@resolveio/server-lib 22.3.184 → 22.3.186

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "22.3.184",
3
+ "version": "22.3.186",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -1425,6 +1425,7 @@ function buildSupportQaEvidence(input) {
1425
1425
  var ticket = input.ticket || {};
1426
1426
  var qaCursor = plainObject(job.supportQaValidationCursor || job.support_qa_validation_cursor);
1427
1427
  var autonomousDecision = plainObject(job.supportV5AutonomousDecision || job.support_v5_autonomous_decision);
1428
+ var preflightGate = supportPreflightGateObject(ticket, job, __assign(__assign({}, plainObject(input.qaEvidence)), { supportV5AutonomousDecision: autonomousDecision }));
1428
1429
  var businessProofReadiness = plainObject(autonomousDecision.businessProofReadiness
1429
1430
  || autonomousDecision.business_proof_readiness
1430
1431
  || job.businessProofReadiness
@@ -1453,8 +1454,141 @@ function buildSupportQaEvidence(input) {
1453
1454
  else if (Object.keys(humanReviewPacket).length) {
1454
1455
  evidence.customerReplyPolicy = { humanReviewPacket: humanReviewPacket };
1455
1456
  }
1457
+ if (Object.keys(preflightGate).length) {
1458
+ evidence.supportV5PreflightGate = preflightGate;
1459
+ applySupportPreflightGateToQaEvidence(evidence, preflightGate);
1460
+ }
1456
1461
  return evidence;
1457
1462
  }
1463
+ function supportPreflightGateObject(ticket, job, evidence) {
1464
+ var _a, _b;
1465
+ var autonomousDecision = plainObject(job.supportV5AutonomousDecision
1466
+ || job.support_v5_autonomous_decision
1467
+ || evidence.supportV5AutonomousDecision
1468
+ || evidence.support_v5_autonomous_decision
1469
+ || ticket.supportV5AutonomousDecision
1470
+ || ticket.support_v5_autonomous_decision);
1471
+ var ticketAutomation = plainObject(ticket.automation);
1472
+ var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
1473
+ return evidenceObject(job.supportV5PreflightGate, job.support_v5_preflight_gate, job.preflightGate, job.preflight_gate, evidence.supportV5PreflightGate, evidence.support_v5_preflight_gate, evidence.preflightGate, evidence.preflight_gate, autonomousDecision.preflightGate, autonomousDecision.preflight_gate, (_a = autonomousDecision.rootCauseReadiness) === null || _a === void 0 ? void 0 : _a.preflightGate, (_b = autonomousDecision.root_cause_readiness) === null || _b === void 0 ? void 0 : _b.preflight_gate, ticket.supportV5PreflightGate, ticket.support_v5_preflight_gate, ticketManager.supportV5PreflightGate, ticketManager.support_v5_preflight_gate, ticketManager.preflightGate, ticketManager.preflight_gate);
1474
+ }
1475
+ function supportPreflightStatus(value) {
1476
+ return cleanText(value, 120).toLowerCase();
1477
+ }
1478
+ function supportPreflightFailedChecks(preflightGate) {
1479
+ var failed = __spreadArray(__spreadArray([], __read(asArray(preflightGate.failedChecks || preflightGate.failed_checks)), false), __read(asArray(preflightGate.checks).filter(function (check) {
1480
+ var status = supportPreflightStatus(check.status || check.state || check.outcome);
1481
+ return /fail|failed|blocked|missing|error/.test(status);
1482
+ })), false);
1483
+ var seen = new Set();
1484
+ return failed.filter(function (check) {
1485
+ var key = "".concat(cleanText(check.name || check.check || check.key, 160), ":").concat(cleanText(check.summary || check.message || check.error || check.reason, 500));
1486
+ if (seen.has(key)) {
1487
+ return false;
1488
+ }
1489
+ seen.add(key);
1490
+ return true;
1491
+ });
1492
+ }
1493
+ function supportPreflightArtifactPaths(preflightGate, checks) {
1494
+ return Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(cleanStringList(preflightGate.artifactPaths || preflightGate.artifact_paths, 60, 500)), false), __read(checks.flatMap(function (check) { return cleanStringList(check.artifactPaths || check.artifact_paths || check.artifacts, 20, 500); })), false), __read(checks.map(function (check) { return cleanText(check.artifactPath || check.artifact_path || check.path || check.file, 500); }).filter(Boolean)), false))).slice(0, 80);
1495
+ }
1496
+ function supportPreflightCheckMessage(check) {
1497
+ return cleanText(check.summary || check.message || check.error || check.reason || check.status, 1000);
1498
+ }
1499
+ function applySupportPreflightGateToQaEvidence(evidence, preflightGate) {
1500
+ var _a;
1501
+ var status = supportPreflightStatus(preflightGate.status);
1502
+ var failureClass = supportPreflightStatus(preflightGate.failureClass || preflightGate.failure_class);
1503
+ var failedChecks = supportPreflightFailedChecks(preflightGate);
1504
+ var artifactPaths = supportPreflightArtifactPaths(preflightGate, failedChecks);
1505
+ var compileResult = plainObject(preflightGate.compileResult || preflightGate.compile_result);
1506
+ var compileFailed = status === 'compile_failed'
1507
+ || failureClass === 'compile'
1508
+ || cleanText(compileResult.failureClass || compileResult.failure_class, 120).toLowerCase() === 'compile'
1509
+ || failedChecks.some(function (check) {
1510
+ var name = supportPreflightStatus(check.name || check.check || check.key);
1511
+ var checkClass = supportPreflightStatus(check.failureClass || check.failure_class);
1512
+ return name === 'compile' || checkClass === 'compile';
1513
+ });
1514
+ if (compileFailed) {
1515
+ var compileCheck = Object.keys(compileResult).length ? compileResult : failedChecks[0] || {};
1516
+ evidence.compile = __assign(__assign({}, plainObject(evidence.compile || evidence.build || evidence.buildResult || evidence.build_result)), { status: cleanText(compileCheck.status || preflightGate.status || 'fail', 80) || 'fail', command: cleanText(compileCheck.command || preflightGate.command || preflightGate.nextCommand || preflightGate.next_command, 500), artifactPath: artifactPaths[0] || cleanText(compileCheck.artifactPath || compileCheck.artifact_path || compileCheck.path, 500), message: supportPreflightCheckMessage(compileCheck) || cleanText(preflightGate.reason || ((_a = preflightGate.blockers) === null || _a === void 0 ? void 0 : _a[0]) || 'Support compile preflight failed before browser QA.', 1000), metadata: {
1517
+ source: 'supportV5PreflightGate',
1518
+ preflightStatus: status,
1519
+ preflightEvidenceHash: cleanText(preflightGate.evidenceHash || preflightGate.evidence_hash, 200),
1520
+ nextCommand: cleanText(preflightGate.nextCommand || preflightGate.next_command, 180)
1521
+ } });
1522
+ return;
1523
+ }
1524
+ var blocksRepair = preflightGate.blocksProductRepair === true || preflightGate.blocks_product_repair === true || /infra_failed|blocked|missing/.test(status);
1525
+ var checks = failedChecks.length
1526
+ ? failedChecks
1527
+ : Object.keys(preflightGate).length && (blocksRepair || status === 'passed')
1528
+ ? [{
1529
+ name: 'support_preflight',
1530
+ status: status === 'passed' ? 'pass' : 'blocked',
1531
+ summary: cleanStringList(preflightGate.blockers, 4, 500).join('; ') || cleanText(preflightGate.reason || preflightGate.status, 1000),
1532
+ artifactPaths: artifactPaths
1533
+ }]
1534
+ : [];
1535
+ if (!checks.length) {
1536
+ return;
1537
+ }
1538
+ evidence.infraChecks = __spreadArray(__spreadArray([], __read(asArray(evidence.infraChecks)), false), __read(checks.map(function (check) { return ({
1539
+ name: cleanText(check.name || check.check || check.key, 160) || 'support_preflight',
1540
+ status: cleanText(check.status || check.state || check.outcome || (status === 'passed' ? 'pass' : 'blocked'), 80),
1541
+ message: supportPreflightCheckMessage(check) || cleanStringList(preflightGate.blockers, 3, 500).join('; '),
1542
+ path: cleanText(check.path || check.artifactPath || check.artifact_path, 500) || artifactPaths[0],
1543
+ metadata: {
1544
+ source: 'supportV5PreflightGate',
1545
+ preflightStatus: status,
1546
+ preflightFailureClass: failureClass,
1547
+ preflightEvidenceHash: cleanText(preflightGate.evidenceHash || preflightGate.evidence_hash, 200),
1548
+ nextCommand: cleanText(preflightGate.nextCommand || preflightGate.next_command, 180)
1549
+ }
1550
+ }); })), false);
1551
+ }
1552
+ function supportPreflightGateResult(preflightGate, now) {
1553
+ if (!preflightGate || !Object.keys(preflightGate).length) {
1554
+ return undefined;
1555
+ }
1556
+ var statusText = supportPreflightStatus(preflightGate.status);
1557
+ var ready = preflightGate.ready === true;
1558
+ var blocksProductRepair = preflightGate.blocksProductRepair === true || preflightGate.blocks_product_repair === true;
1559
+ var failedChecks = supportPreflightFailedChecks(preflightGate);
1560
+ var artifactPaths = supportPreflightArtifactPaths(preflightGate, failedChecks);
1561
+ var gateStatus = ready || statusText === 'passed'
1562
+ ? 'pass'
1563
+ : /compile_failed|infra_failed|fail|failed/.test(statusText)
1564
+ ? 'fail'
1565
+ : blocksProductRepair || /missing|blocked/.test(statusText)
1566
+ ? 'blocked'
1567
+ : 'warn';
1568
+ var blockers = cleanStringList(preflightGate.blockers, 20, 500);
1569
+ return {
1570
+ key: 'support_preflight_gate',
1571
+ label: 'Support preflight gate',
1572
+ status: gateStatus,
1573
+ reason: gateStatus === 'pass'
1574
+ ? 'Support deterministic preflight passed before product-code repair.'
1575
+ : cleanText(blockers.join('; ') || preflightGate.reason || "Support deterministic preflight is ".concat(statusText || 'not ready', " before product-code repair."), 1200),
1576
+ evidenceRefs: artifactPaths,
1577
+ recordedAt: isoNow(now || preflightGate.recordedAt || preflightGate.recorded_at),
1578
+ metadata: {
1579
+ ready: ready,
1580
+ required: preflightGate.required === true,
1581
+ status: statusText,
1582
+ failureClass: cleanText(preflightGate.failureClass || preflightGate.failure_class, 120),
1583
+ nextCommand: cleanText(preflightGate.nextCommand || preflightGate.next_command, 180),
1584
+ blocksProductRepair: blocksProductRepair,
1585
+ blocksModelRepair: preflightGate.blocksModelRepair === true || preflightGate.blocks_model_repair === true,
1586
+ failedChecks: failedChecks.map(function (check) { return cleanText(check.name || check.check || check.key, 160); }).filter(Boolean),
1587
+ requiredEvidence: cleanStringList(preflightGate.requiredEvidence || preflightGate.required_evidence, 20, 500),
1588
+ evidenceHash: cleanText(preflightGate.evidenceHash || preflightGate.evidence_hash, 200)
1589
+ }
1590
+ };
1591
+ }
1458
1592
  function supportBusinessProofReadinessGate(readiness, now) {
1459
1593
  if (!readiness || !Object.keys(readiness).length) {
1460
1594
  return undefined;
@@ -1582,7 +1716,7 @@ function supportNextActionContractRequired(ticket, job, evidence) {
1582
1716
  || !!ticketManager.last_watchdog_decision;
1583
1717
  }
1584
1718
  function supportNextActionContractMetadata(contract) {
1585
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
1719
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v;
1586
1720
  var decisionBasis = plainObject(contract.decisionBasis || contract.decision_basis);
1587
1721
  var costRisk = plainObject(contract.costRisk || contract.cost_risk);
1588
1722
  var source = {
@@ -1621,8 +1755,12 @@ function supportNextActionContractMetadata(contract) {
1621
1755
  blockerFingerprint: cleanText(decisionBasis.blockerFingerprint || decisionBasis.blocker_fingerprint, 200),
1622
1756
  evidenceHash: cleanText(decisionBasis.evidenceHash || decisionBasis.evidence_hash, 200),
1623
1757
  sameFailureCount: numberValue((_o = decisionBasis.sameFailureCount) !== null && _o !== void 0 ? _o : decisionBasis.same_failure_count),
1624
- hotfixCommitRequired: booleanFlag((_r = (_q = (_p = decisionBasis.hotfixCommitRequired) !== null && _p !== void 0 ? _p : decisionBasis.hotfix_commit_required) !== null && _q !== void 0 ? _q : contract.hotfixCommitRequired) !== null && _r !== void 0 ? _r : contract.hotfix_commit_required),
1625
- liveHotfixBlockedUntilCommit: booleanFlag((_u = (_t = (_s = decisionBasis.liveHotfixBlockedUntilCommit) !== null && _s !== void 0 ? _s : decisionBasis.live_hotfix_blocked_until_commit) !== null && _t !== void 0 ? _t : contract.liveHotfixBlockedUntilCommit) !== null && _u !== void 0 ? _u : contract.live_hotfix_blocked_until_commit)
1758
+ preflightReady: booleanFlag((_p = decisionBasis.preflightReady) !== null && _p !== void 0 ? _p : decisionBasis.preflight_ready),
1759
+ preflightStatus: cleanText(decisionBasis.preflightStatus || decisionBasis.preflight_status, 120),
1760
+ preflightFailureClass: cleanText(decisionBasis.preflightFailureClass || decisionBasis.preflight_failure_class, 120),
1761
+ preflightEvidenceHash: cleanText(decisionBasis.preflightEvidenceHash || decisionBasis.preflight_evidence_hash, 200),
1762
+ hotfixCommitRequired: booleanFlag((_s = (_r = (_q = decisionBasis.hotfixCommitRequired) !== null && _q !== void 0 ? _q : decisionBasis.hotfix_commit_required) !== null && _r !== void 0 ? _r : contract.hotfixCommitRequired) !== null && _s !== void 0 ? _s : contract.hotfix_commit_required),
1763
+ liveHotfixBlockedUntilCommit: booleanFlag((_v = (_u = (_t = decisionBasis.liveHotfixBlockedUntilCommit) !== null && _t !== void 0 ? _t : decisionBasis.live_hotfix_blocked_until_commit) !== null && _u !== void 0 ? _u : contract.liveHotfixBlockedUntilCommit) !== null && _v !== void 0 ? _v : contract.live_hotfix_blocked_until_commit)
1626
1764
  };
1627
1765
  return source;
1628
1766
  }
@@ -2520,7 +2658,7 @@ function applyAssistantAnswerQualityGate(qa, decision, now) {
2520
2658
  }
2521
2659
  function buildSupportAIRunFromEvidence(input) {
2522
2660
  var e_28, _a, e_29, _b;
2523
- 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;
2661
+ 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;
2524
2662
  var ticket = input.ticket || {};
2525
2663
  var job = input.job || {};
2526
2664
  var evidence = buildSupportQaEvidence(input);
@@ -2532,8 +2670,8 @@ function buildSupportAIRunFromEvidence(input) {
2532
2670
  addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
2533
2671
  addSourceId(sourceIds, 'buildPlanId', job.buildPlanId || ticket.buildPlanId);
2534
2672
  try {
2535
- for (var _36 = __values(asArray(input.taskEvents)), _37 = _36.next(); !_37.done; _37 = _36.next()) {
2536
- var event_1 = _37.value;
2673
+ for (var _37 = __values(asArray(input.taskEvents)), _38 = _37.next(); !_38.done; _38 = _37.next()) {
2674
+ var event_1 = _38.value;
2537
2675
  pushEvent(events, {
2538
2676
  type: event_1.type === 'human_intervention' ? 'human_intervention' : 'log',
2539
2677
  category: cleanText(event_1.category || event_1.phase || event_1.type, 160),
@@ -2550,13 +2688,13 @@ function buildSupportAIRunFromEvidence(input) {
2550
2688
  catch (e_28_1) { e_28 = { error: e_28_1 }; }
2551
2689
  finally {
2552
2690
  try {
2553
- if (_37 && !_37.done && (_a = _36.return)) _a.call(_36);
2691
+ if (_38 && !_38.done && (_a = _37.return)) _a.call(_37);
2554
2692
  }
2555
2693
  finally { if (e_28) throw e_28.error; }
2556
2694
  }
2557
2695
  try {
2558
- for (var _38 = __values(asArray(input.aiJobs)), _39 = _38.next(); !_39.done; _39 = _38.next()) {
2559
- var aiJob = _39.value;
2696
+ for (var _39 = __values(asArray(input.aiJobs)), _40 = _39.next(); !_40.done; _40 = _39.next()) {
2697
+ var aiJob = _40.value;
2560
2698
  pushEvent(events, {
2561
2699
  type: aiJob.model ? 'model_call' : 'log',
2562
2700
  category: cleanText(aiJob.category || aiJob.phase || aiJob.runner, 160),
@@ -2574,7 +2712,7 @@ function buildSupportAIRunFromEvidence(input) {
2574
2712
  catch (e_29_1) { e_29 = { error: e_29_1 }; }
2575
2713
  finally {
2576
2714
  try {
2577
- if (_39 && !_39.done && (_b = _38.return)) _b.call(_38);
2715
+ if (_40 && !_40.done && (_b = _39.return)) _b.call(_39);
2578
2716
  }
2579
2717
  finally { if (e_29) throw e_29.error; }
2580
2718
  }
@@ -2648,6 +2786,19 @@ function buildSupportAIRunFromEvidence(input) {
2648
2786
  });
2649
2787
  }
2650
2788
  var cost = collectUsageEvents(asArray(input.usageLedger), events);
2789
+ var preflightGateSource = supportPreflightGateObject(ticket, job, evidence);
2790
+ var preflightGate = supportPreflightGateResult(preflightGateSource, input.now);
2791
+ if (preflightGate) {
2792
+ gates.push(preflightGate);
2793
+ pushEvent(events, {
2794
+ type: ((_c = preflightGate.metadata) === null || _c === void 0 ? void 0 : _c.failureClass) === 'compile' || preflightGateSource.status === 'compile_failed' ? 'qa_compile' : 'qa_infra',
2795
+ category: 'support_preflight_gate',
2796
+ message: preflightGate.reason,
2797
+ artifactPaths: preflightGate.evidenceRefs,
2798
+ recordedAt: preflightGate.recordedAt,
2799
+ metadata: preflightGate.metadata
2800
+ });
2801
+ }
2651
2802
  var diagnosisGate = evidenceObject(job.supportV5DiagnosisGate, job.support_v5_diagnosis_gate, job.diagnosisGate, ticket.supportV5DiagnosisGate, ticket.diagnosisGate, evidence.diagnosisGate, evidence.supportV5DiagnosisGate);
2652
2803
  var diagnosisEvidencePackSource = supportDiagnosisEvidencePackObject(ticket, job, evidence);
2653
2804
  var similarFixHints = supportSimilarFixHintsObject(ticket, job, evidence);
@@ -2720,7 +2871,7 @@ function buildSupportAIRunFromEvidence(input) {
2720
2871
  pushEvent(events, {
2721
2872
  type: 'log',
2722
2873
  category: 'diagnosis_gate',
2723
- message: cleanText(((_c = diagnosisGate.accepted_hypothesis) === null || _c === void 0 ? void 0 : _c.statement) || ((_d = diagnosisGate.acceptedHypothesis) === null || _d === void 0 ? void 0 : _d.statement) || diagnosisGate.summary || 'Support diagnosis gate recorded.', 1800),
2874
+ message: cleanText(((_d = diagnosisGate.accepted_hypothesis) === null || _d === void 0 ? void 0 : _d.statement) || ((_e = diagnosisGate.acceptedHypothesis) === null || _e === void 0 ? void 0 : _e.statement) || diagnosisGate.summary || 'Support diagnosis gate recorded.', 1800),
2724
2875
  metadata: {
2725
2876
  status: diagnosisGate.status,
2726
2877
  issueClass: diagnosisIssueClass,
@@ -2757,59 +2908,59 @@ function buildSupportAIRunFromEvidence(input) {
2757
2908
  managerNoBlindLoopPolicy: managerNoBlindLoopMetadata(noBlindLoopGate),
2758
2909
  diagnosisBeforeRepair: diagnosisBeforeRepairGate ? {
2759
2910
  status: diagnosisBeforeRepairGate.status,
2760
- diagnosisValid: ((_e = diagnosisBeforeRepairGate.metadata) === null || _e === void 0 ? void 0 : _e.diagnosisValid) === true,
2761
- diagnosisStatus: cleanText((_f = diagnosisBeforeRepairGate.metadata) === null || _f === void 0 ? void 0 : _f.diagnosisStatus, 120),
2762
- activityCount: Number(((_g = diagnosisBeforeRepairGate.metadata) === null || _g === void 0 ? void 0 : _g.activityCount) || 0),
2763
- changedFiles: cleanStringList((_h = diagnosisBeforeRepairGate.metadata) === null || _h === void 0 ? void 0 : _h.changedFiles, 40, 500),
2764
- allowedDispatchAction: cleanText((_j = diagnosisBeforeRepairGate.metadata) === null || _j === void 0 ? void 0 : _j.allowedDispatchAction, 160),
2765
- productRepairAllowed: ((_k = diagnosisBeforeRepairGate.metadata) === null || _k === void 0 ? void 0 : _k.productRepairAllowed) === true,
2766
- blockers: cleanStringList((_l = diagnosisBeforeRepairGate.metadata) === null || _l === void 0 ? void 0 : _l.blockers, 20, 500)
2911
+ diagnosisValid: ((_f = diagnosisBeforeRepairGate.metadata) === null || _f === void 0 ? void 0 : _f.diagnosisValid) === true,
2912
+ diagnosisStatus: cleanText((_g = diagnosisBeforeRepairGate.metadata) === null || _g === void 0 ? void 0 : _g.diagnosisStatus, 120),
2913
+ activityCount: Number(((_h = diagnosisBeforeRepairGate.metadata) === null || _h === void 0 ? void 0 : _h.activityCount) || 0),
2914
+ changedFiles: cleanStringList((_j = diagnosisBeforeRepairGate.metadata) === null || _j === void 0 ? void 0 : _j.changedFiles, 40, 500),
2915
+ allowedDispatchAction: cleanText((_k = diagnosisBeforeRepairGate.metadata) === null || _k === void 0 ? void 0 : _k.allowedDispatchAction, 160),
2916
+ productRepairAllowed: ((_l = diagnosisBeforeRepairGate.metadata) === null || _l === void 0 ? void 0 : _l.productRepairAllowed) === true,
2917
+ blockers: cleanStringList((_m = diagnosisBeforeRepairGate.metadata) === null || _m === void 0 ? void 0 : _m.blockers, 20, 500)
2767
2918
  } : undefined,
2768
2919
  rootCauseEntryContract: Object.keys(rootCauseEntryContract).length ? {
2769
2920
  contractId: cleanText(rootCauseEntryContract.contract_id || rootCauseEntryContract.contractId, 160),
2770
2921
  version: cleanText(rootCauseEntryContract.version, 120),
2771
2922
  status: cleanText(rootCauseEntryContract.status, 120),
2772
2923
  issueClassProbeCount: asArray(rootCauseEntryContract.issue_class_probes || rootCauseEntryContract.issueClassProbes).length,
2773
- ownerFileMax: Number(((_m = rootCauseEntryContract.owner_file_policy) === null || _m === void 0 ? void 0 : _m.max_files) || ((_o = rootCauseEntryContract.ownerFilePolicy) === null || _o === void 0 ? void 0 : _o.maxFiles) || 0) || 0,
2774
- requiresBusinessAssertion: ((_p = rootCauseEntryContract.business_proof_policy) === null || _p === void 0 ? void 0 : _p.requires_aiqa_business_assertion) === true
2775
- || ((_q = rootCauseEntryContract.businessProofPolicy) === null || _q === void 0 ? void 0 : _q.requiresAiqaBusinessAssertion) === true
2924
+ ownerFileMax: Number(((_o = rootCauseEntryContract.owner_file_policy) === null || _o === void 0 ? void 0 : _o.max_files) || ((_p = rootCauseEntryContract.ownerFilePolicy) === null || _p === void 0 ? void 0 : _p.maxFiles) || 0) || 0,
2925
+ requiresBusinessAssertion: ((_q = rootCauseEntryContract.business_proof_policy) === null || _q === void 0 ? void 0 : _q.requires_aiqa_business_assertion) === true
2926
+ || ((_r = rootCauseEntryContract.businessProofPolicy) === null || _r === void 0 ? void 0 : _r.requiresAiqaBusinessAssertion) === true
2776
2927
  } : undefined,
2777
2928
  diagnosis: Object.keys(diagnosisGate).length ? {
2778
2929
  status: cleanText(diagnosisGate.status, 80),
2779
2930
  issueClass: diagnosisIssueClass,
2780
2931
  ownerFiles: diagnosisOwnerFiles,
2781
- acceptedHypothesis: cleanText(((_r = diagnosisGate.accepted_hypothesis) === null || _r === void 0 ? void 0 : _r.statement) || ((_s = diagnosisGate.acceptedHypothesis) === null || _s === void 0 ? void 0 : _s.statement), 1000),
2932
+ acceptedHypothesis: cleanText(((_s = diagnosisGate.accepted_hypothesis) === null || _s === void 0 ? void 0 : _s.statement) || ((_t = diagnosisGate.acceptedHypothesis) === null || _t === void 0 ? void 0 : _t.statement), 1000),
2782
2933
  proofPlan: diagnosisGate.proof_plan || diagnosisGate.proofPlan
2783
2934
  } : undefined,
2784
2935
  diagnosisEvidencePack: diagnosisEvidencePackGate ? {
2785
- status: cleanText((_t = diagnosisEvidencePackGate.metadata) === null || _t === void 0 ? void 0 : _t.status, 120),
2936
+ status: cleanText((_u = diagnosisEvidencePackGate.metadata) === null || _u === void 0 ? void 0 : _u.status, 120),
2786
2937
  gateStatus: diagnosisEvidencePackGate.status,
2787
- packId: cleanText((_u = diagnosisEvidencePackGate.metadata) === null || _u === void 0 ? void 0 : _u.packId, 180),
2788
- readOnly: ((_v = diagnosisEvidencePackGate.metadata) === null || _v === void 0 ? void 0 : _v.readOnly) !== false,
2789
- sourceEditsAllowed: ((_w = diagnosisEvidencePackGate.metadata) === null || _w === void 0 ? void 0 : _w.sourceEditsAllowed) === true,
2790
- requiredOutputKey: cleanText((_x = diagnosisEvidencePackGate.metadata) === null || _x === void 0 ? void 0 : _x.requiredOutputKey, 120),
2791
- diagnosisValid: ((_y = diagnosisEvidencePackGate.metadata) === null || _y === void 0 ? void 0 : _y.diagnosisValid) === true,
2792
- issueClassHint: cleanText((_z = diagnosisEvidencePackGate.metadata) === null || _z === void 0 ? void 0 : _z.issueClassHint, 120),
2793
- ownerFileHints: cleanStringList((_0 = diagnosisEvidencePackGate.metadata) === null || _0 === void 0 ? void 0 : _0.ownerFileHints, 20, 500),
2794
- similarHintCount: Number(((_1 = diagnosisEvidencePackGate.metadata) === null || _1 === void 0 ? void 0 : _1.similarHintCount) || 0),
2795
- similarHintsAdvisoryOnly: ((_2 = diagnosisEvidencePackGate.metadata) === null || _2 === void 0 ? void 0 : _2.similarHintsAdvisoryOnly) === true,
2796
- issueClassProbeCount: Number(((_3 = diagnosisEvidencePackGate.metadata) === null || _3 === void 0 ? void 0 : _3.issueClassProbeCount) || 0),
2797
- validationBlockers: cleanStringList((_4 = diagnosisEvidencePackGate.metadata) === null || _4 === void 0 ? void 0 : _4.validationBlockers, 20, 500)
2938
+ packId: cleanText((_v = diagnosisEvidencePackGate.metadata) === null || _v === void 0 ? void 0 : _v.packId, 180),
2939
+ readOnly: ((_w = diagnosisEvidencePackGate.metadata) === null || _w === void 0 ? void 0 : _w.readOnly) !== false,
2940
+ sourceEditsAllowed: ((_x = diagnosisEvidencePackGate.metadata) === null || _x === void 0 ? void 0 : _x.sourceEditsAllowed) === true,
2941
+ requiredOutputKey: cleanText((_y = diagnosisEvidencePackGate.metadata) === null || _y === void 0 ? void 0 : _y.requiredOutputKey, 120),
2942
+ diagnosisValid: ((_z = diagnosisEvidencePackGate.metadata) === null || _z === void 0 ? void 0 : _z.diagnosisValid) === true,
2943
+ issueClassHint: cleanText((_0 = diagnosisEvidencePackGate.metadata) === null || _0 === void 0 ? void 0 : _0.issueClassHint, 120),
2944
+ ownerFileHints: cleanStringList((_1 = diagnosisEvidencePackGate.metadata) === null || _1 === void 0 ? void 0 : _1.ownerFileHints, 20, 500),
2945
+ similarHintCount: Number(((_2 = diagnosisEvidencePackGate.metadata) === null || _2 === void 0 ? void 0 : _2.similarHintCount) || 0),
2946
+ similarHintsAdvisoryOnly: ((_3 = diagnosisEvidencePackGate.metadata) === null || _3 === void 0 ? void 0 : _3.similarHintsAdvisoryOnly) === true,
2947
+ issueClassProbeCount: Number(((_4 = diagnosisEvidencePackGate.metadata) === null || _4 === void 0 ? void 0 : _4.issueClassProbeCount) || 0),
2948
+ validationBlockers: cleanStringList((_5 = diagnosisEvidencePackGate.metadata) === null || _5 === void 0 ? void 0 : _5.validationBlockers, 20, 500)
2798
2949
  } : undefined,
2799
2950
  issueClassProbePlan: issueClassProbePlanGate ? {
2800
- status: cleanText((_5 = issueClassProbePlanGate.metadata) === null || _5 === void 0 ? void 0 : _5.status, 120),
2951
+ status: cleanText((_6 = issueClassProbePlanGate.metadata) === null || _6 === void 0 ? void 0 : _6.status, 120),
2801
2952
  gateStatus: issueClassProbePlanGate.status,
2802
- planId: cleanText((_6 = issueClassProbePlanGate.metadata) === null || _6 === void 0 ? void 0 : _6.planId, 180),
2803
- issueClass: cleanText((_7 = issueClassProbePlanGate.metadata) === null || _7 === void 0 ? void 0 : _7.issueClass, 120),
2804
- diagnosisValid: ((_8 = issueClassProbePlanGate.metadata) === null || _8 === void 0 ? void 0 : _8.diagnosisValid) === true,
2805
- issueClassProbePlanReady: ((_9 = issueClassProbePlanGate.metadata) === null || _9 === void 0 ? void 0 : _9.issueClassProbePlanReady) === true,
2806
- activeRoute: cleanText((_10 = issueClassProbePlanGate.metadata) === null || _10 === void 0 ? void 0 : _10.activeRoute, 500),
2807
- action: cleanText((_11 = issueClassProbePlanGate.metadata) === null || _11 === void 0 ? void 0 : _11.action, 1000),
2808
- expectedBusinessProof: cleanText((_12 = issueClassProbePlanGate.metadata) === null || _12 === void 0 ? void 0 : _12.expectedBusinessProof, 1200),
2809
- acceptanceGate: cleanText((_13 = issueClassProbePlanGate.metadata) === null || _13 === void 0 ? void 0 : _13.acceptanceGate, 120),
2810
- requiredArtifacts: cleanStringList((_14 = issueClassProbePlanGate.metadata) === null || _14 === void 0 ? void 0 : _14.requiredArtifacts, 20, 500),
2811
- falsePassBlockers: cleanStringList((_15 = issueClassProbePlanGate.metadata) === null || _15 === void 0 ? void 0 : _15.falsePassBlockers, 20, 500),
2812
- blockers: cleanStringList((_16 = issueClassProbePlanGate.metadata) === null || _16 === void 0 ? void 0 : _16.blockers, 20, 500)
2953
+ planId: cleanText((_7 = issueClassProbePlanGate.metadata) === null || _7 === void 0 ? void 0 : _7.planId, 180),
2954
+ issueClass: cleanText((_8 = issueClassProbePlanGate.metadata) === null || _8 === void 0 ? void 0 : _8.issueClass, 120),
2955
+ diagnosisValid: ((_9 = issueClassProbePlanGate.metadata) === null || _9 === void 0 ? void 0 : _9.diagnosisValid) === true,
2956
+ issueClassProbePlanReady: ((_10 = issueClassProbePlanGate.metadata) === null || _10 === void 0 ? void 0 : _10.issueClassProbePlanReady) === true,
2957
+ activeRoute: cleanText((_11 = issueClassProbePlanGate.metadata) === null || _11 === void 0 ? void 0 : _11.activeRoute, 500),
2958
+ action: cleanText((_12 = issueClassProbePlanGate.metadata) === null || _12 === void 0 ? void 0 : _12.action, 1000),
2959
+ expectedBusinessProof: cleanText((_13 = issueClassProbePlanGate.metadata) === null || _13 === void 0 ? void 0 : _13.expectedBusinessProof, 1200),
2960
+ acceptanceGate: cleanText((_14 = issueClassProbePlanGate.metadata) === null || _14 === void 0 ? void 0 : _14.acceptanceGate, 120),
2961
+ requiredArtifacts: cleanStringList((_15 = issueClassProbePlanGate.metadata) === null || _15 === void 0 ? void 0 : _15.requiredArtifacts, 20, 500),
2962
+ falsePassBlockers: cleanStringList((_16 = issueClassProbePlanGate.metadata) === null || _16 === void 0 ? void 0 : _16.falsePassBlockers, 20, 500),
2963
+ blockers: cleanStringList((_17 = issueClassProbePlanGate.metadata) === null || _17 === void 0 ? void 0 : _17.blockers, 20, 500)
2813
2964
  } : undefined,
2814
2965
  businessProofReadiness: Object.keys(businessProofReadiness).length ? {
2815
2966
  ready: businessProofReadiness.ready === true,
@@ -2819,19 +2970,19 @@ function buildSupportAIRunFromEvidence(input) {
2819
2970
  } : undefined,
2820
2971
  nextActionContract: nextActionContractGate ? {
2821
2972
  status: nextActionContractGate.status,
2822
- action: cleanText((_17 = nextActionContractGate.metadata) === null || _17 === void 0 ? void 0 : _17.action, 160),
2823
- primaryCommand: cleanText((_18 = nextActionContractGate.metadata) === null || _18 === void 0 ? void 0 : _18.primaryCommand, 240),
2824
- safeToAutoRun: ((_19 = nextActionContractGate.metadata) === null || _19 === void 0 ? void 0 : _19.safeToAutoRun) === true,
2825
- canRunWithoutCodexMonitor: ((_20 = nextActionContractGate.metadata) === null || _20 === void 0 ? void 0 : _20.canRunWithoutCodexMonitor) === true,
2826
- codexFallbackRequired: ((_21 = nextActionContractGate.metadata) === null || _21 === void 0 ? void 0 : _21.codexFallbackRequired) === true,
2827
- requiresHumanApproval: ((_22 = nextActionContractGate.metadata) === null || _22 === void 0 ? void 0 : _22.requiresHumanApproval) === true,
2828
- rootCauseFirstSatisfied: ((_23 = nextActionContractGate.metadata) === null || _23 === void 0 ? void 0 : _23.rootCauseFirstSatisfied) === true,
2829
- hotfixCommitRequired: ((_24 = nextActionContractGate.metadata) === null || _24 === void 0 ? void 0 : _24.hotfixCommitRequired) === true,
2830
- liveHotfixBlockedUntilCommit: ((_25 = nextActionContractGate.metadata) === null || _25 === void 0 ? void 0 : _25.liveHotfixBlockedUntilCommit) === true,
2831
- failureClass: cleanText((_26 = nextActionContractGate.metadata) === null || _26 === void 0 ? void 0 : _26.failureClass, 120),
2832
- evidenceFreshnessStatus: cleanText((_27 = nextActionContractGate.metadata) === null || _27 === void 0 ? void 0 : _27.evidenceFreshnessStatus, 120),
2833
- sameFailureCount: Number(((_28 = nextActionContractGate.metadata) === null || _28 === void 0 ? void 0 : _28.sameFailureCount) || 0),
2834
- blockers: cleanStringList((_29 = nextActionContractGate.metadata) === null || _29 === void 0 ? void 0 : _29.blockers, 20, 500)
2973
+ action: cleanText((_18 = nextActionContractGate.metadata) === null || _18 === void 0 ? void 0 : _18.action, 160),
2974
+ primaryCommand: cleanText((_19 = nextActionContractGate.metadata) === null || _19 === void 0 ? void 0 : _19.primaryCommand, 240),
2975
+ safeToAutoRun: ((_20 = nextActionContractGate.metadata) === null || _20 === void 0 ? void 0 : _20.safeToAutoRun) === true,
2976
+ canRunWithoutCodexMonitor: ((_21 = nextActionContractGate.metadata) === null || _21 === void 0 ? void 0 : _21.canRunWithoutCodexMonitor) === true,
2977
+ codexFallbackRequired: ((_22 = nextActionContractGate.metadata) === null || _22 === void 0 ? void 0 : _22.codexFallbackRequired) === true,
2978
+ requiresHumanApproval: ((_23 = nextActionContractGate.metadata) === null || _23 === void 0 ? void 0 : _23.requiresHumanApproval) === true,
2979
+ rootCauseFirstSatisfied: ((_24 = nextActionContractGate.metadata) === null || _24 === void 0 ? void 0 : _24.rootCauseFirstSatisfied) === true,
2980
+ hotfixCommitRequired: ((_25 = nextActionContractGate.metadata) === null || _25 === void 0 ? void 0 : _25.hotfixCommitRequired) === true,
2981
+ liveHotfixBlockedUntilCommit: ((_26 = nextActionContractGate.metadata) === null || _26 === void 0 ? void 0 : _26.liveHotfixBlockedUntilCommit) === true,
2982
+ failureClass: cleanText((_27 = nextActionContractGate.metadata) === null || _27 === void 0 ? void 0 : _27.failureClass, 120),
2983
+ evidenceFreshnessStatus: cleanText((_28 = nextActionContractGate.metadata) === null || _28 === void 0 ? void 0 : _28.evidenceFreshnessStatus, 120),
2984
+ sameFailureCount: Number(((_29 = nextActionContractGate.metadata) === null || _29 === void 0 ? void 0 : _29.sameFailureCount) || 0),
2985
+ blockers: cleanStringList((_30 = nextActionContractGate.metadata) === null || _30 === void 0 ? void 0 : _30.blockers, 20, 500)
2835
2986
  } : undefined,
2836
2987
  customerReplyPolicy: Object.keys(customerReplyPolicy).length ? {
2837
2988
  action: cleanText(customerReplyPolicy.action, 120),
@@ -2839,12 +2990,12 @@ function buildSupportAIRunFromEvidence(input) {
2839
2990
  canDraftCustomerReply: customerReplyPolicy.canDraftCustomerReply === true || customerReplyPolicy.can_draft_customer_reply === true,
2840
2991
  canSendCustomerReply: customerReplyPolicy.canSendCustomerReply === true || customerReplyPolicy.can_send_customer_reply === true,
2841
2992
  reason: cleanText(customerReplyPolicy.reason, 1000),
2842
- reviewType: cleanText(((_30 = customerReplyPolicy.humanReviewPacket) === null || _30 === void 0 ? void 0 : _30.reviewType)
2843
- || ((_31 = customerReplyPolicy.human_review_packet) === null || _31 === void 0 ? void 0 : _31.review_type)
2844
- || ((_32 = customerReplyPolicy.human_review_packet) === null || _32 === void 0 ? void 0 : _32.reviewType), 160),
2845
- primaryAction: cleanText(((_33 = customerReplyPolicy.humanReviewPacket) === null || _33 === void 0 ? void 0 : _33.primaryAction)
2846
- || ((_34 = customerReplyPolicy.human_review_packet) === null || _34 === void 0 ? void 0 : _34.primary_action)
2847
- || ((_35 = customerReplyPolicy.human_review_packet) === null || _35 === void 0 ? void 0 : _35.primaryAction), 160)
2993
+ reviewType: cleanText(((_31 = customerReplyPolicy.humanReviewPacket) === null || _31 === void 0 ? void 0 : _31.reviewType)
2994
+ || ((_32 = customerReplyPolicy.human_review_packet) === null || _32 === void 0 ? void 0 : _32.review_type)
2995
+ || ((_33 = customerReplyPolicy.human_review_packet) === null || _33 === void 0 ? void 0 : _33.reviewType), 160),
2996
+ primaryAction: cleanText(((_34 = customerReplyPolicy.humanReviewPacket) === null || _34 === void 0 ? void 0 : _34.primaryAction)
2997
+ || ((_35 = customerReplyPolicy.human_review_packet) === null || _35 === void 0 ? void 0 : _35.primary_action)
2998
+ || ((_36 = customerReplyPolicy.human_review_packet) === null || _36 === void 0 ? void 0 : _36.primaryAction), 160)
2848
2999
  } : undefined
2849
3000
  }
2850
3001
  });