claudemesh-cli 1.5.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 +10 -2
- package/dist/entrypoints/cli.js +1404 -18
- package/dist/entrypoints/cli.js.map +17 -10
- package/dist/entrypoints/mcp.js +211 -5
- package/dist/entrypoints/mcp.js.map +4 -4
- package/package.json +2 -1
- package/skills/claudemesh/SKILL.md +25 -0
package/dist/entrypoints/mcp.js
CHANGED
|
@@ -382,6 +382,13 @@ class BrokerClient {
|
|
|
382
382
|
grantFileAccessResolvers = new Map;
|
|
383
383
|
peerFileResponseResolvers = new Map;
|
|
384
384
|
peerDirResponseResolvers = new Map;
|
|
385
|
+
topicCreatedResolvers = new Map;
|
|
386
|
+
topicListResolvers = new Map;
|
|
387
|
+
topicMembersResolvers = new Map;
|
|
388
|
+
topicHistoryResolvers = new Map;
|
|
389
|
+
apiKeyCreatedResolvers = new Map;
|
|
390
|
+
apiKeyListResolvers = new Map;
|
|
391
|
+
apiKeyRevokeResolvers = new Map;
|
|
385
392
|
sharedDirs = [process.cwd()];
|
|
386
393
|
_serviceCatalog = [];
|
|
387
394
|
get serviceCatalog() {
|
|
@@ -684,6 +691,128 @@ class BrokerClient {
|
|
|
684
691
|
return;
|
|
685
692
|
this.ws.send(JSON.stringify({ type: "leave_group", name }));
|
|
686
693
|
}
|
|
694
|
+
async topicCreate(args) {
|
|
695
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
696
|
+
return null;
|
|
697
|
+
return new Promise((resolve) => {
|
|
698
|
+
const reqId = this.makeReqId();
|
|
699
|
+
this.topicCreatedResolvers.set(reqId, {
|
|
700
|
+
resolve,
|
|
701
|
+
timer: setTimeout(() => {
|
|
702
|
+
if (this.topicCreatedResolvers.delete(reqId))
|
|
703
|
+
resolve(null);
|
|
704
|
+
}, 5000)
|
|
705
|
+
});
|
|
706
|
+
this.ws.send(JSON.stringify({ type: "topic_create", _reqId: reqId, ...args }));
|
|
707
|
+
});
|
|
708
|
+
}
|
|
709
|
+
async topicList() {
|
|
710
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
711
|
+
return [];
|
|
712
|
+
return new Promise((resolve) => {
|
|
713
|
+
const reqId = this.makeReqId();
|
|
714
|
+
this.topicListResolvers.set(reqId, {
|
|
715
|
+
resolve,
|
|
716
|
+
timer: setTimeout(() => {
|
|
717
|
+
if (this.topicListResolvers.delete(reqId))
|
|
718
|
+
resolve([]);
|
|
719
|
+
}, 5000)
|
|
720
|
+
});
|
|
721
|
+
this.ws.send(JSON.stringify({ type: "topic_list", _reqId: reqId }));
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
async topicJoin(topic, role) {
|
|
725
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
726
|
+
return;
|
|
727
|
+
this.ws.send(JSON.stringify({ type: "topic_join", topic, role }));
|
|
728
|
+
}
|
|
729
|
+
async topicLeave(topic) {
|
|
730
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
731
|
+
return;
|
|
732
|
+
this.ws.send(JSON.stringify({ type: "topic_leave", topic }));
|
|
733
|
+
}
|
|
734
|
+
async topicMembers(topic) {
|
|
735
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
736
|
+
return [];
|
|
737
|
+
return new Promise((resolve) => {
|
|
738
|
+
const reqId = this.makeReqId();
|
|
739
|
+
this.topicMembersResolvers.set(reqId, {
|
|
740
|
+
resolve,
|
|
741
|
+
timer: setTimeout(() => {
|
|
742
|
+
if (this.topicMembersResolvers.delete(reqId))
|
|
743
|
+
resolve([]);
|
|
744
|
+
}, 5000)
|
|
745
|
+
});
|
|
746
|
+
this.ws.send(JSON.stringify({ type: "topic_members", _reqId: reqId, topic }));
|
|
747
|
+
});
|
|
748
|
+
}
|
|
749
|
+
async topicHistory(args) {
|
|
750
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
751
|
+
return [];
|
|
752
|
+
return new Promise((resolve) => {
|
|
753
|
+
const reqId = this.makeReqId();
|
|
754
|
+
this.topicHistoryResolvers.set(reqId, {
|
|
755
|
+
resolve,
|
|
756
|
+
timer: setTimeout(() => {
|
|
757
|
+
if (this.topicHistoryResolvers.delete(reqId))
|
|
758
|
+
resolve([]);
|
|
759
|
+
}, 5000)
|
|
760
|
+
});
|
|
761
|
+
this.ws.send(JSON.stringify({ type: "topic_history", _reqId: reqId, ...args }));
|
|
762
|
+
});
|
|
763
|
+
}
|
|
764
|
+
async topicMarkRead(topic) {
|
|
765
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
766
|
+
return;
|
|
767
|
+
this.ws.send(JSON.stringify({ type: "topic_mark_read", topic }));
|
|
768
|
+
}
|
|
769
|
+
async apiKeyCreate(args) {
|
|
770
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
771
|
+
return null;
|
|
772
|
+
return new Promise((resolve) => {
|
|
773
|
+
const reqId = this.makeReqId();
|
|
774
|
+
this.apiKeyCreatedResolvers.set(reqId, {
|
|
775
|
+
resolve,
|
|
776
|
+
timer: setTimeout(() => {
|
|
777
|
+
if (this.apiKeyCreatedResolvers.delete(reqId))
|
|
778
|
+
resolve(null);
|
|
779
|
+
}, 5000)
|
|
780
|
+
});
|
|
781
|
+
this.ws.send(JSON.stringify({ type: "apikey_create", _reqId: reqId, ...args }));
|
|
782
|
+
});
|
|
783
|
+
}
|
|
784
|
+
async apiKeyList() {
|
|
785
|
+
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
786
|
+
return [];
|
|
787
|
+
return new Promise((resolve) => {
|
|
788
|
+
const reqId = this.makeReqId();
|
|
789
|
+
this.apiKeyListResolvers.set(reqId, {
|
|
790
|
+
resolve,
|
|
791
|
+
timer: setTimeout(() => {
|
|
792
|
+
if (this.apiKeyListResolvers.delete(reqId))
|
|
793
|
+
resolve([]);
|
|
794
|
+
}, 5000)
|
|
795
|
+
});
|
|
796
|
+
this.ws.send(JSON.stringify({ type: "apikey_list", _reqId: reqId }));
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
async apiKeyRevoke(id) {
|
|
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
|
+
});
|
|
815
|
+
}
|
|
687
816
|
async setState(key, value) {
|
|
688
817
|
if (!this.ws || this.ws.readyState !== this.ws.OPEN)
|
|
689
818
|
return;
|
|
@@ -1764,6 +1893,65 @@ class BrokerClient {
|
|
|
1764
1893
|
this.resolveFromMap(this.listPeersResolvers, msgReqId, peers);
|
|
1765
1894
|
return;
|
|
1766
1895
|
}
|
|
1896
|
+
if (msg.type === "topic_created") {
|
|
1897
|
+
const r = msg.topic ?? {};
|
|
1898
|
+
this.resolveFromMap(this.topicCreatedResolvers, msgReqId, {
|
|
1899
|
+
id: r.id,
|
|
1900
|
+
name: r.name,
|
|
1901
|
+
created: !!msg.created
|
|
1902
|
+
});
|
|
1903
|
+
return;
|
|
1904
|
+
}
|
|
1905
|
+
if (msg.type === "topic_list_response") {
|
|
1906
|
+
this.resolveFromMap(this.topicListResolvers, msgReqId, msg.topics ?? []);
|
|
1907
|
+
return;
|
|
1908
|
+
}
|
|
1909
|
+
if (msg.type === "topic_members_response") {
|
|
1910
|
+
this.resolveFromMap(this.topicMembersResolvers, msgReqId, msg.members ?? []);
|
|
1911
|
+
return;
|
|
1912
|
+
}
|
|
1913
|
+
if (msg.type === "topic_history_response") {
|
|
1914
|
+
this.resolveFromMap(this.topicHistoryResolvers, msgReqId, msg.messages ?? []);
|
|
1915
|
+
return;
|
|
1916
|
+
}
|
|
1917
|
+
if (msg.type === "apikey_created") {
|
|
1918
|
+
this.resolveFromMap(this.apiKeyCreatedResolvers, msgReqId, {
|
|
1919
|
+
id: String(msg.id ?? ""),
|
|
1920
|
+
secret: String(msg.secret ?? ""),
|
|
1921
|
+
label: String(msg.label ?? ""),
|
|
1922
|
+
prefix: String(msg.prefix ?? ""),
|
|
1923
|
+
capabilities: msg.capabilities ?? [],
|
|
1924
|
+
topicScopes: msg.topicScopes ?? null,
|
|
1925
|
+
createdAt: String(msg.createdAt ?? "")
|
|
1926
|
+
});
|
|
1927
|
+
return;
|
|
1928
|
+
}
|
|
1929
|
+
if (msg.type === "apikey_list_response") {
|
|
1930
|
+
this.resolveFromMap(this.apiKeyListResolvers, msgReqId, msg.keys ?? []);
|
|
1931
|
+
return;
|
|
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
|
+
}
|
|
1767
1955
|
if (msg.type === "push") {
|
|
1768
1956
|
this._statsCounters.messagesIn++;
|
|
1769
1957
|
const nonce = String(msg.nonce ?? "");
|
|
@@ -2810,7 +2998,7 @@ __export(exports_urls, {
|
|
|
2810
2998
|
VERSION: () => VERSION,
|
|
2811
2999
|
URLS: () => URLS
|
|
2812
3000
|
});
|
|
2813
|
-
var URLS, VERSION = "1.
|
|
3001
|
+
var URLS, VERSION = "1.6.1", env;
|
|
2814
3002
|
var init_urls = __esm(() => {
|
|
2815
3003
|
URLS = {
|
|
2816
3004
|
BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
|
|
@@ -3301,10 +3489,25 @@ function requireToken() {
|
|
|
3301
3489
|
throw new NotSignedIn;
|
|
3302
3490
|
return auth.session_token;
|
|
3303
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
|
+
}
|
|
3304
3506
|
async function whoAmI() {
|
|
3305
3507
|
const auth = getStoredToken();
|
|
3508
|
+
const local = localView();
|
|
3306
3509
|
if (!auth)
|
|
3307
|
-
return { signed_in: false };
|
|
3510
|
+
return { signed_in: false, local };
|
|
3308
3511
|
try {
|
|
3309
3512
|
const profile = await exports_my.getProfile(auth.session_token);
|
|
3310
3513
|
const meshes = await exports_my.getMeshes(auth.session_token);
|
|
@@ -3313,12 +3516,13 @@ async function whoAmI() {
|
|
|
3313
3516
|
signed_in: true,
|
|
3314
3517
|
user: profile,
|
|
3315
3518
|
token_source: auth.token_source,
|
|
3316
|
-
meshes: { owned, guest: meshes.length - owned }
|
|
3519
|
+
meshes: { owned, guest: meshes.length - owned },
|
|
3520
|
+
local
|
|
3317
3521
|
};
|
|
3318
3522
|
} catch (err) {
|
|
3319
3523
|
if (err instanceof ApiError && err.isUnauthorized) {
|
|
3320
3524
|
clearToken();
|
|
3321
|
-
return { signed_in: false };
|
|
3525
|
+
return { signed_in: false, local };
|
|
3322
3526
|
}
|
|
3323
3527
|
throw err;
|
|
3324
3528
|
}
|
|
@@ -3341,6 +3545,8 @@ async function register(callbackPort) {
|
|
|
3341
3545
|
var init_client2 = __esm(() => {
|
|
3342
3546
|
init_facade5();
|
|
3343
3547
|
init_facade5();
|
|
3548
|
+
init_facade();
|
|
3549
|
+
init_paths();
|
|
3344
3550
|
init_token_store();
|
|
3345
3551
|
init_errors3();
|
|
3346
3552
|
});
|
|
@@ -4332,4 +4538,4 @@ startMcpServer().catch((err) => {
|
|
|
4332
4538
|
process.exit(1);
|
|
4333
4539
|
});
|
|
4334
4540
|
|
|
4335
|
-
//# debugId=
|
|
4541
|
+
//# debugId=509118676B7F811E64756E2164756E21
|