@resolveio/server-lib 22.3.134 → 22.3.136

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.
@@ -241,6 +241,22 @@ function ownerFileLooksBroad(value) {
241
241
  || /^(\.|src|server|angular|client|app|lib|packages?)$/i.test(normalized)
242
242
  || /(^|\/)(node_modules|dist|build|coverage|\.git)(\/|$)/i.test(normalized);
243
243
  }
244
+ function proofPlanLooksRouteOnly(proofPlan) {
245
+ var assertionText = cleanText([
246
+ proofPlan.business_assertion,
247
+ proofPlan.action,
248
+ proofPlan.after,
249
+ proofPlan.data_assertion,
250
+ proofPlan.artifact_expectation
251
+ ].filter(Boolean).join(' '), 3000).toLowerCase();
252
+ if (!assertionText) {
253
+ return false;
254
+ }
255
+ var routeOnlySignal = /\b(route|page|screen|dashboard|url|component|shell)\b/.test(assertionText)
256
+ && /\b(loads?|loaded|renders?|rendered|opens?|opened|visible|visibility|hydrates?|hydrated|screenshot)\b/.test(assertionText);
257
+ var businessSignal = /\b(save|saved|persist|persisted|create|created|update|updated|delete|deleted|filter|filtered|exclude|excluded|include|included|row|rows|record|records|count|counts|total|totals|value|values|data|mongo|query|result|results|invoice|pdf|export|download|upload|import|dropdown|selection|selected|form|submit|submitted|validation|error message|customer|account|user|permission|auth|control|button|status|calculation|performance|duration|latency)\b/.test(assertionText);
258
+ return routeOnlySignal && !businessSignal;
259
+ }
244
260
  function normalizeResolveIOSupportDiagnosisGate(value, now) {
245
261
  var source = cleanObject(value);
246
262
  if (!Object.keys(source).length) {
@@ -409,6 +425,9 @@ function validateResolveIOSupportDiagnosisGate(value, options) {
409
425
  if (!normalized.proof_plan.business_assertion) {
410
426
  blockers.push('Diagnosis proof_plan.business_assertion is required.');
411
427
  }
428
+ if (proofPlanLooksRouteOnly(normalized.proof_plan)) {
429
+ blockers.push('Diagnosis proof_plan cannot be route-load, screen-visible, or screenshot-only; it must name the business state/data/control change that proves the issue is fixed.');
430
+ }
412
431
  if (!normalized.evidence.length) {
413
432
  blockers.push('Diagnosis evidence must include ticket/code/browser/log/Mongo proof.');
414
433
  }
@@ -636,86 +655,45 @@ function decideResolveIOSupportV5RepairGate(input) {
636
655
  summary: input.blocker
637
656
  }
638
657
  }); };
