@riddledc/riddle-proof 0.8.55 → 0.8.57

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.
Files changed (71) hide show
  1. package/dist/adapters/codex-exec-agent.js +2 -2
  2. package/dist/adapters/codex.js +2 -2
  3. package/dist/adapters/local-agent.js +2 -2
  4. package/dist/adapters/openclaw.js +5 -5
  5. package/dist/advanced/engine-harness.cjs +64 -20
  6. package/dist/advanced/engine-harness.js +5 -5
  7. package/dist/advanced/index.cjs +64 -20
  8. package/dist/advanced/index.d.cts +1 -1
  9. package/dist/advanced/index.d.ts +1 -1
  10. package/dist/advanced/index.js +6 -6
  11. package/dist/advanced/proof-run-engine.d.cts +1 -1
  12. package/dist/advanced/proof-run-engine.d.ts +1 -1
  13. package/dist/advanced/runner.cjs +5 -0
  14. package/dist/advanced/runner.js +5 -5
  15. package/dist/checkpoint.cjs +4 -0
  16. package/dist/checkpoint.js +2 -2
  17. package/dist/{chunk-W44XEGYW.js → chunk-CUBYSWZT.js} +5 -0
  18. package/dist/{chunk-QGE3KBRL.js → chunk-GHBNDHG7.js} +60 -24
  19. package/dist/{chunk-F65S5LT2.js → chunk-JLOZTVXU.js} +2 -2
  20. package/dist/{chunk-6KYXX4OE.js → chunk-JR7GFTLS.js} +89 -2
  21. package/dist/{chunk-NYRMPWJB.js → chunk-KNPCWWF3.js} +2 -2
  22. package/dist/{chunk-MYMTAVGP.js → chunk-LUFT7AGY.js} +4 -4
  23. package/dist/{chunk-QUK3SG24.js → chunk-MOTQNIZX.js} +5 -1
  24. package/dist/{chunk-SONWF3FQ.js → chunk-RS4HJLJQ.js} +1 -1
  25. package/dist/{chunk-J2ZNL3H3.js → chunk-TTB3ZAVX.js} +2 -2
  26. package/dist/{chunk-Q5GYD5RG.js → chunk-UZIX7M7D.js} +4 -2
  27. package/dist/cli/index.js +8 -8
  28. package/dist/cli.cjs +153 -22
  29. package/dist/cli.js +8 -8
  30. package/dist/codex-exec-agent.js +2 -2
  31. package/dist/engine-harness.cjs +64 -20
  32. package/dist/engine-harness.js +5 -5
  33. package/dist/index.cjs +155 -22
  34. package/dist/index.d.cts +2 -2
  35. package/dist/index.d.ts +2 -2
  36. package/dist/index.js +10 -8
  37. package/dist/local-agent.js +2 -2
  38. package/dist/openclaw.js +5 -5
  39. package/dist/pr-comment.cjs +89 -2
  40. package/dist/pr-comment.d.cts +18 -1
  41. package/dist/pr-comment.d.ts +18 -1
  42. package/dist/pr-comment.js +1 -1
  43. package/dist/{proof-run-engine-MiKZt9oY.d.ts → proof-run-engine-BqRoA3Do.d.ts} +3 -3
  44. package/dist/{proof-run-engine-Baiv6l3A.d.cts → proof-run-engine-DpChFR5H.d.cts} +3 -3
  45. package/dist/proof-run-engine.d.cts +1 -1
  46. package/dist/proof-run-engine.d.ts +1 -1
  47. package/dist/result.cjs +6 -0
  48. package/dist/result.d.cts +2 -1
  49. package/dist/result.d.ts +2 -1
  50. package/dist/result.js +3 -1
  51. package/dist/run-card.js +3 -3
  52. package/dist/runner.cjs +5 -0
  53. package/dist/runner.js +5 -5
  54. package/dist/spec/checkpoint.cjs +4 -0
  55. package/dist/spec/checkpoint.js +2 -2
  56. package/dist/spec/index.cjs +11 -0
  57. package/dist/spec/index.d.cts +1 -1
  58. package/dist/spec/index.d.ts +1 -1
  59. package/dist/spec/index.js +6 -4
  60. package/dist/spec/result.cjs +6 -0
  61. package/dist/spec/result.d.cts +1 -1
  62. package/dist/spec/result.d.ts +1 -1
  63. package/dist/spec/result.js +3 -1
  64. package/dist/spec/run-card.js +3 -3
  65. package/dist/spec/state.cjs +4 -0
  66. package/dist/spec/state.js +4 -4
  67. package/dist/state.cjs +4 -0
  68. package/dist/state.js +4 -4
  69. package/dist/types.d.cts +2 -0
  70. package/dist/types.d.ts +2 -0
  71. package/package.json +1 -1
