@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.
Files changed (54) hide show
  1. package/dist/adapters/codex-exec-agent.cjs +21 -3
  2. package/dist/adapters/codex-exec-agent.js +1 -1
  3. package/dist/adapters/codex.cjs +21 -3
  4. package/dist/adapters/codex.js +1 -1
  5. package/dist/adapters/local-agent.cjs +21 -3
  6. package/dist/adapters/local-agent.js +1 -1
  7. package/dist/adapters/openclaw.js +4 -4
  8. package/dist/advanced/engine-harness.cjs +103 -2
  9. package/dist/advanced/engine-harness.js +5 -5
  10. package/dist/advanced/index.cjs +103 -2
  11. package/dist/advanced/index.js +7 -7
  12. package/dist/advanced/proof-run-core.cjs +98 -1
  13. package/dist/advanced/proof-run-core.js +1 -1
  14. package/dist/advanced/proof-run-engine.cjs +98 -1
  15. package/dist/advanced/proof-run-engine.js +2 -2
  16. package/dist/advanced/runner.js +5 -5
  17. package/dist/checkpoint.cjs +20 -1
  18. package/dist/checkpoint.js +1 -1
  19. package/dist/{chunk-27AB2TEQ.js → chunk-27BG64ZG.js} +3 -3
  20. package/dist/{chunk-P2RN2NYR.js → chunk-3OTO7IDH.js} +2 -2
  21. package/dist/{chunk-EEIYUZXE.js → chunk-4PPJKW3Z.js} +21 -3
  22. package/dist/{chunk-2DW2LBUD.js → chunk-AM3K5FPW.js} +4 -4
  23. package/dist/{chunk-RBWSCU6V.js → chunk-AYMHHRJZ.js} +1 -1
  24. package/dist/{chunk-FU73I4V3.js → chunk-K6HZUSHH.js} +98 -1
  25. package/dist/{chunk-4FOHZ7JG.js → chunk-OILKSY5J.js} +20 -1
  26. package/dist/{chunk-FMOYUYH2.js → chunk-RDPG554T.js} +1 -1
  27. package/dist/{chunk-KS3N5APP.js → chunk-YC77HZVF.js} +1 -1
  28. package/dist/{chunk-YZUVEJ5B.js → chunk-ZQWVXQKJ.js} +1 -1
  29. package/dist/cli/index.js +7 -7
  30. package/dist/cli.cjs +139 -5
  31. package/dist/cli.js +7 -7
  32. package/dist/codex-exec-agent.cjs +21 -3
  33. package/dist/codex-exec-agent.js +1 -1
  34. package/dist/engine-harness.cjs +103 -2
  35. package/dist/engine-harness.js +5 -5
  36. package/dist/index.cjs +139 -5
  37. package/dist/index.js +7 -7
  38. package/dist/local-agent.cjs +21 -3
  39. package/dist/local-agent.js +1 -1
  40. package/dist/openclaw.js +4 -4
  41. package/dist/proof-run-core.cjs +98 -1
  42. package/dist/proof-run-core.js +1 -1
  43. package/dist/proof-run-engine.cjs +98 -1
  44. package/dist/proof-run-engine.js +2 -2
  45. package/dist/run-card.js +2 -2
  46. package/dist/runner.js +5 -5
  47. package/dist/spec/checkpoint.cjs +20 -1
  48. package/dist/spec/checkpoint.js +1 -1
  49. package/dist/spec/index.cjs +20 -1
  50. package/dist/spec/index.js +3 -3
  51. package/dist/spec/run-card.js +2 -2
  52. package/dist/spec/state.js +3 -3
  53. package/dist/state.js +3 -3
  54. package/package.json +1 -1
