@riddledc/riddle-proof 0.8.50 → 0.8.52
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 +41 -23
- package/dist/advanced/engine-harness.js +5 -5
- package/dist/advanced/index.cjs +43 -23
- 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 +16 -4
- package/dist/checkpoint.js +1 -1
- package/dist/{chunk-UKGDVNGI.js → chunk-2CZORYB7.js} +2 -2
- package/dist/{chunk-U46KE6JZ.js → chunk-AXWJJ2LC.js} +16 -4
- package/dist/{chunk-X7SQTCIQ.js → chunk-EKZXU6MU.js} +24 -2
- package/dist/{chunk-TO3VKAG2.js → chunk-FWHJN3QG.js} +2 -2
- package/dist/{chunk-EMWF2575.js → chunk-M3IE3VNC.js} +1 -1
- package/dist/{chunk-2PHYFVTY.js → chunk-OYWZGDTS.js} +1 -1
- package/dist/{chunk-L7U7QZYH.js → chunk-RBAU2M4S.js} +1 -1
- package/dist/{chunk-IOI6QR3B.js → chunk-VYJD6XYF.js} +1 -1
- package/dist/{chunk-2KEYWZY5.js → chunk-WURLFN72.js} +11 -21
- package/dist/cli/index.js +6 -6
- package/dist/cli.cjs +41 -23
- package/dist/cli.js +6 -6
- package/dist/engine-harness.cjs +41 -23
- package/dist/engine-harness.js +5 -5
- package/dist/index.cjs +41 -23
- package/dist/index.js +6 -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 +16 -4
- package/dist/spec/checkpoint.js +1 -1
- package/dist/spec/index.cjs +16 -4
- package/dist/spec/index.js +3 -3
- package/dist/spec/run-card.js +2 -2
- package/dist/spec/state.js +3 -3
- package/dist/state.js +3 -3
- package/package.json +1 -1
|
@@ -664,13 +664,25 @@ function createCheckpointResponseTemplate(packet, input = {}) {
|
|
|
664
664
|
created_at: input.created_at || timestamp()
|
|
665
665
|
});
|
|
666
666
|
}
|
|
667
|
+
function acceptedCheckpointResponseEntries(state) {
|
|
668
|
+
const history = state.checkpoint_history || [];
|
|
669
|
+
const events = state.events || [];
|
|
670
|
+
const acceptedResponseEvents = events.filter((event) => event.kind === "checkpoint.response.accepted");
|
|
671
|
+
const hasCheckpointResponseEvents = events.some((event) => nonEmptyString(event.kind)?.startsWith("checkpoint.response."));
|
|
672
|
+
return history.filter((entry) => {
|
|
673
|
+
if (!entry.response) return false;
|
|
674
|
+
if (!hasCheckpointResponseEvents) return true;
|
|
675
|
+
return acceptedResponseEvents.some((event) => event.ts === entry.ts && (!event.checkpoint || event.checkpoint === entry.response?.checkpoint));
|
|
676
|
+
});
|
|
677
|
+
}
|
|
667
678
|
function checkpointSummaryFromState(state, engineStatePath) {
|
|
668
679
|
const history = state.checkpoint_history || [];
|
|
680
|
+
const events = state.events || [];
|
|
669
681
|
const packets = history.filter((entry) => entry.packet);
|
|
670
|
-
const responses =
|
|
671
|
-
const duplicateResponses =
|
|
682
|
+
const responses = acceptedCheckpointResponseEntries(state);
|
|
683
|
+
const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
|
|
672
684
|
const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
|
|
673
|
-
const latestResponseEntry = [...
|
|
685
|
+
const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
|
|
674
686
|
const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
|
|
675
687
|
const latestResponse = latestResponseEntry?.response;
|
|
676
688
|
const latestResumeToken = latestPacket?.resume_token || null;
|
|
@@ -697,7 +709,7 @@ function checkpointSummaryFromState(state, engineStatePath) {
|
|
|
697
709
|
}
|
|
698
710
|
function isDuplicateCheckpointResponse(state, response) {
|
|
699
711
|
const identity = checkpointResponseIdentity(response);
|
|
700
|
-
return (state
|
|
712
|
+
return acceptedCheckpointResponseEntries(state).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
|
|
701
713
|
}
|
|
702
714
|
function checkpointResponseIdentity(response) {
|
|
703
715
|
const logicalResponse = compactRecord({
|
|
@@ -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,
|
|
@@ -28,10 +28,10 @@ import {
|
|
|
28
28
|
createDisabledRiddleProofAgentAdapter,
|
|
29
29
|
readRiddleProofRunStatus,
|
|
30
30
|
runRiddleProofEngineHarness
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-WURLFN72.js";
|
|
32
32
|
import {
|
|
33
33
|
createCheckpointResponseTemplate
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-AXWJJ2LC.js";
|
|
35
35
|
import {
|
|
36
36
|
createCodexExecAgentAdapter,
|
|
37
37
|
runCodexExecAgentDoctor
|
|
@@ -5,17 +5,19 @@ import {
|
|
|
5
5
|
createRunStatusSnapshot,
|
|
6
6
|
normalizeRunParams,
|
|
7
7
|
setRunStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-M3IE3VNC.js";
|
|
9
9
|
import {
|
|
10
10
|
createRiddleProofRunCard
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RBAU2M4S.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-AXWJJ2LC.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 (![
|
|
@@ -917,10 +911,6 @@ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
|
|
|
917
911
|
if (!response) return null;
|
|
918
912
|
if (isDuplicateCheckpointResponse(state, response)) return null;
|
|
919
913
|
const at = timestamp();
|
|
920
|
-
state.checkpoint_history = [
|
|
921
|
-
...state.checkpoint_history || [],
|
|
922
|
-
{ ts: at, response }
|
|
923
|
-
].slice(-25);
|
|
924
914
|
appendRunEvent(state, {
|
|
925
915
|
ts: at,
|
|
926
916
|
kind: "checkpoint.response.ignored",
|
|
@@ -1374,7 +1364,7 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
1374
1364
|
}
|
|
1375
1365
|
return { blocker };
|
|
1376
1366
|
}
|
|
1377
|
-
const payload = assessment.payload;
|
|
1367
|
+
const payload = normalizeProofAssessmentStageFields(assessment.payload);
|
|
1378
1368
|
recordEvent(state, {
|
|
1379
1369
|
kind: "agent.proof_assessment.completed",
|
|
1380
1370
|
checkpoint,
|
package/dist/cli/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-FWHJN3QG.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-WURLFN72.js";
|
|
6
|
+
import "../chunk-M3IE3VNC.js";
|
|
7
|
+
import "../chunk-RBAU2M4S.js";
|
|
8
|
+
import "../chunk-EKZXU6MU.js";
|
|
9
|
+
import "../chunk-AXWJJ2LC.js";
|
|
10
10
|
import "../chunk-JFQXAJH2.js";
|
|
11
11
|
import "../chunk-73EBR3YL.js";
|
|
12
12
|
import "../chunk-VY4Y5U57.js";
|
package/dist/cli.cjs
CHANGED
|
@@ -31,6 +31,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
));
|
|
32
32
|
|
|
33
33
|
// src/proof-run-core.ts
|
|
34
|
+
function canonicalProofAssessmentStageForDecision(decision) {
|
|
35
|
+
const normalized = typeof decision === "string" ? decision.trim() : "";
|
|
36
|
+
if (normalized === "ready_to_ship") return "ship";
|
|
37
|
+
if (normalized === "needs_richer_proof") return "author";
|
|
38
|
+
if (normalized === "revise_capture") return "verify";
|
|
39
|
+
if (normalized === "needs_recon") return "recon";
|
|
40
|
+
if (normalized === "needs_implementation") return "implement";
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function normalizeProofAssessmentStageFields(assessment) {
|
|
44
|
+
const canonicalStage = canonicalProofAssessmentStageForDecision(assessment.decision);
|
|
45
|
+
if (!canonicalStage) return assessment;
|
|
46
|
+
return {
|
|
47
|
+
...assessment,
|
|
48
|
+
recommended_stage: canonicalStage,
|
|
49
|
+
continue_with_stage: canonicalStage
|
|
50
|
+
};
|
|
51
|
+
}
|
|
34
52
|
function normalizedMode(value) {
|
|
35
53
|
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
36
54
|
}
|
|
@@ -866,10 +884,10 @@ function mergeStateFromParams(statePath, params) {
|
|
|
866
884
|
state.proof_assessment_source = null;
|
|
867
885
|
} else {
|
|
868
886
|
const parsed = JSON.parse(raw);
|
|
869
|
-
const assessment = {
|
|
887
|
+
const assessment = normalizeProofAssessmentStageFields({
|
|
870
888
|
...parsed,
|
|
871
889
|
source: (parsed?.source || "supervising_agent").toString()
|
|
872
|
-
};
|
|
890
|
+
});
|
|
873
891
|
const readyBlocker = assessment?.decision === "ready_to_ship" ? visualDeltaShipGateReason({ ...state, proof_assessment: assessment, proof_assessment_source: assessment.source }) : null;
|
|
874
892
|
if (readyBlocker) {
|
|
875
893
|
assessment.blocked_decision = assessment.decision;
|
|
@@ -4273,13 +4291,25 @@ function createCheckpointResponseTemplate(packet, input = {}) {
|
|
|
4273
4291
|
created_at: input.created_at || timestamp()
|
|
4274
4292
|
});
|
|
4275
4293
|
}
|
|
4294
|
+
function acceptedCheckpointResponseEntries(state) {
|
|
4295
|
+
const history = state.checkpoint_history || [];
|
|
4296
|
+
const events = state.events || [];
|
|
4297
|
+
const acceptedResponseEvents = events.filter((event) => event.kind === "checkpoint.response.accepted");
|
|
4298
|
+
const hasCheckpointResponseEvents = events.some((event) => nonEmptyString(event.kind)?.startsWith("checkpoint.response."));
|
|
4299
|
+
return history.filter((entry) => {
|
|
4300
|
+
if (!entry.response) return false;
|
|
4301
|
+
if (!hasCheckpointResponseEvents) return true;
|
|
4302
|
+
return acceptedResponseEvents.some((event) => event.ts === entry.ts && (!event.checkpoint || event.checkpoint === entry.response?.checkpoint));
|
|
4303
|
+
});
|
|
4304
|
+
}
|
|
4276
4305
|
function checkpointSummaryFromState(state, engineStatePath2) {
|
|
4277
4306
|
const history = state.checkpoint_history || [];
|
|
4307
|
+
const events = state.events || [];
|
|
4278
4308
|
const packets = history.filter((entry) => entry.packet);
|
|
4279
|
-
const responses =
|
|
4280
|
-
const duplicateResponses =
|
|
4309
|
+
const responses = acceptedCheckpointResponseEntries(state);
|
|
4310
|
+
const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
|
|
4281
4311
|
const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
|
|
4282
|
-
const latestResponseEntry = [...
|
|
4312
|
+
const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
|
|
4283
4313
|
const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
|
|
4284
4314
|
const latestResponse = latestResponseEntry?.response;
|
|
4285
4315
|
const latestResumeToken = latestPacket?.resume_token || null;
|
|
@@ -4306,7 +4336,7 @@ function checkpointSummaryFromState(state, engineStatePath2) {
|
|
|
4306
4336
|
}
|
|
4307
4337
|
function isDuplicateCheckpointResponse(state, response) {
|
|
4308
4338
|
const identity = checkpointResponseIdentity(response);
|
|
4309
|
-
return (state
|
|
4339
|
+
return acceptedCheckpointResponseEntries(state).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
|
|
4310
4340
|
}
|
|
4311
4341
|
function checkpointResponseIdentity(response) {
|
|
4312
4342
|
const logicalResponse = compactRecord({
|
|
@@ -5083,10 +5113,7 @@ function isReadyShipGate(result) {
|
|
|
5083
5113
|
return Boolean(gate && gate.ok === true);
|
|
5084
5114
|
}
|
|
5085
5115
|
function proofAssessmentRequestsShip(payload) {
|
|
5086
|
-
|
|
5087
|
-
const recommendedStage = String(payload.recommended_stage || "");
|
|
5088
|
-
const continueStage = String(payload.continue_with_stage || "");
|
|
5089
|
-
return decision === "ready_to_ship" || recommendedStage === "ship" || continueStage === "ship";
|
|
5116
|
+
return String(payload.decision || "").trim() === "ready_to_ship";
|
|
5090
5117
|
}
|
|
5091
5118
|
function proofAssessmentHardBlockers(state, payload) {
|
|
5092
5119
|
const blockers = proofAssessmentHardBlockersForState(state || {});
|
|
@@ -5104,12 +5131,7 @@ function proofAssessmentContinuation(result, payload) {
|
|
|
5104
5131
|
return { ...baseContinuation(result), proof_assessment_json };
|
|
5105
5132
|
}
|
|
5106
5133
|
function defaultStageForProofCheckpointDecision(decision) {
|
|
5107
|
-
|
|
5108
|
-
if (decision === "needs_implementation") return "implement";
|
|
5109
|
-
if (decision === "needs_recon") return "recon";
|
|
5110
|
-
if (decision === "revise_capture") return "verify";
|
|
5111
|
-
if (decision === "needs_richer_proof") return "author";
|
|
5112
|
-
return null;
|
|
5134
|
+
return canonicalProofAssessmentStageForDecision(decision);
|
|
5113
5135
|
}
|
|
5114
5136
|
function checkpointContractFromPacket(packet) {
|
|
5115
5137
|
return recordValue(packet.evidence_excerpt?.checkpoint_contract) || recordValue(recordValue(packet.state_excerpt?.stage_decision_request)?.checkpoint_contract) || null;
|
|
@@ -5135,7 +5157,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
|
5135
5157
|
}
|
|
5136
5158
|
const payload = recordValue(response.payload) || {};
|
|
5137
5159
|
const stage = nonEmptyString(payload.continue_with_stage) || response.continue_with_stage || nonEmptyString(payload.recommended_stage) || defaultStageForProofCheckpointDecision(response.decision);
|
|
5138
|
-
return compactRecord({
|
|
5160
|
+
return normalizeProofAssessmentStageFields(compactRecord({
|
|
5139
5161
|
...payload,
|
|
5140
5162
|
decision: response.decision,
|
|
5141
5163
|
summary: response.summary,
|
|
@@ -5146,7 +5168,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
|
5146
5168
|
source: "supervising_agent",
|
|
5147
5169
|
checkpoint_response_source: response.source || null,
|
|
5148
5170
|
checkpoint_response_created_at: response.created_at
|
|
5149
|
-
});
|
|
5171
|
+
}));
|
|
5150
5172
|
}
|
|
5151
5173
|
function reconAssessmentPayloadFromCheckpointResponse(response) {
|
|
5152
5174
|
if (![
|
|
@@ -5643,10 +5665,6 @@ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
|
|
|
5643
5665
|
if (!response) return null;
|
|
5644
5666
|
if (isDuplicateCheckpointResponse(state, response)) return null;
|
|
5645
5667
|
const at = timestamp3();
|
|
5646
|
-
state.checkpoint_history = [
|
|
5647
|
-
...state.checkpoint_history || [],
|
|
5648
|
-
{ ts: at, response }
|
|
5649
|
-
].slice(-25);
|
|
5650
5668
|
appendRunEvent(state, {
|
|
5651
5669
|
ts: at,
|
|
5652
5670
|
kind: "checkpoint.response.ignored",
|
|
@@ -6100,7 +6118,7 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
6100
6118
|
}
|
|
6101
6119
|
return { blocker };
|
|
6102
6120
|
}
|
|
6103
|
-
const payload = assessment.payload;
|
|
6121
|
+
const payload = normalizeProofAssessmentStageFields(assessment.payload);
|
|
6104
6122
|
recordEvent(state, {
|
|
6105
6123
|
kind: "agent.proof_assessment.completed",
|
|
6106
6124
|
checkpoint,
|
package/dist/cli.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-FWHJN3QG.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-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
6
|
+
import "./chunk-WURLFN72.js";
|
|
7
|
+
import "./chunk-M3IE3VNC.js";
|
|
8
|
+
import "./chunk-RBAU2M4S.js";
|
|
9
|
+
import "./chunk-EKZXU6MU.js";
|
|
10
|
+
import "./chunk-AXWJJ2LC.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
|
@@ -31,6 +31,24 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
33
|
// src/proof-run-core.ts
|
|
34
|
+
function canonicalProofAssessmentStageForDecision(decision) {
|
|
35
|
+
const normalized = typeof decision === "string" ? decision.trim() : "";
|
|
36
|
+
if (normalized === "ready_to_ship") return "ship";
|
|
37
|
+
if (normalized === "needs_richer_proof") return "author";
|
|
38
|
+
if (normalized === "revise_capture") return "verify";
|
|
39
|
+
if (normalized === "needs_recon") return "recon";
|
|
40
|
+
if (normalized === "needs_implementation") return "implement";
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
function normalizeProofAssessmentStageFields(assessment) {
|
|
44
|
+
const canonicalStage = canonicalProofAssessmentStageForDecision(assessment.decision);
|
|
45
|
+
if (!canonicalStage) return assessment;
|
|
46
|
+
return {
|
|
47
|
+
...assessment,
|
|
48
|
+
recommended_stage: canonicalStage,
|
|
49
|
+
continue_with_stage: canonicalStage
|
|
50
|
+
};
|
|
51
|
+
}
|
|
34
52
|
function normalizedMode(value) {
|
|
35
53
|
return typeof value === "string" ? value.trim().toLowerCase() : "";
|
|
36
54
|
}
|
|
@@ -866,10 +884,10 @@ function mergeStateFromParams(statePath, params) {
|
|
|
866
884
|
state.proof_assessment_source = null;
|
|
867
885
|
} else {
|
|
868
886
|
const parsed = JSON.parse(raw);
|
|
869
|
-
const assessment = {
|
|
887
|
+
const assessment = normalizeProofAssessmentStageFields({
|
|
870
888
|
...parsed,
|
|
871
889
|
source: (parsed?.source || "supervising_agent").toString()
|
|
872
|
-
};
|
|
890
|
+
});
|
|
873
891
|
const readyBlocker = assessment?.decision === "ready_to_ship" ? visualDeltaShipGateReason({ ...state, proof_assessment: assessment, proof_assessment_source: assessment.source }) : null;
|
|
874
892
|
if (readyBlocker) {
|
|
875
893
|
assessment.blocked_decision = assessment.decision;
|
|
@@ -4186,13 +4204,25 @@ function normalizeCheckpointResponse(value) {
|
|
|
4186
4204
|
created_at: nonEmptyString(record.created_at) || timestamp()
|
|
4187
4205
|
});
|
|
4188
4206
|
}
|
|
4207
|
+
function acceptedCheckpointResponseEntries(state) {
|
|
4208
|
+
const history = state.checkpoint_history || [];
|
|
4209
|
+
const events = state.events || [];
|
|
4210
|
+
const acceptedResponseEvents = events.filter((event) => event.kind === "checkpoint.response.accepted");
|
|
4211
|
+
const hasCheckpointResponseEvents = events.some((event) => nonEmptyString(event.kind)?.startsWith("checkpoint.response."));
|
|
4212
|
+
return history.filter((entry) => {
|
|
4213
|
+
if (!entry.response) return false;
|
|
4214
|
+
if (!hasCheckpointResponseEvents) return true;
|
|
4215
|
+
return acceptedResponseEvents.some((event) => event.ts === entry.ts && (!event.checkpoint || event.checkpoint === entry.response?.checkpoint));
|
|
4216
|
+
});
|
|
4217
|
+
}
|
|
4189
4218
|
function checkpointSummaryFromState(state, engineStatePath2) {
|
|
4190
4219
|
const history = state.checkpoint_history || [];
|
|
4220
|
+
const events = state.events || [];
|
|
4191
4221
|
const packets = history.filter((entry) => entry.packet);
|
|
4192
|
-
const responses =
|
|
4193
|
-
const duplicateResponses =
|
|
4222
|
+
const responses = acceptedCheckpointResponseEntries(state);
|
|
4223
|
+
const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
|
|
4194
4224
|
const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
|
|
4195
|
-
const latestResponseEntry = [...
|
|
4225
|
+
const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
|
|
4196
4226
|
const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
|
|
4197
4227
|
const latestResponse = latestResponseEntry?.response;
|
|
4198
4228
|
const latestResumeToken = latestPacket?.resume_token || null;
|
|
@@ -4219,7 +4249,7 @@ function checkpointSummaryFromState(state, engineStatePath2) {
|
|
|
4219
4249
|
}
|
|
4220
4250
|
function isDuplicateCheckpointResponse(state, response) {
|
|
4221
4251
|
const identity = checkpointResponseIdentity(response);
|
|
4222
|
-
return (state
|
|
4252
|
+
return acceptedCheckpointResponseEntries(state).some((entry) => entry.response ? checkpointResponseIdentity(entry.response) === identity : false);
|
|
4223
4253
|
}
|
|
4224
4254
|
function checkpointResponseIdentity(response) {
|
|
4225
4255
|
const logicalResponse = compactRecord({
|
|
@@ -4996,10 +5026,7 @@ function isReadyShipGate(result) {
|
|
|
4996
5026
|
return Boolean(gate && gate.ok === true);
|
|
4997
5027
|
}
|
|
4998
5028
|
function proofAssessmentRequestsShip(payload) {
|
|
4999
|
-
|
|
5000
|
-
const recommendedStage = String(payload.recommended_stage || "");
|
|
5001
|
-
const continueStage = String(payload.continue_with_stage || "");
|
|
5002
|
-
return decision === "ready_to_ship" || recommendedStage === "ship" || continueStage === "ship";
|
|
5029
|
+
return String(payload.decision || "").trim() === "ready_to_ship";
|
|
5003
5030
|
}
|
|
5004
5031
|
function proofAssessmentHardBlockers(state, payload) {
|
|
5005
5032
|
const blockers = proofAssessmentHardBlockersForState(state || {});
|
|
@@ -5017,12 +5044,7 @@ function proofAssessmentContinuation(result, payload) {
|
|
|
5017
5044
|
return { ...baseContinuation(result), proof_assessment_json };
|
|
5018
5045
|
}
|
|
5019
5046
|
function defaultStageForProofCheckpointDecision(decision) {
|
|
5020
|
-
|
|
5021
|
-
if (decision === "needs_implementation") return "implement";
|
|
5022
|
-
if (decision === "needs_recon") return "recon";
|
|
5023
|
-
if (decision === "revise_capture") return "verify";
|
|
5024
|
-
if (decision === "needs_richer_proof") return "author";
|
|
5025
|
-
return null;
|
|
5047
|
+
return canonicalProofAssessmentStageForDecision(decision);
|
|
5026
5048
|
}
|
|
5027
5049
|
function checkpointContractFromPacket(packet) {
|
|
5028
5050
|
return recordValue(packet.evidence_excerpt?.checkpoint_contract) || recordValue(recordValue(packet.state_excerpt?.stage_decision_request)?.checkpoint_contract) || null;
|
|
@@ -5048,7 +5070,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
|
5048
5070
|
}
|
|
5049
5071
|
const payload = recordValue(response.payload) || {};
|
|
5050
5072
|
const stage = nonEmptyString(payload.continue_with_stage) || response.continue_with_stage || nonEmptyString(payload.recommended_stage) || defaultStageForProofCheckpointDecision(response.decision);
|
|
5051
|
-
return compactRecord({
|
|
5073
|
+
return normalizeProofAssessmentStageFields(compactRecord({
|
|
5052
5074
|
...payload,
|
|
5053
5075
|
decision: response.decision,
|
|
5054
5076
|
summary: response.summary,
|
|
@@ -5059,7 +5081,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
|
5059
5081
|
source: "supervising_agent",
|
|
5060
5082
|
checkpoint_response_source: response.source || null,
|
|
5061
5083
|
checkpoint_response_created_at: response.created_at
|
|
5062
|
-
});
|
|
5084
|
+
}));
|
|
5063
5085
|
}
|
|
5064
5086
|
function reconAssessmentPayloadFromCheckpointResponse(response) {
|
|
5065
5087
|
if (![
|
|
@@ -5556,10 +5578,6 @@ function finalizedCheckpointResponseWithoutPacketResult(state, value) {
|
|
|
5556
5578
|
if (!response) return null;
|
|
5557
5579
|
if (isDuplicateCheckpointResponse(state, response)) return null;
|
|
5558
5580
|
const at = timestamp3();
|
|
5559
|
-
state.checkpoint_history = [
|
|
5560
|
-
...state.checkpoint_history || [],
|
|
5561
|
-
{ ts: at, response }
|
|
5562
|
-
].slice(-25);
|
|
5563
5581
|
appendRunEvent(state, {
|
|
5564
5582
|
ts: at,
|
|
5565
5583
|
kind: "checkpoint.response.ignored",
|
|
@@ -6013,7 +6031,7 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
6013
6031
|
}
|
|
6014
6032
|
return { blocker };
|
|
6015
6033
|
}
|
|
6016
|
-
const payload = assessment.payload;
|
|
6034
|
+
const payload = normalizeProofAssessmentStageFields(assessment.payload);
|
|
6017
6035
|
recordEvent(state, {
|
|
6018
6036
|
kind: "agent.proof_assessment.completed",
|
|
6019
6037
|
checkpoint,
|
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-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-WURLFN72.js";
|
|
6
|
+
import "./chunk-M3IE3VNC.js";
|
|
7
|
+
import "./chunk-RBAU2M4S.js";
|
|
8
|
+
import "./chunk-EKZXU6MU.js";
|
|
9
|
+
import "./chunk-AXWJJ2LC.js";
|
|
10
10
|
import "./chunk-VY4Y5U57.js";
|
|
11
11
|
import "./chunk-MLKGABMK.js";
|
|
12
12
|
export {
|