@kya-os/checkpoint-shared 1.5.2 → 1.6.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 (75) 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-DVoHMHjY.d.mts → browser-posture-BuChqmH5.d.mts} +2 -2
  10. package/dist/{browser-posture-DVoHMHjY.d.mts.map → browser-posture-BuChqmH5.d.mts.map} +1 -1
  11. package/dist/{browser-posture-D4j2a5gi.d.ts → browser-posture-DIaVLuW3.d.ts} +2 -2
  12. package/dist/{browser-posture-D4j2a5gi.d.ts.map → browser-posture-DIaVLuW3.d.ts.map} +1 -1
  13. package/dist/browser-posture-proof.d.mts +2 -2
  14. package/dist/browser-posture-proof.d.ts +2 -2
  15. package/dist/browser-posture-proof.js +1 -1
  16. package/dist/browser-posture-proof.mjs +1 -1
  17. package/dist/browser-posture.d.mts +1 -1
  18. package/dist/browser-posture.d.ts +1 -1
  19. package/dist/browser-posture.js +3 -3
  20. package/dist/browser-posture.mjs +3 -3
  21. package/dist/browser-posture.mjs.map +1 -1
  22. package/dist/clearance.d.mts +1 -1
  23. package/dist/clearance.d.ts +1 -1
  24. package/dist/clearance.js +2 -2
  25. package/dist/clearance.mjs +2 -2
  26. package/dist/errors/index.d.mts +17 -0
  27. package/dist/errors/index.d.mts.map +1 -1
  28. package/dist/errors/index.d.ts +17 -0
  29. package/dist/errors/index.d.ts.map +1 -1
  30. package/dist/errors/index.js +75 -3
  31. package/dist/errors/index.mjs +75 -3
  32. package/dist/errors/index.mjs.map +1 -1
  33. package/dist/{external-Ct8j_hto.d.ts → external-B7WI9FyQ.d.mts} +2 -2
  34. package/dist/{external-Ct8j_hto.d.mts.map → external-B7WI9FyQ.d.mts.map} +1 -1
  35. package/dist/{external-Ct8j_hto.d.mts → external-B7WI9FyQ.d.ts} +2 -2
  36. package/dist/{external-Ct8j_hto.d.ts.map → external-B7WI9FyQ.d.ts.map} +1 -1
  37. package/dist/gateway-client-ip.d.mts +1 -1
  38. package/dist/gateway-client-ip.d.ts +1 -1
  39. package/dist/gateway-client-ip.js +1 -1
  40. package/dist/gateway-client-ip.mjs +1 -1
  41. package/dist/index.d.mts +811 -132
  42. package/dist/index.d.mts.map +1 -1
  43. package/dist/index.d.ts +811 -132
  44. package/dist/index.d.ts.map +1 -1
  45. package/dist/index.js +1945 -145
  46. package/dist/index.mjs +1891 -145
  47. package/dist/index.mjs.map +1 -1
  48. package/dist/mcpi/approval-grant/index.d.mts.map +1 -1
  49. package/dist/mcpi/approval-grant/index.d.ts.map +1 -1
  50. package/dist/mcpi/approval-grant/index.js +10 -1
  51. package/dist/mcpi/approval-grant/index.mjs +10 -1
  52. package/dist/mcpi/approval-grant/index.mjs.map +1 -1
  53. package/dist/mcpi/dashboard-config/index.d.mts +3 -2
  54. package/dist/mcpi/dashboard-config/index.d.mts.map +1 -1
  55. package/dist/mcpi/dashboard-config/index.d.ts +3 -2
  56. package/dist/mcpi/dashboard-config/index.d.ts.map +1 -1
  57. package/dist/{posture-origins-CEm83u4D.js → posture-origins-LFkX80oF.js} +6 -0
  58. package/dist/{posture-origins-Dl7i8j93.mjs → posture-origins-Pn-ii-Pp.mjs} +2 -2
  59. package/dist/{posture-origins-Dl7i8j93.mjs.map → posture-origins-Pn-ii-Pp.mjs.map} +1 -1
  60. package/dist/{project-verification-key-CgSVX9_m.mjs → project-verification-key-66N4edKn.mjs} +2 -2
  61. package/dist/{project-verification-key-CgSVX9_m.mjs.map → project-verification-key-66N4edKn.mjs.map} +1 -1
  62. package/dist/{project-verification-key-C3L5rd8a.js → project-verification-key-BccT12tQ.js} +1 -1
  63. package/dist/{schemas-DxY-dk9y.mjs → schemas-7qodsG-Z.mjs} +49 -2
  64. package/dist/schemas-7qodsG-Z.mjs.map +1 -0
  65. package/dist/{schemas-BmjNLAE7.js → schemas-YhagYDx_.js} +59 -0
  66. package/fixtures/cli-registration.v2.json +115 -0
  67. package/fixtures/detection/reason-codes.json +1 -1
  68. package/fixtures/kya-http/README.md +34 -26
  69. package/fixtures/kya-http/protected-resource-metadata.full.json +14 -5
  70. package/fixtures/kya-http/protected-resource-metadata.invalid-issuer.json +51 -0
  71. package/fixtures/kya-http/protected-resource-metadata.no-issuer.json +32 -0
  72. package/fixtures/reviewer-grant-revocation.v1.json +285 -0
  73. package/package.json +4 -4
  74. package/dist/schemas-DxY-dk9y.mjs.map +0 -1
  75. package/fixtures/kya-http/protected-resource-metadata.global.json +0 -28
package/dist/index.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as __commonJSMin } from "./rolldown-runtime-iY2fYEqi.mjs";
2
- import { C as unknown, D as _coercedNumber, E as _coercedDate, O as NEVER, S as union, T as _coercedBoolean, _ as number$1, a as _instanceof, b as record, c as boolean$1, d as discriminatedUnion, g as never, h as literal, i as _enum, l as custom, m as ipv6, n as ZodDate, o as any, p as ipv4, r as ZodNumber, s as array, t as ZodBoolean, u as date$1, v as object, w as ZodError, x as string, y as partialRecord } from "./schemas-DxY-dk9y.mjs";
3
- import { a as HEADER_PATTERNS, c as SUSPICIOUS_PATTERNS, d as VALIDATION_PATTERNS, f as extractMatch, h as testPatterns, i as BROWSER_PATTERNS, l as USER_AGENT_PATTERNS, m as testPattern, o as MOBILE_PATTERNS, p as findMatchingPattern, r as validatePostureOrigins, s as OS_PATTERNS, u as UUID_PATTERN } from "./posture-origins-Dl7i8j93.mjs";
2
+ import { A as NEVER, C as string, D as _coercedBoolean, E as ZodError, O as _coercedDate, S as strictObject, T as unknown, _ as never, a as _instanceof, b as partialRecord, c as array, d as date$1, f as discriminatedUnion, g as literal, h as ipv6, i as _enum, k as _coercedNumber, l as boolean$1, m as ipv4, n as ZodDate, o as _null, r as ZodNumber, s as any, t as ZodBoolean, u as custom, v as number$1, w as union, x as record, y as object } from "./schemas-7qodsG-Z.mjs";
3
+ import { a as BROWSER_PATTERNS, c as OS_PATTERNS, d as UUID_PATTERN, f as VALIDATION_PATTERNS, g as testPatterns, h as testPattern, i as validatePostureOrigins, l as SUSPICIOUS_PATTERNS, m as findMatchingPattern, o as HEADER_PATTERNS, p as extractMatch, s as MOBILE_PATTERNS, t as isPublicSuffixLike, u as USER_AGENT_PATTERNS } from "./posture-origins-Pn-ii-Pp.mjs";
4
4
  import { i as resolveClientIp, n as normalizeClientIp, r as parseIpv6, t as compressIpv6 } from "./client-ip-B2Xeo-GK.mjs";
5
5
  import { sha256 } from "@noble/hashes/sha2.js";
6
6
  import { bytesToHex } from "@noble/hashes/utils.js";
@@ -38,6 +38,112 @@ function date(params) {
38
38
  return _coercedDate(ZodDate, params);
39
39
  }
40
40
 
41
+ //#endregion
42
+ //#region src/core/network-assertions.ts
43
+ const ProxyCollectionStateSchema = _enum([
44
+ "current",
45
+ "unavailable",
46
+ "stale",
47
+ "unsupported",
48
+ "conflicting",
49
+ "insufficient_support"
50
+ ]);
51
+ const epochSeconds = number$1().int().min(0).max(253402300799);
52
+ const percentage = number$1().int().min(0).max(100);
53
+ /** Source assertions describe request egress membership, never a visitor identity or fraud verdict. */
54
+ const ProxyAssertionSchema = object({
55
+ kind: string().min(1),
56
+ source: string().min(1),
57
+ subjectScope: literal("request_egress"),
58
+ membership: _enum([
59
+ "present",
60
+ "absent",
61
+ "unknown"
62
+ ]),
63
+ evidenceGrade: _enum(["confirmed", "vendor_reported"]),
64
+ collectionState: ProxyCollectionStateSchema,
65
+ /** Unix seconds supplied by the source. Reader fetch time is not source observation time. */
66
+ observedAt: epochSeconds.nullable(),
67
+ expiresAt: epochSeconds.nullable(),
68
+ membershipConfidence: percentage.nullable(),
69
+ sourceReliability: percentage.nullable(),
70
+ fraudProbability: number$1().min(0).max(1).nullable(),
71
+ proxyClass: _enum(["datacenter", "unknown"]).optional()
72
+ }).strict();
73
+ const knownKinds = /* @__PURE__ */ new Set([
74
+ "tor_exit",
75
+ "published_vpn_exit",
76
+ "observed_proxy",
77
+ "suspected_residential_proxy",
78
+ "privacy_relay",
79
+ "local_tunnel",
80
+ "hosting"
81
+ ]);
82
+ /**
83
+ * The default admits only confirmed, current assertions. maxmind_legacy preserves
84
+ * existing vendor positives without claiming that its undated optional file is fresh.
85
+ * Uncertain evidence never produces a confirmed-clean false Boolean.
86
+ */
87
+ function mapProxyAssertions(proxyAssertions, nowSeconds, collectionState, compatibility = "confirmed_current") {
88
+ const states = [collectionState];
89
+ const eligible = [];
90
+ for (const assertion of proxyAssertions) {
91
+ if (!knownKinds.has(assertion.kind)) {
92
+ states.push("unsupported");
93
+ continue;
94
+ }
95
+ states.push(assertion.collectionState);
96
+ if (assertion.collectionState !== "current" && assertion.collectionState !== "insufficient_support") {
97
+ states.push(assertion.collectionState);
98
+ continue;
99
+ }
100
+ const dated = assertion.observedAt !== null && assertion.expiresAt !== null;
101
+ const current = dated && assertion.observedAt <= nowSeconds && assertion.expiresAt > nowSeconds;
102
+ if (dated && !current) {
103
+ states.push("stale");
104
+ continue;
105
+ }
106
+ const confirmed = assertion.evidenceGrade === "confirmed" && assertion.collectionState === "current" && current;
107
+ const legacy = compatibility === "maxmind_legacy" && assertion.source === "maxmind-anonymous-ip" && assertion.evidenceGrade === "vendor_reported" && assertion.collectionState === "insufficient_support" && assertion.observedAt === null && assertion.expiresAt === null;
108
+ if (confirmed || legacy) eligible.push(assertion);
109
+ else states.push("insufficient_support");
110
+ }
111
+ for (const assertion of eligible) if (assertion.membership === "present" && eligible.some((other) => other.kind === assertion.kind && other.membership === "absent")) states.push("conflicting");
112
+ if (proxyAssertions.length === 0) states.push("insufficient_support");
113
+ const proxyCollectionState = [
114
+ "conflicting",
115
+ "unsupported",
116
+ "unavailable",
117
+ "stale",
118
+ "insufficient_support",
119
+ "current"
120
+ ].find((state) => states.includes(state));
121
+ const blocked = proxyCollectionState !== "current" && proxyCollectionState !== "insufficient_support";
122
+ const positive = eligible.filter((assertion) => assertion.membership === "present");
123
+ const preferred = [
124
+ positive.find((assertion) => assertion.kind === "tor_exit"),
125
+ positive.find((assertion) => assertion.kind === "published_vpn_exit"),
126
+ positive.find((assertion) => assertion.kind === "suspected_residential_proxy"),
127
+ positive.find((assertion) => assertion.kind === "observed_proxy" && assertion.proxyClass === "datacenter"),
128
+ positive.find((assertion) => assertion.kind === "observed_proxy")
129
+ ].find(Boolean);
130
+ const types = {
131
+ tor_exit: "tor",
132
+ published_vpn_exit: "vpn",
133
+ suspected_residential_proxy: "residential_proxy",
134
+ observed_proxy: preferred?.proxyClass === "datacenter" ? "datacenter" : "unknown"
135
+ };
136
+ return {
137
+ proxy: !blocked && preferred ? {
138
+ isProxy: true,
139
+ proxyType: types[preferred.kind],
140
+ confidence: preferred.membershipConfidence ?? (preferred.evidenceGrade === "vendor_reported" ? 90 : 0)
141
+ } : void 0,
142
+ proxyAssertions,
143
+ proxyCollectionState
144
+ };
145
+ }
146
+
41
147
  //#endregion
42
148
  //#region src/core/risk-score.ts
43
149
  /**
@@ -485,8 +591,8 @@ const ProxyInfoSchema = object({
485
591
  });
486
592
  /**
487
593
  * Host-supplied network / IP-intelligence context for a request's
488
- * `trueIp`. Mirrors the Rust `NetworkContext`; echoed verbatim on the
489
- * engine's `VerifyResult.network` (a sibling of `DetectionDetail`, like
594
+ * `trueIp`. Legacy fields mirror the Rust `NetworkContext` and appear on
595
+ * the engine's `VerifyResult.network` (a sibling of `DetectionDetail`, like
490
596
  * `EngineInfo` above — there is no wrapping `VerifyResultSchema`) when the
491
597
  * host supplied one, and exposed to Cedar as `context.ip_routing_type` /
492
598
  * `context.is_proxy`. Absent-safe: a request with no network context is
@@ -497,7 +603,13 @@ const NetworkContextSchema = object({
497
603
  asn: number$1().int().nonnegative().optional(),
498
604
  isp: string().optional(),
499
605
  routingType: RoutingTypeSchema,
500
- proxy: ProxyInfoSchema.optional()
606
+ proxy: ProxyInfoSchema.optional(),
607
+ /**
608
+ * TypeScript-host evidence, retained in detection rows and extended API read-back.
609
+ * Older Rust readers do not echo these additive fields.
610
+ */
611
+ proxyAssertions: array(ProxyAssertionSchema).optional(),
612
+ proxyCollectionState: ProxyCollectionStateSchema.optional()
501
613
  });
502
614
  /**
503
615
  * Descriptive detection detail from the engine.
@@ -606,7 +718,7 @@ const DetectionDetailSchema = object({
606
718
  * `DetectionDetail.granted_scopes` (additive, omitted when empty). */
607
719
  grantedScopes: array(string()).optional(),
608
720
  /**
609
- * GODPROMPTS/detection-reason-codes: namespaced detection/* codes, most-
721
+ * Detection reason codes (#4874): namespaced detection/* codes, most-
610
722
  * significant-evidence first, derived via mapDetectionToReasonCodes.
611
723
  * Optional: only producers that opt into signal exposure (currently
612
724
  * /api/v1/detect via buildDetectionSignalExposure) populate this.
@@ -1282,7 +1394,7 @@ function getVerificationRiskLevel(method, confidence) {
1282
1394
  /**
1283
1395
  * Detection reason-code mapping: the single pure projection of a
1284
1396
  * detection's structured facts onto the `DETECTION_REASON_CODES` registry
1285
- * (GODPROMPTS/detection-reason-codes).
1397
+ * (#4874).
1286
1398
  *
1287
1399
  * The engine already emits structured evidence (`signals[]` with a typed
1288
1400
  * `source`, `verificationMethod`, `detectionClass`, `isAiCrawler`) but the
@@ -2533,7 +2645,6 @@ const DEFAULT_ENV_VARS = {
2533
2645
  AGENTSHIELD_SECRET_KEY: "",
2534
2646
  AGENTSHIELD_PIXEL_ID: "",
2535
2647
  AGENTSHIELD_API_ENDPOINT: "https://api.agentshield.ai",
2536
- AGENTSHIELD_WASM_PATH: "/wasm/agentshield_wasm_bg.wasm",
2537
2648
  AGENTSHIELD_CACHE_TTL: "3600",
2538
2649
  AGENTSHIELD_DEBUG: "false",
2539
2650
  AGENTSHIELD_LOG_LEVEL: "info"
@@ -2797,7 +2908,9 @@ const BARE_ERRORS = {
2797
2908
  BARE_INVALID_END_DATE: "INVALID_END_DATE",
2798
2909
  BARE_INVALID_DATE_RANGE: "INVALID_DATE_RANGE",
2799
2910
  BARE_INVALID_DATE: "INVALID_DATE",
2800
- BARE_UNKNOWN_ERROR: "UNKNOWN_ERROR"
2911
+ BARE_UNKNOWN_ERROR: "UNKNOWN_ERROR",
2912
+ BARE_NOT_FOUND: "NOT_FOUND",
2913
+ BARE_FORBIDDEN: "FORBIDDEN"
2801
2914
  };
2802
2915
  /**
2803
2916
  * Lowercase Error Codes
@@ -2967,6 +3080,40 @@ const KYAOS_PROTOCOL_ERRORS = {
2967
3080
  KYAOS_SLASH_POLICY_UNAVAILABLE: "kyaos/policy-unavailable"
2968
3081
  };
2969
3082
  /**
3083
+ * Gateway Vault Resolve Error Codes
3084
+ *
3085
+ * Emitted by POST /api/v1/gateway/vault/{projectId}/resolve, and five of them
3086
+ * (INVALID_ASSERTION, INVALID_SIGNATURE, ASSERTION_EXPIRED, ASSERTION_REPLAYED,
3087
+ * PROJECT_MISMATCH) also by POST /api/v1/vault/{projectId}/resolve, which
3088
+ * verifies through the same shared verifier and nonce store
3089
+ * (apps/web/lib/vault/). Every emission site passes an explicit message and
3090
+ * status, so registering them changes no wire behaviour.
3091
+ */
3092
+ const GATEWAY_VAULT_ERRORS = {
3093
+ MALFORMED_REQUEST_BODY: "MALFORMED_REQUEST_BODY",
3094
+ GATEWAY_NOT_CONFIGURED: "GATEWAY_NOT_CONFIGURED",
3095
+ INVALID_ASSERTION: "INVALID_ASSERTION",
3096
+ INVALID_SIGNATURE: "INVALID_SIGNATURE",
3097
+ ASSERTION_EXPIRED: "ASSERTION_EXPIRED",
3098
+ ASSERTION_REPLAYED: "ASSERTION_REPLAYED",
3099
+ PROJECT_MISMATCH: "PROJECT_MISMATCH",
3100
+ ISSUER_MISMATCH: "ISSUER_MISMATCH",
3101
+ USER_DID_MISMATCH: "USER_DID_MISMATCH",
3102
+ TOOL_NAME_MISMATCH: "TOOL_NAME_MISMATCH",
3103
+ SESSION_ID_MISMATCH: "SESSION_ID_MISMATCH",
3104
+ NOT_AUTHORIZED: "NOT_AUTHORIZED",
3105
+ CREDENTIALS_NOT_CONFIGURED: "CREDENTIALS_NOT_CONFIGURED",
3106
+ OAUTH_EXPIRED: "OAUTH_EXPIRED"
3107
+ };
3108
+ /**
3109
+ * Vault Resolve Error Codes
3110
+ *
3111
+ * The one code unique to POST /api/v1/vault/{projectId}/resolve. The rest of
3112
+ * its surface reuses GATEWAY_VAULT_ERRORS, BARE_ERRORS and INTERNAL_ERRORS by
3113
+ * key.
3114
+ */
3115
+ const VAULT_ERRORS = { NO_AGENT_KEY: "NO_AGENT_KEY" };
3116
+ /**
2970
3117
  * All Error Codes
2971
3118
  */
