@riddledc/riddle-proof 0.8.84 → 0.8.86

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 (110) hide show
  1. package/README.md +193 -0
  2. package/capabilities.json +17 -0
  3. package/dist/advanced/engine-harness.js +2 -2
  4. package/dist/advanced/index.d.cts +2 -2
  5. package/dist/advanced/index.d.ts +2 -2
  6. package/dist/advanced/index.js +4 -4
  7. package/dist/advanced/proof-run-core.d.cts +1 -1
  8. package/dist/advanced/proof-run-core.d.ts +1 -1
  9. package/dist/advanced/proof-run-engine.d.cts +2 -2
  10. package/dist/advanced/proof-run-engine.d.ts +2 -2
  11. package/dist/advanced/runner.js +2 -2
  12. package/dist/change-proof.cjs +24 -269
  13. package/dist/change-proof.d.cts +2 -2
  14. package/dist/change-proof.d.ts +2 -2
  15. package/dist/change-proof.js +3 -3
  16. package/dist/checked-meaning.cjs +67 -0
  17. package/dist/checked-meaning.d.cts +2 -0
  18. package/dist/checked-meaning.d.ts +2 -0
  19. package/dist/checked-meaning.js +41 -0
  20. package/dist/{chunk-QYZ3GKCP.js → chunk-3W4NGKZ6.js} +20 -19
  21. package/dist/chunk-6S33FQL7.js +14 -0
  22. package/dist/{chunk-FW7CKARF.js → chunk-7W6ZJPHJ.js} +1 -1
  23. package/dist/{chunk-7OAETQU3.js → chunk-BVYM4WJ5.js} +1 -1
  24. package/dist/chunk-GQOE5Q7C.js +32 -0
  25. package/dist/chunk-H5AALGSA.js +32 -0
  26. package/dist/chunk-J2SIQGQI.js +71 -0
  27. package/dist/chunk-KB7FYRBG.js +46 -0
  28. package/dist/{chunk-2K3DIK7A.js → chunk-KF6F2RMQ.js} +301 -3979
  29. package/dist/{chunk-LR4UYJDY.js → chunk-NR2XQXIC.js} +4 -4
  30. package/dist/chunk-NWLKJ2WI.js +31 -0
  31. package/dist/chunk-ODLGSEP2.js +43 -0
  32. package/dist/chunk-OHDNCXRM.js +17 -0
  33. package/dist/cli/index.js +9 -9
  34. package/dist/cli.cjs +606 -5177
  35. package/dist/cli.d.cts +0 -1
  36. package/dist/cli.d.ts +0 -1
  37. package/dist/cli.js +9 -9
  38. package/dist/engine-harness.js +2 -2
  39. package/dist/evidence-trust-root.cjs +54 -0
  40. package/dist/evidence-trust-root.d.cts +2 -0
  41. package/dist/evidence-trust-root.d.ts +2 -0
  42. package/dist/evidence-trust-root.js +31 -0
  43. package/dist/grounded-evidence.cjs +95 -0
  44. package/dist/grounded-evidence.d.cts +2 -0
  45. package/dist/grounded-evidence.d.ts +2 -0
  46. package/dist/grounded-evidence.js +69 -0
  47. package/dist/index.cjs +5995 -11368
  48. package/dist/index.d.cts +17 -4
  49. package/dist/index.d.ts +17 -4
  50. package/dist/index.js +202 -28
  51. package/dist/packet.cjs +54 -0
  52. package/dist/packet.d.cts +2 -0
  53. package/dist/packet.d.ts +2 -0
  54. package/dist/packet.js +31 -0
  55. package/dist/pr-comment.cjs +19 -116
  56. package/dist/pr-comment.d.cts +2 -2
  57. package/dist/pr-comment.d.ts +2 -2
  58. package/dist/pr-comment.js +4 -4
  59. package/dist/profile/index.cjs +277 -3991
  60. package/dist/profile/index.d.cts +2 -3
  61. package/dist/profile/index.d.ts +2 -3
  62. package/dist/profile/index.js +1 -1
  63. package/dist/profile-suggestions.cjs +2 -2
  64. package/dist/profile-suggestions.d.cts +1 -3
  65. package/dist/profile-suggestions.d.ts +1 -3
  66. package/dist/profile-suggestions.js +2 -2
  67. package/dist/profile.cjs +277 -3991
  68. package/dist/profile.d.cts +3 -550
  69. package/dist/profile.d.ts +3 -550
  70. package/dist/profile.js +1 -1
  71. package/dist/{proof-run-core-7Dqm7RKM.d.cts → proof-run-core-DwwrRhY4.d.cts} +1 -1
  72. package/dist/{proof-run-core-7Dqm7RKM.d.ts → proof-run-core-DwwrRhY4.d.ts} +1 -1
  73. package/dist/proof-run-core.d.cts +1 -1
  74. package/dist/proof-run-core.d.ts +1 -1
  75. package/dist/{proof-run-engine-BqRoA3Do.d.ts → proof-run-engine-CWBgj-15.d.ts} +4 -4
  76. package/dist/{proof-run-engine-DpChFR5H.d.cts → proof-run-engine-hEfje943.d.cts} +4 -4
  77. package/dist/proof-run-engine.d.cts +2 -2
  78. package/dist/proof-run-engine.d.ts +2 -2
  79. package/dist/receipts.cjs +10 -255
  80. package/dist/receipts.d.cts +10 -115
  81. package/dist/receipts.d.ts +10 -115
  82. package/dist/receipts.js +1 -1
  83. package/dist/riddle-client.cjs +23 -695
  84. package/dist/riddle-client.d.cts +1 -188
  85. package/dist/riddle-client.d.ts +1 -188
  86. package/dist/riddle-client.js +5 -2
  87. package/dist/rule-trust-root.cjs +36 -0
  88. package/dist/rule-trust-root.d.cts +2 -0
  89. package/dist/rule-trust-root.d.ts +2 -0
  90. package/dist/rule-trust-root.js +13 -0
  91. package/dist/runner.js +2 -2
  92. package/dist/runtime/index.cjs +23 -695
  93. package/dist/runtime/index.d.cts +1 -5
  94. package/dist/runtime/index.d.ts +1 -5
  95. package/dist/runtime/index.js +5 -2
  96. package/dist/runtime/riddle-client.cjs +23 -695
  97. package/dist/runtime/riddle-client.d.cts +1 -5
  98. package/dist/runtime/riddle-client.d.ts +1 -5
  99. package/dist/runtime/riddle-client.js +5 -2
  100. package/dist/semantic-certificate.cjs +17 -1083
  101. package/dist/semantic-certificate.d.cts +2 -310
  102. package/dist/semantic-certificate.d.ts +2 -310
  103. package/dist/semantic-certificate.js +1 -1
  104. package/package.json +42 -4
  105. package/runtime/lib/riddle_core_call.mjs +3 -806
  106. package/dist/chunk-5IFZSUPF.js +0 -644
  107. package/dist/chunk-AQTCU6W5.js +0 -1086
  108. package/dist/chunk-MEVVL4TI.js +0 -258
  109. package/dist/{chunk-WLUMLHII.js → chunk-BID7CKMM.js} +9 -9
  110. package/dist/{chunk-YH7ADFY4.js → chunk-IVSP24XI.js} +3 -3
