@riddledc/riddle-proof 0.5.45 → 0.5.46

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/README.md +17 -0
  2. package/dist/checkpoint.cjs +204 -1
  3. package/dist/checkpoint.d.cts +16 -1
  4. package/dist/checkpoint.d.ts +16 -1
  5. package/dist/checkpoint.js +4 -2
  6. package/dist/{chunk-W7VTDN4T.js → chunk-DUFDZJOF.js} +1 -0
  7. package/dist/{chunk-7S7O3NKF.js → chunk-JTNMEH57.js} +6 -1
  8. package/dist/{chunk-MRSYJMF4.js → chunk-L26NTZOU.js} +2 -2
  9. package/dist/chunk-NOBFZDZG.js +754 -0
  10. package/dist/chunk-PLSGW2GI.js +161 -0
  11. package/dist/{chunk-LXE5YUYY.js → chunk-R6SCWJCI.js} +204 -2
  12. package/dist/{chunk-CHRYLX6N.js → chunk-X3AQ2WUM.js} +128 -15
  13. package/dist/cli.cjs +6129 -0
  14. package/dist/cli.d.cts +1 -0
  15. package/dist/cli.d.ts +1 -0
  16. package/dist/cli.js +160 -0
  17. package/dist/codex-exec-agent.cjs +790 -0
  18. package/dist/codex-exec-agent.d.cts +91 -0
  19. package/dist/codex-exec-agent.d.ts +91 -0
  20. package/dist/codex-exec-agent.js +10 -0
  21. package/dist/engine-harness.cjs +740 -279
  22. package/dist/engine-harness.js +5 -4
  23. package/dist/index.cjs +1469 -247
  24. package/dist/index.d.cts +4 -2
  25. package/dist/index.d.ts +4 -2
  26. package/dist/index.js +33 -17
  27. package/dist/openclaw.js +4 -2
  28. package/dist/proof-run-engine.d.cts +3 -3
  29. package/dist/proof-run-engine.d.ts +3 -3
  30. package/dist/result.cjs +1 -0
  31. package/dist/result.js +1 -1
  32. package/dist/run-card.cjs +212 -0
  33. package/dist/run-card.d.cts +10 -0
  34. package/dist/run-card.d.ts +10 -0
  35. package/dist/run-card.js +10 -0
  36. package/dist/runner.cjs +2 -0
  37. package/dist/runner.js +5 -3
  38. package/dist/state.cjs +174 -5
  39. package/dist/state.d.cts +2 -1
  40. package/dist/state.d.ts +2 -1
  41. package/dist/state.js +4 -2
  42. package/dist/types.d.cts +63 -2
  43. package/dist/types.d.ts +63 -2
  44. package/package.json +15 -2
package/dist/state.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/state.ts
@@ -47,6 +57,163 @@ function recordValue(value) {
47
57
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
48
58
  }
49
59
 
