@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 +228 -90
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/im/types.d.ts +194 -0
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,65 +1,136 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Agent Network (`anet`)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Run a local network of AI agents from one CLI.
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Default local URL:
|
|
67
|
+
|
|
68
|
+
```text
|
|
69
|
+
http://127.0.0.1:9200
|
|
70
|
+
```
|
|
27
71
|
|
|
28
|
-
|
|
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
|
-
|
|
78
|
+
```
|
|
31
79
|
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
49
|
-
anet node start
|
|
113
|
+
anet node create reviewer
|
|
114
|
+
anet node start reviewer
|
|
50
115
|
```
|
|
51
116
|
|
|
52
|
-
Ask `my-bot
|
|
117
|
+
Ask `my-bot`:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
Ask reviewer to review this plan and summarize the risks.
|
|
121
|
+
```
|
|
53
122
|
|
|
54
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
145
|
+
## Runtimes
|
|
75
146
|
|
|
76
|
-
|
|
|
147
|
+
| Runtime | Use When | Notes |
|
|
77
148
|
|---|---|---|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
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
|
-
|
|
153
|
+
## Provider Presets
|
|
87
154
|
|
|
88
|
-
|
|
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
|
|
92
|
-
anet hub start
|
|
93
|
-
anet hub dashboard
|
|
170
|
+
# Hub and dashboard
|
|
171
|
+
anet hub start
|
|
172
|
+
anet hub dashboard
|
|
94
173
|
|
|
95
174
|
# Auth
|
|
96
|
-
anet register
|
|
97
|
-
anet login
|
|
98
|
-
anet logout
|
|
99
|
-
anet whoami
|
|
100
|
-
anet passwd
|
|
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>
|
|
109
|
-
anet node start <name>
|
|
110
|
-
anet node
|
|
111
|
-
anet node
|
|
112
|
-
anet node
|
|
113
|
-
anet
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
anet
|
|
117
|
-
anet
|
|
118
|
-
|
|
119
|
-
#
|
|
120
|
-
anet
|
|
121
|
-
anet
|
|
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
|
-
##
|
|
125
|
-
|
|
126
|
-
Listed for transparency — these commands exist but are not part of the primary supported path.
|
|
220
|
+
## Configuration Files
|
|
127
221
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
222
|
+
```text
|
|
223
|
+
~/.anet/config.json
|
|
224
|
+
Global CLI profile: hub URL, user token, default network.
|
|
131
225
|
|
|
132
|
-
|
|
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
|
-
|
|
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": "
|
|
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://
|
|
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
|
-
|
|
259
|
+
Do not commit `.anet/` or provider API keys.
|
|
166
260
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
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
|
-
|
|
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
|
-
|
|
176
|
-
|
|
177
|
-
- https://
|
|
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
|
|