devcontour-harness 0.1.0-alpha.6 → 0.1.0-alpha.7

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.
@@ -9,7 +9,7 @@ import { fileURLToPath } from 'node:url';
9
9
  import { z } from 'zod';
10
10
  import { idSchema, relativePathSchema, sha256, } from "../contracts/index.js";
11
11
  import { redactor } from "../environment/redaction.js";
12
- import { freshnessEnv, junitSummary, runCheck, sandboxBlockedHosts, } from "../verification/gates.js";
12
+ import { completedCheck, freshnessEnv, junitSummary, runCheck, sandboxBlockedHosts, } from "../verification/gates.js";
13
13
  /**
14
14
  * Пробные проверки reviewer под пределами harness.
15
15
  *
@@ -63,6 +63,19 @@ export const probeSpec = z.object({
63
63
  /** Фаза и SHA ревью: записываются в каждый запуск gate. */
64
64
  phase: z.string().optional(),
65
65
  sha: z.string().optional(),
66
+ /**
67
+ * Вызов reviewer, которому принадлежит журнал: попытка harness, фаза, SHA
68
+ * и номер вызова. Записывается в каждый исход — по нему итог ревью не
69
+ * присваивает себе запуски чужого вызова.
70
+ */
71
+ scope: z
72
+ .strictObject({
73
+ attempt: z.string().min(1),
74
+ phase: z.string().min(1),
75
+ sha: z.string().min(1),
76
+ call: z.number().int().positive(),
77
+ })
78
+ .optional(),
66
79
  /** Каталог controller для отчётов и журналов запусков gate; вне проверяемого дерева. */
67
80
  artifacts: z.string().optional(),
68
81
  });
@@ -201,10 +214,22 @@ export class ReviewProbes {
201
214
  limitMs,
202
215
  stdout: '',
203
216
  stderr: '',
217
+ started: false,
218
+ ...(this.spec.scope ? { scope: this.spec.scope } : {}),
204
219
  };
205
220
  const budgetLeft = () => Math.max(0, this.spec.budgetMs - this.spent);
206
221
  let result;
207
- if (input.gate !== undefined && (!gate || gate.property))
222
+ if (signal.aborted)
223
+ // Отменённый до запуска вызов не исполняется и не резервирует бюджет.
224
+ result = {
225
+ ...base,
226
+ status: 'cancelled',
227
+ exitCode: null,
228
+ durationMs: 0,
229
+ budgetLeftMs: budgetLeft(),
230
+ note: 'Вызов отменён до запуска; команда не исполнялась.',
231
+ };
232
+ else if (input.gate !== undefined && (!gate || gate.property))
208
233
  // Неизвестный ID не исполняется и не тратит бюджет: модель не выбирает
209
234
  // команду, только объявленный gate.
