@resolveio/server-lib 22.3.177 → 22.3.178

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.178",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -232,6 +232,28 @@ export interface ResolveIOSupportIssueClassProbe {
232
232
  };
233
233
  acceptance_gate: 'aiqa_business_assertion';
234
234
  blocks_acceptance_without_business_assertion: boolean;
235
+ false_pass_blockers?: string[];
236
+ }
237
+ export type ResolveIOSupportIssueClassProbePlanStatus = 'missing' | 'incomplete' | 'ready';
238
+ export interface ResolveIOSupportIssueClassProbePlan {
239
+ planId: string;
240
+ status: ResolveIOSupportIssueClassProbePlanStatus;
241
+ issue_class?: ResolveIOSupportIssueClass;
242
+ diagnosisValid: boolean;
243
+ probes: ResolveIOSupportIssueClassProbe[];
244
+ activeProbe?: ResolveIOSupportIssueClassProbe;
245
+ requiredArtifacts: string[];
246
+ acceptanceGate: 'aiqa_business_assertion';
247
+ falsePassBlockers: string[];
248
+ blockers: string[];
249
+ generatedAt: string;
250
+ }
251
+ export interface ResolveIOSupportIssueClassProbePlanValidation {
252
+ valid: boolean;
253
+ status: ResolveIOSupportIssueClassProbePlanStatus;
254
+ blockers: string[];
255
+ normalized?: ResolveIOSupportIssueClassProbePlan;
256
+ activeProbe?: ResolveIOSupportIssueClassProbe;
235
257
  }
