@riddledc/riddle-proof 0.8.75 → 0.8.77

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/README.md CHANGED
@@ -110,10 +110,21 @@ riddle-proof-loop run-change-proof \
110
110
  ```
111
111
 
112
112
  When `--output` / `--output-dir` is set, the command writes
113
- `change-proof-result.json`, `summary.md`, and normalized copies of the
114
- `before/profile-result.json` and `after/profile-result.json` inputs. A
115
- non-passing change proof exits nonzero so CI and PR-comment automation can use
116
- the receipt as a gate.
113
+ `change-proof-result.json`, `change-proof-receipt.json`,
114
+ `change-proof-receipt.md`, `change-proof-receipt.html`, `summary.md`, and
115
+ normalized copies of the `before/profile-result.json` and
116
+ `after/profile-result.json` inputs. The receipt files are the human-facing
117
+ handoff: they show the before/after evidence pair, delta verdicts, screenshot
118
+ links when hosted artifacts are available, explicit proof claims from
119
+ `metadata.required_receipts`, and limits from `metadata.does_not_prove`.
120
+ `riddle-proof-loop pr-comment --proof-dir <dir>` recognizes the receipt JSON
121
+ and uses it as the PR review summary. A non-passing change proof exits nonzero
122
+ so CI and on-demand PR automation can use the receipt as a gate without running
123
+ noisy scheduled workflows.
124
+
125
+ For a small hosted-preview dogfood target, see
126
+ `examples/profiles/hosted-change-proof-preview.json` and
127
+ `examples/change-contracts/hosted-change-proof-preview.json`.
117
128
 
118
129
  ## Durable Loop CLI
119
130
 
@@ -21,12 +21,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
21
21
  var change_proof_exports = {};
22
22
  __export(change_proof_exports, {
23
23
  RIDDLE_PROOF_CHANGE_CONTRACT_VERSION: () => RIDDLE_PROOF_CHANGE_CONTRACT_VERSION,
24
+ RIDDLE_PROOF_CHANGE_RECEIPT_VERSION: () => RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
24
25
  RIDDLE_PROOF_CHANGE_RESULT_VERSION: () => RIDDLE_PROOF_CHANGE_RESULT_VERSION,
25
- assessRiddleProofChange: () => assessRiddleProofChange
26
+ assessRiddleProofChange: () => assessRiddleProofChange,
27
+ createRiddleProofChangeReceipt: () => createRiddleProofChangeReceipt,
28
+ riddleProofChangeReceiptHtml: () => riddleProofChangeReceiptHtml,
29
+ riddleProofChangeReceiptMarkdown: () => riddleProofChangeReceiptMarkdown
26
30
  });
27
31
  module.exports = __toCommonJS(change_proof_exports);
28
32
  var RIDDLE_PROOF_CHANGE_CONTRACT_VERSION = "riddle-proof.change-contract.v1";
29
33
  var RIDDLE_PROOF_CHANGE_RESULT_VERSION = "riddle-proof.change-result.v1";
34
+ var RIDDLE_PROOF_CHANGE_RECEIPT_VERSION = "riddle-proof.change-receipt.v1";
30
35
  var DEFAULT_BEFORE_STATUSES = ["passed", "product_regression"];
31
36
  var DEFAULT_AFTER_STATUSES = ["passed"];
32
37
  var DEFAULT_PROFILE_STATUS_TRANSITION_BEFORE = ["product_regression"];
@@ -185,9 +190,329 @@ function assessRiddleProofChange(contract, input) {
185
190
  metadata: contract.metadata
186
191
  };
187
192
  }
193
+ function changeReceiptVerdict(status) {
194
+ if (status === "passed") return "mergeable";
195
+ if (status === "environment_blocked") return "environment_blocked";
196
+ if (status === "configuration_error") return "configuration_error";
197
+ if (status === "needs_human_review") return "needs_human_review";
198
+ if (status === "proof_insufficient") return "proof_insufficient";
199
+ return "not_mergeable";
200
+ }
201
+ function profileCheckCounts(result) {
202
+ const counts = {
203
+ total: result.checks.length,
204
+ passed: 0,
205
+ failed: 0,
206
+ skipped: 0,
207
+ needs_human_review: 0
208
+ };
209
+ for (const check of result.checks) {
210
+ if (check.status === "passed") counts.passed += 1;
211
+ if (check.status === "failed") counts.failed += 1;
212
+ if (check.status === "skipped") counts.skipped += 1;
213
+ if (check.status === "needs_human_review") counts.needs_human_review += 1;
214
+ }
215
+ return counts;
216
+ }
217
+ function artifactKind(ref) {
218
+ const text = [ref.name, ref.url, ref.path, ref.kind, ref.content_type].filter(Boolean).join(" ").toLowerCase();
219
+ if (/\bimage\b/.test(text) || /\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(text)) return "image";
220
+ if (/\bjson\b|\btext\b|\bmarkdown\b|\bhtml\b|\blog\b/.test(text) || /\.(json|md|txt|html|log|har)(\?|#|$)/.test(text)) return "data";
221
+ return "artifact";
222
+ }
223
+ function receiptArtifactFromRef(side, ref) {
224
+ return {
225
+ side,
226
+ name: ref.name,
227
+ kind: artifactKind(ref),
228
+ url: ref.url,
229
+ path: ref.path,
230
+ source: ref.source
231
+ };
232
+ }
233
+ function comparableArtifactName(value) {
234
+ return (value || "").split(/[/?#]/).pop()?.toLowerCase().replace(/\.(png|jpe?g|gif|webp|avif|svg)$/u, "").replace(/[^a-z0-9_-]+/gu, "-").replace(/^-+|-+$/g, "") || "";
235
+ }
236
+ function artifactMatchesScreenshotLabel(artifact, screenshot) {
237
+ const screenshotName = comparableArtifactName(screenshot);
238
+ if (!screenshotName) return false;
239
+ return [artifact.name, artifact.url, artifact.path].map(comparableArtifactName).some((name) => name === screenshotName || name.endsWith(`-${screenshotName}`));
240
+ }
241
+ function collectReceiptArtifacts(side, result) {
242
+ const artifacts = [];
243
+ const seen = /* @__PURE__ */ new Set();
244
+ const add = (artifact) => {
245
+ const key = artifact.url || artifact.path || `${artifact.kind}:${artifact.name}`;
246
+ if (!artifact.name || seen.has(key)) return;
247
+ seen.add(key);
248
+ artifacts.push(artifact);
249
+ };
250
+ for (const ref of result.artifacts.riddle_artifacts || []) {
251
+ add(receiptArtifactFromRef(side, ref));
252
+ }
253
+ for (const screenshot of result.artifacts.screenshots || []) {
254
+ if (artifacts.some((artifact) => artifactMatchesScreenshotLabel(artifact, screenshot))) continue;
255
+ add({
256
+ side,
257
+ name: screenshot,
258
+ kind: "image"
259
+ });
260
+ }
261
+ return artifacts;
262
+ }
263
+ function artifactIsScreenshot(artifact) {
264
+ if (artifact.kind !== "image") return false;
265
+ return /screenshot|\.png|\.jpe?g|\.webp|\.gif|\.avif|\.svg/i.test([artifact.name, artifact.url, artifact.path].filter(Boolean).join(" "));
266
+ }
267
+ function receiptSide(side, source, result) {
268
+ const artifacts = collectReceiptArtifacts(side, result);
269
+ return {
270
+ side,
271
+ source,
272
+ profile_name: result.profile_name,
273
+ status: result.status,
274
+ summary: result.summary,
275
+ route: result.route,
276
+ captured_at: result.captured_at,
277
+ checks: profileCheckCounts(result),
278
+ screenshots: artifacts.filter(artifactIsScreenshot),
279
+ artifacts
280
+ };
281
+ }
282
+ function metadataStringList(metadata, key) {
283
+ const value = metadata?.[key];
284
+ if (!Array.isArray(value)) return [];
285
+ return value.filter((item) => typeof item === "string" && item.trim().length > 0).map((item) => item.trim());
286
+ }
287
+ function createRiddleProofChangeReceipt(input) {
288
+ return {
289
+ version: RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
290
+ contract_name: input.result.contract_name,
291
+ profile_name: input.profile_name,
292
+ status: input.result.status,
293
+ verdict: changeReceiptVerdict(input.result.status),
294
+ summary: input.result.summary,
295
+ before: receiptSide("before", input.before_source, input.before_result),
296
+ after: receiptSide("after", input.after_source, input.after_result),
297
+ deltas: input.result.deltas.map((delta) => ({
298
+ type: delta.type,
299
+ label: delta.label,
300
+ status: delta.status,
301
+ before_observed: delta.before_observed,
302
+ after_observed: delta.after_observed,
303
+ message: delta.message
304
+ })),
305
+ proves: metadataStringList(input.contract.metadata, "required_receipts"),
306
+ does_not_prove: metadataStringList(input.contract.metadata, "does_not_prove"),
307
+ metadata: input.result.metadata
308
+ };
309
+ }
310
+ function markdownTableCell(value) {
311
+ return String(value ?? "").replace(/\|/g, "\\|").replace(/\r?\n/g, " ");
312
+ }
313
+ function artifactTarget(artifact) {
314
+ return artifact.url || artifact.path;
315
+ }
316
+ function markdownLink(label, target) {
317
+ return `[${label.replace(/\]/g, "\\]")}](${target})`;
318
+ }
319
+ function appendMarkdownArtifacts(lines, title, artifacts) {
320
+ lines.push(`### ${title}`, "");
321
+ if (!artifacts.length) {
322
+ lines.push("- No screenshot artifacts recorded.", "");
323
+ return;
324
+ }
325
+ for (const artifact of artifacts.slice(0, 6)) {
326
+ const target = artifactTarget(artifact);
327
+ if (target && artifact.kind === "image") {
328
+ lines.push(`![${artifact.name.replace(/\]/g, "\\]")}](${target})`);
329
+ } else if (target) {
330
+ lines.push(`- ${markdownLink(artifact.name, target)}`);
331
+ } else {
332
+ lines.push(`- ${artifact.name}`);
333
+ }
334
+ }
335
+ if (artifacts.length > 6) lines.push(`- ${artifacts.length - 6} more artifact(s) omitted`);
336
+ lines.push("");
337
+ }
338
+ function riddleProofChangeReceiptMarkdown(receipt) {
339
+ const lines = [
340
+ "# Riddle Proof Change Receipt",
341
+ "",
342
+ `**Verdict:** ${receipt.verdict}`,
343
+ `**Status:** ${receipt.status}`,
344
+ `**Contract:** ${receipt.contract_name}`,
345
+ receipt.profile_name ? `**Profile:** ${receipt.profile_name}` : "",
346
+ "",
347
+ receipt.summary,
348
+ "",
349
+ "## Evidence Pair",
350
+ "",
351
+ "| Side | Source | Status | Checks |",
352
+ "| --- | --- | --- | --- |",
353
+ `| Before | ${markdownTableCell(receipt.before.source)} | ${receipt.before.status} | ${receipt.before.checks.passed} passed / ${receipt.before.checks.failed} failed |`,
354
+ `| After | ${markdownTableCell(receipt.after.source)} | ${receipt.after.status} | ${receipt.after.checks.passed} passed / ${receipt.after.checks.failed} failed |`,
355
+ "",
356
+ "## Delta Checks",
357
+ "",
358
+ "| Delta | Status | Before | After |",
359
+ "| --- | --- | --- | --- |"
360
+ ].filter(Boolean);
361
+ for (const delta of receipt.deltas) {
362
+ lines.push(`| ${markdownTableCell(delta.label)} | ${delta.status} | ${markdownTableCell(delta.before_observed)} | ${markdownTableCell(delta.after_observed)} |`);
363
+ if (delta.message) lines.push(`| ${markdownTableCell(`${delta.label} message`)} | ${markdownTableCell(delta.message)} | | |`);
364
+ }
365
+ lines.push("");
366
+ appendMarkdownArtifacts(lines, "Before Screenshot", receipt.before.screenshots);
367
+ appendMarkdownArtifacts(lines, "After Screenshot", receipt.after.screenshots);
368
+ if (receipt.proves.length) {
369
+ lines.push("## What This Proves", "");
370
+ for (const claim of receipt.proves) lines.push(`- ${claim}`);
371
+ lines.push("");
372
+ }
373
+ if (receipt.does_not_prove.length) {
374
+ lines.push("## What This Does Not Prove", "");
375
+ for (const claim of receipt.does_not_prove) lines.push(`- ${claim}`);
376
+ lines.push("");
377
+ }
378
+ const linkedArtifacts = [...receipt.before.artifacts, ...receipt.after.artifacts].filter((artifact) => artifactTarget(artifact)).slice(0, 24);
379
+ if (linkedArtifacts.length) {
380
+ lines.push("## Artifacts", "");
381
+ for (const artifact of linkedArtifacts) {
382
+ lines.push(`- ${artifact.side}: ${markdownLink(artifact.name, artifactTarget(artifact) || "")}`);
383
+ }
384
+ lines.push("");
385
+ }
386
+ return `${lines.join("\n").trim()}
387
+ `;
388
+ }
389
+ function escapeHtml(value) {
390
+ return String(value ?? "").replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
391
+ }
392
+ function htmlArtifactCard(artifact) {
393
+ const target = artifactTarget(artifact);
394
+ if (!target) return `<p>${escapeHtml(artifact.name)}</p>`;
395
+ if (artifact.kind === "image") {
396
+ return `<figure><img src="${escapeHtml(target)}" alt="${escapeHtml(artifact.name)}"><figcaption>${escapeHtml(artifact.name)}</figcaption></figure>`;
397
+ }
398
+ return `<p><a href="${escapeHtml(target)}">${escapeHtml(artifact.name)}</a></p>`;
399
+ }
400
+ function htmlArtifactLink(artifact) {
401
+ const target = artifactTarget(artifact);
402
+ if (!target) return escapeHtml(artifact.name);
403
+ return `<a href="${escapeHtml(target)}">${escapeHtml(artifact.name)}</a>`;
404
+ }
405
+ function htmlList(items, emptyText) {
406
+ if (!items.length) return `<p class="muted">${escapeHtml(emptyText)}</p>`;
407
+ return `<ul>${items.map((item) => `<li>${escapeHtml(item)}</li>`).join("")}</ul>`;
408
+ }
409
+ function riddleProofChangeReceiptHtml(receipt) {
410
+ const artifactLinks = [...receipt.before.artifacts, ...receipt.after.artifacts].filter((artifact) => artifactTarget(artifact)).slice(0, 32);
411
+ const deltaRows = receipt.deltas.map((delta) => `
412
+ <tr>
413
+ <td>${escapeHtml(delta.label)}</td>
414
+ <td><span class="status ${escapeHtml(delta.status)}">${escapeHtml(delta.status)}</span></td>
415
+ <td>${escapeHtml(delta.before_observed)}</td>
416
+ <td>${escapeHtml(delta.after_observed)}</td>
417
+ </tr>
418
+ ${delta.message ? `<tr><td class="muted">${escapeHtml(delta.label)} message</td><td colspan="3">${escapeHtml(delta.message)}</td></tr>` : ""}`).join("");
419
+ return `<!doctype html>
420
+ <html lang="en">
421
+ <head>
422
+ <meta charset="utf-8">
423
+ <meta name="viewport" content="width=device-width, initial-scale=1">
424
+ <title>${escapeHtml(receipt.contract_name)} - Riddle Proof Change Receipt</title>
425
+ <style>
426
+ :root { color-scheme: light dark; --bg: #0f141b; --panel: #171f29; --text: #eef4f8; --muted: #aebbc8; --border: #314152; --ok: #69d089; --bad: #ff7a7a; --warn: #ffd166; }
427
+ body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
428
+ main { max-width: 1120px; margin: 0 auto; padding: 32px 20px 48px; }
429
+ header, section { border: 1px solid var(--border); background: var(--panel); border-radius: 8px; padding: 20px; margin: 0 0 18px; }
430
+ h1, h2, h3, p { margin-top: 0; }
431
+ h1 { font-size: clamp(1.6rem, 3vw, 2.4rem); }
432
+ h2 { font-size: 1.1rem; margin-bottom: 14px; }
433
+ .muted { color: var(--muted); }
434
+ .verdict { display: inline-flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border); font-weight: 700; }
435
+ .mergeable, .passed { color: var(--ok); }
436
+ .not_mergeable, .failed, .product_regression { color: var(--bad); }
437
+ .proof_insufficient, .environment_blocked, .needs_human_review, .configuration_error { color: var(--warn); }
438
+ .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
439
+ .side { border: 1px solid var(--border); border-radius: 8px; padding: 14px; min-width: 0; }
440
+ code { overflow-wrap: anywhere; color: var(--muted); }
441
+ table { width: 100%; border-collapse: collapse; }
442
+ th, td { border-bottom: 1px solid var(--border); padding: 10px 8px; text-align: left; vertical-align: top; }
443
+ figure { margin: 0; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: #0b1017; }
444
+ img { display: block; width: 100%; height: auto; }
445
+ figcaption { padding: 8px 10px; color: var(--muted); font-size: 0.9rem; }
446
+ ul { margin-bottom: 0; }
447
+ a { color: #8bc7ff; }
448
+ @media (max-width: 760px) { .grid { grid-template-columns: 1fr; } main { padding: 18px 12px 32px; } }
449
+ </style>
450
+ </head>
451
+ <body>
452
+ <main>
453
+ <header>
454
+ <p class="verdict ${escapeHtml(receipt.verdict)}">${escapeHtml(receipt.verdict)}</p>
455
+ <h1>${escapeHtml(receipt.contract_name)}</h1>
456
+ <p>${escapeHtml(receipt.summary)}</p>
457
+ <p class="muted">Status: ${escapeHtml(receipt.status)}${receipt.profile_name ? ` | Profile: ${escapeHtml(receipt.profile_name)}` : ""}</p>
458
+ </header>
459
+ <section>
460
+ <h2>Evidence Pair</h2>
461
+ <div class="grid">
462
+ <div class="side">
463
+ <h3>Before</h3>
464
+ <p><code>${escapeHtml(receipt.before.source)}</code></p>
465
+ <p>Status: <strong class="${escapeHtml(receipt.before.status)}">${escapeHtml(receipt.before.status)}</strong></p>
466
+ <p>${escapeHtml(receipt.before.summary)}</p>
467
+ <p class="muted">${receipt.before.checks.passed} passed / ${receipt.before.checks.failed} failed checks</p>
468
+ </div>
469
+ <div class="side">
470
+ <h3>After</h3>
471
+ <p><code>${escapeHtml(receipt.after.source)}</code></p>
472
+ <p>Status: <strong class="${escapeHtml(receipt.after.status)}">${escapeHtml(receipt.after.status)}</strong></p>
473
+ <p>${escapeHtml(receipt.after.summary)}</p>
474
+ <p class="muted">${receipt.after.checks.passed} passed / ${receipt.after.checks.failed} failed checks</p>
475
+ </div>
476
+ </div>
477
+ </section>
478
+ <section>
479
+ <h2>Delta Checks</h2>
480
+ <table>
481
+ <thead><tr><th>Delta</th><th>Status</th><th>Before</th><th>After</th></tr></thead>
482
+ <tbody>${deltaRows}</tbody>
483
+ </table>
484
+ </section>
485
+ <section>
486
+ <h2>Screenshots</h2>
487
+ <div class="grid">
488
+ <div>${receipt.before.screenshots.slice(0, 4).map(htmlArtifactCard).join("") || `<p class="muted">No before screenshots recorded.</p>`}</div>
489
+ <div>${receipt.after.screenshots.slice(0, 4).map(htmlArtifactCard).join("") || `<p class="muted">No after screenshots recorded.</p>`}</div>
490
+ </div>
491
+ </section>
492
+ <section>
493
+ <h2>What This Proves</h2>
494
+ ${htmlList(receipt.proves, "No explicit proof claims were recorded in contract metadata.")}
495
+ </section>
496
+ <section>
497
+ <h2>What This Does Not Prove</h2>
498
+ ${htmlList(receipt.does_not_prove, "No explicit limits were recorded in contract metadata.")}
499
+ </section>
500
+ <section>
501
+ <h2>Artifacts</h2>
502
+ ${artifactLinks.length ? `<ul>${artifactLinks.map((artifact) => `<li>${escapeHtml(artifact.side)}: ${htmlArtifactLink(artifact)}</li>`).join("")}</ul>` : `<p class="muted">No linked artifacts recorded.</p>`}
503
+ </section>
504
+ </main>
505
+ </body>
506
+ </html>
507
+ `;
508
+ }
188
509
  // Annotate the CommonJS export names for ESM import in node:
