@kya-os/checkpoint-shared 1.5.2 → 1.7.0

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 (135) hide show
  1. package/CHANGELOG.md +98 -1
  2. package/dist/beacon-types/index.d.mts +12 -1
  3. package/dist/beacon-types/index.d.mts.map +1 -1
  4. package/dist/beacon-types/index.d.ts +12 -1
  5. package/dist/beacon-types/index.d.ts.map +1 -1
  6. package/dist/beacon-types/index.js +18 -1
  7. package/dist/beacon-types/index.mjs +18 -2
  8. package/dist/beacon-types/index.mjs.map +1 -1
  9. package/dist/{browser-posture-D4j2a5gi.d.ts → browser-posture-B8YiPa5c.d.ts} +6 -6
  10. package/dist/{browser-posture-D4j2a5gi.d.ts.map → browser-posture-B8YiPa5c.d.ts.map} +1 -1
  11. package/dist/{browser-posture-DVoHMHjY.d.mts → browser-posture-BLhw-MON.d.mts} +6 -6
  12. package/dist/{browser-posture-DVoHMHjY.d.mts.map → browser-posture-BLhw-MON.d.mts.map} +1 -1
  13. package/dist/browser-posture-cookie.js +1 -1
  14. package/dist/browser-posture-cookie.mjs +1 -1
  15. package/dist/browser-posture-cookie.mjs.map +1 -1
  16. package/dist/browser-posture-proof.d.mts +2 -2
  17. package/dist/browser-posture-proof.d.mts.map +1 -1
  18. package/dist/browser-posture-proof.d.ts +2 -2
  19. package/dist/browser-posture-proof.d.ts.map +1 -1
  20. package/dist/browser-posture-proof.js +43 -2
  21. package/dist/browser-posture-proof.mjs +43 -2
  22. package/dist/browser-posture-proof.mjs.map +1 -1
  23. package/dist/browser-posture.d.mts +1 -1
  24. package/dist/browser-posture.d.ts +1 -1
  25. package/dist/browser-posture.js +3 -3
  26. package/dist/browser-posture.mjs +3 -3
  27. package/dist/browser-posture.mjs.map +1 -1
  28. package/dist/canonical-signer/index.d.mts.map +1 -1
  29. package/dist/canonical-signer/index.d.ts.map +1 -1
  30. package/dist/canonical-signer/index.js +86 -51
  31. package/dist/canonical-signer/index.mjs +86 -51
  32. package/dist/canonical-signer/index.mjs.map +1 -1
  33. package/dist/clearance.d.mts +1 -1
  34. package/dist/clearance.d.ts +1 -1
  35. package/dist/clearance.js +2 -2
  36. package/dist/clearance.mjs +2 -2
  37. package/dist/client-ip-DFamiNoz.d.mts +34 -0
  38. package/dist/client-ip-DFamiNoz.d.mts.map +1 -0
  39. package/dist/client-ip-DFamiNoz.d.ts +34 -0
  40. package/dist/client-ip-DFamiNoz.d.ts.map +1 -0
  41. package/dist/client-ip.d.mts +2 -0
  42. package/dist/client-ip.d.ts +2 -0
  43. package/dist/client-ip.js +7 -0
  44. package/dist/client-ip.mjs +3 -0
  45. package/dist/errors/index.d.mts +17 -0
  46. package/dist/errors/index.d.mts.map +1 -1
  47. package/dist/errors/index.d.ts +17 -0
  48. package/dist/errors/index.d.ts.map +1 -1
  49. package/dist/errors/index.js +75 -3
  50. package/dist/errors/index.mjs +75 -3
  51. package/dist/errors/index.mjs.map +1 -1
  52. package/dist/{external-Ct8j_hto.d.ts → external-B7WI9FyQ.d.mts} +2 -2
  53. package/dist/{external-Ct8j_hto.d.mts.map → external-B7WI9FyQ.d.mts.map} +1 -1
  54. package/dist/{external-Ct8j_hto.d.mts → external-B7WI9FyQ.d.ts} +2 -2
  55. package/dist/{external-Ct8j_hto.d.ts.map → external-B7WI9FyQ.d.ts.map} +1 -1
  56. package/dist/gateway-client-ip.d.mts +1 -1
  57. package/dist/gateway-client-ip.d.ts +1 -1
  58. package/dist/gateway-client-ip.js +1 -1
  59. package/dist/gateway-client-ip.mjs +1 -1
  60. package/dist/host-adapter/index.d.mts +2 -0
  61. package/dist/host-adapter/index.d.ts +2 -0
  62. package/dist/host-adapter/index.js +23 -0
  63. package/dist/host-adapter/index.mjs +3 -0
  64. package/dist/host-adapter-C-4IxmqM.mjs +540 -0
  65. package/dist/host-adapter-C-4IxmqM.mjs.map +1 -0
  66. package/dist/host-adapter-CwW9YB0U.js +694 -0
  67. package/dist/index-B7rTovHa.d.mts +707 -0
  68. package/dist/index-B7rTovHa.d.mts.map +1 -0
  69. package/dist/index-HaqfPtaL.d.ts +707 -0
  70. package/dist/index-HaqfPtaL.d.ts.map +1 -0
  71. package/dist/index.d.mts +742 -937
  72. package/dist/index.d.mts.map +1 -1
  73. package/dist/index.d.ts +742 -937
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +758 -1193
  76. package/dist/index.mjs +659 -1148
  77. package/dist/index.mjs.map +1 -1
  78. package/dist/kya-http-error-codes-7ewV5RuK.d.mts +29 -0
  79. package/dist/kya-http-error-codes-7ewV5RuK.d.mts.map +1 -0
  80. package/dist/kya-http-error-codes-7ewV5RuK.d.ts +29 -0
  81. package/dist/kya-http-error-codes-7ewV5RuK.d.ts.map +1 -0
  82. package/dist/kya-http-error-codes-C2JiWPsi.mjs +73 -0
  83. package/dist/kya-http-error-codes-C2JiWPsi.mjs.map +1 -0
  84. package/dist/kya-http-error-codes-UYb1zpGM.js +83 -0
  85. package/dist/kya-http.d.mts +3 -0
  86. package/dist/kya-http.d.ts +3 -0
  87. package/dist/kya-http.js +11 -0
  88. package/dist/kya-http.mjs +4 -0
  89. package/dist/mcpi/approval-grant/index.d.mts.map +1 -1
  90. package/dist/mcpi/approval-grant/index.d.ts.map +1 -1
  91. package/dist/mcpi/approval-grant/index.js +10 -1
  92. package/dist/mcpi/approval-grant/index.mjs +10 -1
  93. package/dist/mcpi/approval-grant/index.mjs.map +1 -1
  94. package/dist/mcpi/dashboard-config/index.d.mts +3 -2
  95. package/dist/mcpi/dashboard-config/index.d.mts.map +1 -1
  96. package/dist/mcpi/dashboard-config/index.d.ts +3 -2
  97. package/dist/mcpi/dashboard-config/index.d.ts.map +1 -1
  98. package/dist/policy/enforcement.d.mts +2 -0
  99. package/dist/policy/enforcement.d.ts +2 -0
  100. package/dist/policy/enforcement.js +15 -0
  101. package/dist/policy/enforcement.mjs +3 -0
  102. package/dist/{posture-origins-Dl7i8j93.mjs → posture-origins-Ba83O0cD.mjs} +3 -3
  103. package/dist/posture-origins-Ba83O0cD.mjs.map +1 -0
  104. package/dist/{posture-origins-CEm83u4D.js → posture-origins-CdVOdiMT.js} +7 -1
  105. package/dist/{project-verification-key-CgSVX9_m.mjs → project-verification-key-66N4edKn.mjs} +2 -2
  106. package/dist/{project-verification-key-CgSVX9_m.mjs.map → project-verification-key-66N4edKn.mjs.map} +1 -1
  107. package/dist/{project-verification-key-C3L5rd8a.js → project-verification-key-BccT12tQ.js} +1 -1
  108. package/dist/registered-sid-D3g-gZQF.d.mts +11 -0
  109. package/dist/registered-sid-D3g-gZQF.d.mts.map +1 -0
  110. package/dist/registered-sid-D3g-gZQF.d.ts +11 -0
  111. package/dist/registered-sid-D3g-gZQF.d.ts.map +1 -0
  112. package/dist/registered-sid-eLCNZvIF.js +170 -0
  113. package/dist/registered-sid-hUl-bvM5.mjs +142 -0
  114. package/dist/registered-sid-hUl-bvM5.mjs.map +1 -0
  115. package/dist/{schemas-DxY-dk9y.mjs → schemas-7qodsG-Z.mjs} +49 -2
  116. package/dist/schemas-7qodsG-Z.mjs.map +1 -0
  117. package/dist/{schemas-BmjNLAE7.js → schemas-YhagYDx_.js} +59 -0
  118. package/dist/step-up-BjP--hG-.d.mts +114 -0
  119. package/dist/step-up-BjP--hG-.d.mts.map +1 -0
  120. package/dist/step-up-BjP--hG-.d.ts +114 -0
  121. package/dist/step-up-BjP--hG-.d.ts.map +1 -0
  122. package/dist/step-up-C2d8C20x.js +1697 -0
  123. package/dist/step-up-COlmWJN8.mjs +1513 -0
  124. package/dist/step-up-COlmWJN8.mjs.map +1 -0
  125. package/fixtures/cli-registration.v2.json +115 -0
  126. package/fixtures/detection/reason-codes.json +1 -1
  127. package/fixtures/kya-http/README.md +34 -26
  128. package/fixtures/kya-http/protected-resource-metadata.full.json +14 -5
  129. package/fixtures/kya-http/protected-resource-metadata.invalid-issuer.json +51 -0
  130. package/fixtures/kya-http/protected-resource-metadata.no-issuer.json +32 -0
  131. package/fixtures/reviewer-grant-revocation.v1.json +285 -0
  132. package/package.json +26 -4
  133. package/dist/posture-origins-Dl7i8j93.mjs.map +0 -1
  134. package/dist/schemas-DxY-dk9y.mjs.map +0 -1
  135. package/fixtures/kya-http/protected-resource-metadata.global.json +0 -28
package/dist/index.js CHANGED
@@ -27,9 +27,13 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  }) : target, mod));
28
28
 
29
29
  //#endregion
30
- const require_schemas = require('./schemas-BmjNLAE7.js');
31
- const require_posture_origins = require('./posture-origins-CEm83u4D.js');
30
+ const require_schemas = require('./schemas-YhagYDx_.js');
31
+ const require_posture_origins = require('./posture-origins-CdVOdiMT.js');
32
+ const require_host_adapter = require('./host-adapter-CwW9YB0U.js');
32
33
  const require_client_ip = require('./client-ip-CW6pRyLf.js');
34
+ const require_step_up = require('./step-up-C2d8C20x.js');
35
+ const require_kya_http_error_codes = require('./kya-http-error-codes-UYb1zpGM.js');
36
+ const require_registered_sid = require('./registered-sid-eLCNZvIF.js');
33
37
  let _noble_hashes_sha2_js = require("@noble/hashes/sha2.js");
34
38
  let _noble_hashes_utils_js = require("@noble/hashes/utils.js");
35
39
  let _kya_os_provider_registry = require("@kya-os/provider-registry");
@@ -67,6 +71,112 @@ function date(params) {
67
71
  return require_schemas._coercedDate(require_schemas.ZodDate, params);
68
72
  }
69
73
 
74
+ //#endregion
75
+ //#region src/core/network-assertions.ts
76
+ const ProxyCollectionStateSchema = require_schemas._enum([
77
+ "current",
78
+ "unavailable",
79
+ "stale",
80
+ "unsupported",
81
+ "conflicting",
82
+ "insufficient_support"
83
+ ]);
84
+ const epochSeconds = require_schemas.number().int().min(0).max(253402300799);
85
+ const percentage = require_schemas.number().int().min(0).max(100);
86
+ /** Source assertions describe request egress membership, never a visitor identity or fraud verdict. */
87
+ const ProxyAssertionSchema = require_schemas.object({
88
+ kind: require_schemas.string().min(1),
89
+ source: require_schemas.string().min(1),
90
+ subjectScope: require_schemas.literal("request_egress"),
91
+ membership: require_schemas._enum([
92
+ "present",
93
+ "absent",
94
+ "unknown"
95
+ ]),
96
+ evidenceGrade: require_schemas._enum(["confirmed", "vendor_reported"]),
97
+ collectionState: ProxyCollectionStateSchema,
98
+ /** Unix seconds supplied by the source. Reader fetch time is not source observation time. */
99
+ observedAt: epochSeconds.nullable(),
100
+ expiresAt: epochSeconds.nullable(),
101
+ membershipConfidence: percentage.nullable(),
102
+ sourceReliability: percentage.nullable(),
103
+ fraudProbability: require_schemas.number().min(0).max(1).nullable(),
104
+ proxyClass: require_schemas._enum(["datacenter", "unknown"]).optional()
105
+ }).strict();
106
+ const knownKinds = /* @__PURE__ */ new Set([
107
+ "tor_exit",
108
+ "published_vpn_exit",
109
+ "observed_proxy",
110
+ "suspected_residential_proxy",
111
+ "privacy_relay",
112
+ "local_tunnel",
113
+ "hosting"
114
+ ]);
115
+ /**
116
+ * The default admits only confirmed, current assertions. maxmind_legacy preserves
117
+ * existing vendor positives without claiming that its undated optional file is fresh.
118
+ * Uncertain evidence never produces a confirmed-clean false Boolean.
119
+ */
120
+ function mapProxyAssertions(proxyAssertions, nowSeconds, collectionState, compatibility = "confirmed_current") {
121
+ const states = [collectionState];
122
+ const eligible = [];
123
+ for (const assertion of proxyAssertions) {
124
+ if (!knownKinds.has(assertion.kind)) {
125
+ states.push("unsupported");
126
+ continue;
127
+ }
128
+ states.push(assertion.collectionState);
129
+ if (assertion.collectionState !== "current" && assertion.collectionState !== "insufficient_support") {
130
+ states.push(assertion.collectionState);
131
+ continue;
132
+ }
133
+ const dated = assertion.observedAt !== null && assertion.expiresAt !== null;
134
+ const current = dated && assertion.observedAt <= nowSeconds && assertion.expiresAt > nowSeconds;
135
+ if (dated && !current) {
136
+ states.push("stale");
137
+ continue;
138
+ }
139
+ const confirmed = assertion.evidenceGrade === "confirmed" && assertion.collectionState === "current" && current;
140
+ const legacy = compatibility === "maxmind_legacy" && assertion.source === "maxmind-anonymous-ip" && assertion.evidenceGrade === "vendor_reported" && assertion.collectionState === "insufficient_support" && assertion.observedAt === null && assertion.expiresAt === null;
141
+ if (confirmed || legacy) eligible.push(assertion);
142
+ else states.push("insufficient_support");
143
+ }
144
+ for (const assertion of eligible) if (assertion.membership === "present" && eligible.some((other) => other.kind === assertion.kind && other.membership === "absent")) states.push("conflicting");
145
+ if (proxyAssertions.length === 0) states.push("insufficient_support");
146
+ const proxyCollectionState = [
147
+ "conflicting",
148
+ "unsupported",
149
+ "unavailable",
150
+ "stale",
151
+ "insufficient_support",
152
+ "current"
153
+ ].find((state) => states.includes(state));
154
+ const blocked = proxyCollectionState !== "current" && proxyCollectionState !== "insufficient_support";
155
+ const positive = eligible.filter((assertion) => assertion.membership === "present");
156
+ const preferred = [
157
+ positive.find((assertion) => assertion.kind === "tor_exit"),
158
+ positive.find((assertion) => assertion.kind === "published_vpn_exit"),
159
+ positive.find((assertion) => assertion.kind === "suspected_residential_proxy"),
160
+ positive.find((assertion) => assertion.kind === "observed_proxy" && assertion.proxyClass === "datacenter"),
161
+ positive.find((assertion) => assertion.kind === "observed_proxy")
162
+ ].find(Boolean);
163
+ const types = {
164
+ tor_exit: "tor",
165
+ published_vpn_exit: "vpn",
166
+ suspected_residential_proxy: "residential_proxy",
167
+ observed_proxy: preferred?.proxyClass === "datacenter" ? "datacenter" : "unknown"
168
+ };
169
+ return {
170
+ proxy: !blocked && preferred ? {
171
+ isProxy: true,
172
+ proxyType: types[preferred.kind],
173
+ confidence: preferred.membershipConfidence ?? (preferred.evidenceGrade === "vendor_reported" ? 90 : 0)
174
+ } : void 0,
175
+ proxyAssertions,
176
+ proxyCollectionState
177
+ };
178
+ }
179
+
70
180
  //#endregion
71
181
  //#region src/core/risk-score.ts
72
182
  /**
@@ -514,8 +624,8 @@ const ProxyInfoSchema = require_schemas.object({
514
624
  });
515
625
  /**
516
626
  * Host-supplied network / IP-intelligence context for a request's
517
- * `trueIp`. Mirrors the Rust `NetworkContext`; echoed verbatim on the
518
- * engine's `VerifyResult.network` (a sibling of `DetectionDetail`, like
627
+ * `trueIp`. Legacy fields mirror the Rust `NetworkContext` and appear on
628
+ * the engine's `VerifyResult.network` (a sibling of `DetectionDetail`, like
519
629
  * `EngineInfo` above — there is no wrapping `VerifyResultSchema`) when the
520
630
  * host supplied one, and exposed to Cedar as `context.ip_routing_type` /
521
631
  * `context.is_proxy`. Absent-safe: a request with no network context is
@@ -526,7 +636,13 @@ const NetworkContextSchema = require_schemas.object({
526
636
  asn: require_schemas.number().int().nonnegative().optional(),
527
637
  isp: require_schemas.string().optional(),
528
638
  routingType: RoutingTypeSchema,
529
- proxy: ProxyInfoSchema.optional()
639
+ proxy: ProxyInfoSchema.optional(),
640
+ /**
641
+ * TypeScript-host evidence, retained in detection rows and extended API read-back.
642
+ * Older Rust readers do not echo these additive fields.
643
+ */
644
+ proxyAssertions: require_schemas.array(ProxyAssertionSchema).optional(),
645
+ proxyCollectionState: ProxyCollectionStateSchema.optional()
530
646
  });
531
647
  /**
532
648
  * Descriptive detection detail from the engine.
@@ -635,7 +751,7 @@ const DetectionDetailSchema = require_schemas.object({
635
751
  * `DetectionDetail.granted_scopes` (additive, omitted when empty). */
636
752
  grantedScopes: require_schemas.array(require_schemas.string()).optional(),
637
753
  /**
638
- * GODPROMPTS/detection-reason-codes: namespaced detection/* codes, most-
754
+ * Detection reason codes (#4874): namespaced detection/* codes, most-
639
755
  * significant-evidence first, derived via mapDetectionToReasonCodes.
640
756
  * Optional: only producers that opt into signal exposure (currently
641
757
  * /api/v1/detect via buildDetectionSignalExposure) populate this.
@@ -1311,7 +1427,7 @@ function getVerificationRiskLevel(method, confidence) {
1311
1427
  /**
1312
1428
  * Detection reason-code mapping: the single pure projection of a
1313
1429
  * detection's structured facts onto the `DETECTION_REASON_CODES` registry
1314
- * (GODPROMPTS/detection-reason-codes).
1430
+ * (#4874).
1315
1431
  *
1316
1432
  * The engine already emits structured evidence (`signals[]` with a typed
1317
1433
  * `source`, `verificationMethod`, `detectionClass`, `isAiCrawler`) but the
@@ -2562,7 +2678,6 @@ const DEFAULT_ENV_VARS = {
2562
2678
  AGENTSHIELD_SECRET_KEY: "",
2563
2679
  AGENTSHIELD_PIXEL_ID: "",
2564
2680
  AGENTSHIELD_API_ENDPOINT: "https://api.agentshield.ai",
2565
- AGENTSHIELD_WASM_PATH: "/wasm/agentshield_wasm_bg.wasm",
2566
2681
  AGENTSHIELD_CACHE_TTL: "3600",
2567
2682
  AGENTSHIELD_DEBUG: "false",
2568
2683
  AGENTSHIELD_LOG_LEVEL: "info"
@@ -2826,7 +2941,9 @@ const BARE_ERRORS = {
2826
2941
  BARE_INVALID_END_DATE: "INVALID_END_DATE",
2827
2942
  BARE_INVALID_DATE_RANGE: "INVALID_DATE_RANGE",
2828
2943
  BARE_INVALID_DATE: "INVALID_DATE",
2829
- BARE_UNKNOWN_ERROR: "UNKNOWN_ERROR"
2944
+ BARE_UNKNOWN_ERROR: "UNKNOWN_ERROR",
2945
+ BARE_NOT_FOUND: "NOT_FOUND",
2946
+ BARE_FORBIDDEN: "FORBIDDEN"
2830
2947
  };
2831
2948
  /**
2832
2949
  * Lowercase Error Codes
@@ -2996,6 +3113,40 @@ const KYAOS_PROTOCOL_ERRORS = {
2996
3113
  KYAOS_SLASH_POLICY_UNAVAILABLE: "kyaos/policy-unavailable"
2997
3114
  };
2998
3115
  /**
3116
+ * Gateway Vault Resolve Error Codes
3117
+ *
3118
+ * Emitted by POST /api/v1/gateway/vault/{projectId}/resolve, and five of them
3119
+ * (INVALID_ASSERTION, INVALID_SIGNATURE, ASSERTION_EXPIRED, ASSERTION_REPLAYED,
3120
+ * PROJECT_MISMATCH) also by POST /api/v1/vault/{projectId}/resolve, which
3121
+ * verifies through the same shared verifier and nonce store
3122
+ * (apps/web/lib/vault/). Every emission site passes an explicit message and
3123
+ * status, so registering them changes no wire behaviour.
3124
+ */
3125
+ const GATEWAY_VAULT_ERRORS = {
3126
+ MALFORMED_REQUEST_BODY: "MALFORMED_REQUEST_BODY",
3127
+ GATEWAY_NOT_CONFIGURED: "GATEWAY_NOT_CONFIGURED",
3128
+ INVALID_ASSERTION: "INVALID_ASSERTION",
3129
+ INVALID_SIGNATURE: "INVALID_SIGNATURE",
3130
+ ASSERTION_EXPIRED: "ASSERTION_EXPIRED",
3131
+ ASSERTION_REPLAYED: "ASSERTION_REPLAYED",
3132
+ PROJECT_MISMATCH: "PROJECT_MISMATCH",
3133
+ ISSUER_MISMATCH: "ISSUER_MISMATCH",
3134
+ USER_DID_MISMATCH: "USER_DID_MISMATCH",
3135
+ TOOL_NAME_MISMATCH: "TOOL_NAME_MISMATCH",
3136
+ SESSION_ID_MISMATCH: "SESSION_ID_MISMATCH",
3137
+ NOT_AUTHORIZED: "NOT_AUTHORIZED",
3138
+ CREDENTIALS_NOT_CONFIGURED: "CREDENTIALS_NOT_CONFIGURED",
3139
+ OAUTH_EXPIRED: "OAUTH_EXPIRED"
3140
+ };
3141
+ /**
3142
+ * Vault Resolve Error Codes
3143
+ *
3144
+ * The one code unique to POST /api/v1/vault/{projectId}/resolve. The rest of
3145
+ * its surface reuses GATEWAY_VAULT_ERRORS, BARE_ERRORS and INTERNAL_ERRORS by
3146
+ * key.
3147
+ */
3148
+ const VAULT_ERRORS = { NO_AGENT_KEY: "NO_AGENT_KEY" };
3149
+ /**
2999
3150
  * All Error Codes
3000
3151
  */
