pi-subagent-manager 0.11.0 → 0.11.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 +2 -2
- package/docs/tools-and-ui.md +6 -5
- package/package.json +1 -1
- package/src/ui/live-agent-view.ts +104 -32
package/README.md
CHANGED
|
@@ -68,11 +68,11 @@ They inherit your current model until you set preferences. Details: [docs/defaul
|
|
|
68
68
|
| ---------------- | ------------------------------------------------------ |
|
|
69
69
|
| `/agents` | Settings (mode, limits, model picking, tool filtering) |
|
|
70
70
|
| `/agents types` | Agent-type browser and editor |
|
|
71
|
-
| `/agents tree` | Fullscreen tree and
|
|
71
|
+
| `/agents tree` | Fullscreen tree and live viewer with manual steering (`/agents status` is an alias) |
|
|
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**
|
|
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. Press **Left** at the start of the main draft to open it; normal cursor movement is unchanged. See [live navigation](docs/tools-and-ui.md#live-agent-navigation) for controls and compatibility.
|
|
76
76
|
|
|
77
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).
|
|
78
78
|
|
package/docs/tools-and-ui.md
CHANGED
|
@@ -56,13 +56,14 @@ Then `agent_wait` or `agent_status` on `/root/controller-security-research`.
|
|
|
56
56
|
|
|
57
57
|
Refreshes every second and keeps your selection, collapse state and scroll position.
|
|
58
58
|
|
|
59
|
-
### Live agent navigation
|
|
59
|
+
### Live agent navigation
|
|
60
60
|
|
|
61
|
-
The fullscreen watcher shows steer and agent messages in full, including the in-progress assistant reply. Tool calls, results, and other metadata show their name/status and only the first three wrapped lines of each arguments/output preview, followed by `...` when more is hidden. Use **i → Transcript** from the tree for retained tool details. Thinking is initially hidden (**t** toggles it).
|
|
61
|
+
The fullscreen watcher shows steer and agent messages in full, including the in-progress assistant reply. Tool calls, results, and other metadata show their name/status and only the first three wrapped lines of each arguments/output preview, followed by `...` when more is hidden. Use **i → Transcript** from the tree for retained tool details. Thinking is initially hidden (**t** toggles it with transcript controls focused). 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. Unsupported/custom content and images use safe text placeholders rather than native rich rendering. Legacy sessions without reliable inherited-prefix metadata show their whole transcript.
|
|
62
62
|
|
|
63
|
-
- **
|
|
64
|
-
- **
|
|
65
|
-
- **
|
|
63
|
+
- 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.
|
|
64
|
+
- **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.
|
|
65
|
+
- **Up/Down, PageUp/PageDown** scroll and pause following in either mode. With transcript controls focused, **Home** scrolls to the start; **End** or **l** resumes following the live tail. Scroll/follow state is remembered per agent.
|
|
66
|
+
- **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.
|
|
66
67
|
- Frames are sanitized, viewport-bounded and coalesced during bursts. Exit, root replacement and shutdown release observers/timers. Streaming deltas never enter persisted thread events.
|
|
67
68
|
|
|
68
69
|
#### Left-arrow entry
|
package/package.json
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
2
2
|
import { getMarkdownTheme, type Theme } from "@earendil-works/pi-coding-agent";
|
|
3
3
|
import {
|
|
4
|
+
Input,
|
|
4
5
|
Key,
|
|
5
6
|
Markdown,
|
|
6
7
|
matchesKey,
|
|
@@ -51,7 +52,7 @@ function json(value: unknown): string {
|
|
|
51
52
|
}
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
/**
|
|
55
|
+
/** Live transcript and manual steering. Never invoke tools' custom renderers or pass through raw controls. */
|
|
55
56
|
export class LiveAgentView {
|
|
56
57
|
private snapshot: TranscriptSnapshot | undefined;
|
|
57
58
|
private error: string | undefined;
|
|
@@ -63,6 +64,14 @@ export class LiveAgentView {
|
|
|
63
64
|
private scroll: ScrollView;
|
|
64
65
|
private content: string[] = [];
|
|
65
66
|
private restoreViewport = true;
|
|
67
|
+
private input = new Input({ prompt: "Steer > " });
|
|
68
|
+
private editing = true;
|
|
69
|
+
private focusedState = true;
|
|
70
|
+
private pasting = false;
|
|
71
|
+
private pasteTail = "";
|
|
72
|
+
private sending = false;
|
|
73
|
+
private steerStatus: string | undefined;
|
|
74
|
+
private steerFailed = false;
|
|
66
75
|
|
|
67
76
|
constructor(
|
|
68
77
|
private host: DialogHost,
|
|
@@ -77,9 +86,57 @@ export class LiveAgentView {
|
|
|
77
86
|
{ render: () => this.content, invalidate() {} },
|
|
78
87
|
{ follow: "end", overscroll: "contain", scrollbar: "hidden" },
|
|
79
88
|
);
|
|
89
|
+
this.input.focused = true;
|
|
90
|
+
this.input.onSubmit = (value) => void this.steer(value);
|
|
80
91
|
void this.attach();
|
|
81
92
|
}
|
|
82
93
|
|
|
94
|
+
get focused(): boolean {
|
|
95
|
+
return this.focusedState;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
set focused(value: boolean) {
|
|
99
|
+
this.focusedState = value;
|
|
100
|
+
this.input.focused = value && this.editing;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
private async steer(value: string): Promise<void> {
|
|
104
|
+
const message = dialogText(value);
|
|
105
|
+
if (this.disposed || this.sending || !message.trim()) return;
|
|
106
|
+
this.sending = true;
|
|
107
|
+
this.steerFailed = false;
|
|
108
|
+
this.steerStatus = "Sending steering…";
|
|
109
|
+
this.host.requestRender();
|
|
110
|
+
try {
|
|
111
|
+
// Same root-scoped service as the Actions menu: queues a running turn or resumes a settled one.
|
|
112
|
+
await this.service.steer(this.path, message);
|
|
113
|
+
if (this.disposed) return;
|
|
114
|
+
if (this.input.getValue() === message) this.input.setValue("");
|
|
115
|
+
this.steerStatus = "Steering sent";
|
|
116
|
+
} catch (error) {
|
|
117
|
+
if (this.disposed) return;
|
|
118
|
+
this.steerFailed = true;
|
|
119
|
+
this.steerStatus = `Steering failed: ${error instanceof Error ? error.message : String(error)}`;
|
|
120
|
+
} finally {
|
|
121
|
+
this.sending = false;
|
|
122
|
+
if (!this.disposed) this.host.requestRender();
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
private editInput(data: string): void {
|
|
127
|
+
// Keep paste chunks (including embedded Esc, Tab and Enter) out of navigation shortcuts.
|
|
128
|
+
const pasteData = this.pasteTail + data;
|
|
129
|
+
if (pasteData.includes("\x1b[200~")) this.pasting = true;
|
|
130
|
+
if (pasteData.includes("\x1b[201~")) this.pasting = false;
|
|
131
|
+
this.pasteTail = this.pasting ? pasteData.slice(-5) : "";
|
|
132
|
+
const before = this.input.getValue();
|
|
133
|
+
this.input.handleInput(data);
|
|
134
|
+
const safe = dialogText(this.input.getValue());
|
|
135
|
+
if (safe !== this.input.getValue()) this.input.setValue(safe);
|
|
136
|
+
if (safe !== before && !this.sending) this.steerStatus = undefined;
|
|
137
|
+
this.host.requestRender();
|
|
138
|
+
}
|
|
139
|
+
|
|
83
140
|
private async attach(): Promise<void> {
|
|
84
141
|
const attachment = ++this.attachment;
|
|
85
142
|
this.unsubscribe?.();
|
|
@@ -132,6 +189,7 @@ export class LiveAgentView {
|
|
|
132
189
|
|
|
133
190
|
invalidate(): void {
|
|
134
191
|
this.cache = new WeakMap();
|
|
192
|
+
this.input.invalidate();
|
|
135
193
|
}
|
|
136
194
|
|
|
137
195
|
dispose(): void {
|
|
@@ -146,28 +204,42 @@ export class LiveAgentView {
|
|
|
146
204
|
|
|
147
205
|
handleInput(data: string): void {
|
|
148
206
|
if (this.disposed) return;
|
|
207
|
+
if (this.pasting || (this.editing && data.includes("\x1b[200~"))) {
|
|
208
|
+
this.editInput(data);
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
149
211
|
if (matchesKey(data, Key.escape)) return this.done("back");
|
|
150
212
|
if (matchesKey(data, Key.ctrl("q")) || matchesKey(data, Key.ctrl("c")))
|
|
151
213
|
return this.done("main");
|
|
152
|
-
if (data
|
|
214
|
+
if (matchesKey(data, Key.tab)) {
|
|
215
|
+
this.editing = !this.editing;
|
|
216
|
+
this.input.focused = this.focused && this.editing;
|
|
217
|
+
this.host.requestRender();
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (this.error && (matchesKey(data, Key.ctrl("r")) || (!this.editing && data === "r"))) {
|
|
153
221
|
void this.attach();
|
|
154
222
|
return;
|
|
155
223
|
}
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
this.invalidate();
|
|
159
|
-
} else if (data === "t") {
|
|
160
|
-
this.viewport.showThinking = !this.viewport.showThinking;
|
|
161
|
-
this.invalidate();
|
|
162
|
-
} else if (matchesKey(data, Key.up)) this.scroll.scrollBy(-1);
|
|
224
|
+
// Transcript scrolling remains available while composing; Home/End edit the input.
|
|
225
|
+
if (matchesKey(data, Key.up)) this.scroll.scrollBy(-1);
|
|
163
226
|
else if (matchesKey(data, Key.down)) this.scroll.scrollBy(1);
|
|
164
227
|
else if (matchesKey(data, Key.pageUp))
|
|
165
228
|
this.scroll.scrollBy(-Math.max(1, this.scroll.viewportHeight));
|
|
166
229
|
else if (matchesKey(data, Key.pageDown))
|
|
167
230
|
this.scroll.scrollBy(Math.max(1, this.scroll.viewportHeight));
|
|
168
|
-
else if (
|
|
231
|
+
else if (this.editing) {
|
|
232
|
+
this.editInput(data);
|
|
233
|
+
return;
|
|
234
|
+
} else if (data === "c") {
|
|
235
|
+
this.viewport.showInherited = !this.viewport.showInherited;
|
|
236
|
+
this.invalidate();
|
|
237
|
+
} else if (data === "t") {
|
|
238
|
+
this.viewport.showThinking = !this.viewport.showThinking;
|
|
239
|
+
this.invalidate();
|
|
240
|
+
} else if (matchesKey(data, Key.home)) this.scroll.scrollTo(0, { disableFollow: true });
|
|
169
241
|
else if (matchesKey(data, Key.end) || data === "l") this.scroll.scrollToEnd();
|
|
170
|
-
else return;
|
|
242
|
+
else return;
|
|
171
243
|
this.saveViewport();
|
|
172
244
|
this.host.requestRender();
|
|
173
245
|
}
|
|
@@ -287,7 +359,7 @@ export class LiveAgentView {
|
|
|
287
359
|
if (this.error)
|
|
288
360
|
body.push(
|
|
289
361
|
this.theme.fg("error", dialogText(`Attachment error: ${this.error}`)),
|
|
290
|
-
"
|
|
362
|
+
"Ctrl+R Retry · Esc Back · Ctrl+Q Back to main",
|
|
291
363
|
);
|
|
292
364
|
if (!snapshot) {
|
|
293
365
|
if (!this.error) body.push("Attaching to retained live session…");
|
|
@@ -335,7 +407,7 @@ export class LiveAgentView {
|
|
|
335
407
|
);
|
|
336
408
|
}
|
|
337
409
|
this.content = body;
|
|
338
|
-
const bodyHeight = Math.max(0, height -
|
|
410
|
+
const bodyHeight = Math.max(0, height - 4);
|
|
339
411
|
this.scroll.updateLayout(body.length, bodyHeight, () => this.scheduleRender());
|
|
340
412
|
if (this.restoreViewport) {
|
|
341
413
|
if (this.viewport.follow) this.scroll.scrollToEnd();
|
|
@@ -348,28 +420,28 @@ export class LiveAgentView {
|
|
|
348
420
|
while (visible.length < bodyHeight) visible.push("");
|
|
349
421
|
this.saveViewport();
|
|
350
422
|
const footer = this.error
|
|
351
|
-
? "
|
|
352
|
-
:
|
|
423
|
+
? "Ctrl+R Retry · Tab input/transcript · Esc tree · Ctrl+Q main"
|
|
424
|
+
: `${this.editing ? "Enter steer · Tab browse" : "Tab steer · Home/End scroll · c context · t thinking"} · Esc tree · Ctrl+Q main · ↑↓/PgUp/PgDn scroll · ${this.viewport.follow ? "following" : "scrolled"}`;
|
|
425
|
+
const input = this.input.render(columns)[0]!;
|
|
426
|
+
const status = this.theme.fg(
|
|
427
|
+
this.steerStatus ? (this.steerFailed ? "error" : "muted") : this.error ? "error" : "muted",
|
|
428
|
+
dialogText(
|
|
429
|
+
this.steerStatus ??
|
|
430
|
+
(this.error
|
|
431
|
+
? `Attachment error: ${this.error}`
|
|
432
|
+
: thread
|
|
433
|
+
? `${thread.task} · ${thread.status}`
|
|
434
|
+
: "Live transcript · Enter to steer"),
|
|
435
|
+
),
|
|
436
|
+
);
|
|
353
437
|
const lines =
|
|
354
438
|
height === 1
|
|
355
|
-
? [
|
|
439
|
+
? [input]
|
|
356
440
|
: height === 2
|
|
357
|
-
? [header,
|
|
358
|
-
:
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
this.error ? "error" : "muted",
|
|
362
|
-
dialogText(
|
|
363
|
-
this.error
|
|
364
|
-
? `Attachment error: ${this.error}`
|
|
365
|
-
: thread
|
|
366
|
-
? `${thread.task} · ${thread.status}`
|
|
367
|
-
: "Read-only observer",
|
|
368
|
-
),
|
|
369
|
-
),
|
|
370
|
-
...visible,
|
|
371
|
-
this.theme.fg("dim", footer),
|
|
372
|
-
];
|
|
441
|
+
? [header, input]
|
|
442
|
+
: height === 3
|
|
443
|
+
? [header, this.theme.fg("dim", footer), input]
|
|
444
|
+
: [header, status, ...visible, this.theme.fg("dim", footer), input];
|
|
373
445
|
return fillViewport(lines, width, height);
|
|
374
446
|
}
|
|
375
447
|
}
|