@oh-my-pi/pi-catalog 18.8.5 → 18.8.6
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 +10 -0
- package/dist/types/compat/prompt-cache-lookback.d.ts +7 -0
- package/package.json +4 -4
- package/src/compat/axes.ts +6 -0
- package/src/compat/prompt-cache-lookback.ts +23 -0
- package/src/compat/rules/README.md +2 -0
- package/src/compat/rules/classes/anthropic.kdl +6 -0
- package/src/compat/rules.json +1 -1
- package/src/model-manager.ts +26 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
## [Unreleased]
|
|
4
4
|
|
|
5
|
+
## [18.8.6] - 2026-10-08
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Added prompt-cache lookback support for Claude models across all hosts, including the public `prompt-cache-lookback` catalog axis and `resolvePromptCacheLookback` API.
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Fixed model discovery when providers publish models before they are recognized by the catalog; unsupported models are now skipped with a warning so other available models remain discoverable.
|
|
14
|
+
|
|
5
15
|
## [18.8.5] - 2026-10-08
|
|
6
16
|
|
|
7
17
|
### Breaking Changes
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Model } from "../types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Block positions the provider's prompt cache checks back from a breakpoint for
|
|
4
|
+
* an earlier request's entry (`prompt-cache-lookback` axis), or `undefined` when
|
|
5
|
+
* the model has no known lookback bound.
|
|
6
|
+
*/
|
|
7
|
+
export declare function resolvePromptCacheLookback(model: Model): number | undefined;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oh-my-pi/pi-catalog",
|
|
3
|
-
"version": "18.8.
|
|
3
|
+
"version": "18.8.6",
|
|
4
4
|
"description": "Model catalog for omp: bundled model database, provider discovery descriptors, model identity, classification, and equivalence",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -93,12 +93,12 @@
|
|
|
93
93
|
"gen:proto": "bun scripts/generate-protocols.ts"
|
|
94
94
|
},
|
|
95
95
|
"dependencies": {
|
|
96
|
-
"@oh-my-pi/omptype": "18.8.
|
|
97
|
-
"@oh-my-pi/pi-utils": "18.8.
|
|
96
|
+
"@oh-my-pi/omptype": "18.8.6",
|
|
97
|
+
"@oh-my-pi/pi-utils": "18.8.6"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
100
|
"@bgotink/kdl": "0.4.0",
|
|
101
|
-
"@oh-my-pi/pi-ai": "18.8.
|
|
101
|
+
"@oh-my-pi/pi-ai": "18.8.6",
|
|
102
102
|
"@types/bun": "^1.3.14"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
package/src/compat/axes.ts
CHANGED
|
@@ -399,6 +399,12 @@ export const AXES: Readonly<Record<string, AxisDef>> = {
|
|
|
399
399
|
"limits-patch": { key: "limitsPatch", set: "catalog", shape: "object" },
|
|
400
400
|
"long-context-cost": { key: "longContext", set: "catalog", shape: "object" },
|
|
401
401
|
"prompt-cache": { key: "promptCache", set: "catalog", shape: "object" },
|
|
402
|
+
/**
|
|
403
|
+
* Prompt-cache lookback in block positions: how far back from a cache
|
|
404
|
+
* breakpoint the provider looks for an earlier request's cache entry.
|
|
405
|
+
* Unassigned: no known lookback bound.
|
|
406
|
+
*/
|
|
407
|
+
"prompt-cache-lookback": { key: "promptCacheLookback", set: "catalog", shape: "scalar" },
|
|
402
408
|
"long-usage-limit-fallback": { key: "longUsageLimitFallback", set: "catalog", shape: "scalar" },
|
|
403
409
|
"max-context-window": { key: "maxContextWindow", set: "catalog", shape: "scalar" },
|
|
404
410
|
"pricing-status": {
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { toModelSpec } from "../provider-models/bundled-references";
|
|
2
|
+
import type { Model } from "../types";
|
|
3
|
+
import { resolveCatalogAxes } from "./resolve";
|
|
4
|
+
|
|
5
|
+
const lookbackCache = new Map<string, number | null>();
|
|
6
|
+
const LOOKBACK_CACHE_MAX = 8192;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Block positions the provider's prompt cache checks back from a breakpoint for
|
|
10
|
+
* an earlier request's entry (`prompt-cache-lookback` axis), or `undefined` when
|
|
11
|
+
* the model has no known lookback bound.
|
|
12
|
+
*/
|
|
13
|
+
export function resolvePromptCacheLookback(model: Model): number | undefined {
|
|
14
|
+
const key = `${model.provider} ${model.id} ${model.api}`;
|
|
15
|
+
let lookback = lookbackCache.get(key);
|
|
16
|
+
if (lookback === undefined) {
|
|
17
|
+
const value = resolveCatalogAxes(toModelSpec(model)).promptCacheLookback;
|
|
18
|
+
lookback = typeof value === "number" && Number.isInteger(value) && value > 0 ? value : null;
|
|
19
|
+
if (lookbackCache.size >= LOOKBACK_CACHE_MAX) lookbackCache.clear();
|
|
20
|
+
lookbackCache.set(key, lookback);
|
|
21
|
+
}
|
|
22
|
+
return lookback ?? undefined;
|
|
23
|
+
}
|
|
@@ -219,6 +219,8 @@ One object axis carries a computed form: `long-context-cost` accepts either the
|
|
|
219
219
|
|
|
220
220
|
`inline-image-byte-budget` caps retained base64 image characters for a deployment's request body. It leaves room for tool schemas and text beneath the provider's body-size limit; the coding agent reads it through `resolveInlineImageByteBudget` before sending live history. The budget applies only while `compat.officialEndpoint` holds: a custom `baseUrl` imposes its own body limit.
|
|
221
221
|
|
|
222
|
+
`prompt-cache-lookback` is how many block positions back from a cache breakpoint the model's prompt cache looks for an earlier request's entry (Claude: 20, counting the breakpoint; a run of consecutive `tool_use` or `tool_result` blocks is one position). The coding agent reads it through `resolvePromptCacheLookback` and keeps warm-cache tool-result pruning inside the window; unassigned means no known bound.
|
|
223
|
+
|
|
222
224
|
The routed-subscription registry axes (`upstream-rotation`, `region-upstreams-global|us|eu`, `region-limits-eu`, `credit-rates`, `list-price-from`, `routing-family`, `policy-aliases`, `entitlement`, `default-reasoning-off`) describe a gateway whose proxy fans one model out to several upstreams. They are read through `src/compat/factory-droid.ts` by Factory Droid discovery and its request provider, not materialized by `buildModel`. A provider-wide `region-upstreams-*` rule is the upstream serving table and a model rule replaces it for that region. `list-price-from "<provider>" ["<id>"]` shows a bundled row's list price beside the subscription's own billing; unlike seed values it is resolved at runtime and degrades to the seed's zero cost when the row is gone. See [`providers/factory-droid.kdl`](providers/factory-droid.kdl), whose wire and billing pool per model are `api-routes` and `quota-tiers` rules in `runtime/behavior.kdl`.
|
|
223
225
|
|
|
224
226
|
### Time-based pricing
|
|
@@ -9,7 +9,13 @@
|
|
|
9
9
|
// are never undercounted; only Opus/Sonnet/Haiku revisions known to predate
|
|
10
10
|
// 4.7 take the standard tier. Separator-collapsed revisions parse as two
|
|
11
11
|
// digits (`claude-opus-45` is Opus 4.5 → 45), so 10–46 is standard too.
|
|
12
|
+
// Claude's prompt cache finds an earlier request's entry only within 20 block
|
|
13
|
+
// positions back from a breakpoint, counting the breakpoint; a run of
|
|
14
|
+
// consecutive tool_use or tool_result blocks is one position. Warm-cache
|
|
15
|
+
// tool-result pruning keeps its rewrites inside this window.
|
|
16
|
+
// https://platform.claude.com/docs/en/build-with-claude/prompt-caching
|
|
12
17
|
class "anthropic" {
|
|
18
|
+
prompt-cache-lookback 20
|
|
13
19
|
image-tokenization {
|
|
14
20
|
regime "anthropic-patch"
|
|
15
21
|
max-edge 2576
|