@@ -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, return a structured evidence object with start route/state, terminal route/state, action, assertions, and matched UI text. Catch waitForURL or selector timeouts and record them as failed assertions instead of throwing before evidence is emitted.",
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, or reference when useful; use null values when no refinement is needed."
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);
@@ -3,7 +3,7 @@ import {
3
3
  createCodexExecAgentAdapter,
4
4
  createCodexExecJsonRunner,
5
5
  runCodexExecAgentDoctor
6
- } from "../chunk-EEIYUZXE.js";
6
+ } from "../chunk-4PPJKW3Z.js";
7
7
  import "../chunk-VY4Y5U57.js";
8
8
  import "../chunk-MLKGABMK.js";
9
9
  export {
@@ -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, return a structured evidence object with start route/state, terminal route/state, action, assertions, and matched UI text. Catch waitForURL or selector timeouts and record them as failed assertions instead of throwing before evidence is emitted.",
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, or reference when useful; use null values when no refinement is needed."
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);
@@ -3,7 +3,7 @@ import {
3
3
  createCodexExecAgentAdapter,
4
4
  createCodexExecJsonRunner,
5
5
  runCodexExecAgentDoctor
6
- } from "../chunk-EEIYUZXE.js";
6
+ } from "../chunk-4PPJKW3Z.js";
7
7
  import "../chunk-VY4Y5U57.js";
8
8
  import "../chunk-MLKGABMK.js";
9
9
  export {
@@ -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, return a structured evidence object with start route/state, terminal route/state, action, assertions, and matched UI text. Catch waitForURL or selector timeouts and record them as failed assertions instead of throwing before evidence is emitted.",
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, or reference when useful; use null values when no refinement is needed."
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);
@@ -3,7 +3,7 @@ import {
3
3
  createCodexExecAgentAdapter,
4
4
  createCodexExecJsonRunner,
5
5
  runCodexExecAgentDoctor
6
- } from "../chunk-EEIYUZXE.js";
6
+ } from "../chunk-4PPJKW3Z.js";
7
7
  import "../chunk-VY4Y5U57.js";
8
8
  import "../chunk-MLKGABMK.js";
9
9
  export {
@@ -3,10 +3,10 @@ import {
3
3
  parseOpenClawAssertions,
4
4
  parseOpenClawJsonObjectOrArray,
5
5
  toRiddleProofRunParams
6
- } from "../chunk-RBWSCU6V.js";
7
- import "../chunk-YZUVEJ5B.js";
8
- import "../chunk-FMOYUYH2.js";
9
- import "../chunk-4FOHZ7JG.js";
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 {
@@ -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 || supporting.proof_evidence_present === true || observation.telemetry_ready === true || Object.keys(objectValue(bundle.proof_evidence)).length > 0 || Object.keys(objectValue(after.proof_evidence)).length > 0)
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
  }
