claudemesh-cli 0.8.6 → 0.8.7

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.
Files changed (2) hide show
  1. package/dist/index.js +122 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -47733,6 +47733,37 @@ var TOOLS = [
47733
47733
  name: "vault_delete",
47734
47734
  description: "Remove a credential from your vault.",
47735
47735
  inputSchema: { type: "object", properties: { key: { type: "string" } }, required: ["key"] }
47736
+ },
47737
+ {
47738
+ name: "mesh_watch",
47739
+ description: "Watch a URL for changes. The broker polls it at the given interval and notifies you when the response changes. Works with any URL — websites (hash mode), JSON APIs (json mode), or status codes (status mode).",
47740
+ inputSchema: {
47741
+ type: "object",
47742
+ properties: {
47743
+ url: { type: "string", description: "URL to watch" },
47744
+ mode: { type: "string", enum: ["hash", "json", "status"], description: "Detection mode: hash (SHA-256 of body), json (extract jsonpath value), status (HTTP status code). Default: hash" },
47745
+ extract: { type: "string", description: "For json mode: dot path to extract (e.g. 'status' or 'data.deployments[0].status')" },
47746
+ interval: { type: "number", description: "Poll interval in seconds (min: 5, default: 30)" },
47747
+ notify_on: { type: "string", description: "When to notify: 'change' (default), 'match:<value>', 'not_match:<value>'" },
47748
+ headers: { type: "object", description: "Optional HTTP headers (e.g. for auth)" },
47749
+ label: { type: "string", description: "Human-readable label for this watch" }
47750
+ },
47751
+ required: ["url"]
47752
+ }
47753
+ },
47754
+ {
47755
+ name: "mesh_unwatch",
47756
+ description: "Stop watching a URL.",
47757
+ inputSchema: {
47758
+ type: "object",
47759
+ properties: { watch_id: { type: "string" } },
47760
+ required: ["watch_id"]
47761
+ }
47762
+ },
47763
+ {
47764
+ name: "mesh_watches",
47765
+ description: "List your active URL watches.",
47766
+ inputSchema: { type: "object", properties: {} }
47736
47767
  }
47737
47768
  ];
47738
47769
 
@@ -48923,6 +48954,41 @@ class BrokerClient {
48923
48954
  this.sendRaw({ type: "skill_deploy", source, _reqId: reqId });
48924
48955
  });
48925
48956
  }
48957
+ watchAckResolvers = new Map;
48958
+ watchListResolvers = new Map;
48959
+ async watch(url, opts) {
48960
+ return new Promise((resolve) => {
48961
+ const reqId = `watch_${Date.now()}`;
48962
+ const timer = setTimeout(() => {
48963
+ this.watchAckResolvers.delete(reqId);
48964
+ resolve({ error: "timeout" });
48965
+ }, 1e4);
48966
+ this.watchAckResolvers.set(reqId, { resolve, timer });
48967
+ this.sendRaw({ type: "watch", url, ...opts, _reqId: reqId });
48968
+ });
48969
+ }
48970
+ async unwatch(watchId) {
48971
+ return new Promise((resolve) => {
48972
+ const reqId = `unwatch_${Date.now()}`;
48973
+ const timer = setTimeout(() => {
48974
+ this.watchAckResolvers.delete(reqId);
48975
+ resolve(false);
48976
+ }, 1e4);
48977
+ this.watchAckResolvers.set(reqId, { resolve: () => resolve(true), timer });
48978
+ this.sendRaw({ type: "unwatch", watchId, _reqId: reqId });
48979
+ });
48980
+ }
48981
+ async watchList() {
48982
+ return new Promise((resolve) => {
48983
+ const reqId = `watchlist_${Date.now()}`;
48984
+ const timer = setTimeout(() => {
48985
+ this.watchListResolvers.delete(reqId);
48986
+ resolve([]);
48987
+ }, 1e4);
48988
+ this.watchListResolvers.set(reqId, { resolve, timer });
48989
+ this.sendRaw({ type: "watch_list", _reqId: reqId });
48990
+ });
48991
+ }
48926
48992
  async getServiceTools(serviceName) {
48927
48993
  const cached2 = this._serviceCatalog.find((s) => s.name === serviceName);
48928
48994
  if (cached2?.tools?.length)
@@ -49516,6 +49582,24 @@ class BrokerClient {
49516
49582
  r.resolve({ name: msg.name, files: msg.files ?? [] });
49517
49583
  }
49518
49584
  }
