@kya-os/mcp-i-cloudflare 1.13.6 → 1.14.2

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 (111) hide show
  1. package/dist/agent.d.ts.map +1 -1
  2. package/dist/agent.js +23 -5
  3. package/dist/agent.js.map +1 -1
  4. package/dist/audit/deployment-binding.d.ts +54 -54
  5. package/dist/config.d.ts +4 -0
  6. package/dist/config.d.ts.map +1 -1
  7. package/dist/config.js +2 -0
  8. package/dist/config.js.map +1 -1
  9. package/dist/delegation-http/anchor-do.d.ts.map +1 -1
  10. package/dist/delegation-http/anchor-do.js +108 -10
  11. package/dist/delegation-http/anchor-do.js.map +1 -1
  12. package/dist/delegation-http/anchor-registration-validate.d.ts +4 -0
  13. package/dist/delegation-http/anchor-registration-validate.d.ts.map +1 -1
  14. package/dist/delegation-http/anchor-registration-validate.js +9 -0
  15. package/dist/delegation-http/anchor-registration-validate.js.map +1 -1
  16. package/dist/delegation-http/anchor-registration.d.ts.map +1 -1
  17. package/dist/delegation-http/anchor-registration.js +119 -29
  18. package/dist/delegation-http/anchor-registration.js.map +1 -1
  19. package/dist/delegation-http/bearer-retry.d.ts +6 -14
  20. package/dist/delegation-http/bearer-retry.d.ts.map +1 -1
  21. package/dist/delegation-http/bearer-retry.js +37 -73
  22. package/dist/delegation-http/bearer-retry.js.map +1 -1
  23. package/dist/delegation-http/challenge.d.ts +20 -4
  24. package/dist/delegation-http/challenge.d.ts.map +1 -1
  25. package/dist/delegation-http/challenge.js +58 -8
  26. package/dist/delegation-http/challenge.js.map +1 -1
  27. package/dist/delegation-http/consent-anchor-bridge.d.ts +5 -8
  28. package/dist/delegation-http/consent-anchor-bridge.d.ts.map +1 -1
  29. package/dist/delegation-http/consent-anchor-bridge.js +236 -40
  30. package/dist/delegation-http/consent-anchor-bridge.js.map +1 -1
  31. package/dist/delegation-http/constants.d.ts +2 -0
  32. package/dist/delegation-http/constants.d.ts.map +1 -1
  33. package/dist/delegation-http/constants.js +2 -0
  34. package/dist/delegation-http/constants.js.map +1 -1
  35. package/dist/delegation-http/credential-consent.d.ts +3 -1
  36. package/dist/delegation-http/credential-consent.d.ts.map +1 -1
  37. package/dist/delegation-http/credential-consent.js +11 -1
  38. package/dist/delegation-http/credential-consent.js.map +1 -1
  39. package/dist/delegation-http/native-capabilities.d.ts +4 -0
  40. package/dist/delegation-http/native-capabilities.d.ts.map +1 -0
  41. package/dist/delegation-http/native-capabilities.js +53 -0
  42. package/dist/delegation-http/native-capabilities.js.map +1 -0
  43. package/dist/delegation-http/native-fetch.d.ts +3 -0
  44. package/dist/delegation-http/native-fetch.d.ts.map +1 -0
  45. package/dist/delegation-http/native-fetch.js +13 -0
  46. package/dist/delegation-http/native-fetch.js.map +1 -0
  47. package/dist/delegation-http/native-http.d.ts +102 -0
  48. package/dist/delegation-http/native-http.d.ts.map +1 -0
  49. package/dist/delegation-http/native-http.js +191 -0
  50. package/dist/delegation-http/native-http.js.map +1 -0
  51. package/dist/delegation-http/native-oauth.d.ts +26 -0
  52. package/dist/delegation-http/native-oauth.d.ts.map +1 -0
  53. package/dist/delegation-http/native-oauth.js +369 -0
  54. package/dist/delegation-http/native-oauth.js.map +1 -0
  55. package/dist/delegation-http/native-pickup.d.ts +20 -0
  56. package/dist/delegation-http/native-pickup.d.ts.map +1 -0
  57. package/dist/delegation-http/native-pickup.js +227 -0
  58. package/dist/delegation-http/native-pickup.js.map +1 -0
  59. package/dist/delegation-http/pickup-routes.d.ts +1 -0
  60. package/dist/delegation-http/pickup-routes.d.ts.map +1 -1
  61. package/dist/delegation-http/pickup-routes.js +55 -1
  62. package/dist/delegation-http/pickup-routes.js.map +1 -1
  63. package/dist/delegation-http/register.d.ts.map +1 -1
  64. package/dist/delegation-http/register.js +4 -7
  65. package/dist/delegation-http/register.js.map +1 -1
  66. package/dist/delegation-http/remote-issuer.d.ts +37 -0
  67. package/dist/delegation-http/remote-issuer.d.ts.map +1 -0
  68. package/dist/delegation-http/remote-issuer.js +289 -0
  69. package/dist/delegation-http/remote-issuer.js.map +1 -0
  70. package/dist/delegation-http/sid.d.ts +5 -2
  71. package/dist/delegation-http/sid.d.ts.map +1 -1
  72. package/dist/delegation-http/sid.js +8 -2
  73. package/dist/delegation-http/sid.js.map +1 -1
  74. package/dist/delegation-http/types.d.ts +31 -0
  75. package/dist/delegation-http/types.d.ts.map +1 -1
  76. package/dist/delegation-http/well-known-capability.d.ts.map +1 -1
  77. package/dist/delegation-http/well-known-capability.js +5 -0
  78. package/dist/delegation-http/well-known-capability.js.map +1 -1
  79. package/dist/helpers/env-mapper.d.ts.map +1 -1
  80. package/dist/helpers/env-mapper.js +4 -0
  81. package/dist/helpers/env-mapper.js.map +1 -1
  82. package/dist/index.d.ts +4 -0
  83. package/dist/index.d.ts.map +1 -1
  84. package/dist/index.js +2 -0
  85. package/dist/index.js.map +1 -1
  86. package/dist/proof-generator.d.ts +2 -0
  87. package/dist/proof-generator.d.ts.map +1 -1
  88. package/dist/proof-generator.js +1 -0
  89. package/dist/proof-generator.js.map +1 -1
  90. package/dist/runtime/oauth-handler.d.ts.map +1 -1
  91. package/dist/runtime/oauth-handler.js +44 -1
  92. package/dist/runtime/oauth-handler.js.map +1 -1
  93. package/dist/security/mcp-admission.d.ts +43 -0
  94. package/dist/security/mcp-admission.d.ts.map +1 -0
  95. package/dist/security/mcp-admission.js +165 -0
  96. package/dist/security/mcp-admission.js.map +1 -0
  97. package/dist/security/mcp-holder-admission.d.ts +19 -0
  98. package/dist/security/mcp-holder-admission.d.ts.map +1 -0
  99. package/dist/security/mcp-holder-admission.js +52 -0
  100. package/dist/security/mcp-holder-admission.js.map +1 -0
  101. package/dist/security/presented-delegation.d.ts +13 -0
  102. package/dist/security/presented-delegation.d.ts.map +1 -0
  103. package/dist/security/presented-delegation.js +73 -0
  104. package/dist/security/presented-delegation.js.map +1 -0
  105. package/dist/services/consent.service.d.ts +10 -0
  106. package/dist/services/consent.service.d.ts.map +1 -1
  107. package/dist/services/consent.service.js +15 -3
  108. package/dist/services/consent.service.js.map +1 -1
  109. package/dist/types.d.ts +4 -0
  110. package/dist/types.d.ts.map +1 -1
  111. package/package.json +3 -3