189
510
  0 && (module.exports = {
190
511
  RIDDLE_PROOF_CHANGE_CONTRACT_VERSION,
512
+ RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
191
513
  RIDDLE_PROOF_CHANGE_RESULT_VERSION,
192
- assessRiddleProofChange
514
+ assessRiddleProofChange,
515
+ createRiddleProofChangeReceipt,
516
+ riddleProofChangeReceiptHtml,
517
+ riddleProofChangeReceiptMarkdown
193
518
  });
@@ -4,6 +4,7 @@ import './public-state.cjs';
4
4
 
5
5
  declare const RIDDLE_PROOF_CHANGE_CONTRACT_VERSION: "riddle-proof.change-contract.v1";
6
6
  declare const RIDDLE_PROOF_CHANGE_RESULT_VERSION: "riddle-proof.change-result.v1";
7
+ declare const RIDDLE_PROOF_CHANGE_RECEIPT_VERSION: "riddle-proof.change-receipt.v1";
7
8
  type RiddleProofChangeSide = "before" | "after";
8
9
  type RiddleProofChangeStatus = RiddleProofProfileStatus;
9
10
  type RiddleProofChangeDeltaStatus = "passed" | "failed" | "proof_insufficient" | "configuration_error";
@@ -69,6 +70,69 @@ interface AssessRiddleProofChangeInput {
69
70
  before_result?: RiddleProofProfileResult;
70
71
  after_result?: RiddleProofProfileResult;
71
72
  }
