@riddledc/riddle-proof 0.8.25 → 0.8.27
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/adapters/codex-exec-agent.cjs +21 -3
- package/dist/adapters/codex-exec-agent.js +1 -1
- package/dist/adapters/codex.cjs +21 -3
- package/dist/adapters/codex.js +1 -1
- package/dist/adapters/local-agent.cjs +21 -3
- package/dist/adapters/local-agent.js +1 -1
- package/dist/adapters/openclaw.js +4 -4
- package/dist/advanced/engine-harness.cjs +103 -2
- package/dist/advanced/engine-harness.js +5 -5
- package/dist/advanced/index.cjs +103 -2
- package/dist/advanced/index.js +7 -7
- package/dist/advanced/proof-run-core.cjs +98 -1
- package/dist/advanced/proof-run-core.js +1 -1
- package/dist/advanced/proof-run-engine.cjs +98 -1
- package/dist/advanced/proof-run-engine.js +2 -2
- package/dist/advanced/runner.js +5 -5
- package/dist/checkpoint.cjs +20 -1
- package/dist/checkpoint.js +1 -1
- package/dist/{chunk-27AB2TEQ.js → chunk-27BG64ZG.js} +3 -3
- package/dist/{chunk-P2RN2NYR.js → chunk-3OTO7IDH.js} +2 -2
- package/dist/{chunk-EEIYUZXE.js → chunk-4PPJKW3Z.js} +21 -3
- package/dist/{chunk-2DW2LBUD.js → chunk-AM3K5FPW.js} +4 -4
- package/dist/{chunk-RBWSCU6V.js → chunk-AYMHHRJZ.js} +1 -1
- package/dist/{chunk-FU73I4V3.js → chunk-K6HZUSHH.js} +98 -1
- package/dist/{chunk-4FOHZ7JG.js → chunk-OILKSY5J.js} +20 -1
- package/dist/{chunk-FMOYUYH2.js → chunk-RDPG554T.js} +1 -1
- package/dist/{chunk-KS3N5APP.js → chunk-YC77HZVF.js} +1 -1
- package/dist/{chunk-YZUVEJ5B.js → chunk-ZQWVXQKJ.js} +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli.cjs +139 -5
- package/dist/cli.js +7 -7
- package/dist/codex-exec-agent.cjs +21 -3
- package/dist/codex-exec-agent.js +1 -1
- package/dist/engine-harness.cjs +103 -2
- package/dist/engine-harness.js +5 -5
- package/dist/index.cjs +139 -5
- package/dist/index.js +7 -7
- package/dist/local-agent.cjs +21 -3
- package/dist/local-agent.js +1 -1
- package/dist/openclaw.js +4 -4
- package/dist/proof-run-core.cjs +98 -1
- package/dist/proof-run-core.js +1 -1
- package/dist/proof-run-engine.cjs +98 -1
- package/dist/proof-run-engine.js +2 -2
- package/dist/run-card.js +2 -2
- package/dist/runner.js +5 -5
- package/dist/spec/checkpoint.cjs +20 -1
- package/dist/spec/checkpoint.js +1 -1
- package/dist/spec/index.cjs +20 -1
- package/dist/spec/index.js +3 -3
- package/dist/spec/run-card.js +2 -2
- package/dist/spec/state.js +3 -3
- package/dist/state.js +3 -3
- package/package.json +1 -1
package/dist/engine-harness.cjs
CHANGED
|
@@ -190,6 +190,30 @@ function normalizeRoutePath(value) {
|
|
|
190
190
|
return `${pathname}${query}${hash}`;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
+
function trimRouteCandidate(value) {
|
|
194
|
+
return value.trim().replace(/[),.;\]}]+$/g, "");
|
|
195
|
+
}
|
|
196
|
+
function expectedTerminalRouteFromText(value) {
|
|
197
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
198
|
+
if (!text) return "";
|
|
199
|
+
const routePattern = "(https?:\\/\\/[^\\s\"'<>`]+|\\/[^\\s\"'<>`]+)";
|
|
200
|
+
const patterns = [
|
|
201
|
+
new RegExp(`\\bexpected\\s+(?:terminal\\s+|final\\s+|after\\s+)?(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
|
|
202
|
+
new RegExp(`\\b(?:terminal|final|after)\\s+(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
|
|
203
|
+
new RegExp(`\\b(?:ends|end|ending|lands|land|landing)\\s+(?:at|on)\\s*${routePattern}`, "i")
|
|
204
|
+
];
|
|
205
|
+
for (const pattern of patterns) {
|
|
206
|
+
const match = text.match(pattern);
|
|
207
|
+
if (!match) continue;
|
|
208
|
+
const candidate = trimRouteCandidate(match[1] || "");
|
|
209
|
+
const normalized = normalizeRoutePath(candidate);
|
|
210
|
+
if (normalized) return normalized;
|
|
211
|
+
}
|
|
212
|
+
return "";
|
|
213
|
+
}
|
|
214
|
+
function requestedExpectedTerminalRouteForState(state) {
|
|
215
|
+
return expectedTerminalRouteFromText(state.success_criteria) || expectedTerminalRouteFromText(state.change_request) || expectedTerminalRouteFromText(state.context) || expectedTerminalRouteFromText(state.assertions_json);
|
|
216
|
+
}
|
|
193
217
|
function isInteractionVerificationMode(value) {
|
|
194
218
|
return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
|
|
195
219
|
}
|
|
@@ -202,6 +226,25 @@ function appendStateWarning(state, key, warning) {
|
|
|
202
226
|
const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
|
|
203
227
|
if (!existing.includes(warning)) state[key] = [...existing, warning];
|
|
204
228
|
}
|
|
229
|
+
function applyRequestedInteractionRouteContract(state) {
|
|
230
|
+
if (!isInteractionVerificationMode(state.verification_mode)) return;
|
|
231
|
+
const requestedTerminal = requestedExpectedTerminalRouteForState(state);
|
|
232
|
+
if (!requestedTerminal) return;
|
|
233
|
+
state.requested_expected_terminal_path = requestedTerminal;
|
|
234
|
+
if (!stringRecordValue(state, "expected_terminal_path")) {
|
|
235
|
+
state.expected_terminal_path = requestedTerminal;
|
|
236
|
+
}
|
|
237
|
+
const startPath = normalizeRoutePath(state.server_path) || normalizeRoutePath(state.expected_start_path) || "/";
|
|
238
|
+
if (!stringRecordValue(state, "expected_start_path")) {
|
|
239
|
+
state.expected_start_path = startPath;
|
|
240
|
+
}
|
|
241
|
+
const existingContract = state.interaction_contract && typeof state.interaction_contract === "object" ? state.interaction_contract : {};
|
|
242
|
+
state.interaction_contract = {
|
|
243
|
+
...existingContract,
|
|
244
|
+
start_path: stringRecordValue(existingContract, "start_path") || startPath,
|
|
245
|
+
expected_terminal_path: stringRecordValue(existingContract, "expected_terminal_path") || requestedTerminal
|
|
246
|
+
};
|
|
247
|
+
}
|
|
205
248
|
function interactionStartPathForAuthorPacket(state, parsed, refined) {
|
|
206
249
|
return normalizeRoutePath(
|
|
207
250
|
stringRecordValue(state, "expected_start_path") || stringRecordValue(refined, "expected_start_path") || stringRecordValue(parsed.interaction_contract, "start_path") || stringRecordValue(parsed.proof_contract, "start_path") || stringRecordValue(state, "server_path") || "/"
|
|
@@ -244,6 +287,36 @@ function normalizeCaptureScript(value) {
|
|
|
244
287
|
const script = normalizeOptionalString(value) || "";
|
|
245
288
|
return script ? guardProofEvidenceGlobalAssignments(script) : "";
|
|
246
289
|
}
|
|
290
|
+
function compactCaptureScriptForHeuristics(script) {
|
|
291
|
+
return script.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/.*$/gm, "$1 ").replace(/\s+/g, " ").trim().toLowerCase();
|
|
292
|
+
}
|
|
293
|
+
function interactionCaptureScriptLooksPassive(script) {
|
|
294
|
+
const text = compactCaptureScriptForHeuristics(script);
|
|
295
|
+
if (!text) return true;
|
|
296
|
+
const actionPatterns = [
|
|
297
|
+
/\bpage\.(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?|goto|reload)\s*\(/,
|
|
298
|
+
/\blocator\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?)\s*\(/,
|
|
299
|
+
/\b(getby(role|text|label|testid|placeholder|title)|getbyalttext)\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption)\s*\(/,
|
|
300
|
+
/\bkeyboard\s*\.\s*(press|type|inserttext)\s*\(/,
|
|
301
|
+
/\bmouse\s*\.\s*(click|dblclick|down|up|move)\s*\(/,
|
|
302
|
+
/\btouchscreen\s*\.\s*tap\s*\(/
|
|
303
|
+
];
|
|
304
|
+
if (actionPatterns.some((pattern) => pattern.test(text))) return false;
|
|
305
|
+
const evidencePatterns = [
|
|
306
|
+
/\breturn\s+[{[]/,
|
|
307
|
+
/\breturn\s+\w+/,
|
|
308
|
+
/__riddleproofevidence/,
|
|
309
|
+
/\bproof_evidence\b/,
|
|
310
|
+
/\brouteexpectationsource\b/,
|
|
311
|
+
/\bexpectedurl\b/,
|
|
312
|
+
/\bassertions?\b/
|
|
313
|
+
];
|
|
314
|
+
return !evidencePatterns.some((pattern) => pattern.test(text));
|
|
315
|
+
}
|
|
316
|
+
function setStructuredInteractionCaptureFailure(state, summary) {
|
|
317
|
+
const existing = typeof state.structured_interaction_capture_failure_summary === "string" ? state.structured_interaction_capture_failure_summary.trim() : "";
|
|
318
|
+
if (!existing) state.structured_interaction_capture_failure_summary = summary;
|
|
319
|
+
}
|
|
247
320
|
function appendProofSummaryLine(state, line) {
|
|
248
321
|
const text = String(line || "").trim();
|
|
249
322
|
if (!text) return;
|
|
@@ -484,6 +557,9 @@ function proofAssessmentHardBlockersForState(state = {}) {
|
|
|
484
557
|
}
|
|
485
558
|
add(state?.structured_interaction_capture_failure_summary);
|
|
486
559
|
add(state?.structured_interaction_failure_summary);
|
|
560
|
+
if (isInteractionVerificationMode(normalizedVerificationMode(state)) && !stateHasProofEvidence(state)) {
|
|
561
|
+
add("interaction proof evidence is required before ready_to_ship; proof_evidence_present=false");
|
|
562
|
+
}
|
|
487
563
|
const mergeRecommendation = String(state?.merge_recommendation || "").trim();
|
|
488
564
|
if (mergeRecommendation === "do-not-merge" && blockers.length) {
|
|
489
565
|
add("merge_recommendation=do-not-merge because the proof bundle contains hard blockers.");
|
|
@@ -519,7 +595,22 @@ function stateHasAfterEvidence(state = {}) {
|
|
|
519
595
|
const observation = objectValue(after.observation);
|
|
520
596
|
const supporting = objectValue(after.supporting_artifacts);
|
|
521
597
|
return Boolean(
|
|
522
|
-
observation.valid === true && (supporting.has_structured_payload === true ||
|
|
598
|
+
observation.valid === true && (supporting.has_structured_payload === true || stateHasProofEvidence(state) || observation.telemetry_ready === true)
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
function stateHasProofEvidence(state = {}) {
|
|
602
|
+
if (state?.proof_evidence_present === true) return true;
|
|
603
|
+
if (state?.proof_evidence !== void 0 && state?.proof_evidence !== null) {
|
|
604
|
+
if (typeof state.proof_evidence !== "object") return true;
|
|
605
|
+
if (Object.keys(objectValue(state.proof_evidence)).length > 0) return true;
|
|
606
|
+
}
|
|
607
|
+
const bundle = objectValue(state?.evidence_bundle);
|
|
608
|
+
const after = objectValue(bundle.after);
|
|
609
|
+
const supporting = objectValue(after.supporting_artifacts);
|
|
610
|
+
const request = objectValue(state?.proof_assessment_request);
|
|
611
|
+
const structuredEvidence = objectValue(request.structured_evidence);
|
|
612
|
+
return Boolean(
|
|
613
|
+
supporting.proof_evidence_present === true || structuredEvidence.proof_evidence_present === true || Object.keys(objectValue(bundle.proof_evidence)).length > 0 || Object.keys(objectValue(after.proof_evidence)).length > 0
|
|
523
614
|
);
|
|
524
615
|
}
|
|
525
616
|
function validateShipGate(state = {}) {
|
|
@@ -689,6 +780,7 @@ function mergeStateFromParams(statePath, params) {
|
|
|
689
780
|
if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
|
|
690
781
|
if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
|
|
691
782
|
if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
|
|
783
|
+
applyRequestedInteractionRouteContract(state);
|
|
692
784
|
if (params.recon_assessment_json !== void 0) {
|
|
693
785
|
const raw = normalizeOptionalString(params.recon_assessment_json) || "";
|
|
694
786
|
if (!raw) {
|
|
@@ -725,6 +817,11 @@ function mergeStateFromParams(statePath, params) {
|
|
|
725
817
|
state.supervisor_author_packet = parsed;
|
|
726
818
|
if (typeof parsed?.proof_plan === "string") state.proof_plan = normalizeOptionalString(parsed.proof_plan) || "";
|
|
727
819
|
if (typeof parsed?.capture_script === "string") state.capture_script = normalizeCaptureScript(parsed.capture_script);
|
|
820
|
+
if (isInteractionVerificationMode(state.verification_mode) && interactionCaptureScriptLooksPassive(state.capture_script || "")) {
|
|
821
|
+
const warning = "Interaction proof capture script appears passive: it does not perform a browser interaction or return structured proof evidence.";
|
|
822
|
+
appendStateWarning(state, "author_warnings", warning);
|
|
823
|
+
setStructuredInteractionCaptureFailure(state, warning);
|
|
824
|
+
}
|
|
728
825
|
if (parsed?.baseline_understanding_used && typeof parsed.baseline_understanding_used === "object") {
|
|
729
826
|
state.author_baseline_understanding_used = parsed.baseline_understanding_used;
|
|
730
827
|
}
|
|
@@ -3445,7 +3542,7 @@ function responseSchemaForAuthorPacket() {
|
|
|
3445
3542
|
summary: { type: "string" },
|
|
3446
3543
|
payload: {
|
|
3447
3544
|
type: "object",
|
|
3448
|
-
description: "For decision=author_packet, provide the proof packet itself or {author_packet:{...}} with proof_plan, capture_script,
|
|
3545
|
+
description: "For decision=author_packet, provide the proof packet itself or {author_packet:{...}} with proof_plan, capture_script, refined_inputs.expected_terminal_path, and interaction_contract when the proof changes route, query, or hash."
|
|
3449
3546
|
},
|
|
3450
3547
|
reasons: { type: "array", items: { type: "string" } },
|
|
3451
3548
|
continue_with_stage: { type: "string", enum: ["author", "recon"] },
|
|
@@ -3756,6 +3853,10 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
3756
3853
|
reference: input.request.reference || fullState.reference,
|
|
3757
3854
|
server_path: fullState.server_path,
|
|
3758
3855
|
wait_for_selector: fullState.wait_for_selector,
|
|
3856
|
+
expected_start_path: fullState.expected_start_path,
|
|
3857
|
+
expected_terminal_path: fullState.expected_terminal_path,
|
|
3858
|
+
requested_expected_terminal_path: fullState.requested_expected_terminal_path,
|
|
3859
|
+
interaction_contract: jsonCloneRecord(fullState.interaction_contract),
|
|
3759
3860
|
route_expectation: jsonCloneRecord(fullState.route_expectation),
|
|
3760
3861
|
author_summary: fullState.author_summary,
|
|
3761
3862
|
author_request: jsonCloneRecord(authorRequest),
|
package/dist/engine-harness.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createDisabledRiddleProofAgentAdapter,
|
|
3
3
|
readRiddleProofRunStatus,
|
|
4
4
|
runRiddleProofEngineHarness
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-AM3K5FPW.js";
|
|
6
|
+
import "./chunk-ZQWVXQKJ.js";
|
|
7
|
+
import "./chunk-RDPG554T.js";
|
|
8
|
+
import "./chunk-K6HZUSHH.js";
|
|
9
|
+
import "./chunk-OILKSY5J.js";
|
|
10
10
|
import "./chunk-VY4Y5U57.js";
|
|
11
11
|
import "./chunk-MLKGABMK.js";
|
|
12
12
|
export {
|
package/dist/index.cjs
CHANGED
|
@@ -190,6 +190,30 @@ function normalizeRoutePath(value) {
|
|
|
190
190
|
return `${pathname}${query}${hash}`;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
+
function trimRouteCandidate(value) {
|
|
194
|
+
return value.trim().replace(/[),.;\]}]+$/g, "");
|
|
195
|
+
}
|
|
196
|
+
function expectedTerminalRouteFromText(value) {
|
|
197
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
198
|
+
if (!text) return "";
|
|
199
|
+
const routePattern = "(https?:\\/\\/[^\\s\"'<>`]+|\\/[^\\s\"'<>`]+)";
|
|
200
|
+
const patterns = [
|
|
201
|
+
new RegExp(`\\bexpected\\s+(?:terminal\\s+|final\\s+|after\\s+)?(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
|
|
202
|
+
new RegExp(`\\b(?:terminal|final|after)\\s+(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
|
|
203
|
+
new RegExp(`\\b(?:ends|end|ending|lands|land|landing)\\s+(?:at|on)\\s*${routePattern}`, "i")
|
|
204
|
+
];
|
|
205
|
+
for (const pattern of patterns) {
|
|
206
|
+
const match = text.match(pattern);
|
|
207
|
+
if (!match) continue;
|
|
208
|
+
const candidate = trimRouteCandidate(match[1] || "");
|
|
209
|
+
const normalized = normalizeRoutePath(candidate);
|
|
210
|
+
if (normalized) return normalized;
|
|
211
|
+
}
|
|
212
|
+
return "";
|
|
213
|
+
}
|
|
214
|
+
function requestedExpectedTerminalRouteForState(state) {
|
|
215
|
+
return expectedTerminalRouteFromText(state.success_criteria) || expectedTerminalRouteFromText(state.change_request) || expectedTerminalRouteFromText(state.context) || expectedTerminalRouteFromText(state.assertions_json);
|
|
216
|
+
}
|
|
193
217
|
function isInteractionVerificationMode(value) {
|
|
194
218
|
return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
|
|
195
219
|
}
|
|
@@ -202,6 +226,25 @@ function appendStateWarning(state, key, warning) {
|
|
|
202
226
|
const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
|
|
203
227
|
if (!existing.includes(warning)) state[key] = [...existing, warning];
|
|
204
228
|
}
|
|
229
|
+
function applyRequestedInteractionRouteContract(state) {
|
|
230
|
+
if (!isInteractionVerificationMode(state.verification_mode)) return;
|
|
231
|
+
const requestedTerminal = requestedExpectedTerminalRouteForState(state);
|
|
232
|
+
if (!requestedTerminal) return;
|
|
233
|
+
state.requested_expected_terminal_path = requestedTerminal;
|
|
234
|
+
if (!stringRecordValue(state, "expected_terminal_path")) {
|
|
235
|
+
state.expected_terminal_path = requestedTerminal;
|
|
236
|
+
}
|
|
237
|
+
const startPath = normalizeRoutePath(state.server_path) || normalizeRoutePath(state.expected_start_path) || "/";
|
|
238
|
+
if (!stringRecordValue(state, "expected_start_path")) {
|
|
239
|
+
state.expected_start_path = startPath;
|
|
240
|
+
}
|
|
241
|
+
const existingContract = state.interaction_contract && typeof state.interaction_contract === "object" ? state.interaction_contract : {};
|
|
242
|
+
state.interaction_contract = {
|
|
243
|
+
...existingContract,
|
|
244
|
+
start_path: stringRecordValue(existingContract, "start_path") || startPath,
|
|
245
|
+
expected_terminal_path: stringRecordValue(existingContract, "expected_terminal_path") || requestedTerminal
|
|
246
|
+
};
|
|
247
|
+
}
|
|
205
248
|
function interactionStartPathForAuthorPacket(state, parsed, refined) {
|
|
206
249
|
return normalizeRoutePath(
|
|
207
250
|
stringRecordValue(state, "expected_start_path") || stringRecordValue(refined, "expected_start_path") || stringRecordValue(parsed.interaction_contract, "start_path") || stringRecordValue(parsed.proof_contract, "start_path") || stringRecordValue(state, "server_path") || "/"
|
|
@@ -244,6 +287,36 @@ function normalizeCaptureScript(value) {
|
|
|
244
287
|
const script = normalizeOptionalString(value) || "";
|
|
245
288
|
return script ? guardProofEvidenceGlobalAssignments(script) : "";
|
|
246
289
|
}
|
|
290
|
+
function compactCaptureScriptForHeuristics(script) {
|
|
291
|
+
return script.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/.*$/gm, "$1 ").replace(/\s+/g, " ").trim().toLowerCase();
|
|
292
|
+
}
|
|
293
|
+
function interactionCaptureScriptLooksPassive(script) {
|
|
294
|
+
const text = compactCaptureScriptForHeuristics(script);
|
|
295
|
+
if (!text) return true;
|
|
296
|
+
const actionPatterns = [
|
|
297
|
+
/\bpage\.(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?|goto|reload)\s*\(/,
|
|
298
|
+
/\blocator\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?)\s*\(/,
|
|
299
|
+
/\b(getby(role|text|label|testid|placeholder|title)|getbyalttext)\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption)\s*\(/,
|
|
300
|
+
/\bkeyboard\s*\.\s*(press|type|inserttext)\s*\(/,
|
|
301
|
+
/\bmouse\s*\.\s*(click|dblclick|down|up|move)\s*\(/,
|
|
302
|
+
/\btouchscreen\s*\.\s*tap\s*\(/
|
|
303
|
+
];
|
|
304
|
+
if (actionPatterns.some((pattern) => pattern.test(text))) return false;
|
|
305
|
+
const evidencePatterns = [
|
|
306
|
+
/\breturn\s+[{[]/,
|
|
307
|
+
/\breturn\s+\w+/,
|
|
308
|
+
/__riddleproofevidence/,
|
|
309
|
+
/\bproof_evidence\b/,
|
|
310
|
+
/\brouteexpectationsource\b/,
|
|
311
|
+
/\bexpectedurl\b/,
|
|
312
|
+
/\bassertions?\b/
|
|
313
|
+
];
|
|
314
|
+
return !evidencePatterns.some((pattern) => pattern.test(text));
|
|
315
|
+
}
|
|
316
|
+
function setStructuredInteractionCaptureFailure(state, summary) {
|
|
317
|
+
const existing = typeof state.structured_interaction_capture_failure_summary === "string" ? state.structured_interaction_capture_failure_summary.trim() : "";
|
|
318
|
+
if (!existing) state.structured_interaction_capture_failure_summary = summary;
|
|
319
|
+
}
|
|
247
320
|
function appendProofSummaryLine(state, line) {
|
|
248
321
|
const text = String(line || "").trim();
|
|
249
322
|
if (!text) return;
|
|
@@ -484,6 +557,9 @@ function proofAssessmentHardBlockersForState(state = {}) {
|
|
|
484
557
|
}
|
|
485
558
|
add(state?.structured_interaction_capture_failure_summary);
|
|
486
559
|
add(state?.structured_interaction_failure_summary);
|
|
560
|
+
if (isInteractionVerificationMode(normalizedVerificationMode(state)) && !stateHasProofEvidence(state)) {
|
|
561
|
+
add("interaction proof evidence is required before ready_to_ship; proof_evidence_present=false");
|
|
562
|
+
}
|
|
487
563
|
const mergeRecommendation = String(state?.merge_recommendation || "").trim();
|
|
488
564
|
if (mergeRecommendation === "do-not-merge" && blockers.length) {
|
|
489
565
|
add("merge_recommendation=do-not-merge because the proof bundle contains hard blockers.");
|
|
@@ -519,7 +595,22 @@ function stateHasAfterEvidence(state = {}) {
|
|
|
519
595
|
const observation = objectValue(after.observation);
|
|
520
596
|
const supporting = objectValue(after.supporting_artifacts);
|
|
521
597
|
return Boolean(
|
|
522
|
-
observation.valid === true && (supporting.has_structured_payload === true ||
|
|
598
|
+
observation.valid === true && (supporting.has_structured_payload === true || stateHasProofEvidence(state) || observation.telemetry_ready === true)
|
|
599
|
+
);
|
|
600
|
+
}
|
|
601
|
+
function stateHasProofEvidence(state = {}) {
|
|
602
|
+
if (state?.proof_evidence_present === true) return true;
|
|
603
|
+
if (state?.proof_evidence !== void 0 && state?.proof_evidence !== null) {
|
|
604
|
+
if (typeof state.proof_evidence !== "object") return true;
|
|
605
|
+
if (Object.keys(objectValue(state.proof_evidence)).length > 0) return true;
|
|
606
|
+
}
|
|
607
|
+
const bundle = objectValue(state?.evidence_bundle);
|
|
608
|
+
const after = objectValue(bundle.after);
|
|
609
|
+
const supporting = objectValue(after.supporting_artifacts);
|
|
610
|
+
const request = objectValue(state?.proof_assessment_request);
|
|
611
|
+
const structuredEvidence = objectValue(request.structured_evidence);
|
|
612
|
+
return Boolean(
|
|
613
|
+
supporting.proof_evidence_present === true || structuredEvidence.proof_evidence_present === true || Object.keys(objectValue(bundle.proof_evidence)).length > 0 || Object.keys(objectValue(after.proof_evidence)).length > 0
|
|
523
614
|
);
|
|
524
615
|
}
|
|
525
616
|
function validateShipGate(state = {}) {
|
|
@@ -689,6 +780,7 @@ function mergeStateFromParams(statePath, params) {
|
|
|
689
780
|
if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
|
|
690
781
|
if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
|
|
691
782
|
if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
|
|
783
|
+
applyRequestedInteractionRouteContract(state);
|
|
692
784
|
if (params.recon_assessment_json !== void 0) {
|
|
693
785
|
const raw = normalizeOptionalString(params.recon_assessment_json) || "";
|
|
694
786
|
if (!raw) {
|
|
@@ -725,6 +817,11 @@ function mergeStateFromParams(statePath, params) {
|
|
|
725
817
|
state.supervisor_author_packet = parsed;
|
|
726
818
|
if (typeof parsed?.proof_plan === "string") state.proof_plan = normalizeOptionalString(parsed.proof_plan) || "";
|
|
727
819
|
if (typeof parsed?.capture_script === "string") state.capture_script = normalizeCaptureScript(parsed.capture_script);
|
|
820
|
+
if (isInteractionVerificationMode(state.verification_mode) && interactionCaptureScriptLooksPassive(state.capture_script || "")) {
|
|
821
|
+
const warning = "Interaction proof capture script appears passive: it does not perform a browser interaction or return structured proof evidence.";
|
|
822
|
+
appendStateWarning(state, "author_warnings", warning);
|
|
823
|
+
setStructuredInteractionCaptureFailure(state, warning);
|
|
824
|
+
}
|
|
728
825
|
if (parsed?.baseline_understanding_used && typeof parsed.baseline_understanding_used === "object") {
|
|
729
826
|
state.author_baseline_understanding_used = parsed.baseline_understanding_used;
|
|
730
827
|
}
|
|
@@ -3559,7 +3656,7 @@ function responseSchemaForAuthorPacket() {
|
|
|
3559
3656
|
summary: { type: "string" },
|
|
3560
3657
|
payload: {
|
|
3561
3658
|
type: "object",
|
|
3562
|
-
description: "For decision=author_packet, provide the proof packet itself or {author_packet:{...}} with proof_plan, capture_script,
|
|
3659
|
+
description: "For decision=author_packet, provide the proof packet itself or {author_packet:{...}} with proof_plan, capture_script, refined_inputs.expected_terminal_path, and interaction_contract when the proof changes route, query, or hash."
|
|
3563
3660
|
},
|
|
3564
3661
|
reasons: { type: "array", items: { type: "string" } },
|
|
3565
3662
|
continue_with_stage: { type: "string", enum: ["author", "recon"] },
|
|
@@ -3870,6 +3967,10 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
3870
3967
|
reference: input.request.reference || fullState.reference,
|
|
3871
3968
|
server_path: fullState.server_path,
|
|
3872
3969
|
wait_for_selector: fullState.wait_for_selector,
|
|
3970
|
+
expected_start_path: fullState.expected_start_path,
|
|
3971
|
+
expected_terminal_path: fullState.expected_terminal_path,
|
|
3972
|
+
requested_expected_terminal_path: fullState.requested_expected_terminal_path,
|
|
3973
|
+
interaction_contract: jsonCloneRecord(fullState.interaction_contract),
|
|
3873
3974
|
route_expectation: jsonCloneRecord(fullState.route_expectation),
|
|
3874
3975
|
author_summary: fullState.author_summary,
|
|
3875
3976
|
author_request: jsonCloneRecord(authorRequest),
|
|
@@ -4077,9 +4178,24 @@ function defaultContinueStage(packet, decision) {
|
|
|
4077
4178
|
}
|
|
4078
4179
|
function templatePayloadFor(packet, decision) {
|
|
4079
4180
|
if (decision === "author_packet") {
|
|
4181
|
+
const expectedTerminalPath = packet.state_excerpt?.expected_terminal_path || packet.state_excerpt?.requested_expected_terminal_path || null;
|
|
4182
|
+
const expectedStartPath = packet.state_excerpt?.expected_start_path || packet.state_excerpt?.server_path || null;
|
|
4080
4183
|
return {
|
|
4081
4184
|
proof_plan: "TODO: describe the exact proof plan and stop condition.",
|
|
4082
4185
|
capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
|
|
4186
|
+
refined_inputs: {
|
|
4187
|
+
server_path: packet.state_excerpt?.server_path || null,
|
|
4188
|
+
wait_for_selector: packet.state_excerpt?.wait_for_selector || null,
|
|
4189
|
+
reference: packet.state_excerpt?.reference || null,
|
|
4190
|
+
expected_start_path: expectedStartPath,
|
|
4191
|
+
expected_terminal_path: expectedTerminalPath
|
|
4192
|
+
},
|
|
4193
|
+
interaction_contract: {
|
|
4194
|
+
start_path: expectedStartPath,
|
|
4195
|
+
expected_terminal_path: expectedTerminalPath,
|
|
4196
|
+
action: "TODO: describe the browser interaction, for example click the visible Proof nav link.",
|
|
4197
|
+
assertions: []
|
|
4198
|
+
},
|
|
4083
4199
|
summary: "TODO: summarize why this proof packet targets the requested change."
|
|
4084
4200
|
};
|
|
4085
4201
|
}
|
|
@@ -6788,7 +6904,20 @@ var REFINED_INPUTS_SCHEMA = {
|
|
|
6788
6904
|
properties: {
|
|
6789
6905
|
server_path: { type: ["string", "null"] },
|
|
6790
6906
|
wait_for_selector: { type: ["string", "null"] },
|
|
6791
|
-
reference: { enum: ["before", "prod", "both", null] }
|
|
6907
|
+
reference: { enum: ["before", "prod", "both", null] },
|
|
6908
|
+
expected_start_path: { type: ["string", "null"] },
|
|
6909
|
+
expected_terminal_path: { type: ["string", "null"] }
|
|
6910
|
+
}
|
|
6911
|
+
};
|
|
6912
|
+
var INTERACTION_CONTRACT_SCHEMA = {
|
|
6913
|
+
type: "object",
|
|
6914
|
+
additionalProperties: true,
|
|
6915
|
+
properties: {
|
|
6916
|
+
start_path: { type: ["string", "null"] },
|
|
6917
|
+
expected_terminal_path: { type: ["string", "null"] },
|
|
6918
|
+
expected_url: { type: ["string", "null"] },
|
|
6919
|
+
action: { type: ["string", "null"] },
|
|
6920
|
+
assertions: { type: "array", items: { type: "string" } }
|
|
6792
6921
|
}
|
|
6793
6922
|
};
|
|
6794
6923
|
var BASELINE_UNDERSTANDING_SCHEMA = {
|
|
@@ -6858,6 +6987,8 @@ var AUTHOR_SCHEMA = {
|
|
|
6858
6987
|
capture_script: { type: "string" },
|
|
6859
6988
|
baseline_understanding_used: BASELINE_UNDERSTANDING_SCHEMA,
|
|
6860
6989
|
refined_inputs: REFINED_INPUTS_SCHEMA,
|
|
6990
|
+
expected_terminal_path: { type: ["string", "null"] },
|
|
6991
|
+
interaction_contract: INTERACTION_CONTRACT_SCHEMA,
|
|
6861
6992
|
rationale: { type: "array", items: { type: "string" } },
|
|
6862
6993
|
confidence: { type: "string", enum: ["low", "medium", "high"] },
|
|
6863
6994
|
summary: { type: "string" }
|
|
@@ -7465,7 +7596,10 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
|
|
|
7465
7596
|
"Do not leave this authoring stage pending for external investigation. Keep any repo inspection brief, do not modify files, and return the JSON proof packet from the available state.",
|
|
7466
7597
|
"Choose the evidence modality from verification_mode and success_criteria: screenshots for visual/UI proof, interactions plus screenshots for interaction proof, structured metrics/logs/JSON/audio analysis for non-visual proof.",
|
|
7467
7598
|
"For playable/gameplay proof, treat screenshots as supporting artifacts only: start the game, send keyboard or pointer input, measure state before/after, measure non-HUD canvas/playfield pixel deltas across time, and return playability evidence with version riddle-proof.playability.v1.",
|
|
7468
|
-
"For interaction proof,
|
|
7599
|
+
"For interaction proof, author the browser action explicitly in capture_script; a wait-only script is invalid. Return a structured evidence object with start route/state, terminal route/state, action, assertions, and matched UI text.",
|
|
7600
|
+
"For route-changing interaction proof, set refined_inputs.expected_start_path and refined_inputs.expected_terminal_path, and include interaction_contract with start_path, expected_terminal_path, action, and assertions. Keep refined_inputs.server_path on the start route; do not replace it with the terminal route.",
|
|
7601
|
+
"If the original request or success_criteria names an expected terminal URL/path, preserve it exactly in refined_inputs.expected_terminal_path and in interaction_contract.expected_terminal_path, including query and hash.",
|
|
7602
|
+
"Catch waitForURL or selector timeouts and record them as failed assertions instead of throwing before evidence is emitted.",
|
|
7469
7603
|
"For structured proof, collect meaningful measurements inside page.evaluate, assign them to an evidence variable, and return that object from capture_script. Screenshots are optional supporting context for data/audio/log/metric/custom modes.",
|
|
7470
7604
|
"Do not assign globalThis.__riddleProofEvidence, window.__riddleProofEvidence, or self.__riddleProofEvidence in the worker context. Avoid global evidence assignment unless it is inside page.evaluate for compatibility with older packets.",
|
|
7471
7605
|
"Do not call Playwright page.* APIs inside page.evaluate; page.evaluate runs in the browser page, while page.waitForFunction, page.waitForSelector, page.click, and saveScreenshot belong in the outer capture script.",
|
|
@@ -7479,7 +7613,7 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
|
|
|
7479
7613
|
"For visual/UI proof, include saveScreenshot('after-proof') exactly once.",
|
|
7480
7614
|
"Avoid generic proof language. The packet should be specific enough that verify can tell whether the requested change actually happened.",
|
|
7481
7615
|
"Echo the baseline understanding you used in baseline_understanding_used so later stages can detect drift.",
|
|
7482
|
-
"Use refined_inputs for server_path, wait_for_selector,
|
|
7616
|
+
"Use refined_inputs for server_path, wait_for_selector, reference, expected_start_path, and expected_terminal_path when useful; use null values when no refinement is needed."
|
|
7483
7617
|
].join("\n")
|
|
7484
7618
|
});
|
|
7485
7619
|
return payloadOrBlocker(raw, context.checkpoint);
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runRiddleProof
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3OTO7IDH.js";
|
|
4
4
|
import "./chunk-6F4PWJZI.js";
|
|
5
5
|
import {
|
|
6
6
|
RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
createDisabledRiddleProofAgentAdapter,
|
|
96
96
|
readRiddleProofRunStatus,
|
|
97
97
|
runRiddleProofEngineHarness
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-AM3K5FPW.js";
|
|
99
99
|
import {
|
|
100
100
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
101
101
|
appendRunEvent,
|
|
@@ -107,12 +107,12 @@ import {
|
|
|
107
107
|
normalizePrLifecycleState,
|
|
108
108
|
normalizeRunParams,
|
|
109
109
|
setRunStatus
|
|
110
|
-
} from "./chunk-
|
|
110
|
+
} from "./chunk-ZQWVXQKJ.js";
|
|
111
111
|
import {
|
|
112
112
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
113
113
|
createRiddleProofRunCard
|
|
114
|
-
} from "./chunk-
|
|
115
|
-
import "./chunk-
|
|
114
|
+
} from "./chunk-RDPG554T.js";
|
|
115
|
+
import "./chunk-K6HZUSHH.js";
|
|
116
116
|
import {
|
|
117
117
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
118
118
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
@@ -128,13 +128,13 @@ import {
|
|
|
128
128
|
normalizeCheckpointResponse,
|
|
129
129
|
proofContractFromAuthorCheckpointResponse,
|
|
130
130
|
statePathsForRunState
|
|
131
|
-
} from "./chunk-
|
|
131
|
+
} from "./chunk-OILKSY5J.js";
|
|
132
132
|
import "./chunk-JFQXAJH2.js";
|
|
133
133
|
import {
|
|
134
134
|
createCodexExecAgentAdapter,
|
|
135
135
|
createCodexExecJsonRunner,
|
|
136
136
|
runCodexExecAgentDoctor
|
|
137
|
-
} from "./chunk-
|
|
137
|
+
} from "./chunk-4PPJKW3Z.js";
|
|
138
138
|
import {
|
|
139
139
|
applyTerminalMetadata,
|
|
140
140
|
compactRecord,
|
package/dist/local-agent.cjs
CHANGED
|
@@ -57,7 +57,20 @@ var REFINED_INPUTS_SCHEMA = {
|
|
|
57
57
|
properties: {
|
|
58
58
|
server_path: { type: ["string", "null"] },
|
|
59
59
|
wait_for_selector: { type: ["string", "null"] },
|
|
60
|
-
reference: { enum: ["before", "prod", "both", null] }
|
|
60
|
+
reference: { enum: ["before", "prod", "both", null] },
|
|
61
|
+
expected_start_path: { type: ["string", "null"] },
|
|
62
|
+
expected_terminal_path: { type: ["string", "null"] }
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
var INTERACTION_CONTRACT_SCHEMA = {
|
|
66
|
+
type: "object",
|
|
67
|
+
additionalProperties: true,
|
|
68
|
+
properties: {
|
|
69
|
+
start_path: { type: ["string", "null"] },
|
|
70
|
+
expected_terminal_path: { type: ["string", "null"] },
|
|
71
|
+
expected_url: { type: ["string", "null"] },
|
|
72
|
+
action: { type: ["string", "null"] },
|
|
73
|
+
assertions: { type: "array", items: { type: "string" } }
|
|
61
74
|
}
|
|
62
75
|
};
|
|
63
76
|
var BASELINE_UNDERSTANDING_SCHEMA = {
|
|
@@ -127,6 +140,8 @@ var AUTHOR_SCHEMA = {
|
|
|
127
140
|
capture_script: { type: "string" },
|
|
128
141
|
baseline_understanding_used: BASELINE_UNDERSTANDING_SCHEMA,
|
|
129
142
|
refined_inputs: REFINED_INPUTS_SCHEMA,
|
|
143
|
+
expected_terminal_path: { type: ["string", "null"] },
|
|
144
|
+
interaction_contract: INTERACTION_CONTRACT_SCHEMA,
|
|
130
145
|
rationale: { type: "array", items: { type: "string" } },
|
|
131
146
|
confidence: { type: "string", enum: ["low", "medium", "high"] },
|
|
132
147
|
summary: { type: "string" }
|
|
@@ -734,7 +749,10 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
|
|
|
734
749
|
"Do not leave this authoring stage pending for external investigation. Keep any repo inspection brief, do not modify files, and return the JSON proof packet from the available state.",
|
|
735
750
|
"Choose the evidence modality from verification_mode and success_criteria: screenshots for visual/UI proof, interactions plus screenshots for interaction proof, structured metrics/logs/JSON/audio analysis for non-visual proof.",
|
|
736
751
|
"For playable/gameplay proof, treat screenshots as supporting artifacts only: start the game, send keyboard or pointer input, measure state before/after, measure non-HUD canvas/playfield pixel deltas across time, and return playability evidence with version riddle-proof.playability.v1.",
|
|
737
|
-
"For interaction proof,
|
|
752
|
+
"For interaction proof, author the browser action explicitly in capture_script; a wait-only script is invalid. Return a structured evidence object with start route/state, terminal route/state, action, assertions, and matched UI text.",
|
|
753
|
+
"For route-changing interaction proof, set refined_inputs.expected_start_path and refined_inputs.expected_terminal_path, and include interaction_contract with start_path, expected_terminal_path, action, and assertions. Keep refined_inputs.server_path on the start route; do not replace it with the terminal route.",
|
|
754
|
+
"If the original request or success_criteria names an expected terminal URL/path, preserve it exactly in refined_inputs.expected_terminal_path and in interaction_contract.expected_terminal_path, including query and hash.",
|
|
755
|
+
"Catch waitForURL or selector timeouts and record them as failed assertions instead of throwing before evidence is emitted.",
|
|
738
756
|
"For structured proof, collect meaningful measurements inside page.evaluate, assign them to an evidence variable, and return that object from capture_script. Screenshots are optional supporting context for data/audio/log/metric/custom modes.",
|
|
739
757
|
"Do not assign globalThis.__riddleProofEvidence, window.__riddleProofEvidence, or self.__riddleProofEvidence in the worker context. Avoid global evidence assignment unless it is inside page.evaluate for compatibility with older packets.",
|
|
740
758
|
"Do not call Playwright page.* APIs inside page.evaluate; page.evaluate runs in the browser page, while page.waitForFunction, page.waitForSelector, page.click, and saveScreenshot belong in the outer capture script.",
|
|
@@ -748,7 +766,7 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
|
|
|
748
766
|
"For visual/UI proof, include saveScreenshot('after-proof') exactly once.",
|
|
749
767
|
"Avoid generic proof language. The packet should be specific enough that verify can tell whether the requested change actually happened.",
|
|
750
768
|
"Echo the baseline understanding you used in baseline_understanding_used so later stages can detect drift.",
|
|
751
|
-
"Use refined_inputs for server_path, wait_for_selector,
|
|
769
|
+
"Use refined_inputs for server_path, wait_for_selector, reference, expected_start_path, and expected_terminal_path when useful; use null values when no refinement is needed."
|
|
752
770
|
].join("\n")
|
|
753
771
|
});
|
|
754
772
|
return payloadOrBlocker(raw, context.checkpoint);
|
package/dist/local-agent.js
CHANGED
package/dist/openclaw.js
CHANGED
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
parseOpenClawAssertions,
|
|
4
4
|
parseOpenClawJsonObjectOrArray,
|
|
5
5
|
toRiddleProofRunParams
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-AYMHHRJZ.js";
|
|
7
|
+
import "./chunk-ZQWVXQKJ.js";
|
|
8
|
+
import "./chunk-RDPG554T.js";
|
|
9
|
+
import "./chunk-OILKSY5J.js";
|
|
10
10
|
import "./chunk-VY4Y5U57.js";
|
|
11
11
|
import "./chunk-MLKGABMK.js";
|
|
12
12
|
export {
|