@resolveio/server-lib 22.3.190 → 22.3.192

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.
@@ -612,12 +612,166 @@ function hotfixCommitProofGate(evidence, now) {
612
612
  }
613
613
  };
614
614
  }
615
- function collectHotfixEvidenceEvents(sources, events, gates, now) {
615
+ function hotfixDurabilityContractCandidates() {
616
616
  var e_12, _a;
617
- var _b, _c;
617
+ var sources = [];
618
+ for (var _i = 0; _i < arguments.length; _i++) {
619
+ sources[_i] = arguments[_i];
620
+ }
621
+ var result = [];
622
+ var seen = new Set();
623
+ var pushCandidate = function (value) {
624
+ var e_13, _a, e_14, _b;
625
+ var _c, _d;
626
+ if (Array.isArray(value)) {
627
+ try {
628
+ for (var value_2 = __values(value), value_2_1 = value_2.next(); !value_2_1.done; value_2_1 = value_2.next()) {
629
+ var entry = value_2_1.value;
630
+ pushCandidate(entry);
631
+ }
632
+ }
633
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
634
+ finally {
635
+ try {
636
+ if (value_2_1 && !value_2_1.done && (_a = value_2.return)) _a.call(value_2);
637
+ }
638
+ finally { if (e_13) throw e_13.error; }
639
+ }
640
+ return;
641
+ }
642
+ if (!value || typeof value !== 'object') {
643
+ return;
644
+ }
645
+ var nestedValues = [
646
+ value.hotfixDurabilityContract,
647
+ value.hotfix_durability_contract,
648
+ value.supportManagerHotfixDurabilityContract,
649
+ value.support_manager_hotfix_durability_contract,
650
+ value.managerRecoveryHotfixDurability,
651
+ value.manager_recovery_hotfix_durability,
652
+ (_c = value.supportV5RecoveryDirective) === null || _c === void 0 ? void 0 : _c.hotfixDurabilityContract,
653
+ (_d = value.supportV5RecoveryDirective) === null || _d === void 0 ? void 0 : _d.hotfix_durability_contract
654
+ ].filter(Boolean);
655
+ if (nestedValues.length) {
656
+ try {
657
+ for (var nestedValues_2 = __values(nestedValues), nestedValues_2_1 = nestedValues_2.next(); !nestedValues_2_1.done; nestedValues_2_1 = nestedValues_2.next()) {
658
+ var nestedValue = nestedValues_2_1.value;
659
+ pushCandidate(nestedValue);
660
+ }
661
+ }
662
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
663
+ finally {
664
+ try {
665
+ if (nestedValues_2_1 && !nestedValues_2_1.done && (_b = nestedValues_2.return)) _b.call(nestedValues_2);
666
+ }
667
+ finally { if (e_14) throw e_14.error; }
668
+ }
669
+ }
670
+ var required = value.required === true || value.liveHotfixBlockedUntilCommit === true || value.live_hotfix_blocked_until_commit === true || value.commitProofPassed === true || value.commit_proof_passed === true;
671
+ if (!required) {
672
+ return;
673
+ }
674
+ var key = cleanText(value.contractId || value.contract_id || JSON.stringify({
675
+ status: value.status,
676
+ sha: value.sourceCommitSha || value.source_commit_sha,
677
+ url: value.githubCommitUrl || value.github_commit_url
678
+ }), 500);
679
+ if (seen.has(key)) {
680
+ return;
681
+ }
682
+ seen.add(key);
683
+ result.push(value);
684
+ };
685
+ try {
686
+ for (var sources_2 = __values(sources), sources_2_1 = sources_2.next(); !sources_2_1.done; sources_2_1 = sources_2.next()) {
687
+ var source = sources_2_1.value;
688
+ pushCandidate(source);
689
+ }
690
+ }
691
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
692
+ finally {
693
+ try {
694
+ if (sources_2_1 && !sources_2_1.done && (_a = sources_2.return)) _a.call(sources_2);
695
+ }
696
+ finally { if (e_12) throw e_12.error; }
697
+ }
698
+ return result;
699
+ }
700
+ function hotfixDurabilityContractGate(contractValue, now) {
701
+ var contract = (0, ai_runner_manager_policy_1.buildResolveIOAIManagerHotfixDurabilityContract)({
702
+ existing: contractValue,
703
+ evidence: contractValue.evidence || contractValue.hotfixEvidence || contractValue.hotfix_evidence,
704
+ action: contractValue.action,
705
+ reason: contractValue.reason,
706
+ now: now
707
+ });
708
+ if (!contract.required) {
709
+ return undefined;
710
+ }
711
+ var status = contract.liveHotfixBlockedUntilCommit
712
+ ? 'blocked'
713
+ : contract.status === 'ready_for_continuation' || contract.status === 'ready_for_release_gate'
714
+ ? 'pass'
715
+ : 'warn';
716
+ return {
717
+ key: 'hotfix_durability_contract',
718
+ label: 'Hotfix durability contract',
719
+ status: status,
720
+ reason: contract.liveHotfixBlockedUntilCommit
721
+ ? "Manager hotfix is blocked until GitHub commit proof is recorded: ".concat(contract.missingCommitProofFields.join(', ') || 'sourceCommitSha, githubCommitUrl, gitCommitStatus=passed, gitPushStatus=passed')
722
+ : "Manager hotfix durability contract is ".concat(contract.status, "."),
723
+ evidenceRefs: cleanStringList([contract.githubCommitUrl], 1, 500),
724
+ recordedAt: isoNow(now || contract.updatedAt),
725
+ metadata: {
726
+ contractId: contract.contractId,
727
+ status: contract.status,
728
+ nextSafeAction: contract.nextSafeAction,
729
+ canPrepareHotfixPatch: contract.canPrepareHotfixPatch,
730
+ canHotfixBackend: contract.canHotfixBackend,
731
+ liveHotfixBlockedUntilCommit: contract.liveHotfixBlockedUntilCommit,
732
+ commitProofPassed: contract.commitProofPassed,
733
+ commitProofStatus: contract.commitProofStatus,
734
+ missingCommitProofFields: contract.missingCommitProofFields,
735
+ sourceCommitSha: contract.sourceCommitSha,
736
+ githubCommitUrl: contract.githubCommitUrl,
737
+ gitCommitStatus: contract.gitCommitStatus,
738
+ gitPushStatus: contract.gitPushStatus,
739
+ phaseOrder: contract.phaseOrder,
740
+ requiredFields: contract.requiredFields,
741
+ forbiddenActions: contract.forbiddenActions
742
+ }
743
+ };
744
+ }
745
+ function collectHotfixEvidenceEvents(sources, events, gates, now) {
746
+ var e_15, _a, e_16, _b;
747
+ var _c, _d;
618
748
  try {
619
- for (var _d = __values(hotfixEvidenceCandidates.apply(void 0, __spreadArray([], __read(sources), false))), _e = _d.next(); !_e.done; _e = _d.next()) {
620
- var evidence = _e.value;
749
+ for (var _e = __values(hotfixDurabilityContractCandidates.apply(void 0, __spreadArray([], __read(sources), false))), _f = _e.next(); !_f.done; _f = _e.next()) {
750
+ var contract = _f.value;
751
+ var gate = hotfixDurabilityContractGate(contract, now);
752
+ if (gate) {
753
+ gates.push(gate);
754
+ pushEvent(events, {
755
+ type: 'log',
756
+ category: 'hotfix_durability_contract',
757
+ message: gate.reason,
758
+ artifactPaths: gate.evidenceRefs,
759
+ recordedAt: gate.recordedAt,
760
+ metadata: gate.metadata
761
+ });
762
+ }
763
+ }
764
+ }
765
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
766
+ finally {
767
+ try {
768
+ if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
769
+ }
770
+ finally { if (e_15) throw e_15.error; }
771
+ }
772
+ try {
773
+ for (var _g = __values(hotfixEvidenceCandidates.apply(void 0, __spreadArray([], __read(sources), false))), _h = _g.next(); !_h.done; _h = _g.next()) {
774
+ var evidence = _h.value;
621
775
  var validation = (0, ai_runner_manager_policy_1.validateResolveIOAIManagerHotfixEvidence)(evidence);
622
776
  if (!validation.normalized && validation.status === 'missing') {
623
777
  continue;
@@ -630,7 +784,7 @@ function collectHotfixEvidenceEvents(sources, events, gates, now) {
630
784
  ? "Hotfix evidence recorded for ".concat(validation.channel, ".")
631
785
  : "Incomplete hotfix evidence for ".concat(validation.channel || 'unknown channel', "."),
632
786
  artifactPaths: artifactPaths,
633
- recordedAt: ((_b = validation.normalized) === null || _b === void 0 ? void 0 : _b.recordedAt) || eventDate(evidence),
787
+ recordedAt: ((_c = validation.normalized) === null || _c === void 0 ? void 0 : _c.recordedAt) || eventDate(evidence),
634
788
  metadata: {
635
789
  status: validation.status,
636
790
  nextAction: validation.nextAction,
@@ -639,7 +793,7 @@ function collectHotfixEvidenceEvents(sources, events, gates, now) {
639
793
  hotfixSatisfied: validation.hotfixSatisfied,
640
794
  blockers: validation.blockers,
641
795
  githubCommitGuard: validation.githubCommitGuard,
642
- target: (_c = validation.normalized) === null || _c === void 0 ? void 0 : _c.target
796
+ target: (_d = validation.normalized) === null || _d === void 0 ? void 0 : _d.target
643
797
  }
644
798
  });
645
799
  var gate = hotfixEvidenceGate(evidence, now);
@@ -660,46 +814,53 @@ function collectHotfixEvidenceEvents(sources, events, gates, now) {
660
814
  }
661
815
  }
662
816
  }
663
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
817
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
664
818
  finally {
665
819
  try {
666
- if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
820
+ if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
667
821
  }
668
- finally { if (e_12) throw e_12.error; }
822
+ finally { if (e_16) throw e_16.error; }
669
823
  }
670
824
  }
671
825
  function hotfixDurabilityMetadata(gates) {
672
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
826
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4;
673
827
  var hotfixGate = gates.find(function (gate) { return gate.key === 'hotfix_evidence'; });
674
828
  var commitGate = gates.find(function (gate) { return gate.key === 'hotfix_commit_proof'; });
675
- if (!hotfixGate && !commitGate) {
829
+ var durabilityGate = gates.find(function (gate) { return gate.key === 'hotfix_durability_contract'; });
830
+ if (!hotfixGate && !commitGate && !durabilityGate) {
676
831
  return undefined;
677
832
  }
678
- var commitBlocked = !!commitGate && (commitGate.status === 'blocked' || commitGate.status === 'fail');
833
+ var commitBlocked = (!!commitGate && (commitGate.status === 'blocked' || commitGate.status === 'fail'))
834
+ || ((_a = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _a === void 0 ? void 0 : _a.liveHotfixBlockedUntilCommit) === true;
679
835
  return {
836
+ durabilityStatus: cleanText((_b = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _b === void 0 ? void 0 : _b.status, 80),
837
+ durabilityGateStatus: cleanText(durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.status, 80),
838
+ canPrepareHotfixPatch: ((_c = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _c === void 0 ? void 0 : _c.canPrepareHotfixPatch) === true,
839
+ canHotfixBackend: ((_d = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _d === void 0 ? void 0 : _d.canHotfixBackend) === true,
840
+ liveHotfixBlockedUntilCommit: ((_e = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _e === void 0 ? void 0 : _e.liveHotfixBlockedUntilCommit) === true,
680
841
  hotfixEvidenceStatus: cleanText(hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.status, 80),
681
- hotfixSatisfied: ((_a = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _a === void 0 ? void 0 : _a.hotfixSatisfied) === true,
682
- fullDeployBlocked: ((_b = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _b === void 0 ? void 0 : _b.fullDeployBlocked) === true,
683
- fullDeployAllowed: ((_c = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _c === void 0 ? void 0 : _c.fullDeployAllowed) === true,
684
- commitProofRequired: !!commitGate,
685
- commitProofStatus: cleanText(commitGate === null || commitGate === void 0 ? void 0 : commitGate.status, 80),
686
- commitProofPassed: ((_d = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _d === void 0 ? void 0 : _d.passed) === true,
842
+ hotfixSatisfied: ((_f = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _f === void 0 ? void 0 : _f.hotfixSatisfied) === true,
843
+ fullDeployBlocked: ((_g = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _g === void 0 ? void 0 : _g.fullDeployBlocked) === true,
844
+ fullDeployAllowed: ((_h = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _h === void 0 ? void 0 : _h.fullDeployAllowed) === true,
845
+ commitProofRequired: !!commitGate || !!durabilityGate,
846
+ commitProofStatus: cleanText((commitGate === null || commitGate === void 0 ? void 0 : commitGate.status) || ((_j = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _j === void 0 ? void 0 : _j.commitProofStatus), 80),
847
+ commitProofPassed: ((_k = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _k === void 0 ? void 0 : _k.passed) === true || ((_l = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _l === void 0 ? void 0 : _l.commitProofPassed) === true,
687
848
  commitBlocked: commitBlocked,
688
- channel: cleanText(((_e = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _e === void 0 ? void 0 : _e.channel) || ((_f = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _f === void 0 ? void 0 : _f.channel), 120),
689
- sourceCommitSha: cleanText((_g = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _g === void 0 ? void 0 : _g.sourceCommitSha, 200),
690
- githubCommitUrl: cleanText((_h = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _h === void 0 ? void 0 : _h.githubCommitUrl, 500),
691
- gitCommitStatus: cleanText((_j = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _j === void 0 ? void 0 : _j.gitCommitStatus, 120),
692
- gitPushStatus: cleanText((_k = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _k === void 0 ? void 0 : _k.gitPushStatus, 120),
693
- blockers: cleanStringList(__spreadArray(__spreadArray([], __read(asArray((_l = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _l === void 0 ? void 0 : _l.blockers)), false), __read(asArray((_m = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _m === void 0 ? void 0 : _m.blockers)), false), 20, 500),
694
- requiredEvidence: cleanStringList((_o = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _o === void 0 ? void 0 : _o.requiredEvidence, 20, 500),
695
- nextCommands: cleanStringList((_p = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _p === void 0 ? void 0 : _p.nextCommands, 20, 240),
849
+ channel: cleanText(((_m = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _m === void 0 ? void 0 : _m.channel) || ((_o = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _o === void 0 ? void 0 : _o.channel), 120),
850
+ sourceCommitSha: cleanText(((_p = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _p === void 0 ? void 0 : _p.sourceCommitSha) || ((_q = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _q === void 0 ? void 0 : _q.sourceCommitSha), 200),
851
+ githubCommitUrl: cleanText(((_r = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _r === void 0 ? void 0 : _r.githubCommitUrl) || ((_s = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _s === void 0 ? void 0 : _s.githubCommitUrl), 500),
852
+ gitCommitStatus: cleanText(((_t = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _t === void 0 ? void 0 : _t.gitCommitStatus) || ((_u = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _u === void 0 ? void 0 : _u.gitCommitStatus), 120),
853
+ gitPushStatus: cleanText(((_v = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _v === void 0 ? void 0 : _v.gitPushStatus) || ((_w = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _w === void 0 ? void 0 : _w.gitPushStatus), 120),
854
+ blockers: cleanStringList(__spreadArray(__spreadArray(__spreadArray([], __read(asArray((_x = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _x === void 0 ? void 0 : _x.missingCommitProofFields)), false), __read(asArray((_y = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _y === void 0 ? void 0 : _y.blockers)), false), __read(asArray((_z = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _z === void 0 ? void 0 : _z.blockers)), false), 20, 500),
855
+ requiredEvidence: cleanStringList(((_0 = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _0 === void 0 ? void 0 : _0.requiredEvidence) || ((_1 = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _1 === void 0 ? void 0 : _1.requiredFields), 20, 500),
856
+ nextCommands: cleanStringList((_2 = commitGate === null || commitGate === void 0 ? void 0 : commitGate.metadata) === null || _2 === void 0 ? void 0 : _2.nextCommands, 20, 240),
696
857
  nextAction: commitBlocked
697
- ? 'Commit and push the hotfix to GitHub, record sourceCommitSha/githubCommitUrl/gitCommitStatus/gitPushStatus, then rerun the smallest verification gate.'
698
- : cleanText((_q = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _q === void 0 ? void 0 : _q.nextAction, 1000)
858
+ ? cleanText((_3 = durabilityGate === null || durabilityGate === void 0 ? void 0 : durabilityGate.metadata) === null || _3 === void 0 ? void 0 : _3.nextSafeAction, 200) || 'Commit and push the hotfix to GitHub, record sourceCommitSha/githubCommitUrl/gitCommitStatus/gitPushStatus, then rerun the smallest verification gate.'
859
+ : cleanText((_4 = hotfixGate === null || hotfixGate === void 0 ? void 0 : hotfixGate.metadata) === null || _4 === void 0 ? void 0 : _4.nextAction, 1000)
699
860
  };
700
861
  }
701
862
  function collectUsageEvents(entries, events) {
702
- var e_13, _a;
863
+ var e_17, _a;
703
864
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
704
865
  if (!entries.length) {
705
866
  return undefined;
@@ -730,17 +891,17 @@ function collectUsageEvents(entries, events) {
730
891
  });
731
892
  }
732
893
  }
733
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
894
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
734
895
  finally {
735
896
  try {
736
897
  if (normalizedEntries_1_1 && !normalizedEntries_1_1.done && (_a = normalizedEntries_1.return)) _a.call(normalizedEntries_1);
737
898
  }
738
- finally { if (e_13) throw e_13.error; }
899
+ finally { if (e_17) throw e_17.error; }
739
900
  }
740
901
  return (0, ai_run_evidence_1.buildAIRunCost)(entries);
741
902
  }
742
903
  function collectCommitEvents(commits, events) {
743
- var e_14, _a;
904
+ var e_18, _a;
744
905
  try {
745
906
  for (var _b = __values(commits.slice(0, 80)), _c = _b.next(); !_c.done; _c = _b.next()) {
746
907
  var commit = _c.value;
@@ -756,12 +917,12 @@ function collectCommitEvents(commits, events) {
756
917
  });
757
918
  }
758
919
  }
759
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
920
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
760
921
  finally {
761
922
  try {
762
923
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
763
924
  }
764
- finally { if (e_14) throw e_14.error; }
925
+ finally { if (e_18) throw e_18.error; }
765
926
  }
766
927
  }
767
928
  function statusFromBoolean(value, fallback) {
@@ -774,7 +935,7 @@ function statusFromBoolean(value, fallback) {
774
935
  return fallback;
775
936
  }
776
937
  function collectArtifacts(evidence) {
777
- var e_15, _a, e_16, _b, e_17, _c;
938
+ var e_19, _a, e_20, _b, e_21, _c;
778
939
  var artifacts = [];
779
940
  try {
780
941
  for (var _d = __values(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.artifacts)), _e = _d.next(); !_e.done; _e = _d.next()) {
@@ -789,12 +950,12 @@ function collectArtifacts(evidence) {
789
950
  });
790
951
  }
791
952
  }
792
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
953
+ catch (e_19_1) { e_19 = { error: e_19_1 }; }
793
954
  finally {
794
955
  try {
795
956
  if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
796
957
  }
797
- finally { if (e_15) throw e_15.error; }
958
+ finally { if (e_19) throw e_19.error; }
798
959
  }
799
960
  var screenshots = asArray((evidence === null || evidence === void 0 ? void 0 : evidence.screenshots) || (evidence === null || evidence === void 0 ? void 0 : evidence.qaScreenshots) || (evidence === null || evidence === void 0 ? void 0 : evidence.browserScreenshots));
800
961
  try {
@@ -815,12 +976,12 @@ function collectArtifacts(evidence) {
815
976
  }
816
977
  }
817
978
  }
818
- catch (e_16_1) { e_16 = { error: e_16_1 }; }
979
+ catch (e_20_1) { e_20 = { error: e_20_1 }; }
819
980
  finally {
820
981
  try {
821
982
  if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
822
983
  }
823
- finally { if (e_16) throw e_16.error; }
984
+ finally { if (e_20) throw e_20.error; }
824
985
  }
825
986
  var artifactRefs = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.artifactPaths)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.artifact_paths)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.runnerEvidenceArtifacts)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.runner_evidence_artifacts)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.supportQaArtifacts)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.support_qa_artifacts)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.qa_artifacts)), false);
826
987
  try {
@@ -841,17 +1002,17 @@ function collectArtifacts(evidence) {
841
1002
  }
842
1003
  }
843
1004
  }
844
- catch (e_17_1) { e_17 = { error: e_17_1 }; }
1005
+ catch (e_21_1) { e_21 = { error: e_21_1 }; }
845
1006
  finally {
846
1007
  try {
847
1008
  if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
848
1009
  }
849
- finally { if (e_17) throw e_17.error; }
1010
+ finally { if (e_21) throw e_21.error; }
850
1011
  }
851
1012
  return artifacts;
852
1013
  }
853
1014
  function collectInfraChecks(evidence) {
854
- var e_18, _a;
1015
+ var e_22, _a;
855
1016
  var _b;
856
1017
  var checks = [];
857
1018
  try {
@@ -868,12 +1029,12 @@ function collectInfraChecks(evidence) {
868
1029
  });
869
1030
  }
870
1031
  }
871
- catch (e_18_1) { e_18 = { error: e_18_1 }; }
1032
+ catch (e_22_1) { e_22 = { error: e_22_1 }; }
872
1033
  finally {
873
1034
  try {
874
1035
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
875
1036
  }
876
- finally { if (e_18) throw e_18.error; }
1037
+ finally { if (e_22) throw e_22.error; }
877
1038
  }
878
1039
  if (evidence === null || evidence === void 0 ? void 0 : evidence.preflightStatus) {
879
1040
  checks.push({
@@ -906,7 +1067,7 @@ function collectCompileResult(evidence) {
906
1067
  };
907
1068
  }
908
1069
  function collectRouteProbes(evidence) {
909
- var e_19, _a, e_20, _b;
1070
+ var e_23, _a, e_24, _b;
910
1071
  var probes = [];
911
1072
  var rows = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.routeProbes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.route_probes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.routes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.browserRoutes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.browser_routes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.workflowProbes)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.workflow_probes)), false);
912
1073
  var directProbe = plainObject((evidence === null || evidence === void 0 ? void 0 : evidence.routeProbe) || (evidence === null || evidence === void 0 ? void 0 : evidence.route_probe) || (evidence === null || evidence === void 0 ? void 0 : evidence.workflowProbe) || (evidence === null || evidence === void 0 ? void 0 : evidence.workflow_probe));
@@ -930,12 +1091,12 @@ function collectRouteProbes(evidence) {
930
1091
  });
931
1092
  }
932
1093
  }
933
- catch (e_19_1) { e_19 = { error: e_19_1 }; }
1094
+ catch (e_23_1) { e_23 = { error: e_23_1 }; }
934
1095
  finally {
935
1096
  try {
936
1097
  if (rows_1_1 && !rows_1_1.done && (_a = rows_1.return)) _a.call(rows_1);
937
1098
  }
938
- finally { if (e_19) throw e_19.error; }
1099
+ finally { if (e_23) throw e_23.error; }
939
1100
  }
940
1101
  var screenshots = asArray((evidence === null || evidence === void 0 ? void 0 : evidence.screenshots) || (evidence === null || evidence === void 0 ? void 0 : evidence.qaScreenshots) || (evidence === null || evidence === void 0 ? void 0 : evidence.browserScreenshots));
941
1102
  try {
@@ -957,17 +1118,17 @@ function collectRouteProbes(evidence) {
957
1118
  }
958
1119
  }
959
1120
  }
960
- catch (e_20_1) { e_20 = { error: e_20_1 }; }
1121
+ catch (e_24_1) { e_24 = { error: e_24_1 }; }
961
1122
  finally {
962
1123
  try {
963
1124
  if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
964
1125
  }
965
- finally { if (e_20) throw e_20.error; }
1126
+ finally { if (e_24) throw e_24.error; }
966
1127
  }
967
1128
  return probes;
968
1129
  }
969
1130
  function collectBusinessAssertions(evidence) {
970
- var e_21, _a;
1131
+ var e_25, _a;
971
1132
  var assertions = [];
972
1133
  var rows = __spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.businessAssertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.business_assertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.workflowAssertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.workflow_assertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.assertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.qaRows)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.qa_rows)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.rows)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.supportQaAssertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.support_qa_assertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.aiQaBusinessAssertions)), false), __read(asArray(evidence === null || evidence === void 0 ? void 0 : evidence.ai_qa_business_assertions)), false);
973
1134
  try {
@@ -990,12 +1151,12 @@ function collectBusinessAssertions(evidence) {
990
1151
  });
991
1152
  }
992
1153
  }
993
- catch (e_21_1) { e_21 = { error: e_21_1 }; }
1154
+ catch (e_25_1) { e_25 = { error: e_25_1 }; }
994
1155
  finally {
995
1156
  try {
996
1157
  if (rows_2_1 && !rows_2_1.done && (_a = rows_2.return)) _a.call(rows_2);
997
1158
  }
998
- finally { if (e_21) throw e_21.error; }
1159
+ finally { if (e_25) throw e_25.error; }
999
1160
  }
1000
1161
  if (!assertions.length && (evidence === null || evidence === void 0 ? void 0 : evidence.qaRunOutcome) === 'business_assertion_passed') {
1001
1162
  assertions.push({
@@ -1054,7 +1215,7 @@ function businessAssertionPassed(assertion) {
1054
1215
  return /^(pass|passed|success|ok|done)$/i.test(cleanText(assertion.status, 40));
1055
1216
  }
1056
1217
  function supportAssertionMatchesDiagnosisProof(assertion, proofPlan) {
1057
- var e_22, _a;
1218
+ var e_26, _a;
1058
1219
  var metadata = assertion.metadata || {};
1059
1220
  if (metadata.diagnosisProofPlanMatched === true || metadata.proofPlanMatched === true || metadata.supportDiagnosisProof === true) {
1060
1221
  return true;
@@ -1099,12 +1260,12 @@ function supportAssertionMatchesDiagnosisProof(assertion, proofPlan) {
1099
1260
  }
1100
1261
  }
1101
1262
  }
1102
- catch (e_22_1) { e_22 = { error: e_22_1 }; }
1263
+ catch (e_26_1) { e_26 = { error: e_26_1 }; }
1103
1264
  finally {
1104
1265
  try {
1105
1266
  if (proofTokens_1_1 && !proofTokens_1_1.done && (_a = proofTokens_1.return)) _a.call(proofTokens_1);
1106
1267
  }
1107
- finally { if (e_22) throw e_22.error; }
1268
+ finally { if (e_26) throw e_26.error; }
1108
1269
  }
1109
1270
  return overlap >= Math.min(4, Math.max(3, Math.ceil(proofTokens.size * 0.45)));
1110
1271
  }
@@ -1353,7 +1514,7 @@ function supportDiagnosisBeforeRepairGate(diagnosisGate, repairEvidence, now) {
1353
1514
  };
1354
1515
  }
1355
1516
  function evidenceObject() {
1356
- var e_23, _a;
1517
+ var e_27, _a;
1357
1518
  var values = [];
1358
1519
  for (var _i = 0; _i < arguments.length; _i++) {
1359
1520
  values[_i] = arguments[_i];
@@ -1366,17 +1527,17 @@ function evidenceObject() {
1366
1527
  }
1367
1528
  }
1368
1529
  }
1369
- catch (e_23_1) { e_23 = { error: e_23_1 }; }
1530
+ catch (e_27_1) { e_27 = { error: e_27_1 }; }
1370
1531
  finally {
1371
1532
  try {
1372
1533
  if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
1373
1534
  }
1374
- finally { if (e_23) throw e_23.error; }
1535
+ finally { if (e_27) throw e_27.error; }
1375
1536
  }
1376
1537
  return {};
1377
1538
  }
1378
1539
  function mergeEvidenceRecords() {
1379
- var e_24, _a, e_25, _b;
1540
+ var e_28, _a, e_29, _b;
1380
1541
  var values = [];
1381
1542
  for (var _i = 0; _i < arguments.length; _i++) {
1382
1543
  values[_i] = arguments[_i];
@@ -1387,7 +1548,7 @@ function mergeEvidenceRecords() {
1387
1548
  var value = values_2_1.value;
1388
1549
  var source = plainObject(value);
1389
1550
  try {
1390
- for (var _c = (e_25 = void 0, __values(Object.entries(source))), _d = _c.next(); !_d.done; _d = _c.next()) {
1551
+ for (var _c = (e_29 = void 0, __values(Object.entries(source))), _d = _c.next(); !_d.done; _d = _c.next()) {
1391
1552
  var _e = __read(_d.value, 2), key = _e[0], entry = _e[1];
1392
1553
  if (entry === undefined || entry === null || entry === '') {
1393
1554
  continue;
@@ -1403,21 +1564,21 @@ function mergeEvidenceRecords() {
1403
1564
  merged[key] = entry;
1404
1565
  }
1405
1566
  }
1406
- catch (e_25_1) { e_25 = { error: e_25_1 }; }
1567
+ catch (e_29_1) { e_29 = { error: e_29_1 }; }
1407
1568
  finally {
1408
1569
  try {
1409
1570
  if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
1410
1571
  }
1411
- finally { if (e_25) throw e_25.error; }
1572
+ finally { if (e_29) throw e_29.error; }
1412
1573
  }
1413
1574
  }
1414
1575
  }
1415
- catch (e_24_1) { e_24 = { error: e_24_1 }; }
1576
+ catch (e_28_1) { e_28 = { error: e_28_1 }; }
1416
1577
  finally {
1417
1578
  try {
1418
1579
  if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
1419
1580
  }
1420
- finally { if (e_24) throw e_24.error; }
1581
+ finally { if (e_28) throw e_28.error; }
1421
1582
  }
1422
1583
  return merged;
1423
1584
  }
@@ -1637,6 +1798,8 @@ function supportCustomerReplyPolicyGate(policy, now) {
1637
1798
  var canSend = policy.canSendCustomerReply === true || policy.can_send_customer_reply === true;
1638
1799
  var reviewPacket = plainObject(policy.humanReviewPacket || policy.human_review_packet);
1639
1800
  var draftBasis = plainObject(policy.draftBasis || policy.draft_basis);
1801
+ var clarificationValidation = (0, support_runner_v5_1.validateResolveIOSupportClarificationContract)(policy.clarificationContract || policy.clarification_contract || {});
1802
+ var clarificationContract = clarificationValidation.normalized;
1640
1803
  var reviewType = cleanText(reviewPacket.reviewType || reviewPacket.review_type, 160);
1641
1804
  var evidenceRefs = cleanStringList(reviewPacket.evidenceRefs || reviewPacket.evidence_refs, 40, 500);
1642
1805
  var blockers = cleanStringList(policy.blockers || reviewPacket.blockers, 20, 500);
@@ -1645,13 +1808,14 @@ function supportCustomerReplyPolicyGate(policy, now) {
1645
1808
  : action === 'draft_resolution_reply' && canDraft
1646
1809
  ? 'warn'
1647
1810
  : action === 'ask_clarification' && canDraft
1648
- ? 'warn'
1811
+ ? (clarificationValidation.valid ? 'warn' : 'blocked')
1649
1812
  : 'blocked';
1813
+ var mergedBlockers = Array.from(new Set(__spreadArray(__spreadArray([], __read(blockers), false), __read((action === 'ask_clarification' ? clarificationValidation.blockers : [])), false)));
1650
1814
  return {
1651
1815
  key: 'support_customer_reply_policy',
1652
1816
  label: 'Support customer reply policy',
1653
1817
  status: gateStatus,
1654
- reason: reason || action || 'Support customer reply policy recorded.',
1818
+ reason: reason || mergedBlockers.join('; ') || action || 'Support customer reply policy recorded.',
1655
1819
  evidenceRefs: evidenceRefs,
1656
1820
  recordedAt: isoNow(now || policy.recordedAt || policy.recorded_at || reviewPacket.createdAt || reviewPacket.created_at),
1657
1821
  metadata: {
@@ -1667,7 +1831,11 @@ function supportCustomerReplyPolicyGate(policy, now) {
1667
1831
  primaryAction: cleanText(reviewPacket.primaryAction || reviewPacket.primary_action, 160),
1668
1832
  requiresHumanApproval: reviewPacket.requiresHumanApproval !== false && reviewPacket.requires_human_approval !== false,
1669
1833
  questionPresent: !!cleanText(policy.clarificationQuestion || policy.clarification_question || reviewPacket.question, 1000),
1670
- blockers: blockers
1834
+ clarificationContractStatus: cleanText(clarificationContract.status, 120),
1835
+ clarificationMissingField: cleanText(clarificationContract.missingField, 120),
1836
+ clarificationOneQuestionOnly: clarificationContract.oneQuestionOnly === true,
1837
+ clarificationParksTicket: clarificationContract.parksTicketUntilCustomerReply === true,
1838
+ blockers: mergedBlockers
1671
1839
  }
1672
1840
  };
1673
1841
  }
@@ -1971,7 +2139,7 @@ function supportIssueClassProbePlanGate(plan, diagnosisGate, now, required) {
1971
2139
  };
1972
2140
  }
1973
2141
  function firstNonEmptyText(values, max) {
1974
- var e_26, _a;
2142
+ var e_30, _a;
1975
2143
  if (max === void 0) { max = 1000; }
1976
2144
  try {
1977
2145
  for (var values_3 = __values(values), values_3_1 = values_3.next(); !values_3_1.done; values_3_1 = values_3.next()) {
@@ -1982,12 +2150,12 @@ function firstNonEmptyText(values, max) {
1982
2150
  }
1983
2151
  }
1984
2152
  }
1985
- catch (e_26_1) { e_26 = { error: e_26_1 }; }
2153
+ catch (e_30_1) { e_30 = { error: e_30_1 }; }
1986
2154
  finally {
1987
2155
  try {
1988
2156
  if (values_3_1 && !values_3_1.done && (_a = values_3.return)) _a.call(values_3);
1989
2157
  }
1990
- finally { if (e_26) throw e_26.error; }
2158
+ finally { if (e_30) throw e_30.error; }
1991
2159
  }
1992
2160
  return undefined;
1993
2161
  }
@@ -2480,24 +2648,24 @@ function assistantDateWindowObject(quality) {
2480
2648
  return Object.keys(dateWindow).length ? dateWindow : nestedWindow;
2481
2649
  }
2482
2650
  function collectMongoProjectionObjects(value, result) {
2483
- var e_27, _a;
2651
+ var e_31, _a;
2484
2652
  if (result === void 0) { result = []; }
2485
2653
  if (!value || typeof value !== 'object') {
2486
2654
  return result;
2487
2655
  }
2488
2656
  if (Array.isArray(value)) {
2489
2657
  try {
2490
- for (var value_2 = __values(value), value_2_1 = value_2.next(); !value_2_1.done; value_2_1 = value_2.next()) {
2491
- var entry = value_2_1.value;
2658
+ for (var value_3 = __values(value), value_3_1 = value_3.next(); !value_3_1.done; value_3_1 = value_3.next()) {
2659
+ var entry = value_3_1.value;
2492
2660
  collectMongoProjectionObjects(entry, result);
2493
2661
  }
2494
2662
  }
2495
- catch (e_27_1) { e_27 = { error: e_27_1 }; }
2663
+ catch (e_31_1) { e_31 = { error: e_31_1 }; }
2496
2664
  finally {
2497
2665
  try {
2498
- if (value_2_1 && !value_2_1.done && (_a = value_2.return)) _a.call(value_2);
2666
+ if (value_3_1 && !value_3_1.done && (_a = value_3.return)) _a.call(value_3);
2499
2667
  }
2500
- finally { if (e_27) throw e_27.error; }
2668
+ finally { if (e_31) throw e_31.error; }
2501
2669
  }
2502
2670
  return result;
2503
2671
  }
@@ -2917,8 +3085,8 @@ function applyAssistantAnswerQualityGate(qa, decision, now) {
2917
3085
  ], false) });
2918
3086
  }
2919
3087
  function buildSupportAIRunFromEvidence(input) {
2920
- var e_28, _a, e_29, _b;
2921
- var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36;
3088
+ var e_32, _a, e_33, _b;
3089
+ var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44;
2922
3090
  var ticket = input.ticket || {};
2923
3091
  var job = input.job || {};
2924
3092
  var evidence = buildSupportQaEvidence(input);
@@ -2930,8 +3098,8 @@ function buildSupportAIRunFromEvidence(input) {
2930
3098
  addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
2931
3099
  addSourceId(sourceIds, 'buildPlanId', job.buildPlanId || ticket.buildPlanId);
2932
3100
  try {
2933
- for (var _37 = __values(asArray(input.taskEvents)), _38 = _37.next(); !_38.done; _38 = _37.next()) {
2934
- var event_1 = _38.value;
3101
+ for (var _45 = __values(asArray(input.taskEvents)), _46 = _45.next(); !_46.done; _46 = _45.next()) {
3102
+ var event_1 = _46.value;
2935
3103
  pushEvent(events, {
2936
3104
  type: event_1.type === 'human_intervention' ? 'human_intervention' : 'log',
2937
3105
  category: cleanText(event_1.category || event_1.phase || event_1.type, 160),
@@ -2945,16 +3113,16 @@ function buildSupportAIRunFromEvidence(input) {
2945
3113
  });
2946
3114
  }
2947
3115
  }
2948
- catch (e_28_1) { e_28 = { error: e_28_1 }; }
3116
+ catch (e_32_1) { e_32 = { error: e_32_1 }; }
2949
3117
  finally {
2950
3118
  try {
2951
- if (_38 && !_38.done && (_a = _37.return)) _a.call(_37);
3119
+ if (_46 && !_46.done && (_a = _45.return)) _a.call(_45);
2952
3120
  }
2953
- finally { if (e_28) throw e_28.error; }
3121
+ finally { if (e_32) throw e_32.error; }
2954
3122
  }
2955
3123
  try {
2956
- for (var _39 = __values(asArray(input.aiJobs)), _40 = _39.next(); !_40.done; _40 = _39.next()) {
2957
- var aiJob = _40.value;
3124
+ for (var _47 = __values(asArray(input.aiJobs)), _48 = _47.next(); !_48.done; _48 = _47.next()) {
3125
+ var aiJob = _48.value;
2958
3126
  pushEvent(events, {
2959
3127
  type: aiJob.model ? 'model_call' : 'log',
2960
3128
  category: cleanText(aiJob.category || aiJob.phase || aiJob.runner, 160),
@@ -2969,12 +3137,12 @@ function buildSupportAIRunFromEvidence(input) {
2969
3137
  });
2970
3138
  }
2971
3139
  }
2972
- catch (e_29_1) { e_29 = { error: e_29_1 }; }
3140
+ catch (e_33_1) { e_33 = { error: e_33_1 }; }
2973
3141
  finally {
2974
3142
  try {
2975
- if (_40 && !_40.done && (_b = _39.return)) _b.call(_39);
3143
+ if (_48 && !_48.done && (_b = _47.return)) _b.call(_47);
2976
3144
  }
2977
- finally { if (e_29) throw e_29.error; }
3145
+ finally { if (e_33) throw e_33.error; }
2978
3146
  }
2979
3147
  collectCommitEvents(asArray(input.commits), events);
2980
3148
  collectHotfixEvidenceEvents([job, ticket, evidence, input.qaEvidence], events, gates, input.now);
@@ -3255,13 +3423,19 @@ function buildSupportAIRunFromEvidence(input) {
3255
3423
  || ((_33 = customerReplyPolicy.human_review_packet) === null || _33 === void 0 ? void 0 : _33.reviewType), 160),
3256
3424
  primaryAction: cleanText(((_34 = customerReplyPolicy.humanReviewPacket) === null || _34 === void 0 ? void 0 : _34.primaryAction)
3257
3425
  || ((_35 = customerReplyPolicy.human_review_packet) === null || _35 === void 0 ? void 0 : _35.primary_action)
3258
- || ((_36 = customerReplyPolicy.human_review_packet) === null || _36 === void 0 ? void 0 : _36.primaryAction), 160)
3426
+ || ((_36 = customerReplyPolicy.human_review_packet) === null || _36 === void 0 ? void 0 : _36.primaryAction), 160),
3427
+ clarificationContract: customerReplyPolicy.clarificationContract || customerReplyPolicy.clarification_contract ? {
3428
+ status: cleanText(((_37 = customerReplyPolicy.clarificationContract) === null || _37 === void 0 ? void 0 : _37.status) || ((_38 = customerReplyPolicy.clarification_contract) === null || _38 === void 0 ? void 0 : _38.status), 120),
3429
+ missingField: cleanText(((_39 = customerReplyPolicy.clarificationContract) === null || _39 === void 0 ? void 0 : _39.missingField) || ((_40 = customerReplyPolicy.clarification_contract) === null || _40 === void 0 ? void 0 : _40.missing_field), 120),
3430
+ oneQuestionOnly: ((_41 = customerReplyPolicy.clarificationContract) === null || _41 === void 0 ? void 0 : _41.oneQuestionOnly) === true || ((_42 = customerReplyPolicy.clarification_contract) === null || _42 === void 0 ? void 0 : _42.one_question_only) === true,
3431
+ parksTicketUntilCustomerReply: ((_43 = customerReplyPolicy.clarificationContract) === null || _43 === void 0 ? void 0 : _43.parksTicketUntilCustomerReply) === true || ((_44 = customerReplyPolicy.clarification_contract) === null || _44 === void 0 ? void 0 : _44.parks_ticket_until_customer_reply) === true
3432
+ } : undefined
3259
3433
  } : undefined
3260
3434
  }
3261
3435
  });
3262
3436
  }
3263
3437
  function buildAICoderAIRunFromEvidence(input) {
3264
- var e_30, _a;
3438
+ var e_34, _a;
3265
3439
  var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28;
3266
3440
  var app = input.app || {};
3267
3441
  var job = input.job || {};
@@ -3289,12 +3463,12 @@ function buildAICoderAIRunFromEvidence(input) {
3289
3463
  });
3290
3464
  }
3291
3465
  }
3292
- catch (e_30_1) { e_30 = { error: e_30_1 }; }
3466
+ catch (e_34_1) { e_34 = { error: e_34_1 }; }
3293
3467
  finally {
3294
3468
  try {
3295
3469
  if (_30 && !_30.done && (_a = _29.return)) _a.call(_29);
3296
3470
  }
3297
- finally { if (e_30) throw e_30.error; }
3471
+ finally { if (e_34) throw e_34.error; }
3298
3472
  }
3299
3473
  collectCommitEvents(asArray(input.commits), events);
3300
3474
  collectHotfixEvidenceEvents([job, app, evidence, input.qaEvidence], events, gates, input.now);
@@ -3502,7 +3676,7 @@ function buildAICoderAIRunFromEvidence(input) {
3502
3676
  });
3503
3677
  }
3504
3678
  function buildAssistantAIRunFromEvidence(input) {
3505
- var e_31, _a, e_32, _b, e_33, _c;
3679
+ var e_35, _a, e_36, _b, e_37, _c;
3506
3680
  var _d, _e, _f, _g;
3507
3681
  var conversation = input.conversation || {};
3508
3682
  var events = [];
@@ -3528,12 +3702,12 @@ function buildAssistantAIRunFromEvidence(input) {
3528
3702
  });
3529
3703
  }
3530
3704
  }
3531
- catch (e_31_1) { e_31 = { error: e_31_1 }; }
3705
+ catch (e_35_1) { e_35 = { error: e_35_1 }; }
3532
3706
  finally {
3533
3707
  try {
3534
3708
  if (_j && !_j.done && (_a = _h.return)) _a.call(_h);
3535
3709
  }
3536
- finally { if (e_31) throw e_31.error; }
3710
+ finally { if (e_35) throw e_35.error; }
3537
3711
  }
3538
3712
  try {
3539
3713
  for (var _k = __values(asArray(input.issueReports)), _l = _k.next(); !_l.done; _l = _k.next()) {
@@ -3551,12 +3725,12 @@ function buildAssistantAIRunFromEvidence(input) {
3551
3725
  });
3552
3726
  }
3553
3727
  }
3554
- catch (e_32_1) { e_32 = { error: e_32_1 }; }
3728
+ catch (e_36_1) { e_36 = { error: e_36_1 }; }
3555
3729
  finally {
3556
3730
  try {
3557
3731
  if (_l && !_l.done && (_b = _k.return)) _b.call(_k);
3558
3732
  }
3559
- finally { if (e_32) throw e_32.error; }
3733
+ finally { if (e_36) throw e_36.error; }
3560
3734
  }
3561
3735
  var cost = collectUsageEvents(asArray(input.usageLedger), events);
3562
3736
  var answerQuality = assistantQualityObject(input);
@@ -3588,12 +3762,12 @@ function buildAssistantAIRunFromEvidence(input) {
3588
3762
  });
3589
3763
  }
3590
3764
  }
3591
- catch (e_33_1) { e_33 = { error: e_33_1 }; }
3765
+ catch (e_37_1) { e_37 = { error: e_37_1 }; }
3592
3766
  finally {
3593
3767
  try {
3594
3768
  if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
3595
3769
  }
3596
- finally { if (e_33) throw e_33.error; }
3770
+ finally { if (e_37) throw e_37.error; }
3597
3771
  }
3598
3772
  var answerQualityDecision = evaluateAssistantAnswerQuality({
3599
3773
  answerQuality: answerQuality,