73
+ type RiddleProofChangeReceiptVerdict = "mergeable" | "not_mergeable" | "environment_blocked" | "needs_human_review" | "configuration_error" | "proof_insufficient";
74
+ type RiddleProofChangeReceiptArtifactKind = "image" | "data" | "artifact";
75
+ interface RiddleProofChangeReceiptArtifact {
76
+ side: RiddleProofChangeSide;
77
+ name: string;
78
+ kind: RiddleProofChangeReceiptArtifactKind;
79
+ url?: string;
80
+ path?: string;
81
+ source?: string;
82
+ }
83
+ interface RiddleProofChangeReceiptCheckCounts {
84
+ total: number;
85
+ passed: number;
86
+ failed: number;
87
+ skipped: number;
88
+ needs_human_review: number;
89
+ }
90
+ interface RiddleProofChangeReceiptSide {
91
+ side: RiddleProofChangeSide;
92
+ source: string;
93
+ profile_name: string;
94
+ status: RiddleProofProfileStatus;
95
+ summary: string;
96
+ route?: JsonValue;
97
+ captured_at?: string;
98
+ checks: RiddleProofChangeReceiptCheckCounts;
99
+ screenshots: RiddleProofChangeReceiptArtifact[];
100
+ artifacts: RiddleProofChangeReceiptArtifact[];
101
+ }
102
+ interface RiddleProofChangeReceiptDelta {
103
+ type: RiddleProofChangeDeltaResult["type"];
104
+ label: string;
105
+ status: RiddleProofChangeDeltaStatus;
106
+ before_observed?: JsonValue;
107
+ after_observed?: JsonValue;
108
+ message?: string;
109
+ }
110
+ interface RiddleProofChangeReceipt {
111
+ version: typeof RIDDLE_PROOF_CHANGE_RECEIPT_VERSION;
112
+ contract_name: string;
113
+ profile_name?: string;
114
+ status: RiddleProofChangeStatus;
115
+ verdict: RiddleProofChangeReceiptVerdict;
116
+ summary: string;
117
+ before: RiddleProofChangeReceiptSide;
118
+ after: RiddleProofChangeReceiptSide;
119
+ deltas: RiddleProofChangeReceiptDelta[];
120
+ proves: string[];
121
+ does_not_prove: string[];
122
+ metadata?: Record<string, JsonValue>;
123
+ }
124
+ interface CreateRiddleProofChangeReceiptInput {
125
+ contract: RiddleProofChangeContract;
126
+ result: RiddleProofChangeResult;
127
+ before_result: RiddleProofProfileResult;
128
+ after_result: RiddleProofProfileResult;
129
+ before_source: string;
130
+ after_source: string;
131
+ profile_name?: string;
132
+ }
72
133
  declare function assessRiddleProofChange(contract: RiddleProofChangeContract, input: AssessRiddleProofChangeInput): RiddleProofChangeResult;
