@riddledc/riddle-proof 0.8.84 → 0.8.85

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 (67) 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.js +4 -4
  5. package/dist/advanced/runner.js +2 -2
  6. package/dist/change-proof.cjs +22 -260
  7. package/dist/change-proof.d.cts +1 -1
  8. package/dist/change-proof.d.ts +1 -1
  9. package/dist/change-proof.js +2 -2
  10. package/dist/checked-meaning.cjs +67 -0
  11. package/dist/checked-meaning.d.cts +2 -0
  12. package/dist/checked-meaning.d.ts +2 -0
  13. package/dist/checked-meaning.js +41 -0
  14. package/dist/{chunk-QYZ3GKCP.js → chunk-AFARUBE4.js} +12 -11
  15. package/dist/chunk-J2SIQGQI.js +71 -0
  16. package/dist/{chunk-7OAETQU3.js → chunk-JZKLCY5G.js} +1 -1
  17. package/dist/chunk-KB7FYRBG.js +46 -0
  18. package/dist/chunk-NWLKJ2WI.js +31 -0
  19. package/dist/{chunk-LR4UYJDY.js → chunk-O2AO726C.js} +1 -1
  20. package/dist/chunk-ODLGSEP2.js +43 -0
  21. package/dist/chunk-OHDNCXRM.js +17 -0
  22. package/dist/cli/index.js +7 -7
  23. package/dist/cli.cjs +265 -1122
  24. package/dist/cli.d.cts +0 -1
  25. package/dist/cli.d.ts +0 -1
  26. package/dist/cli.js +7 -7
  27. package/dist/engine-harness.js +2 -2
  28. package/dist/grounded-evidence.cjs +95 -0
  29. package/dist/grounded-evidence.d.cts +2 -0
  30. package/dist/grounded-evidence.d.ts +2 -0
  31. package/dist/grounded-evidence.js +69 -0
  32. package/dist/index.cjs +314 -2042
  33. package/dist/index.d.cts +9 -3
  34. package/dist/index.d.ts +9 -3
  35. package/dist/index.js +126 -18
  36. package/dist/pr-comment.cjs +17 -107
  37. package/dist/pr-comment.d.cts +1 -1
  38. package/dist/pr-comment.d.ts +1 -1
  39. package/dist/pr-comment.js +3 -3
  40. package/dist/receipts.cjs +10 -255
  41. package/dist/receipts.d.cts +7 -115
  42. package/dist/receipts.d.ts +7 -115
  43. package/dist/receipts.js +1 -1
  44. package/dist/riddle-client.cjs +23 -695
  45. package/dist/riddle-client.d.cts +1 -188
  46. package/dist/riddle-client.d.ts +1 -188
  47. package/dist/riddle-client.js +5 -2
  48. package/dist/runner.js +2 -2
  49. package/dist/runtime/index.cjs +23 -695
  50. package/dist/runtime/index.d.cts +1 -5
  51. package/dist/runtime/index.d.ts +1 -5
  52. package/dist/runtime/index.js +5 -2
  53. package/dist/runtime/riddle-client.cjs +23 -695
  54. package/dist/runtime/riddle-client.d.cts +1 -5
  55. package/dist/runtime/riddle-client.d.ts +1 -5
  56. package/dist/runtime/riddle-client.js +5 -2
  57. package/dist/semantic-certificate.cjs +17 -1083
  58. package/dist/semantic-certificate.d.cts +2 -310
  59. package/dist/semantic-certificate.d.ts +2 -310
  60. package/dist/semantic-certificate.js +1 -1
  61. package/package.json +28 -5
  62. package/runtime/lib/riddle_core_call.mjs +3 -806
  63. package/dist/chunk-5IFZSUPF.js +0 -644
  64. package/dist/chunk-AQTCU6W5.js +0 -1086
  65. package/dist/chunk-MEVVL4TI.js +0 -258
  66. package/dist/{chunk-WLUMLHII.js → chunk-BID7CKMM.js} +9 -9
  67. package/dist/{chunk-YH7ADFY4.js → chunk-IVSP24XI.js} +3 -3
package/dist/index.cjs CHANGED
@@ -20,6 +20,7 @@ var __copyProps = (to, from, except, desc) => {
20
20
  }
21
21
  return to;
22
22
  };
23
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
23
24
  var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
25
  // If the importer is in node compatibility mode or this is not an ESM
25
26
  // file that has been converted to a CommonJS file using a Babel-
