@sleep2agi/agent-network 2.2.7-preview.6 → 2.2.8-preview.0

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
@@ -1,65 +1,136 @@
1
- # @sleep2agi/agent-network
1
+ # Agent Network (`anet`)
2
2
 
3
- `anet` a single CLI to run a local AI Agent network. Launch the hub, the dashboard, and as many agent nodes as you want. Verified end-to-end on macOS / Linux / Docker via Playwright.
3
+ Run a local network of AI agents from one CLI.
4
4
 
5
- Pairs with `@sleep2agi/commhub-server` 0.8.0, `@sleep2agi/agent-network-dashboard` 0.4.2, `@sleep2agi/agent-node` 2.3.0 on the current stable flow. The local flow below is the supported path; experimental commands are called out separately.
5
+ `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`.
6
+
7
+ ## What It Is
8
+
9
+ Agent Network is a local-first multi-agent runtime:
10
+
11
+ - **CommHub**: MCP + REST + SSE hub for task routing, auth, networks, and status.
12
+ - **Agent nodes**: long-running AI workers backed by Claude Code, Claude Agent SDK, or Codex SDK.
13
+ - **Dashboard**: browser UI for topology, chat, tasks, node health, and server telemetry.
14
+ - **CLI**: `anet`, the single entry point for setup, auth, node lifecycle, and demos.
15
+
16
+ The default path runs entirely on your machine. LAN sharing is opt-in.
17
+
18
+ ## Requirements
19
+
20
+ - Node.js **>= 22.13.0**
21
+ - npm **>= 10**
22
+ - Bun **>= 1.2.0** (`anet hub start` lazy-runs the Bun-based CommHub server)
23
+ - macOS or Linux
24
+
25
+ Install Bun if needed:
26
+
27
+ ```bash
28
+ curl -fsSL https://bun.sh/install | bash
29
+ ```
6
30
 
7
31
  ## Install
8
32
 
33
+ Stable:
34
+
9
35
  ```bash
10
36
  npm install -g @sleep2agi/agent-network
11
37
  anet -v
12
38
  ```
13
39
 
14
- Node.js ≥ 20, npm ≥ 9. The hub and agent runtime are pulled on demand by `bunx` / `npx` — no other manual installs.
40
+ Preview channel:
41
+
42
+ ```bash
43
+ npm install -g @sleep2agi/agent-network@preview
44
+ anet -v
45
+ ```
46
+
47
+ Current npm dist-tags verified on 2026-05-25:
48
+
49
+ | Package | latest | preview |
50
+ |---|---:|---:|
51
+ | `@sleep2agi/agent-network` | `2.2.6` | `2.2.7-preview.6` |
52
+ | `@sleep2agi/commhub-server` | `0.8.2` | `0.8.3-preview.2` |
53
+ | `@sleep2agi/agent-network-dashboard` | `0.5.3` | `0.5.3-preview.267` |
54
+ | `@sleep2agi/agent-node` | `2.4.2` | `2.4.2` |
15
55
 
16
- ## Verified flow
56
+ ## 5-Minute Quick Start
17
57
 
18
58
  Open three terminals.
19
59
 
60
+ ### 1. Start CommHub
61
+
20
62
  ```bash
21
- # Terminal 1 — Hub
22
63
  anet hub start
23
- # • http://127.0.0.1:9200
24
- # • SQLite at ~/.commhub/commhub.db
25
- # • Default admin account auto-created: admin / anethub
26
- # • For LAN access, start with --host 0.0.0.0 and use the printed LAN URL
64
+ ```
65
+
66
+ Default local URL:
67
+
68
+ ```text
69
+ http://127.0.0.1:9200
70
+ ```
27
71
 
28
- # Terminal 2 Dashboard
72
+ By default the hub binds to localhost. Use `--host 0.0.0.0` only when you intentionally want LAN clients to connect.
73
+
74
+ ### 2. Start Dashboard
75
+
76
+ ```bash
29
77
  anet hub dashboard
30
- # • Open http://localhost:3000, log in with admin / anethub
78
+ ```
31
79
 
32
- # Terminal 3 — CLI: log in, create an agent, start it
80
+ Open:
81
+
82
+ ```text
83
+ http://localhost:3000
84
+ ```
85
+
86
+ ### 3. Log In, Create A Node, Start It
87
+
88
+ ```bash
33
89
  anet login --username admin --password anethub
34
90
  anet node create my-bot
35
- # Two-step picker:
36
- # 1) runtime → claude-agent-sdk (recommended)
37
- # 2) provider → MiniMax / DeepSeek / GLM / Kimi / Anthropic / OpenRouter / custom
38
- # Then enter the API key for that provider.
39
91
  anet node start my-bot
40
- # Look for: SSE connected
41
92
  ```