3001
3152
  const ERROR_CODES = {
@@ -3021,7 +3172,9 @@ const ERROR_CODES = {
3021
3172
  ...BOUNCER_UPPERCASE_ERRORS,
3022
3173
  ...AUDIT_ERRORS,
3023
3174
  ...AUDIT_PROTOCOL_ERRORS,
3024
- ...KYAOS_PROTOCOL_ERRORS
3175
+ ...KYAOS_PROTOCOL_ERRORS,
3176
+ ...GATEWAY_VAULT_ERRORS,
3177
+ ...VAULT_ERRORS
3025
3178
  };
3026
3179
  /**
3027
3180
  * Error Messages
@@ -3139,6 +3292,8 @@ const ERROR_MESSAGES = {
3139
3292
  [BARE_ERRORS.BARE_INVALID_DATE_RANGE]: "startDate must be before endDate",
3140
3293
  [BARE_ERRORS.BARE_INVALID_DATE]: "Invalid date format. Use ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.sssZ)",
3141
3294
  [BARE_ERRORS.BARE_UNKNOWN_ERROR]: "Failed to delete project",
3295
+ [BARE_ERRORS.BARE_NOT_FOUND]: "Not found",
3296
+ [BARE_ERRORS.BARE_FORBIDDEN]: "Forbidden",
3142
3297
  [LOWERCASE_ERRORS.LOWERCASE_INVALID_JSON]: "Request body must be valid JSON",
3143
3298
  [LOWERCASE_ERRORS.LOWERCASE_VALIDATION_ERROR]: "Invalid request body",
3144
3299
  [BOUNCER_LOWERCASE_ERRORS.LOWERCASE_NO_PROJECT]: "API key is not associated with a project",
@@ -3232,7 +3387,22 @@ const ERROR_MESSAGES = {
3232
3387
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_HOLDER_MISMATCH]: "The holder does not match the delegation or grant",
3233
3388
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_INVALID_SIGNATURE]: "The signature could not be verified",
3234
3389
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_SESSION_MISMATCH]: "The session does not match the delegation or proof",
3235
- [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_POLICY_UNAVAILABLE]: "The policy revision is currently unavailable"
3390
+ [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_POLICY_UNAVAILABLE]: "The policy revision is currently unavailable",
3391
+ [GATEWAY_VAULT_ERRORS.MALFORMED_REQUEST_BODY]: "Malformed JSON body",
3392
+ [GATEWAY_VAULT_ERRORS.GATEWAY_NOT_CONFIGURED]: "Gateway public key or trusted DID not configured for this project",
3393
+ [GATEWAY_VAULT_ERRORS.INVALID_ASSERTION]: "Assertion JWT must have 3 parts",
3394
+ [GATEWAY_VAULT_ERRORS.INVALID_SIGNATURE]: "Assertion signature verification failed",
3395
+ [GATEWAY_VAULT_ERRORS.ASSERTION_EXPIRED]: "Assertion is expired or outside the allowed window",
3396
+ [GATEWAY_VAULT_ERRORS.ASSERTION_REPLAYED]: "Assertion nonce has already been used",
3397
+ [GATEWAY_VAULT_ERRORS.PROJECT_MISMATCH]: "Assertion projectId does not match route",
3398
+ [GATEWAY_VAULT_ERRORS.ISSUER_MISMATCH]: "Assertion issuer does not match trusted gateway DID",
3399
+ [GATEWAY_VAULT_ERRORS.USER_DID_MISMATCH]: "Assertion userDid does not match request body userDid",
3400
+ [GATEWAY_VAULT_ERRORS.TOOL_NAME_MISMATCH]: "Assertion toolName does not match request body toolName",
3401
+ [GATEWAY_VAULT_ERRORS.SESSION_ID_MISMATCH]: "Assertion sessionId does not match request body sessionId",
3402
+ [GATEWAY_VAULT_ERRORS.NOT_AUTHORIZED]: "User is not a member of this organization",
3403
+ [GATEWAY_VAULT_ERRORS.CREDENTIALS_NOT_CONFIGURED]: "Connect your credentials in Checkpoint",
3404
+ [GATEWAY_VAULT_ERRORS.OAUTH_EXPIRED]: "Provider token expired; user must reconnect",
3405
+ [VAULT_ERRORS.NO_AGENT_KEY]: "No agent deployment found for this project"
3236
3406
  };
3237
3407
  /**
3238
3408
  * HTTP Status Codes for Errors
@@ -3284,6 +3454,8 @@ const ERROR_STATUS_CODES = {
3284
3454
  [BOUNCER_UPPERCASE_ERRORS.INVALID_REQUEST_ID]: 400,
3285
3455
  [AUDIT_ERRORS.AUDIT_INVALID_JSON]: 400,
3286
3456
  [AUDIT_ERRORS.AUDIT_INVALID_SUBMISSION]: 400,
3457
+ [GATEWAY_VAULT_ERRORS.MALFORMED_REQUEST_BODY]: 400,
3458
+ [GATEWAY_VAULT_ERRORS.INVALID_ASSERTION]: 400,
3287
3459
  [AUTH_ERRORS.INVALID_API_KEY]: 401,
3288
3460
  [AUTH_ERRORS.EXPIRED_API_KEY]: 401,
3289
3461
  [AUTH_ERRORS.INVALID_TOKEN]: 401,
@@ -3295,6 +3467,7 @@ const ERROR_STATUS_CODES = {
3295
3467
  [BOUNCER_LOWERCASE_ERRORS.LOWERCASE_UNAUTHORIZED]: 401,
3296
3468
  [AUDIT_ERRORS.AUDIT_CREDENTIAL_REQUIRED]: 401,
3297
3469
  [AUDIT_ERRORS.AUDIT_INVALID_CREDENTIAL]: 401,
3470
+ [GATEWAY_VAULT_ERRORS.INVALID_SIGNATURE]: 401,
3298
3471
  [BILLING_ERRORS.LIMIT_EXCEEDED]: 402,
3299
3472
  [BILLING_ERRORS.BILLING_SUSPENDED]: 402,
3300
3473
  [PERMISSION_ERRORS.INSUFFICIENT_PERMISSIONS]: 403,
@@ -3316,6 +3489,16 @@ const ERROR_STATUS_CODES = {
3316
3489
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_DELEGATION_REVOKED]: 403,
3317
3490
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_HOLDER_MISMATCH]: 403,
3318
3491
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_INVALID_SIGNATURE]: 403,
3492
+ [BARE_ERRORS.BARE_FORBIDDEN]: 403,
3493
+ [GATEWAY_VAULT_ERRORS.ASSERTION_EXPIRED]: 403,
3494
+ [GATEWAY_VAULT_ERRORS.ASSERTION_REPLAYED]: 403,
3495
+ [GATEWAY_VAULT_ERRORS.PROJECT_MISMATCH]: 403,
3496
+ [GATEWAY_VAULT_ERRORS.ISSUER_MISMATCH]: 403,
3497
+ [GATEWAY_VAULT_ERRORS.USER_DID_MISMATCH]: 403,
3498
+ [GATEWAY_VAULT_ERRORS.TOOL_NAME_MISMATCH]: 403,
3499
+ [GATEWAY_VAULT_ERRORS.SESSION_ID_MISMATCH]: 403,
3500
+ [GATEWAY_VAULT_ERRORS.NOT_AUTHORIZED]: 403,
3501
+ [GATEWAY_VAULT_ERRORS.OAUTH_EXPIRED]: 403,
3319
3502
  [PERMISSION_ERRORS.RESOURCE_NOT_FOUND]: 404,
3320
3503
  [API_ERRORS.ENDPOINT_NOT_FOUND]: 404,
3321
3504
  [PIXEL_ERRORS.PIXEL_NOT_FOUND]: 404,
@@ -3333,6 +3516,9 @@ const ERROR_STATUS_CODES = {
3333
3516
  [BOUNCER_UPPERCASE_ERRORS.DEPLOYMENT_NOT_FOUND]: 404,
3334
3517
  [BOUNCER_UPPERCASE_ERRORS.DELEGATION_REQUEST_NOT_FOUND]: 404,
3335
3518
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_INVALID_SESSION]: 404,
3519
+ [BARE_ERRORS.BARE_NOT_FOUND]: 404,
3520
+ [GATEWAY_VAULT_ERRORS.CREDENTIALS_NOT_CONFIGURED]: 404,
3521
+ [VAULT_ERRORS.NO_AGENT_KEY]: 404,
3336
3522
  [API_ERRORS.METHOD_NOT_ALLOWED]: 405,
3337
3523
  [RESOURCE_ERRORS.CONFLICT]: 409,
3338
3524
  [AUDIT_PROTOCOL_ERRORS.AUDIT_LEDGER_MISMATCH]: 409,
@@ -3384,6 +3570,7 @@ const ERROR_STATUS_CODES = {
3384
3570
  [AUDIT_PROTOCOL_ERRORS.AUDIT_MIRROR_VERIFICATION_FAILED]: 500,
3385
3571
  [AUDIT_PROTOCOL_ERRORS.AUDIT_MIRROR_CONTINUITY_FAILED]: 500,
3386
3572
  [AUDIT_PROTOCOL_ERRORS.AUDIT_MIRROR_OUT_OF_ORDER]: 500,
3573
+ [GATEWAY_VAULT_ERRORS.GATEWAY_NOT_CONFIGURED]: 500,
3387
3574
  [NETWORK_ERRORS.UPSTREAM_ERROR]: 502,
3388
3575
  [INTERNAL_ERRORS.INITIALIZATION_ERROR]: 503,
3389
3576
  [INTERNAL_ERRORS.SERVICE_UNAVAILABLE_TRANSIENT]: 503,
@@ -5595,6 +5782,191 @@ const VerificationCacheEntrySchema = require_schemas.object({
5595
5782
  expiresAt: require_schemas.number()
5596
5783
  });
5597
5784
 
5785
+ //#endregion
5786
+ //#region src/utils/allowed-domains.ts
5787
+ /**
5788
+ * A pixel's `configuration.allowedDomains`: the page hosts a pixel accepts
5789
+ * events from (`/api/v1/event` compares them to the event URL's hostname).
5790
+ *
5791
+ * Stored form is a bare, lowercase, punycoded host (`shop.example.com`) or a
5792
+ * leftmost wildcard (`*.example.com`, which covers `example.com` itself and
5793
+ * every subdomain, never a look-alike such as `evilexample.com`).
5794
+ *
5795
+ * The comparison side, `URL.hostname`, is always lowercase with no scheme,
5796
+ * port or path, so an entry stored as `*.Example.com`, `https://example.com`
5797
+ * or `example.com:443` never matched and 403'd every event. Entries are now
5798
+ * normalized on write, and legacy rows are normalized again on read so they
5799
+ * stop failing without a backfill.
5800
+ */
5801
+ const WILDCARD_PROBE_LABEL = "allowed-domain-wildcard-probe";
5802
+ const MAX_ALLOWED_DOMAIN_LENGTH = 300;
5803
+ /**
5804
+ * Most entries one pixel may list. Generous on purpose: each event checks
5805
+ * its host against every entry, and the list was uncapped before, so a
5806
+ * smaller cap could refuse an existing pixel's next save.
5807
+ */
5808
+ const MAX_ALLOWED_DOMAINS = 1e3;
5809
+ /** One DNS label after URL's lowercasing and punycoding. `_` occurs in real subdomains. */
5810
+ const HOST_LABEL = /^[a-z0-9_-]{1,63}$/;
5811
+ const DEFAULT_PORTS = /* @__PURE__ */ new Set(["80", "443"]);
5812
+ /** URL accepts empty labels and characters such as `;` or `,`, which no page host has. */
5813
+ function isHostName(host) {
5814
+ if (host.startsWith("[") && host.endsWith("]")) return true;
5815
+ return host.split(".").every((label) => HOST_LABEL.test(label));
5816
+ }
5817
+ function parseAllowedDomain(entry) {
5818
+ const trimmed = typeof entry === "string" ? entry.trim() : "";
5819
+ if (!trimmed) return { error: "Enter a domain such as shop.example.com" };
5820
+ if (trimmed.length > 300) return { error: `Must be at most ${300} characters` };
5821
+ const schemeMatch = /^([a-z][a-z0-9+.-]*):\/\//i.exec(trimmed);
5822
+ const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : "https";
5823
+ if (scheme !== "https" && scheme !== "http") return { error: "Use a domain name, e.g. shop.example.com" };
5824
+ const rest = schemeMatch ? trimmed.slice(schemeMatch[0].length) : trimmed;
5825
+ const wildcard = rest.startsWith("*.");
5826
+ const withoutWildcard = wildcard ? rest.slice(2) : rest;
5827
+ if (!withoutWildcard || withoutWildcard.includes("*")) return { error: "A wildcard is only allowed as the first label, e.g. *.example.com" };
5828
+ let url;
5829
+ try {
5830
+ url = new URL(`${scheme}://${wildcard ? `${WILDCARD_PROBE_LABEL}.` : ""}${withoutWildcard}`);
5831
+ } catch {
5832
+ return { error: "Not a valid domain" };
5833
+ }
5834
+ if (url.username || url.password) return { error: "Domains cannot contain a username" };
5835
+ let host = url.hostname.replace(/\.$/, "");
5836
+ if (wildcard) {
5837
+ if (!host.startsWith(`${WILDCARD_PROBE_LABEL}.`)) return { error: "Not a valid domain" };
5838
+ host = host.slice(30);
5839
+ }
5840
+ if (!isHostName(host)) return { error: "Not a valid domain" };
5841
+ return {
5842
+ host,
5843
+ wildcard,
5844
+ port: DEFAULT_PORTS.has(url.port) ? "" : url.port
5845
+ };
5846
+ }
5847
+ function format(parsed) {
5848
+ return `${parsed.wildcard ? "*." : ""}${parsed.host}`;
5849
+ }
5850
+ /**
5851
+ * `*.com`, `*.co.uk`, `*.myshopify.com`: a wildcard that admits sites the
5852
+ * customer does not control. Same rule as posture origins, so the two
5853
+ * allowlists refuse the same entries.
5854
+ */
5855
+ function isPublicSuffixWildcard(parsed) {
5856
+ return parsed.wildcard && require_posture_origins.isPublicSuffixLike(parsed.host);
5857
+ }
5858
+ /**
5859
+ * Strict write-time normalization. Returns the stored form, or an error for
5860
+ * junk: another scheme, userinfo, a misplaced wildcard, a host with an empty
5861
+ * label or a character no host has, a non-default port (the check compares
5862
+ * host names only, so a port would suggest a restriction that is never
5863
+ * enforced), or a wildcard over a public suffix.
5864
+ *
5865
+ * @example
5866
+ * normalizeAllowedDomainForWrite('HTTPS://Shop.Example.com:443/cart') // { ok: true, value: 'shop.example.com' }
5867
+ * normalizeAllowedDomainForWrite('*.Example.com.') // { ok: true, value: '*.example.com' }
5868
+ */
5869
+ function normalizeAllowedDomainForWrite(entry) {
5870
+ const parsed = parseAllowedDomain(entry);
5871
+ if ("error" in parsed) return {
5872
+ ok: false,
5873
+ error: parsed.error
5874
+ };
5875
+ if (parsed.port) return {
5876
+ ok: false,
5877
+ error: "Ports are not supported; the check matches the host name only"
5878
+ };
5879
+ if (isPublicSuffixWildcard(parsed)) return {
5880
+ ok: false,
5881
+ error: `*.${parsed.host} would include sites you do not control; list your own hosts instead`
5882
+ };
5883
+ return {
5884
+ ok: true,
5885
+ value: format(parsed)
5886
+ };
5887
+ }
5888
+ /**
5889
+ * Lenient read-time normalization for entries already stored: strips a
5890
+ * scheme, path, port and trailing dot and lowercases, so a legacy entry
5891
+ * such as `https://Example.com:443/` still matches. Undefined for entries
5892
+ * that cannot be a host at all (they then match nothing, as before).
5893
+ *
5894
+ * It never widens what a pixel accepts to a public suffix. A malformed
5895
+ * wildcard over one (`*.COM`, `https://*.co.uk`) matched nothing before, and
5896
+ * cleaning it up would admit every site under it, which writes now refuse.
5897
+ * So it stays undefined. One already stored in exact form (`*.com`) matched
5898
+ * before this normalization existed and is returned unchanged.
5899
+ */
5900
+ function normalizeStoredAllowedDomain(entry) {
5901
+ if (typeof entry !== "string") return void 0;
5902
+ const parsed = parseAllowedDomain(entry);
5903
+ if ("error" in parsed) return void 0;
5904
+ const normalized = format(parsed);
5905
+ if (isPublicSuffixWildcard(parsed) && entry !== normalized) return void 0;
5906
+ return normalized;
5907
+ }
5908
+ /**
5909
+ * Whether a page host is admitted by a pixel's allowed domains. Exact
5910
+ * entries match the host exactly; `*.example.com` matches `example.com`
5911
+ * and any subdomain, on a label boundary.
5912
+ *
5913
+ * @example
5914
+ * hostMatchesAllowedDomains('shop.example.com', ['*.Example.com']) // true
5915
+ * hostMatchesAllowedDomains('evilexample.com', ['*.example.com']) // false
5916
+ */
5917
+ function hostMatchesAllowedDomains(hostname, allowedDomains) {
5918
+ const host = hostname.toLowerCase().replace(/\.$/, "");
5919
+ if (!host) return false;
5920
+ return allowedDomains.some((raw) => {
5921
+ const entry = normalizeStoredAllowedDomain(raw);
5922
+ if (!entry) return false;
5923
+ if (!entry.startsWith("*.")) return host === entry;
5924
+ const base = entry.slice(2);
5925
+ return host === base || host.endsWith(`.${base}`);
5926
+ });
5927
+ }
5928
+ /**
5929
+ * Normalizes a whole list for a write: stored forms in first-seen order with
5930
+ * duplicates removed, plus each junk entry's index and reason. Linear in the
5931
+ * list's length.
5932
+ *
5933
+ * @example
5934
+ * normalizeAllowedDomainList(['Example.com', 'a..b', 'example.com'])
5935
+ * // { values: ['example.com'], errors: [{ index: 1, message: 'Not a valid domain' }] }
5936
+ */
5937
+ function normalizeAllowedDomainList(entries) {
5938
+ const values = /* @__PURE__ */ new Set();
5939
+ const errors = [];
5940
+ entries.forEach((entry, index) => {
5941
+ const result = normalizeAllowedDomainForWrite(entry);
5942
+ if (result.ok) values.add(result.value);
5943
+ else errors.push({
5944
+ index,
5945
+ message: result.error
5946
+ });
5947
+ });
5948
+ return {
5949
+ values: [...values],
5950
+ errors
5951
+ };
5952
+ }
5953
+ /**
5954
+ * `allowedDomains` on a pixel write: at most {@link MAX_ALLOWED_DOMAINS}
5955
+ * entries, each normalized to its stored form (duplicates removed), and each
5956
+ * junk entry reported at its index so the route's 400 says which one and
5957
+ * why. The cap is checked first, so an oversized list is refused without
5958
+ * normalizing any entry.
5959
+ */
5960
+ const AllowedDomainsSchema = require_schemas.array(require_schemas.string()).max(MAX_ALLOWED_DOMAINS, `At most ${MAX_ALLOWED_DOMAINS} allowed domains`).transform((entries, ctx) => {
5961
+ const { values, errors } = normalizeAllowedDomainList(entries);
5962
+ errors.forEach(({ index, message }) => ctx.addIssue({
5963
+ code: "custom",
5964
+ message,
5965
+ path: [index]
5966
+ }));
5967
+ return values;
5968
+ });
5969
+
5598
5970
  //#endregion
5599
5971
  //#region src/api/bulk.ts
5600
5972
  /**
@@ -5751,7 +6123,7 @@ const PixelsBulkCreateItemSchema = require_schemas.object({
5751
6123
  domain: require_schemas.string().url().optional(),
5752
6124
  isActive: require_schemas.boolean().default(true),
5753
6125
  configuration: require_schemas.object({
5754
- allowedDomains: require_schemas.array(require_schemas.string()).default([]),
6126
+ allowedDomains: AllowedDomainsSchema.default([]),
5755
6127
  collectBehavioral: require_schemas.boolean().default(true),
5756
6128
  enableFingerprinting: require_schemas.boolean().default(true),
5757
6129
  enableSessionTracking: require_schemas.boolean().default(true),
@@ -5764,7 +6136,7 @@ const PixelsBulkUpdateItemSchema = require_schemas.object({
5764
6136
  domain: require_schemas.string().url().optional(),
5765
6137
  isActive: require_schemas.boolean().optional(),
5766
6138
  configuration: require_schemas.object({
5767
- allowedDomains: require_schemas.array(require_schemas.string()).optional(),
6139
+ allowedDomains: AllowedDomainsSchema.optional(),
5768
6140
  collectBehavioral: require_schemas.boolean().optional(),
5769
6141
  enableFingerprinting: require_schemas.boolean().optional(),
5770
6142
  enableSessionTracking: require_schemas.boolean().optional(),
@@ -6021,7 +6393,7 @@ const ProjectSchema = require_schemas.object({
6021
6393
  const PixelConfigurationSchema = require_schemas.object({
6022
6394
  enabled: require_schemas.boolean().default(true),
6023
6395
  skipPaths: require_schemas.array(require_schemas.string()).default([]),
6024
- allowedDomains: require_schemas.array(require_schemas.string()).default([]),
6396
+ allowedDomains: AllowedDomainsSchema.default([]),
6025
6397
  blockedAgents: require_schemas.array(require_schemas.string()).default([]),
6026
6398
  batchSize: require_schemas.number().min(1).max(100).default(10),
6027
6399
  flushInterval: require_schemas.number().min(100).max(6e4).default(5e3),
@@ -6583,6 +6955,31 @@ const ConsentAgentMetadataSchema = require_schemas.object({
6583
6955
  connectedAt: require_schemas.string().datetime().optional()
6584
6956
  });
6585
6957
  /**
6958
+ * Brand copy for one input the consent page asks a person to fill in. Copy
6959
+ * only: which inputs appear is the project's consent policy's call (its
6960
+ * sign-in methods and assurance providers), never this config's.
6961
+ */
6962
+ const ConsentInputCopySchema = require_schemas.object({
6963
+ label: require_schemas.string().max(80).optional(),
6964
+ /** A typed field's placeholder, or the hint line under it where the step has one. */
6965
+ hint: require_schemas.string().max(200).optional()
6966
+ });
6967
+ const ConsentSignInCopySchema = require_schemas.object({
6968
+ /** The address field of the email-code and email-and-password sign-ins. */
6969
+ email: ConsentInputCopySchema.optional(),
6970
+ password: ConsentInputCopySchema.optional(),
6971
+ /** The RPPS number step (`registry:fr-rpps`); `prompt` is its heading. */
6972
+ rpps: ConsentInputCopySchema.extend({ prompt: require_schemas.string().max(120).optional() }).optional()
6973
+ });
6974
+ /** A consent policy names a handful of scopes; this only bounds the stored map. */
6975
+ const MAX_SCOPE_LABELS = 50;
6976
+ /**
6977
+ * The brand's name for a scope no authored capability covers, keyed by the
6978
+ * literal scope. Copy only: unlike a capability, a label here never makes a
6979
+ * scope grantable (`allowedScopesFor` does not read it) and carries no Cedar.
6980
+ */
6981
+ const ConsentScopeLabelsSchema = require_schemas.record(require_schemas.string().min(1).max(120), require_schemas.string().min(1).max(80)).refine((labels) => Object.keys(labels).length <= MAX_SCOPE_LABELS, `At most ${MAX_SCOPE_LABELS} scope labels`);
6982
+ /**
6586
6983
  * Full Consent Configuration
6587
6984
  */
6588
6985
  const ConsentConfigSchema = require_schemas.object({
@@ -6599,7 +6996,9 @@ const ConsentConfigSchema = require_schemas.object({
6599
6996
  headlineVerb: require_schemas.string().min(1).max(40).optional(),
6600
6997
  revocationPath: require_schemas.string().min(1).max(120).optional(),
6601
6998
  inactivityDays: require_schemas.number().int().min(1).max(3650).optional(),
6602
- authorizationHost: require_schemas.string().min(1).max(255).optional()
6999
+ authorizationHost: require_schemas.string().min(1).max(255).optional(),
7000
+ signInCopy: ConsentSignInCopySchema.optional(),
7001
+ scopeLabels: ConsentScopeLabelsSchema.optional()
6603
7002
  });
6604
7003
  /**
6605
7004
  * Tool Consent Overrides (CRED-002)
@@ -7377,7 +7776,36 @@ const MarketplaceSourceSchema = require_schemas._enum([
7377
7776
  ]);
7378
7777
  /** Enforcement posture — mirrors the SDK's `enforcementMode` ('observe' = detect-only). */
7379
7778
  const ProvisioningModeSchema = require_schemas._enum(["observe", "enforce"]);
7779
+ /** Backend-verifiable installer identity. Caller-supplied verification flags confer no authority. */
7780
+ const ProvisioningIdentityProofSchema = require_schemas.discriminatedUnion("type", [
7781
+ require_schemas.object({
7782
+ type: require_schemas.literal("vercel-oidc"),
7783
+ token: require_schemas.string().min(1).max(16384)
7784
+ }),
7785
+ require_schemas.object({
7786
+ type: require_schemas.literal("railway-oauth"),
7787
+ accessToken: require_schemas.string().min(1).max(16384)
7788
+ }),
7789
+ require_schemas.object({
7790
+ type: require_schemas.literal("checkpoint-account-link"),
7791
+ token: require_schemas.string().min(1).max(16384)
7792
+ })
7793
+ ]);
7794
+ /** A signed account-link capability issued only from the installer's authenticated session. */
7795
+ const ProvisioningAccountLinkRequestSchema = require_schemas.object({
7796
+ source: MarketplaceSourceSchema,
7797
+ externalId: require_schemas.string().min(1).max(255),
7798
+ resourceId: require_schemas.string().min(1).max(255).optional()
7799
+ });
7800
+ const ProvisioningAccountLinkResponseSchema = require_schemas.object({
7801
+ identityProof: require_schemas.object({
7802
+ type: require_schemas.literal("checkpoint-account-link"),
7803
+ token: require_schemas.string().min(1)
7804
+ }),
7805
+ expiresIn: require_schemas.literal(600)
7806
+ });
7380
7807
  const ProvisionKeyRequestSchema = require_schemas.object({
7808
+ identityProof: ProvisioningIdentityProofSchema.optional(),
7381
7809
  source: MarketplaceSourceSchema,
7382
7810
  /** Provider installation/configuration id (e.g. Vercel configurationId). */
7383
7811
  externalId: require_schemas.string().min(1).max(255),
@@ -7390,12 +7818,7 @@ const ProvisionKeyRequestSchema = require_schemas.object({
7390
7818
  resourceId: require_schemas.string().min(1).max(255),
7391
7819
  /** Human-readable label for the dashboard (e.g. "Vercel / team_xxx / my-project"). */
7392
7820
  label: require_schemas.string().min(1).max(200),
7393
- /**
7394
- * Owner of the provisioned project. `email` is the account-linking key: we find-or-create
7395
- * the KYA-OS user + personal org from it (Shopify-parity), so an address matching an
7396
- * existing account provisions INTO that account — including the org it lands in.
7397
- *
7398
- */
7821
+ /** Installer email must match the identity established by identityProof. */
7399
7822
  owner: require_schemas.object({
7400
7823
  email: require_schemas.string().email(),
7401
7824
  name: require_schemas.string().min(1).max(255).optional()
@@ -7429,15 +7852,16 @@ const ProvisionKeyResponseSchema = require_schemas.object({
7429
7852
  });
7430
7853
  /**
7431
7854
  * Request for `POST /api/provisioning/sso-link` — the "Open in Provider" handoff.
7432
- * The adapter has already verified `ownerEmail` via the provider's OIDC token.
7855
+ * The backend verifies `ownerEmail` using provider evidence or an authenticated account-link ticket.
7433
7856
  */
7434
7857
  const SsoLinkRequestSchema = require_schemas.object({
7858
+ identityProof: ProvisioningIdentityProofSchema.optional(),
7435
7859
  source: MarketplaceSourceSchema,
7436
7860
  /** Provider installation/configuration id (e.g. Vercel configurationId). */
7437
7861
  externalId: require_schemas.string().min(1).max(255),
7438
7862
  /** Optional provider resource id — present → deep-link to that project; absent → org landing. */
7439
7863
  resourceId: require_schemas.string().min(1).max(255).optional(),
7440
- /** Verified installer email (the OIDC `user_email` claim). */
7864
+ /** Installer email must match the identity established by identityProof. */
7441
7865
  ownerEmail: require_schemas.string().email()
7442
7866
  });
7443
7867
  const SsoLinkResponseSchema = require_schemas.object({
@@ -7477,7 +7901,13 @@ const ProvisioningOrganizationSummarySchema = require_schemas.object({
7477
7901
  role: ProvisioningOrganizationRoleSchema
7478
7902
  });
7479
7903
  /** List a user's administrable orgs by verified email. No user match ⇒ `{ organizations: [] }`. */
7480
- const ListProvisioningOrganizationsRequestSchema = require_schemas.object({ email: require_schemas.string().email() });
7904
+ const ListProvisioningOrganizationsRequestSchema = require_schemas.object({
7905
+ source: MarketplaceSourceSchema.optional(),
7906
+ externalId: require_schemas.string().min(1).max(255).optional(),
7907
+ resourceId: require_schemas.string().min(1).max(255).optional(),
7908
+ identityProof: ProvisioningIdentityProofSchema.optional(),
7909
+ email: require_schemas.string().email()
7910
+ });
7481
7911
  const ListProvisioningOrganizationsResponseSchema = require_schemas.object({ organizations: require_schemas.array(ProvisioningOrganizationSummarySchema) });
7482
7912
  /**
7483
7913
  * Create an org for a (found-or-created) user by verified email. `name`/`slug` reuse the
@@ -7485,6 +7915,10 @@ const ListProvisioningOrganizationsResponseSchema = require_schemas.object({ org
7485
7915
  * accept exactly the same input.
7486
7916
  */
7487
7917
  const CreateProvisioningOrganizationRequestSchema = require_schemas.object({
7918
+ source: MarketplaceSourceSchema.optional(),
7919
+ externalId: require_schemas.string().min(1).max(255).optional(),
7920
+ resourceId: require_schemas.string().min(1).max(255).optional(),
7921
+ identityProof: ProvisioningIdentityProofSchema.optional(),
7488
7922
  email: require_schemas.string().email(),
7489
7923
  name: CreateOrganizationInputSchema.shape.name,
7490
7924
  slug: CreateOrganizationInputSchema.shape.slug
@@ -8072,30 +8506,13 @@ const ShopifySessionsPaginationSchema = require_schemas.object({
8072
8506
  totalPages: require_schemas.number().int().nonnegative().describe("`min(ceil(total / limit), 200)`: the last page `sessionsPage` accepts."),
8073
8507
  hasMore: require_schemas.boolean().describe("True when `page < totalPages`.")
8074
8508
  });
8075
- /**
8076
- * Shopify Stats Response
8077
- *
8078
- * Every counter is a SESSION count, not an event count. `totalRequests` is
8079
- * the number of sessions in the window and `blockedBots` the AI-agent
8080
- * sessions among them.
8081
- *
8082
- * `crawlerSessions` and `humanSessions` complete the four-way split
8083
- * (AI agent / crawler / human / unclassified). Both are optional in both
8084
- * directions: an older Checkpoint does not send them, and an older Shopify
8085
- * app ignores them. When present they come from the same per-session
8086
- * classification as `blockedBots` (ai_agent > bot > human priority), so
8087
- * `blockedBots + crawlerSessions + humanSessions <= totalRequests`; the
8088
- * remainder is sessions that belong to no class.
8089
- *
8090
- * `sessions` and `sessionsPagination` are present only when the request
8091
- * asks for them (`include=sessions`); an older Checkpoint never sends them.
8092
- */
8093
8509
  const ShopifyStatsResponseSchema = require_schemas.object({
8094
8510
  totalRequests: require_schemas.number().int().nonnegative(),
8095
8511
  blockedBots: require_schemas.number().int().nonnegative(),
8096
8512
  allowedRequests: require_schemas.number().int().nonnegative(),
8097
8513
  crawlerSessions: require_schemas.number().int().nonnegative().optional(),
8098
8514
  humanSessions: require_schemas.number().int().nonnegative().optional(),
8515
+ unidentifiedSessions: require_schemas.number().int().nonnegative().optional().describe("Sessions in the window with no ai_agent, bot or human detection and at least one incomplete-data detection that carries the no_evidence basis: an idle visitor the engine had nothing to weigh. They are counted in `totalRequests` and `humanSessions`, so this says how many of the human sessions the engine could not classify. Sessions whose incomplete-data detections all have another reason, such as suspicious headers, are in no counter. A window over 31 days is counted the same way, one UTC day at a time, from the daily rollups. Omitted when the session split is unavailable: a window over 31 days served from a cached result that predates the split, and older deployments."),
8099
8516
  threatLevel: require_schemas._enum([
8100
8517
  "low",
8101
8518
  "medium",
@@ -10318,6 +10735,14 @@ const FingerprintSearchQuerySchema = require_schemas.object({
10318
10735
  ]).default("timestamp"),
10319
10736
  sortOrder: require_schemas._enum(["asc", "desc"]).default("desc")
10320
10737
  });
10738
+ /**
10739
+ * Test result when running detection on a fingerprint.
10740
+ *
10741
+ * @deprecated Nothing in this repository builds or parses it; the
10742
+ * `/fingerprint/test` route returns its own shape. Kept because this file is
10743
+ * the package's public type surface and a shipped CHANGELOG entry names it.
10744
+ * Remove in the next major.
10745
+ */
10321
10746
  const DetectionTestResultSchema = require_schemas.object({
10322
10747
  fingerprintId: require_schemas.string(),
10323
10748
  timestamp: require_schemas.date(),
@@ -10372,8 +10797,8 @@ const PublishProfileRequestSchema = require_schemas.object({
10372
10797
  version: require_schemas.string().optional()
10373
10798
  });
10374
10799
  const TestDetectionRequestSchema = require_schemas.object({
10375
- fingerprintId: require_schemas.string(),
10376
- integrationTypes: require_schemas.array(IntegrationTypeSchema).optional()
10800
+ fingerprintId: require_schemas.string().uuid(),
10801
+ integrationTypes: require_schemas.array(IntegrationTypeSchema).min(1, "integrationTypes must list at least one integration type, or be omitted entirely").optional()
10377
10802
  });
10378
10803
  function generateTestId() {
10379
10804
  return `test-${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 8)}`;
@@ -10862,7 +11287,8 @@ const ADMIN_OVERVIEW_SECTIONS = [
10862
11287
  "installations",
10863
11288
  "traffic",
10864
11289
  "lists",
10865
- "hiAi"
11290
+ "hiAi",
11291
+ "accounts"
10866
11292
  ];
10867
11293
  /** Cache states a section can report in `meta.cache.status`. */
10868
11294
  const ADMIN_OVERVIEW_CACHE_STATUSES = [
@@ -10883,6 +11309,51 @@ const SERVICE_TRAFFIC_KEYS = [
10883
11309
  "mixed",
10884
11310
  "none"
10885
11311
  ];
11312
+ /**
11313
+ * Headline numbers that show "N counted · M excluded" and open a drill-down
11314
+ * of every account behind them. The first five mirror the ladder steps
11315
+ * (signedIn is the ladder's signedInProxy); the last three are the KYA-1147
11316
+ * people numbers.
11317
+ */
11318
+ const ADMIN_TRUSTED_METRICS = [
11319
+ "emailsCollected",
11320
+ "users",
11321
+ "signedIn",
11322
+ "onboarded",
11323
+ "activated",
11324
+ "activeUsers",
11325
+ "peopleInOrgs",
11326
+ "installedOrgs"
11327
+ ];
11328
+ /**
11329
+ * Why an account a user-level exclusion did not catch is still left out:
11330
+ * every org that would count it is test-named (`test_org`), or, for an org
11331
+ * row, none of its members is a counted person (`no_counted_members`).
11332
+ */
11333
+ const ADMIN_ORG_EXCLUSION_REASONS = ["test_org", "no_counted_members"];
11334
+ /** `counted`, or the first rule that left the account out (user buckets take precedence). */
11335
+ const ADMIN_ACCOUNT_STATUSES = [
11336
+ "counted",
11337
+ ...EXCLUSION_BUCKETS,
11338
+ ...ADMIN_ORG_EXCLUSION_REASONS
11339
+ ];
11340
+ /** GET /api/admin/overview/accounts query. */
11341
+ /** Drill-down status filter: everyone, any exclusion, or one status. */
11342
+ const ADMIN_ACCOUNTS_STATUS_FILTERS = [
11343
+ "all",
11344
+ "excluded",
11345
+ ...ADMIN_ACCOUNT_STATUSES
11346
+ ];
11347
+ /**
11348
+ * GET /api/admin/overview/accounts query. `status` filters on the server,
11349
+ * so the row cap applies to the filtered list and an exclusion is never cut
11350
+ * off by counted rows.
11351
+ */
11352
+ const adminAccountsQuerySchema = require_schemas.object({
11353
+ metric: require_schemas._enum(ADMIN_TRUSTED_METRICS),
11354
+ window: require_schemas._enum(ADMIN_OVERVIEW_WINDOWS).default("30d"),
11355
+ status: require_schemas._enum(ADMIN_ACCOUNTS_STATUS_FILTERS).default("all")
11356
+ });
10886
11357
 
10887
11358
  //#endregion
10888
11359
  //#region src/types/api.ts
@@ -11076,74 +11547,6 @@ function createValidationErrorResponse(message, details, meta) {
11076
11547
  };
11077
11548
  }
11078
11549
 
11079
- //#endregion
11080
- //#region src/utils/detection-class.ts
11081
- /**
11082
- * Convert DetectionClass discriminated union to database enum string
11083
- * Note: Automation and Unknown are legacy types, converted to Bot and IncompleteData respectively
11084
- */
11085
- function detectionClassToEnum(detectionClass) {
11086
- switch (detectionClass.type) {
11087
- case "Human": return "human";
11088
- case "AiAgent": return "ai_agent";
11089
- case "Automation": return "bot";
11090
- case "Bot": return "bot";
11091
- case "IncompleteData": return "incomplete_data";
11092
- default: return "incomplete_data";
11093
- }
11094
- }
11095
- /**
11096
- * Convert database enum string to DetectionClass discriminated union
11097
- * Handles both current and legacy enum values for backwards compatibility
11098
- */
11099
- function enumToDetectionClass(enumValue) {
11100
- switch (enumValue) {
11101
- case "human": return { type: "Human" };
11102
- case "ai_agent": return { type: "AiAgent" };
11103
- case "automation": return { type: "Bot" };
11104
- case "bot": return { type: "Bot" };
11105
- case "incomplete_data": return { type: "IncompleteData" };
11106
- case "unknown": return { type: "IncompleteData" };
11107
- default: return { type: "IncompleteData" };
11108
- }
11109
- }
11110
- /**
11111
- * Check if a value is a valid string-based detection class (current or legacy)
11112
- */
11113
- function isLegacyDetectionClass(value) {
11114
- return typeof value === "string" && [
11115
- "human",
11116
- "ai_agent",
11117
- "bot",
11118
- "incomplete_data",
11119
- "automation",
11120
- "unknown"
11121
- ].includes(value);
11122
- }
11123
- /**
11124
- * Migrate legacy string detection class to new discriminated union
11125
- * @deprecated Use enumToDetectionClass instead
11126
- */
11127
- function migrateLegacyDetectionClass(value) {
11128
- return enumToDetectionClass(value);
11129
- }
11130
- /**
11131
- * Safely convert any detection class value to the discriminated union format
11132
- */
11133
- function normalizeDetectionClass(value) {
11134
- if (value && typeof value === "object" && "type" in value) return value;
11135
- if (isLegacyDetectionClass(value)) return enumToDetectionClass(value);
11136
- return { type: "IncompleteData" };
11137
- }
11138
- /**
11139
- * Safely convert any detection class value to database enum format
11140
- */
11141
- function normalizeDetectionClassEnum(value) {
11142
- if (value && typeof value === "object" && "type" in value) return detectionClassToEnum(value);
11143
- if (isLegacyDetectionClass(value)) return detectionClassToEnum(enumToDetectionClass(value));
11144
- return "incomplete_data";
11145
- }
11146
-
11147
11550
  //#endregion
11148
11551
  //#region src/utils/agent-runtime-label.ts
11149
11552
  /**
@@ -11681,6 +12084,35 @@ const RecommendationGenerationSchema = require_schemas.object({
11681
12084
  forceRefresh: require_schemas.boolean().optional().default(false)
11682
12085
  });
11683
12086
 
12087
+ //#endregion
12088
+ //#region src/schemas/consent-policy-endpoint.ts
12089
+ /**
12090
+ * Wire shape of `GET /api/v1/kya-os/consent-policy`, defined once here. The
12091
+ * response is the project's consent policy as a client needs to render and
12092
+ * pre-check it; it is authenticated with the project API key.
12093
+ *
12094
+ * `etag` is the BARE hash (lowercase hex). The HTTP `ETag` header carries the
12095
+ * same value as a quoted strong validator, `"<etag>"`, on 200 and 304.
12096
+ * `riskLevel` is ConsentConfig's capability risk set, unchanged.
12097
+ */
12098
+ const ConsentPolicyRiskLevelSchema = require_schemas._enum([
12099
+ "low",
12100
+ "medium",
12101
+ "high",
12102
+ "critical"
12103
+ ]);
12104
+ const ConsentPolicyCapabilitySchema = require_schemas.strictObject({
12105
+ scope: require_schemas.string().min(1),
12106
+ defaultOn: require_schemas.boolean(),
12107
+ riskLevel: ConsentPolicyRiskLevelSchema
12108
+ });
12109
+ const ConsentPolicyResponseSchema = require_schemas.strictObject({
12110
+ allowedScopes: require_schemas.array(require_schemas.string().min(1)).optional(),
12111
+ maxGrantSeconds: require_schemas.number().int().positive().optional(),
12112
+ capabilities: require_schemas.array(ConsentPolicyCapabilitySchema).optional(),
12113
+ etag: require_schemas.string().regex(/^[0-9a-f]{64}$/)
12114
+ });
12115
+
11684
12116
  //#endregion
11685
12117
  //#region src/wire/gateway-internal-tools.ts
11686
12118
  /**
@@ -11833,20 +12265,14 @@ function isPrivateOrReservedHost(hostname) {
11833
12265
  * octal/hex-encoded SSRF bypasses like `0177.0.0.01` → `127.0.0.1`.
11834
12266
  */
11835
12267
  function parseIPv4Octet(part) {
11836
- if (/^0x[0-9a-f]+$/i.test(part)) {
11837
- const n = parseInt(part, 16);
11838
- return Number.isNaN(n) ? null : n;
11839
- }
11840
- if (/^0[0-7]+$/.test(part)) {
11841
- const n = parseInt(part, 8);
11842
- return Number.isNaN(n) ? null : n;
11843
- }
12268
+ if (/^0x[0-9a-f]+$/i.test(part)) return parseInt(part, 16);
12269
+ if (/^0[0-7]+$/.test(part)) return parseInt(part, 8);
11844
12270
  if (/^(0|[1-9]\d*)$/.test(part)) return parseInt(part, 10);
11845
12271
  return null;
11846
12272
  }
11847
12273
  function isPrivateIPv4(ip) {
11848
12274
  const parts = ip.split(".").map(Number);
11849
- if (parts.length !== 4 || parts.some((p) => isNaN(p) || p < 0 || p > 255)) return false;
12275
+ if (parts.some((p) => p > 255)) return false;
11850
12276
  const [a, b] = parts;
11851
12277
  if (a === 0) return true;
11852
12278
  if (a === 127) return true;
@@ -11955,7 +12381,8 @@ const upstreamServerSchema = require_schemas.object({
11955
12381
  });
11956
12382
  /**
11957
12383
  * Input variant — id/slug optional for new upstreams (auto-generated by PUT
11958
- * handler). Also omits the two server-managed static-headers fields:
12384
+ * handler). Also omits server-managed project ownership and the two
12385
+ * server-managed static-headers fields:
11959
12386
  * `staticHeadersEncrypted` (ciphertext — clients never author this
11960
12387
  * directly) and `staticHeaderKeys` (a read-only projection echoed back on
11961
12388
  * GET/PUT responses). The plaintext `staticHeaders` field is intentionally
@@ -11963,6 +12390,7 @@ const upstreamServerSchema = require_schemas.object({
11963
12390
  * values; the PUT handler encrypts it before persisting.
11964
12391
  */
11965
12392
  const upstreamServerInputSchema = upstreamServerSchema.omit({
12393
+ projectId: true,
11966
12394
  staticHeadersEncrypted: true,
11967
12395
  staticHeaderKeys: true
11968
12396
  }).extend({
@@ -14366,13 +14794,21 @@ const PolicyConfigSchema = require_schemas.object({
14366
14794
  * Trusted Layer-2 delegation root DIDs for the project's org (P2 / DR-1),
14367
14795
  * server-resolved by the policy API. A consuming middleware forwards these
14368
14796
  * into the engine's `ContextSpec.trustedDelegationRoots` so L2 delegation
14369
- * chains are pinned to the org DID. Absent ⇒ omitted (root pinning disabled —
14370
- * the engine's open default, byte-identical to pre-P2). Optional (no default)
14797
+ * chains are pinned to the org DID. Absent ⇒ omitted, and the engine rejects
14798
+ * delegation. Optional (no default)
14371
14799
  * so a policy without the field round-trips as `undefined`, matching the
14372
14800
  * policy API's `PolicyResponse` shape and the orchestrator's omit-when-unset
14373
14801
  * contract.
14374
14802
  */
14375
- trustedDelegationRoots: require_schemas.array(require_schemas.string()).optional()
14803
+ trustedDelegationRoots: require_schemas.array(require_schemas.string()).optional(),
14804
+ /**
14805
+ * The org's one OAuth authorization server issuer (RFC 8414 `issuer`), as the
14806
+ * platform's IssuerContext computes it (`https://<branded host or platform>/oauth/<slug>`).
14807
+ * A middleware that serves protected resource metadata advertises exactly
14808
+ * this in `authorization_servers` and never builds an issuer URL itself.
14809
+ * Absent ⇒ the platform could not resolve the org; serve no metadata.
14810
+ */
14811
+ authorizationServerIssuer: require_schemas.string().url().optional()
14376
14812
  });
14377
14813
  const PolicyEvaluationContextSchema = require_schemas.object({
14378
14814
  agentType: require_schemas.string().optional(),
@@ -14678,296 +15114,6 @@ function createResult(action, reason, matchType, extras) {
14678
15114
  };
14679
15115
  }
14680
15116
 
14681
- //#endregion
14682
- //#region src/policy/cedar-string.ts
14683
- /**
14684
- * The Cedar double-quoted string grammar shared by the compose engine's emitter/
14685
- * parser and every enforcement-path TEXT reader (required-scopes, cedar-rule-match).
14686
- * Keeping the escape codec AND the capture pattern in one place means a value the
14687
- * emitter escapes is decoded identically wherever a reader parses it back — they
14688
- * can never drift. (Rust/.NET parse Cedar with a real parser and are unaffected.)
14689
- */
14690
- /** Escape a value for embedding inside a Cedar double-quoted string literal. */
14691
- function escapeCedarString(value) {
14692
- return value.replace(/\\/g, "\\\\").replace(/"/g, "\\\"").replace(/\n/g, "\\n").replace(/\r/g, "\\r").replace(/\t/g, "\\t");
14693
- }
14694
- /** Inverse of {@link escapeCedarString} — decode Cedar string escapes to raw text. */
14695
- function unescapeCedarString(value) {
14696
- return value.replace(/\\([\\"nrt])/g, (_m, ch) => ch === "n" ? "\n" : ch === "r" ? "\r" : ch === "t" ? " " : ch);
14697
- }
14698
- /**
14699
- * Build a RegExp matching `<prefixSource>"<body>"`, where <body> is an escape-aware
14700
- * Cedar string. Capture group 1 is the RAW (still-escaped) body — pass it through
14701
- * {@link unescapeCedarString} before use. `prefixSource` is a regex-source fragment
14702
- * (escape its own metacharacters). This is the single source of the quoted-string
14703
- * capture pattern.
14704
- */
14705
- function cedarQuotedValueRegExp(prefixSource, flags = "") {
14706
- return new RegExp(`${prefixSource}"((?:\\\\.|[^"\\\\])*)"`, flags);
14707
- }
14708
-
14709
- //#endregion
14710
- //#region src/policy/cedar-rule-match.ts
14711
- /**
14712
- * Shared best-effort matchers for reading a composed Cedar policy's per-rule
14713
- * annotations (`@scopes`, `@approvers`, …) WITHOUT a Cedar AST. Both
14714
- * `requiredScopesForRequest` (consent scopes) and `approvalQuorumForRequest`
14715
- * (step-up quorum) narrow a rule's annotation to a request the same way the
14716
- * compose engine's own `parseExistingCedar` does: blocks split on blank lines,
14717
- * a rule contributes only when EVERY request fact it constrains matches.
14718
- *
14719
- * A fact is matched against the SAME projection the gateway/edge feeds the
14720
- * engine (`name = agentName`, `category = scraper|detectionClass`), so the
14721
- * narrowing mirrors the engine's own evaluation. An UNKNOWN fact never narrows.
14722
- */
14723
- /**
14724
- * A block applies when its path AND principal conditions all match the KNOWN
14725
- * request facts. An unknown fact never narrows (so the no-`request` case unions
14726
- * every matching rule's annotation).
14727
- */
14728
- function blockApplies(block, request) {
14729
- if (request?.path !== void 0 && !blockMatchesPath(block, request.path)) return false;
14730
- if (request?.name !== void 0 && !blockMatchesEquality(block, "principal.name", request.name)) return false;
14731
- if (request?.category !== void 0 && !blockMatchesEquality(block, "principal.category", request.category)) return false;
14732
- return true;
14733
- }
14734
- /** The `resource.path` literals appearing anywhere in `text` (no `when`/
14735
- * `unless` scoping — callers that care about scope use `splitWhenUnless`
14736
- * first). Shared regex extraction for `pathLiteralsInBlock` and the
14737
- * scope-aware helpers below. */
14738
- function pathLiteralsInText(text) {
14739
- return Array.from(text.matchAll(cedarQuotedValueRegExp("resource\\.path (?:like|==) ", "g")), (m) => unescapeCedarString(m[1]));
14740
- }
14741
- /**
14742
- * The `resource.path` literals a block MENTIONS anywhere — `when` or
14743
- * `unless` alike (empty = the block never mentions a path). Used for
14744
- * enumeration (which concrete paths does this bundle reference at all),
14745
- * NOT for "does this block's condition match path" — that's
14746
- * `blockMatchesPath`, which is `unless`-aware. Mixing the two up is exactly
14747
- * the bug Bugbot caught (2026-09-10): a literal that appears ONLY inside
14748
- * `unless { … }` names a path this block does NOT apply to, not one it
14749
- * targets.
14750
- */
14751
- function pathLiteralsInBlock(block) {
14752
- return pathLiteralsInText(block);
14753
- }
14754
- /**
14755
- * Split `block` into its `when`-scoped text and its `unless`-scoped inner
14756
- * text, mirroring the compose engine's own excision order
14757
- * (`apps/web/lib/compose/cedar.ts`'s `unless` handling): `unless { … }` is
14758
- * located first and excised, so its own literals never leak into what
14759
- * counts as the block's `when` (narrowing) scope.
14760
- *
14761
- * CodeQL js/polynomial-redos: a single `/unless\s*\{([\s\S]*?)\}\s*;?/`
14762
- * regex is quadratic on a policy blob containing many "unless{"
14763
- * substrings with no closing brace (composed policy text is untrusted,
14764
- * customer-authored input evaluated on the request hot path) — an
14765
- * unanchored match retries the unbounded `[\s\S]*?` scan-to-end at every
14766
- * failed start position. `search()` for the fixed-length "unless\s*{"
14767
- * prefix has no such ambiguity (each position fails fast), and the
14768
- * closing brace is then found with a single linear `indexOf`, so the
14769
- * whole split stays O(n) regardless of how many false "unless{" starts
14770
- * the text contains.
14771
- */
14772
- function splitWhenUnless(block) {
14773
- const unlessIndex = block.search(/unless\s*\{/);
14774
- if (unlessIndex === -1) return {
14775
- whenText: block,
14776
- unlessText: ""
14777
- };
14778
- const openBraceIndex = block.indexOf("{", unlessIndex);
14779
- const closeBraceIndex = block.indexOf("}", openBraceIndex + 1);
14780
- if (closeBraceIndex === -1) return {
14781
- whenText: block,
14782
- unlessText: ""
14783
- };
14784
- return {
14785
- whenText: block.slice(0, unlessIndex),
14786
- unlessText: block.slice(openBraceIndex + 1, closeBraceIndex)
14787
- };
14788
- }
14789
- /**
14790
- * A block applies to `path` when: no `unless` literal excludes it, AND
14791
- * either the `when` scope has no path constraint at all (unconstrained →
14792
- * matches every path except what `unless` just excluded), or one of the
14793
- * `when` scope's path literals matches (exact, or a `*`-prefix glob).
14794
- *
14795
- * Bugbot (2026-09-10): the previous version read path literals from the
14796
- * WHOLE block regardless of `when` vs `unless`, so a site-wide forbid whose
14797
- * only path mention was an `unless { resource.path == "/checkout" }`
14798
- * exemption got scored as "targets only /checkout" — backwards. It applies
14799
- * to every path EXCEPT the excepted one, not ONLY the excepted one.
14800
- */
14801
- function blockMatchesPath(block, path) {
14802
- const { whenText, unlessText } = splitWhenUnless(block);
14803
- if (pathLiteralsInText(unlessText).some((literal) => pathLiteralMatches(literal, path))) return false;
14804
- const whenLiterals = pathLiteralsInText(whenText);
14805
- if (whenLiterals.length === 0) return true;
14806
- return whenLiterals.some((literal) => pathLiteralMatches(literal, path));
14807
- }
14808
- /** Escape every regex metacharacter in `s` (so it matches literally). */
14809
- function escapeRegExp(s) {
14810
- return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14811
- }
14812
- /**
14813
- * Split a composed Cedar bundle into per-rule blocks (blank-line separated),
14814
- * trimmed and with empties dropped. Mirrors the compose engine's own block
14815
- * split (`apps/web/lib/compose/cedar.ts` `parseCedarBlocks`).
14816
- */
14817
- function splitCedarBlocks(cedar) {
14818
- return cedar.split(/\n\s*\n/).map((b) => b.trim()).filter((b) => b.length > 0);
14819
- }
14820
- /**
14821
- * The set of values a block positively constrains `attr` to via `== ` literals.
14822
- * Empty = the block places no `==` constraint on `attr` (unconstrained).
14823
- */
14824
- function blockEqualityLiterals(block, attr) {
14825
- const a = escapeRegExp(attr);
14826
- return Array.from(block.matchAll(cedarQuotedValueRegExp(`${a} == `, "g")), (m) => unescapeCedarString(m[1]));
14827
- }
14828
- /**
14829
- * The set of values a block EXCLUDES `attr` from via `!= ` literals.
14830
- * Empty = the block places no `!=` constraint on `attr`.
14831
- */
14832
- function blockExclusionLiterals(block, attr) {
14833
- const a = escapeRegExp(attr);
14834
- return Array.from(block.matchAll(cedarQuotedValueRegExp(`${a} != `, "g")), (m) => unescapeCedarString(m[1]));
14835
- }
14836
- /** A block applies to `value` when it is NOT excluded by a `!=` literal AND
14837
- * (it declares no `==` literal — unconstrained → applies to all — or `value` is
14838
- * one of them; compose emits an OR-disjunction for a name set). Without the `!=`
14839
- * arm a rule that challenges everyone EXCEPT X (`principal.name != "X"`) would
14840
- * over-advertise its annotation to X — a broader grant than the rule meant. */
14841
- function blockMatchesEquality(block, attr, value) {
14842
- const eq = blockEqualityLiterals(block, attr);
14843
- if (blockExclusionLiterals(block, attr).includes(value)) return false;
14844
- if (eq.length > 0) return eq.includes(value);
14845
- return true;
14846
- }
14847
- /**
14848
- * Match a `resource.path` literal against the request path with CEDAR `like`
14849
- * semantics — NOT the package's `matchPath`. Cedar `*` matches any sequence
14850
- * INCLUDING `/` (regex `.*`), whereas `matchPath` treats a single `*` as
14851
- * `[^/]*` (no slash); using it here would disagree with what the engine
14852
- * actually matched. A `==`/non-wildcard literal is an exact match; a `like`
14853
- * literal maps each `*` (and `**`) to `.*`, anchored.
14854
- */
14855
- function pathLiteralMatches(literal, path) {
14856
- if (!literal.includes("*")) return path === literal;
14857
- const pattern = escapeRegExp(literal).replace(/\\\*/g, ".*");
14858
- try {
14859
- return new RegExp(`^${pattern}$`).test(path);
14860
- } catch {
14861
- return false;
14862
- }
14863
- }
14864
- /**
14865
- * True when the block contains a Cedar `forbid` statement (a deny rule). A bare
14866
- * `forbid` defaults to BLOCK; a `@verdict(...)` annotation refines the kind.
14867
- */
14868
- function isForbidBlock(block) {
14869
- return /\bforbid\s*\(/.test(block);
14870
- }
14871
- /** True when the block narrows the principal — by category/name equality, a
14872
- * Cedar entity-type test (`principal is X`), or a scope-position binding
14873
- * (`forbid(principal == X::"…"`). An un-narrowed deny matches every principal.
14874
- *
14875
- * Cursor Bugbot (2026-09-11, High): this used to scan the WHOLE block for
14876
- * a principal literal, `when`/`unless` alike — the exact same class of bug
14877
- * `blockMatchesPath` above was already fixed for on the path dimension
14878
- * (see that function's doc comment). `unless { principal.category ==
14879
- * "search_engine" }` on an otherwise site-wide `forbid` only exempts
14880
- * search engines from the deny — the rule still denies every OTHER
14881
- * principal, humans included — but scanning the whole block found the
14882
- * `==` literal and called the rule "narrowed," so `pathHasUnnarrowedDenyRule`
14883
- * missed it and a real browser hitting that path reached Cedar only to be
14884
- * denied by the very rule this check exists to catch. Split `when`/`unless`
14885
- * first: a WHEN-scope (or scope-position) literal genuinely targets the
14886
- * deny, narrowing it away from every principal not named — whatever value
14887
- * it names, since an un-narrowed literal search wouldn't have found one at
14888
- * all. An UNLESS-scope literal does the opposite: it exempts ONLY that
14889
- * specific principal, so it narrows the rule away from humans only when
14890
- * the exempted value is literally `"human"` (the #3297 carve-out idiom) —
14891
- * exempting anyone else leaves the deny fully un-narrowed with respect to
14892
- * humans. */
14893
- function narrowsPrincipal(block) {
14894
- const { whenText, unlessText } = splitWhenUnless(block);
14895
- if (blockEqualityLiterals(whenText, "principal.category").length > 0) return true;
14896
- if (blockExclusionLiterals(whenText, "principal.category").includes("human")) return true;
14897
- if (blockEqualityLiterals(whenText, "principal.name").length > 0) return true;
14898
- if (/principal\s+is\s+\w/.test(whenText)) return true;
14899
- if (/forbid\s*\(\s*principal\s*==/.test(whenText)) return true;
14900
- if (blockEqualityLiterals(unlessText, "principal.category").includes("human")) return true;
14901
- return false;
14902
- }
14903
- /** A deny rule that targets EVERY principal — the silent-human-impact footgun. */
14904
- function isUnnarrowedDenyBlock(block) {
14905
- return isForbidBlock(block) && !narrowsPrincipal(block);
14906
- }
14907
- /**
14908
- * True when some un-narrowed deny rule in the bundle matches `path` — i.e. a
14909
- * human hitting `path` is denied by a rule that never narrowed the principal.
14910
- * The single shared definition of "this path catches humans by accident,"
14911
- * used by the deploy gate AND the preview banner.
14912
- */
14913
- function pathHasUnnarrowedDenyRule(cedar, path) {
14914
- return splitCedarBlocks(cedar).some((block) => isUnnarrowedDenyBlock(block) && blockMatchesPath(block, path));
14915
- }
14916
-
14917
- //#endregion
14918
- //#region src/policy/required-scopes.ts
14919
- /**
14920
- * Consent scopes a composed Cedar policy REQUIRES for a request — the
14921
- * `@scopes(...)` annotations the compose engine writes on CHALLENGE-verdict
14922
- * rules (alongside `unless { context.granted_scopes.contains("S") }`).
14923
- *
14924
- * WHY: when a scope-gated rule challenges a request, the step-up must request
14925
- * EXACTLY the scopes the policy demands, so the consent flow mints a delegation
14926
- * carrying them (and the agent's retry then satisfies the carve-out). The
14927
- * policy is the source of truth for "what this route requires", so reading its
14928
- * `@scopes` is reading the SSOT — not re-deriving an engine-computed value.
14929
- *
14930
- * Best-effort TEXT parse (no Cedar AST), mirroring the compose engine's own
14931
- * `parseExistingCedar`: blocks are split on blank lines. A CHALLENGE block
14932
- * contributes its scopes only when EVERY request fact it constrains matches —
14933
- * `resource.path`, `principal.name`, and `principal.category` — so on a shared
14934
- * path the scopes of ANOTHER agent's CHALLENGE rule are not advertised (the
14935
- * engine challenged on the rule whose `when` matched, not merely the path).
14936
- *
14937
- * A fact is matched against the SAME projection the gateway feeds the engine
14938
- * (`name = detection.agentName`, `category = scraper|detectionClass`), so the
14939
- * narrowing mirrors the engine's own evaluation. An UNKNOWN fact never narrows:
14940
- * with no `request` (the consent allow-list case) this returns the union of
14941
- * every CHALLENGE rule's scopes — exactly what consent must be able to grant.
14942
- */
14943
- function requiredScopesForRequest(policySource, request) {
14944
- if (!policySource || !policySource.trim()) return [];
14945
- const out = /* @__PURE__ */ new Set();
14946
- for (const block of policySource.split(/\n\s*\n/)) {
14947
- if (!/@verdict\("CHALLENGE"\)/.test(block)) continue;
14948
- const scopesMatch = block.match(cedarQuotedValueRegExp("@scopes\\("));
14949
- if (!scopesMatch) continue;
14950
- const scopes = scopesMatch[1].split(/\s+/).filter(Boolean).map(unescapeCedarString);
14951
- if (scopes.length === 0) continue;
14952
- if (!blockApplies(block, request)) continue;
14953
- for (const scope of scopes) out.add(scope);
14954
- }
14955
- return [...out];
14956
- }
14957
-
14958
- //#endregion
14959
- //#region src/policy/decision-policy-id.ts
14960
- function decisionPolicyId(decision) {
14961
- switch (decision.kind) {
14962
- case "Permit": return decision.policyId;
14963
- case "Block": return decision.reason?.kind === "PolicyDenied" ? decision.reason.policyId : void 0;
14964
- case "Challenge": return decision.params?.policyId;
14965
- case "Redirect": return decision.target?.policyId;
14966
- case "Instruct": return decision.payload?.policyId;
14967
- default: return;
14968
- }
14969
- }
14970
-
14971
15117
  //#endregion
14972
15118
  //#region src/policy/bespoke-policy.ts
14973
15119
  /** Stable synthetic `@id` per explicit bespoke mechanism. */
@@ -15026,132 +15172,24 @@ function nonNavigablePolicyLabel(policyId) {
15026
15172
 
15027
15173
  //#endregion
15028
15174
  //#region src/policy/policy-lint.ts
15029
- const UNNARROWED_DENY_MESSAGE = "This rule denies every principal — including humans — because it does not narrow the principal. Add a `principal.category == \"ai_agent\"` (or `principal.name`) condition, or confirm you intend to affect humans.";
15030
- function blockIdAnnotation(block) {
15031
- const m = block.match(/@id\("((?:\\.|[^"\\])*)"\)/);
15032
- return m ? m[1] : void 0;
15033
- }
15034
- /**
15035
- * Flag every un-narrowed deny rule in a composed Cedar bundle. Pure and
15036
- * parity-irrelevant: a heuristic author-time WARNING, never an enforcement
15037
- * decision. Shares its "un-narrowed deny" definition with the deploy gate
15038
- * (`pathHasUnnarrowedDenyRule`) so the editor and the gate agree.
15039
- */
15175
+ const NARROW_ADVICE = "Add a `principal.category == \"ai_agent\"` (or `principal.name`) condition, or confirm you intend to affect them.";
15176
+ const EVERYONE_MESSAGE = `This rule denies every visitor, including humans and ${require_step_up.NO_EVIDENCE_CATEGORY} visitors, because it does not narrow the principal. ${NARROW_ADVICE}`;
15177
+ const HUMAN_MESSAGE = `This rule denies human visitors because it does not narrow the principal. ${NARROW_ADVICE}`;
15178
+ const NO_EVIDENCE_MESSAGE = `This rule also applies to ${require_step_up.NO_EVIDENCE_CATEGORY} visitors, who are real people whose browser sent no evidence to classify. Add a \`${require_step_up.NO_EVIDENCE_EXCLUSION_TERM}\` condition, or confirm you intend to affect them.`;
15179
+ const messageFor = (classes) => classes.length === require_step_up.PROBE_CLASSES.length ? EVERYONE_MESSAGE : classes.includes("no_evidence") ? NO_EVIDENCE_MESSAGE : HUMAN_MESSAGE;
15040
15180
  function lintUnnarrowedDenyRules(cedar) {
15041
- const findings = [];
15042
- let searchFrom = 0;
15043
- for (const block of splitCedarBlocks(cedar)) {
15044
- if (!isUnnarrowedDenyBlock(block)) continue;
15045
- const idx = cedar.indexOf(block, searchFrom);
15046
- const line = idx < 0 ? 1 : cedar.slice(0, idx).split("\n").length;
15047
- if (idx >= 0) searchFrom = idx + block.length;
15048
- findings.push({
15049
- ruleId: blockIdAnnotation(block),
15050
- line,
15051
- message: UNNARROWED_DENY_MESSAGE
15052
- });
15053
- }
15054
- return findings;
15055
- }
15056
-
15057
- //#endregion
15058
- //#region src/policy/approval-quorum.ts
15059
- /**
15060
- * The step-up APPROVAL QUORUM a composed Cedar policy requires for a request —
15061
- * the `@approvers(...)` (+ optional `@quorum("N")`) annotations on a
15062
- * CHALLENGE-verdict rule.
15063
- *
15064
- * WHY (ADR D7 — distinct verdict): the engine emits a single `Challenge` for
15065
- * both consent (`@scopes`) and human-approval step-up (`@approvers`). They are
15066
- * DIFFERENT security flows and must not collide — a consent challenge mints a
15067
- * delegation; an approval-quorum challenge demands N-of-M humans cryptographically
15068
- * sign. This classifier is the seam that tells them apart from the policy text:
15069
- * - a CHALLENGE rule carrying `@approvers` → an approval quorum (this returns it)
15070
- * - a CHALLENGE rule with only `@scopes` (or neither) → consent (returns null)
15071
- *
15072
- * It mirrors {@link requiredScopesForRequest}: the SAME best-effort block parse
15073
- * and the SAME request narrowing (shared {@link blockApplies}), so the rule it
15074
- * reads the quorum off is the rule the engine actually challenged on — not merely
15075
- * one that shares a path. Reading the annotation is reading the SSOT (the policy
15076
- * is the source of truth for "what this action requires"), not re-deriving it.
15077
- *
15078
- * The engine carries no rule id on its Challenge, so the classifier re-matches by
15079
- * request facts and is FAIL-CLOSED on ambiguity:
15080
- * - if a CONSENT-only CHALLENGE rule ALSO applies, it returns null — the engine
15081
- * may have challenged on THAT, and reading approval off a different rule would
15082
- * conflate the two flows (ADR D7)
15083
- * - if two applying approval rules disagree on {n, approvers}, it returns null —
15084
- * enforcing the wrong approver roster is a worse failure than a clean deny
15085
- * Each caller feeds it the SAME facts its engine evaluated, so it narrows to the
15086
- * rule the engine could have fired on. The EDGE worker sets resource.path +
15087
- * principal.name and narrows on them; the Fly gateway sets NEITHER (it populates
15088
- * category + the resource entity, leaving resource.path=="" and principal.name=""),
15089
- * so it passes those as "" — path/name-scoped rules don't fire there, exactly as
15090
- * the engine sees it, and a same-scope tie falls to the fail-closed guard above.
15091
- */
15092
- function approvalQuorumForRequest(policySource, request) {
15093
- if (!policySource || !policySource.trim()) return null;
15094
- let chosen = null;
15095
- for (const block of policySource.split(/\n\s*\n/)) {
15096
- if (!/@verdict\("CHALLENGE"\)/.test(block)) continue;
15097
- if (!blockApplies(block, request)) continue;
15098
- const approvers = parseApprovers(block);
15099
- if (!approvers) return null;
15100
- const candidate = {
15101
- n: parseQuorumN(block),
15102
- approvers
15103
- };
15104
- if (chosen && !sameQuorum(chosen, candidate)) return null;
15105
- chosen = candidate;
15106
- }
15107
- return chosen;
15108
- }
15109
- /** The DIDs of an `@approvers("did … did")` annotation, or null when the rule
15110
- * carries none (a consent challenge) or an empty/whitespace list (no real gate). */
15111
- function parseApprovers(block) {
15112
- const m = block.match(/@approvers\("([^"]*)"\)/);
15113
- if (!m) return null;
15114
- const approvers = m[1].split(/\s+/).filter(Boolean);
15115
- return approvers.length > 0 ? approvers : null;
15116
- }
15117
- /** Two quorums match iff same n and same ordered approver list. */
15118
- function sameQuorum(a, b) {
15119
- return a.n === b.n && a.approvers.length === b.approvers.length && a.approvers.every((did, i) => did === b.approvers[i]);
15120
- }
15121
- /**
15122
- * The `@quorum("N")` count, or 1 when absent/malformed. Fail-secure: an
15123
- * unparseable or `< 1` value falls back to 1 (the smallest real quorum), never 0
15124
- * — which would make the step-up gate a no-op. The route's own
15125
- * `validateStepUpQuorum` is the second line of defence on a misconfigured n.
15126
- */
15127
- function parseQuorumN(block) {
15128
- const m = block.match(/@quorum\("([^"]*)"\)/);
15129
- if (!m) return 1;
15130
- const n = Number(m[1]);
15131
- return Number.isInteger(n) && n >= 1 ? n : 1;
15181
+ return require_step_up.unnarrowedDenyStatements(cedar).map(({ statement, classes, line }) => ({
15182
+ ruleId: require_step_up.statementId(statement),
15183
+ line,
15184
+ message: messageFor(classes)
15185
+ }));
15132
15186
  }
15133
-
15134
- //#endregion
15135
- //#region src/policy/step-up.ts
15136
- /**
15137
- * Validate a `step_up` decision's quorum before approval verification.
15138
- * Fail-closed: returns a deny `reason` for any quorum that can never be
15139
- * legitimately met; `{ ok: true }` only when the quorum is a real gate.
15140
- *
15141
- * Ordering is load-bearing: the `n` guard runs first, so an invalid quorum that
15142
- * is both non-positive AND has no approvers reports `invalid_step_up_quorum`
15143
- * (stable/deterministic reason).
15144
- */
15145
- function validateStepUpQuorum(quorum) {
15146
- if (!Number.isInteger(quorum.n) || quorum.n < 1) return {
15147
- ok: false,
15148
- reason: "invalid_step_up_quorum"
15149
- };
15150
- if (!Array.isArray(quorum.approvers) || quorum.approvers.length === 0) return {
15151
- ok: false,
15152
- reason: "step_up_no_approvers"
15153
- };
15154
- return { ok: true };
15187
+ const MISSING_BASELINE_MESSAGE = `This policy has no baseline permit, so every visitor that no permit rule covers is denied, humans and ${require_step_up.NO_EVIDENCE_CATEGORY} visitors included. Add \`permit(principal, action, resource);\` if you want unmatched traffic allowed.`;
15188
+ function lintMissingBaselinePermit(cedar) {
15189
+ return require_step_up.lacksBaselinePermit(cedar) ? [{
15190
+ line: 1,
15191
+ message: MISSING_BASELINE_MESSAGE
15192
+ }] : [];
15155
15193
  }
15156
15194
 
15157
15195
  //#endregion
@@ -15168,6 +15206,11 @@ function validateStepUpQuorum(quorum) {
15168
15206
  * - Fallback to default policy on errors
15169
15207
  * - Configurable API endpoints
15170
15208
  */
15209
+ function looksLikePolicyApiBody(data) {
15210
+ if (typeof data !== "object" || data === null) return false;
15211
+ const threshold = data.blockThreshold;
15212
+ return typeof threshold === "number" && Number.isFinite(threshold);
15213
+ }
15171
15214
  var PolicyUnavailableError = class extends Error {
15172
15215
  code = "POLICY_UNAVAILABLE";
15173
15216
  constructor() {
@@ -15324,6 +15367,7 @@ var PolicyFetcher = class {
15324
15367
  });
15325
15368
  if (!response.ok) throw new Error(`API returned ${response.status}: ${response.statusText}`);
15326
15369
  const data = await response.json();
15370
+ if (!looksLikePolicyApiBody(data)) throw new Error("Policy response is not from the policy API");
15327
15371
  const policy = safeParsePolicyConfig(data);
15328
15372
  if (!policy) throw new Error("Invalid policy response format");
15329
15373
  return policy;
@@ -15443,545 +15487,6 @@ function createEvaluationContext(options) {
15443
15487
  };
15444
15488
  }
15445
15489
 
15446
- //#endregion
15447
- //#region src/host-adapter/verdict-cookie.ts
15448
- /**
15449
- * Canonical cookie name. Sites-1's `/blocked` page reads from this
15450
- * exact key; do not rename without updating the dashboard route.
15451
- */
15452
- const VERDICT_COOKIE_NAME = "__checkpoint_verdict";
15453
- /**
15454
- * Compute the verdict label from a `RenderedResponse`.
15455
- */
15456
- function deriveVerdict(rendered) {
15457
- if (rendered.status === null) return "allowed";
15458
- if (rendered.status === 302) return "redirected";
15459
- return "denied";
15460
- }
15461
- /**
15462
- * Build the `__checkpoint_verdict` cookie value Sites-1's Sonner toast
15463
- * reads. Byte-format pinned by tests in both `checkpoint-nextjs` and
15464
- * `checkpoint-express`:
15465
- *
15466
- * - allowed: `{"verdict":"allowed"}`
15467
- * - denied: `{"verdict":"denied","reason":"<r>"}`
15468
- * - redirected: `{"verdict":"redirected"}`
15469
- *
15470
- * Returns raw JSON; the host's cookie-write call URL-encodes.
15471
- */
15472
- function encodeVerdictCookie(rendered) {
15473
- const verdict = deriveVerdict(rendered);
15474
- const reason = rendered.headers["X-Checkpoint-Reason"];
15475
- return JSON.stringify(reason ? {
15476
- verdict,
15477
- reason
15478
- } : { verdict });
15479
- }
15480
-
15481
- //#endregion
15482
- //#region src/host-adapter/content-negotiation.ts
15483
- /**
15484
- * Content negotiation — framework-agnostic Accept-header parsing for
15485
- * host adapters.
15486
- *
15487
- * The engine's `RenderedResponse` doesn't make HTML-vs-JSON branching
15488
- * decisions; the host wrapper does that based on what the client
15489
- * accepts. Both Next.js (NextRequest) and Express (Request) carry the
15490
- * Accept header in different shapes — `req.headers.get('accept')` vs
15491
- * `req.get('Accept')` vs `req.headers.accept` — so we accept any
15492
- * Headers-like input and do the parsing here.
15493
- */
15494
- /**
15495
- * `true` when the client signaled it accepts HTML or XHTML. Used by
15496
- * host adapters to choose between an HTML `/blocked` rewrite (browsers)
15497
- * and a JSON 4xx response (curl, fetch-from-a-tool, ChatGPT-User).
15498
- *
15499
- * Loose match — q-values, parameters, and additional MIME types are
15500
- * allowed. The spec's q-value precedence (RFC 9110 § 12.5.1) doesn't
15501
- * matter here; we only care whether HTML is present at all.
15502
- *
15503
- * Accepts:
15504
- * - a `Headers` instance (Web Fetch API; Next.js, Hono, Cloudflare)
15505
- * - a plain `Record<string, string>` (Express, Connect, Fastify)
15506
- * - a single string (caller already extracted the Accept value)
15507
- * - `undefined` (treated as no-HTML)
15508
- */
15509
- function acceptsHtml(input) {
15510
- const accept = extractAccept(input);
15511
- if (!accept) return false;
15512
- return accept.includes("text/html") || accept.includes("application/xhtml+xml");
15513
- }
15514
- function extractAccept(input) {
15515
- if (!input) return void 0;
15516
- if (typeof input === "string") return input;
15517
- if (typeof input.get === "function") return input.get("accept") ?? void 0;
15518
- const rec = input;
15519
- const value = rec.accept ?? rec.Accept;
15520
- if (Array.isArray(value)) return value.join(",");
15521
- return value;
15522
- }
15523
-
15524
- //#endregion
15525
- //#region src/host-adapter/decision-mapping.ts
15526
- /**
15527
- * Path the `/blocked` dashboard route lives at. HTML clients that hit
15528
- * a 4xx verdict get rewritten here at status 200 so the page renders
15529
- * with the verdict cookie set and Sonner can pick up the toast.
15530
- *
15531
- * Hard-coded by convention; if a customer ever needs a custom path,
15532
- * pass it through `CheckpointConfig.blockedPath` and override in the
15533
- * host adapter (not in this lookup).
15534
- */
15535
- const BLOCKED_PATH = "/blocked";
15536
- /**
15537
- * Classify a `RenderedResponse` into one of the four host-adapter
15538
- * branches. `clientAcceptsHtml` comes from `acceptsHtml()` in
15539
- * `content-negotiation.ts`.
15540
- */
15541
- function classifyResponseShape(rendered, clientAcceptsHtml) {
15542
- if (rendered.status === null) return "pass-through";
15543
- if (rendered.status === 302 && rendered.headers.Location) return "redirect";
15544
- if (clientAcceptsHtml && rendered.status >= 400 && rendered.status < 500) return "html-block";
15545
- return "json-block";
15546
- }
15547
-
15548
- //#endregion
15549
- //#region src/host-adapter/fetcher-envelope.ts
15550
- /**
15551
- * Dual-envelope selection predicate (draft-kya-http-02 §8.1 fetcher-200).
15552
- *
15553
- * AI-agent fetchers (Claude-User WebFetch, ChatGPT) collapse 4xx/5xx
15554
- * responses and never surface the body to the LLM, so the §8.1 step-up
15555
- * challenge served at 401 is invisible. The fix is a dual envelope: keep
15556
- * the spec 401 for capable/discovery clients, and serve a body-readable
15557
- * HTTP 200 (no `WWW-Authenticate`) for cooperative, self-identifying
15558
- * agents so they can read the body + relay the consent link.
15559
- *
15560
- * `serveBodyReadable200` is the shared selection predicate every TS PEP
15561
- * (checkpoint-nextjs, checkpoint-express / wasm-runtime) consults when its
15562
- * challenge-emission mode is `negotiated`. Centralising it here — rather
15563
- * than re-implementing per PEP — makes drift structurally impossible; the
15564
- * fetcher-200 fixture freezes envelope BYTES, this function freezes the
15565
- * SELECTION.
15566
- *
15567
- * **This is a cooperative-UX bridge, NOT an access control.** A spoofer
15568
- * that hides its identity and does not opt in simply receives the spec
15569
- * 401 (and the original body-drop). Access is still gated entirely by the
15570
- * unchanged detection + delegation verification — never by which envelope
15571
- * is selected.
15572
- */
15573
- /**
15574
- * Durable opt-in header — the primary, framework-agnostic signal that a
15575
- * caller is a cooperative agent able to handle the 200 fetcher envelope.
15576
- * Any non-empty value counts as opt-in (value semantics are reconciled
15577
- * with mcp-i-cloudflare's `KYA-Accept-Challenge: delegation` in the spec).
15578
- */
15579
- const ACCEPT_CHALLENGE_HEADER = "kya-accept-challenge";
15580
- function readHeader(input, name) {
15581
- if (!input) return void 0;
15582
- if (typeof input.get === "function") return input.get(name) ?? void 0;
15583
- const rec = input;
15584
- const lower = name.toLowerCase();
15585
- for (const key of Object.keys(rec)) if (key.toLowerCase() === lower) {
15586
- const v = rec[key];
15587
- return Array.isArray(v) ? v[0] : v ?? void 0;
15588
- }
15589
- }
15590
- /**
15591
- * Decide whether a `negotiated`-mode PEP should serve the body-readable
15592
- * HTTP 200 fetcher envelope (`true`) or the spec 401 (`false`).
15593
- *
15594
- * Serve 200 when EITHER:
15595
- * 1. the caller opts in via a non-empty `KYA-Accept-Challenge` header
15596
- * (the durable, primary signal), OR
15597
- * 2. detection classifies the caller as an AI agent — BOTH `isAgent` and
15598
- * `detectionClass === 'ai_agent'` must agree (a transitional UA heuristic,
15599
- * retired as frameworks adopt the header).
15600
- *
15601
- * Otherwise serve the 401 — spoofers, silent, discovery, and OAuth
15602
- * clients all land here, which is acceptable because this is UX, not a
15603
- * security boundary.
15604
- *
15605
- * Requiring both `isAgent` AND the `ai_agent` class to fire the heuristic
15606
- * mirrors .NET `IsInteractiveAiAgent` (`IsAgent && DetectionClass.Type ==
15607
- * AiAgent`) and the gateway worker, so the cross-PEP selection cannot drift on
15608
- * the pathological case where the two signals disagree (class says agent,
15609
- * `isAgent` says no): that caller is treated as non-cooperative (spec 401),
15610
- * never demoted past it. In normal engine output the two signals agree, so
15611
- * who-gets-200 is unchanged for real traffic.
15612
- *
15613
- * @param headers request headers (for the opt-in signal)
15614
- * @param detectionClass the caller's detection class in any representation
15615
- * the engine produces (a `DetectionClass` object, the
15616
- * `ai_agent` wire string, or absent)
15617
- * @param isAgent the engine's `isAgent` verdict — gates the `ai_agent`
15618
- * heuristic so a class/`isAgent` disagreement gets the 401
15619
- */
15620
- function serveBodyReadable200(headers, detectionClass, isAgent) {
15621
- const optIn = readHeader(headers, ACCEPT_CHALLENGE_HEADER);
15622
- if (optIn && optIn.trim().length > 0) return true;
15623
- if (isAgent && detectionClass !== void 0 && detectionClass !== null) {
15624
- if (normalizeDetectionClassEnum(detectionClass) === "ai_agent") return true;
15625
- }
15626
- return false;
15627
- }
15628
- /**
15629
- * Resolve the challenge-emission mode + request signals into the single
15630
- * boolean each PEP needs: serve the body-readable 200 (`true`) or the spec
15631
- * 401 (`false`). Centralising the mode gate here — not just the predicate —
15632
- * keeps the rollout switch identical across every TS PEP.
15633
- */
15634
- function selectBodyReadable200(mode, headers, detectionClass, isAgent) {
15635
- if (mode === "always-200") return true;
15636
- if (mode === "negotiated") return serveBodyReadable200(headers, detectionClass, isAgent);
15637
- return false;
15638
- }
15639
-
15640
- //#endregion
15641
- //#region src/mcpi/kya-http-error-codes.ts
15642
- /**
15643
- * KYA-HTTP error code registry — draft-kya-http-02 §9 / H1.2 (#3245).
15644
- *
15645
- * The `kyaos/*` strings are wire constants returned in the `error` field of a
15646
- * KYA-HTTP failure response (and mapped to an HTTP status). Emitters MUST use
15647
- * these EXACT bytes; consumers MAY additionally accept the legacy `kya/*`
15648
- * spellings for one transition cycle.
15649
- *
15650
- * The single source of truth is the golden fixture
15651
- * `packages/checkpoint-shared/fixtures/kya-http/error-codes.json`; the parity
15652
- * test in `__tests__/kya-http-error-codes.test.ts` reads that JSON via `fs` and
15653
- * asserts this map is byte-exact against it (no drift, no omissions).
15654
- *
15655
- * `as const satisfies Record<string, \`kyaos/${string}\`>` keeps the narrow
15656
- * literal value types (so consumers get autocomplete and a compile error on a
15657
- * typo'd code) while still proving every value is a well-formed `kyaos/…` string.
15658
- */
15659
- const KYA_HTTP_ERROR = {
15660
- MISSING_SIGNATURE: "kyaos/missing-signature",
15661
- INVALID_SIGNATURE: "kyaos/invalid-signature",
15662
- EXPIRED: "kyaos/expired",
15663
- REPLAY: "kyaos/replay",
15664
- DID_UNRESOLVABLE: "kyaos/did-unresolvable",
15665
- AUTHORIZATION_REQUIRED: "kyaos/authorization-required",
15666
- PROFILE_VIOLATION: "kyaos/profile-violation",
15667
- DELEGATION_REVOKED: "kyaos/delegation-revoked",
15668
- SCOPE_INSUFFICIENT: "kyaos/scope-insufficient",
15669
- CHAIN_BROKEN: "kyaos/chain-broken",
15670
- HOLDER_MISMATCH: "kyaos/holder-mismatch",
15671
- AUDIENCE_MISMATCH: "kyaos/audience-mismatch",
15672
- SESSION_MISMATCH: "kyaos/session-mismatch",
15673
- PICKUP_PINNED: "kyaos/pickup-pinned",
15674
- ASSURANCE_INSUFFICIENT: "kyaos/assurance-insufficient",
15675
- STATUS_PENDING: "kyaos/status-pending",
15676
- AUTHORIZATION_HOST_UNAVAILABLE: "kyaos/authorization-host-unavailable",
15677
- REPLAY_STATE_UNAVAILABLE: "kyaos/replay-state-unavailable",
15678
- REPLAY_CAPACITY: "kyaos/replay-capacity",
15679
- INVALID_SESSION: "kyaos/invalid-session",
15680
- PICKUP_EXPIRED: "kyaos/pickup-expired"
15681
- };
15682
- /**
15683
- * The HTTP status the registry assigns each code (draft-kya-http-02 §9).
15684
- * Mirrors `error-codes.json` exactly, pinned by `__tests__/kya-http-error-codes.test.ts`,
15685
- * and matches the engine's own table (`rust/crates/kya-os-engine/src/render/kya_error.rs`).
15686
- */
15687
- const KYA_HTTP_ERROR_STATUS = {
15688
- [KYA_HTTP_ERROR.MISSING_SIGNATURE]: 401,
15689
- [KYA_HTTP_ERROR.INVALID_SIGNATURE]: 401,
15690
- [KYA_HTTP_ERROR.EXPIRED]: 401,
15691
- [KYA_HTTP_ERROR.REPLAY]: 401,
15692
- [KYA_HTTP_ERROR.DID_UNRESOLVABLE]: 401,
15693
- [KYA_HTTP_ERROR.AUTHORIZATION_REQUIRED]: 401,
15694
- [KYA_HTTP_ERROR.PROFILE_VIOLATION]: 403,
15695
- [KYA_HTTP_ERROR.DELEGATION_REVOKED]: 403,
15696
- [KYA_HTTP_ERROR.SCOPE_INSUFFICIENT]: 403,
15697
- [KYA_HTTP_ERROR.CHAIN_BROKEN]: 403,
15698
- [KYA_HTTP_ERROR.HOLDER_MISMATCH]: 403,
15699
- [KYA_HTTP_ERROR.AUDIENCE_MISMATCH]: 403,
15700
- [KYA_HTTP_ERROR.SESSION_MISMATCH]: 403,
15701
- [KYA_HTTP_ERROR.PICKUP_PINNED]: 403,
15702
- [KYA_HTTP_ERROR.ASSURANCE_INSUFFICIENT]: 403,
15703
- [KYA_HTTP_ERROR.STATUS_PENDING]: 503,
15704
- [KYA_HTTP_ERROR.AUTHORIZATION_HOST_UNAVAILABLE]: 503,
15705
- [KYA_HTTP_ERROR.REPLAY_STATE_UNAVAILABLE]: 503,
15706
- [KYA_HTTP_ERROR.REPLAY_CAPACITY]: 429,
15707
- [KYA_HTTP_ERROR.INVALID_SESSION]: 404,
15708
- [KYA_HTTP_ERROR.PICKUP_EXPIRED]: 410
15709
- };
15710
-
15711
- //#endregion
15712
- //#region src/host-adapter/challenge-wire.ts
15713
- /**
15714
- * Canonical fixture-pinned KYA HTTP challenge-wire builder.
15715
- *
15716
- * The builder is transport-neutral and Edge-safe. Hosts must register the
15717
- * challenge and resolve every URI before calling it; this module validates and
15718
- * serializes those trusted values without network, database, or request access.
15719
- */
15720
- const PROTECTED_RESOURCE_METADATA_PATH = "/.well-known/oauth-protected-resource";
15721
- const DEFAULT_POLL_INTERVAL_S = 3;
15722
- const INVALID_QUOTED_VALUE = /[\u0000-\u001f\u007f"\\]/;
15723
- const SCOPE_TOKEN = /^[\x21\x23-\x5b\x5d-\x7e]+$/;
15724
- const SID = /^kya-[0-9a-f]{16,}$/;
15725
- const ASSURANCE_TIERS = /* @__PURE__ */ new Set([
15726
- "anonymous",
15727
- "attested-bearer",
15728
- "key-bound",
15729
- "registered",
15730
- "delegated"
15731
- ]);
15732
- /** Typed validation failure raised before any response is materialized. */
15733
- var ChallengeWireError = class extends TypeError {
15734
- code;
15735
- constructor(code, message) {
15736
- super(message);
15737
- this.name = "ChallengeWireError";
15738
- this.code = code;
15739
- }
15740
- };
15741
- /** Generate a 128-bit, lower-case hexadecimal challenge id. */
15742
- function generateDelegationSid() {
15743
- const bytes = /* @__PURE__ */ new Uint8Array(16);
15744
- crypto.getRandomValues(bytes);
15745
- let hex = "";
15746
- for (const byte of bytes) hex += byte.toString(16).padStart(2, "0");
15747
- return `kya-${hex}`;
15748
- }
15749
- /** Derive pickup from the registered consent origin, never request Host. */
15750
- function deriveDelegationPickupUri(consentUri, sid) {
15751
- const consent = parseHttpsUrl("consentUri", consentUri);
15752
- assertQuotedValue("sid", sid, "invalid-sid");
15753
- return `${consent.origin}/api/delegation/pickup/${sid}`;
15754
- }
15755
- /** Build the byte-pinned Delegation authentication field value. */
15756
- function buildDelegationChallengeHeader(input) {
15757
- const normalized = validateInput(input);
15758
- const params = [
15759
- ["realm", normalized.realm],
15760
- ["sid", normalized.sid],
15761
- ["consent_uri", normalized.consentUri],
15762
- ["pickup_uri", normalized.pickupUri]
15763
- ];
15764
- if (normalized.requiredScopes.length > 0) params.push(["scope", normalized.requiredScopes.join(" ")]);
15765
- if (normalized.minAssurance) params.push(["min_assurance", normalized.minAssurance]);
15766
- if (input.pollIntervalS !== void 0) params.push(["interval", String(normalized.pollIntervalS)]);
15767
- params.push(["kind", normalized.kind]);
15768
- return `Delegation ${params.map(([name, value]) => `${name}="${value}"`).join(", ")}`;
15769
- }
15770
- /** Build RFC 9728 Bearer discovery for a protected-resource realm. */
15771
- function buildDelegationBearerHeader(realm) {
15772
- assertRealm(realm);
15773
- return `Bearer resource_metadata="https://${realm}${PROTECTED_RESOURCE_METADATA_PATH}"`;
15774
- }
15775
- /** Build the four required machine-followable delegation instruction elements. */
15776
- function buildDelegationInstructions(consentUri, pickupUri, pollIntervalS) {
15777
- return `This action requires human authorization. First establish your pickup binding at ${pickupUri}. If you can sign HTTP requests, sign each poll with an ephemeral did:key; otherwise generate one random 32-byte token encoded as unpadded base64url and send it as X-KYA-Pickup-Token on EVERY poll. After receiving 202 pending, show your user this link and ask them to approve: ${consentUri}. Continue polling ${pickupUri} every ${pollIntervalS} seconds with the same binding. When the response status is 200, take the 'delegation' value and retry your original request with header 'Authorization: Bearer <delegation>'.`;
15778
- }
15779
- /** Build the proof-bound body shared byte-for-byte by both HTTP envelopes. */
15780
- function buildDelegationChallengeBody(input) {
15781
- const normalized = validateInput(input);
15782
- const common = {
15783
- sid: normalized.sid,
15784
- consent_uri: normalized.consentUri,
15785
- pickup_uri: normalized.pickupUri,
15786
- ...normalized.requiredScopes.length > 0 ? { required_scopes: [...normalized.requiredScopes] } : {},
15787
- ...normalized.minAssurance ? { min_assurance: normalized.minAssurance } : {},
15788
- poll_interval_s: normalized.pollIntervalS,
15789
- challenge_proof: input.challengeProof
15790
- };
15791
- if (normalized.kind === "approval_quorum") return {
15792
- error: KYA_HTTP_ERROR.AUTHORIZATION_REQUIRED,
15793
- kyaos: {
15794
- sid: common.sid,
15795
- kind: "approval_quorum",
15796
- quorum: normalized.quorum,
15797
- action_nonce: normalized.actionNonce,
15798
- consent_uri: common.consent_uri,
15799
- pickup_uri: common.pickup_uri,
15800
- ...common.required_scopes ? { required_scopes: common.required_scopes } : {},
15801
- ...common.min_assurance ? { min_assurance: common.min_assurance } : {},
15802
- poll_interval_s: common.poll_interval_s,
15803
- challenge_proof: common.challenge_proof
15804
- },
15805
- instructions: buildApprovalQuorumInstructions(normalized)
15806
- };
15807
- return {
15808
- error: KYA_HTTP_ERROR.AUTHORIZATION_REQUIRED,
15809
- kyaos: {
15810
- ...common,
15811
- action: {
15812
- type: "delegation",
15813
- consent_uri: normalized.consentUri,
15814
- pickup_uri: normalized.pickupUri,
15815
- poll_interval_s: normalized.pollIntervalS,
15816
- pin: { header: "X-KYA-Pickup-Token" },
15817
- retry: {
15818
- header: "Authorization",
15819
- scheme: "Bearer",
15820
- value_from: "delegation"
15821
- }
15822
- }
15823
- },
15824
- instructions: buildDelegationInstructions(normalized.consentUri, normalized.pickupUri, normalized.pollIntervalS)
15825
- };
15826
- }
15827
- /** Build either the canonical 401 or its body-identical fetcher-200 envelope. */
15828
- function buildDelegationChallengeEnvelope(input, mode = "spec-401") {
15829
- const normalized = validateInput(input);
15830
- if (normalized.kind === "approval_quorum" && mode === "fetcher-200") throw new ChallengeWireError("unsupported-envelope", "fetcher-200 is not fixture-defined for approval_quorum");
15831
- const body = buildDelegationChallengeBody(input);
15832
- if (normalized.kind === "approval_quorum") return {
15833
- status: 401,
15834
- headers: [
15835
- ["WWW-Authenticate", buildDelegationChallengeHeader(input)],
15836
- ["Retry-After", String(normalized.pollIntervalS)],
15837
- ["Content-Type", "application/json"],
15838
- ["Cache-Control", "no-store"]
15839
- ],
15840
- body
15841
- };
15842
- const hintHeaders = [
15843
- ["Content-Type", "application/json"],
15844
- ["Cache-Control", "no-store"],
15845
- ["KYA-Auth-Required", "true"],
15846
- ["KYA-Auth-Url", normalized.consentUri],
15847
- ["Link", `<${normalized.consentUri}>; rel="kya-authorize"`],
15848
- ["KYA-Action", "challenge"]
15849
- ];
15850
- if (mode === "fetcher-200") return {
15851
- status: 200,
15852
- headers: hintHeaders,
15853
- body
15854
- };
15855
- return {
15856
- status: 401,
15857
- headers: [
15858
- ["WWW-Authenticate", buildDelegationChallengeHeader(input)],
15859
- ["WWW-Authenticate", `Bearer resource_metadata="${normalized.resourceMetadataUri}"`],
15860
- ["Retry-After", String(normalized.pollIntervalS)],
15861
- ...hintHeaders
15862
- ],
15863
- body
15864
- };
15865
- }
15866
- /** Preferred generic name; the legacy export remains for host compatibility. */
15867
- const buildChallengeWire = buildDelegationChallengeEnvelope;
15868
- function validateInput(input) {
15869
- assertRealm(input.realm);
15870
- assertQuotedValue("sid", input.sid, "invalid-sid");
15871
- if (!SID.test(input.sid)) throw new ChallengeWireError("invalid-sid", "sid must start with kya- and contain at least 64 bits of lower-case hexadecimal entropy");
15872
- const consent = parseHttpsUrl("consentUri", input.consentUri);
15873
- const pickup = parseHttpsUrl("pickupUri", input.pickupUri);
15874
- const expectedPickup = `${consent.origin}/api/delegation/pickup/${input.sid}`;
15875
- if (pickup.href !== expectedPickup) throw new ChallengeWireError("invalid-uri", "pickupUri must use the registered consent origin and sid");
15876
- const pollIntervalS = input.pollIntervalS ?? DEFAULT_POLL_INTERVAL_S;
15877
- if (!Number.isInteger(pollIntervalS) || pollIntervalS < 1 || pollIntervalS > 999) throw new ChallengeWireError("invalid-interval", "pollIntervalS must be an integer from 1 through 999");
15878
- if (input.challengeProof === void 0 || input.challengeProof === null) throw new ChallengeWireError("invalid-proof", "challengeProof is required");
15879
- const requiredScopes = input.requiredScopes ?? [];
15880
- for (const scope of requiredScopes) if (!SCOPE_TOKEN.test(scope)) throw new ChallengeWireError("invalid-scope", `invalid required scope: ${scope}`);
15881
- if (input.minAssurance && !ASSURANCE_TIERS.has(input.minAssurance)) throw new ChallengeWireError("invalid-assurance", `invalid minAssurance: ${input.minAssurance}`);
15882
- const kind = input.kind ?? "delegation";
15883
- if (kind !== "delegation" && kind !== "approval_quorum") throw new ChallengeWireError("invalid-kind", `unsupported challenge kind: ${String(kind)}`);
15884
- let resourceMetadataUri;
15885
- let quorum;
15886
- let actionNonce;
15887
- if (kind === "delegation") {
15888
- resourceMetadataUri = parseHttpsUrl("resourceMetadataUri", input.resourceMetadataUri).href;
15889
- const expectedMetadata = `https://${input.realm}${PROTECTED_RESOURCE_METADATA_PATH}`;
15890
- if (resourceMetadataUri !== expectedMetadata) throw new ChallengeWireError("invalid-uri", "resourceMetadataUri must be the protected resource RFC 9728 metadata URL");
15891
- } else {
15892
- const approval = input;
15893
- quorum = approval.quorum;
15894
- actionNonce = approval.actionNonce;
15895
- if (!Number.isInteger(quorum) || quorum < 1) throw new ChallengeWireError("invalid-quorum", "quorum must be a positive integer");
15896
- assertQuotedValue("actionNonce", actionNonce, "invalid-action-nonce");
15897
- }
15898
- return {
15899
- realm: input.realm,
15900
- sid: input.sid,
15901
- consentUri: consent.href,
15902
- pickupUri: pickup.href,
15903
- resourceMetadataUri,
15904
- requiredScopes,
15905
- pollIntervalS,
15906
- minAssurance: input.minAssurance,
15907
- kind,
15908
- quorum,
15909
- actionNonce
15910
- };
15911
- }
15912
- function buildApprovalQuorumInstructions(input) {
15913
- return `This action requires approval from ${input.quorum} human approvers. Show your user this link to begin the approval process: ${input.consentUri}. Then poll ${input.pickupUri} every ${input.pollIntervalS} seconds (sign polls with an ephemeral did:key, or send one random 32-byte X-KYA-Pickup-Token on EVERY poll). When the response status is 200, retry your original request presenting the returned grants in the KYA-Approvals header.`;
15914
- }
15915
- function assertRealm(realm) {
15916
- assertQuotedValue("realm", realm, "invalid-realm");
15917
- if (realm.includes("/") || realm.includes("@") || realm.includes("?") || realm.includes("#")) throw new ChallengeWireError("invalid-realm", "realm must be a host with an optional port");
15918
- try {
15919
- if (new URL(`https://${realm}`).host !== realm) throw new Error("invalid authority");
15920
- } catch {
15921
- throw new ChallengeWireError("invalid-realm", "realm must be a valid host with an optional port");
15922
- }
15923
- }
15924
- function assertQuotedValue(name, value, code) {
15925
- if (typeof value !== "string" || value.length === 0 || INVALID_QUOTED_VALUE.test(value)) throw new ChallengeWireError(code, `${name} contains characters unsafe for an HTTP quoted-string`);
15926
- }
15927
- function parseHttpsUrl(name, value) {
15928
- assertQuotedValue(name, value, "invalid-uri");
15929
- let parsed;
15930
- try {
15931
- parsed = new URL(value);
15932
- } catch {
15933
- throw new ChallengeWireError("invalid-uri", `${name} must be an absolute HTTPS URL`);
15934
- }
15935
- if (parsed.protocol !== "https:" || parsed.username || parsed.password) throw new ChallengeWireError("invalid-uri", `${name} must be an absolute HTTPS URL without credentials`);
15936
- return parsed;
15937
- }
15938
-
15939
- //#endregion
15940
- //#region src/host-adapter/challenge-context.ts
15941
- const DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS = 3e3;
15942
- /**
15943
- * Resolve and validate registered challenge context at the async host boundary.
15944
- * Resolver failures become an absent context so the renderer can emit the
15945
- * canonical retryable status-pending response; secrets and proof values are
15946
- * never included in failure events.
15947
- */
15948
- async function resolveChallengeContext(resolver, context, options = {}) {
15949
- if (!resolver) return void 0;
15950
- const timeoutMs = options.timeoutMs ?? 3e3;
15951
- if (!Number.isInteger(timeoutMs) || timeoutMs < 1) throw new TypeError("challenge context timeout must be a positive integer");
15952
- let timeoutId;
15953
- try {
15954
- const value = await Promise.race([Promise.resolve(resolver(context)), new Promise((_resolve, reject) => {
15955
- timeoutId = setTimeout(() => reject(new ChallengeContextTimeoutError(timeoutMs)), timeoutMs);
15956
- })]);
15957
- if (timeoutId !== void 0) clearTimeout(timeoutId);
15958
- if (!value) return void 0;
15959
- try {
15960
- buildChallengeWire(value, "spec-401");
15961
- return value;
15962
- } catch (error) {
15963
- options.onFailure?.({
15964
- reason: "invalid-context",
15965
- message: error.message
15966
- });
15967
- return;
15968
- }
15969
- } catch (error) {
15970
- if (timeoutId !== void 0) clearTimeout(timeoutId);
15971
- options.onFailure?.({
15972
- reason: error instanceof ChallengeContextTimeoutError ? "timeout" : "resolver-error",
15973
- message: error instanceof ChallengeContextTimeoutError ? error.message : "challenge context resolver failed"
15974
- });
15975
- return;
15976
- }
15977
- }
15978
- var ChallengeContextTimeoutError = class extends Error {
15979
- constructor(timeoutMs) {
15980
- super(`challenge context resolution exceeded ${timeoutMs}ms`);
15981
- this.name = "ChallengeContextTimeoutError";
15982
- }
15983
- };
15984
-
15985
15490
  //#endregion
15986
15491
  //#region src/wire/vault.ts
15987
15492
  /**
@@ -16108,9 +15613,9 @@ function deriveMcpiOrgKid(slug) {
16108
15613
  * surface stay unchanged.
16109
15614
  *
16110
15615
  * Throws on an invalid slug (same boundary as {@link deriveMcpiOrgDid}) rather
16111
- * than returning `[]`: an empty list re-enables the engine's fail-open
16112
- * "trust every root" default, so an org with a broken slug is a configuration
16113
- * error to surface loudly server-side, not a reason to trust everything.
15616
+ * than returning `[]`: an empty list makes the engine reject every delegation,
15617
+ * so an org with a broken slug is a configuration error to surface loudly
15618
+ * server-side, not a silent outage of every delegated agent.
16114
15619
  */
16115
15620
  function resolveTrustedDelegationRoots(org) {
16116
15621
  return [deriveMcpiOrgDid(org.slug)];
@@ -16127,53 +15632,6 @@ function deriveMcpiUserDid(slug, userId) {
16127
15632
  return `${deriveMcpiOrgDid(slug)}:users:${userId}`;
16128
15633
  }
16129
15634
 
16130
- //#endregion
16131
- //#region src/mcpi/delegation-headers.ts
16132
- /**
16133
- * Delegation-proof request detection (P2 / DR-1).
16134
- *
16135
- * The engine's L2 delegation-root pinning (`ContextSpec.trustedDelegationRoots`)
16136
- * is only consulted when a request actually carries a delegation credential.
16137
- * Every consumer surface — the Cloudflare gateway worker, the published SDK
16138
- * middleware (Next.js / Express), and the Next.js detector route — uses this one
16139
- * check to decide whether to resolve + inject the org's trusted roots, so the
16140
- * human / no-delegation hot path stays a precise no-op.
16141
- *
16142
- * Keeping the header set here (rather than re-listing the literals at each site)
16143
- * is the whole point: a new delegation transport header is added in one place
16144
- * and every verifier surface agrees.
16145
- */
16146
- /**
16147
- * Lowercased delegation-proof header names. `kya-os-delegation-credential` is the
16148
- * canonical KYA-OS transport; `kya-delegation` is the legacy envelope form still
16149
- * accepted via `legacyEnvelopeFallback`.
16150
- */
16151
- const DELEGATION_PROOF_HEADERS = ["kya-os-delegation-credential", "kya-delegation"];
16152
- /** A header value is "present" when it is a non-empty string (or non-empty list). */
16153
- function isPresent(value) {
16154
- if (Array.isArray(value)) return value.length > 0;
16155
- return typeof value === "string" && value.length > 0;
16156
- }
16157
- /**
16158
- * Does the request carry a KYA-OS delegation-proof header?
16159
- *
16160
- * Accepts either a `Headers` instance (Next.js / fetch — case-insensitive
16161
- * lookup) or a plain header record (raw Node/Express headers, gateway worker's
16162
- * lowercased map). Record keys are matched case-insensitively, so callers do not
16163
- * need to pre-normalize. Returns `false` for `null`/`undefined`.
16164
- */
16165
- function requestCarriesDelegationProof(headers) {
16166
- if (!headers) return false;
16167
- if (typeof headers.get === "function") {
16168
- const h = headers;
16169
- return DELEGATION_PROOF_HEADERS.some((name) => isPresent(h.get(name)));
16170
- }
16171
- const record = headers;
16172
- const lowerKeyed = /* @__PURE__ */ new Map();
16173
- for (const key of Object.keys(record)) lowerKeyed.set(key.toLowerCase(), record[key]);
16174
- return DELEGATION_PROOF_HEADERS.some((name) => isPresent(lowerKeyed.get(name)));
16175
- }
16176
-
16177
15635
  //#endregion
16178
15636
  //#region src/mcpi/principal.ts
16179
15637
  /**
@@ -16411,24 +15869,6 @@ const DelegationVerifiedBySchema = require_schemas._enum([
16411
15869
  "checkpoint"
16412
15870
  ]);
16413
15871
  /**
16414
- * Max length of a registered session anchor (`sid`) accepted on the wire and
16415
- * enforced again at the customer route. The join partner
16416
- * `bouncer_sessions.id` is `varchar(100)`; `detections.registered_sid` stays
16417
- * `text` (converting a live column to `varchar` would take an ACCESS EXCLUSIVE
16418
- * rewrite of the hottest table), so this constant is the width contract
16419
- * instead of the column type.
16420
- */
16421
- const REGISTERED_SID_MAX_LENGTH = 100;
16422
- /**
16423
- * The one delegation result that may attribute a `sid` to a session timeline.
16424
- * A rejected presentation carries no engine-emitted sid, and a sid on a
16425
- * `failed` / `not_presented` report is attacker-shaped, so ingest stamps
16426
- * `registered_sid` only for this result and nulls it otherwise (D4 / D15).
16427
- * One member on purpose: Section 13 of the plan records how an explicitly
16428
- * unverified-labeled `failed` could join it later.
16429
- */
16430
- const SID_ATTRIBUTABLE_RESULT = "verified";
16431
- /**
16432
15872
  * The delegation the agent presented (a reference + outcome, not the proof).
16433
15873
  * `result` and `verifiedBy` are required; the JWT claims (`jti` / `iss` / `aud`
16434
15874
  * / `capabilities` / `exp`) are optional because `not_presented` carries none.
@@ -18322,6 +17762,77 @@ const TrackingReadinessSchema = require_schemas.object({
18322
17762
  }).strict())
18323
17763
  }).strict();
18324
17764
 
17765
+ //#endregion
17766
+ //#region src/api/cli-registration.ts
17767
+ const CLI_PAIRING_PROTOCOL_VERSION = 2;
17768
+ const CLI_PAIRING_UPGRADE_MESSAGE = "Upgrade the KYA-OS CLI and run checkpoint init again. This pairing requires independent terminal proof.";
17769
+ const CliPairingProofSchema = require_schemas.string().regex(/^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/);
17770
+ const CLI_PAIRING_FRAMEWORKS = [
17771
+ "nextjs",
17772
+ "express",
17773
+ "static",
17774
+ "unknown"
17775
+ ];
17776
+ const readable = require_schemas.string().max(255).regex(READABLE_TEXT, READABLE_TEXT_MESSAGE);
17777
+ const label = readable.min(1);
17778
+ const hint = require_schemas.string().trim().min(1).max(255).regex(READABLE_TEXT, READABLE_TEXT_MESSAGE);
17779
+ const uuid = require_schemas.string().uuid();
17780
+ const CliPairingRegisterRequestSchema = require_schemas.object({
17781
+ protocolVersion: require_schemas.literal(2),
17782
+ exchangeChallenge: CliPairingProofSchema,
17783
+ domainHint: hint.optional(),
17784
+ repoName: hint.optional(),
17785
+ framework: require_schemas._enum(CLI_PAIRING_FRAMEWORKS).optional()
17786
+ }).strict();
17787
+ const CliPairingApprovedClaimSchema = require_schemas.object({
17788
+ userId: uuid,
17789
+ organizationId: uuid,
17790
+ projectId: uuid
17791
+ }).strict();
17792
+ const CliPairingClaimSchema = require_schemas.object({
17793
+ userId: uuid,
17794
+ userEmail: label,
17795
+ userName: readable.nullable(),
17796
+ organizationId: uuid,
17797
+ organizationName: label,
17798
+ organizationSlug: readable.nullable(),
17799
+ projectId: uuid,
17800
+ projectName: label,
17801
+ projectDomain: readable.nullable()
17802
+ }).strict();
17803
+ const CliPairingExchangeRequestSchema = require_schemas.object({
17804
+ protocolVersion: require_schemas.literal(2),
17805
+ registrationId: uuid,
17806
+ exchangeVerifier: CliPairingProofSchema,
17807
+ approvedClaim: CliPairingApprovedClaimSchema
17808
+ }).strict();
17809
+ const CliPairingRegisterDataSchema = require_schemas.object({
17810
+ protocolVersion: require_schemas.literal(2),
17811
+ registrationId: uuid,
17812
+ claimToken: require_schemas.string().regex(/^cliclaim_[a-f0-9]{64}$/),
17813
+ claimUrl: require_schemas.string().url(),
17814
+ confirmationCode: require_schemas.string().regex(/^[BCDFGHJKLMNPQRSTVWXZ]{4}-[BCDFGHJKLMNPQRSTVWXZ]{4}$/),
17815
+ expiresAt: require_schemas.string().datetime()
17816
+ }).strict();
17817
+ const CliPairingPrivateStatusDataSchema = require_schemas.discriminatedUnion("status", [require_schemas.object({
17818
+ protocolVersion: require_schemas.literal(2),
17819
+ status: require_schemas.literal("pending"),
17820
+ claimed: require_schemas._null()
17821
+ }).strict(), require_schemas.object({
17822
+ protocolVersion: require_schemas.literal(2),
17823
+ status: require_schemas.literal("claimed"),
17824
+ claimed: CliPairingClaimSchema
17825
+ }).strict()]);
17826
+ const CliPairingExchangeDataSchema = require_schemas.object({
17827
+ protocolVersion: require_schemas.literal(2),
17828
+ userId: uuid,
17829
+ projectId: uuid,
17830
+ organizationId: uuid,
17831
+ friendlyId: require_schemas.string().nullable(),
17832
+ apiKey: require_schemas.string().regex(/^sk_[a-f0-9]{64}$/),
17833
+ dashboardUrl: require_schemas.string().url()
17834
+ }).strict();
17835
+
18325
17836
  //#endregion
18326
17837
  //#region src/index.ts
18327
17838
  const VERSION = "0.1.0";
@@ -18333,13 +17844,17 @@ exports.A2ASignedRequestSchema = A2ASignedRequestSchema;
18333
17844
  exports.A2ATaskRequestSchema = A2ATaskRequestSchema;
18334
17845
  exports.A2ATaskSourceConfigSchema = A2ATaskSourceConfigSchema;
18335
17846
  exports.A2ATaskStateSchema = A2ATaskStateSchema;
18336
- exports.ACCEPT_CHALLENGE_HEADER = ACCEPT_CHALLENGE_HEADER;
17847
+ exports.ACCEPT_CHALLENGE_HEADER = require_host_adapter.ACCEPT_CHALLENGE_HEADER;
17848
+ exports.ADMIN_ACCOUNTS_STATUS_FILTERS = ADMIN_ACCOUNTS_STATUS_FILTERS;
17849
+ exports.ADMIN_ACCOUNT_STATUSES = ADMIN_ACCOUNT_STATUSES;
18337
17850
  exports.ADMIN_DELTA_BASES = ADMIN_DELTA_BASES;
17851
+ exports.ADMIN_ORG_EXCLUSION_REASONS = ADMIN_ORG_EXCLUSION_REASONS;
18338
17852
  exports.ADMIN_OVERVIEW_CACHE_STATUSES = ADMIN_OVERVIEW_CACHE_STATUSES;
18339
17853
  exports.ADMIN_OVERVIEW_LIST_LIMIT_DEFAULT = ADMIN_OVERVIEW_LIST_LIMIT_DEFAULT;
18340
17854
  exports.ADMIN_OVERVIEW_LIST_LIMIT_MAX = ADMIN_OVERVIEW_LIST_LIMIT_MAX;
18341
17855
  exports.ADMIN_OVERVIEW_SECTIONS = ADMIN_OVERVIEW_SECTIONS;
18342
17856
  exports.ADMIN_OVERVIEW_WINDOWS = ADMIN_OVERVIEW_WINDOWS;
17857
+ exports.ADMIN_TRUSTED_METRICS = ADMIN_TRUSTED_METRICS;
18343
17858
  exports.AGENT_CATEGORY_META = AGENT_CATEGORY_META;
18344
17859
  exports.AI_AGENT_HEADERS = AI_AGENT_HEADERS;
18345
17860
  exports.ANALYTICS_ERRORS = ANALYTICS_ERRORS;
@@ -18380,6 +17895,7 @@ exports.AgentTypeDefinitionSchema = AgentTypeDefinitionSchema;
18380
17895
  exports.AgentTypeSchema = AgentTypeSchema;
18381
17896
  exports.AggregationTypeSchema = AggregationTypeSchema;
18382
17897
  exports.AllowListEntrySchema = AllowListEntrySchema;
17898
+ exports.AllowedDomainsSchema = AllowedDomainsSchema;
18383
17899
  exports.AnalyticsAgentSourcesQuerySchema = AnalyticsAgentSourcesQuerySchema;
18384
17900
  exports.AnalyticsAgentTypesQuerySchema = AnalyticsAgentTypesQuerySchema;
18385
17901
  exports.AnalyticsChartDataSchema = AnalyticsChartDataSchema;
@@ -18414,7 +17930,7 @@ exports.BARE_ERRORS = BARE_ERRORS;
18414
17930
  exports.BASELINE_ALLOW_POLICY_ID = BASELINE_ALLOW_POLICY_ID;
18415
17931
  exports.BESPOKE_POLICY_IDS = BESPOKE_POLICY_IDS;
18416
17932
  exports.BILLING_ERRORS = BILLING_ERRORS;
18417
- exports.BLOCKED_PATH = BLOCKED_PATH;
17933
+ exports.BLOCKED_PATH = require_host_adapter.BLOCKED_PATH;
18418
17934
  exports.BOT_USER_AGENT_PATTERNS = BOT_USER_AGENT_PATTERNS;
18419
17935
  exports.BOUNCER_LOWERCASE_ERRORS = BOUNCER_LOWERCASE_ERRORS;
18420
17936
  exports.BOUNCER_UPPERCASE_ERRORS = BOUNCER_UPPERCASE_ERRORS;
@@ -18451,8 +17967,12 @@ exports.BulkOperationResultSchema = BulkOperationResultSchema;
18451
17967
  exports.BulkOperationTypeSchema = BulkOperationTypeSchema;
18452
17968
  exports.BulkResponseSchema = BulkResponseSchema;
18453
17969
  exports.BulkResultItemSchema = BulkResultItemSchema;
17970
+ exports.ByteBoundedMemo = require_step_up.ByteBoundedMemo;
18454
17971
  exports.CACHE_LIMITS = CACHE_LIMITS;
18455
17972
  exports.CACHE_TTL = CACHE_TTL;
17973
+ exports.CLI_PAIRING_FRAMEWORKS = CLI_PAIRING_FRAMEWORKS;
17974
+ exports.CLI_PAIRING_PROTOCOL_VERSION = CLI_PAIRING_PROTOCOL_VERSION;
17975
+ exports.CLI_PAIRING_UPGRADE_MESSAGE = CLI_PAIRING_UPGRADE_MESSAGE;
18456
17976
  exports.CLOUD_PROVIDER_RANGES = CLOUD_PROVIDER_RANGES;
18457
17977
  exports.CONDITION_FIELDS = CONDITION_FIELDS;
18458
17978
  exports.CONDITION_OPERATORS = CONDITION_OPERATORS;
@@ -18463,13 +17983,21 @@ exports.CURRENT_POLICY_VERSION = CURRENT_POLICY_VERSION;
18463
17983
  exports.CacheConfigSchema = CacheConfigSchema;
18464
17984
  exports.CachedDetectionDataSchema = CachedDetectionDataSchema;
18465
17985
  exports.ChallengeParamsSchema = ChallengeParamsSchema;
18466
- exports.ChallengeWireError = ChallengeWireError;
17986
+ exports.ChallengeWireError = require_host_adapter.ChallengeWireError;
18467
17987
  exports.CircuitBreakerConfigSchema = CircuitBreakerConfigSchema;
18468
17988
  exports.CircuitBreakerStateSchema = CircuitBreakerStateSchema;
18469
17989
  exports.ClaimVerificationSchema = ClaimVerificationSchema;
18470
17990
  exports.CliIdentityQuerySchema = CliIdentityQuerySchema;
18471
17991
  exports.CliIdentityServiceSchema = CliIdentityServiceSchema;
18472
17992
  exports.CliIdentitySummarySchema = CliIdentitySummarySchema;
17993
+ exports.CliPairingApprovedClaimSchema = CliPairingApprovedClaimSchema;
17994
+ exports.CliPairingClaimSchema = CliPairingClaimSchema;
17995
+ exports.CliPairingExchangeDataSchema = CliPairingExchangeDataSchema;
17996
+ exports.CliPairingExchangeRequestSchema = CliPairingExchangeRequestSchema;
17997
+ exports.CliPairingPrivateStatusDataSchema = CliPairingPrivateStatusDataSchema;
17998
+ exports.CliPairingProofSchema = CliPairingProofSchema;
17999
+ exports.CliPairingRegisterDataSchema = CliPairingRegisterDataSchema;
18000
+ exports.CliPairingRegisterRequestSchema = CliPairingRegisterRequestSchema;
18473
18001
  exports.ClickEventSchema = ClickEventSchema;
18474
18002
  exports.ClientDetectionSchema = ClientDetectionSchema;
18475
18003
  exports.CollectFingerprintRequestSchema = CollectFingerprintRequestSchema;
@@ -18492,6 +18020,12 @@ exports.ConsentCapabilityGroupSchema = ConsentCapabilityGroupSchema;
18492
18020
  exports.ConsentCapabilitySchema = ConsentCapabilitySchema;
18493
18021
  exports.ConsentConfigMetadataSchema = ConsentConfigMetadataSchema;
18494
18022
  exports.ConsentConfigSchema = ConsentConfigSchema;
18023
+ exports.ConsentInputCopySchema = ConsentInputCopySchema;
18024
+ exports.ConsentPolicyCapabilitySchema = ConsentPolicyCapabilitySchema;
18025
+ exports.ConsentPolicyResponseSchema = ConsentPolicyResponseSchema;
18026
+ exports.ConsentPolicyRiskLevelSchema = ConsentPolicyRiskLevelSchema;
18027
+ exports.ConsentScopeLabelsSchema = ConsentScopeLabelsSchema;
18028
+ exports.ConsentSignInCopySchema = ConsentSignInCopySchema;
18495
18029
  exports.ConsentTermsSchema = ConsentTermsSchema;
18496
18030
  exports.ConsentUISchema = ConsentUISchema;
18497
18031
  exports.ConsumedArtifactSchema = ConsumedArtifactSchema;
@@ -18520,7 +18054,7 @@ exports.DEFAULT_API_KEY_RATE_LIMITS = DEFAULT_API_KEY_RATE_LIMITS;
18520
18054
  exports.DEFAULT_AUTHORIZATION_HOST = DEFAULT_AUTHORIZATION_HOST;
18521
18055
  exports.DEFAULT_BEHAVIORAL_THRESHOLDS = DEFAULT_BEHAVIORAL_THRESHOLDS;
18522
18056
  exports.DEFAULT_CACHE_CONFIG = DEFAULT_CACHE_CONFIG;
18523
- exports.DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS = DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS;
18057
+ exports.DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS = require_host_adapter.DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS;
18524
18058
  exports.DEFAULT_CONFIDENCE_THRESHOLDS = DEFAULT_CONFIDENCE_THRESHOLDS;
18525
18059
  exports.DEFAULT_CORS_CONFIG = DEFAULT_CORS_CONFIG;
18526
18060
  exports.DEFAULT_DETECTION_OPTIONS = DEFAULT_DETECTION_OPTIONS;
@@ -18538,7 +18072,7 @@ exports.DEFAULT_SESSION_CONFIG = DEFAULT_SESSION_CONFIG;
18538
18072
  exports.DEFAULT_THRESHOLDS = DEFAULT_THRESHOLDS;
18539
18073
  exports.DEFAULT_TIMEOUTS = DEFAULT_TIMEOUTS;
18540
18074
  exports.DEFAULT_WEBHOOK_EVENTS = DEFAULT_WEBHOOK_EVENTS;
18541
- exports.DELEGATION_PROOF_HEADERS = DELEGATION_PROOF_HEADERS;
18075
+ exports.DELEGATION_PROOF_HEADERS = require_registered_sid.DELEGATION_PROOF_HEADERS;
18542
18076
  exports.DEPLOY_ERRORS = DEPLOY_ERRORS;
18543
18077
  exports.DEPLOY_STEPS = DEPLOY_STEPS;
18544
18078
  exports.DETECTION_ERRORS = DETECTION_ERRORS;
@@ -18622,6 +18156,9 @@ exports.EventTrackingRequestSchema = EventTrackingRequestSchema;
18622
18156
  exports.EventTrackingResponseSchema = EventTrackingResponseSchema;
18623
18157
  exports.ExportAnalyticsSchema = ExportAnalyticsSchema;
18624
18158
  exports.ExpressMiddlewareOptionsSchema = ExpressMiddlewareOptionsSchema;
18159
+ exports.FAIL_CLOSED_BODY = require_step_up.FAIL_CLOSED_BODY;
18160
+ exports.FAIL_CLOSED_HEADERS = require_step_up.FAIL_CLOSED_HEADERS;
18161
+ exports.FAIL_CLOSED_STATUS = require_step_up.FAIL_CLOSED_STATUS;
18625
18162
  exports.FallbackOptionsSchema = FallbackOptionsSchema;
18626
18163
  exports.FilterOperatorSchema = FilterOperatorSchema;
18627
18164
  exports.FingerprintAnalysisSchema = FingerprintAnalysisSchema;
@@ -18632,6 +18169,7 @@ exports.FingerprintResponseSchema = FingerprintResponseSchema;
18632
18169
  exports.FingerprintSearchQuerySchema = FingerprintSearchQuerySchema;
18633
18170
  exports.FleetPullRequestReceiptSchema = FleetPullRequestReceiptSchema;
18634
18171
  exports.ForgeabilityRiskSchema = ForgeabilityRiskSchema;
18172
+ exports.GATEWAY_VAULT_ERRORS = GATEWAY_VAULT_ERRORS;
18635
18173
  exports.GitHubTaskSourceConfigSchema = GitHubTaskSourceConfigSchema;
18636
18174
  exports.GrowthBatchRequestSchema = GrowthBatchRequestSchema;
18637
18175
  exports.GrowthConfigurationResetSchema = GrowthConfigurationResetSchema;
@@ -18665,8 +18203,8 @@ exports.JafarParseError = JafarParseError;
18665
18203
  exports.KNOWN_AGENT_PATTERNS = KNOWN_AGENT_PATTERNS;
18666
18204
  exports.KYAOS_PROTOCOL_ERRORS = KYAOS_PROTOCOL_ERRORS;
18667
18205
  exports.KYA_A2A_EXTENSION = KYA_A2A_EXTENSION;
18668
- exports.KYA_HTTP_ERROR = KYA_HTTP_ERROR;
18669
- exports.KYA_HTTP_ERROR_STATUS = KYA_HTTP_ERROR_STATUS;
18206
+ exports.KYA_HTTP_ERROR = require_kya_http_error_codes.KYA_HTTP_ERROR;
18207
+ exports.KYA_HTTP_ERROR_STATUS = require_kya_http_error_codes.KYA_HTTP_ERROR_STATUS;
18670
18208
  exports.KYA_OS_HANDSHAKE_METHODS = KYA_OS_HANDSHAKE_METHODS;
18671
18209
  exports.KYA_OS_WIRE_METHODS = KYA_OS_WIRE_METHODS;
18672
18210
  exports.KeyboardEventSchema = KeyboardEventSchema;
@@ -18692,6 +18230,8 @@ exports.MANAGEMENT_DEVICE_INTERVAL = MANAGEMENT_DEVICE_INTERVAL;
18692
18230
  exports.MANAGEMENT_REFRESH_PREFIX = MANAGEMENT_REFRESH_PREFIX;
18693
18231
  exports.MANAGEMENT_USER_CODE_ALPHABET = MANAGEMENT_USER_CODE_ALPHABET;
18694
18232
  exports.MATCH_ACTIONS = MATCH_ACTIONS;
18233
+ exports.MAX_ALLOWED_DOMAINS = MAX_ALLOWED_DOMAINS;
18234
+ exports.MAX_ALLOWED_DOMAIN_LENGTH = MAX_ALLOWED_DOMAIN_LENGTH;
18695
18235
  exports.MAX_BULK_BATCH_SIZE = MAX_BULK_BATCH_SIZE;
18696
18236
  exports.MAX_ED25519_KEY_BODY_LENGTH = MAX_ED25519_KEY_BODY_LENGTH;
18697
18237
  exports.MAX_REASON_CODES_HEADER_BYTES = MAX_REASON_CODES_HEADER_BYTES;
@@ -18748,6 +18288,9 @@ exports.ModelCredentialRevocationSchema = ModelCredentialRevocationSchema;
18748
18288
  exports.ModelCredentialSchema = ModelCredentialSchema;
18749
18289
  exports.MouseEventSchema = MouseEventSchema;
18750
18290
  exports.NETWORK_ERRORS = NETWORK_ERRORS;
18291
+ exports.NO_EVIDENCE_CATEGORY = require_step_up.NO_EVIDENCE_CATEGORY;
18292
+ exports.NO_EVIDENCE_EQUALITY_TERM = require_step_up.NO_EVIDENCE_EQUALITY_TERM;
18293
+ exports.NO_EVIDENCE_EXCLUSION_TERM = require_step_up.NO_EVIDENCE_EXCLUSION_TERM;
18751
18294
  exports.NetworkConfigSchema = NetworkConfigSchema;
18752
18295
  exports.NetworkContextSchema = NetworkContextSchema;
18753
18296
  exports.NetworkInfoSchema = NetworkInfoSchema;
@@ -18856,9 +18399,14 @@ Object.defineProperty(exports, 'ProviderRegistryDefinitionSchema', {
18856
18399
  exports.ProvidersResponseSchema = ProvidersResponseSchema;
18857
18400
  exports.ProvisionKeyRequestSchema = ProvisionKeyRequestSchema;
18858
18401
  exports.ProvisionKeyResponseSchema = ProvisionKeyResponseSchema;
18402
+ exports.ProvisioningAccountLinkRequestSchema = ProvisioningAccountLinkRequestSchema;
18403
+ exports.ProvisioningAccountLinkResponseSchema = ProvisioningAccountLinkResponseSchema;
18404
+ exports.ProvisioningIdentityProofSchema = ProvisioningIdentityProofSchema;
18859
18405
  exports.ProvisioningModeSchema = ProvisioningModeSchema;
18860
18406
  exports.ProvisioningOrganizationRoleSchema = ProvisioningOrganizationRoleSchema;
18861
18407
  exports.ProvisioningOrganizationSummarySchema = ProvisioningOrganizationSummarySchema;
18408
+ exports.ProxyAssertionSchema = ProxyAssertionSchema;
18409
+ exports.ProxyCollectionStateSchema = ProxyCollectionStateSchema;
18862
18410
  exports.ProxyInfoSchema = ProxyInfoSchema;
18863
18411
  exports.ProxyTypeSchema = ProxyTypeSchema;
18864
18412
  exports.PublicAnalyticsBotTypeSchema = PublicAnalyticsBotTypeSchema;
@@ -18878,7 +18426,7 @@ exports.QuerySchema = QuerySchema;
18878
18426
  exports.RATE_LIMIT_ERRORS = RATE_LIMIT_ERRORS;
18879
18427
  exports.READABLE_TEXT = READABLE_TEXT;
18880
18428
  exports.READABLE_TEXT_MESSAGE = READABLE_TEXT_MESSAGE;
18881
- exports.REGISTERED_SID_MAX_LENGTH = REGISTERED_SID_MAX_LENGTH;
18429
+ exports.REGISTERED_SID_MAX_LENGTH = require_registered_sid.REGISTERED_SID_MAX_LENGTH;
18882
18430
  exports.REPORT_AI_AGENT_NAMES = REPORT_AI_AGENT_NAMES;
18883
18431
  exports.REPORT_AI_CRAWLER_NAMES = REPORT_AI_CRAWLER_NAMES;
18884
18432
  exports.RESOURCE_ERRORS = RESOURCE_ERRORS;
@@ -18932,7 +18480,7 @@ exports.SERVICE_TRAFFIC_KEYS = SERVICE_TRAFFIC_KEYS;
18932
18480
  exports.SESSION_ERRORS = SESSION_ERRORS;
18933
18481
  exports.SESSION_LIMITS = SESSION_LIMITS;
18934
18482
  exports.SHADOW_NOISY_OR_CONFIDENCE_KEY = SHADOW_NOISY_OR_CONFIDENCE_KEY;
18935
- exports.SID_ATTRIBUTABLE_RESULT = SID_ATTRIBUTABLE_RESULT;
18483
+ exports.SID_ATTRIBUTABLE_RESULT = require_registered_sid.SID_ATTRIBUTABLE_RESULT;
18936
18484
  exports.SLUG_REGEX = SLUG_REGEX;
18937
18485
  exports.SUSPICIOUS_HEADERS = SUSPICIOUS_HEADERS;
18938
18486
  exports.SUSPICIOUS_PATTERNS = require_posture_origins.SUSPICIOUS_PATTERNS;
@@ -19063,7 +18611,8 @@ exports.UserSchema = UserSchema;
19063
18611
  exports.VALIDATION_ERRORS = VALIDATION_ERRORS;
19064
18612
  exports.VALIDATION_MODES = VALIDATION_MODES;
19065
18613
  exports.VALIDATION_PATTERNS = require_posture_origins.VALIDATION_PATTERNS;
19066
- exports.VERDICT_COOKIE_NAME = VERDICT_COOKIE_NAME;
18614
+ exports.VAULT_ERRORS = VAULT_ERRORS;
18615
+ exports.VERDICT_COOKIE_NAME = require_host_adapter.VERDICT_COOKIE_NAME;
19067
18616
  exports.VERSION = VERSION;
19068
18617
  exports.VerdictEvidenceSchema = VerdictEvidenceSchema;
19069
18618
  exports.VerificationCacheEntrySchema = VerificationCacheEntrySchema;
@@ -19098,9 +18647,11 @@ exports.WorkloadEnrollmentResultSchema = WorkloadEnrollmentResultSchema;
19098
18647
  exports.WorkloadEnrollmentRevocationSchema = WorkloadEnrollmentRevocationSchema;
19099
18648
  exports.WorkloadEnrollmentSchema = WorkloadEnrollmentSchema;
19100
18649
  exports.WorkloadRotationProofPayloadSchema = WorkloadRotationProofPayloadSchema;
19101
- exports.acceptsHtml = acceptsHtml;
18650
+ exports.acceptsHtml = require_host_adapter.acceptsHtml;
18651
+ exports.adminAccountsQuerySchema = adminAccountsQuerySchema;
19102
18652
  exports.adminOverviewQuerySchema = adminOverviewQuerySchema;
19103
- exports.approvalQuorumForRequest = approvalQuorumForRequest;
18653
+ exports.analyzePolicySource = require_step_up.analyzePolicySource;
18654
+ exports.approvalQuorumForRequest = require_step_up.approvalQuorumForRequest;
19104
18655
  exports.assertVendorRangesFresh = assertVendorRangesFresh;
19105
18656
  exports.assignmentChangeRequestSchema = assignmentChangeRequestSchema;
19106
18657
  exports.auditLogQuerySchema = auditLogQuerySchema;
@@ -19109,22 +18660,22 @@ exports.base58btcEncode = base58btcEncode;
19109
18660
  exports.batchAssignmentRequestSchema = batchAssignmentRequestSchema;
19110
18661
  exports.bespokePolicyLabel = bespokePolicyLabel;
19111
18662
  exports.blockDelegationVerdict = blockDelegationVerdict;
19112
- exports.blockEqualityLiterals = blockEqualityLiterals;
19113
- exports.buildChallengeWire = buildChallengeWire;
19114
- exports.buildDelegationBearerHeader = buildDelegationBearerHeader;
19115
- exports.buildDelegationChallengeBody = buildDelegationChallengeBody;
19116
- exports.buildDelegationChallengeEnvelope = buildDelegationChallengeEnvelope;
19117
- exports.buildDelegationChallengeHeader = buildDelegationChallengeHeader;
19118
- exports.buildDelegationInstructions = buildDelegationInstructions;
18663
+ exports.blockEqualityLiterals = require_step_up.blockEqualityLiterals;
18664
+ exports.buildChallengeWire = require_host_adapter.buildChallengeWire;
18665
+ exports.buildDelegationBearerHeader = require_host_adapter.buildDelegationBearerHeader;
18666
+ exports.buildDelegationChallengeBody = require_host_adapter.buildDelegationChallengeBody;
18667
+ exports.buildDelegationChallengeEnvelope = require_host_adapter.buildDelegationChallengeEnvelope;
18668
+ exports.buildDelegationChallengeHeader = require_host_adapter.buildDelegationChallengeHeader;
18669
+ exports.buildDelegationInstructions = require_host_adapter.buildDelegationInstructions;
19119
18670
  exports.buildInitialStepsState = buildInitialStepsState;
19120
18671
  exports.buildKnownPatternLookup = buildKnownPatternLookup;
19121
18672
  exports.buildVerdictEvidence = buildVerdictEvidence;
19122
18673
  exports.calculateDeployProgress = calculateDeployProgress;
19123
18674
  exports.callbackSchema = callbackSchema;
19124
- exports.cedarQuotedValueRegExp = cedarQuotedValueRegExp;
18675
+ exports.cedarQuotedValueRegExp = require_step_up.cedarQuotedValueRegExp;
19125
18676
  exports.changePasswordSchema = changePasswordSchema;
19126
18677
  exports.classifyAgentTaxonomy = classifyAgentTaxonomy;
19127
- exports.classifyResponseShape = classifyResponseShape;
18678
+ exports.classifyResponseShape = require_host_adapter.classifyResponseShape;
19128
18679
  exports.claudeRuntimeLabel = claudeRuntimeLabel;
19129
18680
  exports.compressIpv6 = require_client_ip.compressIpv6;
19130
18681
  exports.computeEntropyConfidence = computeEntropyConfidence;
@@ -19138,27 +18689,27 @@ exports.createPaginatedResponseSchema = createPaginatedResponseSchema;
19138
18689
  exports.createPolicyFetcher = createPolicyFetcher;
19139
18690
  exports.createSuccessResponse = createSuccessResponse;
19140
18691
  exports.createValidationErrorResponse = createValidationErrorResponse;
19141
- exports.decisionPolicyId = decisionPolicyId;
18692
+ exports.decisionPolicyId = require_step_up.decisionPolicyId;
19142
18693
  exports.decodeDidKeyEd25519 = decodeDidKeyEd25519;
19143
18694
  exports.decodeDidKeyP256 = decodeDidKeyP256;
19144
18695
  exports.decodeEd25519PublicKeyMultibaseTolerant = decodeEd25519PublicKeyMultibaseTolerant;
19145
18696
  exports.defaultConfig = defaultConfig;
19146
18697
  exports.deriveConflictId = deriveConflictId;
19147
18698
  exports.deriveCorrelationId = deriveCorrelationId;
19148
- exports.deriveDelegationPickupUri = deriveDelegationPickupUri;
18699
+ exports.deriveDelegationPickupUri = require_host_adapter.deriveDelegationPickupUri;
19149
18700
  exports.deriveImportIssueId = deriveImportIssueId;
19150
18701
  exports.deriveMcpClientDid = deriveMcpClientDid;
19151
18702
  exports.deriveMcpiOrgDid = deriveMcpiOrgDid;
19152
18703
  exports.deriveMcpiOrgKid = deriveMcpiOrgKid;
19153
18704
  exports.deriveMcpiUserDid = deriveMcpiUserDid;
19154
- exports.deriveVerdict = deriveVerdict;
19155
- exports.detectionClassToEnum = detectionClassToEnum;
18705
+ exports.deriveVerdict = require_host_adapter.deriveVerdict;
18706
+ exports.detectionClassToEnum = require_host_adapter.detectionClassToEnum;
19156
18707
  exports.discoveredToolSchema = discoveredToolSchema;
19157
18708
  exports.encodeDidKeyEd25519 = encodeDidKeyEd25519;
19158
18709
  exports.encodeEd25519PublicKeyMultibase = encodeEd25519PublicKeyMultibase;
19159
- exports.encodeVerdictCookie = encodeVerdictCookie;
19160
- exports.enumToDetectionClass = enumToDetectionClass;
19161
- exports.escapeCedarString = escapeCedarString;
18710
+ exports.encodeVerdictCookie = require_host_adapter.encodeVerdictCookie;
18711
+ exports.enumToDetectionClass = require_host_adapter.enumToDetectionClass;
18712
+ exports.escapeCedarString = require_step_up.escapeCedarString;
19162
18713
  exports.evaluatePolicy = evaluatePolicy;
19163
18714
  exports.extractCorrelationIdFromHeaders = extractCorrelationIdFromHeaders;
19164
18715
  exports.extractMatch = require_posture_origins.extractMatch;
@@ -19180,7 +18731,7 @@ exports.gatewayInternalDiscoverErrorSchema = gatewayInternalDiscoverErrorSchema;
19180
18731
  exports.gatewayInternalDiscoverSuccessSchema = gatewayInternalDiscoverSuccessSchema;
19181
18732
  exports.gatewayInternalToolsListSchema = gatewayInternalToolsListSchema;
19182
18733
  exports.gatewayToolCallSchema = gatewayToolCallSchema;
19183
- exports.generateDelegationSid = generateDelegationSid;
18734
+ exports.generateDelegationSid = require_host_adapter.generateDelegationSid;
19184
18735
  exports.generateTestId = generateTestId;
19185
18736
  exports.getAgentDisplayName = getAgentDisplayName;
19186
18737
  exports.getBotType = getBotType;
@@ -19200,19 +18751,21 @@ exports.hasClaudeCodeToken = hasClaudeCodeToken;
19200
18751
  exports.hasClaudeSearchBotToken = hasClaudeSearchBotToken;
19201
18752
  exports.hasClaudeUserToken = hasClaudeUserToken;
19202
18753
  exports.hasPinnedSigningVendor = hasPinnedSigningVendor;
18754
+ exports.hostMatchesAllowedDomains = hostMatchesAllowedDomains;
19203
18755
  exports.initializePolicyFetcher = initializePolicyFetcher;
19204
18756
  exports.ipAddressSchema = ipAddressSchema;
19205
18757
  exports.isAuthorizedLead = isAuthorizedLead;
19206
18758
  exports.isBespokePolicyId = isBespokePolicyId;
19207
18759
  exports.isBlockingAction = isBlockingAction;
19208
18760
  exports.isClaudeProductLabel = isClaudeProductLabel;
19209
- exports.isForbidBlock = isForbidBlock;
18761
+ exports.isEngineEnforcing = require_step_up.isEngineEnforcing;
18762
+ exports.isForbidBlock = require_step_up.isForbidBlock;
19210
18763
  exports.isHighConfidenceVerification = isHighConfidenceVerification;
19211
18764
  exports.isKnownAgentType = isKnownAgentType;
19212
18765
  exports.isKnownAiCrawler = isKnownAiCrawler;
19213
18766
  exports.isKyaOsHandshakeMethod = isKyaOsHandshakeMethod;
19214
18767
  exports.isKyaOsWireMethod = isKyaOsWireMethod;
19215
- exports.isLegacyDetectionClass = isLegacyDetectionClass;
18768
+ exports.isLegacyDetectionClass = require_host_adapter.isLegacyDetectionClass;
19216
18769
  exports.isLegitimateCategory = isLegitimateCategory;
19217
18770
  exports.isLimitExceeded = isLimitExceeded;
19218
18771
  exports.isNonNavigablePolicyId = isNonNavigablePolicyId;
@@ -19221,34 +18774,40 @@ exports.isPolicyUnavailableError = isPolicyUnavailableError;
19221
18774
  exports.isPrivateOrReservedHost = isPrivateOrReservedHost;
19222
18775
  exports.isSupportedAuthType = isSupportedAuthType;
19223
18776
  exports.isTraditionalBot = isTraditionalBot;
19224
- exports.isUnnarrowedDenyBlock = isUnnarrowedDenyBlock;
18777
+ exports.isUnnarrowedDenyBlock = require_step_up.isUnnarrowedDenyBlock;
19225
18778
  exports.isValidAuthorizationHost = isValidAuthorizationHost;
19226
18779
  exports.isValidFingerprintResponse = isValidFingerprintResponse;
19227
18780
  exports.isValidMcpiOrgSlug = isValidMcpiOrgSlug;
19228
18781
  exports.isValidWasmDetectionResult = isValidWasmDetectionResult;
19229
18782
  exports.isValidWasmRequestMetadata = isValidWasmRequestMetadata;
18783
+ exports.lintMissingBaselinePermit = lintMissingBaselinePermit;
19230
18784
  exports.lintUnnarrowedDenyRules = lintUnnarrowedDenyRules;
19231
18785
  exports.loadRulesAsync = loadRulesAsync;
19232
18786
  exports.mapDetectionToReasonCodes = mapDetectionToReasonCodes;
19233
18787
  exports.mapLegacyAuthType = mapLegacyAuthType;
18788
+ exports.mapProxyAssertions = mapProxyAssertions;
19234
18789
  exports.mapToLegacyAuthType = mapToLegacyAuthType;
19235
18790
  exports.matchPath = matchPath;
19236
18791
  exports.mergeWithDefaults = mergeWithDefaults;
19237
- exports.migrateLegacyDetectionClass = migrateLegacyDetectionClass;
18792
+ exports.migrateLegacyDetectionClass = require_host_adapter.migrateLegacyDetectionClass;
19238
18793
  exports.modelCredentialFingerprint = modelCredentialFingerprint;
19239
18794
  exports.nonNavigablePolicyLabel = nonNavigablePolicyLabel;
19240
18795
  exports.normalizeAgentName = normalizeAgentName;
18796
+ exports.normalizeAllowedDomainForWrite = normalizeAllowedDomainForWrite;
18797
+ exports.normalizeAllowedDomainList = normalizeAllowedDomainList;
19241
18798
  exports.normalizeChallengeType = normalizeChallengeType;
19242
18799
  exports.normalizeClientIp = require_client_ip.normalizeClientIp;
19243
18800
  exports.normalizeConfidence = normalizeConfidence;
19244
- exports.normalizeDetectionClass = normalizeDetectionClass;
19245
- exports.normalizeDetectionClassEnum = normalizeDetectionClassEnum;
18801
+ exports.normalizeDetectionClass = require_host_adapter.normalizeDetectionClass;
18802
+ exports.normalizeDetectionClassEnum = require_host_adapter.normalizeDetectionClassEnum;
19246
18803
  exports.normalizeHandshakeMethod = normalizeHandshakeMethod;
19247
18804
  exports.normalizeOrganizationName = normalizeOrganizationName;
18805
+ exports.normalizeStoredAllowedDomain = normalizeStoredAllowedDomain;
19248
18806
  exports.normalizeWireMethod = normalizeWireMethod;
19249
18807
  exports.oauthClientSchema = oauthClientSchema;
19250
18808
  exports.parseAcceptedArtifactRevision = parseAcceptedArtifactRevision;
19251
18809
  exports.parseAgentName = parseAgentName;
18810
+ exports.parseCedarStatements = require_step_up.parseCedarStatements;
19252
18811
  exports.parseClaimVerification = parseClaimVerification;
19253
18812
  exports.parseDependencyBinding = parseDependencyBinding;
19254
18813
  exports.parseEvaluationContext = parseEvaluationContext;
@@ -19260,21 +18819,24 @@ exports.parsePolicyConfig = parsePolicyConfig;
19260
18819
  exports.parseRules = parseRules;
19261
18820
  exports.partial = partial;
19262
18821
  exports.passwordSchema = passwordSchema;
19263
- exports.pathHasUnnarrowedDenyRule = pathHasUnnarrowedDenyRule;
19264
- exports.pathLiteralsInBlock = pathLiteralsInBlock;
18822
+ exports.pathHasExplicitDenyRuleFor = require_step_up.pathHasExplicitDenyRuleFor;
18823
+ exports.pathHasUnnarrowedDenyRule = require_step_up.pathHasUnnarrowedDenyRule;
18824
+ exports.pathHasUnnarrowedDenyRuleFor = require_step_up.pathHasUnnarrowedDenyRuleFor;
18825
+ exports.pathLiteralsInBlock = require_step_up.pathLiteralsInBlock;
19265
18826
  exports.permitDelegationVerdict = permitDelegationVerdict;
19266
18827
  exports.projectResetRequestSchema = projectResetRequestSchema;
19267
18828
  exports.readableText = readableText;
19268
18829
  exports.reconstructConfidenceFromEvidence = reconstructConfidenceFromEvidence;
19269
18830
  exports.refineClaudeDisplayLabel = refineClaudeDisplayLabel;
19270
18831
  exports.refineSessionGrainClaudeLabel = refineSessionGrainClaudeLabel;
19271
- exports.requestCarriesDelegationProof = requestCarriesDelegationProof;
19272
- exports.requiredScopesForRequest = requiredScopesForRequest;
18832
+ exports.requestCarriesDelegationProof = require_registered_sid.requestCarriesDelegationProof;
18833
+ exports.requestPresentedCredential = require_registered_sid.requestPresentedCredential;
18834
+ exports.requiredScopesForRequest = require_step_up.requiredScopesForRequest;
19273
18835
  exports.resetPasswordSchema = resetPasswordSchema;
19274
18836
  exports.resetPolicyFetcher = resetPolicyFetcher;
19275
18837
  exports.resolveAuthorizationHost = resolveAuthorizationHost;
19276
18838
  exports.resolveBotSignals = resolveBotSignals;
19277
- exports.resolveChallengeContext = resolveChallengeContext;
18839
+ exports.resolveChallengeContext = require_host_adapter.resolveChallengeContext;
19278
18840
  exports.resolveClientIp = require_client_ip.resolveClientIp;
19279
18841
  exports.resolveTrustedDelegationRoots = resolveTrustedDelegationRoots;
19280
18842
  exports.riskScoreColumnValue = riskScoreColumnValue;
@@ -19282,11 +18844,13 @@ exports.riskScoreFromMetadata = riskScoreFromMetadata;
19282
18844
  exports.riskScoreSourceFromMetadata = riskScoreSourceFromMetadata;
19283
18845
  exports.safeParsePolicyConfig = safeParsePolicyConfig;
19284
18846
  exports.safeUrl = safeUrl;
19285
- exports.selectBodyReadable200 = selectBodyReadable200;
19286
- exports.serveBodyReadable200 = serveBodyReadable200;
18847
+ exports.selectBodyReadable200 = require_host_adapter.selectBodyReadable200;
18848
+ exports.serveBodyReadable200 = require_host_adapter.serveBodyReadable200;
19287
18849
  exports.signInSchema = signInSchema;
19288
18850
  exports.signUpSchema = signUpSchema;
19289
- exports.splitCedarBlocks = splitCedarBlocks;
18851
+ exports.splitCedarBlocks = require_step_up.splitCedarBlocks;
18852
+ exports.statementApplies = require_step_up.statementApplies;
18853
+ exports.statementId = require_step_up.statementId;
19290
18854
  exports.strict = strict;
19291
18855
  exports.supportsClientSide = supportsClientSide;
19292
18856
  exports.supportsHeaders = supportsHeaders;
@@ -19300,7 +18864,7 @@ exports.toPercent = toPercent;
19300
18864
  exports.toProviderRegistryFormat = toProviderRegistryFormat;
19301
18865
  exports.toStoredCorrelationId = toStoredCorrelationId;
19302
18866
  exports.toWasmRequestMetadata = toWasmRequestMetadata;
19303
- exports.unescapeCedarString = unescapeCedarString;
18867
+ exports.unescapeCedarString = require_step_up.unescapeCedarString;
19304
18868
  exports.updateStepsState = updateStepsState;
19305
18869
  exports.upstreamDiscoveryErrorSchema = upstreamDiscoveryErrorSchema;
19306
18870
  exports.upstreamServerInputSchema = upstreamServerInputSchema;
@@ -19325,7 +18889,7 @@ Object.defineProperty(exports, 'validateProviderDefinition', {
19325
18889
  });
19326
18890
  exports.validateRules = validateRules;
19327
18891
  exports.validateRulesLoose = validateRulesLoose;
19328
- exports.validateStepUpQuorum = validateStepUpQuorum;
18892
+ exports.validateStepUpQuorum = require_step_up.validateStepUpQuorum;
19329
18893
  exports.vaultResolveDataSchema = vaultResolveDataSchema;
19330
18894
  exports.vaultResolveErrorSchema = vaultResolveErrorSchema;
19331
18895
  exports.vaultResolveMetaSchema = vaultResolveMetaSchema;
@@ -19333,4 +18897,5 @@ exports.vaultResolveResponseSchema = vaultResolveResponseSchema;
19333
18897
  exports.vaultResolveSuccessSchema = vaultResolveSuccessSchema;
19334
18898
  exports.verifyContractRecordIdentity = verifyContractRecordIdentity;
19335
18899
  exports.verifyEmailSchema = verifyEmailSchema;
19336
- exports.wasmToDetectionResult = wasmToDetectionResult;
18900
+ exports.wasmToDetectionResult = wasmToDetectionResult;
18901
+ exports.withNoEvidenceExclusion = require_step_up.withNoEvidenceExclusion;