@henryqw/pi-footer 4.1.2 → 4.1.3
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/extensions/footer.ts +4 -2
- package/package.json +1 -1
package/extensions/footer.ts
CHANGED
|
@@ -15,6 +15,8 @@ const THINKING_COLORS = {
|
|
|
15
15
|
const QUOTA_STATUS_KEY = "pi-multi-codex";
|
|
16
16
|
const AGENT_TIME_ENTRY = "pi-footer:agent-work";
|
|
17
17
|
const SUBAGENT_BACKGROUND_RESULT = "subagent-background-result";
|
|
18
|
+
// Shorter windows are bursts (non-streamed fallbacks, one large chunk) or too coarse to time.
|
|
19
|
+
const MIN_TPS_WINDOW_MS = 250;
|
|
18
20
|
/** Pi's VIRTUAL_MODEL_API: catalog entries that route each request to a physical model. */
|
|
19
21
|
const VIRTUAL_MODEL_API = "pi-virtual";
|
|
20
22
|
|
|
@@ -284,9 +286,9 @@ export default function footerExtension(pi: ExtensionAPI): void {
|
|
|
284
286
|
pi.on("message_end", (event) => {
|
|
285
287
|
if (event.message.role !== "assistant") return;
|
|
286
288
|
const output = event.message.usage?.output ?? 0;
|
|
287
|
-
const
|
|
289
|
+
const milliseconds = assistantStartedAt === undefined ? 0 : assistantLastUpdateAt! - assistantStartedAt;
|
|
288
290
|
assistantStartedAt = assistantLastUpdateAt = undefined;
|
|
289
|
-
tps =
|
|
291
|
+
tps = milliseconds >= MIN_TPS_WINDOW_MS ? output / (milliseconds / 1000) : undefined;
|
|
290
292
|
});
|
|
291
293
|
|
|
292
294
|
// Session entries are append-only; the leaf also changes on tree navigation.
|