@resolveio/server-lib 22.3.186 → 22.3.187
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
|
@@ -2285,6 +2285,72 @@ function aicoderWorkflowProofCheckpointGate(checkpoint, now) {
|
|
|
2285
2285
|
}
|
|
2286
2286
|
};
|
|
2287
2287
|
}
|
|
2288
|
+
function aicoderNextActionContractObject(app, job, evidence) {
|
|
2289
|
+
var continuationDecision = plainObject(job.aicoderV6ContinuationDecision
|
|
2290
|
+
|| job.aiCoderV6ContinuationDecision
|
|
2291
|
+
|| job.aicoder_v6_continuation_decision
|
|
2292
|
+
|| job.ai_coder_v6_continuation_decision
|
|
2293
|
+
|| app.aicoderV6ContinuationDecision
|
|
2294
|
+
|| app.aiCoderV6ContinuationDecision
|
|
2295
|
+
|| app.aicoder_v6_continuation_decision
|
|
2296
|
+
|| evidence.aicoderV6ContinuationDecision
|
|
2297
|
+
|| evidence.aiCoderV6ContinuationDecision
|
|
2298
|
+
|| evidence.aicoder_v6_continuation_decision);
|
|
2299
|
+
return evidenceObject(continuationDecision.nextActionContract, continuationDecision.next_action_contract, job.nextActionContract, job.next_action_contract, job.aicoderNextActionContract, job.aicoder_next_action_contract, job.aiCoderNextActionContract, job.ai_coder_next_action_contract, app.nextActionContract, app.next_action_contract, evidence.nextActionContract, evidence.next_action_contract, evidence.aicoderNextActionContract, evidence.aicoder_next_action_contract);
|
|
2300
|
+
}
|
|
2301
|
+
function aicoderNextActionContractGate(contract, now) {
|
|
2302
|
+
var _a, _b, _c, _d, _e;
|
|
2303
|
+
if (!contract || !Object.keys(contract).length) {
|
|
2304
|
+
return undefined;
|
|
2305
|
+
}
|
|
2306
|
+
var safeToAutoRun = booleanFlag((_a = contract.safeToAutoRun) !== null && _a !== void 0 ? _a : contract.safe_to_auto_run) === true;
|
|
2307
|
+
var requiresHumanApproval = booleanFlag((_b = contract.requiresHumanApproval) !== null && _b !== void 0 ? _b : contract.requires_human_approval) === true;
|
|
2308
|
+
var canRunWithoutCodexMonitor = booleanFlag((_c = contract.canRunWithoutCodexMonitor) !== null && _c !== void 0 ? _c : contract.can_run_without_codex_monitor) === true;
|
|
2309
|
+
var codexFallbackRequired = booleanFlag((_d = contract.codexFallbackRequired) !== null && _d !== void 0 ? _d : contract.codex_fallback_required) === true;
|
|
2310
|
+
var blockers = cleanStringList(contract.blockers, 40, 500);
|
|
2311
|
+
var primaryCommand = cleanText(contract.primaryCommand || contract.primary_command, 200);
|
|
2312
|
+
var gateStatus = canRunWithoutCodexMonitor
|
|
2313
|
+
? 'pass'
|
|
2314
|
+
: requiresHumanApproval
|
|
2315
|
+
? 'blocked'
|
|
2316
|
+
: codexFallbackRequired
|
|
2317
|
+
? 'warn'
|
|
2318
|
+
: safeToAutoRun ? 'warn' : 'blocked';
|
|
2319
|
+
return {
|
|
2320
|
+
key: 'aicoder_next_action_contract',
|
|
2321
|
+
label: 'AICoder next action contract',
|
|
2322
|
+
status: gateStatus,
|
|
2323
|
+
reason: gateStatus === 'pass'
|
|
2324
|
+
? "AICoder can run ".concat(primaryCommand || 'the next action', " without a Codex monitor.")
|
|
2325
|
+
: (blockers.join(' ') || cleanText(contract.codexFallbackReason || contract.codex_fallback_reason || contract.expectedStateTransition || contract.expected_state_transition, 1200) || 'AICoder next action is not safe to run unattended.'),
|
|
2326
|
+
evidenceRefs: cleanStringList(__spreadArray(__spreadArray(__spreadArray([], __read(asArray(contract.preconditions)), false), __read(asArray(contract.successEvidence || contract.success_evidence)), false), __read(asArray(contract.stopConditions || contract.stop_conditions)), false), 40, 500),
|
|
2327
|
+
recordedAt: isoNow(now || contract.createdAt || contract.created_at || contract.recordedAt || contract.recorded_at),
|
|
2328
|
+
metadata: {
|
|
2329
|
+
contractId: cleanText(contract.contractId || contract.contract_id, 200),
|
|
2330
|
+
action: cleanText(contract.action, 120),
|
|
2331
|
+
label: cleanText(contract.label, 200),
|
|
2332
|
+
primaryCommand: primaryCommand,
|
|
2333
|
+
lane: cleanText(contract.lane, 120),
|
|
2334
|
+
stepType: cleanText(contract.stepType || contract.step_type, 120),
|
|
2335
|
+
safeToAutoRun: safeToAutoRun,
|
|
2336
|
+
requiresHumanApproval: requiresHumanApproval,
|
|
2337
|
+
canRunWithoutCodexMonitor: canRunWithoutCodexMonitor,
|
|
2338
|
+
codexFallbackRequired: codexFallbackRequired,
|
|
2339
|
+
codexFallbackReason: cleanText(contract.codexFallbackReason || contract.codex_fallback_reason, 1000),
|
|
2340
|
+
costRisk: cleanText(contract.costRisk || contract.cost_risk, 120),
|
|
2341
|
+
workflowFirstSatisfied: booleanFlag((_e = contract.workflowFirstSatisfied) !== null && _e !== void 0 ? _e : contract.workflow_first_satisfied) === true,
|
|
2342
|
+
decisionBasis: plainObject(contract.decisionBasis || contract.decision_basis),
|
|
2343
|
+
preconditions: cleanStringList(contract.preconditions, 40, 500),
|
|
2344
|
+
expectedStateTransition: cleanText(contract.expectedStateTransition || contract.expected_state_transition, 1000),
|
|
2345
|
+
successEvidence: cleanStringList(contract.successEvidence || contract.success_evidence, 40, 500),
|
|
2346
|
+
stopConditions: cleanStringList(contract.stopConditions || contract.stop_conditions, 40, 500),
|
|
2347
|
+
forbiddenActions: cleanStringList(contract.forbiddenActions || contract.forbidden_actions, 40, 500),
|
|
2348
|
+
nextCommands: cleanStringList(contract.nextCommands || contract.next_commands, 40, 240),
|
|
2349
|
+
blockers: blockers,
|
|
2350
|
+
ownerFiles: cleanStringList(contract.ownerFiles || contract.owner_files, 40, 500)
|
|
2351
|
+
}
|
|
2352
|
+
};
|
|
2353
|
+
}
|
|
2288
2354
|
function adapterStatusPassed(value) {
|
|
2289
2355
|
var normalized = cleanText(value, 120).toLowerCase();
|
|
2290
2356
|
return !!normalized && /(pass|passed|success|succeeded|ok|done|complete|completed|ready|saved|published|deployed)/i.test(normalized);
|
|
@@ -3002,7 +3068,7 @@ function buildSupportAIRunFromEvidence(input) {
|
|
|
3002
3068
|
}
|
|
3003
3069
|
function buildAICoderAIRunFromEvidence(input) {
|
|
3004
3070
|
var e_30, _a;
|
|
3005
|
-
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;
|
|
3071
|
+
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, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, _18, _19, _20, _21, _22, _23, _24, _25;
|
|
3006
3072
|
var app = input.app || {};
|
|
3007
3073
|
var job = input.job || {};
|
|
3008
3074
|
var evidence = buildAICoderQaEvidence(input);
|
|
@@ -3013,8 +3079,8 @@ function buildAICoderAIRunFromEvidence(input) {
|
|
|
3013
3079
|
addSourceId(sourceIds, 'jobId', job._id || job.id || job.jobId);
|
|
3014
3080
|
addSourceId(sourceIds, 'domain', app.domain || app.customDomain || job.domain);
|
|
3015
3081
|
try {
|
|
3016
|
-
for (var
|
|
3017
|
-
var log =
|
|
3082
|
+
for (var _26 = __values(asArray(input.logs)), _27 = _26.next(); !_27.done; _27 = _26.next()) {
|
|
3083
|
+
var log = _27.value;
|
|
3018
3084
|
pushEvent(events, {
|
|
3019
3085
|
type: log.type === 'scorecard' ? 'scorecard' : 'log',
|
|
3020
3086
|
category: cleanText(log.category || log.phase || log.level, 160),
|
|
@@ -3032,7 +3098,7 @@ function buildAICoderAIRunFromEvidence(input) {
|
|
|
3032
3098
|
catch (e_30_1) { e_30 = { error: e_30_1 }; }
|
|
3033
3099
|
finally {
|
|
3034
3100
|
try {
|
|
3035
|
-
if (
|
|
3101
|
+
if (_27 && !_27.done && (_a = _26.return)) _a.call(_26);
|
|
3036
3102
|
}
|
|
3037
3103
|
finally { if (e_30) throw e_30.error; }
|
|
3038
3104
|
}
|
|
@@ -3127,6 +3193,19 @@ function buildAICoderAIRunFromEvidence(input) {
|
|
|
3127
3193
|
metadata: workflowProofCheckpointGate.metadata
|
|
3128
3194
|
});
|
|
3129
3195
|
}
|
|
3196
|
+
var nextActionContract = aicoderNextActionContractObject(app, job, evidence);
|
|
3197
|
+
var nextActionContractGate = aicoderNextActionContractGate(nextActionContract, input.now);
|
|
3198
|
+
if (nextActionContractGate) {
|
|
3199
|
+
gates.push(nextActionContractGate);
|
|
3200
|
+
pushEvent(events, {
|
|
3201
|
+
type: 'log',
|
|
3202
|
+
category: 'aicoder_next_action_contract',
|
|
3203
|
+
message: nextActionContractGate.reason,
|
|
3204
|
+
artifactPaths: nextActionContractGate.evidenceRefs,
|
|
3205
|
+
recordedAt: nextActionContractGate.recordedAt,
|
|
3206
|
+
metadata: nextActionContractGate.metadata
|
|
3207
|
+
});
|
|
3208
|
+
}
|
|
3130
3209
|
var qa = applyAICoderWorkflowProofGate(buildQaFromEvidence(evidence, input.now), workflowReadiness, input.now);
|
|
3131
3210
|
return (0, ai_run_evidence_1.buildAIRun)({
|
|
3132
3211
|
source: 'aicoder_app',
|
|
@@ -3199,6 +3278,28 @@ function buildAICoderAIRunFromEvidence(input) {
|
|
|
3199
3278
|
workflowProofFingerprint: cleanText((_4 = workflowProofCheckpointGate.metadata) === null || _4 === void 0 ? void 0 : _4.workflowProofFingerprint, 200),
|
|
3200
3279
|
artifactFingerprint: cleanText((_5 = workflowProofCheckpointGate.metadata) === null || _5 === void 0 ? void 0 : _5.artifactFingerprint, 200),
|
|
3201
3280
|
blockers: cleanStringList((_6 = workflowProofCheckpointGate.metadata) === null || _6 === void 0 ? void 0 : _6.blockers, 20, 500)
|
|
3281
|
+
} : undefined,
|
|
3282
|
+
nextActionContract: nextActionContractGate ? {
|
|
3283
|
+
gateStatus: nextActionContractGate.status,
|
|
3284
|
+
contractId: cleanText((_7 = nextActionContractGate.metadata) === null || _7 === void 0 ? void 0 : _7.contractId, 200),
|
|
3285
|
+
action: cleanText((_8 = nextActionContractGate.metadata) === null || _8 === void 0 ? void 0 : _8.action, 120),
|
|
3286
|
+
label: cleanText((_9 = nextActionContractGate.metadata) === null || _9 === void 0 ? void 0 : _9.label, 200),
|
|
3287
|
+
primaryCommand: cleanText((_10 = nextActionContractGate.metadata) === null || _10 === void 0 ? void 0 : _10.primaryCommand, 200),
|
|
3288
|
+
lane: cleanText((_11 = nextActionContractGate.metadata) === null || _11 === void 0 ? void 0 : _11.lane, 120),
|
|
3289
|
+
stepType: cleanText((_12 = nextActionContractGate.metadata) === null || _12 === void 0 ? void 0 : _12.stepType, 120),
|
|
3290
|
+
safeToAutoRun: ((_13 = nextActionContractGate.metadata) === null || _13 === void 0 ? void 0 : _13.safeToAutoRun) === true,
|
|
3291
|
+
requiresHumanApproval: ((_14 = nextActionContractGate.metadata) === null || _14 === void 0 ? void 0 : _14.requiresHumanApproval) === true,
|
|
3292
|
+
canRunWithoutCodexMonitor: ((_15 = nextActionContractGate.metadata) === null || _15 === void 0 ? void 0 : _15.canRunWithoutCodexMonitor) === true,
|
|
3293
|
+
codexFallbackRequired: ((_16 = nextActionContractGate.metadata) === null || _16 === void 0 ? void 0 : _16.codexFallbackRequired) === true,
|
|
3294
|
+
costRisk: cleanText((_17 = nextActionContractGate.metadata) === null || _17 === void 0 ? void 0 : _17.costRisk, 120),
|
|
3295
|
+
workflowFirstSatisfied: ((_18 = nextActionContractGate.metadata) === null || _18 === void 0 ? void 0 : _18.workflowFirstSatisfied) === true,
|
|
3296
|
+
decisionBasis: plainObject((_19 = nextActionContractGate.metadata) === null || _19 === void 0 ? void 0 : _19.decisionBasis),
|
|
3297
|
+
preconditions: cleanStringList((_20 = nextActionContractGate.metadata) === null || _20 === void 0 ? void 0 : _20.preconditions, 20, 500),
|
|
3298
|
+
successEvidence: cleanStringList((_21 = nextActionContractGate.metadata) === null || _21 === void 0 ? void 0 : _21.successEvidence, 20, 500),
|
|
3299
|
+
stopConditions: cleanStringList((_22 = nextActionContractGate.metadata) === null || _22 === void 0 ? void 0 : _22.stopConditions, 20, 500),
|
|
3300
|
+
forbiddenActions: cleanStringList((_23 = nextActionContractGate.metadata) === null || _23 === void 0 ? void 0 : _23.forbiddenActions, 20, 500),
|
|
3301
|
+
nextCommands: cleanStringList((_24 = nextActionContractGate.metadata) === null || _24 === void 0 ? void 0 : _24.nextCommands, 20, 240),
|
|
3302
|
+
blockers: cleanStringList((_25 = nextActionContractGate.metadata) === null || _25 === void 0 ? void 0 : _25.blockers, 20, 500)
|
|
3202
3303
|
} : undefined
|
|
3203
3304
|
}
|
|
3204
3305
|
});
|