pi-smart-compact 7.11.0 → 7.12.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # Changelog
2
2
 
3
+ ## [7.12.1] - 2026-05-19
4
+
5
+ ### Fixed
6
+ - **Pi package gallery preview** — Added `pi.image` metadata pointing to the packaged logo asset so pi.dev/package listings can render the package image.
7
+
8
+ ## [7.12.0] - 2026-05-19
9
+
10
+ ### Added
11
+ - **Performance monitoring report** — Metrics now include run status, method, provider/model, run type, total duration, verification gaps, and phase timings. `/smart-compact metrics` and the `smart_compact` tool's `report` parameter return a profile/provider comparison report for A/B-style evaluation.
12
+ - **Professional local HTML dashboard** — `/smart-compact dashboard` and `smart_compact({ dashboard: true })` write `.cache/smart-compact-report.html` with KPI cards, reliability badges, duration trends, profile/provider comparison tables, phase timing bars, recent-run diagnostics, responsive dark/light styling, and aggregate metrics.
13
+ - **Provider strategy fields** — Provider capabilities now include timeout multipliers, single-pass threshold multipliers, and multimodal support mode. Auto-trigger timeout and single-pass selection adapt to the selected provider.
14
+ - **Multimodal metadata extraction** — The deterministic extractor now preserves image/file/audio/video attachment metadata without embedding binary/base64 payloads in summaries.
15
+
16
+ ### Fixed
17
+ - **Manual tool timeout warning** — `smart_compact` tool calls no longer inherit the native auto-trigger timeout. The timeout guard now only applies when Pi's `session_before_compact` hook is trying to prepare a summary before native compaction.
18
+ - **Auto-trigger robustness** — Increased the default `autoTriggerTimeoutMs` from 45s to 120s, cleared the hook timeout timer deterministically, and kept the native fallback warning specific to auto-trigger runs.
19
+ - **Single-pass output budget** — Single-pass compaction now caps `maxTokens` to the selected profile's `summaryBudgetTokens` instead of the provider's maximum output size.
20
+ - **Runtime version drift** — Synced the exported runtime `VERSION` with `package.json` and added a regression test.
21
+ - **Config validation hardening** — Invalid per-profile overrides are now sanitized instead of reaching the compaction pipeline as non-numeric budget values.
22
+ - **Metrics failure observability** — Timeout and unexpected error exits now write metrics entries with `status: "timeout"` or `status: "error"` before rethrowing.
23
+ - **Dashboard hardening** — The local HTML dashboard escapes metric values and the metrics reader skips corrupt JSONL rows instead of dropping the whole report.
24
+
25
+ ### Performance
26
+ - **Session log recovery cache** — Session log path lookup and parsed message maps are cached with mtime/size invalidation to avoid repeatedly scanning `~/.pi/agent/sessions` during recovery.
27
+
3
28
  ## [7.11.0] - 2026-05-19
4
29
 
5
30
  ### Changed
package/README.md CHANGED
@@ -153,6 +153,8 @@ With no arguments, the extension opens a small picker for:
153
153
  /smart-compact anthropic/claude-sonnet-4 balanced
154
154
  /smart-compact dry-run
155
155
  /smart-compact debug
156
+ /smart-compact metrics
157
+ /smart-compact dashboard
156
158
  /smart-compact "focus on auth changes and unresolved follow-up work"
157
159
  ```
158
160
 
@@ -164,7 +166,9 @@ With no arguments, the extension opens a small picker for:
164
166
  "parameters": {
165
167
  "profile": "balanced",
166
168
  "verbose": false,
167
- "dry_run": false
169
+ "dry_run": false,
170
+ "report": false,
171
+ "dashboard": false
168
172
  }
169
173
  }
170
174
  ```
@@ -179,6 +183,8 @@ The tool prepares a pending smart summary and lets Pi consume it on the next nat
179
183
  - the tool path does **not** compact the conversation mid-turn
180
184
  - pending summaries are kept in memory for **5 minutes**
181
185
  - exploration is adaptive and may be skipped for simple sessions
186
+ - use `/smart-compact metrics` for profile/provider comparisons
187
+ - use `/smart-compact dashboard` to write a local HTML report at `.cache/smart-compact-report.html`
182
188
 
183
189
  This keeps the extension helpful without forcing extra work when it is not needed.
184
190
 
@@ -195,6 +201,7 @@ Add this to `~/.pi/agent/settings.json`:
195
201
  "summaryModel": "anthropic/claude-sonnet-4",
