@sleep2agi/agent-network 2.3.0-preview.27 → 2.3.0-preview.270
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 +35 -434
- package/build-info.json +7 -0
- package/dist/bin/anet.cjs +104 -0
- package/dist/bin/cli.d.ts +1 -1
- package/dist/bin/cli.js +20 -1
- package/dist/src/active-network-task.d.ts +28 -0
- package/dist/src/batch-workdir.d.ts +9 -0
- package/dist/src/bootstrap-password-db.d.ts +13 -0
- package/dist/src/build-info.d.ts +26 -0
- package/dist/src/channel-attachments.d.ts +29 -0
- package/dist/src/channel-inbox-wake.d.ts +21 -0
- package/dist/src/channel-meta.d.ts +10 -0
- package/dist/src/channel-peer-reply.d.ts +41 -0
- package/dist/src/channel-task-trace.d.ts +14 -0
- package/dist/src/claude-vendor-env.d.ts +28 -0
- package/dist/src/cli-args.d.ts +8 -0
- package/dist/src/cli-auth-session.d.ts +47 -0
- package/dist/src/cli-errors.d.ts +41 -0
- package/dist/src/cli-exit.d.ts +11 -0
- package/dist/src/cli-help.d.ts +10 -0
- package/dist/src/cli-version-display.d.ts +16 -0
- package/dist/src/client-task-trace.d.ts +9 -0
- package/dist/src/client.js +1 -1
- package/dist/src/codex-adopt.d.ts +46 -0
- package/dist/src/codex-auth-fingerprint.d.ts +211 -0
- package/dist/src/codex-bin-pin.d.ts +23 -0
- package/dist/src/codex-commhub-mcp.d.ts +22 -0
- package/dist/src/codex-copresence-bridge-log.d.ts +44 -0
- package/dist/src/codex-copresence-env.d.ts +5 -0
- package/dist/src/codex-copresence-login-gate.d.ts +18 -0
- package/dist/src/codex-copresence-model.d.ts +23 -0
- package/dist/src/codex-copresence-preflight.d.ts +78 -0
- package/dist/src/codex-copresence-profile.d.ts +126 -0
- package/dist/src/codex-copresence-recovery.d.ts +70 -0
- package/dist/src/codex-copresence-resume-timeout.d.ts +28 -0
- package/dist/src/codex-copresence-rollout-guard.d.ts +36 -0
- package/dist/src/codex-copresence-rpc.d.ts +17 -0
- package/dist/src/codex-copresence-thread.d.ts +13 -0
- package/dist/src/codex-copresence-yolo.d.ts +16 -0
- package/dist/src/codex-external-appserver.d.ts +130 -0
- package/dist/src/codex-fork-recovery.d.ts +52 -0
- package/dist/src/codex-home-enforce.d.ts +88 -0
- package/dist/src/codex-lifecycle-account.d.ts +104 -0
- package/dist/src/codex-lifecycle-canary.d.ts +20 -0
- package/dist/src/codex-lifecycle-facts.d.ts +53 -0
- package/dist/src/codex-lifecycle-fork.d.ts +91 -0
- package/dist/src/codex-lifecycle-preflight.d.ts +79 -0
- package/dist/src/codex-lifecycle-receipt.d.ts +53 -0
- package/dist/src/codex-lifecycle-restart.d.ts +88 -0
- package/dist/src/codex-login-share-guard.d.ts +146 -0
- package/dist/src/codex-menu.d.ts +99 -0
- package/dist/src/codex-model-default.d.ts +6 -0
- package/dist/src/codex-node-login.d.ts +98 -0
- package/dist/src/codex-pending-thread-restart.d.ts +69 -0
- package/dist/src/codex-reasoning-effort.d.ts +17 -0
- package/dist/src/codex-recovery-lease.d.ts +39 -0
- package/dist/src/codex-recovery-resource-gate.d.ts +15 -0
- package/dist/src/codex-resume.d.ts +89 -0
- package/dist/src/codex-rollout-history-guard.d.ts +84 -0
- package/dist/src/codex-tui-client-health.d.ts +30 -0
- package/dist/src/commhub-response.d.ts +1 -0
- package/dist/src/controlled-upload.d.ts +83 -0
- package/dist/src/copresence-deps.d.ts +22 -0
- package/dist/src/copresence-identity.d.ts +363 -0
- package/dist/src/copresence-startup-diagnosis.d.ts +17 -0
- package/dist/src/daemon-adopt.d.ts +14 -0
- package/dist/src/daemon-anet-bin.d.ts +32 -0
- package/dist/src/daemon-capability-display.d.ts +110 -0
- package/dist/src/daemon-capability-display.js +21 -0
- package/dist/src/daemon-codex-inventory.d.ts +65 -0
- package/dist/src/daemon-inherited-env.d.ts +9 -0
- package/dist/src/daemon-provider-account-custody.d.ts +28 -0
- package/dist/src/daemon-provider-account-readback.d.ts +3 -0
- package/dist/src/daemon-provider-application.d.ts +36 -0
- package/dist/src/daemon-provider-apply-command.d.ts +9 -0
- package/dist/src/daemon-provider-collect.d.ts +29 -0
- package/dist/src/daemon-provider-command.d.ts +7 -0
- package/dist/src/daemon-provider-initialize.d.ts +27 -0
- package/dist/src/daemon-provider-lifecycle.d.ts +4 -0
- package/dist/src/daemon-provider-store.d.ts +104 -0
- package/dist/src/daemon-runtime-path-preflight.d.ts +22 -0
- package/dist/src/daemon-runtime-staleness.d.ts +13 -0
- package/dist/src/dashboard-managed-process.d.ts +35 -0
- package/dist/src/display-width.d.ts +27 -0
- package/dist/src/doctor-node-count.d.ts +28 -0
- package/dist/src/grok-attach-client.d.ts +15 -1
- package/dist/src/grok-build-drift.d.ts +15 -0
- package/dist/src/grok-copresence-disclosure.d.ts +11 -0
- package/dist/src/grok-copresence-orchestration.d.ts +75 -0
- package/dist/src/grok-copresence-profile.d.ts +22 -1
- package/dist/src/grok-create-mode.d.ts +19 -0
- package/dist/src/host-telemetry.d.ts +14 -0
- package/dist/src/hub-health-timeout.d.ts +4 -0
- package/dist/src/hub-server-version.d.ts +64 -0
- package/dist/src/hub-stop.d.ts +74 -0
- package/dist/src/hub-time-display.d.ts +20 -0
- package/dist/src/hub-version-skew.d.ts +19 -0
- package/dist/src/im/correlation-store.d.ts +34 -0
- package/dist/src/im/feishu/adapter.d.ts +47 -0
- package/dist/src/im/feishu/bridge.d.ts +72 -14
- package/dist/src/im/feishu/chat-context.d.ts +44 -0
- package/dist/src/im/feishu/config.d.ts +15 -1
- package/dist/src/im/feishu/hub-upload.d.ts +1 -1
- package/dist/src/im/feishu/queue-notice.d.ts +2 -0
- package/dist/src/im/feishu/worker-lifecycle.d.ts +13 -0
- package/dist/src/im/feishu/worker.js +171 -154
- package/dist/src/inbox-drain.d.ts +20 -0
- package/dist/src/local-process-state.d.ts +12 -0
- package/dist/src/locale-diagnostic.d.ts +12 -0
- package/dist/src/login-client-label.d.ts +6 -0
- package/dist/src/ls-columns.d.ts +15 -0
- package/dist/src/mock-llm.d.ts +12 -0
- package/dist/src/node-activity-log.d.ts +4 -0
- package/dist/src/node-clone.d.ts +134 -0
- package/dist/src/node-create-network.d.ts +17 -0
- package/dist/src/node-delete-hub.d.ts +42 -0
- package/dist/src/node-files.d.ts +62 -0
- package/dist/src/node-locate.d.ts +60 -0
- package/dist/src/node-ls-all.d.ts +80 -0
- package/dist/src/node-menu.d.ts +40 -0
- package/dist/src/node-not-found.d.ts +1 -0
- package/dist/src/node-perm.d.ts +74 -0
- package/dist/src/node-remote.d.ts +180 -0
- package/dist/src/node-running-guard.d.ts +9 -0
- package/dist/src/node-secret-file.d.ts +32 -0
- package/dist/src/node-server-identity.d.ts +35 -0
- package/dist/src/node-server-payload.d.ts +66 -0
- package/dist/src/node-server-rules-file.d.ts +14 -0
- package/dist/src/node-server-secrets.d.ts +60 -0
- package/dist/src/node-server-version.d.ts +39 -0
- package/dist/src/node-server.d.ts +0 -12
- package/dist/src/node-server.js +8 -1
- package/dist/src/node-skills.d.ts +57 -0
- package/dist/src/normalize-runtime.d.ts +29 -2
- package/dist/src/offline-age.d.ts +29 -0
- package/dist/src/one-line-cell.d.ts +20 -0
- package/dist/src/opencode-agent-node-pair.d.ts +41 -3
- package/dist/src/opencode-free-tier.d.ts +27 -0
- package/dist/src/opencode-generation-create.d.ts +37 -0
- package/dist/src/opencode-generation-record.d.ts +24 -0
- package/dist/src/opencode-package-binary.d.ts +24 -1
- package/dist/src/opencode-pin.d.ts +23 -8
- package/dist/src/opencode-preset.d.ts +6 -1
- package/dist/src/opencode-runtime-binding.d.ts +30 -0
- package/dist/src/opencode-safe-root.d.ts +10 -1
- package/dist/src/opencode-shared-server-create.d.ts +5 -0
- package/dist/src/opencode-start-mode.d.ts +8 -0
- package/dist/src/opencode-v2-configured-model.d.ts +34 -0
- package/dist/src/opencode-v2-create-align.d.ts +18 -0
- package/dist/src/opencode-versions.d.ts +44 -0
- package/dist/src/os-user.d.ts +4 -0
- package/dist/src/outbound-attachments.d.ts +60 -0
- package/dist/src/outbound-tool-names.d.ts +1 -0
- package/dist/src/owned-roots.d.ts +58 -0
- package/dist/src/owner-env-file.d.ts +2 -0
- package/dist/src/package-mode-preflight.d.ts +41 -0
- package/dist/src/posix-codex-copresence.d.ts +33 -0
- package/dist/src/posix-modes.d.ts +36 -0
- package/dist/src/primary-network.d.ts +23 -0
- package/dist/src/private-state.d.ts +18 -0
- package/dist/src/process-telemetry.d.ts +12 -0
- package/dist/src/profile-merge.d.ts +12 -0
- package/dist/src/profile-serialize.d.ts +1 -0
- package/dist/src/provider-application-contract.d.ts +11 -0
- package/dist/src/provider-apply.d.ts +28 -0
- package/dist/src/provider-presets.d.ts +76 -0
- package/dist/src/reply-local-links.d.ts +47 -0
- package/dist/src/reply-originator.d.ts +20 -0
- package/dist/src/resume-runtime-infer.d.ts +18 -0
- package/dist/src/rules-file.d.ts +76 -0
- package/dist/src/scoped-secrets.d.ts +56 -0
- package/dist/src/secret-shell-guidance.d.ts +4 -0
- package/dist/src/session-status-class.d.ts +48 -0
- package/dist/src/shared/opencode-borrowed-launch-health.d.ts +29 -0
- package/dist/src/shared/private-file.d.ts +65 -0
- package/dist/src/shared/provider-collection.d.ts +9 -0
- package/dist/src/shared/provider-initialization.d.ts +7 -0
- package/dist/src/shared/reserved-env.d.ts +3 -0
- package/dist/src/shared/scoped-secret-contract.d.ts +1 -0
- package/dist/src/shared/scoped-secret-env.d.ts +3 -0
- package/dist/src/sibling-agent-node.d.ts +23 -0
- package/dist/src/sse-session-match.d.ts +13 -0
- package/dist/src/stale-socket.d.ts +118 -0
- package/dist/src/standalone-bin.d.ts +101 -0
- package/dist/src/standalone-build-stamp.d.ts +33 -0
- package/dist/src/start-resource-gate.d.ts +146 -0
- package/dist/src/stopped-receipt.d.ts +8 -0
- package/dist/src/subcommand-redirect.d.ts +26 -0
- package/dist/src/task-trace.d.ts +33 -0
- package/dist/src/tmux-attach.d.ts +11 -0
- package/dist/src/tmux-capability.d.ts +58 -0
- package/dist/src/tmux-exact-target.d.ts +36 -0
- package/dist/src/tmux-format.d.ts +20 -0
- package/dist/src/tmux-pane-prompt.d.ts +22 -0
- package/dist/src/tmux.d.ts +44 -0
- package/dist/src/token-cli.d.ts +13 -0
- package/dist/src/tool-allowlist.d.ts +28 -0
- package/dist/src/unsafe-package-path-reason.d.ts +31 -0
- package/dist/src/upgrade-channel.d.ts +31 -0
- package/dist/src/win-launcher.d.ts +20 -0
- package/dist/src/windows-codex-copresence.d.ts +254 -0
- package/dist/src/windows-rename-retry.d.ts +13 -0
- package/dist/src/windows-runtime.d.ts +63 -0
- package/dist/src/windows-sdk-stop-evidence.d.ts +24 -0
- package/package.json +17 -11
- package/dist/src/runtime-choices.d.ts +0 -15
package/README.md
CHANGED
|
@@ -5,473 +5,74 @@
|
|
|
5
5
|
[](https://github.com/sleep2agi/agent-network/blob/main/LICENSE)
|
|
6
6
|
[](https://anet.sh)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
`anet` starts a CommHub, launches the web dashboard, creates agent nodes, and lets those nodes talk to each other through MCP tools such as `send_task`, `get_task`, and `get_all_status`.
|
|
11
|
-
|
|
12
|
-
## What It Is
|
|
13
|
-
|
|
14
|
-
Agent Network is a local-first multi-agent runtime:
|
|
15
|
-
|
|
16
|
-
- **CommHub**: MCP + REST + SSE hub for task routing, auth, networks, and status.
|
|
17
|
-
- **Agent nodes**: long-running AI workers backed by Claude Code, Claude Agent SDK, Codex SDK, or Grok Build ACP.
|
|
18
|
-
- **Dashboard**: browser UI for topology, chat, tasks, node health, and server telemetry.
|
|
19
|
-
- **CLI**: `anet`, the single entry point for setup, auth, node lifecycle, and demos.
|
|
20
|
-
|
|
21
|
-
The default path runs entirely on your machine. LAN sharing is opt-in.
|
|
22
|
-
|
|
23
|
-
## Requirements
|
|
24
|
-
|
|
25
|
-
- Node.js **>= 22.13.0**
|
|
26
|
-
- npm **>= 10**
|
|
27
|
-
- Bun **>= 1.2.0** (`anet hub start` lazy-runs the Bun-based CommHub server)
|
|
28
|
-
- macOS or Linux
|
|
29
|
-
|
|
30
|
-
Install Bun if needed:
|
|
31
|
-
|
|
32
|
-
```bash
|
|
33
|
-
curl -fsSL https://bun.sh/install | bash
|
|
34
|
-
```
|
|
8
|
+
`anet` connects local AI agents through one self-hosted Hub. It starts CommHub and the Dashboard, creates node identities, and manages node lifecycle, networks, tokens, tasks, and channels.
|
|
35
9
|
|
|
36
10
|
## Install
|
|
37
11
|
|
|
38
|
-
|
|
12
|
+
Requires Node.js ≥ 22.13 and Bun ≥ 1.2.
|
|
39
13
|
|
|
40
14
|
```bash
|
|
41
|
-
npm install -g @sleep2agi/agent-network
|
|
42
|
-
anet -v
|
|
15
|
+
npm install -g bun @sleep2agi/agent-network @sleep2agi/agent-node
|
|
43
16
|
```
|
|
44
17
|
|
|
45
|
-
|
|
18
|
+
Stable releases use npm's `latest` tag. Features that are still being validated use `preview`:
|
|
46
19
|
|
|
47
20
|
```bash
|
|
48
|
-
|
|
49
|
-
anet -v
|
|
21
|
+
anet upgrade --channel preview
|
|
50
22
|
```
|
|
51
23
|
|
|
52
|
-
|
|
53
|
-
version table embedded in this source tree:
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm view @sleep2agi/agent-network dist-tags --json
|
|
57
|
-
npm view @sleep2agi/agent-node dist-tags --json
|
|
58
|
-
npm view @sleep2agi/commhub-server dist-tags --json
|
|
59
|
-
```
|
|
24
|
+
Do not copy fixed package or preview numbers from old issues. Check the [upgrade guide](https://anet.sh/guide/upgrade) and npm dist-tags for the current release.
|
|
60
25
|
|
|
61
|
-
|
|
62
|
-
reviewed package is explicitly published to `preview`.
|
|
26
|
+
## Quick start
|
|
63
27
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
Open three terminals.
|
|
67
|
-
|
|
68
|
-
### 1. Start CommHub
|
|
28
|
+
Open three terminals:
|
|
69
29
|
|
|
70
30
|
```bash
|
|
31
|
+
# Terminal 1 — Hub
|
|
71
32
|
anet hub start
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
Default local URL:
|
|
75
33
|
|
|
76
|
-
|
|
77
|
-
http://127.0.0.1:9200
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
By default the hub binds to localhost. Use `--host 0.0.0.0` only when you intentionally want LAN clients to connect.
|
|
81
|
-
|
|
82
|
-
### 2. Start Dashboard
|
|
83
|
-
|
|
84
|
-
```bash
|
|
34
|
+
# Terminal 2 — Dashboard
|
|
85
35
|
anet hub dashboard
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
Open:
|
|
89
|
-
|
|
90
|
-
```text
|
|
91
|
-
http://localhost:3000
|
|
92
|
-
```
|
|
93
36
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
```bash
|
|
97
|
-
anet login --username admin --password anethub
|
|
37
|
+
# Terminal 3 — login, create, start
|
|
38
|
+
anet login --hub http://127.0.0.1:9200 --username admin
|
|
98
39
|
anet node create my-bot
|
|
99
40
|
anet node start my-bot
|
|
100
41
|
```
|
|
101
42
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
1. Runtime: `claude-code-cli`, `claude-agent-sdk`, `codex-sdk`, `codex-app-server`, `grok-build-acp`, the experimental preview-only `grok-build-cli`, or preview `opencode-cli`.
|
|
105
|
-
2. Provider preset: runtime-specific options, including Anthropic/OpenAI API-key presets for `opencode-cli` (other Anthropic-compatible providers remain available through `claude-agent-sdk`).
|
|
106
|
-
3. API key and model settings.
|
|
107
|
-
|
|
108
|
-
When the node starts successfully, look for:
|
|
109
|
-
|
|
110
|
-
```text
|
|
111
|
-
SSE connected
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Then use the Dashboard chat panel to send `my-bot` a message.
|
|
115
|
-
|
|
116
|
-
## Multi-Agent Collaboration
|
|
117
|
-
|
|
118
|
-
Create a second node:
|
|
119
|
-
|
|
120
|
-
```bash
|
|
121
|
-
anet node create reviewer
|
|
122
|
-
anet node start reviewer
|
|
123
|
-
```
|
|
124
|
-
|
|
125
|
-
Ask `my-bot`:
|
|
126
|
-
|
|
127
|
-
```text
|
|
128
|
-
Ask reviewer to review this plan and summarize the risks.
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
The first agent can discover peers with `get_all_status`, delegate work with `send_task`, poll with `get_task`, and integrate the reply. The dashboard Tasks and Messages views show the chain.
|
|
132
|
-
|
|
133
|
-
## LAN Hub
|
|
134
|
-
|
|
135
|
-
On the hub machine:
|
|
136
|
-
|
|
137
|
-
```bash
|
|
138
|
-
anet hub start --host 0.0.0.0
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
On another machine:
|
|
142
|
-
|
|
143
|
-
```bash
|
|
144
|
-
npm install -g @sleep2agi/agent-network
|
|
145
|
-
anet init --hub http://<HUB-LAN-IP>:9200
|
|
146
|
-
anet login --username admin --password anethub
|
|
147
|
-
anet node create remote-bot
|
|
148
|
-
anet node start remote-bot
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
Do not expose the hub directly to the public internet without a reverse proxy, HTTPS, firewall rules, and reviewed auth settings.
|
|
152
|
-
|
|
153
|
-
## Runtimes
|
|
154
|
-
|
|
155
|
-
| Runtime | Use When | Notes |
|
|
156
|
-
|---|---|---|
|
|
157
|
-
| `claude-code-cli` | You want Claude Code CLI sessions and channel support | Uses Claude Code process; supports stable `COMMHUB_RESUME_ID` in recent previews |
|
|
158
|
-
| `claude-agent-sdk` | You want Anthropic-compatible API providers | Good default for provider presets |
|
|
159
|
-
| `codex-sdk` | You want Codex-backed nodes | Useful as a backup runtime when Claude quota is constrained |
|
|
160
|
-
| `codex-app-server` | You want a Codex TUI/app-server bridge | Preview bridge with a bound Codex thread |
|
|
161
|
-
| `grok-build-acp` | You want Grok Build through `grok agent stdio` | Requires Grok Build CLI auth; stable for receive/reply, session persistence, and explicit `send_task` delegation |
|
|
162
|
-
| `grok-build-cli` | You want one human-visible, text-only Grok TUI shared with trusted network tasks | **Experimental preview only.** Fixed `[todo_write]` tool profile; Linux and an exact Grok CLI build are required; approval ownership is not fully hardened |
|
|
163
|
-
| `opencode-cli` | You want OpenCode ACP with an Anthropic/OpenAI API preset or a keyless OpenCode model | **Preview only.** Requires exact `opencode-ai@1.18.1` and the paired preview packages; safe mode is text-only and uses fresh private runtime roots |
|
|
164
|
-
|
|
165
|
-
### OpenCode ACP — Preview
|
|
166
|
-
|
|
167
|
-
Install the exact release pair and vetted OpenCode pin, then create a node:
|
|
168
|
-
|
|
169
|
-
```bash
|
|
170
|
-
npm install -g @sleep2agi/agent-network@preview @sleep2agi/agent-node@preview opencode-ai@1.18.1
|
|
171
|
-
anet node create opencode-demo --runtime opencode-cli
|
|
172
|
-
anet node start opencode-demo
|
|
173
|
-
```
|
|
174
|
-
|
|
175
|
-
All three are deliberate global prerequisites for this preview. The OpenCode
|
|
176
|
-
launch path does not auto-run `npx` from a project-controlled PATH. It accepts
|
|
177
|
-
only canonical npm package entrypoints with exact metadata and rejects an
|
|
178
|
-
otherwise convincing same-version package inside the current project or an
|
|
179
|
-
enclosing monorepo workspace.
|
|
180
|
-
|
|
181
|
-
The wizard supports Anthropic and OpenAI API-key presets. If the selected key
|
|
182
|
-
is not exported, use the printed `anet opencode auth-login` command; OpenAI is
|
|
183
|
-
forced to the upstream `Manually enter API Key` method. By default OpenCode
|
|
184
|
-
runs only on Linux in an external random `0700` launch-scoped root whose
|
|
185
|
-
`workspace` and fresh private HOME/XDG roots are removed together after exit.
|
|
186
|
-
Local code tools and unattended `question` are disabled. Only explicit
|
|
187
|
-
`flags.opencodeUnsafeTools=true` restores the project cwd for trusted tasks.
|
|
188
|
-
|
|
189
|
-
The default trusted base is `/run/user/$uid`. On a non-systemd host, pre-create
|
|
190
|
-
an owner-only directory and set its absolute path in
|
|
191
|
-
`ANET_OPENCODE_SAFE_BASE`; the base and every ancestor must not be group/other
|
|
192
|
-
writable. The whole preview runtime (safe and unsafe) hard-fails when the base
|
|
193
|
-
cannot be verified or the host is not Linux. Unsafe still uses the external
|
|
194
|
-
writable root; it changes only cwd and local-tool policy. For exact 1.18.1, every workspace ancestor is scanned for
|
|
195
|
-
`opencode.jsonc`, `opencode.json`, `.opencode`, `AGENTS.md`, `CLAUDE.md`,
|
|
196
|
-
`CONTEXT.md`, `.claude`, `.agents`, and `.git`, then its identity and candidates
|
|
197
|
-
are checked again after the version probe immediately before ACP spawn.
|
|
198
|
-
`OPENCODE_PURE` and `OPENCODE_DISABLE_PROJECT_CONFIG` remain defense in depth,
|
|
199
|
-
not the isolation boundary. Local OpenCode conversation history is not promised
|
|
200
|
-
across process crashes; use Docker/VM when an OS security boundary is needed.
|
|
201
|
-
|
|
202
|
-
### Grok Build ACP
|
|
203
|
-
|
|
204
|
-
`grok-build-acp` uses the local Grok Build CLI via Agent Client Protocol (ACP). Install and authenticate Grok first:
|
|
205
|
-
|
|
206
|
-
```bash
|
|
207
|
-
curl -fsSL https://x.ai/cli/install.sh | bash
|
|
208
|
-
grok
|
|
209
|
-
```
|
|
210
|
-
|
|
211
|
-
Create and start a node:
|
|
212
|
-
|
|
213
|
-
```bash
|
|
214
|
-
anet node create grok-demo --runtime grok-build-acp
|
|
215
|
-
anet node start grok-demo
|
|
216
|
-
```
|
|
217
|
-
|
|
218
|
-
Look for:
|
|
219
|
-
|
|
220
|
-
```text
|
|
221
|
-
runtime: grok-build-acp
|
|
222
|
-
SSE connected
|
|
223
|
-
```
|
|
224
|
-
|
|
225
|
-
Stable support:
|
|
226
|
-
|
|
227
|
-
- Receive CommHub tasks through SSE.
|
|
228
|
-
- Run one Grok Build ACP turn per task.
|
|
229
|
-
- Persist `grokSession` into `.anet/nodes/<name>/config.json`.
|
|
230
|
-
- Resume the saved Grok session on the next task.
|
|
231
|
-
- Reply to the original sender through CommHub.
|
|
232
|
-
- Explicit delegation such as `给 A站助手 发任务: ...` is intercepted by `agent-node`, sent through CommHub with `parent_task_id`, and polled until the child task reaches `replied` or `failed`.
|
|
233
|
-
|
|
234
|
-
Current boundary:
|
|
235
|
-
|
|
236
|
-
- Grok native MCP tool injection is not the stable path yet.
|
|
237
|
-
- For cross-agent delegation, use explicit delegation wording so `agent-node` handles the CommHub call deterministically.
|
|
238
|
-
- If Grok returns `grok ACP error -32603`, upgrade to the latest `@sleep2agi/agent-node` and restart the node; recent builds narrow ACP capabilities and include `error.data` diagnostics.
|
|
239
|
-
|
|
240
|
-
Details: `docs/grok-build-runtime.md`.
|
|
241
|
-
|
|
242
|
-
### Grok Co-Presence TUI — Experimental Preview
|
|
243
|
-
|
|
244
|
-
> **Dangerous experimental feature:** network tasks drive the same Grok TUI and share its conversation context. Approval ownership is not fully hardened. Use only with trusted tasks on a trusted network. This runtime is not supported for production and is not part of the `latest` release channel.
|
|
245
|
-
|
|
246
|
-
The co-presence candidate is currently pinned to Linux with procfs mounted at `/proc` (including `/proc/self/fd`) and the exact Grok CLI build reported as `grok 0.2.93 (f00f96316d)` (the stable installer may append ` [stable]`). Install that build and log in as the same operating-system user that will run `anet`:
|
|
247
|
-
|
|
248
|
-
```bash
|
|
249
|
-
grok login
|
|
250
|
-
grok --version
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
Create the shared-TUI node and start its bridge in the first terminal:
|
|
254
|
-
|
|
255
|
-
```bash
|
|
256
|
-
anet node create grok-shared --runtime grok-build-cli
|
|
257
|
-
anet node start grok-shared
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
Attach an interactive terminal to the same TUI from a second terminal on the same machine and user account:
|
|
261
|
-
|
|
262
|
-
```bash
|
|
263
|
-
anet grok attach grok-shared
|
|
264
|
-
```
|
|
265
|
-
|
|
266
|
-
Press `Ctrl-]` to detach. While attached, a CommHub task sent to `grok-shared` is submitted to this same TUI, rendered in the visible session, and its completed answer is routed back to the originating task. This shared-session behavior is the reason untrusted tasks must not be connected.
|
|
267
|
-
|
|
268
|
-
This preview selects a runtime-owned TUI agent profile whose exact model-tool
|
|
269
|
-
inventory is `[todo_write]`. Filesystem, shell, network, media, MCP, scheduler,
|
|
270
|
-
and subagent tools are unavailable; custom `tools`/`maxTurns` are unsupported
|
|
271
|
-
in co-presence. It is a text-only co-presence preview, not a coding profile.
|
|
272
|
-
|
|
273
|
-
The pinned 0.2.93 TUI resolves its session-local `todo_write` helper without
|
|
274
|
-
human input. During an active network turn the preview admits only that exact
|
|
275
|
-
no-request-ID lifecycle with `decision=allow`, at most once per turn; every other tool, identity,
|
|
276
|
-
decision, overlap, mode transition, or unresolved completion remains closed.
|
|
277
|
-
This deliberately narrow preview exception is not production approval-owner
|
|
278
|
-
enforcement and is another reason to connect trusted tasks only.
|
|
279
|
-
|
|
280
|
-
`anet node start` capability-checks a compatible global `agent-node` if one exists. It requires the machine-readable `ANET_CAPABILITY_GROK_COPRESENCE_V2` marker, so an older headless-only or V1 co-presence binary cannot shadow the fixed-profile preview. A global install is not required: when it is absent or incompatible, `anet` uses `npx -y @sleep2agi/agent-node@preview` to fetch and resolve the preview package, verifies its metadata/capability, then launches the resolved `agent-node` entrypoint directly. Direct launch lets `anet node stop` signal the real runtime instead of an installer wrapper. The fallback therefore needs npm registry access or an already populated npm cache on first start.
|
|
281
|
-
|
|
282
|
-
The preview E2E covers the CommHub inbox path. `grok-build-cli` currently
|
|
283
|
-
refuses Feishu channels because that forked worker does not yet share the
|
|
284
|
-
credential-isolated log boundary; run Feishu on a separate non-Grok node.
|
|
285
|
-
|
|
286
|
-
For the older process-per-turn Grok CLI lane, opt out of co-presence explicitly:
|
|
287
|
-
|
|
288
|
-
```bash
|
|
289
|
-
anet node create grok-turn --runtime grok-build-cli --grok-headless
|
|
290
|
-
anet node start grok-turn
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
`anet grok attach` intentionally refuses a headless node. The separate ACP runtime remains available as:
|
|
294
|
-
|
|
295
|
-
```bash
|
|
296
|
-
anet node create grok-acp --runtime grok-build-acp
|
|
297
|
-
anet node start grok-acp
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
`grok-build-acp` uses `grok agent stdio`; it is not the same execution path as `grok-build-cli --grok-headless`.
|
|
301
|
-
|
|
302
|
-
This preview does **not** claim completion of the formal native Leader/Policy Gateway runtime. Its Phase 0 protocol freeze, Phase 1A implementation gate, production-grade approval ownership, and `latest` release gate remain locked. See the [Grok co-presence preview guide](../docs/grok-build-cli-preview.md) for the exact boundary.
|
|
303
|
-
|
|
304
|
-
## Provider Presets
|
|
305
|
-
|
|
306
|
-
`anet node create` writes the correct provider environment into `.anet/nodes/<name>/config.json`.
|
|
307
|
-
|
|
308
|
-
| Provider | Status | Notes |
|
|
309
|
-
|---|---|---|
|
|
310
|
-
| Anthropic | verified path | Native Anthropic Messages API |
|
|
311
|
-
| MiniMax | verified path | Anthropic-compatible endpoint |
|
|
312
|
-
| DeepSeek | verified path | Anthropic-compatible endpoint |
|
|
313
|
-
| GLM / Zhipu | verified path | Anthropic-compatible endpoint |
|
|
314
|
-
| Kimi / Moonshot | verified path | Anthropic-compatible endpoint |
|
|
315
|
-
| OpenRouter | available | Anthropic-compatible routing |
|
|
316
|
-
| Custom | available | Provide base URL, model, and token |
|
|
317
|
-
|
|
318
|
-
## Common Commands
|
|
319
|
-
|
|
320
|
-
```bash
|
|
321
|
-
# Hub and dashboard
|
|
322
|
-
anet hub start
|
|
323
|
-
anet hub dashboard
|
|
43
|
+
The node is ready after its log reports `SSE connected`. Open `http://localhost:3000` and send it a task from Dashboard.
|
|
324
44
|
|
|
325
|
-
|
|
326
|
-
anet register
|
|
327
|
-
anet login --username <user> --password <password>
|
|
328
|
-
anet logout
|
|
329
|
-
anet whoami
|
|
330
|
-
anet passwd
|
|
45
|
+
## Runtime selection
|
|
331
46
|
|
|
332
|
-
|
|
333
|
-
anet node create <name>
|
|
334
|
-
anet node start <name>
|
|
335
|
-
anet node start --all
|
|
336
|
-
anet node stop <name>
|
|
337
|
-
anet node resume <name>
|
|
338
|
-
anet node rename <old> <new> --force
|
|
339
|
-
anet node delete <name>
|
|
340
|
-
anet node ls
|
|
341
|
-
anet info <name>
|
|
342
|
-
anet logs <name>
|
|
47
|
+
`anet node create` shows only runtimes available in the installed release channel. Installation, authentication, permissions, and current availability are maintained in the [runtime guide](https://anet.sh/guide/runtimes).
|
|
343
48
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
49
|
+
- Claude Code, Claude Agent SDK, Codex SDK, and Grok Build ACP are the published task-runtime paths.
|
|
50
|
+
- Codex TUI co-presence is preview-only and must be started and recovered with `--copresence`; see the [co-presence guide](https://anet.sh/guide/codex-copresence).
|
|
51
|
+
- OpenCode support is preview-only. Its automatic `npx` fallback is intentionally disabled, so install the documented CLI explicitly.
|
|
52
|
+
- Neither npm `latest` nor `preview` includes a shared Grok TUI. Use `grok-build-acp` for published Grok nodes and follow the [Grok nodes guide](https://anet.sh/guide/grok).
|
|
348
53
|
|
|
349
|
-
|
|
350
|
-
anet status
|
|
351
|
-
anet tasks [status]
|
|
352
|
-
anet doctor
|
|
353
|
-
anet doctor --fix
|
|
54
|
+
Development branches may contain source-only runtime experiments. They are not supported installation paths until they appear in an npm dist-tag and the runtime guide.
|
|
354
55
|
|
|
355
|
-
|
|
356
|
-
anet init --hub <url>
|
|
357
|
-
anet init project
|
|
358
|
-
anet project up
|
|
359
|
-
anet project restart
|
|
360
|
-
anet project down
|
|
361
|
-
anet session ls
|
|
56
|
+
## What it provides
|
|
362
57
|
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
anet upgrade
|
|
368
|
-
anet upgrade --channel preview --dry-run
|
|
369
|
-
|
|
370
|
-
# Batch / demos
|
|
371
|
-
anet create --batch
|
|
372
|
-
anet batch list
|
|
373
|
-
anet batch stop <prefix>
|
|
374
|
-
anet demo sci-team
|
|
375
|
-
```
|
|
58
|
+
- **CommHub** — MCP, REST, SSE task delivery, authentication, networks, and audit state.
|
|
59
|
+
- **Agent Node** — long-running workers backed by the selected runtime.
|
|
60
|
+
- **Dashboard** — topology, chat, tasks, messages, and node health.
|
|
61
|
+
- **CLI** — setup, login, node/project lifecycle, channels, tokens, and diagnostics.
|
|
376
62
|
|
|
377
|
-
|
|
63
|
+
Runtimes with CommHub tool integration can discover peers and delegate work with tools such as `get_all_status`, `send_task`, and `get_task`. Replies and ordinary messages do not recursively invoke another model; see the [task lifecycle](https://anet.sh/concepts/task-lifecycle).
|
|
378
64
|
|
|
379
|
-
|
|
380
|
-
~/.anet/config.json
|
|
381
|
-
Global CLI profile: hub URL, user token, default network.
|
|
65
|
+
## Security
|
|
382
66
|
|
|
383
|
-
|
|
384
|
-
Local bootstrap admin token for the hub.
|
|
385
|
-
|
|
386
|
-
{project}/.anet/nodes/<name>/config.json
|
|
387
|
-
Per-node runtime, model, provider env, node token, channels, and session IDs.
|
|
388
|
-
```
|
|
389
|
-
|
|
390
|
-
Example node config:
|
|
391
|
-
|
|
392
|
-
```json
|
|
393
|
-
{
|
|
394
|
-
"node_id": "n_a1b2c3d4",
|
|
395
|
-
"node_name": "my-bot",
|
|
396
|
-
"alias": "my-bot",
|
|
397
|
-
"hub": "http://127.0.0.1:9200",
|
|
398
|
-
"network_id": "default",
|
|
399
|
-
"token": "ntok_...",
|
|
400
|
-
"runtime": "claude-agent-sdk",
|
|
401
|
-
"model": "your-model",
|
|
402
|
-
"channels": ["server:commhub"],
|
|
403
|
-
"tools": ["Read", "Write", "Edit", "Bash", "Glob", "Grep"],
|
|
404
|
-
"env": {
|
|
405
|
-
"ANTHROPIC_BASE_URL": "https://example.com/anthropic",
|
|
406
|
-
"ANTHROPIC_AUTH_TOKEN": "sk-..."
|
|
407
|
-
},
|
|
408
|
-
"flags": {
|
|
409
|
-
"dangerouslySkipPermissions": true,
|
|
410
|
-
"teammateMode": "in-process",
|
|
411
|
-
"maxTurns": 50
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
```
|
|
415
|
-
|
|
416
|
-
Do not commit `.anet/` or provider API keys.
|
|
417
|
-
|
|
418
|
-
## Security Notes
|
|
419
|
-
|
|
420
|
-
- The hub binds to `127.0.0.1` by default.
|
|
421
|
-
- LAN mode is explicit: `anet hub start --host 0.0.0.0`.
|
|
422
|
-
- Node tokens are network-scoped `ntok_` tokens; user tokens are `utok_`.
|
|
423
|
-
- Keep API keys in local node config or env refs; never paste real keys into issues or docs.
|
|
424
|
-
- Treat tmux / terminal streaming features as local-admin tools.
|
|
425
|
-
|
|
426
|
-
## What Is Stable vs Experimental
|
|
427
|
-
|
|
428
|
-
Stable day-to-day path:
|
|
429
|
-
|
|
430
|
-
- `anet hub start` / `anet hub stop` / `anet hub status` (v0.10.11+: SIGTERM → 3s grace → SIGKILL stop; status shows PID + port + `/health` version — no more manual `lsof+kill`)
|
|
431
|
-
- `anet hub dashboard`
|
|
432
|
-
- `anet login`
|
|
433
|
-
- `anet node create/start/stop/delete/rename`
|
|
434
|
-
- `anet node start --all`
|
|
435
|
-
- `anet project up/restart/down`
|
|
436
|
-
- Dashboard chat, task list, topology, and status views
|
|
437
|
-
|
|
438
|
-
Actively evolving:
|
|
439
|
-
|
|
440
|
-
- IM platform integration (Feishu / Slack / WhatsApp / WeCom)
|
|
441
|
-
- Telegram channel binding
|
|
442
|
-
- Advanced dashboard topology edges
|
|
443
|
-
- Batch orchestration and science-team demos
|
|
444
|
-
- Codex runtime expansion
|
|
445
|
-
- Grok Build ACP runtime
|
|
446
|
-
- Cross-version rename hot-reload
|
|
67
|
+
The default Hub is local-only. Before exposing it beyond localhost, change the initial password and follow the [production deployment guide](https://anet.sh/deploy/production). Do not copy `.anet` node configs between machines: they contain network-bound identity and token material.
|
|
447
68
|
|
|
448
69
|
## Documentation
|
|
449
70
|
|
|
450
|
-
-
|
|
451
|
-
-
|
|
452
|
-
-
|
|
453
|
-
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
This package lives in the `agent-network/` subdirectory of the monorepo:
|
|
458
|
-
|
|
459
|
-
```text
|
|
460
|
-
agent-network/
|
|
461
|
-
bin/cli.ts anet CLI
|
|
462
|
-
src/client.ts SDK client
|
|
463
|
-
src/node-server.ts CommHub MCP server bridge used by claude-code-cli
|
|
464
|
-
src/im/ IM integration contracts and future adapters
|
|
465
|
-
```
|
|
466
|
-
|
|
467
|
-
Related packages live next to it:
|
|
468
|
-
|
|
469
|
-
```text
|
|
470
|
-
server/ @sleep2agi/commhub-server
|
|
471
|
-
agent-node/ @sleep2agi/agent-node
|
|
472
|
-
docs-site/ anet.sh documentation site
|
|
473
|
-
```
|
|
474
|
-
|
|
475
|
-
## License
|
|
71
|
+
- [Getting started](https://anet.sh/guide/getting-started)
|
|
72
|
+
- [CLI reference](https://anet.sh/guide/cli)
|
|
73
|
+
- [Runtime guide](https://anet.sh/guide/runtimes)
|
|
74
|
+
- [Tokens and permissions](https://anet.sh/concepts/security)
|
|
75
|
+
- [Troubleshooting](https://anet.sh/troubleshooting)
|
|
76
|
+
- [GitHub repository](https://github.com/sleep2agi/agent-network)
|
|
476
77
|
|
|
477
|
-
Apache-2.0
|
|
78
|
+
Apache-2.0.
|
package/build-info.json
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
// anet 的 bin 入口垫片 —— 唯一职责:在【解析真正的 ESM 入口之前】把 Node 版本讲清楚。
|
|
4
|
+
//
|
|
5
|
+
// 🔴 为什么必须是 CJS,而且必须是手写不进构建:
|
|
6
|
+
//
|
|
7
|
+
// dist/bin/cli.js 是 ESM(package.json 里 type: module),而且经 javascript-obfuscator
|
|
8
|
+
// 处理过。老 Node 读到它的第一行 `import{createRequire}from'node:module'` 就抛
|
|
9
|
+
//
|
|
10
|
+
// SyntaxError: Unexpected token {
|
|
11
|
+
//
|
|
12
|
+
// ——**在任何一行代码执行之前**。cli.ts 里那个 checkNodeVersion()(required "22.13.0")
|
|
13
|
+
// 写在同一个文件里,所以它永远轮不到跑。**一个写在 ESM 里的版本检查,救不了一个
|
|
14
|
+
// 连 ESM 都解析不了的 Node。**
|
|
15
|
+
//
|
|
16
|
+
// 用户实际看到的是一屏混淆后的代码 + SyntaxError,完全指不到真因。
|
|
17
|
+
// (2026-08-18 现场:Node 10/12 世代的栈,`internal/bootstrap/node.js`、
|
|
18
|
+
// `Function.Module.runMain`、`loader.js:723`。)
|
|
19
|
+
//
|
|
20
|
+
// package.json 的 engines.node>=22.13.0 也不拦:npm 默认 engine-strict=false,
|
|
21
|
+
// 那只是安装时的一句警告。
|
|
22
|
+
//
|
|
23
|
+
// 🔴 本文件的写法约束(违反其中任何一条,垫片自己就会在同一个地方炸):
|
|
24
|
+
// - 只用 ES5 语法:var / function / 字符串拼接。不用 const/let、箭头函数、
|
|
25
|
+
// 模板串、可选链(?.)、空值合并(??)。
|
|
26
|
+
// - **不能出现字面量的 `import(...)`** —— 动态 import 是 Node 12.17+ 才能【解析】的
|
|
27
|
+
// 语法,老 Node 在解析阶段就会失败。所以用 new Function 把它推迟到调用时再解析,
|
|
28
|
+
// 而调用只发生在版本检查通过之后。
|
|
29
|
+
// - 不进 bun build,不进 obfuscator。构建里只 cp 过去。
|
|
30
|
+
|
|
31
|
+
// 🔴 两个阈值,回答两个不同的问题。把它们合成一个,就是我 2026-08-18 犯的错:
|
|
32
|
+
//
|
|
33
|
+
// PARSE_FLOOR = 16.0.0 「这个 Node 能不能**加载**入口?」
|
|
34
|
+
// 低于它,dist/bin/cli.js 的第一行 `import{createRequire}from'node:module'`
|
|
35
|
+
// 连解析都过不去(ESM 语句需要 Node>=12;`node:` 前缀需要 >=14.18/16)。
|
|
36
|
+
// 这时**必须硬退**,因为再往下没有任何一行自己的代码能跑。
|
|
37
|
+
//
|
|
38
|
+
// SUPPORTED = 22.13.0 「这个 Node 是不是受支持的版本?」
|
|
39
|
+
// 这是 package.json engines 声明的下限,而产品对它的既有立场是
|
|
40
|
+
// **警告并继续** —— cli.ts 的 checkNodeVersion() 只在 `anet upgrade` 里
|
|
41
|
+
// 打一行 "Continuing anyway"。
|
|
42
|
+
//
|
|
43
|
+
// 🔴 第一版我用 SUPPORTED 做硬退,直接把 e2e 打红了:CI 镜像跑的是 Node 20
|
|
44
|
+
// (tests/Dockerfile 里 setup_20.x),5 个 suite 当场全灭。
|
|
45
|
+
// **垫片不该比产品自己的立场更严** —— 它的职责是把「解析不了」这件事讲清楚,
|
|
46
|
+
// 不是顺手收紧支持策略。那是另一个决定,要单独做。
|
|
47
|
+
var PARSE_FLOOR = '16.0.0';
|
|
48
|
+
var SUPPORTED = '22.13.0';
|
|
49
|
+
|
|
50
|
+
function parts(v) {
|
|
51
|
+
var a = String(v).split('.');
|
|
52
|
+
return [parseInt(a[0], 10) || 0, parseInt(a[1], 10) || 0, parseInt(a[2], 10) || 0];
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function gte(a, b) {
|
|
56
|
+
return a[0] > b[0]
|
|
57
|
+
|| (a[0] === b[0] && a[1] > b[1])
|
|
58
|
+
|| (a[0] === b[0] && a[1] === b[1] && a[2] >= b[2]);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
var cur = parts(process.versions.node);
|
|
62
|
+
|
|
63
|
+
if (!gte(cur, parts(PARSE_FLOOR))) {
|
|
64
|
+
console.error('');
|
|
65
|
+
console.error(' \u274c anet 无法在 Node ' + process.versions.node + ' 上启动。');
|
|
66
|
+
console.error('');
|
|
67
|
+
console.error(' 它的入口是 ESM,而这个版本的 Node 连解析都做不到 —— 没有垫片的话,');
|
|
68
|
+
console.error(' 你看到的会是一屏代码加一句 SyntaxError,而真因是版本。');
|
|
69
|
+
console.error('');
|
|
70
|
+
console.error(' 升级 Node(任选其一):');
|
|
71
|
+
console.error(' nvm install 22 && nvm use 22');
|
|
72
|
+
console.error(' curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs');
|
|
73
|
+
console.error('');
|
|
74
|
+
console.error(' 然后: node -v && anet -v');
|
|
75
|
+
console.error('');
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!gte(cur, parts(SUPPORTED))) {
|
|
80
|
+
// 警告不退出 —— 与 cli.ts 的既有立场一致。走 stderr,不污染任何解析 stdout 的调用方。
|
|
81
|
+
// 2026-11-22(负责人):说人话,且只出现一次 —— 之前 `anet pair` 会在这一行之后再打一条
|
|
82
|
+
// 同义提示,用户看到两条警告。现在这一层统一负责措辞,commands 不再重复打印。
|
|
83
|
+
console.error('[anet] \u26a0\ufe0f 当前 Node v' + process.versions.node + ' 低于本包 engines 要求的 '
|
|
84
|
+
+ SUPPORTED + ' —— 建议升级到 >=' + SUPPORTED + '(nvm install ' + SUPPORTED.split('.')[0]
|
|
85
|
+
+ '),否则可能有不明确的行为差异(本次不阻断)。');
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
var path = require('path');
|
|
89
|
+
var url = require('url');
|
|
90
|
+
var entry = path.join(__dirname, 'cli.js');
|
|
91
|
+
|
|
92
|
+
// 🔴 把 argv[1] 指回真入口。cli.ts 有多处用 process.argv[1] 推自身位置
|
|
93
|
+
// (:792 resolve(argv[1])、:1094-1095 join(argv[1],'..','..')、:4445)。
|
|
94
|
+
// 不改的话 argv[1] 会变成本垫片的路径 —— 同目录,多数推导仍成立,
|
|
95
|
+
// 但"多数成立"不是"成立",直接指回去让行为逐字不变。
|
|
96
|
+
process.argv[1] = entry;
|
|
97
|
+
|
|
98
|
+
// 见上:不能写字面量 import()。
|
|
99
|
+
var dynamicImport = new Function('u', 'return import(u);');
|
|
100
|
+
dynamicImport(url.pathToFileURL(entry).href).catch(function (e) {
|
|
101
|
+
console.error('[anet] 无法加载 ' + entry);
|
|
102
|
+
console.error(e && e.stack ? e.stack : e);
|
|
103
|
+
process.exit(1);
|
|
104
|
+
});
|
package/dist/bin/cli.d.ts
CHANGED