236
258
  export interface ResolveIOSupportBusinessProofAssertion {
237
259
  assertion: string;
@@ -483,6 +505,7 @@ export interface ResolveIOSupportV5StateBundle {
483
505
  supportV5SupervisorState: ResolveIOSupportV5SupervisorState;
484
506
  supportV5DiagnosisGate?: ResolveIOSupportDiagnosisGate;
485
507
  supportV5DiagnosisEvidencePack?: ResolveIOSupportDiagnosisEvidencePack;
508
+ supportV5IssueClassProbePlan?: ResolveIOSupportIssueClassProbePlan;
486
509
  supportV5LaneMemory: {
487
510
  build: ResolveIOSupportV5LaneMemory;
488
511
  qa: ResolveIOSupportV5LaneMemory;
@@ -581,12 +604,14 @@ export interface ResolveIOSupportRootCauseReadiness {
581
604
  canRelease: boolean;
582
605
  canDraftCustomerReply: boolean;
583
606
  requiresHumanDecision: boolean;
607
+ issueClassProbePlanReady: boolean;
584
608
  reason: string;
585
609
  blockers: string[];
586
610
  ownerFiles: string[];
587
611
  issueClass?: ResolveIOSupportIssueClass;
588
612
  expectedProof?: string;
589
613
  issueClassProbes?: ResolveIOSupportIssueClassProbe[];
614
+ issueClassProbePlan?: ResolveIOSupportIssueClassProbePlan;
590
615
  businessProofStatus?: ResolveIOSupportBusinessProofReadiness['status'];
591
616
  proofFingerprint?: string;
592
617
  artifactFingerprint?: string;
@@ -618,6 +643,7 @@ export interface ResolveIOSupportNextActionContract {
618
643
  blockerFingerprint: string;
619
644
  evidenceHash: string;
620
645
  sameFailureCount: number;
646
+ issueClassProbePlanReady: boolean;
621
647
  hotfixCommitRequired: boolean;
622
648
  liveHotfixBlockedUntilCommit: boolean;
623
649
  };
@@ -679,6 +705,8 @@ export interface ResolveIOSupportV5AutonomousDecision {
679
705
  issueClass?: ResolveIOSupportIssueClass;
680
706
  expectedProof?: string;
681
707
  issueClassProbes: ResolveIOSupportIssueClassProbe[];
708
+ issueClassProbePlan?: ResolveIOSupportIssueClassProbePlan;
709
+ issueClassProbePlanValidation: ResolveIOSupportIssueClassProbePlanValidation;
682
710
  activeMicrotask?: ResolveIOSupportV5Microtask;
683
711
  diagnosisValidation: ResolveIOSupportDiagnosisGateValidation;
684
712
  repairGate: ResolveIOSupportV5RepairGateDecision;
@@ -704,6 +732,8 @@ export declare function validateResolveIOSupportDiagnosisGate(value: any, option
704
732
  export declare function evaluateResolveIOSupportBusinessProofReadiness(input?: ResolveIOSupportBusinessProofReadinessInput): ResolveIOSupportBusinessProofReadiness;
705
733
  export declare function decideResolveIOSupportCustomerReplyPolicy(input?: ResolveIOSupportCustomerReplyPolicyInput): ResolveIOSupportCustomerReplyPolicy;
706
734
  export declare function buildResolveIOSupportIssueClassProbes(value: any): ResolveIOSupportIssueClassProbe[];
735
+ export declare function validateResolveIOSupportIssueClassProbePlan(value: any, diagnosisGate?: any, now?: Date | string): ResolveIOSupportIssueClassProbePlanValidation;
736
+ export declare function buildResolveIOSupportIssueClassProbePlan(diagnosisGate: any, now?: Date | string): ResolveIOSupportIssueClassProbePlan;
707
737
  export declare function hashResolveIOSupportV5Evidence(value: any): string;
708
738
  export declare function decideResolveIOSupportV5RepeatedFailureStop(input: ResolveIOSupportV5RepeatStopInput): ResolveIOSupportV5RepeatStopDecision;
709
739
  export declare function evaluateResolveIOSupportEvidenceFreshness(input: {
@@ -778,6 +808,7 @@ export declare function buildResolveIOSupportV5MicrotaskPrompt(input: {
778
808
  contextSnippets?: string[];
779
809
  similarCaseHints?: any;
780
810
  activeQaRow?: ResolveIOSupportV5LaneMemory['activeQaRow'];
811
+ now?: Date | string;
781
812
  }): {
782
813
  prompt: string;
783
814
  promptTokenEstimate: number;
@@ -56,6 +56,8 @@ exports.validateResolveIOSupportDiagnosisGate = validateResolveIOSupportDiagnosi
56
56
  exports.evaluateResolveIOSupportBusinessProofReadiness = evaluateResolveIOSupportBusinessProofReadiness;
57
57
  exports.decideResolveIOSupportCustomerReplyPolicy = decideResolveIOSupportCustomerReplyPolicy;
58
58
  exports.buildResolveIOSupportIssueClassProbes = buildResolveIOSupportIssueClassProbes;
59
+ exports.validateResolveIOSupportIssueClassProbePlan = validateResolveIOSupportIssueClassProbePlan;
60
+ exports.buildResolveIOSupportIssueClassProbePlan = buildResolveIOSupportIssueClassProbePlan;
59
61
  exports.hashResolveIOSupportV5Evidence = hashResolveIOSupportV5Evidence;
60
62
  exports.decideResolveIOSupportV5RepeatedFailureStop = decideResolveIOSupportV5RepeatedFailureStop;
61
63
  exports.evaluateResolveIOSupportEvidenceFreshness = evaluateResolveIOSupportEvidenceFreshness;
@@ -1646,10 +1648,193 @@ function buildResolveIOSupportIssueClassProbes(value) {
1646
1648
  }
1647
1649
  };
1648
1650
  var selected = map[gate.issue_class];
1651
+ var catalog = SUPPORT_ISSUE_CLASS_PROBE_CATALOG.find(function (entry) { return entry.issue_class === gate.issue_class; });
1649
1652
  var requiredArtifacts = Array.from(new Set(__spreadArray(__spreadArray([], __read(contractArtifacts), false), __read(selected.requiredArtifacts), false)));
1650
1653
  return [__assign(__assign({}, common), { failure_class: selected.failureClass, objective: "Issue-class probe for ".concat(gate.issue_class, ": ").concat(gate.issue_case.customer_complaint), action: proofContract
1651
1654
  ? "".concat(proofContract.action_under_test, " ").concat(selected.action)
1652
- : selected.action, expected_evidence: "".concat(selected.expected).concat(assertion ? " Assertion: ".concat(assertion, ".") : '').concat(requiredArtifacts.length ? " Required artifacts: ".concat(requiredArtifacts.join(', '), ".") : '').trim(), expected_business_proof: proof || gate.proof_plan.business_assertion, required_artifacts: requiredArtifacts })];
1655
+ : selected.action, expected_evidence: "".concat(selected.expected).concat(assertion ? " Assertion: ".concat(assertion, ".") : '').concat(requiredArtifacts.length ? " Required artifacts: ".concat(requiredArtifacts.join(', '), ".") : '').trim(), expected_business_proof: proof || gate.proof_plan.business_assertion, required_artifacts: requiredArtifacts, false_pass_blockers: (catalog === null || catalog === void 0 ? void 0 : catalog.false_pass_blockers) || [
1656
+ 'route loaded only',
1657
+ 'screenshot without business state proof',
1658
+ 'model claim without DOM/data proof'
1659
+ ] })];
1660
+ }
1661
+ function normalizeResolveIOSupportIssueClassProbe(value, diagnosisGate) {
1662
+ var source = cleanObject(value);
1663
+ if (!Object.keys(source).length) {
1664
+ return undefined;
1665
+ }
1666
+ var issueClass = normalizeIssueClass(source.issue_class || source.issueClass || (diagnosisGate === null || diagnosisGate === void 0 ? void 0 : diagnosisGate.issue_class));
1667
+ var stateTransition = cleanObject(source.state_transition || source.stateTransition);
1668
+ var route = cleanText(source.route, 500);
1669
+ var failureClass = cleanText(source.failure_class || source.failureClass || 'business', 80);
1670
+ return {
1671
+ issue_class: (issueClass || (diagnosisGate === null || diagnosisGate === void 0 ? void 0 : diagnosisGate.issue_class) || 'missing_wrong_data'),
1672
+ probe_type: (cleanText(source.probe_type || source.probeType, 80) || 'issue_class_probe'),
1673
+ failure_class: failureClass,
1674
+ objective: cleanText(source.objective, 1000),
1675
+ route: route,
1676
+ action: cleanText(source.action, 1200),
1677
+ expected_evidence: cleanText(source.expected_evidence || source.expectedEvidence, 1600),
1678
+ expected_business_proof: cleanText(source.expected_business_proof || source.expectedBusinessProof, 1600),
1679
+ required_artifacts: cleanList(source.required_artifacts || source.requiredArtifacts, 12, 220),
1680
+ state_transition: {
1681
+ before: cleanText(stateTransition.before, 800),
1682
+ action: cleanText(stateTransition.action, 800),
1683
+ after: cleanText(stateTransition.after, 800),
1684
+ assertion: cleanText(stateTransition.assertion, 1000)
1685
+ },
1686
+ acceptance_gate: cleanText(source.acceptance_gate || source.acceptanceGate, 120) === 'aiqa_business_assertion'
1687
+ ? 'aiqa_business_assertion'
1688
+ : 'aiqa_business_assertion',
1689
+ blocks_acceptance_without_business_assertion: source.blocks_acceptance_without_business_assertion !== false
1690
+ && source.blocksAcceptanceWithoutBusinessAssertion !== false,
1691
+ false_pass_blockers: cleanList(source.false_pass_blockers || source.falsePassBlockers, 8, 260)
1692
+ };
1693
+ }
1694
+ function validateResolveIOSupportIssueClassProbePlan(value, diagnosisGate, now) {
1695
+ var diagnosisValidation = validateResolveIOSupportDiagnosisGate(diagnosisGate);
1696
+ var normalizedDiagnosis = diagnosisValidation.normalized;
1697
+ var source = cleanObject(value);
1698
+ var rawProbes = Array.isArray(value)
1699
+ ? value
1700
+ : Array.isArray(source.probes)
1701
+ ? source.probes
1702
+ : Array.isArray(source.issueClassProbes)
1703
+ ? source.issueClassProbes
1704
+ : Array.isArray(source.issue_class_probes)
1705
+ ? source.issue_class_probes
1706
+ : source.activeProbe || source.active_probe
1707
+ ? [source.activeProbe || source.active_probe]
1708
+ : [];
1709
+ var probes = rawProbes
1710
+ .map(function (probe) { return normalizeResolveIOSupportIssueClassProbe(probe, normalizedDiagnosis); })
1711
+ .filter(function (probe) { return !!probe; });
1712
+ var activeProbe = probes[0] || normalizeResolveIOSupportIssueClassProbe(source.activeProbe || source.active_probe, normalizedDiagnosis);
1713
+ var issueClass = normalizeIssueClass(source.issue_class || source.issueClass || (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.issue_class) || (normalizedDiagnosis === null || normalizedDiagnosis === void 0 ? void 0 : normalizedDiagnosis.issue_class));
1714
+ var catalog = SUPPORT_ISSUE_CLASS_PROBE_CATALOG.find(function (entry) { return entry.issue_class === issueClass; });
1715
+ var planRequiredArtifacts = cleanList(source.requiredArtifacts || source.required_artifacts, 16, 220);
1716
+ var activeRequiredArtifacts = cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.required_artifacts, 16, 220);
1717
+ var requiredArtifacts = planRequiredArtifacts.length ? planRequiredArtifacts : activeRequiredArtifacts;
1718
+ var falsePassBlockers = cleanList(source.falsePassBlockers || source.false_pass_blockers, 12, 260).length
1719
+ ? cleanList(source.falsePassBlockers || source.false_pass_blockers, 12, 260)
1720
+ : cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.false_pass_blockers, 12, 260).length
1721
+ ? cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.false_pass_blockers, 12, 260)
1722
+ : ((catalog === null || catalog === void 0 ? void 0 : catalog.false_pass_blockers) || []);
1723
+ var blockers = [];
1724
+ if (!diagnosisValidation.valid || !normalizedDiagnosis) {
1725
+ blockers.push('Valid SupportDiagnosisGate is required before issue-class probe QA.');
1726
+ }
1727
+ if (!probes.length || !activeProbe) {
1728
+ blockers.push('Issue-class probe plan must include at least one active probe.');
1729
+ }
1730
+ if (!issueClass) {
1731
+ blockers.push('Issue-class probe plan must record a valid issue_class.');
1732
+ }
1733
+ if (normalizedDiagnosis && issueClass && issueClass !== normalizedDiagnosis.issue_class) {
1734
+ blockers.push("Issue-class probe plan issue_class ".concat(issueClass, " does not match diagnosis issue_class ").concat(normalizedDiagnosis.issue_class, "."));
1735
+ }
1736
+ if (activeProbe) {
1737
+ if (!cleanText(activeProbe.route, 500)) {
1738
+ blockers.push('Issue-class probe must include the exact route or module under test.');
1739
+ }
1740
+ if (!cleanText(activeProbe.action, 1200)) {
1741
+ blockers.push('Issue-class probe must include the exact action to perform.');
1742
+ }
1743
+ if (!cleanText(activeProbe.expected_evidence, 1600)) {
1744
+ blockers.push('Issue-class probe must include expected evidence.');
1745
+ }
1746
+ if (!cleanText(activeProbe.expected_business_proof, 1600)) {
1747
+ blockers.push('Issue-class probe must include expected business proof.');
1748
+ }
1749
+ if (!cleanText(activeProbe.state_transition.before, 800)) {
1750
+ blockers.push('Issue-class probe state_transition.before is required.');
1751
+ }
1752
+ if (!cleanText(activeProbe.state_transition.action, 800)) {
1753
+ blockers.push('Issue-class probe state_transition.action is required.');
1754
+ }
1755
+ if (!cleanText(activeProbe.state_transition.after, 800)) {
1756
+ blockers.push('Issue-class probe state_transition.after is required.');
1757
+ }
1758
+ if (!cleanText(activeProbe.state_transition.assertion, 1000)) {
1759
+ blockers.push('Issue-class probe state_transition.assertion is required.');
1760
+ }
1761
+ if (activeProbe.acceptance_gate !== 'aiqa_business_assertion') {
1762
+ blockers.push('Issue-class probe acceptance_gate must be aiqa_business_assertion.');
1763
+ }
1764
+ if (activeProbe.blocks_acceptance_without_business_assertion !== true) {
1765
+ blockers.push('Issue-class probe must block acceptance without AIQaBusinessAssertion.');
1766
+ }
1767
+ if (activeRequiredArtifacts.length < 2) {
1768
+ blockers.push('Active issue-class probe must require at least two proof artifacts.');
1769
+ }
1770
+ }
1771
+ if (requiredArtifacts.length < 2) {
1772
+ blockers.push('Issue-class probe plan must require at least two proof artifacts.');
1773
+ }
1774
+ if (!falsePassBlockers.length) {
1775
+ blockers.push('Issue-class probe plan must record false-pass blockers.');
1776
+ }
1777
+ var status = blockers.length
1778
+ ? (probes.length ? 'incomplete' : 'missing')
1779
+ : 'ready';
1780
+ var generatedAt = cleanText(source.generatedAt || source.generated_at, 120) || isoNow(now);
1781
+ var normalized = {
1782
+ planId: cleanText(source.planId || source.plan_id, 160) || "support-probe-plan-".concat(hashResolveIOSupportV5Evidence({
1783
+ issueClass: issueClass,
1784
+ route: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.route,
1785
+ action: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.action,
1786
+ expectedBusinessProof: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.expected_business_proof
1787
+ }).slice(0, 16)),
1788
+ status: status,
1789
+ issue_class: issueClass || undefined,
1790
+ diagnosisValid: diagnosisValidation.valid === true,
1791
+ probes: probes,
1792
+ activeProbe: activeProbe,
1793
+ requiredArtifacts: requiredArtifacts,
1794
+ acceptanceGate: 'aiqa_business_assertion',
1795
+ falsePassBlockers: falsePassBlockers,
1796
+ blockers: blockers,
1797
+ generatedAt: generatedAt
1798
+ };
1799
+ return {
1800
+ valid: blockers.length === 0,
1801
+ status: status,
1802
+ blockers: blockers,
1803
+ normalized: normalized,
1804
+ activeProbe: activeProbe
1805
+ };
1806
+ }
1807
+ function buildResolveIOSupportIssueClassProbePlan(diagnosisGate, now) {
1808
+ var _a, _b;
1809
+ var diagnosisValidation = validateResolveIOSupportDiagnosisGate(diagnosisGate);
1810
+ var probes = diagnosisValidation.valid && diagnosisValidation.normalized
1811
+ ? buildResolveIOSupportIssueClassProbes(diagnosisValidation.normalized)
1812
+ : [];
1813
+ var activeProbe = probes[0];
1814
+ var issueClass = ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.issue_class) || (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.issue_class);
1815
+ var catalog = SUPPORT_ISSUE_CLASS_PROBE_CATALOG.find(function (entry) { return entry.issue_class === issueClass; });
1816
+ var provisional = {
1817
+ planId: "support-probe-plan-".concat(hashResolveIOSupportV5Evidence({
1818
+ issueClass: issueClass,
1819
+ route: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.route,
1820
+ action: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.action,
1821
+ expectedBusinessProof: activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.expected_business_proof
1822
+ }).slice(0, 16)),
1823
+ status: 'incomplete',
1824
+ issue_class: issueClass,
1825
+ diagnosisValid: diagnosisValidation.valid === true,
1826
+ probes: probes,
1827
+ activeProbe: activeProbe,
1828
+ requiredArtifacts: cleanList(activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.required_artifacts, 16, 220),
1829
+ acceptanceGate: 'aiqa_business_assertion',
1830
+ falsePassBlockers: ((_b = activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.false_pass_blockers) === null || _b === void 0 ? void 0 : _b.length)
1831
+ ? activeProbe.false_pass_blockers
1832
+ : ((catalog === null || catalog === void 0 ? void 0 : catalog.false_pass_blockers) || []),
1833
+ blockers: [],
1834
+ generatedAt: isoNow(now)
1835
+ };
1836
+ var validation = validateResolveIOSupportIssueClassProbePlan(provisional, diagnosisValidation.normalized || diagnosisGate, now);
1837
+ return validation.normalized || __assign(__assign({}, provisional), { status: validation.status, blockers: validation.blockers });
1653
1838
  }
