@erichll/pi-statusline 0.6.0 → 0.7.0
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/CHANGELOG.md +25 -0
- package/README.md +10 -8
- package/examples/statusline.json +4 -0
- package/package.json +1 -1
- package/src/config.ts +3 -2
- package/src/panel.ts +1 -1
- package/src/render.ts +9 -8
- package/src/runtime-render.ts +18 -12
- package/src/session.ts +3 -0
- package/src/types.ts +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.7.0 - 2026-10-17
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add a `toolTotal` segment on the runtime row, enabled by default: the number
|
|
8
|
+
of tool calls recorded in the whole session (` 128`; `⚒` in Unicode and
|
|
9
|
+
`tool:` in ASCII icon modes), between session age and tokens. Unlike the tool
|
|
10
|
+
row, which counts the current run, it is read from session entries, so it
|
|
11
|
+
survives reloads and resuming and covers every run. It is hidden at zero and
|
|
12
|
+
is the first of these three segments to fold on narrow rows. Existing segment
|
|
13
|
+
lists gain it before `tokens` unless they list it explicitly.
|
|
14
|
+
|
|
15
|
+
## 0.6.1 - 2026-10-16
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- Mute the runtime row so it no longer competes with the editor: the duration,
|
|
20
|
+
run metrics, session age and tokens use Pi's muted color, and the running
|
|
21
|
+
(`●`) and done (`✓`) symbols are muted too. Only problems stay colored: a
|
|
22
|
+
failed run (`✗`), `awaiting input`, `no content`, `compacting…`, compaction
|
|
23
|
+
failures and cache below 50%. Cache is no longer green from 80%. Explicit
|
|
24
|
+
`session`/`tokens` segment colors still apply.
|
|
25
|
+
- Show run counts label first, like `avg` and `cache`: `turns 4` and
|
|
26
|
+
`compactions 1` instead of `4 turns` and `1 compaction`.
|
|
27
|
+
|
|
3
28
|
## 0.6.0 - 2026-10-16
|
|
4
29
|
|
|
5
30
|
### Added
|
package/README.md
CHANGED
|
@@ -6,12 +6,12 @@ activity and live configuration preview. Leaves the editor intact.
|
|
|
6
6
|
```text
|
|
7
7
|
Example model(high) █░░░░░░░░░ 11.9% pi-packages main ● *2 ↑2
|
|
8
8
|
◐ bash npm test 12s · ✓ read ×5 · ✓ edit ×2
|
|
9
|
-
● 5m 42s · avg 45 tok/s · cache 86% · 3
|
|
9
|
+
● 5m 42s · avg 45 tok/s · cache 86% · turns 3 · compactions 1 · 2h 6m · 128 · 49.4k
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
Rows, top to bottom: the main segments, tool activity for the current run
|
|
13
|
-
(only once it has used tools), then run status, run metrics, session age
|
|
14
|
-
tokens, and other extensions' statuses.
|
|
13
|
+
(only once it has used tools), then run status, run metrics, session age,
|
|
14
|
+
tool calls and tokens, and other extensions' statuses.
|
|
15
15
|
|
|
16
16
|
## Install
|
|
17
17
|
|
|
@@ -82,6 +82,7 @@ Available segments:
|
|
|
82
82
|
| `directory` | Current directory | On |
|
|
83
83
|
| `git` | Branch, dirty/conflict state, staged/unstaged/untracked counts, ahead/behind | On |
|
|
84
84
|
| `session` | Time since the session was created, on the bottom row | On |
|
|
85
|
+
| `toolTotal` | Tool calls recorded in the whole session (` 128`), on the bottom row; hidden at zero | On |
|
|
85
86
|
| `tokens` | Cumulative session tokens, on the bottom row | On |
|
|
86
87
|
| `cost` | Pi-recorded cumulative USD cost | Off |
|
|
87
88
|
| `input`, `output`, `cacheRead`, `cacheWrite` | Individual session token counters | Off |
|
|
@@ -89,8 +90,8 @@ Available segments:
|
|
|
89
90
|
|
|
90
91
|
`segments` is an ordered array of
|
|
91
92
|
`{ id, enabled, icon?, color?, iconColor?, background? }`. Omitted segments are
|
|
92
|
-
disabled, **except `quota` and `
|
|
93
|
-
gain `quota` after `context
|
|
93
|
+
disabled, **except `quota`, `session` and `toolTotal`**: old configurations automatically
|
|
94
|
+
gain `quota` after `context`, and `session` and `toolTotal` before `tokens` (or at the end when
|
|
94
95
|
the anchor is absent). To keep one off, include it with `"enabled": false`.
|
|
95
96
|
|
|
96
97
|
Colors accept `#RRGGBB` or supported Pi theme tokens such as `accent`, `muted`,
|
|
@@ -144,9 +145,10 @@ or RPM/TPM rate limit.
|
|
|
144
145
|
- The bottom row starts with the run status (`●` running, `✓` done, `✗` failed,
|
|
145
146
|
`⊘` cancelled) and its duration, which spans retries, tools, UI waits and
|
|
146
147
|
compaction. `avg` is assistant output tokens / total run seconds, **not
|
|
147
|
-
inference speed**; `cache` is cache-read / (input + cache-read + cache-write)
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
inference speed**; `cache` is cache-read / (input + cache-read + cache-write).
|
|
149
|
+
`turns` counts Pi turns, not upstream requests; `compactions` counts
|
|
150
|
+
successful session entries. The row stays muted; only a failed run, waits,
|
|
151
|
+
compaction problems and cache below 50% are colored.
|
|
150
152
|
- The run duration (to the second) covers one run, from your message until the
|
|
151
153
|
agent settles, across all its turns. The session age (` 2h 6m`, to the
|
|
152
154
|
minute) counts from the session header's creation time: it survives reloads
|
package/examples/statusline.json
CHANGED
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -10,7 +10,7 @@ export function validColor(value: unknown): value is ColorValue {
|
|
|
10
10
|
return typeof value === "string" && (/^#[\da-f]{6}$/i.test(value) || (COLORS as readonly string[]).includes(value));
|
|
11
11
|
}
|
|
12
12
|
export function presetConfig(): StatuslineConfig {
|
|
13
|
-
const enabled = new Set<string>(["model", "thinking", "directory", "git", "context", "quota", "session", "tokens", "statuses"]);
|
|
13
|
+
const enabled = new Set<string>(["model", "thinking", "directory", "git", "context", "quota", "session", "toolTotal", "tokens", "statuses"]);
|
|
14
14
|
return {
|
|
15
15
|
version: 1, enabled: true, preset: "powerline", icons: "nerd",
|
|
16
16
|
separator: "powerline", pathMode: "basename", modelDisplay: "name", contextDisplay: "bar", spacing: 1,
|
|
@@ -80,7 +80,7 @@ export function parseConfig(raw: unknown): StatuslineConfig {
|
|
|
80
80
|
return result;
|
|
81
81
|
});
|
|
82
82
|
// Upgrade older lists once with segments added later; an explicit entry (including disabled) wins.
|
|
83
|
-
const insert = (id: "quota" | "session", index: number) => {
|
|
83
|
+
const insert = (id: "quota" | "session" | "toolTotal", index: number) => {
|
|
84
84
|
if (seen.has(id)) return;
|
|
85
85
|
config.segments.splice(index < 0 ? config.segments.length : index, 0, { id, enabled: true });
|
|
86
86
|
seen.add(id);
|
|
@@ -88,6 +88,7 @@ export function parseConfig(raw: unknown): StatuslineConfig {
|
|
|
88
88
|
const contextIndex = config.segments.findIndex((segment) => segment.id === "context");
|
|
89
89
|
insert("quota", contextIndex < 0 ? -1 : contextIndex + 1);
|
|
90
90
|
insert("session", config.segments.findIndex((segment) => segment.id === "tokens"));
|
|
91
|
+
insert("toolTotal", config.segments.findIndex((segment) => segment.id === "tokens"));
|
|
91
92
|
// All other omissions remain editable but disabled.
|
|
92
93
|
for (const id of SEGMENT_IDS) if (!seen.has(id)) config.segments.push({ id, enabled: false });
|
|
93
94
|
}
|
package/src/panel.ts
CHANGED
|
@@ -64,7 +64,7 @@ export class StatuslinePanel implements Component, Focusable {
|
|
|
64
64
|
{ value: "modelDisplay", label: `Model display: ${this.draft.modelDisplay}`, description: "name: display name · last: final model ID component" },
|
|
65
65
|
{ value: "contextDisplay", label: `Context display: ${this.draft.contextDisplay}`, description: "text: tokens/capacity(percent) · bar: progress and percent" },
|
|
66
66
|
{ value: "spacing", label: `Spacing above statusline: ${this.draft.spacing}`, description: "Blank lines between the input box and the statusline (0–3)" },
|
|
67
|
-
...this.draft.segments.filter((segment) => segment.id !== "thinking").map((segment) => ({ value: `segment:${segment.id}`, label: `[${segment.enabled ? "x" : " "}] ${segment.id}`, description: segment.id === "statuses" || segment.id === "session" || segment.id === "tokens" ? "Runtime row · Space toggles, Enter edits" : segment.id === "quota" ? "Subscription Usage · passive headers/events; hidden without data" : "Space toggles · Alt+Up/Down reorders · Enter edits" })),
|
|
67
|
+
...this.draft.segments.filter((segment) => segment.id !== "thinking").map((segment) => ({ value: `segment:${segment.id}`, label: `[${segment.enabled ? "x" : " "}] ${segment.id}`, description: segment.id === "statuses" || segment.id === "session" || segment.id === "toolTotal" || segment.id === "tokens" ? "Runtime row · Space toggles, Enter edits" : segment.id === "quota" ? "Subscription Usage · passive headers/events; hidden without data" : "Space toggles · Alt+Up/Down reorders · Enter edits" })),
|
|
68
68
|
{ value: "runtime", label: "Runtime options" },
|
|
69
69
|
{ value: "save", label: "Save and apply globally" },
|
|
70
70
|
{ value: "reset", label: "Restore defaults in preview" },
|
package/src/render.ts
CHANGED
|
@@ -13,9 +13,9 @@ export type RenderTheme = Pick<Theme, "style" | "colors" | "appearance">;
|
|
|
13
13
|
// Keep rainbow hues independent of semantic theme colors, which can repeat.
|
|
14
14
|
const THINKING_RAINBOW = ["#c084fc", "#f472b6", "#fb923c", "#facc15", "#4ade80", "#22d3ee", "#60a5fa"].map((value) => parseColor(value));
|
|
15
15
|
const ICONS: Record<StatuslineConfig["icons"], Partial<Record<SegmentId, string>>> = {
|
|
16
|
-
unicode: { model: "", directory: "▸", git: "⑂", context: "◉", cost: "$", input: "↑", output: "↓", session: "◷", tokens: "Σ", cacheRead: "R", cacheWrite: "W" },
|
|
17
|
-
nerd: { model: "", directory: "", git: "", context: "", quota: "", cost: "$", input: "↑", output: "↓", session: "", tokens: "", cacheRead: "R", cacheWrite: "W" },
|
|
18
|
-
ascii: { model: "", directory: "", git: "git:", context: "ctx:", cost: "$", input: "in:", output: "out:", session: "ses:", tokens: "tok:", cacheRead: "R:", cacheWrite: "W:" },
|
|
16
|
+
unicode: { model: "", directory: "▸", git: "⑂", context: "◉", cost: "$", input: "↑", output: "↓", session: "◷", toolTotal: "⚒", tokens: "Σ", cacheRead: "R", cacheWrite: "W" },
|
|
17
|
+
nerd: { model: "", directory: "", git: "", context: "", quota: "", cost: "$", input: "↑", output: "↓", session: "", toolTotal: "", tokens: "", cacheRead: "R", cacheWrite: "W" },
|
|
18
|
+
ascii: { model: "", directory: "", git: "git:", context: "ctx:", cost: "$", input: "in:", output: "out:", session: "ses:", toolTotal: "tool:", tokens: "tok:", cacheRead: "R:", cacheWrite: "W:" },
|
|
19
19
|
};
|
|
20
20
|
const DROP_ORDER: SegmentId[] = ["cost", "cacheWrite", "cacheRead", "output", "input", "thinking", "git", "directory"];
|
|
21
21
|
export function formatTokens(value: number): string {
|
|
@@ -79,6 +79,7 @@ function segmentText(id: SegmentId, data: StatuslineSnapshot, config: Statusline
|
|
|
79
79
|
}
|
|
80
80
|
case "quota": return renderQuota(data.quota, config.icons === "ascii");
|
|
81
81
|
case "session": return data.sessionMinutes === null ? undefined : formatSessionAge(data.sessionMinutes);
|
|
82
|
+
case "toolTotal": return data.toolCalls > 0 ? String(data.toolCalls) : undefined;
|
|
82
83
|
case "cost": return usage.cost.toFixed(3);
|
|
83
84
|
case "input": return formatTokens(usage.input);
|
|
84
85
|
case "output": return formatTokens(usage.output);
|
|
@@ -180,12 +181,12 @@ function setQuota(part: Part, data: StatuslineSnapshot, config: StatuslineConfig
|
|
|
180
181
|
}).join(paint(quotaSeparator(ascii), "dim"));
|
|
181
182
|
};
|
|
182
183
|
}
|
|
183
|
-
/** Session-wide values for the runtime row: dim icon,
|
|
184
|
+
/** Session-wide values for the runtime row: dim icon, muted value. */
|
|
184
185
|
function sessionText(segment: SegmentConfig, data: StatuslineSnapshot, config: StatuslineConfig, theme: RenderTheme): string | undefined {
|
|
185
186
|
const icon = cleanText(segment.icon ?? ICONS[config.icons][segment.id] ?? "");
|
|
186
187
|
const value = segmentText(segment.id, data, config);
|
|
187
188
|
if (value === undefined) return undefined;
|
|
188
|
-
const styled = theme.style(value, { fg: color(segment.color ?? "
|
|
189
|
+
const styled = theme.style(value, { fg: color(segment.color ?? "muted", theme) });
|
|
189
190
|
return icon ? `${theme.style(icon, { fg: color(segment.iconColor ?? "dim", theme) })} ${styled}` : styled;
|
|
190
191
|
}
|
|
191
192
|
|
|
@@ -195,7 +196,7 @@ export function renderFooter(width: number, data: StatuslineSnapshot, config: St
|
|
|
195
196
|
if (width === 0) return [];
|
|
196
197
|
const parts: Part[] = [];
|
|
197
198
|
let secondary: Part | undefined;
|
|
198
|
-
const sessionRow: Partial<Record<"session" | "tokens", string>> = {};
|
|
199
|
+
const sessionRow: Partial<Record<"session" | "toolTotal" | "tokens", string>> = {};
|
|
199
200
|
// CLIProxyAPI's published `tps` status is display text only.
|
|
200
201
|
const tps = cleanText(data.statuses.get("tps") ?? "");
|
|
201
202
|
const elapsedStatus = config.segments.some((s) => s.id === "statuses" && s.enabled) && /^Elapsed \d+[dhms](?: \d+[hms])*$/.test(tps) ? tps : undefined;
|
|
@@ -203,7 +204,7 @@ export function renderFooter(width: number, data: StatuslineSnapshot, config: St
|
|
|
203
204
|
const thinking = config.segments.find((segment) => segment.id === "thinking");
|
|
204
205
|
for (const segment of config.segments) {
|
|
205
206
|
if (!segment.enabled) continue;
|
|
206
|
-
if (segment.id === "session" || segment.id === "tokens") { sessionRow[segment.id] = sessionText(segment, data, config, theme); continue; }
|
|
207
|
+
if (segment.id === "session" || segment.id === "toolTotal" || segment.id === "tokens") { sessionRow[segment.id] = sessionText(segment, data, config, theme); continue; }
|
|
207
208
|
const raw = segmentText(segment.id, segment.id === "statuses" ? { ...data, statuses } : data, config);
|
|
208
209
|
if (raw === undefined) continue;
|
|
209
210
|
let text = cleanText(raw);
|
|
@@ -278,7 +279,7 @@ export function sampleSnapshot(): StatuslineSnapshot {
|
|
|
278
279
|
context: { tokens: 23800, contextWindow: 200000, percent: 11.9 },
|
|
279
280
|
usage: { ...emptyUsage(), input: 32000, output: 5400, cacheRead: 12000, cost: 0.12 },
|
|
280
281
|
git: { ...emptyGit("repository"), branch: "main", unstaged: 2, ahead: 2 },
|
|
281
|
-
statuses: new Map([["example", "Example extension status"]]), sessionMinutes: 126,
|
|
282
|
+
statuses: new Map([["example", "Example extension status"]]), sessionMinutes: 126, toolCalls: 128,
|
|
282
283
|
runtime: {
|
|
283
284
|
runId: "example", status: "Running", elapsedMs: 28000, turns: 3, toolCalls: 8, awaitingInput: false, noContentMs: null, usage: { ...emptyUsage(), output: 1260 }, avg: 45, cache: 0.86,
|
|
284
285
|
tools: [{ name: "bash", target: "npm test", elapsedMs: 12000 }],
|
package/src/runtime-render.ts
CHANGED
|
@@ -18,7 +18,6 @@ function short(ms: number): string {
|
|
|
18
18
|
const total = Math.floor(ms / 1000);
|
|
19
19
|
return total < 60 ? `${total}s` : `${Math.floor(total / 60)}m${total % 60}s`;
|
|
20
20
|
}
|
|
21
|
-
function plural(count: number, word: string): string { return `${word}${count === 1 ? "" : "s"}`; }
|
|
22
21
|
|
|
23
22
|
type Color = "text" | "muted" | "dim" | "accent" | "success" | "warning" | "error";
|
|
24
23
|
type Span = [text: string, color: Color];
|
|
@@ -39,8 +38,8 @@ function fit(parts: Part[], dropOrder: string[], width: number, separator: strin
|
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
const STATUS: Partial<Record<RuntimeSnapshot["status"], { icon: string; ascii: string; color: Color }>> = {
|
|
42
|
-
Running: { icon: "●", ascii: "*", color: "
|
|
43
|
-
Done: { icon: "✓", ascii: "ok", color: "
|
|
41
|
+
Running: { icon: "●", ascii: "*", color: "muted" },
|
|
42
|
+
Done: { icon: "✓", ascii: "ok", color: "muted" },
|
|
44
43
|
Failed: { icon: "✗", ascii: "x", color: "error" },
|
|
45
44
|
Cancelled: { icon: "⊘", ascii: "-", color: "muted" },
|
|
46
45
|
};
|
|
@@ -50,23 +49,29 @@ export interface RuntimeExtras {
|
|
|
50
49
|
statuses?: string;
|
|
51
50
|
/** Session age, already styled. */
|
|
52
51
|
session?: string;
|
|
52
|
+
/** Completed tool calls in the session, already styled. */
|
|
53
|
+
toolTotal?: string;
|
|
53
54
|
/** Session token total, already styled. */
|
|
54
55
|
tokens?: string;
|
|
55
56
|
/** A `tps` extension status of the form `Elapsed 5m 42s`. */
|
|
56
57
|
elapsedStatus?: string;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
|
-
/**
|
|
60
|
+
/**
|
|
61
|
+
* The bottom row: run status and duration, run metrics, then session age, tool calls, tokens and extension statuses.
|
|
62
|
+
* It stays muted so it does not compete with the editor; only problems (failure, waits, low cache) are colored.
|
|
63
|
+
*/
|
|
60
64
|
export function renderRuntime(width: number, data: StatuslineSnapshot, config: StatuslineConfig, theme: RenderTheme, extras: RuntimeExtras = {}): string | undefined {
|
|
61
65
|
const parts: Part[] = [];
|
|
62
66
|
const runtime = data.runtime, compact = data.compaction;
|
|
63
67
|
const enabled = config.runtime.enabled, ascii = config.icons === "ascii";
|
|
64
68
|
const add = (id: string, ...spans: Span[]) => parts.push({ id, spans });
|
|
65
|
-
|
|
69
|
+
// Label first, like `avg` and `cache`: `turns 4`, `compactions 1`.
|
|
70
|
+
const count = (id: "turns" | "compactions", value: number) => add(id, [`${id} `, "dim"], [String(value), "muted"]);
|
|
66
71
|
const duration = extras.elapsedStatus?.replace(/^Elapsed /, "") ?? (runtime?.runId ? elapsed(runtime.elapsedMs) : undefined);
|
|
67
72
|
const state = enabled && config.runtime.status && runtime?.runId ? STATUS[runtime.status] : undefined;
|
|
68
|
-
if (state && duration) add("elapsed", [ascii ? state.ascii : state.icon, state.color], [` ${duration}`, "
|
|
69
|
-
else if (extras.elapsedStatus) add("elapsed", ["elapsed ", "dim"], [duration!, "
|
|
73
|
+
if (state && duration) add("elapsed", [ascii ? state.ascii : state.icon, state.color], [` ${duration}`, "muted"]);
|
|
74
|
+
else if (extras.elapsedStatus) add("elapsed", ["elapsed ", "dim"], [duration!, "muted"]);
|
|
70
75
|
const compacting = enabled && !!compact?.active;
|
|
71
76
|
if (compacting) {
|
|
72
77
|
add("activity", [`${ascii ? "compacting..." : "compacting…"} ${seconds(compact!.elapsedMs)}`, "warning"]);
|
|
@@ -76,18 +81,19 @@ export function renderRuntime(width: number, data: StatuslineSnapshot, config: S
|
|
|
76
81
|
else if (config.runtime.noContent && runtime.noContentMs !== null && runtime.noContentMs >= config.runtime.noContentSeconds * 1000) {
|
|
77
82
|
add("activity", [`no content ${seconds(runtime.noContentMs)}`, "warning"]);
|
|
78
83
|
}
|
|
79
|
-
if (config.runtime.avg && runtime.avg !== null) add("avg", ["avg ", "dim"], [`${Math.round(runtime.avg)} tok/s`, "
|
|
84
|
+
if (config.runtime.avg && runtime.avg !== null) add("avg", ["avg ", "dim"], [`${Math.round(runtime.avg)} tok/s`, "muted"]);
|
|
80
85
|
if (config.runtime.cache && runtime.cache !== null) {
|
|
81
86
|
const percent = Math.round(runtime.cache * 100);
|
|
82
|
-
add("cache", ["cache ", "dim"], [`${percent}%`, percent
|
|
87
|
+
add("cache", ["cache ", "dim"], [`${percent}%`, percent < 50 ? "warning" : "muted"]);
|
|
83
88
|
}
|
|
84
|
-
if (config.runtime.counts && runtime.runId) count("turns", runtime.turns
|
|
89
|
+
if (config.runtime.counts && runtime.runId) count("turns", runtime.turns);
|
|
85
90
|
}
|
|
86
|
-
if (enabled && config.runtime.counts && compact && compact.count > 0) count("compactions", compact.count
|
|
91
|
+
if (enabled && config.runtime.counts && compact && compact.count > 0) count("compactions", compact.count);
|
|
87
92
|
if (extras.session) parts.push({ id: "session", spans: [], styled: extras.session });
|
|
93
|
+
if (extras.toolTotal) parts.push({ id: "toolTotal", spans: [], styled: extras.toolTotal });
|
|
88
94
|
if (extras.tokens) parts.push({ id: "tokens", spans: [], styled: extras.tokens });
|
|
89
95
|
if (extras.statuses && !compacting) parts.push({ id: "statuses", spans: [], styled: extras.statuses });
|
|
90
|
-
return fit(parts, ["statuses", "cache", "avg", "compactions", "session", "tokens", "turns", "activity", "failure"], width, ascii ? " | " : " · ", theme, ascii ? "..." : "…");
|
|
96
|
+
return fit(parts, ["statuses", "cache", "avg", "compactions", "toolTotal", "session", "tokens", "turns", "activity", "failure"], width, ascii ? " | " : " · ", theme, ascii ? "..." : "…");
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
/** `◐ bash npm test 12s · ✓ read ×5 · ✗ bash ×1 · +2`: present while the run has used tools. */
|
package/src/session.ts
CHANGED
|
@@ -36,6 +36,7 @@ export class FooterSession {
|
|
|
36
36
|
private displayKey = "";
|
|
37
37
|
private context: StatuslineSnapshot["context"] = { tokens: null, contextWindow: 0, percent: null };
|
|
38
38
|
private sessionStartMs: number | null = null;
|
|
39
|
+
private toolCalls = 0;
|
|
39
40
|
private readonly gitReader: GitReader | undefined;
|
|
40
41
|
private signal: AbortSignal | undefined;
|
|
41
42
|
private readonly onAbort = () => { this.runtime.observeAbort(); this.schedule(true); };
|
|
@@ -130,6 +131,7 @@ export class FooterSession {
|
|
|
130
131
|
const entries = manager.getEntries();
|
|
131
132
|
this.usage.update(entries);
|
|
132
133
|
this.compaction.update(entries);
|
|
134
|
+
this.toolCalls = entries.reduce((total, entry) => total + (entry.type === "message" && entry.message.role === "toolResult" ? 1 : 0), 0);
|
|
133
135
|
this.sessionStartMs = sessionStart(manager.getHeader()?.timestamp);
|
|
134
136
|
const context = this.ctx.getContextUsage();
|
|
135
137
|
this.context = context ?? { tokens: null, contextWindow: this.ctx.model?.contextWindow ?? 0, percent: null };
|
|
@@ -152,6 +154,7 @@ export class FooterSession {
|
|
|
152
154
|
statuses: this.provider?.getExtensionStatuses() ?? new Map(),
|
|
153
155
|
// Minute resolution keeps an idle footer from repainting every second.
|
|
154
156
|
sessionMinutes: this.sessionStartMs === null ? null : Math.floor(Math.max(0, Date.now() - this.sessionStartMs) / 60000),
|
|
157
|
+
toolCalls: this.toolCalls,
|
|
155
158
|
runtime: this.runtime.snapshot(this.config.runtime.retainSummary), compaction: this.compaction.snapshot(),
|
|
156
159
|
};
|
|
157
160
|
}
|
package/src/types.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ThemeColor } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
|
|
3
|
-
export const SEGMENT_IDS = ["model", "thinking", "context", "quota", "directory", "git", "cost", "input", "output", "session", "tokens", "cacheRead", "cacheWrite", "statuses"] as const;
|
|
3
|
+
export const SEGMENT_IDS = ["model", "thinking", "context", "quota", "directory", "git", "cost", "input", "output", "session", "toolTotal", "tokens", "cacheRead", "cacheWrite", "statuses"] as const;
|
|
4
4
|
export type SegmentId = typeof SEGMENT_IDS[number];
|
|
5
5
|
export type ColorValue = ThemeColor | `#${string}`;
|
|
6
6
|
export type Preset = "powerline";
|
|
@@ -72,6 +72,8 @@ export interface StatuslineSnapshot {
|
|
|
72
72
|
statuses: ReadonlyMap<string, string>;
|
|
73
73
|
/** Whole minutes since the session file was created; null when unknown. */
|
|
74
74
|
sessionMinutes: number | null;
|
|
75
|
+
/** Completed tool calls recorded in the session file, across all runs. */
|
|
76
|
+
toolCalls: number;
|
|
75
77
|
runtime?: import("./runtime.ts").RuntimeSnapshot;
|
|
76
78
|
compaction?: import("./compaction.ts").CompactionSnapshot;
|
|
77
79
|
}
|