@ferris1225/pi-subagents 4.3.30 → 4.3.32

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.
@@ -1,21 +1,18 @@
1
1
  /**
2
2
  * Interactive configuration wizard for /subagents-setup.
3
3
  *
4
- * The top-level menu exposes enabled roles, per-agent model and thinking choices,
5
- * and a full setup pass. Everything else (scope, concurrency, timeout, result lines)
6
- * is config-file-only.
4
+ * The catalog is fixed: scout and artisan are always enabled. The menu lets the
5
+ * user pick a model and thinking level for each role — that is the entire
6
+ * configuration surface.
7
7
  */
8
8
 
9
9
  import { stat } from "node:fs/promises";
10
10
  import type { Api, Model } from "@earendil-works/pi-ai";
11
11
  import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
12
- import { discoverAgents } from "../delegation/agents.ts";
13
12
  import {
14
13
  AGENT_PROFILES,
15
14
  BUILTIN_AGENT_NAMES,
16
15
  DEFAULT_CONFIG,
17
- DEFAULT_ENABLED_AGENTS,
18
- FIRST_RUN_SETUP_HINT,
19
16
  agentProfile,
20
17
  errorMessage,
21
18
  getConfigPath,
@@ -36,7 +33,7 @@ import {
36
33
  resolveThinkingLevel,
37
34
  supportedThinkingLevels,
38
35
  } from "./models.ts";
39
- import { promptSelectMany, promptSelectOne } from "./ui.ts";
36
+ import { promptSelectOne } from "./ui.ts";
40
37
 
41
38
  const THINKING_LEVEL_HINTS: Record<ThinkingLevel, string> = {
42
39
  off: "no reasoning tokens",
@@ -48,31 +45,6 @@ const THINKING_LEVEL_HINTS: Record<ThinkingLevel, string> = {
48
45
  max: "strongest reasoning",
49
46
  };
50
47
 
51
- function setupAgentNames(ctx: ExtensionContext, config: SubagentsConfig): string[] {
52
- const { agents } = discoverAgents(ctx.cwd, {
53
- scope: config.agentScope,
54
- projectTrusted: ctx.isProjectTrusted?.() === true,
55
- });
56
- const available = new Set(agents.map((agent) => agent.name));
57
- return [...new Set([...BUILTIN_AGENT_NAMES, ...available])].filter((name) => available.has(name));
58
- }
59
-
60
- function agentPickerItems(names: readonly string[]): Array<{ value: string; label: string; description: string }> {
61
- return names.map((name) => {
62
- const profile = agentProfile(name);
63
- return {
64
- value: name,
65
- label: profile ? name : `${name} (custom)`,
66
- description: profile ? `${profile.summary} — ${profile.remark}` : "custom agent",
67
- };
68
- });
69
- }
70
-
71
- function moduleLabel(name: string): string {
72
- const profile = agentProfile(name);
73
- return profile ? `${name} — ${profile.summary}` : `${name} (custom)`;
74
- }
75
-
76
48
  async function configExists(configPath: string): Promise<boolean> {
77
49
  try {
78
50
  await stat(configPath);
@@ -82,20 +54,6 @@ async function configExists(configPath: string): Promise<boolean> {
82
54
  }
83
55
  }
84
56
 
85
- async function pickEnabledAgents(
86
- ctx: ExtensionContext,
87
- config: SubagentsConfig,
88
- ): Promise<string[] | undefined> {
89
- const names = setupAgentNames(ctx, config);
90
- return promptSelectMany(
91
- ctx,
92
- "Which roles should be available?",
93
- "Each line is a role and its job. Space toggles • Enter confirms • Esc back",
94
- agentPickerItems(names),
95
- config.enabledAgents.filter((name) => names.includes(name)),
96
- );
97
- }
98
-
99
57
  async function pickConfiguredModel(
100
58
  ctx: ExtensionContext,
101
59
  title: string,
@@ -121,7 +79,7 @@ async function pickAgentModel(
121
79
  ctx: ExtensionContext,
122
80
  agentName: string,
123
81
  agentModels: Readonly<Record<string, string>>,
124
- escNote = "cancels this setup pass",
82
+ escNote = "returns to the role list",
125
83
  ): Promise<string | undefined> {
126
84
  const profile = agentProfile(agentName);
127
85
  const duty = profile ? ` — ${profile.summary}` : "";
@@ -150,7 +108,7 @@ async function pickAgentStrength(
150
108
  agentName: string,
151
109
  model: Model<Api> | undefined,
152
110
  current: ThinkingLevel | undefined,
153
- escNote = "cancels this setup pass",
111
+ escNote = "returns to model selection",
154
112
  ): Promise<ThinkingLevel | undefined> {
155
113
  const supported = supportedThinkingLevels(model);
156
114
  const roleDefault = resolveThinkingLevel(model, roleThinkingLevel(agentName));
@@ -177,85 +135,67 @@ async function pickAgentStrength(
177
135
  ) as Promise<ThinkingLevel | undefined>;
178
136
  }
179
137
 
180
- async function pickAgentToConfigure(
181
- ctx: ExtensionContext,
182
- enabledAgents: readonly string[],
183
- ): Promise<string | undefined> {
184
- if (enabledAgents.length === 0) {
185
- ctx.ui.notify("No agents are enabled. Enable agents first.", "warning");
186
- return undefined;
187
- }
188
- return promptSelectOne(
189
- ctx,
190
- "Configure which agent?",
191
- "Name, then what it owns • ↑/↓ • Enter selects • Esc returns to settings",
192
- enabledAgents.map((name) => {
193
- const profile = agentProfile(name);
194
- return {
195
- value: name,
196
- label: moduleLabel(name),
197
- description: profile?.remark,
198
- };
199
- }),
200
- );
138
+ function applyThinkingChoice(
139
+ levels: Record<string, ThinkingLevel>,
140
+ agentName: string,
141
+ strength: ThinkingLevel,
142
+ model: Model<Api> | undefined,
143
+ ): Record<string, ThinkingLevel> {
144
+ const next = { ...levels };
145
+ const roleDefault = resolveThinkingLevel(model, roleThinkingLevel(agentName));
146
+ if (strength === roleDefault) delete next[agentName];
147
+ else next[agentName] = resolveThinkingLevel(model, strength);
148
+ return next;
201
149
  }
202
150
 
203
- interface ConfiguredAgentChoice {
204
- name: string;
151
+ interface RoleChoice {
205
152
  model: string;
206
153
  strength: ThinkingLevel;
207
154
  }
208
155
 
209
- async function configureOneAgent(
156
+ /** Model then thinking for one fixed role. Esc on the model picker backs out to
157
+ * the menu; Esc on the thinking picker re-asks the model. */
158
+ async function configureOneRole(
210
159
  ctx: ExtensionContext,
160
+ agentName: string,
211
161
  config: SubagentsConfig,
212
- ): Promise<ConfiguredAgentChoice | undefined> {
213
- // Canonical order (built-ins first), whatever order the config file saved.
214
- const available = setupAgentNames(ctx, config);
215
- const enabled = available.filter((name) => config.enabledAgents.includes(name));
162
+ ): Promise<RoleChoice | undefined> {
163
+ const profile = agentProfile(agentName);
164
+ if (profile) ctx.ui.notify(`${agentName}: ${profile.remark}`, "info");
216
165
  while (true) {
217
- const name = await pickAgentToConfigure(ctx, enabled);
218
- if (name === undefined) return undefined;
219
- const profile = agentProfile(name);
220
- if (profile) ctx.ui.notify(`${name}: ${profile.remark}`, "info");
221
-
222
- while (true) {
223
- const modelChoice = await pickAgentModel(
224
- ctx,
225
- name,
226
- config.agentModels,
227
- "returns to agent selection",
228
- );
229
- if (modelChoice === undefined) break;
230
- const model = effectiveModelForChoice(ctx, name, modelChoice, config.agentModels);
231
- const strength = await pickAgentStrength(
232
- ctx,
233
- name,
234
- model,
235
- config.agentThinkingLevels[name],
236
- "returns to model selection",
237
- );
238
- if (strength === undefined) continue;
239
- return { name, model: modelChoice, strength };
240
- }
166
+ const modelChoice = await pickAgentModel(ctx, agentName, config.agentModels);
167
+ if (modelChoice === undefined) return undefined;
168
+ const model = effectiveModelForChoice(ctx, agentName, modelChoice, config.agentModels);
169
+ const strength = await pickAgentStrength(
170
+ ctx,
171
+ agentName,
172
+ model,
173
+ config.agentThinkingLevels[agentName],
174
+ );
175
+ if (strength === undefined) continue;
176
+ return { model: modelChoice, strength };
241
177
  }
242
178
  }
243
179
 
244
- function keepAgentEntries<T>(record: Record<string, T>, enabled: readonly string[]): Record<string, T> {
245
- const keep = new Set(enabled);
246
- return Object.fromEntries(Object.entries(record).filter(([name]) => keep.has(name)));
247
- }
248
-
249
- function applyThinkingChoice(
250
- levels: Record<string, ThinkingLevel>,
180
+ async function applyRoleChoice(
181
+ ctx: ExtensionContext,
182
+ configPath: string,
183
+ config: SubagentsConfig,
251
184
  agentName: string,
252
- strength: ThinkingLevel,
253
- model: Model<Api> | undefined,
254
- ): Record<string, ThinkingLevel> {
255
- const next = { ...levels };
256
- const roleDefault = resolveThinkingLevel(model, roleThinkingLevel(agentName));
257
- if (strength === roleDefault) delete next[agentName];
258
- else next[agentName] = resolveThinkingLevel(model, strength);
185
+ choice: RoleChoice,
186
+ ): Promise<SubagentsConfig> {
187
+ const agentModels = applyAgentModelChoice({ ...config.agentModels }, agentName, choice.model);
188
+ const model = effectiveModelForChoice(ctx, agentName, choice.model, agentModels);
189
+ const next: SubagentsConfig = {
190
+ agentModels,
191
+ agentThinkingLevels: applyThinkingChoice(
192
+ { ...config.agentThinkingLevels },
193
+ agentName,
194
+ choice.strength,
195
+ model,
196
+ ),
197
+ };
198
+ await saveConfig(next, configPath);
259
199
  return next;
260
200
  }
261
201
 
@@ -275,15 +215,13 @@ async function introduceSetup(ctx: ExtensionContext): Promise<boolean> {
275
215
  return choice !== undefined;
276
216
  }
277
217
 
218
+ /** Walk both roles in order — model, then thinking — and save once at the end. */
278
219
  async function runFullSetup(ctx: ExtensionContext, configPath: string, base: SubagentsConfig): Promise<boolean> {
279
220
  if (!(await introduceSetup(ctx))) return false;
280
221
 
281
- const enabled = await pickEnabledAgents(ctx, base);
282
- if (enabled === undefined) return false;
283
-
284
- let agentModels = keepAgentEntries(base.agentModels, enabled);
285
- let agentThinkingLevels = keepAgentEntries(base.agentThinkingLevels, enabled);
286
- for (const agentName of enabled) {
222
+ let agentModels = { ...base.agentModels };
223
+ let agentThinkingLevels = { ...base.agentThinkingLevels };
224
+ for (const agentName of BUILTIN_AGENT_NAMES) {
287
225
  const profile = agentProfile(agentName);
288
226
  if (profile) ctx.ui.notify(`${agentName}: ${profile.remark}`, "info");
289
227
  const choice = await pickAgentModel(ctx, agentName, agentModels);
@@ -297,74 +235,39 @@ async function runFullSetup(ctx: ExtensionContext, configPath: string, base: Sub
297
235
  agentThinkingLevels = applyThinkingChoice(agentThinkingLevels, agentName, strength, model);
298
236
  }
299
237
 
300
- const next: SubagentsConfig = {
301
- enabledAgents: enabled,
302
- knownAgents: setupAgentNames(ctx, base),
303
- agentModels,
304
- agentThinkingLevels,
305
- maxResultLines: base.maxResultLines,
306
- maxConcurrentAgents: base.maxConcurrentAgents,
307
- agentScope: base.agentScope,
308
- idleTimeoutSec: base.idleTimeoutSec,
309
- };
310
- await saveConfig(next, configPath);
311
- ctx.ui.notify(
312
- `pi-subagents saved to ${configPath}. Models and thinking levels are set; open Configure an agent to change one.`,
313
- "info",
314
- );
238
+ await saveConfig({ agentModels, agentThinkingLevels }, configPath);
239
+ ctx.ui.notify(`pi-subagents saved to ${configPath}.`, "info");
315
240
  return true;
316
241
  }
317
242
 
243
+ function roleRow(name: string, config: SubagentsConfig): string {
244
+ const profile = AGENT_PROFILES[name as keyof typeof AGENT_PROFILES];
245
+ const model = config.agentModels[name] ?? "current main model";
246
+ const thinking = config.agentThinkingLevels[name] ?? roleThinkingLevel(name);
247
+ return `${name} — ${profile.summary} · model: ${model} · thinking: ${thinking}`;
248
+ }
249
+
250
+ /** Menu: one row per fixed role showing its current route, plus a both-roles
251
+ * walk. Esc exits; saving happens after each change so a later Esc loses
252
+ * nothing. */
318
253
  async function runMenu(ctx: ExtensionContext, configPath: string, config: SubagentsConfig): Promise<void> {
319
254
  while (true) {
255
+ const rows = BUILTIN_AGENT_NAMES.map((name) => roleRow(name, config));
320
256
  const choice = await ctx.ui.select("pi-subagents settings", [
321
- "Enable/disable agents — choose which roles are available",
322
- "Configure an agent — model and thinking, with its job on the row",
323
- "Full re-setup — pick each role's model and thinking again",
257
+ ...rows,
258
+ "Both roles — walk model and thinking for each",
324
259
  ]);
325
260
  if (choice === undefined) return;
326
- if (choice.startsWith("Full")) {
261
+ if (choice.startsWith("Both")) {
327
262
  if (await runFullSetup(ctx, configPath, config)) return;
328
263
  continue;
329
264
  }
330
-
331
- let next: SubagentsConfig = {
332
- ...config,
333
- agentModels: { ...config.agentModels },
334
- agentThinkingLevels: { ...config.agentThinkingLevels },
335
- };
336
- if (choice.startsWith("Enable")) {
337
- const enabled = await pickEnabledAgents(ctx, config);
338
- if (enabled === undefined) continue;
339
- next.enabledAgents = enabled;
340
- next.knownAgents = setupAgentNames(ctx, config);
341
- next.agentModels = keepAgentEntries(next.agentModels, enabled);
342
- next.agentThinkingLevels = keepAgentEntries(next.agentThinkingLevels, enabled);
343
- } else {
344
- let configuredAny = false;
345
- while (true) {
346
- const picked = await configureOneAgent(ctx, next);
347
- if (!picked) break;
348
- configuredAny = true;
349
- next.agentModels = applyAgentModelChoice(next.agentModels, picked.name, picked.model);
350
- const model = effectiveModelForChoice(ctx, picked.name, picked.model, next.agentModels);
351
- next.agentThinkingLevels = applyThinkingChoice(
352
- next.agentThinkingLevels,
353
- picked.name,
354
- picked.strength,
355
- model,
356
- );
357
- }
358
- if (!configuredAny) continue;
359
- await saveConfig(next, configPath);
360
- ctx.ui.notify(`pi-subagents updated. Saved to ${configPath}`, "info");
361
- config = next;
362
- continue;
363
- }
364
-
365
- await saveConfig(next, configPath);
265
+ const agentName = BUILTIN_AGENT_NAMES.find((name) => choice.startsWith(name));
266
+ if (!agentName) continue;
267
+ const picked = await configureOneRole(ctx, agentName, config);
268
+ if (!picked) continue;
269
+ config = await applyRoleChoice(ctx, configPath, config, agentName, picked);
366
270
  ctx.ui.notify(`pi-subagents updated. Saved to ${configPath}`, "info");
367
- return;
368
271
  }
369
272
  }
370
273
 
@@ -378,7 +281,7 @@ export async function runSetup(ctx: ExtensionContext, configPath: string = getCo
378
281
  const exists = await configExists(configPath);
379
282
  const config = await loadConfig(configPath);
380
283
  if (exists) await runMenu(ctx, configPath, config);
381
- else if (!(await runFullSetup(ctx, configPath, { ...DEFAULT_CONFIG, enabledAgents: [...DEFAULT_ENABLED_AGENTS] }))) {
284
+ else if (!(await runFullSetup(ctx, configPath, DEFAULT_CONFIG))) {
382
285
  ctx.ui.notify("pi-subagents setup cancelled.", "info");
383
286
  }
384
287
  } catch (error) {
@@ -387,20 +290,19 @@ export async function runSetup(ctx: ExtensionContext, configPath: string = getCo
387
290
  }
388
291
 
389
292
  /**
390
- * First-install offer: announce the command, then let the user start the wizard
391
- * right away. Declining leaves the config untouched and the notice is enough to
392
- * run `/subagents-setup` later.
293
+ * First start: write the shipped defaults so both roles work immediately — no
294
+ * model overrides means each child follows the main model — then announce the
295
+ * command that customizes them. The file is the marker: once it exists, later
296
+ * sessions stay silent.
393
297
  */
394
- export async function offerFirstRunSetup(
298
+ export async function ensureDefaultConfig(
395
299
  ctx: ExtensionContext,
396
300
  configPath: string = getConfigPath(),
397
301
  ): Promise<void> {
398
- ctx.ui.notify(`pi-subagents: ${FIRST_RUN_SETUP_HINT}`, "info");
399
- if (ctx.mode !== "tui") return;
400
- const start = await ctx.ui.confirm(
401
- "Configure pi-subagents now?",
402
- "Pick each role's model, then its thinking level. Esc in the wizard stops setup; run /subagents-setup later if you skip now.",
302
+ if (await configExists(configPath)) return;
303
+ await saveConfig(DEFAULT_CONFIG, configPath);
304
+ ctx.ui.notify(
305
+ `pi-subagents: wrote ${configPath} with scout and artisan enabled; both follow the main model. Run /subagents-setup to pick a model and thinking level per role.`,
306
+ "info",
403
307
  );
404
- if (!start) return;
405
- await runSetup(ctx, configPath);
406
308
  }
@@ -1,11 +1,9 @@
1
1
  /**
2
- * TUI pickers for /subagents-setup, built on @earendil-works/pi-tui.
2
+ * TUI picker for /subagents-setup, built on @earendil-works/pi-tui.
3
3
  *
4
- * A single self-contained `Picker` component powers both selectors:
5
- * - single-select (model picker): type to fuzzy-filter, arrows to move,
6
- * PageUp/PageDown to page, Enter to choose, Esc to cancel.
7
- * - multi-select (module picker): same navigation, Space toggles a checkbox,
8
- * Enter confirms the selection set.
4
+ * A single self-contained `Picker` component powers the model and thinking
5
+ * selectors: type to fuzzy-filter, arrows to move, PageUp/PageDown to page,
6
+ * Enter to choose, Esc to cancel.
9
7
  *
10
8
  * pi-tui's built-in SelectList only handles up/down/confirm/cancel (no paging),
11
9
  * so we render the list ourselves and use the injected keybinding manager. Every line
@@ -38,8 +36,6 @@ interface PickerStyles {
38
36
  selectedLabel: (t: string) => string;
39
37
  label: (t: string) => string;
40
38
  dim: (t: string) => string;
41
- checked: (t: string) => string;
42
- unchecked: (t: string) => string;
43
39
  filterEcho: (t: string) => string;
44
40
  }
45
41
 
@@ -50,10 +46,8 @@ function pickerItemSearchText(item: PickerItem): string {
50
46
  }
51
47
 
52
48
  interface PickerCallbacks {
53
- /** single-select: fired with the highlighted value on Enter. */
54
- onSelect?: (value: string) => void;
55
- /** multi-select: fired with the full chosen set on Enter. */
56
- onConfirm?: (values: string[]) => void;
49
+ /** Fired with the highlighted value on Enter. */
50
+ onSelect: (value: string) => void;
57
51
  onCancel: () => void;
58
52
  }
59
53
 
@@ -62,18 +56,28 @@ class Picker implements Component, Focusable {
62
56
  private query = "";
63
57
  private cursor = 0;
64
58
  private filtered: PickerItem[];
59
+ private readonly items: PickerItem[];
60
+ private readonly styles: PickerStyles;
61
+ private readonly headerLines: string[];
62
+ private readonly tui: TUI;
63
+ private readonly keybindings: KeybindingsManager;
64
+ private readonly cb: PickerCallbacks;
65
65
 
66
66
  constructor(
67
- private readonly items: PickerItem[],
68
- private readonly multi: boolean,
69
- private readonly selected: Set<string>,
70
- private readonly styles: PickerStyles,
71
- private readonly headerLines: string[],
72
- private readonly tui: TUI,
73
- private readonly keybindings: KeybindingsManager,
74
- private readonly cb: PickerCallbacks,
67
+ items: PickerItem[],
68
+ styles: PickerStyles,
69
+ headerLines: string[],
70
+ tui: TUI,
71
+ keybindings: KeybindingsManager,
72
+ cb: PickerCallbacks,
75
73
  initialValue?: string,
76
74
  ) {
75
+ this.items = items;
76
+ this.styles = styles;
77
+ this.headerLines = headerLines;
78
+ this.tui = tui;
79
+ this.keybindings = keybindings;
80
+ this.cb = cb;
77
81
  this.filtered = items;
78
82
  const initialIndex = initialValue === undefined ? -1 : items.findIndex((item) => item.value === initialValue);
79
83
  if (initialIndex >= 0) this.cursor = initialIndex;
@@ -116,10 +120,7 @@ class Picker implements Component, Focusable {
116
120
  const mark = isCursor ? s.cursorMark("❯ ") : " ";
117
121
  const label = isCursor ? s.selectedLabel(item.label) : s.label(item.label);
118
122
  const description = item.description ? s.dim(` — ${item.description}`) : "";
119
- const line = this.multi
120
- ? mark + (this.selected.has(item.value) ? s.checked("[x] ") : s.unchecked("[ ] ")) + label + description
121
- : mark + label + description;
122
- lines.push(fit(line));
123
+ lines.push(fit(mark + label + description));
123
124
  }
124
125
  const more = this.filtered.length > PAGE_SIZE ? " ↑/↓ move • PgUp/PgDn page" : "";
125
126
  lines.push(fit(s.dim(` (${this.cursor + 1}/${this.filtered.length})${more}`)));
@@ -140,14 +141,8 @@ class Picker implements Component, Focusable {
140
141
  } else if (kb.matches(data, "tui.select.pageDown")) {
141
142
  this.cursor = Math.min(Math.max(0, this.filtered.length - 1), this.cursor + PAGE_SIZE);
142
143
  } else if (kb.matches(data, "tui.select.confirm")) {
143
- if (this.multi) {
144
- // Confirm in listed order, not toggle order: callers persist this
145
- // sequence and re-render it as the saved role order.
146
- this.cb.onConfirm?.(this.items.filter((item) => this.selected.has(item.value)).map((item) => item.value));
147
- } else {
148
- const item = this.filtered[this.cursor];
149
- if (item) this.cb.onSelect?.(item.value);
150
- }
144
+ const item = this.filtered[this.cursor];
145
+ if (item) this.cb.onSelect(item.value);
151
146
  return;
152
147
  } else if (kb.matches(data, "tui.select.cancel")) {
153
148
  this.cb.onCancel();
@@ -156,18 +151,6 @@ class Picker implements Component, Focusable {
156
151
  this.query = this.query.slice(0, -1);
157
152
  this.cursor = 0;
158
153
  this.recompute();
159
- } else if (data === " ") {
160
- if (this.multi) {
161
- const item = this.filtered[this.cursor];
162
- if (item) {
163
- if (this.selected.has(item.value)) this.selected.delete(item.value);
164
- else this.selected.add(item.value);
165
- }
166
- } else {
167
- this.query += data;
168
- this.cursor = 0;
169
- this.recompute();
170
- }
171
154
  } else if (isPrintable(data)) {
172
155
  this.query += data;
173
156
  this.cursor = 0;
@@ -195,8 +178,6 @@ function makeStyles(theme: Theme): PickerStyles {
195
178
  selectedLabel: (t) => theme.fg("accent", theme.bold(t)),
196
179
  label: (t) => t,
197
180
  dim: (t) => theme.fg("dim", t),
198
- checked: (t) => theme.fg("accent", t),
199
- unchecked: (t) => theme.fg("dim", t),
200
181
  filterEcho: (t) => theme.fg("accent", t),
201
182
  };
202
183
  }
@@ -221,28 +202,9 @@ export function promptSelectOne(
221
202
  return ctx.ui.custom<string | undefined>((tui, theme, keybindings, done) => {
222
203
  const styles = makeStyles(theme);
223
204
  const header = [styles.title(title), styles.hint(hint)];
224
- return new Picker(items, false, new Set<string>(), styles, header, tui, keybindings, {
205
+ return new Picker(items, styles, header, tui, keybindings, {
225
206
  onSelect: (value) => done(value),
226
207
  onCancel: () => done(undefined),
227
208
  }, initialValue);
228
209
  });
229
210
  }
230
-
231
- /** Multi-select with fuzzy filter + paging. Resolves undefined on Esc. */
232
- export function promptSelectMany(
233
- ctx: PickerContext,
234
- title: string,
235
- hint: string,
236
- items: PickerItem[],
237
- initialSelected: readonly string[],
238
- ): Promise<string[] | undefined> {
239
- if (!requireTui(ctx)) return Promise.resolve(undefined);
240
- return ctx.ui.custom<string[] | undefined>((tui, theme, keybindings, done) => {
241
- const styles = makeStyles(theme);
242
- const header = [styles.title(title), styles.hint(hint)];
243
- return new Picker(items, true, new Set<string>(initialSelected), styles, header, tui, keybindings, {
244
- onConfirm: (values) => done(values),
245
- onCancel: () => done(undefined),
246
- });
247
- });
248
- }