Repository navigation
fix: probe the real pi npm copy dir + versioned specs in lane presence (#2850) - #2852
Conversation
…e presence (#2850) inspectLanePresence("pi") probed <piHome>/agent/npm/node_modules/... — an extra "agent" segment stacked on top of resolvePiHome()'s own ~/.pi/agent default — so a real pi-managed copy never resolved: `bili plugin list` showed "unknown" and doctor kept targets empty (false "materializes on next startup" hint, no stale verdict). Versioned npm specs (npm:billion-context@pinned / @latest) were additionally misrouted into the local-path branch by the exact-string PI_NPM_ENTRY match. - extract piNpmCopyRoot() in pi-channel.ts as the single source of truth for the materialization dir (now shared with isPiNpmCopy) - inspectLanePresence: match any npm:billion-context spec form, probe the real dir - updateLane(pi): route versioned specs to the pi-managed message instead of "entry points at this checkout" - regression tests: decoy copy at the old wrong path, all three spec forms, default/PI_HOME/PI_CODING_AGENT_DIR layouts, missing-copy degradation, corrupt settings probe failure, absolute-path local-path semantics, doctor verdicts
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.3162-pr.2852.670bb92This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2852.tgz
npm install -g packageInstall instructions are refreshed on each push. |
[bot] 🏷 Review 完成(本 agent 已完成工作的复核,未重做)— 结论:可合并。 核对方式:拉取分支 head 五关审查结论
本地验证(rebase 后 head):定向套件 6 个文件(plugin-list-version / doctor / update-pi-self-refresh / plugin-update / plugin-agent / launcher)405 项:404 过 / 0 挂 / 1 skip;typecheck 干净;完整 build 干净(dist-import-annotations OK)。全量回归由 CI 把关。 CI(head 结构化八问
行为变更披露(旧 → 新,PR 正文已有表格,此处重申):① 收工判定:代码、测试、CI 全绿,rebase 验证干净,无回归——可合并(合并按规矩由人工执行:https://github.com/ranxianglei/billion-context/pull/2852)。 |
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.303-master.a8d9dc3 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Closes #2850
What
bili plugin listshowedinstalled / unknownfor pi's npm-managed copy even when the copy exists on disk with a readable version, andbili doctorreported empty targets for the same lane (false "pi materializes the npm copy on next startup" hint, stale never detected).Two defects in the shared lane-presence probe (
inspectLanePresence("pi"), src/plugin-install.ts):"agent"segment ontoresolvePiHome(), whose default is already~/.pi/agent(and which honorsPI_CODING_AGENT_DIR/PI_HOME). It read<piHome>/agent/npm/node_modules/billion-contextinstead of pi's real materialization path<piHome>/npm/node_modules/billion-context(the same pathisPiNpmCopy()in src/pi-channel.ts already uses).pkgVersionAt()found nothing →unknown;targetsstayed empty.npm:billion-context.npm:billion-context@0.1.150/@latestpassisBiliPiEntry()(so status said "installed") but fell into the local-path branch, which cannot resolve an npm copy either.Fix
piNpmCopyRoot(env)in src/pi-channel.ts as the single source of truth for the materialization dir;isPiNpmCopy()now uses it too (behavior-identical refactor).inspectLanePresence("pi"): match anynpm:billion-contextspec form (/^npm:billion-context(@|$)/) and probepiNpmCopyRoot(). The spec suffix never changes the folder name; the displayed value still comes from the copy's on-diskpackage.json— never from the spec string or the running CLI version.updateLane("pi")(adjacent instance of the same mechanism): versioned npm specs previously fell through to "entry points at this checkout — rebuild the checkout"; they now get the pi-managed message like the unpinned form.Degradation semantics preserved: missing copy / corrupt manifest / no version field →
unknown; unconfigured → not installed; corrupt settings.json → probe error (doctor reports a broken probe, never a false absent); absolute-path installs keep local-path semantics. Self-refresh gating unchanged (only the unpinnednpm:billion-contextspec self-refreshes, #1196).Behavior changes (old → new)
bili plugin listpi row (npm entry)unknown(probe read a nonexistent dir)unknownonly when genuinely unresolvablebili doctorpi npm lanetargetsalways empty → false "materializes on next startup" hint; stale never detectedbili plugin update pi(versioned npm spec)pi updateupgrades it"No config surface, env var, or default changes. No
kernel/changes. Diagnostics-only code paths — no wire/persistence impact.Tests
9.9.9sits at the old wrong path; default~/.pi/agent+PI_HOMElayouts; missing copy stays unresolvable.inspectLanePresencepi npm lane (targets/copyVersion/form per spec form, decoy ignored, absent copy → empty targets, absolute-path local-path semantics, corrupt settings → probe failure) +runDoctor(stale verdict off the real version, false hint gone, hint returns only when the copy is genuinely absent).