@resolveio/server-lib 22.3.177 → 22.3.179

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.177",
3
+ "version": "22.3.179",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -1665,6 +1665,17 @@ function supportDiagnosisEvidencePackObject(ticket, job, evidence) {
1665
1665
  var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
1666
1666
  return evidenceObject(job.supportV5DiagnosisEvidencePack, job.support_v5_diagnosis_evidence_pack, job.diagnosisEvidencePack, job.diagnosis_evidence_pack, evidence.supportV5DiagnosisEvidencePack, evidence.support_v5_diagnosis_evidence_pack, evidence.diagnosisEvidencePack, evidence.diagnosis_evidence_pack, ticket.supportV5DiagnosisEvidencePack, ticket.support_v5_diagnosis_evidence_pack, ticket.diagnosisEvidencePack, ticket.diagnosis_evidence_pack, ticketManager.diagnosisEvidencePack, ticketManager.diagnosis_evidence_pack);
1667
1667
  }
1668
+ function supportIssueClassProbePlanObject(ticket, job, evidence) {
1669
+ var ticketAutomation = plainObject(ticket.automation);
1670
+ var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
1671
+ var autonomousDecision = plainObject(job.supportV5AutonomousDecision
1672
+ || job.support_v5_autonomous_decision
1673
+ || evidence.supportV5AutonomousDecision
1674
+ || evidence.support_v5_autonomous_decision
1675
+ || ticket.supportV5AutonomousDecision
1676
+ || ticket.support_v5_autonomous_decision);
1677
+ return evidenceObject(autonomousDecision.issueClassProbePlan, autonomousDecision.issue_class_probe_plan, job.supportV5IssueClassProbePlan, job.support_v5_issue_class_probe_plan, job.issueClassProbePlan, job.issue_class_probe_plan, evidence.supportV5IssueClassProbePlan, evidence.support_v5_issue_class_probe_plan, evidence.issueClassProbePlan, evidence.issue_class_probe_plan, ticket.supportV5IssueClassProbePlan, ticket.support_v5_issue_class_probe_plan, ticket.issueClassProbePlan, ticket.issue_class_probe_plan, ticketManager.issueClassProbePlan, ticketManager.issue_class_probe_plan);
1678
+ }
1668
1679
  function supportSimilarFixHintsObject(ticket, job, evidence) {
1669
1680
  var ticketAutomation = plainObject(ticket.automation);
1670
1681
  var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
@@ -1713,6 +1724,79 @@ function supportDiagnosisEvidencePackGate(pack, now) {
1713
1724
  }
1714
1725
  };
1715
1726
  }
