pi-subagent-manager 0.8.0 → 0.10.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/settings.md +12 -0
- package/docs/tools-and-ui.md +42 -5
- package/package.json +1 -1
- package/src/index.ts +54 -6
- package/src/orch/manager.ts +96 -0
- package/src/orch/runtime.ts +27 -0
- package/src/orch/transcript.ts +186 -0
- package/src/prefs/settings.ts +12 -1
- package/src/types.ts +30 -0
- package/src/ui/agent-navigation-editor.ts +195 -0
- package/src/ui/dialog.ts +14 -13
- package/src/ui/live-agent-view.ts +373 -0
- package/src/ui/settings-ui.ts +31 -0
- package/src/ui/status-ui.ts +273 -46
- package/src/ui/ui.ts +90 -22
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import type { AgentMessage } from "@earendil-works/pi-agent-core";
|
|
2
|
+
import { getMarkdownTheme, type Theme } from "@earendil-works/pi-coding-agent";
|
|
3
|
+
import {
|
|
4
|
+
Key,
|
|
5
|
+
Markdown,
|
|
6
|
+
matchesKey,
|
|
7
|
+
ScrollView,
|
|
8
|
+
stripTerminalSequences,
|
|
9
|
+
truncateToWidth,
|
|
10
|
+
visibleWidth,
|
|
11
|
+
wrapTextWithAnsi,
|
|
12
|
+
} from "@earendil-works/pi-tui";
|
|
13
|
+
import type { ThreadService, TranscriptSnapshot } from "../types.ts";
|
|
14
|
+
import { dialogText, type DialogHost } from "./dialog.ts";
|
|
15
|
+
|
|
16
|
+
export interface AgentViewportState {
|
|
17
|
+
scrollTop: number;
|
|
18
|
+
follow: boolean;
|
|
19
|
+
showInherited?: boolean;
|
|
20
|
+
showThinking?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/** Fully cover main, including at very small sizes; only trusted renderers emit terminal sequences. */
|
|
24
|
+
export function fillViewport(lines: string[], width: number, height: number): string[] {
|
|
25
|
+
width = Math.max(0, Math.floor(width));
|
|
26
|
+
height = Math.max(1, Math.floor(height));
|
|
27
|
+
const result = lines.slice(0, height).map((line) => {
|
|
28
|
+
const clipped = truncateToWidth(line, width, "", true);
|
|
29
|
+
return clipped + " ".repeat(Math.max(0, width - visibleWidth(clipped)));
|
|
30
|
+
});
|
|
31
|
+
while (result.length < height) result.push(" ".repeat(width));
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function text(value: string): string {
|
|
36
|
+
return stripTerminalSequences(value)
|
|
37
|
+
.replace(/\r\n?/g, "\n")
|
|
38
|
+
.replace(/[\x00-\x08\x0b-\x1f\x7f-\x9f]/g, "");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function object(value: unknown): Record<string, unknown> | undefined {
|
|
42
|
+
return value && typeof value === "object" ? (value as Record<string, unknown>) : undefined;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
function json(value: unknown): string {
|
|
46
|
+
try {
|
|
47
|
+
return JSON.stringify(value, null, 2) ?? "";
|
|
48
|
+
} catch {
|
|
49
|
+
return "[unrenderable data]";
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** Read-only observer. Never invoke watched tools' custom renderers or pass through raw controls. */
|
|
54
|
+
export class LiveAgentView {
|
|
55
|
+
private snapshot: TranscriptSnapshot | undefined;
|
|
56
|
+
private error: string | undefined;
|
|
57
|
+
private disposed = false;
|
|
58
|
+
private attachment = 0;
|
|
59
|
+
private unsubscribe: (() => void) | undefined;
|
|
60
|
+
private renderTimer: ReturnType<typeof setTimeout> | undefined;
|
|
61
|
+
private cache = new WeakMap<object, { width: number; thinking: boolean; lines: string[] }>();
|
|
62
|
+
private scroll: ScrollView;
|
|
63
|
+
private content: string[] = [];
|
|
64
|
+
private restoreViewport = true;
|
|
65
|
+
|
|
66
|
+
constructor(
|
|
67
|
+
private host: DialogHost,
|
|
68
|
+
private theme: Theme,
|
|
69
|
+
private service: ThreadService,
|
|
70
|
+
readonly path: string,
|
|
71
|
+
private viewport: AgentViewportState,
|
|
72
|
+
private done: (result: "back" | "main") => void,
|
|
73
|
+
) {
|
|
74
|
+
this.scroll = new ScrollView(
|
|
75
|
+
{ render: () => this.content, invalidate() {} },
|
|
76
|
+
{ follow: "end", overscroll: "contain", scrollbar: "hidden" },
|
|
77
|
+
);
|
|
78
|
+
void this.attach();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
private async attach(): Promise<void> {
|
|
82
|
+
const attachment = ++this.attachment;
|
|
83
|
+
this.unsubscribe?.();
|
|
84
|
+
this.unsubscribe = undefined;
|
|
85
|
+
this.error = undefined;
|
|
86
|
+
this.scheduleRender();
|
|
87
|
+
try {
|
|
88
|
+
if (!this.service.observeTranscript)
|
|
89
|
+
throw new Error("Live observation is unavailable for this service.");
|
|
90
|
+
let latest: TranscriptSnapshot | undefined;
|
|
91
|
+
const observation = await this.service.observeTranscript(this.path, (snapshot) => {
|
|
92
|
+
latest = snapshot;
|
|
93
|
+
if (this.disposed || attachment !== this.attachment) return;
|
|
94
|
+
this.accept(snapshot);
|
|
95
|
+
});
|
|
96
|
+
if (this.disposed || attachment !== this.attachment) {
|
|
97
|
+
observation.unsubscribe();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.unsubscribe = observation.unsubscribe;
|
|
101
|
+
this.accept(latest ?? observation.snapshot);
|
|
102
|
+
} catch (error) {
|
|
103
|
+
if (this.disposed || attachment !== this.attachment) return;
|
|
104
|
+
this.error = error instanceof Error ? error.message : String(error);
|
|
105
|
+
this.scheduleRender();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
private accept(snapshot: TranscriptSnapshot): void {
|
|
110
|
+
if (
|
|
111
|
+
this.snapshot &&
|
|
112
|
+
(snapshot.generation < this.snapshot.generation ||
|
|
113
|
+
(snapshot.generation === this.snapshot.generation &&
|
|
114
|
+
snapshot.revision < this.snapshot.revision))
|
|
115
|
+
)
|
|
116
|
+
return;
|
|
117
|
+
this.snapshot = snapshot;
|
|
118
|
+
this.error = snapshot.error;
|
|
119
|
+
this.scheduleRender();
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
private scheduleRender(): void {
|
|
123
|
+
if (this.disposed || this.renderTimer) return;
|
|
124
|
+
this.renderTimer = setTimeout(() => {
|
|
125
|
+
this.renderTimer = undefined;
|
|
126
|
+
if (!this.disposed) this.host.requestRender();
|
|
127
|
+
}, 16);
|
|
128
|
+
this.renderTimer.unref?.();
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
invalidate(): void {
|
|
132
|
+
this.cache = new WeakMap();
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
dispose(): void {
|
|
136
|
+
if (this.disposed) return;
|
|
137
|
+
this.disposed = true;
|
|
138
|
+
++this.attachment;
|
|
139
|
+
this.unsubscribe?.();
|
|
140
|
+
this.unsubscribe = undefined;
|
|
141
|
+
if (this.renderTimer) clearTimeout(this.renderTimer);
|
|
142
|
+
this.renderTimer = undefined;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
handleInput(data: string): void {
|
|
146
|
+
if (this.disposed) return;
|
|
147
|
+
if (matchesKey(data, Key.escape)) return this.done("back");
|
|
148
|
+
if (matchesKey(data, Key.ctrl("q")) || matchesKey(data, Key.ctrl("c")))
|
|
149
|
+
return this.done("main");
|
|
150
|
+
if (data === "r" && this.error) {
|
|
151
|
+
void this.attach();
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
if (data === "c") {
|
|
155
|
+
this.viewport.showInherited = !this.viewport.showInherited;
|
|
156
|
+
this.invalidate();
|
|
157
|
+
} else if (data === "t") {
|
|
158
|
+
this.viewport.showThinking = !this.viewport.showThinking;
|
|
159
|
+
this.invalidate();
|
|
160
|
+
} else if (matchesKey(data, Key.up)) this.scroll.scrollBy(-1);
|
|
161
|
+
else if (matchesKey(data, Key.down)) this.scroll.scrollBy(1);
|
|
162
|
+
else if (matchesKey(data, Key.pageUp))
|
|
163
|
+
this.scroll.scrollBy(-Math.max(1, this.scroll.viewportHeight));
|
|
164
|
+
else if (matchesKey(data, Key.pageDown))
|
|
165
|
+
this.scroll.scrollBy(Math.max(1, this.scroll.viewportHeight));
|
|
166
|
+
else if (matchesKey(data, Key.home)) this.scroll.scrollTo(0, { disableFollow: true });
|
|
167
|
+
else if (matchesKey(data, Key.end) || data === "l") this.scroll.scrollToEnd();
|
|
168
|
+
else return; // Read-only: text/Enter never routes into either agent's editor.
|
|
169
|
+
this.saveViewport();
|
|
170
|
+
this.host.requestRender();
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
private saveViewport(): void {
|
|
174
|
+
this.viewport.scrollTop = this.scroll.scrollTop;
|
|
175
|
+
this.viewport.follow = this.scroll.isFollowingEnd;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
private wrap(value: string, width: number): string[] {
|
|
179
|
+
return text(value)
|
|
180
|
+
.split("\n")
|
|
181
|
+
.flatMap((line) => wrapTextWithAnsi(line, Math.max(1, width)));
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/** Use the same themed Markdown (including code highlighting) as pi's main transcript. */
|
|
185
|
+
private markdown(value: string, width: number, thinking = false): string[] {
|
|
186
|
+
return new Markdown(
|
|
187
|
+
text(value),
|
|
188
|
+
0,
|
|
189
|
+
0,
|
|
190
|
+
getMarkdownTheme(),
|
|
191
|
+
thinking
|
|
192
|
+
? { color: (value) => this.theme.fg("thinkingText", value), italic: true }
|
|
193
|
+
: undefined,
|
|
194
|
+
).render(Math.max(1, width));
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Tool/metadata previews are bounded by rendered rows, not just source newlines. */
|
|
198
|
+
private preview(content: unknown, width: number): string[] {
|
|
199
|
+
const values = Array.isArray(content) ? content : [content];
|
|
200
|
+
const lines: string[] = [];
|
|
201
|
+
for (const value of values) {
|
|
202
|
+
const block = object(value);
|
|
203
|
+
const valueText =
|
|
204
|
+
typeof value === "string"
|
|
205
|
+
? value
|
|
206
|
+
: block?.type === "text"
|
|
207
|
+
? String(block.text ?? "")
|
|
208
|
+
: block?.type === "image"
|
|
209
|
+
? "[Image — text-only observer]"
|
|
210
|
+
: json(value);
|
|
211
|
+
// Avoid wrapping megabytes of tool output just to display its first three rows.
|
|
212
|
+
const safe = text(valueText);
|
|
213
|
+
const bounded = safe.slice(0, 32768);
|
|
214
|
+
for (const line of bounded.split("\n")) {
|
|
215
|
+
lines.push(...wrapTextWithAnsi(line, Math.max(1, width)));
|
|
216
|
+
if (lines.length > 3) return [...lines.slice(0, 3), this.theme.fg("dim", "...")];
|
|
217
|
+
}
|
|
218
|
+
if (safe.length > bounded.length) return [...lines.slice(0, 3), this.theme.fg("dim", "...")];
|
|
219
|
+
}
|
|
220
|
+
return lines;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private blocks(content: unknown, width: number): string[] {
|
|
224
|
+
if (typeof content === "string") return this.markdown(content, width);
|
|
225
|
+
if (!Array.isArray(content)) return this.wrap(json(content), width);
|
|
226
|
+
return content.flatMap((value) => {
|
|
227
|
+
const block = object(value);
|
|
228
|
+
if (!block) return this.wrap(json(value), width);
|
|
229
|
+
if (block.type === "text") return this.markdown(String(block.text ?? ""), width);
|
|
230
|
+
if (block.type === "image") return ["[Image — text-only observer]"];
|
|
231
|
+
if (block.type === "thinking")
|
|
232
|
+
return this.viewport.showThinking
|
|
233
|
+
? this.markdown(String(block.thinking ?? "[redacted thinking]"), width, true)
|
|
234
|
+
: [this.theme.fg("dim", "[Thinking hidden · t show]")];
|
|
235
|
+
if (block.type === "toolCall")
|
|
236
|
+
return [
|
|
237
|
+
this.theme.fg(
|
|
238
|
+
"accent",
|
|
239
|
+
dialogText(`Tool call: ${String(block.name)} (${String(block.id)})`),
|
|
240
|
+
),
|
|
241
|
+
...this.preview(json(block.arguments), width),
|
|
242
|
+
];
|
|
243
|
+
return this.preview(json(block), width);
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
private message(message: AgentMessage, width: number): string[] {
|
|
248
|
+
const cached = this.cache.get(message);
|
|
249
|
+
if (cached && cached.width === width && cached.thinking === !!this.viewport.showThinking)
|
|
250
|
+
return cached.lines;
|
|
251
|
+
const data = message as unknown as Record<string, unknown>;
|
|
252
|
+
const label =
|
|
253
|
+
message.role === "toolResult"
|
|
254
|
+
? `Tool result: ${String(data.toolName)}${data.isError ? " — error" : ""}`
|
|
255
|
+
: message.role;
|
|
256
|
+
const collapsed = !["user", "assistant", "custom"].includes(message.role);
|
|
257
|
+
const content = data.content ?? data.summary ?? data.output ?? data;
|
|
258
|
+
const lines = [
|
|
259
|
+
this.theme.fg(data.isError ? "error" : "accent", dialogText(label)),
|
|
260
|
+
...(collapsed ? this.preview(content, width) : this.blocks(content, width)),
|
|
261
|
+
...(data.errorMessage
|
|
262
|
+
? (collapsed
|
|
263
|
+
? this.preview(String(data.errorMessage), width)
|
|
264
|
+
: this.wrap(String(data.errorMessage), width)
|
|
265
|
+
).map((line) => this.theme.fg("error", line))
|
|
266
|
+
: []),
|
|
267
|
+
"",
|
|
268
|
+
];
|
|
269
|
+
this.cache.set(message, { width, thinking: !!this.viewport.showThinking, lines });
|
|
270
|
+
return lines;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
render(width: number): string[] {
|
|
274
|
+
const height = Math.max(1, this.host.terminal?.rows ?? 24);
|
|
275
|
+
const columns = Math.max(1, width);
|
|
276
|
+
const snapshot = this.snapshot;
|
|
277
|
+
const thread = snapshot?.thread;
|
|
278
|
+
const header = this.theme.fg(
|
|
279
|
+
"accent",
|
|
280
|
+
dialogText(
|
|
281
|
+
`${this.path} · ${thread?.type ?? "agent"} · ${thread?.state ?? "attaching"} — Watching — main continues`,
|
|
282
|
+
),
|
|
283
|
+
);
|
|
284
|
+
const body: string[] = [];
|
|
285
|
+
if (this.error)
|
|
286
|
+
body.push(
|
|
287
|
+
this.theme.fg("error", dialogText(`Attachment error: ${this.error}`)),
|
|
288
|
+
"r Retry · Esc Back · Ctrl+Q Back to main",
|
|
289
|
+
);
|
|
290
|
+
if (!snapshot) {
|
|
291
|
+
if (!this.error) body.push("Attaching to retained live session…");
|
|
292
|
+
} else {
|
|
293
|
+
if (snapshot.inheritedCount)
|
|
294
|
+
body.push(
|
|
295
|
+
this.theme.fg(
|
|
296
|
+
"dim",
|
|
297
|
+
`${snapshot.inheritedCount} inherited messages ${this.viewport.showInherited ? "shown" : "collapsed"} · c toggle`,
|
|
298
|
+
),
|
|
299
|
+
);
|
|
300
|
+
const start = this.viewport.showInherited ? 0 : snapshot.inheritedCount;
|
|
301
|
+
for (const message of snapshot.messages.slice(start))
|
|
302
|
+
body.push(...this.message(message, columns));
|
|
303
|
+
if (snapshot.assistant)
|
|
304
|
+
body.push(
|
|
305
|
+
this.theme.fg("warning", "Assistant streaming…"),
|
|
306
|
+
...this.message(snapshot.assistant, columns),
|
|
307
|
+
);
|
|
308
|
+
const committedResults = new Set(
|
|
309
|
+
snapshot.messages
|
|
310
|
+
.filter((message) => message.role === "toolResult")
|
|
311
|
+
.map((message) => (message.role === "toolResult" ? message.toolCallId : "")),
|
|
312
|
+
);
|
|
313
|
+
for (const tool of snapshot.tools) {
|
|
314
|
+
if (committedResults.has(tool.toolCallId)) continue;
|
|
315
|
+
body.push(
|
|
316
|
+
this.theme.fg(
|
|
317
|
+
tool.isError ? "error" : "warning",
|
|
318
|
+
dialogText(
|
|
319
|
+
`Tool ${tool.toolName} — ${tool.state}${tool.isError ? " (error)" : ""}${tool.parentToolCallId ? " (nested)" : ""}`,
|
|
320
|
+
),
|
|
321
|
+
),
|
|
322
|
+
...this.preview(json(tool.args), columns),
|
|
323
|
+
);
|
|
324
|
+
if (tool.result !== undefined)
|
|
325
|
+
body.push(...this.preview(object(tool.result)?.content ?? tool.result, columns));
|
|
326
|
+
body.push("");
|
|
327
|
+
}
|
|
328
|
+
if (!body.length)
|
|
329
|
+
body.push(
|
|
330
|
+
thread?.state === "starting"
|
|
331
|
+
? "Starting — waiting for transcript attachment…"
|
|
332
|
+
: "No retained messages yet.",
|
|
333
|
+
);
|
|
334
|
+
}
|
|
335
|
+
this.content = body;
|
|
336
|
+
const bodyHeight = Math.max(0, height - 3);
|
|
337
|
+
this.scroll.updateLayout(body.length, bodyHeight, () => this.scheduleRender());
|
|
338
|
+
if (this.restoreViewport) {
|
|
339
|
+
if (this.viewport.follow) this.scroll.scrollToEnd();
|
|
340
|
+
else this.scroll.scrollTo(this.viewport.scrollTop, { disableFollow: true });
|
|
341
|
+
this.restoreViewport = false;
|
|
342
|
+
}
|
|
343
|
+
const visible = this.scroll
|
|
344
|
+
.render(columns)
|
|
345
|
+
.slice(this.scroll.scrollTop, this.scroll.scrollTop + bodyHeight);
|
|
346
|
+
while (visible.length < bodyHeight) visible.push("");
|
|
347
|
+
this.saveViewport();
|
|
348
|
+
const footer = this.error
|
|
349
|
+
? "r Retry · Esc Back · Ctrl+Q Back to main"
|
|
350
|
+
: `Esc tree · Ctrl+Q Back to main · ↑↓/PgUp/PgDn scroll · End latest · c context · t thinking · ${this.viewport.follow ? "following" : "scrolled"}`;
|
|
351
|
+
const lines =
|
|
352
|
+
height === 1
|
|
353
|
+
? [header]
|
|
354
|
+
: height === 2
|
|
355
|
+
? [header, this.theme.fg("dim", footer)]
|
|
356
|
+
: [
|
|
357
|
+
header,
|
|
358
|
+
this.theme.fg(
|
|
359
|
+
this.error ? "error" : "muted",
|
|
360
|
+
dialogText(
|
|
361
|
+
this.error
|
|
362
|
+
? `Attachment error: ${this.error}`
|
|
363
|
+
: thread
|
|
364
|
+
? `${thread.task} · ${thread.status}`
|
|
365
|
+
: "Read-only observer",
|
|
366
|
+
),
|
|
367
|
+
),
|
|
368
|
+
...visible,
|
|
369
|
+
this.theme.fg("dim", footer),
|
|
370
|
+
];
|
|
371
|
+
return fillViewport(lines, width, height);
|
|
372
|
+
}
|
|
373
|
+
}
|
package/src/ui/settings-ui.ts
CHANGED
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type ModelSelectionMode,
|
|
14
14
|
type SubagentMode,
|
|
15
15
|
type ToolFilteringMode,
|
|
16
|
+
type WidgetMode,
|
|
16
17
|
} from "../prefs/settings.ts";
|
|
17
18
|
import { editAgentTypes } from "./ui.ts";
|
|
18
19
|
|
|
@@ -82,6 +83,24 @@ const TOOL_FILTERING_OPTIONS = [
|
|
|
82
83
|
const TOOL_FILTERING_HELP =
|
|
83
84
|
"Allowed (except blocked): only allow-listed tools, minus blocked tools; a missing or empty allow list means no tools.\nAll except blocked: ignore the allow list; block-listed tools remain blocked.\nAll: ignore both lists.\nSave and apply to affect agents when their sessions start.";
|
|
84
85
|
|
|
86
|
+
const WIDGET_MODE_OPTIONS = [
|
|
87
|
+
{
|
|
88
|
+
id: "full",
|
|
89
|
+
label: "Full",
|
|
90
|
+
value: "Detailed agent status rows",
|
|
91
|
+
help: "Full: show the existing agent status widget above the input box, with per-agent details.",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: "minimal",
|
|
95
|
+
label: "Minimal",
|
|
96
|
+
value: "One-line counts and running-agent tokens",
|
|
97
|
+
help: "Minimal: show status counts in one line above the input box.\nStarting agents count as running. Token totals include only active (starting/running) agents.",
|
|
98
|
+
},
|
|
99
|
+
] as const;
|
|
100
|
+
|
|
101
|
+
const WIDGET_MODE_HELP =
|
|
102
|
+
"Full: detailed agent status rows above the input box.\nMinimal: one-line status counts and cumulative input/output tokens for active (starting/running) agents.\nSave and apply to update the widget immediately.";
|
|
103
|
+
|
|
85
104
|
const MODEL_SELECTION_OPTIONS = [
|
|
86
105
|
{
|
|
87
106
|
id: "pick-first-available",
|
|
@@ -161,6 +180,12 @@ async function configureAgentsDialog(
|
|
|
161
180
|
value: MODEL_SELECTION_OPTIONS.find((mode) => mode.id === draft.modelSelection)!.label,
|
|
162
181
|
help: MODEL_SELECTION_HELP,
|
|
163
182
|
},
|
|
183
|
+
{
|
|
184
|
+
id: "widgetMode",
|
|
185
|
+
label: "Status Widget",
|
|
186
|
+
value: WIDGET_MODE_OPTIONS.find((mode) => mode.id === draft.widgetMode)!.label,
|
|
187
|
+
help: WIDGET_MODE_HELP,
|
|
188
|
+
},
|
|
164
189
|
{
|
|
165
190
|
id: "scope",
|
|
166
191
|
label: "Save scope",
|
|
@@ -236,6 +261,12 @@ async function configureAgentsDialog(
|
|
|
236
261
|
});
|
|
237
262
|
if (MODEL_SELECTION_OPTIONS.some((option) => option.id === mode))
|
|
238
263
|
draft.modelSelection = mode as ModelSelectionMode;
|
|
264
|
+
} else if (action === "widgetMode") {
|
|
265
|
+
const mode = await dialogMenu(ctx, "Status Widget", [...WIDGET_MODE_OPTIONS], {
|
|
266
|
+
selectedId: draft.widgetMode,
|
|
267
|
+
});
|
|
268
|
+
if (WIDGET_MODE_OPTIONS.some((option) => option.id === mode))
|
|
269
|
+
draft.widgetMode = mode as WidgetMode;
|
|
239
270
|
} else if (action === "scope") {
|
|
240
271
|
if (!ctx.isProjectTrusted())
|
|
241
272
|
ctx.ui.notify(
|