Skip to content

v0.10.6 — anet upgrade Option B + batch wizard inquirer fix

Choose a tag to compare

@s2agi s2agi released this 17 May 06:08
· 348 commits to main since this release

v0.10.6 — anet upgrade Option B + batch wizard inquirer fix (Vincent 5489+5493)

Patch ship: 2 P0 fixes in agent-network CLI — anet upgrade 默认 detached spawn (再不需要 --self), anet create --batch wizard 在 workdir mode 选择后不再 silent exit。

Released versions (npm latest tag):

  • @sleep2agi/agent-network@2.2.5 ← bumped (CLI upgrade + wizard fixes)
  • @sleep2agi/agent-node@2.4.2 (unchanged, v0.10.3)
  • @sleep2agi/commhub-server@0.8.2 (unchanged)
  • @sleep2agi/agent-network-dashboard@0.5.2 (unchanged, v0.10.4)

Install (first-time users)

npm install -g @sleep2agi/agent-network
anet hub start
anet hub dashboard
anet create --batch      # wizard 5 步走通, prefix/count 输入后真创节点
anet upgrade             # 下次有新版本时自动 detached spawn 升级

Upgrade (existing users — IMPORTANT one-time manual step)

⚠️ Chicken-and-egg note — Option B anet upgrade 自动 detached spawn 修复在 2.2.5+ binary 里, 你当前 2.2.2 / 2.2.3 / 2.2.4 binary 是 npm 上 frozen 的旧逻辑, 跑 anet upgrade 还会显示旧的 "skipped (would replace running CLI)" 行为。

只需一次手装升到 2.2.5+:

npm install -g @sleep2agi/agent-network@2.2.5
anet --version           # 期望 v2.2.5

之后再有新版本 (e.g. 2.2.6+), 直接跑 anet upgrade 就会自动 detached spawn, 不再手装。

Fixed in this patch

#154anet upgrade Option B detached spawn 默认开启

