@sleep2agi/agent-network 2.3.0-preview.23 → 2.3.0-preview.231

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 (204) hide show
  1. package/README.md +35 -395
  2. package/build-info.json +7 -0
  3. package/dist/bin/anet.cjs +101 -0
  4. package/dist/bin/cli.d.ts +1 -1
  5. package/dist/bin/cli.js +20 -1
  6. package/dist/src/active-network-task.d.ts +28 -0
  7. package/dist/src/batch-workdir.d.ts +9 -0
  8. package/dist/src/bootstrap-password-db.d.ts +13 -0
  9. package/dist/src/build-info.d.ts +26 -0
  10. package/dist/src/channel-attachments.d.ts +29 -0
  11. package/dist/src/channel-inbox-wake.d.ts +21 -0
  12. package/dist/src/channel-meta.d.ts +10 -0
  13. package/dist/src/channel-peer-reply.d.ts +41 -0
  14. package/dist/src/channel-task-trace.d.ts +14 -0
  15. package/dist/src/claude-vendor-env.d.ts +28 -0
  16. package/dist/src/cli-args.d.ts +8 -0
  17. package/dist/src/cli-auth-session.d.ts +47 -0
  18. package/dist/src/cli-errors.d.ts +41 -0
  19. package/dist/src/cli-exit.d.ts +11 -0
  20. package/dist/src/cli-help.d.ts +10 -0
  21. package/dist/src/cli-version-display.d.ts +16 -0
  22. package/dist/src/client-task-trace.d.ts +9 -0
  23. package/dist/src/client.js +1 -1
  24. package/dist/src/codex-adopt.d.ts +46 -0
  25. package/dist/src/codex-auth-fingerprint.d.ts +211 -0
  26. package/dist/src/codex-bin-pin.d.ts +23 -0
  27. package/dist/src/codex-commhub-mcp.d.ts +22 -0
  28. package/dist/src/codex-copresence-bridge-log.d.ts +44 -0
  29. package/dist/src/codex-copresence-env.d.ts +5 -0
  30. package/dist/src/codex-copresence-login-gate.d.ts +18 -0
  31. package/dist/src/codex-copresence-model.d.ts +23 -0
  32. package/dist/src/codex-copresence-preflight.d.ts +78 -0
  33. package/dist/src/codex-copresence-profile.d.ts +126 -0
  34. package/dist/src/codex-copresence-recovery.d.ts +70 -0
  35. package/dist/src/codex-copresence-resume-timeout.d.ts +28 -0
  36. package/dist/src/codex-copresence-rollout-guard.d.ts +36 -0
  37. package/dist/src/codex-copresence-rpc.d.ts +17 -0
  38. package/dist/src/codex-copresence-thread.d.ts +13 -0
  39. package/dist/src/codex-copresence-yolo.d.ts +16 -0
  40. package/dist/src/codex-external-appserver.d.ts +130 -0
  41. package/dist/src/codex-fork-recovery.d.ts +52 -0
  42. package/dist/src/codex-home-enforce.d.ts +88 -0
  43. package/dist/src/codex-lifecycle-account.d.ts +104 -0
  44. package/dist/src/codex-lifecycle-canary.d.ts +20 -0
  45. package/dist/src/codex-lifecycle-facts.d.ts +53 -0
  46. package/dist/src/codex-lifecycle-fork.d.ts +91 -0
  47. package/dist/src/codex-lifecycle-preflight.d.ts +79 -0
  48. package/dist/src/codex-lifecycle-receipt.d.ts +53 -0
  49. package/dist/src/codex-lifecycle-restart.d.ts +88 -0
  50. package/dist/src/codex-login-share-guard.d.ts +146 -0
  51. package/dist/src/codex-menu.d.ts +99 -0
  52. package/dist/src/codex-model-default.d.ts +6 -0
  53. package/dist/src/codex-node-login.d.ts +98 -0
  54. package/dist/src/codex-pending-thread-restart.d.ts +69 -0
  55. package/dist/src/codex-reasoning-effort.d.ts +17 -0
  56. package/dist/src/codex-recovery-lease.d.ts +39 -0
  57. package/dist/src/codex-recovery-resource-gate.d.ts +15 -0
  58. package/dist/src/codex-resume.d.ts +89 -0
  59. package/dist/src/codex-rollout-history-guard.d.ts +84 -0
  60. package/dist/src/codex-tui-client-health.d.ts +30 -0
  61. package/dist/src/commhub-response.d.ts +1 -0
  62. package/dist/src/controlled-upload.d.ts +83 -0
  63. package/dist/src/copresence-deps.d.ts +22 -0
  64. package/dist/src/copresence-identity.d.ts +363 -0
  65. package/dist/src/copresence-startup-diagnosis.d.ts +17 -0
  66. package/dist/src/daemon-adopt.d.ts +14 -0
  67. package/dist/src/daemon-anet-bin.d.ts +32 -0
  68. package/dist/src/daemon-capability-display.d.ts +110 -0
  69. package/dist/src/daemon-capability-display.js +21 -0
  70. package/dist/src/daemon-codex-inventory.d.ts +65 -0
  71. package/dist/src/daemon-inherited-env.d.ts +9 -0
  72. package/dist/src/daemon-provider-account-custody.d.ts +28 -0
  73. package/dist/src/daemon-provider-account-readback.d.ts +3 -0
  74. package/dist/src/daemon-provider-application.d.ts +36 -0
  75. package/dist/src/daemon-provider-apply-command.d.ts +9 -0
  76. package/dist/src/daemon-provider-collect.d.ts +29 -0
  77. package/dist/src/daemon-provider-command.d.ts +7 -0
  78. package/dist/src/daemon-provider-initialize.d.ts +27 -0
  79. package/dist/src/daemon-provider-lifecycle.d.ts +4 -0
  80. package/dist/src/daemon-provider-store.d.ts +104 -0
  81. package/dist/src/daemon-runtime-path-preflight.d.ts +22 -0
  82. package/dist/src/daemon-runtime-staleness.d.ts +13 -0
  83. package/dist/src/dashboard-managed-process.d.ts +35 -0
  84. package/dist/src/display-width.d.ts +27 -0
  85. package/dist/src/doctor-node-count.d.ts +28 -0
  86. package/dist/src/grok-attach-client.d.ts +15 -1
  87. package/dist/src/grok-build-drift.d.ts +15 -0
  88. package/dist/src/grok-copresence-disclosure.d.ts +11 -0
  89. package/dist/src/grok-copresence-orchestration.d.ts +75 -0
  90. package/dist/src/grok-copresence-profile.d.ts +22 -1
  91. package/dist/src/grok-create-mode.d.ts +19 -0
  92. package/dist/src/host-telemetry.d.ts +14 -0
  93. package/dist/src/hub-health-timeout.d.ts +4 -0
  94. package/dist/src/hub-server-version.d.ts +64 -0
  95. package/dist/src/hub-stop.d.ts +74 -0
  96. package/dist/src/hub-time-display.d.ts +20 -0
  97. package/dist/src/hub-version-skew.d.ts +19 -0
  98. package/dist/src/im/correlation-store.d.ts +34 -0
  99. package/dist/src/im/feishu/adapter.d.ts +47 -0
  100. package/dist/src/im/feishu/bridge.d.ts +72 -14
  101. package/dist/src/im/feishu/chat-context.d.ts +44 -0
  102. package/dist/src/im/feishu/config.d.ts +15 -1
  103. package/dist/src/im/feishu/hub-upload.d.ts +1 -1
  104. package/dist/src/im/feishu/queue-notice.d.ts +2 -0
  105. package/dist/src/im/feishu/worker-lifecycle.d.ts +13 -0
  106. package/dist/src/im/feishu/worker.js +171 -154
  107. package/dist/src/inbox-drain.d.ts +20 -0
  108. package/dist/src/local-process-state.d.ts +12 -0
  109. package/dist/src/locale-diagnostic.d.ts +12 -0
  110. package/dist/src/login-client-label.d.ts +6 -0
  111. package/dist/src/ls-columns.d.ts +15 -0
  112. package/dist/src/mock-llm.d.ts +12 -0
  113. package/dist/src/node-activity-log.d.ts +4 -0
  114. package/dist/src/node-clone.d.ts +134 -0
  115. package/dist/src/node-delete-hub.d.ts +42 -0
  116. package/dist/src/node-files.d.ts +62 -0
  117. package/dist/src/node-locate.d.ts +60 -0
  118. package/dist/src/node-ls-all.d.ts +80 -0
  119. package/dist/src/node-menu.d.ts +40 -0
  120. package/dist/src/node-not-found.d.ts +1 -0
  121. package/dist/src/node-perm.d.ts +74 -0
  122. package/dist/src/node-remote.d.ts +180 -0
  123. package/dist/src/node-running-guard.d.ts +9 -0
  124. package/dist/src/node-secret-file.d.ts +32 -0
  125. package/dist/src/node-server-identity.d.ts +35 -0
  126. package/dist/src/node-server-payload.d.ts +66 -0
  127. package/dist/src/node-server-rules-file.d.ts +14 -0
  128. package/dist/src/node-server-secrets.d.ts +60 -0
  129. package/dist/src/node-server-version.d.ts +39 -0
  130. package/dist/src/node-server.d.ts +0 -12
  131. package/dist/src/node-server.js +8 -1
  132. package/dist/src/node-skills.d.ts +57 -0
  133. package/dist/src/normalize-runtime.d.ts +28 -1
  134. package/dist/src/offline-age.d.ts +29 -0
  135. package/dist/src/one-line-cell.d.ts +20 -0
  136. package/dist/src/opencode-agent-node-pair.d.ts +42 -0
  137. package/dist/src/opencode-auth-login.d.ts +43 -0
  138. package/dist/src/opencode-free-tier.d.ts +27 -0
  139. package/dist/src/opencode-generation-create.d.ts +27 -0
  140. package/dist/src/opencode-generation-record.d.ts +24 -0
  141. package/dist/src/opencode-launch-env.d.ts +13 -0
  142. package/dist/src/opencode-owner-mode.d.ts +6 -0
  143. package/dist/src/opencode-package-binary.d.ts +44 -0
  144. package/dist/src/opencode-pin.d.ts +28 -8
  145. package/dist/src/opencode-preset.d.ts +42 -8
  146. package/dist/src/opencode-runtime-binding.d.ts +30 -0
  147. package/dist/src/opencode-safe-root.d.ts +36 -0
  148. package/dist/src/opencode-shared-server-create.d.ts +5 -0
  149. package/dist/src/opencode-smoke-env.d.ts +1 -0
  150. package/dist/src/opencode-start-mode.d.ts +8 -0
  151. package/dist/src/opencode-v2-configured-model.d.ts +34 -0
  152. package/dist/src/opencode-v2-create-align.d.ts +18 -0
  153. package/dist/src/opencode-versions.d.ts +44 -0
  154. package/dist/src/os-user.d.ts +4 -0
  155. package/dist/src/outbound-attachments.d.ts +60 -0
  156. package/dist/src/outbound-tool-names.d.ts +1 -0
  157. package/dist/src/owned-roots.d.ts +58 -0
  158. package/dist/src/owner-env-file.d.ts +2 -0
  159. package/dist/src/package-mode-preflight.d.ts +41 -0
  160. package/dist/src/posix-codex-copresence.d.ts +33 -0
  161. package/dist/src/posix-modes.d.ts +36 -0
  162. package/dist/src/primary-network.d.ts +23 -0
  163. package/dist/src/private-state.d.ts +18 -0
  164. package/dist/src/process-telemetry.d.ts +12 -0
  165. package/dist/src/profile-merge.d.ts +12 -0
  166. package/dist/src/profile-serialize.d.ts +1 -0
  167. package/dist/src/provider-application-contract.d.ts +11 -0
  168. package/dist/src/provider-apply.d.ts +28 -0
  169. package/dist/src/provider-presets.d.ts +76 -0
  170. package/dist/src/reply-local-links.d.ts +47 -0
  171. package/dist/src/reply-originator.d.ts +20 -0
  172. package/dist/src/resume-runtime-infer.d.ts +18 -0
  173. package/dist/src/rules-file.d.ts +53 -0
  174. package/dist/src/scoped-secrets.d.ts +56 -0
  175. package/dist/src/secret-shell-guidance.d.ts +4 -0
  176. package/dist/src/session-status-class.d.ts +48 -0
  177. package/dist/src/shared/opencode-borrowed-launch-health.d.ts +29 -0
  178. package/dist/src/shared/provider-collection.d.ts +9 -0
  179. package/dist/src/shared/provider-initialization.d.ts +7 -0
  180. package/dist/src/shared/reserved-env.d.ts +3 -0
  181. package/dist/src/shared/scoped-secret-contract.d.ts +1 -0
  182. package/dist/src/shared/scoped-secret-env.d.ts +3 -0
  183. package/dist/src/sibling-agent-node.d.ts +23 -0
  184. package/dist/src/stale-socket.d.ts +118 -0
  185. package/dist/src/standalone-bin.d.ts +101 -0
  186. package/dist/src/standalone-build-stamp.d.ts +33 -0
  187. package/dist/src/start-resource-gate.d.ts +146 -0
  188. package/dist/src/stopped-receipt.d.ts +8 -0
  189. package/dist/src/subcommand-redirect.d.ts +26 -0
  190. package/dist/src/task-trace.d.ts +33 -0
  191. package/dist/src/tmux-attach.d.ts +11 -0
  192. package/dist/src/tmux-capability.d.ts +58 -0
  193. package/dist/src/tmux-exact-target.d.ts +36 -0
  194. package/dist/src/tmux-format.d.ts +20 -0
  195. package/dist/src/tmux-pane-prompt.d.ts +22 -0
  196. package/dist/src/tmux.d.ts +44 -0
  197. package/dist/src/token-cli.d.ts +13 -0
  198. package/dist/src/tool-allowlist.d.ts +28 -0
  199. package/dist/src/unsafe-package-path-reason.d.ts +31 -0
  200. package/dist/src/upgrade-channel.d.ts +31 -0
  201. package/dist/src/win-launcher.d.ts +20 -0
  202. package/dist/src/windows-codex-copresence.d.ts +238 -0
  203. package/dist/src/windows-rename-retry.d.ts +13 -0
  204. package/package.json +17 -11
