@resolveio/server-lib 22.3.210 → 22.3.212

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.
@@ -129,6 +129,11 @@ function cleanListEntryText(value, max) {
129
129
  if (max === void 0) { max = 500; }
130
130
  if (value && typeof value === 'object' && !Array.isArray(value)) {
131
131
  var source = value;
132
+ var hypothesis = cleanListEntryText(source.hypothesis, Math.floor(max / 2));
133
+ var whyRejected = cleanListEntryText(source.why_rejected || source.whyRejected || source.reason_rejected || source.reasonRejected, Math.floor(max / 2));
134
+ if (hypothesis && whyRejected) {
135
+ return "".concat(hypothesis, " rejected because ").concat(whyRejected).slice(0, max);
136
+ }
132
137
  try {
133
138
  for (var _b = __values([
134
139
  'path',
@@ -924,7 +929,12 @@ function normalizeIssueClass(value) {
924
929
  route_auth_hydration: 'route_auth_hydration',
925
930
  slow_query: 'slow_query_performance',
926
931
  performance: 'slow_query_performance',
927
- slow_query_performance: 'slow_query_performance'
932
+ slow_query_performance: 'slow_query_performance',
933
+ feature: 'missing_wrong_data',
934
+ feature_request: 'missing_wrong_data',
935
+ request_new_feature: 'missing_wrong_data',
936
+ requested_behavior_change: 'missing_wrong_data',
937
+ new_feature: 'missing_wrong_data'
928
938
  };
929
939
  return aliases[normalized] || '';
930
940
  }
@@ -962,12 +972,40 @@ function normalizeSupportDiagnosisEvidence(values) {
962
972
  .filter(function (entry) { return entry && typeof entry === 'object' && !Array.isArray(entry); })
963
973
  .map(function (entry) {
964
974
  var type = cleanText(entry.type, 80).toLowerCase();
965
- var normalizedType = (allowed.has(type) ? type : 'other');
966
- var summary = cleanText(entry.summary || entry.message || entry.evidence || entry.reason, 1200);
967
975
  var artifactPath = cleanText(entry.artifactPath || entry.artifact_path || entry.path || entry.file, 500);
976
+ var inferredType = (function () {
977
+ if (allowed.has(type)) {
978
+ return type;
979
+ }
980
+ if (/\b(ticket|manual-ticket|support-context|email\.metadata)\b/i.test(artifactPath)) {
981
+ return 'ticket';
982
+ }
983
+ if (/\b(commit|git)\b/i.test(artifactPath)) {
984
+ return 'commit';
985
+ }
986
+ if (/\b(mongo|query|database|collection)\b/i.test(artifactPath)) {
987
+ return 'mongo';
988
+ }
989
+ if (/\b(log|trace)\b/i.test(artifactPath)) {
990
+ return 'log';
991
+ }
992
+ if (/\b(angular|server|client|src|methods|publications|routing|permission|component)\b/i.test(artifactPath)) {
993
+ return 'code';
994
+ }
995
+ return 'other';
996
+ })();
997
+ var normalizedType = inferredType;
998
+ var summary = cleanText(entry.summary || entry.message || entry.evidence || entry.reason || entry.fact || entry.description, 1200)
999
+ || (artifactPath ? "Evidence from ".concat(artifactPath) : '');
968
1000
  var ownerFiles = cleanList(entry.ownerFiles || entry.owner_files || entry.files, 12, 500)
969
1001
  .map(normalizeOwnerFilePath)
970
1002
  .filter(Boolean);
1003
+ if (normalizedType === 'code' && artifactPath) {
1004
+ var sourcePath = normalizeOwnerFilePath(artifactPath);
1005
+ if (sourcePath && !ownerFiles.includes(sourcePath)) {
1006
+ ownerFiles.push(sourcePath);
1007
+ }
1008
+ }
971
1009
  var evidenceRefs = cleanList(entry.evidenceRefs || entry.evidence_refs || entry.refs, 12, 500);
972
1010
  return {
973
1011
  id: cleanText(entry.id || entry.evidenceId || entry.evidence_id, 160)
@@ -1420,6 +1458,174 @@ function buildResolveIOSupportDiagnosisEvidencePack(input) {
1420
1458
  generatedAt: generatedAt
1421
1459
  };
1422
1460
  }
1461
+ function inferResolveIOSupportIssueClassFromText(value) {
1462
+ var text = cleanText(value, 3000).toLowerCase();
1463
+ if (/\b(upload|import|csv|spreadsheet|attachment|file)\b/.test(text)) {
1464
+ return 'upload_import';
1465
+ }
1466
+ if (/\b(invoice|pdf|export|print|printed|report|download)\b/.test(text)) {
1467
+ return 'invoice_pdf_export';
1468
+ }
1469
+ if (/\b(filter|query|search|wrong customer|wrong account|mismatch)\b/.test(text)) {
1470
+ return 'filter_query_mismatch';
1471
+ }
1472
+ if (/\b(route|auth|permission|login|hydrate|hydration|blank page|shell)\b/.test(text)) {
1473
+ return 'route_auth_hydration';
1474
+ }
1475
+ if (/\b(slow|timeout|performance|latency|takes too long|hang)\b/.test(text)) {
1476
+ return 'slow_query_performance';
1477
+ }
1478
+ if (/\b(submit|save|click|button|no-op|does nothing|not saving)\b/.test(text)) {
1479
+ return 'no_op_submit';
1480
+ }
1481
+ return 'missing_wrong_data';
1482
+ }
1483
+ function firstSupportDiagnosisText() {
1484
+ var e_5, _a;
1485
+ var values = [];
1486
+ for (var _i = 0; _i < arguments.length; _i++) {
1487
+ values[_i] = arguments[_i];
1488
+ }
1489
+ try {
1490
+ for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
1491
+ var value = values_2_1.value;
1492
+ var text = cleanText(value, 1400);
1493
+ if (text && !supportDiagnosisTextLooksGeneric(text, 12)) {
1494
+ return text;
1495
+ }
1496
+ }
1497
+ }
1498
+ catch (e_5_1) { e_5 = { error: e_5_1 }; }
1499
+ finally {
1500
+ try {
1501
+ if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
1502
+ }
1503
+ finally { if (e_5) throw e_5.error; }
1504
+ }
1505
+ return '';
1506
+ }
1507
+ function extractSupportDiagnosisLineValue(text, label, max) {
1508
+ if (max === void 0) { max = 1000; }
1509
+ var escaped = label.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
1510
+ var match = String(text || '').match(new RegExp("(?:^|\\n)\\s*".concat(escaped, "\\s*:\\s*([^\\n]+)"), 'i'));
1511
+ return cleanText(match === null || match === void 0 ? void 0 : match[1], max);
1512
+ }
1513
+ function inferSupportDiagnosisRouteModuleFromOwners(ownerFiles, text) {
1514
+ var joinedOwners = ownerFiles.join('\n');
1515
+ if (/part\/detail|part-detail|inventory/i.test("".concat(joinedOwners, "\n").concat(text))) {
1516
+ return 'H2SKO part inventory detail / inventory print workflow';
1517
+ }
1518
+ if (/document\/pick-ticket|pick-ticket/i.test(joinedOwners)) {
1519
+ return 'H2SKO pick-ticket print/report workflow';
1520
+ }
1521
+ if (/invoice/i.test("".concat(joinedOwners, "\n").concat(text))) {
1522
+ return 'invoice/PDF/export workflow';
1523
+ }
1524
+ if (/upload|import/i.test("".concat(joinedOwners, "\n").concat(text))) {
1525
+ return 'upload/import workflow';
1526
+ }
1527
+ return firstSupportDiagnosisText(extractSupportDiagnosisLineValue(text, 'Route'), extractSupportDiagnosisLineValue(text, 'Module'));
1528
+ }
1529
+ function buildSupportDiagnosisProofPlanScaffold(issueClass, complaint, routeModule) {
1530
+ var target = cleanText(routeModule || complaint || 'the reported workflow', 300);
1531
+ if (issueClass === 'upload_import') {
1532
+ return {
1533
+ before: 'Capture the target records/counts before re-running the customer import.',
1534
+ before_state_unavailable_reason: '',
1535
+ action: "Run the same upload/import path for ".concat(target, " with the staged customer attachment or an equivalent ticket fixture."),
1536
+ after: 'Every expected imported row is attached/persisted with the correct relationships and no silently skipped rows.',
1537
+ business_assertion: 'The import creates or updates all ticket-expected records, not just a successful upload shell.',
1538
+ route: target,
1539
+ data_assertion: 'Mongo/DOM row counts and representative imported records match the attachment contents.',
1540
+ artifact_expectation: 'before count JSON, import action trace/screenshot, after count JSON, representative imported record proof',
1541
+ business_proof_contract: {
1542
+ issue_class: issueClass,
1543
+ setup_state: 'Customer attachment or localhost fixture is available before import.',
1544
+ action_under_test: 'Execute the import workflow end to end.',
1545
+ expected_business_state_change: 'All expected rows/relationships exist after import.',
1546
+ prohibited_false_pass: 'Upload completion, route load, screenshot, scorecard, or model claim alone is not acceptance.',
1547
+ proof_artifacts: ['before Mongo/data snapshot', 'import action trace or screenshot', 'after Mongo/data snapshot', 'row-level mismatch report'],
1548
+ data_or_dom_assertion: 'Imported record counts and key fields match the source attachment.'
1549
+ }
1550
+ };
1551
+ }
1552
+ var action = issueClass === 'invoice_pdf_export'
1553
+ ? "Run the print/report/export path for ".concat(target, " using the named customer record.")
1554
+ : issueClass === 'filter_query_mismatch'
1555
+ ? "Run the filtered/search/query workflow for ".concat(target, " using the named customer/account context.")
1556
+ : "Run the exact customer-reported workflow for ".concat(target, ".");
1557
+ return {
1558
+ before: 'Capture the customer-reported wrong/missing value before repair using the staged ticket context.',
1559
+ before_state_unavailable_reason: '',
1560
+ action: action,
1561
+ after: 'The same workflow shows the expected customer/account data and no longer shows the wrong value.',
1562
+ business_assertion: 'The reported business value is correct after the action, not merely that the route loaded.',
1563
+ route: target,
1564
+ data_assertion: 'DOM/print/report output and persisted source data agree for the named customer record.',
1565
+ artifact_expectation: 'before screenshot/data snapshot, action trace, after screenshot/data snapshot, AIQaBusinessAssertion JSON',
1566
+ business_proof_contract: {
1567
+ issue_class: issueClass,
1568
+ setup_state: 'The named customer record is present in the staged support data before action.',
1569
+ action_under_test: action,
1570
+ expected_business_state_change: 'The visible/output business data matches the expected persisted value.',
1571
+ prohibited_false_pass: 'Route load, screenshot-only proof, scorecard pass, or model claim alone is not acceptance.',
1572
+ proof_artifacts: ['before DOM/data snapshot', 'action trace/screenshot', 'after DOM/data snapshot', 'Mongo or persisted data comparison'],
1573
+ data_or_dom_assertion: 'The displayed/output value matches the expected persisted customer value.'
1574
+ }
1575
+ };
1576
+ }
1577
+ function buildResolveIOSupportDiagnosisRetryScaffold(input) {
1578
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
1579
+ var existing = normalizeResolveIOSupportDiagnosisGate(input.diagnosisGate, input.now);
1580
+ var scopeText = cleanText([
1581
+ (_a = input.bundle) === null || _a === void 0 ? void 0 : _a.supportV5ScopeDigest,
1582
+ (_c = (_b = input.bundle) === null || _b === void 0 ? void 0 : _b.supportV5SupervisorState) === null || _c === void 0 ? void 0 : _c.currentGoal,
1583
+ (_e = (_d = input.bundle) === null || _d === void 0 ? void 0 : _d.supportV5SupervisorState) === null || _e === void 0 ? void 0 : _e.approvedScope
1584
+ ].filter(Boolean).join('\n'), 3000);
1585
+ var ownerFiles = Array.from(new Set(__spreadArray(__spreadArray([], __read(cleanList(existing === null || existing === void 0 ? void 0 : existing.owner_files, 8, 500)), false), __read(cleanList((_f = input.evidencePack) === null || _f === void 0 ? void 0 : _f.ownerFileHints, 8, 500)), false).map(normalizeOwnerFilePath).filter(Boolean))).slice(0, 8);
1586
+ var complaint = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.customer_complaint, extractSupportDiagnosisLineValue(scopeText, 'Customer complaint'), extractSupportDiagnosisLineValue(scopeText, 'Issue'), extractSupportDiagnosisLineValue(scopeText, 'Approved scope'), scopeText);
1587
+ var issueClass = normalizeIssueClass((existing === null || existing === void 0 ? void 0 : existing.issue_class) || ((_g = input.evidencePack) === null || _g === void 0 ? void 0 : _g.issueClassHint))
1588
+ || inferResolveIOSupportIssueClassFromText("".concat(scopeText, "\n").concat(ownerFiles.join('\n')));
1589
+ var routeModule = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.route_module, inferSupportDiagnosisRouteModuleFromOwners(ownerFiles, scopeText), extractSupportDiagnosisLineValue(scopeText, 'Route'), extractSupportDiagnosisLineValue(scopeText, 'Module'));
1590
+ var expected = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.expected_result, extractSupportDiagnosisLineValue(scopeText, 'Expected'), complaint ? "The customer-reported workflow should use the correct business data for: ".concat(complaint) : '');
1591
+ var observed = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.observed_result, extractSupportDiagnosisLineValue(scopeText, 'Observed'), complaint ? "The observed behavior is the customer report that needs reproduction: ".concat(complaint) : '');
1592
+ var accountContext = firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.issue_case.account_customer_context, extractSupportDiagnosisLineValue(scopeText, 'Client'), extractSupportDiagnosisLineValue(scopeText, 'Customer'), extractSupportDiagnosisLineValue(scopeText, 'Reporter'), (_j = (_h = input.bundle) === null || _h === void 0 ? void 0 : _h.supportV5SupervisorState) === null || _j === void 0 ? void 0 : _j.currentGoal);
1593
+ var proofPlan = (existing === null || existing === void 0 ? void 0 : existing.proof_plan) && (existing.proof_plan.action || existing.proof_plan.business_assertion)
1594
+ ? existing.proof_plan
1595
+ : buildSupportDiagnosisProofPlanScaffold(issueClass, complaint, routeModule);
1596
+ return {
1597
+ instruction: 'Starter only. Replace scaffolded guesses with verified ticket/code/browser/Mongo/log evidence before returning support_diagnosis_gate. Do not copy TODO/placeholder text and do not leave strings blank.',
1598
+ support_diagnosis_gate: {
1599
+ issue_case: {
1600
+ customer_complaint: complaint || 'TODO: restate the customer complaint from the staged ticket/email.',
1601
+ expected_result: expected || 'TODO: state the customer-visible expected business result.',
1602
+ observed_result: observed || 'TODO: state the reproduced or classified wrong behavior.',
1603
+ route_module: routeModule || 'TODO: identify the exact route/module/workflow.',
1604
+ account_customer_context: accountContext || 'TODO: name the affected client/account/user context.',
1605
+ reproduction_status: (existing === null || existing === void 0 ? void 0 : existing.issue_case.reproduction_status) || 'blocked',
1606
+ reproduction_blocker: (existing === null || existing === void 0 ? void 0 : existing.issue_case.reproduction_blocker) || 'TODO: replace with blocker only if reproduction cannot be performed.'
1607
+ },
1608
+ issue_class: issueClass,
1609
+ accepted_hypothesis: {
1610
+ statement: firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.accepted_hypothesis.statement) || 'TODO: one falsifiable root-cause theory backed by current-ticket evidence.',
1611
+ falsifiable_test: firstSupportDiagnosisText(existing === null || existing === void 0 ? void 0 : existing.accepted_hypothesis.falsifiable_test) || 'TODO: exact test that would prove this hypothesis wrong.',
1612
+ evidence: cleanList(existing === null || existing === void 0 ? void 0 : existing.accepted_hypothesis.evidence, 6, 800)
1613
+ },
1614
+ rejected_alternatives: cleanList(existing === null || existing === void 0 ? void 0 : existing.rejected_alternatives, 4, 800),
1615
+ failing_path: (existing === null || existing === void 0 ? void 0 : existing.failing_path) || {
1616
+ frontend: '',
1617
+ backend: '',
1618
+ shared_library: '',
1619
+ data_query: '',
1620
+ description: routeModule || complaint || ''
1621
+ },
1622
+ owner_files: ownerFiles,
1623
+ proof_plan: proofPlan,
1624
+ evidence: (existing === null || existing === void 0 ? void 0 : existing.evidence) || [],
1625
+ status: 'incomplete'
1626
+ }
1627
+ };
1628
+ }
1423
1629
  function normalizeSupportDiagnosisBusinessProofContract(value, issueClassHint) {
1424
1630
  var source = cleanObject(value);
1425
1631
  if (!Object.keys(source).length) {
@@ -1438,19 +1644,162 @@ function normalizeSupportDiagnosisBusinessProofContract(value, issueClassHint) {
1438
1644
  data_or_dom_assertion: pickText(source, ['data_or_dom_assertion', 'dataOrDomAssertion', 'data_assertion', 'dataAssertion', 'dom_assertion', 'domAssertion', 'assertion'], 1000)
1439
1645
  };
1440
1646
  }
1647
+ function supportDiagnosisNarrativeText(value, max) {
1648
+ if (max === void 0) { max = 1200; }
1649
+ if (typeof value === 'string' || typeof value === 'number' || typeof value === 'boolean') {
1650
+ return cleanText(value, max);
1651
+ }
1652
+ if (Array.isArray(value)) {
1653
+ return cleanList(value, 12, Math.max(80, Math.floor(max / 2))).join(' ').slice(0, max);
1654
+ }
1655
+ var source = cleanObject(value);
1656
+ if (!Object.keys(source).length) {
1657
+ return '';
1658
+ }
1659
+ var direct = pickText(source, [
1660
+ 'summary',
1661
+ 'description',
1662
+ 'statement',
1663
+ 'issue_case',
1664
+ 'issueCase',
1665
+ 'customer_complaint',
1666
+ 'customerComplaint',
1667
+ 'expected_result',
1668
+ 'expectedResult',
1669
+ 'observed_result',
1670
+ 'observedResult',
1671
+ 'path',
1672
+ 'reason',
1673
+ 'fact'
1674
+ ], max);
1675
+ if (direct) {
1676
+ return direct;
1677
+ }
1678
+ var hypothesis = cleanText(source.hypothesis, Math.floor(max / 2));
1679
+ var whyRejected = cleanText(source.why_rejected || source.whyRejected || source.reason_rejected || source.reasonRejected, Math.floor(max / 2));
1680
+ if (hypothesis && whyRejected) {
1681
+ return "".concat(hypothesis, " rejected because ").concat(whyRejected).slice(0, max);
1682
+ }
1683
+ var routeModulePermission = cleanText(source.route_module_permission_gate || source.routeModulePermissionGate, Math.floor(max / 2));
1684
+ var templateGate = cleanText(source.template_conditional_rendering_gate || source.templateConditionalRenderingGate, Math.floor(max / 2));
1685
+ var backingGate = cleanText(source.backing_role_group_config_publications_gate || source.backingRoleGroupConfigPublicationsGate, Math.floor(max / 2));
1686
+ return [routeModulePermission, templateGate, backingGate].filter(Boolean).join(' | ').slice(0, max);
1687
+ }
1688
+ function supportDiagnosisLooksLikeClassifiedFeatureRequest(source, issueCaseText, failingPathText, hypothesisText) {
1689
+ var classificationText = supportDiagnosisNarrativeText(source.classification || source.classification_reason || source.classificationReason, 700);
1690
+ var issueClassText = cleanText(source.issue_class || source.issueClass, 160);
1691
+ var combined = [
1692
+ issueClassText,
1693
+ classificationText,
1694
+ issueCaseText,
1695
+ failingPathText,
1696
+ hypothesisText
1697
+ ].join(' ').toLowerCase();
1698
+ return /\b(feature request|feature_request|new feature|requested behavior change|net-new|net new|not implemented|no existing|none_existing|does not exist|no .*route)\b/i.test(combined);
1699
+ }
1700
+ function normalizeSupportDiagnosisRejectedAlternatives(values) {
1701
+ var e_6, _a;
1702
+ if (!Array.isArray(values)) {
1703
+ return cleanList(values, 10, 700);
1704
+ }
1705
+ var result = [];
1706
+ try {
1707
+ for (var values_3 = __values(values), values_3_1 = values_3.next(); !values_3_1.done; values_3_1 = values_3.next()) {
1708
+ var value = values_3_1.value;
1709
+ var text = supportDiagnosisNarrativeText(value, 700);
1710
+ if (text && !result.includes(text)) {
1711
+ result.push(text);
1712
+ }
1713
+ if (result.length >= 10) {
1714
+ break;
1715
+ }
1716
+ }
1717
+ }
1718
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1719
+ finally {
1720
+ try {
1721
+ if (values_3_1 && !values_3_1.done && (_a = values_3.return)) _a.call(values_3);
1722
+ }
1723
+ finally { if (e_6) throw e_6.error; }
1724
+ }
1725
+ return result;
1726
+ }
1727
+ function normalizeSupportDiagnosisProofPlanRows(values) {
1728
+ var e_7, _a;
1729
+ if (!Array.isArray(values)) {
1730
+ return {};
1731
+ }
1732
+ var actions = [];
1733
+ var proofRequired = [];
1734
+ try {
1735
+ for (var values_4 = __values(values), values_4_1 = values_4.next(); !values_4_1.done; values_4_1 = values_4.next()) {
1736
+ var row = values_4_1.value;
1737
+ var source = cleanObject(row);
1738
+ var action = pickText(source, ['action', 'step', 'browser_action', 'browserAction', 'task'], 500) || supportDiagnosisNarrativeText(row, 500);
1739
+ var proof = pickText(source, ['proof_required', 'proofRequired', 'expected', 'expected_result', 'expectedResult', 'assertion', 'business_assertion', 'businessAssertion'], 700);
1740
+ if (action) {
1741
+ actions.push(action);
1742
+ }
1743
+ if (proof) {
1744
+ proofRequired.push(proof);
1745
+ }
1746
+ }
1747
+ }
1748
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
1749
+ finally {
1750
+ try {
1751
+ if (values_4_1 && !values_4_1.done && (_a = values_4.return)) _a.call(values_4);
1752
+ }
1753
+ finally { if (e_7) throw e_7.error; }
1754
+ }
1755
+ return {
1756
+ action: actions.join(' | ').slice(0, 1000),
1757
+ after: proofRequired.join(' | ').slice(0, 1000),
1758
+ business_assertion: proofRequired.join(' | ').slice(0, 1000),
1759
+ data_assertion: proofRequired.join(' | ').slice(0, 1000)
1760
+ };
1761
+ }
1441
1762
  function normalizeOwnerFilePath(value) {
1442
- return cleanListEntryText(value, 500)
1763
+ var e_8, _a;
1764
+ var normalized = cleanListEntryText(value, 500)
1443
1765
  .replace(/\\/g, '/')
1444
1766
  .replace(/^\.\/+/, '')
1445
1767
  .replace(/^\/+/, '')
1446
1768
  .replace(/\s+$/g, '');
1769
+ try {
1770
+ for (var _b = __values([
1771
+ /(?:^|\/)resolveio-ai-workspace\/[^/]+\/resolveio-all\//i,
1772
+ /(?:^|\/)ai-workspace\/[^/]+\/resolveio-all\//i,
1773
+ /(?:^|\/)resolveio-all\//i,
1774
+ /(?:^|\/)resolveio-server-lib\//i,
1775
+ /(?:^|\/)resolveio-client-lib\//i
1776
+ ]), _c = _b.next(); !_c.done; _c = _b.next()) {
1777
+ var pattern = _c.value;
1778
+ var match = normalized.match(pattern);
1779
+ if ((match === null || match === void 0 ? void 0 : match.index) !== undefined) {
1780
+ var start = match.index + match[0].length;
1781
+ var stripped = normalized.slice(start).replace(/^\/+/, '');
1782
+ if (stripped) {
1783
+ return stripped;
1784
+ }
1785
+ }
1786
+ }
1787
+ }
1788
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1789
+ finally {
1790
+ try {
1791
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1792
+ }
1793
+ finally { if (e_8) throw e_8.error; }
1794
+ }
1795
+ return normalized;
1447
1796
  }
1448
1797
  function isResolveIOSupportGeneratedAngularWrapperPath(value) {
1449
1798
  var normalized = normalizeOwnerFilePath(value).replace(/^geochem\//i, '');
1450
1799
  return /(?:^|\/)angular\/app\/(?:methods|publications)\.ts$/i.test(normalized);
1451
1800
  }
1452
1801
  function ownerFileComparablePathKeys(value) {
1453
- var e_5, _a;
1802
+ var e_9, _a;
1454
1803
  var normalized = normalizeOwnerFilePath(value);
1455
1804
  if (!normalized) {
1456
1805
  return [];
@@ -1472,12 +1821,12 @@ function ownerFileComparablePathKeys(value) {
1472
1821
  }
1473
1822
  }
1474
1823
  }
1475
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1824
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
1476
1825
  finally {
1477
1826
  try {
1478
1827
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1479
1828
  }
1480
- finally { if (e_5) throw e_5.error; }
1829
+ finally { if (e_9) throw e_9.error; }
1481
1830
  }
1482
1831
  return Array.from(keys);
1483
1832
  }
@@ -1511,7 +1860,7 @@ function ownerFileLooksNonProductEvidence(value) {
1511
1860
  var normalized = normalizeOwnerFilePath(value);
1512
1861
  return /(^|\/)(qa-artifacts?|screenshots?|screen-shots?|traces?|logs?|tmp|temp|coverage|dist|build|docs?)(\/|$)/i.test(normalized)
1513
1862
  || /(^|\/)(?:support-diagnosis-pack-[^/]+|diagnosis-evidence-pack|aiqa-business-assertion)\.json$/i.test(normalized)
1514
- || /(^|\/)\.resolveio-(?:support|context|runner|qa)(\/|$)/i.test(normalized)
1863
+ || /(^|\/)\.resolveio-(?:support-context|support|context|runner|qa)(\/|$)/i.test(normalized)
1515
1864
  || /(^|\/)(__tests__|tests?|spec)(\/|$)|\.(?:spec|test)\.[jt]sx?$/i.test(normalized)
1516
1865
  || /\.(?:png|jpe?g|gif|webp|svg|pdf|log|txt|md|markdown)$/i.test(normalized);
1517
1866
  }
@@ -1529,7 +1878,7 @@ function supportDiagnosisTextLooksGeneric(value, minimumLength) {
1529
1878
  return compact.length < minimumLength
1530
1879
  || meaningfulWords.length < 3
1531
1880
  || /^(n a|na|none|null|unknown|todo|tbd|pending|fix|bug|issue|problem|broken|not working|works|should work)$/i.test(compact)
1532
- || /\b(todo|tbd|placeholder|unknown|guess|maybe|probably|something|somewhere|stuff|things?)\b/i.test(compact)
1881
+ || /\b(todo|tbd|placeholder|replace with|do not copy|do not leave blank|ticket specific|unknown|guess|maybe|probably|something|somewhere|stuff|things?)\b/i.test(compact)
1533
1882
  || /^(fix|debug|investigate|check|look into|test|verify)( the)? (issue|bug|problem|ticket|route|page)$/i.test(compact)
1534
1883
  || /^(the )?(issue|bug|problem|ticket|route|page)( is)? (fixed|broken|not working|wrong)$/i.test(compact);
1535
1884
  }
@@ -1815,59 +2164,131 @@ function evaluateResolveIOSupportDiagnosisEvidenceQuality(value) {
1815
2164
  };
1816
2165
  }
1817
2166
  function normalizeResolveIOSupportDiagnosisGate(value, now) {
1818
- var source = cleanObject(value);
2167
+ var rootSource = cleanObject(value);
2168
+ var source = cleanObject(rootSource.support_diagnosis_gate
2169
+ || rootSource.supportDiagnosisGate
2170
+ || rootSource.diagnosis_gate
2171
+ || rootSource.diagnosisGate
2172
+ || rootSource);
1819
2173
  if (!Object.keys(source).length) {
1820
2174
  return undefined;
1821
2175
  }
1822
- var issueCaseSource = cleanObject(source.issue_case || source.issueCase);
2176
+ var rawIssueCase = source.issue_case || source.issueCase;
2177
+ var rawHypothesis = source.accepted_hypothesis || source.acceptedHypothesis;
2178
+ var rawFailingPath = source.failing_path || source.failingPath;
2179
+ var rawProofPlan = source.proof_plan || source.proofPlan;
2180
+ var issueCaseSource = cleanObject(rawIssueCase);
1823
2181
  var hypothesisSource = cleanObject(source.accepted_hypothesis || source.acceptedHypothesis);
1824
2182
  var failingPathSource = cleanObject(source.failing_path || source.failingPath);
1825
2183
  var proofPlanSource = cleanObject(source.proof_plan || source.proofPlan);
2184
+ var issueCaseText = supportDiagnosisNarrativeText(rawIssueCase, 1200);
2185
+ var hypothesisText = supportDiagnosisNarrativeText(rawHypothesis, 1200);
2186
+ var failingPathText = supportDiagnosisNarrativeText(rawFailingPath, 1200);
2187
+ var proofPlanRows = normalizeSupportDiagnosisProofPlanRows(rawProofPlan);
1826
2188
  var issueClass = normalizeIssueClass(source.issue_class || source.issueClass);
1827
- var businessProofContract = normalizeSupportDiagnosisBusinessProofContract(proofPlanSource.business_proof_contract || proofPlanSource.businessProofContract || source.business_proof_contract || source.businessProofContract, issueClass || source.issue_class || source.issueClass);
1828
- var ownerFiles = cleanList(source.owner_files || source.ownerFiles, 20, 500)
2189
+ var featureRequestClassified = supportDiagnosisLooksLikeClassifiedFeatureRequest(source, issueCaseText, failingPathText, hypothesisText);
2190
+ var shouldDeriveLooseProofPlan = Array.isArray(rawProofPlan) || featureRequestClassified;
2191
+ var proofPlanBefore = pickText(proofPlanSource, ['before', 'before_state', 'beforeState', 'precondition'], 1000);
2192
+ var proofPlanBeforeUnavailable = pickText(proofPlanSource, ['before_state_unavailable_reason', 'beforeStateUnavailableReason', 'before_unavailable_reason'], 1000)
2193
+ || (featureRequestClassified ? 'Before-state business proof is not available because this is classified as net-new feature scope; current evidence proves the requested route/workflow is not implemented yet.' : '');
2194
+ var proofPlanAction = pickText(proofPlanSource, ['action', 'browser_action', 'browserAction', 'steps'], 1000) || proofPlanRows.action;
2195
+ var proofPlanAfter = pickText(proofPlanSource, ['after', 'after_state', 'afterState', 'expected_after'], 1000) || proofPlanRows.after;
2196
+ var proofPlanBusinessAssertion = pickText(proofPlanSource, ['business_assertion', 'businessAssertion', 'assertion'], 1000) || proofPlanRows.business_assertion;
2197
+ var proofPlanDataAssertion = pickText(proofPlanSource, ['data_assertion', 'dataAssertion', 'mongo_delta', 'mongoDelta'], 1000) || proofPlanRows.data_assertion;
2198
+ var proofPlanArtifactExpectation = pickText(proofPlanSource, ['artifact_expectation', 'artifactExpectation', 'artifact', 'screenshot'], 1000)
2199
+ || (shouldDeriveLooseProofPlan && proofPlanBusinessAssertion ? 'browser trace/screenshot plus persisted DOM/data or Mongo delta tied to the business assertion' : '');
2200
+ var derivedBusinessProofContract = shouldDeriveLooseProofPlan && proofPlanBusinessAssertion ? {
2201
+ issue_class: issueClass || source.issue_class || source.issueClass,
2202
+ setup_state: proofPlanBefore || proofPlanBeforeUnavailable,
2203
+ action_under_test: proofPlanAction,
2204
+ expected_business_state_change: proofPlanAfter || proofPlanBusinessAssertion,
2205
+ prohibited_false_pass: 'Route load, screenshot, scorecard, or model claim alone is not acceptance.',
2206
+ proof_artifacts: [
2207
+ proofPlanArtifactExpectation,
2208
+ 'DOM/data assertion artifact',
2209
+ 'persisted record or Mongo delta proof'
2210
+ ].filter(Boolean),
2211
+ data_or_dom_assertion: proofPlanDataAssertion || proofPlanBusinessAssertion
2212
+ } : undefined;
2213
+ var businessProofContract = normalizeSupportDiagnosisBusinessProofContract(proofPlanSource.business_proof_contract || proofPlanSource.businessProofContract || source.business_proof_contract || source.businessProofContract, issueClass || source.issue_class || source.issueClass) || normalizeSupportDiagnosisBusinessProofContract(derivedBusinessProofContract, issueClass || source.issue_class || source.issueClass);
2214
+ var rawOwnerFiles = cleanList(source.owner_files || source.ownerFiles, 20, 500)
1829
2215
  .map(normalizeOwnerFilePath)
1830
2216
  .filter(Boolean);
2217
+ var productOwnerFiles = rawOwnerFiles.filter(function (ownerFile) { return !ownerFileLooksNonProductEvidence(ownerFile); });
2218
+ var ownerFiles = productOwnerFiles.length ? productOwnerFiles : rawOwnerFiles;
2219
+ var explicitEvidence = normalizeSupportDiagnosisEvidence(source.evidence);
2220
+ var derivedFeatureRequestEvidence = !explicitEvidence.length && featureRequestClassified ? __spreadArray(__spreadArray([], __read((issueCaseText ? [{
2221
+ id: "evidence-".concat(hashResolveIOSupportV5Evidence({ type: 'ticket', summary: issueCaseText }).slice(0, 12)),
2222
+ type: 'ticket',
2223
+ summary: issueCaseText
2224
+ }] : [])), false), __read(ownerFiles.map(function (ownerFile) { return ({
2225
+ id: "evidence-".concat(hashResolveIOSupportV5Evidence({ type: 'code', ownerFile: ownerFile, failingPathText: failingPathText, hypothesisText: hypothesisText }).slice(0, 12)),
2226
+ type: 'code',
2227
+ summary: cleanText([
2228
+ "Owner file inspected for classified feature-request scope: ".concat(ownerFile, "."),
2229
+ failingPathText || hypothesisText || 'No implemented route/module path was identified.'
2230
+ ].filter(Boolean).join(' '), 1200),
2231
+ artifactPath: ownerFile,
2232
+ ownerFiles: [ownerFile]
2233
+ }); })), false) : [];
2234
+ var diagnosisEvidence = explicitEvidence.length ? explicitEvidence : derivedFeatureRequestEvidence;
2235
+ var routeModule = pickText(issueCaseSource, ['route_module', 'routeModule', 'route', 'module', 'screen'], 500)
2236
+ || pickText(source, ['route_module', 'routeModule', 'module', 'screen'], 500)
2237
+ || pickText(failingPathSource, ['route', 'module', 'path', 'description'], 500)
2238
+ || (featureRequestClassified ? 'net-new support feature workflow' : '');
2239
+ var expectedResult = pickText(issueCaseSource, ['expected_result', 'expectedResult', 'expected'], 1000)
2240
+ || pickText(source, ['expected_result', 'expectedResult', 'expected', 'primary_goal', 'primaryGoal', 'requested_behavior', 'requestedBehavior'], 1000)
2241
+ || (featureRequestClassified && issueCaseText ? "Implement the requested workflow: ".concat(issueCaseText) : '');
2242
+ var observedResult = pickText(issueCaseSource, ['observed_result', 'observedResult', 'observed', 'actual'], 1000)
2243
+ || pickText(source, ['observed_result', 'observedResult', 'observed', 'actual', 'current_state', 'currentState'], 1000)
2244
+ || (featureRequestClassified ? "Current repo evidence indicates no implemented route/module for ".concat(routeModule || 'the requested workflow', ".") : '');
2245
+ var accountCustomerContext = pickText(issueCaseSource, ['account_customer_context', 'accountCustomerContext', 'account', 'customer', 'user', 'context'], 800)
2246
+ || pickText(source, ['account_customer_context', 'accountCustomerContext', 'affected_account_user', 'affectedAccountUser', 'account', 'customer', 'client', 'user', 'context'], 800)
2247
+ || (featureRequestClassified ? 'Customer/account context from support ticket intake.' : '');
2248
+ var rawReproductionStatus = issueCaseSource.reproduction_status || issueCaseSource.reproductionStatus || source.reproduction_status;
1831
2249
  var gate = {
1832
2250
  issue_case: {
1833
- customer_complaint: pickText(issueCaseSource, ['customer_complaint', 'customerComplaint', 'complaint', 'request', 'summary'], 1200),
1834
- expected_result: pickText(issueCaseSource, ['expected_result', 'expectedResult', 'expected'], 1000),
1835
- observed_result: pickText(issueCaseSource, ['observed_result', 'observedResult', 'observed', 'actual'], 1000),
1836
- route_module: pickText(issueCaseSource, ['route_module', 'routeModule', 'route', 'module', 'screen'], 500),
1837
- account_customer_context: pickText(issueCaseSource, ['account_customer_context', 'accountCustomerContext', 'account', 'customer', 'user', 'context'], 800),
1838
- reproduction_status: normalizeReproductionStatus(issueCaseSource.reproduction_status || issueCaseSource.reproductionStatus || source.reproduction_status),
2251
+ customer_complaint: pickText(issueCaseSource, ['customer_complaint', 'customerComplaint', 'complaint', 'request', 'summary'], 1200) || issueCaseText,
2252
+ expected_result: expectedResult,
2253
+ observed_result: observedResult,
2254
+ route_module: routeModule,
2255
+ account_customer_context: accountCustomerContext,
2256
+ reproduction_status: rawReproductionStatus ? normalizeReproductionStatus(rawReproductionStatus) : (featureRequestClassified ? 'classified' : normalizeReproductionStatus(rawReproductionStatus)),
1839
2257
  reproduction_blocker: pickText(issueCaseSource, ['reproduction_blocker', 'reproductionBlocker', 'blocked_reason', 'blockedReason'], 1000)
1840
2258
  },
1841
2259
  issue_class: issueClass || 'missing_wrong_data',
1842
2260
  accepted_hypothesis: {
1843
2261
  statement: pickText(hypothesisSource, ['statement', 'hypothesis', 'root_cause', 'rootCause', 'summary'], 1200)
1844
- || (typeof source.accepted_hypothesis === 'string' ? cleanText(source.accepted_hypothesis, 1200) : ''),
1845
- falsifiable_test: pickText(hypothesisSource, ['falsifiable_test', 'falsifiableTest', 'test', 'proof', 'falsifier'], 1000),
1846
- evidence: cleanList(hypothesisSource.evidence || source.hypothesis_evidence || source.hypothesisEvidence, 10, 800)
2262
+ || hypothesisText,
2263
+ falsifiable_test: pickText(hypothesisSource, ['falsifiable_test', 'falsifiableTest', 'test', 'proof', 'falsifier'], 1000)
2264
+ || (failingPathText ? "Verify the accepted hypothesis against the failing path evidence: ".concat(failingPathText) : ''),
2265
+ evidence: cleanList(hypothesisSource.evidence || source.hypothesis_evidence || source.hypothesisEvidence, 10, 800).length
2266
+ ? cleanList(hypothesisSource.evidence || source.hypothesis_evidence || source.hypothesisEvidence, 10, 800)
2267
+ : diagnosisEvidence.map(function (entry) { return [entry.artifactPath, entry.summary].filter(Boolean).join(': '); }).filter(Boolean).slice(0, 10)
1847
2268
  },
1848
- rejected_alternatives: cleanList(source.rejected_alternatives || source.rejectedAlternatives, 10, 700),
2269
+ rejected_alternatives: normalizeSupportDiagnosisRejectedAlternatives(source.rejected_alternatives || source.rejectedAlternatives),
1849
2270
  failing_path: {
1850
2271
  frontend: pickText(failingPathSource, ['frontend', 'frontend_path', 'frontendPath', 'eventPath'], 700),
1851
2272
  backend: pickText(failingPathSource, ['backend', 'backend_path', 'backendPath', 'methodPublicationPath'], 700),
1852
2273
  shared_library: pickText(failingPathSource, ['shared_library', 'sharedLibrary', 'library', 'lib'], 700),
1853
2274
  data_query: pickText(failingPathSource, ['data_query', 'dataQuery', 'query'], 700),
1854
- description: pickText(failingPathSource, ['description', 'path', 'summary'], 1200) || cleanText(source.failing_path, 1200)
2275
+ description: pickText(failingPathSource, ['description', 'path', 'summary'], 1200) || failingPathText
1855
2276
  },
1856
2277
  owner_files: ownerFiles,
1857
2278
  proof_plan: {
1858
- before: pickText(proofPlanSource, ['before', 'before_state', 'beforeState', 'precondition'], 1000),
1859
- before_state_unavailable_reason: pickText(proofPlanSource, ['before_state_unavailable_reason', 'beforeStateUnavailableReason', 'before_unavailable_reason'], 1000),
1860
- action: pickText(proofPlanSource, ['action', 'browser_action', 'browserAction', 'steps'], 1000),
1861
- after: pickText(proofPlanSource, ['after', 'after_state', 'afterState', 'expected_after'], 1000),
1862
- business_assertion: pickText(proofPlanSource, ['business_assertion', 'businessAssertion', 'assertion'], 1000),
2279
+ before: proofPlanBefore,
2280
+ before_state_unavailable_reason: proofPlanBeforeUnavailable,
2281
+ action: proofPlanAction,
2282
+ after: proofPlanAfter,
2283
+ business_assertion: proofPlanBusinessAssertion,
1863
2284
  route: pickText(proofPlanSource, ['route', 'url'], 500),
1864
- data_assertion: pickText(proofPlanSource, ['data_assertion', 'dataAssertion', 'mongo_delta', 'mongoDelta'], 1000),
1865
- artifact_expectation: pickText(proofPlanSource, ['artifact_expectation', 'artifactExpectation', 'artifact', 'screenshot'], 1000),
2285
+ data_assertion: proofPlanDataAssertion,
2286
+ artifact_expectation: proofPlanArtifactExpectation,
1866
2287
  business_proof_contract: businessProofContract
1867
2288
  },
1868
2289
  similar_tickets: normalizeSupportDiagnosisHints(source.similar_tickets || source.similarTickets),
1869
2290
  similar_commits: normalizeSupportDiagnosisHints(source.similar_commits || source.similarCommits),
1870
- evidence: normalizeSupportDiagnosisEvidence(source.evidence),
2291
+ evidence: diagnosisEvidence,
1871
2292
  status: cleanText(source.status, 80).toLowerCase() || 'incomplete',
1872
2293
  updatedAt: isoNow(now || source.updatedAt || source.updated_at)
1873
2294
  };
@@ -1877,7 +2298,7 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
1877
2298
  return gate;
1878
2299
  }
1879
2300
  function extractResolveIOSupportDiagnosisGateFromText(value, now) {
1880
- var e_6, _a;
2301
+ var e_10, _a;
1881
2302
  var text = String(value || '').trim();
1882
2303
  if (!text) {
1883
2304
  return undefined;
@@ -1905,12 +2326,12 @@ function extractResolveIOSupportDiagnosisGateFromText(value, now) {
1905
2326
  }
1906
2327
  }
1907
2328
  }
1908
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
2329
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
1909
2330
  finally {
1910
2331
  try {
1911
2332
  if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
1912
2333
  }
1913
- finally { if (e_6) throw e_6.error; }
2334
+ finally { if (e_10) throw e_10.error; }
1914
2335
  }
1915
2336
  return undefined;
1916
2337
  }
