@resolveio/server-lib 22.3.191 → 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;
748
+ try {
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
+ }
618
772
  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;
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
  }
@@ -1978,7 +2139,7 @@ function supportIssueClassProbePlanGate(plan, diagnosisGate, now, required) {
1978
2139
  };
1979
2140
  }
1980
2141
  function firstNonEmptyText(values, max) {
1981
- var e_26, _a;
2142
+ var e_30, _a;
1982
2143
  if (max === void 0) { max = 1000; }
1983
2144
  try {
1984
2145
  for (var values_3 = __values(values), values_3_1 = values_3.next(); !values_3_1.done; values_3_1 = values_3.next()) {
@@ -1989,12 +2150,12 @@ function firstNonEmptyText(values, max) {
1989
2150
  }
1990
2151
  }
1991
2152
  }
1992
- catch (e_26_1) { e_26 = { error: e_26_1 }; }
2153
+ catch (e_30_1) { e_30 = { error: e_30_1 }; }
1993
2154
  finally {
1994
2155
  try {
1995
2156
  if (values_3_1 && !values_3_1.done && (_a = values_3.return)) _a.call(values_3);
1996
2157
  }
1997
- finally { if (e_26) throw e_26.error; }
2158
+ finally { if (e_30) throw e_30.error; }
1998
2159
  }
1999
2160
  return undefined;
2000
2161
  }
@@ -2487,24 +2648,24 @@ function assistantDateWindowObject(quality) {
2487
2648
  return Object.keys(dateWindow).length ? dateWindow : nestedWindow;
2488
2649
  }
2489
2650
  function collectMongoProjectionObjects(value, result) {
2490
- var e_27, _a;
2651
+ var e_31, _a;
2491
2652
  if (result === void 0) { result = []; }
2492
2653
  if (!value || typeof value !== 'object') {
2493
2654
  return result;
2494
2655
  }
2495
2656
  if (Array.isArray(value)) {
2496
2657
  try {
2497
- for (var value_2 = __values(value), value_2_1 = value_2.next(); !value_2_1.done; value_2_1 = value_2.next()) {
2498
- 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;
2499
2660
  collectMongoProjectionObjects(entry, result);
2500
2661
  }
2501
2662
  }
2502
- catch (e_27_1) { e_27 = { error: e_27_1 }; }
2663
+ catch (e_31_1) { e_31 = { error: e_31_1 }; }
2503
2664
  finally {
2504
2665
  try {
2505
- 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);
2506
2667
  }
2507
- finally { if (e_27) throw e_27.error; }
2668
+ finally { if (e_31) throw e_31.error; }
2508
2669
  }
2509
2670
  return result;
2510
2671
  }
@@ -2924,7 +3085,7 @@ function applyAssistantAnswerQualityGate(qa, decision, now) {
2924
3085
  ], false) });
2925
3086
  }
2926
3087
  function buildSupportAIRunFromEvidence(input) {
2927
- var e_28, _a, e_29, _b;
3088
+ var e_32, _a, e_33, _b;
2928
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;
2929
3090
  var ticket = input.ticket || {};
2930
3091
  var job = input.job || {};
@@ -2952,12 +3113,12 @@ function buildSupportAIRunFromEvidence(input) {
2952
3113
  });
2953
3114
  }
2954
3115
  }
2955
- catch (e_28_1) { e_28 = { error: e_28_1 }; }
3116
+ catch (e_32_1) { e_32 = { error: e_32_1 }; }
2956
3117
  finally {
2957
3118
  try {
2958
3119
  if (_46 && !_46.done && (_a = _45.return)) _a.call(_45);
2959
3120
  }
2960
- finally { if (e_28) throw e_28.error; }
3121
+ finally { if (e_32) throw e_32.error; }
2961
3122
  }
2962
3123
  try {
2963
3124
  for (var _47 = __values(asArray(input.aiJobs)), _48 = _47.next(); !_48.done; _48 = _47.next()) {
@@ -2976,12 +3137,12 @@ function buildSupportAIRunFromEvidence(input) {
2976
3137
  });
2977
3138
  }
2978
3139
  }
2979
- catch (e_29_1) { e_29 = { error: e_29_1 }; }
3140
+ catch (e_33_1) { e_33 = { error: e_33_1 }; }
2980
3141
  finally {
2981
3142
  try {
2982
3143
  if (_48 && !_48.done && (_b = _47.return)) _b.call(_47);
2983
3144
  }
2984
- finally { if (e_29) throw e_29.error; }
3145
+ finally { if (e_33) throw e_33.error; }
2985
3146
  }
