@resolveio/server-lib 22.3.167 → 22.3.169

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.167",
3
+ "version": "22.3.169",
4
4
  "description": "",
5
5
  "scripts": {
6
6
  "package": "./build_package.sh",
@@ -29,6 +29,7 @@
29
29
  "ai-run-evidence-test": "node --require ts-node/register tests/ai-run-evidence.test.ts",
30
30
  "ai-run-eval-test": "node --require ts-node/register tests/ai-run-eval.test.ts",
31
31
  "support-runner-v5-test": "node --require ts-node/register tests/support-runner-v5.test.ts",
32
+ "aicoder-runner-v6-test": "node --require ts-node/register tests/aicoder-runner-v6.test.ts",
32
33
  "ai-assistant-nightly-eval": "npm run ai-assistant-corpus-build && npm run ai-assistant-data-parity-e2e && npm run ai-assistant-corpus-replay-e2e && npm run ai-assistant-eval-triage"
33
34
  },
34
35
  "author": "",
@@ -126,6 +126,26 @@ export interface ResolveIOAICoderWorkflowProofReadiness {
126
126
  export type ResolveIOAICoderV6ContinuationAction = 'continue' | 'retry_same_step' | 'switch_to_repair' | 'park' | 'budget_stop' | 'infra_retry' | 'ready_to_publish';
127
127
  export type ResolveIOAICoderWorkflowReadinessStatus = 'journey_contract_required' | 'journey_contract_repair_required' | 'workflow_build_ready' | 'workflow_qa_required' | 'workflow_business_proof_ready' | 'release_repair_required' | 'infra_repair_only' | 'compile_repair_only' | 'collect_new_evidence' | 'budget_stopped' | 'parked';
128
128
  export type ResolveIOAICoderWorkflowReadinessGate = 'journey_contract' | 'build' | 'workflow_qa' | 'release' | 'infra' | 'compile' | 'evidence' | 'manual';
129
+ export type ResolveIOAICoderWorkflowProofCheckpointStatus = 'waiting_for_journey_contract' | 'waiting_for_workflow_proof' | 'waiting_for_new_evidence' | 'waiting_for_release_gate' | 'waiting_for_infra_or_compile' | 'ready_to_continue';
130
+ export interface ResolveIOAICoderWorkflowProofCheckpoint {
131
+ required: boolean;
132
+ status: ResolveIOAICoderWorkflowProofCheckpointStatus;
133
+ readinessStatus: ResolveIOAICoderWorkflowReadinessStatus;
134
+ nextGate: ResolveIOAICoderWorkflowReadinessGate;
135
+ startingFailureClass: string;
136
+ startingBlockerFingerprint: string;
137
+ startingEvidenceHash: string;
138
+ workflowProofFingerprint: string;
139
+ artifactFingerprint: string;
140
+ requiredEvidence: string[];
141
+ requiredResetEvidence: string[];
142
+ successRequiresWorkflowBusinessProof: boolean;
143
+ blocksProductRepairUntilJourneyContract: boolean;
144
+ blocksPublishUntilWorkflowProof: boolean;
145
+ blocksPublishUntilReleaseGate: boolean;
146
+ blocksWowUiUntilWorkflowProof: boolean;
147
+ nextAction: string;
148
+ }
129
149
  export interface ResolveIOAICoderWorkflowReadiness {
130
150
  status: ResolveIOAICoderWorkflowReadinessStatus;
131
151
  nextGate: ResolveIOAICoderWorkflowReadinessGate;
@@ -150,6 +170,7 @@ export interface ResolveIOAICoderWorkflowReadiness {
150
170
  primaryWorkflowId: string;
151
171
  activeWorkflowStep: string;
152
172
  businessProofArtifacts: string[];
173
+ workflowProofCheckpoint: ResolveIOAICoderWorkflowProofCheckpoint;
153
174
  }
154
175
  export interface ResolveIOAICoderV6SupervisorState {
155
176
  version: 'v6';
@@ -274,6 +295,7 @@ export interface ResolveIOAICoderV6ContinuationDecision {
274
295
  repeatedNoProgressCount: number;
275
296
  budgetExceeded: boolean;
276
297
  workflowReadiness: ResolveIOAICoderWorkflowReadiness;
298
+ workflowProofCheckpoint: ResolveIOAICoderWorkflowProofCheckpoint;
277
299
  recoveryPlan: ResolveIOAIManagerRecoveryPlan;
278
300
  recoveryCheckpoint: ResolveIOAIManagerRecoveryCheckpoint;
279
301
  recoveryEvidenceProbe: ResolveIOAIManagerRecoveryEvidenceProbe;
@@ -291,6 +313,24 @@ export declare function collectResolveIOAICoderJourneyContractIssues(input: any,
291
313
  }): string[];
292
314
  export declare function evaluateResolveIOAICoderWorkflowProofReadiness(input?: ResolveIOAICoderWorkflowProofReadinessInput): ResolveIOAICoderWorkflowProofReadiness;
293
315
  export declare function fingerprintResolveIOAICoderV6Blocker(value: any): string;
316
+ export declare function buildResolveIOAICoderWorkflowProofCheckpoint(input: {
317
+ status: ResolveIOAICoderWorkflowReadinessStatus;
318
+ nextGate: ResolveIOAICoderWorkflowReadinessGate;
319
+ nextAction?: any;
320
+ last?: Partial<ResolveIOAICoderV6StepRecord>;
321
+ journeyContractReady?: boolean;
322
+ businessProofReady?: boolean;
323
+ routeOnlyBlocked?: boolean;
324
+ releaseBlocked?: boolean;
325
+ infraOnly?: boolean;
326
+ compileOnly?: boolean;
327
+ sameFailureParked?: boolean;
328
+ primaryWorkflowId?: any;
329
+ activeWorkflowStep?: any;
330
+ workflowQaRows?: any;
331
+ businessProofArtifacts?: any;
332
+ completedWorkflowSteps?: any;
333
+ }): ResolveIOAICoderWorkflowProofCheckpoint;
294
334
  export declare function buildResolveIOAICoderV6WorkflowReadiness(bundle: ResolveIOAICoderV6StateBundle, context?: {
295
335
  action?: ResolveIOAICoderV6ContinuationAction;
296
336
  reason?: string;
@@ -53,6 +53,7 @@ exports.validateResolveIOAICoderJourneyContract = validateResolveIOAICoderJourne
53
53
  exports.collectResolveIOAICoderJourneyContractIssues = collectResolveIOAICoderJourneyContractIssues;
54
54
  exports.evaluateResolveIOAICoderWorkflowProofReadiness = evaluateResolveIOAICoderWorkflowProofReadiness;
55
55
  exports.fingerprintResolveIOAICoderV6Blocker = fingerprintResolveIOAICoderV6Blocker;
56
+ exports.buildResolveIOAICoderWorkflowProofCheckpoint = buildResolveIOAICoderWorkflowProofCheckpoint;
56
57
  exports.buildResolveIOAICoderV6WorkflowReadiness = buildResolveIOAICoderV6WorkflowReadiness;
57
58
  exports.buildResolveIOAICoderV6Budget = buildResolveIOAICoderV6Budget;
58
59
  exports.initializeResolveIOAICoderV6State = initializeResolveIOAICoderV6State;
@@ -1289,6 +1290,121 @@ function aicoderWorkflowReadinessGateFor(status) {
1289
1290
  return 'manual';
1290
1291
  }
1291
1292
  }
1293
+ function buildResolveIOAICoderWorkflowProofCheckpoint(input) {
1294
+ var _a, _b, _c, _d, _e;
1295
+ var status = input.status;
1296
+ var nextGate = input.nextGate;
1297
+ var proofArtifacts = cleanList(input.businessProofArtifacts, 80, 500);
1298
+ var workflowRows = cleanWorkflowQaRows(input.workflowQaRows, 80);
1299
+ var completedWorkflowSteps = cleanList(input.completedWorkflowSteps, 80, 240);
1300
+ var workflowProofFingerprint = fingerprintResolveIOAICoderWorkflowProofPayload({
1301
+ primaryWorkflowId: input.primaryWorkflowId,
1302
+ activeWorkflowStep: input.activeWorkflowStep,
1303
+ workflowRows: workflowRows.map(function (row) { return ({
1304
+ workflowId: row.workflowId,
1305
+ stepId: row.stepId,
1306
+ status: row.status,
1307
+ acceptanceGate: row.acceptanceGate,
1308
+ assertion: row.assertion
1309
+ }); }),
1310
+ completedWorkflowSteps: completedWorkflowSteps,
1311
+ proofArtifacts: proofArtifacts
1312
+ }, 'aicoder-workflow-readiness');
1313
+ var artifactFingerprint = fingerprintResolveIOAICoderWorkflowProofPayload({
1314
+ proofArtifacts: proofArtifacts,
1315
+ rowArtifacts: workflowRows.flatMap(function (row) { return cleanList(row.artifactPaths, 10, 500); })
1316
+ }, 'aicoder-workflow-artifacts');
1317
+ var requiredEvidenceByStatus = {
1318
+ journey_contract_required: [
1319
+ 'docs/APP_JOURNEY_CONTRACT.md with validated journey_contract JSON',
1320
+ 'first/next/last north_star_workflow steps',
1321
+ 'workflow QA rows generated from journey_contract.qa_assertions'
1322
+ ],
1323
+ journey_contract_repair_required: [
1324
+ 'repaired journey contract validation result',
1325
+ 'command-center hub action mapped to workflow state transition'
1326
+ ],
1327
+ workflow_build_ready: [
1328
+ 'implemented north-star workflow from the Journey Contract',
1329
+ 'seeded data story available in the app'
1330
+ ],
1331
+ workflow_qa_required: [
1332
+ 'AIQaBusinessAssertion for the north-star workflow',
1333
+ 'non-empty data proof',
1334
+ 'saved/calculated output proof',
1335
+ 'report/export proof when promised'
1336
+ ],
1337
+ workflow_business_proof_ready: [
1338
+ 'deterministic release gate before publish',
1339
+ 'workflow proof artifact retained for acceptance'
1340
+ ],
1341
+ release_repair_required: [
1342
+ 'publish/deploy/sample-data failure artifact',
1343
+ 'hotfix or release-gate evidence before another full deploy'
1344
+ ],
1345
+ infra_repair_only: [
1346
+ 'Puppeteer/Chrome/Mongo/startup/preflight evidence',
1347
+ 'infra failure class changed or preflight passed'
1348
+ ],
1349
+ compile_repair_only: [
1350
+ 'compile/build log evidence',
1351
+ 'compile failure class changed or build passed'
1352
+ ],
1353
+ collect_new_evidence: [
1354
+ 'changed blocker fingerprint or evidence hash',
1355
+ 'fresh workflow QA artifact',
1356
+ 'AIQaBusinessAssertion or precise workflow blocker artifact'
1357
+ ],
1358
+ budget_stopped: [
1359
+ 'budget summary',
1360
+ 'one human decision for next bounded action'
1361
+ ],
1362
+ parked: [
1363
+ 'operator decision',
1364
+ 'new evidence before retry'
1365
+ ]
1366
+ };
1367
+ var waitingStatus = status === 'workflow_business_proof_ready'
1368
+ ? 'ready_to_continue'
1369
+ : status === 'release_repair_required'
1370
+ ? 'waiting_for_release_gate'
1371
+ : status === 'collect_new_evidence' || input.sameFailureParked === true
1372
+ ? 'waiting_for_new_evidence'
1373
+ : status === 'infra_repair_only' || status === 'compile_repair_only'
1374
+ ? 'waiting_for_infra_or_compile'
1375
+ : status === 'journey_contract_required' || status === 'journey_contract_repair_required'
1376
+ ? 'waiting_for_journey_contract'
1377
+ : 'waiting_for_workflow_proof';
1378
+ var blocksProductRepairUntilJourneyContract = input.journeyContractReady !== true
1379
+ || status === 'journey_contract_required'
1380
+ || status === 'journey_contract_repair_required';
1381
+ var blocksPublishUntilWorkflowProof = input.businessProofReady !== true
1382
+ || input.routeOnlyBlocked === true
1383
+ || input.sameFailureParked === true
1384
+ || blocksProductRepairUntilJourneyContract
1385
+ || status === 'workflow_qa_required'
1386
+ || status === 'workflow_build_ready'
1387
+ || status === 'collect_new_evidence';
1388
+ return {
1389
+ required: true,
1390
+ status: waitingStatus,
1391
+ readinessStatus: status,
1392
+ nextGate: nextGate,
1393
+ startingFailureClass: cleanText((_a = input.last) === null || _a === void 0 ? void 0 : _a.failureClass, 120),
1394
+ startingBlockerFingerprint: cleanText(((_b = input.last) === null || _b === void 0 ? void 0 : _b.blockerFingerprint) || fingerprintResolveIOAICoderV6Blocker(((_c = input.last) === null || _c === void 0 ? void 0 : _c.blocker) || ((_d = input.last) === null || _d === void 0 ? void 0 : _d.summary) || ''), 160),
1395
+ startingEvidenceHash: cleanText((_e = input.last) === null || _e === void 0 ? void 0 : _e.evidenceHash, 160),
1396
+ workflowProofFingerprint: workflowProofFingerprint,
1397
+ artifactFingerprint: artifactFingerprint,
1398
+ requiredEvidence: (requiredEvidenceByStatus[status] || []).slice(0, 20),
1399
+ requiredResetEvidence: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read((requiredEvidenceByStatus[status] || [])), false), __read((input.sameFailureParked === true ? ['new workflow proof fingerprint', 'new artifact fingerprint'] : [])), false), __read((input.releaseBlocked === true ? ['changed release gate fingerprint'] : [])), false))).slice(0, 20),
1400
+ successRequiresWorkflowBusinessProof: status !== 'infra_repair_only' && status !== 'compile_repair_only' && status !== 'budget_stopped',
1401
+ blocksProductRepairUntilJourneyContract: blocksProductRepairUntilJourneyContract,
1402
+ blocksPublishUntilWorkflowProof: blocksPublishUntilWorkflowProof,
1403
+ blocksPublishUntilReleaseGate: input.releaseBlocked === true || status === 'release_repair_required',
1404
+ blocksWowUiUntilWorkflowProof: blocksPublishUntilWorkflowProof,
1405
+ nextAction: cleanText(input.nextAction, 500) || aicoderWorkflowReadinessNextCommand(status)
1406
+ };
1407
+ }
1292
1408
  function buildResolveIOAICoderV6WorkflowReadiness(bundle, context) {
1293
1409
  var _a, _b;
1294
1410
  if (context === void 0) { context = {}; }
@@ -1301,8 +1417,10 @@ function buildResolveIOAICoderV6WorkflowReadiness(bundle, context) {
1301
1417
  var primaryWorkflowId = cleanText(workflowMemory.primaryWorkflowId || ((_a = rows[0]) === null || _a === void 0 ? void 0 : _a.workflowId), 200);
1302
1418
  var activeWorkflowStep = cleanText(workflowMemory.activeWorkflowStep || workflowMemory.blockedWorkflowStep || ((_b = rows.find(function (row) { return !statusLooksPassed(row.status); })) === null || _b === void 0 ? void 0 : _b.stepId), 200);
1303
1419
  var failureClass = cleanText(last === null || last === void 0 ? void 0 : last.failureClass, 120).toLowerCase();
1304
- var reason = cleanText(context.reason || (last === null || last === void 0 ? void 0 : last.blocker) || (last === null || last === void 0 ? void 0 : last.summary), 1000);
1305
- var combinedText = "".concat(failureClass, "\n").concat(reason, "\n").concat((last === null || last === void 0 ? void 0 : last.stepType) || '', "\n").concat((last === null || last === void 0 ? void 0 : last.lane) || '').toLowerCase();
1420
+ var contextReason = cleanText(context.reason, 1000);
1421
+ var observedBlocker = cleanText((last === null || last === void 0 ? void 0 : last.blocker) || (last === null || last === void 0 ? void 0 : last.summary), 1000);
1422
+ var reason = contextReason || observedBlocker;
1423
+ var combinedText = "".concat(failureClass, "\n").concat(contextReason, "\n").concat(observedBlocker, "\n").concat((last === null || last === void 0 ? void 0 : last.stepType) || '', "\n").concat((last === null || last === void 0 ? void 0 : last.lane) || '').toLowerCase();
1306
1424
  var compileOnly = failureClass === 'compile'
1307
1425
  || /\b(compile|typescript|ts[0-9]{3,5}|ng build|cannot find name|module not found)\b/i.test(combinedText);
1308
1426
  var infraOnly = !compileOnly && (failureClass === 'infra'
@@ -1387,12 +1505,32 @@ function buildResolveIOAICoderV6WorkflowReadiness(bundle, context) {
1387
1505
  && status !== 'journey_contract_repair_required'
1388
1506
  && status !== 'release_repair_required'
1389
1507
  && status !== 'workflow_business_proof_ready';
1508
+ var nextGate = aicoderWorkflowReadinessGateFor(status);
1509
+ var nextCommand = aicoderWorkflowReadinessNextCommand(status);
1510
+ var workflowProofCheckpoint = buildResolveIOAICoderWorkflowProofCheckpoint({
1511
+ status: status,
1512
+ nextGate: nextGate,
1513
+ nextAction: nextCommand,
1514
+ last: last,
1515
+ journeyContractReady: journeyContractReady,
1516
+ businessProofReady: businessProofReady,
1517
+ routeOnlyBlocked: routeOnlyBlocked,
1518
+ releaseBlocked: releaseBlocked,
1519
+ infraOnly: infraOnly,
1520
+ compileOnly: compileOnly,
1521
+ sameFailureParked: sameFailureParked,
1522
+ primaryWorkflowId: primaryWorkflowId,
1523
+ activeWorkflowStep: activeWorkflowStep,
1524
+ workflowQaRows: rows,
1525
+ businessProofArtifacts: proofArtifacts,
1526
+ completedWorkflowSteps: completedSteps
1527
+ });
1390
1528
  return {
1391
1529
  status: status,
1392
- nextGate: aicoderWorkflowReadinessGateFor(status),
1530
+ nextGate: nextGate,
1393
1531
  nextLane: context.nextLane || (last === null || last === void 0 ? void 0 : last.lane) || bundle.aiCoderV6SupervisorState.activeLane,
1394
1532
  nextStep: context.nextStep || (last === null || last === void 0 ? void 0 : last.stepType) || bundle.aiCoderV6SupervisorState.activeStep,
1395
- nextCommand: aicoderWorkflowReadinessNextCommand(status),
1533
+ nextCommand: nextCommand,
1396
1534
  journeyContractReady: journeyContractReady,
1397
1535
  workflowQaRowsReady: workflowQaRowsReady,
1398
1536
  businessProofReady: businessProofReady,
@@ -1410,7 +1548,8 @@ function buildResolveIOAICoderV6WorkflowReadiness(bundle, context) {
1410
1548
  blockers: blockers.slice(0, 8),
1411
1549
  primaryWorkflowId: primaryWorkflowId,
1412
1550
  activeWorkflowStep: activeWorkflowStep,
1413
- businessProofArtifacts: proofArtifacts
1551
+ businessProofArtifacts: proofArtifacts,
1552
+ workflowProofCheckpoint: workflowProofCheckpoint
1414
1553
  };
1415
1554
  }
1416
1555
  function buildResolveIOAICoderV6Budget(existing) {
@@ -1682,14 +1821,17 @@ function decideResolveIOAICoderV6Continuation(bundle) {
1682
1821
  };
1683
1822
  };
1684
1823
  var managerRecoveryFields = function () { return recoveryFieldsFor(managerDecision.recoveryPlan, managerDecision.recoveryCheckpoint, managerDecision.recoveryEvidenceProbe); };
1685
- var withWorkflowReadiness = function (decision) { return (__assign(__assign({}, decision), { workflowReadiness: buildResolveIOAICoderV6WorkflowReadiness(bundle, {
1824
+ var withWorkflowReadiness = function (decision) {
1825
+ var workflowReadiness = buildResolveIOAICoderV6WorkflowReadiness(bundle, {
1686
1826
  action: decision.action,
1687
1827
  reason: decision.reason,
1688
1828
  nextLane: decision.nextLane,
1689
1829
  nextStep: decision.nextStep,
1690
1830
  budgetExceeded: decision.budgetExceeded,
1691
1831
  repeatedNoProgressCount: decision.repeatedNoProgressCount
1692
- }) })); };
1832
+ });
1833
+ return __assign(__assign({}, decision), { workflowReadiness: workflowReadiness, workflowProofCheckpoint: workflowReadiness.workflowProofCheckpoint });
1834
+ };
1693
1835
  var budgetExceeded = (budget.loopCount >= budget.maxLoopsPerRun && !managerDecision.loopBudgetShouldReset)
1694
1836
  || budget.totalPromptTokenEstimate >= budget.maxTotalPromptTokens
1695
1837
  || ((last === null || last === void 0 ? void 0 : last.promptTokenEstimate) || 0) > budget.maxPromptTokensPerNonInitialStep * 2;