@@ -2073,7 +2494,7 @@ function supportStatusLooksPassed(value) {
2073
2494
  return /\b(pass|passed|success|succeeded|complete|completed|ready|not_required|not required)\b/i.test(cleanText(value, 200));
2074
2495
  }
2075
2496
  function nestedObject(source) {
2076
- var e_7, _a;
2497
+ var e_11, _a;
2077
2498
  var keys = [];
2078
2499
  for (var _i = 1; _i < arguments.length; _i++) {
2079
2500
  keys[_i - 1] = arguments[_i];
@@ -2087,17 +2508,17 @@ function nestedObject(source) {
2087
2508
  }
2088
2509
  }
2089
2510
  }
2090
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
2511
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
2091
2512
  finally {
2092
2513
  try {
2093
2514
  if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
2094
2515
  }
2095
- finally { if (e_7) throw e_7.error; }
2516
+ finally { if (e_11) throw e_11.error; }
2096
2517
  }
2097
2518
  return {};
2098
2519
  }
2099
2520
  function resolveSupportReplyReleaseGate(input) {
2100
- var e_8, _a;
2521
+ var e_12, _a;
2101
2522
  var _b;
2102
2523
  var releaseEvidence = cleanObject(input.releaseEvidence);
2103
2524
  var releaseStatus = cleanText(input.releaseStatus
@@ -2168,12 +2589,12 @@ function resolveSupportReplyReleaseGate(input) {
2168
2589
  blockers.push("missing_".concat(field));
2169
2590
  }
2170
2591
  }
2171
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
2592
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
2172
2593
  finally {
2173
2594
  try {
2174
2595
  if (missingCommitProofFields_1_1 && !missingCommitProofFields_1_1.done && (_a = missingCommitProofFields_1.return)) _a.call(missingCommitProofFields_1);
2175
2596
  }
2176
- finally { if (e_8) throw e_8.error; }
2597
+ finally { if (e_12) throw e_12.error; }
2177
2598
  }
2178
2599
  var shouldEvaluateHotfix = statusBlocked || commitProofRequired || Object.keys(hotfixEvidence).length > 0;
2179
2600
  var hotfixContinuation = shouldEvaluateHotfix
@@ -2219,7 +2640,7 @@ function supportBusinessAssertionRouteOnly(value) {
2219
2640
  return /^(route_probe_pass|route_only_pass|route_pass|route_probe|route_loaded)$/i.test(cleanText(value, 80));
2220
2641
  }
2221
2642
  function normalizeSupportBusinessProofAssertions(input) {
2222
- var e_9, _a;
2643
+ var e_13, _a;
2223
2644
  var gate = normalizeResolveIOSupportDiagnosisGate(input.diagnosisGate);
2224
2645
  var proofPlan = gate === null || gate === void 0 ? void 0 : gate.proof_plan;
2225
2646
  var proofContract = proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.business_proof_contract;
@@ -2253,12 +2674,12 @@ function normalizeSupportBusinessProofAssertions(input) {
2253
2674
  });
2254
2675
  }
