@riddledc/riddle-proof 0.8.13 → 0.8.15
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/dist/advanced/engine-harness.cjs +137 -31
- package/dist/advanced/engine-harness.js +1 -1
- package/dist/advanced/index.cjs +137 -31
- package/dist/advanced/index.js +2 -2
- package/dist/advanced/proof-run-engine.cjs +101 -31
- package/dist/advanced/proof-run-engine.js +1 -1
- package/dist/{chunk-SZUC4MDN.js → chunk-KTIDPXE2.js} +1 -1
- package/dist/{chunk-RTLA6CPP.js → chunk-RW4OUHN4.js} +36 -0
- package/dist/{chunk-JBY2SU5U.js → chunk-WJZYRUNV.js} +101 -31
- package/dist/cli/index.js +2 -2
- package/dist/cli.cjs +137 -31
- package/dist/cli.js +2 -2
- package/dist/engine-harness.cjs +137 -31
- package/dist/engine-harness.js +1 -1
- package/dist/index.cjs +137 -31
- package/dist/index.js +1 -1
- package/dist/proof-run-engine.cjs +101 -31
- package/dist/proof-run-engine.js +1 -1
- package/package.json +1 -1
- package/runtime/lib/verify.py +10 -0
- package/runtime/tests/recon_verify_smoke.py +8 -3
- package/runtime/tests/trust_boundary_regression.py +1 -0
|
@@ -1139,6 +1139,12 @@ function snapshotFor(statePath) {
|
|
|
1139
1139
|
function authorReady(state) {
|
|
1140
1140
|
return state?.author_status === "ready" || state?.proof_plan_status === "ready";
|
|
1141
1141
|
}
|
|
1142
|
+
function hasAuthoredProofPlan2(state = {}) {
|
|
1143
|
+
return Boolean((state?.proof_plan || "").trim()) && Boolean((state?.capture_script || "").trim());
|
|
1144
|
+
}
|
|
1145
|
+
function hasExplicitCaptureScript(state = {}) {
|
|
1146
|
+
return Boolean((state?.capture_script || "").trim());
|
|
1147
|
+
}
|
|
1142
1148
|
function implementationReady(state) {
|
|
1143
1149
|
return ["changes_detected", "completed"].includes(state?.implementation_status || "");
|
|
1144
1150
|
}
|
|
@@ -1169,6 +1175,45 @@ function latestReconHasRequiredBaselines(state) {
|
|
|
1169
1175
|
const baselines = latestReconCapturedBaselines(state);
|
|
1170
1176
|
return requiredReconBaselineLabels(state).every((label) => Boolean((baselines?.[label]?.url || "").trim()));
|
|
1171
1177
|
}
|
|
1178
|
+
function canAutoAcceptExplicitCaptureRecon(params, state) {
|
|
1179
|
+
const labels = requiredReconBaselineLabels(state);
|
|
1180
|
+
return Boolean(
|
|
1181
|
+
!implementationRequired(params, state) && hasExplicitCaptureScript(state) && ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "") && labels.length > 0 && latestReconHasRequiredBaselines(state)
|
|
1182
|
+
);
|
|
1183
|
+
}
|
|
1184
|
+
function applyExplicitCaptureReconAcceptance(state) {
|
|
1185
|
+
const baselines = promoteLatestReconBaselines(state);
|
|
1186
|
+
const labels = requiredReconBaselineLabels(state);
|
|
1187
|
+
const selected = latestReconAttempt(state) || {};
|
|
1188
|
+
state.recon_status = "ready_for_proof_plan";
|
|
1189
|
+
state.recon_results = state.recon_results || {};
|
|
1190
|
+
state.recon_results.status = "ready_for_proof_plan";
|
|
1191
|
+
state.recon_results.baselines = baselines;
|
|
1192
|
+
state.recon_assessment_request = {};
|
|
1193
|
+
state.recon_decision_request = {};
|
|
1194
|
+
state.recon_assessment = {
|
|
1195
|
+
decision: "ready_for_author",
|
|
1196
|
+
continue_with_stage: "author",
|
|
1197
|
+
source: "runner_auto_accept",
|
|
1198
|
+
summary: "Runner accepted recon automatically because this audit/no-diff run already supplied an explicit capture script, and the required baseline capture exists.",
|
|
1199
|
+
baseline_labels: labels
|
|
1200
|
+
};
|
|
1201
|
+
state.recon_assessment_source = "runner_auto_accept";
|
|
1202
|
+
state.recon_baseline_understanding = state.recon_baseline_understanding || {
|
|
1203
|
+
reference: state?.reference || state?.requested_reference || "before",
|
|
1204
|
+
target_route: selected?.plan?.target_path || state?.server_path || "/",
|
|
1205
|
+
proof_focus: state?.proof_plan || state?.change_request || "",
|
|
1206
|
+
stop_condition: "Verify must judge the authored capture evidence against the explicit proof packet."
|
|
1207
|
+
};
|
|
1208
|
+
if (hasAuthoredProofPlan2(state)) {
|
|
1209
|
+
state.author_status = "ready";
|
|
1210
|
+
state.proof_plan_status = "ready";
|
|
1211
|
+
} else {
|
|
1212
|
+
state.author_status = "needs_authoring";
|
|
1213
|
+
state.proof_plan_status = "needs_authoring";
|
|
1214
|
+
}
|
|
1215
|
+
return { baselines, labels };
|
|
1216
|
+
}
|
|
1172
1217
|
function hasReconBaselineUnderstanding(state) {
|
|
1173
1218
|
const understanding = state?.recon_assessment?.baseline_understanding || state?.recon_baseline_understanding || {};
|
|
1174
1219
|
return Boolean(
|
|
@@ -2195,6 +2240,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
2195
2240
|
state = readState(config.statePath);
|
|
2196
2241
|
}
|
|
2197
2242
|
}
|
|
2243
|
+
let reconAutoAcceptedExplicitCapture = false;
|
|
2198
2244
|
if (!state?.recon_results || state?.stage === "setup" || state?.stage === "preflight" || ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "") || requestedStage === "recon") {
|
|
2199
2245
|
const reconRes = runOne("recon");
|
|
2200
2246
|
executed.push(executedStep(reconRes));
|
|
@@ -2207,40 +2253,64 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
2207
2253
|
}
|
|
2208
2254
|
state = readState(config.statePath);
|
|
2209
2255
|
if (["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "")) {
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2256
|
+
if (canAutoAcceptExplicitCaptureRecon(params, state)) {
|
|
2257
|
+
const promoted = updateState(config.statePath, (currentState) => {
|
|
2258
|
+
applyExplicitCaptureReconAcceptance(currentState);
|
|
2259
|
+
});
|
|
2260
|
+
state = promoted;
|
|
2261
|
+
reconAutoAcceptedExplicitCapture = true;
|
|
2262
|
+
effectiveAdvanceStage = stageAfterAuthor(state, params);
|
|
2263
|
+
requestedStage = normalizeStageRequest(state, effectiveAdvanceStage);
|
|
2264
|
+
updateState(config.statePath, (currentState) => {
|
|
2265
|
+
currentState.last_requested_advance_stage = effectiveAdvanceStage;
|
|
2266
|
+
});
|
|
2267
|
+
recordAttempt("recon", "completed", "Recon baseline was captured and auto-accepted for an explicit audit/no-diff proof packet.", {
|
|
2268
|
+
autoApproved: true,
|
|
2269
|
+
checkpoint: "recon_auto_accept_explicit_capture",
|
|
2270
|
+
details: {
|
|
2271
|
+
executed,
|
|
2272
|
+
promotedBaselines: latestReconCapturedBaselines(state),
|
|
2273
|
+
baselineLabels: requiredReconBaselineLabels(state)
|
|
2274
|
+
}
|
|
2275
|
+
});
|
|
2276
|
+
} else {
|
|
2277
|
+
const reconAssessmentRequest = state?.recon_assessment_request || state?.recon_decision_request || null;
|
|
2278
|
+
const summary = "Recon gathered route hints, candidate paths, baseline captures, and observations. The supervising agent should now judge whether the latest baseline is trustworthy, whether recon should retry/reframe, and whether recon is done.";
|
|
2279
|
+
const reconDetails = {
|
|
2280
|
+
executed,
|
|
2281
|
+
latestAttempt: latestReconAttempt(state),
|
|
2282
|
+
latestCapturedBaselines: latestReconCapturedBaselines(state),
|
|
2283
|
+
reconAssessmentRequest
|
|
2284
|
+
};
|
|
2285
|
+
recordAttempt("recon", "checkpoint", summary, {
|
|
2286
|
+
autoApproved: reconRes.autoApproved || false,
|
|
2287
|
+
checkpoint: "recon_supervisor_judgment",
|
|
2288
|
+
details: reconDetails
|
|
2289
|
+
});
|
|
2290
|
+
return checkpoint(
|
|
2291
|
+
"recon",
|
|
2292
|
+
"recon_supervisor_judgment",
|
|
2293
|
+
summary,
|
|
2294
|
+
{
|
|
2295
|
+
nextActions: ["inspect_recon_packet", "supply_recon_assessment_json", "continue_internal_loop_with_checkpoint"],
|
|
2296
|
+
advanceOptions: ["recon", "author"],
|
|
2297
|
+
recommendedAdvanceStage: "recon",
|
|
2298
|
+
continueWithStage: "recon",
|
|
2299
|
+
blocking: false,
|
|
2300
|
+
details: reconDetails,
|
|
2301
|
+
reconAssessmentRequest,
|
|
2302
|
+
reconDecisionRequest: state?.recon_decision_request || null,
|
|
2303
|
+
executed
|
|
2304
|
+
}
|
|
2305
|
+
);
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
if (!reconAutoAcceptedExplicitCapture) {
|
|
2309
|
+
recordAttempt("recon", "completed", "Recon completed and promoted an approved baseline context.", {
|
|
2219
2310
|
autoApproved: reconRes.autoApproved || false,
|
|
2220
|
-
|
|
2221
|
-
details: reconDetails
|
|
2311
|
+
details: { executed }
|
|
2222
2312
|
});
|
|
2223
|
-
return checkpoint(
|
|
2224
|
-
"recon",
|
|
2225
|
-
"recon_supervisor_judgment",
|
|
2226
|
-
summary,
|
|
2227
|
-
{
|
|
2228
|
-
nextActions: ["inspect_recon_packet", "supply_recon_assessment_json", "continue_internal_loop_with_checkpoint"],
|
|
2229
|
-
advanceOptions: ["recon", "author"],
|
|
2230
|
-
recommendedAdvanceStage: "recon",
|
|
2231
|
-
continueWithStage: "recon",
|
|
2232
|
-
blocking: false,
|
|
2233
|
-
details: reconDetails,
|
|
2234
|
-
reconAssessmentRequest,
|
|
2235
|
-
reconDecisionRequest: state?.recon_decision_request || null,
|
|
2236
|
-
executed
|
|
2237
|
-
}
|
|
2238
|
-
);
|
|
2239
2313
|
}
|
|
2240
|
-
recordAttempt("recon", "completed", "Recon completed and promoted an approved baseline context.", {
|
|
2241
|
-
autoApproved: reconRes.autoApproved || false,
|
|
2242
|
-
details: { executed }
|
|
2243
|
-
});
|
|
2244
2314
|
}
|
|
2245
2315
|
state = readState(config.statePath);
|
|
2246
2316
|
if (!authorReady(state) || effectiveAdvanceStage === "author") {
|
|
@@ -5150,6 +5220,40 @@ function checkpointResponseContinuation(state, value) {
|
|
|
5150
5220
|
}
|
|
5151
5221
|
};
|
|
5152
5222
|
}
|
|
5223
|
+
function finalizedCheckpointResponseWithoutPacketResult(state, value) {
|
|
5224
|
+
if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
|
|
5225
|
+
const response = normalizeCheckpointResponse(value);
|
|
5226
|
+
if (!response) return null;
|
|
5227
|
+
if (isDuplicateCheckpointResponse(state, response)) return null;
|
|
5228
|
+
const at = timestamp3();
|
|
5229
|
+
state.checkpoint_history = [
|
|
5230
|
+
...state.checkpoint_history || [],
|
|
5231
|
+
{ ts: at, response }
|
|
5232
|
+
].slice(-25);
|
|
5233
|
+
appendRunEvent(state, {
|
|
5234
|
+
ts: at,
|
|
5235
|
+
kind: "checkpoint.response.ignored",
|
|
5236
|
+
checkpoint: response.checkpoint,
|
|
5237
|
+
stage: state.current_stage || "verify",
|
|
5238
|
+
summary: "Late checkpoint response ignored because the run is already finalized.",
|
|
5239
|
+
details: compactRecord({
|
|
5240
|
+
status: state.status,
|
|
5241
|
+
decision: response.decision,
|
|
5242
|
+
resume_token: response.resume_token,
|
|
5243
|
+
source: response.source
|
|
5244
|
+
})
|
|
5245
|
+
});
|
|
5246
|
+
persist(state);
|
|
5247
|
+
return createRunResult({
|
|
5248
|
+
state,
|
|
5249
|
+
status: state.status,
|
|
5250
|
+
last_summary: "Late checkpoint response ignored because the run is already finalized.",
|
|
5251
|
+
raw: {
|
|
5252
|
+
ignored_checkpoint_response: true,
|
|
5253
|
+
response
|
|
5254
|
+
}
|
|
5255
|
+
});
|
|
5256
|
+
}
|
|
5153
5257
|
function disabledAdapterPayload(action, context) {
|
|
5154
5258
|
return {
|
|
5155
5259
|
ok: false,
|
|
@@ -5720,6 +5824,8 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
5720
5824
|
const state = loadRunState(input);
|
|
5721
5825
|
state.request = normalizeRunParams({ ...state.request, ...input.request });
|
|
5722
5826
|
state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
|
|
5827
|
+
const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
|
|
5828
|
+
if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
|
|
5723
5829
|
const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
|
|
5724
5830
|
if (checkpointContinuation.blocker) {
|
|
5725
5831
|
return blockerResult(state, null, checkpointContinuation.blocker);
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
createDisabledRiddleProofAgentAdapter,
|
|
3
3
|
readRiddleProofRunStatus,
|
|
4
4
|
runRiddleProofEngineHarness
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-RW4OUHN4.js";
|
|
6
6
|
import "../chunk-YZUVEJ5B.js";
|
|
7
7
|
import "../chunk-FMOYUYH2.js";
|
|
8
8
|
import "../chunk-7GZY5PLT.js";
|
package/dist/advanced/index.cjs
CHANGED
|
@@ -1170,6 +1170,12 @@ function snapshotFor(statePath) {
|
|
|
1170
1170
|
function authorReady(state) {
|
|
1171
1171
|
return state?.author_status === "ready" || state?.proof_plan_status === "ready";
|
|
1172
1172
|
}
|
|
1173
|
+
function hasAuthoredProofPlan2(state = {}) {
|
|
1174
|
+
return Boolean((state?.proof_plan || "").trim()) && Boolean((state?.capture_script || "").trim());
|
|
1175
|
+
}
|
|
1176
|
+
function hasExplicitCaptureScript(state = {}) {
|
|
1177
|
+
return Boolean((state?.capture_script || "").trim());
|
|
1178
|
+
}
|
|
1173
1179
|
function implementationReady(state) {
|
|
1174
1180
|
return ["changes_detected", "completed"].includes(state?.implementation_status || "");
|
|
1175
1181
|
}
|
|
@@ -1200,6 +1206,45 @@ function latestReconHasRequiredBaselines(state) {
|
|
|
1200
1206
|
const baselines = latestReconCapturedBaselines(state);
|
|
1201
1207
|
return requiredReconBaselineLabels(state).every((label) => Boolean((baselines?.[label]?.url || "").trim()));
|
|
1202
1208
|
}
|
|
1209
|
+
function canAutoAcceptExplicitCaptureRecon(params, state) {
|
|
1210
|
+
const labels = requiredReconBaselineLabels(state);
|
|
1211
|
+
return Boolean(
|
|
1212
|
+
!implementationRequired(params, state) && hasExplicitCaptureScript(state) && ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "") && labels.length > 0 && latestReconHasRequiredBaselines(state)
|
|
1213
|
+
);
|
|
1214
|
+
}
|
|
1215
|
+
function applyExplicitCaptureReconAcceptance(state) {
|
|
1216
|
+
const baselines = promoteLatestReconBaselines(state);
|
|
1217
|
+
const labels = requiredReconBaselineLabels(state);
|
|
1218
|
+
const selected = latestReconAttempt(state) || {};
|
|
1219
|
+
state.recon_status = "ready_for_proof_plan";
|
|
1220
|
+
state.recon_results = state.recon_results || {};
|
|
1221
|
+
state.recon_results.status = "ready_for_proof_plan";
|
|
1222
|
+
state.recon_results.baselines = baselines;
|
|
1223
|
+
state.recon_assessment_request = {};
|
|
1224
|
+
state.recon_decision_request = {};
|
|
1225
|
+
state.recon_assessment = {
|
|
1226
|
+
decision: "ready_for_author",
|
|
1227
|
+
continue_with_stage: "author",
|
|
1228
|
+
source: "runner_auto_accept",
|
|
1229
|
+
summary: "Runner accepted recon automatically because this audit/no-diff run already supplied an explicit capture script, and the required baseline capture exists.",
|
|
1230
|
+
baseline_labels: labels
|
|
1231
|
+
};
|
|
1232
|
+
state.recon_assessment_source = "runner_auto_accept";
|
|
1233
|
+
state.recon_baseline_understanding = state.recon_baseline_understanding || {
|
|
1234
|
+
reference: state?.reference || state?.requested_reference || "before",
|
|
1235
|
+
target_route: selected?.plan?.target_path || state?.server_path || "/",
|
|
1236
|
+
proof_focus: state?.proof_plan || state?.change_request || "",
|
|
1237
|
+
stop_condition: "Verify must judge the authored capture evidence against the explicit proof packet."
|
|
1238
|
+
};
|
|
1239
|
+
if (hasAuthoredProofPlan2(state)) {
|
|
1240
|
+
state.author_status = "ready";
|
|
1241
|
+
state.proof_plan_status = "ready";
|
|
1242
|
+
} else {
|
|
1243
|
+
state.author_status = "needs_authoring";
|
|
1244
|
+
state.proof_plan_status = "needs_authoring";
|
|
1245
|
+
}
|
|
1246
|
+
return { baselines, labels };
|
|
1247
|
+
}
|
|
1203
1248
|
function hasReconBaselineUnderstanding(state) {
|
|
1204
1249
|
const understanding = state?.recon_assessment?.baseline_understanding || state?.recon_baseline_understanding || {};
|
|
1205
1250
|
return Boolean(
|
|
@@ -2226,6 +2271,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
2226
2271
|
state = readState(config.statePath);
|
|
2227
2272
|
}
|
|
2228
2273
|
}
|
|
2274
|
+
let reconAutoAcceptedExplicitCapture = false;
|
|
2229
2275
|
if (!state?.recon_results || state?.stage === "setup" || state?.stage === "preflight" || ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "") || requestedStage === "recon") {
|
|
2230
2276
|
const reconRes = runOne("recon");
|
|
2231
2277
|
executed.push(executedStep(reconRes));
|
|
@@ -2238,40 +2284,64 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
2238
2284
|
}
|
|
2239
2285
|
state = readState(config.statePath);
|
|
2240
2286
|
if (["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "")) {
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2287
|
+
if (canAutoAcceptExplicitCaptureRecon(params, state)) {
|
|
2288
|
+
const promoted = updateState(config.statePath, (currentState) => {
|
|
2289
|
+
applyExplicitCaptureReconAcceptance(currentState);
|
|
2290
|
+
});
|
|
2291
|
+
state = promoted;
|
|
2292
|
+
reconAutoAcceptedExplicitCapture = true;
|
|
2293
|
+
effectiveAdvanceStage = stageAfterAuthor(state, params);
|
|
2294
|
+
requestedStage = normalizeStageRequest(state, effectiveAdvanceStage);
|
|
2295
|
+
updateState(config.statePath, (currentState) => {
|
|
2296
|
+
currentState.last_requested_advance_stage = effectiveAdvanceStage;
|
|
2297
|
+
});
|
|
2298
|
+
recordAttempt("recon", "completed", "Recon baseline was captured and auto-accepted for an explicit audit/no-diff proof packet.", {
|
|
2299
|
+
autoApproved: true,
|
|
2300
|
+
checkpoint: "recon_auto_accept_explicit_capture",
|
|
2301
|
+
details: {
|
|
2302
|
+
executed,
|
|
2303
|
+
promotedBaselines: latestReconCapturedBaselines(state),
|
|
2304
|
+
baselineLabels: requiredReconBaselineLabels(state)
|
|
2305
|
+
}
|
|
2306
|
+
});
|
|
2307
|
+
} else {
|
|
2308
|
+
const reconAssessmentRequest = state?.recon_assessment_request || state?.recon_decision_request || null;
|
|
2309
|
+
const summary = "Recon gathered route hints, candidate paths, baseline captures, and observations. The supervising agent should now judge whether the latest baseline is trustworthy, whether recon should retry/reframe, and whether recon is done.";
|
|
2310
|
+
const reconDetails = {
|
|
2311
|
+
executed,
|
|
2312
|
+
latestAttempt: latestReconAttempt(state),
|
|
2313
|
+
latestCapturedBaselines: latestReconCapturedBaselines(state),
|
|
2314
|
+
reconAssessmentRequest
|
|
2315
|
+
};
|
|
2316
|
+
recordAttempt("recon", "checkpoint", summary, {
|
|
2317
|
+
autoApproved: reconRes.autoApproved || false,
|
|
2318
|
+
checkpoint: "recon_supervisor_judgment",
|
|
2319
|
+
details: reconDetails
|
|
2320
|
+
});
|
|
2321
|
+
return checkpoint(
|
|
2322
|
+
"recon",
|
|
2323
|
+
"recon_supervisor_judgment",
|
|
2324
|
+
summary,
|
|
2325
|
+
{
|
|
2326
|
+
nextActions: ["inspect_recon_packet", "supply_recon_assessment_json", "continue_internal_loop_with_checkpoint"],
|
|
2327
|
+
advanceOptions: ["recon", "author"],
|
|
2328
|
+
recommendedAdvanceStage: "recon",
|
|
2329
|
+
continueWithStage: "recon",
|
|
2330
|
+
blocking: false,
|
|
2331
|
+
details: reconDetails,
|
|
2332
|
+
reconAssessmentRequest,
|
|
2333
|
+
reconDecisionRequest: state?.recon_decision_request || null,
|
|
2334
|
+
executed
|
|
2335
|
+
}
|
|
2336
|
+
);
|
|
2337
|
+
}
|
|
2338
|
+
}
|
|
2339
|
+
if (!reconAutoAcceptedExplicitCapture) {
|
|
2340
|
+
recordAttempt("recon", "completed", "Recon completed and promoted an approved baseline context.", {
|
|
2250
2341
|
autoApproved: reconRes.autoApproved || false,
|
|
2251
|
-
|
|
2252
|
-
details: reconDetails
|
|
2342
|
+
details: { executed }
|
|
2253
2343
|
});
|
|
2254
|
-
return checkpoint(
|
|
2255
|
-
"recon",
|
|
2256
|
-
"recon_supervisor_judgment",
|
|
2257
|
-
summary,
|
|
2258
|
-
{
|
|
2259
|
-
nextActions: ["inspect_recon_packet", "supply_recon_assessment_json", "continue_internal_loop_with_checkpoint"],
|
|
2260
|
-
advanceOptions: ["recon", "author"],
|
|
2261
|
-
recommendedAdvanceStage: "recon",
|
|
2262
|
-
continueWithStage: "recon",
|
|
2263
|
-
blocking: false,
|
|
2264
|
-
details: reconDetails,
|
|
2265
|
-
reconAssessmentRequest,
|
|
2266
|
-
reconDecisionRequest: state?.recon_decision_request || null,
|
|
2267
|
-
executed
|
|
2268
|
-
}
|
|
2269
|
-
);
|
|
2270
2344
|
}
|
|
2271
|
-
recordAttempt("recon", "completed", "Recon completed and promoted an approved baseline context.", {
|
|
2272
|
-
autoApproved: reconRes.autoApproved || false,
|
|
2273
|
-
details: { executed }
|
|
2274
|
-
});
|
|
2275
2345
|
}
|
|
2276
2346
|
state = readState(config.statePath);
|
|
2277
2347
|
if (!authorReady(state) || effectiveAdvanceStage === "author") {
|
|
@@ -5687,6 +5757,40 @@ function checkpointResponseContinuation(state, value) {
|
|
|
5687
5757
|
}
|
|
5688
5758
|
};
|
|
5689
5759
|
}
|
|
5760
|
+
function finalizedCheckpointResponseWithoutPacketResult(state, value) {
|
|
5761
|
+
if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
|
|
5762
|
+
const response = normalizeCheckpointResponse(value);
|
|
5763
|
+
if (!response) return null;
|
|
5764
|
+
if (isDuplicateCheckpointResponse(state, response)) return null;
|
|
5765
|
+
const at = timestamp3();
|
|
5766
|
+
state.checkpoint_history = [
|
|
5767
|
+
...state.checkpoint_history || [],
|
|
5768
|
+
{ ts: at, response }
|
|
5769
|
+
].slice(-25);
|
|
5770
|
+
appendRunEvent(state, {
|
|
5771
|
+
ts: at,
|
|
5772
|
+
kind: "checkpoint.response.ignored",
|
|
5773
|
+
checkpoint: response.checkpoint,
|
|
5774
|
+
stage: state.current_stage || "verify",
|
|
5775
|
+
summary: "Late checkpoint response ignored because the run is already finalized.",
|
|
5776
|
+
details: compactRecord({
|
|
5777
|
+
status: state.status,
|
|
5778
|
+
decision: response.decision,
|
|
5779
|
+
resume_token: response.resume_token,
|
|
5780
|
+
source: response.source
|
|
5781
|
+
})
|
|
5782
|
+
});
|
|
5783
|
+
persist(state);
|
|
5784
|
+
return createRunResult({
|
|
5785
|
+
state,
|
|
5786
|
+
status: state.status,
|
|
5787
|
+
last_summary: "Late checkpoint response ignored because the run is already finalized.",
|
|
5788
|
+
raw: {
|
|
5789
|
+
ignored_checkpoint_response: true,
|
|
5790
|
+
response
|
|
5791
|
+
}
|
|
5792
|
+
});
|
|
5793
|
+
}
|
|
5690
5794
|
function disabledAdapterPayload(action, context) {
|
|
5691
5795
|
return {
|
|
5692
5796
|
ok: false,
|
|
@@ -6257,6 +6361,8 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
6257
6361
|
const state = loadRunState(input);
|
|
6258
6362
|
state.request = normalizeRunParams({ ...state.request, ...input.request });
|
|
6259
6363
|
state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
|
|
6364
|
+
const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
|
|
6365
|
+
if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
|
|
6260
6366
|
const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
|
|
6261
6367
|
if (checkpointContinuation.blocker) {
|
|
6262
6368
|
return blockerResult(state, null, checkpointContinuation.blocker);
|
package/dist/advanced/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
proof_run_engine_exports
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-WJZYRUNV.js";
|
|
4
4
|
import {
|
|
5
5
|
runner_exports
|
|
6
6
|
} from "../chunk-NGX4SUQN.js";
|
|
7
7
|
import {
|
|
8
8
|
engine_harness_exports
|
|
9
|
-
} from "../chunk-
|
|
9
|
+
} from "../chunk-RW4OUHN4.js";
|
|
10
10
|
import "../chunk-YZUVEJ5B.js";
|
|
11
11
|
import "../chunk-FMOYUYH2.js";
|
|
12
12
|
import {
|
|
@@ -1138,6 +1138,12 @@ function snapshotFor(statePath) {
|
|
|
1138
1138
|
function authorReady(state) {
|
|
1139
1139
|
return state?.author_status === "ready" || state?.proof_plan_status === "ready";
|
|
1140
1140
|
}
|
|
1141
|
+
function hasAuthoredProofPlan2(state = {}) {
|
|
1142
|
+
return Boolean((state?.proof_plan || "").trim()) && Boolean((state?.capture_script || "").trim());
|
|
1143
|
+
}
|
|
1144
|
+
function hasExplicitCaptureScript(state = {}) {
|
|
1145
|
+
return Boolean((state?.capture_script || "").trim());
|
|
1146
|
+
}
|
|
1141
1147
|
function implementationReady(state) {
|
|
1142
1148
|
return ["changes_detected", "completed"].includes(state?.implementation_status || "");
|
|
1143
1149
|
}
|
|
@@ -1168,6 +1174,45 @@ function latestReconHasRequiredBaselines(state) {
|
|
|
1168
1174
|
const baselines = latestReconCapturedBaselines(state);
|
|
1169
1175
|
return requiredReconBaselineLabels(state).every((label) => Boolean((baselines?.[label]?.url || "").trim()));
|
|
1170
1176
|
}
|
|
1177
|
+
function canAutoAcceptExplicitCaptureRecon(params, state) {
|
|
1178
|
+
const labels = requiredReconBaselineLabels(state);
|
|
1179
|
+
return Boolean(
|
|
1180
|
+
!implementationRequired(params, state) && hasExplicitCaptureScript(state) && ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "") && labels.length > 0 && latestReconHasRequiredBaselines(state)
|
|
1181
|
+
);
|
|
1182
|
+
}
|
|
1183
|
+
function applyExplicitCaptureReconAcceptance(state) {
|
|
1184
|
+
const baselines = promoteLatestReconBaselines(state);
|
|
1185
|
+
const labels = requiredReconBaselineLabels(state);
|
|
1186
|
+
const selected = latestReconAttempt(state) || {};
|
|
1187
|
+
state.recon_status = "ready_for_proof_plan";
|
|
1188
|
+
state.recon_results = state.recon_results || {};
|
|
1189
|
+
state.recon_results.status = "ready_for_proof_plan";
|
|
1190
|
+
state.recon_results.baselines = baselines;
|
|
1191
|
+
state.recon_assessment_request = {};
|
|
1192
|
+
state.recon_decision_request = {};
|
|
1193
|
+
state.recon_assessment = {
|
|
1194
|
+
decision: "ready_for_author",
|
|
1195
|
+
continue_with_stage: "author",
|
|
1196
|
+
source: "runner_auto_accept",
|
|
1197
|
+
summary: "Runner accepted recon automatically because this audit/no-diff run already supplied an explicit capture script, and the required baseline capture exists.",
|
|
1198
|
+
baseline_labels: labels
|
|
1199
|
+
};
|
|
1200
|
+
state.recon_assessment_source = "runner_auto_accept";
|
|
1201
|
+
state.recon_baseline_understanding = state.recon_baseline_understanding || {
|
|
1202
|
+
reference: state?.reference || state?.requested_reference || "before",
|
|
1203
|
+
target_route: selected?.plan?.target_path || state?.server_path || "/",
|
|
1204
|
+
proof_focus: state?.proof_plan || state?.change_request || "",
|
|
1205
|
+
stop_condition: "Verify must judge the authored capture evidence against the explicit proof packet."
|
|
1206
|
+
};
|
|
1207
|
+
if (hasAuthoredProofPlan2(state)) {
|
|
1208
|
+
state.author_status = "ready";
|
|
1209
|
+
state.proof_plan_status = "ready";
|
|
1210
|
+
} else {
|
|
1211
|
+
state.author_status = "needs_authoring";
|
|
1212
|
+
state.proof_plan_status = "needs_authoring";
|
|
1213
|
+
}
|
|
1214
|
+
return { baselines, labels };
|
|
1215
|
+
}
|
|
1171
1216
|
function hasReconBaselineUnderstanding(state) {
|
|
1172
1217
|
const understanding = state?.recon_assessment?.baseline_understanding || state?.recon_baseline_understanding || {};
|
|
1173
1218
|
return Boolean(
|
|
@@ -2195,6 +2240,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
2195
2240
|
state = readState(config.statePath);
|
|
2196
2241
|
}
|
|
2197
2242
|
}
|
|
2243
|
+
let reconAutoAcceptedExplicitCapture = false;
|
|
2198
2244
|
if (!state?.recon_results || state?.stage === "setup" || state?.stage === "preflight" || ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "") || requestedStage === "recon") {
|
|
2199
2245
|
const reconRes = runOne("recon");
|
|
2200
2246
|
executed.push(executedStep(reconRes));
|
|
@@ -2207,40 +2253,64 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
2207
2253
|
}
|
|
2208
2254
|
state = readState(config.statePath);
|
|
2209
2255
|
if (["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "")) {
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
2218
|
-
|
|
2256
|
+
if (canAutoAcceptExplicitCaptureRecon(params, state)) {
|
|
2257
|
+
const promoted = updateState(config.statePath, (currentState) => {
|
|
2258
|
+
applyExplicitCaptureReconAcceptance(currentState);
|
|
2259
|
+
});
|
|
2260
|
+
state = promoted;
|
|
2261
|
+
reconAutoAcceptedExplicitCapture = true;
|
|
2262
|
+
effectiveAdvanceStage = stageAfterAuthor(state, params);
|
|
2263
|
+
requestedStage = normalizeStageRequest(state, effectiveAdvanceStage);
|
|
2264
|
+
updateState(config.statePath, (currentState) => {
|
|
2265
|
+
currentState.last_requested_advance_stage = effectiveAdvanceStage;
|
|
2266
|
+
});
|
|
2267
|
+
recordAttempt("recon", "completed", "Recon baseline was captured and auto-accepted for an explicit audit/no-diff proof packet.", {
|
|
2268
|
+
autoApproved: true,
|
|
2269
|
+
checkpoint: "recon_auto_accept_explicit_capture",
|
|
2270
|
+
details: {
|
|
2271
|
+
executed,
|
|
2272
|
+
promotedBaselines: latestReconCapturedBaselines(state),
|
|
2273
|
+
baselineLabels: requiredReconBaselineLabels(state)
|
|
2274
|
+
}
|
|
2275
|
+
});
|
|
2276
|
+
} else {
|
|
2277
|
+
const reconAssessmentRequest = state?.recon_assessment_request || state?.recon_decision_request || null;
|
|
2278
|
+
const summary = "Recon gathered route hints, candidate paths, baseline captures, and observations. The supervising agent should now judge whether the latest baseline is trustworthy, whether recon should retry/reframe, and whether recon is done.";
|
|
2279
|
+
const reconDetails = {
|
|
2280
|
+
executed,
|
|
2281
|
+
latestAttempt: latestReconAttempt(state),
|
|
2282
|
+
latestCapturedBaselines: latestReconCapturedBaselines(state),
|
|
2283
|
+
reconAssessmentRequest
|
|
2284
|
+
};
|
|
2285
|
+
recordAttempt("recon", "checkpoint", summary, {
|
|
2286
|
+
autoApproved: reconRes.autoApproved || false,
|
|
2287
|
+
checkpoint: "recon_supervisor_judgment",
|
|
2288
|
+
details: reconDetails
|
|
2289
|
+
});
|
|
2290
|
+
return checkpoint(
|
|
2291
|
+
"recon",
|
|
2292
|
+
"recon_supervisor_judgment",
|
|
2293
|
+
summary,
|
|
2294
|
+
{
|
|
2295
|
+
nextActions: ["inspect_recon_packet", "supply_recon_assessment_json", "continue_internal_loop_with_checkpoint"],
|
|
2296
|
+
advanceOptions: ["recon", "author"],
|
|
2297
|
+
recommendedAdvanceStage: "recon",
|
|
2298
|
+
continueWithStage: "recon",
|
|
2299
|
+
blocking: false,
|
|
2300
|
+
details: reconDetails,
|
|
2301
|
+
reconAssessmentRequest,
|
|
2302
|
+
reconDecisionRequest: state?.recon_decision_request || null,
|
|
2303
|
+
executed
|
|
2304
|
+
}
|
|
2305
|
+
);
|
|
2306
|
+
}
|
|
2307
|
+
}
|
|
2308
|
+
if (!reconAutoAcceptedExplicitCapture) {
|
|
2309
|
+
recordAttempt("recon", "completed", "Recon completed and promoted an approved baseline context.", {
|
|
2219
2310
|
autoApproved: reconRes.autoApproved || false,
|
|
2220
|
-
|
|
2221
|
-
details: reconDetails
|
|
2311
|
+
details: { executed }
|
|
2222
2312
|
});
|
|
2223
|
-
return checkpoint(
|
|
2224
|
-
"recon",
|
|
2225
|
-
"recon_supervisor_judgment",
|
|
2226
|
-
summary,
|
|
2227
|
-
{
|
|
2228
|
-
nextActions: ["inspect_recon_packet", "supply_recon_assessment_json", "continue_internal_loop_with_checkpoint"],
|
|
2229
|
-
advanceOptions: ["recon", "author"],
|
|
2230
|
-
recommendedAdvanceStage: "recon",
|
|
2231
|
-
continueWithStage: "recon",
|
|
2232
|
-
blocking: false,
|
|
2233
|
-
details: reconDetails,
|
|
2234
|
-
reconAssessmentRequest,
|
|
2235
|
-
reconDecisionRequest: state?.recon_decision_request || null,
|
|
2236
|
-
executed
|
|
2237
|
-
}
|
|
2238
|
-
);
|
|
2239
2313
|
}
|
|
2240
|
-
recordAttempt("recon", "completed", "Recon completed and promoted an approved baseline context.", {
|
|
2241
|
-
autoApproved: reconRes.autoApproved || false,
|
|
2242
|
-
details: { executed }
|
|
2243
|
-
});
|
|
2244
2314
|
}
|
|
2245
2315
|
state = readState(config.statePath);
|
|
2246
2316
|
if (!authorReady(state) || effectiveAdvanceStage === "author") {
|