agent-comm-hub 0.1.8 → 0.1.10
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 +7 -0
- package/README.zh.md +6 -0
- package/agents/SKILL.md +20 -0
- package/lib/cli.js +46 -3
- package/lib/index.js +1 -1
- package/package.json +1 -1
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
package/agents/SKILL.md
CHANGED
|
@@ -52,6 +52,26 @@ Optional: call `bridge_register(peerId)` to claim a readable id
|
|
|
52
52
|
decline and `"failed"` when it could not be completed (always with a note).
|
|
53
53
|
5. Unsure whether the peer is online: check `bridge_peers()` first.
|
|
54
54
|
|
|
55
|
+
## 典型工作流(口语化示例)
|
|
56
|
+
|
|
57
|
+
按场景直接照做(工具名保持英文):
|
|
58
|
+
|
|
59
|
+
**1. 别人派活给你(如 codex 规划 → 你开发)**
|
|
60
|
+
- 收到任务:先 `bridge_ack(ref, "accepted")` 回执,说"收到,开始干"。
|
|
61
|
+
- 干完:把成果和交付说明发回给派活的人(`bridge_chat` / `bridge_task`),
|
|
62
|
+
再 `bridge_ack(ref, "done", 交付说明)`,让它审查。
|
|
63
|
+
- 干不了:`bridge_ack(ref, "rejected")` 并说明原因。
|
|
64
|
+
|
|
65
|
+
**2. 你派活给别人(等 vs 不等)**
|
|
66
|
+
- 挂着等:`bridge_task` 发出去后循环 `bridge_wait()`,直到收到交付,接手检查。
|
|
67
|
+
- 不等:发完就干别的;对方完成会主动发回结果,你之后随时用
|
|
68
|
+
`bridge_poll()` / `bridge_wait()` / `bridge_history()` 查收(消息会排队存着)。
|
|
69
|
+
|
|
70
|
+
**3. 多 agent 实时讨论**
|
|
71
|
+
- 说完自己的观点后不要散场:循环 `bridge_wait()` 继续听,一轮没消息就再等
|
|
72
|
+
一轮,直到讨论有结论或用户说"结束"。
|
|
73
|
+
- 超时(`{type:"timeout"}`)不是失败,继续等。
|
|
74
|
+
|
|
55
75
|
## Notes
|
|
56
76
|
|
|
57
77
|
- Messages travel on loopback only (127.0.0.1:18764); never put credentials
|
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.
|
|
713
|
+
var SERVER_VERSION = "0.1.10";
|
|
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.
|
|
716
|
+
var SERVER_VERSION = "0.1.10";
|
|
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.
|
|
3
|
+
"version": "0.1.10",
|
|
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",
|