pi-better-harness 0.58.0 → 0.59.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/CHANGELOG.md +7 -0
- package/README.md +9 -9
- package/extensions/settings/index.ts +18 -9
- package/extensions/settings/menu.ts +126 -0
- package/extensions/settings/page.ts +74 -84
- package/extensions/settings/supervisor.ts +33 -13
- package/node_modules/pi-better-background-tasks/package.json +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-arm64.gz +0 -0
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-arm64.json +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-x64.gz +0 -0
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/darwin-x64.json +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-arm64.gz +0 -0
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-arm64.json +1 -1
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-x64.gz +0 -0
- package/node_modules/pi-better-background-tasks/runtime-client/artifacts/linux-x64.json +1 -1
- package/node_modules/pi-better-subagents/index.ts +8 -3
- package/node_modules/pi-better-subagents/package.json +1 -1
- package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-arm64.gz +0 -0
- package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-arm64.json +1 -1
- package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-x64.gz +0 -0
- package/node_modules/pi-better-subagents/runtime-client/artifacts/darwin-x64.json +1 -1
- package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-arm64.gz +0 -0
- package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-arm64.json +1 -1
- package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-x64.gz +0 -0
- package/node_modules/pi-better-subagents/runtime-client/artifacts/linux-x64.json +1 -1
- package/node_modules/pi-better-subagents/settings-page.ts +51 -31
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.59.0] - 2026-11-27
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
|
|
7
|
+
- Browse Harness settings by function. Switches show their current value, page links show `›`, and prompt editors show **Edit…**. Narrow terminals display values below their labels.
|
|
8
|
+
- Use **Supervisor mode** to turn supervision on or off. **Supervisor scenarios** lets you choose scenarios even while supervision is off.
|
|
9
|
+
|
|
3
10
|
## [0.58.0] - 2026-11-27
|
|
4
11
|
|
|
5
12
|
### Changed
|
package/README.md
CHANGED
|
@@ -214,14 +214,14 @@ pi -e ./packages/pi-better-harness/extensions/minimal-output/index.ts
|
|
|
214
214
|
|
|
215
215
|
## Harness Settings
|
|
216
216
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
217
|
+
Open `/harness-settings` to browse settings by function. Use the up and down
|
|
218
|
+
keys to move between settings. Each row shows its current value, a `›` for a
|
|
219
|
+
page, or **Edit…** for a prompt editor. Enter or Space activates the focused
|
|
220
|
+
row. Escape returns from a child page to the row that opened it.
|
|
221
|
+
|
|
222
|
+
**Agents & permissions** includes the settings pages of loaded Sandbox and
|
|
223
|
+
Subagents packages and the **Agent catalog** shortcut. Standalone installations
|
|
224
|
+
also provide `/sandbox`, `/subagents settings`, `/agents`, and `/goal settings`.
|
|
225
225
|
|
|
226
226
|
**Navigator layout** selects **Flat list** (the default) or **Tree**. Flatten keeps the Subagents
|
|
227
227
|
and Background Tasks groups and includes tasks launched by subagents. Tree puts
|
|
@@ -333,7 +333,7 @@ pi -e ./packages/pi-better-harness/extensions/settings/index.ts
|
|
|
333
333
|
|
|
334
334
|
### Agent Supervisor
|
|
335
335
|
|
|
336
|
-
|
|
336
|
+
In `/harness-settings`, use **Supervisor scenarios** to choose which scenarios to run. **Supervisor mode** turns that selection on or off. You can edit the selection while the mode is off. First use starts with an empty selection. Settings apply to sessions sharing the Pi agent directory. Turning the mode off preserves the selection and lets existing tasks continue.
|
|
337
337
|
|
|
338
338
|
| Scenario | What the owner receives |
|
|
339
339
|
| --- | --- |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAgentDir, type ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
2
2
|
import { currentInstructions, manageInstructions, validateInstructionsPrompt } from "../../lib/instructions.mjs";
|
|
3
3
|
import { readHarnessSetting, updateHarnessSetting } from "../shared-harness-settings.ts";
|
|
4
|
-
import {
|
|
4
|
+
import { openSupervisorScenarios, readSupervisorSettings, setSupervisorEnabled } from "./supervisor.ts";
|
|
5
5
|
import { chooseHarnessSetting } from "./page.ts";
|
|
6
6
|
import { createSettingsRegistry } from "./registry.ts";
|
|
7
7
|
import { changeCallbackSetting, getCallbackSettings, saveCallbackDefault } from "pi-better-background-tasks/src/shared-callback-batcher.ts";
|
|
@@ -12,6 +12,15 @@ export default function harnessSettingsExtension(pi: ExtensionAPI): void {
|
|
|
12
12
|
const registry = createSettingsRegistry(pi);
|
|
13
13
|
const view = { id: "navigator-view", label: "View", values: ["tree", "flatten"],
|
|
14
14
|
get: getNavigatorView, change: (value: string) => setNavigatorView(value) };
|
|
15
|
+
const supervisorMode = {
|
|
16
|
+
id: "supervisor-mode", label: "Supervisor mode", values: ["Off", "On"],
|
|
17
|
+
description: "Run the selected scenarios for sessions sharing this agent directory. Turning the mode off keeps your selections.",
|
|
18
|
+
get() {
|
|
19
|
+
try { return readSupervisorSettings().enabled ? "On" : "Off"; }
|
|
20
|
+
catch { return "Unavailable"; }
|
|
21
|
+
},
|
|
22
|
+
change(value: string) { setSupervisorEnabled(value === "On"); },
|
|
23
|
+
};
|
|
15
24
|
pi.on("session_start", () => { try { loadNavigatorView(); } catch { /* settings command reports read errors */ } });
|
|
16
25
|
pi.on("session_start", () => registry.refresh());
|
|
17
26
|
pi.on("session_shutdown", () => registry.dispose());
|
|
@@ -45,21 +54,21 @@ export default function harnessSettingsExtension(pi: ExtensionAPI): void {
|
|
|
45
54
|
get: readSettings,
|
|
46
55
|
change: mode => changeCallbackSetting(pi, ctx, mode),
|
|
47
56
|
save: () => saveCallbackDefault(readSettings().mode),
|
|
48
|
-
}, registry.controls(), view, [
|
|
49
|
-
{ id: "supervisor:
|
|
50
|
-
description: "Choose
|
|
51
|
-
{ id: "instructions:toggle", label: "Harness instructions",
|
|
57
|
+
}, [...registry.controls(), supervisorMode], view, [
|
|
58
|
+
{ id: "supervisor:scenarios", label: "Supervisor scenarios", kind: "page",
|
|
59
|
+
description: "Choose which scenarios run when Supervisor mode is on." },
|
|
60
|
+
{ id: "instructions:toggle", label: "Harness instructions", kind: "toggle", value: state,
|
|
52
61
|
description: "Toggle the global APPEND_SYSTEM.md block. Applies on startup or /reload." },
|
|
53
|
-
...(prompt === undefined ? [] : [{ id: "instructions:edit", label: "Instructions prompt",
|
|
54
|
-
|
|
62
|
+
...(prompt === undefined ? [] : [{ id: "instructions:edit", label: "Instructions prompt", kind: "editor" as const,
|
|
63
|
+
description: "Edit the Markdown included in the Harness block." }]),
|
|
55
64
|
]);
|
|
56
65
|
} catch (error) {
|
|
57
66
|
ctx.ui.notify(`Settings unavailable: ${error instanceof Error ? error.message : String(error)}`, "error");
|
|
58
67
|
return;
|
|
59
68
|
}
|
|
60
69
|
if (!selected) return;
|
|
61
|
-
if (selected === "supervisor:
|
|
62
|
-
try { await
|
|
70
|
+
if (selected === "supervisor:scenarios") {
|
|
71
|
+
try { await openSupervisorScenarios(ctx); }
|
|
63
72
|
catch (error) { ctx.ui.notify(`Supervisor mode: ${error instanceof Error ? error.message : String(error)}`, "error"); }
|
|
64
73
|
continue;
|
|
65
74
|
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { getKeybindings, matchesKey, truncateToWidth, visibleWidth, wrapTextWithAnsi } from "@earendil-works/pi-tui";
|
|
3
|
+
|
|
4
|
+
export interface MenuItem {
|
|
5
|
+
id: string;
|
|
6
|
+
label: string;
|
|
7
|
+
kind: "toggle" | "choice" | "page" | "editor";
|
|
8
|
+
value?: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface MenuSection {
|
|
13
|
+
title: string;
|
|
14
|
+
items: MenuItem[];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const verbs = { toggle: "toggle", choice: "change", page: "open", editor: "edit" };
|
|
18
|
+
|
|
19
|
+
export function createSettingsMenu(options: {
|
|
20
|
+
title: string;
|
|
21
|
+
sections: MenuSection[];
|
|
22
|
+
selected?: string;
|
|
23
|
+
theme: Theme;
|
|
24
|
+
height: () => number;
|
|
25
|
+
activate: (item: MenuItem) => void;
|
|
26
|
+
back: () => void;
|
|
27
|
+
}) {
|
|
28
|
+
const { theme } = options;
|
|
29
|
+
const rows = options.sections.flatMap(section => section.items.map(item => ({ section, item })));
|
|
30
|
+
const labelWidth = Math.max(0, ...rows.map(({ item }) => visibleWidth(item.label)));
|
|
31
|
+
let cursor = Math.max(0, rows.findIndex(({ item }) => item.id === options.selected));
|
|
32
|
+
let first = 0;
|
|
33
|
+
let feedback = "";
|
|
34
|
+
|
|
35
|
+
function renderItem(item: MenuItem, active: boolean, width: number): string[] {
|
|
36
|
+
const value = item.kind === "page" ? [item.value, "›"].filter(Boolean).join(" ")
|
|
37
|
+
: item.kind === "editor" ? "Edit…" : item.value ?? "";
|
|
38
|
+
const link = item.kind === "page" || item.kind === "editor";
|
|
39
|
+
const trailing = active && !link ? theme.inverse(value) : theme.fg(active ? "accent" : "muted", value);
|
|
40
|
+
const label = (active ? "> " : " ") + theme.fg(active ? "accent" : "text", item.label);
|
|
41
|
+
if (labelWidth + visibleWidth(value) + 4 <= width) {
|
|
42
|
+
return [label + " ".repeat(labelWidth - visibleWidth(item.label) + 2) + trailing];
|
|
43
|
+
}
|
|
44
|
+
return [truncateToWidth(label, width, "…"), truncateToWidth(" " + trailing, width, "…")];
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return {
|
|
48
|
+
report(text: string, error = false) { feedback = theme.fg(error ? "error" : "text", text); },
|
|
49
|
+
invalidate() {},
|
|
50
|
+
handleInput(data: string) {
|
|
51
|
+
const kb = getKeybindings();
|
|
52
|
+
if (kb.matches(data, "tui.select.cancel")) { options.back(); return; }
|
|
53
|
+
const row = rows[cursor];
|
|
54
|
+
if (!row) return;
|
|
55
|
+
if (kb.matches(data, "tui.select.up")) cursor = (cursor + rows.length - 1) % rows.length;
|
|
56
|
+
else if (kb.matches(data, "tui.select.down")) cursor = (cursor + 1) % rows.length;
|
|
57
|
+
else if (kb.matches(data, "tui.select.confirm") || matchesKey(data, "space")) {
|
|
58
|
+
options.activate(row.item);
|
|
59
|
+
return;
|
|
60
|
+
} else return;
|
|
61
|
+
feedback = "";
|
|
62
|
+
},
|
|
63
|
+
render(width: number) {
|
|
64
|
+
const w = Math.max(1, width);
|
|
65
|
+
const title = theme.bold(theme.fg("text", options.title));
|
|
66
|
+
const row = rows[cursor];
|
|
67
|
+
if (!row) return [title, " No settings available"].map(line => truncateToWidth(line, w));
|
|
68
|
+
|
|
69
|
+
// Inline settings share the terminal with the conversation, work panels and Pi footer.
|
|
70
|
+
const height = Math.max(1, Math.floor(options.height() * 2 / 3));
|
|
71
|
+
const lines = rows.map(({ item }, i) => renderItem(item, i === cursor, w));
|
|
72
|
+
const focused = lines[cursor]!;
|
|
73
|
+
if (height < focused.length + 2) return focused.slice(0, height);
|
|
74
|
+
const indent = " ";
|
|
75
|
+
const wrap = (s: string) => wrapTextWithAnsi(s, Math.max(1, w - indent.length)).map(line => indent + line);
|
|
76
|
+
const help = row.item.description ? wrap(row.item.description) : [];
|
|
77
|
+
const kb = getKeybindings();
|
|
78
|
+
const key = (binding: "tui.select.confirm" | "tui.select.cancel") => {
|
|
79
|
+
const name = kb.getKeys(binding)[0] ?? "";
|
|
80
|
+
return name === "escape" ? "Esc" : name.length > 1 ? name.charAt(0).toUpperCase() + name.slice(1) : name;
|
|
81
|
+
};
|
|
82
|
+
const confirm = key("tui.select.confirm");
|
|
83
|
+
const cancel = key("tui.select.cancel");
|
|
84
|
+
const action = [confirm, confirm === "Space" ? "" : "Space"].filter(Boolean).join("/");
|
|
85
|
+
const hint = wrap([action + " to " + verbs[row.item.kind], cancel && cancel + " back"].filter(Boolean).join(" · "));
|
|
86
|
+
const status = feedback ? wrap(feedback) : [];
|
|
87
|
+
const headerGap = height >= 8 ? [""] : [];
|
|
88
|
+
const minBody = 1 + focused.length;
|
|
89
|
+
const available = height - 1 - headerGap.length;
|
|
90
|
+
const footRoom = Math.max(0, available - minBody - 1);
|
|
91
|
+
const keys = [...status, ...hint.map(line => theme.fg("dim", line))].slice(0, footRoom);
|
|
92
|
+
const helpRoom = Math.min(Math.floor(height / 3), footRoom - keys.length - 1);
|
|
93
|
+
const details = help.slice(0, Math.max(0, helpRoom));
|
|
94
|
+
const footer = [...details, ...(details.length ? [""] : []), ...keys];
|
|
95
|
+
if (footer.length) footer.unshift("");
|
|
96
|
+
const budget = Math.min(16, available - footer.length);
|
|
97
|
+
|
|
98
|
+
// Scroll whole rows and repeat the first visible section heading after a scroll.
|
|
99
|
+
let start = cursor;
|
|
100
|
+
let used = 1 + lines[cursor]!.length;
|
|
101
|
+
while (start > first) {
|
|
102
|
+
const cost = lines[start - 1]!.length + (rows[start - 1]!.section === rows[start]!.section ? 0 : 2);
|
|
103
|
+
if (used + cost > budget) break;
|
|
104
|
+
used += cost;
|
|
105
|
+
start--;
|
|
106
|
+
}
|
|
107
|
+
first = start;
|
|
108
|
+
const body: string[] = [];
|
|
109
|
+
let end = first;
|
|
110
|
+
for (; end < rows.length; end++) {
|
|
111
|
+
const { section } = rows[end]!;
|
|
112
|
+
const heading = end === first || rows[end - 1]!.section !== section;
|
|
113
|
+
const gap = heading && body.length > 0;
|
|
114
|
+
const cost = Number(gap) + Number(heading) + lines[end]!.length;
|
|
115
|
+
if (body.length && body.length + cost > budget) break;
|
|
116
|
+
if (gap) body.push("");
|
|
117
|
+
if (heading) body.push(theme.fg("muted", theme.bold(section.title)));
|
|
118
|
+
body.push(...lines[end]!);
|
|
119
|
+
}
|
|
120
|
+
const count = ` ${cursor + 1}/${rows.length}`;
|
|
121
|
+
const showCount = (first > 0 || end < rows.length) && visibleWidth(title + count) <= w;
|
|
122
|
+
return [title + (showCount ? theme.fg("dim", count) : ""), ...headerGap, ...body, ...footer]
|
|
123
|
+
.map(line => truncateToWidth(line, w, "…"));
|
|
124
|
+
},
|
|
125
|
+
};
|
|
126
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ExtensionCommandContext
|
|
2
|
-
import {
|
|
1
|
+
import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
|
+
import { matchesKey } from "@earendil-works/pi-tui";
|
|
3
3
|
import { controlCopy, linkCopy } from "./copy.ts";
|
|
4
|
+
import { createSettingsMenu, type MenuItem, type MenuSection } from "./menu.ts";
|
|
4
5
|
import type { SettingsControl, SettingsLink } from "./registry.ts";
|
|
5
6
|
|
|
6
7
|
export interface CallbackSettingsControl {
|
|
@@ -17,123 +18,112 @@ const callbackDescription = (source: "session" | "default") => [
|
|
|
17
18
|
"Changes apply to this session. Ctrl+S saves your default.",
|
|
18
19
|
].join("\n");
|
|
19
20
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"
|
|
23
|
-
|
|
24
|
-
"setting:
|
|
25
|
-
"setting:
|
|
26
|
-
|
|
21
|
+
const groups = [
|
|
22
|
+
{ title: "Goals & workflows", ids: ["setting:goal-auto-start", "setting:dynamic-workflow", "setting:outcome-todo", "setting:outcome-todo-ledger", "link:goal"] },
|
|
23
|
+
{ title: "Agents & permissions", ids: ["link:subagents", "link:agents", "link:sandbox"] },
|
|
24
|
+
{ title: "Background work", ids: ["setting:tool-call-guard", "setting:background-review-interval", CALLBACK_SETTING_ID] },
|
|
25
|
+
{ title: "Work display", ids: ["setting:navigator-view", "setting:navigator-sticky", "setting:outcome-todo-display", "setting:tool-output", "setting:tool-animation"] },
|
|
26
|
+
{ title: "Supervision", ids: ["setting:supervisor-mode", "supervisor:scenarios"] },
|
|
27
|
+
{ title: "Recaps & instructions", ids: ["setting:session-recap", "link:recap-prompt", "instructions:toggle", "instructions:edit"] },
|
|
27
28
|
];
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
function groupSettings(items: MenuItem[]): MenuSection[] {
|
|
31
|
+
const remaining = new Map(items.map(item => [item.id, item]));
|
|
32
|
+
const sections = groups.map(({ title, ids }) => ({
|
|
33
|
+
title, items: ids.flatMap(id => {
|
|
34
|
+
const item = remaining.get(id);
|
|
35
|
+
remaining.delete(id);
|
|
36
|
+
return item ? [item] : [];
|
|
37
|
+
}),
|
|
38
|
+
}));
|
|
39
|
+
sections.push({ title: "Extensions", items: [...remaining.values()] });
|
|
40
|
+
return sections.filter(section => section.items.length);
|
|
41
|
+
}
|
|
29
42
|
|
|
30
43
|
function presentControl(control: SettingsControl) {
|
|
31
44
|
const copy = controlCopy.get(control.id);
|
|
32
|
-
const
|
|
33
|
-
const display = (raw: string) =>
|
|
45
|
+
const labels = copy?.values;
|
|
46
|
+
const display = (raw: string) => labels && Object.hasOwn(labels, raw) ? labels[raw]! : raw;
|
|
47
|
+
const description = (typeof control.description === "string" && control.description.trim()) || copy?.description;
|
|
34
48
|
const values = control.values.map(display);
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
const item: SettingItem = {
|
|
49
|
+
const raw = control.get();
|
|
50
|
+
const item: MenuItem = {
|
|
38
51
|
id: `setting:${control.id}`,
|
|
39
52
|
label: copy?.label ?? control.label,
|
|
40
|
-
|
|
53
|
+
kind: values.length === 2 && values.includes("On") && values.includes("Off") ? "toggle" : "choice",
|
|
54
|
+
value: display(raw),
|
|
41
55
|
description: [description ?? `Available values are ${values.join(", ")}.`, copy && "Saved as a user default."].filter(Boolean).join("\n"),
|
|
42
|
-
values,
|
|
43
56
|
};
|
|
44
|
-
return { control, item,
|
|
57
|
+
return { control, item, raw, display };
|
|
45
58
|
}
|
|
46
59
|
|
|
47
|
-
function presentLink(link: SettingsLink):
|
|
60
|
+
function presentLink(link: SettingsLink): MenuItem {
|
|
48
61
|
const copy = linkCopy.get(link.id);
|
|
49
|
-
const description = typeof link.description === "string" && link.description.trim()
|
|
50
|
-
? link.description : copy?.description;
|
|
51
|
-
const action = "Open";
|
|
52
62
|
return {
|
|
53
63
|
id: `link:${link.id}`,
|
|
54
64
|
label: copy?.label ?? link.label,
|
|
55
|
-
|
|
56
|
-
description: [description, `You can also run ${link.command}.`].filter(Boolean).join("\n"),
|
|
57
|
-
values: [action],
|
|
65
|
+
kind: link.id === "recap-prompt" ? "editor" : "page",
|
|
66
|
+
description: [(typeof link.description === "string" && link.description.trim()) || copy?.description, `You can also run ${link.command}.`].filter(Boolean).join("\n"),
|
|
58
67
|
};
|
|
59
68
|
}
|
|
60
69
|
|
|
61
|
-
export async function chooseHarnessSetting(ctx: ExtensionCommandContext, links: SettingsLink[], selected?: string, callbacks?: CallbackSettingsControl, controls: SettingsControl[] = [], navigatorView?: SettingsControl, actions:
|
|
62
|
-
return ctx.ui.custom((tui, theme
|
|
70
|
+
export async function chooseHarnessSetting(ctx: ExtensionCommandContext, links: SettingsLink[], selected?: string, callbacks?: CallbackSettingsControl, controls: SettingsControl[] = [], navigatorView?: SettingsControl, actions: MenuItem[] = []): Promise<string | undefined> {
|
|
71
|
+
return ctx.ui.custom((tui, theme, _kb, done: (id?: string) => void) => {
|
|
63
72
|
const currentCallback = callbacks?.get();
|
|
64
73
|
let callbackMode = currentCallback?.mode ?? "hold";
|
|
65
|
-
const callbackSetting:
|
|
74
|
+
const callbackSetting: MenuItem | undefined = currentCallback && {
|
|
66
75
|
id: CALLBACK_SETTING_ID,
|
|
67
76
|
label: "Completion delivery",
|
|
68
|
-
|
|
77
|
+
kind: "choice",
|
|
78
|
+
value: callbackLabels[callbackMode],
|
|
69
79
|
description: callbackDescription(currentCallback.source),
|
|
70
|
-
values: Object.values(callbackLabels),
|
|
71
80
|
};
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
const items = [
|
|
81
|
+
const entries = (navigatorView ? [...controls, navigatorView] : controls).map(presentControl);
|
|
82
|
+
const sections = groupSettings([
|
|
75
83
|
...(callbackSetting ? [callbackSetting] : []),
|
|
76
84
|
...entries.map(({ item }) => item),
|
|
77
85
|
...links.map(presentLink),
|
|
78
86
|
...actions,
|
|
79
|
-
]
|
|
80
|
-
const feedback = new Text("", 2, 0);
|
|
87
|
+
]);
|
|
81
88
|
let changing = false;
|
|
82
89
|
const report = (message: string, error = false) => {
|
|
83
|
-
|
|
90
|
+
menu.report(message, error);
|
|
84
91
|
tui.requestRender?.();
|
|
85
92
|
};
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
const menu = createSettingsMenu({
|
|
94
|
+
title: "Harness settings", theme, sections, selected, height: () => tui.terminal?.rows ?? 32,
|
|
95
|
+
back: () => done(),
|
|
96
|
+
activate(item) {
|
|
97
|
+
if (item === callbackSetting && callbacks) {
|
|
98
|
+
try {
|
|
99
|
+
const next = callbackMode === "hold" ? "steer" : "hold";
|
|
100
|
+
callbacks.change(next);
|
|
101
|
+
callbackMode = next;
|
|
102
|
+
item.value = callbackLabels[next];
|
|
103
|
+
item.description = callbackDescription("session");
|
|
104
|
+
report("Session setting saved.");
|
|
105
|
+
} catch (error) { report(error instanceof Error ? error.message : String(error), true); }
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
const entry = entries.find(entry => entry.item === item);
|
|
109
|
+
if (!entry) { done(item.id); return; }
|
|
110
|
+
const { control, display } = entry;
|
|
95
111
|
changing = true;
|
|
96
112
|
report("Saving setting...");
|
|
97
|
-
Promise.resolve().then(() =>
|
|
98
|
-
|
|
113
|
+
Promise.resolve().then(() => {
|
|
114
|
+
const index = control.values.indexOf(entry.raw);
|
|
115
|
+
return control.change(control.values[(index + 1) % control.values.length]!, ctx);
|
|
116
|
+
}).then(() => {
|
|
117
|
+
entry.raw = control.get();
|
|
118
|
+
item.value = display(entry.raw);
|
|
99
119
|
report("Setting saved.");
|
|
100
|
-
}).catch(error =>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
if (id !== CALLBACK_SETTING_ID || !callbacks || !callbackSetting) { done(id); return; }
|
|
107
|
-
try {
|
|
108
|
-
const nextMode = value === callbackLabels.steer ? "steer" : "hold";
|
|
109
|
-
callbacks.change(nextMode);
|
|
110
|
-
callbackMode = nextMode;
|
|
111
|
-
callbackSetting.description = callbackDescription("session");
|
|
112
|
-
report("Session setting saved.");
|
|
113
|
-
} catch (error) {
|
|
114
|
-
list.updateValue(CALLBACK_SETTING_ID, callbackLabels[callbackMode]);
|
|
115
|
-
report(error instanceof Error ? error.message : String(error), true);
|
|
116
|
-
}
|
|
117
|
-
}, () => done(), { enableSearch: false });
|
|
118
|
-
|
|
119
|
-
const index = selected ? items.findIndex(item => item.id === selected) : 0;
|
|
120
|
-
if (index > 0) {
|
|
121
|
-
// SettingsList has no public selection setter. Restore synchronously using
|
|
122
|
-
// default navigation, then return the untouched user bindings before input.
|
|
123
|
-
const bindings = getKeybindings();
|
|
124
|
-
try {
|
|
125
|
-
setKeybindings(new KeybindingsManager(TUI_KEYBINDINGS));
|
|
126
|
-
for (let i = 0; i < index; i++) list.handleInput("\x1b[B");
|
|
127
|
-
} finally { setKeybindings(bindings); }
|
|
128
|
-
}
|
|
129
|
-
const page = new Container();
|
|
130
|
-
page.addChild(new Text(theme.bold(theme.fg("text", "Harness settings")), 0, 0));
|
|
131
|
-
page.addChild(new Spacer(1));
|
|
132
|
-
page.addChild(list);
|
|
133
|
-
page.addChild(feedback);
|
|
120
|
+
}).catch(error => report(error instanceof Error ? error.message : String(error), true))
|
|
121
|
+
.finally(() => { changing = false; });
|
|
122
|
+
},
|
|
123
|
+
});
|
|
134
124
|
return {
|
|
135
|
-
render:
|
|
136
|
-
invalidate:
|
|
125
|
+
render: menu.render,
|
|
126
|
+
invalidate: menu.invalidate,
|
|
137
127
|
handleInput(data: string) {
|
|
138
128
|
if (changing) return;
|
|
139
129
|
if (callbacks && matchesKey(data, "ctrl+s")) {
|
|
@@ -141,7 +131,7 @@ export async function chooseHarnessSetting(ctx: ExtensionCommandContext, links:
|
|
|
141
131
|
catch (error) { report(error instanceof Error ? error.message : String(error), true); }
|
|
142
132
|
return;
|
|
143
133
|
}
|
|
144
|
-
|
|
134
|
+
menu.handleInput(data);
|
|
145
135
|
},
|
|
146
136
|
};
|
|
147
137
|
});
|
|
@@ -42,23 +42,43 @@ export function scenarioRevision(scenario: string) {
|
|
|
42
42
|
if (enabledScenarios().includes(scenario)) return cache?.revision;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
export
|
|
45
|
+
export function readSupervisorSettings() {
|
|
46
|
+
return decode(readHarnessSetting(key));
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export function setSupervisorEnabled(enabled: boolean) {
|
|
50
|
+
updateHarnessSetting(key, raw => {
|
|
51
|
+
const current = decode(raw);
|
|
52
|
+
return current.enabled === enabled ? raw : { ...current, enabled, revision: randomUUID() };
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export async function openSupervisorScenarios(ctx: Pick<ExtensionCommandContext, "ui">): Promise<void> {
|
|
57
|
+
const { createSettingsMenu } = await import("./menu.ts");
|
|
58
|
+
let selected: string | undefined;
|
|
46
59
|
while (true) {
|
|
47
|
-
const { enabled, scenarios } =
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
60
|
+
const { enabled, scenarios } = readSupervisorSettings();
|
|
61
|
+
const choice = await ctx.ui.custom<string | undefined>((tui, theme, _kb, done) => createSettingsMenu({
|
|
62
|
+
title: "Supervisor scenarios", theme, selected, height: () => tui.terminal?.rows ?? 32,
|
|
63
|
+
sections: [{
|
|
64
|
+
title: enabled ? "Supervisor mode is on" : "Supervisor mode is off",
|
|
65
|
+
items: [...options].map(([id, label]) => ({
|
|
66
|
+
id, label, kind: "toggle", value: scenarios.includes(id) ? "[x]" : "[ ]",
|
|
67
|
+
description: enabled ? "Checked scenarios run for sessions sharing this agent directory."
|
|
68
|
+
: "Checked scenarios will run when you turn on Supervisor mode.",
|
|
69
|
+
})),
|
|
70
|
+
}],
|
|
71
|
+
activate: item => done(item.id),
|
|
72
|
+
back: () => done(undefined),
|
|
73
|
+
}));
|
|
53
74
|
if (choice === undefined) return;
|
|
75
|
+
selected = choice;
|
|
76
|
+
const include = !scenarios.includes(choice);
|
|
54
77
|
updateHarnessSetting(key, raw => {
|
|
55
78
|
const current = decode(raw);
|
|
56
|
-
if (choice ===
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (row.selected) updated.delete(row.id);
|
|
60
|
-
else updated.add(row.id);
|
|
61
|
-
return updated.size === current.scenarios.length ? raw : { ...current, scenarios: [...updated], revision: randomUUID() };
|
|
79
|
+
if (current.scenarios.includes(choice) === include) return raw;
|
|
80
|
+
const next = include ? [...current.scenarios, choice] : current.scenarios.filter(id => id !== choice);
|
|
81
|
+
return { ...current, scenarios: next, revision: randomUUID() };
|
|
62
82
|
});
|
|
63
83
|
}
|
|
64
84
|
}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"build":{"format":1,"sourceDigest":"
|
|
1
|
+
{"build":{"format":1,"sourceDigest":"65746505a072aa1596764b4458d968941ab105350369815050f6ab8f467d2884","piSdkVersion":"1.4.0","nodeVersion":"24.14.1","platform":"darwin-arm64","dependencyLockDigest":"300f19071b0e3f4e68220f42d7976b92dc6a629dd2719325fb7fad41781164c8","protocolVersion":1,"serverVersion":"0.8.4","contentId":"28b4109c57b16d1daedac9e127dc5dbab070230eb1285d179b82a6053a354f7c"},"sha256":"39eaec5eac80494b154758c9b879736e26f492e8c386edb6f5ca51ff67fa84a6"}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"build":{"format":1,"sourceDigest":"
|
|
1
|
+
{"build":{"format":1,"sourceDigest":"65746505a072aa1596764b4458d968941ab105350369815050f6ab8f467d2884","piSdkVersion":"1.4.0","nodeVersion":"24.14.1","platform":"darwin-x64","dependencyLockDigest":"300f19071b0e3f4e68220f42d7976b92dc6a629dd2719325fb7fad41781164c8","protocolVersion":1,"serverVersion":"0.8.4","contentId":"aca525dbaba9b02dcec19e6c7875e0bdcfc3a9ce756571c463d8fba32b244a94"},"sha256":"d186a852343fa9c163703e4b65439b2a378c1d859a364172e3d6c52562027038"}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"build":{"format":1,"sourceDigest":"
|
|
1
|
+
{"build":{"format":1,"sourceDigest":"65746505a072aa1596764b4458d968941ab105350369815050f6ab8f467d2884","piSdkVersion":"1.4.0","nodeVersion":"24.14.1","platform":"linux-arm64","dependencyLockDigest":"300f19071b0e3f4e68220f42d7976b92dc6a629dd2719325fb7fad41781164c8","protocolVersion":1,"serverVersion":"0.8.4","contentId":"d920b273016e2621a49c305335e9842f3836d3814fee6005466624847c95a43b"},"sha256":"ee02a82127297bd0b645aad1b171cdefcd658056bf5a6e6da176acf02465ba77"}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"build":{"format":1,"sourceDigest":"
|
|
1
|
+
{"build":{"format":1,"sourceDigest":"65746505a072aa1596764b4458d968941ab105350369815050f6ab8f467d2884","piSdkVersion":"1.4.0","nodeVersion":"24.14.1","platform":"linux-x64","dependencyLockDigest":"300f19071b0e3f4e68220f42d7976b92dc6a629dd2719325fb7fad41781164c8","protocolVersion":1,"serverVersion":"0.8.4","contentId":"0b344d12f9ac9c186d2627d425f46f173ec5dd71949d4274fdf79e8188429a9e"},"sha256":"c1bf6b160a2a89f0e83dc602387b4dcfb6a2b79010da1a980932b7755358f577"}
|
|
@@ -4536,7 +4536,7 @@ export default function (pi: ExtensionAPI, managed?: import("./managed-launch-po
|
|
|
4536
4536
|
});
|
|
4537
4537
|
const openSettings = async (ctx: ExtensionCommandContext): Promise<void> => {
|
|
4538
4538
|
if (ctx.mode === "tui" && ctx.hasUI && typeof ctx.ui.custom === "function") {
|
|
4539
|
-
const
|
|
4539
|
+
const showSettings = (selected?: "agents") => ctx.ui.custom<"agents" | undefined>((tui, theme, _kb, done) => createSubagentSettingsPage(theme, {
|
|
4540
4540
|
get: () => {
|
|
4541
4541
|
const settings = effectiveSettings();
|
|
4542
4542
|
const skills = activeSkills();
|
|
@@ -4563,8 +4563,13 @@ export default function (pi: ExtensionAPI, managed?: import("./managed-launch-po
|
|
|
4563
4563
|
discoverSkills: () => discoveredSkillsFromContext(ctx),
|
|
4564
4564
|
// Close this page first; the catalog opens after ui.custom resolves.
|
|
4565
4565
|
openAgents: () => done("agents"),
|
|
4566
|
-
|
|
4567
|
-
|
|
4566
|
+
settingsChanged: () => refreshBackgroundWorkNavigator(ctx),
|
|
4567
|
+
}, () => tui.requestRender(), () => done(undefined), () => tui.terminal?.rows ?? 30, selected));
|
|
4568
|
+
let next = await showSettings();
|
|
4569
|
+
while (next === "agents") {
|
|
4570
|
+
await agentOperations.openCatalog(ctx);
|
|
4571
|
+
next = await showSettings(next);
|
|
4572
|
+
}
|
|
4568
4573
|
} else {
|
|
4569
4574
|
const skills = activeSkills();
|
|
4570
4575
|
const skillChoice = skills.mode === "inherit" ? "discovery"
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"build":{"format":1,"sourceDigest":"
|
|
1
|
+
{"build":{"format":1,"sourceDigest":"65746505a072aa1596764b4458d968941ab105350369815050f6ab8f467d2884","piSdkVersion":"1.4.0","nodeVersion":"24.14.1","platform":"darwin-arm64","dependencyLockDigest":"300f19071b0e3f4e68220f42d7976b92dc6a629dd2719325fb7fad41781164c8","protocolVersion":1,"serverVersion":"0.8.4","contentId":"28b4109c57b16d1daedac9e127dc5dbab070230eb1285d179b82a6053a354f7c"},"sha256":"39eaec5eac80494b154758c9b879736e26f492e8c386edb6f5ca51ff67fa84a6"}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"build":{"format":1,"sourceDigest":"
|
|
1
|
+
{"build":{"format":1,"sourceDigest":"65746505a072aa1596764b4458d968941ab105350369815050f6ab8f467d2884","piSdkVersion":"1.4.0","nodeVersion":"24.14.1","platform":"darwin-x64","dependencyLockDigest":"300f19071b0e3f4e68220f42d7976b92dc6a629dd2719325fb7fad41781164c8","protocolVersion":1,"serverVersion":"0.8.4","contentId":"aca525dbaba9b02dcec19e6c7875e0bdcfc3a9ce756571c463d8fba32b244a94"},"sha256":"d186a852343fa9c163703e4b65439b2a378c1d859a364172e3d6c52562027038"}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"build":{"format":1,"sourceDigest":"
|
|
1
|
+
{"build":{"format":1,"sourceDigest":"65746505a072aa1596764b4458d968941ab105350369815050f6ab8f467d2884","piSdkVersion":"1.4.0","nodeVersion":"24.14.1","platform":"linux-arm64","dependencyLockDigest":"300f19071b0e3f4e68220f42d7976b92dc6a629dd2719325fb7fad41781164c8","protocolVersion":1,"serverVersion":"0.8.4","contentId":"d920b273016e2621a49c305335e9842f3836d3814fee6005466624847c95a43b"},"sha256":"ee02a82127297bd0b645aad1b171cdefcd658056bf5a6e6da176acf02465ba77"}
|
|
Binary file
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"build":{"format":1,"sourceDigest":"
|
|
1
|
+
{"build":{"format":1,"sourceDigest":"65746505a072aa1596764b4458d968941ab105350369815050f6ab8f467d2884","piSdkVersion":"1.4.0","nodeVersion":"24.14.1","platform":"linux-x64","dependencyLockDigest":"300f19071b0e3f4e68220f42d7976b92dc6a629dd2719325fb7fad41781164c8","protocolVersion":1,"serverVersion":"0.8.4","contentId":"0b344d12f9ac9c186d2627d425f46f173ec5dd71949d4274fdf79e8188429a9e"},"sha256":"c1bf6b160a2a89f0e83dc602387b4dcfb6a2b79010da1a980932b7755358f577"}
|
|
@@ -46,21 +46,22 @@ export interface SubagentSettingsHandlers {
|
|
|
46
46
|
reset(): void;
|
|
47
47
|
/** Opens the same catalog as `/agents`. The caller closes this page first. */
|
|
48
48
|
openAgents?(): void;
|
|
49
|
+
settingsChanged?(): void;
|
|
49
50
|
}
|
|
50
51
|
|
|
51
52
|
type EditTarget = { kind: "cap" } | { kind: "toolWait" } | { kind: "stuck" } | { kind: "timeout" };
|
|
52
53
|
|
|
53
54
|
const rows = [
|
|
54
|
-
{ kind: "mode", label: "Delegation mode" },
|
|
55
|
-
{ kind: "cap", label: "Concurrent subagents" },
|
|
56
|
-
{ kind: "workspace", label: "Git workspace" },
|
|
57
|
-
{ kind: "timeout", label: "Run timeout" },
|
|
58
|
-
{ kind: "toolWait", label: "Tool-wait alert" },
|
|
59
|
-
{ kind: "stuck", label: "No-progress alert" },
|
|
60
|
-
{ kind: "skills", label: "Skill exposure" },
|
|
61
|
-
{ kind: "choose", label: "Selected skills" },
|
|
62
|
-
{ kind: "agents", label: "
|
|
63
|
-
{ kind: "reset", label: "Reset to defaults" },
|
|
55
|
+
{ section: "Delegation", kind: "mode", label: "Delegation mode" },
|
|
56
|
+
{ section: "Delegation", kind: "cap", label: "Concurrent subagents" },
|
|
57
|
+
{ section: "Delegation", kind: "workspace", label: "Git workspace" },
|
|
58
|
+
{ section: "Run limits & alerts", kind: "timeout", label: "Run timeout" },
|
|
59
|
+
{ section: "Run limits & alerts", kind: "toolWait", label: "Tool-wait alert" },
|
|
60
|
+
{ section: "Run limits & alerts", kind: "stuck", label: "No-progress alert" },
|
|
61
|
+
{ section: "Skills & agents", kind: "skills", label: "Skill exposure" },
|
|
62
|
+
{ section: "Skills & agents", kind: "choose", label: "Selected skills" },
|
|
63
|
+
{ section: "Skills & agents", kind: "agents", label: "Agent catalog" },
|
|
64
|
+
{ section: "Session defaults", kind: "reset", label: "Reset to defaults" },
|
|
64
65
|
] as const;
|
|
65
66
|
|
|
66
67
|
type Row = typeof rows[number];
|
|
@@ -107,9 +108,9 @@ function settingValue(kind: Row["kind"], s: SubagentSettingsSnapshot): string {
|
|
|
107
108
|
case "toolWait": return s.toolWaitMinutes === 0 ? "Off" : `${s.toolWaitMinutes} min`;
|
|
108
109
|
case "stuck": return s.stuckMinutes === 0 ? "Off" : `${s.stuckMinutes} min`;
|
|
109
110
|
case "skills": return skillLabel(s.skillsMode);
|
|
110
|
-
case "choose": return s.skillsMode === "explicit" ? `${s.skillsPaths.length} checked
|
|
111
|
-
case "agents": return "
|
|
112
|
-
case "reset": return "
|
|
111
|
+
case "choose": return s.skillsMode === "explicit" ? `${s.skillsPaths.length} checked ›` : "›";
|
|
112
|
+
case "agents": return "›";
|
|
113
|
+
case "reset": return "";
|
|
113
114
|
}
|
|
114
115
|
}
|
|
115
116
|
|
|
@@ -160,10 +161,12 @@ export function createSubagentSettingsPage(
|
|
|
160
161
|
requestRender: () => void,
|
|
161
162
|
close: () => void,
|
|
162
163
|
getHeight: () => number = () => process.stdout.rows ?? 30,
|
|
164
|
+
selected?: Row["kind"],
|
|
163
165
|
): Tui.Component & Tui.Focusable {
|
|
164
166
|
const input = new Tui.Input();
|
|
167
|
+
let settings = handlers.get();
|
|
165
168
|
let focused = false;
|
|
166
|
-
let row = 0;
|
|
169
|
+
let row = Math.max(0, rows.findIndex(entry => entry.kind === selected));
|
|
167
170
|
let editing: EditTarget | undefined;
|
|
168
171
|
let picker: ReturnType<typeof createSkillPicker> | undefined;
|
|
169
172
|
let rememberedSkillPaths: string[] | undefined;
|
|
@@ -177,6 +180,12 @@ export function createSubagentSettingsPage(
|
|
|
177
180
|
requestRender();
|
|
178
181
|
}
|
|
179
182
|
|
|
183
|
+
function reportChange(text: string): void {
|
|
184
|
+
settings = handlers.get();
|
|
185
|
+
handlers.settingsChanged?.();
|
|
186
|
+
report(text);
|
|
187
|
+
}
|
|
188
|
+
|
|
180
189
|
function startEditing(target: EditTarget, value: string): void {
|
|
181
190
|
editing = target;
|
|
182
191
|
input.setValue(value);
|
|
@@ -188,7 +197,7 @@ export function createSubagentSettingsPage(
|
|
|
188
197
|
function finishEditing(text: string): void {
|
|
189
198
|
input.focused = false;
|
|
190
199
|
editing = undefined;
|
|
191
|
-
|
|
200
|
+
reportChange(text);
|
|
192
201
|
}
|
|
193
202
|
|
|
194
203
|
function openSkillPicker(initial: readonly string[], previousMode: SkillExposureMode): void {
|
|
@@ -204,12 +213,12 @@ export function createSubagentSettingsPage(
|
|
|
204
213
|
if (paths.length === 0) {
|
|
205
214
|
handlers.changeSkills("none", []);
|
|
206
215
|
rememberedSkillPaths = [];
|
|
207
|
-
|
|
216
|
+
reportChange("No skills checked. Skill exposure set to No skill catalog.");
|
|
208
217
|
return { ok: true, message: "No skill catalog selected." };
|
|
209
218
|
}
|
|
210
219
|
handlers.changeSkills("explicit", paths);
|
|
211
220
|
rememberedSkillPaths = [...paths];
|
|
212
|
-
|
|
221
|
+
reportChange(`${paths.length} skill${paths.length === 1 ? "" : "s"} selected.`);
|
|
213
222
|
return { ok: true, message: `${paths.length} selected.` };
|
|
214
223
|
} catch (cause) {
|
|
215
224
|
return { ok: false, message: cause instanceof Error ? cause.message : String(cause) };
|
|
@@ -226,15 +235,17 @@ export function createSubagentSettingsPage(
|
|
|
226
235
|
requestRender();
|
|
227
236
|
}
|
|
228
237
|
|
|
229
|
-
function action(
|
|
238
|
+
function action(selected: Row, key: string): void {
|
|
230
239
|
try {
|
|
240
|
+
// Defaults may have changed in a second Pi session since this page opened.
|
|
241
|
+
settings = handlers.get();
|
|
231
242
|
if (selected.kind === "workspace") {
|
|
232
243
|
handlers.changeWorkspace(settings.gitWorkspace === "worktree" ? "clone" : "worktree");
|
|
233
|
-
|
|
244
|
+
reportChange("Session workspace updated.");
|
|
234
245
|
} else if (selected.kind === "mode") {
|
|
235
246
|
const next = DELEGATION_MODES[(DELEGATION_MODES.indexOf(settings.mode) + 1) % DELEGATION_MODES.length]!;
|
|
236
247
|
handlers.changeMode(next);
|
|
237
|
-
|
|
248
|
+
reportChange("Session mode updated.");
|
|
238
249
|
} else if (selected.kind === "cap") {
|
|
239
250
|
startEditing({ kind: "cap" }, String(settings.maxConcurrent));
|
|
240
251
|
} else if (selected.kind === "toolWait") {
|
|
@@ -244,7 +255,7 @@ export function createSubagentSettingsPage(
|
|
|
244
255
|
} else if (selected.kind === "timeout") {
|
|
245
256
|
if (key === " ") {
|
|
246
257
|
handlers.changeTiming("maxMinutes", 0);
|
|
247
|
-
|
|
258
|
+
reportChange("Run timeout set to 24 hours.");
|
|
248
259
|
} else {
|
|
249
260
|
startEditing(selected, settings.maxMinutes === 0 || settings.maxMinutes >= 1440 ? MAX_TIMEOUT : String(settings.maxMinutes));
|
|
250
261
|
}
|
|
@@ -252,7 +263,7 @@ export function createSubagentSettingsPage(
|
|
|
252
263
|
if (settings.skillsMode === "explicit") rememberedSkillPaths = [...settings.skillsPaths];
|
|
253
264
|
const next = cycleSkillMode(settings.skillsMode);
|
|
254
265
|
handlers.changeSkills(next, []);
|
|
255
|
-
|
|
266
|
+
reportChange(`Skill exposure: ${skillLabel(next).toLowerCase()}.`);
|
|
256
267
|
} else if (selected.kind === "choose") {
|
|
257
268
|
openSkillPicker(
|
|
258
269
|
settings.skillsMode === "explicit" ? settings.skillsPaths : rememberedSkillPaths ?? [],
|
|
@@ -264,7 +275,7 @@ export function createSubagentSettingsPage(
|
|
|
264
275
|
} else {
|
|
265
276
|
handlers.reset();
|
|
266
277
|
rememberedSkillPaths = undefined;
|
|
267
|
-
|
|
278
|
+
reportChange("Session settings reset to saved defaults.");
|
|
268
279
|
}
|
|
269
280
|
} catch (cause) {
|
|
270
281
|
report(cause instanceof Error ? cause.message : String(cause), true);
|
|
@@ -314,14 +325,17 @@ export function createSubagentSettingsPage(
|
|
|
314
325
|
input.focused = editing !== undefined && value;
|
|
315
326
|
if (picker) picker.focused = value;
|
|
316
327
|
},
|
|
317
|
-
invalidate() {
|
|
328
|
+
invalidate() {
|
|
329
|
+
settings = handlers.get();
|
|
330
|
+
input.invalidate();
|
|
331
|
+
picker?.invalidate();
|
|
332
|
+
},
|
|
318
333
|
handleInput(data: string) {
|
|
319
334
|
if (picker) {
|
|
320
335
|
picker.handleInput(data);
|
|
321
336
|
requestRender();
|
|
322
337
|
return;
|
|
323
338
|
}
|
|
324
|
-
const settings = handlers.get();
|
|
325
339
|
if (editing) {
|
|
326
340
|
input.handleInput(data);
|
|
327
341
|
requestRender();
|
|
@@ -333,19 +347,18 @@ export function createSubagentSettingsPage(
|
|
|
333
347
|
else if (keys.matches(data, "tui.select.up") || keys.matches(data, "tui.select.down")) {
|
|
334
348
|
row = Math.max(0, Math.min(rows.length - 1, row + (keys.matches(data, "tui.select.up") ? -1 : 1)));
|
|
335
349
|
message = "";
|
|
336
|
-
} else if (keys.matches(data, "tui.select.confirm") || data === " ") action(
|
|
350
|
+
} else if (keys.matches(data, "tui.select.confirm") || data === " ") action(selected, data);
|
|
337
351
|
else if (Tui.matchesKey(data, "ctrl+s")) {
|
|
338
352
|
const result = handlers.save();
|
|
339
353
|
if (result.ok) {
|
|
340
354
|
rememberedSkillPaths = settings.skillsMode === "explicit" ? [...settings.skillsPaths] : undefined;
|
|
341
|
-
|
|
342
|
-
report(result.message,
|
|
355
|
+
reportChange(result.message);
|
|
356
|
+
} else report(result.message, true);
|
|
343
357
|
}
|
|
344
358
|
requestRender();
|
|
345
359
|
},
|
|
346
360
|
render(width: number) {
|
|
347
361
|
if (picker) return picker.render(width);
|
|
348
|
-
const settings = handlers.get();
|
|
349
362
|
const w = Math.max(1, Math.floor(width));
|
|
350
363
|
const height = Math.max(1, Math.floor(getHeight()));
|
|
351
364
|
const valueColumn = 2 + labelWidth + 2;
|
|
@@ -353,16 +366,23 @@ export function createSubagentSettingsPage(
|
|
|
353
366
|
let selectedStart = 0;
|
|
354
367
|
let selectedEnd = 0;
|
|
355
368
|
for (const [index, entry] of rows.entries()) {
|
|
369
|
+
const startsSection = rows[index - 1]?.section !== entry.section;
|
|
370
|
+
if (startsSection) {
|
|
371
|
+
if (index > 0) body.push("");
|
|
372
|
+
body.push(theme.fg("muted", theme.bold(entry.section)));
|
|
373
|
+
}
|
|
356
374
|
const active = index === row;
|
|
357
375
|
const value = settingValue(entry.kind, settings);
|
|
358
376
|
const stacked = valueColumn + Math.max(Tui.visibleWidth(value), editing?.kind === entry.kind ? 8 : 0) > w;
|
|
359
377
|
const column = stacked ? Math.min(4, Math.max(0, w - 1)) : valueColumn;
|
|
360
378
|
const valueText = editing?.kind === entry.kind
|
|
361
379
|
? input.render(Math.max(1, w - column))[0] ?? ""
|
|
362
|
-
: active ? theme.inverse(value) : theme.fg("muted", value);
|
|
380
|
+
: active && entry.kind !== "choose" && entry.kind !== "agents" ? theme.inverse(value) : theme.fg(active ? "accent" : "muted", value);
|
|
363
381
|
const label = (active ? "> " : " ") + theme.fg(active ? "accent" : "text", entry.label);
|
|
364
382
|
if (active) selectedStart = body.length;
|
|
365
|
-
if (
|
|
383
|
+
if (!value) {
|
|
384
|
+
body.push(label);
|
|
385
|
+
} else if (stacked) {
|
|
366
386
|
const valueLines = Tui.wrapTextWithAnsi(valueText, Math.max(1, w - column));
|
|
367
387
|
body.push(label, ...valueLines.map(line => " ".repeat(column) + line));
|
|
368
388
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-better-harness",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.59.0",
|
|
4
4
|
"description": "Pi extension bundle for a write sandbox, subagents, background tasks, SSH, Goals, and Todo lists.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"test": "node --import tsx --import ../../scripts/isolate-registry.mjs --test test/*.test.mjs test/*.test.ts test/task-context/*.test.ts"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"pi-better-background-tasks": "0.21.
|
|
64
|
+
"pi-better-background-tasks": "0.21.4",
|
|
65
65
|
"pi-better-goal": "0.18.0",
|
|
66
66
|
"pi-better-sandbox": "0.15.2",
|
|
67
67
|
"pi-better-ssh": "0.1.7",
|
|
68
|
-
"pi-better-subagents": "0.
|
|
68
|
+
"pi-better-subagents": "0.40.0",
|
|
69
69
|
"proper-lockfile": "^4.1.2",
|
|
70
70
|
"shell-quote": "1.12.0",
|
|
71
71
|
"smol-toml": "1.9.0",
|