pi-cache-optimizer 2.7.0 → 2.7.1

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
@@ -71,7 +71,7 @@ This extension is validated against Pi 0.83.0 and remains designed for Pi 0.82+.
71
71
  | `/cache-optimizer config footer-mode session\|total` | Persist the footer stats mode. Persistent command configuration overrides the environment variable. |
72
72
  | `/cache-optimizer fix` | Auto-repairs safe compat issues for the active model (adaptive thinking, DeepSeek reasoning, OpenAI proxy session affinity). Shows preview + risk warning, requires confirmation. **Only modifies `models.json` after explicit user approval.** |
73
73
 
74
- `enable` / `disable` are current-process switches. For a persistent opt-out, use environment variables below.
74
+ The interactive `/cache-optimizer` menu includes `Footer mode`, where you can choose `total` or `session`. `enable` / `disable` are current-process switches. For a persistent opt-out, use environment variables below.
75
75
 
76
76
  ## Persistent opt-out
77
77
 
@@ -84,7 +84,7 @@ This extension is validated against Pi 0.83.0 and remains designed for Pi 0.82+.
84
84
 
85
85
  ## Footer cache stats mode
86
86
 
87
- **v2.7.0+** supports both daily cumulative and current-session footer scopes. The footer defaults to `total`, which shows the provider/model's local counters for the current day across Pi sessions and process restarts. Use either the command or environment variable to select the scope:
87
+ **v2.7.0+** supports both daily cumulative and current-session footer scopes. **v2.7.1** adds the Footer mode option to the interactive `/cache-optimizer` menu. The footer defaults to `total`, which shows the provider/model's local counters for the current day across Pi sessions and process restarts. Use either the command or environment variable to select the scope:
88
88
 
89
89
  | Value | Effect |
90
90
  |---|---|
package/README.zh-CN.md CHANGED
@@ -71,7 +71,7 @@ Pi 0.79.7 及之后,`pi update` 默认只更新 Pi 本体。若要更新已安
71
71
  | `/cache-optimizer config footer-mode session\|total` | 持久设置 footer 统计模式;持久命令配置优先于环境变量。 |
72
72
  | `/cache-optimizer fix` | 为当前模型自动修复安全的 compat 问题(adaptive thinking、DeepSeek reasoning、OpenAI proxy session affinity)。展示预览 + 风险提示,需要用户确认。**仅在用户明确批准后才修改 `models.json`。** |
73
73
 
74
- `enable` / `disable` 是当前进程内开关。若要持久关闭某些能力,请使用下面的环境变量。
74
+ 交互式 `/cache-optimizer` 菜单包含 `Footer mode`,可以选择 `total` 或 `session`。`enable` / `disable` 是当前进程内开关。若要持久关闭某些能力,请使用下面的环境变量。
75
75
 
76
76
  ## 持久 Opt-out
77
77
 
@@ -84,7 +84,7 @@ Pi 0.79.7 及之后,`pi update` 默认只更新 Pi 本体。若要更新已安
84
84
 
85
85
  ## Footer 缓存统计模式
86
86
 
87
- **v2.7.0+** 同时支持每日累计与当前 session 两种 footer 统计范围。Footer 默认使用 `total`,显示当前本地日期内、跨 Pi session 和进程重启延续的 provider/model 统计。可以通过命令或环境变量切换显示范围:
87
+ **v2.7.0+** 同时支持每日累计与当前 session 两种 footer 统计范围。**v2.7.1** 在交互式 `/cache-optimizer` 菜单中加入了 Footer mode 选项。Footer 默认使用 `total`,显示当前本地日期内、跨 Pi session 和进程重启延续的 provider/model 统计。可以通过命令或环境变量切换显示范围:
88
88
 
89
89
  | 值 | 作用 |
90
90
  |---|---|
package/index.ts CHANGED
@@ -8074,6 +8074,7 @@ export default function (pi: ExtensionAPI) {
8074
8074
  "Stats — Show cache stats and trend",
8075
8075
  "Compat — Show compat suggestion",
8076
8076
  "Fix — Auto-fix compat issues (writes models.json)",
8077
+ "Footer mode — Choose total or current-session footer stats",
8077
8078
  "Reset — Reset local provider/model stats",
8078
8079
  "Cancel",
8079
8080
  ];
@@ -8256,6 +8257,31 @@ export default function (pi: ExtensionAPI) {
8256
8257
  );
8257
8258
  }
8258
8259
  } else if (choice === menuOptions[6]) {
8260
+ const modeOptions = ["total — Daily cumulative totals (default)", "session — Current Pi session only", "Cancel"];
8261
+ const modeChoice = await cmdCtx.ui.select("Footer cache stats mode", modeOptions);
8262
+ const nextMode = modeChoice === modeOptions[0]
8263
+ ? "total"
8264
+ : modeChoice === modeOptions[1]
8265
+ ? "session"
8266
+ : undefined;
8267
+ if (nextMode) {
8268
+ try {
8269
+ await writePersistedFooterMode(nextMode);
8270
+ persistedFooterStatsMode = nextMode;
8271
+ lastStatusText = undefined;
8272
+ await publishStatus(cmdCtx as unknown as ExtensionContext, model);
8273
+ cmdCtx.ui.notify(
8274
+ `✅ Footer mode set to ${nextMode}. Persistent config overrides ${FOOTER_MODE_ENV}.`,
8275
+ "info",
8276
+ );
8277
+ } catch (error) {
8278
+ cmdCtx.ui.notify(
8279
+ `❌ Could not update footer mode config: ${error instanceof Error ? error.message : String(error)}`,
8280
+ "error",
8281
+ );
8282
+ }
8283
+ }
8284
+ } else if (choice === menuOptions[7]) {
8259
8285
  if (!model) {
8260
8286
  cmdCtx.ui.notify("No active model selected. Select a model first with /model or pi --model.", "warning");
8261
8287
  } else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-cache-optimizer",
3
- "version": "2.7.0",
3
+ "version": "2.7.1",
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",