@riddledc/riddle-proof 0.8.26 → 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 +49 -1
  9. package/dist/advanced/engine-harness.js +5 -5
  10. package/dist/advanced/index.cjs +49 -1
  11. package/dist/advanced/index.js +7 -7
  12. package/dist/advanced/proof-run-core.cjs +44 -0
  13. package/dist/advanced/proof-run-core.js +1 -1
  14. package/dist/advanced/proof-run-engine.cjs +44 -0
  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-WULFU42E.js → chunk-27BG64ZG.js} +3 -3
  20. package/dist/{chunk-DZYH67J2.js → chunk-3OTO7IDH.js} +2 -2
  21. package/dist/{chunk-EEIYUZXE.js → chunk-4PPJKW3Z.js} +21 -3
  22. package/dist/{chunk-EMVMXVJV.js → chunk-AM3K5FPW.js} +4 -4
  23. package/dist/{chunk-RBWSCU6V.js → chunk-AYMHHRJZ.js} +1 -1
  24. package/dist/{chunk-RF72NWHM.js → chunk-K6HZUSHH.js} +44 -0
  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-EGOVHMBQ.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 +85 -4
  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 +49 -1
  35. package/dist/engine-harness.js +5 -5
  36. package/dist/index.cjs +85 -4
  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 +44 -0
  42. package/dist/proof-run-core.js +1 -1
  43. package/dist/proof-run-engine.cjs +44 -0
  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") || "/"