@@ -41,6 +41,20 @@ function numberValue(value) {
41
41
  function booleanValue(value) {
42
42
  return typeof value === "boolean" ? value : void 0;
43
43
  }
44
+ function firstStringValue(...values) {
45
+ for (const value of values) {
46
+ const text = stringValue(value);
47
+ if (text) return text;
48
+ }
49
+ return void 0;
50
+ }
51
+ function firstBooleanValue(...values) {
52
+ for (const value of values) {
53
+ const bool = booleanValue(value);
54
+ if (typeof bool === "boolean") return bool;
55
+ }
56
+ return void 0;
57
+ }
44
58
  function artifactKind(name, url) {
45
59
  const target = `${name} ${url}`.toLowerCase();
46
60
  if (/\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(target)) return "image";
@@ -117,20 +131,55 @@ function selectPrimaryImage(artifacts) {
117
131
  const images = artifacts.filter((artifact) => artifact.kind === "image");
118
132
  return images.find((artifact) => /after|proof|screenshot/i.test(artifact.name)) || images[0];
119
133
  }
134
+ function firstRecordValue(...values) {
135
+ for (const value of values) {
136
+ const record = asRecord(value);
137
+ if (Object.keys(record).length) return record;
138
+ }
139
+ return void 0;
140
+ }
141
+ function checkpointSummaryFrom(...values) {
142
+ const record = firstRecordValue(...values);
143
+ if (!record) return void 0;
144
+ const summary = {
145
+ pending: booleanValue(record.pending),
146
+ response_count: numberValue(record.response_count),
147
+ rejected_response_count: numberValue(record.rejected_response_count),
148
+ ignored_response_count: numberValue(record.ignored_response_count),
149
+ duplicate_response_count: numberValue(record.duplicate_response_count),
150
+ latest_decision: stringValue(record.latest_decision),
151
+ latest_packet_id: stringValue(record.latest_packet_id),
152
+ latest_resume_token: stringValue(record.latest_resume_token)
153
+ };
154
+ return Object.values(summary).some((value) => typeof value !== "undefined") ? summary : void 0;
155
+ }
120
156
  function summarizeRiddleProofPrComment(input) {
121
157
  const runResponse = asRecord(input.runResponse);
122
158
  const result = asRecord(input.result);
123
159
  const proofResult = asRecord(runResponse.proofResult);
124
160
  const preview = asRecord(runResponse.preview);
161
+ const resultRunCard = asRecord(result.run_card);
162
+ const stopCondition = asRecord(resultRunCard.stop_condition);
163
+ const resultDetails = asRecord(result.details);
164
+ const resultRaw = asRecord(result.raw);
165
+ const rawDetails = asRecord(resultRaw.details);
125
166
  const artifacts = collectArtifacts(runResponse);
126
167
  const pages = pageSummaries(result);
127
168
  const checkSource = { ...result };
128
169
  delete checkSource.ok;
129
170
  const nestedChecks = summarizeExplicitChecks(checkSource);
130
171
  const ok = booleanValue(result.ok) ?? booleanValue(runResponse.ok) ?? null;
172
+ const checkpointSummary = checkpointSummaryFrom(
173
+ result.checkpoint_summary,
174
+ stopCondition.checkpoint_summary,
175
+ resultDetails.checkpoint_summary,
176
+ rawDetails.checkpoint_summary,
177
+ proofResult.checkpoint_summary
178
+ );
131
179
  return {
132
180
  ok,
133
181
  status: stringValue(proofResult.status),
182
+ result_status: firstStringValue(result.status, stopCondition.status),
134
183
  job_id: stringValue(proofResult.job_id),
135
184
  duration_ms: numberValue(proofResult.duration_ms),
136
185
  proof_url: stringValue(runResponse.proofUrl),
@@ -138,6 +187,12 @@ function summarizeRiddleProofPrComment(input) {
138
187
  preview_url: stringValue(preview.preview_url) || stringValue(preview.url),
139
188
  preview_publish_recovered: booleanValue(preview.publish_recovered),
140
189
  preview_publish_error: stringValue(preview.publish_error),
190
+ ship_held: firstBooleanValue(result.ship_held, stopCondition.ship_held, resultRaw.ship_held),
191
+ shipping_disabled: firstBooleanValue(result.shipping_disabled, stopCondition.shipping_disabled, resultRaw.shipping_disabled),
192
+ ship_authorized: firstBooleanValue(result.ship_authorized, stopCondition.ship_authorized, resultRaw.ship_authorized),
193
+ proof_decision: firstStringValue(result.proof_decision, stopCondition.proof_decision, resultRaw.proof_decision),
194
+ merge_recommendation: firstStringValue(result.merge_recommendation, stopCondition.merge_recommendation, resultRaw.merge_recommendation),
195
+ checkpoint_summary: checkpointSummary,
141
196
  passed_checks: nestedChecks.passed,
142
197
  failed_checks: nestedChecks.failed,
143
198
  pages,
@@ -156,9 +211,15 @@ function markdownLink(label, url) {
156
211
  return `[${label.replace(/\]/g, "\\]")}](${url})`;
157
212
  }
158
213
  function resultLabel(summary) {
159
- if (summary.ok === true) return "passed";
214
+ if (summary.ok === true) {
215
+ if (summary.result_status === "shipped") return "shipped";
216
+ if (summary.result_status === "completed") return "completed";
217
+ if (summary.ship_held === true) return "proof passed; ship held";
218
+ if (summary.ship_authorized === true) return "passed; ship authorized";
219
+ return "passed";
220
+ }
160
221
  if (summary.ok === false) return "failed";
161
- return summary.status || "recorded";
222
+ return summary.result_status || summary.status || "recorded";
162
223
  }
163
224
  function artifactRank(artifact) {
164
225
  const name = artifact.name.toLowerCase();
@@ -170,6 +231,25 @@ function artifactRank(artifact) {
170
231
  if (artifact.kind === "image") return 20;
171
232
  return 30;
172
233
  }
234
+ function formatBool(value) {
235
+ return typeof value === "boolean" ? String(value) : "unknown";
236
+ }
237
+ function hasShipControl(summary) {
238
+ return typeof summary.ship_held === "boolean" || typeof summary.shipping_disabled === "boolean" || typeof summary.ship_authorized === "boolean";
239
+ }
240
+ function checkpointSummaryLine(summary) {
241
+ const accepted = summary.response_count ?? 0;
242
+ const rejected = summary.rejected_response_count ?? 0;
243
+ const ignored = summary.ignored_response_count ?? 0;
244
+ const parts = [`${accepted} accepted`, `${rejected} rejected`, `${ignored} ignored`];
245
+ if ((summary.duplicate_response_count ?? 0) > 0) parts.push(`${summary.duplicate_response_count} duplicate`);
246
+ const state = summary.pending === true ? "pending" : summary.pending === false ? "complete" : "";
247
+ return [
248
+ parts.join(" / "),
249
+ state,
250
+ summary.latest_decision ? `latest decision \`${summary.latest_decision}\`` : ""
251
+ ].filter(Boolean).join("; ");
252
+ }
173
253
  function buildRiddleProofPrCommentMarkdown(input) {
174
254
  const summary = summarizeRiddleProofPrComment(input);
175
255
  const title = input.title?.trim() || "Riddle Proof Evidence";
@@ -181,9 +261,16 @@ function buildRiddleProofPrCommentMarkdown(input) {
181
261
  ];
182
262
  if (input.goal?.trim()) lines.push(`**Goal:** ${input.goal.trim()}`);
183
263
  if (input.successCriteria?.trim()) lines.push(`**Success criteria:** ${input.successCriteria.trim()}`);
264
+ if (summary.result_status) lines.push(`**Evidence status:** ${summary.result_status}`);
184
265
  if (summary.status) lines.push(`**Riddle job status:** ${summary.status}`);
185
266
  if (summary.job_id) lines.push(`**Riddle job:** \`${summary.job_id}\``);
186
267
  if (summary.duration_ms) lines.push(`**Duration:** ${formatDuration(summary.duration_ms)}`);
268
+ if (hasShipControl(summary)) {
269
+ lines.push(`**Ship control:** held=${formatBool(summary.ship_held)}, shipping_disabled=${formatBool(summary.shipping_disabled)}, authorized=${formatBool(summary.ship_authorized)}`);
270
+ }
271
+ if (summary.proof_decision) lines.push(`**Proof decision:** \`${summary.proof_decision}\``);
272
+ if (summary.merge_recommendation) lines.push(`**Merge recommendation:** ${summary.merge_recommendation}`);
273
+ if (summary.checkpoint_summary) lines.push(`**Checkpoints:** ${checkpointSummaryLine(summary.checkpoint_summary)}`);
187
274
  if (summary.proof_url) lines.push(`**Proof URL:** ${markdownLink(summary.proof_url, summary.proof_url)}`);
188
275
  if (summary.preview_id || summary.preview_url) {
189
276
  const previewLabel = summary.preview_id ? `\`${summary.preview_id}\`` : "preview";
@@ -11,9 +11,20 @@ interface RiddleProofPrCommentPageSummary {
11
11
  passed: number;
12
12
  failed: number;
13
13
  }
14
+ interface RiddleProofPrCommentCheckpointSummary {
15
+ pending?: boolean;
16
+ response_count?: number;
17
+ rejected_response_count?: number;
18
+ ignored_response_count?: number;
19
+ duplicate_response_count?: number;
20
+ latest_decision?: string;
21
+ latest_packet_id?: string;
22
+ latest_resume_token?: string;
23
+ }
14
24
  interface RiddleProofPrCommentSummary {
15
25
  ok: boolean | null;
16
26
  status?: string;
27
+ result_status?: string;
17
28
  job_id?: string;
18
29
  duration_ms?: number;
19
30
  proof_url?: string;
@@ -21,6 +32,12 @@ interface RiddleProofPrCommentSummary {
21
32
  preview_url?: string;
22
33
  preview_publish_recovered?: boolean;
23
34
  preview_publish_error?: string;
35
+ ship_held?: boolean;
36
+ shipping_disabled?: boolean;
37
+ ship_authorized?: boolean;
38
+ proof_decision?: string;
39
+ merge_recommendation?: string;
40
+ checkpoint_summary?: RiddleProofPrCommentCheckpointSummary;
24
41
  passed_checks: number;
25
42
  failed_checks: number;
26
43
  pages: RiddleProofPrCommentPageSummary[];
@@ -38,4 +55,4 @@ interface RiddleProofPrCommentInput {
38
55
  declare function summarizeRiddleProofPrComment(input: RiddleProofPrCommentInput): RiddleProofPrCommentSummary;
39
56
  declare function buildRiddleProofPrCommentMarkdown(input: RiddleProofPrCommentInput): string;
40
57
 
41
- export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
58
+ export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentCheckpointSummary, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
@@ -11,9 +11,20 @@ interface RiddleProofPrCommentPageSummary {
11
11
  passed: number;
12
12
  failed: number;
13
13
  }
14
+ interface RiddleProofPrCommentCheckpointSummary {
15
+ pending?: boolean;
16
+ response_count?: number;
17
+ rejected_response_count?: number;
18
+ ignored_response_count?: number;
19
+ duplicate_response_count?: number;
20
+ latest_decision?: string;
21
+ latest_packet_id?: string;
22
+ latest_resume_token?: string;
23
+ }
14
24
  interface RiddleProofPrCommentSummary {
15
25
  ok: boolean | null;
16
26
  status?: string;
27
+ result_status?: string;
17
28
  job_id?: string;
18
29
  duration_ms?: number;
19
30
  proof_url?: string;
@@ -21,6 +32,12 @@ interface RiddleProofPrCommentSummary {
21
32
  preview_url?: string;
22
33
  preview_publish_recovered?: boolean;
23
34
  preview_publish_error?: string;
35
+ ship_held?: boolean;
36
+ shipping_disabled?: boolean;
37
+ ship_authorized?: boolean;
38
+ proof_decision?: string;
39
+ merge_recommendation?: string;
40
+ checkpoint_summary?: RiddleProofPrCommentCheckpointSummary;
24
41
  passed_checks: number;
25
42
  failed_checks: number;
26
43
  pages: RiddleProofPrCommentPageSummary[];
@@ -38,4 +55,4 @@ interface RiddleProofPrCommentInput {
38
55
  declare function summarizeRiddleProofPrComment(input: RiddleProofPrCommentInput): RiddleProofPrCommentSummary;
39
56
  declare function buildRiddleProofPrCommentMarkdown(input: RiddleProofPrCommentInput): string;
40
57
 
41
- export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
58
+ export { RIDDLE_PROOF_PR_COMMENT_MARKER, type RiddleProofPrCommentArtifact, type RiddleProofPrCommentArtifactKind, type RiddleProofPrCommentCheckpointSummary, type RiddleProofPrCommentInput, type RiddleProofPrCommentPageSummary, type RiddleProofPrCommentSummary, buildRiddleProofPrCommentMarkdown, summarizeRiddleProofPrComment };
@@ -2,7 +2,7 @@ import {
2
2
  RIDDLE_PROOF_PR_COMMENT_MARKER,
3
3
  buildRiddleProofPrCommentMarkdown,
4
4
  summarizeRiddleProofPrComment
5
- } from "./chunk-6KYXX4OE.js";
5
+ } from "./chunk-JR7GFTLS.js";
6
6
  import "./chunk-MLKGABMK.js";
7
7
  export {
8
8
  RIDDLE_PROOF_PR_COMMENT_MARKER,
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
292
292
  blocking?: boolean;
293
293
  details?: Record<string, unknown>;
294
294
  ok: boolean;
295
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
295
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
296
296
  state_path: string;
297
297
  stage: any;
298
298
  summary: string;
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
382
382
  continueWithStage?: WorkflowStage | null;
383
383
  blocking?: boolean;
384
384
  details?: Record<string, unknown>;
385
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
385
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
386
386
  state_path: string;
387
387
  stage: any;
388
388
  checkpoint: string;
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
659
659
  error?: undefined;
660
660
  } | {
661
661
  ok: boolean;
662
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship";
662
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup";
663
663
  state_path: string;
664
664
  stage: any;
665
665
  summary: string;
@@ -292,7 +292,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
292
292
  blocking?: boolean;
293
293
  details?: Record<string, unknown>;
294
294
  ok: boolean;
295
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
295
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
296
296
  state_path: string;
297
297
  stage: any;
298
298
  summary: string;
@@ -382,7 +382,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
382
382
  continueWithStage?: WorkflowStage | null;
383
383
  blocking?: boolean;
384
384
  details?: Record<string, unknown>;
385
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship" | "run";
385
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup" | "run";
386
386
  state_path: string;
387
387
  stage: any;
388
388
  checkpoint: string;
@@ -659,7 +659,7 @@ declare function executeWorkflow(params: WorkflowParams, pluginConfig: any, reso
659
659
  error?: undefined;
660
660
  } | {
661
661
  ok: boolean;
662
- action: "setup" | "recon" | "author" | "implement" | "verify" | "ship";
662
+ action: "author" | "recon" | "ship" | "implement" | "verify" | "setup";
663
663
  state_path: string;
664
664
  stage: any;
665
665
  summary: string;
@@ -1,2 +1,2 @@
1
1
  import './proof-run-core-7Dqm7RKM.cjs';
2
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-Baiv6l3A.cjs';
2
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-DpChFR5H.cjs';
@@ -1,2 +1,2 @@
1
1
  import './proof-run-core-7Dqm7RKM.js';
2
- export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-MiKZt9oY.js';
2
+ export { R as RiddleProofEngine, c as createRiddleProofEngine, e as executeWorkflow } from './proof-run-engine-BqRoA3Do.js';
package/dist/result.cjs CHANGED
@@ -24,6 +24,7 @@ __export(result_exports, {
24
24
  applyTerminalMetadata: () => applyTerminalMetadata,
25
25
  compactRecord: () => compactRecord,
26
26
  createRunResult: () => createRunResult,
27
+ isProtectedFinalStatus: () => isProtectedFinalStatus,
27
28
  isSuccessfulStatus: () => isSuccessfulStatus,
28
29
  isTerminalStatus: () => isTerminalStatus,
29
30
  nonEmptyString: () => nonEmptyString,
@@ -35,6 +36,9 @@ module.exports = __toCommonJS(result_exports);
35
36
  function isTerminalStatus(status) {
36
37
  return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
37
38
  }
39
+ function isProtectedFinalStatus(status) {
40
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
41
+ }
38
42
  function isSuccessfulStatus(status) {
39
43
  return status !== "blocked" && status !== "failed";
40
44
  }
@@ -248,6 +252,7 @@ function createRunResult(input) {
248
252
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
249
253
  state.status = status;
250
254
  state.ok = ok;
255
+ if (isProtectedFinalStatus(status)) state.finalized = true;
251
256
  applyShipControlState(state, { status, raw: input.raw });
252
257
  return compactRecord({
253
258
  ok,
@@ -302,6 +307,7 @@ function createRunResult(input) {
302
307
  applyTerminalMetadata,
303
308
  compactRecord,
304
309
  createRunResult,
310
+ isProtectedFinalStatus,
305
311
  isSuccessfulStatus,
306
312
  isTerminalStatus,
307
313
  nonEmptyString,
package/dist/result.d.cts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { RiddleProofRunState, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofEvidenceBundle, RiddleProofRunResult } from './types.cjs';
2
2
 
3
3
  declare function isTerminalStatus(status: RiddleProofStatus): boolean;
4
+ declare function isProtectedFinalStatus(status: unknown): boolean;
4
5
  declare function isSuccessfulStatus(status: RiddleProofStatus): boolean;
5
6
  declare function compactRecord<T extends Record<string, unknown>>(input: T): Partial<T>;
6
7
  declare function nonEmptyString(value: unknown): string | undefined;
@@ -36,4 +37,4 @@ declare function createRunResult(input: {
36
37
  raw?: Record<string, unknown>;
37
38
  }): RiddleProofRunResult;
38
39
 
39
- export { type RiddleProofShipControlState, type TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor };
40
+ export { type RiddleProofShipControlState, type TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isProtectedFinalStatus, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor };
package/dist/result.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import { RiddleProofRunState, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofEvidenceBundle, RiddleProofRunResult } from './types.js';
2
2
 
3
3
  declare function isTerminalStatus(status: RiddleProofStatus): boolean;
4
+ declare function isProtectedFinalStatus(status: unknown): boolean;
4
5
  declare function isSuccessfulStatus(status: RiddleProofStatus): boolean;
5
6
  declare function compactRecord<T extends Record<string, unknown>>(input: T): Partial<T>;
6
7
  declare function nonEmptyString(value: unknown): string | undefined;
@@ -36,4 +37,4 @@ declare function createRunResult(input: {
36
37
  raw?: Record<string, unknown>;
37
38
  }): RiddleProofRunResult;
38
39
 
39
- export { type RiddleProofShipControlState, type TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor };
40
+ export { type RiddleProofShipControlState, type TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isProtectedFinalStatus, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor };
package/dist/result.js CHANGED
@@ -3,19 +3,21 @@ import {
3
3
  applyTerminalMetadata,
4
4
  compactRecord,
5
5
  createRunResult,
6
+ isProtectedFinalStatus,
6
7
  isSuccessfulStatus,
7
8
  isTerminalStatus,
8
9
  nonEmptyString,
9
10
  normalizeTerminalMetadata,
10
11
  recordValue,
11
12
  shipControlStateFor
12
- } from "./chunk-W44XEGYW.js";
13
+ } from "./chunk-CUBYSWZT.js";
13
14
  import "./chunk-MLKGABMK.js";
14
15
  export {
15
16
  applyShipControlState,
16
17
  applyTerminalMetadata,
17
18
  compactRecord,
18
19
  createRunResult,
20
+ isProtectedFinalStatus,
19
21
  isSuccessfulStatus,
20
22
  isTerminalStatus,
21
23
  nonEmptyString,
package/dist/run-card.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  RIDDLE_PROOF_RUN_CARD_VERSION,
3
3
  createRiddleProofRunCard
4
- } from "./chunk-NYRMPWJB.js";
5
- import "./chunk-QUK3SG24.js";
6
- import "./chunk-W44XEGYW.js";
4
+ } from "./chunk-KNPCWWF3.js";
5
+ import "./chunk-MOTQNIZX.js";
6
+ import "./chunk-CUBYSWZT.js";
7
7
  import "./chunk-MLKGABMK.js";
8
8
  export {
9
9
  RIDDLE_PROOF_RUN_CARD_VERSION,
package/dist/runner.cjs CHANGED
@@ -35,6 +35,9 @@ __export(runner_exports, {
35
35
  module.exports = __toCommonJS(runner_exports);
36
36
 
37
37
  // src/result.ts
38
+ function isProtectedFinalStatus(status) {
39
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
40
+ }
38
41
  function isSuccessfulStatus(status) {
39
42
  return status !== "blocked" && status !== "failed";
40
43
  }
@@ -149,6 +152,7 @@ function createRunResult(input) {
149
152
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
150
153
  state.status = status;
151
154
  state.ok = ok;
155
+ if (isProtectedFinalStatus(status)) state.finalized = true;
152
156
  applyShipControlState(state, { status, raw: input.raw });
153
157
  return compactRecord({
154
158
  ok,
@@ -348,6 +352,7 @@ function appendStageHeartbeat(state, input) {
348
352
  function setRunStatus(state, status, at = timestamp()) {
349
353
  state.status = status;
350
354
  state.ok = status !== "blocked" && status !== "failed";
355
+ if (isProtectedFinalStatus(status)) state.finalized = true;
351
356
  state.updated_at = at;
352
357
  return state;
353
358
  }
package/dist/runner.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  runRiddleProof
3
- } from "./chunk-F65S5LT2.js";
4
- import "./chunk-Q5GYD5RG.js";
5
- import "./chunk-NYRMPWJB.js";
3
+ } from "./chunk-JLOZTVXU.js";
4
+ import "./chunk-UZIX7M7D.js";
5
+ import "./chunk-KNPCWWF3.js";
6
6
  import "./chunk-EKZXU6MU.js";
7
- import "./chunk-QUK3SG24.js";
8
- import "./chunk-W44XEGYW.js";
7
+ import "./chunk-MOTQNIZX.js";
8
+ import "./chunk-CUBYSWZT.js";
9
9
  import "./chunk-MLKGABMK.js";
10
10
  export {
11
11
  runRiddleProof
@@ -759,6 +759,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
759
759
  const packets = history.filter((entry) => entry.packet);
760
760
  const responses = acceptedCheckpointResponseEntries(state);
761
761
  const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
762
+ const rejectedResponses = events.filter((event) => event.kind === "checkpoint.response.rejected");
763
+ const ignoredResponses = events.filter((event) => event.kind === "checkpoint.response.ignored");
762
764
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
763
765
  const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
764
766
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
@@ -774,6 +776,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
774
776
  packet_count: packets.length,
775
777
  response_count: responses.length,
776
778
  duplicate_response_count: duplicateResponses.length,
779
+ rejected_response_count: rejectedResponses.length,
780
+ ignored_response_count: ignoredResponses.length,
777
781
  latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
778
782
  latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
779
783
  latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
@@ -14,8 +14,8 @@ import {
14
14
  normalizeCheckpointResponse,
15
15
  proofContractFromAuthorCheckpointResponse,
16
16
  statePathsForRunState
17
- } from "../chunk-QUK3SG24.js";
18
- import "../chunk-W44XEGYW.js";
17
+ } from "../chunk-MOTQNIZX.js";
18
+ import "../chunk-CUBYSWZT.js";
19
19
  import "../chunk-MLKGABMK.js";
20
20
  export {
21
21
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
@@ -54,6 +54,7 @@ __export(spec_exports, {
54
54
  createRunState: () => createRunState,
55
55
  createRunStatusSnapshot: () => createRunStatusSnapshot,
56
56
  isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
57
+ isProtectedFinalStatus: () => isProtectedFinalStatus,
57
58
  isSuccessfulStatus: () => isSuccessfulStatus,
58
59
  isTerminalStatus: () => isTerminalStatus,
59
60
  nonEmptyString: () => nonEmptyString,
@@ -74,6 +75,9 @@ module.exports = __toCommonJS(spec_exports);
74
75
  function isTerminalStatus(status) {
75
76
  return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
76
77
  }
78
+ function isProtectedFinalStatus(status) {
79
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
80
+ }
77
81
  function isSuccessfulStatus(status) {
78
82
  return status !== "blocked" && status !== "failed";
79
83
  }
@@ -287,6 +291,7 @@ function createRunResult(input) {
287
291
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
288
292
  state.status = status;
289
293
  state.ok = ok;
294
+ if (isProtectedFinalStatus(status)) state.finalized = true;
290
295
  applyShipControlState(state, { status, raw: input.raw });
291
296
  return compactRecord({
292
297
  ok,
@@ -1034,6 +1039,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
1034
1039
  const packets = history.filter((entry) => entry.packet);
1035
1040
  const responses = acceptedCheckpointResponseEntries(state);
1036
1041
  const duplicateResponses = events.filter((event) => event.kind === "checkpoint.response.duplicate");
1042
+ const rejectedResponses = events.filter((event) => event.kind === "checkpoint.response.rejected");
1043
+ const ignoredResponses = events.filter((event) => event.kind === "checkpoint.response.ignored");
1037
1044
  const latestPacketEntry = [...history].reverse().find((entry) => entry.packet);
1038
1045
  const latestResponseEntry = [...responses].reverse().find((entry) => entry.response);
1039
1046
  const latestPacket = state.checkpoint_packet || latestPacketEntry?.packet;
@@ -1049,6 +1056,8 @@ function checkpointSummaryFromState(state, engineStatePath) {
1049
1056
  packet_count: packets.length,
1050
1057
  response_count: responses.length,
1051
1058
  duplicate_response_count: duplicateResponses.length,
1059
+ rejected_response_count: rejectedResponses.length,
1060
+ ignored_response_count: ignoredResponses.length,
1052
1061
  latest_checkpoint: state.checkpoint_packet?.checkpoint || latestResponse?.checkpoint || state.last_checkpoint || null,
1053
1062
  latest_stage: state.checkpoint_packet?.stage || latestResponse?.continue_with_stage || state.current_stage || null,
1054
1063
  latest_kind: state.checkpoint_packet?.kind || latestPacket?.kind || null,
@@ -1577,6 +1586,7 @@ function createRunStatusSnapshot(state, at = timestamp2()) {
1577
1586
  function setRunStatus(state, status, at = timestamp2()) {
1578
1587
  state.status = status;
1579
1588
  state.ok = status !== "blocked" && status !== "failed";
1589
+ if (isProtectedFinalStatus(status)) state.finalized = true;
1580
1590
  state.updated_at = at;
1581
1591
  return state;
1582
1592
  }
@@ -1623,6 +1633,7 @@ function applyPrLifecycleState(state, input, at = timestamp2()) {
1623
1633
  createRunState,
1624
1634
  createRunStatusSnapshot,
1625
1635
  isDuplicateCheckpointResponse,
1636
+ isProtectedFinalStatus,
1626
1637
  isSuccessfulStatus,
1627
1638
  isTerminalStatus,
1628
1639
  nonEmptyString,
@@ -1,5 +1,5 @@
1
1
  export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofViewportCapture, RiddleProofViewportMatrixStatus, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from '../types.cjs';
2
- export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.cjs';
2
+ export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isProtectedFinalStatus, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.cjs';
3
3
  export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from '../state.cjs';
4
4
  export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointPacketIdentity, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from '../checkpoint.cjs';
5
5
  export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from '../run-card.cjs';
@@ -1,5 +1,5 @@
1
1
  export { EvidenceArtifact, EvidenceReference, ImplementationAdapter, ImplementationAdapterInput, ImplementationAdapterResult, IntegrationContext, JsonObject, JsonPrimitive, JsonValue, JudgeAdapter, NotificationAdapter, PreflightAdapter, PreflightAdapterInput, PreflightAdapterResult, ProofAdapter, ProofAdapterInput, ProofAdapterResult, RiddleProofArtifactRole, RiddleProofAssessment, RiddleProofBlocker, RiddleProofCheckpointArtifact, RiddleProofCheckpointPacket, RiddleProofCheckpointResponse, RiddleProofCheckpointRole, RiddleProofCheckpointRoutingHint, RiddleProofCheckpointSummary, RiddleProofCheckpointVisibility, RiddleProofDecision, RiddleProofEvent, RiddleProofEvidenceBundle, RiddleProofPrLifecycleState, RiddleProofPrLifecycleStatus, RiddleProofProofContract, RiddleProofRunCard, RiddleProofRunParams, RiddleProofRunResult, RiddleProofRunState, RiddleProofRunStatusSnapshot, RiddleProofStage, RiddleProofStatePaths, RiddleProofStatus, RiddleProofTerminalMetadata, RiddleProofVerificationMode, RiddleProofViewportCapture, RiddleProofViewportMatrixStatus, RiddleProofVisualSession, RiddleProofVisualSessionFingerprintBasis, SetupAdapter, SetupAdapterInput, SetupAdapterResult, ShipAdapter } from '../types.js';
2
- export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.js';
2
+ export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isProtectedFinalStatus, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.js';
3
3
  export { CreateRunStateInput, RIDDLE_PROOF_RUN_STATE_VERSION, RunEventInput, appendRunEvent, appendStageHeartbeat, applyPrLifecycleState, createRunState, createRunStatusSnapshot, normalizeIntegrationContext, normalizePrLifecycleState, normalizeRunParams, setRunStatus } from '../state.js';
4
4
  export { RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION, RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION, authorPacketPayloadFromCheckpointResponse, buildAuthorCheckpointPacket, buildCheckpointPacketForEngineResult, buildProofAssessmentCheckpointPacket, buildStageCheckpointPacket, checkpointPacketIdentity, checkpointResponseIdentity, checkpointSummaryFromState, createCheckpointResponseTemplate, isDuplicateCheckpointResponse, normalizeCheckpointResponse, proofContractFromAuthorCheckpointResponse, statePathsForRunState } from '../checkpoint.js';
5
5
  export { RIDDLE_PROOF_RUN_CARD_VERSION, createRiddleProofRunCard } from '../run-card.js';
@@ -10,11 +10,11 @@ import {
10
10
  normalizePrLifecycleState,
11
11
  normalizeRunParams,
12
12
  setRunStatus
13
- } from "../chunk-Q5GYD5RG.js";
13
+ } from "../chunk-UZIX7M7D.js";
14
14
  import {
15
15
  RIDDLE_PROOF_RUN_CARD_VERSION,
16
16
  createRiddleProofRunCard
17
- } from "../chunk-NYRMPWJB.js";
17
+ } from "../chunk-KNPCWWF3.js";
18
18
  import {
19
19
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
20
20
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
@@ -31,19 +31,20 @@ import {
31
31
  normalizeCheckpointResponse,
32
32
  proofContractFromAuthorCheckpointResponse,
33
33
  statePathsForRunState
34
- } from "../chunk-QUK3SG24.js";
34
+ } from "../chunk-MOTQNIZX.js";
35
35
  import {
36
36
  applyShipControlState,
37
37
  applyTerminalMetadata,
38
38
  compactRecord,
39
39
  createRunResult,
40
+ isProtectedFinalStatus,
40
41
  isSuccessfulStatus,
41
42
  isTerminalStatus,
42
43
  nonEmptyString,
43
44
  normalizeTerminalMetadata,
44
45
  recordValue,
45
46
  shipControlStateFor
46
- } from "../chunk-W44XEGYW.js";
47
+ } from "../chunk-CUBYSWZT.js";
47
48
  import "../chunk-MLKGABMK.js";
48
49
  export {
49
50
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
@@ -70,6 +71,7 @@ export {
70
71
  createRunState,
71
72
  createRunStatusSnapshot,
72
73
  isDuplicateCheckpointResponse,
74
+ isProtectedFinalStatus,
73
75
  isSuccessfulStatus,
74
76
  isTerminalStatus,
75
77
  nonEmptyString,
@@ -24,6 +24,7 @@ __export(result_exports, {
24
24
  applyTerminalMetadata: () => applyTerminalMetadata,
25
25
  compactRecord: () => compactRecord,
26
26
  createRunResult: () => createRunResult,
27
+ isProtectedFinalStatus: () => isProtectedFinalStatus,
27
28
  isSuccessfulStatus: () => isSuccessfulStatus,
28
29
  isTerminalStatus: () => isTerminalStatus,
29
30
  nonEmptyString: () => nonEmptyString,
@@ -37,6 +38,9 @@ module.exports = __toCommonJS(result_exports);
37
38
  function isTerminalStatus(status) {
38
39
  return status === "blocked" || status === "failed" || status === "ready_to_ship" || status === "shipped" || status === "completed";
39
40
  }
41
+ function isProtectedFinalStatus(status) {
42
+ return status === "ready_to_ship" || status === "shipped" || status === "completed";
43
+ }
40
44
  function isSuccessfulStatus(status) {
41
45
  return status !== "blocked" && status !== "failed";
42
46
  }
@@ -250,6 +254,7 @@ function createRunResult(input) {
250
254
  const state = input.metadata ? applyTerminalMetadata(input.state, input.metadata) : input.state;
251
255
  state.status = status;
252
256
  state.ok = ok;
257
+ if (isProtectedFinalStatus(status)) state.finalized = true;
253
258
  applyShipControlState(state, { status, raw: input.raw });
254
259
  return compactRecord({
255
260
  ok,
@@ -304,6 +309,7 @@ function createRunResult(input) {
304
309
  applyTerminalMetadata,
305
310
  compactRecord,
306
311
  createRunResult,
312
+ isProtectedFinalStatus,
307
313
  isSuccessfulStatus,
308
314
  isTerminalStatus,
309
315
  nonEmptyString,
@@ -1,2 +1,2 @@
1
- export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.cjs';
1
+ export { RiddleProofShipControlState, TerminalMetadataInput, applyShipControlState, applyTerminalMetadata, compactRecord, createRunResult, isProtectedFinalStatus, isSuccessfulStatus, isTerminalStatus, nonEmptyString, normalizeTerminalMetadata, recordValue, shipControlStateFor } from '../result.cjs';
2
2
  import '../types.cjs';