@ferris1225/pi-subagents 6.0.0 → 6.0.2

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 CHANGED
@@ -1,5 +1,68 @@
1
1
  # Changelog
2
2
 
3
+ ## 6.0.2
4
+
5
+ ### Fixes
6
+
7
+ - Simplify `/subagents-setup` into role, setting, and value lists with consistent
8
+ up/down navigation and one-level-back cancellation. Preserve focus and save
9
+ each confirmed change immediately.
10
+ - Prioritize visible model choices over repeated details, show readable model
11
+ names with providers, and distinguish saved settings from keyboard focus.
12
+ Explain following the main model versus choosing a fixed model explicitly.
13
+ - Preserve Unicode search, paste, paging, capability-aware thinking preferences,
14
+ and space for the workflow required-acceptance row on short terminals.
15
+
16
+ ## 6.0.1
17
+
18
+ ### Fixes
19
+
20
+ - Resolve the child working directory before launching or updating its private
21
+ session header, preserving fallback and follow-ups through macOS path aliases
22
+ and Windows junctions without a cross-project fork prompt.
23
+ - Require Pi SDK 1.4.0 and preserve callable codemode/deferred tools in child
24
+ sessions, including approved read-only tools that register after startup.
25
+ Keep delegation controls model-only and invoke them outside codemode.
26
+ - Add workflow and completed-run follow-up waiting; default all dispatches to
27
+ waiting in one-shot print/JSON sessions. Return final evidence exactly once
28
+ after integration and acceptance, mark awaited failures as tool errors, and
29
+ cancel unfinished work without background wake-ups.
30
+ - Display child RPC steering acknowledgements in the tool card and status,
31
+ including request ID and queued/handled/unknown queue disposition. Distinguish
32
+ receipt from model execution instead of showing only a generic success mark.
33
+ - Cancel unattended RPC input dialogs with an explicit response, preventing
34
+ invisible confirmation or input requests from hanging child execution.
35
+ - Clarify that launch receipts are not task completion and that main resumes
36
+ from child evidence to finish fixes and final checks. Correct interrupted-run
37
+ retirement examples, equal-task ownership guidance, and completed-run
38
+ follow-up recommendations. Reuse the completion waiter across dispatch paths.
39
+ - Deliver unexpected workflow failures through the same final-summary route.
40
+ - Retry brief Windows permission/sharing errors during atomic manifest
41
+ replacement under the existing writer lock, preserving the last checkpoint
42
+ and propagating persistent errors without an unlink/copy fallback.
43
+
44
+ - Contain synchronous Windows process-termination errors and child spawn
45
+ failures with missing stdio, preventing resource errors such as `ENOMEM`,
46
+ `EMFILE`, and `ENFILE` from escaping into the parent Pi process.
47
+ - Default completed-run follow-ups to `context: "auto"`: reuse retained history
48
+ when available, otherwise dispatch with a bounded summary and report the
49
+ fallback. Keep explicit `session` strict, expose available follow-up context
50
+ in status, and give interrupted runs actionable recovery guidance.
51
+ - Bind private session copies to the next run's cwd so follow-ups survive
52
+ removal of an earlier worktree. Preserve the session ID and prior entries,
53
+ and remind continued agents to re-read changed files.
54
+ - Preserve recovery artifacts when manifests or path validation cannot be read.
55
+ Protect live owners during empty-session, age, budget and project cleanup.
56
+ Prune expired checkpoints before restore, keep checkpoints with live owners
57
+ or children, and retain validated paths when a session file is unavailable.
58
+ Recovery inspection errors warn without skipping progress-widget setup.
59
+ - Recheck cancellation and source state before follow-up dispatch, and handle
60
+ a retained transcript disappearing during copying without duplicate launches.
61
+ - Drain settlement-triggered cleanup during shutdown and stop launching new
62
+ sweeps once shutdown begins, avoiding filesystem activity after teardown.
63
+ - Correct the documented five-minute minimum retention under budget pressure
64
+ and distinguish automatic reclamation from explicit storage cleanup.
65
+
3
66
  ## 6.0.0
4
67
 
5
68
  ### Breaking changes
