pi-smart-compact 8.0.8 → 9.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/ARCHITECTURE.md +47 -37
  2. package/CHANGELOG.md +28 -2
  3. package/README.md +52 -30
  4. package/SECURITY.md +1 -1
  5. package/dist/app/native-continuity-bridge.d.ts.map +1 -1
  6. package/dist/app/preflight.d.ts +2 -1
  7. package/dist/app/preflight.d.ts.map +1 -1
  8. package/dist/app/run-context.d.ts +10 -10
  9. package/dist/app/run-context.d.ts.map +1 -1
  10. package/dist/app/run-smart-compact.d.ts +18 -2
  11. package/dist/app/run-smart-compact.d.ts.map +1 -1
  12. package/dist/app/smart-compact-input.d.ts +23 -0
  13. package/dist/app/smart-compact-input.d.ts.map +1 -0
  14. package/dist/app/steps/extract.d.ts.map +1 -1
  15. package/dist/app/steps/metrics.d.ts.map +1 -1
  16. package/dist/app/steps/persist.d.ts +2 -3
  17. package/dist/app/steps/persist.d.ts.map +1 -1
  18. package/dist/app/steps/prepare.d.ts +4 -6
  19. package/dist/app/steps/prepare.d.ts.map +1 -1
  20. package/dist/app/steps/recover.d.ts +1 -1
  21. package/dist/app/steps/recover.d.ts.map +1 -1
  22. package/dist/app/steps/state.d.ts.map +1 -1
  23. package/dist/app/steps/synthesize.d.ts.map +1 -1
  24. package/dist/app/steps/verify.d.ts.map +1 -1
  25. package/dist/app/steps/window.d.ts +5 -1
  26. package/dist/app/steps/window.d.ts.map +1 -1
  27. package/dist/constants.d.ts +21 -4
  28. package/dist/constants.d.ts.map +1 -1
  29. package/dist/domain/scrub.d.ts.map +1 -1
  30. package/dist/domain/summary-parse.d.ts +1 -1
  31. package/dist/domain/summary-parse.d.ts.map +1 -1
  32. package/dist/domain/summary-schema.d.ts +1 -1
  33. package/dist/domain/summary-schema.d.ts.map +1 -1
  34. package/dist/domain/tool-semantics.d.ts +9 -0
  35. package/dist/domain/tool-semantics.d.ts.map +1 -1
  36. package/dist/index.d.ts.map +1 -1
  37. package/dist/index.js +2082 -1128
  38. package/dist/infra/context-graph.d.ts.map +1 -1
  39. package/dist/infra/fs.d.ts +11 -15
  40. package/dist/infra/fs.d.ts.map +1 -1
  41. package/dist/infra/git.d.ts +5 -11
  42. package/dist/infra/git.d.ts.map +1 -1
  43. package/dist/infra/llm-client.d.ts +2 -0
  44. package/dist/infra/llm-client.d.ts.map +1 -1
  45. package/dist/infra/paths.d.ts +4 -2
  46. package/dist/infra/paths.d.ts.map +1 -1
  47. package/dist/infra/session-identity.d.ts +11 -0
  48. package/dist/infra/session-identity.d.ts.map +1 -1
  49. package/dist/infra/synthesis-cache.d.ts.map +1 -1
  50. package/dist/phases/explore.d.ts.map +1 -1
  51. package/dist/phases/synthesize.d.ts +4 -1
  52. package/dist/phases/synthesize.d.ts.map +1 -1
  53. package/dist/phases/verify.d.ts +10 -3
  54. package/dist/phases/verify.d.ts.map +1 -1
  55. package/dist/provider-eval.js +113 -43
  56. package/dist/provider-scenario-eval.js +206 -53
  57. package/dist/telemetry-report.js +113 -43
  58. package/dist/types.d.ts +45 -0
  59. package/dist/types.d.ts.map +1 -1
  60. package/dist/ui/overlays.d.ts +2 -1
  61. package/dist/ui/overlays.d.ts.map +1 -1
  62. package/dist/utils/backups.d.ts +31 -0
  63. package/dist/utils/backups.d.ts.map +1 -0
  64. package/dist/utils/cache.d.ts +1 -0
  65. package/dist/utils/cache.d.ts.map +1 -1
  66. package/dist/utils/damage.d.ts.map +1 -1
  67. package/dist/utils/extraction.d.ts +6 -0
  68. package/dist/utils/extraction.d.ts.map +1 -1
  69. package/dist/utils/fingerprint.d.ts +5 -1
  70. package/dist/utils/fingerprint.d.ts.map +1 -1
  71. package/dist/utils/helpers.d.ts +1 -35
  72. package/dist/utils/helpers.d.ts.map +1 -1
  73. package/dist/utils/pruning.d.ts.map +1 -1
  74. package/dist/utils/session-log.d.ts +10 -18
  75. package/dist/utils/session-log.d.ts.map +1 -1
  76. package/dist/utils/state.d.ts +2 -2
  77. package/dist/utils/state.d.ts.map +1 -1
  78. package/package.json +2 -2
package/ARCHITECTURE.md CHANGED
@@ -60,14 +60,14 @@ threads a typed context through ten stages:
60
60
 
61
61
  | # | Stage | Module | Transition |
62
62
  | ---: | --- | --- | --- |
63
- | 1 | prepare | `app/steps/prepare.ts` | config + auth + provider caps |
64
- | 2 | window | `app/steps/window.ts` | pick the prefix to compact |
63
+ | 1 | prepare | `app/steps/prepare.ts` | config + provider caps + budgets; auth remains lazy |
64
+ | 2 | window | `app/steps/window.ts` | pick the prefix using a calibrated final-summary allowance |
65
65
  | 3 | recover | `app/steps/recover.ts` | restore log-truncated messages |
66
66
  | 4 | tier | `app/steps/tier.ts` | choose none / light / full |
67
67
  | 5 | extract | `app/steps/extract.ts` | prune + deterministic extraction + cache |
68
68
  | 6 | synthesize | `app/steps/synthesize.ts` | single-pass or EESV |
