@nijaru/pi-provider-compaction 0.0.12 → 0.0.13

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pi-provider-compaction
2
2
 
3
- Experimental cache-aware compaction for [Pi](https://github.com/earendil-works/pi), with portable summaries and optional provider-native checkpoints. Minimum runtime: Pi 0.87.0. Development checks target Pi 1.4.0.
3
+ Experimental cache-aware compaction for [Pi](https://github.com/earendil-works/pi), with portable summaries and optional provider-native checkpoints. Minimum runtime: Pi 0.87.0. Development checks target Pi 1.5.0.
4
4
 
5
5
  **Experimental; qualified backend probes are not production validation.** Real runner/adapter fixtures and live DeepSeek, MiMo and Codex probes pass, with the preservation and cache-hit qualifications below. Broader backend and deployment validation remains incomplete.
6
6
 
@@ -101,7 +101,7 @@ pi --extension ./dist/index.js
101
101
 
102
102
  The manifest loads the built `dist/index.js`, including a bundled stateless Responses serializer validator; source or host dependency changes require a rebuild. `bun run check` rebuilds first and tests the artifact against Pi's actual host serializer, including function-call history replayed as grammar tools. Keep global installation disabled while testing. Publishing and global activation are separate approval steps.
103
103
 
104
- Tests include real Pi 1.4.0 runner/adapter fixtures for all three protocols, repeated prefix compaction, transformed suffix preservation, unchanged fallback, grammar tools, strict defaults, tool IDs, images, prompt updates, cross-model thinking and mid-conversation effort changes. Set `PI_COMPACTOR_FIXTURE_PATH` to a `pi-compactor` entrypoint to check SDK flag precedence and real idle-expiry transactions in both extension orders. Cached-summary fixtures also exercise built-in DeepSeek/Xiaomi dispatch, Anthropic Messages, late tool output, truncated-output fallback and measured usage. The optional installed-fast-mode fixture (`PI_FAST_MODE_FIXTURE_PATH`) checks actual `pi-fast-mode` composition across `/reload`; it creates an isolated fast-mode configuration. `PI_PEAK_HOURS_FIXTURE_PATH` adds request-wide pricing checks in both extension orders, including warming, branch summaries, mixed-API dispatch and composition with `/fast`.
104
+ Tests include real Pi 1.5.0 runner/adapter fixtures for all three protocols, repeated prefix compaction, transformed suffix preservation, unchanged fallback, grammar tools, strict defaults, tool IDs, images, prompt updates, cross-model thinking and mid-conversation effort changes. Set `PI_COMPACTOR_FIXTURE_PATH` to a `pi-compactor` entrypoint to check SDK flag precedence and real idle-expiry transactions in both extension orders. Cached-summary fixtures also exercise built-in DeepSeek/Xiaomi dispatch, Anthropic Messages, late tool output, truncated-output fallback and measured usage. The optional installed-fast-mode fixture (`PI_FAST_MODE_FIXTURE_PATH`) checks actual `pi-fast-mode` composition across `/reload`; it creates an isolated fast-mode configuration. `PI_PEAK_HOURS_FIXTURE_PATH` adds request-wide pricing checks in both extension orders, including warming, branch summaries, mixed-API dispatch and composition with `/fast`.
105
105
 
106
106
  Authenticated cached-summary smoke tests use synthetic history, including a value beyond the ordinary tool-result excerpt, and check continuation:
107
107
 
package/dist/index.js CHANGED
@@ -2245,6 +2245,7 @@ function combineUsage(first, second) {
2245
2245
  result[key] = (first[key] ?? 0) + (second[key] ?? 0);
2246
2246
  for (const key of ["input", "output", "cacheRead", "cacheWrite", "total"])
2247
2247
  result.cost[key] += second.cost[key];
2248
+ result.cost.totalFromProvider = first.cost.totalFromProvider === true && second.cost.totalFromProvider === true;
2248
2249
  return result;
2249
2250
  }
2250
2251
  function supportedRouteOptions(model, options) {
package/index.ts CHANGED
@@ -112,6 +112,7 @@ function combineUsage(first: Usage | undefined, second: Usage | undefined): Usag
112
112
  for (const key of ["input", "output", "cacheRead", "cacheWrite", "totalTokens"] as const) result[key] += second[key];
113
113
  for (const key of ["reasoning", "cacheWrite1h"] as const) if (first[key] !== undefined || second[key] !== undefined) result[key] = (first[key] ?? 0) + (second[key] ?? 0);
114
114
  for (const key of ["input", "output", "cacheRead", "cacheWrite", "total"] as const) result.cost[key] += second.cost[key];
115
+ result.cost.totalFromProvider = first.cost.totalFromProvider === true && second.cost.totalFromProvider === true;
115
116
  return result;
116
117
  }
117
118
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nijaru/pi-provider-compaction",
3
- "version": "0.0.12",
3
+ "version": "0.0.13",
4
4
  "type": "module",
5
5
  "description": "Provider-native context compaction adapters for Pi",
6
6
  "keywords": [
@@ -46,11 +46,12 @@
46
46
  "LICENSE"
47
47
  ],
48
48
  "devDependencies": {
49
- "@earendil-works/pi-ai": "1.4.0",
50
- "@earendil-works/pi-agent-core": "1.4.0",
51
- "@earendil-works/pi-coding-agent": "1.4.0",
49
+ "@earendil-works/pi-ai": "1.5.0",
50
+ "@earendil-works/pi-agent-core": "1.5.0",
51
+ "@earendil-works/pi-coding-agent": "1.5.0",
52
52
  "@types/bun": "latest",
53
53
  "oxlint": "^1.81.0",
54
+ "typebox": "^1.3.0",
54
55
  "typescript": "^6.0.3"
55
56
  },
56
57
  "peerDependencies": {