@sleep2agi/agent-node 2.5.0-preview.27 → 2.5.0-preview.28
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 -166
- package/dist/cli.js +68 -68
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,199 +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
|
-
```
|
|
19
|
-
|
|
20
|
-
For the canonical OpenCode preview, install the entire vetted pair exactly. The OpenCode path does not execute an ambient package or automatic `npx` fallback:
|
|
15
|
+
npm install -g bun @sleep2agi/agent-network @sleep2agi/agent-node
|
|
21
16
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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
|
|
26
22
|
```
|
|
27
23
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
```bash
|
|
31
|
-
npm install -g @sleep2agi/agent-network
|
|
32
|
-
anet hub start # local hub (terminal 1)
|
|
33
|
-
anet hub dashboard # web UI (terminal 2)
|
|
34
|
-
anet login --hub http://127.0.0.1:9200 --username admin --password anethub
|
|
35
|
-
anet node create my-bot # two-step picker: runtime, then provider
|
|
36
|
-
anet node start my-bot # → SSE connected
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
The picker writes `.anet/nodes/<name>/config.json`. `anet node start` reads it and runs this package under the hood.
|
|
40
|
-
|
|
41
|
-
## Direct invocation
|
|
24
|
+
The node is ready after `SSE connected` appears in its log.
|
|
42
25
|
|
|
43
|
-
For
|
|
26
|
+
For an existing profile, direct invocation is possible but normally unnecessary:
|
|
44
27
|
|
|
45
28
|
```bash
|
|
46
|
-
npx @sleep2agi/agent-node
|
|
29
|
+
npx @sleep2agi/agent-node \
|
|
30
|
+
--config .anet/nodes/<name>/config.json \
|
|
31
|
+
--alias <name>
|
|
47
32
|
```
|
|
48
33
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
| Flag | Default | Notes |
|
|
52
|
-
|---|---|---|
|
|
53
|
-
| `--alias` | required | unique name in the hub |
|
|
54
|
-
| `--hub` | `http://127.0.0.1:9200` | CommHub URL |
|
|
55
|
-
| `--runtime` | `claude-agent-sdk` | `claude-agent-sdk` / `claude-code-cli` / `codex-sdk` / `codex-app-server` / `grok-build-acp` / `opencode-cli` |
|
|
56
|
-
| `--model` | runtime default | passed through to the SDK |
|
|
57
|
-
| `--tools` | (none) | `all` or comma-separated list |
|
|
58
|
-
| `--max-turns` | `50` | upper bound per task |
|
|
59
|
-
| `--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.
|
|
60
35
|
|
|
61
36
|
## Runtimes
|
|
62
37
|
|
|
63
|
-
|
|
64
|
-
|---|---|---|---|
|
|
65
|
-
| `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 |
|
|
66
|
-
| `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 |
|
|
67
|
-
| `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)) |
|
|
68
|
-
| `codex-app-server` | local `codex app-server` WebSocket | preview, Windows-verified | shares a Codex TUI thread with dispatched network tasks |
|
|
69
|
-
| `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 |
|
|
70
|
-
| `opencode-cli` | exact `opencode-ai@1.18.1` ACP child | canonical preview, release-gated | defaults to a launch-scoped external workspace with tools disabled; Anthropic/OpenAI presets |
|
|
71
|
-
|
|
72
|
-
The canonical preview picker exposes exactly these 6 runtimes. They are loaded lazily; picking one does not pull the others' SDK dependencies. `claude-code-cli` adds zero extra SDK weight.
|
|
73
|
-
|
|
74
|
-
## Grok Build ACP
|
|
75
|
-
|
|
76
|
-
`grok-build-acp` runs the local Grok Build CLI over Agent Client Protocol:
|
|
77
|
-
|
|
78
|
-
```bash
|
|
79
|
-
curl -fsSL https://x.ai/cli/install.sh | bash
|
|
80
|
-
grok
|
|
81
|
-
anet node create grok-demo --runtime grok-build-acp
|
|
82
|
-
anet node start grok-demo
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
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.
|
|
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.
|
|
86
39
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
- Native Grok MCP tool injection is still experimental. Do not rely on Grok itself seeing `commhub_get_all_status` or `commhub_send_task`.
|
|
97
|
-
- Image attachments are currently text-only because the captured Grok ACP capability reports `promptCapabilities.image=false`.
|
|
98
|
-
- `grok ACP error -32603` is treated as retryable once with a fresh session; the runtime now logs JSON-RPC `error.data` when Grok provides it.
|
|
99
|
-
- Grok tool-state boilerplate such as "Do not attempt to use tools from these servers yet" is stripped from final CommHub replies so users see the actual task answer.
|
|
100
|
-
|
|
101
|
-
## Provider presets (claude-agent-sdk)
|
|
102
|
-
|
|
103
|
-
`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.
|
|
104
|
-
|
|
105
|
-
| Provider | Base URL | Default model | Status |
|
|
106
|
-
|---|---|---|---|
|
|
107
|
-
| Anthropic | `https://api.anthropic.com` | configured by `--model` | verified |
|
|
108
|
-
| MiniMax (国际) | `https://api.minimax.io/anthropic` | `MiniMax-M2.7` | verified |
|
|
109
|
-
| MiniMax (国内) | `https://api.minimaxi.com/anthropic` | `MiniMax-M2.7` | verified |
|
|
110
|
-
| DeepSeek | `https://api.deepseek.com/anthropic` | `deepseek-chat` | verified |
|
|
111
|
-
| GLM (智谱) | `https://open.bigmodel.cn/api/anthropic` | `glm-4-plus` | verified |
|
|
112
|
-
| Kimi (Moonshot) | `https://api.moonshot.cn/anthropic` | `moonshot-v1-32k` | verified |
|
|
113
|
-
| OpenRouter | `https://openrouter.ai/api/v1` | (user-chosen) | unverified end-to-end |
|
|
114
|
-
| Custom | user-supplied | user-supplied | unverified end-to-end |
|
|
115
|
-
|
|
116
|
-
## Manual env-var examples
|
|
117
|
-
|
|
118
|
-
```bash
|
|
119
|
-
# DeepSeek
|
|
120
|
-
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic \
|
|
121
|
-
ANTHROPIC_AUTH_TOKEN=sk-... \
|
|
122
|
-
npx @sleep2agi/agent-node --alias deep --hub http://127.0.0.1:9200 --tools all
|
|
123
|
-
|
|
124
|
-
# MiniMax
|
|
125
|
-
ANTHROPIC_BASE_URL=https://api.minimax.io/anthropic \
|
|
126
|
-
ANTHROPIC_AUTH_TOKEN=your-key \
|
|
127
|
-
npx @sleep2agi/agent-node --alias mini --model <minimax-model-id> --hub http://127.0.0.1:9200 --tools all
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Configuration file
|
|
131
|
-
|
|
132
|
-
Typical output of `anet node create` at `.anet/nodes/<name>/config.json`:
|
|
133
|
-
|
|
134
|
-
```json
|
|
135
|
-
{
|
|
136
|
-
"node_id": "n_a1b2c3d4",
|
|
137
|
-
"node_name": "my-bot",
|
|
138
|
-
"hub": "http://127.0.0.1:9200",
|
|
139
|
-
"token": "ntok_...",
|
|
140
|
-
"runtime": "claude-agent-sdk",
|
|
141
|
-
"model": "<minimax-model-id>",
|
|
142
|
-
"channels": ["server:commhub"],
|
|
143
|
-
"tools": ["Read", "Write", "Edit", "Bash", "Glob", "Grep"],
|
|
144
|
-
"env": {
|
|
145
|
-
"ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
|
|
146
|
-
"ANTHROPIC_AUTH_TOKEN": "sk-..."
|
|
147
|
-
},
|
|
148
|
-
"flags": {
|
|
149
|
-
"dangerouslySkipPermissions": true,
|
|
150
|
-
"teammateMode": "in-process",
|
|
151
|
-
"maxTurns": 50
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
Per-node config wins over `~/.anet/config.json`; missing fields fall back to global, then defaults.
|
|
157
|
-
|
|
158
|
-
## Main loop
|
|
159
|
-
|
|
160
|
-
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 |
|
|
161
48
|
|
|
162
|
-
|
|
163
|
-
start
|
|
164
|
-
→ report_status: idle
|
|
165
|
-
→ SSE long-poll /events/:alias
|
|
166
|
-
→ on new_task: get_inbox → ack_inbox
|
|
167
|
-
→ report_status: working
|
|
168
|
-
→ run the LLM (with commhub MCP tools injected)
|
|
169
|
-
→ send_reply
|
|
170
|
-
→ report_status: idle
|
|
171
|
-
```
|
|
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).
|
|
172
50
|
|
|
173
|
-
##
|
|
51
|
+
## Configuration and security
|
|
174
52
|
|
|
175
|
-
|
|
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:
|
|
176
54
|
|
|
177
|
-
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
181
|
-
-
|
|
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.
|
|
182
60
|
|
|
183
|
-
|
|
61
|
+
Agent Node does not read environment variables literally named `TOOLS` or `SYSTEM_PROMPT`. Use `--tools` / config `tools` and `--prompt` / config `systemPrompt`.
|
|
184
62
|
|
|
185
|
-
##
|
|
63
|
+
## Task behavior
|
|
186
64
|
|
|
187
|
-
|
|
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.
|
|
188
68
|
|
|
189
|
-
|
|
69
|
+
This distinction prevents reply loops. See the [task lifecycle](https://anet.sh/concepts/task-lifecycle) for state, retry, timeout, and parent-child semantics.
|
|
190
70
|
|
|
191
|
-
|
|
192
|
-
|---|---|
|
|
193
|
-
| [@sleep2agi/agent-network](https://www.npmjs.com/package/@sleep2agi/agent-network) | 2.2.10 |
|
|
194
|
-
| [@sleep2agi/commhub-server](https://www.npmjs.com/package/@sleep2agi/commhub-server) | 0.8.4 |
|
|
195
|
-
| [@sleep2agi/agent-network-dashboard](https://www.npmjs.com/package/@sleep2agi/agent-network-dashboard) | 0.5.6 |
|
|
71
|
+
## Documentation
|
|
196
72
|
|
|
197
|
-
|
|
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)
|
|
198
78
|
|
|
199
|
-
Apache-2.0
|
|
79
|
+
Apache-2.0.
|