@resolveio/server-lib 22.3.211 → 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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@resolveio/server-lib",
3
- "version": "22.3.211",
3
+ "version": "22.3.212",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -1458,6 +1458,174 @@ function buildResolveIOSupportDiagnosisEvidencePack(input) {
1458
1458
  generatedAt: generatedAt
1459
1459
  };
1460
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
+ }
1461
1629
  function normalizeSupportDiagnosisBusinessProofContract(value, issueClassHint) {
1462
1630
  var source = cleanObject(value);
1463
1631
  if (!Object.keys(source).length) {
@@ -1530,14 +1698,14 @@ function supportDiagnosisLooksLikeClassifiedFeatureRequest(source, issueCaseText
1530
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);
1531
1699
  }
1532
1700
  function normalizeSupportDiagnosisRejectedAlternatives(values) {
1533
- var e_5, _a;
1701
+ var e_6, _a;
1534
1702
  if (!Array.isArray(values)) {
1535
1703
  return cleanList(values, 10, 700);
1536
1704
  }
1537
1705
  var result = [];
1538
1706
  try {
1539
- for (var values_2 = __values(values), values_2_1 = values_2.next(); !values_2_1.done; values_2_1 = values_2.next()) {
1540
- var value = values_2_1.value;
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;
1541
1709
  var text = supportDiagnosisNarrativeText(value, 700);
1542
1710
  if (text && !result.includes(text)) {
1543
1711
  result.push(text);
@@ -1547,25 +1715,25 @@ function normalizeSupportDiagnosisRejectedAlternatives(values) {
1547
1715
  }
1548
1716
  }
1549
1717
  }
1550
- catch (e_5_1) { e_5 = { error: e_5_1 }; }
1718
+ catch (e_6_1) { e_6 = { error: e_6_1 }; }
1551
1719
  finally {
1552
1720
  try {
1553
- if (values_2_1 && !values_2_1.done && (_a = values_2.return)) _a.call(values_2);
1721
+ if (values_3_1 && !values_3_1.done && (_a = values_3.return)) _a.call(values_3);
1554
1722
  }
1555
- finally { if (e_5) throw e_5.error; }
1723
+ finally { if (e_6) throw e_6.error; }
1556
1724
  }
1557
1725
  return result;
1558
1726
  }
1559
1727
  function normalizeSupportDiagnosisProofPlanRows(values) {
1560
- var e_6, _a;
1728
+ var e_7, _a;
1561
1729
  if (!Array.isArray(values)) {
1562
1730
  return {};
1563
1731
  }
1564
1732
  var actions = [];
1565
1733
  var proofRequired = [];
1566
1734
  try {
1567
- for (var values_3 = __values(values), values_3_1 = values_3.next(); !values_3_1.done; values_3_1 = values_3.next()) {
1568
- var row = values_3_1.value;
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;
1569
1737
  var source = cleanObject(row);
1570
1738
  var action = pickText(source, ['action', 'step', 'browser_action', 'browserAction', 'task'], 500) || supportDiagnosisNarrativeText(row, 500);
1571
1739
  var proof = pickText(source, ['proof_required', 'proofRequired', 'expected', 'expected_result', 'expectedResult', 'assertion', 'business_assertion', 'businessAssertion'], 700);
@@ -1577,12 +1745,12 @@ function normalizeSupportDiagnosisProofPlanRows(values) {
1577
1745
  }
1578
1746
  }
1579
1747
  }
1580
- catch (e_6_1) { e_6 = { error: e_6_1 }; }
1748
+ catch (e_7_1) { e_7 = { error: e_7_1 }; }
1581
1749
  finally {
1582
1750
  try {
1583
- if (values_3_1 && !values_3_1.done && (_a = values_3.return)) _a.call(values_3);
1751
+ if (values_4_1 && !values_4_1.done && (_a = values_4.return)) _a.call(values_4);
1584
1752
  }
1585
- finally { if (e_6) throw e_6.error; }
1753
+ finally { if (e_7) throw e_7.error; }
1586
1754
  }
1587
1755
  return {
1588
1756
  action: actions.join(' | ').slice(0, 1000),
@@ -1592,7 +1760,7 @@ function normalizeSupportDiagnosisProofPlanRows(values) {
1592
1760
  };
1593
1761
  }
1594
1762
  function normalizeOwnerFilePath(value) {
1595
- var e_7, _a;
1763
+ var e_8, _a;
1596
1764
  var normalized = cleanListEntryText(value, 500)
1597
1765
  .replace(/\\/g, '/')
1598
1766
  .replace(/^\.\/+/, '')
@@ -1617,12 +1785,12 @@ function normalizeOwnerFilePath(value) {
1617
1785
  }
1618
1786
  }
1619
1787
  }
1620
- catch (e_7_1) { e_7 = { error: e_7_1 }; }
1788
+ catch (e_8_1) { e_8 = { error: e_8_1 }; }
1621
1789
  finally {
1622
1790
  try {
1623
1791
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1624
1792
  }
1625
- finally { if (e_7) throw e_7.error; }
1793
+ finally { if (e_8) throw e_8.error; }
1626
1794
  }
1627
1795
  return normalized;
1628
1796
  }
@@ -1631,7 +1799,7 @@ function isResolveIOSupportGeneratedAngularWrapperPath(value) {
1631
1799
  return /(?:^|\/)angular\/app\/(?:methods|publications)\.ts$/i.test(normalized);
1632
1800
  }
1633
1801
  function ownerFileComparablePathKeys(value) {
1634
- var e_8, _a;
1802
+ var e_9, _a;
1635
1803
  var normalized = normalizeOwnerFilePath(value);
1636
1804
  if (!normalized) {
1637
1805
  return [];
@@ -1653,12 +1821,12 @@ function ownerFileComparablePathKeys(value) {
1653
1821
  }
1654
1822
  }
1655
1823
  }
1656
- catch (e_8_1) { e_8 = { error: e_8_1 }; }
1824
+ catch (e_9_1) { e_9 = { error: e_9_1 }; }
1657
1825
  finally {
1658
1826
  try {
1659
1827
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
1660
1828
  }
1661
- finally { if (e_8) throw e_8.error; }
1829
+ finally { if (e_9) throw e_9.error; }
1662
1830
  }
1663
1831
  return Array.from(keys);
1664
1832
  }
