@riddledc/riddle-proof 0.8.52 → 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 +54 -11
- package/dist/advanced/engine-harness.js +4 -4
- package/dist/advanced/index.cjs +54 -11
- package/dist/advanced/index.js +5 -5
- package/dist/advanced/runner.js +4 -4
- 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-FWHJN3QG.js → chunk-2ALMXMFZ.js} +3 -2
- package/dist/{chunk-AXWJJ2LC.js → chunk-BLM5EIBA.js} +40 -11
- package/dist/{chunk-RBAU2M4S.js → chunk-JJ4IWRMJ.js} +1 -1
- package/dist/{chunk-OYWZGDTS.js → chunk-LNWJAHAQ.js} +1 -1
- package/dist/{chunk-2CZORYB7.js → chunk-S5DX7Z6X.js} +1 -1
- package/dist/{chunk-M3IE3VNC.js → chunk-WDIKPIMB.js} +1 -1
- package/dist/{chunk-WURLFN72.js → chunk-ZLBOGPUL.js} +19 -3
- package/dist/cli/index.js +5 -5
- package/dist/cli.cjs +56 -11
- package/dist/cli.js +5 -5
- package/dist/engine-harness.cjs +54 -11
- package/dist/engine-harness.js +4 -4
- package/dist/index.cjs +57 -11
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +7 -5
- package/dist/openclaw.js +4 -4
- package/dist/run-card.js +2 -2
- package/dist/runner.js +4 -4
- 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
package/dist/cli.cjs
CHANGED
|
@@ -3678,12 +3678,13 @@ function statePathsForRunState(state, engineStatePath2) {
|
|
|
3678
3678
|
function responseSchemaForAuthorPacket() {
|
|
3679
3679
|
return {
|
|
3680
3680
|
type: "object",
|
|
3681
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "payload", "created_at"],
|
|
3681
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "payload", "created_at"],
|
|
3682
3682
|
additionalProperties: false,
|
|
3683
3683
|
properties: {
|
|
3684
3684
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3685
3685
|
run_id: { type: "string" },
|
|
3686
3686
|
checkpoint: { type: "string" },
|
|
3687
|
+
packet_id: { type: "string" },
|
|
3687
3688
|
resume_token: { type: "string" },
|
|
3688
3689
|
decision: {
|
|
3689
3690
|
type: "string",
|
|
@@ -3711,12 +3712,13 @@ function responseSchemaForAuthorPacket() {
|
|
|
3711
3712
|
function responseSchemaForProofAssessmentPacket() {
|
|
3712
3713
|
return {
|
|
3713
3714
|
type: "object",
|
|
3714
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
3715
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
3715
3716
|
additionalProperties: false,
|
|
3716
3717
|
properties: {
|
|
3717
3718
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3718
3719
|
run_id: { type: "string" },
|
|
3719
3720
|
checkpoint: { type: "string" },
|
|
3721
|
+
packet_id: { type: "string" },
|
|
3720
3722
|
resume_token: { type: "string" },
|
|
3721
3723
|
decision: {
|
|
3722
3724
|
type: "string",
|
|
@@ -3752,12 +3754,13 @@ function responseSchemaForProofAssessmentPacket() {
|
|
|
3752
3754
|
function responseSchemaForReconPacket() {
|
|
3753
3755
|
return {
|
|
3754
3756
|
type: "object",
|
|
3755
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
3757
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
3756
3758
|
additionalProperties: false,
|
|
3757
3759
|
properties: {
|
|
3758
3760
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3759
3761
|
run_id: { type: "string" },
|
|
3760
3762
|
checkpoint: { type: "string" },
|
|
3763
|
+
packet_id: { type: "string" },
|
|
3761
3764
|
resume_token: { type: "string" },
|
|
3762
3765
|
decision: {
|
|
3763
3766
|
type: "string",
|
|
@@ -3785,12 +3788,13 @@ function responseSchemaForReconPacket() {
|
|
|
3785
3788
|
function responseSchemaForImplementationPacket() {
|
|
3786
3789
|
return {
|
|
3787
3790
|
type: "object",
|
|
3788
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
3791
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
3789
3792
|
additionalProperties: false,
|
|
3790
3793
|
properties: {
|
|
3791
3794
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3792
3795
|
run_id: { type: "string" },
|
|
3793
3796
|
checkpoint: { type: "string" },
|
|
3797
|
+
packet_id: { type: "string" },
|
|
3794
3798
|
resume_token: { type: "string" },
|
|
3795
3799
|
decision: {
|
|
3796
3800
|
type: "string",
|
|
@@ -3818,12 +3822,13 @@ function responseSchemaForImplementationPacket() {
|
|
|
3818
3822
|
function responseSchemaForAdvancePacket(stage) {
|
|
3819
3823
|
return {
|
|
3820
3824
|
type: "object",
|
|
3821
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
3825
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
3822
3826
|
additionalProperties: false,
|
|
3823
3827
|
properties: {
|
|
3824
3828
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3825
3829
|
run_id: { type: "string" },
|
|
3826
3830
|
checkpoint: { type: "string" },
|
|
3831
|
+
packet_id: { type: "string" },
|
|
3827
3832
|
resume_token: { type: "string" },
|
|
3828
3833
|
decision: {
|
|
3829
3834
|
type: "string",
|
|
@@ -3849,6 +3854,20 @@ function resumeTokenFor(input) {
|
|
|
3849
3854
|
const hash = import_node_crypto.default.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
|
|
3850
3855
|
return `rpchk_${hash}`;
|
|
3851
3856
|
}
|
|
3857
|
+
function packetIdentityPayload(packet) {
|
|
3858
|
+
const { packet_id: _packetId, ...identityPayload } = packet;
|
|
3859
|
+
return identityPayload;
|
|
3860
|
+
}
|
|
3861
|
+
function checkpointPacketIdentity(packet) {
|
|
3862
|
+
const hash = import_node_crypto.default.createHash("sha256").update(stableJson(packetIdentityPayload(packet))).digest("hex").slice(0, 24);
|
|
3863
|
+
return `rppkt_${hash}`;
|
|
3864
|
+
}
|
|
3865
|
+
function withPacketIdentity(packet) {
|
|
3866
|
+
return {
|
|
3867
|
+
...packet,
|
|
3868
|
+
packet_id: checkpointPacketIdentity(packet)
|
|
3869
|
+
};
|
|
3870
|
+
}
|
|
3852
3871
|
function artifactsFromState(state) {
|
|
3853
3872
|
const artifacts = [];
|
|
3854
3873
|
for (const role of ["before", "prod", "after"]) {
|
|
@@ -3921,7 +3940,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
3921
3940
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
3922
3941
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.stage_summary) || `${stage} checkpoint needs a supervising decision.`;
|
|
3923
3942
|
const kind = packetKindForStage(stage, checkpoint);
|
|
3924
|
-
return {
|
|
3943
|
+
return withPacketIdentity({
|
|
3925
3944
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
3926
3945
|
run_id: runId,
|
|
3927
3946
|
state_path: input.runState.state_path,
|
|
@@ -3970,7 +3989,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
3970
3989
|
stage
|
|
3971
3990
|
}),
|
|
3972
3991
|
created_at: input.created_at || timestamp()
|
|
3973
|
-
};
|
|
3992
|
+
});
|
|
3974
3993
|
}
|
|
3975
3994
|
function buildAuthorCheckpointPacket(input) {
|
|
3976
3995
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "author_supervisor_judgment";
|
|
@@ -3983,7 +4002,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
3983
4002
|
const reconResults = recordValue(fullState.recon_results);
|
|
3984
4003
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
3985
4004
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.author_summary) || "Author checkpoint needs a supervising proof packet.";
|
|
3986
|
-
return {
|
|
4005
|
+
return withPacketIdentity({
|
|
3987
4006
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
3988
4007
|
run_id: runId,
|
|
3989
4008
|
state_path: input.runState.state_path,
|
|
@@ -4032,7 +4051,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
4032
4051
|
stage
|
|
4033
4052
|
}),
|
|
4034
4053
|
created_at: input.created_at || timestamp()
|
|
4035
|
-
};
|
|
4054
|
+
});
|
|
4036
4055
|
}
|
|
4037
4056
|
function visualDeltaFromState(fullState) {
|
|
4038
4057
|
const bundle = recordValue(fullState.evidence_bundle);
|
|
@@ -4103,7 +4122,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
4103
4122
|
const evidenceIssueCode2 = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
|
|
4104
4123
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
|
|
4105
4124
|
const recoveryHint = evidenceIssueCode2 ? "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.";
|
|
4106
|
-
return {
|
|
4125
|
+
return withPacketIdentity({
|
|
4107
4126
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
4108
4127
|
run_id: runId,
|
|
4109
4128
|
state_path: input.runState.state_path,
|
|
@@ -4163,7 +4182,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
4163
4182
|
stage
|
|
4164
4183
|
}),
|
|
4165
4184
|
created_at: input.created_at || timestamp()
|
|
4166
|
-
};
|
|
4185
|
+
});
|
|
4167
4186
|
}
|
|
4168
4187
|
function buildCheckpointPacketForEngineResult(input) {
|
|
4169
4188
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
|
|
@@ -4192,6 +4211,7 @@ function normalizeCheckpointResponse(value) {
|
|
|
4192
4211
|
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
4193
4212
|
run_id: runId,
|
|
4194
4213
|
checkpoint,
|
|
4214
|
+
packet_id: nonEmptyString(record.packet_id),
|
|
4195
4215
|
resume_token: nonEmptyString(record.resume_token),
|
|
4196
4216
|
decision,
|
|
4197
4217
|
summary,
|
|
@@ -4279,6 +4299,7 @@ function createCheckpointResponseTemplate(packet, input = {}) {
|
|
|
4279
4299
|
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
4280
4300
|
run_id: packet.run_id,
|
|
4281
4301
|
checkpoint: packet.checkpoint,
|
|
4302
|
+
packet_id: packet.packet_id,
|
|
4282
4303
|
resume_token: packet.resume_token,
|
|
4283
4304
|
decision,
|
|
4284
4305
|
summary: input.summary || `TODO: explain checkpoint decision ${decision}.`,
|
|
@@ -4312,6 +4333,9 @@ function checkpointSummaryFromState(state, engineStatePath2) {
|
|
|
4312
4333
|
const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
|
|
4313
4334
|
const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
|
|
4314
4335
|
const latestResponse = latestResponseEntry?.response;
|
|
4336
|
+
const latestPacketId = latestPacket?.packet_id || null;
|
|
4337
|
+
const latestResponsePacketId = latestResponse?.packet_id || null;
|
|
4338
|
+
const packetIdMatches = !latestResponse ? null : latestPacketId && latestResponsePacketId ? latestPacketId === latestResponsePacketId : latestPacketId || latestResponsePacketId ? false : null;
|
|
4315
4339
|
const latestResumeToken = latestPacket?.resume_token || null;
|
|
4316
4340
|
const latestResponseToken = latestResponse?.resume_token || null;
|
|
4317
4341
|
const tokenMatches = !latestResponse ? null : latestResumeToken && latestResponseToken ? latestResumeToken === latestResponseToken : latestResumeToken || latestResponseToken ? false : null;
|
|
@@ -4326,6 +4350,9 @@ function checkpointSummaryFromState(state, engineStatePath2) {
|
|
|
4326
4350
|
latest_decision: latestResponse?.decision || null,
|
|
4327
4351
|
latest_packet_summary: latestPacket?.summary || null,
|
|
4328
4352
|
latest_response_summary: latestResponse?.summary || null,
|
|
4353
|
+
latest_packet_id: latestPacketId,
|
|
4354
|
+
latest_response_packet_id: latestResponsePacketId,
|
|
4355
|
+
packet_id_matches: packetIdMatches,
|
|
4329
4356
|
latest_resume_token: latestResumeToken,
|
|
4330
4357
|
latest_response_token: latestResponseToken,
|
|
4331
4358
|
token_matches: tokenMatches,
|
|
@@ -4342,6 +4369,7 @@ function checkpointResponseIdentity(response) {
|
|
|
4342
4369
|
const logicalResponse = compactRecord({
|
|
4343
4370
|
run_id: response.run_id,
|
|
4344
4371
|
checkpoint: response.checkpoint,
|
|
4372
|
+
packet_id: response.packet_id,
|
|
4345
4373
|
resume_token: response.resume_token,
|
|
4346
4374
|
decision: response.decision,
|
|
4347
4375
|
summary: response.summary,
|
|
@@ -5492,6 +5520,22 @@ function checkpointResponseContinuation(state, value) {
|
|
|
5492
5520
|
}
|
|
5493
5521
|
};
|
|
5494
5522
|
}
|
|
5523
|
+
if (packet.packet_id && response.packet_id !== packet.packet_id) {
|
|
5524
|
+
return {
|
|
5525
|
+
blocker: {
|
|
5526
|
+
code: "checkpoint_response_packet_id_mismatch",
|
|
5527
|
+
checkpoint: packet.checkpoint,
|
|
5528
|
+
message: "Checkpoint response packet_id does not match the pending checkpoint packet.",
|
|
5529
|
+
details: {
|
|
5530
|
+
stage: packet.stage,
|
|
5531
|
+
expected_packet_id: packet.packet_id,
|
|
5532
|
+
actual_packet_id: response.packet_id || null,
|
|
5533
|
+
expected_resume_token: packet.resume_token || null,
|
|
5534
|
+
actual_resume_token: response.resume_token || null
|
|
5535
|
+
}
|
|
5536
|
+
}
|
|
5537
|
+
};
|
|
5538
|
+
}
|
|
5495
5539
|
if (!packet.allowed_decisions.includes(response.decision)) {
|
|
5496
5540
|
return {
|
|
5497
5541
|
blocker: {
|
|
@@ -18760,6 +18804,7 @@ function formatCheckpointMarkdown(input) {
|
|
|
18760
18804
|
`Status: ${input.status || "awaiting_checkpoint"}`,
|
|
18761
18805
|
`Stage: ${packet.stage}`,
|
|
18762
18806
|
`Checkpoint: ${packet.checkpoint}`,
|
|
18807
|
+
`Packet ID: ${packet.packet_id || "legacy"}`,
|
|
18763
18808
|
`Kind: ${packet.kind}`,
|
|
18764
18809
|
"",
|
|
18765
18810
|
"## Goal",
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-2ALMXMFZ.js";
|
|
3
3
|
import "./chunk-DI2XNGEZ.js";
|
|
4
4
|
import "./chunk-6KYXX4OE.js";
|
|
5
5
|
import "./chunk-EX7TO4I5.js";
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-ZLBOGPUL.js";
|
|
7
|
+
import "./chunk-WDIKPIMB.js";
|
|
8
|
+
import "./chunk-JJ4IWRMJ.js";
|
|
9
9
|
import "./chunk-EKZXU6MU.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-BLM5EIBA.js";
|
|
11
11
|
import "./chunk-JFQXAJH2.js";
|
|
12
12
|
import "./chunk-73EBR3YL.js";
|
|
13
13
|
import "./chunk-VY4Y5U57.js";
|
package/dist/engine-harness.cjs
CHANGED
|
@@ -3680,12 +3680,13 @@ function statePathsForRunState(state, engineStatePath2) {
|
|
|
3680
3680
|
function responseSchemaForAuthorPacket() {
|
|
3681
3681
|
return {
|
|
3682
3682
|
type: "object",
|
|
3683
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "payload", "created_at"],
|
|
3683
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "payload", "created_at"],
|
|
3684
3684
|
additionalProperties: false,
|
|
3685
3685
|
properties: {
|
|
3686
3686
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3687
3687
|
run_id: { type: "string" },
|
|
3688
3688
|
checkpoint: { type: "string" },
|
|
3689
|
+
packet_id: { type: "string" },
|
|
3689
3690
|
resume_token: { type: "string" },
|
|
3690
3691
|
decision: {
|
|
3691
3692
|
type: "string",
|
|
@@ -3713,12 +3714,13 @@ function responseSchemaForAuthorPacket() {
|
|
|
3713
3714
|
function responseSchemaForProofAssessmentPacket() {
|
|
3714
3715
|
return {
|
|
3715
3716
|
type: "object",
|
|
3716
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
3717
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
3717
3718
|
additionalProperties: false,
|
|
3718
3719
|
properties: {
|
|
3719
3720
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3720
3721
|
run_id: { type: "string" },
|
|
3721
3722
|
checkpoint: { type: "string" },
|
|
3723
|
+
packet_id: { type: "string" },
|
|
3722
3724
|
resume_token: { type: "string" },
|
|
3723
3725
|
decision: {
|
|
3724
3726
|
type: "string",
|
|
@@ -3754,12 +3756,13 @@ function responseSchemaForProofAssessmentPacket() {
|
|
|
3754
3756
|
function responseSchemaForReconPacket() {
|
|
3755
3757
|
return {
|
|
3756
3758
|
type: "object",
|
|
3757
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
3759
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
3758
3760
|
additionalProperties: false,
|
|
3759
3761
|
properties: {
|
|
3760
3762
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3761
3763
|
run_id: { type: "string" },
|
|
3762
3764
|
checkpoint: { type: "string" },
|
|
3765
|
+
packet_id: { type: "string" },
|
|
3763
3766
|
resume_token: { type: "string" },
|
|
3764
3767
|
decision: {
|
|
3765
3768
|
type: "string",
|
|
@@ -3787,12 +3790,13 @@ function responseSchemaForReconPacket() {
|
|
|
3787
3790
|
function responseSchemaForImplementationPacket() {
|
|
3788
3791
|
return {
|
|
3789
3792
|
type: "object",
|
|
3790
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
3793
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
3791
3794
|
additionalProperties: false,
|
|
3792
3795
|
properties: {
|
|
3793
3796
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3794
3797
|
run_id: { type: "string" },
|
|
3795
3798
|
checkpoint: { type: "string" },
|
|
3799
|
+
packet_id: { type: "string" },
|
|
3796
3800
|
resume_token: { type: "string" },
|
|
3797
3801
|
decision: {
|
|
3798
3802
|
type: "string",
|
|
@@ -3820,12 +3824,13 @@ function responseSchemaForImplementationPacket() {
|
|
|
3820
3824
|
function responseSchemaForAdvancePacket(stage) {
|
|
3821
3825
|
return {
|
|
3822
3826
|
type: "object",
|
|
3823
|
-
required: ["version", "run_id", "checkpoint", "decision", "summary", "created_at"],
|
|
3827
|
+
required: ["version", "run_id", "checkpoint", "packet_id", "decision", "summary", "created_at"],
|
|
3824
3828
|
additionalProperties: false,
|
|
3825
3829
|
properties: {
|
|
3826
3830
|
version: { const: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION },
|
|
3827
3831
|
run_id: { type: "string" },
|
|
3828
3832
|
checkpoint: { type: "string" },
|
|
3833
|
+
packet_id: { type: "string" },
|
|
3829
3834
|
resume_token: { type: "string" },
|
|
3830
3835
|
decision: {
|
|
3831
3836
|
type: "string",
|
|
@@ -3851,6 +3856,20 @@ function resumeTokenFor(input) {
|
|
|
3851
3856
|
const hash = import_node_crypto.default.createHash("sha256").update(JSON.stringify(input)).digest("hex").slice(0, 24);
|
|
3852
3857
|
return `rpchk_${hash}`;
|
|
3853
3858
|
}
|
|
3859
|
+
function packetIdentityPayload(packet) {
|
|
3860
|
+
const { packet_id: _packetId, ...identityPayload } = packet;
|
|
3861
|
+
return identityPayload;
|
|
3862
|
+
}
|
|
3863
|
+
function checkpointPacketIdentity(packet) {
|
|
3864
|
+
const hash = import_node_crypto.default.createHash("sha256").update(stableJson(packetIdentityPayload(packet))).digest("hex").slice(0, 24);
|
|
3865
|
+
return `rppkt_${hash}`;
|
|
3866
|
+
}
|
|
3867
|
+
function withPacketIdentity(packet) {
|
|
3868
|
+
return {
|
|
3869
|
+
...packet,
|
|
3870
|
+
packet_id: checkpointPacketIdentity(packet)
|
|
3871
|
+
};
|
|
3872
|
+
}
|
|
3854
3873
|
function artifactsFromState(state) {
|
|
3855
3874
|
const artifacts = [];
|
|
3856
3875
|
for (const role of ["before", "prod", "after"]) {
|
|
@@ -3923,7 +3942,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
3923
3942
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
3924
3943
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.stage_summary) || `${stage} checkpoint needs a supervising decision.`;
|
|
3925
3944
|
const kind = packetKindForStage(stage, checkpoint);
|
|
3926
|
-
return {
|
|
3945
|
+
return withPacketIdentity({
|
|
3927
3946
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
3928
3947
|
run_id: runId,
|
|
3929
3948
|
state_path: input.runState.state_path,
|
|
@@ -3972,7 +3991,7 @@ function buildStageCheckpointPacket(input) {
|
|
|
3972
3991
|
stage
|
|
3973
3992
|
}),
|
|
3974
3993
|
created_at: input.created_at || timestamp()
|
|
3975
|
-
};
|
|
3994
|
+
});
|
|
3976
3995
|
}
|
|
3977
3996
|
function buildAuthorCheckpointPacket(input) {
|
|
3978
3997
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "author_supervisor_judgment";
|
|
@@ -3985,7 +4004,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
3985
4004
|
const reconResults = recordValue(fullState.recon_results);
|
|
3986
4005
|
const checkpointContract = recordValue(input.engineResult.checkpointContract);
|
|
3987
4006
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.author_summary) || "Author checkpoint needs a supervising proof packet.";
|
|
3988
|
-
return {
|
|
4007
|
+
return withPacketIdentity({
|
|
3989
4008
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
3990
4009
|
run_id: runId,
|
|
3991
4010
|
state_path: input.runState.state_path,
|
|
@@ -4034,7 +4053,7 @@ function buildAuthorCheckpointPacket(input) {
|
|
|
4034
4053
|
stage
|
|
4035
4054
|
}),
|
|
4036
4055
|
created_at: input.created_at || timestamp()
|
|
4037
|
-
};
|
|
4056
|
+
});
|
|
4038
4057
|
}
|
|
4039
4058
|
function visualDeltaFromState(fullState) {
|
|
4040
4059
|
const bundle = recordValue(fullState.evidence_bundle);
|
|
@@ -4105,7 +4124,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
4105
4124
|
const evidenceIssueCode2 = visualDeltaIssueCode(visualDelta, visualDeltaRequired);
|
|
4106
4125
|
const summary = nonEmptyString(input.engineResult.summary) || nonEmptyString(fullState.verify_summary) || "Verify captured evidence and needs a supervising proof assessment.";
|
|
4107
4126
|
const recoveryHint = evidenceIssueCode2 ? "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.";
|
|
4108
|
-
return {
|
|
4127
|
+
return withPacketIdentity({
|
|
4109
4128
|
version: RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
4110
4129
|
run_id: runId,
|
|
4111
4130
|
state_path: input.runState.state_path,
|
|
@@ -4165,7 +4184,7 @@ function buildProofAssessmentCheckpointPacket(input) {
|
|
|
4165
4184
|
stage
|
|
4166
4185
|
}),
|
|
4167
4186
|
created_at: input.created_at || timestamp()
|
|
4168
|
-
};
|
|
4187
|
+
});
|
|
4169
4188
|
}
|
|
4170
4189
|
function buildCheckpointPacketForEngineResult(input) {
|
|
4171
4190
|
const checkpoint = nonEmptyString(input.engineResult.checkpoint) || "";
|
|
@@ -4194,6 +4213,7 @@ function normalizeCheckpointResponse(value) {
|
|
|
4194
4213
|
version: RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
4195
4214
|
run_id: runId,
|
|
4196
4215
|
checkpoint,
|
|
4216
|
+
packet_id: nonEmptyString(record.packet_id),
|
|
4197
4217
|
resume_token: nonEmptyString(record.resume_token),
|
|
4198
4218
|
decision,
|
|
4199
4219
|
summary,
|
|
@@ -4225,6 +4245,9 @@ function checkpointSummaryFromState(state, engineStatePath2) {
|
|
|
4225
4245
|
const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
|
|
4226
4246
|
const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
|
|
4227
4247
|
const latestResponse = latestResponseEntry?.response;
|
|
4248
|
+
const latestPacketId = latestPacket?.packet_id || null;
|
|
4249
|
+
const latestResponsePacketId = latestResponse?.packet_id || null;
|
|
4250
|
+
const packetIdMatches = !latestResponse ? null : latestPacketId && latestResponsePacketId ? latestPacketId === latestResponsePacketId : latestPacketId || latestResponsePacketId ? false : null;
|
|
4228
4251
|
const latestResumeToken = latestPacket?.resume_token || null;
|
|
4229
4252
|
const latestResponseToken = latestResponse?.resume_token || null;
|
|
4230
4253
|
const tokenMatches = !latestResponse ? null : latestResumeToken && latestResponseToken ? latestResumeToken === latestResponseToken : latestResumeToken || latestResponseToken ? false : null;
|
|
@@ -4239,6 +4262,9 @@ function checkpointSummaryFromState(state, engineStatePath2) {
|
|
|
4239
4262
|
latest_decision: latestResponse?.decision || null,
|
|
4240
4263
|
latest_packet_summary: latestPacket?.summary || null,
|
|
4241
4264
|
latest_response_summary: latestResponse?.summary || null,
|
|
4265
|
+
latest_packet_id: latestPacketId,
|
|
4266
|
+
latest_response_packet_id: latestResponsePacketId,
|
|
4267
|
+
packet_id_matches: packetIdMatches,
|
|
4242
4268
|
latest_resume_token: latestResumeToken,
|
|
4243
4269
|
latest_response_token: latestResponseToken,
|
|
4244
4270
|
token_matches: tokenMatches,
|
|
@@ -4255,6 +4281,7 @@ function checkpointResponseIdentity(response) {
|
|
|
4255
4281
|
const logicalResponse = compactRecord({
|
|
4256
4282
|
run_id: response.run_id,
|
|
4257
4283
|
checkpoint: response.checkpoint,
|
|
4284
|
+
packet_id: response.packet_id,
|
|
4258
4285
|
resume_token: response.resume_token,
|
|
4259
4286
|
decision: response.decision,
|
|
4260
4287
|
summary: response.summary,
|
|
@@ -5405,6 +5432,22 @@ function checkpointResponseContinuation(state, value) {
|
|
|
5405
5432
|
}
|
|
5406
5433
|
};
|
|
5407
5434
|
}
|
|
5435
|
+
if (packet.packet_id && response.packet_id !== packet.packet_id) {
|
|
5436
|
+
return {
|
|
5437
|
+
blocker: {
|
|
5438
|
+
code: "checkpoint_response_packet_id_mismatch",
|
|
5439
|
+
checkpoint: packet.checkpoint,
|
|
5440
|
+
message: "Checkpoint response packet_id does not match the pending checkpoint packet.",
|
|
5441
|
+
details: {
|
|
5442
|
+
stage: packet.stage,
|
|
5443
|
+
expected_packet_id: packet.packet_id,
|
|
5444
|
+
actual_packet_id: response.packet_id || null,
|
|
5445
|
+
expected_resume_token: packet.resume_token || null,
|
|
5446
|
+
actual_resume_token: response.resume_token || null
|
|
5447
|
+
}
|
|
5448
|
+
}
|
|
5449
|
+
};
|
|
5450
|
+
}
|
|
5408
5451
|
if (!packet.allowed_decisions.includes(response.decision)) {
|
|
5409
5452
|
return {
|
|
5410
5453
|
blocker: {
|
package/dist/engine-harness.js
CHANGED
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
createDisabledRiddleProofAgentAdapter,
|
|
3
3
|
readRiddleProofRunStatus,
|
|
4
4
|
runRiddleProofEngineHarness
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-ZLBOGPUL.js";
|
|
6
|
+
import "./chunk-WDIKPIMB.js";
|
|
7
|
+
import "./chunk-JJ4IWRMJ.js";
|
|
8
8
|
import "./chunk-EKZXU6MU.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-BLM5EIBA.js";
|
|
10
10
|
import "./chunk-VY4Y5U57.js";
|
|
11
11
|
import "./chunk-MLKGABMK.js";
|
|
12
12
|
export {
|