1654
1839
  function hashResolveIOSupportV5Evidence(value) {
1655
1840
  var raw = typeof value === 'string' ? value : JSON.stringify(value || {});
@@ -2103,17 +2288,22 @@ function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
2103
2288
  if (!gate) {
2104
2289
  return bundle;
2105
2290
  }
2291
+ var now = isoNow();
2106
2292
  var ownerFiles = gate.owner_files;
2107
2293
  var probes = buildResolveIOSupportIssueClassProbes(gate);
2294
+ var probePlan = buildResolveIOSupportIssueClassProbePlan(gate, now);
2295
+ var probePlanValidation = validateResolveIOSupportIssueClassProbePlan(probePlan, gate, now);
2108
2296
  var proofContract = gate.proof_plan.business_proof_contract;
2297
+ var activeProbe = probePlanValidation.activeProbe || probePlan.activeProbe || probes[0];
2109
2298
  var businessProof = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.expected_business_state_change) || gate.proof_plan.business_assertion;
2110
- var businessAssertion = (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion) || gate.proof_plan.data_assertion || gate.proof_plan.after;
2111
- var now = isoNow();
2299
+ var businessAssertion = (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.state_transition.assertion)
2300
+ || (proofContract === null || proofContract === void 0 ? void 0 : proofContract.data_or_dom_assertion)
2301
+ || gate.proof_plan.data_assertion
2302
+ || gate.proof_plan.after;
2112
2303
  var diagnosisMicrotaskId = ((_a = (bundle.supportV5MicrotaskLedger || [])
2113
2304
  .find(function (task) { return task.type === 'diagnosis_gate'; })) === null || _a === void 0 ? void 0 : _a.microtaskId)