@@ -1710,7 +1878,7 @@ function supportDiagnosisTextLooksGeneric(value, minimumLength) {
1710
1878
  return compact.length < minimumLength
1711
1879
  || meaningfulWords.length < 3
1712
1880
  || /^(n a|na|none|null|unknown|todo|tbd|pending|fix|bug|issue|problem|broken|not working|works|should work)$/i.test(compact)
1713
- || /\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)
1714
1882
  || /^(fix|debug|investigate|check|look into|test|verify)( the)? (issue|bug|problem|ticket|route|page)$/i.test(compact)
1715
1883
  || /^(the )?(issue|bug|problem|ticket|route|page)( is)? (fixed|broken|not working|wrong)$/i.test(compact);
1716
1884
  }
@@ -2130,7 +2298,7 @@ function normalizeResolveIOSupportDiagnosisGate(value, now) {
2130
2298
  return gate;
2131
2299
  }
2132
2300
  function extractResolveIOSupportDiagnosisGateFromText(value, now) {
2133
- var e_9, _a;
2301
+ var e_10, _a;
2134
2302
  var text = String(value || '').trim();
2135
2303
  if (!text) {
2136
2304
  return undefined;
@@ -2158,12 +2326,12 @@ function extractResolveIOSupportDiagnosisGateFromText(value, now) {
2158
2326
  }
2159
2327
  }
2160
2328
  }
2161
- catch (e_9_1) { e_9 = { error: e_9_1 }; }
2329
+ catch (e_10_1) { e_10 = { error: e_10_1 }; }
2162
2330
  finally {
2163
2331
  try {
2164
2332
  if (candidates_1_1 && !candidates_1_1.done && (_a = candidates_1.return)) _a.call(candidates_1);
2165
2333
  }
2166
- finally { if (e_9) throw e_9.error; }
2334
+ finally { if (e_10) throw e_10.error; }
2167
2335
  }
2168
2336
  return undefined;
2169
2337
  }
