pi-cache-optimizer 2.10.6 → 2.10.7
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/README.md +1 -1
- package/README.zh-CN.md +1 -1
- package/package.json +2 -2
- package/src/model-identity.ts +10 -3
- package/src/models-json-lint.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,16 @@ last version Pi recorded for this package under "Extension Updates". Pi records
|
|
|
5
5
|
it sees this file, so notes start with the update after that.
|
|
6
6
|
Older history is in the [git log](https://github.com/jiangge/pi-cache-optimizer/commits/master).
|
|
7
7
|
|
|
8
|
+
## [2.10.7] - 2026-11-21
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- Pi 1.6.0's built-in llama.cpp models are recognised again, so they no longer get proxy and session-affinity advice meant for third-party OpenAI-compatible gateways. Pi 1.6.0 stopped setting `compat.supportsDeveloperRole: false` on them. A same-id `llama.cpp` provider that sets cache or routing overrides (`promptCacheKeyMode`, `cacheControlFormat`, `openRouterRouting`, `vercelGatewayRouting`) is no longer treated as the built-in one.
|
|
13
|
+
|
|
14
|
+
### Changed
|
|
15
|
+
|
|
16
|
+
- Validated against Pi 1.6.0. Its `models.json` compat keys are unchanged.
|
|
17
|
+
|
|
8
18
|
## [2.10.6] - 2026-11-13
|
|
9
19
|
|
|
10
20
|
### Changed
|
package/README.md
CHANGED
|
@@ -64,7 +64,7 @@ Run `/reload` in Pi after install/update/remove so extension hooks refresh.
|
|
|
64
64
|
|
|
65
65
|
On Pi 0.79.7 and newer, `pi update` updates Pi itself only. To update installed Pi packages such as this extension, run `pi update --extensions` (packages only) or `pi update --all` (Pi + packages).
|
|
66
66
|
|
|
67
|
-
This extension requires Pi 0.82+ and is validated against Pi 1.
|
|
67
|
+
This extension requires Pi 0.82+ and is validated against Pi 1.6.0. It uses the official Pi package types directly for type-checking, along with extension hooks, `getAgentDir()`, and prompt options shared by those versions; it does not depend on Pi 0.83+ APIs such as `ctx.scopedModels` or the bundled TypeBox 1.3 aliases. Native virtual model support and codemode nested-call coalescing activate only on Pi 0.99+ hosts that produce them; older hosts keep the previous behavior. The local development baseline uses Node.js 22.19.0 or newer, matching Pi 1.0.3's engine requirement.
|
|
68
68
|
|
|
69
69
|
## Commands
|
|
70
70
|
|
package/README.zh-CN.md
CHANGED
|
@@ -64,7 +64,7 @@ pi remove npm:pi-deepseek-cache-optimizer && pi install npm:pi-cache-optimizer
|
|
|
64
64
|
|
|
65
65
|
Pi 0.79.7 及之后,`pi update` 默认只更新 Pi 本体。若要更新已安装的 Pi package(包括本扩展),请运行 `pi update --extensions`(只更新 packages)或 `pi update --all`(Pi 与 packages 一起更新)。
|
|
66
66
|
|
|
67
|
-
本扩展要求 Pi 0.82+,并已使用 Pi 1.
|
|
67
|
+
本扩展要求 Pi 0.82+,并已使用 Pi 1.6.0 验证。TypeScript 校验直接使用官方 Pi package 类型,同时只使用这些版本共有的 extension hooks、`getAgentDir()` 和 prompt options;不依赖 Pi 0.83+ 专有 API(例如 `ctx.scopedModels` 或 bundled TypeBox 1.3 aliases)。原生虚拟模型支持与 codemode 嵌套工具调用合并只在会产生它们的 Pi 0.99+ 上生效,较早版本保持原有行为。本地开发基线需要 Node.js 22.19.0 或更高版本,与 Pi 1.0.3 的 engine 要求一致。
|
|
68
68
|
|
|
69
69
|
## 命令
|
|
70
70
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-cache-optimizer",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.7",
|
|
4
4
|
"description": "Improve Pi prompt/KV cache hit rates with stable prompts, OpenAI-compatible cache keys, proxy compat warnings, and footer cache stats.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"pi-package",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"check:modules": "node scripts/check-module-graph.mjs"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@earendil-works/pi-coding-agent": "^1.
|
|
41
|
+
"@earendil-works/pi-coding-agent": "^1.6.0",
|
|
42
42
|
"@earendil-works/pi-server": "^1.1.0",
|
|
43
43
|
"@types/node": "^22.0.0",
|
|
44
44
|
"jiti": "^2.7.0",
|
package/src/model-identity.ts
CHANGED
|
@@ -266,16 +266,23 @@ export function isPiBuiltInLlamaCppModel(model: PiModel | undefined): boolean {
|
|
|
266
266
|
// cache/routing overrides, so provider id alone must never imply exemption.
|
|
267
267
|
// supportsUsageInStreaming is deliberately not part of the fingerprint: Pi
|
|
268
268
|
// 0.82.x sets it false and Pi 0.83+ sets it true after fixing streamed usage,
|
|
269
|
-
// and it carries no routing or cache configuration.
|
|
269
|
+
// and it carries no routing or cache configuration. supportsDeveloperRole is
|
|
270
|
+
// false up to Pi 1.5.x; Pi 1.6.0 dropped it (developer role became
|
|
271
|
+
// api.openai.com-only by default), so absent is accepted too, but true is not.
|
|
270
272
|
const compat = getCompat(model);
|
|
271
273
|
return compat.supportsStore === false
|
|
272
|
-
&& compat.supportsDeveloperRole === false
|
|
274
|
+
&& (compat.supportsDeveloperRole === false || compat.supportsDeveloperRole === undefined)
|
|
273
275
|
&& compat.supportsReasoningEffort === false
|
|
274
276
|
&& compat.supportsStrictMode === false
|
|
275
277
|
&& compat.maxTokensField === "max_tokens"
|
|
276
278
|
&& compat.sendSessionAffinityHeaders === undefined
|
|
277
279
|
&& compat.sessionAffinityFormat === undefined
|
|
278
|
-
&& compat.supportsLongCacheRetention === undefined
|
|
280
|
+
&& compat.supportsLongCacheRetention === undefined
|
|
281
|
+
// Cache/routing overrides Pi's built-in provider never sets.
|
|
282
|
+
&& (compat as Record<string, unknown>).promptCacheKeyMode === undefined
|
|
283
|
+
&& (compat as Record<string, unknown>).cacheControlFormat === undefined
|
|
284
|
+
&& (compat as Record<string, unknown>).openRouterRouting === undefined
|
|
285
|
+
&& (compat as Record<string, unknown>).vercelGatewayRouting === undefined;
|
|
279
286
|
}
|
|
280
287
|
|
|
281
288
|
export function isResponsesPromptRewriteBypassApi(api: unknown): boolean {
|
package/src/models-json-lint.ts
CHANGED
|
@@ -13,14 +13,14 @@ import { MODELS_JSON_PATH } from "./paths.ts";
|
|
|
13
13
|
* key; unknown keys that resemble nothing are left alone so newer Pi fields
|
|
14
14
|
* and personal annotations never produce noise. It never edits the file.
|
|
15
15
|
*
|
|
16
|
-
* Known key sets are copied from Pi 1.
|
|
17
|
-
* 1.5.1 added compat promptCacheKeyMode, requiresNonNullAssistantContent, requiresToolsWithToolHistory and supportsMessageThreads):
|
|
16
|
+
* Known key sets are copied from Pi 1.6.0 (1.4.0 added compat imageInput and sendImageOptInHeader; 1.5.0 changed no keys;
|
|
17
|
+
* 1.5.1 added compat promptCacheKeyMode, requiresNonNullAssistantContent, requiresToolsWithToolHistory and supportsMessageThreads; 1.6.0 changed no keys):
|
|
18
18
|
* - @earendil-works/pi-coding-agent dist/core/model-config.js
|
|
19
19
|
* (ModelsConfigSchema, ProviderConfigSchema, ModelDefinitionSchema, ModelOverrideSchema)
|
|
20
20
|
* - @earendil-works/pi-ai dist/providers/compat-schema.js
|
|
21
21
|
* (ProviderCompatSchema = merged properties of every per-API compat schema)
|
|
22
22
|
*/
|
|
23
|
-
export const MODELS_JSON_SCHEMA_SOURCE_VERSION = "1.
|
|
23
|
+
export const MODELS_JSON_SCHEMA_SOURCE_VERSION = "1.6.0";
|
|
24
24
|
|
|
25
25
|
export const MODELS_JSON_ROOT_KEYS: readonly string[] = ["$schema", "providers"];
|
|
26
26
|
|
|
@@ -38,7 +38,7 @@ export const MODELS_JSON_MODEL_OVERRIDE_KEYS: readonly string[] = [
|
|
|
38
38
|
"contextWindow", "maxTokens", "samplingParams", "samplingParamsByThinkingLevel", "headers", "compat",
|
|
39
39
|
];
|
|
40
40
|
|
|
41
|
-
/** Object.keys(ProviderCompatSchema.properties) in Pi 1.
|
|
41
|
+
/** Object.keys(ProviderCompatSchema.properties) in Pi 1.6.0, sorted. */
|
|
42
42
|
export const MODELS_JSON_COMPAT_KEYS: readonly string[] = [
|
|
43
43
|
"allowEmptySignature", "allowedFallbackModels", "cacheControlFormat", "chatTemplateArgs", "chatTemplateKwargs",
|
|
44
44
|
"forceAdaptiveThinking", "imageInput", "maxTokensField", "openRouterRouting", "promptCacheKeyMode",
|