@farmslot/agent-runtime 0.39.5 → 0.39.6

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,10 @@
8
8
 
9
9
  - Active-development baseline; add user-facing changes here before release or package publication.
10
10
 
11
+ ## 0.39.6 - 2026-10-28
12
+
13
+ - PR completion keeps linked criteria as evidence and checks worker-derived requirements without waiting for review.
14
+
11
15
  ## 0.39.5 - 2026-10-28
12
16
 
13
17
  - Cache native process metadata for up to a minute during passive polling while keeping fresh identity checks for cleanup and controls.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farmslot/agent-runtime",
3
- "version": "0.39.5",
3
+ "version": "0.39.6",
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.73.1"
72
+ "@farmslot/protocol": "0.74.0"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/node": "^22.0.0",
@@ -28,8 +28,6 @@ function effectiveAcceptanceContract(taskDir, base, baseBytes) {
28
28
  !Number.isSafeInteger(revision.revision) ||
29
29
  revision.revision < 1 ||
30
30
  !Array.isArray(revision.proofModes) ||
31
- typeof revision.claimReviewGate !== 'boolean' ||
32
- typeof revision.publicationReview !== 'boolean' ||
33
31
  revision.baseContractHash !== createHash('sha256').update(frozenBase).digest('hex')
34
32
  )