69
- | 7 | verify | `app/steps/verify.ts` | structural verify + repair |
70
- | 8 | state | `app/steps/state.ts` + `domain/yield-gate.ts` | state/open loops/delta + final yield proof |
69
+ | 7 | verify | `app/steps/verify.ts` | structural verify + repair; high-risk outcomes require successful tool evidence |
70
+ | 8 | state | `app/steps/state.ts` + `domain/yield-gate.ts` | state/open loops/resolved history/delta + final yield proof |
71
71
  | 9 | persist | `app/steps/persist.ts` | stage pending, apply compaction |
72
72
  | 10 | metrics | `app/steps/metrics.ts` | success / failure record |
73
73
 
@@ -120,8 +120,9 @@ pressure and deterministic extraction risk.
120
120
  Model routes are stage-specific but never inferred from mode. With no explicit
121
121
  configuration, Explore, Synthesize, and Verify all use the selected Pi model.
122
122
  `segmentationModel`, `summaryModel`, and `verificationModel` can independently
123
- override those routes. `prepareRun()` resolves credentials once per distinct
124
- provider/model route; call metrics preserve the actual route.
123
+ override those routes. Credentials resolve lazily immediately before each
124
+ stage's first network call and are reused for equivalent routes; call metrics
125
+ preserve the actual route.
125
126
 
126
127
  ### Keep window and preprocessing
127
128
 
@@ -145,10 +146,11 @@ keeps chunked recovery instead of sending an oversized one-shot prompt to
145
146
  native summarization. Manual runs use the profile's absolute adaptive tail, so
146
147
  model-window size cannot turn an explicit command into a full-context no-op.
147
148
 
148
- Before summarization the pipeline serializes the full selected conversation,
149
- scrubs it, and writes that pre-prune backup; it then prunes redundant messages,
149
+ Before summarization the pipeline serializes and scrubs the full selected
150
+ conversation into an in-memory prepared backup, then prunes redundant messages,
150
151
  loads the previous verified summary plus bounded continuity state, checks the
151
- incremental extraction cache, and loads the project fingerprint.
152
+ incremental extraction cache, and loads the project fingerprint. The backup is
153
+ written atomically only after the matching native compaction is confirmed.
152
154
 
153
155
  ### Extract
154
156
 
@@ -187,16 +189,20 @@ deterministic fallback assembly when any budget or LLM call fails.
187
189
  ### Verify
188
190
 
189
191
  Primary: [`src/phases/verify.ts`](./src/phases/verify.ts). Scores the summary
190
- against the deterministic extraction. It checks for missing modified files,
191
- missing unresolved errors, missing high-confidence constraints, weak goal
192
- coverage, missing structure sections, suspicious fabricated file references,
193
- done/unresolved inconsistencies, missing explicit decisions, and missing
194
- open-loop coverage.
192
+ against deterministic extraction, continuity, explicit focus/note steering,
193
+ and source messages. It checks missing modified/read/deleted files, unresolved
194
+ errors, high-confidence constraints, weak goal coverage, missing structure,
195
+ suspicious fabricated paths, done/unresolved inconsistencies, explicit
196
+ decisions, open loops, and unsupported high-risk outcome claims. Claims such as
197
+ “tests passed” require matching source prose or a successful related tool
198
+ result.
195
199
 
196
200
  **Repair order is intentional:** (1) deterministic patch first (free,
197
201
  idempotent) → (2) one LLM patch only in `thorough` mode if still insufficient
198
- → (3) replace lower-scoring output with the deterministic quality floor → (4)
199
- reject unless final verification has no gaps and meets the verified threshold.
202
+ → (3) replace lower-scoring output with a deterministic quality floor built
203
+ only from extraction, continuity, and steering (4) reject unless final
204
+ verification has no gaps and meets the verified threshold. Untrusted chunk
205
+ prose is never an input to the quality floor.
200
206
  Final verification runs again after continuity injection. The final scalar is
201
207
  reported as repaired **verification coverage**, alongside the pre-repair source
202
208
  score and fallback provenance; it is not labeled as raw synthesis quality.
@@ -210,10 +216,10 @@ Markdown prefixes and multiline wrapping cannot create false missing-error gaps.
210
216
  - **Canonical summary IR** accepts recognized H1/H2/H3 headings, preserves Progress subsections, and merges duplicate canonical kinds before state mutation.
211
217
  - **Typed verification gaps** drive mandatory deterministic repair; collision-aware path needles prevent basename cross-satisfaction. Provenance is persisted and shown before optional approval.
212
218
  - **Fine tool semantics** separate read/search/list/mutate/delete/execute operations. Pruning deduplicates only identical idempotent access signatures.
213
- - **Unified token planning** uses a run-bound estimator with bounded process-shared provider/model calibration, counts structured tool-call arguments, preserves an adaptive recent tail, targets mode-specific post-compaction headroom, reserves 25% of the synthesis allowance for deterministic post-summary state sections, and reserves/reconciles every request against the mode's aggregate prompt/output-token caps.
214
- - **Security boundaries** scrub high-confidence secrets before provider calls and durable cache/backup/state writes; PII scrubbing is opt-in.
215
- - **Policy controls** include focus weighting, exact call/latency budgets, fail-closed manual approval, online damage monitoring, and persisted open-loop overrides.
216
- - **Release gate** (`bun run gate`) covers adversarial parser, verification, tool, cache, budget, scrub and damage fixtures.
219
+ - **Unified token planning** uses a run-bound estimator with bounded process-shared provider/model calibration, counts structured tool-call arguments, preserves an adaptive recent tail, targets mode-specific post-compaction headroom, reserves bounded deterministic post-summary state sections, clamps every provider request to the model's advertised output limit, and reserves/reconciles every request against aggregate prompt/output-token caps. Missing provider usage is estimated conservatively. Tool exchanges remain atomic; oversized result bodies are head/tail bounded only for synthesis after full deterministic extraction.
220
+ - **Security boundaries** scrub high-confidence secrets before provider calls and durable cache/backup/state writes; PII scrubbing is opt-in. Backups remain in memory until confirmed apply.
221
+ - **Policy controls** include focus weighting, exact call/latency budgets, default fail-closed manual approval, online damage monitoring, and persisted open-loop overrides. Interactive review time is outside the pipeline deadline.
222
+ - **Release gates** (`bun run gate`, `bun run bench`) cover adversarial parser, verification, tool, cache, budget, scrub and damage fixtures plus bounded p95 regressions for extraction, pruning, chunking, summary parsing, and path matching.
217
223
 
