@resolveio/server-lib 22.3.170 → 22.3.172
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 +1 -1
- package/util/ai-run-evidence-adapters.js +126 -26
- package/util/ai-run-evidence-adapters.js.map +1 -1
- package/util/ai-runner-manager-policy.js +10 -10
- package/util/ai-runner-manager-policy.js.map +1 -1
- package/util/support-runner-v5.d.ts +44 -0
- package/util/support-runner-v5.js +250 -17
- package/util/support-runner-v5.js.map +1 -1
package/package.json
CHANGED
|
@@ -1604,6 +1604,59 @@ function supportNextActionContractGate(contract, now) {
|
|
|
1604
1604
|
metadata: __assign(__assign({}, metadata), { blockers: blockers, missingSafetyFlags: missingSafetyFlags })
|
|
1605
1605
|
};
|
|
1606
1606
|
}
|
|
1607
|
+
function supportDiagnosisEvidencePackObject(ticket, job, evidence) {
|
|
1608
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
1609
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
1610
|
+
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);
|
|
1611
|
+
}
|
|
1612
|
+
function supportSimilarFixHintsObject(ticket, job, evidence) {
|
|
1613
|
+
var ticketAutomation = plainObject(ticket.automation);
|
|
1614
|
+
var ticketManager = plainObject(ticketAutomation.manager || ticket.manager);
|
|
1615
|
+
return evidenceObject(job.supportRootCauseSimilarFixHints, job.support_root_cause_similar_fix_hints, job.similarFixHints, job.similar_fix_hints, evidence.supportRootCauseSimilarFixHints, evidence.support_root_cause_similar_fix_hints, evidence.similarFixHints, evidence.similar_fix_hints, ticket.supportRootCauseSimilarFixHints, ticket.support_root_cause_similar_fix_hints, ticketManager.rootCauseSimilarFixHints, ticketManager.root_cause_similar_fix_hints);
|
|
1616
|
+
}
|
|
1617
|
+
function supportDiagnosisEvidencePackGate(pack, now) {
|
|
1618
|
+
if (!pack || !Object.keys(pack).length) {
|
|
1619
|
+
return undefined;
|
|
1620
|
+
}
|
|
1621
|
+
var statusText = cleanText(pack.status, 120);
|
|
1622
|
+
var diagnosisValid = pack.diagnosisValid === true || pack.diagnosis_valid === true;
|
|
1623
|
+
var validationBlockers = cleanStringList(pack.validationBlockers || pack.validation_blockers, 40, 500);
|
|
1624
|
+
var similarSelection = plainObject(pack.similarCaseSelection || pack.similar_case_selection);
|
|
1625
|
+
var rankedHints = asArray(similarSelection.ranked);
|
|
1626
|
+
var gateStatus = diagnosisValid || statusText === 'diagnosis_ready'
|
|
1627
|
+
? 'pass'
|
|
1628
|
+
: statusText === 'blocked'
|
|
1629
|
+
? 'blocked'
|
|
1630
|
+
: 'warn';
|
|
1631
|
+
return {
|
|
1632
|
+
key: 'support_diagnosis_evidence_pack',
|
|
1633
|
+
label: 'Support diagnosis evidence pack',
|
|
1634
|
+
status: gateStatus,
|
|
1635
|
+
reason: gateStatus === 'pass'
|
|
1636
|
+
? 'Support diagnosis evidence pack has a valid root-cause diagnosis and advisory similar-fix context.'
|
|
1637
|
+
: validationBlockers.join('; ') || 'Support diagnosis evidence pack requires read-only root-cause evidence before repair.',
|
|
1638
|
+
evidenceRefs: cleanStringList(pack.requiredEvidence || pack.required_evidence, 30, 500),
|
|
1639
|
+
recordedAt: isoNow(now || pack.generatedAt || pack.generated_at),
|
|
1640
|
+
metadata: {
|
|
1641
|
+
packId: cleanText(pack.packId || pack.pack_id, 180),
|
|
1642
|
+
status: statusText,
|
|
1643
|
+
readOnly: pack.readOnly !== false && pack.read_only !== false,
|
|
1644
|
+
sourceEditsAllowed: pack.sourceEditsAllowed === true || pack.source_edits_allowed === true,
|
|
1645
|
+
rootCauseFirstRequired: pack.rootCauseFirstRequired !== false && pack.root_cause_first_required !== false,
|
|
1646
|
+
requiredOutputKey: cleanText(pack.requiredOutputKey || pack.required_output_key, 120),
|
|
1647
|
+
requiredFields: cleanStringList(pack.requiredFields || pack.required_fields, 20, 160),
|
|
1648
|
+
forbiddenActions: cleanStringList(pack.forbiddenActions || pack.forbidden_actions, 20, 500),
|
|
1649
|
+
diagnosisValid: diagnosisValid,
|
|
1650
|
+
diagnosisStatus: cleanText(pack.diagnosisStatus || pack.diagnosis_status, 120),
|
|
1651
|
+
validationBlockers: validationBlockers,
|
|
1652
|
+
issueClassHint: cleanText(pack.issueClassHint || pack.issue_class_hint, 120),
|
|
1653
|
+
ownerFileHints: cleanStringList(pack.ownerFileHints || pack.owner_file_hints, 20, 500),
|
|
1654
|
+
similarHintCount: rankedHints.length,
|
|
1655
|
+
similarHintsAdvisoryOnly: true,
|
|
1656
|
+
issueClassProbeCount: asArray(pack.issueClassProbeCatalog || pack.issue_class_probe_catalog).length
|
|
1657
|
+
}
|
|
1658
|
+
};
|
|
1659
|
+
}
|
|
1607
1660
|
function firstNonEmptyText(values, max) {
|
|
1608
1661
|
var e_26, _a;
|
|
1609
1662
|
if (max === void 0) { max = 1000; }
|
|
@@ -2218,7 +2271,7 @@ function applyAssistantAnswerQualityGate(qa, decision, now) {
|
|
|
2218
2271
|
}
|
|
2219
2272
|
function buildSupportAIRunFromEvidence(input) {
|
|
2220
2273
|
var e_28, _a, e_29, _b;
|
|
2221
|
-
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;
|
|
2274
|
+
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;
|
|
2222
2275
|
var ticket = input.ticket || {};
|
|
2223
2276
|
var job = input.job || {};
|
|
2224
2277
|
var evidence = buildSupportQaEvidence(input);
|
|
@@ -2230,8 +2283,8 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
2230
2283
|
addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
|
|
2231
2284
|
addSourceId(sourceIds, 'buildPlanId', job.buildPlanId || ticket.buildPlanId);
|
|
2232
2285
|
try {
|
|
2233
|
-
for (var
|
|
2234
|
-
var event_1 =
|
|
2286
|
+
for (var _24 = __values(asArray(input.taskEvents)), _25 = _24.next(); !_25.done; _25 = _24.next()) {
|
|
2287
|
+
var event_1 = _25.value;
|
|
2235
2288
|
pushEvent(events, {
|
|
2236
2289
|
type: event_1.type === 'human_intervention' ? 'human_intervention' : 'log',
|
|
2237
2290
|
category: cleanText(event_1.category || event_1.phase || event_1.type, 160),
|
|
@@ -2248,13 +2301,13 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
2248
2301
|
catch (e_28_1) { e_28 = { error: e_28_1 }; }
|
|
2249
2302
|
finally {
|
|
2250
2303
|
try {
|
|
2251
|
-
if (
|
|
2304
|
+
if (_25 && !_25.done && (_a = _24.return)) _a.call(_24);
|
|
2252
2305
|
}
|
|
2253
2306
|
finally { if (e_28) throw e_28.error; }
|
|
2254
2307
|
}
|
|
2255
2308
|
try {
|
|
2256
|
-
for (var
|
|
2257
|
-
var aiJob =
|
|
2309
|
+
for (var _26 = __values(asArray(input.aiJobs)), _27 = _26.next(); !_27.done; _27 = _26.next()) {
|
|
2310
|
+
var aiJob = _27.value;
|
|
2258
2311
|
pushEvent(events, {
|
|
2259
2312
|
type: aiJob.model ? 'model_call' : 'log',
|
|
2260
2313
|
category: cleanText(aiJob.category || aiJob.phase || aiJob.runner, 160),
|
|
@@ -2272,7 +2325,7 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
2272
2325
|
catch (e_29_1) { e_29 = { error: e_29_1 }; }
|
|
2273
2326
|
finally {
|
|
2274
2327
|
try {
|
|
2275
|
-
if (
|
|
2328
|
+
if (_27 && !_27.done && (_b = _26.return)) _b.call(_26);
|
|
2276
2329
|
}
|
|
2277
2330
|
finally { if (e_29) throw e_29.error; }
|
|
2278
2331
|
}
|
|
@@ -2346,6 +2399,38 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
2346
2399
|
}
|
|
2347
2400
|
var cost = collectUsageEvents(asArray(input.usageLedger), events);
|
|
2348
2401
|
var diagnosisGate = evidenceObject(job.supportV5DiagnosisGate, job.support_v5_diagnosis_gate, job.diagnosisGate, ticket.supportV5DiagnosisGate, ticket.diagnosisGate, evidence.diagnosisGate, evidence.supportV5DiagnosisGate);
|
|
2402
|
+
var diagnosisEvidencePackSource = supportDiagnosisEvidencePackObject(ticket, job, evidence);
|
|
2403
|
+
var similarFixHints = supportSimilarFixHintsObject(ticket, job, evidence);
|
|
2404
|
+
var diagnosisEvidencePack = Object.keys(diagnosisEvidencePackSource).length
|
|
2405
|
+
? diagnosisEvidencePackSource
|
|
2406
|
+
: (Object.keys(diagnosisGate).length || Object.keys(similarFixHints).length)
|
|
2407
|
+
? (0, support_runner_v5_1.buildResolveIOSupportDiagnosisEvidencePack)({
|
|
2408
|
+
diagnosisGate: diagnosisGate,
|
|
2409
|
+
similarCaseHints: similarFixHints,
|
|
2410
|
+
issueClass: diagnosisGate.issue_class || diagnosisGate.issueClass,
|
|
2411
|
+
ownerFiles: diagnosisGate.owner_files || diagnosisGate.ownerFiles,
|
|
2412
|
+
text: [
|
|
2413
|
+
ticket.title,
|
|
2414
|
+
ticket.subject,
|
|
2415
|
+
ticket.summary,
|
|
2416
|
+
job.title,
|
|
2417
|
+
job.summary
|
|
2418
|
+
].filter(Boolean).join(' '),
|
|
2419
|
+
now: input.now
|
|
2420
|
+
})
|
|
2421
|
+
: {};
|
|
2422
|
+
var diagnosisEvidencePackGate = supportDiagnosisEvidencePackGate(diagnosisEvidencePack, input.now);
|
|
2423
|
+
if (diagnosisEvidencePackGate) {
|
|
2424
|
+
gates.push(diagnosisEvidencePackGate);
|
|
2425
|
+
pushEvent(events, {
|
|
2426
|
+
type: 'log',
|
|
2427
|
+
category: 'support_diagnosis_evidence_pack',
|
|
2428
|
+
message: diagnosisEvidencePackGate.reason,
|
|
2429
|
+
artifactPaths: diagnosisEvidencePackGate.evidenceRefs,
|
|
2430
|
+
recordedAt: diagnosisEvidencePackGate.recordedAt,
|
|
2431
|
+
metadata: diagnosisEvidencePackGate.metadata
|
|
2432
|
+
});
|
|
2433
|
+
}
|
|
2349
2434
|
var productRepairEvidence = supportProductRepairEvidence(input, evidence);
|
|
2350
2435
|
var diagnosisBeforeRepairGate = supportDiagnosisBeforeRepairGate(diagnosisGate, productRepairEvidence, input.now);
|
|
2351
2436
|
if (diagnosisBeforeRepairGate) {
|
|
@@ -2426,6 +2511,21 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
2426
2511
|
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),
|
|
2427
2512
|
proofPlan: diagnosisGate.proof_plan || diagnosisGate.proofPlan
|
|
2428
2513
|
} : undefined,
|
|
2514
|
+
diagnosisEvidencePack: diagnosisEvidencePackGate ? {
|
|
2515
|
+
status: cleanText((_t = diagnosisEvidencePackGate.metadata) === null || _t === void 0 ? void 0 : _t.status, 120),
|
|
2516
|
+
gateStatus: diagnosisEvidencePackGate.status,
|
|
2517
|
+
packId: cleanText((_u = diagnosisEvidencePackGate.metadata) === null || _u === void 0 ? void 0 : _u.packId, 180),
|
|
2518
|
+
readOnly: ((_v = diagnosisEvidencePackGate.metadata) === null || _v === void 0 ? void 0 : _v.readOnly) !== false,
|
|
2519
|
+
sourceEditsAllowed: ((_w = diagnosisEvidencePackGate.metadata) === null || _w === void 0 ? void 0 : _w.sourceEditsAllowed) === true,
|
|
2520
|
+
requiredOutputKey: cleanText((_x = diagnosisEvidencePackGate.metadata) === null || _x === void 0 ? void 0 : _x.requiredOutputKey, 120),
|
|
2521
|
+
diagnosisValid: ((_y = diagnosisEvidencePackGate.metadata) === null || _y === void 0 ? void 0 : _y.diagnosisValid) === true,
|
|
2522
|
+
issueClassHint: cleanText((_z = diagnosisEvidencePackGate.metadata) === null || _z === void 0 ? void 0 : _z.issueClassHint, 120),
|
|
2523
|
+
ownerFileHints: cleanStringList((_0 = diagnosisEvidencePackGate.metadata) === null || _0 === void 0 ? void 0 : _0.ownerFileHints, 20, 500),
|
|
2524
|
+
similarHintCount: Number(((_1 = diagnosisEvidencePackGate.metadata) === null || _1 === void 0 ? void 0 : _1.similarHintCount) || 0),
|
|
2525
|
+
similarHintsAdvisoryOnly: ((_2 = diagnosisEvidencePackGate.metadata) === null || _2 === void 0 ? void 0 : _2.similarHintsAdvisoryOnly) === true,
|
|
2526
|
+
issueClassProbeCount: Number(((_3 = diagnosisEvidencePackGate.metadata) === null || _3 === void 0 ? void 0 : _3.issueClassProbeCount) || 0),
|
|
2527
|
+
validationBlockers: cleanStringList((_4 = diagnosisEvidencePackGate.metadata) === null || _4 === void 0 ? void 0 : _4.validationBlockers, 20, 500)
|
|
2528
|
+
} : undefined,
|
|
2429
2529
|
businessProofReadiness: Object.keys(businessProofReadiness).length ? {
|
|
2430
2530
|
ready: businessProofReadiness.ready === true,
|
|
2431
2531
|
status: cleanText(businessProofReadiness.status, 120),
|
|
@@ -2434,19 +2534,19 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
2434
2534
|
} : undefined,
|
|
2435
2535
|
nextActionContract: nextActionContractGate ? {
|
|
2436
2536
|
status: nextActionContractGate.status,
|
|
2437
|
-
action: cleanText((
|
|
2438
|
-
primaryCommand: cleanText((
|
|
2439
|
-
safeToAutoRun: ((
|
|
2440
|
-
canRunWithoutCodexMonitor: ((
|
|
2441
|
-
codexFallbackRequired: ((
|
|
2442
|
-
requiresHumanApproval: ((
|
|
2443
|
-
rootCauseFirstSatisfied: ((
|
|
2444
|
-
hotfixCommitRequired: ((
|
|
2445
|
-
liveHotfixBlockedUntilCommit: ((
|
|
2446
|
-
failureClass: cleanText((
|
|
2447
|
-
evidenceFreshnessStatus: cleanText((
|
|
2448
|
-
sameFailureCount: Number(((
|
|
2449
|
-
blockers: cleanStringList((
|
|
2537
|
+
action: cleanText((_5 = nextActionContractGate.metadata) === null || _5 === void 0 ? void 0 : _5.action, 160),
|
|
2538
|
+
primaryCommand: cleanText((_6 = nextActionContractGate.metadata) === null || _6 === void 0 ? void 0 : _6.primaryCommand, 240),
|
|
2539
|
+
safeToAutoRun: ((_7 = nextActionContractGate.metadata) === null || _7 === void 0 ? void 0 : _7.safeToAutoRun) === true,
|
|
2540
|
+
canRunWithoutCodexMonitor: ((_8 = nextActionContractGate.metadata) === null || _8 === void 0 ? void 0 : _8.canRunWithoutCodexMonitor) === true,
|
|
2541
|
+
codexFallbackRequired: ((_9 = nextActionContractGate.metadata) === null || _9 === void 0 ? void 0 : _9.codexFallbackRequired) === true,
|
|
2542
|
+
requiresHumanApproval: ((_10 = nextActionContractGate.metadata) === null || _10 === void 0 ? void 0 : _10.requiresHumanApproval) === true,
|
|
2543
|
+
rootCauseFirstSatisfied: ((_11 = nextActionContractGate.metadata) === null || _11 === void 0 ? void 0 : _11.rootCauseFirstSatisfied) === true,
|
|
2544
|
+
hotfixCommitRequired: ((_12 = nextActionContractGate.metadata) === null || _12 === void 0 ? void 0 : _12.hotfixCommitRequired) === true,
|
|
2545
|
+
liveHotfixBlockedUntilCommit: ((_13 = nextActionContractGate.metadata) === null || _13 === void 0 ? void 0 : _13.liveHotfixBlockedUntilCommit) === true,
|
|
2546
|
+
failureClass: cleanText((_14 = nextActionContractGate.metadata) === null || _14 === void 0 ? void 0 : _14.failureClass, 120),
|
|
2547
|
+
evidenceFreshnessStatus: cleanText((_15 = nextActionContractGate.metadata) === null || _15 === void 0 ? void 0 : _15.evidenceFreshnessStatus, 120),
|
|
2548
|
+
sameFailureCount: Number(((_16 = nextActionContractGate.metadata) === null || _16 === void 0 ? void 0 : _16.sameFailureCount) || 0),
|
|
2549
|
+
blockers: cleanStringList((_17 = nextActionContractGate.metadata) === null || _17 === void 0 ? void 0 : _17.blockers, 20, 500)
|
|
2450
2550
|
} : undefined,
|
|
2451
2551
|
customerReplyPolicy: Object.keys(customerReplyPolicy).length ? {
|
|
2452
2552
|
action: cleanText(customerReplyPolicy.action, 120),
|
|
@@ -2454,12 +2554,12 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
2454
2554
|
canDraftCustomerReply: customerReplyPolicy.canDraftCustomerReply === true || customerReplyPolicy.can_draft_customer_reply === true,
|
|
2455
2555
|
canSendCustomerReply: customerReplyPolicy.canSendCustomerReply === true || customerReplyPolicy.can_send_customer_reply === true,
|
|
2456
2556
|
reason: cleanText(customerReplyPolicy.reason, 1000),
|
|
2457
|
-
reviewType: cleanText(((
|
|
2458
|
-
|| ((
|
|
2459
|
-
|| ((
|
|
2460
|
-
primaryAction: cleanText(((
|
|
2461
|
-
|| ((
|
|
2462
|
-
|| ((
|
|
2557
|
+
reviewType: cleanText(((_18 = customerReplyPolicy.humanReviewPacket) === null || _18 === void 0 ? void 0 : _18.reviewType)
|
|
2558
|
+
|| ((_19 = customerReplyPolicy.human_review_packet) === null || _19 === void 0 ? void 0 : _19.review_type)
|
|
2559
|
+
|| ((_20 = customerReplyPolicy.human_review_packet) === null || _20 === void 0 ? void 0 : _20.reviewType), 160),
|
|
2560
|
+
primaryAction: cleanText(((_21 = customerReplyPolicy.humanReviewPacket) === null || _21 === void 0 ? void 0 : _21.primaryAction)
|
|
2561
|
+
|| ((_22 = customerReplyPolicy.human_review_packet) === null || _22 === void 0 ? void 0 : _22.primary_action)
|
|
2562
|
+
|| ((_23 = customerReplyPolicy.human_review_packet) === null || _23 === void 0 ? void 0 : _23.primaryAction), 160)
|
|
2463
2563
|
} : undefined
|
|
2464
2564
|
}
|
|
2465
2565
|
});
|