@@ -3447,7 +3544,7 @@ function responseSchemaForAuthorPacket() {
3447
3544
  summary: { type: "string" },
3448
3545
  payload: {
3449
3546
  type: "object",
3450
- description: "For decision=author_packet, provide the proof packet itself or {author_packet:{...}} with proof_plan, capture_script, and refined_inputs.expected_terminal_path when the proof changes route, query, or hash."
3547
+ 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."
3451
3548
  },
3452
3549
  reasons: { type: "array", items: { type: "string" } },
3453
3550
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -3758,6 +3855,10 @@ function buildAuthorCheckpointPacket(input) {
3758
3855
  reference: input.request.reference || fullState.reference,
3759
3856
  server_path: fullState.server_path,
3760
3857
  wait_for_selector: fullState.wait_for_selector,
3858
+ expected_start_path: fullState.expected_start_path,
3859
+ expected_terminal_path: fullState.expected_terminal_path,
3860
+ requested_expected_terminal_path: fullState.requested_expected_terminal_path,
3861
+ interaction_contract: jsonCloneRecord(fullState.interaction_contract),
3761
3862
  route_expectation: jsonCloneRecord(fullState.route_expectation),
3762
3863
  author_summary: fullState.author_summary,
3763
3864
  author_request: jsonCloneRecord(authorRequest),
@@ -2,11 +2,11 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "../chunk-2DW2LBUD.js";
6
- import "../chunk-YZUVEJ5B.js";
7
- import "../chunk-FMOYUYH2.js";
8
- import "../chunk-FU73I4V3.js";
9
- import "../chunk-4FOHZ7JG.js";
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 {
@@ -221,6 +221,30 @@ function normalizeRoutePath(value) {
221
221
  return `${pathname}${query}${hash}`;
222
222
  }
223
223
  }
224
+ function trimRouteCandidate(value) {
225
+ return value.trim().replace(/[),.;\]}]+$/g, "");
226
+ }
227
+ function expectedTerminalRouteFromText(value) {
228
+ const text = typeof value === "string" ? value.trim() : "";
229
+ if (!text) return "";
230
+ const routePattern = "(https?:\\/\\/[^\\s\"'<>`]+|\\/[^\\s\"'<>`]+)";
231
+ const patterns = [
232
+ new RegExp(`\\bexpected\\s+(?:terminal\\s+|final\\s+|after\\s+)?(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
233
+ new RegExp(`\\b(?:terminal|final|after)\\s+(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
234
+ new RegExp(`\\b(?:ends|end|ending|lands|land|landing)\\s+(?:at|on)\\s*${routePattern}`, "i")
235
+ ];
236
+ for (const pattern of patterns) {
237
+ const match = text.match(pattern);
238
+ if (!match) continue;
239
+ const candidate = trimRouteCandidate(match[1] || "");
240
+ const normalized = normalizeRoutePath(candidate);
241
+ if (normalized) return normalized;
242
+ }
243
+ return "";
244
+ }
245
+ function requestedExpectedTerminalRouteForState(state) {
246
+ return expectedTerminalRouteFromText(state.success_criteria) || expectedTerminalRouteFromText(state.change_request) || expectedTerminalRouteFromText(state.context) || expectedTerminalRouteFromText(state.assertions_json);
247
+ }
224
248
  function isInteractionVerificationMode(value) {
225
249
  return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
226
250
  }
@@ -233,6 +257,25 @@ function appendStateWarning(state, key, warning) {
233
257
  const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
234
258
  if (!existing.includes(warning)) state[key] = [...existing, warning];
235
259
  }
260
+ function applyRequestedInteractionRouteContract(state) {
261
+ if (!isInteractionVerificationMode(state.verification_mode)) return;
262
+ const requestedTerminal = requestedExpectedTerminalRouteForState(state);
263
+ if (!requestedTerminal) return;
264
+ state.requested_expected_terminal_path = requestedTerminal;
265
+ if (!stringRecordValue(state, "expected_terminal_path")) {
266
+ state.expected_terminal_path = requestedTerminal;
267
+ }
268
+ const startPath = normalizeRoutePath(state.server_path) || normalizeRoutePath(state.expected_start_path) || "/";
269
+ if (!stringRecordValue(state, "expected_start_path")) {
270
+ state.expected_start_path = startPath;
271
+ }
272
+ const existingContract = state.interaction_contract && typeof state.interaction_contract === "object" ? state.interaction_contract : {};
273
+ state.interaction_contract = {
274
+ ...existingContract,
275
+ start_path: stringRecordValue(existingContract, "start_path") || startPath,
276
+ expected_terminal_path: stringRecordValue(existingContract, "expected_terminal_path") || requestedTerminal
277
+ };
278
+ }
236
279
  function interactionStartPathForAuthorPacket(state, parsed, refined) {
237
280
  return normalizeRoutePath(
238
281
  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") || "/"
@@ -275,6 +318,36 @@ function normalizeCaptureScript(value) {
275
318
  const script = normalizeOptionalString(value) || "";
276
319
  return script ? guardProofEvidenceGlobalAssignments(script) : "";
277
320
  }
321
+ function compactCaptureScriptForHeuristics(script) {
322
+ return script.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/.*$/gm, "$1 ").replace(/\s+/g, " ").trim().toLowerCase();
323
+ }
324
+ function interactionCaptureScriptLooksPassive(script) {
325
+ const text = compactCaptureScriptForHeuristics(script);
326
+ if (!text) return true;
327
+ const actionPatterns = [
328
+ /\bpage\.(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?|goto|reload)\s*\(/,
329
+ /\blocator\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?)\s*\(/,
330
+ /\b(getby(role|text|label|testid|placeholder|title)|getbyalttext)\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption)\s*\(/,
331
+ /\bkeyboard\s*\.\s*(press|type|inserttext)\s*\(/,
332
+ /\bmouse\s*\.\s*(click|dblclick|down|up|move)\s*\(/,
333
+ /\btouchscreen\s*\.\s*tap\s*\(/
334
+ ];
335
+ if (actionPatterns.some((pattern) => pattern.test(text))) return false;
336
+ const evidencePatterns = [
337
+ /\breturn\s+[{[]/,
338
+ /\breturn\s+\w+/,
339
+ /__riddleproofevidence/,
340
+ /\bproof_evidence\b/,
341
+ /\brouteexpectationsource\b/,
342
+ /\bexpectedurl\b/,
343
+ /\bassertions?\b/
344
+ ];
345
+ return !evidencePatterns.some((pattern) => pattern.test(text));
346
+ }
347
+ function setStructuredInteractionCaptureFailure(state, summary) {
348
+ const existing = typeof state.structured_interaction_capture_failure_summary === "string" ? state.structured_interaction_capture_failure_summary.trim() : "";
349
+ if (!existing) state.structured_interaction_capture_failure_summary = summary;
350
+ }
278
351
  function appendProofSummaryLine(state, line) {
279
352
  const text = String(line || "").trim();
280
353
  if (!text) return;
@@ -515,6 +588,9 @@ function proofAssessmentHardBlockersForState(state = {}) {
515
588
  }
516
589
  add(state?.structured_interaction_capture_failure_summary);
517
590
  add(state?.structured_interaction_failure_summary);
591
+ if (isInteractionVerificationMode(normalizedVerificationMode(state)) && !stateHasProofEvidence(state)) {
592
+ add("interaction proof evidence is required before ready_to_ship; proof_evidence_present=false");
593
+ }
518
594
  const mergeRecommendation = String(state?.merge_recommendation || "").trim();
519
595
  if (mergeRecommendation === "do-not-merge" && blockers.length) {
520
596
  add("merge_recommendation=do-not-merge because the proof bundle contains hard blockers.");
@@ -550,7 +626,22 @@ function stateHasAfterEvidence(state = {}) {
550
626
  const observation = objectValue(after.observation);
551
627
  const supporting = objectValue(after.supporting_artifacts);
552
628
  return Boolean(
553
- observation.valid === true && (supporting.has_structured_payload === true || supporting.proof_evidence_present === true || observation.telemetry_ready === true || Object.keys(objectValue(bundle.proof_evidence)).length > 0 || Object.keys(objectValue(after.proof_evidence)).length > 0)
629
+ observation.valid === true && (supporting.has_structured_payload === true || stateHasProofEvidence(state) || observation.telemetry_ready === true)
630
+ );
631
+ }
632
+ function stateHasProofEvidence(state = {}) {
633
+ if (state?.proof_evidence_present === true) return true;
634
+ if (state?.proof_evidence !== void 0 && state?.proof_evidence !== null) {
635
+ if (typeof state.proof_evidence !== "object") return true;
636
+ if (Object.keys(objectValue(state.proof_evidence)).length > 0) return true;
637
+ }
638
+ const bundle = objectValue(state?.evidence_bundle);
639
+ const after = objectValue(bundle.after);
640
+ const supporting = objectValue(after.supporting_artifacts);
641
+ const request = objectValue(state?.proof_assessment_request);
642
+ const structuredEvidence = objectValue(request.structured_evidence);
643
+ return Boolean(
644
+ 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
554
645
  );
555
646
  }
556
647
  function validateShipGate(state = {}) {
@@ -720,6 +811,7 @@ function mergeStateFromParams(statePath, params) {
720
811
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
721
812
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
722
813
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
814
+ applyRequestedInteractionRouteContract(state);
723
815
  if (params.recon_assessment_json !== void 0) {
724
816
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
725
817
  if (!raw) {
@@ -756,6 +848,11 @@ function mergeStateFromParams(statePath, params) {
756
848
  state.supervisor_author_packet = parsed;
757
849
  if (typeof parsed?.proof_plan === "string") state.proof_plan = normalizeOptionalString(parsed.proof_plan) || "";
758
850
  if (typeof parsed?.capture_script === "string") state.capture_script = normalizeCaptureScript(parsed.capture_script);
851
+ if (isInteractionVerificationMode(state.verification_mode) && interactionCaptureScriptLooksPassive(state.capture_script || "")) {
852
+ const warning = "Interaction proof capture script appears passive: it does not perform a browser interaction or return structured proof evidence.";
853
+ appendStateWarning(state, "author_warnings", warning);
854
+ setStructuredInteractionCaptureFailure(state, warning);
855
+ }
759
856
  if (parsed?.baseline_understanding_used && typeof parsed.baseline_understanding_used === "object") {
760
857
  state.author_baseline_understanding_used = parsed.baseline_understanding_used;
761
858
  }
@@ -3479,7 +3576,7 @@ function responseSchemaForAuthorPacket() {
3479
3576
  summary: { type: "string" },
3480
3577
  payload: {
3481
3578
  type: "object",
3482
- description: "For decision=author_packet, provide the proof packet itself or {author_packet:{...}} with proof_plan, capture_script, and refined_inputs.expected_terminal_path when the proof changes route, query, or hash."
3579
+ 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."
3483
3580
  },
3484
3581
  reasons: { type: "array", items: { type: "string" } },
3485
3582
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -3790,6 +3887,10 @@ function buildAuthorCheckpointPacket(input) {
3790
3887
  reference: input.request.reference || fullState.reference,
3791
3888
  server_path: fullState.server_path,
3792
3889
  wait_for_selector: fullState.wait_for_selector,
3890
+ expected_start_path: fullState.expected_start_path,
3891
+ expected_terminal_path: fullState.expected_terminal_path,
3892
+ requested_expected_terminal_path: fullState.requested_expected_terminal_path,
3893
+ interaction_contract: jsonCloneRecord(fullState.interaction_contract),
3793
3894
  route_expectation: jsonCloneRecord(fullState.route_expectation),
3794
3895
  author_summary: fullState.author_summary,
3795
3896
  author_request: jsonCloneRecord(authorRequest),
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  proof_run_engine_exports
3
- } from "../chunk-KS3N5APP.js";
3
+ } from "../chunk-YC77HZVF.js";
4
4
  import {
5
5
  runner_exports
6
- } from "../chunk-P2RN2NYR.js";
6
+ } from "../chunk-3OTO7IDH.js";
7
7
  import {
8
8
  engine_harness_exports
9
- } from "../chunk-2DW2LBUD.js";
10
- import "../chunk-YZUVEJ5B.js";
11
- import "../chunk-FMOYUYH2.js";
9
+ } from "../chunk-AM3K5FPW.js";
10
+ import "../chunk-ZQWVXQKJ.js";
11
+ import "../chunk-RDPG554T.js";
12
12
  import {
13
13
  proof_run_core_exports
14
- } from "../chunk-FU73I4V3.js";
15
- import "../chunk-4FOHZ7JG.js";
14
+ } from "../chunk-K6HZUSHH.js";
15
+ import "../chunk-OILKSY5J.js";
16
16
  import "../chunk-VY4Y5U57.js";
17
17
  import "../chunk-MLKGABMK.js";
18
18
  export {