218
224
  ## State, caching & persistence
219
225
 
@@ -221,10 +227,12 @@ Post-verification, `app/steps/state.ts` + `src/utils/state.ts` enrich the
221
227
  summary, then `domain/yield-gate.ts` measures the final replacement. Planning
222
228
  has already reserved the bounded post-synthesis enrichment band by reducing the
223
229
  retained tail; missing the original target or 10% net-saving floor still throws
224
- before a `StatedRc` can reach staging/apply. `session_before_compact` only stages a passing candidate; after
225
- the host emits the matching `session_compact`, `app/steps/persist.ts` commits
226
- reusable state and success telemetry. Aborted/unconfirmed candidates write
227
- neither, and the UI reports `Applied` only after that correlated commit.
230
+ before a `StatedRc` can reach staging/apply. `session_before_compact` only stages
231
+ a passing candidate; after the host emits the matching `session_compact`,
232
+ `app/steps/persist.ts` commits reusable state, the prepared conversation backup,
233
+ and success telemetry. Aborted/unconfirmed candidates write none of them. The
234
+ UI reports `Applied` only after that correlated commit and emits a separate
235
+ warning if any durable side effect was partial.
228
236
  `ui/error-format.ts` converts verification/yield failures to one bounded,
229
237
  content-free diagnostic and collapses unknown multiline errors; full stacks are
230
238
  suppressed by default and emitted only under explicit `DEBUG=smart-compact`.
@@ -238,13 +246,13 @@ leaving one content-free safe-fallback notice in the UI.
238
246
  | Concern | Where | Notes |
239
247
  | --- | --- | --- |
240
248
  | Open-loop injection | `utils/state.ts` | inserted before Next Steps via the canonical parser |
241
- | `CompactionState` | `utils/state.ts` | conservatively merged and bounded across goal wording changes; newer file evidence resolves delete/present contradictions |
249
+ | `CompactionState` | `utils/state.ts` | immutable project/session/branch-head snapshots; descendants resolve the newest matching ancestor and siblings never overwrite each other |
242
250
  | Continuity Ledger | `utils/state.ts` | prior facts carry forward until positive resolution evidence or an explicit override; goal shifts become non-destructive breadcrumbs |
243
251
  | Cross-compaction delta | `utils/state.ts` | "Changes Since Last Compaction" section |
244
252
  | Incremental extraction cache | `utils/cache.ts` + `utils/id-fingerprint.ts` | bounded SHA-256 prefix fingerprint + tail; safe only when the pruned prefix still matches |
245
- | Synthesis cache | `infra/synthesis-cache.ts` | behavior key includes normalized focus, route, mode, budgets, and reasoning |
246
- | Session-log recovery | `utils/session-log.ts` | streaming JSONL parse; bypasses pi-toolkit truncation by entry-id mapping |
247
- | Project fingerprint | `utils/fingerprint.ts` | locked read/merge/write; language/framework/key dirs stay bounded across sessions |
253
+ | Synthesis cache | `infra/synthesis-cache.ts` | behavior key includes normalized focus, route, mode, profile limits, run-level call/input/latency limits, and reasoning |
254
+ | Session-log recovery | `utils/session-log.ts` | async bounded-memory JSONL scan with event-loop yields; bypasses pi-toolkit truncation by entry-id mapping without dropping late active-branch IDs at a fixed byte cap |
255
+ | Project fingerprint | `utils/fingerprint.ts` | locked read/merge/write; language/framework/key dirs stay bounded and `sessionCount` tracks distinct hashed session identities |
248
256
  | Damage detection | `utils/damage.ts` | best-effort post-compaction regression signals |
249
257
  | Context graph | `infra/context-graph.ts` | SQLite FTS5 facts + file edges; 2,000 non-structural nodes per project |
250
258
 
@@ -330,11 +338,13 @@ drives pipeline behavior:
330
338
  | `singlePassTokenMultiplier` | single-pass vs chunked threshold |
331
339
  | `tokenRatioEstimate` | token estimation; refined by per-(provider,model) **EMA calibration** |
332
340
 
333
- The Codex limiter is hybrid. Custom Codex endpoints receive
334
- `max_output_tokens` through Pi AI's payload hook. The ChatGPT subscription
335
- endpoint rejects every wire output-cap field, so it uses a derived 15–90s
336
- per-call stream watchdog plus a visible-output ceiling; aborts route to the
337
- phase's deterministic fallback.
341
+ Every provider call is raced against one aborting hard deadline so a transport
342
+ that ignores cancellation cannot keep the run lock indefinitely. Custom Codex
343
+ endpoints also receive `max_output_tokens` through Pi AI's payload hook. The
344
+ ChatGPT subscription endpoint rejects every wire output-cap field, so its
345
+ deadline is derived from the requested output allowance (15–90s) and paired
346
+ with a visible-output ceiling. Deadline failures route to the phase's
347
+ deterministic fallback.
338
348
 
339
349
  ### Provider evaluation and routing evidence
340
350
 
@@ -414,14 +424,14 @@ The code is organized into six layers, each with a single responsibility.
414
424
  | `app/run-context.ts` | typed stage chain (`RcBase → … → StatedRc`) |
415
425
  | `app/mode-policy.ts` | Auto selector and finite Fast/Balanced/Thorough policies; legacy Aggressive maps to Fast |
416
426
  | `app/pending-slot.ts` | encapsulated pending-compaction state cell |
417
- | `app/steps/prepare.ts` | resolve config, auth, provider caps |
418
- | `app/steps/window.ts` | pick the prefix of messages to compact |
427
+ | `app/steps/prepare.ts` | resolve config, provider caps, budgets, and cancellation; stage auth resolves lazily |
428
+ | `app/steps/window.ts` | pick the prefix using provider-calibrated synthesis and deterministic post-processing bounds |
419
429
  | `app/steps/recover.ts` | recover full content for log-truncated messages |
420
430
  | `app/steps/tier.ts` | choose compaction tier (none / light / full) |
421
431
  | `app/steps/extract.ts` | pruning + deterministic extraction with incremental cache |
422
432
  | `app/steps/synthesize.ts` | single-pass / EESV synthesis |