49585
+ if (msg.type === "watch_ack") {
49586
+ const reqId = msg._reqId;
49587
+ if (reqId && this.watchAckResolvers.has(reqId)) {
49588
+ const r = this.watchAckResolvers.get(reqId);
49589
+ clearTimeout(r.timer);
49590
+ this.watchAckResolvers.delete(reqId);
49591
+ r.resolve(msg);
49592
+ }
49593
+ }
49594
+ if (msg.type === "watch_list_result") {
49595
+ const reqId = msg._reqId;
49596
+ if (reqId && this.watchListResolvers.has(reqId)) {
49597
+ const r = this.watchListResolvers.get(reqId);
49598
+ clearTimeout(r.timer);
49599
+ this.watchListResolvers.delete(reqId);
49600
+ r.resolve(msg.watches ?? []);
49601
+ }
49602
+ }
49519
49603
  if (msg.type === "error") {
49520
49604
  this.debug(`broker error: ${msg.code} ${msg.message}`);
49521
49605
  const id = msg.id ? String(msg.id) : null;
@@ -51247,6 +51331,43 @@ ${lines.join(`
51247
51331
  const result = await client2.skillDeploy(source);
51248
51332
  return text(`Skill "${result.name}" deployed.
51249
51333
  Files: ${result.files.join(", ")}`);
51334
+ }
51335
+ case "mesh_watch": {
51336
+ const { url, mode, extract, interval, notify_on, headers, label } = args ?? {};
51337
+ if (!url)
51338
+ return text("mesh_watch: `url` required", true);
51339
+ const client2 = allClients()[0];
51340
+ if (!client2)
51341
+ return text("mesh_watch: not connected", true);
51342
+ const result = await client2.watch(url, { mode, extract, interval, notify_on, headers, label });
51343
+ if (result.error)
51344
+ return text(`mesh_watch: ${result.error}`, true);
51345
+ return text(`Watching "${label ?? url}" (${result.mode}, every ${result.interval}s)
51346
+ Watch ID: ${result.watchId}`);
51347
+ }
51348
+ case "mesh_unwatch": {
51349
+ const { watch_id } = args ?? {};
51350
+ if (!watch_id)
51351
+ return text("mesh_unwatch: `watch_id` required", true);
51352
+ const client2 = allClients()[0];
51353
+ if (!client2)
51354
+ return text("mesh_unwatch: not connected", true);
51355
+ await client2.unwatch(watch_id);
51356
+ return text(`Watch ${watch_id} stopped.`);
51357
+ }
51358
+ case "mesh_watches": {
51359
+ const client2 = allClients()[0];
51360
+ if (!client2)
51361
+ return text("mesh_watches: not connected", true);
51362
+ const watches = await client2.watchList();
51363
+ if (watches.length === 0)
51364
+ return text("No active watches.");
51365
+ const lines = watches.map((w) => `- **${w.id}** ${w.label ? `(${w.label}) ` : ""}${w.url}
51366
+ mode: ${w.mode} | interval: ${w.interval}s | last: ${w.lastValue?.slice(0, 30) ?? "pending"} | checked: ${w.lastCheck ?? "never"}`);
51367
+ return text(`${watches.length} active watch(es):
51368
+
51369
+ ${lines.join(`
51370
+ `)}`);
51250
51371
  }
51251
51372
  default:
51252
51373
  return text(`Unknown tool: ${name}`, true);
@@ -52604,7 +52725,7 @@ init_config();
52604
52725
  // package.json
52605
52726
  var package_default = {
52606
52727
  name: "claudemesh-cli",
52607
- version: "0.8.6",
52728
+ version: "0.8.7",
52608
52729
  description: "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
52609
52730
  keywords: [
52610
52731
  "claude-code",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudemesh-cli",
3
- "version": "0.8.6",
3
+ "version": "0.8.7",
4
4
  "description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
5
5
  "keywords": [
6
6
  "claude-code",