@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.
package/dist/index.cjs CHANGED
@@ -31,6 +31,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
31
31
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
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") {
@@ -4104,6 +4227,9 @@ function normalizeRunParams(input) {
4104
4227
  context: input.context,
4105
4228
  reviewer: input.reviewer,
4106
4229
  mode: input.mode,
4230
+ implementation_mode: input.implementation_mode,
4231
+ require_diff: input.require_diff,
4232
+ allow_code_changes: input.allow_code_changes,
4107
4233
  build_command: input.build_command,
4108
4234
  build_output: input.build_output,
4109
4235
  server_image: input.server_image,
@@ -4255,6 +4381,7 @@ function applyPrLifecycleState(state, input, at = timestamp2()) {
4255
4381
  }
4256
4382
 
4257
4383
  // src/runner.ts
4384
+ init_proof_run_core();
4258
4385
  function errorDetails(error) {
4259
4386
  if (error instanceof Error) {
4260
4387
  return {
@@ -4454,6 +4581,7 @@ async function runRiddleProof(input) {
4454
4581
  }
4455
4582
  }
4456
4583
  const changeRequest = state.request.change_request?.trim();
4584
+ const noImplementationMode = noImplementationModeFor(state.request);
4457
4585
  if (!changeRequest) {
4458
4586
  return blockRun({
4459
4587
  state,
@@ -4461,14 +4589,14 @@ async function runRiddleProof(input) {
4461
4589
  blocker: adapterBlocker("change_request_required", "A change request is required before implementation.", "request_invalid")
4462
4590
  });
4463
4591
  }
4464
- if (!workdir) {
4592
+ if (!noImplementationMode && !workdir) {
4465
4593
  return blockRun({
4466
4594
  state,
4467
4595
  stage: "setup",
4468
4596
  blocker: adapterBlocker("workdir_not_configured", "A workdir or setup adapter result is required before implementation.", "setup_required")
4469
4597
  });
4470
4598
  }
4471
- if (!adapters.implementation) {
4599
+ if (!noImplementationMode && !adapters.implementation) {
4472
4600
  return blockRun({
4473
4601
  state,
4474
4602
  stage: "implement",
@@ -4494,57 +4622,68 @@ async function runRiddleProof(input) {
4494
4622
  let assessment;
4495
4623
  for (let attempt = 0; attempt < maxIterations; attempt += 1) {
4496
4624
  state.iterations += 1;
4497
- appendStageHeartbeat(state, {
4498
- stage: "implement",
4499
- summary: "Implementation stage is active.",
4500
- details: { iteration: state.iterations }
4501
- });
4502
- appendRunEvent(state, {
4503
- kind: "implementation.started",
4504
- checkpoint: "implementation_started",
4505
- stage: "implement",
4506
- summary: "Implementation adapter started.",
4507
- details: { iteration: state.iterations }
4508
- });
4509
- try {
4510
- implementation = await adapters.implementation.implement({
4511
- workdir,
4512
- change_request: changeRequest,
4513
- evidence_context: evidenceContext,
4514
- state
4625
+ if (noImplementationMode) {
4626
+ state.implementation_status = "not_required";
4627
+ appendRunEvent(state, {
4628
+ kind: "implementation.skipped",
4629
+ checkpoint: "implementation_not_required",
4630
+ stage: "implement",
4631
+ summary: "Implementation stage skipped because audit/no-diff mode disables code changes.",
4632
+ details: { iteration: state.iterations }
4515
4633
  });
4516
- } catch (error) {
4517
- return blockRun({
4518
- state,
4634
+ } else {
4635
+ appendStageHeartbeat(state, {
4519
4636
  stage: "implement",
4520
- blocker: adapterBlocker("implementation_exception", "The implementation adapter threw an exception.", "implementation_failed", errorDetails(error)),
4521
- evidence_bundle: evidenceBundle
4637
+ summary: "Implementation stage is active.",
4638
+ details: { iteration: state.iterations }
4522
4639
  });
4523
- }
4524
- if (!implementation.ok) {
4525
- return blockRun({
4526
- state,
4640
+ appendRunEvent(state, {
4641
+ kind: "implementation.started",
4642
+ checkpoint: "implementation_started",
4527
4643
  stage: "implement",
4528
- blocker: adapterBlocker(
4529
- "implementation_failed",
4530
- "The implementation adapter did not complete successfully.",
4531
- "implementation_failed",
4532
- { blockers: implementation.blockers }
4533
- ),
4534
- evidence_bundle: evidenceBundle,
4535
- raw: { implementation }
4644
+ summary: "Implementation adapter started.",
4645
+ details: { iteration: state.iterations }
4536
4646
  });
4537
- }
4538
- appendRunEvent(state, {
4539
- kind: "implementation.completed",
4540
- checkpoint: "implementation_completed",
4541
- stage: "implement",
4542
- summary: "Implementation adapter completed.",
4543
- details: {
4544
- changed_files: implementation.changed_files,
4545
- tests_run: implementation.tests_run
4647
+ try {
4648
+ implementation = await adapters.implementation.implement({
4649
+ workdir,
4650
+ change_request: changeRequest,
4651
+ evidence_context: evidenceContext,
4652
+ state
4653
+ });
4654
+ } catch (error) {
4655
+ return blockRun({
4656
+ state,
4657
+ stage: "implement",
4658
+ blocker: adapterBlocker("implementation_exception", "The implementation adapter threw an exception.", "implementation_failed", errorDetails(error)),
4659
+ evidence_bundle: evidenceBundle
4660
+ });
4546
4661
  }
4547
- });
4662
+ if (!implementation.ok) {
4663
+ return blockRun({
4664
+ state,
4665
+ stage: "implement",
4666
+ blocker: adapterBlocker(
4667
+ "implementation_failed",
4668
+ "The implementation adapter did not complete successfully.",
4669
+ "implementation_failed",
4670
+ { blockers: implementation.blockers }
4671
+ ),
4672
+ evidence_bundle: evidenceBundle,
4673
+ raw: { implementation }
4674
+ });
4675
+ }
4676
+ appendRunEvent(state, {
4677
+ kind: "implementation.completed",
4678
+ checkpoint: "implementation_completed",
4679
+ stage: "implement",
4680
+ summary: "Implementation adapter completed.",
4681
+ details: {
4682
+ changed_files: implementation.changed_files,
4683
+ tests_run: implementation.tests_run
4684
+ }
4685
+ });
4686
+ }
4548
4687
  appendStageHeartbeat(state, {
4549
4688
  stage: "prove",
4550
4689
  summary: "Proof capture stage is active.",
@@ -4920,7 +5059,7 @@ function stageFromWorkflowParams(params) {
4920
5059
  if (params.ship_after_verify) return "ship";
4921
5060
  if (params.proof_assessment_json) return "verify";
4922
5061
  if (params.implementation_notes) return "verify";
4923
- if (params.author_packet_json) return "implement";
5062
+ if (params.author_packet_json) return noImplementationModeFor(params) ? "verify" : "implement";
4924
5063
  if (params.recon_assessment_json) return "author";
4925
5064
  return "setup";
4926
5065
  }
@@ -4950,6 +5089,9 @@ function initialRunParams(request, input, state) {
4950
5089
  context: request.context,
4951
5090
  reviewer: request.reviewer,
4952
5091
  mode: request.mode,
5092
+ implementation_mode: request.implementation_mode,
5093
+ require_diff: request.require_diff,
5094
+ allow_code_changes: request.allow_code_changes,
4953
5095
  build_command: request.build_command,
4954
5096
  build_output: request.build_output,
4955
5097
  server_image: request.server_image,
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-RXFKKYWA.js";
3
+ } from "./chunk-HIKFPDRO.js";
4
4
  import "./chunk-6F4PWJZI.js";
5
5
  import {
6
6
  RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION,
@@ -84,7 +84,7 @@ import {
84
84
  createDisabledRiddleProofAgentAdapter,
85
85
  readRiddleProofRunStatus,
86
86
  runRiddleProofEngineHarness
87
- } from "./chunk-D3M2FAYQ.js";
87
+ } from "./chunk-N5BVCRKI.js";
88
88
  import {
89
89
  RIDDLE_PROOF_RUN_STATE_VERSION,
90
90
  appendRunEvent,
@@ -96,12 +96,12 @@ import {
96
96
  normalizePrLifecycleState,
97
97
  normalizeRunParams,
98
98
  setRunStatus
99
- } from "./chunk-MO24D3PY.js";
99
+ } from "./chunk-4DM3OTWH.js";
100
100
  import {
101
101
  RIDDLE_PROOF_RUN_CARD_VERSION,
102
102
  createRiddleProofRunCard
103
103
  } from "./chunk-3UHWI3FO.js";
104
- import "./chunk-RFJ5BQF6.js";
104
+ import "./chunk-FPD2RF3Q.js";
105
105
  import {
106
106
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
107
107
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
package/dist/openclaw.cjs CHANGED
@@ -77,6 +77,9 @@ function normalizeRunParams(input) {
77
77
  context: input.context,
78
78
  reviewer: input.reviewer,
79
79
  mode: input.mode,
80
+ implementation_mode: input.implementation_mode,
81
+ require_diff: input.require_diff,
82
+ allow_code_changes: input.allow_code_changes,
80
83
  build_command: input.build_command,
81
84
  build_output: input.build_output,
82
85
  server_image: input.server_image,
@@ -176,6 +179,9 @@ function toRiddleProofRunParams(params) {
176
179
  context: params.context,
177
180
  reviewer: params.reviewer,
178
181
  mode: params.mode,
182
+ implementation_mode: params.implementation_mode,
183
+ require_diff: params.require_diff,
184
+ allow_code_changes: params.allow_code_changes,
179
185
  build_command: params.build_command,
180
186
  build_output: params.build_output,
181
187
  server_image: params.server_image,
@@ -22,6 +22,9 @@ interface OpenClawProofedChangeParams {
22
22
  context?: string;
23
23
  reviewer?: string;
24
24
  mode?: string;
25
+ implementation_mode?: "change" | "none" | (string & {});
26
+ require_diff?: boolean;
27
+ allow_code_changes?: boolean;
25
28
  build_command?: string;
26
29
  build_output?: string;
27
30
  server_image?: string;
@@ -22,6 +22,9 @@ interface OpenClawProofedChangeParams {
22
22
  context?: string;
23
23
  reviewer?: string;
24
24
  mode?: string;
25
+ implementation_mode?: "change" | "none" | (string & {});
26
+ require_diff?: boolean;
27
+ allow_code_changes?: boolean;
25
28
  build_command?: string;
26
29
  build_output?: string;
27
30
  server_image?: string;
package/dist/openclaw.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  normalizeIntegrationContext,
3
3
  normalizeRunParams
4
- } from "./chunk-MO24D3PY.js";
4
+ } from "./chunk-4DM3OTWH.js";
5
5
  import "./chunk-3UHWI3FO.js";
6
6
  import "./chunk-33XO42CY.js";
7
7
  import {
@@ -83,6 +83,9 @@ function toRiddleProofRunParams(params) {
83
83
  context: params.context,
84
84
  reviewer: params.reviewer,
85
85
  mode: params.mode,
86
+ implementation_mode: params.implementation_mode,
87
+ require_diff: params.require_diff,
88
+ allow_code_changes: params.allow_code_changes,
86
89
  build_command: params.build_command,
87
90
  build_output: params.build_output,
88
91
  server_image: params.server_image,