@sleep2agi/agent-node 2.5.0-preview.21 → 2.5.0-preview.210
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 -226
- package/build-info.json +7 -0
- package/dist/cli.js +349 -153
- package/dist/upload-file-mcp-stdio.js +75 -0
- package/package.json +12 -6
package/README.md
CHANGED
|
@@ -1,259 +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` launch it for you. For the experimental `grok-build-cli` co-presence runtime, `anet` capability-checks any global `agent-node` and otherwise runs `npx -y @sleep2agi/agent-node@preview`; no global `agent-node` install is required. To pin the stable package for other runtimes:
|
|
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` / `grok-build-cli` / `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
|
-
| `grok-build-cli` | local Grok TUI or process-per-turn Grok CLI | dangerous experimental preview | shared TUI is text-only with fixed `[todo_write]`; Linux and exact Grok `0.2.93 (f00f96316d)` required; trusted tasks only |
|
|
62
|
-
| `http-api` | OpenAI/Anthropic-compatible HTTP | experimental | reads `ANTHROPIC_*`, `OPENAI_*`, or `MINIMAX_CODING_API_KEY` environment variables |
|
|
63
|
-
|
|
64
|
-
Runtimes are loaded lazily — picking one doesn't pull the others' dependencies. `claude-code-cli` adds zero extra SDK weight.
|
|
65
|
-
|
|
66
|
-
## Grok Build ACP
|
|
67
|
-
|
|
68
|
-
`grok-build-acp` runs the local Grok Build CLI over Agent Client Protocol:
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
curl -fsSL https://x.ai/cli/install.sh | bash
|
|
72
|
-
grok
|
|
73
|
-
anet node create grok-demo --runtime grok-build-acp
|
|
74
|
-
anet node start grok-demo
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
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.
|
|
78
|
-
|
|
79
|
-
Stable behavior:
|
|
80
|
-
|
|
81
|
-
- CommHub task delivery and replies are handled by `agent-node`, not by Grok itself.
|
|
82
|
-
- Plain text tasks should be answered directly by Grok.
|
|
83
|
-
- Explicit delegation tasks are intercepted before Grok when they use a clear pattern such as `给 <alias> 发任务: <task>`.
|
|
84
|
-
- Intercepted delegation calls CommHub directly, passes `parent_task_id`, polls `get_task`, and returns the child result.
|
|
85
|
-
|
|
86
|
-
Known boundary:
|
|
87
|
-
|
|
88
|
-
- Native Grok MCP tool injection is still experimental. Do not rely on Grok itself seeing `commhub_get_all_status` or `commhub_send_task`.
|
|
89
|
-
- Image attachments are currently text-only because the captured Grok ACP capability reports `promptCapabilities.image=false`.
|
|
90
|
-
- `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.
|
|
91
|
-
- 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.
|
|
92
|
-
|
|
93
|
-
## Grok shared TUI — experimental preview
|
|
94
|
-
|
|
95
|
-
> **Not production-ready:** network tasks drive the same TUI and share its conversation context. Approval ownership is not fully hardened. Use only with trusted tasks on a trusted network. This path belongs to the npm `preview` channel and is not a capability claim for `latest`.
|
|
96
|
-
|
|
97
|
-
The preview is currently supported only on Linux with procfs mounted at `/proc` (including `/proc/self/fd`) and is pinned to build `grok 0.2.93 (f00f96316d)`; the known stable installer prints the same build with an optional trailing ` [stable]`. Install and authenticate that Grok CLI build as the same operating-system user that runs the node:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
grok login
|
|
101
|
-
grok --version
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
Use the supported `anet` entry point. In terminal 1:
|
|
105
|
-
|
|
106
|
-
```bash
|
|
107
|
-
anet node create grok-shared --runtime grok-build-cli
|
|
108
|
-
anet node start grok-shared
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
In terminal 2 on the same machine and user account:
|
|
112
|
-
|
|
113
|
-
```bash
|
|
114
|
-
anet grok attach grok-shared
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
`anet node start` owns the Grok PTY and the local attach socket. `anet grok attach` relays that same terminal and detaches on `Ctrl-]`. A task delivered by CommHub is submitted into the visible shared session, and the completed answer is routed back to the originating task.
|
|
118
|
-
|
|
119
|
-
For credential isolation, this preview selects a runtime-owned TUI agent
|
|
120
|
-
profile with the exact model-tool inventory `[todo_write]`. Filesystem, shell,
|
|
121
|
-
network, media, MCP, scheduler, and subagent tools are unavailable. Generic
|
|
122
|
-
`tools` and `maxTurns` settings are rejected in co-presence because pinned
|
|
123
|
-
Grok ignores those CLI flags in interactive mode. This is a text-only shared
|
|
124
|
-
conversation preview, not a coding runtime.
|
|
125
|
-
|
|
126
|
-
Grok 0.2.93 automatically resolves the fixed session-local `todo_write`
|
|
127
|
-
helper. The preview accepts at most one exact observed no-request-ID
|
|
128
|
-
`permission_requested` → `permission_resolved(decision=allow)` lifecycle
|
|
129
|
-
during each active network turn and only when no human decision was sent. Every
|
|
130
|
-
other automatic, mismatched, overlapping, or unfinished permission lifecycle
|
|
131
|
-
still fails closed. This exception is preview-only and does not satisfy the
|
|
132
|
-
approval-owner gate required for `latest`.
|
|
133
|
-
|
|
134
|
-
If no compatible global `agent-node` is installed, `anet` uses `npx -y @sleep2agi/agent-node@preview` to fetch and resolve the package, verifies preview metadata plus the machine-readable `ANET_CAPABILITY_GROK_COPRESENCE_V2` marker, and then launches the resolved entrypoint directly so stop signals reach the real runtime. An older headless-only or V1 co-presence package does not pass this check. First start therefore needs npm registry access or an already populated npm cache. An incompatible global package is not silently allowed to select another runtime.
|
|
135
|
-
|
|
136
|
-
This preview supports the CommHub inbox lane used by `anet node start`.
|
|
137
|
-
Feishu configuration is rejected for `grok-build-cli`: its forked worker log
|
|
138
|
-
path is not yet inside this runtime's credential-isolated boundary. The npm
|
|
139
|
-
resolver, agent-node parent, Grok probes, PTY, and helper processes each use
|
|
140
|
-
an exact from-empty environment; durable pending replies and goal state are
|
|
141
|
-
redacted and owner-only. Same-UID host processes remain trusted.
|
|
142
|
-
|
|
143
|
-
The legacy process-per-turn Grok CLI path uses the same runtime name with an explicit creation flag:
|
|
144
|
-
|
|
145
|
-
```bash
|
|
146
|
-
anet node create grok-turn --runtime grok-build-cli --grok-headless
|
|
147
|
-
anet node start grok-turn
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
This headless node cannot be used with `anet grok attach`. It is also distinct from ACP headless mode:
|
|
151
|
-
|
|
152
|
-
```bash
|
|
153
|
-
anet node create grok-acp --runtime grok-build-acp
|
|
154
|
-
anet node start grok-acp
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
`grok-build-acp` launches `grok agent stdio`; `grok-build-cli --grok-headless` launches one streaming-JSON Grok CLI turn per task.
|
|
158
|
-
|
|
159
|
-
The formal native Leader/Policy Gateway design is not shipped by this experimental path. Its Phase 0 protocol freeze, Phase 1A gate, production-grade approval ownership, and `latest` release gate remain locked. See the [Grok co-presence preview guide](../docs/grok-build-cli-preview.md).
|
|
160
|
-
|
|
161
|
-
## Provider presets (claude-agent-sdk)
|
|
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.
|
|
162
39
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
|
166
|
-
|
|
167
|
-
|
|
|
168
|
-
|
|
|
169
|
-
|
|
|
170
|
-
|
|
|
171
|
-
| GLM (智谱) | `https://open.bigmodel.cn/api/anthropic` | `glm-4-plus` | verified |
|
|
172
|
-
| Kimi (Moonshot) | `https://api.moonshot.cn/anthropic` | `moonshot-v1-32k` | verified |
|
|
173
|
-
| OpenRouter | `https://openrouter.ai/api/v1` | (user-chosen) | unverified end-to-end |
|
|
174
|
-
| Custom | user-supplied | user-supplied | unverified end-to-end |
|
|
175
|
-
|
|
176
|
-
## Manual env-var examples
|
|
177
|
-
|
|
178
|
-
```bash
|
|
179
|
-
# DeepSeek
|
|
180
|
-
ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropic \
|
|
181
|
-
ANTHROPIC_AUTH_TOKEN=sk-... \
|
|
182
|
-
npx @sleep2agi/agent-node --alias deep --hub http://127.0.0.1:9200 --tools all
|
|
183
|
-
|
|
184
|
-
# MiniMax
|
|
185
|
-
ANTHROPIC_BASE_URL=https://api.minimax.io/anthropic \
|
|
186
|
-
ANTHROPIC_AUTH_TOKEN=your-key \
|
|
187
|
-
npx @sleep2agi/agent-node --alias mini --model <minimax-model-id> --hub http://127.0.0.1:9200 --tools all
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
## Configuration file
|
|
191
|
-
|
|
192
|
-
Typical output of `anet node create` at `.anet/nodes/<name>/config.json`:
|
|
193
|
-
|
|
194
|
-
```json
|
|
195
|
-
{
|
|
196
|
-
"node_id": "n_a1b2c3d4",
|
|
197
|
-
"node_name": "my-bot",
|
|
198
|
-
"hub": "http://127.0.0.1:9200",
|
|
199
|
-
"token": "ntok_...",
|
|
200
|
-
"runtime": "claude-agent-sdk",
|
|
201
|
-
"model": "<minimax-model-id>",
|
|
202
|
-
"channels": ["server:commhub"],
|
|
203
|
-
"tools": ["Read", "Write", "Edit", "Bash", "Glob", "Grep"],
|
|
204
|
-
"env": {
|
|
205
|
-
"ANTHROPIC_BASE_URL": "https://api.minimax.io/anthropic",
|
|
206
|
-
"ANTHROPIC_AUTH_TOKEN": "sk-..."
|
|
207
|
-
},
|
|
208
|
-
"flags": {
|
|
209
|
-
"dangerouslySkipPermissions": true,
|
|
210
|
-
"teammateMode": "in-process",
|
|
211
|
-
"maxTurns": 50
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
Per-node config wins over `~/.anet/config.json`; missing fields fall back to global, then defaults.
|
|
217
|
-
|
|
218
|
-
## Main loop
|
|
219
|
-
|
|
220
|
-
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 |
|
|
221
48
|
|
|
222
|
-
|
|
223
|
-
start
|
|
224
|
-
→ report_status: idle
|
|
225
|
-
→ SSE long-poll /events/:alias
|
|
226
|
-
→ on new_task: get_inbox → ack_inbox
|
|
227
|
-
→ report_status: working
|
|
228
|
-
→ run the LLM (with commhub MCP tools injected)
|
|
229
|
-
→ send_reply
|
|
230
|
-
→ report_status: idle
|
|
231
|
-
```
|
|
49
|
+
The shared Grok TUI (`grok-build-cli` co-presence) ships on the npm `preview` channel (agent-node ≥ 2.5.0-preview.43 with agent-network ≥ 2.3.0-preview.59); `latest` does not include it. Development branches may contain source-only experiments, but they are not an installable product path until published and listed in the [Grok nodes guide](https://anet.sh/guide/grok).
|
|
232
50
|
|
|
233
|
-
##
|
|
51
|
+
## Configuration and security
|
|
234
52
|
|
|
235
|
-
|
|
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:
|
|
236
54
|
|
|
237
|
-
-
|
|
238
|
-
-
|
|
239
|
-
-
|
|
240
|
-
-
|
|
241
|
-
-
|
|
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.
|
|
242
60
|
|
|
243
|
-
|
|
61
|
+
Agent Node does not read environment variables literally named `TOOLS` or `SYSTEM_PROMPT`. Use `--tools` / config `tools` and `--prompt` / config `systemPrompt`.
|
|
244
62
|
|
|
245
|
-
##
|
|
63
|
+
## Task behavior
|
|
246
64
|
|
|
247
|
-
|
|
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.
|
|
248
68
|
|
|
249
|
-
|
|
69
|
+
This distinction prevents reply loops. See the [task lifecycle](https://anet.sh/concepts/task-lifecycle) for state, retry, timeout, and parent-child semantics.
|
|
250
70
|
|
|
251
|
-
|
|
252
|
-
|---|---|
|
|
253
|
-
| [@sleep2agi/agent-network](https://www.npmjs.com/package/@sleep2agi/agent-network) | 2.2.10 |
|
|
254
|
-
| [@sleep2agi/commhub-server](https://www.npmjs.com/package/@sleep2agi/commhub-server) | 0.8.4 |
|
|
255
|
-
| [@sleep2agi/agent-network-dashboard](https://www.npmjs.com/package/@sleep2agi/agent-network-dashboard) | 0.5.6 |
|
|
71
|
+
## Documentation
|
|
256
72
|
|
|
257
|
-
|
|
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)
|
|
258
78
|
|
|
259
|
-
Apache-2.0
|
|
79
|
+
Apache-2.0.
|