@riddledc/riddle-proof 0.8.14 → 0.8.15

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.
@@ -5220,6 +5220,40 @@ function checkpointResponseContinuation(state, value) {
5220
5220
  }
5221
5221
  };
5222
5222
  }
5223
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5224
+ if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5225
+ const response = normalizeCheckpointResponse(value);
5226
+ if (!response) return null;
5227
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5228
+ const at = timestamp3();
5229
+ state.checkpoint_history = [
5230
+ ...state.checkpoint_history || [],
5231
+ { ts: at, response }
5232
+ ].slice(-25);
5233
+ appendRunEvent(state, {
5234
+ ts: at,
5235
+ kind: "checkpoint.response.ignored",
5236
+ checkpoint: response.checkpoint,
5237
+ stage: state.current_stage || "verify",
5238
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5239
+ details: compactRecord({
5240
+ status: state.status,
5241
+ decision: response.decision,
5242
+ resume_token: response.resume_token,
5243
+ source: response.source
5244
+ })
5245
+ });
5246
+ persist(state);
5247
+ return createRunResult({
5248
+ state,
5249
+ status: state.status,
5250
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5251
+ raw: {
5252
+ ignored_checkpoint_response: true,
5253
+ response
5254
+ }
5255
+ });
5256
+ }
5223
5257
  function disabledAdapterPayload(action, context) {
5224
5258
  return {
5225
5259
  ok: false,
@@ -5790,6 +5824,8 @@ async function runRiddleProofEngineHarness(input) {
5790
5824
  const state = loadRunState(input);
5791
5825
  state.request = normalizeRunParams({ ...state.request, ...input.request });
5792
5826
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
5827
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
5828
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
5793
5829
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
5794
5830
  if (checkpointContinuation.blocker) {
5795
5831
  return blockerResult(state, null, checkpointContinuation.blocker);
@@ -2,7 +2,7 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "../chunk-YFRPFV4U.js";
5
+ } from "../chunk-RW4OUHN4.js";
6
6
  import "../chunk-YZUVEJ5B.js";
7
7
  import "../chunk-FMOYUYH2.js";
8
8
  import "../chunk-7GZY5PLT.js";
@@ -5757,6 +5757,40 @@ function checkpointResponseContinuation(state, value) {
5757
5757
  }
5758
5758
  };
5759
5759
  }
5760
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5761
+ if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5762
+ const response = normalizeCheckpointResponse(value);
5763
+ if (!response) return null;
5764
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5765
+ const at = timestamp3();
5766
+ state.checkpoint_history = [
5767
+ ...state.checkpoint_history || [],
5768
+ { ts: at, response }
5769
+ ].slice(-25);
5770
+ appendRunEvent(state, {
5771
+ ts: at,
5772
+ kind: "checkpoint.response.ignored",
5773
+ checkpoint: response.checkpoint,
5774
+ stage: state.current_stage || "verify",
5775
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5776
+ details: compactRecord({
5777
+ status: state.status,
5778
+ decision: response.decision,
5779
+ resume_token: response.resume_token,
5780
+ source: response.source
5781
+ })
5782
+ });
5783
+ persist(state);
5784
+ return createRunResult({
5785
+ state,
5786
+ status: state.status,
5787
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5788
+ raw: {
5789
+ ignored_checkpoint_response: true,
5790
+ response
5791
+ }
5792
+ });
5793
+ }
5760
5794
  function disabledAdapterPayload(action, context) {
5761
5795
  return {
5762
5796
  ok: false,
@@ -6327,6 +6361,8 @@ async function runRiddleProofEngineHarness(input) {
6327
6361
  const state = loadRunState(input);
6328
6362
  state.request = normalizeRunParams({ ...state.request, ...input.request });
6329
6363
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
6364
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
6365
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
6330
6366
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
6331
6367
  if (checkpointContinuation.blocker) {
6332
6368
  return blockerResult(state, null, checkpointContinuation.blocker);
@@ -6,7 +6,7 @@ import {
6
6
  } from "../chunk-NGX4SUQN.js";
7
7
  import {
8
8
  engine_harness_exports
9
- } from "../chunk-YFRPFV4U.js";
9
+ } from "../chunk-RW4OUHN4.js";
10
10
  import "../chunk-YZUVEJ5B.js";
11
11
  import "../chunk-FMOYUYH2.js";
12
12
  import {
@@ -22,7 +22,7 @@ import {
22
22
  createDisabledRiddleProofAgentAdapter,
23
23
  readRiddleProofRunStatus,
24
24
  runRiddleProofEngineHarness
25
- } from "./chunk-YFRPFV4U.js";
25
+ } from "./chunk-RW4OUHN4.js";
26
26
  import {
27
27
  createCheckpointResponseTemplate
28
28
  } from "./chunk-4FOHZ7JG.js";
@@ -861,6 +861,40 @@ function checkpointResponseContinuation(state, value) {
861
861
  }
862
862
  };
863
863
  }
864
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
865
+ if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
866
+ const response = normalizeCheckpointResponse(value);
867
+ if (!response) return null;
868
+ if (isDuplicateCheckpointResponse(state, response)) return null;
869
+ const at = timestamp();
870
+ state.checkpoint_history = [
871
+ ...state.checkpoint_history || [],
872
+ { ts: at, response }
873
+ ].slice(-25);
874
+ appendRunEvent(state, {
875
+ ts: at,
876
+ kind: "checkpoint.response.ignored",
877
+ checkpoint: response.checkpoint,
878
+ stage: state.current_stage || "verify",
879
+ summary: "Late checkpoint response ignored because the run is already finalized.",
880
+ details: compactRecord({
881
+ status: state.status,
882
+ decision: response.decision,
883
+ resume_token: response.resume_token,
884
+ source: response.source
885
+ })
886
+ });
887
+ persist(state);
888
+ return createRunResult({
889
+ state,
890
+ status: state.status,
891
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
892
+ raw: {
893
+ ignored_checkpoint_response: true,
894
+ response
895
+ }
896
+ });
897
+ }
864
898
  function disabledAdapterPayload(action, context) {
865
899
  return {
866
900
  ok: false,
@@ -1431,6 +1465,8 @@ async function runRiddleProofEngineHarness(input) {
1431
1465
  const state = loadRunState(input);
1432
1466
  state.request = normalizeRunParams({ ...state.request, ...input.request });
1433
1467
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
1468
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
1469
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
1434
1470
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
1435
1471
  if (checkpointContinuation.blocker) {
1436
1472
  return blockerResult(state, null, checkpointContinuation.blocker);
package/dist/cli/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import "../chunk-EGZT3EVL.js";
1
+ import "../chunk-KTIDPXE2.js";
2
2
  import "../chunk-PEWAIEER.js";
3
3
  import "../chunk-TWTEUS7R.js";
4
- import "../chunk-YFRPFV4U.js";
4
+ import "../chunk-RW4OUHN4.js";
5
5
  import "../chunk-YZUVEJ5B.js";
6
6
  import "../chunk-FMOYUYH2.js";
7
7
  import "../chunk-7GZY5PLT.js";
package/dist/cli.cjs CHANGED
@@ -5289,6 +5289,40 @@ function checkpointResponseContinuation(state, value) {
5289
5289
  }
5290
5290
  };
5291
5291
  }
5292
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5293
+ if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5294
+ const response = normalizeCheckpointResponse(value);
5295
+ if (!response) return null;
5296
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5297
+ const at = timestamp3();
5298
+ state.checkpoint_history = [
5299
+ ...state.checkpoint_history || [],
5300
+ { ts: at, response }
5301
+ ].slice(-25);
5302
+ appendRunEvent(state, {
5303
+ ts: at,
5304
+ kind: "checkpoint.response.ignored",
5305
+ checkpoint: response.checkpoint,
5306
+ stage: state.current_stage || "verify",
5307
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5308
+ details: compactRecord({
5309
+ status: state.status,
5310
+ decision: response.decision,
5311
+ resume_token: response.resume_token,
5312
+ source: response.source
5313
+ })
5314
+ });
5315
+ persist(state);
5316
+ return createRunResult({
5317
+ state,
5318
+ status: state.status,
5319
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5320
+ raw: {
5321
+ ignored_checkpoint_response: true,
5322
+ response
5323
+ }
5324
+ });
5325
+ }
5292
5326
  function disabledAdapterPayload(action, context) {
5293
5327
  return {
5294
5328
  ok: false,
@@ -5859,6 +5893,8 @@ async function runRiddleProofEngineHarness(input) {
5859
5893
  const state = loadRunState(input);
5860
5894
  state.request = normalizeRunParams({ ...state.request, ...input.request });
5861
5895
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
5896
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
5897
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
5862
5898
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
5863
5899
  if (checkpointContinuation.blocker) {
5864
5900
  return blockerResult(state, null, checkpointContinuation.blocker);
package/dist/cli.js CHANGED
@@ -1,8 +1,8 @@
1
1
  #!/usr/bin/env node
2
- import "./chunk-EGZT3EVL.js";
2
+ import "./chunk-KTIDPXE2.js";
3
3
  import "./chunk-PEWAIEER.js";
4
4
  import "./chunk-TWTEUS7R.js";
5
- import "./chunk-YFRPFV4U.js";
5
+ import "./chunk-RW4OUHN4.js";
6
6
  import "./chunk-YZUVEJ5B.js";
7
7
  import "./chunk-FMOYUYH2.js";
8
8
  import "./chunk-7GZY5PLT.js";
@@ -5218,6 +5218,40 @@ function checkpointResponseContinuation(state, value) {
5218
5218
  }
5219
5219
  };
5220
5220
  }
5221
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5222
+ if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5223
+ const response = normalizeCheckpointResponse(value);
5224
+ if (!response) return null;
5225
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5226
+ const at = timestamp3();
5227
+ state.checkpoint_history = [
5228
+ ...state.checkpoint_history || [],
5229
+ { ts: at, response }
5230
+ ].slice(-25);
5231
+ appendRunEvent(state, {
5232
+ ts: at,
5233
+ kind: "checkpoint.response.ignored",
5234
+ checkpoint: response.checkpoint,
5235
+ stage: state.current_stage || "verify",
5236
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5237
+ details: compactRecord({
5238
+ status: state.status,
5239
+ decision: response.decision,
5240
+ resume_token: response.resume_token,
5241
+ source: response.source
5242
+ })
5243
+ });
5244
+ persist(state);
5245
+ return createRunResult({
5246
+ state,
5247
+ status: state.status,
5248
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5249
+ raw: {
5250
+ ignored_checkpoint_response: true,
5251
+ response
5252
+ }
5253
+ });
5254
+ }
5221
5255
  function disabledAdapterPayload(action, context) {
5222
5256
  return {
5223
5257
  ok: false,
@@ -5788,6 +5822,8 @@ async function runRiddleProofEngineHarness(input) {
5788
5822
  const state = loadRunState(input);
5789
5823
  state.request = normalizeRunParams({ ...state.request, ...input.request });
5790
5824
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
5825
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
5826
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
5791
5827
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
5792
5828
  if (checkpointContinuation.blocker) {
5793
5829
  return blockerResult(state, null, checkpointContinuation.blocker);
@@ -2,7 +2,7 @@ import {
2
2
  createDisabledRiddleProofAgentAdapter,
3
3
  readRiddleProofRunStatus,
4
4
  runRiddleProofEngineHarness
5
- } from "./chunk-YFRPFV4U.js";
5
+ } from "./chunk-RW4OUHN4.js";
6
6
  import "./chunk-YZUVEJ5B.js";
7
7
  import "./chunk-FMOYUYH2.js";
8
8
  import "./chunk-7GZY5PLT.js";
package/dist/index.cjs CHANGED
@@ -5952,6 +5952,40 @@ function checkpointResponseContinuation(state, value) {
5952
5952
  }
5953
5953
  };
5954
5954
  }
5955
+ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
5956
+ if (!value || state.checkpoint_packet || !state.finalized || !isProtectedFinalStatus(state.status)) return null;
5957
+ const response = normalizeCheckpointResponse(value);
5958
+ if (!response) return null;
5959
+ if (isDuplicateCheckpointResponse(state, response)) return null;
5960
+ const at = timestamp3();
5961
+ state.checkpoint_history = [
5962
+ ...state.checkpoint_history || [],
5963
+ { ts: at, response }
5964
+ ].slice(-25);
5965
+ appendRunEvent(state, {
5966
+ ts: at,
5967
+ kind: "checkpoint.response.ignored",
5968
+ checkpoint: response.checkpoint,
5969
+ stage: state.current_stage || "verify",
5970
+ summary: "Late checkpoint response ignored because the run is already finalized.",
5971
+ details: compactRecord({
5972
+ status: state.status,
5973
+ decision: response.decision,
5974
+ resume_token: response.resume_token,
5975
+ source: response.source
5976
+ })
5977
+ });
5978
+ persist(state);
5979
+ return createRunResult({
5980
+ state,
5981
+ status: state.status,
5982
+ last_summary: "Late checkpoint response ignored because the run is already finalized.",
5983
+ raw: {
5984
+ ignored_checkpoint_response: true,
5985
+ response
5986
+ }
5987
+ });
5988
+ }
5955
5989
  function disabledAdapterPayload(action, context) {
5956
5990
  return {
5957
5991
  ok: false,
@@ -6522,6 +6556,8 @@ async function runRiddleProofEngineHarness(input) {
6522
6556
  const state = loadRunState(input);
6523
6557
  state.request = normalizeRunParams({ ...state.request, ...input.request });
6524
6558
  state.request.engine_state_path = nonEmptyString(input.resume_params?.state_path) || nonEmptyString(state.request.engine_state_path) || createEngineStatePath(state, input.config);
6559
+ const finalizedCheckpointResponse = finalizedCheckpointResponseWithoutPacketResult(state, input.checkpoint_response);
6560
+ if (finalizedCheckpointResponse) return finalizedCheckpointResponse;
6525
6561
  const checkpointContinuation = checkpointResponseContinuation(state, input.checkpoint_response);
6526
6562
  if (checkpointContinuation.blocker) {
6527
6563
  return blockerResult(state, null, checkpointContinuation.blocker);
package/dist/index.js CHANGED
@@ -95,7 +95,7 @@ import {
95
95
  createDisabledRiddleProofAgentAdapter,
96
96
  readRiddleProofRunStatus,
97
97
  runRiddleProofEngineHarness
98
- } from "./chunk-YFRPFV4U.js";
98
+ } from "./chunk-RW4OUHN4.js";
99
99
  import {
100
100
  RIDDLE_PROOF_RUN_STATE_VERSION,
101
101
  appendRunEvent,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@riddledc/riddle-proof",
3
- "version": "0.8.14",
3
+ "version": "0.8.15",
4
4
  "description": "Reusable Riddle Proof contracts and helpers for evidence-backed agent changes.",
5
5
  "license": "MIT",
6
6
  "author": "RiddleDC",
@@ -109,6 +109,7 @@ CASES = [
109
109
  GENERIC_FAILURE_MARKERS = (
110
110
  'codex_invalid_json',
111
111
  'codex_no_final_response',
112
+ 'codex_timeout',
112
113
  'max_iterations_reached',
113
114
  'stage_iteration_limit_reached',
114
115
  'unhandled_checkpoint',