@riddledc/riddle-proof 0.6.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.
@@ -6,6 +6,7 @@ import {
6
6
  ensureAction,
7
7
  invalidateVerifyEvidence,
8
8
  mergeStateFromParams,
9
+ noImplementationModeFor,
9
10
  readState,
10
11
  recordStageAttempt,
11
12
  resolveConfig,
@@ -14,7 +15,7 @@ import {
14
15
  validateShipGate,
15
16
  workflowFile,
16
17
  writeState
17
- } from "./chunk-RFJ5BQF6.js";
18
+ } from "./chunk-FPD2RF3Q.js";
18
19
 
19
20
  // src/proof-run-engine.ts
20
21
  import { execFileSync } from "child_process";
@@ -29,8 +30,11 @@ function authorReady(state) {
29
30
  function implementationReady(state) {
30
31
  return ["changes_detected", "completed"].includes(state?.implementation_status || "");
31
32
  }
32
- function stageAfterAuthor(state) {
33
- return implementationReady(state) ? "verify" : "implement";
33
+ function implementationRequired(params, state) {
34
+ return !noImplementationModeFor(params, state);
35
+ }
36
+ function stageAfterAuthor(state, params) {
37
+ return implementationReady(state) || !implementationRequired(params, state) ? "verify" : "implement";
34
38
  }
35
39
  function latestReconAttempt(state) {
36
40
  const history = Array.isArray(state?.recon_results?.attempt_history) ? state.recon_results.attempt_history : [];
@@ -241,7 +245,7 @@ function recommendedAdvanceStage(state) {
241
245
  if (!state?.workspace_ready) return "setup";
242
246
  if (!state?.recon_results || ["needs_agent_decision", "needs_supervisor_judgment"].includes(state?.recon_status || "")) return "recon";
243
247
  if (!authorReady(state)) return "author";
244
- if (!implementationReady(state)) return "implement";
248
+ if (!implementationReady(state) && !noImplementationModeFor(state)) return "implement";
245
249
  if (state?.verify_status === "capture_incomplete") return verifyAssessment(state).continueWithStage || verifyAssessment(state).recommendedStage || "author";
246
250
  if (state?.verify_status === "evidence_captured") return verifyAssessment(state).continueWithStage || verifyAssessment(state).recommendedStage;
247
251
  if (!(state?.after_cdn || "").trim()) return "verify";
@@ -866,6 +870,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
866
870
  checkpoint: params.advance_stage === "setup" ? "setup_review" : null,
867
871
  autoApproved: setupRes.autoApproved || false
868
872
  });
873
+ mergeStateFromParams(config.statePath, params);
869
874
  state = readState(config.statePath);
870
875
  if (params.advance_stage === "setup") {
871
876
  return checkpoint(
@@ -1163,7 +1168,8 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
1163
1168
  }
1164
1169
  );
1165
1170
  }
1166
- const authorNextStage = stageAfterAuthor(state);
1171
+ const noImplementationMode = !implementationRequired(params, state);
1172
+ const authorNextStage = stageAfterAuthor(state, params);
1167
1173
  const explicitAuthorDebug = params.advance_stage === "author";
1168
1174
  recordAttempt("author", "completed", "Author applied the supervising agent's proof packet to recon observations.", {
1169
1175
  autoApproved: authorRes.autoApproved || false,
@@ -1181,7 +1187,7 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
1181
1187
  return checkpoint(
1182
1188
  "author",
1183
1189
  "author_review",
1184
- 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.",
1190
+ 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.",
1185
1191
  {
1186
1192
  nextActions: authorNextStage === "verify" ? ["inspect_proof_packet", "advance_run_to_verify", "rerun_author"] : ["inspect_proof_packet", "advance_run_to_implement", "rerun_author"],
1187
1193
  advanceOptions: authorNextStage === "verify" ? ["author", "verify", "recon"] : ["author", "implement", "recon"],
@@ -1214,13 +1220,14 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
1214
1220
  }
1215
1221
  if (!effectiveAdvanceStage) {
1216
1222
  const recommended = recommendedAdvanceStage(state);
1223
+ const noImplementationMode = !implementationRequired(params, state);
1217
1224
  return checkpoint(
1218
- recommended || "implement",
1225
+ recommended || (noImplementationMode ? "verify" : "implement"),
1219
1226
  "awaiting_stage_advance",
1220
1227
  "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.",
1221
1228
  {
1222
1229
  nextActions: ["inspect_state", "set_advance_stage", "resume_run"],
1223
- advanceOptions: ["recon", "author", "implement", "verify", "ship"],
1230
+ advanceOptions: noImplementationMode ? ["recon", "author", "verify", "ship"] : ["recon", "author", "implement", "verify", "ship"],
1224
1231
  recommendedAdvanceStage: recommended,
1225
1232
  details: { executed },
1226
1233
  executed
@@ -1228,6 +1235,26 @@ async function executeWorkflow(params, pluginConfig, resolvedConfig) {
1228
1235
  );
1229
1236
  }
1230
1237
  if (effectiveAdvanceStage === "implement") {
1238
+ if (!implementationRequired(params, state)) {
1239
+ recordAttempt("implement", "checkpoint", "Implementation stage was skipped because audit/no-diff mode disables code changes.", {
1240
+ checkpoint: "implement_disabled_for_audit",
1241
+ details: { executed }
1242
+ });
1243
+ return checkpoint(
1244
+ "verify",
1245
+ "implement_disabled_for_audit",
1246
+ "Audit/no-diff mode disables implementation. Continue to verify against the existing target; do not launch an implementation agent or require a git diff.",
1247
+ {
1248
+ nextActions: ["advance_run_to_verify", "inspect_author_packet", "rerun_recon_if_target_changed"],
1249
+ advanceOptions: ["verify", "author", "recon"],
1250
+ recommendedAdvanceStage: "verify",
1251
+ continueWithStage: "verify",
1252
+ blocking: false,
1253
+ details: { executed },
1254
+ executed
1255
+ }
1256
+ );
1257
+ }
1231
1258
  const implementRes = runOne("implement");
1232
1259
  executed.push(executedStep(implementRes));
1233
1260
  if (implementRes.haltedForApproval) {
@@ -1318,7 +1345,8 @@ ${implementRes.stderr || ""}`;
1318
1345
  }
1319
1346
  if (effectiveAdvanceStage === "verify") {
1320
1347
  state = readState(config.statePath);
1321
- if (!["changes_detected", "completed"].includes(state?.implementation_status || "")) {
1348
+ const needsImplementation = implementationRequired(params, state);
1349
+ if (needsImplementation && !implementationReady(state)) {
1322
1350
  return checkpoint(
1323
1351
  "implement",
1324
1352
  "implement_required",
@@ -1335,6 +1363,18 @@ ${implementRes.stderr || ""}`;
1335
1363
  }
1336
1364
  );
1337
1365
  }
1366
+ if (!needsImplementation && !implementationReady(state)) {
1367
+ recordAttempt("implement", "completed", "Implementation stage is not required for this audit/no-diff run.", {
1368
+ checkpoint: "implementation_not_required",
1369
+ details: { executed }
1370
+ });
1371
+ state = updateState(config.statePath, (currentState) => {
1372
+ currentState.implementation_status = "not_required";
1373
+ currentState.implementation_mode = currentState.implementation_mode || "none";
1374
+ if (currentState.require_diff === void 0) currentState.require_diff = false;
1375
+ if (currentState.allow_code_changes === void 0) currentState.allow_code_changes = false;
1376
+ });
1377
+ }
1338
1378
  const hasIncomingProofAssessment = typeof params.proof_assessment_json === "string" && params.proof_assessment_json.trim().length > 0;
1339
1379
  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));
1340
1380
  let verifyRes = { ok: true, step: "verify", reusedEvidence: canReuseVerifyEvidence };
@@ -1357,8 +1397,13 @@ ${implementRes.stderr || ""}`;
1357
1397
  const verifySummary = state?.verify_summary || state?.proof_summary || null;
1358
1398
  const proofAssessment = verifyAssessment(state);
1359
1399
  const convergenceSignals = nonConvergenceSignals(state, proofAssessment);
1360
- const verifyRecommendedStage = proofAssessment.recommendedStage || null;
1361
- const verifyContinueWithStage = shouldEscalateVerifyToHuman(state, proofAssessment) ? null : proofAssessment.continueWithStage || verifyRecommendedStage || null;
1400
+ const rawVerifyRecommendedStage = proofAssessment.recommendedStage || null;
1401
+ const verifyRecommendedStage = !needsImplementation && rawVerifyRecommendedStage === "implement" ? "verify" : rawVerifyRecommendedStage;
1402
+ const rawVerifyContinueWithStage = shouldEscalateVerifyToHuman(state, proofAssessment) ? null : proofAssessment.continueWithStage || verifyRecommendedStage || null;
1403
+ const verifyContinueWithStage = !needsImplementation && rawVerifyContinueWithStage === "implement" ? "verify" : rawVerifyContinueWithStage;
1404
+ const verifyLoopAdvanceOptions = needsImplementation ? ["author", "verify", "implement", "recon"] : ["author", "verify", "recon"];
1405
+ const verifyReviewAdvanceOptions = needsImplementation ? ["verify", "author", "implement", "recon", "ship"] : ["verify", "author", "recon"];
1406
+ const verifyRetryAdvanceOptions = needsImplementation ? ["author", "implement", "ship", "verify", "recon"] : ["author", "verify", "recon"];
1362
1407
  const verifyDetails = {
1363
1408
  executed,
1364
1409
  verifyStatus,
@@ -1396,7 +1441,7 @@ ${implementRes.stderr || ""}`;
1396
1441
  {
1397
1442
  ok: true,
1398
1443
  nextActions: ["inspect_after_capture", "continue_internal_loop_with_checkpoint", "return_to_recon_if_baseline_is_wrong"],
1399
- advanceOptions: ["author", "verify", "implement", "recon"],
1444
+ advanceOptions: verifyLoopAdvanceOptions,
1400
1445
  recommendedAdvanceStage: verifyRecommendedStage || "author",
1401
1446
  continueWithStage: verifyContinueWithStage || "author",
1402
1447
  blocking: false,
@@ -1424,7 +1469,7 @@ ${implementRes.stderr || ""}`;
1424
1469
  summary,
1425
1470
  {
1426
1471
  nextActions: ["inspect_evidence", "author_proof_assessment_json", "continue_internal_loop_with_checkpoint"],
1427
- advanceOptions: ["verify", "author", "implement", "recon", "ship"],
1472
+ advanceOptions: verifyReviewAdvanceOptions,
1428
1473
  recommendedAdvanceStage: "verify",
1429
1474
  continueWithStage: "verify",
1430
1475
  blocking: false,
@@ -1454,7 +1499,7 @@ ${implementRes.stderr || ""}`;
1454
1499
  {
1455
1500
  ok: false,
1456
1501
  nextActions: ["inspect_retry_history", "summarize_internal_loop", "ask_human_for_direction"],
1457
- advanceOptions: ["author", "implement", "ship", "verify", "recon"],
1502
+ advanceOptions: verifyRetryAdvanceOptions,
1458
1503
  recommendedAdvanceStage: null,
1459
1504
  continueWithStage: null,
1460
1505
  blocking: true,
@@ -1469,7 +1514,7 @@ ${implementRes.stderr || ""}`;
1469
1514
  }
1470
1515
  );
1471
1516
  }
1472
- const shouldAutoShip = verifyContinueWithStage === "ship" && (params.ship_after_verify || params.continue_from_checkpoint || params.advance_stage !== "verify");
1517
+ const shouldAutoShip = verifyContinueWithStage === "ship" && needsImplementation && (params.ship_after_verify || params.continue_from_checkpoint || params.advance_stage !== "verify");
1473
1518
  if (shouldAutoShip) {
1474
1519
  const shipGate = validateShipGate(state);
1475
1520
  if (!shipGate.ok) {
@@ -1527,6 +1572,33 @@ ${implementRes.stderr || ""}`;
1527
1572
  };
1528
1573
  }
1529
1574
  if (proofAssessment.decision === "ready_to_ship") {
1575
+ if (!needsImplementation) {
1576
+ recordAttempt("verify", "completed", "Verify captured a proof packet for audit/no-diff mode; shipping remains disabled.", {
1577
+ autoApproved: verifyRes.autoApproved || false,
1578
+ checkpoint: "verify_audit_complete",
1579
+ details: verifyDetails
1580
+ });
1581
+ return checkpoint(
1582
+ "verify",
1583
+ "verify_audit_complete",
1584
+ "The supervising agent judged the audit proof sufficient. Audit/no-diff mode disables ship, PR creation, implementation agents, and git-diff requirements.",
1585
+ {
1586
+ nextActions: ["inspect_evidence", "report_audit_result", "rerun_verify_if_needed"],
1587
+ advanceOptions: ["verify", "author", "recon"],
1588
+ recommendedAdvanceStage: "verify",
1589
+ continueWithStage: null,
1590
+ blocking: false,
1591
+ details: verifyDetails,
1592
+ verifyStatus,
1593
+ verifySummary,
1594
+ afterCdn: state?.after_cdn || null,
1595
+ mergeRecommendation: state?.merge_recommendation || null,
1596
+ verifyDecisionRequest,
1597
+ proofAssessment: proofAssessment.raw,
1598
+ executed
1599
+ }
1600
+ );
1601
+ }
1530
1602
  const shipGate = validateShipGate(state);
1531
1603
  if (!shipGate.ok) {
1532
1604
  recordAttempt("verify", "checkpoint", "Verify cannot mark ship ready because the hard ship gate is missing required evidence or approval.", {
@@ -1583,8 +1655,8 @@ ${implementRes.stderr || ""}`;
1583
1655
  unresolvedSummary,
1584
1656
  {
1585
1657
  ok: true,
1586
- 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"],
1587
- advanceOptions: ["author", "implement", "ship", "verify", "recon"],
1658
+ 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"],
1659
+ advanceOptions: verifyRetryAdvanceOptions,
1588
1660
  recommendedAdvanceStage: verifyRecommendedStage,
1589
1661
  continueWithStage: verifyContinueWithStage,
1590
1662
  blocking: false,
@@ -1601,6 +1673,23 @@ ${implementRes.stderr || ""}`;
1601
1673
  }
1602
1674
  if (effectiveAdvanceStage === "ship") {
1603
1675
  state = readState(config.statePath);
1676
+ if (!implementationRequired(params, state)) {
1677
+ return checkpoint(
1678
+ "verify",
1679
+ "ship_disabled_for_audit",
1680
+ "Audit/no-diff mode disables ship and PR creation. Report the audit result from verify evidence instead.",
1681
+ {
1682
+ ok: false,
1683
+ nextActions: ["inspect_verify_state", "report_audit_result"],
1684
+ advanceOptions: ["verify", "author", "recon"],
1685
+ recommendedAdvanceStage: "verify",
1686
+ continueWithStage: "verify",
1687
+ blocking: true,
1688
+ details: { executed },
1689
+ executed
1690
+ }
1691
+ );
1692
+ }
1604
1693
  const shipAssessment = verifyAssessment(state);
1605
1694
  const shipGate = validateShipGate(state);
1606
1695
  if (state?.verify_status !== "evidence_captured") {
package/dist/runner.cjs CHANGED
@@ -1,7 +1,9 @@
1
1
  "use strict";
2
+ var __create = Object.create;
2
3
  var __defProp = Object.defineProperty;
3
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
5
7
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
8
  var __export = (target, all) => {
7
9
  for (var name in all)
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
15
17
  }
16
18
  return to;
17
19
  };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
18
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
29
 
20
30
  // src/runner.ts
@@ -188,6 +198,9 @@ function normalizeRunParams(input) {
188
198
  context: input.context,
189
199
  reviewer: input.reviewer,
190
200
  mode: input.mode,
201
+ implementation_mode: input.implementation_mode,
202
+ require_diff: input.require_diff,
203
+ allow_code_changes: input.allow_code_changes,
191
204
  build_command: input.build_command,
192
205
  build_output: input.build_output,
193
206
  server_image: input.server_image,
@@ -285,6 +298,41 @@ function setRunStatus(state, status, at = timestamp()) {
285
298
  return state;
286
299
  }
287
300
 
301
+ // src/proof-run-core.ts
302
+ var import_node_fs = require("fs");
303
+ var import_node_crypto = require("crypto");
304
+ var import_node_path = __toESM(require("path"), 1);
305
+ var import_node_url = require("url");
306
+ var import_meta = {};
307
+ function normalizedMode(value) {
308
+ return typeof value === "string" ? value.trim().toLowerCase() : "";
309
+ }
310
+ function noImplementationModeInput(value) {
311
+ return value && typeof value === "object" ? value : {};
312
+ }
313
+ function noImplementationModeFor(params, state) {
314
+ const input = noImplementationModeInput(params);
315
+ const stateInput = noImplementationModeInput(state);
316
+ const mode = normalizedMode(input.mode ?? input.workflow_mode ?? stateInput.mode ?? stateInput.workflow_mode);
317
+ const implementationMode = normalizedMode(input.implementation_mode ?? stateInput.implementation_mode);
318
+ const requireDiff = input.require_diff ?? stateInput.require_diff;
319
+ const allowCodeChanges = input.allow_code_changes ?? stateInput.allow_code_changes;
320
+ return mode === "audit" || mode === "profile" || implementationMode === "none" || requireDiff === false || allowCodeChanges === false;
321
+ }
322
+ function currentDistDir() {
323
+ const meta = typeof import_meta === "object" ? import_meta : {};
324
+ if (typeof meta.url === "string" && meta.url) {
325
+ return import_node_path.default.dirname((0, import_node_url.fileURLToPath)(meta.url));
326
+ }
327
+ if (typeof __dirname === "string") return __dirname;
328
+ return process.cwd();
329
+ }
330
+ var BUNDLED_RIDDLE_PROOF_DIR = import_node_path.default.resolve(
331
+ currentDistDir(),
332
+ "..",
333
+ "runtime"
334
+ );
335
+
288
336
  // src/runner.ts
289
337
  function errorDetails(error) {
290
338
  if (error instanceof Error) {
@@ -485,6 +533,7 @@ async function runRiddleProof(input) {
485
533
  }
486
534
  }
487
535
  const changeRequest = state.request.change_request?.trim();
536
+ const noImplementationMode = noImplementationModeFor(state.request);
488
537
  if (!changeRequest) {
489
538
  return blockRun({
490
539
  state,
@@ -492,14 +541,14 @@ async function runRiddleProof(input) {
492
541
  blocker: adapterBlocker("change_request_required", "A change request is required before implementation.", "request_invalid")
493
542
  });
494
543
  }
495
- if (!workdir) {
544
+ if (!noImplementationMode && !workdir) {
496
545
  return blockRun({
497
546
  state,
498
547
  stage: "setup",
499
548
  blocker: adapterBlocker("workdir_not_configured", "A workdir or setup adapter result is required before implementation.", "setup_required")
500
549
  });
501
550
  }
502
- if (!adapters.implementation) {
551
+ if (!noImplementationMode && !adapters.implementation) {
503
552
  return blockRun({
504
553
  state,
505
554
  stage: "implement",
@@ -525,57 +574,68 @@ async function runRiddleProof(input) {
525
574
  let assessment;
526
575
  for (let attempt = 0; attempt < maxIterations; attempt += 1) {
527
576
  state.iterations += 1;
528
- appendStageHeartbeat(state, {
529
- stage: "implement",
530
- summary: "Implementation stage is active.",
531
- details: { iteration: state.iterations }
532
- });
533
- appendRunEvent(state, {
534
- kind: "implementation.started",
535
- checkpoint: "implementation_started",
536
- stage: "implement",
537
- summary: "Implementation adapter started.",
538
- details: { iteration: state.iterations }
539
- });
540
- try {
541
- implementation = await adapters.implementation.implement({
542
- workdir,
543
- change_request: changeRequest,
544
- evidence_context: evidenceContext,
545
- state
577
+ if (noImplementationMode) {
578
+ state.implementation_status = "not_required";
579
+ appendRunEvent(state, {
580
+ kind: "implementation.skipped",
581
+ checkpoint: "implementation_not_required",
582
+ stage: "implement",
583
+ summary: "Implementation stage skipped because audit/no-diff mode disables code changes.",
584
+ details: { iteration: state.iterations }
546
585
  });
547
- } catch (error) {
548
- return blockRun({
549
- state,
586
+ } else {
587
+ appendStageHeartbeat(state, {
550
588
  stage: "implement",
551
- blocker: adapterBlocker("implementation_exception", "The implementation adapter threw an exception.", "implementation_failed", errorDetails(error)),
552
- evidence_bundle: evidenceBundle
589
+ summary: "Implementation stage is active.",
590
+ details: { iteration: state.iterations }
553
591
  });
554
- }
555
- if (!implementation.ok) {
556
- return blockRun({
557
- state,
592
+ appendRunEvent(state, {
593
+ kind: "implementation.started",
594
+ checkpoint: "implementation_started",
558
595
  stage: "implement",
559
- blocker: adapterBlocker(
560
- "implementation_failed",
561
- "The implementation adapter did not complete successfully.",
562
- "implementation_failed",
563
- { blockers: implementation.blockers }
564
- ),
565
- evidence_bundle: evidenceBundle,
566
- raw: { implementation }
596
+ summary: "Implementation adapter started.",
597
+ details: { iteration: state.iterations }
567
598
  });
568
- }
569
- appendRunEvent(state, {
570
- kind: "implementation.completed",
571
- checkpoint: "implementation_completed",
572
- stage: "implement",
573
- summary: "Implementation adapter completed.",
574
- details: {
575
- changed_files: implementation.changed_files,
576
- tests_run: implementation.tests_run
599
+ try {
600
+ implementation = await adapters.implementation.implement({
601
+ workdir,
602
+ change_request: changeRequest,
603
+ evidence_context: evidenceContext,
604
+ state
605
+ });
606
+ } catch (error) {
607
+ return blockRun({
608
+ state,
609
+ stage: "implement",
610
+ blocker: adapterBlocker("implementation_exception", "The implementation adapter threw an exception.", "implementation_failed", errorDetails(error)),
611
+ evidence_bundle: evidenceBundle
612
+ });
577
613
  }
578
- });
614
+ if (!implementation.ok) {
615
+ return blockRun({
616
+ state,
617
+ stage: "implement",
618
+ blocker: adapterBlocker(
619
+ "implementation_failed",
620
+ "The implementation adapter did not complete successfully.",
621
+ "implementation_failed",
622
+ { blockers: implementation.blockers }
623
+ ),
624
+ evidence_bundle: evidenceBundle,
625
+ raw: { implementation }
626
+ });
627
+ }
628
+ appendRunEvent(state, {
629
+ kind: "implementation.completed",
630
+ checkpoint: "implementation_completed",
631
+ stage: "implement",
632
+ summary: "Implementation adapter completed.",
633
+ details: {
634
+ changed_files: implementation.changed_files,
635
+ tests_run: implementation.tests_run
636
+ }
637
+ });
638
+ }
579
639
  appendStageHeartbeat(state, {
580
640
  stage: "prove",
581
641
  summary: "Proof capture stage is active.",
package/dist/runner.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-RXFKKYWA.js";
4
- import "./chunk-MO24D3PY.js";
3
+ } from "./chunk-HIKFPDRO.js";
4
+ import "./chunk-4DM3OTWH.js";
5
5
  import "./chunk-3UHWI3FO.js";
6
+ import "./chunk-FPD2RF3Q.js";
6
7
  import "./chunk-33XO42CY.js";
7
8
  import "./chunk-DUFDZJOF.js";
8
9
  export {
package/dist/state.cjs CHANGED
@@ -361,6 +361,9 @@ function normalizeRunParams(input) {
361
361
  context: input.context,
362
362
  reviewer: input.reviewer,
363
363
  mode: input.mode,
364
+ implementation_mode: input.implementation_mode,
365
+ require_diff: input.require_diff,
366
+ allow_code_changes: input.allow_code_changes,
364
367
  build_command: input.build_command,
365
368
  build_output: input.build_output,
366
369
  server_image: input.server_image,
package/dist/state.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  normalizePrLifecycleState,
10
10
  normalizeRunParams,
11
11
  setRunStatus
12
- } from "./chunk-MO24D3PY.js";
12
+ } from "./chunk-4DM3OTWH.js";
13
13
  import "./chunk-3UHWI3FO.js";
14
14
  import "./chunk-33XO42CY.js";
15
15
  import "./chunk-DUFDZJOF.js";
package/dist/types.d.cts CHANGED
@@ -31,6 +31,9 @@ interface RiddleProofRunParams {
31
31
  context?: string;
32
32
  reviewer?: string;
33
33
  mode?: string;
34
+ implementation_mode?: "change" | "none" | (string & {});
35
+ require_diff?: boolean;
36
+ allow_code_changes?: boolean;
34
37
  build_command?: string;
35
38
  build_output?: string;
36
39
  server_image?: string;
package/dist/types.d.ts CHANGED
@@ -31,6 +31,9 @@ interface RiddleProofRunParams {
31
31
  context?: string;
32
32
  reviewer?: string;
33
33
  mode?: string;
34
+ implementation_mode?: "change" | "none" | (string & {});
35
+ require_diff?: boolean;
36
+ allow_code_changes?: boolean;
34
37
  build_command?: string;
35
38
  build_output?: string;
36
39
  server_image?: string;
@@ -0,0 +1,26 @@
1
+ {
2
+ "version": "riddle-proof.profile.v1",
3
+ "name": "page-content-basic",
4
+ "target": {
5
+ "route": "/",
6
+ "viewports": [
7
+ { "name": "mobile", "width": 390, "height": 844 },
8
+ { "name": "desktop", "width": 1440, "height": 1000 }
9
+ ],
10
+ "auth": "none",
11
+ "wait_for_selector": "body"
12
+ },
13
+ "checks": [
14
+ { "type": "route_loaded", "expected_path": "/" },
15
+ { "type": "selector_visible", "selector": "body" },
16
+ { "type": "text_visible", "text": "Example" },
17
+ { "type": "no_mobile_horizontal_overflow" },
18
+ { "type": "no_fatal_console_errors" }
19
+ ],
20
+ "artifacts": ["screenshot", "console", "dom_summary", "proof_json"],
21
+ "failure_policy": {
22
+ "environment_blocked": "neutral",
23
+ "proof_insufficient": "fail",
24
+ "product_regression": "fail"
25
+ }
26
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.6.0",
3
+ "version": "0.7.1",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",
@@ -84,6 +84,11 @@
84
84
  "import": "./dist/basic-gameplay.js",
85
85
  "require": "./dist/basic-gameplay.cjs"
86
86
  },
87
+ "./profile": {
88
+ "types": "./dist/profile.d.ts",
89
+ "import": "./dist/profile.js",
90
+ "require": "./dist/profile.cjs"
91
+ },
87
92
  "./openclaw": {
88
93
  "types": "./dist/openclaw.d.ts",
89
94
  "import": "./dist/openclaw.js",
@@ -110,6 +115,7 @@
110
115
  },
111
116
  "files": [
112
117
  "dist",
118
+ "examples",
113
119
  "lib",
114
120
  "runtime",
115
121
  "README.md",
@@ -125,7 +131,7 @@
125
131
  "typescript": "^5.4.5"
126
132
  },
127
133
  "scripts": {
128
- "build": "tsup src/index.ts src/types.ts src/result.ts src/state.ts src/checkpoint.ts src/run-card.ts src/runner.ts src/engine-harness.ts src/codex-exec-agent.ts src/local-agent.ts src/cli.ts src/diagnostics.ts src/proof-session.ts src/playability.ts src/basic-gameplay.ts src/openclaw.ts src/proof-run-core.ts src/proof-run-engine.ts src/riddle-client.ts --format cjs,esm --dts --out-dir dist --clean",
134
+ "build": "tsup src/index.ts src/types.ts src/result.ts src/state.ts src/checkpoint.ts src/run-card.ts src/runner.ts src/engine-harness.ts src/codex-exec-agent.ts src/local-agent.ts src/cli.ts src/diagnostics.ts src/proof-session.ts src/playability.ts src/basic-gameplay.ts src/profile.ts src/openclaw.ts src/proof-run-core.ts src/proof-run-engine.ts src/riddle-client.ts --format cjs,esm --dts --out-dir dist --clean",
129
135
  "clean": "rm -rf dist",
130
136
  "lint": "echo 'lint: (not configured)'",
131
137
  "test": "npm run build && node test.js && node proof-run.test.js"