@riddledc/riddle-proof 0.8.26 → 0.8.28

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 (57) 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
  55. package/runtime/lib/setup.py +23 -4
  56. package/runtime/lib/verify.py +41 -1
  57. package/runtime/tests/recon_verify_smoke.py +110 -0
@@ -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 {
@@ -22,14 +22,14 @@ import {
22
22
  createDisabledRiddleProofAgentAdapter,
23
23
  readRiddleProofRunStatus,
24
24
  runRiddleProofEngineHarness
25
- } from "./chunk-EMVMXVJV.js";
25
+ } from "./chunk-AM3K5FPW.js";
26
26
  import {
27
27
  createCheckpointResponseTemplate
28
- } from "./chunk-4FOHZ7JG.js";
28
+ } from "./chunk-OILKSY5J.js";
29
29
  import {
30
30
  createCodexExecAgentAdapter,
31
31
  runCodexExecAgentDoctor
32
- } from "./chunk-EEIYUZXE.js";
32
+ } from "./chunk-4PPJKW3Z.js";
33
33
 
34
34
  // src/cli.ts
35
35
  import { spawnSync } from "child_process";
@@ -3,10 +3,10 @@ import {
3
3
  appendStageHeartbeat,
4
4
  createRunState,
5
5
  setRunStatus
6
- } from "./chunk-YZUVEJ5B.js";
6
+ } from "./chunk-ZQWVXQKJ.js";
7
7
  import {
8
8
  noImplementationModeFor
9
- } from "./chunk-RF72NWHM.js";
9
+ } from "./chunk-K6HZUSHH.js";
10
10
  import {
11
11
  createRunResult
12
12
  } from "./chunk-VY4Y5U57.js";
@@ -16,7 +16,20 @@ var REFINED_INPUTS_SCHEMA = {
16
16
  properties: {
17
17
  server_path: { type: ["string", "null"] },
18
18
  wait_for_selector: { type: ["string", "null"] },
19
- reference: { enum: ["before", "prod", "both", null] }
19
+ reference: { enum: ["before", "prod", "both", null] },
20
+ expected_start_path: { type: ["string", "null"] },
21
+ expected_terminal_path: { type: ["string", "null"] }
22
+ }
23
+ };
24
+ var INTERACTION_CONTRACT_SCHEMA = {
25
+ type: "object",
26
+ additionalProperties: true,
27
+ properties: {
28
+ start_path: { type: ["string", "null"] },
29
+ expected_terminal_path: { type: ["string", "null"] },
30
+ expected_url: { type: ["string", "null"] },
31
+ action: { type: ["string", "null"] },
32
+ assertions: { type: "array", items: { type: "string" } }
20
33
  }
21
34
  };
22
35
  var BASELINE_UNDERSTANDING_SCHEMA = {
@@ -86,6 +99,8 @@ var AUTHOR_SCHEMA = {
86
99
  capture_script: { type: "string" },
87
100
  baseline_understanding_used: BASELINE_UNDERSTANDING_SCHEMA,
88
101
  refined_inputs: REFINED_INPUTS_SCHEMA,
102
+ expected_terminal_path: { type: ["string", "null"] },
103
+ interaction_contract: INTERACTION_CONTRACT_SCHEMA,
89
104
  rationale: { type: "array", items: { type: "string" } },
90
105
  confidence: { type: "string", enum: ["low", "medium", "high"] },
91
106
  summary: { type: "string" }
@@ -693,7 +708,10 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
693
708
  "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.",
694
709
  "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.",
695
710
  "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.",
696
- "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.",
711
+ "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.",
712
+ "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.",
713
+ "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.",
714
+ "Catch waitForURL or selector timeouts and record them as failed assertions instead of throwing before evidence is emitted.",
697
715
  "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.",
698
716
  "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.",
699
717
  "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.",
@@ -707,7 +725,7 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
707
725
  "For visual/UI proof, include saveScreenshot('after-proof') exactly once.",
708
726
  "Avoid generic proof language. The packet should be specific enough that verify can tell whether the requested change actually happened.",
709
727
  "Echo the baseline understanding you used in baseline_understanding_used so later stages can detect drift.",
710
- "Use refined_inputs for server_path, wait_for_selector, or reference when useful; use null values when no refinement is needed."
728
+ "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."
711
729
  ].join("\n")
712
730
  });