2972
3119
  const ERROR_CODES = {
@@ -2992,7 +3139,9 @@ const ERROR_CODES = {
2992
3139
  ...BOUNCER_UPPERCASE_ERRORS,
2993
3140
  ...AUDIT_ERRORS,
2994
3141
  ...AUDIT_PROTOCOL_ERRORS,
2995
- ...KYAOS_PROTOCOL_ERRORS
3142
+ ...KYAOS_PROTOCOL_ERRORS,
3143
+ ...GATEWAY_VAULT_ERRORS,
3144
+ ...VAULT_ERRORS
2996
3145
  };
2997
3146
  /**
2998
3147
  * Error Messages
@@ -3110,6 +3259,8 @@ const ERROR_MESSAGES = {
3110
3259
  [BARE_ERRORS.BARE_INVALID_DATE_RANGE]: "startDate must be before endDate",
3111
3260
  [BARE_ERRORS.BARE_INVALID_DATE]: "Invalid date format. Use ISO 8601 format (YYYY-MM-DD or YYYY-MM-DDTHH:mm:ss.sssZ)",
3112
3261
  [BARE_ERRORS.BARE_UNKNOWN_ERROR]: "Failed to delete project",
3262
+ [BARE_ERRORS.BARE_NOT_FOUND]: "Not found",
3263
+ [BARE_ERRORS.BARE_FORBIDDEN]: "Forbidden",
3113
3264
  [LOWERCASE_ERRORS.LOWERCASE_INVALID_JSON]: "Request body must be valid JSON",
3114
3265
  [LOWERCASE_ERRORS.LOWERCASE_VALIDATION_ERROR]: "Invalid request body",
3115
3266
  [BOUNCER_LOWERCASE_ERRORS.LOWERCASE_NO_PROJECT]: "API key is not associated with a project",
@@ -3203,7 +3354,22 @@ const ERROR_MESSAGES = {
3203
3354
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_HOLDER_MISMATCH]: "The holder does not match the delegation or grant",
3204
3355
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_INVALID_SIGNATURE]: "The signature could not be verified",
3205
3356
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_SESSION_MISMATCH]: "The session does not match the delegation or proof",
3206
- [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_POLICY_UNAVAILABLE]: "The policy revision is currently unavailable"
3357
+ [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_POLICY_UNAVAILABLE]: "The policy revision is currently unavailable",
3358
+ [GATEWAY_VAULT_ERRORS.MALFORMED_REQUEST_BODY]: "Malformed JSON body",
3359
+ [GATEWAY_VAULT_ERRORS.GATEWAY_NOT_CONFIGURED]: "Gateway public key or trusted DID not configured for this project",
3360
+ [GATEWAY_VAULT_ERRORS.INVALID_ASSERTION]: "Assertion JWT must have 3 parts",
3361
+ [GATEWAY_VAULT_ERRORS.INVALID_SIGNATURE]: "Assertion signature verification failed",
3362
+ [GATEWAY_VAULT_ERRORS.ASSERTION_EXPIRED]: "Assertion is expired or outside the allowed window",
3363
+ [GATEWAY_VAULT_ERRORS.ASSERTION_REPLAYED]: "Assertion nonce has already been used",
3364
+ [GATEWAY_VAULT_ERRORS.PROJECT_MISMATCH]: "Assertion projectId does not match route",
3365
+ [GATEWAY_VAULT_ERRORS.ISSUER_MISMATCH]: "Assertion issuer does not match trusted gateway DID",
3366
+ [GATEWAY_VAULT_ERRORS.USER_DID_MISMATCH]: "Assertion userDid does not match request body userDid",
3367
+ [GATEWAY_VAULT_ERRORS.TOOL_NAME_MISMATCH]: "Assertion toolName does not match request body toolName",
3368
+ [GATEWAY_VAULT_ERRORS.SESSION_ID_MISMATCH]: "Assertion sessionId does not match request body sessionId",
3369
+ [GATEWAY_VAULT_ERRORS.NOT_AUTHORIZED]: "User is not a member of this organization",
3370
+ [GATEWAY_VAULT_ERRORS.CREDENTIALS_NOT_CONFIGURED]: "Connect your credentials in Checkpoint",
3371
+ [GATEWAY_VAULT_ERRORS.OAUTH_EXPIRED]: "Provider token expired; user must reconnect",
3372
+ [VAULT_ERRORS.NO_AGENT_KEY]: "No agent deployment found for this project"
3207
3373
  };
3208
3374
  /**
3209
3375
  * HTTP Status Codes for Errors
@@ -3255,6 +3421,8 @@ const ERROR_STATUS_CODES = {
3255
3421
  [BOUNCER_UPPERCASE_ERRORS.INVALID_REQUEST_ID]: 400,
3256
3422
  [AUDIT_ERRORS.AUDIT_INVALID_JSON]: 400,
3257
3423
  [AUDIT_ERRORS.AUDIT_INVALID_SUBMISSION]: 400,
3424
+ [GATEWAY_VAULT_ERRORS.MALFORMED_REQUEST_BODY]: 400,
3425
+ [GATEWAY_VAULT_ERRORS.INVALID_ASSERTION]: 400,
3258
3426
  [AUTH_ERRORS.INVALID_API_KEY]: 401,
3259
3427
  [AUTH_ERRORS.EXPIRED_API_KEY]: 401,
3260
3428
  [AUTH_ERRORS.INVALID_TOKEN]: 401,
@@ -3266,6 +3434,7 @@ const ERROR_STATUS_CODES = {
3266
3434
  [BOUNCER_LOWERCASE_ERRORS.LOWERCASE_UNAUTHORIZED]: 401,
3267
3435
  [AUDIT_ERRORS.AUDIT_CREDENTIAL_REQUIRED]: 401,
3268
3436
  [AUDIT_ERRORS.AUDIT_INVALID_CREDENTIAL]: 401,
3437
+ [GATEWAY_VAULT_ERRORS.INVALID_SIGNATURE]: 401,
3269
3438
  [BILLING_ERRORS.LIMIT_EXCEEDED]: 402,
3270
3439
  [BILLING_ERRORS.BILLING_SUSPENDED]: 402,
3271
3440
  [PERMISSION_ERRORS.INSUFFICIENT_PERMISSIONS]: 403,
@@ -3287,6 +3456,16 @@ const ERROR_STATUS_CODES = {
3287
3456
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_DELEGATION_REVOKED]: 403,
3288
3457
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_HOLDER_MISMATCH]: 403,
3289
3458
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_INVALID_SIGNATURE]: 403,
3459
+ [BARE_ERRORS.BARE_FORBIDDEN]: 403,
3460
+ [GATEWAY_VAULT_ERRORS.ASSERTION_EXPIRED]: 403,
3461
+ [GATEWAY_VAULT_ERRORS.ASSERTION_REPLAYED]: 403,
3462
+ [GATEWAY_VAULT_ERRORS.PROJECT_MISMATCH]: 403,
3463
+ [GATEWAY_VAULT_ERRORS.ISSUER_MISMATCH]: 403,
3464
+ [GATEWAY_VAULT_ERRORS.USER_DID_MISMATCH]: 403,
3465
+ [GATEWAY_VAULT_ERRORS.TOOL_NAME_MISMATCH]: 403,
3466
+ [GATEWAY_VAULT_ERRORS.SESSION_ID_MISMATCH]: 403,
3467
+ [GATEWAY_VAULT_ERRORS.NOT_AUTHORIZED]: 403,
3468
+ [GATEWAY_VAULT_ERRORS.OAUTH_EXPIRED]: 403,
3290
3469
  [PERMISSION_ERRORS.RESOURCE_NOT_FOUND]: 404,
3291
3470
  [API_ERRORS.ENDPOINT_NOT_FOUND]: 404,
3292
3471
  [PIXEL_ERRORS.PIXEL_NOT_FOUND]: 404,
@@ -3304,6 +3483,9 @@ const ERROR_STATUS_CODES = {
3304
3483
  [BOUNCER_UPPERCASE_ERRORS.DEPLOYMENT_NOT_FOUND]: 404,
3305
3484
  [BOUNCER_UPPERCASE_ERRORS.DELEGATION_REQUEST_NOT_FOUND]: 404,
3306
3485
  [KYAOS_PROTOCOL_ERRORS.KYAOS_SLASH_INVALID_SESSION]: 404,
3486
+ [BARE_ERRORS.BARE_NOT_FOUND]: 404,
3487
+ [GATEWAY_VAULT_ERRORS.CREDENTIALS_NOT_CONFIGURED]: 404,
3488
+ [VAULT_ERRORS.NO_AGENT_KEY]: 404,
3307
3489
  [API_ERRORS.METHOD_NOT_ALLOWED]: 405,
3308
3490
  [RESOURCE_ERRORS.CONFLICT]: 409,
3309
3491
  [AUDIT_PROTOCOL_ERRORS.AUDIT_LEDGER_MISMATCH]: 409,
@@ -3355,6 +3537,7 @@ const ERROR_STATUS_CODES = {
3355
3537
  [AUDIT_PROTOCOL_ERRORS.AUDIT_MIRROR_VERIFICATION_FAILED]: 500,
3356
3538
  [AUDIT_PROTOCOL_ERRORS.AUDIT_MIRROR_CONTINUITY_FAILED]: 500,
3357
3539
  [AUDIT_PROTOCOL_ERRORS.AUDIT_MIRROR_OUT_OF_ORDER]: 500,
3540
+ [GATEWAY_VAULT_ERRORS.GATEWAY_NOT_CONFIGURED]: 500,
3358
3541
  [NETWORK_ERRORS.UPSTREAM_ERROR]: 502,
3359
3542
  [INTERNAL_ERRORS.INITIALIZATION_ERROR]: 503,
3360
3543
  [INTERNAL_ERRORS.SERVICE_UNAVAILABLE_TRANSIENT]: 503,
@@ -5566,6 +5749,191 @@ const VerificationCacheEntrySchema = object({
5566
5749
  expiresAt: number$1()
5567
5750
  });
5568
5751
 
5752
+ //#endregion
5753
+ //#region src/utils/allowed-domains.ts
5754
+ /**
5755
+ * A pixel's `configuration.allowedDomains`: the page hosts a pixel accepts
5756
+ * events from (`/api/v1/event` compares them to the event URL's hostname).
5757
+ *
5758
+ * Stored form is a bare, lowercase, punycoded host (`shop.example.com`) or a
5759
+ * leftmost wildcard (`*.example.com`, which covers `example.com` itself and
5760
+ * every subdomain, never a look-alike such as `evilexample.com`).
5761
+ *
5762
+ * The comparison side, `URL.hostname`, is always lowercase with no scheme,
5763
+ * port or path, so an entry stored as `*.Example.com`, `https://example.com`
5764
+ * or `example.com:443` never matched and 403'd every event. Entries are now
5765
+ * normalized on write, and legacy rows are normalized again on read so they
5766
+ * stop failing without a backfill.
5767
+ */
5768
+ const WILDCARD_PROBE_LABEL = "allowed-domain-wildcard-probe";
5769
+ const MAX_ALLOWED_DOMAIN_LENGTH = 300;
5770
+ /**
5771
+ * Most entries one pixel may list. Generous on purpose: each event checks
5772
+ * its host against every entry, and the list was uncapped before, so a
5773
+ * smaller cap could refuse an existing pixel's next save.
5774
+ */
5775
+ const MAX_ALLOWED_DOMAINS = 1e3;
5776
+ /** One DNS label after URL's lowercasing and punycoding. `_` occurs in real subdomains. */
5777
+ const HOST_LABEL = /^[a-z0-9_-]{1,63}$/;
5778
+ const DEFAULT_PORTS = /* @__PURE__ */ new Set(["80", "443"]);
5779
+ /** URL accepts empty labels and characters such as `;` or `,`, which no page host has. */
5780
+ function isHostName(host) {
5781
+ if (host.startsWith("[") && host.endsWith("]")) return true;
5782
+ return host.split(".").every((label) => HOST_LABEL.test(label));
5783
+ }
5784
+ function parseAllowedDomain(entry) {
5785
+ const trimmed = typeof entry === "string" ? entry.trim() : "";
5786
+ if (!trimmed) return { error: "Enter a domain such as shop.example.com" };
5787
+ if (trimmed.length > 300) return { error: `Must be at most ${300} characters` };
5788
+ const schemeMatch = /^([a-z][a-z0-9+.-]*):\/\//i.exec(trimmed);
5789
+ const scheme = schemeMatch ? schemeMatch[1].toLowerCase() : "https";
5790
+ if (scheme !== "https" && scheme !== "http") return { error: "Use a domain name, e.g. shop.example.com" };
5791
+ const rest = schemeMatch ? trimmed.slice(schemeMatch[0].length) : trimmed;
5792
+ const wildcard = rest.startsWith("*.");
5793
+ const withoutWildcard = wildcard ? rest.slice(2) : rest;
5794
+ if (!withoutWildcard || withoutWildcard.includes("*")) return { error: "A wildcard is only allowed as the first label, e.g. *.example.com" };
5795
+ let url;
5796
+ try {
5797
+ url = new URL(`${scheme}://${wildcard ? `${WILDCARD_PROBE_LABEL}.` : ""}${withoutWildcard}`);
5798
+ } catch {
5799
+ return { error: "Not a valid domain" };
5800
+ }
5801
+ if (url.username || url.password) return { error: "Domains cannot contain a username" };
5802
+ let host = url.hostname.replace(/\.$/, "");
5803
+ if (wildcard) {
5804
+ if (!host.startsWith(`${WILDCARD_PROBE_LABEL}.`)) return { error: "Not a valid domain" };
5805
+ host = host.slice(30);
5806
+ }
5807
+ if (!isHostName(host)) return { error: "Not a valid domain" };
5808
+ return {
5809
+ host,
5810
+ wildcard,
5811
+ port: DEFAULT_PORTS.has(url.port) ? "" : url.port
5812
+ };
5813
+ }
5814
+ function format(parsed) {
5815
+ return `${parsed.wildcard ? "*." : ""}${parsed.host}`;
5816
+ }
5817
+ /**
5818
+ * `*.com`, `*.co.uk`, `*.myshopify.com`: a wildcard that admits sites the
5819
+ * customer does not control. Same rule as posture origins, so the two
5820
+ * allowlists refuse the same entries.
5821
+ */
5822
+ function isPublicSuffixWildcard(parsed) {
5823
+ return parsed.wildcard && isPublicSuffixLike(parsed.host);
5824
+ }
5825
+ /**
5826
+ * Strict write-time normalization. Returns the stored form, or an error for
5827
+ * junk: another scheme, userinfo, a misplaced wildcard, a host with an empty
5828
+ * label or a character no host has, a non-default port (the check compares
5829
+ * host names only, so a port would suggest a restriction that is never
5830
+ * enforced), or a wildcard over a public suffix.
5831
+ *
5832
+ * @example
5833
+ * normalizeAllowedDomainForWrite('HTTPS://Shop.Example.com:443/cart') // { ok: true, value: 'shop.example.com' }
5834
+ * normalizeAllowedDomainForWrite('*.Example.com.') // { ok: true, value: '*.example.com' }
5835
+ */
5836
+ function normalizeAllowedDomainForWrite(entry) {
5837
+ const parsed = parseAllowedDomain(entry);
5838
+ if ("error" in parsed) return {
5839
+ ok: false,
5840
+ error: parsed.error
5841
+ };
5842
+ if (parsed.port) return {
5843
+ ok: false,
5844
+ error: "Ports are not supported; the check matches the host name only"
5845
+ };
5846
+ if (isPublicSuffixWildcard(parsed)) return {
5847
+ ok: false,
5848
+ error: `*.${parsed.host} would include sites you do not control; list your own hosts instead`
5849
+ };
5850
+ return {
5851
+ ok: true,
5852
+ value: format(parsed)
5853
+ };
5854
+ }
5855
+ /**
5856
+ * Lenient read-time normalization for entries already stored: strips a
5857
+ * scheme, path, port and trailing dot and lowercases, so a legacy entry
5858
+ * such as `https://Example.com:443/` still matches. Undefined for entries
5859
+ * that cannot be a host at all (they then match nothing, as before).
5860
+ *
5861
+ * It never widens what a pixel accepts to a public suffix. A malformed
5862
+ * wildcard over one (`*.COM`, `https://*.co.uk`) matched nothing before, and
5863
+ * cleaning it up would admit every site under it, which writes now refuse.
5864
+ * So it stays undefined. One already stored in exact form (`*.com`) matched
5865
+ * before this normalization existed and is returned unchanged.
5866
+ */
5867
+ function normalizeStoredAllowedDomain(entry) {
5868
+ if (typeof entry !== "string") return void 0;
5869
+ const parsed = parseAllowedDomain(entry);
5870
+ if ("error" in parsed) return void 0;
5871
+ const normalized = format(parsed);
5872
+ if (isPublicSuffixWildcard(parsed) && entry !== normalized) return void 0;
5873
+ return normalized;
5874
+ }
5875
+ /**
5876
+ * Whether a page host is admitted by a pixel's allowed domains. Exact
5877
+ * entries match the host exactly; `*.example.com` matches `example.com`
5878
+ * and any subdomain, on a label boundary.
5879
+ *
5880
+ * @example
5881
+ * hostMatchesAllowedDomains('shop.example.com', ['*.Example.com']) // true
5882
+ * hostMatchesAllowedDomains('evilexample.com', ['*.example.com']) // false
5883
+ */
5884
+ function hostMatchesAllowedDomains(hostname, allowedDomains) {
5885
+ const host = hostname.toLowerCase().replace(/\.$/, "");
5886
+ if (!host) return false;
5887
+ return allowedDomains.some((raw) => {
5888
+ const entry = normalizeStoredAllowedDomain(raw);
5889
+ if (!entry) return false;
5890
+ if (!entry.startsWith("*.")) return host === entry;
5891
+ const base = entry.slice(2);
5892
+ return host === base || host.endsWith(`.${base}`);
5893
+ });
5894
+ }
5895
+ /**
5896
+ * Normalizes a whole list for a write: stored forms in first-seen order with
5897
+ * duplicates removed, plus each junk entry's index and reason. Linear in the
5898
+ * list's length.
5899
+ *
5900
+ * @example
5901
+ * normalizeAllowedDomainList(['Example.com', 'a..b', 'example.com'])
5902
+ * // { values: ['example.com'], errors: [{ index: 1, message: 'Not a valid domain' }] }
5903
+ */
5904
+ function normalizeAllowedDomainList(entries) {
5905
+ const values = /* @__PURE__ */ new Set();
5906
+ const errors = [];
5907
+ entries.forEach((entry, index) => {
5908
+ const result = normalizeAllowedDomainForWrite(entry);
5909
+ if (result.ok) values.add(result.value);
5910
+ else errors.push({
5911
+ index,
5912
+ message: result.error
5913
+ });
5914
+ });
5915
+ return {
5916
+ values: [...values],
5917
+ errors
5918
+ };
5919
+ }
5920
+ /**
5921
+ * `allowedDomains` on a pixel write: at most {@link MAX_ALLOWED_DOMAINS}
5922
+ * entries, each normalized to its stored form (duplicates removed), and each
5923
+ * junk entry reported at its index so the route's 400 says which one and
5924
+ * why. The cap is checked first, so an oversized list is refused without
5925
+ * normalizing any entry.
5926
+ */
5927
+ const AllowedDomainsSchema = array(string()).max(MAX_ALLOWED_DOMAINS, `At most ${MAX_ALLOWED_DOMAINS} allowed domains`).transform((entries, ctx) => {
5928
+ const { values, errors } = normalizeAllowedDomainList(entries);
5929
+ errors.forEach(({ index, message }) => ctx.addIssue({
5930
+ code: "custom",
5931
+ message,
5932
+ path: [index]
5933
+ }));
5934
+ return values;
5935
+ });
5936
+
5569
5937
  //#endregion
5570
5938
  //#region src/api/bulk.ts
5571
5939
  /**
@@ -5722,7 +6090,7 @@ const PixelsBulkCreateItemSchema = object({
5722
6090
  domain: string().url().optional(),
5723
6091
  isActive: boolean$1().default(true),
5724
6092
  configuration: object({
5725
- allowedDomains: array(string()).default([]),
6093
+ allowedDomains: AllowedDomainsSchema.default([]),
5726
6094
  collectBehavioral: boolean$1().default(true),
5727
6095
  enableFingerprinting: boolean$1().default(true),
5728
6096
  enableSessionTracking: boolean$1().default(true),
@@ -5735,7 +6103,7 @@ const PixelsBulkUpdateItemSchema = object({
5735
6103
  domain: string().url().optional(),
5736
6104
  isActive: boolean$1().optional(),
5737
6105
  configuration: object({
5738
- allowedDomains: array(string()).optional(),
6106
+ allowedDomains: AllowedDomainsSchema.optional(),
5739
6107
  collectBehavioral: boolean$1().optional(),
5740
6108
  enableFingerprinting: boolean$1().optional(),
5741
6109
  enableSessionTracking: boolean$1().optional(),
@@ -5992,7 +6360,7 @@ const ProjectSchema = object({
5992
6360
  const PixelConfigurationSchema = object({
5993
6361
  enabled: boolean$1().default(true),
5994
6362
  skipPaths: array(string()).default([]),
5995
- allowedDomains: array(string()).default([]),
6363
+ allowedDomains: AllowedDomainsSchema.default([]),
5996
6364
  blockedAgents: array(string()).default([]),
5997
6365
  batchSize: number$1().min(1).max(100).default(10),
5998
6366
  flushInterval: number$1().min(100).max(6e4).default(5e3),
@@ -6554,6 +6922,31 @@ const ConsentAgentMetadataSchema = object({
6554
6922
  connectedAt: string().datetime().optional()
6555
6923
  });
6556
6924
  /**
6925
+ * Brand copy for one input the consent page asks a person to fill in. Copy
6926
+ * only: which inputs appear is the project's consent policy's call (its
6927
+ * sign-in methods and assurance providers), never this config's.
6928
+ */
6929
+ const ConsentInputCopySchema = object({
6930
+ label: string().max(80).optional(),
6931
+ /** A typed field's placeholder, or the hint line under it where the step has one. */
6932
+ hint: string().max(200).optional()
6933
+ });
6934
+ const ConsentSignInCopySchema = object({
6935
+ /** The address field of the email-code and email-and-password sign-ins. */
6936
+ email: ConsentInputCopySchema.optional(),
6937
+ password: ConsentInputCopySchema.optional(),
6938
+ /** The RPPS number step (`registry:fr-rpps`); `prompt` is its heading. */
6939
+ rpps: ConsentInputCopySchema.extend({ prompt: string().max(120).optional() }).optional()
6940
+ });
6941
+ /** A consent policy names a handful of scopes; this only bounds the stored map. */
6942
+ const MAX_SCOPE_LABELS = 50;
6943
+ /**
6944
+ * The brand's name for a scope no authored capability covers, keyed by the
6945
+ * literal scope. Copy only: unlike a capability, a label here never makes a
6946
+ * scope grantable (`allowedScopesFor` does not read it) and carries no Cedar.
6947
+ */
6948
+ const ConsentScopeLabelsSchema = record(string().min(1).max(120), string().min(1).max(80)).refine((labels) => Object.keys(labels).length <= MAX_SCOPE_LABELS, `At most ${MAX_SCOPE_LABELS} scope labels`);
6949
+ /**
6557
6950
  * Full Consent Configuration
6558
6951
  */
6559
6952
  const ConsentConfigSchema = object({
@@ -6570,7 +6963,9 @@ const ConsentConfigSchema = object({
6570
6963
  headlineVerb: string().min(1).max(40).optional(),
6571
6964
  revocationPath: string().min(1).max(120).optional(),
6572
6965
  inactivityDays: number$1().int().min(1).max(3650).optional(),
6573
- authorizationHost: string().min(1).max(255).optional()
6966
+ authorizationHost: string().min(1).max(255).optional(),
6967
+ signInCopy: ConsentSignInCopySchema.optional(),
6968
+ scopeLabels: ConsentScopeLabelsSchema.optional()
6574
6969
  });
6575
6970
  /**
6576
6971
  * Tool Consent Overrides (CRED-002)
@@ -7348,7 +7743,36 @@ const MarketplaceSourceSchema = _enum([
7348
7743
  ]);
7349
7744
  /** Enforcement posture — mirrors the SDK's `enforcementMode` ('observe' = detect-only). */
7350
7745
  const ProvisioningModeSchema = _enum(["observe", "enforce"]);
7746
+ /** Backend-verifiable installer identity. Caller-supplied verification flags confer no authority. */
7747
+ const ProvisioningIdentityProofSchema = discriminatedUnion("type", [
7748
+ object({
7749
+ type: literal("vercel-oidc"),
7750
+ token: string().min(1).max(16384)
7751
+ }),
7752
+ object({
7753
+ type: literal("railway-oauth"),
7754
+ accessToken: string().min(1).max(16384)
7755
+ }),
7756
+ object({
7757
+ type: literal("checkpoint-account-link"),
7758
+ token: string().min(1).max(16384)
7759
+ })
7760
+ ]);
7761
+ /** A signed account-link capability issued only from the installer's authenticated session. */
7762
+ const ProvisioningAccountLinkRequestSchema = object({
7763
+ source: MarketplaceSourceSchema,
7764
+ externalId: string().min(1).max(255),
7765
+ resourceId: string().min(1).max(255).optional()
7766
+ });
7767
+ const ProvisioningAccountLinkResponseSchema = object({
7768
+ identityProof: object({
7769
+ type: literal("checkpoint-account-link"),
7770
+ token: string().min(1)
7771
+ }),
7772
+ expiresIn: literal(600)
7773
+ });
7351
7774
  const ProvisionKeyRequestSchema = object({
7775
+ identityProof: ProvisioningIdentityProofSchema.optional(),
7352
7776
  source: MarketplaceSourceSchema,
7353
7777
  /** Provider installation/configuration id (e.g. Vercel configurationId). */
7354
7778
  externalId: string().min(1).max(255),
@@ -7361,12 +7785,7 @@ const ProvisionKeyRequestSchema = object({
7361
7785
  resourceId: string().min(1).max(255),
7362
7786
  /** Human-readable label for the dashboard (e.g. "Vercel / team_xxx / my-project"). */
7363
7787
  label: string().min(1).max(200),
7364
- /**
7365
- * Owner of the provisioned project. `email` is the account-linking key: we find-or-create
7366
- * the KYA-OS user + personal org from it (Shopify-parity), so an address matching an
7367
- * existing account provisions INTO that account — including the org it lands in.
7368
- *
7369
- */
7788
+ /** Installer email must match the identity established by identityProof. */
7370
7789
  owner: object({
7371
7790
  email: string().email(),
7372
7791
  name: string().min(1).max(255).optional()
@@ -7400,15 +7819,16 @@ const ProvisionKeyResponseSchema = object({
7400
7819
  });
7401
7820
  /**
7402
7821
  * Request for `POST /api/provisioning/sso-link` — the "Open in Provider" handoff.
7403
- * The adapter has already verified `ownerEmail` via the provider's OIDC token.
7822
+ * The backend verifies `ownerEmail` using provider evidence or an authenticated account-link ticket.
7404
7823
  */
7405
7824
  const SsoLinkRequestSchema = object({
7825
+ identityProof: ProvisioningIdentityProofSchema.optional(),
7406
7826
  source: MarketplaceSourceSchema,
7407
7827
  /** Provider installation/configuration id (e.g. Vercel configurationId). */
7408
7828
  externalId: string().min(1).max(255),
7409
7829
  /** Optional provider resource id — present → deep-link to that project; absent → org landing. */
7410
7830
  resourceId: string().min(1).max(255).optional(),
7411
- /** Verified installer email (the OIDC `user_email` claim). */
7831
+ /** Installer email must match the identity established by identityProof. */
7412
7832
  ownerEmail: string().email()
7413
7833
  });
7414
7834
  const SsoLinkResponseSchema = object({
@@ -7448,7 +7868,13 @@ const ProvisioningOrganizationSummarySchema = object({
7448
7868
  role: ProvisioningOrganizationRoleSchema
7449
7869
  });
7450
7870
  /** List a user's administrable orgs by verified email. No user match ⇒ `{ organizations: [] }`. */
7451
- const ListProvisioningOrganizationsRequestSchema = object({ email: string().email() });
7871
+ const ListProvisioningOrganizationsRequestSchema = object({
7872
+ source: MarketplaceSourceSchema.optional(),
7873
+ externalId: string().min(1).max(255).optional(),
7874
+ resourceId: string().min(1).max(255).optional(),
7875
+ identityProof: ProvisioningIdentityProofSchema.optional(),
7876
+ email: string().email()
7877
+ });
7452
7878
  const ListProvisioningOrganizationsResponseSchema = object({ organizations: array(ProvisioningOrganizationSummarySchema) });
7453
7879
  /**
7454
7880
  * Create an org for a (found-or-created) user by verified email. `name`/`slug` reuse the
@@ -7456,6 +7882,10 @@ const ListProvisioningOrganizationsResponseSchema = object({ organizations: arra
7456
7882
  * accept exactly the same input.
7457
7883
  */
7458
7884
  const CreateProvisioningOrganizationRequestSchema = object({
7885
+ source: MarketplaceSourceSchema.optional(),
7886
+ externalId: string().min(1).max(255).optional(),
7887
+ resourceId: string().min(1).max(255).optional(),
7888
+ identityProof: ProvisioningIdentityProofSchema.optional(),
7459
7889
  email: string().email(),
7460
7890
  name: CreateOrganizationInputSchema.shape.name,
7461
7891
  slug: CreateOrganizationInputSchema.shape.slug
@@ -8043,30 +8473,13 @@ const ShopifySessionsPaginationSchema = object({
8043
8473
  totalPages: number$1().int().nonnegative().describe("`min(ceil(total / limit), 200)`: the last page `sessionsPage` accepts."),
8044
8474
  hasMore: boolean$1().describe("True when `page < totalPages`.")
8045
8475
  });
8046
- /**
8047
- * Shopify Stats Response
8048
- *
8049
- * Every counter is a SESSION count, not an event count. `totalRequests` is
8050
- * the number of sessions in the window and `blockedBots` the AI-agent
8051
- * sessions among them.
8052
- *
8053
- * `crawlerSessions` and `humanSessions` complete the four-way split
8054
- * (AI agent / crawler / human / unclassified). Both are optional in both
8055
- * directions: an older Checkpoint does not send them, and an older Shopify
8056
- * app ignores them. When present they come from the same per-session
8057
- * classification as `blockedBots` (ai_agent > bot > human priority), so
8058
- * `blockedBots + crawlerSessions + humanSessions <= totalRequests`; the
8059
- * remainder is sessions that belong to no class.
8060
- *
8061
- * `sessions` and `sessionsPagination` are present only when the request
8062
- * asks for them (`include=sessions`); an older Checkpoint never sends them.
8063
- */
8064
8476
  const ShopifyStatsResponseSchema = object({
8065
8477
  totalRequests: number$1().int().nonnegative(),
8066
8478
  blockedBots: number$1().int().nonnegative(),
8067
8479
  allowedRequests: number$1().int().nonnegative(),
8068
8480
  crawlerSessions: number$1().int().nonnegative().optional(),
8069
8481
  humanSessions: number$1().int().nonnegative().optional(),
8482
+ unidentifiedSessions: number$1().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."),
8070
8483
  threatLevel: _enum([
8071
8484
  "low",
8072
8485
  "medium",
@@ -10289,6 +10702,14 @@ const FingerprintSearchQuerySchema = object({
10289
10702
  ]).default("timestamp"),
10290
10703
  sortOrder: _enum(["asc", "desc"]).default("desc")
10291
10704
  });
10705
+ /**
10706
+ * Test result when running detection on a fingerprint.
10707
+ *
10708
+ * @deprecated Nothing in this repository builds or parses it; the
10709
+ * `/fingerprint/test` route returns its own shape. Kept because this file is
10710
+ * the package's public type surface and a shipped CHANGELOG entry names it.
10711
+ * Remove in the next major.
10712
+ */
10292
10713
  const DetectionTestResultSchema = object({
10293
10714
  fingerprintId: string(),
10294
10715
  timestamp: date$1(),
@@ -10343,8 +10764,8 @@ const PublishProfileRequestSchema = object({
10343
10764
  version: string().optional()
10344
10765
  });
10345
10766
  const TestDetectionRequestSchema = object({
10346
- fingerprintId: string(),
10347
- integrationTypes: array(IntegrationTypeSchema).optional()
10767
+ fingerprintId: string().uuid(),
10768
+ integrationTypes: array(IntegrationTypeSchema).min(1, "integrationTypes must list at least one integration type, or be omitted entirely").optional()
10348
10769
  });
10349
10770
  function generateTestId() {
10350
10771
  return `test-${Date.now().toString(36)}-${Math.random().toString(36).substring(2, 8)}`;
@@ -10833,7 +11254,8 @@ const ADMIN_OVERVIEW_SECTIONS = [
10833
11254
  "installations",
10834
11255
  "traffic",
10835
11256
  "lists",
10836
- "hiAi"
11257
+ "hiAi",
11258
+ "accounts"
10837
11259
  ];
10838
11260
  /** Cache states a section can report in `meta.cache.status`. */
10839
11261
  const ADMIN_OVERVIEW_CACHE_STATUSES = [
@@ -10854,6 +11276,51 @@ const SERVICE_TRAFFIC_KEYS = [
10854
11276
  "mixed",
10855
11277
  "none"
10856
11278
  ];
11279
+ /**
11280
+ * Headline numbers that show "N counted · M excluded" and open a drill-down
11281
+ * of every account behind them. The first five mirror the ladder steps
11282
+ * (signedIn is the ladder's signedInProxy); the last three are the KYA-1147
11283
+ * people numbers.
11284
+ */
11285
+ const ADMIN_TRUSTED_METRICS = [
11286
+ "emailsCollected",
11287
+ "users",
11288
+ "signedIn",
11289
+ "onboarded",
11290
+ "activated",
11291
+ "activeUsers",
11292
+ "peopleInOrgs",
11293
+ "installedOrgs"
11294
+ ];
11295
+ /**
11296
+ * Why an account a user-level exclusion did not catch is still left out:
11297
+ * every org that would count it is test-named (`test_org`), or, for an org
11298
+ * row, none of its members is a counted person (`no_counted_members`).
11299
+ */
11300
+ const ADMIN_ORG_EXCLUSION_REASONS = ["test_org", "no_counted_members"];
11301
+ /** `counted`, or the first rule that left the account out (user buckets take precedence). */
11302
+ const ADMIN_ACCOUNT_STATUSES = [
11303
+ "counted",
11304
+ ...EXCLUSION_BUCKETS,
11305
+ ...ADMIN_ORG_EXCLUSION_REASONS
11306
+ ];
11307
+ /** GET /api/admin/overview/accounts query. */
11308
+ /** Drill-down status filter: everyone, any exclusion, or one status. */
11309
+ const ADMIN_ACCOUNTS_STATUS_FILTERS = [
11310
+ "all",
11311
+ "excluded",
11312
+ ...ADMIN_ACCOUNT_STATUSES
11313
+ ];
11314
+ /**
11315
+ * GET /api/admin/overview/accounts query. `status` filters on the server,
11316
+ * so the row cap applies to the filtered list and an exclusion is never cut
11317
+ * off by counted rows.
11318
+ */
11319
+ const adminAccountsQuerySchema = object({
11320
+ metric: _enum(ADMIN_TRUSTED_METRICS),
11321
+ window: _enum(ADMIN_OVERVIEW_WINDOWS).default("30d"),
11322
+ status: _enum(ADMIN_ACCOUNTS_STATUS_FILTERS).default("all")
11323
+ });
10857
11324
 
10858
11325
  //#endregion
10859
11326
  //#region src/types/api.ts
@@ -11652,6 +12119,35 @@ const RecommendationGenerationSchema = object({
11652
12119
  forceRefresh: boolean$1().optional().default(false)
11653
12120
  });
11654
12121
 
12122
+ //#endregion
12123
+ //#region src/schemas/consent-policy-endpoint.ts
12124
+ /**
12125
+ * Wire shape of `GET /api/v1/kya-os/consent-policy`, defined once here. The
12126
+ * response is the project's consent policy as a client needs to render and
12127
+ * pre-check it; it is authenticated with the project API key.
12128
+ *
12129
+ * `etag` is the BARE hash (lowercase hex). The HTTP `ETag` header carries the
12130
+ * same value as a quoted strong validator, `"<etag>"`, on 200 and 304.
12131
+ * `riskLevel` is ConsentConfig's capability risk set, unchanged.
12132
+ */
12133
+ const ConsentPolicyRiskLevelSchema = _enum([
12134
+ "low",
12135
+ "medium",
12136
+ "high",
12137
+ "critical"
12138
+ ]);
12139
+ const ConsentPolicyCapabilitySchema = strictObject({
12140
+ scope: string().min(1),
12141
+ defaultOn: boolean$1(),
12142
+ riskLevel: ConsentPolicyRiskLevelSchema
12143
+ });
12144
+ const ConsentPolicyResponseSchema = strictObject({
12145
+ allowedScopes: array(string().min(1)).optional(),
12146
+ maxGrantSeconds: number$1().int().positive().optional(),
12147
+ capabilities: array(ConsentPolicyCapabilitySchema).optional(),
12148
+ etag: string().regex(/^[0-9a-f]{64}$/)
12149
+ });
12150
+
11655
12151
  //#endregion
11656
12152
  //#region src/wire/gateway-internal-tools.ts
11657
12153
  /**
@@ -11804,20 +12300,14 @@ function isPrivateOrReservedHost(hostname) {
11804
12300
  * octal/hex-encoded SSRF bypasses like `0177.0.0.01` → `127.0.0.1`.
11805
12301
  */
11806
12302
  function parseIPv4Octet(part) {
11807
- if (/^0x[0-9a-f]+$/i.test(part)) {
11808
- const n = parseInt(part, 16);
11809
- return Number.isNaN(n) ? null : n;
11810
- }
11811
- if (/^0[0-7]+$/.test(part)) {
11812
- const n = parseInt(part, 8);
11813
- return Number.isNaN(n) ? null : n;
11814
- }
12303
+ if (/^0x[0-9a-f]+$/i.test(part)) return parseInt(part, 16);
12304
+ if (/^0[0-7]+$/.test(part)) return parseInt(part, 8);
11815
12305
  if (/^(0|[1-9]\d*)$/.test(part)) return parseInt(part, 10);
11816
12306
  return null;
11817
12307
  }
11818
12308
  function isPrivateIPv4(ip) {
11819
12309
  const parts = ip.split(".").map(Number);
11820
- if (parts.length !== 4 || parts.some((p) => isNaN(p) || p < 0 || p > 255)) return false;
12310
+ if (parts.some((p) => p > 255)) return false;
11821
12311
  const [a, b] = parts;
11822
12312
  if (a === 0) return true;
11823
12313
  if (a === 127) return true;
@@ -11926,7 +12416,8 @@ const upstreamServerSchema = object({
11926
12416
  });
11927
12417
  /**
11928
12418
  * Input variant — id/slug optional for new upstreams (auto-generated by PUT
11929
- * handler). Also omits the two server-managed static-headers fields:
12419
+ * handler). Also omits server-managed project ownership and the two
12420
+ * server-managed static-headers fields:
11930
12421
  * `staticHeadersEncrypted` (ciphertext — clients never author this
11931
12422
  * directly) and `staticHeaderKeys` (a read-only projection echoed back on
11932
12423
  * GET/PUT responses). The plaintext `staticHeaders` field is intentionally
@@ -11934,6 +12425,7 @@ const upstreamServerSchema = object({
11934
12425
  * values; the PUT handler encrypts it before persisting.
11935
12426
  */
11936
12427
  const upstreamServerInputSchema = upstreamServerSchema.omit({
12428
+ projectId: true,
11937
12429
  staticHeadersEncrypted: true,
11938
12430
  staticHeaderKeys: true
11939
12431
  }).extend({
@@ -14337,13 +14829,21 @@ const PolicyConfigSchema = object({
14337
14829
  * Trusted Layer-2 delegation root DIDs for the project's org (P2 / DR-1),
14338
14830
  * server-resolved by the policy API. A consuming middleware forwards these
14339
14831
  * into the engine's `ContextSpec.trustedDelegationRoots` so L2 delegation
14340
- * chains are pinned to the org DID. Absent ⇒ omitted (root pinning disabled —
14341
- * the engine's open default, byte-identical to pre-P2). Optional (no default)
14832
+ * chains are pinned to the org DID. Absent ⇒ omitted, and the engine rejects
14833
+ * delegation. Optional (no default)
14342
14834
  * so a policy without the field round-trips as `undefined`, matching the
14343
14835
  * policy API's `PolicyResponse` shape and the orchestrator's omit-when-unset
14344
14836
  * contract.
14345
14837
  */
14346
- trustedDelegationRoots: array(string()).optional()
14838
+ trustedDelegationRoots: array(string()).optional(),
14839
+ /**
14840
+ * The org's one OAuth authorization server issuer (RFC 8414 `issuer`), as the
14841
+ * platform's IssuerContext computes it (`https://<branded host or platform>/oauth/<slug>`).
14842
+ * A middleware that serves protected resource metadata advertises exactly
14843
+ * this in `authorization_servers` and never builds an issuer URL itself.
14844
+ * Absent ⇒ the platform could not resolve the org; serve no metadata.
14845
+ */
14846
+ authorizationServerIssuer: string().url().optional()
14347
14847
  });
14348
14848
  const PolicyEvaluationContextSchema = object({
14349
14849
  agentType: string().optional(),
@@ -14385,6 +14885,9 @@ const PolicyEvaluationResultSchema = object({
14385
14885
  /** What type of match triggered this decision */
14386
14886
  matchType: PolicyMatchTypeSchema
14387
14887
  });
14888
+ function isEngineEnforcing(flags) {
14889
+ return flags.engineEnforcementEnabled === true && flags.enabled !== false;
14890
+ }
14388
14891
  /**
14389
14892
  * Validate and parse a policy configuration
14390
14893
  */
@@ -14405,6 +14908,20 @@ function parseEvaluationContext(data) {
14405
14908
  return PolicyEvaluationContextSchema.parse(data);
14406
14909
  }
14407
14910
 
14911
+ //#endregion
14912
+ //#region src/policy/fail-closed-response.ts
14913
+ const FAIL_CLOSED_STATUS = 503;
14914
+ const FAIL_CLOSED_RETRY_AFTER_SECONDS = 3;
14915
+ const FAIL_CLOSED_BODY = {
14916
+ error: "Service temporarily unavailable",
14917
+ source: "checkpoint-middleware"
14918
+ };
14919
+ const FAIL_CLOSED_HEADERS = {
14920
+ "Content-Type": "application/json",
14921
+ "Cache-Control": "no-store",
14922
+ "Retry-After": String(3)
14923
+ };
14924
+
14408
14925
  //#endregion
14409
14926
  //#region src/policy/evaluator.ts
14410
14927
  /**
@@ -14649,6 +15166,44 @@ function createResult(action, reason, matchType, extras) {
14649
15166
  };
14650
15167
  }
14651
15168
 
15169
+ //#endregion
15170
+ //#region src/policy/cedar-mask.ts
15171
+ const blank = (char) => char === "\n" || char === "\r" ? char : " ";
15172
+ function maskCedar(cedar) {
15173
+ const visible = cedar.split("");
15174
+ const code = cedar.split("");
15175
+ const inString = new Array(cedar.length).fill(false);
15176
+ let i = 0;
15177
+ while (i < cedar.length) if (cedar[i] === "\"") {
15178
+ let end = i + 1;
15179
+ while (end < cedar.length && cedar[end] !== "\"") end += cedar[end] === "\\" ? 2 : 1;
15180
+ const bodyEnd = Math.min(end, cedar.length);
15181
+ for (let k = i + 1; k < bodyEnd; k++) {
15182
+ inString[k] = true;
15183
+ code[k] = blank(cedar[k]);
15184
+ }
15185
+ i = end + 1;
15186
+ } else if (cedar[i] === "/" && cedar[i + 1] === "/") while (i < cedar.length && cedar[i] !== "\n" && cedar[i] !== "\r") {
15187
+ visible[i] = " ";
15188
+ code[i] = " ";
15189
+ i++;
15190
+ }
15191
+ else i++;
15192
+ return {
15193
+ visible: visible.join(""),
15194
+ code: code.join(""),
15195
+ inString
15196
+ };
15197
+ }
15198
+
15199
+ //#endregion
15200
+ //#region src/policy/cedar-space.ts
15201
+ const CEDAR_SPACE_CLASS = "[\\t-\\r \\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000]";
15202
+ function isCedarSpace(char) {
15203
+ const code = char.charCodeAt(0);
15204
+ return code >= 9 && code <= 13 || code === 32 || code === 133 || code === 160 || code === 5760 || code >= 8192 && code <= 8202 || code === 8232 || code === 8233 || code === 8239 || code === 8287 || code === 12288;
15205
+ }
15206
+
14652
15207
  //#endregion
14653
15208
  //#region src/policy/cedar-string.ts
14654
15209
  /**
@@ -14676,6 +15231,1041 @@ function unescapeCedarString(value) {
14676
15231
  function cedarQuotedValueRegExp(prefixSource, flags = "") {
14677
15232
  return new RegExp(`${prefixSource}"((?:\\\\.|[^"\\\\])*)"`, flags);
14678
15233
  }
15234
+ const LIKE_ESCAPES = {
15235
+ n: "\n",
15236
+ r: "\r",
15237
+ t: " ",
15238
+ "0": "\0"
15239
+ };
15240
+ const NUMERIC_ESCAPE = /x([0-9a-fA-F]{2})|u\{([0-9a-fA-F][0-9a-fA-F_]*)\}/y;
15241
+ const MAX_CODE_POINT = 1114111;
15242
+ const MAX_UNICODE_DIGITS = 6;
15243
+ function numericEscapeCode(raw, at) {
15244
+ NUMERIC_ESCAPE.lastIndex = at;
15245
+ const match = NUMERIC_ESCAPE.exec(raw);
15246
+ if (match === null) return null;
15247
+ if (match[1] !== void 0) return {
15248
+ code: parseInt(match[1], 16),
15249
+ length: match[0].length
15250
+ };
15251
+ const digits = match[2].replace(/_/g, "");
15252
+ const code = parseInt(digits, 16);
15253
+ return digits.length <= MAX_UNICODE_DIGITS && code <= MAX_CODE_POINT && (code < 55296 || code > 57343) ? {
15254
+ code,
15255
+ length: match[0].length
15256
+ } : null;
15257
+ }
15258
+ function cedarLikeSegments(rawPattern) {
15259
+ const segments = [""];
15260
+ const append = (char) => {
15261
+ if (char === "*") segments.push("");
15262
+ else segments[segments.length - 1] += char;
15263
+ };
15264
+ for (let i = 0; i < rawPattern.length; i++) {
15265
+ const char = rawPattern.charAt(i);
15266
+ if (char !== "\\") {
15267
+ append(char);
15268
+ continue;
15269
+ }
15270
+ const numeric = numericEscapeCode(rawPattern, i + 1);
15271
+ if (numeric !== null) {
15272
+ append(String.fromCodePoint(numeric.code));
15273
+ i += numeric.length;
15274
+ } else {
15275
+ const next = rawPattern.charAt(++i);
15276
+ segments[segments.length - 1] += LIKE_ESCAPES[next] ?? next;
15277
+ }
15278
+ }
15279
+ return segments;
15280
+ }
15281
+ function globMatches(segments, value) {
15282
+ const first = segments[0];
15283
+ if (segments.length === 1) return value === first;
15284
+ const last = segments[segments.length - 1];
15285
+ const end = value.length - last.length;
15286
+ if (end < first.length || !value.startsWith(first) || !value.endsWith(last)) return false;
15287
+ let position = first.length;
15288
+ for (let i = 1; i < segments.length - 1; i++) {
15289
+ const at = value.indexOf(segments[i], position);
15290
+ if (at === -1 || at + segments[i].length > end) return false;
15291
+ position = at + segments[i].length;
15292
+ }
15293
+ return true;
15294
+ }
15295
+
15296
+ //#endregion
15297
+ //#region src/policy/legacy-carve-out.ts
15298
+ const NO_EVIDENCE_CATEGORY = "no_evidence";
15299
+ const NO_EVIDENCE_EXCLUSION_TERM = `principal.category != "${NO_EVIDENCE_CATEGORY}"`;
15300
+ const NO_EVIDENCE_EQUALITY_TERM = `principal.category == "${NO_EVIDENCE_CATEGORY}"`;
15301
+ const WS = `${CEDAR_SPACE_CLASS}*`;
15302
+ const SEGMENT_BOUNDARY = new RegExp(`\\b(?:forbid|permit)${WS}\\(|;`, "g");
15303
+ const ACCESSOR = `(?:\\.${WS}category\\b|\\[${WS}"C[^"]*"${WS}\\])`;
15304
+ const SUBJECT = `(?<![.\\w])principal${WS}${ACCESSOR}`;
15305
+ const EXACT = "\"E[^\"]*\"";
15306
+ const LIKEABLE = "\"[EL][^\"]*\"";
15307
+ const ELEMENTS = `[^\\]\\[]*(?:\\[${WS}"[^"]*"${WS}\\][^\\]\\[]*){0,16}`;
15308
+ const CATEGORY_READ = new RegExp(`(?<![.\\w])principal(?:${WS}\\))*${WS}${ACCESSOR}`, "g");
15309
+ const GROUP_OR_PRINCIPAL = /[()[\]{}]|(?<![\w.])principal(?!\w)/g;
15310
+ const CHAIN_LINK = new RegExp(`${WS}(?:\\.${WS}(category\\b)|\\.${WS}\\w+|\\[${WS}"(C)?[^"]*"${WS}\\])`, "y");
15311
+ const PRINCIPAL_LENGTH = 9;
15312
+ const BARE_GROUP = new RegExp(`^(?:\\(|${CEDAR_SPACE_CLASS})*$`);
15313
+ const CATEGORY_COMPARED = new RegExp(`${SUBJECT}${WS}(?:(?:==|!=)${WS}${EXACT}|like${WS}${LIKEABLE})|${EXACT}${WS}(?:==|!=)${WS}${SUBJECT}`);
15314
+ const LIST_CALL = new RegExp(`\\[(${ELEMENTS})\\]${WS}\\.${WS}contains(?:All|Any)?${WS}(?:(${SUBJECT})|(${EXACT})|\\[(${ELEMENTS})\\])`, "g");
15315
+ const HAS_CATEGORY = new RegExp(SUBJECT);
15316
+ const HAS_NO_EVIDENCE = new RegExp(EXACT);
15317
+ const SUBSTITUTED_READ = new RegExp(`\\(if ((?:\\(|${CEDAR_SPACE_CLASS})*principal(?:\\)|${CEDAR_SPACE_CLASS})*(?:\\.${WS}category\\b|\\[${WS}("(?:\\\\.|[^"\\\\])*")${WS}\\])) == "${NO_EVIDENCE_CATEGORY}" then "human" else \\1\\)`, "g");
15318
+ function literalMarker(body) {
15319
+ const segments = cedarLikeSegments(body);
15320
+ if (segments.length === 1) {
15321
+ if (segments[0] === "no_evidence") return "E";
15322
+ return segments[0] === "category" ? "C" : " ";
15323
+ }
15324
+ return segments.some((segment) => segment.includes("no_evidence")) && globMatches(segments, "no_evidence") ? "L" : " ";
15325
+ }
15326
+ function scan(cedar) {
15327
+ const { visible, code, inString } = maskCedar(cedar);
15328
+ const marked = code.split("");
15329
+ for (let start = 0; start < cedar.length;) {
15330
+ if (!inString[start]) {
15331
+ start++;
15332
+ continue;
15333
+ }
15334
+ let end = start;
15335
+ while (end < cedar.length && inString[end]) end++;
15336
+ const marker = literalMarker(visible.slice(start, end));
15337
+ if (marker !== " ") marked[start] = marker;
15338
+ start = end;
15339
+ }
15340
+ const text = marked.join("");
15341
+ return {
15342
+ visible,
15343
+ text,
15344
+ flat: text.replace(/[()]/g, " "),
15345
+ pairs: pairParentheses(text)
15346
+ };
15347
+ }
15348
+ function pairParentheses(text) {
15349
+ const pairs = new Int32Array(text.length).fill(-1);
15350
+ const open = [];
15351
+ for (let i = 0; i < text.length; i++) if (text[i] === "(") open.push(i);
15352
+ else if (text[i] === ")") pairs[i] = open.pop() ?? -1;
15353
+ return pairs;
15354
+ }
15355
+ function statementRanges(text) {
15356
+ const ranges = [];
15357
+ let open = -1;
15358
+ for (const boundary of text.matchAll(SEGMENT_BOUNDARY)) if (boundary[0] === ";") {
15359
+ if (open !== -1) ranges.push([open, boundary.index + 1]);
15360
+ open = -1;
15361
+ } else {
15362
+ if (open !== -1) ranges.push([open, boundary.index]);
15363
+ open = boundary.index;
15364
+ }
15365
+ if (open !== -1) ranges.push([open, text.length]);
15366
+ return ranges;
15367
+ }
15368
+ function applyEdits(cedar, edits) {
15369
+ if (edits.length === 0) return cedar;
15370
+ const pieces = [];
15371
+ let position = 0;
15372
+ for (const edit of edits) {
15373
+ pieces.push(cedar.slice(position, edit.start), edit.text);
15374
+ position = edit.end;
15375
+ }
15376
+ pieces.push(cedar.slice(position));
15377
+ return pieces.join("");
15378
+ }
15379
+ function namesNoEvidenceIn(flat) {
15380
+ if (CATEGORY_COMPARED.test(flat)) return true;
15381
+ for (const [, receiver, subject, exact, list = ""] of flat.matchAll(LIST_CALL)) {
15382
+ const receiverReadsCategory = HAS_CATEGORY.test(receiver);
15383
+ const receiverNamesNoEvidence = HAS_NO_EVIDENCE.test(receiver);
15384
+ if (receiverReadsCategory && (exact !== void 0 || HAS_NO_EVIDENCE.test(list)) || receiverNamesNoEvidence && (subject !== void 0 || HAS_CATEGORY.test(list))) return true;
15385
+ }
15386
+ return false;
15387
+ }
15388
+ function namesNoEvidence(cedar) {
15389
+ return namesNoEvidenceIn(scan(cedar).flat);
15390
+ }
15391
+ function groupStart({ text, pairs }, principal, read) {
15392
+ const lastCloser = read.lastIndexOf(")");
15393
+ if (lastCloser === -1) return principal;
15394
+ const open = pairs[principal + lastCloser];
15395
+ return open !== -1 && BARE_GROUP.test(text.slice(open, principal)) ? open : -1;
15396
+ }
15397
+ const isWordChar = (char) => char !== void 0 && /\w/.test(char);
15398
+ function skipSpaceBack(text, from) {
15399
+ let i = from;
15400
+ while (i >= 0 && isCedarSpace(text[i])) i--;
15401
+ return i;
15402
+ }
15403
+ function skipSpaceForward(text, from) {
15404
+ let i = from;
15405
+ while (i < text.length && isCedarSpace(text[i])) i++;
15406
+ return i;
15407
+ }
15408
+ function wordEndingAt(text, end) {
15409
+ let start = end;
15410
+ while (start > 0 && isWordChar(text[start - 1])) start--;
15411
+ return text.slice(start, end + 1);
15412
+ }
15413
+ function isPrincipalVariable(text, at) {
15414
+ const before = skipSpaceBack(text, at - 1);
15415
+ const char = text[before];
15416
+ if (char === "." || char === "?") return false;
15417
+ if (char === ":" && text[before - 1] === ":") return false;
15418
+ if (isWordChar(char) && wordEndingAt(text, before) === "has") return false;
15419
+ return text[skipSpaceForward(text, at + PRINCIPAL_LENGTH)] !== ":";
15420
+ }
15421
+ function isBranchValue(text, at) {
15422
+ let before = skipSpaceBack(text, at - 1);
15423
+ while (text[before] === "(") before = skipSpaceBack(text, before - 1);
15424
+ const char = text[before];
15425
+ const word = isWordChar(char) ? wordEndingAt(text, before) : "";
15426
+ const introduced = word === "then" || word === "else" || char === ":" && text[before - 1] !== ":";
15427
+ const after = skipSpaceForward(text, at + PRINCIPAL_LENGTH);
15428
+ const next = text[after];
15429
+ const ends = next === ")" || next === "}" || next === "]" || next === "," || text.startsWith("else", after) && !isWordChar(text[after + 4]);
15430
+ return introduced && ends;
15431
+ }
15432
+ function headEnd(text, from, to) {
15433
+ let depth = 0;
15434
+ for (let i = text.indexOf("(", from); i < to; i++) if (text[i] === "(") depth++;
15435
+ else if (text[i] === ")" && --depth === 0) return i + 1;
15436
+ return from;
15437
+ }
15438
+ function directReads(scanned, from, to) {
15439
+ const reads = [];
15440
+ for (const read of scanned.text.slice(from, to).matchAll(CATEGORY_READ)) {
15441
+ const principal = from + read.index;
15442
+ if (!isPrincipalVariable(scanned.text, principal)) continue;
15443
+ const start = groupStart(scanned, principal, read[0]);
15444
+ if (start !== -1) reads.push({
15445
+ principal,
15446
+ start,
15447
+ end: principal + read[0].length
15448
+ });
15449
+ }
15450
+ return reads;
15451
+ }
15452
+ function readsCategoryAfter(text, from) {
15453
+ CHAIN_LINK.lastIndex = from;
15454
+ for (let link = CHAIN_LINK.exec(text); link !== null; link = CHAIN_LINK.exec(text)) if (link[1] !== void 0 || link[2] !== void 0) return true;
15455
+ return false;
15456
+ }
15457
+ function readsCategoryOfCarriedPrincipal(text, from, to, reads) {
15458
+ const direct = new Set(reads.map((read) => read.principal));
15459
+ const holding = [false];
15460
+ for (const token of text.slice(from, to).matchAll(GROUP_OR_PRINCIPAL)) {
15461
+ const at = from + token.index;
15462
+ if (token[0] === "principal") {
15463
+ if (!direct.has(at) && isPrincipalVariable(text, at) && isBranchValue(text, at)) holding[holding.length - 1] = true;
15464
+ } else if ("([{".includes(token[0])) holding.push(false);
15465
+ else if (holding.length > 1 && holding.pop()) {
15466
+ holding[holding.length - 1] = true;
15467
+ if (readsCategoryAfter(text, at + 1)) return true;
15468
+ }
15469
+ }
15470
+ return false;
15471
+ }
15472
+ function withNoEvidenceExclusion(cedar) {
15473
+ const scanned = scan(cedar);
15474
+ const { visible, text, flat } = scanned;
15475
+ const edits = [];
15476
+ for (const [from, to] of statementRanges(text)) {
15477
+ if (namesNoEvidenceIn(flat.slice(from, to))) continue;
15478
+ const reads = directReads(scanned, from, to);
15479
+ if (reads.length === 0) continue;
15480
+ if (readsCategoryOfCarriedPrincipal(text, headEnd(text, from, to), to, reads)) continue;
15481
+ for (const { start, end } of reads) {
15482
+ const accessor = visible.slice(start, end);
15483
+ edits.push({
15484
+ start,
15485
+ end,
15486
+ text: `(if ${accessor} == "${NO_EVIDENCE_CATEGORY}" then "human" else ${accessor})`
15487
+ });
15488
+ }
15489
+ }
15490
+ return applyEdits(cedar, edits);
15491
+ }
15492
+ function withoutNoEvidenceExclusion(cedar) {
15493
+ const { visible, inString } = maskCedar(cedar);
15494
+ const edits = [];
15495
+ for (const read of visible.matchAll(SUBSTITUTED_READ)) {
15496
+ const key = read[2];
15497
+ if (!inString[read.index] && (key === void 0 || literalMarker(key.slice(1, -1)) === "C")) edits.push({
15498
+ start: read.index,
15499
+ end: read.index + read[0].length,
15500
+ text: read[1]
15501
+ });
15502
+ }
15503
+ return applyEdits(cedar, edits);
15504
+ }
15505
+
15506
+ //#endregion
15507
+ //#region src/policy/cedar-expression.ts
15508
+ const MAX_NESTING = 48;
15509
+ const MAX_HEX_ESCAPE = 127;
15510
+ const UNNAMED_CATEGORY = "\ud800";
15511
+ const LONE_SURROGATE = /\p{Surrogate}/u;
15512
+ const HUMAN_NAMES = [
15513
+ "",
15514
+ "human",
15515
+ "unknown",
15516
+ "anonymous"
15517
+ ];
15518
+ const UNKNOWN = { k: "unknown" };
15519
+ const PUNCTUATION = /* @__PURE__ */ new Set("<>!+-*()[]{}.,:");
15520
+ const TWO_CHARACTER = /* @__PURE__ */ new Set([
15521
+ "&&",
15522
+ "||",
15523
+ "==",
15524
+ "!=",
15525
+ "<=",
15526
+ ">=",
15527
+ "::"
15528
+ ]);
15529
+ const SIMPLE_ESCAPES = {
15530
+ n: "\n",
15531
+ r: "\r",
15532
+ t: " ",
15533
+ "\\": "\\",
15534
+ "0": "\0",
15535
+ "'": "'",
15536
+ "\"": "\""
15537
+ };
15538
+ const IDENTIFIER_START = /[A-Za-z_]/;
15539
+ const IDENTIFIER_PART = /[A-Za-z0-9_]/;
15540
+ const DIGIT = /[0-9]/;
15541
+ const UNSUPPORTED_PATTERN_ESCAPE = /\\[0u]/;
15542
+ function tokenize(text) {
15543
+ const tokens = [];
15544
+ let i = 0;
15545
+ while (i < text.length) {
15546
+ const char = text[i];
15547
+ if (isCedarSpace(char)) i += 1;
15548
+ else if (char === "/" && text[i + 1] === "/") while (i < text.length && text[i] !== "\n" && text[i] !== "\r") i += 1;
15549
+ else if (char === "\"") {
15550
+ let end = i + 1;
15551
+ while (end < text.length && text[end] !== "\"") end += text[end] === "\\" ? 2 : 1;
15552
+ if (end >= text.length) throw new SyntaxError("unterminated string");
15553
+ const body = text.slice(i + 1, end);
15554
+ if (LONE_SURROGATE.test(body)) throw new SyntaxError("ill-formed string");
15555
+ tokens.push({
15556
+ t: "str",
15557
+ v: body
15558
+ });
15559
+ i = end + 1;
15560
+ } else if (IDENTIFIER_START.test(char)) {
15561
+ let end = i + 1;
15562
+ while (end < text.length && IDENTIFIER_PART.test(text[end])) end += 1;
15563
+ tokens.push({
15564
+ t: "id",
15565
+ v: text.slice(i, end)
15566
+ });
15567
+ i = end;
15568
+ } else if (DIGIT.test(char)) {
15569
+ let end = i + 1;
15570
+ while (end < text.length && DIGIT.test(text[end])) end += 1;
15571
+ tokens.push({
15572
+ t: "num",
15573
+ v: text.slice(i, end)
15574
+ });
15575
+ i = end;
15576
+ } else if (TWO_CHARACTER.has(text.slice(i, i + 2))) {
15577
+ tokens.push({
15578
+ t: "p",
15579
+ v: text.slice(i, i + 2)
15580
+ });
15581
+ i += 2;
15582
+ } else if (PUNCTUATION.has(char)) {
15583
+ tokens.push({
15584
+ t: "p",
15585
+ v: char
15586
+ });
15587
+ i += 1;
15588
+ } else throw new SyntaxError("unexpected character");
15589
+ }
15590
+ return tokens;
15591
+ }
15592
+ function decodeCedarString(raw) {
15593
+ let out = "";
15594
+ for (let i = 0; i < raw.length; i += 1) if (raw[i] !== "\\") out += raw[i];
15595
+ else if (raw[i + 1] === "x" || raw[i + 1] === "u") {
15596
+ const numeric = numericEscapeCode(raw, i + 1);
15597
+ if (numeric === null || raw[i + 1] === "x" && numeric.code > MAX_HEX_ESCAPE) return null;
15598
+ out += String.fromCodePoint(numeric.code);
15599
+ i += numeric.length;
15600
+ } else {
15601
+ const mapped = SIMPLE_ESCAPES[raw[i + 1]];
15602
+ if (mapped === void 0) return null;
15603
+ out += mapped;
15604
+ i += 1;
15605
+ }
15606
+ return out;
15607
+ }
15608
+ var Parser = class {
15609
+ tokens;
15610
+ position = 0;
15611
+ readsTag = false;
15612
+ constructor(tokens) {
15613
+ this.tokens = tokens;
15614
+ }
15615
+ parseAll() {
15616
+ const expression = this.expression(0);
15617
+ if (this.position < this.tokens.length) throw new SyntaxError("trailing tokens");
15618
+ return this.readsTag ? UNKNOWN : expression;
15619
+ }
15620
+ peek() {
15621
+ return this.tokens[this.position];
15622
+ }
15623
+ is(type, value) {
15624
+ const token = this.peek();
15625
+ return token !== void 0 && token.t === type && token.v === value;
15626
+ }
15627
+ take(type, value) {
15628
+ const found = this.is(type, value);
15629
+ if (found) this.position += 1;
15630
+ return found;
15631
+ }
15632
+ expect(type, value) {
15633
+ if (!this.take(type, value)) throw new SyntaxError(`expected ${value}`);
15634
+ }
15635
+ next(type) {
15636
+ const token = this.peek();
15637
+ if (token === void 0 || token.t !== type) throw new SyntaxError(`expected ${type}`);
15638
+ this.position += 1;
15639
+ return token;
15640
+ }
15641
+ expression(depth) {
15642
+ if (depth > MAX_NESTING) throw new SyntaxError("too deep");
15643
+ if (this.take("id", "if")) {
15644
+ const cond = this.expression(depth + 1);
15645
+ this.expect("id", "then");
15646
+ const then = this.expression(depth + 1);
15647
+ this.expect("id", "else");
15648
+ return {
15649
+ k: "if",
15650
+ cond,
15651
+ then,
15652
+ otherwise: this.expression(depth + 1)
15653
+ };
15654
+ }
15655
+ return this.chain("||", () => this.chain("&&", () => this.relation(depth)));
15656
+ }
15657
+ chain(operator, operand) {
15658
+ const terms = [operand()];
15659
+ while (this.take("p", operator)) terms.push(operand());
15660
+ return terms.length === 1 ? terms[0] : {
15661
+ k: operator === "&&" ? "and" : "or",
15662
+ terms
15663
+ };
15664
+ }
15665
+ relation(depth) {
15666
+ const left = this.additive(depth);
15667
+ const token = this.peek();
15668
+ if (token === void 0) return left;
15669
+ if (token.t === "p" && (token.v === "==" || token.v === "!=")) {
15670
+ this.position += 1;
15671
+ return {
15672
+ k: "cmp",
15673
+ equals: token.v === "==",
15674
+ left,
15675
+ right: this.additive(depth)
15676
+ };
15677
+ }
15678
+ if (token.t === "p" && [
15679
+ "<",
15680
+ "<=",
15681
+ ">",
15682
+ ">="
15683
+ ].includes(token.v)) {
15684
+ this.position += 1;
15685
+ this.additive(depth);
15686
+ return UNKNOWN;
15687
+ }
15688
+ if (token.t === "id" && token.v === "in") {
15689
+ this.position += 1;
15690
+ this.additive(depth);
15691
+ return UNKNOWN;
15692
+ }
15693
+ if (token.t === "id" && token.v === "like") {
15694
+ this.position += 1;
15695
+ return {
15696
+ k: "like",
15697
+ operand: left,
15698
+ pattern: this.next("str").v
15699
+ };
15700
+ }
15701
+ if (token.t === "id" && token.v === "has") {
15702
+ this.position += 1;
15703
+ this.attributePath();
15704
+ return UNKNOWN;
15705
+ }
15706
+ if (token.t === "id" && token.v === "is") {
15707
+ this.position += 1;
15708
+ this.namePath();
15709
+ if (this.take("id", "in")) this.additive(depth);
15710
+ return UNKNOWN;
15711
+ }
15712
+ return left;
15713
+ }
15714
+ attributePath() {
15715
+ const first = this.peek();
15716
+ if (first === void 0 || first.t !== "id" && first.t !== "str") throw new SyntaxError("expected attribute");
15717
+ this.position += 1;
15718
+ while (this.take("p", ".")) {
15719
+ const part = this.peek();
15720
+ if (part === void 0 || part.t !== "id" && part.t !== "str") throw new SyntaxError("expected attribute");
15721
+ this.position += 1;
15722
+ }
15723
+ }
15724
+ namePath() {
15725
+ this.next("id");
15726
+ while (this.take("p", "::")) this.next("id");
15727
+ }
15728
+ additive(depth) {
15729
+ let result = this.multiplicative(depth);
15730
+ while (this.is("p", "+") || this.is("p", "-")) {
15731
+ this.position += 1;
15732
+ this.multiplicative(depth);
15733
+ result = UNKNOWN;
15734
+ }
15735
+ return result;
15736
+ }
15737
+ multiplicative(depth) {
15738
+ let result = this.unary(depth);
15739
+ while (this.take("p", "*")) {
15740
+ this.unary(depth);
15741
+ result = UNKNOWN;
15742
+ }
15743
+ return result;
15744
+ }
15745
+ unary(depth) {
15746
+ const prefixes = [];
15747
+ while (this.is("p", "!") || this.is("p", "-")) {
15748
+ prefixes.push(this.peek().v);
15749
+ this.position += 1;
15750
+ if (prefixes.length > MAX_NESTING) throw new SyntaxError("too deep");
15751
+ }
15752
+ let result = this.member(depth);
15753
+ for (let i = prefixes.length - 1; i >= 0; i -= 1) result = prefixes[i] === "!" ? {
15754
+ k: "not",
15755
+ operand: result
15756
+ } : UNKNOWN;
15757
+ return result;
15758
+ }
15759
+ member(depth) {
15760
+ let result = this.primary(depth);
15761
+ let links = 0;
15762
+ for (;;) {
15763
+ if (this.take("p", ".")) {
15764
+ const method = this.next("id").v;
15765
+ if (method === "getTag") this.readsTag = true;
15766
+ result = this.is("p", "(") ? {
15767
+ k: "call",
15768
+ method,
15769
+ receiver: result,
15770
+ args: this.arguments(depth)
15771
+ } : attribute(result, method);
15772
+ } else if (this.take("p", "[")) {
15773
+ const key = this.next("str").v;
15774
+ this.expect("p", "]");
15775
+ result = attribute(result, decodeCedarString(key));
15776
+ } else return result;
15777
+ links += 1;
15778
+ if (links > MAX_NESTING) throw new SyntaxError("too deep");
15779
+ }
15780
+ }
15781
+ arguments(depth) {
15782
+ this.expect("p", "(");
15783
+ return this.list(")", depth + 1);
15784
+ }
15785
+ list(close, depth) {
15786
+ const items = [];
15787
+ while (!this.take("p", close)) {
15788
+ items.push(this.expression(depth));
15789
+ if (!this.is("p", close)) this.expect("p", ",");
15790
+ }
15791
+ return items;
15792
+ }
15793
+ primary(depth) {
15794
+ const token = this.peek();
15795
+ if (token === void 0) throw new SyntaxError("unexpected end");
15796
+ this.position += 1;
15797
+ if (token.t === "str") return {
15798
+ k: "str",
15799
+ raw: token.v
15800
+ };
15801
+ if (token.t === "num") return UNKNOWN;
15802
+ if (token.t === "id") {
15803
+ if (token.v === "true" || token.v === "false") return {
15804
+ k: "lit",
15805
+ v: token.v === "true"
15806
+ };
15807
+ if ([
15808
+ "principal",
15809
+ "resource",
15810
+ "action",
15811
+ "context"
15812
+ ].includes(token.v)) return {
15813
+ k: "var",
15814
+ name: token.v
15815
+ };
15816
+ while (this.take("p", "::")) {
15817
+ if (this.peek()?.t === "str") {
15818
+ this.position += 1;
15819
+ return UNKNOWN;
15820
+ }
15821
+ this.next("id");
15822
+ }
15823
+ if (this.is("p", "(")) this.arguments(depth);
15824
+ return UNKNOWN;
15825
+ }
15826
+ if (token.v === "(") {
15827
+ const inner = this.expression(depth + 1);
15828
+ this.expect("p", ")");
15829
+ return inner;
15830
+ }
15831
+ if (token.v === "[") return {
15832
+ k: "set",
15833
+ items: this.list("]", depth + 1)
15834
+ };
15835
+ if (token.v === "{") {
15836
+ while (!this.take("p", "}")) {
15837
+ const key = this.peek();
15838
+ if (key === void 0 || key.t !== "id" && key.t !== "str") throw new SyntaxError("expected key");
15839
+ this.position += 1;
15840
+ this.expect("p", ":");
15841
+ this.expression(depth + 1);
15842
+ if (!this.is("p", "}")) this.expect("p", ",");
15843
+ }
15844
+ return UNKNOWN;
15845
+ }
15846
+ throw new SyntaxError("unexpected token");
15847
+ }
15848
+ };
15849
+ function attribute(target, name) {
15850
+ if (target.k !== "var" || name === null) return UNKNOWN;
15851
+ if (target.name === "principal" && (name === "category" || name === "name")) return { k: name };
15852
+ return target.name === "resource" && name === "path" ? { k: "path" } : UNKNOWN;
15853
+ }
15854
+ const parseExpression = (text) => new Parser(tokenize(text)).parseAll();
15855
+ const triOf = (value) => value ? "yes" : "no";
15856
+ const invert = (value) => value === "maybe" ? "maybe" : value === "yes" ? "no" : "yes";
15857
+ const constantSets = /* @__PURE__ */ new WeakMap();
15858
+ function valueOf(expr, facts, read) {
15859
+ switch (expr.k) {
15860
+ case "str": {
15861
+ const decoded = decodeCedarString(expr.raw);
15862
+ return decoded === null ? { k: "unknown" } : {
15863
+ k: "str",
15864
+ v: decoded
15865
+ };
15866
+ }
15867
+ case "category": return {
15868
+ k: "str",
15869
+ v: read
15870
+ };
15871
+ case "path": return facts.path === void 0 ? { k: "unknown" } : {
15872
+ k: "str",
15873
+ v: facts.path
15874
+ };
15875
+ case "name": return { k: "name" };
15876
+ case "set": {
15877
+ const known = constantSets.get(expr);
15878
+ if (known !== void 0) return known;
15879
+ const items = expr.items.map((item) => valueOf(item, facts, read));
15880
+ const value = items.some((item) => item.k === "set") ? { k: "unknown" } : {
15881
+ k: "set",
15882
+ items
15883
+ };
15884
+ if (expr.items.every((item) => item.k === "str")) constantSets.set(expr, value);
15885
+ return value;
15886
+ }
15887
+ case "if": {
15888
+ const cond = evaluateExpression(expr.cond, facts);
15889
+ if (cond === "maybe") return { k: "unknown" };
15890
+ return valueOf(cond === "yes" ? expr.then : expr.otherwise, facts, read);
15891
+ }
15892
+ case "lit":
15893
+ case "and":
15894
+ case "or":
15895
+ case "not":
15896
+ case "cmp":
15897
+ case "like":
15898
+ case "call": return {
15899
+ k: "tri",
15900
+ v: evaluateExpression(expr, facts)
15901
+ };
15902
+ default: return { k: "unknown" };
15903
+ }
15904
+ }
15905
+ function sameValue(left, right) {
15906
+ if (left.k === "unknown" || right.k === "unknown") return "maybe";
15907
+ if (left.k === "name" || right.k === "name") {
15908
+ const other = left.k === "name" ? right : left;
15909
+ if (other.k !== "str") return other.k === "name" ? "maybe" : "no";
15910
+ return HUMAN_NAMES.includes(other.v.trim().toLowerCase()) ? "maybe" : "no";
15911
+ }
15912
+ if (left.k === "tri" && right.k === "tri") return left.v === "maybe" || right.v === "maybe" ? "maybe" : triOf(left.v === right.v);
15913
+ if (left.k === "tri" || right.k === "tri") return "no";
15914
+ if (left.k === "str" && right.k === "str") return triOf(left.v === right.v);
15915
+ if (left.k === "set" && right.k === "set") {
15916
+ const [leftIndex, rightIndex] = [indexItems(left.items), indexItems(right.items)];
15917
+ if (leftIndex.pure && rightIndex.pure) return triOf(leftIndex.strings.size === rightIndex.strings.size && holdsAll(leftIndex, rightIndex));
15918
+ const covers = (from, into) => {
15919
+ const index = indexItems(into);
15920
+ return combine(from.map((item) => member(item, index)), "and");
15921
+ };
15922
+ return combine([covers(left.items, right.items), covers(right.items, left.items)], "and");
15923
+ }
15924
+ return "no";
15925
+ }
15926
+ function holdsAll(index, other) {
15927
+ for (const value of other.strings) if (!index.strings.has(value)) return false;
15928
+ return true;
15929
+ }
15930
+ function shareAny(left, right) {
15931
+ const [small, large] = left.strings.size <= right.strings.size ? [left, right] : [right, left];
15932
+ for (const value of small.strings) if (large.strings.has(value)) return true;
15933
+ return false;
15934
+ }
15935
+ const indexes = /* @__PURE__ */ new WeakMap();
15936
+ function indexItems(items) {
15937
+ const known = indexes.get(items);
15938
+ if (known !== void 0) return known;
15939
+ const index = buildIndex(items);
15940
+ indexes.set(items, index);
15941
+ return index;
15942
+ }
15943
+ function buildIndex(items) {
15944
+ const strings = /* @__PURE__ */ new Set();
15945
+ const representatives = /* @__PURE__ */ new Map();
15946
+ for (const item of items) if (item.k === "str") {
15947
+ strings.add(item.v);
15948
+ representatives.set(HUMAN_NAMES.includes(item.v.trim().toLowerCase()) ? "human" : "str", item);
15949
+ } else representatives.set(item.k === "tri" ? `tri:${item.v}` : item.k, item);
15950
+ return {
15951
+ strings,
15952
+ representatives: [...representatives.values()],
15953
+ pure: items.every((item) => item.k === "str")
15954
+ };
15955
+ }
15956
+ function member(item, index) {
15957
+ if (item.k === "str" && index.strings.has(item.v)) return "yes";
15958
+ return combine(index.representatives.map((candidate) => sameValue(item, candidate)), "or");
15959
+ }
15960
+ function combine(results, op) {
15961
+ const decisive = op === "and" ? "no" : "yes";
15962
+ if (results.includes(decisive)) return decisive;
15963
+ return results.includes("maybe") ? "maybe" : invert(decisive);
15964
+ }
15965
+ function setCall(method, receiver, args) {
15966
+ if (receiver.k !== "set") return "maybe";
15967
+ if (method === "isEmpty" && args.length === 0) return triOf(receiver.items.length === 0);
15968
+ const [argument] = args;
15969
+ if (args.length !== 1) return "maybe";
15970
+ const index = indexItems(receiver.items);
15971
+ if (method === "contains") return member(argument, index);
15972
+ if (argument.k !== "set") return "maybe";
15973
+ if (method === "containsAny" || method === "containsAll") {
15974
+ const other = indexItems(argument.items);
15975
+ if (index.pure && other.pure) return triOf(method === "containsAny" ? shareAny(index, other) : other.strings.size <= index.strings.size && holdsAll(index, other));
15976
+ return combine(argument.items.map((item) => member(item, index)), method === "containsAny" ? "or" : "and");
15977
+ }
15978
+ return "maybe";
15979
+ }
15980
+ const leaves = (expr) => expr.k === "set" ? expr.items.flatMap(leaves) : expr.k === "if" ? [...leaves(expr.then), ...leaves(expr.otherwise)] : [expr];
15981
+ function strings(exprs) {
15982
+ const found = [];
15983
+ for (const part of exprs.flatMap(leaves)) {
15984
+ const decoded = part.k === "str" ? decodeCedarString(part.raw) : null;
15985
+ if (decoded !== null) found.push(decoded);
15986
+ }
15987
+ return found;
15988
+ }
15989
+ const readsCategory = (exprs) => exprs.flatMap(leaves).some((part) => part.k === "category");
15990
+ const spelledAtoms = /* @__PURE__ */ new WeakMap();
15991
+ function spelledBy(expr) {
15992
+ let spelled = spelledAtoms.get(expr);
15993
+ if (spelled === void 0) {
15994
+ const sides = expr.k === "cmp" ? [expr.left, expr.right] : [expr.receiver, ...expr.args];
15995
+ spelled = {
15996
+ reads: readsCategory(sides),
15997
+ names: new Set(strings(sides))
15998
+ };
15999
+ spelledAtoms.set(expr, spelled);
16000
+ }
16001
+ return spelled;
16002
+ }
16003
+ function mentions(expr, name) {
16004
+ if (name === void 0) return false;
16005
+ if (expr.k === "like") {
16006
+ const segments = cedarLikeSegments(expr.pattern);
16007
+ return readsCategory([expr.operand]) && segments.some((segment) => segment.includes(name)) && globMatches(segments, name);
16008
+ }
16009
+ const { reads, names } = spelledBy(expr);
16010
+ return reads && names.has(name);
16011
+ }
16012
+ const readOf = (expr, facts) => mentions(expr, facts.unnamed) ? UNNAMED_CATEGORY : facts.category;
16013
+ function evaluateExpression(expr, facts) {
16014
+ switch (expr.k) {
16015
+ case "lit": return triOf(expr.v);
16016
+ case "not": return invert(evaluateExpression(expr.operand, facts));
16017
+ case "and":
16018
+ case "or": return combine(expr.terms.map((term) => evaluateExpression(term, facts)), expr.k);
16019
+ case "if": {
16020
+ const cond = evaluateExpression(expr.cond, facts);
16021
+ if (cond !== "maybe") return evaluateExpression(cond === "yes" ? expr.then : expr.otherwise, facts);
16022
+ const [then, otherwise] = [expr.then, expr.otherwise].map((branch) => evaluateExpression(branch, facts));
16023
+ return then === otherwise ? then : "maybe";
16024
+ }
16025
+ case "cmp": {
16026
+ const read = readOf(expr, facts);
16027
+ const same = sameValue(valueOf(expr.left, facts, read), valueOf(expr.right, facts, read));
16028
+ return expr.equals ? same : invert(same);
16029
+ }
16030
+ case "like": {
16031
+ const subject = valueOf(expr.operand, facts, readOf(expr, facts));
16032
+ if (UNSUPPORTED_PATTERN_ESCAPE.test(expr.pattern)) return "maybe";
16033
+ const segments = cedarLikeSegments(expr.pattern);
16034
+ if (subject.k === "name") return HUMAN_NAMES.some((candidate) => globMatches(segments, candidate)) ? "maybe" : "no";
16035
+ if (subject.k !== "str") return "maybe";
16036
+ return triOf(globMatches(segments, subject.v));
16037
+ }
16038
+ case "call": {
16039
+ const read = readOf(expr, facts);
16040
+ return setCall(expr.method, valueOf(expr.receiver, facts, read), expr.args.map((arg) => valueOf(arg, facts, read)));
16041
+ }
16042
+ default: return "maybe";
16043
+ }
16044
+ }
16045
+
16046
+ //#endregion
16047
+ //#region src/policy/cedar-principal-scope.ts
16048
+ const PROBE_CLASSES = ["human", NO_EVIDENCE_CATEGORY];
16049
+ const ANONYMOUS_PRINCIPAL_ID = "anonymous";
16050
+ const S = CEDAR_SPACE_CLASS;
16051
+ const HEAD = new RegExp(`\\b(forbid|permit)${S}*\\(`, "g");
16052
+ const isAnnotationName = (code, index) => {
16053
+ let position = index - 1;
16054
+ while (position >= 0 && isCedarSpace(code[position])) position -= 1;
16055
+ return code[position] === "@";
16056
+ };
16057
+ const skipSpace = (text, from) => {
16058
+ let index = from;
16059
+ while (index < text.length && isCedarSpace(text[index])) index += 1;
16060
+ return index;
16061
+ };
16062
+ const conditionAt = (text, from) => {
16063
+ const keywordStart = skipSpace(text, from);
16064
+ const kind = text.startsWith("when", keywordStart) ? "when" : text.startsWith("unless", keywordStart) ? "unless" : null;
16065
+ if (kind === null) return null;
16066
+ const braceOpen = skipSpace(text, keywordStart + kind.length);
16067
+ return text[braceOpen] === "{" ? {
16068
+ kind,
16069
+ braceOpen
16070
+ } : null;
16071
+ };
16072
+ function matching(code, openIndex, open, close) {
16073
+ let depth = 0;
16074
+ for (let i = openIndex; i < code.length; i++) if (code[i] === open) depth++;
16075
+ else if (code[i] === close) {
16076
+ depth--;
16077
+ if (depth === 0) return i;
16078
+ }
16079
+ return -1;
16080
+ }
16081
+ function parseCedarStatements(cedar) {
16082
+ const { visible, code } = maskCedar(cedar);
16083
+ const statements = [];
16084
+ const heads = new RegExp(HEAD.source, "g");
16085
+ let previousEnd = 0;
16086
+ let match = heads.exec(code);
16087
+ while (match !== null) {
16088
+ if (isAnnotationName(code, match.index)) {
16089
+ match = heads.exec(code);
16090
+ continue;
16091
+ }
16092
+ const open = match.index + match[0].length - 1;
16093
+ const scopeEnd = matching(code, open, "(", ")");
16094
+ if (scopeEnd < 0) break;
16095
+ const conditions = [];
16096
+ let position = scopeEnd + 1;
16097
+ for (;;) {
16098
+ const condition = conditionAt(code, position);
16099
+ if (condition === null) break;
16100
+ const braceClose = matching(code, condition.braceOpen, "{", "}");
16101
+ if (braceClose < 0) {
16102
+ position = code.length;
16103
+ break;
16104
+ }
16105
+ conditions.push({
16106
+ kind: condition.kind,
16107
+ body: visible.slice(condition.braceOpen + 1, braceClose)
16108
+ });
16109
+ position = braceClose + 1;
16110
+ }
16111
+ const terminatorAt = skipSpace(code, position);
16112
+ const end = code[terminatorAt] === ";" ? terminatorAt + 1 : position;
16113
+ statements.push({
16114
+ effect: match[1],
16115
+ blockStart: Math.min(skipSpace(cedar, previousEnd), match.index),
16116
+ start: match.index,
16117
+ end,
16118
+ text: visible.slice(match.index, end),
16119
+ scope: visible.slice(open + 1, scopeEnd),
16120
+ conditions,
16121
+ annotations: visible.slice(previousEnd, match.index)
16122
+ });
16123
+ previousEnd = end;
16124
+ heads.lastIndex = end;
16125
+ match = heads.exec(code);
16126
+ }
16127
+ return statements;
16128
+ }
16129
+ const TRUE_BODY = new RegExp(`^${S}*true${S}*$`);
16130
+ const PRINCIPAL_EQUALS = new RegExp(`\\bprincipal${S}*==`);
16131
+ const ENTITY_ID = new RegExp(`::${S}*"((?:\\\\.|[^"\\\\])*)"`, "g");
16132
+ const IS_TYPE = new RegExp(`\\bis${S}+([\\w:]+)`);
16133
+ const ID_ANNOTATION = new RegExp(`@id\\(${S}*"((?:\\\\.|[^"\\\\])*)"${S}*\\)`, "g");
16134
+ function principalScope(scope) {
16135
+ const { visible, code } = maskCedar(scope);
16136
+ let depth = 0;
16137
+ let end = code.length;
16138
+ for (let i = 0; i < code.length; i++) {
16139
+ const char = code[i];
16140
+ if (char === "(" || char === "[" || char === "{") depth++;
16141
+ else if (char === ")" || char === "]" || char === "}") depth--;
16142
+ else if (char === "," && depth === 0) {
16143
+ end = i;
16144
+ break;
16145
+ }
16146
+ }
16147
+ const text = visible.slice(0, end);
16148
+ const masked = code.slice(0, end);
16149
+ if (PRINCIPAL_EQUALS.test(masked) || /\bin\b/.test(masked)) return Array.from(text.matchAll(ENTITY_ID), (m) => decodeCedarString(m[1])).some((id) => id === null || id === ANONYMOUS_PRINCIPAL_ID) ? "maybe" : "no";
16150
+ const isType = IS_TYPE.exec(masked);
16151
+ if (isType) return isType[1].split("::").pop() === "Agent" ? "maybe" : "no";
16152
+ return "yes";
16153
+ }
16154
+ const prepared = /* @__PURE__ */ new WeakMap();
16155
+ function parsedCondition(body) {
16156
+ try {
16157
+ return parseExpression(body);
16158
+ } catch {
16159
+ return null;
16160
+ }
16161
+ }
16162
+ function evaluableOf(statement) {
16163
+ return {
16164
+ scope: principalScope(statement.scope),
16165
+ conditions: statement.conditions.map(({ kind, body }) => ({
16166
+ kind,
16167
+ node: parsedCondition(body)
16168
+ }))
16169
+ };
16170
+ }
16171
+ function preparedOf(statement) {
16172
+ let entry = prepared.get(statement);
16173
+ if (entry === void 0) {
16174
+ const named = namesNoEvidence(statement.text);
16175
+ entry = {
16176
+ namesNoEvidence: named,
16177
+ substituted: !named && withNoEvidenceExclusion(statement.text) !== statement.text,
16178
+ evaluable: evaluableOf(statement)
16179
+ };
16180
+ prepared.set(statement, entry);
16181
+ }
16182
+ return entry;
16183
+ }
16184
+ function statementApplies(statement, facts) {
16185
+ const { substituted, evaluable } = preparedOf(statement);
16186
+ const read = facts.category === "no_evidence" && substituted ? {
16187
+ ...facts,
16188
+ category: "human"
16189
+ } : facts;
16190
+ const effective = {
16191
+ category: read.category,
16192
+ path: read.path,
16193
+ unnamed: facts.discountNaming ? read.category : void 0
16194
+ };
16195
+ if (evaluable.scope === "no") return false;
16196
+ for (const { kind, node } of evaluable.conditions) {
16197
+ const result = node === null ? "maybe" : evaluateExpression(node, effective);
16198
+ if (kind === "when" && result === "no") return false;
16199
+ if (kind === "unless" && result === "yes") return false;
16200
+ }
16201
+ return true;
16202
+ }
16203
+ function reachesClassOnlyByNaming(statement, probe, path) {
16204
+ return statementApplies(statement, {
16205
+ category: probe,
16206
+ path
16207
+ }) && !statementApplies(statement, {
16208
+ category: probe,
16209
+ path,
16210
+ discountNaming: true
16211
+ });
16212
+ }
16213
+ function statementId(statement) {
16214
+ return Array.from(statement.annotations.matchAll(ID_ANNOTATION), (m) => unescapeCedarString(m[1])).at(-1);
16215
+ }
16216
+ let memoText;
16217
+ let memoParsed = {
16218
+ text: "",
16219
+ statements: []
16220
+ };
16221
+ function parsedOf(cedar) {
16222
+ if (memoText !== cedar) {
16223
+ const text = withoutNoEvidenceExclusion(cedar);
16224
+ memoParsed = {
16225
+ text,
16226
+ statements: parseCedarStatements(text)
16227
+ };
16228
+ memoText = cedar;
16229
+ }
16230
+ return memoParsed;
16231
+ }
16232
+ function analyzePolicyScope(cedar) {
16233
+ const { text, statements } = parsedOf(cedar);
16234
+ return {
16235
+ unnarrowedDeny(path) {
16236
+ const found = [];
16237
+ let line = 1;
16238
+ let counted = 0;
16239
+ for (const statement of statements) {
16240
+ if (statement.effect !== "forbid") continue;
16241
+ const classes = PROBE_CLASSES.filter((probe) => statementApplies(statement, {
16242
+ category: probe,
16243
+ path
16244
+ }) && !reachesClassOnlyByNaming(statement, probe, path));
16245
+ if (classes.length > 0) {
16246
+ for (; counted < statement.blockStart; counted++) if (text.charCodeAt(counted) === 10) line++;
16247
+ found.push({
16248
+ statement,
16249
+ classes,
16250
+ line
16251
+ });
16252
+ }
16253
+ }
16254
+ return found;
16255
+ },
16256
+ denyNamingClass(path, probe) {
16257
+ return statements.filter((statement) => statement.effect === "forbid" && (probe !== "no_evidence" || preparedOf(statement).namesNoEvidence) && reachesClassOnlyByNaming(statement, probe, path));
16258
+ },
16259
+ lacksBaselinePermit() {
16260
+ return statements.length > 0 && !statements.some(isBaselinePermit);
16261
+ }
16262
+ };
16263
+ }
16264
+ const unnarrowedDenyStatements = (cedar, path) => analyzePolicyScope(cedar).unnarrowedDeny(path);
16265
+ const lacksBaselinePermit = (cedar) => analyzePolicyScope(cedar).lacksBaselinePermit();
16266
+ function isBaselinePermit(statement) {
16267
+ return statement.effect === "permit" && principalScope(statement.scope) === "yes" && statement.conditions.every((condition) => condition.kind === "when" && TRUE_BODY.test(condition.body));
16268
+ }
14679
16269
 
14680
16270
  //#endregion
14681
16271
  //#region src/policy/cedar-rule-match.ts
@@ -14691,6 +16281,8 @@ function cedarQuotedValueRegExp(prefixSource, flags = "") {
14691
16281
  * engine (`name = agentName`, `category = scraper|detectionClass`), so the
14692
16282
  * narrowing mirrors the engine's own evaluation. An UNKNOWN fact never narrows.
14693
16283
  */
16284
+ const UNLESS_BRACE = new RegExp(`unless${CEDAR_SPACE_CLASS}*\\{`);
16285
+ const FORBID_HEAD = new RegExp(`\\bforbid${CEDAR_SPACE_CLASS}*\\(`, "g");
14694
16286
  /**
14695
16287
  * A block applies when its path AND principal conditions all match the KNOWN
14696
16288
  * request facts. An unknown fact never narrows (so the no-`request` case unions
@@ -14699,9 +16291,16 @@ function cedarQuotedValueRegExp(prefixSource, flags = "") {
14699
16291
  function blockApplies(block, request) {
14700
16292
  if (request?.path !== void 0 && !blockMatchesPath(block, request.path)) return false;
14701
16293
  if (request?.name !== void 0 && !blockMatchesEquality(block, "principal.name", request.name)) return false;
14702
- if (request?.category !== void 0 && !blockMatchesEquality(block, "principal.category", request.category)) return false;
16294
+ if (request?.category !== void 0) {
16295
+ if (!blockMatchesEquality(block, "principal.category", categoryRead(block, request.category))) return false;
16296
+ }
14703
16297
  return true;
14704
16298
  }
16299
+ function categoryRead(block, category) {
16300
+ if (category !== "no_evidence") return category;
16301
+ const original = withoutNoEvidenceExclusion(block);
16302
+ return withNoEvidenceExclusion(original) !== original ? "human" : category;
16303
+ }
14705
16304
  /** The `resource.path` literals appearing anywhere in `text` (no `when`/
14706
16305
  * `unless` scoping — callers that care about scope use `splitWhenUnless`
14707
16306
  * first). Shared regex extraction for `pathLiteralsInBlock` and the
@@ -14741,7 +16340,7 @@ function pathLiteralsInBlock(block) {
14741
16340
  * the text contains.
14742
16341
  */
14743
16342
  function splitWhenUnless(block) {
14744
- const unlessIndex = block.search(/unless\s*\{/);
16343
+ const unlessIndex = block.search(UNLESS_BRACE);
14745
16344
  if (unlessIndex === -1) return {
14746
16345
  whenText: block,
14747
16346
  unlessText: ""
@@ -14824,67 +16423,79 @@ function blockMatchesEquality(block, attr, value) {
14824
16423
  * literal maps each `*` (and `**`) to `.*`, anchored.
14825
16424
  */
14826
16425
  function pathLiteralMatches(literal, path) {
14827
- if (!literal.includes("*")) return path === literal;
14828
- const pattern = escapeRegExp(literal).replace(/\\\*/g, ".*");
14829
- try {
14830
- return new RegExp(`^${pattern}$`).test(path);
14831
- } catch {
14832
- return false;
14833
- }
16426
+ return globMatches(literal.split("*"), path);
14834
16427
  }
14835
16428
  /**
14836
16429
  * True when the block contains a Cedar `forbid` statement (a deny rule). A bare
14837
16430
  * `forbid` defaults to BLOCK; a `@verdict(...)` annotation refines the kind.
14838
16431
  */
14839
16432
  function isForbidBlock(block) {
14840
- return /\bforbid\s*\(/.test(block);
14841
- }
14842
- /** True when the block narrows the principal — by category/name equality, a
14843
- * Cedar entity-type test (`principal is X`), or a scope-position binding
14844
- * (`forbid(principal == X::"…"`). An un-narrowed deny matches every principal.
14845
- *
14846
- * Cursor Bugbot (2026-09-11, High): this used to scan the WHOLE block for
14847
- * a principal literal, `when`/`unless` alike — the exact same class of bug
14848
- * `blockMatchesPath` above was already fixed for on the path dimension
14849
- * (see that function's doc comment). `unless { principal.category ==
14850
- * "search_engine" }` on an otherwise site-wide `forbid` only exempts
14851
- * search engines from the deny — the rule still denies every OTHER
14852
- * principal, humans included — but scanning the whole block found the
14853
- * `==` literal and called the rule "narrowed," so `pathHasUnnarrowedDenyRule`
14854
- * missed it and a real browser hitting that path reached Cedar only to be
14855
- * denied by the very rule this check exists to catch. Split `when`/`unless`
14856
- * first: a WHEN-scope (or scope-position) literal genuinely targets the
14857
- * deny, narrowing it away from every principal not named — whatever value
14858
- * it names, since an un-narrowed literal search wouldn't have found one at
14859
- * all. An UNLESS-scope literal does the opposite: it exempts ONLY that
14860
- * specific principal, so it narrows the rule away from humans only when
14861
- * the exempted value is literally `"human"` (the #3297 carve-out idiom) —
14862
- * exempting anyone else leaves the deny fully un-narrowed with respect to
14863
- * humans. */
14864
- function narrowsPrincipal(block) {
14865
- const { whenText, unlessText } = splitWhenUnless(block);
14866
- if (blockEqualityLiterals(whenText, "principal.category").length > 0) return true;
14867
- if (blockExclusionLiterals(whenText, "principal.category").includes("human")) return true;
14868
- if (blockEqualityLiterals(whenText, "principal.name").length > 0) return true;
14869
- if (/principal\s+is\s+\w/.test(whenText)) return true;
14870
- if (/forbid\s*\(\s*principal\s*==/.test(whenText)) return true;
14871
- if (blockEqualityLiterals(unlessText, "principal.category").includes("human")) return true;
14872
- return false;
16433
+ const { code } = maskCedar(block);
16434
+ return Array.from(code.matchAll(FORBID_HEAD)).some(({ index }) => !isAnnotationName(code, index));
14873
16435
  }
14874
- /** A deny rule that targets EVERY principal — the silent-human-impact footgun. */
14875
16436
  function isUnnarrowedDenyBlock(block) {
14876
- return isForbidBlock(block) && !narrowsPrincipal(block);
16437
+ return unnarrowedDenyStatements(block).some(({ classes }) => classes.includes("human"));
16438
+ }
16439
+ function analyzePolicySource(cedar) {
16440
+ const scope = analyzePolicyScope(cedar);
16441
+ const analysis = {
16442
+ unnarrowedDenyFor: (path, probe) => scope.unnarrowedDeny(path).some(({ classes }) => classes.includes(probe)),
16443
+ explicitDenyFor: (path, probe) => scope.denyNamingClass(path, probe).length > 0,
16444
+ humanHazard: (path) => analysis.unnarrowedDenyFor(path, "human"),
16445
+ noEvidenceHazard: (path) => analysis.unnarrowedDenyFor(path, "no_evidence") && !analysis.noEvidenceNamed(path),
16446
+ noEvidenceNamed: (path) => analysis.explicitDenyFor(path, NO_EVIDENCE_CATEGORY)
16447
+ };
16448
+ return analysis;
16449
+ }
16450
+ function pathHasUnnarrowedDenyRuleFor(cedar, path, probe) {
16451
+ return analyzePolicySource(cedar).unnarrowedDenyFor(path, probe);
16452
+ }
16453
+ function pathHasExplicitDenyRuleFor(cedar, path, probe) {
16454
+ return analyzePolicySource(cedar).explicitDenyFor(path, probe);
14877
16455
  }
14878
- /**
14879
- * True when some un-narrowed deny rule in the bundle matches `path` — i.e. a
14880
- * human hitting `path` is denied by a rule that never narrowed the principal.
14881
- * The single shared definition of "this path catches humans by accident,"
14882
- * used by the deploy gate AND the preview banner.
14883
- */
14884
16456
  function pathHasUnnarrowedDenyRule(cedar, path) {
14885
- return splitCedarBlocks(cedar).some((block) => isUnnarrowedDenyBlock(block) && blockMatchesPath(block, path));
16457
+ return analyzePolicySource(cedar).humanHazard(path);
14886
16458
  }
14887
16459
 
16460
+ //#endregion
16461
+ //#region src/policy/byte-bounded-memo.ts
16462
+ var ByteBoundedMemo = class {
16463
+ budgetBytes;
16464
+ entries = /* @__PURE__ */ new Map();
16465
+ used = 0;
16466
+ constructor(budgetBytes) {
16467
+ this.budgetBytes = budgetBytes;
16468
+ }
16469
+ remember(key, bytes, make) {
16470
+ const hit = this.entries.get(key);
16471
+ if (hit !== void 0) {
16472
+ this.entries.delete(key);
16473
+ this.entries.set(key, hit);
16474
+ return hit.value;
16475
+ }
16476
+ const value = make();
16477
+ if (bytes > this.budgetBytes) return value;
16478
+ this.entries.set(key, {
16479
+ value,
16480
+ bytes
16481
+ });
16482
+ this.used += bytes;
16483
+ for (const [oldest, entry] of this.entries) {
16484
+ if (this.used <= this.budgetBytes) break;
16485
+ this.entries.delete(oldest);
16486
+ this.used -= entry.bytes;
16487
+ }
16488
+ return value;
16489
+ }
16490
+ };
16491
+
16492
+ //#endregion
16493
+ //#region src/policy/unsubstituted-source.ts
16494
+ const BUDGET_BYTES = 4194304;
16495
+ const BYTES_PER_CHARACTER = 4;
16496
+ const memo = new ByteBoundedMemo(BUDGET_BYTES);
16497
+ const unsubstitutedSource = (source) => memo.remember(source, source.length * BYTES_PER_CHARACTER, () => withoutNoEvidenceExclusion(source));
16498
+
14888
16499
  //#endregion
14889
16500
  //#region src/policy/required-scopes.ts
14890
16501
  /**
@@ -14914,7 +16525,7 @@ function pathHasUnnarrowedDenyRule(cedar, path) {
14914
16525
  function requiredScopesForRequest(policySource, request) {
14915
16526
  if (!policySource || !policySource.trim()) return [];
14916
16527
  const out = /* @__PURE__ */ new Set();
14917
- for (const block of policySource.split(/\n\s*\n/)) {
16528
+ for (const block of unsubstitutedSource(policySource).split(/\n\s*\n/)) {
14918
16529
  if (!/@verdict\("CHALLENGE"\)/.test(block)) continue;
14919
16530
  const scopesMatch = block.match(cedarQuotedValueRegExp("@scopes\\("));
14920
16531
  if (!scopesMatch) continue;
@@ -14997,32 +16608,24 @@ function nonNavigablePolicyLabel(policyId) {
14997
16608
 
14998
16609
  //#endregion
14999
16610
  //#region src/policy/policy-lint.ts
15000
- 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.";
15001
- function blockIdAnnotation(block) {
15002
- const m = block.match(/@id\("((?:\\.|[^"\\])*)"\)/);
15003
- return m ? m[1] : void 0;
15004
- }
15005
- /**
15006
- * Flag every un-narrowed deny rule in a composed Cedar bundle. Pure and
15007
- * parity-irrelevant: a heuristic author-time WARNING, never an enforcement
15008
- * decision. Shares its "un-narrowed deny" definition with the deploy gate
15009
- * (`pathHasUnnarrowedDenyRule`) so the editor and the gate agree.
15010
- */
16611
+ const NARROW_ADVICE = "Add a `principal.category == \"ai_agent\"` (or `principal.name`) condition, or confirm you intend to affect them.";
16612
+ const EVERYONE_MESSAGE = `This rule denies every visitor, including humans and ${NO_EVIDENCE_CATEGORY} visitors, because it does not narrow the principal. ${NARROW_ADVICE}`;
16613
+ const HUMAN_MESSAGE = `This rule denies human visitors because it does not narrow the principal. ${NARROW_ADVICE}`;
16614
+ const NO_EVIDENCE_MESSAGE = `This rule also applies to ${NO_EVIDENCE_CATEGORY} visitors, who are real people whose browser sent no evidence to classify. Add a \`${NO_EVIDENCE_EXCLUSION_TERM}\` condition, or confirm you intend to affect them.`;
16615
+ const messageFor = (classes) => classes.length === PROBE_CLASSES.length ? EVERYONE_MESSAGE : classes.includes("no_evidence") ? NO_EVIDENCE_MESSAGE : HUMAN_MESSAGE;
15011
16616
  function lintUnnarrowedDenyRules(cedar) {
15012
- const findings = [];
15013
- let searchFrom = 0;
15014
- for (const block of splitCedarBlocks(cedar)) {
15015
- if (!isUnnarrowedDenyBlock(block)) continue;
15016
- const idx = cedar.indexOf(block, searchFrom);
15017
- const line = idx < 0 ? 1 : cedar.slice(0, idx).split("\n").length;
15018
- if (idx >= 0) searchFrom = idx + block.length;
15019
- findings.push({
15020
- ruleId: blockIdAnnotation(block),
15021
- line,
15022
- message: UNNARROWED_DENY_MESSAGE
15023
- });
15024
- }
15025
- return findings;
16617
+ return unnarrowedDenyStatements(cedar).map(({ statement, classes, line }) => ({
16618
+ ruleId: statementId(statement),
16619
+ line,
16620
+ message: messageFor(classes)
16621
+ }));
16622
+ }
16623
+ const MISSING_BASELINE_MESSAGE = `This policy has no baseline permit, so every visitor that no permit rule covers is denied, humans and ${NO_EVIDENCE_CATEGORY} visitors included. Add \`permit(principal, action, resource);\` if you want unmatched traffic allowed.`;
16624
+ function lintMissingBaselinePermit(cedar) {
16625
+ return lacksBaselinePermit(cedar) ? [{
16626
+ line: 1,
16627
+ message: MISSING_BASELINE_MESSAGE
16628
+ }] : [];
15026
16629
  }
15027
16630
 
15028
16631
  //#endregion
@@ -15063,7 +16666,7 @@ function lintUnnarrowedDenyRules(cedar) {
15063
16666
  function approvalQuorumForRequest(policySource, request) {
15064
16667
  if (!policySource || !policySource.trim()) return null;
15065
16668
  let chosen = null;
15066
- for (const block of policySource.split(/\n\s*\n/)) {
16669
+ for (const block of unsubstitutedSource(policySource).split(/\n\s*\n/)) {
15067
16670
  if (!/@verdict\("CHALLENGE"\)/.test(block)) continue;
15068
16671
  if (!blockApplies(block, request)) continue;
15069
16672
  const approvers = parseApprovers(block);
@@ -15139,6 +16742,11 @@ function validateStepUpQuorum(quorum) {
15139
16742
  * - Fallback to default policy on errors
15140
16743
  * - Configurable API endpoints
15141
16744
  */
16745
+ function looksLikePolicyApiBody(data) {
16746
+ if (typeof data !== "object" || data === null) return false;
16747
+ const threshold = data.blockThreshold;
16748
+ return typeof threshold === "number" && Number.isFinite(threshold);
16749
+ }
15142
16750
  var PolicyUnavailableError = class extends Error {
15143
16751
  code = "POLICY_UNAVAILABLE";
15144
16752
  constructor() {
@@ -15295,6 +16903,7 @@ var PolicyFetcher = class {
15295
16903
  });
15296
16904
  if (!response.ok) throw new Error(`API returned ${response.status}: ${response.statusText}`);
15297
16905
  const data = await response.json();
16906
+ if (!looksLikePolicyApiBody(data)) throw new Error("Policy response is not from the policy API");
15298
16907
  const policy = safeParsePolicyConfig(data);
15299
16908
  if (!policy) throw new Error("Invalid policy response format");
15300
16909
  return policy;
@@ -16079,9 +17688,9 @@ function deriveMcpiOrgKid(slug) {
16079
17688
  * surface stay unchanged.
16080
17689
  *
16081
17690
  * Throws on an invalid slug (same boundary as {@link deriveMcpiOrgDid}) rather
16082
- * than returning `[]`: an empty list re-enables the engine's fail-open
16083
- * "trust every root" default, so an org with a broken slug is a configuration
16084
- * error to surface loudly server-side, not a reason to trust everything.
17691
+ * than returning `[]`: an empty list makes the engine reject every delegation,
17692
+ * so an org with a broken slug is a configuration error to surface loudly
17693
+ * server-side, not a silent outage of every delegated agent.
16085
17694
  */
16086
17695
  function resolveTrustedDelegationRoots(org) {
16087
17696
  return [deriveMcpiOrgDid(org.slug)];
@@ -16104,11 +17713,10 @@ function deriveMcpiUserDid(slug, userId) {
16104
17713
  * Delegation-proof request detection (P2 / DR-1).
16105
17714
  *
16106
17715
  * The engine's L2 delegation-root pinning (`ContextSpec.trustedDelegationRoots`)
16107
- * is only consulted when a request actually carries a delegation credential.
16108
- * Every consumer surface — the Cloudflare gateway worker, the published SDK
16109
- * middleware (Next.js / Express), and the Next.js detector route — uses this one
16110
- * check to decide whether to resolve + inject the org's trusted roots, so the
16111
- * human / no-delegation hot path stays a precise no-op.
17716
+ * is consulted for every credential the engine verifies: the delegation-proof
17717
+ * headers below AND an `Authorization: Bearer` VC-JWT. Consumers gate root
17718
+ * resolution on `requestPresentedCredential`, so the human / no-credential hot
17719
+ * path stays a precise no-op.
16112
17720
  *
16113
17721
  * Keeping the header set here (rather than re-listing the literals at each site)
16114
17722
  * is the whole point: a new delegation transport header is added in one place
@@ -16144,6 +17752,73 @@ function requestCarriesDelegationProof(headers) {
16144
17752
  for (const key of Object.keys(record)) lowerKeyed.set(key.toLowerCase(), record[key]);
16145
17753
  return DELEGATION_PROOF_HEADERS.some((name) => isPresent(lowerKeyed.get(name)));
16146
17754
  }
17755
+ const MAX_VC_JWT_PAYLOAD_CHARS = 16384;
17756
+ function headerText(headers, name) {
17757
+ if (typeof headers.get === "function") return headers.get(name) ?? void 0;
17758
+ for (const [key, value] of Object.entries(headers)) {
17759
+ if (key.toLowerCase() !== name) continue;
17760
+ if (Array.isArray(value)) return value.join(", ");
17761
+ return typeof value === "string" ? value : void 0;
17762
+ }
17763
+ }
17764
+ function isMemberDelimiter(c) {
17765
+ return c === "=" || c === ";" || c === "," || c === " " || c === " ";
17766
+ }
17767
+ function hasKyaMember(value) {
17768
+ let memberStart = true;
17769
+ let quoted = false;
17770
+ let escaped = false;
17771
+ for (let i = 0; i < value.length; i++) {
17772
+ const c = value[i];
17773
+ if (quoted) {
17774
+ if (escaped) escaped = false;
17775
+ else if (c === "\\") escaped = true;
17776
+ else if (c === "\"") quoted = false;
17777
+ continue;
17778
+ }
17779
+ if (memberStart) {
17780
+ if (c === " " || c === " ") continue;
17781
+ if (value.startsWith("kya", i) && (i + 3 === value.length || isMemberDelimiter(value[i + 3]))) return true;
17782
+ memberStart = false;
17783
+ }
17784
+ if (c === "\"") quoted = true;
17785
+ else if (c === ",") memberStart = true;
17786
+ }
17787
+ return false;
17788
+ }
17789
+ function decodeBase64UrlJson(segment) {
17790
+ const padded = segment.replace(/-/g, "+").replace(/_/g, "/");
17791
+ const binary = atob(padded + "=".repeat((4 - padded.length % 4) % 4));
17792
+ const bytes = Uint8Array.from(binary, (ch) => ch.charCodeAt(0));
17793
+ return JSON.parse(new TextDecoder().decode(bytes));
17794
+ }
17795
+ function isDelegationCredentialPayload(payload) {
17796
+ if (typeof payload !== "object" || payload === null) return false;
17797
+ if ("vc" in payload) return true;
17798
+ const type = payload.type;
17799
+ return Array.isArray(type) && type.includes("DelegationCredential");
17800
+ }
17801
+ function looksLikeVcJwt(token) {
17802
+ const parts = token.split(".");
17803
+ if (parts.length !== 3 || parts.some((part) => part.length === 0)) return false;
17804
+ if (parts[1].length > MAX_VC_JWT_PAYLOAD_CHARS) return true;
17805
+ try {
17806
+ return isDelegationCredentialPayload(decodeBase64UrlJson(parts[1]));
17807
+ } catch {
17808
+ return false;
17809
+ }
17810
+ }
17811
+ /** Same definition as the .NET / Java `IsCredentialPresented`. */
17812
+ function requestPresentedCredential(headers) {
17813
+ if (!headers) return false;
17814
+ for (const name of ["signature-input", "signature"]) {
17815
+ const value = headerText(headers, name);
17816
+ if (value && hasKyaMember(value)) return true;
17817
+ }
17818
+ if (requestCarriesDelegationProof(headers)) return true;
17819
+ const bearer = headerText(headers, "authorization")?.match(/^bearer\s+(\S+)/i);
17820
+ return bearer !== null && bearer !== void 0 && looksLikeVcJwt(bearer[1]);
17821
+ }
16147
17822
 
16148
17823
  //#endregion
16149
17824
  //#region src/mcpi/principal.ts
@@ -18293,11 +19968,82 @@ const TrackingReadinessSchema = object({
18293
19968
  }).strict())
18294
19969
  }).strict();
18295
19970
 
19971
+ //#endregion
19972
+ //#region src/api/cli-registration.ts
19973
+ const CLI_PAIRING_PROTOCOL_VERSION = 2;
19974
+ const CLI_PAIRING_UPGRADE_MESSAGE = "Upgrade the KYA-OS CLI and run checkpoint init again. This pairing requires independent terminal proof.";
19975
+ const CliPairingProofSchema = string().regex(/^[A-Za-z0-9_-]{42}[AEIMQUYcgkosw048]$/);
19976
+ const CLI_PAIRING_FRAMEWORKS = [
19977
+ "nextjs",
19978
+ "express",
19979
+ "static",
19980
+ "unknown"
19981
+ ];
19982
+ const readable = string().max(255).regex(READABLE_TEXT, READABLE_TEXT_MESSAGE);
19983
+ const label = readable.min(1);
19984
+ const hint = string().trim().min(1).max(255).regex(READABLE_TEXT, READABLE_TEXT_MESSAGE);
19985
+ const uuid = string().uuid();
19986
+ const CliPairingRegisterRequestSchema = object({
19987
+ protocolVersion: literal(2),
19988
+ exchangeChallenge: CliPairingProofSchema,
19989
+ domainHint: hint.optional(),
19990
+ repoName: hint.optional(),
19991
+ framework: _enum(CLI_PAIRING_FRAMEWORKS).optional()
19992
+ }).strict();
19993
+ const CliPairingApprovedClaimSchema = object({
19994
+ userId: uuid,
19995
+ organizationId: uuid,
19996
+ projectId: uuid
19997
+ }).strict();
19998
+ const CliPairingClaimSchema = object({
19999
+ userId: uuid,
20000
+ userEmail: label,
20001
+ userName: readable.nullable(),
20002
+ organizationId: uuid,
20003
+ organizationName: label,
20004
+ organizationSlug: readable.nullable(),
20005
+ projectId: uuid,
20006
+ projectName: label,
20007
+ projectDomain: readable.nullable()
20008
+ }).strict();
20009
+ const CliPairingExchangeRequestSchema = object({
20010
+ protocolVersion: literal(2),
20011
+ registrationId: uuid,
20012
+ exchangeVerifier: CliPairingProofSchema,
20013
+ approvedClaim: CliPairingApprovedClaimSchema
20014
+ }).strict();
20015
+ const CliPairingRegisterDataSchema = object({
20016
+ protocolVersion: literal(2),
20017
+ registrationId: uuid,
20018
+ claimToken: string().regex(/^cliclaim_[a-f0-9]{64}$/),
20019
+ claimUrl: string().url(),
20020
+ confirmationCode: string().regex(/^[BCDFGHJKLMNPQRSTVWXZ]{4}-[BCDFGHJKLMNPQRSTVWXZ]{4}$/),
20021
+ expiresAt: string().datetime()
20022
+ }).strict();
20023
+ const CliPairingPrivateStatusDataSchema = discriminatedUnion("status", [object({
20024
+ protocolVersion: literal(2),
20025
+ status: literal("pending"),
20026
+ claimed: _null()
20027
+ }).strict(), object({
20028
+ protocolVersion: literal(2),
20029
+ status: literal("claimed"),
20030
+ claimed: CliPairingClaimSchema
20031
+ }).strict()]);
20032
+ const CliPairingExchangeDataSchema = object({
20033
+ protocolVersion: literal(2),
20034
+ userId: uuid,
20035
+ projectId: uuid,
20036
+ organizationId: uuid,
20037
+ friendlyId: string().nullable(),
20038
+ apiKey: string().regex(/^sk_[a-f0-9]{64}$/),
20039
+ dashboardUrl: string().url()
20040
+ }).strict();
20041
+
18296
20042
  //#endregion
18297
20043
  //#region src/index.ts
18298
20044
  const VERSION = "0.1.0";
18299
20045
  const PACKAGE_NAME = "@kya-os/checkpoint-shared";
18300
20046
 
18301
20047
  //#endregion
18302
- export { A2ARpcEnvelopeSchema, A2ASignedRequestSchema, A2ATaskRequestSchema, A2ATaskSourceConfigSchema, A2ATaskStateSchema, ACCEPT_CHALLENGE_HEADER, ADMIN_DELTA_BASES, ADMIN_OVERVIEW_CACHE_STATUSES, ADMIN_OVERVIEW_LIST_LIMIT_DEFAULT, ADMIN_OVERVIEW_LIST_LIMIT_MAX, ADMIN_OVERVIEW_SECTIONS, ADMIN_OVERVIEW_WINDOWS, AGENT_CATEGORY_META, AI_AGENT_HEADERS, ANALYTICS_ERRORS, ANONYMOUS_PRINCIPAL_DID, API_ERRORS, API_ERROR_CODES, API_REQUEST_LIMITS, ATTESTED_BEARER_MAX_TTL_SECONDS, AUDIT_ERRORS, AUDIT_PROTOCOL_ERRORS, AUTHORIZATION_MODES, AUTH_ERRORS, AUTH_ERROR_MESSAGES, AUTH_MODES, AcceptanceWithdrawalSchema, AcceptedArtifactRevisionSchema, AccountSchema, AddFingerprintToProfileRequestSchema, AddModelCredentialSchema, AddUpdateProviderRequestSchema, AdminQueryParamsSchema, AgentCategorySchema, AgentClassificationRequestSchema, AgentClassificationResultSchema, AgentClassificationSchema, AgentInfoSchema, AgentPatternSchema, AgentProfileSchema, AgentShieldConfigSchema, AgentSourceDistributionSchema, AgentStatisticsSchema, AgentTypeDefinitionSchema, AgentTypeSchema, AgentTypeSchema as WasmAgentTypeSchema, AggregationTypeSchema, AllowListEntrySchema, AnalyticsAgentSourcesQuerySchema, AnalyticsAgentTypesQuerySchema, AnalyticsChartDataSchema, AnalyticsDataPointSchema, AnalyticsExportParamsSchema, AnalyticsExportQuerySchema, AnalyticsQuerySchema, AnalyticsRealtimeQuerySchema, AnalyticsSessionsQuerySchema, AnalyticsSessionsResponseSchema, AnalyticsSummarySchema as AnalyticsSessionsSummarySchema, AnalyticsSummarySchema$1 as AnalyticsSummarySchema, AnalyticsTimeSeriesSchema, AnalyticsTimeWindowSchema, ApiKeyPermissionSchema, ApiKeyRateLimitsSchema, ApiKeySchema, ApiKeysBulkCreateItemSchema, ApiKeysBulkRequestSchema, ApiKeysBulkRevokeItemSchema, ApiKeysBulkUpdateItemSchema, ApiKeysQuerySchema, ApiResponseSchema, ApplyIdentityIntentSchema, ApproveTaskPublicationSchema, ApprovedTaskPublicationSchema, ArtifactIdentitySchema, AssuranceTierSchema, AuthErrorType, AuthProviderTypeSchema, BARE_ERRORS, BASELINE_ALLOW_POLICY_ID, BESPOKE_POLICY_IDS, BILLING_ERRORS, BLOCKED_PATH, BOT_USER_AGENT_PATTERNS, BOUNCER_LOWERCASE_ERRORS, BOUNCER_UPPERCASE_ERRORS, BROWSER_PATTERNS, BULK_ERROR_CODES, BaseAuthProviderSchema, BaseBulkRequestSchema, BatchDetectionRequestSchema, BatchDetectionResponseSchema, BatchEventRequestSchema, BatchEventResponseSchema, BatchEventSchema, BatchPixelEventRequestSchema, BehavioralAnalysisSchema, BehavioralDataSchema, BehavioralPatternSchema, BehavioralRulesSchema, BehavioralSignalsSchema, BehavioralThresholdSchema, BindingStatusSchema, BlockEventSchema, BlockReasonSchema, BotPatternSchema, BotTypeSchema, BouncerConfigSchema, BouncerOutcomeSchema, BouncerProofSchema, BrowserInfoSchema, BulkDeletePreviewStatsSchema, BulkDeleteResponseSchema, BulkOperationOptionsSchema, BulkOperationParamsSchema, BulkOperationResultSchema, BulkOperationTypeSchema, BulkResponseSchema, BulkResultItemSchema, CACHE_LIMITS, CACHE_TTL, CLOUD_PROVIDER_RANGES, CONDITION_FIELDS, CONDITION_OPERATORS, CONFIDENCE_THRESHOLDS, CORRELATION_ID_HEADER, CRISPBudgetSchema, CURRENT_POLICY_VERSION, CacheConfigSchema, CachedDetectionDataSchema, ChallengeParamsSchema, ChallengeWireError, CircuitBreakerConfigSchema, CircuitBreakerStateSchema, ClaimVerificationSchema, CliIdentityQuerySchema, CliIdentityServiceSchema, CliIdentitySummarySchema, ClickEventSchema, ClientDetectionSchema, CollectFingerprintRequestSchema, CollectFingerprintResponseSchema, CollectedDataSchema, ConditionFieldSchema, ConditionOperatorSchema, ConditionValueSchema, ConfidenceBreakdownSchema, ConfidenceLevelSchema, ConfidenceThresholdSchema, ConfidenceUtils, ConfigureLinearInstallationSchema, ConfigureLinearInstallationV2Schema, ConfigureTaskSourceInstallationSchema, ConfiguredProviderSchema, ConsentAgentMetadataSchema, ConsentBrandingSchema, ConsentCapabilityGroupSchema, ConsentCapabilitySchema, ConsentConfigMetadataSchema, ConsentConfigSchema, ConsentTermsSchema, ConsentUISchema, ConsumedArtifactSchema, CorrelationIdSchema, CreateApiKeySchema, CreateOrganizationInputSchema, CreateOrganizationSchema, CreatePixelSchema, CreateProfileRequestSchema, CreateProjectSchema, CreateProvisioningOrganizationRequestSchema, CreateProvisioningOrganizationResponseSchema, CredentialProviderConfigSchema, CredentialProviderSchema, CustomRuleSchema, DATABASE_LIMITS, DEFAULT_ADMIN_OVERVIEW_WINDOW, DEFAULT_AGENTSHIELD_CONFIG, DEFAULT_AGENT_TYPES, DEFAULT_API_KEY_RATE_LIMITS, DEFAULT_AUTHORIZATION_HOST, DEFAULT_BEHAVIORAL_THRESHOLDS, DEFAULT_CACHE_CONFIG, DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CORS_CONFIG, DEFAULT_DETECTION_OPTIONS, DEFAULT_ENV_VARS, DEFAULT_LOG_CONFIG, DEFAULT_MAX_VENDOR_RANGE_AGE_MS, DEFAULT_PASSWORD_REQUIREMENTS, DEFAULT_PIXEL_CONFIG, DEFAULT_POLICY, DEFAULT_PROJECT_SETTINGS, DEFAULT_RESPONSE_HEADERS, DEFAULT_RETRY_CONFIG, DEFAULT_RULE_PRIORITY, DEFAULT_SESSION_CONFIG, DEFAULT_THRESHOLDS, DEFAULT_TIMEOUTS, DEFAULT_WEBHOOK_EVENTS, DELEGATION_PROOF_HEADERS, DEPLOY_ERRORS, DEPLOY_STEPS, DETECTION_ERRORS, DETECTION_LIMITS, DETECTION_REASON_CODES, DashboardStatsRequestSchema, DatabaseDetectionMetadataSchema, DatabaseStatusSchema, DecisionSchema, DelegationAuditSourceSchema, DelegationAuditSummarySchema, DelegationConstraintSummarySchema, DelegationEffectiveStatusSchema, DelegationExportChannelSchema, DelegationExportRecordSchema, DelegationExposureSchema, DelegationListStatusFilterSchema, DelegationManagementDetailSchema, DelegationManagementItemSchema, DelegationManagementListSchema, DelegationPollingStatusSchema, DelegationResultSchema, DelegationRevokeRequestSchema, DelegationRevokeResponseSchema, DelegationSchema, DelegationStatusSchema, DelegationStoredStatusSchema, DelegationVerifiedBySchema, DeleteAccountSchema, DenyListEntrySchema, DependencyBindingSchema, DeployProgressEventSchema, DeployStepIdSchema, DeployStepStateSchema, DeployStepStatusSchema, DeploymentMetadataSchema, DetectionClassSchema, DetectionDetailSchema, DetectionErrorDetailsSchema, DetectionEventSchema, DetectionInputSchema, DetectionLogSchema, DetectionMetadataSchema, DetectionModeSchema, DetectionOptionsSchema, DetectionReasonCodeSchema, DetectionReasoningSchema, DetectionRequestSchema, DetectionResponseSchema, DetectionResultSchema, DetectionRuleSchema, DetectionRulesSchema, DetectionSignalExposureSchema, DetectionSignalSchema, DetectionStatusSchema, DetectionTestResultSchema, DetectionViewTypeSchema, DidCommTaskSourceBindingSchema, DidCommTaskSourceConfigSchema, DidCommTaskSourceMessageSchema, DiscordTaskSourceConfigSchema, ENFORCEMENT_ACTIONS, ENFORCEMENT_MODES, ENTROPY_CONFIDENCE_CEILING, ENTROPY_CONFIDENCE_FLOOR, ERROR_CATEGORIES, ERROR_CODES, ERROR_MESSAGES, ERROR_STATUS_CODES, EXCLUSION_BUCKETS, EXPORT_LIMITS, EnforcementActionSchema, EnforcementModeSchema, EngineInfoSchema, EnhancedFingerprintResponseSchema, EnrollWorkloadSchema, ErrorResponseSchema, EventConfigSchema, EventStorageRecordSchema, EventTrackingRequestSchema, EventTrackingResponseSchema, ExportAnalyticsSchema, ExpressMiddlewareOptionsSchema, FallbackOptionsSchema, FilterOperatorSchema, FingerprintAnalysisSchema, ClientDetectionSchema$1 as FingerprintClientDetectionSchema, FingerprintDetectRequestSchema, FingerprintRecordSchema, FingerprintResponseSchema, FingerprintSearchQuerySchema, FleetPullRequestReceiptSchema, ForgeabilityRiskSchema, GitHubTaskSourceConfigSchema, GrowthBatchRequestSchema, GrowthConfigurationResetSchema, GrowthConfigurationThresholdsSchema, GrowthConfigurationUpdateSchema, GrowthOpportunitiesQuerySchema, GrowthOpportunityUpdateSchema, HEADER_PATTERNS, HTTP_STATUS, HeaderRuleSchema, HeaderRulesSchema, HealthResponseSchema, HomeRailRollupsRequestSchema, INSTALLATION_KINDS, INSTALLATION_TYPES, INTERNAL_ERRORS, IdentityIntentActionSchema, IdentityIntentRequestSchema, IdentityIntentSchema, IdentityIntentStateSchema, IdentityObservationSchema, ImmutableArtifactLocatorSchema, ImportIssueV2Schema, InstructPayloadSchema, IntegrationTypeSchema, InternalProcessingFlagsSchema, IpRangeCollectionSchema, IpRangeRuleSchema, IssueTaskGrantSchema, JafarParseError, KNOWN_AGENT_PATTERNS, KYAOS_PROTOCOL_ERRORS, KYA_A2A_EXTENSION, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KeyboardEventSchema, LOWERCASE_ERRORS, LinearActivityGateSchema, LinearActivityObservationSummarySchema, LinearInstallationAuthorizationSchema, LinearInstallationProviderStatusSchema, LinearInstallationStatusReasonSchema, LinearInstallationStatusSchema, LinearInstallationWorkflowSchema, LinearObsoleteActivityListSchema, LinearObsoleteActivitySchema, ListProvisioningOrganizationsRequestSchema, ListProvisioningOrganizationsResponseSchema, LoggingConfigSchema, MANAGEMENT_ACCESS_PREFIX, MANAGEMENT_AUDIENCE, MANAGEMENT_CLIENT_ID, MANAGEMENT_CONSENT_MAX_ORGANIZATIONS, MANAGEMENT_CONSENT_MAX_PROJECTS, MANAGEMENT_DEVICE_INTERVAL, MANAGEMENT_REFRESH_PREFIX, MANAGEMENT_USER_CODE_ALPHABET, MATCH_ACTIONS, MAX_BULK_BATCH_SIZE, MAX_ED25519_KEY_BODY_LENGTH, MAX_REASON_CODES_HEADER_BYTES, MAX_REASON_CODES_ON_WIRE, MAX_TASK_GRANT_DAYS, MAX_TASK_GRANT_DEPTH, MCPI_ORG_DID_HOST, MCP_CLIENT_DID_HOST, MOBILE_PATTERNS, ManagementAccessTokenSchema, ManagementAuthorizeQuerySchema, ManagementConsentContextSchema, ManagementConsentSchema, ManagementDeviceDescriptionSchema, ManagementDeviceRequestSchema, ManagementDeviceResponseSchema, ManagementDomainErrorSchema, ManagementErrorCodeSchema, ManagementErrorReasonSchema, ManagementErrorSchema, ManagementLoopbackRedirectSchema, ManagementPostureJwkSchema, ManagementPostureOriginsRequestSchema, ManagementPostureSchema, ManagementPrincipalSchema, ManagementProfileSchema, ManagementProjectNameSchema, ManagementProjectsSchema, ManagementRefreshTokenSchema, ManagementRevokeRequestSchema, ManagementRuntimeKeyPurposeSchema, ManagementRuntimeKeyRequestSchema, ManagementRuntimeKeySchema, ManagementScopeRequestSchema, ManagementScopeSchema, ManagementSessionSchema, ManagementTokenRequestSchema, ManagementTokenResponseSchema, MarketplaceSourceSchema, MaterializationPlanSchema, MessagePrioritySchema, MiddlewareActionSchema, MiddlewareConfigSchema, MiddlewareSessionConfigSchema, MiddlewareSessionDataSchema, MigrationStatusSchema, ModelCredentialFingerprintSchema, ModelCredentialLabelSchema, ModelCredentialListSchema, ModelCredentialProviderSchema, ModelCredentialRefusalCodeSchema, ModelCredentialResultSchema, ModelCredentialRevocationSchema, ModelCredentialSchema, MouseEventSchema, NETWORK_ERRORS, NetworkConfigSchema, NetworkContextSchema, NetworkInfoSchema, NetworkTimingSchema, NextMiddlewareOptionsSchema, OAUTH_LOWERCASE_ERRORS, OAuth2ProviderSchema, OAuthConnectionStatusSchema, OAuthModeSchema, OAuthProviderConfigSchema, OAuthProviderMetadataSchema, OAuthProviderTypeSchema, OAuthProvidersMapSchema, OAuthTokensResponseSchema, OS_PATTERNS, OfflineQueueEntrySchema, OrganizationErrorCode, OrganizationIdSchema, OrganizationRoleSchema, OrganizationSettingsSchema, OrganizationSsoModeSchema, OrganizationSsoProviderSchema, OrganizationSsoSettingsSchema, PACKAGE_NAME, PAGINATION_DEFAULTS, PERFORMANCE_THRESHOLDS, PERMISSION_ERRORS, PINNED_SIGNING_VENDORS, PIXEL_ERRORS, PIXEL_EVENT_LIMITS, PLAN_FEATURE_LIMITS, PLAN_RATE_LIMITS, POLICY_ERRORS, POLICY_MATCH_TYPES, PROVIDER_AUTH_TYPES, PageContextSchema, PaginatedResponseSchema, PaginationInfoSchema, PaginationParamsSchema, PaginationResponseSchema, PaginationResponseSchema as PublicPaginationResponseSchema, ParentIntegrationStatusSchema, PatternUpdateRequestSchema, PerformanceRecalculationRequestSchema, PixelAnalyticsSchema, PixelConfigurationSchema, PixelEventSchema, PixelEventTypeSchema, PixelInitSchema, PixelInstallConfigSchema, PixelSchema, PixelSessionSchema, PixelStatsSchema, PixelTrackingRequestSchema, PixelTrackingResponseSchema, PixelUserIdentificationSchema, PixelVerificationStatusSchema, PixelsBulkCreateItemSchema, PixelsBulkDeleteItemSchema, PixelsBulkRegenerateItemSchema, PixelsBulkRequestSchema, PixelsBulkUpdateItemSchema, PixelsQuerySchema, PolicyConditionSchema, PolicyConfigSchema, PolicyEvaluationContextSchema, PolicyEvaluationResultSchema, PolicyFetcher, PolicyMatchTypeSchema, PolicyMetadataSchema, PolicyRuleSchema, PolicyUnavailableError, PostureOriginsSchema, ProjectIdSchema, ProjectIdentitySchema, ProjectSchema, ProjectSettingsSchema, ProjectsBulkCreateItemSchema, ProjectsBulkDeleteItemSchema, ProjectsBulkRequestSchema, ProjectsBulkUpdateItemSchema, ProjectsQuerySchema, ProtocolVersionSchema, ProviderConfigSchema, ProviderDefinitionSchema, ProviderRegistryDefinitionSchema, ProvidersResponseSchema, ProvisionKeyRequestSchema, ProvisionKeyResponseSchema, ProvisioningModeSchema, ProvisioningOrganizationRoleSchema, ProvisioningOrganizationSummarySchema, ProxyInfoSchema, ProxyTypeSchema, PublicAnalyticsBotTypeSchema, PublicAnalyticsSchema, PublicAnalyticsSummarySchema, PublicAnalyticsTimeSeriesPointSchema, PublicApiHeadersSchema, PublicApiQueryParamsSchema, PublicApiResponseSchema, PublicDetectionSchema, PublicKeyConfigSchema, PublicProjectSchema, PublishProfileRequestSchema, QueryFilterSchema, QuerySchema, RATE_LIMIT_ERRORS, READABLE_TEXT, READABLE_TEXT_MESSAGE, REGISTERED_SID_MAX_LENGTH, REPORT_AI_AGENT_NAMES, REPORT_AI_CRAWLER_NAMES, RESOURCE_ERRORS, RULE_CATEGORIES, RULE_ERRORS, RULE_PATHS, RULE_VERSION, RealtimeEventSchema, RealtimeEventTypeSchema, ReasoningStepSchema, ReassignTaskLeadSchema, RecommendationGenerationSchema, RecommendationQuerySchema, ReconciliationDecisionSetSchema, RedirectTargetSchema, RedisSessionDataSchema, RedisStatsSchema, RefreshScopesRequestSchema, RegistryAuthorityStateSchema, ReplaceTaskGrantSchema, ReportedAgentSchema, ReportedDelegationSchema, ReportedIdentitySchema, ReportedPrincipalSchema, RepositoryIdentitySchema, RequestContextSchema, ResourceUsageSchema, ResponseActionSchema, RetryStrategySchema, RevokeModelCredentialSchema, RevokeProvisionQuerySchema, RevokeProvisionResponseSchema, RevokeTaskGrantSchema, RevokeWorkloadEnrollmentSchema, RiskAssessmentSchema, RiskScoreSchema, RiskScoreSourceSchema, RotateModelCredentialSchema, RotateWorkloadEnrollmentSchema, RoutingTypeSchema, RuleLoadOptionsSchema, RuleLoader, RuleMatchResultSchema, RuleMetadataSchema, RuleParser, RuleUpdateEventSchema, RuleValidationResultSchema, RuleValidator, SECURITY_LIMITS, SERVICE_TRAFFIC_KEYS, SESSION_ERRORS, SESSION_LIMITS, SHADOW_NOISY_OR_CONFIDENCE_KEY, SID_ATTRIBUTABLE_RESULT, SLUG_REGEX, SUSPICIOUS_HEADERS, SUSPICIOUS_PATTERNS, ScopeSchema, ScrollEventSchema, SdkSessionDataSchema, SessionConfigSchema, SessionCreateRequestSchema, SessionDataSchema, SessionEventSchema, SessionEventTypeSchema, SessionQueryOptionsSchema, SessionSchema, SessionStateSchema, SessionStorageTypeSchema, SessionTokenPayloadSchema, SessionUpdateRequestSchema, AgentTypeDistributionSchema as SharedAgentTypeDistributionSchema, ConfidenceDistributionSchema as SharedConfidenceDistributionSchema, ShopifyProjectProvisionRequestSchema, ShopifyProjectProvisionResultSchema, ShopifyProjectSettingsUpdateSchema, ShopifySessionClassSchema, ShopifySessionSchema, ShopifySessionsPaginationSchema, ShopifyStatsResponseSchema, ShopifyThreatSchema, SignatureAlgorithmSchema, SignatureRuleSchema, SignatureVerificationRequestSchema, SignatureVerificationResponseSchema, SingleItemResponseSchema, SsoLinkRequestSchema, SsoLinkResponseSchema, StaleReasonSchema, StaleReasonsSchema, StaleVendorRangesError, StartLinearInstallationSchema, StatsResponseSchema, StatsUpdateEventSchema, StrictEnforcementActionSchema, SuggestedActionSchema, SystemStatsSchema, TASK_ADMISSION_PROTOCOLS, TASK_ADMISSION_RESEND, TIME_WINDOWS, TLSFingerprintSchema, TRADITIONAL_BOT_PATTERNS, TRAFFIC_TAXONOMY_BUCKETS, TRUSTED_BOTS, TaskAdmissionProtocolSchema, TaskGrantAdmissionRequestSchema, TaskGrantAdmissionSchema, TaskGrantAllowanceSchema, TaskGrantArgumentsSchema, TaskGrantBindingSchema, TaskGrantEffectiveStatusSchema, TaskGrantHolderListRequestSchema, TaskGrantIssueResultSchema, TaskGrantListSchema, TaskGrantRevocationSchema, TaskGrantSchema, TaskGrantStatusRequestSchema, TaskGrantStatusSchema, TaskGrantStatusValueSchema, TaskGrantViewSchema, TaskLeadAssignmentSchema, TaskLeadPoolSchema, TaskMailboxClaimRequestSchema, TaskMailboxClaimSchema, TaskMailboxProtocolSchema, TaskMailboxResultSchema, TaskMailboxScopeSchema, TaskMailboxSettlementSchema, TaskMailboxStatusRequestSchema, TaskMailboxStatusSchema, TaskModelInvokeSchema, TaskModelMessagesSchema, TaskModelPolicySchema, TaskModelReceiptSchema, TaskModelStatusSchema, TaskModelUsageSchema, TaskProjectionEvidenceSchema, TaskProjectionStateSchema, TaskSourceIntentSchema, TaskSourceProviderConfigSchema, TaskSourceProviderSchema, TaskStandingActionSchema, TaskStandingAdmissionReceiptBaseSchema, TaskStandingAdmissionRequestBaseSchema, TaskStandingAdmissionRequestSchema, TaskStandingAdmissionSchema, TaskStandingCapabilitySchema, TaskStandingLimitsSchema, TaskStandingPolicySchema, TaskStandingReconcileSchema, TaskStatusProjectionListSchema, TaskStatusProjectionSchema, TestDetectionRequestSchema, ThresholdConfigSchema, ToolConsentOverridesSchema, TouchEventSchema, TraceStepSchema, TrackDependencyV2Schema, TrackingReadinessReasonCodeSchema, TrackingReadinessSchema, TransportConfigSchema, TransportMetricsSchema, TransportOptionsSchema, TransportResponseSchema, TransportStateSchema, UNCALIBRATED_NOISY_OR_PRIOR, UNNAMED_AGENT_LABEL, UPDATE_FREQUENCIES, USER_AGENT_PATTERNS, UUID_PATTERN, UpdateApiKeySchema, UpdateBouncerConfigSchema, UpdateOrganizationInputSchema, UpdateOrganizationSchema, UpdatePixelSchema, UpdateProfileRequestSchema, UpdateProjectSchema, UpdateSettingsSchema, UserAgentRuleSchema, UserPlanSchema, UserSchema, VALIDATION_ERRORS, VALIDATION_MODES, VALIDATION_PATTERNS, VERDICT_COOKIE_NAME, VERSION, VerdictEvidenceSchema, VerificationCacheEntrySchema, VerificationProviderSchema, VerificationRequestSchema, VerificationResponseSchema, VerificationTokenSchema, WEBHOOK_LIMITS, WasmAgentNameSchema, WasmConfigSchema, WasmDetectionResultSchema, WasmRequestMetadataSchema, WasmRiskLevel, WasmVerificationMethod, WorkerActionSchema, WorkerCapabilitiesSchema, WorkerConfigSchema, WorkerErrorSchema, WorkerErrorTypeSchema, WorkerHealthStatusSchema, WorkerMessageSchema, WorkerMessageTypeSchema, WorkerMetricsSchema, WorkerPoolConfigSchema, WorkerStateSchema, WorkerTaskSchema, WorkloadEnrollmentChallengeSchema, WorkloadEnrollmentListSchema, WorkloadEnrollmentProofPayloadSchema, WorkloadEnrollmentResultSchema, WorkloadEnrollmentRevocationSchema, WorkloadEnrollmentSchema, WorkloadRotationProofPayloadSchema, acceptsHtml, adminOverviewQuerySchema, approvalQuorumForRequest, assertVendorRangesFresh, assignmentChangeRequestSchema, auditLogQuerySchema, base58btcDecode, base58btcEncode, batchAssignmentRequestSchema, bespokePolicyLabel, blockDelegationVerdict, blockEqualityLiterals, buildChallengeWire, buildDelegationBearerHeader, buildDelegationChallengeBody, buildDelegationChallengeEnvelope, buildDelegationChallengeHeader, buildDelegationInstructions, buildInitialStepsState, buildKnownPatternLookup, buildVerdictEvidence, calculateDeployProgress, callbackSchema, cedarQuotedValueRegExp, changePasswordSchema, classifyAgentTaxonomy, classifyResponseShape, claudeRuntimeLabel, compressIpv6, computeEntropyConfidence, contractDigest, createError, createErrorResponse, createEvaluationContext, createKyaA2AAgentCard, createPaginatedResponse, createPaginatedResponseSchema, createPolicyFetcher, createSuccessResponse, createValidationErrorResponse, decisionPolicyId, decodeDidKeyEd25519, decodeDidKeyP256, decodeEd25519PublicKeyMultibaseTolerant, defaultConfig, deriveConflictId, deriveCorrelationId, deriveDelegationPickupUri, deriveImportIssueId, deriveMcpClientDid, deriveMcpiOrgDid, deriveMcpiOrgKid, deriveMcpiUserDid, deriveVerdict, detectionClassToEnum, discoveredToolSchema, encodeDidKeyEd25519, encodeEd25519PublicKeyMultibase, encodeVerdictCookie, enumToDetectionClass, escapeCedarString, evaluatePolicy, extractCorrelationIdFromHeaders, extractMatch, fetchPolicy, findMatchingPattern, findStaleVendorRanges, forgotPasswordSchema, formatAgentCategory, formatAgentCategoryInline, formatConfidence, formatReasonCodesHeader, fromProviderRegistryFormat, fromProviderRegistryFormatSafe, gatewayConfigInputSchema, gatewayConfigSchema, gatewayConnectedAgentSchema, gatewayConnectionsSummarySchema, gatewayInternalDiscoverErrorSchema, gatewayInternalDiscoverSuccessSchema, gatewayInternalToolsListSchema, gatewayToolCallSchema, generateDelegationSid, generateTestId, getAgentDisplayName, getBotType, getCategoryBadgeVariant, getCategoryColor, getConfidenceLevel, getDefaultPolicyFetcher, getEnvVar, getRateLimitWindow, getRemainingQuota, getStepInfo, getStepOrder, getVerificationMethodDescription, getVerificationReliability, getVerificationRiskLevel, hasClaudeCodeToken, hasClaudeSearchBotToken, hasClaudeUserToken, hasPinnedSigningVendor, initializePolicyFetcher, ipAddressSchema, isAuthorizedLead, isBespokePolicyId, isBlockingAction, isClaudeProductLabel, isForbidBlock, isHighConfidenceVerification, isKnownAgentType, isKnownAiCrawler, isKyaOsHandshakeMethod, isKyaOsWireMethod, isLegacyDetectionClass, isLegitimateCategory, isLimitExceeded, isNonNavigablePolicyId, isPassThroughAction, isPolicyUnavailableError, isPrivateOrReservedHost, isSupportedAuthType, isTraditionalBot, isUnnarrowedDenyBlock, isValidAuthorizationHost, isValidFingerprintResponse, isValidMcpiOrgSlug, isValidWasmDetectionResult, isValidWasmRequestMetadata, lintUnnarrowedDenyRules, loadRulesAsync, mapDetectionToReasonCodes, mapLegacyAuthType, mapToLegacyAuthType, matchPath, mergeWithDefaults, migrateLegacyDetectionClass, modelCredentialFingerprint, nonNavigablePolicyLabel, normalizeAgentName, normalizeChallengeType, normalizeClientIp, normalizeConfidence, normalizeDetectionClass, normalizeDetectionClassEnum, normalizeHandshakeMethod, normalizeOrganizationName, normalizeWireMethod, oauthClientSchema, parseAcceptedArtifactRevision, parseAgentName, parseClaimVerification, parseDependencyBinding, parseEvaluationContext, parseImportIssueV2, parseIpv6, parseJafarFeed, parseMaterializationPlan, parsePolicyConfig, parseRules, partial, passwordSchema, pathHasUnnarrowedDenyRule, pathLiteralsInBlock, permitDelegationVerdict, projectResetRequestSchema, readableText, reconstructConfidenceFromEvidence, refineClaudeDisplayLabel, refineSessionGrainClaudeLabel, requestCarriesDelegationProof, requiredScopesForRequest, resetPasswordSchema, resetPolicyFetcher, resolveAuthorizationHost, resolveBotSignals, resolveChallengeContext, resolveClientIp, resolveTrustedDelegationRoots, riskScoreColumnValue, riskScoreFromMetadata, riskScoreSourceFromMetadata, safeParsePolicyConfig, safeUrl, selectBodyReadable200, serveBodyReadable200, signInSchema, signUpSchema, splitCedarBlocks, strict, supportsClientSide, supportsHeaders, supportsServerEnhanced, taskGrantArgumentsDigest, testPattern, testPatterns, toBareHost, toCoarseReasonKind, toPercent, toProviderRegistryFormat, toStoredCorrelationId, toWasmRequestMetadata, unescapeCedarString, updateStepsState, upstreamDiscoveryErrorSchema, upstreamServerInputSchema, upstreamServerSchema, validModelAdmission, validate, validateClientDetection, validateFingerprintRequest, validateOrThrow, validateOrganizationName, validateProviderConfig, validateProviderDefinition, validateRules, validateRulesLoose, validateStepUpQuorum, vaultResolveDataSchema, vaultResolveErrorSchema, vaultResolveMetaSchema, vaultResolveResponseSchema, vaultResolveSuccessSchema, verifyContractRecordIdentity, verifyEmailSchema, wasmToDetectionResult };
20048
+ export { A2ARpcEnvelopeSchema, A2ASignedRequestSchema, A2ATaskRequestSchema, A2ATaskSourceConfigSchema, A2ATaskStateSchema, ACCEPT_CHALLENGE_HEADER, ADMIN_ACCOUNTS_STATUS_FILTERS, ADMIN_ACCOUNT_STATUSES, ADMIN_DELTA_BASES, ADMIN_ORG_EXCLUSION_REASONS, ADMIN_OVERVIEW_CACHE_STATUSES, ADMIN_OVERVIEW_LIST_LIMIT_DEFAULT, ADMIN_OVERVIEW_LIST_LIMIT_MAX, ADMIN_OVERVIEW_SECTIONS, ADMIN_OVERVIEW_WINDOWS, ADMIN_TRUSTED_METRICS, AGENT_CATEGORY_META, AI_AGENT_HEADERS, ANALYTICS_ERRORS, ANONYMOUS_PRINCIPAL_DID, API_ERRORS, API_ERROR_CODES, API_REQUEST_LIMITS, ATTESTED_BEARER_MAX_TTL_SECONDS, AUDIT_ERRORS, AUDIT_PROTOCOL_ERRORS, AUTHORIZATION_MODES, AUTH_ERRORS, AUTH_ERROR_MESSAGES, AUTH_MODES, AcceptanceWithdrawalSchema, AcceptedArtifactRevisionSchema, AccountSchema, AddFingerprintToProfileRequestSchema, AddModelCredentialSchema, AddUpdateProviderRequestSchema, AdminQueryParamsSchema, AgentCategorySchema, AgentClassificationRequestSchema, AgentClassificationResultSchema, AgentClassificationSchema, AgentInfoSchema, AgentPatternSchema, AgentProfileSchema, AgentShieldConfigSchema, AgentSourceDistributionSchema, AgentStatisticsSchema, AgentTypeDefinitionSchema, AgentTypeSchema, AgentTypeSchema as WasmAgentTypeSchema, AggregationTypeSchema, AllowListEntrySchema, AllowedDomainsSchema, AnalyticsAgentSourcesQuerySchema, AnalyticsAgentTypesQuerySchema, AnalyticsChartDataSchema, AnalyticsDataPointSchema, AnalyticsExportParamsSchema, AnalyticsExportQuerySchema, AnalyticsQuerySchema, AnalyticsRealtimeQuerySchema, AnalyticsSessionsQuerySchema, AnalyticsSessionsResponseSchema, AnalyticsSummarySchema as AnalyticsSessionsSummarySchema, AnalyticsSummarySchema$1 as AnalyticsSummarySchema, AnalyticsTimeSeriesSchema, AnalyticsTimeWindowSchema, ApiKeyPermissionSchema, ApiKeyRateLimitsSchema, ApiKeySchema, ApiKeysBulkCreateItemSchema, ApiKeysBulkRequestSchema, ApiKeysBulkRevokeItemSchema, ApiKeysBulkUpdateItemSchema, ApiKeysQuerySchema, ApiResponseSchema, ApplyIdentityIntentSchema, ApproveTaskPublicationSchema, ApprovedTaskPublicationSchema, ArtifactIdentitySchema, AssuranceTierSchema, AuthErrorType, AuthProviderTypeSchema, BARE_ERRORS, BASELINE_ALLOW_POLICY_ID, BESPOKE_POLICY_IDS, BILLING_ERRORS, BLOCKED_PATH, BOT_USER_AGENT_PATTERNS, BOUNCER_LOWERCASE_ERRORS, BOUNCER_UPPERCASE_ERRORS, BROWSER_PATTERNS, BULK_ERROR_CODES, BaseAuthProviderSchema, BaseBulkRequestSchema, BatchDetectionRequestSchema, BatchDetectionResponseSchema, BatchEventRequestSchema, BatchEventResponseSchema, BatchEventSchema, BatchPixelEventRequestSchema, BehavioralAnalysisSchema, BehavioralDataSchema, BehavioralPatternSchema, BehavioralRulesSchema, BehavioralSignalsSchema, BehavioralThresholdSchema, BindingStatusSchema, BlockEventSchema, BlockReasonSchema, BotPatternSchema, BotTypeSchema, BouncerConfigSchema, BouncerOutcomeSchema, BouncerProofSchema, BrowserInfoSchema, BulkDeletePreviewStatsSchema, BulkDeleteResponseSchema, BulkOperationOptionsSchema, BulkOperationParamsSchema, BulkOperationResultSchema, BulkOperationTypeSchema, BulkResponseSchema, BulkResultItemSchema, ByteBoundedMemo, CACHE_LIMITS, CACHE_TTL, CLI_PAIRING_FRAMEWORKS, CLI_PAIRING_PROTOCOL_VERSION, CLI_PAIRING_UPGRADE_MESSAGE, CLOUD_PROVIDER_RANGES, CONDITION_FIELDS, CONDITION_OPERATORS, CONFIDENCE_THRESHOLDS, CORRELATION_ID_HEADER, CRISPBudgetSchema, CURRENT_POLICY_VERSION, CacheConfigSchema, CachedDetectionDataSchema, ChallengeParamsSchema, ChallengeWireError, CircuitBreakerConfigSchema, CircuitBreakerStateSchema, ClaimVerificationSchema, CliIdentityQuerySchema, CliIdentityServiceSchema, CliIdentitySummarySchema, CliPairingApprovedClaimSchema, CliPairingClaimSchema, CliPairingExchangeDataSchema, CliPairingExchangeRequestSchema, CliPairingPrivateStatusDataSchema, CliPairingProofSchema, CliPairingRegisterDataSchema, CliPairingRegisterRequestSchema, ClickEventSchema, ClientDetectionSchema, CollectFingerprintRequestSchema, CollectFingerprintResponseSchema, CollectedDataSchema, ConditionFieldSchema, ConditionOperatorSchema, ConditionValueSchema, ConfidenceBreakdownSchema, ConfidenceLevelSchema, ConfidenceThresholdSchema, ConfidenceUtils, ConfigureLinearInstallationSchema, ConfigureLinearInstallationV2Schema, ConfigureTaskSourceInstallationSchema, ConfiguredProviderSchema, ConsentAgentMetadataSchema, ConsentBrandingSchema, ConsentCapabilityGroupSchema, ConsentCapabilitySchema, ConsentConfigMetadataSchema, ConsentConfigSchema, ConsentInputCopySchema, ConsentPolicyCapabilitySchema, ConsentPolicyResponseSchema, ConsentPolicyRiskLevelSchema, ConsentScopeLabelsSchema, ConsentSignInCopySchema, ConsentTermsSchema, ConsentUISchema, ConsumedArtifactSchema, CorrelationIdSchema, CreateApiKeySchema, CreateOrganizationInputSchema, CreateOrganizationSchema, CreatePixelSchema, CreateProfileRequestSchema, CreateProjectSchema, CreateProvisioningOrganizationRequestSchema, CreateProvisioningOrganizationResponseSchema, CredentialProviderConfigSchema, CredentialProviderSchema, CustomRuleSchema, DATABASE_LIMITS, DEFAULT_ADMIN_OVERVIEW_WINDOW, DEFAULT_AGENTSHIELD_CONFIG, DEFAULT_AGENT_TYPES, DEFAULT_API_KEY_RATE_LIMITS, DEFAULT_AUTHORIZATION_HOST, DEFAULT_BEHAVIORAL_THRESHOLDS, DEFAULT_CACHE_CONFIG, DEFAULT_CHALLENGE_CONTEXT_TIMEOUT_MS, DEFAULT_CONFIDENCE_THRESHOLDS, DEFAULT_CORS_CONFIG, DEFAULT_DETECTION_OPTIONS, DEFAULT_ENV_VARS, DEFAULT_LOG_CONFIG, DEFAULT_MAX_VENDOR_RANGE_AGE_MS, DEFAULT_PASSWORD_REQUIREMENTS, DEFAULT_PIXEL_CONFIG, DEFAULT_POLICY, DEFAULT_PROJECT_SETTINGS, DEFAULT_RESPONSE_HEADERS, DEFAULT_RETRY_CONFIG, DEFAULT_RULE_PRIORITY, DEFAULT_SESSION_CONFIG, DEFAULT_THRESHOLDS, DEFAULT_TIMEOUTS, DEFAULT_WEBHOOK_EVENTS, DELEGATION_PROOF_HEADERS, DEPLOY_ERRORS, DEPLOY_STEPS, DETECTION_ERRORS, DETECTION_LIMITS, DETECTION_REASON_CODES, DashboardStatsRequestSchema, DatabaseDetectionMetadataSchema, DatabaseStatusSchema, DecisionSchema, DelegationAuditSourceSchema, DelegationAuditSummarySchema, DelegationConstraintSummarySchema, DelegationEffectiveStatusSchema, DelegationExportChannelSchema, DelegationExportRecordSchema, DelegationExposureSchema, DelegationListStatusFilterSchema, DelegationManagementDetailSchema, DelegationManagementItemSchema, DelegationManagementListSchema, DelegationPollingStatusSchema, DelegationResultSchema, DelegationRevokeRequestSchema, DelegationRevokeResponseSchema, DelegationSchema, DelegationStatusSchema, DelegationStoredStatusSchema, DelegationVerifiedBySchema, DeleteAccountSchema, DenyListEntrySchema, DependencyBindingSchema, DeployProgressEventSchema, DeployStepIdSchema, DeployStepStateSchema, DeployStepStatusSchema, DeploymentMetadataSchema, DetectionClassSchema, DetectionDetailSchema, DetectionErrorDetailsSchema, DetectionEventSchema, DetectionInputSchema, DetectionLogSchema, DetectionMetadataSchema, DetectionModeSchema, DetectionOptionsSchema, DetectionReasonCodeSchema, DetectionReasoningSchema, DetectionRequestSchema, DetectionResponseSchema, DetectionResultSchema, DetectionRuleSchema, DetectionRulesSchema, DetectionSignalExposureSchema, DetectionSignalSchema, DetectionStatusSchema, DetectionTestResultSchema, DetectionViewTypeSchema, DidCommTaskSourceBindingSchema, DidCommTaskSourceConfigSchema, DidCommTaskSourceMessageSchema, DiscordTaskSourceConfigSchema, ENFORCEMENT_ACTIONS, ENFORCEMENT_MODES, ENTROPY_CONFIDENCE_CEILING, ENTROPY_CONFIDENCE_FLOOR, ERROR_CATEGORIES, ERROR_CODES, ERROR_MESSAGES, ERROR_STATUS_CODES, EXCLUSION_BUCKETS, EXPORT_LIMITS, EnforcementActionSchema, EnforcementModeSchema, EngineInfoSchema, EnhancedFingerprintResponseSchema, EnrollWorkloadSchema, ErrorResponseSchema, EventConfigSchema, EventStorageRecordSchema, EventTrackingRequestSchema, EventTrackingResponseSchema, ExportAnalyticsSchema, ExpressMiddlewareOptionsSchema, FAIL_CLOSED_BODY, FAIL_CLOSED_HEADERS, FAIL_CLOSED_STATUS, FallbackOptionsSchema, FilterOperatorSchema, FingerprintAnalysisSchema, ClientDetectionSchema$1 as FingerprintClientDetectionSchema, FingerprintDetectRequestSchema, FingerprintRecordSchema, FingerprintResponseSchema, FingerprintSearchQuerySchema, FleetPullRequestReceiptSchema, ForgeabilityRiskSchema, GATEWAY_VAULT_ERRORS, GitHubTaskSourceConfigSchema, GrowthBatchRequestSchema, GrowthConfigurationResetSchema, GrowthConfigurationThresholdsSchema, GrowthConfigurationUpdateSchema, GrowthOpportunitiesQuerySchema, GrowthOpportunityUpdateSchema, HEADER_PATTERNS, HTTP_STATUS, HeaderRuleSchema, HeaderRulesSchema, HealthResponseSchema, HomeRailRollupsRequestSchema, INSTALLATION_KINDS, INSTALLATION_TYPES, INTERNAL_ERRORS, IdentityIntentActionSchema, IdentityIntentRequestSchema, IdentityIntentSchema, IdentityIntentStateSchema, IdentityObservationSchema, ImmutableArtifactLocatorSchema, ImportIssueV2Schema, InstructPayloadSchema, IntegrationTypeSchema, InternalProcessingFlagsSchema, IpRangeCollectionSchema, IpRangeRuleSchema, IssueTaskGrantSchema, JafarParseError, KNOWN_AGENT_PATTERNS, KYAOS_PROTOCOL_ERRORS, KYA_A2A_EXTENSION, KYA_HTTP_ERROR, KYA_HTTP_ERROR_STATUS, KYA_OS_HANDSHAKE_METHODS, KYA_OS_WIRE_METHODS, KeyboardEventSchema, LOWERCASE_ERRORS, LinearActivityGateSchema, LinearActivityObservationSummarySchema, LinearInstallationAuthorizationSchema, LinearInstallationProviderStatusSchema, LinearInstallationStatusReasonSchema, LinearInstallationStatusSchema, LinearInstallationWorkflowSchema, LinearObsoleteActivityListSchema, LinearObsoleteActivitySchema, ListProvisioningOrganizationsRequestSchema, ListProvisioningOrganizationsResponseSchema, LoggingConfigSchema, MANAGEMENT_ACCESS_PREFIX, MANAGEMENT_AUDIENCE, MANAGEMENT_CLIENT_ID, MANAGEMENT_CONSENT_MAX_ORGANIZATIONS, MANAGEMENT_CONSENT_MAX_PROJECTS, MANAGEMENT_DEVICE_INTERVAL, MANAGEMENT_REFRESH_PREFIX, MANAGEMENT_USER_CODE_ALPHABET, MATCH_ACTIONS, MAX_ALLOWED_DOMAINS, MAX_ALLOWED_DOMAIN_LENGTH, MAX_BULK_BATCH_SIZE, MAX_ED25519_KEY_BODY_LENGTH, MAX_REASON_CODES_HEADER_BYTES, MAX_REASON_CODES_ON_WIRE, MAX_TASK_GRANT_DAYS, MAX_TASK_GRANT_DEPTH, MCPI_ORG_DID_HOST, MCP_CLIENT_DID_HOST, MOBILE_PATTERNS, ManagementAccessTokenSchema, ManagementAuthorizeQuerySchema, ManagementConsentContextSchema, ManagementConsentSchema, ManagementDeviceDescriptionSchema, ManagementDeviceRequestSchema, ManagementDeviceResponseSchema, ManagementDomainErrorSchema, ManagementErrorCodeSchema, ManagementErrorReasonSchema, ManagementErrorSchema, ManagementLoopbackRedirectSchema, ManagementPostureJwkSchema, ManagementPostureOriginsRequestSchema, ManagementPostureSchema, ManagementPrincipalSchema, ManagementProfileSchema, ManagementProjectNameSchema, ManagementProjectsSchema, ManagementRefreshTokenSchema, ManagementRevokeRequestSchema, ManagementRuntimeKeyPurposeSchema, ManagementRuntimeKeyRequestSchema, ManagementRuntimeKeySchema, ManagementScopeRequestSchema, ManagementScopeSchema, ManagementSessionSchema, ManagementTokenRequestSchema, ManagementTokenResponseSchema, MarketplaceSourceSchema, MaterializationPlanSchema, MessagePrioritySchema, MiddlewareActionSchema, MiddlewareConfigSchema, MiddlewareSessionConfigSchema, MiddlewareSessionDataSchema, MigrationStatusSchema, ModelCredentialFingerprintSchema, ModelCredentialLabelSchema, ModelCredentialListSchema, ModelCredentialProviderSchema, ModelCredentialRefusalCodeSchema, ModelCredentialResultSchema, ModelCredentialRevocationSchema, ModelCredentialSchema, MouseEventSchema, NETWORK_ERRORS, NO_EVIDENCE_CATEGORY, NO_EVIDENCE_EQUALITY_TERM, NO_EVIDENCE_EXCLUSION_TERM, NetworkConfigSchema, NetworkContextSchema, NetworkInfoSchema, NetworkTimingSchema, NextMiddlewareOptionsSchema, OAUTH_LOWERCASE_ERRORS, OAuth2ProviderSchema, OAuthConnectionStatusSchema, OAuthModeSchema, OAuthProviderConfigSchema, OAuthProviderMetadataSchema, OAuthProviderTypeSchema, OAuthProvidersMapSchema, OAuthTokensResponseSchema, OS_PATTERNS, OfflineQueueEntrySchema, OrganizationErrorCode, OrganizationIdSchema, OrganizationRoleSchema, OrganizationSettingsSchema, OrganizationSsoModeSchema, OrganizationSsoProviderSchema, OrganizationSsoSettingsSchema, PACKAGE_NAME, PAGINATION_DEFAULTS, PERFORMANCE_THRESHOLDS, PERMISSION_ERRORS, PINNED_SIGNING_VENDORS, PIXEL_ERRORS, PIXEL_EVENT_LIMITS, PLAN_FEATURE_LIMITS, PLAN_RATE_LIMITS, POLICY_ERRORS, POLICY_MATCH_TYPES, PROVIDER_AUTH_TYPES, PageContextSchema, PaginatedResponseSchema, PaginationInfoSchema, PaginationParamsSchema, PaginationResponseSchema, PaginationResponseSchema as PublicPaginationResponseSchema, ParentIntegrationStatusSchema, PatternUpdateRequestSchema, PerformanceRecalculationRequestSchema, PixelAnalyticsSchema, PixelConfigurationSchema, PixelEventSchema, PixelEventTypeSchema, PixelInitSchema, PixelInstallConfigSchema, PixelSchema, PixelSessionSchema, PixelStatsSchema, PixelTrackingRequestSchema, PixelTrackingResponseSchema, PixelUserIdentificationSchema, PixelVerificationStatusSchema, PixelsBulkCreateItemSchema, PixelsBulkDeleteItemSchema, PixelsBulkRegenerateItemSchema, PixelsBulkRequestSchema, PixelsBulkUpdateItemSchema, PixelsQuerySchema, PolicyConditionSchema, PolicyConfigSchema, PolicyEvaluationContextSchema, PolicyEvaluationResultSchema, PolicyFetcher, PolicyMatchTypeSchema, PolicyMetadataSchema, PolicyRuleSchema, PolicyUnavailableError, PostureOriginsSchema, ProjectIdSchema, ProjectIdentitySchema, ProjectSchema, ProjectSettingsSchema, ProjectsBulkCreateItemSchema, ProjectsBulkDeleteItemSchema, ProjectsBulkRequestSchema, ProjectsBulkUpdateItemSchema, ProjectsQuerySchema, ProtocolVersionSchema, ProviderConfigSchema, ProviderDefinitionSchema, ProviderRegistryDefinitionSchema, ProvidersResponseSchema, ProvisionKeyRequestSchema, ProvisionKeyResponseSchema, ProvisioningAccountLinkRequestSchema, ProvisioningAccountLinkResponseSchema, ProvisioningIdentityProofSchema, ProvisioningModeSchema, ProvisioningOrganizationRoleSchema, ProvisioningOrganizationSummarySchema, ProxyAssertionSchema, ProxyCollectionStateSchema, ProxyInfoSchema, ProxyTypeSchema, PublicAnalyticsBotTypeSchema, PublicAnalyticsSchema, PublicAnalyticsSummarySchema, PublicAnalyticsTimeSeriesPointSchema, PublicApiHeadersSchema, PublicApiQueryParamsSchema, PublicApiResponseSchema, PublicDetectionSchema, PublicKeyConfigSchema, PublicProjectSchema, PublishProfileRequestSchema, QueryFilterSchema, QuerySchema, RATE_LIMIT_ERRORS, READABLE_TEXT, READABLE_TEXT_MESSAGE, REGISTERED_SID_MAX_LENGTH, REPORT_AI_AGENT_NAMES, REPORT_AI_CRAWLER_NAMES, RESOURCE_ERRORS, RULE_CATEGORIES, RULE_ERRORS, RULE_PATHS, RULE_VERSION, RealtimeEventSchema, RealtimeEventTypeSchema, ReasoningStepSchema, ReassignTaskLeadSchema, RecommendationGenerationSchema, RecommendationQuerySchema, ReconciliationDecisionSetSchema, RedirectTargetSchema, RedisSessionDataSchema, RedisStatsSchema, RefreshScopesRequestSchema, RegistryAuthorityStateSchema, ReplaceTaskGrantSchema, ReportedAgentSchema, ReportedDelegationSchema, ReportedIdentitySchema, ReportedPrincipalSchema, RepositoryIdentitySchema, RequestContextSchema, ResourceUsageSchema, ResponseActionSchema, RetryStrategySchema, RevokeModelCredentialSchema, RevokeProvisionQuerySchema, RevokeProvisionResponseSchema, RevokeTaskGrantSchema, RevokeWorkloadEnrollmentSchema, RiskAssessmentSchema, RiskScoreSchema, RiskScoreSourceSchema, RotateModelCredentialSchema, RotateWorkloadEnrollmentSchema, RoutingTypeSchema, RuleLoadOptionsSchema, RuleLoader, RuleMatchResultSchema, RuleMetadataSchema, RuleParser, RuleUpdateEventSchema, RuleValidationResultSchema, RuleValidator, SECURITY_LIMITS, SERVICE_TRAFFIC_KEYS, SESSION_ERRORS, SESSION_LIMITS, SHADOW_NOISY_OR_CONFIDENCE_KEY, SID_ATTRIBUTABLE_RESULT, SLUG_REGEX, SUSPICIOUS_HEADERS, SUSPICIOUS_PATTERNS, ScopeSchema, ScrollEventSchema, SdkSessionDataSchema, SessionConfigSchema, SessionCreateRequestSchema, SessionDataSchema, SessionEventSchema, SessionEventTypeSchema, SessionQueryOptionsSchema, SessionSchema, SessionStateSchema, SessionStorageTypeSchema, SessionTokenPayloadSchema, SessionUpdateRequestSchema, AgentTypeDistributionSchema as SharedAgentTypeDistributionSchema, ConfidenceDistributionSchema as SharedConfidenceDistributionSchema, ShopifyProjectProvisionRequestSchema, ShopifyProjectProvisionResultSchema, ShopifyProjectSettingsUpdateSchema, ShopifySessionClassSchema, ShopifySessionSchema, ShopifySessionsPaginationSchema, ShopifyStatsResponseSchema, ShopifyThreatSchema, SignatureAlgorithmSchema, SignatureRuleSchema, SignatureVerificationRequestSchema, SignatureVerificationResponseSchema, SingleItemResponseSchema, SsoLinkRequestSchema, SsoLinkResponseSchema, StaleReasonSchema, StaleReasonsSchema, StaleVendorRangesError, StartLinearInstallationSchema, StatsResponseSchema, StatsUpdateEventSchema, StrictEnforcementActionSchema, SuggestedActionSchema, SystemStatsSchema, TASK_ADMISSION_PROTOCOLS, TASK_ADMISSION_RESEND, TIME_WINDOWS, TLSFingerprintSchema, TRADITIONAL_BOT_PATTERNS, TRAFFIC_TAXONOMY_BUCKETS, TRUSTED_BOTS, TaskAdmissionProtocolSchema, TaskGrantAdmissionRequestSchema, TaskGrantAdmissionSchema, TaskGrantAllowanceSchema, TaskGrantArgumentsSchema, TaskGrantBindingSchema, TaskGrantEffectiveStatusSchema, TaskGrantHolderListRequestSchema, TaskGrantIssueResultSchema, TaskGrantListSchema, TaskGrantRevocationSchema, TaskGrantSchema, TaskGrantStatusRequestSchema, TaskGrantStatusSchema, TaskGrantStatusValueSchema, TaskGrantViewSchema, TaskLeadAssignmentSchema, TaskLeadPoolSchema, TaskMailboxClaimRequestSchema, TaskMailboxClaimSchema, TaskMailboxProtocolSchema, TaskMailboxResultSchema, TaskMailboxScopeSchema, TaskMailboxSettlementSchema, TaskMailboxStatusRequestSchema, TaskMailboxStatusSchema, TaskModelInvokeSchema, TaskModelMessagesSchema, TaskModelPolicySchema, TaskModelReceiptSchema, TaskModelStatusSchema, TaskModelUsageSchema, TaskProjectionEvidenceSchema, TaskProjectionStateSchema, TaskSourceIntentSchema, TaskSourceProviderConfigSchema, TaskSourceProviderSchema, TaskStandingActionSchema, TaskStandingAdmissionReceiptBaseSchema, TaskStandingAdmissionRequestBaseSchema, TaskStandingAdmissionRequestSchema, TaskStandingAdmissionSchema, TaskStandingCapabilitySchema, TaskStandingLimitsSchema, TaskStandingPolicySchema, TaskStandingReconcileSchema, TaskStatusProjectionListSchema, TaskStatusProjectionSchema, TestDetectionRequestSchema, ThresholdConfigSchema, ToolConsentOverridesSchema, TouchEventSchema, TraceStepSchema, TrackDependencyV2Schema, TrackingReadinessReasonCodeSchema, TrackingReadinessSchema, TransportConfigSchema, TransportMetricsSchema, TransportOptionsSchema, TransportResponseSchema, TransportStateSchema, UNCALIBRATED_NOISY_OR_PRIOR, UNNAMED_AGENT_LABEL, UPDATE_FREQUENCIES, USER_AGENT_PATTERNS, UUID_PATTERN, UpdateApiKeySchema, UpdateBouncerConfigSchema, UpdateOrganizationInputSchema, UpdateOrganizationSchema, UpdatePixelSchema, UpdateProfileRequestSchema, UpdateProjectSchema, UpdateSettingsSchema, UserAgentRuleSchema, UserPlanSchema, UserSchema, VALIDATION_ERRORS, VALIDATION_MODES, VALIDATION_PATTERNS, VAULT_ERRORS, VERDICT_COOKIE_NAME, VERSION, VerdictEvidenceSchema, VerificationCacheEntrySchema, VerificationProviderSchema, VerificationRequestSchema, VerificationResponseSchema, VerificationTokenSchema, WEBHOOK_LIMITS, WasmAgentNameSchema, WasmConfigSchema, WasmDetectionResultSchema, WasmRequestMetadataSchema, WasmRiskLevel, WasmVerificationMethod, WorkerActionSchema, WorkerCapabilitiesSchema, WorkerConfigSchema, WorkerErrorSchema, WorkerErrorTypeSchema, WorkerHealthStatusSchema, WorkerMessageSchema, WorkerMessageTypeSchema, WorkerMetricsSchema, WorkerPoolConfigSchema, WorkerStateSchema, WorkerTaskSchema, WorkloadEnrollmentChallengeSchema, WorkloadEnrollmentListSchema, WorkloadEnrollmentProofPayloadSchema, WorkloadEnrollmentResultSchema, WorkloadEnrollmentRevocationSchema, WorkloadEnrollmentSchema, WorkloadRotationProofPayloadSchema, acceptsHtml, adminAccountsQuerySchema, adminOverviewQuerySchema, analyzePolicySource, approvalQuorumForRequest, assertVendorRangesFresh, assignmentChangeRequestSchema, auditLogQuerySchema, base58btcDecode, base58btcEncode, batchAssignmentRequestSchema, bespokePolicyLabel, blockDelegationVerdict, blockEqualityLiterals, buildChallengeWire, buildDelegationBearerHeader, buildDelegationChallengeBody, buildDelegationChallengeEnvelope, buildDelegationChallengeHeader, buildDelegationInstructions, buildInitialStepsState, buildKnownPatternLookup, buildVerdictEvidence, calculateDeployProgress, callbackSchema, cedarQuotedValueRegExp, changePasswordSchema, classifyAgentTaxonomy, classifyResponseShape, claudeRuntimeLabel, compressIpv6, computeEntropyConfidence, contractDigest, createError, createErrorResponse, createEvaluationContext, createKyaA2AAgentCard, createPaginatedResponse, createPaginatedResponseSchema, createPolicyFetcher, createSuccessResponse, createValidationErrorResponse, decisionPolicyId, decodeDidKeyEd25519, decodeDidKeyP256, decodeEd25519PublicKeyMultibaseTolerant, defaultConfig, deriveConflictId, deriveCorrelationId, deriveDelegationPickupUri, deriveImportIssueId, deriveMcpClientDid, deriveMcpiOrgDid, deriveMcpiOrgKid, deriveMcpiUserDid, deriveVerdict, detectionClassToEnum, discoveredToolSchema, encodeDidKeyEd25519, encodeEd25519PublicKeyMultibase, encodeVerdictCookie, enumToDetectionClass, escapeCedarString, evaluatePolicy, extractCorrelationIdFromHeaders, extractMatch, fetchPolicy, findMatchingPattern, findStaleVendorRanges, forgotPasswordSchema, formatAgentCategory, formatAgentCategoryInline, formatConfidence, formatReasonCodesHeader, fromProviderRegistryFormat, fromProviderRegistryFormatSafe, gatewayConfigInputSchema, gatewayConfigSchema, gatewayConnectedAgentSchema, gatewayConnectionsSummarySchema, gatewayInternalDiscoverErrorSchema, gatewayInternalDiscoverSuccessSchema, gatewayInternalToolsListSchema, gatewayToolCallSchema, generateDelegationSid, generateTestId, getAgentDisplayName, getBotType, getCategoryBadgeVariant, getCategoryColor, getConfidenceLevel, getDefaultPolicyFetcher, getEnvVar, getRateLimitWindow, getRemainingQuota, getStepInfo, getStepOrder, getVerificationMethodDescription, getVerificationReliability, getVerificationRiskLevel, hasClaudeCodeToken, hasClaudeSearchBotToken, hasClaudeUserToken, hasPinnedSigningVendor, hostMatchesAllowedDomains, initializePolicyFetcher, ipAddressSchema, isAuthorizedLead, isBespokePolicyId, isBlockingAction, isClaudeProductLabel, isEngineEnforcing, isForbidBlock, isHighConfidenceVerification, isKnownAgentType, isKnownAiCrawler, isKyaOsHandshakeMethod, isKyaOsWireMethod, isLegacyDetectionClass, isLegitimateCategory, isLimitExceeded, isNonNavigablePolicyId, isPassThroughAction, isPolicyUnavailableError, isPrivateOrReservedHost, isSupportedAuthType, isTraditionalBot, isUnnarrowedDenyBlock, isValidAuthorizationHost, isValidFingerprintResponse, isValidMcpiOrgSlug, isValidWasmDetectionResult, isValidWasmRequestMetadata, lintMissingBaselinePermit, lintUnnarrowedDenyRules, loadRulesAsync, mapDetectionToReasonCodes, mapLegacyAuthType, mapProxyAssertions, mapToLegacyAuthType, matchPath, mergeWithDefaults, migrateLegacyDetectionClass, modelCredentialFingerprint, nonNavigablePolicyLabel, normalizeAgentName, normalizeAllowedDomainForWrite, normalizeAllowedDomainList, normalizeChallengeType, normalizeClientIp, normalizeConfidence, normalizeDetectionClass, normalizeDetectionClassEnum, normalizeHandshakeMethod, normalizeOrganizationName, normalizeStoredAllowedDomain, normalizeWireMethod, oauthClientSchema, parseAcceptedArtifactRevision, parseAgentName, parseCedarStatements, parseClaimVerification, parseDependencyBinding, parseEvaluationContext, parseImportIssueV2, parseIpv6, parseJafarFeed, parseMaterializationPlan, parsePolicyConfig, parseRules, partial, passwordSchema, pathHasExplicitDenyRuleFor, pathHasUnnarrowedDenyRule, pathHasUnnarrowedDenyRuleFor, pathLiteralsInBlock, permitDelegationVerdict, projectResetRequestSchema, readableText, reconstructConfidenceFromEvidence, refineClaudeDisplayLabel, refineSessionGrainClaudeLabel, requestCarriesDelegationProof, requestPresentedCredential, requiredScopesForRequest, resetPasswordSchema, resetPolicyFetcher, resolveAuthorizationHost, resolveBotSignals, resolveChallengeContext, resolveClientIp, resolveTrustedDelegationRoots, riskScoreColumnValue, riskScoreFromMetadata, riskScoreSourceFromMetadata, safeParsePolicyConfig, safeUrl, selectBodyReadable200, serveBodyReadable200, signInSchema, signUpSchema, splitCedarBlocks, statementApplies, statementId, strict, supportsClientSide, supportsHeaders, supportsServerEnhanced, taskGrantArgumentsDigest, testPattern, testPatterns, toBareHost, toCoarseReasonKind, toPercent, toProviderRegistryFormat, toStoredCorrelationId, toWasmRequestMetadata, unescapeCedarString, updateStepsState, upstreamDiscoveryErrorSchema, upstreamServerInputSchema, upstreamServerSchema, validModelAdmission, validate, validateClientDetection, validateFingerprintRequest, validateOrThrow, validateOrganizationName, validateProviderConfig, validateProviderDefinition, validateRules, validateRulesLoose, validateStepUpQuorum, vaultResolveDataSchema, vaultResolveErrorSchema, vaultResolveMetaSchema, vaultResolveResponseSchema, vaultResolveSuccessSchema, verifyContractRecordIdentity, verifyEmailSchema, wasmToDetectionResult, withNoEvidenceExclusion };
18303
20049
  //# sourceMappingURL=index.mjs.map