claudemesh-cli 1.34.1 → 1.34.2
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/mcp.js
CHANGED
|
@@ -81,7 +81,7 @@ __export(exports_urls, {
|
|
|
81
81
|
VERSION: () => VERSION,
|
|
82
82
|
URLS: () => URLS
|
|
83
83
|
});
|
|
84
|
-
var URLS, VERSION = "1.34.
|
|
84
|
+
var URLS, VERSION = "1.34.2", env;
|
|
85
85
|
var init_urls = __esm(() => {
|
|
86
86
|
URLS = {
|
|
87
87
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -2964,6 +2964,11 @@ ${mf.allowed_tools.map((t) => ` - ${t}`).join(`
|
|
|
2964
2964
|
});
|
|
2965
2965
|
const transport = new StdioServerTransport;
|
|
2966
2966
|
await server.connect(transport);
|
|
2967
|
+
const WELCOME_DELAY_MS = 5000;
|
|
2968
|
+
const WELCOME_LOOKBACK_MS = 24 * 60 * 60 * 1000;
|
|
2969
|
+
setTimeout(() => {
|
|
2970
|
+
emitInboxWelcome(server, mcpLog, WELCOME_LOOKBACK_MS);
|
|
2971
|
+
}, WELCOME_DELAY_MS);
|
|
2967
2972
|
const keepalive = setInterval(() => {}, 1000);
|
|
2968
2973
|
const shutdown = () => {
|
|
2969
2974
|
clearInterval(keepalive);
|
|
@@ -2973,6 +2978,70 @@ ${mf.allowed_tools.map((t) => ` - ${t}`).join(`
|
|
|
2973
2978
|
process.on("SIGTERM", shutdown);
|
|
2974
2979
|
process.on("SIGINT", shutdown);
|
|
2975
2980
|
}
|
|
2981
|
+
async function emitInboxWelcome(server, mcpLog, lookbackMs) {
|
|
2982
|
+
const sinceIso = new Date(Date.now() - lookbackMs).toISOString();
|
|
2983
|
+
const path = `/v1/inbox?since=${encodeURIComponent(sinceIso)}&limit=20`;
|
|
2984
|
+
let body;
|
|
2985
|
+
try {
|
|
2986
|
+
const res = await daemonGet(path);
|
|
2987
|
+
if (res.status !== 200) {
|
|
2988
|
+
mcpLog("welcome_skip", { reason: "ipc_status", status: res.status });
|
|
2989
|
+
return;
|
|
2990
|
+
}
|
|
2991
|
+
body = res.body;
|
|
2992
|
+
} catch (e) {
|
|
2993
|
+
mcpLog("welcome_skip", { reason: "ipc_threw", err: String(e) });
|
|
2994
|
+
return;
|
|
2995
|
+
}
|
|
2996
|
+
const items = Array.isArray(body.items) ? body.items : [];
|
|
2997
|
+
if (items.length === 0) {
|
|
2998
|
+
mcpLog("welcome_skip", { reason: "empty" });
|
|
2999
|
+
return;
|
|
3000
|
+
}
|
|
3001
|
+
const byMesh = new Map;
|
|
3002
|
+
for (const it of items) {
|
|
3003
|
+
const meshSlug = String(it.mesh ?? "");
|
|
3004
|
+
const arr = byMesh.get(meshSlug) ?? [];
|
|
3005
|
+
arr.push(it);
|
|
3006
|
+
byMesh.set(meshSlug, arr);
|
|
3007
|
+
}
|
|
3008
|
+
const preview = items.slice(0, 3).map((it) => {
|
|
3009
|
+
const sender = String(it.sender_name ?? "unknown");
|
|
3010
|
+
const senderPub = String(it.sender_pubkey ?? "").slice(0, 8);
|
|
3011
|
+
const meshSlug = String(it.mesh ?? "");
|
|
3012
|
+
const bodyText = (typeof it.body === "string" ? it.body : "(encrypted)").slice(0, 60);
|
|
3013
|
+
const ts = String(it.received_at ?? "");
|
|
3014
|
+
const time = ts ? new Date(ts).toLocaleTimeString() : "";
|
|
3015
|
+
const tag = sender !== senderPub ? `${sender} (${senderPub})` : senderPub;
|
|
3016
|
+
return ` ${tag} [${meshSlug}] ${time}: ${bodyText}`;
|
|
3017
|
+
}).join(`
|
|
3018
|
+
`);
|
|
3019
|
+
const remainder = items.length > 3 ? `
|
|
3020
|
+
…and ${items.length - 3} more` : "";
|
|
3021
|
+
const meshList = [...byMesh.keys()].filter(Boolean).join(", ");
|
|
3022
|
+
const header = `\uD83D\uDCE5 [welcome] ${items.length} message${items.length === 1 ? "" : "s"} in inbox from the last 24h${meshList ? ` (${meshList})` : ""}`;
|
|
3023
|
+
const footer = `
|
|
3024
|
+
Run \`claudemesh inbox\` for full content.`;
|
|
3025
|
+
const content = `${header}
|
|
3026
|
+
${preview}${remainder}${footer}`;
|
|
3027
|
+
try {
|
|
3028
|
+
await server.notification({
|
|
3029
|
+
method: "notifications/claude/channel",
|
|
3030
|
+
params: {
|
|
3031
|
+
content,
|
|
3032
|
+
meta: {
|
|
3033
|
+
kind: "welcome",
|
|
3034
|
+
unread_count: items.length,
|
|
3035
|
+
meshes: [...byMesh.keys()],
|
|
3036
|
+
latest_message_ids: items.slice(0, 10).map((it) => String(it.id ?? ""))
|
|
3037
|
+
}
|
|
3038
|
+
}
|
|
3039
|
+
});
|
|
3040
|
+
mcpLog("welcome_emitted", { count: items.length, meshes: [...byMesh.keys()] });
|
|
3041
|
+
} catch (err) {
|
|
3042
|
+
mcpLog("welcome_emit_failed", { err: String(err) });
|
|
3043
|
+
}
|
|
3044
|
+
}
|
|
2976
3045
|
async function startServiceProxy(serviceName) {
|
|
2977
3046
|
const config = readConfig();
|
|
2978
3047
|
if (config.meshes.length === 0) {
|
|
@@ -3085,4 +3154,4 @@ startMcpServer().catch((err) => {
|
|
|
3085
3154
|
process.exit(1);
|
|
3086
3155
|
});
|
|
3087
3156
|
|
|
3088
|
-
//# debugId=
|
|
3157
|
+
//# debugId=BF4B7D5AF5C8B94C64756E2164756E21
|