2255
2676
  }
2256
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2677
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
2257
2678
  finally {
2258
2679
  try {
2259
2680
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2260
2681
  }
2261
- finally { if (e_9) throw e_9.error; }
2682
+ finally { if (e_13) throw e_13.error; }
2262
2683
  }
2263
2684
  var status = cleanText(input.businessAssertionStatus || input.outcomeLabel, 80);
2264
2685
  if (!assertions.length && (supportBusinessAssertionPassed(status) || supportBusinessAssertionRouteOnly(status) || supportBusinessAssertionFailed(status))) {
@@ -2348,7 +2769,7 @@ function supportBusinessProofAssertionHasStructuredContractMapping(assertion, ga
2348
2769
  return routeMatches && actionMatches && expectedStateMatches && hasBusinessDataProof;
2349
2770
  }
2350
2771
  function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2351
- var e_10, _a;
2772
+ var e_14, _a;
2352
2773
  if (!gate) {
2353
2774
  return false;
2354
2775
  }
@@ -2388,12 +2809,12 @@ function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2388
2809
  }
2389
2810
  }
2390
2811
  }
2391
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
2812
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
2392
2813
  finally {
2393
2814
  try {
2394
2815
  if (proofWords_1_1 && !proofWords_1_1.done && (_a = proofWords_1.return)) _a.call(proofWords_1);
2395
2816
  }
2396
- finally { if (e_10) throw e_10.error; }
2817
+ finally { if (e_14) throw e_14.error; }
2397
2818
  }