package/README.md CHANGED
@@ -5,21 +5,28 @@ dependency workflows, and Git worktree isolation.
5
5
 
6
6
  ## Install
7
7
 
8
- Requires **Pi >= 1.0.0** and **Node.js >= 22.19.0**.
8
+ Requires **Pi >= 1.4.0** and **Node.js >= 22.19.0**. Development and native
9
+ integration tests use the Pi 1.4.0 SDK.
9
10
 
10
11
  ```bash
11
12
  pi install npm:@ferris1225/pi-subagents
12
13
  ```
13
14
 
14
- Run `/subagents-setup` for a role selector and focused settings editor. Wide
15
- terminals place them side by side; narrow terminals stack them. ↑/↓ changes the
16
- role, ←/→ selects **Model**, **Thinking**, or **Reset**, and Enter edits it.
17
- The selected role shows its full model reference, effective reasoning level,
18
- requested level when clamped, and default/override source. Each selection saves
19
- immediately; Esc returns without applying a picker selection and keeps focus.
20
- Model pickers support search, paste, and paging. On short terminals, PgUp/PgDn
21
- scrolls the settings while the selected role and field stay pinned. Setup
22
- reserves space for the workflow's required-acceptance row.
15
+ Run `/subagents-setup`, choose a role, then choose **Model**, **Thinking**, or
16
+ **Reset defaults**. Every screen uses ↑/↓ and Enter; Esc goes back one level
17
+ without applying an unconfirmed choice. Selections save immediately and return
18
+ to the same setting; returning to the role list keeps that role selected.
19
+
20
+ Model and thinking choices support search, Unicode paste, and PgUp/PgDn paging.
21
+ Models show their friendly name and provider; search also matches exact model
22
+ references and capabilities. **[saved]** marks the stored selection independently
23
+ of the navigation cursor. **Follow main (dynamic)** tracks the main window's
24
+ model, including future changes; choosing a specific model pins that reference,
25
+ even when it currently matches main. Tab toggles complete details (including
26
+ exact references); ↑/↓ and PgUp/PgDn scroll them. Tab or Esc returns from details
27
+ to the list, keeping the search and cursor.
28
+ The list takes priority over details on short terminals. Setup reserves space
29
+ for the workflow identity and required-acceptance row.
23
30
 
24
31
  All roles follow the main model by default; thinking defaults to `low` for scout
25
32
  and `high` for artisan, sentinel, and skeptic. The panel distinguishes defaults from overrides and
@@ -113,10 +120,21 @@ subagent({
113
120
  });