196
202
  "segmentationModel": "anthropic/claude-haiku-3",
197
203
  "autoTrigger": true,
204
+ "autoTriggerTimeoutMs": 120000,
198
205
  "backupEnabled": true,
199
206
  "profiles": {
200
207
  "balanced": {
@@ -214,6 +221,7 @@ Add this to `~/.pi/agent/settings.json`:
214
221
  | `summaryModel` | `string \| null` | `null` |
215
222
  | `segmentationModel` | `string \| null` | `null` |
216
223
  | `autoTrigger` | `boolean` | `true` |
224
+ | `autoTriggerTimeoutMs` | `number` | `120000` |
217
225
  | `backupEnabled` | `boolean` | `true` |
218
226
  | `backupDir` | `string` | `~/.pi/agent/compact-backups` |
219
227
  | `profiles` | partial per-profile overrides | built-ins |
@@ -269,8 +277,10 @@ The current design includes:
269
277
  - hallucinated file-reference detection
270
278
  - open-loop injection
271
279
  - project fingerprinting and delta tracking
280
+ - provider-specific timeout and single-pass strategies
281
+ - multimodal attachment metadata preservation
272
282
  - backup creation before compaction
273
- - metrics logging and damage detection
283
+ - metrics logging, profile/provider comparison, and damage detection
274
284
 
275
285
  ---
276
286
 
@@ -282,6 +292,7 @@ At runtime, the extension writes to paths under `~/.pi/agent/`, including:
282
292
  - `compact-backups/`
283
293
  - `.cache/compact-extraction-<session>.json`
284
294
  - `.cache/compact-metrics.jsonl`
295
+ - `.cache/smart-compact-report.html`
285
296
  - `.cache/smart-compact/projects/<projectId>.json`
286
297
  - `.cache/smart-compact/states/<projectId>.json`
287
298
  - `.cache/smart-compact/damage-reports.jsonl`
@@ -2,7 +2,7 @@
2
2
  * Constants, prompts, and profile defaults.
3
3
  */
4
4
  import type { CompressionProfile, ProfileConfig } from "./types.ts";
5
- export declare const VERSION = "7.9.5";
5
+ export declare const VERSION = "7.12.1";
6
6
  export declare const CHARS_PER_TOKEN = 3.8;
7
7
  export declare const COMPACT_SYSTEM_PREFIX: string;
8
8
  export declare const PROFILES: Record<CompressionProfile, ProfileConfig>;
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEpE,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC,eAAO,MAAM,q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AAClD,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAClD,eAAO,MAAM,wBAAwB,wBAAwB,CAAC;AAC9D,eAAO,MAAM,cAAc,sBAAsB,CAAC;AAClD,eAAO,MAAM,kBAAkB,kBAAkB,CAAC;AAClD,eAAO,MAAM,eAAe,qCAAqC,CAAC;AAGlE,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAG5C,eAAO,MAAM,mBAAmB,OAAO,CAAC;AACxC,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAGxC,eAAO,MAAM,UAAU,iBAAiB,CAAC;AACzC,eAAO,MAAM,cAAc,oBAAoB,CAAC;AAEhD,eAAO,MAAM,sBAAsB,QAU6T,CAAC"}
package/dist/core.d.ts CHANGED
@@ -22,6 +22,8 @@ export interface SmartCompactOptions {
22
22
  autoTriggered?: boolean;
23
23
  userNote?: string;
24
24
  skipCompact?: boolean;
25
+ /** Optional hard budget for native auto-trigger only. Manual/tool runs do not time out by default. */
26
+ timeoutMs?: number;
25
27
  }
26
28
  export declare function runSmartCompact(opts: SmartCompactOptions): Promise<void>;
27
29
  //# sourceMappingURL=core.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAE/E,OAAO,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,KAAK,EACV,kBAAkB,EAAE,iBAAiB,EAEtC,MAAM,YAAY,CAAC;AAuBpB,yEAAyE;AACzE,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,uBAAuB,CAAC;IAC7B,YAAY,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACzB,QAAQ,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IACrB,OAAO,EAAE,kBAAkB,CAAC;IAC5B,OAAO,CAAC,EAAE,OAA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,OAAO,CAAC;IACtB,sGAAsG;IACtG,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,OAAO,CAAC,IAAI,CAAC,CA+e9E"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,iCAAiC,CAAC;AAwC7F,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAAE,EAAE,YAAY,QA2J7D"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAA2B,MAAM,iCAAiC,CAAC;AA0C7F,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAAC,EAAE,EAAE,YAAY,QA6K7D"}