@riddledc/riddle-proof 0.8.29 → 0.8.31

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 (46) hide show
  1. package/dist/advanced/engine-harness.cjs +188 -11
  2. package/dist/advanced/engine-harness.js +2 -2
  3. package/dist/advanced/index.cjs +188 -11
  4. package/dist/advanced/index.d.cts +2 -2
  5. package/dist/advanced/index.d.ts +2 -2
  6. package/dist/advanced/index.js +4 -4
  7. package/dist/advanced/proof-run-core.cjs +3 -1
  8. package/dist/advanced/proof-run-core.d.cts +1 -1
  9. package/dist/advanced/proof-run-core.d.ts +1 -1
  10. package/dist/advanced/proof-run-core.js +1 -1
  11. package/dist/advanced/proof-run-engine.cjs +136 -2
  12. package/dist/advanced/proof-run-engine.d.cts +2 -2
  13. package/dist/advanced/proof-run-engine.d.ts +2 -2
  14. package/dist/advanced/proof-run-engine.js +2 -2
  15. package/dist/advanced/runner.js +2 -2
  16. package/dist/{chunk-3OTO7IDH.js → chunk-C2NHHBFV.js} +1 -1
  17. package/dist/{chunk-YC77HZVF.js → chunk-IOI6QR3B.js} +134 -2
  18. package/dist/{chunk-FJPZZ4JO.js → chunk-U73JPBZW.js} +1 -1
  19. package/dist/{chunk-K6HZUSHH.js → chunk-X7SQTCIQ.js} +3 -1
  20. package/dist/{chunk-AM3K5FPW.js → chunk-ZREWMTFA.js} +53 -10
  21. package/dist/cli/index.js +3 -3
  22. package/dist/cli.cjs +188 -11
  23. package/dist/cli.js +3 -3
  24. package/dist/engine-harness.cjs +188 -11
  25. package/dist/engine-harness.js +2 -2
  26. package/dist/index.cjs +188 -11
  27. package/dist/index.js +3 -3
  28. package/dist/{proof-run-core-C8FDUhle.d.cts → proof-run-core-B1GeqkR8.d.cts} +2 -0
  29. package/dist/{proof-run-core-C8FDUhle.d.ts → proof-run-core-B1GeqkR8.d.ts} +2 -0
  30. package/dist/proof-run-core.cjs +3 -1
  31. package/dist/proof-run-core.d.cts +1 -1
  32. package/dist/proof-run-core.d.ts +1 -1
  33. package/dist/proof-run-core.js +1 -1
  34. package/dist/{proof-run-engine-D80hVFMf.d.cts → proof-run-engine-4dM37pEx.d.cts} +1 -1
  35. package/dist/{proof-run-engine-By7oLsF-.d.ts → proof-run-engine-BqaeqAze.d.ts} +1 -1
  36. package/dist/proof-run-engine.cjs +136 -2
  37. package/dist/proof-run-engine.d.cts +2 -2
  38. package/dist/proof-run-engine.d.ts +2 -2
  39. package/dist/proof-run-engine.js +2 -2
  40. package/dist/runner.js +2 -2
  41. package/lib/workspace-core.mjs +62 -7
  42. package/package.json +2 -2
  43. package/runtime/lib/riddle_core_call.mjs +662 -40
  44. package/runtime/lib/util.py +117 -40
  45. package/runtime/lib/verify.py +17 -4
  46. package/runtime/tests/recon_verify_smoke.py +137 -1
package/dist/index.cjs CHANGED
@@ -157,6 +157,7 @@ function buildSetupArgs(params, config) {
157
157
  discord_thread_id: params.discord_thread_id || "",
158
158
  discord_message_id: params.discord_message_id || "",
159
159
  discord_source_url: params.discord_source_url || "",
160
+ ship_mode: params.ship_mode || "",
160
161
  leave_draft: params.leave_draft ? "true" : ""
161
162
  };
162
163
  }
@@ -746,7 +747,8 @@ function mergeStateFromParams(statePath, params) {
746
747
  "auth_headers_json",
747
748
  "proof_plan",
748
749
  "implementation_notes",
749
- "implementation_mode"
750
+ "implementation_mode",
751
+ "ship_mode"
750
752
  ];
