pi-subagent-manager 0.26.0 → 0.27.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/README.md +1 -1
- package/docs/settings.md +10 -3
- package/docs/tools-and-ui.md +3 -3
- package/package.json +2 -1
- package/src/index.ts +22 -2
- package/src/prefs/settings.ts +26 -0
- package/src/ui/agent-navigation-editor.ts +22 -8
- package/src/ui/settings-ui.ts +34 -2
- package/src/ui/status-ui.ts +12 -1
- package/src/ui/ui.ts +7 -1
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ They inherit your current model until you set preferences. Details: [docs/defaul
|
|
|
76
76
|
| `/agents reload` | Reload definitions and settings |
|
|
77
77
|
| `/agents reap` | Confirm the eligible count, then forget completed agents and free retained-thread slots (cannot be resumed); preserves active parents and ancestors of retained threads. Session files remain on disk. |
|
|
78
78
|
|
|
79
|
-
A live **Agents** widget sits above the input box. Choose **Full** (the existing tree) or **Minimal** (colored status counts and running-agent token totals, plus the browser hint) under **Status Widget** in `/agents` settings. In the fullscreen tree, **Enter** opens an agent's live view. Type in the bottom **Steer** input and press **Enter** to send it a steering message, including nested agents. **Tab** switches between input and transcript controls, **Escape** returns, and **i** in the tree opens existing thread actions. A status strip below the previews shows how many agents are running and **Press ← to open subagent browser**. Once the main turn ends and all subagents are idle, the preview collapses to a single status-count line. A fresh prompt hides previously settled agents from the widget; they reappear only when resumed, and `/agents tree` always keeps them available.
|
|
79
|
+
A live **Agents** widget sits above the input box. Choose **Full** (the existing tree) or **Minimal** (colored status counts and running-agent token totals, plus the browser hint) under **Status Widget** in `/agents` settings. In the fullscreen tree, **Enter** opens an agent's live view. Type in the bottom **Steer** input and press **Enter** to send it a steering message, including nested agents. **Tab** switches between input and transcript controls, **Escape** returns, and **i** in the tree opens existing thread actions. A status strip below the previews shows how many agents are running and **Press ← to open subagent browser**. Once the main turn ends and all subagents are idle, the preview collapses to a single status-count line. A fresh prompt hides previously settled agents from the widget; they reappear only when resumed, and `/agents tree` always keeps them available. Arrow keys walk **tree ← full ← minimal**: press **Right** at the end of the draft (or in an empty input) to collapse the widget to one line for this session only, without changing saved settings, and **Left** at the start of the draft to step back to full and then, while subagents are starting or running, into the tree (otherwise Left stays native). With the Minimal setting the walk is just **tree ← minimal**. In the tree, **Right** on a leaf returns to the widget. `/agents tree` remains available regardless of agent activity. See [live navigation](docs/tools-and-ui.md#live-agent-navigation) for controls and compatibility.
|
|
80
80
|
|
|
81
81
|
**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.
|
|
82
82
|
|
package/docs/settings.md
CHANGED
|
@@ -58,7 +58,7 @@ Controls the subagent status display above the input box. Choose **Status Widget
|
|
|
58
58
|
| `full` (default) | A compact tree with one row per agent, task/state, metrics and navigation hints. |
|
|
59
59
|
| `minimal` | One line of theme-colored status counts plus cumulative input `↑` / output `↓` tokens for agents currently starting or running. |
|
|
60
60
|
|
|
61
|
-
Minimal mode groups starting agents with running agents and excludes the main conversation. Token totals exclude completed, stopped, failed and paused agents. The fullscreen tree remains available via `/agents tree` in either mode.
|
|
61
|
+
Minimal mode groups starting agents with running agents and excludes the main conversation. Token totals exclude completed, stopped, failed and paused agents. The fullscreen tree remains available via `/agents tree` in either mode. Arrow keys at the draft edge walk a fixed line: **tree ← full ← minimal**. With **Full** configured, all three states are reachable: **Right (→)** at the end of the main draft (or in an empty input) collapses full to the one-line minimal view for this session only, without saving preferences; **Left (←)** at the start of the draft first returns minimal to full, and from full opens the tree (only while agents are starting or running). With **Minimal** configured the line is just **tree ← minimal**: Left opens the tree, and Right does nothing because minimal is already the right edge. In the fullscreen tree, **Right** on a leaf row (after folds and descents are exhausted) closes the tree and returns to the widget (full, or minimal if configured). Session startup/switch/reload restores the configured mode.
|
|
62
62
|
|
|
63
63
|
## [labs] Nerd Font icons (`nerdFontIcons`)
|
|
64
64
|
|
|
@@ -186,8 +186,15 @@ Lower it to keep the tree tidy. Raise it for long sessions with many agents. Whe
|
|
|
186
186
|
|
|
187
187
|
Settings are read in order: **built-in defaults → Global → trusted Current Project**.
|
|
188
188
|
All keys are optional. The dialog saves only values different from the lower layer,
|
|
189
|
-
so unchanged settings continue inheriting future global changes.
|
|
190
|
-
|
|
189
|
+
so unchanged settings continue inheriting future global changes.
|
|
190
|
+
|
|
191
|
+
**Restore defaults** asks you to pick **Global** or **Project** (Project only in a
|
|
192
|
+
trusted project). The picker shows the exact `settings.json` path each choice
|
|
193
|
+
deletes. Choosing one deletes that file immediately — nothing is rewritten with
|
|
194
|
+
default or empty values — then reloads settings and discards unsaved edits. A
|
|
195
|
+
missing file is not an error. There is no undo, and Cancel in the outer dialog
|
|
196
|
+
cannot bring the file back. Deleting the Project file returns the save scope to
|
|
197
|
+
Global; Global values still apply beneath any remaining Project file.
|
|
191
198
|
|
|
192
199
|
Colored dots before each setting describe saved changes: an **accent dot** means
|
|
193
200
|
changed in Global relative to defaults; a **warning dot** means changed in Current
|
package/docs/tools-and-ui.md
CHANGED
|
@@ -84,7 +84,7 @@ The fullscreen watcher renders steer and agent messages (including thinking) as
|
|
|
84
84
|
|
|
85
85
|
While any subagent is **starting or running**, press physical **Left (←)** at the beginning of the main draft (or in an empty input) to open the subagent browser. With no active subagents, or elsewhere in the draft, Left retains normal cursor movement. `/agents tree` remains available regardless of agent activity. Down is always native editing/history navigation. Autocomplete, jumps, paste and configured shortcuts take precedence. Navigating preserves the main draft/cursor and does not require the root to be idle.
|
|
86
86
|
|
|
87
|
-
Press physical **Right (→)** at the end of the main draft (or in an empty input) to collapse the full widget to a single status line for this session. This does not save settings or change the configured **Status Widget** mode. Refreshes, agent resumes, new main turns and session-tree navigation keep it collapsed; starting, switching or reloading a session restores the configured mode. Left
|
|
87
|
+
Press physical **Right (→)** at the end of the main draft (or in an empty input) to collapse the full widget to a single status line for this session. This does not save settings or change the configured **Status Widget** mode. Refreshes, agent resumes, new main turns and session-tree navigation keep it collapsed; starting, switching or reloading a session restores the configured mode. Left from that collapsed line first returns to the full widget; Left again opens the full dialog while subagents are active. In the fullscreen tree, Right on a leaf row closes the tree and returns to the full widget, so the keys always walk **tree ← full ← minimal**. When **Status Widget** is set to Minimal, the walk is **tree ← minimal**: Left opens the tree directly, Right in the tree returns to the minimal line, and Right at the draft does nothing. Elsewhere in the draft Right retains normal cursor movement; autocomplete, jumps, paste and shortcuts take precedence.
|
|
88
88
|
|
|
89
89
|
Arrow-key shortcuts are enabled by default in the TUI; `/agents tree` remains available everywhere. Pi has one custom-editor slot: installation is skipped if another factory owns it or an existing draft is nonempty, since the host cannot transfer cursor/undo/expanded-paste state. Load order can still let a later editor replace ours. Initial startup uses Pi's history hydration; replacement installations seed history once. Session-tree rebuilds keep the existing editor instance.
|
|
90
90
|
|
|
@@ -99,7 +99,7 @@ The widget above the input editor has two display modes, selected with **Status
|
|
|
99
99
|
- **Full** (default): the existing compact tree, at most twelve lines.
|
|
100
100
|
- **Minimal**: a summary line such as `3 running, 2 stopped, 1 failed, 1 paused ↑12k ↓3k`, with semantic theme colors. Starting agents count as running; completed agents are counted when present. Token totals include only currently starting/running agents, not the main conversation or settled threads. Use `/agents tree` for details.
|
|
101
101
|
|
|
102
|
-
Once the main turn has ended and no subagents are starting or running, either mode collapses to a single status-count line without the browser hint. The full tree remains available via `/agents tree`; **Left** at the start of the draft opens it only while subagents are starting or running. A fresh main prompt hides agents that were already settled (completed, failed, stopped or paused); they remain in `/agents tree` and reappear in the widget only when resumed. Agents still starting or running remain visible, and new agents appear normally. Automatic Final Recap turns keep the current task's results visible. Visible agents use the configured display mode unless Right has collapsed the widget for this session.
|
|
102
|
+
Once the main turn has ended and no subagents are starting or running, either mode collapses to a single status-count line without the browser hint. The full tree remains available via `/agents tree`; **Left** at the start of the draft opens it only while subagents are starting or running. A fresh main prompt hides agents that were already settled (completed, failed, stopped or paused); they remain in `/agents tree` and reappear in the widget only when resumed. Agents still starting or running remain visible, and new agents appear normally. Automatic Final Recap turns keep the current task's results visible. Visible agents use the configured display mode unless Right has collapsed the widget for this session (Left expands it again).
|
|
103
103
|
|
|
104
104
|
In full mode:
|
|
105
105
|
|
|
@@ -107,7 +107,7 @@ In full mode:
|
|
|
107
107
|
- Activity and lifecycle messages (such as `Completed; session retained`) are omitted to save space; detailed status remains available in `/agents tree` and `agent_status`.
|
|
108
108
|
- Agents are ordered newest-started first (spawn or resume); a branch ranks by its most recently started agent. The most recently started agents are preferred when previews overflow. Overflow is counted, not listed.
|
|
109
109
|
- Time freezes while paused and resumes on continue.
|
|
110
|
-
- A small status strip below the previews shows the running count (including starting agents) and **Press ← to open subagent browser**, including when agents overflow. The full footer also shows **→ collapse**. Minimal mode keeps **← browser** inline so it stays one line. Browser hints appear only while subagents are starting or running; RPC output omits keyboard hints.
|
|
110
|
+
- A small status strip below the previews shows the running count (including starting agents) and **Press ← to open subagent browser**, including when agents overflow. The full footer also shows **→ collapse**. Minimal mode keeps **← browser** inline so it stays one line (**← expand** when it is a session collapse of full). Browser hints appear only while subagents are starting or running; RPC output omits keyboard hints.
|
|
111
111
|
- With **[labs] Nerd Font icons** enabled, the selected Circle, Braille, or Hourglass loader appears before the preserved role icon in the widget and fullscreen tree/live-view headers. Each family provides completed, paused, failed, and stopped state icons. The minimal summary uses the same indicators for its status counts. Preview all families and states under **[labs] Loader style**. Animation timers stop on settlement or disposal; RPC output stays static.
|
|
112
112
|
|
|
113
113
|
### Interrupts and stopping agents
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-subagent-manager",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Hierarchical, steerable subagent threads for pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"check": "tsc --noEmit",
|
|
40
40
|
"changelog": "tsx .github/scripts/changelog.ts",
|
|
41
41
|
"test": "tsx --test tests/*.test.ts",
|
|
42
|
+
"test:ttyd": "node .agents/skills/ttyd-testing/scripts/smoke-test.mjs && node .agents/skills/ttyd-testing/scripts/lifecycle-test.mjs",
|
|
42
43
|
"test:coverage": "mkdir -p coverage && tsx --test --experimental-test-coverage --test-coverage-include='src/**' --test-reporter=spec --test-reporter-destination=stdout --test-reporter=lcov --test-reporter-destination=coverage/lcov.info tests/*.test.ts",
|
|
43
44
|
"prepublishOnly": "npm run check && npm test",
|
|
44
45
|
"format": "prettier --write --print-width 100 src tests agents .github docs/default-agents.md README.md",
|
package/src/index.ts
CHANGED
|
@@ -94,7 +94,13 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
94
94
|
summaryTimer = undefined;
|
|
95
95
|
summaryRunning = false;
|
|
96
96
|
};
|
|
97
|
-
|
|
97
|
+
// Right at a tree leaf steps tree → full: leave any session collapse behind.
|
|
98
|
+
const returnToWidget = () => {
|
|
99
|
+
if (!widgetCollapsed) return;
|
|
100
|
+
widgetCollapsed = false;
|
|
101
|
+
if (context) refreshWidget(context);
|
|
102
|
+
};
|
|
103
|
+
let navigation = new AgentNavigationController(returnToWidget);
|
|
98
104
|
let navigationEditor: AgentNavigationEditor | undefined;
|
|
99
105
|
let navigationEditorFactory: Parameters<ExtensionContext["ui"]["setEditorComponent"]>[0];
|
|
100
106
|
let navigationGeneration = 0;
|
|
@@ -166,6 +172,19 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
166
172
|
widgetCollapsed = true;
|
|
167
173
|
if (context) refreshWidget(context);
|
|
168
174
|
},
|
|
175
|
+
// Left from the session-collapsed one-liner returns to full before the tree.
|
|
176
|
+
canExpand: () =>
|
|
177
|
+
manager !== undefined &&
|
|
178
|
+
context?.mode === "tui" &&
|
|
179
|
+
limits.subagentMode !== "off" &&
|
|
180
|
+
!navigation.isOpen &&
|
|
181
|
+
widgetCollapsed &&
|
|
182
|
+
limits.widgetMode === "full" &&
|
|
183
|
+
widgetThreads().some((thread) => thread.path !== "/root"),
|
|
184
|
+
expandWidget: () => {
|
|
185
|
+
widgetCollapsed = false;
|
|
186
|
+
if (context) refreshWidget(context);
|
|
187
|
+
},
|
|
169
188
|
onError: (error) =>
|
|
170
189
|
context?.ui.notify(error instanceof Error ? error.message : String(error), "error"),
|
|
171
190
|
});
|
|
@@ -493,6 +512,7 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
493
512
|
limits.nerdFontIcons,
|
|
494
513
|
rootTurnEnded,
|
|
495
514
|
limits.loaderStyle,
|
|
515
|
+
widgetCollapsed && limits.widgetMode === "full",
|
|
496
516
|
);
|
|
497
517
|
};
|
|
498
518
|
pi.on("agent_start", async (_event, ctx) => {
|
|
@@ -540,7 +560,7 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
540
560
|
cancelSummary();
|
|
541
561
|
const token = ++generation;
|
|
542
562
|
closeNavigation(installEditor);
|
|
543
|
-
navigation = new AgentNavigationController();
|
|
563
|
+
navigation = new AgentNavigationController(returnToWidget);
|
|
544
564
|
// session_start already belongs to the replacement session: never append the old registry here.
|
|
545
565
|
if (manager) await manager.shutdown();
|
|
546
566
|
inheritedTools.reset();
|
package/src/prefs/settings.ts
CHANGED
|
@@ -486,3 +486,29 @@ export function setManagerProjectSettings(options: ManagerSettingsOptions & {
|
|
|
486
486
|
}
|
|
487
487
|
return entry.filePath;
|
|
488
488
|
}
|
|
489
|
+
|
|
490
|
+
/** Resolved settings.json path for a scope; the file may not exist. */
|
|
491
|
+
export function managerSettingsPath(options: ManagerSettingsOptions, scope: ManagerSaveScope): string {
|
|
492
|
+
if (scope === "project") {
|
|
493
|
+
if (!options.includeProject) throw new Error("Project settings are not enabled/trusted");
|
|
494
|
+
return layer(options.cwd, [".pi", "agent", "subagent-manager"]).filePath;
|
|
495
|
+
}
|
|
496
|
+
return layer(options.agentDir, ["subagent-manager"]).filePath;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
/** Restore a scope's defaults by deleting its settings file (nothing is written). A missing file is not an error. */
|
|
500
|
+
export function deleteManagerSettings(options: ManagerSettingsOptions & { scope: ManagerSaveScope }): {
|
|
501
|
+
filePath: string;
|
|
502
|
+
deleted: boolean;
|
|
503
|
+
} {
|
|
504
|
+
if (options.scope !== "user" && options.scope !== "project")
|
|
505
|
+
throw new Error("Invalid settings scope");
|
|
506
|
+
const filePath = managerSettingsPath(options, options.scope);
|
|
507
|
+
const entry = options.scope === "project"
|
|
508
|
+
? layer(options.cwd, [".pi", "agent", "subagent-manager"])
|
|
509
|
+
: layer(options.agentDir, ["subagent-manager"]);
|
|
510
|
+
// Malformed JSON is removable; symlinks and non-files are refused by settingsFileExists.
|
|
511
|
+
if (!settingsFileExists(entry)) return { filePath, deleted: false };
|
|
512
|
+
unlinkSync(entry.filePath);
|
|
513
|
+
return { filePath, deleted: true };
|
|
514
|
+
}
|
|
@@ -16,9 +16,15 @@ export interface AgentNavigationEditorOptions {
|
|
|
16
16
|
/** Must return the whole navigation interaction, so repeated Left cannot reopen it. */
|
|
17
17
|
openTree(): void | Promise<void>;
|
|
18
18
|
canOpen(): boolean;
|
|
19
|
-
/** Session-local widget collapse; never saves the configured display mode. */
|
|
19
|
+
/** Session-local widget collapse (full → minimal); never saves the configured display mode. */
|
|
20
20
|
collapseWidget?(): void | Promise<void>;
|
|
21
21
|
canCollapse?(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Session-local widget expansion (minimal → full). While it is available, Left
|
|
24
|
+
* steps toward the full widget before the tree: tree ← full ← minimal.
|
|
25
|
+
*/
|
|
26
|
+
expandWidget?(): void | Promise<void>;
|
|
27
|
+
canExpand?(): boolean;
|
|
22
28
|
/** Root ownership token; changing it invalidates queued transitions. */
|
|
23
29
|
generation(): unknown;
|
|
24
30
|
onError?(error: unknown): void;
|
|
@@ -169,10 +175,17 @@ export class AgentNavigationEditor extends CustomEditor {
|
|
|
169
175
|
generation: unknown,
|
|
170
176
|
direction: "left" | "right",
|
|
171
177
|
): void {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
178
|
+
// Left walks one step toward the tree: minimal → full first, then full → tree.
|
|
179
|
+
// Right walks one step toward minimal. The decision is rechecked in the microtask.
|
|
180
|
+
const action = (): "expand" | "tree" | "collapse" | undefined => {
|
|
181
|
+
if (direction === "right")
|
|
182
|
+
return this.navigation.collapseWidget && (this.navigation.canCollapse?.() ?? false)
|
|
183
|
+
? "collapse" : undefined;
|
|
184
|
+
if (this.navigation.expandWidget && (this.navigation.canExpand?.() ?? false)) return "expand";
|
|
185
|
+
return this.navigation.canOpen() ? "tree" : undefined;
|
|
186
|
+
};
|
|
187
|
+
const chosen = action();
|
|
188
|
+
if (this.pending || !chosen) return;
|
|
176
189
|
this.pending = direction;
|
|
177
190
|
const epoch = this.inputEpoch;
|
|
178
191
|
queueMicrotask(() => {
|
|
@@ -182,7 +195,7 @@ export class AgentNavigationEditor extends CustomEditor {
|
|
|
182
195
|
!this.focused ||
|
|
183
196
|
this.inputEpoch !== epoch ||
|
|
184
197
|
this.navigation.generation() !== generation ||
|
|
185
|
-
|
|
198
|
+
action() !== chosen ||
|
|
186
199
|
this.isShowingAutocomplete() ||
|
|
187
200
|
this.getText() !== text ||
|
|
188
201
|
after.line !== cursor.line ||
|
|
@@ -194,8 +207,9 @@ export class AgentNavigationEditor extends CustomEditor {
|
|
|
194
207
|
try {
|
|
195
208
|
// Call within the checked microtask: an extra Promise.then would leave
|
|
196
209
|
// a gap in which root ownership could change after validation.
|
|
197
|
-
void Promise.resolve(
|
|
198
|
-
|
|
210
|
+
void Promise.resolve(chosen === "tree" ? this.navigation.openTree()
|
|
211
|
+
: chosen === "expand" ? this.navigation.expandWidget!()
|
|
212
|
+
: this.navigation.collapseWidget!())
|
|
199
213
|
.catch((error: unknown) => this.navigation.onError?.(error))
|
|
200
214
|
.finally(() => {
|
|
201
215
|
this.pending = undefined;
|
package/src/ui/settings-ui.ts
CHANGED
|
@@ -15,7 +15,9 @@ import {
|
|
|
15
15
|
type CostValue,
|
|
16
16
|
LOADER_STYLES,
|
|
17
17
|
type LoaderStyle,
|
|
18
|
+
deleteManagerSettings,
|
|
18
19
|
loadManagerSettingsLayers,
|
|
20
|
+
managerSettingsPath,
|
|
19
21
|
saveManagerOverrides,
|
|
20
22
|
setManagerProjectSettings,
|
|
21
23
|
type ManagerSettings,
|
|
@@ -364,7 +366,7 @@ async function configureAgentsDialog(
|
|
|
364
366
|
{
|
|
365
367
|
id: "defaults",
|
|
366
368
|
label: "Restore defaults",
|
|
367
|
-
help: "
|
|
369
|
+
help: "Pick Global or Project, then delete that scope's settings.json so its defaults apply again.\nThe file is removed, not rewritten; unsaved edits are discarded. This cannot be undone.",
|
|
368
370
|
},
|
|
369
371
|
{
|
|
370
372
|
id: "save",
|
|
@@ -489,7 +491,37 @@ async function configureAgentsDialog(
|
|
|
489
491
|
options.apply();
|
|
490
492
|
}
|
|
491
493
|
}
|
|
492
|
-
} else if (action === "defaults")
|
|
494
|
+
} else if (action === "defaults") {
|
|
495
|
+
const target = { cwd: ctx.cwd, agentDir: options.agentDir, includeProject: ctx.isProjectTrusted() };
|
|
496
|
+
const globalPath = managerSettingsPath(target, "user");
|
|
497
|
+
const projectPath = target.includeProject ? managerSettingsPath(target, "project") : undefined;
|
|
498
|
+
const explain = (path: string) =>
|
|
499
|
+
`Deletes this file now (nothing is written):\n${path}\nIf it does not exist, nothing happens. Unsaved edits are discarded. No undo.`;
|
|
500
|
+
const rows: DialogRow[] = [
|
|
501
|
+
{ id: "user", label: "Global", value: "Restore global defaults", help: explain(globalPath) },
|
|
502
|
+
...(projectPath
|
|
503
|
+
? [{ id: "project", label: "Project", value: "Restore project defaults", help: explain(projectPath) }]
|
|
504
|
+
: []),
|
|
505
|
+
{ id: "cancel", label: "Cancel", help: "Delete nothing." },
|
|
506
|
+
];
|
|
507
|
+
const choice = await dialogMenu(ctx, "Restore defaults: delete which settings file?", rows, {
|
|
508
|
+
selectedId: "cancel",
|
|
509
|
+
footer: "↑↓/Tab choose · Enter delete file · Esc cancel",
|
|
510
|
+
});
|
|
511
|
+
if (choice === "user" || choice === "project") {
|
|
512
|
+
const { filePath, deleted } = deleteManagerSettings({ ...target, scope: choice });
|
|
513
|
+
layers = readLayers();
|
|
514
|
+
reportDiagnostics();
|
|
515
|
+
baseline = { ...layers.settings };
|
|
516
|
+
draft = { ...baseline };
|
|
517
|
+
scope = layers.scope;
|
|
518
|
+
options.apply();
|
|
519
|
+
ctx.ui.notify(
|
|
520
|
+
deleted ? `Deleted ${filePath}. Defaults restored.` : `No settings file at ${filePath}; nothing to delete.`,
|
|
521
|
+
"info",
|
|
522
|
+
);
|
|
523
|
+
}
|
|
524
|
+
}
|
|
493
525
|
else if (action === "types") {
|
|
494
526
|
await editAgentTypes(ctx, options.store, draft.nerdFontIcons, {
|
|
495
527
|
getAllTools: options.getAllTools ?? (() => []),
|
package/src/ui/status-ui.ts
CHANGED
|
@@ -114,6 +114,8 @@ export class StatusDialog {
|
|
|
114
114
|
state: AgentTreeState;
|
|
115
115
|
actions(path: string): void;
|
|
116
116
|
fullscreen?: boolean;
|
|
117
|
+
/** Right on a leaf steps tree → widget; called just before the tree closes. */
|
|
118
|
+
returnToWidget?(): void;
|
|
117
119
|
},
|
|
118
120
|
private nerdFontIcons = false,
|
|
119
121
|
private loaderStyle: LoaderStyle = "circle",
|
|
@@ -242,6 +244,12 @@ export class StatusDialog {
|
|
|
242
244
|
else {
|
|
243
245
|
const child = row?.hasChildren ? firstChild(rows, index) : undefined;
|
|
244
246
|
if (child) this.selectedPath = child.path;
|
|
247
|
+
else if (this.navigation?.fullscreen) {
|
|
248
|
+
// Nothing left to fold or descend into: the next step right is the widget.
|
|
249
|
+
this.navigation.returnToWidget?.();
|
|
250
|
+
this.done(undefined);
|
|
251
|
+
return;
|
|
252
|
+
}
|
|
245
253
|
}
|
|
246
254
|
} else {
|
|
247
255
|
let next = index;
|
|
@@ -355,7 +363,7 @@ export class StatusDialog {
|
|
|
355
363
|
height,
|
|
356
364
|
this.heading(rows, start, treeCount),
|
|
357
365
|
body,
|
|
358
|
-
this.navigation ? "Esc main · ↑↓ select · ←→ fold · i Actions · Ctrl+C stop all" : FOOTER,
|
|
366
|
+
this.navigation ? "Esc main · ↑↓ select · ←→ fold · → widget · i Actions · Ctrl+C stop all" : FOOTER,
|
|
359
367
|
);
|
|
360
368
|
}
|
|
361
369
|
|
|
@@ -433,6 +441,8 @@ export class AgentNavigationController {
|
|
|
433
441
|
private opening: Promise<void> | undefined;
|
|
434
442
|
private generation = 0;
|
|
435
443
|
|
|
444
|
+
constructor(private returnToWidget?: () => void) {}
|
|
445
|
+
|
|
436
446
|
get isOpen(): boolean {
|
|
437
447
|
return this.opening !== undefined;
|
|
438
448
|
}
|
|
@@ -527,6 +537,7 @@ export class AgentNavigationController {
|
|
|
527
537
|
{
|
|
528
538
|
state: this.tree,
|
|
529
539
|
fullscreen: true,
|
|
540
|
+
returnToWidget: this.returnToWidget,
|
|
530
541
|
actions: (path) => finish({ kind: "actions", path }),
|
|
531
542
|
},
|
|
532
543
|
nerdFontIcons,
|
package/src/ui/ui.ts
CHANGED
|
@@ -226,6 +226,8 @@ interface AgentWidgetRenderOptions {
|
|
|
226
226
|
loaderStyle?: LoaderStyle;
|
|
227
227
|
/** RPC snapshots use a static running frame and never start an animation. */
|
|
228
228
|
animate?: boolean;
|
|
229
|
+
/** Minimal line is a session collapse of full: Left steps back to full, not the browser. */
|
|
230
|
+
expandHint?: boolean;
|
|
229
231
|
}
|
|
230
232
|
|
|
231
233
|
function agentWidgetStatus(
|
|
@@ -377,6 +379,7 @@ export function renderAgentSummary(
|
|
|
377
379
|
nerdFontIcons = false,
|
|
378
380
|
animate = true,
|
|
379
381
|
loaderStyle = "circle",
|
|
382
|
+
expandHint = false,
|
|
380
383
|
}: AgentWidgetRenderOptions = {},
|
|
381
384
|
): string[] {
|
|
382
385
|
const agents = new Map<string, ThreadView>();
|
|
@@ -420,7 +423,7 @@ export function renderAgentSummary(
|
|
|
420
423
|
return theme.fg(color, `${progress ? `${progress} ` : ""}${counts[state]} ${state}`);
|
|
421
424
|
})
|
|
422
425
|
.join(theme.fg("muted", ", ")) +
|
|
423
|
-
(showBrowserHint && counts.running > 0 ? theme.fg("muted", " · ← browser") : "");
|
|
426
|
+
(showBrowserHint && counts.running > 0 ? theme.fg("muted", expandHint ? " · ← expand" : " · ← browser") : "");
|
|
424
427
|
const right = theme.fg("muted", `↑${formatCount(input)} ↓${formatCount(output)}`);
|
|
425
428
|
return [fitLine(left, right, Math.max(0, width))];
|
|
426
429
|
}
|
|
@@ -432,6 +435,8 @@ export function updateWidget(
|
|
|
432
435
|
nerdFontIcons = false,
|
|
433
436
|
rootTurnEnded = false,
|
|
434
437
|
loaderStyle: LoaderStyle = "circle",
|
|
438
|
+
/** True while a configured-full widget is session-collapsed to the minimal line. */
|
|
439
|
+
sessionCollapsed = false,
|
|
435
440
|
): void {
|
|
436
441
|
if (!ctx.hasUI) return;
|
|
437
442
|
if (!threads.some((thread) => thread.path !== "/root")) {
|
|
@@ -470,6 +475,7 @@ export function updateWidget(
|
|
|
470
475
|
showBrowserHint: !settled,
|
|
471
476
|
nerdFontIcons,
|
|
472
477
|
loaderStyle,
|
|
478
|
+
expandHint: sessionCollapsed,
|
|
473
479
|
}),
|
|
474
480
|
invalidate: () => {},
|
|
475
481
|
dispose: () => {
|