tryassay 0.14.0 → 0.15.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.
@@ -0,0 +1,508 @@
1
+ // ============================================================
2
+ // Build Verifier — Build-Test-Repair loop for generated apps
3
+ // Runs npm install, npm run build, starts dev server, health checks.
4
+ // On failure, feeds errors to CodeAgent for repair, then retries.
5
+ // ============================================================
6
+ import { exec, spawn } from 'node:child_process';
7
+ import { readFile, writeFile, mkdir } from 'node:fs/promises';
8
+ import { join, dirname } from 'node:path';
9
+ import { randomUUID } from 'node:crypto';
10
+ import { CodeAgent } from './agents/code-agent.js';
11
+ import { MessageBus } from './message-bus.js';
12
+ // ── Build Verifier ───────────────────────────────────────────
13
+ export class BuildVerifier {
14
+ projectPath;
15
+ options;
16
+ constructor(projectPath, options) {
17
+ this.projectPath = projectPath;
18
+ this.options = {
19
+ maxRepairAttempts: options.maxRepairAttempts,
20
+ installTimeoutMs: options.installTimeoutMs ?? 120_000,
21
+ buildTimeoutMs: options.buildTimeoutMs ?? 120_000,
22
+ startStabilityMs: options.startStabilityMs ?? 15_000,
23
+ healthCheckTimeoutMs: options.healthCheckTimeoutMs ?? 10_000,
24
+ healthCheckRetries: options.healthCheckRetries ?? 3,
25
+ codeModel: options.codeModel,
26
+ onReconcileDeps: options.onReconcileDeps,
27
+ };
28
+ }
29
+ /** Run the full build-test-repair loop. */
30
+ async verify() {
31
+ const loopStart = Date.now();
32
+ const repairAttempts = [];
33
+ let lastInstall = null;
34
+ let lastBuild = null;
35
+ let lastStart = null;
36
+ let lastHealthCheck = null;
37
+ let allErrors = [];
38
+ for (let attempt = 0; attempt <= this.options.maxRepairAttempts; attempt++) {
39
+ allErrors = [];
40
+ // Step 1: npm install
41
+ lastInstall = await this.runInstall();
42
+ if (lastInstall.status === 'fail' || lastInstall.status === 'timeout') {
43
+ allErrors.push(...this.parseErrors(lastInstall.stderr + '\n' + lastInstall.stdout));
44
+ if (allErrors.length === 0) {
45
+ allErrors.push({ file: 'package.json', line: null, message: lastInstall.stderr.slice(0, 500) || 'npm install failed', category: 'dependency_error' });
46
+ }
47
+ if (attempt < this.options.maxRepairAttempts) {
48
+ const repairResult = await this.runRepair(attempt + 1, allErrors);
49
+ repairAttempts.push(repairResult);
50
+ if (!repairResult.repairSucceeded)
51
+ continue;
52
+ continue; // Retry from install
53
+ }
54
+ break;
55
+ }
56
+ // Step 2: npm run build
57
+ lastBuild = await this.runBuild();
58
+ if (lastBuild.status === 'fail' || lastBuild.status === 'timeout') {
59
+ allErrors.push(...this.parseErrors(lastBuild.stderr + '\n' + lastBuild.stdout));
60
+ if (allErrors.length === 0) {
61
+ allErrors.push({ file: 'unknown', line: null, message: lastBuild.stderr.slice(0, 500) || 'Build failed', category: 'other' });
62
+ }
63
+ if (attempt < this.options.maxRepairAttempts) {
64
+ const repairResult = await this.runRepair(attempt + 1, allErrors);
65
+ repairAttempts.push(repairResult);
66
+ continue; // Retry from install
67
+ }
68
+ break;
69
+ }
70
+ // Step 3: Start dev server and check stability
71
+ lastStart = await this.runStart();
72
+ if (lastStart.status === 'fail' || lastStart.status === 'timeout') {
73
+ allErrors.push(...this.parseErrors(lastStart.stderr + '\n' + lastStart.stdout));
74
+ if (allErrors.length === 0) {
75
+ allErrors.push({ file: 'unknown', line: null, message: lastStart.stderr.slice(0, 500) || 'Dev server failed to start', category: 'runtime_error' });
76
+ }
77
+ if (attempt < this.options.maxRepairAttempts) {
78
+ const repairResult = await this.runRepair(attempt + 1, allErrors);
79
+ repairAttempts.push(repairResult);
80
+ continue; // Retry from install
81
+ }
82
+ break;
83
+ }
84
+ // Step 4: Health check
85
+ const port = this.detectPort();
86
+ lastHealthCheck = await this.runHealthCheck(port);
87
+ // If all steps pass, we're done
88
+ if (lastInstall.status === 'pass' && lastBuild.status === 'pass') {
89
+ const status = repairAttempts.length > 0 ? 'repaired' : 'pass';
90
+ return {
91
+ status,
92
+ install: lastInstall,
93
+ build: lastBuild,
94
+ start: lastStart,
95
+ healthCheck: lastHealthCheck,
96
+ repairAttempts,
97
+ finalErrors: [],
98
+ totalDurationMs: Date.now() - loopStart,
99
+ };
100
+ }
101
+ }
102
+ // Max attempts exhausted or unrecoverable failure
103
+ return {
104
+ status: 'fail',
105
+ install: lastInstall,
106
+ build: lastBuild,
107
+ start: lastStart,
108
+ healthCheck: lastHealthCheck,
109
+ repairAttempts,
110
+ finalErrors: allErrors,
111
+ totalDurationMs: Date.now() - loopStart,
112
+ };
113
+ }
114
+ // ── Build Steps ────────────────────────────────────────────
115
+ async runInstall() {
116
+ const start = Date.now();
117
+ const result = await this.execCommand('npm install', this.options.installTimeoutMs);
118
+ return {
119
+ step: 'install',
120
+ status: this.resultStatus(result),
121
+ command: 'npm install',
122
+ stdout: result.stdout.slice(0, 5000),
123
+ stderr: result.stderr.slice(0, 5000),
124
+ durationMs: Date.now() - start,
125
+ exitCode: result.exitCode,
126
+ };
127
+ }
128
+ async runBuild() {
129
+ const start = Date.now();
130
+ // Check if build script exists
131
+ const hasBuild = await this.hasPkgScript('build');
132
+ if (!hasBuild) {
133
+ return {
134
+ step: 'build',
135
+ status: 'skip',
136
+ command: 'npm run build',
137
+ stdout: 'No build script in package.json',
138
+ stderr: '',
139
+ durationMs: 0,
140
+ exitCode: null,
141
+ };
142
+ }
143
+ const result = await this.execCommand('npm run build', this.options.buildTimeoutMs);
144
+ return {
145
+ step: 'build',
146
+ status: this.resultStatus(result),
147
+ command: 'npm run build',
148
+ stdout: result.stdout.slice(0, 5000),
149
+ stderr: result.stderr.slice(0, 5000),
150
+ durationMs: Date.now() - start,
151
+ exitCode: result.exitCode,
152
+ };
153
+ }
154
+ async runStart() {
155
+ const start = Date.now();
156
+ const hasDev = await this.hasPkgScript('dev');
157
+ const hasStart = await this.hasPkgScript('start');
158
+ const script = hasDev ? 'dev' : hasStart ? 'start' : null;
159
+ if (!script) {
160
+ return {
161
+ step: 'start',
162
+ status: 'skip',
163
+ command: 'npm run dev',
164
+ stdout: 'No dev or start script in package.json',
165
+ stderr: '',
166
+ durationMs: 0,
167
+ exitCode: null,
168
+ };
169
+ }
170
+ // Spawn the dev server and wait for stability
171
+ let serverProcess = null;
172
+ let stdout = '';
173
+ let stderr = '';
174
+ try {
175
+ serverProcess = spawn('npm', ['run', script], {
176
+ cwd: this.projectPath,
177
+ env: { ...process.env, NODE_ENV: 'development', BROWSER: 'none' },
178
+ stdio: ['ignore', 'pipe', 'pipe'],
179
+ detached: true,
180
+ });
181
+ serverProcess.stdout?.on('data', (data) => { stdout += data.toString(); });
182
+ serverProcess.stderr?.on('data', (data) => { stderr += data.toString(); });
183
+ // Wait for "Ready" indicator or stability period
184
+ const stable = await this.waitForReady(serverProcess, stdout, () => stdout, this.options.startStabilityMs);
185
+ return {
186
+ step: 'start',
187
+ status: stable ? 'pass' : 'fail',
188
+ command: `npm run ${script}`,
189
+ stdout: stdout.slice(0, 5000),
190
+ stderr: stderr.slice(0, 5000),
191
+ durationMs: Date.now() - start,
192
+ exitCode: stable ? 0 : 1,
193
+ };
194
+ }
195
+ catch (err) {
196
+ return {
197
+ step: 'start',
198
+ status: 'fail',
199
+ command: `npm run ${script}`,
200
+ stdout: stdout.slice(0, 5000),
201
+ stderr: (stderr + '\n' + (err instanceof Error ? err.message : String(err))).slice(0, 5000),
202
+ durationMs: Date.now() - start,
203
+ exitCode: 1,
204
+ };
205
+ }
206
+ finally {
207
+ // Kill the dev server process tree
208
+ if (serverProcess?.pid) {
209
+ try {
210
+ process.kill(-serverProcess.pid, 'SIGTERM');
211
+ }
212
+ catch { /* already dead */ }
213
+ // Force kill after 2s
214
+ setTimeout(() => {
215
+ try {
216
+ process.kill(-serverProcess.pid, 'SIGKILL');
217
+ }
218
+ catch { /* already dead */ }
219
+ }, 2000);
220
+ }
221
+ }
222
+ }
223
+ async runHealthCheck(port) {
224
+ const start = Date.now();
225
+ for (let retry = 0; retry < this.options.healthCheckRetries; retry++) {
226
+ try {
227
+ const controller = new AbortController();
228
+ const timeout = setTimeout(() => controller.abort(), this.options.healthCheckTimeoutMs);
229
+ const response = await fetch(`http://localhost:${port}/`, {
230
+ signal: controller.signal,
231
+ });
232
+ clearTimeout(timeout);
233
+ if (response.ok || response.status < 500) {
234
+ return {
235
+ step: 'health_check',
236
+ status: 'pass',
237
+ command: `GET http://localhost:${port}/`,
238
+ stdout: `HTTP ${response.status} ${response.statusText}`,
239
+ stderr: '',
240
+ durationMs: Date.now() - start,
241
+ exitCode: 0,
242
+ };
243
+ }
244
+ }
245
+ catch {
246
+ // Retry after delay
247
+ if (retry < this.options.healthCheckRetries - 1) {
248
+ await this.sleep(2000);
249
+ }
250
+ }
251
+ }
252
+ return {
253
+ step: 'health_check',
254
+ status: 'fail',
255
+ command: `GET http://localhost:${port}/`,
256
+ stdout: '',
257
+ stderr: `Health check failed after ${this.options.healthCheckRetries} retries`,
258
+ durationMs: Date.now() - start,
259
+ exitCode: 1,
260
+ };
261
+ }
262
+ // ── Error Parsing ──────────────────────────────────────────
263
+ parseErrors(output) {
264
+ const errors = [];
265
+ const lines = output.split('\n');
266
+ for (const line of lines) {
267
+ // TypeScript errors: file(line,col): error TS####: message
268
+ const tsMatch = line.match(/^(.+?)\((\d+),\d+\):\s*error\s+TS\d+:\s*(.+)$/);
269
+ if (tsMatch) {
270
+ errors.push({ file: tsMatch[1], line: parseInt(tsMatch[2], 10), message: tsMatch[3], category: 'type_error' });
271
+ continue;
272
+ }
273
+ // TypeScript errors (alternative format): file:line:col - error TS####: message
274
+ const tsMatch2 = line.match(/^(.+?):(\d+):\d+\s*-\s*error\s+TS\d+:\s*(.+)$/);
275
+ if (tsMatch2) {
276
+ errors.push({ file: tsMatch2[1], line: parseInt(tsMatch2[2], 10), message: tsMatch2[3], category: 'type_error' });
277
+ continue;
278
+ }
279
+ // Next.js / Webpack module not found
280
+ const moduleMatch = line.match(/Module not found:\s*(?:Can't resolve|Error:\s*Can't resolve)\s*'([^']+)'/);
281
+ if (moduleMatch) {
282
+ errors.push({ file: 'package.json', line: null, message: `Module not found: '${moduleMatch[1]}'`, category: 'module_not_found' });
283
+ continue;
284
+ }
285
+ // SyntaxError
286
+ const syntaxMatch = line.match(/SyntaxError:\s*(.+)/);
287
+ if (syntaxMatch) {
288
+ errors.push({ file: 'unknown', line: null, message: syntaxMatch[1], category: 'syntax_error' });
289
+ continue;
290
+ }
291
+ // npm ERR! with dependency info
292
+ const npmErrMatch = line.match(/npm ERR!\s+(.+)/);
293
+ if (npmErrMatch && (line.includes('peer dep') || line.includes('ERESOLVE') || line.includes('could not resolve'))) {
294
+ errors.push({ file: 'package.json', line: null, message: npmErrMatch[1], category: 'dependency_error' });
295
+ continue;
296
+ }
297
+ // Generic Error:
298
+ const errorMatch = line.match(/^Error:\s*(.+)/);
299
+ if (errorMatch) {
300
+ errors.push({ file: 'unknown', line: null, message: errorMatch[1], category: 'other' });
301
+ continue;
302
+ }
303
+ }
304
+ // Deduplicate by message
305
+ const seen = new Set();
306
+ return errors.filter(e => {
307
+ const key = `${e.file}:${e.line}:${e.message}`;
308
+ if (seen.has(key))
309
+ return false;
310
+ seen.add(key);
311
+ return true;
312
+ });
313
+ }
314
+ // ── Repair via CodeAgent ───────────────────────────────────
315
+ async runRepair(attempt, errors) {
316
+ const repairStart = Date.now();
317
+ const filesModified = [];
318
+ // Group errors by file
319
+ const errorsByFile = new Map();
320
+ for (const error of errors) {
321
+ const existing = errorsByFile.get(error.file) ?? [];
322
+ existing.push(error);
323
+ errorsByFile.set(error.file, existing);
324
+ }
325
+ // Read failing file contents
326
+ const fileContents = [];
327
+ for (const [filePath, fileErrors] of errorsByFile) {
328
+ if (filePath === 'unknown' || filePath === 'package.json') {
329
+ fileContents.push({ path: filePath, content: '', errors: fileErrors });
330
+ continue;
331
+ }
332
+ try {
333
+ const absPath = filePath.startsWith('/') ? filePath : join(this.projectPath, filePath);
334
+ const content = await readFile(absPath, 'utf-8');
335
+ fileContents.push({ path: filePath, content, errors: fileErrors });
336
+ }
337
+ catch {
338
+ fileContents.push({ path: filePath, content: '(file not readable)', errors: fileErrors });
339
+ }
340
+ }
341
+ // Build the repair goal
342
+ const errorSummary = fileContents.map(fc => {
343
+ const errLines = fc.errors.map(e => ` - ${e.category}: ${e.message}${e.line ? ` (line ${e.line})` : ''}`).join('\n');
344
+ return `File: ${fc.path}\nErrors:\n${errLines}\n${fc.content ? `Current content:\n\`\`\`\n${fc.content.slice(0, 3000)}\n\`\`\`` : ''}`;
345
+ }).join('\n\n---\n\n');
346
+ // Also read package.json for context
347
+ let pkgJson = '';
348
+ try {
349
+ pkgJson = await readFile(join(this.projectPath, 'package.json'), 'utf-8');
350
+ }
351
+ catch { /* no package.json */ }
352
+ const repairGoal = `Fix these build errors in a generated application. Return corrected files.
353
+
354
+ Attempt ${attempt} of ${this.options.maxRepairAttempts}.
355
+
356
+ Build errors found:
357
+ ${errorSummary}
358
+
359
+ ${pkgJson ? `package.json:\n\`\`\`json\n${pkgJson.slice(0, 2000)}\n\`\`\`` : ''}
360
+
361
+ Fix ALL errors. If a module is not found, either fix the import or add the dependency. If there are type errors, fix the types. Return the complete corrected file contents.`;
362
+ const messageBus = new MessageBus();
363
+ const codeAgent = new CodeAgent(messageBus, { model: this.options.codeModel });
364
+ try {
365
+ const result = await codeAgent.executeTask({
366
+ taskId: `repair-${attempt}-${randomUUID().slice(0, 8)}`,
367
+ goal: repairGoal,
368
+ constraints: ['Fix build errors only — do not add new features or refactor working code.'],
369
+ dependencies: [],
370
+ contextRefs: [],
371
+ });
372
+ if (result.status === 'failed') {
373
+ return {
374
+ attempt,
375
+ errors,
376
+ filesModified: [],
377
+ repairSucceeded: false,
378
+ durationMs: Date.now() - repairStart,
379
+ };
380
+ }
381
+ // Write repaired files to disk
382
+ let touchedPackageJson = false;
383
+ for (const artifact of result.artifacts) {
384
+ if (!artifact.path)
385
+ continue;
386
+ const absPath = join(this.projectPath, artifact.path);
387
+ try {
388
+ await mkdir(dirname(absPath), { recursive: true });
389
+ await writeFile(absPath, artifact.content, 'utf-8');
390
+ filesModified.push(artifact.path);
391
+ if (artifact.path === 'package.json' || artifact.path.endsWith('/package.json')) {
392
+ touchedPackageJson = true;
393
+ }
394
+ }
395
+ catch {
396
+ // Best-effort write
397
+ }
398
+ }
399
+ // Re-reconcile deps if package.json was touched
400
+ if (touchedPackageJson && this.options.onReconcileDeps) {
401
+ await this.options.onReconcileDeps();
402
+ }
403
+ return {
404
+ attempt,
405
+ errors,
406
+ filesModified,
407
+ repairSucceeded: filesModified.length > 0,
408
+ durationMs: Date.now() - repairStart,
409
+ };
410
+ }
411
+ catch {
412
+ return {
413
+ attempt,
414
+ errors,
415
+ filesModified: [],
416
+ repairSucceeded: false,
417
+ durationMs: Date.now() - repairStart,
418
+ };
419
+ }
420
+ }
421
+ // ── Process Helpers ────────────────────────────────────────
422
+ execCommand(command, timeoutMs) {
423
+ return new Promise((resolve) => {
424
+ exec(command, {
425
+ cwd: this.projectPath,
426
+ timeout: timeoutMs,
427
+ maxBuffer: 10 * 1024 * 1024, // 10MB
428
+ env: { ...process.env, NODE_ENV: 'development', CI: 'true' },
429
+ }, (error, stdout, stderr) => {
430
+ const timedOut = error?.killed === true;
431
+ resolve({
432
+ stdout: stdout ?? '',
433
+ stderr: stderr ?? '',
434
+ exitCode: timedOut ? null : (error?.code !== undefined ? (typeof error.code === 'number' ? error.code : 1) : 0),
435
+ timedOut,
436
+ });
437
+ });
438
+ });
439
+ }
440
+ waitForReady(proc, _initialStdout, getStdout, stabilityMs) {
441
+ return new Promise((resolve) => {
442
+ const readyPatterns = [
443
+ /ready/i,
444
+ /started.*on/i,
445
+ /listening.*on/i,
446
+ /compiled.*successfully/i,
447
+ /Local:\s+http/i,
448
+ ];
449
+ let resolved = false;
450
+ const done = (result) => {
451
+ if (!resolved) {
452
+ resolved = true;
453
+ resolve(result);
454
+ }
455
+ };
456
+ // Check for ready pattern in output
457
+ const checkInterval = setInterval(() => {
458
+ const output = getStdout();
459
+ if (readyPatterns.some(p => p.test(output))) {
460
+ clearInterval(checkInterval);
461
+ clearTimeout(stabilityTimeout);
462
+ done(true);
463
+ }
464
+ }, 500);
465
+ // Timeout: if no ready pattern found, consider it a failure
466
+ const stabilityTimeout = setTimeout(() => {
467
+ clearInterval(checkInterval);
468
+ // If process is still running, it might be okay (just no ready message)
469
+ done(!proc.killed && proc.exitCode === null);
470
+ }, stabilityMs);
471
+ // Process exit = failure
472
+ proc.on('exit', (code) => {
473
+ clearInterval(checkInterval);
474
+ clearTimeout(stabilityTimeout);
475
+ done(code === 0);
476
+ });
477
+ proc.on('error', () => {
478
+ clearInterval(checkInterval);
479
+ clearTimeout(stabilityTimeout);
480
+ done(false);
481
+ });
482
+ });
483
+ }
484
+ resultStatus(result) {
485
+ if (result.timedOut)
486
+ return 'timeout';
487
+ if (result.exitCode === 0)
488
+ return 'pass';
489
+ return 'fail';
490
+ }
491
+ async hasPkgScript(name) {
492
+ try {
493
+ const pkg = JSON.parse(await readFile(join(this.projectPath, 'package.json'), 'utf-8'));
494
+ return typeof pkg.scripts?.[name] === 'string';
495
+ }
496
+ catch {
497
+ return false;
498
+ }
499
+ }
500
+ detectPort() {
501
+ // Default Next.js port
502
+ return 3000;
503
+ }
504
+ sleep(ms) {
505
+ return new Promise(resolve => setTimeout(resolve, ms));
506
+ }
507
+ }
508
+ //# sourceMappingURL=build-verifier.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-verifier.js","sourceRoot":"","sources":["../../src/runtime/build-verifier.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,6DAA6D;AAC7D,qEAAqE;AACrE,kEAAkE;AAClE,+DAA+D;AAE/D,OAAO,EAAE,IAAI,EAAE,KAAK,EAAqB,MAAM,oBAAoB,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,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AC,CAAC;IACzD,CAAC;CACF"}
@@ -1359,6 +1359,15 @@ export type AppCreatePhase = {
1359
1359
  readonly waveIndex: number;
1360
1360
  readonly totalWaves: number;
1361
1361
  readonly featureIds: readonly string[];
1362
+ } | {
1363
+ readonly phase: 'build_verifying';
1364
+ readonly attempt: number;
1365
+ readonly maxAttempts: number;
1366
+ } | {
1367
+ readonly phase: 'build_repairing';
1368
+ readonly attempt: number;
1369
+ readonly maxAttempts: number;
1370
+ readonly errorCount: number;
1362
1371
  } | {
1363
1372
  readonly phase: 'cross_verifying';
1364
1373
  } | {
@@ -1382,6 +1391,7 @@ export interface AppCreateResult {
1382
1391
  readonly projectPath: string;
1383
1392
  readonly plan: ArchitecturePlan | null;
1384
1393
  readonly featureResults: readonly FeatureBuildResult[];
1394
+ readonly buildVerification: BuildVerificationResult | null;
1385
1395
  readonly crossVerification: CrossFeatureVerification | null;
1386
1396
  readonly totalDurationMs: number;
1387
1397
  readonly auditTrail: readonly AuditEntry[];
@@ -1411,6 +1421,40 @@ export interface CrossFeatureCheck {
1411
1421
  readonly verdict: 'PASS' | 'FAIL';
1412
1422
  readonly evidence: string;
1413
1423
  }
1424
+ export type BuildStepStatus = 'pass' | 'fail' | 'skip' | 'timeout';
1425
+ export interface BuildStepResult {
1426
+ readonly step: 'install' | 'build' | 'start' | 'health_check';
1427
+ readonly status: BuildStepStatus;
1428
+ readonly command: string;
1429
+ readonly stdout: string;
1430
+ readonly stderr: string;
1431
+ readonly durationMs: number;
1432
+ readonly exitCode: number | null;
1433
+ }
1434
+ export type BuildErrorCategory = 'type_error' | 'module_not_found' | 'syntax_error' | 'runtime_error' | 'dependency_error' | 'other';
1435
+ export interface BuildError {
1436
+ readonly file: string;
1437
+ readonly line: number | null;
1438
+ readonly message: string;
1439
+ readonly category: BuildErrorCategory;
1440
+ }
1441
+ export interface BuildRepairAttempt {
1442
+ readonly attempt: number;
1443
+ readonly errors: readonly BuildError[];
1444
+ readonly filesModified: readonly string[];
1445
+ readonly repairSucceeded: boolean;
1446
+ readonly durationMs: number;
1447
+ }
1448
+ export interface BuildVerificationResult {
1449
+ readonly status: 'pass' | 'fail' | 'repaired' | 'skipped';
1450
+ readonly install: BuildStepResult | null;
1451
+ readonly build: BuildStepResult | null;
1452
+ readonly start: BuildStepResult | null;
1453
+ readonly healthCheck: BuildStepResult | null;
1454
+ readonly repairAttempts: readonly BuildRepairAttempt[];
1455
+ readonly finalErrors: readonly BuildError[];
1456
+ readonly totalDurationMs: number;
1457
+ }
1414
1458
  export interface AppCreateOptions {
1415
1459
  readonly outputPath: string;
1416
1460
  readonly models?: Partial<Record<AgentSpecialization, string>>;
@@ -1420,4 +1464,6 @@ export interface AppCreateOptions {
1420
1464
  readonly sequential?: boolean;
1421
1465
  readonly noDirectMode?: boolean;
1422
1466
  readonly fullVerification?: boolean;
1467
+ readonly maxBuildRepairAttempts?: number;
1468
+ readonly skipBuildVerification?: boolean;
1423
1469
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tryassay",
3
- "version": "0.14.0",
3
+ "version": "0.15.0",
4
4
  "description": "AI code verification CLI — find bugs that tests miss, linters ignore, and code review overlooks",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",