package/README.md CHANGED
@@ -5,434 +5,74 @@
5
5
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/sleep2agi/agent-network/blob/main/LICENSE)
6
6
  [![Docs](https://img.shields.io/badge/docs-anet.sh-009e7e.svg)](https://anet.sh)
7
7
 
8
- Run a local network of AI agents from one CLI.
9
-
10
- `anet` starts a CommHub, launches the web dashboard, creates agent nodes, and lets those nodes talk to each other through MCP tools such as `send_task`, `get_task`, and `get_all_status`.
11
-
12
- ## What It Is
13
-
14
- Agent Network is a local-first multi-agent runtime:
15
-
16
- - **CommHub**: MCP + REST + SSE hub for task routing, auth, networks, and status.
17
- - **Agent nodes**: long-running AI workers backed by Claude Code, Claude Agent SDK, Codex SDK, or Grok Build ACP.
18
- - **Dashboard**: browser UI for topology, chat, tasks, node health, and server telemetry.
19
- - **CLI**: `anet`, the single entry point for setup, auth, node lifecycle, and demos.
20
-
21
- The default path runs entirely on your machine. LAN sharing is opt-in.
22
-
23
- ## Requirements
24
-
25
- - Node.js **>= 22.13.0**
26
- - npm **>= 10**
27
- - Bun **>= 1.2.0** (`anet hub start` lazy-runs the Bun-based CommHub server)
28
- - macOS or Linux
29
-
30
- Install Bun if needed:
31
-
32
- ```bash
33
- curl -fsSL https://bun.sh/install | bash
34
- ```
8
+ `anet` connects local AI agents through one self-hosted Hub. It starts CommHub and the Dashboard, creates node identities, and manages node lifecycle, networks, tokens, tasks, and channels.
35
9
 
36
10
  ## Install
37
11
 
38
- Stable:
39
-
40
- ```bash
41
- npm install -g @sleep2agi/agent-network
42
- anet -v
43
- ```
44
-
45
- Preview channel:
12
+ Requires Node.js ≥ 22.13 and Bun ≥ 1.2.
46
13
 
47
14
  ```bash
48
- npm install -g @sleep2agi/agent-network@preview
49
- anet -v
15
+ npm install -g bun @sleep2agi/agent-network @sleep2agi/agent-node
50
16
  ```
51
17
 
52
- Npm dist-tags move independently. Query the registry instead of relying on a
53
- version table embedded in this source tree:
18
+ Stable releases use npm's `latest` tag. Features that are still being validated use `preview`:
54
19
 
55
20
  ```bash
56
- npm view @sleep2agi/agent-network dist-tags --json
57
- npm view @sleep2agi/agent-node dist-tags --json
58
- npm view @sleep2agi/commhub-server dist-tags --json
21
+ anet upgrade --channel preview
59
22
  ```
60
23
 
61
- The Grok co-presence text below describes candidate source only until a
62
- reviewed package is explicitly published to `preview`.
24
+ Do not copy fixed package or preview numbers from old issues. Check the [upgrade guide](https://anet.sh/guide/upgrade) and npm dist-tags for the current release.
63
25
 
64
- ## 5-Minute Quick Start
26
+ ## Quick start
65
27
 
66
- Open three terminals.
67
-
68
- ### 1. Start CommHub
28
+ Open three terminals:
69
29
 
70
30
  ```bash
31
+ # Terminal 1 — Hub
71
32
  anet hub start
72
- ```
73
33
 
74
- Default local URL:
75
-
76
- ```text
77
- http://127.0.0.1:9200
78
- ```
79
-
80
- By default the hub binds to localhost. Use `--host 0.0.0.0` only when you intentionally want LAN clients to connect.
81
-
82
- ### 2. Start Dashboard
83
-
84
- ```bash
34
+ # Terminal 2 — Dashboard
85
35
  anet hub dashboard
86
- ```
87
-
88
- Open:
89
36
 
90
- ```text
91
- http://localhost:3000
92
- ```
93
-
94
- ### 3. Log In, Create A Node, Start It
95
-
96
- ```bash
97
- anet login --username admin --password anethub
37
+ # Terminal 3 — login, create, start
38
+ anet login --hub http://127.0.0.1:9200 --username admin
98
39
  anet node create my-bot
99
40
  anet node start my-bot
100
41
  ```
101
42
 
102
- `anet node create` walks you through:
103
-
104
- 1. Runtime: `claude-code-cli`, `claude-agent-sdk`, `codex-sdk`, `grok-build-acp`, or the experimental preview-only `grok-build-cli` co-presence runtime.
105
- 2. Provider preset: Anthropic, MiniMax, InternLM, Xiaomi MiMo, or `custom` (any Anthropic-compatible endpoint — used for DeepSeek / GLM / Kimi / OpenRouter etc.; codex-sdk for OpenAI Codex; Grok runtimes reuse the local Grok CLI login).
106
- 3. API key and model settings.
107
-
108
- When the node starts successfully, look for:
109
-
110
- ```text
111
- SSE connected
112
- ```
113
-
114
- Then use the Dashboard chat panel to send `my-bot` a message.
115
-
116
- ## Multi-Agent Collaboration
117
-
118
- Create a second node:
119
-
120
- ```bash
121
- anet node create reviewer
122
- anet node start reviewer
123
- ```
124
-
125
- Ask `my-bot`:
126
-
127
- ```text
128
- Ask reviewer to review this plan and summarize the risks.
129
- ```
130
-
131
- The first agent can discover peers with `get_all_status`, delegate work with `send_task`, poll with `get_task`, and integrate the reply. The dashboard Tasks and Messages views show the chain.
132
-
133
- ## LAN Hub
134
-
135
- On the hub machine:
136
-
137
- ```bash
138
- anet hub start --host 0.0.0.0
139
- ```
140
-
141
- On another machine:
142
-
143
- ```bash
144
- npm install -g @sleep2agi/agent-network
145
- anet init --hub http://<HUB-LAN-IP>:9200
146
- anet login --username admin --password anethub
147
- anet node create remote-bot
148
- anet node start remote-bot
149
- ```
150
-
151
- Do not expose the hub directly to the public internet without a reverse proxy, HTTPS, firewall rules, and reviewed auth settings.
152
-
153
- ## Runtimes
154
-
155
- | Runtime | Use When | Notes |
156
- |---|---|---|
157
- | `claude-code-cli` | You want Claude Code CLI sessions and channel support | Uses Claude Code process; supports stable `COMMHUB_RESUME_ID` in recent previews |
158
- | `claude-agent-sdk` | You want Anthropic-compatible API providers | Good default for provider presets |
159
- | `codex-sdk` | You want Codex-backed nodes | Useful as a backup runtime when Claude quota is constrained |
160
- | `grok-build-acp` | You want Grok Build through `grok agent stdio` | Requires Grok Build CLI auth; stable for receive/reply, session persistence, and explicit `send_task` delegation |
161
- | `grok-build-cli` | You want one human-visible, text-only Grok TUI shared with trusted network tasks | **Experimental preview only.** Fixed `[todo_write]` tool profile; Linux and an exact Grok CLI build are required; approval ownership is not fully hardened |
162
-
163
- ### Grok Build ACP
164
-
165
- `grok-build-acp` uses the local Grok Build CLI via Agent Client Protocol (ACP). Install and authenticate Grok first:
166
-
167
- ```bash
168
- curl -fsSL https://x.ai/cli/install.sh | bash
169
- grok
170
- ```
171
-
172
- Create and start a node:
173
-
174
- ```bash
175
- anet node create grok-demo --runtime grok-build-acp
176
- anet node start grok-demo
177
- ```
178
-
179
- Look for:
180
-
181
- ```text
182
- runtime: grok-build-acp
183
- SSE connected
184
- ```
185
-
186
- Stable support:
187
-
188
- - Receive CommHub tasks through SSE.
189
- - Run one Grok Build ACP turn per task.
190
- - Persist `grokSession` into `.anet/nodes/<name>/config.json`.
191
- - Resume the saved Grok session on the next task.
192
- - Reply to the original sender through CommHub.
193
- - Explicit delegation such as `给 A站助手 发任务: ...` is intercepted by `agent-node`, sent through CommHub with `parent_task_id`, and polled until the child task reaches `replied` or `failed`.
194
-
195
- Current boundary:
196
-
197
- - Grok native MCP tool injection is not the stable path yet.
198
- - For cross-agent delegation, use explicit delegation wording so `agent-node` handles the CommHub call deterministically.
199
- - If Grok returns `grok ACP error -32603`, upgrade to the latest `@sleep2agi/agent-node` and restart the node; recent builds narrow ACP capabilities and include `error.data` diagnostics.
200
-
201
- Details: `docs/grok-build-runtime.md`.
202
-
203
- ### Grok Co-Presence TUI — Experimental Preview
204
-
205
- > **Dangerous experimental feature:** network tasks drive the same Grok TUI and share its conversation context. Approval ownership is not fully hardened. Use only with trusted tasks on a trusted network. This runtime is not supported for production and is not part of the `latest` release channel.
206
-
207
- The co-presence candidate is currently pinned to Linux with procfs mounted at `/proc` (including `/proc/self/fd`) and the exact Grok CLI build reported as `grok 0.2.93 (f00f96316d)` (the stable installer may append ` [stable]`). Install that build and log in as the same operating-system user that will run `anet`:
208
-
209
- ```bash
210
- grok login
211
- grok --version
212
- ```
213
-
214
- Create the shared-TUI node and start its bridge in the first terminal:
215
-
216
- ```bash
217
- anet node create grok-shared --runtime grok-build-cli
218
- anet node start grok-shared
219
- ```
220
-
221
- Attach an interactive terminal to the same TUI from a second terminal on the same machine and user account:
222
-
223
- ```bash
224
- anet grok attach grok-shared
225
- ```
226
-
227
- Press `Ctrl-]` to detach. While attached, a CommHub task sent to `grok-shared` is submitted to this same TUI, rendered in the visible session, and its completed answer is routed back to the originating task. This shared-session behavior is the reason untrusted tasks must not be connected.
228
-
229
- This preview selects a runtime-owned TUI agent profile whose exact model-tool
230
- inventory is `[todo_write]`. Filesystem, shell, network, media, MCP, scheduler,
231
- and subagent tools are unavailable; custom `tools`/`maxTurns` are unsupported
232
- in co-presence. It is a text-only co-presence preview, not a coding profile.
233
-
234
- The pinned 0.2.93 TUI resolves its session-local `todo_write` helper without
235
- human input. During an active network turn the preview admits only that exact
236
- no-request-ID lifecycle with `decision=allow`, at most once per turn; every other tool, identity,
237
- decision, overlap, mode transition, or unresolved completion remains closed.
238
- This deliberately narrow preview exception is not production approval-owner
239
- enforcement and is another reason to connect trusted tasks only.
240
-
241
- `anet node start` capability-checks a compatible global `agent-node` if one exists. It requires the machine-readable `ANET_CAPABILITY_GROK_COPRESENCE_V2` marker, so an older headless-only or V1 co-presence binary cannot shadow the fixed-profile preview. A global install is not required: when it is absent or incompatible, `anet` uses `npx -y @sleep2agi/agent-node@preview` to fetch and resolve the preview package, verifies its metadata/capability, then launches the resolved `agent-node` entrypoint directly. Direct launch lets `anet node stop` signal the real runtime instead of an installer wrapper. The fallback therefore needs npm registry access or an already populated npm cache on first start.
242
-
243
- The preview E2E covers the CommHub inbox path. `grok-build-cli` currently
244
- refuses Feishu channels because that forked worker does not yet share the
245
- credential-isolated log boundary; run Feishu on a separate non-Grok node.
246
-
247
- For the older process-per-turn Grok CLI lane, opt out of co-presence explicitly:
248
-
249
- ```bash
250
- anet node create grok-turn --runtime grok-build-cli --grok-headless
251
- anet node start grok-turn
252
- ```
253
-
254
- `anet grok attach` intentionally refuses a headless node. The separate ACP runtime remains available as:
255
-
256
- ```bash
257
- anet node create grok-acp --runtime grok-build-acp
258
- anet node start grok-acp
259
- ```
260
-
261
- `grok-build-acp` uses `grok agent stdio`; it is not the same execution path as `grok-build-cli --grok-headless`.
262
-
263
- This preview does **not** claim completion of the formal native Leader/Policy Gateway runtime. Its Phase 0 protocol freeze, Phase 1A implementation gate, production-grade approval ownership, and `latest` release gate remain locked. See the [Grok co-presence preview guide](../docs/grok-build-cli-preview.md) for the exact boundary.
43
+ The node is ready after its log reports `SSE connected`. Open `http://localhost:3000` and send it a task from Dashboard.
264
44
 
265
- ## Provider Presets
45
+ ## Runtime selection
266
46
 
267
- `anet node create` writes the correct provider environment into `.anet/nodes/<name>/config.json`.
47
+ `anet node create` shows only runtimes available in the installed release channel. Installation, authentication, permissions, and current availability are maintained in the [runtime guide](https://anet.sh/guide/runtimes).
268
48
 
269
- | Provider | Status | Notes |
270
- |---|---|---|
271
- | Anthropic | verified path | Native Anthropic Messages API |
272
- | MiniMax | verified path | Anthropic-compatible endpoint |
273
- | DeepSeek | verified path | Anthropic-compatible endpoint |
274
- | GLM / Zhipu | verified path | Anthropic-compatible endpoint |
275
- | Kimi / Moonshot | verified path | Anthropic-compatible endpoint |
276
- | OpenRouter | available | Anthropic-compatible routing |
277
- | Custom | available | Provide base URL, model, and token |
49
+ - Claude Code, Claude Agent SDK, Codex SDK, and Grok Build ACP are the published task-runtime paths.
50
+ - Codex TUI co-presence is preview-only and must be started and recovered with `--copresence`; see the [co-presence guide](https://anet.sh/guide/codex-copresence).
51
+ - OpenCode support is preview-only. Its automatic `npx` fallback is intentionally disabled, so install the documented CLI explicitly.
52
+ - Neither npm `latest` nor `preview` includes a shared Grok TUI. Use `grok-build-acp` for published Grok nodes and follow the [Grok nodes guide](https://anet.sh/guide/grok).
278
53
 
279
- ## Common Commands
54
+ Development branches may contain source-only runtime experiments. They are not supported installation paths until they appear in an npm dist-tag and the runtime guide.
280
55
 
281
- ```bash
282
- # Hub and dashboard
283
- anet hub start
284
- anet hub dashboard
56
+ ## What it provides
285
57
 
286
- # Auth
287
- anet register
288
- anet login --username <user> --password <password>
289
- anet logout
290
- anet whoami
291
- anet passwd
58
+ - **CommHub** — MCP, REST, SSE task delivery, authentication, networks, and audit state.
59
+ - **Agent Node** — long-running workers backed by the selected runtime.
60
+ - **Dashboard** — topology, chat, tasks, messages, and node health.
61
+ - **CLI** — setup, login, node/project lifecycle, channels, tokens, and diagnostics.
292
62
 
293
- # Nodes
294
- anet node create <name>
295
- anet node start <name>
296
- anet node start --all
297
- anet node stop <name>
298
- anet node resume <name>
299
- anet node rename <old> <new> --force
300
- anet node delete <name>
301
- anet node ls
302
- anet info <name>
303
- anet logs <name>
63
+ Runtimes with CommHub tool integration can discover peers and delegate work with tools such as `get_all_status`, `send_task`, and `get_task`. Replies and ordinary messages do not recursively invoke another model; see the [task lifecycle](https://anet.sh/concepts/task-lifecycle).
304
64
 
305
- # Grok co-presence (experimental preview; trusted tasks only)
306
- anet node create grok-shared --runtime grok-build-cli
307
- anet node start grok-shared
308
- anet grok attach grok-shared
65
+ ## Security
309
66
 
310
- # Network status and repair
311
- anet status
312
- anet tasks [status]
313
- anet doctor
314
- anet doctor --fix
315
-
316
- # Project and session helpers
317
- anet init --hub <url>
318
- anet init project
319
- anet project up
320
- anet project restart
321
- anet project down
322
- anet session ls
323
-
324
- # Channels and upgrades
325
- anet channel add telegram <name> --bot-token <tok> --allow <uid>
326
- anet channel add feishu <name> --app-id <id> --app-secret <secret> --allow <open-id> # see docs/feishu-quickstart.md
327
- anet channel ls
328
- anet upgrade
329
- anet upgrade --channel preview --dry-run
330
-
331
- # Batch / demos
332
- anet create --batch
333
- anet batch list
334
- anet batch stop <prefix>
335
- anet demo sci-team
336
- ```
337
-
338
- ## Configuration Files
339
-
340
- ```text
341
- ~/.anet/config.json
342
- Global CLI profile: hub URL, user token, default network.
343
-
344
- ~/.anet/server/admin-utok.json
345
- Local bootstrap admin token for the hub.
346
-
347
- {project}/.anet/nodes/<name>/config.json
348
- Per-node runtime, model, provider env, node token, channels, and session IDs.
349
- ```
350
-
351
- Example node config:
352
-
353
- ```json
354
- {
355
- "node_id": "n_a1b2c3d4",
356
- "node_name": "my-bot",
357
- "alias": "my-bot",
358
- "hub": "http://127.0.0.1:9200",
359
- "network_id": "default",
360
- "token": "ntok_...",
361
- "runtime": "claude-agent-sdk",
362
- "model": "your-model",
363
- "channels": ["server:commhub"],
364
- "tools": ["Read", "Write", "Edit", "Bash", "Glob", "Grep"],
365
- "env": {
366
- "ANTHROPIC_BASE_URL": "https://example.com/anthropic",
367
- "ANTHROPIC_AUTH_TOKEN": "sk-..."
368
- },
369
- "flags": {
370
- "dangerouslySkipPermissions": true,
371
- "teammateMode": "in-process",
372
- "maxTurns": 50
373
- }
374
- }
375
- ```
376
-
377
- Do not commit `.anet/` or provider API keys.
378
-
379
- ## Security Notes
380
-
381
- - The hub binds to `127.0.0.1` by default.
382
- - LAN mode is explicit: `anet hub start --host 0.0.0.0`.
383
- - Node tokens are network-scoped `ntok_` tokens; user tokens are `utok_`.
384
- - Keep API keys in local node config or env refs; never paste real keys into issues or docs.
385
- - Treat tmux / terminal streaming features as local-admin tools.
386
-
387
- ## What Is Stable vs Experimental
388
-
389
- Stable day-to-day path:
390
-
391
- - `anet hub start` / `anet hub stop` / `anet hub status` (v0.10.11+: SIGTERM → 3s grace → SIGKILL stop; status shows PID + port + `/health` version — no more manual `lsof+kill`)
392
- - `anet hub dashboard`
393
- - `anet login`
394
- - `anet node create/start/stop/delete/rename`
395
- - `anet node start --all`
396
- - `anet project up/restart/down`
397
- - Dashboard chat, task list, topology, and status views
398
-
399
- Actively evolving:
400
-
401
- - IM platform integration (Feishu / Slack / WhatsApp / WeCom)
402
- - Telegram channel binding
403
- - Advanced dashboard topology edges
404
- - Batch orchestration and science-team demos
405
- - Codex runtime expansion
406
- - Grok Build ACP runtime
407
- - Cross-version rename hot-reload
67
+ The default Hub is local-only. Before exposing it beyond localhost, change the initial password and follow the [production deployment guide](https://anet.sh/deploy/production). Do not copy `.anet` node configs between machines: they contain network-bound identity and token material.
408
68
 
409
69
  ## Documentation
410
70
 
411
- - Docs site: https://anet.sh
412
- - Getting started: https://anet.sh/guide/getting-started
413
- - Preview guide: https://anet.sh/guide/preview/getting-started
414
- - Issues: https://github.com/sleep2agi/agent-network/issues
415
-
416
- ## Repository Layout
417
-
418
- This package lives in the `agent-network/` subdirectory of the monorepo:
419
-
420
- ```text
421
- agent-network/
422
- bin/cli.ts anet CLI
423
- src/client.ts SDK client
424
- src/node-server.ts CommHub MCP server bridge used by claude-code-cli
425
- src/im/ IM integration contracts and future adapters
426
- ```
427
-
428
- Related packages live next to it:
429
-
430
- ```text
431
- server/ @sleep2agi/commhub-server
432
- agent-node/ @sleep2agi/agent-node
433
- docs-site/ anet.sh documentation site
434
- ```
435
-
436
- ## License
71
+ - [Getting started](https://anet.sh/guide/getting-started)
72
+ - [CLI reference](https://anet.sh/guide/cli)
73
+ - [Runtime guide](https://anet.sh/guide/runtimes)
74
+ - [Tokens and permissions](https://anet.sh/concepts/security)
75
+ - [Troubleshooting](https://anet.sh/troubleshooting)
76
+ - [GitHub repository](https://github.com/sleep2agi/agent-network)
437
77
 
438
- Apache-2.0
78
+ Apache-2.0.
@@ -0,0 +1,7 @@
1
+ {
2
+ "schema": 1,
3
+ "commit": "f8c8b132cdbba131fbd7b1666f5af110354c98dc",
4
+ "dirty": false,
5
+ "built_at": "2026-11-10T14:25:11.456Z",
6
+ "source": "git"
7
+ }
@@ -0,0 +1,101 @@
1
+ #!/usr/bin/env node
2
+ /* eslint-disable */
3
+ // anet 的 bin 入口垫片 —— 唯一职责:在【解析真正的 ESM 入口之前】把 Node 版本讲清楚。
4
+ //
5
+ // 🔴 为什么必须是 CJS,而且必须是手写不进构建:
6
+ //
7
+ // dist/bin/cli.js 是 ESM(package.json 里 type: module),而且经 javascript-obfuscator
8
+ // 处理过。老 Node 读到它的第一行 `import{createRequire}from'node:module'` 就抛
9
+ //
10
+ // SyntaxError: Unexpected token {
11
+ //
12
+ // ——**在任何一行代码执行之前**。cli.ts 里那个 checkNodeVersion()(required "22.13.0")
13
+ // 写在同一个文件里,所以它永远轮不到跑。**一个写在 ESM 里的版本检查,救不了一个
14
+ // 连 ESM 都解析不了的 Node。**
15
+ //
16
+ // 用户实际看到的是一屏混淆后的代码 + SyntaxError,完全指不到真因。
17
+ // (2026-08-18 现场:Node 10/12 世代的栈,`internal/bootstrap/node.js`、
18
+ // `Function.Module.runMain`、`loader.js:723`。)
19
+ //
20
+ // package.json 的 engines.node>=22.13.0 也不拦:npm 默认 engine-strict=false,
21
+ // 那只是安装时的一句警告。
22
+ //
23
+ // 🔴 本文件的写法约束(违反其中任何一条,垫片自己就会在同一个地方炸):
24
+ // - 只用 ES5 语法:var / function / 字符串拼接。不用 const/let、箭头函数、
25
+ // 模板串、可选链(?.)、空值合并(??)。
26
+ // - **不能出现字面量的 `import(...)`** —— 动态 import 是 Node 12.17+ 才能【解析】的
27
+ // 语法,老 Node 在解析阶段就会失败。所以用 new Function 把它推迟到调用时再解析,
28
+ // 而调用只发生在版本检查通过之后。
29
+ // - 不进 bun build,不进 obfuscator。构建里只 cp 过去。
30
+
31
+ // 🔴 两个阈值,回答两个不同的问题。把它们合成一个,就是我 2026-08-18 犯的错:
32
+ //
33
+ // PARSE_FLOOR = 16.0.0 「这个 Node 能不能**加载**入口?」
34
+ // 低于它,dist/bin/cli.js 的第一行 `import{createRequire}from'node:module'`
35
+ // 连解析都过不去(ESM 语句需要 Node>=12;`node:` 前缀需要 >=14.18/16)。
36
+ // 这时**必须硬退**,因为再往下没有任何一行自己的代码能跑。
37
+ //
38
+ // SUPPORTED = 22.13.0 「这个 Node 是不是受支持的版本?」
39
+ // 这是 package.json engines 声明的下限,而产品对它的既有立场是
40
+ // **警告并继续** —— cli.ts 的 checkNodeVersion() 只在 `anet upgrade` 里
41
+ // 打一行 "Continuing anyway"。
42
+ //
43
+ // 🔴 第一版我用 SUPPORTED 做硬退,直接把 e2e 打红了:CI 镜像跑的是 Node 20
44
+ // (tests/Dockerfile 里 setup_20.x),5 个 suite 当场全灭。
45
+ // **垫片不该比产品自己的立场更严** —— 它的职责是把「解析不了」这件事讲清楚,
46
+ // 不是顺手收紧支持策略。那是另一个决定,要单独做。
47
+ var PARSE_FLOOR = '16.0.0';
48
+ var SUPPORTED = '22.13.0';
49
+
50
+ function parts(v) {
51
+ var a = String(v).split('.');
52
+ return [parseInt(a[0], 10) || 0, parseInt(a[1], 10) || 0, parseInt(a[2], 10) || 0];
53
+ }
54
+
55
+ function gte(a, b) {
56
+ return a[0] > b[0]
57
+ || (a[0] === b[0] && a[1] > b[1])
58
+ || (a[0] === b[0] && a[1] === b[1] && a[2] >= b[2]);
59
+ }
60
+
61
+ var cur = parts(process.versions.node);
62
+
63
+ if (!gte(cur, parts(PARSE_FLOOR))) {
64
+ console.error('');
65
+ console.error(' \u274c anet 无法在 Node ' + process.versions.node + ' 上启动。');
66
+ console.error('');
67
+ console.error(' 它的入口是 ESM,而这个版本的 Node 连解析都做不到 —— 没有垫片的话,');
68
+ console.error(' 你看到的会是一屏代码加一句 SyntaxError,而真因是版本。');
69
+ console.error('');
70
+ console.error(' 升级 Node(任选其一):');
71
+ console.error(' nvm install 22 && nvm use 22');
72
+ console.error(' curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs');
73
+ console.error('');
74
+ console.error(' 然后: node -v && anet -v');
75
+ console.error('');
76
+ process.exit(1);
77
+ }
78
+
79
+ if (!gte(cur, parts(SUPPORTED))) {
80
+ // 警告不退出 —— 与 cli.ts 的既有立场一致。走 stderr,不污染任何解析 stdout 的调用方。
81
+ console.error('[anet] \u26a0 Node ' + process.versions.node + ' 低于受支持的 >=' + SUPPORTED
82
+ + ';能跑,但不保证。升级: nvm install ' + SUPPORTED.split('.')[0]);
83
+ }
84
+
85
+ var path = require('path');
86
+ var url = require('url');
87
+ var entry = path.join(__dirname, 'cli.js');
88
+
89
+ // 🔴 把 argv[1] 指回真入口。cli.ts 有多处用 process.argv[1] 推自身位置
90
+ // (:792 resolve(argv[1])、:1094-1095 join(argv[1],'..','..')、:4445)。
91
+ // 不改的话 argv[1] 会变成本垫片的路径 —— 同目录,多数推导仍成立,
92
+ // 但"多数成立"不是"成立",直接指回去让行为逐字不变。
93
+ process.argv[1] = entry;
94
+
95
+ // 见上:不能写字面量 import()。
96
+ var dynamicImport = new Function('u', 'return import(u);');
97
+ dynamicImport(url.pathToFileURL(entry).href).catch(function (e) {
98
+ console.error('[anet] 无法加载 ' + entry);
99
+ console.error(e && e.stack ? e.stack : e);
100
+ process.exit(1);
101
+ });
package/dist/bin/cli.d.ts CHANGED
@@ -11,4 +11,4 @@
11
11
  */
12
12
  import { normalizeRuntime, type RuntimeName } from "../src/normalize-runtime";
13
13
  export { normalizeRuntime, type RuntimeName };
14
- export declare const OPENCODE_PINNED_VERSION = "1.17.13";
14
+ export declare const OPENCODE_PINNED_VERSION = "1.18.34";