@andorra-labs/code 0.1.8 → 0.1.10
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/THIRD_PARTY_NOTICES.md +2 -1
- package/dist/src/account-presentation.d.ts +11 -0
- package/dist/src/account-presentation.js +29 -2
- package/dist/src/agent-execution.js +57 -4
- package/dist/src/agent-mcp.d.ts +12 -0
- package/dist/src/agent-mcp.js +81 -2
- package/dist/src/app-server/protocol.d.ts +120 -1
- package/dist/src/app-server/protocol.js +8 -1
- package/dist/src/app-server/reasoning.d.ts +0 -8
- package/dist/src/app-server/reasoning.js +15 -28
- package/dist/src/app-server.d.ts +32 -0
- package/dist/src/app-server.js +214 -21
- package/dist/src/auth/AuthManager.d.ts +15 -0
- package/dist/src/auth/AuthManager.js +66 -7
- package/dist/src/auth/index.d.ts +1 -1
- package/dist/src/auth/index.js +1 -1
- package/dist/src/auth/store.d.ts +17 -1
- package/dist/src/auth/store.js +25 -2
- package/dist/src/browser-runner.js +1 -2
- package/dist/src/browser-server.js +10 -2
- package/dist/src/browser-session.js +6 -2
- package/dist/src/browser-stealth.d.ts +29 -0
- package/dist/src/browser-stealth.js +166 -0
- package/dist/src/browser-ui/app.js +123 -28
- package/dist/src/browser-ui/icons/chevron-right.svg +8 -0
- package/dist/src/browser-ui/index.html +8 -8
- package/dist/src/browser-ui/style.css +199 -171
- package/dist/src/browser-ui/tokens.css +198 -0
- package/dist/src/browser-view.d.ts +57 -9
- package/dist/src/browser-view.js +187 -36
- package/dist/src/cli.js +31 -9
- package/dist/src/coding-tools.js +9 -5
- package/dist/src/command-screens.js +4 -4
- package/dist/src/commands.d.ts +1 -1
- package/dist/src/commands.js +3 -2
- package/dist/src/completion-gates.d.ts +35 -0
- package/dist/src/completion-gates.js +25 -0
- package/dist/src/completion.d.ts +7 -1
- package/dist/src/completion.js +37 -4
- package/dist/src/config.d.ts +1 -1
- package/dist/src/config.js +2 -2
- package/dist/src/context-budget.d.ts +11 -0
- package/dist/src/context-budget.js +13 -0
- package/dist/src/decision/DecisionEngine.d.ts +5 -1
- package/dist/src/decision/DecisionManager.d.ts +1 -0
- package/dist/src/decision/DecisionManager.js +14 -3
- package/dist/src/decision/FactContinuations.d.ts +6 -0
- package/dist/src/decision/FactContinuations.js +9 -1
- package/dist/src/decision/FactServiceGate.js +1 -1
- package/dist/src/decision/checks.js +1 -1
- package/dist/src/decision/hostedSkills.d.ts +37 -0
- package/dist/src/decision/hostedSkills.js +64 -0
- package/dist/src/decision/providers/AndorraDecisionProvider.d.ts +10 -2
- package/dist/src/decision/providers/AndorraDecisionProvider.js +121 -10
- package/dist/src/default-graph.d.ts +11 -0
- package/dist/src/default-graph.js +20 -0
- package/dist/src/duration.d.ts +13 -2
- package/dist/src/duration.js +27 -3
- package/dist/src/file-diff.d.ts +105 -0
- package/dist/src/file-diff.js +244 -0
- package/dist/src/graph-manager-chat.d.ts +302 -0
- package/dist/src/graph-manager-chat.js +940 -0
- package/dist/src/graph-runner.js +6 -0
- package/dist/src/graph-server.d.ts +9 -0
- package/dist/src/graph-server.js +171 -20
- package/dist/src/graph-studio-features.js +2 -2
- package/dist/src/graph-sync.js +5 -2
- package/dist/src/graph-ui/app.js +369 -183
- package/dist/src/graph-ui/controls.css +55 -32
- package/dist/src/graph-ui/controls.js +85 -9
- package/dist/src/graph-ui/edge-router.js +114 -13
- package/dist/src/graph-ui/embed.js +32 -17
- package/dist/src/graph-ui/icons.js +1 -0
- package/dist/src/graph-ui/index.html +4 -4
- package/dist/src/graph-ui/library.css +4 -10
- package/dist/src/graph-ui/manager-markdown.js +155 -0
- package/dist/src/graph-ui/manager-state.js +191 -0
- package/dist/src/graph-ui/manager.css +161 -0
- package/dist/src/graph-ui/manager.js +700 -0
- package/dist/src/graph-ui/skill-picker.js +6 -6
- package/dist/src/graph-ui/studio-canvas.js +17 -15
- package/dist/src/graph-ui/studio.css +24 -23
- package/dist/src/graph-ui/studio.js +69 -48
- package/dist/src/graph-ui/style.css +128 -93
- package/dist/src/graph-ui/theme.js +2 -2
- package/dist/src/graph-ui/tokens.css +217 -151
- package/dist/src/graphs.d.ts +76 -2
- package/dist/src/graphs.js +172 -9
- package/dist/src/hardened-runtime.js +8 -2
- package/dist/src/mcp.d.ts +75 -0
- package/dist/src/mcp.js +240 -8
- package/dist/src/membership-errors.d.ts +14 -0
- package/dist/src/membership-errors.js +24 -1
- package/dist/src/membership.d.ts +20 -0
- package/dist/src/membership.js +45 -16
- package/dist/src/palette.d.ts +25 -8
- package/dist/src/palette.js +26 -8
- package/dist/src/provider-engine.d.ts +4 -4
- package/dist/src/provider-engine.js +39 -22
- package/dist/src/provider-keys.d.ts +5 -1
- package/dist/src/provider-keys.js +7 -3
- package/dist/src/provider-settings.d.ts +4 -1
- package/dist/src/provider-settings.js +46 -5
- package/dist/src/providers.d.ts +24 -0
- package/dist/src/providers.js +47 -2
- package/dist/src/qa/guidance.d.ts +26 -0
- package/dist/src/qa/guidance.js +46 -0
- package/dist/src/qa/index.d.ts +1 -8
- package/dist/src/qa/index.js +1 -16
- package/dist/src/qa/profile/QaProfile.d.ts +5 -1
- package/dist/src/qa/profile/QaProfile.js +6 -2
- package/dist/src/qa/runtime/ProcessManager.d.ts +20 -2
- package/dist/src/qa/runtime/ProcessManager.js +69 -13
- package/dist/src/qa/tools.d.ts +19 -1
- package/dist/src/qa/tools.js +20 -145
- package/dist/src/react-runtime.d.ts +11 -0
- package/dist/src/react-runtime.js +203 -53
- package/dist/src/remote/engine-pool.js +21 -6
- package/dist/src/run-progress.d.ts +6 -0
- package/dist/src/run-progress.js +7 -0
- package/dist/src/runtime.d.ts +8 -0
- package/dist/src/screen-selection.d.ts +38 -0
- package/dist/src/screen-selection.js +103 -0
- package/dist/src/session-changes.d.ts +117 -0
- package/dist/src/session-changes.js +796 -0
- package/dist/src/session-skills.d.ts +75 -0
- package/dist/src/session-skills.js +151 -0
- package/dist/src/side-panel.d.ts +1 -1
- package/dist/src/side-panel.js +6 -12
- package/dist/src/skill-commands.js +1 -1
- package/dist/src/skills/bundled/control-browser/SKILL.md +9 -1
- package/dist/src/skills/bundled/graph-manager/SKILL.md +8 -0
- package/dist/src/skills/bundled/provenance.json +3 -3
- package/dist/src/skills/bundled/web-gui-tester/SKILL.md +1 -1
- package/dist/src/stall-recovery.d.ts +33 -0
- package/dist/src/stall-recovery.js +83 -0
- package/dist/src/subagent-run.js +1 -2
- package/dist/src/telemetry/schema.d.ts +1 -1
- package/dist/src/telemetry/schema.js +1 -2
- package/dist/src/terminal-ui.d.ts +66 -22
- package/dist/src/terminal-ui.js +327 -92
- package/dist/src/tool-diff-stats.d.ts +9 -0
- package/dist/src/tool-diff-stats.js +20 -0
- package/dist/src/tool-names.d.ts +1 -1
- package/dist/src/tool-result-filter.js +1 -1
- package/dist/src/tools.js +26 -2
- package/dist/src/transcript.d.ts +11 -0
- package/dist/src/transcript.js +23 -3
- package/dist/src/types.d.ts +24 -4
- package/dist/src/usage-analytics.d.ts +7 -0
- package/dist/src/usage-analytics.js +55 -15
- package/docs/concepts/README.md +1 -1
- package/docs/concepts/limits.md +9 -0
- package/docs/guides/desktop-app.md +1 -1
- package/docs/guides/graph-builder.md +16 -1
- package/docs/guides/tui.md +9 -9
- package/docs/reference/slash-commands.md +2 -1
- package/docs/superpowers/plans/2026-11-13-graph-manager-chat.md +203 -0
- package/docs/superpowers/plans/2026-11-14-jev-fair-use-pricing.md +79 -0
- package/docs/superpowers/specs/2026-11-13-graph-manager-chat-design.md +182 -0
- package/docs/superpowers/specs/2026-11-14-jev-fair-use-pricing-design.md +156 -0
- package/package.json +1 -1
- package/tests/chat-side-panel-test-plan.md +1 -1
- package/dist/src/qa/api/http-runner.d.ts +0 -3
- package/dist/src/qa/api/http-runner.js +0 -47
- package/dist/src/qa/git/ChangeDetector.d.ts +0 -26
- package/dist/src/qa/git/ChangeDetector.js +0 -177
- package/dist/src/qa/git/DiffReviewer.d.ts +0 -28
- package/dist/src/qa/git/DiffReviewer.js +0 -115
- package/dist/src/qa/orchestrator/ChangeClassifier.d.ts +0 -14
- package/dist/src/qa/orchestrator/ChangeClassifier.js +0 -28
- package/dist/src/qa/orchestrator/MergeGate.d.ts +0 -14
- package/dist/src/qa/orchestrator/MergeGate.js +0 -40
- package/dist/src/qa/orchestrator/QaOrchestrator.d.ts +0 -79
- package/dist/src/qa/orchestrator/QaOrchestrator.js +0 -373
- package/dist/src/qa/runners/CommandRunner.d.ts +0 -22
- package/dist/src/qa/runners/CommandRunner.js +0 -96
- package/dist/src/qa/runners/TestRunner.d.ts +0 -21
- package/dist/src/qa/runners/TestRunner.js +0 -66
- package/dist/src/qa/runtime/RuntimeSmoke.d.ts +0 -11
- package/dist/src/qa/runtime/RuntimeSmoke.js +0 -78
- package/dist/src/qa/runtime-detect.d.ts +0 -10
- package/dist/src/qa/runtime-detect.js +0 -72
- package/dist/src/qa/security/DependencyScanner.d.ts +0 -19
- package/dist/src/qa/security/DependencyScanner.js +0 -167
- package/dist/src/qa/security/SecretScanner.d.ts +0 -3
- package/dist/src/qa/security/SecretScanner.js +0 -55
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn } from 'node:child_process';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
3
|
import net from 'node:net';
|
|
4
|
+
import { closeSync, openSync, readSync, fstatSync } from 'node:fs';
|
|
4
5
|
import { mkdir, appendFile } from 'node:fs/promises';
|
|
5
6
|
import path from 'node:path';
|
|
6
7
|
import { defaultShellKind, shellBaseEnv, shellInvocation, stopProcessTree } from '../../shell.js';
|
|
@@ -8,11 +9,23 @@ import { recordCommandTiming } from '../../command-metrics.js';
|
|
|
8
9
|
import { notifyBackgroundChange } from './changes.js';
|
|
9
10
|
const LOG_CAP_BYTES = 262_144;
|
|
10
11
|
const POLL_INTERVAL_MS = 500;
|
|
12
|
+
/**
|
|
13
|
+
* Whether a job can be started to outlive the CLI. Not on Windows: there the PowerShell wrapper
|
|
14
|
+
* carries the command's output through its own pipeline, so the command dies with the wrapper, and
|
|
15
|
+
* a detached PowerShell exits before running the command at all.
|
|
16
|
+
*/
|
|
17
|
+
export const PERSISTENT_JOBS_SUPPORTED = process.platform !== 'win32';
|
|
11
18
|
/**
|
|
12
19
|
* Long-lived QA processes (dev servers) owned by the CLI session. Logs stay on
|
|
13
20
|
* disk plus a bounded in-memory tail; every process inherits the shell
|
|
14
21
|
* credential-allowlist environment and is tree-killed on stop, including when
|
|
15
22
|
* the CLI exits.
|
|
23
|
+
*
|
|
24
|
+
* A persistent process is the exception at exit: it is a service the user asked to have left
|
|
25
|
+
* running (a web server the task sets up), so CLI shutdown leaves it alone. It writes straight to
|
|
26
|
+
* its log file rather than through pipes, because a pipe to a CLI that has exited would end it on
|
|
27
|
+
* its next write, and it is unreferenced (and, like every job, in its own process group) so the CLI
|
|
28
|
+
* can exit while it runs. An explicit stop and the removal of its workspace still end it.
|
|
16
29
|
*/
|
|
17
30
|
export class QaProcessManager {
|
|
18
31
|
workspace;
|
|
@@ -25,6 +38,8 @@ export class QaProcessManager {
|
|
|
25
38
|
async start(options) {
|
|
26
39
|
options.signal?.throwIfAborted();
|
|
27
40
|
this.validateStart(options);
|
|
41
|
+
if (options.persist && !PERSISTENT_JOBS_SUPPORTED)
|
|
42
|
+
throw new Error('persist is not supported on Windows: a background job ends when the CLI exits.');
|
|
28
43
|
await this.stop(options.id);
|
|
29
44
|
options.signal?.throwIfAborted();
|
|
30
45
|
const runId = randomUUID();
|
|
@@ -38,15 +53,29 @@ export class QaProcessManager {
|
|
|
38
53
|
options.signal?.throwIfAborted();
|
|
39
54
|
if (options.launchPolicy?.())
|
|
40
55
|
throw new Error('Background command requires Full Access or explicit escalation; restricted execution is unavailable.');
|
|
56
|
+
const persistent = options.persist === true;
|
|
57
|
+
// Synchronous, so nothing yields between the guards above and the spawn below.
|
|
58
|
+
const logFd = persistent ? openSync(logPath, 'a') : undefined;
|
|
41
59
|
const spawnedAt = Date.now();
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
let child;
|
|
61
|
+
try {
|
|
62
|
+
child = spawn(invocation.executable, invocation.args, {
|
|
63
|
+
cwd: this.workspace,
|
|
64
|
+
env: shellBaseEnv(runId),
|
|
65
|
+
windowsHide: true,
|
|
66
|
+
detached: process.platform !== 'win32',
|
|
67
|
+
stdio: logFd === undefined ? ['ignore', 'pipe', 'pipe'] : ['ignore', logFd, logFd],
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
// The child holds its own copy of the descriptor.
|
|
72
|
+
if (logFd !== undefined)
|
|
73
|
+
closeSync(logFd);
|
|
74
|
+
}
|
|
75
|
+
// Nothing of the CLI's keeps a persistent job alive or waits for it.
|
|
76
|
+
if (persistent)
|
|
77
|
+
child.unref();
|
|
78
|
+
const record = { id: options.id, command: options.command, child, runId, logPath, chunks: [], bytes: 0, exited: undefined, startedAt: spawnedAt, persistent };
|
|
50
79
|
this.processes.set(options.id, record);
|
|
51
80
|
for (const stream of [child.stdout, child.stderr]) {
|
|
52
81
|
stream?.on('data', (chunk) => {
|
|
@@ -88,6 +117,7 @@ export class QaProcessManager {
|
|
|
88
117
|
logRef: path.relative(this.workspace, record.logPath).split(path.sep).join('/'),
|
|
89
118
|
startedAt: record.startedAt,
|
|
90
119
|
...(record.endedAt === undefined ? {} : { endedAt: record.endedAt }),
|
|
120
|
+
...(record.persistent ? { persistent: true } : {}),
|
|
91
121
|
};
|
|
92
122
|
}
|
|
93
123
|
get(id) {
|
|
@@ -102,7 +132,8 @@ export class QaProcessManager {
|
|
|
102
132
|
const record = this.processes.get(id);
|
|
103
133
|
if (!record)
|
|
104
134
|
throw new Error(`no QA process named "${id}"`);
|
|
105
|
-
|
|
135
|
+
// A persistent job writes to its log file directly, so the tail comes from there.
|
|
136
|
+
const text = record.persistent ? readTail(record.logPath, tailBytes) : Buffer.concat(record.chunks).toString('utf8');
|
|
106
137
|
const tail = text.length > tailBytes ? text.slice(-tailBytes) : text;
|
|
107
138
|
const status = record.exited ? `\n[process exited code=${record.exited.code ?? record.exited.signal}${record.spawnError ? ` error=${record.spawnError}` : ''}]` : '';
|
|
108
139
|
return `${tail}${status}`;
|
|
@@ -193,9 +224,34 @@ export class QaProcessManager {
|
|
|
193
224
|
}
|
|
194
225
|
catch { /* already gone */ }
|
|
195
226
|
}
|
|
196
|
-
|
|
197
|
-
|
|
227
|
+
/** `keepPersistent` is CLI shutdown: a job started to outlive the CLI is left running and forgotten. */
|
|
228
|
+
async stopAll(options = {}) {
|
|
229
|
+
for (const [id, record] of [...this.processes]) {
|
|
230
|
+
if (options.keepPersistent && record.persistent) {
|
|
231
|
+
this.processes.delete(id);
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
198
234
|
await this.stop(id);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/** The last `bytes` of a log file, read without loading the rest; empty when it cannot be read. */
|
|
239
|
+
function readTail(file, bytes) {
|
|
240
|
+
let fd;
|
|
241
|
+
try {
|
|
242
|
+
fd = openSync(file, 'r');
|
|
243
|
+
const size = fstatSync(fd).size;
|
|
244
|
+
const length = Math.min(size, bytes);
|
|
245
|
+
const buffer = Buffer.alloc(length);
|
|
246
|
+
readSync(fd, buffer, 0, length, size - length);
|
|
247
|
+
return buffer.toString('utf8');
|
|
248
|
+
}
|
|
249
|
+
catch {
|
|
250
|
+
return '';
|
|
251
|
+
}
|
|
252
|
+
finally {
|
|
253
|
+
if (fd !== undefined)
|
|
254
|
+
closeSync(fd);
|
|
199
255
|
}
|
|
200
256
|
}
|
|
201
257
|
function sleep(ms) {
|
|
@@ -252,9 +308,9 @@ export async function stopQaProcessesUnder(root) {
|
|
|
252
308
|
managers.delete(workspace);
|
|
253
309
|
await Promise.all(owned.map(([, manager]) => manager.stopAll().catch(() => { })));
|
|
254
310
|
}
|
|
255
|
-
/** CLI shutdown hook: kill every QA-owned background process. */
|
|
311
|
+
/** CLI shutdown hook: kill every QA-owned background process except those started to persist. */
|
|
256
312
|
export async function disposeAllQaProcesses() {
|
|
257
313
|
const managersSnapshot = [...managers.values()];
|
|
258
314
|
managers.clear();
|
|
259
|
-
await Promise.all(managersSnapshot.map(manager => manager.stopAll()));
|
|
315
|
+
await Promise.all(managersSnapshot.map(manager => manager.stopAll({ keepPersistent: true })));
|
|
260
316
|
}
|
package/dist/src/qa/tools.d.ts
CHANGED
|
@@ -1,3 +1,21 @@
|
|
|
1
1
|
import type { Tool } from '../types.js';
|
|
2
|
-
|
|
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[];
|
package/dist/src/qa/tools.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { clipText } from '../text.js';
|
|
2
|
-
import {
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
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
|
-
/**
|
|
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
|
|
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
|
}
|
|
@@ -40,6 +40,17 @@ export interface HardenedRunOptions extends RunOptions {
|
|
|
40
40
|
beforeToolCall?: (context: BeforeToolCallContext, signal: AbortSignal) => Promise<BeforeToolCallResult | undefined>;
|
|
41
41
|
afterToolCall?: (context: AfterToolCallContext, signal: AbortSignal) => Promise<AfterToolCallResult | undefined>;
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Told to every agent that holds the todo list: a plan update rides in a batch that does work.
|
|
45
|
+
*
|
|
46
|
+
* A request that carries only update_todos re-reads the whole conversation and thinks again to
|
|
47
|
+
* move a status. On Andorra Code 0.1.8 (DeepSeek V4.1 Flash, Jev off) 116 of 303 plan updates in
|
|
48
|
+
* 90 SWE-bench runs and 110 of 229 in 62 Terminal-Bench runs were sent alone, 95 of them as the
|
|
49
|
+
* last request before complete_agent, and none beside it: 4.5% and 7.9% of all output tokens. The
|
|
50
|
+
* host has accepted update_todos beside complete_agent since the final-answer gates; nothing told
|
|
51
|
+
* the model so.
|
|
52
|
+
*/
|
|
53
|
+
export declare const TODO_BATCHING_GUIDANCE = "A plan update never needs a turn of its own: send update_todos in the same batch as the tool calls that do the next work, and send the last one, with the true final statuses, in the same batch as complete_agent, which is the one call allowed beside it.";
|
|
43
54
|
/**
|
|
44
55
|
* One engine for all reasoning nodes. The copied agent owns turn scheduling, tool
|
|
45
56
|
* batches and session state; these hooks enforce Andorra's graph contracts.
|