pi-cache-optimizer 2.2.0 → 2.3.0

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
@@ -40,6 +40,19 @@ This release keeps the original DeepSeek behavior and adds read-only stats adapt
40
40
 
41
41
  Generic OpenAI-compatible proxies are **not** treated as OpenAI-family just because they use an OpenAI-shaped API or provider id. If the active model id/name is ambiguous, the extension hides the footer stats instead of guessing.
42
42
 
43
+ ## Platform support
44
+
45
+ This extension is pure Node.js — no shell exec, no native bindings, no platform-specific paths — so it runs on every OS Pi itself supports:
46
+
47
+ | OS | Notes |
48
+ |---|---|
49
+ | Linux | Native. |
50
+ | macOS | Native. |
51
+ | Windows | Works through the bash shell Pi requires on Windows (Git Bash, Cygwin, MSYS2, or WSL). See Pi's [Windows setup](https://github.com/earendil-works/pi-coding-agent/blob/main/docs/windows.md). |
52
+ | Termux / Android | Works inside Pi's Termux setup. |
53
+
54
+ State files under `~/.pi/agent/` are resolved via Node's `os.homedir()`, so on Windows the path automatically expands to `C:\Users\<you>\.pi\agent\...`. All shell snippets in this README are bash, matching the shell Pi runs in on every supported platform; no PowerShell or `cmd.exe` translation is needed when commands are executed inside (or for) Pi.
55
+
43
56
  ## Quickstart
44
57
 
45
58
  1. (Optional but recommended) Read the official Pi + DeepSeek onboarding guide: [`pi_mono.zh-CN.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/pi_mono.zh-CN.md). It covers Pi installation and core configuration.
package/README.zh-CN.md CHANGED
@@ -43,6 +43,19 @@
43
43
 
44
44
  Generic OpenAI-compatible 代理**不会**仅因为使用 OpenAI 形状 API 或 provider id 就被当作 OpenAI-family。如果当前 model id/name 语义不明确,扩展会隐藏底部统计,而不是猜测。
45
45
 
46
+ ## 平台支持
47
+
48
+ 本扩展是纯 Node.js 实现 —— 不调用 shell、没有原生绑定、不写死平台相关路径 —— 因此与 Pi 自身保持一致,支持以下系统:
49
+
50
+ | 操作系统 | 说明 |
51
+ |---|---|
52
+ | Linux | 原生支持。 |
53
+ | macOS | 原生支持。 |
54
+ | Windows | 通过 Pi 在 Windows 下要求的 bash shell 运行(Git Bash、Cygwin、MSYS2 或 WSL)。详见 Pi 的 [Windows setup](https://github.com/earendil-works/pi-coding-agent/blob/main/docs/windows.md)。 |
55
+ | Termux / Android | 在 Pi 的 Termux 环境中可用。 |
56
+
57
+ 状态文件 `~/.pi/agent/` 通过 Node 的 `os.homedir()` 解析,所以在 Windows 上会自动展开为 `C:\Users\<你>\.pi\agent\...`。本文档中所有 shell 命令均使用 bash 语法,与 Pi 在每个受支持平台下运行的 shell 一致;只要在 Pi 内(或为 Pi 而执行)运行,就**不需要**改写为 PowerShell 或 `cmd.exe` 形式。
58
+
46
59
  ## 快速开始
47
60
 
48
61
  1. (可选但推荐)先读一遍官方 Pi + DeepSeek 接入指南:[`pi_mono.zh-CN.md`](https://github.com/deepseek-ai/awesome-deepseek-agent/blob/main/docs/pi_mono.zh-CN.md)。它讲了 Pi 安装与基础配置。
package/index.ts CHANGED
@@ -1433,6 +1433,40 @@ export default function (pi: ExtensionAPI) {
1433
1433
  });
1434
1434
 
1435
1435
  pi.on("before_agent_start", async (event, _ctx) => {
1436
+ // ────────────────────────────────────────────────────────────────
1437
+ // OpenAI Responses API bypass (codex-responses + responses)
1438
+ //
1439
+ // OpenAI's Responses API endpoints — both the Codex backend
1440
+ // (openai-codex-responses, chatgpt.com) and the public
1441
+ // Responses API (openai-responses, api.openai.com / Copilot) —
1442
+ // have two properties that make client-side prompt reordering
1443
+ // unnecessary and potentially harmful:
1444
+ //
1445
+ // 1. Server-managed caching: both APIs send `prompt_cache_key`
1446
+ // (= Pi session id) in every request body, so the server
1447
+ // already maintains a stable cache without prefix ordering.
1448
+ // Client-side reordering adds no cache benefit.
1449
+ //
1450
+ // 2. Stricter content-safety filtering: the Codex backend in
1451
+ // particular has a product-level safety filter that flags
1452
+ // reordered prompts (tool snippets / guidelines lifted above
1453
+ // the assistant role) as potential prompt-injection, returning
1454
+ // `content_filter` and blocking tool calls (notably
1455
+ // `subagent`). The public Responses API shares the same
1456
+ // filter framework and could behave similarly.
1457
+ //
1458
+ // We therefore skip ALL prompt modifications (churn strip, skill
1459
+ // compression, reorder) for these APIs. Third-party providers
1460
+ // that use openai-completions are unaffected.
1461
+ // ────────────────────────────────────────────────────────────────
1462
+ const model = _ctx.model;
1463
+ if (model) {
1464
+ const api = lower(model.api);
1465
+ if (api === "openai-codex-responses" || api === "openai-responses") {
1466
+ return {};
1467
+ }
1468
+ }
1469
+
1436
1470
  // Step 1: strip per-turn churn from <session-overview>.
1437
1471
  // Removing RECENT COMMITS, Working directory status, and
1438
1472
  // Journal line count makes more of the session-overview stable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-cache-optimizer",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "description": "Pi extension that improves provider-side KV/prompt cache hit rates (DeepSeek, OpenAI, Claude, Gemini) by reordering the system prompt, requesting long retention, and showing footer cache stats. Renamed from pi-deepseek-cache-optimizer.",
5
5
  "keywords": [
6
6
  "pi-package",