b0e81a4af5ea5588d4dd755c526bb346c77c15b2

Author
TheEdgeOfRage <git@theedgeofrage.com>
Committer
TheEdgeOfRage <git@theedgeofrage.com>
Date

Message

Update pi footer to include model and thinking level

Diff

 1diff --git a/dot_pi/agent/extensions/detailed-footer.ts b/dot_pi/agent/extensions/detailed-footer.ts
 2index 04483407e8665d6e0792a06d26bf10cd6da2b78d..d75b80cb87483d6aee63fa85722ed8f0a1339564 100644
 3--- a/dot_pi/agent/extensions/detailed-footer.ts
 4+++ b/dot_pi/agent/extensions/detailed-footer.ts
 5@@ -3,7 +3,11 @@ import type {
 6   ExtensionAPI,
 7   ExtensionContext,
 8 } from "@earendil-works/pi-coding-agent";
 9-import { truncateToWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
10+import {
11+  truncateToWidth,
12+  visibleWidth,
13+  wrapTextWithAnsi,
14+} from "@earendil-works/pi-tui";
15 
16 type Usage = {
17   input?: number;
18@@ -194,15 +198,13 @@ export default function detailedFooter(pi: ExtensionAPI): void {
19         }
20 
21         const model = ctx.model;
22-        let modelLabel =
23-          model === undefined ? "Model: none" : `Model: ${model.id}`;
24-        if (model?.reasoning)
25-          modelLabel += ` • Thinking: ${ctx.thinkingLevel ?? "off"}`;
26-        if (model !== undefined && footerData.getAvailableProviderCount() > 1) {
27-          modelLabel = `Provider: ${model.provider} • ${modelLabel}`;
28-        }
29+        let modelLabel = model?.id ?? "no model";
30+        if (model?.reasoning) modelLabel += ` • ${ctx.thinkingLevel ?? "off"}`;
31 
32         const separator = theme.fg("dim", " • ");
33+        const metricLine = metrics.join(separator);
34+        const modelText = theme.fg("dim", modelLabel);
35+        const modelWidth = visibleWidth(modelText);
36         const lines = [
37           truncateToWidth(
38             theme.fg("dim", location),
39@@ -210,8 +212,15 @@ export default function detailedFooter(pi: ExtensionAPI): void {
40             theme.fg("dim", "..."),
41           ),
42         ];
43-        lines.push(...wrapTextWithAnsi(metrics.join(separator), width));
44-        lines.push(...wrapTextWithAnsi(theme.fg("dim", modelLabel), width));
45+        if (modelWidth + 2 > width) {
46+          lines.push(truncateToWidth(modelText, width));
47+        } else {
48+          const metricsText = truncateToWidth(metricLine, width - modelWidth - 2);
49+          const padding = " ".repeat(
50+            Math.max(2, width - visibleWidth(metricsText) - modelWidth),
51+          );
52+          lines.push(metricsText + padding + modelText);
53+        }
54 
55         const statuses = Array.from(footerData.getExtensionStatuses().entries())
56           .sort(([left], [right]) => left.localeCompare(right))