@@ -15,6 +15,7 @@ var __copyProps = (to, from, except, desc) => {
15
15
  }
16
16
  return to;
17
17
  };
18
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
19
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
20
 
20
21
  // src/pr-comment.ts
@@ -204,117 +205,19 @@ function summarizeRiddleProofPublicState(input) {
204
205
  }
205
206
 
206
207
  // src/profile.ts
207
- var RIDDLE_PROOF_PROFILE_STATUSES = [
208
- "passed",
209
- "product_regression",
210
- "proof_insufficient",
211
- "environment_blocked",
212
- "configuration_error",
213
- "needs_human_review"
214
- ];
208
+ var import_profile = require("@riddledc/riddle-proof-core/profile");
215
209
 
216
210
  // src/receipts.ts
217
- var RIDDLE_PREVIEW_RECEIPT_VERSION = "riddle.preview-receipt.v1";
218
- var RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION = "riddle-proof.observation-receipt.v1";
219
- function isRecord(value) {
220
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
221
- }
222
- function requiredString(record, key, context) {
223
- const value = record[key];
224
- if (typeof value !== "string" || !value.trim()) {
225
- throw new Error(`${context}.${key} must be a non-empty string.`);
226
- }
227
- return value.trim();
228
- }
229
- function normalizedSourceIdentity(value) {
230
- if (!isRecord(value)) return {};
231
- return {
232
- git_revision: typeof value.git_revision === "string" && value.git_revision.trim() ? value.git_revision.trim() : void 0,
233
- repository: typeof value.repository === "string" && value.repository.trim() ? value.repository.trim() : void 0,
234
- dirty: typeof value.dirty === "boolean" ? value.dirty : void 0,
235
- label: typeof value.label === "string" && value.label.trim() ? value.label.trim() : void 0
236
- };
237
- }
238
- function parseRiddlePreviewReceipt(value) {
239
- if (!isRecord(value)) throw new Error("Preview receipt must be an object.");
240
- if (value.version !== RIDDLE_PREVIEW_RECEIPT_VERSION) {
241
- throw new Error(`Unsupported Preview receipt version ${String(value.version || "missing")}.`);
242
- }
243
- if (!isRecord(value.source)) throw new Error("Preview receipt source must be an object.");
244
- const expiresAt = requiredString(value, "expires_at", "preview receipt");
245
- const publishedAt = requiredString(value, "published_at", "preview receipt");
246
- const contentDigest = requiredString(value, "content_digest", "preview receipt");
247
- if (!contentDigest.startsWith("sha256:") || contentDigest.length <= "sha256:".length) {
248
- throw new Error("preview receipt.content_digest must be a sha256 digest.");
249
- }
250
- if (!Number.isFinite(Date.parse(expiresAt)) || !Number.isFinite(Date.parse(publishedAt))) {
251
- throw new Error("Preview receipt timestamps must be valid ISO date strings.");
252
- }
253
- return {
254
- version: RIDDLE_PREVIEW_RECEIPT_VERSION,
255
- preview_id: requiredString(value, "preview_id", "preview receipt"),
256
- url: requiredString(value, "url", "preview receipt"),
257
- expires_at: expiresAt,
258
- content_digest: contentDigest,
259
- source: normalizedSourceIdentity(value.source),
260
- published_at: publishedAt
261
- };
262
- }
263
- function parseRiddleProofObservationReceipt(value) {
264
- if (!isRecord(value)) throw new Error("Observation receipt must be an object.");
265
- if (value.version !== RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION) {
266
- throw new Error(`Unsupported Observation receipt version ${String(value.version || "missing")}.`);
267
- }
268
- if (!isRecord(value.executor)) throw new Error("Observation receipt executor must be an object.");
269
- if (!isRecord(value.target)) throw new Error("Observation receipt target must be an object.");
270
- if (!isRecord(value.source)) throw new Error("Observation receipt source must be an object.");
271
- requiredString(value, "observation_id", "observation receipt");
272
- requiredString(value, "captured_at", "observation receipt");
273
- const executorKind = requiredString(value.executor, "kind", "observation receipt executor");
274
- if (!"local_playwright,riddle_hosted,browser_api,other".split(",").includes(executorKind)) {
275
- throw new Error(`Unsupported observation executor kind ${executorKind}.`);
276
- }
277
- if (value.executor.runner !== void 0) {
278
- requiredString(value.executor, "runner", "observation receipt executor");
279
- }
280
- const role = requiredString(value, "comparison_role", "observation receipt");
281
- if (!["before", "after", "standalone"].includes(role)) {
282
- throw new Error(`Unsupported observation comparison role ${role}.`);
283
- }
284
- const targetKind = requiredString(value.target, "kind", "observation receipt target");
285
- if (targetKind !== "url" && targetKind !== "preview") {
286
- throw new Error(`Unsupported observation target kind ${targetKind}.`);
287
- }
288
- requiredString(value.target, "url", "observation receipt target");
289
- if (targetKind === "preview") {
290
- if (value.target.preview === void 0) {
291
- throw new Error("Preview Observation target must include its Preview receipt.");
292
- }
293
- parseRiddlePreviewReceipt(value.target.preview);
294
- }
295
- if (!Array.isArray(value.artifacts)) throw new Error("Observation receipt artifacts must be an array.");
296
- const artifactRoles = /* @__PURE__ */ new Set(["canonical_screenshot", "setup_screenshot", "data", "diagnostic", "artifact"]);
297
- const artifacts = value.artifacts.map((artifact, index) => {
298
- if (!isRecord(artifact)) throw new Error(`Observation receipt artifact ${index} must be an object.`);
299
- requiredString(artifact, "name", `observation receipt artifact ${index}`);
300
- const artifactRole = requiredString(artifact, "role", `observation receipt artifact ${index}`);
301
- if (!artifactRoles.has(artifactRole)) {
302
- throw new Error(`Unsupported observation artifact role ${artifactRole}.`);
303
- }
304
- return artifact;
305
- });
306
- if (value.canonical_screenshot !== void 0) {
307
- if (!isRecord(value.canonical_screenshot) || value.canonical_screenshot.role !== "canonical_screenshot") {
308
- throw new Error("Observation canonical_screenshot must have the canonical_screenshot role.");
309
- }
310
- const canonical = value.canonical_screenshot;
311
- const included = artifacts.some((artifact) => artifact.role === "canonical_screenshot" && artifact.name === canonical.name && artifact.url === canonical.url && artifact.path === canonical.path);
312
- if (!included) {
313
- throw new Error("Observation canonical_screenshot must reference an artifact in the receipt.");
314
- }
315
- }
316
- return value;
317
- }
211
+ var receipts_exports = {};
212
+ __export(receipts_exports, {
213
+ RIDDLE_PREVIEW_RECEIPT_VERSION: () => import_receipts.RIDDLE_PREVIEW_RECEIPT_VERSION,
214
+ RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION: () => import_receipts.RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
215
+ createRiddleProofObservationReceipt: () => import_receipts.createRiddleProofObservationReceipt,
216
+ parseRiddlePreviewReceipt: () => import_receipts.parseRiddlePreviewReceipt,
217
+ parseRiddleProofObservationReceipt: () => import_receipts.parseRiddleProofObservationReceipt
218
+ });
219
+ __reExport(receipts_exports, require("@riddledc/riddle-proof-core/receipts"));
220
+ var import_receipts = require("@riddledc/riddle-proof-core/receipts");
318
221
 