42
93
 
43
- Now go to the Dashboard, click `my-bot` in the Chat panel, type a message, hit Enter. The agent calls the LLM and replies with full markdown rendering.
94
+ `anet node create` walks you through:
95
+
96
+ 1. Runtime: `claude-code-cli`, `claude-agent-sdk`, or `codex-sdk`.
97
+ 2. Provider preset: Anthropic, MiniMax, DeepSeek, GLM, Kimi, OpenRouter, or custom Anthropic-compatible endpoint.
98
+ 3. API key and model settings.
44
99
 
45
- ### Multi-agent collaboration (verified)
100
+ When the node starts successfully, look for:
101
+
102
+ ```text
103
+ SSE connected
104
+ ```
105
+
106
+ Then use the Dashboard chat panel to send `my-bot` a message.
107
+
108
+ ## Multi-Agent Collaboration
109
+
110
+ Create a second node:
46
111
 
47
112
  ```bash
48
- anet node create video-bot --runtime claude-agent-sdk
49
- anet node start video-bot
113
+ anet node create reviewer
114
+ anet node start reviewer
50
115
  ```
51
116
 
52
- Ask `my-bot` something like *"ask video-bot what it can do"*. `my-bot` discovers `video-bot` via the commhub MCP `get_all_status` tool, dispatches the question with `send_task`, polls `get_task`, and integrates the reply. The Tasks and Messages pages show the full handshake.
117
+ Ask `my-bot`:
118
+
119
+ ```text
120
+ Ask reviewer to review this plan and summarize the risks.
121
+ ```
53
122
 
54
- ### LAN-shared hub
123
+ 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.
55
124
 
56
- By default `anet hub start` binds to `127.0.0.1`. To accept agents from other machines on the same network, start the hub with an explicit LAN bind:
125
+ ## LAN Hub
126
+
127
+ On the hub machine:
57
128
 
58
129
  ```bash
59
130
  anet hub start --host 0.0.0.0
60
131
  ```
61
132
 
62
- Then on another machine:
133
+ On another machine:
63
134
 
64
135
  ```bash
65
136
  npm install -g @sleep2agi/agent-network
@@ -69,89 +140,112 @@ anet node create remote-bot
69
140
  anet node start remote-bot
70
141
  ```
71
142
 
72
- ## Provider presets
143
+ Do not expose the hub directly to the public internet without a reverse proxy, HTTPS, firewall rules, and reviewed auth settings.
73
144
 
74
- `anet node create` second step picks a provider preset. Each preset writes the right `ANTHROPIC_BASE_URL` and a sensible default model into `.anet/nodes/<name>/config.json`, then prompts for the API key.
145
+ ## Runtimes
75
146
 
76
- | Provider | Status | Notes |
147
+ | Runtime | Use When | Notes |
77
148
  |---|---|---|
78
- | Anthropic | verified | `sk-ant-...`, model passed through from `--model` or provider default |
79
- | MiniMax (国内 / 国际) | verified | `sk-cp-...` |
80
- | DeepSeek | verified | `sk-...` |
81
- | GLM (智谱) | verified | open.bigmodel.cn key |
82
- | Kimi (Moonshot) | verified | platform.moonshot.cn key |
83
- | OpenRouter | unverified end-to-end | `sk-or-...` works in dev, no full E2E run |
84
- | Custom Anthropic-compatible | unverified end-to-end | provide base URL + token manually |
149
+ | `claude-code-cli` | You want Claude Code CLI sessions and channel support | Uses Claude Code process; supports stable `COMMHUB_RESUME_ID` in recent previews |
150
+ | `claude-agent-sdk` | You want Anthropic-compatible API providers | Good default for provider presets |
151
+ | `codex-sdk` | You want Codex-backed nodes | Useful as a backup runtime when Claude quota is constrained |
85
152
 
86
- `claude-agent-sdk` is just an Anthropic Messages API client — any compatible endpoint works without code changes; `--model` is passed through.
153
+ ## Provider Presets
87
154
 
