@riddledc/riddle-proof 0.8.83 → 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 (75) hide show
  1. package/README.md +247 -29
  2. package/capabilities.json +17 -0
  3. package/dist/advanced/engine-harness.js +2 -2
  4. package/dist/advanced/index.d.cts +1 -1
  5. package/dist/advanced/index.d.ts +1 -1
  6. package/dist/advanced/index.js +4 -4
  7. package/dist/advanced/proof-run-engine.d.cts +1 -1
  8. package/dist/advanced/proof-run-engine.d.ts +1 -1
  9. package/dist/advanced/runner.js +2 -2
  10. package/dist/change-proof.cjs +22 -260
  11. package/dist/change-proof.d.cts +1 -1
  12. package/dist/change-proof.d.ts +1 -1
  13. package/dist/change-proof.js +2 -2
  14. package/dist/checked-meaning.cjs +67 -0
  15. package/dist/checked-meaning.d.cts +2 -0
  16. package/dist/checked-meaning.d.ts +2 -0
  17. package/dist/checked-meaning.js +41 -0
  18. package/dist/{chunk-QYZ3GKCP.js → chunk-AFARUBE4.js} +12 -11
  19. package/dist/chunk-J2SIQGQI.js +71 -0
  20. package/dist/{chunk-7OAETQU3.js → chunk-JZKLCY5G.js} +1 -1
  21. package/dist/chunk-KB7FYRBG.js +46 -0
  22. package/dist/chunk-NWLKJ2WI.js +31 -0
  23. package/dist/{chunk-LR4UYJDY.js → chunk-O2AO726C.js} +1 -1
  24. package/dist/chunk-ODLGSEP2.js +43 -0
  25. package/dist/chunk-OHDNCXRM.js +17 -0
  26. package/dist/cli/index.js +7 -7
  27. package/dist/cli.cjs +265 -1122
  28. package/dist/cli.d.cts +0 -1
  29. package/dist/cli.d.ts +0 -1
  30. package/dist/cli.js +7 -7
  31. package/dist/engine-harness.js +2 -2
  32. package/dist/grounded-evidence.cjs +95 -0
  33. package/dist/grounded-evidence.d.cts +2 -0
  34. package/dist/grounded-evidence.d.ts +2 -0
  35. package/dist/grounded-evidence.js +69 -0
  36. package/dist/index.cjs +318 -1539
  37. package/dist/index.d.cts +9 -3
  38. package/dist/index.d.ts +9 -3
  39. package/dist/index.js +136 -16
  40. package/dist/pr-comment.cjs +17 -107
  41. package/dist/pr-comment.d.cts +1 -1
  42. package/dist/pr-comment.d.ts +1 -1
  43. package/dist/pr-comment.js +3 -3
  44. package/dist/{proof-run-engine-MiKZt9oY.d.ts → proof-run-engine-BqRoA3Do.d.ts} +3 -3
  45. package/dist/{proof-run-engine-Baiv6l3A.d.cts → proof-run-engine-DpChFR5H.d.cts} +3 -3
  46. package/dist/proof-run-engine.d.cts +1 -1
  47. package/dist/proof-run-engine.d.ts +1 -1
  48. package/dist/receipts.cjs +10 -255
  49. package/dist/receipts.d.cts +7 -115
  50. package/dist/receipts.d.ts +7 -115
  51. package/dist/receipts.js +1 -1
  52. package/dist/riddle-client.cjs +23 -695
  53. package/dist/riddle-client.d.cts +1 -188
  54. package/dist/riddle-client.d.ts +1 -188
  55. package/dist/riddle-client.js +5 -2
  56. package/dist/runner.js +2 -2
  57. package/dist/runtime/index.cjs +23 -695
  58. package/dist/runtime/index.d.cts +1 -5
  59. package/dist/runtime/index.d.ts +1 -5
  60. package/dist/runtime/index.js +5 -2
  61. package/dist/runtime/riddle-client.cjs +23 -695
  62. package/dist/runtime/riddle-client.d.cts +1 -5
  63. package/dist/runtime/riddle-client.d.ts +1 -5
  64. package/dist/runtime/riddle-client.js +5 -2
  65. package/dist/semantic-certificate.cjs +23 -582
  66. package/dist/semantic-certificate.d.cts +2 -191
  67. package/dist/semantic-certificate.d.ts +2 -191
  68. package/dist/semantic-certificate.js +15 -3
  69. package/package.json +28 -5
  70. package/runtime/lib/riddle_core_call.mjs +3 -806
  71. package/dist/chunk-5IFZSUPF.js +0 -644
  72. package/dist/chunk-DB5ZHRUP.js +0 -585
  73. package/dist/chunk-MEVVL4TI.js +0 -258
  74. package/dist/{chunk-WLUMLHII.js → chunk-BID7CKMM.js} +9 -9
  75. 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,11 +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_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,
3446
3483
  RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION: () => RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION,
3447
3484
  RIDDLE_PROOF_VISUAL_SESSION_VERSION: () => RIDDLE_PROOF_VISUAL_SESSION_VERSION,
3448
- RIDDLE_UNSUBMITTED_WAKE_HINT: () => RIDDLE_UNSUBMITTED_WAKE_HINT,
3449
- RiddleApiError: () => RiddleApiError,
3485
+ RIDDLE_UNSUBMITTED_WAKE_HINT: () => import_client.RIDDLE_UNSUBMITTED_WAKE_HINT,
3486
+ RiddleApiError: () => import_client.RiddleApiError,
3450
3487
  appendCaptureDiagnostic: () => appendCaptureDiagnostic,
3451
3488
  appendRunEvent: () => appendRunEvent,
3452
3489
  appendStageHeartbeat: () => appendStageHeartbeat,
