claudemesh-cli 0.9.0 → 0.9.1
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/index.js +125 -121
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -51622,159 +51622,163 @@ ${lines.join(`
|
|
|
51622
51622
|
return text(`Unknown tool: ${name}`, true);
|
|
51623
51623
|
}
|
|
51624
51624
|
});
|
|
51625
|
-
await startClients(config2);
|
|
51626
51625
|
const transport = new StdioServerTransport;
|
|
51627
51626
|
await server.connect(transport);
|
|
51628
|
-
|
|
51629
|
-
|
|
51630
|
-
|
|
51631
|
-
|
|
51632
|
-
|
|
51633
|
-
|
|
51634
|
-
|
|
51635
|
-
|
|
51636
|
-
if (
|
|
51637
|
-
|
|
51638
|
-
|
|
51639
|
-
const
|
|
51640
|
-
|
|
51641
|
-
|
|
51642
|
-
|
|
51643
|
-
|
|
51644
|
-
|
|
51645
|
-
|
|
51646
|
-
|
|
51647
|
-
|
|
51648
|
-
|
|
51649
|
-
|
|
51650
|
-
|
|
51651
|
-
|
|
51652
|
-
|
|
51653
|
-
|
|
51654
|
-
|
|
51655
|
-
|
|
51656
|
-
|
|
51657
|
-
|
|
51658
|
-
|
|
51659
|
-
|
|
51660
|
-
|
|
51661
|
-
|
|
51662
|
-
|
|
51663
|
-
|
|
51664
|
-
|
|
51665
|
-
|
|
51666
|
-
|
|
51667
|
-
|
|
51627
|
+
startClients(config2).then(() => {
|
|
51628
|
+
wirePushHandlers();
|
|
51629
|
+
}).catch(() => {
|
|
51630
|
+
wirePushHandlers();
|
|
51631
|
+
});
|
|
51632
|
+
async function wirePushHandlers() {
|
|
51633
|
+
for (const client2 of allClients()) {
|
|
51634
|
+
client2.onPush(async (msg) => {
|
|
51635
|
+
if (messageMode === "off")
|
|
51636
|
+
return;
|
|
51637
|
+
if (msg.subtype === "system" && msg.event) {
|
|
51638
|
+
const eventName = msg.event;
|
|
51639
|
+
const data = msg.eventData ?? {};
|
|
51640
|
+
let content2;
|
|
51641
|
+
if (eventName === "tick") {
|
|
51642
|
+
const tick = data.tick ?? 0;
|
|
51643
|
+
const simTime = String(data.simTime ?? "").replace("T", " ").replace(/\..*/, "");
|
|
51644
|
+
const speed = data.speed ?? 1;
|
|
51645
|
+
content2 = `[heartbeat] tick ${tick} | sim time: ${simTime} | speed: x${speed}`;
|
|
51646
|
+
} else if (eventName === "peer_joined") {
|
|
51647
|
+
content2 = `[system] Peer "${data.name ?? "unknown"}" joined the mesh`;
|
|
51648
|
+
} else if (eventName === "peer_returned") {
|
|
51649
|
+
const peerName = String(data.name ?? "unknown");
|
|
51650
|
+
const lastSeenAt = data.lastSeenAt ? relativeTime(String(data.lastSeenAt)) : "unknown";
|
|
51651
|
+
const groups = Array.isArray(data.groups) ? data.groups.map((g) => g.role ? `@${g.name}:${g.role}` : `@${g.name}`).join(", ") : "";
|
|
51652
|
+
const summary = data.summary ? ` Summary: "${data.summary}"` : "";
|
|
51653
|
+
content2 = `[system] Welcome back, "${peerName}"! Last seen ${lastSeenAt}.${groups ? ` Restored: ${groups}` : ""}${summary}`;
|
|
51654
|
+
} else if (eventName === "peer_left") {
|
|
51655
|
+
content2 = `[system] Peer "${data.name ?? "unknown"}" left the mesh`;
|
|
51656
|
+
} else if (eventName === "mcp_registered") {
|
|
51657
|
+
const tools = Array.isArray(data.tools) ? data.tools.join(", ") : "";
|
|
51658
|
+
content2 = `[system] New MCP server available: "${data.serverName}" (hosted by ${data.hostedBy}). Tools: ${tools}. Use mesh_tool_call to invoke.`;
|
|
51659
|
+
} else if (eventName === "mcp_unregistered") {
|
|
51660
|
+
content2 = `[system] MCP server "${data.serverName}" removed (was hosted by ${data.hostedBy})`;
|
|
51661
|
+
} else if (eventName === "mcp_restored") {
|
|
51662
|
+
content2 = `[system] MCP server "${data.serverName}" is back online (hosted by ${data.hostedBy})`;
|
|
51663
|
+
} else if (eventName === "watch_triggered") {
|
|
51664
|
+
content2 = `[WATCH] ${data.label ?? data.url}: ${data.oldValue} → ${data.newValue}`;
|
|
51665
|
+
} else if (eventName === "mcp_deployed") {
|
|
51666
|
+
content2 = `[SERVICE] "${data.name}" deployed (${data.tool_count} tools) by ${data.deployed_by}`;
|
|
51667
|
+
} else if (eventName === "mcp_undeployed") {
|
|
51668
|
+
content2 = `[SERVICE] "${data.name}" undeployed by ${data.by}`;
|
|
51669
|
+
} else if (eventName === "mcp_scope_changed") {
|
|
51670
|
+
content2 = `[SERVICE] "${data.name}" scope changed to ${JSON.stringify(data.scope)} by ${data.by}`;
|
|
51671
|
+
} else {
|
|
51672
|
+
content2 = `[system] ${eventName}: ${JSON.stringify(data)}`;
|
|
51673
|
+
}
|
|
51674
|
+
try {
|
|
51675
|
+
await server.notification({
|
|
51676
|
+
method: "notifications/claude/channel",
|
|
51677
|
+
params: {
|
|
51678
|
+
content: content2,
|
|
51679
|
+
meta: {
|
|
51680
|
+
kind: "system",
|
|
51681
|
+
event: eventName,
|
|
51682
|
+
mesh_slug: client2.meshSlug,
|
|
51683
|
+
mesh_id: client2.meshId,
|
|
51684
|
+
...Object.keys(data).length > 0 ? { eventData: data } : {}
|
|
51685
|
+
}
|
|
51686
|
+
}
|
|
51687
|
+
});
|
|
51688
|
+
process.stderr.write(`[claudemesh] system: ${content2}
|
|
51689
|
+
`);
|
|
51690
|
+
} catch (pushErr) {
|
|
51691
|
+
process.stderr.write(`[claudemesh] system push FAILED: ${pushErr}
|
|
51692
|
+
`);
|
|
51693
|
+
}
|
|
51694
|
+
return;
|
|
51695
|
+
}
|
|
51696
|
+
const fromPubkey = msg.senderPubkey || "";
|
|
51697
|
+
const fromName = fromPubkey ? await resolvePeerName(client2, fromPubkey) : "unknown";
|
|
51698
|
+
if (messageMode === "inbox") {
|
|
51699
|
+
try {
|
|
51700
|
+
await server.notification({
|
|
51701
|
+
method: "notifications/claude/channel",
|
|
51702
|
+
params: {
|
|
51703
|
+
content: `[inbox] New message from ${fromName}. Use check_messages to read.`,
|
|
51704
|
+
meta: { kind: "inbox_notification", from_name: fromName }
|
|
51705
|
+
}
|
|
51706
|
+
});
|
|
51707
|
+
} catch {}
|
|
51708
|
+
return;
|
|
51668
51709
|
}
|
|
51710
|
+
const content = msg.plaintext ?? decryptFailedWarning(fromPubkey);
|
|
51669
51711
|
try {
|
|
51670
51712
|
await server.notification({
|
|
51671
51713
|
method: "notifications/claude/channel",
|
|
51672
51714
|
params: {
|
|
51673
|
-
content
|
|
51715
|
+
content,
|
|
51674
51716
|
meta: {
|
|
51675
|
-
|
|
51676
|
-
|
|
51717
|
+
from_id: fromPubkey,
|
|
51718
|
+
from_name: fromName,
|
|
51677
51719
|
mesh_slug: client2.meshSlug,
|
|
51678
51720
|
mesh_id: client2.meshId,
|
|
51679
|
-
|
|
51721
|
+
priority: msg.priority,
|
|
51722
|
+
sent_at: msg.createdAt,
|
|
51723
|
+
delivered_at: msg.receivedAt,
|
|
51724
|
+
kind: msg.kind,
|
|
51725
|
+
...msg.subtype ? { subtype: msg.subtype } : {}
|
|
51680
51726
|
}
|
|
51681
51727
|
}
|
|
51682
51728
|
});
|
|
51683
|
-
process.stderr.write(`[claudemesh]
|
|
51729
|
+
process.stderr.write(`[claudemesh] pushed: from=${fromName} content=${content.slice(0, 60)}
|
|
51684
51730
|
`);
|
|
51685
51731
|
} catch (pushErr) {
|
|
51686
|
-
process.stderr.write(`[claudemesh]
|
|
51732
|
+
process.stderr.write(`[claudemesh] push FAILED: ${pushErr}
|
|
51687
51733
|
`);
|
|
51688
51734
|
}
|
|
51689
|
-
|
|
51690
|
-
|
|
51691
|
-
const fromPubkey = msg.senderPubkey || "";
|
|
51692
|
-
const fromName = fromPubkey ? await resolvePeerName(client2, fromPubkey) : "unknown";
|
|
51693
|
-
if (messageMode === "inbox") {
|
|
51735
|
+
});
|
|
51736
|
+
client2.onStreamData(async (evt) => {
|
|
51694
51737
|
try {
|
|
51695
51738
|
await server.notification({
|
|
51696
51739
|
method: "notifications/claude/channel",
|
|
51697
51740
|
params: {
|
|
51698
|
-
content: `[
|
|
51699
|
-
meta: {
|
|
51741
|
+
content: `[stream:${evt.stream}] from ${evt.publishedBy}: ${JSON.stringify(evt.data)}`,
|
|
51742
|
+
meta: {
|
|
51743
|
+
kind: "stream_data",
|
|
51744
|
+
stream: evt.stream,
|
|
51745
|
+
published_by: evt.publishedBy
|
|
51746
|
+
}
|
|
51700
51747
|
}
|
|
51701
51748
|
});
|
|
51702
51749
|
} catch {}
|
|
51703
|
-
|
|
51704
|
-
|
|
51705
|
-
|
|
51706
|
-
|
|
51707
|
-
|
|
51708
|
-
|
|
51709
|
-
|
|
51710
|
-
|
|
51711
|
-
|
|
51712
|
-
|
|
51713
|
-
|
|
51714
|
-
|
|
51715
|
-
mesh_id: client2.meshId,
|
|
51716
|
-
priority: msg.priority,
|
|
51717
|
-
sent_at: msg.createdAt,
|
|
51718
|
-
delivered_at: msg.receivedAt,
|
|
51719
|
-
kind: msg.kind,
|
|
51720
|
-
...msg.subtype ? { subtype: msg.subtype } : {}
|
|
51721
|
-
}
|
|
51722
|
-
}
|
|
51723
|
-
});
|
|
51724
|
-
process.stderr.write(`[claudemesh] pushed: from=${fromName} content=${content.slice(0, 60)}
|
|
51725
|
-
`);
|
|
51726
|
-
} catch (pushErr) {
|
|
51727
|
-
process.stderr.write(`[claudemesh] push FAILED: ${pushErr}
|
|
51728
|
-
`);
|
|
51729
|
-
}
|
|
51730
|
-
});
|
|
51731
|
-
client2.onStreamData(async (evt) => {
|
|
51732
|
-
try {
|
|
51733
|
-
await server.notification({
|
|
51734
|
-
method: "notifications/claude/channel",
|
|
51735
|
-
params: {
|
|
51736
|
-
content: `[stream:${evt.stream}] from ${evt.publishedBy}: ${JSON.stringify(evt.data)}`,
|
|
51737
|
-
meta: {
|
|
51738
|
-
kind: "stream_data",
|
|
51739
|
-
stream: evt.stream,
|
|
51740
|
-
published_by: evt.publishedBy
|
|
51750
|
+
});
|
|
51751
|
+
client2.onStateChange(async (change) => {
|
|
51752
|
+
try {
|
|
51753
|
+
await server.notification({
|
|
51754
|
+
method: "notifications/claude/channel",
|
|
51755
|
+
params: {
|
|
51756
|
+
content: `[state] ${change.key} = ${JSON.stringify(change.value)} (set by ${change.updatedBy})`,
|
|
51757
|
+
meta: {
|
|
51758
|
+
kind: "state_change",
|
|
51759
|
+
key: change.key,
|
|
51760
|
+
updated_by: change.updatedBy
|
|
51761
|
+
}
|
|
51741
51762
|
}
|
|
51742
|
-
}
|
|
51743
|
-
}
|
|
51744
|
-
}
|
|
51745
|
-
}
|
|
51746
|
-
|
|
51763
|
+
});
|
|
51764
|
+
} catch {}
|
|
51765
|
+
});
|
|
51766
|
+
}
|
|
51767
|
+
const welcomeClient = allClients()[0];
|
|
51768
|
+
if (welcomeClient && welcomeClient.status === "open") {
|
|
51747
51769
|
try {
|
|
51770
|
+
const peers = await welcomeClient.listPeers();
|
|
51771
|
+
const peerNames = peers.filter((p) => p.displayName !== myName).map((p) => p.displayName).join(", ") || "none";
|
|
51748
51772
|
await server.notification({
|
|
51749
51773
|
method: "notifications/claude/channel",
|
|
51750
51774
|
params: {
|
|
51751
|
-
content: `[
|
|
51752
|
-
meta: {
|
|
51753
|
-
kind: "state_change",
|
|
51754
|
-
key: change.key,
|
|
51755
|
-
updated_by: change.updatedBy
|
|
51756
|
-
}
|
|
51775
|
+
content: `[system] Connected as ${myName} to mesh ${welcomeClient.meshSlug}. ${peers.length} peer(s) online: ${peerNames}. Call mesh_info for full details or set_summary to announce yourself.`,
|
|
51776
|
+
meta: { kind: "welcome", mesh_slug: welcomeClient.meshSlug }
|
|
51757
51777
|
}
|
|
51758
51778
|
});
|
|
51759
51779
|
} catch {}
|
|
51760
|
-
}
|
|
51780
|
+
}
|
|
51761
51781
|
}
|
|
51762
|
-
setTimeout(async () => {
|
|
51763
|
-
const client2 = allClients()[0];
|
|
51764
|
-
if (!client2 || client2.status !== "open")
|
|
51765
|
-
return;
|
|
51766
|
-
try {
|
|
51767
|
-
const peers = await client2.listPeers();
|
|
51768
|
-
const peerNames = peers.filter((p) => p.displayName !== myName).map((p) => p.displayName).join(", ") || "none";
|
|
51769
|
-
await server.notification({
|
|
51770
|
-
method: "notifications/claude/channel",
|
|
51771
|
-
params: {
|
|
51772
|
-
content: `[system] Connected as ${myName} to mesh ${client2.meshSlug}. ${peers.length} peer(s) online: ${peerNames}. Call mesh_info for full details or set_summary to announce yourself.`,
|
|
51773
|
-
meta: { kind: "welcome", mesh_slug: client2.meshSlug }
|
|
51774
|
-
}
|
|
51775
|
-
});
|
|
51776
|
-
} catch {}
|
|
51777
|
-
}, 3000);
|
|
51778
51782
|
const keepalive = setInterval(() => {}, 1000);
|
|
51779
51783
|
const shutdown = () => {
|
|
51780
51784
|
clearInterval(keepalive);
|
|
@@ -53127,7 +53131,7 @@ init_config();
|
|
|
53127
53131
|
// package.json
|
|
53128
53132
|
var package_default = {
|
|
53129
53133
|
name: "claudemesh-cli",
|
|
53130
|
-
version: "0.9.
|
|
53134
|
+
version: "0.9.1",
|
|
53131
53135
|
description: "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
|
|
53132
53136
|
keywords: [
|
|
53133
53137
|
"claude-code",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "claudemesh-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
"prettier": "3.6.2",
|
|
49
49
|
"typescript": "5.9.3",
|
|
50
50
|
"vitest": "4.0.14",
|
|
51
|
-
"@turbostarter/prettier-config": "0.1.0",
|
|
52
51
|
"@turbostarter/eslint-config": "0.1.0",
|
|
53
52
|
"@turbostarter/tsconfig": "0.1.0",
|
|
54
|
-
"@turbostarter/vitest-config": "0.1.0"
|
|
53
|
+
"@turbostarter/vitest-config": "0.1.0",
|
|
54
|
+
"@turbostarter/prettier-config": "0.1.0"
|
|
55
55
|
},
|
|
56
56
|
"scripts": {
|
|
57
57
|
"build": "bun build src/index.ts --target=node --outfile dist/index.js --banner \"#!/usr/bin/env node\" && chmod +x dist/index.js",
|