@@ -33,9 +33,22 @@ export declare function buildConsentUri(i: ChallengeVerdictInput): string;
33
33
  /** The pickup endpoint URL on the worker's authorization host: `…/api/delegation/pickup/<sid>`. */
34
34
  export declare function buildPickupUri(i: ChallengeVerdictInput): string;
35
35
  /**
36
- * Build the human-facing `instructions` string (§8.1). Carries the four REQUIRED
37
- * elements: (1) consent-uri relay, (2) pickup-uri + interval, (3) pinning
38
- * requirement, (4) retry presentation. Byte-exact vs the fixture given its inputs.
36
+ * Build the human-facing `instructions` string (§8.1), gated on the host's
37
+ * declared pickup profile (`ChallengeVerdictInput.pickupProfile`).
38
+ *
39
+ * DEFAULT (no profile): the reviewed token-first choreography — generate an
40
+ * unpadded-base64url 32-byte token, establish the binding with it, relay the
41
+ * consent link after 202 pending, poll with the SAME token, retry as plain
42
+ * Bearer. No did:key polls and no signed retries: this runtime's pickup
43
+ * surface treats signature-only polls as no-identity polls, and its mint
44
+ * does not `cnf`-bind the delegation to a pickup key, so those directives
45
+ * would dead-end a compliant agent (signed poll never binds; signed retry of
46
+ * a non-holder-bound VC is refused as `kyaos/holder-mismatch`).
47
+ *
48
+ * The explicit pickupProfile opt-in retains the reviewed binding-first legacy
49
+ * envelope for hosts that support signed pickup. It does not make that legacy
50
+ * credential holder-bound. Strict native challenges and their mandatory fresh
51
+ * retry proofs are emitted by native-http.ts from the registered native contract.
39
52
  */