751
753
  for (const field of stringFields) {
752
754
  if (params[field] !== void 0) {
@@ -1365,6 +1367,72 @@ function updateState(statePath, mutate) {
1365
1367
  function nowIso() {
1366
1368
  return (/* @__PURE__ */ new Date()).toISOString();
1367
1369
  }
1370
+ function missingExecutableError(error) {
1371
+ return error?.code === "ENOENT" || /\bENOENT\b/.test(String(error?.message || error || ""));
1372
+ }
1373
+ function pythonScriptsForBundledStage(step) {
1374
+ if (step === "setup") return ["preflight.py", "setup.py"];
1375
+ if (step === "recon") return ["recon.py"];
1376
+ if (step === "author") return ["author.py"];
1377
+ if (step === "implement") return ["implement.py"];
1378
+ if (step === "verify") return ["verify.py"];
1379
+ if (step === "ship") return ["ship.py"];
1380
+ return [];
1381
+ }
1382
+ function runBundledPythonStage(step, runtimeDir, env) {
1383
+ const scripts = pythonScriptsForBundledStage(step);
1384
+ if (!scripts.length) {
1385
+ return {
1386
+ ok: false,
1387
+ error: `No bundled Python fallback is defined for ${step}.`
1388
+ };
1389
+ }
1390
+ const pythonCommand = process.env.RIDDLE_PROOF_PYTHON_COMMAND || "python3";
1391
+ const libDir = import_node_path2.default.join(runtimeDir, "lib");
1392
+ const stdout = [];
1393
+ const stderr = [];
1394
+ const executed = [];
1395
+ try {
1396
+ for (const script of scripts) {
1397
+ const scriptPath = import_node_path2.default.join(libDir, script);
1398
+ if (!(0, import_node_fs2.existsSync)(scriptPath)) {
1399
+ return {
1400
+ ok: false,
1401
+ stdout: stdout.join(""),
1402
+ stderr: stderr.join(""),
1403
+ error: `Riddle Proof bundled Python fallback missing ${scriptPath}`
1404
+ };
1405
+ }
1406
+ executed.push(script);
1407
+ stdout.push((0, import_node_child_process.execFileSync)(pythonCommand, [scriptPath], {
1408
+ encoding: "utf-8",
1409
+ env,
1410
+ stdio: ["ignore", "pipe", "pipe"]
1411
+ }));
1412
+ }
1413
+ } catch (error) {
1414
+ return {
1415
+ ok: false,
1416
+ stdout: `${stdout.join("")}${String(error?.stdout || "")}`,
1417
+ stderr: `${stderr.join("")}${String(error?.stderr || "")}`,
1418
+ error: error?.message || String(error),
1419
+ raw: {
1420
+ runner: "bundled_python_fallback",
1421
+ scripts: executed
1422
+ }
1423
+ };
1424
+ }
1425
+ return {
1426
+ ok: true,
1427
+ stdout: stdout.join(""),
1428
+ stderr: stderr.join(""),
1429
+ raw: {
1430
+ ok: true,
1431
+ runner: "bundled_python_fallback",
1432
+ scripts: executed
1433
+ }
1434
+ };
1435
+ }
1368
1436
  function appendRuntimeEventToState(state, event) {
1369
1437
  const events = Array.isArray(state.runtime_events) ? state.runtime_events : [];
1370
1438
  state.runtime_events = [...events, event].slice(-RUNTIME_EVENT_LIMIT);
@@ -1931,6 +1999,17 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
1931
1999
  })
1932
2000
  );
1933
2001
  } catch (error) {
2002
+ if (!process.env.RIDDLE_PROOF_LOBSTER_SCRIPT && missingExecutableError(error)) {
2003
+ const fallback = runBundledPythonStage(step, config.riddleProofDir, env);
2004
+ return finishRuntimeStep(config.statePath, action, {
2005
+ ok: fallback.ok,
2006
+ step,
2007
+ raw: fallback.raw,
2008
+ stdout: fallback.stdout,
2009
+ stderr: fallback.stderr,
2010
+ error: fallback.error
2011
+ }, timer);
2012
+ }
1934
2013
  return finishRuntimeStep(config.statePath, action, {
1935
2014
  ok: false,
1936
2015
  step,
@@ -2684,6 +2763,60 @@ ${implementRes.stderr || ""}`;
2684
2763
  verifyRes = runOne("verify");
2685
2764
  executed.push(executedStep(verifyRes));
2686
2765
  if (!verifyRes.ok || verifyRes.haltedForApproval) {
2766
+ const failedVerifyState = readState(config.statePath);
2767
+ const failedVerifyStatus = failedVerifyState?.verify_status || "";
2768
+ if (!verifyRes.haltedForApproval && (failedVerifyStatus === "capture_incomplete" || failedVerifyStatus === "capture_error")) {
2769
+ const verifyDecisionRequest2 = failedVerifyState?.verify_decision_request || null;
2770
+ const captureQuality = verifyDecisionRequest2?.capture_quality || {};
2771
+ const conclusiveVerifyBlockers2 = proofAssessmentHardBlockersForState({
2772
+ ...failedVerifyState,
2773
+ structured_interaction_capture_failure_summary: stringValue(verifyDecisionRequest2?.structured_interaction_capture_failure_summary) || stringValue(failedVerifyState?.structured_interaction_capture_failure_summary) || void 0,
2774
+ structured_interaction_failure_summary: stringValue(verifyDecisionRequest2?.structured_interaction_failure_summary) || stringValue(failedVerifyState?.structured_interaction_failure_summary) || void 0
2775
+ });
2776
+ const structuredInteractionFailureSummary2 = stringValue(verifyDecisionRequest2?.structured_interaction_capture_failure_summary) || stringValue(verifyDecisionRequest2?.structured_interaction_failure_summary) || stringValue(failedVerifyState?.structured_interaction_capture_failure_summary) || stringValue(failedVerifyState?.structured_interaction_failure_summary) || stringValue(conclusiveVerifyBlockers2[0]);
2777
+ const captureTerminalBlocker = failedVerifyStatus === "capture_error" || conclusiveVerifyBlockers2.length > 0 || Boolean(structuredInteractionFailureSummary2) || captureQuality?.terminal_blocker === true || captureQuality?.blocking === true;
2778
+ const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ? stringValue(captureQuality?.summary) : "";
2779
+ const checkpointName = captureTerminalBlocker ? "verify_capture_blocked" : "verify_capture_retry";
2780
+ const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary2 || stringValue(verifyDecisionRequest2?.summary) || stringValue(failedVerifyState?.verify_summary) || stringValue(failedVerifyState?.proof_summary) || stringValue(verifyRes.error) || "Verify capture failed before the evidence could be judged.";
2781
+ const failedVerifyDetails = {
2782
+ executed,
2783
+ verifyStatus: failedVerifyStatus,
2784
+ verifySummary: failedVerifyState?.verify_summary || failedVerifyState?.proof_summary || null,
2785
+ afterCdn: failedVerifyState?.after_cdn || null,
2786
+ mergeRecommendation: failedVerifyState?.merge_recommendation || null,
2787
+ verifyDecisionRequest: verifyDecisionRequest2,
2788
+ conclusiveVerifyBlockers: conclusiveVerifyBlockers2,
2789
+ verifyError: verifyRes.error || null,
2790
+ verifyStdout: verifyRes.stdout || "",
2791
+ verifyStderr: verifyRes.stderr || ""
2792
+ };
2793
+ recordAttempt("verify", "checkpoint", summary, {
2794
+ autoApproved: verifyRes.autoApproved || false,
2795
+ checkpoint: checkpointName,
2796
+ error: verifyRes.error || null,
2797
+ details: failedVerifyDetails
2798
+ });
2799
+ return checkpoint(
2800
+ "verify",
2801
+ checkpointName,
2802
+ summary,
2803
+ {
2804
+ ok: true,
2805
+ nextActions: captureTerminalBlocker ? ["inspect_after_capture", "report_specific_browser_evidence_blocker", "start_a_new_run_after_the_product_or_script_is_fixed"] : ["inspect_after_capture", "continue_internal_loop_with_checkpoint", "return_to_recon_if_baseline_is_wrong"],
2806
+ advanceOptions: needsImplementation ? ["author", "implement", "ship", "verify", "recon"] : ["author", "verify", "recon"],
2807
+ recommendedAdvanceStage: captureTerminalBlocker ? null : verifyDecisionRequest2?.recommended_stage || verifyDecisionRequest2?.continue_with_stage || "author",
2808
+ continueWithStage: captureTerminalBlocker ? null : verifyDecisionRequest2?.continue_with_stage || verifyDecisionRequest2?.recommended_stage || "author",
2809
+ blocking: captureTerminalBlocker,
2810
+ details: failedVerifyDetails,
2811
+ verifyStatus: failedVerifyStatus,
2812
+ verifySummary: failedVerifyDetails.verifySummary,
2813
+ afterCdn: failedVerifyState?.after_cdn || null,
2814
+ mergeRecommendation: failedVerifyState?.merge_recommendation || null,
2815
+ verifyDecisionRequest: verifyDecisionRequest2,
2816
+ executed
2817
+ }
2818
+ );
2819
+ }
2687
2820
  return failedRun("verify", verifyRes.haltedForApproval ? "verify halted for approval" : "verify failed", verifyRes, {
2688
2821
  checkpoint: "verify_failed",
2689
2822
  details: { executed },
@@ -2737,8 +2870,9 @@ ${implementRes.stderr || ""}`;
2737
2870
  });
2738
2871
  state = readState(config.statePath);
2739
2872
  }
