@riddledc/riddle-proof 0.1.1 → 0.3.0

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.
@@ -0,0 +1,22 @@
1
+ import { PreflightAdapter, SetupAdapter, ImplementationAdapter, ProofAdapter, JudgeAdapter, ShipAdapter, NotificationAdapter, RiddleProofRunParams, RiddleProofRunState, RiddleProofRunResult } from './types.cjs';
2
+
3
+ interface RiddleProofRunnerAdapters {
4
+ preflight?: PreflightAdapter;
5
+ setup?: SetupAdapter;
6
+ implementation?: ImplementationAdapter;
7
+ proof?: ProofAdapter;
8
+ judge?: JudgeAdapter;
9
+ ship?: ShipAdapter;
10
+ notification?: NotificationAdapter;
11
+ }
12
+ interface RunRiddleProofInput {
13
+ request: RiddleProofRunParams;
14
+ adapters: RiddleProofRunnerAdapters;
15
+ state?: RiddleProofRunState;
16
+ state_path?: string;
17
+ workdir?: string;
18
+ max_iterations?: number;
19
+ }
20
+ declare function runRiddleProof(input: RunRiddleProofInput): Promise<RiddleProofRunResult>;
21
+
22
+ export { type RiddleProofRunnerAdapters, type RunRiddleProofInput, runRiddleProof };
@@ -0,0 +1,22 @@
1
+ import { PreflightAdapter, SetupAdapter, ImplementationAdapter, ProofAdapter, JudgeAdapter, ShipAdapter, NotificationAdapter, RiddleProofRunParams, RiddleProofRunState, RiddleProofRunResult } from './types.js';
2
+
3
+ interface RiddleProofRunnerAdapters {
4
+ preflight?: PreflightAdapter;
5
+ setup?: SetupAdapter;
6
+ implementation?: ImplementationAdapter;
7
+ proof?: ProofAdapter;
8
+ judge?: JudgeAdapter;
9
+ ship?: ShipAdapter;
10
+ notification?: NotificationAdapter;
11
+ }
12
+ interface RunRiddleProofInput {
13
+ request: RiddleProofRunParams;
14
+ adapters: RiddleProofRunnerAdapters;
15
+ state?: RiddleProofRunState;
16
+ state_path?: string;
17
+ workdir?: string;
18
+ max_iterations?: number;
19
+ }
20
+ declare function runRiddleProof(input: RunRiddleProofInput): Promise<RiddleProofRunResult>;
21
+
22
+ export { type RiddleProofRunnerAdapters, type RunRiddleProofInput, runRiddleProof };
package/dist/runner.js ADDED
@@ -0,0 +1,8 @@
1
+ import {
2
+ runRiddleProof
3
+ } from "./chunk-P3FUU5X4.js";
4
+ import "./chunk-IQIEOQZF.js";
5
+ import "./chunk-5DC6YXN4.js";
6
+ export {
7
+ runRiddleProof
8
+ };
package/dist/state.cjs CHANGED
@@ -22,7 +22,9 @@ var state_exports = {};
22
22
  __export(state_exports, {
23
23
  RIDDLE_PROOF_RUN_STATE_VERSION: () => RIDDLE_PROOF_RUN_STATE_VERSION,
24
24
  appendRunEvent: () => appendRunEvent,
25
+ appendStageHeartbeat: () => appendStageHeartbeat,
25
26
  createRunState: () => createRunState,
27
+ createRunStatusSnapshot: () => createRunStatusSnapshot,
26
28
  normalizeIntegrationContext: () => normalizeIntegrationContext,
27
29
  normalizeRunParams: () => normalizeRunParams,
28
30
  setRunStatus: () => setRunStatus
@@ -45,6 +47,17 @@ var RIDDLE_PROOF_RUN_STATE_VERSION = "riddle-proof.run-state.v1";
45
47
  function timestamp() {
46
48
  return (/* @__PURE__ */ new Date()).toISOString();
47
49
  }
50
+ function createRunId(createdAt) {
51
+ const stamp = createdAt.replace(/\D/g, "").slice(0, 14) || "unknown";
52
+ const entropy = Math.random().toString(36).slice(2, 8) || "run";
53
+ return `rp_${stamp}_${entropy}`;
54
+ }
55
+ function elapsedMs(start, end) {
56
+ const startMs = start ? Date.parse(start) : NaN;
57
+ const endMs = end ? Date.parse(end) : NaN;
58
+ if (!Number.isFinite(startMs) || !Number.isFinite(endMs)) return void 0;
59
+ return Math.max(0, endMs - startMs);
60
+ }
48
61
  function normalizeIntegrationContext(input, fallbackSource) {
49
62
  const value = recordValue(input);
50
63
  if (!value) {
@@ -95,7 +108,12 @@ function createRunState(input) {
95
108
  const createdAt = input.created_at || timestamp();
96
109
  return compactRecord({
97
110
  version: RIDDLE_PROOF_RUN_STATE_VERSION,
111
+ run_id: input.run_id || createRunId(createdAt),
98
112
  state_path: input.state_path,
113
+ worktree_path: input.worktree_path,
114
+ branch: input.branch || input.request.branch,
115
+ current_stage: input.current_stage ?? null,
116
+ stage_started_at: input.stage_started_at ?? null,
99
117
  status: input.status || "running",
100
118
  created_at: createdAt,
101
119
  updated_at: input.updated_at || createdAt,
@@ -123,9 +141,49 @@ function appendRunEvent(state, input) {
123
141
  details: event.details
124
142
  }));
125
143
  if (input.checkpoint !== void 0) state.last_checkpoint = input.checkpoint;
144
+ if (input.stage !== void 0) {
145
+ if (state.current_stage !== input.stage) state.stage_started_at = event.ts;
146
+ state.current_stage = input.stage;
147
+ }
126
148
  state.updated_at = event.ts;
127
149
  return state;
128
150
  }
151
+ function appendStageHeartbeat(state, input) {
152
+ const at = input.ts || timestamp();
153
+ return appendRunEvent(state, {
154
+ ts: at,
155
+ kind: "stage.heartbeat",
156
+ checkpoint: input.checkpoint || `${input.stage}_heartbeat`,
157
+ stage: input.stage,
158
+ summary: input.summary || `${input.stage} stage is active.`,
159
+ details: compactRecord({
160
+ elapsed_ms: elapsedMs(state.created_at, at),
161
+ stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
162
+ wait_reason: input.wait_reason,
163
+ blocker: input.blocker,
164
+ ...input.details
165
+ })
166
+ });
167
+ }
168
+ function createRunStatusSnapshot(state, at = timestamp()) {
169
+ const latestEvent = state.events[state.events.length - 1];
170
+ const runId = state.run_id || "unknown";
171
+ return compactRecord({
172
+ run_id: runId,
173
+ status: state.status,
174
+ current_stage: state.current_stage ?? null,
175
+ state_path: state.state_path ?? null,
176
+ worktree_path: state.worktree_path ?? null,
177
+ branch: state.branch ?? null,
178
+ iterations: state.iterations,
179
+ last_checkpoint: state.last_checkpoint ?? null,
180
+ updated_at: state.updated_at,
181
+ elapsed_ms: elapsedMs(state.created_at, at),
182
+ stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
183
+ blocker: state.blocker,
184
+ latest_event: latestEvent
185
+ });
186
+ }
129
187
  function setRunStatus(state, status, at = timestamp()) {
130
188
  state.status = status;
131
189
  state.ok = status !== "blocked" && status !== "failed";
@@ -136,7 +194,9 @@ function setRunStatus(state, status, at = timestamp()) {
136
194
  0 && (module.exports = {
137
195
  RIDDLE_PROOF_RUN_STATE_VERSION,
138
196
  appendRunEvent,
197
+ appendStageHeartbeat,
139
198
  createRunState,
199
+ createRunStatusSnapshot,
140
200
  normalizeIntegrationContext,
141
201
  normalizeRunParams,
142
202
  setRunStatus
package/dist/state.d.cts CHANGED
@@ -1,10 +1,15 @@
1
- import { RiddleProofRunParams, RiddleProofStatus, RiddleProofEvent, RiddleProofRunState, IntegrationContext } from './types.cjs';
1
+ import { RiddleProofRunParams, RiddleProofStatus, RiddleProofStage, RiddleProofEvent, RiddleProofRunState, 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 {
5
5
  request: RiddleProofRunParams;
6
+ run_id?: string;
6
7
  status?: RiddleProofStatus;
7
8
  state_path?: string;
9
+ worktree_path?: string;
10
+ branch?: string;
11
+ current_stage?: RiddleProofStage | null;
12
+ stage_started_at?: string | null;
8
13
  created_at?: string;
9
14
  updated_at?: string;
10
15
  iterations?: number;
@@ -18,6 +23,16 @@ declare function normalizeIntegrationContext(input?: Partial<IntegrationContext>
18
23
  declare function normalizeRunParams(input: RiddleProofRunParams): RiddleProofRunParams;
19
24
  declare function createRunState(input: CreateRunStateInput): RiddleProofRunState;
20
25
  declare function appendRunEvent<T extends RiddleProofRunState>(state: T, input: RunEventInput): T;
26
+ declare function appendStageHeartbeat<T extends RiddleProofRunState>(state: T, input: {
27
+ stage: RiddleProofStage;
28
+ summary?: string;
29
+ checkpoint?: string;
30
+ wait_reason?: string;
31
+ blocker?: string;
32
+ details?: Record<string, unknown>;
33
+ ts?: string;
34
+ }): T;
35
+ declare function createRunStatusSnapshot(state: RiddleProofRunState, at?: string): RiddleProofRunStatusSnapshot;
21
36
  declare function setRunStatus<T extends RiddleProofRunState>(state: T, status: RiddleProofStatus, at?: string): T;
22
37
 
23
- export { type CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, type RunEventInput, appendRunEvent, createRunState, normalizeIntegrationContext, normalizeRunParams, setRunStatus };
38
+ export { type CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, type RunEventInput, appendRunEvent, appendStageHeartbeat, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizeRunParams, setRunStatus };
package/dist/state.d.ts CHANGED
@@ -1,10 +1,15 @@
1
- import { RiddleProofRunParams, RiddleProofStatus, RiddleProofEvent, RiddleProofRunState, IntegrationContext } from './types.js';
1
+ import { RiddleProofRunParams, RiddleProofStatus, RiddleProofStage, RiddleProofEvent, RiddleProofRunState, 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 {
5
5
  request: RiddleProofRunParams;
6
+ run_id?: string;
6
7
  status?: RiddleProofStatus;
7
8
  state_path?: string;
9
+ worktree_path?: string;
10
+ branch?: string;
11
+ current_stage?: RiddleProofStage | null;
12
+ stage_started_at?: string | null;
8
13
  created_at?: string;
9
14
  updated_at?: string;
10
15
  iterations?: number;
@@ -18,6 +23,16 @@ declare function normalizeIntegrationContext(input?: Partial<IntegrationContext>
18
23
  declare function normalizeRunParams(input: RiddleProofRunParams): RiddleProofRunParams;
19
24
  declare function createRunState(input: CreateRunStateInput): RiddleProofRunState;
20
25
  declare function appendRunEvent<T extends RiddleProofRunState>(state: T, input: RunEventInput): T;
26
+ declare function appendStageHeartbeat<T extends RiddleProofRunState>(state: T, input: {
27
+ stage: RiddleProofStage;
28
+ summary?: string;
29
+ checkpoint?: string;
30
+ wait_reason?: string;
31
+ blocker?: string;
32
+ details?: Record<string, unknown>;
33
+ ts?: string;
34
+ }): T;
35
+ declare function createRunStatusSnapshot(state: RiddleProofRunState, at?: string): RiddleProofRunStatusSnapshot;
21
36
  declare function setRunStatus<T extends RiddleProofRunState>(state: T, status: RiddleProofStatus, at?: string): T;
22
37
 
23
- export { type CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, type RunEventInput, appendRunEvent, createRunState, normalizeIntegrationContext, normalizeRunParams, setRunStatus };
38
+ export { type CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, type RunEventInput, appendRunEvent, appendStageHeartbeat, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizeRunParams, setRunStatus };
package/dist/state.js CHANGED
@@ -1,16 +1,20 @@
1
1
  import {
2
2
  RIDDLE_PROOF_RUN_STATE_VERSION,
3
3
  appendRunEvent,
4
+ appendStageHeartbeat,
4
5
  createRunState,
6
+ createRunStatusSnapshot,
5
7
  normalizeIntegrationContext,
6
8
  normalizeRunParams,
7
9
  setRunStatus
8
- } from "./chunk-EPVZKWUS.js";
9
- import "./chunk-2ZQNXVQC.js";
10
+ } from "./chunk-IQIEOQZF.js";
11
+ import "./chunk-5DC6YXN4.js";
10
12
  export {
11
13
  RIDDLE_PROOF_RUN_STATE_VERSION,
12
14
  appendRunEvent,
15
+ appendStageHeartbeat,
13
16
  createRunState,
17
+ createRunStatusSnapshot,
14
18
  normalizeIntegrationContext,
15
19
  normalizeRunParams,
16
20
  setRunStatus
package/dist/types.d.cts CHANGED
@@ -6,7 +6,8 @@ type JsonObject = {
6
6
  type RiddleProofStatus = "running" | "blocked" | "failed" | "ready_to_ship" | "shipped" | "completed";
7
7
  type RiddleProofVerificationMode = "proof" | "visual" | "interaction" | "render" | "data" | "json" | "audio" | "log" | "logs" | "metric" | "metrics" | (string & {});
8
8
  type RiddleProofDecision = "ready_to_ship" | "needs_richer_proof" | "revise_capture" | "needs_recon" | "needs_implementation" | (string & {});
9
- type RiddleProofStage = "setup" | "recon" | "author" | "implement" | "verify" | "ship" | (string & {});
9
+ type RiddleProofStage = "preflight" | "setup" | "recon" | "author" | "implement" | "prove" | "verify" | "ship" | "notify" | (string & {});
10
+ type RiddleProofArtifactRole = "baseline" | "after_proof" | "incidental" | "diagnostic" | (string & {});
10
11
  interface RiddleProofRunParams {
11
12
  repo?: string;
12
13
  branch?: string;
@@ -60,7 +61,12 @@ interface RiddleProofEvent {
60
61
  }
61
62
  interface RiddleProofRunState {
62
63
  version: "riddle-proof.run-state.v1";
64
+ run_id?: string;
63
65
  state_path?: string;
66
+ worktree_path?: string;
67
+ branch?: string;
68
+ current_stage?: RiddleProofStage | null;
69
+ stage_started_at?: string | null;
64
70
  status: RiddleProofStatus;
65
71
  ok?: boolean;
66
72
  created_at: string;
@@ -80,7 +86,11 @@ interface RiddleProofRunState {
80
86
  interface RiddleProofRunResult {
81
87
  ok: boolean;
82
88
  status: RiddleProofStatus;
89
+ run_id?: string;
83
90
  state_path?: string | null;
91
+ worktree_path?: string | null;
92
+ branch?: string | null;
93
+ current_stage?: RiddleProofStage | null;
84
94
  iterations?: number;
85
95
  last_checkpoint?: string | null;
86
96
  last_summary?: string | null;
@@ -95,6 +105,21 @@ interface RiddleProofRunResult {
95
105
  evidence_bundle?: RiddleProofEvidenceBundle;
96
106
  raw?: Record<string, unknown>;
97
107
  }
108
+ interface RiddleProofRunStatusSnapshot {
109
+ run_id: string;
110
+ status: RiddleProofStatus;
111
+ current_stage?: RiddleProofStage | null;
112
+ state_path?: string | null;
113
+ worktree_path?: string | null;
114
+ branch?: string | null;
115
+ iterations: number;
116
+ last_checkpoint?: string | null;
117
+ updated_at: string;
118
+ elapsed_ms?: number;
119
+ stage_elapsed_ms?: number;
120
+ blocker?: RiddleProofBlocker;
121
+ latest_event?: RiddleProofEvent;
122
+ }
98
123
  interface RiddleProofEvidenceBundle {
99
124
  verification_mode: RiddleProofVerificationMode;
100
125
  baselines?: EvidenceReference[];
@@ -108,6 +133,7 @@ interface RiddleProofEvidenceBundle {
108
133
  }
109
134
  interface EvidenceReference {
110
135
  kind: "before" | "prod" | "after" | "comparison" | (string & {});
136
+ role?: RiddleProofArtifactRole;
111
137
  url?: string;
112
138
  path?: string;
113
139
  observed_path?: string;
@@ -117,6 +143,7 @@ interface EvidenceReference {
117
143
  interface EvidenceArtifact {
118
144
  name: string;
119
145
  kind?: "screenshot" | "json" | "log" | "metric" | "audio" | "video" | (string & {});
146
+ role?: RiddleProofArtifactRole;
120
147
  url?: string;
121
148
  path?: string;
122
149
  content_type?: string;
@@ -132,6 +159,37 @@ interface RiddleProofAssessment {
132
159
  reasons?: string[];
133
160
  source?: "supervising_agent" | "supervisor" | "human" | (string & {});
134
161
  }
162
+ interface PreflightAdapterInput {
163
+ request: RiddleProofRunParams;
164
+ state: RiddleProofRunState;
165
+ }
166
+ interface PreflightAdapterResult {
167
+ ok: boolean;
168
+ warnings?: string[];
169
+ degraded_capabilities?: string[];
170
+ blockers?: string[];
171
+ raw?: Record<string, unknown>;
172
+ }
173
+ interface PreflightAdapter {
174
+ preflight(input: PreflightAdapterInput): Promise<PreflightAdapterResult>;
175
+ }
176
+ interface SetupAdapterInput {
177
+ request: RiddleProofRunParams;
178
+ state: RiddleProofRunState;
179
+ }
180
+ interface SetupAdapterResult {
181
+ ok: boolean;
182
+ workdir?: string;
183
+ worktree_path?: string;
184
+ branch?: string;
185
+ cleanup_policy?: "reuse" | "delete_on_success" | "delete_on_finish" | "leave_for_debug" | (string & {});
186
+ evidence_context?: RiddleProofEvidenceBundle;
187
+ blockers?: string[];
188
+ raw?: Record<string, unknown>;
189
+ }
190
+ interface SetupAdapter {
191
+ setup(input: SetupAdapterInput): Promise<SetupAdapterResult>;
192
+ }
135
193
  interface ImplementationAdapterInput {
136
194
  workdir: string;
137
195
  change_request: string;
@@ -149,6 +207,20 @@ interface ImplementationAdapterResult {
149
207
  interface ImplementationAdapter {
150
208
  implement(input: ImplementationAdapterInput): Promise<ImplementationAdapterResult>;
151
209
  }
210
+ interface ProofAdapterInput {
211
+ state: RiddleProofRunState;
212
+ implementation?: ImplementationAdapterResult;
213
+ evidence_context?: RiddleProofEvidenceBundle;
214
+ }
215
+ interface ProofAdapterResult {
216
+ ok: boolean;
217
+ evidence_bundle?: RiddleProofEvidenceBundle;
218
+ blockers?: string[];
219
+ raw?: Record<string, unknown>;
220
+ }
221
+ interface ProofAdapter {
222
+ prove(input: ProofAdapterInput): Promise<ProofAdapterResult>;
223
+ }
152
224
  interface JudgeAdapter {
153
225
  assessProof(input: {
154
226
  state: RiddleProofRunState;
@@ -176,4 +248,4 @@ interface RiddleProofTerminalMetadata {
176
248
  finalized?: boolean;
177
249
  }
178
250
 
179
- export type { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, RiddleProofAssessment, RiddleProofBlocker, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofStage, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, ShipAdapter };
251
+ export type { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter };
package/dist/types.d.ts CHANGED
@@ -6,7 +6,8 @@ type JsonObject = {
6
6
  type RiddleProofStatus = "running" | "blocked" | "failed" | "ready_to_ship" | "shipped" | "completed";
7
7
  type RiddleProofVerificationMode = "proof" | "visual" | "interaction" | "render" | "data" | "json" | "audio" | "log" | "logs" | "metric" | "metrics" | (string & {});
8
8
  type RiddleProofDecision = "ready_to_ship" | "needs_richer_proof" | "revise_capture" | "needs_recon" | "needs_implementation" | (string & {});
9
- type RiddleProofStage = "setup" | "recon" | "author" | "implement" | "verify" | "ship" | (string & {});
9
+ type RiddleProofStage = "preflight" | "setup" | "recon" | "author" | "implement" | "prove" | "verify" | "ship" | "notify" | (string & {});
10
+ type RiddleProofArtifactRole = "baseline" | "after_proof" | "incidental" | "diagnostic" | (string & {});
10
11
  interface RiddleProofRunParams {
11
12
  repo?: string;
12
13
  branch?: string;
@@ -60,7 +61,12 @@ interface RiddleProofEvent {
60
61
  }
61
62
  interface RiddleProofRunState {
62
63
  version: "riddle-proof.run-state.v1";
64
+ run_id?: string;
63
65
  state_path?: string;
66
+ worktree_path?: string;
67
+ branch?: string;
68
+ current_stage?: RiddleProofStage | null;
69
+ stage_started_at?: string | null;
64
70
  status: RiddleProofStatus;
65
71
  ok?: boolean;
66
72
  created_at: string;
@@ -80,7 +86,11 @@ interface RiddleProofRunState {
80
86
  interface RiddleProofRunResult {
81
87
  ok: boolean;
82
88
  status: RiddleProofStatus;
89
+ run_id?: string;
83
90
  state_path?: string | null;
91
+ worktree_path?: string | null;
92
+ branch?: string | null;
93
+ current_stage?: RiddleProofStage | null;
84
94
  iterations?: number;
85
95
  last_checkpoint?: string | null;
86
96
  last_summary?: string | null;
@@ -95,6 +105,21 @@ interface RiddleProofRunResult {
95
105
  evidence_bundle?: RiddleProofEvidenceBundle;
96
106
  raw?: Record<string, unknown>;
97
107
  }
108
+ interface RiddleProofRunStatusSnapshot {
109
+ run_id: string;
110
+ status: RiddleProofStatus;
111
+ current_stage?: RiddleProofStage | null;
112
+ state_path?: string | null;
113
+ worktree_path?: string | null;
114
+ branch?: string | null;
115
+ iterations: number;
116
+ last_checkpoint?: string | null;
117
+ updated_at: string;
118
+ elapsed_ms?: number;
119
+ stage_elapsed_ms?: number;
120
+ blocker?: RiddleProofBlocker;
121
+ latest_event?: RiddleProofEvent;
122
+ }
98
123
  interface RiddleProofEvidenceBundle {
99
124
  verification_mode: RiddleProofVerificationMode;
100
125
  baselines?: EvidenceReference[];
@@ -108,6 +133,7 @@ interface RiddleProofEvidenceBundle {
108
133
  }
109
134
  interface EvidenceReference {
110
135
  kind: "before" | "prod" | "after" | "comparison" | (string & {});
136
+ role?: RiddleProofArtifactRole;
111
137
  url?: string;
112
138
  path?: string;
113
139
  observed_path?: string;
@@ -117,6 +143,7 @@ interface EvidenceReference {
117
143
  interface EvidenceArtifact {
118
144
  name: string;
119
145
  kind?: "screenshot" | "json" | "log" | "metric" | "audio" | "video" | (string & {});
146
+ role?: RiddleProofArtifactRole;
120
147
  url?: string;
121
148
  path?: string;
122
149
  content_type?: string;
@@ -132,6 +159,37 @@ interface RiddleProofAssessment {
132
159
  reasons?: string[];
133
160
  source?: "supervising_agent" | "supervisor" | "human" | (string & {});
134
161
  }
162
+ interface PreflightAdapterInput {
163
+ request: RiddleProofRunParams;
164
+ state: RiddleProofRunState;
165
+ }
166
+ interface PreflightAdapterResult {
167
+ ok: boolean;
168
+ warnings?: string[];
169
+ degraded_capabilities?: string[];
170
+ blockers?: string[];
171
+ raw?: Record<string, unknown>;
172
+ }
173
+ interface PreflightAdapter {
174
+ preflight(input: PreflightAdapterInput): Promise<PreflightAdapterResult>;
175
+ }
176
+ interface SetupAdapterInput {
177
+ request: RiddleProofRunParams;
178
+ state: RiddleProofRunState;
179
+ }
180
+ interface SetupAdapterResult {
181
+ ok: boolean;
182
+ workdir?: string;
183
+ worktree_path?: string;
184
+ branch?: string;
185
+ cleanup_policy?: "reuse" | "delete_on_success" | "delete_on_finish" | "leave_for_debug" | (string & {});
186
+ evidence_context?: RiddleProofEvidenceBundle;
187
+ blockers?: string[];
188
+ raw?: Record<string, unknown>;
189
+ }
190
+ interface SetupAdapter {
191
+ setup(input: SetupAdapterInput): Promise<SetupAdapterResult>;
192
+ }
135
193
  interface ImplementationAdapterInput {
136
194
  workdir: string;
137
195
  change_request: string;
@@ -149,6 +207,20 @@ interface ImplementationAdapterResult {
149
207
  interface ImplementationAdapter {
150
208
  implement(input: ImplementationAdapterInput): Promise<ImplementationAdapterResult>;
151
209
  }
210
+ interface ProofAdapterInput {
211
+ state: RiddleProofRunState;
212
+ implementation?: ImplementationAdapterResult;
213
+ evidence_context?: RiddleProofEvidenceBundle;
214
+ }
215
+ interface ProofAdapterResult {
216
+ ok: boolean;
217
+ evidence_bundle?: RiddleProofEvidenceBundle;
218
+ blockers?: string[];
219
+ raw?: Record<string, unknown>;
220
+ }
221
+ interface ProofAdapter {
222
+ prove(input: ProofAdapterInput): Promise<ProofAdapterResult>;
223
+ }
152
224
  interface JudgeAdapter {
153
225
  assessProof(input: {
154
226
  state: RiddleProofRunState;
@@ -176,4 +248,4 @@ interface RiddleProofTerminalMetadata {
176
248
  finalized?: boolean;
177
249
  }
178
250
 
179
- export type { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, RiddleProofAssessment, RiddleProofBlocker, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofStage, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, ShipAdapter };
251
+ export type { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.1.1",
3
+ "version": "0.3.0",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",
@@ -34,6 +34,11 @@
34
34
  "import": "./dist/state.js",
35
35
  "require": "./dist/state.cjs"
36
36
  },
37
+ "./runner": {
38
+ "types": "./dist/runner.d.ts",
39
+ "import": "./dist/runner.js",
40
+ "require": "./dist/runner.cjs"
41
+ },
37
42
  "./openclaw": {
38
43
  "types": "./dist/openclaw.d.ts",
39
44
  "import": "./dist/openclaw.js",
@@ -55,7 +60,7 @@
55
60
  "typescript": "^5.4.5"
56
61
  },
57
62
  "scripts": {
58
- "build": "tsup src/index.ts src/types.ts src/result.ts src/state.ts src/openclaw.ts --format cjs,esm --dts --out-dir dist --clean",
63
+ "build": "tsup src/index.ts src/types.ts src/result.ts src/state.ts src/runner.ts src/openclaw.ts --format cjs,esm --dts --out-dir dist --clean",
59
64
  "clean": "rm -rf dist",
60
65
  "lint": "echo 'lint: (not configured)'",
61
66
  "test": "npm run build && node test.js"