@riddledc/riddle-proof 0.5.49 → 0.5.51
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 +9 -0
- package/dist/checkpoint.cjs +76 -0
- package/dist/checkpoint.d.cts +11 -2
- package/dist/checkpoint.d.ts +11 -2
- package/dist/checkpoint.js +3 -1
- package/dist/{chunk-YW77WDTR.js → chunk-3266V3MO.js} +7 -3
- package/dist/{chunk-R6SCWJCI.js → chunk-36CBRVAK.js} +75 -0
- package/dist/{chunk-U7Q3RB5D.js → chunk-KLOSE27H.js} +1 -1
- package/dist/{chunk-722PW3X3.js → chunk-LBZWFSTU.js} +3 -3
- package/dist/{chunk-CI2F66EE.js → chunk-T7YFCZND.js} +1 -1
- package/dist/{chunk-YJPQOAZG.js → chunk-WKKMBN5S.js} +1 -1
- package/dist/cli.cjs +143 -4
- package/dist/cli.js +69 -6
- package/dist/codex-exec-agent.cjs +7 -3
- package/dist/codex-exec-agent.js +1 -1
- package/dist/engine-harness.js +4 -4
- package/dist/index.cjs +83 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -6
- package/dist/local-agent.cjs +7 -3
- package/dist/local-agent.js +1 -1
- package/dist/openclaw.js +3 -3
- package/dist/proof-run-core.d.cts +1 -1
- package/dist/proof-run-core.d.ts +1 -1
- package/dist/proof-run-engine.d.cts +3 -3
- package/dist/proof-run-engine.d.ts +3 -3
- package/dist/run-card.js +2 -2
- package/dist/runner.js +4 -4
- package/dist/state.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -63,9 +63,11 @@ Codex/CLI-style testing:
|
|
|
63
63
|
|
|
64
64
|
```sh
|
|
65
65
|
riddle-proof-loop run --request-json request.json --checkpoint-mode yield
|
|
66
|
+
riddle-proof-loop checkpoint --state-path /tmp/riddle-proof-run.json
|
|
66
67
|
riddle-proof-loop run --request-json request.json --agent local
|
|
67
68
|
riddle-proof-loop status --state-path /tmp/riddle-proof-run.json
|
|
68
69
|
riddle-proof-loop respond --state-path /tmp/riddle-proof-run.json --response-json response.json
|
|
70
|
+
riddle-proof-loop respond --state-path /tmp/riddle-proof-run.json --decision ready_for_author --summary "Baseline is trustworthy."
|
|
69
71
|
riddle-proof-loop doctor local
|
|
70
72
|
```
|
|
71
73
|
|
|
@@ -74,6 +76,13 @@ authoring, implementation, proof assessment, and evidence recovery. A host can
|
|
|
74
76
|
answer those packets with `riddle-proof.checkpoint_response.v1` JSON without
|
|
75
77
|
needing OpenClaw-specific proof semantics.
|
|
76
78
|
|
|
79
|
+
For a sole-agent loop, keep the agent in charge of the checkpoint response:
|
|
80
|
+
run until a checkpoint, inspect `riddle-proof-loop checkpoint` for the packet,
|
|
81
|
+
act directly when the packet asks for implementation, then respond with either
|
|
82
|
+
full `--response-json` or the shorter `--decision` / `--summary` /
|
|
83
|
+
`--payload-json` flags. No local executor or OpenClaw surface is required for
|
|
84
|
+
that base workflow.
|
|
85
|
+
|
|
77
86
|
`--agent local` is the generic CLI executor slot. The current implementation
|
|
78
87
|
uses the local Codex CLI adapter underneath, but the loop contract and CLI
|
|
79
88
|
surface are intentionally not Codex-specific.
|
package/dist/checkpoint.cjs
CHANGED
|
@@ -39,6 +39,7 @@ __export(checkpoint_exports, {
|
|
|
39
39
|
buildStageCheckpointPacket: () => buildStageCheckpointPacket,
|
|
40
40
|
checkpointResponseIdentity: () => checkpointResponseIdentity,
|
|
41
41
|
checkpointSummaryFromState: () => checkpointSummaryFromState,
|
|
42
|
+
createCheckpointResponseTemplate: () => createCheckpointResponseTemplate,
|
|
42
43
|
isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
|
|
43
44
|
normalizeCheckpointResponse: () => normalizeCheckpointResponse,
|
|
44
45
|
proofContractFromAuthorCheckpointResponse: () => proofContractFromAuthorCheckpointResponse,
|
|
@@ -602,6 +603,80 @@ function normalizeCheckpointResponse(value) {
|
|
|
602
603
|
created_at: nonEmptyString(record.created_at) || timestamp()
|
|
603
604
|
});
|
|
604
605
|
}
|
|
606
|
+
function defaultContinueStage(packet, decision) {
|
|
607
|
+
if (decision === "ready_for_author" || decision === "author_packet" || decision === "needs_author") return "author";
|
|
608
|
+
if (decision === "implementation_complete") return "verify";
|
|
609
|
+
if (decision === "ready_to_ship") return "ship";
|
|
610
|
+
if (decision === "revise_capture") return "verify";
|
|
611
|
+
if (decision === "retry_recon" || decision === "recon_stuck" || decision === "needs_recon") return "recon";
|
|
612
|
+
if (decision === "needs_implementation") return "implement";
|
|
613
|
+
if (decision === "continue_stage" || decision === "retry_stage") return packet.stage;
|
|
614
|
+
return void 0;
|
|
615
|
+
}
|
|
616
|
+
function templatePayloadFor(packet, decision) {
|
|
617
|
+
if (packet.kind === "author_proof" || decision === "author_packet") {
|
|
618
|
+
return {
|
|
619
|
+
proof_plan: "TODO: describe the exact proof plan and stop condition.",
|
|
620
|
+
capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
|
|
621
|
+
summary: "TODO: summarize why this proof packet targets the requested change."
|
|
622
|
+
};
|
|
623
|
+
}
|
|
624
|
+
if (packet.kind === "implement_change" || decision === "implementation_complete") {
|
|
625
|
+
return {
|
|
626
|
+
changed_files: [],
|
|
627
|
+
tests_run: [],
|
|
628
|
+
implementation_notes: "TODO: summarize the direct edits made in the after worktree."
|
|
629
|
+
};
|
|
630
|
+
}
|
|
631
|
+
if (packet.kind === "assess_recon" || packet.stage === "recon") {
|
|
632
|
+
return {
|
|
633
|
+
baseline_understanding: {
|
|
634
|
+
reference: "TODO",
|
|
635
|
+
target_route: "TODO",
|
|
636
|
+
before_evidence_url: "TODO",
|
|
637
|
+
visible_before_state: "TODO",
|
|
638
|
+
relevant_elements: [],
|
|
639
|
+
requested_change: packet.change_request,
|
|
640
|
+
proof_focus: "TODO",
|
|
641
|
+
stop_condition: "TODO",
|
|
642
|
+
quality_risks: []
|
|
643
|
+
},
|
|
644
|
+
refined_inputs: {
|
|
645
|
+
server_path: null,
|
|
646
|
+
wait_for_selector: null,
|
|
647
|
+
reference: null
|
|
648
|
+
}
|
|
649
|
+
};
|
|
650
|
+
}
|
|
651
|
+
if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
|
|
652
|
+
return {
|
|
653
|
+
recommended_stage: defaultContinueStage(packet, decision) || packet.stage,
|
|
654
|
+
evidence_issue_code: packet.evidence_excerpt?.evidence_issue_code || null,
|
|
655
|
+
visual_delta: packet.evidence_excerpt?.visual_delta || null
|
|
656
|
+
};
|
|
657
|
+
}
|
|
658
|
+
return void 0;
|
|
659
|
+
}
|
|
660
|
+
function createCheckpointResponseTemplate(packet, input = {}) {
|
|
661
|
+
const allowed = Array.isArray(packet.allowed_decisions) ? packet.allowed_decisions : [];
|
|
662
|
+
const decision = input.decision && allowed.includes(input.decision) ? input.decision : allowed[0] || "blocked";
|
|
663
|
+
const continueStage = input.continue_with_stage || defaultContinueStage(packet, decision);
|
|
664
|
+
return compactRecord({
|
|
665
|
+
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
666
|
+
run_id: packet.run_id,
|
|
667
|
+
checkpoint: packet.checkpoint,
|
|
668
|
+
resume_token: packet.resume_token,
|
|
669
|
+
decision,
|
|
670
|
+
summary: input.summary || `TODO: explain checkpoint decision ${decision}.`,
|
|
671
|
+
payload: input.payload || templatePayloadFor(packet, decision),
|
|
672
|
+
reasons: input.reasons || ["TODO: replace with concrete reason(s)."],
|
|
673
|
+
continue_with_stage: continueStage,
|
|
674
|
+
source: {
|
|
675
|
+
kind: input.source_kind || "codex"
|
|
676
|
+
},
|
|
677
|
+
created_at: input.created_at || timestamp()
|
|
678
|
+
});
|
|
679
|
+
}
|
|
605
680
|
function checkpointSummaryFromState(state, engineStatePath) {
|
|
606
681
|
const history = state.checkpoint_history || [];
|
|
607
682
|
const packets = history.filter((entry) => entry.packet);
|
|
@@ -702,6 +777,7 @@ function proofContractFromAuthorCheckpointResponse(response, packet, payload) {
|
|
|
702
777
|
buildStageCheckpointPacket,
|
|
703
778
|
checkpointResponseIdentity,
|
|
704
779
|
checkpointSummaryFromState,
|
|
780
|
+
createCheckpointResponseTemplate,
|
|
705
781
|
isDuplicateCheckpointResponse,
|
|
706
782
|
normalizeCheckpointResponse,
|
|
707
783
|
proofContractFromAuthorCheckpointResponse,
|
package/dist/checkpoint.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunState, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofProofContract, RiddleProofStatePaths } from './types.cjs';
|
|
1
|
+
import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunState, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStage, RiddleProofProofContract, RiddleProofStatePaths } from './types.cjs';
|
|
2
2
|
|
|
3
3
|
declare const RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: "riddle-proof.checkpoint.v1";
|
|
4
4
|
declare const RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: "riddle-proof.checkpoint_response.v1";
|
|
@@ -61,10 +61,19 @@ declare function buildCheckpointPacketForEngineResult(input: {
|
|
|
61
61
|
created_at?: string;
|
|
62
62
|
}): RiddleProofCheckpointPacket;
|
|
63
63
|
declare function normalizeCheckpointResponse(value: unknown): RiddleProofCheckpointResponse | null;
|
|
64
|
+
declare function createCheckpointResponseTemplate(packet: RiddleProofCheckpointPacket, input?: {
|
|
65
|
+
decision?: string;
|
|
66
|
+
summary?: string;
|
|
67
|
+
payload?: Record<string, unknown>;
|
|
68
|
+
reasons?: string[];
|
|
69
|
+
continue_with_stage?: RiddleProofStage;
|
|
70
|
+
source_kind?: NonNullable<RiddleProofCheckpointResponse["source"]>["kind"];
|
|
71
|
+
created_at?: string;
|
|
72
|
+
}): RiddleProofCheckpointResponse;
|
|
64
73
|
declare function checkpointSummaryFromState(state: RiddleProofRunState, engineStatePath?: string | null): RiddleProofCheckpointSummary;
|
|
65
74
|
declare function isDuplicateCheckpointResponse(state: RiddleProofRunState, response: RiddleProofCheckpointResponse): boolean;
|
|
66
75
|
declare function checkpointResponseIdentity(response: RiddleProofCheckpointResponse): string;
|
|
67
76
|
declare function authorPacketPayloadFromCheckpointResponse(response: RiddleProofCheckpointResponse): Record<string, unknown> | null;
|
|
68
77
|
declare function proofContractFromAuthorCheckpointResponse(response: RiddleProofCheckpointResponse, packet: RiddleProofCheckpointPacket, payload: Record<string, unknown>): RiddleProofProofContract;
|
|
69
78
|
|
|
70
|
-
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
|
79
|
+
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
package/dist/checkpoint.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunState, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofProofContract, RiddleProofStatePaths } from './types.js';
|
|
1
|
+
import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunState, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStage, RiddleProofProofContract, RiddleProofStatePaths } from './types.js';
|
|
2
2
|
|
|
3
3
|
declare const RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: "riddle-proof.checkpoint.v1";
|
|
4
4
|
declare const RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: "riddle-proof.checkpoint_response.v1";
|
|
@@ -61,10 +61,19 @@ declare function buildCheckpointPacketForEngineResult(input: {
|
|
|
61
61
|
created_at?: string;
|
|
62
62
|
}): RiddleProofCheckpointPacket;
|
|
63
63
|
declare function normalizeCheckpointResponse(value: unknown): RiddleProofCheckpointResponse | null;
|
|
64
|
+
declare function createCheckpointResponseTemplate(packet: RiddleProofCheckpointPacket, input?: {
|
|
65
|
+
decision?: string;
|
|
66
|
+
summary?: string;
|
|
67
|
+
payload?: Record<string, unknown>;
|
|
68
|
+
reasons?: string[];
|
|
69
|
+
continue_with_stage?: RiddleProofStage;
|
|
70
|
+
source_kind?: NonNullable<RiddleProofCheckpointResponse["source"]>["kind"];
|
|
71
|
+
created_at?: string;
|
|
72
|
+
}): RiddleProofCheckpointResponse;
|
|
64
73
|
declare function checkpointSummaryFromState(state: RiddleProofRunState, engineStatePath?: string | null): RiddleProofCheckpointSummary;
|
|
65
74
|
declare function isDuplicateCheckpointResponse(state: RiddleProofRunState, response: RiddleProofCheckpointResponse): boolean;
|
|
66
75
|
declare function checkpointResponseIdentity(response: RiddleProofCheckpointResponse): string;
|
|
67
76
|
declare function authorPacketPayloadFromCheckpointResponse(response: RiddleProofCheckpointResponse): Record<string, unknown> | null;
|
|
68
77
|
declare function proofContractFromAuthorCheckpointResponse(response: RiddleProofCheckpointResponse, packet: RiddleProofCheckpointPacket, payload: Record<string, unknown>): RiddleProofProofContract;
|
|
69
78
|
|
|
70
|
-
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
|
79
|
+
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState };
|
package/dist/checkpoint.js
CHANGED
|
@@ -8,11 +8,12 @@ import {
|
|
|
8
8
|
buildStageCheckpointPacket,
|
|
9
9
|
checkpointResponseIdentity,
|
|
10
10
|
checkpointSummaryFromState,
|
|
11
|
+
createCheckpointResponseTemplate,
|
|
11
12
|
isDuplicateCheckpointResponse,
|
|
12
13
|
normalizeCheckpointResponse,
|
|
13
14
|
proofContractFromAuthorCheckpointResponse,
|
|
14
15
|
statePathsForRunState
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-36CBRVAK.js";
|
|
16
17
|
import "./chunk-DUFDZJOF.js";
|
|
17
18
|
export {
|
|
18
19
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
@@ -24,6 +25,7 @@ export {
|
|
|
24
25
|
buildStageCheckpointPacket,
|
|
25
26
|
checkpointResponseIdentity,
|
|
26
27
|
checkpointSummaryFromState,
|
|
28
|
+
createCheckpointResponseTemplate,
|
|
27
29
|
isDuplicateCheckpointResponse,
|
|
28
30
|
normalizeCheckpointResponse,
|
|
29
31
|
proofContractFromAuthorCheckpointResponse,
|
|
@@ -132,10 +132,11 @@ var PROOF_SCHEMA = {
|
|
|
132
132
|
source: { type: "string", enum: ["supervising_agent"] }
|
|
133
133
|
}
|
|
134
134
|
};
|
|
135
|
-
var PROMPT_STRING_LIMIT =
|
|
135
|
+
var PROMPT_STRING_LIMIT = 1e3;
|
|
136
136
|
var PROMPT_ARRAY_LIMIT = 8;
|
|
137
137
|
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
138
|
-
var PROMPT_BLOCK_LIMIT =
|
|
138
|
+
var PROMPT_BLOCK_LIMIT = 16e3;
|
|
139
|
+
var PROMPT_TOTAL_LIMIT = 58e3;
|
|
139
140
|
var PROMPT_KEY_PRIORITY = [
|
|
140
141
|
"ok",
|
|
141
142
|
"status",
|
|
@@ -250,7 +251,7 @@ function resolveWorkdir(context, fallback = "/tmp") {
|
|
|
250
251
|
return after || fallback;
|
|
251
252
|
}
|
|
252
253
|
function basePrompt(context, role) {
|
|
253
|
-
|
|
254
|
+
const prompt = [
|
|
254
255
|
role,
|
|
255
256
|
"",
|
|
256
257
|
"You are the supervising Codex worker inside the Riddle Proof harness.",
|
|
@@ -262,6 +263,9 @@ function basePrompt(context, role) {
|
|
|
262
263
|
jsonBlock("Riddle checkpoint result", context.engineResult),
|
|
263
264
|
jsonBlock("Full riddle state", context.fullRiddleState || {})
|
|
264
265
|
].join("\n");
|
|
266
|
+
if (prompt.length <= PROMPT_TOTAL_LIMIT) return prompt;
|
|
267
|
+
return `${prompt.slice(0, PROMPT_TOTAL_LIMIT).trimEnd()}
|
|
268
|
+
...[truncated ${prompt.length - PROMPT_TOTAL_LIMIT} chars from total prompt]`;
|
|
265
269
|
}
|
|
266
270
|
function schemaRequiredKeys(schema) {
|
|
267
271
|
const required = schema?.required;
|
|
@@ -549,6 +549,80 @@ function normalizeCheckpointResponse(value) {
|
|
|
549
549
|
created_at: nonEmptyString(record.created_at) || timestamp()
|
|
550
550
|
});
|
|
551
551
|
}
|
|
552
|
+
function defaultContinueStage(packet, decision) {
|
|
553
|
+
if (decision === "ready_for_author" || decision === "author_packet" || decision === "needs_author") return "author";
|
|
554
|
+
if (decision === "implementation_complete") return "verify";
|
|
555
|
+
if (decision === "ready_to_ship") return "ship";
|
|
556
|
+
if (decision === "revise_capture") return "verify";
|
|
557
|
+
if (decision === "retry_recon" || decision === "recon_stuck" || decision === "needs_recon") return "recon";
|
|
558
|
+
if (decision === "needs_implementation") return "implement";
|
|
559
|
+
if (decision === "continue_stage" || decision === "retry_stage") return packet.stage;
|
|
560
|
+
return void 0;
|
|
561
|
+
}
|
|
562
|
+
function templatePayloadFor(packet, decision) {
|
|
563
|
+
if (packet.kind === "author_proof" || decision === "author_packet") {
|
|
564
|
+
return {
|
|
565
|
+
proof_plan: "TODO: describe the exact proof plan and stop condition.",
|
|
566
|
+
capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
|
|
567
|
+
summary: "TODO: summarize why this proof packet targets the requested change."
|
|
568
|
+
};
|
|
569
|
+
}
|
|
570
|
+
if (packet.kind === "implement_change" || decision === "implementation_complete") {
|
|
571
|
+
return {
|
|
572
|
+
changed_files: [],
|
|
573
|
+
tests_run: [],
|
|
574
|
+
implementation_notes: "TODO: summarize the direct edits made in the after worktree."
|
|
575
|
+
};
|
|
576
|
+
}
|
|
577
|
+
if (packet.kind === "assess_recon" || packet.stage === "recon") {
|
|
578
|
+
return {
|
|
579
|
+
baseline_understanding: {
|
|
580
|
+
reference: "TODO",
|
|
581
|
+
target_route: "TODO",
|
|
582
|
+
before_evidence_url: "TODO",
|
|
583
|
+
visible_before_state: "TODO",
|
|
584
|
+
relevant_elements: [],
|
|
585
|
+
requested_change: packet.change_request,
|
|
586
|
+
proof_focus: "TODO",
|
|
587
|
+
stop_condition: "TODO",
|
|
588
|
+
quality_risks: []
|
|
589
|
+
},
|
|
590
|
+
refined_inputs: {
|
|
591
|
+
server_path: null,
|
|
592
|
+
wait_for_selector: null,
|
|
593
|
+
reference: null
|
|
594
|
+
}
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
|
|
598
|
+
return {
|
|
599
|
+
recommended_stage: defaultContinueStage(packet, decision) || packet.stage,
|
|
600
|
+
evidence_issue_code: packet.evidence_excerpt?.evidence_issue_code || null,
|
|
601
|
+
visual_delta: packet.evidence_excerpt?.visual_delta || null
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
return void 0;
|
|
605
|
+
}
|
|
606
|
+
function createCheckpointResponseTemplate(packet, input = {}) {
|
|
607
|
+
const allowed = Array.isArray(packet.allowed_decisions) ? packet.allowed_decisions : [];
|
|
608
|
+
const decision = input.decision && allowed.includes(input.decision) ? input.decision : allowed[0] || "blocked";
|
|
609
|
+
const continueStage = input.continue_with_stage || defaultContinueStage(packet, decision);
|
|
610
|
+
return compactRecord({
|
|
611
|
+
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
612
|
+
run_id: packet.run_id,
|
|
613
|
+
checkpoint: packet.checkpoint,
|
|
614
|
+
resume_token: packet.resume_token,
|
|
615
|
+
decision,
|
|
616
|
+
summary: input.summary || `TODO: explain checkpoint decision ${decision}.`,
|
|
617
|
+
payload: input.payload || templatePayloadFor(packet, decision),
|
|
618
|
+
reasons: input.reasons || ["TODO: replace with concrete reason(s)."],
|
|
619
|
+
continue_with_stage: continueStage,
|
|
620
|
+
source: {
|
|
621
|
+
kind: input.source_kind || "codex"
|
|
622
|
+
},
|
|
623
|
+
created_at: input.created_at || timestamp()
|
|
624
|
+
});
|
|
625
|
+
}
|
|
552
626
|
function checkpointSummaryFromState(state, engineStatePath) {
|
|
553
627
|
const history = state.checkpoint_history || [];
|
|
554
628
|
const packets = history.filter((entry) => entry.packet);
|
|
@@ -648,6 +722,7 @@ export {
|
|
|
648
722
|
buildProofAssessmentCheckpointPacket,
|
|
649
723
|
buildCheckpointPacketForEngineResult,
|
|
650
724
|
normalizeCheckpointResponse,
|
|
725
|
+
createCheckpointResponseTemplate,
|
|
651
726
|
checkpointSummaryFromState,
|
|
652
727
|
isDuplicateCheckpointResponse,
|
|
653
728
|
checkpointResponseIdentity,
|
|
@@ -10,10 +10,10 @@ import {
|
|
|
10
10
|
createRunStatusSnapshot,
|
|
11
11
|
normalizeRunParams,
|
|
12
12
|
setRunStatus
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-KLOSE27H.js";
|
|
14
14
|
import {
|
|
15
15
|
createRiddleProofRunCard
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-T7YFCZND.js";
|
|
17
17
|
import {
|
|
18
18
|
authorPacketPayloadFromCheckpointResponse,
|
|
19
19
|
buildCheckpointPacketForEngineResult,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
normalizeCheckpointResponse,
|
|
24
24
|
proofContractFromAuthorCheckpointResponse,
|
|
25
25
|
statePathsForRunState
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-36CBRVAK.js";
|
|
27
27
|
import {
|
|
28
28
|
applyTerminalMetadata,
|
|
29
29
|
compactRecord,
|
package/dist/cli.cjs
CHANGED
|
@@ -3538,6 +3538,80 @@ function normalizeCheckpointResponse(value) {
|
|
|
3538
3538
|
created_at: nonEmptyString(record.created_at) || timestamp()
|
|
3539
3539
|
});
|
|
3540
3540
|
}
|
|
3541
|
+
function defaultContinueStage(packet, decision) {
|
|
3542
|
+
if (decision === "ready_for_author" || decision === "author_packet" || decision === "needs_author") return "author";
|
|
3543
|
+
if (decision === "implementation_complete") return "verify";
|
|
3544
|
+
if (decision === "ready_to_ship") return "ship";
|
|
3545
|
+
if (decision === "revise_capture") return "verify";
|
|
3546
|
+
if (decision === "retry_recon" || decision === "recon_stuck" || decision === "needs_recon") return "recon";
|
|
3547
|
+
if (decision === "needs_implementation") return "implement";
|
|
3548
|
+
if (decision === "continue_stage" || decision === "retry_stage") return packet.stage;
|
|
3549
|
+
return void 0;
|
|
3550
|
+
}
|
|
3551
|
+
function templatePayloadFor(packet, decision) {
|
|
3552
|
+
if (packet.kind === "author_proof" || decision === "author_packet") {
|
|
3553
|
+
return {
|
|
3554
|
+
proof_plan: "TODO: describe the exact proof plan and stop condition.",
|
|
3555
|
+
capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
|
|
3556
|
+
summary: "TODO: summarize why this proof packet targets the requested change."
|
|
3557
|
+
};
|
|
3558
|
+
}
|
|
3559
|
+
if (packet.kind === "implement_change" || decision === "implementation_complete") {
|
|
3560
|
+
return {
|
|
3561
|
+
changed_files: [],
|
|
3562
|
+
tests_run: [],
|
|
3563
|
+
implementation_notes: "TODO: summarize the direct edits made in the after worktree."
|
|
3564
|
+
};
|
|
3565
|
+
}
|
|
3566
|
+
if (packet.kind === "assess_recon" || packet.stage === "recon") {
|
|
3567
|
+
return {
|
|
3568
|
+
baseline_understanding: {
|
|
3569
|
+
reference: "TODO",
|
|
3570
|
+
target_route: "TODO",
|
|
3571
|
+
before_evidence_url: "TODO",
|
|
3572
|
+
visible_before_state: "TODO",
|
|
3573
|
+
relevant_elements: [],
|
|
3574
|
+
requested_change: packet.change_request,
|
|
3575
|
+
proof_focus: "TODO",
|
|
3576
|
+
stop_condition: "TODO",
|
|
3577
|
+
quality_risks: []
|
|
3578
|
+
},
|
|
3579
|
+
refined_inputs: {
|
|
3580
|
+
server_path: null,
|
|
3581
|
+
wait_for_selector: null,
|
|
3582
|
+
reference: null
|
|
3583
|
+
}
|
|
3584
|
+
};
|
|
3585
|
+
}
|
|
3586
|
+
if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
|
|
3587
|
+
return {
|
|
3588
|
+
recommended_stage: defaultContinueStage(packet, decision) || packet.stage,
|
|
3589
|
+
evidence_issue_code: packet.evidence_excerpt?.evidence_issue_code || null,
|
|
3590
|
+
visual_delta: packet.evidence_excerpt?.visual_delta || null
|
|
3591
|
+
};
|
|
3592
|
+
}
|
|
3593
|
+
return void 0;
|
|
3594
|
+
}
|
|
3595
|
+
function createCheckpointResponseTemplate(packet, input = {}) {
|
|
3596
|
+
const allowed = Array.isArray(packet.allowed_decisions) ? packet.allowed_decisions : [];
|
|
3597
|
+
const decision = input.decision && allowed.includes(input.decision) ? input.decision : allowed[0] || "blocked";
|
|
3598
|
+
const continueStage = input.continue_with_stage || defaultContinueStage(packet, decision);
|
|
3599
|
+
return compactRecord({
|
|
3600
|
+
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
3601
|
+
run_id: packet.run_id,
|
|
3602
|
+
checkpoint: packet.checkpoint,
|
|
3603
|
+
resume_token: packet.resume_token,
|
|
3604
|
+
decision,
|
|
3605
|
+
summary: input.summary || `TODO: explain checkpoint decision ${decision}.`,
|
|
3606
|
+
payload: input.payload || templatePayloadFor(packet, decision),
|
|
3607
|
+
reasons: input.reasons || ["TODO: replace with concrete reason(s)."],
|
|
3608
|
+
continue_with_stage: continueStage,
|
|
3609
|
+
source: {
|
|
3610
|
+
kind: input.source_kind || "codex"
|
|
3611
|
+
},
|
|
3612
|
+
created_at: input.created_at || timestamp()
|
|
3613
|
+
});
|
|
3614
|
+
}
|
|
3541
3615
|
function checkpointSummaryFromState(state, engineStatePath2) {
|
|
3542
3616
|
const history = state.checkpoint_history || [];
|
|
3543
3617
|
const packets = history.filter((entry) => entry.packet);
|
|
@@ -5609,10 +5683,11 @@ var PROOF_SCHEMA = {
|
|
|
5609
5683
|
source: { type: "string", enum: ["supervising_agent"] }
|
|
5610
5684
|
}
|
|
5611
5685
|
};
|
|
5612
|
-
var PROMPT_STRING_LIMIT =
|
|
5686
|
+
var PROMPT_STRING_LIMIT = 1e3;
|
|
5613
5687
|
var PROMPT_ARRAY_LIMIT = 8;
|
|
5614
5688
|
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
5615
|
-
var PROMPT_BLOCK_LIMIT =
|
|
5689
|
+
var PROMPT_BLOCK_LIMIT = 16e3;
|
|
5690
|
+
var PROMPT_TOTAL_LIMIT = 58e3;
|
|
5616
5691
|
var PROMPT_KEY_PRIORITY = [
|
|
5617
5692
|
"ok",
|
|
5618
5693
|
"status",
|
|
@@ -5727,7 +5802,7 @@ function resolveWorkdir(context, fallback = "/tmp") {
|
|
|
5727
5802
|
return after || fallback;
|
|
5728
5803
|
}
|
|
5729
5804
|
function basePrompt(context, role) {
|
|
5730
|
-
|
|
5805
|
+
const prompt = [
|
|
5731
5806
|
role,
|
|
5732
5807
|
"",
|
|
5733
5808
|
"You are the supervising Codex worker inside the Riddle Proof harness.",
|
|
@@ -5739,6 +5814,9 @@ function basePrompt(context, role) {
|
|
|
5739
5814
|
jsonBlock("Riddle checkpoint result", context.engineResult),
|
|
5740
5815
|
jsonBlock("Full riddle state", context.fullRiddleState || {})
|
|
5741
5816
|
].join("\n");
|
|
5817
|
+
if (prompt.length <= PROMPT_TOTAL_LIMIT) return prompt;
|
|
5818
|
+
return `${prompt.slice(0, PROMPT_TOTAL_LIMIT).trimEnd()}
|
|
5819
|
+
...[truncated ${prompt.length - PROMPT_TOTAL_LIMIT} chars from total prompt]`;
|
|
5742
5820
|
}
|
|
5743
5821
|
function schemaRequiredKeys(schema) {
|
|
5744
5822
|
const required = schema?.required;
|
|
@@ -6323,7 +6401,9 @@ function usage() {
|
|
|
6323
6401
|
return [
|
|
6324
6402
|
"Usage:",
|
|
6325
6403
|
" riddle-proof-loop run --request-json <file|json|-> [--agent disabled|local] [--checkpoint-mode yield|auto]",
|
|
6404
|
+
" riddle-proof-loop checkpoint --state-path <path> [--decision <decision>]",
|
|
6326
6405
|
" riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
|
|
6406
|
+
" riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
|
|
6327
6407
|
" riddle-proof-loop status --state-path <path>",
|
|
6328
6408
|
" riddle-proof-loop doctor local [--codex-command <path>]",
|
|
6329
6409
|
"",
|
|
@@ -6367,6 +6447,18 @@ function readJsonValue(value, label) {
|
|
|
6367
6447
|
}
|
|
6368
6448
|
return parsed;
|
|
6369
6449
|
}
|
|
6450
|
+
function readOptionalJsonRecord(value, label) {
|
|
6451
|
+
if (!value) return void 0;
|
|
6452
|
+
return readJsonValue(value, label);
|
|
6453
|
+
}
|
|
6454
|
+
function readOptionalJsonStringArray(value, label) {
|
|
6455
|
+
if (!value) return void 0;
|
|
6456
|
+
const parsed = value === "-" ? JSON.parse(readStdin()) : (0, import_node_fs5.existsSync)(value) ? JSON.parse((0, import_node_fs5.readFileSync)(value, "utf-8")) : JSON.parse(value);
|
|
6457
|
+
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
|
|
6458
|
+
throw new Error(`${label} must be a JSON array of strings.`);
|
|
6459
|
+
}
|
|
6460
|
+
return parsed;
|
|
6461
|
+
}
|
|
6370
6462
|
function readRunState(statePath) {
|
|
6371
6463
|
const parsed = readJsonValue(statePath, "--state-path");
|
|
6372
6464
|
if (parsed.version !== "riddle-proof.run-state.v1" || !Array.isArray(parsed.events)) {
|
|
@@ -6374,6 +6466,29 @@ function readRunState(statePath) {
|
|
|
6374
6466
|
}
|
|
6375
6467
|
return parsed;
|
|
6376
6468
|
}
|
|
6469
|
+
function checkpointResponseForFlags(statePath, options) {
|
|
6470
|
+
const state = readRunState(statePath);
|
|
6471
|
+
if (!state.checkpoint_packet) {
|
|
6472
|
+
throw new Error(`${statePath} has no pending checkpoint packet. Use status to inspect the current run state.`);
|
|
6473
|
+
}
|
|
6474
|
+
const decision = optionString(options, "decision");
|
|
6475
|
+
const summary = optionString(options, "summary");
|
|
6476
|
+
if (!decision || !summary) {
|
|
6477
|
+
throw new Error("--decision and --summary are required when --response-json is not supplied.");
|
|
6478
|
+
}
|
|
6479
|
+
if (!state.checkpoint_packet.allowed_decisions.includes(decision)) {
|
|
6480
|
+
throw new Error(`--decision ${decision} is not allowed for ${state.checkpoint_packet.checkpoint}. Allowed decisions: ${state.checkpoint_packet.allowed_decisions.join(", ")}`);
|
|
6481
|
+
}
|
|
6482
|
+
return createCheckpointResponseTemplate(state.checkpoint_packet, {
|
|
6483
|
+
decision,
|
|
6484
|
+
summary,
|
|
6485
|
+
payload: readOptionalJsonRecord(optionString(options, "payloadJson"), "--payload-json"),
|
|
6486
|
+
reasons: readOptionalJsonStringArray(optionString(options, "reasonsJson"), "--reasons-json"),
|
|
6487
|
+
continue_with_stage: optionString(options, "continueWithStage"),
|
|
6488
|
+
source_kind: optionString(options, "sourceKind") || "codex",
|
|
6489
|
+
created_at: optionString(options, "createdAt")
|
|
6490
|
+
});
|
|
6491
|
+
}
|
|
6377
6492
|
function codexConfig(options) {
|
|
6378
6493
|
const codexFullAuto = optionString(options, "codexFullAuto");
|
|
6379
6494
|
return {
|
|
@@ -6430,13 +6545,37 @@ async function main() {
|
|
|
6430
6545
|
const snapshot = readRiddleProofRunStatus(statePath);
|
|
6431
6546
|
if (!snapshot) throw new Error(`${statePath} is not a readable Riddle Proof run state.`);
|
|
6432
6547
|
process.stdout.write(`${JSON.stringify(snapshot, null, 2)}
|
|
6548
|
+
`);
|
|
6549
|
+
return;
|
|
6550
|
+
}
|
|
6551
|
+
if (command === "checkpoint") {
|
|
6552
|
+
const statePath = optionString(options, "statePath");
|
|
6553
|
+
if (!statePath) throw new Error("--state-path is required.");
|
|
6554
|
+
const state = readRunState(statePath);
|
|
6555
|
+
const snapshot = readRiddleProofRunStatus(statePath);
|
|
6556
|
+
if (!state.checkpoint_packet) {
|
|
6557
|
+
throw new Error(`${statePath} has no pending checkpoint packet.`);
|
|
6558
|
+
}
|
|
6559
|
+
const responseTemplate = createCheckpointResponseTemplate(state.checkpoint_packet, {
|
|
6560
|
+
decision: optionString(options, "decision"),
|
|
6561
|
+
source_kind: optionString(options, "sourceKind") || "codex"
|
|
6562
|
+
});
|
|
6563
|
+
process.stdout.write(`${JSON.stringify({
|
|
6564
|
+
checkpoint_packet: state.checkpoint_packet,
|
|
6565
|
+
run_card: snapshot?.run_card || state.run_card || null,
|
|
6566
|
+
response_template: responseTemplate,
|
|
6567
|
+
next_commands: [
|
|
6568
|
+
`riddle-proof-loop respond --state-path ${statePath} --decision ${responseTemplate.decision} --summary <summary> --payload-json <file|json|->`,
|
|
6569
|
+
`riddle-proof-loop status --state-path ${statePath}`
|
|
6570
|
+
]
|
|
6571
|
+
}, null, 2)}
|
|
6433
6572
|
`);
|
|
6434
6573
|
return;
|
|
6435
6574
|
}
|
|
6436
6575
|
if (command === "run" || command === "respond") {
|
|
6437
6576
|
const statePath = optionString(options, "statePath");
|
|
6438
6577
|
const request = requestForRun(options);
|
|
6439
|
-
const response = command === "respond" ? readJsonValue(optionString(options, "responseJson"), "--response-json") : void 0;
|
|
6578
|
+
const response = command === "respond" ? optionString(options, "responseJson") ? readJsonValue(optionString(options, "responseJson"), "--response-json") : checkpointResponseForFlags(statePath || "", options) : void 0;
|
|
6440
6579
|
const result = await runRiddleProofEngineHarness({
|
|
6441
6580
|
request,
|
|
6442
6581
|
state_path: statePath,
|
package/dist/cli.js
CHANGED
|
@@ -3,16 +3,18 @@ import {
|
|
|
3
3
|
createDisabledRiddleProofAgentAdapter,
|
|
4
4
|
readRiddleProofRunStatus,
|
|
5
5
|
runRiddleProofEngineHarness
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-LBZWFSTU.js";
|
|
7
7
|
import "./chunk-4ASMX4R6.js";
|
|
8
8
|
import "./chunk-JFQXAJH2.js";
|
|
9
9
|
import {
|
|
10
10
|
createCodexExecAgentAdapter,
|
|
11
11
|
runCodexExecAgentDoctor
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
15
|
-
import
|
|
12
|
+
} from "./chunk-3266V3MO.js";
|
|
13
|
+
import "./chunk-KLOSE27H.js";
|
|
14
|
+
import "./chunk-T7YFCZND.js";
|
|
15
|
+
import {
|
|
16
|
+
createCheckpointResponseTemplate
|
|
17
|
+
} from "./chunk-36CBRVAK.js";
|
|
16
18
|
import "./chunk-DUFDZJOF.js";
|
|
17
19
|
|
|
18
20
|
// src/cli.ts
|
|
@@ -21,7 +23,9 @@ function usage() {
|
|
|
21
23
|
return [
|
|
22
24
|
"Usage:",
|
|
23
25
|
" riddle-proof-loop run --request-json <file|json|-> [--agent disabled|local] [--checkpoint-mode yield|auto]",
|
|
26
|
+
" riddle-proof-loop checkpoint --state-path <path> [--decision <decision>]",
|
|
24
27
|
" riddle-proof-loop respond --state-path <path> --response-json <file|json|->",
|
|
28
|
+
" riddle-proof-loop respond --state-path <path> --decision <decision> --summary <text> [--payload-json <file|json|->]",
|
|
25
29
|
" riddle-proof-loop status --state-path <path>",
|
|
26
30
|
" riddle-proof-loop doctor local [--codex-command <path>]",
|
|
27
31
|
"",
|
|
@@ -65,6 +69,18 @@ function readJsonValue(value, label) {
|
|
|
65
69
|
}
|
|
66
70
|
return parsed;
|
|
67
71
|
}
|
|
72
|
+
function readOptionalJsonRecord(value, label) {
|
|
73
|
+
if (!value) return void 0;
|
|
74
|
+
return readJsonValue(value, label);
|
|
75
|
+
}
|
|
76
|
+
function readOptionalJsonStringArray(value, label) {
|
|
77
|
+
if (!value) return void 0;
|
|
78
|
+
const parsed = value === "-" ? JSON.parse(readStdin()) : existsSync(value) ? JSON.parse(readFileSync(value, "utf-8")) : JSON.parse(value);
|
|
79
|
+
if (!Array.isArray(parsed) || parsed.some((item) => typeof item !== "string")) {
|
|
80
|
+
throw new Error(`${label} must be a JSON array of strings.`);
|
|
81
|
+
}
|
|
82
|
+
return parsed;
|
|
83
|
+
}
|
|
68
84
|
function readRunState(statePath) {
|
|
69
85
|
const parsed = readJsonValue(statePath, "--state-path");
|
|
70
86
|
if (parsed.version !== "riddle-proof.run-state.v1" || !Array.isArray(parsed.events)) {
|
|
@@ -72,6 +88,29 @@ function readRunState(statePath) {
|
|
|
72
88
|
}
|
|
73
89
|
return parsed;
|
|
74
90
|
}
|
|
91
|
+
function checkpointResponseForFlags(statePath, options) {
|
|
92
|
+
const state = readRunState(statePath);
|
|
93
|
+
if (!state.checkpoint_packet) {
|
|
94
|
+
throw new Error(`${statePath} has no pending checkpoint packet. Use status to inspect the current run state.`);
|
|
95
|
+
}
|
|
96
|
+
const decision = optionString(options, "decision");
|
|
97
|
+
const summary = optionString(options, "summary");
|
|
98
|
+
if (!decision || !summary) {
|
|
99
|
+
throw new Error("--decision and --summary are required when --response-json is not supplied.");
|
|
100
|
+
}
|
|
101
|
+
if (!state.checkpoint_packet.allowed_decisions.includes(decision)) {
|
|
102
|
+
throw new Error(`--decision ${decision} is not allowed for ${state.checkpoint_packet.checkpoint}. Allowed decisions: ${state.checkpoint_packet.allowed_decisions.join(", ")}`);
|
|
103
|
+
}
|
|
104
|
+
return createCheckpointResponseTemplate(state.checkpoint_packet, {
|
|
105
|
+
decision,
|
|
106
|
+
summary,
|
|
107
|
+
payload: readOptionalJsonRecord(optionString(options, "payloadJson"), "--payload-json"),
|
|
108
|
+
reasons: readOptionalJsonStringArray(optionString(options, "reasonsJson"), "--reasons-json"),
|
|
109
|
+
continue_with_stage: optionString(options, "continueWithStage"),
|
|
110
|
+
source_kind: optionString(options, "sourceKind") || "codex",
|
|
111
|
+
created_at: optionString(options, "createdAt")
|
|
112
|
+
});
|
|
113
|
+
}
|
|
75
114
|
function codexConfig(options) {
|
|
76
115
|
const codexFullAuto = optionString(options, "codexFullAuto");
|
|
77
116
|
return {
|
|
@@ -128,13 +167,37 @@ async function main() {
|
|
|
128
167
|
const snapshot = readRiddleProofRunStatus(statePath);
|
|
129
168
|
if (!snapshot) throw new Error(`${statePath} is not a readable Riddle Proof run state.`);
|
|
130
169
|
process.stdout.write(`${JSON.stringify(snapshot, null, 2)}
|
|
170
|
+
`);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (command === "checkpoint") {
|
|
174
|
+
const statePath = optionString(options, "statePath");
|
|
175
|
+
if (!statePath) throw new Error("--state-path is required.");
|
|
176
|
+
const state = readRunState(statePath);
|
|
177
|
+
const snapshot = readRiddleProofRunStatus(statePath);
|
|
178
|
+
if (!state.checkpoint_packet) {
|
|
179
|
+
throw new Error(`${statePath} has no pending checkpoint packet.`);
|
|
180
|
+
}
|
|
181
|
+
const responseTemplate = createCheckpointResponseTemplate(state.checkpoint_packet, {
|
|
182
|
+
decision: optionString(options, "decision"),
|
|
183
|
+
source_kind: optionString(options, "sourceKind") || "codex"
|
|
184
|
+
});
|
|
185
|
+
process.stdout.write(`${JSON.stringify({
|
|
186
|
+
checkpoint_packet: state.checkpoint_packet,
|
|
187
|
+
run_card: snapshot?.run_card || state.run_card || null,
|
|
188
|
+
response_template: responseTemplate,
|
|
189
|
+
next_commands: [
|
|
190
|
+
`riddle-proof-loop respond --state-path ${statePath} --decision ${responseTemplate.decision} --summary <summary> --payload-json <file|json|->`,
|
|
191
|
+
`riddle-proof-loop status --state-path ${statePath}`
|
|
192
|
+
]
|
|
193
|
+
}, null, 2)}
|
|
131
194
|
`);
|
|
132
195
|
return;
|
|
133
196
|
}
|
|
134
197
|
if (command === "run" || command === "respond") {
|
|
135
198
|
const statePath = optionString(options, "statePath");
|
|
136
199
|
const request = requestForRun(options);
|
|
137
|
-
const response = command === "respond" ? readJsonValue(optionString(options, "responseJson"), "--response-json") : void 0;
|
|
200
|
+
const response = command === "respond" ? optionString(options, "responseJson") ? readJsonValue(optionString(options, "responseJson"), "--response-json") : checkpointResponseForFlags(statePath || "", options) : void 0;
|
|
138
201
|
const result = await runRiddleProofEngineHarness({
|
|
139
202
|
request,
|
|
140
203
|
state_path: statePath,
|
|
@@ -171,10 +171,11 @@ var PROOF_SCHEMA = {
|
|
|
171
171
|
source: { type: "string", enum: ["supervising_agent"] }
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
|
-
var PROMPT_STRING_LIMIT =
|
|
174
|
+
var PROMPT_STRING_LIMIT = 1e3;
|
|
175
175
|
var PROMPT_ARRAY_LIMIT = 8;
|
|
176
176
|
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
177
|
-
var PROMPT_BLOCK_LIMIT =
|
|
177
|
+
var PROMPT_BLOCK_LIMIT = 16e3;
|
|
178
|
+
var PROMPT_TOTAL_LIMIT = 58e3;
|
|
178
179
|
var PROMPT_KEY_PRIORITY = [
|
|
179
180
|
"ok",
|
|
180
181
|
"status",
|
|
@@ -289,7 +290,7 @@ function resolveWorkdir(context, fallback = "/tmp") {
|
|
|
289
290
|
return after || fallback;
|
|
290
291
|
}
|
|
291
292
|
function basePrompt(context, role) {
|
|
292
|
-
|
|
293
|
+
const prompt = [
|
|
293
294
|
role,
|
|
294
295
|
"",
|
|
295
296
|
"You are the supervising Codex worker inside the Riddle Proof harness.",
|
|
@@ -301,6 +302,9 @@ function basePrompt(context, role) {
|
|
|
301
302
|
jsonBlock("Riddle checkpoint result", context.engineResult),
|
|
302
303
|
jsonBlock("Full riddle state", context.fullRiddleState || {})
|
|
303
304
|
].join("\n");
|
|
305
|
+
if (prompt.length <= PROMPT_TOTAL_LIMIT) return prompt;
|
|
306
|
+
return `${prompt.slice(0, PROMPT_TOTAL_LIMIT).trimEnd()}
|
|
307
|
+
...[truncated ${prompt.length - PROMPT_TOTAL_LIMIT} chars from total prompt]`;
|
|
304
308
|
}
|
|
305
309
|
function schemaRequiredKeys(schema) {
|
|
306
310
|
const required = schema?.required;
|
package/dist/codex-exec-agent.js
CHANGED
package/dist/engine-harness.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createDisabledRiddleProofAgentAdapter,
|
|
3
3
|
readRiddleProofRunStatus,
|
|
4
4
|
runRiddleProofEngineHarness
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LBZWFSTU.js";
|
|
6
6
|
import "./chunk-4ASMX4R6.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-KLOSE27H.js";
|
|
8
|
+
import "./chunk-T7YFCZND.js";
|
|
9
|
+
import "./chunk-36CBRVAK.js";
|
|
10
10
|
import "./chunk-DUFDZJOF.js";
|
|
11
11
|
export {
|
|
12
12
|
createDisabledRiddleProofAgentAdapter,
|
package/dist/index.cjs
CHANGED
|
@@ -2801,6 +2801,7 @@ __export(index_exports, {
|
|
|
2801
2801
|
compactRecord: () => compactRecord,
|
|
2802
2802
|
compareVisualProofSessionFingerprint: () => compareVisualProofSessionFingerprint,
|
|
2803
2803
|
createCaptureDiagnostic: () => createCaptureDiagnostic,
|
|
2804
|
+
createCheckpointResponseTemplate: () => createCheckpointResponseTemplate,
|
|
2804
2805
|
createCodexExecAgentAdapter: () => createCodexExecAgentAdapter,
|
|
2805
2806
|
createCodexExecJsonRunner: () => createCodexExecJsonRunner,
|
|
2806
2807
|
createDisabledRiddleProofAgentAdapter: () => createDisabledRiddleProofAgentAdapter,
|
|
@@ -3598,6 +3599,80 @@ function normalizeCheckpointResponse(value) {
|
|
|
3598
3599
|
created_at: nonEmptyString(record.created_at) || timestamp()
|
|
3599
3600
|
});
|
|
3600
3601
|
}
|
|
3602
|
+
function defaultContinueStage(packet, decision) {
|
|
3603
|
+
if (decision === "ready_for_author" || decision === "author_packet" || decision === "needs_author") return "author";
|
|
3604
|
+
if (decision === "implementation_complete") return "verify";
|
|
3605
|
+
if (decision === "ready_to_ship") return "ship";
|
|
3606
|
+
if (decision === "revise_capture") return "verify";
|
|
3607
|
+
if (decision === "retry_recon" || decision === "recon_stuck" || decision === "needs_recon") return "recon";
|
|
3608
|
+
if (decision === "needs_implementation") return "implement";
|
|
3609
|
+
if (decision === "continue_stage" || decision === "retry_stage") return packet.stage;
|
|
3610
|
+
return void 0;
|
|
3611
|
+
}
|
|
3612
|
+
function templatePayloadFor(packet, decision) {
|
|
3613
|
+
if (packet.kind === "author_proof" || decision === "author_packet") {
|
|
3614
|
+
return {
|
|
3615
|
+
proof_plan: "TODO: describe the exact proof plan and stop condition.",
|
|
3616
|
+
capture_script: "TODO: provide the capture script that collects required artifacts/evidence.",
|
|
3617
|
+
summary: "TODO: summarize why this proof packet targets the requested change."
|
|
3618
|
+
};
|
|
3619
|
+
}
|
|
3620
|
+
if (packet.kind === "implement_change" || decision === "implementation_complete") {
|
|
3621
|
+
return {
|
|
3622
|
+
changed_files: [],
|
|
3623
|
+
tests_run: [],
|
|
3624
|
+
implementation_notes: "TODO: summarize the direct edits made in the after worktree."
|
|
3625
|
+
};
|
|
3626
|
+
}
|
|
3627
|
+
if (packet.kind === "assess_recon" || packet.stage === "recon") {
|
|
3628
|
+
return {
|
|
3629
|
+
baseline_understanding: {
|
|
3630
|
+
reference: "TODO",
|
|
3631
|
+
target_route: "TODO",
|
|
3632
|
+
before_evidence_url: "TODO",
|
|
3633
|
+
visible_before_state: "TODO",
|
|
3634
|
+
relevant_elements: [],
|
|
3635
|
+
requested_change: packet.change_request,
|
|
3636
|
+
proof_focus: "TODO",
|
|
3637
|
+
stop_condition: "TODO",
|
|
3638
|
+
quality_risks: []
|
|
3639
|
+
},
|
|
3640
|
+
refined_inputs: {
|
|
3641
|
+
server_path: null,
|
|
3642
|
+
wait_for_selector: null,
|
|
3643
|
+
reference: null
|
|
3644
|
+
}
|
|
3645
|
+
};
|
|
3646
|
+
}
|
|
3647
|
+
if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
|
|
3648
|
+
return {
|
|
3649
|
+
recommended_stage: defaultContinueStage(packet, decision) || packet.stage,
|
|
3650
|
+
evidence_issue_code: packet.evidence_excerpt?.evidence_issue_code || null,
|
|
3651
|
+
visual_delta: packet.evidence_excerpt?.visual_delta || null
|
|
3652
|
+
};
|
|
3653
|
+
}
|
|
3654
|
+
return void 0;
|
|
3655
|
+
}
|
|
3656
|
+
function createCheckpointResponseTemplate(packet, input = {}) {
|
|
3657
|
+
const allowed = Array.isArray(packet.allowed_decisions) ? packet.allowed_decisions : [];
|
|
3658
|
+
const decision = input.decision && allowed.includes(input.decision) ? input.decision : allowed[0] || "blocked";
|
|
3659
|
+
const continueStage = input.continue_with_stage || defaultContinueStage(packet, decision);
|
|
3660
|
+
return compactRecord({
|
|
3661
|
+
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
3662
|
+
run_id: packet.run_id,
|
|
3663
|
+
checkpoint: packet.checkpoint,
|
|
3664
|
+
resume_token: packet.resume_token,
|
|
3665
|
+
decision,
|
|
3666
|
+
summary: input.summary || `TODO: explain checkpoint decision ${decision}.`,
|
|
3667
|
+
payload: input.payload || templatePayloadFor(packet, decision),
|
|
3668
|
+
reasons: input.reasons || ["TODO: replace with concrete reason(s)."],
|
|
3669
|
+
continue_with_stage: continueStage,
|
|
3670
|
+
source: {
|
|
3671
|
+
kind: input.source_kind || "codex"
|
|
3672
|
+
},
|
|
3673
|
+
created_at: input.created_at || timestamp()
|
|
3674
|
+
});
|
|
3675
|
+
}
|
|
3601
3676
|
function checkpointSummaryFromState(state, engineStatePath2) {
|
|
3602
3677
|
const history = state.checkpoint_history || [];
|
|
3603
3678
|
const packets = history.filter((entry) => entry.packet);
|
|
@@ -6202,10 +6277,11 @@ var PROOF_SCHEMA = {
|
|
|
6202
6277
|
source: { type: "string", enum: ["supervising_agent"] }
|
|
6203
6278
|
}
|
|
6204
6279
|
};
|
|
6205
|
-
var PROMPT_STRING_LIMIT =
|
|
6280
|
+
var PROMPT_STRING_LIMIT = 1e3;
|
|
6206
6281
|
var PROMPT_ARRAY_LIMIT = 8;
|
|
6207
6282
|
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
6208
|
-
var PROMPT_BLOCK_LIMIT =
|
|
6283
|
+
var PROMPT_BLOCK_LIMIT = 16e3;
|
|
6284
|
+
var PROMPT_TOTAL_LIMIT = 58e3;
|
|
6209
6285
|
var PROMPT_KEY_PRIORITY = [
|
|
6210
6286
|
"ok",
|
|
6211
6287
|
"status",
|
|
@@ -6320,7 +6396,7 @@ function resolveWorkdir(context, fallback = "/tmp") {
|
|
|
6320
6396
|
return after || fallback;
|
|
6321
6397
|
}
|
|
6322
6398
|
function basePrompt(context, role) {
|
|
6323
|
-
|
|
6399
|
+
const prompt = [
|
|
6324
6400
|
role,
|
|
6325
6401
|
"",
|
|
6326
6402
|
"You are the supervising Codex worker inside the Riddle Proof harness.",
|
|
@@ -6332,6 +6408,9 @@ function basePrompt(context, role) {
|
|
|
6332
6408
|
jsonBlock("Riddle checkpoint result", context.engineResult),
|
|
6333
6409
|
jsonBlock("Full riddle state", context.fullRiddleState || {})
|
|
6334
6410
|
].join("\n");
|
|
6411
|
+
if (prompt.length <= PROMPT_TOTAL_LIMIT) return prompt;
|
|
6412
|
+
return `${prompt.slice(0, PROMPT_TOTAL_LIMIT).trimEnd()}
|
|
6413
|
+
...[truncated ${prompt.length - PROMPT_TOTAL_LIMIT} chars from total prompt]`;
|
|
6335
6414
|
}
|
|
6336
6415
|
function schemaRequiredKeys(schema) {
|
|
6337
6416
|
const required = schema?.required;
|
|
@@ -7549,6 +7628,7 @@ function parseJson(value) {
|
|
|
7549
7628
|
compactRecord,
|
|
7550
7629
|
compareVisualProofSessionFingerprint,
|
|
7551
7630
|
createCaptureDiagnostic,
|
|
7631
|
+
createCheckpointResponseTemplate,
|
|
7552
7632
|
createCodexExecAgentAdapter,
|
|
7553
7633
|
createCodexExecJsonRunner,
|
|
7554
7634
|
createDisabledRiddleProofAgentAdapter,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from './types.cjs';
|
|
2
2
|
export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from './result.cjs';
|
|
3
3
|
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from './state.cjs';
|
|
4
|
-
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.cjs';
|
|
4
|
+
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.cjs';
|
|
5
5
|
export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from './run-card.cjs';
|
|
6
6
|
export { RiddleProofRunnerAdapters, RunRiddleProofInput, runRiddleProof } from './runner.cjs';
|
|
7
7
|
export { RiddleProofAgentAdapter, RiddleProofAgentPayload, RiddleProofCheckpointMode, RiddleProofEngine, RiddleProofEngineHarnessConfig, RiddleProofEngineHarnessContext, RiddleProofEngineResult, RiddleProofShipMode, RiddleProofWorkflowParams, RunRiddleProofEngineHarnessInput, createDisabledRiddleProofAgentAdapter, readRiddleProofRunStatus, runRiddleProofEngineHarness } from './engine-harness.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from './types.js';
|
|
2
2
|
export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from './result.js';
|
|
3
3
|
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from './state.js';
|
|
4
|
-
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.js';
|
|
4
|
+
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from './checkpoint.js';
|
|
5
5
|
export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from './run-card.js';
|
|
6
6
|
export { RiddleProofRunnerAdapters, RunRiddleProofInput, runRiddleProof } from './runner.js';
|
|
7
7
|
export { RiddleProofAgentAdapter, RiddleProofAgentPayload, RiddleProofCheckpointMode, RiddleProofEngine, RiddleProofEngineHarnessConfig, RiddleProofEngineHarnessContext, RiddleProofEngineResult, RiddleProofShipMode, RiddleProofWorkflowParams, RunRiddleProofEngineHarnessInput, createDisabledRiddleProofAgentAdapter, readRiddleProofRunStatus, runRiddleProofEngineHarness } from './engine-harness.js';
|
package/dist/index.js
CHANGED
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
} from "./chunk-ODORKNSO.js";
|
|
18
18
|
import {
|
|
19
19
|
runRiddleProof
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WKKMBN5S.js";
|
|
21
21
|
import {
|
|
22
22
|
DEFAULT_DIAGNOSTIC_ARRAY_LIMIT,
|
|
23
23
|
DEFAULT_DIAGNOSTIC_HISTORY_LIMIT,
|
|
@@ -32,14 +32,14 @@ import {
|
|
|
32
32
|
createDisabledRiddleProofAgentAdapter,
|
|
33
33
|
readRiddleProofRunStatus,
|
|
34
34
|
runRiddleProofEngineHarness
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-LBZWFSTU.js";
|
|
36
36
|
import "./chunk-4ASMX4R6.js";
|
|
37
37
|
import "./chunk-JFQXAJH2.js";
|
|
38
38
|
import {
|
|
39
39
|
createCodexExecAgentAdapter,
|
|
40
40
|
createCodexExecJsonRunner,
|
|
41
41
|
runCodexExecAgentDoctor
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-3266V3MO.js";
|
|
43
43
|
import {
|
|
44
44
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
|
45
45
|
appendRunEvent,
|
|
@@ -51,11 +51,11 @@ import {
|
|
|
51
51
|
normalizePrLifecycleState,
|
|
52
52
|
normalizeRunParams,
|
|
53
53
|
setRunStatus
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-KLOSE27H.js";
|
|
55
55
|
import {
|
|
56
56
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
57
57
|
createRiddleProofRunCard
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-T7YFCZND.js";
|
|
59
59
|
import {
|
|
60
60
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
61
61
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
@@ -66,11 +66,12 @@ import {
|
|
|
66
66
|
buildStageCheckpointPacket,
|
|
67
67
|
checkpointResponseIdentity,
|
|
68
68
|
checkpointSummaryFromState,
|
|
69
|
+
createCheckpointResponseTemplate,
|
|
69
70
|
isDuplicateCheckpointResponse,
|
|
70
71
|
normalizeCheckpointResponse,
|
|
71
72
|
proofContractFromAuthorCheckpointResponse,
|
|
72
73
|
statePathsForRunState
|
|
73
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-36CBRVAK.js";
|
|
74
75
|
import {
|
|
75
76
|
applyTerminalMetadata,
|
|
76
77
|
compactRecord,
|
|
@@ -111,6 +112,7 @@ export {
|
|
|
111
112
|
compactRecord,
|
|
112
113
|
compareVisualProofSessionFingerprint,
|
|
113
114
|
createCaptureDiagnostic,
|
|
115
|
+
createCheckpointResponseTemplate,
|
|
114
116
|
createCodexExecAgentAdapter,
|
|
115
117
|
createCodexExecJsonRunner,
|
|
116
118
|
createDisabledRiddleProofAgentAdapter,
|
package/dist/local-agent.cjs
CHANGED
|
@@ -173,10 +173,11 @@ var PROOF_SCHEMA = {
|
|
|
173
173
|
source: { type: "string", enum: ["supervising_agent"] }
|
|
174
174
|
}
|
|
175
175
|
};
|
|
176
|
-
var PROMPT_STRING_LIMIT =
|
|
176
|
+
var PROMPT_STRING_LIMIT = 1e3;
|
|
177
177
|
var PROMPT_ARRAY_LIMIT = 8;
|
|
178
178
|
var PROMPT_OBJECT_KEY_LIMIT = 50;
|
|
179
|
-
var PROMPT_BLOCK_LIMIT =
|
|
179
|
+
var PROMPT_BLOCK_LIMIT = 16e3;
|
|
180
|
+
var PROMPT_TOTAL_LIMIT = 58e3;
|
|
180
181
|
var PROMPT_KEY_PRIORITY = [
|
|
181
182
|
"ok",
|
|
182
183
|
"status",
|
|
@@ -291,7 +292,7 @@ function resolveWorkdir(context, fallback = "/tmp") {
|
|
|
291
292
|
return after || fallback;
|
|
292
293
|
}
|
|
293
294
|
function basePrompt(context, role) {
|
|
294
|
-
|
|
295
|
+
const prompt = [
|
|
295
296
|
role,
|
|
296
297
|
"",
|
|
297
298
|
"You are the supervising Codex worker inside the Riddle Proof harness.",
|
|
@@ -303,6 +304,9 @@ function basePrompt(context, role) {
|
|
|
303
304
|
jsonBlock("Riddle checkpoint result", context.engineResult),
|
|
304
305
|
jsonBlock("Full riddle state", context.fullRiddleState || {})
|
|
305
306
|
].join("\n");
|
|
307
|
+
if (prompt.length <= PROMPT_TOTAL_LIMIT) return prompt;
|
|
308
|
+
return `${prompt.slice(0, PROMPT_TOTAL_LIMIT).trimEnd()}
|
|
309
|
+
...[truncated ${prompt.length - PROMPT_TOTAL_LIMIT} chars from total prompt]`;
|
|
306
310
|
}
|
|
307
311
|
function schemaRequiredKeys(schema) {
|
|
308
312
|
const required = schema?.required;
|
package/dist/local-agent.js
CHANGED
package/dist/openclaw.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeIntegrationContext,
|
|
3
3
|
normalizeRunParams
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-KLOSE27H.js";
|
|
5
|
+
import "./chunk-T7YFCZND.js";
|
|
6
|
+
import "./chunk-36CBRVAK.js";
|
|
7
7
|
import {
|
|
8
8
|
compactRecord
|
|
9
9
|
} from "./chunk-DUFDZJOF.js";
|
|
@@ -115,7 +115,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
|
|
|
115
115
|
target_image_hash: string;
|
|
116
116
|
viewport_matrix_json: string;
|
|
117
117
|
deterministic_setup_json: string;
|
|
118
|
-
reference: "
|
|
118
|
+
reference: "prod" | "before" | "both";
|
|
119
119
|
base_branch: string;
|
|
120
120
|
before_ref: string;
|
|
121
121
|
allow_static_preview_fallback: string;
|
package/dist/proof-run-core.d.ts
CHANGED
|
@@ -115,7 +115,7 @@ declare function buildSetupArgs(params: WorkflowParams, config: ReturnType<typeo
|
|
|
115
115
|
target_image_hash: string;
|
|
116
116
|
viewport_matrix_json: string;
|
|
117
117
|
deterministic_setup_json: string;
|
|
118
|
-
reference: "
|
|
118
|
+
reference: "prod" | "before" | "both";
|
|
119
119
|
base_branch: string;
|
|
120
120
|
before_ref: string;
|
|
121
121
|
allow_static_preview_fallback: string;
|
|
@@ -277,7 +277,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
277
277
|
blocking?: boolean;
|
|
278
278
|
details?: Record<string, unknown>;
|
|
279
279
|
ok: boolean;
|
|
280
|
-
action: "
|
|
280
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
281
281
|
state_path: string;
|
|
282
282
|
stage: any;
|
|
283
283
|
summary: string;
|
|
@@ -362,7 +362,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
362
362
|
continueWithStage?: WorkflowStage | null;
|
|
363
363
|
blocking?: boolean;
|
|
364
364
|
details?: Record<string, unknown>;
|
|
365
|
-
action: "
|
|
365
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
366
366
|
state_path: string;
|
|
367
367
|
stage: any;
|
|
368
368
|
checkpoint: string;
|
|
@@ -624,7 +624,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
624
624
|
error?: undefined;
|
|
625
625
|
} | {
|
|
626
626
|
ok: boolean;
|
|
627
|
-
action: "
|
|
627
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
628
628
|
state_path: string;
|
|
629
629
|
stage: any;
|
|
630
630
|
summary: string;
|
|
@@ -277,7 +277,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
277
277
|
blocking?: boolean;
|
|
278
278
|
details?: Record<string, unknown>;
|
|
279
279
|
ok: boolean;
|
|
280
|
-
action: "
|
|
280
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
281
281
|
state_path: string;
|
|
282
282
|
stage: any;
|
|
283
283
|
summary: string;
|
|
@@ -362,7 +362,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
362
362
|
continueWithStage?: WorkflowStage | null;
|
|
363
363
|
blocking?: boolean;
|
|
364
364
|
details?: Record<string, unknown>;
|
|
365
|
-
action: "
|
|
365
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
366
366
|
state_path: string;
|
|
367
367
|
stage: any;
|
|
368
368
|
checkpoint: string;
|
|
@@ -624,7 +624,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
|
|
|
624
624
|
error?: undefined;
|
|
625
625
|
} | {
|
|
626
626
|
ok: boolean;
|
|
627
|
-
action: "
|
|
627
|
+
action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
|
|
628
628
|
state_path: string;
|
|
629
629
|
stage: any;
|
|
630
630
|
summary: string;
|
package/dist/run-card.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
3
3
|
createRiddleProofRunCard
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-T7YFCZND.js";
|
|
5
|
+
import "./chunk-36CBRVAK.js";
|
|
6
6
|
import "./chunk-DUFDZJOF.js";
|
|
7
7
|
export {
|
|
8
8
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
package/dist/runner.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runRiddleProof
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-WKKMBN5S.js";
|
|
4
|
+
import "./chunk-KLOSE27H.js";
|
|
5
|
+
import "./chunk-T7YFCZND.js";
|
|
6
|
+
import "./chunk-36CBRVAK.js";
|
|
7
7
|
import "./chunk-DUFDZJOF.js";
|
|
8
8
|
export {
|
|
9
9
|
runRiddleProof
|
package/dist/state.js
CHANGED
|
@@ -9,9 +9,9 @@ import {
|
|
|
9
9
|
normalizePrLifecycleState,
|
|
10
10
|
normalizeRunParams,
|
|
11
11
|
setRunStatus
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
14
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-KLOSE27H.js";
|
|
13
|
+
import "./chunk-T7YFCZND.js";
|
|
14
|
+
import "./chunk-36CBRVAK.js";
|
|
15
15
|
import "./chunk-DUFDZJOF.js";
|
|
16
16
|
export {
|
|
17
17
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|