@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.
- package/README.md +29 -3
- package/dist/{chunk-2ZQNXVQC.js → chunk-5DC6YXN4.js} +4 -0
- package/dist/{chunk-EPVZKWUS.js → chunk-IQIEOQZF.js} +59 -1
- package/dist/chunk-P3FUU5X4.js +495 -0
- package/dist/index.cjs +548 -0
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +10 -2
- package/dist/openclaw.js +2 -2
- package/dist/result.cjs +4 -0
- package/dist/result.js +1 -1
- package/dist/runner.cjs +697 -0
- package/dist/runner.d.cts +22 -0
- package/dist/runner.d.ts +22 -0
- package/dist/runner.js +8 -0
- package/dist/state.cjs +60 -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 +74 -2
- package/dist/types.d.ts +74 -2
- package/package.json +7 -2
package/dist/index.cjs
CHANGED
|
@@ -22,10 +22,12 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
RIDDLE_PROOF_RUN_STATE_VERSION: () => RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
24
24
|
appendRunEvent: () => appendRunEvent,
|
|
25
|
+
appendStageHeartbeat: () => appendStageHeartbeat,
|
|
25
26
|
applyTerminalMetadata: () => applyTerminalMetadata,
|
|
26
27
|
compactRecord: () => compactRecord,
|
|
27
28
|
createRunResult: () => createRunResult,
|
|
28
29
|
createRunState: () => createRunState,
|
|
30
|
+
createRunStatusSnapshot: () => createRunStatusSnapshot,
|
|
29
31
|
isSuccessfulStatus: () => isSuccessfulStatus,
|
|
30
32
|
isTerminalStatus: () => isTerminalStatus,
|
|
31
33
|
nonEmptyString: () => nonEmptyString,
|
|
@@ -33,6 +35,7 @@ __export(index_exports, {
|
|
|
33
35
|
normalizeRunParams: () => normalizeRunParams,
|
|
34
36
|
normalizeTerminalMetadata: () => normalizeTerminalMetadata,
|
|
35
37
|
recordValue: () => recordValue,
|
|
38
|
+
runRiddleProof: () => runRiddleProof,
|
|
36
39
|
setRunStatus: () => setRunStatus
|
|
37
40
|
});
|
|
38
41
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -91,7 +94,11 @@ function createRunResult(input) {
|
|
|
91
94
|
return compactRecord({
|
|
92
95
|
ok,
|
|
93
96
|
status,
|
|
97
|
+
run_id: state.run_id,
|
|
94
98
|
state_path: input.state_path ?? state.state_path ?? null,
|
|
99
|
+
worktree_path: state.worktree_path ?? null,
|
|
100
|
+
branch: state.branch ?? null,
|
|
101
|
+
current_stage: state.current_stage ?? null,
|
|
95
102
|
iterations: state.iterations,
|
|
96
103
|
last_checkpoint: state.last_checkpoint ?? null,
|
|
97
104
|
last_summary: input.last_summary ?? null,
|
|
@@ -113,6 +120,17 @@ var RIDDLE_PROOF_RUN_STATE_VERSION = "riddle-proof.run-state.v1";
|
|
|
113
120
|
function timestamp() {
|
|
114
121
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
115
122
|
}
|
|
123
|
+
function createRunId(createdAt) {
|
|
124
|
+
const stamp = createdAt.replace(/\D/g, "").slice(0, 14) || "unknown";
|
|
125
|
+
const entropy = Math.random().toString(36).slice(2, 8) || "run";
|
|
126
|
+
return `rp_${stamp}_${entropy}`;
|
|
127
|
+
}
|
|
128
|
+
function elapsedMs(start, end) {
|
|
129
|
+
const startMs = start ? Date.parse(start) : NaN;
|
|
130
|
+
const endMs = end ? Date.parse(end) : NaN;
|
|
131
|
+
if (!Number.isFinite(startMs) || !Number.isFinite(endMs)) return void 0;
|
|
132
|
+
return Math.max(0, endMs - startMs);
|
|
133
|
+
}
|
|
116
134
|
function normalizeIntegrationContext(input, fallbackSource) {
|
|
117
135
|
const value = recordValue(input);
|
|
118
136
|
if (!value) {
|
|
@@ -163,7 +181,12 @@ function createRunState(input) {
|
|
|
163
181
|
const createdAt = input.created_at || timestamp();
|
|
164
182
|
return compactRecord({
|
|
165
183
|
version: RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
184
|
+
run_id: input.run_id || createRunId(createdAt),
|
|
166
185
|
state_path: input.state_path,
|
|
186
|
+
worktree_path: input.worktree_path,
|
|
187
|
+
branch: input.branch || input.request.branch,
|
|
188
|
+
current_stage: input.current_stage ?? null,
|
|
189
|
+
stage_started_at: input.stage_started_at ?? null,
|
|
167
190
|
status: input.status || "running",
|
|
168
191
|
created_at: createdAt,
|
|
169
192
|
updated_at: input.updated_at || createdAt,
|
|
@@ -191,23 +214,547 @@ function appendRunEvent(state, input) {
|
|
|
191
214
|
details: event.details
|
|
192
215
|
}));
|
|
193
216
|
if (input.checkpoint !== void 0) state.last_checkpoint = input.checkpoint;
|
|
217
|
+
if (input.stage !== void 0) {
|
|
218
|
+
if (state.current_stage !== input.stage) state.stage_started_at = event.ts;
|
|
219
|
+
state.current_stage = input.stage;
|
|
220
|
+
}
|
|
194
221
|
state.updated_at = event.ts;
|
|
195
222
|
return state;
|
|
196
223
|
}
|
|
224
|
+
function appendStageHeartbeat(state, input) {
|
|
225
|
+
const at = input.ts || timestamp();
|
|
226
|
+
return appendRunEvent(state, {
|
|
227
|
+
ts: at,
|
|
228
|
+
kind: "stage.heartbeat",
|
|
229
|
+
checkpoint: input.checkpoint || `${input.stage}_heartbeat`,
|
|
230
|
+
stage: input.stage,
|
|
231
|
+
summary: input.summary || `${input.stage} stage is active.`,
|
|
232
|
+
details: compactRecord({
|
|
233
|
+
elapsed_ms: elapsedMs(state.created_at, at),
|
|
234
|
+
stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
|
|
235
|
+
wait_reason: input.wait_reason,
|
|
236
|
+
blocker: input.blocker,
|
|
237
|
+
...input.details
|
|
238
|
+
})
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function createRunStatusSnapshot(state, at = timestamp()) {
|
|
242
|
+
const latestEvent = state.events[state.events.length - 1];
|
|
243
|
+
const runId = state.run_id || "unknown";
|
|
244
|
+
return compactRecord({
|
|
245
|
+
run_id: runId,
|
|
246
|
+
status: state.status,
|
|
247
|
+
current_stage: state.current_stage ?? null,
|
|
248
|
+
state_path: state.state_path ?? null,
|
|
249
|
+
worktree_path: state.worktree_path ?? null,
|
|
250
|
+
branch: state.branch ?? null,
|
|
251
|
+
iterations: state.iterations,
|
|
252
|
+
last_checkpoint: state.last_checkpoint ?? null,
|
|
253
|
+
updated_at: state.updated_at,
|
|
254
|
+
elapsed_ms: elapsedMs(state.created_at, at),
|
|
255
|
+
stage_elapsed_ms: elapsedMs(state.stage_started_at, at),
|
|
256
|
+
blocker: state.blocker,
|
|
257
|
+
latest_event: latestEvent
|
|
258
|
+
});
|
|
259
|
+
}
|
|
197
260
|
function setRunStatus(state, status, at = timestamp()) {
|
|
198
261
|
state.status = status;
|
|
199
262
|
state.ok = status !== "blocked" && status !== "failed";
|
|
200
263
|
state.updated_at = at;
|
|
201
264
|
return state;
|
|
202
265
|
}
|
|
266
|
+
|
|
267
|
+
// src/runner.ts
|
|
268
|
+
function errorDetails(error) {
|
|
269
|
+
if (error instanceof Error) {
|
|
270
|
+
return {
|
|
271
|
+
name: error.name,
|
|
272
|
+
message: error.message
|
|
273
|
+
};
|
|
274
|
+
}
|
|
275
|
+
return { message: String(error) };
|
|
276
|
+
}
|
|
277
|
+
function adapterBlocker(code, message, checkpoint, details) {
|
|
278
|
+
return {
|
|
279
|
+
code,
|
|
280
|
+
message,
|
|
281
|
+
checkpoint,
|
|
282
|
+
details
|
|
283
|
+
};
|
|
284
|
+
}
|
|
285
|
+
function blockRun(input) {
|
|
286
|
+
input.state.blocker = input.blocker;
|
|
287
|
+
appendRunEvent(input.state, {
|
|
288
|
+
kind: "run.blocked",
|
|
289
|
+
checkpoint: input.blocker.checkpoint,
|
|
290
|
+
stage: input.stage,
|
|
291
|
+
summary: input.blocker.message,
|
|
292
|
+
details: {
|
|
293
|
+
code: input.blocker.code,
|
|
294
|
+
...input.blocker.details
|
|
295
|
+
}
|
|
296
|
+
});
|
|
297
|
+
setRunStatus(input.state, "blocked");
|
|
298
|
+
return createRunResult({
|
|
299
|
+
state: input.state,
|
|
300
|
+
status: "blocked",
|
|
301
|
+
last_summary: input.blocker.message,
|
|
302
|
+
evidence_bundle: input.evidence_bundle,
|
|
303
|
+
raw: input.raw
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
function shouldIterate(assessment) {
|
|
307
|
+
const nextStage = assessment.continue_with_stage || assessment.recommended_stage;
|
|
308
|
+
return nextStage === "implement" || nextStage === "author";
|
|
309
|
+
}
|
|
310
|
+
async function notifyIfConfigured(input) {
|
|
311
|
+
if (!input.notification) return input.result;
|
|
312
|
+
try {
|
|
313
|
+
const notification = await input.notification.notify({
|
|
314
|
+
state: input.state,
|
|
315
|
+
result: input.result
|
|
316
|
+
});
|
|
317
|
+
input.state.notification = notification;
|
|
318
|
+
appendRunEvent(input.state, {
|
|
319
|
+
kind: "notification.completed",
|
|
320
|
+
checkpoint: "notification_completed",
|
|
321
|
+
stage: "notify",
|
|
322
|
+
summary: "Integration notification completed."
|
|
323
|
+
});
|
|
324
|
+
} catch (error) {
|
|
325
|
+
appendRunEvent(input.state, {
|
|
326
|
+
kind: "notification.failed",
|
|
327
|
+
checkpoint: "notification_failed",
|
|
328
|
+
stage: "notify",
|
|
329
|
+
summary: "Integration notification failed.",
|
|
330
|
+
details: errorDetails(error)
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
return createRunResult({
|
|
334
|
+
state: input.state,
|
|
335
|
+
status: input.state.status,
|
|
336
|
+
last_summary: input.result.last_summary,
|
|
337
|
+
evidence_bundle: input.result.evidence_bundle,
|
|
338
|
+
raw: input.result.raw
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
async function runRiddleProof(input) {
|
|
342
|
+
const state = input.state || createRunState({
|
|
343
|
+
request: input.request,
|
|
344
|
+
state_path: input.state_path,
|
|
345
|
+
worktree_path: input.workdir
|
|
346
|
+
});
|
|
347
|
+
const adapters = input.adapters || {};
|
|
348
|
+
const maxIterations = Math.max(1, Math.trunc(input.max_iterations ?? 1));
|
|
349
|
+
appendRunEvent(state, {
|
|
350
|
+
kind: "run.started",
|
|
351
|
+
checkpoint: "run_started",
|
|
352
|
+
stage: "setup",
|
|
353
|
+
summary: "Riddle Proof run started.",
|
|
354
|
+
details: {
|
|
355
|
+
run_id: state.run_id,
|
|
356
|
+
state_path: state.state_path,
|
|
357
|
+
worktree_path: state.worktree_path,
|
|
358
|
+
branch: state.branch,
|
|
359
|
+
max_iterations: maxIterations,
|
|
360
|
+
ship_mode: state.request.ship_mode || "none"
|
|
361
|
+
}
|
|
362
|
+
});
|
|
363
|
+
appendStageHeartbeat(state, {
|
|
364
|
+
stage: "setup",
|
|
365
|
+
summary: "Setup stage is active.",
|
|
366
|
+
details: {
|
|
367
|
+
run_id: state.run_id,
|
|
368
|
+
state_path: state.state_path,
|
|
369
|
+
worktree_path: state.worktree_path,
|
|
370
|
+
branch: state.branch
|
|
371
|
+
}
|
|
372
|
+
});
|
|
373
|
+
let workdir = input.workdir;
|
|
374
|
+
let evidenceContext;
|
|
375
|
+
if (adapters.preflight) {
|
|
376
|
+
appendRunEvent(state, {
|
|
377
|
+
kind: "preflight.started",
|
|
378
|
+
checkpoint: "preflight_started",
|
|
379
|
+
stage: "preflight",
|
|
380
|
+
summary: "Riddle Proof preflight adapter started."
|
|
381
|
+
});
|
|
382
|
+
try {
|
|
383
|
+
const preflight = await adapters.preflight.preflight({ request: state.request, state });
|
|
384
|
+
if (!preflight.ok) {
|
|
385
|
+
return blockRun({
|
|
386
|
+
state,
|
|
387
|
+
stage: "preflight",
|
|
388
|
+
blocker: adapterBlocker(
|
|
389
|
+
"preflight_failed",
|
|
390
|
+
"The preflight adapter found blocking tool or model configuration issues.",
|
|
391
|
+
"preflight_failed",
|
|
392
|
+
{
|
|
393
|
+
blockers: preflight.blockers,
|
|
394
|
+
warnings: preflight.warnings,
|
|
395
|
+
degraded_capabilities: preflight.degraded_capabilities
|
|
396
|
+
}
|
|
397
|
+
),
|
|
398
|
+
raw: { preflight }
|
|
399
|
+
});
|
|
400
|
+
}
|
|
401
|
+
appendRunEvent(state, {
|
|
402
|
+
kind: "preflight.completed",
|
|
403
|
+
checkpoint: "preflight_completed",
|
|
404
|
+
stage: "preflight",
|
|
405
|
+
summary: "Riddle Proof preflight adapter completed.",
|
|
406
|
+
details: {
|
|
407
|
+
warnings: preflight.warnings,
|
|
408
|
+
degraded_capabilities: preflight.degraded_capabilities
|
|
409
|
+
}
|
|
410
|
+
});
|
|
411
|
+
} catch (error) {
|
|
412
|
+
return blockRun({
|
|
413
|
+
state,
|
|
414
|
+
stage: "preflight",
|
|
415
|
+
blocker: adapterBlocker("preflight_exception", "The preflight adapter threw an exception.", "preflight_failed", errorDetails(error))
|
|
416
|
+
});
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
if (adapters.setup) {
|
|
420
|
+
appendRunEvent(state, {
|
|
421
|
+
kind: "setup.started",
|
|
422
|
+
checkpoint: "setup_started",
|
|
423
|
+
stage: "setup",
|
|
424
|
+
summary: "Riddle Proof setup adapter started."
|
|
425
|
+
});
|
|
426
|
+
try {
|
|
427
|
+
const setup = await adapters.setup.setup({ request: state.request, state });
|
|
428
|
+
if (!setup.ok) {
|
|
429
|
+
return blockRun({
|
|
430
|
+
state,
|
|
431
|
+
stage: "setup",
|
|
432
|
+
blocker: adapterBlocker(
|
|
433
|
+
"setup_failed",
|
|
434
|
+
"The setup adapter did not complete successfully.",
|
|
435
|
+
"setup_failed",
|
|
436
|
+
{ blockers: setup.blockers }
|
|
437
|
+
),
|
|
438
|
+
raw: { setup }
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
workdir = setup.worktree_path || setup.workdir || workdir;
|
|
442
|
+
state.worktree_path = setup.worktree_path || setup.workdir || state.worktree_path;
|
|
443
|
+
state.branch = setup.branch || state.branch;
|
|
444
|
+
evidenceContext = setup.evidence_context;
|
|
445
|
+
appendRunEvent(state, {
|
|
446
|
+
kind: "setup.completed",
|
|
447
|
+
checkpoint: "setup_completed",
|
|
448
|
+
stage: "setup",
|
|
449
|
+
summary: "Riddle Proof setup adapter completed.",
|
|
450
|
+
details: {
|
|
451
|
+
has_workdir: Boolean(workdir),
|
|
452
|
+
worktree_path: state.worktree_path,
|
|
453
|
+
branch: state.branch,
|
|
454
|
+
cleanup_policy: setup.cleanup_policy,
|
|
455
|
+
has_evidence_context: Boolean(evidenceContext)
|
|
456
|
+
}
|
|
457
|
+
});
|
|
458
|
+
} catch (error) {
|
|
459
|
+
return blockRun({
|
|
460
|
+
state,
|
|
461
|
+
stage: "setup",
|
|
462
|
+
blocker: adapterBlocker("setup_exception", "The setup adapter threw an exception.", "setup_failed", errorDetails(error))
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
const changeRequest = state.request.change_request?.trim();
|
|
467
|
+
if (!changeRequest) {
|
|
468
|
+
return blockRun({
|
|
469
|
+
state,
|
|
470
|
+
stage: "setup",
|
|
471
|
+
blocker: adapterBlocker("change_request_required", "A change request is required before implementation.", "request_invalid")
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
if (!workdir) {
|
|
475
|
+
return blockRun({
|
|
476
|
+
state,
|
|
477
|
+
stage: "setup",
|
|
478
|
+
blocker: adapterBlocker("workdir_not_configured", "A workdir or setup adapter result is required before implementation.", "setup_required")
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
if (!adapters.implementation) {
|
|
482
|
+
return blockRun({
|
|
483
|
+
state,
|
|
484
|
+
stage: "implement",
|
|
485
|
+
blocker: adapterBlocker("implementation_adapter_not_configured", "An implementation adapter is required to change code.", "implementation_required")
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
if (!adapters.proof) {
|
|
489
|
+
return blockRun({
|
|
490
|
+
state,
|
|
491
|
+
stage: "prove",
|
|
492
|
+
blocker: adapterBlocker("proof_adapter_not_configured", "A proof adapter is required to capture evidence.", "proof_required")
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
if (!adapters.judge) {
|
|
496
|
+
return blockRun({
|
|
497
|
+
state,
|
|
498
|
+
stage: "verify",
|
|
499
|
+
blocker: adapterBlocker("judge_adapter_not_configured", "A judge adapter is required to assess proof.", "judge_required")
|
|
500
|
+
});
|
|
501
|
+
}
|
|
502
|
+
let implementation;
|
|
503
|
+
let evidenceBundle;
|
|
504
|
+
let assessment;
|
|
505
|
+
for (let attempt = 0; attempt < maxIterations; attempt += 1) {
|
|
506
|
+
state.iterations += 1;
|
|
507
|
+
appendStageHeartbeat(state, {
|
|
508
|
+
stage: "implement",
|
|
509
|
+
summary: "Implementation stage is active.",
|
|
510
|
+
details: { iteration: state.iterations }
|
|
511
|
+
});
|
|
512
|
+
appendRunEvent(state, {
|
|
513
|
+
kind: "implementation.started",
|
|
514
|
+
checkpoint: "implementation_started",
|
|
515
|
+
stage: "implement",
|
|
516
|
+
summary: "Implementation adapter started.",
|
|
517
|
+
details: { iteration: state.iterations }
|
|
518
|
+
});
|
|
519
|
+
try {
|
|
520
|
+
implementation = await adapters.implementation.implement({
|
|
521
|
+
workdir,
|
|
522
|
+
change_request: changeRequest,
|
|
523
|
+
evidence_context: evidenceContext,
|
|
524
|
+
state
|
|
525
|
+
});
|
|
526
|
+
} catch (error) {
|
|
527
|
+
return blockRun({
|
|
528
|
+
state,
|
|
529
|
+
stage: "implement",
|
|
530
|
+
blocker: adapterBlocker("implementation_exception", "The implementation adapter threw an exception.", "implementation_failed", errorDetails(error)),
|
|
531
|
+
evidence_bundle: evidenceBundle
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
if (!implementation.ok) {
|
|
535
|
+
return blockRun({
|
|
536
|
+
state,
|
|
537
|
+
stage: "implement",
|
|
538
|
+
blocker: adapterBlocker(
|
|
539
|
+
"implementation_failed",
|
|
540
|
+
"The implementation adapter did not complete successfully.",
|
|
541
|
+
"implementation_failed",
|
|
542
|
+
{ blockers: implementation.blockers }
|
|
543
|
+
),
|
|
544
|
+
evidence_bundle: evidenceBundle,
|
|
545
|
+
raw: { implementation }
|
|
546
|
+
});
|
|
547
|
+
}
|
|
548
|
+
appendRunEvent(state, {
|
|
549
|
+
kind: "implementation.completed",
|
|
550
|
+
checkpoint: "implementation_completed",
|
|
551
|
+
stage: "implement",
|
|
552
|
+
summary: "Implementation adapter completed.",
|
|
553
|
+
details: {
|
|
554
|
+
changed_files: implementation.changed_files,
|
|
555
|
+
tests_run: implementation.tests_run
|
|
556
|
+
}
|
|
557
|
+
});
|
|
558
|
+
appendStageHeartbeat(state, {
|
|
559
|
+
stage: "prove",
|
|
560
|
+
summary: "Proof capture stage is active.",
|
|
561
|
+
details: {
|
|
562
|
+
verification_mode: state.request.verification_mode
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
appendRunEvent(state, {
|
|
566
|
+
kind: "proof.started",
|
|
567
|
+
checkpoint: "proof_started",
|
|
568
|
+
stage: "prove",
|
|
569
|
+
summary: "Proof adapter started."
|
|
570
|
+
});
|
|
571
|
+
try {
|
|
572
|
+
const proof = await adapters.proof.prove({
|
|
573
|
+
state,
|
|
574
|
+
implementation,
|
|
575
|
+
evidence_context: evidenceContext
|
|
576
|
+
});
|
|
577
|
+
if (!proof.ok || !proof.evidence_bundle) {
|
|
578
|
+
return blockRun({
|
|
579
|
+
state,
|
|
580
|
+
stage: "prove",
|
|
581
|
+
blocker: adapterBlocker(
|
|
582
|
+
"proof_failed",
|
|
583
|
+
"The proof adapter did not produce a usable evidence bundle.",
|
|
584
|
+
"proof_failed",
|
|
585
|
+
{ blockers: proof.blockers }
|
|
586
|
+
),
|
|
587
|
+
raw: { proof }
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
evidenceBundle = proof.evidence_bundle;
|
|
591
|
+
appendRunEvent(state, {
|
|
592
|
+
kind: "proof.completed",
|
|
593
|
+
checkpoint: "proof_completed",
|
|
594
|
+
stage: "prove",
|
|
595
|
+
summary: "Proof adapter completed.",
|
|
596
|
+
details: {
|
|
597
|
+
verification_mode: evidenceBundle.verification_mode,
|
|
598
|
+
artifact_count: evidenceBundle.artifacts?.length ?? 0
|
|
599
|
+
}
|
|
600
|
+
});
|
|
601
|
+
} catch (error) {
|
|
602
|
+
return blockRun({
|
|
603
|
+
state,
|
|
604
|
+
stage: "prove",
|
|
605
|
+
blocker: adapterBlocker("proof_exception", "The proof adapter threw an exception.", "proof_failed", errorDetails(error))
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
appendRunEvent(state, {
|
|
609
|
+
kind: "judge.started",
|
|
610
|
+
checkpoint: "judge_started",
|
|
611
|
+
stage: "verify",
|
|
612
|
+
summary: "Judge adapter started."
|
|
613
|
+
});
|
|
614
|
+
appendStageHeartbeat(state, {
|
|
615
|
+
stage: "verify",
|
|
616
|
+
summary: "Verification stage is active.",
|
|
617
|
+
details: {
|
|
618
|
+
verification_mode: evidenceBundle.verification_mode
|
|
619
|
+
}
|
|
620
|
+
});
|
|
621
|
+
try {
|
|
622
|
+
assessment = await adapters.judge.assessProof({ state, evidence_bundle: evidenceBundle });
|
|
623
|
+
state.proof_decision = assessment.decision;
|
|
624
|
+
appendRunEvent(state, {
|
|
625
|
+
kind: "judge.completed",
|
|
626
|
+
checkpoint: "judge_completed",
|
|
627
|
+
stage: "verify",
|
|
628
|
+
summary: assessment.summary,
|
|
629
|
+
details: {
|
|
630
|
+
decision: assessment.decision,
|
|
631
|
+
recommended_stage: assessment.recommended_stage,
|
|
632
|
+
continue_with_stage: assessment.continue_with_stage,
|
|
633
|
+
reasons: assessment.reasons
|
|
634
|
+
}
|
|
635
|
+
});
|
|
636
|
+
} catch (error) {
|
|
637
|
+
return blockRun({
|
|
638
|
+
state,
|
|
639
|
+
stage: "verify",
|
|
640
|
+
blocker: adapterBlocker("judge_exception", "The judge adapter threw an exception.", "judge_failed", errorDetails(error)),
|
|
641
|
+
evidence_bundle: evidenceBundle
|
|
642
|
+
});
|
|
643
|
+
}
|
|
644
|
+
if (assessment.decision === "ready_to_ship") break;
|
|
645
|
+
if (attempt + 1 < maxIterations && shouldIterate(assessment)) {
|
|
646
|
+
evidenceContext = evidenceBundle;
|
|
647
|
+
appendRunEvent(state, {
|
|
648
|
+
kind: "run.iterating",
|
|
649
|
+
checkpoint: "iteration_requested",
|
|
650
|
+
stage: "implement",
|
|
651
|
+
summary: "Judge requested another implementation iteration.",
|
|
652
|
+
details: {
|
|
653
|
+
decision: assessment.decision,
|
|
654
|
+
next_iteration: state.iterations + 1
|
|
655
|
+
}
|
|
656
|
+
});
|
|
657
|
+
continue;
|
|
658
|
+
}
|
|
659
|
+
return blockRun({
|
|
660
|
+
state,
|
|
661
|
+
stage: "verify",
|
|
662
|
+
blocker: adapterBlocker(
|
|
663
|
+
"proof_not_ready",
|
|
664
|
+
assessment.summary || "Proof is not ready to ship.",
|
|
665
|
+
"judge_completed",
|
|
666
|
+
{
|
|
667
|
+
decision: assessment.decision,
|
|
668
|
+
recommended_stage: assessment.recommended_stage,
|
|
669
|
+
continue_with_stage: assessment.continue_with_stage,
|
|
670
|
+
reasons: assessment.reasons
|
|
671
|
+
}
|
|
672
|
+
),
|
|
673
|
+
evidence_bundle: evidenceBundle,
|
|
674
|
+
raw: { assessment }
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
if (!assessment || !evidenceBundle) {
|
|
678
|
+
return blockRun({
|
|
679
|
+
state,
|
|
680
|
+
stage: "verify",
|
|
681
|
+
blocker: adapterBlocker("runner_incomplete", "The runner ended without proof assessment.", "runner_incomplete")
|
|
682
|
+
});
|
|
683
|
+
}
|
|
684
|
+
if (state.request.ship_mode !== "ship") {
|
|
685
|
+
setRunStatus(state, "ready_to_ship");
|
|
686
|
+
const result2 = createRunResult({
|
|
687
|
+
state,
|
|
688
|
+
status: "ready_to_ship",
|
|
689
|
+
last_summary: assessment.summary,
|
|
690
|
+
evidence_bundle: evidenceBundle,
|
|
691
|
+
raw: { implementation, assessment }
|
|
692
|
+
});
|
|
693
|
+
return notifyIfConfigured({ state, result: result2, notification: adapters.notification });
|
|
694
|
+
}
|
|
695
|
+
if (!adapters.ship) {
|
|
696
|
+
return blockRun({
|
|
697
|
+
state,
|
|
698
|
+
stage: "ship",
|
|
699
|
+
blocker: adapterBlocker("ship_adapter_not_configured", "A ship adapter is required when ship_mode is ship.", "ship_required"),
|
|
700
|
+
evidence_bundle: evidenceBundle,
|
|
701
|
+
raw: { implementation, assessment }
|
|
702
|
+
});
|
|
703
|
+
}
|
|
704
|
+
appendRunEvent(state, {
|
|
705
|
+
kind: "ship.started",
|
|
706
|
+
checkpoint: "ship_started",
|
|
707
|
+
stage: "ship",
|
|
708
|
+
summary: "Ship adapter started."
|
|
709
|
+
});
|
|
710
|
+
appendStageHeartbeat(state, {
|
|
711
|
+
stage: "ship",
|
|
712
|
+
summary: "Ship stage is active."
|
|
713
|
+
});
|
|
714
|
+
let metadata;
|
|
715
|
+
try {
|
|
716
|
+
metadata = await adapters.ship.ship({ state, assessment });
|
|
717
|
+
} catch (error) {
|
|
718
|
+
return blockRun({
|
|
719
|
+
state,
|
|
720
|
+
stage: "ship",
|
|
721
|
+
blocker: adapterBlocker("ship_exception", "The ship adapter threw an exception.", "ship_failed", errorDetails(error)),
|
|
722
|
+
evidence_bundle: evidenceBundle,
|
|
723
|
+
raw: { implementation, assessment }
|
|
724
|
+
});
|
|
725
|
+
}
|
|
726
|
+
appendRunEvent(state, {
|
|
727
|
+
kind: "ship.completed",
|
|
728
|
+
checkpoint: "ship_completed",
|
|
729
|
+
stage: "ship",
|
|
730
|
+
summary: "Ship adapter completed.",
|
|
731
|
+
details: {
|
|
732
|
+
pr_url: metadata.pr_url,
|
|
733
|
+
marked_ready: metadata.marked_ready,
|
|
734
|
+
finalized: metadata.finalized
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
setRunStatus(state, "shipped");
|
|
738
|
+
const result = createRunResult({
|
|
739
|
+
state,
|
|
740
|
+
status: "shipped",
|
|
741
|
+
last_summary: "Riddle Proof shipped.",
|
|
742
|
+
metadata,
|
|
743
|
+
evidence_bundle: evidenceBundle,
|
|
744
|
+
raw: { implementation, assessment }
|
|
745
|
+
});
|
|
746
|
+
return notifyIfConfigured({ state, result, notification: adapters.notification });
|
|
747
|
+
}
|
|
203
748
|
// Annotate the CommonJS export names for ESM import in node:
|
|
204
749
|
0 && (module.exports = {
|
|
205
750
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
206
751
|
appendRunEvent,
|
|
752
|
+
appendStageHeartbeat,
|
|
207
753
|
applyTerminalMetadata,
|
|
208
754
|
compactRecord,
|
|
209
755
|
createRunResult,
|
|
210
756
|
createRunState,
|
|
757
|
+
createRunStatusSnapshot,
|
|
211
758
|
isSuccessfulStatus,
|
|
212
759
|
isTerminalStatus,
|
|
213
760
|
nonEmptyString,
|
|
@@ -215,5 +762,6 @@ function setRunStatus(state, status, at = timestamp()) {
|
|
|
215
762
|
normalizeRunParams,
|
|
216
763
|
normalizeTerminalMetadata,
|
|
217
764
|
recordValue,
|
|
765
|
+
runRiddleProof,
|
|
218
766
|
setRunStatus
|
|
219
767
|
});
|
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, RiddleProofAssessment, RiddleProofBlocker, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofStage, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, 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
|
+
export { RiddleProofRunnerAdapters, RunRiddleProofInput, runRiddleProof } from './runner.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, RiddleProofAssessment, RiddleProofBlocker, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofStage, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, 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
|
+
export { RiddleProofRunnerAdapters, RunRiddleProofInput, runRiddleProof } from './runner.js';
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
runRiddleProof
|
|
3
|
+
} from "./chunk-P3FUU5X4.js";
|
|
1
4
|
import {
|
|
2
5
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
3
6
|
appendRunEvent,
|
|
7
|
+
appendStageHeartbeat,
|
|
4
8
|
createRunState,
|
|
9
|
+
createRunStatusSnapshot,
|
|
5
10
|
normalizeIntegrationContext,
|
|
6
11
|
normalizeRunParams,
|
|
7
12
|
setRunStatus
|
|
8
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-IQIEOQZF.js";
|
|
9
14
|
import {
|
|
10
15
|
applyTerminalMetadata,
|
|
11
16
|
compactRecord,
|
|
@@ -15,15 +20,17 @@ import {
|
|
|
15
20
|
nonEmptyString,
|
|
16
21
|
normalizeTerminalMetadata,
|
|
17
22
|
recordValue
|
|
18
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-5DC6YXN4.js";
|
|
19
24
|
import "./chunk-6F4PWJZI.js";
|
|
20
25
|
export {
|
|
21
26
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
22
27
|
appendRunEvent,
|
|
28
|
+
appendStageHeartbeat,
|
|
23
29
|
applyTerminalMetadata,
|
|
24
30
|
compactRecord,
|
|
25
31
|
createRunResult,
|
|
26
32
|
createRunState,
|
|
33
|
+
createRunStatusSnapshot,
|
|
27
34
|
isSuccessfulStatus,
|
|
28
35
|
isTerminalStatus,
|
|
29
36
|
nonEmptyString,
|
|
@@ -31,5 +38,6 @@ export {
|
|
|
31
38
|
normalizeRunParams,
|
|
32
39
|
normalizeTerminalMetadata,
|
|
33
40
|
recordValue,
|
|
41
|
+
runRiddleProof,
|
|
34
42
|
setRunStatus
|
|
35
43
|
};
|
package/dist/openclaw.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeIntegrationContext,
|
|
3
3
|
normalizeRunParams
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-IQIEOQZF.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) {
|
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,
|