1727
+ function supportIssueClassProbePlanGate(plan, diagnosisGate, now, required) {
1728
+ if (required === void 0) { required = false; }
1729
+ if (!plan || !Object.keys(plan).length) {
1730
+ if (!required) {
1731
+ return undefined;
1732
+ }
1733
+ var blocker = 'Support V5 run is missing IssueClassProbePlan, so business proof cannot be accepted from route-only or generic QA.';
1734
+ return {
1735
+ key: 'support_issue_class_probe_plan',
1736
+ label: 'Support issue-class probe plan',
1737
+ status: 'blocked',
1738
+ reason: blocker,
1739
+ evidenceRefs: [],
1740
+ recordedAt: isoNow(now),
1741
+ metadata: {
1742
+ required: true,
1743
+ missingPlan: true,
1744
+ issueClassProbePlanReady: false,
1745
+ acceptanceGate: 'aiqa_business_assertion',
1746
+ blockers: [blocker],
1747
+ falsePassBlockers: ['route load only', 'generic clickthrough only', 'scorecard-only pass']
1748
+ }
1749
+ };
1750
+ }
1751
+ var validation = (0, support_runner_v5_1.validateResolveIOSupportIssueClassProbePlan)(plan, diagnosisGate, now);
1752
+ var normalized = plainObject(validation.normalized || plan);
1753
+ var activeProbe = plainObject(validation.activeProbe || normalized.activeProbe || normalized.active_probe);
1754
+ var blockers = cleanStringList(validation.blockers || normalized.blockers, 40, 500);
1755
+ var requiredArtifacts = cleanStringList(normalized.requiredArtifacts
1756
+ || normalized.required_artifacts
1757
+ || activeProbe.required_artifacts, 30, 500);
1758
+ var falsePassBlockers = cleanStringList(normalized.falsePassBlockers
1759
+ || normalized.false_pass_blockers
1760
+ || activeProbe.false_pass_blockers, 30, 500);
1761
+ var status = validation.valid ? 'pass' : 'blocked';
1762
+ var issueClass = cleanText(normalized.issue_class || normalized.issueClass || activeProbe.issue_class, 120);
1763
+ var route = cleanText(activeProbe.route, 500);
1764
+ var action = cleanText(activeProbe.action, 1000);
1765
+ return {
1766
+ key: 'support_issue_class_probe_plan',
1767
+ label: 'Support issue-class probe plan',
1768
+ status: status,
1769
+ reason: validation.valid
1770
+ ? "Support issue-class probe plan is ready for ".concat(issueClass || 'the diagnosed issue', " and requires AIQaBusinessAssertion proof.")
1771
+ : blockers.join('; ') || 'Support issue-class probe plan is incomplete.',
1772
+ evidenceRefs: requiredArtifacts,
1773
+ recordedAt: isoNow(now || normalized.generatedAt || normalized.generated_at),
1774
+ metadata: {
1775
+ planId: cleanText(normalized.planId || normalized.plan_id, 180),
1776
+ status: cleanText(validation.status || normalized.status, 120),
1777
+ issueClass: issueClass,
1778
+ diagnosisValid: normalized.diagnosisValid === true || normalized.diagnosis_valid === true,
1779
+ issueClassProbePlanReady: validation.valid === true && validation.status === 'ready',
1780
+ activeRoute: route,
1781
+ action: action,
1782
+ expectedEvidence: cleanText(activeProbe.expected_evidence || activeProbe.expectedEvidence, 1200),
1783
+ expectedBusinessProof: cleanText(activeProbe.expected_business_proof || activeProbe.expectedBusinessProof, 1200),
1784
+ acceptanceGate: cleanText(normalized.acceptanceGate || normalized.acceptance_gate || activeProbe.acceptance_gate, 120),
1785
+ requiredArtifacts: requiredArtifacts,
1786
+ falsePassBlockers: falsePassBlockers,
1787
+ blockers: blockers,
1788
+ activeProbe: {
1789
+ issueClass: issueClass,
1790
+ route: route,
1791
+ action: action,
1792
+ probeType: cleanText(activeProbe.probe_type || activeProbe.probeType, 120),
1793
+ failureClass: cleanText(activeProbe.failure_class || activeProbe.failureClass, 120),
1794
+ blocksAcceptanceWithoutBusinessAssertion: activeProbe.blocks_acceptance_without_business_assertion === true
1795
+ || activeProbe.blocksAcceptanceWithoutBusinessAssertion === true
1796
+ }
1797
+ }
1798
+ };
1799
+ }
1716
1800
  function firstNonEmptyText(values, max) {
1717
1801
  var e_26, _a;
1718
1802
  if (max === void 0) { max = 1000; }
@@ -2402,7 +2486,7 @@ function applyAssistantAnswerQualityGate(qa, decision, now) {
2402
2486
  }
2403
2487
  function buildSupportAIRunFromEvidence(input) {
2404
2488
  var e_28, _a, e_29, _b;
2405
- 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;
2489
+ 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;
2406
2490
  var ticket = input.ticket || {};
2407
2491
  var job = input.job || {};
2408
2492
  var evidence = buildSupportQaEvidence(input);
@@ -2414,8 +2498,8 @@ function buildSupportAIRunFromEvidence(input) {
2414
2498
  addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
2415
2499
  addSourceId(sourceIds, 'buildPlanId', job.buildPlanId || ticket.buildPlanId);
2416
2500
  try {
2417
- for (var _24 = __values(asArray(input.taskEvents)), _25 = _24.next(); !_25.done; _25 = _24.next()) {
2418
- var event_1 = _25.value;
2501
+ for (var _36 = __values(asArray(input.taskEvents)), _37 = _36.next(); !_37.done; _37 = _36.next()) {
2502
+ var event_1 = _37.value;
2419
2503
  pushEvent(events, {
2420
2504
  type: event_1.type === 'human_intervention' ? 'human_intervention' : 'log',
2421
2505
  category: cleanText(event_1.category || event_1.phase || event_1.type, 160),
@@ -2432,13 +2516,13 @@ function buildSupportAIRunFromEvidence(input) {
2432
2516
  catch (e_28_1) { e_28 = { error: e_28_1 }; }
2433
2517
  finally {
2434
2518
  try {
2435
- if (_25 && !_25.done && (_a = _24.return)) _a.call(_24);
2519
+ if (_37 && !_37.done && (_a = _36.return)) _a.call(_36);
2436
2520
  }
2437
2521
  finally { if (e_28) throw e_28.error; }
2438
2522
  }
2439
2523
  try {
2440
- for (var _26 = __values(asArray(input.aiJobs)), _27 = _26.next(); !_27.done; _27 = _26.next()) {
2441
- var aiJob = _27.value;
2524
+ for (var _38 = __values(asArray(input.aiJobs)), _39 = _38.next(); !_39.done; _39 = _38.next()) {
2525
+ var aiJob = _39.value;
2442
2526
  pushEvent(events, {
2443
2527
  type: aiJob.model ? 'model_call' : 'log',
2444
2528
  category: cleanText(aiJob.category || aiJob.phase || aiJob.runner, 160),
@@ -2456,7 +2540,7 @@ function buildSupportAIRunFromEvidence(input) {
2456
2540
  catch (e_29_1) { e_29 = { error: e_29_1 }; }
2457
2541
  finally {
2458
2542
  try {
2459
- if (_27 && !_27.done && (_b = _26.return)) _b.call(_26);
2543
+ if (_39 && !_39.done && (_b = _38.return)) _b.call(_38);
2460
2544
  }
2461
2545
  finally { if (e_29) throw e_29.error; }
2462
2546
  }
@@ -2563,6 +2647,25 @@ function buildSupportAIRunFromEvidence(input) {
2563
2647
  metadata: diagnosisEvidencePackGate.metadata
2564
2648
  });
2565
2649
  }
2650
+ var issueClassProbePlanSource = supportIssueClassProbePlanObject(ticket, job, evidence);
2651
+ var issueClassProbePlan = Object.keys(issueClassProbePlanSource).length
2652
+ ? issueClassProbePlanSource
2653
+ : Object.keys(diagnosisGate).length
2654
+ ? (0, support_runner_v5_1.buildResolveIOSupportIssueClassProbePlan)(diagnosisGate, input.now)
2655
+ : {};
2656
+ var issueClassProbePlanRequired = nextActionContractRequired || Object.keys(diagnosisGate).length > 0;
2657
+ var issueClassProbePlanGate = supportIssueClassProbePlanGate(issueClassProbePlan, diagnosisGate, input.now, issueClassProbePlanRequired);
2658
+ if (issueClassProbePlanGate) {
2659
+ gates.push(issueClassProbePlanGate);
2660
+ pushEvent(events, {
2661
+ type: 'log',
2662
+ category: 'support_issue_class_probe_plan',
2663
+ message: issueClassProbePlanGate.reason,
2664
+ artifactPaths: issueClassProbePlanGate.evidenceRefs,
2665
+ recordedAt: issueClassProbePlanGate.recordedAt,
2666
+ metadata: issueClassProbePlanGate.metadata
2667
+ });
2668
+ }
2566
2669
  var productRepairEvidence = supportProductRepairEvidence(input, evidence);
2567
2670
  var diagnosisBeforeRepairGate = supportDiagnosisBeforeRepairGate(diagnosisGate, productRepairEvidence, input.now);
2568
2671
  if (diagnosisBeforeRepairGate) {
@@ -2658,6 +2761,21 @@ function buildSupportAIRunFromEvidence(input) {
2658
2761
  issueClassProbeCount: Number(((_3 = diagnosisEvidencePackGate.metadata) === null || _3 === void 0 ? void 0 : _3.issueClassProbeCount) || 0),
2659
2762
  validationBlockers: cleanStringList((_4 = diagnosisEvidencePackGate.metadata) === null || _4 === void 0 ? void 0 : _4.validationBlockers, 20, 500)
2660
2763
  } : undefined,
2764
+ issueClassProbePlan: issueClassProbePlanGate ? {
2765
+ status: cleanText((_5 = issueClassProbePlanGate.metadata) === null || _5 === void 0 ? void 0 : _5.status, 120),
2766
+ gateStatus: issueClassProbePlanGate.status,
2767
+ planId: cleanText((_6 = issueClassProbePlanGate.metadata) === null || _6 === void 0 ? void 0 : _6.planId, 180),
2768
+ issueClass: cleanText((_7 = issueClassProbePlanGate.metadata) === null || _7 === void 0 ? void 0 : _7.issueClass, 120),
2769
+ diagnosisValid: ((_8 = issueClassProbePlanGate.metadata) === null || _8 === void 0 ? void 0 : _8.diagnosisValid) === true,
2770
+ issueClassProbePlanReady: ((_9 = issueClassProbePlanGate.metadata) === null || _9 === void 0 ? void 0 : _9.issueClassProbePlanReady) === true,
2771
+ activeRoute: cleanText((_10 = issueClassProbePlanGate.metadata) === null || _10 === void 0 ? void 0 : _10.activeRoute, 500),
2772
+ action: cleanText((_11 = issueClassProbePlanGate.metadata) === null || _11 === void 0 ? void 0 : _11.action, 1000),
2773
+ expectedBusinessProof: cleanText((_12 = issueClassProbePlanGate.metadata) === null || _12 === void 0 ? void 0 : _12.expectedBusinessProof, 1200),
2774
+ acceptanceGate: cleanText((_13 = issueClassProbePlanGate.metadata) === null || _13 === void 0 ? void 0 : _13.acceptanceGate, 120),
2775
+ requiredArtifacts: cleanStringList((_14 = issueClassProbePlanGate.metadata) === null || _14 === void 0 ? void 0 : _14.requiredArtifacts, 20, 500),
2776
+ falsePassBlockers: cleanStringList((_15 = issueClassProbePlanGate.metadata) === null || _15 === void 0 ? void 0 : _15.falsePassBlockers, 20, 500),
2777
+ blockers: cleanStringList((_16 = issueClassProbePlanGate.metadata) === null || _16 === void 0 ? void 0 : _16.blockers, 20, 500)
2778
+ } : undefined,
2661
2779
  businessProofReadiness: Object.keys(businessProofReadiness).length ? {
2662
2780
  ready: businessProofReadiness.ready === true,
2663
2781
  status: cleanText(businessProofReadiness.status, 120),
@@ -2666,19 +2784,19 @@ function buildSupportAIRunFromEvidence(input) {
2666
2784
  } : undefined,
2667
2785
  nextActionContract: nextActionContractGate ? {
2668
2786
  status: nextActionContractGate.status,
2669
- action: cleanText((_5 = nextActionContractGate.metadata) === null || _5 === void 0 ? void 0 : _5.action, 160),
2670
- primaryCommand: cleanText((_6 = nextActionContractGate.metadata) === null || _6 === void 0 ? void 0 : _6.primaryCommand, 240),
2671
- safeToAutoRun: ((_7 = nextActionContractGate.metadata) === null || _7 === void 0 ? void 0 : _7.safeToAutoRun) === true,
2672
- canRunWithoutCodexMonitor: ((_8 = nextActionContractGate.metadata) === null || _8 === void 0 ? void 0 : _8.canRunWithoutCodexMonitor) === true,
2673
- codexFallbackRequired: ((_9 = nextActionContractGate.metadata) === null || _9 === void 0 ? void 0 : _9.codexFallbackRequired) === true,
2674
- requiresHumanApproval: ((_10 = nextActionContractGate.metadata) === null || _10 === void 0 ? void 0 : _10.requiresHumanApproval) === true,
2675
- rootCauseFirstSatisfied: ((_11 = nextActionContractGate.metadata) === null || _11 === void 0 ? void 0 : _11.rootCauseFirstSatisfied) === true,
2676
- hotfixCommitRequired: ((_12 = nextActionContractGate.metadata) === null || _12 === void 0 ? void 0 : _12.hotfixCommitRequired) === true,
2677
- liveHotfixBlockedUntilCommit: ((_13 = nextActionContractGate.metadata) === null || _13 === void 0 ? void 0 : _13.liveHotfixBlockedUntilCommit) === true,
2678
- failureClass: cleanText((_14 = nextActionContractGate.metadata) === null || _14 === void 0 ? void 0 : _14.failureClass, 120),
2679
- evidenceFreshnessStatus: cleanText((_15 = nextActionContractGate.metadata) === null || _15 === void 0 ? void 0 : _15.evidenceFreshnessStatus, 120),
2680
- sameFailureCount: Number(((_16 = nextActionContractGate.metadata) === null || _16 === void 0 ? void 0 : _16.sameFailureCount) || 0),
2681
- blockers: cleanStringList((_17 = nextActionContractGate.metadata) === null || _17 === void 0 ? void 0 : _17.blockers, 20, 500)
2787
+ action: cleanText((_17 = nextActionContractGate.metadata) === null || _17 === void 0 ? void 0 : _17.action, 160),
2788
+ primaryCommand: cleanText((_18 = nextActionContractGate.metadata) === null || _18 === void 0 ? void 0 : _18.primaryCommand, 240),
2789
+ safeToAutoRun: ((_19 = nextActionContractGate.metadata) === null || _19 === void 0 ? void 0 : _19.safeToAutoRun) === true,
2790
+ canRunWithoutCodexMonitor: ((_20 = nextActionContractGate.metadata) === null || _20 === void 0 ? void 0 : _20.canRunWithoutCodexMonitor) === true,
2791
+ codexFallbackRequired: ((_21 = nextActionContractGate.metadata) === null || _21 === void 0 ? void 0 : _21.codexFallbackRequired) === true,
2792
+ requiresHumanApproval: ((_22 = nextActionContractGate.metadata) === null || _22 === void 0 ? void 0 : _22.requiresHumanApproval) === true,
2793
+ rootCauseFirstSatisfied: ((_23 = nextActionContractGate.metadata) === null || _23 === void 0 ? void 0 : _23.rootCauseFirstSatisfied) === true,
2794
+ hotfixCommitRequired: ((_24 = nextActionContractGate.metadata) === null || _24 === void 0 ? void 0 : _24.hotfixCommitRequired) === true,
2795
+ liveHotfixBlockedUntilCommit: ((_25 = nextActionContractGate.metadata) === null || _25 === void 0 ? void 0 : _25.liveHotfixBlockedUntilCommit) === true,
2796
+ failureClass: cleanText((_26 = nextActionContractGate.metadata) === null || _26 === void 0 ? void 0 : _26.failureClass, 120),
2797
+ evidenceFreshnessStatus: cleanText((_27 = nextActionContractGate.metadata) === null || _27 === void 0 ? void 0 : _27.evidenceFreshnessStatus, 120),
2798
+ sameFailureCount: Number(((_28 = nextActionContractGate.metadata) === null || _28 === void 0 ? void 0 : _28.sameFailureCount) || 0),
2799
+ blockers: cleanStringList((_29 = nextActionContractGate.metadata) === null || _29 === void 0 ? void 0 : _29.blockers, 20, 500)
2682
2800
  } : undefined,
2683
2801
  customerReplyPolicy: Object.keys(customerReplyPolicy).length ? {
2684
2802
  action: cleanText(customerReplyPolicy.action, 120),
@@ -2686,12 +2804,12 @@ function buildSupportAIRunFromEvidence(input) {
2686
2804
  canDraftCustomerReply: customerReplyPolicy.canDraftCustomerReply === true || customerReplyPolicy.can_draft_customer_reply === true,
2687
2805
  canSendCustomerReply: customerReplyPolicy.canSendCustomerReply === true || customerReplyPolicy.can_send_customer_reply === true,
2688
2806
  reason: cleanText(customerReplyPolicy.reason, 1000),
2689
- reviewType: cleanText(((_18 = customerReplyPolicy.humanReviewPacket) === null || _18 === void 0 ? void 0 : _18.reviewType)
2690
- || ((_19 = customerReplyPolicy.human_review_packet) === null || _19 === void 0 ? void 0 : _19.review_type)
2691
- || ((_20 = customerReplyPolicy.human_review_packet) === null || _20 === void 0 ? void 0 : _20.reviewType), 160),
2692
- primaryAction: cleanText(((_21 = customerReplyPolicy.humanReviewPacket) === null || _21 === void 0 ? void 0 : _21.primaryAction)
2693
- || ((_22 = customerReplyPolicy.human_review_packet) === null || _22 === void 0 ? void 0 : _22.primary_action)
2694
- || ((_23 = customerReplyPolicy.human_review_packet) === null || _23 === void 0 ? void 0 : _23.primaryAction), 160)
2807
+ reviewType: cleanText(((_30 = customerReplyPolicy.humanReviewPacket) === null || _30 === void 0 ? void 0 : _30.reviewType)
2808
+ || ((_31 = customerReplyPolicy.human_review_packet) === null || _31 === void 0 ? void 0 : _31.review_type)
2809
+ || ((_32 = customerReplyPolicy.human_review_packet) === null || _32 === void 0 ? void 0 : _32.reviewType), 160),
2810
+ primaryAction: cleanText(((_33 = customerReplyPolicy.humanReviewPacket) === null || _33 === void 0 ? void 0 : _33.primaryAction)
2811
+ || ((_34 = customerReplyPolicy.human_review_packet) === null || _34 === void 0 ? void 0 : _34.primary_action)
2812
+ || ((_35 = customerReplyPolicy.human_review_packet) === null || _35 === void 0 ? void 0 : _35.primaryAction), 160)
2695
2813
  } : undefined
2696
2814
  }
2697
2815
  });