60
+ // src/checkpoint.ts
61
+ var import_node_crypto = __toESM(require("crypto"), 1);
62
+ function statePathsForRunState(state, engineStatePath) {
63
+ return compactRecord({
64
+ wrapper_state_path: state.state_path || state.request.harness_state_path || null,
65
+ engine_state_path: engineStatePath || state.request.engine_state_path || null,
66
+ resume_state_path: engineStatePath || state.request.engine_state_path || null
67
+ });
68
+ }
69
+
70
+ // src/run-card.ts
71
+ var RIDDLE_PROOF_RUN_CARD_VERSION = "riddle-proof.run-card.v1";
72
+ function elapsedMs(start, end) {
73
+ const startMs = start ? Date.parse(start) : NaN;
74
+ const endMs = end ? Date.parse(end) : NaN;
75
+ if (!Number.isFinite(startMs) || !Number.isFinite(endMs)) return void 0;
76
+ return Math.max(0, endMs - startMs);
77
+ }
78
+ function jsonCloneRecord(value) {
79
+ const record = recordValue(value);
80
+ if (!record) return void 0;
81
+ try {
82
+ return JSON.parse(JSON.stringify(record));
83
+ } catch {
84
+ return { ...record };
85
+ }
86
+ }
87
+ function compactText(value, limit = 600) {
88
+ const text = nonEmptyString(value);
89
+ if (!text) return void 0;
90
+ return text.length <= limit ? text : `${text.slice(0, limit - 20).trimEnd()}...`;
91
+ }
92
+ function visualDeltaFrom(input) {
93
+ const fullState = input.fullRiddleState || {};
94
+ const bundle = recordValue(fullState.evidence_bundle);
95
+ const after = recordValue(bundle?.after);
96
+ const afterDelta = recordValue(after?.visual_delta);
97
+ if (afterDelta && Object.keys(afterDelta).length) return afterDelta;
98
+ const requestDelta = recordValue(recordValue(fullState.proof_assessment_request)?.visual_delta);
99
+ if (requestDelta && Object.keys(requestDelta).length) return requestDelta;
100
+ const packetDelta = recordValue(input.runState.checkpoint_packet?.evidence_excerpt?.visual_delta);
101
+ return packetDelta && Object.keys(packetDelta).length ? packetDelta : void 0;
102
+ }
103
+ function artifactsFrom(input) {
104
+ const packetArtifacts = input.runState.checkpoint_packet?.artifacts;
105
+ if (packetArtifacts?.length) return packetArtifacts.slice(0, 12);
106
+ const fullState = input.fullRiddleState || {};
107
+ const artifacts = [];
108
+ for (const role of ["before", "prod", "after"]) {
109
+ const url = nonEmptyString(fullState[`${role}_cdn`]) || nonEmptyString(input.runState[`${role}_artifact_url`]);
110
+ if (url) artifacts.push({ role, url, name: `${role}.png`, mime_type: "image/png" });
111
+ }
112
+ return artifacts.length ? artifacts : void 0;
113
+ }
114
+ function ownerFor(state) {
115
+ if (state.status === "awaiting_checkpoint") {
116
+ const role = nonEmptyString(state.checkpoint_packet?.routing_hint?.suggested_role);
117
+ return role || "supervising_agent";
118
+ }
119
+ if (state.status === "running") return "engine";
120
+ if (state.status === "blocked" || state.status === "failed") return "human_or_operator";
121
+ return "none";
122
+ }
123
+ function actionFor(state) {
124
+ if (state.status === "awaiting_checkpoint") return state.checkpoint_packet?.question || "Answer the pending checkpoint.";
125
+ if (state.status === "running") return "Continue the current Riddle Proof stage.";
126
+ if (state.status === "blocked" || state.status === "failed") return state.blocker?.message || "Inspect the blocker and decide whether a new run or infrastructure repair is needed.";
127
+ if (state.status === "ready_to_ship") return "Ship is held by policy; review PR/ship policy before advancing.";
128
+ return "No next action; run is terminal.";
129
+ }
130
+ function evidenceIssueCode(input) {
131
+ const packetIssue = nonEmptyString(input.runState.checkpoint_packet?.evidence_excerpt?.evidence_issue_code);
132
+ if (packetIssue) return packetIssue;
133
+ const assessmentIssue = nonEmptyString(recordValue(input.fullRiddleState?.proof_assessment)?.evidence_issue_code);
134
+ if (assessmentIssue) return assessmentIssue;
135
+ const delta = visualDeltaFrom(input);
136
+ const status = nonEmptyString(delta?.status);
137
+ if (status === "unmeasured") {
138
+ const reason = `${nonEmptyString(delta?.reason) || ""}
139
+ ${input.runState.blocker?.message || ""}`.toLowerCase();
140
+ return reason.includes("fetch") || reason.includes("allowlist") || reason.includes("registered domain") || reason.includes("high risk") || reason.includes("comparator") ? "comparator_fetch_blocked" : "visual_delta_unmeasured";
141
+ }
142
+ if (status === "measured" && delta?.passed === false) return "semantic_proof_failed";
143
+ return void 0;
144
+ }
145
+ function createRiddleProofRunCard(state, input = {}) {
146
+ const at = input.at || (/* @__PURE__ */ new Date()).toISOString();
147
+ const fullState = input.fullRiddleState || {};
148
+ const packet = state.checkpoint_packet;
149
+ const latestEvent = state.events[state.events.length - 1];
150
+ const bundle = recordValue(fullState.evidence_bundle);
151
+ const artifactContract = jsonCloneRecord(packet?.artifact_contract) || jsonCloneRecord(recordValue(fullState.proof_assessment_request)?.artifact_contract) || jsonCloneRecord(recordValue(bundle?.artifact_contract)) || jsonCloneRecord(state.proof_contract?.artifact_contract);
152
+ const required = jsonCloneRecord(recordValue(artifactContract)?.required);
153
+ const statePaths = input.state_paths || state.state_paths || statePathsForRunState(state);
154
+ const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
155
+ const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
156
+ return {
157
+ version: RIDDLE_PROOF_RUN_CARD_VERSION,
158
+ run_id: state.run_id || "unknown",
159
+ status: state.status,
160
+ goal: compactRecord({
161
+ repo: state.request.repo || nonEmptyString(fullState.repo),
162
+ branch: state.request.branch || nonEmptyString(fullState.branch),
163
+ change_request: state.request.change_request || nonEmptyString(fullState.change_request),
164
+ verification_mode: state.request.verification_mode || nonEmptyString(fullState.verification_mode),
165
+ success_criteria: state.request.success_criteria
166
+ }),
167
+ durable_state: compactRecord({
168
+ ...statePaths,
169
+ worktree_path: state.worktree_path || nonEmptyString(fullState.after_worktree) || null,
170
+ branch: state.branch || nonEmptyString(fullState.branch) || null
171
+ }),
172
+ current_phase: compactRecord({
173
+ stage: state.current_stage ?? null,
174
+ checkpoint: state.last_checkpoint ?? packet?.checkpoint ?? null,
175
+ latest_event: latestEvent?.kind ?? null,
176
+ elapsed_ms: elapsedMs(state.created_at, at),
177
+ stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
178
+ iterations: state.iterations
179
+ }),
180
+ owner_next_action: compactRecord({
181
+ owner: ownerFor(state),
182
+ action: actionFor(state),
183
+ checkpoint_kind: packet?.kind || null,
184
+ allowed_decisions: packet?.allowed_decisions,
185
+ retryable: state.status === "running" || state.status === "awaiting_checkpoint",
186
+ reason: state.blocker?.code || packet?.summary || latestEvent?.summary || null
187
+ }),
188
+ evidence_contract: compactRecord({
189
+ verification_mode: state.request.verification_mode || nonEmptyString(fullState.verification_mode),
190
+ required,
191
+ artifact_contract: artifactContract,
192
+ proof_plan: compactText(state.proof_contract?.proof_plan || fullState.proof_plan, 600),
193
+ stop_condition: compactText(state.proof_contract?.stop_condition, 400)
194
+ }),
195
+ latest_evidence: compactRecord({
196
+ before_url: nonEmptyString(fullState.before_cdn) || state.before_artifact_url || null,
197
+ prod_url: nonEmptyString(fullState.prod_cdn) || state.prod_artifact_url || null,
198
+ after_url: nonEmptyString(fullState.after_cdn) || state.after_artifact_url || null,
199
+ visual_delta: visualDelta || null,
200
+ evidence_issue_code: evidenceIssueCode({ fullRiddleState: fullState, runState: state }) || null,
201
+ proof_evidence_present: fullState.proof_evidence_present === true || Boolean(bundle?.proof_evidence || bundle?.proof_evidence_sample),
202
+ artifacts
203
+ }),
204
+ stop_condition: compactRecord({
205
+ status: state.status,
206
+ terminal: isTerminalStatus(state.status),
207
+ blocker_code: state.blocker?.code || null,
208
+ blocker_message: state.blocker?.message || null,
209
+ proof_decision: state.proof_decision,
210
+ merge_recommendation: state.merge_recommendation,
211
+ monitor_should_continue: !isTerminalStatus(state.status)
212
+ }),
213
+ updated_at: state.updated_at
214
+ };
215
+ }
216
+
50
217
  // src/state.ts
