claudemesh-cli 1.0.0-alpha.35 → 1.0.0-alpha.36
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/cli.js +43 -51
- package/dist/entrypoints/cli.js.map +8 -8
- package/dist/entrypoints/mcp.js +23 -19
- package/dist/entrypoints/mcp.js.map +4 -4
- package/package.json +1 -1
package/dist/entrypoints/mcp.js
CHANGED
|
@@ -1299,6 +1299,7 @@ class BrokerClient {
|
|
|
1299
1299
|
outbound = [];
|
|
1300
1300
|
pushHandlers = new Set;
|
|
1301
1301
|
pushBuffer = [];
|
|
1302
|
+
pushChain = Promise.resolve();
|
|
1302
1303
|
listPeersResolvers = new Map;
|
|
1303
1304
|
stateResolvers = new Map;
|
|
1304
1305
|
stateListResolvers = new Map;
|
|
@@ -2663,7 +2664,7 @@ class BrokerClient {
|
|
|
2663
2664
|
const nonce = String(msg.nonce ?? "");
|
|
2664
2665
|
const ciphertext = String(msg.ciphertext ?? "");
|
|
2665
2666
|
const senderPubkey = String(msg.senderPubkey ?? "");
|
|
2666
|
-
(async () => {
|
|
2667
|
+
this.pushChain = this.pushChain.then(async () => {
|
|
2667
2668
|
const isSystem = msg.subtype === "system" || senderPubkey === "system";
|
|
2668
2669
|
const kind = isSystem ? "broadcast" : senderPubkey ? "direct" : "unknown";
|
|
2669
2670
|
let plaintext = null;
|
|
@@ -2740,7 +2741,9 @@ class BrokerClient {
|
|
|
2740
2741
|
h(push);
|
|
2741
2742
|
} catch {}
|
|
2742
2743
|
}
|
|
2743
|
-
})()
|
|
2744
|
+
}).catch((e) => {
|
|
2745
|
+
this.debug(`push handler chain error: ${e instanceof Error ? e.message : e}`);
|
|
2746
|
+
});
|
|
2744
2747
|
return;
|
|
2745
2748
|
}
|
|
2746
2749
|
if (msg.type === "state_result") {
|
|
@@ -3186,11 +3189,17 @@ class BrokerClient {
|
|
|
3186
3189
|
send();
|
|
3187
3190
|
}
|
|
3188
3191
|
scheduleReconnect() {
|
|
3192
|
+
if (this.reconnectTimer) {
|
|
3193
|
+
this.debug("reconnect already scheduled — skipping");
|
|
3194
|
+
return;
|
|
3195
|
+
}
|
|
3189
3196
|
this.setConnStatus("reconnecting");
|
|
3190
|
-
const
|
|
3197
|
+
const base = BACKOFF_CAPS[Math.min(this.reconnectAttempt, BACKOFF_CAPS.length - 1)];
|
|
3198
|
+
const delay = Math.floor(Math.random() * base);
|
|
3191
3199
|
this.reconnectAttempt += 1;
|
|
3192
|
-
this.debug(`reconnect in ${delay}ms (attempt ${this.reconnectAttempt})`);
|
|
3200
|
+
this.debug(`reconnect in ${delay}ms (attempt ${this.reconnectAttempt}, base ${base}ms)`);
|
|
3193
3201
|
this.reconnectTimer = setTimeout(() => {
|
|
3202
|
+
this.reconnectTimer = null;
|
|
3194
3203
|
if (this.closed)
|
|
3195
3204
|
return;
|
|
3196
3205
|
this.connect().catch((e) => {
|
|
@@ -3493,7 +3502,7 @@ __export(exports_urls, {
|
|
|
3493
3502
|
VERSION: () => VERSION,
|
|
3494
3503
|
URLS: () => URLS
|
|
3495
3504
|
});
|
|
3496
|
-
var URLS, VERSION = "1.0.0-alpha.
|
|
3505
|
+
var URLS, VERSION = "1.0.0-alpha.36", env;
|
|
3497
3506
|
var init_urls = __esm(() => {
|
|
3498
3507
|
URLS = {
|
|
3499
3508
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -4173,21 +4182,13 @@ async function syncToBroker(meshSlug, grants) {
|
|
|
4173
4182
|
const auth = getStoredToken();
|
|
4174
4183
|
if (!auth)
|
|
4175
4184
|
return;
|
|
4176
|
-
let userId = "";
|
|
4177
|
-
try {
|
|
4178
|
-
const payload = JSON.parse(Buffer.from(auth.session_token.split(".")[1], "base64url").toString());
|
|
4179
|
-
userId = payload.sub ?? "";
|
|
4180
|
-
} catch {
|
|
4181
|
-
return;
|
|
4182
|
-
}
|
|
4183
|
-
if (!userId)
|
|
4184
|
-
return;
|
|
4185
4185
|
try {
|
|
4186
4186
|
await request({
|
|
4187
4187
|
path: `/cli/mesh/${meshSlug}/grants`,
|
|
4188
4188
|
method: "POST",
|
|
4189
|
-
body: {
|
|
4190
|
-
baseUrl: BROKER_HTTP2
|
|
4189
|
+
body: { grants },
|
|
4190
|
+
baseUrl: BROKER_HTTP2,
|
|
4191
|
+
token: auth.session_token
|
|
4191
4192
|
});
|
|
4192
4193
|
} catch (e) {
|
|
4193
4194
|
render.warn(`broker grant sync failed — client filter still active: ${e instanceof Error ? e.message : e}`);
|
|
@@ -4216,8 +4217,11 @@ function resolveCaps(input) {
|
|
|
4216
4217
|
async function resolvePeer(meshSlug, name) {
|
|
4217
4218
|
return await withMesh({ meshSlug }, async (client) => {
|
|
4218
4219
|
const peers = await client.listPeers();
|
|
4219
|
-
const match = peers.find((p) => p.displayName === name || p.pubkey === name || p.pubkey.startsWith(name));
|
|
4220
|
-
|
|
4220
|
+
const match = peers.find((p) => p.displayName === name || p.pubkey === name || p.pubkey.startsWith(name) || p.memberPubkey === name || p.memberPubkey && p.memberPubkey.startsWith(name));
|
|
4221
|
+
if (!match)
|
|
4222
|
+
return null;
|
|
4223
|
+
const key = match.memberPubkey ?? match.pubkey;
|
|
4224
|
+
return { displayName: match.displayName, pubkey: key };
|
|
4221
4225
|
});
|
|
4222
4226
|
}
|
|
4223
4227
|
function pickMesh2(slug) {
|
|
@@ -6532,4 +6536,4 @@ startMcpServer().catch((err) => {
|
|
|
6532
6536
|
process.exit(1);
|
|
6533
6537
|
});
|
|
6534
6538
|
|
|
6535
|
-
//# debugId=
|
|
6539
|
+
//# debugId=F940F8787F28151764756E2164756E21
|