claudemesh-cli 1.0.0-alpha.41 → 1.0.0-alpha.42
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 +88 -13
- package/dist/entrypoints/cli.js.map +4 -4
- package/dist/entrypoints/mcp.js +86 -12
- package/dist/entrypoints/mcp.js.map +3 -3
- package/package.json +1 -1
package/dist/entrypoints/mcp.js
CHANGED
|
@@ -3525,7 +3525,7 @@ __export(exports_urls, {
|
|
|
3525
3525
|
VERSION: () => VERSION,
|
|
3526
3526
|
URLS: () => URLS
|
|
3527
3527
|
});
|
|
3528
|
-
var URLS, VERSION = "1.0.0-alpha.
|
|
3528
|
+
var URLS, VERSION = "1.0.0-alpha.42", env;
|
|
3529
3529
|
var init_urls = __esm(() => {
|
|
3530
3530
|
URLS = {
|
|
3531
3531
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -4442,7 +4442,7 @@ async function resolveClient(to) {
|
|
|
4442
4442
|
target = rest;
|
|
4443
4443
|
}
|
|
4444
4444
|
}
|
|
4445
|
-
if (
|
|
4445
|
+
if (target.startsWith("#") || target.startsWith("@") || target === "*") {
|
|
4446
4446
|
if (targetClients.length === 1) {
|
|
4447
4447
|
return { client: targetClients[0], targetSpec: target };
|
|
4448
4448
|
}
|
|
@@ -4452,21 +4452,95 @@ async function resolveClient(to) {
|
|
|
4452
4452
|
error: `multiple meshes joined; prefix target with "<mesh-slug>:" (joined: ${clients2.map((c) => c.meshSlug).join(", ")})`
|
|
4453
4453
|
};
|
|
4454
4454
|
}
|
|
4455
|
+
if (/^[0-9a-f]{8,64}$/.test(target)) {
|
|
4456
|
+
const hits = [];
|
|
4457
|
+
for (const c of targetClients) {
|
|
4458
|
+
const peers = await c.listPeers();
|
|
4459
|
+
for (const p of peers) {
|
|
4460
|
+
if (p.pubkey.startsWith(target)) {
|
|
4461
|
+
hits.push({ mesh: c, pubkey: p.pubkey, displayName: p.displayName });
|
|
4462
|
+
}
|
|
4463
|
+
}
|
|
4464
|
+
}
|
|
4465
|
+
if (hits.length === 1) {
|
|
4466
|
+
return { client: hits[0].mesh, targetSpec: hits[0].pubkey };
|
|
4467
|
+
}
|
|
4468
|
+
if (hits.length > 1) {
|
|
4469
|
+
const lines = hits.map((h) => ` - ${h.displayName} @ ${h.mesh.meshSlug} · pubkey ${h.pubkey.slice(0, 20)}…`).join(`
|
|
4470
|
+
`);
|
|
4471
|
+
return {
|
|
4472
|
+
client: null,
|
|
4473
|
+
targetSpec: target,
|
|
4474
|
+
error: `ambiguous pubkey prefix "${target}" matches ${hits.length} peers:
|
|
4475
|
+
${lines}
|
|
4476
|
+
Use a longer prefix.`
|
|
4477
|
+
};
|
|
4478
|
+
}
|
|
4479
|
+
if (target.length === 64) {
|
|
4480
|
+
if (targetClients.length === 1) {
|
|
4481
|
+
return { client: targetClients[0], targetSpec: target };
|
|
4482
|
+
}
|
|
4483
|
+
return {
|
|
4484
|
+
client: null,
|
|
4485
|
+
targetSpec: target,
|
|
4486
|
+
error: `multiple meshes joined; prefix target with "<mesh-slug>:" (joined: ${clients2.map((c) => c.meshSlug).join(", ")})`
|
|
4487
|
+
};
|
|
4488
|
+
}
|
|
4489
|
+
return {
|
|
4490
|
+
client: null,
|
|
4491
|
+
targetSpec: target,
|
|
4492
|
+
error: `no online peer's pubkey starts with "${target}".`
|
|
4493
|
+
};
|
|
4494
|
+
}
|
|
4455
4495
|
const nameLower = target.toLowerCase();
|
|
4456
4496
|
const candidates = [];
|
|
4497
|
+
const exactMatches = [];
|
|
4498
|
+
const partialMatches = [];
|
|
4457
4499
|
for (const c of targetClients) {
|
|
4500
|
+
const ownSession = c.getSessionPubkey();
|
|
4458
4501
|
const peers = await c.listPeers();
|
|
4459
4502
|
candidates.push({ mesh: c.meshSlug, peers });
|
|
4460
|
-
const
|
|
4461
|
-
|
|
4462
|
-
|
|
4463
|
-
|
|
4464
|
-
|
|
4465
|
-
|
|
4466
|
-
|
|
4467
|
-
|
|
4503
|
+
for (const p of peers) {
|
|
4504
|
+
if (ownSession && p.pubkey === ownSession)
|
|
4505
|
+
continue;
|
|
4506
|
+
const nameLow = p.displayName.toLowerCase();
|
|
4507
|
+
if (nameLow === nameLower) {
|
|
4508
|
+
exactMatches.push({ mesh: c, pubkey: p.pubkey, displayName: p.displayName, cwd: p.cwd });
|
|
4509
|
+
} else if (nameLow.includes(nameLower)) {
|
|
4510
|
+
partialMatches.push({ mesh: c, pubkey: p.pubkey, displayName: p.displayName, cwd: p.cwd });
|
|
4511
|
+
}
|
|
4468
4512
|
}
|
|
4469
4513
|
}
|
|
4514
|
+
if (exactMatches.length === 1) {
|
|
4515
|
+
return { client: exactMatches[0].mesh, targetSpec: exactMatches[0].pubkey };
|
|
4516
|
+
}
|
|
4517
|
+
if (exactMatches.length > 1) {
|
|
4518
|
+
const lines = exactMatches.map((m) => ` - ${m.displayName} · pubkey ${m.pubkey.slice(0, 16)}…${m.cwd ? ` · cwd ${m.cwd}` : ""}`).join(`
|
|
4519
|
+
`);
|
|
4520
|
+
return {
|
|
4521
|
+
client: null,
|
|
4522
|
+
targetSpec: target,
|
|
4523
|
+
error: `"${target}" is ambiguous — ${exactMatches.length} peers share that display name:
|
|
4524
|
+
${lines}
|
|
4525
|
+
` + `Disambiguate by pubkey prefix (e.g. send to "${exactMatches[0].pubkey.slice(0, 12)}…").`
|
|
4526
|
+
};
|
|
4527
|
+
}
|
|
4528
|
+
if (partialMatches.length === 1) {
|
|
4529
|
+
process.stderr.write(`[claudemesh] resolved "${target}" → "${partialMatches[0].displayName}" (partial match)
|
|
4530
|
+
`);
|
|
4531
|
+
return { client: partialMatches[0].mesh, targetSpec: partialMatches[0].pubkey };
|
|
4532
|
+
}
|
|
4533
|
+
if (partialMatches.length > 1) {
|
|
4534
|
+
const lines = partialMatches.map((m) => ` - ${m.displayName} · pubkey ${m.pubkey.slice(0, 16)}…`).join(`
|
|
4535
|
+
`);
|
|
4536
|
+
return {
|
|
4537
|
+
client: null,
|
|
4538
|
+
targetSpec: target,
|
|
4539
|
+
error: `"${target}" partially matches ${partialMatches.length} peers:
|
|
4540
|
+
${lines}
|
|
4541
|
+
Be more specific, or use a pubkey prefix.`
|
|
4542
|
+
};
|
|
4543
|
+
}
|
|
4470
4544
|
const known = candidates.flatMap((c) => c.peers.map((p) => `${c.mesh}/${p.displayName}`));
|
|
4471
4545
|
return {
|
|
4472
4546
|
client: null,
|
|
@@ -4849,7 +4923,7 @@ No peers connected.`);
|
|
|
4849
4923
|
const hiddenTag = p.visible === false ? " [hidden]" : "";
|
|
4850
4924
|
const sameKeyCount = pubkeyCounts.get(p.pubkey) ?? 1;
|
|
4851
4925
|
const sameKeyTag = sameKeyCount > 1 ? ` [shares key with ${sameKeyCount - 1} other session(s)]` : "";
|
|
4852
|
-
return `- ${profileAvatar}**${p.displayName}**${profileTitle} [${p.status}]${localityTag}${hiddenTag}${sameKeyTag}${groupsStr}${metaStr} (${p.pubkey.slice(0,
|
|
4926
|
+
return `- ${profileAvatar}**${p.displayName}**${profileTitle} [${p.status}]${localityTag}${hiddenTag}${sameKeyTag}${groupsStr}${metaStr} (pubkey: ${p.pubkey.slice(0, 16)}…)${cwdStr}${summary}`;
|
|
4853
4927
|
});
|
|
4854
4928
|
sections.push(`${header}
|
|
4855
4929
|
${peerLines.join(`
|
|
@@ -6559,4 +6633,4 @@ startMcpServer().catch((err) => {
|
|
|
6559
6633
|
process.exit(1);
|
|
6560
6634
|
});
|
|
6561
6635
|
|
|
6562
|
-
//# debugId=
|
|
6636
|
+
//# debugId=B72076A3A86916E364756E2164756E21
|