@resolveio/server-lib 22.3.182 → 22.3.183

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.182",
3
+ "version": "22.3.183",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -186,6 +186,42 @@ export interface ResolveIOSupportHumanReviewPacket {
186
186
  costRisk: 'free_or_deterministic' | 'small_model_or_qa' | 'expensive_model' | 'release_or_customer_send';
187
187
  createdAt: string;
188
188
  }
189
+ export interface ResolveIOSupportHumanDecisionChoice {
190
+ choiceId: string;
191
+ label: string;
192
+ action: string;
193
+ description: string;
194
+ safety: 'low' | 'medium' | 'high';
195
+ requiresConfirmation: boolean;
196
+ nextCommand: string;
197
+ expectedResult: string;
198
+ allowedWithoutCodexMonitor: boolean;
199
+ }
200
+ export interface ResolveIOSupportHumanDecisionRequest {
201
+ requestId: string;
202
+ required: boolean;
203
+ status: 'not_required' | 'waiting_for_operator' | 'auto_dispatch_allowed';
204
+ reason: string;
205
+ question: string;
206
+ preferredChoiceId: string;
207
+ evidence: {
208
+ failureClass: string;
209
+ blocker: string;
210
+ blockerFingerprint: string;
211
+ evidenceHash: string;
212
+ sameFailureCount: number;
213
+ pingPongCount: number;
214
+ evidenceStrength: ResolveIOAIManagerEvidenceStrength;
215
+ requiredResetEvidence: string[];
216
+ recentArtifactPaths: string[];
217
+ changedFiles: string[];
218
+ nextActionContractId: string;
219
+ };
220
+ choices: ResolveIOSupportHumanDecisionChoice[];
221
+ blockedUntil: string[];
222
+ autoDispatchAllowed: boolean;
223
+ createdAt: string;
224
+ }
189
225
  export interface ResolveIOSupportCustomerReplyPolicyInput {
190
226
  diagnosisGate?: any;
191
227
  issueClassProbePlan?: any;
@@ -725,6 +761,7 @@ export interface ResolveIOSupportV5AutonomousDecision {
725
761
  continuationProofCheckpoint: ResolveIOSupportContinuationProofCheckpoint;
726
762
  nextActionContract: ResolveIOSupportNextActionContract;
727
763
  humanReviewPacket: ResolveIOSupportHumanReviewPacket;
764
+ humanDecisionRequest?: ResolveIOSupportHumanDecisionRequest;
728
765
  hotfixContinuation?: ResolveIOAIManagerHotfixContinuationDecision;
729
766
  recordedAt: string;
730
767
  }
@@ -3246,6 +3246,128 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
3246
3246
  createdAt: createdAt
3247
3247
  };
3248
3248
  };
