claudemesh-cli 1.30.2 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entrypoints/cli.js +149 -53
- package/dist/entrypoints/cli.js.map +10 -9
- package/dist/entrypoints/mcp.js +2 -2
- package/dist/entrypoints/mcp.js.map +1 -1
- package/package.json +1 -1
package/dist/entrypoints/cli.js
CHANGED
|
@@ -104,7 +104,7 @@ __export(exports_urls, {
|
|
|
104
104
|
VERSION: () => VERSION,
|
|
105
105
|
URLS: () => URLS
|
|
106
106
|
});
|
|
107
|
-
var URLS, VERSION = "1.
|
|
107
|
+
var URLS, VERSION = "1.31.0", env;
|
|
108
108
|
var init_urls = __esm(() => {
|
|
109
109
|
URLS = {
|
|
110
110
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -3780,6 +3780,7 @@ __export(exports_lifecycle, {
|
|
|
3780
3780
|
_resetDaemonReadyCache: () => _resetDaemonReadyCache
|
|
3781
3781
|
});
|
|
3782
3782
|
import { existsSync as existsSync6, readFileSync as readFileSync6, statSync, unlinkSync as unlinkSync2, writeFileSync as writeFileSync6 } from "node:fs";
|
|
3783
|
+
import { homedir as homedir3 } from "node:os";
|
|
3783
3784
|
import { join as join4 } from "node:path";
|
|
3784
3785
|
async function ensureDaemonReady(opts = {}) {
|
|
3785
3786
|
if (lastResultThisProcess && (lastResultThisProcess.state === "up" || lastResultThisProcess.state === "started")) {
|
|
@@ -3800,6 +3801,19 @@ async function runEnsureDaemon(opts) {
|
|
|
3800
3801
|
const probe = await probeDaemon();
|
|
3801
3802
|
if (probe === "up")
|
|
3802
3803
|
return { state: "up", durationMs: Date.now() - t0 };
|
|
3804
|
+
if (isServiceManaged()) {
|
|
3805
|
+
if (probe === "stale")
|
|
3806
|
+
cleanupStaleFiles();
|
|
3807
|
+
const polled = await pollForSocket(SERVICE_BUDGET_MS);
|
|
3808
|
+
if (polled.ok)
|
|
3809
|
+
return { state: "up", durationMs: Date.now() - t0 };
|
|
3810
|
+
const tool = process.platform === "darwin" ? `launchctl print gui/$(id -u)/${SERVICE_LABEL}` : `systemctl --user status ${SYSTEMD_UNIT}`;
|
|
3811
|
+
return {
|
|
3812
|
+
state: "service-not-ready",
|
|
3813
|
+
durationMs: Date.now() - t0,
|
|
3814
|
+
reason: `service-managed daemon not responding within ${SERVICE_BUDGET_MS}ms (run \`${tool}\`)`
|
|
3815
|
+
};
|
|
3816
|
+
}
|
|
3803
3817
|
if (probe === "stale")
|
|
3804
3818
|
cleanupStaleFiles();
|
|
3805
3819
|
if (opts.noAutoSpawn) {
|
|
@@ -3819,6 +3833,15 @@ async function runEnsureDaemon(opts) {
|
|
|
3819
3833
|
markSpawnFailure();
|
|
3820
3834
|
return { state: "spawn-failed", durationMs: Date.now() - t0, reason: spawnRes.reason };
|
|
3821
3835
|
}
|
|
3836
|
+
function isServiceManaged() {
|
|
3837
|
+
if (process.platform === "darwin") {
|
|
3838
|
+
return existsSync6(join4(homedir3(), "Library", "LaunchAgents", `${SERVICE_LABEL}.plist`));
|
|
3839
|
+
}
|
|
3840
|
+
if (process.platform === "linux") {
|
|
3841
|
+
return existsSync6(join4(homedir3(), ".config", "systemd", "user", SYSTEMD_UNIT));
|
|
3842
|
+
}
|
|
3843
|
+
return false;
|
|
3844
|
+
}
|
|
3822
3845
|
async function probeDaemon() {
|
|
3823
3846
|
if (!existsSync6(DAEMON_PATHS.SOCK_FILE))
|
|
3824
3847
|
return "absent";
|
|
@@ -3936,7 +3959,7 @@ async function resolveCliBinary() {
|
|
|
3936
3959
|
}
|
|
3937
3960
|
return argv1;
|
|
3938
3961
|
}
|
|
3939
|
-
var SPAWN_LOCK_FILE = () => join4(DAEMON_PATHS.DAEMON_DIR, ".spawn.lock"), SPAWN_FAIL_FILE = () => join4(DAEMON_PATHS.DAEMON_DIR, ".spawn-failure"), SPAWN_FAIL_TTL_MS = 30000, PROBE_TIMEOUT_MS =
|
|
3962
|
+
var SPAWN_LOCK_FILE = () => join4(DAEMON_PATHS.DAEMON_DIR, ".spawn.lock"), SPAWN_FAIL_FILE = () => join4(DAEMON_PATHS.DAEMON_DIR, ".spawn-failure"), SPAWN_FAIL_TTL_MS = 30000, PROBE_TIMEOUT_MS = 2500, SERVICE_BUDGET_MS = 8000, lastResultThisProcess = null, SERVICE_LABEL = "com.claudemesh.daemon", SYSTEMD_UNIT = "claudemesh-daemon.service";
|
|
3940
3963
|
var init_lifecycle = __esm(() => {
|
|
3941
3964
|
init_client3();
|
|
3942
3965
|
init_paths2();
|
|
@@ -3982,7 +4005,7 @@ __export(exports_launch, {
|
|
|
3982
4005
|
import { spawnSync as spawnSync2 } from "node:child_process";
|
|
3983
4006
|
import { randomUUID } from "node:crypto";
|
|
3984
4007
|
import { mkdtempSync, writeFileSync as writeFileSync7, rmSync, readdirSync, statSync as statSync2, existsSync as existsSync7, readFileSync as readFileSync7 } from "node:fs";
|
|
3985
|
-
import { tmpdir, hostname as hostname2, homedir as
|
|
4008
|
+
import { tmpdir, hostname as hostname2, homedir as homedir4 } from "node:os";
|
|
3986
4009
|
import { join as join5 } from "node:path";
|
|
3987
4010
|
import { createInterface as createInterface4 } from "node:readline";
|
|
3988
4011
|
async function ensureDaemonRunning(meshSlug, quiet) {
|
|
@@ -4329,7 +4352,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
4329
4352
|
} catch {}
|
|
4330
4353
|
await ensureDaemonRunning(mesh.slug, args.quiet);
|
|
4331
4354
|
try {
|
|
4332
|
-
const claudeConfigPath = join5(
|
|
4355
|
+
const claudeConfigPath = join5(homedir4(), ".claude.json");
|
|
4333
4356
|
if (existsSync7(claudeConfigPath)) {
|
|
4334
4357
|
const claudeConfig = JSON.parse(readFileSync7(claudeConfigPath, "utf-8"));
|
|
4335
4358
|
const mcpServers = claudeConfig.mcpServers ?? {};
|
|
@@ -4435,7 +4458,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
4435
4458
|
}
|
|
4436
4459
|
const meshMcpEntries = [];
|
|
4437
4460
|
if (serviceCatalog.length > 0) {
|
|
4438
|
-
const claudeConfigPath = join5(
|
|
4461
|
+
const claudeConfigPath = join5(homedir4(), ".claude.json");
|
|
4439
4462
|
let claudeConfig = {};
|
|
4440
4463
|
try {
|
|
4441
4464
|
claudeConfig = JSON.parse(readFileSync7(claudeConfigPath, "utf-8"));
|
|
@@ -4500,9 +4523,9 @@ async function runLaunch(flags, rawArgs) {
|
|
|
4500
4523
|
let claudeBin = "claude";
|
|
4501
4524
|
if (!isWindows2) {
|
|
4502
4525
|
const candidates = [
|
|
4503
|
-
join5(
|
|
4526
|
+
join5(homedir4(), ".local", "bin", "claude"),
|
|
4504
4527
|
"/usr/local/bin/claude",
|
|
4505
|
-
join5(
|
|
4528
|
+
join5(homedir4(), ".claude", "bin", "claude")
|
|
4506
4529
|
];
|
|
4507
4530
|
for (const c of candidates) {
|
|
4508
4531
|
if (existsSync7(c)) {
|
|
@@ -4514,7 +4537,7 @@ async function runLaunch(flags, rawArgs) {
|
|
|
4514
4537
|
const cleanup = () => {
|
|
4515
4538
|
if (meshMcpEntries.length > 0) {
|
|
4516
4539
|
try {
|
|
4517
|
-
const claudeConfigPath = join5(
|
|
4540
|
+
const claudeConfigPath = join5(homedir4(), ".claude.json");
|
|
4518
4541
|
const claudeConfig = JSON.parse(readFileSync7(claudeConfigPath, "utf-8"));
|
|
4519
4542
|
const mcpServers = claudeConfig.mcpServers ?? {};
|
|
4520
4543
|
for (const { key } of meshMcpEntries) {
|
|
@@ -5221,7 +5244,7 @@ __export(exports_join, {
|
|
|
5221
5244
|
import sodium3 from "libsodium-wrappers";
|
|
5222
5245
|
import { writeFileSync as writeFileSync8, mkdirSync as mkdirSync4 } from "node:fs";
|
|
5223
5246
|
import { join as join6, dirname as dirname3 } from "node:path";
|
|
5224
|
-
import { homedir as
|
|
5247
|
+
import { homedir as homedir5, hostname as hostname3 } from "node:os";
|
|
5225
5248
|
function deriveAppBaseUrl() {
|
|
5226
5249
|
const override = process.env.CLAUDEMESH_APP_URL;
|
|
5227
5250
|
if (override)
|
|
@@ -5340,7 +5363,7 @@ async function runJoin(args) {
|
|
|
5340
5363
|
joinedAt: new Date().toISOString()
|
|
5341
5364
|
});
|
|
5342
5365
|
writeConfig(config);
|
|
5343
|
-
const configDir = env.CLAUDEMESH_CONFIG_DIR ?? join6(
|
|
5366
|
+
const configDir = env.CLAUDEMESH_CONFIG_DIR ?? join6(homedir5(), ".claudemesh");
|
|
5344
5367
|
const inviteFile = join6(configDir, `invite-${payload.mesh_slug}.txt`);
|
|
5345
5368
|
try {
|
|
5346
5369
|
mkdirSync4(dirname3(inviteFile), { recursive: true });
|
|
@@ -7580,6 +7603,10 @@ function warnDaemonState(res, opts = {}) {
|
|
|
7580
7603
|
return true;
|
|
7581
7604
|
case "spawn-failed":
|
|
7582
7605
|
process.stderr.write(`${tag("warn")} daemon spawn failed${res.reason ? `: ${res.reason}` : ""} — using cold path ${hint("(check ~/.claudemesh/daemon/daemon.log)")}
|
|
7606
|
+
`);
|
|
7607
|
+
return true;
|
|
7608
|
+
case "service-not-ready":
|
|
7609
|
+
process.stderr.write(`${tag("warn")} ${res.reason ?? "service-managed daemon not responding"} — using cold path ${hint("(check ~/.claudemesh/daemon/daemon.log)")}
|
|
7583
7610
|
`);
|
|
7584
7611
|
return true;
|
|
7585
7612
|
}
|
|
@@ -9307,6 +9334,34 @@ function bindSseStream(res, bus) {
|
|
|
9307
9334
|
return cleanup;
|
|
9308
9335
|
}
|
|
9309
9336
|
|
|
9337
|
+
// src/daemon/process-info.ts
|
|
9338
|
+
import { execFileSync } from "node:child_process";
|
|
9339
|
+
function getProcessStartTime(pid) {
|
|
9340
|
+
if (!Number.isFinite(pid) || pid <= 0)
|
|
9341
|
+
return null;
|
|
9342
|
+
try {
|
|
9343
|
+
const out = execFileSync("ps", ["-o", "lstart=", "-p", String(pid)], {
|
|
9344
|
+
encoding: "utf8",
|
|
9345
|
+
timeout: 1000,
|
|
9346
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
9347
|
+
}).trim();
|
|
9348
|
+
return out.length > 0 ? out : null;
|
|
9349
|
+
} catch {
|
|
9350
|
+
return null;
|
|
9351
|
+
}
|
|
9352
|
+
}
|
|
9353
|
+
function isPidAlive(pid) {
|
|
9354
|
+
if (!Number.isFinite(pid) || pid <= 0)
|
|
9355
|
+
return false;
|
|
9356
|
+
try {
|
|
9357
|
+
process.kill(pid, 0);
|
|
9358
|
+
return true;
|
|
9359
|
+
} catch {
|
|
9360
|
+
return false;
|
|
9361
|
+
}
|
|
9362
|
+
}
|
|
9363
|
+
var init_process_info = () => {};
|
|
9364
|
+
|
|
9310
9365
|
// src/daemon/session-registry.ts
|
|
9311
9366
|
function startReaper() {
|
|
9312
9367
|
if (reaperHandle)
|
|
@@ -9328,7 +9383,8 @@ function registerSession(info) {
|
|
|
9328
9383
|
} catch {}
|
|
9329
9384
|
}
|
|
9330
9385
|
}
|
|
9331
|
-
const
|
|
9386
|
+
const startTime = info.startTime ?? getProcessStartTime(info.pid) ?? undefined;
|
|
9387
|
+
const stored = { ...info, startTime, registeredAt: Date.now() };
|
|
9332
9388
|
byToken.set(info.token, stored);
|
|
9333
9389
|
bySessionId.set(info.sessionId, info.token);
|
|
9334
9390
|
try {
|
|
@@ -9368,10 +9424,16 @@ function reapDead() {
|
|
|
9368
9424
|
dead.push(token);
|
|
9369
9425
|
continue;
|
|
9370
9426
|
}
|
|
9371
|
-
|
|
9372
|
-
process.kill(info.pid, 0);
|
|
9373
|
-
} catch {
|
|
9427
|
+
if (!isPidAlive(info.pid)) {
|
|
9374
9428
|
dead.push(token);
|
|
9429
|
+
continue;
|
|
9430
|
+
}
|
|
9431
|
+
if (info.startTime !== undefined) {
|
|
9432
|
+
const live = getProcessStartTime(info.pid);
|
|
9433
|
+
if (live !== null && live !== info.startTime) {
|
|
9434
|
+
dead.push(token);
|
|
9435
|
+
continue;
|
|
9436
|
+
}
|
|
9375
9437
|
}
|
|
9376
9438
|
}
|
|
9377
9439
|
for (const t of dead)
|
|
@@ -9379,8 +9441,9 @@ function reapDead() {
|
|
|
9379
9441
|
}
|
|
9380
9442
|
var TTL_MS, REAPER_INTERVAL_MS, byToken, bySessionId, hooks, reaperHandle = null;
|
|
9381
9443
|
var init_session_registry = __esm(() => {
|
|
9444
|
+
init_process_info();
|
|
9382
9445
|
TTL_MS = 24 * 60 * 60 * 1000;
|
|
9383
|
-
REAPER_INTERVAL_MS =
|
|
9446
|
+
REAPER_INTERVAL_MS = 5 * 1000;
|
|
9384
9447
|
byToken = new Map;
|
|
9385
9448
|
bySessionId = new Map;
|
|
9386
9449
|
hooks = {};
|
|
@@ -9508,7 +9571,12 @@ function makeHandler(opts) {
|
|
|
9508
9571
|
return;
|
|
9509
9572
|
}
|
|
9510
9573
|
if (req.method === "GET" && url.pathname === "/v1/health") {
|
|
9511
|
-
|
|
9574
|
+
const brokers = {};
|
|
9575
|
+
if (opts.brokers) {
|
|
9576
|
+
for (const [slug, client] of opts.brokers)
|
|
9577
|
+
brokers[slug] = client.status;
|
|
9578
|
+
}
|
|
9579
|
+
respond(res, 200, { ok: true, pid: process.pid, brokers });
|
|
9512
9580
|
return;
|
|
9513
9581
|
}
|
|
9514
9582
|
if (req.method === "POST" && url.pathname === "/v1/sessions/register") {
|
|
@@ -11463,7 +11531,7 @@ __export(exports_service_install, {
|
|
|
11463
11531
|
});
|
|
11464
11532
|
import { existsSync as existsSync12, mkdirSync as mkdirSync7, writeFileSync as writeFileSync11, unlinkSync as unlinkSync5, readFileSync as readFileSync11 } from "node:fs";
|
|
11465
11533
|
import { execSync as execSync2 } from "node:child_process";
|
|
11466
|
-
import { homedir as
|
|
11534
|
+
import { homedir as homedir6 } from "node:os";
|
|
11467
11535
|
import { join as join8, dirname as dirname5 } from "node:path";
|
|
11468
11536
|
function detectPlatform() {
|
|
11469
11537
|
if (process.platform === "darwin")
|
|
@@ -11496,7 +11564,7 @@ function uninstallService() {
|
|
|
11496
11564
|
if (platform5 === "darwin") {
|
|
11497
11565
|
const p = darwinPlistPath();
|
|
11498
11566
|
try {
|
|
11499
|
-
execSync2(`launchctl bootout gui/$(id -u)/${
|
|
11567
|
+
execSync2(`launchctl bootout gui/$(id -u)/${SERVICE_LABEL2}`, { stdio: "ignore" });
|
|
11500
11568
|
} catch {}
|
|
11501
11569
|
if (existsSync12(p)) {
|
|
11502
11570
|
unlinkSync5(p);
|
|
@@ -11505,7 +11573,7 @@ function uninstallService() {
|
|
|
11505
11573
|
} else if (platform5 === "linux") {
|
|
11506
11574
|
const p = linuxUnitPath();
|
|
11507
11575
|
try {
|
|
11508
|
-
execSync2(`systemctl --user disable --now ${
|
|
11576
|
+
execSync2(`systemctl --user disable --now ${SYSTEMD_UNIT2}`, { stdio: "ignore" });
|
|
11509
11577
|
} catch {}
|
|
11510
11578
|
if (existsSync12(p)) {
|
|
11511
11579
|
unlinkSync5(p);
|
|
@@ -11515,7 +11583,7 @@ function uninstallService() {
|
|
|
11515
11583
|
return { platform: platform5, removed };
|
|
11516
11584
|
}
|
|
11517
11585
|
function darwinPlistPath() {
|
|
11518
|
-
return join8(
|
|
11586
|
+
return join8(homedir6(), "Library", "LaunchAgents", `${SERVICE_LABEL2}.plist`);
|
|
11519
11587
|
}
|
|
11520
11588
|
function installDarwin(args) {
|
|
11521
11589
|
const plist = darwinPlistPath();
|
|
@@ -11535,7 +11603,7 @@ function installDarwin(args) {
|
|
|
11535
11603
|
<plist version="1.0">
|
|
11536
11604
|
<dict>
|
|
11537
11605
|
<key>Label</key>
|
|
11538
|
-
<string>${
|
|
11606
|
+
<string>${SERVICE_LABEL2}</string>
|
|
11539
11607
|
<key>ProgramArguments</key>
|
|
11540
11608
|
<array>
|
|
11541
11609
|
<string>${escapeXml(nodeBin)}</string>
|
|
@@ -11550,11 +11618,11 @@ function installDarwin(args) {
|
|
|
11550
11618
|
<key>StandardErrorPath</key>
|
|
11551
11619
|
<string>${escapeXml(log2)}</string>
|
|
11552
11620
|
<key>WorkingDirectory</key>
|
|
11553
|
-
<string>${escapeXml(
|
|
11621
|
+
<string>${escapeXml(homedir6())}</string>
|
|
11554
11622
|
<key>EnvironmentVariables</key>
|
|
11555
11623
|
<dict>
|
|
11556
11624
|
<key>HOME</key>
|
|
11557
|
-
<string>${escapeXml(
|
|
11625
|
+
<string>${escapeXml(homedir6())}</string>
|
|
11558
11626
|
<key>PATH</key>
|
|
11559
11627
|
<string>/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
|
|
11560
11628
|
</dict>
|
|
@@ -11563,7 +11631,7 @@ function installDarwin(args) {
|
|
|
11563
11631
|
`;
|
|
11564
11632
|
writeFileSync11(plist, xml, { mode: 420 });
|
|
11565
11633
|
try {
|
|
11566
|
-
execSync2(`launchctl bootout gui/$(id -u)/${
|
|
11634
|
+
execSync2(`launchctl bootout gui/$(id -u)/${SERVICE_LABEL2}`, { stdio: "ignore" });
|
|
11567
11635
|
} catch {}
|
|
11568
11636
|
try {
|
|
11569
11637
|
const pidPath = DAEMON_PATHS.PID_FILE;
|
|
@@ -11583,7 +11651,7 @@ function installDarwin(args) {
|
|
|
11583
11651
|
};
|
|
11584
11652
|
}
|
|
11585
11653
|
function linuxUnitPath() {
|
|
11586
|
-
return join8(
|
|
11654
|
+
return join8(homedir6(), ".config", "systemd", "user", SYSTEMD_UNIT2);
|
|
11587
11655
|
}
|
|
11588
11656
|
function installLinux(args) {
|
|
11589
11657
|
const unit = linuxUnitPath();
|
|
@@ -11614,7 +11682,7 @@ WantedBy=default.target
|
|
|
11614
11682
|
`;
|
|
11615
11683
|
writeFileSync11(unit, content, { mode: 420 });
|
|
11616
11684
|
try {
|
|
11617
|
-
execSync2(`systemctl --user stop ${
|
|
11685
|
+
execSync2(`systemctl --user stop ${SYSTEMD_UNIT2}`, { stdio: "ignore" });
|
|
11618
11686
|
} catch {}
|
|
11619
11687
|
try {
|
|
11620
11688
|
const pidPath = DAEMON_PATHS.PID_FILE;
|
|
@@ -11630,7 +11698,7 @@ WantedBy=default.target
|
|
|
11630
11698
|
return {
|
|
11631
11699
|
platform: "linux",
|
|
11632
11700
|
unitPath: unit,
|
|
11633
|
-
bootCommand: `systemctl --user daemon-reload && systemctl --user enable --now ${
|
|
11701
|
+
bootCommand: `systemctl --user daemon-reload && systemctl --user enable --now ${SYSTEMD_UNIT2}`
|
|
11634
11702
|
};
|
|
11635
11703
|
}
|
|
11636
11704
|
function escapeXml(s) {
|
|
@@ -11654,7 +11722,7 @@ function readInstalledUnit() {
|
|
|
11654
11722
|
return { platform: platform5, path: path2, content: null };
|
|
11655
11723
|
}
|
|
11656
11724
|
}
|
|
11657
|
-
var
|
|
11725
|
+
var SERVICE_LABEL2 = "com.claudemesh.daemon", SYSTEMD_UNIT2 = "claudemesh-daemon.service";
|
|
11658
11726
|
var init_service_install = __esm(() => {
|
|
11659
11727
|
init_paths2();
|
|
11660
11728
|
});
|
|
@@ -11991,7 +12059,7 @@ import {
|
|
|
11991
12059
|
readFileSync as readFileSync12,
|
|
11992
12060
|
writeFileSync as writeFileSync12
|
|
11993
12061
|
} from "node:fs";
|
|
11994
|
-
import { homedir as
|
|
12062
|
+
import { homedir as homedir7, platform as platform5 } from "node:os";
|
|
11995
12063
|
import { dirname as dirname6, join as join9, resolve } from "node:path";
|
|
11996
12064
|
import { fileURLToPath } from "node:url";
|
|
11997
12065
|
import { spawnSync as spawnSync3 } from "node:child_process";
|
|
@@ -12234,7 +12302,7 @@ function installStatusLine() {
|
|
|
12234
12302
|
writeClaudeSettings(settings);
|
|
12235
12303
|
return { installed: true };
|
|
12236
12304
|
}
|
|
12237
|
-
function runInstall(args = []) {
|
|
12305
|
+
async function runInstall(args = []) {
|
|
12238
12306
|
const skipHooks = args.includes("--no-hooks");
|
|
12239
12307
|
const skipSkill = args.includes("--no-skill");
|
|
12240
12308
|
const skipService = args.includes("--no-service");
|
|
@@ -12325,7 +12393,7 @@ function runInstall(args = []) {
|
|
|
12325
12393
|
} catch {}
|
|
12326
12394
|
if (!skipService && hasMeshes) {
|
|
12327
12395
|
try {
|
|
12328
|
-
installDaemonService(entry);
|
|
12396
|
+
await installDaemonService(entry);
|
|
12329
12397
|
} catch (e) {
|
|
12330
12398
|
render.warn(`daemon service install failed: ${e instanceof Error ? e.message : String(e)}`, "Run `claudemesh daemon install-service` to retry.");
|
|
12331
12399
|
}
|
|
@@ -12353,7 +12421,7 @@ function runInstall(args = []) {
|
|
|
12353
12421
|
render.info(dim(` claudemesh install --status-line # live peer count in Claude Code`));
|
|
12354
12422
|
render.info(dim(` claudemesh completions zsh # shell completions`));
|
|
12355
12423
|
}
|
|
12356
|
-
function installDaemonService(binaryEntry) {
|
|
12424
|
+
async function installDaemonService(binaryEntry) {
|
|
12357
12425
|
const {
|
|
12358
12426
|
installService: installService2,
|
|
12359
12427
|
detectPlatform: detectPlatform2
|
|
@@ -12385,7 +12453,35 @@ function installDaemonService(binaryEntry) {
|
|
|
12385
12453
|
render.ok("daemon started");
|
|
12386
12454
|
} catch (e) {
|
|
12387
12455
|
render.warn(`daemon service installed but failed to start: ${e instanceof Error ? e.message : String(e)}`, `Run manually: ${r.bootCommand}`);
|
|
12456
|
+
return;
|
|
12388
12457
|
}
|
|
12458
|
+
await verifyBrokerConnectivity();
|
|
12459
|
+
}
|
|
12460
|
+
async function verifyBrokerConnectivity() {
|
|
12461
|
+
const VERIFY_BUDGET_MS = 15000;
|
|
12462
|
+
const POLL_INTERVAL_MS2 = 500;
|
|
12463
|
+
const { ipc: ipc2 } = await Promise.resolve().then(() => (init_client3(), exports_client));
|
|
12464
|
+
const start = Date.now();
|
|
12465
|
+
let lastBrokers = {};
|
|
12466
|
+
while (Date.now() - start < VERIFY_BUDGET_MS) {
|
|
12467
|
+
try {
|
|
12468
|
+
const res = await ipc2({
|
|
12469
|
+
path: "/v1/health",
|
|
12470
|
+
timeoutMs: 2000
|
|
12471
|
+
});
|
|
12472
|
+
lastBrokers = res.body?.brokers ?? {};
|
|
12473
|
+
const openMesh = Object.entries(lastBrokers).find(([, s]) => s === "open");
|
|
12474
|
+
if (openMesh) {
|
|
12475
|
+
const others = Object.entries(lastBrokers).filter(([slug]) => slug !== openMesh[0]);
|
|
12476
|
+
const tail = others.length > 0 ? `, ${others.length} other mesh${others.length === 1 ? "" : "es"} attaching` : "";
|
|
12477
|
+
render.ok(`broker connected (mesh=${openMesh[0]}${tail})`);
|
|
12478
|
+
return;
|
|
12479
|
+
}
|
|
12480
|
+
} catch {}
|
|
12481
|
+
await new Promise((r) => setTimeout(r, POLL_INTERVAL_MS2));
|
|
12482
|
+
}
|
|
12483
|
+
const states = Object.keys(lastBrokers).length === 0 ? "no health response from daemon" : Object.entries(lastBrokers).map(([m, s]) => `${m}=${s}`).join(", ");
|
|
12484
|
+
render.warn(`broker did not reach open within ${Math.round(VERIFY_BUDGET_MS / 1000)}s (${states})`, "Check ~/.claudemesh/daemon/daemon.log for connect errors. Common causes: outbound :443 blocked, expired TLS, DNS resolution.");
|
|
12389
12485
|
}
|
|
12390
12486
|
function runUninstall() {
|
|
12391
12487
|
render.section("claudemesh uninstall");
|
|
@@ -12432,9 +12528,9 @@ var init_install = __esm(() => {
|
|
|
12432
12528
|
init_facade();
|
|
12433
12529
|
init_render();
|
|
12434
12530
|
init_styles();
|
|
12435
|
-
CLAUDE_CONFIG = join9(
|
|
12436
|
-
CLAUDE_SETTINGS = join9(
|
|
12437
|
-
CLAUDE_SKILLS_ROOT = join9(
|
|
12531
|
+
CLAUDE_CONFIG = join9(homedir7(), ".claude.json");
|
|
12532
|
+
CLAUDE_SETTINGS = join9(homedir7(), ".claude", "settings.json");
|
|
12533
|
+
CLAUDE_SKILLS_ROOT = join9(homedir7(), ".claude", "skills");
|
|
12438
12534
|
CLAUDEMESH_TOOLS = [
|
|
12439
12535
|
"mcp__claudemesh__cancel_scheduled",
|
|
12440
12536
|
"mcp__claudemesh__check_messages",
|
|
@@ -12491,7 +12587,7 @@ __export(exports_uninstall, {
|
|
|
12491
12587
|
});
|
|
12492
12588
|
import { readFileSync as readFileSync13, writeFileSync as writeFileSync13, existsSync as existsSync14, rmSync as rmSync2, readdirSync as readdirSync2 } from "node:fs";
|
|
12493
12589
|
import { join as join10, dirname as dirname7 } from "node:path";
|
|
12494
|
-
import { homedir as
|
|
12590
|
+
import { homedir as homedir8 } from "node:os";
|
|
12495
12591
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
12496
12592
|
function bundledSkillsDir() {
|
|
12497
12593
|
const here = fileURLToPath2(import.meta.url);
|
|
@@ -12578,7 +12674,7 @@ var init_uninstall = __esm(() => {
|
|
|
12578
12674
|
init_render();
|
|
12579
12675
|
init_styles();
|
|
12580
12676
|
init_exit_codes();
|
|
12581
|
-
CLAUDE_SKILLS_ROOT2 = join10(
|
|
12677
|
+
CLAUDE_SKILLS_ROOT2 = join10(homedir8(), ".claude", "skills");
|
|
12582
12678
|
});
|
|
12583
12679
|
|
|
12584
12680
|
// src/commands/doctor.ts
|
|
@@ -12587,7 +12683,7 @@ __export(exports_doctor, {
|
|
|
12587
12683
|
runDoctor: () => runDoctor
|
|
12588
12684
|
});
|
|
12589
12685
|
import { existsSync as existsSync15, readFileSync as readFileSync14, statSync as statSync3 } from "node:fs";
|
|
12590
|
-
import { homedir as
|
|
12686
|
+
import { homedir as homedir9, platform as platform6 } from "node:os";
|
|
12591
12687
|
import { join as join11 } from "node:path";
|
|
12592
12688
|
import { spawnSync as spawnSync4 } from "node:child_process";
|
|
12593
12689
|
function checkNode() {
|
|
@@ -12612,7 +12708,7 @@ function checkClaudeOnPath() {
|
|
|
12612
12708
|
};
|
|
12613
12709
|
}
|
|
12614
12710
|
function checkMcpRegistered() {
|
|
12615
|
-
const claudeConfig = join11(
|
|
12711
|
+
const claudeConfig = join11(homedir9(), ".claude.json");
|
|
12616
12712
|
if (!existsSync15(claudeConfig)) {
|
|
12617
12713
|
return {
|
|
12618
12714
|
name: "claudemesh MCP registered in ~/.claude.json",
|
|
@@ -12638,7 +12734,7 @@ function checkMcpRegistered() {
|
|
|
12638
12734
|
}
|
|
12639
12735
|
}
|
|
12640
12736
|
function checkHooksRegistered() {
|
|
12641
|
-
const settings = join11(
|
|
12737
|
+
const settings = join11(homedir9(), ".claude", "settings.json");
|
|
12642
12738
|
if (!existsSync15(settings)) {
|
|
12643
12739
|
return {
|
|
12644
12740
|
name: "Status hooks registered in ~/.claude/settings.json",
|
|
@@ -13572,7 +13668,7 @@ var exports_url_handler = {};
|
|
|
13572
13668
|
__export(exports_url_handler, {
|
|
13573
13669
|
runUrlHandler: () => runUrlHandler
|
|
13574
13670
|
});
|
|
13575
|
-
import { platform as platform7, homedir as
|
|
13671
|
+
import { platform as platform7, homedir as homedir10 } from "node:os";
|
|
13576
13672
|
import { existsSync as existsSync21, mkdirSync as mkdirSync9, writeFileSync as writeFileSync14, rmSync as rmSync3, chmodSync as chmodSync5 } from "node:fs";
|
|
13577
13673
|
import { join as join12 } from "node:path";
|
|
13578
13674
|
import { spawnSync as spawnSync5 } from "node:child_process";
|
|
@@ -13581,7 +13677,7 @@ function resolveClaudemeshBin() {
|
|
|
13581
13677
|
}
|
|
13582
13678
|
function installDarwin2() {
|
|
13583
13679
|
const binPath = resolveClaudemeshBin();
|
|
13584
|
-
const appDir = join12(
|
|
13680
|
+
const appDir = join12(homedir10(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
|
|
13585
13681
|
const contents = join12(appDir, "Contents");
|
|
13586
13682
|
const macOS = join12(contents, "MacOS");
|
|
13587
13683
|
mkdirSync9(macOS, { recursive: true });
|
|
@@ -13633,7 +13729,7 @@ EOF
|
|
|
13633
13729
|
}
|
|
13634
13730
|
function installLinux2() {
|
|
13635
13731
|
const binPath = resolveClaudemeshBin();
|
|
13636
|
-
const appsDir = join12(
|
|
13732
|
+
const appsDir = join12(homedir10(), ".local", "share", "applications");
|
|
13637
13733
|
mkdirSync9(appsDir, { recursive: true });
|
|
13638
13734
|
const desktop = `[Desktop Entry]
|
|
13639
13735
|
Type=Application
|
|
@@ -13668,7 +13764,7 @@ function installWindows() {
|
|
|
13668
13764
|
`[HKEY_CURRENT_USER\\Software\\Classes\\claudemesh\\shell\\open\\command]`,
|
|
13669
13765
|
`@="\\"${binPath.replace(/\\/g, "\\\\")}\\" \\"%1\\""`
|
|
13670
13766
|
];
|
|
13671
|
-
const regPath = join12(
|
|
13767
|
+
const regPath = join12(homedir10(), "claudemesh-handler.reg");
|
|
13672
13768
|
writeFileSync14(regPath, lines.join(`\r
|
|
13673
13769
|
`));
|
|
13674
13770
|
const res = spawnSync5("reg.exe", ["import", regPath], { encoding: "utf-8" });
|
|
@@ -13680,14 +13776,14 @@ function installWindows() {
|
|
|
13680
13776
|
return EXIT.SUCCESS;
|
|
13681
13777
|
}
|
|
13682
13778
|
function uninstallDarwin() {
|
|
13683
|
-
const appDir = join12(
|
|
13779
|
+
const appDir = join12(homedir10(), "Library", "Application Support", "claudemesh", "ClaudemeshHandler.app");
|
|
13684
13780
|
if (existsSync21(appDir))
|
|
13685
13781
|
rmSync3(appDir, { recursive: true, force: true });
|
|
13686
13782
|
render.ok("removed claudemesh:// handler on macOS");
|
|
13687
13783
|
return EXIT.SUCCESS;
|
|
13688
13784
|
}
|
|
13689
13785
|
function uninstallLinux() {
|
|
13690
|
-
const desktopPath = join12(
|
|
13786
|
+
const desktopPath = join12(homedir10(), ".local", "share", "applications", "claudemesh.desktop");
|
|
13691
13787
|
if (existsSync21(desktopPath))
|
|
13692
13788
|
rmSync3(desktopPath, { force: true });
|
|
13693
13789
|
render.ok("removed claudemesh:// handler on Linux");
|
|
@@ -13735,7 +13831,7 @@ __export(exports_status_line, {
|
|
|
13735
13831
|
});
|
|
13736
13832
|
import { existsSync as existsSync22, readFileSync as readFileSync18 } from "node:fs";
|
|
13737
13833
|
import { join as join13 } from "node:path";
|
|
13738
|
-
import { homedir as
|
|
13834
|
+
import { homedir as homedir11 } from "node:os";
|
|
13739
13835
|
async function runStatusLine() {
|
|
13740
13836
|
try {
|
|
13741
13837
|
const config = readConfig();
|
|
@@ -13743,7 +13839,7 @@ async function runStatusLine() {
|
|
|
13743
13839
|
process.stdout.write("◇ claudemesh (not joined)");
|
|
13744
13840
|
return EXIT.SUCCESS;
|
|
13745
13841
|
}
|
|
13746
|
-
const cachePath = join13(
|
|
13842
|
+
const cachePath = join13(homedir11(), ".claudemesh", "peer-cache.json");
|
|
13747
13843
|
let cache = {};
|
|
13748
13844
|
if (existsSync22(cachePath)) {
|
|
13749
13845
|
try {
|
|
@@ -13987,7 +14083,7 @@ __export(exports_grants, {
|
|
|
13987
14083
|
isAllowed: () => isAllowed
|
|
13988
14084
|
});
|
|
13989
14085
|
import { existsSync as existsSync25, mkdirSync as mkdirSync10, readFileSync as readFileSync20, writeFileSync as writeFileSync16 } from "node:fs";
|
|
13990
|
-
import { homedir as
|
|
14086
|
+
import { homedir as homedir12 } from "node:os";
|
|
13991
14087
|
import { join as join15 } from "node:path";
|
|
13992
14088
|
async function syncToBroker(meshSlug, grants) {
|
|
13993
14089
|
const auth = getStoredToken();
|
|
@@ -14015,7 +14111,7 @@ function readGrants() {
|
|
|
14015
14111
|
}
|
|
14016
14112
|
}
|
|
14017
14113
|
function writeGrants(g) {
|
|
14018
|
-
const dir = join15(
|
|
14114
|
+
const dir = join15(homedir12(), ".claudemesh");
|
|
14019
14115
|
if (!existsSync25(dir))
|
|
14020
14116
|
mkdirSync10(dir, { recursive: true });
|
|
14021
14117
|
writeFileSync16(GRANT_FILE, JSON.stringify(g, null, 2), { mode: 384 });
|
|
@@ -14174,7 +14270,7 @@ var init_grants = __esm(() => {
|
|
|
14174
14270
|
BROKER_HTTP7 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
|
|
14175
14271
|
ALL_CAPS = ["read", "dm", "broadcast", "state-read", "state-write", "file-read"];
|
|
14176
14272
|
DEFAULT_CAPS = ["read", "dm", "broadcast", "state-read"];
|
|
14177
|
-
GRANT_FILE = join15(
|
|
14273
|
+
GRANT_FILE = join15(homedir12(), ".claudemesh", "grants.json");
|
|
14178
14274
|
});
|
|
14179
14275
|
|
|
14180
14276
|
// src/commands/profile.ts
|
|
@@ -19213,7 +19309,7 @@ async function main() {
|
|
|
19213
19309
|
}
|
|
19214
19310
|
case "install": {
|
|
19215
19311
|
const { runInstall: runInstall2 } = await Promise.resolve().then(() => (init_install(), exports_install));
|
|
19216
|
-
runInstall2(positionals);
|
|
19312
|
+
await runInstall2(positionals);
|
|
19217
19313
|
break;
|
|
19218
19314
|
}
|
|
19219
19315
|
case "uninstall": {
|
|
@@ -19893,4 +19989,4 @@ main().catch((err) => {
|
|
|
19893
19989
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
19894
19990
|
});
|
|
19895
19991
|
|
|
19896
|
-
//# debugId=
|
|
19992
|
+
//# debugId=CD2B8A691C15D42A64756E2164756E21
|