@erichll/pi-statusline 0.6.1 → 0.8.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 +39 -0
- package/README.md +32 -15
- package/examples/statusline.json +7 -1
- package/package.json +1 -1
- package/src/config.ts +5 -4
- package/src/index.ts +3 -2
- package/src/panel.ts +4 -4
- package/src/render.ts +10 -7
- package/src/runtime-render.ts +64 -13
- package/src/session.ts +10 -3
- package/src/skills.ts +40 -0
- package/src/tools.ts +10 -2
- package/src/types.ts +9 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,44 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.8.0 - 2026-10-18
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- Add a skills row, enabled by default, between the tool row and the runtime
|
|
8
|
+
row: the loaded skills used in the session, in first-use order
|
|
9
|
+
(` pdf-tools · docx +1`; `❖` in Unicode and `skills` in ASCII icon modes).
|
|
10
|
+
It counts `/skill:name` invocations and model reads of a loaded skill's file,
|
|
11
|
+
is read from session entries so it survives reloads and resuming, and is
|
|
12
|
+
hidden until a skill is used. `runtime.skills` toggles it and
|
|
13
|
+
`runtime.skillsMaxVisible` (1–8, default 4) sets how many names show before
|
|
14
|
+
`+N`; narrow rows fold names, then show only the count.
|
|
15
|
+
- Show the skill directory for reads of a skill file on the tool row
|
|
16
|
+
(`read pdf-tools/SKILL.md` instead of `read SKILL.md`).
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- Give the lower rows dim row icons aligned with the main row: each starts with
|
|
21
|
+
a space, so its icon sits under the model icon, and two spaces set the icon
|
|
22
|
+
off from the row contents (one in ASCII mode). The tool row leads with the
|
|
23
|
+
tool total's icon (``; `⚒` in Unicode and `tools` in ASCII icon modes) and
|
|
24
|
+
the runtime row with a pulse (` ● 5m 42s`; `∿` and `run`).
|
|
25
|
+
- Quiet the tool row like the runtime row: running tools (`◐ bash`) use the
|
|
26
|
+
text color instead of warning and accent, and completed calls (`✓`) are dim
|
|
27
|
+
instead of success. Only a tool running 30s or longer (its `◐` and timer turn
|
|
28
|
+
warning) and failures (`✗`, error) stay colored.
|
|
29
|
+
|
|
30
|
+
## 0.7.0 - 2026-10-17
|
|
31
|
+
|
|
32
|
+
### Added
|
|
33
|
+
|
|
34
|
+
- Add a `toolTotal` segment on the runtime row, enabled by default: the number
|
|
35
|
+
of tool calls recorded in the whole session (` 128`; `⚒` in Unicode and
|
|
36
|
+
`tool:` in ASCII icon modes), between session age and tokens. Unlike the tool
|
|
37
|
+
row, which counts the current run, it is read from session entries, so it
|
|
38
|
+
survives reloads and resuming and covers every run. It is hidden at zero and
|
|
39
|
+
is the first of these three segments to fold on narrow rows. Existing segment
|
|
40
|
+
lists gain it before `tokens` unless they list it explicitly.
|
|
41
|
+
|
|
3
42
|
## 0.6.1 - 2026-10-16
|
|
4
43
|
|
|
5
44
|
### Changed
|
package/README.md
CHANGED
|
@@ -5,13 +5,17 @@ activity and live configuration preview. Leaves the editor intact.
|
|
|
5
5
|
|
|
6
6
|
```text
|
|
7
7
|
Example model(high) █░░░░░░░░░ 11.9% pi-packages main ● *2 ↑2
|
|
8
|
-
◐ bash npm test 12s · ✓ read ×5 · ✓ edit ×2
|
|
9
|
-
|
|
8
|
+
◐ bash npm test 12s · ✓ read ×5 · ✓ edit ×2
|
|
9
|
+
pdf-tools · docx
|
|
10
|
+
● 5m 42s · avg 45 tok/s · cache 86% · turns 3 · compactions 1 · 2h 6m · 128 · 49.4k
|
|
10
11
|
```
|
|
11
12
|
|
|
12
13
|
Rows, top to bottom: the main segments, tool activity for the current run
|
|
13
|
-
(only once it has used tools),
|
|
14
|
-
|
|
14
|
+
(only once it has used tools), the skills used in the session (only once one
|
|
15
|
+
is used), then run status, run metrics, session age, tool calls and tokens,
|
|
16
|
+
and other extensions' statuses. The last three rows start with a space, so their
|
|
17
|
+
labels (``, ``, ``) sit under the main row's model icon, and two
|
|
18
|
+
spaces set each label off from the row contents (one in ASCII mode).
|
|
15
19
|
|
|
16
20
|
## Install
|
|
17
21
|
|
|
@@ -82,6 +86,7 @@ Available segments:
|
|
|
82
86
|
| `directory` | Current directory | On |
|
|
83
87
|
| `git` | Branch, dirty/conflict state, staged/unstaged/untracked counts, ahead/behind | On |
|
|
84
88
|
| `session` | Time since the session was created, on the bottom row | On |
|
|
89
|
+
| `toolTotal` | Tool calls recorded in the whole session (` 128`), on the bottom row; hidden at zero | On |
|
|
85
90
|
| `tokens` | Cumulative session tokens, on the bottom row | On |
|
|
86
91
|
| `cost` | Pi-recorded cumulative USD cost | Off |
|
|
87
92
|
| `input`, `output`, `cacheRead`, `cacheWrite` | Individual session token counters | Off |
|
|
@@ -89,8 +94,8 @@ Available segments:
|
|
|
89
94
|
|
|
90
95
|
`segments` is an ordered array of
|
|
91
96
|
`{ id, enabled, icon?, color?, iconColor?, background? }`. Omitted segments are
|
|
92
|
-
disabled, **except `quota` and `
|
|
93
|
-
gain `quota` after `context
|
|
97
|
+
disabled, **except `quota`, `session` and `toolTotal`**: old configurations automatically
|
|
98
|
+
gain `quota` after `context`, and `session` and `toolTotal` before `tokens` (or at the end when
|
|
94
99
|
the anchor is absent). To keep one off, include it with `"enabled": false`.
|
|
95
100
|
|
|
96
101
|
Colors accept `#RRGGBB` or supported Pi theme tokens such as `accent`, `muted`,
|
|
@@ -113,8 +118,8 @@ Bars show **used** percentages for the primary and secondary windows, with live
|
|
|
113
118
|
reset countdowns. Labels come from the reported window length (`5h`, `1d`,
|
|
114
119
|
`7d`, `30d` within 5%, otherwise exact such as `1h30m`); without one, the
|
|
115
120
|
window is unlabeled rather than guessed. Each window is colored on its own:
|
|
116
|
-
Pi's accent, warning above 70% and error above 90%;
|
|
117
|
-
both. Narrow terminals omit countdowns, then bars, then the segment rather than
|
|
121
|
+
Pi's accent, warning above 70% and error above 90%; the segment icon follows
|
|
122
|
+
the higher of the two. A segment `color` overrides both. Narrow terminals omit countdowns, then bars, then the segment rather than
|
|
118
123
|
truncate a window; an unlabeled window keeps its countdown instead of its bar.
|
|
119
124
|
|
|
120
125
|
Data is observed passively through Pi's provider events:
|
|
@@ -141,9 +146,9 @@ or RPM/TPM rate limit.
|
|
|
141
146
|
- Context is Pi's current estimate, not cumulative consumption; unknown values
|
|
142
147
|
show `?`. Session totals include recorded usage across the whole session file,
|
|
143
148
|
including compaction and abandoned branches. Cost is Pi-reported, not an invoice.
|
|
144
|
-
- The bottom row
|
|
145
|
-
|
|
146
|
-
compaction. `avg` is assistant output tokens / total run seconds, **not
|
|
149
|
+
- The bottom row (``, `∿` in Unicode and `run` in ASCII icon modes) starts
|
|
150
|
+
with the run status (`●` running, `✓` done, `✗` failed, `⊘` cancelled) and its
|
|
151
|
+
duration, which spans retries, tools, UI waits and compaction. `avg` is assistant output tokens / total run seconds, **not
|
|
147
152
|
inference speed**; `cache` is cache-read / (input + cache-read + cache-write).
|
|
148
153
|
`turns` counts Pi turns, not upstream requests; `compactions` counts
|
|
149
154
|
successful session entries. The row stays muted; only a failed run, waits,
|
|
@@ -156,16 +161,28 @@ or RPM/TPM rate limit.
|
|
|
156
161
|
- `awaiting input` and `no content 10s` follow the duration while active. No
|
|
157
162
|
content means no non-empty text, reasoning or tool-call delta was observed; it
|
|
158
163
|
is not a server timeout and is suppressed during tools, UI waits and compaction.
|
|
159
|
-
- The tool row
|
|
160
|
-
|
|
164
|
+
- The tool row (``, `⚒` in Unicode and `tools` in ASCII icon modes, like the
|
|
165
|
+
session tool total) shows up to two running tools with what they work on (a
|
|
166
|
+
shell command without `cd`/env prefixes, a file name or a search pattern), merging
|
|
161
167
|
same-name calls as `×N`, then this run's completed (`✓`) and failed (`✗`)
|
|
162
168
|
counts. `toolsMaxVisible` (1–8, default 4) completed kinds show before `+N`.
|
|
163
169
|
Nested calls count but are represented by their parent while running; calls
|
|
164
170
|
ended by a cancellation are not failures. Narrow rows fold kinds, then drop
|
|
165
|
-
targets, then timers.
|
|
171
|
+
targets, then timers. The row stays quiet: running tools (`◐ bash`) use the
|
|
172
|
+
text color, completed ones (`✓`) are dim, and only a tool running 30s or
|
|
173
|
+
longer (its `◐` and timer turn warning) and failures (error) are colored. A read of a skill file shows its directory
|
|
174
|
+
(`read pdf-tools/SKILL.md`).
|
|
175
|
+
- The skills row (``, `❖` in Unicode and `skills` in ASCII icon modes) lists
|
|
176
|
+
the loaded skills used in the session, in first-use order: `/skill:name`
|
|
177
|
+
invocations and model reads of a loaded skill's file.
|
|
178
|
+
Reads of skill files Pi did not load are ignored; a skill read only for
|
|
179
|
+
reference, such as while writing another skill, still counts. Like tool calls,
|
|
180
|
+
it is read from session entries, so it survives reloads and resuming.
|
|
181
|
+
`skillsMaxVisible` (1–8, default 4) names show before `+N`; narrow rows fold
|
|
182
|
+
names, then show only the count.
|
|
166
183
|
|
|
167
184
|
All runtime options default to enabled; `noContentSeconds` accepts 1–3600
|
|
168
|
-
(default 10). `tools: false` hides the tool row. `retainSummary` keeps the last run until the next one;
|
|
185
|
+
(default 10). `tools: false` hides the tool row and `skills: false` the skills row. `retainSummary` keeps the last run until the next one;
|
|
169
186
|
`runtime.enabled: false` hides local runtime metrics. Reload/new session resets
|
|
170
187
|
in-memory runtime summaries, not persisted session totals.
|
|
171
188
|
|
package/examples/statusline.json
CHANGED
|
@@ -49,6 +49,10 @@
|
|
|
49
49
|
"id": "session",
|
|
50
50
|
"enabled": true
|
|
51
51
|
},
|
|
52
|
+
{
|
|
53
|
+
"id": "toolTotal",
|
|
54
|
+
"enabled": true
|
|
55
|
+
},
|
|
52
56
|
{
|
|
53
57
|
"id": "tokens",
|
|
54
58
|
"enabled": true
|
|
@@ -76,6 +80,8 @@
|
|
|
76
80
|
"cache": true,
|
|
77
81
|
"counts": true,
|
|
78
82
|
"retainSummary": true,
|
|
79
|
-
"toolsMaxVisible": 4
|
|
83
|
+
"toolsMaxVisible": 4,
|
|
84
|
+
"skills": true,
|
|
85
|
+
"skillsMaxVisible": 4
|
|
80
86
|
}
|
|
81
87
|
}
|
package/package.json
CHANGED
package/src/config.ts
CHANGED
|
@@ -10,12 +10,12 @@ 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,
|
|
17
17
|
segments: SEGMENT_IDS.map((id) => ({ id, enabled: enabled.has(id) })),
|
|
18
|
-
runtime: { enabled: true, status: true, tools: true, noContent: true, noContentSeconds: 10, avg: true, cache: true, counts: true, retainSummary: true, toolsMaxVisible: 4 },
|
|
18
|
+
runtime: { enabled: true, status: true, tools: true, noContent: true, noContentSeconds: 10, avg: true, cache: true, counts: true, retainSummary: true, toolsMaxVisible: 4, skills: true, skillsMaxVisible: 4 },
|
|
19
19
|
};
|
|
20
20
|
}
|
|
21
21
|
function record(value: unknown): value is Record<string, unknown> {
|
|
@@ -54,7 +54,7 @@ export function parseConfig(raw: unknown): StatuslineConfig {
|
|
|
54
54
|
if (key === "noContentSeconds") {
|
|
55
55
|
if (typeof value !== "number" || !Number.isInteger(value) || value < 1 || value > 3600) throw new Error("Invalid runtime.noContentSeconds (1–3600)");
|
|
56
56
|
config.runtime.noContentSeconds = value;
|
|
57
|
-
} else if (key === "toolsMaxVisible") config.runtime
|
|
57
|
+
} else if (key === "toolsMaxVisible" || key === "skillsMaxVisible") config.runtime[key] = integer(value, 1, 8, `runtime.${key}`);
|
|
58
58
|
else (config[group] as unknown as Record<string, unknown>)[key] = boolean(value, `${group}.${key}`);
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -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/index.ts
CHANGED
|
@@ -10,6 +10,7 @@ export default function statusline(pi: ExtensionAPI): void {
|
|
|
10
10
|
let config = presetConfig();
|
|
11
11
|
let session: FooterSession | undefined;
|
|
12
12
|
let generation = 0;
|
|
13
|
+
const commands = () => pi.getCommands();
|
|
13
14
|
|
|
14
15
|
pi.on("session_start", async (_event, ctx) => {
|
|
15
16
|
const token = ++generation;
|
|
@@ -19,7 +20,7 @@ export default function statusline(pi: ExtensionAPI): void {
|
|
|
19
20
|
if (token !== generation) return;
|
|
20
21
|
config = loaded.config;
|
|
21
22
|
if (loaded.warning) ctx.ui.notify(loaded.warning, "warning");
|
|
22
|
-
session = new FooterSession(ctx, config);
|
|
23
|
+
session = new FooterSession(ctx, config, undefined, commands);
|
|
23
24
|
session.refresh(true);
|
|
24
25
|
session.install();
|
|
25
26
|
});
|
|
@@ -89,7 +90,7 @@ export default function statusline(pi: ExtensionAPI): void {
|
|
|
89
90
|
config = loaded.config;
|
|
90
91
|
if (loaded.warning) ctx.ui.notify(loaded.warning, "warning");
|
|
91
92
|
current.dispose();
|
|
92
|
-
session = new FooterSession(ctx, config);
|
|
93
|
+
session = new FooterSession(ctx, config, undefined, commands);
|
|
93
94
|
session.refresh(true); session.install();
|
|
94
95
|
return;
|
|
95
96
|
}
|
package/src/panel.ts
CHANGED
|
@@ -41,7 +41,7 @@ export class StatuslinePanel implements Component, Focusable {
|
|
|
41
41
|
}
|
|
42
42
|
private items(): SelectItem[] {
|
|
43
43
|
if (this.section) {
|
|
44
|
-
const labels: Record<string, string> = { enabled: "Runtime metrics", status: "Run status, elapsed and compaction status", tools: "Tool activity row", noContent: "No content warning", noContentSeconds: "No content threshold (seconds)", avg: "Average output speed", cache: "Cache read ratio", counts: "Turns and compactions", retainSummary: "Retain last run summary", toolsMaxVisible: "Completed tool kinds shown" };
|
|
44
|
+
const labels: Record<string, string> = { enabled: "Runtime metrics", status: "Run status, elapsed and compaction status", tools: "Tool activity row", noContent: "No content warning", noContentSeconds: "No content threshold (seconds)", avg: "Average output speed", cache: "Cache read ratio", counts: "Turns and compactions", retainSummary: "Retain last run summary", toolsMaxVisible: "Completed tool kinds shown", skills: "Skills row", skillsMaxVisible: "Skill names shown" };
|
|
45
45
|
return [...Object.entries(this.draft[this.section]).map(([key, value]) => ({ value: `option:${key}`, label: `${labels[key] ?? key}: ${value}` })), { value: "back", label: "Back to settings" }];
|
|
46
46
|
}
|
|
47
47
|
if (this.editing) {
|
|
@@ -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" },
|
|
@@ -93,9 +93,9 @@ export class StatuslinePanel implements Component, Focusable {
|
|
|
93
93
|
if (this.section) {
|
|
94
94
|
if (value === "back") { this.cancel(); return; }
|
|
95
95
|
const key = value.slice("option:".length);
|
|
96
|
-
if (key === "noContentSeconds" || key === "toolsMaxVisible") {
|
|
96
|
+
if (key === "noContentSeconds" || key === "toolsMaxVisible" || key === "skillsMaxVisible") {
|
|
97
97
|
this.input = new Input(); this.input.focused = this.hasFocus; this.input.setValue(String(this.draft.runtime[key]));
|
|
98
|
-
this.inputLabel = key === "noContentSeconds" ? "No content threshold (1–3600 seconds)" : "Completed tool kinds shown before +N (1–8)";
|
|
98
|
+
this.inputLabel = key === "noContentSeconds" ? "No content threshold (1–3600 seconds)" : key === "toolsMaxVisible" ? "Completed tool kinds shown before +N (1–8)" : "Skill names shown before +N (1–8)";
|
|
99
99
|
this.input.onEscape = () => this.cancel();
|
|
100
100
|
this.input.onSubmit = (text) => {
|
|
101
101
|
try { this.draft = parseConfig({ ...this.draft, runtime: { ...this.draft.runtime, [key]: Number(text) } }); this.input = undefined; this.error = ""; this.rebuild(value); }
|
package/src/render.ts
CHANGED
|
@@ -6,16 +6,16 @@ export { cleanText } from "./text.ts";
|
|
|
6
6
|
import type { ColorValue, SegmentConfig, SegmentId, StatuslineConfig, StatuslineSnapshot } from "./types.ts";
|
|
7
7
|
import { emptyGit } from "./git.ts";
|
|
8
8
|
import { emptyUsage } from "./usage.ts";
|
|
9
|
-
import { renderRuntime, renderTools } from "./runtime-render.ts";
|
|
9
|
+
import { renderRuntime, renderSkills, renderTools } from "./runtime-render.ts";
|
|
10
10
|
import { quotaPieces, quotaSeparator, renderQuota, type QuotaDetail } from "./quota.ts";
|
|
11
11
|
|
|
12
12
|
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);
|
|
@@ -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);
|
|
@@ -257,6 +258,8 @@ export function renderFooter(width: number, data: StatuslineSnapshot, config: St
|
|
|
257
258
|
if (parts.length) lines.push(truncateToWidth(line, width, ellipsis));
|
|
258
259
|
const tools = renderTools(width, data, config, theme);
|
|
259
260
|
if (tools) lines.push(tools);
|
|
261
|
+
const skills = renderSkills(width, data, config, theme);
|
|
262
|
+
if (skills) lines.push(skills);
|
|
260
263
|
const runtime = renderRuntime(width, data, config, theme, { statuses: secondary ? renderPart(secondary, theme) : undefined, ...sessionRow, elapsedStatus });
|
|
261
264
|
if (runtime) lines.push(runtime);
|
|
262
265
|
return lines;
|
|
@@ -278,7 +281,7 @@ export function sampleSnapshot(): StatuslineSnapshot {
|
|
|
278
281
|
context: { tokens: 23800, contextWindow: 200000, percent: 11.9 },
|
|
279
282
|
usage: { ...emptyUsage(), input: 32000, output: 5400, cacheRead: 12000, cost: 0.12 },
|
|
280
283
|
git: { ...emptyGit("repository"), branch: "main", unstaged: 2, ahead: 2 },
|
|
281
|
-
statuses: new Map([["example", "Example extension status"]]), sessionMinutes: 126,
|
|
284
|
+
statuses: new Map([["example", "Example extension status"]]), sessionMinutes: 126, toolCalls: 128, skills: ["pdf-tools", "docx"],
|
|
282
285
|
runtime: {
|
|
283
286
|
runId: "example", status: "Running", elapsedMs: 28000, turns: 3, toolCalls: 8, awaitingInput: false, noContentMs: null, usage: { ...emptyUsage(), output: 1260 }, avg: 45, cache: 0.86,
|
|
284
287
|
tools: [{ name: "bash", target: "npm test", elapsedMs: 12000 }],
|
package/src/runtime-render.ts
CHANGED
|
@@ -36,6 +36,15 @@ function fit(parts: Part[], dropOrder: string[], width: number, separator: strin
|
|
|
36
36
|
}
|
|
37
37
|
return parts.length ? truncateToWidth(line, width, ellipsis) : undefined;
|
|
38
38
|
}
|
|
39
|
+
/**
|
|
40
|
+
* Lower rows start with a space so their labels (``, ``, ``) sit under the main row's
|
|
41
|
+
* model icon. Two spaces then set the label off from the contents; ASCII labels are words and take one.
|
|
42
|
+
*/
|
|
43
|
+
function labeled(label: Span, ascii: boolean, width: number, theme: RenderTheme, render: (width: number) => string | undefined): string | undefined {
|
|
44
|
+
const prefix = ` ${theme.style(label[0], { fg: theme.colors[label[1]] })}${ascii ? " " : " "}`;
|
|
45
|
+
const line = render(Math.max(1, width - visibleWidth(prefix)));
|
|
46
|
+
return line ? truncateToWidth(prefix + line, width, ascii ? "..." : "…") : undefined;
|
|
47
|
+
}
|
|
39
48
|
|
|
40
49
|
const STATUS: Partial<Record<RuntimeSnapshot["status"], { icon: string; ascii: string; color: Color }>> = {
|
|
41
50
|
Running: { icon: "●", ascii: "*", color: "muted" },
|
|
@@ -49,6 +58,8 @@ export interface RuntimeExtras {
|
|
|
49
58
|
statuses?: string;
|
|
50
59
|
/** Session age, already styled. */
|
|
51
60
|
session?: string;
|
|
61
|
+
/** Completed tool calls in the session, already styled. */
|
|
62
|
+
toolTotal?: string;
|
|
52
63
|
/** Session token total, already styled. */
|
|
53
64
|
tokens?: string;
|
|
54
65
|
/** A `tps` extension status of the form `Elapsed 5m 42s`. */
|
|
@@ -56,7 +67,8 @@ export interface RuntimeExtras {
|
|
|
56
67
|
}
|
|
57
68
|
|
|
58
69
|
/**
|
|
59
|
-
* The bottom row: run status and duration, run metrics, then session age,
|
|
70
|
+
* The bottom row (` ● 5m 42s · …`): run status and duration, run metrics, then session age, tool calls, tokens
|
|
71
|
+
* and extension statuses.
|
|
60
72
|
* It stays muted so it does not compete with the editor; only problems (failure, waits, low cache) are colored.
|
|
61
73
|
*/
|
|
62
74
|
export function renderRuntime(width: number, data: StatuslineSnapshot, config: StatuslineConfig, theme: RenderTheme, extras: RuntimeExtras = {}): string | undefined {
|
|
@@ -88,12 +100,45 @@ export function renderRuntime(width: number, data: StatuslineSnapshot, config: S
|
|
|
88
100
|
}
|
|
89
101
|
if (enabled && config.runtime.counts && compact && compact.count > 0) count("compactions", compact.count);
|
|
90
102
|
if (extras.session) parts.push({ id: "session", spans: [], styled: extras.session });
|
|
103
|
+
if (extras.toolTotal) parts.push({ id: "toolTotal", spans: [], styled: extras.toolTotal });
|
|
91
104
|
if (extras.tokens) parts.push({ id: "tokens", spans: [], styled: extras.tokens });
|
|
92
105
|
if (extras.statuses && !compacting) parts.push({ id: "statuses", spans: [], styled: extras.statuses });
|
|
93
|
-
|
|
106
|
+
// A pulse: the run's status and vitals, then the session's.
|
|
107
|
+
const label: Span = [{ nerd: "\u{F0430}", unicode: "∿", ascii: "run" }[config.icons], "dim"];
|
|
108
|
+
return labeled(label, ascii, width, theme, (available) =>
|
|
109
|
+
fit(parts, ["statuses", "cache", "avg", "compactions", "toolTotal", "session", "tokens", "turns", "activity", "failure"], available, ascii ? " | " : " · ", theme, ascii ? "..." : "…"));
|
|
94
110
|
}
|
|
95
111
|
|
|
96
|
-
/**
|
|
112
|
+
/** ` pdf-tools · docx +1`: the session's skills in first-use order, present once one is used. */
|
|
113
|
+
export function renderSkills(width: number, data: StatuslineSnapshot, config: StatuslineConfig, theme: RenderTheme): string | undefined {
|
|
114
|
+
if (!config.runtime.enabled || !config.runtime.skills || !data.skills.length) return undefined;
|
|
115
|
+
const ascii = config.icons === "ascii", ellipsis = ascii ? "..." : "…", separator = ascii ? " | " : " · ";
|
|
116
|
+
const names = data.skills.map((name) => truncateToWidth(name, 24, ellipsis));
|
|
117
|
+
// An open book: a skill is a set of instructions. ASCII keeps the word.
|
|
118
|
+
const label: Span = [{ nerd: "\u{F05DA}", unicode: "❖", ascii: "skills" }[config.icons], "dim"];
|
|
119
|
+
const build = (visible: number): Part[] => {
|
|
120
|
+
if (!visible) return [{ id: "skills", spans: [[String(names.length), "muted"]] }];
|
|
121
|
+
const spans: Span[] = [];
|
|
122
|
+
names.slice(0, visible).forEach((name, index) => { if (index) spans.push([separator, "dim"]); spans.push([name, "muted"]); });
|
|
123
|
+
if (names.length > visible) spans.push([` +${names.length - visible}`, "dim"]);
|
|
124
|
+
return [{ id: "skills", spans }];
|
|
125
|
+
};
|
|
126
|
+
// Narrowing order: fold names into `+N`, then show only the count.
|
|
127
|
+
return labeled(label, ascii, width, theme, (available) => {
|
|
128
|
+
let parts: Part[] = [];
|
|
129
|
+
for (let visible = Math.min(config.runtime.skillsMaxVisible, names.length); visible >= 0; visible--) {
|
|
130
|
+
parts = build(visible);
|
|
131
|
+
if (visibleWidth(draw(parts, separator, theme)) <= available) break;
|
|
132
|
+
}
|
|
133
|
+
return fit(parts, [], available, separator, theme, ellipsis);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* ` ◐ bash npm test 12s · ✓ read ×5 · ✗ bash ×1 · +2`: present while the run has used tools.
|
|
139
|
+
* Like the runtime row it stays quiet: running tools (`◐ bash`) are the brightest text, completed
|
|
140
|
+
* ones recede, and only problems (a tool running 30s or longer, a failure) are colored.
|
|
141
|
+
*/
|
|
97
142
|
export function renderTools(width: number, data: StatuslineSnapshot, config: StatuslineConfig, theme: RenderTheme): string | undefined {
|
|
98
143
|
const runtime = data.runtime;
|
|
99
144
|
if (!config.runtime.enabled || !config.runtime.tools || !runtime || (!runtime.tools.length && !runtime.completed.length)) return undefined;
|
|
@@ -109,15 +154,17 @@ export function renderTools(width: number, data: StatuslineSnapshot, config: Sta
|
|
|
109
154
|
const failed = runtime.completed.filter((tool) => tool.failed).sort((a, b) => b.failed - a.failed);
|
|
110
155
|
const build = (visible: number, targets: boolean, timers: boolean): Part[] => {
|
|
111
156
|
const parts: Part[] = running.slice(0, 2).map((group) => {
|
|
112
|
-
|
|
157
|
+
// A tool running 30s or longer is the one problem a running call can show.
|
|
158
|
+
const slow = group.elapsedMs >= 30000;
|
|
159
|
+
const spans: Span[] = [[sym.run, slow ? "warning" : "text"], [` ${group.name}`, "text"]];
|
|
113
160
|
if (group.count > 1) spans.push([` ${sym.times}${group.count}`, "dim"]);
|
|
114
161
|
else if (targets && group.target) spans.push([` ${group.target}`, "muted"]);
|
|
115
|
-
if (timers && group.elapsedMs >= 1000) spans.push([` ${short(group.elapsedMs)}`,
|
|
162
|
+
if (timers && group.elapsedMs >= 1000) spans.push([` ${short(group.elapsedMs)}`, slow ? "warning" : "muted"]);
|
|
116
163
|
return { id: "running", spans };
|
|
117
164
|
});
|
|
118
165
|
const moreRunning = running.slice(2).reduce((total, group) => total + group.count, 0);
|
|
119
|
-
if (moreRunning) parts.push({ id: "running", spans: [[sym.run, "
|
|
120
|
-
for (const tool of ok.slice(0, visible)) parts.push({ id: "ok", spans: [[sym.ok, "
|
|
166
|
+
if (moreRunning) parts.push({ id: "running", spans: [[sym.run, "text"], [` +${moreRunning}`, "dim"]] });
|
|
167
|
+
for (const tool of ok.slice(0, visible)) parts.push({ id: "ok", spans: [[sym.ok, "dim"], [` ${tool.name}`, "muted"], [` ${sym.times}${tool.ok}`, "dim"]] });
|
|
121
168
|
for (const tool of failed) parts.push({ id: "failed", spans: [[sym.fail, "error"], [` ${tool.name}`, "muted"], [` ${sym.times}${tool.failed}`, "error"]] });
|
|
122
169
|
const hidden = ok.length - Math.min(visible, ok.length);
|
|
123
170
|
if (hidden) parts.push({ id: "more", spans: [[`+${hidden}`, "dim"]] });
|
|
@@ -129,10 +176,14 @@ export function renderTools(width: number, data: StatuslineSnapshot, config: Sta
|
|
|
129
176
|
for (let visible = max; visible >= 1; visible--) attempts.push([visible, true, true]);
|
|
130
177
|
attempts.push([1, false, true], [0, false, true], [0, false, false]);
|
|
131
178
|
const separator = ascii ? " | " : " · ";
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
179
|
+
// The same icon as the session's tool total: this row is the current run's share.
|
|
180
|
+
const label: Span = [{ nerd: "\u{F1064}", unicode: "⚒", ascii: "tools" }[config.icons], "dim"];
|
|
181
|
+
return labeled(label, ascii, width, theme, (available) => {
|
|
182
|
+
let parts: Part[] = [];
|
|
183
|
+
for (const [visible, targets, timers] of attempts) {
|
|
184
|
+
parts = build(visible, targets, timers);
|
|
185
|
+
if (visibleWidth(draw(parts, separator, theme)) <= available) break;
|
|
186
|
+
}
|
|
187
|
+
return fit(parts, [], available, separator, theme, ascii ? "..." : "…");
|
|
188
|
+
});
|
|
138
189
|
}
|
package/src/session.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { homedir } from "node:os";
|
|
2
2
|
import type { AssistantMessage } from "@earendil-works/pi-ai";
|
|
3
|
-
import type { ExtensionContext, ReadonlyFooterDataProvider } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import type { ExtensionContext, ReadonlyFooterDataProvider, SlashCommandInfo } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import type { TUI } from "@earendil-works/pi-tui";
|
|
5
5
|
import { emptyGit, GitPoller, type GitReader } from "./git.ts";
|
|
6
6
|
import { renderFooter, withSpacing } from "./render.ts";
|
|
@@ -9,6 +9,7 @@ import { UsageCache } from "./usage.ts";
|
|
|
9
9
|
import { RuntimeState } from "./runtime.ts";
|
|
10
10
|
import { CompactionState } from "./compaction.ts";
|
|
11
11
|
import { QuotaState } from "./quota.ts";
|
|
12
|
+
import { sessionSkills } from "./skills.ts";
|
|
12
13
|
|
|
13
14
|
/** The header's creation time; hidden rather than guessed when missing, malformed or in the future. */
|
|
14
15
|
export function sessionStart(timestamp: string | undefined, now = Date.now()): number | null {
|
|
@@ -36,12 +37,15 @@ export class FooterSession {
|
|
|
36
37
|
private displayKey = "";
|
|
37
38
|
private context: StatuslineSnapshot["context"] = { tokens: null, contextWindow: 0, percent: null };
|
|
38
39
|
private sessionStartMs: number | null = null;
|
|
40
|
+
private toolCalls = 0;
|
|
41
|
+
private skills: string[] = [];
|
|
39
42
|
private readonly gitReader: GitReader | undefined;
|
|
43
|
+
private readonly commands: () => readonly SlashCommandInfo[];
|
|
40
44
|
private signal: AbortSignal | undefined;
|
|
41
45
|
private readonly onAbort = () => { this.runtime.observeAbort(); this.schedule(true); };
|
|
42
46
|
|
|
43
|
-
constructor(ctx: ExtensionContext, config: StatuslineConfig, gitReader?: GitReader) {
|
|
44
|
-
this.ctx = ctx; this.config = config; this.gitReader = gitReader;
|
|
47
|
+
constructor(ctx: ExtensionContext, config: StatuslineConfig, gitReader?: GitReader, commands: () => readonly SlashCommandInfo[] = () => []) {
|
|
48
|
+
this.ctx = ctx; this.config = config; this.gitReader = gitReader; this.commands = commands;
|
|
45
49
|
}
|
|
46
50
|
get active(): boolean { return this.ownsFooter && !this.closed; }
|
|
47
51
|
setContext(ctx: ExtensionContext): void { this.ctx = ctx; this.quota.select(ctx.model); this.watchSignal(); }
|
|
@@ -130,6 +134,8 @@ export class FooterSession {
|
|
|
130
134
|
const entries = manager.getEntries();
|
|
131
135
|
this.usage.update(entries);
|
|
132
136
|
this.compaction.update(entries);
|
|
137
|
+
this.toolCalls = entries.reduce((total, entry) => total + (entry.type === "message" && entry.message.role === "toolResult" ? 1 : 0), 0);
|
|
138
|
+
this.skills = sessionSkills(entries, this.ctx.cwd, this.commands);
|
|
133
139
|
this.sessionStartMs = sessionStart(manager.getHeader()?.timestamp);
|
|
134
140
|
const context = this.ctx.getContextUsage();
|
|
135
141
|
this.context = context ?? { tokens: null, contextWindow: this.ctx.model?.contextWindow ?? 0, percent: null };
|
|
@@ -152,6 +158,7 @@ export class FooterSession {
|
|
|
152
158
|
statuses: this.provider?.getExtensionStatuses() ?? new Map(),
|
|
153
159
|
// Minute resolution keeps an idle footer from repainting every second.
|
|
154
160
|
sessionMinutes: this.sessionStartMs === null ? null : Math.floor(Math.max(0, Date.now() - this.sessionStartMs) / 60000),
|
|
161
|
+
toolCalls: this.toolCalls, skills: this.skills,
|
|
155
162
|
runtime: this.runtime.snapshot(this.config.runtime.retainSummary), compaction: this.compaction.snapshot(),
|
|
156
163
|
};
|
|
157
164
|
}
|
package/src/skills.ts
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { homedir } from "node:os";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { parseSkillBlock, type SessionEntry, type SlashCommandInfo } from "@earendil-works/pi-coding-agent";
|
|
4
|
+
import { cleanText } from "./text.ts";
|
|
5
|
+
|
|
6
|
+
/** Pi's read path handling: an `@` prefix is stripped, `~` is the home directory, the rest is relative to cwd. */
|
|
7
|
+
function readPath(path: string, cwd: string): string {
|
|
8
|
+
const text = path.startsWith("@") ? path.slice(1) : path;
|
|
9
|
+
if (text === "~") return homedir();
|
|
10
|
+
return resolve(cwd, text.startsWith("~/") ? `${homedir()}${text.slice(1)}` : text);
|
|
11
|
+
}
|
|
12
|
+
function userText(content: unknown): string {
|
|
13
|
+
if (typeof content === "string") return content;
|
|
14
|
+
if (!Array.isArray(content)) return "";
|
|
15
|
+
return content.map((block) => block?.type === "text" && typeof block.text === "string" ? block.text : "").join("");
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Loaded skills used in the session, in first-use order: `/skill:name` invocations and model
|
|
20
|
+
* reads of a loaded skill's file. Reads of skill files Pi did not load are not skills in use.
|
|
21
|
+
*/
|
|
22
|
+
export function sessionSkills(entries: readonly SessionEntry[], cwd: string, commands: () => readonly SlashCommandInfo[]): string[] {
|
|
23
|
+
const used = new Set<string>();
|
|
24
|
+
let paths: Map<string, string> | undefined;
|
|
25
|
+
const add = (name: string | undefined) => { const text = name && cleanText(name).trim(); if (text) used.add(text); };
|
|
26
|
+
for (const entry of entries) {
|
|
27
|
+
if (entry.type !== "message") continue;
|
|
28
|
+
const message = entry.message;
|
|
29
|
+
if (message.role === "user") add(parseSkillBlock(userText(message.content))?.name);
|
|
30
|
+
if (message.role !== "assistant" || !Array.isArray(message.content)) continue;
|
|
31
|
+
for (const block of message.content) {
|
|
32
|
+
if (block.type !== "toolCall" || block.name !== "read" || typeof block.arguments?.path !== "string") continue;
|
|
33
|
+
// Looked up once per scan, only when the session has reads.
|
|
34
|
+
paths ??= new Map(commands().filter((command) => command.source === "skill" && command.sourceInfo?.path)
|
|
35
|
+
.map((command) => [resolve(command.sourceInfo.path), command.name.replace(/^skill:/, "")]));
|
|
36
|
+
add(paths.get(readPath(block.arguments.path, cwd)));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return [...used];
|
|
40
|
+
}
|
package/src/tools.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { basename } from "node:path";
|
|
1
|
+
import { basename, dirname } from "node:path";
|
|
2
2
|
import { visibleWidth } from "@earendil-works/pi-tui";
|
|
3
3
|
import { cleanText } from "./text.ts";
|
|
4
4
|
|
|
@@ -21,6 +21,13 @@ function fileName(path: string | undefined): string | undefined {
|
|
|
21
21
|
const name = path ? basename(cleanText(path).replace(/[\\/]+$/, "")) : "";
|
|
22
22
|
return name && name !== "." ? name : undefined;
|
|
23
23
|
}
|
|
24
|
+
/** `skills/pdf-tools/SKILL.md` → `pdf-tools/SKILL.md`: every skill file has the same name. */
|
|
25
|
+
function readTarget(path: string | undefined): string | undefined {
|
|
26
|
+
const name = fileName(path);
|
|
27
|
+
if (name !== "SKILL.md") return fit(name, 24);
|
|
28
|
+
const skill = fileName(dirname(cleanText(path!).replace(/[\\/]+$/, "")));
|
|
29
|
+
return skill ? `${fit(skill, 24 - "/SKILL.md".length)}/SKILL.md` : name;
|
|
30
|
+
}
|
|
24
31
|
/** `cd dir && FOO=1 npm test` → `npm test`: the part that says what is running. */
|
|
25
32
|
function commandSummary(command: string): string | undefined {
|
|
26
33
|
let text = cleanText(command.split(/\r?\n/).find((line) => line.trim()) ?? "");
|
|
@@ -35,7 +42,8 @@ function commandSummary(command: string): string | undefined {
|
|
|
35
42
|
export function toolTarget(name: string, args: unknown): string | undefined {
|
|
36
43
|
switch (name) {
|
|
37
44
|
case "bash": case "powershell": { const command = arg(args, "command"); return fit(command && commandSummary(command), 24); }
|
|
38
|
-
case "read":
|
|
45
|
+
case "read": return readTarget(arg(args, "path"));
|
|
46
|
+
case "edit": case "write": return fit(fileName(arg(args, "path")), 24);
|
|
39
47
|
case "grep": case "find": { const pattern = arg(args, "pattern"); const text = pattern && cleanText(pattern); return text ? `"${fit(text, 16)}"` : undefined; }
|
|
40
48
|
case "ls": { const dir = fileName(arg(args, "path")); return dir ? `${fit(dir, 23)}/` : undefined; }
|
|
41
49
|
default: return undefined;
|
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";
|
|
@@ -17,6 +17,10 @@ export interface RuntimeConfig {
|
|
|
17
17
|
retainSummary: boolean;
|
|
18
18
|
/** Completed tool kinds shown before folding into `+N` (1–8). */
|
|
19
19
|
toolsMaxVisible: number;
|
|
20
|
+
/** The session's skills row. */
|
|
21
|
+
skills: boolean;
|
|
22
|
+
/** Skill names shown before folding into `+N` (1–8). */
|
|
23
|
+
skillsMaxVisible: number;
|
|
20
24
|
}
|
|
21
25
|
export interface SegmentConfig {
|
|
22
26
|
id: SegmentId;
|
|
@@ -72,6 +76,10 @@ export interface StatuslineSnapshot {
|
|
|
72
76
|
statuses: ReadonlyMap<string, string>;
|
|
73
77
|
/** Whole minutes since the session file was created; null when unknown. */
|
|
74
78
|
sessionMinutes: number | null;
|
|
79
|
+
/** Completed tool calls recorded in the session file, across all runs. */
|
|
80
|
+
toolCalls: number;
|
|
81
|
+
/** Loaded skills used in the session, in first-use order. */
|
|
82
|
+
skills: string[];
|
|
75
83
|
runtime?: import("./runtime.ts").RuntimeSnapshot;
|
|
76
84
|
compaction?: import("./compaction.ts").CompactionSnapshot;
|
|
77
85
|
}
|