Skip to content

refactor(packs): consume acp-kernel 0.0.66 pack API - #403

Merged
ranxianglei merged 2 commits into
masterfrom
2026-09-13_kernel-packs
Sep 12, 2026
Merged

ranxianglei merged 2 commits into
masterfrom
2026-09-13_kernel-packs

Conversation

@ranxianglei

Copy link
Copy Markdown
Owner

Fixes #401 (supersedes closed #402 — that PR was closed by a branch rename; identical content plus a cross-platform test fix)

What

Migrates the adapter onto the kernel's pack layer so the mechanism has one source of truth (matching billion-context #729/#730, which already consumes the kernel API).

  • src/packs/{types,sanitize,lean,builtin,dir}.ts deleted — replaced by acp-kernel 0.0.66 exports (Pack/PackSource/PackResolver, sanitizePackSurface, builtin registry with default+lean, createDirPackSource, defaultPackSources)
  • src/prompt-pack.ts rewritten on kernel exports; consumers unchanged (mergeSurface/readToolSurfaceWithPacks/resolveActivePack; src/index.ts call sites pass Pack instead of pack.surface)
  • pi-specific data (PiPromptSections tri-state sections, per-tool prompt snippet/guidelines, delegatePrompt) rides in surface.adapters.pi — opaque to the kernel, sanitized adapter-side (piAdapterSurface)
  • source chain identical: project .pi/acp/packs > user ~/.pi/acp/packs > builtin; filename-is-identity semantics from the kernel
  • lean assertions now target kernel leanPack.adapters.pi, including the aligned recall rules (Post-compress search bounce: lean pack promotes search_context to routine recall #399/fix(packs): lean recall rules aligned with pre-lean semantics #400)
  • acp-kernel exact pin bumped 0.0.65 → 0.0.66

CI fixes vs #402

  • branch renamed to 2026-09-13_kernel-packs (pr-validation requires YYYY-MM-DD_short-title)
  • readToolSurfaceWithPacks precedence test now overrides both HOME and USERPROFILE (os.homedir() resolves USERPROFILE on Windows — that was the windows-24 failure)

Verification

  • npm run typecheck clean · npm test 789 pass / 0 fail / 3 skipped (skips pre-existing) · npm run build green
  • runtime smoke: lean resolves via kernel builtin, 4 tools with cleared snippets, aligned rules present

awork added 2 commits September 12, 2026 22:18
…acks

Fixes #401

- src/packs/* deleted (229 lines): types/sanitize/lean/builtin/dir all
  live in the kernel now (acp-kernel #259/#260, v0.0.66)
- src/prompt-pack.ts rewritten on kernel exports; external surface
  (packResolver/resolveActivePack/mergeSurface/readToolSurfaceWithPacks)
  unchanged
- pi-specific surface (PiPromptSections tri-state, tool extras,
  delegatePrompt) read from surface.adapters.pi and sanitized adapter-side;
  kernel treats it as opaque data
- lean assertions moved to kernel leanPack.adapters.pi (aligned recall
  rules from #399/#400)
- acp-kernel pinned 0.0.65 -> 0.0.66 (exact)
- 792 tests: 789 pass / 0 fail / 3 skipped (pre-existing); typecheck+build green
@github-actions

Copy link
Copy Markdown
Contributor

📦 Built Extension Artifact

Branch: 2026-09-13_kernel-packs (e0c613f)

Option A — Install from npm PR tag (recommended)

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

Each push to this PR publishes a new version under the pr-403 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-pr403.tgz
pi install ./package

This comment is automatically updated on each push.

@ranxianglei
ranxianglei merged commit 975cc43 into master Sep 12, 2026
9 checks passed
ranxianglei pushed a commit that referenced this pull request Sep 12, 2026
…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
HangxiangMa pushed a commit to HangxiangMa/billion-context-pi that referenced this pull request Sep 21, 2026
…-packs

refactor(packs): consume acp-kernel 0.0.66 pack API
ranxianglei added a commit that referenced this pull request Sep 25, 2026
… acp-kernel 0.0.90 (#540, #535 go-live)

- #540: compress receipts and the tier3-only rewrite selected 'new' blocks
  with slice(-blocksCreated); an in-place refold keeps its original array
  position, so refolding b1 of [b1,b2,b3] presented b3's stale summary as
  the new one. Selection now diffs before/after runIds (every applyCompression
  assigns a fresh runId to created AND refolded blocks) — exact for both
  shapes. Regression test: two blocks, inline-restore the non-tail b1,
  re-compress its span, assert span clause + fingerprint line reference b1's
  NEW summary, b2 untouched, still exactly two persisted blocks.
- pin acp-kernel 0.0.86 -> 0.0.90 (real install, overlay retired): ships
  refold-in-place (kernel #403) + full-log resolving (#400), making #535 P2
  live end-to-end.
- viable-ranges test now feeds well-formed CoreMessages: 0.0.90's syncBlocks
  (subid coverage, kernel #233) dereferences message.id via baseIdOf and
  throws on id-less host-shaped entries where 0.0.86 silently tolerated them
  (kernel-side guard filed separately).

Gates: typecheck ✓ · 944 tests / 941 pass / 0 fail / 3 skipped · build ✓

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

Labels

None yet

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