Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
82cfee315c | ||
|
|
ab08be04a5 |
@@ -1658,6 +1658,9 @@ function handleConnection(ws: WebSocket): void {
|
|||||||
for (const p of peers) for (const g of p.groups) allGroups.add(`@${g.name}`);
|
for (const p of peers) for (const g of p.groups) allGroups.add(`@${g.name}`);
|
||||||
const myPresence = peers.find(p => p.sessionId === [...connections.entries()].find(([pid]) => pid === presenceId)?.[1]?.sessionPubkey);
|
const myPresence = peers.find(p => p.sessionId === [...connections.entries()].find(([pid]) => pid === presenceId)?.[1]?.sessionPubkey);
|
||||||
const peerConn = connections.get(presenceId);
|
const peerConn = connections.get(presenceId);
|
||||||
|
// Find own display name: match sessionPubkey from the peer list
|
||||||
|
const selfPubkey = peerConn?.sessionPubkey ?? peerConn?.memberPubkey;
|
||||||
|
const selfPeer = peers.find(p => p.pubkey === selfPubkey);
|
||||||
sendToPeer(presenceId, {
|
sendToPeer(presenceId, {
|
||||||
type: "mesh_info_result",
|
type: "mesh_info_result",
|
||||||
mesh: conn.meshId,
|
mesh: conn.meshId,
|
||||||
@@ -1670,7 +1673,7 @@ function handleConnection(ws: WebSocket): void {
|
|||||||
streams: streams.map(s => s.name),
|
streams: streams.map(s => s.name),
|
||||||
tables: tables.map((t: any) => t.name),
|
tables: tables.map((t: any) => t.name),
|
||||||
collections: [],
|
collections: [],
|
||||||
yourName: peerConn?.groups?.[0]?.name ?? "unknown",
|
yourName: selfPeer?.displayName ?? "unknown",
|
||||||
yourGroups: peerConn?.groups ?? [],
|
yourGroups: peerConn?.groups ?? [],
|
||||||
});
|
});
|
||||||
log.info("ws mesh_info", { presence_id: presenceId });
|
log.info("ws mesh_info", { presence_id: presenceId });
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "claudemesh-cli",
|
"name": "claudemesh-cli",
|
||||||
"version": "0.5.7",
|
"version": "0.5.9",
|
||||||
"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",
|
||||||
|
|||||||
@@ -859,6 +859,27 @@ Your message mode is "${messageMode}".
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Welcome notification: give Claude immediate context on connect.
|
||||||
|
// Triggers Claude to call mesh_info/list_peers without user input.
|
||||||
|
setTimeout(async () => {
|
||||||
|
const client = allClients()[0];
|
||||||
|
if (!client || client.status !== "open") return;
|
||||||
|
try {
|
||||||
|
const peers = await client.listPeers();
|
||||||
|
const peerNames = peers
|
||||||
|
.filter(p => p.displayName !== myName)
|
||||||
|
.map(p => p.displayName)
|
||||||
|
.join(", ") || "none";
|
||||||
|
await server.notification({
|
||||||
|
method: "notifications/claude/channel",
|
||||||
|
params: {
|
||||||
|
content: `[system] Connected as ${myName} to mesh ${client.meshSlug}. ${peers.length} peer(s) online: ${peerNames}. Call mesh_info for full details or set_summary to announce yourself.`,
|
||||||
|
meta: { kind: "welcome", mesh_slug: client.meshSlug },
|
||||||
|
},
|
||||||
|
});
|
||||||
|
} catch { /* best effort */ }
|
||||||
|
}, 3_000); // 3s delay: let WS connect + hello_ack complete first
|
||||||
|
|
||||||
// Event loop keepalive: Node.js stdout to a pipe is buffered. Without
|
// Event loop keepalive: Node.js stdout to a pipe is buffered. Without
|
||||||
// periodic event loop activity, stdout.write() from WS callbacks may not
|
// periodic event loop activity, stdout.write() from WS callbacks may not
|
||||||
// flush until the next I/O event. This 1s interval keeps the event loop
|
// flush until the next I/O event. This 1s interval keeps the event loop
|
||||||
|
|||||||
Reference in New Issue
Block a user