@resolveio/server-lib 22.3.199 → 22.3.200
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/methods/ai-terminal.d.ts +20 -1
- package/methods/ai-terminal.js +975 -577
- package/methods/ai-terminal.js.map +1 -1
- package/package.json +1 -1
- package/util/ai-run-evidence-adapters.js +2940 -151
- package/util/ai-run-evidence-adapters.js.map +1 -1
- package/util/ai-run-evidence.js +247 -3
- package/util/ai-run-evidence.js.map +1 -1
- package/util/ai-runner-manager-policy.d.ts +20 -0
- package/util/ai-runner-manager-policy.js +158 -13
- package/util/ai-runner-manager-policy.js.map +1 -1
- package/util/aicoder-runner-v6.d.ts +2 -0
- package/util/aicoder-runner-v6.js +178 -39
- package/util/aicoder-runner-v6.js.map +1 -1
- package/util/support-runner-v5.d.ts +375 -4
- package/util/support-runner-v5.js +2027 -100
- package/util/support-runner-v5.js.map +1 -1
|
@@ -442,6 +442,60 @@ function normalizeHotfixEvidenceTarget(value) {
|
|
|
442
442
|
seedKey: cleanText(source.seedKey || source.seed_key || source.fixture, 240)
|
|
443
443
|
};
|
|
444
444
|
}
|
|
445
|
+
function normalizeHotfixEvidenceTargets(value, fallback) {
|
|
446
|
+
var rawTargets = Array.isArray(value) ? value : [];
|
|
447
|
+
var targets = rawTargets
|
|
448
|
+
.map(normalizeHotfixEvidenceTarget)
|
|
449
|
+
.filter(function (target) { return Object.values(target).some(function (entry) { return cleanText(entry, 500); }); });
|
|
450
|
+
if (!targets.length && fallback && Object.values(fallback).some(function (entry) { return cleanText(entry, 500); })) {
|
|
451
|
+
targets.push(fallback);
|
|
452
|
+
}
|
|
453
|
+
var seen = new Set();
|
|
454
|
+
return targets.filter(function (target) {
|
|
455
|
+
var key = "".concat(cleanText(target.host, 240).toLowerCase(), "::").concat(cleanText(target.path || target.processName || target.configKey || target.seedKey || target.cacheKey, 500));
|
|
456
|
+
if (seen.has(key)) {
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
seen.add(key);
|
|
460
|
+
return true;
|
|
461
|
+
}).slice(0, 20);
|
|
462
|
+
}
|
|
463
|
+
function normalizeHotfixRemoteChecksumProof(value) {
|
|
464
|
+
var source = cleanObject(value);
|
|
465
|
+
return {
|
|
466
|
+
host: cleanText(source.host || source.hostname || source.domain, 240),
|
|
467
|
+
path: cleanText(source.path || source.remotePath || source.remote_path, 500),
|
|
468
|
+
checksumBefore: cleanText(source.checksumBefore || source.checksum_before || source.remoteChecksumBefore || source.remote_checksum_before, 160),
|
|
469
|
+
checksumAfter: cleanText(source.checksumAfter || source.checksum_after || source.remoteChecksumAfter || source.remote_checksum_after, 160),
|
|
470
|
+
checksum: cleanText(source.checksum || source.remoteChecksum || source.remote_checksum, 160),
|
|
471
|
+
status: cleanText(source.status, 160)
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function normalizeHotfixRemoteChecksumProofs(value) {
|
|
475
|
+
return (Array.isArray(value) ? value : [])
|
|
476
|
+
.map(normalizeHotfixRemoteChecksumProof)
|
|
477
|
+
.filter(function (entry) { return entry.host || entry.path || entry.checksumAfter || entry.checksum || entry.status; })
|
|
478
|
+
.slice(0, 40);
|
|
479
|
+
}
|
|
480
|
+
function normalizeHotfixHostStatusProof(value) {
|
|
481
|
+
var _a, _b;
|
|
482
|
+
var source = cleanObject(value);
|
|
483
|
+
var checkCount = Number((_a = source.checkCount) !== null && _a !== void 0 ? _a : source.check_count);
|
|
484
|
+
var failedCount = Number((_b = source.failedCount) !== null && _b !== void 0 ? _b : source.failed_count);
|
|
485
|
+
return {
|
|
486
|
+
host: cleanText(source.host || source.hostname || source.domain, 240),
|
|
487
|
+
status: cleanText(source.status || source.result, 160),
|
|
488
|
+
evidence: cleanText(source.evidence || source.message || source.summary, 1000),
|
|
489
|
+
checkCount: Number.isFinite(checkCount) ? Math.max(0, Math.floor(checkCount)) : undefined,
|
|
490
|
+
failedCount: Number.isFinite(failedCount) ? Math.max(0, Math.floor(failedCount)) : undefined
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
function normalizeHotfixHostStatusProofs(value) {
|
|
494
|
+
return (Array.isArray(value) ? value : [])
|
|
495
|
+
.map(normalizeHotfixHostStatusProof)
|
|
496
|
+
.filter(function (entry) { return entry.host || entry.status || entry.evidence; })
|
|
497
|
+
.slice(0, 40);
|
|
498
|
+
}
|
|
445
499
|
function normalizeResolveIOAIManagerHotfixEvidence(value, policy) {
|
|
446
500
|
var _a;
|
|
447
501
|
var source = cleanObject(value);
|
|
@@ -453,18 +507,24 @@ function normalizeResolveIOAIManagerHotfixEvidence(value, policy) {
|
|
|
453
507
|
return undefined;
|
|
454
508
|
}
|
|
455
509
|
var target = normalizeHotfixEvidenceTarget(source.target || source);
|
|
510
|
+
var targets = normalizeHotfixEvidenceTargets(source.targets || source.hotfixTargets || source.hotfix_targets, target);
|
|
456
511
|
return {
|
|
457
512
|
channel: channel,
|
|
458
513
|
status: normalizeHotfixStatus(source.status),
|
|
459
514
|
target: target,
|
|
515
|
+
targets: targets,
|
|
460
516
|
compiledArtifactPath: cleanText(source.compiledArtifactPath || source.compiled_artifact_path || target.artifactPath, 500),
|
|
461
517
|
builtDistPath: cleanText(source.builtDistPath || source.built_dist_path || target.artifactPath, 500),
|
|
462
518
|
remoteChecksumBefore: cleanText(source.remoteChecksumBefore || source.remote_checksum_before || source.checksumBefore || source.checksum_before, 160),
|
|
463
519
|
remoteChecksumAfter: cleanText(source.remoteChecksumAfter || source.remote_checksum_after || source.checksumAfter || source.checksum_after, 160),
|
|
464
520
|
remoteChecksum: cleanText(source.remoteChecksum || source.remote_checksum || source.checksum, 160),
|
|
521
|
+
remoteChecksums: normalizeHotfixRemoteChecksumProofs(source.remoteChecksums || source.remote_checksums || source.checksums || source.hostChecksums || source.host_checksums),
|
|
465
522
|
restartEvidence: cleanText(source.restartEvidence || source.restart_evidence, 1000),
|
|
523
|
+
restartResults: normalizeHotfixHostStatusProofs(source.restartResults || source.restart_results || source.restarts || source.serviceRestartResults || source.service_restart_results),
|
|
466
524
|
healthCheckStatus: cleanText(source.healthCheckStatus || source.health_check_status || source.health, 160),
|
|
525
|
+
healthChecks: normalizeHotfixHostStatusProofs(source.healthChecks || source.health_checks || source.hostHealthChecks || source.host_health_checks),
|
|
467
526
|
selfTestStatus: cleanText(source.selfTestStatus || source.self_test_status || source.selfTest || source.self_test, 160),
|
|
527
|
+
selfTests: normalizeHotfixHostStatusProofs(source.selfTests || source.self_tests || source.runnerManagerSelfTests || source.runner_manager_self_tests),
|
|
468
528
|
releaseGateStatus: cleanText(source.releaseGateStatus || source.release_gate_status || source.releaseGate || source.release_gate, 160),
|
|
469
529
|
s3UploadResult: cleanText(source.s3UploadResult || source.s3_upload_result || source.uploadResult || source.upload_result, 1000),
|
|
470
530
|
cloudfrontInvalidationId: cleanText(source.cloudfrontInvalidationId || source.cloudfront_invalidation_id || source.invalidationId || source.invalidation_id, 240),
|
|
@@ -509,6 +569,95 @@ function isFullGitCommitSha(value) {
|
|
|
509
569
|
function isStrongRemoteChecksum(value) {
|
|
510
570
|
return /^[a-f0-9]{12,128}$/i.test(cleanText(value, 160));
|
|
511
571
|
}
|
|
572
|
+
function hotfixTargetLabel(target, fallbackIndex) {
|
|
573
|
+
return cleanText([target.host, target.path].filter(Boolean).join(':'), 800) || "target[".concat(fallbackIndex, "]");
|
|
574
|
+
}
|
|
575
|
+
function hotfixTargetsForBackendEvidence(evidence) {
|
|
576
|
+
var targets = normalizeHotfixEvidenceTargets(evidence.targets, evidence.target);
|
|
577
|
+
return targets.length ? targets : [evidence.target].filter(function (target) { return !!target; });
|
|
578
|
+
}
|
|
579
|
+
function targetMatchesHostPath(sourceHost, sourcePath, target) {
|
|
580
|
+
var host = cleanText(sourceHost, 240).toLowerCase();
|
|
581
|
+
var path = cleanText(sourcePath, 500);
|
|
582
|
+
var targetHost = cleanText(target.host, 240).toLowerCase();
|
|
583
|
+
var targetPath = cleanText(target.path, 500);
|
|
584
|
+
if (targetHost && host && targetHost !== host) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
if (targetPath && path && targetPath !== path) {
|
|
588
|
+
return false;
|
|
589
|
+
}
|
|
590
|
+
return (!!targetHost && !!host) || (!!targetPath && !!path);
|
|
591
|
+
}
|
|
592
|
+
function checksumProofForBackendTarget(evidence, target, allowLegacyGlobal) {
|
|
593
|
+
var proof = (evidence.remoteChecksums || []).find(function (entry) { return targetMatchesHostPath(entry.host, entry.path, target); });
|
|
594
|
+
if (proof) {
|
|
595
|
+
return proof;
|
|
596
|
+
}
|
|
597
|
+
if (allowLegacyGlobal && (evidence.remoteChecksumAfter || evidence.remoteChecksum)) {
|
|
598
|
+
return {
|
|
599
|
+
host: target.host,
|
|
600
|
+
path: target.path,
|
|
601
|
+
checksumBefore: evidence.remoteChecksumBefore,
|
|
602
|
+
checksumAfter: evidence.remoteChecksumAfter,
|
|
603
|
+
checksum: evidence.remoteChecksum,
|
|
604
|
+
status: evidence.status
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
return undefined;
|
|
608
|
+
}
|
|
609
|
+
function hostStatusProofForBackendTarget(records, target, allowLegacyGlobalStatus) {
|
|
610
|
+
var proof = (records || []).find(function (entry) { return targetMatchesHostPath(entry.host, undefined, target); });
|
|
611
|
+
if (proof) {
|
|
612
|
+
return proof;
|
|
613
|
+
}
|
|
614
|
+
if (allowLegacyGlobalStatus) {
|
|
615
|
+
return {
|
|
616
|
+
host: target.host,
|
|
617
|
+
status: cleanText(allowLegacyGlobalStatus, 160)
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
return undefined;
|
|
621
|
+
}
|
|
622
|
+
function validateBackendHotfixTargetCoverage(evidence, blockers) {
|
|
623
|
+
var targets = hotfixTargetsForBackendEvidence(evidence);
|
|
624
|
+
var structuredMultiTarget = targets.length > 1;
|
|
625
|
+
if (structuredMultiTarget && !(evidence.remoteChecksums || []).length) {
|
|
626
|
+
blockers.push('Backend JS hotfix with multiple targets requires remoteChecksums[] with a strong checksumAfter per host/path.');
|
|
627
|
+
}
|
|
628
|
+
if (structuredMultiTarget && !(evidence.restartResults || []).length) {
|
|
629
|
+
blockers.push('Backend JS hotfix with multiple targets requires restartResults[] with passed status per host.');
|
|
630
|
+
}
|
|
631
|
+
if (structuredMultiTarget && !(evidence.healthChecks || []).length) {
|
|
632
|
+
blockers.push('Backend JS hotfix with multiple targets requires healthChecks[] with passed status per host.');
|
|
633
|
+
}
|
|
634
|
+
if (structuredMultiTarget && !(evidence.selfTests || []).length) {
|
|
635
|
+
blockers.push('Backend JS hotfix with multiple targets requires selfTests[] with passed status per host.');
|
|
636
|
+
}
|
|
637
|
+
targets.forEach(function (target, index) {
|
|
638
|
+
var label = hotfixTargetLabel(target, index);
|
|
639
|
+
pushMissing(blockers, !!target.host, "Backend JS hotfix ".concat(label, " requires target host."));
|
|
640
|
+
pushMissing(blockers, !!target.path, "Backend JS hotfix ".concat(label, " requires target path."));
|
|
641
|
+
var checksumProof = checksumProofForBackendTarget(evidence, target, !structuredMultiTarget);
|
|
642
|
+
var checksumAfter = (checksumProof === null || checksumProof === void 0 ? void 0 : checksumProof.checksumAfter) || (checksumProof === null || checksumProof === void 0 ? void 0 : checksumProof.checksum) || '';
|
|
643
|
+
pushMissing(blockers, !!checksumAfter, "Backend JS hotfix ".concat(label, " requires remote checksum after replacement."));
|
|
644
|
+
if (checksumAfter && !isStrongRemoteChecksum(checksumAfter)) {
|
|
645
|
+
blockers.push("Backend JS hotfix ".concat(label, " remote checksum after replacement must be a strong hex checksum, not a label or placeholder."));
|
|
646
|
+
}
|
|
647
|
+
if ((checksumProof === null || checksumProof === void 0 ? void 0 : checksumProof.checksumBefore) && checksumAfter && checksumProof.checksumBefore === checksumAfter) {
|
|
648
|
+
blockers.push("Backend JS hotfix ".concat(label, " checksum did not change; record force/no-op evidence or do not claim a hotfix."));
|
|
649
|
+
}
|
|
650
|
+
var restartProof = hostStatusProofForBackendTarget(evidence.restartResults, target, structuredMultiTarget ? '' : (evidence.restartEvidence || evidence.serviceRestartEvidence ? 'passed' : ''));
|
|
651
|
+
pushMissing(blockers, !!restartProof && hotfixStatusPassed(restartProof.status || restartProof.evidence), "Backend JS hotfix ".concat(label, " requires restart evidence or passed restartResults status."));
|
|
652
|
+
var healthProof = hostStatusProofForBackendTarget(evidence.healthChecks, target, structuredMultiTarget ? '' : evidence.healthCheckStatus);
|
|
653
|
+
pushMissing(blockers, !!healthProof && hotfixStatusPassed(healthProof.status), "Backend JS hotfix ".concat(label, " requires passed healthCheckStatus or healthChecks status."));
|
|
654
|
+
var selfTestProof = hostStatusProofForBackendTarget(evidence.selfTests, target, structuredMultiTarget ? '' : evidence.selfTestStatus);
|
|
655
|
+
pushMissing(blockers, !!selfTestProof && hotfixStatusPassed(selfTestProof.status), "Backend JS hotfix ".concat(label, " requires passed selfTestStatus or selfTests status."));
|
|
656
|
+
if (selfTestProof && Number.isFinite(Number(selfTestProof.failedCount)) && Number(selfTestProof.failedCount) > 0) {
|
|
657
|
+
blockers.push("Backend JS hotfix ".concat(label, " selfTests failedCount must be 0."));
|
|
658
|
+
}
|
|
659
|
+
});
|
|
660
|
+
}
|
|
512
661
|
function githubCommitProofBlockers(value, channel) {
|
|
513
662
|
var blockers = [];
|
|
514
663
|
var sourceCommitSha = cleanText(value.sourceCommitSha, 120);
|
|
@@ -635,18 +784,7 @@ function validateResolveIOAIManagerHotfixEvidence(value, options) {
|
|
|
635
784
|
}
|
|
636
785
|
if (channel === 'backend_js') {
|
|
637
786
|
pushMissing(blockers, !!normalized.compiledArtifactPath, 'Backend JS hotfix requires compiledArtifactPath.');
|
|
638
|
-
|
|
639
|
-
pushMissing(blockers, !!target.path, 'Backend JS hotfix requires target.path.');
|
|
640
|
-
pushMissing(blockers, !!(normalized.remoteChecksumAfter || normalized.remoteChecksum), 'Backend JS hotfix requires remote checksum after replacement.');
|
|
641
|
-
if ((normalized.remoteChecksumAfter || normalized.remoteChecksum) && !isStrongRemoteChecksum(normalized.remoteChecksumAfter || normalized.remoteChecksum || '')) {
|
|
642
|
-
blockers.push('Backend JS hotfix remote checksum after replacement must be a strong hex checksum, not a label or placeholder.');
|
|
643
|
-
}
|
|
644
|
-
pushMissing(blockers, !!(normalized.restartEvidence || normalized.serviceRestartEvidence), 'Backend JS hotfix requires restart evidence.');
|
|
645
|
-
pushMissing(blockers, hotfixStatusPassed(normalized.healthCheckStatus), 'Backend JS hotfix requires passed healthCheckStatus.');
|
|
646
|
-
pushMissing(blockers, hotfixStatusPassed(normalized.selfTestStatus), 'Backend JS hotfix requires passed selfTestStatus.');
|
|
647
|
-
if (normalized.remoteChecksumBefore && normalized.remoteChecksumAfter && normalized.remoteChecksumBefore === normalized.remoteChecksumAfter) {
|
|
648
|
-
blockers.push('Backend JS hotfix checksum did not change; record force/no-op evidence or do not claim a hotfix.');
|
|
649
|
-
}
|
|
787
|
+
validateBackendHotfixTargetCoverage(normalized, blockers);
|
|
650
788
|
}
|
|
651
789
|
else if (channel === 'static_ui') {
|
|
652
790
|
pushMissing(blockers, !!normalized.builtDistPath, 'Static UI hotfix requires builtDistPath.');
|
|
@@ -744,14 +882,19 @@ function mergeHotfixEvidenceRecordInput(input) {
|
|
|
744
882
|
'channel',
|
|
745
883
|
'status',
|
|
746
884
|
'target',
|
|
885
|
+
'targets',
|
|
747
886
|
'compiledArtifactPath',
|
|
748
887
|
'builtDistPath',
|
|
749
888
|
'remoteChecksumBefore',
|
|
750
889
|
'remoteChecksumAfter',
|
|
751
890
|
'remoteChecksum',
|
|
891
|
+
'remoteChecksums',
|
|
752
892
|
'restartEvidence',
|
|
893
|
+
'restartResults',
|
|
753
894
|
'healthCheckStatus',
|
|
895
|
+
'healthChecks',
|
|
754
896
|
'selfTestStatus',
|
|
897
|
+
'selfTests',
|
|
755
898
|
'releaseGateStatus',
|
|
756
899
|
's3UploadResult',
|
|
757
900
|
'cloudfrontInvalidationId',
|
|
@@ -2838,9 +2981,11 @@ function buildResolveIOAIManagerRecoveryPlan(input) {
|
|
|
2838
2981
|
return makePlan('journey_contract_repair', 'Repair Journey Contract', 'Fix the first/next/last workflow contract before app code work continues.', 'journey_contract_repair', false, true, [
|
|
2839
2982
|
'Open docs/APP_JOURNEY_CONTRACT.md.',
|
|
2840
2983
|
'Define first_screen, north_star_workflow, screen_sequence, data_story, completion_states, and qa_assertions.',
|
|
2984
|
+
'Give every north_star_workflow step a stable id and map each screen_sequence row with workflow_step_id or exact route/CTA.',
|
|
2985
|
+
'Map every qa_assertions row to workflow_step_id or covers_workflow_step_ids so QA can walk first/next/last deterministically.',
|
|
2841
2986
|
'Ensure each CTA maps to an action, route, method, calculation, or state transition.',
|
|
2842
2987
|
'Validate that sample data can drive the promised workflow.'
|
|
2843
|
-
], ['validated journey_contract JSON', 'CTA-to-action mapping', 'workflow QA assertions'], ['journey validation passes', 'new workflow QA rows generated'], ['build empty routes', 'add link-only dashboard actions', 'defer workflow design to wow pass']);
|
|
2988
|
+
], ['validated journey_contract JSON', 'CTA-to-action mapping', 'screen-to-workflow mapping', 'workflow QA assertions mapped to step ids'], ['journey validation passes', 'new workflow QA rows generated'], ['build empty routes', 'add link-only dashboard actions', 'defer workflow design to wow pass']);
|
|
2844
2989
|
}
|
|
2845
2990
|
if (failureClass === 'release') {
|
|
2846
2991
|
return makePlan('release_repair', 'Repair Release Gate', 'Repair deploy/publish/sample-data release evidence with a hotfix-first path before any repeated full deploy.', 'release_repair_only', false, false, [
|