@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 CHANGED
@@ -1,259 +1,79 @@
1
- # @sleep2agi/agent-node
1
+ # `@sleep2agi/agent-node`
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/@sleep2agi/agent-node.svg)](https://www.npmjs.com/package/@sleep2agi/agent-node)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/@sleep2agi/agent-node.svg)](https://www.npmjs.com/package/@sleep2agi/agent-node)
5
5
  [![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://github.com/sleep2agi/agent-network/blob/main/LICENSE)
6
6
  [![Docs](https://img.shields.io/badge/docs-anet.sh-009e7e.svg)](https://anet.sh)
7
7
 
8
- Agent runtime for Agent Network. Connects to a CommHub server, registers under an alias, and processes incoming tasks with Claude, Codex, Grok Build, or compatible HTTP runtimes.
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
- The supported entry point is the `anet` CLI from `@sleep2agi/agent-network`, which writes the right `config.json`, network token, and environment variables for you.
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
- ## Verified flow
21
-
22
- ```bash
23
- npm install -g @sleep2agi/agent-network
24
- anet hub start # local hub (terminal 1)
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 picker writes `.anet/nodes/<name>/config.json`. `anet node start` reads it and runs this package under the hood.
24
+ The node is ready after `SSE connected` appears in its log.
32
25
 
33
- ## Direct invocation
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 --alias my-bot --hub http://127.0.0.1:9200 --tools all
29
+ npx @sleep2agi/agent-node \
30
+ --config .anet/nodes/<name>/config.json \
31
+ --alias <name>
39
32
  ```
40
33
 
41
- CLI flags:
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
- | Runtime | Backend | Status | Notes |
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
- `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.
164
-
165
- | Provider | Base URL | Default model | Status |
166
- |---|---|---|---|
167
- | Anthropic | `https://api.anthropic.com` | configured by `--model` | verified |
168
- | MiniMax (国际) | `https://api.minimax.io/anthropic` | `MiniMax-M2.7` | verified |
169
- | MiniMax (国内) | `https://api.minimaxi.com/anthropic` | `MiniMax-M2.7` | verified |
170
- | DeepSeek | `https://api.deepseek.com/anthropic` | `deepseek-chat` | verified |
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
- ## Peer coordination (verified)
51
+ ## Configuration and security
234
52
 
235
- When the agent runs, the commhub MCP tools are auto-injected. The model can call:
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
- - `commhub_get_all_status()` — see who else is online
238
- - `commhub_send_task(alias, task)` — dispatch a sub-task to a peer
239
- - `commhub_get_task(task_id)` — poll for the peer's reply
240
- - `commhub_send_message(alias, message)` — chat without a task lifecycle
241
- - `commhub_report_status(status, task)` — push status update
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
- This is what powers the multi-agent flow demonstrated in `anet hub dashboard` (e.g. ask one bot to consult another — the Tasks and Messages pages show the full handshake live).
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
- ## Isolation
63
+ ## Task behavior
246
64
 
247
- When the runtime is `claude-code-cli`, the spawned subprocess gets `settingSources: []` so it doesn't read the host's `~/.claude.json` and accidentally cross networks.
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
- ## Companion packages
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
- | Package | Version |
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
- ## License
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.
@@ -0,0 +1,7 @@
1
+ {
2
+ "schema": 1,
3
+ "commit": "3c4f88aa2058b5647717811b8125477edd70eb68",
4
+ "dirty": false,
5
+ "built_at": "2026-11-17T09:46:11.748Z",
6
+ "source": "git"
7
+ }