pi-cache-optimizer 2.8.17 → 2.8.18
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 +2 -0
- package/README.zh-CN.md +2 -0
- package/index.ts +17 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -110,6 +110,8 @@ Persistent feature settings are managed under the Pi agent directory by the nati
|
|
|
110
110
|
/cache-optimizer config reset
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
`openai-codex-responses` keeps Pi's native skill index even when skill compression is enabled. Real task-level benchmarks with `openai-codex/gpt-6-luna` showed that the shorter Markdown skill index could increase the model's tool-call trajectory and total task cost; Codex therefore keeps the native Pi XML skill list while still benefiting from the optimizer's other cache/runtime features.
|
|
114
|
+
|
|
113
115
|
`config reset` reads the latest disk configuration under the shared transaction lock and removes only persistent feature overrides, preserving the latest footer mode, model-specific prompt-cache-key settings, and file permissions. Invalid JSON/schema, symlinks, non-regular targets, and concurrent manual changes are refused rather than overwritten. These commands do not modify shell startup files or `PI_CACHE_RETENTION`; `enable` and `disable` remain current-process runtime switches.
|
|
114
116
|
|
|
115
117
|
## Opt-in deterministic tool ordering
|
package/README.zh-CN.md
CHANGED
|
@@ -110,6 +110,8 @@ Doctor 显示的 endpoint URL 会移除用户名/密码、查询参数和 fragme
|
|
|
110
110
|
/cache-optimizer config reset
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
对于 `openai-codex-responses`,即使开启 skill compression,也会保留 Pi 原生 skill index。真实 `openai-codex/gpt-6-luna` 任务级 benchmark 表明,较短的 Markdown skill index 虽然减少了单次 prompt,但可能增加模型的工具调用轨迹和最终任务总成本;因此 Codex 保留 Pi 原生 XML skill 列表,同时继续使用本扩展的其他缓存与运行时优化。
|
|
114
|
+
|
|
113
115
|
`config reset` 在共享事务锁内读取最新磁盘配置,只移除持久化 feature 覆盖,保留最新 footer mode、按模型配置的 prompt-cache-key 设置和文件权限。JSON/schema 无效、symlink、非普通文件或并发手动修改时会拒绝覆盖。这些命令不会修改 shell 启动文件或 `PI_CACHE_RETENTION`;`enable` 和 `disable` 仍然是当前进程的运行时开关。
|
|
114
116
|
|
|
115
117
|
## Opt-in 确定性工具排序
|
package/index.ts
CHANGED
|
@@ -1072,9 +1072,16 @@ export default function (pi: ExtensionAPI) {
|
|
|
1072
1072
|
return {};
|
|
1073
1073
|
}
|
|
1074
1074
|
|
|
1075
|
+
// OpenAI Codex/Responses is unusually sensitive to skill-index shape: real
|
|
1076
|
+
// TourStory task benchmarks showed the compressed Markdown index could
|
|
1077
|
+
// lengthen the Pi tool trajectory enough to increase total task cost even
|
|
1078
|
+
// though each request became shorter. Keep Pi's native skill block for the
|
|
1079
|
+
// Codex transport; other providers retain the compression optimization.
|
|
1080
|
+
const codexSkillCompressionBypass = model?.api === "openai-codex-responses";
|
|
1081
|
+
|
|
1075
1082
|
// Skill compression first, as a section edit when Pi supports it (see
|
|
1076
1083
|
// compressSkillsViaSection); the string path below is the fallback.
|
|
1077
|
-
const skillsViaSection = compressSkillsViaSection(event);
|
|
1084
|
+
const skillsViaSection = codexSkillCompressionBypass ? false : compressSkillsViaSection(event);
|
|
1078
1085
|
|
|
1079
1086
|
// Strip per-turn churn from <session-overview>.
|
|
1080
1087
|
// Removing RECENT COMMITS, Working directory status, and
|
|
@@ -1088,14 +1095,18 @@ export default function (pi: ExtensionAPI) {
|
|
|
1088
1095
|
// (Pi < 0.86, or a forced prompt from an earlier handler). Deterministic from the same `event.systemPromptOptions.skills`,
|
|
1089
1096
|
// so cache stability is unchanged. No-op if opted out, below
|
|
1090
1097
|
// SKILL_COMPRESSION_MIN_COUNT, or if pi emitted a format we don't recognize.
|
|
1091
|
-
const compressedPrompt =
|
|
1092
|
-
strippedPrompt
|
|
1093
|
-
|
|
1094
|
-
|
|
1098
|
+
const compressedPrompt = codexSkillCompressionBypass
|
|
1099
|
+
? strippedPrompt
|
|
1100
|
+
: compressSkillsInSystemPrompt(
|
|
1101
|
+
strippedPrompt,
|
|
1102
|
+
event.systemPromptOptions,
|
|
1103
|
+
);
|
|
1095
1104
|
// With a section edit and nothing to strip, Pi renders the compressed prompt
|
|
1096
1105
|
// itself and no forced prompt is returned.
|
|
1097
1106
|
recordSkillCompressionOutcome(
|
|
1098
|
-
|
|
1107
|
+
codexSkillCompressionBypass
|
|
1108
|
+
? { applied: false, reason: "OpenAI Codex uses Pi's native skill index to preserve task trajectory", visibleSkills, at: Date.now() }
|
|
1109
|
+
: skillsViaSection
|
|
1099
1110
|
? { applied: "section", visibleSkills, at: Date.now() }
|
|
1100
1111
|
: compressedPrompt !== strippedPrompt
|
|
1101
1112
|
? { applied: "string", visibleSkills, at: Date.now() }
|
package/package.json
CHANGED