pi-subagent-manager 1.1.0 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-subagent-manager",
3
- "version": "1.1.0",
3
+ "version": "1.2.0",
4
4
  "description": "Hierarchical, steerable subagent threads for pi",
5
5
  "type": "module",
6
6
  "engines": {
package/src/index.ts CHANGED
@@ -835,6 +835,7 @@ export default function piSubagent(pi: ExtensionAPI): void {
835
835
  await editAgentTypes(ctx, store, limits.nerdFontIcons, {
836
836
  getAllTools: () => pi.getAllTools(),
837
837
  toolFiltering: limits.toolFiltering,
838
+ resolveAgentSettings: (type) => driverFactory.resolveAgentSettings(type, "/root"),
838
839
  });
839
840
  store.reload();
840
841
  } else if (command === "reload") {
@@ -857,6 +858,7 @@ export default function piSubagent(pi: ExtensionAPI): void {
857
858
  agentDir: getAgentDir(),
858
859
  getAllTools: () => pi.getAllTools(),
859
860
  checklistStatus: () => currentChecklistStatus(ctx),
861
+ resolveAgentSettings: (type) => driverFactory.resolveAgentSettings(type, "/root"),
860
862
  apply: () => {
861
863
  const diagnostics = loadLimits(ctx);
862
864
  requireManager().setLimits(limits);
package/src/ui/dialog.ts CHANGED
@@ -36,6 +36,8 @@ export interface DialogRow {
36
36
  /** Trusted formatter for a fixed three-cell middle column, styled at render time. */
37
37
  renderIndicators?: (theme: Theme) => string;
38
38
  value?: string;
39
+ /** Optional second line beneath the value, clipped to the same column. */
40
+ valueDetail?: string;
39
41
  valueColor?: Parameters<Theme["fg"]>[0];
40
42
  help?: string;
41
43
  }
@@ -239,7 +241,8 @@ export class DialogMenu {
239
241
  .split(/\r\n?|\n/)
240
242
  .flatMap((line) => wrapTextWithAnsi(dialogText(line), Math.max(1, inner - 1)))
241
243
  .slice(0, Math.max(1, height - 7 - legend.length));
242
- this.viewport = Math.max(1, height - 6 - help.length - legend.length);
244
+ const rowHeight = this.rows.some((row) => row.valueDetail !== undefined) ? 2 : 1;
245
+ this.viewport = Math.max(1, Math.floor((height - 6 - help.length - legend.length) / rowHeight));
243
246
  const start = Math.max(
244
247
  0,
245
248
  Math.min(
@@ -260,7 +263,7 @@ export class DialogMenu {
260
263
  "dim",
261
264
  ` ${this.rows.length ? this.selected + 1 : 0}/${this.rows.length} · Field / ${hasIndicators ? "Saved / " : ""}Value`,
262
265
  ),
263
- ...this.rows.slice(start, start + this.viewport).map((row, i) => {
266
+ ...this.rows.slice(start, start + this.viewport).flatMap((row, i) => {
264
267
  const selected = start + i === this.selected;
265
268
  const color = (text: string) => selected ? this.theme.fg("accent", text) : text;
266
269
  const plainLabel = dialogText(row.label);
@@ -274,11 +277,15 @@ export class DialogMenu {
274
277
  const indicators = truncateToWidth(row.renderIndicators?.(this.theme) ?? "", indicatorWidth, "", true);
275
278
  const indicatorPadding = " ".repeat(Math.max(0, indicatorWidth - visibleWidth(indicators)));
276
279
  const value = dialogText(row.value ?? "");
277
- return color(`${selected ? "›" : " "} `)
280
+ const primary = color(`${selected ? "›" : " "} `)
278
281
  + (row.renderLabel ? label : color(label))
279
282
  + color(`${padding} │ `)
280
283
  + (hasIndicators ? indicators + color(`${indicatorPadding} │ `) : "")
281
284
  + (row.valueColor ? this.theme.fg(row.valueColor, value) : color(value));
285
+ if (rowHeight === 1) return [primary];
286
+ const valueStart = 2 + labelWidth + 3 + (hasIndicators ? indicatorWidth + 3 : 0);
287
+ const detail = truncateToWidth(dialogText(row.valueDetail ?? ""), Math.max(0, inner - valueStart));
288
+ return [primary, " ".repeat(valueStart) + this.theme.fg("muted", detail)];
282
289
  }),
283
290
  "",
284
291
  ...help.map((line) => this.theme.fg("muted", ` ${line}`)),
@@ -29,7 +29,7 @@ import {
29
29
  type ToolFilteringMode,
30
30
  type WidgetMode,
31
31
  } from "../prefs/settings.ts";
32
- import { editAgentTypes } from "./ui.ts";
32
+ import { editAgentTypes, type AgentEditorOptions } from "./ui.ts";
33
33
  import { HOUSEKEEPING_PICKER_CANCEL, pickHousekeepingModel } from "./model-picker.ts";
34
34
  import type { ToolEditorOptions } from "./tool-picker.ts";
35
35
  import { AGENT_LOADERS, availableLoaderStyles, effectiveLoaderStyle } from "./agent-loader.ts";
@@ -331,6 +331,7 @@ export async function configureAgents(
331
331
  settings: ManagerSettings;
332
332
  agentDir: string;
333
333
  getAllTools?: ToolEditorOptions["getAllTools"];
334
+ resolveAgentSettings?: AgentEditorOptions["resolveAgentSettings"];
334
335
  /** Live pi-checklist eligibility; absent means unavailable (fail closed). */
335
336
  checklistStatus?: () => ChecklistStatus;
336
337
  apply(): void;
@@ -368,6 +369,7 @@ async function configureAgentsDialog(
368
369
  settings: ManagerSettings;
369
370
  agentDir: string;
370
371
  getAllTools?: ToolEditorOptions["getAllTools"];
372
+ resolveAgentSettings?: AgentEditorOptions["resolveAgentSettings"];
371
373
  /** Live pi-checklist eligibility; absent means unavailable (fail closed). */
372
374
  checklistStatus?: () => ChecklistStatus;
373
375
  apply(): void;
@@ -651,6 +653,7 @@ async function configureAgentsDialog(
651
653
  await editAgentTypes(ctx, options.store, draft.nerdFontIcons, {
652
654
  getAllTools: options.getAllTools ?? (() => []),
653
655
  toolFiltering: draft.toolFiltering,
656
+ resolveAgentSettings: options.resolveAgentSettings,
654
657
  });
655
658
  options.store.reload();
656
659
  } else if (action === "save") {
package/src/ui/ui.ts CHANGED
@@ -43,7 +43,7 @@ import type { LoaderStyle, WidgetMode } from "../prefs/settings.ts";
43
43
  import { AGENT_PROGRESS_INTERVAL, agentProgressIcon, isAgentLoaderGlyph } from "./agent-loader.ts";
44
44
  export { AGENT_PROGRESS_INTERVAL, agentProgressIcon } from "./agent-loader.ts";
45
45
  import { buildStatusTree, lastStarted, threadActivity, type StatusRow } from "./thread-tree.ts";
46
- import { THINKING_LEVELS, type AgentType, type ThreadService, type ThreadView } from "../types.ts";
46
+ import { THINKING_LEVELS, type AgentType, type ResolvedAgentSettings, type ThreadService, type ThreadView } from "../types.ts";
47
47
 
48
48
  export type ThreadController = Pick<
49
49
  ThreadService,
@@ -1025,11 +1025,27 @@ function editMenuLabel(action: EditMenuAction, draft: AgentType): string {
1025
1025
  }
1026
1026
  }
1027
1027
 
1028
+ export interface AgentEditorOptions extends ToolEditorOptions {
1029
+ /** The runtime resolver used by agent_types, for children of this session's root. */
1030
+ resolveAgentSettings?: (type: AgentType) => ResolvedAgentSettings;
1031
+ }
1032
+
1033
+ function effectiveModelLine(type: AgentType, options: AgentEditorOptions): string {
1034
+ try {
1035
+ const settings = options.resolveAgentSettings?.(type);
1036
+ return settings
1037
+ ? `Model: ${settings.model} · thinking: ${settings.thinkingLevel}`
1038
+ : "Model: unavailable";
1039
+ } catch {
1040
+ return "Model: unavailable";
1041
+ }
1042
+ }
1043
+
1028
1044
  export async function editAgentTypes(
1029
1045
  ctx: ExtensionCommandContext,
1030
1046
  store: ConfigStore,
1031
1047
  nerdFontIcons = false,
1032
- toolEditor: ToolEditorOptions = { getAllTools: () => [], toolFiltering: "allowed" },
1048
+ toolEditor: AgentEditorOptions = { getAllTools: () => [], toolFiltering: "allowed" },
1033
1049
  ): Promise<void> {
1034
1050
  if (!canOpenDialog(ctx)) return;
1035
1051
  await withDialogSession(ctx, (scoped) =>
@@ -1079,7 +1095,7 @@ async function editAgentTypesDialog(
1079
1095
  ctx: ExtensionCommandContext,
1080
1096
  store: ConfigStore,
1081
1097
  nerdFontIcons: boolean,
1082
- toolEditor: ToolEditorOptions,
1098
+ toolEditor: AgentEditorOptions,
1083
1099
  ): Promise<void> {
1084
1100
  while (true) {
1085
1101
  const types = store.list();
@@ -1096,6 +1112,7 @@ async function editAgentTypesDialog(
1096
1112
  renderLabel: (label: string, theme: Theme) =>
1097
1113
  agentTypeBadge(label, type.color, theme, type.icon, nerdFontIcons),
1098
1114
  value: type.description,
1115
+ valueDetail: effectiveModelLine(type, toolEditor),
1099
1116
  help: agentSourceHelp(store, type.name),
1100
1117
  })),
1101
1118
  ]);