Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2372032a68 | ||
|
|
a70c5fd124 |
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "claudemesh-cli",
|
||||
"version": "0.5.4",
|
||||
"version": "0.5.6",
|
||||
"description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
|
||||
"keywords": [
|
||||
"claude-code",
|
||||
|
||||
@@ -707,6 +707,56 @@ Your message mode is "${messageMode}".
|
||||
return text(lines.join("\n"));
|
||||
}
|
||||
|
||||
case "ping_mesh": {
|
||||
const { priorities: pingPriorities } = (args ?? {}) as { priorities?: string[] };
|
||||
const toTest = (pingPriorities ?? ["now", "next"]) as Priority[];
|
||||
const client = allClients()[0];
|
||||
if (!client) return text("ping_mesh: not connected", true);
|
||||
const results: string[] = [];
|
||||
|
||||
// Diagnostics: connection state
|
||||
results.push(`WS status: ${client.status}`);
|
||||
results.push(`Mesh: ${client.meshSlug}`);
|
||||
|
||||
// Check own peer status (explains priority gating)
|
||||
const peers = await client.listPeers();
|
||||
const selfPeer = peers.find(p => p.displayName === myName);
|
||||
results.push(`Your status: ${selfPeer?.status ?? "not found in peer list"}`);
|
||||
results.push(`Peers online: ${peers.length}`);
|
||||
results.push(`Push buffer: ${client.pushHistory.length} buffered`);
|
||||
|
||||
// Test send→ack latency per priority (doesn't need round-trip)
|
||||
for (const prio of toTest) {
|
||||
const sendTime = Date.now();
|
||||
// Send to a peer if one exists, otherwise broadcast
|
||||
const target = peers.find(p => p.displayName !== myName);
|
||||
const sendResult = await client.send(
|
||||
target?.pubkey ?? "*",
|
||||
`__ping__ ${prio} from ${myName} at ${new Date().toISOString()}`,
|
||||
prio,
|
||||
);
|
||||
const ackTime = Date.now();
|
||||
|
||||
if (!sendResult.ok) {
|
||||
results.push(`[${prio}] SEND FAILED: ${sendResult.error}`);
|
||||
} else {
|
||||
results.push(`[${prio}] send→ack: ${ackTime - sendTime}ms (msgId: ${sendResult.messageId?.slice(0, 12)})`);
|
||||
if (prio !== "now" && selfPeer?.status === "working") {
|
||||
results.push(` ⚠ peer status is "working" — broker holds "${prio}" until idle`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check if notification pipeline works
|
||||
results.push("");
|
||||
results.push("Pipeline check:");
|
||||
results.push(` onPush handlers: active`);
|
||||
results.push(` messageMode: ${messageMode}`);
|
||||
results.push(` server.notification: ${messageMode === "off" ? "disabled (mode=off)" : "enabled"}`);
|
||||
|
||||
return text(results.join("\n"));
|
||||
}
|
||||
|
||||
default:
|
||||
return text(`Unknown tool: ${name}`, true);
|
||||
}
|
||||
|
||||
@@ -555,4 +555,21 @@ export const TOOLS: Tool[] = [
|
||||
"Get a complete overview of the mesh: peers, groups, state, memory, files, tasks, streams, tables. Call on session start for full situational awareness.",
|
||||
inputSchema: { type: "object", properties: {} },
|
||||
},
|
||||
|
||||
// --- Diagnostics ---
|
||||
{
|
||||
name: "ping_mesh",
|
||||
description:
|
||||
"Send test messages through the full pipeline and measure round-trip timing per priority. Diagnoses push delivery issues.",
|
||||
inputSchema: {
|
||||
type: "object",
|
||||
properties: {
|
||||
priorities: {
|
||||
type: "array",
|
||||
items: { type: "string", enum: ["now", "next", "low"] },
|
||||
description: "Priorities to test (default: [\"now\", \"next\"])",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user