@riddledc/riddle-proof 0.8.59 → 0.8.60
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.d.cts +1 -0
- package/dist/adapters/codex-exec-agent.d.ts +1 -0
- package/dist/adapters/codex-exec-agent.js +3 -2
- package/dist/adapters/codex.d.cts +1 -0
- package/dist/adapters/codex.d.ts +1 -0
- package/dist/adapters/codex.js +3 -2
- package/dist/adapters/local-agent.d.cts +1 -0
- package/dist/adapters/local-agent.d.ts +1 -0
- package/dist/adapters/local-agent.js +3 -2
- package/dist/adapters/openclaw.d.cts +1 -0
- package/dist/adapters/openclaw.d.ts +1 -0
- package/dist/adapters/openclaw.js +6 -5
- package/dist/advanced/engine-harness.cjs +253 -43
- package/dist/advanced/engine-harness.d.cts +1 -0
- package/dist/advanced/engine-harness.d.ts +1 -0
- package/dist/advanced/engine-harness.js +6 -5
- package/dist/advanced/index.cjs +253 -43
- package/dist/advanced/index.d.cts +1 -0
- package/dist/advanced/index.d.ts +1 -0
- package/dist/advanced/index.js +7 -6
- package/dist/advanced/runner.cjs +202 -4
- package/dist/advanced/runner.d.cts +1 -0
- package/dist/advanced/runner.d.ts +1 -0
- package/dist/advanced/runner.js +6 -5
- package/dist/checkpoint.d.cts +1 -0
- package/dist/checkpoint.d.ts +1 -0
- package/dist/checkpoint.js +3 -2
- package/dist/{chunk-TTB3ZAVX.js → chunk-3FK5HZHK.js} +2 -2
- package/dist/{chunk-XSNMMAPJ.js → chunk-AWRBSVNW.js} +4 -4
- package/dist/{chunk-MOTQNIZX.js → chunk-FX2CB4MG.js} +1 -1
- package/dist/{chunk-2PKBTYOA.js → chunk-HZOILEGF.js} +3 -3
- package/dist/{chunk-KNPCWWF3.js → chunk-NXEAFQYZ.js} +16 -10
- package/dist/{chunk-GHBNDHG7.js → chunk-PCEDAQPG.js} +4 -4
- package/dist/{chunk-CUBYSWZT.js → chunk-QGMSN34W.js} +51 -4
- package/dist/{chunk-RS4HJLJQ.js → chunk-QPKY767W.js} +1 -1
- package/dist/{chunk-UZIX7M7D.js → chunk-UEY5SJG5.js} +13 -9
- package/dist/{chunk-KG64Y5MC.js → chunk-WKIIJX3O.js} +12 -0
- package/dist/{chunk-JLOZTVXU.js → chunk-XKNJ5OE4.js} +2 -2
- package/dist/cli/index.js +9 -9
- package/dist/cli.cjs +461 -404
- package/dist/cli.js +9 -9
- package/dist/codex-exec-agent.d.cts +1 -0
- package/dist/codex-exec-agent.d.ts +1 -0
- package/dist/codex-exec-agent.js +3 -2
- package/dist/diagnostics.d.cts +1 -0
- package/dist/diagnostics.d.ts +1 -0
- package/dist/engine-harness.cjs +253 -43
- package/dist/engine-harness.d.cts +1 -0
- package/dist/engine-harness.d.ts +1 -0
- package/dist/engine-harness.js +6 -5
- package/dist/index.cjs +236 -169
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +21 -11
- package/dist/local-agent.d.cts +1 -0
- package/dist/local-agent.d.ts +1 -0
- package/dist/local-agent.js +3 -2
- package/dist/openclaw.d.cts +1 -0
- package/dist/openclaw.d.ts +1 -0
- package/dist/openclaw.js +6 -5
- package/dist/pr-comment.cjs +7 -2
- package/dist/pr-comment.js +2 -2
- package/dist/profile/index.d.cts +1 -0
- package/dist/profile/index.d.ts +1 -0
- package/dist/profile.d.cts +1 -0
- package/dist/profile.d.ts +1 -0
- package/dist/proof-session.d.cts +1 -0
- package/dist/proof-session.d.ts +1 -0
- package/dist/public-state.cjs +15 -0
- package/dist/public-state.d.cts +4 -1
- package/dist/public-state.d.ts +4 -1
- package/dist/public-state.js +7 -1
- package/dist/result.cjs +211 -4
- package/dist/result.d.cts +12 -1
- package/dist/result.d.ts +12 -1
- package/dist/result.js +6 -1
- package/dist/run-card.cjs +198 -40
- package/dist/run-card.d.cts +1 -0
- package/dist/run-card.d.ts +1 -0
- package/dist/run-card.js +4 -3
- package/dist/runner.cjs +202 -4
- package/dist/runner.d.cts +1 -0
- package/dist/runner.d.ts +1 -0
- package/dist/runner.js +6 -5
- package/dist/spec/checkpoint.d.cts +1 -0
- package/dist/spec/checkpoint.d.ts +1 -0
- package/dist/spec/checkpoint.js +3 -2
- package/dist/spec/index.cjs +235 -167
- package/dist/spec/index.d.cts +2 -2
- package/dist/spec/index.d.ts +2 -2
- package/dist/spec/index.js +17 -7
- package/dist/spec/public-state.cjs +15 -0
- package/dist/spec/public-state.d.cts +1 -1
- package/dist/spec/public-state.d.ts +1 -1
- package/dist/spec/public-state.js +7 -1
- package/dist/spec/result.cjs +209 -4
- package/dist/spec/result.d.cts +2 -1
- package/dist/spec/result.d.ts +2 -1
- package/dist/spec/result.js +6 -1
- package/dist/spec/run-card.cjs +198 -40
- package/dist/spec/run-card.d.cts +1 -0
- package/dist/spec/run-card.d.ts +1 -0
- package/dist/spec/run-card.js +4 -3
- package/dist/spec/state.cjs +207 -45
- package/dist/spec/state.d.cts +1 -0
- package/dist/spec/state.d.ts +1 -0
- package/dist/spec/state.js +5 -4
- package/dist/spec/types.d.cts +1 -0
- package/dist/spec/types.d.ts +1 -0
- package/dist/state.cjs +207 -45
- package/dist/state.d.cts +1 -0
- package/dist/state.d.ts +1 -0
- package/dist/state.js +5 -4
- package/dist/types.d.cts +14 -0
- package/dist/types.d.ts +14 -0
- package/package.json +1 -1
package/dist/spec/state.cjs
CHANGED
|
@@ -43,6 +43,167 @@ __export(state_exports, {
|
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(state_exports);
|
|
45
45
|
|
|
46
|
+
// src/public-state.ts
|
|
47
|
+
function riddleProofPublicStateAllowsClaim(summary, claim) {
|
|
48
|
+
return !summary?.prohibited_claims.includes(claim);
|
|
49
|
+
}
|
|
50
|
+
function riddleProofPublicStateAllowsMergeRecommendation(summary) {
|
|
51
|
+
return riddleProofPublicStateAllowsClaim(summary, "merge_ready") && riddleProofPublicStateAllowsClaim(summary, "sync_allowed");
|
|
52
|
+
}
|
|
53
|
+
function riddleProofPublicStateMergeRecommendation(summary, recommendation) {
|
|
54
|
+
return recommendation && riddleProofPublicStateAllowsMergeRecommendation(summary) ? recommendation : void 0;
|
|
55
|
+
}
|
|
56
|
+
function asRecord(value) {
|
|
57
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
58
|
+
}
|
|
59
|
+
function stringValue(value) {
|
|
60
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
61
|
+
}
|
|
62
|
+
function booleanValue(value) {
|
|
63
|
+
return typeof value === "boolean" ? value : void 0;
|
|
64
|
+
}
|
|
65
|
+
function numberValue(value) {
|
|
66
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
67
|
+
}
|
|
68
|
+
function firstStringValue(...values) {
|
|
69
|
+
for (const value of values) {
|
|
70
|
+
const text = stringValue(value);
|
|
71
|
+
if (text) return text;
|
|
72
|
+
}
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
75
|
+
function firstBooleanValue(...values) {
|
|
76
|
+
for (const value of values) {
|
|
77
|
+
const bool = booleanValue(value);
|
|
78
|
+
if (typeof bool === "boolean") return bool;
|
|
79
|
+
}
|
|
80
|
+
return void 0;
|
|
81
|
+
}
|
|
82
|
+
function firstRecordValue(...values) {
|
|
83
|
+
for (const value of values) {
|
|
84
|
+
const record = asRecord(value);
|
|
85
|
+
if (Object.keys(record).length) return record;
|
|
86
|
+
}
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
function countValue(value) {
|
|
90
|
+
const number = numberValue(value);
|
|
91
|
+
return typeof number === "number" && number > 0 ? Math.trunc(number) : 0;
|
|
92
|
+
}
|
|
93
|
+
function checkpointSummaryFrom(...values) {
|
|
94
|
+
const record = firstRecordValue(...values);
|
|
95
|
+
if (!record) return void 0;
|
|
96
|
+
const accepted = countValue(record.response_count);
|
|
97
|
+
const rejected = countValue(record.rejected_response_count);
|
|
98
|
+
const ignored = countValue(record.ignored_response_count);
|
|
99
|
+
const duplicate = countValue(record.duplicate_response_count);
|
|
100
|
+
const summary = {
|
|
101
|
+
pending: booleanValue(record.pending),
|
|
102
|
+
accepted_response_count: accepted,
|
|
103
|
+
rejected_response_count: rejected,
|
|
104
|
+
ignored_response_count: ignored,
|
|
105
|
+
duplicate_response_count: duplicate,
|
|
106
|
+
latest_decision: stringValue(record.latest_decision),
|
|
107
|
+
audit_disclosure_required: rejected > 0 || ignored > 0 || duplicate > 0
|
|
108
|
+
};
|
|
109
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
110
|
+
}
|
|
111
|
+
function uniqueStrings(values) {
|
|
112
|
+
return [...new Set(values.filter(Boolean))];
|
|
113
|
+
}
|
|
114
|
+
function summarizeRiddleProofPublicState(input) {
|
|
115
|
+
const record = asRecord(input);
|
|
116
|
+
const runCard = asRecord(record.run_card);
|
|
117
|
+
const stopCondition = asRecord(runCard.stop_condition);
|
|
118
|
+
const raw = asRecord(record.raw);
|
|
119
|
+
const request = asRecord(record.request);
|
|
120
|
+
const requestMetadata = asRecord(record.request_metadata);
|
|
121
|
+
const prState = asRecord(record.pr_state);
|
|
122
|
+
const handoff = asRecord(record.pr_handoff_policy);
|
|
123
|
+
const handoffState = stringValue(handoff.state);
|
|
124
|
+
const status = firstStringValue(record.status, stopCondition.status);
|
|
125
|
+
const ok = booleanValue(record.ok) ?? null;
|
|
126
|
+
const shipMode = firstStringValue(request.ship_mode, requestMetadata.ship_mode, record.ship_mode, handoff.ship_mode);
|
|
127
|
+
const explicitShippingDisabled = firstBooleanValue(
|
|
128
|
+
record.shipping_disabled,
|
|
129
|
+
stopCondition.shipping_disabled,
|
|
130
|
+
raw.shipping_disabled,
|
|
131
|
+
handoff.shipping_disabled
|
|
132
|
+
);
|
|
133
|
+
const shippingDisabled = explicitShippingDisabled === true || shipMode === "none" || handoffState === "proof_complete_ship_disabled";
|
|
134
|
+
const explicitShipAuthorized = firstBooleanValue(
|
|
135
|
+
record.ship_authorized,
|
|
136
|
+
stopCondition.ship_authorized,
|
|
137
|
+
raw.ship_authorized
|
|
138
|
+
);
|
|
139
|
+
const authorizationEvidence = Boolean(
|
|
140
|
+
status === "shipped" || record.marked_ready === true || stringValue(prState.status) === "merged" || record.merge_commit || record.merged_at
|
|
141
|
+
);
|
|
142
|
+
const shipAuthorizedBeforeHold = explicitShipAuthorized ?? authorizationEvidence;
|
|
143
|
+
const explicitShipHeld = firstBooleanValue(record.ship_held, stopCondition.ship_held, raw.ship_held);
|
|
144
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !shipAuthorizedBeforeHold;
|
|
145
|
+
const shipHeld = explicitShipHeld === true || inferredHeld;
|
|
146
|
+
const shipAuthorized = shipHeld ? false : shipAuthorizedBeforeHold === true;
|
|
147
|
+
const proofComplete = Boolean(
|
|
148
|
+
status === "ready_to_ship" || status === "shipped" || status === "completed" || status === "passed" || ok === true || handoff.proof_complete === true
|
|
149
|
+
);
|
|
150
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
151
|
+
record.checkpoint_summary,
|
|
152
|
+
stopCondition.checkpoint_summary,
|
|
153
|
+
asRecord(record.details).checkpoint_summary,
|
|
154
|
+
asRecord(raw.details).checkpoint_summary
|
|
155
|
+
);
|
|
156
|
+
const blockedOrWaiting = status === "blocked" || status === "failed" || status === "awaiting_checkpoint" || handoffState === "proof_blocked" || handoffState === "proof_review_required" || handoffState === "proof_failed" || handoffState === "proof_checkpoint_required";
|
|
157
|
+
const proofPassed = Boolean(proofComplete && !blockedOrWaiting);
|
|
158
|
+
const explicitMergeReady = firstBooleanValue(record.merge_ready, stopCondition.merge_ready, raw.merge_ready, handoff.merge_ready);
|
|
159
|
+
const normalPrAllowed = firstBooleanValue(record.normal_pr_allowed, raw.normal_pr_allowed, handoff.normal_pr_allowed);
|
|
160
|
+
const baseHandoffAllowed = !blockedOrWaiting && !shipHeld && !shippingDisabled;
|
|
161
|
+
const mergeReady = baseHandoffAllowed && normalPrAllowed !== false && (explicitMergeReady ?? shipAuthorized);
|
|
162
|
+
const syncAllowed = mergeReady;
|
|
163
|
+
let policyState = "unknown";
|
|
164
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") policyState = "awaiting_checkpoint";
|
|
165
|
+
else if (status === "failed" || handoffState === "proof_failed") policyState = "proof_failed";
|
|
166
|
+
else if (status === "blocked" || handoffState === "proof_blocked" || handoffState === "proof_review_required") policyState = "proof_blocked";
|
|
167
|
+
else if (handoffState === "proof_complete_ship_disabled") policyState = "proof_complete_ship_disabled";
|
|
168
|
+
else if (proofComplete && shipHeld && !shipAuthorized) policyState = "proof_passed_ship_held";
|
|
169
|
+
else if (proofComplete && shippingDisabled && !shipAuthorized) policyState = "proof_complete_ship_disabled";
|
|
170
|
+
else if (shipAuthorized) policyState = "ship_authorized";
|
|
171
|
+
else if (proofPassed) policyState = "proof_passed";
|
|
172
|
+
else if (status === "running") policyState = "proof_in_progress";
|
|
173
|
+
const requiredDisclosures = [];
|
|
174
|
+
if (shipHeld) requiredDisclosures.push("ship_held");
|
|
175
|
+
if (shippingDisabled) requiredDisclosures.push("shipping_disabled");
|
|
176
|
+
if (checkpointSummary?.audit_disclosure_required) requiredDisclosures.push("checkpoint_audit_counters");
|
|
177
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") requiredDisclosures.push("checkpoint_required");
|
|
178
|
+
const prohibitedClaims = [];
|
|
179
|
+
if (!shipAuthorized || shipHeld || shippingDisabled) prohibitedClaims.push("ship_authorized", "shipped");
|
|
180
|
+
if (!mergeReady) prohibitedClaims.push("merge_ready");
|
|
181
|
+
if (!syncAllowed) prohibitedClaims.push("sync_allowed");
|
|
182
|
+
if (blockedOrWaiting) {
|
|
183
|
+
prohibitedClaims.push("proof_passed", "ready_to_ship");
|
|
184
|
+
}
|
|
185
|
+
if (checkpointSummary?.audit_disclosure_required) {
|
|
186
|
+
prohibitedClaims.push("all_checkpoint_responses_accepted");
|
|
187
|
+
}
|
|
188
|
+
const resultLabel = policyState === "awaiting_checkpoint" ? "checkpoint required" : policyState === "proof_blocked" ? "blocked" : policyState === "proof_failed" ? "failed" : policyState === "proof_complete_ship_disabled" ? "proof complete; shipping disabled" : policyState === "proof_passed_ship_held" ? "proof passed; ship held" : policyState === "ship_authorized" ? status === "shipped" ? "shipped" : "ship authorized" : policyState === "proof_passed" ? "passed" : policyState === "proof_in_progress" ? "running" : status || "recorded";
|
|
189
|
+
return {
|
|
190
|
+
status,
|
|
191
|
+
ok,
|
|
192
|
+
policy_state: policyState,
|
|
193
|
+
result_label: resultLabel,
|
|
194
|
+
proof_complete: proofComplete,
|
|
195
|
+
proof_passed: proofPassed,
|
|
196
|
+
ship_held: shipHeld,
|
|
197
|
+
shipping_disabled: shippingDisabled,
|
|
198
|
+
ship_authorized: shipAuthorized,
|
|
199
|
+
merge_ready: mergeReady,
|
|
200
|
+
sync_allowed: syncAllowed,
|
|
201
|
+
checkpoint_summary: checkpointSummary,
|
|
202
|
+
required_disclosures: uniqueStrings(requiredDisclosures),
|
|
203
|
+
prohibited_claims: uniqueStrings(prohibitedClaims)
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
46
207
|
// src/result.ts
|
|
47
208
|
function isTerminalStatus(status) {
|
|
48
209
|
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
@@ -59,44 +220,36 @@ function nonEmptyString(value) {
|
|
|
59
220
|
function recordValue(value) {
|
|
60
221
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
61
222
|
}
|
|
62
|
-
function
|
|
63
|
-
for (const value of values) {
|
|
64
|
-
if (typeof value === "boolean") return value;
|
|
65
|
-
}
|
|
66
|
-
return void 0;
|
|
67
|
-
}
|
|
68
|
-
function shipControlStateFor(input) {
|
|
223
|
+
function publicStateForRunState(input) {
|
|
69
224
|
const state = input.state;
|
|
70
225
|
const status = input.status || state.status;
|
|
71
226
|
const raw = recordValue(input.raw) || {};
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
state.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
state.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
227
|
+
const extendedState = state;
|
|
228
|
+
const terminalOk = isTerminalStatus(status) ? state.ok : void 0;
|
|
229
|
+
return summarizeRiddleProofPublicState(compactRecord({
|
|
230
|
+
status,
|
|
231
|
+
ok: terminalOk,
|
|
232
|
+
request: state.request,
|
|
233
|
+
pr_state: state.pr_state,
|
|
234
|
+
marked_ready: state.marked_ready,
|
|
235
|
+
ship_held: state.ship_held,
|
|
236
|
+
shipping_disabled: state.shipping_disabled,
|
|
237
|
+
ship_authorized: state.ship_authorized,
|
|
238
|
+
ship_mode: state.request?.ship_mode,
|
|
239
|
+
merge_commit: state.merge_commit,
|
|
240
|
+
merged_at: state.merged_at,
|
|
241
|
+
checkpoint_summary: state.checkpoint_summary,
|
|
242
|
+
pr_handoff_policy: recordValue(extendedState.pr_handoff_policy),
|
|
243
|
+
merge_ready: extendedState.merge_ready,
|
|
244
|
+
normal_pr_allowed: extendedState.normal_pr_allowed,
|
|
245
|
+
raw: Object.keys(raw).length ? raw : void 0
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
function publicMergeRecommendationForRunState(input) {
|
|
249
|
+
return riddleProofPublicStateMergeRecommendation(
|
|
250
|
+
publicStateForRunState(input),
|
|
251
|
+
input.state.merge_recommendation
|
|
90
252
|
);
|
|
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
253
|
}
|
|
101
254
|
|
|
102
255
|
// src/checkpoint.ts
|
|
@@ -268,7 +421,8 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
268
421
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
269
422
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
270
423
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
271
|
-
const
|
|
424
|
+
const publicState = publicStateForRunState({ state, status: state.status });
|
|
425
|
+
const publicMergeRecommendation = publicMergeRecommendationForRunState({ state, status: state.status });
|
|
272
426
|
return {
|
|
273
427
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
274
428
|
run_id: state.run_id || "unknown",
|
|
@@ -322,14 +476,18 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
322
476
|
stop_condition: compactRecord({
|
|
323
477
|
status: state.status,
|
|
324
478
|
terminal: isTerminalStatus(state.status),
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
479
|
+
result_label: publicState.result_label,
|
|
480
|
+
ship_held: publicState.ship_held,
|
|
481
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
482
|
+
ship_authorized: publicState.ship_authorized,
|
|
483
|
+
merge_ready: publicState.merge_ready,
|
|
484
|
+
sync_allowed: publicState.sync_allowed,
|
|
328
485
|
blocker_code: state.blocker?.code || null,
|
|
329
486
|
blocker_message: state.blocker?.message || null,
|
|
330
487
|
proof_decision: state.proof_decision,
|
|
331
|
-
merge_recommendation:
|
|
332
|
-
monitor_should_continue: !isTerminalStatus(state.status)
|
|
488
|
+
merge_recommendation: publicMergeRecommendation,
|
|
489
|
+
monitor_should_continue: !isTerminalStatus(state.status),
|
|
490
|
+
public_state: publicState
|
|
333
491
|
}),
|
|
334
492
|
updated_at: state.updated_at
|
|
335
493
|
};
|
|
@@ -515,8 +673,8 @@ function appendStageHeartbeat(state, input) {
|
|
|
515
673
|
function createRunStatusSnapshot(state, at = timestamp()) {
|
|
516
674
|
const latestEvent = state.events[state.events.length - 1];
|
|
517
675
|
const runId = state.run_id || "unknown";
|
|
518
|
-
const
|
|
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 ===
|
|
676
|
+
const publicState = publicStateForRunState({ state, status: state.status });
|
|
677
|
+
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 === publicState.ship_held && state.run_card.stop_condition?.shipping_disabled === publicState.shipping_disabled && state.run_card.stop_condition?.ship_authorized === publicState.ship_authorized && state.run_card.stop_condition?.merge_ready === publicState.merge_ready && state.run_card.stop_condition?.sync_allowed === publicState.sync_allowed && state.run_card.stop_condition?.result_label === publicState.result_label;
|
|
520
678
|
const runCard = existingRunCardCurrent ? state.run_card : createRiddleProofRunCard(state, { at });
|
|
521
679
|
return compactRecord({
|
|
522
680
|
run_id: runId,
|
|
@@ -530,9 +688,13 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
530
688
|
pr_url: state.pr_url ?? null,
|
|
531
689
|
pr_branch: state.pr_branch ?? null,
|
|
532
690
|
pr_state: state.pr_state,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
691
|
+
result_label: publicState.result_label,
|
|
692
|
+
ship_held: publicState.ship_held,
|
|
693
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
694
|
+
ship_authorized: publicState.ship_authorized,
|
|
695
|
+
merge_ready: publicState.merge_ready,
|
|
696
|
+
sync_allowed: publicState.sync_allowed,
|
|
697
|
+
public_state: publicState,
|
|
536
698
|
ci_status: state.ci_status,
|
|
537
699
|
ship_commit: state.ship_commit,
|
|
538
700
|
ship_remote_head: state.ship_remote_head,
|
package/dist/spec/state.d.cts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from '../state.cjs';
|
|
2
2
|
import '../types.cjs';
|
|
3
|
+
import '../public-state.cjs';
|
package/dist/spec/state.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from '../state.js';
|
|
2
2
|
import '../types.js';
|
|
3
|
+
import '../public-state.js';
|
package/dist/spec/state.js
CHANGED
|
@@ -9,10 +9,11 @@ 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-UEY5SJG5.js";
|
|
13
|
+
import "../chunk-NXEAFQYZ.js";
|
|
14
|
+
import "../chunk-FX2CB4MG.js";
|
|
15
|
+
import "../chunk-QGMSN34W.js";
|
|
16
|
+
import "../chunk-WKIIJX3O.js";
|
|
16
17
|
import "../chunk-MLKGABMK.js";
|
|
17
18
|
export {
|
|
18
19
|
RIDDLE_PROOF_RUN_STATE_VERSION,
|
package/dist/spec/types.d.cts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
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
|
+
import '../public-state.cjs';
|
package/dist/spec/types.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
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
|
+
import '../public-state.js';
|
package/dist/state.cjs
CHANGED
|
@@ -43,6 +43,167 @@ __export(state_exports, {
|
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(state_exports);
|
|
45
45
|
|
|
46
|
+
// src/public-state.ts
|
|
47
|
+
function riddleProofPublicStateAllowsClaim(summary, claim) {
|
|
48
|
+
return !summary?.prohibited_claims.includes(claim);
|
|
49
|
+
}
|
|
50
|
+
function riddleProofPublicStateAllowsMergeRecommendation(summary) {
|
|
51
|
+
return riddleProofPublicStateAllowsClaim(summary, "merge_ready") && riddleProofPublicStateAllowsClaim(summary, "sync_allowed");
|
|
52
|
+
}
|
|
53
|
+
function riddleProofPublicStateMergeRecommendation(summary, recommendation) {
|
|
54
|
+
return recommendation && riddleProofPublicStateAllowsMergeRecommendation(summary) ? recommendation : void 0;
|
|
55
|
+
}
|
|
56
|
+
function asRecord(value) {
|
|
57
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
58
|
+
}
|
|
59
|
+
function stringValue(value) {
|
|
60
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
61
|
+
}
|
|
62
|
+
function booleanValue(value) {
|
|
63
|
+
return typeof value === "boolean" ? value : void 0;
|
|
64
|
+
}
|
|
65
|
+
function numberValue(value) {
|
|
66
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
67
|
+
}
|
|
68
|
+
function firstStringValue(...values) {
|
|
69
|
+
for (const value of values) {
|
|
70
|
+
const text = stringValue(value);
|
|
71
|
+
if (text) return text;
|
|
72
|
+
}
|
|
73
|
+
return void 0;
|
|
74
|
+
}
|
|
75
|
+
function firstBooleanValue(...values) {
|
|
76
|
+
for (const value of values) {
|
|
77
|
+
const bool = booleanValue(value);
|
|
78
|
+
if (typeof bool === "boolean") return bool;
|
|
79
|
+
}
|
|
80
|
+
return void 0;
|
|
81
|
+
}
|
|
82
|
+
function firstRecordValue(...values) {
|
|
83
|
+
for (const value of values) {
|
|
84
|
+
const record = asRecord(value);
|
|
85
|
+
if (Object.keys(record).length) return record;
|
|
86
|
+
}
|
|
87
|
+
return void 0;
|
|
88
|
+
}
|
|
89
|
+
function countValue(value) {
|
|
90
|
+
const number = numberValue(value);
|
|
91
|
+
return typeof number === "number" && number > 0 ? Math.trunc(number) : 0;
|
|
92
|
+
}
|
|
93
|
+
function checkpointSummaryFrom(...values) {
|
|
94
|
+
const record = firstRecordValue(...values);
|
|
95
|
+
if (!record) return void 0;
|
|
96
|
+
const accepted = countValue(record.response_count);
|
|
97
|
+
const rejected = countValue(record.rejected_response_count);
|
|
98
|
+
const ignored = countValue(record.ignored_response_count);
|
|
99
|
+
const duplicate = countValue(record.duplicate_response_count);
|
|
100
|
+
const summary = {
|
|
101
|
+
pending: booleanValue(record.pending),
|
|
102
|
+
accepted_response_count: accepted,
|
|
103
|
+
rejected_response_count: rejected,
|
|
104
|
+
ignored_response_count: ignored,
|
|
105
|
+
duplicate_response_count: duplicate,
|
|
106
|
+
latest_decision: stringValue(record.latest_decision),
|
|
107
|
+
audit_disclosure_required: rejected > 0 || ignored > 0 || duplicate > 0
|
|
108
|
+
};
|
|
109
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
110
|
+
}
|
|
111
|
+
function uniqueStrings(values) {
|
|
112
|
+
return [...new Set(values.filter(Boolean))];
|
|
113
|
+
}
|
|
114
|
+
function summarizeRiddleProofPublicState(input) {
|
|
115
|
+
const record = asRecord(input);
|
|
116
|
+
const runCard = asRecord(record.run_card);
|
|
117
|
+
const stopCondition = asRecord(runCard.stop_condition);
|
|
118
|
+
const raw = asRecord(record.raw);
|
|
119
|
+
const request = asRecord(record.request);
|
|
120
|
+
const requestMetadata = asRecord(record.request_metadata);
|
|
121
|
+
const prState = asRecord(record.pr_state);
|
|
122
|
+
const handoff = asRecord(record.pr_handoff_policy);
|
|
123
|
+
const handoffState = stringValue(handoff.state);
|
|
124
|
+
const status = firstStringValue(record.status, stopCondition.status);
|
|
125
|
+
const ok = booleanValue(record.ok) ?? null;
|
|
126
|
+
const shipMode = firstStringValue(request.ship_mode, requestMetadata.ship_mode, record.ship_mode, handoff.ship_mode);
|
|
127
|
+
const explicitShippingDisabled = firstBooleanValue(
|
|
128
|
+
record.shipping_disabled,
|
|
129
|
+
stopCondition.shipping_disabled,
|
|
130
|
+
raw.shipping_disabled,
|
|
131
|
+
handoff.shipping_disabled
|
|
132
|
+
);
|
|
133
|
+
const shippingDisabled = explicitShippingDisabled === true || shipMode === "none" || handoffState === "proof_complete_ship_disabled";
|
|
134
|
+
const explicitShipAuthorized = firstBooleanValue(
|
|
135
|
+
record.ship_authorized,
|
|
136
|
+
stopCondition.ship_authorized,
|
|
137
|
+
raw.ship_authorized
|
|
138
|
+
);
|
|
139
|
+
const authorizationEvidence = Boolean(
|
|
140
|
+
status === "shipped" || record.marked_ready === true || stringValue(prState.status) === "merged" || record.merge_commit || record.merged_at
|
|
141
|
+
);
|
|
142
|
+
const shipAuthorizedBeforeHold = explicitShipAuthorized ?? authorizationEvidence;
|
|
143
|
+
const explicitShipHeld = firstBooleanValue(record.ship_held, stopCondition.ship_held, raw.ship_held);
|
|
144
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !shipAuthorizedBeforeHold;
|
|
145
|
+
const shipHeld = explicitShipHeld === true || inferredHeld;
|
|
146
|
+
const shipAuthorized = shipHeld ? false : shipAuthorizedBeforeHold === true;
|
|
147
|
+
const proofComplete = Boolean(
|
|
148
|
+
status === "ready_to_ship" || status === "shipped" || status === "completed" || status === "passed" || ok === true || handoff.proof_complete === true
|
|
149
|
+
);
|
|
150
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
151
|
+
record.checkpoint_summary,
|
|
152
|
+
stopCondition.checkpoint_summary,
|
|
153
|
+
asRecord(record.details).checkpoint_summary,
|
|
154
|
+
asRecord(raw.details).checkpoint_summary
|
|
155
|
+
);
|
|
156
|
+
const blockedOrWaiting = status === "blocked" || status === "failed" || status === "awaiting_checkpoint" || handoffState === "proof_blocked" || handoffState === "proof_review_required" || handoffState === "proof_failed" || handoffState === "proof_checkpoint_required";
|
|
157
|
+
const proofPassed = Boolean(proofComplete && !blockedOrWaiting);
|
|
158
|
+
const explicitMergeReady = firstBooleanValue(record.merge_ready, stopCondition.merge_ready, raw.merge_ready, handoff.merge_ready);
|
|
159
|
+
const normalPrAllowed = firstBooleanValue(record.normal_pr_allowed, raw.normal_pr_allowed, handoff.normal_pr_allowed);
|
|
160
|
+
const baseHandoffAllowed = !blockedOrWaiting && !shipHeld && !shippingDisabled;
|
|
161
|
+
const mergeReady = baseHandoffAllowed && normalPrAllowed !== false && (explicitMergeReady ?? shipAuthorized);
|
|
162
|
+
const syncAllowed = mergeReady;
|
|
163
|
+
let policyState = "unknown";
|
|
164
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") policyState = "awaiting_checkpoint";
|
|
165
|
+
else if (status === "failed" || handoffState === "proof_failed") policyState = "proof_failed";
|
|
166
|
+
else if (status === "blocked" || handoffState === "proof_blocked" || handoffState === "proof_review_required") policyState = "proof_blocked";
|
|
167
|
+
else if (handoffState === "proof_complete_ship_disabled") policyState = "proof_complete_ship_disabled";
|
|
168
|
+
else if (proofComplete && shipHeld && !shipAuthorized) policyState = "proof_passed_ship_held";
|
|
169
|
+
else if (proofComplete && shippingDisabled && !shipAuthorized) policyState = "proof_complete_ship_disabled";
|
|
170
|
+
else if (shipAuthorized) policyState = "ship_authorized";
|
|
171
|
+
else if (proofPassed) policyState = "proof_passed";
|
|
172
|
+
else if (status === "running") policyState = "proof_in_progress";
|
|
173
|
+
const requiredDisclosures = [];
|
|
174
|
+
if (shipHeld) requiredDisclosures.push("ship_held");
|
|
175
|
+
if (shippingDisabled) requiredDisclosures.push("shipping_disabled");
|
|
176
|
+
if (checkpointSummary?.audit_disclosure_required) requiredDisclosures.push("checkpoint_audit_counters");
|
|
177
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") requiredDisclosures.push("checkpoint_required");
|
|
178
|
+
const prohibitedClaims = [];
|
|
179
|
+
if (!shipAuthorized || shipHeld || shippingDisabled) prohibitedClaims.push("ship_authorized", "shipped");
|
|
180
|
+
if (!mergeReady) prohibitedClaims.push("merge_ready");
|
|
181
|
+
if (!syncAllowed) prohibitedClaims.push("sync_allowed");
|
|
182
|
+
if (blockedOrWaiting) {
|
|
183
|
+
prohibitedClaims.push("proof_passed", "ready_to_ship");
|
|
184
|
+
}
|
|
185
|
+
if (checkpointSummary?.audit_disclosure_required) {
|
|
186
|
+
prohibitedClaims.push("all_checkpoint_responses_accepted");
|
|
187
|
+
}
|
|
188
|
+
const resultLabel = policyState === "awaiting_checkpoint" ? "checkpoint required" : policyState === "proof_blocked" ? "blocked" : policyState === "proof_failed" ? "failed" : policyState === "proof_complete_ship_disabled" ? "proof complete; shipping disabled" : policyState === "proof_passed_ship_held" ? "proof passed; ship held" : policyState === "ship_authorized" ? status === "shipped" ? "shipped" : "ship authorized" : policyState === "proof_passed" ? "passed" : policyState === "proof_in_progress" ? "running" : status || "recorded";
|
|
189
|
+
return {
|
|
190
|
+
status,
|
|
191
|
+
ok,
|
|
192
|
+
policy_state: policyState,
|
|
193
|
+
result_label: resultLabel,
|
|
194
|
+
proof_complete: proofComplete,
|
|
195
|
+
proof_passed: proofPassed,
|
|
196
|
+
ship_held: shipHeld,
|
|
197
|
+
shipping_disabled: shippingDisabled,
|
|
198
|
+
ship_authorized: shipAuthorized,
|
|
199
|
+
merge_ready: mergeReady,
|
|
200
|
+
sync_allowed: syncAllowed,
|
|
201
|
+
checkpoint_summary: checkpointSummary,
|
|
202
|
+
required_disclosures: uniqueStrings(requiredDisclosures),
|
|
203
|
+
prohibited_claims: uniqueStrings(prohibitedClaims)
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
46
207
|
// src/result.ts
|
|
47
208
|
function isTerminalStatus(status) {
|
|
48
209
|
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
@@ -59,44 +220,36 @@ function nonEmptyString(value) {
|
|
|
59
220
|
function recordValue(value) {
|
|
60
221
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
61
222
|
}
|
|
62
|
-
function
|
|
63
|
-
for (const value of values) {
|
|
64
|
-
if (typeof value === "boolean") return value;
|
|
65
|
-
}
|
|
66
|
-
return void 0;
|
|
67
|
-
}
|
|
68
|
-
function shipControlStateFor(input) {
|
|
223
|
+
function publicStateForRunState(input) {
|
|
69
224
|
const state = input.state;
|
|
70
225
|
const status = input.status || state.status;
|
|
71
226
|
const raw = recordValue(input.raw) || {};
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
state.
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
state.
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
227
|
+
const extendedState = state;
|
|
228
|
+
const terminalOk = isTerminalStatus(status) ? state.ok : void 0;
|
|
229
|
+
return summarizeRiddleProofPublicState(compactRecord({
|
|
230
|
+
status,
|
|
231
|
+
ok: terminalOk,
|
|
232
|
+
request: state.request,
|
|
233
|
+
pr_state: state.pr_state,
|
|
234
|
+
marked_ready: state.marked_ready,
|
|
235
|
+
ship_held: state.ship_held,
|
|
236
|
+
shipping_disabled: state.shipping_disabled,
|
|
237
|
+
ship_authorized: state.ship_authorized,
|
|
238
|
+
ship_mode: state.request?.ship_mode,
|
|
239
|
+
merge_commit: state.merge_commit,
|
|
240
|
+
merged_at: state.merged_at,
|
|
241
|
+
checkpoint_summary: state.checkpoint_summary,
|
|
242
|
+
pr_handoff_policy: recordValue(extendedState.pr_handoff_policy),
|
|
243
|
+
merge_ready: extendedState.merge_ready,
|
|
244
|
+
normal_pr_allowed: extendedState.normal_pr_allowed,
|
|
245
|
+
raw: Object.keys(raw).length ? raw : void 0
|
|
246
|
+
}));
|
|
247
|
+
}
|
|
248
|
+
function publicMergeRecommendationForRunState(input) {
|
|
249
|
+
return riddleProofPublicStateMergeRecommendation(
|
|
250
|
+
publicStateForRunState(input),
|
|
251
|
+
input.state.merge_recommendation
|
|
90
252
|
);
|
|
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
253
|
}
|
|
101
254
|
|
|
102
255
|
// src/checkpoint.ts
|
|
@@ -268,7 +421,8 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
268
421
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
269
422
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
270
423
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
271
|
-
const
|
|
424
|
+
const publicState = publicStateForRunState({ state, status: state.status });
|
|
425
|
+
const publicMergeRecommendation = publicMergeRecommendationForRunState({ state, status: state.status });
|
|
272
426
|
return {
|
|
273
427
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
274
428
|
run_id: state.run_id || "unknown",
|
|
@@ -322,14 +476,18 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
322
476
|
stop_condition: compactRecord({
|
|
323
477
|
status: state.status,
|
|
324
478
|
terminal: isTerminalStatus(state.status),
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
479
|
+
result_label: publicState.result_label,
|
|
480
|
+
ship_held: publicState.ship_held,
|
|
481
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
482
|
+
ship_authorized: publicState.ship_authorized,
|
|
483
|
+
merge_ready: publicState.merge_ready,
|
|
484
|
+
sync_allowed: publicState.sync_allowed,
|
|
328
485
|
blocker_code: state.blocker?.code || null,
|
|
329
486
|
blocker_message: state.blocker?.message || null,
|
|
330
487
|
proof_decision: state.proof_decision,
|
|
331
|
-
merge_recommendation:
|
|
332
|
-
monitor_should_continue: !isTerminalStatus(state.status)
|
|
488
|
+
merge_recommendation: publicMergeRecommendation,
|
|
489
|
+
monitor_should_continue: !isTerminalStatus(state.status),
|
|
490
|
+
public_state: publicState
|
|
333
491
|
}),
|
|
334
492
|
updated_at: state.updated_at
|
|
335
493
|
};
|
|
@@ -515,8 +673,8 @@ function appendStageHeartbeat(state, input) {
|
|
|
515
673
|
function createRunStatusSnapshot(state, at = timestamp()) {
|
|
516
674
|
const latestEvent = state.events[state.events.length - 1];
|
|
517
675
|
const runId = state.run_id || "unknown";
|
|
518
|
-
const
|
|
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 ===
|
|
676
|
+
const publicState = publicStateForRunState({ state, status: state.status });
|
|
677
|
+
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 === publicState.ship_held && state.run_card.stop_condition?.shipping_disabled === publicState.shipping_disabled && state.run_card.stop_condition?.ship_authorized === publicState.ship_authorized && state.run_card.stop_condition?.merge_ready === publicState.merge_ready && state.run_card.stop_condition?.sync_allowed === publicState.sync_allowed && state.run_card.stop_condition?.result_label === publicState.result_label;
|
|
520
678
|
const runCard = existingRunCardCurrent ? state.run_card : createRiddleProofRunCard(state, { at });
|
|
521
679
|
return compactRecord({
|
|
522
680
|
run_id: runId,
|
|
@@ -530,9 +688,13 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
530
688
|
pr_url: state.pr_url ?? null,
|
|
531
689
|
pr_branch: state.pr_branch ?? null,
|
|
532
690
|
pr_state: state.pr_state,
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
691
|
+
result_label: publicState.result_label,
|
|
692
|
+
ship_held: publicState.ship_held,
|
|
693
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
694
|
+
ship_authorized: publicState.ship_authorized,
|
|
695
|
+
merge_ready: publicState.merge_ready,
|
|
696
|
+
sync_allowed: publicState.sync_allowed,
|
|
697
|
+
public_state: publicState,
|
|
536
698
|
ci_status: state.ci_status,
|
|
537
699
|
ship_commit: state.ship_commit,
|
|
538
700
|
ship_remote_head: state.ship_remote_head,
|
package/dist/state.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RiddleProofRunParams, RiddleProofStatus, RiddleProofStage, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStatePaths, RiddleProofProofContract, RiddleProofRunCard, RiddleProofCheckpointResponse, RiddleProofEvent, RiddleProofRunState, RiddleProofPrLifecycleState, RiddleProofRunStatusSnapshot, IntegrationContext } from './types.cjs';
|
|
2
|
+
import './public-state.cjs';
|
|
2
3
|
|
|
3
4
|
declare const RIDDLE_PROOF_RUN_STATE_VERSION: "riddle-proof.run-state.v1";
|
|
4
5
|
interface CreateRunStateInput {
|
package/dist/state.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RiddleProofRunParams, RiddleProofStatus, RiddleProofStage, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStatePaths, RiddleProofProofContract, RiddleProofRunCard, RiddleProofCheckpointResponse, RiddleProofEvent, RiddleProofRunState, RiddleProofPrLifecycleState, RiddleProofRunStatusSnapshot, IntegrationContext } from './types.js';
|
|
2
|
+
import './public-state.js';
|
|
2
3
|
|
|
3
4
|
declare const RIDDLE_PROOF_RUN_STATE_VERSION: "riddle-proof.run-state.v1";
|
|
4
5
|
interface CreateRunStateInput {
|