423
- | `app/steps/verify.ts` | structural verification + repair |
424
- | `app/steps/state.ts` | enrich summary with state machine + open loops |
433
+ | `app/steps/verify.ts` | structural verification + repair with tool-result trust boundaries |
434
+ | `app/steps/state.ts` | enrich summary with state, open loops, and recent resolved-error history |
425
435
  | `app/steps/persist.ts` | apply compaction, save fingerprint, persist state |
426
436
  | `app/steps/metrics.ts` | record success / failure metrics |
427
437
 
package/CHANGELOG.md CHANGED
@@ -1,8 +1,34 @@
1
1
  # Changelog
2
2
 
3
- ## [Unreleased]
3
+ ## [9.0.0] - 2026-08-09
4
4
 
5
- No changes yet.
5
+ ### Changed
6
+
7
+ - Major hardening release: verified host-correlated apply, strict command/tool inputs, bounded automatic compaction, model-aware output ceilings, branch-scoped continuity, and fail-closed yield and evidence contracts are now enforced end to end.
8
+
9
+ ### Fixed
10
+
11
+ - Command and tool inputs now share one strict parser. Control tokens are consumed only from the left edge, `--note`/`--` preserve literal notes, file paths are not mistaken for model IDs, and invalid modes or budgets fail explicitly.
12
+ - Verified state is stored as immutable project/session/branch-head snapshots; sibling branches no longer overwrite continuity, loop overrides re-index the updated graph, and synthesis cache keys include every output-affecting run budget.
13
+ - Deleted-file evidence now survives chunk synthesis, fallback assembly, verification, and repair. Modified/deleted paths count only in their canonical sections; unrelated parallel tool calls and substantive assistant constraints are no longer pruned.
14
+ - Every provider transport has an aborting hard deadline, stale filesystem locks are reclaimed asynchronously, backup listing reads bounded headers, and session-log recovery scans large active logs incrementally without a 50 MiB correctness cutoff.
15
+ - Result and approval UI expose generation fallbacks, source-versus-repaired coverage, remaining-gap counts, and the actual summary preview. Project fingerprints count distinct sessions instead of compaction runs.
16
+ - Verification now grounds high-risk completion claims only against successful tool results or deterministic resolved-error/file evidence, removes unsupported assistant-only claims, and builds the quality floor only from deterministic extraction, continuity, and explicit steering.
17
+ - Session-log recovery preserves exact entry/message identity; synthesis cache keys include recovered content and every provider route; full cache values are cloned without sharing nested mutable state.
18
+ - Boundary indexes are integer-canonicalized, exploration arguments reject empty broad matches, extraction evidence is bounded with visible overflow counts, and delayed tool results remain paired under the chunk ceiling.
19
+ - Missing provider usage is conservatively estimated for budgets and telemetry. Budget-driven synthesis fallbacks are recorded explicitly rather than appearing as provider-free success.
20
+ - Scrubbed backups are prepared without I/O and written only after correlated native apply. Partial persistence is reported separately, stale state/temp artifacts are removed, and stage transitions now enforce runtime order and required fields.
21
+ - Manual verified-summary review is enabled by default and excluded from the pipeline deadline; the preview wraps long evidence lines and dashboards hide unavailable quality scores.
22
+ - Cross-process JSONL retention now holds the append/trim lock for the complete transaction, overflow planning accounts for host-only fixed context, and long command failures preserve a bounded error window from the middle of pruned tool output.
23
+ - Single-batch synthesis fallbacks are visible and never cached as clean output; verification refreshes the run-wide LLM-call total; transient tool-probe failures no longer poison capability caches; profile overrides enforce integer and cross-field bounds.
24
+ - Verified-summary review is one scrollable Apply/Cancel screen, unavailable preflight choices explain why Enter is blocked, exact backup payloads materialize only after native apply, and restore forks from the recorded branch leaf or opens an isolated session for legacy backups.
25
+ - Unresolved host sessions stop before pipeline work, branch ancestry snapshots are bounded while retaining compaction state heads, Git-root caching is bounded and expiring, and context-graph directories are normalized to owner-only permissions.
26
+ - Window planning now translates provider output caps through the calibrated local estimator and budgets bounded deterministic repair/state additions, preventing late target rejection after a high-saving run.
27
+ - Secret scrubbing recognizes provider-specific Google/Stripe/GitLab/npm credentials, AWS secret assignments, credential-bearing object keys, and passwords in connection URIs.
28
+ - Incremental extraction caches retain failed-operation signatures, so only the same later operation can resolve a cached error; recent resolved errors remain visible in the continuation summary.
29
+ - Automatic compaction shows live phase progress and is bounded to 60 seconds and four LLM calls before native recovery. Context-graph queue saturation now rejects and reports the newest update instead of silently evicting accepted state.
30
+ - CI actions are pinned to immutable commits, the redundant adversarial rerun was removed from CI, and restore tests delete their temporary HOME directories.
31
+ - Every tracked provider request is clamped to the model's advertised output limit before budget reservation and dispatch. The release check now includes p95 hot-path regression limits and a host-correlated end-to-end auto-compaction/apply lifecycle test.
6
32
 
7
33
  ## [8.0.8] - 2026-08-09
8
34
 
package/README.md CHANGED
@@ -38,12 +38,19 @@ Then run `/smart-compact` for an explainable preflight before anything changes.
38
38
  /smart-compact auto # adaptive mode selection
39
39
  /smart-compact anthropic/claude-sonnet-4 fast # explicit model + mode
40
40
  /smart-compact balanced --focus=auth # preserve extra auth detail
41
+ /smart-compact --note="keep balanced and fast terminology"
42
+ /smart-compact -- preserve this note verbatim after the option boundary
41
43
  /smart-compact metrics # text metrics report
42
44
  /smart-compact dashboard # interactive dashboard
43
45
  /smart-compact restore # browse and restore backups
44
46
  /smart-compact loops # manage persisted open loops