2114
2305
  || stableIdFromText('diagnosis', "Root-cause-first diagnosis gate for: ".concat(cleanText(bundle.supportV5ScopeDigest || gate.issue_case.customer_complaint, 360) || 'support ticket'));
2115
2306
  var ledger = (bundle.supportV5MicrotaskLedger || []).map(function (task) {
2116
- var _a;
2117
2307
  if (task.type === 'diagnosis_gate') {
2118
2308
  return __assign(__assign({}, task), { status: validation.valid ? 'pass' : 'needs_repair', blocker: validation.valid ? '' : validation.blockers.join(' | '), updatedAt: now });
2119
2309
  }
@@ -2121,18 +2311,18 @@ function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
2121
2311
  return __assign(__assign({}, task), { targetFiles: ownerFiles, contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'owner_files'], false))), selfGate: "Repair only the diagnosed owner files unless you revise the diagnosis with new evidence. Owner files: ".concat(ownerFiles.join(', '), "."), acceptanceProof: businessProof, dependsOn: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.dependsOn || [])), false), [diagnosisMicrotaskId], false))), updatedAt: now });
2122
2312
  }
2123
2313
  if (task.lane === 'qa' && task.type === 'qa_row') {
2124
- return __assign(__assign({}, task), { contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'proof_plan'], false))), selfGate: ((_a = probes[0]) === null || _a === void 0 ? void 0 : _a.action) || task.selfGate, acceptanceProof: businessProof || task.acceptanceProof, targetFiles: ownerFiles, updatedAt: now });
2314
+ return __assign(__assign({}, task), { contextRefs: Array.from(new Set(__spreadArray(__spreadArray([], __read((task.contextRefs || [])), false), ['supportV5DiagnosisGate', 'supportV5IssueClassProbePlan', 'proof_plan'], false))), selfGate: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.action) || task.selfGate, acceptanceProof: (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.expected_business_proof) || businessProof || task.acceptanceProof, targetFiles: ownerFiles, updatedAt: now });
2125
2315
  }
