@riddledc/riddle-proof 0.8.13 → 0.8.14
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 +101 -31
- package/dist/advanced/engine-harness.js +1 -1
- package/dist/advanced/index.cjs +101 -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-EGZT3EVL.js} +1 -1
- package/dist/{chunk-JBY2SU5U.js → chunk-WJZYRUNV.js} +101 -31
- package/dist/cli/index.js +2 -2
- package/dist/cli.cjs +101 -31
- package/dist/cli.js +2 -2
- package/dist/engine-harness.cjs +101 -31
- package/dist/engine-harness.js +1 -1
- package/dist/index.cjs +101 -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/dist/{chunk-RTLA6CPP.js → chunk-YFRPFV4U.js} +0 -0
|
@@ -35,6 +35,12 @@ function snapshotFor(statePath) {
|
|
|
35
35
|
function authorReady(state) {
|
|
36
36
|
return state?.author_status === "ready" || state?.proof_plan_status === "ready";
|
|
37
37
|
}
|
|
38
|
+
function hasAuthoredProofPlan(state = {}) {
|
|
39
|
+
return Boolean((state?.proof_plan || "").trim()) && Boolean((state?.capture_script || "").trim());
|
|
40
|
+
}
|
|
41
|
+
function hasExplicitCaptureScript(state = {}) {
|
|
42
|
+
return Boolean((state?.capture_script || "").trim());
|
|
43
|
+
}
|
|
38
44
|
function implementationReady(state) {
|
|
39
45
|
return ["changes_detected", "completed"].includes(state?.implementation_status || "");
|
|
40
46
|
}
|
|
@@ -65,6 +71,45 @@ function latestReconHasRequiredBaselines(state) {
|
|
|
65
71
|
const baselines = latestReconCapturedBaselines(state);
|
|
66
72
|
return requiredReconBaselineLabels(state).every((label) => Boolean((baselines?.[label]?.url || "").trim()));
|
|
67
73
|
}
|
|
74
|
+
function canAutoAcceptExplicitCaptureRecon(params, state) {
|
|
75
|
+
const labels = requiredReconBaselineLabels(state);
|
|
76
|
+
return Boolean(
|
|
77
|
+
!implementationRequired(params, state) && hasExplicitCaptureScript(state) && ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "") && labels.length > 0 && latestReconHasRequiredBaselines(state)
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
function applyExplicitCaptureReconAcceptance(state) {
|
|
81
|
+
const baselines = promoteLatestReconBaselines(state);
|
|
82
|
+
const labels = requiredReconBaselineLabels(state);
|
|
83
|
+
const selected = latestReconAttempt(state) || {};
|
|
84
|
+
state.recon_status = "ready_for_proof_plan";
|
|
85
|
+
state.recon_results = state.recon_results || {};
|
|
86
|
+
state.recon_results.status = "ready_for_proof_plan";
|
|
87
|
+
state.recon_results.baselines = baselines;
|
|
88
|
+
state.recon_assessment_request = {};
|
|
89
|
+
state.recon_decision_request = {};
|
|
90
|
+
state.recon_assessment = {
|
|
91
|
+
decision: "ready_for_author",
|
|
92
|
+
continue_with_stage: "author",
|
|
93
|
+
source: "runner_auto_accept",
|
|
94
|
+
summary: "Runner accepted recon automatically because this audit/no-diff run already supplied an explicit capture script, and the required baseline capture exists.",
|
|
95
|
+
baseline_labels: labels
|
|
96
|
+
};
|
|
97
|
+
state.recon_assessment_source = "runner_auto_accept";
|
|
98
|
+
state.recon_baseline_understanding = state.recon_baseline_understanding || {
|
|
99
|
+
reference: state?.reference || state?.requested_reference || "before",
|
|
100
|
+
target_route: selected?.plan?.target_path || state?.server_path || "/",
|
|
101
|
+
proof_focus: state?.proof_plan || state?.change_request || "",
|
|
102
|
+
stop_condition: "Verify must judge the authored capture evidence against the explicit proof packet."
|
|
103
|
+
};
|
|
104
|
+
if (hasAuthoredProofPlan(state)) {
|
|
105
|
+
state.author_status = "ready";
|
|
106
|
+
state.proof_plan_status = "ready";
|
|
107
|
+
} else {
|
|
108
|
+
state.author_status = "needs_authoring";
|
|
109
|
+
state.proof_plan_status = "needs_authoring";
|
|
110
|
+
}
|
|
111
|
+
return { baselines, labels };
|
|
112
|
+
}
|
|
68
113
|
function hasReconBaselineUnderstanding(state) {
|
|
69
114
|
const understanding = state?.recon_assessment?.baseline_understanding || state?.recon_baseline_understanding || {};
|
|
70
115
|
return Boolean(
|
|
@@ -1092,6 +1137,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
1092
1137
|
state = readState(config.statePath);
|
|
1093
1138
|
}
|
|
1094
1139
|
}
|
|
1140
|
+
let reconAutoAcceptedExplicitCapture = false;
|
|
1095
1141
|
if (!state?.recon_results || state?.stage === "setup" || state?.stage === "preflight" || ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "") || requestedStage === "recon") {
|
|
1096
1142
|
const reconRes = runOne("recon");
|
|
1097
1143
|
executed.push(executedStep(reconRes));
|
|
@@ -1104,40 +1150,64 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
|
|
|
1104
1150
|
}
|
|
1105
1151
|
state = readState(config.statePath);
|
|
1106
1152
|
if (["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "")) {
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1153
|
+
if (canAutoAcceptExplicitCaptureRecon(params, state)) {
|
|
1154
|
+
const promoted = updateState(config.statePath, (currentState) => {
|
|
1155
|
+
applyExplicitCaptureReconAcceptance(currentState);
|
|
1156
|
+
});
|
|
1157
|
+
state = promoted;
|
|
1158
|
+
reconAutoAcceptedExplicitCapture = true;
|
|
1159
|
+
effectiveAdvanceStage = stageAfterAuthor(state, params);
|
|
1160
|
+
requestedStage = normalizeStageRequest(state, effectiveAdvanceStage);
|
|
1161
|
+
updateState(config.statePath, (currentState) => {
|
|
1162
|
+
currentState.last_requested_advance_stage = effectiveAdvanceStage;
|
|
1163
|
+
});
|
|
1164
|
+
recordAttempt("recon", "completed", "Recon baseline was captured and auto-accepted for an explicit audit/no-diff proof packet.", {
|
|
1165
|
+
autoApproved: true,
|
|
1166
|
+
checkpoint: "recon_auto_accept_explicit_capture",
|
|
1167
|
+
details: {
|
|
1168
|
+
executed,
|
|
1169
|
+
promotedBaselines: latestReconCapturedBaselines(state),
|
|
1170
|
+
baselineLabels: requiredReconBaselineLabels(state)
|
|
1171
|
+
}
|
|
1172
|
+
});
|
|
1173
|
+
} else {
|
|
1174
|
+
const reconAssessmentRequest = state?.recon_assessment_request || state?.recon_decision_request || null;
|
|
1175
|
+
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.";
|
|
1176
|
+
const reconDetails = {
|
|
1177
|
+
executed,
|
|
1178
|
+
latestAttempt: latestReconAttempt(state),
|
|
1179
|
+
latestCapturedBaselines: latestReconCapturedBaselines(state),
|
|
1180
|
+
reconAssessmentRequest
|
|
1181
|
+
};
|
|
1182
|
+
recordAttempt("recon", "checkpoint", summary, {
|
|
1183
|
+
autoApproved: reconRes.autoApproved || false,
|
|
1184
|
+
checkpoint: "recon_supervisor_judgment",
|
|
1185
|
+
details: reconDetails
|
|
1186
|
+
});
|
|
1187
|
+
return checkpoint(
|
|
1188
|
+
"recon",
|
|
1189
|
+
"recon_supervisor_judgment",
|
|
1190
|
+
summary,
|
|
1191
|
+
{
|
|
1192
|
+
nextActions: ["inspect_recon_packet", "supply_recon_assessment_json", "continue_internal_loop_with_checkpoint"],
|
|
1193
|
+
advanceOptions: ["recon", "author"],
|
|
1194
|
+
recommendedAdvanceStage: "recon",
|
|
1195
|
+
continueWithStage: "recon",
|
|
1196
|
+
blocking: false,
|
|
1197
|
+
details: reconDetails,
|
|
1198
|
+
reconAssessmentRequest,
|
|
1199
|
+
reconDecisionRequest: state?.recon_decision_request || null,
|
|
1200
|
+
executed
|
|
1201
|
+
}
|
|
1202
|
+
);
|
|
1203
|
+
}
|
|
1204
|
+
}
|
|
1205
|
+
if (!reconAutoAcceptedExplicitCapture) {
|
|
1206
|
+
recordAttempt("recon", "completed", "Recon completed and promoted an approved baseline context.", {
|
|
1116
1207
|
autoApproved: reconRes.autoApproved || false,
|
|
1117
|
-
|
|
1118
|
-
details: reconDetails
|
|
1208
|
+
details: { executed }
|
|
1119
1209
|
});
|
|
1120
|
-
return checkpoint(
|
|
1121
|
-
"recon",
|
|
1122
|
-
"recon_supervisor_judgment",
|
|
1123
|
-
summary,
|
|
1124
|
-
{
|
|
1125
|
-
nextActions: ["inspect_recon_packet", "supply_recon_assessment_json", "continue_internal_loop_with_checkpoint"],
|
|
1126
|
-
advanceOptions: ["recon", "author"],
|
|
1127
|
-
recommendedAdvanceStage: "recon",
|
|
1128
|
-
continueWithStage: "recon",
|
|
1129
|
-
blocking: false,
|
|
1130
|
-
details: reconDetails,
|
|
1131
|
-
reconAssessmentRequest,
|
|
1132
|
-
reconDecisionRequest: state?.recon_decision_request || null,
|
|
1133
|
-
executed
|
|
1134
|
-
}
|
|
1135
|
-
);
|
|
1136
1210
|
}
|
|
1137
|
-
recordAttempt("recon", "completed", "Recon completed and promoted an approved baseline context.", {
|
|
1138
|
-
autoApproved: reconRes.autoApproved || false,
|
|
1139
|
-
details: { executed }
|
|
1140
|
-
});
|
|
1141
1211
|
}
|
|
1142
1212
|
state = readState(config.statePath);
|
|
1143
1213
|
if (!authorReady(state) || effectiveAdvanceStage === "author") {
|
package/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-EGZT3EVL.js";
|
|
2
2
|
import "../chunk-PEWAIEER.js";
|
|
3
3
|
import "../chunk-TWTEUS7R.js";
|
|
4
|
-
import "../chunk-
|
|
4
|
+
import "../chunk-YFRPFV4U.js";
|
|
5
5
|
import "../chunk-YZUVEJ5B.js";
|
|
6
6
|
import "../chunk-FMOYUYH2.js";
|
|
7
7
|
import "../chunk-7GZY5PLT.js";
|
package/dist/cli.cjs
CHANGED
|
@@ -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") {
|
package/dist/cli.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-EGZT3EVL.js";
|
|
3
3
|
import "./chunk-PEWAIEER.js";
|
|
4
4
|
import "./chunk-TWTEUS7R.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-YFRPFV4U.js";
|
|
6
6
|
import "./chunk-YZUVEJ5B.js";
|
|
7
7
|
import "./chunk-FMOYUYH2.js";
|
|
8
8
|
import "./chunk-7GZY5PLT.js";
|
package/dist/engine-harness.cjs
CHANGED
|
@@ -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") {
|
package/dist/engine-harness.js
CHANGED