@agnishc/edb-global-footer 0.14.2 → 0.15.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/footer.ts +7 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agnishc/edb-global-footer",
3
- "version": "0.14.2",
3
+ "version": "0.15.1",
4
4
  "description": "Pi extension: two-line status footer showing path, git branch, token usage, and model",
5
5
  "keywords": [
6
6
  "pi-package",
package/src/footer.ts CHANGED
@@ -109,6 +109,7 @@ export function createFooterRenderer(
109
109
  let totalCacheRead = 0;
110
110
  let totalCacheWrite = 0;
111
111
  let totalCost = 0;
112
+ let latestCacheHitRate: number | undefined;
112
113
 
113
114
  for (const entry of ctx.sessionManager.getEntries()) {
114
115
  if (entry.type === "message" && entry.message.role === "assistant") {
@@ -119,12 +120,14 @@ export function createFooterRenderer(
119
120
  totalCacheRead += msg.usage.cacheRead;
120
121
  totalCacheWrite += msg.usage.cacheWrite;
121
122
  totalCost += msg.usage.cost.total;
123
+ const promptTokens = msg.usage.input + msg.usage.cacheRead + msg.usage.cacheWrite;
124
+ latestCacheHitRate = promptTokens > 0 ? (msg.usage.cacheRead / promptTokens) * 100 : undefined;
122
125
  }
123
126
  }
124
127
 
125
128
  // Build three groups separated by pipes
126
129
  // Group 1: ↑input ↓output
127
- // Group 2: Rcache Wcache $cost
130
+ // Group 2: Rcache Wcache CH% $cost
128
131
  // Group 3: context%
129
132
  const { tps } = tpsState;
130
133
  const showTps = tps > 0;
@@ -139,6 +142,9 @@ export function createFooterRenderer(
139
142
  const group2Parts: string[] = [];
140
143
  if (totalCacheRead) group2Parts.push(`${iconCacheRead}${formatTokens(totalCacheRead)}`);
141
144
  if (totalCacheWrite) group2Parts.push(`${iconCacheWrite}${formatTokens(totalCacheWrite)}`);
145
+ if ((totalCacheRead > 0 || totalCacheWrite > 0) && latestCacheHitRate !== undefined) {
146
+ group2Parts.push(`CH${latestCacheHitRate.toFixed(1)}%`);
147
+ }
142
148
  const usingSubscription = ctx.model ? ctx.modelRegistry.isUsingOAuth(ctx.model) : false;
143
149
  if (totalCost || usingSubscription) {
144
150
  group2Parts.push(`$${totalCost.toFixed(3)}${usingSubscription ? " (sub)" : ""}`);