@riddledc/riddle-proof 0.7.0 → 0.7.1

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.
@@ -42,6 +42,8 @@ __export(proof_run_core_exports, {
42
42
  ensureStageLoopState: () => ensureStageLoopState,
43
43
  invalidateVerifyEvidence: () => invalidateVerifyEvidence,
44
44
  mergeStateFromParams: () => mergeStateFromParams,
45
+ noImplementationModeFor: () => noImplementationModeFor,
46
+ previewModeFromWorkflowMode: () => previewModeFromWorkflowMode,
45
47
  readState: () => readState,
46
48
  recordStageAttempt: () => recordStageAttempt,
47
49
  requiredBaselineLabelsForState: () => requiredBaselineLabelsForState,
@@ -63,6 +65,25 @@ var import_node_path = __toESM(require("path"), 1);
63
65
  var import_node_url = require("url");
64
66
  var import_meta = {};
65
67
  var WORKFLOW_STAGE_ORDER = ["setup", "recon", "author", "implement", "verify", "ship"];
68
+ function normalizedMode(value) {
69
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
70
+ }
71
+ function previewModeFromWorkflowMode(value) {
72
+ const mode = normalizedMode(value);
73
+ return mode === "server" || mode === "static" ? mode : void 0;
74
+ }
75
+ function noImplementationModeInput(value) {
76
+ return value && typeof value === "object" ? value : {};
77
+ }
78
+ function noImplementationModeFor(params, state) {
79
+ const input = noImplementationModeInput(params);
80
+ const stateInput = noImplementationModeInput(state);
81
+ const mode = normalizedMode(input.mode ?? input.workflow_mode ?? stateInput.mode ?? stateInput.workflow_mode);
82
+ const implementationMode = normalizedMode(input.implementation_mode ?? stateInput.implementation_mode);
83
+ const requireDiff = input.require_diff ?? stateInput.require_diff;
84
+ const allowCodeChanges = input.allow_code_changes ?? stateInput.allow_code_changes;
85
+ return mode === "audit" || mode === "profile" || implementationMode === "none" || requireDiff === false || allowCodeChanges === false;
86
+ }
66
87
  var CHECKPOINT_CONTRACT_VERSION = "riddle-proof-run.checkpoint.v1";
67
88
  function currentDistDir() {
68
89
  const meta = typeof import_meta === "object" ? import_meta : {};
@@ -155,7 +176,7 @@ function buildSetupArgs(params, config) {
155
176
  allow_static_preview_fallback: params.allow_static_preview_fallback ? "true" : "",
156
177
  context: params.context || "",
157
178
  reviewer: params.reviewer || config.defaultReviewer,
158
- mode: params.mode || "",
179
+ mode: previewModeFromWorkflowMode(params.mode) || "",
159
180
  build_command: params.build_command || "npm run build",
160
181
  build_output: params.build_output || "build",
161
182
  server_image: params.server_image || "node:20-slim",
@@ -758,7 +779,8 @@ function mergeStateFromParams(statePath, params) {
758
779
  "auth_cookies_json",
759
780
  "auth_headers_json",
760
781
  "proof_plan",
761
- "implementation_notes"
782
+ "implementation_notes",
783
+ "implementation_mode"
762
784
  ];
763
785
  for (const field of stringFields) {
764
786
  if (params[field] !== void 0) {
@@ -773,7 +795,17 @@ function mergeStateFromParams(statePath, params) {
773
795
  if (issues.length) state.implementation_environment_issues = issues;
774
796
  }
775
797
  if (params.reference !== void 0) state.reference = params.reference;
776
- if (params.mode !== void 0) state.mode = params.mode;
798
+ if (params.mode !== void 0) {
799
+ const previewMode = previewModeFromWorkflowMode(params.mode);
800
+ if (previewMode) {
801
+ state.mode = previewMode;
802
+ } else {
803
+ state.workflow_mode = normalizeOptionalString(params.mode);
804
+ }
805
+ }
806
+ if (params.implementation_mode !== void 0) state.implementation_mode = normalizeOptionalString(params.implementation_mode);
807
+ if (params.require_diff !== void 0) state.require_diff = params.require_diff;
808
+ if (params.allow_code_changes !== void 0) state.allow_code_changes = params.allow_code_changes;
777
809
  if (params.allow_static_preview_fallback !== void 0) {
778
810
  state.allow_static_preview_fallback = params.allow_static_preview_fallback;
779
811
  }
@@ -918,6 +950,11 @@ function summarizeState(state) {
918
950
  repo: state.repo || null,
919
951
  branch: state.branch || null,
920
952
  mode: state.mode || null,
953
+ workflow_mode: state.workflow_mode || null,
954
+ implementation_mode: state.implementation_mode || null,
955
+ require_diff: state.require_diff ?? null,
956
+ allow_code_changes: state.allow_code_changes ?? null,
957
+ no_implementation_mode: noImplementationModeFor(state),
921
958
  reference: state.reference || null,
922
959
  before_ref: state.before_ref || null,
923
960
  allow_static_preview_fallback: Boolean(state.allow_static_preview_fallback),
@@ -1015,6 +1052,8 @@ function summarizeState(state) {
1015
1052
  ensureStageLoopState,
1016
1053
  invalidateVerifyEvidence,
1017
1054
  mergeStateFromParams,
1055
+ noImplementationModeFor,
1056
+ previewModeFromWorkflowMode,
1018
1057
  readState,
1019
1058
  recordStageAttempt,
1020
1059
  requiredBaselineLabelsForState,
@@ -26,7 +26,10 @@ interface WorkflowParams {
26
26
  allow_static_preview_fallback?: boolean;
27
27
  context?: string;
28
28
  reviewer?: string;
29
- mode?: "server" | "static";
29
+ mode?: "server" | "static" | "audit" | (string & {});
30
+ implementation_mode?: "change" | "none" | (string & {});
31
+ require_diff?: boolean;
32
+ allow_code_changes?: boolean;
30
33
  build_command?: string;
31
34
  build_output?: string;
32
35
  server_image?: string;
@@ -58,6 +61,8 @@ interface WorkflowParams {
58
61
  update_base_checkout?: boolean;
59
62
  advance_stage?: WorkflowStage;
60
63
  }
64
+ declare function previewModeFromWorkflowMode(value: unknown): "server" | "static" | undefined;
65
+ declare function noImplementationModeFor(params?: unknown, state?: unknown): boolean;
61
66
  interface PluginConfig {
62
67
  riddleProofDir?: string;
63
68
  statePath?: string;
@@ -115,7 +120,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
115
120
  target_image_hash: string;
116
121
  viewport_matrix_json: string;
117
122
  deterministic_setup_json: string;
118
- reference: "before" | "prod" | "both";
123
+ reference: "prod" | "before" | "both";
119
124
  base_branch: string;
120
125
  before_ref: string;
121
126
  allow_static_preview_fallback: string;
@@ -238,6 +243,11 @@ declare function summarizeState(state: any): {
238
243
  repo: any;
239
244
  branch: any;
240
245
  mode: any;
246
+ workflow_mode: any;
247
+ implementation_mode: any;
248
+ require_diff: any;
249
+ allow_code_changes: any;
250
+ no_implementation_mode: boolean;
241
251
  reference: any;
242
252
  before_ref: any;
243
253
  allow_static_preview_fallback: boolean;
@@ -306,4 +316,4 @@ declare function summarizeState(state: any): {
306
316
  };
307
317
  };
308
318
 
309
- export { BUNDLED_RIDDLE_PROOF_DIR, CHECKPOINT_CONTRACT_VERSION, type CheckpointInputContract, type PluginConfig, RIDDLE_PROOF_DIR_CANDIDATES, type ShipGateValidation, WORKFLOW_STAGE_ORDER, type WorkflowAction, type WorkflowParams, type WorkflowStage, buildCheckpointContract, buildSetupArgs, checkpointContinueStage, clearStageDecisionRequest, ensureAction, ensureStageLoopState, invalidateVerifyEvidence, mergeStateFromParams, readState, recordStageAttempt, requiredBaselineLabelsForState, resolveConfig, resolveRiddleProofDir, setStageDecisionRequest, summarizeState, validateShipGate, visualDeltaForState, visualDeltaRequiredForState, visualDeltaShipGateReason, workflowFile, writeState };
319
+ export { BUNDLED_RIDDLE_PROOF_DIR, CHECKPOINT_CONTRACT_VERSION, type CheckpointInputContract, type PluginConfig, RIDDLE_PROOF_DIR_CANDIDATES, type ShipGateValidation, WORKFLOW_STAGE_ORDER, type WorkflowAction, type WorkflowParams, type WorkflowStage, buildCheckpointContract, buildSetupArgs, checkpointContinueStage, clearStageDecisionRequest, ensureAction, ensureStageLoopState, invalidateVerifyEvidence, mergeStateFromParams, noImplementationModeFor, previewModeFromWorkflowMode, readState, recordStageAttempt, requiredBaselineLabelsForState, resolveConfig, resolveRiddleProofDir, setStageDecisionRequest, summarizeState, validateShipGate, visualDeltaForState, visualDeltaRequiredForState, visualDeltaShipGateReason, workflowFile, writeState };
@@ -26,7 +26,10 @@ interface WorkflowParams {
26
26
  allow_static_preview_fallback?: boolean;
27
27
  context?: string;
28
28
  reviewer?: string;
29
- mode?: "server" | "static";
29
+ mode?: "server" | "static" | "audit" | (string & {});
30
+ implementation_mode?: "change" | "none" | (string & {});
31
+ require_diff?: boolean;
32
+ allow_code_changes?: boolean;
30
33
  build_command?: string;
31
34
  build_output?: string;
32
35
  server_image?: string;
@@ -58,6 +61,8 @@ interface WorkflowParams {
58
61
  update_base_checkout?: boolean;
59
62
  advance_stage?: WorkflowStage;
60
63
  }
64
+ declare function previewModeFromWorkflowMode(value: unknown): "server" | "static" | undefined;
65
+ declare function noImplementationModeFor(params?: unknown, state?: unknown): boolean;
61
66
  interface PluginConfig {
62
67
  riddleProofDir?: string;
63
68
  statePath?: string;
@@ -115,7 +120,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
115
120
  target_image_hash: string;
116
121
  viewport_matrix_json: string;
117
122
  deterministic_setup_json: string;
118
- reference: "before" | "prod" | "both";
123
+ reference: "prod" | "before" | "both";
119
124
  base_branch: string;
120
125
  before_ref: string;
121
126
  allow_static_preview_fallback: string;
@@ -238,6 +243,11 @@ declare function summarizeState(state: any): {
238
243
  repo: any;
239
244
  branch: any;
240
245
  mode: any;
246
+ workflow_mode: any;
247
+ implementation_mode: any;
248
+ require_diff: any;
249
+ allow_code_changes: any;
250
+ no_implementation_mode: boolean;
241
251
  reference: any;
242
252
  before_ref: any;
243
253
  allow_static_preview_fallback: boolean;
@@ -306,4 +316,4 @@ declare function summarizeState(state: any): {
306
316
  };
307
317
  };
308
318
 
309
- export { BUNDLED_RIDDLE_PROOF_DIR, CHECKPOINT_CONTRACT_VERSION, type CheckpointInputContract, type PluginConfig, RIDDLE_PROOF_DIR_CANDIDATES, type ShipGateValidation, WORKFLOW_STAGE_ORDER, type WorkflowAction, type WorkflowParams, type WorkflowStage, buildCheckpointContract, buildSetupArgs, checkpointContinueStage, clearStageDecisionRequest, ensureAction, ensureStageLoopState, invalidateVerifyEvidence, mergeStateFromParams, readState, recordStageAttempt, requiredBaselineLabelsForState, resolveConfig, resolveRiddleProofDir, setStageDecisionRequest, summarizeState, validateShipGate, visualDeltaForState, visualDeltaRequiredForState, visualDeltaShipGateReason, workflowFile, writeState };
319
+ export { BUNDLED_RIDDLE_PROOF_DIR, CHECKPOINT_CONTRACT_VERSION, type CheckpointInputContract, type PluginConfig, RIDDLE_PROOF_DIR_CANDIDATES, type ShipGateValidation, WORKFLOW_STAGE_ORDER, type WorkflowAction, type WorkflowParams, type WorkflowStage, buildCheckpointContract, buildSetupArgs, checkpointContinueStage, clearStageDecisionRequest, ensureAction, ensureStageLoopState, invalidateVerifyEvidence, mergeStateFromParams, noImplementationModeFor, previewModeFromWorkflowMode, readState, recordStageAttempt, requiredBaselineLabelsForState, resolveConfig, resolveRiddleProofDir, setStageDecisionRequest, summarizeState, validateShipGate, visualDeltaForState, visualDeltaRequiredForState, visualDeltaShipGateReason, workflowFile, writeState };
@@ -11,6 +11,8 @@ import {
11
11
  ensureStageLoopState,
12
12
  invalidateVerifyEvidence,
13
13
  mergeStateFromParams,
14
+ noImplementationModeFor,
15
+ previewModeFromWorkflowMode,
14
16
  readState,
15
17
  recordStageAttempt,
16
18
  requiredBaselineLabelsForState,
@@ -24,7 +26,7 @@ import {
24
26
  visualDeltaShipGateReason,
25
27
  workflowFile,
26
28
  writeState
27
- } from "./chunk-RFJ5BQF6.js";
29
+ } from "./chunk-FPD2RF3Q.js";
28
30
  export {
29
31
  BUNDLED_RIDDLE_PROOF_DIR,
30
32
  CHECKPOINT_CONTRACT_VERSION,
@@ -38,6 +40,8 @@ export {
38
40
  ensureStageLoopState,
39
41
  invalidateVerifyEvidence,
40
42
  mergeStateFromParams,
43
+ noImplementationModeFor,
44
+ previewModeFromWorkflowMode,
41
45
  readState,
42
46
  recordStageAttempt,
43
47
  requiredBaselineLabelsForState,
@@ -45,6 +45,25 @@ var import_node_path = __toESM(require("path"), 1);
45
45
  var import_node_url = require("url");
46
46
  var import_meta = {};
47
47
  var WORKFLOW_STAGE_ORDER = ["setup", "recon", "author", "implement", "verify", "ship"];
48
+ function normalizedMode(value) {
49
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
50
+ }
51
+ function previewModeFromWorkflowMode(value) {
52
+ const mode = normalizedMode(value);
53
+ return mode === "server" || mode === "static" ? mode : void 0;
54
+ }
55
+ function noImplementationModeInput(value) {
56
+ return value && typeof value === "object" ? value : {};
57
+ }
58
+ function noImplementationModeFor(params, state) {
59
+ const input = noImplementationModeInput(params);
60
+ const stateInput = noImplementationModeInput(state);
61
+ const mode = normalizedMode(input.mode ?? input.workflow_mode ?? stateInput.mode ?? stateInput.workflow_mode);
62
+ const implementationMode = normalizedMode(input.implementation_mode ?? stateInput.implementation_mode);
63
+ const requireDiff = input.require_diff ?? stateInput.require_diff;
64
+ const allowCodeChanges = input.allow_code_changes ?? stateInput.allow_code_changes;
65
+ return mode === "audit" || mode === "profile" || implementationMode === "none" || requireDiff === false || allowCodeChanges === false;
66
+ }
48
67
  var CHECKPOINT_CONTRACT_VERSION = "riddle-proof-run.checkpoint.v1";
49
68
  function currentDistDir() {
50
69
  const meta = typeof import_meta === "object" ? import_meta : {};
@@ -137,7 +156,7 @@ function buildSetupArgs(params, config) {
137
156
  allow_static_preview_fallback: params.allow_static_preview_fallback ? "true" : "",
138
157
  context: params.context || "",
139
158
  reviewer: params.reviewer || config.defaultReviewer,
140
- mode: params.mode || "",
159
+ mode: previewModeFromWorkflowMode(params.mode) || "",
141
160
  build_command: params.build_command || "npm run build",
142
161
  build_output: params.build_output || "build",
143
162
  server_image: params.server_image || "node:20-slim",
@@ -740,7 +759,8 @@ function mergeStateFromParams(statePath, params) {
740
759
  "auth_cookies_json",
741
760
  "auth_headers_json",
742
761
  "proof_plan",
743
- "implementation_notes"
762
+ "implementation_notes",
763
+ "implementation_mode"
744
764
  ];
745
765
  for (const field of stringFields) {
746
766
  if (params[field] !== void 0) {
@@ -755,7 +775,17 @@ function mergeStateFromParams(statePath, params) {
755
775
  if (issues.length) state.implementation_environment_issues = issues;
756
776
  }
757
777
  if (params.reference !== void 0) state.reference = params.reference;
758
- if (params.mode !== void 0) state.mode = params.mode;
778
+ if (params.mode !== void 0) {
779
+ const previewMode = previewModeFromWorkflowMode(params.mode);
780
+ if (previewMode) {
781
+ state.mode = previewMode;
782
+ } else {
783
+ state.workflow_mode = normalizeOptionalString(params.mode);
784
+ }
785
+ }
786
+ if (params.implementation_mode !== void 0) state.implementation_mode = normalizeOptionalString(params.implementation_mode);
787
+ if (params.require_diff !== void 0) state.require_diff = params.require_diff;
788
+ if (params.allow_code_changes !== void 0) state.allow_code_changes = params.allow_code_changes;
759
789
  if (params.allow_static_preview_fallback !== void 0) {
760
790
  state.allow_static_preview_fallback = params.allow_static_preview_fallback;
761
791
  }
@@ -900,6 +930,11 @@ function summarizeState(state) {
900
930
  repo: state.repo || null,
901
931
  branch: state.branch || null,
902
932
  mode: state.mode || null,
933
+ workflow_mode: state.workflow_mode || null,
934
+ implementation_mode: state.implementation_mode || null,
935
+ require_diff: state.require_diff ?? null,
936
+ allow_code_changes: state.allow_code_changes ?? null,
937
+ no_implementation_mode: noImplementationModeFor(state),
903
938
  reference: state.reference || null,
904
939
  before_ref: state.before_ref || null,
905
940
  allow_static_preview_fallback: Boolean(state.allow_static_preview_fallback),
@@ -994,8 +1029,11 @@ function authorReady(state) {
994
1029
  function implementationReady(state) {
995
1030
  return ["changes_detected", "completed"].includes(state?.implementation_status || "");
996
1031
  }
997
- function stageAfterAuthor(state) {
998
- return implementationReady(state) ? "verify" : "implement";
1032
+ function implementationRequired(params, state) {
1033
+ return !noImplementationModeFor(params, state);
1034
+ }
1035
+ function stageAfterAuthor(state, params) {
1036
+ return implementationReady(state) || !implementationRequired(params, state) ? "verify" : "implement";
999
1037
  }
1000
1038
  function latestReconAttempt(state) {
1001
1039
  const history = Array.isArray(state?.recon_results?.attempt_history) ? state.recon_results.attempt_history : [];
@@ -1206,7 +1244,7 @@ function recommendedAdvanceStage(state) {
1206
1244
  if (!state?.workspace_ready) return "setup";
1207
1245
  if (!state?.recon_results || ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "")) return "recon";
1208
1246
  if (!authorReady(state)) return "author";
1209
- if (!implementationReady(state)) return "implement";
1247
+ if (!implementationReady(state) && !noImplementationModeFor(state)) return "implement";
1210
1248
  if (state?.verify_status === "capture_incomplete") return verifyAssessment(state).continueWithStage || verifyAssessment(state).recommendedStage || "author";
1211
1249
  if (state?.verify_status === "evidence_captured") return verifyAssessment(state).continueWithStage || verifyAssessment(state).recommendedStage;
1212
1250
  if (!(state?.after_cdn || "").trim()) return "verify";
@@ -1831,6 +1869,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
1831
1869
  checkpoint: params.advance_stage === "setup" ? "setup_review" : null,
1832
1870
  autoApproved: setupRes.autoApproved || false
1833
1871
  });
1872
+ mergeStateFromParams(config.statePath, params);
1834
1873
  state = readState(config.statePath);
1835
1874
  if (params.advance_stage === "setup") {
1836
1875
  return checkpoint(
@@ -2128,7 +2167,8 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
2128
2167
  }
2129
2168
  );
2130
2169
  }
2131
- const authorNextStage = stageAfterAuthor(state);
2170
+ const noImplementationMode = !implementationRequired(params, state);
2171
+ const authorNextStage = stageAfterAuthor(state, params);
2132
2172
  const explicitAuthorDebug = params.advance_stage === "author";
2133
2173
  recordAttempt("author", "completed", "Author applied the supervising agent's proof packet to recon observations.", {
2134
2174
  autoApproved: authorRes.autoApproved || false,
@@ -2146,7 +2186,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
2146
2186
  return checkpoint(
2147
2187
  "author",
2148
2188
  "author_review",
2149
- 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.",
2189
+ 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.",
2150
2190
  {
2151
2191
  nextActions: authorNextStage === "verify" ? ["inspect_proof_packet", "advance_run_to_verify", "rerun_author"] : ["inspect_proof_packet", "advance_run_to_implement", "rerun_author"],
2152
2192
  advanceOptions: authorNextStage === "verify" ? ["author", "verify", "recon"] : ["author", "implement", "recon"],
@@ -2179,13 +2219,14 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
2179
2219
  }
2180
2220
  if (!effectiveAdvanceStage) {
2181
2221
  const recommended = recommendedAdvanceStage(state);
2222
+ const noImplementationMode = !implementationRequired(params, state);
2182
2223
  return checkpoint(
2183
- recommended || "implement",
2224
+ recommended || (noImplementationMode ? "verify" : "implement"),
2184
2225
  "awaiting_stage_advance",
2185
2226
  "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.",
2186
2227
  {
2187
2228
  nextActions: ["inspect_state", "set_advance_stage", "resume_run"],
2188
- advanceOptions: ["recon", "author", "implement", "verify", "ship"],
2229
+ advanceOptions: noImplementationMode ? ["recon", "author", "verify", "ship"] : ["recon", "author", "implement", "verify", "ship"],
2189
2230
  recommendedAdvanceStage: recommended,
2190
2231
  details: { executed },
2191
2232
  executed
@@ -2193,6 +2234,26 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
2193
2234
  );
2194
2235
  }
2195
2236
  if (effectiveAdvanceStage === "implement") {
2237
+ if (!implementationRequired(params, state)) {
2238
+ recordAttempt("implement", "checkpoint", "Implementation stage was skipped because audit/no-diff mode disables code changes.", {
2239
+ checkpoint: "implement_disabled_for_audit",
2240
+ details: { executed }
2241
+ });
2242
+ return checkpoint(
2243
+ "verify",
2244
+ "implement_disabled_for_audit",
2245
+ "Audit/no-diff mode disables implementation. Continue to verify against the existing target; do not launch an implementation agent or require a git diff.",
2246
+ {
2247
+ nextActions: ["advance_run_to_verify", "inspect_author_packet", "rerun_recon_if_target_changed"],
2248
+ advanceOptions: ["verify", "author", "recon"],
2249
+ recommendedAdvanceStage: "verify",
2250
+ continueWithStage: "verify",
2251
+ blocking: false,
2252
+ details: { executed },
2253
+ executed
2254
+ }
2255
+ );
2256
+ }
2196
2257
  const implementRes = runOne("implement");
2197
2258
  executed.push(executedStep(implementRes));
2198
2259
  if (implementRes.haltedForApproval) {
@@ -2283,7 +2344,8 @@ ${implementRes.stderr || ""}`;
2283
2344
  }
2284
2345
  if (effectiveAdvanceStage === "verify") {
2285
2346
  state = readState(config.statePath);
2286
- if (!["changes_detected", "completed"].includes(state?.implementation_status || "")) {
2347
+ const needsImplementation = implementationRequired(params, state);
2348
+ if (needsImplementation && !implementationReady(state)) {
2287
2349
  return checkpoint(
2288
2350
  "implement",
2289
2351
  "implement_required",
@@ -2300,6 +2362,18 @@ ${implementRes.stderr || ""}`;
2300
2362
  }
2301
2363
  );
2302
2364
  }
2365
+ if (!needsImplementation && !implementationReady(state)) {
2366
+ recordAttempt("implement", "completed", "Implementation stage is not required for this audit/no-diff run.", {
2367
+ checkpoint: "implementation_not_required",
2368
+ details: { executed }
2369
+ });
2370
+ state = updateState(config.statePath, (currentState) => {
2371
+ currentState.implementation_status = "not_required";
2372
+ currentState.implementation_mode = currentState.implementation_mode || "none";
2373
+ if (currentState.require_diff === void 0) currentState.require_diff = false;
2374
+ if (currentState.allow_code_changes === void 0) currentState.allow_code_changes = false;
2375
+ });
2376
+ }
2303
2377
  const hasIncomingProofAssessment = typeof params.proof_assessment_json === "string" && params.proof_assessment_json.trim().length > 0;
2304
2378
  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));
2305
2379
  let verifyRes = { ok: true, step: "verify", reusedEvidence: canReuseVerifyEvidence };
@@ -2322,8 +2396,13 @@ ${implementRes.stderr || ""}`;
2322
2396
  const verifySummary = state?.verify_summary || state?.proof_summary || null;
2323
2397
  const proofAssessment = verifyAssessment(state);
2324
2398
  const convergenceSignals = nonConvergenceSignals(state, proofAssessment);
2325
- const verifyRecommendedStage = proofAssessment.recommendedStage || null;
2326
- const verifyContinueWithStage = shouldEscalateVerifyToHuman(state, proofAssessment) ? null : proofAssessment.continueWithStage || verifyRecommendedStage || null;
2399
+ const rawVerifyRecommendedStage = proofAssessment.recommendedStage || null;
2400
+ const verifyRecommendedStage = !needsImplementation && rawVerifyRecommendedStage === "implement" ? "verify" : rawVerifyRecommendedStage;
2401
+ const rawVerifyContinueWithStage = shouldEscalateVerifyToHuman(state, proofAssessment) ? null : proofAssessment.continueWithStage || verifyRecommendedStage || null;
2402
+ const verifyContinueWithStage = !needsImplementation && rawVerifyContinueWithStage === "implement" ? "verify" : rawVerifyContinueWithStage;
2403
+ const verifyLoopAdvanceOptions = needsImplementation ? ["author", "verify", "implement", "recon"] : ["author", "verify", "recon"];
2404
+ const verifyReviewAdvanceOptions = needsImplementation ? ["verify", "author", "implement", "recon", "ship"] : ["verify", "author", "recon"];
2405
+ const verifyRetryAdvanceOptions = needsImplementation ? ["author", "implement", "ship", "verify", "recon"] : ["author", "verify", "recon"];
2327
2406
  const verifyDetails = {
2328
2407
  executed,
2329
2408
  verifyStatus,
@@ -2361,7 +2440,7 @@ ${implementRes.stderr || ""}`;
2361
2440
  {
2362
2441
  ok: true,
2363
2442
  nextActions: ["inspect_after_capture", "continue_internal_loop_with_checkpoint", "return_to_recon_if_baseline_is_wrong"],
2364
- advanceOptions: ["author", "verify", "implement", "recon"],
2443
+ advanceOptions: verifyLoopAdvanceOptions,
2365
2444
  recommendedAdvanceStage: verifyRecommendedStage || "author",
2366
2445
  continueWithStage: verifyContinueWithStage || "author",
2367
2446
  blocking: false,
@@ -2389,7 +2468,7 @@ ${implementRes.stderr || ""}`;
2389
2468
  summary,
2390
2469
  {
2391
2470
  nextActions: ["inspect_evidence", "author_proof_assessment_json", "continue_internal_loop_with_checkpoint"],
2392
- advanceOptions: ["verify", "author", "implement", "recon", "ship"],
2471
+ advanceOptions: verifyReviewAdvanceOptions,
2393
2472
  recommendedAdvanceStage: "verify",
2394
2473
  continueWithStage: "verify",
2395
2474
  blocking: false,
@@ -2419,7 +2498,7 @@ ${implementRes.stderr || ""}`;
2419
2498
  {
2420
2499
  ok: false,
2421
2500
  nextActions: ["inspect_retry_history", "summarize_internal_loop", "ask_human_for_direction"],
2422
- advanceOptions: ["author", "implement", "ship", "verify", "recon"],
2501
+ advanceOptions: verifyRetryAdvanceOptions,
2423
2502
  recommendedAdvanceStage: null,
2424
2503
  continueWithStage: null,
2425
2504
  blocking: true,
@@ -2434,7 +2513,7 @@ ${implementRes.stderr || ""}`;
2434
2513
  }
2435
2514
  );
2436
2515
  }
2437
- const shouldAutoShip = verifyContinueWithStage === "ship" && (params.ship_after_verify || params.continue_from_checkpoint || params.advance_stage !== "verify");
2516
+ const shouldAutoShip = verifyContinueWithStage === "ship" && needsImplementation && (params.ship_after_verify || params.continue_from_checkpoint || params.advance_stage !== "verify");
2438
2517
  if (shouldAutoShip) {
2439
2518
  const shipGate = validateShipGate(state);
2440
2519
  if (!shipGate.ok) {
@@ -2492,6 +2571,33 @@ ${implementRes.stderr || ""}`;
2492
2571
  };
2493
2572
  }
2494
2573
  if (proofAssessment.decision === "ready_to_ship") {
2574
+ if (!needsImplementation) {
2575
+ recordAttempt("verify", "completed", "Verify captured a proof packet for audit/no-diff mode; shipping remains disabled.", {
2576
+ autoApproved: verifyRes.autoApproved || false,
2577
+ checkpoint: "verify_audit_complete",
2578
+ details: verifyDetails
2579
+ });
2580
+ return checkpoint(
2581
+ "verify",
2582
+ "verify_audit_complete",
2583
+ "The supervising agent judged the audit proof sufficient. Audit/no-diff mode disables ship, PR creation, implementation agents, and git-diff requirements.",
2584
+ {
2585
+ nextActions: ["inspect_evidence", "report_audit_result", "rerun_verify_if_needed"],
2586
+ advanceOptions: ["verify", "author", "recon"],
2587
+ recommendedAdvanceStage: "verify",
2588
+ continueWithStage: null,
2589
+ blocking: false,
2590
+ details: verifyDetails,
2591
+ verifyStatus,
2592
+ verifySummary,
2593
+ afterCdn: state?.after_cdn || null,
2594
+ mergeRecommendation: state?.merge_recommendation || null,
2595
+ verifyDecisionRequest,
2596
+ proofAssessment: proofAssessment.raw,
2597
+ executed
2598
+ }
2599
+ );
2600
+ }
2495
2601
  const shipGate = validateShipGate(state);
2496
2602
  if (!shipGate.ok) {
2497
2603
  recordAttempt("verify", "checkpoint", "Verify cannot mark ship ready because the hard ship gate is missing required evidence or approval.", {
@@ -2548,8 +2654,8 @@ ${implementRes.stderr || ""}`;
2548
2654
  unresolvedSummary,
2549
2655
  {
2550
2656
  ok: true,
2551
- 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"],
2552
- advanceOptions: ["author", "implement", "ship", "verify", "recon"],
2657
+ 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"],
2658
+ advanceOptions: verifyRetryAdvanceOptions,
2553
2659
  recommendedAdvanceStage: verifyRecommendedStage,
2554
2660
  continueWithStage: verifyContinueWithStage,
2555
2661
  blocking: false,
@@ -2566,6 +2672,23 @@ ${implementRes.stderr || ""}`;
2566
2672
  }
2567
2673
  if (effectiveAdvanceStage === "ship") {
2568
2674
  state = readState(config.statePath);
2675
+ if (!implementationRequired(params, state)) {
2676
+ return checkpoint(
2677
+ "verify",
2678
+ "ship_disabled_for_audit",
2679
+ "Audit/no-diff mode disables ship and PR creation. Report the audit result from verify evidence instead.",
2680
+ {
2681
+ ok: false,
2682
+ nextActions: ["inspect_verify_state", "report_audit_result"],
2683
+ advanceOptions: ["verify", "author", "recon"],
2684
+ recommendedAdvanceStage: "verify",
2685
+ continueWithStage: "verify",
2686
+ blocking: true,
2687
+ details: { executed },
2688
+ executed
2689
+ }
2690
+ );
2691
+ }
2569
2692
  const shipAssessment = verifyAssessment(state);
2570
2693
  const shipGate = validateShipGate(state);
2571
2694
  if (state?.verify_status !== "evidence_captured") {
@@ -21,6 +21,11 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
21
21
  repo: any;
22
22
  branch: any;
23
23
  mode: any;
24
+ workflow_mode: any;
25
+ implementation_mode: any;
26
+ require_diff: any;
27
+ allow_code_changes: any;
28
+ no_implementation_mode: boolean;
24
29
  reference: any;
25
30
  before_ref: any;
26
31
  allow_static_preview_fallback: boolean;
@@ -113,6 +118,11 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
113
118
  repo: any;
114
119
  branch: any;
115
120
  mode: any;
121
+ workflow_mode: any;
122
+ implementation_mode: any;
123
+ require_diff: any;
124
+ allow_code_changes: any;
125
+ no_implementation_mode: boolean;
116
126
  reference: any;
117
127
  before_ref: any;
118
128
  allow_static_preview_fallback: boolean;
@@ -203,6 +213,11 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
203
213
  repo: any;
204
214
  branch: any;
205
215
  mode: any;
216
+ workflow_mode: any;
217
+ implementation_mode: any;
218
+ require_diff: any;
219
+ allow_code_changes: any;
220
+ no_implementation_mode: boolean;
206
221
  reference: any;
207
222
  before_ref: any;
208
223
  allow_static_preview_fallback: boolean;
@@ -277,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
277
292
  blocking?: boolean;
278
293
  details?: Record<string, unknown>;
279
294
  ok: boolean;
280
- action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
295
+ action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
281
296
  state_path: string;
282
297
  stage: any;
283
298
  summary: string;
@@ -286,6 +301,11 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
286
301
  repo: any;
287
302
  branch: any;
288
303
  mode: any;
304
+ workflow_mode: any;
305
+ implementation_mode: any;
306
+ require_diff: any;
307
+ allow_code_changes: any;
308
+ no_implementation_mode: boolean;
289
309
  reference: any;
290
310
  before_ref: any;
291
311
  allow_static_preview_fallback: boolean;
@@ -362,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
362
382
  continueWithStage?: WorkflowStage | null;
363
383
  blocking?: boolean;
364
384
  details?: Record<string, unknown>;
365
- action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
385
+ action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
366
386
  state_path: string;
367
387
  stage: any;
368
388
  checkpoint: string;
@@ -372,6 +392,11 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
372
392
  repo: any;
373
393
  branch: any;
374
394
  mode: any;
395
+ workflow_mode: any;
396
+ implementation_mode: any;
397
+ require_diff: any;
398
+ allow_code_changes: any;
399
+ no_implementation_mode: boolean;
375
400
  reference: any;
376
401
  before_ref: any;
377
402
  allow_static_preview_fallback: boolean;
@@ -462,6 +487,11 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
462
487
  repo: any;
463
488
  branch: any;
464
489
  mode: any;
490
+ workflow_mode: any;
491
+ implementation_mode: any;
492
+ require_diff: any;
493
+ allow_code_changes: any;
494
+ no_implementation_mode: boolean;
465
495
  reference: any;
466
496
  before_ref: any;
467
497
  allow_static_preview_fallback: boolean;
@@ -550,6 +580,11 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
550
580
  repo: any;
551
581
  branch: any;
552
582
  mode: any;
583
+ workflow_mode: any;
584
+ implementation_mode: any;
585
+ require_diff: any;
586
+ allow_code_changes: any;
587
+ no_implementation_mode: boolean;
553
588
  reference: any;
554
589
  before_ref: any;
555
590
  allow_static_preview_fallback: boolean;
@@ -624,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
624
659
  error?: undefined;
625
660
  } | {
626
661
  ok: boolean;
627
- action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
662
+ action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
628
663
  state_path: string;
629
664
  stage: any;
630
665
  summary: string;
@@ -633,6 +668,11 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
633
668
  repo: any;
634
669
  branch: any;
635
670
  mode: any;
671
+ workflow_mode: any;
672
+ implementation_mode: any;
673
+ require_diff: any;
674
+ allow_code_changes: any;
675
+ no_implementation_mode: boolean;
636
676
  reference: any;
637
677
  before_ref: any;
638
678
  allow_static_preview_fallback: boolean;