fix(cli): 1.30.2 — daemon service unit attaches to every joined mesh
claudemesh install was baking --mesh <primary> into the launchd plist / systemd unit, locking the daemon to a single mesh and contradicting 1.26.0's multi-mesh design. users with >1 joined mesh fell off the daemon path on every non-primary verb (cold-WS fallback, peer list returning all meshes because the server-side filter ran against zero attached state, "daemon spawn failed: socket did not appear" from launched sessions in sibling meshes). now: meshSlug is optional in InstallArgs; claudemesh install omits it so the unit runs `claudemesh daemon up` with no flag, which attaches to every joined mesh. `claudemesh daemon install-service --mesh <slug>` is preserved as opt-in for single-mesh hosts and CI. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -190,13 +190,11 @@ async function runInstallService(opts: DaemonOptions): Promise<number> {
|
||||
process.stderr.write(`unsupported platform: ${process.platform}\n`);
|
||||
return 2;
|
||||
}
|
||||
if (!opts.mesh) {
|
||||
process.stderr.write(`pass --mesh <slug> so the service knows which mesh to attach to\n`);
|
||||
return 2;
|
||||
}
|
||||
// Resolve the binary path. Prefer the running argv[0] when it's an
|
||||
// installed claudemesh binary; fall back to whichever `claudemesh` is
|
||||
// first on PATH.
|
||||
// first on PATH. --mesh is now optional: omit it to attach to every
|
||||
// joined mesh (the 1.26.0 multi-mesh default); pass it to lock the
|
||||
// unit to a single mesh for testing or single-mesh hosts.
|
||||
let binary = process.argv[1] ?? "";
|
||||
if (!binary || /\.ts$/.test(binary) || /node_modules|src\/entrypoints/.test(binary)) {
|
||||
try {
|
||||
@@ -210,8 +208,8 @@ async function runInstallService(opts: DaemonOptions): Promise<number> {
|
||||
try {
|
||||
const r = installService({
|
||||
binaryPath: binary,
|
||||
meshSlug: opts.mesh,
|
||||
displayName: opts.displayName,
|
||||
...(opts.mesh ? { meshSlug: opts.mesh } : {}),
|
||||
...(opts.displayName ? { displayName: opts.displayName } : {}),
|
||||
});
|
||||
if (opts.json) {
|
||||
process.stdout.write(JSON.stringify({ ok: true, ...r }) + "\n");
|
||||
|
||||
@@ -545,23 +545,25 @@ export function runInstall(args: string[] = []): void {
|
||||
}
|
||||
|
||||
let hasMeshes = false;
|
||||
let primaryMesh: string | undefined;
|
||||
try {
|
||||
const meshConfig = readConfig();
|
||||
hasMeshes = meshConfig.meshes.length > 0;
|
||||
primaryMesh = meshConfig.meshes[0]?.slug;
|
||||
} catch {}
|
||||
|
||||
// Daemon service install — required for MCP integration as of 1.24.0.
|
||||
// The daemon owns the broker WS and feeds the MCP push-pipe via SSE;
|
||||
// skipping it leaves channel push, slash commands, and resources broken.
|
||||
if (!skipService && hasMeshes && primaryMesh) {
|
||||
// 1.30.2: install no longer locks the unit to a single mesh; the
|
||||
// daemon attaches to every joined mesh on boot (1.26.0 multi-mesh
|
||||
// design). Users who want single-mesh can pass `claudemesh daemon
|
||||
// install-service --mesh <slug>` explicitly.
|
||||
if (!skipService && hasMeshes) {
|
||||
try {
|
||||
installDaemonService(entry, primaryMesh);
|
||||
installDaemonService(entry);
|
||||
} catch (e) {
|
||||
render.warn(
|
||||
`daemon service install failed: ${e instanceof Error ? e.message : String(e)}`,
|
||||
"Run `claudemesh daemon install-service --mesh <slug>` to retry.",
|
||||
"Run `claudemesh daemon install-service` to retry.",
|
||||
);
|
||||
}
|
||||
} else if (skipService) {
|
||||
@@ -601,7 +603,7 @@ export function runInstall(args: string[] = []): void {
|
||||
* the user knows there's a problem before it shows up as "no messages
|
||||
* arriving."
|
||||
*/
|
||||
function installDaemonService(binaryEntry: string, meshSlug: string): void {
|
||||
function installDaemonService(binaryEntry: string): void {
|
||||
const {
|
||||
installService,
|
||||
detectPlatform,
|
||||
@@ -625,17 +627,17 @@ function installDaemonService(binaryEntry: string, meshSlug: string): void {
|
||||
} catch {
|
||||
render.warn(
|
||||
"couldn't resolve a 'claudemesh' binary on PATH; daemon service skipped",
|
||||
"Install via npm/homebrew, then run `claudemesh daemon install-service --mesh " + meshSlug + "`",
|
||||
"Install via npm/homebrew, then run `claudemesh daemon install-service`",
|
||||
);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
const r = installService({ binaryPath: binary, meshSlug });
|
||||
const r = installService({ binaryPath: binary });
|
||||
render.ok(`daemon service installed (${r.platform})`);
|
||||
render.kv([
|
||||
["unit", dim(r.unitPath)],
|
||||
["mesh", dim(meshSlug)],
|
||||
["mesh", dim("(all joined meshes)")],
|
||||
]);
|
||||
|
||||
// Boot the unit immediately so MCP has a daemon to attach to on next
|
||||
|
||||
@@ -38,8 +38,13 @@ function isCi(): boolean {
|
||||
export interface InstallArgs {
|
||||
/** Path to the `claudemesh` binary, e.g. /opt/homebrew/bin/claudemesh */
|
||||
binaryPath: string;
|
||||
/** Mesh slug to attach to. */
|
||||
meshSlug: string;
|
||||
/**
|
||||
* Optional mesh slug to lock the daemon to. Omit (the new default) so
|
||||
* the daemon attaches to every joined mesh — matches the 1.26.0
|
||||
* multi-mesh design. Single-mesh lock is preserved for users who
|
||||
* explicitly want it (testing, CI, host with one mesh).
|
||||
*/
|
||||
meshSlug?: string;
|
||||
/** Optional display name. */
|
||||
displayName?: string;
|
||||
/** Override the auto-detected CI refusal. */
|
||||
@@ -97,8 +102,9 @@ function installDarwin(args: InstallArgs): InstallResult {
|
||||
`<string>${escapeXml(args.binaryPath)}</string>`,
|
||||
"<string>daemon</string>",
|
||||
"<string>up</string>",
|
||||
"<string>--mesh</string>",
|
||||
`<string>${escapeXml(args.meshSlug)}</string>`,
|
||||
...(args.meshSlug
|
||||
? ["<string>--mesh</string>", `<string>${escapeXml(args.meshSlug)}</string>`]
|
||||
: []),
|
||||
...(args.displayName ? ["<string>--name</string>", `<string>${escapeXml(args.displayName)}</string>`] : []),
|
||||
].join("\n ");
|
||||
|
||||
@@ -176,7 +182,7 @@ function installLinux(args: InstallArgs): InstallResult {
|
||||
const nodeBin = process.execPath;
|
||||
const execArgs = [
|
||||
"daemon", "up",
|
||||
"--mesh", args.meshSlug,
|
||||
...(args.meshSlug ? ["--mesh", args.meshSlug] : []),
|
||||
...(args.displayName ? ["--name", args.displayName] : []),
|
||||
].map(shellQuote).join(" ");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user