3249
+ var buildHumanDecisionRequest = function (action, label, reason, fields, rootCauseReadiness, continuationProofCheckpoint, nextActionContract, requiredEvidence, blockers) {
3250
+ var repeatedEvidenceBlocked = evidenceFreshness.mustCollectNewEvidence === true
3251
+ || rootCauseReadiness.sameFailureParked === true
3252
+ || continuationProofCheckpoint.status === 'waiting_for_new_evidence';
3253
+ var manualApprovalRequired = action === 'park_manual'
3254
+ || action === 'ask_customer_clarification'
3255
+ || nextActionContract.requiresHumanApproval === true
3256
+ || fields.canRunAutonomously !== true;
3257
+ if (!repeatedEvidenceBlocked && !manualApprovalRequired) {
3258
+ return undefined;
3259
+ }
3260
+ var createdAt = isoNow(input.now);
3261
+ var autoDispatchAllowed = repeatedEvidenceBlocked
3262
+ && action === 'collect_new_evidence'
3263
+ && nextActionContract.safeToAutoRun === true
3264
+ && nextActionContract.canRunWithoutCodexMonitor === true;
3265
+ var preferredChoiceId = autoDispatchAllowed
3266
+ ? 'run_bounded_evidence_probe'
3267
+ : action === 'ask_customer_clarification'
3268
+ ? 'review_customer_clarification'
3269
+ : action === 'run_diagnosis_gate' || action === 'revise_diagnosis_scope'
3270
+ ? 'revise_diagnosis_gate'
3271
+ : 'keep_parked';
3272
+ var baseRequiredEvidence = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(requiredEvidence), false), __read(continuationProofCheckpoint.requiredResetEvidence), false), __read(evidenceFreshness.requiredResetEvidence), false).filter(Boolean))).slice(0, 20);
3273
+ var choices = [];
3274
+ if (repeatedEvidenceBlocked) {
3275
+ choices.push({
3276
+ choiceId: 'run_bounded_evidence_probe',
3277
+ label: 'Run Evidence Probe',
3278
+ action: 'collect_new_evidence',
3279
+ description: 'Collect changed issue-specific evidence only; product-code repair remains blocked until blockerFingerprint, evidenceHash, or business proof changes.',
3280
+ safety: 'low',
3281
+ requiresConfirmation: false,
3282
+ nextCommand: nextActionContract.primaryCommand || 'run_support_v5_recovery_evidence_probe',
3283
+ expectedResult: nextActionExpectedTransition('collect_new_evidence', nextActionContract.primaryCommand || 'run_support_v5_recovery_evidence_probe'),
3284
+ allowedWithoutCodexMonitor: autoDispatchAllowed
3285
+ });
3286
+ }
3287
+ choices.push({
3288
+ choiceId: 'revise_diagnosis_gate',
3289
+ label: 'Revise Diagnosis',
3290
+ action: 'run_diagnosis_gate',
3291
+ description: 'Re-run read-only root-cause diagnosis with the new evidence and update owner files/proof plan before any repair loop.',
3292
+ safety: 'low',
3293
+ requiresConfirmation: repeatedEvidenceBlocked === false,
3294
+ nextCommand: 'revise_support_diagnosis_gate_with_new_evidence',
3295
+ expectedResult: nextActionExpectedTransition('run_diagnosis_gate', 'revise_support_diagnosis_gate_with_new_evidence'),
3296
+ allowedWithoutCodexMonitor: false
3297
+ });
3298
+ if (action === 'ask_customer_clarification') {
3299
+ choices.push({
3300
+ choiceId: 'review_customer_clarification',
3301
+ label: 'Review Clarification',
3302
+ action: 'ask_customer_clarification',
3303
+ description: 'Review the one customer question before any send action; no product-code repair is allowed from guessed context.',
3304
+ safety: 'medium',
3305
+ requiresConfirmation: true,
3306
+ nextCommand: nextActionContract.primaryCommand || 'review_customer_clarification',
3307
+ expectedResult: nextActionExpectedTransition('ask_customer_clarification', nextActionContract.primaryCommand || 'review_customer_clarification'),
3308
+ allowedWithoutCodexMonitor: false
3309
+ });
3310
+ }
3311
+ choices.push({
3312
+ choiceId: 'keep_parked',
3313
+ label: 'Keep Parked',
3314
+ action: 'park_manual',
3315
+ description: 'Do not spend more model, QA, release, or customer-send budget until new evidence, scope, budget, or approval changes.',
3316
+ safety: 'low',
3317
+ requiresConfirmation: false,
3318
+ nextCommand: 'park_support_ticket_until_new_evidence',
3319
+ expectedResult: 'The support runner stays parked and records the blocker as waiting for an operator decision or fresh evidence.',
3320
+ allowedWithoutCodexMonitor: true
3321
+ });
3322
+ var blockedUntil = Array.from(new Set(__spreadArray(__spreadArray([], __read(baseRequiredEvidence), false), [
3323
+ repeatedEvidenceBlocked ? 'blockerFingerprint changes from the starting repeated blocker' : '',
3324
+ repeatedEvidenceBlocked ? 'evidenceHash changes from the starting repeated evidence hash' : '',
3325
+ repeatedEvidenceBlocked ? 'fresh AIQaBusinessAssertion, infra/compile proof, release proof, or artifact path is attached' : '',
3326
+ action === 'park_manual' ? 'operator changes scope, budget, autonomy policy, or approval' : ''
3327
+ ], false).filter(Boolean))).slice(0, 16);
3328
+ return {
3329
+ requestId: "support-human-decision-".concat(hashResolveIOSupportV5Evidence({
3330
+ action: action,
3331
+ label: label,
3332
+ reason: reason,
3333
+ preferredChoiceId: preferredChoiceId,
3334
+ failureClass: evidenceFreshness.failureClass,
3335
+ blockerFingerprint: evidenceFreshness.blockerFingerprint,
3336
+ evidenceHash: evidenceFreshness.evidenceHash,
3337
+ createdAt: createdAt.slice(0, 16)
3338
+ }).slice(0, 16)),
3339
+ required: true,
3340
+ status: autoDispatchAllowed ? 'auto_dispatch_allowed' : 'waiting_for_operator',
3341
+ reason: repeatedEvidenceBlocked
3342
+ ? "".concat(reason, " Same failure evidence repeated; repair is blocked until new evidence changes the proof state.")
3343
+ : reason,
3344
+ question: repeatedEvidenceBlocked
3345
+ ? 'Same blocker/evidence repeated. Run one bounded evidence probe, revise diagnosis with new facts, or keep the ticket parked?'
3346
+ : action === 'ask_customer_clarification'
3347
+ ? 'Customer context is missing. Review the clarification question or keep the ticket parked?'
3348
+ : "Human approval is required for ".concat(label, ". What should the runner do next?"),
3349
+ preferredChoiceId: preferredChoiceId,
3350
+ evidence: {
3351
+ failureClass: evidenceFreshness.failureClass,
3352
+ blocker: cleanText(blockers[0] || reason, 1000),
3353
+ blockerFingerprint: evidenceFreshness.blockerFingerprint,
3354
+ evidenceHash: evidenceFreshness.evidenceHash,
3355
+ sameFailureCount: evidenceFreshness.sameFailureCount,
3356
+ pingPongCount: evidenceFreshness.pingPongCount,
3357
+ evidenceStrength: evidenceFreshness.evidenceStrength,
3358
+ requiredResetEvidence: baseRequiredEvidence,
3359
+ recentArtifactPaths: evidenceFreshness.artifactPaths.slice(0, 20),
3360
+ changedFiles: evidenceFreshness.changedFiles.slice(0, 20),
3361
+ nextActionContractId: nextActionContract.contractId
3362
+ },
3363
+ choices: choices
3364
+ .filter(function (choice, index, source) { return source.findIndex(function (candidate) { return candidate.choiceId === choice.choiceId; }) === index; })
3365
+ .slice(0, 6),
3366
+ blockedUntil: blockedUntil,
3367
+ autoDispatchAllowed: autoDispatchAllowed,
3368
+ createdAt: createdAt
3369
+ };
3370
+ };
3249
3371
  var makeDecision = function (action, label, reason, fields) {
3250
3372
  var _a;
3251
3373
  var primaryCommand = fields.primaryCommand || action;
@@ -3291,6 +3413,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
3291
3413
  : 'free_or_deterministic',
3292
3414
  now: input.now
3293
3415
  });
3416
+ var humanDecisionRequest = buildHumanDecisionRequest(action, label, reason, fields, rootCauseReadiness, continuationProofCheckpoint, nextActionContract, requiredEvidence, blockers);
3294
3417
  return {
3295
3418
  action: action,
3296
3419
  label: label,
@@ -3329,6 +3452,7 @@ function decideResolveIOSupportV5AutonomousNextAction(input) {
3329
3452
  continuationProofCheckpoint: continuationProofCheckpoint,
3330
3453
  nextActionContract: nextActionContract,
3331
3454
  humanReviewPacket: humanReviewPacket,
3455
+ humanDecisionRequest: humanDecisionRequest,
3332
3456
  hotfixContinuation: fields.hotfixContinuation,
3333
3457
  recordedAt: isoNow(input.now)
3334
3458
  };