@ferris1225/pi-subagents 2.0.0 → 2.0.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.
Files changed (3) hide show
  1. package/README.md +3 -1
  2. package/package.json +1 -1
  3. package/src/setup.ts +49 -23
package/README.md CHANGED
@@ -277,7 +277,9 @@ sessions show the recovery paths again until the artifacts are removed.
277
277
  Stored at `~/.pi/agent/pi-subagents.json` (follows `PI_CODING_AGENT_DIR` when
278
278
  set). `/subagents-setup` has five top-level choices: enable agents, configure one
279
279
  agent's model/thinking, choose a vision model, runtime settings, or full setup.
280
- There is no backup pool or global thinking menu. Model pickers show only in-scope
280
+ After one agent's model + thinking picks, the wizard returns to the agent picker
281
+ so several agents can be configured in one pass; Esc at any step ends the pass
282
+ and keeps every agent already configured. There is no backup pool or global thinking menu. Model pickers show only in-scope
281
283
  models with configured authentication and display their real supported thinking
282
284
  levels. Thinking defaults to **Auto**; manual overrides show only levels supported
283
285
  by that agent's effective model. `notifyOnReviewPass` and `maxResultLines` remain
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ferris1225/pi-subagents",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Controllable background sub-agent threads for pi: specialized roles, capability-aware thinking, direct main-model fallback, auto-fix chains, and Git worktree isolation.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/setup.ts CHANGED
@@ -204,11 +204,46 @@ async function pickAgentToConfigure(
204
204
  return promptSelectOne(
205
205
  ctx,
206
206
  "Configure which agent?",
207
- "Type to filter • ↑/↓ • Enter selects • Esc cancels",
207
+ "Type to filter • ↑/↓ • Enter selects • Esc ends this pass",
208
208
  enabledAgents.map((name) => ({ value: name, label: moduleLabel(name) })),
209
209
  );
210
210
  }
211
211
 
212
+ /** One agent: model, then thinking if the model exposes a choice. Esc at any
213
+ * step ends the caller's pass; earlier agents in that pass stay applied. */
214
+ async function configureOneAgent(
215
+ ctx: ExtensionCommandContext,
216
+ config: SubagentsConfig,
217
+ ): Promise<
218
+ | {
219
+ name: string;
220
+ model: string;
221
+ strength: ThinkingLevel | typeof AUTO_THINKING;
222
+ }
223
+ | undefined
224
+ > {
225
+ const name = await pickAgentToConfigure(ctx, config.enabledAgents);
226
+ if (name === undefined) return undefined;
227
+ const modelChoice = await pickAgentModel(
228
+ ctx,
229
+ name,
230
+ config.agentModels[name],
231
+ "stops — earlier agent changes are kept",
232
+ );
233
+ if (modelChoice === undefined) return undefined;
234
+ const model = effectiveModelForChoice(ctx, modelChoice);
235
+ const strength = await pickAgentStrength(
236
+ ctx,
237
+ name,
238
+ model,
239
+ config.agentThinkingLevels[name],
240
+ actualAgentThinkingDefault(ctx, config, name),
241
+ "stops — earlier agent changes are kept",
242
+ );
243
+ if (strength === undefined) return undefined;
244
+ return { name, model: modelChoice, strength };
245
+ }
246
+
212
247
  async function pickInjection(ctx: ExtensionCommandContext, current: boolean): Promise<boolean | undefined> {
213
248
  const on = "On — inject the delegation directive (recommended)";
214
249
  const off = "Off — rely on tool descriptions only";
@@ -379,28 +414,19 @@ async function runMenu(ctx: ExtensionCommandContext, configPath: string, config:
379
414
  next.agentModels = keepAgentEntries(next.agentModels, enabled);
380
415
  next.agentThinkingLevels = keepAgentEntries(next.agentThinkingLevels, enabled);
381
416
  } else if (choice.startsWith("Configure")) {
382
- const agentName = await pickAgentToConfigure(ctx, next.enabledAgents);
383
- if (agentName === undefined) return notifyCancelled(ctx);
384
- const modelChoice = await pickAgentModel(
385
- ctx,
386
- agentName,
387
- next.agentModels[agentName],
388
- "cancels agent changes",
389
- );
390
- if (modelChoice === undefined) return notifyCancelled(ctx);
391
- const model = effectiveModelForChoice(ctx, modelChoice);
392
- const strength = await pickAgentStrength(
393
- ctx,
394
- agentName,
395
- model,
396
- next.agentThinkingLevels[agentName],
397
- actualAgentThinkingDefault(ctx, next, agentName),
398
- "cancels agent changes",
399
- );
400
- if (strength === undefined) return notifyCancelled(ctx);
401
- next.agentModels = applyAgentModelChoice(next.agentModels, agentName, modelChoice);
402
- if (strength === AUTO_THINKING) delete next.agentThinkingLevels[agentName];
403
- else next.agentThinkingLevels[agentName] = strength;
417
+ // Per-agent loop: model (+ thinking when the model exposes a choice), then
418
+ // back to the agent picker so several agents can be set in one pass. Esc
419
+ // at any step ends the loop; agents already configured in this pass are kept.
420
+ let configuredAny = false;
421
+ while (true) {
422
+ const picked = await configureOneAgent(ctx, next);
423
+ if (picked === undefined) break;
424
+ configuredAny = true;
425
+ next.agentModels = applyAgentModelChoice(next.agentModels, picked.name, picked.model);
426
+ if (picked.strength === AUTO_THINKING) delete next.agentThinkingLevels[picked.name];
427
+ else next.agentThinkingLevels[picked.name] = picked.strength;
428
+ }
429
+ if (!configuredAny) return notifyCancelled(ctx);
404
430
  } else if (choice.startsWith("Change vision")) {
405
431
  const visionModel = await pickVisionModel(ctx, config.visionModel);
406
432
  if (visionModel === undefined) return notifyCancelled(ctx);