@riddledc/riddle-proof 0.8.54 → 0.8.55
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 +65 -2
- package/dist/advanced/engine-harness.js +5 -5
- package/dist/advanced/index.cjs +66 -3
- package/dist/advanced/index.js +6 -6
- package/dist/advanced/runner.cjs +54 -1
- package/dist/advanced/runner.js +5 -5
- package/dist/checkpoint.js +2 -2
- package/dist/{chunk-S5DX7Z6X.js → chunk-F65S5LT2.js} +3 -3
- package/dist/{chunk-LNWJAHAQ.js → chunk-J2ZNL3H3.js} +2 -2
- package/dist/{chunk-ECLGGGAI.js → chunk-MYMTAVGP.js} +3 -3
- package/dist/{chunk-JJ4IWRMJ.js → chunk-NYRMPWJB.js} +8 -3
- package/dist/{chunk-WDIKPIMB.js → chunk-Q5GYD5RG.js} +9 -4
- package/dist/{chunk-IV4DVWPR.js → chunk-QGE3KBRL.js} +11 -5
- package/dist/{chunk-BLM5EIBA.js → chunk-QUK3SG24.js} +1 -1
- package/dist/{chunk-73EBR3YL.js → chunk-SONWF3FQ.js} +1 -1
- package/dist/{chunk-VY4Y5U57.js → chunk-W44XEGYW.js} +52 -0
- package/dist/cli/index.js +7 -7
- package/dist/cli.cjs +65 -2
- package/dist/cli.js +7 -7
- package/dist/codex-exec-agent.js +2 -2
- package/dist/engine-harness.cjs +65 -2
- package/dist/engine-harness.js +5 -5
- package/dist/index.cjs +70 -3
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -8
- package/dist/local-agent.js +2 -2
- package/dist/openclaw.js +5 -5
- package/dist/result.cjs +56 -2
- package/dist/result.d.cts +16 -2
- package/dist/result.d.ts +16 -2
- package/dist/result.js +7 -3
- package/dist/run-card.cjs +43 -0
- package/dist/run-card.js +3 -3
- package/dist/runner.cjs +54 -1
- package/dist/runner.js +5 -5
- package/dist/spec/checkpoint.js +2 -2
- package/dist/spec/index.cjs +63 -1
- package/dist/spec/index.d.cts +1 -1
- package/dist/spec/index.d.ts +1 -1
- package/dist/spec/index.js +9 -5
- package/dist/spec/result.cjs +56 -2
- package/dist/spec/result.d.cts +1 -1
- package/dist/spec/result.d.ts +1 -1
- package/dist/spec/result.js +7 -3
- package/dist/spec/run-card.cjs +43 -0
- package/dist/spec/run-card.js +3 -3
- package/dist/spec/state.cjs +48 -1
- package/dist/spec/state.js +4 -4
- package/dist/state.cjs +48 -1
- package/dist/state.js +4 -4
- package/dist/types.d.cts +15 -0
- package/dist/types.d.ts +15 -0
- package/package.json +1 -1
package/dist/runner.cjs
CHANGED
|
@@ -47,6 +47,12 @@ function nonEmptyString(value) {
|
|
|
47
47
|
function recordValue(value) {
|
|
48
48
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
49
49
|
}
|
|
50
|
+
function firstBoolean(...values) {
|
|
51
|
+
for (const value of values) {
|
|
52
|
+
if (typeof value === "boolean") return value;
|
|
53
|
+
}
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
50
56
|
function applyTerminalMetadata(state, metadata) {
|
|
51
57
|
if (metadata.pr_state) {
|
|
52
58
|
state.pr_state = metadata.pr_state;
|
|
@@ -63,6 +69,9 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
63
69
|
if (prBranch) state.pr_branch = prBranch;
|
|
64
70
|
if (typeof metadata.marked_ready === "boolean") state.marked_ready = metadata.marked_ready;
|
|
65
71
|
if (typeof metadata.left_draft === "boolean") state.left_draft = metadata.left_draft;
|
|
72
|
+
if (typeof metadata.ship_held === "boolean") state.ship_held = metadata.ship_held;
|
|
73
|
+
if (typeof metadata.shipping_disabled === "boolean") state.shipping_disabled = metadata.shipping_disabled;
|
|
74
|
+
if (typeof metadata.ship_authorized === "boolean") state.ship_authorized = metadata.ship_authorized;
|
|
66
75
|
const ciStatus = nonEmptyString(metadata.ci_status);
|
|
67
76
|
if (ciStatus) state.ci_status = ciStatus;
|
|
68
77
|
const shipCommit = nonEmptyString(metadata.ship_commit);
|
|
@@ -94,12 +103,53 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
94
103
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
95
104
|
return state;
|
|
96
105
|
}
|
|
106
|
+
function shipControlStateFor(input) {
|
|
107
|
+
const state = input.state;
|
|
108
|
+
const status = input.status || state.status;
|
|
109
|
+
const raw = recordValue(input.raw) || {};
|
|
110
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
111
|
+
const prState = recordValue(state.pr_state) || {};
|
|
112
|
+
const shippingDisabled = firstBoolean(
|
|
113
|
+
raw.shipping_disabled,
|
|
114
|
+
raw.shippingDisabled,
|
|
115
|
+
state.shipping_disabled,
|
|
116
|
+
shipReport.shipping_disabled,
|
|
117
|
+
shipReport.shippingDisabled
|
|
118
|
+
) ?? state.request?.ship_mode === "none";
|
|
119
|
+
const explicitAuthorized = firstBoolean(
|
|
120
|
+
raw.ship_authorized,
|
|
121
|
+
raw.shipAuthorized,
|
|
122
|
+
state.ship_authorized,
|
|
123
|
+
shipReport.ship_authorized,
|
|
124
|
+
shipReport.shipAuthorized
|
|
125
|
+
);
|
|
126
|
+
const authorizationEvidence = Boolean(
|
|
127
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
128
|
+
);
|
|
129
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
130
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
131
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
132
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
133
|
+
return {
|
|
134
|
+
ship_held: shipHeld,
|
|
135
|
+
shipping_disabled: shippingDisabled,
|
|
136
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function applyShipControlState(state, input = {}) {
|
|
140
|
+
const control = shipControlStateFor({ state, status: input.status, raw: input.raw });
|
|
141
|
+
state.ship_held = control.ship_held;
|
|
142
|
+
state.shipping_disabled = control.shipping_disabled;
|
|
143
|
+
state.ship_authorized = control.ship_authorized;
|
|
144
|
+
return state;
|
|
145
|
+
}
|
|
97
146
|
function createRunResult(input) {
|
|
98
147
|
const status = input.status || input.state.status;
|
|
99
148
|
const ok = isSuccessfulStatus(status);
|
|
100
149
|
const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
|
|
101
150
|
state.status = status;
|
|
102
151
|
state.ok = ok;
|
|
152
|
+
applyShipControlState(state, { status, raw: input.raw });
|
|
103
153
|
return compactRecord({
|
|
104
154
|
ok,
|
|
105
155
|
status,
|
|
@@ -117,6 +167,9 @@ function createRunResult(input) {
|
|
|
117
167
|
pr_state: state.pr_state,
|
|
118
168
|
marked_ready: state.marked_ready,
|
|
119
169
|
left_draft: state.left_draft,
|
|
170
|
+
ship_held: state.ship_held,
|
|
171
|
+
shipping_disabled: state.shipping_disabled,
|
|
172
|
+
ship_authorized: state.ship_authorized,
|
|
120
173
|
ci_status: state.ci_status,
|
|
121
174
|
ship_commit: state.ship_commit,
|
|
122
175
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -770,7 +823,7 @@ async function runRiddleProof(input) {
|
|
|
770
823
|
status: "ready_to_ship",
|
|
771
824
|
last_summary: assessment.summary,
|
|
772
825
|
evidence_bundle: evidenceBundle,
|
|
773
|
-
raw: { implementation, assessment }
|
|
826
|
+
raw: { implementation, assessment, ship_held: true, shipping_disabled: true, ship_authorized: false }
|
|
774
827
|
});
|
|
775
828
|
return notifyIfConfigured({ state, result: result2, notification: adapters.notification });
|
|
776
829
|
}
|
package/dist/runner.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runRiddleProof
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-F65S5LT2.js";
|
|
4
|
+
import "./chunk-Q5GYD5RG.js";
|
|
5
|
+
import "./chunk-NYRMPWJB.js";
|
|
6
6
|
import "./chunk-EKZXU6MU.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-QUK3SG24.js";
|
|
8
|
+
import "./chunk-W44XEGYW.js";
|
|
9
9
|
import "./chunk-MLKGABMK.js";
|
|
10
10
|
export {
|
|
11
11
|
runRiddleProof
|
package/dist/spec/checkpoint.js
CHANGED
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
normalizeCheckpointResponse,
|
|
15
15
|
proofContractFromAuthorCheckpointResponse,
|
|
16
16
|
statePathsForRunState
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import "../chunk-
|
|
17
|
+
} from "../chunk-QUK3SG24.js";
|
|
18
|
+
import "../chunk-W44XEGYW.js";
|
|
19
19
|
import "../chunk-MLKGABMK.js";
|
|
20
20
|
export {
|
|
21
21
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
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,
|
|
@@ -64,6 +65,7 @@ __export(spec_exports, {
|
|
|
64
65
|
proofContractFromAuthorCheckpointResponse: () => proofContractFromAuthorCheckpointResponse,
|
|
65
66
|
recordValue: () => recordValue,
|
|
66
67
|
setRunStatus: () => setRunStatus,
|
|
68
|
+
shipControlStateFor: () => shipControlStateFor,
|
|
67
69
|
statePathsForRunState: () => statePathsForRunState
|
|
68
70
|
});
|
|
69
71
|
module.exports = __toCommonJS(spec_exports);
|
|
@@ -169,6 +171,9 @@ function normalizeTerminalMetadata(input) {
|
|
|
169
171
|
pr_state: prState,
|
|
170
172
|
marked_ready: markedReady,
|
|
171
173
|
left_draft: leftDraft,
|
|
174
|
+
ship_held: firstBoolean(riddleState.ship_held, result.ship_held, result.shipHeld, details.ship_held, details.shipHeld, shipReport.ship_held, shipReport.shipHeld),
|
|
175
|
+
shipping_disabled: firstBoolean(riddleState.shipping_disabled, result.shipping_disabled, result.shippingDisabled, details.shipping_disabled, details.shippingDisabled, shipReport.shipping_disabled, shipReport.shippingDisabled),
|
|
176
|
+
ship_authorized: firstBoolean(riddleState.ship_authorized, result.ship_authorized, result.shipAuthorized, details.ship_authorized, details.shipAuthorized, shipReport.ship_authorized, shipReport.shipAuthorized),
|
|
172
177
|
ci_status: firstNonEmptyString(riddleState.ci_status, result.ci_status, result.ciStatus, details.ci_status, details.ciStatus, shipReport.ci_status),
|
|
173
178
|
ship_commit: firstNonEmptyString(riddleState.ship_commit, result.ship_commit, result.shipCommit, details.ship_commit, details.shipCommit, shipReport.shipped_commit, shipReport.ship_commit),
|
|
174
179
|
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 +207,9 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
202
207
|
if (prBranch) state.pr_branch = prBranch;
|
|
203
208
|
if (typeof metadata.marked_ready === "boolean") state.marked_ready = metadata.marked_ready;
|
|
204
209
|
if (typeof metadata.left_draft === "boolean") state.left_draft = metadata.left_draft;
|
|
210
|
+
if (typeof metadata.ship_held === "boolean") state.ship_held = metadata.ship_held;
|
|
211
|
+
if (typeof metadata.shipping_disabled === "boolean") state.shipping_disabled = metadata.shipping_disabled;
|
|
212
|
+
if (typeof metadata.ship_authorized === "boolean") state.ship_authorized = metadata.ship_authorized;
|
|
205
213
|
const ciStatus = nonEmptyString(metadata.ci_status);
|
|
206
214
|
if (ciStatus) state.ci_status = ciStatus;
|
|
207
215
|
const shipCommit = nonEmptyString(metadata.ship_commit);
|
|
@@ -233,12 +241,53 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
233
241
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
234
242
|
return state;
|
|
235
243
|
}
|
|
244
|
+
function shipControlStateFor(input) {
|
|
245
|
+
const state = input.state;
|
|
246
|
+
const status = input.status || state.status;
|
|
247
|
+
const raw = recordValue(input.raw) || {};
|
|
248
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
249
|
+
const prState = recordValue(state.pr_state) || {};
|
|
250
|
+
const shippingDisabled = firstBoolean(
|
|
251
|
+
raw.shipping_disabled,
|
|
252
|
+
raw.shippingDisabled,
|
|
253
|
+
state.shipping_disabled,
|
|
254
|
+
shipReport.shipping_disabled,
|
|
255
|
+
shipReport.shippingDisabled
|
|
256
|
+
) ?? state.request?.ship_mode === "none";
|
|
257
|
+
const explicitAuthorized = firstBoolean(
|
|
258
|
+
raw.ship_authorized,
|
|
259
|
+
raw.shipAuthorized,
|
|
260
|
+
state.ship_authorized,
|
|
261
|
+
shipReport.ship_authorized,
|
|
262
|
+
shipReport.shipAuthorized
|
|
263
|
+
);
|
|
264
|
+
const authorizationEvidence = Boolean(
|
|
265
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
266
|
+
);
|
|
267
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
268
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
269
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
270
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
271
|
+
return {
|
|
272
|
+
ship_held: shipHeld,
|
|
273
|
+
shipping_disabled: shippingDisabled,
|
|
274
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function applyShipControlState(state, input = {}) {
|
|
278
|
+
const control = shipControlStateFor({ state, status: input.status, raw: input.raw });
|
|
279
|
+
state.ship_held = control.ship_held;
|
|
280
|
+
state.shipping_disabled = control.shipping_disabled;
|
|
281
|
+
state.ship_authorized = control.ship_authorized;
|
|
282
|
+
return state;
|
|
283
|
+
}
|
|
236
284
|
function createRunResult(input) {
|
|
237
285
|
const status = input.status || input.state.status;
|
|
238
286
|
const ok = isSuccessfulStatus(status);
|
|
239
287
|
const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
|
|
240
288
|
state.status = status;
|
|
241
289
|
state.ok = ok;
|
|
290
|
+
applyShipControlState(state, { status, raw: input.raw });
|
|
242
291
|
return compactRecord({
|
|
243
292
|
ok,
|
|
244
293
|
status,
|
|
@@ -256,6 +305,9 @@ function createRunResult(input) {
|
|
|
256
305
|
pr_state: state.pr_state,
|
|
257
306
|
marked_ready: state.marked_ready,
|
|
258
307
|
left_draft: state.left_draft,
|
|
308
|
+
ship_held: state.ship_held,
|
|
309
|
+
shipping_disabled: state.shipping_disabled,
|
|
310
|
+
ship_authorized: state.ship_authorized,
|
|
259
311
|
ci_status: state.ci_status,
|
|
260
312
|
ship_commit: state.ship_commit,
|
|
261
313
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -1235,6 +1287,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
1235
1287
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
1236
1288
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
1237
1289
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
1290
|
+
const shipControl = shipControlStateFor({ state });
|
|
1238
1291
|
return {
|
|
1239
1292
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
1240
1293
|
run_id: state.run_id || "unknown",
|
|
@@ -1288,6 +1341,9 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
1288
1341
|
stop_condition: compactRecord({
|
|
1289
1342
|
status: state.status,
|
|
1290
1343
|
terminal: isTerminalStatus(state.status),
|
|
1344
|
+
ship_held: shipControl.ship_held,
|
|
1345
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
1346
|
+
ship_authorized: shipControl.ship_authorized,
|
|
1291
1347
|
blocker_code: state.blocker?.code || null,
|
|
1292
1348
|
blocker_message: state.blocker?.message || null,
|
|
1293
1349
|
proof_decision: state.proof_decision,
|
|
@@ -1478,7 +1534,8 @@ function appendStageHeartbeat(state, input) {
|
|
|
1478
1534
|
function createRunStatusSnapshot(state, at = timestamp2()) {
|
|
1479
1535
|
const latestEvent = state.events[state.events.length - 1];
|
|
1480
1536
|
const runId = state.run_id || "unknown";
|
|
1481
|
-
const
|
|
1537
|
+
const shipControl = shipControlStateFor({ state });
|
|
1538
|
+
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
1539
|
const runCard = existingRunCardCurrent ? state.run_card : createRiddleProofRunCard(state, { at });
|
|
1483
1540
|
return compactRecord({
|
|
1484
1541
|
run_id: runId,
|
|
@@ -1492,6 +1549,9 @@ function createRunStatusSnapshot(state, at = timestamp2()) {
|
|
|
1492
1549
|
pr_url: state.pr_url ?? null,
|
|
1493
1550
|
pr_branch: state.pr_branch ?? null,
|
|
1494
1551
|
pr_state: state.pr_state,
|
|
1552
|
+
ship_held: shipControl.ship_held,
|
|
1553
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
1554
|
+
ship_authorized: shipControl.ship_authorized,
|
|
1495
1555
|
ci_status: state.ci_status,
|
|
1496
1556
|
ship_commit: state.ship_commit,
|
|
1497
1557
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -1546,6 +1606,7 @@ function applyPrLifecycleState(state, input, at = timestamp2()) {
|
|
|
1546
1606
|
appendRunEvent,
|
|
1547
1607
|
appendStageHeartbeat,
|
|
1548
1608
|
applyPrLifecycleState,
|
|
1609
|
+
applyShipControlState,
|
|
1549
1610
|
applyTerminalMetadata,
|
|
1550
1611
|
authorPacketPayloadFromCheckpointResponse,
|
|
1551
1612
|
buildAuthorCheckpointPacket,
|
|
@@ -1573,5 +1634,6 @@ function applyPrLifecycleState(state, input, at = timestamp2()) {
|
|
|
1573
1634
|
proofContractFromAuthorCheckpointResponse,
|
|
1574
1635
|
recordValue,
|
|
1575
1636
|
setRunStatus,
|
|
1637
|
+
shipControlStateFor,
|
|
1576
1638
|
statePathsForRunState
|
|
1577
1639
|
});
|
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, 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, 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-Q5GYD5RG.js";
|
|
14
14
|
import {
|
|
15
15
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
16
16
|
createRiddleProofRunCard
|
|
17
|
-
} from "../chunk-
|
|
17
|
+
} from "../chunk-NYRMPWJB.js";
|
|
18
18
|
import {
|
|
19
19
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
20
20
|
RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
|
|
@@ -31,8 +31,9 @@ import {
|
|
|
31
31
|
normalizeCheckpointResponse,
|
|
32
32
|
proofContractFromAuthorCheckpointResponse,
|
|
33
33
|
statePathsForRunState
|
|
34
|
-
} from "../chunk-
|
|
34
|
+
} from "../chunk-QUK3SG24.js";
|
|
35
35
|
import {
|
|
36
|
+
applyShipControlState,
|
|
36
37
|
applyTerminalMetadata,
|
|
37
38
|
compactRecord,
|
|
38
39
|
createRunResult,
|
|
@@ -40,8 +41,9 @@ import {
|
|
|
40
41
|
isTerminalStatus,
|
|
41
42
|
nonEmptyString,
|
|
42
43
|
normalizeTerminalMetadata,
|
|
43
|
-
recordValue
|
|
44
|
-
|
|
44
|
+
recordValue,
|
|
45
|
+
shipControlStateFor
|
|
46
|
+
} from "../chunk-W44XEGYW.js";
|
|
45
47
|
import "../chunk-MLKGABMK.js";
|
|
46
48
|
export {
|
|
47
49
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
@@ -51,6 +53,7 @@ export {
|
|
|
51
53
|
appendRunEvent,
|
|
52
54
|
appendStageHeartbeat,
|
|
53
55
|
applyPrLifecycleState,
|
|
56
|
+
applyShipControlState,
|
|
54
57
|
applyTerminalMetadata,
|
|
55
58
|
authorPacketPayloadFromCheckpointResponse,
|
|
56
59
|
buildAuthorCheckpointPacket,
|
|
@@ -78,5 +81,6 @@ export {
|
|
|
78
81
|
proofContractFromAuthorCheckpointResponse,
|
|
79
82
|
recordValue,
|
|
80
83
|
setRunStatus,
|
|
84
|
+
shipControlStateFor,
|
|
81
85
|
statePathsForRunState
|
|
82
86
|
};
|
package/dist/spec/result.cjs
CHANGED
|
@@ -20,6 +20,7 @@ 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,7 +28,8 @@ __export(result_exports, {
|
|
|
27
28
|
isTerminalStatus: () => isTerminalStatus,
|
|
28
29
|
nonEmptyString: () => nonEmptyString,
|
|
29
30
|
normalizeTerminalMetadata: () => normalizeTerminalMetadata,
|
|
30
|
-
recordValue: () => recordValue
|
|
31
|
+
recordValue: () => recordValue,
|
|
32
|
+
shipControlStateFor: () => shipControlStateFor
|
|
31
33
|
});
|
|
32
34
|
module.exports = __toCommonJS(result_exports);
|
|
33
35
|
|
|
@@ -132,6 +134,9 @@ function normalizeTerminalMetadata(input) {
|
|
|
132
134
|
pr_state: prState,
|
|
133
135
|
marked_ready: markedReady,
|
|
134
136
|
left_draft: leftDraft,
|
|
137
|
+
ship_held: firstBoolean(riddleState.ship_held, result.ship_held, result.shipHeld, details.ship_held, details.shipHeld, shipReport.ship_held, shipReport.shipHeld),
|
|
138
|
+
shipping_disabled: firstBoolean(riddleState.shipping_disabled, result.shipping_disabled, result.shippingDisabled, details.shipping_disabled, details.shippingDisabled, shipReport.shipping_disabled, shipReport.shippingDisabled),
|
|
139
|
+
ship_authorized: firstBoolean(riddleState.ship_authorized, result.ship_authorized, result.shipAuthorized, details.ship_authorized, details.shipAuthorized, shipReport.ship_authorized, shipReport.shipAuthorized),
|
|
135
140
|
ci_status: firstNonEmptyString(riddleState.ci_status, result.ci_status, result.ciStatus, details.ci_status, details.ciStatus, shipReport.ci_status),
|
|
136
141
|
ship_commit: firstNonEmptyString(riddleState.ship_commit, result.ship_commit, result.shipCommit, details.ship_commit, details.shipCommit, shipReport.shipped_commit, shipReport.ship_commit),
|
|
137
142
|
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 +170,9 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
165
170
|
if (prBranch) state.pr_branch = prBranch;
|
|
166
171
|
if (typeof metadata.marked_ready === "boolean") state.marked_ready = metadata.marked_ready;
|
|
167
172
|
if (typeof metadata.left_draft === "boolean") state.left_draft = metadata.left_draft;
|
|
173
|
+
if (typeof metadata.ship_held === "boolean") state.ship_held = metadata.ship_held;
|
|
174
|
+
if (typeof metadata.shipping_disabled === "boolean") state.shipping_disabled = metadata.shipping_disabled;
|
|
175
|
+
if (typeof metadata.ship_authorized === "boolean") state.ship_authorized = metadata.ship_authorized;
|
|
168
176
|
const ciStatus = nonEmptyString(metadata.ci_status);
|
|
169
177
|
if (ciStatus) state.ci_status = ciStatus;
|
|
170
178
|
const shipCommit = nonEmptyString(metadata.ship_commit);
|
|
@@ -196,12 +204,53 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
196
204
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
197
205
|
return state;
|
|
198
206
|
}
|
|
207
|
+
function shipControlStateFor(input) {
|
|
208
|
+
const state = input.state;
|
|
209
|
+
const status = input.status || state.status;
|
|
210
|
+
const raw = recordValue(input.raw) || {};
|
|
211
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
212
|
+
const prState = recordValue(state.pr_state) || {};
|
|
213
|
+
const shippingDisabled = firstBoolean(
|
|
214
|
+
raw.shipping_disabled,
|
|
215
|
+
raw.shippingDisabled,
|
|
216
|
+
state.shipping_disabled,
|
|
217
|
+
shipReport.shipping_disabled,
|
|
218
|
+
shipReport.shippingDisabled
|
|
219
|
+
) ?? state.request?.ship_mode === "none";
|
|
220
|
+
const explicitAuthorized = firstBoolean(
|
|
221
|
+
raw.ship_authorized,
|
|
222
|
+
raw.shipAuthorized,
|
|
223
|
+
state.ship_authorized,
|
|
224
|
+
shipReport.ship_authorized,
|
|
225
|
+
shipReport.shipAuthorized
|
|
226
|
+
);
|
|
227
|
+
const authorizationEvidence = Boolean(
|
|
228
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
229
|
+
);
|
|
230
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
231
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
232
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
233
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
234
|
+
return {
|
|
235
|
+
ship_held: shipHeld,
|
|
236
|
+
shipping_disabled: shippingDisabled,
|
|
237
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
function applyShipControlState(state, input = {}) {
|
|
241
|
+
const control = shipControlStateFor({ state, status: input.status, raw: input.raw });
|
|
242
|
+
state.ship_held = control.ship_held;
|
|
243
|
+
state.shipping_disabled = control.shipping_disabled;
|
|
244
|
+
state.ship_authorized = control.ship_authorized;
|
|
245
|
+
return state;
|
|
246
|
+
}
|
|
199
247
|
function createRunResult(input) {
|
|
200
248
|
const status = input.status || input.state.status;
|
|
201
249
|
const ok = isSuccessfulStatus(status);
|
|
202
250
|
const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
|
|
203
251
|
state.status = status;
|
|
204
252
|
state.ok = ok;
|
|
253
|
+
applyShipControlState(state, { status, raw: input.raw });
|
|
205
254
|
return compactRecord({
|
|
206
255
|
ok,
|
|
207
256
|
status,
|
|
@@ -219,6 +268,9 @@ function createRunResult(input) {
|
|
|
219
268
|
pr_state: state.pr_state,
|
|
220
269
|
marked_ready: state.marked_ready,
|
|
221
270
|
left_draft: state.left_draft,
|
|
271
|
+
ship_held: state.ship_held,
|
|
272
|
+
shipping_disabled: state.shipping_disabled,
|
|
273
|
+
ship_authorized: state.ship_authorized,
|
|
222
274
|
ci_status: state.ci_status,
|
|
223
275
|
ship_commit: state.ship_commit,
|
|
224
276
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -248,6 +300,7 @@ function createRunResult(input) {
|
|
|
248
300
|
}
|
|
249
301
|
// Annotate the CommonJS export names for ESM import in node:
|
|
250
302
|
0 && (module.exports = {
|
|
303
|
+
applyShipControlState,
|
|
251
304
|
applyTerminalMetadata,
|
|
252
305
|
compactRecord,
|
|
253
306
|
createRunResult,
|
|
@@ -255,5 +308,6 @@ function createRunResult(input) {
|
|
|
255
308
|
isTerminalStatus,
|
|
256
309
|
nonEmptyString,
|
|
257
310
|
normalizeTerminalMetadata,
|
|
258
|
-
recordValue
|
|
311
|
+
recordValue,
|
|
312
|
+
shipControlStateFor
|
|
259
313
|
});
|
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, 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, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.js';
|
|
2
2
|
import '../types.js';
|
package/dist/spec/result.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
applyShipControlState,
|
|
2
3
|
applyTerminalMetadata,
|
|
3
4
|
compactRecord,
|
|
4
5
|
createRunResult,
|
|
@@ -6,10 +7,12 @@ import {
|
|
|
6
7
|
isTerminalStatus,
|
|
7
8
|
nonEmptyString,
|
|
8
9
|
normalizeTerminalMetadata,
|
|
9
|
-
recordValue
|
|
10
|
-
|
|
10
|
+
recordValue,
|
|
11
|
+
shipControlStateFor
|
|
12
|
+
} from "../chunk-W44XEGYW.js";
|
|
11
13
|
import "../chunk-MLKGABMK.js";
|
|
12
14
|
export {
|
|
15
|
+
applyShipControlState,
|
|
13
16
|
applyTerminalMetadata,
|
|
14
17
|
compactRecord,
|
|
15
18
|
createRunResult,
|
|
@@ -17,5 +20,6 @@ export {
|
|
|
17
20
|
isTerminalStatus,
|
|
18
21
|
nonEmptyString,
|
|
19
22
|
normalizeTerminalMetadata,
|
|
20
|
-
recordValue
|
|
23
|
+
recordValue,
|
|
24
|
+
shipControlStateFor
|
|
21
25
|
};
|
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-NYRMPWJB.js";
|
|
5
|
+
import "../chunk-QUK3SG24.js";
|
|
6
|
+
import "../chunk-W44XEGYW.js";
|
|
7
7
|
import "../chunk-MLKGABMK.js";
|
|
8
8
|
export {
|
|
9
9
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
package/dist/spec/state.cjs
CHANGED
|
@@ -56,6 +56,45 @@ function nonEmptyString(value) {
|
|
|
56
56
|
function recordValue(value) {
|
|
57
57
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
58
58
|
}
|
|
59
|
+
function firstBoolean(...values) {
|
|
60
|
+
for (const value of values) {
|
|
61
|
+
if (typeof value === "boolean") return value;
|
|
62
|
+
}
|
|
63
|
+
return void 0;
|
|
64
|
+
}
|
|
65
|
+
function shipControlStateFor(input) {
|
|
66
|
+
const state = input.state;
|
|
67
|
+
const status = input.status || state.status;
|
|
68
|
+
const raw = recordValue(input.raw) || {};
|
|
69
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
70
|
+
const prState = recordValue(state.pr_state) || {};
|
|
71
|
+
const shippingDisabled = firstBoolean(
|
|
72
|
+
raw.shipping_disabled,
|
|
73
|
+
raw.shippingDisabled,
|
|
74
|
+
state.shipping_disabled,
|
|
75
|
+
shipReport.shipping_disabled,
|
|
76
|
+
shipReport.shippingDisabled
|
|
77
|
+
) ?? state.request?.ship_mode === "none";
|
|
78
|
+
const explicitAuthorized = firstBoolean(
|
|
79
|
+
raw.ship_authorized,
|
|
80
|
+
raw.shipAuthorized,
|
|
81
|
+
state.ship_authorized,
|
|
82
|
+
shipReport.ship_authorized,
|
|
83
|
+
shipReport.shipAuthorized
|
|
84
|
+
);
|
|
85
|
+
const authorizationEvidence = Boolean(
|
|
86
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
87
|
+
);
|
|
88
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
89
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
90
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
91
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
92
|
+
return {
|
|
93
|
+
ship_held: shipHeld,
|
|
94
|
+
shipping_disabled: shippingDisabled,
|
|
95
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
96
|
+
};
|
|
97
|
+
}
|
|
59
98
|
|
|
60
99
|
// src/checkpoint.ts
|
|
61
100
|
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
@@ -226,6 +265,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
226
265
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
227
266
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
228
267
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
268
|
+
const shipControl = shipControlStateFor({ state });
|
|
229
269
|
return {
|
|
230
270
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
231
271
|
run_id: state.run_id || "unknown",
|
|
@@ -279,6 +319,9 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
279
319
|
stop_condition: compactRecord({
|
|
280
320
|
status: state.status,
|
|
281
321
|
terminal: isTerminalStatus(state.status),
|
|
322
|
+
ship_held: shipControl.ship_held,
|
|
323
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
324
|
+
ship_authorized: shipControl.ship_authorized,
|
|
282
325
|
blocker_code: state.blocker?.code || null,
|
|
283
326
|
blocker_message: state.blocker?.message || null,
|
|
284
327
|
proof_decision: state.proof_decision,
|
|
@@ -469,7 +512,8 @@ function appendStageHeartbeat(state, input) {
|
|
|
469
512
|
function createRunStatusSnapshot(state, at = timestamp()) {
|
|
470
513
|
const latestEvent = state.events[state.events.length - 1];
|
|
471
514
|
const runId = state.run_id || "unknown";
|
|
472
|
-
const
|
|
515
|
+
const shipControl = shipControlStateFor({ state });
|
|
516
|
+
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
517
|
const runCard = existingRunCardCurrent ? state.run_card : createRiddleProofRunCard(state, { at });
|
|
474
518
|
return compactRecord({
|
|
475
519
|
run_id: runId,
|
|
@@ -483,6 +527,9 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
483
527
|
pr_url: state.pr_url ?? null,
|
|
484
528
|
pr_branch: state.pr_branch ?? null,
|
|
485
529
|
pr_state: state.pr_state,
|
|
530
|
+
ship_held: shipControl.ship_held,
|
|
531
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
532
|
+
ship_authorized: shipControl.ship_authorized,
|
|
486
533
|
ci_status: state.ci_status,
|
|
487
534
|
ship_commit: state.ship_commit,
|
|
488
535
|
ship_remote_head: state.ship_remote_head,
|