feat(cli): v0.5.5 — ping_mesh diagnostic tool
Some checks failed
Some checks failed
Sends test messages to self through the full pipeline per priority and measures round-trip timing. Reports send→ack and send→receive latency. Detects broker priority gating (status=working holds next/low). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "claudemesh-cli",
|
"name": "claudemesh-cli",
|
||||||
"version": "0.5.4",
|
"version": "0.5.5",
|
||||||
"description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
|
"description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"claude-code",
|
"claude-code",
|
||||||
|
|||||||
@@ -707,6 +707,58 @@ Your message mode is "${messageMode}".
|
|||||||
return text(lines.join("\n"));
|
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[] = [];
|
||||||
|
|
||||||
|
for (const prio of toTest) {
|
||||||
|
const sendTime = Date.now();
|
||||||
|
const pingId = `ping-${sendTime}-${prio}`;
|
||||||
|
// Send to self (broadcast) — should bounce back through the broker
|
||||||
|
const sendResult = await client.send("*", `__ping__${pingId}`, prio);
|
||||||
|
const ackTime = Date.now();
|
||||||
|
|
||||||
|
if (!sendResult.ok) {
|
||||||
|
results.push(`[${prio}] SEND FAILED: ${sendResult.error}`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Wait up to 10s for the ping to arrive in pushBuffer
|
||||||
|
let received = false;
|
||||||
|
let receiveTime = 0;
|
||||||
|
for (let i = 0; i < 100; i++) {
|
||||||
|
await new Promise(r => setTimeout(r, 100));
|
||||||
|
const buffer = client.pushHistory;
|
||||||
|
const match = buffer.find(m =>
|
||||||
|
m.plaintext?.includes(pingId) || false
|
||||||
|
);
|
||||||
|
if (match) {
|
||||||
|
received = true;
|
||||||
|
receiveTime = Date.now();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (received) {
|
||||||
|
results.push(
|
||||||
|
`[${prio}] OK — send→ack: ${ackTime - sendTime}ms, send→receive: ${receiveTime - sendTime}ms`
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
// Check peer status
|
||||||
|
const peers = await client.listPeers();
|
||||||
|
const selfStatus = peers.find(p => p.displayName === myName)?.status ?? "unknown";
|
||||||
|
results.push(
|
||||||
|
`[${prio}] NOT RECEIVED in 10s (your status: ${selfStatus}${selfStatus === "working" ? " — broker holds next/low" : ""})`
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return text(`Ping results:\n${results.join("\n")}`);
|
||||||
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return text(`Unknown tool: ${name}`, true);
|
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.",
|
"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: {} },
|
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