pi-cache-optimizer 2.6.3 → 2.6.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/README.md +4 -2
- package/README.zh-CN.md +4 -2
- package/index.ts +550 -306
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
Pi extension for improving provider-side KV / prompt cache hit rates. It keeps stable prompt content near the front, adds a conservative OpenAI-compatible `prompt_cache_key` fallback, warns about common proxy cache-routing gaps, and shows read-only footer cache stats.
|
|
10
10
|
|
|
11
|
-
> Renamed from `pi-deepseek-cache-optimizer`. Existing footer counters migrate automatically.
|
|
11
|
+
> Renamed from `pi-deepseek-cache-optimizer`. Existing footer counters migrate automatically. The extension does **not** touch `~/.pi/agent/models.json` during normal operation; only `/cache-optimizer fix` can edit it, and only after an explicit interactive preview + confirmation with an automatic timestamped backup.
|
|
12
12
|
|
|
13
13
|
## Contents
|
|
14
14
|
|
|
@@ -17,6 +17,8 @@ Pi extension for improving provider-side KV / prompt cache hit rates. It keeps s
|
|
|
17
17
|
- [Commands](#commands)
|
|
18
18
|
- [Persistent opt-out](#persistent-opt-out)
|
|
19
19
|
- [OpenAI-compatible proxy setup](#openai-compatible-proxy-setup)
|
|
20
|
+
- [Anthropic adaptive thinking models](#anthropic-adaptive-thinking-models)
|
|
21
|
+
- [Auto-repair with `/cache-optimizer fix`](#auto-repair-with-cache-optimizer-fix)
|
|
20
22
|
- [Footer stats](#footer-stats)
|
|
21
23
|
- [Uninstall](#uninstall)
|
|
22
24
|
- [Verify effect](#verify-effect)
|
|
@@ -161,7 +163,7 @@ Or use model-level override:
|
|
|
161
163
|
|
|
162
164
|
1. Shows full preview of changes (file path, edit location, JSON to write, risks)
|
|
163
165
|
2. Warns: ① changes affect all sessions using that channel, ② automatic backup created at `models.json.backup-cache-optimizer-<timestamp>`, ③ Pi reload required
|
|
164
|
-
3. Uses comment-preserving surgical editor — existing comments, indentation, key order preserved
|
|
166
|
+
3. Uses comment-preserving surgical editor — existing comments, indentation, and existing key order are preserved
|
|
165
167
|
4. Requires explicit user confirmation (interactive prompt or `ui.select`)
|
|
166
168
|
5. Writes atomically (temp + rename); self-validates after write
|
|
167
169
|
6. Falls back to manual guidance if JSONC scanner cannot confidently locate the target
|
package/README.zh-CN.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
用于提升 Pi 中 provider 侧 KV Cache / Prompt Cache 命中率的扩展:把稳定 prompt 内容前置,给 OpenAI-compatible 请求补保守的 `prompt_cache_key`,提示代理渠道常见缓存路由兼容问题,并在底部显示只读缓存统计。
|
|
10
10
|
|
|
11
|
-
> 本包已从 `pi-deepseek-cache-optimizer`
|
|
11
|
+
> 本包已从 `pi-deepseek-cache-optimizer` 改名。已有底部统计会自动迁移。正常运行时扩展不会触碰你的 `~/.pi/agent/models.json`;只有 `/cache-optimizer fix` 会在展示交互式预览、风险提示并得到明确确认后写入,且会先创建带时间戳的自动备份。
|
|
12
12
|
|
|
13
13
|
## 目录
|
|
14
14
|
|
|
@@ -17,6 +17,8 @@
|
|
|
17
17
|
- [命令](#命令)
|
|
18
18
|
- [持久 Opt-out](#持久-opt-out)
|
|
19
19
|
- [OpenAI-compatible 代理配置](#openai-compatible-代理配置)
|
|
20
|
+
- [Anthropic adaptive thinking 模型](#anthropic-adaptive-thinking-模型)
|
|
21
|
+
- [使用 `/cache-optimizer fix` 自动修复](#使用-cache-optimizer-fix-自动修复)
|
|
20
22
|
- [Footer 统计](#footer-统计)
|
|
21
23
|
- [卸载](#卸载)
|
|
22
24
|
- [验证效果](#验证效果)
|
|
@@ -161,7 +163,7 @@ Pi 内置 catalog 已为官方模型设置此 flag。`models.json` 中覆盖这
|
|
|
161
163
|
|
|
162
164
|
1. 显示完整变更预览(文件路径、编辑位置、要写入的 JSON、风险说明)
|
|
163
165
|
2. 警告:① 修改影响使用该渠道的所有 session,② 自动备份到 `models.json.backup-cache-optimizer-<timestamp>`,③ 需重启 Pi 或 reload
|
|
164
|
-
3. 使用保留注释的精确编辑器 ——
|
|
166
|
+
3. 使用保留注释的精确编辑器 —— 现有注释、缩进和已有 key 顺序都会保留
|
|
165
167
|
4. 需要用户明确确认(交互式提示或 `ui.select`)
|
|
166
168
|
5. 原子写入(temp + rename);写入后自我验证
|
|
167
169
|
6. 如果 JSONC 扫描器无法置信定位目标,回退到手动修改指引
|