pi-subagent-manager 0.12.0 → 0.13.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 +2 -2
- package/docs/custom-agents.md +35 -0
- package/docs/settings.md +3 -3
- package/docs/tools-and-ui.md +9 -6
- package/package.json +1 -1
- package/src/index.ts +11 -1
- package/src/prefs/config.ts +572 -43
- package/src/types.ts +16 -0
- package/src/ui/agent-navigation-editor.ts +40 -26
- package/src/ui/live-agent-view.ts +19 -2
- package/src/ui/status-ui.ts +30 -6
- package/src/ui/ui.ts +223 -56
package/README.md
CHANGED
|
@@ -72,9 +72,9 @@ They inherit your current model until you set preferences. Details: [docs/defaul
|
|
|
72
72
|
| `/agents import` | Import agents from other subagent extensions |
|
|
73
73
|
| `/agents reload` | Reload definitions and settings |
|
|
74
74
|
|
|
75
|
-
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; `/agents tree` still opens the full tree. While subagents are starting or running, press **Left** at the start of the main draft to open it; otherwise Left stays native. `/agents tree` remains available regardless of agent activity. See [live navigation](docs/tools-and-ui.md#live-agent-navigation) for controls and compatibility.
|
|
75
|
+
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; `/agents tree` still opens the full tree. While subagents are starting or running, press **Left** at the start of the main draft to open it; otherwise Left stays native. 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. `/agents tree` remains available regardless of agent activity. See [live navigation](docs/tools-and-ui.md#live-agent-navigation) for controls and compatibility.
|
|
76
76
|
|
|
77
|
-
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). 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).
|
|
77
|
+
Experimental features are marked **[labs]** in settings. Enable **[labs] Nerd Font icons** in `/agents` to show role-specific icons beside agent names, with animated progress glyphs for starting/running agents and static icons for settled agents (off by default; requires a Nerd Font in your terminal). 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).
|
|
78
78
|
|
|
79
79
|
Enable **[labs] Final Recap** in `/agents` to automatically ask the idle main agent to summarize detached-agent results, keeping the final response in the main thread. It is off by default and suppressed by Subagent Mode Off. **Enabling it may cause extra model turns and uses more tokens and context.** See [Final Recap](docs/settings.md#labs-final-recap-finalrecap).
|
|
80
80
|
|
package/docs/custom-agents.md
CHANGED
|
@@ -11,6 +11,41 @@ An agent type is one Markdown file: YAML frontmatter on top, system prompt below
|
|
|
11
11
|
|
|
12
12
|
Precedence: **project > user > bundled**. A file with the same `name` as a bundled agent replaces it.
|
|
13
13
|
|
|
14
|
+
## Tweak settings or fork the agent?
|
|
15
|
+
|
|
16
|
+
Two ways to customize a bundled agent. Pick one per agent — a scope (user or
|
|
17
|
+
project) cannot hold both a `.md` and a `.yml` for the same name.
|
|
18
|
+
|
|
19
|
+
| | Tweak settings (`<name>.yml`) | Fork agent (`<name>.md`) |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| What it is | Settings-only override merged on top of the bundled definition | Full copy that replaces the bundled definition |
|
|
22
|
+
| System prompt | Stays bundled; you keep receiving prompt updates | Copied; you own it, bundled prompt updates no longer apply |
|
|
23
|
+
| Editable | Settings (models, tools, thinking, color, icon, description) | Everything, including name and system prompt |
|
|
24
|
+
| File | Plain YAML mapping, no frontmatter, no Markdown body | YAML frontmatter on top, system prompt below |
|
|
25
|
+
|
|
26
|
+
`~/.pi/agent/subagent-manager/agents/coder.yml`:
|
|
27
|
+
|
|
28
|
+
```yaml
|
|
29
|
+
name: coder
|
|
30
|
+
thinkingLevel: low
|
|
31
|
+
tools:
|
|
32
|
+
allow:
|
|
33
|
+
- read
|
|
34
|
+
- grep
|
|
35
|
+
- agent_update
|
|
36
|
+
- agent_pause
|
|
37
|
+
```
|
|
38
|
+
|
|
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.
|
|
44
|
+
|
|
45
|
+
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.
|
|
48
|
+
|
|
14
49
|
These are the only locations read. Other packages' `~/.pi/agent/agents` or `.pi/agents` are ignored — use [`/agents import`](importing-agents.md) for those.
|
|
15
50
|
|
|
16
51
|
## 2. Write the file
|
package/docs/settings.md
CHANGED
|
@@ -50,16 +50,16 @@ Controls the subagent status display above the input box. Choose **Status Widget
|
|
|
50
50
|
|
|
51
51
|
| Option | Display |
|
|
52
52
|
| ------------------ | ------- |
|
|
53
|
-
| `full` (default) |
|
|
53
|
+
| `full` (default) | A compact tree with one row per agent, task/state, metrics and navigation hints. |
|
|
54
54
|
| `minimal` | One line of theme-colored status counts plus cumulative input `↑` / output `↓` tokens for agents currently starting or running. |
|
|
55
55
|
|
|
56
|
-
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.
|
|
56
|
+
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. In full mode, press **Right (→)** at the end of the main draft (or in an empty input) to collapse to one line for this session only, without saving preferences. Session startup/switch/reload restores the configured mode. **Left (←)** at the start of the draft still opens the full dialog while agents are active.
|
|
57
57
|
|
|
58
58
|
## [labs] Nerd Font icons (`nerdFontIcons`)
|
|
59
59
|
|
|
60
60
|
Experimental features are tagged **[labs]** in settings. **[labs] Nerd Font icons** is an on/off toggle, **off by default**. Enable it in `/agents` and save with **Ctrl+S**, or set `"nerdFontIcons": true` in your settings file. Configure a [Nerd Font](https://www.nerdfonts.com/) in your terminal first; unsupported fonts may show boxes or incorrect glyphs. The extension does not install or detect fonts.
|
|
61
61
|
|
|
62
|
-
When enabled, an agent type’s optional `icon` appears before its readable name in the full widget, thread browsers, live watcher header, and type picker.
|
|
62
|
+
When enabled, an agent type’s optional `icon` appears before its readable name in the full widget, thread browsers, live watcher header, and type picker. Starting/running agents use a cycling Nerd Font progress glyph in the widget, fullscreen tree and live watcher header; paused/completed/stopped/failed agents retain static role icons. Active agents without a configured icon also show the progress glyph. The one-line minimal widget animates its aggregate running count, not individual agents. Turning the setting off restores text-only labels without removing configured icons; RPC output remains static. Saved settings apply immediately to newly rendered widgets and dialogs.
|
|
63
63
|
|
|
64
64
|
All six bundled agents have [role-specific icons](default-agents.md#nerd-font-icons). Add or change an icon with **[labs] Icon** in `/agents types`, or the optional `icon` frontmatter field in [your own agent](custom-agents.md#icons-labs). Retained threads keep the icon from their saved agent definition.
|
|
65
65
|
|
package/docs/tools-and-ui.md
CHANGED
|
@@ -68,11 +68,13 @@ The fullscreen watcher renders steer and agent messages (including thinking) as
|
|
|
68
68
|
- **Ctrl+R** (or **r** with transcript controls focused) retries an unavailable observation without starting a turn. Starting threads are watchable; stopped/completed threads remain readable.
|
|
69
69
|
- Frames are sanitized, viewport-bounded and coalesced during bursts. Exit, root replacement and shutdown release observers/timers. Streaming deltas never enter persisted thread events.
|
|
70
70
|
|
|
71
|
-
####
|
|
71
|
+
#### Arrow-key shortcuts
|
|
72
72
|
|
|
73
73
|
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.
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
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 still opens the full dialog while subagents are active, without expanding the widget. Elsewhere in the draft Right retains normal cursor movement; autocomplete, jumps, paste and shortcuts take precedence.
|
|
76
|
+
|
|
77
|
+
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.
|
|
76
78
|
|
|
77
79
|
While navigation is open, the host fullscreen search shortcut is temporarily disabled through public keybindings to avoid stacking a second host overlay. The prior binding owner is restored only if no other extension replaced it. **Known host limitation:** if an unrelated extension stacks another overlay above navigation, Pi's custom-UI completion can close the newer overlay instead. Avoid concurrent extension-owned overlays; a host identity-targeted completion API is needed to remove this limitation. No private host access or unsupported overlay-lifecycle workaround is used.
|
|
78
80
|
|
|
@@ -85,15 +87,16 @@ The widget above the input editor has two display modes, selected with **Status
|
|
|
85
87
|
- **Full** (default): the existing compact tree, at most twelve lines.
|
|
86
88
|
- **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.
|
|
87
89
|
|
|
88
|
-
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 new main turn or active subagent restores the configured display mode.
|
|
90
|
+
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 new main turn or active subagent restores the configured display mode unless Right has collapsed the widget for this session.
|
|
89
91
|
|
|
90
92
|
In full mode:
|
|
91
93
|
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
+
- One row per agent: colored type pill, path, state, task, active time, input `↑` / output `↓` tokens.
|
|
95
|
+
- Activity and lifecycle messages (such as `Completed; session retained`) are omitted to save space; detailed status remains available in `/agents tree` and `agent_status`.
|
|
94
96
|
- Active branches are shown first; the most recent agents within each state are preferred when previews overflow. Overflow is counted, not listed.
|
|
95
97
|
- Time freezes while paused and resumes on continue.
|
|
96
|
-
- A small status strip below the previews shows the running count (including starting agents) and **Press ← to open subagent browser**, including when agents overflow.
|
|
98
|
+
- 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.
|
|
99
|
+
- With **[labs] Nerd Font icons** enabled, starting/running agents show a cycling progress glyph in the widget and fullscreen tree/live-view headers. Settled agents retain static role icons. The minimal summary also animates its running count. Animation timers stop on settlement or disposal; RPC output stays static.
|
|
97
100
|
|
|
98
101
|
### Interrupts and stopping agents
|
|
99
102
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -51,6 +51,7 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
51
51
|
};
|
|
52
52
|
let generation = 0;
|
|
53
53
|
let rootTurnEnded = false;
|
|
54
|
+
let widgetCollapsed = false;
|
|
54
55
|
let summaryRunning = false;
|
|
55
56
|
let suspendingSummaries = false;
|
|
56
57
|
let summaryTimer: ReturnType<typeof setTimeout> | undefined;
|
|
@@ -95,6 +96,13 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
95
96
|
(thread.state === "starting" || thread.state === "running")),
|
|
96
97
|
openTree: () => manager && context
|
|
97
98
|
? navigation.open(context, manager.scope("/root"), undefined, limits.nerdFontIcons) : undefined,
|
|
99
|
+
canCollapse: () => manager !== undefined && context?.mode === "tui" &&
|
|
100
|
+
limits.subagentMode !== "off" && !navigation.isOpen && !widgetCollapsed &&
|
|
101
|
+
limits.widgetMode === "full" && manager.list().some((thread) => thread.path !== "/root"),
|
|
102
|
+
collapseWidget: () => {
|
|
103
|
+
widgetCollapsed = true;
|
|
104
|
+
if (context) refreshWidget(context);
|
|
105
|
+
},
|
|
98
106
|
onError: (error) => context?.ui.notify(
|
|
99
107
|
error instanceof Error ? error.message : String(error), "error"),
|
|
100
108
|
});
|
|
@@ -304,7 +312,8 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
304
312
|
const refreshWidget = (ctx: ExtensionContext) => {
|
|
305
313
|
if (limits.subagentMode === "off") {
|
|
306
314
|
if (ctx.hasUI) ctx.ui.setWidget("pi-subagent", undefined);
|
|
307
|
-
} else updateWidget(ctx, requireManager().list(), limits.widgetMode,
|
|
315
|
+
} else updateWidget(ctx, requireManager().list(), widgetCollapsed ? "minimal" : limits.widgetMode,
|
|
316
|
+
limits.nerdFontIcons, rootTurnEnded);
|
|
308
317
|
};
|
|
309
318
|
pi.on("agent_start", async (_event, ctx) => {
|
|
310
319
|
rootTurnEnded = false;
|
|
@@ -344,6 +353,7 @@ export default function piSubagent(pi: ExtensionAPI): void {
|
|
|
344
353
|
inheritedTools.reset();
|
|
345
354
|
context = ctx;
|
|
346
355
|
rootTurnEnded = false;
|
|
356
|
+
if (installEditor) widgetCollapsed = false;
|
|
347
357
|
store = new ConfigStore({
|
|
348
358
|
cwd: ctx.cwd,
|
|
349
359
|
agentDir: getAgentDir(),
|