@farmslot/agent-runtime 0.3.0 → 0.3.1

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
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.3.1 - 2026-07-24
6
+
7
+ - Validate retained recipe traces against their recipes and artifact attribution.
8
+
5
9
  ## 0.3.0 - 2026-07-24
6
10
 
7
11
  - Fail artifact validation when the installed protocol rejects the canonical Recipe v1 envelope.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farmslot/agent-runtime",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@
31
31
  "prepublishOnly": "node ../../scripts/quality/check-farmslot-package-readiness.mjs --publish --packages @farmslot/agent-runtime"
32
32
  },
33
33
  "dependencies": {
34
- "@farmslot/protocol": "0.11.1"
34
+ "@farmslot/protocol": "0.12.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@types/node": "^22.0.0",
@@ -39,14 +39,14 @@ try {
39
39
  }
40
40
  }
41
41
  let recipeProtocol = null;
42
- try {
43
- recipeProtocol = await import('@farmslot/protocol/recipe');
44
- } catch (error) {
45
- if (!isMissingWorkspaceProtocolBuild(error, 'dist/recipe/index.js')) throw error;
46
- // Source checkouts can run before @farmslot/protocol has emitted dist/.
47
- // Keep strict local validation until the shared validator is available.
48
- if (process.env.FARMSLOT_DEBUG_AGENT_RUNTIME) {
49
- console.warn(`[agent-runtime] using local Recipe v1 fallback: ${error.message}`);
42
+ if (process.env.FARMSLOT_TEST_DISABLE_RECIPE_PROTOCOL !== '1') {
43
+ try {
44
+ recipeProtocol = await import('@farmslot/protocol/recipe');
45
+ } catch (error) {
46
+ if (!isMissingWorkspaceProtocolBuild(error, 'dist/recipe/index.js')) throw error;
47
+ if (process.env.FARMSLOT_DEBUG_AGENT_RUNTIME) {
48
+ console.warn(`[agent-runtime] shared Recipe v1 validator unavailable: ${error.message}`);
49
+ }
50
50
  }
51
51
  }
52
52
  if (recipeProtocol) {
@@ -325,6 +325,7 @@ function validateRecipeDocumentArtifact() {
325
325
  `${packageRoot}/artifact-manifest.json`,
326
326
  'recipe-run/artifact-manifest.json',
327
327
  );
328
+ const trace = readJsonArtifact(`${packageRoot}/trace.json`, 'recipe-run/trace.json');
328
329
  const recipeResolution = readJsonArtifact(
329
330
  `${packageRoot}/recipe-resolution.json`,
330
331
  'recipe-run/recipe-resolution.json',
@@ -339,34 +340,24 @@ function validateRecipeDocumentArtifact() {
339
340
  if (document !== undefined) resolvedRecipes[String(dependency.digest)] = document;
340
341
  }
341
342
  }
342
- if (sharedRecipeArtifactPackageValidator) {
343
- const result = sharedRecipeArtifactPackageValidator({
344
- recipe,
345
- manifest,
346
- recipeResolution,
347
- resolvedRecipes,
348
- artifactPaths: listArtifactPaths(path.join(taskDir, packageRoot)),
349
- });
350
- for (const finding of result.findings) {
351
- if (finding.severity === 'error') {
352
- issues.push(`${finding.code} ${finding.path}: ${finding.message}`);
353
- }
354
- }
343
+ if (!sharedRecipeArtifactPackageValidator) {
344
+ issues.push(
345
+ 'recipe-run package validation requires built @farmslot/protocol; build the protocol package and retry',
346
+ );
355
347
  return;
356
348
  }
357
- if (manifest === undefined) issues.push('artifact-manifest.json is missing');
358
- if (recipeResolution === undefined) issues.push('recipe-resolution.json is missing');
359
- const externalRecipeIds = new Set(
360
- isRecord(recipeResolution) && Array.isArray(recipeResolution.dependencies)
361
- ? recipeResolution.dependencies
362
- .filter(isRecord)
363
- .map((dependency) => dependency.ref)
364
- .filter((ref) => typeof ref === 'string')
365
- : [],
366
- );
367
- validateRecipeDocumentValue(recipe, 'recipe.json', { externalRecipeIds });
368
- for (const [digest, document] of Object.entries(resolvedRecipes)) {
369
- validateRecipeDocumentValue(document, `resolved recipe ${digest}`, { externalRecipeIds });
349
+ const result = sharedRecipeArtifactPackageValidator({
350
+ recipe,
351
+ manifest,
352
+ trace,
353
+ recipeResolution,
354
+ resolvedRecipes,
355
+ artifactPaths: listArtifactPaths(path.join(taskDir, packageRoot)),
356
+ });
357
+ for (const finding of result.findings) {
358
+ if (finding.severity === 'error') {
359
+ issues.push(`${finding.code} ${finding.path}: ${finding.message}`);
360
+ }
370
361
  }
371
362
  }
372
363