2126
2316
  return task;
2127
2317
  });
2128
2318
  var nextActive = selectResolveIOSupportV5ActiveMicrotask(ledger, bundle.supportV5ActiveMicrotaskId);
2129
- return __assign(__assign({}, bundle), { supportV5DiagnosisGate: gate, supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextActive === null || nextActive === void 0 ? void 0 : nextActive.microtaskId, supportV5LaneMemory: __assign(__assign({}, bundle.supportV5LaneMemory), { build: __assign(__assign({}, bundle.supportV5LaneMemory.build), { changedFiles: ownerFiles, scopeSummary: [
2319
+ return __assign(__assign({}, bundle), { supportV5DiagnosisGate: gate, supportV5IssueClassProbePlan: probePlanValidation.normalized || probePlan, supportV5MicrotaskLedger: ledger, supportV5ActiveMicrotaskId: nextActive === null || nextActive === void 0 ? void 0 : nextActive.microtaskId, supportV5LaneMemory: __assign(__assign({}, bundle.supportV5LaneMemory), { build: __assign(__assign({}, bundle.supportV5LaneMemory.build), { changedFiles: ownerFiles, scopeSummary: [
2130
2320
  bundle.supportV5LaneMemory.build.scopeSummary,
2131
2321
  "Diagnosis issue class: ".concat(gate.issue_class),
2132
2322
  "Accepted hypothesis: ".concat(gate.accepted_hypothesis.statement),
2133
2323
  "Owner files: ".concat(ownerFiles.join(', '))
2134
2324
  ].filter(Boolean).join(' | '), updatedAt: now }), qa: __assign(__assign({}, bundle.supportV5LaneMemory.qa), { activeQaRow: {
2135
- workflow: (proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test) || gate.proof_plan.action,
2325
+ workflow: (proofContract === null || proofContract === void 0 ? void 0 : proofContract.action_under_test) || (activeProbe === null || activeProbe === void 0 ? void 0 : activeProbe.state_transition.action) || gate.proof_plan.action,
2136
2326
  route: gate.proof_plan.route || gate.issue_case.route_module,
2137
2327
  assertion: businessAssertion,
2138
2328
  status: 'pending'
@@ -2319,6 +2509,7 @@ function initializeResolveIOSupportV5State(input) {
2319
2509
  var budget = buildResolveIOSupportV5Budget(existing.supportV5Budget);
2320
2510
  var existingDiagnosisGate = normalizeResolveIOSupportDiagnosisGate(existing.supportV5DiagnosisGate);
2321
2511
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(existingDiagnosisGate);
2512
+ var existingProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(existing.supportV5IssueClassProbePlan || existing.support_v5_issue_class_probe_plan, diagnosisValidation.normalized || existingDiagnosisGate, now);
2322
2513
  var scopeDigest = cleanText(existing.supportV5ScopeDigest, 4000) || buildResolveIOSupportV5ScopeDigest({
2323
2514
  goal: (existingSupervisor === null || existingSupervisor === void 0 ? void 0 : existingSupervisor.currentGoal) || "Resolve support ticket ".concat(ticketLabel),
2324
2515
  approvedScope: scope,
@@ -2352,6 +2543,7 @@ function initializeResolveIOSupportV5State(input) {
2352
2543
  },
2353
2544
  supportV5DiagnosisGate: diagnosisValidation.valid ? diagnosisValidation.normalized : existingDiagnosisGate,
2354
2545
  supportV5DiagnosisEvidencePack: existing.supportV5DiagnosisEvidencePack || existing.support_v5_diagnosis_evidence_pack,
2546
+ supportV5IssueClassProbePlan: existingProbePlanValidation.normalized,
2355
2547
  supportV5LaneMemory: {
2356
2548
  build: {
2357
2549
  lane: 'build',
@@ -2657,9 +2849,18 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
2657
2849
  var issueClassProbes = diagnosisValidation.valid && diagnosisValidation.normalized
2658
2850
  ? buildResolveIOSupportIssueClassProbes(diagnosisValidation.normalized)
2659
2851
  : [];
2660
- var activeIssueClassProbe = issueClassProbes[0];
2852
+ var generatedProbePlan = diagnosisValidation.valid && diagnosisValidation.normalized
2853
+ ? buildResolveIOSupportIssueClassProbePlan(diagnosisValidation.normalized, input.now)
2854
+ : undefined;
2855
+ var storedProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(bundle.supportV5IssueClassProbePlan, diagnosisValidation.normalized, input.now);
2856
+ var issueClassProbePlanValidation = storedProbePlanValidation.valid
2857
+ ? storedProbePlanValidation
2858
+ : validateResolveIOSupportIssueClassProbePlan(generatedProbePlan, diagnosisValidation.normalized, input.now);
2859
+ var issueClassProbePlan = issueClassProbePlanValidation.normalized || generatedProbePlan;
2860
+ var activeIssueClassProbe = issueClassProbePlanValidation.activeProbe || (issueClassProbePlan === null || issueClassProbePlan === void 0 ? void 0 : issueClassProbePlan.activeProbe) || issueClassProbes[0];
2661
2861
  var issueClassProbeEvidence = activeIssueClassProbe
2662
2862
  ? Array.from(new Set(__spreadArray([
2863
+ "IssueClassProbePlan ".concat((issueClassProbePlan === null || issueClassProbePlan === void 0 ? void 0 : issueClassProbePlan.planId) || 'generated', " status=").concat(issueClassProbePlanValidation.status),
2663
2864
  "AIQaBusinessAssertion mapped to ".concat(activeIssueClassProbe.issue_class),
2664
2865
  "state transition: ".concat(activeIssueClassProbe.state_transition.before || 'before', " -> ").concat(activeIssueClassProbe.state_transition.action || activeIssueClassProbe.action, " -> ").concat(activeIssueClassProbe.state_transition.after || 'after')
2665
2866
  ], __read(activeIssueClassProbe.required_artifacts.map(function (artifact) { return "artifact: ".concat(artifact); })), false)))
@@ -2696,7 +2897,8 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
2696
2897
  var diagnosisValid = diagnosisValidation.valid === true;
2697
2898
  var ownerFilesReady = diagnosisValid && ownerFiles.length > 0;
2698
2899
  var proofPlanReady = diagnosisValid && !!proofContract;
2699
- var rootCauseFirstSatisfied = diagnosisValid && ownerFilesReady && proofPlanReady;
2900
+ var issueClassProbePlanReady = issueClassProbePlanValidation.valid === true;
2901
+ var rootCauseFirstSatisfied = diagnosisValid && ownerFilesReady && proofPlanReady && issueClassProbePlanReady;
2700
2902
  var sameFailureParked = evidenceFreshness.mustCollectNewEvidence === true
2701
2903
  || (action === 'collect_new_evidence' && /repeated|no_progress|ping_pong|same failure|same evidence/i.test(reason));
2702
2904
  return {
@@ -2717,12 +2919,14 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
2717
2919
  canDraftCustomerReply: (action === 'draft_customer_reply' && businessProofReadiness.ready === true)
2718
2920
  || action === 'ask_customer_clarification',
2719
2921
  requiresHumanDecision: action === 'park_manual' || fields.canRunAutonomously !== true,
2922
+ issueClassProbePlanReady: issueClassProbePlanReady,
2720
2923
  reason: reason,
2721
- blockers: blockers,
2924
+ blockers: Array.from(new Set(__spreadArray(__spreadArray([], __read(blockers), false), __read(issueClassProbePlanValidation.blockers), false))),
2722
2925
  ownerFiles: ownerFiles,
2723
2926
  issueClass: ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.issue_class) || repairGate.issueClass,
2724
2927
  expectedProof: expectedProof,
2725
2928
  issueClassProbes: issueClassProbes,
2929
+ issueClassProbePlan: issueClassProbePlan,
2726
2930
  businessProofStatus: businessProofReadiness.status,
2727
2931
  proofFingerprint: businessProofReadiness.proofFingerprint,
2728
2932
  artifactFingerprint: businessProofReadiness.artifactFingerprint,
@@ -2746,7 +2950,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
2746
2950
  return 'Only diagnosis owner_files change, a compile/unit gate is recorded, and the next state is business proof QA rather than acceptance.';
2747
2951
  }
2748
2952
  if (action === 'run_business_proof_qa') {
2749
- return 'A fresh AIQaBusinessAssertion maps to the active proof_plan and records before/action/after DOM, data, or Mongo proof.';
2953
+ return 'A fresh AIQaBusinessAssertion maps to the validated IssueClassProbePlan and records before/action/after DOM, data, or Mongo proof.';
2750
2954
  }
2751
2955
  if (action === 'repair_release_hotfix_first') {
2752
2956
  return primaryCommand === 'record_hotfix_evidence'
@@ -2777,6 +2981,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
2777
2981
  var safeToAutoRun = fields.canRunAutonomously === true
2778
2982
  && !requiresHumanApproval
2779
2983
  && (action !== 'run_owner_scoped_repair' || (rootCauseReadiness.rootCauseFirstSatisfied === true && evidenceFreshness.mustCollectNewEvidence !== true))
2984
+ && (action !== 'run_business_proof_qa' || rootCauseReadiness.issueClassProbePlanReady === true)
2780
2985
  && (action !== 'repair_release_hotfix_first' || primaryCommand !== 'apply_backend_hotfix_only_after_commit_proof' || liveHotfixBlockedUntilCommit !== true);
2781
2986
  var costRisk = requiresHumanApproval
2782
2987
  ? 'manual_blocked'
@@ -2802,7 +3007,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
2802
3007
  var preconditions = Array.from(new Set(__spreadArray([
2803
3008
  action !== 'run_diagnosis_gate' ? 'SupportDiagnosisGate validation checked before action.' : 'Diagnosis is read-only and cannot edit source files.',
2804
3009
  action === 'run_owner_scoped_repair' ? 'Root-cause-first gate is satisfied and owner_files are the only editable product files.' : '',
2805
- action === 'run_business_proof_qa' ? 'Business proof QA must use the diagnosis proof_plan and generated issue-class probe.' : '',
3010
+ action === 'run_business_proof_qa' ? 'Business proof QA must use the diagnosis proof_plan and validated IssueClassProbePlan.' : '',
2806
3011
  action === 'repair_release_hotfix_first' ? 'Live backend hotfix is blocked until GitHub commit proof is recorded and passed.' : '',
2807
3012
  evidenceFreshness.mustCollectNewEvidence === true ? 'Current failure is stale or repeated; only evidence collection is allowed until proof changes.' : ''
2808
3013
  ], __read(requiredEvidence), false).filter(Boolean))).slice(0, 24);
@@ -2847,6 +3052,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
2847
3052
  blockerFingerprint: evidenceFreshness.blockerFingerprint,
2848
3053
  evidenceHash: evidenceFreshness.evidenceHash,
2849
3054
  sameFailureCount: evidenceFreshness.sameFailureCount,
3055
+ issueClassProbePlanReady: rootCauseReadiness.issueClassProbePlanReady === true,
2850
3056
  hotfixCommitRequired: hotfixCommitRequired,
2851
3057
  liveHotfixBlockedUntilCommit: liveHotfixBlockedUntilCommit
2852
3058
  },
@@ -2931,6 +3137,8 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
2931
3137
  issueClass: ((_a = diagnosisValidation.normalized) === null || _a === void 0 ? void 0 : _a.issue_class) || repairGate.issueClass,
2932
3138
  expectedProof: expectedProof,
2933
3139
  issueClassProbes: issueClassProbes,
3140
+ issueClassProbePlan: issueClassProbePlan,
3141
+ issueClassProbePlanValidation: issueClassProbePlanValidation,
2934
3142
  activeMicrotask: activeMicrotask,
2935
3143
  diagnosisValidation: diagnosisValidation,
2936
3144
  repairGate: repairGate,
@@ -3221,7 +3429,7 @@ function buildResolveIOSupportV5DiagnoseFirstPrompt(lines) {
3221
3429
  ].filter(Boolean);
3222
3430
  }
3223
3431
  function buildResolveIOSupportV5MicrotaskPrompt(input) {
3224
- var _a, _b, _c, _d, _e, _f, _g;
3432
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
3225
3433
  var activeMicrotask = selectResolveIOSupportV5ActiveMicrotask(input.bundle.supportV5MicrotaskLedger || [], input.bundle.supportV5ActiveMicrotaskId);
3226
3434
  var diagnosisValidation = validateResolveIOSupportDiagnosisGate(input.bundle.supportV5DiagnosisGate);
3227
3435
  var diagnosisGate = diagnosisValidation.normalized || input.bundle.supportV5DiagnosisGate;
@@ -3251,6 +3459,12 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
3251
3459
  ownerFiles: (diagnosisGate === null || diagnosisGate === void 0 ? void 0 : diagnosisGate.owner_files) || targetFiles,
3252
3460
  text: input.bundle.supportV5ScopeDigest || input.bundle.supportV5SupervisorState.currentGoal
3253
3461
  });
3462
+ var promptProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(input.bundle.supportV5IssueClassProbePlan, diagnosisValidation.normalized || diagnosisGate, input.now);
3463
+ var promptProbePlan = promptProbePlanValidation.valid
3464
+ ? promptProbePlanValidation.normalized
3465
+ : diagnosisValidation.valid
3466
+ ? buildResolveIOSupportIssueClassProbePlan(diagnosisValidation.normalized || diagnosisGate, input.now)
3467
+ : undefined;
3254
3468
  var similarCaseSelection = diagnosisEvidencePack.similarCaseSelection;
3255
3469
  var similarCaseHintsText = ((_d = similarCaseSelection === null || similarCaseSelection === void 0 ? void 0 : similarCaseSelection.ranked) === null || _d === void 0 ? void 0 : _d.length)
3256
3470
  ? __spreadArray([
@@ -3343,6 +3557,19 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
3343
3557
  name: 'similar_accepted_fix_hints',
3344
3558
  text: similarCaseHintsText
3345
3559
  } : undefined,
3560
+ !diagnosisActive && input.lane === 'qa' && promptProbePlan ? {
3561
+ name: 'issue_class_probe_plan',
3562
+ text: [
3563
+ "IssueClassProbePlan ".concat(promptProbePlan.planId, " status=").concat(promptProbePlan.status, " issue_class=").concat(promptProbePlan.issue_class || '', " gate=").concat(promptProbePlan.acceptanceGate),
3564
+ "route=".concat(cleanText((_h = promptProbePlan.activeProbe) === null || _h === void 0 ? void 0 : _h.route, 180)),
3565
+ "action=".concat(cleanText(((_j = promptProbePlan.activeProbe) === null || _j === void 0 ? void 0 : _j.state_transition.action) || ((_k = promptProbePlan.activeProbe) === null || _k === void 0 ? void 0 : _k.action), 260)),
3566
+ "assertion=".concat(cleanText((_l = promptProbePlan.activeProbe) === null || _l === void 0 ? void 0 : _l.state_transition.assertion, 260)),
3567
+ "after=".concat(cleanText((_m = promptProbePlan.activeProbe) === null || _m === void 0 ? void 0 : _m.state_transition.after, 260)),
3568
+ "artifacts=".concat(promptProbePlan.requiredArtifacts.slice(0, 6).join(', ')),
3569
+ "false_pass_blockers=".concat(promptProbePlan.falsePassBlockers.slice(0, 4).join(', ')),
3570
+ promptProbePlan.blockers.length ? "blockers=".concat(promptProbePlan.blockers.slice(0, 4).join('; ')) : ''
3571
+ ].filter(Boolean).join('\n')
3572
+ } : undefined,
3346
3573
  {
3347
3574
  name: 'scope_digest',
3348
3575
  text: cleanText(input.bundle.supportV5ScopeDigest || input.bundle.supportV5SupervisorState.approvedScope, 900)
@@ -3382,10 +3609,9 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
3382
3609
  text: [
3383
3610
  'QA lane first action after preflight: collect fresh browser evidence for the active row, not a proof review of existing route/auth artifacts.',
3384
3611
  'Use the already-running localhost harness and staged env. Before any shell command, run `source .resolveio-support-tools/env.sh 2>/dev/null || source ../.resolveio-support-tools/env.sh 2>/dev/null || true`; then use `$RESOLVEIO_SUPPORT_QA_CLIENT_URL`, `$RESOLVEIO_SUPPORT_QA_SERVER_URL`, `$PUPPETEER_EXECUTABLE_PATH`, and `$CHROME_BIN`.',
3385
- 'Required auth replay helper inside every Puppeteer row script: `const storage=JSON.parse(fs.readFileSync("qa-artifacts/auth-bootstrap-storage-state.json","utf8")); const entries=[...(Array.isArray(storage.localStorageEntries)?storage.localStorageEntries:[]), ...(Array.isArray(storage.localStorage)?storage.localStorage:Object.entries(storage.localStorage||{}).map(([key,value])=>({key,value}))), ...((storage.origins||[]).flatMap(o=>o.localStorage||[]))].map(e=>({key:e.key||e.name,value:e.value})).filter(e=>e.key); const clientUrl=process.env.RESOLVEIO_SUPPORT_QA_CLIENT_URL||process.env.RESOLVEIO_RUNNER_QA_CLIENT_URL; const rowRoute="<ACTIVE_QA_ROUTE>"; await page.goto(clientUrl,{waitUntil:"domcontentloaded"}); await page.evaluate(items=>{localStorage.clear(); for(const item of items)localStorage.setItem(item.key,item.value);}, entries); await page.goto(new URL(rowRoute, clientUrl).href,{waitUntil:"domcontentloaded"});` Replace `<ACTIVE_QA_ROUTE>` with the active row route before running. A screenshot of `/home`, the login screen, or a shell route after this helper means the QA script navigated to the wrong route or storage is stale; rerun the same row with the active route before returning an app blocker.',
3612
+ 'Required auth replay helper inside every Puppeteer row script: `const storage=JSON.parse(fs.readFileSync("qa-artifacts/auth-bootstrap-storage-state.json","utf8")); const entries=[...(Array.isArray(storage.localStorageEntries)?storage.localStorageEntries:[]), ...(Array.isArray(storage.localStorage)?storage.localStorage:Object.entries(storage.localStorage||{}).map(([key,value])=>({key,value}))), ...((storage.origins||[]).flatMap(o=>o.localStorage||[]))].map(e=>({key:e.key||e.name,value:e.value})).filter(e=>e.key); const clientUrl=process.env.RESOLVEIO_SUPPORT_QA_CLIENT_URL||process.env.RESOLVEIO_RUNNER_QA_CLIENT_URL; const rowRoute="<ACTIVE_QA_ROUTE>"; await page.goto(clientUrl,{waitUntil:"domcontentloaded"}); await page.evaluate(items=>{localStorage.clear(); for(const item of items)localStorage.setItem(item.key,item.value);}, entries); await page.goto(new URL(rowRoute, clientUrl).href,{waitUntil:"domcontentloaded"});` Replace `<ACTIVE_QA_ROUTE>` with the active row route.',
3386
3613
  'Allowed first command shape: one bounded `node`/Puppeteer row script that reads `qa-artifacts/auth-bootstrap-storage-state.json`, opens `$RESOLVEIO_SUPPORT_QA_CLIENT_URL`, seeds localStorage, navigates to the active QA route with `new URL(activeRoute, clientUrl).href`, drives the visible workflow, captures screenshot/caption, and updates the active matrix row. A `/home` proof is invalid for a locked non-home route.',
3387
- 'Forbidden in QA lane after preflight: `npm run build`, `npm run build-dev`, `npm run build-prod`, `ng build`, `npm install`, `npm ci`, `npm run server`, `npm run client`, `ng serve`, `gulp`, `mongod`, `run-local-qa.sh`, and broad source discovery. If a build/startup/dependency problem is suspected, return `blocked` or `needs-fix` with the existing qa-artifacts log paths instead of launching those commands.',
3388
- 'Launch Puppeteer from `PUPPETEER_EXECUTABLE_PATH || CHROME_BIN`, seed localStorage from `qa-artifacts/auth-bootstrap-storage-state.json`, then navigate to the active QA route.',
3614
+ 'Forbidden in QA lane after preflight: build/install/startup/watch commands, `mongod`, `run-local-qa.sh`, and broad source discovery. If build/startup/dependency is suspected, return blocked/needs-fix with existing qa-artifacts log paths.',
3389
3615
  'Before passing, confirm `qa-artifacts/auth-bootstrap-result.json` used the ticket reporter or named affected user when available. If it used generic admin/dev while `qa-live-data-seed-result.json.selected.qa_user_context` names a reporter/affected user, rerun auth as that user or return needs-fix.',
3390
3616
  'Drive the visible customer workflow for this one row. Capture a new customer-facing screenshot/caption and update `qa-artifacts/qa-coverage-matrix.json` with workflow, route, data id/name, assertion, screenshot path, caption, and pass/failed/blocked status.',
3391
3617
  'Also write `qa-artifacts/aiqa-business-assertion.json` with one AIQaBusinessAssertion object: assertion, status, workflow, route, before, action, expected, after/observed, dataProof or mongoDelta, artifactPaths, and metadata.supportDiagnosisProof=true only when it maps to the active SupportDiagnosisGate proof_plan.',