pi-bro 0.33.0 → 0.35.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/src/bro.ts CHANGED
@@ -8,7 +8,7 @@ import {
8
8
  resolveBtwThread,
9
9
  } from "./btw.ts";
10
10
  import { doctorReport, showBroConfigModal } from "./doctor.ts";
11
- import { setPiHostContext } from "./backend.ts";
11
+ import { setPiHostContext, stopActiveBackendExecutions } from "./backend.ts";
12
12
  import { openElevateModal } from "./elevate.ts";
13
13
  import { openArchitectureDocs } from "./architecture.ts";
14
14
  import { openGrillModal } from "./grill.ts";
@@ -154,7 +154,14 @@ export default async function bro(pi: ExtensionAPI) {
154
154
  grillThread = restored.grill;
155
155
  };
156
156
 
157
- pi.on("session_shutdown", async () => { stopGuidedReviews(); });
157
+ pi.on("session_shutdown", async () => {
158
+ // Both cleanups begin before we await either one.
159
+ const [reviews, backends] = await Promise.allSettled([
160
+ stopGuidedReviews(), stopActiveBackendExecutions(),
161
+ ]);
162
+ if (reviews.status === "rejected") throw reviews.reason;
163
+ if (backends.status === "rejected") throw backends.reason;
164
+ });
158
165
  pi.on("session_start", async (_event, ctx) => { restore(ctx); });
159
166
  pi.on("session_tree", async (_event, ctx) => { restore(ctx); });
160
167
 
