pi-status-footer 1.0.4 β†’ 1.0.6

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 (3) hide show
  1. package/README.md +20 -15
  2. package/package.json +8 -3
  3. package/stats-footer.ts +191 -40
package/README.md CHANGED
@@ -7,15 +7,15 @@ A compact, zero-config two-line status footer for [pi](https://github.com/earend
7
7
  ![pi-status-footer demo](docs/footer-demo.png)
8
8
 
9
9
  ```
10
- πŸ€– openai/gpt-4o πŸ’­ medium ↑5.2k ↓8.1k ⚑42 t/s πŸ’Ύ63% πŸ“¦38%/128k
11
- πŸ“ my-project β–Έ ξœ₯ main +3 -1 ⏳ 4:32 πŸ’¬ 1:18
10
+ πŸ“¦ 38%/128k πŸ’Ύ 63% ↑5.2k ↓8.1k ⚑42 t/s ⏳ 4:32 πŸ’¬ 1:18 πŸ’° $0.420 +$0.020000
11
+ πŸ“ my-project β–Έ ξœ₯ main +3 -1 πŸ€– openai/ry-very-long-modelid-4o πŸ’­ medium
12
12
  ```
13
13
 
14
- **Line 1 β€” Model & stats:** provider/model, thinking level with themed color, input/output tokens, tokens per second (live while streaming), cache hit rate, context window usage with color-coded fullness (green < 60%, yellow < 80%, red β‰₯ 80%).
14
+ **Line 1 β€” Stats & timers:** context window usage with color-coded fullness (green < 60%, yellow < 80%, red β‰₯ 80%), cache hit rate, input/output tokens, tokens per second (live while streaming), agent run timer (⏳), current turn timer (πŸ’¬), and session cost (πŸ’°) with the current turn's delta.
15
15
 
16
- **Line 2 β€” Project & timers:** repo folder name, git branch, live working-tree diff from HEAD (+N added lines, -M deleted), agent run timer (⏳), current turn timer (πŸ’¬).
16
+ **Line 2 β€” Project & model:** repo folder name, git branch, live working-tree diff from HEAD (+N added lines, -M deleted), provider/model, thinking level with themed color.
17
17
 
18
- Everything auto-fits to your terminal width β€” lower-priority segments drop off when space is tight (model name is always shown, truncated if needed).
18
+ Everything auto-fits to your terminal width. Line 1 always keeps every segment (it clips only on very narrow terminals). On line 2 the model is mandatory: the model id is shortened from the left, keeping the provider and thinking level intact β€” only if even that can't fit does the folder/git group drop off.
19
19
 
20
20
  ## Features
21
21
 
@@ -23,9 +23,11 @@ Everything auto-fits to your terminal width β€” lower-priority segments drop off
23
23
  - **Live TPS** β€” shows tokens/second during generation, stays visible between turns
24
24
  - **Git awareness** β€” asynchronous, debounced `git diff --shortstat HEAD` so typing never blocks; branch changes detected automatically via `footerData.onBranchChange`
25
25
  - **Cache hit rate** β€” percentage of prompt tokens served from cache
26
+ - **Cost, sum + delta** β€” session total with the current turn's cost alongside it, at fixed precision (sum 3 decimals, delta 6) so the segment width never changes and no value is abbreviated into scientific notation; models with no catalog pricing read `n/a` instead of a misleading `$0.00`
26
27
  - **Context gauge** β€” percentage and raw max; shifts from green β†’ yellow β†’ red as you approach the limit
27
28
  - **Thinking level** β€” color-coded to match pi's thinking theme
28
- - **Segments drop gracefully** β€” only the model name is mandatory; everything else fits to width
29
+ - **Responsive model id** β€” shortened from the left (with an `…` marker) when space is tight, so the provider and thinking level stay fully readable; the folder/git group drops only when the model still can't share the line
30
+ - **Line 1 never drops stats** β€” every stat segment always renders; on very narrow terminals the line clips instead
29
31
  - **East Asian safe** β€” explicit ambiguous-width handling for CJK-friendly terminals
30
32
  - **Safe at all times** β€” footer rendering never crashes the TUI, even on edge cases
31
33
 
@@ -46,26 +48,29 @@ After installation, the footer appears automatically on the next pi TUI session.
46
48
 
47
49
  ## Display reference
48
50
 
49
- ### Line 1 β€” Model & stats
51
+ ### Line 1 β€” Stats, cost & timers
50
52
 
51
53
  | Segment | Example | Source |
52
54
  |---|---|---|
53
- | πŸ€– model | `πŸ€– openai/gpt-4o` | `ctx.model.provider / ctx.model.id` |
54
- | πŸ’­ thinking | `πŸ’­ high` | `ctx.thinkingLevel`, themed via `theme.fg()` |
55
+ | πŸ“¦context | `πŸ“¦ 38%/128k` | `ctx.getContextUsage()`, color-coded by percent |
56
+ | πŸ’Ύcache | `πŸ’Ύ 63%` | `cacheRead / (input + cacheRead + cacheWrite)` |
55
57
  | ↑input ↓output | `↑5.2k ↓8.1k` | Session `usage.input / usage.output` (accumulated across all entries) |
56
58
  | ⚑tps | `⚑42 t/s` | Live during generation; last completed rate shown between turns |
57
- | πŸ’Ύcache | `πŸ’Ύ63%` | `cacheRead / (input + cacheRead + cacheWrite)` |
58
- | πŸ“¦context | `πŸ“¦38%/128k` | `ctx.getContextUsage()`, color-coded by percent |
59
+ | ⏳ working | `⏳ 4:32` | Elapsed time since `agent_start`, HH:MM:SS above 1h |
60
+ | πŸ’¬ turn | `πŸ’¬ 1:18` | Elapsed time since last `turn_start` |
61
+ | πŸ’° cost | `πŸ’° $0.420 +$0.020000` | Session sum of `usage.cost.total` across all entries, plus the current turn's delta |
62
+
63
+ Cost notes: the sum accumulates every usage-bearing entry (assistant messages, tool results, compaction, branch summaries) and survives a session resume, since pi persists per-message cost in the session file. The delta is the session cost read at `turn_start` subtracted from the current total, so it never folds the previous turn into the current one. The sum is rounded to 3 decimals and the delta to 6 β€” fixed precision, so the segment width is stable and nothing is ever rendered in scientific notation; a rate that is wrong by 1e6 shows as `$0.000`, which is visibly broken on purpose. A model that declares no catalog pricing (aggregator providers) reports zero cost and renders `n/a`, and a session with no usage at all renders no cost segment. Because the cost segment is last on line 1, it is also the first thing a narrow terminal clips.
59
64
 
60
- ### Line 2 β€” Project & timers
65
+ ### Line 2 β€” Project & model
61
66
 
62
67
  | Segment | Example | Source |
63
68
  |---|---|---|
64
69
  | πŸ“ repo | `πŸ“ my-project` | Git repo root basename (from `ctx.cwd` walk-up) |
65
70
  | β–Έ ξœ₯ branch | `β–Έ ξœ₯ main` | `footerData.getGitBranch()`, auto-updates |
66
71
  | +N -M diff | `+3 -1` | Async `git diff --shortstat HEAD` (1s debounced) |
67
- | ⏳ working | `⏳ 4:32` | Elapsed time since `agent_start`, HH:MM:SS above 1h |
68
- | πŸ’¬ turn | `πŸ’¬ 1:18` | Elapsed time since last `turn_start` |
72
+ | πŸ€– model | `πŸ€– openai/gpt-4o` | `ctx.model.provider / ctx.model.id`, id shortened from the left when narrow |
73
+ | πŸ’­ thinking | `πŸ’­ high` | `ctx.thinkingLevel`, themed via `theme.fg()` |
69
74
 
70
75
  ## How it works
71
76
 
@@ -73,7 +78,7 @@ The extension hooks into six pi lifecycle events:
73
78
 
74
79
  - **`session_start`** β€” registers the footer via `ctx.ui.setFooter()`, discovers repo root, starts branch-change listener
75
80
  - **`agent_start` / `agent_settled`** β€” controls the agent-run timer and a 1-second interval that triggers git diff refresh
76
- - **`turn_start` / `turn_end`** β€” drives the per-turn timer
81
+ - **`turn_start` / `turn_end`** β€” drives the per-turn timer, and snapshots the session cost at `turn_start` as the baseline for the turn's cost delta
77
82
  - **`message_start` / `message_update` / `message_end`** β€” tracks the generation window for live TPS. Most providers only report output-token usage at message end, so `message_update` estimates tokens live from the streamed delta characters (text/thinking/toolcall), calibrated against each message's real usage at `message_end`
78
83
  - **`model_select`** β€” clears stale TPS on model switch
79
84
  - **`session_shutdown`** β€” cleans up all state
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "pi-status-footer",
3
- "version": "1.0.4",
4
- "description": "Compact two-line status footer for pi: model, thinking level, tokens, TPS, cache hit rate, context usage, live git diff, and working/turn timers.",
3
+ "version": "1.0.6",
4
+ "description": "Compact two-line status footer for pi: model, thinking level, tokens, cost, TPS, cache hit rate, context usage, live git diff, and working/turn timers.",
5
5
  "keywords": [
6
6
  "pi-package",
7
7
  "pi",
@@ -14,6 +14,11 @@
14
14
  "tokens",
15
15
  "tps",
16
16
  "tokens-per-second",
17
+ "cost",
18
+ "spend",
19
+ "usd",
20
+ "budget",
21
+ "pricing",
17
22
  "cache",
18
23
  "context",
19
24
  "usage",
@@ -29,7 +34,7 @@
29
34
  "streaming"
30
35
  ],
31
36
  "scripts": {
32
- "test": "node --experimental-strip-types test-live-tps.ts"
37
+ "test": "node --experimental-strip-types test-live-tps.ts && node --experimental-strip-types test-layout.ts && node --experimental-strip-types test-cost.ts"
33
38
  },
34
39
  "license": "MIT",
35
40
  "repository": {
package/stats-footer.ts CHANGED
@@ -48,6 +48,42 @@ export function formatDuration(ms: number): string {
48
48
  return `${minutes}:${pad(seconds)}`;
49
49
  }
50
50
 
51
+ /** Decimals for the session sum and for the per-turn delta. */
52
+ const COST_DECIMALS = 3;
53
+ const COST_DELTA_DECIMALS = 6;
54
+
55
+ /**
56
+ * Session cost in USD, fixed to 3 decimals. Fixed decimals rather than
57
+ * precision that follows the magnitude: the segment width then never changes
58
+ * as the total grows, and the value is never abbreviated away.
59
+ *
60
+ * Fixed decimals also mean no exponential fallback is ever needed. Dividing a
61
+ * rate by 1e6 twice is a real failure mode on this box (it happened), and
62
+ * `$0.000000` is a loud, obviously-broken number, whereas `$3.6e-9` could be
63
+ * read as a plausible price.
64
+ *
65
+ * A zero cost with tokens on the clock means the model carries no catalog
66
+ * pricing (aggregator/custom providers declare no rates, so pi records 0) β€”
67
+ * that is missing data, not a free session, so it reads `n/a`. Before any
68
+ * usage at all it is simply `-`.
69
+ */
70
+ export function formatCost(usd: number, hasTokens = true): string {
71
+ if (!Number.isFinite(usd) || usd < 0) return "n/a";
72
+ if (usd === 0) return hasTokens ? "n/a" : "-";
73
+ return `$${usd.toFixed(COST_DECIMALS)}`;
74
+ }
75
+
76
+ /**
77
+ * Cost added by the current (or last) turn as a `+$x.xxxxxx` suffix, at 6
78
+ * decimals β€” a single wokey turn costs cents, so 3 would quantise the delta
79
+ * to zero. Empty while the turn has not spent anything, so the caller can
80
+ * append it blindly.
81
+ */
82
+ export function formatCostDelta(usd: number): string {
83
+ if (!Number.isFinite(usd) || usd <= 0) return "";
84
+ return `+$${usd.toFixed(COST_DELTA_DECIMALS)}`;
85
+ }
86
+
51
87
  /**
52
88
  * Output tokens per second for an assistant message generation window.
53
89
  * Returns null when too little time has elapsed for a meaningful rate.
@@ -202,24 +238,94 @@ function joinSegments(segments: string[], separator: string): string {
202
238
  return segments.filter(Boolean).join(separator);
203
239
  }
204
240
 
205
- function fitSegments(
206
- segments: string[],
207
- separator: string,
208
- width: number,
241
+ /** Below this terminal width the footer gives up fitting and lets the line
242
+ * overflow (the TUI clips it); shortening arithmetic degenerates here. */
243
+ const MIN_FIT_WIDTH = 50;
244
+
245
+ /**
246
+ * Shorten a model id by dropping leading characters, keeping the trailing
247
+ * part (model ids usually end in the distinguishing version, e.g. `...-4o`).
248
+ * A leading ellipsis marks the cut. Returns "" when nothing fits.
249
+ */
250
+ export function shortenModelId(
251
+ id: string,
252
+ budget: number,
253
+ ellipsis = "…",
209
254
  ): string {
210
- if (width <= 0 || segments.length === 0) return "";
211
- // The first segment (model + thinking level) has top priority. If it
212
- // alone is wider than the terminal, show a truncated prefix of it
213
- // instead of skipping it in favor of lower-priority segments.
214
- if (measureWidth(segments[0]!) > width) {
215
- return truncateSafe(segments[0]!, width, "...");
255
+ if (budget <= 0) return "";
256
+ if (measureWidth(id) <= budget) return id;
257
+ const ellipsisWidth = measureWidth(ellipsis);
258
+ if (budget < ellipsisWidth) return "";
259
+ const chars = Array.from(id);
260
+ for (let start = 0; start < chars.length; start++) {
261
+ const candidate = ellipsis + chars.slice(start).join("");
262
+ if (measureWidth(candidate) <= budget) return candidate;
216
263
  }
217
- const fitted: string[] = [segments[0]!];
218
- for (const segment of segments.slice(1)) {
219
- const candidate = joinSegments([...fitted, segment], separator);
220
- if (measureWidth(candidate) <= width) fitted.push(segment);
264
+ return ellipsis;
265
+ }
266
+
267
+ export interface SecondLineParts {
268
+ /** Folder/branch/diff group; "" when there is no folder to show. */
269
+ gitGroup: string;
270
+ /** Prefix before the provider, e.g. "πŸ€– ". */
271
+ modelPrefix: string;
272
+ /** Provider name; may be "" when no model is selected. */
273
+ provider: string;
274
+ /** Model id, shortened from the left when space is tight. */
275
+ modelId: string;
276
+ /** Everything after the model id, e.g. " πŸ’­ medium". */
277
+ modelSuffix: string;
278
+ /** Between-segment separator. */
279
+ separator: string;
280
+ /** Color wrapper applied to the `provider/id` text. */
281
+ styleModelId?: (text: string) => string;
282
+ }
283
+
284
+ /**
285
+ * Line 2 = folder/git group + model segment. The model (provider + thinking
286
+ * level) is mandatory: when space is tight the model id loses leading
287
+ * characters first, and if even a bare `provider/` cannot share the line the
288
+ * whole git group is dropped.
289
+ */
290
+ export function fitSecondLine(parts: SecondLineParts, width: number): string {
291
+ const {
292
+ gitGroup,
293
+ modelPrefix,
294
+ provider,
295
+ modelId,
296
+ modelSuffix,
297
+ separator,
298
+ styleModelId = (text: string) => text,
299
+ } = parts;
300
+ const providerPrefix = provider ? `${provider}/` : "";
301
+ const fixedWidth =
302
+ measureWidth(modelPrefix) +
303
+ measureWidth(providerPrefix) +
304
+ measureWidth(modelSuffix);
305
+ const buildModel = (budget: number): string | null => {
306
+ if (fixedWidth > budget) return null;
307
+ const idText = shortenModelId(modelId, budget - fixedWidth);
308
+ return `${modelPrefix}${styleModelId(`${providerPrefix}${idText}`)}${modelSuffix}`;
309
+ };
310
+
311
+ const fullModel = buildModel(Number.POSITIVE_INFINITY)!;
312
+ if (width < MIN_FIT_WIDTH) {
313
+ // Too narrow to fit meaningfully β€” render everything and let the TUI clip.
314
+ return joinSegments([gitGroup, fullModel], separator);
221
315
  }
222
- return truncateSafe(joinSegments(fitted, separator), width, "");
316
+ const maxWidth = Math.max(0, width - SAFETY_MARGIN);
317
+ if (!gitGroup) return buildModel(maxWidth) ?? fullModel;
318
+
319
+ const full = joinSegments([gitGroup, fullModel], separator);
320
+ if (measureWidth(full) <= maxWidth) return full;
321
+
322
+ const withGit = buildModel(
323
+ maxWidth - measureWidth(gitGroup) - measureWidth(separator),
324
+ );
325
+ if (withGit !== null) return joinSegments([gitGroup, withGit], separator);
326
+
327
+ // The model alone can't share the line: drop the whole folder/git group.
328
+ return buildModel(maxWidth) ?? fullModel;
223
329
  }
224
330
 
225
331
  /** Walk up from cwd to find the git repo root directory (or null). */
@@ -275,6 +381,23 @@ export default function statsFooter(pi: ExtensionAPI) {
275
381
  let gitDeleted = 0;
276
382
  let gitFetching = false;
277
383
  let lastGitFetch = 0;
384
+ // Session-manager handle, kept so turn_start can read the cumulative cost
385
+ // synchronously (renders are throttled, so a cached total can still be
386
+ // missing the previous turn's final message when a new turn begins).
387
+ let sessionManager: { getEntries(): SessionEntry[] } | null = null;
388
+ // Cumulative session cost at the start of the current turn; the turn's
389
+ // delta is the current cumulative minus this baseline.
390
+ let costAtTurnStart = 0;
391
+
392
+ /** Cumulative session cost right now, read straight from the session. */
393
+ const readSessionCost = (): number => {
394
+ if (sessionManager === null) return 0;
395
+ try {
396
+ return collectSessionStats(sessionManager.getEntries()).usage.cost;
397
+ } catch {
398
+ return 0;
399
+ }
400
+ };
278
401
 
279
402
  const rerender = () => tuiRef?.requestRender();
280
403
  const stopTimer = () => {
@@ -318,6 +441,10 @@ export default function statsFooter(pi: ExtensionAPI) {
318
441
  lastTps = null;
319
442
  deltaChars = 0;
320
443
  sessionCwd = ctx.cwd;
444
+ sessionManager = ctx.sessionManager;
445
+ // Baseline the turn delta at whatever the (possibly resumed) session
446
+ // already spent, so a delta only ever appears once a turn runs.
447
+ costAtTurnStart = readSessionCost();
321
448
  folderName = basename(ctx.cwd);
322
449
  const repoRoot = findRepoRoot(ctx.cwd);
323
450
  repoName = repoRoot === null ? null : basename(repoRoot);
@@ -358,9 +485,6 @@ export default function statsFooter(pi: ExtensionAPI) {
358
485
  else contextColor = "success";
359
486
  }
360
487
 
361
- const modelId = ctx.model
362
- ? `${ctx.model.provider}/${ctx.model.id}`
363
- : "no-model";
364
488
  const thinkingLevel = ctx.thinkingLevel || "off";
365
489
  const contextText =
366
490
  contextPercent === null
@@ -385,34 +509,51 @@ export default function statsFooter(pi: ExtensionAPI) {
385
509
  // TPS: live rate while the current assistant message streams,
386
510
  // falling back to the last completed message's rate so the value
387
511
  // keeps a fixed position instead of flashing only at message_end.
388
- let tpsSuffix = "";
389
512
  const liveTps =
390
513
  genStart !== null && liveOutput > 0
391
514
  ? computeTps(liveOutput, genStart, Date.now())
392
515
  : null;
393
516
  const tpsValue = liveTps ?? lastTps;
394
- tpsSuffix = ` ⚑${Math.round(tpsValue ?? 0)} t/s`;
395
- // Line 1 β€” model + tokens/stats, each segment icon-prefixed.
396
- const statsLine = fitSegments(
517
+ // Cost: session sum plus the current turn's delta. Cost is derived
518
+ // from tokens, and it is the slowest-changing value on the line
519
+ // (it only ticks up at message boundaries), so it goes last: on a
520
+ // narrow terminal the right-edge clip drops the cost before the
521
+ // context/cache/token readouts.
522
+ const spentTokens =
523
+ usage.input + usage.output + usage.cacheRead + usage.cacheWrite;
524
+ const turnCost = Math.max(0, usage.cost - costAtTurnStart);
525
+ const costDelta = formatCostDelta(turnCost);
526
+ const costSegment =
527
+ spentTokens === 0
528
+ ? ""
529
+ : `πŸ’° ${theme.fg("accent", formatCost(usage.cost))}${
530
+ costDelta === "" ? "" : ` ${theme.fg("dim", costDelta)}`
531
+ }`;
532
+ // Line 1 β€” stats only (context, cache, tokens, TPS, timers, cost). Every
533
+ // segment always renders; on very narrow terminals the line overflows
534
+ // and the TUI clips it rather than dropping stats.
535
+ const statsLine = joinSegments(
397
536
  [
398
- `πŸ€– ${theme.fg("accent", modelId)} ${thinkingText}`,
537
+ `πŸ“¦ ${theme.fg(contextColor, contextText)}`,
399
538
  theme.fg(
400
539
  "dim",
401
- `↑${formatTokens(usage.input)} ↓${formatTokens(usage.output)}${tpsSuffix}`,
540
+ `πŸ’Ύ ${cacheRate === null ? "-" : `${cacheRate.toFixed(0)}%`}`,
402
541
  ),
403
542
  theme.fg(
404
543
  "dim",
405
- `πŸ’Ύ ${cacheRate === null ? "-" : `${cacheRate.toFixed(0)}%`}`,
544
+ `↑${formatTokens(usage.input)} ↓${formatTokens(usage.output)}`,
406
545
  ),
407
- `πŸ“¦ ${theme.fg(contextColor, contextText)}`,
546
+ theme.fg("dim", `⚑${Math.round(tpsValue ?? 0)} t/s`),
547
+ `⏳ ${theme.fg("accent", formatDuration(elapsed))}`,
548
+ `πŸ’¬ ${theme.fg("accent", formatDuration(turnElapsed))}`,
549
+ costSegment,
408
550
  ],
409
551
  separator,
410
- Math.max(0, width - SAFETY_MARGIN),
411
552
  );
412
- // Line 2 β€” folder/git status + working/turn timers. The folder
413
- // name always shows (repo root basename, or plain cwd basename
414
- // when not inside a git repo); branch + diff only when git is
415
- // present.
553
+ // Line 2 β€” folder/git status + model/thinking. The folder name
554
+ // always shows (repo root basename, or plain cwd basename when
555
+ // not inside a git repo); branch + diff only when git is present.
556
+ // The model id is shortened from the left before git is dropped.
416
557
  const branch = footerData.getGitBranch();
417
558
  const gitSegments: string[] = [];
418
559
  if (folderName !== null) {
@@ -430,15 +571,18 @@ export default function statsFooter(pi: ExtensionAPI) {
430
571
  gitSegments.push(folderText);
431
572
  }
432
573
  }
433
- // ⏳ = work in progress (whole agent run), πŸ’¬ = current turn.
434
- gitSegments.push(
435
- `⏳ ${theme.fg("accent", formatDuration(elapsed))}`,
436
- `πŸ’¬ ${theme.fg("accent", formatDuration(turnElapsed))}`,
437
- );
438
- const gitLine = fitSegments(
439
- gitSegments,
440
- separator,
441
- Math.max(0, width - SAFETY_MARGIN),
574
+ const gitGroup = joinSegments(gitSegments, separator);
575
+ const gitLine = fitSecondLine(
576
+ {
577
+ gitGroup,
578
+ modelPrefix: "πŸ€– ",
579
+ provider: ctx.model?.provider ?? "",
580
+ modelId: ctx.model?.id ?? "no-model",
581
+ modelSuffix: ` ${thinkingText}`,
582
+ separator,
583
+ styleModelId: (text) => theme.fg("accent", text),
584
+ },
585
+ width,
442
586
  );
443
587
 
444
588
  return [
@@ -479,6 +623,11 @@ export default function statsFooter(pi: ExtensionAPI) {
479
623
  pi.on("turn_start", () => {
480
624
  turnStart = Date.now();
481
625
  lastTurnDuration = 0;
626
+ // Baseline for the turn's cost delta, read from the session rather
627
+ // than reused from the last render: agent_settled requests a render,
628
+ // but that render may not have run yet when the next turn starts,
629
+ // which would fold the previous turn's cost into this one.
630
+ costAtTurnStart = readSessionCost();
482
631
  });
483
632
  pi.on("turn_end", () => {
484
633
  if (turnStart !== null) lastTurnDuration = Date.now() - turnStart;
@@ -496,6 +645,8 @@ export default function statsFooter(pi: ExtensionAPI) {
496
645
  lastTps = null;
497
646
  deltaChars = 0;
498
647
  sessionCwd = null;
648
+ sessionManager = null;
649
+ costAtTurnStart = 0;
499
650
  folderName = null;
500
651
  repoName = null;
501
652
  gitAdded = 0;