@farmslot/agent-runtime 0.45.0 → 0.45.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
@@ -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.45.1 - 2026-11-08
8
+
9
+ - Let a frozen proof-trial terminal contract record failed or missing measurements without inventing passing acceptance verdicts.
10
+
7
11
  ## 0.45.0 - 2026-11-08
8
12
 
9
13
  - Show Farm workers advisory shape and registered-AC feedback before completion through task-local helpers, without changing standalone skill defaults.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farmslot/agent-runtime",
3
- "version": "0.45.0",
3
+ "version": "0.45.1",
4
4
  "minimumRuntimeVersion": "0.42.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -61,7 +61,7 @@
61
61
  },
62
62
  "scripts": {
63
63
  "typecheck": "yarn workspace @farmslot/protocol build && tsc --noEmit --project tsconfig.json",
64
- "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 test/acceptance-contract.test.cjs test/acceptance-derivation.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 test/recipe-shape-feedback.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",
64
+ "test": "node --test test/proof-measurement.test.cjs 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 test/acceptance-contract.test.cjs test/acceptance-derivation.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 test/recipe-shape-feedback.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",
65
65
  "format": "prettier --write --ignore-path ../../.prettierignore .",
66
66
  "format:check": "prettier --check --ignore-path ../../.prettierignore .",
67
67
  "lint": "eslint \"src/**/*.ts\"",
@@ -76,7 +76,7 @@
76
76
  },
77
77
  "dependencies": {
78
78
  "@farmslot/adapter-sdk": "0.26.3",
79
- "@farmslot/protocol": "0.82.0"
79
+ "@farmslot/protocol": "0.82.1"
80
80
  },
81
81
  "devDependencies": {
82
82
  "@types/node": "^22.0.0",
@@ -8,6 +8,8 @@ const require = createRequire(import.meta.url);
8
8
  const { evidenceManifestArtifacts, normalizeArtifactPath } = require('./evidence-manifest.cjs');
9
9
  const {
10
10
  expandedArtifactsForCommand,
11
+ isProofMeasurementContract,
12
+ isProofMeasurementTask,
11
13
  resolveWorkerTerminalArtifactPath,
12
14
  deterministicChecks,
13
15
  } = require('./worker-terminal-contract.cjs');
@@ -495,12 +497,13 @@ if (contractPath && terminalCommand && existsSync(contractPath)) {
495
497
  }
496
498
  }
497
499
  const isReviewTerminal = terminalContract?.flowType === 'review';
500
+ const proofMeasurement = isProofMeasurementContract(terminalContract);
498
501
  const hasRecipe = fileExists('artifacts/recipe.json');
499
502
 
500
503
  // A reviewer must be able to report ISSUES when worker-owned proof is invalid.
501
504
  // Its terminal gate validates only the reviewer-owned feedback artifact below;
502
505
  // contribution and fix flows still validate the complete proof package.
