@andorra-labs/code 0.1.9 → 0.1.11

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 (212) hide show
  1. package/README.md +28 -208
  2. package/THIRD_PARTY_NOTICES.md +15 -0
  3. package/dist/src/agent-execution.js +56 -0
  4. package/dist/src/app-server/protocol.d.ts +109 -1
  5. package/dist/src/app-server/protocol.js +8 -1
  6. package/dist/src/app-server.d.ts +59 -1
  7. package/dist/src/app-server.js +418 -63
  8. package/dist/src/auth/index.d.ts +1 -1
  9. package/dist/src/auth/index.js +1 -1
  10. package/dist/src/auth/store.d.ts +17 -1
  11. package/dist/src/auth/store.js +25 -2
  12. package/dist/src/automation-service.js +1 -1
  13. package/dist/src/browser-session.d.ts +8 -0
  14. package/dist/src/browser-session.js +27 -1
  15. package/dist/src/browser-ui/app.js +255 -33
  16. package/dist/src/browser-ui/index.html +9 -9
  17. package/dist/src/browser-ui/style.css +110 -65
  18. package/dist/src/browser-ui/tokens.css +27 -26
  19. package/dist/src/cli.js +10 -5
  20. package/dist/src/coding-tools.d.ts +24 -0
  21. package/dist/src/coding-tools.js +71 -8
  22. package/dist/src/command-screens.js +1 -1
  23. package/dist/src/commands.d.ts +1 -1
  24. package/dist/src/commands.js +2 -2
  25. package/dist/src/completion-gates.d.ts +42 -7
  26. package/dist/src/completion-gates.js +55 -9
  27. package/dist/src/completion.d.ts +9 -1
  28. package/dist/src/completion.js +20 -2
  29. package/dist/src/dashboard-view.js +2 -2
  30. package/dist/src/deadline.js +4 -0
  31. package/dist/src/decision/checks.js +1 -1
  32. package/dist/src/file-diff.d.ts +105 -0
  33. package/dist/src/file-diff.js +244 -0
  34. package/dist/src/graph-manager-chat.js +4 -4
  35. package/dist/src/graph-runner.js +39 -2
  36. package/dist/src/graph-sync.d.ts +8 -0
  37. package/dist/src/graph-sync.js +54 -3
  38. package/dist/src/graph-tool.js +1 -1
  39. package/dist/src/graph-ui/app.js +303 -129
  40. package/dist/src/graph-ui/controls.css +43 -22
  41. package/dist/src/graph-ui/controls.js +31 -1
  42. package/dist/src/graph-ui/embed.js +56 -7
  43. package/dist/src/graph-ui/icons.js +5 -0
  44. package/dist/src/graph-ui/index.html +3 -3
  45. package/dist/src/graph-ui/manager-state.js +2 -2
  46. package/dist/src/graph-ui/manager.css +19 -18
  47. package/dist/src/graph-ui/manager.js +5 -5
  48. package/dist/src/graph-ui/skill-picker.js +5 -5
  49. package/dist/src/graph-ui/studio-canvas.js +16 -16
  50. package/dist/src/graph-ui/studio.css +18 -15
  51. package/dist/src/graph-ui/studio.js +99 -42
  52. package/dist/src/graph-ui/style.css +125 -80
  53. package/dist/src/graph-ui/theme.js +2 -2
  54. package/dist/src/graph-ui/tokens.css +33 -29
  55. package/dist/src/graphs.d.ts +10 -3
  56. package/dist/src/graphs.js +15 -4
  57. package/dist/src/mcp.d.ts +75 -0
  58. package/dist/src/mcp.js +240 -8
  59. package/dist/src/membership-errors.d.ts +7 -1
  60. package/dist/src/membership-errors.js +9 -3
  61. package/dist/src/provider-keys.d.ts +5 -1
  62. package/dist/src/provider-keys.js +7 -3
  63. package/dist/src/provider-settings.d.ts +4 -1
  64. package/dist/src/provider-settings.js +46 -5
  65. package/dist/src/pull-requests.d.ts +42 -6
  66. package/dist/src/pull-requests.js +11 -3
  67. package/dist/src/qa/guidance.js +6 -19
  68. package/dist/src/qa/index.d.ts +0 -2
  69. package/dist/src/qa/index.js +0 -2
  70. package/dist/src/qa/profile/QaProfile.d.ts +5 -1
  71. package/dist/src/qa/profile/QaProfile.js +6 -2
  72. package/dist/src/qa/tools.d.ts +19 -1
  73. package/dist/src/qa/tools.js +20 -145
  74. package/dist/src/react-runtime.js +134 -16
  75. package/dist/src/read-document-doc.d.ts +20 -0
  76. package/dist/src/read-document-doc.js +524 -0
  77. package/dist/src/read-document-docx.d.ts +21 -0
  78. package/dist/src/read-document-docx.js +584 -0
  79. package/dist/src/read-document-text.d.ts +29 -0
  80. package/dist/src/read-document-text.js +67 -0
  81. package/dist/src/read-document-tool.d.ts +48 -0
  82. package/dist/src/read-document-tool.js +162 -0
  83. package/dist/src/read-document.d.ts +78 -0
  84. package/dist/src/read-document.js +353 -0
  85. package/dist/src/read-image.d.ts +29 -2
  86. package/dist/src/read-image.js +42 -17
  87. package/dist/src/remote/engine-pool.js +18 -6
  88. package/dist/src/runtime.d.ts +19 -0
  89. package/dist/src/runtime.js +10 -1
  90. package/dist/src/screen-selection.d.ts +38 -0
  91. package/dist/src/screen-selection.js +103 -0
  92. package/dist/src/session-changes.d.ts +122 -0
  93. package/dist/src/session-changes.js +804 -0
  94. package/dist/src/side-panel.d.ts +6 -1
  95. package/dist/src/side-panel.js +12 -10
  96. package/dist/src/skills/bundled/create-skill/SKILL.md +1 -1
  97. package/dist/src/skills/bundled/diagram/SKILL.md +1 -1
  98. package/dist/src/skills/bundled/graph-manager/SKILL.md +37 -3
  99. package/dist/src/skills/bundled/graph-manager/patterns.md +27 -0
  100. package/dist/src/skills/bundled/provenance.json +4 -4
  101. package/dist/src/skills/runtime-skills.js +3 -3
  102. package/dist/src/stall-recovery.d.ts +15 -0
  103. package/dist/src/stall-recovery.js +17 -0
  104. package/dist/src/telemetry/schema.d.ts +1 -1
  105. package/dist/src/telemetry/schema.js +1 -2
  106. package/dist/src/terminal-ui.d.ts +64 -20
  107. package/dist/src/terminal-ui.js +312 -82
  108. package/dist/src/time-limit.d.ts +53 -0
  109. package/dist/src/time-limit.js +79 -0
  110. package/dist/src/tool-diff-stats.d.ts +9 -0
  111. package/dist/src/tool-diff-stats.js +20 -0
  112. package/dist/src/tool-names.d.ts +1 -1
  113. package/dist/src/tool-result-filter.js +1 -1
  114. package/dist/src/tools.js +118 -9
  115. package/dist/src/transcript.d.ts +11 -0
  116. package/dist/src/transcript.js +15 -3
  117. package/dist/src/types.d.ts +12 -0
  118. package/dist/src/usage-analytics.d.ts +3 -1
  119. package/dist/src/usage-analytics.js +16 -2
  120. package/package.json +6 -26
  121. package/dist/src/qa/api/http-runner.d.ts +0 -3
  122. package/dist/src/qa/api/http-runner.js +0 -47
  123. package/dist/src/qa/git/ChangeDetector.d.ts +0 -26
  124. package/dist/src/qa/git/ChangeDetector.js +0 -177
  125. package/dist/src/qa/git/DiffReviewer.d.ts +0 -28
  126. package/dist/src/qa/git/DiffReviewer.js +0 -115
  127. package/dist/src/qa/orchestrator/ChangeClassifier.d.ts +0 -14
  128. package/dist/src/qa/orchestrator/ChangeClassifier.js +0 -28
  129. package/dist/src/qa/orchestrator/MergeGate.d.ts +0 -14
  130. package/dist/src/qa/orchestrator/MergeGate.js +0 -40
  131. package/dist/src/qa/orchestrator/QaOrchestrator.d.ts +0 -79
  132. package/dist/src/qa/orchestrator/QaOrchestrator.js +0 -373
  133. package/dist/src/qa/runners/CommandRunner.d.ts +0 -22
  134. package/dist/src/qa/runners/CommandRunner.js +0 -96
  135. package/dist/src/qa/runners/TestRunner.d.ts +0 -21
  136. package/dist/src/qa/runners/TestRunner.js +0 -66
  137. package/dist/src/qa/runtime/RuntimeSmoke.d.ts +0 -11
  138. package/dist/src/qa/runtime/RuntimeSmoke.js +0 -78
  139. package/dist/src/qa/runtime-detect.d.ts +0 -10
  140. package/dist/src/qa/runtime-detect.js +0 -72
  141. package/dist/src/qa/security/DependencyScanner.d.ts +0 -19
  142. package/dist/src/qa/security/DependencyScanner.js +0 -167
  143. package/dist/src/qa/security/SecretScanner.d.ts +0 -3
  144. package/dist/src/qa/security/SecretScanner.js +0 -55
  145. package/docs/README.md +0 -36
  146. package/docs/agents/README.md +0 -62
  147. package/docs/agents/install-for-agents.md +0 -56
  148. package/docs/agents/mcp-server.md +0 -212
  149. package/docs/agents/subagent-mode.md +0 -149
  150. package/docs/concepts/README.md +0 -47
  151. package/docs/concepts/jev-actionable-routing.md +0 -113
  152. package/docs/concepts/jev-decision-thresholds.md +0 -412
  153. package/docs/concepts/jev-efficiency.md +0 -217
  154. package/docs/concepts/jev-eval-2026-11-01.md +0 -78
  155. package/docs/concepts/limits.md +0 -52
  156. package/docs/concepts/memory.md +0 -10
  157. package/docs/concepts/security.md +0 -50
  158. package/docs/concepts/workspace-instructions.md +0 -29
  159. package/docs/getting-started/README.md +0 -82
  160. package/docs/getting-started/accounts.md +0 -78
  161. package/docs/getting-started/configure-providers.md +0 -132
  162. package/docs/guides/README.md +0 -13
  163. package/docs/guides/browser.md +0 -39
  164. package/docs/guides/desktop-app.md +0 -414
  165. package/docs/guides/extensions.md +0 -102
  166. package/docs/guides/graph-builder.md +0 -116
  167. package/docs/guides/headless.md +0 -46
  168. package/docs/guides/tui.md +0 -75
  169. package/docs/guides/update.md +0 -70
  170. package/docs/guides/web-search.md +0 -51
  171. package/docs/guides/windows-code-signing.md +0 -319
  172. package/docs/llms.txt +0 -45
  173. package/docs/reference/README.md +0 -7
  174. package/docs/reference/cli.md +0 -76
  175. package/docs/reference/config.md +0 -91
  176. package/docs/reference/slash-commands.md +0 -59
  177. package/docs/superpowers/plans/2026-11-01-claude-console-sign-in.md +0 -111
  178. package/docs/superpowers/plans/2026-11-01-jev-node-opt-in.md +0 -910
  179. package/docs/superpowers/plans/2026-11-02-workflow-pane.md +0 -398
  180. package/docs/superpowers/plans/2026-11-06-graph-soft-delete.md +0 -125
  181. package/docs/superpowers/plans/2026-11-09-orchestrator-delegation.md +0 -295
  182. package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +0 -203
  183. package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +0 -79
  184. package/docs/superpowers/specs/2026-10-31-work-line-summary-design.md +0 -50
  185. package/docs/superpowers/specs/2026-11-01-claude-console-sign-in-design.md +0 -176
  186. package/docs/superpowers/specs/2026-11-01-jev-node-opt-in-design.md +0 -164
  187. package/docs/superpowers/specs/2026-11-01-pr-section-design.md +0 -111
  188. package/docs/superpowers/specs/2026-11-02-workflow-pane-design.md +0 -130
  189. package/docs/superpowers/specs/2026-11-06-bundled-skills-design.md +0 -206
  190. package/docs/superpowers/specs/2026-11-09-orchestrator-delegation-design.md +0 -291
  191. package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +0 -182
  192. package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +0 -156
  193. package/scripts/jev-efficiency-eval.mjs +0 -187
  194. package/scripts/jev-efficiency-live.mjs +0 -193
  195. package/scripts/zcode-engine-replay.mjs +0 -223
  196. package/tests/agent-centric-mcp-test-plan.md +0 -208
  197. package/tests/analytics-settings-test-plan.md +0 -165
  198. package/tests/browser-cli-smoke.mjs +0 -276
  199. package/tests/browser-test-plan.md +0 -280
  200. package/tests/chat-side-panel-test-plan.md +0 -309
  201. package/tests/decision-engine-test-plan.md +0 -163
  202. package/tests/default-active-jev-test-plan.md +0 -85
  203. package/tests/harness-extensions-test-plan.md +0 -113
  204. package/tests/jev-all-decisions-test-plan.md +0 -156
  205. package/tests/jev-efficiency/criteria.json +0 -158
  206. package/tests/jev-efficiency/workloads.mjs +0 -242
  207. package/tests/jev-efficiency-test-plan.md +0 -198
  208. package/tests/permissions-sandbox-probe.mjs +0 -74
  209. package/tests/permissions-test-plan.md +0 -191
  210. package/tests/product-telemetry-test-plan.md +0 -536
  211. package/tests/thinking-stream-preview-test-plan.md +0 -136
  212. package/tests/zcode-react-engine-test-plan.md +0 -396