2986
3147
  collectCommitEvents(asArray(input.commits), events);
2987
3148
  collectHotfixEvidenceEvents([job, ticket, evidence, input.qaEvidence], events, gates, input.now);
@@ -3274,7 +3435,7 @@ function buildSupportAIRunFromEvidence(input) {
3274
3435
  });
3275
3436
  }
3276
3437
  function buildAICoderAIRunFromEvidence(input) {
3277
- var e_30, _a;
3438
+ var e_34, _a;
3278
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;
3279
3440
  var app = input.app || {};
3280
3441
  var job = input.job || {};
@@ -3302,12 +3463,12 @@ function buildAICoderAIRunFromEvidence(input) {
3302
3463
  });
3303
3464
  }
3304
3465
  }
3305
- catch (e_30_1) { e_30 = { error: e_30_1 }; }
3466
+ catch (e_34_1) { e_34 = { error: e_34_1 }; }
3306
3467
  finally {
3307
3468
  try {
3308
3469
  if (_30 && !_30.done && (_a = _29.return)) _a.call(_29);
3309
3470
  }
3310
- finally { if (e_30) throw e_30.error; }
3471
+ finally { if (e_34) throw e_34.error; }
3311
3472
  }
3312
3473
  collectCommitEvents(asArray(input.commits), events);
3313
3474
  collectHotfixEvidenceEvents([job, app, evidence, input.qaEvidence], events, gates, input.now);
@@ -3515,7 +3676,7 @@ function buildAICoderAIRunFromEvidence(input) {
3515
3676
  });
3516
3677
  }
3517
3678
  function buildAssistantAIRunFromEvidence(input) {
3518
- var e_31, _a, e_32, _b, e_33, _c;
3679
+ var e_35, _a, e_36, _b, e_37, _c;
3519
3680
  var _d, _e, _f, _g;
3520
3681
  var conversation = input.conversation || {};
3521
3682
  var events = [];
@@ -3541,12 +3702,12 @@ function buildAssistantAIRunFromEvidence(input) {
3541
3702
  });
3542
3703
  }
3543
3704
  }
3544
- catch (e_31_1) { e_31 = { error: e_31_1 }; }
3705
+ catch (e_35_1) { e_35 = { error: e_35_1 }; }
3545
3706
  finally {
3546
3707
  try {
3547
3708
  if (_j && !_j.done && (_a = _h.return)) _a.call(_h);
3548
3709
  }
3549
- finally { if (e_31) throw e_31.error; }
3710
+ finally { if (e_35) throw e_35.error; }
3550
3711
  }
3551
3712
  try {
3552
3713
  for (var _k = __values(asArray(input.issueReports)), _l = _k.next(); !_l.done; _l = _k.next()) {
@@ -3564,12 +3725,12 @@ function buildAssistantAIRunFromEvidence(input) {
3564
3725
  });
3565
3726
  }
3566
3727
  }
3567
- catch (e_32_1) { e_32 = { error: e_32_1 }; }
3728
+ catch (e_36_1) { e_36 = { error: e_36_1 }; }
3568
3729
  finally {
3569
3730
  try {
3570
3731
  if (_l && !_l.done && (_b = _k.return)) _b.call(_k);
3571
3732
  }
3572
- finally { if (e_32) throw e_32.error; }
3733
+ finally { if (e_36) throw e_36.error; }
3573
3734
  }
3574
3735
  var cost = collectUsageEvents(asArray(input.usageLedger), events);
3575
3736
  var answerQuality = assistantQualityObject(input);
@@ -3601,12 +3762,12 @@ function buildAssistantAIRunFromEvidence(input) {
3601
3762
  });
3602
3763
  }
3603
3764
  }
3604
- catch (e_33_1) { e_33 = { error: e_33_1 }; }
3765
+ catch (e_37_1) { e_37 = { error: e_37_1 }; }
3605
3766
  finally {
3606
3767
  try {
3607
3768
  if (_o && !_o.done && (_c = _m.return)) _c.call(_m);
3608
3769
  }
3609
- finally { if (e_33) throw e_33.error; }
3770
+ finally { if (e_37) throw e_37.error; }
3610
3771
  }
3611
3772
  var answerQualityDecision = evaluateAssistantAnswerQuality({
3612
3773
  answerQuality: answerQuality,