35
33
  throw new Error(
@@ -61,11 +59,11 @@ function effectiveAcceptanceContract(taskDir, base, baseBytes) {
61
59
  proofModes.set(row.id, row);
62
60
  }
63
61
  const {
64
- handoffAcceptanceCriteria,
62
+ workerAcceptanceCriteria,
65
63
  readAcceptanceLedger,
66
64
  inheritedCriterionIdsForTask,
67
65
  } = require('./acceptance-ledger.cjs');
68
- const criteria = handoffAcceptanceCriteria(taskDir);
66
+ const criteria = workerAcceptanceCriteria(taskDir);
69
67
  const inherited = inheritedCriterionIdsForTask(taskDir, criteria);
70
68
  const recordedInherited = revision.inheritedCriterionIds ?? [];
71
69
  if (
@@ -78,10 +76,6 @@ function effectiveAcceptanceContract(taskDir, base, baseBytes) {
78
76
  if (inherited.has(criterion.id)) continue;
79
77
  const row = ledger?.criteria?.find((candidate) => candidate.id === criterion.id);
80
78
  const mode = criterion.proofMode ?? row?.proofMode;
81
- if (['visual', 'mixed'].includes(mode) && base.claimReviewSupported === false)
82
- throw new Error(
83
- `${criterion.id}: captured visual completion review is unsupported for this run policy.`,
84
- );
85
79
  if (
86
80
  mode &&
87
81
  (proofModes.get(criterion.id)?.proofMode !== mode ||
@@ -93,11 +87,6 @@ function effectiveAcceptanceContract(taskDir, base, baseBytes) {
93
87
  }
94
88
  return {
95
89
  ...base,
96
- claimReviewGate: revision.claimReviewGate,
97
- publicationReview: revision.publicationReview,
98
- acceptanceReviewCriteria: revision.proofModes
99
- .filter(({ id, proofMode }) => proofMode === 'review' && !inherited.has(id))
100
- .map(({ id }) => id),
101
90
  inheritedAcceptanceCriteria: [...inherited],
102
91
  };
103
92
  }
@@ -116,6 +116,15 @@ function requireHandoffAcceptanceCriteria(taskDir) {
116
116
  return criteriaFromHandoff(handoff, taskDir);
117
117
  }
118
118
 
119
+ /** PR completion checks worker-derived requirements; original ACs remain evidence. */
120
+ function workerAcceptanceCriteria(taskDir) {
121
+ const criteria = requireHandoffAcceptanceCriteria(taskDir);
122
+ if (readJson(path.join(taskDir, HANDOFF_INPUT)).flow !== 'pr-complete') return criteria;
123
+ const { registration } = readJson(path.join(taskDir, ACCEPTANCE_REGISTRATION_INPUT));
124
+ const derived = new Set((registration?.derived ?? []).map(({ id }) => id));
125
+ return criteria.filter(({ id }) => derived.has(id));
126
+ }
127
+
119
128
  /** One message shape for a handoff the acceptance rule cannot read. */
120
129
  function handoffReadRefusal(detail) {
121
130
  return (
@@ -349,7 +358,12 @@ function acceptanceContractIssues(taskDir, options = {}) {
349
358
  `Acceptance derivation ${unit.id} is pending${unit.error ? `: ${unit.error}` : '; complete the source classification subtask'}.`,
350
359
  );
351
360
  if (criteria.length === 0) return [];
361
+ const completion = readJson(path.join(taskDir, HANDOFF_INPUT)).flow === 'pr-complete';
352
362
  const known = new Set(criteria.map(({ id }) => id));
363
+ if (completion) {
364
+ criteria = workerAcceptanceCriteria(taskDir);
365
+ if (!criteria.length) return [];
366
+ }
353
367
  try {
354
368
  const inherited = inheritedCriterionIdsForTask(taskDir, criteria, options.requireFresh);
355
369
  criteria = criteria.filter(({ id }) => !inherited.has(id));
@@ -398,13 +412,13 @@ function acceptanceContractIssues(taskDir, options = {}) {
398
412
  );
399
413
  continue;
400
414
  }
401
- const reviewDeferred =
415
+ const retainedReviewEvidence =
416
+ completion &&
402
417
  entry.verdict === 'awaiting-review' &&
403
- entry.proofMode === 'review' &&
404
- options.deferReviewCriteria?.includes(criterion.id);
418
+ ['visual', 'mixed', 'review'].includes(entry.proofMode);
405
419
  if (
406
- options.deferClaimVerdicts !== true &&
407
- !reviewDeferred &&
420
+ (completion || options.deferClaimVerdicts !== true) &&
421
+ !retainedReviewEvidence &&
408
422
  (entry.verdict === 'failed' ||
409
423
  entry.verdict === 'awaiting-review' ||
410
424
  (!options.allowWeak && (entry.verdict === 'missing' || entry.verdict === 'weak')))
@@ -425,6 +439,7 @@ module.exports = {
425
439
  ACCEPTANCE_VERDICTS,
426
440
  AcceptanceRefusal,
427
441
  acceptanceContractIssues,
442
+ workerAcceptanceCriteria,
428
443
  acceptanceCriterionId,
429
444
  acceptanceRowExecution,
430
445
  acceptanceStatusList,
@@ -589,10 +589,16 @@ if (
589
589
  flags.has('--require-acceptance-status') ||
590
590
  (terminalCommand === 'complete' && !isReviewTerminal)
591
591
  ) {
592
+ const owningFlow =
593
+ readJsonArtifact('inputs/handoff.json', 'handoff')?.flow ?? terminalContract?.flowType;
592
594
  let deferClaimVerdicts = false;
593
595
  const ledger = readAcceptanceLedger(taskDir);
594
596
  // ADR-062 Amendment 18: only the run's publication code review checks a `review` claim.
595
- if (terminalCommand === 'complete' && terminalContract?.publicationReview !== true) {
597
+ if (
598
+ terminalCommand === 'complete' &&
599
+ owningFlow !== 'pr-complete' &&
600
+ terminalContract?.publicationReview !== true
601
+ ) {
596
602
  for (const row of Array.isArray(ledger?.criteria) ? ledger.criteria : []) {
597
603
  if (
598
604
  row?.proofMode === 'review' &&
@@ -605,6 +611,7 @@ if (
605
611
  }
606
612
  if (
607
613
  terminalCommand === 'complete' &&
614
+ owningFlow !== 'pr-complete' &&
608
615
  terminalContract?.claimReviewGate === true &&
609
616
  ledger?.schemaVersion === 2
610
617
  ) {
@@ -614,10 +621,6 @@ if (
614
621
  deferClaimVerdicts = integrityIssues.length === 0;
615
622
  }
616
623
  for (const issue of acceptanceContractIssues(taskDir, {
617
- deferReviewCriteria:
618
- terminalContract?.publicationReview === true
619
- ? terminalContract.acceptanceReviewCriteria
620
- : undefined,
621
624
  allowWeak: terminalContract?.acceptance?.allowWeak === true,
622
625
  requireFresh: terminalContract?.acceptance?.requireFresh === true,
623
626
  deferClaimVerdicts,