88
- ## Command reference
155
+ `anet node create` writes the correct provider environment into `.anet/nodes/<name>/config.json`.
156
+
157
+ | Provider | Status | Notes |
158
+ |---|---|---|
159
+ | Anthropic | verified path | Native Anthropic Messages API |
160
+ | MiniMax | verified path | Anthropic-compatible endpoint |
161
+ | DeepSeek | verified path | Anthropic-compatible endpoint |
162
+ | GLM / Zhipu | verified path | Anthropic-compatible endpoint |
163
+ | Kimi / Moonshot | verified path | Anthropic-compatible endpoint |
164
+ | OpenRouter | available | Anthropic-compatible routing |
165
+ | Custom | available | Provide base URL, model, and token |
166
+
167
+ ## Common Commands
89
168
 
90
169
  ```bash
91
- # Hub + Dashboard
92
- anet hub start # local CommHub + auto admin/anethub [verified]
93
- anet hub dashboard # launch the Web Dashboard [verified]
170
+ # Hub and dashboard
171
+ anet hub start
172
+ anet hub dashboard
94
173
 
95
174
  # Auth
96
- anet register # create an account [verified]
97
- anet login [--username ...] # login, saves token to ~/.anet/config.json [verified]
98
- anet logout # [verified]
99
- anet whoami # [verified]
100
- anet passwd # change password [verified]
101
-
102
- # Tokens
103
- anet token create <name> # [verified]
104
- anet token ls # [verified]
105
- anet token revoke <id> # [verified]
175
+ anet register
176
+ anet login --username <user> --password <password>
177
+ anet logout
178
+ anet whoami
179
+ anet passwd
106
180
 
107
181
  # Nodes
108
- anet node create <name> # two-step interactive picker [verified]
109
- anet node start <name> # connect via SSE, await tasks [verified]
110
- anet node stop <name> # [verified]
111
- anet node delete <name> # [verified]
112
- anet node ls # [verified]
113
- anet logs <name> # tail the node's log file [verified]
114
-
115
- # Status
116
- anet status # network overview [verified]
117
- anet doctor # local sanity checks [verified]
118
-
119
- # Setup helpers
120
- anet init [--hub <url>] # write ~/.anet/config.json (LAN setup) [verified]
121
- anet init project # write .mcp.json + CLAUDE.md [verified]
182
+ anet node create <name>
183
+ anet node start <name>
184
+ anet node start --all
185
+ anet node stop <name>
186
+ anet node resume <name>
187
+ anet node rename <old> <new> --force
188
+ anet node delete <name>
189
+ anet node ls
190
+ anet info <name>
191
+ anet logs <name>
192
+
193
+ # Network status and repair
194
+ anet status
195
+ anet tasks [status]
196
+ anet doctor
197
+ anet doctor --fix
198
+
199
+ # Project and session helpers
200
+ anet init --hub <url>
201
+ anet init project
202
+ anet project up
203
+ anet project restart
204
+ anet project down
205
+ anet session ls
206
+
207
+ # Channels and upgrades
208
+ anet channel add telegram <name> --bot-token <tok> --allow <uid>
209
+ anet channel ls
210
+ anet upgrade
211
+ anet upgrade --channel preview --dry-run
212
+
213
+ # Batch / demos
214
+ anet create --batch
215
+ anet batch list
216
+ anet batch stop <prefix>
217
+ anet demo sci-team
122
218
  ```
123
219
 
124
- ## Not verified
125
-
126
- Listed for transparency — these commands exist but are not part of the primary supported path.
220
+ ## Configuration Files
127
221
 