713
731
  return payloadOrBlocker(raw, context.checkpoint);
@@ -5,17 +5,17 @@ import {
5
5
  createRunStatusSnapshot,
6
6
  normalizeRunParams,
7
7
  setRunStatus
8
- } from "./chunk-YZUVEJ5B.js";
8
+ } from "./chunk-ZQWVXQKJ.js";
9
9
  import {
10
10
  createRiddleProofRunCard
11
- } from "./chunk-FMOYUYH2.js";
11
+ } from "./chunk-RDPG554T.js";
12
12
  import {
13
13
  noImplementationModeFor,
14
14
  proofAssessmentHardBlockersForState,
15
15
  visualDeltaForState,
16
16
  visualDeltaRequiredForState,
17
17
  visualDeltaShipGateReason
18
- } from "./chunk-RF72NWHM.js";
18
+ } from "./chunk-K6HZUSHH.js";
19
19
  import {
20
20
  authorPacketPayloadFromCheckpointResponse,
21
21
  buildCheckpointPacketForEngineResult,
@@ -25,7 +25,7 @@ import {
25
25
  normalizeCheckpointResponse,
26
26
  proofContractFromAuthorCheckpointResponse,
27
27
  statePathsForRunState
28
- } from "./chunk-4FOHZ7JG.js";
28
+ } from "./chunk-OILKSY5J.js";
29
29
  import {
30
30
  applyTerminalMetadata,
31
31
  compactRecord,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  normalizeIntegrationContext,
3
3
  normalizeRunParams
4
- } from "./chunk-YZUVEJ5B.js";
4
+ } from "./chunk-ZQWVXQKJ.js";
5
5
  import {
6
6
  compactRecord
7
7
  } from "./chunk-VY4Y5U57.js";
@@ -208,6 +208,30 @@ function normalizeRoutePath(value) {
208
208
  return `${pathname}${query}${hash}`;
209
209
  }
210
210
  }
