@kya-os/consent 0.1.37 → 0.1.39

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 (192) hide show
  1. package/dist/bundle/index.d.ts +12 -0
  2. package/dist/bundle/index.d.ts.map +1 -1
  3. package/dist/bundle/index.js +12 -0
  4. package/dist/bundle/index.js.map +1 -1
  5. package/dist/bundle/inline.d.ts.map +1 -1
  6. package/dist/bundle/inline.js +2 -2
  7. package/dist/bundle/inline.js.map +1 -1
  8. package/dist/bundle/shell.d.ts +23 -0
  9. package/dist/bundle/shell.d.ts.map +1 -1
  10. package/dist/bundle/shell.js +25 -1
  11. package/dist/bundle/shell.js.map +1 -1
  12. package/dist/capabilities/index.d.ts +7 -0
  13. package/dist/capabilities/index.d.ts.map +1 -0
  14. package/dist/capabilities/index.js +7 -0
  15. package/dist/capabilities/index.js.map +1 -0
  16. package/dist/capabilities/registry.d.ts +29 -0
  17. package/dist/capabilities/registry.d.ts.map +1 -0
  18. package/dist/capabilities/registry.js +178 -0
  19. package/dist/capabilities/registry.js.map +1 -0
  20. package/dist/cedar/compile.d.ts +30 -0
  21. package/dist/cedar/compile.d.ts.map +1 -0
  22. package/dist/cedar/compile.js +55 -0
  23. package/dist/cedar/compile.js.map +1 -0
  24. package/dist/cedar/explain.d.ts +22 -0
  25. package/dist/cedar/explain.d.ts.map +1 -0
  26. package/dist/cedar/explain.js +72 -0
  27. package/dist/cedar/explain.js.map +1 -0
  28. package/dist/cedar/index.d.ts +8 -0
  29. package/dist/cedar/index.d.ts.map +1 -0
  30. package/dist/cedar/index.js +8 -0
  31. package/dist/cedar/index.js.map +1 -0
  32. package/dist/cjs/bundle/index.js +19 -1
  33. package/dist/cjs/bundle/index.js.map +1 -1
  34. package/dist/cjs/bundle/inline.js +2 -2
  35. package/dist/cjs/bundle/inline.js.map +1 -1
  36. package/dist/cjs/bundle/shell.js +25 -1
  37. package/dist/cjs/bundle/shell.js.map +1 -1
  38. package/dist/cjs/capabilities/index.js +12 -0
  39. package/dist/cjs/capabilities/index.js.map +1 -0
  40. package/dist/cjs/capabilities/registry.js +182 -0
  41. package/dist/cjs/capabilities/registry.js.map +1 -0
  42. package/dist/cjs/cedar/compile.js +59 -0
  43. package/dist/cjs/cedar/compile.js.map +1 -0
  44. package/dist/cjs/cedar/explain.js +75 -0
  45. package/dist/cjs/cedar/explain.js.map +1 -0
  46. package/dist/cjs/cedar/index.js +14 -0
  47. package/dist/cjs/cedar/index.js.map +1 -0
  48. package/dist/cjs/components/consent-action-bar.js +138 -0
  49. package/dist/cjs/components/consent-action-bar.js.map +1 -0
  50. package/dist/cjs/components/consent-agent-header.js +205 -0
  51. package/dist/cjs/components/consent-agent-header.js.map +1 -0
  52. package/dist/cjs/components/consent-capabilities-screen.js +309 -0
  53. package/dist/cjs/components/consent-capabilities-screen.js.map +1 -0
  54. package/dist/cjs/components/consent-capability-card.js +340 -0
  55. package/dist/cjs/components/consent-capability-card.js.map +1 -0
  56. package/dist/cjs/components/consent-footer.js +99 -0
  57. package/dist/cjs/components/consent-footer.js.map +1 -0
  58. package/dist/cjs/components/consent-revocation-notice.js +101 -0
  59. package/dist/cjs/components/consent-revocation-notice.js.map +1 -0
  60. package/dist/cjs/components/index.js +14 -1
  61. package/dist/cjs/components/index.js.map +1 -1
  62. package/dist/cjs/components/mcp-consent.js +176 -7
  63. package/dist/cjs/components/mcp-consent.js.map +1 -1
  64. package/dist/cjs/copy/index.js +12 -0
  65. package/dist/cjs/copy/index.js.map +1 -0
  66. package/dist/cjs/copy/tokens.js +101 -0
  67. package/dist/cjs/copy/tokens.js.map +1 -0
  68. package/dist/cjs/index.js +8 -0
  69. package/dist/cjs/index.js.map +1 -1
  70. package/dist/cjs/mcp-app/index.js +15 -0
  71. package/dist/cjs/mcp-app/index.js.map +1 -0
  72. package/dist/cjs/mcp-app/inline.js +20 -0
  73. package/dist/cjs/mcp-app/inline.js.map +1 -0
  74. package/dist/cjs/mcp-app/types.js +10 -0
  75. package/dist/cjs/mcp-app/types.js.map +1 -0
  76. package/dist/cjs/popup/index.js +15 -0
  77. package/dist/cjs/popup/index.js.map +1 -0
  78. package/dist/cjs/popup/launcher.js +77 -0
  79. package/dist/cjs/popup/launcher.js.map +1 -0
  80. package/dist/cjs/schemas/capabilities.schemas.js +129 -0
  81. package/dist/cjs/schemas/capabilities.schemas.js.map +1 -0
  82. package/dist/cjs/schemas/config.schemas.js +18 -0
  83. package/dist/cjs/schemas/config.schemas.js.map +1 -1
  84. package/dist/cjs/schemas/index.js +1 -0
  85. package/dist/cjs/schemas/index.js.map +1 -1
  86. package/dist/cjs/styles/index.js +1 -0
  87. package/dist/cjs/styles/index.js.map +1 -1
  88. package/dist/cjs/styles/theme.js +86 -0
  89. package/dist/cjs/styles/theme.js.map +1 -0
  90. package/dist/cjs/types/capabilities.types.js +12 -0
  91. package/dist/cjs/types/capabilities.types.js.map +1 -0
  92. package/dist/cjs/types/index.js +1 -0
  93. package/dist/cjs/types/index.js.map +1 -1
  94. package/dist/components/consent-action-bar.d.ts +30 -0
  95. package/dist/components/consent-action-bar.d.ts.map +1 -0
  96. package/dist/components/consent-action-bar.js +135 -0
  97. package/dist/components/consent-action-bar.js.map +1 -0
  98. package/dist/components/consent-agent-header.d.ts +31 -0
  99. package/dist/components/consent-agent-header.d.ts.map +1 -0
  100. package/dist/components/consent-agent-header.js +202 -0
  101. package/dist/components/consent-agent-header.js.map +1 -0
  102. package/dist/components/consent-capabilities-screen.d.ts +62 -0
  103. package/dist/components/consent-capabilities-screen.d.ts.map +1 -0
  104. package/dist/components/consent-capabilities-screen.js +306 -0
  105. package/dist/components/consent-capabilities-screen.js.map +1 -0
  106. package/dist/components/consent-capability-card.d.ts +44 -0
  107. package/dist/components/consent-capability-card.d.ts.map +1 -0
  108. package/dist/components/consent-capability-card.js +337 -0
  109. package/dist/components/consent-capability-card.js.map +1 -0
  110. package/dist/components/consent-footer.d.ts +22 -0
  111. package/dist/components/consent-footer.d.ts.map +1 -0
  112. package/dist/components/consent-footer.js +96 -0
  113. package/dist/components/consent-footer.js.map +1 -0
  114. package/dist/components/consent-revocation-notice.d.ts +22 -0
  115. package/dist/components/consent-revocation-notice.d.ts.map +1 -0
  116. package/dist/components/consent-revocation-notice.js +98 -0
  117. package/dist/components/consent-revocation-notice.js.map +1 -0
  118. package/dist/components/index.d.ts +6 -0
  119. package/dist/components/index.d.ts.map +1 -1
  120. package/dist/components/index.js +7 -0
  121. package/dist/components/index.js.map +1 -1
  122. package/dist/components/mcp-consent.d.ts +41 -0
  123. package/dist/components/mcp-consent.d.ts.map +1 -1
  124. package/dist/components/mcp-consent.js +176 -7
  125. package/dist/components/mcp-consent.js.map +1 -1
  126. package/dist/consent.js +1578 -210
  127. package/dist/consent.min.js +727 -96
  128. package/dist/copy/index.d.ts +8 -0
  129. package/dist/copy/index.d.ts.map +1 -0
  130. package/dist/copy/index.js +7 -0
  131. package/dist/copy/index.js.map +1 -0
  132. package/dist/copy/tokens.d.ts +93 -0
  133. package/dist/copy/tokens.d.ts.map +1 -0
  134. package/dist/copy/tokens.js +97 -0
  135. package/dist/copy/tokens.js.map +1 -0
  136. package/dist/index.d.ts +4 -0
  137. package/dist/index.d.ts.map +1 -1
  138. package/dist/index.js +8 -0
  139. package/dist/index.js.map +1 -1
  140. package/dist/mcp-app/index.d.ts +10 -0
  141. package/dist/mcp-app/index.d.ts.map +1 -0
  142. package/dist/mcp-app/index.js +9 -0
  143. package/dist/mcp-app/index.js.map +1 -0
  144. package/dist/mcp-app/inline.d.ts +16 -0
  145. package/dist/mcp-app/inline.d.ts.map +1 -0
  146. package/dist/mcp-app/inline.js +16 -0
  147. package/dist/mcp-app/inline.js.map +1 -0
  148. package/dist/mcp-app/types.d.ts +33 -0
  149. package/dist/mcp-app/types.d.ts.map +1 -0
  150. package/dist/mcp-app/types.js +8 -0
  151. package/dist/mcp-app/types.js.map +1 -0
  152. package/dist/popup/index.d.ts +8 -0
  153. package/dist/popup/index.d.ts.map +1 -0
  154. package/dist/popup/index.js +7 -0
  155. package/dist/popup/index.js.map +1 -0
  156. package/dist/popup/launcher.d.ts +81 -0
  157. package/dist/popup/launcher.d.ts.map +1 -0
  158. package/dist/popup/launcher.js +71 -0
  159. package/dist/popup/launcher.js.map +1 -0
  160. package/dist/schemas/api.schemas.d.ts +234 -30
  161. package/dist/schemas/api.schemas.d.ts.map +1 -1
  162. package/dist/schemas/capabilities.schemas.d.ts +186 -0
  163. package/dist/schemas/capabilities.schemas.d.ts.map +1 -0
  164. package/dist/schemas/capabilities.schemas.js +123 -0
  165. package/dist/schemas/capabilities.schemas.js.map +1 -0
  166. package/dist/schemas/config.schemas.d.ts +332 -36
  167. package/dist/schemas/config.schemas.d.ts.map +1 -1
  168. package/dist/schemas/config.schemas.js +18 -0
  169. package/dist/schemas/config.schemas.js.map +1 -1
  170. package/dist/schemas/index.d.ts +1 -0
  171. package/dist/schemas/index.d.ts.map +1 -1
  172. package/dist/schemas/index.js +1 -0
  173. package/dist/schemas/index.js.map +1 -1
  174. package/dist/styles/index.d.ts +1 -0
  175. package/dist/styles/index.d.ts.map +1 -1
  176. package/dist/styles/index.js +1 -0
  177. package/dist/styles/index.js.map +1 -1
  178. package/dist/styles/theme.d.ts +72 -0
  179. package/dist/styles/theme.d.ts.map +1 -0
  180. package/dist/styles/theme.js +81 -0
  181. package/dist/styles/theme.js.map +1 -0
  182. package/dist/types/capabilities.types.d.ts +126 -0
  183. package/dist/types/capabilities.types.d.ts.map +1 -0
  184. package/dist/types/capabilities.types.js +11 -0
  185. package/dist/types/capabilities.types.js.map +1 -0
  186. package/dist/types/config.types.d.ts +33 -0
  187. package/dist/types/config.types.d.ts.map +1 -1
  188. package/dist/types/index.d.ts +1 -0
  189. package/dist/types/index.d.ts.map +1 -1
  190. package/dist/types/index.js +1 -0
  191. package/dist/types/index.js.map +1 -1
  192. package/package.json +15 -8
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inline.js","sourceRoot":"","sources":["../../src/mcp-app/inline.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,sEAAsE;AACtE,MAAM,CAAC,MAAM,oBAAoB,GAAW,mizuBAAmizuB,CAAC;AAEhlzuB,4CAA4C;AAC5C,MAAM,CAAC,MAAM,yBAAyB,GAAW,MAAM,CAAC"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * MCP Apps Consent Types
3
+ *
4
+ * Type definitions for the inline consent UI rendered via MCP Apps.
5
+ * These match the structuredContent shape produced by
6
+ * MCPIRuntimeBase.buildConsentUIResult().
7
+ */
8
+ /** Parameters passed via structuredContent from the runtime */
9
+ export interface ConsentParams {
10
+ type: "consent_required";
11
+ /** Auth mode: "consent-only" (default) or "credentials" (username/password form) */
12
+ authMode?: "consent-only" | "credentials";
13
+ tool: string;
14
+ scopes: string[];
15
+ agentDid: string;
16
+ agentName: string;
17
+ sessionId: string;
18
+ projectId: string;
19
+ resumeToken: string;
20
+ serverUrl: string;
21
+ /** Fallback URL if the iframe can't reach the server */
22
+ consentUrl: string;
23
+ /** Credential provider name (only present when authMode is "credentials") */
24
+ provider?: string;
25
+ }
26
+ /** Response from POST /consent/approve */
27
+ export interface ConsentApprovalResponse {
28
+ success: boolean;
29
+ delegation_id?: string;
30
+ delegation_token?: string;
31
+ error?: string;
32
+ error_code?: string;
33
+ }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/mcp-app/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,kBAAkB,CAAC;IACzB,oFAAoF;IACpF,QAAQ,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC;IAC1C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,UAAU,EAAE,MAAM,CAAC;IACnB,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,0CAA0C;AAC1C,MAAM,WAAW,uBAAuB;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * MCP Apps Consent Types
3
+ *
4
+ * Type definitions for the inline consent UI rendered via MCP Apps.
5
+ * These match the structuredContent shape produced by
6
+ * MCPIRuntimeBase.buildConsentUIResult().
7
+ */
8
+ export {};
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/mcp-app/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Consent popup launcher exports.
3
+ *
4
+ * @module @kya-os/consent/popup
5
+ */
6
+ export { POPUP_CAPABLE_CLIENT_IDS, POPUP_WINDOW_FEATURES, shouldUsePopup, buildPopupResource, buildConsentMarkdownLink, } from "./launcher.js";
7
+ export type { ConsentPopupResource, PopupCapableClientId } from "./launcher.js";
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/popup/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,eAAe,CAAC;AACvB,YAAY,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Consent popup launcher exports.
3
+ *
4
+ * @module @kya-os/consent/popup
5
+ */
6
+ export { POPUP_CAPABLE_CLIENT_IDS, POPUP_WINDOW_FEATURES, shouldUsePopup, buildPopupResource, buildConsentMarkdownLink, } from "./launcher.js";
7
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/popup/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EACL,wBAAwB,EACxB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,wBAAwB,GACzB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Consent Popup Launcher
3
+ *
4
+ * The framework returns a *markdown link* by default when a tool requires
5
+ * delegation: the agent surfaces the link to the user, who clicks through to
6
+ * the consent page in a normal browser tab.
7
+ *
8
+ * For clients that ship an embedded browser (today: `.mcpb`-installed Claude
9
+ * Desktop), we can do better — return a structured-content UI resource that
10
+ * opens a stripped-chrome popup window with the consent URL preloaded. The
11
+ * popup closes itself on success. The user never leaves the chat.
12
+ *
13
+ * This module is runtime-agnostic. It returns plain data; the runtime adapter
14
+ * (e.g. `@kya-os/mcp-i-cloudflare`) is responsible for delivering the chosen
15
+ * representation back to the MCP client.
16
+ *
17
+ * @module @kya-os/consent/popup/launcher
18
+ */
19
+ /**
20
+ * Stable identifiers for clients that support the embedded popup launcher.
21
+ *
22
+ * These IDs match the canonical IDs in `@kya-os/mcp-i-cloudflare`'s
23
+ * `findKnownClient` registry. Adding a new client here requires that the
24
+ * client also surface a usable embedded browser.
25
+ */
26
+ export declare const POPUP_CAPABLE_CLIENT_IDS: readonly ["claude"];
27
+ export type PopupCapableClientId = (typeof POPUP_CAPABLE_CLIENT_IDS)[number];
28
+ /**
29
+ * Decide whether the consent flow should be presented as a popup for this
30
+ * client + config combination. Falls back to `false` when either input
31
+ * disqualifies the popup path.
32
+ *
33
+ * @param clientId - Canonical client id from `findKnownClient`. Pass the
34
+ * `id` field, not the raw `clientInfo.name` string.
35
+ * @param popupEnabled - The resolved `popupEnabled` flag from `ResolvedUI`.
36
+ */
37
+ export declare function shouldUsePopup(clientId: string | undefined, popupEnabled: boolean | undefined): clientId is PopupCapableClientId;
38
+ /**
39
+ * Default popup window size. Matches the consent screen's max width
40
+ * (`max-w-[512px]`) plus enough vertical room for the capability list and
41
+ * the action bar.
42
+ */
43
+ export declare const POPUP_WINDOW_FEATURES: {
44
+ readonly width: 520;
45
+ readonly height: 760;
46
+ };
47
+ /**
48
+ * The structured-content payload returned to the MCP client when we want it to
49
+ * open the consent page in a popup. The MCP client must be able to render
50
+ * `application/vnd.kya-os.consent-popup+json` as an action; otherwise the
51
+ * runtime should fall back to the markdown link.
52
+ *
53
+ * The schema mirrors the MCP UI resource shape: a single content block with
54
+ * a uri (the consent URL) and a hint to open in a popup with the given
55
+ * window features.
56
+ */
57
+ export interface ConsentPopupResource {
58
+ type: "kya-os/consent-popup";
59
+ consentUrl: string;
60
+ features: {
61
+ width: number;
62
+ height: number;
63
+ };
64
+ /**
65
+ * Markdown fallback the client can display if it does not understand the
66
+ * popup hint. Same content as `buildConsentMarkdownLink`, included so a
67
+ * single response works for both popup-aware and popup-naive clients.
68
+ */
69
+ fallbackMarkdown: string;
70
+ }
71
+ /**
72
+ * Build the popup resource payload for a given consent URL.
73
+ */
74
+ export declare function buildPopupResource(consentUrl: string): ConsentPopupResource;
75
+ /**
76
+ * Markdown text the framework returns when the client doesn't support the
77
+ * popup path. Identical to the historical `Authorize the action here →`
78
+ * line so existing flows are unchanged.
79
+ */
80
+ export declare function buildConsentMarkdownLink(consentUrl: string): string;
81
+ //# sourceMappingURL=launcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher.d.ts","sourceRoot":"","sources":["../../src/popup/launcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,qBAAsB,CAAC;AAE5D,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,YAAY,EAAE,OAAO,GAAG,SAAS,GAChC,QAAQ,IAAI,oBAAoB,CAIlC;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB;;;CAGxB,CAAC;AAEX;;;;;;;;;GASG;AACH,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,sBAAsB,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE;QACR,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;KAChB,CAAC;IACF;;;;OAIG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,GAAG,oBAAoB,CAO3E;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEnE"}
@@ -0,0 +1,71 @@
1
+ /**
2
+ * Consent Popup Launcher
3
+ *
4
+ * The framework returns a *markdown link* by default when a tool requires
5
+ * delegation: the agent surfaces the link to the user, who clicks through to
6
+ * the consent page in a normal browser tab.
7
+ *
8
+ * For clients that ship an embedded browser (today: `.mcpb`-installed Claude
9
+ * Desktop), we can do better — return a structured-content UI resource that
10
+ * opens a stripped-chrome popup window with the consent URL preloaded. The
11
+ * popup closes itself on success. The user never leaves the chat.
12
+ *
13
+ * This module is runtime-agnostic. It returns plain data; the runtime adapter
14
+ * (e.g. `@kya-os/mcp-i-cloudflare`) is responsible for delivering the chosen
15
+ * representation back to the MCP client.
16
+ *
17
+ * @module @kya-os/consent/popup/launcher
18
+ */
19
+ /**
20
+ * Stable identifiers for clients that support the embedded popup launcher.
21
+ *
22
+ * These IDs match the canonical IDs in `@kya-os/mcp-i-cloudflare`'s
23
+ * `findKnownClient` registry. Adding a new client here requires that the
24
+ * client also surface a usable embedded browser.
25
+ */
26
+ export const POPUP_CAPABLE_CLIENT_IDS = ["claude"];
27
+ /**
28
+ * Decide whether the consent flow should be presented as a popup for this
29
+ * client + config combination. Falls back to `false` when either input
30
+ * disqualifies the popup path.
31
+ *
32
+ * @param clientId - Canonical client id from `findKnownClient`. Pass the
33
+ * `id` field, not the raw `clientInfo.name` string.
34
+ * @param popupEnabled - The resolved `popupEnabled` flag from `ResolvedUI`.
35
+ */
36
+ export function shouldUsePopup(clientId, popupEnabled) {
37
+ if (!popupEnabled)
38
+ return false;
39
+ if (!clientId)
40
+ return false;
41
+ return POPUP_CAPABLE_CLIENT_IDS.includes(clientId);
42
+ }
43
+ /**
44
+ * Default popup window size. Matches the consent screen's max width
45
+ * (`max-w-[512px]`) plus enough vertical room for the capability list and
46
+ * the action bar.
47
+ */
48
+ export const POPUP_WINDOW_FEATURES = {
49
+ width: 520,
50
+ height: 760,
51
+ };
52
+ /**
53
+ * Build the popup resource payload for a given consent URL.
54
+ */
55
+ export function buildPopupResource(consentUrl) {
56
+ return {
57
+ type: "kya-os/consent-popup",
58
+ consentUrl,
59
+ features: { ...POPUP_WINDOW_FEATURES },
60
+ fallbackMarkdown: buildConsentMarkdownLink(consentUrl),
61
+ };
62
+ }
63
+ /**
64
+ * Markdown text the framework returns when the client doesn't support the
65
+ * popup path. Identical to the historical `Authorize the action here →`
66
+ * line so existing flows are unchanged.
67
+ */
68
+ export function buildConsentMarkdownLink(consentUrl) {
69
+ return `[Authorize the action here →](${consentUrl})`;
70
+ }
71
+ //# sourceMappingURL=launcher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"launcher.js","sourceRoot":"","sources":["../../src/popup/launcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAQ,CAAU,CAAC;AAI5D;;;;;;;;GAQG;AACH,MAAM,UAAU,cAAc,CAC5B,QAA4B,EAC5B,YAAiC;IAEjC,IAAI,CAAC,YAAY;QAAE,OAAO,KAAK,CAAC;IAChC,IAAI,CAAC,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5B,OAAQ,wBAA8C,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC5E,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,KAAK,EAAE,GAAG;IACV,MAAM,EAAE,GAAG;CACH,CAAC;AA2BX;;GAEG;AACH,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,OAAO;QACL,IAAI,EAAE,sBAAsB;QAC5B,UAAU;QACV,QAAQ,EAAE,EAAE,GAAG,qBAAqB,EAAE;QACtC,gBAAgB,EAAE,wBAAwB,CAAC,UAAU,CAAC;KACvD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,wBAAwB,CAAC,UAAkB;IACzD,OAAO,iCAAiC,UAAU,GAAG,CAAC;AACxD,CAAC"}