@sleep2agi/agent-network 2.0.1-preview.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,182 +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
- **v2.0.0 stable** 推荐普通用户直接 `npm install -g @sleep2agi/agent-network` 上手。
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
- ## 架构
7
+ ## Install
8
8
 
9
+ ```bash
10
+ npm install -g @sleep2agi/agent-network
11
+ anet -v
9
12
  ```
10
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
11
- │ Agent Node │ │ Agent Node │ │ Agent Node │
12
- │ (codex) │ │ (minimax) │ │ (claude) │
13
- └──────┬──────┘ └──────┬──────┘ └──────┬──────┘
14
- │ SSE │ SSE │ MCP
15
- └──────────┬───────┴──────────────────┘
16
- ┌─────┴─────┐
17
- │ CommHub │ ← MCP Server + REST API
18
- │ Server │ 任务调度 + 消息路由
19
- └───────────┘
20
- ```
21
-
22
- **三个包,三个角色:**
23
13
 
24
- | | 版本 | 角色 |
25
- |---|------|------|
26
- | `@sleep2agi/commhub-server` | 0.5.0 | 通信中枢 (Server) |
27
- | `@sleep2agi/agent-network-dashboard` | 0.1.0 | Web Dashboard |
28
- | `@sleep2agi/agent-network` | 2.0.0 | CLI 管理工具 (anet) |
29
- | `@sleep2agi/agent-node` | 2.1.1 | Agent 运行时 |
14
+ Node.js 20, npm 9. The hub and agent runtime are pulled on demand by `bunx` / `npx` — no other manual installs.
30
15
 
31
- ## 5 分钟快速上手
16
+ ## Verified flow
32
17
 
33
- 完整流程(local-only,零云依赖):
18
+ Open three terminals.
34
19
 
35
20
  ```bash
36
- # 1) 安装 CLI(自带 hub + dashboard 启动器)
37
- npm install -g @sleep2agi/agent-network
38
-
39
- # 2) 启动本地 CommHub(默认端口 9200,SQLite 在 ~/.commhub/commhub.db)
21
+ # Terminal 1 Hub
40
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
41
27
 
42
- # 3) 另开终端,启动 Dashboard(自动连本地 hub)
28
+ # Terminal 2 Dashboard
43
29
  anet hub dashboard
44
- # 浏览器打开 http://localhost:3000
45
-
46
- # 4) 登录(默认账号 admin / anethub,首次 hub start 自动创建)
47
- anet login
30
+ # Open http://localhost:3000, log in with admin / anethub
48
31
 
49
- # 5) 创建一个 Agent 节点(交互式选 Runtime + 模型)
50
- anet node create alice
51
-
52
- # 6) 启动它
53
- anet node start alice
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
54
41
  ```
55
42
 
56
- `anet node create` 会让你两步选择:先选 Runtime(claude-agent-sdk / codex-sdk / claude-code-cli),再选 Provider(Anthropic / DeepSeek / GLM / Kimi / MiniMax / OpenRouter / 自定义)。
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.
57
44
 
58
- ### Agent 协作示例
45
+ ### Multi-agent collaboration (verified)
59
46
 
60
47
  ```bash
61
- # 终端 A
62
- anet node create alice
63
- anet node start alice
64
-
65
- # 终端 B
66
- anet node create bob
67
- anet node start bob
48
+ anet node create video-bot --runtime claude-agent-sdk
49
+ anet node start video-bot
68
50
  ```
69
51
 
70
- Agent 会自动通过 commhub MCP 工具发现彼此(`get_all_status`),并用 `send_task` 互相派活。Dashboard `Tasks` / `Messages` 页面实时看到所有交互。
71
-
72
- ## Runtime 选择
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.
73
53
 
74
- | Runtime | 底层 | 需要 | 适用场景 |
75
- |---------|------|------|---------|
76
- | `claude-agent-sdk` | Anthropic Messages API | API Key(Anthropic / DeepSeek / GLM / Kimi / MiniMax / OpenRouter / 自定义) | 通用任务,最广兼容 |
77
- | `codex-sdk` | OpenAI GPT-5 / o3 | `codex auth login` | 代码任务,强推理 |
78
- | `claude-code-cli` | 本地 Claude Code | Claude Pro 订阅 | 复用 Pro 订阅 |
54
+ ### LAN-shared hub (verified)
79
55
 
80
- ## CLI 命令
56
+ `anet hub start` listens on `0.0.0.0`. From another machine on the same network:
81
57
 
82
58
  ```bash