319
222
  // src/change-proof.ts
320
223
  var RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION = "riddle-proof.change-receipt.v1";
@@ -368,7 +271,7 @@ function observationArtifactMatches(actual, expected) {
368
271
  if (!actual || !expected) return actual === expected;
369
272
  return actual.name === expected.name && actual.role === expected.role && actual.url === expected.url && actual.path === expected.path && actual.kind === expected.kind && actual.content_type === expected.content_type && actual.source === expected.source;
370
273
  }
371
- function isRecord2(value) {
274
+ function isRecord(value) {
372
275
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
373
276
  }
374
277
  function migratedObservationFromLegacySide(side, legacy) {
@@ -445,7 +348,7 @@ function migrateRiddleProofChangeReceipt(legacy) {
445
348
  };
446
349
  }
447
350
  function parseRiddleProofChangeReceipt(value) {
448
- if (!isRecord2(value)) throw new Error("Change receipt must be an object.");
351
+ if (!isRecord(value)) throw new Error("Change receipt must be an object.");
449
352
  if (value.version === RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION) {
450
353
  return migrateRiddleProofChangeReceipt(value);
451
354
  }
@@ -453,11 +356,11 @@ function parseRiddleProofChangeReceipt(value) {
453
356
  throw new Error(`Unsupported Change receipt version ${String(value.version || "missing")}.`);
454
357
  }
455
358
  const receipt = value;
456
- if (!RIDDLE_PROOF_PROFILE_STATUSES.includes(receipt.status)) {
359
+ if (!import_profile.RIDDLE_PROOF_PROFILE_STATUSES.includes(receipt.status)) {
457
360
  throw new Error(`Unsupported Change receipt status ${String(receipt.status || "missing")}.`);
458
361
  }
459
- parseRiddleProofObservationReceipt(receipt.before);
460
- parseRiddleProofObservationReceipt(receipt.after);
362
+ (0, import_receipts.parseRiddleProofObservationReceipt)(receipt.before);
363
+ (0, import_receipts.parseRiddleProofObservationReceipt)(receipt.after);
461
364
  if (receipt.before.comparison_role !== "before" || receipt.after.comparison_role !== "after") {
462
365
  throw new Error("Change receipt observations must preserve their before and after comparison roles.");
463
366
  }
@@ -489,8 +392,8 @@ function createRiddleProofHandoffReceipt(changeReceipt, options = {}) {
489
392
  };
490
393
  }
491
394
  function parseRiddleProofHandoffReceipt(value) {
492
- if (!isRecord2(value) || value.version !== RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION) {
493
- throw new Error(`Unsupported Handoff receipt version ${String(isRecord2(value) ? value.version || "missing" : "missing")}.`);
395
+ if (!isRecord(value) || value.version !== RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION) {
396
+ throw new Error(`Unsupported Handoff receipt version ${String(isRecord(value) ? value.version || "missing" : "missing")}.`);
494
397
  }
495
398
  const receipt = value;
496
399
  if (!Number.isFinite(Date.parse(receipt.created_at))) {
@@ -1,8 +1,8 @@
1
1
  import { RiddleProofPublicStateSummary } from './public-state.cjs';
2
2
  import { RiddleProofHandoffReceipt } from './change-proof.cjs';
3
- import './profile.cjs';
3
+ import '@riddledc/riddle-proof-core/profile';
4
+ import '@riddledc/riddle-proof-core/receipts';
4
5
  import './types.cjs';
5
- import './receipts.cjs';
6
6
 
7
7
  declare const RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
8
8
  type RiddleProofPrCommentArtifactKind = "image" | "data" | "artifact";
@@ -1,8 +1,8 @@
1
1
  import { RiddleProofPublicStateSummary } from './public-state.js';
2
2
  import { RiddleProofHandoffReceipt } from './change-proof.js';
3
- import './profile.js';
3
+ import '@riddledc/riddle-proof-core/profile';
4
+ import '@riddledc/riddle-proof-core/receipts';
4
5
  import './types.js';
5
- import './receipts.js';
6
6
 
7
7
  declare const RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
8
8
  type RiddleProofPrCommentArtifactKind = "image" | "data" | "artifact";
@@ -3,10 +3,10 @@ import {
3
3
  buildRiddleProofHandoffPrCommentMarkdown,
4
4
  buildRiddleProofPrCommentMarkdown,
5
5
  summarizeRiddleProofPrComment
6
- } from "./chunk-7OAETQU3.js";
7
- import "./chunk-LR4UYJDY.js";
8
- import "./chunk-MEVVL4TI.js";
9
- import "./chunk-2K3DIK7A.js";
6
+ } from "./chunk-BVYM4WJ5.js";
7
+ import "./chunk-NR2XQXIC.js";
8
+ import "./chunk-KF6F2RMQ.js";
9
+ import "./chunk-OHDNCXRM.js";
10
10
  import "./chunk-ZAR7BWMN.js";
11
11
  import "./chunk-MLKGABMK.js";
12
12
  export {