45
47
  ```
46
48
 
49
+ Command controls are consumed only from the left edge. Once note text starts,
50
+ words such as `fast`, `balanced`, and paths such as `src/auth.ts` remain note
51
+ content. Use `--note=...` or `--` when the boundary should be explicit. Invalid
52
+ tool modes and budgets return an error instead of silently using defaults.
53
+
47
54
  At 60% context usage by default, the extension also participates in Pi's native
48
55
  compaction flow. Long-running agents can call `smart_compact`, `smart_recall`,
49
56
  and `smart_save_memory` directly.
@@ -68,7 +75,7 @@ The design principle is simple:
68
75
 
69
76
  > **Facts first. Synthesis second. Verification before apply.**
70
77
 
71
- Any unresolved verification gap rejects the custom summary before staging or apply. A zero-gap deterministic fallback is preferred over unverifiable model output; only failure of that fallback rejects the run. A successful compaction must also meet its mode target and at least 10% estimated net savings both before synthesis and after the final summary is measured. Automatic failures leave Pi free to use its native compactor, while manual failures leave the conversation unchanged.
78
+ Any unresolved verification gap rejects the custom summary before staging or apply. High-risk outcome claims such as “tests passed” or “deployed” must match source messages or a successful related tool result; unsupported claims are removed deterministically. A zero-gap fallback built only from extraction, continuity, and explicit focus/note steering is preferred over unverifiable model output; untrusted chunk prose cannot become the quality floor. A successful compaction must also meet its mode target and at least 10% estimated net savings both before synthesis and after the final summary is measured. Automatic failures leave Pi free to use its native compactor, while manual failures leave the conversation unchanged.
72
79
 
73
80
  ## EESV pipeline
74
81
 
@@ -150,14 +157,18 @@ target, route, and boundary data stays under `D` instead of crowding the decisio
150
157
  - `D` toggles calibrated estimator, target, boundary, and route details.
151
158
  - `M` opens Advanced model selection and replans with that route's calibration.
152
159
 
153
- Values remain estimates until the next provider turn reports usage. Smart
154
- Compact therefore uses `~`/`≤` language, measures the completed summary again
155
- before staging, and reports final success only after Pi confirms the matching
156
- `session_compact` run ID. A single long user turn may be split at a safe message
157
- boundary: its older prefix is verified into the summary while the budgeted
158
- working tail stays raw. Tool exchanges are summarized or retained as complete
159
- call/result pairs, never split. If Verify, yield, provider, or native apply
160
- fails, the UI shows one bounded actionable line without evidence text or a
160
+ Provider-reported token usage is used when available; missing or partial usage
161
+ is conservatively estimated for both metrics and aggregate budgets. Every
162
+ provider request is clamped to the selected model's advertised output limit
163
+ before reservation and dispatch. Smart Compact uses `~`/`≤` language for
164
+ post-compaction estimates, measures the completed summary again before staging,
165
+ and reports final success only after Pi confirms the matching
166
+ `session_compact` run ID. A single long user turn may be
167
+ split at a safe message boundary: its older prefix is verified into the summary
168
+ while the budgeted working tail stays raw. Tool exchanges remain complete
169
+ call/result pairs; oversized result evidence is head/tail bounded only in the
170
+ synthesis prompt after deterministic extraction has consumed the full input.
171
+ If Verify, yield, provider, or native apply fails, the UI shows one bounded actionable line without evidence text or a
161
172
  JavaScript stack. A successful `100/100` is labeled **verification coverage**;
162
173
  the source score and deterministic/LLM/fallback provenance remain visible so
163
174
  repaired coverage is never presented as raw synthesis quality. Stack diagnostics
@@ -182,8 +193,8 @@ brief. `verbose` restores routine phase notices; full stack diagnostics require
182
193
  does **not** attempt unsupported non-contiguous compaction.
183
194
  - `--max-calls` accepts `1–100`.
184
195
  - `--max-input-tokens` accepts `10000–1000000` aggregate prompt tokens.
185
- - `--max-latency` accepts `5000–600000` milliseconds as a cancellation deadline; cancellation waits for safe pipeline unwind before returning.
186
- - Budget exhaustion degrades to deterministic summaries instead of dropping context.
196
+ - `--max-latency` accepts `5000–600000` milliseconds as a provider/pipeline cancellation deadline; interactive summary review time is excluded.
197
+ - Budget exhaustion is recorded as an explicit fallback outcome and degrades to deterministic summaries instead of dropping context.
187
198
 
188
199
  The tool exposes equivalent `focus`, `max_calls`, `max_input_tokens`, and
189
200
  `max_latency_ms` parameters.
@@ -206,7 +217,7 @@ the verified summary carries them forward. Automatic risk refinement may deepen
206
217
  analysis/repair strategy after extraction, but it does not mutate the profile
207
218
  allowance or retention window that was already used to prove the target.
208
219
 
209
- Output caps stop subsequent calls after observed usage reaches the threshold.
220
+ Output caps stop subsequent calls after reported or conservatively estimated usage reaches the threshold.
210
221
  The ChatGPT Codex subscription endpoint rejects `max_output_tokens`,
211
222
  `max_tokens`, and `max_completion_tokens`; Smart Compact therefore enforces a
212
223
  15–90 second per-call watchdog plus a streamed visible-output ceiling and falls
@@ -286,11 +297,20 @@ guidance for reaching the target.
286
297
  - Tool-call/tool-result pair integrity at the compaction boundary
287
298
  - Collision-safe modified-file verification for monorepos
288
299
  - Bounded fixed-point repair for patchable verification gaps, followed by a zero-gap deterministic quality floor
300
+ - High-risk success claims are grounded only in successful host/tool results or
301
+ deterministic resolved-error/file evidence; assistant prose is never proof
302
+ of its own claim.
303
+ - The window planner converts provider output caps through the calibrated local
304
+ estimator and reserves bounded deterministic repair/state additions before
305
+ choosing the retained tail.
306
+ - Recent resolved errors remain explicit in the Continuity Ledger instead of
307
+ disappearing when they leave the unresolved set.
289
308
  - Cross-session guard and five-minute TTL for pending summaries
290
309
  - Session-log recovery for older, truncated tool results
291
- - Full selected pre-prune conversation backups, scrubbed before a 0600 write;
292
- marker-owned retention leaves foreign files in custom directories untouched
293
- - Private artifact directories are enforced as 0700 and files as 0600
310
+ - The full selected pre-prune conversation is scrubbed and prepared in memory;
311
+ its 0600 backup is written only after the matching native compaction succeeds.
312
+ Marker-owned retention leaves foreign files in custom directories untouched.
313
+ - Private artifact directories are enforced as 0700 and files as 0600; stale state snapshots and orphaned atomic-write temp files are removed during bounded retention sweeps.
294
314
 
295
315
  ### Secrets and PII
296
316
 
@@ -301,9 +321,10 @@ boundary:
301
321
  provider request · extraction cache · backup · state · context graph · pending summary
302
322
  ```