Vincent 5489+5490 实测 catch (v0.10.4 #151 Option A verbiage fix 不够, chicken-and-egg deadlock 仍在):

$ anet upgrade
Plan:
  anet (self)         2.2.2  →  2.2.4
anet (self): skipped (would replace the running CLI).    ← ❌ 误导, 用户以为成功
[anet] Done. 0 upgraded, 2 up-to-date, 1 lazy.

Root cause: Node 进程无法 in-place 替换自己的 binary。先前 v0.10.4 Option A 仅改了文案 ("⚠️ NEEDS MANUAL UPGRADE"), 但 chicken-and-egg 没解 — 用户在旧 binary 上仍看老逻辑。

Implementation (bin/cli.ts:3873-3874):

const child = spawn(forkScript, [], { stdio: "inherit", detached: true });
child.unref();
// 主进程 process.exit(0), detached child 继续跑 npm install

用户体验:

  • 之前: anet upgrade 跑完 print "Done" 但 anet binary 没变, 用户困惑
  • 现在: anet upgrade 自动 spawn detached npm install, 主进程 exit, 一两分钟后 anet --version 已是新版

#155anet create --batch wizard silent exit fix

Vincent 5493 实测 catch:

$ anet create --batch
✔️ 选择供应商: Codex / GPT
✔️ 选择 model: gpt-5.5
Workdir [/home/vansin/anet-team]: ~/design
✔️ 工作目录模式: shared
Node prefix (e.g. 工程师) [工程师]: $       ← ❌ wizard silent exit here
$

Vincent: "下面的步骤呢? 名字前缀 和 个数,你都不做测试的吗? 我佛了,这次做足测试再来吧"

Root cause: 在 inquirer select() (workdir mode 选择) 之后, process.stdin 状态变化, readline-based ask() helper 在 EOF 立即 return, 整个 wizard 静默退出。这是 #137 (v0.9.2 preview.5 anet create regression) 的同根问题, 不同代码路径再发。

Implementation (bin/cli.ts:6516-6536):

// 4. Prefix + count — #155 (Vincent 5493 hit wizard exit here)
//
// After the inquirer select() prompt for workdir mode (above), @inquirer/
// prompts leaves process.stdin in a state where the readline-based ask()
// returns immediately at EOF and the process silently exits — the EXACT
// same #137 (preview.5) pattern. The fix is to use inquirer input() for
// all post-select prompts so stdin handling stays uniform with the select
// that came before.
const { input: inquirerInput } = await import("@inquirer/prompts");
prefix = opts.prefix || (await inquirerInput({
  message: "Node prefix (e.g. 工程师)",
  default: "工程师",
})).trim() || "工程师";
countStr = opts.count || (await inquirerInput({
  message: "Count (1-50)",
  default: "5",
})).trim() || "5";

Backward compat: catch fallback 保留 legacy ask() for non-TTY / 无 inquirer 环境 (CI / scripted)。

Quality gates

Gate Owner Method Result
#154 source code-path 通信龙 grep bin/cli.ts:3873-3874 detached: true + unref() ✅ PASS
#155 source code-path 通信龙 grep bin/cli.ts:6516-6536 inquirerInput + fix comment ✅ PASS
Methodology limit catch 通信测试马 Plan B (--self short-circuit) + Docker iter 暴露 dist obfuscation 🎓 lesson banked
Method B 2-phase promote 通信工程马 npm publish --tag preview → 60s CDN → dist-tag latest → docker smoke ✅ TBD

Lesson banked (feedback_dist_obfuscated_use_source_grep): dist/bin/cli.js 是 esbuild bundled + obfuscated (rotating string-table, identifiers mangled, string literals encoded), static grep 对 dist 完全失效。Code-path 验证一律 grep bin/cli.ts source (HEAD = preview build source)。

Cross-version compat

Path Result
老 binary (2.2.2/2.2.3/2.2.4) anet upgrade ⚠️ 沿用旧 Option A 行为 (frozen on npm), 用户需手装 1 次
2.2.5+ anet upgrade (有更新 target) ✅ 自动 detached spawn, exit 主进程, npm install 后台跑
2.2.5+ anet upgrade (已是 latest) ✅ short-circuit "up to date", 不 spawn
2.2.5+ anet create --batch interactive ✅ wizard 5 步走通 (vendor / model / workdir base / workdir mode / prefix / count), 无 silent exit
2.2.5+ anet create --batch --prefix X --count N flags ✅ flag 仍 works, 跳 prompt, 无回归
非 TTY (CI) anet create --batch ✅ catch fallback to legacy ask(), 仍工作
agent-node / commhub-server / dashboard ✅ 不变, 0 schema change

Cycle 11 stats

  • 16 cumulative @latest publishes (v0.9.0 → v0.10.6): 0 split-brain / 0 rollback / 0 retry
  • v0.10.x today (5月17日): v0.10.1 + v0.10.2 + v0.10.3 + v0.10.4 + v0.10.5 + v0.10.6 = 6 ships in ~9 hours (audit-first cadence)
  • 9 Vincent telegram catch today (5444→5493): 全闭环 (R697 + #149/#150/#151/#152/#153/#154/#155 + 红线 SOP)

Lessons saved this cycle

  • feedback_no_skip_smoke_gate (Vincent 5493) — 紧急 trust path SUSPENDED, Docker smoke gate 永不跳
  • feedback_no_host_test_nodes (Vincent 5499-5502) — 红线: 测试节点全 Docker, 不许 connect 本机 hub
  • feedback_pat_label_scope (Update) — gh CLI fallback to fine-grained PAT (无 issues:write), curl REST + classic PAT bypass
  • feedback_dist_obfuscated_use_source_grep (本 cycle 新增) — dist bundle obfuscated, code-path verify 用 source 不用 dist

Author: 通信龙 (lead, source-grep verify) · SDK马 (#154 + #155 fold) · 通信工程马 (promote) · 通信测试马 (methodology catch + dist obfuscation expose) · Vincent (catch 5489+5490+5493+5499-5502)