pi-subagent-manager 0.20.0 → 0.21.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 CHANGED
@@ -77,9 +77,9 @@ A live **Agents** widget sits above the input box. Choose **Full** (the existing
77
77
 
78
78
  **Cost accounting:** Agent rows show estimated USD cost (including cache reads/writes) when reported. Completed, paused, stopped, and failed agents roll up only newly incurred cost. Accounting survives resume, reload, branch navigation, and reaping; nested agents' own costs are counted once. Running-agent costs remain in their rows until settlement. This changes the footer display, not Pi's native session statistics.
79
79
 
80
- - Choose **[labs] Cost display** in `/agents settings`: **pi-footer status key** (default), **pi-footer event**, or **Pi status only**. The stable ID/key is **`subagent_cost`**.
80
+ - Open **[labs] Footer display** in `/agents settings` to choose a location (**Replace Pi status**, **pi-footer status widget**, or **pi-footer event**), a value (**Only subagent cost** or **Total cost**), and a money icon. Defaults: status widget, settled subagent-only cost, and 💵. The stable ID/key is **`subagent_cost`**.
81
81
  - **`npm:pi-footer`:** with the default status-key mode, add **Extension Status** through `/footer` and select **`subagent_cost`**. Event mode instead requires a **Pi Event Value** widget with **Widget ID** entered manually and **Raw value only** enabled; event IDs are not listed in the status selector.
82
- - Values publish at session start and immediately on subagent startup, including `$0.0000`, then after settlement/settings changes. Status modes leave your footer untouched; event mode retains the combined-cost fallback when no extension provides `/footer`. See [Cost display settings](docs/settings.md#labs-cost-display-costdisplay) and the [pi-footer setup guide with exact snippets](docs/pi-footer.md).
82
+ - Values publish at session start and immediately on subagent startup, including `💵 $0.0000`, then after settlement/settings changes. Total cost includes the main session plus settled subagents. The icon picker offers three Nerd Font choices when the labs toggle is on, otherwise three emoji choices. Status modes leave your footer untouched; event mode retains a fallback showing the selected value/icon when no extension provides `/footer`. See [Cost display settings](docs/settings.md#labs-cost-display-costdisplay) and the [pi-footer setup guide with exact snippets](docs/pi-footer.md).
83
83
 
84
84
  Experimental features are marked **[labs]** in settings. Enable **[labs] Nerd Font icons** in `/agents` to show role-specific icons beside agent names (off by default; requires a Nerd Font in your terminal). Loaders appear **before**, never instead of, the role icon. Choose Circle, Braille, or Hourglass under **[labs] Loader style**, with previews of every animation frame and each family's completed, paused, failed, and stopped icons. Custom agent types can set an optional `icon` or use **[labs] Icon** in `/agents types`. See [icon setup](docs/settings.md#labs-nerd-font-icons-nerdfonticons).
85
85
 
@@ -1,6 +1,7 @@
1
1
  # Write your own agent
2
2
 
3
- An agent type is one Markdown file: YAML frontmatter on top, system prompt below.
3
+ A full agent type is a Markdown file: YAML frontmatter on top, system prompt below.
4
+ A settings-only customization is a sparse YAML overlay.
4
5
 
5
6
  ## 1. Pick a location
6
7
 
@@ -9,7 +10,8 @@ An agent type is one Markdown file: YAML frontmatter on top, system prompt below
9
10
  | User | `<pi-agent-dir>/subagent-manager/agents/` (normally `~/.pi/agent/subagent-manager/agents/`) |
10
11
  | Project | `<cwd>/.pi/agent/subagent-manager/agents/` — loaded only when pi trusts the project |
11
12
 
12
- Precedence: **project > user > bundled**. A file with the same `name` as a bundled agent replaces it.
13
+ Precedence: **project > user > bundled**. Markdown definitions replace lower-layer
14
+ definitions; YAML overlays inherit any fields they do not specify.
13
15
 
14
16
  ## Tweak settings or fork the agent?
15
17
 
@@ -26,7 +28,6 @@ project) cannot hold both a `.md` and a `.yml` for the same name.
26
28
  `~/.pi/agent/subagent-manager/agents/coder.yml`:
27
29
 
28
30
  ```yaml
29
- name: coder
30
31
  thinkingLevel: low
31
32
  tools:
32
33
  allow:
@@ -36,18 +37,34 @@ tools:
36
37
  - agent_pause
37
38
  ```
38
39
 
39
- Only listed fields override; everything else follows the base definition, so
40
- untouched settings keep tracking bundled updates. Set an optional field to
41
- `null` to clear it back to the base state (e.g. `icon: null`). `name`, when
42
- present, must match the filename. Overrides need a base agent to merge onto —
43
- a `.yml` without a matching bundled or forked definition is rejected.
40
+ Only listed fields override; everything else follows the lower-layer definition,
41
+ so untouched models, settings, descriptions, and prompts keep tracking extension
42
+ updates. `tools.allow` and `tools.block` merge independently: changing one does
43
+ not pin the other. Lists replace the corresponding list, rather than appending.
44
+ An empty tool list (`[]`) is an explicit empty list.
45
+
46
+ Omit a field to inherit it. Set an optional field to `null` to **remove** it from
47
+ the effective definition, not to restore the bundled value: `models: null` uses
48
+ the parent/default model; `icon: null` hides the icon; `tools.allow: null` removes
49
+ the allow list while keeping the inherited block list; `tools: null` removes the
50
+ whole policy. To restore inheritance, delete that setting from the YAML file.
51
+ `name` is optional and, when present, must match the filename. `.yml` and `.yaml`
52
+ are both supported. An override needs a matching lower-layer agent — an orphan
53
+ YAML file is rejected. Prompt fields/bodies are not allowed in YAML overlays.
44
54
 
45
55
  In `/agents types`, editing a bundled agent asks you to pick one mode first,
46
- and settings stay locked until you choose. Overrides cannot rename the agent
47
- or edit the system prompt — fork it instead.
56
+ and settings stay locked until you choose. **Tweak settings** starts with an
57
+ empty overlay (`{}` when saved unchanged), not a copy of the definition. Saving
58
+ writes only changed settings and retains existing explicit overrides, even if
59
+ an override currently matches a default. Saving to another scope writes the
60
+ edits into that scope without copying unchanged values from the displayed
61
+ scope. Project overlays inherit user customizations; user overlays inherit
62
+ bundled definitions. Overrides cannot rename the agent or edit the system
63
+ prompt — fork it instead. Full Markdown forks remain full copies.
48
64
 
49
65
  To undo a fork or override, choose **Reset to bundled** (after Save) in the editor.
50
- It deletes the `.md`/`.yml` file after confirmation and the shipped agent applies again.
66
+ It deletes the customization file after confirmation and the lower-layer agent
67
+ applies again (the user customization, if any, or the shipped definition).
51
68
 
52
69
  These are the only locations read. Other packages' `~/.pi/agent/agents` or `.pi/agents` are ignored — use [`/agents import`](importing-agents.md) for those.
53
70
 
@@ -128,7 +145,8 @@ In `/agents types`, select **[labs] Icon** and paste the glyph, then save the ag
128
145
 
129
146
  The model picker lists selected models first, in fallback order. **Enter** toggles a model, **Ctrl+↑/↓** reorders, typing filters. Unselected models are ranked by fuzzy match against `modelSuggestions`, scoped models first.
130
147
 
131
- **External editor** opens the whole file in `$VISUAL`, `$EDITOR`, or `vi`.
148
+ **External editor** opens the whole Markdown definition in `$VISUAL`, `$EDITOR`,
149
+ or `vi` in fork mode. For an overlay, edit its YAML file directly and reload.
132
150
 
133
151
  ## Errors
134
152
 
package/docs/pi-footer.md CHANGED
@@ -1,16 +1,17 @@
1
1
  # Subagent dollar totals in pi-footer
2
2
 
3
3
  With `npm:pi-footer` loaded, choose one of the two integration paths below. Both
4
- show the **settled subagent-only USD subtotal**, not the main session's cost.
5
- Keep pi-footer's native cost widget if you also want the main session cost.
4
+ show the selected **Display value**: settled subagent-only USD (default), or total
5
+ main-session + settled-subagent USD. Keep pi-footer’s native cost widget if you
6
+ want the main-session cost shown separately.
6
7
 
7
8
  The shared status key / event Widget ID is exactly **`subagent_cost`**. It is not
8
9
  `pi-subagent-manager`, an extension file path, or an npm package ID.
9
10
 
10
11
  ## Extension Status (recommended; default)
11
12
 
12
- 1. Open `/agents settings`, set **[labs] Cost display** to **pi-footer status key**,
13
- and save with **Ctrl+S**.
13
+ 1. Open `/agents settings` → **[labs] Footer display** → **Location**, choose
14
+ **pi-footer status widget**, return to settings, and save with **Ctrl+S**.
14
15
  2. Open `/footer`, choose **Edit lines**, select a row, and add **Extension Status**.
15
16
  3. Set **Status key** to **`subagent_cost`** and enable **Raw value only**.
16
17
  4. Save the footer configuration.
@@ -45,15 +46,15 @@ lookup key that must match the publisher. Do not put the package name in it.
45
46
  The manager already publishes the value using this API (no extra extension needed):
46
47
 
47
48
  ```typescript
48
- ctx.ui.setStatus("subagent_cost", "$0.1234");
49
+ ctx.ui.setStatus("subagent_cost", "💵 $0.1234");
49
50
  ```
50
51
 
51
52
  It clears the status with `ctx.ui.setStatus("subagent_cost", undefined)`.
52
53
 
53
54
  ## Pi Event Value (alternative)
54
55
 
55
- 1. Open `/agents settings`, set **[labs] Cost display** to **pi-footer event**,
56
- and save with **Ctrl+S**.
56
+ 1. Open `/agents settings` → **[labs] Footer display** → **Location**, choose
57
+ **pi-footer event**, return to settings, and save with **Ctrl+S**.
57
58
  2. In `/footer`, add a **Pi Event Value** widget to the desired row.
58
59
  3. Enter **Widget ID** as **`subagent_cost`** manually, replacing the generated ID,
59
60
  and enable **Raw value only**. Event IDs do **not** appear in the status-key selector.
@@ -88,7 +89,7 @@ This is the exact event name and payload shape, with an illustrative dollar valu
88
89
  ```typescript
89
90
  pi.events.emit("pi-footer:update-widget", {
90
91
  widgetId: "subagent_cost",
91
- value: "$0.1234",
92
+ value: "💵 $0.1234",
92
93
  });
93
94
  ```
94
95
 
@@ -103,7 +104,7 @@ pi.events.emit("pi-footer:update-widget", {
103
104
 
104
105
  ## File locations and refresh behavior
105
106
 
106
- - Merge the `costDisplay` setting into
107
+ - Merge `costDisplay`, `costValue`, and `costIcon` settings into
107
108
  `~/.pi/agent/subagent-manager/settings.json`, or the trusted-project override
108
109
  `.pi/agent/subagent-manager/settings.json`. Preserve your other settings.
109
110
  - Footer widget snippets are **objects inside a row**, not complete configuration
@@ -116,11 +117,12 @@ pi.events.emit("pi-footer:update-widget", {
116
117
  - `$0.0000` appears at session start/reload and immediately on subagent startup.
117
118
  Running costs settle on completion, pause, stop, or failure; they remain in
118
119
  agent rows until then. Nested agents are counted once, and accounting survives
119
- resume and reaping. Nerd Font icons may prefix the dollar value when enabled.
120
- - If the status key is missing, check that the manager is loaded and the mode is
121
- **pi-footer status key**, not **pi-footer event** or **Pi status only**.
122
- **Pi status only** publishes a combined main-session + settled-subagent total,
123
- so it is not the mode to use for a subagent-only widget.
120
+ resume and reaping. The selected money, coins, or wallet icon prefixes the
121
+ dollar value: emoji with Nerd Font icons off, or a Nerd Font glyph with it on.
122
+ - If the status key is missing, check that the manager is loaded and the location
123
+ is **pi-footer status widget**, not **pi-footer event**. **Replace Pi status**
124
+ uses the same status key but includes a Subagents/Total label. All locations
125
+ support either display value; choose **Only subagent cost** for a subtotal.
124
126
 
125
127
  See [Cost display settings](settings.md#labs-cost-display-costdisplay) for all modes
126
128
  and fallback behavior when pi-footer is not loaded.
package/docs/settings.md CHANGED
@@ -18,6 +18,8 @@ All keys are optional. Defaults:
18
18
  "nerdFontIcons": false,
19
19
  "loaderStyle": "circle",
20
20
  "costDisplay": "pi-footer-status",
21
+ "costValue": "subagents",
22
+ "costIcon": "money",
21
23
  "finalRecap": false,
22
24
  "modelSelection": "pick-first-scoped",
23
25
  "toolFiltering": "allowed",
@@ -73,15 +75,17 @@ The Labs preview shows every family's running animation frames and completed, pa
73
75
 
74
76
  ## [labs] Cost display (`costDisplay`)
75
77
 
76
- Choose the cost output in `/agents settings` and save. The stable ID/key is **`subagent_cost`**.
78
+ Open **[labs] Footer display** in `/agents settings` to choose the location, display value, and icon, then return and save. The stable ID/key is **`subagent_cost`**.
77
79
 
78
80
  | Value | Output |
79
81
  | --- | --- |
80
- | `pi-footer-status` (default) | Publishes `$0.0000` via Pi’s `setStatus` API. In `/footer`, add **Extension Status** and pick **`subagent_cost`** from the status-key selector. |
81
- | `pi-footer-event` | Emits `pi-footer:update-widget` with `widgetId: "subagent_cost"`. Add **Pi Event Value**, enter **Widget ID** manually, and enable **Raw value only**. Event IDs do not appear in the status selector. Without an extension providing `/footer`, preserves the combined-cost fallback footer. |
82
- | `pi-status` | Sets Pi’s status to `Total: $0.0000` — main session + all settled subagents; no pi-footer events or custom footer. |
82
+ | `pi-footer-status` (default) | Publishes `💵 $0.0000` via Pi’s `setStatus` API. In `/footer`, add **Extension Status** and pick **`subagent_cost`** from the status-key selector. |
83
+ | `pi-footer-event` | Emits `pi-footer:update-widget` with `widgetId: "subagent_cost"`. Add **Pi Event Value**, enter **Widget ID** manually, and enable **Raw value only**. Event IDs do not appear in the status selector. Without an extension providing `/footer`, preserves the fallback footer, using the selected value/icon. |
84
+ | `pi-status` | **Replace Pi status**: sets the manager’s Pi status to `Subagents: 💵 $0.0000` or `Total: 💵 $0.0000`; no pi-footer events or custom footer. |
83
85
 
84
- Both status modes use the same public Pi status API: third-party footers may also display Pi status-only output. These modes never replace your footer. The pi-footer modes show the **settled subagent-only** USD subtotal; Pi status shows **main session + all settled subagents**. In all modes, running costs settle on completion, pause, stop, or failure. It publishes on session start/reload, immediately when a subagent starts (even at zero), and after settlement/settings changes. Switching modes clears the previous output; shutdown clears the published value. Nerd Font icons apply when enabled.
86
+ Both status modes use the same public Pi status API: third-party footers may also display Pi status-only output. These modes never replace your footer. **Display value** (`costValue`) is independent of location: `subagents` (default) shows settled subagent-only USD; `total` adds the main session’s cost. In all modes, running subagent costs settle on completion, pause, stop, or failure. Values publish on session start/reload, immediately when a subagent starts (even at zero), after settlement/settings changes, and when main-session turns end. Switching locations clears the previous output; shutdown clears the published value.
87
+
88
+ **Icon** (`costIcon`) offers `money` (default), `coins`, or `wallet`. With **[labs] Nerd Font icons** off, these appear as 💵, 🪙, or 👛. With it on, the picker and output use corresponding Nerd Font glyphs instead. The semantic choice survives toggling font mode.
85
89
 
86
90
  See [Subagent dollar totals in pi-footer](pi-footer.md) for step-by-step setup and copy-paste widget configuration, status-key, and event snippets.
87
91
 
@@ -72,7 +72,7 @@ Refreshes every second and keeps your selection, collapse state and scroll posit
72
72
 
73
73
  ### Live agent navigation
74
74
 
75
- The fullscreen watcher renders steer and agent messages (including thinking) as Markdown, same as pi's main transcript. Tool calls and their results share pi's native `ToolExecutionComponent`, with built-in renderers for shell commands, reads, highlighted writes, edit diffs and search tools. Pending, successful and failed executions use pi's active theme colors. Unknown tools use pi's safe generic renderer; nested executions appear beneath their parent. **Ctrl+O** toggles full tool output from either input or transcript focus. **t** cycles detail levels with transcript controls focused: **preview** (default: pi's native tool previews, first three rendered thinking lines), **compact** (one line per call, thinking hidden), **full** (complete tool output and thinking). Successful reads are collapsed by default, just like pi; expand them with **Ctrl+O**. Inherited context is initially collapsed (**c** toggles it with transcript controls focused). Watching alone never starts a turn, switches sessions, or changes model/tool/resource ownership. Extension renderers are never invoked, raw terminal controls are stripped, and images use safe text placeholders. Legacy sessions without reliable inherited-prefix metadata show their whole transcript.
75
+ The fullscreen watcher renders steer and agent messages (including thinking) as Markdown, same as pi's main transcript. Tool calls and their results share pi's native `ToolExecutionComponent`, with built-in renderers for shell commands, reads, highlighted writes, edit diffs and search tools. Pending, successful and failed executions use pi's active theme colors. Unknown tools use pi's safe generic renderer; nested executions appear beneath their parent. **Ctrl+O** cycles all three detail levels in both steer and browse mode: **preview** (default: pi's native tool previews, first three rendered thinking lines), **compact** (one line per call, thinking hidden), **full** (complete tool output and thinking). Successful reads are collapsed by default, just like pi; expand them with **Ctrl+O**. Inherited context is initially collapsed (**c** toggles it with transcript controls focused). Watching alone never starts a turn, switches sessions, or changes model/tool/resource ownership. Extension renderers are never invoked, raw terminal controls are stripped, and images use safe text placeholders. Legacy sessions without reliable inherited-prefix metadata show their whole transcript.
76
76
 
77
77
  - The bottom **Steer** input is focused initially. Type and press **Enter** to send to the inspected agent, including nested descendants, through the same service as `agent_steer`: running agents receive queued input; paused/completed/stopped agents resume their retained session. Empty input is ignored. Sending leaves the viewer open; failures are shown and preserve the draft for retry.
78
78
  - **Tab** switches between steering input and transcript controls. While typing, **c/t/l/r** are ordinary text and **Home/End** move the input cursor. Pasting never submits by itself.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-subagent-manager",
3
- "version": "0.20.0",
3
+ "version": "0.21.1",
4
4
  "description": "Hierarchical, steerable subagent threads for pi",
5
5
  "type": "module",
6
6
  "engines": {
package/src/index.ts CHANGED
@@ -51,6 +51,8 @@ export default function piSubagent(pi: ExtensionAPI): void {
51
51
  () => costLedger.totalUsd,
52
52
  () => limits.nerdFontIcons,
53
53
  () => limits.costDisplay,
54
+ () => limits.costValue,
55
+ () => limits.costIcon,
54
56
  );
55
57
  const refreshCostFooter = (ctx: ExtensionContext) => costFooter.refresh(ctx);
56
58
  const rollupCost = (thread: ThreadView) => {
@@ -186,6 +186,16 @@ function toolPolicy(value: unknown): NonNullable<AgentType["tools"]> {
186
186
  return result;
187
187
  }
188
188
 
189
+ function overrideToolPolicy(value: unknown): NonNullable<AgentSettingsOverride["tools"]> {
190
+ const mapping = record(value, "tools");
191
+ const result: NonNullable<AgentSettingsOverride["tools"]> = {};
192
+ for (const key of Object.keys(mapping)) {
193
+ if (key !== "allow" && key !== "block") throw new Error(`Unknown tools field: ${key}`);
194
+ result[key] = mapping[key] === null ? null : toolNames(mapping[key], `tools.${key}`);
195
+ }
196
+ return result;
197
+ }
198
+
189
199
  export function parseAgentType(content: string, filePath?: string): AgentType {
190
200
  try {
191
201
  const { yaml, body } = frontmatter(content);
@@ -271,7 +281,7 @@ export type AgentCustomizationKind = "fork" | "override";
271
281
  /**
272
282
  * Sparse settings parsed from a `<name>.yml` override file. Plain YAML mapping,
273
283
  * no frontmatter, no Markdown body. Omitted fields follow the base definition;
274
- * explicit `null` on an optional field resets it to the base/inherit state.
284
+ * explicit `null` clears an optional field (rather than inheriting it).
275
285
  */
276
286
  export interface AgentSettingsOverride {
277
287
  name?: string;
@@ -283,7 +293,7 @@ export interface AgentSettingsOverride {
283
293
  thinkingLevel?: AgentType["thinkingLevel"] | null;
284
294
  color?: string | null;
285
295
  icon?: string | null;
286
- tools?: NonNullable<AgentType["tools"]> | null;
296
+ tools?: { allow?: string[] | null; block?: string[] | null } | null;
287
297
  }
288
298
 
289
299
  export const AGENT_OVERRIDE_EXTENSIONS = [".yml", ".yaml"] as const;
@@ -389,7 +399,7 @@ export function parseAgentSettings(
389
399
  return value;
390
400
  });
391
401
  if (Object.hasOwn(data, "tools"))
392
- result.tools = data.tools === null ? null : toolPolicy(data.tools);
402
+ result.tools = data.tools === null ? null : overrideToolPolicy(data.tools);
393
403
  return result;
394
404
  } catch (error) {
395
405
  throw new Error(
@@ -420,16 +430,6 @@ export function serializeAgentSettings(override: AgentSettingsOverride): string
420
430
  return content;
421
431
  }
422
432
 
423
- /** Fields an override may clear back to the base/inherit state with null. */
424
- const CLEARABLE_OVERRIDE_FIELDS = new Set([
425
- "models",
426
- "modelSuggestions",
427
- "thinkingLevel",
428
- "color",
429
- "icon",
430
- "tools",
431
- ]);
432
-
433
433
  /**
434
434
  * Merge a sparse settings override on top of a base definition. Unset fields
435
435
  * follow the base; explicit null clears the field. The prompt body always
@@ -457,24 +457,33 @@ export function mergeAgentSettings(
457
457
  "thinkingLevel",
458
458
  "color",
459
459
  "icon",
460
- "tools",
461
460
  ] as const) {
462
461
  const value = override[key];
463
462
  if (value === undefined) continue;
464
463
  if (value === null) delete merged[key];
465
464
  else (merged[key] as unknown) = structuredClone(value);
466
465
  }
466
+ if (override.tools === null) delete merged.tools;
467
+ else if (override.tools !== undefined) {
468
+ merged.tools ??= {};
469
+ for (const key of ["allow", "block"] as const) {
470
+ const value = override.tools[key];
471
+ if (value === null) delete merged.tools[key];
472
+ else if (value !== undefined) merged.tools[key] = [...value];
473
+ }
474
+ if (!Object.keys(merged.tools).length) delete merged.tools;
475
+ }
467
476
  merged.systemPrompt = base.systemPrompt;
468
477
  return merged;
469
478
  }
470
479
 
471
480
  /**
472
481
  * Diff a draft against its base: only changed settings land in the override
473
- * file, so untouched fields keep tracking bundled updates. Always includes
474
- * the agent name for readability.
482
+ * file, so untouched fields keep tracking bundled updates. The filename
483
+ * identifies the agent; an unchanged draft produces an empty mapping.
475
484
  */
476
485
  export function diffAgentSettings(base: AgentType, draft: AgentType): AgentSettingsOverride {
477
- const override: AgentSettingsOverride = { name: draft.name };
486
+ const override: AgentSettingsOverride = {};
478
487
  if (draft.description !== base.description) override.description = draft.description;
479
488
  const baseModels = getModelPreferences(base);
480
489
  const draftModels = getModelPreferences(draft);
@@ -493,18 +502,64 @@ export function diffAgentSettings(base: AgentType, draft: AgentType): AgentSetti
493
502
  "thinkingLevel",
494
503
  "color",
495
504
  "icon",
496
- "tools",
497
505
  ] as const) {
498
506
  const before = base[key];
499
507
  const after = draft[key];
500
- if (JSON.stringify(before ?? null) === JSON.stringify(after ?? null)) continue;
508
+ if (sameSetting(before, after)) continue;
501
509
  if (after === undefined) override[key] = null as never;
502
510
  else (override[key] as unknown) = structuredClone(after);
503
511
  }
504
- void CLEARABLE_OVERRIDE_FIELDS;
512
+ for (const key of ["allow", "block"] as const) {
513
+ if (sameSetting(base.tools?.[key], draft.tools?.[key])) continue;
514
+ override.tools ??= {};
515
+ override.tools[key] = draft.tools?.[key] === undefined ? null : [...draft.tools[key]!];
516
+ }
505
517
  return override;
506
518
  }
507
519
 
520
+ function sameSetting(before: unknown, after: unknown): boolean {
521
+ return JSON.stringify(before ?? null) === JSON.stringify(after ?? null);
522
+ }
523
+
524
+ /** Retain existing explicit pins; update only settings actually edited in this draft. */
525
+ function updateAgentSettings(
526
+ base: AgentType,
527
+ before: AgentType,
528
+ draft: AgentType,
529
+ existing: AgentSettingsOverride,
530
+ ): AgentSettingsOverride {
531
+ const result = structuredClone(existing);
532
+ const edits = diffAgentSettings(before, draft);
533
+ const desired = diffAgentSettings(base, draft);
534
+ for (const key of [
535
+ "description",
536
+ "models",
537
+ "modelSuggestions",
538
+ "thinkingLevel",
539
+ "color",
540
+ "icon",
541
+ ] as const) {
542
+ if (!Object.hasOwn(edits, key)) continue;
543
+ if (desired[key] === undefined) delete result[key];
544
+ else (result[key] as unknown) = desired[key];
545
+ if (key === "models") delete result.model;
546
+ }
547
+ if (edits.tools) {
548
+ // Whole-policy clears must keep clearing the untouched sibling, too.
549
+ if (result.tools === null) result.tools = { allow: null, block: null };
550
+ const tools = result.tools ?? {};
551
+ for (const key of ["allow", "block"] as const) {
552
+ if (!Object.hasOwn(edits.tools, key)) continue;
553
+ const value = desired.tools?.[key];
554
+ if (value === undefined) delete tools[key];
555
+ else tools[key] = value;
556
+ }
557
+ if (Object.keys(tools).length) result.tools = tools;
558
+ else delete result.tools;
559
+ }
560
+ return result;
561
+ }
562
+
508
563
  export function selectTools(
509
564
  policy: AgentType["tools"],
510
565
  available: string[],
@@ -539,6 +594,8 @@ export class ConfigStore {
539
594
  diagnostics: string[] = [];
540
595
  private types = new Map<string, AgentType>();
541
596
  private bases = new Map<string, AgentType>();
597
+ private scopeBases = new Map<AgentScope, Map<string, AgentType>>();
598
+ private scopeOverrides = new Map<AgentScope, Map<string, AgentSettingsOverride>>();
542
599
  private readonly options: ConfigStoreOptions;
543
600
 
544
601
  constructor(options: ConfigStoreOptions) {
@@ -549,6 +606,8 @@ export class ConfigStore {
549
606
  reload(): void {
550
607
  this.types.clear();
551
608
  this.bases.clear();
609
+ this.scopeBases.clear();
610
+ this.scopeOverrides.clear();
552
611
  this.diagnostics = [];
553
612
  const layers: [string, NonNullable<AgentType["source"]>][] = [
554
613
  [
@@ -573,6 +632,10 @@ export class ConfigStore {
573
632
  ),
574
633
  );
575
634
  for (const [directory, source] of layers) {
635
+ if (source !== "bundled") {
636
+ this.scopeBases.set(source, structuredClone(this.types));
637
+ this.scopeOverrides.set(source, new Map());
638
+ }
576
639
  let files: string[];
577
640
  try {
578
641
  const stat = assertNotSymlinkPath(directory);
@@ -812,6 +875,7 @@ export class ConfigStore {
812
875
  try {
813
876
  const merged = mergeAgentSettings(base, { ...override, name });
814
877
  this.bases.set(name, structuredClone(base));
878
+ this.scopeOverrides.get(scope)!.set(name, structuredClone(override));
815
879
  this.types.set(name, {
816
880
  ...merged,
817
881
  name,
@@ -892,6 +956,12 @@ export class ConfigStore {
892
956
  return base ? structuredClone(base) : undefined;
893
957
  }
894
958
 
959
+ /** Definition below a specific save scope; never includes that scope or higher ones. */
960
+ private getScopeBase(name: string, scope: AgentScope): AgentType | undefined {
961
+ const base = this.scopeBases.get(scope)?.get(name);
962
+ return base ? structuredClone(base) : undefined;
963
+ }
964
+
895
965
  private canPreserveDestination(
896
966
  name: string,
897
967
  scope: AgentScope,
@@ -976,28 +1046,27 @@ export class ConfigStore {
976
1046
  /**
977
1047
  * Save a settings-only `<name>.yml` override merged on top of the base.
978
1048
  * The prompt body always comes from the base; only changed settings are
979
- * written so untouched fields keep tracking bundled updates.
1049
+ * written so untouched fields keep tracking bundled updates. Existing pins
1050
+ * are retained; `original` is the pre-edit snapshot (also used to avoid
1051
+ * copying inherited settings into another scope or from a stale draft).
980
1052
  */
981
1053
  saveOverride(
982
1054
  name: string,
983
1055
  draft: AgentType,
984
1056
  scope: AgentScope,
985
- original?: SaveOrigin,
1057
+ original?: AgentType,
986
1058
  ): AgentType {
987
1059
  if (!NAME.test(name)) throw new Error("Unsafe agent name");
988
1060
  if (draft.name !== name)
989
1061
  throw new Error("Settings overrides cannot rename the agent; fork it instead");
990
- const base = this.getBase(name) ?? (() => {
991
- try {
992
- return this.get(name);
993
- } catch {
994
- return undefined;
995
- }
996
- })();
1062
+ const base = this.getScopeBase(name, scope);
997
1063
  if (!base) throw new Error(`Settings override has no base agent named ${JSON.stringify(name)}`);
998
- if (base.name !== name)
999
- throw new Error(`Settings override has no base agent named ${JSON.stringify(name)}`);
1000
- const override = diffAgentSettings(base, { ...draft, name });
1064
+ const before = original ?? this.get(name);
1065
+ const existing = this.scopeOverrides.get(scope)?.get(name) ?? {};
1066
+ const override =
1067
+ before.customization?.kind === "fork"
1068
+ ? diffAgentSettings(base, draft)
1069
+ : updateAgentSettings(base, before, draft, existing);
1001
1070
  const content = serializeAgentSettings(override);
1002
1071
  parseAgentSettings(content, undefined, name);
1003
1072
  const filePath = this.destination(name, scope, original, "override");
@@ -22,6 +22,12 @@ export type WidgetMode = (typeof WIDGET_MODES)[number];
22
22
  export const COST_DISPLAY_MODES = ["pi-footer-event", "pi-footer-status", "pi-status"] as const;
23
23
  export type CostDisplayMode = (typeof COST_DISPLAY_MODES)[number];
24
24
 
25
+ export const COST_VALUES = ["subagents", "total"] as const;
26
+ export type CostValue = (typeof COST_VALUES)[number];
27
+
28
+ export const COST_ICONS = ["money", "coins", "wallet"] as const;
29
+ export type CostIcon = (typeof COST_ICONS)[number];
30
+
25
31
  export const LOADER_STYLES = ["circle", "braille", "hourglass"] as const;
26
32
  export type LoaderStyle = (typeof LOADER_STYLES)[number];
27
33
 
@@ -40,6 +46,8 @@ export interface ManagerSettings {
40
46
  toolFiltering: ToolFilteringMode;
41
47
  widgetMode: WidgetMode;
42
48
  costDisplay: CostDisplayMode;
49
+ costValue: CostValue;
50
+ costIcon: CostIcon;
43
51
  nerdFontIcons: boolean;
44
52
  loaderStyle: LoaderStyle;
45
53
  finalRecap: boolean;
@@ -58,13 +66,15 @@ export const DEFAULT_MANAGER_SETTINGS: ManagerSettings = {
58
66
  toolFiltering: "allowed",
59
67
  widgetMode: "full",
60
68
  costDisplay: "pi-footer-status",
69
+ costValue: "subagents",
70
+ costIcon: "money",
61
71
  nerdFontIcons: false,
62
72
  loaderStyle: "circle",
63
73
  finalRecap: false,
64
74
  };
65
75
 
66
76
  const KEYS = [
67
- "maxLevels", "maxConcurrent", "maxThreads", "modelSelection", "subagentMode", "toolFiltering", "widgetMode", "costDisplay", "nerdFontIcons", "loaderStyle", "finalRecap",
77
+ "maxLevels", "maxConcurrent", "maxThreads", "modelSelection", "subagentMode", "toolFiltering", "widgetMode", "costDisplay", "costValue", "costIcon", "nerdFontIcons", "loaderStyle", "finalRecap",
68
78
  ] as const;
69
79
  const MAX_LEVELS = 32;
70
80
 
@@ -106,6 +116,8 @@ function requirement(key: (typeof KEYS)[number]): string {
106
116
  if (key === "subagentMode") return "subagentMode must be off, opportunistic or orchestration";
107
117
  if (key === "widgetMode") return "widgetMode must be full or minimal";
108
118
  if (key === "costDisplay") return "costDisplay must be pi-footer-event, pi-footer-status or pi-status";
119
+ if (key === "costValue") return "costValue must be subagents or total";
120
+ if (key === "costIcon") return "costIcon must be money, coins or wallet";
109
121
  if (key === "loaderStyle") return "loaderStyle must be circle, braille or hourglass";
110
122
  if (key === "toolFiltering") return "toolFiltering must be allowed, all-except-blocked or all";
111
123
  if (key === "modelSelection")
@@ -165,6 +177,16 @@ function parseSettings(content: string): Partial<ManagerSettings> {
165
177
  layer.costDisplay = value as CostDisplayMode;
166
178
  continue;
167
179
  }
180
+ if (key === "costValue") {
181
+ if (!COST_VALUES.includes(value as CostValue)) throw new Error(requirement(key));
182
+ layer.costValue = value as CostValue;
183
+ continue;
184
+ }
185
+ if (key === "costIcon") {
186
+ if (!COST_ICONS.includes(value as CostIcon)) throw new Error(requirement(key));
187
+ layer.costIcon = value as CostIcon;
188
+ continue;
189
+ }
168
190
  if (key === "loaderStyle") {
169
191
  if (!LOADER_STYLES.includes(value as LoaderStyle)) throw new Error(requirement(key));
170
192
  layer.loaderStyle = value as LoaderStyle;
@@ -2,7 +2,7 @@ import { homedir } from "node:os";
2
2
  import type { Usage } from "@earendil-works/pi-ai";
3
3
  import type { ExtensionAPI, ExtensionContext, SessionEntry } from "@earendil-works/pi-coding-agent";
4
4
  import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
5
- import type { CostDisplayMode } from "../prefs/settings.ts";
5
+ import type { CostDisplayMode, CostValue, CostIcon } from "../prefs/settings.ts";
6
6
 
7
7
  export function footerUsage(entries: readonly SessionEntry[]) {
8
8
  const totals = { input: 0, output: 0, cacheRead: 0, cacheWrite: 0, cost: 0 };
@@ -32,6 +32,15 @@ export const COST_WIDGET_ID = "subagent_cost";
32
32
  export const COST_WIDGET_EVENT = "pi-footer:update-widget";
33
33
  export const COST_ICON = "\uf0d6";
34
34
 
35
+ export function costIconGlyph(icon: CostIcon, nerdFontIcons: boolean): string {
36
+ const glyphs = {
37
+ money: { emoji: "💵", nerd: COST_ICON },
38
+ coins: { emoji: "🪙", nerd: "\u{f0512}" },
39
+ wallet: { emoji: "👛", nerd: "\u{f055d}" },
40
+ };
41
+ return glyphs[icon][nerdFontIcons ? "nerd" : "emoji"];
42
+ }
43
+
35
44
  export function formatSubagentCost(cost: number, nerdFontIcons: boolean): string {
36
45
  return `${nerdFontIcons ? COST_ICON + " " : ""}$${cost.toFixed(4)}`;
37
46
  }
@@ -54,11 +63,20 @@ export class CostFooterController {
54
63
  private readonly subagentCost: () => number,
55
64
  private readonly nerdFontIcons: () => boolean,
56
65
  private readonly displayMode: () => CostDisplayMode = () => "pi-footer-status",
66
+ private readonly costValue: () => CostValue = () => "subagents",
67
+ private readonly costIcon: () => CostIcon = () => "money",
57
68
  ) {}
58
69
 
70
+ private formatCost(mainCost: number): string {
71
+ const cost = this.subagentCost() + (this.costValue() === "total" ? mainCost : 0);
72
+ return `${costIconGlyph(this.costIcon(), this.nerdFontIcons())} $${cost.toFixed(4)}`;
73
+ }
74
+
59
75
  refresh(ctx: ExtensionContext): void {
60
76
  const mode = this.displayMode();
61
- const value = formatSubagentCost(this.subagentCost(), this.nerdFontIcons());
77
+ const value = this.formatCost(
78
+ this.costValue() === "total" ? footerUsage(ctx.sessionManager.getEntries()).cost : 0,
79
+ );
62
80
  if (this.publishedMode !== undefined && this.publishedMode !== mode) {
63
81
  this.clear();
64
82
  this.reset(ctx);
@@ -67,14 +85,8 @@ export class CostFooterController {
67
85
  if (mode !== "pi-footer-event") {
68
86
  if (ctx.hasUI) {
69
87
  this.statusContext = ctx;
70
- const statusValue =
71
- mode === "pi-status"
72
- ? `Total: ${formatSubagentCost(
73
- footerUsage(ctx.sessionManager.getEntries()).cost + this.subagentCost(),
74
- this.nerdFontIcons(),
75
- )}`
76
- : value;
77
- ctx.ui.setStatus(COST_WIDGET_ID, statusValue);
88
+ const label = this.costValue() === "total" ? "Total" : "Subagents";
89
+ ctx.ui.setStatus(COST_WIDGET_ID, mode === "pi-status" ? `${label}: ${value}` : value);
78
90
  }
79
91
  return;
80
92
  }
@@ -91,7 +103,7 @@ export class CostFooterController {
91
103
  return;
92
104
  }
93
105
  if (this.subagentCost() <= 0 || !ctx.hasUI || ctx.mode !== "tui") return;
94
- this.requestRender = installCostFooter(ctx, this.subagentCost);
106
+ this.requestRender = installCostFooter(ctx, this.subagentCost, (mainCost) => this.formatCost(mainCost));
95
107
  this.installed = true;
96
108
  }
97
109
 
@@ -123,6 +135,7 @@ const tokens = (n: number) =>
123
135
  export function installCostFooter(
124
136
  ctx: ExtensionContext,
125
137
  subagentCost: () => number,
138
+ displayCost?: (mainCost: number) => string,
126
139
  ): (() => void) | undefined {
127
140
  if (!ctx.hasUI || ctx.mode !== "tui" || !ctx.ui.setFooter) return;
128
141
  let requestRender: (() => void) | undefined;
@@ -163,7 +176,8 @@ export function installCostFooter(
163
176
  const subscription =
164
177
  ctx.model &&
165
178
  (ctx.model.provider === "kimi-coding" || ctx.modelRegistry?.isUsingOAuth(ctx.model));
166
- parts.push(`$${(totals.cost + subagentCost()).toFixed(3)}${subscription ? " (sub)" : ""}`);
179
+ const costText = displayCost?.(totals.cost) ?? `$${(totals.cost + subagentCost()).toFixed(3)}`;
180
+ parts.push(`${costText}${subscription ? " (sub)" : ""}`);
167
181
  const context = ctx.getContextUsage();
168
182
  if (context) {
169
183
  const text = `${context.percent === null ? "?" : context.percent.toFixed(1) + "%"}/${tokens(context.contextWindow)}`;
@@ -17,7 +17,7 @@ import { AGENT_PROGRESS_INTERVAL, agentProgressIcon, agentTypeLabel } from "./ui
17
17
  import type { LoaderStyle } from "../prefs/settings.ts";
18
18
  import { renderTranscriptTool } from "./transcript-tool.ts";
19
19
 
20
- /** Transcript detail level cycled by the t key: full → preview → compact. */
20
+ /** Transcript detail level cycled by Ctrl+O: full → preview → compact. */
21
21
  export type TranscriptDetail = "full" | "preview" | "compact";
22
22
  const DETAIL_CYCLE: TranscriptDetail[] = ["full", "preview", "compact"];
23
23
 
@@ -260,7 +260,8 @@ export class LiveAgentView {
260
260
  if (matchesKey(data, Key.ctrl("q")) || matchesKey(data, Key.ctrl("c")))
261
261
  return this.done("main");
262
262
  if (matchesKey(data, Key.ctrl("o"))) {
263
- this.viewport.detail = this.detail === "full" ? "preview" : "full";
263
+ this.viewport.detail =
264
+ DETAIL_CYCLE[(DETAIL_CYCLE.indexOf(this.detail) + 1) % DETAIL_CYCLE.length];
264
265
  this.invalidate();
265
266
  this.host.requestRender();
266
267
  return;
@@ -288,10 +289,6 @@ export class LiveAgentView {
288
289
  } else if (data === "c") {
289
290
  this.viewport.showInherited = !this.viewport.showInherited;
290
291
  this.invalidate();
291
- } else if (data === "t") {
292
- this.viewport.detail =
293
- DETAIL_CYCLE[(DETAIL_CYCLE.indexOf(this.detail) + 1) % DETAIL_CYCLE.length];
294
- this.invalidate();
295
292
  } else if (matchesKey(data, Key.home)) this.scroll.scrollTo(0, { disableFollow: true });
296
293
  else if (matchesKey(data, Key.end) || data === "l") this.scroll.scrollToEnd();
297
294
  else return;
@@ -378,7 +375,7 @@ export class LiveAgentView {
378
375
  if (block.type === "image") return ["[Image — text-only observer]"];
379
376
  if (block.type === "thinking") {
380
377
  if (this.detail === "compact")
381
- return [this.theme.fg("dim", "[Thinking hidden · t cycles view]")];
378
+ return [this.theme.fg("dim", "[Thinking hidden · Ctrl+O cycles view]")];
382
379
  // Thinking is model-authored Markdown; preview truncates the rendered lines, not the source.
383
380
  const rendered = this.markdown(String(block.thinking ?? "[redacted thinking]"), width, true);
384
381
  if (this.detail === "full" || rendered.length <= 3) return rendered;
@@ -548,7 +545,7 @@ export class LiveAgentView {
548
545
  this.saveViewport();
549
546
  const footer = this.error
550
547
  ? "Ctrl+R Retry · Tab input/transcript · Esc tree · Ctrl+Q main"
551
- : `${this.editing ? "Enter steer · Tab browse" : `Tab steer · Home/End scroll · c context · t view:${this.detail}`} · Ctrl+O expand tools · Esc tree · Ctrl+Q main · ↑↓/PgUp/PgDn scroll · ${this.viewport.follow ? "following" : "scrolled"}`;
548
+ : `${this.editing ? "Enter steer · Tab browse" : "Tab steer · Home/End scroll · c context"} · Ctrl+O view:${this.detail} · Esc tree · Ctrl+Q main · ↑↓/PgUp/PgDn scroll · ${this.viewport.follow ? "following" : "scrolled"}`;
552
549
  const input = ` ${this.input.render(inner)[0]!}`;
553
550
  const status = this.theme.fg(
554
551
  this.steerStatus ? (this.steerFailed ? "error" : "muted") : this.error ? "error" : "muted",
@@ -9,6 +9,9 @@ import {
9
9
  import {
10
10
  DEFAULT_MANAGER_SETTINGS,
11
11
  type CostDisplayMode,
12
+ COST_ICONS,
13
+ type CostIcon,
14
+ type CostValue,
12
15
  LOADER_STYLES,
13
16
  type LoaderStyle,
14
17
  loadManagerSaveScope,
@@ -23,6 +26,7 @@ import {
23
26
  import { editAgentTypes } from "./ui.ts";
24
27
  import type { ToolEditorOptions } from "./tool-picker.ts";
25
28
  import { AGENT_LOADERS } from "./agent-loader.ts";
29
+ import { costIconGlyph } from "./cost-footer.ts";
26
30
 
27
31
  const LOADER_OPTIONS = LOADER_STYLES.map((id) => {
28
32
  const loader = AGENT_LOADERS[id];
@@ -120,22 +124,76 @@ const WIDGET_MODE_HELP =
120
124
 
121
125
  const COST_DISPLAY_OPTIONS = [
122
126
  {
123
- id: "pi-footer-event",
124
- label: "pi-footer event",
125
- help: "Publish settled subagent-only USD via pi-footer:update-widget with Widget ID subagent_cost. Add a Pi Event Value widget manually and enable Raw value only. Without an external /footer, retain the combined-cost fallback.",
127
+ id: "pi-status",
128
+ label: "Replace Pi status",
129
+ help: "Show the selected cost in Pi’s status area, without replacing the whole footer. Third-party footers may also consume this status.",
126
130
  },
127
131
  {
128
132
  id: "pi-footer-status",
129
- label: "pi-footer status key",
130
- help: "Publish settled subagent-only USD under status key subagent_cost for pi-footer’s Extension Status selector, including $0.0000 before any cost settles. Does not replace your footer.",
133
+ label: "pi-footer status widget",
134
+ value: "subagent_cost",
135
+ help: "Status key: subagent_cost\nSelect subagent_cost in pi-footer’s Extension Status widget. Does not replace your footer.",
131
136
  },
132
137
  {
133
- id: "pi-status",
134
- label: "Pi status only",
135
- help: "Only update Pi’s status with total USD cost: main session + all settled subagents. pi-footer modes show subagent-only cost. No pi-footer events or custom footer. Third-party footers may also consume this status key.",
138
+ id: "pi-footer-event",
139
+ label: "pi-footer event",
140
+ value: "subagent_cost",
141
+ help: "Event: pi-footer:update-widget\nWidget ID: subagent_cost\nAdd a Pi Event Value widget and enable Raw value only. Without an external /footer, retain the cost fallback.",
136
142
  },
137
143
  ] as const;
138
144
 
145
+ const COST_VALUE_OPTIONS = [
146
+ { id: "subagents", label: "Only subagent cost", help: "Settled USD cost of all subagents; excludes the main session." },
147
+ { id: "total", label: "Total cost", help: "Main session USD cost plus all settled subagent costs." },
148
+ ] as const;
149
+
150
+ const COST_ICON_LABELS = { money: "Money", coins: "Coins", wallet: "Wallet" } as const;
151
+
152
+ /** Edits the shared draft; only the outer settings screen saves or applies it. */
153
+ async function configureFooterDisplay(ctx: ExtensionCommandContext, draft: ManagerSettings): Promise<void> {
154
+ let selectedId: string | undefined;
155
+ while (true) {
156
+ const action = await dialogMenu(ctx, "[labs] Footer display", [
157
+ {
158
+ id: "location",
159
+ label: "Location",
160
+ value: COST_DISPLAY_OPTIONS.find((option) => option.id === draft.costDisplay)!.label,
161
+ help: "Choose Pi status, a pi-footer status widget, or a pi-footer event. Integration IDs are shown in the location picker.",
162
+ },
163
+ {
164
+ id: "value",
165
+ label: "Display value",
166
+ value: COST_VALUE_OPTIONS.find((option) => option.id === draft.costValue)!.label,
167
+ help: "Show only settled subagent cost, or main session plus settled subagents. Applies to every location.",
168
+ },
169
+ {
170
+ id: "icon",
171
+ label: "Icon",
172
+ value: `${costIconGlyph(draft.costIcon, draft.nerdFontIcons)} ${COST_ICON_LABELS[draft.costIcon]}`,
173
+ help: `Choose a money-related ${draft.nerdFontIcons ? "Nerd Font" : "emoji"} icon. The family follows [labs] Nerd Font icons.`,
174
+ },
175
+ { id: "back", label: "Back", help: "Return to settings. Save and apply there to commit these changes." },
176
+ ], { selectedId, footer: "↑↓/Tab navigate · Enter edit · Esc back" });
177
+ if (!action || action === "back") return;
178
+ selectedId = action;
179
+ if (action === "location") {
180
+ const mode = await dialogMenu(ctx, "Footer location", [...COST_DISPLAY_OPTIONS], { selectedId: draft.costDisplay });
181
+ if (COST_DISPLAY_OPTIONS.some((option) => option.id === mode)) draft.costDisplay = mode as CostDisplayMode;
182
+ } else if (action === "value") {
183
+ const value = await dialogMenu(ctx, "Footer display value", [...COST_VALUE_OPTIONS], { selectedId: draft.costValue });
184
+ if (COST_VALUE_OPTIONS.some((option) => option.id === value)) draft.costValue = value as CostValue;
185
+ } else if (action === "icon") {
186
+ const icon = await dialogMenu(ctx, `Footer icon · ${draft.nerdFontIcons ? "Nerd Font" : "Emoji"}`, COST_ICONS.map((id) => ({
187
+ id,
188
+ label: COST_ICON_LABELS[id],
189
+ value: costIconGlyph(id, draft.nerdFontIcons),
190
+ help: `${costIconGlyph(id, draft.nerdFontIcons)} ${COST_ICON_LABELS[id]} · ${draft.nerdFontIcons ? "Requires a Nerd Font in your terminal." : "Emoji icon."}`,
191
+ })), { selectedId: draft.costIcon });
192
+ if (COST_ICONS.includes(icon as CostIcon)) draft.costIcon = icon as CostIcon;
193
+ }
194
+ }
195
+ }
196
+
139
197
  const MODEL_SELECTION_OPTIONS = [
140
198
  {
141
199
  id: "pick-first-available",
@@ -228,9 +286,9 @@ async function configureAgentsDialog(
228
286
  },
229
287
  {
230
288
  id: "costDisplay",
231
- label: "[labs] Cost display",
289
+ label: "[labs] Footer display",
232
290
  value: COST_DISPLAY_OPTIONS.find((mode) => mode.id === draft.costDisplay)!.label,
233
- help: "Choose pi-footer event, pi-footer status key (default), or Pi status only. ID: subagent_cost. pi-footer modes: settled subagent-only USD. Pi status: main session + all settled subagents; publishes on session start and as soon as a subagent starts. Save to apply immediately.",
291
+ help: "Configure footer location, displayed cost, and money icon in a submenu. Save and apply to update immediately.",
234
292
  },
235
293
  {
236
294
  id: "nerdFontIcons",
@@ -332,11 +390,7 @@ async function configureAgentsDialog(
332
390
  if (WIDGET_MODE_OPTIONS.some((option) => option.id === mode))
333
391
  draft.widgetMode = mode as WidgetMode;
334
392
  } else if (action === "costDisplay") {
335
- const mode = await dialogMenu(ctx, "[labs] Cost display", [...COST_DISPLAY_OPTIONS], {
336
- selectedId: draft.costDisplay,
337
- });
338
- if (COST_DISPLAY_OPTIONS.some((option) => option.id === mode))
339
- draft.costDisplay = mode as CostDisplayMode;
393
+ await configureFooterDisplay(ctx, draft);
340
394
  } else if (action === "nerdFontIcons") {
341
395
  draft.nerdFontIcons = !draft.nerdFontIcons;
342
396
  } else if (action === "loaderStyle") {
package/src/ui/ui.ts CHANGED
@@ -24,7 +24,6 @@ import {
24
24
  import {
25
25
  AGENT_COLORS,
26
26
  ConfigStore,
27
- diffAgentSettings,
28
27
  parseAgentType,
29
28
  serializeAgentType,
30
29
  } from "../prefs/config.ts";
@@ -980,7 +979,7 @@ async function chooseCustomizationMode(
980
979
  id: "override",
981
980
  label: "Tweak settings",
982
981
  value: `${agentName}.yml`,
983
- help: "Override only settings (models, tools, thinking, color). The prompt stays bundled and keeps receiving updates. System prompt and name stay locked.",
982
+ help: "Start with an empty settings overlay; only changed fields are saved. The prompt stays bundled and keeps receiving updates. System prompt and name stay locked.",
984
983
  },
985
984
  {
986
985
  id: "fork",
@@ -1079,14 +1078,7 @@ async function editAgentTypesDialog(
1079
1078
  editMode = mode;
1080
1079
  }
1081
1080
  while (true) {
1082
- const baseForDiff =
1083
- editMode === "override" && original
1084
- ? (store.getBase(original.name) ?? original)
1085
- : undefined;
1086
- const dirty =
1087
- editMode === "override" && baseForDiff
1088
- ? Object.keys(diffAgentSettings(baseForDiff, draft)).length > 1
1089
- : !original || serializeAgentType(draft) !== originalContent;
1081
+ const dirty = !original || serializeAgentType(draft) !== originalContent;
1090
1082
  const field = await dialogMenu(
1091
1083
  ctx,
1092
1084
  `Edit ${sanitizeText(draft.name)} (unsaved)`,