40
53
  export declare function buildInstructions(i: ChallengeVerdictInput): string;
41
54
  /**
@@ -46,7 +59,10 @@ export declare function buildChallengeBody(i: ChallengeVerdictInput, challengePr
46
59
  /**
47
60
  * Build the full §8.1 401 `Response`: dual `WWW-Authenticate` challenges (Delegation
48
61
  * first, then Bearer), `Retry-After`, JSON content type, and `Cache-Control:
49
- * no-store`.
62
+ * no-store`. Under the native profile the unsigned consent hint headers
63
+ * (`KYA-Auth-Required`/`KYA-Auth-Url`/`Link`/`KYA-Action`) are mirrored from the
64
+ * fetcher-200 envelope so header-only surfaces see the consent target on the 401
65
+ * too; the default legacy envelope stays 1.13.6-shaped.
50
66
  */
51
67
  export declare function buildChallengeResponse(i: ChallengeVerdictInput, challengeProof: string): Response;
52
68
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"challenge.d.ts","sourceRoot":"","sources":["../../src/delegation-http/challenge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,oBAAoB,CAAC;AAUnE;;;;;GAKG;AACH,wBAAgB,8BAA8B,CAC5C,CAAC,EAAE,qBAAqB,GACvB,MAAM,CAqBR;AAED;;;GAGG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAEhE;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAE/D;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,qBAAqB,GAAG,MAAM,CAUlE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,CAAC,EAAE,qBAAqB,EACxB,cAAc,EAAE,MAAM,GACrB,MAAM,CAkBR;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,CAAC,EAAE,qBAAqB,EACxB,cAAc,EAAE,MAAM,GACrB,QAAQ,CAYV;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,6BAA6B,CAC3C,CAAC,EAAE,qBAAqB,EACxB,cAAc,EAAE,MAAM,GACrB,QAAQ,CAcV;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CACtC,GAAG,EAA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,OAAO,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,eAAe,EAAE,MAAM,EAAE,CAAA;CAAE,GACvE,OAAO,CAAC,MAAM,CAAC,CAmBjB"}
@@ -60,17 +60,37 @@ export function buildPickupUri(i) {
60
60
  return `https://${i.authorizationHost}/api/delegation/pickup/${i.sid}`;
61
61
  }
62
62
  /**
63
- * Build the human-facing `instructions` string (§8.1). Carries the four REQUIRED
64
- * elements: (1) consent-uri relay, (2) pickup-uri + interval, (3) pinning
65
- * requirement, (4) retry presentation. Byte-exact vs the fixture given its inputs.
63
+ * Build the human-facing `instructions` string (§8.1), gated on the host's
64
+ * declared pickup profile (`ChallengeVerdictInput.pickupProfile`).
65
+ *
66
+ * DEFAULT (no profile): the reviewed token-first choreography — generate an
67
+ * unpadded-base64url 32-byte token, establish the binding with it, relay the
68
+ * consent link after 202 pending, poll with the SAME token, retry as plain
69
+ * Bearer. No did:key polls and no signed retries: this runtime's pickup
70
+ * surface treats signature-only polls as no-identity polls, and its mint
71
+ * does not `cnf`-bind the delegation to a pickup key, so those directives
72
+ * would dead-end a compliant agent (signed poll never binds; signed retry of
73
+ * a non-holder-bound VC is refused as `kyaos/holder-mismatch`).
74
+ *
75
+ * The explicit pickupProfile opt-in retains the reviewed binding-first legacy
76
+ * envelope for hosts that support signed pickup. It does not make that legacy
77
+ * credential holder-bound. Strict native challenges and their mandatory fresh
78
+ * retry proofs are emitted by native-http.ts from the registered native contract.
66
79
  */
