@riddledc/riddle-proof 0.8.58 → 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-ONOPGCID.js → chunk-AWRBSVNW.js} +4 -4
- package/dist/{chunk-MOTQNIZX.js → chunk-FX2CB4MG.js} +1 -1
- package/dist/{chunk-62XLYPMS.js → chunk-HZOILEGF.js} +15 -2
- 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 +473 -403
- 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 +248 -168
- 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 +19 -1
- package/dist/pr-comment.d.cts +2 -0
- package/dist/pr-comment.d.ts +2 -0
- 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/advanced/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/advanced/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
|
package/dist/checkpoint.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunState, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStage, RiddleProofProofContract, RiddleProofStatePaths } from './types.cjs';
|
|
2
|
+
import './public-state.cjs';
|
|
2
3
|
|
|
3
4
|
declare const RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: "riddle-proof.checkpoint.v1";
|
|
4
5
|
declare const RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: "riddle-proof.checkpoint_response.v1";
|
package/dist/checkpoint.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RiddleProofCheckpointResponse, RiddleProofRunParams, RiddleProofRunState, RiddleProofCheckpointPacket, RiddleProofCheckpointSummary, RiddleProofStage, RiddleProofProofContract, RiddleProofStatePaths } from './types.js';
|
|
2
|
+
import './public-state.js';
|
|
2
3
|
|
|
3
4
|
declare const RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: "riddle-proof.checkpoint.v1";
|
|
4
5
|
declare const RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: "riddle-proof.checkpoint_response.v1";
|
package/dist/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,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeIntegrationContext,
|
|
3
3
|
normalizeRunParams
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UEY5SJG5.js";
|
|
5
5
|
import {
|
|
6
6
|
compactRecord
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-QGMSN34W.js";
|
|
8
8
|
|
|
9
9
|
// src/openclaw.ts
|
|
10
10
|
function parseOpenClawAssertions(value) {
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
RIDDLE_PROOF_PR_COMMENT_MARKER,
|
|
8
8
|
buildRiddleProofPrCommentMarkdown,
|
|
9
9
|
summarizeRiddleProofPrComment
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-HZOILEGF.js";
|
|
11
11
|
import {
|
|
12
12
|
RIDDLE_PROOF_PROFILE_EVIDENCE_VERSION,
|
|
13
13
|
applyRiddleProofProfileArtifactCompleteness,
|
|
@@ -28,14 +28,14 @@ import {
|
|
|
28
28
|
createDisabledRiddleProofAgentAdapter,
|
|
29
29
|
readRiddleProofRunStatus,
|
|
30
30
|
runRiddleProofEngineHarness
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-PCEDAQPG.js";
|
|
32
32
|
import {
|
|
33
33
|
createCheckpointResponseTemplate
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-FX2CB4MG.js";
|
|
35
35
|
import {
|
|
36
36
|
createCodexExecAgentAdapter,
|
|
37
37
|
runCodexExecAgentDoctor
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-QPKY767W.js";
|
|
39
39
|
|
|
40
40
|
// src/cli.ts
|
|
41
41
|
import { spawnSync } from "child_process";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
|
+
riddleProofPublicStateAllowsMergeRecommendation,
|
|
2
3
|
summarizeRiddleProofPublicState
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-WKIIJX3O.js";
|
|
4
5
|
|
|
5
6
|
// src/pr-comment.ts
|
|
6
7
|
var RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
|
|
@@ -166,6 +167,8 @@ function summarizeRiddleProofPrComment(input) {
|
|
|
166
167
|
ship_held: publicState.ship_held,
|
|
167
168
|
shipping_disabled: publicState.shipping_disabled,
|
|
168
169
|
ship_authorized: publicState.ship_authorized,
|
|
170
|
+
merge_ready: publicState.merge_ready,
|
|
171
|
+
sync_allowed: publicState.sync_allowed,
|
|
169
172
|
proof_decision: firstStringValue(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
|
|
170
173
|
merge_recommendation: firstStringValue(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
|
|
171
174
|
checkpoint_summary: checkpointSummary,
|
|
@@ -215,6 +218,13 @@ function formatBool(value) {
|
|
|
215
218
|
function hasShipControl(summary) {
|
|
216
219
|
return typeof summary.ship_held === "boolean" || typeof summary.shipping_disabled === "boolean" || typeof summary.ship_authorized === "boolean";
|
|
217
220
|
}
|
|
221
|
+
function hasHandoffControl(summary) {
|
|
222
|
+
return typeof summary.merge_ready === "boolean" || typeof summary.sync_allowed === "boolean";
|
|
223
|
+
}
|
|
224
|
+
function shouldRenderMergeRecommendation(summary) {
|
|
225
|
+
if (!summary.merge_recommendation) return false;
|
|
226
|
+
return riddleProofPublicStateAllowsMergeRecommendation(summary.public_state);
|
|
227
|
+
}
|
|
218
228
|
function checkpointSummaryLine(summary) {
|
|
219
229
|
const accepted = summary.response_count ?? 0;
|
|
220
230
|
const rejected = summary.rejected_response_count ?? 0;
|
|
@@ -246,8 +256,11 @@ function buildRiddleProofPrCommentMarkdown(input) {
|
|
|
246
256
|
if (hasShipControl(summary)) {
|
|
247
257
|
lines.push(`**Ship control:** held=${formatBool(summary.ship_held)}, shipping_disabled=${formatBool(summary.shipping_disabled)}, authorized=${formatBool(summary.ship_authorized)}`);
|
|
248
258
|
}
|
|
259
|
+
if (hasHandoffControl(summary)) {
|
|
260
|
+
lines.push(`**Handoff:** merge_ready=${formatBool(summary.merge_ready)}, sync_allowed=${formatBool(summary.sync_allowed)}`);
|
|
261
|
+
}
|
|
249
262
|
if (summary.proof_decision) lines.push(`**Proof decision:** \`${summary.proof_decision}\``);
|
|
250
|
-
if (summary
|
|
263
|
+
if (shouldRenderMergeRecommendation(summary)) lines.push(`**Merge recommendation:** ${summary.merge_recommendation}`);
|
|
251
264
|
if (summary.checkpoint_summary) lines.push(`**Checkpoints:** ${checkpointSummaryLine(summary.checkpoint_summary)}`);
|
|
252
265
|
if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
|
|
253
266
|
if (summary.preview_id || summary.preview_url) {
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
statePathsForRunState
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FX2CB4MG.js";
|
|
4
4
|
import {
|
|
5
5
|
compactRecord,
|
|
6
6
|
isTerminalStatus,
|
|
7
7
|
nonEmptyString,
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
publicMergeRecommendationForRunState,
|
|
9
|
+
publicStateForRunState,
|
|
10
|
+
recordValue
|
|
11
|
+
} from "./chunk-QGMSN34W.js";
|
|
11
12
|
|
|
12
13
|
// src/run-card.ts
|
|
13
14
|
var RIDDLE_PROOF_RUN_CARD_VERSION = "riddle-proof.run-card.v1";
|
|
@@ -168,7 +169,8 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
168
169
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
169
170
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
170
171
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
171
|
-
const
|
|
172
|
+
const publicState = publicStateForRunState({ state, status: state.status });
|
|
173
|
+
const publicMergeRecommendation = publicMergeRecommendationForRunState({ state, status: state.status });
|
|
172
174
|
return {
|
|
173
175
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
174
176
|
run_id: state.run_id || "unknown",
|
|
@@ -222,14 +224,18 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
222
224
|
stop_condition: compactRecord({
|
|
223
225
|
status: state.status,
|
|
224
226
|
terminal: isTerminalStatus(state.status),
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
227
|
+
result_label: publicState.result_label,
|
|
228
|
+
ship_held: publicState.ship_held,
|
|
229
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
230
|
+
ship_authorized: publicState.ship_authorized,
|
|
231
|
+
merge_ready: publicState.merge_ready,
|
|
232
|
+
sync_allowed: publicState.sync_allowed,
|
|
228
233
|
blocker_code: state.blocker?.code || null,
|
|
229
234
|
blocker_message: state.blocker?.message || null,
|
|
230
235
|
proof_decision: state.proof_decision,
|
|
231
|
-
merge_recommendation:
|
|
232
|
-
monitor_should_continue: !isTerminalStatus(state.status)
|
|
236
|
+
merge_recommendation: publicMergeRecommendation,
|
|
237
|
+
monitor_should_continue: !isTerminalStatus(state.status),
|
|
238
|
+
public_state: publicState
|
|
233
239
|
}),
|
|
234
240
|
updated_at: state.updated_at
|
|
235
241
|
};
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
createRunStatusSnapshot,
|
|
6
6
|
normalizeRunParams,
|
|
7
7
|
setRunStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-UEY5SJG5.js";
|
|
9
9
|
import {
|
|
10
10
|
createRiddleProofRunCard
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NXEAFQYZ.js";
|
|
12
12
|
import {
|
|
13
13
|
canonicalProofAssessmentStageForDecision,
|
|
14
14
|
noImplementationModeFor,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
normalizeCheckpointResponse,
|
|
28
28
|
proofContractFromAuthorCheckpointResponse,
|
|
29
29
|
statePathsForRunState
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-FX2CB4MG.js";
|
|
31
31
|
import {
|
|
32
32
|
applyShipControlState,
|
|
33
33
|
applyTerminalMetadata,
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
nonEmptyString,
|
|
38
38
|
normalizeTerminalMetadata,
|
|
39
39
|
recordValue
|
|
40
|
-
} from "./chunk-
|
|
40
|
+
} from "./chunk-QGMSN34W.js";
|
|
41
41
|
import {
|
|
42
42
|
__export
|
|
43
43
|
} from "./chunk-MLKGABMK.js";
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
riddleProofPublicStateMergeRecommendation,
|
|
3
|
+
summarizeRiddleProofPublicState
|
|
4
|
+
} from "./chunk-WKIIJX3O.js";
|
|
5
|
+
|
|
1
6
|
// src/result.ts
|
|
2
7
|
function isTerminalStatus(status) {
|
|
3
8
|
return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
|
|
@@ -172,6 +177,37 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
172
177
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
173
178
|
return state;
|
|
174
179
|
}
|
|
180
|
+
function publicStateForRunState(input) {
|
|
181
|
+
const state = input.state;
|
|
182
|
+
const status = input.status || state.status;
|
|
183
|
+
const raw = recordValue(input.raw) || {};
|
|
184
|
+
const extendedState = state;
|
|
185
|
+
const terminalOk = isTerminalStatus(status) ? state.ok : void 0;
|
|
186
|
+
return summarizeRiddleProofPublicState(compactRecord({
|
|
187
|
+
status,
|
|
188
|
+
ok: terminalOk,
|
|
189
|
+
request: state.request,
|
|
190
|
+
pr_state: state.pr_state,
|
|
191
|
+
marked_ready: state.marked_ready,
|
|
192
|
+
ship_held: state.ship_held,
|
|
193
|
+
shipping_disabled: state.shipping_disabled,
|
|
194
|
+
ship_authorized: state.ship_authorized,
|
|
195
|
+
ship_mode: state.request?.ship_mode,
|
|
196
|
+
merge_commit: state.merge_commit,
|
|
197
|
+
merged_at: state.merged_at,
|
|
198
|
+
checkpoint_summary: state.checkpoint_summary,
|
|
199
|
+
pr_handoff_policy: recordValue(extendedState.pr_handoff_policy),
|
|
200
|
+
merge_ready: extendedState.merge_ready,
|
|
201
|
+
normal_pr_allowed: extendedState.normal_pr_allowed,
|
|
202
|
+
raw: Object.keys(raw).length ? raw : void 0
|
|
203
|
+
}));
|
|
204
|
+
}
|
|
205
|
+
function publicMergeRecommendationForRunState(input) {
|
|
206
|
+
return riddleProofPublicStateMergeRecommendation(
|
|
207
|
+
publicStateForRunState(input),
|
|
208
|
+
input.state.merge_recommendation
|
|
209
|
+
);
|
|
210
|
+
}
|
|
175
211
|
function shipControlStateFor(input) {
|
|
176
212
|
const state = input.state;
|
|
177
213
|
const status = input.status || state.status;
|
|
@@ -220,6 +256,11 @@ function createRunResult(input) {
|
|
|
220
256
|
state.ok = ok;
|
|
221
257
|
if (isProtectedFinalStatus(status)) state.finalized = true;
|
|
222
258
|
applyShipControlState(state, { status, raw: input.raw });
|
|
259
|
+
const publicState = publicStateForRunState({ state, status, raw: input.raw });
|
|
260
|
+
const publicMergeRecommendation = riddleProofPublicStateMergeRecommendation(
|
|
261
|
+
publicState,
|
|
262
|
+
state.merge_recommendation
|
|
263
|
+
);
|
|
223
264
|
return compactRecord({
|
|
224
265
|
ok,
|
|
225
266
|
status,
|
|
@@ -237,9 +278,12 @@ function createRunResult(input) {
|
|
|
237
278
|
pr_state: state.pr_state,
|
|
238
279
|
marked_ready: state.marked_ready,
|
|
239
280
|
left_draft: state.left_draft,
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
281
|
+
result_label: publicState.result_label,
|
|
282
|
+
ship_held: publicState.ship_held,
|
|
283
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
284
|
+
ship_authorized: publicState.ship_authorized,
|
|
285
|
+
merge_ready: publicState.merge_ready,
|
|
286
|
+
sync_allowed: publicState.sync_allowed,
|
|
243
287
|
ci_status: state.ci_status,
|
|
244
288
|
ship_commit: state.ship_commit,
|
|
245
289
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -253,7 +297,8 @@ function createRunResult(input) {
|
|
|
253
297
|
cleanup_report: state.cleanup_report,
|
|
254
298
|
notification: state.notification,
|
|
255
299
|
proof_decision: state.proof_decision,
|
|
256
|
-
merge_recommendation:
|
|
300
|
+
merge_recommendation: publicMergeRecommendation,
|
|
301
|
+
public_state: publicState,
|
|
257
302
|
finalized: state.finalized,
|
|
258
303
|
blocker: state.blocker,
|
|
259
304
|
checkpoint_packet: state.checkpoint_packet,
|
|
@@ -277,6 +322,8 @@ export {
|
|
|
277
322
|
recordValue,
|
|
278
323
|
normalizeTerminalMetadata,
|
|
279
324
|
applyTerminalMetadata,
|
|
325
|
+
publicStateForRunState,
|
|
326
|
+
publicMergeRecommendationForRunState,
|
|
280
327
|
shipControlStateFor,
|
|
281
328
|
applyShipControlState,
|
|
282
329
|
createRunResult
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRiddleProofRunCard
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NXEAFQYZ.js";
|
|
4
4
|
import {
|
|
5
5
|
compactRecord,
|
|
6
6
|
isProtectedFinalStatus,
|
|
7
7
|
isTerminalStatus,
|
|
8
8
|
nonEmptyString,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} from "./chunk-
|
|
9
|
+
publicStateForRunState,
|
|
10
|
+
recordValue
|
|
11
|
+
} from "./chunk-QGMSN34W.js";
|
|
12
12
|
|
|
13
13
|
// src/state.ts
|
|
14
14
|
var RIDDLE_PROOF_RUN_STATE_VERSION = "riddle-proof.run-state.v1";
|
|
@@ -190,8 +190,8 @@ function appendStageHeartbeat(state, input) {
|
|
|
190
190
|
function createRunStatusSnapshot(state, at = timestamp()) {
|
|
191
191
|
const latestEvent = state.events[state.events.length - 1];
|
|
192
192
|
const runId = state.run_id || "unknown";
|
|
193
|
-
const
|
|
194
|
-
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 ===
|
|
193
|
+
const publicState = publicStateForRunState({ state, status: state.status });
|
|
194
|
+
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;
|
|
195
195
|
const runCard = existingRunCardCurrent ? state.run_card : createRiddleProofRunCard(state, { at });
|
|
196
196
|
return compactRecord({
|
|
197
197
|
run_id: runId,
|
|
@@ -205,9 +205,13 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
205
205
|
pr_url: state.pr_url ?? null,
|
|
206
206
|
pr_branch: state.pr_branch ?? null,
|
|
207
207
|
pr_state: state.pr_state,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
result_label: publicState.result_label,
|
|
209
|
+
ship_held: publicState.ship_held,
|
|
210
|
+
shipping_disabled: publicState.shipping_disabled,
|
|
211
|
+
ship_authorized: publicState.ship_authorized,
|
|
212
|
+
merge_ready: publicState.merge_ready,
|
|
213
|
+
sync_allowed: publicState.sync_allowed,
|
|
214
|
+
public_state: publicState,
|
|
211
215
|
ci_status: state.ci_status,
|
|
212
216
|
ship_commit: state.ship_commit,
|
|
213
217
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
// src/public-state.ts
|
|
2
|
+
function riddleProofPublicStateAllowsClaim(summary, claim) {
|
|
3
|
+
return !summary?.prohibited_claims.includes(claim);
|
|
4
|
+
}
|
|
5
|
+
function riddleProofPublicStateAllowsMergeRecommendation(summary) {
|
|
6
|
+
return riddleProofPublicStateAllowsClaim(summary, "merge_ready") && riddleProofPublicStateAllowsClaim(summary, "sync_allowed");
|
|
7
|
+
}
|
|
8
|
+
function riddleProofPublicStateMergeRecommendation(summary, recommendation) {
|
|
9
|
+
return recommendation && riddleProofPublicStateAllowsMergeRecommendation(summary) ? recommendation : void 0;
|
|
10
|
+
}
|
|
2
11
|
function asRecord(value) {
|
|
3
12
|
return value && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
4
13
|
}
|
|
@@ -151,5 +160,8 @@ function summarizeRiddleProofPublicState(input) {
|
|
|
151
160
|
}
|
|
152
161
|
|
|
153
162
|
export {
|
|
163
|
+
riddleProofPublicStateAllowsClaim,
|
|
164
|
+
riddleProofPublicStateAllowsMergeRecommendation,
|
|
165
|
+
riddleProofPublicStateMergeRecommendation,
|
|
154
166
|
summarizeRiddleProofPublicState
|
|
155
167
|
};
|