@henryqw/pi-footer 2.2.0 → 2.2.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 +1 -1
- package/extensions/footer.ts +8 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ pi-harness · clear-field-f8d2 [+2 ~3 ?1 ↑2] · PR #123 · approved Codex #
|
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
- The first line shows the repository, branch, Git state, and `pi-pr` pull request status beside the checkout identity. The `pi-multi-codex` quota status, when non-empty, occupies the right side. Linked-worktree branches drop the generated `worktree/` prefix.
|
|
33
|
-
- The second line shows cumulative input tokens, output tokens, latest cache-hit rate, and tokens per second for the most recent assistant response. The rate is timed from the response's first streamed content to its
|
|
33
|
+
- The second line shows cumulative input tokens, output tokens, latest cache-hit rate, and tokens per second for the most recent assistant response. The rate is timed from the response's first streamed content to its last, so request latency, time to first token, and provider work after the stream ends (such as Claude bridge shutting down Claude Code) are excluded. A response that arrives without streamed content, or all at once, shows `—`. It also shows estimated cost and context usage. Totals include reported tool usage and finished `pi-subagent` background workflows. The active model and thinking level are right-aligned. Under a virtual model, the physical model and thinking level of the latest successful response follow an arrow, for example `auto • high → gpt-5.6-luna • medium`, matching Pi's built-in footer.
|
|
34
34
|
- The third line shows a compact CodeGraph badge first when loaded: `✓ CG` indexed, `● CG` in use, `◐ CG` checking or indexing, `○ CG` missing, `! CG` setup problem, or `? CG` unknown state. Its icon uses the active theme's state color; `CG` remains plain so the badge is readable without color. When pi-codegraph is not loaded, no badge appears. A middle dot separates the CodeGraph badge from other extension statuses; cumulative agent-work time stays on the right, beneath the active model.
|
|
35
35
|
|
|
36
36
|
Git badges appear only when action is needed:
|
package/extensions/footer.ts
CHANGED
|
@@ -310,16 +310,20 @@ export default function footerExtension(pi: ExtensionAPI): void {
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
let tps: number | undefined;
|
|
313
|
-
//
|
|
313
|
+
// Measure first to last streamed update: providers emit message_start before the first token,
|
|
314
|
+
// and some (Claude bridge) emit message_end only after post-stream teardown.
|
|
314
315
|
let assistantStartedAt: number | undefined;
|
|
316
|
+
let assistantLastUpdateAt: number | undefined;
|
|
315
317
|
pi.on("message_update", async (event) => {
|
|
316
|
-
if (event.message.role
|
|
318
|
+
if (event.message.role !== "assistant") return;
|
|
319
|
+
assistantLastUpdateAt = performance.now();
|
|
320
|
+
assistantStartedAt ??= assistantLastUpdateAt;
|
|
317
321
|
});
|
|
318
322
|
pi.on("message_end", async (event) => {
|
|
319
323
|
if (event.message.role !== "assistant") return;
|
|
320
324
|
const output = event.message.usage?.output ?? 0;
|
|
321
|
-
const seconds = assistantStartedAt === undefined ? 0 : (
|
|
322
|
-
assistantStartedAt = undefined;
|
|
325
|
+
const seconds = assistantStartedAt === undefined ? 0 : (assistantLastUpdateAt! - assistantStartedAt) / 1000;
|
|
326
|
+
assistantStartedAt = assistantLastUpdateAt = undefined;
|
|
323
327
|
tps = seconds > 0 ? output / seconds : undefined;
|
|
324
328
|
});
|
|
325
329
|
|