@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
@@ -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 {
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") || "/"
@@ -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) {
@@ -3612,7 +3656,7 @@ function responseSchemaForAuthorPacket() {
3612
3656
  summary: { type: "string" },
3613
3657
  payload: {
3614
3658
  type: "object",
3615
- 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."
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."
3616
3660
  },
3617
3661
  reasons: { type: "array", items: { type: "string" } },
3618
3662
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -3923,6 +3967,10 @@ function buildAuthorCheckpointPacket(input) {
3923
3967
  reference: input.request.reference || fullState.reference,
3924
3968
  server_path: fullState.server_path,
3925
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),
3926
3974
  route_expectation: jsonCloneRecord(fullState.route_expectation),
3927
3975
  author_summary: fullState.author_summary,
3928
3976
  author_request: jsonCloneRecord(authorRequest),
@@ -4130,9 +4178,24 @@ function defaultContinueStage(packet, decision) {
4130
4178
  }
4131
4179
  function templatePayloadFor(packet, decision) {
4132
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;
4133
4183
  return {
4134
4184
  proof_plan: "TODO: describe the exact proof plan and stop condition.",
4135
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
+ },
4136
4199
  summary: "TODO: summarize why this proof packet targets the requested change."
4137
4200
  };
4138
4201
  }
@@ -6841,7 +6904,20 @@ var REFINED_INPUTS_SCHEMA = {
6841
6904
  properties: {
6842
6905
  server_path: { type: ["string", "null"] },
6843
6906
  wait_for_selector: { type: ["string", "null"] },
6844
- 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" } }
6845
6921
  }
6846
6922
  };
6847
6923
  var BASELINE_UNDERSTANDING_SCHEMA = {
@@ -6911,6 +6987,8 @@ var AUTHOR_SCHEMA = {
6911
6987
  capture_script: { type: "string" },
6912
6988
  baseline_understanding_used: BASELINE_UNDERSTANDING_SCHEMA,
6913
6989
  refined_inputs: REFINED_INPUTS_SCHEMA,
6990
+ expected_terminal_path: { type: ["string", "null"] },
6991
+ interaction_contract: INTERACTION_CONTRACT_SCHEMA,
6914
6992
  rationale: { type: "array", items: { type: "string" } },
6915
6993
  confidence: { type: "string", enum: ["low", "medium", "high"] },
6916
6994
  summary: { type: "string" }
@@ -7518,7 +7596,10 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
7518
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.",
7519
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.",
7520
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.",
7521
- "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.",
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.",
7522
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.",
7523
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.",
7524
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.",
@@ -7532,7 +7613,7 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
7532
7613
  "For visual/UI proof, include saveScreenshot('after-proof') exactly once.",
7533
7614
  "Avoid generic proof language. The packet should be specific enough that verify can tell whether the requested change actually happened.",
7534
7615
  "Echo the baseline understanding you used in baseline_understanding_used so later stages can detect drift.",
7535
- "Use refined_inputs for server_path, wait_for_selector, or reference when useful; use null values when no refinement is needed."
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."
7536
7617
  ].join("\n")
7537
7618
  });
