agent-comm-hub 0.1.8 → 0.1.9

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 CHANGED
@@ -63,6 +63,13 @@ npm install -D agent-comm-hub
63
63
  npx agent-comm-hub
64
64
  ```
65
65
 
66
+ Update later without a manual reinstall (files are replaced in place, so an
67
+ installed auto-start launcher keeps working; restart the hub afterwards):
68
+
69
+ ```bash
70
+ agent-comm-hub update
71
+ ```
72
+
66
73
  ### 2. Start the hub
67
74
 
68
75
  ```bash
package/README.zh.md CHANGED
@@ -63,6 +63,12 @@ npm install -D agent-comm-hub
63
63
  npx agent-comm-hub
64
64
  ```
65
65
 
66
+ 之后想更新(免手动重装,文件原地替换,已装的自启动器不受影响;更新后重启 hub):
67
+
68
+ ```bash
69
+ agent-comm-hub update
70
+ ```
71
+
66
72
  ### 2. 启动 hub
67
73
 
68
74
  ```bash
package/lib/cli.js CHANGED
@@ -710,7 +710,7 @@ function readBody(req) {
710
710
 
711
711
  // src/index.ts
712
712
  var SERVER_NAME = "agent-comm-hub";
713
- var SERVER_VERSION = "0.1.8";
713
+ var SERVER_VERSION = "0.1.9";
714
714
  var DEFAULT_HOST = "127.0.0.1";
715
715
  var DEFAULT_PORT = 18764;
716
716
  var DEFAULT_PATH = "/mcp";
@@ -952,9 +952,9 @@ async function runSetup(options = {}) {
952
952
  // src/ops.ts
953
953
  import { execFileSync } from "node:child_process";
954
954
  import { request } from "node:http";
955
- import { mkdirSync, rmSync, writeFileSync } from "node:fs";
955
+ import { mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
956
956
  import { homedir as homedir2 } from "node:os";
957
- import { join as join2 } from "node:path";
957
+ import { dirname as dirname2, join as join2 } from "node:path";
958
958
  import { fileURLToPath as fileURLToPath2 } from "node:url";
959
959
  async function runStatus(options = {}) {
960
960
  const host = options.host ?? "127.0.0.1";
@@ -1004,6 +1004,32 @@ async function runStatus(options = {}) {
1004
1004
  return { ...notRunning, error: error.message };
1005
1005
  }
1006
1006
  }
1007
+ function runUpdate() {
1008
+ const messages = [];
1009
+ const pkgFile = join2(dirname2(fileURLToPath2(import.meta.url)), "..", "package.json");
1010
+ const readVersion = () => {
1011
+ try {
1012
+ return JSON.parse(readFileSync(pkgFile, "utf8")).version ?? "?";
1013
+ } catch {
1014
+ return "?";
1015
+ }
1016
+ };
1017
+ try {
1018
+ const before = readVersion();
1019
+ messages.push(`current version: ${before}`);
1020
+ const npmBin = process.platform === "win32" ? "npm.cmd" : "npm";
1021
+ const out = execFileSync(npmBin, ["install", "-g", "agent-comm-hub@latest"], { encoding: "utf8", windowsHide: true, shell: process.platform === "win32" });
1022
+ const tail = out.trim().split(/\r?\n/).slice(-3).filter(Boolean).join(" | ");
1023
+ if (tail) messages.push(tail);
1024
+ const after = readVersion();
1025
+ if (after === before) messages.push(`already up to date (v${after})`);
1026
+ else messages.push(`updated: v${before} -> v${after}`);
1027
+ messages.push("restart the hub (agent-comm-hub) to pick up the new version");
1028
+ return { ok: true, messages };
1029
+ } catch (error) {
1030
+ return { ok: false, messages: [`update failed: ${error.message}`] };
1031
+ }
1032
+ }
1007
1033
  function cliPath() {
1008
1034
  return fileURLToPath2(import.meta.url);
1009
1035
  }
@@ -1143,6 +1169,9 @@ Usage:
1143
1169
  one-shot auto-start (Windows Run
1144
1170
  key + hidden VBS launcher, no admin;
1145
1171
  Linux systemd; --dry-run prints)
1172
+ agent-comm-hub update self-update from the npm registry
1173
+ (files updated in place; restart
1174
+ the hub afterwards)
1146
1175
 
1147
1176
  Hub options:
1148
1177
  --host <addr> Bind address (default 127.0.0.1)
@@ -1231,6 +1260,20 @@ try {
1231
1260
  }
1232
1261
  process.exit(0);
1233
1262
  }
1263
+ if (command === "update") {
1264
+ const args2 = parseArgs(rest);
1265
+ if (args2["--help"] || args2["-h"]) {
1266
+ printHelp();
1267
+ process.exit(0);
1268
+ }
1269
+ const result = runUpdate();
1270
+ for (const message of result.messages) log.info(message);
1271
+ if (!result.ok) {
1272
+ console.error("update: failed \u2014 see messages above");
1273
+ process.exit(1);
1274
+ }
1275
+ process.exit(0);
1276
+ }
1234
1277
  const args = parseArgs(argv);
1235
1278
  if (args["--help"] || args["-h"]) {
1236
1279
  printHelp();
package/lib/index.js CHANGED
@@ -713,7 +713,7 @@ function readBody(req) {
713
713
 
714
714
  // src/index.ts
715
715
  var SERVER_NAME = "agent-comm-hub";
716
- var SERVER_VERSION = "0.1.8";
716
+ var SERVER_VERSION = "0.1.9";
717
717
  var DEFAULT_HOST = "127.0.0.1";
718
718
  var DEFAULT_PORT = 18764;
719
719
  var DEFAULT_PATH = "/mcp";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-comm-hub",
3
- "version": "0.1.8",
3
+ "version": "0.1.9",
4
4
  "description": "Generic multi-peer MCP hub: any MCP-capable agent (MiniMax Code, Claude Code, opencode, Codex, Gemini CLI, DSH, ...) connects to one local streamable-http endpoint and they chat, delegate tasks, and acknowledge in real time",
5
5
  "keywords": [
6
6
  "mcp",