@@ -3460,6 +3497,7 @@ __export(index_exports, {
3460
3497
  assessBasicGameplayRoute: () => assessBasicGameplayRoute,
3461
3498
  assessPlayabilityEvidence: () => assessPlayabilityEvidence,
3462
3499
  assessRiddleProofChange: () => assessRiddleProofChange,
3500
+ assessRiddleProofCheckedMeaningClosure: () => import_checked_meaning.assessRiddleProofCheckedMeaningClosure,
3463
3501
  assessRiddleProofOrderedTrace: () => assessRiddleProofOrderedTrace,
3464
3502
  assessRiddleProofOrderedTraceSetupResults: () => assessRiddleProofOrderedTraceSetupResults,
3465
3503
  assessRiddleProofProfileArtifactCompleteness: () => assessRiddleProofProfileArtifactCompleteness,
@@ -3478,13 +3516,16 @@ __export(index_exports, {
3478
3516
  checkpointPacketIdentity: () => checkpointPacketIdentity,
3479
3517
  checkpointResponseIdentity: () => checkpointResponseIdentity,
3480
3518
  checkpointSummaryFromState: () => checkpointSummaryFromState,
3481
- collectRiddlePreviewDeployWarnings: () => collectRiddlePreviewDeployWarnings,
3519
+ collectRiddlePreviewDeployWarnings: () => import_client.collectRiddlePreviewDeployWarnings,
3482
3520
  collectRiddleProfileArtifactRefs: () => collectRiddleProfileArtifactRefs,
3483
3521
  collectRiddleProofProfileWarnings: () => collectRiddleProofProfileWarnings,
3484
3522
  compactBasicGameplayText: () => compactBasicGameplayText,
3485
3523
  compactRecord: () => compactRecord,
3486
3524
  compareVisualProofSessionFingerprint: () => compareVisualProofSessionFingerprint,
3487
- 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,
3488
3529
  createBasicGameplayCatchRecords: () => createBasicGameplayCatchRecords,
3489
3530
  createBasicGameplayCatchSummary: () => createBasicGameplayCatchSummary,
3490
3531
  createCaptureDiagnostic: () => createCaptureDiagnostic,
@@ -3494,33 +3535,45 @@ __export(index_exports, {
3494
3535
  createDisabledRiddleProofAgentAdapter: () => createDisabledRiddleProofAgentAdapter,
3495
3536
  createLocalAgentAdapter: () => createCodexExecAgentAdapter,
3496
3537
  createLocalAgentJsonRunner: () => createCodexExecJsonRunner,
3497
- createRiddleApiClient: () => createRiddleApiClient,
3538
+ createRiddleApiClient: () => import_client.createRiddleApiClient,
3498
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,
3499
3546
  createRiddleProofHandoffReceipt: () => createRiddleProofHandoffReceipt,
3500
- createRiddleProofObservationReceipt: () => createRiddleProofObservationReceipt,
3547
+ createRiddleProofObservationReceipt: () => import_receipts.createRiddleProofObservationReceipt,
3501
3548
  createRiddleProofProfileConfigurationError: () => createRiddleProofProfileConfigurationError,
3502
3549
  createRiddleProofProfileEnvironmentBlockedResult: () => createRiddleProofProfileEnvironmentBlockedResult,
3503
3550
  createRiddleProofProfileInsufficientResult: () => createRiddleProofProfileInsufficientResult,
3504
3551
  createRiddleProofRunCard: () => createRiddleProofRunCard,
3505
- createRiddleProofSemanticCertificate: () => createRiddleProofSemanticCertificate,
3552
+ createRiddleProofSemanticAtomicCertificateClosure: () => import_semantic_certificate.createRiddleProofSemanticAtomicCertificateClosure,
3553
+ createRiddleProofSemanticCertificate: () => import_semantic_certificate.createRiddleProofSemanticCertificate,
3554
+ createRiddleProofSignedCaptureBundle: () => import_grounded_evidence.createRiddleProofSignedCaptureBundle,
3506
3555
  createRunResult: () => createRunResult,
3507
3556
  createRunState: () => createRunState,
3508
3557
  createRunStatusSnapshot: () => createRunStatusSnapshot,
3509
- deployRiddlePreview: () => deployRiddlePreview,
3510
- deployRiddleStaticPreview: () => deployRiddleStaticPreview,
3558
+ deployRiddlePreview: () => import_client.deployRiddlePreview,
3559
+ deployRiddleStaticPreview: () => import_client.deployRiddleStaticPreview,
3511
3560
  deriveRiddleProofArtifactBodyAssertions: () => deriveRiddleProofArtifactBodyAssertions,
3512
- detectRiddlePreviewSource: () => detectRiddlePreviewSource,
3561
+ detectRiddlePreviewSource: () => import_client.detectRiddlePreviewSource,
3513
3562
  extractBasicGameplayEvidence: () => extractBasicGameplayEvidence,
3514
3563
  extractPlayabilityEvidence: () => extractPlayabilityEvidence,
3515
3564
  extractRiddleProofProfileResult: () => extractRiddleProofProfileResult,
3516
- getRiddleBalance: () => getRiddleBalance,
3565
+ getRiddleBalance: () => import_client.getRiddleBalance,
3566
+ getRiddleJobArtifacts: () => import_client.getRiddleJobArtifacts,
3517
3567
  isDuplicateCheckpointResponse: () => isDuplicateCheckpointResponse,
3518
3568
  isProtectedFinalStatus: () => isProtectedFinalStatus,
3519
3569
  isRiddleProofPlayabilityMode: () => isRiddleProofPlayabilityMode,
3520
3570
  isSuccessfulStatus: () => isSuccessfulStatus,
3521
- isTerminalRiddleJobStatus: () => isTerminalRiddleJobStatus,
3571
+ isTerminalRiddleJobStatus: () => import_client.isTerminalRiddleJobStatus,
3522
3572
  isTerminalStatus: () => isTerminalStatus,
3523
- matchRiddleProofSemanticCertificate: () => matchRiddleProofSemanticCertificate,
3573
+ matchRiddleProofCheckedMeaningClosure: () => import_checked_meaning.matchRiddleProofCheckedMeaningClosure,
3574
+ matchRiddleProofGroundedSemanticCertificateClosure: () => import_grounded_evidence.matchRiddleProofGroundedSemanticCertificateClosure,
3575
+ matchRiddleProofSemanticCertificate: () => import_semantic_certificate.matchRiddleProofSemanticCertificate,
3576
+ matchRiddleProofSemanticCertificateClosure: () => import_semantic_certificate.matchRiddleProofSemanticCertificateClosure,
3524
3577
  migrateRiddleProofChangeReceipt: () => migrateRiddleProofChangeReceipt,
3525
3578
  nonEmptyString: () => nonEmptyString,
3526
3579
  normalizeCheckpointResponse: () => normalizeCheckpointResponse,
@@ -3529,14 +3582,14 @@ __export(index_exports, {
3529
3582
  normalizeRiddleProofProfile: () => normalizeRiddleProofProfile,
3530
3583
  normalizeRunParams: () => normalizeRunParams,
3531
3584
  normalizeTerminalMetadata: () => normalizeTerminalMetadata,
3532
- parseRiddlePreviewReceipt: () => parseRiddlePreviewReceipt,
3585
+ parseRiddlePreviewReceipt: () => import_receipts.parseRiddlePreviewReceipt,
3533
3586
  parseRiddleProofChangeReceipt: () => parseRiddleProofChangeReceipt,
3534
3587
  parseRiddleProofHandoffReceipt: () => parseRiddleProofHandoffReceipt,
3535
- parseRiddleProofObservationReceipt: () => parseRiddleProofObservationReceipt,
3536
- parseRiddleProofSemanticCertificate: () => parseRiddleProofSemanticCertificate,
3537
- parseRiddleViewport: () => parseRiddleViewport,
3588
+ parseRiddleProofObservationReceipt: () => import_receipts.parseRiddleProofObservationReceipt,
3589
+ parseRiddleProofSemanticCertificate: () => import_semantic_certificate.parseRiddleProofSemanticCertificate,
3590
+ parseRiddleViewport: () => import_client.parseRiddleViewport,
3538
3591
  parseVisualProofSession: () => parseVisualProofSession,
3539
- pollRiddleJob: () => pollRiddleJob,
3592
+ pollRiddleJob: () => import_client.pollRiddleJob,
3540
3593
  preflightRiddleProofProfileHttpStatusChecks: () => preflightRiddleProofProfileHttpStatusChecks,
3541
3594
  preflightRiddleProofProfileRunnerArtifacts: () => preflightRiddleProofProfileRunnerArtifacts,
3542
3595
  profileStatusExitCode: () => profileStatusExitCode,
@@ -3546,9 +3599,11 @@ __export(index_exports, {
3546
3599
  readRiddleProofRunStatus: () => readRiddleProofRunStatus,
3547
3600
  recordValue: () => recordValue,
3548
3601
  redactForProofDiagnostics: () => redactForProofDiagnostics,
3602
+ replayRiddleProofCheckedMeaningClosure: () => import_checked_meaning.replayRiddleProofCheckedMeaningClosure,
3603
+ replayRiddleProofGroundedSemanticCertificate: () => import_grounded_evidence.replayRiddleProofGroundedSemanticCertificate,
3549
3604
  resolveBasicGameplayProgressionCheckWithArtifactScreenshots: () => resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
3550
- resolveRiddleApiKey: () => resolveRiddleApiKey,
3551
- resolveRiddleApiKeySource: () => resolveRiddleApiKeySource,
3605
+ resolveRiddleApiKey: () => import_client.resolveRiddleApiKey,
3606
+ resolveRiddleApiKeySource: () => import_client.resolveRiddleApiKeySource,
3552
3607
  resolveRiddleProofProfileRouteUrl: () => resolveRiddleProofProfileRouteUrl,
3553
3608
  resolveRiddleProofProfileTargetUrl: () => resolveRiddleProofProfileTargetUrl,
3554
3609
  resolveRiddleProofProfileTimeoutSec: () => resolveRiddleProofProfileTimeoutSec,
@@ -3557,14 +3612,14 @@ __export(index_exports, {
3557
3612
  riddleProofPublicStateAllowsClaim: () => riddleProofPublicStateAllowsClaim,
3558
3613
  riddleProofPublicStateAllowsMergeRecommendation: () => riddleProofPublicStateAllowsMergeRecommendation,
3559
3614
  riddleProofPublicStateMergeRecommendation: () => riddleProofPublicStateMergeRecommendation,
3560
- riddleProofSemanticScopesEqual: () => riddleProofSemanticScopesEqual,
3561
- riddleRequestJson: () => riddleRequestJson,
3615
+ riddleProofSemanticScopesEqual: () => import_semantic_certificate.riddleProofSemanticScopesEqual,
3616
+ riddleRequestJson: () => import_client.riddleRequestJson,
3562
3617
  runCodexExecAgentDoctor: () => runCodexExecAgentDoctor,
3563
3618
  runLocalAgentDoctor: () => runCodexExecAgentDoctor,
3564
3619
  runRiddleProof: () => runRiddleProof,
3565
3620
  runRiddleProofEngineHarness: () => runRiddleProofEngineHarness,
3566
- runRiddleScript: () => runRiddleScript,
3567
- runRiddleServerPreview: () => runRiddleServerPreview,
3621
+ runRiddleScript: () => import_client.runRiddleScript,
3622
+ runRiddleServerPreview: () => import_client.runRiddleServerPreview,
3568
3623
  sanitizeBasicGameplayJsonString: () => sanitizeBasicGameplayJsonString,
3569
3624
  setRunStatus: () => setRunStatus,
3570
3625
  shipControlStateFor: () => shipControlStateFor,
@@ -3578,6 +3633,10 @@ __export(index_exports, {
3578
3633
  summarizeRiddleProofProfileResult: () => summarizeRiddleProofProfileResult,
3579
3634
  summarizeRiddleProofPublicConsumerSurface: () => summarizeRiddleProofPublicConsumerSurface,
3580
3635
  summarizeRiddleProofPublicState: () => summarizeRiddleProofPublicState,
3636
+ validateRiddleProofCheckedMeaningClosure: () => import_checked_meaning.validateRiddleProofCheckedMeaningClosure,
3637
+ validateRiddleProofGroundedSemanticCertificateClosure: () => import_grounded_evidence.validateRiddleProofGroundedSemanticCertificateClosure,
3638
+ validateRiddleProofSemanticCertificateClosure: () => import_semantic_certificate.validateRiddleProofSemanticCertificateClosure,
3639
+ verifyRiddleProofSignedCaptureBundle: () => import_grounded_evidence.verifyRiddleProofSignedCaptureBundle,
3581
3640
  visualSessionFingerprint: () => visualSessionFingerprint,
3582
3641
  visualSessionFingerprintBasis: () => visualSessionFingerprintBasis
3583
3642
  });
@@ -10516,8 +10575,8 @@ function jsonContains(observed, expected) {
10516
10575
  }
10517
10576
  return false;
10518
10577
  }
10519
- function parseJsonPathSegments(path6) {
10520
- let input = path6.trim();
10578
+ function parseJsonPathSegments(path5) {
10579
+ let input = path5.trim();
10521
10580
  if (!input) throw new Error("path is empty");
10522
10581
  if (input === "$") return [];
10523
10582
  if (input.startsWith("$.")) input = input.slice(2);
@@ -10557,10 +10616,10 @@ function parseJsonPathSegments(path6) {
10557
10616
  pushToken();
10558
10617
  return segments;
10559
10618
  }
10560
- function resolveJsonPath(root, path6) {
10619
+ function resolveJsonPath(root, path5) {
10561
10620
  let segments;
10562
10621
  try {
10563
- segments = parseJsonPathSegments(path6);
10622
+ segments = parseJsonPathSegments(path5);
10564
10623
  } catch (error) {
10565
10624
  return { exists: false, error: String(error instanceof Error ? error.message : error) };
10566
10625
  }
@@ -10594,7 +10653,7 @@ function assessRiddleProofOrderedTrace(trace, events) {
10594
10653
  missing_paths: missingPaths,
10595
10654
  reason
10596
10655
  });
10597
- const parsePath = (path6) => {
10656
+ const parsePath = (path5) => {
10598
10657
  const segments = [];
10599
10658
  let token = "";
10600
10659
  const pushToken = () => {
@@ -10602,8 +10661,8 @@ function assessRiddleProofOrderedTrace(trace, events) {
10602
10661
  if (value) segments.push(value);
10603
10662
  token = "";
10604
10663
  };
10605
- for (let index = 0; index < path6.length; index += 1) {
10606
- const char = path6[index];
10664
+ for (let index = 0; index < path5.length; index += 1) {
10665
+ const char = path5[index];
10607
10666
  if (char === ".") {
10608
10667
  pushToken();
10609
10668
  continue;
@@ -10613,9 +10672,9 @@ function assessRiddleProofOrderedTrace(trace, events) {
10613
10672
  continue;
10614
10673
  }
10615
10674
  pushToken();
10616
- const closeIndex = path6.indexOf("]", index + 1);
10675
+ const closeIndex = path5.indexOf("]", index + 1);
10617
10676
  if (closeIndex === -1) throw new Error(`unterminated bracket at ${index}`);
10618
- const bracket = path6.slice(index + 1, closeIndex).trim();
10677
+ const bracket = path5.slice(index + 1, closeIndex).trim();
10619
10678
  if (!bracket) throw new Error(`empty bracket at ${index}`);
10620
10679
  if (/^\d+$/.test(bracket)) {
10621
10680
  segments.push(Number(bracket));
@@ -10627,10 +10686,10 @@ function assessRiddleProofOrderedTrace(trace, events) {
10627
10686
  pushToken();
10628
10687
  return segments;
10629
10688
  };
10630
- const resolve = (root, path6) => {
10689
+ const resolve = (root, path5) => {
10631
10690
  let segments;
10632
10691
  try {
10633
- segments = parsePath(path6);
10692
+ segments = parsePath(path5);
10634
10693
  } catch {
10635
10694
  return { exists: false };
10636
10695
  }
@@ -10926,15 +10985,15 @@ function profileSetupReturnSummaryFields(result) {
10926
10985
  const fields = [];
10927
10986
  for (const item of input) {
10928
10987
  if (typeof item === "string") {
10929
- const path7 = item.trim();
10930
- if (path7) fields.push({ path: path7 });
10988
+ const path6 = item.trim();
10989
+ if (path6) fields.push({ path: path6 });
10931
10990
  continue;
10932
10991
  }
10933
10992
  if (!isRecord2(item)) continue;
10934
- const path6 = stringValue6(item.path) ?? stringValue6(item.key) ?? stringValue6(item.json_path) ?? stringValue6(item.jsonPath);
10935
- if (!path6) continue;
10993
+ const path5 = stringValue6(item.path) ?? stringValue6(item.key) ?? stringValue6(item.json_path) ?? stringValue6(item.jsonPath);
10994
+ if (!path5) continue;
10936
10995
  const label = stringValue6(item.label) ?? stringValue6(item.name) ?? stringValue6(item.title);
10937
- fields.push(label ? { path: path6, label } : { path: path6 });
10996
+ fields.push(label ? { path: path5, label } : { path: path5 });
10938
10997
  }
10939
10998
  return fields;
10940
10999
  }
@@ -11392,17 +11451,17 @@ function normalizeReturnSummaryFields(input, index) {
11392
11451
  }
11393
11452
  return fieldsInput.map((field, fieldIndex) => {
11394
11453
  if (typeof field === "string") {
11395
- const path7 = field.trim();
11396
- if (!path7) throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] requires path.`);
11397
- 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 };
11398
11457
  }
11399
11458
  if (!isRecord2(field)) {
11400
11459
  throw new Error(`target.setup_actions[${index}].return_summary_fields[${fieldIndex}] must be a string path or object.`);
11401
11460
  }
11402
- const path6 = stringFromOwn(field, "path", "key", "json_path", "jsonPath");
11403
- 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.`);
11404
11463
  const label = stringFromOwn(field, "label", "name", "title");
11405
- return label ? { path: path6, label } : { path: path6 };
11464
+ return label ? { path: path5, label } : { path: path5 };
11406
11465
  });
11407
11466
  }
11408
11467
  function normalizeSetupActionRepeat(input, index) {
@@ -11617,8 +11676,8 @@ function normalizeSetupAction(input, index) {
11617
11676
  if ((type === "local_storage" || type === "session_storage") && value === void 0 && !hasJsonValue) {
11618
11677
  throw new Error(`target.setup_actions[${index}] ${type} requires value.`);
11619
11678
  }
11620
- const path6 = stringFromOwn(input, "path", "function_path", "functionPath", "window_path", "windowPath", "state_path", "statePath");
11621
- 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) {
11622
11681
  throw new Error(`target.setup_actions[${index}] ${type} requires path.`);
11623
11682
  }
11624
11683
  const script = stringFromOwn(input, "script", "code", "source", "body");
@@ -11716,7 +11775,7 @@ function normalizeSetupAction(input, index) {
11716
11775
  restore: deterministicRestore || void 0,
11717
11776
  label: stringFromOwn(input, "label", "name", "screenshot_label", "screenshotLabel"),
11718
11777
  script,
11719
- path: path6,
11778
+ path: path5,
11720
11779
  args,
11721
11780
  expect_return: hasExpectedReturn ? toJsonValue(valueFromOwn(input, "expect_return", "expectReturn", "expected_return", "expectedReturn")) : void 0,
11722
11781
  store_return_to: storeReturnTo,
@@ -12042,10 +12101,10 @@ function collectRiddleProofProfileEnvironmentBlockedWarnings(profile, blocker) {
12042
12101
  return warnings;
12043
12102
  }
12044
12103
  function normalizeRouteInventoryPath(value, label) {
12045
- const path6 = stringValue6(value);
12046
- if (!path6) throw new Error(`${label} requires path.`);
12047
- if (!path6.startsWith("/")) throw new Error(`${label}.path must start with /.`);
12048
- 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);
12049
12108
  }
12050
12109
  function normalizeRouteInventoryRoute(input, index) {
12051
12110
  if (typeof input === "string") return { path: normalizeRouteInventoryPath(input, `checks route_inventory expected_routes[${index}]`) };
@@ -12124,16 +12183,16 @@ function normalizeHttpStatusBodyJsonAssertions(value, label) {
12124
12183
  return value.map((item, index) => {
12125
12184
  const itemLabel = `${label}[${index}]`;
12126
12185
  if (typeof item === "string") {
12127
- const path7 = stringValue6(item);
12128
- if (!path7) throw new Error(`${itemLabel} path must not be empty.`);
12129
- 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 };
12130
12189
  }
12131
12190
  if (!isRecord2(item)) throw new Error(`${itemLabel} must be an object or JSON path string.`);
12132
- const path6 = stringFromOwn(item, "path", "json_path", "jsonPath", "key");
12133
- 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.`);
12134
12193
  const assertion = {
12135
12194
  label: stringValue6(item.label),
12136
- path: path6
12195
+ path: path5
12137
12196
  };
12138
12197
  const exists = booleanValue2(valueFromOwn(item, "exists", "present"));
12139
12198
  if (exists !== void 0) assertion.exists = exists;
@@ -12183,8 +12242,8 @@ function normalizeOrderedTraceEvents(value, label) {
12183
12242
  const predicates = predicatesInput.map((predicateInput, predicateIndex) => {
12184
12243
  const predicateLabel = `${eventLabel}.predicates[${predicateIndex}]`;
12185
12244
  if (!isRecord2(predicateInput)) throw new Error(`${predicateLabel} must be an object.`);
12186
- const path6 = stringFromOwn(predicateInput, "path", "field", "key");
12187
- 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.`);
12188
12247
  const op = stringFromOwn(predicateInput, "op", "operator");
12189
12248
  if (!op || !RIDDLE_PROOF_ORDERED_TRACE_OPERATORS.includes(op)) {
12190
12249
  throw new Error(`${predicateLabel}.op must be one of ${RIDDLE_PROOF_ORDERED_TRACE_OPERATORS.join(", ")}.`);
@@ -12202,7 +12261,7 @@ function normalizeOrderedTraceEvents(value, label) {
12202
12261
  }
12203
12262
  }
12204
12263
  return {
12205
- path: path6,
12264
+ path: path5,
12206
12265
  op,
12207
12266
  value: requiresValue ? toJsonValue(value2) : void 0
12208
12267
  };
@@ -12970,7 +13029,7 @@ function summarizeRouteInventory(viewport, inventory) {
12970
13029
  const sourceCandidateCount = numberValue4(inventory.source_candidate_count);
12971
13030
  const sourceCandidateUniqueLinkCount = numberValue4(inventory.source_candidate_unique_link_count);
12972
13031
  const sourceLinkScope = stringValue6(inventory.source_link_scope);
12973
- 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)) : [];
12974
13033
  const duplicateSourceLinkCount = numberValue4(inventory.duplicate_source_link_count) ?? (sourceLinkCount !== null && sourceUniqueLinkCount !== null ? Math.max(0, sourceLinkCount - sourceUniqueLinkCount) : null);
12975
13034
  const failures = Array.isArray(inventory.failures) ? inventory.failures : [];
12976
13035
  return {
@@ -12991,14 +13050,14 @@ function routeInventoryExpectedRouteSummaries(value, fallback) {
12991
13050
  const rawRoutes = Array.isArray(value) ? value : Array.isArray(fallback) ? fallback : [];
12992
13051
  return rawRoutes.map((route) => {
12993
13052
  if (typeof route === "string") {
12994
- const path7 = route.trim();
12995
- return path7 ? { path: path7 } : void 0;
13053
+ const path6 = route.trim();
13054
+ return path6 ? { path: path6 } : void 0;
12996
13055
  }
12997
13056
  if (!isRecord2(route)) return void 0;
12998
- const path6 = stringValue6(route.path);
12999
- if (!path6) return void 0;
13057
+ const path5 = stringValue6(route.path);
13058
+ if (!path5) return void 0;
13000
13059
  const name = stringValue6(route.name);
13001
- return name ? { name, path: path6 } : { path: path6 };
13060
+ return name ? { name, path: path5 } : { path: path5 };
13002
13061
  }).filter((route) => Boolean(route));
13003
13062
  }
13004
13063
  function matchText(sample, check) {
@@ -13135,8 +13194,8 @@ function expectedFailedNetworkMockConsoleEventSummary(event, evidence) {
13135
13194
  text: isRecord2(event) && typeof event.text === "string" ? event.text.slice(0, 300) : sample.slice(0, 300)
13136
13195
  };
13137
13196
  }
13138
- function normalizeRoutePath2(path6) {
13139
- const value = path6 || "/";
13197
+ function normalizeRoutePath2(path5) {
13198
+ const value = path5 || "/";
13140
13199
  if (value === "/") return "/";
13141
13200
  return value.replace(/\/+$/, "") || "/";
13142
13201
  }
@@ -13702,7 +13761,7 @@ function assessCheckFromEvidence(check, evidence) {
13702
13761
  const sourceCandidateCount = numberValue4(first?.source_candidate_count);
13703
13762
  const sourceCandidateUniqueLinkCount = numberValue4(first?.source_candidate_unique_link_count);
13704
13763
  const sourceLinkScope = stringValue6(first?.source_link_scope);
13705
- 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)) : [];
13706
13765
  const duplicateSourceLinkCount = numberValue4(first?.duplicate_source_link_count) ?? (sourceLinkCount !== null && sourceUniqueLinkCount !== null ? Math.max(0, sourceLinkCount - sourceUniqueLinkCount) : null);
13707
13766
  const expectedRoutes = routeInventoryExpectedRouteSummaries(first?.expected_routes, check.expected_routes);
13708
13767
  return {
@@ -20066,16 +20125,16 @@ function collectRiddleProfileArtifactRefs(input) {
20066
20125
  function add(item, source) {
20067
20126
  if (!isRecord2(item)) return;
20068
20127
  const url = stringValue6(item.url);
20069
- const path6 = stringValue6(item.path);
20070
- 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) || "";
20071
20130
  const name = normalizeRiddleProfileArtifactName(rawName);
20072
- if (!name && !url && !path6) return;
20073
- const key = profileArtifactDedupeKey(name, url || path6 || "");
20131
+ if (!name && !url && !path5) return;
20132
+ const key = profileArtifactDedupeKey(name, url || path5 || "");
20074
20133
  const priority = profileArtifactPriority(rawName, name);
20075
20134
  const ref = {
20076
20135
  name,
20077
20136
  url,
20078
- path: path6,
20137
+ path: path5,
20079
20138
  kind: stringValue6(item.kind) || stringValue6(item.type),
20080
20139
  content_type: stringValue6(item.content_type) || stringValue6(item.contentType),
20081
20140
  source
@@ -20322,832 +20381,111 @@ function suggestRiddleProofProfileChecks(input) {
20322
20381
  }
20323
20382
 
20324
20383
  // src/receipts.ts
20325
- var RIDDLE_PREVIEW_RECEIPT_VERSION = "riddle.preview-receipt.v1";
20326
- var RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION = "riddle-proof.observation-receipt.v1";
20327
- function isRecord3(value) {
20328
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
20329
- }
20330
- function requiredString(record, key, context) {
20331
- const value = record[key];
20332
- if (typeof value !== "string" || !value.trim()) {
20333
- throw new Error(`${context}.${key} must be a non-empty string.`);
20334
- }
20335
- return value.trim();
20336
- }
20337
- function normalizedSourceIdentity(value) {
20338
- if (!isRecord3(value)) return {};
20339
- return {
20340
- git_revision: typeof value.git_revision === "string" && value.git_revision.trim() ? value.git_revision.trim() : void 0,
20341
- repository: typeof value.repository === "string" && value.repository.trim() ? value.repository.trim() : void 0,
20342
- dirty: typeof value.dirty === "boolean" ? value.dirty : void 0,
20343
- label: typeof value.label === "string" && value.label.trim() ? value.label.trim() : void 0
20344
- };
20345
- }
20346
- function parseRiddlePreviewReceipt(value) {
20347
- if (!isRecord3(value)) throw new Error("Preview receipt must be an object.");
20348
- if (value.version !== RIDDLE_PREVIEW_RECEIPT_VERSION) {
20349
- throw new Error(`Unsupported Preview receipt version ${String(value.version || "missing")}.`);
20350
- }
20351
- if (!isRecord3(value.source)) throw new Error("Preview receipt source must be an object.");
20352
- const expiresAt = requiredString(value, "expires_at", "preview receipt");
20353
- const publishedAt = requiredString(value, "published_at", "preview receipt");
20354
- const contentDigest = requiredString(value, "content_digest", "preview receipt");
20355
- if (!contentDigest.startsWith("sha256:") || contentDigest.length <= "sha256:".length) {
20356
- throw new Error("preview receipt.content_digest must be a sha256 digest.");
20357
- }
20358
- if (!Number.isFinite(Date.parse(expiresAt)) || !Number.isFinite(Date.parse(publishedAt))) {
20359
- throw new Error("Preview receipt timestamps must be valid ISO date strings.");
20360
- }
20361
- return {
20362
- version: RIDDLE_PREVIEW_RECEIPT_VERSION,
20363
- preview_id: requiredString(value, "preview_id", "preview receipt"),
20364
- url: requiredString(value, "url", "preview receipt"),
20365
- expires_at: expiresAt,
20366
- content_digest: contentDigest,
20367
- source: normalizedSourceIdentity(value.source),
20368
- published_at: publishedAt
20369
- };
20370
- }
20371
- function comparableArtifactName(value) {
20372
- return (value || "").split(/[/?#]/).pop()?.toLowerCase().replace(/\.(png|jpe?g|gif|webp|avif|svg)$/u, "").replace(/[^a-z0-9_-]+/gu, "-").replace(/^-+|-+$/g, "") || "";
20373
- }
20374
- function artifactMatchesLabel(artifact, label) {
20375
- const expected = comparableArtifactName(label);
20376
- if (!expected) return false;
20377
- return [artifact.name, artifact.url, artifact.path].map(comparableArtifactName).some((name) => name === expected || name.endsWith(`-${expected}`));
20378
- }
20379
- function artifactLooksLikeScreenshot(ref) {
20380
- const text = [ref.name, ref.url, ref.path, ref.kind, ref.content_type].filter(Boolean).join(" ").toLowerCase();
20381
- return /screenshot|\bimage\b/.test(text) || /\.(png|jpe?g|gif|webp|avif|svg)(\?|#|$)/.test(text);
20382
- }
20383
- function finalScreenshotLabels(result) {
20384
- const explicit = result.artifacts.canonical_screenshots || [];
20385
- if (explicit.length) return explicit;
20386
- const fromEvidence = (result.evidence?.viewports || []).map((viewport) => viewport.screenshot_label).filter((label) => typeof label === "string" && Boolean(label.trim()));
20387
- if (fromEvidence.length) return fromEvidence;
20388
- return (result.artifacts.screenshots || []).slice(0, 1);
20389
- }
20390
- function setupScreenshotLabels(result) {
20391
- const explicit = result.artifacts.setup_screenshots || [];
20392
- if (explicit.length) return explicit;
20393
- return (result.evidence?.viewports || []).flatMap(
20394
- (viewport) => (viewport.setup_action_results || []).filter((action) => action.action === "screenshot" && action.ok !== false && typeof action.screenshot_label === "string").map((action) => String(action.screenshot_label))
20395
- );
20396
- }
20397
- function observationArtifactFromRef(ref, canonicalLabels, setupLabels) {
20398
- const base = {
20399
- name: ref.name,
20400
- role: ref.role || "artifact",
20401
- url: ref.url,
20402
- path: ref.path,
20403
- kind: ref.kind,
20404
- content_type: ref.content_type,
20405
- source: ref.source
20406
- };
20407
- if (!artifactLooksLikeScreenshot(ref)) return base;
20408
- if (canonicalLabels.some((label) => artifactMatchesLabel(base, label))) {
20409
- return { ...base, role: "canonical_screenshot" };
20410
- }
20411
- if (setupLabels.some((label) => artifactMatchesLabel(base, label))) {
20412
- return { ...base, role: "setup_screenshot" };
20413
- }
20414
- return { ...base, role: "diagnostic" };
20415
- }
20416
- function profileObservationArtifacts(result) {
20417
- const canonicalLabels = finalScreenshotLabels(result);
20418
- const setupLabels = setupScreenshotLabels(result);
20419
- const artifacts = [];
20420
- const seen = /* @__PURE__ */ new Set();
20421
- const add = (artifact) => {
20422
- const key = artifact.url || artifact.path || `${artifact.role}:${artifact.name}`;
20423
- if (!artifact.name || seen.has(key)) return;
20424
- seen.add(key);
20425
- artifacts.push(artifact);
20426
- };
20427
- for (const ref of result.artifacts.riddle_artifacts || []) {
20428
- add(observationArtifactFromRef(ref, canonicalLabels, setupLabels));
20429
- }
20430
- for (const label of canonicalLabels) {
20431
- if (!artifacts.some((artifact) => artifactMatchesLabel(artifact, label))) {
20432
- add({ name: label, path: label, role: "canonical_screenshot", kind: "image" });
20433
- }
20434
- }
20435
- for (const label of setupLabels) {
20436
- if (!artifacts.some((artifact) => artifactMatchesLabel(artifact, label))) {
20437
- add({ name: label, path: label, role: "setup_screenshot", kind: "image" });
20438
- }
20439
- }
20440
- for (const label of result.artifacts.screenshots || []) {
20441
- if (!artifacts.some((artifact) => artifactMatchesLabel(artifact, label))) {
20442
- add({ name: label, path: label, role: "diagnostic", kind: "image" });
20443
- }
20444
- }
20445
- return artifacts;
20446
- }
20447
- function mergeObservationArtifacts(profileArtifacts, suppliedArtifacts) {
20448
- const artifacts = [...profileArtifacts];
20449
- for (const supplied of suppliedArtifacts) {
20450
- const suppliedNames = [supplied.name, supplied.url, supplied.path].map(comparableArtifactName).filter(Boolean);
20451
- const existingIndex = artifacts.findIndex((artifact) => {
20452
- if (supplied.url && artifact.url === supplied.url) return true;
20453
- if (supplied.path && artifact.path === supplied.path) return true;
20454
- return [artifact.name, artifact.url, artifact.path].map(comparableArtifactName).some((name) => name && suppliedNames.includes(name));
20455
- });
20456
- if (existingIndex < 0) {
20457
- artifacts.push(supplied);
20458
- continue;
20459
- }
20460
- const existing = artifacts[existingIndex];
20461
- 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;
20462
- artifacts[existingIndex] = {
20463
- ...existing,
20464
- ...supplied,
20465
- role
20466
- };
20467
- }
20468
- return artifacts;
20469
- }
20470
- function defaultObservationId(role, capturedAt) {
20471
- return `obs_${role}_${capturedAt.replace(/[^0-9]/g, "").slice(0, 17) || "unknown"}`;
20472
- }
20473
- function profileCheckCounts(result) {
20474
- const counts = { total: result.checks.length, passed: 0, failed: 0, skipped: 0, needs_human_review: 0 };
20475
- for (const check of result.checks) {
20476
- if (check.status === "passed") counts.passed += 1;
20477
- if (check.status === "failed") counts.failed += 1;
20478
- if (check.status === "skipped") counts.skipped += 1;
20479
- if (check.status === "needs_human_review") counts.needs_human_review += 1;
20480
- }
20481
- return counts;
20482
- }
20483
- function createRiddleProofObservationReceipt(input) {
20484
- const capturedAt = input.captured_at || input.profile_result?.captured_at || (/* @__PURE__ */ new Date()).toISOString();
20485
- const profileArtifacts = input.profile_result ? profileObservationArtifacts(input.profile_result) : [];
20486
- const requestedCanonical = input.canonical_screenshot ? { ...input.canonical_screenshot, role: "canonical_screenshot" } : void 0;
20487
- const artifacts = mergeObservationArtifacts(
20488
- profileArtifacts,
20489
- [...input.artifacts || [], ...requestedCanonical ? [requestedCanonical] : []]
20490
- );
20491
- const canonicalScreenshot = requestedCanonical ? artifacts.find((artifact) => artifact.role === "canonical_screenshot" && artifactMatchesLabel(artifact, requestedCanonical.name)) || requestedCanonical : artifacts.find((artifact) => artifact.role === "canonical_screenshot");
20492
- const target = input.target.kind === "preview" && input.target.preview ? { ...input.target, preview: parseRiddlePreviewReceipt(input.target.preview) } : input.target;
20493
- return {
20494
- version: RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
20495
- observation_id: input.observation_id || defaultObservationId(input.comparison_role, capturedAt),
20496
- comparison_role: input.comparison_role,
20497
- executor: input.executor,
20498
- target,
20499
- source: normalizedSourceIdentity(input.source || input.target.preview?.source),
20500
- captured_at: capturedAt,
20501
- artifacts,
20502
- canonical_screenshot: canonicalScreenshot,
20503
- profile_summary: input.profile_result ? {
20504
- profile_name: input.profile_result.profile_name,
20505
- status: input.profile_result.status,
20506
- summary: input.profile_result.summary,
20507
- route: input.profile_result.route,
20508
- checks: profileCheckCounts(input.profile_result)
20509
- } : void 0,
20510
- proof: input.profile_result ? {
20511
- profile_name: input.profile_result.profile_name,
20512
- result: input.profile_result
20513
- } : void 0,
20514
- publication: input.publication,
20515
- execution: input.execution,
20516
- metadata: input.metadata
20517
- };
20518
- }
20519
- function parseRiddleProofObservationReceipt(value) {
20520
- if (!isRecord3(value)) throw new Error("Observation receipt must be an object.");
20521
- if (value.version !== RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION) {
20522
- throw new Error(`Unsupported Observation receipt version ${String(value.version || "missing")}.`);
20523
- }
20524
- if (!isRecord3(value.executor)) throw new Error("Observation receipt executor must be an object.");
20525
- if (!isRecord3(value.target)) throw new Error("Observation receipt target must be an object.");
20526
- if (!isRecord3(value.source)) throw new Error("Observation receipt source must be an object.");
20527
- requiredString(value, "observation_id", "observation receipt");
20528
- requiredString(value, "captured_at", "observation receipt");
20529
- const executorKind = requiredString(value.executor, "kind", "observation receipt executor");
20530
- if (!"local_playwright,riddle_hosted,browser_api,other".split(",").includes(executorKind)) {
20531
- throw new Error(`Unsupported observation executor kind ${executorKind}.`);
20532
- }
20533
- if (value.executor.runner !== void 0) {
20534
- requiredString(value.executor, "runner", "observation receipt executor");
20535
- }
20536
- const role = requiredString(value, "comparison_role", "observation receipt");
20537
- if (!["before", "after", "standalone"].includes(role)) {
20538
- throw new Error(`Unsupported observation comparison role ${role}.`);
20539
- }
20540
- const targetKind = requiredString(value.target, "kind", "observation receipt target");
20541
- if (targetKind !== "url" && targetKind !== "preview") {
20542
- throw new Error(`Unsupported observation target kind ${targetKind}.`);
20543
- }
20544
- requiredString(value.target, "url", "observation receipt target");
20545
- if (targetKind === "preview") {
20546
- if (value.target.preview === void 0) {
20547
- throw new Error("Preview Observation target must include its Preview receipt.");
20548
- }
20549
- parseRiddlePreviewReceipt(value.target.preview);
20550
- }
20551
- if (!Array.isArray(value.artifacts)) throw new Error("Observation receipt artifacts must be an array.");
20552
- const artifactRoles = /* @__PURE__ */ new Set(["canonical_screenshot", "setup_screenshot", "data", "diagnostic", "artifact"]);
20553
- const artifacts = value.artifacts.map((artifact, index) => {
20554
- if (!isRecord3(artifact)) throw new Error(`Observation receipt artifact ${index} must be an object.`);
20555
- requiredString(artifact, "name", `observation receipt artifact ${index}`);
20556
- const artifactRole = requiredString(artifact, "role", `observation receipt artifact ${index}`);
20557
- if (!artifactRoles.has(artifactRole)) {
20558
- throw new Error(`Unsupported observation artifact role ${artifactRole}.`);
20559
- }
20560
- return artifact;
20561
- });
20562
- if (value.canonical_screenshot !== void 0) {
20563
- if (!isRecord3(value.canonical_screenshot) || value.canonical_screenshot.role !== "canonical_screenshot") {
20564
- throw new Error("Observation canonical_screenshot must have the canonical_screenshot role.");
20565
- }
20566
- const canonical = value.canonical_screenshot;
20567
- const included = artifacts.some((artifact) => artifact.role === "canonical_screenshot" && artifact.name === canonical.name && artifact.url === canonical.url && artifact.path === canonical.path);
20568
- if (!included) {
20569
- throw new Error("Observation canonical_screenshot must reference an artifact in the receipt.");
20570
- }
20571
- }
20572
- return value;
20573
- }
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);
20574
20397
 
20575
20398
  // src/semantic-certificate.ts
20576
- var import_node_crypto5 = require("crypto");
20577
- var RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION = "riddle-proof.semantic-certificate.v0";
20578
- var SCOPE_FIELDS = [
20579
- "repository",
20580
- "revision",
20581
- "environment",
20582
- "target",
20583
- "proof_attempt"
20584
- ];
20585
- var AUTHORITY_FIELDS = [
20586
- "authority",
20587
- "status",
20588
- "verdict",
20589
- "ready_to_ship",
20590
- "merge_ready",
20591
- "sync_allowed",
20592
- "ship_authorized",
20593
- "shipping_authorized",
20594
- "shipping_disabled",
20595
- "merge_recommended",
20596
- "merge_recommendation",
20597
- "shipping_authorization"
20598
- ];
20599
- var CERTIFICATE_FIELDS = /* @__PURE__ */ new Set([
20600
- "version",
20601
- "certificate_id",
20602
- "scope",
20603
- "claim",
20604
- "evidence",
20605
- "derivation",
20606
- "issued_at"
20607
- ]);
20608
- function isRecord4(value) {
20609
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
20610
- }
20611
- function safeErrorMessage(error) {
20612
- try {
20613
- if (error instanceof Error) return String(error.message);
20614
- } catch {
20615
- }
20616
- try {
20617
- return String(error);
20618
- } catch {
20619
- return "unprintable thrown value";
20620
- }
20621
- }
20622
- function assertOnlyKeys(record, allowed, context) {
20623
- const allowedSet = new Set(allowed);
20624
- for (const key of Object.keys(record)) {
20625
- if (!allowedSet.has(key)) {
20626
- throw new Error(`${context} contains unsupported field ${key}.`);
20627
- }
20628
- }
20629
- }
20630
- function requiredString2(record, key, context) {
20631
- const value = record[key];
20632
- if (typeof value !== "string" || !value.trim()) {
20633
- throw new Error(`${context}.${key} must be a non-empty string.`);
20634
- }
20635
- return value.trim();
20636
- }
20637
- function optionalString(record, key, context) {
20638
- if (record[key] === void 0) return void 0;
20639
- return requiredString2(record, key, context);
20640
- }
20641
- function isJsonValue(value, ancestors = /* @__PURE__ */ new Set()) {
20642
- if (value === null || typeof value === "string" || typeof value === "boolean") {
20643
- return true;
20644
- }
20645
- if (typeof value === "number") return Number.isFinite(value);
20646
- if (Array.isArray(value)) {
20647
- if (ancestors.has(value)) return false;
20648
- ancestors.add(value);
20649
- const valid2 = value.every((entry) => isJsonValue(entry, ancestors));
20650
- ancestors.delete(value);
20651
- return valid2;
20652
- }
20653
- if (!isRecord4(value)) return false;
20654
- const prototype = Object.getPrototypeOf(value);
20655
- if (prototype !== Object.prototype && prototype !== null) return false;
20656
- if (ancestors.has(value)) return false;
20657
- ancestors.add(value);
20658
- const valid = Object.values(value).every((entry) => isJsonValue(entry, ancestors));
20659
- ancestors.delete(value);
20660
- return valid;
20661
- }
20662
- function parseJsonObject2(value, context) {
20663
- if (value === void 0) return void 0;
20664
- if (!isRecord4(value) || !isJsonValue(value)) {
20665
- throw new Error(`${context} must be a JSON object.`);
20666
- }
20667
- const cloned = JSON.parse(JSON.stringify(value));
20668
- if (!isRecord4(cloned) || !isJsonValue(cloned)) {
20669
- throw new Error(`${context} must remain a JSON object when serialized.`);
20670
- }
20671
- return cloned;
20672
- }
20673
- function parseIssuedAt(value, context) {
20674
- if (typeof value !== "string" || !value.trim() || !Number.isFinite(Date.parse(value))) {
20675
- throw new Error(`${context} must be a valid timestamp.`);
20676
- }
20677
- return value.trim();
20678
- }
20679
- function parseScope(value, context) {
20680
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20681
- assertOnlyKeys(value, SCOPE_FIELDS, context);
20682
- return {
20683
- repository: requiredString2(value, "repository", context),
20684
- revision: requiredString2(value, "revision", context),
20685
- environment: requiredString2(value, "environment", context),
20686
- target: requiredString2(value, "target", context),
20687
- proof_attempt: requiredString2(value, "proof_attempt", context)
20688
- };
20689
- }
20690
- function parseClaimRef(value, context, allowedExtras = []) {
20691
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20692
- assertOnlyKeys(value, ["claim_id", "claim_version", "parameters", ...allowedExtras], context);
20693
- const parameters = parseJsonObject2(value.parameters, `${context}.parameters`);
20694
- return {
20695
- claim_id: requiredString2(value, "claim_id", context),
20696
- claim_version: requiredString2(value, "claim_version", context),
20697
- ...parameters ? { parameters } : {}
20698
- };
20699
- }
20700
- function parseClaim(value, context) {
20701
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20702
- return {
20703
- ...parseClaimRef(value, context, ["label"]),
20704
- label: requiredString2(value, "label", context)
20705
- };
20706
- }
20707
- function parseEvidenceRef(value, context) {
20708
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20709
- assertOnlyKeys(
20710
- value,
20711
- ["receipt_id", "artifact_digest", "role", "artifact_url", "artifact_path"],
20712
- context
20713
- );
20714
- const artifactDigest = requiredString2(value, "artifact_digest", context).toLowerCase();
20715
- if (!/^sha256:[0-9a-f]{64}$/u.test(artifactDigest)) {
20716
- throw new Error(`${context}.artifact_digest must be a full sha256 digest.`);
20717
- }
20718
- const artifactUrl = optionalString(value, "artifact_url", context);
20719
- const artifactPath = optionalString(value, "artifact_path", context);
20720
- return {
20721
- receipt_id: requiredString2(value, "receipt_id", context),
20722
- artifact_digest: artifactDigest,
20723
- role: requiredString2(value, "role", context),
20724
- ...artifactUrl ? { artifact_url: artifactUrl } : {},
20725
- ...artifactPath ? { artifact_path: artifactPath } : {}
20726
- };
20727
- }
20728
- function parseEvidenceBundle(value, context) {
20729
- if (!Array.isArray(value) || value.length === 0) {
20730
- throw new Error(`${context} must contain at least one evidence reference.`);
20731
- }
20732
- return value.map((entry, index) => parseEvidenceRef(entry, `${context}[${index}]`));
20733
- }
20734
- function parseContractRef(value, context) {
20735
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20736
- return {
20737
- contract_id: requiredString2(value, "contract_id", context),
20738
- contract_version: requiredString2(value, "contract_version", context),
20739
- label: requiredString2(value, "label", context)
20740
- };
20741
- }
20742
- function parseContract(value, context, allowRuntimePredicate = false) {
20743
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20744
- assertOnlyKeys(
20745
- value,
20746
- ["contract_id", "contract_version", "label", "claim", ...allowRuntimePredicate ? ["accepts"] : []],
20747
- context
20748
- );
20749
- if (allowRuntimePredicate && typeof value.accepts !== "function") {
20750
- throw new Error(`${context}.accepts must be a function.`);
20751
- }
20752
- return {
20753
- ...parseContractRef(value, context),
20754
- claim: parseClaim(value.claim, `${context}.claim`)
20755
- };
20756
- }
20757
- function parseRule(value, context, allowFullPremises = false) {
20758
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20759
- assertOnlyKeys(value, ["rule_id", "rule_version", "label", "premises", "conclusion"], context);
20760
- if (!Array.isArray(value.premises) || value.premises.length === 0) {
20761
- throw new Error(`${context}.premises must contain at least one claim reference.`);
20762
- }
20763
- return {
20764
- rule_id: requiredString2(value, "rule_id", context),
20765
- rule_version: requiredString2(value, "rule_version", context),
20766
- label: requiredString2(value, "label", context),
20767
- premises: value.premises.map((premise, index) => parseClaimRef(
20768
- premise,
20769
- `${context}.premises[${index}]`,
20770
- allowFullPremises ? ["label"] : []
20771
- )),
20772
- conclusion: parseClaim(value.conclusion, `${context}.conclusion`)
20773
- };
20774
- }
20775
- function parsePremise(value, context) {
20776
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20777
- assertOnlyKeys(
20778
- value,
20779
- ["certificate_id", "derivation_kind", "assurance", "scope", "claim", "evidence"],
20780
- context
20781
- );
20782
- const derivationKind = requiredString2(value, "derivation_kind", context);
20783
- const assurance = requiredString2(value, "assurance", context);
20784
- const validAssurance = derivationKind === "contract" && assurance === "runtime_contract_accepted" || derivationKind === "composition" && assurance === "declared_runtime_rule";
20785
- if (!validAssurance) {
20786
- throw new Error(`${context} must preserve a valid derivation_kind and assurance pair.`);
20787
- }
20788
- return {
20789
- certificate_id: requiredString2(value, "certificate_id", context),
20790
- derivation_kind: derivationKind,
20791
- assurance,
20792
- scope: parseScope(value.scope, `${context}.scope`),
20793
- claim: parseClaim(value.claim, `${context}.claim`),
20794
- evidence: parseEvidenceBundle(value.evidence, `${context}.evidence`)
20795
- };
20796
- }
20797
- function stableJson3(value) {
20798
- if (Array.isArray(value)) return `[${value.map(stableJson3).join(",")}]`;
20799
- if (isRecord4(value)) {
20800
- return `{${Object.keys(value).filter((key) => value[key] !== void 0).sort().map((key) => `${JSON.stringify(key)}:${stableJson3(value[key])}`).join(",")}}`;
20801
- }
20802
- const encoded = JSON.stringify(value);
20803
- if (encoded === void 0) throw new Error("Semantic certificate contains a non-JSON value.");
20804
- return encoded;
20805
- }
20806
- function sameClaimRef(left, right) {
20807
- return left.claim_id === right.claim_id && left.claim_version === right.claim_version && stableJson3(left.parameters || {}) === stableJson3(right.parameters || {});
20808
- }
20809
- function sameEvidence(left, right) {
20810
- return stableJson3(left) === stableJson3(right);
20811
- }
20812
- function certificateId(body) {
20813
- const digest = (0, import_node_crypto5.createHash)("sha256").update(stableJson3(body)).digest("hex");
20814
- return `rpsc_${digest}`;
20815
- }
20816
- function withCertificateId(body) {
20817
- return { ...body, certificate_id: certificateId(body) };
20818
- }
20819
- function parseDerivation(value, context) {
20820
- if (!isRecord4(value)) throw new Error(`${context} must be an object.`);
20821
- const kind = requiredString2(value, "kind", context);
20822
- if (kind === "contract") {
20823
- assertOnlyKeys(value, ["kind", "assurance", "contract"], context);
20824
- if (value.assurance !== "runtime_contract_accepted") {
20825
- throw new Error(`${context}.assurance must be runtime_contract_accepted.`);
20826
- }
20827
- return {
20828
- kind,
20829
- assurance: "runtime_contract_accepted",
20830
- contract: parseContract(value.contract, `${context}.contract`)
20831
- };
20832
- }
20833
- if (kind === "composition") {
20834
- assertOnlyKeys(value, ["kind", "assurance", "rule", "premises"], context);
20835
- if (value.assurance !== "declared_runtime_rule") {
20836
- throw new Error(`${context}.assurance must be declared_runtime_rule.`);
20837
- }
20838
- if (!Array.isArray(value.premises) || value.premises.length === 0) {
20839
- throw new Error(`${context}.premises must contain at least one certificate premise.`);
20840
- }
20841
- return {
20842
- kind,
20843
- assurance: "declared_runtime_rule",
20844
- rule: parseRule(value.rule, `${context}.rule`),
20845
- premises: value.premises.map((premise, index) => parsePremise(premise, `${context}.premises[${index}]`))
20846
- };
20847
- }
20848
- throw new Error(`${context}.kind must be contract or composition.`);
20849
- }
20850
- function riddleProofSemanticScopesEqual(left, right) {
20851
- return SCOPE_FIELDS.every((field) => left[field] === right[field]);
20852
- }
20853
- function createRiddleProofSemanticCertificate(input) {
20854
- if (!isRecord4(input)) throw new Error("Semantic certificate input must be an object.");
20855
- assertOnlyKeys(
20856
- input,
20857
- ["scope", "evidence", "observation", "contract", "issued_at"],
20858
- "semantic certificate input"
20859
- );
20860
- const scope = parseScope(input.scope, "semantic certificate scope");
20861
- const evidence = parseEvidenceBundle(input.evidence, "semantic certificate evidence");
20862
- const contract = parseContract(input.contract, "semantic certificate contract", true);
20863
- const contractRef = {
20864
- contract_id: contract.contract_id,
20865
- contract_version: contract.contract_version,
20866
- label: contract.label
20867
- };
20868
- const claim = contract.claim;
20869
- let accepted;
20870
- try {
20871
- accepted = input.contract.accepts({ ...scope }, input.observation) === true;
20872
- } catch (error) {
20873
- return {
20874
- ok: false,
20875
- error: {
20876
- code: "contract_error",
20877
- contract: contractRef,
20878
- message: `Semantic contract evaluation failed: ${error instanceof Error ? error.message : String(error)}.`
20879
- }
20880
- };
20881
- }
20882
- if (!accepted) {
20883
- return {
20884
- ok: false,
20885
- error: {
20886
- code: "contract_rejected",
20887
- contract: contractRef,
20888
- message: "Semantic contract rejected the supplied observation at this scope."
20889
- }
20890
- };
20891
- }
20892
- const body = {
20893
- version: RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
20894
- scope,
20895
- claim,
20896
- evidence,
20897
- derivation: { kind: "contract", assurance: "runtime_contract_accepted", contract },
20898
- issued_at: parseIssuedAt(input.issued_at || (/* @__PURE__ */ new Date()).toISOString(), "semantic certificate issued_at")
20899
- };
20900
- return { ok: true, certificate: withCertificateId(body) };
20901
- }
20902
- function parseRiddleProofSemanticCertificate(value) {
20903
- if (!isRecord4(value)) throw new Error("Semantic certificate must be an object.");
20904
- if (value.version !== RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION) {
20905
- throw new Error(`Unsupported Semantic certificate version ${String(value.version || "missing")}.`);
20906
- }
20907
- for (const field of AUTHORITY_FIELDS) {
20908
- if (Object.prototype.hasOwnProperty.call(value, field)) {
20909
- throw new Error(`Semantic certificate must not contain authority field ${field}.`);
20910
- }
20911
- }
20912
- for (const field of Object.keys(value)) {
20913
- if (!CERTIFICATE_FIELDS.has(field)) {
20914
- throw new Error(`Semantic certificate contains unsupported field ${field}.`);
20915
- }
20916
- }
20917
- const scope = parseScope(value.scope, "semantic certificate scope");
20918
- const claim = parseClaim(value.claim, "semantic certificate claim");
20919
- const evidence = parseEvidenceBundle(value.evidence, "semantic certificate evidence");
20920
- const derivation = parseDerivation(value.derivation, "semantic certificate derivation");
20921
- if (derivation.kind === "contract" && !sameClaimRef(claim, derivation.contract.claim)) {
20922
- throw new Error("Semantic contract-derived claim must match its contract claim.");
20923
- }
20924
- if (derivation.kind === "composition") {
20925
- if (derivation.premises.length !== derivation.rule.premises.length) {
20926
- throw new Error("Semantic composition premises must match the rule premise count.");
20927
- }
20928
- derivation.premises.forEach((premise, index) => {
20929
- if (!riddleProofSemanticScopesEqual(scope, premise.scope)) {
20930
- throw new Error(`Semantic composition premise ${index} must have the certificate scope.`);
20931
- }
20932
- if (!sameClaimRef(premise.claim, derivation.rule.premises[index])) {
20933
- throw new Error(`Semantic composition premise ${index} must match its rule claim.`);
20934
- }
20935
- });
20936
- if (!sameClaimRef(claim, derivation.rule.conclusion)) {
20937
- throw new Error("Semantic composition claim must match its rule conclusion.");
20938
- }
20939
- const expectedEvidence = derivation.premises.flatMap((premise) => premise.evidence);
20940
- if (!sameEvidence(evidence, expectedEvidence)) {
20941
- throw new Error("Semantic composition evidence must be the ordered concatenation of premise evidence.");
20942
- }
20943
- }
20944
- const body = {
20945
- version: RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
20946
- scope,
20947
- claim,
20948
- evidence,
20949
- derivation,
20950
- issued_at: parseIssuedAt(value.issued_at, "semantic certificate issued_at")
20951
- };
20952
- const observedId = requiredString2(value, "certificate_id", "semantic certificate");
20953
- const expectedId = certificateId(body);
20954
- if (observedId !== expectedId) {
20955
- throw new Error("Semantic certificate_id must match its content.");
20956
- }
20957
- return { ...body, certificate_id: observedId };
20958
- }
20959
- function matchRiddleProofSemanticCertificate(input) {
20960
- if (!isRecord4(input)) throw new Error("Semantic certificate match input must be an object.");
20961
- assertOnlyKeys(
20962
- input,
20963
- [
20964
- "certificate",
20965
- "expected_certificate_id",
20966
- "expected_scope",
20967
- "expected_claim",
20968
- "expected_assurance"
20969
- ],
20970
- "semantic certificate match input"
20971
- );
20972
- const expectedCertificateId = requiredString2(
20973
- input,
20974
- "expected_certificate_id",
20975
- "semantic certificate match input"
20976
- );
20977
- if (!/^rpsc_[0-9a-f]{64}$/u.test(expectedCertificateId)) {
20978
- throw new Error(
20979
- "Semantic certificate match input.expected_certificate_id must be a full rpsc content ID."
20980
- );
20981
- }
20982
- const expectedScope = parseScope(
20983
- input.expected_scope,
20984
- "semantic certificate match expected_scope"
20985
- );
20986
- const expectedClaim = parseClaimRef(
20987
- input.expected_claim,
20988
- "semantic certificate match expected_claim",
20989
- ["label"]
20990
- );
20991
- const expectedAssurance = requiredString2(
20992
- input,
20993
- "expected_assurance",
20994
- "semantic certificate match input"
20995
- );
20996
- if (expectedAssurance !== "runtime_contract_accepted" && expectedAssurance !== "declared_runtime_rule") {
20997
- throw new Error(
20998
- "Semantic certificate match input.expected_assurance must be runtime_contract_accepted or declared_runtime_rule."
20999
- );
21000
- }
21001
- let certificate;
21002
- try {
21003
- certificate = parseRiddleProofSemanticCertificate(input.certificate);
21004
- } catch (error) {
21005
- return {
21006
- ok: false,
21007
- error: {
21008
- code: "invalid_certificate",
21009
- message: `Semantic certificate did not parse: ${safeErrorMessage(error)}`
21010
- }
21011
- };
21012
- }
21013
- if (certificate.certificate_id !== expectedCertificateId) {
21014
- return {
21015
- ok: false,
21016
- error: {
21017
- code: "certificate_id_mismatch",
21018
- expected: expectedCertificateId,
21019
- observed: certificate.certificate_id,
21020
- message: "Semantic certificate does not match the trusted expected content ID."
21021
- }
21022
- };
21023
- }
21024
- const scopeMismatch = firstScopeMismatch(expectedScope, certificate.scope);
21025
- if (scopeMismatch) {
21026
- return {
21027
- ok: false,
21028
- error: {
21029
- code: "scope_mismatch",
21030
- ...scopeMismatch,
21031
- message: `Semantic certificate has a different ${scopeMismatch.field} than the consumer expected.`
21032
- }
21033
- };
21034
- }
21035
- if (!sameClaimRef(expectedClaim, certificate.claim)) {
21036
- return {
21037
- ok: false,
21038
- error: {
21039
- code: "claim_mismatch",
21040
- expected: expectedClaim,
21041
- observed: parseClaimRef(
21042
- certificate.claim,
21043
- "semantic certificate match observed claim",
21044
- ["label"]
21045
- ),
21046
- message: "Semantic certificate does not state the claim the consumer expected."
21047
- }
21048
- };
21049
- }
21050
- if (certificate.derivation.assurance !== expectedAssurance) {
21051
- return {
21052
- ok: false,
21053
- error: {
21054
- code: "assurance_mismatch",
21055
- expected: expectedAssurance,
21056
- observed: certificate.derivation.assurance,
21057
- message: "Semantic certificate does not have the assurance the consumer expected."
21058
- }
21059
- };
21060
- }
21061
- return { ok: true, certificate };
21062
- }
21063
- function firstScopeMismatch(expected, observed) {
21064
- for (const field of SCOPE_FIELDS) {
21065
- if (expected[field] !== observed[field]) {
21066
- return { field, expected: expected[field], observed: observed[field] };
21067
- }
21068
- }
21069
- return void 0;
21070
- }
21071
- function premiseFromCertificate(certificate) {
21072
- return {
21073
- certificate_id: certificate.certificate_id,
21074
- derivation_kind: certificate.derivation.kind,
21075
- assurance: certificate.derivation.assurance,
21076
- scope: { ...certificate.scope },
21077
- claim: parseClaim(certificate.claim, "semantic composition premise claim"),
21078
- evidence: certificate.evidence.map((entry) => ({ ...entry }))
21079
- };
21080
- }
21081
- function composeRiddleProofSemanticCertificates(input) {
21082
- if (!isRecord4(input)) throw new Error("Semantic composition input must be an object.");
21083
- assertOnlyKeys(
21084
- input,
21085
- ["rule", "certificates", "issued_at"],
21086
- "semantic composition input"
21087
- );
21088
- const rule = parseRule(input.rule, "semantic composition rule", true);
21089
- if (!Array.isArray(input.certificates) || input.certificates.length === 0) {
21090
- throw new Error("Semantic composition requires at least one certificate.");
21091
- }
21092
- const certificates = input.certificates.map((certificate) => parseRiddleProofSemanticCertificate(certificate));
21093
- if (certificates.length !== rule.premises.length) {
21094
- return {
21095
- ok: false,
21096
- error: {
21097
- code: "premise_count_mismatch",
21098
- expected: rule.premises.length,
21099
- observed: certificates.length,
21100
- message: `Semantic rule expected ${rule.premises.length} certificate(s), received ${certificates.length}.`
21101
- }
21102
- };
21103
- }
21104
- const expectedScope = certificates[0].scope;
21105
- for (let index = 1; index < certificates.length; index += 1) {
21106
- const mismatch = firstScopeMismatch(expectedScope, certificates[index].scope);
21107
- if (mismatch) {
21108
- return {
21109
- ok: false,
21110
- error: {
21111
- code: "scope_mismatch",
21112
- input_index: index,
21113
- ...mismatch,
21114
- message: `Semantic certificate ${index} has a different ${mismatch.field}.`
21115
- }
21116
- };
21117
- }
21118
- }
21119
- for (let index = 0; index < certificates.length; index += 1) {
21120
- const expected = rule.premises[index];
21121
- const observed = certificates[index].claim;
21122
- if (!sameClaimRef(expected, observed)) {
21123
- return {
21124
- ok: false,
21125
- error: {
21126
- code: "premise_mismatch",
21127
- input_index: index,
21128
- expected,
21129
- observed: parseClaimRef(observed, "semantic composition observed claim", ["label"]),
21130
- message: `Semantic certificate ${index} does not satisfy its declared rule premise.`
21131
- }
21132
- };
21133
- }
21134
- }
21135
- const evidence = certificates.flatMap((certificate) => certificate.evidence);
21136
- const body = {
21137
- version: RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
21138
- scope: { ...expectedScope },
21139
- claim: { ...rule.conclusion },
21140
- evidence,
21141
- derivation: {
21142
- kind: "composition",
21143
- assurance: "declared_runtime_rule",
21144
- rule,
21145
- premises: certificates.map(premiseFromCertificate)
21146
- },
21147
- issued_at: parseIssuedAt(input.issued_at || (/* @__PURE__ */ new Date()).toISOString(), "semantic certificate issued_at")
21148
- };
21149
- return { ok: true, certificate: withCertificateId(body) };
21150
- }
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);
21151
20489
 
21152
20490
  // src/change-proof.ts
21153
20491
  var RIDDLE_PROOF_CHANGE_CONTRACT_VERSION = "riddle-proof.change-contract.v1";
@@ -21491,7 +20829,7 @@ function changeReceiptVerdict(status) {
21491
20829
  if (status === "proof_insufficient") return "proof_insufficient";
21492
20830
  return "not_mergeable";
21493
20831
  }
21494
- function profileCheckCounts2(result) {
20832
+ function profileCheckCounts(result) {
21495
20833
  const counts = {
21496
20834
  total: result.checks.length,
21497
20835
  passed: 0,
@@ -21564,7 +20902,7 @@ function observationExecutor(result) {
21564
20902
  function observationForReceiptSide(side, result, source, sourceIdentity) {
21565
20903
  if (!result) throw new Error(`${side}_result or ${side}_observation is required.`);
21566
20904
  if (!source) throw new Error(`${side}_source or ${side}_observation is required.`);
21567
- return createRiddleProofObservationReceipt({
20905
+ return (0, import_receipts.createRiddleProofObservationReceipt)({
21568
20906
  comparison_role: side,
21569
20907
  executor: observationExecutor(result),
21570
20908
  target: { kind: "url", url: source },
@@ -21575,8 +20913,8 @@ function observationForReceiptSide(side, result, source, sourceIdentity) {
21575
20913
  });
21576
20914
  }
21577
20915
  function createRiddleProofChangeReceipt(input) {
21578
- const before = input.before_observation ? parseRiddleProofObservationReceipt(input.before_observation) : observationForReceiptSide("before", input.before_result, input.before_source, input.before_source_identity);
21579
- 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);
21580
20918
  const verdict = changeReceiptVerdict(input.result.status);
21581
20919
  const shippingAuthorization = input.shipping_authorization || noShippingAuthorization();
21582
20920
  assertShippingAuthorizationConsistent(shippingAuthorization, "Change receipt");
@@ -21606,7 +20944,7 @@ function createRiddleProofChangeReceipt(input) {
21606
20944
  metadata: input.result.metadata
21607
20945
  };
21608
20946
  }
21609
- function isRecord5(value) {
20947
+ function isRecord3(value) {
21610
20948
  return Boolean(value) && typeof value === "object" && !Array.isArray(value);
21611
20949
  }
21612
20950
  function migratedObservationFromLegacySide(side, legacy) {
@@ -21683,7 +21021,7 @@ function migrateRiddleProofChangeReceipt(legacy) {
21683
21021
  };
21684
21022
  }
21685
21023
  function parseRiddleProofChangeReceipt(value) {
21686
- 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.");
21687
21025
  if (value.version === RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION) {
21688
21026
  return migrateRiddleProofChangeReceipt(value);
21689
21027
  }
@@ -21694,8 +21032,8 @@ function parseRiddleProofChangeReceipt(value) {
21694
21032
  if (!RIDDLE_PROOF_PROFILE_STATUSES.includes(receipt.status)) {
21695
21033
  throw new Error(`Unsupported Change receipt status ${String(receipt.status || "missing")}.`);
21696
21034
  }
21697
- parseRiddleProofObservationReceipt(receipt.before);
21698
- parseRiddleProofObservationReceipt(receipt.after);
21035
+ (0, import_receipts.parseRiddleProofObservationReceipt)(receipt.before);
21036
+ (0, import_receipts.parseRiddleProofObservationReceipt)(receipt.after);
21699
21037
  if (receipt.before.comparison_role !== "before" || receipt.after.comparison_role !== "after") {
21700
21038
  throw new Error("Change receipt observations must preserve their before and after comparison roles.");
21701
21039
  }
@@ -21727,8 +21065,8 @@ function createRiddleProofHandoffReceipt(changeReceipt, options = {}) {
21727
21065
  };
21728
21066
  }
21729
21067
  function parseRiddleProofHandoffReceipt(value) {
21730
- if (!isRecord5(value) || value.version !== RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION) {
21731
- 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")}.`);
21732
21070
  }
21733
21071
  const receipt = value;
21734
21072
  if (!Number.isFinite(Date.parse(receipt.created_at))) {
@@ -21783,7 +21121,7 @@ function receiptSideView(side, observation) {
21783
21121
  summary: summary?.summary || observation.proof?.result.summary || "No profile summary recorded.",
21784
21122
  route: summary?.route,
21785
21123
  captured_at: observation.captured_at,
21786
- checks: summary?.checks || (observation.proof ? profileCheckCounts2(observation.proof.result) : {
21124
+ checks: summary?.checks || (observation.proof ? profileCheckCounts(observation.proof.result) : {
21787
21125
  total: 0,
21788
21126
  passed: 0,
21789
21127
  failed: 0,
@@ -22013,624 +21351,7 @@ function riddleProofChangeReceiptHtml(receipt) {
22013
21351
  }
22014
21352
 
22015
21353
  // src/riddle-client.ts
22016
- var import_node_child_process4 = require("child_process");
22017
- var import_node_fs5 = require("fs");
22018
- var import_node_os2 = require("os");
22019
- var import_node_path5 = __toESM(require("path"), 1);
22020
- var DEFAULT_RIDDLE_API_BASE_URL = "https://api.riddledc.com";
22021
- var DEFAULT_RIDDLE_API_KEY_FILE = "/tmp/riddle-api-key";
22022
- var RIDDLE_UNSUBMITTED_WAKE_HINT = "hosted worker may still be waking or waiting for a lease";
22023
- var RiddleApiError = class extends Error {
22024
- constructor(pathname, status, body) {
22025
- super(`Riddle API ${pathname} failed HTTP ${status}: ${body}`);
22026
- this.name = "RiddleApiError";
22027
- this.status = status;
22028
- this.body = body;
22029
- this.path = pathname;
22030
- }
22031
- };
22032
- var PREVIEW_PUBLISH_RECOVERY_STATUSES = /* @__PURE__ */ new Set([408, 429, 500, 502, 503, 504]);
22033
- var PREVIEW_PUBLISH_RECOVERY_ATTEMPTS = 30;
22034
- var PREVIEW_PUBLISH_RECOVERY_INTERVAL_MS = 2e3;
22035
- function normalizeBaseUrl(value) {
22036
- return (value || DEFAULT_RIDDLE_API_BASE_URL).replace(/\/$/, "");
22037
- }
22038
- function fetchFor(config = {}) {
22039
- return config.fetchImpl || fetch;
22040
- }
22041
- function resolveRiddleApiKeyWithSource(config = {}) {
22042
- if (config.apiKey?.trim()) return { apiKey: config.apiKey.trim(), source: "option" };
22043
- if (process.env.RIDDLE_API_KEY?.trim()) return { apiKey: process.env.RIDDLE_API_KEY.trim(), source: "env" };
22044
- const keyFile = config.apiKeyFile || process.env.RIDDLE_API_KEY_FILE || DEFAULT_RIDDLE_API_KEY_FILE;
22045
- if ((0, import_node_fs5.existsSync)(keyFile)) {
22046
- const key = (0, import_node_fs5.readFileSync)(keyFile, "utf8").trim();
22047
- if (key) return { apiKey: key, source: "file", file: keyFile };
22048
- }
22049
- throw new Error(`Riddle API key missing. Set RIDDLE_API_KEY or write ${DEFAULT_RIDDLE_API_KEY_FILE}.`);
22050
- }
22051
- function resolveRiddleApiKeySource(config = {}) {
22052
- const { apiKey: _apiKey, ...source } = resolveRiddleApiKeyWithSource(config);
22053
- return source;
22054
- }
22055
- function resolveRiddleApiKey(config = {}) {
22056
- return resolveRiddleApiKeyWithSource(config).apiKey;
22057
- }
22058
- async function riddleRequestJson(config, pathname, init = {}) {
22059
- const response = await fetchFor(config)(`${normalizeBaseUrl(config.apiBaseUrl)}${pathname}`, {
22060
- ...init,
22061
- headers: {
22062
- Authorization: `Bearer ${resolveRiddleApiKey(config)}`,
22063
- "Content-Type": "application/json",
22064
- ...init.headers || {}
22065
- }
22066
- });
22067
- const text = await response.text();
22068
- let json = null;
22069
- try {
22070
- json = JSON.parse(text);
22071
- } catch {
22072
- }
22073
- if (!response.ok) throw new RiddleApiError(pathname, response.status, text);
22074
- return json ?? text;
22075
- }
22076
- async function getRiddleBalance(config = {}) {
22077
- return riddleRequestJson(config, "/v1/balance", { method: "GET" });
22078
- }
22079
- function previewDeployResultFromRecord(input) {
22080
- const { record, id, label, framework, expiresAt, publishRecovered, publishError } = input;
22081
- const receipt = record.receipt && typeof record.receipt === "object" ? parseRiddlePreviewReceipt(record.receipt) : void 0;
22082
- return {
22083
- ok: true,
22084
- id: String(record.id || record.preview_id || id),
22085
- label,
22086
- framework,
22087
- preview_url: String(record.preview_url || ""),
22088
- file_count: typeof record.file_count === "number" ? record.file_count : void 0,
22089
- total_bytes: typeof record.total_bytes === "number" ? record.total_bytes : void 0,
22090
- expires_at: receipt?.expires_at || expiresAt,
22091
- receipt,
22092
- publish_recovered: publishRecovered || void 0,
22093
- publish_error: publishError,
22094
- warnings: input.warnings?.length ? input.warnings : void 0,
22095
- raw: record
22096
- };
22097
- }
22098
- function gitOutput(directory, args) {
22099
- try {
22100
- return (0, import_node_child_process4.execFileSync)("git", ["-C", directory, ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"] }).trim();
22101
- } catch {
22102
- return "";
22103
- }
22104
- }
22105
- function detectRiddlePreviewSource(directory) {
22106
- const gitRevision = gitOutput(directory, ["rev-parse", "HEAD"]);
22107
- if (!gitRevision) return {};
22108
- const repository = gitOutput(directory, ["config", "--get", "remote.origin.url"]);
22109
- const status = gitOutput(directory, ["status", "--porcelain", "--untracked-files=normal"]);
22110
- return {
22111
- git_revision: gitRevision,
22112
- repository: repository || void 0,
22113
- dirty: Boolean(status)
22114
- };
22115
- }
22116
- function canRecoverPreviewPublish(error) {
22117
- return error instanceof RiddleApiError && PREVIEW_PUBLISH_RECOVERY_STATUSES.has(error.status);
22118
- }
22119
- function summarizePreviewDirectory(directory) {
22120
- const stack = [directory];
22121
- let fileCount = 0;
22122
- let totalBytes = 0;
22123
- while (stack.length) {
22124
- const current = stack.pop();
22125
- for (const entry of (0, import_node_fs5.readdirSync)(current, { withFileTypes: true })) {
22126
- const fullPath = import_node_path5.default.join(current, entry.name);
22127
- if (entry.isDirectory()) {
22128
- stack.push(fullPath);
22129
- continue;
22130
- }
22131
- if (!entry.isFile()) continue;
22132
- const stat = (0, import_node_fs5.statSync)(fullPath);
22133
- fileCount += 1;
22134
- totalBytes += stat.size;
22135
- }
22136
- }
22137
- return { file_count: fileCount, total_bytes: totalBytes };
22138
- }
22139
- function previewProgressEmitter(config, base) {
22140
- return async (snapshot) => {
22141
- if (!config.onPreviewProgress) return;
22142
- await config.onPreviewProgress({
22143
- label: base.label,
22144
- framework: base.framework,
22145
- directory: base.directory,
22146
- elapsed_ms: Math.max(0, Date.now() - base.startedAt),
22147
- warnings: base.warnings?.length ? base.warnings : void 0,
22148
- ...snapshot
22149
- });
22150
- };
22151
- }
22152
- async function waitForPublishedPreview(config, input) {
22153
- await input.emitProgress?.({
22154
- stage: "publish_recovering",
22155
- id: input.id,
22156
- file_count: input.localSummary?.file_count,
22157
- total_bytes: input.localSummary?.total_bytes,
22158
- publish_error: input.publishError.message,
22159
- message: `publish returned ${input.publishError.status}; polling preview status`
22160
- });
22161
- for (let attempt = 1; attempt <= PREVIEW_PUBLISH_RECOVERY_ATTEMPTS; attempt += 1) {
22162
- const status = await riddleRequestJson(config, `/v1/preview/${input.id}`);
22163
- await input.emitProgress?.({
22164
- stage: "checking_status",
22165
- id: input.id,
22166
- attempt,
22167
- attempts: PREVIEW_PUBLISH_RECOVERY_ATTEMPTS,
22168
- status: typeof status.status === "string" ? status.status : null,
22169
- preview_url: typeof status.preview_url === "string" ? status.preview_url : void 0,
22170
- file_count: typeof status.file_count === "number" ? status.file_count : input.localSummary?.file_count,
22171
- total_bytes: typeof status.total_bytes === "number" ? status.total_bytes : input.localSummary?.total_bytes
22172
- });
22173
- if (String(status.status || "") === "ready" && String(status.preview_url || "").trim()) {
22174
- await input.emitProgress?.({
22175
- stage: "ready",
22176
- id: input.id,
22177
- preview_url: String(status.preview_url),
22178
- file_count: typeof status.file_count === "number" ? status.file_count : input.localSummary?.file_count,
22179
- total_bytes: typeof status.total_bytes === "number" ? status.total_bytes : input.localSummary?.total_bytes
22180
- });
22181
- return previewDeployResultFromRecord({
22182
- record: status,
22183
- id: input.id,
22184
- label: input.label,
22185
- framework: input.framework,
22186
- expiresAt: input.expiresAt,
22187
- publishRecovered: true,
22188
- publishError: input.publishError.message,
22189
- warnings: input.warnings
22190
- });
22191
- }
22192
- if (attempt < PREVIEW_PUBLISH_RECOVERY_ATTEMPTS) {
22193
- await new Promise((resolve) => setTimeout(resolve, PREVIEW_PUBLISH_RECOVERY_INTERVAL_MS));
22194
- }
22195
- }
22196
- throw input.publishError;
22197
- }
22198
- async function deployRiddlePreview(config, directory, label, framework = "static", options = {}) {
22199
- if (!directory?.trim()) throw new Error("directory is required");
22200
- if (!label?.trim()) throw new Error("label is required");
22201
- if (framework !== "spa" && framework !== "static") throw new Error("framework must be spa or static");
22202
- const startedAt = Date.now();
22203
- const warnings = collectRiddlePreviewDeployWarnings(directory, framework);
22204
- const source = options.source || detectRiddlePreviewSource(directory);
22205
- const emitProgress = previewProgressEmitter(config, { label, framework, directory, startedAt, warnings });
22206
- await emitProgress({ stage: "validating", message: "checking preview input directory" });
22207
- const localSummary = summarizePreviewDirectory(directory);
22208
- await emitProgress({
22209
- stage: "creating",
22210
- file_count: localSummary.file_count,
22211
- total_bytes: localSummary.total_bytes,
22212
- message: "creating preview upload target"
22213
- });
22214
- const created = await riddleRequestJson(config, "/v1/preview", {
22215
- method: "POST",
22216
- body: JSON.stringify({ framework, label, source })
22217
- });
22218
- const id = String(created.id || "");
22219
- const uploadUrl = String(created.upload_url || "");
22220
- if (!id || !uploadUrl) throw new Error("Riddle preview create response was missing id or upload_url.");
22221
- await emitProgress({
22222
- stage: "created",
22223
- id,
22224
- file_count: localSummary.file_count,
22225
- total_bytes: localSummary.total_bytes,
22226
- message: "preview upload target created"
22227
- });
22228
- const scratch = (0, import_node_fs5.mkdtempSync)(import_node_path5.default.join((0, import_node_os2.tmpdir)(), "riddle-preview-upload-"));
22229
- const tarball = import_node_path5.default.join(scratch, `${id}.tar.gz`);
22230
- let tarballBytes = 0;
22231
- try {
22232
- await emitProgress({
22233
- stage: "archiving",
22234
- id,
22235
- file_count: localSummary.file_count,
22236
- total_bytes: localSummary.total_bytes,
22237
- message: "creating preview archive"
22238
- });
22239
- (0, import_node_child_process4.execFileSync)("tar", ["czf", tarball, "-C", directory, "."], { stdio: "pipe" });
22240
- tarballBytes = (0, import_node_fs5.statSync)(tarball).size;
22241
- await emitProgress({
22242
- stage: "archived",
22243
- id,
22244
- file_count: localSummary.file_count,
22245
- total_bytes: localSummary.total_bytes,
22246
- tarball_bytes: tarballBytes,
22247
- message: "preview archive created"
22248
- });
22249
- await emitProgress({
22250
- stage: "uploading",
22251
- id,
22252
- file_count: localSummary.file_count,
22253
- total_bytes: localSummary.total_bytes,
22254
- tarball_bytes: tarballBytes,
22255
- message: "uploading preview archive"
22256
- });
22257
- const upload = await fetchFor(config)(uploadUrl, {
22258
- method: "PUT",
22259
- headers: { "Content-Type": "application/gzip" },
22260
- body: (0, import_node_fs5.readFileSync)(tarball)
22261
- });
22262
- if (!upload.ok) {
22263
- throw new RiddleApiError(uploadUrl, upload.status, await upload.text());
22264
- }
22265
- await emitProgress({
22266
- stage: "uploaded",
22267
- id,
22268
- file_count: localSummary.file_count,
22269
- total_bytes: localSummary.total_bytes,
22270
- tarball_bytes: tarballBytes,
22271
- message: "preview archive uploaded"
22272
- });
22273
- } finally {
22274
- (0, import_node_fs5.rmSync)(scratch, { recursive: true, force: true });
22275
- }
22276
- const expiresAt = typeof created.expires_at === "string" ? created.expires_at : void 0;
22277
- try {
22278
- await emitProgress({
22279
- stage: "publishing",
22280
- id,
22281
- file_count: localSummary.file_count,
22282
- total_bytes: localSummary.total_bytes,
22283
- tarball_bytes: tarballBytes || void 0,
22284
- message: "publishing preview"
22285
- });
22286
- const published = await riddleRequestJson(config, `/v1/preview/${id}/publish`, {
22287
- method: "POST"
22288
- });
22289
- await emitProgress({
22290
- stage: "ready",
22291
- id,
22292
- preview_url: String(published.preview_url || ""),
22293
- file_count: typeof published.file_count === "number" ? published.file_count : localSummary.file_count,
22294
- total_bytes: typeof published.total_bytes === "number" ? published.total_bytes : localSummary.total_bytes
22295
- });
22296
- return previewDeployResultFromRecord({ record: published, id, label, framework, expiresAt, warnings });
22297
- } catch (error) {
22298
- if (!canRecoverPreviewPublish(error)) throw error;
22299
- return waitForPublishedPreview(config, {
22300
- id,
22301
- label,
22302
- framework,
22303
- expiresAt,
22304
- publishError: error,
22305
- warnings,
22306
- localSummary,
22307
- emitProgress
22308
- });
22309
- }
22310
- }
22311
- function latestMatchingMtimeMs(directory, predicate) {
22312
- let latest = 0;
22313
- const stack = [directory];
22314
- let visited = 0;
22315
- while (stack.length) {
22316
- const current = stack.pop();
22317
- for (const entry of (0, import_node_fs5.readdirSync)(current, { withFileTypes: true })) {
22318
- const fullPath = import_node_path5.default.join(current, entry.name);
22319
- if (entry.isDirectory()) {
22320
- stack.push(fullPath);
22321
- continue;
22322
- }
22323
- if (!entry.isFile() || !predicate(fullPath)) continue;
22324
- const stat = (0, import_node_fs5.statSync)(fullPath);
22325
- latest = Math.max(latest, stat.mtimeMs);
22326
- visited += 1;
22327
- if (visited >= 1e4) return latest;
22328
- }
22329
- }
22330
- return latest;
22331
- }
22332
- function collectRiddlePreviewDeployWarnings(directory, framework = "static") {
22333
- try {
22334
- if (framework !== "static") return [];
22335
- const resolvedDirectory = import_node_path5.default.resolve(directory);
22336
- if (import_node_path5.default.basename(resolvedDirectory) !== "out") return [];
22337
- const repoRoot = import_node_path5.default.dirname(resolvedDirectory);
22338
- const nextAppDir = import_node_path5.default.join(repoRoot, ".next", "server", "app");
22339
- if (!(0, import_node_fs5.existsSync)(nextAppDir)) return [];
22340
- const nextRenderedMtimeMs = latestMatchingMtimeMs(nextAppDir, (filePath) => /\.(?:html|rsc)$/i.test(filePath));
22341
- if (!nextRenderedMtimeMs) return [];
22342
- const outRenderedMtimeMs = (0, import_node_fs5.existsSync)(resolvedDirectory) ? latestMatchingMtimeMs(resolvedDirectory, (filePath) => /\.(?:html|txt|rsc)$/i.test(filePath)) : 0;
22343
- if (!outRenderedMtimeMs) {
22344
- return [
22345
- "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."
22346
- ];
22347
- }
22348
- if (nextRenderedMtimeMs > outRenderedMtimeMs + 1e3) {
22349
- return [
22350
- "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."
22351
- ];
22352
- }
22353
- return [];
22354
- } catch {
22355
- return [];
22356
- }
22357
- }
22358
- async function deployRiddleStaticPreview(config, directory, label, options = {}) {
22359
- return deployRiddlePreview(config, directory, label, "static", options);
22360
- }
22361
- function createTarball(directory, label, exclude = []) {
22362
- const scratch = (0, import_node_fs5.mkdtempSync)(import_node_path5.default.join((0, import_node_os2.tmpdir)(), "riddle-upload-"));
22363
- const tarball = import_node_path5.default.join(scratch, `${label}.tar.gz`);
22364
- const excludeArgs = exclude.flatMap((item) => ["--exclude", item]);
22365
- try {
22366
- (0, import_node_child_process4.execFileSync)("tar", ["czf", tarball, ...excludeArgs, "-C", directory, "."], { stdio: "pipe" });
22367
- return { scratch, tarball };
22368
- } catch (error) {
22369
- (0, import_node_fs5.rmSync)(scratch, { recursive: true, force: true });
22370
- throw error;
22371
- }
22372
- }
22373
- function parseRiddleViewport(value) {
22374
- if (!value) return void 0;
22375
- const match = /^(\d+)x(\d+)$/.exec(value.trim());
22376
- if (!match) throw new Error("viewport must look like 1280x720");
22377
- return { width: Number(match[1]), height: Number(match[2]) };
22378
- }
22379
- function scriptErrorFrom(job) {
22380
- const nested = job?.proof_of_execution && typeof job.proof_of_execution === "object" && !Array.isArray(job.proof_of_execution) ? job.proof_of_execution : null;
22381
- 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;
22382
- }
22383
- async function runRiddleServerPreview(config, input) {
22384
- if (!input.directory?.trim()) throw new Error("directory is required");
22385
- if (!input.script?.trim()) throw new Error("script is required");
22386
- const port = input.port || 3e3;
22387
- const routePath = input.path || "/";
22388
- const timeoutSec = input.timeoutSec || 180;
22389
- const created = await riddleRequestJson(config, "/v1/server-preview", {
22390
- method: "POST",
22391
- body: JSON.stringify({
22392
- image: input.image || "node:22-slim",
22393
- command: input.command || "node scripts/riddleSpaPreviewServer.mjs build 3000",
22394
- port,
22395
- path: routePath,
22396
- readiness_path: input.readinessPath || routePath,
22397
- readiness_timeout: input.readinessTimeoutSec || 90,
22398
- wait_until: input.waitUntil || "domcontentloaded",
22399
- wait_for_selector: input.waitForSelector || "body",
22400
- navigation_timeout: input.navigationTimeoutSec || 60,
22401
- viewport: input.viewport,
22402
- timeout: timeoutSec,
22403
- script: input.script
22404
- })
22405
- });
22406
- const jobId = String(created.job_id || "");
22407
- const uploadUrl = String(created.upload_url || "");
22408
- if (!jobId || !uploadUrl) {
22409
- throw new Error(`Riddle server preview create response was missing job_id or upload_url.`);
22410
- }
22411
- const { scratch, tarball } = createTarball(input.directory, jobId, [
22412
- ".git",
22413
- "node_modules",
22414
- "test-results",
22415
- ...input.exclude || []
22416
- ]);
22417
- try {
22418
- const upload = await fetchFor(config)(uploadUrl, {
22419
- method: "PUT",
22420
- headers: { "Content-Type": "application/gzip" },
22421
- body: (0, import_node_fs5.readFileSync)(tarball)
22422
- });
22423
- if (!upload.ok) throw new RiddleApiError(uploadUrl, upload.status, await upload.text());
22424
- } finally {
22425
- (0, import_node_fs5.rmSync)(scratch, { recursive: true, force: true });
22426
- }
22427
- await riddleRequestJson(config, `/v1/server-preview/${jobId}/start`, {
22428
- method: "POST"
22429
- });
22430
- let job = null;
22431
- const attempts = input.pollAttempts || Math.ceil((timeoutSec + 90) / 2);
22432
- const intervalMs = input.pollIntervalMs || 2e3;
22433
- for (let index = 0; index < attempts; index += 1) {
22434
- job = await riddleRequestJson(config, `/v1/server-preview/${jobId}`);
22435
- if (isTerminalRiddleJobStatus(job.status)) break;
22436
- if (index + 1 < attempts) await new Promise((resolve) => setTimeout(resolve, intervalMs));
22437
- }
22438
- const status = job?.status ? String(job.status) : null;
22439
- const scriptError = scriptErrorFrom(job);
22440
- return {
22441
- ok: (status === "completed" || status === "complete") && !scriptError,
22442
- job_id: jobId,
22443
- status,
22444
- terminal: isTerminalRiddleJobStatus(status),
22445
- script_error: scriptError,
22446
- job
22447
- };
22448
- }
22449
- async function runRiddleScript(config, input) {
22450
- if (!input.url?.trim()) throw new Error("url is required");
22451
- if (!input.script?.trim()) throw new Error("script is required");
22452
- const payload = {
22453
- url: input.url,
22454
- script: input.script,
22455
- sync: input.sync ?? false,
22456
- timeout_sec: input.timeoutSec || 120
22457
- };
22458
- if (input.viewport) payload.viewport = input.viewport;
22459
- if (input.include) payload.include = input.include;
22460
- if (typeof input.strict === "boolean") payload.strict = input.strict;
22461
- if (input.options) payload.options = input.options;
22462
- return riddleRequestJson(config, "/v1/run", {
22463
- method: "POST",
22464
- body: JSON.stringify(payload)
22465
- });
22466
- }
22467
- function isTerminalRiddleJobStatus(status) {
22468
- return ["completed", "complete", "completed_error", "completed_timeout", "failed"].includes(String(status || ""));
22469
- }
22470
- function stringField(record, key) {
22471
- const value = record?.[key];
22472
- return typeof value === "string" && value.trim() ? value.trim() : null;
22473
- }
22474
- function parseTimestampMs(value) {
22475
- if (!value) return null;
22476
- const parsed = Date.parse(value);
22477
- return Number.isFinite(parsed) ? parsed : null;
22478
- }
22479
- function buildPollSnapshot(jobId, job, input) {
22480
- const status = job?.status ? String(job.status) : null;
22481
- const phase = job?.phase ? String(job.phase) : null;
22482
- const terminal = isTerminalRiddleJobStatus(status);
22483
- const createdAt = stringField(job, "created_at");
22484
- const submittedAt = stringField(job, "submitted_at");
22485
- const completedAt = stringField(job, "completed_at");
22486
- const createdMs = parseTimestampMs(createdAt);
22487
- const submittedMs = parseTimestampMs(submittedAt);
22488
- const rawExecution = job?.execution && typeof job.execution === "object" && !Array.isArray(job.execution) ? job.execution : null;
22489
- const enqueuedAt = rawExecution ? stringField(rawExecution, "enqueued_at") : null;
22490
- const enqueuedMs = parseTimestampMs(enqueuedAt);
22491
- const queueStartedMs = enqueuedMs ?? createdMs;
22492
- const claimedAt = rawExecution ? stringField(rawExecution, "claimed_at") : null;
22493
- const claimedMs = parseTimestampMs(claimedAt);
22494
- let queueElapsedMs = null;
22495
- if (queueStartedMs !== null && claimedMs !== null) {
22496
- queueElapsedMs = Math.max(0, claimedMs - queueStartedMs);
22497
- } else if (queueStartedMs !== null && submittedMs !== null) {
22498
- queueElapsedMs = Math.max(0, submittedMs - queueStartedMs);
22499
- } else if (queueStartedMs !== null && !submittedAt && !terminal) {
22500
- queueElapsedMs = Math.max(0, input.observedAt - queueStartedMs);
22501
- }
22502
- return {
22503
- job_id: jobId,
22504
- status,
22505
- phase,
22506
- terminal,
22507
- attempt: input.attempt,
22508
- attempts: input.attempts,
22509
- elapsed_ms: Math.max(0, input.observedAt - input.startedAt),
22510
- created_at: createdAt,
22511
- submitted_at: submittedAt,
22512
- completed_at: completedAt,
22513
- queue_elapsed_ms: queueElapsedMs,
22514
- pre_submission_elapsed_ms: Math.max(0, Math.floor(input.preSubmissionElapsedMs ?? 0)),
22515
- running_without_submission: Boolean(status && !terminal && !submittedAt),
22516
- active_execution: Boolean(status === "running" && phase && phase !== "queued"),
22517
- execution: rawExecution ? rawExecution : void 0
22518
- };
22519
- }
22520
- function pollMessage(snapshot, timedOut) {
22521
- if (!timedOut) return void 0;
22522
- const submitted = snapshot.submitted_at || "not submitted";
22523
- const wakeHint = snapshot.running_without_submission && !snapshot.created_at && !snapshot.submitted_at ? ` ${RIDDLE_UNSUBMITTED_WAKE_HINT}.` : "";
22524
- const queue = snapshot.queue_elapsed_ms !== null ? ` queue_elapsed_ms=${snapshot.queue_elapsed_ms}` : "";
22525
- const preSubmit = snapshot.pre_submission_elapsed_ms > 0 ? ` pre_submission_elapsed_ms=${snapshot.pre_submission_elapsed_ms}` : "";
22526
- 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}`;
22527
- }
22528
- async function pollRiddleJob(config, jobId, options = {}) {
22529
- if (!jobId?.trim()) throw new Error("jobId is required");
22530
- const attempts = Math.max(1, Math.floor(options.attempts ?? (options.wait ? 300 : 1)));
22531
- const intervalMs = Math.max(0, Math.floor(options.intervalMs ?? 2e3));
22532
- const progressEveryMs = Math.max(0, Math.floor(options.progressEveryMs ?? 1e4));
22533
- const unsubmittedTimeoutMs = Math.max(0, Math.floor(options.unsubmittedTimeoutMs ?? 0));
22534
- const startedAt = Date.now();
22535
- let job = null;
22536
- let lastSnapshot = null;
22537
- let lastProgressAt = 0;
22538
- let lastProgressKey = "";
22539
- let preSubmissionElapsedMs = 0;
22540
- let unsubmittedTimedOut = false;
22541
- for (let index = 0; index < attempts; index += 1) {
22542
- job = await riddleRequestJson(config, `/v1/jobs/${jobId}`);
22543
- const observedAt = Date.now();
22544
- const nextSnapshot = buildPollSnapshot(jobId, job, {
22545
- attempt: index + 1,
22546
- attempts,
22547
- startedAt,
22548
- observedAt,
22549
- preSubmissionElapsedMs
22550
- });
22551
- if (nextSnapshot.running_without_submission) {
22552
- preSubmissionElapsedMs = Math.max(preSubmissionElapsedMs, nextSnapshot.elapsed_ms);
22553
- }
22554
- lastSnapshot = {
22555
- ...nextSnapshot,
22556
- pre_submission_elapsed_ms: preSubmissionElapsedMs
22557
- };
22558
- const progressKey = [
22559
- lastSnapshot.status || "unknown",
22560
- lastSnapshot.phase || "unknown",
22561
- lastSnapshot.terminal ? "terminal" : "nonterminal",
22562
- lastSnapshot.submitted_at ? "submitted" : "unsubmitted"
22563
- ].join(":");
22564
- if (options.onProgress) {
22565
- const shouldReport = index === 0 || lastSnapshot.terminal || progressKey !== lastProgressKey || observedAt - lastProgressAt >= progressEveryMs;
22566
- if (shouldReport) {
22567
- lastProgressAt = observedAt;
22568
- lastProgressKey = progressKey;
22569
- await options.onProgress(lastSnapshot);
22570
- }
22571
- }
22572
- unsubmittedTimedOut = Boolean(
22573
- options.wait && unsubmittedTimeoutMs > 0 && lastSnapshot.running_without_submission && !lastSnapshot.created_at && !lastSnapshot.submitted_at && preSubmissionElapsedMs >= unsubmittedTimeoutMs
22574
- );
22575
- if (lastSnapshot.terminal) break;
22576
- if (unsubmittedTimedOut) break;
22577
- if (index + 1 < attempts) {
22578
- await new Promise((resolve) => setTimeout(resolve, intervalMs));
22579
- }
22580
- }
22581
- const status = job?.status ? String(job.status) : null;
22582
- const fallbackObservedAt = Date.now();
22583
- const snapshot = lastSnapshot || buildPollSnapshot(jobId, job, {
22584
- attempt: 0,
22585
- attempts,
22586
- startedAt,
22587
- observedAt: fallbackObservedAt
22588
- });
22589
- if (!isTerminalRiddleJobStatus(status)) {
22590
- const timedOut = Boolean(options.wait);
22591
- return {
22592
- ok: !timedOut,
22593
- job_id: jobId,
22594
- status,
22595
- terminal: false,
22596
- job,
22597
- poll: {
22598
- ...snapshot,
22599
- timed_out: timedOut,
22600
- interval_ms: intervalMs,
22601
- unsubmitted_timeout: unsubmittedTimedOut || void 0,
22602
- unsubmitted_timeout_ms: unsubmittedTimedOut ? unsubmittedTimeoutMs : void 0,
22603
- message: pollMessage(snapshot, timedOut)
22604
- }
22605
- };
22606
- }
22607
- const artifacts = await riddleRequestJson(config, `/v1/jobs/${jobId}/artifacts`);
22608
- return {
22609
- ok: status === "completed" || status === "complete",
22610
- job_id: jobId,
22611
- status,
22612
- terminal: true,
22613
- job,
22614
- artifacts,
22615
- poll: {
22616
- ...snapshot,
22617
- timed_out: false,
22618
- interval_ms: intervalMs
22619
- }
22620
- };
22621
- }
22622
- function createRiddleApiClient(config = {}) {
22623
- return {
22624
- apiKeySource: () => resolveRiddleApiKeySource(config),
22625
- requestJson: (pathname, init) => riddleRequestJson(config, pathname, init),
22626
- getBalance: () => getRiddleBalance(config),
22627
- deployPreview: (directory, label, framework = "static", options) => deployRiddlePreview(config, directory, label, framework, options),
22628
- deployStaticPreview: (directory, label, options) => deployRiddleStaticPreview(config, directory, label, options),
22629
- runScript: (input) => runRiddleScript(config, input),
22630
- runServerPreview: (input) => runRiddleServerPreview(config, input),
22631
- pollJob: (jobId, options) => pollRiddleJob(config, jobId, options)
22632
- };
22633
- }
21354
+ var import_client = require("@riddledc/riddle-proof-riddle-client/client");
22634
21355
 
22635
21356
  // src/pr-comment.ts
22636
21357
  var RIDDLE_PROOF_PR_COMMENT_MARKER = "<!-- riddle-proof:pr-comment:v1 -->";
@@ -22761,7 +21482,7 @@ function pageSummaries(result) {
22761
21482
  }
22762
21483
  return pages;
22763
21484
  }
22764
- function profileCheckCounts3(result) {
21485
+ function profileCheckCounts2(result) {
22765
21486
  const checks = asArray(result.checks);
22766
21487
  if (checks.length) {
22767
21488
  let passed2 = 0;
@@ -22900,7 +21621,7 @@ function summarizeRiddleProofPrComment(input) {
22900
21621
  const resultDetails = asRecord2(result.details);
22901
21622
  const resultRaw = asRecord2(result.raw);
22902
21623
  const rawDetails = asRecord2(resultRaw.details);
22903
- const profileChecks = profileResult ? profileCheckCounts3(result) : void 0;
21624
+ const profileChecks = profileResult ? profileCheckCounts2(result) : void 0;
22904
21625
  const changeChecks = changeResult ? changeReceiptCheckCounts(result) : void 0;
22905
21626
  const artifacts = mergeArtifacts(
22906
21627
  collectArtifacts(runResponse),
@@ -23171,6 +21892,7 @@ function buildRiddleProofPrCommentMarkdown(input) {
23171
21892
  DEFAULT_DIAGNOSTIC_STRING_LIMIT,
23172
21893
  DEFAULT_RIDDLE_API_BASE_URL,
23173
21894
  DEFAULT_RIDDLE_API_KEY_FILE,
21895
+ RIDDLE_BALANCE_ENDPOINT_PATH,
23174
21896
  RIDDLE_PREVIEW_RECEIPT_VERSION,
23175
21897
  RIDDLE_PROOF_BASIC_GAMEPLAY_ASSESSMENT_VERSION,
23176
21898
  RIDDLE_PROOF_BASIC_GAMEPLAY_CATCH_VERSION,
@@ -23180,8 +21902,39 @@ function buildRiddleProofPrCommentMarkdown(input) {
23180
21902
  RIDDLE_PROOF_CHANGE_RECEIPT_V1_VERSION,
23181
21903
  RIDDLE_PROOF_CHANGE_RECEIPT_VERSION,
23182
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,
23183
21916
  RIDDLE_PROOF_CHECKPOINT_PACKET_VERSION,
23184
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,
23185
21938
  RIDDLE_PROOF_HANDOFF_RECEIPT_VERSION,
23186
21939
  RIDDLE_PROOF_HOSTED_PROFILE_ARTIFACTS,
23187
21940
  RIDDLE_PROOF_OBSERVATION_RECEIPT_VERSION,
@@ -23199,7 +21952,11 @@ function buildRiddleProofPrCommentMarkdown(input) {
23199
21952
  RIDDLE_PROOF_PR_COMMENT_MARKER,
23200
21953
  RIDDLE_PROOF_RUN_CARD_VERSION,
23201
21954
  RIDDLE_PROOF_RUN_STATE_VERSION,
21955
+ RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_MAX_CERTIFICATES,
21956
+ RIDDLE_PROOF_SEMANTIC_CERTIFICATE_CLOSURE_VERSION,
23202
21957
  RIDDLE_PROOF_SEMANTIC_CERTIFICATE_VERSION,
21958
+ RIDDLE_PROOF_SIGNED_CAPTURE_BUNDLE_VERSION,
21959
+ RIDDLE_PROOF_SIGNED_CAPTURE_SIGNATURE_DOMAIN,
23203
21960
  RIDDLE_PROOF_VISUAL_SESSION_FINGERPRINT_VERSION,
23204
21961
  RIDDLE_PROOF_VISUAL_SESSION_VERSION,
23205
21962
  RIDDLE_UNSUBMITTED_WAKE_HINT,
@@ -23217,6 +21974,7 @@ function buildRiddleProofPrCommentMarkdown(input) {
23217
21974
  assessBasicGameplayRoute,
23218
21975
  assessPlayabilityEvidence,
23219
21976
  assessRiddleProofChange,
21977
+ assessRiddleProofCheckedMeaningClosure,
23220
21978
  assessRiddleProofOrderedTrace,
23221
21979
  assessRiddleProofOrderedTraceSetupResults,
23222
21980
  assessRiddleProofProfileArtifactCompleteness,
@@ -23241,6 +21999,9 @@ function buildRiddleProofPrCommentMarkdown(input) {
23241
21999
  compactBasicGameplayText,
23242
22000
  compactRecord,
23243
22001
  compareVisualProofSessionFingerprint,
22002
+ composeRiddleProofCheckedMeaningClosures,
22003
+ composeRiddleProofGroundedSemanticCertificateClosures,
22004
+ composeRiddleProofSemanticCertificateClosures,
23244
22005
  composeRiddleProofSemanticCertificates,
23245
22006
  createBasicGameplayCatchRecords,
23246
22007
  createBasicGameplayCatchSummary,
@@ -23253,13 +22014,21 @@ function buildRiddleProofPrCommentMarkdown(input) {
23253
22014
  createLocalAgentJsonRunner,
23254
22015
  createRiddleApiClient,
23255
22016
  createRiddleProofChangeReceipt,
22017
+ createRiddleProofCheckedMeaningAtomicClosure,
22018
+ createRiddleProofCheckedMeaningRule,
22019
+ createRiddleProofGroundedDeclarativeJsonContract,
22020
+ createRiddleProofGroundedDeclarativeJsonVerifier,
22021
+ createRiddleProofGroundedSemanticAtomicCertificateClosure,
22022
+ createRiddleProofGroundedSemanticCertificate,
23256
22023
  createRiddleProofHandoffReceipt,
23257
22024
  createRiddleProofObservationReceipt,
23258
22025
  createRiddleProofProfileConfigurationError,
23259
22026
  createRiddleProofProfileEnvironmentBlockedResult,
23260
22027
  createRiddleProofProfileInsufficientResult,
23261
22028
  createRiddleProofRunCard,
22029
+ createRiddleProofSemanticAtomicCertificateClosure,
23262
22030
  createRiddleProofSemanticCertificate,
22031
+ createRiddleProofSignedCaptureBundle,
23263
22032
  createRunResult,
23264
22033
  createRunState,
23265
22034
  createRunStatusSnapshot,
@@ -23271,13 +22040,17 @@ function buildRiddleProofPrCommentMarkdown(input) {
23271
22040
  extractPlayabilityEvidence,
23272
22041
  extractRiddleProofProfileResult,
23273
22042
  getRiddleBalance,
22043
+ getRiddleJobArtifacts,
23274
22044
  isDuplicateCheckpointResponse,
23275
22045
  isProtectedFinalStatus,
23276
22046
  isRiddleProofPlayabilityMode,
23277
22047
  isSuccessfulStatus,
23278
22048
  isTerminalRiddleJobStatus,
23279
22049
  isTerminalStatus,
22050
+ matchRiddleProofCheckedMeaningClosure,
22051
+ matchRiddleProofGroundedSemanticCertificateClosure,
23280
22052
  matchRiddleProofSemanticCertificate,
22053
+ matchRiddleProofSemanticCertificateClosure,
23281
22054
  migrateRiddleProofChangeReceipt,
23282
22055
  nonEmptyString,
23283
22056
  normalizeCheckpointResponse,
@@ -23303,6 +22076,8 @@ function buildRiddleProofPrCommentMarkdown(input) {
23303
22076
  readRiddleProofRunStatus,
23304
22077
  recordValue,
23305
22078
  redactForProofDiagnostics,
22079
+ replayRiddleProofCheckedMeaningClosure,
22080
+ replayRiddleProofGroundedSemanticCertificate,
23306
22081
  resolveBasicGameplayProgressionCheckWithArtifactScreenshots,
23307
22082
  resolveRiddleApiKey,
23308
22083
  resolveRiddleApiKeySource,
@@ -23335,6 +22110,10 @@ function buildRiddleProofPrCommentMarkdown(input) {
23335
22110
  summarizeRiddleProofProfileResult,
23336
22111
  summarizeRiddleProofPublicConsumerSurface,
23337
22112
  summarizeRiddleProofPublicState,
22113
+ validateRiddleProofCheckedMeaningClosure,
22114
+ validateRiddleProofGroundedSemanticCertificateClosure,
22115
+ validateRiddleProofSemanticCertificateClosure,
22116
+ verifyRiddleProofSignedCaptureBundle,
23338
22117
  visualSessionFingerprint,
23339
22118
  visualSessionFingerprintBasis
23340
22119
  });