@sleep2agi/agent-node 2.5.0-preview.22 → 2.5.0-preview.23
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 +105 -4
- package/dist/cli.js +138 -102
- package/package.json +9 -5
package/README.md
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
[](https://github.com/sleep2agi/agent-network/blob/main/LICENSE)
|
|
6
6
|
[](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 runtime for Agent Network. Connects to a CommHub server, registers under an alias, and processes incoming tasks with Claude, Codex, Grok Build, OpenCode, or compatible HTTP runtimes.
|
|
9
9
|
|
|
10
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.
|
|
11
11
|
|
|
12
12
|
## Install
|
|
13
13
|
|
|
14
|
-
You usually don't install this package directly — `
|
|
14
|
+
You usually don't install this package directly — except for preview `opencode-cli`, which requires the exact paired global `agent-network`/`agent-node` versions and `opencode-ai@1.18.1`. That credential-bearing path never auto-runs project-context `npx`; `anet` accepts only canonical exact package identities and refuses older or project/monorepo-local capable-looking packages. For the experimental `grok-build-cli` co-presence runtime, `anet` similarly capability-checks the global package. To pin the stable package for other runtimes:
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
npm install -g @sleep2agi/agent-node
|
|
@@ -44,7 +44,7 @@ CLI flags:
|
|
|
44
44
|
|---|---|---|
|
|
45
45
|
| `--alias` | required | unique name in the hub |
|
|
46
46
|
| `--hub` | `http://127.0.0.1:9200` | CommHub URL |
|
|
47
|
-
| `--runtime` | `claude-agent-sdk` | `claude-agent-sdk` / `codex-sdk` / `codex-app-server` / `claude-code-cli` / `grok-build-acp` / `http-api` |
|
|
47
|
+
| `--runtime` | `claude-agent-sdk` | `claude-agent-sdk` / `codex-sdk` / `codex-app-server` / `claude-code-cli` / `grok-build-acp` / `grok-build-cli` / `opencode-cli` / `http-api` |
|
|
48
48
|
| `--model` | runtime default | passed through to the SDK |
|
|
49
49
|
| `--tools` | (none) | `all` or comma-separated list |
|
|
50
50
|
| `--max-turns` | `50` | upper bound per task |
|
|
@@ -56,13 +56,46 @@ CLI flags:
|
|
|
56
56
|
|---|---|---|---|
|
|
57
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
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
|
-
| `codex-app-server` | local `codex app-server` + TUI bridge | preview; production locked | canonical RFC-030 runtime. The current CLI entry starts the Phase-0 direct path; Policy Gateway, §8 review, merge and production approval remain locked |
|
|
60
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)) |
|
|
61
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
|
+
| `opencode-cli` | local `opencode acp` | preview, Docker E2E gated | exact `opencode-ai@1.18.1`; Anthropic/OpenAI API presets; safe text-only default with fresh private state roots |
|
|
62
63
|
| `http-api` | OpenAI/Anthropic-compatible HTTP | experimental | reads `ANTHROPIC_*`, `OPENAI_*`, or `MINIMAX_CODING_API_KEY` environment variables |
|
|
63
64
|
|
|
64
65
|
Runtimes are loaded lazily — picking one doesn't pull the others' dependencies. `claude-code-cli` adds zero extra SDK weight.
|
|
65
66
|
|
|
67
|
+
## OpenCode ACP preview
|
|
68
|
+
|
|
69
|
+
Use the paired launcher rather than invoking this package directly:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
npm install -g @sleep2agi/agent-network@preview @sleep2agi/agent-node@preview opencode-ai@1.18.1
|
|
73
|
+
anet node create opencode-demo --runtime opencode-cli
|
|
74
|
+
anet node start opencode-demo
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The default runtime policy disables local filesystem/shell/delegation tools
|
|
78
|
+
and the unattended `question` tool. This preview requires Linux for both safe
|
|
79
|
+
and unsafe OpenCode launches. Safe mode creates one external,
|
|
80
|
+
random, `0700`, launch-scoped root containing the empty workspace and fresh
|
|
81
|
+
HOME/XDG tree; copied API credentials, OpenCode DB/log files, and the workspace
|
|
82
|
+
are removed together after exit. Only explicit
|
|
83
|
+
`flags.opencodeUnsafeTools=true` restores project cwd and local tools for
|
|
84
|
+
trusted tasks, but it is not a sandbox.
|
|
85
|
+
|
|
86
|
+
The default trusted base is `/run/user/$uid`. Non-systemd environments must
|
|
87
|
+
pre-create an owner-only directory and set its absolute path through
|
|
88
|
+
`ANET_OPENCODE_SAFE_BASE`. The base and all ancestors must be canonical
|
|
89
|
+
directories with no group/other write bit; an unverifiable base or non-Linux
|
|
90
|
+
host makes the runtime fail closed. Unsafe mode still needs the same external
|
|
91
|
+
writable root; it changes only cwd/tool policy. Exact 1.18.1 workspace ancestors are rejected
|
|
92
|
+
if they contain `opencode.jsonc`, `opencode.json`, `.opencode`, `AGENTS.md`,
|
|
93
|
+
`CLAUDE.md`, `CONTEXT.md`, `.claude`, `.agents`, or `.git`; identities and
|
|
94
|
+
candidates are revalidated after the version probe immediately before spawn.
|
|
95
|
+
`OPENCODE_PURE` / `OPENCODE_DISABLE_PROJECT_CONFIG` and the other discovery
|
|
96
|
+
disable flags are defense in depth only. A process restart may therefore log
|
|
97
|
+
`session lost on restart` and open a new session.
|
|
98
|
+
|
|
66
99
|
## Grok Build ACP
|
|
67
100
|
|
|
68
101
|
`grok-build-acp` runs the local Grok Build CLI over Agent Client Protocol:
|
|
@@ -90,6 +123,74 @@ Known boundary:
|
|
|
90
123
|
- `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
124
|
- 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
125
|
|
|
126
|
+
## Grok shared TUI — experimental preview
|
|
127
|
+
|
|
128
|
+
> **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`.
|
|
129
|
+
|
|
130
|
+
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:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
grok login
|
|
134
|
+
grok --version
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Use the supported `anet` entry point. In terminal 1:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
anet node create grok-shared --runtime grok-build-cli
|
|
141
|
+
anet node start grok-shared
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
In terminal 2 on the same machine and user account:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
anet grok attach grok-shared
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
`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.
|
|
151
|
+
|
|
152
|
+
For credential isolation, this preview selects a runtime-owned TUI agent
|
|
153
|
+
profile with the exact model-tool inventory `[todo_write]`. Filesystem, shell,
|
|
154
|
+
network, media, MCP, scheduler, and subagent tools are unavailable. Generic
|
|
155
|
+
`tools` and `maxTurns` settings are rejected in co-presence because pinned
|
|
156
|
+
Grok ignores those CLI flags in interactive mode. This is a text-only shared
|
|
157
|
+
conversation preview, not a coding runtime.
|
|
158
|
+
|
|
159
|
+
Grok 0.2.93 automatically resolves the fixed session-local `todo_write`
|
|
160
|
+
helper. The preview accepts at most one exact observed no-request-ID
|
|
161
|
+
`permission_requested` → `permission_resolved(decision=allow)` lifecycle
|
|
162
|
+
during each active network turn and only when no human decision was sent. Every
|
|
163
|
+
other automatic, mismatched, overlapping, or unfinished permission lifecycle
|
|
164
|
+
still fails closed. This exception is preview-only and does not satisfy the
|
|
165
|
+
approval-owner gate required for `latest`.
|
|
166
|
+
|
|
167
|
+
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.
|
|
168
|
+
|
|
169
|
+
This preview supports the CommHub inbox lane used by `anet node start`.
|
|
170
|
+
Feishu configuration is rejected for `grok-build-cli`: its forked worker log
|
|
171
|
+
path is not yet inside this runtime's credential-isolated boundary. The npm
|
|
172
|
+
resolver, agent-node parent, Grok probes, PTY, and helper processes each use
|
|
173
|
+
an exact from-empty environment; durable pending replies and goal state are
|
|
174
|
+
redacted and owner-only. Same-UID host processes remain trusted.
|
|
175
|
+
|
|
176
|
+
The legacy process-per-turn Grok CLI path uses the same runtime name with an explicit creation flag:
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
anet node create grok-turn --runtime grok-build-cli --grok-headless
|
|
180
|
+
anet node start grok-turn
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
This headless node cannot be used with `anet grok attach`. It is also distinct from ACP headless mode:
|
|
184
|
+
|
|
185
|
+
```bash
|
|
186
|
+
anet node create grok-acp --runtime grok-build-acp
|
|
187
|
+
anet node start grok-acp
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
`grok-build-acp` launches `grok agent stdio`; `grok-build-cli --grok-headless` launches one streaming-JSON Grok CLI turn per task.
|
|
191
|
+
|
|
192
|
+
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).
|
|
193
|
+
|
|
93
194
|
## Provider presets (claude-agent-sdk)
|
|
94
195
|
|
|
95
196
|
`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.
|