Skip to content

refactor(packs): consume acp-kernel 0.0.66 pack layer; delete local src/packs - #404

Closed
ranxianglei wants to merge 2 commits into
masterfrom
2026-09-12_kernel-packs-401
Closed

ranxianglei wants to merge 2 commits into
masterfrom
2026-09-12_kernel-packs-401

Conversation

@ranxianglei

@ranxianglei ranxianglei commented Sep 12, 2026 •

Copy link
Copy Markdown
Owner

Status — rebased onto master (supersedes original head f0e8fcf)

The original head duplicated #403, which merged 5 seconds before this PR was opened (same base fbbeb4c, same goal). It is now rebased onto current master, which already carries the kernel-pack refactor (incl. the acp-kernel 0.0.65→0.0.66 pin and lockfile). What remains is the genuine delta below.

Changes (vs current master)

  • fix(packs): mergeSurface honors generic top-level shared sections. The merged refactor(packs): consume acp-kernel 0.0.66 pack API #403 implementation built promptSections only from adapters.pi + inline, silently dropping the shared section keys the kernel sanitizer keeps at the generic top level (acpTags/tools/summariesInContext) — a behavior regression vs pre-refactor and a contradiction of the documented merge semantics. Now: inline > adapters.pi > sanitized generic top level.
  • Restored the pre-refactor mergeSurface(PackSurface | null) signature (refactor(packs): consume acp-kernel 0.0.66 pack API #403 had changed it to Pack; call sites pass .surface).
  • Re-export kernel defaultPackSources(opts) as-is instead of a local cwd wrapper.
  • Tests (tests/prompt-pack.test.ts, now 14): ported refactor(packs): consume acp-kernel 0.0.66 pack API #403's home/cwd acp.json precedence test (with USERPROFILE override for Windows); added pi-extras sanitization coverage (bad types dropped, unknown tools dropped) that was lost when piAdapterSurface was removed; assert shared-key retention through mergeSurface.
  • Docs: CONFIGURATION.md (+zh-CN) Prompt Packs section documents the kernel-owned mechanism, the adapters.pi sub-schema (13-key tri-state promptSections, toolExtras promptSnippet/promptGuidelines, delegatePrompt), and the three-tier merge precedence; CHANGELOG entry added.

Behavior notes (documented)

  1. Pi-only section keys (tier2, whenToCompress, …) must live under adapters.pi.promptSections — the kernel sanitizer only keeps shared keys at top level and silently drops the rest. Same for pi-only tool fields: promptSnippet/promptGuidelines belong in adapters.pi.toolExtras (top-level toolPrompts keeps description + paramDescriptions only).
  2. Kernel toolPrompts no longer filters by tool name (unknown names like bash are kept in the surface); consumers read only the four ACP tools, so no functional impact.
  3. delegatePrompt is no longer a top-level pack-file field — it lives at adapters.pi.delegatePrompt.

Lean behavior is identical to before (aligned recall rules from #399/#400, null sections, tool one-liners).

Verification

  • npm ci on a clean tree installs exactly acp-kernel@0.0.66 ✅
  • npm run typecheck ✅
  • npm test ✅ (786 pass / 0 fail / 6 skip; 792 total)
  • npm run build ✅ (kernel pack code inlined in dist)

Fixes #401 (already closed by #403's merge; kept for traceability)

@github-actions

github-actions Bot commented Sep 12, 2026 •

Copy link
Copy Markdown
Contributor

📦 Built Extension Artifact

Branch: 2026-09-12_kernel-packs-401 (88b12eb)

Option A — Install from npm PR tag (recommended)

pi install npm:billion-context-pi@pr-404

Each push to this PR publishes a new version under the pr-404 npm tag.

Option B — Download artifact

  1. Download the artifact from the Actions run
  2. Extract the tarball and install:
tar xzf billion-context-pi-pr404.tgz
pi install ./package

This comment is automatically updated on each push.

…store PackSurface signature

#403 landed the kernel-pack refactor but its mergeSurface built promptSections
only from adapters.pi + inline, silently dropping the shared section keys the
kernel sanitizer keeps at the generic top level (acpTags/tools/summariesInContext)
— a behavior regression vs pre-refactor and vs the documented merge semantics.
This aligns the implementation with the intended design:

- promptSections merge: inline > adapters.pi > sanitized generic top level
- mergeSurface(PackSurface | null) signature restored (pre-refactor contract;
  #403 had changed it to Pack)
- re-export kernel defaultPackSources as-is instead of a local cwd wrapper
- tests: port home/cwd acp.json precedence test (with USERPROFILE override)
  from #403; add pi-extras sanitization coverage lost when piAdapterSurface
  was removed; assert shared-key retention through mergeSurface
@ranxianglei
ranxianglei force-pushed the 2026-09-12_kernel-packs-401 branch from f0e8fcf to 9dac793 Compare September 12, 2026 14:39
…nce; add changelog entry

CONFIGURATION.md (+zh-CN) Prompt Packs section now documents the kernel-owned
mechanism, the adapters.pi sub-schema (promptSections 13-key tri-state,
toolExtras promptSnippet/promptGuidelines, delegatePrompt), and the three-tier
merge precedence including generic top-level shared section keys. CHANGELOG
entry for the kernel-pack sink closes #401.
@ranxianglei
ranxianglei force-pushed the 2026-09-12_kernel-packs-401 branch from 9dac793 to 88b12eb Compare September 12, 2026 14:40
@ranxianglei

Copy link
Copy Markdown
Owner Author

🤖 Powered by ework · qwen3.8-27b

[bot] 🏷 PR Review #404 — rebased onto master, delta verified, ready for human merge.

Duplicate screening: this PR is a superseded-twice situation, not a clean duplicate. It shares base fbbeb4c and goal with #403, and #403 merged at 14:27:57Z — five seconds before this PR opened. The original head f0e8fcf is therefore fully superseded by master. But the two heads are not functionally identical (see bug below), so per triage rules: tagged 重复, kept open, reviewed as a follow-up delta vs current master instead of closing.

Actions taken on the PR branch (pushed as 2 commits; head is now 88b12eb):

  1. Rebased onto master (975cc43). The kernel-pack refactor + 0.0.66 pin + lockfile already landed via refactor(packs): consume acp-kernel 0.0.66 pack API #403, so the PR no longer touches package.json/package-lock.json at all.
  2. Kept this PR's src/prompt-pack.ts / src/index.ts implementation over refactor(packs): consume acp-kernel 0.0.66 pack API #403's (rationale below), ported refactor(packs): consume acp-kernel 0.0.66 pack API #403's home/cwd acp.json precedence test (incl. the Windows USERPROFILE override from e0c613f), and added one test covering pi-extras sanitization that was lost when refactor(packs): consume acp-kernel 0.0.66 pack API #403's exported piAdapterSurface was removed.
  3. Took this PR's fuller docs and corrected the CHANGELOG entry (its "bump 0.0.65→0.0.66 / hand-patched lockfile" sentences no longer apply post-rebase; test counts updated; "closes Prompt-pack module duplicated: local src/packs/* reimplements what acp-kernel 0.0.66 now ships #401" → "(Prompt-pack module duplicated: local src/packs/* reimplements what acp-kernel 0.0.66 now ships #401,由 refactor(packs): consume acp-kernel 0.0.66 pack API #403 合并关闭)" since refactor(packs): consume acp-kernel 0.0.66 pack API #403's merge already auto-closed Prompt-pack module duplicated: local src/packs/* reimplements what acp-kernel 0.0.66 now ships #401).
  4. Rewrote the PR description to describe the actual post-rebase delta.

Bug found in the merged #403 code — this is what makes the delta worth landing:

#403's mergeSurface built promptSections only from adapters.pi + inline:

promptSections: { ...pi.promptSections, ...(inline.promptSections ?? {}) }

The kernel sanitizer keeps shared section keys at the generic top level (acpTags/tools/summariesInContext — all three rendered by Pi). Those overrides were silently dropped — a behavior regression vs pre-refactor (the base fbbeb4c local implementation honored top-level sections) and a contradiction of the documented merge precedence ("inline > adapters.pi > generic top level"). This PR restores the third tier: { ...sanitizePromptSections(p.promptSections), ...pi.promptSections, ...(inline.promptSections ?? {}) }. It also restores the pre-refactor mergeSurface(PackSurface | null) signature (#403 had changed it to Pack with no consumer requiring the change) and re-exports the kernel's defaultPackSources(opts) as-is instead of shadowing it with a local cwd wrapper.

Verification (run on the pushed tree):

  • npm ci clean install → exactly acp-kernel@0.0.66; npm run typecheck ✅
  • npm test: 786 pass / 0 fail / 6 skip (792 total); tests/prompt-pack.test.ts now 14 tests, incl. an assertion that a top-level shared key (tools) survives sanitizePackSurface → mergeSurface
  • npm run build ✅ (dist 792.29 KB, kernel pack code inlined)

Final diff vs master: exactly 6 files, −42 lines net. I cannot merge — merges are human-only. Please review and merge when ready: #404


中文摘要:修复了 #403 已合并代码中 mergeSurface 静默丢弃通用顶层共享 section 键(acpTags/tools/summariesInContext)的回归(#403 只合并 adapters.pi + inline,与文档三层优先级及重构前行为都矛盾),恢复了原 PackSurface 签名与内核 defaultPackSources 原样导出,补齐 home/cwd 配置级联和 pi-extras 清洗两个缺失测试,文档与 CHANGELOG 按 rebase 后事实修正——rebase 到 master 后全部检查绿(typecheck、786 pass、build),diff 收敛为 6 文件净 −42 行,可以合并。

@ranxianglei ranxianglei mentioned this pull request Sep 13, 2026
3 tasks done
@ranxianglei

Copy link
Copy Markdown
Owner Author

队列清理 #484:核心已落 master —— f75b755 "refactor(packs): consume acp-kernel 0.0.66 pack API, drop local src/packs"(src/packs/ 已不存在,只剩 src/prompt-pack.ts 宿主壳;内核 0.0.81 pack API 齐备)。本 PR 仅剩一个未落的 docs 提交(88b12eb:adapters.pi schema 与三级合并优先级文档)——如仍需要可单独 cherry-pick 重发,不阻塞关闭。

@ranxianglei

Copy link
Copy Markdown
Owner Author

Closing as landed: the code half shipped via master f75b755 "refactor(packs): consume acp-kernel 0.0.66 pack API, drop local src/packs" (kernel 0.0.81 pack API now consumed by src/prompt-pack.ts). The only unlanded delta is docs commit 88b12eb (adapters.pi schema notes) — worth replaying as a standalone docs PR if still wanted. (Triage #484.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Prompt-pack module duplicated: local src/packs/* reimplements what acp-kernel 0.0.66 now ships

1 participant