503
- if (!isReviewTerminal) {
506
+ if (!isReviewTerminal && !proofMeasurement) {
504
507
  const hasRecipeDecision = fileExists('artifacts/recipe-decision.json');
505
508
  const recipeDecisionText = readText('artifacts/recipe-decision.json');
506
509
  if (hasRecipeDecision) {
@@ -581,7 +584,11 @@ if (!isReviewTerminal) {
581
584
 
582
585
  // A registered child unit is part of the parent's proof: the parent cannot
583
586
  // report success while a child checklist is still running or blocked.
584
- if (fileExists(SUBTASK_INDEX_REL)) {
587
+ if (
588
+ fileExists(SUBTASK_INDEX_REL) &&
589
+ !proofMeasurement &&
590
+ !(isReviewTerminal && isProofMeasurementTask(taskDir))
591
+ ) {
585
592
  for (const { unit, status } of openSubtaskUnits(taskDir)) {
586
593
  issues.push(
587
594
  `${unit.checklist}: subtask ${unit.id} is not settled (status ${status ?? 'no signal'}) — ` +
@@ -594,8 +601,9 @@ if (fileExists(SUBTASK_INDEX_REL)) {
594
601
  // init registered in inputs/handoff.json needs a verdict, and `weak` / `missing`
595
602
  // fails unless the flow's terminal contract waives it.
596
603
  if (
597
- flags.has('--require-acceptance-status') ||
598
- (terminalCommand === 'complete' && !isReviewTerminal)
604
+ !proofMeasurement &&
605
+ (flags.has('--require-acceptance-status') ||
606
+ (terminalCommand === 'complete' && !isReviewTerminal))
599
607
  ) {
600
608
  const owningFlow =
601
609
  readJsonArtifact('inputs/handoff.json', 'handoff')?.flow ?? terminalContract?.flowType;
@@ -675,7 +683,7 @@ if (terminalCommand !== 'blocked') {
675
683
  for (const checklist of checklists) {
676
684
  try {
677
685
  const result = deterministicChecks.evaluate(taskDir, checklist);
678
- issues.push(...result.issues);
686
+ if (!proofMeasurement) issues.push(...result.issues);
679
687
  deterministicResults.push(...result.checks);
680
688
  } catch (error) {
681
689
  issues.push(`Deterministic checks cannot be validated: ${error.message}`);
@@ -6,6 +6,8 @@ const { spawnSync } = require('node:child_process');
6
6
  const { validateEvidenceManifest, evidenceManifestArtifacts } = require('./evidence-manifest.cjs');
7
7
  const {
8
8
  expandedArtifactsForCommand,
9
+ isProofMeasurementContract,
10
+ isProofMeasurementTask,
9
11
  resolveWorkerTerminalContract,
10
12
  resolveWorkerTerminalArtifactPath,
11
13
  deterministicChecks,
@@ -593,14 +595,29 @@ function assertNoOpenSubtasks(command) {
593
595
  process.exit(1);
594
596
  }
595
597
 
598
+ // A proof trial records incomplete work as a measurement; it does not request a repair.
599
+ const proofMeasurement =
600
+ terminalCommand !== 'blocked' &&
601
+ Boolean(terminalCommand && isProofMeasurementContract(loadTerminalContract(taskDir, taskPath)));
596
602
  // `blocked` stays available while a child is open: the run is blocked either way.
597
- if (terminalCommand === 'complete' || terminalCommand === 'no-change') {
603
+ const proofJudge = Boolean(
604
+ terminalCommand &&
605
+ terminalCommand !== 'blocked' &&
606
+ loadTerminalContract(taskDir, taskPath)?.flowType === 'review' &&
607
+ isProofMeasurementTask(taskDir),
608
+ );
609
+ if (
610
+ !proofMeasurement &&
611
+ !proofJudge &&
612
+ (terminalCommand === 'complete' || terminalCommand === 'no-change')
613
+ ) {
598
614
  assertNoOpenSubtasks(terminalCommand);
599
615
  }
600
616
  if (
601
617
  terminalCommand &&
602
618
  (terminalCommand === 'complete' || terminalCommand === 'no-change') &&
603
619
  opts['mark-last'] &&
620
+ !proofMeasurement &&
604
621
  !opts['skip-checklist']
605
622
  ) {
606
623
  assertChecklistComplete(taskPath, { allowOneUnchecked: true });
@@ -51,6 +51,7 @@ const { atomicWrite } = require('./mark-io.cjs');
51
51
  * @typedef {object} WorkerTerminalContractDocument
52
52
  * @property {1} schemaVersion
53
53
  * @property {string} flowType
54
+ * @property {true} [proofMeasurement] Gateway-owned QA measurement policy.
54
55
  * @property {string} [mode]
55
56
  * @property {boolean} requireSignal
56
57
  * @property {number} [recordedEvidenceContractVersion] Gateway-owned run version projection.
@@ -217,13 +218,16 @@ function normalizeCommandLayer(layer) {
217
218
  /**
218
219
  * @param {WorkerTerminalProjectConfig | null | undefined} projectConfig
219
220
  * @param {string} flowType
220
- * @param {{ mode?: string | null, now?: string }} [options]
221
+ * @param {{ mode?: string | null, now?: string, proofMeasurement?: true }} [options]
221
222
  * @returns {WorkerTerminalContractDocument}
222
223
  */
223
224
  function resolveWorkerTerminalContract(projectConfig, flowType, options = {}) {
224
225
  const mode = options.mode ?? undefined;
225
226
  const now = options.now ?? new Date().toISOString();
226
227
  const flowKey = String(flowType || '').trim() || 'unknown';
228
+ const proofMeasurement = options.proofMeasurement === true;
229
+ if (proofMeasurement && flowKey !== 'qa')
230
+ throw new Error('Proof measurements require the QA flow');
227
231
 
228
232
  const defaultsLayer = normalizeCommandLayer({
229
233
  complete: projectConfig?.complete,
@@ -279,11 +283,14 @@ function resolveWorkerTerminalContract(projectConfig, flowType, options = {}) {
279
283
  return {
280
284
  schemaVersion: 1,
281
285
  flowType: flowKey,
286
+ ...(proofMeasurement ? { proofMeasurement: true } : {}),
282
287
  ...(mode ? { mode } : {}),
283
288
  requireSignal,
284
- ...(acceptance && Object.keys(acceptance).length > 0 ? { acceptance } : {}),
285
- commands,
286
- whenPresent,
289
+ ...(!proofMeasurement && acceptance && Object.keys(acceptance).length > 0
290
+ ? { acceptance }
291
+ : {}),
292
+ commands: proofMeasurement ? { ...commands, complete: { artifacts: [] } } : commands,
293
+ whenPresent: proofMeasurement ? [] : whenPresent,
287
294
  resolvedAt: now,
288
295
  source: projectConfig ? 'project' : 'builtin',
289
296
  };
@@ -795,8 +802,26 @@ const deterministicChecks = {
795
802
  evaluate: evaluateDeterministicChecks,
796
803
  };
797
804
 
805
+ /** Only a frozen gateway QA contract selects measurement completion. */
806
+ function isProofMeasurementContract(contract) {
807
+ return contract?.flowType === 'qa' && contract.proofMeasurement === true;
808
+ }
809
+
810
+ /** The root policy also lets its static judge inspect unfinished worker subtasks. */
811
+ function isProofMeasurementTask(taskDir) {
812
+ const file = path.join(taskDir, 'inputs/worker-terminal-contract.json');
813
+ try {
814
+ return isProofMeasurementContract(JSON.parse(fs.readFileSync(file, 'utf8')));
815
+ } catch (error) {
816
+ if (error.code === 'ENOENT') return false;
817
+ throw error;
818
+ }
819
+ }
820
+
798
821
  module.exports = {
799
822
  TERMINAL_COMMANDS,
823
+ isProofMeasurementContract,
824
+ isProofMeasurementTask,
800
825
  BUILTIN_FLOW_COMMANDS,
801
826
  resolveWorkerTerminalContract,
802
827
  lintWorkerTemplateAgainstContract,