67
80
  export function buildInstructions(i) {
68
81
  const consentUri = buildConsentUri(i);
69
82
  const pickupUri = buildPickupUri(i);
70
- return (`This action requires human authorization. Show your user this link and ask them to approve: ${consentUri}. ` +
71
- `Then poll ${pickupUri} every ${i.pollIntervalS} seconds. ` +
72
- `If you can sign HTTP requests, sign each poll with an ephemeral did:key; ` +
73
- `otherwise generate one random 32-byte token and send it as X-KYA-Pickup-Token on EVERY poll. ` +
83
+ if (i.pickupProfile === "kya-http/2") {
84
+ return (`This action requires human authorization. First establish your pickup binding at ${pickupUri}. ` +
85
+ `If you can sign HTTP requests, sign each poll with an ephemeral did:key; otherwise generate one random 32-byte token encoded as unpadded base64url and send it as X-KYA-Pickup-Token on EVERY poll. ` +
86
+ `After receiving 202 pending, show your user this link and ask them to approve: ${consentUri}. ` +
87
+ `Continue polling ${pickupUri} every ${i.pollIntervalS} seconds with the same binding. ` +
88
+ `When the response status is 200, take the 'delegation' value and retry your original request with header 'Authorization: Bearer <delegation>'.`);
89
+ }
90
+ return (`This action requires human authorization. Generate one random 32-byte token encoded as unpadded base64url and keep it for this authorization request. ` +
91
+ `First establish your pickup binding at ${pickupUri} by sending that token as X-KYA-Pickup-Token. ` +
92
+ `After receiving 202 pending, show your user this link and ask them to approve: ${consentUri}. ` +
93
+ `Continue polling ${pickupUri} every ${i.pollIntervalS} seconds with the same X-KYA-Pickup-Token on EVERY poll. ` +
74
94
  `When the response status is 200, take the 'delegation' value and retry your original request with header 'Authorization: Bearer <delegation>'.`);
75
95
  }
76
96
  /**
@@ -89,6 +109,26 @@ export function buildChallengeBody(i, challengeProof) {
89
109
  }
90
110
  kyaos.poll_interval_s = i.pollIntervalS;
91
111
  kyaos.challenge_proof = challengeProof;
112
+ if (i.pickupProfile === "kya-http/2") {
113
+ // Machine-readable choreography descriptor: agents that parse structure
114
+ // instead of prose read the pin header and retry presentation from here.
115
+ // Key order mirrors the golden fixture's `kyaos.action`. NATIVE PROFILE
116
+ // ONLY: checkpoint's legacy-drift boundary treats this block's presence
117
+ // as a reviewed signal of native pickup support, so the default legacy
118
+ // body stays 1.13.6-shaped (no action block).
119
+ kyaos.action = {
120
+ type: "delegation",
121
+ consent_uri: buildConsentUri(i),
122
+ pickup_uri: buildPickupUri(i),
123
+ poll_interval_s: i.pollIntervalS,
124
+ pin: { header: "X-KYA-Pickup-Token" },
125
+ retry: {
126
+ header: "Authorization",
127
+ scheme: "Bearer",
128
+ value_from: "delegation",
129
+ },
130
+ };
131
+ }
92
132
  return {
93
133
  error: KYAOS_ERRORS.authorizationRequired,
94
134
  kyaos,
@@ -98,15 +138,25 @@ export function buildChallengeBody(i, challengeProof) {
98
138
  /**
99
139
  * Build the full §8.1 401 `Response`: dual `WWW-Authenticate` challenges (Delegation
100
140
  * first, then Bearer), `Retry-After`, JSON content type, and `Cache-Control:
101
- * no-store`.
141
+ * no-store`. Under the native profile the unsigned consent hint headers
142
+ * (`KYA-Auth-Required`/`KYA-Auth-Url`/`Link`/`KYA-Action`) are mirrored from the
143
+ * fetcher-200 envelope so header-only surfaces see the consent target on the 401
144
+ * too; the default legacy envelope stays 1.13.6-shaped.
102
145
  */
103
146
  export function buildChallengeResponse(i, challengeProof) {
147
+ const consentUri = buildConsentUri(i);
104
148
  const headers = new Headers();
105
149
  headers.append("WWW-Authenticate", buildWWWAuthenticateDelegation(i));
106
150
  headers.append("WWW-Authenticate", buildWWWAuthenticateBearer(i.realm));
107
151
  headers.set("Retry-After", String(i.pollIntervalS));
108
152
  headers.set("Content-Type", "application/json");
109
153
  headers.set("Cache-Control", "no-store");
154
+ if (i.pickupProfile === "kya-http/2") {
155
+ headers.set("KYA-Auth-Required", "true");
156
+ headers.set("KYA-Auth-Url", consentUri);
157
+ headers.set("Link", `<${consentUri}>; rel="kya-authorize"`);
158
+ headers.set("KYA-Action", "challenge");
159
+ }
110
160
  return new Response(JSON.stringify(buildChallengeBody(i, challengeProof)), {
111
161
  status: 401,
112
162
  headers,
@@ -1 +1 @@
1
- {"version":3,"file":"challenge.js","sourceRoot":"","sources":["../../src/delegation-http/challenge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAIlE;;;;;GAKG;AACH,MAAM,sBAAsB,GAAG,iBAAiB,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,UAAU,8BAA8B,CAC5C,CAAwB;IAExB,MAAM,MAAM,GAGR;QACF,KAAK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AAC,CAAC;IAEvC,OAAO,IAAI,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC,EAAE;QACzE,MAAM,EAAE,GAAG;QACX,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,kBAAkB,CACtC,GAA6B,EAC7B,OAAwE;IAExE,MAAM,KAAK,GAAG,MAAM,GAAG,CAAC,aAAa,CACnC;QACE,MAAM,EAAE,sBAAsB;QAC9B,MAAM,EAAE;YACN,GAAG,EAAE,OAAO,CAAC,GAAG;YAChB,WAAW,EAAE,OAAO,CAAC,WAAW;YAChC,eAAe,EAAE,OAAO,CAAC,eAAe;SACzC;KACF,EACD,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,EAC9B;QACE,wEAAwE;QACxE,KAAK,EAAE,OAAO,CAAC,GAAG;QAClB,QAAQ,EAAE,OAAO,CAAC,WAAW;QAC7B,SAAS,EAAE,OAAO,CAAC,GAAG;KACvB,CACF,CAAC;IACF,OAAO,KAAK,CAAC,GAAG,CAAC;AACnB,CAAC"}
@@ -45,14 +45,11 @@ import type { HttpChallengeConfig } from "../config";
45
45
  */
46
46
  export declare function resolveServerUrl(env: CloudflareEnv, c: HonoContext, realm?: string): string;
47
47
  /**
48
- * Resolve the anchor sid for `POST /consent/approve`. The `@kya-os/consent` Lit
49
- * component (`mcp-consent.ts` `handleApprove()`) always fetches the hardcoded
50
- * `${serverUrl}/consent/approve` — it has no way to append a query string — so
51
- * the sid instead travels in the POST body as `session_id` (its own field name,
52
- * populated from the `session-id` shell attribute {@link renderAnchorConsentShell}
53
- * sets to the anchor sid). Falls back to the query for the legacy raw-HTML
54
- * form's `action="/consent/approve?sid=…"` target, which some external PEPs may
55
- * still construct directly.
48
+ * Resolve an explicit anchor `sid` from the query or body. Older anchor forms
49
+ * submit only `session_id`; recognize those only by the original kya namespace.
50
+ * An ordinary legacy UUID must not select the HTTP handler merely because it
51
+ * also meets the opaque HTTP ID syntax. The selected handler still validates
52
+ * CSRF and persisted anchor state before granting any authority.
56
53
  *
57
54
  * Peeks the body via `clone()` so the ORIGINAL request stream is never consumed
58
55
  * here — `readBodyFields` still performs the one real body read, downstream in
@@ -1 +1 @@
1
- {"version":3,"file":"consent-anchor-bridge.d.ts","sourceRoot":"","sources":["../../src/delegation-http/consent-anchor-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAkBH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AA8TrD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,aAAa,EAClB,CAAC,EAAE,WAAW,EACd,KAAK,CAAC,EAAE,MAAM,GACb,MAAM,CAiBR;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,iBAAiB,CACrC,CAAC,EAAE,WAAW,GACb,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAyB7B;AA8SD;;GAEG;AACH,wBAAsB,sBAAsB,CAC1C,CAAC,EAAE,WAAW,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GACjC,OAAO,CAAC,QAAQ,CAAC,CA4DnB;AAED;;;GAGG;AACH,wBAAsB,0BAA0B,CAC9C,CAAC,EAAE,WAAW,EACd,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,aAAa,EAClB,GAAG,EAAE,QAAQ,CAAC,mBAAmB,CAAC,GACjC,OAAO,CAAC,QAAQ,CAAC,CAsNnB"}
1
+ {"version":3,"file":"consent-anchor-bridge.d.ts","sourceRoot":"","sources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