211
+ function trimRouteCandidate(value) {
212
+ return value.trim().replace(/[),.;\]}]+$/g, "");
213
+ }
214
+ function expectedTerminalRouteFromText(value) {
215
+ const text = typeof value === "string" ? value.trim() : "";
216
+ if (!text) return "";
217
+ const routePattern = "(https?:\\/\\/[^\\s\"'<>`]+|\\/[^\\s\"'<>`]+)";
218
+ const patterns = [
219
+ new RegExp(`\\bexpected\\s+(?:terminal\\s+|final\\s+|after\\s+)?(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
220
+ new RegExp(`\\b(?:terminal|final|after)\\s+(?:url|route|path)\\s*(?:is|=|:)\\s*${routePattern}`, "i"),
221
+ new RegExp(`\\b(?:ends|end|ending|lands|land|landing)\\s+(?:at|on)\\s*${routePattern}`, "i")
222
+ ];
223
+ for (const pattern of patterns) {
224
+ const match = text.match(pattern);
225
+ if (!match) continue;
226
+ const candidate = trimRouteCandidate(match[1] || "");
227
+ const normalized = normalizeRoutePath(candidate);
228
+ if (normalized) return normalized;
229
+ }
230
+ return "";
231
+ }
232
+ function requestedExpectedTerminalRouteForState(state) {
233
+ return expectedTerminalRouteFromText(state.success_criteria) || expectedTerminalRouteFromText(state.change_request) || expectedTerminalRouteFromText(state.context) || expectedTerminalRouteFromText(state.assertions_json);
234
+ }
211
235
  function isInteractionVerificationMode(value) {
212
236
  return INTERACTION_VERIFICATION_MODES.has(typeof value === "string" ? value.trim().toLowerCase() : "");
213
237
  }
@@ -220,6 +244,25 @@ function appendStateWarning(state, key, warning) {
220
244
  const existing = Array.isArray(state[key]) ? state[key].filter((item) => typeof item === "string") : [];
221
245
  if (!existing.includes(warning)) state[key] = [...existing, warning];
222
246
  }
247
+ function applyRequestedInteractionRouteContract(state) {
248
+ if (!isInteractionVerificationMode(state.verification_mode)) return;
249
+ const requestedTerminal = requestedExpectedTerminalRouteForState(state);
250
+ if (!requestedTerminal) return;
251
+ state.requested_expected_terminal_path = requestedTerminal;
252
+ if (!stringRecordValue(state, "expected_terminal_path")) {
253
+ state.expected_terminal_path = requestedTerminal;
254
+ }
255
+ const startPath = normalizeRoutePath(state.server_path) || normalizeRoutePath(state.expected_start_path) || "/";
256
+ if (!stringRecordValue(state, "expected_start_path")) {
257
+ state.expected_start_path = startPath;
258
+ }
259
+ const existingContract = state.interaction_contract && typeof state.interaction_contract === "object" ? state.interaction_contract : {};
260
+ state.interaction_contract = {
261
+ ...existingContract,
262
+ start_path: stringRecordValue(existingContract, "start_path") || startPath,
263
+ expected_terminal_path: stringRecordValue(existingContract, "expected_terminal_path") || requestedTerminal
264
+ };
265
+ }
223
266
  function interactionStartPathForAuthorPacket(state, parsed, refined) {
224
267
  return normalizeRoutePath(
225
268
  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") || "/"
@@ -936,6 +979,7 @@ function mergeStateFromParams(statePath, params) {
936
979
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
937
980
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
938
981
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
982
+ applyRequestedInteractionRouteContract(state);
939
983
  if (params.recon_assessment_json !== void 0) {
940
984
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
941
985
  if (!raw) {
@@ -65,7 +65,7 @@ function responseSchemaForAuthorPacket() {
65
65
  summary: { type: "string" },
66
66
  payload: {
67
67
  type: "object",
68
- 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."
68
+ 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."
69
69
  },
70
70
  reasons: { type: "array", items: { type: "string" } },
71
71
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -376,6 +376,10 @@ function buildAuthorCheckpointPacket(input) {
376
376
  reference: input.request.reference || fullState.reference,
377
377
  server_path: fullState.server_path,
378
378
  wait_for_selector: fullState.wait_for_selector,
379
+ expected_start_path: fullState.expected_start_path,
380
+ expected_terminal_path: fullState.expected_terminal_path,
381
+ requested_expected_terminal_path: fullState.requested_expected_terminal_path,
382
+ interaction_contract: jsonCloneRecord(fullState.interaction_contract),
379
383
  route_expectation: jsonCloneRecord(fullState.route_expectation),
380
384
  author_summary: fullState.author_summary,
381
385
  author_request: jsonCloneRecord(authorRequest),
@@ -583,9 +587,24 @@ function defaultContinueStage(packet, decision) {
583
587
  }
584
588
  function templatePayloadFor(packet, decision) {
585
589
  if (decision === "author_packet") {
590
+ const expectedTerminalPath = packet.state_excerpt?.expected_terminal_path || packet.state_excerpt?.requested_expected_terminal_path || null;
591
+ const expectedStartPath = packet.state_excerpt?.expected_start_path || packet.state_excerpt?.server_path || null;
586
592
  return {
587
593
  proof_plan: "TODO: describe the exact proof plan and stop condition.",
588
594
  capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
595
+ refined_inputs: {
596
+ server_path: packet.state_excerpt?.server_path || null,
597
+ wait_for_selector: packet.state_excerpt?.wait_for_selector || null,
598
+ reference: packet.state_excerpt?.reference || null,
599
+ expected_start_path: expectedStartPath,
600
+ expected_terminal_path: expectedTerminalPath
601
+ },
602
+ interaction_contract: {
603
+ start_path: expectedStartPath,
604
+ expected_terminal_path: expectedTerminalPath,
605
+ action: "TODO: describe the browser interaction, for example click the visible Proof nav link.",
606
+ assertions: []
607
+ },
589
608
  summary: "TODO: summarize why this proof packet targets the requested change."
590
609
  };
591
610
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  statePathsForRunState
3
- } from "./chunk-4FOHZ7JG.js";
3
+ } from "./chunk-OILKSY5J.js";
4
4
  import {
5
5
  compactRecord,
6
6
  isTerminalStatus,
@@ -16,7 +16,7 @@ import {
16
16
  validateShipGate,
17
17
  workflowFile,
18
18
  writeState
19
- } from "./chunk-RF72NWHM.js";
19
+ } from "./chunk-K6HZUSHH.js";
20
20
  import {
21
21
  __export
22
22
  } from "./chunk-MLKGABMK.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  createRiddleProofRunCard
3
- } from "./chunk-FMOYUYH2.js";
3
+ } from "./chunk-RDPG554T.js";
4
4
  import {
5
5
  compactRecord,
6
6
  isTerminalStatus,
package/dist/cli/index.js CHANGED
@@ -1,12 +1,12 @@
1
- import "../chunk-WULFU42E.js";
1
+ import "../chunk-27BG64ZG.js";
2
2
  import "../chunk-PEWAIEER.js";
3
3
  import "../chunk-TWTEUS7R.js";
4
- import "../chunk-EMVMXVJV.js";
5
- import "../chunk-YZUVEJ5B.js";
6
- import "../chunk-FMOYUYH2.js";
7
- import "../chunk-RF72NWHM.js";
8
- import "../chunk-4FOHZ7JG.js";
4
+ import "../chunk-AM3K5FPW.js";
5
+ import "../chunk-ZQWVXQKJ.js";
6
+ import "../chunk-RDPG554T.js";
7
+ import "../chunk-K6HZUSHH.js";
8
+ import "../chunk-OILKSY5J.js";
9
9
  import "../chunk-JFQXAJH2.js";
10
- import "../chunk-EEIYUZXE.js";
10
+ import "../chunk-4PPJKW3Z.js";
11
11
  import "../chunk-VY4Y5U57.js";
12
12
  import "../chunk-MLKGABMK.js";
package/dist/cli.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) {
@@ -3496,7 +3540,7 @@ function responseSchemaForAuthorPacket() {
3496
3540
  summary: { type: "string" },
3497
3541
  payload: {
3498
3542
  type: "object",
3499
- 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."
3543
+ 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."
3500
3544
  },
3501
3545
  reasons: { type: "array", items: { type: "string" } },
3502
3546
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -3807,6 +3851,10 @@ function buildAuthorCheckpointPacket(input) {
3807
3851
  reference: input.request.reference || fullState.reference,
3808
3852
  server_path: fullState.server_path,
3809
3853
  wait_for_selector: fullState.wait_for_selector,
3854
+ expected_start_path: fullState.expected_start_path,
3855
+ expected_terminal_path: fullState.expected_terminal_path,
3856
+ requested_expected_terminal_path: fullState.requested_expected_terminal_path,
3857
+ interaction_contract: jsonCloneRecord(fullState.interaction_contract),
3810
3858
  route_expectation: jsonCloneRecord(fullState.route_expectation),
3811
3859
  author_summary: fullState.author_summary,
3812
3860
  author_request: jsonCloneRecord(authorRequest),
@@ -4014,9 +4062,24 @@ function defaultContinueStage(packet, decision) {
4014
4062
  }
4015
4063
  function templatePayloadFor(packet, decision) {
4016
4064
  if (decision === "author_packet") {
4065
+ const expectedTerminalPath = packet.state_excerpt?.expected_terminal_path || packet.state_excerpt?.requested_expected_terminal_path || null;
4066
+ const expectedStartPath = packet.state_excerpt?.expected_start_path || packet.state_excerpt?.server_path || null;
4017
4067
  return {
4018
4068
  proof_plan: "TODO: describe the exact proof plan and stop condition.",
4019
4069
  capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
4070
+ refined_inputs: {
4071
+ server_path: packet.state_excerpt?.server_path || null,
4072
+ wait_for_selector: packet.state_excerpt?.wait_for_selector || null,
4073
+ reference: packet.state_excerpt?.reference || null,
4074
+ expected_start_path: expectedStartPath,
4075
+ expected_terminal_path: expectedTerminalPath
4076
+ },
4077
+ interaction_contract: {
4078
+ start_path: expectedStartPath,
4079
+ expected_terminal_path: expectedTerminalPath,
4080
+ action: "TODO: describe the browser interaction, for example click the visible Proof nav link.",
4081
+ assertions: []
4082
+ },
4020
4083
  summary: "TODO: summarize why this proof packet targets the requested change."
4021
4084
  };
4022
4085
  }
@@ -6179,7 +6242,20 @@ var REFINED_INPUTS_SCHEMA = {
6179
6242
  properties: {
6180
6243
  server_path: { type: ["string", "null"] },
6181
6244
  wait_for_selector: { type: ["string", "null"] },
6182
- reference: { enum: ["before", "prod", "both", null] }
6245
+ reference: { enum: ["before", "prod", "both", null] },
6246
+ expected_start_path: { type: ["string", "null"] },
6247
+ expected_terminal_path: { type: ["string", "null"] }
6248
+ }
6249
+ };
6250
+ var INTERACTION_CONTRACT_SCHEMA = {
6251
+ type: "object",
6252
+ additionalProperties: true,
6253
+ properties: {
6254
+ start_path: { type: ["string", "null"] },
6255
+ expected_terminal_path: { type: ["string", "null"] },
6256
+ expected_url: { type: ["string", "null"] },
6257
+ action: { type: ["string", "null"] },
6258
+ assertions: { type: "array", items: { type: "string" } }
6183
6259
  }
6184
6260
  };
6185
6261
  var BASELINE_UNDERSTANDING_SCHEMA = {
@@ -6249,6 +6325,8 @@ var AUTHOR_SCHEMA = {
6249
6325
  capture_script: { type: "string" },
6250
6326
  baseline_understanding_used: BASELINE_UNDERSTANDING_SCHEMA,
6251
6327
  refined_inputs: REFINED_INPUTS_SCHEMA,
6328
+ expected_terminal_path: { type: ["string", "null"] },
6329
+ interaction_contract: INTERACTION_CONTRACT_SCHEMA,
6252
6330
  rationale: { type: "array", items: { type: "string" } },
6253
6331
  confidence: { type: "string", enum: ["low", "medium", "high"] },
6254
6332
  summary: { type: "string" }
@@ -6856,7 +6934,10 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
6856
6934
  "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.",
6857
6935
  "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.",
6858
6936
  "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.",
6859
- "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.",
6937
+ "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.",
6938
+ "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.",
6939
+ "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.",
6940
+ "Catch waitForURL or selector timeouts and record them as failed assertions instead of throwing before evidence is emitted.",
6860
6941
  "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.",
6861
6942
  "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.",
6862
6943
  "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.",
@@ -6870,7 +6951,7 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
6870
6951
  "For visual/UI proof, include saveScreenshot('after-proof') exactly once.",
6871
6952
  "Avoid generic proof language. The packet should be specific enough that verify can tell whether the requested change actually happened.",
6872
6953
  "Echo the baseline understanding you used in baseline_understanding_used so later stages can detect drift.",
6873
- "Use refined_inputs for server_path, wait_for_selector, or reference when useful; use null values when no refinement is needed."
6954
+ "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."
6874
6955
  ].join("\n")
6875
6956
  });
6876
6957
  return payloadOrBlocker(raw, context.checkpoint);
package/dist/cli.js CHANGED
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-WULFU42E.js";
2
+ import "./chunk-27BG64ZG.js";
3
3
  import "./chunk-PEWAIEER.js";
4
4
  import "./chunk-TWTEUS7R.js";
5
- import "./chunk-EMVMXVJV.js";
6
- import "./chunk-YZUVEJ5B.js";
7
- import "./chunk-FMOYUYH2.js";
8
- import "./chunk-RF72NWHM.js";
9
- import "./chunk-4FOHZ7JG.js";
5
+ import "./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-JFQXAJH2.js";
11
- import "./chunk-EEIYUZXE.js";
11
+ import "./chunk-4PPJKW3Z.js";
12
12
  import "./chunk-VY4Y5U57.js";
13
13
  import "./chunk-MLKGABMK.js";
@@ -55,7 +55,20 @@ var REFINED_INPUTS_SCHEMA = {
55
55
  properties: {
56
56
  server_path: { type: ["string", "null"] },
57
57
  wait_for_selector: { type: ["string", "null"] },
58
- reference: { enum: ["before", "prod", "both", null] }
58
+ reference: { enum: ["before", "prod", "both", null] },
59
+ expected_start_path: { type: ["string", "null"] },
60
+ expected_terminal_path: { type: ["string", "null"] }
61
+ }
62
+ };
63
+ var INTERACTION_CONTRACT_SCHEMA = {
64
+ type: "object",
65
+ additionalProperties: true,
66
+ properties: {
67
+ start_path: { type: ["string", "null"] },
68
+ expected_terminal_path: { type: ["string", "null"] },
69
+ expected_url: { type: ["string", "null"] },
70
+ action: { type: ["string", "null"] },
71
+ assertions: { type: "array", items: { type: "string" } }
59
72
  }
60
73
  };
61
74
  var BASELINE_UNDERSTANDING_SCHEMA = {
@@ -125,6 +138,8 @@ var AUTHOR_SCHEMA = {
125
138
  capture_script: { type: "string" },
126
139
  baseline_understanding_used: BASELINE_UNDERSTANDING_SCHEMA,
127
140
  refined_inputs: REFINED_INPUTS_SCHEMA,
141
+ expected_terminal_path: { type: ["string", "null"] },
142
+ interaction_contract: INTERACTION_CONTRACT_SCHEMA,
128
143
  rationale: { type: "array", items: { type: "string" } },
129
144
  confidence: { type: "string", enum: ["low", "medium", "high"] },
130
145
  summary: { type: "string" }
@@ -732,7 +747,10 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
732
747
  "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.",
733
748
  "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.",
734
749
  "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.",
735
- "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.",
750
+ "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.",
751
+ "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.",
752
+ "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.",
753
+ "Catch waitForURL or selector timeouts and record them as failed assertions instead of throwing before evidence is emitted.",
736
754
  "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.",
737
755
  "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.",
738
756
  "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.",
@@ -746,7 +764,7 @@ function createCodexExecAgentAdapter(config = {}, runner = createCodexExecJsonRu
746
764
  "For visual/UI proof, include saveScreenshot('after-proof') exactly once.",
747
765
  "Avoid generic proof language. The packet should be specific enough that verify can tell whether the requested change actually happened.",
748
766
  "Echo the baseline understanding you used in baseline_understanding_used so later stages can detect drift.",
749
- "Use refined_inputs for server_path, wait_for_selector, or reference when useful; use null values when no refinement is needed."
767
+ "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."
750
768
  ].join("\n")
751
769
  });
752
770
  return payloadOrBlocker(raw, context.checkpoint);
@@ -2,7 +2,7 @@ import {
2
2
  createCodexExecAgentAdapter,
3
3
  createCodexExecJsonRunner,
4
4
  runCodexExecAgentDoctor
5
- } from "./chunk-EEIYUZXE.js";
5
+ } from "./chunk-4PPJKW3Z.js";
6
6
  import "./chunk-VY4Y5U57.js";
7
7
  import "./chunk-MLKGABMK.js";
8
8
  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) {
@@ -3498,7 +3542,7 @@ function responseSchemaForAuthorPacket() {
3498
3542
  summary: { type: "string" },
3499
3543
  payload: {
3500
3544
  type: "object",
3501
- 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."
3545
+ description: "For decision=author_packet, provide the proof packet itself or {author_packet:{...}} with proof_plan, capture_script, refined_inputs.expected_terminal_path, and interaction_contract when the proof changes route, query, or hash."
3502
3546
  },
3503
3547
  reasons: { type: "array", items: { type: "string" } },
3504
3548
  continue_with_stage: { type: "string", enum: ["author", "recon"] },
@@ -3809,6 +3853,10 @@ function buildAuthorCheckpointPacket(input) {
3809
3853
  reference: input.request.reference || fullState.reference,
3810
3854
  server_path: fullState.server_path,
3811
3855
  wait_for_selector: fullState.wait_for_selector,
3856
+ expected_start_path: fullState.expected_start_path,
3857
+ expected_terminal_path: fullState.expected_terminal_path,
3858
+ requested_expected_terminal_path: fullState.requested_expected_terminal_path,
3859
+ interaction_contract: jsonCloneRecord(fullState.interaction_contract),
3812
3860
  route_expectation: jsonCloneRecord(fullState.route_expectation),
3813
3861
  author_summary: fullState.author_summary,
3814
3862
  author_request: jsonCloneRecord(authorRequest),