@farmslot/agent-runtime 0.38.2 → 0.38.3
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/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
- Active-development baseline; add user-facing changes here before release or package publication.
|
|
6
6
|
|
|
7
|
+
## 0.38.3 - 2026-10-24
|
|
8
|
+
|
|
9
|
+
- Reject invalid evidence manifests during progress marks with field-level errors, before checklist or signal updates.
|
|
10
|
+
|
|
7
11
|
## 0.38.2 - 2026-10-23
|
|
8
12
|
|
|
9
13
|
- Run managed native reviewers without approval prompts while preserving their sandbox write scope and worker safety policy.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farmslot/agent-runtime",
|
|
3
|
-
"version": "0.38.
|
|
3
|
+
"version": "0.38.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -43,11 +43,15 @@
|
|
|
43
43
|
"./scripts/review-diff-scope.cjs": {
|
|
44
44
|
"types": "./scripts/review-diff-scope.d.cts",
|
|
45
45
|
"default": "./scripts/review-diff-scope.cjs"
|
|
46
|
+
},
|
|
47
|
+
"./scripts/evidence-manifest.cjs": {
|
|
48
|
+
"types": "./scripts/evidence-manifest.d.cts",
|
|
49
|
+
"default": "./scripts/evidence-manifest.cjs"
|
|
46
50
|
}
|
|
47
51
|
},
|
|
48
52
|
"scripts": {
|
|
49
53
|
"typecheck": "yarn workspace @farmslot/protocol build && tsc --noEmit --project tsconfig.json",
|
|
50
|
-
"test": "node --test test/mark-operator-wait.test.cjs test/review-diff-scope.test.cjs test/claim-review-gate.test.mjs test/deterministic-checks.test.cjs && node test/mark-checklist-step.test.cjs && node test/mark-subtask.test.cjs && node --test test/acceptance-ledger.test.cjs test/acceptance-ledger-cutover.test.cjs && node test/checklist-target-sync.test.mjs && node test/acceptance-ledger-sync.test.mjs && node test/package-exports.test.cjs && node test/check-task-artifact-contract.test.cjs && node test/recipe-quality-builder.test.cjs && node test/task-init.test.mjs && node --import tsx ../../scripts/e2e-subtask-mark.mts && node ../../scripts/quality/run-tsx-tests.mjs --cwd . --tsconfig tsconfig.json src/execution-template && node ../../scripts/quality/run-tsx-tests.mjs --cwd . --tsconfig tsconfig.json src/task-init && node ../../scripts/quality/run-tsx-tests.mjs --cwd . --tsconfig tsconfig.json src/native",
|
|
54
|
+
"test": "node --test test/evidence-manifest.test.cjs test/mark-operator-wait.test.cjs test/review-diff-scope.test.cjs test/claim-review-gate.test.mjs test/deterministic-checks.test.cjs && node test/mark-checklist-step.test.cjs && node test/mark-subtask.test.cjs && node --test test/acceptance-ledger.test.cjs test/acceptance-ledger-cutover.test.cjs && node test/checklist-target-sync.test.mjs && node test/acceptance-ledger-sync.test.mjs && node test/package-exports.test.cjs && node test/check-task-artifact-contract.test.cjs && node test/recipe-quality-builder.test.cjs && node test/task-init.test.mjs && node --import tsx ../../scripts/e2e-subtask-mark.mts && node ../../scripts/quality/run-tsx-tests.mjs --cwd . --tsconfig tsconfig.json src/execution-template && node ../../scripts/quality/run-tsx-tests.mjs --cwd . --tsconfig tsconfig.json src/task-init && node ../../scripts/quality/run-tsx-tests.mjs --cwd . --tsconfig tsconfig.json src/native",
|
|
51
55
|
"format": "prettier --write --ignore-path ../../.prettierignore .",
|
|
52
56
|
"format:check": "prettier --check --ignore-path ../../.prettierignore .",
|
|
53
57
|
"lint": "eslint \"src/**/*.ts\"",
|
|
@@ -101,7 +105,8 @@
|
|
|
101
105
|
"scripts/retained-recipe-attempt.d.cts",
|
|
102
106
|
"scripts/execution-template-cli.mjs",
|
|
103
107
|
"scripts/git-diff.d.cts",
|
|
104
|
-
"scripts/review-diff-scope.d.cts"
|
|
108
|
+
"scripts/review-diff-scope.d.cts",
|
|
109
|
+
"scripts/evidence-manifest.d.cts"
|
|
105
110
|
],
|
|
106
111
|
"publishConfig": {
|
|
107
112
|
"access": "public"
|
|
@@ -5,6 +5,7 @@ import path from 'node:path';
|
|
|
5
5
|
import { fileURLToPath } from 'node:url';
|
|
6
6
|
|
|
7
7
|
const require = createRequire(import.meta.url);
|
|
8
|
+
const { validateEvidenceManifest } = require('./evidence-manifest.cjs');
|
|
8
9
|
const {
|
|
9
10
|
expandedArtifactsForCommand,
|
|
10
11
|
resolveWorkerTerminalArtifactPath,
|
|
@@ -117,20 +118,6 @@ const issues = [];
|
|
|
117
118
|
const mediaExt = /\.(png|jpe?g|gif|webp|mp4|mov|webm)$/i;
|
|
118
119
|
const internalArtifactPath =
|
|
119
120
|
/^artifacts\/(?:harness-launch|harness-relaunch|harness-relaunch-node20|runtime-launch|runtime-relaunch|runner-blockers)\//;
|
|
120
|
-
const allowedManifestKeys = new Set([
|
|
121
|
-
'version',
|
|
122
|
-
'preferred_mode',
|
|
123
|
-
'summary',
|
|
124
|
-
'before_after_pairs',
|
|
125
|
-
'standalone',
|
|
126
|
-
'omit',
|
|
127
|
-
'videos',
|
|
128
|
-
'before_state_capture',
|
|
129
|
-
]);
|
|
130
|
-
const allowedPairKeys = new Set(['label', 'covers', 'before', 'after', 'note']);
|
|
131
|
-
const allowedStandaloneKeys = new Set(['label', 'covers', 'file', 'note']);
|
|
132
|
-
const allowedVideoKeys = new Set(['before', 'after', 'preferred', 'note']);
|
|
133
|
-
const allowedOmitKeys = new Set(['file', 'reason']);
|
|
134
121
|
|
|
135
122
|
function fileExists(rel) {
|
|
136
123
|
try {
|
|
@@ -261,25 +248,6 @@ function isRecipeQualityArtifactStrict(value) {
|
|
|
261
248
|
return validator(value);
|
|
262
249
|
}
|
|
263
250
|
|
|
264
|
-
function unknownKeys(record, allowed, prefix) {
|
|
265
|
-
for (const key of Object.keys(record)) {
|
|
266
|
-
if (!allowed.has(key)) issues.push(`${prefix}.${key}: unknown key`);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
function optionalString(record, key, prefix) {
|
|
271
|
-
if (record[key] !== undefined && typeof record[key] !== 'string') {
|
|
272
|
-
issues.push(`${prefix}.${key}: expected string`);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
|
|
276
|
-
function optionalStringArray(record, key, prefix) {
|
|
277
|
-
if (record[key] === undefined) return;
|
|
278
|
-
if (!Array.isArray(record[key]) || record[key].some((entry) => typeof entry !== 'string')) {
|
|
279
|
-
issues.push(`${prefix}.${key}: expected string[]`);
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
251
|
function normalizeArtifactPath(value, mediaOnly = true) {
|
|
284
252
|
if (typeof value !== 'string') return null;
|
|
285
253
|
const trimmed = value.trim();
|
|
@@ -530,92 +498,11 @@ function parseManifest() {
|
|
|
530
498
|
issues.push(`evidence-manifest.json: invalid JSON: ${error.message}`);
|
|
531
499
|
return null;
|
|
532
500
|
}
|
|
533
|
-
|
|
534
|
-
|
|
501
|
+
const manifestIssues = validateEvidenceManifest(manifest);
|
|
502
|
+
if (manifestIssues.length > 0) {
|
|
503
|
+
issues.push(...manifestIssues);
|
|
535
504
|
return null;
|
|
536
505
|
}
|
|
537
|
-
unknownKeys(manifest, allowedManifestKeys, 'manifest');
|
|
538
|
-
if (manifest.version !== undefined && typeof manifest.version !== 'number') {
|
|
539
|
-
issues.push('manifest.version: expected number');
|
|
540
|
-
}
|
|
541
|
-
if (
|
|
542
|
-
manifest.preferred_mode !== undefined &&
|
|
543
|
-
!['screenshots', 'video'].includes(manifest.preferred_mode)
|
|
544
|
-
) {
|
|
545
|
-
issues.push('manifest.preferred_mode: expected screenshots or video');
|
|
546
|
-
}
|
|
547
|
-
optionalString(manifest, 'summary', 'manifest');
|
|
548
|
-
|
|
549
|
-
if (manifest.before_after_pairs !== undefined) {
|
|
550
|
-
if (!Array.isArray(manifest.before_after_pairs)) {
|
|
551
|
-
issues.push('manifest.before_after_pairs: expected array');
|
|
552
|
-
} else {
|
|
553
|
-
manifest.before_after_pairs.forEach((entry, index) => {
|
|
554
|
-
const prefix = `manifest.before_after_pairs[${index}]`;
|
|
555
|
-
if (!isRecord(entry)) return issues.push(`${prefix}: expected object`);
|
|
556
|
-
unknownKeys(entry, allowedPairKeys, prefix);
|
|
557
|
-
if (typeof entry.label !== 'string' || !entry.label.trim())
|
|
558
|
-
issues.push(`${prefix}.label: expected non-empty string`);
|
|
559
|
-
optionalStringArray(entry, 'covers', prefix);
|
|
560
|
-
optionalString(entry, 'before', prefix);
|
|
561
|
-
optionalString(entry, 'after', prefix);
|
|
562
|
-
optionalString(entry, 'note', prefix);
|
|
563
|
-
if (entry.before === undefined && entry.after === undefined)
|
|
564
|
-
issues.push(`${prefix}: expected before or after`);
|
|
565
|
-
});
|
|
566
|
-
}
|
|
567
|
-
}
|
|
568
|
-
|
|
569
|
-
if (manifest.standalone !== undefined) {
|
|
570
|
-
if (!Array.isArray(manifest.standalone)) {
|
|
571
|
-
issues.push('manifest.standalone: expected array');
|
|
572
|
-
} else {
|
|
573
|
-
manifest.standalone.forEach((entry, index) => {
|
|
574
|
-
const prefix = `manifest.standalone[${index}]`;
|
|
575
|
-
if (!isRecord(entry)) return issues.push(`${prefix}: expected object`);
|
|
576
|
-
unknownKeys(entry, allowedStandaloneKeys, prefix);
|
|
577
|
-
if (typeof entry.label !== 'string' || !entry.label.trim())
|
|
578
|
-
issues.push(`${prefix}.label: expected non-empty string`);
|
|
579
|
-
optionalStringArray(entry, 'covers', prefix);
|
|
580
|
-
if (typeof entry.file !== 'string' || !entry.file.trim())
|
|
581
|
-
issues.push(`${prefix}.file: expected non-empty string`);
|
|
582
|
-
optionalString(entry, 'note', prefix);
|
|
583
|
-
});
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
|
|
587
|
-
if (manifest.videos !== undefined) {
|
|
588
|
-
if (!isRecord(manifest.videos)) {
|
|
589
|
-
issues.push('manifest.videos: expected object');
|
|
590
|
-
} else {
|
|
591
|
-
unknownKeys(manifest.videos, allowedVideoKeys, 'manifest.videos');
|
|
592
|
-
optionalString(manifest.videos, 'before', 'manifest.videos');
|
|
593
|
-
optionalString(manifest.videos, 'after', 'manifest.videos');
|
|
594
|
-
optionalString(manifest.videos, 'note', 'manifest.videos');
|
|
595
|
-
if (
|
|
596
|
-
manifest.videos.preferred !== undefined &&
|
|
597
|
-
typeof manifest.videos.preferred !== 'boolean'
|
|
598
|
-
) {
|
|
599
|
-
issues.push('manifest.videos.preferred: expected boolean');
|
|
600
|
-
}
|
|
601
|
-
}
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
if (manifest.omit !== undefined) {
|
|
605
|
-
if (!Array.isArray(manifest.omit)) {
|
|
606
|
-
issues.push('manifest.omit: expected array');
|
|
607
|
-
} else {
|
|
608
|
-
manifest.omit.forEach((entry, index) => {
|
|
609
|
-
const prefix = `manifest.omit[${index}]`;
|
|
610
|
-
if (typeof entry === 'string') return;
|
|
611
|
-
if (!isRecord(entry)) return issues.push(`${prefix}: expected string or object`);
|
|
612
|
-
unknownKeys(entry, allowedOmitKeys, prefix);
|
|
613
|
-
if (typeof entry.file !== 'string' || !entry.file.trim())
|
|
614
|
-
issues.push(`${prefix}.file: expected non-empty string`);
|
|
615
|
-
optionalString(entry, 'reason', prefix);
|
|
616
|
-
});
|
|
617
|
-
}
|
|
618
|
-
}
|
|
619
506
|
|
|
620
507
|
const refs = new Set();
|
|
621
508
|
const artifactRoot = path.posix.dirname(relPath);
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
const MANIFEST_KEYS = new Set([
|
|
2
|
+
'version',
|
|
3
|
+
'preferred_mode',
|
|
4
|
+
'summary',
|
|
5
|
+
'before_after_pairs',
|
|
6
|
+
'standalone',
|
|
7
|
+
'omit',
|
|
8
|
+
'videos',
|
|
9
|
+
'before_state_capture',
|
|
10
|
+
]);
|
|
11
|
+
const PAIR_KEYS = new Set(['label', 'covers', 'before', 'after', 'note']);
|
|
12
|
+
const STANDALONE_KEYS = new Set(['label', 'covers', 'file', 'note']);
|
|
13
|
+
const VIDEO_KEYS = new Set(['before', 'after', 'preferred', 'note']);
|
|
14
|
+
const OMIT_KEYS = new Set(['file', 'reason']);
|
|
15
|
+
|
|
16
|
+
function isRecord(value) {
|
|
17
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function pushUnknownKeyIssues(issues, path, record, allowed) {
|
|
21
|
+
for (const key of Object.keys(record)) {
|
|
22
|
+
if (!allowed.has(key)) issues.push(`${path}.${key}: unknown key`);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function optionalString(issues, record, path, key) {
|
|
27
|
+
if (record[key] !== undefined && typeof record[key] !== 'string') {
|
|
28
|
+
issues.push(`${path}.${key}: expected string`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function optionalStringArray(issues, record, path, key) {
|
|
33
|
+
const value = record[key];
|
|
34
|
+
if (value === undefined) return;
|
|
35
|
+
if (!Array.isArray(value) || value.some((entry) => typeof entry !== 'string')) {
|
|
36
|
+
issues.push(`${path}.${key}: expected string[]`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function validateEvidenceManifest(value) {
|
|
41
|
+
const issues = [];
|
|
42
|
+
if (!isRecord(value)) return ['manifest: expected object'];
|
|
43
|
+
pushUnknownKeyIssues(issues, 'manifest', value, MANIFEST_KEYS);
|
|
44
|
+
|
|
45
|
+
if (value.version !== undefined && typeof value.version !== 'number') {
|
|
46
|
+
issues.push('manifest.version: expected number');
|
|
47
|
+
}
|
|
48
|
+
if (
|
|
49
|
+
value.preferred_mode !== undefined &&
|
|
50
|
+
value.preferred_mode !== 'screenshots' &&
|
|
51
|
+
value.preferred_mode !== 'video'
|
|
52
|
+
) {
|
|
53
|
+
issues.push('manifest.preferred_mode: expected "screenshots" or "video"');
|
|
54
|
+
}
|
|
55
|
+
optionalString(issues, value, 'manifest', 'summary');
|
|
56
|
+
if (value.omit !== undefined) {
|
|
57
|
+
if (!Array.isArray(value.omit)) {
|
|
58
|
+
issues.push('manifest.omit: expected array');
|
|
59
|
+
} else {
|
|
60
|
+
value.omit.forEach((entry, index) => {
|
|
61
|
+
const path = `manifest.omit[${index}]`;
|
|
62
|
+
if (typeof entry === 'string') return;
|
|
63
|
+
if (!isRecord(entry)) {
|
|
64
|
+
issues.push(`${path}: expected string or object`);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
pushUnknownKeyIssues(issues, path, entry, OMIT_KEYS);
|
|
68
|
+
if (typeof entry.file !== 'string' || !entry.file.trim()) {
|
|
69
|
+
issues.push(`${path}.file: expected non-empty string`);
|
|
70
|
+
}
|
|
71
|
+
optionalString(issues, entry, path, 'reason');
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (value.before_state_capture !== undefined && !isRecord(value.before_state_capture)) {
|
|
76
|
+
issues.push('manifest.before_state_capture: expected object');
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (value.before_after_pairs !== undefined) {
|
|
80
|
+
if (!Array.isArray(value.before_after_pairs)) {
|
|
81
|
+
issues.push('manifest.before_after_pairs: expected array');
|
|
82
|
+
} else {
|
|
83
|
+
value.before_after_pairs.forEach((entry, index) => {
|
|
84
|
+
const path = `manifest.before_after_pairs[${index}]`;
|
|
85
|
+
if (!isRecord(entry)) {
|
|
86
|
+
issues.push(`${path}: expected object`);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
pushUnknownKeyIssues(issues, path, entry, PAIR_KEYS);
|
|
90
|
+
if (typeof entry.label !== 'string' || !entry.label.trim()) {
|
|
91
|
+
issues.push(`${path}.label: expected non-empty string`);
|
|
92
|
+
}
|
|
93
|
+
optionalStringArray(issues, entry, path, 'covers');
|
|
94
|
+
optionalString(issues, entry, path, 'before');
|
|
95
|
+
optionalString(issues, entry, path, 'after');
|
|
96
|
+
optionalString(issues, entry, path, 'note');
|
|
97
|
+
if (entry.before === undefined && entry.after === undefined) {
|
|
98
|
+
issues.push(`${path}: expected before or after`);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
if (value.standalone !== undefined) {
|
|
105
|
+
if (!Array.isArray(value.standalone)) {
|
|
106
|
+
issues.push('manifest.standalone: expected array');
|
|
107
|
+
} else {
|
|
108
|
+
value.standalone.forEach((entry, index) => {
|
|
109
|
+
const path = `manifest.standalone[${index}]`;
|
|
110
|
+
if (!isRecord(entry)) {
|
|
111
|
+
issues.push(`${path}: expected object`);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
pushUnknownKeyIssues(issues, path, entry, STANDALONE_KEYS);
|
|
115
|
+
if (typeof entry.label !== 'string' || !entry.label.trim()) {
|
|
116
|
+
issues.push(`${path}.label: expected non-empty string`);
|
|
117
|
+
}
|
|
118
|
+
optionalStringArray(issues, entry, path, 'covers');
|
|
119
|
+
if (typeof entry.file !== 'string' || !entry.file.trim()) {
|
|
120
|
+
issues.push(`${path}.file: expected non-empty string`);
|
|
121
|
+
}
|
|
122
|
+
optionalString(issues, entry, path, 'note');
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
if (value.videos !== undefined) {
|
|
128
|
+
if (!isRecord(value.videos)) {
|
|
129
|
+
issues.push('manifest.videos: expected object');
|
|
130
|
+
} else {
|
|
131
|
+
pushUnknownKeyIssues(issues, 'manifest.videos', value.videos, VIDEO_KEYS);
|
|
132
|
+
optionalString(issues, value.videos, 'manifest.videos', 'before');
|
|
133
|
+
optionalString(issues, value.videos, 'manifest.videos', 'after');
|
|
134
|
+
optionalString(issues, value.videos, 'manifest.videos', 'note');
|
|
135
|
+
if (value.videos.preferred !== undefined && typeof value.videos.preferred !== 'boolean') {
|
|
136
|
+
issues.push('manifest.videos.preferred: expected boolean');
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
return issues;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
module.exports = { validateEvidenceManifest };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export function validateEvidenceManifest(value: unknown): string[];
|
|
@@ -3,6 +3,7 @@ const fs = require('node:fs');
|
|
|
3
3
|
const path = require('node:path');
|
|
4
4
|
const { randomUUID } = require('node:crypto');
|
|
5
5
|
const { spawnSync } = require('node:child_process');
|
|
6
|
+
const { validateEvidenceManifest } = require('./evidence-manifest.cjs');
|
|
6
7
|
const {
|
|
7
8
|
expandedArtifactsForCommand,
|
|
8
9
|
resolveWorkerTerminalContract,
|
|
@@ -68,6 +69,7 @@ function printHelp() {
|
|
|
68
69
|
'Override: farmslot-agent mark <task-dir> --checklist REVIEW.md <step> — optional --signal; signal defaults from checklist name.',
|
|
69
70
|
'Bootstrap: ./mark start — role-owned signal with status running (no checklist box).',
|
|
70
71
|
'Progress: ./mark 1, ./mark 2, ... — checks the box and appends checklistTiming.',
|
|
72
|
+
'Existing evidence manifests are validated before progress or success marks, with field errors on refusal.',
|
|
71
73
|
'Operator: ./mark wait --who "name" --reason "..."; ./mark resume clears the wait without marking a row.',
|
|
72
74
|
'Child units: ./mark sub start <id> --step N --from <path|inline:text>, then ./mark sub <id> <n> | complete [--report PATH] [--mark-last] | blocked --reason "..." | status.',
|
|
73
75
|
' While a child owns step N, ./mark N is refused; the child complete ticks it. Run ./mark sub --help for the child verbs.',
|
|
@@ -509,6 +511,49 @@ function resolveTarget(taskPath, stepNumber, markLast) {
|
|
|
509
511
|
|
|
510
512
|
const taskDir = path.dirname(signalPath);
|
|
511
513
|
|
|
514
|
+
// Validate existing declarations before a progress mark changes the checklist or
|
|
515
|
+
// signal. Missing manifests are normal before proof capture; reviewers must be
|
|
516
|
+
// able to report invalid worker evidence, and operator controls stay available.
|
|
517
|
+
function assertEvidenceManifests() {
|
|
518
|
+
const contract = loadTerminalContract(taskDir, taskPath);
|
|
519
|
+
if (contract?.flowType === 'review') return;
|
|
520
|
+
const manifestPath = 'artifacts/evidence-manifest.json';
|
|
521
|
+
const paths = new Set([
|
|
522
|
+
manifestPath,
|
|
523
|
+
resolveWorkerTerminalArtifactPath(
|
|
524
|
+
taskDir,
|
|
525
|
+
manifestPath,
|
|
526
|
+
contract?.recordedEvidenceContractVersion ?? 0,
|
|
527
|
+
),
|
|
528
|
+
]);
|
|
529
|
+
const issues = [];
|
|
530
|
+
for (const file of paths) {
|
|
531
|
+
let bytes;
|
|
532
|
+
try {
|
|
533
|
+
bytes = fs.readFileSync(path.join(taskDir, file), 'utf8');
|
|
534
|
+
} catch (error) {
|
|
535
|
+
if (error.code === 'ENOENT') continue;
|
|
536
|
+
throw error;
|
|
537
|
+
}
|
|
538
|
+
let manifest;
|
|
539
|
+
try {
|
|
540
|
+
manifest = JSON.parse(bytes);
|
|
541
|
+
} catch (error) {
|
|
542
|
+
issues.push(`${file}: invalid JSON: ${error.message}`);
|
|
543
|
+
continue;
|
|
544
|
+
}
|
|
545
|
+
issues.push(...validateEvidenceManifest(manifest).map((issue) => `${file}: ${issue}`));
|
|
546
|
+
}
|
|
547
|
+
if (issues.length > 0) {
|
|
548
|
+
console.error(`Invalid evidence manifest:\n${issues.map((issue) => `- ${issue}`).join('\n')}`);
|
|
549
|
+
process.exit(1);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
|
|
553
|
+
if (stepNumber != null || terminalCommand === 'complete' || terminalCommand === 'no-change') {
|
|
554
|
+
assertEvidenceManifests();
|
|
555
|
+
}
|
|
556
|
+
|
|
512
557
|
/**
|
|
513
558
|
* A step owned by a child unit belongs to that child until it is settled
|
|
514
559
|
* (`complete` or `done` — a `blocked` child keeps ownership). The child's
|