134
+ declare function createRiddleProofChangeReceipt(input: CreateRiddleProofChangeReceiptInput): RiddleProofChangeReceipt;
135
+ declare function riddleProofChangeReceiptMarkdown(receipt: RiddleProofChangeReceipt): string;
136
+ declare function riddleProofChangeReceiptHtml(receipt: RiddleProofChangeReceipt): string;
73
137
 
74
- export { type AssessRiddleProofChangeInput, RIDDLE_PROOF_CHANGE_CONTRACT_VERSION, RIDDLE_PROOF_CHANGE_RESULT_VERSION, type RiddleProofChangeContract, type RiddleProofChangeDelta, type RiddleProofChangeDeltaResult, type RiddleProofChangeDeltaStatus, type RiddleProofChangeGroupContract, type RiddleProofChangeGroupResult, type RiddleProofChangeProfileCheckStatus, type RiddleProofChangeResult, type RiddleProofChangeSide, type RiddleProofChangeStatus, type RiddleProofCheckStatusTransitionDelta, type RiddleProofProfileStatusTransitionDelta, assessRiddleProofChange };
138
+ export { type AssessRiddleProofChangeInput, type CreateRiddleProofChangeReceiptInput, RIDDLE_PROOF_CHANGE_CONTRACT_VERSION, RIDDLE_PROOF_CHANGE_RECEIPT_VERSION, RIDDLE_PROOF_CHANGE_RESULT_VERSION, type RiddleProofChangeContract, type RiddleProofChangeDelta, type RiddleProofChangeDeltaResult, type RiddleProofChangeDeltaStatus, type RiddleProofChangeGroupContract, type RiddleProofChangeGroupResult, type RiddleProofChangeProfileCheckStatus, type RiddleProofChangeReceipt, type RiddleProofChangeReceiptArtifact, type RiddleProofChangeReceiptArtifactKind, type RiddleProofChangeReceiptCheckCounts, type RiddleProofChangeReceiptDelta, type RiddleProofChangeReceiptSide, type RiddleProofChangeReceiptVerdict, type RiddleProofChangeResult, type RiddleProofChangeSide, type RiddleProofChangeStatus, type RiddleProofCheckStatusTransitionDelta, type RiddleProofProfileStatusTransitionDelta, assessRiddleProofChange, createRiddleProofChangeReceipt, riddleProofChangeReceiptHtml, riddleProofChangeReceiptMarkdown };
@@ -4,6 +4,7 @@ import './public-state.js';
4
4
 