2873
+ const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ? stringValue(captureQuality?.summary) : "";
2740
2874
  const checkpointName = captureTerminalBlocker ? "verify_capture_blocked" : "verify_capture_retry";
2741
- const summary = structuredInteractionFailureSummary || stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2875
+ const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary || stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2742
2876
  recordAttempt("verify", "checkpoint", summary, {
2743
2877
  autoApproved: verifyRes.autoApproved || false,
2744
2878
  checkpoint: checkpointName,
@@ -5541,6 +5675,7 @@ function initialRunParams(request, input, state) {
5541
5675
  auth_headers_json: request.auth_headers_json,
5542
5676
  color_scheme: request.color_scheme,
5543
5677
  wait_for_selector: request.wait_for_selector,
5678
+ ship_mode: request.ship_mode,
5544
5679
  leave_draft: request.leave_draft || void 0,
5545
5680
  discord_channel: request.integration_context?.channel_id,
5546
5681
  discord_thread_id: request.integration_context?.thread_id,
@@ -5553,6 +5688,18 @@ function initialRunParams(request, input, state) {
5553
5688
  function effectiveShipMode(request, config) {
5554
5689
  return request.ship_mode || config?.defaultShipMode || "ship";
5555
5690
  }
5691
+ function continuationRequestsShip(next) {
5692
+ return Boolean(next && (next.advance_stage === "ship" || next.ship_after_verify === true));
5693
+ }
5694
+ function shipHeldTerminal(state, result) {
5695
+ return terminalResult(
5696
+ state,
5697
+ "ready_to_ship",
5698
+ result,
5699
+ result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.",
5700
+ { ship_held: true }
5701
+ );
5702
+ }
5556
5703
  function checkpointContinueStage2(result) {
5557
5704
  const resume = recordValue(result.checkpointContract?.resume);
5558
5705
  return nonEmptyString(resume?.continue_with_stage);
@@ -6077,6 +6224,28 @@ function checkpointResponseContinuation(state, value) {
6077
6224
  const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
6078
6225
  if (assessment) {
6079
6226
  appendCheckpointResponse(state, response);
6227
+ if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
6228
+ const result = {
6229
+ ok: true,
6230
+ state_path: state.request.engine_state_path || packet.state_path || "",
6231
+ checkpoint: packet.checkpoint,
6232
+ stage: packet.stage,
6233
+ summary: response.summary,
6234
+ checkpointContract: checkpointContractFromPacket(packet) || null
6235
+ };
6236
+ return {
6237
+ terminal: terminalResult(
6238
+ state,
6239
+ "ready_to_ship",
6240
+ result,
6241
+ response.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.",
6242
+ {
6243
+ ship_held: true,
6244
+ proof_assessment: assessment
6245
+ }
6246
+ )
6247
+ };
6248
+ }
6080
6249
  return { next: { ...base, proof_assessment_json: jsonParam(assessment) } };
6081
6250
  }
6082
6251
  if (response.decision === "blocked" || response.decision === "human_review") {
@@ -6327,6 +6496,9 @@ async function routeCheckpoint(request, state, result, agent, input) {
6327
6496
  }
6328
6497
  const next = stageCheckpointContinuation(result);
6329
6498
  if (next) {
6499
+ if (continuationRequestsShip(next) && effectiveShipMode(request, input.config) !== "ship") {
6500
+ return { terminal: shipHeldTerminal(state, result) };
6501
+ }
6330
6502
  recordEvent(state, {
6331
6503
  kind: "checkpoint.recovery_continuation",
6332
6504
  checkpoint,
@@ -6358,6 +6530,9 @@ async function routeCheckpoint(request, state, result, agent, input) {
6358
6530
  };
6359
6531
  }
6360
6532
  if (checkpoint === "ship_review") {
6533
+ if (effectiveShipMode(request, input.config) !== "ship") {
6534
+ return { terminal: shipHeldTerminal(state, result) };
6535
+ }
6361
6536
  return {
6362
6537
  terminal: terminalResult(state, "shipped", result, result.summary || "Riddle Proof shipped.")
6363
6538
  };
@@ -6393,9 +6568,7 @@ async function routeCheckpoint(request, state, result, agent, input) {
6393
6568
  return { next: { ...baseContinuation(result), ship_after_verify: true } };
6394
6569
  }
6395
6570
  return {
6396
- terminal: terminalResult(state, "ready_to_ship", result, result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.", {
6397
- ship_held: true
6398
- })
6571
+ terminal: shipHeldTerminal(state, result)
6399
6572
  };
6400
6573
  }
6401
6574
  if (checkpoint === "verify_audit_complete") {
@@ -6686,18 +6859,19 @@ async function routeCheckpoint(request, state, result, agent, input) {
6686
6859
  const next = recommendedContinuation(result) || defaultAwaitingStageContinuation(result);
6687
6860
  if (next) {
6688
6861
  if (String(next.advance_stage || "") === "ship" && effectiveShipMode(request, input.config) !== "ship") {
6689
- return {
6690
- terminal: terminalResult(state, "ready_to_ship", result, result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.", {
6691
- ship_held: true
6692
- })
6693
- };
6862
+ return { terminal: shipHeldTerminal(state, result) };
6694
6863
  }
6695
6864
  return { next };
6696
6865
  }
6697
6866
  }
6698
6867
  if (checkpoint.endsWith("_review")) {
6699
6868
  const next = recommendedContinuation(result);
6700
- if (next) return { next };
6869
+ if (next) {
6870
+ if (continuationRequestsShip(next) && effectiveShipMode(request, input.config) !== "ship") {
6871
+ return { terminal: shipHeldTerminal(state, result) };
6872
+ }
6873
+ return { next };
6874
+ }
6701
6875
  }
6702
6876
  return {
6703
6877
  blocker: {
@@ -6723,6 +6897,9 @@ async function runRiddleProofEngineHarness(input) {
6723
6897
  if (checkpointContinuation.blocker) {
6724
6898
  return blockerResult(state, null, checkpointContinuation.blocker);
6725
6899
  }
6900
+ if (checkpointContinuation.terminal) {
6901
+ return checkpointContinuation.terminal;
6902
+ }
6726
6903
  const request = state.request;
6727
6904
  const agent = input.agent || createDisabledRiddleProofAgentAdapter();
6728
6905
  const maxIterations = Math.max(
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-3OTO7IDH.js";
3
+ } from "./chunk-C2NHHBFV.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-AM3K5FPW.js";
98
+ } from "./chunk-ZREWMTFA.js";
99
99
  import {
100
100
  RIDDLE_PROOF_RUN_STATE_VERSION,
101
101
  appendRunEvent,
@@ -112,7 +112,7 @@ import {
112
112
  RIDDLE_PROOF_RUN_CARD_VERSION,
113
113
  createRiddleProofRunCard
114
114
  } from "./chunk-RDPG554T.js";
115
- import "./chunk-K6HZUSHH.js";
115
+ import "./chunk-X7SQTCIQ.js";
116
116
  import {
117
117
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
118
118
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
@@ -55,6 +55,7 @@ interface WorkflowParams {
55
55
  auto_approve?: boolean;
56
56
  continue_from_checkpoint?: boolean;
57
57
  ship_after_verify?: boolean;
58
+ ship_mode?: "none" | "ship";
58
59
  leave_draft?: boolean;
59
60
  cleanup_merged_pr?: boolean;
60
61
  fetch_base?: boolean;
@@ -148,6 +149,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
148
149
  discord_thread_id: string;
149
150
  discord_message_id: string;
150
151
  discord_source_url: string;
152
+ ship_mode: string;
151
153
  leave_draft: string;
152
154
  };
153
155
  declare function readState(statePath: string): any;
@@ -55,6 +55,7 @@ interface WorkflowParams {
55
55
  auto_approve?: boolean;
56
56
  continue_from_checkpoint?: boolean;
57
57
  ship_after_verify?: boolean;
58
+ ship_mode?: "none" | "ship";
58
59
  leave_draft?: boolean;
59
60
  cleanup_merged_pr?: boolean;
60
61
  fetch_base?: boolean;
@@ -148,6 +149,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
148
149
  discord_thread_id: string;
149
150
  discord_message_id: string;
150
151
  discord_source_url: string;
152
+ ship_mode: string;
151
153
  leave_draft: string;
152
154
  };
153
155
  declare function readState(statePath: string): any;
@@ -201,6 +201,7 @@ function buildSetupArgs(params, config) {
201
201
  discord_thread_id: params.discord_thread_id || "",
202
202
  discord_message_id: params.discord_message_id || "",
203
203
  discord_source_url: params.discord_source_url || "",
204
+ ship_mode: params.ship_mode || "",
204
205
  leave_draft: params.leave_draft ? "true" : ""
205
206
  };
206
207
  }
@@ -972,7 +973,8 @@ function mergeStateFromParams(statePath, params) {
972
973
  "auth_headers_json",
973
974
  "proof_plan",
974
975
  "implementation_notes",
975
- "implementation_mode"
976
+ "implementation_mode",
977
+ "ship_mode"
976
978
  ];
977
979
  for (const field of stringFields) {
978
980
  if (params[field] !== void 0) {
@@ -1 +1 @@
1
- export { B as BUNDLED_RIDDLE_PROOF_DIR, C as CHECKPOINT_CONTRACT_VERSION, b as CheckpointInputContract, P as PluginConfig, R as RIDDLE_PROOF_DIR_CANDIDATES, S as ShipGateValidation, c as WORKFLOW_STAGE_ORDER, d as WorkflowAction, W as WorkflowParams, a as WorkflowStage, e as buildCheckpointContract, f as buildSetupArgs, g as checkpointContinueStage, h as clearStageDecisionRequest, i as ensureAction, j as ensureStageLoopState, k as invalidateVerifyEvidence, m as mergeStateFromParams, n as noImplementationModeFor, l as previewModeFromWorkflowMode, o as proofAssessmentHardBlockersForState, q as readState, s as recordStageAttempt, t as requiredBaselineLabelsForState, r as resolveConfig, u as resolveRiddleProofDir, v as setStageDecisionRequest, w as summarizeState, x as validateShipGate, y as visualDeltaForState, z as visualDeltaRequiredForState, A as visualDeltaShipGateReason, D as workflowFile, E as writeState } from './proof-run-core-C8FDUhle.cjs';
1
+ export { B as BUNDLED_RIDDLE_PROOF_DIR, C as CHECKPOINT_CONTRACT_VERSION, b as CheckpointInputContract, P as PluginConfig, R as RIDDLE_PROOF_DIR_CANDIDATES, S as ShipGateValidation, c as WORKFLOW_STAGE_ORDER, d as WorkflowAction, W as WorkflowParams, a as WorkflowStage, e as buildCheckpointContract, f as buildSetupArgs, g as checkpointContinueStage, h as clearStageDecisionRequest, i as ensureAction, j as ensureStageLoopState, k as invalidateVerifyEvidence, m as mergeStateFromParams, n as noImplementationModeFor, l as previewModeFromWorkflowMode, o as proofAssessmentHardBlockersForState, q as readState, s as recordStageAttempt, t as requiredBaselineLabelsForState, r as resolveConfig, u as resolveRiddleProofDir, v as setStageDecisionRequest, w as summarizeState, x as validateShipGate, y as visualDeltaForState, z as visualDeltaRequiredForState, A as visualDeltaShipGateReason, D as workflowFile, E as writeState } from './proof-run-core-B1GeqkR8.cjs';
@@ -1 +1 @@
1
- export { B as BUNDLED_RIDDLE_PROOF_DIR, C as CHECKPOINT_CONTRACT_VERSION, b as CheckpointInputContract, P as PluginConfig, R as RIDDLE_PROOF_DIR_CANDIDATES, S as ShipGateValidation, c as WORKFLOW_STAGE_ORDER, d as WorkflowAction, W as WorkflowParams, a as WorkflowStage, e as buildCheckpointContract, f as buildSetupArgs, g as checkpointContinueStage, h as clearStageDecisionRequest, i as ensureAction, j as ensureStageLoopState, k as invalidateVerifyEvidence, m as mergeStateFromParams, n as noImplementationModeFor, l as previewModeFromWorkflowMode, o as proofAssessmentHardBlockersForState, q as readState, s as recordStageAttempt, t as requiredBaselineLabelsForState, r as resolveConfig, u as resolveRiddleProofDir, v as setStageDecisionRequest, w as summarizeState, x as validateShipGate, y as visualDeltaForState, z as visualDeltaRequiredForState, A as visualDeltaShipGateReason, D as workflowFile, E as writeState } from './proof-run-core-C8FDUhle.js';
1
+ export { B as BUNDLED_RIDDLE_PROOF_DIR, C as CHECKPOINT_CONTRACT_VERSION, b as CheckpointInputContract, P as PluginConfig, R as RIDDLE_PROOF_DIR_CANDIDATES, S as ShipGateValidation, c as WORKFLOW_STAGE_ORDER, d as WorkflowAction, W as WorkflowParams, a as WorkflowStage, e as buildCheckpointContract, f as buildSetupArgs, g as checkpointContinueStage, h as clearStageDecisionRequest, i as ensureAction, j as ensureStageLoopState, k as invalidateVerifyEvidence, m as mergeStateFromParams, n as noImplementationModeFor, l as previewModeFromWorkflowMode, o as proofAssessmentHardBlockersForState, q as readState, s as recordStageAttempt, t as requiredBaselineLabelsForState, r as resolveConfig, u as resolveRiddleProofDir, v as setStageDecisionRequest, w as summarizeState, x as validateShipGate, y as visualDeltaForState, z as visualDeltaRequiredForState, A as visualDeltaShipGateReason, D as workflowFile, E as writeState } from './proof-run-core-B1GeqkR8.js';
@@ -27,7 +27,7 @@ import {
27
27
  visualDeltaShipGateReason,
28
28
  workflowFile,
29
29
  writeState
30
- } from "./chunk-K6HZUSHH.js";
30
+ } from "./chunk-X7SQTCIQ.js";
31
31
  import "./chunk-MLKGABMK.js";
32
32
  export {
33
33
  BUNDLED_RIDDLE_PROOF_DIR,
@@ -1,4 +1,4 @@
1
- import { W as WorkflowParams, r as resolveConfig, P as PluginConfig, a as WorkflowStage } from './proof-run-core-C8FDUhle.cjs';
1
+ import { W as WorkflowParams, r as resolveConfig, P as PluginConfig, a as WorkflowStage } from './proof-run-core-B1GeqkR8.cjs';
2
2
 
3
3
  declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, resolvedConfig?: ReturnType<typeof resolveConfig>): Promise<{
4
4
  ok: boolean;
@@ -1,4 +1,4 @@
1
- import { W as WorkflowParams, r as resolveConfig, P as PluginConfig, a as WorkflowStage } from './proof-run-core-C8FDUhle.js';
1
+ import { W as WorkflowParams, r as resolveConfig, P as PluginConfig, a as WorkflowStage } from './proof-run-core-B1GeqkR8.js';
2
2
 
3
3
  declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, resolvedConfig?: ReturnType<typeof resolveConfig>): Promise<{
4
4
  ok: boolean;
@@ -180,6 +180,7 @@ function buildSetupArgs(params, config) {
180
180
  discord_thread_id: params.discord_thread_id || "",
181
181
  discord_message_id: params.discord_message_id || "",
182
182
  discord_source_url: params.discord_source_url || "",
183
+ ship_mode: params.ship_mode || "",
183
184
  leave_draft: params.leave_draft ? "true" : ""
184
185
  };
185
186
  }
@@ -951,7 +952,8 @@ function mergeStateFromParams(statePath, params) {
951
952
  "auth_headers_json",
952
953
  "proof_plan",
953
954
  "implementation_notes",
954
- "implementation_mode"
955
+ "implementation_mode",
956
+ "ship_mode"
955
957
  ];
956
958
  for (const field of stringFields) {
957
959
  if (params[field] !== void 0) {
@@ -1363,6 +1365,72 @@ var RUNTIME_EVENT_LIMIT = 100;
1363
1365
  function nowIso() {
1364
1366
  return (/* @__PURE__ */ new Date()).toISOString();
1365
1367
  }
1368
+ function missingExecutableError(error) {
1369
+ return error?.code === "ENOENT" || /\bENOENT\b/.test(String(error?.message || error || ""));
1370
+ }
1371
+ function pythonScriptsForBundledStage(step) {
1372
+ if (step === "setup") return ["preflight.py", "setup.py"];
1373
+ if (step === "recon") return ["recon.py"];
1374
+ if (step === "author") return ["author.py"];
1375
+ if (step === "implement") return ["implement.py"];
1376
+ if (step === "verify") return ["verify.py"];
1377
+ if (step === "ship") return ["ship.py"];
1378
+ return [];
1379
+ }
1380
+ function runBundledPythonStage(step, runtimeDir, env) {
1381
+ const scripts = pythonScriptsForBundledStage(step);
1382
+ if (!scripts.length) {
1383
+ return {
1384
+ ok: false,
1385
+ error: `No bundled Python fallback is defined for ${step}.`
1386
+ };
1387
+ }
1388
+ const pythonCommand = process.env.RIDDLE_PROOF_PYTHON_COMMAND || "python3";
1389
+ const libDir = import_node_path2.default.join(runtimeDir, "lib");
1390
+ const stdout = [];
1391
+ const stderr = [];
1392
+ const executed = [];
1393
+ try {
1394
+ for (const script of scripts) {
1395
+ const scriptPath = import_node_path2.default.join(libDir, script);
1396
+ if (!(0, import_node_fs2.existsSync)(scriptPath)) {
1397
+ return {
1398
+ ok: false,
1399
+ stdout: stdout.join(""),
1400
+ stderr: stderr.join(""),
1401
+ error: `Riddle Proof bundled Python fallback missing ${scriptPath}`
1402
+ };
1403
+ }
1404
+ executed.push(script);
1405
+ stdout.push((0, import_node_child_process.execFileSync)(pythonCommand, [scriptPath], {
1406
+ encoding: "utf-8",
1407
+ env,
1408
+ stdio: ["ignore", "pipe", "pipe"]
1409
+ }));
1410
+ }
1411
+ } catch (error) {
1412
+ return {
1413
+ ok: false,
1414
+ stdout: `${stdout.join("")}${String(error?.stdout || "")}`,
1415
+ stderr: `${stderr.join("")}${String(error?.stderr || "")}`,
1416
+ error: error?.message || String(error),
1417
+ raw: {
1418
+ runner: "bundled_python_fallback",
1419
+ scripts: executed
1420
+ }
1421
+ };
1422
+ }
1423
+ return {
1424
+ ok: true,
1425
+ stdout: stdout.join(""),
1426
+ stderr: stderr.join(""),
1427
+ raw: {
1428
+ ok: true,
1429
+ runner: "bundled_python_fallback",
1430
+ scripts: executed
1431
+ }
1432
+ };
1433
+ }
1366
1434
  function appendRuntimeEventToState(state, event) {
1367
1435
  const events = Array.isArray(state.runtime_events) ? state.runtime_events : [];
1368
1436
  state.runtime_events = [...events, event].slice(-RUNTIME_EVENT_LIMIT);
@@ -1929,6 +1997,17 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
1929
1997
  })
1930
1998
  );
1931
1999
  } catch (error) {
2000
+ if (!process.env.RIDDLE_PROOF_LOBSTER_SCRIPT && missingExecutableError(error)) {
2001
+ const fallback = runBundledPythonStage(step, config.riddleProofDir, env);
2002
+ return finishRuntimeStep(config.statePath, action, {
2003
+ ok: fallback.ok,
2004
+ step,
2005
+ raw: fallback.raw,
2006
+ stdout: fallback.stdout,
2007
+ stderr: fallback.stderr,
2008
+ error: fallback.error
2009
+ }, timer);
2010
+ }
1932
2011
  return finishRuntimeStep(config.statePath, action, {
1933
2012
  ok: false,
1934
2013
  step,
@@ -2682,6 +2761,60 @@ ${implementRes.stderr || ""}`;
2682
2761
  verifyRes = runOne("verify");
2683
2762
  executed.push(executedStep(verifyRes));
2684
2763
  if (!verifyRes.ok || verifyRes.haltedForApproval) {
2764
+ const failedVerifyState = readState(config.statePath);
2765
+ const failedVerifyStatus = failedVerifyState?.verify_status || "";
2766
+ if (!verifyRes.haltedForApproval && (failedVerifyStatus === "capture_incomplete" || failedVerifyStatus === "capture_error")) {
2767
+ const verifyDecisionRequest2 = failedVerifyState?.verify_decision_request || null;
2768
+ const captureQuality = verifyDecisionRequest2?.capture_quality || {};
2769
+ const conclusiveVerifyBlockers2 = proofAssessmentHardBlockersForState({
2770
+ ...failedVerifyState,
2771
+ structured_interaction_capture_failure_summary: stringValue(verifyDecisionRequest2?.structured_interaction_capture_failure_summary) || stringValue(failedVerifyState?.structured_interaction_capture_failure_summary) || void 0,
2772
+ structured_interaction_failure_summary: stringValue(verifyDecisionRequest2?.structured_interaction_failure_summary) || stringValue(failedVerifyState?.structured_interaction_failure_summary) || void 0
2773
+ });
2774
+ const structuredInteractionFailureSummary2 = stringValue(verifyDecisionRequest2?.structured_interaction_capture_failure_summary) || stringValue(verifyDecisionRequest2?.structured_interaction_failure_summary) || stringValue(failedVerifyState?.structured_interaction_capture_failure_summary) || stringValue(failedVerifyState?.structured_interaction_failure_summary) || stringValue(conclusiveVerifyBlockers2[0]);
2775
+ const captureTerminalBlocker = failedVerifyStatus === "capture_error" || conclusiveVerifyBlockers2.length > 0 || Boolean(structuredInteractionFailureSummary2) || captureQuality?.terminal_blocker === true || captureQuality?.blocking === true;
2776
+ const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ? stringValue(captureQuality?.summary) : "";
2777
+ const checkpointName = captureTerminalBlocker ? "verify_capture_blocked" : "verify_capture_retry";
2778
+ const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary2 || stringValue(verifyDecisionRequest2?.summary) || stringValue(failedVerifyState?.verify_summary) || stringValue(failedVerifyState?.proof_summary) || stringValue(verifyRes.error) || "Verify capture failed before the evidence could be judged.";
2779
+ const failedVerifyDetails = {
2780
+ executed,
2781
+ verifyStatus: failedVerifyStatus,
2782
+ verifySummary: failedVerifyState?.verify_summary || failedVerifyState?.proof_summary || null,
2783
+ afterCdn: failedVerifyState?.after_cdn || null,
2784
+ mergeRecommendation: failedVerifyState?.merge_recommendation || null,
2785
+ verifyDecisionRequest: verifyDecisionRequest2,
2786
+ conclusiveVerifyBlockers: conclusiveVerifyBlockers2,
2787
+ verifyError: verifyRes.error || null,
2788
+ verifyStdout: verifyRes.stdout || "",
2789
+ verifyStderr: verifyRes.stderr || ""
2790
+ };
2791
+ recordAttempt("verify", "checkpoint", summary, {
2792
+ autoApproved: verifyRes.autoApproved || false,
2793
+ checkpoint: checkpointName,
2794
+ error: verifyRes.error || null,
2795
+ details: failedVerifyDetails
2796
+ });
2797
+ return checkpoint(
2798
+ "verify",
2799
+ checkpointName,
2800
+ summary,
2801
+ {
2802
+ ok: true,
2803
+ nextActions: captureTerminalBlocker ? ["inspect_after_capture", "report_specific_browser_evidence_blocker", "start_a_new_run_after_the_product_or_script_is_fixed"] : ["inspect_after_capture", "continue_internal_loop_with_checkpoint", "return_to_recon_if_baseline_is_wrong"],
2804
+ advanceOptions: needsImplementation ? ["author", "implement", "ship", "verify", "recon"] : ["author", "verify", "recon"],
2805
+ recommendedAdvanceStage: captureTerminalBlocker ? null : verifyDecisionRequest2?.recommended_stage || verifyDecisionRequest2?.continue_with_stage || "author",
2806
+ continueWithStage: captureTerminalBlocker ? null : verifyDecisionRequest2?.continue_with_stage || verifyDecisionRequest2?.recommended_stage || "author",
2807
+ blocking: captureTerminalBlocker,
2808
+ details: failedVerifyDetails,
2809
+ verifyStatus: failedVerifyStatus,
2810
+ verifySummary: failedVerifyDetails.verifySummary,
2811
+ afterCdn: failedVerifyState?.after_cdn || null,
2812
+ mergeRecommendation: failedVerifyState?.merge_recommendation || null,
2813
+ verifyDecisionRequest: verifyDecisionRequest2,
2814
+ executed
2815
+ }
2816
+ );
2817
+ }
2685
2818
  return failedRun("verify", verifyRes.haltedForApproval ? "verify halted for approval" : "verify failed", verifyRes, {
2686
2819
  checkpoint: "verify_failed",
2687
2820
  details: { executed },
@@ -2735,8 +2868,9 @@ ${implementRes.stderr || ""}`;
2735
2868
  });
2736
2869
  state = readState(config.statePath);
2737
2870
  }
2871
+ const terminalCaptureQualitySummary = captureQuality?.terminal_blocker === true || captureQuality?.blocking === true ? stringValue(captureQuality?.summary) : "";
2738
2872
  const checkpointName = captureTerminalBlocker ? "verify_capture_blocked" : "verify_capture_retry";
2739
- const summary = structuredInteractionFailureSummary || stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2873
+ const summary = terminalCaptureQualitySummary || structuredInteractionFailureSummary || stringValue(proofAssessment.summary) || "Verify ran, but the proof packet still needs internal capture-plan work before it should ship.";
2740
2874
  recordAttempt("verify", "checkpoint", summary, {
2741
2875
  autoApproved: verifyRes.autoApproved || false,
2742
2876
  checkpoint: checkpointName,
@@ -1,2 +1,2 @@
1
- import './proof-run-core-C8FDUhle.cjs';
2
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-D80hVFMf.cjs';
1
+ import './proof-run-core-B1GeqkR8.cjs';
2
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-4dM37pEx.cjs';
@@ -1,2 +1,2 @@
1
- import './proof-run-core-C8FDUhle.js';
2
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-By7oLsF-.js';
1
+ import './proof-run-core-B1GeqkR8.js';
2
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-BqaeqAze.js';
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  createRiddleProofEngine,
3
3
  executeWorkflow
4
- } from "./chunk-YC77HZVF.js";
5
- import "./chunk-K6HZUSHH.js";
4
+ } from "./chunk-IOI6QR3B.js";
5
+ import "./chunk-X7SQTCIQ.js";
6
6
  import "./chunk-MLKGABMK.js";
7
7
  export {
8
8
  createRiddleProofEngine,
package/dist/runner.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-3OTO7IDH.js";
3
+ } from "./chunk-C2NHHBFV.js";
4
4
  import "./chunk-ZQWVXQKJ.js";
5
5
  import "./chunk-RDPG554T.js";
6
- import "./chunk-K6HZUSHH.js";
6
+ import "./chunk-X7SQTCIQ.js";
7
7
  import "./chunk-OILKSY5J.js";
8
8
  import "./chunk-VY4Y5U57.js";
9
9
  import "./chunk-MLKGABMK.js";