@@ -737,6 +780,7 @@ function mergeStateFromParams(statePath, params) {
737
780
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
738
781
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
739
782
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
783
+ applyRequestedInteractionRouteContract(state);
740
784
  if (params.recon_assessment_json !== void 0) {
741
785
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
742
786
  if (!raw) {
@@ -3500,7 +3544,7 @@ function responseSchemaForAuthorPacket() {
3500
3544
  summary: { type: "string" },
3501
3545
  payload: {
3502
3546
  type: "object",
3503
- 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."
3504
3548
  },
3505
3549
  reasons: { type: "array", items: { type: "string" } },
3506
3550
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -3811,6 +3855,10 @@ function buildAuthorCheckpointPacket(input) {
3811
3855
  reference: input.request.reference || fullState.reference,
3812
3856
  server_path: fullState.server_path,
3813
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),
3814
3862
  route_expectation: jsonCloneRecord(fullState.route_expectation),
3815
3863
  author_summary: fullState.author_summary,
3816
3864
  author_request: jsonCloneRecord(authorRequest),
@@ -2,11 +2,11 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "../chunk-EMVMXVJV.js";
6
- import "../chunk-YZUVEJ5B.js";
7
- import "../chunk-FMOYUYH2.js";
8
- import "../chunk-RF72NWHM.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") || "/"
@@ -768,6 +811,7 @@ function mergeStateFromParams(statePath, params) {
768
811
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
769
812
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
770
813
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
814
+ applyRequestedInteractionRouteContract(state);
771
815
  if (params.recon_assessment_json !== void 0) {
772
816
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
773
817
  if (!raw) {
@@ -3532,7 +3576,7 @@ function responseSchemaForAuthorPacket() {
3532
3576
  summary: { type: "string" },
3533
3577
  payload: {
3534
3578
  type: "object",
3535
- 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."
3536
3580
  },
3537
3581
  reasons: { type: "array", items: { type: "string" } },
3538
3582
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -3843,6 +3887,10 @@ function buildAuthorCheckpointPacket(input) {
3843
3887
  reference: input.request.reference || fullState.reference,
3844
3888
  server_path: fullState.server_path,
3845
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),
3846
3894
  route_expectation: jsonCloneRecord(fullState.route_expectation),
3847
3895
  author_summary: fullState.author_summary,
3848
3896
  author_request: jsonCloneRecord(authorRequest),
@@ -1,18 +1,18 @@
1
1
  import {
2
2
  proof_run_engine_exports
3
- } from "../chunk-EGOVHMBQ.js";
3
+ } from "../chunk-YC77HZVF.js";
4
4
  import {
5
5
  runner_exports
6
- } from "../chunk-DZYH67J2.js";
6
+ } from "../chunk-3OTO7IDH.js";
7
7
  import {
8
8
  engine_harness_exports
9
- } from "../chunk-EMVMXVJV.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-RF72NWHM.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 {
@@ -237,6 +237,30 @@ function normalizeRoutePath(value) {
237
237
  return `${pathname}${query}${hash}`;
238
238
  }
239
239
  }
240
+ function trimRouteCandidate(value) {
241
+ return value.trim().replace(/[),.;\]}]+$/g, "");
242
+ }
243
+ function expectedTerminalRouteFromText(value) {
244
+ const text = typeof value === "string" ? value.trim() : "";
245
+ if (!text) return "";
246
+ const routePattern = "(https?:\\/\\/[^\\s\"'<>`]+|\\/[^\\s\"'<>`]+)";
247
+ const patterns = [
248
+ new RegExp(`\\bexpected\\s+(?:terminal\\s+|final\\s+|after\\s+)?(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
249
+ new RegExp(`\\b(?:terminal|final|after)\\s+(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
250
+ new RegExp(`\\b(?:ends|end|ending|lands|land|landing)\\s+(?:at|on)\\s*${routePattern}`, "i")
251
+ ];
252
+ for (const pattern of patterns) {
253
+ const match = text.match(pattern);
254
+ if (!match) continue;
255
+ const candidate = trimRouteCandidate(match[1] || "");
256
+ const normalized = normalizeRoutePath(candidate);
257
+ if (normalized) return normalized;
258
+ }
259
+ return "";
260
+ }
261
+ function requestedExpectedTerminalRouteForState(state) {
262
+ return expectedTerminalRouteFromText(state.success_criteria) || expectedTerminalRouteFromText(state.change_request) || expectedTerminalRouteFromText(state.context) || expectedTerminalRouteFromText(state.assertions_json);
263
+ }
240
264
  function isInteractionVerificationMode(value) {
241
265
  return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
242
266
  }
@@ -249,6 +273,25 @@ function appendStateWarning(state, key, warning) {
249
273
  const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
250
274
  if (!existing.includes(warning)) state[key] = [...existing, warning];
251
275
  }
276
+ function applyRequestedInteractionRouteContract(state) {
277
+ if (!isInteractionVerificationMode(state.verification_mode)) return;
278
+ const requestedTerminal = requestedExpectedTerminalRouteForState(state);
279
+ if (!requestedTerminal) return;
280
+ state.requested_expected_terminal_path = requestedTerminal;
281
+ if (!stringRecordValue(state, "expected_terminal_path")) {
282
+ state.expected_terminal_path = requestedTerminal;
283
+ }
284
+ const startPath = normalizeRoutePath(state.server_path) || normalizeRoutePath(state.expected_start_path) || "/";
285
+ if (!stringRecordValue(state, "expected_start_path")) {
286
+ state.expected_start_path = startPath;
287
+ }
288
+ const existingContract = state.interaction_contract && typeof state.interaction_contract === "object" ? state.interaction_contract : {};
289
+ state.interaction_contract = {
290
+ ...existingContract,
291
+ start_path: stringRecordValue(existingContract, "start_path") || startPath,
292
+ expected_terminal_path: stringRecordValue(existingContract, "expected_terminal_path") || requestedTerminal
293
+ };
294
+ }
252
295
  function interactionStartPathForAuthorPacket(state, parsed, refined) {
253
296
  return normalizeRoutePath(
254
297
  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") || "/"
@@ -965,6 +1008,7 @@ function mergeStateFromParams(statePath, params) {
965
1008
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
966
1009
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
967
1010
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
1011
+ applyRequestedInteractionRouteContract(state);
968
1012
  if (params.recon_assessment_json !== void 0) {
969
1013
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
970
1014
  if (!raw) {
@@ -27,7 +27,7 @@ import {
27
27
  visualDeltaShipGateReason,
28
28
  workflowFile,
29
29
  writeState
30
- } from "../chunk-RF72NWHM.js";
30
+ } from "../chunk-K6HZUSHH.js";
31
31
  import "../chunk-MLKGABMK.js";
32
32
  export {
33
33
  BUNDLED_RIDDLE_PROOF_DIR,
@@ -216,6 +216,30 @@ function normalizeRoutePath(value) {
216
216
  return `${pathname}${query}${hash}`;
217
217
  }
218
218
  }
219
+ function trimRouteCandidate(value) {
220
+ return value.trim().replace(/[),.;\]}]+$/g, "");
221
+ }
222
+ function expectedTerminalRouteFromText(value) {
223
+ const text = typeof value === "string" ? value.trim() : "";
224
+ if (!text) return "";
225
+ const routePattern = "(https?:\\/\\/[^\\s\"'<>`]+|\\/[^\\s\"'<>`]+)";
226
+ const patterns = [
227
+ new RegExp(`\\bexpected\\s+(?:terminal\\s+|final\\s+|after\\s+)?(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
228
+ new RegExp(`\\b(?:terminal|final|after)\\s+(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
229
+ new RegExp(`\\b(?:ends|end|ending|lands|land|landing)\\s+(?:at|on)\\s*${routePattern}`, "i")
230
+ ];
231
+ for (const pattern of patterns) {
232
+ const match = text.match(pattern);
233
+ if (!match) continue;
234
+ const candidate = trimRouteCandidate(match[1] || "");
235
+ const normalized = normalizeRoutePath(candidate);
236
+ if (normalized) return normalized;
237
+ }
238
+ return "";
239
+ }
240
+ function requestedExpectedTerminalRouteForState(state) {
241
+ return expectedTerminalRouteFromText(state.success_criteria) || expectedTerminalRouteFromText(state.change_request) || expectedTerminalRouteFromText(state.context) || expectedTerminalRouteFromText(state.assertions_json);
242
+ }
219
243
  function isInteractionVerificationMode(value) {
220
244
  return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
221
245
  }
@@ -228,6 +252,25 @@ function appendStateWarning(state, key, warning) {
228
252
  const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
229
253
  if (!existing.includes(warning)) state[key] = [...existing, warning];
230
254
  }
255
+ function applyRequestedInteractionRouteContract(state) {
256
+ if (!isInteractionVerificationMode(state.verification_mode)) return;
257
+ const requestedTerminal = requestedExpectedTerminalRouteForState(state);
258
+ if (!requestedTerminal) return;
259
+ state.requested_expected_terminal_path = requestedTerminal;
260
+ if (!stringRecordValue(state, "expected_terminal_path")) {
261
+ state.expected_terminal_path = requestedTerminal;
262
+ }
263
+ const startPath = normalizeRoutePath(state.server_path) || normalizeRoutePath(state.expected_start_path) || "/";
264
+ if (!stringRecordValue(state, "expected_start_path")) {
265
+ state.expected_start_path = startPath;
266
+ }
267
+ const existingContract = state.interaction_contract && typeof state.interaction_contract === "object" ? state.interaction_contract : {};
268
+ state.interaction_contract = {
269
+ ...existingContract,
270
+ start_path: stringRecordValue(existingContract, "start_path") || startPath,
271
+ expected_terminal_path: stringRecordValue(existingContract, "expected_terminal_path") || requestedTerminal
272
+ };
273
+ }
231
274
  function interactionStartPathForAuthorPacket(state, parsed, refined) {
232
275
  return normalizeRoutePath(
233
276
  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") || "/"
@@ -944,6 +987,7 @@ function mergeStateFromParams(statePath, params) {
944
987
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
945
988
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
946
989
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
990
+ applyRequestedInteractionRouteContract(state);
947
991
  if (params.recon_assessment_json !== void 0) {
948
992
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
949
993
  if (!raw) {
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createRiddleProofEngine,
3
3
  executeWorkflow
4
- } from "../chunk-EGOVHMBQ.js";
5
- import "../chunk-RF72NWHM.js";
4
+ } from "../chunk-YC77HZVF.js";
5
+ import "../chunk-K6HZUSHH.js";
6
6
  import "../chunk-MLKGABMK.js";
7
7
  export {
8
8
  createRiddleProofEngine,
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "../chunk-DZYH67J2.js";
4
- import "../chunk-YZUVEJ5B.js";
5
- import "../chunk-FMOYUYH2.js";
6
- import "../chunk-RF72NWHM.js";
7
- import "../chunk-4FOHZ7JG.js";
3
+ } from "../chunk-3OTO7IDH.js";
4
+ import "../chunk-ZQWVXQKJ.js";
5
+ import "../chunk-RDPG554T.js";
6
+ import "../chunk-K6HZUSHH.js";
7
+ import "../chunk-OILKSY5J.js";
8
8
  import "../chunk-VY4Y5U57.js";
9
9
  import "../chunk-MLKGABMK.js";
10
10
  export {
@@ -119,7 +119,7 @@ function responseSchemaForAuthorPacket() {
119
119
  summary: { type: "string" },
120
120
  payload: {
121
121
  type: "object",
122
- 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."
122
+ 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."
123
123
  },
124
124
  reasons: { type: "array", items: { type: "string" } },
125
125
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -430,6 +430,10 @@ function buildAuthorCheckpointPacket(input) {
430
430
  reference: input.request.reference || fullState.reference,
431
431
  server_path: fullState.server_path,
432
432
  wait_for_selector: fullState.wait_for_selector,
433
+ expected_start_path: fullState.expected_start_path,
434
+ expected_terminal_path: fullState.expected_terminal_path,
435
+ requested_expected_terminal_path: fullState.requested_expected_terminal_path,
436
+ interaction_contract: jsonCloneRecord(fullState.interaction_contract),
433
437
  route_expectation: jsonCloneRecord(fullState.route_expectation),
434
438
  author_summary: fullState.author_summary,
435
439
  author_request: jsonCloneRecord(authorRequest),
@@ -637,9 +641,24 @@ function defaultContinueStage(packet, decision) {
637
641
  }
638
642
  function templatePayloadFor(packet, decision) {
639
643
  if (decision === "author_packet") {
644
+ const expectedTerminalPath = packet.state_excerpt?.expected_terminal_path || packet.state_excerpt?.requested_expected_terminal_path || null;
645
+ const expectedStartPath = packet.state_excerpt?.expected_start_path || packet.state_excerpt?.server_path || null;
640
646
  return {
641
647
  proof_plan: "TODO: describe the exact proof plan and stop condition.",
642
648
  capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
649
+ refined_inputs: {
650
+ server_path: packet.state_excerpt?.server_path || null,
651
+ wait_for_selector: packet.state_excerpt?.wait_for_selector || null,
652
+ reference: packet.state_excerpt?.reference || null,
653
+ expected_start_path: expectedStartPath,
654
+ expected_terminal_path: expectedTerminalPath
655
+ },
656
+ interaction_contract: {
657
+ start_path: expectedStartPath,
658
+ expected_terminal_path: expectedTerminalPath,
659
+ action: "TODO: describe the browser interaction, for example click the visible Proof nav link.",
660
+ assertions: []
661
+ },
643
662
  summary: "TODO: summarize why this proof packet targets the requested change."
644
663
  };
645
664
  }