claudemesh-cli 1.5.0 → 1.6.0

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.
@@ -382,6 +382,12 @@ 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;
385
391
  sharedDirs = [process.cwd()];
386
392
  _serviceCatalog = [];
387
393
  get serviceCatalog() {
@@ -684,6 +690,116 @@ class BrokerClient {
684
690
  return;
685
691
  this.ws.send(JSON.stringify({ type: "leave_group", name }));
686
692
  }
693
+ async topicCreate(args) {
694
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
695
+ return null;
696
+ return new Promise((resolve) => {
697
+ const reqId = this.makeReqId();
698
+ this.topicCreatedResolvers.set(reqId, {
699
+ resolve,
700
+ timer: setTimeout(() => {
701
+ if (this.topicCreatedResolvers.delete(reqId))
702
+ resolve(null);
703
+ }, 5000)
704
+ });
705
+ this.ws.send(JSON.stringify({ type: "topic_create", _reqId: reqId, ...args }));
706
+ });
707
+ }
708
+ async topicList() {
709
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
710
+ return [];
711
+ return new Promise((resolve) => {
712
+ const reqId = this.makeReqId();
713
+ this.topicListResolvers.set(reqId, {
714
+ resolve,
715
+ timer: setTimeout(() => {
716
+ if (this.topicListResolvers.delete(reqId))
717
+ resolve([]);
718
+ }, 5000)
719
+ });
720
+ this.ws.send(JSON.stringify({ type: "topic_list", _reqId: reqId }));
721
+ });
722
+ }
723
+ async topicJoin(topic, role) {
724
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
725
+ return;
726
+ this.ws.send(JSON.stringify({ type: "topic_join", topic, role }));
727
+ }
728
+ async topicLeave(topic) {
729
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
730
+ return;
731
+ this.ws.send(JSON.stringify({ type: "topic_leave", topic }));
732
+ }
733
+ async topicMembers(topic) {
734
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
735
+ return [];
736
+ return new Promise((resolve) => {
737
+ const reqId = this.makeReqId();
738
+ this.topicMembersResolvers.set(reqId, {
739
+ resolve,
740
+ timer: setTimeout(() => {
741
+ if (this.topicMembersResolvers.delete(reqId))
742
+ resolve([]);
743
+ }, 5000)
744
+ });
745
+ this.ws.send(JSON.stringify({ type: "topic_members", _reqId: reqId, topic }));
746
+ });
747
+ }
748
+ async topicHistory(args) {
749
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
750
+ return [];
751
+ return new Promise((resolve) => {
752
+ const reqId = this.makeReqId();
753
+ this.topicHistoryResolvers.set(reqId, {
754
+ resolve,
755
+ timer: setTimeout(() => {
756
+ if (this.topicHistoryResolvers.delete(reqId))
757
+ resolve([]);
758
+ }, 5000)
759
+ });
760
+ this.ws.send(JSON.stringify({ type: "topic_history", _reqId: reqId, ...args }));
761
+ });
762
+ }
763
+ async topicMarkRead(topic) {
764
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
765
+ return;
766
+ this.ws.send(JSON.stringify({ type: "topic_mark_read", topic }));
767
+ }
768
+ async apiKeyCreate(args) {
769
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
770
+ return null;
771
+ return new Promise((resolve) => {
772
+ const reqId = this.makeReqId();
773
+ this.apiKeyCreatedResolvers.set(reqId, {
774
+ resolve,
775
+ timer: setTimeout(() => {
776
+ if (this.apiKeyCreatedResolvers.delete(reqId))
777
+ resolve(null);
778
+ }, 5000)
779
+ });
780
+ this.ws.send(JSON.stringify({ type: "apikey_create", _reqId: reqId, ...args }));
781
+ });
782
+ }
783
+ async apiKeyList() {
784
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
785
+ return [];
786
+ return new Promise((resolve) => {
787
+ const reqId = this.makeReqId();
788
+ this.apiKeyListResolvers.set(reqId, {
789
+ resolve,
790
+ timer: setTimeout(() => {
791
+ if (this.apiKeyListResolvers.delete(reqId))
792
+ resolve([]);
793
+ }, 5000)
794
+ });
795
+ this.ws.send(JSON.stringify({ type: "apikey_list", _reqId: reqId }));
796
+ });
797
+ }
798
+ async apiKeyRevoke(id) {
799
+ if (!this.ws || this.ws.readyState !== this.ws.OPEN)
800
+ return;
801
+ this.ws.send(JSON.stringify({ type: "apikey_revoke", id }));
802
+ }
687
803
  async setState(key, value) {
688
804
  if (!this.ws || this.ws.readyState !== this.ws.OPEN)
689
805
  return;
@@ -1764,6 +1880,43 @@ class BrokerClient {
1764
1880
  this.resolveFromMap(this.listPeersResolvers, msgReqId, peers);
1765
1881
  return;
1766
1882
  }
1883
+ if (msg.type === "topic_created") {
1884
+ const r = msg.topic ?? {};
1885
+ this.resolveFromMap(this.topicCreatedResolvers, msgReqId, {
1886
+ id: r.id,
1887
+ name: r.name,
1888
+ created: !!msg.created
1889
+ });
1890
+ return;
1891
+ }
1892
+ if (msg.type === "topic_list_response") {
1893
+ this.resolveFromMap(this.topicListResolvers, msgReqId, msg.topics ?? []);
1894
+ return;
1895
+ }
1896
+ if (msg.type === "topic_members_response") {
1897
+ this.resolveFromMap(this.topicMembersResolvers, msgReqId, msg.members ?? []);
1898
+ return;
1899
+ }
1900
+ if (msg.type === "topic_history_response") {
1901
+ this.resolveFromMap(this.topicHistoryResolvers, msgReqId, msg.messages ?? []);
1902
+ return;
1903
+ }
1904
+ if (msg.type === "apikey_created") {
1905
+ this.resolveFromMap(this.apiKeyCreatedResolvers, msgReqId, {
1906
+ id: String(msg.id ?? ""),
1907
+ secret: String(msg.secret ?? ""),
1908
+ label: String(msg.label ?? ""),
1909
+ prefix: String(msg.prefix ?? ""),
1910
+ capabilities: msg.capabilities ?? [],
1911
+ topicScopes: msg.topicScopes ?? null,
1912
+ createdAt: String(msg.createdAt ?? "")
1913
+ });
1914
+ return;
1915
+ }
1916
+ if (msg.type === "apikey_list_response") {
1917
+ this.resolveFromMap(this.apiKeyListResolvers, msgReqId, msg.keys ?? []);
1918
+ return;
1919
+ }
1767
1920
  if (msg.type === "push") {
1768
1921
  this._statsCounters.messagesIn++;
1769
1922
  const nonce = String(msg.nonce ?? "");
@@ -2810,7 +2963,7 @@ __export(exports_urls, {
2810
2963
  VERSION: () => VERSION,
2811
2964
  URLS: () => URLS
2812
2965
  });
2813
- var URLS, VERSION = "1.5.0", env;
2966
+ var URLS, VERSION = "1.6.0", env;
2814
2967
  var init_urls = __esm(() => {
2815
2968
  URLS = {
2816
2969
  BROKER: process.env.CLAUDEMESH_BROKER_URL ?? "wss://ic.claudemesh.com/ws",
@@ -4332,4 +4485,4 @@ startMcpServer().catch((err) => {
4332
4485
  process.exit(1);
4333
4486
  });
4334
4487
 
4335
- //# debugId=3095927E5265159264756E2164756E21
4488
+ //# debugId=298B7D9BD1801FF064756E2164756E21