51
218
  var RIDDLE_PROOF_RUN_STATE_VERSION = "riddle-proof.run-state.v1";
52
219
  function timestamp() {
@@ -57,7 +224,7 @@ function createRunId(createdAt) {
57
224
  const entropy = Math.random().toString(36).slice(2, 8) || "run";
58
225
  return `rp_${stamp}_${entropy}`;
59
226
  }
60
- function elapsedMs(start, end) {
227
+ function elapsedMs2(start, end) {
61
228
  const startMs = start ? Date.parse(start) : NaN;
62
229
  const endMs = end ? Date.parse(end) : NaN;
63
230
  if (!Number.isFinite(startMs) || !Number.isFinite(endMs)) return void 0;
@@ -173,6 +340,7 @@ function createRunState(input) {
173
340
  checkpoint_summary: input.checkpoint_summary,
174
341
  state_paths: input.state_paths,
175
342
  proof_contract: input.proof_contract,
343
+ run_card: input.run_card,
176
344
  checkpoint_history: input.checkpoint_history,
177
345
  events: input.events ? [...input.events] : []
178
346
  });
@@ -211,8 +379,8 @@ function appendStageHeartbeat(state, input) {
211
379
  stage: input.stage,
212
380
  summary: input.summary || `${input.stage} stage is active.`,
213
381
  details: compactRecord({
214
- elapsed_ms: elapsedMs(state.created_at, at),
215
- stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
382
+ elapsed_ms: elapsedMs2(state.created_at, at),
383
+ stage_elapsed_ms: elapsedMs2(state.stage_started_at, at),
216
384
  wait_reason: input.wait_reason,
217
385
  blocker: input.blocker,
218
386
  ...input.details
@@ -244,13 +412,14 @@ function createRunStatusSnapshot(state, at = timestamp()) {
244
412
  iterations: state.iterations,
245
413
  last_checkpoint: state.last_checkpoint ?? null,
246
414
  updated_at: state.updated_at,
247
- elapsed_ms: elapsedMs(state.created_at, at),
248
- stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
415
+ elapsed_ms: elapsedMs2(state.created_at, at),
416
+ stage_elapsed_ms: elapsedMs2(state.stage_started_at, at),
249
417
  blocker: state.blocker,
250
418
  checkpoint_packet: state.checkpoint_packet,
251
419
  checkpoint_summary: state.checkpoint_summary,
252
420
  state_paths: state.state_paths,
253
421
  proof_contract: state.proof_contract,
422
+ run_card: createRiddleProofRunCard(state, { at }),
254
423
  latest_event: latestEvent
255
424
  });
256
425
  }
package/dist/state.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { RiddleProofRunParams, RiddleProofStatus, RiddleProofStage, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStatePaths, RiddleProofProofContract, RiddleProofCheckpointResponse, RiddleProofEvent, RiddleProofRunState, RiddleProofPrLifecycleState, RiddleProofRunStatusSnapshot, IntegrationContext } from './types.cjs';
1
+ import { RiddleProofRunParams, RiddleProofStatus, RiddleProofStage, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStatePaths, RiddleProofProofContract, RiddleProofRunCard, RiddleProofCheckpointResponse, RiddleProofEvent, RiddleProofRunState, RiddleProofPrLifecycleState, RiddleProofRunStatusSnapshot, IntegrationContext } from './types.cjs';
2
2
 
3
3
  declare const RIDDLE_PROOF_RUN_STATE_VERSION: "riddle-proof.run-state.v1";
4
4
  interface CreateRunStateInput {
@@ -18,6 +18,7 @@ interface CreateRunStateInput {
18
18
  checkpoint_summary?: RiddleProofCheckpointSummary;
19
19
  state_paths?: RiddleProofStatePaths;
20
20
  proof_contract?: RiddleProofProofContract;
21
+ run_card?: RiddleProofRunCard;
21
22
  checkpoint_history?: Array<{
22
23
  ts: string;
23
24
  packet?: RiddleProofCheckpointPacket;
package/dist/state.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { RiddleProofRunParams, RiddleProofStatus, RiddleProofStage, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStatePaths, RiddleProofProofContract, RiddleProofCheckpointResponse, RiddleProofEvent, RiddleProofRunState, RiddleProofPrLifecycleState, RiddleProofRunStatusSnapshot, IntegrationContext } from './types.js';
1
+ import { RiddleProofRunParams, RiddleProofStatus, RiddleProofStage, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStatePaths, RiddleProofProofContract, RiddleProofRunCard, RiddleProofCheckpointResponse, RiddleProofEvent, RiddleProofRunState, RiddleProofPrLifecycleState, RiddleProofRunStatusSnapshot, IntegrationContext } from './types.js';
2
2
 
3
3
  declare const RIDDLE_PROOF_RUN_STATE_VERSION: "riddle-proof.run-state.v1";
4
4
  interface CreateRunStateInput {
@@ -18,6 +18,7 @@ interface CreateRunStateInput {
18
18
  checkpoint_summary?: RiddleProofCheckpointSummary;
19
19
  state_paths?: RiddleProofStatePaths;
20
20
  proof_contract?: RiddleProofProofContract;
21
+ run_card?: RiddleProofRunCard;
21
22
  checkpoint_history?: Array<{
22
23
  ts: string;
23
24
  packet?: RiddleProofCheckpointPacket;
package/dist/state.js CHANGED
@@ -9,8 +9,10 @@ import {
9
9
  normalizePrLifecycleState,
10
10
  normalizeRunParams,
11
11
  setRunStatus
12
- } from "./chunk-7S7O3NKF.js";
13
- import "./chunk-W7VTDN4T.js";
12
+ } from "./chunk-JTNMEH57.js";
13
+ import "./chunk-PLSGW2GI.js";
14
+ import "./chunk-R6SCWJCI.js";
15
+ import "./chunk-DUFDZJOF.js";
14
16
  export {
15
17
  RIDDLE_PROOF_RUN_STATE_VERSION,
16
18
  appendRunEvent,
package/dist/types.d.cts CHANGED
@@ -74,7 +74,7 @@ interface RiddleProofCheckpointPacket {
74
74
  state_path?: string;
75
75
  stage: RiddleProofStage;
76
76
  checkpoint: string;
77
- kind: "assess_recon" | "author_proof" | "implement_change" | "assess_proof" | "human_review" | "advance_decision" | (string & {});
77
+ kind: "assess_recon" | "author_proof" | "implement_change" | "assess_proof" | "recover_evidence" | "human_review" | "advance_decision" | (string & {});
78
78
  summary: string;
79
79
  question: string;
80
80
  change_request: string;
@@ -152,6 +152,64 @@ interface RiddleProofProofContract {
152
152
  payload?: Record<string, unknown>;
153
153
  created_at: string;
154
154
  }
155
+ interface RiddleProofRunCard {
156
+ version: "riddle-proof.run-card.v1";
157
+ run_id: string;
158
+ status: RiddleProofStatus;
159
+ goal: {
160
+ repo?: string;
161
+ branch?: string;
162
+ change_request?: string;
163
+ verification_mode?: RiddleProofVerificationMode;
164
+ success_criteria?: string;
165
+ };
166
+ durable_state: RiddleProofStatePaths & {
167
+ worktree_path?: string | null;
168
+ branch?: string | null;
169
+ };
170
+ current_phase: {
171
+ stage?: RiddleProofStage | null;
172
+ checkpoint?: string | null;
173
+ latest_event?: string | null;
174
+ elapsed_ms?: number;
175
+ stage_elapsed_ms?: number;
176
+ iterations?: number;
177
+ };
178
+ owner_next_action: {
179
+ owner?: string;
180
+ action?: string;
181
+ checkpoint_kind?: string | null;
182
+ allowed_decisions?: string[];
183
+ retryable?: boolean;
184
+ reason?: string | null;
185
+ };
186
+ evidence_contract: {
187
+ verification_mode?: RiddleProofVerificationMode;
188
+ required?: Record<string, unknown>;
189
+ artifact_contract?: Record<string, unknown>;
190
+ proof_plan?: string;
191
+ stop_condition?: string;
192
+ };
193
+ latest_evidence: {
194
+ before_url?: string | null;
195
+ prod_url?: string | null;
196
+ after_url?: string | null;
197
+ visual_delta?: Record<string, unknown> | null;
198
+ evidence_issue_code?: string | null;
199
+ proof_evidence_present?: boolean;
200
+ artifacts?: RiddleProofCheckpointArtifact[];
201
+ };
202
+ stop_condition: {
203
+ status: RiddleProofStatus;
204
+ terminal?: boolean;
205
+ blocker_code?: string | null;
206
+ blocker_message?: string | null;
207
+ proof_decision?: RiddleProofDecision;
208
+ merge_recommendation?: string;
209
+ monitor_should_continue?: boolean;
210
+ };
211
+ updated_at: string;
212
+ }
155
213
  interface IntegrationContext {
156
214
  source?: "openclaw" | "discord" | "github" | "cli" | "riddle" | (string & {});
157
215
  channel_id?: string;
@@ -217,6 +275,7 @@ interface RiddleProofRunState {
217
275
  checkpoint_summary?: RiddleProofCheckpointSummary;
218
276
  state_paths?: RiddleProofStatePaths;
219
277
  proof_contract?: RiddleProofProofContract;
278
+ run_card?: RiddleProofRunCard;
220
279
  checkpoint_history?: Array<{
221
280
  ts: string;
222
281
  packet?: RiddleProofCheckpointPacket;
@@ -261,6 +320,7 @@ interface RiddleProofRunResult {
261
320
  checkpoint_summary?: RiddleProofCheckpointSummary;
262
321
  state_paths?: RiddleProofStatePaths;
263
322
  proof_contract?: RiddleProofProofContract;
323
+ run_card?: RiddleProofRunCard;
264
324
  proof_session?: RiddleProofVisualSession;
265
325
  evidence_bundle?: RiddleProofEvidenceBundle;
266
326
  raw?: Record<string, unknown>;
@@ -296,6 +356,7 @@ interface RiddleProofRunStatusSnapshot {
296
356
  checkpoint_summary?: RiddleProofCheckpointSummary;
297
357
  state_paths?: RiddleProofStatePaths;
298
358
  proof_contract?: RiddleProofProofContract;
359
+ run_card?: RiddleProofRunCard;
299
360
  latest_event?: RiddleProofEvent;
300
361
  }
301
362
  interface RiddleProofEvidenceBundle {
@@ -516,4 +577,4 @@ interface RiddleProofVisualSessionFingerprintBasis {
516
577
  capture_script_hash?: string;
517
578
  }
518
579
 
519
- export type { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter };
580
+ export type { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter };
package/dist/types.d.ts CHANGED
@@ -74,7 +74,7 @@ interface RiddleProofCheckpointPacket {
74
74
  state_path?: string;
75
75
  stage: RiddleProofStage;
76
76
  checkpoint: string;
77
- kind: "assess_recon" | "author_proof" | "implement_change" | "assess_proof" | "human_review" | "advance_decision" | (string & {});
77
+ kind: "assess_recon" | "author_proof" | "implement_change" | "assess_proof" | "recover_evidence" | "human_review" | "advance_decision" | (string & {});
78
78
  summary: string;
79
79
  question: string;
80
80
  change_request: string;
@@ -152,6 +152,64 @@ interface RiddleProofProofContract {
152
152
  payload?: Record<string, unknown>;
153
153
  created_at: string;
154
154
  }
155
+ interface RiddleProofRunCard {
156
+ version: "riddle-proof.run-card.v1";
157
+ run_id: string;
158
+ status: RiddleProofStatus;
159
+ goal: {
160
+ repo?: string;
161
+ branch?: string;
162
+ change_request?: string;
163
+ verification_mode?: RiddleProofVerificationMode;
164
+ success_criteria?: string;
165
+ };
166
+ durable_state: RiddleProofStatePaths & {
167
+ worktree_path?: string | null;
168
+ branch?: string | null;
169
+ };
170
+ current_phase: {
171
+ stage?: RiddleProofStage | null;
172
+ checkpoint?: string | null;
173
+ latest_event?: string | null;
174
+ elapsed_ms?: number;
175
+ stage_elapsed_ms?: number;
176
+ iterations?: number;
177
+ };
178
+ owner_next_action: {
179
+ owner?: string;
180
+ action?: string;
181
+ checkpoint_kind?: string | null;
182
+ allowed_decisions?: string[];
183
+ retryable?: boolean;
184
+ reason?: string | null;
185
+ };
186
+ evidence_contract: {
187
+ verification_mode?: RiddleProofVerificationMode;
188
+ required?: Record<string, unknown>;
189
+ artifact_contract?: Record<string, unknown>;
190
+ proof_plan?: string;
191
+ stop_condition?: string;
192
+ };
193
+ latest_evidence: {
194
+ before_url?: string | null;
195
+ prod_url?: string | null;
196
+ after_url?: string | null;
197
+ visual_delta?: Record<string, unknown> | null;
198
+ evidence_issue_code?: string | null;
199
+ proof_evidence_present?: boolean;
200
+ artifacts?: RiddleProofCheckpointArtifact[];
201
+ };
202
+ stop_condition: {
203
+ status: RiddleProofStatus;
204
+ terminal?: boolean;
205
+ blocker_code?: string | null;
206
+ blocker_message?: string | null;
207
+ proof_decision?: RiddleProofDecision;
208
+ merge_recommendation?: string;
209
+ monitor_should_continue?: boolean;
210
+ };
211
+ updated_at: string;
212
+ }
155
213
  interface IntegrationContext {
156
214
  source?: "openclaw" | "discord" | "github" | "cli" | "riddle" | (string & {});
157
215
  channel_id?: string;
@@ -217,6 +275,7 @@ interface RiddleProofRunState {
217
275
  checkpoint_summary?: RiddleProofCheckpointSummary;
218
276
  state_paths?: RiddleProofStatePaths;
219
277
  proof_contract?: RiddleProofProofContract;
278
+ run_card?: RiddleProofRunCard;
220
279
  checkpoint_history?: Array<{
221
280
  ts: string;
222
281
  packet?: RiddleProofCheckpointPacket;
@@ -261,6 +320,7 @@ interface RiddleProofRunResult {
261
320
  checkpoint_summary?: RiddleProofCheckpointSummary;
262
321
  state_paths?: RiddleProofStatePaths;
263
322
  proof_contract?: RiddleProofProofContract;
323
+ run_card?: RiddleProofRunCard;
264
324
  proof_session?: RiddleProofVisualSession;
265
325
  evidence_bundle?: RiddleProofEvidenceBundle;
266
326
  raw?: Record<string, unknown>;
@@ -296,6 +356,7 @@ interface RiddleProofRunStatusSnapshot {
296
356
  checkpoint_summary?: RiddleProofCheckpointSummary;
297
357
  state_paths?: RiddleProofStatePaths;
298
358
  proof_contract?: RiddleProofProofContract;
359
+ run_card?: RiddleProofRunCard;
299
360
  latest_event?: RiddleProofEvent;
300
361
  }
301
362
  interface RiddleProofEvidenceBundle {
@@ -516,4 +577,4 @@ interface RiddleProofVisualSessionFingerprintBasis {
516
577
  capture_script_hash?: string;
517
578
  }
518
579
 
519
- export type { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter };
580
+ export type { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.5.45",
3
+ "version": "0.5.46",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",
@@ -39,6 +39,11 @@
39
39
  "import": "./dist/checkpoint.js",
40
40
  "require": "./dist/checkpoint.cjs"
41
41
  },
42
+ "./run-card": {
43
+ "types": "./dist/run-card.d.ts",
44
+ "import": "./dist/run-card.js",
45
+ "require": "./dist/run-card.cjs"
46
+ },
42
47
  "./runner": {
43
48
  "types": "./dist/runner.d.ts",
44
49
  "import": "./dist/runner.js",
@@ -49,6 +54,11 @@
49
54
  "import": "./dist/engine-harness.js",
50
55
  "require": "./dist/engine-harness.cjs"
51
56
  },
57
+ "./codex-exec-agent": {
58
+ "types": "./dist/codex-exec-agent.d.ts",
59
+ "import": "./dist/codex-exec-agent.js",
60
+ "require": "./dist/codex-exec-agent.cjs"
61
+ },
52
62
  "./diagnostics": {
53
63
  "types": "./dist/diagnostics.d.ts",
54
64
  "import": "./dist/diagnostics.js",
@@ -80,6 +90,9 @@
80
90
  "require": "./dist/proof-run-engine.cjs"
81
91
  }
82
92
  },
93
+ "bin": {
94
+ "riddle-proof-loop": "./dist/cli.js"
95
+ },
83
96
  "files": [
84
97
  "dist",
85
98
  "lib",
@@ -97,7 +110,7 @@
97
110
  "typescript": "^5.4.5"
98
111
  },
99
112
  "scripts": {
100
- "build": "tsup src/index.ts src/types.ts src/result.ts src/state.ts src/checkpoint.ts src/runner.ts src/engine-harness.ts src/diagnostics.ts src/proof-session.ts src/playability.ts src/openclaw.ts src/proof-run-core.ts src/proof-run-engine.ts --format cjs,esm --dts --out-dir dist --clean",
113
+ "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/cli.ts src/diagnostics.ts src/proof-session.ts src/playability.ts src/openclaw.ts src/proof-run-core.ts src/proof-run-engine.ts --format cjs,esm --dts --out-dir dist --clean",
101
114
  "clean": "rm -rf dist",
102
115
  "lint": "echo 'lint: (not configured)'",
103
116
  "test": "npm run build && node test.js && node proof-run.test.js"