pi-subagent-manager 1.1.0 → 1.2.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 +4 -4
- package/agents/architect.md +1 -1
- package/agents/coder.md +1 -1
- package/agents/researcher.md +1 -1
- package/agents/reviewer.md +1 -1
- package/agents/tasker.md +1 -1
- package/agents/writer.md +1 -1
- package/docs/default-agents.md +24 -24
- package/package.json +10 -5
- package/src/index.ts +17 -4
- package/src/orch/checklist-integration.ts +33 -9
- package/src/orch/diagnostics.ts +3 -1
- package/src/orch/housekeeping.ts +1 -4
- package/src/orch/inherited-tools.ts +2 -2
- package/src/orch/manager.ts +8 -3
- package/src/orch/prompt.ts +3 -1
- package/src/orch/runtime.ts +28 -15
- package/src/prefs/config.ts +47 -149
- package/src/prefs/models.ts +2 -5
- package/src/prefs/settings.ts +121 -55
- package/src/ui/agent-navigation-editor.ts +20 -10
- package/src/ui/cost-footer.ts +5 -2
- package/src/ui/dialog.ts +52 -59
- package/src/ui/model-picker.ts +17 -5
- package/src/ui/settings-ui.ts +364 -217
- package/src/ui/status-ui.ts +14 -11
- package/src/ui/ui.ts +51 -26
package/src/ui/status-ui.ts
CHANGED
|
@@ -140,15 +140,14 @@ export class StatusDialog {
|
|
|
140
140
|
|
|
141
141
|
private syncRefresh(): void {
|
|
142
142
|
if (!this.refreshing) return;
|
|
143
|
-
const delay =
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
(thread)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
: 1000;
|
|
143
|
+
const delay = this.service
|
|
144
|
+
.list()
|
|
145
|
+
.some(
|
|
146
|
+
(thread) =>
|
|
147
|
+
thread.path !== ROOT && (thread.state === "starting" || thread.state === "running"),
|
|
148
|
+
)
|
|
149
|
+
? AGENT_PROGRESS_INTERVAL
|
|
150
|
+
: 1000;
|
|
152
151
|
if (this.timer !== undefined && this.refreshDelay === delay) return;
|
|
153
152
|
this.stopRefresh();
|
|
154
153
|
this.refreshDelay = delay;
|
|
@@ -317,7 +316,9 @@ export class StatusDialog {
|
|
|
317
316
|
? truncateToWidth(metrics, width, "")
|
|
318
317
|
: (() => {
|
|
319
318
|
const left = truncateToWidth(identityLine, width - metricWidth - 1);
|
|
320
|
-
return
|
|
319
|
+
return (
|
|
320
|
+
left + " ".repeat(Math.max(1, width - visibleWidth(left) - metricWidth)) + metrics
|
|
321
|
+
);
|
|
321
322
|
})();
|
|
322
323
|
const second = truncateToWidth(
|
|
323
324
|
this.theme.fg(inactive ? base : selected ? "accent" : "muted", activity),
|
|
@@ -363,7 +364,9 @@ export class StatusDialog {
|
|
|
363
364
|
height,
|
|
364
365
|
this.heading(rows, start, treeCount),
|
|
365
366
|
body,
|
|
366
|
-
this.navigation
|
|
367
|
+
this.navigation
|
|
368
|
+
? "Esc main · ↑↓ select · ←→ fold · → widget · i Actions · Ctrl+C stop all"
|
|
369
|
+
: FOOTER,
|
|
367
370
|
);
|
|
368
371
|
}
|
|
369
372
|
|
package/src/ui/ui.ts
CHANGED
|
@@ -21,12 +21,7 @@ import {
|
|
|
21
21
|
truncateToWidth,
|
|
22
22
|
visibleWidth,
|
|
23
23
|
} from "@earendil-works/pi-tui";
|
|
24
|
-
import {
|
|
25
|
-
AGENT_COLORS,
|
|
26
|
-
ConfigStore,
|
|
27
|
-
parseAgentType,
|
|
28
|
-
serializeAgentType,
|
|
29
|
-
} from "../prefs/config.ts";
|
|
24
|
+
import { AGENT_COLORS, ConfigStore, parseAgentType, serializeAgentType } from "../prefs/config.ts";
|
|
30
25
|
import { editModelPreferences, MODEL_EDITOR_CANCEL } from "./model-picker.ts";
|
|
31
26
|
import { editToolSelection, TOOL_EDITOR_CANCEL, type ToolEditorOptions } from "./tool-picker.ts";
|
|
32
27
|
import {
|
|
@@ -43,7 +38,13 @@ import type { LoaderStyle, WidgetMode } from "../prefs/settings.ts";
|
|
|
43
38
|
import { AGENT_PROGRESS_INTERVAL, agentProgressIcon, isAgentLoaderGlyph } from "./agent-loader.ts";
|
|
44
39
|
export { AGENT_PROGRESS_INTERVAL, agentProgressIcon } from "./agent-loader.ts";
|
|
45
40
|
import { buildStatusTree, lastStarted, threadActivity, type StatusRow } from "./thread-tree.ts";
|
|
46
|
-
import {
|
|
41
|
+
import {
|
|
42
|
+
THINKING_LEVELS,
|
|
43
|
+
type AgentType,
|
|
44
|
+
type ResolvedAgentSettings,
|
|
45
|
+
type ThreadService,
|
|
46
|
+
type ThreadView,
|
|
47
|
+
} from "../types.ts";
|
|
47
48
|
|
|
48
49
|
export type ThreadController = Pick<
|
|
49
50
|
ThreadService,
|
|
@@ -423,7 +424,9 @@ export function renderAgentSummary(
|
|
|
423
424
|
return theme.fg(color, `${progress ? `${progress} ` : ""}${counts[state]} ${state}`);
|
|
424
425
|
})
|
|
425
426
|
.join(theme.fg("muted", ", ")) +
|
|
426
|
-
(showBrowserHint && counts.running > 0
|
|
427
|
+
(showBrowserHint && counts.running > 0
|
|
428
|
+
? theme.fg("muted", expandHint ? " · ← expand" : " · ← browser")
|
|
429
|
+
: "");
|
|
427
430
|
const right = theme.fg("muted", `↑${formatCount(input)} ↓${formatCount(output)}`);
|
|
428
431
|
return [fitLine(left, right, Math.max(0, width))];
|
|
429
432
|
}
|
|
@@ -1025,11 +1028,27 @@ function editMenuLabel(action: EditMenuAction, draft: AgentType): string {
|
|
|
1025
1028
|
}
|
|
1026
1029
|
}
|
|
1027
1030
|
|
|
1031
|
+
export interface AgentEditorOptions extends ToolEditorOptions {
|
|
1032
|
+
/** The runtime resolver used by agent_types, for children of this session's root. */
|
|
1033
|
+
resolveAgentSettings?: (type: AgentType) => ResolvedAgentSettings;
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
function effectiveModelLine(type: AgentType, options: AgentEditorOptions): string {
|
|
1037
|
+
try {
|
|
1038
|
+
const settings = options.resolveAgentSettings?.(type);
|
|
1039
|
+
return settings
|
|
1040
|
+
? `Model: ${settings.model} · thinking: ${settings.thinkingLevel}`
|
|
1041
|
+
: "Model: unavailable";
|
|
1042
|
+
} catch {
|
|
1043
|
+
return "Model: unavailable";
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
|
|
1028
1047
|
export async function editAgentTypes(
|
|
1029
1048
|
ctx: ExtensionCommandContext,
|
|
1030
1049
|
store: ConfigStore,
|
|
1031
1050
|
nerdFontIcons = false,
|
|
1032
|
-
toolEditor:
|
|
1051
|
+
toolEditor: AgentEditorOptions = { getAllTools: () => [], toolFiltering: "allowed" },
|
|
1033
1052
|
): Promise<void> {
|
|
1034
1053
|
if (!canOpenDialog(ctx)) return;
|
|
1035
1054
|
await withDialogSession(ctx, (scoped) =>
|
|
@@ -1039,12 +1058,10 @@ export async function editAgentTypes(
|
|
|
1039
1058
|
|
|
1040
1059
|
function agentSourceHelp(store: ConfigStore, name: string): string {
|
|
1041
1060
|
const layers = store.getLayers(name);
|
|
1042
|
-
const paths = layers
|
|
1043
|
-
`${layer.source ?? "user"} · ${layer.filePath ?? ""}
|
|
1044
|
-
|
|
1045
|
-
return layers.length > 1
|
|
1046
|
-
? `${layers.map((layer) => layer.source).join(" → ")}\n${paths}`
|
|
1047
|
-
: paths;
|
|
1061
|
+
const paths = layers
|
|
1062
|
+
.map((layer) => `${layer.source ?? "user"} · ${layer.filePath ?? ""}`)
|
|
1063
|
+
.join("\n");
|
|
1064
|
+
return layers.length > 1 ? `${layers.map((layer) => layer.source).join(" → ")}\n${paths}` : paths;
|
|
1048
1065
|
}
|
|
1049
1066
|
|
|
1050
1067
|
function agentSettingsIndicators(
|
|
@@ -1056,30 +1073,33 @@ function agentSettingsIndicators(
|
|
|
1056
1073
|
const settings = store.getSettingsOverride(name, scope);
|
|
1057
1074
|
if (!settings) return false;
|
|
1058
1075
|
if (action === "tools.allow" || action === "tools.block") {
|
|
1059
|
-
return
|
|
1060
|
-
|
|
1076
|
+
return (
|
|
1077
|
+
Object.hasOwn(settings, "tools") &&
|
|
1078
|
+
(settings.tools === null || Object.hasOwn(settings.tools ?? {}, action.split(".")[1]!))
|
|
1079
|
+
);
|
|
1061
1080
|
}
|
|
1062
1081
|
return Object.hasOwn(settings, action);
|
|
1063
1082
|
};
|
|
1064
1083
|
const global = hasKey("user");
|
|
1065
1084
|
const project = hasKey("project");
|
|
1066
1085
|
return (theme) =>
|
|
1067
|
-
(global ? theme.fg("accent", "●") : " ") + " " +
|
|
1068
|
-
(project ? theme.fg("warning", "●") : " ");
|
|
1086
|
+
(global ? theme.fg("accent", "●") : " ") + " " + (project ? theme.fg("warning", "●") : " ");
|
|
1069
1087
|
}
|
|
1070
1088
|
|
|
1071
1089
|
function agentSettingsLegend(theme: Theme): string {
|
|
1072
1090
|
const global = theme.fg("accent", "●");
|
|
1073
1091
|
const project = theme.fg("warning", "●");
|
|
1074
|
-
return
|
|
1075
|
-
|
|
1092
|
+
return (
|
|
1093
|
+
theme.fg("muted", "Saved: ") +
|
|
1094
|
+
`${global} Global · ${project} Current Project · ${global} ${project} Both`
|
|
1095
|
+
);
|
|
1076
1096
|
}
|
|
1077
1097
|
|
|
1078
1098
|
async function editAgentTypesDialog(
|
|
1079
1099
|
ctx: ExtensionCommandContext,
|
|
1080
1100
|
store: ConfigStore,
|
|
1081
1101
|
nerdFontIcons: boolean,
|
|
1082
|
-
toolEditor:
|
|
1102
|
+
toolEditor: AgentEditorOptions,
|
|
1083
1103
|
): Promise<void> {
|
|
1084
1104
|
while (true) {
|
|
1085
1105
|
const types = store.list();
|
|
@@ -1096,6 +1116,7 @@ async function editAgentTypesDialog(
|
|
|
1096
1116
|
renderLabel: (label: string, theme: Theme) =>
|
|
1097
1117
|
agentTypeBadge(label, type.color, theme, type.icon, nerdFontIcons),
|
|
1098
1118
|
value: type.description,
|
|
1119
|
+
valueDetail: effectiveModelLine(type, toolEditor),
|
|
1099
1120
|
help: agentSourceHelp(store, type.name),
|
|
1100
1121
|
})),
|
|
1101
1122
|
]);
|
|
@@ -1133,9 +1154,10 @@ async function editAgentTypesDialog(
|
|
|
1133
1154
|
return {
|
|
1134
1155
|
id: action,
|
|
1135
1156
|
label: EDIT_FIELD_LABELS[action],
|
|
1136
|
-
renderIndicators:
|
|
1137
|
-
|
|
1138
|
-
|
|
1157
|
+
renderIndicators:
|
|
1158
|
+
editMode === "override" && original
|
|
1159
|
+
? agentSettingsIndicators(store, original.name, action)
|
|
1160
|
+
: undefined,
|
|
1139
1161
|
valueColor: action === "Save" && dirty ? ("warning" as const) : undefined,
|
|
1140
1162
|
value:
|
|
1141
1163
|
action === "Customization"
|
|
@@ -1144,7 +1166,10 @@ async function editAgentTypesDialog(
|
|
|
1144
1166
|
? "(changes)"
|
|
1145
1167
|
: action === "Source"
|
|
1146
1168
|
? original
|
|
1147
|
-
? store
|
|
1169
|
+
? store
|
|
1170
|
+
.getLayers(original.name)
|
|
1171
|
+
.map((layer) => layer.source)
|
|
1172
|
+
.join(" → ")
|
|
1148
1173
|
: "New draft"
|
|
1149
1174
|
: action === "Save scope"
|
|
1150
1175
|
? saveScope === "user"
|