7538
7619
  return payloadOrBlocker(raw, context.checkpoint);
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-DZYH67J2.js";
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-EMVMXVJV.js";
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-YZUVEJ5B.js";
110
+ } from "./chunk-ZQWVXQKJ.js";
111
111
  import {
112
112
  RIDDLE_PROOF_RUN_CARD_VERSION,
113
113
  createRiddleProofRunCard
114
- } from "./chunk-FMOYUYH2.js";
115
- import "./chunk-RF72NWHM.js";
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-4FOHZ7JG.js";
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-EEIYUZXE.js";
137
+ } from "./chunk-4PPJKW3Z.js";
138
138
  import {
139
139
  applyTerminalMetadata,
140
140
  compactRecord,
@@ -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 {
package/dist/openclaw.js CHANGED
@@ -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 {
@@ -235,6 +235,30 @@ function normalizeRoutePath(value) {
235
235
  return `${pathname}${query}${hash}`;
236
236
  }
237
237
  }
238
+ function trimRouteCandidate(value) {
239
+ return value.trim().replace(/[),.;\]}]+$/g, "");
240
+ }
241
+ function expectedTerminalRouteFromText(value) {
242
+ const text = typeof value === "string" ? value.trim() : "";
243
+ if (!text) return "";
244
+ const routePattern = "(https?:\\/\\/[^\\s\"'<>`]+|\\/[^\\s\"'<>`]+)";
245
+ const patterns = [
246
+ new RegExp(`\\bexpected\\s+(?:terminal\\s+|final\\s+|after\\s+)?(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
247
+ new RegExp(`\\b(?:terminal|final|after)\\s+(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
248
+ new RegExp(`\\b(?:ends|end|ending|lands|land|landing)\\s+(?:at|on)\\s*${routePattern}`, "i")
249
+ ];
250
+ for (const pattern of patterns) {
251
+ const match = text.match(pattern);
252
+ if (!match) continue;
253
+ const candidate = trimRouteCandidate(match[1] || "");
254
+ const normalized = normalizeRoutePath(candidate);
255
+ if (normalized) return normalized;
256
+ }
257
+ return "";
258
+ }
259
+ function requestedExpectedTerminalRouteForState(state) {
260
+ return expectedTerminalRouteFromText(state.success_criteria) || expectedTerminalRouteFromText(state.change_request) || expectedTerminalRouteFromText(state.context) || expectedTerminalRouteFromText(state.assertions_json);
261
+ }
238
262
  function isInteractionVerificationMode(value) {
239
263
  return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
240
264
  }
@@ -247,6 +271,25 @@ function appendStateWarning(state, key, warning) {
247
271
  const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
248
272
  if (!existing.includes(warning)) state[key] = [...existing, warning];
249
273
  }
274
+ function applyRequestedInteractionRouteContract(state) {
275
+ if (!isInteractionVerificationMode(state.verification_mode)) return;
276
+ const requestedTerminal = requestedExpectedTerminalRouteForState(state);
277
+ if (!requestedTerminal) return;
278
+ state.requested_expected_terminal_path = requestedTerminal;
279
+ if (!stringRecordValue(state, "expected_terminal_path")) {
280
+ state.expected_terminal_path = requestedTerminal;
281
+ }
282
+ const startPath = normalizeRoutePath(state.server_path) || normalizeRoutePath(state.expected_start_path) || "/";
283
+ if (!stringRecordValue(state, "expected_start_path")) {
284
+ state.expected_start_path = startPath;
285
+ }
286
+ const existingContract = state.interaction_contract && typeof state.interaction_contract === "object" ? state.interaction_contract : {};
287
+ state.interaction_contract = {
288
+ ...existingContract,
289
+ start_path: stringRecordValue(existingContract, "start_path") || startPath,
290
+ expected_terminal_path: stringRecordValue(existingContract, "expected_terminal_path") || requestedTerminal
291
+ };
292
+ }
250
293
  function interactionStartPathForAuthorPacket(state, parsed, refined) {
251
294
  return normalizeRoutePath(
252
295
  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") || "/"
@@ -963,6 +1006,7 @@ function mergeStateFromParams(statePath, params) {
963
1006
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
964
1007
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
965
1008
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
1009
+ applyRequestedInteractionRouteContract(state);
966
1010
  if (params.recon_assessment_json !== void 0) {
967
1011
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
968
1012
  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,
@@ -214,6 +214,30 @@ function normalizeRoutePath(value) {
214
214
  return `${pathname}${query}${hash}`;
215
215
  }
216
216
  }
217
+ function trimRouteCandidate(value) {
218
+ return value.trim().replace(/[),.;\]}]+$/g, "");
219
+ }
220
+ function expectedTerminalRouteFromText(value) {
221
+ const text = typeof value === "string" ? value.trim() : "";
222
+ if (!text) return "";
223
+ const routePattern = "(https?:\\/\\/[^\\s\"'<>`]+|\\/[^\\s\"'<>`]+)";
224
+ const patterns = [
225
+ new RegExp(`\\bexpected\\s+(?:terminal\\s+|final\\s+|after\\s+)?(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
226
+ new RegExp(`\\b(?:terminal|final|after)\\s+(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
227
+ new RegExp(`\\b(?:ends|end|ending|lands|land|landing)\\s+(?:at|on)\\s*${routePattern}`, "i")
228
+ ];
229
+ for (const pattern of patterns) {
230
+ const match = text.match(pattern);
231
+ if (!match) continue;
232
+ const candidate = trimRouteCandidate(match[1] || "");
233
+ const normalized = normalizeRoutePath(candidate);
234
+ if (normalized) return normalized;
235
+ }
236
+ return "";
237
+ }
238
+ function requestedExpectedTerminalRouteForState(state) {
239
+ return expectedTerminalRouteFromText(state.success_criteria) || expectedTerminalRouteFromText(state.change_request) || expectedTerminalRouteFromText(state.context) || expectedTerminalRouteFromText(state.assertions_json);
240
+ }
217
241
  function isInteractionVerificationMode(value) {
218
242
  return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
219
243
  }
@@ -226,6 +250,25 @@ function appendStateWarning(state, key, warning) {
226
250
  const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
227
251
  if (!existing.includes(warning)) state[key] = [...existing, warning];
228
252
  }
253
+ function applyRequestedInteractionRouteContract(state) {
254
+ if (!isInteractionVerificationMode(state.verification_mode)) return;
255
+ const requestedTerminal = requestedExpectedTerminalRouteForState(state);
256
+ if (!requestedTerminal) return;
257
+ state.requested_expected_terminal_path = requestedTerminal;
258
+ if (!stringRecordValue(state, "expected_terminal_path")) {
259
+ state.expected_terminal_path = requestedTerminal;
260
+ }
261
+ const startPath = normalizeRoutePath(state.server_path) || normalizeRoutePath(state.expected_start_path) || "/";
262
+ if (!stringRecordValue(state, "expected_start_path")) {
263
+ state.expected_start_path = startPath;
264
+ }
265
+ const existingContract = state.interaction_contract && typeof state.interaction_contract === "object" ? state.interaction_contract : {};
266
+ state.interaction_contract = {
267
+ ...existingContract,
268
+ start_path: stringRecordValue(existingContract, "start_path") || startPath,
269
+ expected_terminal_path: stringRecordValue(existingContract, "expected_terminal_path") || requestedTerminal
270
+ };
271
+ }
229
272
  function interactionStartPathForAuthorPacket(state, parsed, refined) {
230
273
  return normalizeRoutePath(
231
274
  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") || "/"
@@ -942,6 +985,7 @@ function mergeStateFromParams(statePath, params) {
942
985
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
943
986
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
944
987
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
988
+ applyRequestedInteractionRouteContract(state);
945
989
  if (params.recon_assessment_json !== void 0) {
946
990
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
947
991
  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,
package/dist/run-card.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  RIDDLE_PROOF_RUN_CARD_VERSION,
3
3
  createRiddleProofRunCard
4
- } from "./chunk-FMOYUYH2.js";
5
- import "./chunk-4FOHZ7JG.js";
4
+ } from "./chunk-RDPG554T.js";
5
+ import "./chunk-OILKSY5J.js";
6
6
  import "./chunk-VY4Y5U57.js";
7
7
  import "./chunk-MLKGABMK.js";
8
8
  export {
package/dist/runner.js CHANGED
@@ -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 {
@@ -121,7 +121,7 @@ function responseSchemaForAuthorPacket() {
121
121
  summary: { type: "string" },
122
122
  payload: {
123
123
  type: "object",
124
- 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."
124
+ 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."
125
125
  },
126
126
  reasons: { type: "array", items: { type: "string" } },
127
127
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -432,6 +432,10 @@ function buildAuthorCheckpointPacket(input) {
432
432
  reference: input.request.reference || fullState.reference,
433
433
  server_path: fullState.server_path,
434
434
  wait_for_selector: fullState.wait_for_selector,
435
+ expected_start_path: fullState.expected_start_path,
436
+ expected_terminal_path: fullState.expected_terminal_path,
437
+ requested_expected_terminal_path: fullState.requested_expected_terminal_path,
438
+ interaction_contract: jsonCloneRecord(fullState.interaction_contract),
435
439
  route_expectation: jsonCloneRecord(fullState.route_expectation),
436
440
  author_summary: fullState.author_summary,
437
441
  author_request: jsonCloneRecord(authorRequest),
@@ -639,9 +643,24 @@ function defaultContinueStage(packet, decision) {
639
643
  }
640
644
  function templatePayloadFor(packet, decision) {
641
645
  if (decision === "author_packet") {
646
+ const expectedTerminalPath = packet.state_excerpt?.expected_terminal_path || packet.state_excerpt?.requested_expected_terminal_path || null;
647
+ const expectedStartPath = packet.state_excerpt?.expected_start_path || packet.state_excerpt?.server_path || null;
642
648
  return {
643
649
  proof_plan: "TODO: describe the exact proof plan and stop condition.",
644
650
  capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
651
+ refined_inputs: {
652
+ server_path: packet.state_excerpt?.server_path || null,
653
+ wait_for_selector: packet.state_excerpt?.wait_for_selector || null,
654
+ reference: packet.state_excerpt?.reference || null,
655
+ expected_start_path: expectedStartPath,
656
+ expected_terminal_path: expectedTerminalPath
657
+ },
658
+ interaction_contract: {
659
+ start_path: expectedStartPath,
660
+ expected_terminal_path: expectedTerminalPath,
661
+ action: "TODO: describe the browser interaction, for example click the visible Proof nav link.",
662
+ assertions: []
663
+ },
645
664
  summary: "TODO: summarize why this proof packet targets the requested change."
646
665
  };
647
666
  }
@@ -13,7 +13,7 @@ import {
13
13
  normalizeCheckpointResponse,
14
14
  proofContractFromAuthorCheckpointResponse,
15
15
  statePathsForRunState
16
- } from "../chunk-4FOHZ7JG.js";
16
+ } from "../chunk-OILKSY5J.js";
17
17
  import "../chunk-VY4Y5U57.js";
18
18
  import "../chunk-MLKGABMK.js";
19
19
  export {
@@ -344,7 +344,7 @@ function responseSchemaForAuthorPacket() {
344
344
  summary: { type: "string" },
345
345
  payload: {
346
346
  type: "object",
347
- 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."
347
+ 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."
348
348
  },
349
349
  reasons: { type: "array", items: { type: "string" } },
350
350
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -655,6 +655,10 @@ function buildAuthorCheckpointPacket(input) {
655
655
  reference: input.request.reference || fullState.reference,
656
656
  server_path: fullState.server_path,
657
657
  wait_for_selector: fullState.wait_for_selector,
658
+ expected_start_path: fullState.expected_start_path,
659
+ expected_terminal_path: fullState.expected_terminal_path,
660
+ requested_expected_terminal_path: fullState.requested_expected_terminal_path,
661
+ interaction_contract: jsonCloneRecord(fullState.interaction_contract),
658
662
  route_expectation: jsonCloneRecord(fullState.route_expectation),
659
663
  author_summary: fullState.author_summary,
660
664
  author_request: jsonCloneRecord(authorRequest),
@@ -862,9 +866,24 @@ function defaultContinueStage(packet, decision) {
862
866
  }
863
867
  function templatePayloadFor(packet, decision) {
864
868
  if (decision === "author_packet") {
869
+ const expectedTerminalPath = packet.state_excerpt?.expected_terminal_path || packet.state_excerpt?.requested_expected_terminal_path || null;
870
+ const expectedStartPath = packet.state_excerpt?.expected_start_path || packet.state_excerpt?.server_path || null;
865
871
  return {
866
872
  proof_plan: "TODO: describe the exact proof plan and stop condition.",
867
873
  capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
874
+ refined_inputs: {
875
+ server_path: packet.state_excerpt?.server_path || null,
876
+ wait_for_selector: packet.state_excerpt?.wait_for_selector || null,
877
+ reference: packet.state_excerpt?.reference || null,
878
+ expected_start_path: expectedStartPath,
879
+ expected_terminal_path: expectedTerminalPath
880
+ },
881
+ interaction_contract: {
882
+ start_path: expectedStartPath,
883
+ expected_terminal_path: expectedTerminalPath,
884
+ action: "TODO: describe the browser interaction, for example click the visible Proof nav link.",
885
+ assertions: []
886
+ },
868
887
  summary: "TODO: summarize why this proof packet targets the requested change."
869
888
  };
870
889
  }
@@ -10,11 +10,11 @@ import {
10
10
  normalizePrLifecycleState,
11
11
  normalizeRunParams,
12
12
  setRunStatus
13
- } from "../chunk-YZUVEJ5B.js";
13
+ } from "../chunk-ZQWVXQKJ.js";
14
14
  import {
15
15
  RIDDLE_PROOF_RUN_CARD_VERSION,
16
16
  createRiddleProofRunCard
17
- } from "../chunk-FMOYUYH2.js";
17
+ } from "../chunk-RDPG554T.js";
18
18
  import {
19
19
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
20
20
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
@@ -30,7 +30,7 @@ import {
30
30
  normalizeCheckpointResponse,
31
31
  proofContractFromAuthorCheckpointResponse,
32
32
  statePathsForRunState
33
- } from "../chunk-4FOHZ7JG.js";
33
+ } from "../chunk-OILKSY5J.js";
34
34
  import {
35
35
  applyTerminalMetadata,
36
36
  compactRecord,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  RIDDLE_PROOF_RUN_CARD_VERSION,
3
3
  createRiddleProofRunCard
4
- } from "../chunk-FMOYUYH2.js";
5
- import "../chunk-4FOHZ7JG.js";
4
+ } from "../chunk-RDPG554T.js";
5
+ import "../chunk-OILKSY5J.js";
6
6
  import "../chunk-VY4Y5U57.js";
7
7
  import "../chunk-MLKGABMK.js";
8
8
  export {
@@ -9,9 +9,9 @@ import {
9
9
  normalizePrLifecycleState,
10
10
  normalizeRunParams,
11
11
  setRunStatus
12
- } from "../chunk-YZUVEJ5B.js";
13
- import "../chunk-FMOYUYH2.js";
14
- import "../chunk-4FOHZ7JG.js";
12
+ } from "../chunk-ZQWVXQKJ.js";
13
+ import "../chunk-RDPG554T.js";
14
+ import "../chunk-OILKSY5J.js";
15
15
  import "../chunk-VY4Y5U57.js";
16
16
  import "../chunk-MLKGABMK.js";
17
17
  export {