114
121
  ```
115
122
 
116
- Results arrive automatically. Set `wait: true` to return them in the tool call,
117
- including in one-shot `pi -p` sessions. Use stable `phaseId` values: completed
118
- phases stay owned for the parent session, and interrupted phases retain ownership
119
- across reloads. Repeating the same task in the same cwd is also rejected.
123
+ Use `wait: true` when the next step needs the result. `subagent`,
124
+ `subagent_workflow`, and completed-run `subagent_message` follow-ups default to
125
+ waiting in one-shot `pi -p` / JSON sessions, so the parent stays alive until the
126
+ work finishes. TUI and RPC sessions default to background delivery; `wait: false`
127
+ explicitly selects it in any mode. Each result is delivered once, after
128
+ integration, either in the waiting tool call or as a background completion.
129
+ Awaited failures are tool errors with retained evidence.
130
+
131
+ A launch receipt only confirms delegation. Main continues independent work or
132
+ pauses until the completion wakes it, then finishes the requested outcome and
133
+ final checks. It does not poll or treat a successful launch as task completion.
134
+ Use stable `phaseId` values: completed phases stay owned for the parent session,
135
+ and interrupted phases retain ownership across reloads. Equal normalized tasks
136
+ in the same cwd are also rejected, even with a different `phaseId`. Reuse the
137
+ result, or use `subagent_message` for an additional bounded step.
120
138
 
121
139
  Ownership includes main, individual runs, and workflow nodes still waiting on
122
140
  dependencies. Main continues only disjoint work and passes its completed research
@@ -151,6 +169,7 @@ so no separate workflow skill needs to be loaded.
151
169
  subagent_workflow({
152
170
  workflow: "code-review",
153
171
  inputs: { TARGET: "HEAD~1..HEAD; inspect the cache invalidation fix" },
172
+ wait: true,
154
173
  });
155
174
 
156
175
  subagent_workflow({
@@ -200,8 +219,10 @@ The final answer must end with `WORKFLOW_ACCEPTANCE: PASS` or
200
219
  fails the workflow even when the reviewer process exits normally. A PASS cannot
201
220
  clear failures in earlier work. Explicit cancellation or session interruption
202
221
  stops the graph without starting acceptance. The graph sends one final summary
203
- containing its acceptance result; main still owns remediation, the final gate,
204
- and release.
222
+ containing its acceptance result, or returns it in the tool call with `wait: true`.
223
+ Waiting includes integration and acceptance, streams progress, and stops owned
224
+ work on parent cancellation without a background wake-up. Main still owns
225
+ remediation, the final gate, and release.
205
226
 
206
227
  Phase identity includes the built-in plan and its inputs. The same deliverable
207
228
  remains owned within its workspace; different questions or targets can run in
@@ -213,7 +234,7 @@ the same session. Inspect retained results instead of repeating completed work.
213
234
  | --- | --- |
214
235
  | `subagent_status({ id: 12 })` | Inspect a run's progress, result, and recovery paths |
215
236
  | `subagent_status({ workflow: 3 })` | Inspect graph nodes and dependencies |
216
- | `subagent_message({ id: 12, message: "Check the caller too" })` | Steer a running child, or start a follow-up from its completed session |
237
+ | `subagent_message({ id: 12, message: "Check the caller too" })` | Steer a running child, or continue a completed run using its session when available and a summary otherwise |
217
238
  | `subagent_message({ id: 12, message: "Add the test", context: "summary" })` | Start a new next step with only a bounded summary of the earlier run |
218
239
  | `subagent_stop({ id: "12" })` | Stop a run and retire its retained session |
219
240
  | `subagent_stop({ workflow: 3 })` | Stop a graph and finalize its active nodes |
@@ -261,22 +282,42 @@ stops unfinished work. New/resume/fork/reload ends old children and retains inte
261
282
  for manual recovery. Runs do not resume automatically; main finishes incomplete
262
283
  work from partial changes and artifacts.
263
284
 
264
- A steering message is queued at the next Pi steering boundary; acknowledgement
265
- does not mean the child has acted on it. To continue a successfully completed
266
- run, choose the context that fits the follow-up:
267
-
268
- - `context: "session"` (default) for rework — revising, fixing or extending the
269
- same deliverable. It continues a private copy of the retained session, so the
270
- earlier reasoning stays available and the provider prompt-cache key
271
- (`sessionId`) is unchanged.
272
- - `context: "summary"` for a new next step — the new run never sees the old
273
- transcript and is briefed with the objective, the final result and the files
274
- the run touched. Cheaper, no cache reuse, and it cannot rely on detail the
275
- summary omits.
276
-
277
- Both start a new run with the role, workspace and scope preserved. Queueing,
278
- admission and isolation still apply. Pending runs cannot be steered, and fixed
279
- workflow graphs cannot be edited.
285
+ A steering call waits for the child's existing RPC channel to acknowledge the
286
+ matching request ID. The tool card shows **Received · queued** when Pi confirms
287
+ queueing, **Received · handled** when an input hook consumes the message, or
288
+ **Accepted · queue state unconfirmed** when no disposition is available.
289
+ `subagent_status` retains the latest acknowledgement, request ID, age, and message
290
+ summary. Rejection or a missing acknowledgement is an error, not a receipt.
291
+ Queueing delivers at a Pi steering boundary; it does not prove that the model
292
+ has executed the instruction.
293
+
294
+ To continue a successfully completed run, choose the context that fits the follow-up:
295
+
296
+ - `context: "auto"` (default) continues a private copy of the retained session
297
+ when available. If cleanup has removed it, the follow-up starts with a bounded
298
+ summary and explicitly reports that full history is unavailable. No retry is
299
+ needed for an expired session.
300
+ - `context: "session"` requires full history for rework that depends on earlier
301
+ details. If the session is unavailable, the call fails without starting a run.
302
+ - `context: "summary"` always starts fresh for a new next step, with the earlier
303
+ objective, final result and touched files. It cannot rely on omitted details
304
+ or reuse the earlier provider cache.
305
+
306
+ Session continuations retain the earlier history and provider prompt-cache key
307
+ (`sessionId`). Their private copy is bound to the new run's working directory,
308
+ including when a previous temporary worktree has already been removed. Child
309
+ startup and the copied session header use the same physical directory, so macOS
310
+ path aliases and Windows junctions do not trigger a cross-project fork prompt.
311
+ The continuation is instructed to re-read files before editing in the current cwd.
312
+
313
+ Every follow-up preserves the role, workspace and scope and passes through normal
314
+ admission and isolation. Set `wait: true` to receive its final result in the same
315
+ call; this waiting option applies to newly started follow-ups, while steering a
316
+ running child returns its acknowledgement. `subagent_status` reports whether a
317
+ completed run has a session available or only summary context. Results and summaries remain
318
+ available within the current parent runtime; completed runs are not restored
319
+ after reload. Pending runs cannot be steered, and fixed workflow graphs cannot
320
+ be edited.
280
321
 
281
322
  Children use Pi's native `--mode rpc` CLI with piped input/output, retries, and
282
323
  session persistence. On Windows, console hiding covers the Pi child and Node
@@ -287,29 +328,56 @@ explicit child extension installs the same policy for runtimes without Node
287
328
  preloading. Windows launches stay attached so detachment cannot open a console.
288
329
  On macOS and Linux, the policy leaves shell options unchanged; the Pi child uses
289
330
  a separate process group for cancellation and does not launch a terminal app.
290
- RPC communication and process-tree cancellation remain active. Commands that
291
- explicitly open a terminal or GUI control their own windows.
331
+ RPC communication and process-tree cancellation remain active. Child startup
332
+ errors are reported as failed runs. If Windows cannot launch `taskkill`,
333
+ termination falls back to killing the child directly. Commands that explicitly
334
+ open a terminal or GUI control their own windows.
292
335
  A settled provider failure can hand off once to the main model in the same
293
336
  session. State and full-result files live under
294
337
  `~/.pi/agent/ferris-pi-subagents/`, grouped by project. `PI_CODING_AGENT_DIR`
295
338
  overrides the agent directory.
296
339
 
340
+ ## Pi codemode compatibility
341
+
342
+ Call `subagent`, `subagent_workflow`, and the control tools directly. They use
343
+ Pi's `model-only` exposure and are intentionally unavailable as nested
344
+ `tools.subagent(...)` calls inside codemode. Children can still use codemode
345
+ with their inherited callable tools. Indirect tools retain their exposure;
346
+ scout promotes approved read-only tools for direct use. It waits up to ten
347
+ seconds for startup registration and activates later arrivals between turns.
348
+ Read-only classification uses Pi tool metadata.
349
+
350
+ Child RPC dialogs that require confirmation, selection, or text input are
351
+ cancelled with a matching response and an explanation, so an unattended child
352
+ does not hang waiting for an invisible dialog. No confirmation is approved
353
+ automatically.
354
+
297
355
  ## Storage and cleanup
298
356
 
299
357
  Each project root holds `sessions/`, `worktrees/`, `tmp/` and `results/`. Startup
300
358
  hygiene already drops temp leftovers, artifacts whose Pi process is gone, result
301
359
  files past their retention window, and project roots idle for three days. Parked
302
- recovery work and anything a manifest still references always survive.
360
+ recovery work and manifest references are protected during these sweeps.
361
+ Interrupted checkpoints expire after 30 days when no recorded owner or child
362
+ from the current boot is alive; expired checkpoints are pruned before restore.
363
+ Missing session files do not erase validated recovery paths. Unreadable or
364
+ malformed manifests leave artifacts intact and skip automatic reclamation;
365
+ explicit cleanup reports the error. Startup warns about failed recovery inspection
366
+ and continues initializing the progress widget.
303
367
 
304
368
  Reclamation is automatic: a settlement may trigger one paced sweep (at most every
305
369
  five minutes) that drops dead-owner artifacts, expired result files, and settled
306
370
  session copies older than 30 minutes, then trims the oldest settled sessions
307
- until a project fits its 1.5 GB budget. Live runs, parked recovery work, recent
308
- sessions, and anything a manifest references are never touched, so rework within
309
- the last half hour can still continue its session.
310
-
311
- `/subagents-cleanup` runs the same pass immediately and reports per-project usage
312
- and freed bytes; `/subagents-cleanup dry-run` measures without deleting anything.
371
+ until a project fits its 1.5 GB budget. Under budget pressure, settled sessions
372
+ older than five minutes can be removed. Live runs, parked recovery work, and
373
+ manifest references remain protected. Automatic follow-ups use the retained
374
+ summary when a completed run's transcript has expired. Session shutdown waits
375
+ for cleanup already in progress and prevents new settlement sweeps.
376
+
377
+ `/subagents-cleanup` immediately reclaims unclaimed dead-owner artifacts and idle
378
+ project roots, reporting usage and freed bytes. `/subagents-cleanup dry-run`
379
+ measures without deleting anything. Session age and budget reclamation runs
380
+ automatically on settlement.
313
381
 
314
382
  ## Development
315
383
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferris1225/pi-subagents",
3
- "version": "6.0.0",
3
+ "version": "6.0.2",
4
4
  "description": "A managed sub-agent team for pi: research, implementation, independent review, interactive follow-ups, and Git worktree isolation.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -40,9 +40,9 @@
40
40
  "prepack": "npm run check"
41
41
  },
42
42
  "peerDependencies": {
43
- "@earendil-works/pi-ai": ">=1.0.0",
44
- "@earendil-works/pi-coding-agent": ">=1.0.0",
45
- "@earendil-works/pi-tui": ">=1.0.0",
43
+ "@earendil-works/pi-ai": ">=1.4.0",
44
+ "@earendil-works/pi-coding-agent": ">=1.4.0",
45
+ "@earendil-works/pi-tui": ">=1.4.0",
46
46
  "typebox": "*"
47
47
  },
48
48
  "devDependencies": {
@@ -24,6 +24,7 @@ export interface ModelPickerItem {
24
24
  value: string;
25
25
  label: string;
26
26
  description?: string;
27
+ saved?: boolean;
27
28
  }
28
29
 
29
30
  export type ModelListEntry = Pick<
@@ -199,19 +200,23 @@ export function buildModelPickerItems(options: {
199
200
 
200
201
  const dynamic: ModelPickerItem = {
201
202
  value: CURRENT_MAIN_MODEL,
202
- label: "Current main model (dynamic)",
203
- description: "Clear agent override; use the current main model dynamically",
203
+ label: "Follow main (dynamic)",
204
+ description: "Uses the main window's model, including future changes. Now: " + (mainRef ?? "Pi default") + ". No model is pinned.",
205
+ saved: !configuredRef,
204
206
  };
205
207
  const items: ModelPickerItem[] = [dynamic];
206
208
  for (const ref of refs) {
207
209
  const model = byRef.get(ref)!;
208
210
  const tags = [ref === liveConfiguredRef ? "configured" : "", ref === mainRef ? "current main" : ""]
209
211
  .filter(Boolean);
210
- const name = model.name.trim() && model.name !== model.id ? model.name.trim() : undefined;
212
+ const name = model.name.trim() || model.id;
213
+ const duplicateName = [...byRef.values()].some((other) =>
214
+ other.id !== model.id && other.provider === model.provider && (other.name.trim() || other.id) === name);
211
215
  items.push({
212
216
  value: ref,
213
- label: ref,
214
- description: [name, modelCapabilities(model), ...tags].filter(Boolean).join(" · "),
217
+ label: name + " · " + model.provider + (duplicateName ? " (" + model.id + ")" : ""),
218
+ description: ["Reference: " + ref, "Pins this model; falls back to main if unavailable or it fails.", modelCapabilities(model), ...tags].join(" · "),
219
+ saved: ref === liveConfiguredRef,
215
220
  });
216
221
  }
217
222
  return items;
@@ -24,7 +24,7 @@ import {
24
24
  resolveThinkingLevel,
25
25
  supportedThinkingLevels,
26
26
  } from "./models.ts";
27
- import { promptRoleGrid, promptSelectOne, type RoleGridFocus, type RoleGridRow } from "./ui.ts";
27
+ import { promptMenu, promptSelectOne, type SetupItem } from "./ui.ts";
28
28
 
29
29
  const ROLE_DEFAULT = "__role_default__";
30
30
  const THINKING_LEVEL_HINTS: Record<ThinkingLevel, string> = {
@@ -50,29 +50,38 @@ function roleModel(ctx: ExtensionContext, config: SubagentsConfig, name: string)
50
50
  return findModelByRef(availableModelsInScope(ctx), config.agentModels[name]) ?? ctx.model;
51
51
  }
52
52
 
53
- /** One row per role: every model and thinking choice stays visible together. */
54
- function roleRows(ctx: ExtensionContext, config: SubagentsConfig): RoleGridRow[] {
55
- const mainRef = currentModelRef(ctx) ?? "Pi default";
56
- const models = availableModelsInScope(ctx);
53
+ const ROLE_PURPOSE: Record<string, string> = {
54
+ scout: "Research with citations",
55
+ artisan: "Implement and verify",
56
+ sentinel: "Review implementation",
57
+ skeptic: "Challenge a named claim",
58
+ };
59
+
60
+ function roleSettings(ctx: ExtensionContext, config: SubagentsConfig, name: string): SetupItem[] {
61
+ const selected = config.agentModels[name];
62
+ const model = findModelByRef(availableModelsInScope(ctx), selected);
63
+ const modelLabel = selected
64
+ ? model ? model.name + " · " + model.provider : selected + " (unavailable)"
65
+ : "Follow main (dynamic)";
66
+ const preferred = config.agentThinkingLevels[name] ?? roleThinkingLevel(name);
67
+ const effective = resolveThinkingLevel(model ?? ctx.model, preferred);
68
+ const source = config.agentThinkingLevels[name] ? "override" : "role default";
69
+ const thinking = effective + (effective !== preferred ? " (" + preferred + " requested)" : "") + " · " + source;
70
+ return [
71
+ { value: "model", label: "Model: " + modelLabel, description: selected
72
+ ? "Pinned reference: " + selected + (model ? ". Falls back to main if it fails." : ". Unavailable; using main.")
73
+ : "Follows the main window's model, including future changes. Now: " + (currentModelRef(ctx) ?? "Pi default") + ". Choose a specific model to pin it." },
74
+ { value: "thinking", label: "Thinking: " + thinking,
75
+ description: "Reasoning effort: " + thinking + ". Role default: " + roleThinkingLevel(name) + ". Model capabilities limit the effective level; your saved preference is kept when changing models." },
76
+ { value: "reset", label: "Reset defaults", description: "Restore only " + name + " to Follow main and role-default thinking (" + roleThinkingLevel(name) + "). Saves immediately." },
77
+ ];
78
+ }
79
+
80
+ function roleItems(ctx: ExtensionContext, config: SubagentsConfig): SetupItem[] {
57
81
  return BUILTIN_AGENT_NAMES.map((name) => {
58
- const profile = agentProfile(name)!;
59
- const selected = config.agentModels[name];
60
- const model = findModelByRef(models, selected);
61
- const available = !selected || Boolean(model);
62
- const preferred = config.agentThinkingLevels[name] ?? roleThinkingLevel(name);
63
- const effective = resolveThinkingLevel(model ?? ctx.model, preferred);
64
- const clamped = effective !== preferred ? " (" + preferred + " requested)" : "";
65
- const overridden = Boolean(config.agentThinkingLevels[name]);
66
- return {
67
- role: name,
68
- thinkingOverridden: overridden,
69
- model: selected ? selected + (available ? "" : " (unavailable)") : "Follow main",
70
- thinking: effective + clamped,
71
- description: profile.remark + " Model: " + (selected
72
- ? (available ? "falls back to main if it fails." : "unavailable; using main.")
73
- : "follows main (" + mainRef + ") dynamically.")
74
- + " Thinking: role default " + roleThinkingLevel(name) + ", clamped to the model-supported levels. Reset restores " + name + " to Follow main and that default. * marks an override.",
75
- };
82
+ const settings = roleSettings(ctx, config, name);
83
+ return { value: name, label: name + " · " + ROLE_PURPOSE[name],
84
+ description: settings[0]!.label + "\n" + settings[1]!.label + "\n" + agentProfile(name)!.remark };
76
85
  });
77
86
  }
78
87
  async function editSetting(
@@ -90,7 +99,7 @@ async function editSetting(
90
99
  delete next.agentThinkingLevels[name];
91
100
  } else if (field === "model") {
92
101
  const choice = await promptSelectOne(ctx, name + " · Model",
93
- "Search provider, model, or capability · Esc back without changes",
102
+ "Follow main = dynamic · Others = pinned",
94
103
  buildModelPickerItems({ models: availableModelsInScope(ctx), configuredRef: config.agentModels[name], mainRef: currentModelRef(ctx) }),
95
104
  config.agentModels[name] ?? CURRENT_MAIN_MODEL);
96
105
  if (choice === undefined) return undefined;
@@ -109,9 +118,13 @@ async function editSetting(
109
118
  ...supported.map((level) => ({ value: level, label: level, description: THINKING_LEVEL_HINTS[level] })),
110
119
  ];
111
120
  const current = config.agentThinkingLevels[name];
121
+ if (current && !supported.includes(current)) {
122
+ options.push({ value: current, label: current + " (runs as " + resolveThinkingLevel(model, current) + ")",
123
+ description: "Saved preference; this model clamps it. Keep it for other models, or choose a supported level." });
124
+ }
112
125
  const choice = await promptSelectOne(ctx, name + " · Thinking",
113
- "Choose reasoning effort · Role default follows model capabilities · Esc back",
114
- options, current && supported.includes(current) ? current : ROLE_DEFAULT);
126
+ "Reasoning effort · saved preferences survive model changes",
127
+ options, current ?? ROLE_DEFAULT);
115
128
  if (choice === undefined) return undefined;
116
129
  if (choice === ROLE_DEFAULT) delete next.agentThinkingLevels[name];
117
130
  else next.agentThinkingLevels[name] = choice as ThinkingLevel;
@@ -130,17 +143,23 @@ export async function runSetup(ctx: ExtensionContext, configPath: string = getCo
130
143
  }
131
144
  try {
132
145
  let config = await loadConfig(configPath);
133
- let focus: RoleGridFocus = {};
146
+ let roleFocus: string | undefined;
147
+ const settingFocus: Record<string, string> = {};
134
148
  let status = "Changes save immediately";
135
149
  while (true) {
136
- const choice = await promptRoleGrid(ctx, roleRows(ctx, config), focus, status);
137
- if (choice === undefined) return;
138
- focus = { row: choice.row, column: choice.column };
139
- const next = await editSetting(ctx, config, choice.role, choice.field);
140
- if (!next) continue;
141
- await saveConfig(next, configPath);
142
- config = next;
143
- status = "Saved " + choice.role + (choice.field === "reset" ? " defaults" : " " + choice.field);
150
+ const name = await promptMenu(ctx, "Subagents · Roles", status === "Changes save immediately" ? "Choose a role · " + status : status, roleItems(ctx, config), roleFocus);
151
+ if (name === undefined) return;
152
+ roleFocus = name;
153
+ while (true) {
154
+ const field = await promptMenu(ctx, name + " · Settings", status === "Changes save immediately" ? "Choose a setting · " + status : status, roleSettings(ctx, config, name), settingFocus[name]);
155
+ if (field === undefined) break;
156
+ settingFocus[name] = field;
157
+ const next = await editSetting(ctx, config, name, field);
158
+ if (!next) continue;
159
+ await saveConfig(next, configPath);
160
+ config = next;
161
+ status = "Saved " + name + (field === "reset" ? " defaults" : " " + field);
162
+ }
144
163
  }
145
164
  } catch (error) {
146
165
  ctx.ui.notify("pi-subagents setup failed: " + errorMessage(error), "error");