5
5
  declare const RIDDLE_PROOF_CHANGE_CONTRACT_VERSION: "riddle-proof.change-contract.v1";
6
6
  declare const RIDDLE_PROOF_CHANGE_RESULT_VERSION: "riddle-proof.change-result.v1";
7
+ declare const RIDDLE_PROOF_CHANGE_RECEIPT_VERSION: "riddle-proof.change-receipt.v1";
7
8
  type RiddleProofChangeSide = "before" | "after";
8
9
  type RiddleProofChangeStatus = RiddleProofProfileStatus;
9
10
  type RiddleProofChangeDeltaStatus = "passed" | "failed" | "proof_insufficient" | "configuration_error";
@@ -69,6 +70,69 @@ interface AssessRiddleProofChangeInput {
69
70
  before_result?: RiddleProofProfileResult;
70
71
  after_result?: RiddleProofProfileResult;
71
72
  }
73
+ type RiddleProofChangeReceiptVerdict = "mergeable" | "not_mergeable" | "environment_blocked" | "needs_human_review" | "configuration_error" | "proof_insufficient";
74
+ type RiddleProofChangeReceiptArtifactKind = "image" | "data" | "artifact";
75
+ interface RiddleProofChangeReceiptArtifact {
76
+ side: RiddleProofChangeSide;
77
+ name: string;
78
+ kind: RiddleProofChangeReceiptArtifactKind;
79
+ url?: string;
80
+ path?: string;
81
+ source?: string;
82
+ }
83
+ interface RiddleProofChangeReceiptCheckCounts {
84
+ total: number;
85
+ passed: number;
86
+ failed: number;
87
+ skipped: number;
88
+ needs_human_review: number;
89
+ }
90
+ interface RiddleProofChangeReceiptSide {
91
+ side: RiddleProofChangeSide;
92
+ source: string;
93
+ profile_name: string;
94
+ status: RiddleProofProfileStatus;
95
+ summary: string;
96
+ route?: JsonValue;
97
+ captured_at?: string;
98
+ checks: RiddleProofChangeReceiptCheckCounts;
99
+ screenshots: RiddleProofChangeReceiptArtifact[];
100
+ artifacts: RiddleProofChangeReceiptArtifact[];
101
+ }
102
+ interface RiddleProofChangeReceiptDelta {
103
+ type: RiddleProofChangeDeltaResult["type"];
104
+ label: string;
105
+ status: RiddleProofChangeDeltaStatus;
106
+ before_observed?: JsonValue;
107
+ after_observed?: JsonValue;
108
+ message?: string;
109
+ }
110
+ interface RiddleProofChangeReceipt {
111
+ version: typeof RIDDLE_PROOF_CHANGE_RECEIPT_VERSION;
112
+ contract_name: string;
113
+ profile_name?: string;
114
+ status: RiddleProofChangeStatus;
115
+ verdict: RiddleProofChangeReceiptVerdict;
116
+ summary: string;
117
+ before: RiddleProofChangeReceiptSide;
118
+ after: RiddleProofChangeReceiptSide;
119
+ deltas: RiddleProofChangeReceiptDelta[];
120
+ proves: string[];
121
+ does_not_prove: string[];
122
+ metadata?: Record<string, JsonValue>;
123
+ }
124
+ interface CreateRiddleProofChangeReceiptInput {
125
+ contract: RiddleProofChangeContract;
126
+ result: RiddleProofChangeResult;
127
+ before_result: RiddleProofProfileResult;
128
+ after_result: RiddleProofProfileResult;
129
+ before_source: string;
130
+ after_source: string;
131
+ profile_name?: string;
132
+ }
72
133
  declare function assessRiddleProofChange(contract: RiddleProofChangeContract, input: AssessRiddleProofChangeInput): RiddleProofChangeResult;