2398
2819
  return overlap >= Math.min(5, Math.max(3, Math.ceil(proofWords.size * 0.45)));
2399
2820
  }
@@ -3918,7 +4339,7 @@ function supportManagerRequiredResetEvidenceForContract(contract) {
3918
4339
  ], false))).slice(0, 16);
3919
4340
  }
3920
4341
  function validateResolveIOSupportNextActionContract(value) {
3921
- var e_11, _a;
4342
+ var e_15, _a;
3922
4343
  var _b, _c, _d, _e, _f;
3923
4344
  var contract = cleanObject(value);
3924
4345
  var blockers = [];
@@ -3940,12 +4361,12 @@ function validateResolveIOSupportNextActionContract(value) {
3940
4361
  }
3941
4362
  }
3942
4363
  }
3943
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
4364
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
3944
4365
  finally {
3945
4366
  try {
3946
4367
  if (requiredStringFields_1_1 && !requiredStringFields_1_1.done && (_a = requiredStringFields_1.return)) _a.call(requiredStringFields_1);
3947
4368
  }
3948
- finally { if (e_11) throw e_11.error; }
4369
+ finally { if (e_15) throw e_15.error; }
3949
4370
  }
3950
4371
  if (!Array.isArray(contract.nextCommands) || !contract.nextCommands.length) {
3951
4372
  blockers.push('NextActionContract.nextCommands must include at least the primary command.');
@@ -4964,7 +5385,7 @@ function buildResolveIOSupportV5ScopeDigest(input) {
4964
5385
  return raw.slice(0, maxChars);
4965
5386
  }
4966
5387
  function buildResolveIOSupportV5MicrotaskLedger(input) {
4967
- var e_12, _a;
5388
+ var e_16, _a;
4968
5389
  var existing = Array.isArray(input.existing) ? input.existing : [];
4969
5390
  var completedByObjective = new Map();
4970
5391
  try {
@@ -4975,12 +5396,12 @@ function buildResolveIOSupportV5MicrotaskLedger(input) {
4975
5396
  }
4976
5397
  }
4977
5398
  }
4978
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
5399
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
4979
5400
  finally {
4980
5401
  try {
4981
5402
  if (existing_1_1 && !existing_1_1.done && (_a = existing_1.return)) _a.call(existing_1);
4982
5403
  }
4983
- finally { if (e_12) throw e_12.error; }
5404
+ finally { if (e_16) throw e_16.error; }
4984
5405
  }
4985
5406
  var now = isoNow(input.now);
4986
5407
  var requirements = cleanList(input.requirements, 30, 240);
@@ -6549,6 +6970,14 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6549
6970
  ownerFiles: (diagnosisGate === null || diagnosisGate === void 0 ? void 0 : diagnosisGate.owner_files) || targetFiles,
6550
6971
  text: input.bundle.supportV5ScopeDigest || input.bundle.supportV5SupervisorState.currentGoal
6551
6972
  });
