claudemesh-cli 1.6.0 → 1.6.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/README.md +1 -1
- package/dist/entrypoints/cli.js +95 -19
- package/dist/entrypoints/cli.js.map +6 -6
- package/dist/entrypoints/mcp.js +61 -8
- package/dist/entrypoints/mcp.js.map +4 -4
- package/package.json +1 -1
package/dist/entrypoints/mcp.js
CHANGED
|
@@ -388,6 +388,7 @@ class BrokerClient {
|
|
|
388
388
|
topicHistoryResolvers = new Map;
|
|
389
389
|
apiKeyCreatedResolvers = new Map;
|
|
390
390
|
apiKeyListResolvers = new Map;
|
|
391
|
+
apiKeyRevokeResolvers = new Map;
|
|
391
392
|
sharedDirs = [process.cwd()];
|
|
392
393
|
_serviceCatalog = [];
|
|
393
394
|
get serviceCatalog() {
|
|
@@ -796,9 +797,21 @@ class BrokerClient {
|
|
|
796
797
|
});
|
|
797
798
|
}
|
|
798
799
|
async apiKeyRevoke(id) {
|
|
799
|
-
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
800
|
-
return;
|
|
801
|
-
|
|
800
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN) {
|
|
801
|
+
return { ok: false, code: "not_connected", message: "broker not connected" };
|
|
802
|
+
}
|
|
803
|
+
return new Promise((resolve) => {
|
|
804
|
+
const reqId = this.makeReqId();
|
|
805
|
+
this.apiKeyRevokeResolvers.set(reqId, {
|
|
806
|
+
resolve,
|
|
807
|
+
timer: setTimeout(() => {
|
|
808
|
+
if (this.apiKeyRevokeResolvers.delete(reqId)) {
|
|
809
|
+
resolve({ ok: false, code: "timeout", message: "broker did not respond within 5s" });
|
|
810
|
+
}
|
|
811
|
+
}, 5000)
|
|
812
|
+
});
|
|
813
|
+
this.ws.send(JSON.stringify({ type: "apikey_revoke", id, _reqId: reqId }));
|
|
814
|
+
});
|
|
802
815
|
}
|
|
803
816
|
async setState(key, value) {
|
|
804
817
|
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
@@ -1917,6 +1930,28 @@ class BrokerClient {
|
|
|
1917
1930
|
this.resolveFromMap(this.apiKeyListResolvers, msgReqId, msg.keys ?? []);
|
|
1918
1931
|
return;
|
|
1919
1932
|
}
|
|
1933
|
+
if (msg.type === "apikey_revoke_response") {
|
|
1934
|
+
const status = String(msg.status ?? "");
|
|
1935
|
+
if (status === "revoked") {
|
|
1936
|
+
this.resolveFromMap(this.apiKeyRevokeResolvers, msgReqId, {
|
|
1937
|
+
ok: true,
|
|
1938
|
+
id: String(msg.id ?? "")
|
|
1939
|
+
});
|
|
1940
|
+
} else if (status === "not_found") {
|
|
1941
|
+
this.resolveFromMap(this.apiKeyRevokeResolvers, msgReqId, {
|
|
1942
|
+
ok: false,
|
|
1943
|
+
code: "not_found",
|
|
1944
|
+
message: "no api key matches that id in this mesh"
|
|
1945
|
+
});
|
|
1946
|
+
} else if (status === "not_unique") {
|
|
1947
|
+
this.resolveFromMap(this.apiKeyRevokeResolvers, msgReqId, {
|
|
1948
|
+
ok: false,
|
|
1949
|
+
code: "not_unique",
|
|
1950
|
+
message: `prefix matches ${Number(msg.matches ?? 0)} keys; use the full id`
|
|
1951
|
+
});
|
|
1952
|
+
}
|
|
1953
|
+
return;
|
|
1954
|
+
}
|
|
1920
1955
|
if (msg.type === "push") {
|
|
1921
1956
|
this._statsCounters.messagesIn++;
|
|
1922
1957
|
const nonce = String(msg.nonce ?? "");
|
|
@@ -2963,7 +2998,7 @@ __export(exports_urls, {
|
|
|
2963
2998
|
VERSION: () => VERSION,
|
|
2964
2999
|
URLS: () => URLS
|
|
2965
3000
|
});
|
|
2966
|
-
var URLS, VERSION = "1.6.
|
|
3001
|
+
var URLS, VERSION = "1.6.1", env;
|
|
2967
3002
|
var init_urls = __esm(() => {
|
|
2968
3003
|
URLS = {
|
|
2969
3004
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -3454,10 +3489,25 @@ function requireToken() {
|
|
|
3454
3489
|
throw new NotSignedIn;
|
|
3455
3490
|
return auth.session_token;
|
|
3456
3491
|
}
|
|
3492
|
+
function localView() {
|
|
3493
|
+
const cfg = readConfig();
|
|
3494
|
+
if (cfg.meshes.length === 0)
|
|
3495
|
+
return;
|
|
3496
|
+
return {
|
|
3497
|
+
config_path: PATHS.CONFIG_FILE,
|
|
3498
|
+
meshes: cfg.meshes.map((m) => ({
|
|
3499
|
+
slug: m.slug,
|
|
3500
|
+
mesh_id: m.meshId,
|
|
3501
|
+
member_id: m.memberId,
|
|
3502
|
+
pubkey_prefix: m.pubkey.slice(0, 12)
|
|
3503
|
+
}))
|
|
3504
|
+
};
|
|
3505
|
+
}
|
|
3457
3506
|
async function whoAmI() {
|
|
3458
3507
|
const auth = getStoredToken();
|
|
3508
|
+
const local = localView();
|
|
3459
3509
|
if (!auth)
|
|
3460
|
-
return { signed_in: false };
|
|
3510
|
+
return { signed_in: false, local };
|
|
3461
3511
|
try {
|
|
3462
3512
|
const profile = await exports_my.getProfile(auth.session_token);
|
|
3463
3513
|
const meshes = await exports_my.getMeshes(auth.session_token);
|
|
@@ -3466,12 +3516,13 @@ async function whoAmI() {
|
|
|
3466
3516
|
signed_in: true,
|
|
3467
3517
|
user: profile,
|
|
3468
3518
|
token_source: auth.token_source,
|
|
3469
|
-
meshes: { owned, guest: meshes.length - owned }
|
|
3519
|
+
meshes: { owned, guest: meshes.length - owned },
|
|
3520
|
+
local
|
|
3470
3521
|
};
|
|
3471
3522
|
} catch (err) {
|
|
3472
3523
|
if (err instanceof ApiError && err.isUnauthorized) {
|
|
3473
3524
|
clearToken();
|
|
3474
|
-
return { signed_in: false };
|
|
3525
|
+
return { signed_in: false, local };
|
|
3475
3526
|
}
|
|
3476
3527
|
throw err;
|
|
3477
3528
|
}
|
|
@@ -3494,6 +3545,8 @@ async function register(callbackPort) {
|
|
|
3494
3545
|
var init_client2 = __esm(() => {
|
|
3495
3546
|
init_facade5();
|
|
3496
3547
|
init_facade5();
|
|
3548
|
+
init_facade();
|
|
3549
|
+
init_paths();
|
|
3497
3550
|
init_token_store();
|
|
3498
3551
|
init_errors3();
|
|
3499
3552
|
});
|
|
@@ -4485,4 +4538,4 @@ startMcpServer().catch((err) => {
|
|
|
4485
4538
|
process.exit(1);
|
|
4486
4539
|
});
|
|
4487
4540
|
|
|
4488
|
-
//# debugId=
|
|
4541
|
+
//# debugId=509118676B7F811E64756E2164756E21
|