pi-smart-compact 10.1.4 → 10.1.5

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
@@ -2,6 +2,31 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [10.1.5] - 2026-10-05
6
+
7
+ ### Release approval
8
+
9
+ - Patch release approved by the release owner after the deterministic gates
10
+ on the exact candidate. No version-specific applied-canary cohort or live
11
+ provider run exists for `10.1.5`; the fix is evidenced by unit tests and
12
+ offline replay of a recorded session's cache usage only.
13
+
14
+ ### Fixed
15
+
16
+ - **Anchor prompt cache no longer evicts the rolling cache marker on OAuth
17
+ payloads.** pi-ai places `cache_control` on both OAuth system blocks (the
18
+ Claude Code identity line and the system prompt), so an Anthropic request
19
+ already carries four breakpoints: identity, system prompt, tools, rolling
20
+ tail. Adding the anchor marker made five, and the limit enforcement dropped
21
+ the first foreign message marker, which was the rolling tail. From the
22
+ first turn after an anchor every request then read only the prefix up to
23
+ the anchor and wrote nothing: `cacheWrite` stayed 0 while uncached input
24
+ grew turn by turn (a recorded session fell from 99% to 40% cache hits and
25
+ stayed there through a compaction that kept the anchor). The rolling tail
26
+ is now never an eviction candidate; the redundant identity marker goes
27
+ first, then the tools marker, both of which only cover prefixes of the
28
+ system-prompt marker. API-key payloads (one system marker) were unaffected.
29
+
5
30
  ## [10.1.4] - 2026-10-02
6
31
 
7
32
  ### Release approval
@@ -16,7 +16,9 @@
16
16
  * reply after N yet) N's prefix has never been written. The previous anchor M
17
17
  * keeps a marker too, [system, tools, M, N], so the prefix through M is read
18
18
  * and only (M, N] is written. The bridge uses a free slot or displaces a
19
- * foreign message marker; it never evicts system/tools markers.
19
+ * redundant foreign marker (see `evictable`); it never displaces the rolling
20
+ * tail, which is what advances the cache every turn (pi-ai's OAuth layout
21
+ * already carries four markers: identity, system prompt, tools, tail).
20
22
  *
21
23
  * TTL follows the payload: a `1h` marker (Pi long retention) makes the anchor
22
24
  * `1h` and rolling markers after it `5m`; otherwise markers stay default.
@@ -1 +1 @@
1
- {"version":3,"file":"anchor-cache.d.ts","sourceRoot":"","sources":["../../src/app/anchor-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,KAAK,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,0BAA0B,GAAG,2BAA2B,CAAC,CAAC;AA6CvG,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,EAC5B,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;CAAE,GACxC,IAAI,CAEN"}
1
+ {"version":3,"file":"anchor-cache.d.ts","sourceRoot":"","sources":["../../src/app/anchor-cache.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,iCAAiC,CAAC;AACtF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD,KAAK,iBAAiB,GAAG,IAAI,CAAC,aAAa,EAAE,0BAA0B,GAAG,2BAA2B,CAAC,CAAC;AA6CvG,wBAAgB,mBAAmB,CACjC,EAAE,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,EAC5B,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;CAAE,GACxC,IAAI,CAEN"}
@@ -8,7 +8,7 @@ import type { CompressionProfile, ProfileConfig } from "./types.ts";
8
8
  * `package.json#version`. Do not hand-edit this line for releases; bump
9
9
  * package.json and run `bun run sync-version`.
10
10
  */
11
- export declare const VERSION = "10.1.4";
11
+ export declare const VERSION = "10.1.5";
12
12
  /**
13
13
  * Opt-in components that are not installed with the extension: optional peer
14
14
  * dependencies in package.json, pinned to the versions the release audit
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  } from "@earendil-works/pi-coding-agent";
6
6
 
7
7
  // src/constants.ts
8
- var VERSION = "10.1.4";
8
+ var VERSION = "10.1.5";
9
9
  var OPTIONAL_COMPONENTS = {
10
10
  mnemopi: { name: "@oh-my-pi/pi-mnemopi", version: "18.3.1", enables: "Mnemopi memory store" },
11
11
  bun: { name: "bun", version: "1.4.2", enables: "Mnemopi worker runtime when no Bun 1.3.14+ is on PATH" },
@@ -24685,8 +24685,18 @@ function transitionBridge(payload, anchors, anchorLoc) {
24685
24685
  }
24686
24686
  function bridgeFits(payload) {
24687
24687
  const markers = listMarkers(payload);
24688
- const displaceable = markers.filter((m) => m.section === "messages" && !m.owned).length;
24689
- return markers.length - displaceable < MARKER_LIMIT;
24688
+ return markers.length - evictable(markers).length < MARKER_LIMIT;
24689
+ }
24690
+ function evictable(markers) {
24691
+ const foreign = (list) => list.filter((m) => !m.owned);
24692
+ const messages = markers.filter((m) => m.section === "messages");
24693
+ const system = markers.filter((m) => m.section === "system");
24694
+ return [
24695
+ ...foreign(messages.slice(0, -1)),
24696
+ ...foreign(system.slice(0, -1)),
24697
+ ...foreign(markers.filter((m) => m.section === "tools")),
24698
+ ...foreign(system.slice(-1))
24699
+ ];
24690
24700
  }
24691
24701
  function setMarker(payload, ref, control) {
24692
24702
  const block = payload.messages[ref.msgIdx].content[ref.blockIdx];
@@ -24748,7 +24758,7 @@ function countMarkers(payload) {
24748
24758
  function enforceMarkerLimit(payload) {
24749
24759
  let markers = listMarkers(payload);
24750
24760
  while (markers.length > MARKER_LIMIT) {
24751
- const target = markers.find((m) => m.section === "messages" && !m.owned) ?? markers.find((m) => m.section === "tools" && !m.owned) ?? markers.find((m) => m.section === "system" && !m.owned);
24761
+ const target = evictable(markers)[0];
24752
24762
  if (!target)
24753
24763
  break;
24754
24764
  delete blockAt(payload, target).cache_control;
package/dist/rtk.js CHANGED
@@ -198,7 +198,7 @@ class SecretScrubber {
198
198
  }
199
199
 
200
200
  // src/constants.ts
201
- var VERSION = "10.1.4";
201
+ var VERSION = "10.1.5";
202
202
  var OPTIONAL_COMPONENTS = {
203
203
  mnemopi: { name: "@oh-my-pi/pi-mnemopi", version: "18.3.1", enables: "Mnemopi memory store" },
204
204
  bun: { name: "bun", version: "1.4.2", enables: "Mnemopi worker runtime when no Bun 1.3.14+ is on PATH" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-smart-compact",
3
- "version": "10.1.4",
3
+ "version": "10.1.5",
4
4
  "description": "Pi Continuity — context hygiene and session continuity for Pi Coding Agent: recoverable cleanup, checkpoints, memory and verified compaction.",
5
5
  "type": "module",
6
6
  "packageManager": "bun@1.4.2",