@riddledc/riddle-proof 0.8.51 → 0.8.53
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/adapters/openclaw.js +4 -4
- package/dist/advanced/engine-harness.cjs +79 -26
- package/dist/advanced/engine-harness.js +5 -5
- package/dist/advanced/index.cjs +81 -26
- package/dist/advanced/index.d.cts +2 -2
- package/dist/advanced/index.d.ts +2 -2
- package/dist/advanced/index.js +7 -7
- package/dist/advanced/proof-run-core.cjs +24 -2
- package/dist/advanced/proof-run-core.d.cts +1 -1
- package/dist/advanced/proof-run-core.d.ts +1 -1
- package/dist/advanced/proof-run-core.js +5 -1
- package/dist/advanced/proof-run-engine.cjs +20 -2
- package/dist/advanced/proof-run-engine.d.cts +2 -2
- package/dist/advanced/proof-run-engine.d.ts +2 -2
- package/dist/advanced/proof-run-engine.js +2 -2
- package/dist/advanced/runner.js +5 -5
- package/dist/checkpoint.cjs +41 -11
- package/dist/checkpoint.d.cts +2 -1
- package/dist/checkpoint.d.ts +2 -1
- package/dist/checkpoint.js +3 -1
- package/dist/{chunk-AWM2BKDF.js → chunk-2ALMXMFZ.js} +3 -2
- package/dist/{chunk-AXWJJ2LC.js → chunk-BLM5EIBA.js} +40 -11
- package/dist/{chunk-X7SQTCIQ.js → chunk-EKZXU6MU.js} +24 -2
- package/dist/{chunk-RBAU2M4S.js → chunk-JJ4IWRMJ.js} +1 -1
- package/dist/{chunk-OYWZGDTS.js → chunk-LNWJAHAQ.js} +1 -1
- package/dist/{chunk-DFQBQGSD.js → chunk-S5DX7Z6X.js} +2 -2
- package/dist/{chunk-IOI6QR3B.js → chunk-VYJD6XYF.js} +1 -1
- package/dist/{chunk-M3IE3VNC.js → chunk-WDIKPIMB.js} +1 -1
- package/dist/{chunk-ZHTJEZH5.js → chunk-ZLBOGPUL.js} +27 -17
- package/dist/cli/index.js +6 -6
- package/dist/cli.cjs +81 -26
- package/dist/cli.js +6 -6
- package/dist/engine-harness.cjs +79 -26
- package/dist/engine-harness.js +5 -5
- package/dist/index.cjs +82 -26
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -6
- package/dist/openclaw.js +4 -4
- package/dist/{proof-run-core-B1GeqkR8.d.ts → proof-run-core-7Dqm7RKM.d.cts} +6 -2
- package/dist/{proof-run-core-B1GeqkR8.d.cts → proof-run-core-7Dqm7RKM.d.ts} +6 -2
- package/dist/proof-run-core.cjs +24 -2
- package/dist/proof-run-core.d.cts +1 -1
- package/dist/proof-run-core.d.ts +1 -1
- package/dist/proof-run-core.js +5 -1
- package/dist/{proof-run-engine-BqaeqAze.d.ts → proof-run-engine-BqRoA3Do.d.ts} +1 -1
- package/dist/{proof-run-engine-4dM37pEx.d.cts → proof-run-engine-DpChFR5H.d.cts} +1 -1
- package/dist/proof-run-engine.cjs +20 -2
- package/dist/proof-run-engine.d.cts +2 -2
- package/dist/proof-run-engine.d.ts +2 -2
- package/dist/proof-run-engine.js +2 -2
- package/dist/run-card.js +2 -2
- package/dist/runner.js +5 -5
- package/dist/spec/checkpoint.cjs +41 -11
- package/dist/spec/checkpoint.d.cts +1 -1
- package/dist/spec/checkpoint.d.ts +1 -1
- package/dist/spec/checkpoint.js +3 -1
- package/dist/spec/index.cjs +41 -11
- package/dist/spec/index.d.cts +1 -1
- package/dist/spec/index.d.ts +1 -1
- package/dist/spec/index.js +5 -3
- package/dist/spec/run-card.js +2 -2
- package/dist/spec/state.js +3 -3
- package/dist/state.js +3 -3
- package/dist/types.d.cts +5 -0
- package/dist/types.d.ts +5 -0
- package/package.json +1 -1
|
@@ -51,12 +51,13 @@ function statePathsForRunState(state, engineStatePath) {
|
|
|
51
51
|
function responseSchemaForAuthorPacket() {
|
|
52
52
|
return {
|
|
53
53
|
type: "object",
|
|
54
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "payload", "created_at"],
|
|
54
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "payload", "created_at"],
|
|
55
55
|
additionalProperties: false,
|
|
56
56
|
properties: {
|
|
57
57
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
58
58
|
run_id: { type: "string" },
|
|
59
59
|
checkpoint: { type: "string" },
|
|
60
|
+
packet_id: { type: "string" },
|
|
60
61
|
resume_token: { type: "string" },
|
|
61
62
|
decision: {
|
|
62
63
|
type: "string",
|
|
@@ -84,12 +85,13 @@ function responseSchemaForAuthorPacket() {
|
|
|
84
85
|
function responseSchemaForProofAssessmentPacket() {
|
|
85
86
|
return {
|
|
86
87
|
type: "object",
|
|
87
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
88
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
88
89
|
additionalProperties: false,
|
|
89
90
|
properties: {
|
|
90
91
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
91
92
|
run_id: { type: "string" },
|
|
92
93
|
checkpoint: { type: "string" },
|
|
94
|
+
packet_id: { type: "string" },
|
|
93
95
|
resume_token: { type: "string" },
|
|
94
96
|
decision: {
|
|
95
97
|
type: "string",
|
|
@@ -125,12 +127,13 @@ function responseSchemaForProofAssessmentPacket() {
|
|
|
125
127
|
function responseSchemaForReconPacket() {
|
|
126
128
|
return {
|
|
127
129
|
type: "object",
|
|
128
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
130
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
129
131
|
additionalProperties: false,
|
|
130
132
|
properties: {
|
|
131
133
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
132
134
|
run_id: { type: "string" },
|
|
133
135
|
checkpoint: { type: "string" },
|
|
136
|
+
packet_id: { type: "string" },
|
|
134
137
|
resume_token: { type: "string" },
|
|
135
138
|
decision: {
|
|
136
139
|
type: "string",
|
|
@@ -158,12 +161,13 @@ function responseSchemaForReconPacket() {
|
|
|
158
161
|
function responseSchemaForImplementationPacket() {
|
|
159
162
|
return {
|
|
160
163
|
type: "object",
|
|
161
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
164
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
162
165
|
additionalProperties: false,
|
|
163
166
|
properties: {
|
|
164
167
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
165
168
|
run_id: { type: "string" },
|
|
166
169
|
checkpoint: { type: "string" },
|
|
170
|
+
packet_id: { type: "string" },
|
|
167
171
|
resume_token: { type: "string" },
|
|
168
172
|
decision: {
|
|
169
173
|
type: "string",
|
|
@@ -191,12 +195,13 @@ function responseSchemaForImplementationPacket() {
|
|
|
191
195
|
function responseSchemaForAdvancePacket(stage) {
|
|
192
196
|
return {
|
|
193
197
|
type: "object",
|
|
194
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
198
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
195
199
|
additionalProperties: false,
|
|
196
200
|
properties: {
|
|
197
201
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
198
202
|
run_id: { type: "string" },
|
|
199
203
|
checkpoint: { type: "string" },
|
|
204
|
+
packet_id: { type: "string" },
|
|
200
205
|
resume_token: { type: "string" },
|
|
201
206
|
decision: {
|
|
202
207
|
type: "string",
|
|
@@ -222,6 +227,20 @@ function resumeTokenFor(input) {
|
|
|
222
227
|
const hash = crypto.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
|
|
223
228
|
return `rpchk_${hash}`;
|
|
224
229
|
}
|
|
230
|
+
function packetIdentityPayload(packet) {
|
|
231
|
+
const { packet_id: _packetId, ...identityPayload } = packet;
|
|
232
|
+
return identityPayload;
|
|
233
|
+
}
|
|
234
|
+
function checkpointPacketIdentity(packet) {
|
|
235
|
+
const hash = crypto.createHash("sha256").update(stableJson(packetIdentityPayload(packet))).digest("hex").slice(0, 24);
|
|
236
|
+
return `rppkt_${hash}`;
|
|
237
|
+
}
|
|
238
|
+
function withPacketIdentity(packet) {
|
|
239
|
+
return {
|
|
240
|
+
...packet,
|
|
241
|
+
packet_id: checkpointPacketIdentity(packet)
|
|
242
|
+
};
|
|
243
|
+
}
|
|
225
244
|
function artifactsFromState(state) {
|
|
226
245
|
const artifacts = [];
|
|
227
246
|
for (const role of ["before", "prod", "after"]) {
|
|
@@ -294,7 +313,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
294
313
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
295
314
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.stage_summary) || `${stage} checkpoint needs a supervising decision.`;
|
|
296
315
|
const kind = packetKindForStage(stage, checkpoint);
|
|
297
|
-
return {
|
|
316
|
+
return withPacketIdentity({
|
|
298
317
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
299
318
|
run_id: runId,
|
|
300
319
|
state_path: input.runState.state_path,
|
|
@@ -343,7 +362,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
343
362
|
stage
|
|
344
363
|
}),
|
|
345
364
|
created_at: input.created_at || timestamp()
|
|
346
|
-
};
|
|
365
|
+
});
|
|
347
366
|
}
|
|
348
367
|
function buildAuthorCheckpointPacket(input) {
|
|
349
368
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "author_supervisor_judgment";
|
|
@@ -356,7 +375,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
356
375
|
const reconResults = recordValue(fullState.recon_results);
|
|
357
376
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
358
377
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.author_summary) || "Author checkpoint needs a supervising proof packet.";
|
|
359
|
-
return {
|
|
378
|
+
return withPacketIdentity({
|
|
360
379
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
361
380
|
run_id: runId,
|
|
362
381
|
state_path: input.runState.state_path,
|
|
@@ -405,7 +424,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
405
424
|
stage
|
|
406
425
|
}),
|
|
407
426
|
created_at: input.created_at || timestamp()
|
|
408
|
-
};
|
|
427
|
+
});
|
|
409
428
|
}
|
|
410
429
|
function visualDeltaFromState(fullState) {
|
|
411
430
|
const bundle = recordValue(fullState.evidence_bundle);
|
|
@@ -476,7 +495,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
476
495
|
const evidenceIssueCode = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
|
|
477
496
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
|
|
478
497
|
const recoveryHint = evidenceIssueCode ? "Required visual_delta evidence is incomplete. Keep this same run in verify/evidence recovery with decision=revise_capture and continue_with_stage=verify unless the evidence proves an implementation or recon problem." : "Assess whether the current artifacts prove the requested change, then choose the next stage.";
|
|
479
|
-
return {
|
|
498
|
+
return withPacketIdentity({
|
|
480
499
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
481
500
|
run_id: runId,
|
|
482
501
|
state_path: input.runState.state_path,
|
|
@@ -536,7 +555,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
536
555
|
stage
|
|
537
556
|
}),
|
|
538
557
|
created_at: input.created_at || timestamp()
|
|
539
|
-
};
|
|
558
|
+
});
|
|
540
559
|
}
|
|
541
560
|
function buildCheckpointPacketForEngineResult(input) {
|
|
542
561
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
|
|
@@ -565,6 +584,7 @@ function normalizeCheckpointResponse(value) {
|
|
|
565
584
|
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
566
585
|
run_id: runId,
|
|
567
586
|
checkpoint,
|
|
587
|
+
packet_id: nonEmptyString(record.packet_id),
|
|
568
588
|
resume_token: nonEmptyString(record.resume_token),
|
|
569
589
|
decision,
|
|
570
590
|
summary,
|
|
@@ -652,6 +672,7 @@ function createCheckpointResponseTemplate(packet, input = {}) {
|
|
|
652
672
|
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
653
673
|
run_id: packet.run_id,
|
|
654
674
|
checkpoint: packet.checkpoint,
|
|
675
|
+
packet_id: packet.packet_id,
|
|
655
676
|
resume_token: packet.resume_token,
|
|
656
677
|
decision,
|
|
657
678
|
summary: input.summary || `TODO: explain checkpoint decision ${decision}.`,
|
|
@@ -685,6 +706,9 @@ function checkpointSummaryFromState(state, engineStatePath) {
|
|
|
685
706
|
const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
|
|
686
707
|
const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
|
|
687
708
|
const latestResponse = latestResponseEntry?.response;
|
|
709
|
+
const latestPacketId = latestPacket?.packet_id || null;
|
|
710
|
+
const latestResponsePacketId = latestResponse?.packet_id || null;
|
|
711
|
+
const packetIdMatches = !latestResponse ? null : latestPacketId && latestResponsePacketId ? latestPacketId === latestResponsePacketId : latestPacketId || latestResponsePacketId ? false : null;
|
|
688
712
|
const latestResumeToken = latestPacket?.resume_token || null;
|
|
689
713
|
const latestResponseToken = latestResponse?.resume_token || null;
|
|
690
714
|
const tokenMatches = !latestResponse ? null : latestResumeToken && latestResponseToken ? latestResumeToken === latestResponseToken : latestResumeToken || latestResponseToken ? false : null;
|
|
@@ -699,6 +723,9 @@ function checkpointSummaryFromState(state, engineStatePath) {
|
|
|
699
723
|
latest_decision: latestResponse?.decision || null,
|
|
700
724
|
latest_packet_summary: latestPacket?.summary || null,
|
|
701
725
|
latest_response_summary: latestResponse?.summary || null,
|
|
726
|
+
latest_packet_id: latestPacketId,
|
|
727
|
+
latest_response_packet_id: latestResponsePacketId,
|
|
728
|
+
packet_id_matches: packetIdMatches,
|
|
702
729
|
latest_resume_token: latestResumeToken,
|
|
703
730
|
latest_response_token: latestResponseToken,
|
|
704
731
|
token_matches: tokenMatches,
|
|
@@ -715,6 +742,7 @@ function checkpointResponseIdentity(response) {
|
|
|
715
742
|
const logicalResponse = compactRecord({
|
|
716
743
|
run_id: response.run_id,
|
|
717
744
|
checkpoint: response.checkpoint,
|
|
745
|
+
packet_id: response.packet_id,
|
|
718
746
|
resume_token: response.resume_token,
|
|
719
747
|
decision: response.decision,
|
|
720
748
|
summary: response.summary,
|
|
@@ -772,6 +800,7 @@ export {
|
|
|
772
800
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
773
801
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
774
802
|
statePathsForRunState,
|
|
803
|
+
checkpointPacketIdentity,
|
|
775
804
|
buildStageCheckpointPacket,
|
|
776
805
|
buildAuthorCheckpointPacket,
|
|
777
806
|
buildProofAssessmentCheckpointPacket,
|
|
@@ -11,6 +11,7 @@ __export(proof_run_core_exports, {
|
|
|
11
11
|
WORKFLOW_STAGE_ORDER: () => WORKFLOW_STAGE_ORDER,
|
|
12
12
|
buildCheckpointContract: () => buildCheckpointContract,
|
|
13
13
|
buildSetupArgs: () => buildSetupArgs,
|
|
14
|
+
canonicalProofAssessmentStageForDecision: () => canonicalProofAssessmentStageForDecision,
|
|
14
15
|
checkpointContinueStage: () => checkpointContinueStage,
|
|
15
16
|
clearStageDecisionRequest: () => clearStageDecisionRequest,
|
|
16
17
|
ensureAction: () => ensureAction,
|
|
@@ -18,6 +19,7 @@ __export(proof_run_core_exports, {
|
|
|
18
19
|
invalidateVerifyEvidence: () => invalidateVerifyEvidence,
|
|
19
20
|
mergeStateFromParams: () => mergeStateFromParams,
|
|
20
21
|
noImplementationModeFor: () => noImplementationModeFor,
|
|
22
|
+
normalizeProofAssessmentStageFields: () => normalizeProofAssessmentStageFields,
|
|
21
23
|
previewModeFromWorkflowMode: () => previewModeFromWorkflowMode,
|
|
22
24
|
proofAssessmentHardBlockersForState: () => proofAssessmentHardBlockersForState,
|
|
23
25
|
readState: () => readState,
|
|
@@ -39,6 +41,24 @@ import { randomUUID } from "crypto";
|
|
|
39
41
|
import path from "path";
|
|
40
42
|
import { fileURLToPath } from "url";
|
|
41
43
|
var WORKFLOW_STAGE_ORDER = ["setup", "recon", "author", "implement", "verify", "ship"];
|
|
44
|
+
function canonicalProofAssessmentStageForDecision(decision) {
|
|
45
|
+
const normalized = typeof decision === "string" ? decision.trim() : "";
|
|
46
|
+
if (normalized === "ready_to_ship") return "ship";
|
|
47
|
+
if (normalized === "needs_richer_proof") return "author";
|
|
48
|
+
if (normalized === "revise_capture") return "verify";
|
|
49
|
+
if (normalized === "needs_recon") return "recon";
|
|
50
|
+
if (normalized === "needs_implementation") return "implement";
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
function normalizeProofAssessmentStageFields(assessment) {
|
|
54
|
+
const canonicalStage = canonicalProofAssessmentStageForDecision(assessment.decision);
|
|
55
|
+
if (!canonicalStage) return assessment;
|
|
56
|
+
return {
|
|
57
|
+
...assessment,
|
|
58
|
+
recommended_stage: canonicalStage,
|
|
59
|
+
continue_with_stage: canonicalStage
|
|
60
|
+
};
|
|
61
|
+
}
|
|
42
62
|
function normalizedMode(value) {
|
|
43
63
|
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
44
64
|
}
|
|
@@ -1065,10 +1085,10 @@ function mergeStateFromParams(statePath, params) {
|
|
|
1065
1085
|
state.proof_assessment_source = null;
|
|
1066
1086
|
} else {
|
|
1067
1087
|
const parsed = JSON.parse(raw);
|
|
1068
|
-
const assessment = {
|
|
1088
|
+
const assessment = normalizeProofAssessmentStageFields({
|
|
1069
1089
|
...parsed,
|
|
1070
1090
|
source: (parsed?.source || "supervising_agent").toString()
|
|
1071
|
-
};
|
|
1091
|
+
});
|
|
1072
1092
|
const readyBlocker = assessment?.decision === "ready_to_ship" ? visualDeltaShipGateReason({ ...state, proof_assessment: assessment, proof_assessment_source: assessment.source }) : null;
|
|
1073
1093
|
if (readyBlocker) {
|
|
1074
1094
|
assessment.blocked_decision = assessment.decision;
|
|
@@ -1233,6 +1253,8 @@ function summarizeState(state) {
|
|
|
1233
1253
|
|
|
1234
1254
|
export {
|
|
1235
1255
|
WORKFLOW_STAGE_ORDER,
|
|
1256
|
+
canonicalProofAssessmentStageForDecision,
|
|
1257
|
+
normalizeProofAssessmentStageFields,
|
|
1236
1258
|
previewModeFromWorkflowMode,
|
|
1237
1259
|
noImplementationModeFor,
|
|
1238
1260
|
CHECKPOINT_CONTRACT_VERSION,
|
|
@@ -3,10 +3,10 @@ import {
|
|
|
3
3
|
appendStageHeartbeat,
|
|
4
4
|
createRunState,
|
|
5
5
|
setRunStatus
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-WDIKPIMB.js";
|
|
7
7
|
import {
|
|
8
8
|
noImplementationModeFor
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-EKZXU6MU.js";
|
|
10
10
|
import {
|
|
11
11
|
createRunResult
|
|
12
12
|
} from "./chunk-VY4Y5U57.js";
|
|
@@ -5,17 +5,19 @@ import {
|
|
|
5
5
|
createRunStatusSnapshot,
|
|
6
6
|
normalizeRunParams,
|
|
7
7
|
setRunStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-WDIKPIMB.js";
|
|
9
9
|
import {
|
|
10
10
|
createRiddleProofRunCard
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-JJ4IWRMJ.js";
|
|
12
12
|
import {
|
|
13
|
+
canonicalProofAssessmentStageForDecision,
|
|
13
14
|
noImplementationModeFor,
|
|
15
|
+
normalizeProofAssessmentStageFields,
|
|
14
16
|
proofAssessmentHardBlockersForState,
|
|
15
17
|
visualDeltaForState,
|
|
16
18
|
visualDeltaRequiredForState,
|
|
17
19
|
visualDeltaShipGateReason
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-EKZXU6MU.js";
|
|
19
21
|
import {
|
|
20
22
|
authorPacketPayloadFromCheckpointResponse,
|
|
21
23
|
buildCheckpointPacketForEngineResult,
|
|
@@ -25,7 +27,7 @@ import {
|
|
|
25
27
|
normalizeCheckpointResponse,
|
|
26
28
|
proofContractFromAuthorCheckpointResponse,
|
|
27
29
|
statePathsForRunState
|
|
28
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-BLM5EIBA.js";
|
|
29
31
|
import {
|
|
30
32
|
applyTerminalMetadata,
|
|
31
33
|
compactRecord,
|
|
@@ -357,10 +359,7 @@ function isReadyShipGate(result) {
|
|
|
357
359
|
return Boolean(gate && gate.ok === true);
|
|
358
360
|
}
|
|
359
361
|
function proofAssessmentRequestsShip(payload) {
|
|
360
|
-
|
|
361
|
-
const recommendedStage = String(payload.recommended_stage || "");
|
|
362
|
-
const continueStage = String(payload.continue_with_stage || "");
|
|
363
|
-
return decision === "ready_to_ship" || recommendedStage === "ship" || continueStage === "ship";
|
|
362
|
+
return String(payload.decision || "").trim() === "ready_to_ship";
|
|
364
363
|
}
|
|
365
364
|
function proofAssessmentHardBlockers(state, payload) {
|
|
366
365
|
const blockers = proofAssessmentHardBlockersForState(state || {});
|
|
@@ -378,12 +377,7 @@ function proofAssessmentContinuation(result, payload) {
|
|
|
378
377
|
return { ...baseContinuation(result), proof_assessment_json };
|
|
379
378
|
}
|
|
380
379
|
function defaultStageForProofCheckpointDecision(decision) {
|
|
381
|
-
|
|
382
|
-
if (decision === "needs_implementation") return "implement";
|
|
383
|
-
if (decision === "needs_recon") return "recon";
|
|
384
|
-
if (decision === "revise_capture") return "verify";
|
|
385
|
-
if (decision === "needs_richer_proof") return "author";
|
|
386
|
-
return null;
|
|
380
|
+
return canonicalProofAssessmentStageForDecision(decision);
|
|
387
381
|
}
|
|
388
382
|
function checkpointContractFromPacket(packet) {
|
|
389
383
|
return recordValue(packet.evidence_excerpt?.checkpoint_contract) || recordValue(recordValue(packet.state_excerpt?.stage_decision_request)?.checkpoint_contract) || null;
|
|
@@ -409,7 +403,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
|
409
403
|
}
|
|
410
404
|
const payload = recordValue(response.payload) || {};
|
|
411
405
|
const stage = nonEmptyString(payload.continue_with_stage) || response.continue_with_stage || nonEmptyString(payload.recommended_stage) || defaultStageForProofCheckpointDecision(response.decision);
|
|
412
|
-
return compactRecord({
|
|
406
|
+
return normalizeProofAssessmentStageFields(compactRecord({
|
|
413
407
|
...payload,
|
|
414
408
|
decision: response.decision,
|
|
415
409
|
summary: response.summary,
|
|
@@ -420,7 +414,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
|
420
414
|
source: "supervising_agent",
|
|
421
415
|
checkpoint_response_source: response.source || null,
|
|
422
416
|
checkpoint_response_created_at: response.created_at
|
|
423
|
-
});
|
|
417
|
+
}));
|
|
424
418
|
}
|
|
425
419
|
function reconAssessmentPayloadFromCheckpointResponse(response) {
|
|
426
420
|
if (![
|
|
@@ -744,6 +738,22 @@ function checkpointResponseContinuation(state, value) {
|
|
|
744
738
|
}
|
|
745
739
|
};
|
|
746
740
|
}
|
|
741
|
+
if (packet.packet_id && response.packet_id !== packet.packet_id) {
|
|
742
|
+
return {
|
|
743
|
+
blocker: {
|
|
744
|
+
code: "checkpoint_response_packet_id_mismatch",
|
|
745
|
+
checkpoint: packet.checkpoint,
|
|
746
|
+
message: "Checkpoint response packet_id does not match the pending checkpoint packet.",
|
|
747
|
+
details: {
|
|
748
|
+
stage: packet.stage,
|
|
749
|
+
expected_packet_id: packet.packet_id,
|
|
750
|
+
actual_packet_id: response.packet_id || null,
|
|
751
|
+
expected_resume_token: packet.resume_token || null,
|
|
752
|
+
actual_resume_token: response.resume_token || null
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
};
|
|
756
|
+
}
|
|
747
757
|
if (!packet.allowed_decisions.includes(response.decision)) {
|
|
748
758
|
return {
|
|
749
759
|
blocker: {
|
|
@@ -1370,7 +1380,7 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
1370
1380
|
}
|
|
1371
1381
|
return { blocker };
|
|
1372
1382
|
}
|
|
1373
|
-
const payload = assessment.payload;
|
|
1383
|
+
const payload = normalizeProofAssessmentStageFields(assessment.payload);
|
|
1374
1384
|
recordEvent(state, {
|
|
1375
1385
|
kind: "agent.proof_assessment.completed",
|
|
1376
1386
|
checkpoint,
|
package/dist/cli/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-2ALMXMFZ.js";
|
|
2
2
|
import "../chunk-DI2XNGEZ.js";
|
|
3
3
|
import "../chunk-6KYXX4OE.js";
|
|
4
4
|
import "../chunk-EX7TO4I5.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-ZLBOGPUL.js";
|
|
6
|
+
import "../chunk-WDIKPIMB.js";
|
|
7
|
+
import "../chunk-JJ4IWRMJ.js";
|
|
8
|
+
import "../chunk-EKZXU6MU.js";
|
|
9
|
+
import "../chunk-BLM5EIBA.js";
|
|
10
10
|
import "../chunk-JFQXAJH2.js";
|
|
11
11
|
import "../chunk-73EBR3YL.js";
|
|
12
12
|
import "../chunk-VY4Y5U57.js";
|