@riddledc/riddle-proof 0.8.25 → 0.8.27

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/dist/adapters/codex-exec-agent.cjs +21 -3
  2. package/dist/adapters/codex-exec-agent.js +1 -1
  3. package/dist/adapters/codex.cjs +21 -3
  4. package/dist/adapters/codex.js +1 -1
  5. package/dist/adapters/local-agent.cjs +21 -3
  6. package/dist/adapters/local-agent.js +1 -1
  7. package/dist/adapters/openclaw.js +4 -4
  8. package/dist/advanced/engine-harness.cjs +103 -2
  9. package/dist/advanced/engine-harness.js +5 -5
  10. package/dist/advanced/index.cjs +103 -2
  11. package/dist/advanced/index.js +7 -7
  12. package/dist/advanced/proof-run-core.cjs +98 -1
  13. package/dist/advanced/proof-run-core.js +1 -1
  14. package/dist/advanced/proof-run-engine.cjs +98 -1
  15. package/dist/advanced/proof-run-engine.js +2 -2
  16. package/dist/advanced/runner.js +5 -5
  17. package/dist/checkpoint.cjs +20 -1
  18. package/dist/checkpoint.js +1 -1
  19. package/dist/{chunk-27AB2TEQ.js → chunk-27BG64ZG.js} +3 -3
  20. package/dist/{chunk-P2RN2NYR.js → chunk-3OTO7IDH.js} +2 -2
  21. package/dist/{chunk-EEIYUZXE.js → chunk-4PPJKW3Z.js} +21 -3
  22. package/dist/{chunk-2DW2LBUD.js → chunk-AM3K5FPW.js} +4 -4
  23. package/dist/{chunk-RBWSCU6V.js → chunk-AYMHHRJZ.js} +1 -1
  24. package/dist/{chunk-FU73I4V3.js → chunk-K6HZUSHH.js} +98 -1
  25. package/dist/{chunk-4FOHZ7JG.js → chunk-OILKSY5J.js} +20 -1
  26. package/dist/{chunk-FMOYUYH2.js → chunk-RDPG554T.js} +1 -1
  27. package/dist/{chunk-KS3N5APP.js → chunk-YC77HZVF.js} +1 -1
  28. package/dist/{chunk-YZUVEJ5B.js → chunk-ZQWVXQKJ.js} +1 -1
  29. package/dist/cli/index.js +7 -7
  30. package/dist/cli.cjs +139 -5
  31. package/dist/cli.js +7 -7
  32. package/dist/codex-exec-agent.cjs +21 -3
  33. package/dist/codex-exec-agent.js +1 -1
  34. package/dist/engine-harness.cjs +103 -2
  35. package/dist/engine-harness.js +5 -5
  36. package/dist/index.cjs +139 -5
  37. package/dist/index.js +7 -7
  38. package/dist/local-agent.cjs +21 -3
  39. package/dist/local-agent.js +1 -1
  40. package/dist/openclaw.js +4 -4
  41. package/dist/proof-run-core.cjs +98 -1
  42. package/dist/proof-run-core.js +1 -1
  43. package/dist/proof-run-engine.cjs +98 -1
  44. package/dist/proof-run-engine.js +2 -2
  45. package/dist/run-card.js +2 -2
  46. package/dist/runner.js +5 -5
  47. package/dist/spec/checkpoint.cjs +20 -1
  48. package/dist/spec/checkpoint.js +1 -1
  49. package/dist/spec/index.cjs +20 -1
  50. package/dist/spec/index.js +3 -3
  51. package/dist/spec/run-card.js +2 -2
  52. package/dist/spec/state.js +3 -3
  53. package/dist/state.js +3 -3
  54. package/package.json +1 -1
@@ -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") || "/"
@@ -291,6 +334,36 @@ function normalizeCaptureScript(value) {
291
334
  const script = normalizeOptionalString(value) || "";
292
335
  return script ? guardProofEvidenceGlobalAssignments(script) : "";
293
336
  }
