@sleep2agi/agent-network 2.0.0 → 2.0.1-preview.1
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 +120 -206
- package/dist/bin/cli.js +1 -1
- package/dist/src/client.js +1 -1
- package/dist/src/node-server.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,255 +1,169 @@
|
|
|
1
|
-
# @sleep2agi/agent-network
|
|
1
|
+
# @sleep2agi/agent-network
|
|
2
2
|
|
|
3
|
-
AI Agent
|
|
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.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**v2.0.0 stable.** Pairs with `@sleep2agi/commhub-server` 0.5.0, `@sleep2agi/agent-network-dashboard` 0.1.0, `@sleep2agi/agent-node` 2.1.1. Everything below in the **Verified flow** section has E2E coverage; everything in the **Not verified** section is best-effort.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
|
|
9
|
-
│ Agent Node │ │ Agent Node │ │ Agent Node │
|
|
10
|
-
│ (codex) │ │ (minimax) │ │ (claude) │
|
|
11
|
-
└──────┬──────┘ └──────┬──────┘ └──────┬──────┘
|
|
12
|
-
│ SSE │ SSE │ MCP
|
|
13
|
-
└──────────┬───────┴──────────────────┘
|
|
14
|
-
┌─────┴─────┐
|
|
15
|
-
│ CommHub │ ← MCP Server + REST API
|
|
16
|
-
│ Server │ 任务调度 + 消息路由
|
|
17
|
-
└───────────┘
|
|
18
|
-
```
|
|
7
|
+
## Install
|
|
19
8
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
| `@sleep2agi/commhub-server` | 通信中枢 (Server) | 服务器,只需 1 台 |
|
|
25
|
-
| `@sleep2agi/agent-network` | CLI 管理工具 (anet) | 每台开发机 |
|
|
26
|
-
| `@sleep2agi/agent-node` | Agent 运行时 | 每台开发机 |
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @sleep2agi/agent-network
|
|
11
|
+
anet -v
|
|
12
|
+
```
|
|
27
13
|
|
|
28
|
-
|
|
14
|
+
Node.js ≥ 20, npm ≥ 9. The hub and agent runtime are pulled on demand by `bunx` / `npx` — no other manual installs.
|
|
29
15
|
|
|
30
|
-
|
|
16
|
+
## Verified flow
|
|
31
17
|
|
|
32
|
-
|
|
18
|
+
Open three terminals.
|
|
33
19
|
|
|
34
20
|
```bash
|
|
35
|
-
#
|
|
36
|
-
|
|
21
|
+
# Terminal 1 — Hub
|
|
22
|
+
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
|
+
# • Prints a LAN URL so other machines can join
|
|
37
27
|
|
|
38
|
-
#
|
|
39
|
-
|
|
40
|
-
#
|
|
28
|
+
# Terminal 2 — Dashboard
|
|
29
|
+
anet hub dashboard
|
|
30
|
+
# • Open http://localhost:3000, log in with admin / anethub
|
|
41
31
|
|
|
42
|
-
#
|
|
43
|
-
|
|
32
|
+
# Terminal 3 — CLI: log in, create an agent, start it
|
|
33
|
+
anet login --username admin --password anethub
|
|
34
|
+
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
|
+
anet node start my-bot
|
|
40
|
+
# Look for: SSE connected
|
|
44
41
|
```
|
|
45
42
|
|
|
46
|
-
|
|
47
|
-
- MCP 端点: `http://0.0.0.0:9200/mcp`
|
|
48
|
-
- REST API: `http://0.0.0.0:9200/api`
|
|
49
|
-
- 健康检查: `http://0.0.0.0:9200/health`
|
|
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.
|
|
50
44
|
|
|
51
|
-
###
|
|
45
|
+
### Multi-agent collaboration (verified)
|
|
52
46
|
|
|
53
47
|
```bash
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
# 一键引导(推荐)
|
|
57
|
-
anet quickstart
|
|
58
|
-
|
|
59
|
-
# 或手动配置
|
|
60
|
-
anet init --hub http://YOUR_SERVER_IP:9200
|
|
61
|
-
anet register # 创建账号
|
|
62
|
-
anet login # 登录
|
|
63
|
-
|
|
64
|
-
# 检查一切正常
|
|
65
|
-
anet doctor
|
|
48
|
+
anet node create video-bot --runtime claude-agent-sdk
|
|
49
|
+
anet node start video-bot
|
|
66
50
|
```
|
|
67
51
|
|
|
68
|
-
|
|
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.
|
|
69
53
|
|
|
70
|
-
|
|
71
|
-
# 交互式创建(会问你选哪个 Runtime / Model)
|
|
72
|
-
anet create my-agent
|
|
54
|
+
### LAN-shared hub (verified)
|
|
73
55
|
|
|
74
|
-
|
|
75
|
-
anet create my-agent --runtime codex-sdk --model gpt-5.4
|
|
56
|
+
`anet hub start` listens on `0.0.0.0`. From another machine on the same network:
|
|
76
57
|
|
|
77
|
-
|
|
78
|
-
|
|
58
|
+
```bash
|
|
59
|
+
npm install -g @sleep2agi/agent-network
|
|
60
|
+
anet init --hub http://<HUB-LAN-IP>:9200
|
|
61
|
+
anet login --username admin --password anethub
|
|
62
|
+
anet node create remote-bot
|
|
63
|
+
anet node start remote-bot
|
|
79
64
|
```
|
|
80
65
|
|
|
81
|
-
|
|
66
|
+
## Provider presets
|
|
82
67
|
|
|
83
|
-
|
|
68
|
+
`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.
|
|
84
69
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
70
|
+
| Provider | Status | Notes |
|
|
71
|
+
|---|---|---|
|
|
72
|
+
| Anthropic | verified | `sk-ant-...`, default `claude-sonnet-4-5` |
|
|
73
|
+
| MiniMax (国内 / 国际) | verified | `sk-cp-...` |
|
|
74
|
+
| DeepSeek | verified | `sk-...` |
|
|
75
|
+
| GLM (智谱) | verified | open.bigmodel.cn key |
|
|
76
|
+
| Kimi (Moonshot) | verified | platform.moonshot.cn key |
|
|
77
|
+
| OpenRouter | unverified end-to-end | `sk-or-...` works in dev, no full E2E run |
|
|
78
|
+
| Custom Anthropic-compatible | unverified end-to-end | provide base URL + token manually |
|
|
88
79
|
|
|
89
|
-
|
|
90
|
-
anet tasks
|
|
91
|
-
```
|
|
80
|
+
`claude-agent-sdk` is just an Anthropic Messages API client — any compatible endpoint works without code changes; `--model` is passed through.
|
|
92
81
|
|
|
93
|
-
|
|
94
|
-
```
|
|
95
|
-
commhub_send_task(alias="my-agent", task="帮我写个 hello world")
|
|
96
|
-
```
|
|
82
|
+
## Command reference
|
|
97
83
|
|
|
98
|
-
|
|
84
|
+
```bash
|
|
85
|
+
# Hub + Dashboard
|
|
86
|
+
anet hub start # local CommHub + auto admin/anethub [verified]
|
|
87
|
+
anet hub stop # stop the local hub [verified]
|
|
88
|
+
anet hub dashboard # launch the Web Dashboard [verified]
|
|
99
89
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
90
|
+
# Auth
|
|
91
|
+
anet register # create an account [verified]
|
|
92
|
+
anet login [--username ...] # login, saves token to ~/.anet/config.json [verified]
|
|
93
|
+
anet logout # [verified]
|
|
94
|
+
anet whoami # [verified]
|
|
95
|
+
anet passwd # change password [verified]
|
|
105
96
|
|
|
106
|
-
|
|
107
|
-
#
|
|
108
|
-
anet
|
|
97
|
+
# Tokens
|
|
98
|
+
anet token create <name> # [verified]
|
|
99
|
+
anet token ls # [verified]
|
|
100
|
+
anet token revoke <id> # [verified]
|
|
109
101
|
|
|
110
|
-
#
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
102
|
+
# Nodes
|
|
103
|
+
anet node create <name> # two-step interactive picker [verified]
|
|
104
|
+
anet node start <name> # connect via SSE, await tasks [verified]
|
|
105
|
+
anet node stop <name> # [verified]
|
|
106
|
+
anet node delete <name> # [verified]
|
|
107
|
+
anet node ls # [verified]
|
|
108
|
+
anet logs <name> # tail the node's log file [verified]
|
|
115
109
|
|
|
116
|
-
|
|
110
|
+
# Status
|
|
111
|
+
anet status # network overview [verified]
|
|
112
|
+
anet doctor # local sanity checks [verified]
|
|
117
113
|
|
|
118
|
-
|
|
119
|
-
#
|
|
120
|
-
anet
|
|
121
|
-
anet register # 创建账号
|
|
122
|
-
anet login # 登录
|
|
123
|
-
anet logout # 退出
|
|
124
|
-
anet whoami # 当前用户信息
|
|
125
|
-
anet passwd # 修改密码
|
|
126
|
-
|
|
127
|
-
# Token
|
|
128
|
-
anet token create <name> # 创建 API Token
|
|
129
|
-
anet token ls # Token 列表
|
|
130
|
-
anet token revoke <id> # 撤销 Token
|
|
131
|
-
|
|
132
|
-
# 网络
|
|
133
|
-
anet network create <name> # 创建网络
|
|
134
|
-
anet network ls # 我的网络列表
|
|
135
|
-
anet network use <name> # 切换网络
|
|
136
|
-
anet network info # 当前网络详情
|
|
137
|
-
anet network rename <new> # 重命名网络
|
|
138
|
-
anet network delete --force # 删除网络
|
|
139
|
-
|
|
140
|
-
# 节点
|
|
141
|
-
anet create <name> # 创建 node(交互式)
|
|
142
|
-
anet start <name> # 启动
|
|
143
|
-
anet stop <name> # 停止
|
|
144
|
-
anet delete <name> --force # 删除
|
|
145
|
-
anet rename <ref> <new> # 重命名
|
|
146
|
-
anet ls # 节点列表 + 网络状态
|
|
147
|
-
anet status # 网络总览
|
|
148
|
-
anet info <name> # 节点详情
|
|
149
|
-
anet tasks [status] # 任务列表
|
|
150
|
-
anet logs <name> # 查看日志
|
|
151
|
-
anet doctor # 系统诊断
|
|
152
|
-
anet demo # 实时仪表盘
|
|
153
|
-
anet config # 查看配置
|
|
154
|
-
|
|
155
|
-
# Channel
|
|
156
|
-
anet channel add telegram <name> --bot-token <tok> --allow <uid>
|
|
157
|
-
|
|
158
|
-
# 授权
|
|
159
|
-
anet license # 查看 License 状态
|
|
160
|
-
anet activate <key> # 激活授权码
|
|
161
|
-
|
|
162
|
-
# 设置
|
|
163
|
-
anet init # 配置 hub URL
|
|
164
|
-
anet setup # 安装依赖
|
|
165
|
-
anet server local # 本地零配置启动
|
|
166
|
-
anet server start # 启动 CommHub
|
|
167
|
-
anet upgrade # 检查更新
|
|
168
|
-
anet -v # 版本信息
|
|
114
|
+
# Setup helpers
|
|
115
|
+
anet init [--hub <url>] # write ~/.anet/config.json (LAN setup) [verified]
|
|
116
|
+
anet init project # write .mcp.json + CLAUDE.md [verified]
|
|
169
117
|
```
|
|
170
118
|
|
|
171
|
-
##
|
|
119
|
+
## Not verified
|
|
172
120
|
|
|
173
|
-
|
|
174
|
-
~/.anet/config.json # 全局: hub URL + token
|
|
175
|
-
{project}/.anet/nodes/<name>/
|
|
176
|
-
├── config.json # 节点: runtime, model, node_id
|
|
177
|
-
└── channels/telegram/
|
|
178
|
-
├── .env # bot token (chmod 600)
|
|
179
|
-
└── access.json # 白名单
|
|
180
|
-
```
|
|
121
|
+
Listed for transparency — these commands exist but are not part of the supported v2.0.0 path.
|
|
181
122
|
|
|
182
|
-
|
|
123
|
+
- `anet quickstart` — removed from the docs; use `anet hub start` + `anet node create` instead.
|
|
124
|
+
- `anet license` / `anet activate` — placeholders for a future paid tier.
|
|
125
|
+
- `anet network create` / `anet network invite` / cross-user network sharing — code is in, no full E2E.
|
|
126
|
+
- `anet channel add telegram|wechat|feishu` — channels exist but are not E2E regressed in v2.0.0.
|
|
183
127
|
|
|
184
|
-
##
|
|
128
|
+
## Configuration files
|
|
185
129
|
|
|
186
|
-
|
|
130
|
+
```
|
|
131
|
+
~/.anet/config.json # global: hub URL + user token
|
|
132
|
+
{cwd}/.anet/nodes/<name>/config.json # per-node: runtime, model, provider, API key
|
|
133
|
+
```
|
|
187
134
|
|
|
188
|
-
|
|
189
|
-
# 1. 先创建 agent 节点
|
|
190
|
-
anet create my-bot --runtime http-api
|
|
135
|
+
Field-level override: per-node config wins, missing fields fall back to global, then defaults.
|
|
191
136
|
|
|
192
|
-
|
|
193
|
-
anet channel add telegram my-bot --bot-token 123456:ABC-xxx --allow 7612221352
|
|
194
|
-
# --bot-token: 从 @BotFather 获取
|
|
195
|
-
# --allow: 允许的 Telegram 用户 ID(白名单)
|
|
137
|
+
A typical `config.json` after `anet node create`:
|
|
196
138
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
139
|
+
```json
|
|
140
|
+
{
|
|
141
|
+
"alias": "my-bot",
|
|
142
|
+
"hub": "http://127.0.0.1:9200",
|
|
143
|
+
"runtime": "claude-agent-sdk",
|
|
144
|
+
"model": "MiniMax-M2.7",
|
|
145
|
+
"anthropic_base_url": "https://api.minimax.io/anthropic",
|
|
146
|
+
"anthropic_auth_token": "sk-...",
|
|
147
|
+
"tools": "all",
|
|
148
|
+
"maxTurns": 50,
|
|
149
|
+
"dangerouslySkipPermissions": true,
|
|
150
|
+
"teammateMode": true
|
|
151
|
+
}
|
|
200
152
|
```
|
|
201
153
|
|
|
202
|
-
|
|
203
|
-
```
|
|
204
|
-
.anet/nodes/my-bot/channels/telegram/
|
|
205
|
-
├── .env # BOT_TOKEN(chmod 600,安全存储)
|
|
206
|
-
└── access.json # {"allow": ["7612221352"]}
|
|
207
|
-
```
|
|
154
|
+
## Companion packages
|
|
208
155
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
|
212
|
-
|
|
213
|
-
|
|
|
214
|
-
| `POST /api/auth/login` | 登录 |
|
|
215
|
-
| `GET /api/auth/me` | 当前用户 |
|
|
216
|
-
| `PUT /api/auth/me` | 修改资料 |
|
|
217
|
-
| `POST /api/auth/password` | 修改密码 |
|
|
218
|
-
| `GET /api/auth/tokens` | Token 列表 |
|
|
219
|
-
| `POST /api/auth/tokens` | 创建 Token |
|
|
220
|
-
| `DELETE /api/auth/tokens/:id` | 撤销 Token |
|
|
221
|
-
| `GET /api/networks` | 网络列表 |
|
|
222
|
-
| `POST /api/networks` | 创建网络 |
|
|
223
|
-
| `GET /api/networks/:id` | 网络详情 |
|
|
224
|
-
| `PUT /api/networks/:id` | 重命名网络 |
|
|
225
|
-
| `DELETE /api/networks/:id` | 删除网络 |
|
|
226
|
-
| `GET /api/tasks` | 任务列表 (支持 network_id 过滤) |
|
|
227
|
-
| `GET /api/stats` | 统计汇总 |
|
|
228
|
-
| `GET /api/audit-log` | 审计日志 |
|
|
229
|
-
| `GET /api/license` | License 状态 |
|
|
230
|
-
|
|
231
|
-
所有数据端点支持 `?network_id=` 过滤。认证: `Authorization: Bearer <token>`。
|
|
232
|
-
|
|
233
|
-
## 文档
|
|
234
|
-
|
|
235
|
-
- [Getting Started Guide](docs/getting-started.md) — 新手教程
|
|
236
|
-
- [CHANGELOG](CHANGELOG.md) — 版本变更
|
|
237
|
-
- [V3 设计](docs/v3-multi-network-design.md) — 架构设计
|
|
238
|
-
- [测试矩阵](tests/README.md) — 25 套 550+ Docker 测试
|
|
239
|
-
- [Examples](examples/README.md) — Demo 场景
|
|
240
|
-
|
|
241
|
-
## npm 包
|
|
242
|
-
|
|
243
|
-
| 包 | 最新 Preview | 说明 |
|
|
244
|
-
|---|-------------|------|
|
|
245
|
-
| [@sleep2agi/agent-network](https://www.npmjs.com/package/@sleep2agi/agent-network) | 2.0.0-preview.28 | anet CLI + SDK |
|
|
246
|
-
| [@sleep2agi/agent-node](https://www.npmjs.com/package/@sleep2agi/agent-node) | 2.1.0-preview.8 | Agent 运行时 |
|
|
247
|
-
| [@sleep2agi/commhub-server](https://www.npmjs.com/package/@sleep2agi/commhub-server) | 0.5.0-preview.28 | CommHub Server |
|
|
156
|
+
| Package | Version | What it does |
|
|
157
|
+
|---|---|---|
|
|
158
|
+
| [@sleep2agi/commhub-server](https://www.npmjs.com/package/@sleep2agi/commhub-server) | 0.5.0 | MCP + REST + SSE hub |
|
|
159
|
+
| [@sleep2agi/agent-network-dashboard](https://www.npmjs.com/package/@sleep2agi/agent-network-dashboard) | 0.1.0 | Web Dashboard |
|
|
160
|
+
| [@sleep2agi/agent-node](https://www.npmjs.com/package/@sleep2agi/agent-node) | 2.1.1 | Agent runtime |
|
|
248
161
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
162
|
+
## Docs
|
|
163
|
+
|
|
164
|
+
- https://anet.vansin.me — full documentation site
|
|
165
|
+
- https://anet.vansin.me/guide/getting-started — verified local flow
|
|
166
|
+
- https://github.com/sleep2agi/agent-network — source
|
|
253
167
|
|
|
254
168
|
## License
|
|
255
169
|
|