128
- - `anet license` / `anet activate` — v0.6 legacy trial / pro-license commands. **No longer needed after Apache 2.0 OSS.** Hub still keeps a SQLite `licenses` table for backward-compat (creates a 14-day trial on first run). On `license_expired`, see [troubleshooting](https://anet.sh/en/troubleshooting).
129
- - `anet network create` / `anet network invite` / cross-user network sharing — code is in, no full E2E.
130
- - `anet channel add telegram|wechat|feishu` channel code exists; only the Telegram-oriented paths are actively exercised.
222
+ ```text
223
+ ~/.anet/config.json
224
+ Global CLI profile: hub URL, user token, default network.
131
225
 
132
- ## Configuration files
226
+ ~/.anet/server/admin-utok.json
227
+ Local bootstrap admin token for the hub.
133
228
 
229
+ {project}/.anet/nodes/<name>/config.json
230
+ Per-node runtime, model, provider env, node token, channels, and session IDs.
134
231
  ```
135
- ~/.anet/config.json # global: hub URL + user token
136
- {cwd}/.anet/nodes/<name>/config.json # per-node: runtime, model, provider, API key
137
- ```
138
-
139
- Field-level override: per-node config wins, missing fields fall back to global, then defaults.
140
232
 
141
- A typical `config.json` after `anet node create`:
233
+ Example node config:
142
234
 
143
235
  ```json
144
236
  {
145
237
  "node_id": "n_a1b2c3d4",
146
238
  "node_name": "my-bot",
239
+ "alias": "my-bot",
147
240
  "hub": "http://127.0.0.1:9200",
241
+ "network_id": "default",
148
242
  "token": "ntok_...",
149
243
  "runtime": "claude-agent-sdk",
150
- "model": "<minimax-model-id>",
244
+ "model": "your-model",
151
245
  "channels": ["server:commhub"],
152
246
  "tools": ["Read", "Write", "Edit", "Bash", "Glob", "Grep"],
153
247
  "env": {
154
- "ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
248
+ "ANTHROPIC_BASE_URL": "https://example.com/anthropic",
155
249
  "ANTHROPIC_AUTH_TOKEN": "sk-..."
156
250
  },
157
251
  "flags": {
@@ -162,19 +256,63 @@ A typical `config.json` after `anet node create`:
162
256
  }
163
257
  ```
164
258
 
165
- ## Companion packages
259
+ Do not commit `.anet/` or provider API keys.
166
260
 
167
- | Package | Version | What it does |
168
- |---|---|---|
169
- | [@sleep2agi/commhub-server](https://www.npmjs.com/package/@sleep2agi/commhub-server) | 0.8.0 | MCP + REST + SSE hub |
170
- | [@sleep2agi/agent-network-dashboard](https://www.npmjs.com/package/@sleep2agi/agent-network-dashboard) | 0.4.2 | Web Dashboard |
171
- | [@sleep2agi/agent-node](https://www.npmjs.com/package/@sleep2agi/agent-node) | 2.3.0 | Agent runtime |
261
+ ## Security Notes
262
+
263
+ - The hub binds to `127.0.0.1` by default.
264
+ - LAN mode is explicit: `anet hub start --host 0.0.0.0`.
265
+ - Node tokens are network-scoped `ntok_` tokens; user tokens are `utok_`.
266
+ - Keep API keys in local node config or env refs; never paste real keys into issues or docs.
267
+ - Treat tmux / terminal streaming features as local-admin tools.
268
+
269
+ ## What Is Stable vs Experimental
270
+
271
+ Stable day-to-day path:
272
+
273
+ - `anet hub start`
274
+ - `anet hub dashboard`
275
+ - `anet login`
276
+ - `anet node create/start/stop/delete/rename`
277
+ - `anet node start --all`
278
+ - `anet project up/restart/down`
279
+ - Dashboard chat, task list, topology, and status views
280
+
281
+ Actively evolving:
172
282
 
173
- ## Docs
283
+ - IM platform integration (Feishu / Slack / WhatsApp / WeCom)
284
+ - Telegram channel binding
285
+ - Advanced dashboard topology edges
286
+ - Batch orchestration and science-team demos
287
+ - Codex runtime expansion
288
+ - Cross-version rename hot-reload
174
289
 
175
- - https://anet.sh — full documentation site
176
- - https://anet.sh/en/guide/getting-started — verified local flow
177
- - https://github.com/sleep2agi/agent-network — source
290
+ ## Documentation
291
+
292
+ - Docs site: https://anet.sh
293
+ - Getting started: https://anet.sh/guide/getting-started
294
+ - Preview guide: https://anet.sh/guide/preview/getting-started
295
+ - Issues: https://github.com/sleep2agi/agent-network/issues
296
+
297
+ ## Repository Layout
298
+
299
+ This package lives in the `agent-network/` subdirectory of the monorepo:
300
+
301
+ ```text
302
+ agent-network/
303
+ bin/cli.ts anet CLI
304
+ src/client.ts SDK client
305
+ src/node-server.ts CommHub MCP server bridge used by claude-code-cli
306
+ src/im/ IM integration contracts and future adapters
307
+ ```
308
+
309
+ Related packages live next to it:
310
+
311
+ ```text
312
+ server/ @sleep2agi/commhub-server
313
+ agent-node/ @sleep2agi/agent-node
314
+ docs-site/ anet.sh documentation site
315
+ ```
178
316
 
179
317
  ## License
180
318