@riddledc/riddle-proof 0.7.0 → 0.7.2

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.
@@ -92,6 +92,9 @@ function normalizeRunParams(input) {
92
92
  context: input.context,
93
93
  reviewer: input.reviewer,
94
94
  mode: input.mode,
95
+ implementation_mode: input.implementation_mode,
96
+ require_diff: input.require_diff,
97
+ allow_code_changes: input.allow_code_changes,
95
98
  build_command: input.build_command,
96
99
  build_output: input.build_output,
97
100
  server_image: input.server_image,
@@ -4,6 +4,25 @@ import { randomUUID } from "crypto";
4
4
  import path from "path";
5
5
  import { fileURLToPath } from "url";
6
6
  var WORKFLOW_STAGE_ORDER = ["setup", "recon", "author", "implement", "verify", "ship"];
7
+ function normalizedMode(value) {
8
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
9
+ }
10
+ function previewModeFromWorkflowMode(value) {
11
+ const mode = normalizedMode(value);
12
+ return mode === "server" || mode === "static" ? mode : void 0;
13
+ }
14
+ function noImplementationModeInput(value) {
15
+ return value && typeof value === "object" ? value : {};
16
+ }
17
+ function noImplementationModeFor(params, state) {
18
+ const input = noImplementationModeInput(params);
19
+ const stateInput = noImplementationModeInput(state);
20
+ const mode = normalizedMode(input.mode ?? input.workflow_mode ?? stateInput.mode ?? stateInput.workflow_mode);
21
+ const implementationMode = normalizedMode(input.implementation_mode ?? stateInput.implementation_mode);
22
+ const requireDiff = input.require_diff ?? stateInput.require_diff;
23
+ const allowCodeChanges = input.allow_code_changes ?? stateInput.allow_code_changes;
24
+ return mode === "audit" || mode === "profile" || implementationMode === "none" || requireDiff === false || allowCodeChanges === false;
25
+ }
7
26
  var CHECKPOINT_CONTRACT_VERSION = "riddle-proof-run.checkpoint.v1";
8
27
  function currentDistDir() {
9
28
  const meta = typeof import.meta === "object" ? import.meta : {};
@@ -96,7 +115,7 @@ function buildSetupArgs(params, config) {
96
115
  allow_static_preview_fallback: params.allow_static_preview_fallback ? "true" : "",
97
116
  context: params.context || "",
98
117
  reviewer: params.reviewer || config.defaultReviewer,
99
- mode: params.mode || "",
118
+ mode: previewModeFromWorkflowMode(params.mode) || "",
100
119
  build_command: params.build_command || "npm run build",
101
120
  build_output: params.build_output || "build",
102
121
  server_image: params.server_image || "node:20-slim",
@@ -699,7 +718,8 @@ function mergeStateFromParams(statePath, params) {
699
718
  "auth_cookies_json",
700
719
  "auth_headers_json",
701
720
  "proof_plan",
702
- "implementation_notes"
721
+ "implementation_notes",
722
+ "implementation_mode"
703
723
  ];
704
724
  for (const field of stringFields) {
705
725
  if (params[field] !== void 0) {
@@ -714,7 +734,17 @@ function mergeStateFromParams(statePath, params) {
714
734
  if (issues.length) state.implementation_environment_issues = issues;
715
735
  }
716
736
  if (params.reference !== void 0) state.reference = params.reference;
717
- if (params.mode !== void 0) state.mode = params.mode;
737
+ if (params.mode !== void 0) {
738
+ const previewMode = previewModeFromWorkflowMode(params.mode);
739
+ if (previewMode) {
740
+ state.mode = previewMode;
741
+ } else {
742
+ state.workflow_mode = normalizeOptionalString(params.mode);
743
+ }
744
+ }
745
+ if (params.implementation_mode !== void 0) state.implementation_mode = normalizeOptionalString(params.implementation_mode);
746
+ if (params.require_diff !== void 0) state.require_diff = params.require_diff;
747
+ if (params.allow_code_changes !== void 0) state.allow_code_changes = params.allow_code_changes;
718
748
  if (params.allow_static_preview_fallback !== void 0) {
719
749
  state.allow_static_preview_fallback = params.allow_static_preview_fallback;
720
750
  }
@@ -859,6 +889,11 @@ function summarizeState(state) {
859
889
  repo: state.repo || null,
860
890
  branch: state.branch || null,
861
891
  mode: state.mode || null,
892
+ workflow_mode: state.workflow_mode || null,
893
+ implementation_mode: state.implementation_mode || null,
894
+ require_diff: state.require_diff ?? null,
895
+ allow_code_changes: state.allow_code_changes ?? null,
896
+ no_implementation_mode: noImplementationModeFor(state),
862
897
  reference: state.reference || null,
863
898
  before_ref: state.before_ref || null,
864
899
  allow_static_preview_fallback: Boolean(state.allow_static_preview_fallback),
@@ -945,6 +980,8 @@ function summarizeState(state) {
945
980
 
946
981
  export {
947
982
  WORKFLOW_STAGE_ORDER,
983
+ previewModeFromWorkflowMode,
984
+ noImplementationModeFor,
948
985
  CHECKPOINT_CONTRACT_VERSION,
949
986
  BUNDLED_RIDDLE_PROOF_DIR,
950
987
  RIDDLE_PROOF_DIR_CANDIDATES,
@@ -3,7 +3,10 @@ import {
3
3
  appendStageHeartbeat,
4
4
  createRunState,
5
5
  setRunStatus
6
- } from "./chunk-MO24D3PY.js";
6
+ } from "./chunk-4DM3OTWH.js";
7
+ import {
8
+ noImplementationModeFor
9
+ } from "./chunk-FPD2RF3Q.js";
7
10
  import {
8
11
  createRunResult
9
12
  } from "./chunk-DUFDZJOF.js";
@@ -208,6 +211,7 @@ async function runRiddleProof(input) {
208
211
  }
209
212
  }
210
213
  const changeRequest = state.request.change_request?.trim();
214
+ const noImplementationMode = noImplementationModeFor(state.request);
211
215
  if (!changeRequest) {
212
216
  return blockRun({
213
217
  state,
@@ -215,14 +219,14 @@ async function runRiddleProof(input) {
215
219
  blocker: adapterBlocker("change_request_required", "A change request is required before implementation.", "request_invalid")
216
220
  });
217
221
  }
218
- if (!workdir) {
222
+ if (!noImplementationMode && !workdir) {
219
223
  return blockRun({
220
224
  state,
221
225
  stage: "setup",
222
226
  blocker: adapterBlocker("workdir_not_configured", "A workdir or setup adapter result is required before implementation.", "setup_required")
223
227
  });
224
228
  }
225
- if (!adapters.implementation) {
229
+ if (!noImplementationMode && !adapters.implementation) {
226
230
  return blockRun({
227
231
  state,
228
232
  stage: "implement",
@@ -248,57 +252,68 @@ async function runRiddleProof(input) {
248
252
  let assessment;
249
253
  for (let attempt = 0; attempt < maxIterations; attempt += 1) {
250
254
  state.iterations += 1;
251
- appendStageHeartbeat(state, {
252
- stage: "implement",
253
- summary: "Implementation stage is active.",
254
- details: { iteration: state.iterations }
255
- });
256
- appendRunEvent(state, {
257
- kind: "implementation.started",
258
- checkpoint: "implementation_started",
259
- stage: "implement",
260
- summary: "Implementation adapter started.",
261
- details: { iteration: state.iterations }
262
- });
263
- try {
264
- implementation = await adapters.implementation.implement({
265
- workdir,
266
- change_request: changeRequest,
267
- evidence_context: evidenceContext,
268
- state
255
+ if (noImplementationMode) {
256
+ state.implementation_status = "not_required";
257
+ appendRunEvent(state, {
258
+ kind: "implementation.skipped",
259
+ checkpoint: "implementation_not_required",
260
+ stage: "implement",
261
+ summary: "Implementation stage skipped because audit/no-diff mode disables code changes.",
262
+ details: { iteration: state.iterations }
269
263
  });
270
- } catch (error) {
271
- return blockRun({
272
- state,
264
+ } else {
265
+ appendStageHeartbeat(state, {
273
266
  stage: "implement",
274
- blocker: adapterBlocker("implementation_exception", "The implementation adapter threw an exception.", "implementation_failed", errorDetails(error)),
275
- evidence_bundle: evidenceBundle
267
+ summary: "Implementation stage is active.",
268
+ details: { iteration: state.iterations }
276
269
  });
277
- }
278
- if (!implementation.ok) {
279
- return blockRun({
280
- state,
270
+ appendRunEvent(state, {
271
+ kind: "implementation.started",
272
+ checkpoint: "implementation_started",
281
273
  stage: "implement",
282
- blocker: adapterBlocker(
283
- "implementation_failed",
284
- "The implementation adapter did not complete successfully.",
285
- "implementation_failed",
286
- { blockers: implementation.blockers }
287
- ),
288
- evidence_bundle: evidenceBundle,
289
- raw: { implementation }
274
+ summary: "Implementation adapter started.",
275
+ details: { iteration: state.iterations }
290
276
  });
291
- }
292
- appendRunEvent(state, {
293
- kind: "implementation.completed",
294
- checkpoint: "implementation_completed",
295
- stage: "implement",
296
- summary: "Implementation adapter completed.",
297
- details: {
298
- changed_files: implementation.changed_files,
299
- tests_run: implementation.tests_run
277
+ try {
278
+ implementation = await adapters.implementation.implement({
279
+ workdir,
280
+ change_request: changeRequest,
281
+ evidence_context: evidenceContext,
282
+ state
283
+ });
284
+ } catch (error) {
285
+ return blockRun({
286
+ state,
287
+ stage: "implement",
288
+ blocker: adapterBlocker("implementation_exception", "The implementation adapter threw an exception.", "implementation_failed", errorDetails(error)),
289
+ evidence_bundle: evidenceBundle
290
+ });
300
291
  }
301
- });
292
+ if (!implementation.ok) {
293
+ return blockRun({
294
+ state,
295
+ stage: "implement",
296
+ blocker: adapterBlocker(
297
+ "implementation_failed",
298
+ "The implementation adapter did not complete successfully.",
299
+ "implementation_failed",
300
+ { blockers: implementation.blockers }
301
+ ),
302
+ evidence_bundle: evidenceBundle,
303
+ raw: { implementation }
304
+ });
305
+ }
306
+ appendRunEvent(state, {
307
+ kind: "implementation.completed",
308
+ checkpoint: "implementation_completed",
309
+ stage: "implement",
310
+ summary: "Implementation adapter completed.",
311
+ details: {
312
+ changed_files: implementation.changed_files,
313
+ tests_run: implementation.tests_run
314
+ }
315
+ });
316
+ }
302
317
  appendStageHeartbeat(state, {
303
318
  stage: "prove",
304
319
  summary: "Proof capture stage is active.",
@@ -5,15 +5,16 @@ import {
5
5
  createRunStatusSnapshot,
6
6
  normalizeRunParams,
7
7
  setRunStatus
8
- } from "./chunk-MO24D3PY.js";
8
+ } from "./chunk-4DM3OTWH.js";
9
9
  import {
10
10
  createRiddleProofRunCard
11
11
  } from "./chunk-3UHWI3FO.js";
12
12
  import {
13
+ noImplementationModeFor,
13
14
  visualDeltaForState,
14
15
  visualDeltaRequiredForState,
15
16
  visualDeltaShipGateReason
16
- } from "./chunk-RFJ5BQF6.js";
17
+ } from "./chunk-FPD2RF3Q.js";
17
18
  import {
18
19
  authorPacketPayloadFromCheckpointResponse,
19
20
  buildCheckpointPacketForEngineResult,
@@ -223,7 +224,7 @@ function stageFromWorkflowParams(params) {
223
224
  if (params.ship_after_verify) return "ship";
224
225
  if (params.proof_assessment_json) return "verify";
225
226
  if (params.implementation_notes) return "verify";
226
- if (params.author_packet_json) return "implement";
227
+ if (params.author_packet_json) return noImplementationModeFor(params) ? "verify" : "implement";
227
228
  if (params.recon_assessment_json) return "author";
228
229
  return "setup";
229
230
  }
@@ -253,6 +254,9 @@ function initialRunParams(request, input, state) {
253
254
  context: request.context,
254
255
  reviewer: request.reviewer,
255
256
  mode: request.mode,
257
+ implementation_mode: request.implementation_mode,
258
+ require_diff: request.require_diff,
259
+ allow_code_changes: request.allow_code_changes,
256
260
  build_command: request.build_command,
257
261
  build_output: request.build_output,
258
262
  server_image: request.server_image,
package/dist/cli.cjs CHANGED
@@ -31,6 +31,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  ));
32
32
 
33
33
  // src/proof-run-core.ts
34
+ function normalizedMode(value) {
35
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
36
+ }
37
+ function previewModeFromWorkflowMode(value) {
38
+ const mode = normalizedMode(value);
39
+ return mode === "server" || mode === "static" ? mode : void 0;
40
+ }
41
+ function noImplementationModeInput(value) {
42
+ return value && typeof value === "object" ? value : {};
43
+ }
44
+ function noImplementationModeFor(params, state) {
45
+ const input = noImplementationModeInput(params);
46
+ const stateInput = noImplementationModeInput(state);
47
+ const mode = normalizedMode(input.mode ?? input.workflow_mode ?? stateInput.mode ?? stateInput.workflow_mode);
48
+ const implementationMode = normalizedMode(input.implementation_mode ?? stateInput.implementation_mode);
49
+ const requireDiff = input.require_diff ?? stateInput.require_diff;
50
+ const allowCodeChanges = input.allow_code_changes ?? stateInput.allow_code_changes;
51
+ return mode === "audit" || mode === "profile" || implementationMode === "none" || requireDiff === false || allowCodeChanges === false;
52
+ }
34
53
  function currentDistDir() {
35
54
  const meta = typeof import_meta === "object" ? import_meta : {};
36
55
  if (typeof meta.url === "string" && meta.url) {
@@ -114,7 +133,7 @@ function buildSetupArgs(params, config) {
114
133
  allow_static_preview_fallback: params.allow_static_preview_fallback ? "true" : "",
115
134
  context: params.context || "",
116
135
  reviewer: params.reviewer || config.defaultReviewer,
117
- mode: params.mode || "",
136
+ mode: previewModeFromWorkflowMode(params.mode) || "",
118
137
  build_command: params.build_command || "npm run build",
119
138
  build_output: params.build_output || "build",
120
139
  server_image: params.server_image || "node:20-slim",
@@ -539,7 +558,8 @@ function mergeStateFromParams(statePath, params) {
539
558
  "auth_cookies_json",
540
559
  "auth_headers_json",
541
560
  "proof_plan",
542
- "implementation_notes"
561
+ "implementation_notes",
562
+ "implementation_mode"
543
563
  ];
544
564
  for (const field of stringFields) {
545
565
  if (params[field] !== void 0) {
@@ -554,7 +574,17 @@ function mergeStateFromParams(statePath, params) {
554
574
  if (issues.length) state.implementation_environment_issues = issues;
555
575
  }
556
576
  if (params.reference !== void 0) state.reference = params.reference;
557
- if (params.mode !== void 0) state.mode = params.mode;
577
+ if (params.mode !== void 0) {
578
+ const previewMode = previewModeFromWorkflowMode(params.mode);
579
+ if (previewMode) {
580
+ state.mode = previewMode;
581
+ } else {
582
+ state.workflow_mode = normalizeOptionalString(params.mode);
583
+ }
584
+ }
585
+ if (params.implementation_mode !== void 0) state.implementation_mode = normalizeOptionalString(params.implementation_mode);
586
+ if (params.require_diff !== void 0) state.require_diff = params.require_diff;
587
+ if (params.allow_code_changes !== void 0) state.allow_code_changes = params.allow_code_changes;
558
588
  if (params.allow_static_preview_fallback !== void 0) {
559
589
  state.allow_static_preview_fallback = params.allow_static_preview_fallback;
560
590
  }
@@ -699,6 +729,11 @@ function summarizeState(state) {
699
729
  repo: state.repo || null,
700
730
  branch: state.branch || null,
701
731
  mode: state.mode || null,
732
+ workflow_mode: state.workflow_mode || null,
733
+ implementation_mode: state.implementation_mode || null,
734
+ require_diff: state.require_diff ?? null,
735
+ allow_code_changes: state.allow_code_changes ?? null,
736
+ no_implementation_mode: noImplementationModeFor(state),
702
737
  reference: state.reference || null,
703
738
  before_ref: state.before_ref || null,
704
739
  allow_static_preview_fallback: Boolean(state.allow_static_preview_fallback),
@@ -997,8 +1032,11 @@ function authorReady(state) {
997
1032
  function implementationReady(state) {
998
1033
  return ["changes_detected", "completed"].includes(state?.implementation_status || "");
999
1034
  }
1000
- function stageAfterAuthor(state) {
1001
- return implementationReady(state) ? "verify" : "implement";
1035
+ function implementationRequired(params, state) {
1036
+ return !noImplementationModeFor(params, state);
1037
+ }
1038
+ function stageAfterAuthor(state, params) {
1039
+ return implementationReady(state) || !implementationRequired(params, state) ? "verify" : "implement";
1002
1040
  }
1003
1041
  function latestReconAttempt(state) {
1004
1042
  const history = Array.isArray(state?.recon_results?.attempt_history) ? state.recon_results.attempt_history : [];
@@ -1208,7 +1246,7 @@ function recommendedAdvanceStage(state) {
1208
1246
  if (!state?.workspace_ready) return "setup";
1209
1247
  if (!state?.recon_results || ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "")) return "recon";
1210
1248
  if (!authorReady(state)) return "author";
1211
- if (!implementationReady(state)) return "implement";
1249
+ if (!implementationReady(state) && !noImplementationModeFor(state)) return "implement";
1212
1250
  if (state?.verify_status === "capture_incomplete") return verifyAssessment(state).continueWithStage || verifyAssessment(state).recommendedStage || "author";
1213
1251
  if (state?.verify_status === "evidence_captured") return verifyAssessment(state).continueWithStage || verifyAssessment(state).recommendedStage;
1214
1252
  if (!(state?.after_cdn || "").trim()) return "verify";
@@ -1833,6 +1871,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
1833
1871
  checkpoint: params.advance_stage === "setup" ? "setup_review" : null,
1834
1872
  autoApproved: setupRes.autoApproved || false
1835
1873
  });
1874
+ mergeStateFromParams(config.statePath, params);
1836
1875
  state = readState(config.statePath);
1837
1876
  if (params.advance_stage === "setup") {
1838
1877
  return checkpoint(
@@ -2130,7 +2169,8 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
2130
2169
  }
2131
2170
  );
2132
2171
  }
2133
- const authorNextStage = stageAfterAuthor(state);
2172
+ const noImplementationMode = !implementationRequired(params, state);
2173
+ const authorNextStage = stageAfterAuthor(state, params);
2134
2174
  const explicitAuthorDebug = params.advance_stage === "author";
2135
2175
  recordAttempt("author", "completed", "Author applied the supervising agent's proof packet to recon observations.", {
2136
2176
  autoApproved: authorRes.autoApproved || false,
@@ -2148,7 +2188,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
2148
2188
  return checkpoint(
2149
2189
  "author",
2150
2190
  "author_review",
2151
- authorNextStage === "verify" ? "Author applied the supervising agent's proof packet. Because implementation is already recorded, you can continue straight into verify." : "Author applied the supervising agent's proof packet. Inspect it if needed, then continue into implement.",
2191
+ authorNextStage === "verify" ? noImplementationMode ? "Author applied the supervising agent's proof packet. Audit/no-diff mode disables implementation, so you can continue straight into verify." : "Author applied the supervising agent's proof packet. Because implementation is already recorded, you can continue straight into verify." : "Author applied the supervising agent's proof packet. Inspect it if needed, then continue into implement.",
2152
2192
  {
2153
2193
  nextActions: authorNextStage === "verify" ? ["inspect_proof_packet", "advance_run_to_verify", "rerun_author"] : ["inspect_proof_packet", "advance_run_to_implement", "rerun_author"],
2154
2194
  advanceOptions: authorNextStage === "verify" ? ["author", "verify", "recon"] : ["author", "implement", "recon"],
@@ -2181,13 +2221,14 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
2181
2221
  }
2182
2222
  if (!effectiveAdvanceStage) {
2183
2223
  const recommended = recommendedAdvanceStage(state);
2224
+ const noImplementationMode = !implementationRequired(params, state);
2184
2225
  return checkpoint(
2185
- recommended || "implement",
2226
+ recommended || (noImplementationMode ? "verify" : "implement"),
2186
2227
  "awaiting_stage_advance",
2187
2228
  "Proof authoring is ready. The wrapper will not guess the next stage from here, explicitly choose whether to revisit recon/author, validate implementation, capture verify evidence, or ship.",
2188
2229
  {
2189
2230
  nextActions: ["inspect_state", "set_advance_stage", "resume_run"],
2190
- advanceOptions: ["recon", "author", "implement", "verify", "ship"],
2231
+ advanceOptions: noImplementationMode ? ["recon", "author", "verify", "ship"] : ["recon", "author", "implement", "verify", "ship"],
2191
2232
  recommendedAdvanceStage: recommended,
2192
2233
  details: { executed },
2193
2234
  executed
@@ -2195,6 +2236,26 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
2195
2236
  );
2196
2237
  }
2197
2238
  if (effectiveAdvanceStage === "implement") {
2239
+ if (!implementationRequired(params, state)) {
2240
+ recordAttempt("implement", "checkpoint", "Implementation stage was skipped because audit/no-diff mode disables code changes.", {
2241
+ checkpoint: "implement_disabled_for_audit",
2242
+ details: { executed }
2243
+ });
2244
+ return checkpoint(
2245
+ "verify",
2246
+ "implement_disabled_for_audit",
2247
+ "Audit/no-diff mode disables implementation. Continue to verify against the existing target; do not launch an implementation agent or require a git diff.",
2248
+ {
2249
+ nextActions: ["advance_run_to_verify", "inspect_author_packet", "rerun_recon_if_target_changed"],
2250
+ advanceOptions: ["verify", "author", "recon"],
2251
+ recommendedAdvanceStage: "verify",
2252
+ continueWithStage: "verify",
2253
+ blocking: false,
2254
+ details: { executed },
2255
+ executed
2256
+ }
2257
+ );
2258
+ }
2198
2259
  const implementRes = runOne("implement");
2199
2260
  executed.push(executedStep(implementRes));
2200
2261
  if (implementRes.haltedForApproval) {
@@ -2285,7 +2346,8 @@ ${implementRes.stderr || ""}`;
2285
2346
  }
2286
2347
  if (effectiveAdvanceStage === "verify") {
2287
2348
  state = readState(config.statePath);
2288
- if (!["changes_detected", "completed"].includes(state?.implementation_status || "")) {
2349
+ const needsImplementation = implementationRequired(params, state);
2350
+ if (needsImplementation && !implementationReady(state)) {
2289
2351
  return checkpoint(
2290
2352
  "implement",
2291
2353
  "implement_required",
@@ -2302,6 +2364,18 @@ ${implementRes.stderr || ""}`;
2302
2364
  }
2303
2365
  );
2304
2366
  }
2367
+ if (!needsImplementation && !implementationReady(state)) {
2368
+ recordAttempt("implement", "completed", "Implementation stage is not required for this audit/no-diff run.", {
2369
+ checkpoint: "implementation_not_required",
2370
+ details: { executed }
2371
+ });
2372
+ state = updateState(config.statePath, (currentState) => {
2373
+ currentState.implementation_status = "not_required";
2374
+ currentState.implementation_mode = currentState.implementation_mode || "none";
2375
+ if (currentState.require_diff === void 0) currentState.require_diff = false;
2376
+ if (currentState.allow_code_changes === void 0) currentState.allow_code_changes = false;
2377
+ });
2378
+ }
2305
2379
  const hasIncomingProofAssessment = typeof params.proof_assessment_json === "string" && params.proof_assessment_json.trim().length > 0;
2306
2380
  const canReuseVerifyEvidence = (params.advance_stage !== "verify" || hasIncomingProofAssessment) && state?.verify_status === "evidence_captured" && Boolean((state?.after_cdn || "").trim()) && (state?.active_checkpoint === "verify_supervisor_judgment" || hasSupervisorProofAssessment(state));
2307
2381
  let verifyRes = { ok: true, step: "verify", reusedEvidence: canReuseVerifyEvidence };
@@ -2324,8 +2398,13 @@ ${implementRes.stderr || ""}`;
2324
2398
  const verifySummary = state?.verify_summary || state?.proof_summary || null;
2325
2399
  const proofAssessment = verifyAssessment(state);
2326
2400
  const convergenceSignals = nonConvergenceSignals(state, proofAssessment);
2327
- const verifyRecommendedStage = proofAssessment.recommendedStage || null;
2328
- const verifyContinueWithStage = shouldEscalateVerifyToHuman(state, proofAssessment) ? null : proofAssessment.continueWithStage || verifyRecommendedStage || null;
2401
+ const rawVerifyRecommendedStage = proofAssessment.recommendedStage || null;
2402
+ const verifyRecommendedStage = !needsImplementation && rawVerifyRecommendedStage === "implement" ? "verify" : rawVerifyRecommendedStage;
2403
+ const rawVerifyContinueWithStage = shouldEscalateVerifyToHuman(state, proofAssessment) ? null : proofAssessment.continueWithStage || verifyRecommendedStage || null;
2404
+ const verifyContinueWithStage = !needsImplementation && rawVerifyContinueWithStage === "implement" ? "verify" : rawVerifyContinueWithStage;
2405
+ const verifyLoopAdvanceOptions = needsImplementation ? ["author", "verify", "implement", "recon"] : ["author", "verify", "recon"];
2406
+ const verifyReviewAdvanceOptions = needsImplementation ? ["verify", "author", "implement", "recon", "ship"] : ["verify", "author", "recon"];
2407
+ const verifyRetryAdvanceOptions = needsImplementation ? ["author", "implement", "ship", "verify", "recon"] : ["author", "verify", "recon"];
2329
2408
  const verifyDetails = {
2330
2409
  executed,
2331
2410
  verifyStatus,
@@ -2363,7 +2442,7 @@ ${implementRes.stderr || ""}`;
2363
2442
  {
2364
2443
  ok: true,
2365
2444
  nextActions: ["inspect_after_capture", "continue_internal_loop_with_checkpoint", "return_to_recon_if_baseline_is_wrong"],
2366
- advanceOptions: ["author", "verify", "implement", "recon"],
2445
+ advanceOptions: verifyLoopAdvanceOptions,
2367
2446
  recommendedAdvanceStage: verifyRecommendedStage || "author",
2368
2447
  continueWithStage: verifyContinueWithStage || "author",
2369
2448
  blocking: false,
@@ -2391,7 +2470,7 @@ ${implementRes.stderr || ""}`;
2391
2470
  summary,
2392
2471
  {
2393
2472
  nextActions: ["inspect_evidence", "author_proof_assessment_json", "continue_internal_loop_with_checkpoint"],
2394
- advanceOptions: ["verify", "author", "implement", "recon", "ship"],
2473
+ advanceOptions: verifyReviewAdvanceOptions,
2395
2474
  recommendedAdvanceStage: "verify",
2396
2475
  continueWithStage: "verify",
2397
2476
  blocking: false,
@@ -2421,7 +2500,7 @@ ${implementRes.stderr || ""}`;
2421
2500
  {
2422
2501
  ok: false,
2423
2502
  nextActions: ["inspect_retry_history", "summarize_internal_loop", "ask_human_for_direction"],
2424
- advanceOptions: ["author", "implement", "ship", "verify", "recon"],
2503
+ advanceOptions: verifyRetryAdvanceOptions,
2425
2504
  recommendedAdvanceStage: null,
2426
2505
  continueWithStage: null,
2427
2506
  blocking: true,
@@ -2436,7 +2515,7 @@ ${implementRes.stderr || ""}`;
2436
2515
  }
2437
2516
  );
2438
2517
  }
2439
- const shouldAutoShip = verifyContinueWithStage === "ship" && (params.ship_after_verify || params.continue_from_checkpoint || params.advance_stage !== "verify");
2518
+ const shouldAutoShip = verifyContinueWithStage === "ship" && needsImplementation && (params.ship_after_verify || params.continue_from_checkpoint || params.advance_stage !== "verify");
2440
2519
  if (shouldAutoShip) {
2441
2520
  const shipGate = validateShipGate(state);
2442
2521
  if (!shipGate.ok) {
@@ -2494,6 +2573,33 @@ ${implementRes.stderr || ""}`;
2494
2573
  };
2495
2574
  }
2496
2575
  if (proofAssessment.decision === "ready_to_ship") {
2576
+ if (!needsImplementation) {
2577
+ recordAttempt("verify", "completed", "Verify captured a proof packet for audit/no-diff mode; shipping remains disabled.", {
2578
+ autoApproved: verifyRes.autoApproved || false,
2579
+ checkpoint: "verify_audit_complete",
2580
+ details: verifyDetails
2581
+ });
2582
+ return checkpoint(
2583
+ "verify",
2584
+ "verify_audit_complete",
2585
+ "The supervising agent judged the audit proof sufficient. Audit/no-diff mode disables ship, PR creation, implementation agents, and git-diff requirements.",
2586
+ {
2587
+ nextActions: ["inspect_evidence", "report_audit_result", "rerun_verify_if_needed"],
2588
+ advanceOptions: ["verify", "author", "recon"],
2589
+ recommendedAdvanceStage: "verify",
2590
+ continueWithStage: null,
2591
+ blocking: false,
2592
+ details: verifyDetails,
2593
+ verifyStatus,
2594
+ verifySummary,
2595
+ afterCdn: state?.after_cdn || null,
2596
+ mergeRecommendation: state?.merge_recommendation || null,
2597
+ verifyDecisionRequest,
2598
+ proofAssessment: proofAssessment.raw,
2599
+ executed
2600
+ }
2601
+ );
2602
+ }
2497
2603
  const shipGate = validateShipGate(state);
2498
2604
  if (!shipGate.ok) {
2499
2605
  recordAttempt("verify", "checkpoint", "Verify cannot mark ship ready because the hard ship gate is missing required evidence or approval.", {
@@ -2550,8 +2656,8 @@ ${implementRes.stderr || ""}`;
2550
2656
  unresolvedSummary,
2551
2657
  {
2552
2658
  ok: true,
2553
- nextActions: convergenceSignals.warning ? ["inspect_retry_history", "decide_whether_to_keep_iterating_or_escalate", "continue_internal_loop_with_checkpoint"] : ["inspect_proof_assessment", "continue_internal_loop_with_checkpoint", "return_to_implement_if_fix_failed"],
2554
- advanceOptions: ["author", "implement", "ship", "verify", "recon"],
2659
+ nextActions: convergenceSignals.warning ? ["inspect_retry_history", "decide_whether_to_keep_iterating_or_escalate", "continue_internal_loop_with_checkpoint"] : needsImplementation ? ["inspect_proof_assessment", "continue_internal_loop_with_checkpoint", "return_to_implement_if_fix_failed"] : ["inspect_proof_assessment", "continue_internal_loop_with_checkpoint", "rerun_author_if_proof_contract_is_wrong"],
2660
+ advanceOptions: verifyRetryAdvanceOptions,
2555
2661
  recommendedAdvanceStage: verifyRecommendedStage,
2556
2662
  continueWithStage: verifyContinueWithStage,
2557
2663
  blocking: false,
@@ -2568,6 +2674,23 @@ ${implementRes.stderr || ""}`;
2568
2674
  }
2569
2675
  if (effectiveAdvanceStage === "ship") {
2570
2676
  state = readState(config.statePath);
2677
+ if (!implementationRequired(params, state)) {
2678
+ return checkpoint(
2679
+ "verify",
2680
+ "ship_disabled_for_audit",
2681
+ "Audit/no-diff mode disables ship and PR creation. Report the audit result from verify evidence instead.",
2682
+ {
2683
+ ok: false,
2684
+ nextActions: ["inspect_verify_state", "report_audit_result"],
2685
+ advanceOptions: ["verify", "author", "recon"],
2686
+ recommendedAdvanceStage: "verify",
2687
+ continueWithStage: "verify",
2688
+ blocking: true,
2689
+ details: { executed },
2690
+ executed
2691
+ }
2692
+ );
2693
+ }
2571
2694
  const shipAssessment = verifyAssessment(state);
2572
2695
  const shipGate = validateShipGate(state);
2573
2696
  if (state?.verify_status !== "evidence_captured") {
@@ -3968,6 +4091,9 @@ function normalizeRunParams(input) {
3968
4091
  context: input.context,
3969
4092
  reviewer: input.reviewer,
3970
4093
  mode: input.mode,
4094
+ implementation_mode: input.implementation_mode,
4095
+ require_diff: input.require_diff,
4096
+ allow_code_changes: input.allow_code_changes,
3971
4097
  build_command: input.build_command,
3972
4098
  build_output: input.build_output,
3973
4099
  server_image: input.server_image,
@@ -4281,7 +4407,7 @@ function stageFromWorkflowParams(params) {
4281
4407
  if (params.ship_after_verify) return "ship";
4282
4408
  if (params.proof_assessment_json) return "verify";
4283
4409
  if (params.implementation_notes) return "verify";
4284
- if (params.author_packet_json) return "implement";
4410
+ if (params.author_packet_json) return noImplementationModeFor(params) ? "verify" : "implement";
4285
4411
  if (params.recon_assessment_json) return "author";
4286
4412
  return "setup";
4287
4413
  }
@@ -4311,6 +4437,9 @@ function initialRunParams(request, input, state) {
4311
4437
  context: request.context,
4312
4438
  reviewer: request.reviewer,
4313
4439
  mode: request.mode,
4440
+ implementation_mode: request.implementation_mode,
4441
+ require_diff: request.require_diff,
4442
+ allow_code_changes: request.allow_code_changes,
4314
4443
  build_command: request.build_command,
4315
4444
  build_output: request.build_output,
4316
4445
  server_image: request.server_image,
package/dist/cli.js CHANGED
@@ -18,10 +18,10 @@ import {
18
18
  createDisabledRiddleProofAgentAdapter,
19
19
  readRiddleProofRunStatus,
20
20
  runRiddleProofEngineHarness
21
- } from "./chunk-D3M2FAYQ.js";
22
- import "./chunk-MO24D3PY.js";
21
+ } from "./chunk-N5BVCRKI.js";
22
+ import "./chunk-4DM3OTWH.js";
23
23
  import "./chunk-3UHWI3FO.js";
24
- import "./chunk-RFJ5BQF6.js";
24
+ import "./chunk-FPD2RF3Q.js";
25
25
  import {
26
26
  createCheckpointResponseTemplate
27
27
  } from "./chunk-33XO42CY.js";