83
- # Hub
84
- anet hub start # 本地启动 CommHub Server
85
- anet hub stop # 停止
86
- anet hub dashboard # 启动 Dashboard Web UI
87
-
88
- # 账号
89
- anet register # 创建账号
90
- anet login # 登录
91
- anet logout # 退出
92
- anet whoami # 当前用户
93
-
94
- # Token
95
- anet token create <name> # 创建 API Token
96
- anet token ls # Token 列表
97
- anet token revoke <id> # 撤销
98
-
99
- # 节点
100
- anet node create <name> # 创建 node(两步交互式选 Runtime + Provider)
101
- anet node start <name> # 启动
102
- anet node stop <name> # 停止
103
- anet node delete <name> # 删除
104
- anet node ls # 节点列表
105
-
106
- # 状态
107
- anet status # 网络总览
108
- anet ls # 节点 + 网络状态
109
- anet tasks [status] # 任务列表
110
- anet logs <name> # 查看日志
111
- anet doctor # 系统诊断
112
-
113
- # Channel
114
- anet channel add telegram <name> --bot-token <tok> --allow <uid>
115
-
116
- # 设置
117
- anet init # 配置 hub URL
118
- anet -v # 版本信息
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
119
64
  ```
120
65
 
121
- > `anet quickstart` 命令存在但流程仍在打磨(experimental)— 请使用上面的显式步骤。
122
- > `anet license` / `anet activate` 是 placeholder(云授权暂未启用),local-only 用法不需要。
66
+ ## Provider presets
123
67
 
124
- ## 配置文件
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.
125
69
 
126
- ```
127
- ~/.anet/config.json # 全局: hub URL + token
128
- {project}/.anet/nodes/<name>/
129
- ├── config.json # 节点: runtime, model, node_id
130
- └── channels/telegram/
131
- ├── .env # bot token (chmod 600)
132
- └── access.json # 白名单
133
- ```
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 |
134
79
 
135
- 配置优先级: CLI 参数 > 环境变量 > 项目配置 > 全局配置 > 默认值
80
+ `claude-agent-sdk` is just an Anthropic Messages API client any compatible endpoint works without code changes; `--model` is passed through.
136
81
 
137
- ## Telegram Channel 接入
138
-
139
- 让 Agent 自动接收 Telegram 消息并回复:
82
+ ## Command reference
140
83
 
141
84
  ```bash
142
- anet node create my-bot
143
- anet channel add telegram my-bot --bot-token 123456:ABC-xxx --allow 7612221352
144
- anet node start my-bot
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]
89
+
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]
96
+
97
+ # Tokens
98
+ anet token create <name> # [verified]
99
+ anet token ls # [verified]
100
+ anet token revoke <id> # [verified]
101
+
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]
109
+
110
+ # Status
111
+ anet status # network overview [verified]
112
+ anet doctor # local sanity checks [verified]
113
+
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]
145
117
  ```
146
118
 
147
- ## REST API(部分)
119
+ ## Not verified
148
120
 
149
- | 端点 | 说明 |
150
- |------|------|
151
- | `POST /api/auth/register` | 注册 |
152
- | `POST /api/auth/login` | 登录 |
153
- | `GET /api/auth/me` | 当前用户 |
154
- | `GET /api/networks` | 网络列表 |
155
- | `POST /api/networks` | 创建网络 |
156
- | `GET /api/tasks` | 任务列表 |
157
- | `GET /api/stats` | 统计汇总 |
158
- | `GET /api/audit-log` | 审计日志 |
121
+ Listed for transparency these commands exist but are not part of the supported v2.0.0 path.
159
122
 
160
- 认证: `Authorization: Bearer <token>` cookie。
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.
161
127
 
162
- ## 文档
128
+ ## Configuration files
163
129
 
164
- - [CHANGELOG](CHANGELOG.md) — 版本变更
165
- - [docs/](docs/) 设计文档与指南
166
- - [tests/](tests/) Docker 测试矩阵
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
+ ```
167
134
 
168
- ## npm 包(已发布稳定版)
135
+ Field-level override: per-node config wins, missing fields fall back to global, then defaults.
136
+
137
+ A typical `config.json` after `anet node create`:
138
+
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
+ }
152
+ ```
153
+
154
+ ## Companion packages
169
155
 
170
- | | latest | 说明 |
171
- |---|--------|------|
172
- | [@sleep2agi/agent-network](https://www.npmjs.com/package/@sleep2agi/agent-network) | 2.0.0 | anet CLI |
173
- | [@sleep2agi/agent-node](https://www.npmjs.com/package/@sleep2agi/agent-node) | 2.1.1 | Agent 运行时 |
174
- | [@sleep2agi/commhub-server](https://www.npmjs.com/package/@sleep2agi/commhub-server) | 0.5.0 | 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 |
175
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 |
176
161
 
177
- ```bash
178
- npm install -g @sleep2agi/agent-network
179
- ```
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
180
167
 
181
168
  ## License
182
169