@farmslot/agent-runtime 0.39.1 → 0.39.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
|
@@ -8,6 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
- Active-development baseline; add user-facing changes here before release or package publication.
|
|
10
10
|
|
|
11
|
+
## 0.39.3 - 2026-10-27
|
|
12
|
+
|
|
13
|
+
- Refuse worker completion when either evidence manifest names a missing media file, before changing the checklist or signal.
|
|
14
|
+
|
|
15
|
+
## 0.39.2 - 2026-10-26
|
|
16
|
+
|
|
17
|
+
- Remove the local CI-parity worker step and its completion receipt requirement.
|
|
18
|
+
|
|
11
19
|
## 0.39.1 - 2026-10-25
|
|
12
20
|
|
|
13
21
|
- Include the acceptance-contract declaration so typed consumers can resolve the exported helper.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farmslot/agent-runtime",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"@farmslot/adapter-sdk": "0.25.1",
|
|
72
|
-
"@farmslot/protocol": "0.
|
|
72
|
+
"@farmslot/protocol": "0.73.1"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/node": "^22.0.0",
|
|
@@ -5,7 +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 {
|
|
8
|
+
const { evidenceManifestArtifacts, normalizeArtifactPath } = require('./evidence-manifest.cjs');
|
|
9
9
|
const {
|
|
10
10
|
expandedArtifactsForCommand,
|
|
11
11
|
resolveWorkerTerminalArtifactPath,
|
|
@@ -115,9 +115,6 @@ if (!taskDir) {
|
|
|
115
115
|
}
|
|
116
116
|
|
|
117
117
|
const issues = [];
|
|
118
|
-
const mediaExt = /\.(png|jpe?g|gif|webp|mp4|mov|webm)$/i;
|
|
119
|
-
const internalArtifactPath =
|
|
120
|
-
/^artifacts\/(?:harness-launch|harness-relaunch|harness-relaunch-node20|runtime-launch|runtime-relaunch|runner-blockers)\//;
|
|
121
118
|
|
|
122
119
|
function fileExists(rel) {
|
|
123
120
|
try {
|
|
@@ -248,34 +245,6 @@ function isRecipeQualityArtifactStrict(value) {
|
|
|
248
245
|
return validator(value);
|
|
249
246
|
}
|
|
250
247
|
|
|
251
|
-
function normalizeArtifactPath(value, mediaOnly = true) {
|
|
252
|
-
if (typeof value !== 'string') return null;
|
|
253
|
-
const trimmed = value.trim();
|
|
254
|
-
if (!trimmed || /^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(trimmed)) return null;
|
|
255
|
-
const pathPart = trimmed.split(/[?#]/, 1)[0];
|
|
256
|
-
const normalized = pathPart.replace(/\\/g, '/').replace(/^\.\/+/g, '');
|
|
257
|
-
if (!normalized || path.posix.isAbsolute(normalized) || normalized.includes('\0')) return null;
|
|
258
|
-
const segments = normalized.split('/').filter(Boolean);
|
|
259
|
-
if (segments.some((segment) => segment === '.' || segment === '..')) return null;
|
|
260
|
-
const withoutArtifacts =
|
|
261
|
-
segments[0] === 'artifacts' ? segments.slice(1).join('/') : segments.join('/');
|
|
262
|
-
if (!withoutArtifacts || (mediaOnly && !mediaExt.test(withoutArtifacts))) return null;
|
|
263
|
-
return `artifacts/${withoutArtifacts}`;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
function addRef(refs, value, artifactRoot = 'artifacts') {
|
|
267
|
-
const relative = normalizeArtifactPath(value);
|
|
268
|
-
const normalized = relative
|
|
269
|
-
? path.posix.join(artifactRoot, relative.slice('artifacts/'.length))
|
|
270
|
-
: null;
|
|
271
|
-
if (!normalized) return;
|
|
272
|
-
if (internalArtifactPath.test(normalized)) {
|
|
273
|
-
issues.push(`evidence-manifest references internal artifact: ${normalized}`);
|
|
274
|
-
return;
|
|
275
|
-
}
|
|
276
|
-
refs.add(normalized);
|
|
277
|
-
}
|
|
278
|
-
|
|
279
248
|
function validateRecipeQualityArtifact() {
|
|
280
249
|
const relPath = 'artifacts/recipe-quality.json';
|
|
281
250
|
if (!fileExists(relPath)) return;
|
|
@@ -498,26 +467,10 @@ function parseManifest() {
|
|
|
498
467
|
issues.push(`evidence-manifest.json: invalid JSON: ${error.message}`);
|
|
499
468
|
return null;
|
|
500
469
|
}
|
|
501
|
-
const
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
506
|
-
|
|
507
|
-
const refs = new Set();
|
|
508
|
-
const artifactRoot = path.posix.dirname(relPath);
|
|
509
|
-
for (const pair of manifest.before_after_pairs ?? []) {
|
|
510
|
-
addRef(refs, pair?.before, artifactRoot);
|
|
511
|
-
addRef(refs, pair?.after, artifactRoot);
|
|
512
|
-
}
|
|
513
|
-
for (const entry of manifest.standalone ?? []) addRef(refs, entry?.file, artifactRoot);
|
|
514
|
-
addRef(refs, manifest.videos?.before, artifactRoot);
|
|
515
|
-
addRef(refs, manifest.videos?.after, artifactRoot);
|
|
516
|
-
|
|
517
|
-
for (const ref of [...refs].sort()) {
|
|
518
|
-
if (!fileExists(ref)) issues.push(`evidence-manifest references missing artifact: ${ref}`);
|
|
519
|
-
}
|
|
520
|
-
return { manifest, refs };
|
|
470
|
+
const result = evidenceManifestArtifacts(manifest, path.posix.dirname(relPath), fileExists);
|
|
471
|
+
issues.push(...result.issues);
|
|
472
|
+
if (!result.refs) return null;
|
|
473
|
+
return { manifest, refs: result.refs };
|
|
521
474
|
}
|
|
522
475
|
|
|
523
476
|
let terminalContract;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const path = require('node:path');
|
|
2
|
+
|
|
1
3
|
const MANIFEST_KEYS = new Set([
|
|
2
4
|
'version',
|
|
3
5
|
'preferred_mode',
|
|
@@ -141,4 +143,54 @@ function validateEvidenceManifest(value) {
|
|
|
141
143
|
return issues;
|
|
142
144
|
}
|
|
143
145
|
|
|
144
|
-
|
|
146
|
+
function normalizeArtifactPath(value, mediaOnly = true) {
|
|
147
|
+
if (typeof value !== 'string') return null;
|
|
148
|
+
const trimmed = value.trim();
|
|
149
|
+
if (!trimmed || /^(?:[a-z][a-z0-9+.-]*:|\/\/|#)/i.test(trimmed)) return null;
|
|
150
|
+
const pathPart = trimmed.split(/[?#]/, 1)[0];
|
|
151
|
+
const normalized = pathPart.replace(/\\/g, '/').replace(/^\.\/+/g, '');
|
|
152
|
+
if (!normalized || path.posix.isAbsolute(normalized) || normalized.includes('\0')) return null;
|
|
153
|
+
const segments = normalized.split('/').filter(Boolean);
|
|
154
|
+
if (segments.some((segment) => segment === '.' || segment === '..')) return null;
|
|
155
|
+
const withoutArtifacts =
|
|
156
|
+
segments[0] === 'artifacts' ? segments.slice(1).join('/') : segments.join('/');
|
|
157
|
+
if (
|
|
158
|
+
!withoutArtifacts ||
|
|
159
|
+
(mediaOnly && !/\.(png|jpe?g|gif|webp|mp4|mov|webm)$/i.test(withoutArtifacts))
|
|
160
|
+
)
|
|
161
|
+
return null;
|
|
162
|
+
return `artifacts/${withoutArtifacts}`;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
function evidenceManifestArtifacts(value, artifactRoot, fileExists) {
|
|
166
|
+
const issues = validateEvidenceManifest(value);
|
|
167
|
+
const refs = new Set();
|
|
168
|
+
if (issues.length) return { refs: null, issues };
|
|
169
|
+
const add = (value) => {
|
|
170
|
+
const relative = normalizeArtifactPath(value);
|
|
171
|
+
if (!relative) return;
|
|
172
|
+
const normalized = path.posix.join(artifactRoot, relative.slice('artifacts/'.length));
|
|
173
|
+
if (
|
|
174
|
+
/^artifacts\/(?:harness-launch|harness-relaunch|harness-relaunch-node20|runtime-launch|runtime-relaunch|runner-blockers)\//.test(
|
|
175
|
+
normalized,
|
|
176
|
+
)
|
|
177
|
+
) {
|
|
178
|
+
issues.push(`evidence-manifest references internal artifact: ${normalized}`);
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
refs.add(normalized);
|
|
182
|
+
};
|
|
183
|
+
for (const pair of value.before_after_pairs ?? []) {
|
|
184
|
+
add(pair.before);
|
|
185
|
+
add(pair.after);
|
|
186
|
+
}
|
|
187
|
+
for (const entry of value.standalone ?? []) add(entry.file);
|
|
188
|
+
add(value.videos?.before);
|
|
189
|
+
add(value.videos?.after);
|
|
190
|
+
for (const ref of [...refs].sort()) {
|
|
191
|
+
if (!fileExists(ref)) issues.push(`evidence-manifest references missing artifact: ${ref}`);
|
|
192
|
+
}
|
|
193
|
+
return { refs, issues };
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
module.exports = { validateEvidenceManifest, normalizeArtifactPath, evidenceManifestArtifacts };
|
|
@@ -1 +1,11 @@
|
|
|
1
1
|
export function validateEvidenceManifest(value: unknown): string[];
|
|
2
|
+
export function normalizeArtifactPath(value: unknown, mediaOnly?: boolean): string | null;
|
|
3
|
+
export interface EvidenceManifestArtifacts {
|
|
4
|
+
refs: Set<string> | null;
|
|
5
|
+
issues: string[];
|
|
6
|
+
}
|
|
7
|
+
export function evidenceManifestArtifacts(
|
|
8
|
+
value: unknown,
|
|
9
|
+
artifactRoot: string,
|
|
10
|
+
fileExists: (path: string) => boolean,
|
|
11
|
+
): EvidenceManifestArtifacts;
|
|
@@ -3,7 +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
|
+
const { validateEvidenceManifest, evidenceManifestArtifacts } = require('./evidence-manifest.cjs');
|
|
7
7
|
const {
|
|
8
8
|
expandedArtifactsForCommand,
|
|
9
9
|
resolveWorkerTerminalContract,
|
|
@@ -546,7 +546,13 @@ function assertEvidenceManifests() {
|
|
|
546
546
|
issues.push(`${file}: invalid JSON: ${error.message}`);
|
|
547
547
|
continue;
|
|
548
548
|
}
|
|
549
|
-
|
|
549
|
+
const manifestIssues =
|
|
550
|
+
terminalCommand === 'complete' || terminalCommand === 'no-change'
|
|
551
|
+
? evidenceManifestArtifacts(manifest, path.posix.dirname(file), (ref) =>
|
|
552
|
+
taskFileExists(taskDir, ref),
|
|
553
|
+
).issues
|
|
554
|
+
: validateEvidenceManifest(manifest);
|
|
555
|
+
issues.push(...manifestIssues.map((issue) => `${file}: ${issue}`));
|
|
550
556
|
}
|
|
551
557
|
if (issues.length > 0) {
|
|
552
558
|
console.error(`Invalid evidence manifest:\n${issues.map((issue) => `- ${issue}`).join('\n')}`);
|
|
@@ -456,7 +456,9 @@ function deterministicDeclarations(markdown, checklist) {
|
|
|
456
456
|
if (!match && item.rawLabel.includes('[DETERMINISTIC')) {
|
|
457
457
|
throw new Error(`Invalid deterministic declaration in ${checklist} step ${item.stepNumber}`);
|
|
458
458
|
}
|
|
459
|
-
return match
|
|
459
|
+
return match && match[1] !== 'ci.local_check'
|
|
460
|
+
? [{ checklist, stepNumber: item.stepNumber, reference: match[1] }]
|
|
461
|
+
: [];
|
|
460
462
|
});
|
|
461
463
|
}
|
|
462
464
|
|
|
@@ -492,7 +494,7 @@ function deterministicContract(taskDir, checklist) {
|
|
|
492
494
|
function recordedDeterministicSteps(taskDir, checklist) {
|
|
493
495
|
const contract = deterministicContract(taskDir, checklist);
|
|
494
496
|
const frozen = (contract.deterministicChecks ?? []).filter(
|
|
495
|
-
(step) => step.checklist === checklist,
|
|
497
|
+
(step) => step.checklist === checklist && step.reference !== 'ci.local_check',
|
|
496
498
|
);
|
|
497
499
|
const file = path.join(taskDir, checklist);
|
|
498
500
|
const actual = fs.existsSync(file)
|