@resolveio/server-lib 22.3.174 → 22.3.175
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 +1 -1
- package/util/ai-run-evidence-adapters.js +116 -15
- package/util/ai-run-evidence-adapters.js.map +1 -1
- package/util/ai-run-evidence-eval.d.ts +2 -2
- package/util/ai-run-evidence-eval.js +13 -0
- package/util/ai-run-evidence-eval.js.map +1 -1
- package/util/ai-run-evidence.js +14 -0
- package/util/ai-run-evidence.js.map +1 -1
package/package.json
CHANGED
|
@@ -1780,6 +1780,16 @@ function buildAICoderQaEvidence(input) {
|
|
|
1780
1780
|
|| job.journey_contract_markdown
|
|
1781
1781
|
|| app.journeyContractMarkdown
|
|
1782
1782
|
|| app.journey_contract_markdown;
|
|
1783
|
+
evidence.journeyContractPath = firstNonEmptyText([
|
|
1784
|
+
evidence.journeyContractPath,
|
|
1785
|
+
evidence.journey_contract_path,
|
|
1786
|
+
workflowMemory.journeyContractPath,
|
|
1787
|
+
workflowMemory.journey_contract_path,
|
|
1788
|
+
job.journeyContractPath,
|
|
1789
|
+
job.journey_contract_path,
|
|
1790
|
+
app.journeyContractPath,
|
|
1791
|
+
app.journey_contract_path
|
|
1792
|
+
], 500) || 'docs/APP_JOURNEY_CONTRACT.md';
|
|
1783
1793
|
evidence.deployStatus = firstNonEmptyText([
|
|
1784
1794
|
evidence.deployStatus,
|
|
1785
1795
|
evidence.deploy_status,
|
|
@@ -1841,6 +1851,71 @@ function normalizeAICoderWorkflowProofReadiness(value, now) {
|
|
|
1841
1851
|
evaluatedAt: isoNow(now || value.evaluatedAt || value.evaluated_at || value.recordedAt || value.recorded_at)
|
|
1842
1852
|
};
|
|
1843
1853
|
}
|
|
1854
|
+
function aicoderJourneyContractValidationFromEvidence(evidence) {
|
|
1855
|
+
var journeyInput = evidence.journeyContract !== undefined && evidence.journeyContract !== null
|
|
1856
|
+
? evidence.journeyContract
|
|
1857
|
+
: evidence.journeyContractMarkdown;
|
|
1858
|
+
var hasJourneyInput = journeyInput !== undefined && journeyInput !== null && cleanText(journeyInput, 100).length > 0;
|
|
1859
|
+
if (!hasJourneyInput) {
|
|
1860
|
+
return {
|
|
1861
|
+
valid: false,
|
|
1862
|
+
contract: null,
|
|
1863
|
+
issues: [{
|
|
1864
|
+
code: 'missing_contract',
|
|
1865
|
+
path: cleanText(evidence.journeyContractPath, 500) || 'docs/APP_JOURNEY_CONTRACT.md',
|
|
1866
|
+
message: 'docs/APP_JOURNEY_CONTRACT.md with structured journey_contract JSON is required before AICoder build, workflow QA, wow UI, publish, or acceptance.',
|
|
1867
|
+
severity: 'error'
|
|
1868
|
+
}],
|
|
1869
|
+
workflowQaRows: [],
|
|
1870
|
+
primaryWorkflowId: ''
|
|
1871
|
+
};
|
|
1872
|
+
}
|
|
1873
|
+
return (0, aicoder_runner_v6_1.validateResolveIOAICoderJourneyContract)(journeyInput, {
|
|
1874
|
+
requireMarkdownEnvelope: typeof journeyInput === 'string'
|
|
1875
|
+
});
|
|
1876
|
+
}
|
|
1877
|
+
function aicoderJourneyContractGate(validation, evidence, now) {
|
|
1878
|
+
var errorIssues = validation.issues.filter(function (issue) { return issue.severity === 'error'; });
|
|
1879
|
+
var warningIssues = validation.issues.filter(function (issue) { return issue.severity === 'warning'; });
|
|
1880
|
+
var status = validation.valid
|
|
1881
|
+
? (warningIssues.length ? 'warn' : 'pass')
|
|
1882
|
+
: 'blocked';
|
|
1883
|
+
var path = cleanText(evidence.journeyContractPath, 500) || 'docs/APP_JOURNEY_CONTRACT.md';
|
|
1884
|
+
return {
|
|
1885
|
+
key: 'aicoder_journey_contract',
|
|
1886
|
+
label: 'AICoder journey contract',
|
|
1887
|
+
status: status,
|
|
1888
|
+
reason: validation.valid
|
|
1889
|
+
? (warningIssues.length
|
|
1890
|
+
? "Journey contract is valid with warnings: ".concat(warningIssues.map(function (issue) { return issue.message; }).slice(0, 3).join(' | '))
|
|
1891
|
+
: 'Journey contract validates first/next/last workflow, data story, completion states, and QA assertions.')
|
|
1892
|
+
: (errorIssues.map(function (issue) { return issue.message; }).slice(0, 5).join(' | ') || 'AICoder Journey Contract is missing or invalid.'),
|
|
1893
|
+
evidenceRefs: [path],
|
|
1894
|
+
recordedAt: isoNow(now),
|
|
1895
|
+
metadata: {
|
|
1896
|
+
path: path,
|
|
1897
|
+
valid: validation.valid,
|
|
1898
|
+
primaryWorkflowId: cleanText(validation.primaryWorkflowId, 200),
|
|
1899
|
+
workflowQaRowCount: validation.workflowQaRows.length,
|
|
1900
|
+
errorCount: errorIssues.length,
|
|
1901
|
+
warningCount: warningIssues.length,
|
|
1902
|
+
issueCodes: cleanStringList(validation.issues.map(function (issue) { return issue.code; }), 40, 120),
|
|
1903
|
+
issues: validation.issues.slice(0, 20).map(function (issue) { return ({
|
|
1904
|
+
code: cleanText(issue.code, 120),
|
|
1905
|
+
path: cleanText(issue.path, 500),
|
|
1906
|
+
severity: issue.severity,
|
|
1907
|
+
message: cleanText(issue.message, 800)
|
|
1908
|
+
}); }),
|
|
1909
|
+
blocksBuildUntilValid: !validation.valid,
|
|
1910
|
+
blocksWorkflowQaUntilValid: !validation.valid,
|
|
1911
|
+
blocksWowUiUntilWorkflowProof: !validation.valid,
|
|
1912
|
+
blocksPublishUntilWorkflowProof: !validation.valid,
|
|
1913
|
+
nextAction: validation.valid
|
|
1914
|
+
? 'Generate workflow QA rows from journey_contract.qa_assertions and execute the north-star workflow.'
|
|
1915
|
+
: 'Generate or repair docs/APP_JOURNEY_CONTRACT.md before app build, wow UI, publish, or acceptance.'
|
|
1916
|
+
}
|
|
1917
|
+
};
|
|
1918
|
+
}
|
|
1844
1919
|
function aicoderWorkflowProofReadinessGate(readiness, now) {
|
|
1845
1920
|
var status = readiness.ready
|
|
1846
1921
|
? 'pass'
|
|
@@ -2623,7 +2698,7 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
2623
2698
|
}
|
|
2624
2699
|
function buildAICoderAIRunFromEvidence(input) {
|
|
2625
2700
|
var e_30, _a;
|
|
2626
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
|
2701
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1, _2, _3, _4, _5, _6;
|
|
2627
2702
|
var app = input.app || {};
|
|
2628
2703
|
var job = input.job || {};
|
|
2629
2704
|
var evidence = buildAICoderQaEvidence(input);
|
|
@@ -2634,8 +2709,8 @@ function buildAICoderAIRunFromEvidence(input) {
|
|
|
2634
2709
|
addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
|
|
2635
2710
|
addSourceId(sourceIds, 'domain', app.domain || app.customDomain || job.domain);
|
|
2636
2711
|
try {
|
|
2637
|
-
for (var
|
|
2638
|
-
var log =
|
|
2712
|
+
for (var _7 = __values(asArray(input.logs)), _8 = _7.next(); !_8.done; _8 = _7.next()) {
|
|
2713
|
+
var log = _8.value;
|
|
2639
2714
|
pushEvent(events, {
|
|
2640
2715
|
type: log.type === 'scorecard' ? 'scorecard' : 'log',
|
|
2641
2716
|
category: cleanText(log.category || log.phase || log.level, 160),
|
|
@@ -2653,7 +2728,7 @@ function buildAICoderAIRunFromEvidence(input) {
|
|
|
2653
2728
|
catch (e_30_1) { e_30 = { error: e_30_1 }; }
|
|
2654
2729
|
finally {
|
|
2655
2730
|
try {
|
|
2656
|
-
if (
|
|
2731
|
+
if (_8 && !_8.done && (_a = _7.return)) _a.call(_7);
|
|
2657
2732
|
}
|
|
2658
2733
|
finally { if (e_30) throw e_30.error; }
|
|
2659
2734
|
}
|
|
@@ -2672,6 +2747,17 @@ function buildAICoderAIRunFromEvidence(input) {
|
|
|
2672
2747
|
});
|
|
2673
2748
|
}
|
|
2674
2749
|
var cost = collectUsageEvents(asArray(input.usageLedger), events);
|
|
2750
|
+
var journeyContractValidation = aicoderJourneyContractValidationFromEvidence(evidence);
|
|
2751
|
+
var journeyContractGate = aicoderJourneyContractGate(journeyContractValidation, evidence, input.now);
|
|
2752
|
+
gates.push(journeyContractGate);
|
|
2753
|
+
pushEvent(events, {
|
|
2754
|
+
type: 'log',
|
|
2755
|
+
category: 'aicoder_journey_contract',
|
|
2756
|
+
message: journeyContractGate.reason,
|
|
2757
|
+
artifactPaths: journeyContractGate.evidenceRefs,
|
|
2758
|
+
recordedAt: journeyContractGate.recordedAt,
|
|
2759
|
+
metadata: journeyContractGate.metadata
|
|
2760
|
+
});
|
|
2675
2761
|
var scorecardPassed = evidence.scorecardPassed === true
|
|
2676
2762
|
|| evidence.scorecardStatus === 'pass'
|
|
2677
2763
|
|| (Number((_c = (_b = evidence.score) !== null && _b !== void 0 ? _b : evidence.qualityScore) !== null && _c !== void 0 ? _c : 0) >= Number((_e = (_d = evidence.scoreThreshold) !== null && _d !== void 0 ? _d : job.scoreThreshold) !== null && _e !== void 0 ? _e : 90));
|
|
@@ -2765,6 +2851,21 @@ function buildAICoderAIRunFromEvidence(input) {
|
|
|
2765
2851
|
wowScore: (_g = evidence.wowScore) !== null && _g !== void 0 ? _g : job.wowScore,
|
|
2766
2852
|
score: (_h = evidence.score) !== null && _h !== void 0 ? _h : evidence.qualityScore,
|
|
2767
2853
|
managerNoBlindLoopPolicy: managerNoBlindLoopMetadata(noBlindLoopGate),
|
|
2854
|
+
journeyContract: {
|
|
2855
|
+
status: journeyContractGate.status,
|
|
2856
|
+
valid: ((_j = journeyContractGate.metadata) === null || _j === void 0 ? void 0 : _j.valid) === true,
|
|
2857
|
+
path: cleanText((_k = journeyContractGate.metadata) === null || _k === void 0 ? void 0 : _k.path, 500),
|
|
2858
|
+
primaryWorkflowId: cleanText((_l = journeyContractGate.metadata) === null || _l === void 0 ? void 0 : _l.primaryWorkflowId, 200),
|
|
2859
|
+
workflowQaRowCount: Number(((_m = journeyContractGate.metadata) === null || _m === void 0 ? void 0 : _m.workflowQaRowCount) || 0),
|
|
2860
|
+
errorCount: Number(((_o = journeyContractGate.metadata) === null || _o === void 0 ? void 0 : _o.errorCount) || 0),
|
|
2861
|
+
warningCount: Number(((_p = journeyContractGate.metadata) === null || _p === void 0 ? void 0 : _p.warningCount) || 0),
|
|
2862
|
+
issueCodes: cleanStringList((_q = journeyContractGate.metadata) === null || _q === void 0 ? void 0 : _q.issueCodes, 40, 120),
|
|
2863
|
+
blocksBuildUntilValid: ((_r = journeyContractGate.metadata) === null || _r === void 0 ? void 0 : _r.blocksBuildUntilValid) === true,
|
|
2864
|
+
blocksWorkflowQaUntilValid: ((_s = journeyContractGate.metadata) === null || _s === void 0 ? void 0 : _s.blocksWorkflowQaUntilValid) === true,
|
|
2865
|
+
blocksWowUiUntilWorkflowProof: ((_t = journeyContractGate.metadata) === null || _t === void 0 ? void 0 : _t.blocksWowUiUntilWorkflowProof) === true,
|
|
2866
|
+
blocksPublishUntilWorkflowProof: ((_u = journeyContractGate.metadata) === null || _u === void 0 ? void 0 : _u.blocksPublishUntilWorkflowProof) === true,
|
|
2867
|
+
nextAction: cleanText((_v = journeyContractGate.metadata) === null || _v === void 0 ? void 0 : _v.nextAction, 1000)
|
|
2868
|
+
},
|
|
2768
2869
|
workflowProofReadiness: {
|
|
2769
2870
|
ready: workflowReadiness.ready,
|
|
2770
2871
|
status: workflowReadiness.status,
|
|
@@ -2781,18 +2882,18 @@ function buildAICoderAIRunFromEvidence(input) {
|
|
|
2781
2882
|
proofFreshness: workflowReadiness.proofFreshness
|
|
2782
2883
|
},
|
|
2783
2884
|
workflowProofCheckpoint: workflowProofCheckpointGate ? {
|
|
2784
|
-
status: cleanText((
|
|
2885
|
+
status: cleanText((_w = workflowProofCheckpointGate.metadata) === null || _w === void 0 ? void 0 : _w.status, 120),
|
|
2785
2886
|
gateStatus: workflowProofCheckpointGate.status,
|
|
2786
|
-
readinessStatus: cleanText((
|
|
2787
|
-
nextGate: cleanText((
|
|
2788
|
-
nextAction: cleanText((
|
|
2789
|
-
blocksProductRepairUntilJourneyContract: ((
|
|
2790
|
-
blocksPublishUntilWorkflowProof: ((
|
|
2791
|
-
blocksPublishUntilReleaseGate: ((
|
|
2792
|
-
blocksWowUiUntilWorkflowProof: ((
|
|
2793
|
-
workflowProofFingerprint: cleanText((
|
|
2794
|
-
artifactFingerprint: cleanText((
|
|
2795
|
-
blockers: cleanStringList((
|
|
2887
|
+
readinessStatus: cleanText((_x = workflowProofCheckpointGate.metadata) === null || _x === void 0 ? void 0 : _x.readinessStatus, 120),
|
|
2888
|
+
nextGate: cleanText((_y = workflowProofCheckpointGate.metadata) === null || _y === void 0 ? void 0 : _y.nextGate, 120),
|
|
2889
|
+
nextAction: cleanText((_z = workflowProofCheckpointGate.metadata) === null || _z === void 0 ? void 0 : _z.nextAction, 1000),
|
|
2890
|
+
blocksProductRepairUntilJourneyContract: ((_0 = workflowProofCheckpointGate.metadata) === null || _0 === void 0 ? void 0 : _0.blocksProductRepairUntilJourneyContract) === true,
|
|
2891
|
+
blocksPublishUntilWorkflowProof: ((_1 = workflowProofCheckpointGate.metadata) === null || _1 === void 0 ? void 0 : _1.blocksPublishUntilWorkflowProof) === true,
|
|
2892
|
+
blocksPublishUntilReleaseGate: ((_2 = workflowProofCheckpointGate.metadata) === null || _2 === void 0 ? void 0 : _2.blocksPublishUntilReleaseGate) === true,
|
|
2893
|
+
blocksWowUiUntilWorkflowProof: ((_3 = workflowProofCheckpointGate.metadata) === null || _3 === void 0 ? void 0 : _3.blocksWowUiUntilWorkflowProof) === true,
|
|
2894
|
+
workflowProofFingerprint: cleanText((_4 = workflowProofCheckpointGate.metadata) === null || _4 === void 0 ? void 0 : _4.workflowProofFingerprint, 200),
|
|
2895
|
+
artifactFingerprint: cleanText((_5 = workflowProofCheckpointGate.metadata) === null || _5 === void 0 ? void 0 : _5.artifactFingerprint, 200),
|
|
2896
|
+
blockers: cleanStringList((_6 = workflowProofCheckpointGate.metadata) === null || _6 === void 0 ? void 0 : _6.blockers, 20, 500)
|
|
2796
2897
|
} : undefined
|
|
2797
2898
|
}
|
|
2798
2899
|
});
|