@riddledc/riddle-proof 0.8.54 → 0.8.56
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/codex-exec-agent.js +2 -2
- package/dist/adapters/codex.js +2 -2
- package/dist/adapters/local-agent.js +2 -2
- package/dist/adapters/openclaw.js +5 -5
- package/dist/advanced/engine-harness.cjs +129 -22
- package/dist/advanced/engine-harness.js +5 -5
- package/dist/advanced/index.cjs +130 -23
- package/dist/advanced/index.d.cts +1 -1
- package/dist/advanced/index.d.ts +1 -1
- package/dist/advanced/index.js +6 -6
- package/dist/advanced/proof-run-engine.d.cts +1 -1
- package/dist/advanced/proof-run-engine.d.ts +1 -1
- package/dist/advanced/runner.cjs +59 -1
- package/dist/advanced/runner.js +5 -5
- package/dist/checkpoint.cjs +4 -0
- package/dist/checkpoint.js +2 -2
- package/dist/{chunk-ECLGGGAI.js → chunk-54DIEDR3.js} +3 -3
- package/dist/{chunk-VY4Y5U57.js → chunk-CUBYSWZT.js} +57 -0
- package/dist/{chunk-IV4DVWPR.js → chunk-GHBNDHG7.js} +67 -25
- package/dist/{chunk-S5DX7Z6X.js → chunk-JLOZTVXU.js} +3 -3
- package/dist/{chunk-JJ4IWRMJ.js → chunk-KNPCWWF3.js} +8 -3
- package/dist/{chunk-BLM5EIBA.js → chunk-MOTQNIZX.js} +5 -1
- package/dist/{chunk-73EBR3YL.js → chunk-RS4HJLJQ.js} +1 -1
- package/dist/{chunk-LNWJAHAQ.js → chunk-TTB3ZAVX.js} +2 -2
- package/dist/{chunk-WDIKPIMB.js → chunk-UZIX7M7D.js} +11 -4
- package/dist/cli/index.js +7 -7
- package/dist/cli.cjs +129 -22
- package/dist/cli.js +7 -7
- package/dist/codex-exec-agent.js +2 -2
- package/dist/engine-harness.cjs +129 -22
- package/dist/engine-harness.js +5 -5
- package/dist/index.cjs +136 -23
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +14 -8
- package/dist/local-agent.js +2 -2
- package/dist/openclaw.js +5 -5
- package/dist/{proof-run-engine-MiKZt9oY.d.ts → proof-run-engine-BqRoA3Do.d.ts} +3 -3
- package/dist/{proof-run-engine-Baiv6l3A.d.cts → proof-run-engine-DpChFR5H.d.cts} +3 -3
- package/dist/proof-run-engine.d.cts +1 -1
- package/dist/proof-run-engine.d.ts +1 -1
- package/dist/result.cjs +62 -2
- package/dist/result.d.cts +17 -2
- package/dist/result.d.ts +17 -2
- package/dist/result.js +9 -3
- package/dist/run-card.cjs +43 -0
- package/dist/run-card.js +3 -3
- package/dist/runner.cjs +59 -1
- package/dist/runner.js +5 -5
- package/dist/spec/checkpoint.cjs +4 -0
- package/dist/spec/checkpoint.js +2 -2
- package/dist/spec/index.cjs +74 -1
- package/dist/spec/index.d.cts +1 -1
- package/dist/spec/index.d.ts +1 -1
- package/dist/spec/index.js +11 -5
- package/dist/spec/result.cjs +62 -2
- package/dist/spec/result.d.cts +1 -1
- package/dist/spec/result.d.ts +1 -1
- package/dist/spec/result.js +9 -3
- package/dist/spec/run-card.cjs +43 -0
- package/dist/spec/run-card.js +3 -3
- package/dist/spec/state.cjs +52 -1
- package/dist/spec/state.js +4 -4
- package/dist/state.cjs +52 -1
- package/dist/state.js +4 -4
- package/dist/types.d.cts +17 -0
- package/dist/types.d.ts +17 -0
- package/package.json +1 -1
package/dist/spec/index.cjs
CHANGED
|
@@ -37,6 +37,7 @@ __export(spec_exports, {
|
|
|
37
37
|
appendRunEvent: () => appendRunEvent,
|
|
38
38
|
appendStageHeartbeat: () => appendStageHeartbeat,
|
|
39
39
|
applyPrLifecycleState: () => applyPrLifecycleState,
|
|
40
|
+
applyShipControlState: () => applyShipControlState,
|
|
40
41
|
applyTerminalMetadata: () => applyTerminalMetadata,
|
|
41
42
|
authorPacketPayloadFromCheckpointResponse: () => authorPacketPayloadFromCheckpointResponse,
|
|
42
43
|
buildAuthorCheckpointPacket: () => buildAuthorCheckpointPacket,
|
|
@@ -53,6 +54,7 @@ __export(spec_exports, {
|
|
|
53
54
|
createRunState: () => createRunState,
|
|
54
55
|
createRunStatusSnapshot: () => createRunStatusSnapshot,
|
|
55
56
|
isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
|
|
57
|
+
isProtectedFinalStatus: () => isProtectedFinalStatus,
|
|
56
58
|
isSuccessfulStatus: () => isSuccessfulStatus,
|
|
57
59
|
isTerminalStatus: () => isTerminalStatus,
|
|
58
60
|
nonEmptyString: () => nonEmptyString,
|
|
@@ -64,6 +66,7 @@ __export(spec_exports, {
|
|
|
64
66
|
proofContractFromAuthorCheckpointResponse: () => proofContractFromAuthorCheckpointResponse,
|
|
65
67
|
recordValue: () => recordValue,
|
|
66
68
|
setRunStatus: () => setRunStatus,
|
|
69
|
+
shipControlStateFor: () => shipControlStateFor,
|
|
67
70
|
statePathsForRunState: () => statePathsForRunState
|
|
68
71
|
});
|
|
69
72
|
module.exports = __toCommonJS(spec_exports);
|
|
@@ -72,6 +75,9 @@ module.exports = __toCommonJS(spec_exports);
|
|
|
72
75
|
function isTerminalStatus(status) {
|
|
73
76
|
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
74
77
|
}
|
|
78
|
+
function isProtectedFinalStatus(status) {
|
|
79
|
+
return status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
80
|
+
}
|
|
75
81
|
function isSuccessfulStatus(status) {
|
|
76
82
|
return status !== "blocked" && status !== "failed";
|
|
77
83
|
}
|
|
@@ -169,6 +175,9 @@ function normalizeTerminalMetadata(input) {
|
|
|
169
175
|
pr_state: prState,
|
|
170
176
|
marked_ready: markedReady,
|
|
171
177
|
left_draft: leftDraft,
|
|
178
|
+
ship_held: firstBoolean(riddleState.ship_held, result.ship_held, result.shipHeld, details.ship_held, details.shipHeld, shipReport.ship_held, shipReport.shipHeld),
|
|
179
|
+
shipping_disabled: firstBoolean(riddleState.shipping_disabled, result.shipping_disabled, result.shippingDisabled, details.shipping_disabled, details.shippingDisabled, shipReport.shipping_disabled, shipReport.shippingDisabled),
|
|
180
|
+
ship_authorized: firstBoolean(riddleState.ship_authorized, result.ship_authorized, result.shipAuthorized, details.ship_authorized, details.shipAuthorized, shipReport.ship_authorized, shipReport.shipAuthorized),
|
|
172
181
|
ci_status: firstNonEmptyString(riddleState.ci_status, result.ci_status, result.ciStatus, details.ci_status, details.ciStatus, shipReport.ci_status),
|
|
173
182
|
ship_commit: firstNonEmptyString(riddleState.ship_commit, result.ship_commit, result.shipCommit, details.ship_commit, details.shipCommit, shipReport.shipped_commit, shipReport.ship_commit),
|
|
174
183
|
ship_remote_head: firstNonEmptyString(riddleState.ship_remote_head, result.ship_remote_head, result.shipRemoteHead, details.ship_remote_head, details.shipRemoteHead, shipReport.ship_remote_head),
|
|
@@ -202,6 +211,9 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
202
211
|
if (prBranch) state.pr_branch = prBranch;
|
|
203
212
|
if (typeof metadata.marked_ready === "boolean") state.marked_ready = metadata.marked_ready;
|
|
204
213
|
if (typeof metadata.left_draft === "boolean") state.left_draft = metadata.left_draft;
|
|
214
|
+
if (typeof metadata.ship_held === "boolean") state.ship_held = metadata.ship_held;
|
|
215
|
+
if (typeof metadata.shipping_disabled === "boolean") state.shipping_disabled = metadata.shipping_disabled;
|
|
216
|
+
if (typeof metadata.ship_authorized === "boolean") state.ship_authorized = metadata.ship_authorized;
|
|
205
217
|
const ciStatus = nonEmptyString(metadata.ci_status);
|
|
206
218
|
if (ciStatus) state.ci_status = ciStatus;
|
|
207
219
|
const shipCommit = nonEmptyString(metadata.ship_commit);
|
|
@@ -233,12 +245,54 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
233
245
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
234
246
|
return state;
|
|
235
247
|
}
|
|
248
|
+
function shipControlStateFor(input) {
|
|
249
|
+
const state = input.state;
|
|
250
|
+
const status = input.status || state.status;
|
|
251
|
+
const raw = recordValue(input.raw) || {};
|
|
252
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
253
|
+
const prState = recordValue(state.pr_state) || {};
|
|
254
|
+
const shippingDisabled = firstBoolean(
|
|
255
|
+
raw.shipping_disabled,
|
|
256
|
+
raw.shippingDisabled,
|
|
257
|
+
state.shipping_disabled,
|
|
258
|
+
shipReport.shipping_disabled,
|
|
259
|
+
shipReport.shippingDisabled
|
|
260
|
+
) ?? state.request?.ship_mode === "none";
|
|
261
|
+
const explicitAuthorized = firstBoolean(
|
|
262
|
+
raw.ship_authorized,
|
|
263
|
+
raw.shipAuthorized,
|
|
264
|
+
state.ship_authorized,
|
|
265
|
+
shipReport.ship_authorized,
|
|
266
|
+
shipReport.shipAuthorized
|
|
267
|
+
);
|
|
268
|
+
const authorizationEvidence = Boolean(
|
|
269
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
270
|
+
);
|
|
271
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
272
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
273
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
274
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
275
|
+
return {
|
|
276
|
+
ship_held: shipHeld,
|
|
277
|
+
shipping_disabled: shippingDisabled,
|
|
278
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
279
|
+
};
|
|
280
|
+
}
|
|
281
|
+
function applyShipControlState(state, input = {}) {
|
|
282
|
+
const control = shipControlStateFor({ state, status: input.status, raw: input.raw });
|
|
283
|
+
state.ship_held = control.ship_held;
|
|
284
|
+
state.shipping_disabled = control.shipping_disabled;
|
|
285
|
+
state.ship_authorized = control.ship_authorized;
|
|
286
|
+
return state;
|
|
287
|
+
}
|
|
236
288
|
function createRunResult(input) {
|
|
237
289
|
const status = input.status || input.state.status;
|
|
238
290
|
const ok = isSuccessfulStatus(status);
|
|
239
291
|
const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
|
|
240
292
|
state.status = status;
|
|
241
293
|
state.ok = ok;
|
|
294
|
+
if (isProtectedFinalStatus(status)) state.finalized = true;
|
|
295
|
+
applyShipControlState(state, { status, raw: input.raw });
|
|
242
296
|
return compactRecord({
|
|
243
297
|
ok,
|
|
244
298
|
status,
|
|
@@ -256,6 +310,9 @@ function createRunResult(input) {
|
|
|
256
310
|
pr_state: state.pr_state,
|
|
257
311
|
marked_ready: state.marked_ready,
|
|
258
312
|
left_draft: state.left_draft,
|
|
313
|
+
ship_held: state.ship_held,
|
|
314
|
+
shipping_disabled: state.shipping_disabled,
|
|
315
|
+
ship_authorized: state.ship_authorized,
|
|
259
316
|
ci_status: state.ci_status,
|
|
260
317
|
ship_commit: state.ship_commit,
|
|
261
318
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -982,6 +1039,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
|
|
|
982
1039
|
const packets = history.filter((entry) => entry.packet);
|
|
983
1040
|
const responses = acceptedCheckpointResponseEntries(state);
|
|
984
1041
|
const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
|
|
1042
|
+
const rejectedResponses = events.filter((event) => event.kind === "checkpoint.response.rejected");
|
|
1043
|
+
const ignoredResponses = events.filter((event) => event.kind === "checkpoint.response.ignored");
|
|
985
1044
|
const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
|
|
986
1045
|
const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
|
|
987
1046
|
const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
|
|
@@ -997,6 +1056,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
|
|
|
997
1056
|
packet_count: packets.length,
|
|
998
1057
|
response_count: responses.length,
|
|
999
1058
|
duplicate_response_count: duplicateResponses.length,
|
|
1059
|
+
rejected_response_count: rejectedResponses.length,
|
|
1060
|
+
ignored_response_count: ignoredResponses.length,
|
|
1000
1061
|
latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
|
|
1001
1062
|
latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
|
|
1002
1063
|
latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
|
|
@@ -1235,6 +1296,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
1235
1296
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
1236
1297
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
1237
1298
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
1299
|
+
const shipControl = shipControlStateFor({ state });
|
|
1238
1300
|
return {
|
|
1239
1301
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
1240
1302
|
run_id: state.run_id || "unknown",
|
|
@@ -1288,6 +1350,9 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
1288
1350
|
stop_condition: compactRecord({
|
|
1289
1351
|
status: state.status,
|
|
1290
1352
|
terminal: isTerminalStatus(state.status),
|
|
1353
|
+
ship_held: shipControl.ship_held,
|
|
1354
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
1355
|
+
ship_authorized: shipControl.ship_authorized,
|
|
1291
1356
|
blocker_code: state.blocker?.code || null,
|
|
1292
1357
|
blocker_message: state.blocker?.message || null,
|
|
1293
1358
|
proof_decision: state.proof_decision,
|
|
@@ -1478,7 +1543,8 @@ function appendStageHeartbeat(state, input) {
|
|
|
1478
1543
|
function createRunStatusSnapshot(state, at = timestamp2()) {
|
|
1479
1544
|
const latestEvent = state.events[state.events.length - 1];
|
|
1480
1545
|
const runId = state.run_id || "unknown";
|
|
1481
|
-
const
|
|
1546
|
+
const shipControl = shipControlStateFor({ state });
|
|
1547
|
+
const existingRunCardCurrent = state.run_card?.status === state.status && state.run_card.stop_condition?.status === state.status && state.run_card.stop_condition?.terminal === isTerminalStatus(state.status) && state.run_card.stop_condition?.monitor_should_continue === !isTerminalStatus(state.status) && state.run_card.stop_condition?.ship_held === shipControl.ship_held && state.run_card.stop_condition?.shipping_disabled === shipControl.shipping_disabled && state.run_card.stop_condition?.ship_authorized === shipControl.ship_authorized;
|
|
1482
1548
|
const runCard = existingRunCardCurrent ? state.run_card : createRiddleProofRunCard(state, { at });
|
|
1483
1549
|
return compactRecord({
|
|
1484
1550
|
run_id: runId,
|
|
@@ -1492,6 +1558,9 @@ function createRunStatusSnapshot(state, at = timestamp2()) {
|
|
|
1492
1558
|
pr_url: state.pr_url ?? null,
|
|
1493
1559
|
pr_branch: state.pr_branch ?? null,
|
|
1494
1560
|
pr_state: state.pr_state,
|
|
1561
|
+
ship_held: shipControl.ship_held,
|
|
1562
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
1563
|
+
ship_authorized: shipControl.ship_authorized,
|
|
1495
1564
|
ci_status: state.ci_status,
|
|
1496
1565
|
ship_commit: state.ship_commit,
|
|
1497
1566
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -1517,6 +1586,7 @@ function createRunStatusSnapshot(state, at = timestamp2()) {
|
|
|
1517
1586
|
function setRunStatus(state, status, at = timestamp2()) {
|
|
1518
1587
|
state.status = status;
|
|
1519
1588
|
state.ok = status !== "blocked" && status !== "failed";
|
|
1589
|
+
if (isProtectedFinalStatus(status)) state.finalized = true;
|
|
1520
1590
|
state.updated_at = at;
|
|
1521
1591
|
return state;
|
|
1522
1592
|
}
|
|
@@ -1546,6 +1616,7 @@ function applyPrLifecycleState(state, input, at = timestamp2()) {
|
|
|
1546
1616
|
appendRunEvent,
|
|
1547
1617
|
appendStageHeartbeat,
|
|
1548
1618
|
applyPrLifecycleState,
|
|
1619
|
+
applyShipControlState,
|
|
1549
1620
|
applyTerminalMetadata,
|
|
1550
1621
|
authorPacketPayloadFromCheckpointResponse,
|
|
1551
1622
|
buildAuthorCheckpointPacket,
|
|
@@ -1562,6 +1633,7 @@ function applyPrLifecycleState(state, input, at = timestamp2()) {
|
|
|
1562
1633
|
createRunState,
|
|
1563
1634
|
createRunStatusSnapshot,
|
|
1564
1635
|
isDuplicateCheckpointResponse,
|
|
1636
|
+
isProtectedFinalStatus,
|
|
1565
1637
|
isSuccessfulStatus,
|
|
1566
1638
|
isTerminalStatus,
|
|
1567
1639
|
nonEmptyString,
|
|
@@ -1573,5 +1645,6 @@ function applyPrLifecycleState(state, input, at = timestamp2()) {
|
|
|
1573
1645
|
proofContractFromAuthorCheckpointResponse,
|
|
1574
1646
|
recordValue,
|
|
1575
1647
|
setRunStatus,
|
|
1648
|
+
shipControlStateFor,
|
|
1576
1649
|
statePathsForRunState
|
|
1577
1650
|
});
|
package/dist/spec/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofViewportCapture, RiddleProofViewportMatrixStatus, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from '../types.cjs';
|
|
2
|
-
export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from '../result.cjs';
|
|
2
|
+
export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isProtectedFinalStatus, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.cjs';
|
|
3
3
|
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from '../state.cjs';
|
|
4
4
|
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointPacketIdentity, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from '../checkpoint.cjs';
|
|
5
5
|
export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from '../run-card.cjs';
|
package/dist/spec/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofViewportCapture, RiddleProofViewportMatrixStatus, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from '../types.js';
|
|
2
|
-
export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from '../result.js';
|
|
2
|
+
export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isProtectedFinalStatus, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.js';
|
|
3
3
|
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from '../state.js';
|
|
4
4
|
export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointPacketIdentity, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from '../checkpoint.js';
|
|
5
5
|
export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from '../run-card.js';
|
package/dist/spec/index.js
CHANGED
|
@@ -10,11 +10,11 @@ import {
|
|
|
10
10
|
normalizePrLifecycleState,
|
|
11
11
|
normalizeRunParams,
|
|
12
12
|
setRunStatus
|
|
13
|
-
} from "../chunk-
|
|
13
|
+
} from "../chunk-UZIX7M7D.js";
|
|
14
14
|
import {
|
|
15
15
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
16
16
|
createRiddleProofRunCard
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-KNPCWWF3.js";
|
|
18
18
|
import {
|
|
19
19
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
20
20
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
@@ -31,17 +31,20 @@ import {
|
|
|
31
31
|
normalizeCheckpointResponse,
|
|
32
32
|
proofContractFromAuthorCheckpointResponse,
|
|
33
33
|
statePathsForRunState
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-MOTQNIZX.js";
|
|
35
35
|
import {
|
|
36
|
+
applyShipControlState,
|
|
36
37
|
applyTerminalMetadata,
|
|
37
38
|
compactRecord,
|
|
38
39
|
createRunResult,
|
|
40
|
+
isProtectedFinalStatus,
|
|
39
41
|
isSuccessfulStatus,
|
|
40
42
|
isTerminalStatus,
|
|
41
43
|
nonEmptyString,
|
|
42
44
|
normalizeTerminalMetadata,
|
|
43
|
-
recordValue
|
|
44
|
-
|
|
45
|
+
recordValue,
|
|
46
|
+
shipControlStateFor
|
|
47
|
+
} from "../chunk-CUBYSWZT.js";
|
|
45
48
|
import "../chunk-MLKGABMK.js";
|
|
46
49
|
export {
|
|
47
50
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
@@ -51,6 +54,7 @@ export {
|
|
|
51
54
|
appendRunEvent,
|
|
52
55
|
appendStageHeartbeat,
|
|
53
56
|
applyPrLifecycleState,
|
|
57
|
+
applyShipControlState,
|
|
54
58
|
applyTerminalMetadata,
|
|
55
59
|
authorPacketPayloadFromCheckpointResponse,
|
|
56
60
|
buildAuthorCheckpointPacket,
|
|
@@ -67,6 +71,7 @@ export {
|
|
|
67
71
|
createRunState,
|
|
68
72
|
createRunStatusSnapshot,
|
|
69
73
|
isDuplicateCheckpointResponse,
|
|
74
|
+
isProtectedFinalStatus,
|
|
70
75
|
isSuccessfulStatus,
|
|
71
76
|
isTerminalStatus,
|
|
72
77
|
nonEmptyString,
|
|
@@ -78,5 +83,6 @@ export {
|
|
|
78
83
|
proofContractFromAuthorCheckpointResponse,
|
|
79
84
|
recordValue,
|
|
80
85
|
setRunStatus,
|
|
86
|
+
shipControlStateFor,
|
|
81
87
|
statePathsForRunState
|
|
82
88
|
};
|
package/dist/spec/result.cjs
CHANGED
|
@@ -20,14 +20,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/spec/result.ts
|
|
21
21
|
var result_exports = {};
|
|
22
22
|
__export(result_exports, {
|
|
23
|
+
applyShipControlState: () => applyShipControlState,
|
|
23
24
|
applyTerminalMetadata: () => applyTerminalMetadata,
|
|
24
25
|
compactRecord: () => compactRecord,
|
|
25
26
|
createRunResult: () => createRunResult,
|
|
27
|
+
isProtectedFinalStatus: () => isProtectedFinalStatus,
|
|
26
28
|
isSuccessfulStatus: () => isSuccessfulStatus,
|
|
27
29
|
isTerminalStatus: () => isTerminalStatus,
|
|
28
30
|
nonEmptyString: () => nonEmptyString,
|
|
29
31
|
normalizeTerminalMetadata: () => normalizeTerminalMetadata,
|
|
30
|
-
recordValue: () => recordValue
|
|
32
|
+
recordValue: () => recordValue,
|
|
33
|
+
shipControlStateFor: () => shipControlStateFor
|
|
31
34
|
});
|
|
32
35
|
module.exports = __toCommonJS(result_exports);
|
|
33
36
|
|
|
@@ -35,6 +38,9 @@ module.exports = __toCommonJS(result_exports);
|
|
|
35
38
|
function isTerminalStatus(status) {
|
|
36
39
|
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
37
40
|
}
|
|
41
|
+
function isProtectedFinalStatus(status) {
|
|
42
|
+
return status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
43
|
+
}
|
|
38
44
|
function isSuccessfulStatus(status) {
|
|
39
45
|
return status !== "blocked" && status !== "failed";
|
|
40
46
|
}
|
|
@@ -132,6 +138,9 @@ function normalizeTerminalMetadata(input) {
|
|
|
132
138
|
pr_state: prState,
|
|
133
139
|
marked_ready: markedReady,
|
|
134
140
|
left_draft: leftDraft,
|
|
141
|
+
ship_held: firstBoolean(riddleState.ship_held, result.ship_held, result.shipHeld, details.ship_held, details.shipHeld, shipReport.ship_held, shipReport.shipHeld),
|
|
142
|
+
shipping_disabled: firstBoolean(riddleState.shipping_disabled, result.shipping_disabled, result.shippingDisabled, details.shipping_disabled, details.shippingDisabled, shipReport.shipping_disabled, shipReport.shippingDisabled),
|
|
143
|
+
ship_authorized: firstBoolean(riddleState.ship_authorized, result.ship_authorized, result.shipAuthorized, details.ship_authorized, details.shipAuthorized, shipReport.ship_authorized, shipReport.shipAuthorized),
|
|
135
144
|
ci_status: firstNonEmptyString(riddleState.ci_status, result.ci_status, result.ciStatus, details.ci_status, details.ciStatus, shipReport.ci_status),
|
|
136
145
|
ship_commit: firstNonEmptyString(riddleState.ship_commit, result.ship_commit, result.shipCommit, details.ship_commit, details.shipCommit, shipReport.shipped_commit, shipReport.ship_commit),
|
|
137
146
|
ship_remote_head: firstNonEmptyString(riddleState.ship_remote_head, result.ship_remote_head, result.shipRemoteHead, details.ship_remote_head, details.shipRemoteHead, shipReport.ship_remote_head),
|
|
@@ -165,6 +174,9 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
165
174
|
if (prBranch) state.pr_branch = prBranch;
|
|
166
175
|
if (typeof metadata.marked_ready === "boolean") state.marked_ready = metadata.marked_ready;
|
|
167
176
|
if (typeof metadata.left_draft === "boolean") state.left_draft = metadata.left_draft;
|
|
177
|
+
if (typeof metadata.ship_held === "boolean") state.ship_held = metadata.ship_held;
|
|
178
|
+
if (typeof metadata.shipping_disabled === "boolean") state.shipping_disabled = metadata.shipping_disabled;
|
|
179
|
+
if (typeof metadata.ship_authorized === "boolean") state.ship_authorized = metadata.ship_authorized;
|
|
168
180
|
const ciStatus = nonEmptyString(metadata.ci_status);
|
|
169
181
|
if (ciStatus) state.ci_status = ciStatus;
|
|
170
182
|
const shipCommit = nonEmptyString(metadata.ship_commit);
|
|
@@ -196,12 +208,54 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
196
208
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
197
209
|
return state;
|
|
198
210
|
}
|
|
211
|
+
function shipControlStateFor(input) {
|
|
212
|
+
const state = input.state;
|
|
213
|
+
const status = input.status || state.status;
|
|
214
|
+
const raw = recordValue(input.raw) || {};
|
|
215
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
216
|
+
const prState = recordValue(state.pr_state) || {};
|
|
217
|
+
const shippingDisabled = firstBoolean(
|
|
218
|
+
raw.shipping_disabled,
|
|
219
|
+
raw.shippingDisabled,
|
|
220
|
+
state.shipping_disabled,
|
|
221
|
+
shipReport.shipping_disabled,
|
|
222
|
+
shipReport.shippingDisabled
|
|
223
|
+
) ?? state.request?.ship_mode === "none";
|
|
224
|
+
const explicitAuthorized = firstBoolean(
|
|
225
|
+
raw.ship_authorized,
|
|
226
|
+
raw.shipAuthorized,
|
|
227
|
+
state.ship_authorized,
|
|
228
|
+
shipReport.ship_authorized,
|
|
229
|
+
shipReport.shipAuthorized
|
|
230
|
+
);
|
|
231
|
+
const authorizationEvidence = Boolean(
|
|
232
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
233
|
+
);
|
|
234
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
235
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
236
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
237
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
238
|
+
return {
|
|
239
|
+
ship_held: shipHeld,
|
|
240
|
+
shipping_disabled: shippingDisabled,
|
|
241
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
function applyShipControlState(state, input = {}) {
|
|
245
|
+
const control = shipControlStateFor({ state, status: input.status, raw: input.raw });
|
|
246
|
+
state.ship_held = control.ship_held;
|
|
247
|
+
state.shipping_disabled = control.shipping_disabled;
|
|
248
|
+
state.ship_authorized = control.ship_authorized;
|
|
249
|
+
return state;
|
|
250
|
+
}
|
|
199
251
|
function createRunResult(input) {
|
|
200
252
|
const status = input.status || input.state.status;
|
|
201
253
|
const ok = isSuccessfulStatus(status);
|
|
202
254
|
const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
|
|
203
255
|
state.status = status;
|
|
204
256
|
state.ok = ok;
|
|
257
|
+
if (isProtectedFinalStatus(status)) state.finalized = true;
|
|
258
|
+
applyShipControlState(state, { status, raw: input.raw });
|
|
205
259
|
return compactRecord({
|
|
206
260
|
ok,
|
|
207
261
|
status,
|
|
@@ -219,6 +273,9 @@ function createRunResult(input) {
|
|
|
219
273
|
pr_state: state.pr_state,
|
|
220
274
|
marked_ready: state.marked_ready,
|
|
221
275
|
left_draft: state.left_draft,
|
|
276
|
+
ship_held: state.ship_held,
|
|
277
|
+
shipping_disabled: state.shipping_disabled,
|
|
278
|
+
ship_authorized: state.ship_authorized,
|
|
222
279
|
ci_status: state.ci_status,
|
|
223
280
|
ship_commit: state.ship_commit,
|
|
224
281
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -248,12 +305,15 @@ function createRunResult(input) {
|
|
|
248
305
|
}
|
|
249
306
|
// Annotate the CommonJS export names for ESM import in node:
|
|
250
307
|
0 && (module.exports = {
|
|
308
|
+
applyShipControlState,
|
|
251
309
|
applyTerminalMetadata,
|
|
252
310
|
compactRecord,
|
|
253
311
|
createRunResult,
|
|
312
|
+
isProtectedFinalStatus,
|
|
254
313
|
isSuccessfulStatus,
|
|
255
314
|
isTerminalStatus,
|
|
256
315
|
nonEmptyString,
|
|
257
316
|
normalizeTerminalMetadata,
|
|
258
|
-
recordValue
|
|
317
|
+
recordValue,
|
|
318
|
+
shipControlStateFor
|
|
259
319
|
});
|
package/dist/spec/result.d.cts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from '../result.cjs';
|
|
1
|
+
export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isProtectedFinalStatus, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.cjs';
|
|
2
2
|
import '../types.cjs';
|
package/dist/spec/result.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { TerminalMetadataInput, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue } from '../result.js';
|
|
1
|
+
export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isProtectedFinalStatus, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.js';
|
|
2
2
|
import '../types.js';
|
package/dist/spec/result.js
CHANGED
|
@@ -1,21 +1,27 @@
|
|
|
1
1
|
import {
|
|
2
|
+
applyShipControlState,
|
|
2
3
|
applyTerminalMetadata,
|
|
3
4
|
compactRecord,
|
|
4
5
|
createRunResult,
|
|
6
|
+
isProtectedFinalStatus,
|
|
5
7
|
isSuccessfulStatus,
|
|
6
8
|
isTerminalStatus,
|
|
7
9
|
nonEmptyString,
|
|
8
10
|
normalizeTerminalMetadata,
|
|
9
|
-
recordValue
|
|
10
|
-
|
|
11
|
+
recordValue,
|
|
12
|
+
shipControlStateFor
|
|
13
|
+
} from "../chunk-CUBYSWZT.js";
|
|
11
14
|
import "../chunk-MLKGABMK.js";
|
|
12
15
|
export {
|
|
16
|
+
applyShipControlState,
|
|
13
17
|
applyTerminalMetadata,
|
|
14
18
|
compactRecord,
|
|
15
19
|
createRunResult,
|
|
20
|
+
isProtectedFinalStatus,
|
|
16
21
|
isSuccessfulStatus,
|
|
17
22
|
isTerminalStatus,
|
|
18
23
|
nonEmptyString,
|
|
19
24
|
normalizeTerminalMetadata,
|
|
20
|
-
recordValue
|
|
25
|
+
recordValue,
|
|
26
|
+
shipControlStateFor
|
|
21
27
|
};
|
package/dist/spec/run-card.cjs
CHANGED
|
@@ -48,6 +48,45 @@ function nonEmptyString(value) {
|
|
|
48
48
|
function recordValue(value) {
|
|
49
49
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
50
50
|
}
|
|
51
|
+
function firstBoolean(...values) {
|
|
52
|
+
for (const value of values) {
|
|
53
|
+
if (typeof value === "boolean") return value;
|
|
54
|
+
}
|
|
55
|
+
return void 0;
|
|
56
|
+
}
|
|
57
|
+
function shipControlStateFor(input) {
|
|
58
|
+
const state = input.state;
|
|
59
|
+
const status = input.status || state.status;
|
|
60
|
+
const raw = recordValue(input.raw) || {};
|
|
61
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
62
|
+
const prState = recordValue(state.pr_state) || {};
|
|
63
|
+
const shippingDisabled = firstBoolean(
|
|
64
|
+
raw.shipping_disabled,
|
|
65
|
+
raw.shippingDisabled,
|
|
66
|
+
state.shipping_disabled,
|
|
67
|
+
shipReport.shipping_disabled,
|
|
68
|
+
shipReport.shippingDisabled
|
|
69
|
+
) ?? state.request?.ship_mode === "none";
|
|
70
|
+
const explicitAuthorized = firstBoolean(
|
|
71
|
+
raw.ship_authorized,
|
|
72
|
+
raw.shipAuthorized,
|
|
73
|
+
state.ship_authorized,
|
|
74
|
+
shipReport.ship_authorized,
|
|
75
|
+
shipReport.shipAuthorized
|
|
76
|
+
);
|
|
77
|
+
const authorizationEvidence = Boolean(
|
|
78
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
79
|
+
);
|
|
80
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
81
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
82
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
83
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
84
|
+
return {
|
|
85
|
+
ship_held: shipHeld,
|
|
86
|
+
shipping_disabled: shippingDisabled,
|
|
87
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
88
|
+
};
|
|
89
|
+
}
|
|
51
90
|
|
|
52
91
|
// src/checkpoint.ts
|
|
53
92
|
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
@@ -218,6 +257,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
218
257
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
219
258
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
220
259
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
260
|
+
const shipControl = shipControlStateFor({ state });
|
|
221
261
|
return {
|
|
222
262
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
223
263
|
run_id: state.run_id || "unknown",
|
|
@@ -271,6 +311,9 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
271
311
|
stop_condition: compactRecord({
|
|
272
312
|
status: state.status,
|
|
273
313
|
terminal: isTerminalStatus(state.status),
|
|
314
|
+
ship_held: shipControl.ship_held,
|
|
315
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
316
|
+
ship_authorized: shipControl.ship_authorized,
|
|
274
317
|
blocker_code: state.blocker?.code || null,
|
|
275
318
|
blocker_message: state.blocker?.message || null,
|
|
276
319
|
proof_decision: state.proof_decision,
|
package/dist/spec/run-card.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
3
3
|
createRiddleProofRunCard
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
4
|
+
} from "../chunk-KNPCWWF3.js";
|
|
5
|
+
import "../chunk-MOTQNIZX.js";
|
|
6
|
+
import "../chunk-CUBYSWZT.js";
|
|
7
7
|
import "../chunk-MLKGABMK.js";
|
|
8
8
|
export {
|
|
9
9
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
package/dist/spec/state.cjs
CHANGED
|
@@ -47,6 +47,9 @@ module.exports = __toCommonJS(state_exports);
|
|
|
47
47
|
function isTerminalStatus(status) {
|
|
48
48
|
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
49
49
|
}
|
|
50
|
+
function isProtectedFinalStatus(status) {
|
|
51
|
+
return status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
52
|
+
}
|
|
50
53
|
function compactRecord(input) {
|
|
51
54
|
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0 && value !== null && value !== ""));
|
|
52
55
|
}
|
|
@@ -56,6 +59,45 @@ function nonEmptyString(value) {
|
|
|
56
59
|
function recordValue(value) {
|
|
57
60
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
58
61
|
}
|
|
62
|
+
function firstBoolean(...values) {
|
|
63
|
+
for (const value of values) {
|
|
64
|
+
if (typeof value === "boolean") return value;
|
|
65
|
+
}
|
|
66
|
+
return void 0;
|
|
67
|
+
}
|
|
68
|
+
function shipControlStateFor(input) {
|
|
69
|
+
const state = input.state;
|
|
70
|
+
const status = input.status || state.status;
|
|
71
|
+
const raw = recordValue(input.raw) || {};
|
|
72
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
73
|
+
const prState = recordValue(state.pr_state) || {};
|
|
74
|
+
const shippingDisabled = firstBoolean(
|
|
75
|
+
raw.shipping_disabled,
|
|
76
|
+
raw.shippingDisabled,
|
|
77
|
+
state.shipping_disabled,
|
|
78
|
+
shipReport.shipping_disabled,
|
|
79
|
+
shipReport.shippingDisabled
|
|
80
|
+
) ?? state.request?.ship_mode === "none";
|
|
81
|
+
const explicitAuthorized = firstBoolean(
|
|
82
|
+
raw.ship_authorized,
|
|
83
|
+
raw.shipAuthorized,
|
|
84
|
+
state.ship_authorized,
|
|
85
|
+
shipReport.ship_authorized,
|
|
86
|
+
shipReport.shipAuthorized
|
|
87
|
+
);
|
|
88
|
+
const authorizationEvidence = Boolean(
|
|
89
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
90
|
+
);
|
|
91
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
92
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
93
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
94
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
95
|
+
return {
|
|
96
|
+
ship_held: shipHeld,
|
|
97
|
+
shipping_disabled: shippingDisabled,
|
|
98
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
99
|
+
};
|
|
100
|
+
}
|
|
59
101
|
|
|
60
102
|
// src/checkpoint.ts
|
|
61
103
|
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
@@ -226,6 +268,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
226
268
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
227
269
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
228
270
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
271
|
+
const shipControl = shipControlStateFor({ state });
|
|
229
272
|
return {
|
|
230
273
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
231
274
|
run_id: state.run_id || "unknown",
|
|
@@ -279,6 +322,9 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
279
322
|
stop_condition: compactRecord({
|
|
280
323
|
status: state.status,
|
|
281
324
|
terminal: isTerminalStatus(state.status),
|
|
325
|
+
ship_held: shipControl.ship_held,
|
|
326
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
327
|
+
ship_authorized: shipControl.ship_authorized,
|
|
282
328
|
blocker_code: state.blocker?.code || null,
|
|
283
329
|
blocker_message: state.blocker?.message || null,
|
|
284
330
|
proof_decision: state.proof_decision,
|
|
@@ -469,7 +515,8 @@ function appendStageHeartbeat(state, input) {
|
|
|
469
515
|
function createRunStatusSnapshot(state, at = timestamp()) {
|
|
470
516
|
const latestEvent = state.events[state.events.length - 1];
|
|
471
517
|
const runId = state.run_id || "unknown";
|
|
472
|
-
const
|
|
518
|
+
const shipControl = shipControlStateFor({ state });
|
|
519
|
+
const existingRunCardCurrent = state.run_card?.status === state.status && state.run_card.stop_condition?.status === state.status && state.run_card.stop_condition?.terminal === isTerminalStatus(state.status) && state.run_card.stop_condition?.monitor_should_continue === !isTerminalStatus(state.status) && state.run_card.stop_condition?.ship_held === shipControl.ship_held && state.run_card.stop_condition?.shipping_disabled === shipControl.shipping_disabled && state.run_card.stop_condition?.ship_authorized === shipControl.ship_authorized;
|
|
473
520
|
const runCard = existingRunCardCurrent ? state.run_card : createRiddleProofRunCard(state, { at });
|
|
474
521
|
return compactRecord({
|
|
475
522
|
run_id: runId,
|
|
@@ -483,6 +530,9 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
483
530
|
pr_url: state.pr_url ?? null,
|
|
484
531
|
pr_branch: state.pr_branch ?? null,
|
|
485
532
|
pr_state: state.pr_state,
|
|
533
|
+
ship_held: shipControl.ship_held,
|
|
534
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
535
|
+
ship_authorized: shipControl.ship_authorized,
|
|
486
536
|
ci_status: state.ci_status,
|
|
487
537
|
ship_commit: state.ship_commit,
|
|
488
538
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -508,6 +558,7 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
508
558
|
function setRunStatus(state, status, at = timestamp()) {
|
|
509
559
|
state.status = status;
|
|
510
560
|
state.ok = status !== "blocked" && status !== "failed";
|
|
561
|
+
if (isProtectedFinalStatus(status)) state.finalized = true;
|
|
511
562
|
state.updated_at = at;
|
|
512
563
|
return state;
|
|
513
564
|
}
|
package/dist/spec/state.js
CHANGED
|
@@ -9,10 +9,10 @@ import {
|
|
|
9
9
|
normalizePrLifecycleState,
|
|
10
10
|
normalizeRunParams,
|
|
11
11
|
setRunStatus
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
12
|
+
} from "../chunk-UZIX7M7D.js";
|
|
13
|
+
import "../chunk-KNPCWWF3.js";
|
|
14
|
+
import "../chunk-MOTQNIZX.js";
|
|
15
|
+
import "../chunk-CUBYSWZT.js";
|
|
16
16
|
import "../chunk-MLKGABMK.js";
|
|
17
17
|
export {
|
|
18
18
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|