@@ -2326,7 +2494,7 @@ function supportStatusLooksPassed(value) {
2326
2494
  return /\b(pass|passed|success|succeeded|complete|completed|ready|not_required|not required)\b/i.test(cleanText(value, 200));
2327
2495
  }
2328
2496
  function nestedObject(source) {
2329
- var e_10, _a;
2497
+ var e_11, _a;
2330
2498
  var keys = [];
2331
2499
  for (var _i = 1; _i < arguments.length; _i++) {
2332
2500
  keys[_i - 1] = arguments[_i];
@@ -2340,17 +2508,17 @@ function nestedObject(source) {
2340
2508
  }
2341
2509
  }
2342
2510
  }
2343
- catch (e_10_1) { e_10 = { error: e_10_1 }; }
2511
+ catch (e_11_1) { e_11 = { error: e_11_1 }; }
2344
2512
  finally {
2345
2513
  try {
2346
2514
  if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1);
2347
2515
  }
2348
- finally { if (e_10) throw e_10.error; }
2516
+ finally { if (e_11) throw e_11.error; }
2349
2517
  }
2350
2518
  return {};
2351
2519
  }
2352
2520
  function resolveSupportReplyReleaseGate(input) {
2353
- var e_11, _a;
2521
+ var e_12, _a;
2354
2522
  var _b;
2355
2523
  var releaseEvidence = cleanObject(input.releaseEvidence);
2356
2524
  var releaseStatus = cleanText(input.releaseStatus
@@ -2421,12 +2589,12 @@ function resolveSupportReplyReleaseGate(input) {
2421
2589
  blockers.push("missing_".concat(field));
2422
2590
  }
2423
2591
  }
2424
- catch (e_11_1) { e_11 = { error: e_11_1 }; }
2592
+ catch (e_12_1) { e_12 = { error: e_12_1 }; }
2425
2593
  finally {
2426
2594
  try {
2427
2595
  if (missingCommitProofFields_1_1 && !missingCommitProofFields_1_1.done && (_a = missingCommitProofFields_1.return)) _a.call(missingCommitProofFields_1);
2428
2596
  }
2429
- finally { if (e_11) throw e_11.error; }
2597
+ finally { if (e_12) throw e_12.error; }
2430
2598
  }
2431
2599
  var shouldEvaluateHotfix = statusBlocked || commitProofRequired || Object.keys(hotfixEvidence).length > 0;
2432
2600
  var hotfixContinuation = shouldEvaluateHotfix
@@ -2472,7 +2640,7 @@ function supportBusinessAssertionRouteOnly(value) {
2472
2640
  return /^(route_probe_pass|route_only_pass|route_pass|route_probe|route_loaded)$/i.test(cleanText(value, 80));
2473
2641
  }
2474
2642
  function normalizeSupportBusinessProofAssertions(input) {
2475
- var e_12, _a;
2643
+ var e_13, _a;
2476
2644
  var gate = normalizeResolveIOSupportDiagnosisGate(input.diagnosisGate);
2477
2645
  var proofPlan = gate === null || gate === void 0 ? void 0 : gate.proof_plan;
2478
2646
  var proofContract = proofPlan === null || proofPlan === void 0 ? void 0 : proofPlan.business_proof_contract;
@@ -2506,12 +2674,12 @@ function normalizeSupportBusinessProofAssertions(input) {
2506
2674
  });
2507
2675
  }
2508
2676
  }
2509
- catch (e_12_1) { e_12 = { error: e_12_1 }; }
2677
+ catch (e_13_1) { e_13 = { error: e_13_1 }; }
2510
2678
  finally {
2511
2679
  try {
2512
2680
  if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
2513
2681
  }
2514
- finally { if (e_12) throw e_12.error; }
2682
+ finally { if (e_13) throw e_13.error; }
2515
2683
  }
2516
2684
  var status = cleanText(input.businessAssertionStatus || input.outcomeLabel, 80);
