@sleep2agi/agent-node 2.5.0-preview.3 → 2.5.0-preview.30
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 +46 -157
- package/dist/cli.js +160 -85
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -1,190 +1,79 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@sleep2agi/agent-node`
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@sleep2agi/agent-node)
|
|
4
4
|
[](https://www.npmjs.com/package/@sleep2agi/agent-node)
|
|
5
5
|
[](https://github.com/sleep2agi/agent-network/blob/main/LICENSE)
|
|
6
6
|
[](https://anet.sh)
|
|
7
7
|
|
|
8
|
-
Agent
|
|
8
|
+
Agent Node is the worker process between CommHub and a model runtime. It receives tasks over SSE, invokes the configured runtime, returns results, and reports node status.
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Most users should manage it through the `anet` CLI. `anet node create` writes the network-bound identity and runtime configuration; `anet node start` launches the matching Agent Node.
|
|
11
11
|
|
|
12
|
-
## Install
|
|
13
|
-
|
|
14
|
-
You usually don't install this package directly — `anet node create` and `anet node start` use it via `npx`. To pin it:
|
|
12
|
+
## Install and run
|
|
15
13
|
|
|
16
14
|
```bash
|
|
17
|
-
npm install -g @sleep2agi/agent-node
|
|
18
|
-
```
|
|
15
|
+
npm install -g bun @sleep2agi/agent-network @sleep2agi/agent-node
|
|
19
16
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
anet
|
|
25
|
-
anet hub dashboard # web UI (terminal 2)
|
|
26
|
-
anet login --username admin --password anethub
|
|
27
|
-
anet node create my-bot # two-step picker: runtime, then provider
|
|
28
|
-
anet node start my-bot # → SSE connected
|
|
17
|
+
anet hub start
|
|
18
|
+
anet hub dashboard
|
|
19
|
+
anet login --hub http://127.0.0.1:9200 --username admin
|
|
20
|
+
anet node create my-bot
|
|
21
|
+
anet node start my-bot
|
|
29
22
|
```
|
|
30
23
|
|
|
31
|
-
The
|
|
24
|
+
The node is ready after `SSE connected` appears in its log.
|
|
32
25
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
For scripts and CI:
|
|
26
|
+
For an existing profile, direct invocation is possible but normally unnecessary:
|
|
36
27
|
|
|
37
28
|
```bash
|
|
38
|
-
npx @sleep2agi/agent-node
|
|
29
|
+
npx @sleep2agi/agent-node \
|
|
30
|
+
--config .anet/nodes/<name>/config.json \
|
|
31
|
+
--alias <name>
|
|
39
32
|
```
|
|
40
33
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
| Flag | Default | Notes |
|
|
44
|
-
|---|---|---|
|
|
45
|
-
| `--alias` | required | unique name in the hub |
|
|
46
|
-
| `--hub` | `http://127.0.0.1:9200` | CommHub URL |
|
|
47
|
-
| `--runtime` | `claude-agent-sdk` | `claude-agent-sdk` / `codex-sdk` / `claude-code-cli` / `grok-build-acp` / `http-api` |
|
|
48
|
-
| `--model` | runtime default | passed through to the SDK |
|
|
49
|
-
| `--tools` | (none) | `all` or comma-separated list |
|
|
50
|
-
| `--max-turns` | `50` | upper bound per task |
|
|
51
|
-
| `--session` | (none) | resume a prior session / thread |
|
|
34
|
+
The config must contain a valid node token, or authentication must resolve through the documented legacy fallback. Do not pass a user token as node identity.
|
|
52
35
|
|
|
53
36
|
## Runtimes
|
|
54
37
|
|
|
55
|
-
|
|
56
|
-
|---|---|---|---|
|
|
57
|
-
| `claude-agent-sdk` | [@anthropic-ai/claude-agent-sdk](https://www.npmjs.com/package/@anthropic-ai/claude-agent-sdk) | verified | Anthropic-compatible API; works with MiniMax, DeepSeek, GLM, Kimi, Anthropic, OpenRouter, or custom endpoints |
|
|
58
|
-
| `codex-sdk` | [@openai/codex-sdk](https://www.npmjs.com/package/@openai/codex-sdk) | unverified end-to-end | unit tests pass, no full E2E with real codex auth |
|
|
59
|
-
| `claude-code-cli` | local `claude` CLI | unverified end-to-end | runs locally for Claude Pro subscribers (v0.8.2 fixed the session-resume default-loss bug; see [changelog](https://anet.sh/en/changelog)) |
|
|
60
|
-
| `grok-build-acp` | local `grok agent stdio` | stable runtime, native MCP injection boundary remains preview | requires Grok Build CLI login; stable for receive/reply, session persistence, and explicit CommHub delegation handled by agent-node |
|
|
61
|
-
| `http-api` | OpenAI/Anthropic-compatible HTTP | experimental | reads `ANTHROPIC_*`, `OPENAI_*`, or `MINIMAX_CODING_API_KEY` environment variables |
|
|
62
|
-
|
|
63
|
-
Runtimes are loaded lazily — picking one doesn't pull the others' dependencies. `claude-code-cli` adds zero extra SDK weight.
|
|
64
|
-
|
|
65
|
-
## Grok Build ACP
|
|
66
|
-
|
|
67
|
-
`grok-build-acp` runs the local Grok Build CLI over Agent Client Protocol:
|
|
68
|
-
|
|
69
|
-
```bash
|
|
70
|
-
curl -fsSL https://x.ai/cli/install.sh | bash
|
|
71
|
-
grok
|
|
72
|
-
anet node create grok-demo --runtime grok-build-acp
|
|
73
|
-
anet node start grok-demo
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
The runtime starts `grok agent stdio`, authenticates with the cached Grok login, opens or loads a Grok session, sends the task prompt, collects streamed ACP notifications, and writes `grokSession` back to the node config.
|
|
77
|
-
|
|
78
|
-
Stable behavior:
|
|
79
|
-
|
|
80
|
-
- CommHub task delivery and replies are handled by `agent-node`, not by Grok itself.
|
|
81
|
-
- Plain text tasks should be answered directly by Grok.
|
|
82
|
-
- Explicit delegation tasks are intercepted before Grok when they use a clear pattern such as `给 <alias> 发任务: <task>`.
|
|
83
|
-
- Intercepted delegation calls CommHub directly, passes `parent_task_id`, polls `get_task`, and returns the child result.
|
|
38
|
+
Runtime availability follows the installed npm channel; do not infer it from a fixed version table in a README. Use the [runtime guide](https://anet.sh/guide/runtimes) as the current compatibility matrix.
|
|
84
39
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
`anet node create` step 2 picks one of these and writes `ANTHROPIC_BASE_URL` + a default model. All Anthropic-compatible HTTP API; `--model` is passed through verbatim.
|
|
95
|
-
|
|
96
|
-
| Provider | Base URL | Default model | Status |
|
|
97
|
-
|---|---|---|---|
|
|
98
|
-
| Anthropic | `https://api.anthropic.com` | configured by `--model` | verified |
|
|
99
|
-
| MiniMax (国际) | `https://api.minimax.io/anthropic` | `MiniMax-M2.7` | verified |
|
|
100
|
-
| MiniMax (国内) | `https://api.minimaxi.com/anthropic` | `MiniMax-M2.7` | verified |
|
|
101
|
-
| DeepSeek | `https://api.deepseek.com/anthropic` | `deepseek-chat` | verified |
|
|
102
|
-
| GLM (智谱) | `https://open.bigmodel.cn/api/anthropic` | `glm-4-plus` | verified |
|
|
103
|
-
| Kimi (Moonshot) | `https://api.moonshot.cn/anthropic` | `moonshot-v1-32k` | verified |
|
|
104
|
-
| OpenRouter | `https://openrouter.ai/api/v1` | (user-chosen) | unverified end-to-end |
|
|
105
|
-
| Custom | user-supplied | user-supplied | unverified end-to-end |
|
|
106
|
-
|
|
107
|
-
## Manual env-var examples
|
|
108
|
-
|
|
109
|
-
```bash
|
|
110
|
-
# DeepSeek
|
|
111
|
-
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic \
|
|
112
|
-
ANTHROPIC_AUTH_TOKEN=sk-... \
|
|
113
|
-
npx @sleep2agi/agent-node --alias deep --hub http://127.0.0.1:9200 --tools all
|
|
114
|
-
|
|
115
|
-
# MiniMax
|
|
116
|
-
ANTHROPIC_BASE_URL=https://api.minimax.io/anthropic \
|
|
117
|
-
ANTHROPIC_AUTH_TOKEN=your-key \
|
|
118
|
-
npx @sleep2agi/agent-node --alias mini --model <minimax-model-id> --hub http://127.0.0.1:9200 --tools all
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
## Configuration file
|
|
122
|
-
|
|
123
|
-
Typical output of `anet node create` at `.anet/nodes/<name>/config.json`:
|
|
124
|
-
|
|
125
|
-
```json
|
|
126
|
-
{
|
|
127
|
-
"node_id": "n_a1b2c3d4",
|
|
128
|
-
"node_name": "my-bot",
|
|
129
|
-
"hub": "http://127.0.0.1:9200",
|
|
130
|
-
"token": "ntok_...",
|
|
131
|
-
"runtime": "claude-agent-sdk",
|
|
132
|
-
"model": "<minimax-model-id>",
|
|
133
|
-
"channels": ["server:commhub"],
|
|
134
|
-
"tools": ["Read", "Write", "Edit", "Bash", "Glob", "Grep"],
|
|
135
|
-
"env": {
|
|
136
|
-
"ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
|
|
137
|
-
"ANTHROPIC_AUTH_TOKEN": "sk-..."
|
|
138
|
-
},
|
|
139
|
-
"flags": {
|
|
140
|
-
"dangerouslySkipPermissions": true,
|
|
141
|
-
"teammateMode": "in-process",
|
|
142
|
-
"maxTurns": 50
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
```
|
|
146
|
-
|
|
147
|
-
Per-node config wins over `~/.anet/config.json`; missing fields fall back to global, then defaults.
|
|
148
|
-
|
|
149
|
-
## Main loop
|
|
150
|
-
|
|
151
|
-
Same shape across runtimes:
|
|
40
|
+
| Runtime | Purpose | Availability boundary |
|
|
41
|
+
|---|---|---|
|
|
42
|
+
| `claude-code-cli` | Reuse a local Claude Code login/session | Published task runtime |
|
|
43
|
+
| `claude-agent-sdk` | Call Anthropic-compatible APIs | Published task runtime |
|
|
44
|
+
| `codex-sdk` | Run Codex-backed tasks | Published task runtime |
|
|
45
|
+
| `grok-build-acp` | Run Grok Build through ACP | Published task runtime; no human attach |
|
|
46
|
+
| `codex-app-server` | Share a Codex thread with a human TUI | Preview-only; use `anet node start <name> --copresence` |
|
|
47
|
+
| `opencode-cli` | Run the vetted OpenCode ACP path | Preview-only |
|
|
152
48
|
|
|
153
|
-
|
|
154
|
-
start
|
|
155
|
-
→ report_status: idle
|
|
156
|
-
→ SSE long-poll /events/:alias
|
|
157
|
-
→ on new_task: get_inbox → ack_inbox
|
|
158
|
-
→ report_status: working
|
|
159
|
-
→ run the LLM (with commhub MCP tools injected)
|
|
160
|
-
→ send_reply
|
|
161
|
-
→ report_status: idle
|
|
162
|
-
```
|
|
49
|
+
Neither npm `latest` nor `preview` includes a shared Grok TUI. Development branches may contain source-only experiments, but they are not an installable product path until published and listed in the [Grok TUI status page](https://anet.sh/guide/grok-copresence).
|
|
163
50
|
|
|
164
|
-
##
|
|
51
|
+
## Configuration and security
|
|
165
52
|
|
|
166
|
-
|
|
53
|
+
Project-local profiles live under `.anet/nodes/<alias>/`. A profile includes the Hub URL, runtime, `node_id`, network-bound `ntok_`, model settings, and runtime flags. Treat it as a secret:
|
|
167
54
|
|
|
168
|
-
-
|
|
169
|
-
-
|
|
170
|
-
-
|
|
171
|
-
-
|
|
172
|
-
-
|
|
55
|
+
- Do not commit `.anet`, profile files, `.env`, or tokens.
|
|
56
|
+
- Do not copy one node profile to another machine or alias.
|
|
57
|
+
- Create a separate node identity on each machine.
|
|
58
|
+
- Start from the intended project directory; runtime file tools inherit that workspace.
|
|
59
|
+
- Runtime permission defaults differ. Read the CLI disclosure and [security guide](https://anet.sh/concepts/security) before allowing shell, file-write, or network access.
|
|
173
60
|
|
|
174
|
-
|
|
61
|
+
Agent Node does not read environment variables literally named `TOOLS` or `SYSTEM_PROMPT`. Use `--tools` / config `tools` and `--prompt` / config `systemPrompt`.
|
|
175
62
|
|
|
176
|
-
##
|
|
63
|
+
## Task behavior
|
|
177
64
|
|
|
178
|
-
|
|
65
|
+
- `send_task` creates executable work and can invoke the target runtime.
|
|
66
|
+
- `send_reply` completes a task without invoking another model.
|
|
67
|
+
- `send_message` is ordinary chat and does not invoke another model.
|
|
179
68
|
|
|
180
|
-
|
|
69
|
+
This distinction prevents reply loops. See the [task lifecycle](https://anet.sh/concepts/task-lifecycle) for state, retry, timeout, and parent-child semantics.
|
|
181
70
|
|
|
182
|
-
|
|
183
|
-
|---|---|
|
|
184
|
-
| [@sleep2agi/agent-network](https://www.npmjs.com/package/@sleep2agi/agent-network) | 2.2.10 |
|
|
185
|
-
| [@sleep2agi/commhub-server](https://www.npmjs.com/package/@sleep2agi/commhub-server) | 0.8.4 |
|
|
186
|
-
| [@sleep2agi/agent-network-dashboard](https://www.npmjs.com/package/@sleep2agi/agent-network-dashboard) | 0.5.6 |
|
|
71
|
+
## Documentation
|
|
187
72
|
|
|
188
|
-
|
|
73
|
+
- [Agent Node guide](https://anet.sh/guide/agent-node)
|
|
74
|
+
- [Runtime guide](https://anet.sh/guide/runtimes)
|
|
75
|
+
- [CLI reference](https://anet.sh/guide/cli)
|
|
76
|
+
- [Troubleshooting](https://anet.sh/troubleshooting)
|
|
77
|
+
- [Source repository](https://github.com/sleep2agi/agent-network)
|
|
189
78
|
|
|
190
|
-
Apache-2.0
|
|
79
|
+
Apache-2.0.
|