@riddledc/riddle-proof 0.8.30 → 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 +132 -10
  2. package/dist/advanced/engine-harness.js +2 -2
  3. package/dist/advanced/index.cjs +132 -10
  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 +80 -1
  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-32RE64IO.js → chunk-IOI6QR3B.js} +78 -1
  18. package/dist/{chunk-XJA2GDVN.js → chunk-U73JPBZW.js} +1 -1
  19. package/dist/{chunk-K6HZUSHH.js → chunk-X7SQTCIQ.js} +3 -1
  20. package/dist/{chunk-UWO4YR7I.js → chunk-ZREWMTFA.js} +53 -10
  21. package/dist/cli/index.js +3 -3
  22. package/dist/cli.cjs +132 -10
  23. package/dist/cli.js +3 -3
  24. package/dist/engine-harness.cjs +132 -10
  25. package/dist/engine-harness.js +2 -2
  26. package/dist/index.cjs +132 -10
  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 +80 -1
  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 +4 -3
  46. package/runtime/tests/recon_verify_smoke.py +132 -0
@@ -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,
@@ -4849,6 +4928,7 @@ function initialRunParams(request, input, state) {
4849
4928
  auth_headers_json: request.auth_headers_json,
4850
4929
  color_scheme: request.color_scheme,
4851
4930
  wait_for_selector: request.wait_for_selector,
4931
+ ship_mode: request.ship_mode,
4852
4932
  leave_draft: request.leave_draft || void 0,
4853
4933
  discord_channel: request.integration_context?.channel_id,
4854
4934
  discord_thread_id: request.integration_context?.thread_id,
@@ -4861,6 +4941,18 @@ function initialRunParams(request, input, state) {
4861
4941
  function effectiveShipMode(request, config) {
4862
4942
  return request.ship_mode || config?.defaultShipMode || "ship";
4863
4943
  }
4944
+ function continuationRequestsShip(next) {
4945
+ return Boolean(next && (next.advance_stage === "ship" || next.ship_after_verify === true));
4946
+ }
4947
+ function shipHeldTerminal(state, result) {
4948
+ return terminalResult(
4949
+ state,
4950
+ "ready_to_ship",
4951
+ result,
4952
+ result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.",
4953
+ { ship_held: true }
4954
+ );
4955
+ }
4864
4956
  function checkpointContinueStage2(result) {
4865
4957
  const resume = recordValue(result.checkpointContract?.resume);
4866
4958
  return nonEmptyString(resume?.continue_with_stage);
@@ -5385,6 +5477,28 @@ function checkpointResponseContinuation(state, value) {
5385
5477
  const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
5386
5478
  if (assessment) {
5387
5479
  appendCheckpointResponse(state, response);
5480
+ if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
5481
+ const result = {
5482
+ ok: true,
5483
+ state_path: state.request.engine_state_path || packet.state_path || "",
5484
+ checkpoint: packet.checkpoint,
5485
+ stage: packet.stage,
5486
+ summary: response.summary,
5487
+ checkpointContract: checkpointContractFromPacket(packet) || null
5488
+ };
5489
+ return {
5490
+ terminal: terminalResult(
5491
+ state,
5492
+ "ready_to_ship",
5493
+ result,
5494
+ response.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.",
5495
+ {
5496
+ ship_held: true,
5497
+ proof_assessment: assessment
5498
+ }
5499
+ )
5500
+ };
5501
+ }
5388
5502
  return { next: { ...base, proof_assessment_json: jsonParam(assessment) } };
5389
5503
  }
5390
5504
  if (response.decision === "blocked" || response.decision === "human_review") {
@@ -5635,6 +5749,9 @@ async function routeCheckpoint(request, state, result, agent, input) {
5635
5749
  }
5636
5750
  const next = stageCheckpointContinuation(result);
5637
5751
  if (next) {
5752
+ if (continuationRequestsShip(next) && effectiveShipMode(request, input.config) !== "ship") {
5753
+ return { terminal: shipHeldTerminal(state, result) };
5754
+ }
5638
5755
  recordEvent(state, {
5639
5756
  kind: "checkpoint.recovery_continuation",
5640
5757
  checkpoint,
@@ -5666,6 +5783,9 @@ async function routeCheckpoint(request, state, result, agent, input) {
5666
5783
  };
5667
5784
  }
5668
5785
  if (checkpoint === "ship_review") {
5786
+ if (effectiveShipMode(request, input.config) !== "ship") {
5787
+ return { terminal: shipHeldTerminal(state, result) };
5788
+ }
5669
5789
  return {
5670
5790
  terminal: terminalResult(state, "shipped", result, result.summary || "Riddle Proof shipped.")
5671
5791
  };
@@ -5701,9 +5821,7 @@ async function routeCheckpoint(request, state, result, agent, input) {
5701
5821
  return { next: { ...baseContinuation(result), ship_after_verify: true } };
5702
5822
  }
5703
5823
  return {
5704
- terminal: terminalResult(state, "ready_to_ship", result, result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.", {
5705
- ship_held: true
5706
- })
5824
+ terminal: shipHeldTerminal(state, result)
5707
5825
  };
5708
5826
  }
5709
5827
  if (checkpoint === "verify_audit_complete") {
@@ -5994,18 +6112,19 @@ async function routeCheckpoint(request, state, result, agent, input) {
5994
6112
  const next = recommendedContinuation(result) || defaultAwaitingStageContinuation(result);
5995
6113
  if (next) {
5996
6114
  if (String(next.advance_stage || "") === "ship" && effectiveShipMode(request, input.config) !== "ship") {
5997
- return {
5998
- terminal: terminalResult(state, "ready_to_ship", result, result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.", {
5999
- ship_held: true
6000
- })
6001
- };
6115
+ return { terminal: shipHeldTerminal(state, result) };
6002
6116
  }
6003
6117
  return { next };
6004
6118
  }
6005
6119
  }
6006
6120
  if (checkpoint.endsWith("_review")) {
6007
6121
  const next = recommendedContinuation(result);
6008
- if (next) return { next };
6122
+ if (next) {
6123
+ if (continuationRequestsShip(next) && effectiveShipMode(request, input.config) !== "ship") {
6124
+ return { terminal: shipHeldTerminal(state, result) };
6125
+ }
6126
+ return { next };
6127
+ }
6009
6128
  }
6010
6129
  return {
6011
6130
  blocker: {
@@ -6031,6 +6150,9 @@ async function runRiddleProofEngineHarness(input) {
6031
6150
  if (checkpointContinuation.blocker) {
6032
6151
  return blockerResult(state, null, checkpointContinuation.blocker);
6033
6152
  }
6153
+ if (checkpointContinuation.terminal) {
6154
+ return checkpointContinuation.terminal;
6155
+ }
6034
6156
  const request = state.request;
6035
6157
  const agent = input.agent || createDisabledRiddleProofAgentAdapter();
6036
6158
  const maxIterations = Math.max(
@@ -2,10 +2,10 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "../chunk-UWO4YR7I.js";
5
+ } from "../chunk-ZREWMTFA.js";
6
6
  import "../chunk-ZQWVXQKJ.js";
7
7
  import "../chunk-RDPG554T.js";
8
- import "../chunk-K6HZUSHH.js";
8
+ import "../chunk-X7SQTCIQ.js";
9
9
  import "../chunk-OILKSY5J.js";
10
10
  import "../chunk-VY4Y5U57.js";
11
11
  import "../chunk-MLKGABMK.js";
@@ -188,6 +188,7 @@ function buildSetupArgs(params, config) {
188
188
  discord_thread_id: params.discord_thread_id || "",
189
189
  discord_message_id: params.discord_message_id || "",
190
190
  discord_source_url: params.discord_source_url || "",
191
+ ship_mode: params.ship_mode || "",
191
192
  leave_draft: params.leave_draft ? "true" : ""
192
193
  };
193
194
  }
@@ -777,7 +778,8 @@ function mergeStateFromParams(statePath, params) {
777
778
  "auth_headers_json",
778
779
  "proof_plan",
779
780
  "implementation_notes",
780
- "implementation_mode"
781
+ "implementation_mode",
782
+ "ship_mode"
781
783
  ];
782
784
  for (const field of stringFields) {
783
785
  if (params[field] !== void 0) {
@@ -1396,6 +1398,72 @@ function updateState(statePath, mutate) {
1396
1398
  function nowIso() {
1397
1399
  return (/* @__PURE__ */ new Date()).toISOString();
1398
1400
  }
1401
+ function missingExecutableError(error) {
1402
+ return error?.code === "ENOENT" || /\bENOENT\b/.test(String(error?.message || error || ""));
1403
+ }
1404
+ function pythonScriptsForBundledStage(step) {
1405
+ if (step === "setup") return ["preflight.py", "setup.py"];
1406
+ if (step === "recon") return ["recon.py"];
1407
+ if (step === "author") return ["author.py"];
1408
+ if (step === "implement") return ["implement.py"];
1409
+ if (step === "verify") return ["verify.py"];
1410
+ if (step === "ship") return ["ship.py"];
1411
+ return [];
1412
+ }
1413
+ function runBundledPythonStage(step, runtimeDir, env) {
1414
+ const scripts = pythonScriptsForBundledStage(step);
1415
+ if (!scripts.length) {
1416
+ return {
1417
+ ok: false,
1418
+ error: `No bundled Python fallback is defined for ${step}.`
1419
+ };
1420
+ }
1421
+ const pythonCommand = process.env.RIDDLE_PROOF_PYTHON_COMMAND || "python3";
1422
+ const libDir = import_node_path2.default.join(runtimeDir, "lib");
1423
+ const stdout = [];
1424
+ const stderr = [];
1425
+ const executed = [];
1426
+ try {
1427
+ for (const script of scripts) {
1428
+ const scriptPath = import_node_path2.default.join(libDir, script);
1429
+ if (!(0, import_node_fs2.existsSync)(scriptPath)) {
1430
+ return {
1431
+ ok: false,
1432
+ stdout: stdout.join(""),
1433
+ stderr: stderr.join(""),
1434
+ error: `Riddle Proof bundled Python fallback missing ${scriptPath}`
1435
+ };
1436
+ }
1437
+ executed.push(script);
1438
+ stdout.push((0, import_node_child_process.execFileSync)(pythonCommand, [scriptPath], {
1439
+ encoding: "utf-8",
1440
+ env,
1441
+ stdio: ["ignore", "pipe", "pipe"]
1442
+ }));
1443
+ }
1444
+ } catch (error) {
1445
+ return {
1446
+ ok: false,
1447
+ stdout: `${stdout.join("")}${String(error?.stdout || "")}`,
1448
+ stderr: `${stderr.join("")}${String(error?.stderr || "")}`,
1449
+ error: error?.message || String(error),
1450
+ raw: {
1451
+ runner: "bundled_python_fallback",
1452
+ scripts: executed
1453
+ }
1454
+ };
1455
+ }
1456
+ return {
1457
+ ok: true,
1458
+ stdout: stdout.join(""),
1459
+ stderr: stderr.join(""),
1460
+ raw: {
1461
+ ok: true,
1462
+ runner: "bundled_python_fallback",
1463
+ scripts: executed
1464
+ }
1465
+ };
1466
+ }
1399
1467
  function appendRuntimeEventToState(state, event) {
1400
1468
  const events = Array.isArray(state.runtime_events) ? state.runtime_events : [];
1401
1469
  state.runtime_events = [...events, event].slice(-RUNTIME_EVENT_LIMIT);
@@ -1962,6 +2030,17 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
1962
2030
  })
1963
2031
  );
1964
2032
  } catch (error) {
2033
+ if (!process.env.RIDDLE_PROOF_LOBSTER_SCRIPT && missingExecutableError(error)) {
2034
+ const fallback = runBundledPythonStage(step, config.riddleProofDir, env);
2035
+ return finishRuntimeStep(config.statePath, action, {
2036
+ ok: fallback.ok,
2037
+ step,
2038
+ raw: fallback.raw,
2039
+ stdout: fallback.stdout,
2040
+ stderr: fallback.stderr,
2041
+ error: fallback.error
2042
+ }, timer);
2043
+ }
1965
2044
  return finishRuntimeStep(config.statePath, action, {
1966
2045
  ok: false,
1967
2046
  step,
@@ -5386,6 +5465,7 @@ function initialRunParams(request, input, state) {
5386
5465
  auth_headers_json: request.auth_headers_json,
5387
5466
  color_scheme: request.color_scheme,
5388
5467
  wait_for_selector: request.wait_for_selector,
5468
+ ship_mode: request.ship_mode,
5389
5469
  leave_draft: request.leave_draft || void 0,
5390
5470
  discord_channel: request.integration_context?.channel_id,
5391
5471
  discord_thread_id: request.integration_context?.thread_id,
@@ -5398,6 +5478,18 @@ function initialRunParams(request, input, state) {
5398
5478
  function effectiveShipMode(request, config) {
5399
5479
  return request.ship_mode || config?.defaultShipMode || "ship";
5400
5480
  }
5481
+ function continuationRequestsShip(next) {
5482
+ return Boolean(next && (next.advance_stage === "ship" || next.ship_after_verify === true));
5483
+ }
5484
+ function shipHeldTerminal(state, result) {
5485
+ return terminalResult(
5486
+ state,
5487
+ "ready_to_ship",
5488
+ result,
5489
+ result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.",
5490
+ { ship_held: true }
5491
+ );
5492
+ }
5401
5493
  function checkpointContinueStage2(result) {
5402
5494
  const resume = recordValue(result.checkpointContract?.resume);
5403
5495
  return nonEmptyString(resume?.continue_with_stage);
@@ -5922,6 +6014,28 @@ function checkpointResponseContinuation(state, value) {
5922
6014
  const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
5923
6015
  if (assessment) {
5924
6016
  appendCheckpointResponse(state, response);
6017
+ if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
6018
+ const result = {
6019
+ ok: true,
6020
+ state_path: state.request.engine_state_path || packet.state_path || "",
6021
+ checkpoint: packet.checkpoint,
6022
+ stage: packet.stage,
6023
+ summary: response.summary,
6024
+ checkpointContract: checkpointContractFromPacket(packet) || null
6025
+ };
6026
+ return {
6027
+ terminal: terminalResult(
6028
+ state,
6029
+ "ready_to_ship",
6030
+ result,
6031
+ response.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.",
6032
+ {
6033
+ ship_held: true,
6034
+ proof_assessment: assessment
6035
+ }
6036
+ )
6037
+ };
6038
+ }
5925
6039
  return { next: { ...base, proof_assessment_json: jsonParam(assessment) } };
5926
6040
  }
5927
6041
  if (response.decision === "blocked" || response.decision === "human_review") {
@@ -6172,6 +6286,9 @@ async function routeCheckpoint(request, state, result, agent, input) {
6172
6286
  }
6173
6287
  const next = stageCheckpointContinuation(result);
6174
6288
  if (next) {
6289
+ if (continuationRequestsShip(next) && effectiveShipMode(request, input.config) !== "ship") {
6290
+ return { terminal: shipHeldTerminal(state, result) };
6291
+ }
6175
6292
  recordEvent(state, {
6176
6293
  kind: "checkpoint.recovery_continuation",
6177
6294
  checkpoint,
@@ -6203,6 +6320,9 @@ async function routeCheckpoint(request, state, result, agent, input) {
6203
6320
  };
6204
6321
  }
6205
6322
  if (checkpoint === "ship_review") {
6323
+ if (effectiveShipMode(request, input.config) !== "ship") {
6324
+ return { terminal: shipHeldTerminal(state, result) };
6325
+ }
6206
6326
  return {
6207
6327
  terminal: terminalResult(state, "shipped", result, result.summary || "Riddle Proof shipped.")
6208
6328
  };
@@ -6238,9 +6358,7 @@ async function routeCheckpoint(request, state, result, agent, input) {
6238
6358
  return { next: { ...baseContinuation(result), ship_after_verify: true } };
6239
6359
  }
6240
6360
  return {
6241
- terminal: terminalResult(state, "ready_to_ship", result, result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.", {
6242
- ship_held: true
6243
- })
6361
+ terminal: shipHeldTerminal(state, result)
6244
6362
  };
6245
6363
  }
6246
6364
  if (checkpoint === "verify_audit_complete") {
@@ -6531,18 +6649,19 @@ async function routeCheckpoint(request, state, result, agent, input) {
6531
6649
  const next = recommendedContinuation(result) || defaultAwaitingStageContinuation(result);
6532
6650
  if (next) {
6533
6651
  if (String(next.advance_stage || "") === "ship" && effectiveShipMode(request, input.config) !== "ship") {
6534
- return {
6535
- terminal: terminalResult(state, "ready_to_ship", result, result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.", {
6536
- ship_held: true
6537
- })
6538
- };
6652
+ return { terminal: shipHeldTerminal(state, result) };
6539
6653
  }
6540
6654
  return { next };
6541
6655
  }
6542
6656
  }
6543
6657
  if (checkpoint.endsWith("_review")) {
6544
6658
  const next = recommendedContinuation(result);
6545
- if (next) return { next };
6659
+ if (next) {
6660
+ if (continuationRequestsShip(next) && effectiveShipMode(request, input.config) !== "ship") {
6661
+ return { terminal: shipHeldTerminal(state, result) };
6662
+ }
6663
+ return { next };
6664
+ }
6546
6665
  }
6547
6666
  return {
6548
6667
  blocker: {
@@ -6568,6 +6687,9 @@ async function runRiddleProofEngineHarness(input) {
6568
6687
  if (checkpointContinuation.blocker) {
6569
6688
  return blockerResult(state, null, checkpointContinuation.blocker);
6570
6689
  }
6690
+ if (checkpointContinuation.terminal) {
6691
+ return checkpointContinuation.terminal;
6692
+ }
6571
6693
  const request = state.request;
6572
6694
  const agent = input.agent || createDisabledRiddleProofAgentAdapter();
6573
6695
  const maxIterations = Math.max(
@@ -1,5 +1,5 @@
1
1
  export { b as runner } from '../runner-4LJ5z0D-.cjs';
2
2
  export { l as engineHarness } from '../engine-harness-LBfqbFSe.cjs';
3
- export { p as proofRunCore } from '../proof-run-core-C8FDUhle.cjs';
4
- export { p as proofRunEngine } from '../proof-run-engine-D80hVFMf.cjs';
3
+ export { p as proofRunCore } from '../proof-run-core-B1GeqkR8.cjs';
4
+ export { p as proofRunEngine } from '../proof-run-engine-4dM37pEx.cjs';
5
5
  import '../types.cjs';
@@ -1,5 +1,5 @@
1
1
  export { b as runner } from '../runner-BdQpOkZD.js';
2
2
  export { l as engineHarness } from '../engine-harness-CMACHP6A.js';
3
- export { p as proofRunCore } from '../proof-run-core-C8FDUhle.js';
4
- export { p as proofRunEngine } from '../proof-run-engine-By7oLsF-.js';
3
+ export { p as proofRunCore } from '../proof-run-core-B1GeqkR8.js';
4
+ export { p as proofRunEngine } from '../proof-run-engine-BqaeqAze.js';
5
5
  import '../types.js';
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  proof_run_engine_exports
3
- } from "../chunk-32RE64IO.js";
3
+ } from "../chunk-IOI6QR3B.js";
4
4
  import {
5
5
  runner_exports
6
- } from "../chunk-3OTO7IDH.js";
6
+ } from "../chunk-C2NHHBFV.js";
7
7
  import {
8
8
  engine_harness_exports
9
- } from "../chunk-UWO4YR7I.js";
9
+ } from "../chunk-ZREWMTFA.js";
10
10
  import "../chunk-ZQWVXQKJ.js";
11
11
  import "../chunk-RDPG554T.js";
12
12
  import {
13
13
  proof_run_core_exports
14
- } from "../chunk-K6HZUSHH.js";
14
+ } from "../chunk-X7SQTCIQ.js";
15
15
  import "../chunk-OILKSY5J.js";
16
16
  import "../chunk-VY4Y5U57.js";
17
17
  import "../chunk-MLKGABMK.js";
@@ -203,6 +203,7 @@ function buildSetupArgs(params, config) {
203
203
  discord_thread_id: params.discord_thread_id || "",
204
204
  discord_message_id: params.discord_message_id || "",
205
205
  discord_source_url: params.discord_source_url || "",
206
+ ship_mode: params.ship_mode || "",
206
207
  leave_draft: params.leave_draft ? "true" : ""
207
208
  };
208
209
  }
@@ -974,7 +975,8 @@ function mergeStateFromParams(statePath, params) {
974
975
  "auth_headers_json",
975
976
  "proof_plan",
976
977
  "implementation_notes",
977
- "implementation_mode"
978
+ "implementation_mode",
979
+ "ship_mode"
978
980
  ];
979
981
  for (const field of stringFields) {
980
982
  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,
@@ -182,6 +182,7 @@ function buildSetupArgs(params, config) {
182
182
  discord_thread_id: params.discord_thread_id || "",
183
183
  discord_message_id: params.discord_message_id || "",
184
184
  discord_source_url: params.discord_source_url || "",
185
+ ship_mode: params.ship_mode || "",
185
186
  leave_draft: params.leave_draft ? "true" : ""
186
187
  };
187
188
  }
@@ -953,7 +954,8 @@ function mergeStateFromParams(statePath, params) {
953
954
  "auth_headers_json",
954
955
  "proof_plan",
955
956
  "implementation_notes",
956
- "implementation_mode"
957
+ "implementation_mode",
958
+ "ship_mode"
957
959
  ];
958
960
  for (const field of stringFields) {
959
961
  if (params[field] !== void 0) {
@@ -1365,6 +1367,72 @@ var RUNTIME_EVENT_LIMIT = 100;
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,
@@ -1,2 +1,2 @@
1
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-D80hVFMf.cjs';
2
- import '../proof-run-core-C8FDUhle.cjs';
1
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-4dM37pEx.cjs';
2
+ import '../proof-run-core-B1GeqkR8.cjs';
@@ -1,2 +1,2 @@
1
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-By7oLsF-.js';
2
- import '../proof-run-core-C8FDUhle.js';
1
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from '../proof-run-engine-BqaeqAze.js';
2
+ import '../proof-run-core-B1GeqkR8.js';