@riddledc/riddle-proof 0.8.53 → 0.8.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/adapters/codex-exec-agent.js +2 -2
- package/dist/adapters/codex.js +2 -2
- package/dist/adapters/local-agent.js +2 -2
- package/dist/adapters/openclaw.js +5 -5
- package/dist/advanced/engine-harness.cjs +128 -3
- package/dist/advanced/engine-harness.js +5 -5
- package/dist/advanced/index.cjs +129 -4
- package/dist/advanced/index.d.cts +1 -1
- package/dist/advanced/index.d.ts +1 -1
- package/dist/advanced/index.js +6 -6
- package/dist/advanced/proof-run-engine.d.cts +1 -1
- package/dist/advanced/proof-run-engine.d.ts +1 -1
- package/dist/advanced/runner.cjs +54 -1
- package/dist/advanced/runner.js +5 -5
- package/dist/checkpoint.js +2 -2
- package/dist/{chunk-S5DX7Z6X.js → chunk-F65S5LT2.js} +3 -3
- package/dist/{chunk-LNWJAHAQ.js → chunk-J2ZNL3H3.js} +2 -2
- package/dist/{chunk-2ALMXMFZ.js → chunk-MYMTAVGP.js} +3 -3
- package/dist/{chunk-JJ4IWRMJ.js → chunk-NYRMPWJB.js} +8 -3
- package/dist/{chunk-WDIKPIMB.js → chunk-Q5GYD5RG.js} +9 -4
- package/dist/{chunk-ZLBOGPUL.js → chunk-QGE3KBRL.js} +74 -6
- package/dist/{chunk-BLM5EIBA.js → chunk-QUK3SG24.js} +1 -1
- package/dist/{chunk-73EBR3YL.js → chunk-SONWF3FQ.js} +1 -1
- package/dist/{chunk-VY4Y5U57.js → chunk-W44XEGYW.js} +52 -0
- package/dist/cli/index.js +7 -7
- package/dist/cli.cjs +128 -3
- package/dist/cli.js +7 -7
- package/dist/codex-exec-agent.js +2 -2
- package/dist/engine-harness.cjs +128 -3
- package/dist/engine-harness.js +5 -5
- package/dist/index.cjs +133 -4
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -8
- package/dist/local-agent.js +2 -2
- package/dist/openclaw.js +5 -5
- package/dist/{proof-run-engine-DpChFR5H.d.cts → proof-run-engine-Baiv6l3A.d.cts} +3 -3
- package/dist/{proof-run-engine-BqRoA3Do.d.ts → proof-run-engine-MiKZt9oY.d.ts} +3 -3
- package/dist/proof-run-engine.d.cts +1 -1
- package/dist/proof-run-engine.d.ts +1 -1
- package/dist/result.cjs +56 -2
- package/dist/result.d.cts +16 -2
- package/dist/result.d.ts +16 -2
- package/dist/result.js +7 -3
- package/dist/run-card.cjs +43 -0
- package/dist/run-card.js +3 -3
- package/dist/runner.cjs +54 -1
- package/dist/runner.js +5 -5
- package/dist/spec/checkpoint.js +2 -2
- package/dist/spec/index.cjs +63 -1
- package/dist/spec/index.d.cts +1 -1
- package/dist/spec/index.d.ts +1 -1
- package/dist/spec/index.js +9 -5
- package/dist/spec/result.cjs +56 -2
- package/dist/spec/result.d.cts +1 -1
- package/dist/spec/result.d.ts +1 -1
- package/dist/spec/result.js +7 -3
- package/dist/spec/run-card.cjs +43 -0
- package/dist/spec/run-card.js +3 -3
- package/dist/spec/state.cjs +48 -1
- package/dist/spec/state.js +4 -4
- package/dist/state.cjs +48 -1
- package/dist/state.js +4 -4
- package/dist/types.d.cts +15 -0
- package/dist/types.d.ts +15 -0
- package/package.json +1 -1
package/dist/advanced/runner.cjs
CHANGED
|
@@ -47,6 +47,12 @@ function nonEmptyString(value) {
|
|
|
47
47
|
function recordValue(value) {
|
|
48
48
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
49
49
|
}
|
|
50
|
+
function firstBoolean(...values) {
|
|
51
|
+
for (const value of values) {
|
|
52
|
+
if (typeof value === "boolean") return value;
|
|
53
|
+
}
|
|
54
|
+
return void 0;
|
|
55
|
+
}
|
|
50
56
|
function applyTerminalMetadata(state, metadata) {
|
|
51
57
|
if (metadata.pr_state) {
|
|
52
58
|
state.pr_state = metadata.pr_state;
|
|
@@ -63,6 +69,9 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
63
69
|
if (prBranch) state.pr_branch = prBranch;
|
|
64
70
|
if (typeof metadata.marked_ready === "boolean") state.marked_ready = metadata.marked_ready;
|
|
65
71
|
if (typeof metadata.left_draft === "boolean") state.left_draft = metadata.left_draft;
|
|
72
|
+
if (typeof metadata.ship_held === "boolean") state.ship_held = metadata.ship_held;
|
|
73
|
+
if (typeof metadata.shipping_disabled === "boolean") state.shipping_disabled = metadata.shipping_disabled;
|
|
74
|
+
if (typeof metadata.ship_authorized === "boolean") state.ship_authorized = metadata.ship_authorized;
|
|
66
75
|
const ciStatus = nonEmptyString(metadata.ci_status);
|
|
67
76
|
if (ciStatus) state.ci_status = ciStatus;
|
|
68
77
|
const shipCommit = nonEmptyString(metadata.ship_commit);
|
|
@@ -94,12 +103,53 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
94
103
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
95
104
|
return state;
|
|
96
105
|
}
|
|
106
|
+
function shipControlStateFor(input) {
|
|
107
|
+
const state = input.state;
|
|
108
|
+
const status = input.status || state.status;
|
|
109
|
+
const raw = recordValue(input.raw) || {};
|
|
110
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
111
|
+
const prState = recordValue(state.pr_state) || {};
|
|
112
|
+
const shippingDisabled = firstBoolean(
|
|
113
|
+
raw.shipping_disabled,
|
|
114
|
+
raw.shippingDisabled,
|
|
115
|
+
state.shipping_disabled,
|
|
116
|
+
shipReport.shipping_disabled,
|
|
117
|
+
shipReport.shippingDisabled
|
|
118
|
+
) ?? state.request?.ship_mode === "none";
|
|
119
|
+
const explicitAuthorized = firstBoolean(
|
|
120
|
+
raw.ship_authorized,
|
|
121
|
+
raw.shipAuthorized,
|
|
122
|
+
state.ship_authorized,
|
|
123
|
+
shipReport.ship_authorized,
|
|
124
|
+
shipReport.shipAuthorized
|
|
125
|
+
);
|
|
126
|
+
const authorizationEvidence = Boolean(
|
|
127
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
128
|
+
);
|
|
129
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
130
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
131
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
132
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
133
|
+
return {
|
|
134
|
+
ship_held: shipHeld,
|
|
135
|
+
shipping_disabled: shippingDisabled,
|
|
136
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function applyShipControlState(state, input = {}) {
|
|
140
|
+
const control = shipControlStateFor({ state, status: input.status, raw: input.raw });
|
|
141
|
+
state.ship_held = control.ship_held;
|
|
142
|
+
state.shipping_disabled = control.shipping_disabled;
|
|
143
|
+
state.ship_authorized = control.ship_authorized;
|
|
144
|
+
return state;
|
|
145
|
+
}
|
|
97
146
|
function createRunResult(input) {
|
|
98
147
|
const status = input.status || input.state.status;
|
|
99
148
|
const ok = isSuccessfulStatus(status);
|
|
100
149
|
const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
|
|
101
150
|
state.status = status;
|
|
102
151
|
state.ok = ok;
|
|
152
|
+
applyShipControlState(state, { status, raw: input.raw });
|
|
103
153
|
return compactRecord({
|
|
104
154
|
ok,
|
|
105
155
|
status,
|
|
@@ -117,6 +167,9 @@ function createRunResult(input) {
|
|
|
117
167
|
pr_state: state.pr_state,
|
|
118
168
|
marked_ready: state.marked_ready,
|
|
119
169
|
left_draft: state.left_draft,
|
|
170
|
+
ship_held: state.ship_held,
|
|
171
|
+
shipping_disabled: state.shipping_disabled,
|
|
172
|
+
ship_authorized: state.ship_authorized,
|
|
120
173
|
ci_status: state.ci_status,
|
|
121
174
|
ship_commit: state.ship_commit,
|
|
122
175
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -770,7 +823,7 @@ async function runRiddleProof(input) {
|
|
|
770
823
|
status: "ready_to_ship",
|
|
771
824
|
last_summary: assessment.summary,
|
|
772
825
|
evidence_bundle: evidenceBundle,
|
|
773
|
-
raw: { implementation, assessment }
|
|
826
|
+
raw: { implementation, assessment, ship_held: true, shipping_disabled: true, ship_authorized: false }
|
|
774
827
|
});
|
|
775
828
|
return notifyIfConfigured({ state, result: result2, notification: adapters.notification });
|
|
776
829
|
}
|
package/dist/advanced/runner.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runRiddleProof
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-F65S5LT2.js";
|
|
4
|
+
import "../chunk-Q5GYD5RG.js";
|
|
5
|
+
import "../chunk-NYRMPWJB.js";
|
|
6
6
|
import "../chunk-EKZXU6MU.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
7
|
+
import "../chunk-QUK3SG24.js";
|
|
8
|
+
import "../chunk-W44XEGYW.js";
|
|
9
9
|
import "../chunk-MLKGABMK.js";
|
|
10
10
|
export {
|
|
11
11
|
runRiddleProof
|
package/dist/checkpoint.js
CHANGED
|
@@ -14,8 +14,8 @@ import {
|
|
|
14
14
|
normalizeCheckpointResponse,
|
|
15
15
|
proofContractFromAuthorCheckpointResponse,
|
|
16
16
|
statePathsForRunState
|
|
17
|
-
} from "./chunk-
|
|
18
|
-
import "./chunk-
|
|
17
|
+
} from "./chunk-QUK3SG24.js";
|
|
18
|
+
import "./chunk-W44XEGYW.js";
|
|
19
19
|
import "./chunk-MLKGABMK.js";
|
|
20
20
|
export {
|
|
21
21
|
RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
|
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
appendStageHeartbeat,
|
|
4
4
|
createRunState,
|
|
5
5
|
setRunStatus
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-Q5GYD5RG.js";
|
|
7
7
|
import {
|
|
8
8
|
noImplementationModeFor
|
|
9
9
|
} from "./chunk-EKZXU6MU.js";
|
|
10
10
|
import {
|
|
11
11
|
createRunResult
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-W44XEGYW.js";
|
|
13
13
|
import {
|
|
14
14
|
__export
|
|
15
15
|
} from "./chunk-MLKGABMK.js";
|
|
@@ -454,7 +454,7 @@ async function runRiddleProof(input) {
|
|
|
454
454
|
status: "ready_to_ship",
|
|
455
455
|
last_summary: assessment.summary,
|
|
456
456
|
evidence_bundle: evidenceBundle,
|
|
457
|
-
raw: { implementation, assessment }
|
|
457
|
+
raw: { implementation, assessment, ship_held: true, shipping_disabled: true, ship_authorized: false }
|
|
458
458
|
});
|
|
459
459
|
return notifyIfConfigured({ state, result: result2, notification: adapters.notification });
|
|
460
460
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeIntegrationContext,
|
|
3
3
|
normalizeRunParams
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-Q5GYD5RG.js";
|
|
5
5
|
import {
|
|
6
6
|
compactRecord
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-W44XEGYW.js";
|
|
8
8
|
|
|
9
9
|
// src/openclaw.ts
|
|
10
10
|
function parseOpenClawAssertions(value) {
|
|
@@ -28,14 +28,14 @@ import {
|
|
|
28
28
|
createDisabledRiddleProofAgentAdapter,
|
|
29
29
|
readRiddleProofRunStatus,
|
|
30
30
|
runRiddleProofEngineHarness
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-QGE3KBRL.js";
|
|
32
32
|
import {
|
|
33
33
|
createCheckpointResponseTemplate
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-QUK3SG24.js";
|
|
35
35
|
import {
|
|
36
36
|
createCodexExecAgentAdapter,
|
|
37
37
|
runCodexExecAgentDoctor
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-SONWF3FQ.js";
|
|
39
39
|
|
|
40
40
|
// src/cli.ts
|
|
41
41
|
import { spawnSync } from "child_process";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
statePathsForRunState
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QUK3SG24.js";
|
|
4
4
|
import {
|
|
5
5
|
compactRecord,
|
|
6
6
|
isTerminalStatus,
|
|
7
7
|
nonEmptyString,
|
|
8
|
-
recordValue
|
|
9
|
-
|
|
8
|
+
recordValue,
|
|
9
|
+
shipControlStateFor
|
|
10
|
+
} from "./chunk-W44XEGYW.js";
|
|
10
11
|
|
|
11
12
|
// src/run-card.ts
|
|
12
13
|
var RIDDLE_PROOF_RUN_CARD_VERSION = "riddle-proof.run-card.v1";
|
|
@@ -167,6 +168,7 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
167
168
|
const visualDelta = visualDeltaFrom({ fullRiddleState: fullState, runState: state });
|
|
168
169
|
const artifacts = artifactsFrom({ fullRiddleState: fullState, runState: state });
|
|
169
170
|
const viewportMatrix = viewportMatrixFrom({ fullRiddleState: fullState, runState: state });
|
|
171
|
+
const shipControl = shipControlStateFor({ state });
|
|
170
172
|
return {
|
|
171
173
|
version: RIDDLE_PROOF_RUN_CARD_VERSION,
|
|
172
174
|
run_id: state.run_id || "unknown",
|
|
@@ -220,6 +222,9 @@ function createRiddleProofRunCard(state, input = {}) {
|
|
|
220
222
|
stop_condition: compactRecord({
|
|
221
223
|
status: state.status,
|
|
222
224
|
terminal: isTerminalStatus(state.status),
|
|
225
|
+
ship_held: shipControl.ship_held,
|
|
226
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
227
|
+
ship_authorized: shipControl.ship_authorized,
|
|
223
228
|
blocker_code: state.blocker?.code || null,
|
|
224
229
|
blocker_message: state.blocker?.message || null,
|
|
225
230
|
proof_decision: state.proof_decision,
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createRiddleProofRunCard
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NYRMPWJB.js";
|
|
4
4
|
import {
|
|
5
5
|
compactRecord,
|
|
6
6
|
isTerminalStatus,
|
|
7
7
|
nonEmptyString,
|
|
8
|
-
recordValue
|
|
9
|
-
|
|
8
|
+
recordValue,
|
|
9
|
+
shipControlStateFor
|
|
10
|
+
} from "./chunk-W44XEGYW.js";
|
|
10
11
|
|
|
11
12
|
// src/state.ts
|
|
12
13
|
var RIDDLE_PROOF_RUN_STATE_VERSION = "riddle-proof.run-state.v1";
|
|
@@ -188,7 +189,8 @@ function appendStageHeartbeat(state, input) {
|
|
|
188
189
|
function createRunStatusSnapshot(state, at = timestamp()) {
|
|
189
190
|
const latestEvent = state.events[state.events.length - 1];
|
|
190
191
|
const runId = state.run_id || "unknown";
|
|
191
|
-
const
|
|
192
|
+
const shipControl = shipControlStateFor({ state });
|
|
193
|
+
const existingRunCardCurrent = state.run_card?.status === state.status && state.run_card.stop_condition?.status === state.status && state.run_card.stop_condition?.terminal === isTerminalStatus(state.status) && state.run_card.stop_condition?.monitor_should_continue === !isTerminalStatus(state.status) && state.run_card.stop_condition?.ship_held === shipControl.ship_held && state.run_card.stop_condition?.shipping_disabled === shipControl.shipping_disabled && state.run_card.stop_condition?.ship_authorized === shipControl.ship_authorized;
|
|
192
194
|
const runCard = existingRunCardCurrent ? state.run_card : createRiddleProofRunCard(state, { at });
|
|
193
195
|
return compactRecord({
|
|
194
196
|
run_id: runId,
|
|
@@ -202,6 +204,9 @@ function createRunStatusSnapshot(state, at = timestamp()) {
|
|
|
202
204
|
pr_url: state.pr_url ?? null,
|
|
203
205
|
pr_branch: state.pr_branch ?? null,
|
|
204
206
|
pr_state: state.pr_state,
|
|
207
|
+
ship_held: shipControl.ship_held,
|
|
208
|
+
shipping_disabled: shipControl.shipping_disabled,
|
|
209
|
+
ship_authorized: shipControl.ship_authorized,
|
|
205
210
|
ci_status: state.ci_status,
|
|
206
211
|
ship_commit: state.ship_commit,
|
|
207
212
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
createRunStatusSnapshot,
|
|
6
6
|
normalizeRunParams,
|
|
7
7
|
setRunStatus
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-Q5GYD5RG.js";
|
|
9
9
|
import {
|
|
10
10
|
createRiddleProofRunCard
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-NYRMPWJB.js";
|
|
12
12
|
import {
|
|
13
13
|
canonicalProofAssessmentStageForDecision,
|
|
14
14
|
noImplementationModeFor,
|
|
@@ -27,15 +27,16 @@ import {
|
|
|
27
27
|
normalizeCheckpointResponse,
|
|
28
28
|
proofContractFromAuthorCheckpointResponse,
|
|
29
29
|
statePathsForRunState
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-QUK3SG24.js";
|
|
31
31
|
import {
|
|
32
|
+
applyShipControlState,
|
|
32
33
|
applyTerminalMetadata,
|
|
33
34
|
compactRecord,
|
|
34
35
|
createRunResult,
|
|
35
36
|
nonEmptyString,
|
|
36
37
|
normalizeTerminalMetadata,
|
|
37
38
|
recordValue
|
|
38
|
-
} from "./chunk-
|
|
39
|
+
} from "./chunk-W44XEGYW.js";
|
|
39
40
|
import {
|
|
40
41
|
__export
|
|
41
42
|
} from "./chunk-MLKGABMK.js";
|
|
@@ -313,7 +314,7 @@ function shipHeldTerminal(state, result) {
|
|
|
313
314
|
"ready_to_ship",
|
|
314
315
|
result,
|
|
315
316
|
result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.",
|
|
316
|
-
{ ship_held: true }
|
|
317
|
+
{ ship_held: true, shipping_disabled: true, ship_authorized: false }
|
|
317
318
|
);
|
|
318
319
|
}
|
|
319
320
|
function checkpointContinueStage(result) {
|
|
@@ -361,6 +362,32 @@ function isReadyShipGate(result) {
|
|
|
361
362
|
function proofAssessmentRequestsShip(payload) {
|
|
362
363
|
return String(payload.decision || "").trim() === "ready_to_ship";
|
|
363
364
|
}
|
|
365
|
+
var TRUSTED_PROOF_ASSESSMENT_READY_SOURCES = /* @__PURE__ */ new Set([
|
|
366
|
+
"supervising_agent",
|
|
367
|
+
"supervisor",
|
|
368
|
+
"openclaw_auto_ship_mode_none"
|
|
369
|
+
]);
|
|
370
|
+
function proofAssessmentSourceTrustedForShip(payload) {
|
|
371
|
+
const source = nonEmptyString(payload.source)?.toLowerCase();
|
|
372
|
+
if (!source) return true;
|
|
373
|
+
return TRUSTED_PROOF_ASSESSMENT_READY_SOURCES.has(source);
|
|
374
|
+
}
|
|
375
|
+
function proofAssessmentSourceBlocker(input) {
|
|
376
|
+
if (!proofAssessmentRequestsShip(input.payload)) return null;
|
|
377
|
+
if (proofAssessmentSourceTrustedForShip(input.payload)) return null;
|
|
378
|
+
const source = nonEmptyString(input.payload.source) || "unknown";
|
|
379
|
+
return {
|
|
380
|
+
code: input.code || "proof_assessment_source_not_trusted",
|
|
381
|
+
checkpoint: input.checkpoint || null,
|
|
382
|
+
message: `Riddle Proof cannot mark ready_to_ship from untrusted proof assessment source: ${source}.`,
|
|
383
|
+
details: compactRecord({
|
|
384
|
+
stage: input.stage || null,
|
|
385
|
+
proofAssessment: input.payload,
|
|
386
|
+
checkpoint_response_source: input.response?.source || null,
|
|
387
|
+
response: input.response || null
|
|
388
|
+
})
|
|
389
|
+
};
|
|
390
|
+
}
|
|
364
391
|
function proofAssessmentHardBlockers(state, payload) {
|
|
365
392
|
const blockers = proofAssessmentHardBlockersForState(state || {});
|
|
366
393
|
if (Array.isArray(payload.hard_blockers)) {
|
|
@@ -391,6 +418,15 @@ function stageFromCheckpointResponse(response, packet) {
|
|
|
391
418
|
const stage = response.continue_with_stage || nonEmptyString(payload.continue_with_stage) || nonEmptyString(payload.recommended_stage) || nonEmptyString(resume?.continue_with_stage) || (response.decision === "retry_stage" ? packet.stage : "");
|
|
392
419
|
return stage ? stage : null;
|
|
393
420
|
}
|
|
421
|
+
function proofAssessmentSourceFromCheckpointResponse(response) {
|
|
422
|
+
const kind = nonEmptyString(response.source?.kind)?.toLowerCase();
|
|
423
|
+
if (!kind) return "supervising_agent";
|
|
424
|
+
if (kind === "human") return "supervisor";
|
|
425
|
+
if (kind === "codex" || kind === "openclaw-main" || kind === "claude-code") {
|
|
426
|
+
return "supervising_agent";
|
|
427
|
+
}
|
|
428
|
+
return `checkpoint_response:${kind}`;
|
|
429
|
+
}
|
|
394
430
|
function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
395
431
|
if (![
|
|
396
432
|
"ready_to_ship",
|
|
@@ -411,7 +447,7 @@ function proofAssessmentPayloadFromCheckpointResponse(response) {
|
|
|
411
447
|
continue_with_stage: stage || void 0,
|
|
412
448
|
escalation_target: nonEmptyString(payload.escalation_target) || "agent",
|
|
413
449
|
reasons: Array.isArray(response.reasons) ? response.reasons : Array.isArray(payload.reasons) ? payload.reasons : [],
|
|
414
|
-
source:
|
|
450
|
+
source: proofAssessmentSourceFromCheckpointResponse(response),
|
|
415
451
|
checkpoint_response_source: response.source || null,
|
|
416
452
|
checkpoint_response_created_at: response.created_at
|
|
417
453
|
}));
|
|
@@ -556,6 +592,7 @@ function terminalResult(state, status, result, summary, raw = {}) {
|
|
|
556
592
|
engineResult: result
|
|
557
593
|
});
|
|
558
594
|
applyTerminalMetadata(state, metadata);
|
|
595
|
+
applyShipControlState(state, { status, raw });
|
|
559
596
|
persist(state);
|
|
560
597
|
return createRunResult({
|
|
561
598
|
state,
|
|
@@ -862,6 +899,14 @@ function checkpointResponseContinuation(state, value) {
|
|
|
862
899
|
if (packet.kind === "assess_proof" || packet.kind === "recover_evidence" || packet.stage === "verify") {
|
|
863
900
|
const assessment = proofAssessmentPayloadFromCheckpointResponse(response);
|
|
864
901
|
if (assessment) {
|
|
902
|
+
const sourceBlocker = proofAssessmentSourceBlocker({
|
|
903
|
+
checkpoint: packet.checkpoint,
|
|
904
|
+
stage: packet.stage,
|
|
905
|
+
payload: assessment,
|
|
906
|
+
response,
|
|
907
|
+
code: "checkpoint_response_source_not_trusted"
|
|
908
|
+
});
|
|
909
|
+
if (sourceBlocker) return { blocker: sourceBlocker };
|
|
865
910
|
appendCheckpointResponse(state, response);
|
|
866
911
|
if (state.request.ship_mode !== "ship" && proofAssessmentRequestsShip(assessment)) {
|
|
867
912
|
const result = {
|
|
@@ -880,6 +925,8 @@ function checkpointResponseContinuation(state, value) {
|
|
|
880
925
|
response.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.",
|
|
881
926
|
{
|
|
882
927
|
ship_held: true,
|
|
928
|
+
shipping_disabled: true,
|
|
929
|
+
ship_authorized: false,
|
|
883
930
|
proof_assessment: assessment
|
|
884
931
|
}
|
|
885
932
|
)
|
|
@@ -1420,6 +1467,25 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
1420
1467
|
}
|
|
1421
1468
|
};
|
|
1422
1469
|
}
|
|
1470
|
+
const sourceBlocker = proofAssessmentSourceBlocker({
|
|
1471
|
+
checkpoint,
|
|
1472
|
+
stage: "verify",
|
|
1473
|
+
payload,
|
|
1474
|
+
code: "proof_assessment_source_not_trusted"
|
|
1475
|
+
});
|
|
1476
|
+
if (sourceBlocker) {
|
|
1477
|
+
recordEvent(state, {
|
|
1478
|
+
kind: "agent.proof_assessment.source_blocked",
|
|
1479
|
+
checkpoint,
|
|
1480
|
+
stage: "verify",
|
|
1481
|
+
summary: sourceBlocker.message,
|
|
1482
|
+
details: compactRecord({
|
|
1483
|
+
proof_assessment: payload,
|
|
1484
|
+
agent_duration_ms: durationMs
|
|
1485
|
+
})
|
|
1486
|
+
});
|
|
1487
|
+
return { blocker: sourceBlocker };
|
|
1488
|
+
}
|
|
1423
1489
|
const visualBlocker = proofAssessmentVisualBlocker({
|
|
1424
1490
|
...context.fullRiddleState || {},
|
|
1425
1491
|
verification_mode: context.fullRiddleState?.verification_mode || request.verification_mode
|
|
@@ -1454,6 +1520,8 @@ async function routeCheckpoint(request, state, result, agent, input) {
|
|
|
1454
1520
|
assessment.summary || result.summary || "Riddle Proof evidence is approved, but ship_mode=none is holding before PR/ship.",
|
|
1455
1521
|
{
|
|
1456
1522
|
ship_held: true,
|
|
1523
|
+
shipping_disabled: true,
|
|
1524
|
+
ship_authorized: false,
|
|
1457
1525
|
proof_assessment: payload
|
|
1458
1526
|
}
|
|
1459
1527
|
)
|
|
@@ -99,6 +99,9 @@ function normalizeTerminalMetadata(input) {
|
|
|
99
99
|
pr_state: prState,
|
|
100
100
|
marked_ready: markedReady,
|
|
101
101
|
left_draft: leftDraft,
|
|
102
|
+
ship_held: firstBoolean(riddleState.ship_held, result.ship_held, result.shipHeld, details.ship_held, details.shipHeld, shipReport.ship_held, shipReport.shipHeld),
|
|
103
|
+
shipping_disabled: firstBoolean(riddleState.shipping_disabled, result.shipping_disabled, result.shippingDisabled, details.shipping_disabled, details.shippingDisabled, shipReport.shipping_disabled, shipReport.shippingDisabled),
|
|
104
|
+
ship_authorized: firstBoolean(riddleState.ship_authorized, result.ship_authorized, result.shipAuthorized, details.ship_authorized, details.shipAuthorized, shipReport.ship_authorized, shipReport.shipAuthorized),
|
|
102
105
|
ci_status: firstNonEmptyString(riddleState.ci_status, result.ci_status, result.ciStatus, details.ci_status, details.ciStatus, shipReport.ci_status),
|
|
103
106
|
ship_commit: firstNonEmptyString(riddleState.ship_commit, result.ship_commit, result.shipCommit, details.ship_commit, details.shipCommit, shipReport.shipped_commit, shipReport.ship_commit),
|
|
104
107
|
ship_remote_head: firstNonEmptyString(riddleState.ship_remote_head, result.ship_remote_head, result.shipRemoteHead, details.ship_remote_head, details.shipRemoteHead, shipReport.ship_remote_head),
|
|
@@ -132,6 +135,9 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
132
135
|
if (prBranch) state.pr_branch = prBranch;
|
|
133
136
|
if (typeof metadata.marked_ready === "boolean") state.marked_ready = metadata.marked_ready;
|
|
134
137
|
if (typeof metadata.left_draft === "boolean") state.left_draft = metadata.left_draft;
|
|
138
|
+
if (typeof metadata.ship_held === "boolean") state.ship_held = metadata.ship_held;
|
|
139
|
+
if (typeof metadata.shipping_disabled === "boolean") state.shipping_disabled = metadata.shipping_disabled;
|
|
140
|
+
if (typeof metadata.ship_authorized === "boolean") state.ship_authorized = metadata.ship_authorized;
|
|
135
141
|
const ciStatus = nonEmptyString(metadata.ci_status);
|
|
136
142
|
if (ciStatus) state.ci_status = ciStatus;
|
|
137
143
|
const shipCommit = nonEmptyString(metadata.ship_commit);
|
|
@@ -163,12 +169,53 @@ function applyTerminalMetadata(state, metadata) {
|
|
|
163
169
|
if (typeof metadata.finalized === "boolean") state.finalized = metadata.finalized;
|
|
164
170
|
return state;
|
|
165
171
|
}
|
|
172
|
+
function shipControlStateFor(input) {
|
|
173
|
+
const state = input.state;
|
|
174
|
+
const status = input.status || state.status;
|
|
175
|
+
const raw = recordValue(input.raw) || {};
|
|
176
|
+
const shipReport = recordValue(state.ship_report) || {};
|
|
177
|
+
const prState = recordValue(state.pr_state) || {};
|
|
178
|
+
const shippingDisabled = firstBoolean(
|
|
179
|
+
raw.shipping_disabled,
|
|
180
|
+
raw.shippingDisabled,
|
|
181
|
+
state.shipping_disabled,
|
|
182
|
+
shipReport.shipping_disabled,
|
|
183
|
+
shipReport.shippingDisabled
|
|
184
|
+
) ?? state.request?.ship_mode === "none";
|
|
185
|
+
const explicitAuthorized = firstBoolean(
|
|
186
|
+
raw.ship_authorized,
|
|
187
|
+
raw.shipAuthorized,
|
|
188
|
+
state.ship_authorized,
|
|
189
|
+
shipReport.ship_authorized,
|
|
190
|
+
shipReport.shipAuthorized
|
|
191
|
+
);
|
|
192
|
+
const authorizationEvidence = Boolean(
|
|
193
|
+
status === "shipped" || state.marked_ready === true || shipReport.marked_ready === true || prState.status === "merged" || state.merge_commit || state.merged_at
|
|
194
|
+
);
|
|
195
|
+
const inferredAuthorized = explicitAuthorized ?? authorizationEvidence;
|
|
196
|
+
const rawHeld = firstBoolean(raw.ship_held, raw.shipHeld);
|
|
197
|
+
const inferredHeld = status === "ready_to_ship" && shippingDisabled && !inferredAuthorized;
|
|
198
|
+
const shipHeld = rawHeld ?? (state.ship_held === true || inferredHeld);
|
|
199
|
+
return {
|
|
200
|
+
ship_held: shipHeld,
|
|
201
|
+
shipping_disabled: shippingDisabled,
|
|
202
|
+
ship_authorized: shipHeld ? false : inferredAuthorized
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
function applyShipControlState(state, input = {}) {
|
|
206
|
+
const control = shipControlStateFor({ state, status: input.status, raw: input.raw });
|
|
207
|
+
state.ship_held = control.ship_held;
|
|
208
|
+
state.shipping_disabled = control.shipping_disabled;
|
|
209
|
+
state.ship_authorized = control.ship_authorized;
|
|
210
|
+
return state;
|
|
211
|
+
}
|
|
166
212
|
function createRunResult(input) {
|
|
167
213
|
const status = input.status || input.state.status;
|
|
168
214
|
const ok = isSuccessfulStatus(status);
|
|
169
215
|
const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
|
|
170
216
|
state.status = status;
|
|
171
217
|
state.ok = ok;
|
|
218
|
+
applyShipControlState(state, { status, raw: input.raw });
|
|
172
219
|
return compactRecord({
|
|
173
220
|
ok,
|
|
174
221
|
status,
|
|
@@ -186,6 +233,9 @@ function createRunResult(input) {
|
|
|
186
233
|
pr_state: state.pr_state,
|
|
187
234
|
marked_ready: state.marked_ready,
|
|
188
235
|
left_draft: state.left_draft,
|
|
236
|
+
ship_held: state.ship_held,
|
|
237
|
+
shipping_disabled: state.shipping_disabled,
|
|
238
|
+
ship_authorized: state.ship_authorized,
|
|
189
239
|
ci_status: state.ci_status,
|
|
190
240
|
ship_commit: state.ship_commit,
|
|
191
241
|
ship_remote_head: state.ship_remote_head,
|
|
@@ -222,5 +272,7 @@ export {
|
|
|
222
272
|
recordValue,
|
|
223
273
|
normalizeTerminalMetadata,
|
|
224
274
|
applyTerminalMetadata,
|
|
275
|
+
shipControlStateFor,
|
|
276
|
+
applyShipControlState,
|
|
225
277
|
createRunResult
|
|
226
278
|
};
|
package/dist/cli/index.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import "../chunk-
|
|
1
|
+
import "../chunk-MYMTAVGP.js";
|
|
2
2
|
import "../chunk-DI2XNGEZ.js";
|
|
3
3
|
import "../chunk-6KYXX4OE.js";
|
|
4
4
|
import "../chunk-EX7TO4I5.js";
|
|
5
|
-
import "../chunk-
|
|
6
|
-
import "../chunk-
|
|
7
|
-
import "../chunk-
|
|
5
|
+
import "../chunk-QGE3KBRL.js";
|
|
6
|
+
import "../chunk-Q5GYD5RG.js";
|
|
7
|
+
import "../chunk-NYRMPWJB.js";
|
|
8
8
|
import "../chunk-EKZXU6MU.js";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-QUK3SG24.js";
|
|
10
10
|
import "../chunk-JFQXAJH2.js";
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
11
|
+
import "../chunk-SONWF3FQ.js";
|
|
12
|
+
import "../chunk-W44XEGYW.js";
|
|
13
13
|
import "../chunk-MLKGABMK.js";
|