337
+ function compactCaptureScriptForHeuristics(script) {
338
+ return script.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/.*$/gm, "$1 ").replace(/\s+/g, " ").trim().toLowerCase();
339
+ }
340
+ function interactionCaptureScriptLooksPassive(script) {
341
+ const text = compactCaptureScriptForHeuristics(script);
342
+ if (!text) return true;
343
+ const actionPatterns = [
344
+ /\bpage\.(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?|goto|reload)\s*\(/,
345
+ /\blocator\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?)\s*\(/,
346
+ /\b(getby(role|text|label|testid|placeholder|title)|getbyalttext)\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption)\s*\(/,
347
+ /\bkeyboard\s*\.\s*(press|type|inserttext)\s*\(/,
348
+ /\bmouse\s*\.\s*(click|dblclick|down|up|move)\s*\(/,
349
+ /\btouchscreen\s*\.\s*tap\s*\(/
350
+ ];
351
+ if (actionPatterns.some((pattern) => pattern.test(text))) return false;
352
+ const evidencePatterns = [
353
+ /\breturn\s+[{[]/,
354
+ /\breturn\s+\w+/,
355
+ /__riddleproofevidence/,
356
+ /\bproof_evidence\b/,
357
+ /\brouteexpectationsource\b/,
358
+ /\bexpectedurl\b/,
359
+ /\bassertions?\b/
360
+ ];
361
+ return !evidencePatterns.some((pattern) => pattern.test(text));
362
+ }
363
+ function setStructuredInteractionCaptureFailure(state, summary) {
364
+ const existing = typeof state.structured_interaction_capture_failure_summary === "string" ? state.structured_interaction_capture_failure_summary.trim() : "";
365
+ if (!existing) state.structured_interaction_capture_failure_summary = summary;
366
+ }
294
367
  function appendProofSummaryLine(state, line) {
295
368
  const text = String(line || "").trim();
296
369
  if (!text) return;
@@ -540,6 +613,9 @@ function proofAssessmentHardBlockersForState(state = {}) {
540
613
  }
541
614
  add(state?.structured_interaction_capture_failure_summary);
542
615
  add(state?.structured_interaction_failure_summary);
616
+ if (isInteractionVerificationMode(normalizedVerificationMode(state)) && !stateHasProofEvidence(state)) {
617
+ add("interaction proof evidence is required before ready_to_ship; proof_evidence_present=false");
618
+ }
543
619
  const mergeRecommendation = String(state?.merge_recommendation || "").trim();
544
620
  if (mergeRecommendation === "do-not-merge" && blockers.length) {
545
621
  add("merge_recommendation=do-not-merge because the proof bundle contains hard blockers.");
@@ -575,7 +651,22 @@ function stateHasAfterEvidence(state = {}) {
575
651
  const observation = objectValue(after.observation);
576
652
  const supporting = objectValue(after.supporting_artifacts);
577
653
  return Boolean(
578
- observation.valid === true && (supporting.has_structured_payload === true || supporting.proof_evidence_present === true || observation.telemetry_ready === true || Object.keys(objectValue(bundle.proof_evidence)).length > 0 || Object.keys(objectValue(after.proof_evidence)).length > 0)
654
+ observation.valid === true && (supporting.has_structured_payload === true || stateHasProofEvidence(state) || observation.telemetry_ready === true)
655
+ );
656
+ }
657
+ function stateHasProofEvidence(state = {}) {
658
+ if (state?.proof_evidence_present === true) return true;
659
+ if (state?.proof_evidence !== void 0 && state?.proof_evidence !== null) {
660
+ if (typeof state.proof_evidence !== "object") return true;
661
+ if (Object.keys(objectValue(state.proof_evidence)).length > 0) return true;
662
+ }
663
+ const bundle = objectValue(state?.evidence_bundle);
664
+ const after = objectValue(bundle.after);
665
+ const supporting = objectValue(after.supporting_artifacts);
666
+ const request = objectValue(state?.proof_assessment_request);
667
+ const structuredEvidence = objectValue(request.structured_evidence);
668
+ return Boolean(
669
+ supporting.proof_evidence_present === true || structuredEvidence.proof_evidence_present === true || Object.keys(objectValue(bundle.proof_evidence)).length > 0 || Object.keys(objectValue(after.proof_evidence)).length > 0
579
670
  );
580
671
  }
581
672
  function validateShipGate(state = {}) {
@@ -917,6 +1008,7 @@ function mergeStateFromParams(statePath, params) {
917
1008
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
918
1009
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
919
1010
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
1011
+ applyRequestedInteractionRouteContract(state);
920
1012
  if (params.recon_assessment_json !== void 0) {
921
1013
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
922
1014
  if (!raw) {
@@ -953,6 +1045,11 @@ function mergeStateFromParams(statePath, params) {
953
1045
  state.supervisor_author_packet = parsed;
954
1046
  if (typeof parsed?.proof_plan === "string") state.proof_plan = normalizeOptionalString(parsed.proof_plan) || "";
955
1047
  if (typeof parsed?.capture_script === "string") state.capture_script = normalizeCaptureScript(parsed.capture_script);
1048
+ if (isInteractionVerificationMode(state.verification_mode) && interactionCaptureScriptLooksPassive(state.capture_script || "")) {
1049
+ const warning = "Interaction proof capture script appears passive: it does not perform a browser interaction or return structured proof evidence.";
1050
+ appendStateWarning(state, "author_warnings", warning);
1051
+ setStructuredInteractionCaptureFailure(state, warning);
1052
+ }
956
1053
  if (parsed?.baseline_understanding_used && typeof parsed.baseline_understanding_used === "object") {
957
1054
  state.author_baseline_understanding_used = parsed.baseline_understanding_used;
958
1055
  }
@@ -27,7 +27,7 @@ import {
27
27
  visualDeltaShipGateReason,
28
28
  workflowFile,
29
29
  writeState
30
- } from "../chunk-FU73I4V3.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") || "/"
@@ -270,6 +313,36 @@ function normalizeCaptureScript(value) {
270
313
  const script = normalizeOptionalString(value) || "";
271
314
  return script ? guardProofEvidenceGlobalAssignments(script) : "";
272
315
  }
316
+ function compactCaptureScriptForHeuristics(script) {
317
+ return script.replace(/\/\*[\s\S]*?\*\//g, " ").replace(/(^|[^:])\/\/.*$/gm, "$1 ").replace(/\s+/g, " ").trim().toLowerCase();
318
+ }
319
+ function interactionCaptureScriptLooksPassive(script) {
320
+ const text = compactCaptureScriptForHeuristics(script);
321
+ if (!text) return true;
322
+ const actionPatterns = [
323
+ /\bpage\.(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?|goto|reload)\s*\(/,
324
+ /\blocator\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption|dispatch(event)?)\s*\(/,
325
+ /\b(getby(role|text|label|testid|placeholder|title)|getbyalttext)\s*\([^)]*\)\s*\.\s*(click|dblclick|tap|fill|press|type|check|uncheck|selectoption)\s*\(/,
326
+ /\bkeyboard\s*\.\s*(press|type|inserttext)\s*\(/,
327
+ /\bmouse\s*\.\s*(click|dblclick|down|up|move)\s*\(/,
328
+ /\btouchscreen\s*\.\s*tap\s*\(/
329
+ ];
330
+ if (actionPatterns.some((pattern) => pattern.test(text))) return false;
331
+ const evidencePatterns = [
332
+ /\breturn\s+[{[]/,
333
+ /\breturn\s+\w+/,
334
+ /__riddleproofevidence/,
335
+ /\bproof_evidence\b/,
336
+ /\brouteexpectationsource\b/,
337
+ /\bexpectedurl\b/,
338
+ /\bassertions?\b/
339
+ ];
340
+ return !evidencePatterns.some((pattern) => pattern.test(text));
341
+ }
342
+ function setStructuredInteractionCaptureFailure(state, summary) {
343
+ const existing = typeof state.structured_interaction_capture_failure_summary === "string" ? state.structured_interaction_capture_failure_summary.trim() : "";
344
+ if (!existing) state.structured_interaction_capture_failure_summary = summary;
345
+ }
273
346
  function appendProofSummaryLine(state, line) {
274
347
  const text = String(line || "").trim();
275
348
  if (!text) return;
@@ -519,6 +592,9 @@ function proofAssessmentHardBlockersForState(state = {}) {
519
592
  }
520
593
  add(state?.structured_interaction_capture_failure_summary);
521
594
  add(state?.structured_interaction_failure_summary);
595
+ if (isInteractionVerificationMode(normalizedVerificationMode(state)) && !stateHasProofEvidence(state)) {
596
+ add("interaction proof evidence is required before ready_to_ship; proof_evidence_present=false");
597
+ }
522
598
  const mergeRecommendation = String(state?.merge_recommendation || "").trim();
523
599
  if (mergeRecommendation === "do-not-merge" && blockers.length) {
524
600
  add("merge_recommendation=do-not-merge because the proof bundle contains hard blockers.");
@@ -554,7 +630,22 @@ function stateHasAfterEvidence(state = {}) {
554
630
  const observation = objectValue(after.observation);
555
631
  const supporting = objectValue(after.supporting_artifacts);
556
632
  return Boolean(
557
- observation.valid === true && (supporting.has_structured_payload === true || supporting.proof_evidence_present === true || observation.telemetry_ready === true || Object.keys(objectValue(bundle.proof_evidence)).length > 0 || Object.keys(objectValue(after.proof_evidence)).length > 0)
633
+ observation.valid === true && (supporting.has_structured_payload === true || stateHasProofEvidence(state) || observation.telemetry_ready === true)
634
+ );
635
+ }
636
+ function stateHasProofEvidence(state = {}) {
637
+ if (state?.proof_evidence_present === true) return true;
638
+ if (state?.proof_evidence !== void 0 && state?.proof_evidence !== null) {
639
+ if (typeof state.proof_evidence !== "object") return true;
640
+ if (Object.keys(objectValue(state.proof_evidence)).length > 0) return true;
641
+ }
642
+ const bundle = objectValue(state?.evidence_bundle);
643
+ const after = objectValue(bundle.after);
644
+ const supporting = objectValue(after.supporting_artifacts);
645
+ const request = objectValue(state?.proof_assessment_request);
646
+ const structuredEvidence = objectValue(request.structured_evidence);
647
+ return Boolean(
648
+ supporting.proof_evidence_present === true || structuredEvidence.proof_evidence_present === true || Object.keys(objectValue(bundle.proof_evidence)).length > 0 || Object.keys(objectValue(after.proof_evidence)).length > 0
558
649
  );
559
650
  }
560
651
  function validateShipGate(state = {}) {
@@ -896,6 +987,7 @@ function mergeStateFromParams(statePath, params) {
896
987
  if (params.use_auth !== void 0) state.use_auth = params.use_auth ? "true" : "";
897
988
  if (params.leave_draft !== void 0) state.leave_draft = params.leave_draft ? "true" : "";
898
989
  if (params.advance_stage !== void 0) state.last_requested_advance_stage = params.advance_stage;
990
+ applyRequestedInteractionRouteContract(state);
899
991
  if (params.recon_assessment_json !== void 0) {
900
992
  const raw = normalizeOptionalString(params.recon_assessment_json) || "";
901
993
  if (!raw) {
@@ -932,6 +1024,11 @@ function mergeStateFromParams(statePath, params) {
932
1024
  state.supervisor_author_packet = parsed;
933
1025
  if (typeof parsed?.proof_plan === "string") state.proof_plan = normalizeOptionalString(parsed.proof_plan) || "";
934
1026
  if (typeof parsed?.capture_script === "string") state.capture_script = normalizeCaptureScript(parsed.capture_script);
1027
+ if (isInteractionVerificationMode(state.verification_mode) && interactionCaptureScriptLooksPassive(state.capture_script || "")) {
1028
+ const warning = "Interaction proof capture script appears passive: it does not perform a browser interaction or return structured proof evidence.";
1029
+ appendStateWarning(state, "author_warnings", warning);
1030
+ setStructuredInteractionCaptureFailure(state, warning);
1031
+ }
935
1032
  if (parsed?.baseline_understanding_used && typeof parsed.baseline_understanding_used === "object") {
936
1033
  state.author_baseline_understanding_used = parsed.baseline_understanding_used;
937
1034
  }
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createRiddleProofEngine,
3
3
  executeWorkflow
4
- } from "../chunk-KS3N5APP.js";
5
- import "../chunk-FU73I4V3.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-P2RN2NYR.js";
4
- import "../chunk-YZUVEJ5B.js";
5
- import "../chunk-FMOYUYH2.js";
6
- import "../chunk-FU73I4V3.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
  }
@@ -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-2DW2LBUD.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-FU73I4V3.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-FU73I4V3.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";