@riddledc/riddle-proof 0.2.0 → 0.4.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.
- package/README.md +10 -3
- package/dist/{chunk-2ZQNXVQC.js → chunk-5DC6YXN4.js} +4 -0
- package/dist/{chunk-EPVZKWUS.js → chunk-5FHUOSNO.js} +64 -1
- package/dist/{chunk-GWGXPNON.js → chunk-F65YYXVO.js} +92 -4
- package/dist/chunk-US63AYQU.js +684 -0
- package/dist/engine-harness.cjs +924 -0
- package/dist/engine-harness.d.cts +68 -0
- package/dist/engine-harness.d.ts +68 -0
- package/dist/engine-harness.js +12 -0
- package/dist/index.cjs +829 -2
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +15 -3
- package/dist/openclaw.cjs +10 -0
- package/dist/openclaw.d.cts +5 -0
- package/dist/openclaw.d.ts +5 -0
- package/dist/openclaw.js +7 -2
- package/dist/result.cjs +4 -0
- package/dist/result.js +1 -1
- package/dist/runner.cjs +135 -2
- package/dist/runner.d.cts +2 -1
- package/dist/runner.d.ts +2 -1
- package/dist/runner.js +3 -3
- package/dist/state.cjs +65 -0
- package/dist/state.d.cts +17 -2
- package/dist/state.d.ts +17 -2
- package/dist/state.js +6 -2
- package/dist/types.d.cts +51 -2
- package/dist/types.d.ts +51 -2
- package/package.json +7 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofAssessment, RiddleProofBlocker, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofStage, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from './types.cjs';
|
|
1
|
+
export { 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 } from './types.cjs';
|
|
2
2
|
export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from './result.cjs';
|
|
3
|
-
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, createRunState, normalizeIntegrationContext, normalizeRunParams, setRunStatus } from './state.cjs';
|
|
3
|
+
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizeRunParams, setRunStatus } from './state.cjs';
|
|
4
4
|
export { RiddleProofRunnerAdapters, RunRiddleProofInput, runRiddleProof } from './runner.cjs';
|
|
5
|
+
export { RiddleProofAgentAdapter, RiddleProofAgentPayload, RiddleProofEngine, RiddleProofEngineHarnessConfig, RiddleProofEngineHarnessContext, RiddleProofEngineResult, RiddleProofShipMode, RiddleProofWorkflowParams, RunRiddleProofEngineHarnessInput, createDisabledRiddleProofAgentAdapter, readRiddleProofRunStatus, runRiddleProofEngineHarness } from './engine-harness.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofAssessment, RiddleProofBlocker, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofStage, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from './types.js';
|
|
1
|
+
export { 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 } from './types.js';
|
|
2
2
|
export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from './result.js';
|
|
3
|
-
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, createRunState, normalizeIntegrationContext, normalizeRunParams, setRunStatus } from './state.js';
|
|
3
|
+
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizeRunParams, setRunStatus } from './state.js';
|
|
4
4
|
export { RiddleProofRunnerAdapters, RunRiddleProofInput, runRiddleProof } from './runner.js';
|
|
5
|
+
export { RiddleProofAgentAdapter, RiddleProofAgentPayload, RiddleProofEngine, RiddleProofEngineHarnessConfig, RiddleProofEngineHarnessContext, RiddleProofEngineResult, RiddleProofShipMode, RiddleProofWorkflowParams, RunRiddleProofEngineHarnessInput, createDisabledRiddleProofAgentAdapter, readRiddleProofRunStatus, runRiddleProofEngineHarness } from './engine-harness.js';
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDisabledRiddleProofAgentAdapter,
|
|
3
|
+
readRiddleProofRunStatus,
|
|
4
|
+
runRiddleProofEngineHarness
|
|
5
|
+
} from "./chunk-US63AYQU.js";
|
|
1
6
|
import {
|
|
2
7
|
runRiddleProof
|
|
3
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-F65YYXVO.js";
|
|
4
9
|
import {
|
|
5
10
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
6
11
|
appendRunEvent,
|
|
12
|
+
appendStageHeartbeat,
|
|
7
13
|
createRunState,
|
|
14
|
+
createRunStatusSnapshot,
|
|
8
15
|
normalizeIntegrationContext,
|
|
9
16
|
normalizeRunParams,
|
|
10
17
|
setRunStatus
|
|
11
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-5FHUOSNO.js";
|
|
12
19
|
import {
|
|
13
20
|
applyTerminalMetadata,
|
|
14
21
|
compactRecord,
|
|
@@ -18,22 +25,27 @@ import {
|
|
|
18
25
|
nonEmptyString,
|
|
19
26
|
normalizeTerminalMetadata,
|
|
20
27
|
recordValue
|
|
21
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-5DC6YXN4.js";
|
|
22
29
|
import "./chunk-6F4PWJZI.js";
|
|
23
30
|
export {
|
|
24
31
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
25
32
|
appendRunEvent,
|
|
33
|
+
appendStageHeartbeat,
|
|
26
34
|
applyTerminalMetadata,
|
|
27
35
|
compactRecord,
|
|
36
|
+
createDisabledRiddleProofAgentAdapter,
|
|
28
37
|
createRunResult,
|
|
29
38
|
createRunState,
|
|
39
|
+
createRunStatusSnapshot,
|
|
30
40
|
isSuccessfulStatus,
|
|
31
41
|
isTerminalStatus,
|
|
32
42
|
nonEmptyString,
|
|
33
43
|
normalizeIntegrationContext,
|
|
34
44
|
normalizeRunParams,
|
|
35
45
|
normalizeTerminalMetadata,
|
|
46
|
+
readRiddleProofRunStatus,
|
|
36
47
|
recordValue,
|
|
37
48
|
runRiddleProof,
|
|
49
|
+
runRiddleProofEngineHarness,
|
|
38
50
|
setRunStatus
|
|
39
51
|
};
|
package/dist/openclaw.cjs
CHANGED
|
@@ -81,6 +81,11 @@ function normalizeRunParams(input) {
|
|
|
81
81
|
color_scheme: input.color_scheme,
|
|
82
82
|
wait_for_selector: input.wait_for_selector,
|
|
83
83
|
ship_mode: input.ship_mode,
|
|
84
|
+
engine_state_path: input.engine_state_path,
|
|
85
|
+
harness_state_path: input.harness_state_path,
|
|
86
|
+
max_iterations: input.max_iterations,
|
|
87
|
+
auto_approve: input.auto_approve,
|
|
88
|
+
dry_run: input.dry_run,
|
|
84
89
|
integration_context: normalizeIntegrationContext(input.integration_context)
|
|
85
90
|
});
|
|
86
91
|
}
|
|
@@ -139,6 +144,11 @@ function toRiddleProofRunParams(params) {
|
|
|
139
144
|
color_scheme: params.color_scheme,
|
|
140
145
|
wait_for_selector: params.wait_for_selector,
|
|
141
146
|
ship_mode: params.ship_mode || (params.ship_after_verify ? "ship" : void 0),
|
|
147
|
+
engine_state_path: params.state_path,
|
|
148
|
+
harness_state_path: params.harness_state_path,
|
|
149
|
+
max_iterations: params.max_iterations,
|
|
150
|
+
auto_approve: params.auto_approve,
|
|
151
|
+
dry_run: params.dry_run,
|
|
142
152
|
integration_context: openClawIntegrationContext(params)
|
|
143
153
|
});
|
|
144
154
|
}
|
package/dist/openclaw.d.cts
CHANGED
|
@@ -28,6 +28,11 @@ interface OpenClawProofedChangeParams {
|
|
|
28
28
|
wait_for_selector?: string;
|
|
29
29
|
ship_after_verify?: boolean;
|
|
30
30
|
ship_mode?: "none" | "ship";
|
|
31
|
+
state_path?: string;
|
|
32
|
+
harness_state_path?: string;
|
|
33
|
+
max_iterations?: number;
|
|
34
|
+
auto_approve?: boolean;
|
|
35
|
+
dry_run?: boolean;
|
|
31
36
|
discord_channel?: string;
|
|
32
37
|
discord_thread_id?: string;
|
|
33
38
|
discord_message_id?: string;
|
package/dist/openclaw.d.ts
CHANGED
|
@@ -28,6 +28,11 @@ interface OpenClawProofedChangeParams {
|
|
|
28
28
|
wait_for_selector?: string;
|
|
29
29
|
ship_after_verify?: boolean;
|
|
30
30
|
ship_mode?: "none" | "ship";
|
|
31
|
+
state_path?: string;
|
|
32
|
+
harness_state_path?: string;
|
|
33
|
+
max_iterations?: number;
|
|
34
|
+
auto_approve?: boolean;
|
|
35
|
+
dry_run?: boolean;
|
|
31
36
|
discord_channel?: string;
|
|
32
37
|
discord_thread_id?: string;
|
|
33
38
|
discord_message_id?: string;
|
package/dist/openclaw.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeIntegrationContext,
|
|
3
3
|
normalizeRunParams
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5FHUOSNO.js";
|
|
5
5
|
import {
|
|
6
6
|
compactRecord
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-5DC6YXN4.js";
|
|
8
8
|
|
|
9
9
|
// src/openclaw.ts
|
|
10
10
|
function parseOpenClawAssertions(value) {
|
|
@@ -60,6 +60,11 @@ function toRiddleProofRunParams(params) {
|
|
|
60
60
|
color_scheme: params.color_scheme,
|
|
61
61
|
wait_for_selector: params.wait_for_selector,
|
|
62
62
|
ship_mode: params.ship_mode || (params.ship_after_verify ? "ship" : void 0),
|
|
63
|
+
engine_state_path: params.state_path,
|
|
64
|
+
harness_state_path: params.harness_state_path,
|
|
65
|
+
max_iterations: params.max_iterations,
|
|
66
|
+
auto_approve: params.auto_approve,
|
|
67
|
+
dry_run: params.dry_run,
|
|
63
68
|
integration_context: openClawIntegrationContext(params)
|
|
64
69
|
});
|
|
65
70
|
}
|
package/dist/result.cjs
CHANGED
|
@@ -83,7 +83,11 @@ function createRunResult(input) {
|
|
|
83
83
|
return compactRecord({
|
|
84
84
|
ok,
|
|
85
85
|
status,
|
|
86
|
+
run_id: state.run_id,
|
|
86
87
|
state_path: input.state_path ?? state.state_path ?? null,
|
|
88
|
+
worktree_path: state.worktree_path ?? null,
|
|
89
|
+
branch: state.branch ?? null,
|
|
90
|
+
current_stage: state.current_stage ?? null,
|
|
87
91
|
iterations: state.iterations,
|
|
88
92
|
last_checkpoint: state.last_checkpoint ?? null,
|
|
89
93
|
last_summary: input.last_summary ?? null,
|
package/dist/result.js
CHANGED
package/dist/runner.cjs
CHANGED
|
@@ -59,7 +59,11 @@ function createRunResult(input) {
|
|
|
59
59
|
return compactRecord({
|
|
60
60
|
ok,
|
|
61
61
|
status,
|
|
62
|
+
run_id: state.run_id,
|
|
62
63
|
state_path: input.state_path ?? state.state_path ?? null,
|
|
64
|
+
worktree_path: state.worktree_path ?? null,
|
|
65
|
+
branch: state.branch ?? null,
|
|
66
|
+
current_stage: state.current_stage ?? null,
|
|
63
67
|
iterations: state.iterations,
|
|
64
68
|
last_checkpoint: state.last_checkpoint ?? null,
|
|
65
69
|
last_summary: input.last_summary ?? null,
|
|
@@ -81,6 +85,17 @@ var RIDDLE_PROOF_RUN_STATE_VERSION = "riddle-proof.run-state.v1";
|
|
|
81
85
|
function timestamp() {
|
|
82
86
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
83
87
|
}
|
|
88
|
+
function createRunId(createdAt) {
|
|
89
|
+
const stamp = createdAt.replace(/\D/g, "").slice(0, 14) || "unknown";
|
|
90
|
+
const entropy = Math.random().toString(36).slice(2, 8) || "run";
|
|
91
|
+
return `rp_${stamp}_${entropy}`;
|
|
92
|
+
}
|
|
93
|
+
function elapsedMs(start, end) {
|
|
94
|
+
const startMs = start ? Date.parse(start) : NaN;
|
|
95
|
+
const endMs = end ? Date.parse(end) : NaN;
|
|
96
|
+
if (!Number.isFinite(startMs) || !Number.isFinite(endMs)) return void 0;
|
|
97
|
+
return Math.max(0, endMs - startMs);
|
|
98
|
+
}
|
|
84
99
|
function normalizeIntegrationContext(input, fallbackSource) {
|
|
85
100
|
const value = recordValue(input);
|
|
86
101
|
if (!value) {
|
|
@@ -124,6 +139,11 @@ function normalizeRunParams(input) {
|
|
|
124
139
|
color_scheme: input.color_scheme,
|
|
125
140
|
wait_for_selector: input.wait_for_selector,
|
|
126
141
|
ship_mode: input.ship_mode,
|
|
142
|
+
engine_state_path: input.engine_state_path,
|
|
143
|
+
harness_state_path: input.harness_state_path,
|
|
144
|
+
max_iterations: input.max_iterations,
|
|
145
|
+
auto_approve: input.auto_approve,
|
|
146
|
+
dry_run: input.dry_run,
|
|
127
147
|
integration_context: normalizeIntegrationContext(input.integration_context)
|
|
128
148
|
});
|
|
129
149
|
}
|
|
@@ -131,7 +151,12 @@ function createRunState(input) {
|
|
|
131
151
|
const createdAt = input.created_at || timestamp();
|
|
132
152
|
return compactRecord({
|
|
133
153
|
version: RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
154
|
+
run_id: input.run_id || createRunId(createdAt),
|
|
134
155
|
state_path: input.state_path,
|
|
156
|
+
worktree_path: input.worktree_path,
|
|
157
|
+
branch: input.branch || input.request.branch,
|
|
158
|
+
current_stage: input.current_stage ?? null,
|
|
159
|
+
stage_started_at: input.stage_started_at ?? null,
|
|
135
160
|
status: input.status || "running",
|
|
136
161
|
created_at: createdAt,
|
|
137
162
|
updated_at: input.updated_at || createdAt,
|
|
@@ -159,9 +184,30 @@ function appendRunEvent(state, input) {
|
|
|
159
184
|
details: event.details
|
|
160
185
|
}));
|
|
161
186
|
if (input.checkpoint !== void 0) state.last_checkpoint = input.checkpoint;
|
|
187
|
+
if (input.stage !== void 0) {
|
|
188
|
+
if (state.current_stage !== input.stage) state.stage_started_at = event.ts;
|
|
189
|
+
state.current_stage = input.stage;
|
|
190
|
+
}
|
|
162
191
|
state.updated_at = event.ts;
|
|
163
192
|
return state;
|
|
164
193
|
}
|
|
194
|
+
function appendStageHeartbeat(state, input) {
|
|
195
|
+
const at = input.ts || timestamp();
|
|
196
|
+
return appendRunEvent(state, {
|
|
197
|
+
ts: at,
|
|
198
|
+
kind: "stage.heartbeat",
|
|
199
|
+
checkpoint: input.checkpoint || `${input.stage}_heartbeat`,
|
|
200
|
+
stage: input.stage,
|
|
201
|
+
summary: input.summary || `${input.stage} stage is active.`,
|
|
202
|
+
details: compactRecord({
|
|
203
|
+
elapsed_ms: elapsedMs(state.created_at, at),
|
|
204
|
+
stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
|
|
205
|
+
wait_reason: input.wait_reason,
|
|
206
|
+
blocker: input.blocker,
|
|
207
|
+
...input.details
|
|
208
|
+
})
|
|
209
|
+
});
|
|
210
|
+
}
|
|
165
211
|
function setRunStatus(state, status, at = timestamp()) {
|
|
166
212
|
state.status = status;
|
|
167
213
|
state.ok = status !== "blocked" && status !== "failed";
|
|
@@ -246,7 +292,8 @@ async function notifyIfConfigured(input) {
|
|
|
246
292
|
async function runRiddleProof(input) {
|
|
247
293
|
const state = input.state || createRunState({
|
|
248
294
|
request: input.request,
|
|
249
|
-
state_path: input.state_path
|
|
295
|
+
state_path: input.state_path,
|
|
296
|
+
worktree_path: input.workdir
|
|
250
297
|
});
|
|
251
298
|
const adapters = input.adapters || {};
|
|
252
299
|
const maxIterations = Math.max(1, Math.trunc(input.max_iterations ?? 1));
|
|
@@ -256,12 +303,70 @@ async function runRiddleProof(input) {
|
|
|
256
303
|
stage: "setup",
|
|
257
304
|
summary: "Riddle Proof run started.",
|
|
258
305
|
details: {
|
|
306
|
+
run_id: state.run_id,
|
|
307
|
+
state_path: state.state_path,
|
|
308
|
+
worktree_path: state.worktree_path,
|
|
309
|
+
branch: state.branch,
|
|
259
310
|
max_iterations: maxIterations,
|
|
260
311
|
ship_mode: state.request.ship_mode || "none"
|
|
261
312
|
}
|
|
262
313
|
});
|
|
314
|
+
appendStageHeartbeat(state, {
|
|
315
|
+
stage: "setup",
|
|
316
|
+
summary: "Setup stage is active.",
|
|
317
|
+
details: {
|
|
318
|
+
run_id: state.run_id,
|
|
319
|
+
state_path: state.state_path,
|
|
320
|
+
worktree_path: state.worktree_path,
|
|
321
|
+
branch: state.branch
|
|
322
|
+
}
|
|
323
|
+
});
|
|
263
324
|
let workdir = input.workdir;
|
|
264
325
|
let evidenceContext;
|
|
326
|
+
if (adapters.preflight) {
|
|
327
|
+
appendRunEvent(state, {
|
|
328
|
+
kind: "preflight.started",
|
|
329
|
+
checkpoint: "preflight_started",
|
|
330
|
+
stage: "preflight",
|
|
331
|
+
summary: "Riddle Proof preflight adapter started."
|
|
332
|
+
});
|
|
333
|
+
try {
|
|
334
|
+
const preflight = await adapters.preflight.preflight({ request: state.request, state });
|
|
335
|
+
if (!preflight.ok) {
|
|
336
|
+
return blockRun({
|
|
337
|
+
state,
|
|
338
|
+
stage: "preflight",
|
|
339
|
+
blocker: adapterBlocker(
|
|
340
|
+
"preflight_failed",
|
|
341
|
+
"The preflight adapter found blocking tool or model configuration issues.",
|
|
342
|
+
"preflight_failed",
|
|
343
|
+
{
|
|
344
|
+
blockers: preflight.blockers,
|
|
345
|
+
warnings: preflight.warnings,
|
|
346
|
+
degraded_capabilities: preflight.degraded_capabilities
|
|
347
|
+
}
|
|
348
|
+
),
|
|
349
|
+
raw: { preflight }
|
|
350
|
+
});
|
|
351
|
+
}
|
|
352
|
+
appendRunEvent(state, {
|
|
353
|
+
kind: "preflight.completed",
|
|
354
|
+
checkpoint: "preflight_completed",
|
|
355
|
+
stage: "preflight",
|
|
356
|
+
summary: "Riddle Proof preflight adapter completed.",
|
|
357
|
+
details: {
|
|
358
|
+
warnings: preflight.warnings,
|
|
359
|
+
degraded_capabilities: preflight.degraded_capabilities
|
|
360
|
+
}
|
|
361
|
+
});
|
|
362
|
+
} catch (error) {
|
|
363
|
+
return blockRun({
|
|
364
|
+
state,
|
|
365
|
+
stage: "preflight",
|
|
366
|
+
blocker: adapterBlocker("preflight_exception", "The preflight adapter threw an exception.", "preflight_failed", errorDetails(error))
|
|
367
|
+
});
|
|
368
|
+
}
|
|
369
|
+
}
|
|
265
370
|
if (adapters.setup) {
|
|
266
371
|
appendRunEvent(state, {
|
|
267
372
|
kind: "setup.started",
|
|
@@ -284,7 +389,9 @@ async function runRiddleProof(input) {
|
|
|
284
389
|
raw: { setup }
|
|
285
390
|
});
|
|
286
391
|
}
|
|
287
|
-
workdir = setup.workdir || workdir;
|
|
392
|
+
workdir = setup.worktree_path || setup.workdir || workdir;
|
|
393
|
+
state.worktree_path = setup.worktree_path || setup.workdir || state.worktree_path;
|
|
394
|
+
state.branch = setup.branch || state.branch;
|
|
288
395
|
evidenceContext = setup.evidence_context;
|
|
289
396
|
appendRunEvent(state, {
|
|
290
397
|
kind: "setup.completed",
|
|
@@ -293,6 +400,9 @@ async function runRiddleProof(input) {
|
|
|
293
400
|
summary: "Riddle Proof setup adapter completed.",
|
|
294
401
|
details: {
|
|
295
402
|
has_workdir: Boolean(workdir),
|
|
403
|
+
worktree_path: state.worktree_path,
|
|
404
|
+
branch: state.branch,
|
|
405
|
+
cleanup_policy: setup.cleanup_policy,
|
|
296
406
|
has_evidence_context: Boolean(evidenceContext)
|
|
297
407
|
}
|
|
298
408
|
});
|
|
@@ -345,6 +455,11 @@ async function runRiddleProof(input) {
|
|
|
345
455
|
let assessment;
|
|
346
456
|
for (let attempt = 0; attempt < maxIterations; attempt += 1) {
|
|
347
457
|
state.iterations += 1;
|
|
458
|
+
appendStageHeartbeat(state, {
|
|
459
|
+
stage: "implement",
|
|
460
|
+
summary: "Implementation stage is active.",
|
|
461
|
+
details: { iteration: state.iterations }
|
|
462
|
+
});
|
|
348
463
|
appendRunEvent(state, {
|
|
349
464
|
kind: "implementation.started",
|
|
350
465
|
checkpoint: "implementation_started",
|
|
@@ -391,6 +506,13 @@ async function runRiddleProof(input) {
|
|
|
391
506
|
tests_run: implementation.tests_run
|
|
392
507
|
}
|
|
393
508
|
});
|
|
509
|
+
appendStageHeartbeat(state, {
|
|
510
|
+
stage: "prove",
|
|
511
|
+
summary: "Proof capture stage is active.",
|
|
512
|
+
details: {
|
|
513
|
+
verification_mode: state.request.verification_mode
|
|
514
|
+
}
|
|
515
|
+
});
|
|
394
516
|
appendRunEvent(state, {
|
|
395
517
|
kind: "proof.started",
|
|
396
518
|
checkpoint: "proof_started",
|
|
@@ -440,6 +562,13 @@ async function runRiddleProof(input) {
|
|
|
440
562
|
stage: "verify",
|
|
441
563
|
summary: "Judge adapter started."
|
|
442
564
|
});
|
|
565
|
+
appendStageHeartbeat(state, {
|
|
566
|
+
stage: "verify",
|
|
567
|
+
summary: "Verification stage is active.",
|
|
568
|
+
details: {
|
|
569
|
+
verification_mode: evidenceBundle.verification_mode
|
|
570
|
+
}
|
|
571
|
+
});
|
|
443
572
|
try {
|
|
444
573
|
assessment = await adapters.judge.assessProof({ state, evidence_bundle: evidenceBundle });
|
|
445
574
|
state.proof_decision = assessment.decision;
|
|
@@ -529,6 +658,10 @@ async function runRiddleProof(input) {
|
|
|
529
658
|
stage: "ship",
|
|
530
659
|
summary: "Ship adapter started."
|
|
531
660
|
});
|
|
661
|
+
appendStageHeartbeat(state, {
|
|
662
|
+
stage: "ship",
|
|
663
|
+
summary: "Ship stage is active."
|
|
664
|
+
});
|
|
532
665
|
let metadata;
|
|
533
666
|
try {
|
|
534
667
|
metadata = await adapters.ship.ship({ state, assessment });
|
package/dist/runner.d.cts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SetupAdapter, ImplementationAdapter, ProofAdapter, JudgeAdapter, ShipAdapter, NotificationAdapter, RiddleProofRunParams, RiddleProofRunState, RiddleProofRunResult } from './types.cjs';
|
|
1
|
+
import { PreflightAdapter, SetupAdapter, ImplementationAdapter, ProofAdapter, JudgeAdapter, ShipAdapter, NotificationAdapter, RiddleProofRunParams, RiddleProofRunState, RiddleProofRunResult } from './types.cjs';
|
|
2
2
|
|
|
3
3
|
interface RiddleProofRunnerAdapters {
|
|
4
|
+
preflight?: PreflightAdapter;
|
|
4
5
|
setup?: SetupAdapter;
|
|
5
6
|
implementation?: ImplementationAdapter;
|
|
6
7
|
proof?: ProofAdapter;
|
package/dist/runner.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { SetupAdapter, ImplementationAdapter, ProofAdapter, JudgeAdapter, ShipAdapter, NotificationAdapter, RiddleProofRunParams, RiddleProofRunState, RiddleProofRunResult } from './types.js';
|
|
1
|
+
import { PreflightAdapter, SetupAdapter, ImplementationAdapter, ProofAdapter, JudgeAdapter, ShipAdapter, NotificationAdapter, RiddleProofRunParams, RiddleProofRunState, RiddleProofRunResult } from './types.js';
|
|
2
2
|
|
|
3
3
|
interface RiddleProofRunnerAdapters {
|
|
4
|
+
preflight?: PreflightAdapter;
|
|
4
5
|
setup?: SetupAdapter;
|
|
5
6
|
implementation?: ImplementationAdapter;
|
|
6
7
|
proof?: ProofAdapter;
|
package/dist/runner.js
CHANGED
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) {
|
|
@@ -88,6 +101,11 @@ function normalizeRunParams(input) {
|
|
|
88
101
|
color_scheme: input.color_scheme,
|
|
89
102
|
wait_for_selector: input.wait_for_selector,
|
|
90
103
|
ship_mode: input.ship_mode,
|
|
104
|
+
engine_state_path: input.engine_state_path,
|
|
105
|
+
harness_state_path: input.harness_state_path,
|
|
106
|
+
max_iterations: input.max_iterations,
|
|
107
|
+
auto_approve: input.auto_approve,
|
|
108
|
+
dry_run: input.dry_run,
|
|
91
109
|
integration_context: normalizeIntegrationContext(input.integration_context)
|
|
92
110
|
});
|
|
93
111
|
}
|
|
@@ -95,7 +113,12 @@ function createRunState(input) {
|
|
|
95
113
|
const createdAt = input.created_at || timestamp();
|
|
96
114
|
return compactRecord({
|
|
97
115
|
version: RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
116
|
+
run_id: input.run_id || createRunId(createdAt),
|
|
98
117
|
state_path: input.state_path,
|
|
118
|
+
worktree_path: input.worktree_path,
|
|
119
|
+
branch: input.branch || input.request.branch,
|
|
120
|
+
current_stage: input.current_stage ?? null,
|
|
121
|
+
stage_started_at: input.stage_started_at ?? null,
|
|
99
122
|
status: input.status || "running",
|
|
100
123
|
created_at: createdAt,
|
|
101
124
|
updated_at: input.updated_at || createdAt,
|
|
@@ -123,9 +146,49 @@ function appendRunEvent(state, input) {
|
|
|
123
146
|
details: event.details
|
|
124
147
|
}));
|
|
125
148
|
if (input.checkpoint !== void 0) state.last_checkpoint = input.checkpoint;
|
|
149
|
+
if (input.stage !== void 0) {
|
|
150
|
+
if (state.current_stage !== input.stage) state.stage_started_at = event.ts;
|
|
151
|
+
state.current_stage = input.stage;
|
|
152
|
+
}
|
|
126
153
|
state.updated_at = event.ts;
|
|
127
154
|
return state;
|
|
128
155
|
}
|
|
156
|
+
function appendStageHeartbeat(state, input) {
|
|
157
|
+
const at = input.ts || timestamp();
|
|
158
|
+
return appendRunEvent(state, {
|
|
159
|
+
ts: at,
|
|
160
|
+
kind: "stage.heartbeat",
|
|
161
|
+
checkpoint: input.checkpoint || `${input.stage}_heartbeat`,
|
|
162
|
+
stage: input.stage,
|
|
163
|
+
summary: input.summary || `${input.stage} stage is active.`,
|
|
164
|
+
details: compactRecord({
|
|
165
|
+
elapsed_ms: elapsedMs(state.created_at, at),
|
|
166
|
+
stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
|
|
167
|
+
wait_reason: input.wait_reason,
|
|
168
|
+
blocker: input.blocker,
|
|
169
|
+
...input.details
|
|
170
|
+
})
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
function createRunStatusSnapshot(state, at = timestamp()) {
|
|
174
|
+
const latestEvent = state.events[state.events.length - 1];
|
|
175
|
+
const runId = state.run_id || "unknown";
|
|
176
|
+
return compactRecord({
|
|
177
|
+
run_id: runId,
|
|
178
|
+
status: state.status,
|
|
179
|
+
current_stage: state.current_stage ?? null,
|
|
180
|
+
state_path: state.state_path ?? null,
|
|
181
|
+
worktree_path: state.worktree_path ?? null,
|
|
182
|
+
branch: state.branch ?? null,
|
|
183
|
+
iterations: state.iterations,
|
|
184
|
+
last_checkpoint: state.last_checkpoint ?? null,
|
|
185
|
+
updated_at: state.updated_at,
|
|
186
|
+
elapsed_ms: elapsedMs(state.created_at, at),
|
|
187
|
+
stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
|
|
188
|
+
blocker: state.blocker,
|
|
189
|
+
latest_event: latestEvent
|
|
190
|
+
});
|
|
191
|
+
}
|
|
129
192
|
function setRunStatus(state, status, at = timestamp()) {
|
|
130
193
|
state.status = status;
|
|
131
194
|
state.ok = status !== "blocked" && status !== "failed";
|
|
@@ -136,7 +199,9 @@ function setRunStatus(state, status, at = timestamp()) {
|
|
|
136
199
|
0 && (module.exports = {
|
|
137
200
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
138
201
|
appendRunEvent,
|
|
202
|
+
appendStageHeartbeat,
|
|
139
203
|
createRunState,
|
|
204
|
+
createRunStatusSnapshot,
|
|
140
205
|
normalizeIntegrationContext,
|
|
141
206
|
normalizeRunParams,
|
|
142
207
|
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-
|
|
9
|
-
import "./chunk-
|
|
10
|
+
} from "./chunk-5FHUOSNO.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
|