210
235
  result = {
@@ -243,6 +268,9 @@ export class ReviewProbes {
243
268
  // засчитывает незавершённый запуск целиком (R3-F01). Без записи
244
269
  // проверка не запускается.
245
270
  const reserved = reserveProbe(this.spec.log, runId, limitMs, base.argv, gate?.id);
271
+ // Факт старта отмечается на границе исполнения и переживает исключение
272
+ // после неё: упавшее сохранение отчёта не делает запуск «не бывшим».
273
+ const launch = { started: false };
246
274
  let outcome;
247
275
  try {
248
276
  if (reserved)
@@ -251,23 +279,53 @@ export class ReviewProbes {
251
279
  // останавливает процессы проверки, пережившие controller.
252
280
  const marked = { ...env, [probeRunEnv]: runId };
253
281
  outcome = gate
254
- ? await this.gate(gate, runId, limitMs, marked, redact, signal)
255
- : await this.command(argv, runId, limitMs, marked, redact, signal);
282
+ ? await this.gate(gate, runId, limitMs, marked, redact, signal, launch)
283
+ : await this.command(argv, runId, limitMs, marked, redact, signal, launch);
256
284
  }
257
285
  catch (error) {
258
- outcome = {
259
- status: 'error',
260
- exitCode: null,
261
- stdout: '',
262
- stderr: '',
263
- failure: 'environment',
264
- note: 'Команда не запустилась — это отказ среды, а не результат проверки: ' +
265
- redact(error instanceof Error ? error.message : String(error)),
266
- };
286
+ const message = redact(error instanceof Error ? error.message : String(error));
287
+ // Проверка завершилась, а исключение пришло после (уборка): её код
288
+ // и вывод — исход, который не теряется.
289
+ const done = completedCheck(error);
290
+ outcome = done
291
+ ? {
292
+ status: 'error',
293
+ failure: 'environment',
294
+ exitCode: done.timedOut || signal.aborted ? null : done.code,
295
+ stdout: tail(done.stdout),
296
+ stderr: tail(done.stderr),
297
+ note: 'Проверка завершилась, но controller не убрал её временные каталоги — отказ среды после исхода: ' +
298
+ message,
299
+ }
300
+ : signal.aborted && !launch.started
301
+ ? {
302
+ status: 'cancelled',
303
+ exitCode: null,
304
+ stdout: '',
305
+ stderr: '',
306
+ note: 'Вызов отменён до запуска; команда не исполнялась.',
307
+ }
308
+ : {
309
+ status: 'error',
310
+ exitCode: null,
311
+ stdout: '',
312
+ stderr: '',
313
+ failure: 'environment',
314
+ note: launch.started
315
+ ? 'Проверка запустилась, но её исход не получен — отказ среды, а не результат проверки: ' +
316
+ message
317
+ : 'Команда не запустилась — это отказ среды, а не результат проверки: ' + message,
318
+ };
267
319
  }
268
320
  const durationMs = this.now() - started;
269
321
  this.spent += durationMs - limitMs;
270
- result = { ...base, ...outcome, durationMs, budgetLeftMs: budgetLeft() };
322
+ result = {
323
+ ...base,
324
+ ...outcome,
325
+ started: launch.started,
326
+ durationMs,
327
+ budgetLeftMs: budgetLeft(),
328
+ };
271
329
  }
272
330
  // Журнал — наблюдение controller, а не самоотчёт модели. Строка исхода
273
331
  // разрешает записанный ранее резерв фактической длительностью.
@@ -279,9 +337,10 @@ export class ReviewProbes {
279
337
  return { ...result, log: result.log ?? this.spec.log };
280
338
  }
281
339
  /** Исследовательская команда reviewer: исходники только для чтения, запись — в TMPDIR. */
282
- async command(argv, runId, limitMs, env, redact, signal) {
340
+ async command(argv, runId, limitMs, env, redact, signal, launch) {
283
341
  const r = await runCheck({ config: { isolation: this.spec.isolation } }, {
284
342
  argv,
343
+ onStart: () => (launch.started = true),
285
344
  cwd: this.spec.cwd,
286
345
  env: { ...env, CI: '1' },
287
346
  redact,
@@ -339,7 +398,7 @@ export class ReviewProbes {
339
398
  * прежние `.reports/*.xml` дерева не читаются, не удаляются и не
340
399
  * перезаписываются.
341
400
  */
342
- async gate(gate, runId, limitMs, env, redact, signal) {
401
+ async gate(gate, runId, limitMs, env, redact, signal, launch) {
343
402
  const meta = {
344
403
  id: gate.id,
345
404
  phase: this.spec.phase ?? null,
@@ -411,9 +470,11 @@ export class ReviewProbes {
411
470
  let outcome;
412
471
  let header = `# harness probe gate ${gate.id}: run=${runId} phase=${meta.phase ?? '-'} sha=${meta.sha ?? '-'} cwd=${relative(root, gateCwd) || '.'} argv=${JSON.stringify(meta.argv)} env=${meta.controllerEnv.join(',')}\n`;
413
472
  let output = '';
473
+ let finished;
414
474
  try {
415
475
  const r = await runCheck({ config: { isolation: this.spec.isolation } }, {
416
476
  argv: gate.command,
477
+ onStart: () => (launch.started = true),
417
478
  cwd: gateCwd,
418
479
  env: { ...env, ...controllerEnv },
419
480
  redact,
@@ -426,6 +487,7 @@ export class ReviewProbes {
426
487
  controller: this.spec.controller,
427
488
  settingsDir: join(this.spec.settingsDir, runId),
428
489
  });
490
+ finished = r;
429
491
  output = r.stdout + '\n' + r.stderr;
430
492
  // Отчёт читается и сохраняется до удаления scratch — при любом исходе.
431
493
  const read = gate.report
@@ -509,16 +571,51 @@ export class ReviewProbes {
509
571
  };
510
572
  }
511
573
  catch (error) {
512
- outcome = environment(`Gate не запустился: ${redact(error instanceof Error ? error.message : String(error))}.`);
574
+ const message = redact(error instanceof Error ? error.message : String(error));
575
+ // Сбой после старта (например, сохранения отчёта) не стирает исход
576
+ // процесса: код и вывод завершившейся проверки остаются в результате.
577
+ outcome = launch.started
578
+ ? {
579
+ ...environment(`Gate запустился, но его evidence не сохранено: ${message}.`),
580
+ ...((finished ??= completedCheck(error))
581
+ ? {
582
+ exitCode: finished.timedOut || signal.aborted ? null : finished.code,
583
+ stdout: tail(finished.stdout),
584
+ stderr: tail(finished.stderr),
585
+ }
586
+ : {}),
587
+ }
588
+ : signal.aborted
589
+ ? {
590
+ ...empty,
591
+ status: 'cancelled',
592
+ note: 'Вызов отменён до запуска gate; gate не исполнялся.',
593
+ }
594
+ : environment(`Gate не запустился: ${message}.`);
513
595
  }
514
596
  finally {
515
597
  meta.scratchRemoved = await removeScratch(scratch);
516
598
  }
517
599
  header += `# status=${outcome.status}${outcome.failure ? ` failure=${outcome.failure}` : ''} exit=${outcome.exitCode ?? '-'} report=${meta.report?.status ?? '-'}${meta.report?.digest ? ` digest=${meta.report.digest}` : ''} scratchRemoved=${meta.scratchRemoved}\n`;
518
- await writeFile(logPath, redact(header + output + (outcome.note ? '\n' + outcome.note : '')), {
519
- flag: 'wx',
520
- });
521
- await writeFile(join(runDir, 'run.json'), JSON.stringify({ runId, status: outcome.status, failure: outcome.failure, gate: meta }, null, 2), { flag: 'wx' });
600
+ try {
601
+ await writeFile(logPath, redact(header + output + (outcome.note ? '\n' + outcome.note : '')), { flag: 'wx' });
602
+ await writeFile(join(runDir, 'run.json'), JSON.stringify({
603
+ runId,
604
+ status: outcome.status,
605
+ failure: outcome.failure,
606
+ started: launch.started,
607
+ gate: meta,
608
+ }, null, 2), { flag: 'wx' });
609
+ }
610
+ catch (error) {
611
+ // Исход уже получен: отказ записи evidence не стирает код и вывод.
612
+ outcome = {
613
+ ...outcome,
614
+ status: 'error',
615
+ failure: 'environment',
616
+ note: `${outcome.note ?? ''} Evidence запуска не сохранено: ${redact(error instanceof Error ? error.message : String(error))}.`.trim(),
617
+ };
618
+ }
522
619
  return { ...outcome, gate: meta, log: logPath };
523
620
  }
524
621
  }
@@ -658,35 +755,102 @@ export function probeCommand(specPath) {
658
755
  args: [...(source ? ['--import', import.meta.resolve('tsx')] : []), entry, '--spec', specPath],
659
756
  };
660
757
  }
661
- /** Журнал проверок reviewer: по записи на запуск; нечитаемая строка — не запуск. */
662
- export async function probeRecords(log) {
663
- const text = await readFile(log, 'utf8').catch(() => '');
664
- return text
665
- .split('\n')
666
- .filter(Boolean)
667
- .flatMap((line) => {
758
+ const NOTE_LIMIT = 2000;
759
+ /** Статусы исхода probe; иной статус — диагностика, а не исход. */
760
+ export const probeStatuses = new Set([
761
+ 'passed',
762
+ 'failed',
763
+ 'timeout',
764
+ 'budget-exhausted',
765
+ 'error',
766
+ 'rejected',
767
+ 'cancelled',
768
+ ]);
769
+ const text = (v) => (typeof v === 'string' ? v : undefined);
770
+ /**
771
+ * Журнал проверок reviewer: по записи на запуск. Нечитаемая строка, объект
772
+ * без формы исхода (`runId`, `argv`, `status`) и строки резерва/списания —
773
+ * не запуски; они не роняют чтение остальных строк.
774
+ */
775
+ export async function readProbeJournal(log) {
776
+ const content = await readFile(log, 'utf8').catch(() => '');
777
+ const records = [];
778
+ const seen = new Set();
779
+ const starts = new Map();
780
+ let invalid = 0;
781
+ for (const line of content.split('\n')) {
782
+ if (!line.trim())
783
+ continue;
784
+ let p;
668
785
  try {
669
- const p = JSON.parse(line);
670
- // Строки резерва и списания — учёт бюджета, а не запуски.
671
- if (p.type)
672
- return [];
673
- return [
674
- {
675
- runId: String(p.runId),
676
- argv: p.argv,
677
- status: p.status,
678
- durationMs: p.durationMs,
679
- limitMs: p.limitMs,
680
- ...(p.failure ? { failure: p.failure } : {}),
681
- ...(p.gate ? { gate: p.gate } : {}),
682
- ...(p.log ? { log: p.log } : {}),
683
- },
684
- ];
786
+ const parsed = JSON.parse(line);
787
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed))
788
+ throw new Error('not an object');
789
+ p = parsed;
685
790
  }
686
791
  catch {
687
- return [];
792
+ invalid++;
793
+ continue;
688
794
  }
689
- });
795
+ const runId = text(p.runId);
796
+ // Строки резерва и списания — учёт бюджета, а не запуски.
797
+ if (p.type !== undefined) {
798
+ if (runId && p.type === 'start' && !starts.has(runId))
799
+ starts.set(runId, false);
800
+ else if (runId && p.type === 'abandoned')
801
+ starts.set(runId, true);
802
+ else
803
+ invalid++;
804
+ continue;
805
+ }
806
+ const argv = Array.isArray(p.argv) && p.argv.every((a) => typeof a === 'string') ? p.argv : undefined;
807
+ const status = text(p.status);
808
+ if (!runId || !argv || !status) {
809
+ invalid++;
810
+ continue;
811
+ }
812
+ // Повтор runId — одна запись; запись с неизвестным статусом runId не
813
+ // занимает: следующий валидный исход того же запуска сохраняется.
814
+ if (seen.has(runId))
815
+ continue;
816
+ if (probeStatuses.has(status))
817
+ seen.add(runId);
818
+ const exitCode = p.exitCode === null || Number.isInteger(p.exitCode)
819
+ ? p.exitCode
820
+ : undefined;
821
+ records.push({
822
+ runId,
823
+ argv,
824
+ status: status,
825
+ durationMs: Number(p.durationMs) || 0,
826
+ limitMs: Number(p.limitMs) || 0,
827
+ ...(p.failure === 'environment' || p.failure === 'report' ? { failure: p.failure } : {}),
828
+ ...(p.gate && typeof p.gate === 'object' ? { gate: p.gate } : {}),
829
+ ...(text(p.log) ? { log: text(p.log) } : {}),
830
+ ...(exitCode !== undefined ? { exitCode } : {}),
831
+ ...(typeof p.started === 'boolean' ? { started: p.started } : {}),
832
+ ...(p.scope && typeof p.scope === 'object' ? { scope: p.scope } : {}),
833
+ ...(text(p.note) ? { note: text(p.note) } : {}),
834
+ ...(text(p.stdout) !== undefined ? { stdout: text(p.stdout) } : {}),
835
+ ...(text(p.stderr) !== undefined ? { stderr: text(p.stderr) } : {}),
836
+ });
837
+ }
838
+ const reservations = [...starts]
839
+ .filter(([runId]) => !seen.has(runId))
840
+ .map(([runId, abandoned]) => ({ runId, abandoned }));
841
+ return { records, invalid, reservations };
842
+ }
843
+ /** Запуск в виде `review.json.probes`: без потоков вывода, пояснение ограничено. */
844
+ export function probeRecord(record) {
845
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
846
+ const { stdout, stderr, ...rest } = record;
847
+ return rest.note && rest.note.length > NOTE_LIMIT
848
+ ? { ...rest, note: rest.note.slice(0, NOTE_LIMIT) + '…' }
849
+ : rest;
850
+ }
851
+ /** Журнал проверок reviewer: по записи на запуск; нечитаемая строка — не запуск. */
852
+ export async function probeRecords(log) {
853
+ return (await readProbeJournal(log)).records.map(probeRecord);
690
854
  }
691
855
  /** Переменная окружения с runId проверки: её наследуют все процессы запуска. */
692
856
  export const probeRunEnv = 'HARNESS_PROBE_RUN';
@@ -857,6 +1021,7 @@ export function observeReproductions(findings, probes, redact) {
857
1021
  // Отказ среды (EPERM рецепта отчёта, песочница) — не запуск проверяемого
858
1022
  // кода: на нём наблюдение не ставится.
859
1023
  const ran = !!cited &&
1024
+ cited.started !== false &&
860
1025
  ['passed', 'failed', 'timeout'].includes(cited.status) &&
861
1026
  cited.failure !== 'environment';
862
1027
  return {
@@ -162,7 +162,21 @@ export declare const propertyEvidenceSchema: z.ZodObject<{
162
162
  }, z.core.$strict>>;
163
163
  coverage: z.ZodOptional<z.ZodArray<z.ZodString>>;
164
164
  }, z.core.$strict>;
165
- /** Что reviewer действительно выполнил — по событиям runtime, не по словам модели. */
165
+ /** Происхождение подтверждённой команды: событие runtime или запуск probe controller. */
166
+ export declare const inspectionOriginSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
167
+ type: z.ZodLiteral<"runtime">;
168
+ runtime: z.ZodString;
169
+ item: z.ZodNullable<z.ZodString>;
170
+ }, z.core.$strict>, z.ZodObject<{
171
+ type: z.ZodLiteral<"controller">;
172
+ runId: z.ZodString;
173
+ }, z.core.$strict>], "type">;
174
+ /**
175
+ * Что reviewer действительно выполнил — по событиям runtime и журналу
176
+ * проверок controller одного вызова reviewer, не по словам модели
177
+ * (docs/review-probes.md). Поля после `reason` появились в alpha.7 и
178
+ * необязательны: записи прежних версий читаются как есть.
179
+ */
166
180
  export declare const reviewInspectionSchema: z.ZodObject<{
167
181
  mode: z.ZodEnum<{
168
182
  commands: "commands";
@@ -171,13 +185,61 @@ export declare const reviewInspectionSchema: z.ZodObject<{
171
185
  source: z.ZodEnum<{
172
186
  "codex-events": "codex-events";
173
187
  unavailable: "unavailable";
188
+ "controller-probes": "controller-probes";
189
+ "runtime-and-controller": "runtime-and-controller";
174
190
  }>;
175
191
  commands: z.ZodArray<z.ZodObject<{
176
192
  command: z.ZodString;
177
- exitCode: z.ZodNumber;
193
+ exitCode: z.ZodNullable<z.ZodNumber>;
178
194
  output: z.ZodString;
195
+ origins: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
196
+ type: z.ZodLiteral<"runtime">;
197
+ runtime: z.ZodString;
198
+ item: z.ZodNullable<z.ZodString>;
199
+ }, z.core.$strict>, z.ZodObject<{
200
+ type: z.ZodLiteral<"controller">;
201
+ runId: z.ZodString;
202
+ }, z.core.$strict>], "type">>>;
203
+ status: z.ZodOptional<z.ZodEnum<{
204
+ error: "error";
205
+ passed: "passed";
206
+ failed: "failed";
207
+ cancelled: "cancelled";
208
+ completed: "completed";
209
+ timeout: "timeout";
210
+ }>>;
211
+ failure: z.ZodOptional<z.ZodEnum<{
212
+ report: "report";
213
+ environment: "environment";
214
+ }>>;
215
+ gate: z.ZodOptional<z.ZodString>;
216
+ note: z.ZodOptional<z.ZodString>;
179
217
  }, z.core.$strict>>;
180
218
  reason: z.ZodNullable<z.ZodString>;
219
+ context: z.ZodOptional<z.ZodObject<{
220
+ attempt: z.ZodString;
221
+ phase: z.ZodEnum<{
222
+ candidate: "candidate";
223
+ integration: "integration";
224
+ }>;
225
+ sha: z.ZodString;
226
+ call: z.ZodNumber;
227
+ }, z.core.$strict>>;
228
+ total: z.ZodOptional<z.ZodNumber>;
229
+ excluded: z.ZodOptional<z.ZodArray<z.ZodObject<{
230
+ runId: z.ZodString;
231
+ status: z.ZodNullable<z.ZodString>;
232
+ reason: z.ZodEnum<{
233
+ "not-started": "not-started";
234
+ "legacy-unconfirmed": "legacy-unconfirmed";
235
+ "foreign-scope": "foreign-scope";
236
+ "unknown-status": "unknown-status";
237
+ unfinished: "unfinished";
238
+ abandoned: "abandoned";
239
+ }>;
240
+ }, z.core.$strict>>>;
241
+ excludedTotal: z.ZodOptional<z.ZodNumber>;
242
+ invalid: z.ZodOptional<z.ZodNumber>;
181
243
  }, z.core.$strict>;
182
244
  export declare const evidenceFindingSchema: z.ZodObject<{
183
245
  severity: z.ZodString;
@@ -220,13 +282,61 @@ export declare const evidenceRecordSchema: z.ZodObject<{
220
282
  source: z.ZodEnum<{
221
283
  "codex-events": "codex-events";
222
284
  unavailable: "unavailable";
285
+ "controller-probes": "controller-probes";
286
+ "runtime-and-controller": "runtime-and-controller";
223
287
  }>;
224
288
  commands: z.ZodArray<z.ZodObject<{
225
289
  command: z.ZodString;
226
- exitCode: z.ZodNumber;
290
+ exitCode: z.ZodNullable<z.ZodNumber>;
227
291
  output: z.ZodString;
292
+ origins: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
293
+ type: z.ZodLiteral<"runtime">;
294
+ runtime: z.ZodString;
295
+ item: z.ZodNullable<z.ZodString>;
296
+ }, z.core.$strict>, z.ZodObject<{
297
+ type: z.ZodLiteral<"controller">;
298
+ runId: z.ZodString;
299
+ }, z.core.$strict>], "type">>>;
300
+ status: z.ZodOptional<z.ZodEnum<{
301
+ error: "error";
302
+ passed: "passed";
303
+ failed: "failed";
304
+ cancelled: "cancelled";
305
+ completed: "completed";
306
+ timeout: "timeout";
307
+ }>>;
308
+ failure: z.ZodOptional<z.ZodEnum<{
309
+ report: "report";
310
+ environment: "environment";
311
+ }>>;
312
+ gate: z.ZodOptional<z.ZodString>;
313
+ note: z.ZodOptional<z.ZodString>;
228
314
  }, z.core.$strict>>;
229
315
  reason: z.ZodNullable<z.ZodString>;
316
+ context: z.ZodOptional<z.ZodObject<{
317
+ attempt: z.ZodString;
318
+ phase: z.ZodEnum<{
319
+ candidate: "candidate";
320
+ integration: "integration";
321
+ }>;
322
+ sha: z.ZodString;
323
+ call: z.ZodNumber;
324
+ }, z.core.$strict>>;
325
+ total: z.ZodOptional<z.ZodNumber>;
326
+ excluded: z.ZodOptional<z.ZodArray<z.ZodObject<{
327
+ runId: z.ZodString;
328
+ status: z.ZodNullable<z.ZodString>;
329
+ reason: z.ZodEnum<{
330
+ "not-started": "not-started";
331
+ "legacy-unconfirmed": "legacy-unconfirmed";
332
+ "foreign-scope": "foreign-scope";
333
+ "unknown-status": "unknown-status";
334
+ unfinished: "unfinished";
335
+ abandoned: "abandoned";
336
+ }>;
337
+ }, z.core.$strict>>>;
338
+ excludedTotal: z.ZodOptional<z.ZodNumber>;
339
+ invalid: z.ZodOptional<z.ZodNumber>;
230
340
  }, z.core.$strict>>;
231
341
  findings: z.ZodOptional<z.ZodArray<z.ZodObject<{
232
342
  severity: z.ZodString;
@@ -708,13 +818,61 @@ export declare const attemptStateSchema: z.ZodObject<{
708
818
  source: z.ZodEnum<{
709
819
  "codex-events": "codex-events";
710
820
  unavailable: "unavailable";
821
+ "controller-probes": "controller-probes";
822
+ "runtime-and-controller": "runtime-and-controller";
711
823
  }>;
712
824
  commands: z.ZodArray<z.ZodObject<{
713
825
  command: z.ZodString;
714
- exitCode: z.ZodNumber;
826
+ exitCode: z.ZodNullable<z.ZodNumber>;
715
827
  output: z.ZodString;
828
+ origins: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
829
+ type: z.ZodLiteral<"runtime">;
830
+ runtime: z.ZodString;
831
+ item: z.ZodNullable<z.ZodString>;
832
+ }, z.core.$strict>, z.ZodObject<{
833
+ type: z.ZodLiteral<"controller">;
834
+ runId: z.ZodString;
835
+ }, z.core.$strict>], "type">>>;
836
+ status: z.ZodOptional<z.ZodEnum<{
837
+ error: "error";
838
+ passed: "passed";
839
+ failed: "failed";
840
+ cancelled: "cancelled";
841
+ completed: "completed";
842
+ timeout: "timeout";
843
+ }>>;
844
+ failure: z.ZodOptional<z.ZodEnum<{
845
+ report: "report";
846
+ environment: "environment";
847
+ }>>;
848
+ gate: z.ZodOptional<z.ZodString>;
849
+ note: z.ZodOptional<z.ZodString>;
716
850
  }, z.core.$strict>>;
717
851
  reason: z.ZodNullable<z.ZodString>;
852
+ context: z.ZodOptional<z.ZodObject<{
853
+ attempt: z.ZodString;
854
+ phase: z.ZodEnum<{
855
+ candidate: "candidate";
856
+ integration: "integration";
857
+ }>;
858
+ sha: z.ZodString;
859
+ call: z.ZodNumber;
860
+ }, z.core.$strict>>;
861
+ total: z.ZodOptional<z.ZodNumber>;
862
+ excluded: z.ZodOptional<z.ZodArray<z.ZodObject<{
863
+ runId: z.ZodString;
864
+ status: z.ZodNullable<z.ZodString>;
865
+ reason: z.ZodEnum<{
866
+ "not-started": "not-started";
867
+ "legacy-unconfirmed": "legacy-unconfirmed";
868
+ "foreign-scope": "foreign-scope";
869
+ "unknown-status": "unknown-status";
870
+ unfinished: "unfinished";
871
+ abandoned: "abandoned";
872
+ }>;
873
+ }, z.core.$strict>>>;
874
+ excludedTotal: z.ZodOptional<z.ZodNumber>;
875
+ invalid: z.ZodOptional<z.ZodNumber>;
718
876
  }, z.core.$strict>>;
719
877
  findings: z.ZodOptional<z.ZodArray<z.ZodObject<{
720
878
  severity: z.ZodString;
@@ -1375,8 +1533,8 @@ export declare const callRecordSchema: z.ZodObject<{
1375
1533
  outcome: z.ZodEnum<{
1376
1534
  error: "error";
1377
1535
  active: "active";
1378
- returned: "returned";
1379
1536
  abandoned: "abandoned";
1537
+ returned: "returned";
1380
1538
  }>;
1381
1539
  process: z.ZodOptional<z.ZodObject<{
1382
1540
  id: z.ZodString;
@@ -1698,8 +1856,8 @@ export declare const localSchemas: {
1698
1856
  outcome: z.ZodEnum<{
1699
1857
  error: "error";
1700
1858
  active: "active";
1701
- returned: "returned";
1702
1859
  abandoned: "abandoned";
1860
+ returned: "returned";
1703
1861
  }>;
1704
1862
  process: z.ZodOptional<z.ZodObject<{
1705
1863
  id: z.ZodString;
@@ -2891,13 +3049,61 @@ export declare const executionDocumentSchema: z.ZodObject<{
2891
3049
  source: z.ZodEnum<{
2892
3050
  "codex-events": "codex-events";
2893
3051
  unavailable: "unavailable";
3052
+ "controller-probes": "controller-probes";
3053
+ "runtime-and-controller": "runtime-and-controller";
2894
3054
  }>;
2895
3055
  commands: z.ZodArray<z.ZodObject<{
2896
3056
  command: z.ZodString;
2897
- exitCode: z.ZodNumber;
3057
+ exitCode: z.ZodNullable<z.ZodNumber>;
2898
3058
  output: z.ZodString;
3059
+ origins: z.ZodOptional<z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
3060
+ type: z.ZodLiteral<"runtime">;
3061
+ runtime: z.ZodString;
3062
+ item: z.ZodNullable<z.ZodString>;
3063
+ }, z.core.$strict>, z.ZodObject<{
3064
+ type: z.ZodLiteral<"controller">;
3065
+ runId: z.ZodString;
3066
+ }, z.core.$strict>], "type">>>;
3067
+ status: z.ZodOptional<z.ZodEnum<{
3068
+ error: "error";
3069
+ passed: "passed";
3070
+ failed: "failed";
3071
+ cancelled: "cancelled";
3072
+ completed: "completed";
3073
+ timeout: "timeout";
3074
+ }>>;
3075
+ failure: z.ZodOptional<z.ZodEnum<{
3076
+ report: "report";
3077
+ environment: "environment";
3078
+ }>>;
3079
+ gate: z.ZodOptional<z.ZodString>;
3080
+ note: z.ZodOptional<z.ZodString>;
2899
3081
  }, z.core.$strict>>;
2900
3082
  reason: z.ZodNullable<z.ZodString>;
3083
+ context: z.ZodOptional<z.ZodObject<{
3084
+ attempt: z.ZodString;
3085
+ phase: z.ZodEnum<{
3086
+ candidate: "candidate";
3087
+ integration: "integration";
3088
+ }>;
3089
+ sha: z.ZodString;
3090
+ call: z.ZodNumber;
3091
+ }, z.core.$strict>>;
3092
+ total: z.ZodOptional<z.ZodNumber>;
3093
+ excluded: z.ZodOptional<z.ZodArray<z.ZodObject<{
3094
+ runId: z.ZodString;
3095
+ status: z.ZodNullable<z.ZodString>;
3096
+ reason: z.ZodEnum<{
3097
+ "not-started": "not-started";
3098
+ "legacy-unconfirmed": "legacy-unconfirmed";
3099
+ "foreign-scope": "foreign-scope";
3100
+ "unknown-status": "unknown-status";
3101
+ unfinished: "unfinished";
3102
+ abandoned: "abandoned";
3103
+ }>;
3104
+ }, z.core.$strict>>>;
3105
+ excludedTotal: z.ZodOptional<z.ZodNumber>;
3106
+ invalid: z.ZodOptional<z.ZodNumber>;
2901
3107
  }, z.core.$strict>>;
2902
3108
  findings: z.ZodOptional<z.ZodArray<z.ZodObject<{
2903
3109
  severity: z.ZodString;