Repository navigation
feat: inline billion-context-pi-subagents into the pi lane (#2186) - #2221
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2293-pr.2221.ea9d610This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2221.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 收到,正在按 PR Review 规范审 #2221(feat: inline pi-subagents into the pi lane)。 已确认 PR 元数据:head 我会重点过:①原 issue #2186 方向是否对;②既有行为回归清单(pi.ts 双宿主工厂、omp lane、stand-down parity、零依赖契约);③embedder 契约 claim-before-check 逻辑与 marker 竞态;④测试有效性;⑤diff 整洁度。结论稍后按结构化七问给出。 |
[bot] 🏷 Review of #2221 (feat: inline pi-subagents into the pi lane). Headline: the CI regression you hit is already fixed by your follow-up Verified hands-on at current head The #2072 regression (root cause, matches your fix): that test's Remaining items (only ① needs action before merge): ① Behavior change — must be stated (Deliverables rule 4; §7.4 default-value = product decision). By default (no ② Minor (body line 16): "No new env vars… knobs stay the package's own ③ Minor (body line 22): "only ④ Optional test nit ( Structured seven questions:
判定:阻塞性 CI 回归已由 |
Wire the acp_delegate sub-agent surface (tools + /acp-fleet command +
fleet shortcut + status widget + read tracking + prompt append) into the
native pi extension via the package's embedder contract: markEmbedded()
claim, manual building-block wiring, tsup noExternal inlining, and an
esbuild alias stub for @earendil-works/pi-coding-agent so the package's
only value import (CONFIG_DIR_NAME) falls back to the documented ".pi".
- agent-gated (pi only; omp lane untouched), single-writer vs a
standalone billion-context-pi-subagents install
- devDeps pinned exact: billion-context-pi-subagents 0.1.1,
@earendil-works/{pi-coding-agent,pi-tui} 0.83.0 (typecheck-only)
- dist/index.js + dist/mcp.js import graph unchanged (zero-dep contract)
Real pi awaits an ARRAY of handlers per event per extension (pi-coding-agent@0.83.0 runner.js emit(): handlers.get(type) then for..of) — the Map-of-single-handler fake silently replaced the factory's session_start handler with the embedded subagents wiring's, so acp_cache never registered and the e2e timed out. The fake now appends, and the two fire-sites await every registered handler.
c793ed5 to
3e51990
Compare
…ent fake (#2186) Same single-slot shadowing defect the issue2072 fake just got fixed for: this fake also drops every but the last handler per event, so the wiring's third session_start registration silently disables registerTools. Composed in place (rather than array-ified) because this file has ~20 fire-sites.
#2186) The old fleet-policy test never invoked the captured handler (fake did not store options); it now drives the handler with delegate.enabled=false and asserts the notification. Adds the project-scope pi-subagents overlap stand-down case (tools unregistered + one warning toast).
…ilently (#2186) A broken acp.json previously fell back to defaults with zero diagnostics; the standalone package logs this via logThrow but bili's lane has no such channel — console.error matches the agent-module house style.
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.62-master.33ce0f8 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #2186
What
bili pi(the native pi extension,dist/agent/pi.js) now ships the acp_delegate sub-agent surface natively:acp_delegate/acp_delegate_wait/acp_delegate_canceltools, the/acp-fleetinspector command, the fleet shortcut, the delegate status widget, read-tracking, and the system-prompt append. This is the "自带拆分 subagents 内置" ask from #612 (billion-context-pi): users of the bili pi lane get sub-agents without installing anything else.Implementation follows the package's documented embedder contract: the standalone factory and an embedder are mutually exclusive (
isEmbedded()), so bili claims theacp-delegate.embeddedmarker (check-before-claim) and wires the building blocks itself:src/agent/pi-subagents.ts—wirePiSubagents(pi, agent)gated toagent === "pi"only (omp lane reuses the factory but must NOT get the delegate surface — same reasonpi.tsis a dual-host factory). Claims the marker so a concurrently installed standalonebillion-context-pi-subagentsextension stands down instead of double-registering.tsup.config.ts—noExternal: ["billion-context-pi-subagents"]inlines the package intodist/agent/pi.js; an esbuild alias maps the package's ONLY value import@earendil-works/pi-coding-agent(readsCONFIG_DIR_NAME) to an empty stub (src/agent/pi-host-stub.ts), exercising the package's documented.pifallback. Result: zero new runtime imports in any dist artifact.src/agent/pi.ts— optionalsendUserMessage/registerShortcuton the localExtensionAPIsurface (guarded calls; absent on omp hosts), plus the wiring call at factory tail.~/.pi/acp.json+<cwd>/.pi/acp.json).Config surface
No new bili config fields, env vars, or CLI flags. The delegate's knobs stay the package's own
acp.jsonsurface (read by the package'sloadSubagentsUserConfig), deliberately NOT mirrored into~/.config/billion-context/billion-context.json— the embedded surface is configure-where-the-package-documents-it, no second shape invented (#1437 discipline).Dependencies
billion-context-pi-subagentsdevDep pinned exact0.1.1(acp-kernel pin discipline — it is bundled at build time). 0.1.1 shipped specifically for this: it exportsloadSubagentsUserConfig+isEmbedded(package PR fix: address all code review findings (condense, routing, session-id, dead code) #2 / release PR feat: OpenAI Responses API support (/v1/responses) #4).@earendil-works/pi-coding-agent+@earendil-works/pi-tui0.83.0exact: typecheck-only (d.ts resolution), erased by esbuild — no runtime reach.dist/index.jsanddist/mcp.jscontain 0 references to the package or its imports; onlydist/agent/pi.jsgrows (the only@earendil-worksstrings left in dist are pre-existing pi-CLI path constants, not imports).Tests
tests/pi-subagents-wiring.test.ts(8 tests, hermetic, HOME redirected): agent gate (omp never claims), marker claim + stand-down of a second embedder, full registration atsession_start(3 tools + command + shortcut), host withoutbuildContextEntriesgets command but no tools,before_agent_startprompt append (string + array shapes),tool_resultread/bash dispatch incl. isError skip,session_shutdownno-crash, policy gate on the fleet command.tests/dsh-native.test.ts(15s apply() timeouts that reproduce identically on clean master — environmental spawn/network timing, unrelated to this change; no dsh file is touched). CI runs the full ubuntu+windows matrix.Cross-repo
Package side already live:
billion-context-pi-subagents@0.1.1on npm (registry-resolved lockfile, no local paths). billion-context-pi keeps its own richer extension (fleet UI upstream); this lane embeds a pinned snapshot, same model as the acp-kernel inline.