6973
+ var diagnosisRetryScaffold = diagnosisActive
6974
+ ? buildResolveIOSupportDiagnosisRetryScaffold({
6975
+ bundle: input.bundle,
6976
+ diagnosisGate: diagnosisGate,
6977
+ evidencePack: diagnosisEvidencePack,
6978
+ now: input.now
6979
+ })
6980
+ : undefined;
6552
6981
  var promptProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(input.bundle.supportV5IssueClassProbePlan, diagnosisValidation.normalized || diagnosisGate, input.now);
6553
6982
  var promptProbePlan = promptProbePlanValidation.valid
6554
6983
  ? promptProbePlanValidation.normalized
@@ -6595,7 +7024,8 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6595
7024
  name: 'root_cause_first_diagnosis_contract',
6596
7025
  text: [
6597
7026
  'Before any product-code repair, produce strict JSON only:',
6598
- '{"support_diagnosis_gate":{"issue_case":{"customer_complaint":"","expected_result":"","observed_result":"","route_module":"","account_customer_context":"","reproduction_status":"reproduced|blocked|classified","reproduction_blocker":""},"issue_class":"no_op_submit|missing_wrong_data|filter_query_mismatch|invoice_pdf_export|upload_import|route_auth_hydration|slow_query_performance","accepted_hypothesis":{"statement":"","falsifiable_test":"","evidence":[""]},"rejected_alternatives":[""],"failing_path":{"frontend":"","backend":"","shared_library":"","data_query":"","description":""},"owner_files":["small/exact/file.ts"],"proof_plan":{"before":"","before_state_unavailable_reason":"","action":"","after":"","business_assertion":"","route":"","data_assertion":"","artifact_expectation":"","business_proof_contract":{"issue_class":"same as diagnosis issue_class","setup_state":"","action_under_test":"","expected_business_state_change":"","prohibited_false_pass":"Route load, screenshot, scorecard, or model claim alone is not acceptance.","proof_artifacts":["browser trace/screenshot/json/mongo delta"],"data_or_dom_assertion":""}},"similar_tickets":[],"similar_commits":[],"evidence":[{"type":"ticket|browser|mongo|log|code|commit|qa|other","summary":"","artifactPath":""}],"status":"passed"}}',
7027
+ 'Required JSON shape: {"support_diagnosis_gate":{"issue_case":{"customer_complaint":"concrete customer complaint","expected_result":"concrete expected business result","observed_result":"concrete observed/reproduced behavior","route_module":"exact route/module/workflow","account_customer_context":"affected client/account/user","reproduction_status":"reproduced|blocked|classified","reproduction_blocker":"required only when blocked"},"issue_class":"no_op_submit|missing_wrong_data|filter_query_mismatch|invoice_pdf_export|upload_import|route_auth_hydration|slow_query_performance","accepted_hypothesis":{"statement":"one falsifiable root-cause theory","falsifiable_test":"exact test that could disprove it","evidence":["typed evidence with artifact path or concrete code/data citation"]},"rejected_alternatives":["rejected theory plus why"],"failing_path":{"frontend":"frontend event/path if applicable","backend":"method/publication/query if applicable","shared_library":"shared library path if applicable","data_query":"data/query path if applicable","description":"end-to-end failing path"},"owner_files":["small/exact/product-file.ts"],"proof_plan":{"before":"before-state business proof","before_state_unavailable_reason":"only if before proof cannot exist","action":"exact user/system action","after":"expected after-state business proof","business_assertion":"pass/fail assertion tied to customer issue","route":"route/workflow under test","data_assertion":"DOM/data/Mongo assertion","artifact_expectation":"specific artifacts to capture","business_proof_contract":{"issue_class":"same as diagnosis issue_class","setup_state":"setup state","action_under_test":"action under test","expected_business_state_change":"expected state change","prohibited_false_pass":"Route load, screenshot, scorecard, or model claim alone is not acceptance.","proof_artifacts":["specific DOM/data/Mongo/network/screenshot artifacts"],"data_or_dom_assertion":"assertion checked in DOM/data/Mongo"}},"similar_tickets":[],"similar_commits":[],"evidence":[{"type":"ticket|browser|mongo|log|code|commit|qa|other","summary":"concrete evidence summary","artifactPath":"path or code reference"}],"status":"passed"}}',
7028
+ 'Do not copy schema/example wording into the output. Empty strings, TODOs, placeholders, route-only proof, and ticket-only proof will fail validation.',
6599
7029
  'Owner files must be a small exact editable set, not directories, globs, generated wrappers, or broad repo areas.',
6600
7030
  'The accepted hypothesis must be falsifiable and backed by evidence; prior similar tickets or commits are hints only and cannot bypass fresh diagnosis.',
6601
7031
  'For reproduction_status="reproduced", evidence must include at least one browser, Mongo, log, or QA evidence object with artifactPath so the runner can replay the proof.',
@@ -6665,6 +7095,10 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6665
7095
  instruction: 'This JSON block is the diagnosis evidence pack. Do not request or invent a support-diagnosis-pack JSON file unless a concrete named ticket attachment/log is still absent from the staged support evidence context.'
6666
7096
  }, null, 2)
