yam-flow 2.5.1 → 2.7.0

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.
@@ -1,3 +1,5 @@
1
+ import { verifyStrictGateResult } from './gate-result.js';
2
+
1
3
  export const TRUTH_STATUSES = Object.freeze([
2
4
  'verified',
3
5
  'proven',
@@ -1395,7 +1397,24 @@ function missionCompletionCap(value: unknown = ''): TruthStatus {
1395
1397
  const parsed = parseStructuredValue(item);
1396
1398
  if (!parsed || typeof parsed !== 'object') return weakestTruth(weakest, 'blocked');
1397
1399
  const gate = buildMissionCompletionGate(parsed as Record<string, unknown>);
1398
- return weakestTruth(weakest, gate.truth_status);
1400
+ const record = parsed as Record<string, unknown>;
1401
+ const strictGate = record.gate_result && typeof record.gate_result === 'object'
1402
+ ? record.gate_result as Record<string, unknown>
1403
+ : null;
1404
+ const reportedContract = record.gate_contract && typeof record.gate_contract === 'object'
1405
+ ? record.gate_contract as Record<string, unknown>
1406
+ : null;
1407
+ const strictVerification = verifyStrictGateResult(strictGate);
1408
+ const strictReady = Boolean(
1409
+ strictGate
1410
+ && strictGate.boundary === 'mission'
1411
+ && strictGate.gate_id === 'mission-completion'
1412
+ && strictGate.status === 'passed'
1413
+ && strictVerification.valid
1414
+ && reportedContract?.valid === true
1415
+ && reportedContract?.truth_status === 'verified'
1416
+ );
1417
+ return weakestTruth(weakest, strictReady ? gate.truth_status : 'blocked');
1399
1418
  }, 'proven');
1400
1419
  }
1401
1420