claudemesh-cli 1.0.0 → 1.0.1
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
|
@@ -1317,6 +1317,7 @@ class BrokerClient {
|
|
|
1317
1317
|
return this._serviceCatalog;
|
|
1318
1318
|
}
|
|
1319
1319
|
closed = false;
|
|
1320
|
+
terminalClose = null;
|
|
1320
1321
|
reconnectAttempt = 0;
|
|
1321
1322
|
helloTimer = null;
|
|
1322
1323
|
reconnectTimer = null;
|
|
@@ -1444,12 +1445,22 @@ class BrokerClient {
|
|
|
1444
1445
|
}
|
|
1445
1446
|
this.handleServerMessage(msg);
|
|
1446
1447
|
};
|
|
1447
|
-
const onClose = () => {
|
|
1448
|
+
const onClose = (code, reasonBuf) => {
|
|
1448
1449
|
if (this.helloTimer)
|
|
1449
1450
|
clearTimeout(this.helloTimer);
|
|
1450
1451
|
this.helloTimer = null;
|
|
1451
1452
|
if (this.ws === ws)
|
|
1452
1453
|
this.ws = null;
|
|
1454
|
+
const reason = reasonBuf?.toString("utf-8") ?? "";
|
|
1455
|
+
if (code === 4001 || code === 4002) {
|
|
1456
|
+
this.closed = true;
|
|
1457
|
+
this.setConnStatus("closed");
|
|
1458
|
+
this.terminalClose = { code, reason };
|
|
1459
|
+
if (this._status !== "open") {
|
|
1460
|
+
reject(new Error(`ws terminal close ${code}: ${reason || "session ended"}`));
|
|
1461
|
+
}
|
|
1462
|
+
return;
|
|
1463
|
+
}
|
|
1453
1464
|
if (this._status !== "open" && this._status !== "reconnecting") {
|
|
1454
1465
|
reject(new Error("ws closed before hello_ack"));
|
|
1455
1466
|
}
|
|
@@ -3132,6 +3143,9 @@ class BrokerClient {
|
|
|
3132
3143
|
}
|
|
3133
3144
|
if (msg.type === "error") {
|
|
3134
3145
|
this.debug(`broker error: ${msg.code} ${msg.message}`);
|
|
3146
|
+
if (msg.code === "revoked") {
|
|
3147
|
+
this.terminalClose = { code: 4002, reason: String(msg.message ?? "revoked") };
|
|
3148
|
+
}
|
|
3135
3149
|
const id = msg.id ? String(msg.id) : null;
|
|
3136
3150
|
let handledByPendingSend = false;
|
|
3137
3151
|
if (id) {
|
|
@@ -3372,6 +3386,25 @@ async function withMesh(opts, fn) {
|
|
|
3372
3386
|
await client.connect();
|
|
3373
3387
|
const result = await fn(client, mesh);
|
|
3374
3388
|
return result;
|
|
3389
|
+
} catch (e) {
|
|
3390
|
+
if (client.terminalClose) {
|
|
3391
|
+
const { code, reason } = client.terminalClose;
|
|
3392
|
+
if (code === 4002) {
|
|
3393
|
+
console.error(`
|
|
3394
|
+
✘ ${reason}
|
|
3395
|
+
`);
|
|
3396
|
+
} else if (code === 4001) {
|
|
3397
|
+
console.error(`
|
|
3398
|
+
✘ Kicked from this mesh. Run \`claudemesh\` to rejoin.
|
|
3399
|
+
`);
|
|
3400
|
+
} else {
|
|
3401
|
+
console.error(`
|
|
3402
|
+
✘ Broker closed connection: ${reason}
|
|
3403
|
+
`);
|
|
3404
|
+
}
|
|
3405
|
+
process.exit(1);
|
|
3406
|
+
}
|
|
3407
|
+
throw e;
|
|
3375
3408
|
} finally {
|
|
3376
3409
|
client.close();
|
|
3377
3410
|
}
|
|
@@ -3525,7 +3558,7 @@ __export(exports_urls, {
|
|
|
3525
3558
|
VERSION: () => VERSION,
|
|
3526
3559
|
URLS: () => URLS
|
|
3527
3560
|
});
|
|
3528
|
-
var URLS, VERSION = "1.0.
|
|
3561
|
+
var URLS, VERSION = "1.0.1", env;
|
|
3529
3562
|
var init_urls = __esm(() => {
|
|
3530
3563
|
URLS = {
|
|
3531
3564
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -6633,4 +6666,4 @@ startMcpServer().catch((err) => {
|
|
|
6633
6666
|
process.exit(1);
|
|
6634
6667
|
});
|
|
6635
6668
|
|
|
6636
|
-
//# debugId=
|
|
6669
|
+
//# debugId=B1200DBD10CF1BC164756E2164756E21
|