303
323
 
304
- It covers common API keys, cloud/GitHub/Slack tokens, JWTs, bearer tokens,
305
- private keys, and credential assignments. Optional email/phone/payment-card
306
- scrubbing is available through `scrubPii`.
324
+ It covers common API keys (including Google and Stripe), AWS/GitHub/GitLab/npm/
325
+ Slack tokens, JWTs, bearer tokens, private keys, secret-bearing object fields,
326
+ generic credential assignments, and passwords embedded in connection URIs.
327
+ Optional email/phone/payment-card scrubbing is available through `scrubPii`.
307
328
 
308
329
  Secret scrubbing is defense in depth, **not a replacement for proper secret
309
330
  handling or a dedicated DLP system**. See the
@@ -311,12 +332,13 @@ handling or a dedicated DLP system**. See the
311
332
 
312
333
  ### Approval and feedback
313
334
 
314
- - The manual preflight is the default decision point. `requireApproval: true`
315
- additionally shows a fail-closed verified-summary **Apply / Cancel** review;
316
- `false` avoids a redundant second modal. Fingerprint, continuity state,
317
- context graph, and success telemetry commit only after the host confirms the
318
- matching native `session_compact` event, and only then does the UI report
319
- `Applied`.
335
+ - Manual runs show a fail-closed verified-summary **Apply / Cancel** review by
336
+ default (`requireApproval: true`); set it to `false` only to opt out of the
337
+ second modal after preflight. Review time is not charged to the pipeline
338
+ deadline. Fingerprint, continuity state, context graph, prepared backup, and
339
+ success telemetry commit only after the host confirms the matching native
340
+ `session_compact` event. The UI reports `Applied` at that point and separately
341
+ warns if any durable persistence side effect was partial.
320
342
  - Online damage monitoring observes the first post-compaction messages and
321
343
  records re-read files or repeated context. Observations join the originating
322
344
  compaction by a local run id; missing evidence lowers coverage rather than
@@ -359,7 +381,7 @@ Add `smartCompact` to `~/.pi/agent/settings.json`:
359
381
  "backupEnabled": true,
360
382
  "scrubSecrets": true,
361
383
  "scrubPii": false,
362
- "requireApproval": false,
384
+ "requireApproval": true,
363
385
  "maxLlmCalls": 8,
364
386
  "maxLlmInputTokens": 0,
365
387
  "codexMaxCallMs": 0,
@@ -426,13 +448,13 @@ the run fails closed before staging or apply.
426
448
  | `summaryThinkingLevel` | `minimal \| low \| medium \| high \| xhigh \| max \| null` | `minimal` | Reasoning level for synthesis and repair; provider default when null |
427
449
  | `segmentationThinkingLevel` | `minimal \| low \| medium \| high \| xhigh \| max \| null` | `minimal` | Reasoning level for exploration; provider default when null |
428
450
  | `autoTrigger` | `boolean` | `true` | Participate in Pi's native compact hook |
429
- | `autoTriggerTimeoutMs` | `number` | `120000` | Auto cancellation deadline; waits for safe pipeline unwind, never an unsafe hard return |
451
+ | `autoTriggerTimeoutMs` | `number` | `120000` | Requested auto cancellation deadline; the synchronous hook clamps it to 60s and four LLM calls, shows live phase progress, then safely unwinds to native recovery |
430
452
  | `minContextPercent` | `number` | `60` | Auto/tool context gate; manual `/smart-compact` warns and bypasses it |
431
- | `backupEnabled` | `boolean` | `true` | Write a pre-compaction backup |
453
+ | `backupEnabled` | `boolean` | `true` | Prepare a scrubbed pre-compaction backup; write it only after confirmed apply |
432
454
  | `backupDir` | `string` | `~/.pi/agent/compact-backups` | Empty config value uses this path |
433
455
  | `profiles` | object | built-ins | Per-profile numeric overrides |
434
456
  | `pinPaths` | `string[]` | `[]` | Always preserve matching paths |
435
- | `requireApproval` | `boolean` | `false` | Manual UI only; cancel/error fails closed |
457
+ | `requireApproval` | `boolean` | `true` | Manual verified-summary review; cancel/error fails closed |
436
458
  | `scrubSecrets` | `boolean` | `true` | High-confidence credential redaction |
437
459
  | `scrubPii` | `boolean` | `false` | Email/phone/card-shaped redaction |
438
460
  | `maxLlmCalls` | integer `0–100` | `8` | Global ceiling combined with the selected mode |
@@ -546,8 +568,8 @@ coordinate hook order or prefer a single automatic compaction owner.
546
568
 
547
569
  ```bash
548
570
  bun install --frozen-lockfile
549
- bun run release:check # typecheck + tests + adversarial gate + build + package audit
550
- bun run bench
571
+ bun run release:check # typecheck + tests + adversarial/performance gates + build + package audit
572
+ bun run bench # standalone hot-path p95 regression gate
551
573
  bun run compat:pi # isolated latest-Pi compatibility check
552
574
  ```
553
575
 
package/SECURITY.md CHANGED
@@ -6,7 +6,7 @@ Security fixes target the latest published version of `pi-smart-compact`.
6
6
 
7
7
  | Version | Supported |
8
8
  | --- | --- |
9
- | Latest `8.x` | ✅ |
9
+ | Latest `9.x` | ✅ |
10
10
  | Older | ❌ |
11
11
 
12
12
  ## Reporting a vulnerability