2517
2685
  if (!assertions.length && (supportBusinessAssertionPassed(status) || supportBusinessAssertionRouteOnly(status) || supportBusinessAssertionFailed(status))) {
@@ -2601,7 +2769,7 @@ function supportBusinessProofAssertionHasStructuredContractMapping(assertion, ga
2601
2769
  return routeMatches && actionMatches && expectedStateMatches && hasBusinessDataProof;
2602
2770
  }
2603
2771
  function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2604
- var e_13, _a;
2772
+ var e_14, _a;
2605
2773
  if (!gate) {
2606
2774
  return false;
2607
2775
  }
@@ -2641,12 +2809,12 @@ function supportBusinessProofAssertionMatchesContract(assertion, gate) {
2641
2809
  }
2642
2810
  }
2643
2811
  }
2644
- catch (e_13_1) { e_13 = { error: e_13_1 }; }
2812
+ catch (e_14_1) { e_14 = { error: e_14_1 }; }
2645
2813
  finally {
2646
2814
  try {
2647
2815
  if (proofWords_1_1 && !proofWords_1_1.done && (_a = proofWords_1.return)) _a.call(proofWords_1);
2648
2816
  }
2649
- finally { if (e_13) throw e_13.error; }
2817
+ finally { if (e_14) throw e_14.error; }
2650
2818
  }
2651
2819
  return overlap >= Math.min(5, Math.max(3, Math.ceil(proofWords.size * 0.45)));
2652
2820
  }
@@ -4171,7 +4339,7 @@ function supportManagerRequiredResetEvidenceForContract(contract) {
4171
4339
  ], false))).slice(0, 16);
4172
4340
  }
4173
4341
  function validateResolveIOSupportNextActionContract(value) {
4174
- var e_14, _a;
4342
+ var e_15, _a;
4175
4343
  var _b, _c, _d, _e, _f;
4176
4344
  var contract = cleanObject(value);
4177
4345
  var blockers = [];
@@ -4193,12 +4361,12 @@ function validateResolveIOSupportNextActionContract(value) {
4193
4361
  }
4194
4362
  }
4195
4363
  }
4196
- catch (e_14_1) { e_14 = { error: e_14_1 }; }
4364
+ catch (e_15_1) { e_15 = { error: e_15_1 }; }
4197
4365
  finally {
4198
4366
  try {
4199
4367
  if (requiredStringFields_1_1 && !requiredStringFields_1_1.done && (_a = requiredStringFields_1.return)) _a.call(requiredStringFields_1);
4200
4368
  }
4201
- finally { if (e_14) throw e_14.error; }
4369
+ finally { if (e_15) throw e_15.error; }
4202
4370
  }
4203
4371
  if (!Array.isArray(contract.nextCommands) || !contract.nextCommands.length) {
4204
4372
  blockers.push('NextActionContract.nextCommands must include at least the primary command.');
@@ -5217,7 +5385,7 @@ function buildResolveIOSupportV5ScopeDigest(input) {
5217
5385
  return raw.slice(0, maxChars);
5218
5386
  }
5219
5387
  function buildResolveIOSupportV5MicrotaskLedger(input) {
5220
- var e_15, _a;
5388
+ var e_16, _a;
5221
5389
  var existing = Array.isArray(input.existing) ? input.existing : [];
5222
5390
  var completedByObjective = new Map();
5223
5391
  try {
@@ -5228,12 +5396,12 @@ function buildResolveIOSupportV5MicrotaskLedger(input) {
5228
5396
  }
5229
5397
  }
5230
5398
  }
5231
- catch (e_15_1) { e_15 = { error: e_15_1 }; }
5399
+ catch (e_16_1) { e_16 = { error: e_16_1 }; }
5232
5400
  finally {
5233
5401
  try {
5234
5402
  if (existing_1_1 && !existing_1_1.done && (_a = existing_1.return)) _a.call(existing_1);
5235
5403
  }
5236
- finally { if (e_15) throw e_15.error; }
5404
+ finally { if (e_16) throw e_16.error; }
5237
5405
  }
5238
5406
  var now = isoNow(input.now);
5239
5407
  var requirements = cleanList(input.requirements, 30, 240);
@@ -6802,6 +6970,14 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6802
6970
  ownerFiles: (diagnosisGate === null || diagnosisGate === void 0 ? void 0 : diagnosisGate.owner_files) || targetFiles,
6803
6971
  text: input.bundle.supportV5ScopeDigest || input.bundle.supportV5SupervisorState.currentGoal
6804
6972
  });