package/src/btw.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import type { ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
2
2
  import { copyToClipboard, getMarkdownTheme } from "@earendil-works/pi-coding-agent";
3
3
  import { Input, Markdown, matchesKey, wrapTextWithAnsi, type Focusable } from "@earendil-works/pi-tui";
4
- import { execute as executeBackend, type BackendProgress, type BackendSelection } from "./backend.ts";
4
+ import { execute as executeBackend, textProgressThrottle, type BackendSelection } from "./backend.ts";
5
5
  import { buildBtwPrompt } from "./prompt.ts";
6
6
  import {
7
7
  type BackendName,
@@ -140,20 +140,7 @@ export async function runBtwTurn(
140
140
  signal: AbortSignal,
141
141
  onProgress?: (text: string) => void,
142
142
  ): Promise<{ text: string; conversationId?: string; expiredContinuation?: true }> {
143
- let updateTimer: ReturnType<typeof setTimeout> | undefined;
144
- let latest: string | undefined;
145
- const throttledProgress = onProgress
146
- ? (progress: BackendProgress) => {
147
- if (progress.kind !== "text") return;
148
- latest = progress.text;
149
- if (!updateTimer) {
150
- updateTimer = setTimeout(() => {
151
- updateTimer = undefined;
152
- if (!signal.aborted && latest !== undefined) onProgress(latest);
153
- }, 75);
154
- }
155
- }
156
- : undefined;
143
+ const progress = textProgressThrottle(signal, onProgress);
157
144
 
158
145
  try {
159
146
  const outcome = await executeBackend(
@@ -166,13 +153,13 @@ export async function runBtwTurn(
166
153
  },
167
154
  selection,
168
155
  signal,
169
- throttledProgress,
156
+ progress.receive,
170
157
  );
171
158
  if (outcome.status === "success") return { text: outcome.text, conversationId: outcome.continuation?.id };
172
159
  if (outcome.continuationExpired) return { text: "", expiredContinuation: true };
173
160
  throw new Error(outcome.message);
174
161
  } finally {
175
- if (updateTimer) clearTimeout(updateTimer);
162
+ progress.dispose();
176
163
  }
177
164
  }
178
165
 
package/src/doctor.ts CHANGED
@@ -33,14 +33,11 @@ import {
33
33
  CAPABILITIES,
34
34
  CAPABILITY_LABELS,
35
35
  EFFORTS,
36
+ EXTERNAL_BACKENDS,
37
+ isExternalBackend,
36
38
  capabilityBackend,
37
39
  capabilityOverride,
38
40
  capabilityPair,
39
- isClaudeEffort,
40
- isCodexEffort,
41
- isGrokEffort,
42
- isMuseEffort,
43
- isPiEffort,
44
41
  readPreferences,
45
42
  readSettings,
46
43
  resolveCapabilitySettings,
@@ -102,18 +99,12 @@ export function parseAgyModels(output: string): AgyModelFamily[] {
102
99
  }
103
100
 
104
101
  export async function listAgyModels(pi: ExtensionAPI, signal?: AbortSignal): Promise<AgyModelFamily[]> {
105
- const runDirectory = await mkdtemp(join(tmpdir(), "pi-bro-"));
102
+ const result = await probeCli(pi, "agy", ["models"], signal, 30_000);
103
+ if (result.killed || result.code !== 0) throw new Error(agyFailureMessage("list models", result));
106
104
  try {
107
- const result = await pi.exec("agy", ["models"], { cwd: runDirectory, signal, timeout: 30_000 });
108
- if (signal?.aborted) throw new Error("Canceled.");
109
- if (result.killed || result.code !== 0) throw new Error(agyFailureMessage("list models", result));
110
- try {
111
- return parseAgyModels(result.stdout);
112
- } catch (error) {
113
- throw new Error(withDoctor(error));
114
- }
115
- } finally {
116
- await rm(runDirectory, { recursive: true, force: true });
105
+ return parseAgyModels(result.stdout);
106
+ } catch (error) {
107
+ throw new Error(withDoctor(error));
117
108
  }
118
109
  }
119
110
 
@@ -155,20 +146,28 @@ function piEffortDetail(model: Parameters<typeof piEffectiveEffort>[0], effort:
155
146
  return `${effort} → ${effective} (clamped)`;
156
147
  }
157
148
 
158
- async function checkAgyVersion(pi: ExtensionAPI, signal: AbortSignal): Promise<string> {
149
+ // Every diagnostic CLI probe runs away from the user's project and cleans up on all outcomes.
150
+ async function probeCli(
151
+ pi: ExtensionAPI, binary: string, args: string[], signal: AbortSignal | undefined, timeout: number,
152
+ ): Promise<Awaited<ReturnType<ExtensionAPI["exec"]>>> {
159
153
  const runDirectory = await mkdtemp(join(tmpdir(), "pi-bro-"));
160
154
  try {
161
- const result = await pi.exec("agy", ["--version"], { cwd: runDirectory, signal, timeout: 10_000 });
162
- if (signal.aborted) throw new Error("Canceled.");
163
- if (result.killed || result.code !== 0) throw new Error(agyFailureMessage("start", result));
164
- const version = result.stdout.trim() || result.stderr.trim();
165
- if (!version) throw new Error("Agy returned no version information. Update Agy, then run `/bro doctor` again.");
166
- return version;
155
+ const result = await pi.exec(binary, args, { cwd: runDirectory, signal, timeout });
156
+ if (signal?.aborted) throw new Error("Canceled.");
157
+ return result;
167
158
  } finally {
168
159
  await rm(runDirectory, { recursive: true, force: true });
169
160
  }
170
161
  }
171
162
 
163
+ async function checkAgyVersion(pi: ExtensionAPI, signal: AbortSignal): Promise<string> {
164
+ const result = await probeCli(pi, "agy", ["--version"], signal, 10_000);
165
+ if (result.killed || result.code !== 0) throw new Error(agyFailureMessage("start", result));
166
+ const version = result.stdout.trim() || result.stderr.trim();
167
+ if (!version) throw new Error("Agy returned no version information. Update Agy, then run `/bro doctor` again.");
168
+ return version;
169
+ }
170
+
172
171
  function resolveCatalogSettings(
173
172
  settings: BroSettings,
174
173
  families: AgyModelFamily[],
@@ -179,82 +178,54 @@ function resolveCatalogSettings(
179
178
  }
180
179
 
181
180
  async function checkCliVersion(pi: ExtensionAPI, binary: string, displayName: string, signal: AbortSignal): Promise<string> {
182
- const runDirectory = await mkdtemp(join(tmpdir(), "pi-bro-"));
183
- try {
184
- const result = await pi.exec(binary, ["--version"], { cwd: runDirectory, signal, timeout: 10_000 });
185
- if (signal.aborted) throw new Error("Canceled.");
186
- if (result.killed || result.code !== 0) {
187
- const detail = result.stderr.trim() || result.stdout.trim();
188
- throw new Error(
189
- detail
190
- ? `${displayName} could not start: ${detail}\n\nRun \`/bro doctor\` for setup help.`
191
- : `${displayName} could not start. Make sure ${displayName} is installed and on PATH, then run \`/bro doctor\`.`,
192
- );
193
- }
194
- const version = result.stdout.trim() || result.stderr.trim();
195
- if (!version) throw new Error(`${displayName} returned no version information. Update ${displayName}, then run \`/bro doctor\` again.`);
196
- return version;
197
- } finally {
198
- await rm(runDirectory, { recursive: true, force: true });
181
+ const result = await probeCli(pi, binary, ["--version"], signal, 10_000);
182
+ if (result.killed || result.code !== 0) {
183
+ const detail = result.stderr.trim() || result.stdout.trim();
184
+ throw new Error(
185
+ detail
186
+ ? `${displayName} could not start: ${detail}\n\nRun \`/bro doctor\` for setup help.`
187
+ : `${displayName} could not start. Make sure ${displayName} is installed and on PATH, then run \`/bro doctor\`.`,
188
+ );
199
189
  }
190
+ const version = result.stdout.trim() || result.stderr.trim();
191
+ if (!version) throw new Error(`${displayName} returned no version information. Update ${displayName}, then run \`/bro doctor\` again.`);
192
+ return version;
200
193
  }
201
194
 
202
195
  // Auth status only: a version/auth answer without a model request. A passing answer here
203
196
  // says the CLI starts and reports signed-in state -- it does not imply connectivity.
204
197
  async function checkClaudeAuth(pi: ExtensionAPI, signal: AbortSignal): Promise<string> {
205
- const runDirectory = await mkdtemp(join(tmpdir(), "pi-bro-"));
206
- try {
207
- const result = await pi.exec("claude", ["auth", "status"], { cwd: runDirectory, signal, timeout: 15_000 });
208
- if (signal.aborted) throw new Error("Canceled.");
209
- if (result.killed || result.code !== 0) {
210
- const detail = result.stderr.trim() || result.stdout.trim();
211
- throw new Error(detail ? `Claude auth status: ${detail}` : "Claude auth status is unknown. Sign in, then run `/bro doctor`.");
212
- }
213
- let status: unknown;
214
- try { status = JSON.parse(result.stdout); } catch { throw new Error("Claude returned unreadable auth status; sign in and retry /bro doctor."); }
215
- if (!isRecord(status) || status.loggedIn !== true) throw new Error("Claude is not signed in. Run `claude auth login`.");
216
- return "authentication configured (not a connectivity test)";
217
- } finally {
218
- await rm(runDirectory, { recursive: true, force: true });
198
+ const result = await probeCli(pi, "claude", ["auth", "status"], signal, 15_000);
199
+ if (result.killed || result.code !== 0) {
200
+ const detail = result.stderr.trim() || result.stdout.trim();
201
+ throw new Error(detail ? `Claude auth status: ${detail}` : "Claude auth status is unknown. Sign in, then run `/bro doctor`.");
219
202
  }
203
+ let status: unknown;
204
+ try { status = JSON.parse(result.stdout); } catch { throw new Error("Claude returned unreadable auth status; sign in and retry /bro doctor."); }
205
+ if (!isRecord(status) || status.loggedIn !== true) throw new Error("Claude is not signed in. Run `claude auth login`.");
206
+ return "authentication configured (not a connectivity test)";
220
207
  }
221
208
 
222
209
  // Auth status only: a version/auth answer without a model request. A passing answer here
223
210
  // says the CLI starts and reports signed-in state -- it does not imply connectivity.
224
211
  async function checkCodexAuth(pi: ExtensionAPI, signal: AbortSignal): Promise<string> {
225
- const runDirectory = await mkdtemp(join(tmpdir(), "pi-bro-"));
226
- try {
227
- const result = await pi.exec("codex", ["login", "status"], { cwd: runDirectory, signal, timeout: 15_000 });
228
- if (signal.aborted) throw new Error("Canceled.");
229
- if (result.killed || result.code !== 0) {
230
- const detail = result.stderr.trim() || result.stdout.trim();
231
- throw new Error(detail ? `Codex auth status: ${detail}` : "Codex is not logged in. Run `codex login`.");
232
- }
233
- const status = result.stdout.trim() || result.stderr.trim();
234
- if (!status || !/logged in/i.test(status)) throw new Error("Codex is not logged in. Run `codex login`.");
235
- return "authentication configured (not a connectivity test)";
236
- } finally {
237
- await rm(runDirectory, { recursive: true, force: true });
212
+ const result = await probeCli(pi, "codex", ["login", "status"], signal, 15_000);
213
+ if (result.killed || result.code !== 0) {
214
+ const detail = result.stderr.trim() || result.stdout.trim();
215
+ throw new Error(detail ? `Codex auth status: ${detail}` : "Codex is not logged in. Run `codex login`.");
238
216
  }
217
+ const status = result.stdout.trim() || result.stderr.trim();
218
+ if (!status || !/logged in/i.test(status)) throw new Error("Codex is not logged in. Run `codex login`.");
219
+ return "authentication configured (not a connectivity test)";
239
220
  }
240
221
 
241
222
  async function checkAgyUsage(pi: ExtensionAPI, signal: AbortSignal): Promise<string> {
242
- const runDirectory = await mkdtemp(join(tmpdir(), "pi-bro-"));
223
+ const result = await probeCli(pi, "agy", ["-p", "/usage", "--output-format", "json", "--print-timeout", "30s", "--sandbox"], signal, 35_000);
224
+ if (result.killed || result.code !== 0) throw new Error(agyFailureMessage("check account usage", result));
243
225
  try {
244
- const result = await pi.exec(
245
- "agy",
246
- ["-p", "/usage", "--output-format", "json", "--print-timeout", "30s", "--sandbox"],
247
- { cwd: runDirectory, signal, timeout: 35_000 },
248
- );
249
- if (signal.aborted) throw new Error("Canceled.");
250
- if (result.killed || result.code !== 0) throw new Error(agyFailureMessage("check account usage", result));
251
- try {
252
- return formatAgyUsage(JSON.parse(result.stdout));
253
- } catch (error) {
254
- throw new Error(withDoctor(error instanceof SyntaxError ? "Agy returned invalid usage data." : error));
255
- }
256
- } finally {
257
- await rm(runDirectory, { recursive: true, force: true });
226
+ return formatAgyUsage(JSON.parse(result.stdout));
227
+ } catch (error) {
228
+ throw new Error(withDoctor(error instanceof SyntaxError ? "Agy returned invalid usage data." : error));
258
229
  }
259
230
  }
260
231
 
@@ -297,10 +268,6 @@ export async function doctorReport(pi: ExtensionAPI, ctx: ExtensionCommandContex
297
268
  ? CAPABILITIES.some(capability => capabilityBackend(settings, capability) === backend)
298
269
  : backend === "agy";
299
270
  const agyInUse = backendInUse("agy");
300
- const claudeInUse = backendInUse("claude");
301
- const grokInUse = backendInUse("grok");
302
- const codexInUse = backendInUse("codex");
303
- const museInUse = backendInUse("muse");
304
271
  const piInUse = backendInUse("pi");
305
272
 
306
273
  let agyStarted = false;
@@ -335,69 +302,30 @@ export async function doctorReport(pi: ExtensionAPI, ctx: ExtensionCommandContex
335
302
  pass("Agy", "not probed — no feature selects the Agy backend");
336
303
  }
337
304
 
338
- // Version and auth status only, never a model request. A passing answer says the CLI
339
- // starts and reports signed-in state -- it does not imply connectivity.
340
- if (claudeInUse) {
341
- try {
342
- pass("Claude", await checkCliVersion(pi, "claude", "Claude", signal));
343
- } catch (error) {
344
- if (signal.aborted) throw error;
345
- fail("Claude", error);
346
- }
347
- try {
348
- pass("Claude auth", await checkClaudeAuth(pi, signal));
349
- } catch (error) {
350
- if (signal.aborted) throw error;
351
- fail("Claude auth", error);
352
- }
353
- } else {
354
- pass("Claude", "not probed — no feature selects the Claude backend");
355
- }
356
-
357
- // Version only, never a model request. No Grok auth probe exists, so a passing
358
- // version says the CLI starts — it says nothing about auth or connectivity.
359
- if (grokInUse) {
360
- try {
361
- pass("Grok", await checkCliVersion(pi, "grok", "Grok", signal));
362
- } catch (error) {
363
- if (signal.aborted) throw error;
364
- fail("Grok", error);
365
- }
366
- pass("Grok auth", "unverified — no auth probe exists (version does not imply auth or connectivity)");
367
- } else {
368
- pass("Grok", "not probed — no feature selects the Grok backend");
369
- }
370
-
371
- // Version and auth status only, never a model request.
372
- if (codexInUse) {
373
- try {
374
- pass("Codex", await checkCliVersion(pi, "codex", "Codex", signal));
375
- } catch (error) {
376
- if (signal.aborted) throw error;
377
- fail("Codex", error);
305
+ // These CLIs share a version probe; only Claude and Codex have a supported auth probe.
306
+ // Grok and Muse must still say "unverified" rather than implying login or connectivity.
307
+ for (const backend of ["claude", "grok", "codex", "muse"] as const) {
308
+ const label = EXTERNAL_BACKENDS[backend].label;
309
+ if (!backendInUse(backend)) {
310
+ pass(label, `not probed — no feature selects the ${label} backend`);
311
+ continue;
378
312
  }
379
313
  try {
380
- pass("Codex auth", await checkCodexAuth(pi, signal));
314
+ pass(label, await checkCliVersion(pi, backend, label, signal));
381
315
  } catch (error) {
382
316
  if (signal.aborted) throw error;
383
- fail("Codex auth", error);
317
+ fail(label, error);
384
318
  }
385
- } else {
386
- pass("Codex", "not probed — no feature selects the Codex backend");
387
- }
388
-
389
- // Version only, never a model request. No Muse auth probe exists, so a passing
390
- // version says the CLI starts — it says nothing about auth or connectivity.
391
- if (museInUse) {
392
- try {
393
- pass("Muse", await checkCliVersion(pi, "muse", "Muse", signal));
394
- } catch (error) {
395
- if (signal.aborted) throw error;
396
- fail("Muse", error);
319
+ if (backend === "claude" || backend === "codex") {
320
+ try {
321
+ pass(`${label} auth`, await (backend === "claude" ? checkClaudeAuth(pi, signal) : checkCodexAuth(pi, signal)));
322
+ } catch (error) {
323
+ if (signal.aborted) throw error;
324
+ fail(`${label} auth`, error);
325
+ }
326
+ } else {
327
+ pass(`${label} auth`, "unverified — no auth probe exists (version does not imply auth or connectivity)");
397
328
  }
398
- pass("Muse auth", "unverified — no auth probe exists (version does not imply auth or connectivity)");
399
- } else {
400
- pass("Muse", "not probed — no feature selects the Muse backend");
401
329
  }
402
330
 
403
331
  // Pi is in-process: validate the selected physical model against the bridged runtime without a
@@ -419,42 +347,10 @@ export async function doctorReport(pi: ExtensionAPI, ctx: ExtensionCommandContex
419
347
 
420
348
  if (settings) {
421
349
  const defaultBackend = settings.backend ?? "agy";
422
- if (defaultBackend === "claude") {
423
- pass("Selected model", `claude \`${settings.model}\``);
424
- if (!isClaudeEffort(settings.effort)) {
425
- fail("Reasoning effort", `\`${settings.effort}\` is unsupported. Run \`/bro config\` to choose another.`);
426
- } else if (settings.effort === "default") {
427
- pass("Reasoning effort", "built into the selected model");
428
- } else {
429
- pass("Reasoning effort", settings.effort);
430
- }
431
- } else if (defaultBackend === "grok") {
432
- pass("Selected model", `grok \`${settings.model}\``);
433
- if (!isGrokEffort(settings.effort)) {
434
- fail("Reasoning effort", `\`${settings.effort}\` is unsupported. Run \`/bro config\` to choose another.`);
435
- } else if (settings.effort === "default") {
436
- pass("Reasoning effort", "built into the selected model");
437
- } else {
438
- pass("Reasoning effort", settings.effort);
439
- }
440
- } else if (defaultBackend === "codex") {
441
- pass("Selected model", `codex \`${settings.model}\``);
442
- if (!isCodexEffort(settings.effort)) {
443
- fail("Reasoning effort", `\`${settings.effort}\` is unsupported. Run \`/bro config\` to choose another.`);
444
- } else if (settings.effort === "default") {
445
- pass("Reasoning effort", "built into the selected model");
446
- } else {
447
- pass("Reasoning effort", settings.effort);
448
- }
449
- } else if (defaultBackend === "muse") {
450
- pass("Selected model", `muse \`${settings.model}\``);
451
- if (!isMuseEffort(settings.effort)) {
452
- fail("Reasoning effort", `\`${settings.effort}\` is unsupported. Run \`/bro config\` to choose another.`);
453
- } else if (settings.effort === "default") {
454
- pass("Reasoning effort", "built into the selected model");
455
- } else {
456
- pass("Reasoning effort", settings.effort);
457
- }
350
+ if (isExternalBackend(defaultBackend) && defaultBackend !== "pi") {
351
+ // readSettings already validates each external pair against this backend's effort range.
352
+ pass("Selected model", `${defaultBackend} \`${settings.model}\``);
353
+ pass("Reasoning effort", settings.effort === "default" ? "built into the selected model" : settings.effort);
458
354
  } else if (defaultBackend === "pi") {
459
355
  const parts = splitPiModel(settings.model);
460
356
  const physical = parts ? findPiModel(parts.providerId, parts.modelId) : undefined;
@@ -469,11 +365,7 @@ export async function doctorReport(pi: ExtensionAPI, ctx: ExtensionCommandContex
469
365
  pass("Selected model", `pi \`${settings.model}\``);
470
366
  }
471
367
  }
472
- if (!isPiEffort(settings.effort)) {
473
- fail("Reasoning effort", `\`${settings.effort}\` is unsupported. Run \`/bro config\` to choose another.`);
474
- } else {
475
- pass("Reasoning effort", piEffortDetail(physical, settings.effort));
476
- }
368
+ pass("Reasoning effort", piEffortDetail(physical, settings.effort));
477
369
  } else if (models) {
478
370
  const current = resolveCatalogSettings(settings, models);
479
371
  if (!current.family) {
@@ -503,59 +395,12 @@ export async function doctorReport(pi: ExtensionAPI, ctx: ExtensionCommandContex
503
395
  pass(label, detail);
504
396
  if (reviewNotice) lines.push(`- ℹ **${label}:** ${reviewNotice}`);
505
397
  };
506
- if (backend === "claude") {
507
- if (!isClaudeEffort(pair.effort)) {
508
- fail(label, `\`${pair.effort}\` is unsupported for claude \`${pair.model}\`. Run \`/bro config\` to fix this.`);
509
- continue;
510
- }
511
- passCapability(
512
- override
513
- ? `override claude \`${pair.model}\`${pair.effort === "default" ? "" : ` (${pair.effort})`}`
514
- : `claude \`${pair.model}\`${pair.effort === "default" ? "" : ` (${pair.effort})`} · using the shared default`,
515
- );
516
- continue;
517
- }
518
- if (backend === "grok") {
519
- if (!isGrokEffort(pair.effort)) {
520
- fail(label, `\`${pair.effort}\` is unsupported for grok \`${pair.model}\`. Run \`/bro config\` to fix this.`);
521
- continue;
522
- }
523
- passCapability(
524
- override
525
- ? `override grok \`${pair.model}\`${pair.effort === "default" ? "" : ` (${pair.effort})`}`
526
- : `grok \`${pair.model}\`${pair.effort === "default" ? "" : ` (${pair.effort})`} · using the shared default`,
527
- );
528
- continue;
529
- }
530
- if (backend === "codex") {
531
- if (!isCodexEffort(pair.effort)) {
532
- fail(label, `\`${pair.effort}\` is unsupported for codex \`${pair.model}\`. Run \`/bro config\` to fix this.`);
533
- continue;
534
- }
535
- passCapability(
536
- override
537
- ? `override codex \`${pair.model}\`${pair.effort === "default" ? "" : ` (${pair.effort})`}`
538
- : `codex \`${pair.model}\`${pair.effort === "default" ? "" : ` (${pair.effort})`} · using the shared default`,
539
- );
540
- continue;
541
- }
542
- if (backend === "muse") {
543
- if (!isMuseEffort(pair.effort)) {
544
- fail(label, `\`${pair.effort}\` is unsupported for muse \`${pair.model}\`. Run \`/bro config\` to fix this.`);
545
- continue;
546
- }
547
- passCapability(
548
- override
549
- ? `override muse \`${pair.model}\`${pair.effort === "default" ? "" : ` (${pair.effort})`}`
550
- : `muse \`${pair.model}\`${pair.effort === "default" ? "" : ` (${pair.effort})`} · using the shared default`,
551
- );
398
+ if (isExternalBackend(backend) && backend !== "pi") {
399
+ const selection = `${override ? "override " : ""}${backend} \`${pair.model}\`${pair.effort === "default" ? "" : ` (${pair.effort})`}`;
400
+ passCapability(override ? selection : `${selection} · using the shared default`);
552
401
  continue;
553
402
  }
554
403
  if (backend === "pi") {
555
- if (!isPiEffort(pair.effort)) {
556
- fail(label, `\`${pair.effort}\` is unsupported for pi \`${pair.model}\`. Run \`/bro config\` to fix this.`);
557
- continue;
558
- }
559
404
  const parts = splitPiModel(pair.model);
560
405
  if (!parts) {
561
406
  fail(label, `\`${pair.model}\` is not a \`<provider>/<id>\` Pi model. Run \`/bro config\` to fix this.`);
@@ -404,14 +404,14 @@ These are needs, not modes. Copied text does not enter Pi until you paste and su
404
404
 
405
405
  ## Architecture documentation
406
406
 
407
- - \`/bro architecture [focus]\` — inspect this project and create or refresh \`docs/architecture/\` (Markdown, diagrams and a self-contained HTML map). Inherits the BTW model selection. See docs/features/architecture.md.
407
+ - \`/bro architecture [focus]\` — create source-backed docs and an offline map in \`docs/architecture/\` using the BTW model. See docs/features/architecture.md.
408
408
 
409
409
  ## Guided Review
410
410
 
411
- - \`/bro guided-review <PR number or URL>\` — automatically explain and assess a PR with captured code and optional private questions (local Pi interactive only; Git and authenticated gh required).
412
- - Reviews save automatically. Reopen the same PR without a model call; bare \`/bro guided-review\` lists saved reviews (\`resume\` is an alias). Captured code stays unchanged.
411
+ - \`/bro guided-review <PR number or URL>\` — assess captured PR code in local interactive Pi (requires Git and authenticated gh).
412
+ - Reviews save automatically. Reopen without a model call; bare \`/bro guided-review\` lists saved reviews.\n- \`/bro guided-review delete [PR number or URL]\` — delete one local saved review with confirmation; Overview also offers Delete review.
413
413
  - Enter opens items or activates focused actions. Tab changes focus; Esc goes back, then closes from Contents. Close saves; Stop and close cancels active work first.
414
- - Copy finding uses the clipboard, not GitHub. Regenerate requires confirmation and reviews the same capture. For untrusted PRs, prefer Claude/Muse/Pi: file-only tools, no shell/writes/web. Codex/Grok allow shell in a read-only sandbox; Agy's sandbox permits project writes. All three show an advisory. Choose a review override in /bro config. Repository text can mislead; citations are not proof.
414
+ - Copy finding goes to the clipboard, not GitHub. Regenerate reuses captured source. For untrusted PRs, choose file-only Claude/Muse/Pi; Codex/Grok offer sandboxed shell, while Agy may write captured files. Bro warns when shell is allowed. See docs/guided-review.md.
415
415
 
416
416
  ## Elevate
417
417
 
@@ -442,7 +442,7 @@ These are needs, not modes. Copied text does not enter Pi until you paste and su
442
442
  ## Configure and check
443
443
 
444
444
  - \`/bro preferences\` — tell Bro about yourself and how you like answers; added to explain, show, btw, Elevate and Guided Review prompts, never the advisor (**Ctrl+S** save, **Ctrl+K** delete, **Ctrl+C** copy, **Esc** close)
445
- - \`/bro config\` — Global (shared defaults, preferences, Doctor) and Features (Simplify, Show, BTW, Review, Advisor, Overthink defaults and BTW-inherited workflows). The same model pickers, safe saves and error handling remain; Esc backs out.
445
+ - \`/bro config\` — shared defaults, per-feature models, preferences, Doctor and Overthink. Esc backs out.
446
446
  - \`/bro mode [brief|balanced|faithful]\` — view or choose the explanation mode
447
447
  - \`/bro doctor\` — check settings, preferences, and every selected backend without running a model turn
448
448