134
+ declare function createRiddleProofChangeReceipt(input: CreateRiddleProofChangeReceiptInput): RiddleProofChangeReceipt;
135
+ declare function riddleProofChangeReceiptMarkdown(receipt: RiddleProofChangeReceipt): string;
136
+ declare function riddleProofChangeReceiptHtml(receipt: RiddleProofChangeReceipt): string;
73
137
 
74
- export { type AssessRiddleProofChangeInput, RIDDLE_PROOF_CHANGE_CONTRACT_VERSION, RIDDLE_PROOF_CHANGE_RESULT_VERSION, type RiddleProofChangeContract, type RiddleProofChangeDelta, type RiddleProofChangeDeltaResult, type RiddleProofChangeDeltaStatus, type RiddleProofChangeGroupContract, type RiddleProofChangeGroupResult, type RiddleProofChangeProfileCheckStatus, type RiddleProofChangeResult, type RiddleProofChangeSide, type RiddleProofChangeStatus, type RiddleProofCheckStatusTransitionDelta, type RiddleProofProfileStatusTransitionDelta, assessRiddleProofChange };
138
+ export { type AssessRiddleProofChangeInput, type CreateRiddleProofChangeReceiptInput, RIDDLE_PROOF_CHANGE_CONTRACT_VERSION, RIDDLE_PROOF_CHANGE_RECEIPT_VERSION, RIDDLE_PROOF_CHANGE_RESULT_VERSION, type RiddleProofChangeContract, type RiddleProofChangeDelta, type RiddleProofChangeDeltaResult, type RiddleProofChangeDeltaStatus, type RiddleProofChangeGroupContract, type RiddleProofChangeGroupResult, type RiddleProofChangeProfileCheckStatus, type RiddleProofChangeReceipt, type RiddleProofChangeReceiptArtifact, type RiddleProofChangeReceiptArtifactKind, type RiddleProofChangeReceiptCheckCounts, type RiddleProofChangeReceiptDelta, type RiddleProofChangeReceiptSide, type RiddleProofChangeReceiptVerdict, type RiddleProofChangeResult, type RiddleProofChangeSide, type RiddleProofChangeStatus, type RiddleProofCheckStatusTransitionDelta, type RiddleProofProfileStatusTransitionDelta, assessRiddleProofChange, createRiddleProofChangeReceipt, riddleProofChangeReceiptHtml, riddleProofChangeReceiptMarkdown };
@@ -1,11 +1,19 @@
1
1
  import {
2
2
  RIDDLE_PROOF_CHANGE_CONTRACT_VERSION,
3
+ RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
3
4
  RIDDLE_PROOF_CHANGE_RESULT_VERSION,
4
- assessRiddleProofChange
5
- } from "./chunk-6S7DZWVC.js";
5
+ assessRiddleProofChange,
6
+ createRiddleProofChangeReceipt,
7
+ riddleProofChangeReceiptHtml,
8
+ riddleProofChangeReceiptMarkdown
9
+ } from "./chunk-BILL3UC2.js";
6
10
  import "./chunk-MLKGABMK.js";
7
11
  export {
8
12
  RIDDLE_PROOF_CHANGE_CONTRACT_VERSION,
13
+ RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
9
14
  RIDDLE_PROOF_CHANGE_RESULT_VERSION,
10
- assessRiddleProofChange
15
+ assessRiddleProofChange,
16
+ createRiddleProofChangeReceipt,
17
+ riddleProofChangeReceiptHtml,
18
+ riddleProofChangeReceiptMarkdown
11
19
  };