6973
+ var diagnosisRetryScaffold = diagnosisActive
6974
+ ? buildResolveIOSupportDiagnosisRetryScaffold({
6975
+ bundle: input.bundle,
6976
+ diagnosisGate: diagnosisGate,
6977
+ evidencePack: diagnosisEvidencePack,
6978
+ now: input.now
6979
+ })
6980
+ : undefined;
6805
6981
  var promptProbePlanValidation = validateResolveIOSupportIssueClassProbePlan(input.bundle.supportV5IssueClassProbePlan, diagnosisValidation.normalized || diagnosisGate, input.now);
6806
6982
  var promptProbePlan = promptProbePlanValidation.valid
6807
6983
  ? promptProbePlanValidation.normalized
@@ -6848,7 +7024,8 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6848
7024
  name: 'root_cause_first_diagnosis_contract',
6849
7025
  text: [
6850
7026
  'Before any product-code repair, produce strict JSON only:',
6851
- '{"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.',
6852
7029
  'Owner files must be a small exact editable set, not directories, globs, generated wrappers, or broad repo areas.',
6853
7030
  'The accepted hypothesis must be falsifiable and backed by evidence; prior similar tickets or commits are hints only and cannot bypass fresh diagnosis.',
6854
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.',
@@ -6918,6 +7095,10 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
6918
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.'
6919
7096
  }, null, 2)
6920
7097
  } : undefined,
7098
+ diagnosisActive && diagnosisRetryScaffold ? {
7099
+ name: 'diagnosis_retry_scaffold',
7100
+ text: JSON.stringify(diagnosisRetryScaffold, null, 2)
7101
+ } : undefined,
6921
7102
  diagnosisActive && similarCaseHintsText ? {
6922
7103
  name: 'similar_accepted_fix_hints',
6923
7104
  text: similarCaseHintsText
@@ -7024,7 +7205,7 @@ function buildResolveIOSupportV5MicrotaskPrompt(input) {
7024
7205
  };
7025
7206
  }
7026
7207
  function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
7027
- var e_16, _a, e_17, _b;
7208
+ var e_17, _a, e_18, _b;
7028
7209
  var byMicrotask = new Map();
7029
7210
  var bySection = new Map();
7030
7211
  var totalPromptTokenEstimate = 0;
@@ -7039,17 +7220,17 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
7039
7220
  existing.calls += 1;
7040
7221
  byMicrotask.set(usage.microtaskId, existing);
7041
7222
  try {
7042
- for (var _e = (e_17 = 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()) {
7043
7224
  var section = _f.value;
7044
7225
  bySection.set(section.name, (bySection.get(section.name) || 0) + section.tokenEstimate);
7045
7226
  }
7046
7227
  }
7047
- catch (e_17_1) { e_17 = { error: e_17_1 }; }
7228
+ catch (e_18_1) { e_18 = { error: e_18_1 }; }
7048
7229
  finally {
7049
7230
  try {
7050
7231
  if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
7051
7232
  }
7052
- finally { if (e_17) throw e_17.error; }
7233
+ finally { if (e_18) throw e_18.error; }
7053
7234
  }
7054
7235
  var hardCap = usage.lane === 'qa' ? promptBudget.qaMicrotaskHardCap : promptBudget.buildMicrotaskHardCap;
7055
7236
  if ((usage.promptTokenEstimate || 0) > hardCap) {
@@ -7057,12 +7238,12 @@ function summarizeResolveIOSupportV5MicrotaskUsage(bundle) {
7057
7238
  }
7058
7239
  }
7059
7240
  }
7060
- catch (e_16_1) { e_16 = { error: e_16_1 }; }
7241
+ catch (e_17_1) { e_17 = { error: e_17_1 }; }
7061
7242
  finally {
7062
7243
  try {
7063
7244
  if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
7064
7245
  }
7065
- finally { if (e_16) throw e_16.error; }
7246
+ finally { if (e_17) throw e_17.error; }
7066
7247
  }
7067
7248
  return {
7068
7249
  totalPromptTokenEstimate: totalPromptTokenEstimate,