6667
7097
  } : undefined,
7098
+ diagnosisActive && diagnosisRetryScaffold ? {
7099
+ name: 'diagnosis_retry_scaffold',
7100
+ text: JSON.stringify(diagnosisRetryScaffold, null, 2)
7101
+ } : undefined,
6668
7102
  diagnosisActive && similarCaseHintsText ? {
6669
7103
  name: 'similar_accepted_fix_hints',
6670
7104
  text: similarCaseHintsText
@@ -6771,7 +7205,7 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6771
7205
  };
6772
7206
  }
6773
7207
  function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6774
- var e_13, _a, e_14, _b;
7208
+ var e_17, _a, e_18, _b;
6775
7209
  var byMicrotask = new Map();
6776
7210
  var bySection = new Map();
6777
7211
  var totalPromptTokenEstimate = 0;
@@ -6786,17 +7220,17 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6786
7220
  existing.calls += 1;
6787
7221
  byMicrotask.set(usage.microtaskId, existing);
6788
7222
  try {
6789
- for (var _e = (e_14 = void 0, __values(usage.promptSections || [])), _f = _e.next(); !_f.done; _f = _e.next()) {
7223
+ for (var _e = (e_18 = void 0, __values(usage.promptSections || [])), _f = _e.next(); !_f.done; _f = _e.next()) {
6790
7224
  var section = _f.value;
6791
7225
  bySection.set(section.name, (bySection.get(section.name) || 0) + section.tokenEstimate);
6792
7226
  }
6793
7227
  }
6794
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
7228
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
6795
7229
  finally {
6796
7230
  try {
6797
7231
  if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
6798
7232
  }
6799
- finally { if (e_14) throw e_14.error; }
7233
+ finally { if (e_18) throw e_18.error; }
6800
7234
  }
6801
7235
  var hardCap = usage.lane === 'qa' ? promptBudget.qaMicrotaskHardCap : promptBudget.buildMicrotaskHardCap;
6802
7236
  if ((usage.promptTokenEstimate || 0) > hardCap) {
@@ -6804,12 +7238,12 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
6804
7238
  }
6805
7239
  }
6806
7240
  }
6807
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
7241
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
6808
7242
  finally {
6809
7243
  try {
6810
7244
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
6811
7245
  }
6812
- finally { if (e_13) throw e_13.error; }
7246
+ finally { if (e_17) throw e_17.error; }
6813
7247
  }
6814
7248
  return {
6815
7249
  totalPromptTokenEstimate: totalPromptTokenEstimate,