@@ -5,7 +5,13 @@ export interface MembershipVerdict {
5
5
  failureReason?: 'tls' | 'dns' | 'network';
6
6
  subject?: string;
7
7
  }
8
- /** A graph feature the account's membership does not reach. */
8
+ /**
9
+ * A graph feature the account's membership does not reach.
10
+ *
11
+ * The messages are the CLI's output, so they name `/login`; that advice is always a sentence of its
12
+ * own, which the desktop window replaces with its own way in (Settings › Account) when it shows the
13
+ * refusal (desktop/src/engine/errorWords.ts). Keep it that way when changing the wording.
14
+ */
9
15
  export declare class PaidMembershipRequiredError extends Error {
10
16
  constructor(message?: string);
11
17
  /**
@@ -1,10 +1,16 @@
1
- const FEATURES = 'the Andorra graph, custom graphs and the graph builder';
1
+ const FEATURES = 'the Andorra graph, custom graphs and the Graph Editor';
2
2
  const REASONS = {
3
3
  tls: 'a secure connection to the account service could not be verified',
4
4
  dns: 'the account service address could not be resolved',
5
5
  network: 'the account service could not be reached',
6
6
  };
7
- /** A graph feature the account's membership does not reach. */
7
+ /**
8
+ * A graph feature the account's membership does not reach.
9
+ *
10
+ * The messages are the CLI's output, so they name `/login`; that advice is always a sentence of its
11
+ * own, which the desktop window replaces with its own way in (Settings › Account) when it shows the
12
+ * refusal (desktop/src/engine/errorWords.ts). Keep it that way when changing the wording.
13
+ */
8
14
  export class PaidMembershipRequiredError extends Error {
9
15
  constructor(message = `Paid membership is required for ${FEATURES}. Use /login to sign in. If already signed in, check your membership or connection.`) { super(message); }
10
16
  /**
@@ -19,7 +25,7 @@ export class PaidMembershipRequiredError extends Error {
19
25
  return new PaidMembershipRequiredError(`Your Andorra membership could not be checked${reason}. This does not mean you were signed out; check your connection and retry.`);
20
26
  }
21
27
  if (!access.subject)
22
- return new PaidMembershipRequiredError(`You are signed out of your Andorra account. Use /login to sign in again; ${FEATURES} need a signed-in account.`);
28
+ return new PaidMembershipRequiredError(`You are signed out of your Andorra account; ${FEATURES} need a signed-in account. Use /login to sign in again.`);
23
29
  if (!access.paid)
24
30
  return new PaidMembershipRequiredError('This needs a paid membership, and your Andorra account does not have one.');
25
31
  return new PaidMembershipRequiredError();
@@ -41,7 +41,11 @@ export declare function storeProviderKeys(directory: string, keys: Map<string, s
41
41
  * them could not publish its configuration. Best-effort: the save's own failure is what is reported.
42
42
  */
43
43
  export declare function restoreProviderKeys(directory: string, providers: Iterable<string>, current: Map<string, string>): Promise<void>;
44
- /** Delete the keys a configuration directory saved for these providers. A machine without an OS store holds none. */
44
+ /**
45
+ * Delete the keys a configuration directory saved for these providers. A machine without an OS store
46
+ * holds none. A locked one this session cannot unlock still holds them, so its failure is reported and
47
+ * the keys stay pending deletion for a later save to retry.
48
+ */
45
49
  export declare function removeProviderKeys(directory: string, providers: Iterable<string>): Promise<void>;
46
50
  /** Whether saving should move plaintext keys out of `config.json` on this machine. */
47
51
  export declare function providerKeysBelongInKeyring(environment?: NodeJS.ProcessEnv): boolean;
@@ -1,5 +1,5 @@
1
1
  import { resolve } from 'node:path';
2
- import { credentialStoreMode, KeyringAbsentError, KeyringCredentialStore } from './auth/store.js';
2
+ import { credentialStoreMode, KeyringAbsentError, KeyringCredentialStore, KeyringUnreachableError } from './auth/store.js';
3
3
  /**
4
4
  * Saved provider API keys, kept in the OS credential store rather than in `config.json`.
5
5
  *
@@ -102,14 +102,18 @@ export async function restoreProviderKeys(directory, providers, current) {
102
102
  await (key === undefined ? vaultFor(directory, provider).remove() : vaultFor(directory, provider).write(key)).catch(() => { });
103
103
  }
104
104
  }
105
- /** Delete the keys a configuration directory saved for these providers. A machine without an OS store holds none. */
105
+ /**
106
+ * Delete the keys a configuration directory saved for these providers. A machine without an OS store
107
+ * holds none. A locked one this session cannot unlock still holds them, so its failure is reported and
108
+ * the keys stay pending deletion for a later save to retry.
109
+ */
106
110
  export async function removeProviderKeys(directory, providers) {
107
111
  for (const provider of new Set(providers)) {
108
112
  try {
109
113
  await vaultFor(directory, provider).remove();
110
114
  }
111
115
  catch (error) {
112
- if (error instanceof KeyringAbsentError)
116
+ if (error instanceof KeyringAbsentError && !(error instanceof KeyringUnreachableError))
113
117
  return;
114
118
  throw new Error('Unable to remove saved provider API keys from the OS credential store. Unlock it and retry.', { cause: error });
115
119
  }
@@ -1,8 +1,11 @@
1
1
  import type { CommandScreenUI } from './command-screens.js';
2
2
  import { type Config } from './config.js';
3
+ import { type ProviderConfig } from './providers.js';
3
4
  import { retireUnsavedCodexAccounts } from './codex-auth.js';
4
5
  import type { AnthropicConsoleAuth } from './anthropic-console-auth.js';
5
6
  type ConsoleAuth = Pick<AnthropicConsoleAuth, 'start' | 'status' | 'cancel'>;
7
+ /** Lists the model ids an endpoint offers with the draft's credentials, as a run would request them. */
8
+ type ModelLister = (provider: ProviderConfig, signal: AbortSignal) => Promise<string[] | undefined>;
6
9
  /** Provider edits remain isolated until the caller atomically persists the returned draft. */
7
- export declare function editProviderSettings(config: Config, id: string | undefined, ui: CommandScreenUI, signal: AbortSignal, login?: typeof import('./codex-auth.js').loginCodex, retire?: typeof retireUnsavedCodexAccounts, consoleAuth?: () => Promise<ConsoleAuth>): Promise<Config | undefined>;
10
+ export declare function editProviderSettings(config: Config, id: string | undefined, ui: CommandScreenUI, signal: AbortSignal, login?: typeof import('./codex-auth.js').loginCodex, retire?: typeof retireUnsavedCodexAccounts, consoleAuth?: () => Promise<ConsoleAuth>, discover?: ModelLister): Promise<Config | undefined>;
8
11
  export {};
@@ -8,20 +8,21 @@ import { ANTHROPIC_CONSOLE_BASE_URL, anthropicAccountHome } from './anthropic-cr
8
8
  import { GROK_BASE_URL } from './grok-provider.js';
9
9
  import { OPENCODE_BASE_URL } from './opencode-cli-provider.js';
10
10
  const defaultConsoleAuth = async () => new (await import('./anthropic-console-auth.js')).AnthropicConsoleAuth();
11
+ const defaultModelLister = async (provider, signal) => createAdapter(provider).listModels?.(signal);
11
12
  /** Provider edits remain isolated until the caller atomically persists the returned draft. */
12
- export async function editProviderSettings(config, id, ui, signal, login = async (options) => (await import('./codex-auth.js')).loginCodex(options), retire = retireUnsavedCodexAccounts, consoleAuth = defaultConsoleAuth) {
13
+ export async function editProviderSettings(config, id, ui, signal, login = async (options) => (await import('./codex-auth.js')).loginCodex(options), retire = retireUnsavedCodexAccounts, consoleAuth = defaultConsoleAuth, discover = defaultModelLister) {
13
14
  // Every exit that returns no draft abandons the edit, including one an abort or a failing prompt
14
15
  // raises: a login or account slot made while editing must not outlive an edit that was never saved.
15
16
  const abandon = {};
16
17
  try {
17
- return await editDraft(config, id, ui, signal, login, retire, consoleAuth, abandon);
18
+ return await editDraft(config, id, ui, signal, login, retire, consoleAuth, abandon, discover);
18
19
  }
19
20
  catch (error) {
20
21
  await abandon.discard?.().catch(() => { });
21
22
  throw error;
22
23
  }
23
24
  }
24
- async function editDraft(config, id, ui, signal, login, retire, consoleAuth, abandon) {
25
+ async function editDraft(config, id, ui, signal, login, retire, consoleAuth, abandon, discover) {
25
26
  if (!ui.question)
26
27
  throw new Error('Provider settings require interactive input.');
27
28
  const draft = structuredClone(config);
@@ -239,7 +240,47 @@ async function editDraft(config, id, ui, signal, login, retire, consoleAuth, aba
239
240
  candidate.baseUrl = value;
240
241
  }
241
242
  else if (field === 'model') {
242
- const value = await ask('Model ID (blank keeps current)');
243
+ // The picker offers what the endpoint lists next to the models already configured, and a row
244
+ // for typing an id: a listing that fails or is empty must never stop a person naming a model.
245
+ // Only read-only catalogs are consulted here; a ChatGPT sign-in stays behind its own row.
246
+ let listed = [];
247
+ let unavailable = false;
248
+ try {
249
+ const models = await ui.loadScreen('Available models', async (loadSignal) => {
250
+ if (isCodex)
251
+ return [];
252
+ if (isClaude)
253
+ return (await (await import('./claude-provider.js')).readClaudeCatalog(loadSignal)).models.map(id => ({ id }));
254
+ if (isGrok)
255
+ return (await (await import('./grok-provider.js')).readGrokCatalog(loadSignal)).models.map(id => ({ id }));
256
+ if (isOpenCode)
257
+ return (await (await import('./opencode-cli-provider.js')).readOpenCodeCatalog(loadSignal)).models.map(model => ({ id: model.id }));
258
+ return (await discover(candidate, loadSignal) ?? []).map(id => ({ id }));
259
+ }, { signal });
260
+ if (!models)
261
+ continue;
262
+ listed = models.filter(model => model.id.trim());
263
+ }
264
+ catch (error) {
265
+ if (signal.aborted)
266
+ throw error;
267
+ unavailable = true;
268
+ }
269
+ const rows = new Map();
270
+ const row = (model, recommended) => ({ id: `:use:${model}`, label: `${model}${model === candidate.model ? ' · active' : ''}${recommended ? ' (recommended)' : ''}` });
271
+ for (const model of providerModels(candidate))
272
+ rows.set(model, row(model));
273
+ for (const model of listed)
274
+ if (!rows.has(model.id))
275
+ rows.set(model.id, row(model.id, model.isDefault));
276
+ const recommended = listed.find(model => model.isDefault)?.id;
277
+ const preferred = candidate.model && rows.has(candidate.model) ? candidate.model : recommended;
278
+ const title = unavailable ? 'Active model (could not list available models)'
279
+ : !isCodex && !listed.length ? 'Active model (no models listed)' : 'Active model';
280
+ const choice = await choose(title, [...rows.values(), { id: ':custom', label: '+ Enter a custom model ID' }], preferred ? `:use:${preferred}` : undefined);
281
+ if (!choice)
282
+ continue;
283
+ const value = choice === ':custom' ? await ask('Model ID (blank cancels)') : choice.slice(5);
243
284
  if (!value)
244
285
  continue;
245
286
  if (value !== provider.model)
@@ -420,7 +461,7 @@ async function editDraft(config, id, ui, signal, login, retire, consoleAuth, aba
420
461
  candidate.codexEmail = result.email;
421
462
  return result.models;
422
463
  }
423
- return (await createAdapter(candidate).listModels?.(loadSignal) ?? []).map(id => ({ id }));
464
+ return (await discover(candidate, loadSignal) ?? []).map(id => ({ id }));
424
465
  }, { signal });
425
466
  if (!models)
426
467
  continue;
@@ -1,4 +1,4 @@
1
- import type { WakeCarry } from './timers.js';
1
+ import type { WakeCarry, WakeOrigin } from './timers.js';
2
2
  /**
3
3
  * The pull request a session opened, and what the user (or the agent) asked the engine to do about it.
4
4
  *
@@ -22,14 +22,22 @@ export interface SessionPullRequest {
22
22
  handledThrough?: string;
23
23
  /**
24
24
  * An Auto-fix wake armed and not yet delivered. The handled mark moves to `through` only once a run carries
25
- * the prompt: a wake lost with its engine is armed again by the next watcher instead of being skipped.
25
+ * the prompt: a wake lost with its engine is armed again by the next watcher instead of being skipped. `prompt` is
26
+ * the wake's text, so a run waiting for this review in another engine can take it there (`await_review`).
26
27
  */
27
28
  pendingFix?: {
28
29
  wakeId: string;
29
30
  through: string;
31
+ prompt?: string;
30
32
  };
31
33
  /** The selections of the run that attached or last configured the PR, so an Auto-fix run continues under them. */
32
34
  carry?: WakeCarry;
35
+ /**
36
+ * The graph node an Auto-fix prompt goes back to: the node that switched Auto-fix on, or failing that the node that
37
+ * attached the PR. Without it the prompt starts a new task at the graph's entry node, which is a different agent
38
+ * from the one that owns the PR's work.
39
+ */
40
+ origin?: WakeOrigin;
33
41
  /** The signed-in `gh` account that can read this PR; every call for it runs as this account. */
34
42
  ghUser?: string;
35
43
  /** Why the watcher last could not read this PR; cleared by the next successful read. */
@@ -160,10 +168,38 @@ export declare function applyPullRequestSettings(gh: GhRunner, current: SessionP
160
168
  */
161
169
  export declare function applyPullRequestSettingsAsReadableAccount(gh: GhRunner, current: SessionPullRequest, changes: PullRequestSettings, now?: Date): Promise<SessionPullRequest>;
162
170
  /** A session's pull request as its run's `pull_request` tool reaches it; bound to that session by the engine. */
171
+ /**
172
+ * How a wait for the next review ended. `comments` carries the Auto-fix prompt the wait took in place of a wake;
173
+ * `steered` means the user sent the run a message while it waited; `aborted` that the run was stopped.
174
+ */
175
+ export type ReviewWait = {
176
+ kind: 'comments';
177
+ prompt: string;
178
+ } | {
179
+ kind: 'finished';
180
+ pullRequest: SessionPullRequest;
181
+ } | {
182
+ kind: 'off';
183
+ pullRequest: SessionPullRequest;
184
+ } | {
185
+ kind: 'none';
186
+ } | {
187
+ kind: 'timeout';
188
+ } | {
189
+ kind: 'steered';
190
+ } | {
191
+ kind: 'aborted';
192
+ };
163
193
  export interface PullRequestControl {
164
194
  status(): Promise<SessionPullRequest | undefined>;
165
- attach(url: string, settings: PullRequestSettings): Promise<SessionPullRequest>;
166
- update(settings: PullRequestSettings): Promise<SessionPullRequest>;
195
+ /** `origin` is the graph node making the call, when one is: the node Auto-fix wakes. */
196
+ attach(url: string, settings: PullRequestSettings, origin?: WakeOrigin): Promise<SessionPullRequest>;
197
+ update(settings: PullRequestSettings, origin?: WakeOrigin): Promise<SessionPullRequest>;
198
+ /**
199
+ * Wait, inside the calling run, for the next review comments Auto-fix would wake the session for, the PR to be
200
+ * merged or closed, Auto-fix to be switched off, the user to message the run, `timeoutMs`, or `signal`.
201
+ */
202
+ awaitReview?(signal: AbortSignal, timeoutMs: number, origin?: WakeOrigin): Promise<ReviewWait>;
167
203
  dismiss(): Promise<void>;
168
204
  }
169
205
  /** Read the settings a caller passed, ignoring anything that is not a boolean setting. */
@@ -233,8 +269,8 @@ export interface PullRequestWatcherOptions {
233
269
  intervalMs?: number;
234
270
  /** A PR's stored state changed. */
235
271
  onUpdated: (sessionId: string, pullRequest: SessionPullRequest) => void;
236
- /** Arm an Auto-fix prompt for the session, continuing under `carry`; returns the wake's id. */
237
- wake: (sessionId: string, prompt: string, carry: WakeCarry | undefined) => string;
272
+ /** Arm an Auto-fix prompt for the session, continuing under `carry` and addressed to `origin`'s node; returns the wake's id. */
273
+ wake: (sessionId: string, prompt: string, carry: WakeCarry | undefined, origin: WakeOrigin | undefined) => string;
238
274
  /** Whether this engine still holds the wake `id`, armed and not yet delivered. */
239
275
  wakePending: (id: string) => boolean;
240
276
  log?: (level: 'info' | 'warn', detail: string) => void;
@@ -44,7 +44,14 @@ function validPullRequest(value) {
44
44
  && typeof record.autoFix === 'boolean' && typeof record.mergeWhenReady === 'boolean'
45
45
  && typeof record.attachedAt === 'string' && typeof record.updatedAt === 'string'
46
46
  && (record.ghUser === undefined || typeof record.ghUser === 'string')
47
- && (record.watchError === undefined || typeof record.watchError === 'string');
47
+ && (record.watchError === undefined || typeof record.watchError === 'string')
48
+ && (record.origin === undefined || validOrigin(record.origin));
49
+ }
50
+ function validOrigin(value) {
51
+ if (typeof value !== 'object' || value === null)
52
+ return false;
53
+ const origin = value;
54
+ return typeof origin.runId === 'string' && origin.runId.length > 0 && typeof origin.nodeId === 'string' && origin.nodeId.length > 0;
48
55
  }
49
56
  /**
50
57
  * A stored record as this version keeps it. Records written while Auto-archive existed still carry its two fields,
@@ -700,8 +707,9 @@ export class PullRequestWatcher {
700
707
  if (current.pendingFix && this.options.wakePending(current.pendingFix.wakeId))
701
708
  return;
702
709
  // The handled mark is not moved here: it moves when a run carries the prompt (`markAutoFixDelivered`).
703
- const wakeId = this.options.wake(sessionId, autoFixPrompt(current, found), current.carry);
704
- const next = { ...current, pendingFix: { wakeId, through: found.newest }, updatedAt: new Date().toISOString() };
710
+ const prompt = autoFixPrompt(current, found);
711
+ const wakeId = this.options.wake(sessionId, prompt, current.carry, current.origin);
712
+ const next = { ...current, pendingFix: { wakeId, through: found.newest, prompt }, updatedAt: new Date().toISOString() };
705
713
  await writePullRequest(home, sessionId, next);
706
714
  this.options.onUpdated(sessionId, next);
707
715
  });
@@ -12,14 +12,8 @@
12
12
  */
13
13
  /** The qa.* tools the guidance can name, in the order it names them. */
14
14
  const QA_TOOLS = [
15
- ['qa.fast', 'lint + typecheck + related tests + diff/secret review'],
16
- ['qa.test', 'scoped unit runs: related/file/pattern/all'],
17
15
  ['qa.terminal', 'persistent PTY/ConPTY CLI/TUI interaction'],
18
- ['qa.browser', ''],
19
- ['qa.security', ''],
20
- ['qa.deep', 'merge gate'],
21
- ['qa.status', ''],
22
- ['qa.inspect_project', ''],
16
+ ['qa.browser', 'page load, console and network check'],
23
17
  ];
24
18
  /**
25
19
  * The QA guidance for one node, or the empty string for a node that holds
@@ -32,11 +26,12 @@ export function qaGuidance(options) {
32
26
  return '';
33
27
  const has = (name) => held.has(name);
34
28
  const tester = options.laterTester;
29
+ // Lint, tests and builds are not qa.* tools: the agent runs the project's own commands through
30
+ // its shell. A pipeline of them (qa.fast, qa.deep and four more) was removed after it cost about
31
+ // two extra requests per run and mostly reported failures the change had not caused.
35
32
  const lines = [
36
- `- Use the qa.* tools for quality checks instead of ad-hoc shell when they fit: ${tools.map(([name, description]) => description ? `${name} (${description})` : name).join(', ')}.`,
33
+ `- Use the qa.* tools instead of ad-hoc shell when they fit: ${tools.map(([name, description]) => `${name} (${description})`).join(', ')}. Lint, tests and builds have no qa.* tool: run the project's own commands for them.`,
37
34
  ];
38
- if (has('qa.fast'))
39
- lines.push(`- After you edit code, run qa.fast before claiming the change works; when a check fails, fix it and re-run the narrowest check${has('qa.test') ? ' (qa.test related/file/pattern)' : ''} before the full qa.fast.`);
40
35
  if (tester !== undefined) {
41
36
  lines.push(`- ${JSON.stringify(tester)} runs after this node and tests the change in the running app. Do not launch, click through, type into or screenshot the app yourself, and do not script keyboard or mouse input into any window: build the change, run the checks that cover it, and hand ${JSON.stringify(tester)} what it needs to test.`);
42
37
  }
@@ -46,14 +41,6 @@ export function qaGuidance(options) {
46
41
  if (has('qa.browser'))
47
42
  lines.push('- Frontend/UI changes additionally need qa.browser against a running app.');
48
43
  }
49
- if (has('qa.security'))
50
- lines.push('- Security-sensitive or dependency changes need qa.security. Treat a secret-scan finding as a hard blocker: rotate and remove the secret, never commit it.');
51
- // The merge gate adds browser checks and runtime smoke runs for the change it classifies, which
52
- // is the testing a later tester owns.
53
- if (has('qa.deep') && tester === undefined)
54
- lines.push('- Before declaring feature work complete, run qa.deep; report the gate verdict. If a required check is blocked, say so plainly instead of calling the work verified.');
55
- if (has('qa.status'))
56
- lines.push('- Checks are remembered per session: qa.status shows stale results after later edits.');
57
- lines.push('- Commands classified destructive (e.g. recursive deletes of system paths) are denied in every mode, including yolo.', '- On Windows, run foreground child commands directly with PowerShell\'s invocation operator (for example `& $exe @args`) instead of wrapping them in `Start-Job` just to impose a timeout; the shell tool already owns timeout and process-tree cleanup. Avoid `Start-Process -ArgumentList @(…)` for multi-word arguments unless you quote them explicitly, because Windows PowerShell flattens the array before launching the child.', '- Full logs live under .andorra/runtime/qa/<run-id>/ (referenced by logRef); read them with Read when the summary is not enough.');
44
+ lines.push('- Commands classified destructive (e.g. recursive deletes of system paths) are denied in every mode, including yolo.', '- On Windows, run foreground child commands directly with PowerShell\'s invocation operator (for example `& $exe @args`) instead of wrapping them in `Start-Job` just to impose a timeout; the shell tool already owns timeout and process-tree cleanup. Avoid `Start-Process -ArgumentList @(…)` for multi-word arguments unless you quote them explicitly, because Windows PowerShell flattens the array before launching the child.');
58
45
  return `QA tooling:\n${lines.join('\n')}`;
59
46
  }
@@ -1,7 +1,5 @@
1
1
  export { createQaTools } from './tools.js';
2
- export { getQaOrchestrator, QaOrchestrator } from './orchestrator/QaOrchestrator.js';
3
2
  export { disposeAllQaProcesses, getQaProcessManager, listQaProcesses, stopQaProcess } from './runtime/ProcessManager.js';
4
3
  export { disposeAllQaPtys, getQaPtyManager, listQaPtys, stopQaPty } from './runtime/PtyManager.js';
5
4
  export { onBackgroundChange } from './runtime/changes.js';
6
- export { detectRuntimeCapabilities } from './runtime-detect.js';
7
5
  export { qaGuidance, type QaGuidanceOptions } from './guidance.js';
@@ -1,7 +1,5 @@
1
1
  export { createQaTools } from './tools.js';
2
- export { getQaOrchestrator, QaOrchestrator } from './orchestrator/QaOrchestrator.js';
3
2
  export { disposeAllQaProcesses, getQaProcessManager, listQaProcesses, stopQaProcess } from './runtime/ProcessManager.js';
4
3
  export { disposeAllQaPtys, getQaPtyManager, listQaPtys, stopQaPty } from './runtime/PtyManager.js';
5
4
  export { onBackgroundChange } from './runtime/changes.js';
6
- export { detectRuntimeCapabilities } from './runtime-detect.js';
7
5
  export { qaGuidance } from './guidance.js';
@@ -13,5 +13,9 @@ export declare const DEFAULT_AUTO_REPAIR: {
13
13
  enabled: boolean;
14
14
  maxAttemptsPerCheck: number;
15
15
  };
16
- /** Marker directories excluded from QA scans and change analysis. */
16
+ /**
17
+ * Marker directories excluded from QA scans and change analysis. `.codegraph` is the code index
18
+ * Andorra Code writes into the workspace itself; it is never part of the user's change,
19
+ * and neither are the caches a test run leaves behind (one pytest run added four .pyc files to a one-file change).
20
+ */
17
21
  export declare const QA_EXCLUDED_DIRS: Set<string>;
@@ -11,5 +11,9 @@ export const DEFAULT_SECURITY = {
11
11
  dependencyScan: true, secretScan: true, semgrep: false, failOn: ['critical', 'high'],
12
12
  };
13
13
  export const DEFAULT_AUTO_REPAIR = { enabled: true, maxAttemptsPerCheck: 3 };
14
- /** Marker directories excluded from QA scans and change analysis. */
15
- export const QA_EXCLUDED_DIRS = new Set(['.git', 'node_modules', '.andorracode', '.andorra', 'dist', 'build', 'out', 'coverage', '.next', 'vendor']);
14
+ /**
15
+ * Marker directories excluded from QA scans and change analysis. `.codegraph` is the code index
16
+ * Andorra Code writes into the workspace itself; it is never part of the user's change,
17
+ * and neither are the caches a test run leaves behind (one pytest run added four .pyc files to a one-file change).
18
+ */
19
+ export const QA_EXCLUDED_DIRS = new Set(['.git', 'node_modules', '.andorracode', '.andorra', '.codegraph', '__pycache__', '.pytest_cache', 'dist', 'build', 'out', 'coverage', '.next', 'vendor']);
@@ -1,3 +1,21 @@
1
1
  import type { Tool } from '../types.js';
2
- /** The LLM-facing QA tools. All command execution is permission-gated. */
2
+ import type { QaCheckResult } from './types.js';
3
+ /**
4
+ * The host work behind qa.browser, behind one seam so a test can stand in for the browser and
5
+ * observe that permission was decided before it ran.
6
+ */
7
+ export declare const qaBrowserHost: {
8
+ check(options: {
9
+ workspace: string;
10
+ url?: string;
11
+ accessibility?: boolean;
12
+ signal: AbortSignal;
13
+ }): Promise<QaCheckResult[]>;
14
+ };
15
+ /**
16
+ * The LLM-facing QA tools: a terminal to drive a CLI or TUI and a browser page check. All command
17
+ * execution is permission-gated. The check pipeline that used to sit beside them (qa.fast,
18
+ * qa.test, qa.deep, qa.security, qa.status, qa.inspect_project) is gone: an agent verifies a
19
+ * change with the project's own commands through its shell.
20
+ */
3
21
  export declare function createQaTools(): Tool[];
@@ -1,9 +1,9 @@
1
1
  import { clipText } from '../text.js';
2
- import { getQaOrchestrator } from './orchestrator/QaOrchestrator.js';
2
+ import { deriveProfile } from './profile/ProjectInspector.js';
3
+ import { runBrowserQa } from './browser/PlaywrightRunner.js';
3
4
  import { createQaAuthorizer } from './qa-authorize.js';
4
5
  import { assertNotHostKill } from '../host-process-guard.js';
5
6
  import { getQaPtyManager } from './runtime/PtyManager.js';
6
- const RESULT_LIMIT = 25;
7
7
  const ERROR_LIMIT = 20;
8
8
  function compactResult(result) {
9
9
  return {
@@ -15,36 +15,17 @@ function compactResult(result) {
15
15
  ...(result.repairExhausted ? { repairExhausted: true } : {}),
16
16
  };
17
17
  }
18
- function reportText(report) {
19
- const lines = report.results.map(result => `${result.id}: ${result.status.toUpperCase()} — ${result.summary}`);
20
- const gate = report.gate ? `\nMerge gate (${report.gate.steps.join(', ')}): ${report.gate.verdict.toUpperCase()}` : '';
21
- return clipText(`QA run ${report.runId}: ${report.verdict.toUpperCase()}.${gate}\n${lines.join('\n')}`, 24_000);
22
- }
23
- function reportOutput(report) {
24
- return clipText(JSON.stringify({
25
- runId: report.runId, verdict: report.verdict, fingerprint: report.fingerprint,
26
- changedFiles: report.changedFiles.slice(0, 100),
27
- ...(report.gate ? { gate: report.gate } : {}),
28
- results: report.results.slice(0, RESULT_LIMIT).map(compactResult),
29
- summary: reportText(report),
30
- }), 24_000);
31
- }
32
- function reportEventOutput(output) {
33
- try {
34
- const parsed = JSON.parse(output);
35
- return JSON.stringify({ runId: parsed.runId, verdict: parsed.verdict, results: parsed.results?.map(result => ({ id: result.id, status: result.status })) });
36
- }
37
- catch {
38
- return output.slice(0, 500);
39
- }
40
- }
41
- function validateStringArray(value, name, max) {
42
- if (value === undefined)
43
- return undefined;
44
- if (!Array.isArray(value) || value.length > max || value.some(item => typeof item !== 'string' || !item || item.length > 1024))
45
- throw new Error(`${name} must be an array of at most ${max} nonempty strings`);
46
- return value;
47
- }
18
+ /**
19
+ * The host work behind qa.browser, behind one seam so a test can stand in for the browser and
20
+ * observe that permission was decided before it ran.
21
+ */
22
+ export const qaBrowserHost = {
23
+ async check(options) {
24
+ const { profile } = await deriveProfile(options.workspace);
25
+ const outcome = await runBrowserQa({ workspace: options.workspace, profile, ...(options.url ? { url: options.url } : {}), ...(options.accessibility !== undefined ? { accessibility: options.accessibility } : {}), signal: options.signal });
26
+ return [outcome.smoke, outcome.consoleErrors, outcome.networkErrors, ...(outcome.accessibility ? [outcome.accessibility] : [])];
27
+ },
28
+ };
48
29
  function assertTerminalApplication(command) {
49
30
  const trimmed = command.trim();
50
31
  const first = /^(?:"([^"]+)"|'([^']+)'|(\S+))/.exec(trimmed)?.slice(1).find(Boolean)?.toLowerCase() ?? '';
@@ -65,71 +46,14 @@ function assertTerminalApplication(command) {
65
46
  }
66
47
  }
67
48
  }
68
- /** The LLM-facing QA tools. All command execution is permission-gated. */
49
+ /**
50
+ * The LLM-facing QA tools: a terminal to drive a CLI or TUI and a browser page check. All command
51
+ * execution is permission-gated. The check pipeline that used to sit beside them (qa.fast,
52
+ * qa.test, qa.deep, qa.security, qa.status, qa.inspect_project) is gone: an agent verifies a
53
+ * change with the project's own commands through its shell.
54
+ */
69
55
  export function createQaTools() {
70
56
  return [
71
- {
72
- name: 'qa.inspect_project',
73
- family: 'qa',
74
- executionMode: 'sequential',
75
- description: 'Report the derived QA profile for this workspace: language, framework, package manager, the lint/typecheck/unit/build/e2e commands QA will run, detected runtime tools, current changed files and their classification, and any .andorra/qa.yaml validation error. Read-only; runs no commands.',
76
- parameters: { type: 'object', properties: {}, additionalProperties: false },
77
- execute: async (_args, context) => {
78
- const orchestrator = getQaOrchestrator(context.workspace);
79
- const summary = await orchestrator.profileSummary(context.signal);
80
- const snapshot = await orchestrator.changeSnapshot(context.signal);
81
- return `${summary}\nchanged files (${snapshot.changedFiles.length}): ${snapshot.changedFiles.slice(0, 60).join(', ') || 'none'}\nclassification: ${Object.entries(snapshot.classification).filter(([, active]) => active).map(([name]) => name).join(', ') || 'none'}`;
82
- },
83
- },
84
- {
85
- name: 'qa.fast',
86
- family: 'qa',
87
- executionMode: 'sequential',
88
- description: 'Run the fast QA pipeline over the current working tree: lint, typecheck, unit tests related to changed files, then automated diff review and secret scan (redacted). Set includeBuild when the build matters (packaging or build-config changes). After any fix, re-run this before trusting the result.',
89
- parameters: {
90
- type: 'object',
91
- properties: { includeBuild: { type: 'boolean', description: 'Also run the build check; default false' } },
92
- additionalProperties: false,
93
- },
94
- execute: async (args, context) => {
95
- if (args.includeBuild !== undefined && typeof args.includeBuild !== 'boolean')
96
- throw new Error('includeBuild must be a boolean');
97
- const orchestrator = getQaOrchestrator(context.workspace);
98
- const authorizer = createQaAuthorizer('qa.fast', context);
99
- authorizer.assertPlanned(orchestrator.plannedCommands(await orchestrator.getProfile(context.signal)));
100
- const report = await orchestrator.fast({ includeBuild: args.includeBuild === true, signal: context.signal, authorize: command => authorizer.authorize(command) });
101
- return reportOutput(report);
102
- },
103
- eventOutput: reportEventOutput,
104
- },
105
- {
106
- name: 'qa.test',
107
- family: 'qa',
108
- executionMode: 'sequential',
109
- description: 'Run the project unit suite scoped by mode: "related" re-runs tests related to changed files, "file" runs the exact test files listed, "pattern" runs tests whose name matches a filter, and "all" runs the full suite. Prefer related/file while iterating on a specific failure.',
110
- parameters: {
111
- type: 'object',
112
- properties: {
113
- mode: { type: 'string', enum: ['related', 'file', 'pattern', 'all'], description: 'Test scoping mode' },
114
- files: { type: 'array', items: { type: 'string' }, description: 'Workspace-relative file paths; required for related and file modes' },
115
- pattern: { type: 'string', description: 'Test name filter; required for pattern mode' },
116
- },
117
- required: ['mode'],
118
- additionalProperties: false,
119
- },
120
- execute: async (args, context) => {
121
- const mode = args.mode;
122
- const files = validateStringArray(args.files, 'files', 100);
123
- const pattern = args.pattern;
124
- if (typeof pattern === 'string' && (pattern.includes('\0') || pattern.length > 512))
125
- throw new Error('pattern must be under 512 characters without NUL bytes');
126
- const orchestrator = getQaOrchestrator(context.workspace);
127
- const authorizer = createQaAuthorizer('qa.test', context);
128
- authorizer.assertPlanned(orchestrator.plannedCommands(await orchestrator.getProfile(context.signal)));
129
- const result = await orchestrator.test({ mode, files, pattern }, { signal: context.signal, authorize: command => authorizer.authorize(command) });
130
- return JSON.stringify(compactResult(result));
131
- },
132
- },
133
57
  {
134
58
  name: 'qa.terminal',
135
59
  family: 'qa',
@@ -248,58 +172,9 @@ export function createQaTools() {
248
172
  throw new Error('url must be an http(s) URL');
249
173
  if (args.accessibility !== undefined && typeof args.accessibility !== 'boolean')
250
174
  throw new Error('accessibility must be a boolean');
251
- const orchestrator = getQaOrchestrator(context.workspace);
252
- const results = await orchestrator.browser({ ...(url ? { url } : {}), ...(typeof args.accessibility === 'boolean' ? { accessibility: args.accessibility } : {}), signal: context.signal });
253
- return clipText(JSON.stringify({ results: results.map(compactResult), summary: results.map(result => `${result.id}: ${result.status.toUpperCase()} — ${result.summary}`).join('\n') }), 24_000);
254
- },
255
- },
256
- {
257
- name: 'qa.security',
258
- family: 'qa',
259
- executionMode: 'sequential',
260
- description: 'Run security checks over the working tree: the built-in secret scan over all added lines (matched values are redacted), a dependency audit (npm/pnpm/yarn) against the configured severity cascade, and semgrep when enabled in .andorra/qa.yaml. Always run this before considering a merge; secret findings block the merge gate.',
261
- parameters: { type: 'object', properties: {}, additionalProperties: false },
262
- execute: async (_args, context) => {
263
- const orchestrator = getQaOrchestrator(context.workspace);
264
- const authorizer = createQaAuthorizer('qa.security', context);
265
- authorizer.assertPlanned(orchestrator.plannedCommands(await orchestrator.getProfile(context.signal)));
266
- const results = await orchestrator.security({ signal: context.signal, authorize: command => authorizer.authorize(command) });
175
+ const results = await qaBrowserHost.check({ workspace: context.workspace, ...(url ? { url } : {}), ...(typeof args.accessibility === 'boolean' ? { accessibility: args.accessibility } : {}), signal: context.signal });
267
176
  return clipText(JSON.stringify({ results: results.map(compactResult), summary: results.map(result => `${result.id}: ${result.status.toUpperCase()} — ${result.summary}`).join('\n') }), 24_000);
268
177
  },
269
178
  },
270
- {
271
- name: 'qa.deep',
272
- family: 'qa',
273
- executionMode: 'sequential',
274
- description: 'Run the full merge gate for the current change set: the configured base gate (lint, typecheck, related tests, build, diff review, secret scan) plus checks the change classification adds — browser checks for frontend changes, runtime smoke when a startup command exists, API smoke, dependency audit, semgrep. Optional checks narrows to a subset of gate step ids. A ready verdict means every required check passed or was legitimately skipped.',
275
- parameters: {
276
- type: 'object',
277
- properties: { checks: { type: 'array', items: { type: 'string' }, description: 'Optional subset of gate step ids to run' } },
278
- additionalProperties: false,
279
- },
280
- execute: async (args, context) => {
281
- const checks = validateStringArray(args.checks, 'checks', 32);
282
- const orchestrator = getQaOrchestrator(context.workspace);
283
- const authorizer = createQaAuthorizer('qa.deep', context);
284
- authorizer.assertPlanned(orchestrator.plannedCommands(await orchestrator.getProfile(context.signal)));
285
- const report = await orchestrator.deep({ signal: context.signal, authorize: command => authorizer.authorize(command), ...(checks ? { checks } : {}) });
286
- return reportOutput(report);
287
- },
288
- eventOutput: reportEventOutput,
289
- },
290
- {
291
- name: 'qa.status',
292
- family: 'qa',
293
- executionMode: 'sequential',
294
- description: 'Show the QA session view: derived profile summary, every recorded check result this session, whether results are stale because the working tree changed since they were recorded, consecutive failure counts per check, and the last merge-gate verdict. Runs host Git and runtime probes; restricted permissions require scoped approval.',
295
- parameters: { type: 'object', properties: {}, additionalProperties: false },
296
- execute: async (_args, context) => {
297
- const orchestrator = getQaOrchestrator(context.workspace);
298
- const { summary, state } = await orchestrator.status(context.signal);
299
- const checks = Object.values(state.checks);
300
- const lines = checks.map(result => `${result.id}: ${result.status.toUpperCase()} — ${result.summary}${result.repairExhausted ? ' (repair attempts exhausted)' : ''}${orchestrator.isStale(result.fingerprint ?? '') ? ' [STALE: working tree changed since this result]' : ''}`);
301
- return `${summary}\n\nQA results:\n${lines.join('\n') || 'none yet'}\nchangedSinceLastQa: ${state.changedSinceLastQa}\nmergeReady: ${state.mergeReady}${state.lastGateVerdict ? ` (last verdict ${state.lastGateVerdict})` : ''}`;
302
- },
303
- },
304
179
  ];
305
180
  }