feat: surface-text override layer (prompt sections + tool descriptions) - #169
feat: surface-text override layer (prompt sections + tool descriptions)#169ranxianglei wants to merge 1 commit into
Conversation
New src/surface-config.ts implements the kernel's prompt/tool surface customization layer (DESIGN-prompts.md Layer 1): - applySectionOverrides: tri-state per standing-prompt section (string = replace, null = remove, omitted = default) - buildCompressSystemPrompt / buildCompressTextSystemPrompt / buildCompressHybridSystemPrompt accept an optional CompressPromptSections second argument - cloneWithDescriptions: deep-clones a JSON tool schema and replaces parameter descriptions by property name at any nesting depth - applyAcpToolOverrides: per-tool description + paramDescriptions for all three wire shapes (anthropic / openai / responses) Defaults are byte-identical to 0.0.46 (fixture regression tests against the published dist output). Surface text is presentation-only, so no risk gate — load-bearing rules stay in resolvePrompts. 16 new tests; full suite 556 pass.
📦 Built Package ArtifactBranch: Option A — Install from npm PR tag (recommended)In your adapter project: npm install acp-kernel@pr-169Each push to this PR publishes a new version under the Option B — Download artifact
tar xzf acp-kernel-pr169.tgz
npm install ./packageThis comment is automatically updated on each push. |
[bot] Review of PR #169 ( Verification (all performed on this clone, branch
|
What
Implements DESIGN-prompts.md Layer 1 — the prompt/tool surface customization layer that both adapters (billion-context-pi, billion-context) need for their config-driven prompt customization (ranxianglei/billion-context-pi#252).
New
src/surface-config.ts, exported from the barrel:applySectionOverrides(sections, overrides?)stringreplaces (header + body),nullremoves, omitted keeps default; unknown keys ignoredbuildCompressSystemPrompt(prompts?, sections?)(+ text/hybrid variants)CompressPromptSectionssecond arg (keys:acpTags,tools,summariesInContext,textProtocol,textTools,functionTools)cloneWithDescriptions(schema, paramDescriptions)descriptionof every property whose name matches, at any nesting depth; input never mutatedapplyAcpToolOverrides(tools, overrides?)description+paramDescriptionsacross all three wire shapes (anthropicinput_schema, openaifunction.parameters, responses flatparameters); shared constants never mutatedDesign decisions
Promptsrules stay behindresolvePrompts+acknowledgeRisk.compress(...)/run acp_status. Only human-readable text moves; schema names/structure are fixed.applyAcpToolOverrideswithout overrides copies the array but passes tool references through.Verification
tests/fixtures/, generated from the npm package): function 7,681 / text 7,589 / hybrid 7,172 bytes.tests/surface-config.test.ts(section replace/remove, cross-builder key ignoring, nested param descriptions, no-mutation proofs, all 3 wire shapes).npm run typecheck✅ ·npm test556/556 ✅ (was 540) ·npm run build✅Notes
npm run format:checkfails on 91 files on clean master (prettier 3.9.6 drift); CI does not gate on it, left untouched to keep this PR focused.