@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/run-card.cjs
CHANGED
|
@@ -35,59 +35,212 @@ __export(run_card_exports, {
|
|
|
35
35
|
});
|
|
36
36
|
module.exports = __toCommonJS(run_card_exports);
|
|
37
37
|
|
|
38
|
-
// src/
|
|
39
|
-
function
|
|
40
|
-
return
|
|
38
|
+
// src/public-state.ts
|
|
39
|
+
function riddleProofPublicStateAllowsClaim(summary, claim) {
|
|
40
|
+
return !summary?.prohibited_claims.includes(claim);
|
|
41
41
|
}
|
|
42
|
-
function
|
|
43
|
-
return
|
|
42
|
+
function riddleProofPublicStateAllowsMergeRecommendation(summary) {
|
|
43
|
+
return riddleProofPublicStateAllowsClaim(summary, "merge_ready") && riddleProofPublicStateAllowsClaim(summary, "sync_allowed");
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function riddleProofPublicStateMergeRecommendation(summary, recommendation) {
|
|
46
|
+
return recommendation && riddleProofPublicStateAllowsMergeRecommendation(summary) ? recommendation : void 0;
|
|
47
|
+
}
|
|
48
|
+
function asRecord(value) {
|
|
49
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
50
|
+
}
|
|
51
|
+
function stringValue(value) {
|
|
46
52
|
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
47
53
|
}
|
|
48
|
-
function
|
|
49
|
-
return
|
|
54
|
+
function booleanValue(value) {
|
|
55
|
+
return typeof value === "boolean" ? value : void 0;
|
|
56
|
+
}
|
|
57
|
+
function numberValue(value) {
|
|
58
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
50
59
|
}
|
|
51
|
-
function
|
|
60
|
+
function firstStringValue(...values) {
|
|
52
61
|
for (const value of values) {
|
|
53
|
-
|
|
62
|
+
const text = stringValue(value);
|
|
63
|
+
if (text) return text;
|
|
54
64
|
}
|
|
55
65
|
return void 0;
|
|
56
66
|
}
|
|
57
|
-
function
|
|
58
|
-
const
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
function firstBooleanValue(...values) {
|
|
68
|
+
for (const value of values) {
|
|
69
|
+
const bool = booleanValue(value);
|
|
70
|
+
if (typeof bool === "boolean") return bool;
|
|
71
|
+
}
|
|
72
|
+
return void 0;
|
|
73
|
+
}
|
|
74
|
+
function firstRecordValue(...values) {
|
|
75
|
+
for (const value of values) {
|
|
76
|
+
const record = asRecord(value);
|
|
77
|
+
if (Object.keys(record).length) return record;
|
|
78
|
+
}
|
|
79
|
+
return void 0;
|
|
80
|
+
}
|
|
81
|
+
function countValue(value) {
|
|
82
|
+
const number = numberValue(value);
|
|
83
|
+
return typeof number === "number" && number > 0 ? Math.trunc(number) : 0;
|
|
84
|
+
}
|
|
85
|
+
function checkpointSummaryFrom(...values) {
|
|
86
|
+
const record = firstRecordValue(...values);
|
|
87
|
+
if (!record) return void 0;
|
|
88
|
+
const accepted = countValue(record.response_count);
|
|
89
|
+
const rejected = countValue(record.rejected_response_count);
|
|
90
|
+
const ignored = countValue(record.ignored_response_count);
|
|
91
|
+
const duplicate = countValue(record.duplicate_response_count);
|
|
92
|
+
const summary = {
|
|
93
|
+
pending: booleanValue(record.pending),
|
|
94
|
+
accepted_response_count: accepted,
|
|
95
|
+
rejected_response_count: rejected,
|
|
96
|
+
ignored_response_count: ignored,
|
|
97
|
+
duplicate_response_count: duplicate,
|
|
98
|
+
latest_decision: stringValue(record.latest_decision),
|
|
99
|
+
audit_disclosure_required: rejected > 0 || ignored > 0 || duplicate > 0
|
|
100
|
+
};
|
|
101
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
102
|
+
}
|
|
103
|
+
function uniqueStrings(values) {
|
|
104
|
+
return [...new Set(values.filter(Boolean))];
|
|
105
|
+
}
|
|
106
|
+
function summarizeRiddleProofPublicState(input) {
|
|
107
|
+
const record = asRecord(input);
|
|
108
|
+
const runCard = asRecord(record.run_card);
|
|
109
|
+
const stopCondition = asRecord(runCard.stop_condition);
|
|
110
|
+
const raw = asRecord(record.raw);
|
|
111
|
+
const request = asRecord(record.request);
|
|
112
|
+
const requestMetadata = asRecord(record.request_metadata);
|
|
113
|
+
const prState = asRecord(record.pr_state);
|
|
114
|
+
const handoff = asRecord(record.pr_handoff_policy);
|
|
115
|
+
const handoffState = stringValue(handoff.state);
|
|
116
|
+
const status = firstStringValue(record.status, stopCondition.status);
|
|
117
|
+
const ok = booleanValue(record.ok) ?? null;
|
|
118
|
+
const shipMode = firstStringValue(request.ship_mode, requestMetadata.ship_mode, record.ship_mode, handoff.ship_mode);
|
|
119
|
+
const explicitShippingDisabled = firstBooleanValue(
|
|
120
|
+
record.shipping_disabled,
|
|
121
|
+
stopCondition.shipping_disabled,
|
|
64
122
|
raw.shipping_disabled,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
raw.ship_authorized
|
|
72
|
-
raw.shipAuthorized,
|
|
73
|
-
state.ship_authorized,
|
|
74
|
-
shipReport.ship_authorized,
|
|
75
|
-
shipReport.shipAuthorized
|
|
123
|
+
handoff.shipping_disabled
|
|
124
|
+
);
|
|
125
|
+
const shippingDisabled = explicitShippingDisabled === true || shipMode === "none" || handoffState === "proof_complete_ship_disabled";
|
|
126
|
+
const explicitShipAuthorized = firstBooleanValue(
|
|
127
|
+
record.ship_authorized,
|
|
128
|
+
stopCondition.ship_authorized,
|
|
129
|
+
raw.ship_authorized
|
|
76
130
|
);
|
|
77
131
|
const authorizationEvidence = Boolean(
|
|
78
|
-
status === "shipped" ||
|
|
132
|
+
status === "shipped" || record.marked_ready === true || stringValue(prState.status) === "merged" || record.merge_commit || record.merged_at
|
|
133
|
+
);
|
|
134
|
+
const shipAuthorizedBeforeHold = explicitShipAuthorized ?? authorizationEvidence;
|
|
135
|
+
const explicitShipHeld = firstBooleanValue(record.ship_held, stopCondition.ship_held, raw.ship_held);
|
|
136
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !shipAuthorizedBeforeHold;
|
|
137
|
+
const shipHeld = explicitShipHeld === true || inferredHeld;
|
|
138
|
+
const shipAuthorized = shipHeld ? false : shipAuthorizedBeforeHold === true;
|
|
139
|
+
const proofComplete = Boolean(
|
|
140
|
+
status === "ready_to_ship" || status === "shipped" || status === "completed" || status === "passed" || ok === true || handoff.proof_complete === true
|
|
79
141
|
);
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
142
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
143
|
+
record.checkpoint_summary,
|
|
144
|
+
stopCondition.checkpoint_summary,
|
|
145
|
+
asRecord(record.details).checkpoint_summary,
|
|
146
|
+
asRecord(raw.details).checkpoint_summary
|
|
147
|
+
);
|
|
148
|
+
const blockedOrWaiting = status === "blocked" || status === "failed" || status === "awaiting_checkpoint" || handoffState === "proof_blocked" || handoffState === "proof_review_required" || handoffState === "proof_failed" || handoffState === "proof_checkpoint_required";
|
|
149
|
+
const proofPassed = Boolean(proofComplete && !blockedOrWaiting);
|
|
150
|
+
const explicitMergeReady = firstBooleanValue(record.merge_ready, stopCondition.merge_ready, raw.merge_ready, handoff.merge_ready);
|
|
151
|
+
const normalPrAllowed = firstBooleanValue(record.normal_pr_allowed, raw.normal_pr_allowed, handoff.normal_pr_allowed);
|
|
152
|
+
const baseHandoffAllowed = !blockedOrWaiting && !shipHeld && !shippingDisabled;
|
|
153
|
+
const mergeReady = baseHandoffAllowed && normalPrAllowed !== false && (explicitMergeReady ?? shipAuthorized);
|
|
154
|
+
const syncAllowed = mergeReady;
|
|
155
|
+
let policyState = "unknown";
|
|
156
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") policyState = "awaiting_checkpoint";
|
|
157
|
+
else if (status === "failed" || handoffState === "proof_failed") policyState = "proof_failed";
|
|
158
|
+
else if (status === "blocked" || handoffState === "proof_blocked" || handoffState === "proof_review_required") policyState = "proof_blocked";
|
|
159
|
+
else if (handoffState === "proof_complete_ship_disabled") policyState = "proof_complete_ship_disabled";
|
|
160
|
+
else if (proofComplete && shipHeld && !shipAuthorized) policyState = "proof_passed_ship_held";
|
|
161
|
+
else if (proofComplete && shippingDisabled && !shipAuthorized) policyState = "proof_complete_ship_disabled";
|
|
162
|
+
else if (shipAuthorized) policyState = "ship_authorized";
|
|
163
|
+
else if (proofPassed) policyState = "proof_passed";
|
|
164
|
+
else if (status === "running") policyState = "proof_in_progress";
|
|
165
|
+
const requiredDisclosures = [];
|
|
166
|
+
if (shipHeld) requiredDisclosures.push("ship_held");
|
|
167
|
+
if (shippingDisabled) requiredDisclosures.push("shipping_disabled");
|
|
168
|
+
if (checkpointSummary?.audit_disclosure_required) requiredDisclosures.push("checkpoint_audit_counters");
|
|
169
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") requiredDisclosures.push("checkpoint_required");
|
|
170
|
+
const prohibitedClaims = [];
|
|
171
|
+
if (!shipAuthorized || shipHeld || shippingDisabled) prohibitedClaims.push("ship_authorized", "shipped");
|
|
172
|
+
if (!mergeReady) prohibitedClaims.push("merge_ready");
|
|
173
|
+
if (!syncAllowed) prohibitedClaims.push("sync_allowed");
|
|
174
|
+
if (blockedOrWaiting) {
|
|
175
|
+
prohibitedClaims.push("proof_passed", "ready_to_ship");
|
|
176
|
+
}
|
|
177
|
+
if (checkpointSummary?.audit_disclosure_required) {
|
|
178
|
+
prohibitedClaims.push("all_checkpoint_responses_accepted");
|
|
179
|
+
}
|
|
180
|
+
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";
|
|
84
181
|
return {
|
|
182
|
+
status,
|
|
183
|
+
ok,
|
|
184
|
+
policy_state: policyState,
|
|
185
|
+
result_label: resultLabel,
|
|
186
|
+
proof_complete: proofComplete,
|
|
187
|
+
proof_passed: proofPassed,
|
|
85
188
|
ship_held: shipHeld,
|
|
86
189
|
shipping_disabled: shippingDisabled,
|
|
87
|
-
ship_authorized:
|
|
190
|
+
ship_authorized: shipAuthorized,
|
|
191
|
+
merge_ready: mergeReady,
|
|
192
|
+
sync_allowed: syncAllowed,
|
|
193
|
+
checkpoint_summary: checkpointSummary,
|
|
194
|
+
required_disclosures: uniqueStrings(requiredDisclosures),
|
|
195
|
+
prohibited_claims: uniqueStrings(prohibitedClaims)
|
|
88
196
|
};
|
|
89
197
|
}
|
|
90
198
|
|
|
199
|
+
// src/result.ts
|
|
200
|
+
function isTerminalStatus(status) {
|
|
201
|
+
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
202
|
+
}
|
|
203
|
+
function compactRecord(input) {
|
|
204
|
+
return Object.fromEntries(Object.entries(input).filter(([, value]) => value !== void 0 && value !== null && value !== ""));
|
|
205
|
+
}
|
|
206
|
+
function nonEmptyString(value) {
|
|
207
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
208
|
+
}
|
|
209
|
+
function recordValue(value) {
|
|
210
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
211
|
+
}
|
|
212
|
+
function publicStateForRunState(input) {
|
|
213
|
+
const state = input.state;
|
|
214
|
+
const status = input.status || state.status;
|
|
215
|
+
const raw = recordValue(input.raw) || {};
|
|
216
|
+
const extendedState = state;
|
|
217
|
+
const terminalOk = isTerminalStatus(status) ? state.ok : void 0;
|
|
218
|
+
return summarizeRiddleProofPublicState(compactRecord({
|
|
219
|
+
status,
|
|
220
|
+
ok: terminalOk,
|
|
221
|
+
request: state.request,
|
|
222
|
+
pr_state: state.pr_state,
|
|
223
|
+
marked_ready: state.marked_ready,
|
|
224
|
+
ship_held: state.ship_held,
|
|
225
|
+
shipping_disabled: state.shipping_disabled,
|
|
226
|
+
ship_authorized: state.ship_authorized,
|
|
227
|
+
ship_mode: state.request?.ship_mode,
|
|
228
|
+
merge_commit: state.merge_commit,
|
|
229
|
+
merged_at: state.merged_at,
|
|
230
|
+
checkpoint_summary: state.checkpoint_summary,
|
|
231
|
+
pr_handoff_policy: recordValue(extendedState.pr_handoff_policy),
|
|
232
|
+
merge_ready: extendedState.merge_ready,
|
|
233
|
+
normal_pr_allowed: extendedState.normal_pr_allowed,
|
|
234
|
+
raw: Object.keys(raw).length ? raw : void 0
|
|
235
|
+
}));
|
|
236
|
+
}
|
|
237
|
+
function publicMergeRecommendationForRunState(input) {
|
|
238
|
+
return riddleProofPublicStateMergeRecommendation(
|
|
239
|
+
publicStateForRunState(input),
|
|
240
|
+
input.state.merge_recommendation
|
|
241
|
+
);
|
|
242
|
+
}
|
|
243
|
+
|
|
91
244
|
// src/checkpoint.ts
|
|
92
245
|
var import_node_crypto = __toESM(require("crypto"), 1);
|
|
93
246
|
function statePathsForRunState(state, engineStatePath) {
|
|
@@ -257,7 +410,8 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
257
410
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
258
411
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
259
412
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
260
|
-
const
|
|
413
|
+
const publicState = publicStateForRunState({ state, status: state.status });
|
|
414
|
+
const publicMergeRecommendation = publicMergeRecommendationForRunState({ state, status: state.status });
|
|
261
415
|
return {
|
|
262
416
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
263
417
|
run_id: state.run_id || "unknown",
|
|
@@ -311,14 +465,18 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
311
465
|
stop_condition: compactRecord({
|
|
312
466
|
status: state.status,
|
|
313
467
|
terminal: isTerminalStatus(state.status),
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
468
|
+
result_label: publicState.result_label,
|
|
469
|
+
ship_held: publicState.ship_held,
|
|
470
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
471
|
+
ship_authorized: publicState.ship_authorized,
|
|
472
|
+
merge_ready: publicState.merge_ready,
|
|
473
|
+
sync_allowed: publicState.sync_allowed,
|
|
317
474
|
blocker_code: state.blocker?.code || null,
|
|
318
475
|
blocker_message: state.blocker?.message || null,
|
|
319
476
|
proof_decision: state.proof_decision,
|
|
320
|
-
merge_recommendation:
|
|
321
|
-
monitor_should_continue: !isTerminalStatus(state.status)
|
|
477
|
+
merge_recommendation: publicMergeRecommendation,
|
|
478
|
+
monitor_should_continue: !isTerminalStatus(state.status),
|
|
479
|
+
public_state: publicState
|
|
322
480
|
}),
|
|
323
481
|
updated_at: state.updated_at
|
|
324
482
|
};
|
package/dist/run-card.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RiddleProofRunState, RiddleProofStatePaths, RiddleProofRunCard } from './types.cjs';
|
|
2
|
+
import './public-state.cjs';
|
|
2
3
|
|
|
3
4
|
declare const RIDDLE_PROOF_RUN_CARD_VERSION: "riddle-proof.run-card.v1";
|
|
4
5
|
declare function createRiddleProofRunCard(state: RiddleProofRunState, input?: {
|
package/dist/run-card.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RiddleProofRunState, RiddleProofStatePaths, RiddleProofRunCard } from './types.js';
|
|
2
|
+
import './public-state.js';
|
|
2
3
|
|
|
3
4
|
declare const RIDDLE_PROOF_RUN_CARD_VERSION: "riddle-proof.run-card.v1";
|
|
4
5
|
declare function createRiddleProofRunCard(state: RiddleProofRunState, input?: {
|
package/dist/run-card.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
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-NXEAFQYZ.js";
|
|
5
|
+
import "./chunk-FX2CB4MG.js";
|
|
6
|
+
import "./chunk-QGMSN34W.js";
|
|
7
|
+
import "./chunk-WKIIJX3O.js";
|
|
7
8
|
import "./chunk-MLKGABMK.js";
|
|
8
9
|
export {
|
|
9
10
|
RIDDLE_PROOF_RUN_CARD_VERSION,
|
package/dist/runner.cjs
CHANGED
|
@@ -34,7 +34,171 @@ __export(runner_exports, {
|
|
|
34
34
|
});
|
|
35
35
|
module.exports = __toCommonJS(runner_exports);
|
|
36
36
|
|
|
37
|
+
// src/public-state.ts
|
|
38
|
+
function riddleProofPublicStateAllowsClaim(summary, claim) {
|
|
39
|
+
return !summary?.prohibited_claims.includes(claim);
|
|
40
|
+
}
|
|
41
|
+
function riddleProofPublicStateAllowsMergeRecommendation(summary) {
|
|
42
|
+
return riddleProofPublicStateAllowsClaim(summary, "merge_ready") && riddleProofPublicStateAllowsClaim(summary, "sync_allowed");
|
|
43
|
+
}
|
|
44
|
+
function riddleProofPublicStateMergeRecommendation(summary, recommendation) {
|
|
45
|
+
return recommendation && riddleProofPublicStateAllowsMergeRecommendation(summary) ? recommendation : void 0;
|
|
46
|
+
}
|
|
47
|
+
function asRecord(value) {
|
|
48
|
+
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
49
|
+
}
|
|
50
|
+
function stringValue(value) {
|
|
51
|
+
return typeof value === "string" && value.trim() ? value.trim() : void 0;
|
|
52
|
+
}
|
|
53
|
+
function booleanValue(value) {
|
|
54
|
+
return typeof value === "boolean" ? value : void 0;
|
|
55
|
+
}
|
|
56
|
+
function numberValue(value) {
|
|
57
|
+
return typeof value === "number" && Number.isFinite(value) ? value : void 0;
|
|
58
|
+
}
|
|
59
|
+
function firstStringValue(...values) {
|
|
60
|
+
for (const value of values) {
|
|
61
|
+
const text = stringValue(value);
|
|
62
|
+
if (text) return text;
|
|
63
|
+
}
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
function firstBooleanValue(...values) {
|
|
67
|
+
for (const value of values) {
|
|
68
|
+
const bool = booleanValue(value);
|
|
69
|
+
if (typeof bool === "boolean") return bool;
|
|
70
|
+
}
|
|
71
|
+
return void 0;
|
|
72
|
+
}
|
|
73
|
+
function firstRecordValue(...values) {
|
|
74
|
+
for (const value of values) {
|
|
75
|
+
const record = asRecord(value);
|
|
76
|
+
if (Object.keys(record).length) return record;
|
|
77
|
+
}
|
|
78
|
+
return void 0;
|
|
79
|
+
}
|
|
80
|
+
function countValue(value) {
|
|
81
|
+
const number = numberValue(value);
|
|
82
|
+
return typeof number === "number" && number > 0 ? Math.trunc(number) : 0;
|
|
83
|
+
}
|
|
84
|
+
function checkpointSummaryFrom(...values) {
|
|
85
|
+
const record = firstRecordValue(...values);
|
|
86
|
+
if (!record) return void 0;
|
|
87
|
+
const accepted = countValue(record.response_count);
|
|
88
|
+
const rejected = countValue(record.rejected_response_count);
|
|
89
|
+
const ignored = countValue(record.ignored_response_count);
|
|
90
|
+
const duplicate = countValue(record.duplicate_response_count);
|
|
91
|
+
const summary = {
|
|
92
|
+
pending: booleanValue(record.pending),
|
|
93
|
+
accepted_response_count: accepted,
|
|
94
|
+
rejected_response_count: rejected,
|
|
95
|
+
ignored_response_count: ignored,
|
|
96
|
+
duplicate_response_count: duplicate,
|
|
97
|
+
latest_decision: stringValue(record.latest_decision),
|
|
98
|
+
audit_disclosure_required: rejected > 0 || ignored > 0 || duplicate > 0
|
|
99
|
+
};
|
|
100
|
+
return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
|
|
101
|
+
}
|
|
102
|
+
function uniqueStrings(values) {
|
|
103
|
+
return [...new Set(values.filter(Boolean))];
|
|
104
|
+
}
|
|
105
|
+
function summarizeRiddleProofPublicState(input) {
|
|
106
|
+
const record = asRecord(input);
|
|
107
|
+
const runCard = asRecord(record.run_card);
|
|
108
|
+
const stopCondition = asRecord(runCard.stop_condition);
|
|
109
|
+
const raw = asRecord(record.raw);
|
|
110
|
+
const request = asRecord(record.request);
|
|
111
|
+
const requestMetadata = asRecord(record.request_metadata);
|
|
112
|
+
const prState = asRecord(record.pr_state);
|
|
113
|
+
const handoff = asRecord(record.pr_handoff_policy);
|
|
114
|
+
const handoffState = stringValue(handoff.state);
|
|
115
|
+
const status = firstStringValue(record.status, stopCondition.status);
|
|
116
|
+
const ok = booleanValue(record.ok) ?? null;
|
|
117
|
+
const shipMode = firstStringValue(request.ship_mode, requestMetadata.ship_mode, record.ship_mode, handoff.ship_mode);
|
|
118
|
+
const explicitShippingDisabled = firstBooleanValue(
|
|
119
|
+
record.shipping_disabled,
|
|
120
|
+
stopCondition.shipping_disabled,
|
|
121
|
+
raw.shipping_disabled,
|
|
122
|
+
handoff.shipping_disabled
|
|
123
|
+
);
|
|
124
|
+
const shippingDisabled = explicitShippingDisabled === true || shipMode === "none" || handoffState === "proof_complete_ship_disabled";
|
|
125
|
+
const explicitShipAuthorized = firstBooleanValue(
|
|
126
|
+
record.ship_authorized,
|
|
127
|
+
stopCondition.ship_authorized,
|
|
128
|
+
raw.ship_authorized
|
|
129
|
+
);
|
|
130
|
+
const authorizationEvidence = Boolean(
|
|
131
|
+
status === "shipped" || record.marked_ready === true || stringValue(prState.status) === "merged" || record.merge_commit || record.merged_at
|
|
132
|
+
);
|
|
133
|
+
const shipAuthorizedBeforeHold = explicitShipAuthorized ?? authorizationEvidence;
|
|
134
|
+
const explicitShipHeld = firstBooleanValue(record.ship_held, stopCondition.ship_held, raw.ship_held);
|
|
135
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !shipAuthorizedBeforeHold;
|
|
136
|
+
const shipHeld = explicitShipHeld === true || inferredHeld;
|
|
137
|
+
const shipAuthorized = shipHeld ? false : shipAuthorizedBeforeHold === true;
|
|
138
|
+
const proofComplete = Boolean(
|
|
139
|
+
status === "ready_to_ship" || status === "shipped" || status === "completed" || status === "passed" || ok === true || handoff.proof_complete === true
|
|
140
|
+
);
|
|
141
|
+
const checkpointSummary = checkpointSummaryFrom(
|
|
142
|
+
record.checkpoint_summary,
|
|
143
|
+
stopCondition.checkpoint_summary,
|
|
144
|
+
asRecord(record.details).checkpoint_summary,
|
|
145
|
+
asRecord(raw.details).checkpoint_summary
|
|
146
|
+
);
|
|
147
|
+
const blockedOrWaiting = status === "blocked" || status === "failed" || status === "awaiting_checkpoint" || handoffState === "proof_blocked" || handoffState === "proof_review_required" || handoffState === "proof_failed" || handoffState === "proof_checkpoint_required";
|
|
148
|
+
const proofPassed = Boolean(proofComplete && !blockedOrWaiting);
|
|
149
|
+
const explicitMergeReady = firstBooleanValue(record.merge_ready, stopCondition.merge_ready, raw.merge_ready, handoff.merge_ready);
|
|
150
|
+
const normalPrAllowed = firstBooleanValue(record.normal_pr_allowed, raw.normal_pr_allowed, handoff.normal_pr_allowed);
|
|
151
|
+
const baseHandoffAllowed = !blockedOrWaiting && !shipHeld && !shippingDisabled;
|
|
152
|
+
const mergeReady = baseHandoffAllowed && normalPrAllowed !== false && (explicitMergeReady ?? shipAuthorized);
|
|
153
|
+
const syncAllowed = mergeReady;
|
|
154
|
+
let policyState = "unknown";
|
|
155
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") policyState = "awaiting_checkpoint";
|
|
156
|
+
else if (status === "failed" || handoffState === "proof_failed") policyState = "proof_failed";
|
|
157
|
+
else if (status === "blocked" || handoffState === "proof_blocked" || handoffState === "proof_review_required") policyState = "proof_blocked";
|
|
158
|
+
else if (handoffState === "proof_complete_ship_disabled") policyState = "proof_complete_ship_disabled";
|
|
159
|
+
else if (proofComplete && shipHeld && !shipAuthorized) policyState = "proof_passed_ship_held";
|
|
160
|
+
else if (proofComplete && shippingDisabled && !shipAuthorized) policyState = "proof_complete_ship_disabled";
|
|
161
|
+
else if (shipAuthorized) policyState = "ship_authorized";
|
|
162
|
+
else if (proofPassed) policyState = "proof_passed";
|
|
163
|
+
else if (status === "running") policyState = "proof_in_progress";
|
|
164
|
+
const requiredDisclosures = [];
|
|
165
|
+
if (shipHeld) requiredDisclosures.push("ship_held");
|
|
166
|
+
if (shippingDisabled) requiredDisclosures.push("shipping_disabled");
|
|
167
|
+
if (checkpointSummary?.audit_disclosure_required) requiredDisclosures.push("checkpoint_audit_counters");
|
|
168
|
+
if (status === "awaiting_checkpoint" || handoffState === "proof_checkpoint_required") requiredDisclosures.push("checkpoint_required");
|
|
169
|
+
const prohibitedClaims = [];
|
|
170
|
+
if (!shipAuthorized || shipHeld || shippingDisabled) prohibitedClaims.push("ship_authorized", "shipped");
|
|
171
|
+
if (!mergeReady) prohibitedClaims.push("merge_ready");
|
|
172
|
+
if (!syncAllowed) prohibitedClaims.push("sync_allowed");
|
|
173
|
+
if (blockedOrWaiting) {
|
|
174
|
+
prohibitedClaims.push("proof_passed", "ready_to_ship");
|
|
175
|
+
}
|
|
176
|
+
if (checkpointSummary?.audit_disclosure_required) {
|
|
177
|
+
prohibitedClaims.push("all_checkpoint_responses_accepted");
|
|
178
|
+
}
|
|
179
|
+
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";
|
|
180
|
+
return {
|
|
181
|
+
status,
|
|
182
|
+
ok,
|
|
183
|
+
policy_state: policyState,
|
|
184
|
+
result_label: resultLabel,
|
|
185
|
+
proof_complete: proofComplete,
|
|
186
|
+
proof_passed: proofPassed,
|
|
187
|
+
ship_held: shipHeld,
|
|
188
|
+
shipping_disabled: shippingDisabled,
|
|
189
|
+
ship_authorized: shipAuthorized,
|
|
190
|
+
merge_ready: mergeReady,
|
|
191
|
+
sync_allowed: syncAllowed,
|
|
192
|
+
checkpoint_summary: checkpointSummary,
|
|
193
|
+
required_disclosures: uniqueStrings(requiredDisclosures),
|
|
194
|
+
prohibited_claims: uniqueStrings(prohibitedClaims)
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
37
198
|
// src/result.ts
|
|
199
|
+
function isTerminalStatus(status) {
|
|
200
|
+
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
201
|
+
}
|
|
38
202
|
function isProtectedFinalStatus(status) {
|
|
39
203
|
return status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
40
204
|
}
|
|
@@ -106,6 +270,31 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
106
270
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
107
271
|
return state;
|
|
108
272
|
}
|
|
273
|
+
function publicStateForRunState(input) {
|
|
274
|
+
const state = input.state;
|
|
275
|
+
const status = input.status || state.status;
|
|
276
|
+
const raw = recordValue(input.raw) || {};
|
|
277
|
+
const extendedState = state;
|
|
278
|
+
const terminalOk = isTerminalStatus(status) ? state.ok : void 0;
|
|
279
|
+
return summarizeRiddleProofPublicState(compactRecord({
|
|
280
|
+
status,
|
|
281
|
+
ok: terminalOk,
|
|
282
|
+
request: state.request,
|
|
283
|
+
pr_state: state.pr_state,
|
|
284
|
+
marked_ready: state.marked_ready,
|
|
285
|
+
ship_held: state.ship_held,
|
|
286
|
+
shipping_disabled: state.shipping_disabled,
|
|
287
|
+
ship_authorized: state.ship_authorized,
|
|
288
|
+
ship_mode: state.request?.ship_mode,
|
|
289
|
+
merge_commit: state.merge_commit,
|
|
290
|
+
merged_at: state.merged_at,
|
|
291
|
+
checkpoint_summary: state.checkpoint_summary,
|
|
292
|
+
pr_handoff_policy: recordValue(extendedState.pr_handoff_policy),
|
|
293
|
+
merge_ready: extendedState.merge_ready,
|
|
294
|
+
normal_pr_allowed: extendedState.normal_pr_allowed,
|
|
295
|
+
raw: Object.keys(raw).length ? raw : void 0
|
|
296
|
+
}));
|
|
297
|
+
}
|
|
109
298
|
function shipControlStateFor(input) {
|
|
110
299
|
const state = input.state;
|
|
111
300
|
const status = input.status || state.status;
|
|
@@ -154,6 +343,11 @@ function createRunResult(input) {
|
|
|
154
343
|
state.ok = ok;
|
|
155
344
|
if (isProtectedFinalStatus(status)) state.finalized = true;
|
|
156
345
|
applyShipControlState(state, { status, raw: input.raw });
|
|
346
|
+
const publicState = publicStateForRunState({ state, status, raw: input.raw });
|
|
347
|
+
const publicMergeRecommendation = riddleProofPublicStateMergeRecommendation(
|
|
348
|
+
publicState,
|
|
349
|
+
state.merge_recommendation
|
|
350
|
+
);
|
|
157
351
|
return compactRecord({
|
|
158
352
|
ok,
|
|
159
353
|
status,
|
|
@@ -171,9 +365,12 @@ function createRunResult(input) {
|
|
|
171
365
|
pr_state: state.pr_state,
|
|
172
366
|
marked_ready: state.marked_ready,
|
|
173
367
|
left_draft: state.left_draft,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
368
|
+
result_label: publicState.result_label,
|
|
369
|
+
ship_held: publicState.ship_held,
|
|
370
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
371
|
+
ship_authorized: publicState.ship_authorized,
|
|
372
|
+
merge_ready: publicState.merge_ready,
|
|
373
|
+
sync_allowed: publicState.sync_allowed,
|
|
177
374
|
ci_status: state.ci_status,
|
|
178
375
|
ship_commit: state.ship_commit,
|
|
179
376
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -187,7 +384,8 @@ function createRunResult(input) {
|
|
|
187
384
|
cleanup_report: state.cleanup_report,
|
|
188
385
|
notification: state.notification,
|
|
189
386
|
proof_decision: state.proof_decision,
|
|
190
|
-
merge_recommendation:
|
|
387
|
+
merge_recommendation: publicMergeRecommendation,
|
|
388
|
+
public_state: publicState,
|
|
191
389
|
finalized: state.finalized,
|
|
192
390
|
blocker: state.blocker,
|
|
193
391
|
checkpoint_packet: state.checkpoint_packet,
|
package/dist/runner.d.cts
CHANGED
package/dist/runner.d.ts
CHANGED
package/dist/runner.js
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runRiddleProof
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-XKNJ5OE4.js";
|
|
4
|
+
import "./chunk-UEY5SJG5.js";
|
|
5
|
+
import "./chunk-NXEAFQYZ.js";
|
|
6
6
|
import "./chunk-EKZXU6MU.js";
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-FX2CB4MG.js";
|
|
8
|
+
import "./chunk-QGMSN34W.js";
|
|
9
|
+
import "./chunk-WKIIJX3O.js";
|
|
9
10
|
import "./chunk-MLKGABMK.js";
|
|
10
11
|
export {
|
|
11
12
|
runRiddleProof
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
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';
|
|
2
2
|
import '../types.cjs';
|
|
3
|
+
import '../public-state.cjs';
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
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';
|
|
2
2
|
import '../types.js';
|
|
3
|
+
import '../public-state.js';
|
package/dist/spec/checkpoint.js
CHANGED
|
@@ -14,8 +14,9 @@ import {
|
|
|
14
14
|
normalizeCheckpointResponse,
|
|
15
15
|
proofContractFromAuthorCheckpointResponse,
|
|
16
16
|
statePathsForRunState
|
|
17
|
-
} from "../chunk-
|
|
18
|
-
import "../chunk-
|
|
17
|
+
} from "../chunk-FX2CB4MG.js";
|
|
18
|
+
import "../chunk-QGMSN34W.js";
|
|
19
|
+
import "../chunk-WKIIJX3O.js";
|
|
19
20
|
import "../chunk-MLKGABMK.js";
|
|
20
21
|
export {
|
|
21
22
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|