@resolveio/server-lib 22.3.192 → 22.3.194

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.192",
3
+ "version": "22.3.194",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -1513,6 +1513,41 @@ function supportDiagnosisBeforeRepairGate(diagnosisGate, repairEvidence, now) {
1513
1513
  }
1514
1514
  };
1515
1515
  }
1516
+ function supportOwnerFileScopeGate(diagnosisGate, repairEvidence, now) {
1517
+ if (!repairEvidence.attempted) {
1518
+ return undefined;
1519
+ }
1520
+ var validation = (0, support_runner_v5_1.validateResolveIOSupportDiagnosisGate)(diagnosisGate);
1521
+ if (!validation.valid || !validation.normalized) {
1522
+ return undefined;
1523
+ }
1524
+ var outsideOwnerFiles = (0, support_runner_v5_1.changedFilesOutsideResolveIOSupportDiagnosisOwnerFiles)(validation.normalized, repairEvidence.changedFiles, { allowTests: true });
1525
+ var status = outsideOwnerFiles.length ? 'blocked' : 'pass';
1526
+ return {
1527
+ key: 'support_owner_file_scope',
1528
+ label: 'Support owner-file scope',
1529
+ status: status,
1530
+ reason: outsideOwnerFiles.length
1531
+ ? "Support repair changed files outside diagnosis owner_files; revise diagnosis with new evidence before broadening edits: ".concat(outsideOwnerFiles.join(', '))
1532
+ : 'Support repair stayed within diagnosis owner_files; test-only changes are allowed as supporting evidence.',
1533
+ evidenceRefs: outsideOwnerFiles.length ? outsideOwnerFiles : repairEvidence.changedFiles,
1534
+ recordedAt: isoNow(now),
1535
+ metadata: {
1536
+ repairAttempted: true,
1537
+ diagnosisValid: true,
1538
+ issueClass: validation.normalized.issue_class,
1539
+ ownerFiles: validation.normalized.owner_files,
1540
+ changedFiles: repairEvidence.changedFiles,
1541
+ outsideOwnerFiles: outsideOwnerFiles,
1542
+ allowedTestFilesOutsideOwnerScope: true,
1543
+ productRepairAllowed: outsideOwnerFiles.length === 0,
1544
+ allowedDispatchAction: outsideOwnerFiles.length ? 'run_read_only_diagnosis' : 'run_business_proof_qa',
1545
+ requiredEvidence: outsideOwnerFiles.length
1546
+ ? ['revised SupportDiagnosisGate with evidence for each new owner file', 'updated failing_path and proof_plan matching broadened scope']
1547
+ : ['compile/unit proof', 'AIQaBusinessAssertion mapped to diagnosis proof_plan']
1548
+ }
1549
+ };
1550
+ }
1516
1551
  function evidenceObject() {
1517
1552
  var e_27, _a;
1518
1553
  var values = [];
@@ -1596,6 +1631,12 @@ function buildSupportQaEvidence(input) {
1596
1631
  || autonomousDecision.customer_reply_policy
1597
1632
  || job.customerReplyPolicy
1598
1633
  || job.customer_reply_policy);
1634
+ var customerReplyReadiness = plainObject(autonomousDecision.customerReplyReadiness
1635
+ || autonomousDecision.customer_reply_readiness
1636
+ || customerReplyPolicy.readinessContract
1637
+ || customerReplyPolicy.readiness_contract
1638
+ || job.customerReplyReadiness
1639
+ || job.customer_reply_readiness);
1599
1640
  var humanReviewPacket = plainObject(autonomousDecision.humanReviewPacket
1600
1641
  || autonomousDecision.human_review_packet
1601
1642
  || customerReplyPolicy.humanReviewPacket
@@ -1616,6 +1657,9 @@ function buildSupportQaEvidence(input) {
1616
1657
  else if (Object.keys(humanReviewPacket).length) {
1617
1658
  evidence.customerReplyPolicy = { humanReviewPacket: humanReviewPacket };
1618
1659
  }
1660
+ if (Object.keys(customerReplyReadiness).length) {
1661
+ evidence.customerReplyReadiness = customerReplyReadiness;
1662
+ }
1619
1663
  if (Object.keys(preflightGate).length) {
1620
1664
  evidence.supportV5PreflightGate = preflightGate;
1621
1665
  applySupportPreflightGateToQaEvidence(evidence, preflightGate);
@@ -1839,6 +1883,47 @@ function supportCustomerReplyPolicyGate(policy, now) {
1839
1883
  }
1840
1884
  };
1841
1885
  }
1886
+ function supportCustomerReplyReadinessGate(contract, now) {
1887
+ if (!contract || !Object.keys(contract).length) {
1888
+ return undefined;
1889
+ }
1890
+ var validation = (0, support_runner_v5_1.validateResolveIOSupportCustomerReplyReadinessContract)(contract);
1891
+ var normalized = validation.normalized;
1892
+ var status = cleanText(normalized.status, 120);
1893
+ var gateStatus = normalized.canSendCustomerReply
1894
+ ? 'blocked'
1895
+ : validation.valid && (status === 'draft_ready' || status === 'clarification_required')
1896
+ ? 'warn'
1897
+ : 'blocked';
1898
+ return {
1899
+ key: 'support_customer_reply_readiness',
1900
+ label: 'Support customer reply readiness',
1901
+ status: gateStatus,
1902
+ reason: normalized.reason || validation.blockers.join('; ') || status || 'Support customer reply readiness recorded.',
1903
+ evidenceRefs: normalized.evidenceRefs,
1904
+ recordedAt: isoNow(now || normalized.createdAt),
1905
+ metadata: {
1906
+ contractId: normalized.contractId,
1907
+ status: status,
1908
+ policyAction: normalized.policyAction,
1909
+ reviewType: normalized.reviewType,
1910
+ primaryCommand: normalized.primaryCommand,
1911
+ canDraftCustomerReply: normalized.canDraftCustomerReply,
1912
+ canSendCustomerReply: normalized.canSendCustomerReply,
1913
+ requiresHumanApproval: normalized.requiresHumanApproval,
1914
+ proofBacked: normalized.proofBacked,
1915
+ businessProofReady: normalized.businessProofReady,
1916
+ releaseReady: normalized.releaseReady,
1917
+ diagnosisReady: normalized.diagnosisReady,
1918
+ issueClassProbePlanReady: normalized.issueClassProbePlanReady,
1919
+ clarificationRequired: normalized.clarificationRequired,
1920
+ blockers: Array.from(new Set(__spreadArray(__spreadArray([], __read(normalized.blockers), false), __read(validation.blockers), false))),
1921
+ requiredEvidence: normalized.requiredEvidence,
1922
+ nextCommands: normalized.nextCommands,
1923
+ forbiddenActions: normalized.forbiddenActions
1924
+ }
1925
+ };
1926
+ }
1842
1927
  function supportNextActionContractObject(ticket, job, evidence) {
1843
1928
  var ticketAutomation = plainObject(ticket.automation);
1844
1929
  var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
@@ -3086,7 +3171,7 @@ function applyAssistantAnswerQualityGate(qa, decision, now) {
3086
3171
  }
3087
3172
  function buildSupportAIRunFromEvidence(input) {
3088
3173
  var e_32, _a, e_33, _b;
3089
- var _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25, _26, _27, _28, _29, _30, _31, _32, _33, _34, _35, _36, _37, _38, _39, _40, _41, _42, _43, _44;
3174
+ 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, _45, _46, _47, _48, _49, _50, _51, _52, _53, _54, _55, _56, _57, _58, _59, _60, _61;
3090
3175
  var ticket = input.ticket || {};
3091
3176
  var job = input.job || {};
3092
3177
  var evidence = buildSupportQaEvidence(input);
@@ -3098,8 +3183,8 @@ function buildSupportAIRunFromEvidence(input) {
3098
3183
  addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
3099
3184
  addSourceId(sourceIds, 'buildPlanId', job.buildPlanId || ticket.buildPlanId);
3100
3185
  try {
3101
- for (var _45 = __values(asArray(input.taskEvents)), _46 = _45.next(); !_46.done; _46 = _45.next()) {
3102
- var event_1 = _46.value;
3186
+ for (var _62 = __values(asArray(input.taskEvents)), _63 = _62.next(); !_63.done; _63 = _62.next()) {
3187
+ var event_1 = _63.value;
3103
3188
  pushEvent(events, {
3104
3189
  type: event_1.type === 'human_intervention' ? 'human_intervention' : 'log',
3105
3190
  category: cleanText(event_1.category || event_1.phase || event_1.type, 160),
@@ -3116,13 +3201,13 @@ function buildSupportAIRunFromEvidence(input) {
3116
3201
  catch (e_32_1) { e_32 = { error: e_32_1 }; }
3117
3202
  finally {
3118
3203
  try {
3119
- if (_46 && !_46.done && (_a = _45.return)) _a.call(_45);
3204
+ if (_63 && !_63.done && (_a = _62.return)) _a.call(_62);
3120
3205
  }
3121
3206
  finally { if (e_32) throw e_32.error; }
3122
3207
  }
3123
3208
  try {
3124
- for (var _47 = __values(asArray(input.aiJobs)), _48 = _47.next(); !_48.done; _48 = _47.next()) {
3125
- var aiJob = _48.value;
3209
+ for (var _64 = __values(asArray(input.aiJobs)), _65 = _64.next(); !_65.done; _65 = _64.next()) {
3210
+ var aiJob = _65.value;
3126
3211
  pushEvent(events, {
3127
3212
  type: aiJob.model ? 'model_call' : 'log',
3128
3213
  category: cleanText(aiJob.category || aiJob.phase || aiJob.runner, 160),
@@ -3140,7 +3225,7 @@ function buildSupportAIRunFromEvidence(input) {
3140
3225
  catch (e_33_1) { e_33 = { error: e_33_1 }; }
3141
3226
  finally {
3142
3227
  try {
3143
- if (_48 && !_48.done && (_b = _47.return)) _b.call(_47);
3228
+ if (_65 && !_65.done && (_b = _64.return)) _b.call(_64);
3144
3229
  }
3145
3230
  finally { if (e_33) throw e_33.error; }
3146
3231
  }
@@ -3184,6 +3269,22 @@ function buildSupportAIRunFromEvidence(input) {
3184
3269
  metadata: customerReplyPolicyGate.metadata
3185
3270
  });
3186
3271
  }
3272
+ var customerReplyReadiness = plainObject(evidence.customerReplyReadiness
3273
+ || evidence.customer_reply_readiness
3274
+ || customerReplyPolicy.readinessContract
3275
+ || customerReplyPolicy.readiness_contract);
3276
+ var customerReplyReadinessGate = supportCustomerReplyReadinessGate(customerReplyReadiness, input.now);
3277
+ if (customerReplyReadinessGate) {
3278
+ gates.push(customerReplyReadinessGate);
3279
+ pushEvent(events, {
3280
+ type: 'human_intervention',
3281
+ category: 'support_customer_reply_readiness',
3282
+ message: customerReplyReadinessGate.reason,
3283
+ artifactPaths: customerReplyReadinessGate.evidenceRefs,
3284
+ recordedAt: customerReplyReadinessGate.recordedAt,
3285
+ metadata: customerReplyReadinessGate.metadata
3286
+ });
3287
+ }
3187
3288
  var nextActionContract = supportNextActionContractObject(ticket, job, evidence);
3188
3289
  var nextActionContractRequired = supportNextActionContractRequired(ticket, job, evidence);
3189
3290
  var nextActionContractGate = supportNextActionContractGate(nextActionContract, input.now, nextActionContractRequired);
@@ -3292,6 +3393,18 @@ function buildSupportAIRunFromEvidence(input) {
3292
3393
  metadata: diagnosisBeforeRepairGate.metadata
3293
3394
  });
3294
3395
  }
3396
+ var ownerFileScopeGate = supportOwnerFileScopeGate(diagnosisGate, productRepairEvidence, input.now);
3397
+ if (ownerFileScopeGate) {
3398
+ gates.push(ownerFileScopeGate);
3399
+ pushEvent(events, {
3400
+ type: 'log',
3401
+ category: 'support_owner_file_scope',
3402
+ message: ownerFileScopeGate.reason,
3403
+ artifactPaths: ownerFileScopeGate.evidenceRefs,
3404
+ recordedAt: ownerFileScopeGate.recordedAt,
3405
+ metadata: ownerFileScopeGate.metadata
3406
+ });
3407
+ }
3295
3408
  var qa = applySupportDiagnosisProofGate(buildQaFromEvidence(evidence, input.now), diagnosisGate, input.now);
3296
3409
  var diagnosisOwnerFiles = asArray(diagnosisGate.owner_files || diagnosisGate.ownerFiles);
3297
3410
  var diagnosisIssueClass = cleanText(diagnosisGate.issue_class || diagnosisGate.issueClass, 120);
@@ -3344,51 +3457,61 @@ function buildSupportAIRunFromEvidence(input) {
3344
3457
  productRepairAllowed: ((_l = diagnosisBeforeRepairGate.metadata) === null || _l === void 0 ? void 0 : _l.productRepairAllowed) === true,
3345
3458
  blockers: cleanStringList((_m = diagnosisBeforeRepairGate.metadata) === null || _m === void 0 ? void 0 : _m.blockers, 20, 500)
3346
3459
  } : undefined,
3460
+ ownerFileScope: ownerFileScopeGate ? {
3461
+ status: ownerFileScopeGate.status,
3462
+ productRepairAllowed: ((_o = ownerFileScopeGate.metadata) === null || _o === void 0 ? void 0 : _o.productRepairAllowed) === true,
3463
+ allowedDispatchAction: cleanText((_p = ownerFileScopeGate.metadata) === null || _p === void 0 ? void 0 : _p.allowedDispatchAction, 160),
3464
+ ownerFiles: cleanStringList((_q = ownerFileScopeGate.metadata) === null || _q === void 0 ? void 0 : _q.ownerFiles, 40, 500),
3465
+ changedFiles: cleanStringList((_r = ownerFileScopeGate.metadata) === null || _r === void 0 ? void 0 : _r.changedFiles, 60, 500),
3466
+ outsideOwnerFiles: cleanStringList((_s = ownerFileScopeGate.metadata) === null || _s === void 0 ? void 0 : _s.outsideOwnerFiles, 40, 500),
3467
+ allowedTestFilesOutsideOwnerScope: ((_t = ownerFileScopeGate.metadata) === null || _t === void 0 ? void 0 : _t.allowedTestFilesOutsideOwnerScope) === true,
3468
+ requiredEvidence: cleanStringList((_u = ownerFileScopeGate.metadata) === null || _u === void 0 ? void 0 : _u.requiredEvidence, 20, 500)
3469
+ } : undefined,
3347
3470
  rootCauseEntryContract: Object.keys(rootCauseEntryContract).length ? {
3348
3471
  contractId: cleanText(rootCauseEntryContract.contract_id || rootCauseEntryContract.contractId, 160),
3349
3472
  version: cleanText(rootCauseEntryContract.version, 120),
3350
3473
  status: cleanText(rootCauseEntryContract.status, 120),
3351
3474
  issueClassProbeCount: asArray(rootCauseEntryContract.issue_class_probes || rootCauseEntryContract.issueClassProbes).length,
3352
- 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,
3353
- requiresBusinessAssertion: ((_q = rootCauseEntryContract.business_proof_policy) === null || _q === void 0 ? void 0 : _q.requires_aiqa_business_assertion) === true
3354
- || ((_r = rootCauseEntryContract.businessProofPolicy) === null || _r === void 0 ? void 0 : _r.requiresAiqaBusinessAssertion) === true
3475
+ ownerFileMax: Number(((_v = rootCauseEntryContract.owner_file_policy) === null || _v === void 0 ? void 0 : _v.max_files) || ((_w = rootCauseEntryContract.ownerFilePolicy) === null || _w === void 0 ? void 0 : _w.maxFiles) || 0) || 0,
3476
+ requiresBusinessAssertion: ((_x = rootCauseEntryContract.business_proof_policy) === null || _x === void 0 ? void 0 : _x.requires_aiqa_business_assertion) === true
3477
+ || ((_y = rootCauseEntryContract.businessProofPolicy) === null || _y === void 0 ? void 0 : _y.requiresAiqaBusinessAssertion) === true
3355
3478
  } : undefined,
3356
3479
  diagnosis: Object.keys(diagnosisGate).length ? {
3357
3480
  status: cleanText(diagnosisGate.status, 80),
3358
3481
  issueClass: diagnosisIssueClass,
3359
3482
  ownerFiles: diagnosisOwnerFiles,
3360
- 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),
3483
+ acceptedHypothesis: cleanText(((_z = diagnosisGate.accepted_hypothesis) === null || _z === void 0 ? void 0 : _z.statement) || ((_0 = diagnosisGate.acceptedHypothesis) === null || _0 === void 0 ? void 0 : _0.statement), 1000),
3361
3484
  proofPlan: diagnosisGate.proof_plan || diagnosisGate.proofPlan
3362
3485
  } : undefined,
3363
3486
  diagnosisEvidencePack: diagnosisEvidencePackGate ? {
3364
- status: cleanText((_u = diagnosisEvidencePackGate.metadata) === null || _u === void 0 ? void 0 : _u.status, 120),
3487
+ status: cleanText((_1 = diagnosisEvidencePackGate.metadata) === null || _1 === void 0 ? void 0 : _1.status, 120),
3365
3488
  gateStatus: diagnosisEvidencePackGate.status,
3366
- packId: cleanText((_v = diagnosisEvidencePackGate.metadata) === null || _v === void 0 ? void 0 : _v.packId, 180),
3367
- readOnly: ((_w = diagnosisEvidencePackGate.metadata) === null || _w === void 0 ? void 0 : _w.readOnly) !== false,
3368
- sourceEditsAllowed: ((_x = diagnosisEvidencePackGate.metadata) === null || _x === void 0 ? void 0 : _x.sourceEditsAllowed) === true,
3369
- requiredOutputKey: cleanText((_y = diagnosisEvidencePackGate.metadata) === null || _y === void 0 ? void 0 : _y.requiredOutputKey, 120),
3370
- diagnosisValid: ((_z = diagnosisEvidencePackGate.metadata) === null || _z === void 0 ? void 0 : _z.diagnosisValid) === true,
3371
- issueClassHint: cleanText((_0 = diagnosisEvidencePackGate.metadata) === null || _0 === void 0 ? void 0 : _0.issueClassHint, 120),
3372
- ownerFileHints: cleanStringList((_1 = diagnosisEvidencePackGate.metadata) === null || _1 === void 0 ? void 0 : _1.ownerFileHints, 20, 500),
3373
- similarHintCount: Number(((_2 = diagnosisEvidencePackGate.metadata) === null || _2 === void 0 ? void 0 : _2.similarHintCount) || 0),
3374
- similarHintsAdvisoryOnly: ((_3 = diagnosisEvidencePackGate.metadata) === null || _3 === void 0 ? void 0 : _3.similarHintsAdvisoryOnly) === true,
3375
- issueClassProbeCount: Number(((_4 = diagnosisEvidencePackGate.metadata) === null || _4 === void 0 ? void 0 : _4.issueClassProbeCount) || 0),
3376
- validationBlockers: cleanStringList((_5 = diagnosisEvidencePackGate.metadata) === null || _5 === void 0 ? void 0 : _5.validationBlockers, 20, 500)
3489
+ packId: cleanText((_2 = diagnosisEvidencePackGate.metadata) === null || _2 === void 0 ? void 0 : _2.packId, 180),
3490
+ readOnly: ((_3 = diagnosisEvidencePackGate.metadata) === null || _3 === void 0 ? void 0 : _3.readOnly) !== false,
3491
+ sourceEditsAllowed: ((_4 = diagnosisEvidencePackGate.metadata) === null || _4 === void 0 ? void 0 : _4.sourceEditsAllowed) === true,
3492
+ requiredOutputKey: cleanText((_5 = diagnosisEvidencePackGate.metadata) === null || _5 === void 0 ? void 0 : _5.requiredOutputKey, 120),
3493
+ diagnosisValid: ((_6 = diagnosisEvidencePackGate.metadata) === null || _6 === void 0 ? void 0 : _6.diagnosisValid) === true,
3494
+ issueClassHint: cleanText((_7 = diagnosisEvidencePackGate.metadata) === null || _7 === void 0 ? void 0 : _7.issueClassHint, 120),
3495
+ ownerFileHints: cleanStringList((_8 = diagnosisEvidencePackGate.metadata) === null || _8 === void 0 ? void 0 : _8.ownerFileHints, 20, 500),
3496
+ similarHintCount: Number(((_9 = diagnosisEvidencePackGate.metadata) === null || _9 === void 0 ? void 0 : _9.similarHintCount) || 0),
3497
+ similarHintsAdvisoryOnly: ((_10 = diagnosisEvidencePackGate.metadata) === null || _10 === void 0 ? void 0 : _10.similarHintsAdvisoryOnly) === true,
3498
+ issueClassProbeCount: Number(((_11 = diagnosisEvidencePackGate.metadata) === null || _11 === void 0 ? void 0 : _11.issueClassProbeCount) || 0),
3499
+ validationBlockers: cleanStringList((_12 = diagnosisEvidencePackGate.metadata) === null || _12 === void 0 ? void 0 : _12.validationBlockers, 20, 500)
3377
3500
  } : undefined,
3378
3501
  issueClassProbePlan: issueClassProbePlanGate ? {
3379
- status: cleanText((_6 = issueClassProbePlanGate.metadata) === null || _6 === void 0 ? void 0 : _6.status, 120),
3502
+ status: cleanText((_13 = issueClassProbePlanGate.metadata) === null || _13 === void 0 ? void 0 : _13.status, 120),
3380
3503
  gateStatus: issueClassProbePlanGate.status,
3381
- planId: cleanText((_7 = issueClassProbePlanGate.metadata) === null || _7 === void 0 ? void 0 : _7.planId, 180),
3382
- issueClass: cleanText((_8 = issueClassProbePlanGate.metadata) === null || _8 === void 0 ? void 0 : _8.issueClass, 120),
3383
- diagnosisValid: ((_9 = issueClassProbePlanGate.metadata) === null || _9 === void 0 ? void 0 : _9.diagnosisValid) === true,
3384
- issueClassProbePlanReady: ((_10 = issueClassProbePlanGate.metadata) === null || _10 === void 0 ? void 0 : _10.issueClassProbePlanReady) === true,
3385
- activeRoute: cleanText((_11 = issueClassProbePlanGate.metadata) === null || _11 === void 0 ? void 0 : _11.activeRoute, 500),
3386
- action: cleanText((_12 = issueClassProbePlanGate.metadata) === null || _12 === void 0 ? void 0 : _12.action, 1000),
3387
- expectedBusinessProof: cleanText((_13 = issueClassProbePlanGate.metadata) === null || _13 === void 0 ? void 0 : _13.expectedBusinessProof, 1200),
3388
- acceptanceGate: cleanText((_14 = issueClassProbePlanGate.metadata) === null || _14 === void 0 ? void 0 : _14.acceptanceGate, 120),
3389
- requiredArtifacts: cleanStringList((_15 = issueClassProbePlanGate.metadata) === null || _15 === void 0 ? void 0 : _15.requiredArtifacts, 20, 500),
3390
- falsePassBlockers: cleanStringList((_16 = issueClassProbePlanGate.metadata) === null || _16 === void 0 ? void 0 : _16.falsePassBlockers, 20, 500),
3391
- blockers: cleanStringList((_17 = issueClassProbePlanGate.metadata) === null || _17 === void 0 ? void 0 : _17.blockers, 20, 500)
3504
+ planId: cleanText((_14 = issueClassProbePlanGate.metadata) === null || _14 === void 0 ? void 0 : _14.planId, 180),
3505
+ issueClass: cleanText((_15 = issueClassProbePlanGate.metadata) === null || _15 === void 0 ? void 0 : _15.issueClass, 120),
3506
+ diagnosisValid: ((_16 = issueClassProbePlanGate.metadata) === null || _16 === void 0 ? void 0 : _16.diagnosisValid) === true,
3507
+ issueClassProbePlanReady: ((_17 = issueClassProbePlanGate.metadata) === null || _17 === void 0 ? void 0 : _17.issueClassProbePlanReady) === true,
3508
+ activeRoute: cleanText((_18 = issueClassProbePlanGate.metadata) === null || _18 === void 0 ? void 0 : _18.activeRoute, 500),
3509
+ action: cleanText((_19 = issueClassProbePlanGate.metadata) === null || _19 === void 0 ? void 0 : _19.action, 1000),
3510
+ expectedBusinessProof: cleanText((_20 = issueClassProbePlanGate.metadata) === null || _20 === void 0 ? void 0 : _20.expectedBusinessProof, 1200),
3511
+ acceptanceGate: cleanText((_21 = issueClassProbePlanGate.metadata) === null || _21 === void 0 ? void 0 : _21.acceptanceGate, 120),
3512
+ requiredArtifacts: cleanStringList((_22 = issueClassProbePlanGate.metadata) === null || _22 === void 0 ? void 0 : _22.requiredArtifacts, 20, 500),
3513
+ falsePassBlockers: cleanStringList((_23 = issueClassProbePlanGate.metadata) === null || _23 === void 0 ? void 0 : _23.falsePassBlockers, 20, 500),
3514
+ blockers: cleanStringList((_24 = issueClassProbePlanGate.metadata) === null || _24 === void 0 ? void 0 : _24.blockers, 20, 500)
3392
3515
  } : undefined,
3393
3516
  businessProofReadiness: Object.keys(businessProofReadiness).length ? {
3394
3517
  ready: businessProofReadiness.ready === true,
@@ -3398,19 +3521,19 @@ function buildSupportAIRunFromEvidence(input) {
3398
3521
  } : undefined,
3399
3522
  nextActionContract: nextActionContractGate ? {
3400
3523
  status: nextActionContractGate.status,
3401
- action: cleanText((_18 = nextActionContractGate.metadata) === null || _18 === void 0 ? void 0 : _18.action, 160),
3402
- primaryCommand: cleanText((_19 = nextActionContractGate.metadata) === null || _19 === void 0 ? void 0 : _19.primaryCommand, 240),
3403
- safeToAutoRun: ((_20 = nextActionContractGate.metadata) === null || _20 === void 0 ? void 0 : _20.safeToAutoRun) === true,
3404
- canRunWithoutCodexMonitor: ((_21 = nextActionContractGate.metadata) === null || _21 === void 0 ? void 0 : _21.canRunWithoutCodexMonitor) === true,
3405
- codexFallbackRequired: ((_22 = nextActionContractGate.metadata) === null || _22 === void 0 ? void 0 : _22.codexFallbackRequired) === true,
3406
- requiresHumanApproval: ((_23 = nextActionContractGate.metadata) === null || _23 === void 0 ? void 0 : _23.requiresHumanApproval) === true,
3407
- rootCauseFirstSatisfied: ((_24 = nextActionContractGate.metadata) === null || _24 === void 0 ? void 0 : _24.rootCauseFirstSatisfied) === true,
3408
- hotfixCommitRequired: ((_25 = nextActionContractGate.metadata) === null || _25 === void 0 ? void 0 : _25.hotfixCommitRequired) === true,
3409
- liveHotfixBlockedUntilCommit: ((_26 = nextActionContractGate.metadata) === null || _26 === void 0 ? void 0 : _26.liveHotfixBlockedUntilCommit) === true,
3410
- failureClass: cleanText((_27 = nextActionContractGate.metadata) === null || _27 === void 0 ? void 0 : _27.failureClass, 120),
3411
- evidenceFreshnessStatus: cleanText((_28 = nextActionContractGate.metadata) === null || _28 === void 0 ? void 0 : _28.evidenceFreshnessStatus, 120),
3412
- sameFailureCount: Number(((_29 = nextActionContractGate.metadata) === null || _29 === void 0 ? void 0 : _29.sameFailureCount) || 0),
3413
- blockers: cleanStringList((_30 = nextActionContractGate.metadata) === null || _30 === void 0 ? void 0 : _30.blockers, 20, 500)
3524
+ action: cleanText((_25 = nextActionContractGate.metadata) === null || _25 === void 0 ? void 0 : _25.action, 160),
3525
+ primaryCommand: cleanText((_26 = nextActionContractGate.metadata) === null || _26 === void 0 ? void 0 : _26.primaryCommand, 240),
3526
+ safeToAutoRun: ((_27 = nextActionContractGate.metadata) === null || _27 === void 0 ? void 0 : _27.safeToAutoRun) === true,
3527
+ canRunWithoutCodexMonitor: ((_28 = nextActionContractGate.metadata) === null || _28 === void 0 ? void 0 : _28.canRunWithoutCodexMonitor) === true,
3528
+ codexFallbackRequired: ((_29 = nextActionContractGate.metadata) === null || _29 === void 0 ? void 0 : _29.codexFallbackRequired) === true,
3529
+ requiresHumanApproval: ((_30 = nextActionContractGate.metadata) === null || _30 === void 0 ? void 0 : _30.requiresHumanApproval) === true,
3530
+ rootCauseFirstSatisfied: ((_31 = nextActionContractGate.metadata) === null || _31 === void 0 ? void 0 : _31.rootCauseFirstSatisfied) === true,
3531
+ hotfixCommitRequired: ((_32 = nextActionContractGate.metadata) === null || _32 === void 0 ? void 0 : _32.hotfixCommitRequired) === true,
3532
+ liveHotfixBlockedUntilCommit: ((_33 = nextActionContractGate.metadata) === null || _33 === void 0 ? void 0 : _33.liveHotfixBlockedUntilCommit) === true,
3533
+ failureClass: cleanText((_34 = nextActionContractGate.metadata) === null || _34 === void 0 ? void 0 : _34.failureClass, 120),
3534
+ evidenceFreshnessStatus: cleanText((_35 = nextActionContractGate.metadata) === null || _35 === void 0 ? void 0 : _35.evidenceFreshnessStatus, 120),
3535
+ sameFailureCount: Number(((_36 = nextActionContractGate.metadata) === null || _36 === void 0 ? void 0 : _36.sameFailureCount) || 0),
3536
+ blockers: cleanStringList((_37 = nextActionContractGate.metadata) === null || _37 === void 0 ? void 0 : _37.blockers, 20, 500)
3414
3537
  } : undefined,
3415
3538
  customerReplyPolicy: Object.keys(customerReplyPolicy).length ? {
3416
3539
  action: cleanText(customerReplyPolicy.action, 120),
@@ -3418,18 +3541,31 @@ function buildSupportAIRunFromEvidence(input) {
3418
3541
  canDraftCustomerReply: customerReplyPolicy.canDraftCustomerReply === true || customerReplyPolicy.can_draft_customer_reply === true,
3419
3542
  canSendCustomerReply: customerReplyPolicy.canSendCustomerReply === true || customerReplyPolicy.can_send_customer_reply === true,
3420
3543
  reason: cleanText(customerReplyPolicy.reason, 1000),
3421
- reviewType: cleanText(((_31 = customerReplyPolicy.humanReviewPacket) === null || _31 === void 0 ? void 0 : _31.reviewType)
3422
- || ((_32 = customerReplyPolicy.human_review_packet) === null || _32 === void 0 ? void 0 : _32.review_type)
3423
- || ((_33 = customerReplyPolicy.human_review_packet) === null || _33 === void 0 ? void 0 : _33.reviewType), 160),
3424
- primaryAction: cleanText(((_34 = customerReplyPolicy.humanReviewPacket) === null || _34 === void 0 ? void 0 : _34.primaryAction)
3425
- || ((_35 = customerReplyPolicy.human_review_packet) === null || _35 === void 0 ? void 0 : _35.primary_action)
3426
- || ((_36 = customerReplyPolicy.human_review_packet) === null || _36 === void 0 ? void 0 : _36.primaryAction), 160),
3544
+ reviewType: cleanText(((_38 = customerReplyPolicy.humanReviewPacket) === null || _38 === void 0 ? void 0 : _38.reviewType)
3545
+ || ((_39 = customerReplyPolicy.human_review_packet) === null || _39 === void 0 ? void 0 : _39.review_type)
3546
+ || ((_40 = customerReplyPolicy.human_review_packet) === null || _40 === void 0 ? void 0 : _40.reviewType), 160),
3547
+ primaryAction: cleanText(((_41 = customerReplyPolicy.humanReviewPacket) === null || _41 === void 0 ? void 0 : _41.primaryAction)
3548
+ || ((_42 = customerReplyPolicy.human_review_packet) === null || _42 === void 0 ? void 0 : _42.primary_action)
3549
+ || ((_43 = customerReplyPolicy.human_review_packet) === null || _43 === void 0 ? void 0 : _43.primaryAction), 160),
3427
3550
  clarificationContract: customerReplyPolicy.clarificationContract || customerReplyPolicy.clarification_contract ? {
3428
- status: cleanText(((_37 = customerReplyPolicy.clarificationContract) === null || _37 === void 0 ? void 0 : _37.status) || ((_38 = customerReplyPolicy.clarification_contract) === null || _38 === void 0 ? void 0 : _38.status), 120),
3429
- missingField: cleanText(((_39 = customerReplyPolicy.clarificationContract) === null || _39 === void 0 ? void 0 : _39.missingField) || ((_40 = customerReplyPolicy.clarification_contract) === null || _40 === void 0 ? void 0 : _40.missing_field), 120),
3430
- oneQuestionOnly: ((_41 = customerReplyPolicy.clarificationContract) === null || _41 === void 0 ? void 0 : _41.oneQuestionOnly) === true || ((_42 = customerReplyPolicy.clarification_contract) === null || _42 === void 0 ? void 0 : _42.one_question_only) === true,
3431
- parksTicketUntilCustomerReply: ((_43 = customerReplyPolicy.clarificationContract) === null || _43 === void 0 ? void 0 : _43.parksTicketUntilCustomerReply) === true || ((_44 = customerReplyPolicy.clarification_contract) === null || _44 === void 0 ? void 0 : _44.parks_ticket_until_customer_reply) === true
3551
+ status: cleanText(((_44 = customerReplyPolicy.clarificationContract) === null || _44 === void 0 ? void 0 : _44.status) || ((_45 = customerReplyPolicy.clarification_contract) === null || _45 === void 0 ? void 0 : _45.status), 120),
3552
+ missingField: cleanText(((_46 = customerReplyPolicy.clarificationContract) === null || _46 === void 0 ? void 0 : _46.missingField) || ((_47 = customerReplyPolicy.clarification_contract) === null || _47 === void 0 ? void 0 : _47.missing_field), 120),
3553
+ oneQuestionOnly: ((_48 = customerReplyPolicy.clarificationContract) === null || _48 === void 0 ? void 0 : _48.oneQuestionOnly) === true || ((_49 = customerReplyPolicy.clarification_contract) === null || _49 === void 0 ? void 0 : _49.one_question_only) === true,
3554
+ parksTicketUntilCustomerReply: ((_50 = customerReplyPolicy.clarificationContract) === null || _50 === void 0 ? void 0 : _50.parksTicketUntilCustomerReply) === true || ((_51 = customerReplyPolicy.clarification_contract) === null || _51 === void 0 ? void 0 : _51.parks_ticket_until_customer_reply) === true
3432
3555
  } : undefined
3556
+ } : undefined,
3557
+ customerReplyReadiness: customerReplyReadinessGate ? {
3558
+ status: cleanText((_52 = customerReplyReadinessGate.metadata) === null || _52 === void 0 ? void 0 : _52.status, 120),
3559
+ gateStatus: customerReplyReadinessGate.status,
3560
+ primaryCommand: cleanText((_53 = customerReplyReadinessGate.metadata) === null || _53 === void 0 ? void 0 : _53.primaryCommand, 180),
3561
+ policyAction: cleanText((_54 = customerReplyReadinessGate.metadata) === null || _54 === void 0 ? void 0 : _54.policyAction, 120),
3562
+ canDraftCustomerReply: ((_55 = customerReplyReadinessGate.metadata) === null || _55 === void 0 ? void 0 : _55.canDraftCustomerReply) === true,
3563
+ canSendCustomerReply: ((_56 = customerReplyReadinessGate.metadata) === null || _56 === void 0 ? void 0 : _56.canSendCustomerReply) === true,
3564
+ requiresHumanApproval: ((_57 = customerReplyReadinessGate.metadata) === null || _57 === void 0 ? void 0 : _57.requiresHumanApproval) === true,
3565
+ proofBacked: ((_58 = customerReplyReadinessGate.metadata) === null || _58 === void 0 ? void 0 : _58.proofBacked) === true,
3566
+ businessProofReady: ((_59 = customerReplyReadinessGate.metadata) === null || _59 === void 0 ? void 0 : _59.businessProofReady) === true,
3567
+ releaseReady: ((_60 = customerReplyReadinessGate.metadata) === null || _60 === void 0 ? void 0 : _60.releaseReady) === true,
3568
+ blockers: cleanStringList((_61 = customerReplyReadinessGate.metadata) === null || _61 === void 0 ? void 0 : _61.blockers, 20, 500)
3433
3569
  } : undefined
3434
3570
  }
3435
3571
  });