@riddledc/riddle-proof 0.5.8 → 0.5.9
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/dist/{chunk-GC7C2NRA.js → chunk-CNKNPJAF.js} +30 -1
- package/dist/engine-harness.cjs +30 -1
- package/dist/engine-harness.js +1 -1
- package/dist/index.cjs +30 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -27,6 +27,17 @@ import {
|
|
|
27
27
|
} from "fs";
|
|
28
28
|
import path from "path";
|
|
29
29
|
import crypto from "crypto";
|
|
30
|
+
var DEFAULT_MAX_ITERATIONS = 12;
|
|
31
|
+
var DEFAULT_STAGE_ITERATION_LIMITS = {
|
|
32
|
+
setup: 2,
|
|
33
|
+
recon: 4,
|
|
34
|
+
author: 3,
|
|
35
|
+
implement: 3,
|
|
36
|
+
prove: 3,
|
|
37
|
+
verify: 4,
|
|
38
|
+
ship: 2,
|
|
39
|
+
notify: 2
|
|
40
|
+
};
|
|
30
41
|
function timestamp() {
|
|
31
42
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
32
43
|
}
|
|
@@ -633,7 +644,7 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
633
644
|
const agent = input.agent || createDisabledRiddleProofAgentAdapter();
|
|
634
645
|
const maxIterations = Math.max(
|
|
635
646
|
1,
|
|
636
|
-
Math.trunc(input.max_iterations ?? request.max_iterations ?? input.config?.defaultMaxIterations ??
|
|
647
|
+
Math.trunc(input.max_iterations ?? request.max_iterations ?? input.config?.defaultMaxIterations ?? DEFAULT_MAX_ITERATIONS)
|
|
637
648
|
);
|
|
638
649
|
state.status = "running";
|
|
639
650
|
state.ok = void 0;
|
|
@@ -666,6 +677,7 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
666
677
|
}
|
|
667
678
|
let nextParams = input.resume_params || initialRunParams(request, input, state);
|
|
668
679
|
let lastResult = null;
|
|
680
|
+
const stageIterations = {};
|
|
669
681
|
for (let index = 0; index < maxIterations; index += 1) {
|
|
670
682
|
if (request.leave_draft && nextParams.leave_draft === void 0) {
|
|
671
683
|
nextParams = { ...nextParams, leave_draft: true };
|
|
@@ -724,6 +736,7 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
724
736
|
if (engineState) state.request.engine_state_path = engineState;
|
|
725
737
|
state.last_checkpoint = result.checkpoint || state.last_checkpoint || null;
|
|
726
738
|
const resultStage = stageFromCheckpoint(result);
|
|
739
|
+
stageIterations[resultStage] = (stageIterations[resultStage] || 0) + 1;
|
|
727
740
|
heartbeat(state, {
|
|
728
741
|
stage: resultStage,
|
|
729
742
|
summary: `${resultStage} stage is active.`,
|
|
@@ -749,6 +762,22 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
749
762
|
finished_at: timestamp()
|
|
750
763
|
}
|
|
751
764
|
});
|
|
765
|
+
const stageLimit = DEFAULT_STAGE_ITERATION_LIMITS[resultStage];
|
|
766
|
+
if (stageLimit && stageIterations[resultStage] > stageLimit) {
|
|
767
|
+
return blockerResult(state, result, {
|
|
768
|
+
code: "stage_iteration_limit_reached",
|
|
769
|
+
checkpoint: result.checkpoint || null,
|
|
770
|
+
message: `The harness exceeded the ${resultStage} stage iteration limit before the proof was ready or shipped.`,
|
|
771
|
+
details: {
|
|
772
|
+
stage: resultStage,
|
|
773
|
+
stage_iterations: stageIterations[resultStage],
|
|
774
|
+
stage_iteration_limit: stageLimit,
|
|
775
|
+
max_iterations: maxIterations,
|
|
776
|
+
lastCheckpoint: result.checkpoint || null,
|
|
777
|
+
lastSummary: result.summary || null
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
}
|
|
752
781
|
const routed = await routeCheckpoint(request, state, result, agent, input);
|
|
753
782
|
if (routed.terminal) return routed.terminal;
|
|
754
783
|
if (routed.blocker) return blockerResult(state, result, routed.blocker);
|
package/dist/engine-harness.cjs
CHANGED
|
@@ -2997,6 +2997,17 @@ function setRunStatus(state, status, at = timestamp()) {
|
|
|
2997
2997
|
}
|
|
2998
2998
|
|
|
2999
2999
|
// src/engine-harness.ts
|
|
3000
|
+
var DEFAULT_MAX_ITERATIONS = 12;
|
|
3001
|
+
var DEFAULT_STAGE_ITERATION_LIMITS = {
|
|
3002
|
+
setup: 2,
|
|
3003
|
+
recon: 4,
|
|
3004
|
+
author: 3,
|
|
3005
|
+
implement: 3,
|
|
3006
|
+
prove: 3,
|
|
3007
|
+
verify: 4,
|
|
3008
|
+
ship: 2,
|
|
3009
|
+
notify: 2
|
|
3010
|
+
};
|
|
3000
3011
|
function timestamp2() {
|
|
3001
3012
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
3002
3013
|
}
|
|
@@ -3603,7 +3614,7 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
3603
3614
|
const agent = input.agent || createDisabledRiddleProofAgentAdapter();
|
|
3604
3615
|
const maxIterations = Math.max(
|
|
3605
3616
|
1,
|
|
3606
|
-
Math.trunc(input.max_iterations ?? request.max_iterations ?? input.config?.defaultMaxIterations ??
|
|
3617
|
+
Math.trunc(input.max_iterations ?? request.max_iterations ?? input.config?.defaultMaxIterations ?? DEFAULT_MAX_ITERATIONS)
|
|
3607
3618
|
);
|
|
3608
3619
|
state.status = "running";
|
|
3609
3620
|
state.ok = void 0;
|
|
@@ -3636,6 +3647,7 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
3636
3647
|
}
|
|
3637
3648
|
let nextParams = input.resume_params || initialRunParams(request, input, state);
|
|
3638
3649
|
let lastResult = null;
|
|
3650
|
+
const stageIterations = {};
|
|
3639
3651
|
for (let index = 0; index < maxIterations; index += 1) {
|
|
3640
3652
|
if (request.leave_draft && nextParams.leave_draft === void 0) {
|
|
3641
3653
|
nextParams = { ...nextParams, leave_draft: true };
|
|
@@ -3694,6 +3706,7 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
3694
3706
|
if (engineState) state.request.engine_state_path = engineState;
|
|
3695
3707
|
state.last_checkpoint = result.checkpoint || state.last_checkpoint || null;
|
|
3696
3708
|
const resultStage = stageFromCheckpoint(result);
|
|
3709
|
+
stageIterations[resultStage] = (stageIterations[resultStage] || 0) + 1;
|
|
3697
3710
|
heartbeat(state, {
|
|
3698
3711
|
stage: resultStage,
|
|
3699
3712
|
summary: `${resultStage} stage is active.`,
|
|
@@ -3719,6 +3732,22 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
3719
3732
|
finished_at: timestamp2()
|
|
3720
3733
|
}
|
|
3721
3734
|
});
|
|
3735
|
+
const stageLimit = DEFAULT_STAGE_ITERATION_LIMITS[resultStage];
|
|
3736
|
+
if (stageLimit && stageIterations[resultStage] > stageLimit) {
|
|
3737
|
+
return blockerResult(state, result, {
|
|
3738
|
+
code: "stage_iteration_limit_reached",
|
|
3739
|
+
checkpoint: result.checkpoint || null,
|
|
3740
|
+
message: `The harness exceeded the ${resultStage} stage iteration limit before the proof was ready or shipped.`,
|
|
3741
|
+
details: {
|
|
3742
|
+
stage: resultStage,
|
|
3743
|
+
stage_iterations: stageIterations[resultStage],
|
|
3744
|
+
stage_iteration_limit: stageLimit,
|
|
3745
|
+
max_iterations: maxIterations,
|
|
3746
|
+
lastCheckpoint: result.checkpoint || null,
|
|
3747
|
+
lastSummary: result.summary || null
|
|
3748
|
+
}
|
|
3749
|
+
});
|
|
3750
|
+
}
|
|
3722
3751
|
const routed = await routeCheckpoint(request, state, result, agent, input);
|
|
3723
3752
|
if (routed.terminal) return routed.terminal;
|
|
3724
3753
|
if (routed.blocker) return blockerResult(state, result, routed.blocker);
|
package/dist/engine-harness.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -3556,6 +3556,17 @@ var import_node_child_process2 = require("child_process");
|
|
|
3556
3556
|
var import_node_fs3 = require("fs");
|
|
3557
3557
|
var import_node_path3 = __toESM(require("path"), 1);
|
|
3558
3558
|
var import_node_crypto2 = __toESM(require("crypto"), 1);
|
|
3559
|
+
var DEFAULT_MAX_ITERATIONS = 12;
|
|
3560
|
+
var DEFAULT_STAGE_ITERATION_LIMITS = {
|
|
3561
|
+
setup: 2,
|
|
3562
|
+
recon: 4,
|
|
3563
|
+
author: 3,
|
|
3564
|
+
implement: 3,
|
|
3565
|
+
prove: 3,
|
|
3566
|
+
verify: 4,
|
|
3567
|
+
ship: 2,
|
|
3568
|
+
notify: 2
|
|
3569
|
+
};
|
|
3559
3570
|
function timestamp2() {
|
|
3560
3571
|
return (/* @__PURE__ */ new Date()).toISOString();
|
|
3561
3572
|
}
|
|
@@ -4162,7 +4173,7 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
4162
4173
|
const agent = input.agent || createDisabledRiddleProofAgentAdapter();
|
|
4163
4174
|
const maxIterations = Math.max(
|
|
4164
4175
|
1,
|
|
4165
|
-
Math.trunc(input.max_iterations ?? request.max_iterations ?? input.config?.defaultMaxIterations ??
|
|
4176
|
+
Math.trunc(input.max_iterations ?? request.max_iterations ?? input.config?.defaultMaxIterations ?? DEFAULT_MAX_ITERATIONS)
|
|
4166
4177
|
);
|
|
4167
4178
|
state.status = "running";
|
|
4168
4179
|
state.ok = void 0;
|
|
@@ -4195,6 +4206,7 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
4195
4206
|
}
|
|
4196
4207
|
let nextParams = input.resume_params || initialRunParams(request, input, state);
|
|
4197
4208
|
let lastResult = null;
|
|
4209
|
+
const stageIterations = {};
|
|
4198
4210
|
for (let index = 0; index < maxIterations; index += 1) {
|
|
4199
4211
|
if (request.leave_draft && nextParams.leave_draft === void 0) {
|
|
4200
4212
|
nextParams = { ...nextParams, leave_draft: true };
|
|
@@ -4253,6 +4265,7 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
4253
4265
|
if (engineState) state.request.engine_state_path = engineState;
|
|
4254
4266
|
state.last_checkpoint = result.checkpoint || state.last_checkpoint || null;
|
|
4255
4267
|
const resultStage = stageFromCheckpoint(result);
|
|
4268
|
+
stageIterations[resultStage] = (stageIterations[resultStage] || 0) + 1;
|
|
4256
4269
|
heartbeat(state, {
|
|
4257
4270
|
stage: resultStage,
|
|
4258
4271
|
summary: `${resultStage} stage is active.`,
|
|
@@ -4278,6 +4291,22 @@ async function runRiddleProofEngineHarness(input) {
|
|
|
4278
4291
|
finished_at: timestamp2()
|
|
4279
4292
|
}
|
|
4280
4293
|
});
|
|
4294
|
+
const stageLimit = DEFAULT_STAGE_ITERATION_LIMITS[resultStage];
|
|
4295
|
+
if (stageLimit && stageIterations[resultStage] > stageLimit) {
|
|
4296
|
+
return blockerResult(state, result, {
|
|
4297
|
+
code: "stage_iteration_limit_reached",
|
|
4298
|
+
checkpoint: result.checkpoint || null,
|
|
4299
|
+
message: `The harness exceeded the ${resultStage} stage iteration limit before the proof was ready or shipped.`,
|
|
4300
|
+
details: {
|
|
4301
|
+
stage: resultStage,
|
|
4302
|
+
stage_iterations: stageIterations[resultStage],
|
|
4303
|
+
stage_iteration_limit: stageLimit,
|
|
4304
|
+
max_iterations: maxIterations,
|
|
4305
|
+
lastCheckpoint: result.checkpoint || null,
|
|
4306
|
+
lastSummary: result.summary || null
|
|
4307
|
+
}
|
|
4308
|
+
});
|
|
4309
|
+
}
|
|
4281
4310
|
const routed = await routeCheckpoint(request, state, result, agent, input);
|
|
4282
4311
|
if (routed.terminal) return routed.terminal;
|
|
4283
4312
|
if (routed.blocker) return blockerResult(state, result, routed.blocker);
|
package/dist/index.js
CHANGED