639
- if (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) {
640
- var recoveryPlan_1 = recoveryPlanFor('park_repeated_failure', repeatedFailure.reason, repeatedFailure.failureClass, true);
658
+ var recoveryFieldsFor = function (recoveryPlan) {
659
+ var recoveryCheckpoint = recoveryCheckpointFor(recoveryPlan);
641
660
  return {
642
- action: 'park_repeated_failure',
643
- canEditProductCode: false,
644
- blockers: [repeatedFailure.reason],
645
- ownerFiles: ownerFiles,
646
- issueClass: (_c = diagnosisValidation.normalized) === null || _c === void 0 ? void 0 : _c.issue_class,
647
- proofPlan: (_d = diagnosisValidation.normalized) === null || _d === void 0 ? void 0 : _d.proof_plan,
648
- outsideOwnerFiles: outsideOwnerFiles,
649
- repeatedFailure: repeatedFailure,
650
- diagnosisValidation: diagnosisValidation,
651
- recoveryPlan: recoveryPlan_1,
652
- recoveryCheckpoint: recoveryCheckpointFor(recoveryPlan_1)
661
+ recoveryPlan: recoveryPlan,
662
+ recoveryCheckpoint: recoveryCheckpoint,
663
+ recoveryEvidenceProbe: (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryEvidenceProbe)({
664
+ checkpoint: recoveryCheckpoint,
665
+ current: {
666
+ lane: 'build',
667
+ stepType: activeStepType || 'build_repair',
668
+ failureClass: failureClass || 'unknown',
669
+ blocker: input.blocker || (diagnosisValidation.blockers || []).join(' | '),
670
+ evidenceHash: input.evidenceHash,
671
+ changedFiles: cleanList(input.changedFiles, 40, 500),
672
+ summary: input.blocker
673
+ }
674
+ })
653
675
  };
676
+ };
677
+ if (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) {
678
+ var recoveryPlan_1 = recoveryPlanFor('park_repeated_failure', repeatedFailure.reason, repeatedFailure.failureClass, true);
679
+ return __assign({ action: 'park_repeated_failure', canEditProductCode: false, blockers: [repeatedFailure.reason], ownerFiles: ownerFiles, issueClass: (_c = diagnosisValidation.normalized) === null || _c === void 0 ? void 0 : _c.issue_class, proofPlan: (_d = diagnosisValidation.normalized) === null || _d === void 0 ? void 0 : _d.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_1));
654
680
  }
655
681
  if (failureClass === 'infra' || failureClass === 'compile') {
656
682
  var recoveryPlan_2 = recoveryPlanFor('retry_infra', 'support_v5_infra_or_compile_repair_required', failureClass, false);
657
- return {
658
- action: 'infra_repair_only',
659
- canEditProductCode: false,
660
- blockers: ['Infra/compile/Puppeteer/startup failures must be repaired in the harness lane before product-code repair.'],
661
- ownerFiles: ownerFiles,
662
- issueClass: (_e = diagnosisValidation.normalized) === null || _e === void 0 ? void 0 : _e.issue_class,
663
- proofPlan: (_f = diagnosisValidation.normalized) === null || _f === void 0 ? void 0 : _f.proof_plan,
664
- outsideOwnerFiles: outsideOwnerFiles,
665
- repeatedFailure: repeatedFailure,
666
- diagnosisValidation: diagnosisValidation,
667
- recoveryPlan: recoveryPlan_2,
668
- recoveryCheckpoint: recoveryCheckpointFor(recoveryPlan_2)
669
- };
683
+ return __assign({ action: 'infra_repair_only', canEditProductCode: false, blockers: ['Infra/compile/Puppeteer/startup failures must be repaired in the harness lane before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_e = diagnosisValidation.normalized) === null || _e === void 0 ? void 0 : _e.issue_class, proofPlan: (_f = diagnosisValidation.normalized) === null || _f === void 0 ? void 0 : _f.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_2));
670
684
  }
671
685
  if (activeStepType === 'diagnosis_gate' || !diagnosisValidation.valid) {
672
686
  var recoveryPlan_3 = recoveryPlanFor('continue', 'support_v5_diagnosis_gate_required', 'diagnosis', false);
673
- return {
674
- action: 'diagnose_only',
675
- canEditProductCode: false,
676
- blockers: diagnosisValidation.blockers.length
687
+ return __assign({ action: 'diagnose_only', canEditProductCode: false, blockers: diagnosisValidation.blockers.length
677
688
  ? diagnosisValidation.blockers
678
- : ['SupportDiagnosisGate is required before product-code repair.'],
679
- ownerFiles: ownerFiles,
680
- issueClass: (_g = diagnosisValidation.normalized) === null || _g === void 0 ? void 0 : _g.issue_class,
681
- proofPlan: (_h = diagnosisValidation.normalized) === null || _h === void 0 ? void 0 : _h.proof_plan,
682
- outsideOwnerFiles: outsideOwnerFiles,
683
- repeatedFailure: repeatedFailure,
684
- diagnosisValidation: diagnosisValidation,
685
- recoveryPlan: recoveryPlan_3,
686
- recoveryCheckpoint: recoveryCheckpointFor(recoveryPlan_3)
687
- };
689
+ : ['SupportDiagnosisGate is required before product-code repair.'], ownerFiles: ownerFiles, issueClass: (_g = diagnosisValidation.normalized) === null || _g === void 0 ? void 0 : _g.issue_class, proofPlan: (_h = diagnosisValidation.normalized) === null || _h === void 0 ? void 0 : _h.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_3));
688
690
  }
689
691
  if (outsideOwnerFiles.length) {
690
692
  var recoveryPlan_4 = recoveryPlanFor('continue', 'support_v5_out_of_scope_requires_diagnosis_revision', 'owner_scope', false);
691
- return {
692
- action: 'reject_out_of_scope',
693
- canEditProductCode: false,
694
- blockers: ["Changed files outside diagnosis owner_files; revise diagnosis with new evidence before broadening edits: ".concat(outsideOwnerFiles.join(', '))],
695
- ownerFiles: ownerFiles,
696
- issueClass: (_j = diagnosisValidation.normalized) === null || _j === void 0 ? void 0 : _j.issue_class,
697
- proofPlan: (_k = diagnosisValidation.normalized) === null || _k === void 0 ? void 0 : _k.proof_plan,
698
- outsideOwnerFiles: outsideOwnerFiles,
699
- repeatedFailure: repeatedFailure,
700
- diagnosisValidation: diagnosisValidation,
701
- recoveryPlan: recoveryPlan_4,
702
- recoveryCheckpoint: recoveryCheckpointFor(recoveryPlan_4)
703
- };
693
+ return __assign({ action: 'reject_out_of_scope', canEditProductCode: false, blockers: ["Changed files outside diagnosis owner_files; revise diagnosis with new evidence before broadening edits: ".concat(outsideOwnerFiles.join(', '))], ownerFiles: ownerFiles, issueClass: (_j = diagnosisValidation.normalized) === null || _j === void 0 ? void 0 : _j.issue_class, proofPlan: (_k = diagnosisValidation.normalized) === null || _k === void 0 ? void 0 : _k.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan_4));
704
694
  }
705
695
  var recoveryPlan = recoveryPlanFor('continue', 'support_v5_product_repair_allowed_after_diagnosis', failureClass || 'product_code', true);
706
- return {
707
- action: 'allow_product_repair',
708
- canEditProductCode: true,
709
- blockers: [],
710
- ownerFiles: ownerFiles,
711
- issueClass: (_l = diagnosisValidation.normalized) === null || _l === void 0 ? void 0 : _l.issue_class,
712
- proofPlan: (_m = diagnosisValidation.normalized) === null || _m === void 0 ? void 0 : _m.proof_plan,
713
- outsideOwnerFiles: outsideOwnerFiles,
714
- repeatedFailure: repeatedFailure,
715
- diagnosisValidation: diagnosisValidation,
716
- recoveryPlan: recoveryPlan,
717
- recoveryCheckpoint: recoveryCheckpointFor(recoveryPlan)
718
- };
696
+ return __assign({ action: 'allow_product_repair', canEditProductCode: true, blockers: [], ownerFiles: ownerFiles, issueClass: (_l = diagnosisValidation.normalized) === null || _l === void 0 ? void 0 : _l.issue_class, proofPlan: (_m = diagnosisValidation.normalized) === null || _m === void 0 ? void 0 : _m.proof_plan, outsideOwnerFiles: outsideOwnerFiles, repeatedFailure: repeatedFailure, diagnosisValidation: diagnosisValidation }, recoveryFieldsFor(recoveryPlan));
719
697
  }
720
698
  function applyResolveIOSupportDiagnosisGateToMicrotasks(bundle, diagnosisGate) {
721
699
  var validation = validateResolveIOSupportDiagnosisGate(diagnosisGate);
@@ -1007,7 +985,8 @@ function initializeResolveIOSupportV5State(input) {
1007
985
  : [],
1008
986
  supportV5FailureFingerprints: Array.isArray(existing.supportV5FailureFingerprints)
1009
987
  ? existing.supportV5FailureFingerprints.slice(-200)
1010
- : []
988
+ : [],
989
+ supportV5RecoveryEvidenceProbe: existing.supportV5RecoveryEvidenceProbe
1011
990
  };
1012
991
  return diagnosisValidation.valid && diagnosisValidation.normalized
1013
992
  ? applyResolveIOSupportDiagnosisGateToMicrotasks(initialized, diagnosisValidation.normalized)
@@ -1143,59 +1122,38 @@ function decideResolveIOSupportV5Continuation(bundle) {
1143
1122
  plan: recoveryPlan,
1144
1123
  current: last
1145
1124
  }); };
1125
+ var recoveryFieldsFor = function (recoveryPlan) {
1126
+ var recoveryCheckpoint = recoveryCheckpointFor(recoveryPlan);
1127
+ return {
1128
+ recoveryPlan: recoveryPlan,
1129
+ recoveryCheckpoint: recoveryCheckpoint,
1130
+ recoveryEvidenceProbe: (0, ai_runner_manager_policy_1.buildResolveIOAIManagerRecoveryEvidenceProbe)({
1131
+ checkpoint: recoveryCheckpoint,
1132
+ current: last
1133
+ })
1134
+ };
1135
+ };
1146
1136
  if (budgetExceeded) {
1147
1137
  var recoveryPlan_5 = recoveryPlanFor('manual_handoff', 'support_v5_budget_guard', {
1148
1138
  productRepairFailure: false
1149
1139
  });
1150
- return {
1151
- action: 'park',
1152
- reason: 'support_v5_budget_guard',
1153
- nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup',
1154
- repeatedNoProgressCount: repeatedNoProgressCount,
1155
- budgetExceeded: budgetExceeded,
1156
- recoveryPlan: recoveryPlan_5,
1157
- recoveryCheckpoint: recoveryCheckpointFor(recoveryPlan_5)
1158
- };
1140
+ return __assign({ action: 'park', reason: 'support_v5_budget_guard', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_5));
1159
1141
  }
1160
1142
  if (repeatedNoProgressCount > budget.maxRepeatedNoProgress) {
1161
1143
  var recoveryPlan_6 = recoveryPlanFor('park_repeated_failure', 'support_v5_repeated_no_progress', {
1162
1144
  productRepairFailure: true
1163
1145
  });
1164
- return {
1165
- action: 'park',
1166
- reason: 'support_v5_repeated_no_progress',
1167
- nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup',
1168
- repeatedNoProgressCount: repeatedNoProgressCount,
1169
- budgetExceeded: budgetExceeded,
1170
- recoveryPlan: recoveryPlan_6,
1171
- recoveryCheckpoint: recoveryCheckpointFor(recoveryPlan_6)
1172
- };
1146
+ return __assign({ action: 'park', reason: 'support_v5_repeated_no_progress', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_6));
1173
1147
  }
1174
1148
  if (repeatedFailure === null || repeatedFailure === void 0 ? void 0 : repeatedFailure.shouldStop) {
1175
1149
  var recoveryPlan_7 = recoveryPlanFor(repeatedFailure.reason === 'support_v5_ping_pong_failure_loop' ? 'park_ping_pong' : 'park_repeated_failure', repeatedFailure.reason, {
1176
1150
  failureClass: repeatedFailure.failureClass,
1177
1151
  productRepairFailure: true
1178
1152
  });
1179
- return {
1180
- action: 'park',
1181
- reason: repeatedFailure.reason,
1182
- nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup',
1183
- repeatedNoProgressCount: repeatedFailure.repeatedCount,
1184
- budgetExceeded: budgetExceeded,
1185
- recoveryPlan: recoveryPlan_7,
1186
- recoveryCheckpoint: recoveryCheckpointFor(recoveryPlan_7)
1187
- };
1153
+ return __assign({ action: 'park', reason: repeatedFailure.reason, nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || 'cleanup', repeatedNoProgressCount: repeatedFailure.repeatedCount, budgetExceeded: budgetExceeded }, recoveryFieldsFor(recoveryPlan_7));
1188
1154
  }
1189
1155
  var recoveryPlan = recoveryPlanFor('continue', 'support_v5_continue');
1190
- return {
1191
- action: 'continue',
1192
- reason: 'support_v5_continue',
1193
- nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.supportV5SupervisorState.activeStep,
1194
- repeatedNoProgressCount: repeatedNoProgressCount,
1195
- budgetExceeded: false,
1196
- recoveryPlan: recoveryPlan,
1197
- recoveryCheckpoint: recoveryCheckpointFor(recoveryPlan)
1198
- };
1156
+ return __assign({ action: 'continue', reason: 'support_v5_continue', nextStep: (last === null || last === void 0 ? void 0 : last.stepType) || bundle.supportV5SupervisorState.activeStep, repeatedNoProgressCount: repeatedNoProgressCount, budgetExceeded: false }, recoveryFieldsFor(recoveryPlan));
1199
1157
  }
1200
1158
  function buildResolveIOSupportV5DiagnoseFirstPrompt(lines) {
1201
1159
  var _a, _b;