claudemesh-cli 0.8.6 → 0.8.8

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 +145 -3
  2. package/package.json +4 -4
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)
@@ -49125,9 +49191,30 @@ class BrokerClient {
49125
49191
  const ciphertext = String(msg.ciphertext ?? "");
49126
49192
  const senderPubkey = String(msg.senderPubkey ?? "");
49127
49193
  (async () => {
49128
- const kind = senderPubkey ? "direct" : "unknown";
49194
+ const isSystem = msg.subtype === "system" || senderPubkey === "system";
49195
+ const kind = isSystem ? "broadcast" : senderPubkey ? "direct" : "unknown";
49129
49196
  let plaintext = null;
49130
- if (senderPubkey && nonce && ciphertext) {
49197
+ if (isSystem) {
49198
+ const event = msg.event ? String(msg.event) : "system";
49199
+ const data = msg.eventData;
49200
+ if (event === "watch_triggered" && data) {
49201
+ plaintext = `[WATCH] ${data.label ?? data.url}: ${data.oldValue} → ${data.newValue}`;
49202
+ } else if (event === "mcp_deployed" && data) {
49203
+ plaintext = `[SERVICE] "${data.name}" deployed (${data.tool_count} tools) by ${data.deployed_by}`;
49204
+ } else if (event === "mcp_undeployed" && data) {
49205
+ plaintext = `[SERVICE] "${data.name}" undeployed by ${data.by}`;
49206
+ } else if (event === "mcp_scope_changed" && data) {
49207
+ plaintext = `[SERVICE] "${data.name}" scope changed to ${JSON.stringify(data.scope)} by ${data.by}`;
49208
+ } else if (event === "peer_joined" && data) {
49209
+ plaintext = `[MESH] ${data.displayName ?? "peer"} joined`;
49210
+ } else if (event === "peer_left" && data) {
49211
+ plaintext = `[MESH] ${data.displayName ?? "peer"} left`;
49212
+ } else if (data) {
49213
+ plaintext = `[${event}] ${JSON.stringify(data)}`;
49214
+ } else {
49215
+ plaintext = `[${event}]`;
49216
+ }
49217
+ } else if (senderPubkey && nonce && ciphertext) {
49131
49218
  plaintext = await decryptDirect({ nonce, ciphertext }, senderPubkey, this.sessionSecretKey ?? this.mesh.secretKey);
49132
49219
  }
49133
49220
  if (plaintext === null && ciphertext && !senderPubkey) {
@@ -49516,6 +49603,24 @@ class BrokerClient {
49516
49603
  r.resolve({ name: msg.name, files: msg.files ?? [] });
49517
49604
  }
49518
49605
  }
49606
+ if (msg.type === "watch_ack") {
49607
+ const reqId = msg._reqId;
49608
+ if (reqId && this.watchAckResolvers.has(reqId)) {
49609
+ const r = this.watchAckResolvers.get(reqId);
49610
+ clearTimeout(r.timer);
49611
+ this.watchAckResolvers.delete(reqId);
49612
+ r.resolve(msg);
49613
+ }
49614
+ }
49615
+ if (msg.type === "watch_list_result") {
49616
+ const reqId = msg._reqId;
49617
+ if (reqId && this.watchListResolvers.has(reqId)) {
49618
+ const r = this.watchListResolvers.get(reqId);
49619
+ clearTimeout(r.timer);
49620
+ this.watchListResolvers.delete(reqId);
49621
+ r.resolve(msg.watches ?? []);
49622
+ }
49623
+ }
49519
49624
  if (msg.type === "error") {
49520
49625
  this.debug(`broker error: ${msg.code} ${msg.message}`);
49521
49626
  const id = msg.id ? String(msg.id) : null;
@@ -51247,6 +51352,43 @@ ${lines.join(`
51247
51352
  const result = await client2.skillDeploy(source);
51248
51353
  return text(`Skill "${result.name}" deployed.
51249
51354
  Files: ${result.files.join(", ")}`);
51355
+ }
51356
+ case "mesh_watch": {
51357
+ const { url, mode, extract, interval, notify_on, headers, label } = args ?? {};
51358
+ if (!url)
51359
+ return text("mesh_watch: `url` required", true);
51360
+ const client2 = allClients()[0];
51361
+ if (!client2)
51362
+ return text("mesh_watch: not connected", true);
51363
+ const result = await client2.watch(url, { mode, extract, interval, notify_on, headers, label });
51364
+ if (result.error)
51365
+ return text(`mesh_watch: ${result.error}`, true);
51366
+ return text(`Watching "${label ?? url}" (${result.mode}, every ${result.interval}s)
51367
+ Watch ID: ${result.watchId}`);
51368
+ }
51369
+ case "mesh_unwatch": {
51370
+ const { watch_id } = args ?? {};
51371
+ if (!watch_id)
51372
+ return text("mesh_unwatch: `watch_id` required", true);
51373
+ const client2 = allClients()[0];
51374
+ if (!client2)
51375
+ return text("mesh_unwatch: not connected", true);
51376
+ await client2.unwatch(watch_id);
51377
+ return text(`Watch ${watch_id} stopped.`);
51378
+ }
51379
+ case "mesh_watches": {
51380
+ const client2 = allClients()[0];
51381
+ if (!client2)
51382
+ return text("mesh_watches: not connected", true);
51383
+ const watches = await client2.watchList();
51384
+ if (watches.length === 0)
51385
+ return text("No active watches.");
51386
+ const lines = watches.map((w) => `- **${w.id}** ${w.label ? `(${w.label}) ` : ""}${w.url}
51387
+ mode: ${w.mode} | interval: ${w.interval}s | last: ${w.lastValue?.slice(0, 30) ?? "pending"} | checked: ${w.lastCheck ?? "never"}`);
51388
+ return text(`${watches.length} active watch(es):
51389
+
51390
+ ${lines.join(`
51391
+ `)}`);
51250
51392
  }
51251
51393
  default:
51252
51394
  return text(`Unknown tool: ${name}`, true);
@@ -52604,7 +52746,7 @@ init_config();
52604
52746
  // package.json
52605
52747
  var package_default = {
52606
52748
  name: "claudemesh-cli",
52607
- version: "0.8.6",
52749
+ version: "0.8.8",
52608
52750
  description: "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
52609
52751
  keywords: [
52610
52752
  "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.8",
4
4
  "description": "Claude Code MCP client for claudemesh — peer mesh messaging between Claude sessions.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -48,10 +48,10 @@
48
48
  "prettier": "3.6.2",
49
49
  "typescript": "5.9.3",
50
50
  "vitest": "4.0.14",
51
- "@turbostarter/vitest-config": "0.1.0",
52
- "@turbostarter/tsconfig": "0.1.0",
53
51
  "@turbostarter/eslint-config": "0.1.0",
54
- "@turbostarter/prettier-config": "0.1.0"
52
+ "@turbostarter/prettier-config": "0.1.0",
53
+ "@turbostarter/tsconfig": "0.1.0",
54
+ "@turbostarter/vitest-config": "0.1.0"
55
55
  },
56
56
  "scripts": {
57
57
  "build": "bun build src/index.ts --target=node --outfile dist/index.js --banner \"#!/usr/bin/env node\" && chmod +x dist/index.js",