Repository navigation
[PR] refactor: extract prepare*/inject* pipelines into src/server/ (#1440) - #1449
ranxianglei wants to merge 1 commit into
Conversation
…*.ts + inject.ts (#1440)
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)npm install -g billion-context@pr-1449Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf billion-context-pr1449.tgz
npm install -g packageInstall instructions are refreshed on each push. |
Review: #1449 (cut 2 of the #1440 disassembly — prepare*/inject* extract)Verdict: ✅ mergeable. Branch is fresh — single commit ① DirectionSound continuation of the #1440 plan: pure-move is the right strategy for this hot file, and it follows the pattern cut 1 established ( Purity — independently re-verified (not taken on faith)I ran my own two-directional, line-level mechanical check against
② Regression review — existing behaviors on touched paths
Both compression modes reasoned about: the move touches neither mode's carrier path differently — plugin-mode suppression and proxy-mode Pre-flight (local, on
|
|
(ai: zhipuai-lb/glm-5.3) 孤儿票清理:标题指向的 issue 已关闭,修复已由其他路径落地。关单;误判请 reopen。 |
What
Second cut of the #1440 server.ts disassembly plan. Moves the per-wire prepare pipelines (request-body → Prepared) and the inject helpers out of
src/server.tsinto six new files undersrc/server/:prepare-shared.tsPreparedtype + shared helpers (imageBillingFor,withReasoningDrop,effectiveTokenCount,effectiveAbsorbBlock,reapOrphansLogged,stripKernelSummaries, …)prepare-anthropic.tsprepareAnthropic,prepareCountTokens, Anthropic reasoning-pair warningprepare-openai.tsprepareOpenai, OpenAI warn helpers, wiredrop warn cluster (WARNED_WIREDROP_KEY_CAP,_resetWireDropWarningsForTest)prepare-google.tsprepareGoogle,prepareGoogleCountTokensprepare-responses.tsprepareResponses,prepareResponsesCompact,repairResponsesAssistantOrdering,resolvePromptCacheKey,shouldInjectPromptCacheKey,FORCE_TEXT_PROTOCOLinject.tsinjectTool(+ its shared injection plumbing)Discipline
exportkeywords where cross-file use requires it, single-quote specifier rewrites in the new files' own import blocks, and the test-import updates below.codex-official,count-tokens,fix-1205-file-parts,issue564-responses-ordering,reasoning-echo) — import lines only.Behavior change disclosure
_wireDropWarnSetForTest()(mastersrc/server.ts:142-144) had zero references beyond its definition (audit item P4; also slated for removal by PR refactor: drop dead declarations + demote internal-only exports + unused-export gate (#1440) #1443). Overlap is trivially resolvable at merge time.Verification (rebased head)
npm run typecheck— cleannpm test— 2839 pass / 0 fail / 12 skip (identical to master baseline)npm run build— success, import annotations OKRefs #1440