Repository navigation
refactor(server): unify injectTool/injectOpenaiTool/injectResponsesTool over one owned-name merge core (#1440 P3) - #2307
Conversation
📦 Built Package ArtifactBranch: Option A — Install this exact build (recommended)npm install -g billion-context@0.0.2478-pr.2307.824d049This exact version is immutable and reproducible. The rolling Option B — Download artifact
tar xzf billion-context-pr2307.tgz
npm install -g packageInstall instructions are refreshed on each push. |
…dex (#1443 residue) In-passing gate fix during #2307 review: the unused-export check fails on master itself (INTERNAL_ONLY src/launcher.ts: codexRewriteInsertionIndex), blocking every PR's unused-exports job. The function is used only inside launcher.ts (:980); the export keyword is dead surface left by the #1443 cleanup pass. One-word removal; no behavior, wire, or cache impact.
[bot] 🏷 Review 完成:等价论证逐条成立,本地验证全绿;唯一红检查是 master 既有缺陷,已按「小问题直接修」政策顺手修掉(独立标注 commit)。CI 在新 head 上重跑中。 核对过的范围:diff 仅 结构化七问
判定:CI 全绿后可合(人工合并)。gate 修复 commit 已推,CI 正在 |
…ol over one owned-name merge core (#1440 P3)
8127261 to
6e71ed5
Compare
📦 Merged Build PublishedThis merge to master was published as npm install -g billion-context@0.0.110-master.608e611 # this exact build
npm install -g billion-context@master # always the newest merged build
|
Issue #1440 P3 — collapse the three flat-shape tool-injection copies in
src/server.ts(injectTool/injectOpenaiTool/injectResponsesTool) into one shared private core. Behavior-preserving: zero call-site changes, signatures unchanged, wire bytes unchanged.What
New module-private generic:
owns the algorithm once: wanted = acp ∪ extras; drop input entries whose name hits wanted; return
[...kept, ...acp, ...extras]. The three wrappers become single-expression delegators pinned by explicit type args (mergeOwnedTools<unknown>/mergeOwnedTools<OpenAITool>) withnameOfcallbacks that are the exact accessors the originals used ((t as { name?: string })?.name/t?.function?.name) — noany, no inference risk.ccrOn ? BILI_ACP_TOOLS_ANTHROPIC : …_NO_RANGE) stays on each wrapper, with its [Bug] OMP plugin: empty optional decompress range fields cause failures and unsupported-range retries #1712/[Feature] CCR v2: message-ID coverage in block summaries, range-level decompress, ID-returning search_context #1179 note intact.injectGoogleTooldeliberately untouched — different algorithm, not just a different accessor: Gemini nests declarations one level deeper (tools[].functionDeclarations[]), collects presence across every entry, appends missing declarations as ONE new entry, and returns the original array reference when nothing is missing (identity is load-bearing downstream). The core structurally cannot express both the ownership-dropping path Google must avoid and that identity behavior.Equivalence argument (case-by-case, per wrapper)
[...acp, ...extras]in both (responses:[...acp]≙ old[...base]). Buildingownedfirst is pure — no side effects ⇒ same result either order.typeof n === "string"guard only filters non-string acp/extras names, which the realBILI_ACP_TOOLS_*constants never produce (applyAcpToolOverridespasses them through by reference); and a non-string-named input entry is kept regardless of set membership in BOTH versions.filter, append order acp→extras preserved.T; call sites are internal — no widening possible.Net diff:
src/server.ts+22/−27, lines ~5114–5181 only; zero caller lines appear in the diff (verified at :3887 anthropic, :4137 openai, :4699 responses). No exports added/removed (core is module-private → the #1443 unused-export gate unaffected).Verification
npx tsc --noEmitclean · tsup build OKRebase note (master moved past v0.1.187: #2167 external-summary executor et al.)
Rebased onto
95ad8d25and resolved two small conflicts inside the inject zone: master's #2167 added anexternalOnparameter +withExternalSummaryTools()wrapping toinjectTool/injectOpenaiTool/injectResponsesTool(and Google). The wrappers keep master's signatures/wrapping verbatim and the delegations stay one-liners on top ofmergeOwnedTools. No behavioral delta introduced by the resolution — same algorithm, same order, master's new args flow straight through to the core.Second commit: one-line gate fix (
PiSubagentChildSignaldemoted) — master's ownunused-exportsjob has been red since #2268 landed (verified on tip); this repo's established pattern for exactly this situation is a mechanical demote commit (cf.371b15b5). Kept separate so it can be cherry-picked/dropped independently. After it runs, the merge ref passes the gate clean (locally verified:✓ unused-export gate: clean (3 waived)).Re: patrol fix
81272616("drop stray export codexRewriteInsertionIndex") that landed on the branch meanwhile: subsumed — that symbol is already demoted on master itself (371b15b5); the flag only appeared because the branch still stood on the pre-release base at patrol time. Dropped from the branch by this force-push, effect retained via master.Re-verified after rebase: gate exit 0 · tsc clean · tsup OK · wire-contract 15/15 · pi-subagent-channel 28/28 incl. · web-ptools-position 2/2 · external-summary{,-runtime,-batch} 45/45 · lane-guard keywords absent from diff.