@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 CHANGED
@@ -1,255 +1,169 @@
1
- # @sleep2agi/agent-network (anet)
1
+ # @sleep2agi/agent-network
2
2
 
3
- AI Agent 通信网络 一行命令创建 Agent,多 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
- ## 5 分钟快速上手
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
- ### Step 1: 部署 CommHub Server(服务器端)
16
+ ## Verified flow
31
17
 
32
- 在你的服务器上(需要 Bun):
18
+ Open three terminals.
33
19
 
34
20
  ```bash
35
- # 安装 Bun (如果没有)
36
- curl -fsSL https://bun.sh/install | bash
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
- # 启动 CommHub Server (默认 SQLite, 零配置)
39
- bunx @sleep2agi/commhub-server
40
- # 默认端口 9200, 访问 http://YOUR_IP:9200/health 验证
28
+ # Terminal 2 Dashboard
29
+ anet hub dashboard
30
+ # Open http://localhost:3000, log in with admin / anethub
41
31
 
42
- # 或使用 PostgreSQL
43
- DATABASE_URL=postgres://user:pass@host:5432/commhub bunx @sleep2agi/commhub-server
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
- Server 启动后会显示:
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
- ### Step 2: 安装 + 一键设置(开发机)
45
+ ### Multi-agent collaboration (verified)
52
46
 
53
47
  ```bash
54
- npm install -g @sleep2agi/agent-network @sleep2agi/agent-node
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
- ### Step 3: 创建并启动 Agent
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
- ```bash
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
- anet start my-agent
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
- ### Step 4: 发送任务
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
- ```bash
86
- # 查看网络状态
87
- anet status
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
- 通过 MCP 工具发送任务(Claude Code / Codex 会自动发现):
94
- ```
95
- commhub_send_task(alias="my-agent", task="帮我写个 hello world")
96
- ```
82
+ ## Command reference
97
83
 
98
- ## Runtime 选择
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
- | Runtime | 底层 | 需要 | 适用场景 |
101
- |---------|------|------|---------|
102
- | `codex-sdk` | GPT-5.4 via Codex | `codex auth login` | 代码任务 |
103
- | `claude-agent-sdk` | Claude Code | Claude Pro + `claude auth login` | 通用任务 |
104
- | `http-api` | 任何 OpenAI/Anthropic 兼容 API | API Key | MiniMax, DeepSeek 等 |
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
- ```bash
107
- # Codex (GPT-5.4)
108
- anet create dev --runtime codex-sdk
97
+ # Tokens
98
+ anet token create <name> # [verified]
99
+ anet token ls # [verified]
100
+ anet token revoke <id> # [verified]
109
101
 
110
- # MiniMax (通过 Anthropic 兼容 API)
111
- ANTHROPIC_BASE_URL=https://api.minimaxi.com/anthropic \
112
- ANTHROPIC_API_KEY=sk-cp-xxx \
113
- agent-node --alias dev --runtime http-api --model claude-3-5-haiku-20241022
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
- ## CLI 命令 (39 个)
110
+ # Status
111
+ anet status # network overview [verified]
112
+ anet doctor # local sanity checks [verified]
117
113
 
118
- ```bash
119
- # 账号
120
- anet quickstart # 一键引导设置
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
- 配置优先级: CLI 参数 > 环境变量 > 项目配置 > 全局配置 > 默认值
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
- ## Telegram Channel 接入
128
+ ## Configuration files
185
129
 
186
- 让 Agent 自动接收 Telegram 消息并回复:
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
- ```bash
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
- # 2. 添加 Telegram channel
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
- # 3. 启动
198
- anet start my-bot
199
- # agent 会自动连 Telegram bot,收到消息后 AI 处理并回复
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
- ## REST API (27 endpoints)
210
-
211
- | 端点 | 说明 |
212
- |------|------|
213
- | `POST /api/auth/register` | 注册 |
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
- ```bash
250
- # 安装 preview 版
251
- npm i -g @sleep2agi/agent-network@preview @sleep2agi/agent-node@preview
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