@@ -1797,9 +1798,9 @@ function cleanupMergedProofRun(state, repoDir, params, prState) {
1797
1798
  const baseBranch = stringValue2(prState.base_branch) || stringValue2(state?.base_branch) || "main";
1798
1799
  let fetchedBase = params.fetch_base === false;
1799
1800
  if (params.fetch_base !== false && baseBranch) {
1800
- const fetch2 = commandResult("git", ["fetch", "origin", baseBranch], repoDir, 12e4);
1801
- cleanup.fetch = fetch2.ok ? { ok: true, base_branch: baseBranch } : { ok: false, base_branch: baseBranch, error: fetch2.stderr.slice(0, 300) };
1802
- if (fetch2.ok) {
1801
+ const fetch = commandResult("git", ["fetch", "origin", baseBranch], repoDir, 12e4);
1802
+ cleanup.fetch = fetch.ok ? { ok: true, base_branch: baseBranch } : { ok: false, base_branch: baseBranch, error: fetch.stderr.slice(0, 300) };
1803
+ if (fetch.ok) {
1803
1804
  fetchedBase = true;
1804
1805
  state.base_synced_at = (/* @__PURE__ */ new Date()).toISOString();
1805
1806
  state.base_branch = baseBranch;
@@ -3412,9 +3413,10 @@ __export(index_exports, {
3412
3413
  DEFAULT_DIAGNOSTIC_ARRAY_LIMIT: () => DEFAULT_DIAGNOSTIC_ARRAY_LIMIT,
3413
3414
  DEFAULT_DIAGNOSTIC_HISTORY_LIMIT: () => DEFAULT_DIAGNOSTIC_HISTORY_LIMIT,
3414
3415
  DEFAULT_DIAGNOSTIC_STRING_LIMIT: () => DEFAULT_DIAGNOSTIC_STRING_LIMIT,
3415
- DEFAULT_RIDDLE_API_BASE_URL: () => DEFAULT_RIDDLE_API_BASE_URL,
3416
- DEFAULT_RIDDLE_API_KEY_FILE: () => DEFAULT_RIDDLE_API_KEY_FILE,
3417
- RIDDLE_PREVIEW_RECEIPT_VERSION: () => RIDDLE_PREVIEW_RECEIPT_VERSION,
3416
+ DEFAULT_RIDDLE_API_BASE_URL: () => import_client.DEFAULT_RIDDLE_API_BASE_URL,
3417
+ DEFAULT_RIDDLE_API_KEY_FILE: () => import_client.DEFAULT_RIDDLE_API_KEY_FILE,
3418
+ RIDDLE_BALANCE_ENDPOINT_PATH: () => import_client.RIDDLE_BALANCE_ENDPOINT_PATH,
3419
+ RIDDLE_PREVIEW_RECEIPT_VERSION: () => import_receipts.RIDDLE_PREVIEW_RECEIPT_VERSION,
3418
3420
  RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION: () => RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
3419
3421
  RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION: () => RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION,
3420
3422
  RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION: () => RIDDLE_PROOF_BASIC_GAMEPLAY_VERSION,
@@ -3423,11 +3425,42 @@ __export(index_exports, {
3423
3425
  RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION: () => RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION,
3424
3426
  RIDDLE_PROOF_CHANGE_RECEIPT_VERSION: () => RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
3425
3427
  RIDDLE_PROOF_CHANGE_RESULT_VERSION: () => RIDDLE_PROOF_CHANGE_RESULT_VERSION,
3428
+ RIDDLE_PROOF_CHECKED_MEANING_ASSURANCE: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_ASSURANCE,
3429
+ RIDDLE_PROOF_CHECKED_MEANING_CLOSURE_VERSION: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_CLOSURE_VERSION,
3430
+ RIDDLE_PROOF_CHECKED_MEANING_MATERIALIZED_RULE_DIGEST_DOMAIN: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MATERIALIZED_RULE_DIGEST_DOMAIN,
3431
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_AGE_MS: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_AGE_MS,
3432
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_CONSUMPTION_WINDOW_MS: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_CONSUMPTION_WINDOW_MS,
3433
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_DEFINITION_BYTES: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_DEFINITION_BYTES,
3434
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_PARAMETERS: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_PARAMETERS,
3435
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_PREMISES: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_PREMISES,
3436
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_RULES: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_RULES,
3437
+ RIDDLE_PROOF_CHECKED_MEANING_RULE_DIGEST_DOMAIN: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_RULE_DIGEST_DOMAIN,
3438
+ RIDDLE_PROOF_CHECKED_MEANING_RULE_ENGINE: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_RULE_ENGINE,
3426
3439
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION: () => RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
3427
3440
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION: () => RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
3441
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACTS: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACTS,
3442
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACT_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACT_BYTES,
3443
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_OBSERVATION_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_OBSERVATION_BYTES,
3444
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TIME_WINDOW_MS: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TIME_WINDOW_MS,
3445
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TOTAL_ARTIFACT_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TOTAL_ARTIFACT_BYTES,
3446
+ RIDDLE_PROOF_GROUNDED_CAPTURE_STATEMENT_VERSION: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_STATEMENT_VERSION,
3447
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_DEFINITION_DIGEST_DOMAIN: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_DEFINITION_DIGEST_DOMAIN,
3448
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_CONTRACT_ENGINE: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_CONTRACT_ENGINE,
3449
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_VERIFIER_ENGINE: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_VERIFIER_ENGINE,
3450
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_ASSERTIONS: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_ASSERTIONS,
3451
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_DEFINITION_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_DEFINITION_BYTES,
3452
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_BYTES,
3453
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_SEGMENTS: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_SEGMENTS,
3454
+ RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_CONFIG_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_CONFIG_BYTES,
3455
+ RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_REGISTRY_ENTRIES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_REGISTRY_ENTRIES,
3456
+ RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_TRUSTED_KEY_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_TRUSTED_KEY_BYTES,
3457
+ RIDDLE_PROOF_GROUNDED_SEMANTIC_CERTIFICATE_CLOSURE_VERSION: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
3458
+ RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_METADATA_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_METADATA_BYTES,
3459
+ RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_TOTAL_ARTIFACT_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_TOTAL_ARTIFACT_BYTES,
3460
+ RIDDLE_PROOF_GROUNDED_VERIFICATION_RECEIPT_VERSION: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_VERIFICATION_RECEIPT_VERSION,
3428
3461
  RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION: () => RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION,
3429
3462
  RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS: () => RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS,
3430
- RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION: () => RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
3463
+ RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION: () => import_receipts.RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
3431
3464
  RIDDLE_PROOF_ORDERED_TRACE_OPERATORS: () => RIDDLE_PROOF_ORDERED_TRACE_OPERATORS,
3432
3465
  RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION: () => RIDDLE_PROOF_PLAYABILITY_ASSESSMENT_VERSION,
3433
3466
  RIDDLE_PROOF_PLAYABILITY_VERSION: () => RIDDLE_PROOF_PLAYABILITY_VERSION,
@@ -3442,13 +3475,15 @@ __export(index_exports, {
3442
3475
  RIDDLE_PROOF_PR_COMMENT_MARKER: () => RIDDLE_PROOF_PR_COMMENT_MARKER,
3443
3476
  RIDDLE_PROOF_RUN_CARD_VERSION: () => RIDDLE_PROOF_RUN_CARD_VERSION,
3444
3477
  RIDDLE_PROOF_RUN_STATE_VERSION: () => RIDDLE_PROOF_RUN_STATE_VERSION,
3445
- RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES: () => RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES,
3446
- RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION: () => RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
3447
- RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION: () => RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
3478
+ RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES: () => import_semantic_certificate.RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES,
3479
+ RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION: () => import_semantic_certificate.RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
3480
+ RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION: () => import_semantic_certificate.RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
3481
+ RIDDLE_PROOF_SIGNED_CAPTURE_BUNDLE_VERSION: () => import_grounded_evidence.RIDDLE_PROOF_SIGNED_CAPTURE_BUNDLE_VERSION,
3482
+ RIDDLE_PROOF_SIGNED_CAPTURE_SIGNATURE_DOMAIN: () => import_grounded_evidence.RIDDLE_PROOF_SIGNED_CAPTURE_SIGNATURE_DOMAIN,
3448
3483
  RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION: () => RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION,
3449
3484
  RIDDLE_PROOF_VISUAL_SESSION_VERSION: () => RIDDLE_PROOF_VISUAL_SESSION_VERSION,
3450
- RIDDLE_UNSUBMITTED_WAKE_HINT: () => RIDDLE_UNSUBMITTED_WAKE_HINT,
3451
- RiddleApiError: () => RiddleApiError,
3485
+ RIDDLE_UNSUBMITTED_WAKE_HINT: () => import_client.RIDDLE_UNSUBMITTED_WAKE_HINT,
3486
+ RiddleApiError: () => import_client.RiddleApiError,
3452
3487
  appendCaptureDiagnostic: () => appendCaptureDiagnostic,
3453
3488
  appendRunEvent: () => appendRunEvent,
3454
3489
  appendStageHeartbeat: () => appendStageHeartbeat,
@@ -3462,6 +3497,7 @@ __export(index_exports, {
3462
3497
  assessBasicGameplayRoute: () => assessBasicGameplayRoute,
3463
3498
  assessPlayabilityEvidence: () => assessPlayabilityEvidence,
3464
3499
  assessRiddleProofChange: () => assessRiddleProofChange,
3500
+ assessRiddleProofCheckedMeaningClosure: () => import_checked_meaning.assessRiddleProofCheckedMeaningClosure,
3465
3501
  assessRiddleProofOrderedTrace: () => assessRiddleProofOrderedTrace,
3466
3502
  assessRiddleProofOrderedTraceSetupResults: () => assessRiddleProofOrderedTraceSetupResults,
3467
3503
  assessRiddleProofProfileArtifactCompleteness: () => assessRiddleProofProfileArtifactCompleteness,
@@ -3480,14 +3516,16 @@ __export(index_exports, {
3480
3516
  checkpointPacketIdentity: () => checkpointPacketIdentity,
3481
3517
  checkpointResponseIdentity: () => checkpointResponseIdentity,
3482
3518
  checkpointSummaryFromState: () => checkpointSummaryFromState,
3483
- collectRiddlePreviewDeployWarnings: () => collectRiddlePreviewDeployWarnings,
3519
+ collectRiddlePreviewDeployWarnings: () => import_client.collectRiddlePreviewDeployWarnings,
3484
3520
  collectRiddleProfileArtifactRefs: () => collectRiddleProfileArtifactRefs,
3485
3521
  collectRiddleProofProfileWarnings: () => collectRiddleProofProfileWarnings,
3486
3522
  compactBasicGameplayText: () => compactBasicGameplayText,
3487
3523
  compactRecord: () => compactRecord,
3488
3524
  compareVisualProofSessionFingerprint: () => compareVisualProofSessionFingerprint,
3489
- composeRiddleProofSemanticCertificateClosures: () => composeRiddleProofSemanticCertificateClosures,
3490
- composeRiddleProofSemanticCertificates: () => composeRiddleProofSemanticCertificates,
3525
+ composeRiddleProofCheckedMeaningClosures: () => import_checked_meaning.composeRiddleProofCheckedMeaningClosures,
3526
+ composeRiddleProofGroundedSemanticCertificateClosures: () => import_grounded_evidence.composeRiddleProofGroundedSemanticCertificateClosures,
3527
+ composeRiddleProofSemanticCertificateClosures: () => import_semantic_certificate.composeRiddleProofSemanticCertificateClosures,
3528
+ composeRiddleProofSemanticCertificates: () => import_semantic_certificate.composeRiddleProofSemanticCertificates,
3491
3529
  createBasicGameplayCatchRecords: () => createBasicGameplayCatchRecords,
3492
3530
  createBasicGameplayCatchSummary: () => createBasicGameplayCatchSummary,
3493
3531
  createCaptureDiagnostic: () => createCaptureDiagnostic,
@@ -3497,35 +3535,45 @@ __export(index_exports, {
3497
3535
  createDisabledRiddleProofAgentAdapter: () => createDisabledRiddleProofAgentAdapter,
3498
3536
  createLocalAgentAdapter: () => createCodexExecAgentAdapter,
3499
3537
  createLocalAgentJsonRunner: () => createCodexExecJsonRunner,
3500
- createRiddleApiClient: () => createRiddleApiClient,
3538
+ createRiddleApiClient: () => import_client.createRiddleApiClient,
3501
3539
  createRiddleProofChangeReceipt: () => createRiddleProofChangeReceipt,
3540
+ createRiddleProofCheckedMeaningAtomicClosure: () => import_checked_meaning.createRiddleProofCheckedMeaningAtomicClosure,
3541
+ createRiddleProofCheckedMeaningRule: () => import_checked_meaning.createRiddleProofCheckedMeaningRule,
3542
+ createRiddleProofGroundedDeclarativeJsonContract: () => import_grounded_evidence.createRiddleProofGroundedDeclarativeJsonContract,
3543
+ createRiddleProofGroundedDeclarativeJsonVerifier: () => import_grounded_evidence.createRiddleProofGroundedDeclarativeJsonVerifier,
3544
+ createRiddleProofGroundedSemanticAtomicCertificateClosure: () => import_grounded_evidence.createRiddleProofGroundedSemanticAtomicCertificateClosure,
3545
+ createRiddleProofGroundedSemanticCertificate: () => import_grounded_evidence.createRiddleProofGroundedSemanticCertificate,
3502
3546
  createRiddleProofHandoffReceipt: () => createRiddleProofHandoffReceipt,
3503
- createRiddleProofObservationReceipt: () => createRiddleProofObservationReceipt,
3547
+ createRiddleProofObservationReceipt: () => import_receipts.createRiddleProofObservationReceipt,
3504
3548
  createRiddleProofProfileConfigurationError: () => createRiddleProofProfileConfigurationError,
3505
3549
  createRiddleProofProfileEnvironmentBlockedResult: () => createRiddleProofProfileEnvironmentBlockedResult,
3506
3550
  createRiddleProofProfileInsufficientResult: () => createRiddleProofProfileInsufficientResult,
3507
3551
  createRiddleProofRunCard: () => createRiddleProofRunCard,
3508
- createRiddleProofSemanticAtomicCertificateClosure: () => createRiddleProofSemanticAtomicCertificateClosure,
3509
- createRiddleProofSemanticCertificate: () => createRiddleProofSemanticCertificate,
3552
+ createRiddleProofSemanticAtomicCertificateClosure: () => import_semantic_certificate.createRiddleProofSemanticAtomicCertificateClosure,
3553
+ createRiddleProofSemanticCertificate: () => import_semantic_certificate.createRiddleProofSemanticCertificate,
3554
+ createRiddleProofSignedCaptureBundle: () => import_grounded_evidence.createRiddleProofSignedCaptureBundle,
3510
3555
  createRunResult: () => createRunResult,
3511
3556
  createRunState: () => createRunState,
3512
3557
  createRunStatusSnapshot: () => createRunStatusSnapshot,
3513
- deployRiddlePreview: () => deployRiddlePreview,
3514
- deployRiddleStaticPreview: () => deployRiddleStaticPreview,
3558
+ deployRiddlePreview: () => import_client.deployRiddlePreview,
3559
+ deployRiddleStaticPreview: () => import_client.deployRiddleStaticPreview,
3515
3560
  deriveRiddleProofArtifactBodyAssertions: () => deriveRiddleProofArtifactBodyAssertions,
3516
- detectRiddlePreviewSource: () => detectRiddlePreviewSource,
3561
+ detectRiddlePreviewSource: () => import_client.detectRiddlePreviewSource,
3517
3562
  extractBasicGameplayEvidence: () => extractBasicGameplayEvidence,
3518
3563
  extractPlayabilityEvidence: () => extractPlayabilityEvidence,
3519
3564
  extractRiddleProofProfileResult: () => extractRiddleProofProfileResult,
3520
- getRiddleBalance: () => getRiddleBalance,
3565
+ getRiddleBalance: () => import_client.getRiddleBalance,
3566
+ getRiddleJobArtifacts: () => import_client.getRiddleJobArtifacts,
3521
3567
  isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
3522
3568
  isProtectedFinalStatus: () => isProtectedFinalStatus,
3523
3569
  isRiddleProofPlayabilityMode: () => isRiddleProofPlayabilityMode,
3524
3570
  isSuccessfulStatus: () => isSuccessfulStatus,
3525
- isTerminalRiddleJobStatus: () => isTerminalRiddleJobStatus,
3571
+ isTerminalRiddleJobStatus: () => import_client.isTerminalRiddleJobStatus,
3526
3572
  isTerminalStatus: () => isTerminalStatus,
3527
- matchRiddleProofSemanticCertificate: () => matchRiddleProofSemanticCertificate,
3528
- matchRiddleProofSemanticCertificateClosure: () => matchRiddleProofSemanticCertificateClosure,
3573
+ matchRiddleProofCheckedMeaningClosure: () => import_checked_meaning.matchRiddleProofCheckedMeaningClosure,
3574
+ matchRiddleProofGroundedSemanticCertificateClosure: () => import_grounded_evidence.matchRiddleProofGroundedSemanticCertificateClosure,
3575
+ matchRiddleProofSemanticCertificate: () => import_semantic_certificate.matchRiddleProofSemanticCertificate,
3576
+ matchRiddleProofSemanticCertificateClosure: () => import_semantic_certificate.matchRiddleProofSemanticCertificateClosure,
3529
3577
  migrateRiddleProofChangeReceipt: () => migrateRiddleProofChangeReceipt,
3530
3578
  nonEmptyString: () => nonEmptyString,
3531
3579
  normalizeCheckpointResponse: () => normalizeCheckpointResponse,
@@ -3534,14 +3582,14 @@ __export(index_exports, {
3534
3582
  normalizeRiddleProofProfile: () => normalizeRiddleProofProfile,
3535
3583
  normalizeRunParams: () => normalizeRunParams,
3536
3584
  normalizeTerminalMetadata: () => normalizeTerminalMetadata,
3537
- parseRiddlePreviewReceipt: () => parseRiddlePreviewReceipt,
3585
+ parseRiddlePreviewReceipt: () => import_receipts.parseRiddlePreviewReceipt,
3538
3586
  parseRiddleProofChangeReceipt: () => parseRiddleProofChangeReceipt,
3539
3587
  parseRiddleProofHandoffReceipt: () => parseRiddleProofHandoffReceipt,
3540
- parseRiddleProofObservationReceipt: () => parseRiddleProofObservationReceipt,
3541
- parseRiddleProofSemanticCertificate: () => parseRiddleProofSemanticCertificate,
3542
- parseRiddleViewport: () => parseRiddleViewport,
3588
+ parseRiddleProofObservationReceipt: () => import_receipts.parseRiddleProofObservationReceipt,
3589
+ parseRiddleProofSemanticCertificate: () => import_semantic_certificate.parseRiddleProofSemanticCertificate,
3590
+ parseRiddleViewport: () => import_client.parseRiddleViewport,
3543
3591
  parseVisualProofSession: () => parseVisualProofSession,
3544
- pollRiddleJob: () => pollRiddleJob,
3592
+ pollRiddleJob: () => import_client.pollRiddleJob,
3545
3593
  preflightRiddleProofProfileHttpStatusChecks: () => preflightRiddleProofProfileHttpStatusChecks,
3546
3594
  preflightRiddleProofProfileRunnerArtifacts: () => preflightRiddleProofProfileRunnerArtifacts,
3547
3595
  profileStatusExitCode: () => profileStatusExitCode,
@@ -3551,9 +3599,11 @@ __export(index_exports, {
3551
3599
  readRiddleProofRunStatus: () => readRiddleProofRunStatus,
3552
3600
  recordValue: () => recordValue,
3553
3601
  redactForProofDiagnostics: () => redactForProofDiagnostics,
3602
+ replayRiddleProofCheckedMeaningClosure: () => import_checked_meaning.replayRiddleProofCheckedMeaningClosure,
3603
+ replayRiddleProofGroundedSemanticCertificate: () => import_grounded_evidence.replayRiddleProofGroundedSemanticCertificate,
3554
3604
  resolveBasicGameplayProgressionCheckWithArtifactScreenshots: () => resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
3555
- resolveRiddleApiKey: () => resolveRiddleApiKey,
3556
- resolveRiddleApiKeySource: () => resolveRiddleApiKeySource,
3605
+ resolveRiddleApiKey: () => import_client.resolveRiddleApiKey,
3606
+ resolveRiddleApiKeySource: () => import_client.resolveRiddleApiKeySource,
3557
3607
  resolveRiddleProofProfileRouteUrl: () => resolveRiddleProofProfileRouteUrl,
3558
3608
  resolveRiddleProofProfileTargetUrl: () => resolveRiddleProofProfileTargetUrl,
3559
3609
  resolveRiddleProofProfileTimeoutSec: () => resolveRiddleProofProfileTimeoutSec,
@@ -3562,14 +3612,14 @@ __export(index_exports, {
3562
3612
  riddleProofPublicStateAllowsClaim: () => riddleProofPublicStateAllowsClaim,
3563
3613
  riddleProofPublicStateAllowsMergeRecommendation: () => riddleProofPublicStateAllowsMergeRecommendation,
3564
3614
  riddleProofPublicStateMergeRecommendation: () => riddleProofPublicStateMergeRecommendation,
3565
- riddleProofSemanticScopesEqual: () => riddleProofSemanticScopesEqual,
3566
- riddleRequestJson: () => riddleRequestJson,
3615
+ riddleProofSemanticScopesEqual: () => import_semantic_certificate.riddleProofSemanticScopesEqual,
3616
+ riddleRequestJson: () => import_client.riddleRequestJson,
3567
3617
  runCodexExecAgentDoctor: () => runCodexExecAgentDoctor,
3568
3618
  runLocalAgentDoctor: () => runCodexExecAgentDoctor,
3569
3619
  runRiddleProof: () => runRiddleProof,
3570
3620
  runRiddleProofEngineHarness: () => runRiddleProofEngineHarness,
3571
- runRiddleScript: () => runRiddleScript,
3572
- runRiddleServerPreview: () => runRiddleServerPreview,
3621
+ runRiddleScript: () => import_client.runRiddleScript,
3622
+ runRiddleServerPreview: () => import_client.runRiddleServerPreview,
3573
3623
  sanitizeBasicGameplayJsonString: () => sanitizeBasicGameplayJsonString,
3574
3624
  setRunStatus: () => setRunStatus,
3575
3625
  shipControlStateFor: () => shipControlStateFor,
@@ -3583,7 +3633,10 @@ __export(index_exports, {
3583
3633
  summarizeRiddleProofProfileResult: () => summarizeRiddleProofProfileResult,
3584
3634
  summarizeRiddleProofPublicConsumerSurface: () => summarizeRiddleProofPublicConsumerSurface,
3585
3635
  summarizeRiddleProofPublicState: () => summarizeRiddleProofPublicState,
3586
- validateRiddleProofSemanticCertificateClosure: () => validateRiddleProofSemanticCertificateClosure,
3636
+ validateRiddleProofCheckedMeaningClosure: () => import_checked_meaning.validateRiddleProofCheckedMeaningClosure,
3637
+ validateRiddleProofGroundedSemanticCertificateClosure: () => import_grounded_evidence.validateRiddleProofGroundedSemanticCertificateClosure,
3638
+ validateRiddleProofSemanticCertificateClosure: () => import_semantic_certificate.validateRiddleProofSemanticCertificateClosure,
3639
+ verifyRiddleProofSignedCaptureBundle: () => import_grounded_evidence.verifyRiddleProofSignedCaptureBundle,
3587
3640
  visualSessionFingerprint: () => visualSessionFingerprint,
3588
3641
  visualSessionFingerprintBasis: () => visualSessionFingerprintBasis
3589
3642
  });
@@ -10522,8 +10575,8 @@ function jsonContains(observed, expected) {
10522
10575
  }
10523
10576
  return false;
10524
10577
  }
10525
- function parseJsonPathSegments(path6) {
10526
- let input = path6.trim();
10578
+ function parseJsonPathSegments(path5) {
10579
+ let input = path5.trim();
10527
10580
  if (!input) throw new Error("path is empty");
10528
10581
  if (input === "$") return [];
10529
10582
  if (input.startsWith("$.")) input = input.slice(2);
@@ -10563,10 +10616,10 @@ function parseJsonPathSegments(path6) {
10563
10616
  pushToken();
10564
10617
  return segments;
10565
10618
  }
10566
- function resolveJsonPath(root, path6) {
10619
+ function resolveJsonPath(root, path5) {
10567
10620
  let segments;
10568
10621
  try {
10569
- segments = parseJsonPathSegments(path6);
10622
+ segments = parseJsonPathSegments(path5);
10570
10623
  } catch (error) {
10571
10624
  return { exists: false, error: String(error instanceof Error ? error.message : error) };
10572
10625
  }
@@ -10600,7 +10653,7 @@ function assessRiddleProofOrderedTrace(trace, events) {
10600
10653
  missing_paths: missingPaths,
10601
10654
  reason
10602
10655
  });
10603
- const parsePath = (path6) => {
10656
+ const parsePath = (path5) => {
10604
10657
  const segments = [];
10605
10658
  let token = "";
10606
10659
  const pushToken = () => {
@@ -10608,8 +10661,8 @@ function assessRiddleProofOrderedTrace(trace, events) {
10608
10661
  if (value) segments.push(value);
10609
10662
  token = "";
10610
10663
  };
10611
- for (let index = 0; index < path6.length; index += 1) {
10612
- const char = path6[index];
10664
+ for (let index = 0; index < path5.length; index += 1) {
10665
+ const char = path5[index];
10613
10666
  if (char === ".") {
10614
10667
  pushToken();
10615
10668
  continue;
@@ -10619,9 +10672,9 @@ function assessRiddleProofOrderedTrace(trace, events) {
10619
10672
  continue;
10620
10673
  }
10621
10674
  pushToken();
10622
- const closeIndex = path6.indexOf("]", index + 1);
10675
+ const closeIndex = path5.indexOf("]", index + 1);
10623
10676
  if (closeIndex === -1) throw new Error(`unterminated bracket at ${index}`);
10624
- const bracket = path6.slice(index + 1, closeIndex).trim();
10677
+ const bracket = path5.slice(index + 1, closeIndex).trim();
10625
10678
  if (!bracket) throw new Error(`empty bracket at ${index}`);
10626
10679
  if (/^\d+$/.test(bracket)) {
10627
10680
  segments.push(Number(bracket));
@@ -10633,10 +10686,10 @@ function assessRiddleProofOrderedTrace(trace, events) {
10633
10686
  pushToken();
10634
10687
  return segments;
10635
10688
  };
10636
- const resolve = (root, path6) => {
10689
+ const resolve = (root, path5) => {
10637
10690
  let segments;
10638
10691
  try {
10639
- segments = parsePath(path6);
10692
+ segments = parsePath(path5);
10640
10693
  } catch {
10641
10694
  return { exists: false };
10642
10695
  }
@@ -10932,15 +10985,15 @@ function profileSetupReturnSummaryFields(result) {
10932
10985
  const fields = [];
10933
10986
  for (const item of input) {
10934
10987
  if (typeof item === "string") {
10935
- const path7 = item.trim();
10936
- if (path7) fields.push({ path: path7 });
10988
+ const path6 = item.trim();
10989
+ if (path6) fields.push({ path: path6 });
10937
10990
  continue;
10938
10991
  }
10939
10992
  if (!isRecord2(item)) continue;
10940
- const path6 = stringValue6(item.path) ?? stringValue6(item.key) ?? stringValue6(item.json_path) ?? stringValue6(item.jsonPath);
10941
- if (!path6) continue;
10993
+ const path5 = stringValue6(item.path) ?? stringValue6(item.key) ?? stringValue6(item.json_path) ?? stringValue6(item.jsonPath);
10994
+ if (!path5) continue;
10942
10995
  const label = stringValue6(item.label) ?? stringValue6(item.name) ?? stringValue6(item.title);
10943
- fields.push(label ? { path: path6, label } : { path: path6 });
10996
+ fields.push(label ? { path: path5, label } : { path: path5 });
10944
10997
  }
10945
10998
  return fields;
10946
10999
  }
@@ -11398,17 +11451,17 @@ function normalizeReturnSummaryFields(input, index) {
11398
11451
  }
11399
11452
  return fieldsInput.map((field, fieldIndex) => {
11400
11453
  if (typeof field === "string") {
11401
- const path7 = field.trim();
11402
- if (!path7) throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] requires path.`);
11403
- return { path: path7 };
11454
+ const path6 = field.trim();
11455
+ if (!path6) throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] requires path.`);
11456
+ return { path: path6 };
11404
11457
  }
11405
11458
  if (!isRecord2(field)) {
11406
11459
  throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] must be a string path or object.`);
11407
11460
  }
11408
- const path6 = stringFromOwn(field, "path", "key", "json_path", "jsonPath");
11409
- if (!path6) throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] requires path.`);
11461
+ const path5 = stringFromOwn(field, "path", "key", "json_path", "jsonPath");
11462
+ if (!path5) throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] requires path.`);
11410
11463
  const label = stringFromOwn(field, "label", "name", "title");
11411
- return label ? { path: path6, label } : { path: path6 };
11464
+ return label ? { path: path5, label } : { path: path5 };
11412
11465
  });
11413
11466
  }
11414
11467
  function normalizeSetupActionRepeat(input, index) {
@@ -11623,8 +11676,8 @@ function normalizeSetupAction(input, index) {
11623
11676
  if ((type === "local_storage" || type === "session_storage") && value === void 0 && !hasJsonValue) {
11624
11677
  throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
11625
11678
  }
11626
- const path6 = stringFromOwn(input, "path", "function_path", "functionPath", "window_path", "windowPath", "state_path", "statePath");
11627
- if ((type === "window_call" || type === "window_call_until" || type === "assert_window_value" || type === "assert_window_number") && !path6) {
11679
+ const path5 = stringFromOwn(input, "path", "function_path", "functionPath", "window_path", "windowPath", "state_path", "statePath");
11680
+ if ((type === "window_call" || type === "window_call_until" || type === "assert_window_value" || type === "assert_window_number") && !path5) {
11628
11681
  throw new Error(`target.setup_actions[${index}] ${type} requires path.`);
11629
11682
  }
11630
11683
  const script = stringFromOwn(input, "script", "code", "source", "body");
@@ -11722,7 +11775,7 @@ function normalizeSetupAction(input, index) {
11722
11775
  restore: deterministicRestore || void 0,
11723
11776
  label: stringFromOwn(input, "label", "name", "screenshot_label", "screenshotLabel"),
11724
11777
  script,
11725
- path: path6,
11778
+ path: path5,
11726
11779
  args,
11727
11780
  expect_return: hasExpectedReturn ? toJsonValue(valueFromOwn(input, "expect_return", "expectReturn", "expected_return", "expectedReturn")) : void 0,
11728
11781
  store_return_to: storeReturnTo,
@@ -12048,10 +12101,10 @@ function collectRiddleProofProfileEnvironmentBlockedWarnings(profile, blocker) {
12048
12101
  return warnings;
12049
12102
  }
12050
12103
  function normalizeRouteInventoryPath(value, label) {
12051
- const path6 = stringValue6(value);
12052
- if (!path6) throw new Error(`${label} requires path.`);
12053
- if (!path6.startsWith("/")) throw new Error(`${label}.path must start with /.`);
12054
- return normalizeRoutePath2(path6);
12104
+ const path5 = stringValue6(value);
12105
+ if (!path5) throw new Error(`${label} requires path.`);
12106
+ if (!path5.startsWith("/")) throw new Error(`${label}.path must start with /.`);
12107
+ return normalizeRoutePath2(path5);
12055
12108
  }
12056
12109
  function normalizeRouteInventoryRoute(input, index) {
12057
12110
  if (typeof input === "string") return { path: normalizeRouteInventoryPath(input, `checks route_inventory expected_routes[${index}]`) };
@@ -12130,16 +12183,16 @@ function normalizeHttpStatusBodyJsonAssertions(value, label) {
12130
12183
  return value.map((item, index) => {
12131
12184
  const itemLabel = `${label}[${index}]`;
12132
12185
  if (typeof item === "string") {
12133
- const path7 = stringValue6(item);
12134
- if (!path7) throw new Error(`${itemLabel} path must not be empty.`);
12135
- return { path: path7, exists: true };
12186
+ const path6 = stringValue6(item);
12187
+ if (!path6) throw new Error(`${itemLabel} path must not be empty.`);
12188
+ return { path: path6, exists: true };
12136
12189
  }
12137
12190
  if (!isRecord2(item)) throw new Error(`${itemLabel} must be an object or JSON path string.`);
12138
- const path6 = stringFromOwn(item, "path", "json_path", "jsonPath", "key");
12139
- if (!path6) throw new Error(`${itemLabel}.path is required.`);
12191
+ const path5 = stringFromOwn(item, "path", "json_path", "jsonPath", "key");
12192
+ if (!path5) throw new Error(`${itemLabel}.path is required.`);
12140
12193
  const assertion = {
12141
12194
  label: stringValue6(item.label),
12142
- path: path6
12195
+ path: path5
12143
12196
  };
12144
12197
  const exists = booleanValue2(valueFromOwn(item, "exists", "present"));
12145
12198
  if (exists !== void 0) assertion.exists = exists;
@@ -12189,8 +12242,8 @@ function normalizeOrderedTraceEvents(value, label) {
12189
12242
  const predicates = predicatesInput.map((predicateInput, predicateIndex) => {
12190
12243
  const predicateLabel = `${eventLabel}.predicates[${predicateIndex}]`;
12191
12244
  if (!isRecord2(predicateInput)) throw new Error(`${predicateLabel} must be an object.`);
12192
- const path6 = stringFromOwn(predicateInput, "path", "field", "key");
12193
- if (!path6) throw new Error(`${predicateLabel}.path is required.`);
12245
+ const path5 = stringFromOwn(predicateInput, "path", "field", "key");
12246
+ if (!path5) throw new Error(`${predicateLabel}.path is required.`);
12194
12247
  const op = stringFromOwn(predicateInput, "op", "operator");
12195
12248
  if (!op || !RIDDLE_PROOF_ORDERED_TRACE_OPERATORS.includes(op)) {
12196
12249
  throw new Error(`${predicateLabel}.op must be one of ${RIDDLE_PROOF_ORDERED_TRACE_OPERATORS.join(", ")}.`);
@@ -12208,7 +12261,7 @@ function normalizeOrderedTraceEvents(value, label) {
12208
12261
  }
12209
12262
  }
12210
12263
  return {
12211
- path: path6,
12264
+ path: path5,
12212
12265
  op,
12213
12266
  value: requiresValue ? toJsonValue(value2) : void 0
12214
12267
  };
@@ -12976,7 +13029,7 @@ function summarizeRouteInventory(viewport, inventory) {
12976
13029
  const sourceCandidateCount = numberValue4(inventory.source_candidate_count);
12977
13030
  const sourceCandidateUniqueLinkCount = numberValue4(inventory.source_candidate_unique_link_count);
12978
13031
  const sourceLinkScope = stringValue6(inventory.source_link_scope);
12979
- const duplicateSourceLinks = Array.isArray(inventory.duplicate_source_link_paths) ? inventory.duplicate_source_link_paths.map((path6) => String(path6)) : [];
13032
+ const duplicateSourceLinks = Array.isArray(inventory.duplicate_source_link_paths) ? inventory.duplicate_source_link_paths.map((path5) => String(path5)) : [];
12980
13033
  const duplicateSourceLinkCount = numberValue4(inventory.duplicate_source_link_count) ?? (sourceLinkCount !== null && sourceUniqueLinkCount !== null ? Math.max(0, sourceLinkCount - sourceUniqueLinkCount) : null);
12981
13034
  const failures = Array.isArray(inventory.failures) ? inventory.failures : [];
12982
13035
  return {
@@ -12997,14 +13050,14 @@ function routeInventoryExpectedRouteSummaries(value, fallback) {
12997
13050
  const rawRoutes = Array.isArray(value) ? value : Array.isArray(fallback) ? fallback : [];
12998
13051
  return rawRoutes.map((route) => {
12999
13052
  if (typeof route === "string") {
13000
- const path7 = route.trim();
13001
- return path7 ? { path: path7 } : void 0;
13053
+ const path6 = route.trim();
13054
+ return path6 ? { path: path6 } : void 0;
13002
13055
  }
13003
13056
  if (!isRecord2(route)) return void 0;
13004
- const path6 = stringValue6(route.path);
13005
- if (!path6) return void 0;
13057
+ const path5 = stringValue6(route.path);
13058
+ if (!path5) return void 0;
13006
13059
  const name = stringValue6(route.name);
13007
- return name ? { name, path: path6 } : { path: path6 };
13060
+ return name ? { name, path: path5 } : { path: path5 };
13008
13061
  }).filter((route) => Boolean(route));
13009
13062
  }
13010
13063
  function matchText(sample, check) {
@@ -13141,8 +13194,8 @@ function expectedFailedNetworkMockConsoleEventSummary(event, evidence) {
13141
13194
  text: isRecord2(event) && typeof event.text === "string" ? event.text.slice(0, 300) : sample.slice(0, 300)
13142
13195
  };
13143
13196
  }
13144
- function normalizeRoutePath2(path6) {
13145
- const value = path6 || "/";
13197
+ function normalizeRoutePath2(path5) {
13198
+ const value = path5 || "/";
13146
13199
  if (value === "/") return "/";
13147
13200
  return value.replace(/\/+$/, "") || "/";
13148
13201
  }
@@ -13708,7 +13761,7 @@ function assessCheckFromEvidence(check, evidence) {
13708
13761
  const sourceCandidateCount = numberValue4(first?.source_candidate_count);
13709
13762
  const sourceCandidateUniqueLinkCount = numberValue4(first?.source_candidate_unique_link_count);
13710
13763
  const sourceLinkScope = stringValue6(first?.source_link_scope);
13711
- const duplicateSourceLinks = Array.isArray(first?.duplicate_source_link_paths) ? first.duplicate_source_link_paths.map((path6) => String(path6)) : [];
13764
+ const duplicateSourceLinks = Array.isArray(first?.duplicate_source_link_paths) ? first.duplicate_source_link_paths.map((path5) => String(path5)) : [];
13712
13765
  const duplicateSourceLinkCount = numberValue4(first?.duplicate_source_link_count) ?? (sourceLinkCount !== null && sourceUniqueLinkCount !== null ? Math.max(0, sourceLinkCount - sourceUniqueLinkCount) : null);
13713
13766
  const expectedRoutes = routeInventoryExpectedRouteSummaries(first?.expected_routes, check.expected_routes);
13714
13767
  return {
@@ -20072,16 +20125,16 @@ function collectRiddleProfileArtifactRefs(input) {
20072
20125
  function add(item, source) {
20073
20126
  if (!isRecord2(item)) return;
20074
20127
  const url = stringValue6(item.url);
20075
- const path6 = stringValue6(item.path);
20076
- const rawName = stringValue6(item.name) || stringValue6(item.filename) || artifactNameFromPath(url || path6) || "";
20128
+ const path5 = stringValue6(item.path);
20129
+ const rawName = stringValue6(item.name) || stringValue6(item.filename) || artifactNameFromPath(url || path5) || "";
20077
20130
  const name = normalizeRiddleProfileArtifactName(rawName);
20078
- if (!name && !url && !path6) return;
20079
- const key = profileArtifactDedupeKey(name, url || path6 || "");
20131
+ if (!name && !url && !path5) return;
20132
+ const key = profileArtifactDedupeKey(name, url || path5 || "");
20080
20133
  const priority = profileArtifactPriority(rawName, name);
20081
20134
  const ref = {
20082
20135
  name,
20083
20136
  url,
20084
- path: path6,
20137
+ path: path5,
20085
20138
  kind: stringValue6(item.kind) || stringValue6(item.type),
20086
20139
  content_type: stringValue6(item.content_type) || stringValue6(item.contentType),
20087
20140
  source
@@ -20328,1327 +20381,111 @@ function suggestRiddleProofProfileChecks(input) {
20328
20381
  }
20329
20382
 
20330
20383
  // src/receipts.ts
20331
- var RIDDLE_PREVIEW_RECEIPT_VERSION = "riddle.preview-receipt.v1";
20332
- var RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION = "riddle-proof.observation-receipt.v1";
20333
- function isRecord3(value) {
20334
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
20335
- }
20336
- function requiredString(record, key, context) {
20337
- const value = record[key];
20338
- if (typeof value !== "string" || !value.trim()) {
20339
- throw new Error(`${context}.${key} must be a non-empty string.`);
20340
- }
20341
- return value.trim();
20342
- }
20343
- function normalizedSourceIdentity(value) {
20344
- if (!isRecord3(value)) return {};
20345
- return {
20346
- git_revision: typeof value.git_revision === "string" && value.git_revision.trim() ? value.git_revision.trim() : void 0,
20347
- repository: typeof value.repository === "string" && value.repository.trim() ? value.repository.trim() : void 0,
20348
- dirty: typeof value.dirty === "boolean" ? value.dirty : void 0,
20349
- label: typeof value.label === "string" && value.label.trim() ? value.label.trim() : void 0
20350
- };
20351
- }
20352
- function parseRiddlePreviewReceipt(value) {
20353
- if (!isRecord3(value)) throw new Error("Preview receipt must be an object.");
20354
- if (value.version !== RIDDLE_PREVIEW_RECEIPT_VERSION) {
20355
- throw new Error(`Unsupported Preview receipt version ${String(value.version || "missing")}.`);
20356
- }
20357
- if (!isRecord3(value.source)) throw new Error("Preview receipt source must be an object.");
20358
- const expiresAt = requiredString(value, "expires_at", "preview receipt");
20359
- const publishedAt = requiredString(value, "published_at", "preview receipt");
20360
- const contentDigest = requiredString(value, "content_digest", "preview receipt");
20361
- if (!contentDigest.startsWith("sha256:") || contentDigest.length <= "sha256:".length) {
20362
- throw new Error("preview receipt.content_digest must be a sha256 digest.");
20363
- }
20364
- if (!Number.isFinite(Date.parse(expiresAt)) || !Number.isFinite(Date.parse(publishedAt))) {
20365
- throw new Error("Preview receipt timestamps must be valid ISO date strings.");
20366
- }
20367
- return {
20368
- version: RIDDLE_PREVIEW_RECEIPT_VERSION,
20369
- preview_id: requiredString(value, "preview_id", "preview receipt"),
20370
- url: requiredString(value, "url", "preview receipt"),
20371
- expires_at: expiresAt,
20372
- content_digest: contentDigest,
20373
- source: normalizedSourceIdentity(value.source),
20374
- published_at: publishedAt
20375
- };
20376
- }
20377
- function comparableArtifactName(value) {
20378
- return (value || "").split(/[/?#]/).pop()?.toLowerCase().replace(/\.(png|jpe?g|gif|webp|avif|svg)$/u, "").replace(/[^a-z0-9_-]+/gu, "-").replace(/^-+|-+$/g, "") || "";
20379
- }
20380
- function artifactMatchesLabel(artifact, label) {
20381
- const expected = comparableArtifactName(label);
20382
- if (!expected) return false;
20383
- return [artifact.name, artifact.url, artifact.path].map(comparableArtifactName).some((name) => name === expected || name.endsWith(`-${expected}`));
20384
- }
20385
- function artifactLooksLikeScreenshot(ref) {
20386
- const text = [ref.name, ref.url, ref.path, ref.kind, ref.content_type].filter(Boolean).join(" ").toLowerCase();
20387
- return /screenshot|\bimage\b/.test(text) || /\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(text);
20388
- }
20389
- function finalScreenshotLabels(result) {
20390
- const explicit = result.artifacts.canonical_screenshots || [];
20391
- if (explicit.length) return explicit;
20392
- const fromEvidence = (result.evidence?.viewports || []).map((viewport) => viewport.screenshot_label).filter((label) => typeof label === "string" && Boolean(label.trim()));
20393
- if (fromEvidence.length) return fromEvidence;
20394
- return (result.artifacts.screenshots || []).slice(0, 1);
20395
- }
20396
- function setupScreenshotLabels(result) {
20397
- const explicit = result.artifacts.setup_screenshots || [];
20398
- if (explicit.length) return explicit;
20399
- return (result.evidence?.viewports || []).flatMap(
20400
- (viewport) => (viewport.setup_action_results || []).filter((action) => action.action === "screenshot" && action.ok !== false && typeof action.screenshot_label === "string").map((action) => String(action.screenshot_label))
20401
- );
20402
- }
20403
- function observationArtifactFromRef(ref, canonicalLabels, setupLabels) {
20404
- const base = {
20405
- name: ref.name,
20406
- role: ref.role || "artifact",
20407
- url: ref.url,
20408
- path: ref.path,
20409
- kind: ref.kind,
20410
- content_type: ref.content_type,
20411
- source: ref.source
20412
- };
20413
- if (!artifactLooksLikeScreenshot(ref)) return base;
20414
- if (canonicalLabels.some((label) => artifactMatchesLabel(base, label))) {
20415
- return { ...base, role: "canonical_screenshot" };
20416
- }
20417
- if (setupLabels.some((label) => artifactMatchesLabel(base, label))) {
20418
- return { ...base, role: "setup_screenshot" };
20419
- }
20420
- return { ...base, role: "diagnostic" };
20421
- }
20422
- function profileObservationArtifacts(result) {
20423
- const canonicalLabels = finalScreenshotLabels(result);
20424
- const setupLabels = setupScreenshotLabels(result);
20425
- const artifacts = [];
20426
- const seen = /* @__PURE__ */ new Set();
20427
- const add = (artifact) => {
20428
- const key = artifact.url || artifact.path || `${artifact.role}:${artifact.name}`;
20429
- if (!artifact.name || seen.has(key)) return;
20430
- seen.add(key);
20431
- artifacts.push(artifact);
20432
- };
20433
- for (const ref of result.artifacts.riddle_artifacts || []) {
20434
- add(observationArtifactFromRef(ref, canonicalLabels, setupLabels));
20435
- }
20436
- for (const label of canonicalLabels) {
20437
- if (!artifacts.some((artifact) => artifactMatchesLabel(artifact, label))) {
20438
- add({ name: label, path: label, role: "canonical_screenshot", kind: "image" });
20439
- }
20440
- }
20441
- for (const label of setupLabels) {
20442
- if (!artifacts.some((artifact) => artifactMatchesLabel(artifact, label))) {
20443
- add({ name: label, path: label, role: "setup_screenshot", kind: "image" });
20444
- }
20445
- }
20446
- for (const label of result.artifacts.screenshots || []) {
20447
- if (!artifacts.some((artifact) => artifactMatchesLabel(artifact, label))) {
20448
- add({ name: label, path: label, role: "diagnostic", kind: "image" });
20449
- }
20450
- }
20451
- return artifacts;
20452
- }
20453
- function mergeObservationArtifacts(profileArtifacts, suppliedArtifacts) {
20454
- const artifacts = [...profileArtifacts];
20455
- for (const supplied of suppliedArtifacts) {
20456
- const suppliedNames = [supplied.name, supplied.url, supplied.path].map(comparableArtifactName).filter(Boolean);
20457
- const existingIndex = artifacts.findIndex((artifact) => {
20458
- if (supplied.url && artifact.url === supplied.url) return true;
20459
- if (supplied.path && artifact.path === supplied.path) return true;
20460
- return [artifact.name, artifact.url, artifact.path].map(comparableArtifactName).some((name) => name && suppliedNames.includes(name));
20461
- });
20462
- if (existingIndex < 0) {
20463
- artifacts.push(supplied);
20464
- continue;
20465
- }
20466
- const existing = artifacts[existingIndex];
20467
- const role = supplied.role === "canonical_screenshot" || supplied.role === "setup_screenshot" ? supplied.role : existing.role === "canonical_screenshot" || existing.role === "setup_screenshot" ? existing.role : supplied.role === "artifact" ? existing.role : supplied.role;
20468
- artifacts[existingIndex] = {
20469
- ...existing,
20470
- ...supplied,
20471
- role
20472
- };
20473
- }
20474
- return artifacts;
20475
- }
20476
- function defaultObservationId(role, capturedAt) {
20477
- return `obs_${role}_${capturedAt.replace(/[^0-9]/g, "").slice(0, 17) || "unknown"}`;
20478
- }
20479
- function profileCheckCounts(result) {
20480
- const counts = { total: result.checks.length, passed: 0, failed: 0, skipped: 0, needs_human_review: 0 };
20481
- for (const check of result.checks) {
20482
- if (check.status === "passed") counts.passed += 1;
20483
- if (check.status === "failed") counts.failed += 1;
20484
- if (check.status === "skipped") counts.skipped += 1;
20485
- if (check.status === "needs_human_review") counts.needs_human_review += 1;
20486
- }
20487
- return counts;
20488
- }
20489
- function createRiddleProofObservationReceipt(input) {
20490
- const capturedAt = input.captured_at || input.profile_result?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
20491
- const profileArtifacts = input.profile_result ? profileObservationArtifacts(input.profile_result) : [];
20492
- const requestedCanonical = input.canonical_screenshot ? { ...input.canonical_screenshot, role: "canonical_screenshot" } : void 0;
20493
- const artifacts = mergeObservationArtifacts(
20494
- profileArtifacts,
20495
- [...input.artifacts || [], ...requestedCanonical ? [requestedCanonical] : []]
20496
- );
20497
- const canonicalScreenshot = requestedCanonical ? artifacts.find((artifact) => artifact.role === "canonical_screenshot" && artifactMatchesLabel(artifact, requestedCanonical.name)) || requestedCanonical : artifacts.find((artifact) => artifact.role === "canonical_screenshot");
20498
- const target = input.target.kind === "preview" && input.target.preview ? { ...input.target, preview: parseRiddlePreviewReceipt(input.target.preview) } : input.target;
20499
- return {
20500
- version: RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
20501
- observation_id: input.observation_id || defaultObservationId(input.comparison_role, capturedAt),
20502
- comparison_role: input.comparison_role,
20503
- executor: input.executor,
20504
- target,
20505
- source: normalizedSourceIdentity(input.source || input.target.preview?.source),
20506
- captured_at: capturedAt,
20507
- artifacts,
20508
- canonical_screenshot: canonicalScreenshot,
20509
- profile_summary: input.profile_result ? {
20510
- profile_name: input.profile_result.profile_name,
20511
- status: input.profile_result.status,
20512
- summary: input.profile_result.summary,
20513
- route: input.profile_result.route,
20514
- checks: profileCheckCounts(input.profile_result)
20515
- } : void 0,
20516
- proof: input.profile_result ? {
20517
- profile_name: input.profile_result.profile_name,
20518
- result: input.profile_result
20519
- } : void 0,
20520
- publication: input.publication,
20521
- execution: input.execution,
20522
- metadata: input.metadata
20523
- };
20524
- }
20525
- function parseRiddleProofObservationReceipt(value) {
20526
- if (!isRecord3(value)) throw new Error("Observation receipt must be an object.");
20527
- if (value.version !== RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION) {
20528
- throw new Error(`Unsupported Observation receipt version ${String(value.version || "missing")}.`);
20529
- }
20530
- if (!isRecord3(value.executor)) throw new Error("Observation receipt executor must be an object.");
20531
- if (!isRecord3(value.target)) throw new Error("Observation receipt target must be an object.");
20532
- if (!isRecord3(value.source)) throw new Error("Observation receipt source must be an object.");
20533
- requiredString(value, "observation_id", "observation receipt");
20534
- requiredString(value, "captured_at", "observation receipt");
20535
- const executorKind = requiredString(value.executor, "kind", "observation receipt executor");
20536
- if (!"local_playwright,riddle_hosted,browser_api,other".split(",").includes(executorKind)) {
20537
- throw new Error(`Unsupported observation executor kind ${executorKind}.`);
20538
- }
20539
- if (value.executor.runner !== void 0) {
20540
- requiredString(value.executor, "runner", "observation receipt executor");
20541
- }
20542
- const role = requiredString(value, "comparison_role", "observation receipt");
20543
- if (!["before", "after", "standalone"].includes(role)) {
20544
- throw new Error(`Unsupported observation comparison role ${role}.`);
20545
- }
20546
- const targetKind = requiredString(value.target, "kind", "observation receipt target");
20547
- if (targetKind !== "url" && targetKind !== "preview") {
20548
- throw new Error(`Unsupported observation target kind ${targetKind}.`);
20549
- }
20550
- requiredString(value.target, "url", "observation receipt target");
20551
- if (targetKind === "preview") {
20552
- if (value.target.preview === void 0) {
20553
- throw new Error("Preview Observation target must include its Preview receipt.");
20554
- }
20555
- parseRiddlePreviewReceipt(value.target.preview);
20556
- }
20557
- if (!Array.isArray(value.artifacts)) throw new Error("Observation receipt artifacts must be an array.");
20558
- const artifactRoles = /* @__PURE__ */ new Set(["canonical_screenshot", "setup_screenshot", "data", "diagnostic", "artifact"]);
20559
- const artifacts = value.artifacts.map((artifact, index) => {
20560
- if (!isRecord3(artifact)) throw new Error(`Observation receipt artifact ${index} must be an object.`);
20561
- requiredString(artifact, "name", `observation receipt artifact ${index}`);
20562
- const artifactRole = requiredString(artifact, "role", `observation receipt artifact ${index}`);
20563
- if (!artifactRoles.has(artifactRole)) {
20564
- throw new Error(`Unsupported observation artifact role ${artifactRole}.`);
20565
- }
20566
- return artifact;
20567
- });
20568
- if (value.canonical_screenshot !== void 0) {
20569
- if (!isRecord3(value.canonical_screenshot) || value.canonical_screenshot.role !== "canonical_screenshot") {
20570
- throw new Error("Observation canonical_screenshot must have the canonical_screenshot role.");
20571
- }
20572
- const canonical = value.canonical_screenshot;
20573
- const included = artifacts.some((artifact) => artifact.role === "canonical_screenshot" && artifact.name === canonical.name && artifact.url === canonical.url && artifact.path === canonical.path);
20574
- if (!included) {
20575
- throw new Error("Observation canonical_screenshot must reference an artifact in the receipt.");
20576
- }
20577
- }
20578
- return value;
20579
- }
20580
-
20581
- // src/semantic-certificate.ts
20582
- var import_node_crypto5 = require("crypto");
20583
- var RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION = "riddle-proof.semantic-certificate.v0";
20584
- var RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION = "riddle-proof.semantic-certificate-closure.v0";
20585
- var RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES = 4096;
20586
- var SCOPE_FIELDS = [
20587
- "repository",
20588
- "revision",
20589
- "environment",
20590
- "target",
20591
- "proof_attempt"
20592
- ];
20593
- var AUTHORITY_FIELDS = [
20594
- "authority",
20595
- "status",
20596
- "verdict",
20597
- "ready_to_ship",
20598
- "merge_ready",
20599
- "sync_allowed",
20600
- "ship_authorized",
20601
- "shipping_authorized",
20602
- "shipping_disabled",
20603
- "merge_recommended",
20604
- "merge_recommendation",
20605
- "shipping_authorization"
20606
- ];
20607
- var CERTIFICATE_FIELDS = /* @__PURE__ */ new Set([
20608
- "version",
20609
- "certificate_id",
20610
- "scope",
20611
- "claim",
20612
- "evidence",
20613
- "derivation",
20614
- "issued_at"
20615
- ]);
20616
- function isRecord4(value) {
20617
- if (!value || typeof value !== "object" || Array.isArray(value)) return false;
20618
- const prototype = Object.getPrototypeOf(value);
20619
- return prototype === Object.prototype || prototype === null;
20620
- }
20621
- function safeErrorMessage(error) {
20622
- try {
20623
- if (error instanceof Error) return String(error.message);
20624
- } catch {
20625
- }
20626
- try {
20627
- return String(error);
20628
- } catch {
20629
- return "unprintable thrown value";
20630
- }
20631
- }
20632
- function assertOnlyKeys(record, allowed, context) {
20633
- const allowedSet = new Set(allowed);
20634
- for (const key of Reflect.ownKeys(record)) {
20635
- if (typeof key !== "string") {
20636
- throw new Error(`${context} contains an unsupported symbol field.`);
20637
- }
20638
- if (!allowedSet.has(key)) {
20639
- throw new Error(`${context} contains unsupported field ${key}.`);
20640
- }
20641
- const descriptor = Object.getOwnPropertyDescriptor(record, key);
20642
- if (!descriptor || descriptor.enumerable !== true || descriptor.get !== void 0 || descriptor.set !== void 0) {
20643
- throw new Error(`${context}.${key} must be an enumerable data field.`);
20644
- }
20645
- }
20646
- }
20647
- function readDenseDataArray(value, context, maximumLength) {
20648
- if (!Array.isArray(value) || Object.getPrototypeOf(value) !== Array.prototype) {
20649
- throw new Error(`${context} must be a plain array.`);
20650
- }
20651
- const lengthDescriptor = Object.getOwnPropertyDescriptor(value, "length");
20652
- if (!lengthDescriptor || typeof lengthDescriptor.value !== "number" || !Number.isSafeInteger(lengthDescriptor.value) || lengthDescriptor.value < 0) {
20653
- throw new Error(`${context}.length must be an own data field.`);
20654
- }
20655
- const length = lengthDescriptor.value;
20656
- if (maximumLength !== void 0 && length > maximumLength) {
20657
- throw new Error(`${context} exceeds ${maximumLength} entries.`);
20658
- }
20659
- const indexedElements = [];
20660
- let elementCount = 0;
20661
- for (const key of Reflect.ownKeys(value)) {
20662
- if (key === "length") continue;
20663
- if (typeof key !== "string") {
20664
- throw new Error(`${context} contains an unsupported symbol field.`);
20665
- }
20666
- const index = Number(key);
20667
- if (!Number.isInteger(index) || index < 0 || index >= length || index >= 2 ** 32 - 1 || String(index) !== key) {
20668
- throw new Error(`${context} contains unsupported array field ${key}.`);
20669
- }
20670
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
20671
- if (!descriptor || descriptor.enumerable !== true || descriptor.get !== void 0 || descriptor.set !== void 0) {
20672
- throw new Error(`${context}[${key}] must be an enumerable data field.`);
20673
- }
20674
- indexedElements.push([index, descriptor.value]);
20675
- elementCount += 1;
20676
- }
20677
- if (elementCount !== length) {
20678
- throw new Error(`${context} must not contain sparse or inherited entries.`);
20679
- }
20680
- indexedElements.sort(([left], [right]) => left - right);
20681
- return indexedElements.map(([, entry]) => entry);
20682
- }
20683
- function requiredField(record, key, context) {
20684
- const descriptor = Object.getOwnPropertyDescriptor(record, key);
20685
- if (!descriptor) {
20686
- throw new Error(`${context}.${key} is required.`);
20687
- }
20688
- if (descriptor.enumerable !== true || descriptor.get !== void 0 || descriptor.set !== void 0) {
20689
- throw new Error(`${context}.${key} must be an enumerable data field.`);
20690
- }
20691
- return descriptor.value;
20692
- }
20693
- function optionalField(record, key) {
20694
- const descriptor = Object.getOwnPropertyDescriptor(record, key);
20695
- if (!descriptor) return void 0;
20696
- if (descriptor.enumerable !== true || descriptor.get !== void 0 || descriptor.set !== void 0) {
20697
- throw new Error(`${key} must be an enumerable data field.`);
20698
- }
20699
- return descriptor.value;
20700
- }
20701
- function requiredString2(record, key, context) {
20702
- const value = requiredField(record, key, context);
20703
- if (typeof value !== "string" || !value.trim()) {
20704
- throw new Error(`${context}.${key} must be a non-empty string.`);
20705
- }
20706
- return value.trim();
20707
- }
20708
- function optionalString(record, key, context) {
20709
- if (optionalField(record, key) === void 0) return void 0;
20710
- return requiredString2(record, key, context);
20711
- }
20712
- function cloneJsonValue(value, context, ancestors = /* @__PURE__ */ new Set()) {
20713
- if (value === null || typeof value === "string" || typeof value === "boolean") {
20714
- return value;
20715
- }
20716
- if (typeof value === "number") {
20717
- if (!Number.isFinite(value)) throw new Error(`${context} must contain only finite numbers.`);
20718
- return value;
20719
- }
20720
- if (Array.isArray(value)) {
20721
- const elements = readDenseDataArray(value, context);
20722
- if (ancestors.has(value)) throw new Error(`${context} must not be cyclic.`);
20723
- ancestors.add(value);
20724
- const cloned2 = elements.map((entry, index) => cloneJsonValue(entry, `${context}[${index}]`, ancestors));
20725
- ancestors.delete(value);
20726
- return cloned2;
20727
- }
20728
- if (!isRecord4(value)) throw new Error(`${context} must contain only JSON values.`);
20729
- if (ancestors.has(value)) throw new Error(`${context} must not be cyclic.`);
20730
- ancestors.add(value);
20731
- const cloned = {};
20732
- for (const key of Reflect.ownKeys(value)) {
20733
- if (typeof key !== "string") {
20734
- throw new Error(`${context} contains an unsupported symbol field.`);
20735
- }
20736
- const descriptor = Object.getOwnPropertyDescriptor(value, key);
20737
- if (!descriptor || descriptor.enumerable !== true || descriptor.get !== void 0 || descriptor.set !== void 0) {
20738
- throw new Error(`${context}.${key} must be an enumerable data field.`);
20739
- }
20740
- Object.defineProperty(cloned, key, {
20741
- value: cloneJsonValue(descriptor.value, `${context}.${key}`, ancestors),
20742
- enumerable: true,
20743
- configurable: true,
20744
- writable: true
20745
- });
20746
- }
20747
- ancestors.delete(value);
20748
- return cloned;
20749
- }
20750
- function parseJsonObject2(value, context) {
20751
- if (value === void 0) return void 0;
20752
- if (!isRecord4(value)) {
20753
- throw new Error(`${context} must be a JSON object.`);
20754
- }
20755
- const cloned = cloneJsonValue(value, context);
20756
- if (!isRecord4(cloned)) {
20757
- throw new Error(`${context} must remain a JSON object when serialized.`);
20758
- }
20759
- return cloned;
20760
- }
20761
- function parseIssuedAt(value, context) {
20762
- if (typeof value !== "string" || !value.trim() || !Number.isFinite(Date.parse(value))) {
20763
- throw new Error(`${context} must be a valid timestamp.`);
20764
- }
20765
- return value.trim();
20766
- }
20767
- function parseScope(value, context) {
20768
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20769
- assertOnlyKeys(value, SCOPE_FIELDS, context);
20770
- return {
20771
- repository: requiredString2(value, "repository", context),
20772
- revision: requiredString2(value, "revision", context),
20773
- environment: requiredString2(value, "environment", context),
20774
- target: requiredString2(value, "target", context),
20775
- proof_attempt: requiredString2(value, "proof_attempt", context)
20776
- };
20777
- }
20778
- function parseClaimRef(value, context, allowedExtras = []) {
20779
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20780
- assertOnlyKeys(value, ["claim_id", "claim_version", "parameters", ...allowedExtras], context);
20781
- const parameters = parseJsonObject2(optionalField(value, "parameters"), `${context}.parameters`);
20782
- return {
20783
- claim_id: requiredString2(value, "claim_id", context),
20784
- claim_version: requiredString2(value, "claim_version", context),
20785
- ...parameters ? { parameters } : {}
20786
- };
20787
- }
20788
- function parseClaim(value, context) {
20789
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20790
- return {
20791
- ...parseClaimRef(value, context, ["label"]),
20792
- label: requiredString2(value, "label", context)
20793
- };
20794
- }
20795
- function parseEvidenceRef(value, context) {
20796
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20797
- assertOnlyKeys(
20798
- value,
20799
- ["receipt_id", "artifact_digest", "role", "artifact_url", "artifact_path"],
20800
- context
20801
- );
20802
- const artifactDigest = requiredString2(value, "artifact_digest", context).toLowerCase();
20803
- if (!/^sha256:[0-9a-f]{64}$/u.test(artifactDigest)) {
20804
- throw new Error(`${context}.artifact_digest must be a full sha256 digest.`);
20805
- }
20806
- const artifactUrl = optionalString(value, "artifact_url", context);
20807
- const artifactPath = optionalString(value, "artifact_path", context);
20808
- return {
20809
- receipt_id: requiredString2(value, "receipt_id", context),
20810
- artifact_digest: artifactDigest,
20811
- role: requiredString2(value, "role", context),
20812
- ...artifactUrl ? { artifact_url: artifactUrl } : {},
20813
- ...artifactPath ? { artifact_path: artifactPath } : {}
20814
- };
20815
- }
20816
- function parseEvidenceBundle(value, context) {
20817
- const entries = readDenseDataArray(value, context);
20818
- if (entries.length === 0) {
20819
- throw new Error(`${context} must contain at least one evidence reference.`);
20820
- }
20821
- return entries.map((entry, index) => parseEvidenceRef(entry, `${context}[${index}]`));
20822
- }
20823
- function parseContractRef(value, context) {
20824
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20825
- return {
20826
- contract_id: requiredString2(value, "contract_id", context),
20827
- contract_version: requiredString2(value, "contract_version", context),
20828
- label: requiredString2(value, "label", context)
20829
- };
20830
- }
20831
- function parseContract(value, context, allowRuntimePredicate = false) {
20832
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20833
- assertOnlyKeys(
20834
- value,
20835
- ["contract_id", "contract_version", "label", "claim", ...allowRuntimePredicate ? ["accepts"] : []],
20836
- context
20837
- );
20838
- if (allowRuntimePredicate && typeof requiredField(value, "accepts", context) !== "function") {
20839
- throw new Error(`${context}.accepts must be a function.`);
20840
- }
20841
- return {
20842
- ...parseContractRef(value, context),
20843
- claim: parseClaim(requiredField(value, "claim", context), `${context}.claim`)
20844
- };
20845
- }
20846
- function parseRule(value, context, allowFullPremises = false) {
20847
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20848
- assertOnlyKeys(value, ["rule_id", "rule_version", "label", "premises", "conclusion"], context);
20849
- const premises = requiredField(value, "premises", context);
20850
- const premiseValues = readDenseDataArray(premises, `${context}.premises`);
20851
- if (premiseValues.length === 0) {
20852
- throw new Error(`${context}.premises must contain at least one claim reference.`);
20853
- }
20854
- return {
20855
- rule_id: requiredString2(value, "rule_id", context),
20856
- rule_version: requiredString2(value, "rule_version", context),
20857
- label: requiredString2(value, "label", context),
20858
- premises: premiseValues.map((premise, index) => parseClaimRef(
20859
- premise,
20860
- `${context}.premises[${index}]`,
20861
- allowFullPremises ? ["label"] : []
20862
- )),
20863
- conclusion: parseClaim(requiredField(value, "conclusion", context), `${context}.conclusion`)
20864
- };
20865
- }
20866
- function parsePremise(value, context) {
20867
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20868
- assertOnlyKeys(
20869
- value,
20870
- ["certificate_id", "derivation_kind", "assurance", "scope", "claim", "evidence"],
20871
- context
20872
- );
20873
- const derivationKind = requiredString2(value, "derivation_kind", context);
20874
- const assurance = requiredString2(value, "assurance", context);
20875
- const validAssurance = derivationKind === "contract" && assurance === "runtime_contract_accepted" || derivationKind === "composition" && assurance === "declared_runtime_rule";
20876
- if (!validAssurance) {
20877
- throw new Error(`${context} must preserve a valid derivation_kind and assurance pair.`);
20878
- }
20879
- return {
20880
- certificate_id: requiredString2(value, "certificate_id", context),
20881
- derivation_kind: derivationKind,
20882
- assurance,
20883
- scope: parseScope(requiredField(value, "scope", context), `${context}.scope`),
20884
- claim: parseClaim(requiredField(value, "claim", context), `${context}.claim`),
20885
- evidence: parseEvidenceBundle(requiredField(value, "evidence", context), `${context}.evidence`)
20886
- };
20887
- }
20888
- function stableJson3(value) {
20889
- if (Array.isArray(value)) return `[${value.map(stableJson3).join(",")}]`;
20890
- if (isRecord4(value)) {
20891
- return `{${Object.keys(value).filter((key) => value[key] !== void 0).sort().map((key) => `${JSON.stringify(key)}:${stableJson3(value[key])}`).join(",")}}`;
20892
- }
20893
- const encoded = JSON.stringify(value);
20894
- if (encoded === void 0) throw new Error("Semantic certificate contains a non-JSON value.");
20895
- return encoded;
20896
- }
20897
- function sameClaimRef(left, right) {
20898
- return left.claim_id === right.claim_id && left.claim_version === right.claim_version && stableJson3(left.parameters || {}) === stableJson3(right.parameters || {});
20899
- }
20900
- function sameEvidence(left, right) {
20901
- return stableJson3(left) === stableJson3(right);
20902
- }
20903
- function certificateId(body) {
20904
- const digest = (0, import_node_crypto5.createHash)("sha256").update(stableJson3(body)).digest("hex");
20905
- return `rpsc_${digest}`;
20906
- }
20907
- function withCertificateId(body) {
20908
- return { ...body, certificate_id: certificateId(body) };
20909
- }
20910
- function parseDerivation(value, context) {
20911
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20912
- const kind = requiredString2(value, "kind", context);
20913
- if (kind === "contract") {
20914
- assertOnlyKeys(value, ["kind", "assurance", "contract"], context);
20915
- if (requiredField(value, "assurance", context) !== "runtime_contract_accepted") {
20916
- throw new Error(`${context}.assurance must be runtime_contract_accepted.`);
20917
- }
20918
- return {
20919
- kind,
20920
- assurance: "runtime_contract_accepted",
20921
- contract: parseContract(requiredField(value, "contract", context), `${context}.contract`)
20922
- };
20923
- }
20924
- if (kind === "composition") {
20925
- assertOnlyKeys(value, ["kind", "assurance", "rule", "premises"], context);
20926
- if (requiredField(value, "assurance", context) !== "declared_runtime_rule") {
20927
- throw new Error(`${context}.assurance must be declared_runtime_rule.`);
20928
- }
20929
- const premises = requiredField(value, "premises", context);
20930
- const premiseValues = readDenseDataArray(premises, `${context}.premises`);
20931
- if (premiseValues.length === 0) {
20932
- throw new Error(`${context}.premises must contain at least one certificate premise.`);
20933
- }
20934
- return {
20935
- kind,
20936
- assurance: "declared_runtime_rule",
20937
- rule: parseRule(requiredField(value, "rule", context), `${context}.rule`),
20938
- premises: premiseValues.map((premise, index) => parsePremise(premise, `${context}.premises[${index}]`))
20939
- };
20940
- }
20941
- throw new Error(`${context}.kind must be contract or composition.`);
20942
- }
20943
- function riddleProofSemanticScopesEqual(left, right) {
20944
- return SCOPE_FIELDS.every((field) => left[field] === right[field]);
20945
- }
20946
- function createRiddleProofSemanticCertificate(input) {
20947
- if (!isRecord4(input)) throw new Error("Semantic certificate input must be an object.");
20948
- assertOnlyKeys(
20949
- input,
20950
- ["scope", "evidence", "observation", "contract", "issued_at"],
20951
- "semantic certificate input"
20952
- );
20953
- const scope = parseScope(requiredField(input, "scope", "semantic certificate input"), "semantic certificate scope");
20954
- const evidence = parseEvidenceBundle(
20955
- requiredField(input, "evidence", "semantic certificate input"),
20956
- "semantic certificate evidence"
20957
- );
20958
- const runtimeContract = requiredField(
20959
- input,
20960
- "contract",
20961
- "semantic certificate input"
20962
- );
20963
- const contract = parseContract(runtimeContract, "semantic certificate contract", true);
20964
- const accepts = requiredField(
20965
- runtimeContract,
20966
- "accepts",
20967
- "semantic certificate contract"
20968
- );
20969
- if (typeof accepts !== "function") {
20970
- throw new Error("semantic certificate contract.accepts must be a function.");
20971
- }
20972
- const contractRef = {
20973
- contract_id: contract.contract_id,
20974
- contract_version: contract.contract_version,
20975
- label: contract.label
20976
- };
20977
- const claim = contract.claim;
20978
- let accepted;
20979
- try {
20980
- accepted = accepts(
20981
- { ...scope },
20982
- requiredField(input, "observation", "semantic certificate input")
20983
- ) === true;
20984
- } catch (error) {
20985
- return {
20986
- ok: false,
20987
- error: {
20988
- code: "contract_error",
20989
- contract: contractRef,
20990
- message: `Semantic contract evaluation failed: ${safeErrorMessage(error)}.`
20991
- }
20992
- };
20993
- }
20994
- if (!accepted) {
20995
- return {
20996
- ok: false,
20997
- error: {
20998
- code: "contract_rejected",
20999
- contract: contractRef,
21000
- message: "Semantic contract rejected the supplied observation at this scope."
21001
- }
21002
- };
21003
- }
21004
- const body = {
21005
- version: RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
21006
- scope,
21007
- claim,
21008
- evidence,
21009
- derivation: { kind: "contract", assurance: "runtime_contract_accepted", contract },
21010
- issued_at: parseIssuedAt(
21011
- optionalField(input, "issued_at") || (/* @__PURE__ */ new Date()).toISOString(),
21012
- "semantic certificate issued_at"
21013
- )
21014
- };
21015
- return { ok: true, certificate: withCertificateId(body) };
21016
- }
21017
- function parseRiddleProofSemanticCertificate(value) {
21018
- if (!isRecord4(value)) throw new Error("Semantic certificate must be an object.");
21019
- const version = optionalField(value, "version");
21020
- if (version !== RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION) {
21021
- throw new Error(`Unsupported Semantic certificate version ${String(version || "missing")}.`);
21022
- }
21023
- for (const field of AUTHORITY_FIELDS) {
21024
- if (Object.prototype.hasOwnProperty.call(value, field)) {
21025
- throw new Error(`Semantic certificate must not contain authority field ${field}.`);
21026
- }
21027
- }
21028
- assertOnlyKeys(value, [...CERTIFICATE_FIELDS], "Semantic certificate");
21029
- const scope = parseScope(requiredField(value, "scope", "semantic certificate"), "semantic certificate scope");
21030
- const claim = parseClaim(requiredField(value, "claim", "semantic certificate"), "semantic certificate claim");
21031
- const evidence = parseEvidenceBundle(
21032
- requiredField(value, "evidence", "semantic certificate"),
21033
- "semantic certificate evidence"
21034
- );
21035
- const derivation = parseDerivation(
21036
- requiredField(value, "derivation", "semantic certificate"),
21037
- "semantic certificate derivation"
21038
- );
21039
- if (derivation.kind === "contract" && !sameClaimRef(claim, derivation.contract.claim)) {
21040
- throw new Error("Semantic contract-derived claim must match its contract claim.");
21041
- }
21042
- if (derivation.kind === "composition") {
21043
- if (derivation.premises.length !== derivation.rule.premises.length) {
21044
- throw new Error("Semantic composition premises must match the rule premise count.");
21045
- }
21046
- derivation.premises.forEach((premise, index) => {
21047
- if (!riddleProofSemanticScopesEqual(scope, premise.scope)) {
21048
- throw new Error(`Semantic composition premise ${index} must have the certificate scope.`);
21049
- }
21050
- if (!sameClaimRef(premise.claim, derivation.rule.premises[index])) {
21051
- throw new Error(`Semantic composition premise ${index} must match its rule claim.`);
21052
- }
21053
- });
21054
- if (!sameClaimRef(claim, derivation.rule.conclusion)) {
21055
- throw new Error("Semantic composition claim must match its rule conclusion.");
21056
- }
21057
- const expectedEvidence = derivation.premises.flatMap((premise) => premise.evidence);
21058
- if (!sameEvidence(evidence, expectedEvidence)) {
21059
- throw new Error("Semantic composition evidence must be the ordered concatenation of premise evidence.");
21060
- }
21061
- }
21062
- const body = {
21063
- version: RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
21064
- scope,
21065
- claim,
21066
- evidence,
21067
- derivation,
21068
- issued_at: parseIssuedAt(
21069
- requiredField(value, "issued_at", "semantic certificate"),
21070
- "semantic certificate issued_at"
21071
- )
21072
- };
21073
- const observedId = requiredString2(value, "certificate_id", "semantic certificate");
21074
- const expectedId = certificateId(body);
21075
- if (observedId !== expectedId) {
21076
- throw new Error("Semantic certificate_id must match its content.");
21077
- }
21078
- return { ...body, certificate_id: observedId };
21079
- }
21080
- function matchRiddleProofSemanticCertificate(input) {
21081
- if (!isRecord4(input)) throw new Error("Semantic certificate match input must be a plain object.");
21082
- assertOnlyKeys(
21083
- input,
21084
- [
21085
- "certificate",
21086
- "expected_certificate_id",
21087
- "expected_scope",
21088
- "expected_claim",
21089
- "expected_assurance"
21090
- ],
21091
- "semantic certificate match input"
21092
- );
21093
- const expectedCertificateId = requiredString2(
21094
- input,
21095
- "expected_certificate_id",
21096
- "semantic certificate match input"
21097
- );
21098
- if (!/^rpsc_[0-9a-f]{64}$/u.test(expectedCertificateId)) {
21099
- throw new Error(
21100
- "Semantic certificate match input.expected_certificate_id must be a full rpsc content ID."
21101
- );
21102
- }
21103
- const expectedScope = parseScope(
21104
- requiredField(input, "expected_scope", "semantic certificate match input"),
21105
- "semantic certificate match expected_scope"
21106
- );
21107
- const expectedClaim = parseClaimRef(
21108
- requiredField(input, "expected_claim", "semantic certificate match input"),
21109
- "semantic certificate match expected_claim",
21110
- ["label"]
21111
- );
21112
- const expectedAssurance = requiredString2(
21113
- input,
21114
- "expected_assurance",
21115
- "semantic certificate match input"
21116
- );
21117
- if (expectedAssurance !== "runtime_contract_accepted" && expectedAssurance !== "declared_runtime_rule") {
21118
- throw new Error(
21119
- "Semantic certificate match input.expected_assurance must be runtime_contract_accepted or declared_runtime_rule."
21120
- );
21121
- }
21122
- let certificate;
21123
- try {
21124
- certificate = parseRiddleProofSemanticCertificate(
21125
- requiredField(input, "certificate", "semantic certificate match input")
21126
- );
21127
- } catch (error) {
21128
- return {
21129
- ok: false,
21130
- error: {
21131
- code: "invalid_certificate",
21132
- message: `Semantic certificate did not parse: ${safeErrorMessage(error)}`
21133
- }
21134
- };
21135
- }
21136
- if (certificate.certificate_id !== expectedCertificateId) {
21137
- return {
21138
- ok: false,
21139
- error: {
21140
- code: "certificate_id_mismatch",
21141
- expected: expectedCertificateId,
21142
- observed: certificate.certificate_id,
21143
- message: "Semantic certificate does not match the trusted expected content ID."
21144
- }
21145
- };
21146
- }
21147
- const scopeMismatch = firstScopeMismatch(expectedScope, certificate.scope);
21148
- if (scopeMismatch) {
21149
- return {
21150
- ok: false,
21151
- error: {
21152
- code: "scope_mismatch",
21153
- ...scopeMismatch,
21154
- message: `Semantic certificate has a different ${scopeMismatch.field} than the consumer expected.`
21155
- }
21156
- };
21157
- }
21158
- if (!sameClaimRef(expectedClaim, certificate.claim)) {
21159
- return {
21160
- ok: false,
21161
- error: {
21162
- code: "claim_mismatch",
21163
- expected: expectedClaim,
21164
- observed: parseClaimRef(
21165
- certificate.claim,
21166
- "semantic certificate match observed claim",
21167
- ["label"]
21168
- ),
21169
- message: "Semantic certificate does not state the claim the consumer expected."
21170
- }
21171
- };
21172
- }
21173
- if (certificate.derivation.assurance !== expectedAssurance) {
21174
- return {
21175
- ok: false,
21176
- error: {
21177
- code: "assurance_mismatch",
21178
- expected: expectedAssurance,
21179
- observed: certificate.derivation.assurance,
21180
- message: "Semantic certificate does not have the assurance the consumer expected."
21181
- }
21182
- };
21183
- }
21184
- return { ok: true, certificate };
21185
- }
21186
- function firstScopeMismatch(expected, observed) {
21187
- for (const field of SCOPE_FIELDS) {
21188
- if (expected[field] !== observed[field]) {
21189
- return { field, expected: expected[field], observed: observed[field] };
21190
- }
21191
- }
21192
- return void 0;
21193
- }
21194
- function premiseFromCertificate(certificate) {
21195
- return {
21196
- certificate_id: certificate.certificate_id,
21197
- derivation_kind: certificate.derivation.kind,
21198
- assurance: certificate.derivation.assurance,
21199
- scope: { ...certificate.scope },
21200
- claim: parseClaim(certificate.claim, "semantic composition premise claim"),
21201
- evidence: certificate.evidence.map((entry) => ({ ...entry }))
21202
- };
21203
- }
21204
- function composeRiddleProofSemanticCertificates(input) {
21205
- if (!isRecord4(input)) throw new Error("Semantic composition input must be an object.");
21206
- assertOnlyKeys(
21207
- input,
21208
- ["rule", "certificates", "issued_at"],
21209
- "semantic composition input"
21210
- );
21211
- const rule = parseRule(
21212
- requiredField(input, "rule", "semantic composition input"),
21213
- "semantic composition rule",
21214
- true
21215
- );
21216
- const inputCertificates = requiredField(input, "certificates", "semantic composition input");
21217
- const certificateValues = readDenseDataArray(
21218
- inputCertificates,
21219
- "semantic composition input.certificates"
21220
- );
21221
- if (certificateValues.length === 0) {
21222
- throw new Error("Semantic composition requires at least one certificate.");
21223
- }
21224
- const certificates = certificateValues.map((certificate) => parseRiddleProofSemanticCertificate(certificate));
21225
- if (certificates.length !== rule.premises.length) {
21226
- return {
21227
- ok: false,
21228
- error: {
21229
- code: "premise_count_mismatch",
21230
- expected: rule.premises.length,
21231
- observed: certificates.length,
21232
- message: `Semantic rule expected ${rule.premises.length} certificate(s), received ${certificates.length}.`
21233
- }
21234
- };
21235
- }
21236
- const expectedScope = certificates[0].scope;
21237
- for (let index = 1; index < certificates.length; index += 1) {
21238
- const mismatch = firstScopeMismatch(expectedScope, certificates[index].scope);
21239
- if (mismatch) {
21240
- return {
21241
- ok: false,
21242
- error: {
21243
- code: "scope_mismatch",
21244
- input_index: index,
21245
- ...mismatch,
21246
- message: `Semantic certificate ${index} has a different ${mismatch.field}.`
21247
- }
21248
- };
21249
- }
21250
- }
21251
- for (let index = 0; index < certificates.length; index += 1) {
21252
- const expected = rule.premises[index];
21253
- const observed = certificates[index].claim;
21254
- if (!sameClaimRef(expected, observed)) {
21255
- return {
21256
- ok: false,
21257
- error: {
21258
- code: "premise_mismatch",
21259
- input_index: index,
21260
- expected,
21261
- observed: parseClaimRef(observed, "semantic composition observed claim", ["label"]),
21262
- message: `Semantic certificate ${index} does not satisfy its declared rule premise.`
21263
- }
21264
- };
21265
- }
21266
- }
21267
- const evidence = certificates.flatMap((certificate) => certificate.evidence);
21268
- const body = {
21269
- version: RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
21270
- scope: { ...expectedScope },
21271
- claim: { ...rule.conclusion },
21272
- evidence,
21273
- derivation: {
21274
- kind: "composition",
21275
- assurance: "declared_runtime_rule",
21276
- rule,
21277
- premises: certificates.map(premiseFromCertificate)
21278
- },
21279
- issued_at: parseIssuedAt(
21280
- optionalField(input, "issued_at") || (/* @__PURE__ */ new Date()).toISOString(),
21281
- "semantic certificate issued_at"
21282
- )
21283
- };
21284
- return { ok: true, certificate: withCertificateId(body) };
21285
- }
21286
- function invalidClosure(message) {
21287
- return { ok: false, error: { code: "invalid_closure", message } };
21288
- }
21289
- function firstPremiseSnapshotMismatch(snapshot, certificate) {
21290
- const observed = premiseFromCertificate(certificate);
21291
- if (snapshot.derivation_kind !== observed.derivation_kind) return "derivation_kind";
21292
- if (snapshot.assurance !== observed.assurance) return "assurance";
21293
- if (stableJson3(snapshot.scope) !== stableJson3(observed.scope)) return "scope";
21294
- if (stableJson3(snapshot.claim) !== stableJson3(observed.claim)) return "claim";
21295
- if (stableJson3(snapshot.evidence) !== stableJson3(observed.evidence)) return "evidence";
21296
- return void 0;
21297
- }
21298
- function validateSemanticCertificateClosureInternal(value) {
21299
- if (!isRecord4(value)) {
21300
- return invalidClosure("Semantic certificate closure must be a plain object.");
21301
- }
21302
- assertOnlyKeys(
21303
- value,
21304
- ["version", "root_certificate_id", "certificates"],
21305
- "Semantic certificate closure"
21306
- );
21307
- if (requiredField(value, "version", "Semantic certificate closure") !== RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION) {
21308
- return invalidClosure("Unsupported Semantic certificate closure version.");
21309
- }
21310
- const rootCertificateId = requiredString2(
21311
- value,
21312
- "root_certificate_id",
21313
- "Semantic certificate closure"
21314
- );
21315
- if (!/^rpsc_[0-9a-f]{64}$/u.test(rootCertificateId)) {
21316
- return invalidClosure(
21317
- "Semantic certificate closure.root_certificate_id must be a full rpsc content ID."
21318
- );
21319
- }
21320
- const inputCertificates = requiredField(
21321
- value,
21322
- "certificates",
21323
- "Semantic certificate closure"
21324
- );
21325
- const certificateValues = readDenseDataArray(
21326
- inputCertificates,
21327
- "Semantic certificate closure.certificates",
21328
- RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES
21329
- );
21330
- if (certificateValues.length === 0) {
21331
- return invalidClosure("Semantic certificate closure must contain at least one certificate.");
21332
- }
21333
- const certificates = [];
21334
- for (let index = 0; index < certificateValues.length; index += 1) {
21335
- try {
21336
- certificates.push(parseRiddleProofSemanticCertificate(certificateValues[index]));
21337
- } catch (error) {
21338
- return {
21339
- ok: false,
21340
- error: {
21341
- code: "invalid_closure_certificate",
21342
- input_index: index,
21343
- message: `Semantic certificate closure certificate ${index} did not parse: ${safeErrorMessage(error)}`
21344
- }
21345
- };
21346
- }
21347
- }
21348
- const certificatesById = /* @__PURE__ */ new Map();
21349
- const firstIndexById = /* @__PURE__ */ new Map();
21350
- for (let index = 0; index < certificates.length; index += 1) {
21351
- const certificate = certificates[index];
21352
- const firstIndex = firstIndexById.get(certificate.certificate_id);
21353
- if (firstIndex !== void 0) {
21354
- return {
21355
- ok: false,
21356
- error: {
21357
- code: "duplicate_certificate_id",
21358
- certificate_id: certificate.certificate_id,
21359
- first_index: firstIndex,
21360
- duplicate_index: index,
21361
- message: `Semantic certificate closure repeats certificate ${certificate.certificate_id}.`
21362
- }
21363
- };
21364
- }
21365
- firstIndexById.set(certificate.certificate_id, index);
21366
- certificatesById.set(certificate.certificate_id, certificate);
21367
- }
21368
- const rootCertificate = certificatesById.get(rootCertificateId);
21369
- if (!rootCertificate) {
21370
- return {
21371
- ok: false,
21372
- error: {
21373
- code: "root_certificate_missing",
21374
- root_certificate_id: rootCertificateId,
21375
- message: "Semantic certificate closure does not contain its declared root certificate."
21376
- }
21377
- };
21378
- }
21379
- const states = /* @__PURE__ */ new Map();
21380
- const stack = [{ certificate: rootCertificate, next_premise_index: 0 }];
21381
- const dependencyFirst = [];
21382
- states.set(rootCertificateId, "visiting");
21383
- while (stack.length > 0) {
21384
- const frame = stack[stack.length - 1];
21385
- const premises = frame.certificate.derivation.kind === "composition" ? frame.certificate.derivation.premises : [];
21386
- if (frame.next_premise_index < premises.length) {
21387
- const premiseIndex = frame.next_premise_index;
21388
- frame.next_premise_index += 1;
21389
- const snapshot = premises[premiseIndex];
21390
- const child = certificatesById.get(snapshot.certificate_id);
21391
- if (!child) {
21392
- return {
21393
- ok: false,
21394
- error: {
21395
- code: "dangling_premise",
21396
- parent_certificate_id: frame.certificate.certificate_id,
21397
- premise_index: premiseIndex,
21398
- premise_certificate_id: snapshot.certificate_id,
21399
- message: `Semantic certificate ${frame.certificate.certificate_id} premise ${premiseIndex} has no full certificate body.`
21400
- }
21401
- };
21402
- }
21403
- const mismatch = firstPremiseSnapshotMismatch(snapshot, child);
21404
- if (mismatch) {
21405
- return {
21406
- ok: false,
21407
- error: {
21408
- code: "premise_snapshot_mismatch",
21409
- parent_certificate_id: frame.certificate.certificate_id,
21410
- premise_index: premiseIndex,
21411
- premise_certificate_id: snapshot.certificate_id,
21412
- field: mismatch,
21413
- message: `Semantic certificate ${frame.certificate.certificate_id} premise ${premiseIndex} has a different ${mismatch} than its full certificate body.`
21414
- }
21415
- };
21416
- }
21417
- const childState = states.get(child.certificate_id);
21418
- if (childState === "visiting") {
21419
- const cycleStart = stack.findIndex(
21420
- (candidate) => candidate.certificate.certificate_id === child.certificate_id
21421
- );
21422
- const certificateIds = stack.slice(Math.max(0, cycleStart)).map((candidate) => candidate.certificate.certificate_id);
21423
- certificateIds.push(child.certificate_id);
21424
- return {
21425
- ok: false,
21426
- error: {
21427
- code: "certificate_cycle",
21428
- certificate_ids: certificateIds,
21429
- message: "Semantic certificate closure contains a certificate cycle."
21430
- }
21431
- };
21432
- }
21433
- if (childState !== "visited") {
21434
- states.set(child.certificate_id, "visiting");
21435
- stack.push({ certificate: child, next_premise_index: 0 });
21436
- }
21437
- continue;
21438
- }
21439
- stack.pop();
21440
- states.set(frame.certificate.certificate_id, "visited");
21441
- dependencyFirst.push(frame.certificate);
21442
- }
21443
- if (dependencyFirst.length !== certificates.length) {
21444
- const reachable = new Set(dependencyFirst.map((certificate) => certificate.certificate_id));
21445
- const unreachable = certificates.filter((certificate) => !reachable.has(certificate.certificate_id)).map((certificate) => certificate.certificate_id).sort();
21446
- return {
21447
- ok: false,
21448
- error: {
21449
- code: "unreachable_certificates",
21450
- certificate_ids: unreachable,
21451
- message: "Semantic certificate closure contains certificates unreachable from its root."
21452
- }
21453
- };
21454
- }
21455
- const closure = {
21456
- version: RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
21457
- root_certificate_id: rootCertificateId,
21458
- certificates: dependencyFirst
21459
- };
21460
- return { ok: true, closure, root_certificate: rootCertificate };
21461
- }
21462
- function validateRiddleProofSemanticCertificateClosure(value) {
21463
- try {
21464
- return validateSemanticCertificateClosureInternal(value);
21465
- } catch (error) {
21466
- return invalidClosure(
21467
- `Semantic certificate closure did not parse: ${safeErrorMessage(error)}`
21468
- );
21469
- }
21470
- }
21471
- function createRiddleProofSemanticAtomicCertificateClosure(input) {
21472
- if (!isRecord4(input)) throw new Error("Semantic certificate closure input must be a plain object.");
21473
- assertOnlyKeys(input, ["certificate"], "Semantic certificate closure input");
21474
- const certificate = requiredField(input, "certificate", "Semantic certificate closure input");
21475
- let parsedCertificate;
21476
- try {
21477
- parsedCertificate = parseRiddleProofSemanticCertificate(certificate);
21478
- } catch (error) {
21479
- return {
21480
- ok: false,
21481
- error: {
21482
- code: "invalid_closure_certificate",
21483
- input_index: 0,
21484
- message: `Semantic certificate closure certificate 0 did not parse: ${safeErrorMessage(error)}`
21485
- }
21486
- };
21487
- }
21488
- if (parsedCertificate.derivation.kind !== "contract") {
21489
- return invalidClosure(
21490
- "An atomic Semantic certificate closure requires a contract-derived certificate."
21491
- );
21492
- }
21493
- return validateRiddleProofSemanticCertificateClosure({
21494
- version: RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
21495
- root_certificate_id: parsedCertificate.certificate_id,
21496
- certificates: [certificate]
21497
- });
21498
- }
21499
- function composeRiddleProofSemanticCertificateClosures(input) {
21500
- if (!isRecord4(input)) throw new Error("Semantic closure composition input must be a plain object.");
21501
- assertOnlyKeys(
21502
- input,
21503
- ["rule", "closures", "issued_at"],
21504
- "Semantic closure composition input"
21505
- );
21506
- const inputClosures = requiredField(
21507
- input,
21508
- "closures",
21509
- "Semantic closure composition input"
21510
- );
21511
- const closureValues = readDenseDataArray(
21512
- inputClosures,
21513
- "Semantic closure composition input.closures"
21514
- );
21515
- if (closureValues.length === 0) {
21516
- throw new Error("Semantic closure composition requires at least one closure.");
21517
- }
21518
- const validatedClosures = [];
21519
- for (let index = 0; index < closureValues.length; index += 1) {
21520
- const result = validateRiddleProofSemanticCertificateClosure(closureValues[index]);
21521
- if (!result.ok) {
21522
- return {
21523
- ok: false,
21524
- error: {
21525
- code: "input_closure_invalid",
21526
- input_index: index,
21527
- cause: result.error,
21528
- message: `Semantic input closure ${index} is invalid: ${result.error.message}`
21529
- }
21530
- };
21531
- }
21532
- validatedClosures.push(result);
21533
- }
21534
- const roots = validatedClosures.map((result) => {
21535
- if (!result.ok) throw new Error("Validated Semantic closure unexpectedly became invalid.");
21536
- return result.root_certificate;
21537
- });
21538
- const composition = composeRiddleProofSemanticCertificates({
21539
- rule: requiredField(input, "rule", "Semantic closure composition input"),
21540
- certificates: roots,
21541
- issued_at: optionalField(input, "issued_at")
21542
- });
21543
- if (!composition.ok) return composition;
21544
- const merged = [];
21545
- const byId = /* @__PURE__ */ new Map();
21546
- for (const result of validatedClosures) {
21547
- if (!result.ok) continue;
21548
- for (const certificate of result.closure.certificates) {
21549
- const existing = byId.get(certificate.certificate_id);
21550
- if (existing) {
21551
- if (stableJson3(existing) !== stableJson3(certificate)) {
21552
- return {
21553
- ok: false,
21554
- error: {
21555
- code: "certificate_id_collision",
21556
- certificate_id: certificate.certificate_id,
21557
- message: `Semantic closures contain unequal bodies for ${certificate.certificate_id}.`
21558
- }
21559
- };
21560
- }
21561
- continue;
21562
- }
21563
- byId.set(certificate.certificate_id, certificate);
21564
- merged.push(certificate);
21565
- }
21566
- }
21567
- if (byId.has(composition.certificate.certificate_id)) {
21568
- return {
21569
- ok: false,
21570
- error: {
21571
- code: "certificate_id_collision",
21572
- certificate_id: composition.certificate.certificate_id,
21573
- message: "Semantic composition produced a root ID already present in its premise closures."
21574
- }
21575
- };
21576
- }
21577
- merged.push(composition.certificate);
21578
- const validation = validateRiddleProofSemanticCertificateClosure({
21579
- version: RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
21580
- root_certificate_id: composition.certificate.certificate_id,
21581
- certificates: merged
21582
- });
21583
- if (!validation.ok) {
21584
- return {
21585
- ok: false,
21586
- error: {
21587
- code: "closure_construction_failed",
21588
- cause: validation.error,
21589
- message: `Semantic closure construction failed: ${validation.error.message}`
21590
- }
21591
- };
21592
- }
21593
- return {
21594
- ok: true,
21595
- certificate: composition.certificate,
21596
- closure: validation.closure
21597
- };
21598
- }
21599
- function matchRiddleProofSemanticCertificateClosure(input) {
21600
- if (!isRecord4(input)) throw new Error("Semantic certificate closure match input must be a plain object.");
21601
- assertOnlyKeys(
21602
- input,
21603
- [
21604
- "closure",
21605
- "expected_root_certificate_id",
21606
- "expected_scope",
21607
- "expected_claim",
21608
- "expected_assurance"
21609
- ],
21610
- "Semantic certificate closure match input"
21611
- );
21612
- const validation = validateRiddleProofSemanticCertificateClosure(
21613
- requiredField(input, "closure", "Semantic certificate closure match input")
21614
- );
21615
- if (!validation.ok) return validation;
21616
- const expectedRootCertificateId = requiredString2(
21617
- input,
21618
- "expected_root_certificate_id",
21619
- "Semantic certificate closure match input"
21620
- );
21621
- if (!/^rpsc_[0-9a-f]{64}$/u.test(expectedRootCertificateId)) {
21622
- throw new Error(
21623
- "Semantic certificate closure match input.expected_root_certificate_id must be a full rpsc content ID."
21624
- );
21625
- }
21626
- const rootMatch = matchRiddleProofSemanticCertificate({
21627
- certificate: validation.root_certificate,
21628
- expected_certificate_id: expectedRootCertificateId,
21629
- expected_scope: requiredField(
21630
- input,
21631
- "expected_scope",
21632
- "Semantic certificate closure match input"
21633
- ),
21634
- expected_claim: requiredField(
21635
- input,
21636
- "expected_claim",
21637
- "Semantic certificate closure match input"
21638
- ),
21639
- expected_assurance: requiredField(
21640
- input,
21641
- "expected_assurance",
21642
- "Semantic certificate closure match input"
21643
- )
21644
- });
21645
- if (!rootMatch.ok) return rootMatch;
21646
- return {
21647
- ok: true,
21648
- closure: validation.closure,
21649
- root_certificate: rootMatch.certificate
21650
- };
21651
- }
20384
+ var receipts_exports = {};
20385
+ __export(receipts_exports, {
20386
+ RIDDLE_PREVIEW_RECEIPT_VERSION: () => import_receipts.RIDDLE_PREVIEW_RECEIPT_VERSION,
20387
+ RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION: () => import_receipts.RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
20388
+ createRiddleProofObservationReceipt: () => import_receipts.createRiddleProofObservationReceipt,
20389
+ parseRiddlePreviewReceipt: () => import_receipts.parseRiddlePreviewReceipt,
20390
+ parseRiddleProofObservationReceipt: () => import_receipts.parseRiddleProofObservationReceipt
20391
+ });
20392
+ __reExport(receipts_exports, require("@riddledc/riddle-proof-core/receipts"));
20393
+ var import_receipts = require("@riddledc/riddle-proof-core/receipts");
20394
+
20395
+ // src/index.ts
20396
+ __reExport(index_exports, receipts_exports, module.exports);
20397
+
20398
+ // src/semantic-certificate.ts
20399
+ var semantic_certificate_exports = {};
20400
+ __export(semantic_certificate_exports, {
20401
+ RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES: () => import_semantic_certificate.RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES,
20402
+ RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION: () => import_semantic_certificate.RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
20403
+ RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION: () => import_semantic_certificate.RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
20404
+ composeRiddleProofSemanticCertificateClosures: () => import_semantic_certificate.composeRiddleProofSemanticCertificateClosures,
20405
+ composeRiddleProofSemanticCertificates: () => import_semantic_certificate.composeRiddleProofSemanticCertificates,
20406
+ createRiddleProofSemanticAtomicCertificateClosure: () => import_semantic_certificate.createRiddleProofSemanticAtomicCertificateClosure,
20407
+ createRiddleProofSemanticCertificate: () => import_semantic_certificate.createRiddleProofSemanticCertificate,
20408
+ matchRiddleProofSemanticCertificate: () => import_semantic_certificate.matchRiddleProofSemanticCertificate,
20409
+ matchRiddleProofSemanticCertificateClosure: () => import_semantic_certificate.matchRiddleProofSemanticCertificateClosure,
20410
+ parseRiddleProofSemanticCertificate: () => import_semantic_certificate.parseRiddleProofSemanticCertificate,
20411
+ riddleProofSemanticScopesEqual: () => import_semantic_certificate.riddleProofSemanticScopesEqual,
20412
+ validateRiddleProofSemanticCertificateClosure: () => import_semantic_certificate.validateRiddleProofSemanticCertificateClosure
20413
+ });
20414
+ __reExport(semantic_certificate_exports, require("@riddledc/riddle-proof-core/semantic-certificate"));
20415
+ var import_semantic_certificate = require("@riddledc/riddle-proof-core/semantic-certificate");
20416
+
20417
+ // src/index.ts
20418
+ __reExport(index_exports, semantic_certificate_exports, module.exports);
20419
+
20420
+ // src/grounded-evidence.ts
20421
+ var grounded_evidence_exports = {};
20422
+ __export(grounded_evidence_exports, {
20423
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACTS: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACTS,
20424
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACT_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACT_BYTES,
20425
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_OBSERVATION_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_OBSERVATION_BYTES,
20426
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TIME_WINDOW_MS: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TIME_WINDOW_MS,
20427
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TOTAL_ARTIFACT_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TOTAL_ARTIFACT_BYTES,
20428
+ RIDDLE_PROOF_GROUNDED_CAPTURE_STATEMENT_VERSION: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_CAPTURE_STATEMENT_VERSION,
20429
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_DEFINITION_DIGEST_DOMAIN: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_DEFINITION_DIGEST_DOMAIN,
20430
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_CONTRACT_ENGINE: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_CONTRACT_ENGINE,
20431
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_VERIFIER_ENGINE: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_VERIFIER_ENGINE,
20432
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_ASSERTIONS: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_ASSERTIONS,
20433
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_DEFINITION_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_DEFINITION_BYTES,
20434
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_BYTES,
20435
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_SEGMENTS: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_SEGMENTS,
20436
+ RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_CONFIG_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_CONFIG_BYTES,
20437
+ RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_REGISTRY_ENTRIES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_REGISTRY_ENTRIES,
20438
+ RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_TRUSTED_KEY_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_TRUSTED_KEY_BYTES,
20439
+ RIDDLE_PROOF_GROUNDED_SEMANTIC_CERTIFICATE_CLOSURE_VERSION: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
20440
+ RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_METADATA_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_METADATA_BYTES,
20441
+ RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_TOTAL_ARTIFACT_BYTES: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_TOTAL_ARTIFACT_BYTES,
20442
+ RIDDLE_PROOF_GROUNDED_VERIFICATION_RECEIPT_VERSION: () => import_grounded_evidence.RIDDLE_PROOF_GROUNDED_VERIFICATION_RECEIPT_VERSION,
20443
+ RIDDLE_PROOF_SIGNED_CAPTURE_BUNDLE_VERSION: () => import_grounded_evidence.RIDDLE_PROOF_SIGNED_CAPTURE_BUNDLE_VERSION,
20444
+ RIDDLE_PROOF_SIGNED_CAPTURE_SIGNATURE_DOMAIN: () => import_grounded_evidence.RIDDLE_PROOF_SIGNED_CAPTURE_SIGNATURE_DOMAIN,
20445
+ composeRiddleProofGroundedSemanticCertificateClosures: () => import_grounded_evidence.composeRiddleProofGroundedSemanticCertificateClosures,
20446
+ createRiddleProofGroundedDeclarativeJsonContract: () => import_grounded_evidence.createRiddleProofGroundedDeclarativeJsonContract,
20447
+ createRiddleProofGroundedDeclarativeJsonVerifier: () => import_grounded_evidence.createRiddleProofGroundedDeclarativeJsonVerifier,
20448
+ createRiddleProofGroundedSemanticAtomicCertificateClosure: () => import_grounded_evidence.createRiddleProofGroundedSemanticAtomicCertificateClosure,
20449
+ createRiddleProofGroundedSemanticCertificate: () => import_grounded_evidence.createRiddleProofGroundedSemanticCertificate,
20450
+ createRiddleProofSignedCaptureBundle: () => import_grounded_evidence.createRiddleProofSignedCaptureBundle,
20451
+ matchRiddleProofGroundedSemanticCertificateClosure: () => import_grounded_evidence.matchRiddleProofGroundedSemanticCertificateClosure,
20452
+ replayRiddleProofGroundedSemanticCertificate: () => import_grounded_evidence.replayRiddleProofGroundedSemanticCertificate,
20453
+ validateRiddleProofGroundedSemanticCertificateClosure: () => import_grounded_evidence.validateRiddleProofGroundedSemanticCertificateClosure,
20454
+ verifyRiddleProofSignedCaptureBundle: () => import_grounded_evidence.verifyRiddleProofSignedCaptureBundle
20455
+ });
20456
+ __reExport(grounded_evidence_exports, require("@riddledc/riddle-proof-core/grounded-evidence"));
20457
+ var import_grounded_evidence = require("@riddledc/riddle-proof-core/grounded-evidence");
20458
+
20459
+ // src/index.ts
20460
+ __reExport(index_exports, grounded_evidence_exports, module.exports);
20461
+
20462
+ // src/checked-meaning.ts
20463
+ var checked_meaning_exports = {};
20464
+ __export(checked_meaning_exports, {
20465
+ RIDDLE_PROOF_CHECKED_MEANING_ASSURANCE: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_ASSURANCE,
20466
+ RIDDLE_PROOF_CHECKED_MEANING_CLOSURE_VERSION: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_CLOSURE_VERSION,
20467
+ RIDDLE_PROOF_CHECKED_MEANING_MATERIALIZED_RULE_DIGEST_DOMAIN: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MATERIALIZED_RULE_DIGEST_DOMAIN,
20468
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_AGE_MS: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_AGE_MS,
20469
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_CONSUMPTION_WINDOW_MS: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_CONSUMPTION_WINDOW_MS,
20470
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_DEFINITION_BYTES: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_DEFINITION_BYTES,
20471
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_PARAMETERS: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_PARAMETERS,
20472
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_PREMISES: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_PREMISES,
20473
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_RULES: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_MAX_RULES,
20474
+ RIDDLE_PROOF_CHECKED_MEANING_RULE_DIGEST_DOMAIN: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_RULE_DIGEST_DOMAIN,
20475
+ RIDDLE_PROOF_CHECKED_MEANING_RULE_ENGINE: () => import_checked_meaning.RIDDLE_PROOF_CHECKED_MEANING_RULE_ENGINE,
20476
+ assessRiddleProofCheckedMeaningClosure: () => import_checked_meaning.assessRiddleProofCheckedMeaningClosure,
20477
+ composeRiddleProofCheckedMeaningClosures: () => import_checked_meaning.composeRiddleProofCheckedMeaningClosures,
20478
+ createRiddleProofCheckedMeaningAtomicClosure: () => import_checked_meaning.createRiddleProofCheckedMeaningAtomicClosure,
20479
+ createRiddleProofCheckedMeaningRule: () => import_checked_meaning.createRiddleProofCheckedMeaningRule,
20480
+ matchRiddleProofCheckedMeaningClosure: () => import_checked_meaning.matchRiddleProofCheckedMeaningClosure,
20481
+ replayRiddleProofCheckedMeaningClosure: () => import_checked_meaning.replayRiddleProofCheckedMeaningClosure,
20482
+ validateRiddleProofCheckedMeaningClosure: () => import_checked_meaning.validateRiddleProofCheckedMeaningClosure
20483
+ });
20484
+ __reExport(checked_meaning_exports, require("@riddledc/riddle-proof-core/checked-meaning"));
20485
+ var import_checked_meaning = require("@riddledc/riddle-proof-core/checked-meaning");
20486
+
20487
+ // src/index.ts
20488
+ __reExport(index_exports, checked_meaning_exports, module.exports);
21652
20489
 
21653
20490
  // src/change-proof.ts
21654
20491
  var RIDDLE_PROOF_CHANGE_CONTRACT_VERSION = "riddle-proof.change-contract.v1";
@@ -21992,7 +20829,7 @@ function changeReceiptVerdict(status) {
21992
20829
  if (status === "proof_insufficient") return "proof_insufficient";
21993
20830
  return "not_mergeable";
21994
20831
  }
21995
- function profileCheckCounts2(result) {
20832
+ function profileCheckCounts(result) {
21996
20833
  const counts = {
21997
20834
  total: result.checks.length,
21998
20835
  passed: 0,
@@ -22065,7 +20902,7 @@ function observationExecutor(result) {
22065
20902
  function observationForReceiptSide(side, result, source, sourceIdentity) {
22066
20903
  if (!result) throw new Error(`${side}_result or ${side}_observation is required.`);
22067
20904
  if (!source) throw new Error(`${side}_source or ${side}_observation is required.`);
22068
- return createRiddleProofObservationReceipt({
20905
+ return (0, import_receipts.createRiddleProofObservationReceipt)({
22069
20906
  comparison_role: side,
22070
20907
  executor: observationExecutor(result),
22071
20908
  target: { kind: "url", url: source },
@@ -22076,8 +20913,8 @@ function observationForReceiptSide(side, result, source, sourceIdentity) {
22076
20913
  });
22077
20914
  }
22078
20915
  function createRiddleProofChangeReceipt(input) {
22079
- const before = input.before_observation ? parseRiddleProofObservationReceipt(input.before_observation) : observationForReceiptSide("before", input.before_result, input.before_source, input.before_source_identity);
22080
- const after = input.after_observation ? parseRiddleProofObservationReceipt(input.after_observation) : observationForReceiptSide("after", input.after_result, input.after_source, input.after_source_identity);
20916
+ const before = input.before_observation ? (0, import_receipts.parseRiddleProofObservationReceipt)(input.before_observation) : observationForReceiptSide("before", input.before_result, input.before_source, input.before_source_identity);
20917
+ const after = input.after_observation ? (0, import_receipts.parseRiddleProofObservationReceipt)(input.after_observation) : observationForReceiptSide("after", input.after_result, input.after_source, input.after_source_identity);
22081
20918
  const verdict = changeReceiptVerdict(input.result.status);
22082
20919
  const shippingAuthorization = input.shipping_authorization || noShippingAuthorization();
22083
20920
  assertShippingAuthorizationConsistent(shippingAuthorization, "Change receipt");
@@ -22107,7 +20944,7 @@ function createRiddleProofChangeReceipt(input) {
22107
20944
  metadata: input.result.metadata
22108
20945
  };
22109
20946
  }
22110
- function isRecord5(value) {
20947
+ function isRecord3(value) {
22111
20948
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
22112
20949
  }
22113
20950
  function migratedObservationFromLegacySide(side, legacy) {
@@ -22184,7 +21021,7 @@ function migrateRiddleProofChangeReceipt(legacy) {
22184
21021
  };
22185
21022
  }
22186
21023
  function parseRiddleProofChangeReceipt(value) {
22187
- if (!isRecord5(value)) throw new Error("Change receipt must be an object.");
21024
+ if (!isRecord3(value)) throw new Error("Change receipt must be an object.");
22188
21025
  if (value.version === RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION) {
22189
21026
  return migrateRiddleProofChangeReceipt(value);
22190
21027
  }
@@ -22195,8 +21032,8 @@ function parseRiddleProofChangeReceipt(value) {
22195
21032
  if (!RIDDLE_PROOF_PROFILE_STATUSES.includes(receipt.status)) {
22196
21033
  throw new Error(`Unsupported Change receipt status ${String(receipt.status || "missing")}.`);
22197
21034
  }
22198
- parseRiddleProofObservationReceipt(receipt.before);
22199
- parseRiddleProofObservationReceipt(receipt.after);
21035
+ (0, import_receipts.parseRiddleProofObservationReceipt)(receipt.before);
21036
+ (0, import_receipts.parseRiddleProofObservationReceipt)(receipt.after);
22200
21037
  if (receipt.before.comparison_role !== "before" || receipt.after.comparison_role !== "after") {
22201
21038
  throw new Error("Change receipt observations must preserve their before and after comparison roles.");
22202
21039
  }
@@ -22228,8 +21065,8 @@ function createRiddleProofHandoffReceipt(changeReceipt, options = {}) {
22228
21065
  };
22229
21066
  }
22230
21067
  function parseRiddleProofHandoffReceipt(value) {
22231
- if (!isRecord5(value) || value.version !== RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION) {
22232
- throw new Error(`Unsupported Handoff receipt version ${String(isRecord5(value) ? value.version || "missing" : "missing")}.`);
21068
+ if (!isRecord3(value) || value.version !== RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION) {
21069
+ throw new Error(`Unsupported Handoff receipt version ${String(isRecord3(value) ? value.version || "missing" : "missing")}.`);
22233
21070
  }
22234
21071
  const receipt = value;
22235
21072
  if (!Number.isFinite(Date.parse(receipt.created_at))) {
@@ -22284,7 +21121,7 @@ function receiptSideView(side, observation) {
22284
21121
  summary: summary?.summary || observation.proof?.result.summary || "No profile summary recorded.",
22285
21122
  route: summary?.route,
22286
21123
  captured_at: observation.captured_at,
22287
- checks: summary?.checks || (observation.proof ? profileCheckCounts2(observation.proof.result) : {
21124
+ checks: summary?.checks || (observation.proof ? profileCheckCounts(observation.proof.result) : {
22288
21125
  total: 0,
22289
21126
  passed: 0,
22290
21127
  failed: 0,
@@ -22514,624 +21351,7 @@ function riddleProofChangeReceiptHtml(receipt) {
22514
21351
  }
22515
21352
 
22516
21353
  // src/riddle-client.ts
22517
- var import_node_child_process4 = require("child_process");
22518
- var import_node_fs5 = require("fs");
22519
- var import_node_os2 = require("os");
22520
- var import_node_path5 = __toESM(require("path"), 1);
22521
- var DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
22522
- var DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
22523
- var RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
22524
- var RiddleApiError = class extends Error {
22525
- constructor(pathname, status, body) {
22526
- super(`Riddle API ${pathname} failed HTTP ${status}: ${body}`);
22527
- this.name = "RiddleApiError";
22528
- this.status = status;
22529
- this.body = body;
22530
- this.path = pathname;
22531
- }
22532
- };
22533
- var PREVIEW_PUBLISH_RECOVERY_STATUSES = /* @__PURE__ */ new Set([408, 429, 500, 502, 503, 504]);
22534
- var PREVIEW_PUBLISH_RECOVERY_ATTEMPTS = 30;
22535
- var PREVIEW_PUBLISH_RECOVERY_INTERVAL_MS = 2e3;
22536
- function normalizeBaseUrl(value) {
22537
- return (value || DEFAULT_RIDDLE_API_BASE_URL).replace(/\/$/, "");
22538
- }
22539
- function fetchFor(config = {}) {
22540
- return config.fetchImpl || fetch;
22541
- }
22542
- function resolveRiddleApiKeyWithSource(config = {}) {
22543
- if (config.apiKey?.trim()) return { apiKey: config.apiKey.trim(), source: "option" };
22544
- if (process.env.RIDDLE_API_KEY?.trim()) return { apiKey: process.env.RIDDLE_API_KEY.trim(), source: "env" };
22545
- const keyFile = config.apiKeyFile || process.env.RIDDLE_API_KEY_FILE || DEFAULT_RIDDLE_API_KEY_FILE;
22546
- if ((0, import_node_fs5.existsSync)(keyFile)) {
22547
- const key = (0, import_node_fs5.readFileSync)(keyFile, "utf8").trim();
22548
- if (key) return { apiKey: key, source: "file", file: keyFile };
22549
- }
22550
- throw new Error(`Riddle API key missing. Set RIDDLE_API_KEY or write ${DEFAULT_RIDDLE_API_KEY_FILE}.`);
22551
- }
22552
- function resolveRiddleApiKeySource(config = {}) {
22553
- const { apiKey: _apiKey, ...source } = resolveRiddleApiKeyWithSource(config);
22554
- return source;
22555
- }
22556
- function resolveRiddleApiKey(config = {}) {
22557
- return resolveRiddleApiKeyWithSource(config).apiKey;
22558
- }
22559
- async function riddleRequestJson(config, pathname, init = {}) {
22560
- const response = await fetchFor(config)(`${normalizeBaseUrl(config.apiBaseUrl)}${pathname}`, {
22561
- ...init,
22562
- headers: {
22563
- Authorization: `Bearer ${resolveRiddleApiKey(config)}`,
22564
- "Content-Type": "application/json",
22565
- ...init.headers || {}
22566
- }
22567
- });
22568
- const text = await response.text();
22569
- let json = null;
22570
- try {
22571
- json = JSON.parse(text);
22572
- } catch {
22573
- }
22574
- if (!response.ok) throw new RiddleApiError(pathname, response.status, text);
22575
- return json ?? text;
22576
- }
22577
- async function getRiddleBalance(config = {}) {
22578
- return riddleRequestJson(config, "/v1/balance", { method: "GET" });
22579
- }
22580
- function previewDeployResultFromRecord(input) {
22581
- const { record, id, label, framework, expiresAt, publishRecovered, publishError } = input;
22582
- const receipt = record.receipt && typeof record.receipt === "object" ? parseRiddlePreviewReceipt(record.receipt) : void 0;
22583
- return {
22584
- ok: true,
22585
- id: String(record.id || record.preview_id || id),
22586
- label,
22587
- framework,
22588
- preview_url: String(record.preview_url || ""),
22589
- file_count: typeof record.file_count === "number" ? record.file_count : void 0,
22590
- total_bytes: typeof record.total_bytes === "number" ? record.total_bytes : void 0,
22591
- expires_at: receipt?.expires_at || expiresAt,
22592
- receipt,
22593
- publish_recovered: publishRecovered || void 0,
22594
- publish_error: publishError,
22595
- warnings: input.warnings?.length ? input.warnings : void 0,
22596
- raw: record
22597
- };
22598
- }
22599
- function gitOutput(directory, args) {
22600
- try {
22601
- return (0, import_node_child_process4.execFileSync)("git", ["-C", directory, ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
22602
- } catch {
22603
- return "";
22604
- }
22605
- }
22606
- function detectRiddlePreviewSource(directory) {
22607
- const gitRevision = gitOutput(directory, ["rev-parse", "HEAD"]);
22608
- if (!gitRevision) return {};
22609
- const repository = gitOutput(directory, ["config", "--get", "remote.origin.url"]);
22610
- const status = gitOutput(directory, ["status", "--porcelain", "--untracked-files=normal"]);
22611
- return {
22612
- git_revision: gitRevision,
22613
- repository: repository || void 0,
22614
- dirty: Boolean(status)
22615
- };
22616
- }
22617
- function canRecoverPreviewPublish(error) {
22618
- return error instanceof RiddleApiError && PREVIEW_PUBLISH_RECOVERY_STATUSES.has(error.status);
22619
- }
22620
- function summarizePreviewDirectory(directory) {
22621
- const stack = [directory];
22622
- let fileCount = 0;
22623
- let totalBytes = 0;
22624
- while (stack.length) {
22625
- const current = stack.pop();
22626
- for (const entry of (0, import_node_fs5.readdirSync)(current, { withFileTypes: true })) {
22627
- const fullPath = import_node_path5.default.join(current, entry.name);
22628
- if (entry.isDirectory()) {
22629
- stack.push(fullPath);
22630
- continue;
22631
- }
22632
- if (!entry.isFile()) continue;
22633
- const stat = (0, import_node_fs5.statSync)(fullPath);
22634
- fileCount += 1;
22635
- totalBytes += stat.size;
22636
- }
22637
- }
22638
- return { file_count: fileCount, total_bytes: totalBytes };
22639
- }
22640
- function previewProgressEmitter(config, base) {
22641
- return async (snapshot) => {
22642
- if (!config.onPreviewProgress) return;
22643
- await config.onPreviewProgress({
22644
- label: base.label,
22645
- framework: base.framework,
22646
- directory: base.directory,
22647
- elapsed_ms: Math.max(0, Date.now() - base.startedAt),
22648
- warnings: base.warnings?.length ? base.warnings : void 0,
22649
- ...snapshot
22650
- });
22651
- };
22652
- }
22653
- async function waitForPublishedPreview(config, input) {
22654
- await input.emitProgress?.({
22655
- stage: "publish_recovering",
22656
- id: input.id,
22657
- file_count: input.localSummary?.file_count,
22658
- total_bytes: input.localSummary?.total_bytes,
22659
- publish_error: input.publishError.message,
22660
- message: `publish returned ${input.publishError.status}; polling preview status`
22661
- });
22662
- for (let attempt = 1; attempt <= PREVIEW_PUBLISH_RECOVERY_ATTEMPTS; attempt += 1) {
22663
- const status = await riddleRequestJson(config, `/v1/preview/${input.id}`);
22664
- await input.emitProgress?.({
22665
- stage: "checking_status",
22666
- id: input.id,
22667
- attempt,
22668
- attempts: PREVIEW_PUBLISH_RECOVERY_ATTEMPTS,
22669
- status: typeof status.status === "string" ? status.status : null,
22670
- preview_url: typeof status.preview_url === "string" ? status.preview_url : void 0,
22671
- file_count: typeof status.file_count === "number" ? status.file_count : input.localSummary?.file_count,
22672
- total_bytes: typeof status.total_bytes === "number" ? status.total_bytes : input.localSummary?.total_bytes
22673
- });
22674
- if (String(status.status || "") === "ready" && String(status.preview_url || "").trim()) {
22675
- await input.emitProgress?.({
22676
- stage: "ready",
22677
- id: input.id,
22678
- preview_url: String(status.preview_url),
22679
- file_count: typeof status.file_count === "number" ? status.file_count : input.localSummary?.file_count,
22680
- total_bytes: typeof status.total_bytes === "number" ? status.total_bytes : input.localSummary?.total_bytes
22681
- });
22682
- return previewDeployResultFromRecord({
22683
- record: status,
22684
- id: input.id,
22685
- label: input.label,
22686
- framework: input.framework,
22687
- expiresAt: input.expiresAt,
22688
- publishRecovered: true,
22689
- publishError: input.publishError.message,
22690
- warnings: input.warnings
22691
- });
22692
- }
22693
- if (attempt < PREVIEW_PUBLISH_RECOVERY_ATTEMPTS) {
22694
- await new Promise((resolve) => setTimeout(resolve, PREVIEW_PUBLISH_RECOVERY_INTERVAL_MS));
22695
- }
22696
- }
22697
- throw input.publishError;
22698
- }
22699
- async function deployRiddlePreview(config, directory, label, framework = "static", options = {}) {
22700
- if (!directory?.trim()) throw new Error("directory is required");
22701
- if (!label?.trim()) throw new Error("label is required");
22702
- if (framework !== "spa" && framework !== "static") throw new Error("framework must be spa or static");
22703
- const startedAt = Date.now();
22704
- const warnings = collectRiddlePreviewDeployWarnings(directory, framework);
22705
- const source = options.source || detectRiddlePreviewSource(directory);
22706
- const emitProgress = previewProgressEmitter(config, { label, framework, directory, startedAt, warnings });
22707
- await emitProgress({ stage: "validating", message: "checking preview input directory" });
22708
- const localSummary = summarizePreviewDirectory(directory);
22709
- await emitProgress({
22710
- stage: "creating",
22711
- file_count: localSummary.file_count,
22712
- total_bytes: localSummary.total_bytes,
22713
- message: "creating preview upload target"
22714
- });
22715
- const created = await riddleRequestJson(config, "/v1/preview", {
22716
- method: "POST",
22717
- body: JSON.stringify({ framework, label, source })
22718
- });
22719
- const id = String(created.id || "");
22720
- const uploadUrl = String(created.upload_url || "");
22721
- if (!id || !uploadUrl) throw new Error("Riddle preview create response was missing id or upload_url.");
22722
- await emitProgress({
22723
- stage: "created",
22724
- id,
22725
- file_count: localSummary.file_count,
22726
- total_bytes: localSummary.total_bytes,
22727
- message: "preview upload target created"
22728
- });
22729
- const scratch = (0, import_node_fs5.mkdtempSync)(import_node_path5.default.join((0, import_node_os2.tmpdir)(), "riddle-preview-upload-"));
22730
- const tarball = import_node_path5.default.join(scratch, `${id}.tar.gz`);
22731
- let tarballBytes = 0;
22732
- try {
22733
- await emitProgress({
22734
- stage: "archiving",
22735
- id,
22736
- file_count: localSummary.file_count,
22737
- total_bytes: localSummary.total_bytes,
22738
- message: "creating preview archive"
22739
- });
22740
- (0, import_node_child_process4.execFileSync)("tar", ["czf", tarball, "-C", directory, "."], { stdio: "pipe" });
22741
- tarballBytes = (0, import_node_fs5.statSync)(tarball).size;
22742
- await emitProgress({
22743
- stage: "archived",
22744
- id,
22745
- file_count: localSummary.file_count,
22746
- total_bytes: localSummary.total_bytes,
22747
- tarball_bytes: tarballBytes,
22748
- message: "preview archive created"
22749
- });
22750
- await emitProgress({
22751
- stage: "uploading",
22752
- id,
22753
- file_count: localSummary.file_count,
22754
- total_bytes: localSummary.total_bytes,
22755
- tarball_bytes: tarballBytes,
22756
- message: "uploading preview archive"
22757
- });
22758
- const upload = await fetchFor(config)(uploadUrl, {
22759
- method: "PUT",
22760
- headers: { "Content-Type": "application/gzip" },
22761
- body: (0, import_node_fs5.readFileSync)(tarball)
22762
- });
22763
- if (!upload.ok) {
22764
- throw new RiddleApiError(uploadUrl, upload.status, await upload.text());
22765
- }
22766
- await emitProgress({
22767
- stage: "uploaded",
22768
- id,
22769
- file_count: localSummary.file_count,
22770
- total_bytes: localSummary.total_bytes,
22771
- tarball_bytes: tarballBytes,
22772
- message: "preview archive uploaded"
22773
- });
22774
- } finally {
22775
- (0, import_node_fs5.rmSync)(scratch, { recursive: true, force: true });
22776
- }
22777
- const expiresAt = typeof created.expires_at === "string" ? created.expires_at : void 0;
22778
- try {
22779
- await emitProgress({
22780
- stage: "publishing",
22781
- id,
22782
- file_count: localSummary.file_count,
22783
- total_bytes: localSummary.total_bytes,
22784
- tarball_bytes: tarballBytes || void 0,
22785
- message: "publishing preview"
22786
- });
22787
- const published = await riddleRequestJson(config, `/v1/preview/${id}/publish`, {
22788
- method: "POST"
22789
- });
22790
- await emitProgress({
22791
- stage: "ready",
22792
- id,
22793
- preview_url: String(published.preview_url || ""),
22794
- file_count: typeof published.file_count === "number" ? published.file_count : localSummary.file_count,
22795
- total_bytes: typeof published.total_bytes === "number" ? published.total_bytes : localSummary.total_bytes
22796
- });
22797
- return previewDeployResultFromRecord({ record: published, id, label, framework, expiresAt, warnings });
22798
- } catch (error) {
22799
- if (!canRecoverPreviewPublish(error)) throw error;
22800
- return waitForPublishedPreview(config, {
22801
- id,
22802
- label,
22803
- framework,
22804
- expiresAt,
22805
- publishError: error,
22806
- warnings,
22807
- localSummary,
22808
- emitProgress
22809
- });
22810
- }
22811
- }
22812
- function latestMatchingMtimeMs(directory, predicate) {
22813
- let latest = 0;
22814
- const stack = [directory];
22815
- let visited = 0;
22816
- while (stack.length) {
22817
- const current = stack.pop();
22818
- for (const entry of (0, import_node_fs5.readdirSync)(current, { withFileTypes: true })) {
22819
- const fullPath = import_node_path5.default.join(current, entry.name);
22820
- if (entry.isDirectory()) {
22821
- stack.push(fullPath);
22822
- continue;
22823
- }
22824
- if (!entry.isFile() || !predicate(fullPath)) continue;
22825
- const stat = (0, import_node_fs5.statSync)(fullPath);
22826
- latest = Math.max(latest, stat.mtimeMs);
22827
- visited += 1;
22828
- if (visited >= 1e4) return latest;
22829
- }
22830
- }
22831
- return latest;
22832
- }
22833
- function collectRiddlePreviewDeployWarnings(directory, framework = "static") {
22834
- try {
22835
- if (framework !== "static") return [];
22836
- const resolvedDirectory = import_node_path5.default.resolve(directory);
22837
- if (import_node_path5.default.basename(resolvedDirectory) !== "out") return [];
22838
- const repoRoot = import_node_path5.default.dirname(resolvedDirectory);
22839
- const nextAppDir = import_node_path5.default.join(repoRoot, ".next", "server", "app");
22840
- if (!(0, import_node_fs5.existsSync)(nextAppDir)) return [];
22841
- const nextRenderedMtimeMs = latestMatchingMtimeMs(nextAppDir, (filePath) => /\.(?:html|rsc)$/i.test(filePath));
22842
- if (!nextRenderedMtimeMs) return [];
22843
- const outRenderedMtimeMs = (0, import_node_fs5.existsSync)(resolvedDirectory) ? latestMatchingMtimeMs(resolvedDirectory, (filePath) => /\.(?:html|txt|rsc)$/i.test(filePath)) : 0;
22844
- if (!outRenderedMtimeMs) {
22845
- return [
22846
- "Riddle Preview static deploy target is an out/ directory with newer Next render output in .next/server/app, but no rendered HTML/RSC files were found in out/. Run the project static bundle/export step before deploying."
22847
- ];
22848
- }
22849
- if (nextRenderedMtimeMs > outRenderedMtimeMs + 1e3) {
22850
- return [
22851
- "Riddle Preview static deploy target out/ appears older than the Next render output in .next/server/app. Run the project static bundle/export step, such as npm run build:static-deploy or next export, before deploying to avoid a stale Preview."
22852
- ];
22853
- }
22854
- return [];
22855
- } catch {
22856
- return [];
22857
- }
22858
- }
22859
- async function deployRiddleStaticPreview(config, directory, label, options = {}) {
22860
- return deployRiddlePreview(config, directory, label, "static", options);
22861
- }
22862
- function createTarball(directory, label, exclude = []) {
22863
- const scratch = (0, import_node_fs5.mkdtempSync)(import_node_path5.default.join((0, import_node_os2.tmpdir)(), "riddle-upload-"));
22864
- const tarball = import_node_path5.default.join(scratch, `${label}.tar.gz`);
22865
- const excludeArgs = exclude.flatMap((item) => ["--exclude", item]);
22866
- try {
22867
- (0, import_node_child_process4.execFileSync)("tar", ["czf", tarball, ...excludeArgs, "-C", directory, "."], { stdio: "pipe" });
22868
- return { scratch, tarball };
22869
- } catch (error) {
22870
- (0, import_node_fs5.rmSync)(scratch, { recursive: true, force: true });
22871
- throw error;
22872
- }
22873
- }
22874
- function parseRiddleViewport(value) {
22875
- if (!value) return void 0;
22876
- const match = /^(\d+)x(\d+)$/.exec(value.trim());
22877
- if (!match) throw new Error("viewport must look like 1280x720");
22878
- return { width: Number(match[1]), height: Number(match[2]) };
22879
- }
22880
- function scriptErrorFrom(job) {
22881
- const nested = job?.proof_of_execution && typeof job.proof_of_execution === "object" && !Array.isArray(job.proof_of_execution) ? job.proof_of_execution : null;
22882
- return typeof job?.script_error === "string" && job.script_error.trim() ? job.script_error : typeof nested?.script_error === "string" && nested.script_error.trim() ? nested.script_error : null;
22883
- }
22884
- async function runRiddleServerPreview(config, input) {
22885
- if (!input.directory?.trim()) throw new Error("directory is required");
22886
- if (!input.script?.trim()) throw new Error("script is required");
22887
- const port = input.port || 3e3;
22888
- const routePath = input.path || "/";
22889
- const timeoutSec = input.timeoutSec || 180;
22890
- const created = await riddleRequestJson(config, "/v1/server-preview", {
22891
- method: "POST",
22892
- body: JSON.stringify({
22893
- image: input.image || "node:22-slim",
22894
- command: input.command || "node scripts/riddleSpaPreviewServer.mjs build 3000",
22895
- port,
22896
- path: routePath,
22897
- readiness_path: input.readinessPath || routePath,
22898
- readiness_timeout: input.readinessTimeoutSec || 90,
22899
- wait_until: input.waitUntil || "domcontentloaded",
22900
- wait_for_selector: input.waitForSelector || "body",
22901
- navigation_timeout: input.navigationTimeoutSec || 60,
22902
- viewport: input.viewport,
22903
- timeout: timeoutSec,
22904
- script: input.script
22905
- })
22906
- });
22907
- const jobId = String(created.job_id || "");
22908
- const uploadUrl = String(created.upload_url || "");
22909
- if (!jobId || !uploadUrl) {
22910
- throw new Error(`Riddle server preview create response was missing job_id or upload_url.`);
22911
- }
22912
- const { scratch, tarball } = createTarball(input.directory, jobId, [
22913
- ".git",
22914
- "node_modules",
22915
- "test-results",
22916
- ...input.exclude || []
22917
- ]);
22918
- try {
22919
- const upload = await fetchFor(config)(uploadUrl, {
22920
- method: "PUT",
22921
- headers: { "Content-Type": "application/gzip" },
22922
- body: (0, import_node_fs5.readFileSync)(tarball)
22923
- });
22924
- if (!upload.ok) throw new RiddleApiError(uploadUrl, upload.status, await upload.text());
22925
- } finally {
22926
- (0, import_node_fs5.rmSync)(scratch, { recursive: true, force: true });
22927
- }
22928
- await riddleRequestJson(config, `/v1/server-preview/${jobId}/start`, {
22929
- method: "POST"
22930
- });
22931
- let job = null;
22932
- const attempts = input.pollAttempts || Math.ceil((timeoutSec + 90) / 2);
22933
- const intervalMs = input.pollIntervalMs || 2e3;
22934
- for (let index = 0; index < attempts; index += 1) {
22935
- job = await riddleRequestJson(config, `/v1/server-preview/${jobId}`);
22936
- if (isTerminalRiddleJobStatus(job.status)) break;
22937
- if (index + 1 < attempts) await new Promise((resolve) => setTimeout(resolve, intervalMs));
22938
- }
22939
- const status = job?.status ? String(job.status) : null;
22940
- const scriptError = scriptErrorFrom(job);
22941
- return {
22942
- ok: (status === "completed" || status === "complete") && !scriptError,
22943
- job_id: jobId,
22944
- status,
22945
- terminal: isTerminalRiddleJobStatus(status),
22946
- script_error: scriptError,
22947
- job
22948
- };
22949
- }
22950
- async function runRiddleScript(config, input) {
22951
- if (!input.url?.trim()) throw new Error("url is required");
22952
- if (!input.script?.trim()) throw new Error("script is required");
22953
- const payload = {
22954
- url: input.url,
22955
- script: input.script,
22956
- sync: input.sync ?? false,
22957
- timeout_sec: input.timeoutSec || 120
22958
- };
22959
- if (input.viewport) payload.viewport = input.viewport;
22960
- if (input.include) payload.include = input.include;
22961
- if (typeof input.strict === "boolean") payload.strict = input.strict;
22962
- if (input.options) payload.options = input.options;
22963
- return riddleRequestJson(config, "/v1/run", {
22964
- method: "POST",
22965
- body: JSON.stringify(payload)
22966
- });
22967
- }
22968
- function isTerminalRiddleJobStatus(status) {
22969
- return ["completed", "complete", "completed_error", "completed_timeout", "failed"].includes(String(status || ""));
22970
- }
22971
- function stringField(record, key) {
22972
- const value = record?.[key];
22973
- return typeof value === "string" && value.trim() ? value.trim() : null;
22974
- }
22975
- function parseTimestampMs(value) {
22976
- if (!value) return null;
22977
- const parsed = Date.parse(value);
22978
- return Number.isFinite(parsed) ? parsed : null;
22979
- }
22980
- function buildPollSnapshot(jobId, job, input) {
22981
- const status = job?.status ? String(job.status) : null;
22982
- const phase = job?.phase ? String(job.phase) : null;
22983
- const terminal = isTerminalRiddleJobStatus(status);
22984
- const createdAt = stringField(job, "created_at");
22985
- const submittedAt = stringField(job, "submitted_at");
22986
- const completedAt = stringField(job, "completed_at");
22987
- const createdMs = parseTimestampMs(createdAt);
22988
- const submittedMs = parseTimestampMs(submittedAt);
22989
- const rawExecution = job?.execution && typeof job.execution === "object" && !Array.isArray(job.execution) ? job.execution : null;
22990
- const enqueuedAt = rawExecution ? stringField(rawExecution, "enqueued_at") : null;
22991
- const enqueuedMs = parseTimestampMs(enqueuedAt);
22992
- const queueStartedMs = enqueuedMs ?? createdMs;
22993
- const claimedAt = rawExecution ? stringField(rawExecution, "claimed_at") : null;
22994
- const claimedMs = parseTimestampMs(claimedAt);
22995
- let queueElapsedMs = null;
22996
- if (queueStartedMs !== null && claimedMs !== null) {
22997
- queueElapsedMs = Math.max(0, claimedMs - queueStartedMs);
22998
- } else if (queueStartedMs !== null && submittedMs !== null) {
22999
- queueElapsedMs = Math.max(0, submittedMs - queueStartedMs);
23000
- } else if (queueStartedMs !== null && !submittedAt && !terminal) {
23001
- queueElapsedMs = Math.max(0, input.observedAt - queueStartedMs);
23002
- }
23003
- return {
23004
- job_id: jobId,
23005
- status,
23006
- phase,
23007
- terminal,
23008
- attempt: input.attempt,
23009
- attempts: input.attempts,
23010
- elapsed_ms: Math.max(0, input.observedAt - input.startedAt),
23011
- created_at: createdAt,
23012
- submitted_at: submittedAt,
23013
- completed_at: completedAt,
23014
- queue_elapsed_ms: queueElapsedMs,
23015
- pre_submission_elapsed_ms: Math.max(0, Math.floor(input.preSubmissionElapsedMs ?? 0)),
23016
- running_without_submission: Boolean(status && !terminal && !submittedAt),
23017
- active_execution: Boolean(status === "running" && phase && phase !== "queued"),
23018
- execution: rawExecution ? rawExecution : void 0
23019
- };
23020
- }
23021
- function pollMessage(snapshot, timedOut) {
23022
- if (!timedOut) return void 0;
23023
- const submitted = snapshot.submitted_at || "not submitted";
23024
- const wakeHint = snapshot.running_without_submission && !snapshot.created_at && !snapshot.submitted_at ? ` ${RIDDLE_UNSUBMITTED_WAKE_HINT}.` : "";
23025
- const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
23026
- const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
23027
- return `Riddle job ${snapshot.job_id} did not reach a terminal status after ${snapshot.attempt} poll attempts; status=${snapshot.status || "unknown"} phase=${snapshot.phase || "unknown"} submitted_at=${submitted}.${wakeHint}${queue}${preSubmit}`;
23028
- }
23029
- async function pollRiddleJob(config, jobId, options = {}) {
23030
- if (!jobId?.trim()) throw new Error("jobId is required");
23031
- const attempts = Math.max(1, Math.floor(options.attempts ?? (options.wait ? 300 : 1)));
23032
- const intervalMs = Math.max(0, Math.floor(options.intervalMs ?? 2e3));
23033
- const progressEveryMs = Math.max(0, Math.floor(options.progressEveryMs ?? 1e4));
23034
- const unsubmittedTimeoutMs = Math.max(0, Math.floor(options.unsubmittedTimeoutMs ?? 0));
23035
- const startedAt = Date.now();
23036
- let job = null;
23037
- let lastSnapshot = null;
23038
- let lastProgressAt = 0;
23039
- let lastProgressKey = "";
23040
- let preSubmissionElapsedMs = 0;
23041
- let unsubmittedTimedOut = false;
23042
- for (let index = 0; index < attempts; index += 1) {
23043
- job = await riddleRequestJson(config, `/v1/jobs/${jobId}`);
23044
- const observedAt = Date.now();
23045
- const nextSnapshot = buildPollSnapshot(jobId, job, {
23046
- attempt: index + 1,
23047
- attempts,
23048
- startedAt,
23049
- observedAt,
23050
- preSubmissionElapsedMs
23051
- });
23052
- if (nextSnapshot.running_without_submission) {
23053
- preSubmissionElapsedMs = Math.max(preSubmissionElapsedMs, nextSnapshot.elapsed_ms);
23054
- }
23055
- lastSnapshot = {
23056
- ...nextSnapshot,
23057
- pre_submission_elapsed_ms: preSubmissionElapsedMs
23058
- };
23059
- const progressKey = [
23060
- lastSnapshot.status || "unknown",
23061
- lastSnapshot.phase || "unknown",
23062
- lastSnapshot.terminal ? "terminal" : "nonterminal",
23063
- lastSnapshot.submitted_at ? "submitted" : "unsubmitted"
23064
- ].join(":");
23065
- if (options.onProgress) {
23066
- const shouldReport = index === 0 || lastSnapshot.terminal || progressKey !== lastProgressKey || observedAt - lastProgressAt >= progressEveryMs;
23067
- if (shouldReport) {
23068
- lastProgressAt = observedAt;
23069
- lastProgressKey = progressKey;
23070
- await options.onProgress(lastSnapshot);
23071
- }
23072
- }
23073
- unsubmittedTimedOut = Boolean(
23074
- options.wait && unsubmittedTimeoutMs > 0 && lastSnapshot.running_without_submission && !lastSnapshot.created_at && !lastSnapshot.submitted_at && preSubmissionElapsedMs >= unsubmittedTimeoutMs
23075
- );
23076
- if (lastSnapshot.terminal) break;
23077
- if (unsubmittedTimedOut) break;
23078
- if (index + 1 < attempts) {
23079
- await new Promise((resolve) => setTimeout(resolve, intervalMs));
23080
- }
23081
- }
23082
- const status = job?.status ? String(job.status) : null;
23083
- const fallbackObservedAt = Date.now();
23084
- const snapshot = lastSnapshot || buildPollSnapshot(jobId, job, {
23085
- attempt: 0,
23086
- attempts,
23087
- startedAt,
23088
- observedAt: fallbackObservedAt
23089
- });
23090
- if (!isTerminalRiddleJobStatus(status)) {
23091
- const timedOut = Boolean(options.wait);
23092
- return {
23093
- ok: !timedOut,
23094
- job_id: jobId,
23095
- status,
23096
- terminal: false,
23097
- job,
23098
- poll: {
23099
- ...snapshot,
23100
- timed_out: timedOut,
23101
- interval_ms: intervalMs,
23102
- unsubmitted_timeout: unsubmittedTimedOut || void 0,
23103
- unsubmitted_timeout_ms: unsubmittedTimedOut ? unsubmittedTimeoutMs : void 0,
23104
- message: pollMessage(snapshot, timedOut)
23105
- }
23106
- };
23107
- }
23108
- const artifacts = await riddleRequestJson(config, `/v1/jobs/${jobId}/artifacts`);
23109
- return {
23110
- ok: status === "completed" || status === "complete",
23111
- job_id: jobId,
23112
- status,
23113
- terminal: true,
23114
- job,
23115
- artifacts,
23116
- poll: {
23117
- ...snapshot,
23118
- timed_out: false,
23119
- interval_ms: intervalMs
23120
- }
23121
- };
23122
- }
23123
- function createRiddleApiClient(config = {}) {
23124
- return {
23125
- apiKeySource: () => resolveRiddleApiKeySource(config),
23126
- requestJson: (pathname, init) => riddleRequestJson(config, pathname, init),
23127
- getBalance: () => getRiddleBalance(config),
23128
- deployPreview: (directory, label, framework = "static", options) => deployRiddlePreview(config, directory, label, framework, options),
23129
- deployStaticPreview: (directory, label, options) => deployRiddleStaticPreview(config, directory, label, options),
23130
- runScript: (input) => runRiddleScript(config, input),
23131
- runServerPreview: (input) => runRiddleServerPreview(config, input),
23132
- pollJob: (jobId, options) => pollRiddleJob(config, jobId, options)
23133
- };
23134
- }
21354
+ var import_client = require("@riddledc/riddle-proof-riddle-client/client");
23135
21355
 
23136
21356
  // src/pr-comment.ts
23137
21357
  var RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
@@ -23262,7 +21482,7 @@ function pageSummaries(result) {
23262
21482
  }
23263
21483
  return pages;
23264
21484
  }
23265
- function profileCheckCounts3(result) {
21485
+ function profileCheckCounts2(result) {
23266
21486
  const checks = asArray(result.checks);
23267
21487
  if (checks.length) {
23268
21488
  let passed2 = 0;
@@ -23401,7 +21621,7 @@ function summarizeRiddleProofPrComment(input) {
23401
21621
  const resultDetails = asRecord2(result.details);
23402
21622
  const resultRaw = asRecord2(result.raw);
23403
21623
  const rawDetails = asRecord2(resultRaw.details);
23404
- const profileChecks = profileResult ? profileCheckCounts3(result) : void 0;
21624
+ const profileChecks = profileResult ? profileCheckCounts2(result) : void 0;
23405
21625
  const changeChecks = changeResult ? changeReceiptCheckCounts(result) : void 0;
23406
21626
  const artifacts = mergeArtifacts(
23407
21627
  collectArtifacts(runResponse),
@@ -23672,6 +21892,7 @@ function buildRiddleProofPrCommentMarkdown(input) {
23672
21892
  DEFAULT_DIAGNOSTIC_STRING_LIMIT,
23673
21893
  DEFAULT_RIDDLE_API_BASE_URL,
23674
21894
  DEFAULT_RIDDLE_API_KEY_FILE,
21895
+ RIDDLE_BALANCE_ENDPOINT_PATH,
23675
21896
  RIDDLE_PREVIEW_RECEIPT_VERSION,
23676
21897
  RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
23677
21898
  RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION,
@@ -23681,8 +21902,39 @@ function buildRiddleProofPrCommentMarkdown(input) {
23681
21902
  RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION,
23682
21903
  RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
23683
21904
  RIDDLE_PROOF_CHANGE_RESULT_VERSION,
21905
+ RIDDLE_PROOF_CHECKED_MEANING_ASSURANCE,
21906
+ RIDDLE_PROOF_CHECKED_MEANING_CLOSURE_VERSION,
21907
+ RIDDLE_PROOF_CHECKED_MEANING_MATERIALIZED_RULE_DIGEST_DOMAIN,
21908
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_AGE_MS,
21909
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_CONSUMPTION_WINDOW_MS,
21910
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_DEFINITION_BYTES,
21911
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_PARAMETERS,
21912
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_PREMISES,
21913
+ RIDDLE_PROOF_CHECKED_MEANING_MAX_RULES,
21914
+ RIDDLE_PROOF_CHECKED_MEANING_RULE_DIGEST_DOMAIN,
21915
+ RIDDLE_PROOF_CHECKED_MEANING_RULE_ENGINE,
23684
21916
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
23685
21917
  RIDDLE_PROOF_CHECKPOINT_RESPONSE_VERSION,
21918
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACTS,
21919
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_ARTIFACT_BYTES,
21920
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_OBSERVATION_BYTES,
21921
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TIME_WINDOW_MS,
21922
+ RIDDLE_PROOF_GROUNDED_CAPTURE_MAX_TOTAL_ARTIFACT_BYTES,
21923
+ RIDDLE_PROOF_GROUNDED_CAPTURE_STATEMENT_VERSION,
21924
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_DEFINITION_DIGEST_DOMAIN,
21925
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_CONTRACT_ENGINE,
21926
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_JSON_VERIFIER_ENGINE,
21927
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_ASSERTIONS,
21928
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_DEFINITION_BYTES,
21929
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_BYTES,
21930
+ RIDDLE_PROOF_GROUNDED_DECLARATIVE_MAX_POINTER_SEGMENTS,
21931
+ RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_CONFIG_BYTES,
21932
+ RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_REGISTRY_ENTRIES,
21933
+ RIDDLE_PROOF_GROUNDED_REPLAY_MAX_AGGREGATE_TRUSTED_KEY_BYTES,
21934
+ RIDDLE_PROOF_GROUNDED_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
21935
+ RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_METADATA_BYTES,
21936
+ RIDDLE_PROOF_GROUNDED_SEMANTIC_CLOSURE_MAX_TOTAL_ARTIFACT_BYTES,
21937
+ RIDDLE_PROOF_GROUNDED_VERIFICATION_RECEIPT_VERSION,
23686
21938
  RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION,
23687
21939
  RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS,
23688
21940
  RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
@@ -23703,6 +21955,8 @@ function buildRiddleProofPrCommentMarkdown(input) {
23703
21955
  RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES,
23704
21956
  RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
23705
21957
  RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
21958
+ RIDDLE_PROOF_SIGNED_CAPTURE_BUNDLE_VERSION,
21959
+ RIDDLE_PROOF_SIGNED_CAPTURE_SIGNATURE_DOMAIN,
23706
21960
  RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION,
23707
21961
  RIDDLE_PROOF_VISUAL_SESSION_VERSION,
23708
21962
  RIDDLE_UNSUBMITTED_WAKE_HINT,
@@ -23720,6 +21974,7 @@ function buildRiddleProofPrCommentMarkdown(input) {
23720
21974
  assessBasicGameplayRoute,
23721
21975
  assessPlayabilityEvidence,
23722
21976
  assessRiddleProofChange,
21977
+ assessRiddleProofCheckedMeaningClosure,
23723
21978
  assessRiddleProofOrderedTrace,
23724
21979
  assessRiddleProofOrderedTraceSetupResults,
23725
21980
  assessRiddleProofProfileArtifactCompleteness,
@@ -23744,6 +21999,8 @@ function buildRiddleProofPrCommentMarkdown(input) {
23744
21999
  compactBasicGameplayText,
23745
22000
  compactRecord,
23746
22001
  compareVisualProofSessionFingerprint,
22002
+ composeRiddleProofCheckedMeaningClosures,
22003
+ composeRiddleProofGroundedSemanticCertificateClosures,
23747
22004
  composeRiddleProofSemanticCertificateClosures,
23748
22005
  composeRiddleProofSemanticCertificates,
23749
22006
  createBasicGameplayCatchRecords,
@@ -23757,6 +22014,12 @@ function buildRiddleProofPrCommentMarkdown(input) {
23757
22014
  createLocalAgentJsonRunner,
23758
22015
  createRiddleApiClient,
23759
22016
  createRiddleProofChangeReceipt,
22017
+ createRiddleProofCheckedMeaningAtomicClosure,
22018
+ createRiddleProofCheckedMeaningRule,
22019
+ createRiddleProofGroundedDeclarativeJsonContract,
22020
+ createRiddleProofGroundedDeclarativeJsonVerifier,
22021
+ createRiddleProofGroundedSemanticAtomicCertificateClosure,
22022
+ createRiddleProofGroundedSemanticCertificate,
23760
22023
  createRiddleProofHandoffReceipt,
23761
22024
  createRiddleProofObservationReceipt,
23762
22025
  createRiddleProofProfileConfigurationError,
@@ -23765,6 +22028,7 @@ function buildRiddleProofPrCommentMarkdown(input) {
23765
22028
  createRiddleProofRunCard,
23766
22029
  createRiddleProofSemanticAtomicCertificateClosure,
23767
22030
  createRiddleProofSemanticCertificate,
22031
+ createRiddleProofSignedCaptureBundle,
23768
22032
  createRunResult,
23769
22033
  createRunState,
23770
22034
  createRunStatusSnapshot,
@@ -23776,12 +22040,15 @@ function buildRiddleProofPrCommentMarkdown(input) {
23776
22040
  extractPlayabilityEvidence,
23777
22041
  extractRiddleProofProfileResult,
23778
22042
  getRiddleBalance,
22043
+ getRiddleJobArtifacts,
23779
22044
  isDuplicateCheckpointResponse,
23780
22045
  isProtectedFinalStatus,
23781
22046
  isRiddleProofPlayabilityMode,
23782
22047
  isSuccessfulStatus,
23783
22048
  isTerminalRiddleJobStatus,
23784
22049
  isTerminalStatus,
22050
+ matchRiddleProofCheckedMeaningClosure,
22051
+ matchRiddleProofGroundedSemanticCertificateClosure,
23785
22052
  matchRiddleProofSemanticCertificate,
23786
22053
  matchRiddleProofSemanticCertificateClosure,
23787
22054
  migrateRiddleProofChangeReceipt,
@@ -23809,6 +22076,8 @@ function buildRiddleProofPrCommentMarkdown(input) {
23809
22076
  readRiddleProofRunStatus,
23810
22077
  recordValue,
23811
22078
  redactForProofDiagnostics,
22079
+ replayRiddleProofCheckedMeaningClosure,
22080
+ replayRiddleProofGroundedSemanticCertificate,
23812
22081
  resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
23813
22082
  resolveRiddleApiKey,
23814
22083
  resolveRiddleApiKeySource,
@@ -23841,7 +22110,10 @@ function buildRiddleProofPrCommentMarkdown(input) {
23841
22110
  summarizeRiddleProofProfileResult,
23842
22111
  summarizeRiddleProofPublicConsumerSurface,
23843
22112
  summarizeRiddleProofPublicState,
22113
+ validateRiddleProofCheckedMeaningClosure,
22114
+ validateRiddleProofGroundedSemanticCertificateClosure,
23844
22115
  validateRiddleProofSemanticCertificateClosure,
22116
+ verifyRiddleProofSignedCaptureBundle,
23845
22117
  visualSessionFingerprint,
23846
22118
  visualSessionFingerprintBasis
23847
22119
  });