@@ -1 +1 @@
1
- {"version":3,"file":"native-continuity-bridge.d.ts","sourceRoot":"","sources":["../../src/app/native-continuity-bridge.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AASD,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxD,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI,CAAC;IAClD,KAAK,CAAC,KAAK,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC3C,IAAI,IAAI,MAAM,CAAC;CAChB;AAMD,wBAAgB,4BAA4B,CAAC,IAAI,GAAE;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACT,GAAG,sBAAsB,CAqG9B"}
1
+ {"version":3,"file":"native-continuity-bridge.d.ts","sourceRoot":"","sources":["../../src/app/native-continuity-bridge.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,qBAAqB;IACpC,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;CACtB;AASD,MAAM,WAAW,sBAAsB;IACrC,KAAK,CAAC,KAAK,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACxD,IAAI,CAAC,KAAK,EAAE,qBAAqB,GAAG,MAAM,GAAG,IAAI,CAAC;IAClD,KAAK,CAAC,KAAK,CAAC,EAAE,qBAAqB,GAAG,IAAI,CAAC;IAC3C,IAAI,IAAI,MAAM,CAAC;CAChB;AAMD,wBAAgB,4BAA4B,CAAC,IAAI,GAAE;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,MAAM,CAAC;CACT,GAAG,sBAAsB,CA2G9B"}
@@ -1,12 +1,13 @@
1
1
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
2
2
  import type { Api, Model } from "@earendil-works/pi-ai";
3
3
  import type { CompactConfig, EffectiveCompactionMode, ProfileConfig, SessionMessageEntry } from "../types.ts";
4
- import { type TokenCalibrationStore, type TokenEstimator } from "../utils/tokens.ts";
4
+ import { getProviderCaps, type TokenCalibrationStore, type TokenEstimator } from "../utils/tokens.ts";
5
5
  import type { CompactionWindowPlan } from "./run-context.ts";
6
6
  export declare function preflightDamageMedian(cwd: string, config: CompactConfig): number;
7
7
  export interface PreparedPreflightProfile {
8
8
  profileCfg: ProfileConfig;
9
9
  estimator: TokenEstimator;
10
+ providerCaps: ReturnType<typeof getProviderCaps>;
10
11
  adapted: boolean;
11
12
  damageMedian: number;
12
13
  }
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/app/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,aAAa,EAAE,uBAAuB,EAAc,aAAa,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAI1H,OAAO,EAAsB,KAAK,qBAAqB,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AAG7D,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAG,MAAM,CAMhF;AAED,MAAM,WAAW,wBAAwB;IACvC,UAAU,EAAE,aAAa,CAAC;IAC1B,SAAS,EAAE,cAAc,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,kFAAkF;AAClF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE;IAC7C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,IAAI,EAAE,uBAAuB,CAAC;IAC9B,gBAAgB,EAAE,qBAAqB,CAAC;IACxC,MAAM,EAAE,aAAa,CAAC;IACtB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,wBAAwB,CAkB3B;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,IAAI,EAAE,oBAAoB,GAAG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AyB,EAAE,MAAM,CAAC;IAClC,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,OAAO,EAAE,CAAC;IAClB,IAAI,EAAE,mBAAmB,EAAE,CAAC;IAC5B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,yBAAyB,EAAE,MAAM,CAAC;IAClC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;CAC5B;AAED,uEAAuE;AACvE,wBAAgB,6BAA6B,CAC3C,GAAG,EAAE,gBAAgB,EACrB,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,EACxB,gBAAgB,EAAE,qBAAqB,GACtC,sBAAsB,CAqBxB;AAED,wBAAgB,mBAAmB,CACjC,GAAG,EAAE,gBAAgB,EACrB,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,EACxB,IAAI,EAAE,uBAAuB,EAC7B,gBAAgB,EAAE,qBAAqB,EACvC,MAAM,EAAE,aAAa,EACrB,YAAY,CAAC,EAAE,MAAM,EACrB,MAAM,GAAE,sBAA2F,GAClG,eAAe,CAqCjB"}
@@ -34,7 +34,7 @@
34
34
  */
35
35
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
36
36
  import type { Model, Api, ProviderHeaders } from "@earendil-works/pi-ai";
37
- import type { CompressionProfile, CompactionMode, EffectiveCompactionMode, LlmMessage, StructuredExtraction, ExplorationReport, ChunkSummary, SessionMessageEntry, PipelinePhaseTiming, CompactConfig, ProfileConfig, ProviderCapabilities, SmartCompactDetails, CompactionState, ContinuityScope, OpenLoop, Cell } from "../types.ts";
37
+ import type { CompressionProfile, CompactionMode, EffectiveCompactionMode, LlmMessage, StructuredExtraction, ExplorationReport, ChunkSummary, SessionMessageEntry, PipelinePhaseTiming, CompactConfig, ProfileConfig, ProviderCapabilities, SmartCompactDetails, CompactionState, ContinuityScope, OpenLoop, Cell, PreparedConversationBackup } from "../types.ts";
38
38
  import type { PendingSlot } from "./pending-slot.ts";
39
39
  import type { PruningResult } from "../utils/pruning.ts";
40
40
  import type { CompactionTier } from "../utils/helpers.ts";
@@ -127,6 +127,8 @@ export interface CompactionWindowPlan {
127
127
  fixedContextTokens: number;
128
128
  retentionTargetTokens: number;
129
129
  summaryBudgetTokens: number;
130
+ /** Locally estimated upper bound for synthesis plus deterministic post-processing. */
131
+ finalSummaryAllowanceTokens?: number;
130
132
  targetAfterTokens: number;
131
133
  hardBoundaryAdjusted: boolean;
132
134
  viable: boolean;
@@ -155,6 +157,8 @@ export type WindowedRc = RcBase & WindowedExt;
155
157
  export interface RecoveredExt extends WindowedExt {
156
158
  readonly _recovered: true;
157
159
  llmMessages: LlmMessage[];
160
+ /** Entry id aligned 1:1 with `llmMessages` after convertToLlm filtering. */
161
+ llmEntryIds: string[];
158
162
  }
159
163
  export type RecoveredRc = RcBase & RecoveredExt;
160
164
  export type ActiveTier = Exclude<CompactionTier, "none">;
@@ -184,6 +188,8 @@ export interface ExtractedExt extends TieredExt {
184
188
  convText: string;
185
189
  convTokens: number;
186
190
  backupPath: string | null;
191
+ /** Scrubbed exact payload staged in memory and written only after apply confirmation. */
192
+ preparedBackup?: PreparedConversationBackup;
187
193
  }
188
194
  export type ExtractedRc = RcBase & ExtractedExt;
189
195
  export interface SynthesizedExt extends ExtractedExt {
@@ -191,6 +197,7 @@ export interface SynthesizedExt extends ExtractedExt {
191
197
  finalSummary: string;
192
198
  method: "eesv" | "single-pass" | "heuristic";
193
199
  methodForMetrics: string;
200
+ generationFallbacks: string[];
194
201
  llmCalls: number;
195
202
  summaries: ChunkSummary[];
196
203
  explorationReport: ExplorationReport | null;
@@ -226,13 +233,6 @@ export type RunContext = StatedRc;
226
233
  export declare function markMeasuredPhase(rc: RcBase, phase: PipelinePhaseTiming["phase"], startMs: number, endMs?: number): void;
227
234
  /** Mark the boundary between two pipeline phases for the metrics log. */
228
235
  export declare function markPhase(rc: RcBase, phase: PipelinePhaseTiming["phase"]): void;
229
- /**
230
- * In-place stage advancement.
231
- *
232
- * Each step mutates its input then casts to the next stage. The cast is the
233
- * only place we widen the type — the runtime object never copies. Centralizing
234
- * it here means tests can spot the transition easily and IDE jumps to the
235
- * factory rather than scattering `as` keywords through every step.
236
- */
237
- export declare function advance<TIn extends RcBase, TOut extends TIn>(rc: TIn, _stage: keyof TOut): TOut;
236
+ /** Runtime-checked, in-place transition between adjacent pipeline stages. */
237
+ export declare function advance<TIn extends RcBase, TOut extends TIn>(rc: TIn, stage: keyof TOut): TOut;
238
238
  //# sourceMappingURL=run-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-context.d.ts","sourceRoot":"","sources":["../../src/app/run-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,KAAK,EACV,kBAAkB,EAAE,cAAc,EAAE,uBAAuB,EAAE,UAAU,EAAE,oBAAoB,EAC7F,iBAAiB,EAAE,YAAY,EAAE,mBAAmB,EAAE,mBAAmB,EACzE,aAAa,EAAE,aAAa,EAAE,oBAAoB,EAAE,mBAAmB,EACvE,eAAe,EAAE,eAAe,EAAE,QAAQ,EAAE,IAAI,EACjD,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK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,EAAE,KAAK,EAAE,MAAM,IAAI,GAAG,IAAI,CAkB9F"}
@@ -17,7 +17,7 @@
17
17
  * dependency is data on the stage type, every conditional is a boolean flag.
18
18
  */
19
19
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
20
- import type { Cell } from "../types.ts";
20
+ import type { Cell, PendingCompaction, SmartCompactDetails } from "../types.ts";
21
21
  import type { SessionRunLock } from "./session-run-lock.ts";
22
22
  import type { Model, Api } from "@earendil-works/pi-ai";
23
23
  import type { CompactionMode, CompressionProfile } from "../types.ts";
@@ -86,5 +86,21 @@ export interface SmartCompactOptions {
86
86
  /** Lifecycle callback supplied by the extension's commit store. */
87
87
  onNativeApplyError?: (runId: string, error: Error) => boolean;
88
88
  }
89
- export declare function runSmartCompact(opts: SmartCompactOptions): Promise<void>;
89
+ export type CompactOutcome = {
90
+ kind: "staged";
91
+ pending: PendingCompaction;
92
+ } | {
93
+ kind: "apply-requested";
94
+ pending: PendingCompaction;
95
+ } | {
96
+ kind: "dry-run";
97
+ details: SmartCompactDetails;
98
+ } | {
99
+ kind: "skipped";
100
+ reason: "model-unavailable" | "session-unavailable" | "already-running" | "window-not-viable" | "tier-selection-failed";
101
+ } | {
102
+ kind: "cancelled";
103
+ source: "user" | "timeout" | "host";
104
+ };
105
+ export declare function runSmartCompact(opts: SmartCompactOptions): Promise<CompactOutcome>;
90
106
  //# sourceMappingURL=run-smart-compact.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-smart-compact.d.ts","sourceRoot":"","sources":["../../src/app/run-smart-compact.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAA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C;IAAC,MAAM,EAAE,mBAAmB,GAAG,qBAAqB,GAAG,iBAAiB,GAAG,mBAAmB,GAAG,uBAAuB,CAAA;CAAE,GAC5I;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAA;CAAE,CAAC;AAwD/D,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,CAAC,CA6NxF"}
@@ -0,0 +1,23 @@
1
+ import type { CompactionMode } from "../types.ts";
2
+ export interface SmartCompactInput {
3
+ modelArg?: string;
4
+ mode?: CompactionMode;
5
+ verbose: boolean;
6
+ dryRun: boolean;
7
+ action?: "metrics" | "dashboard" | "restore" | "loops";
8
+ focus?: string;
9
+ note?: string;
10
+ maxLlmCalls?: number;
11
+ maxLlmInputTokens?: number;
12
+ timeoutMs?: number;
13
+ }
14
+ export type SmartCompactInputResult = {
15
+ ok: true;
16
+ value: SmartCompactInput;
17
+ } | {
18
+ ok: false;
19
+ error: string;
20
+ };
21
+ export declare function parseSmartCompactCommand(args: string, isModelToken: (token: string) => boolean): SmartCompactInputResult;
22
+ export declare function parseSmartCompactTool(params: Record<string, unknown>): SmartCompactInputResult;
23
+ //# sourceMappingURL=smart-compact-input.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"smart-compact-input.d.ts","sourceRoot":"","sources":["../../src/app/smart-compact-input.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAsB,MAAM,aAAa,CAAC;AAItE,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,CAAC;IACvD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,uBAAuB,GAC/B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,iBAAiB,CAAA;CAAE,GACtC;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAyEjC,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GACvC,uBAAuB,CAmEzB;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,uBAAuB,CA4B9F"}
@@ -1 +1 @@
1
- {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../src/app/steps/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAmB/D,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,WAAW,CAoL1D"}
1
+ {"version":3,"file":"extract.d.ts","sourceRoot":"","sources":["../../../src/app/steps/extract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAmB/D,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,GAAG,WAAW,CAmM1D"}
@@ -1 +1 @@
1
- {"version":3,"file":"metrics.d.ts","sourceRoot":"","sources":["../../../src/app/steps/metrics.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,QAAQ,E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