@maxhealth.tech/prefab 0.3.17 → 0.3.19

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 (148) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/README.md +1 -1
  3. package/dist/a2ui/browser.js +1 -2
  4. package/dist/a2ui/browser.js.map +1 -1
  5. package/dist/a2ui/expr.d.ts +7 -54
  6. package/dist/a2ui/expr.d.ts.map +1 -1
  7. package/dist/a2ui/expr.js +13 -90
  8. package/dist/a2ui/expr.js.map +1 -1
  9. package/dist/a2ui/icons.d.ts +3 -25
  10. package/dist/a2ui/icons.d.ts.map +1 -1
  11. package/dist/a2ui/icons.js +4 -33
  12. package/dist/a2ui/icons.js.map +1 -1
  13. package/dist/a2ui/types.d.ts +7 -54
  14. package/dist/a2ui/types.d.ts.map +1 -1
  15. package/dist/a2ui/types.js +2 -21
  16. package/dist/a2ui/types.js.map +1 -1
  17. package/dist/a2ui.min.js +1 -1
  18. package/dist/actions/subscribe.d.ts +3 -18
  19. package/dist/actions/subscribe.d.ts.map +1 -1
  20. package/dist/actions/subscribe.js +2 -17
  21. package/dist/actions/subscribe.js.map +1 -1
  22. package/dist/app.d.ts.map +1 -1
  23. package/dist/app.js +3 -6
  24. package/dist/app.js.map +1 -1
  25. package/dist/auto/schema.d.ts.map +1 -1
  26. package/dist/auto/schema.js +2 -6
  27. package/dist/auto/schema.js.map +1 -1
  28. package/dist/components/pdf/index.d.ts +3 -9
  29. package/dist/components/pdf/index.d.ts.map +1 -1
  30. package/dist/components/pdf/index.js +2 -8
  31. package/dist/components/pdf/index.js.map +1 -1
  32. package/dist/core/escape.d.ts +1 -19
  33. package/dist/core/escape.d.ts.map +1 -1
  34. package/dist/core/escape.js +1 -19
  35. package/dist/core/escape.js.map +1 -1
  36. package/dist/core/humanize.d.ts +2 -17
  37. package/dist/core/humanize.d.ts.map +1 -1
  38. package/dist/core/humanize.js +8 -20
  39. package/dist/core/humanize.js.map +1 -1
  40. package/dist/core/logger.d.ts +1 -9
  41. package/dist/core/logger.d.ts.map +1 -1
  42. package/dist/core/logger.js +1 -9
  43. package/dist/core/logger.js.map +1 -1
  44. package/dist/core/stringify.d.ts +2 -19
  45. package/dist/core/stringify.d.ts.map +1 -1
  46. package/dist/core/stringify.js +3 -21
  47. package/dist/core/stringify.js.map +1 -1
  48. package/dist/core/validate.d.ts.map +1 -1
  49. package/dist/core/validate.js +23 -26
  50. package/dist/core/validate.js.map +1 -1
  51. package/dist/core/version.d.ts +3 -22
  52. package/dist/core/version.d.ts.map +1 -1
  53. package/dist/core/version.js +3 -22
  54. package/dist/core/version.js.map +1 -1
  55. package/dist/mcp/a2ui.d.ts +6 -36
  56. package/dist/mcp/a2ui.d.ts.map +1 -1
  57. package/dist/mcp/a2ui.js +6 -36
  58. package/dist/mcp/a2ui.js.map +1 -1
  59. package/dist/mcp/input-required.d.ts.map +1 -1
  60. package/dist/mcp/input-required.js +2 -8
  61. package/dist/mcp/input-required.js.map +1 -1
  62. package/dist/mcp/resource.d.ts +12 -88
  63. package/dist/mcp/resource.d.ts.map +1 -1
  64. package/dist/mcp/resource.js +18 -85
  65. package/dist/mcp/resource.js.map +1 -1
  66. package/dist/mcp/result.d.ts +2 -27
  67. package/dist/mcp/result.d.ts.map +1 -1
  68. package/dist/mcp/result.js +2 -27
  69. package/dist/mcp/result.js.map +1 -1
  70. package/dist/mcp/theme-bridge.d.ts +5 -36
  71. package/dist/mcp/theme-bridge.d.ts.map +1 -1
  72. package/dist/mcp/theme-bridge.js +6 -43
  73. package/dist/mcp/theme-bridge.js.map +1 -1
  74. package/dist/mcp/types.d.ts +11 -106
  75. package/dist/mcp/types.d.ts.map +1 -1
  76. package/dist/mcp/types.js +2 -22
  77. package/dist/mcp/types.js.map +1 -1
  78. package/dist/renderer/actions.d.ts +2 -2
  79. package/dist/renderer/actions.d.ts.map +1 -1
  80. package/dist/renderer/actions.js +6 -2
  81. package/dist/renderer/actions.js.map +1 -1
  82. package/dist/renderer/app.d.ts.map +1 -1
  83. package/dist/renderer/app.js +3 -2
  84. package/dist/renderer/app.js.map +1 -1
  85. package/dist/renderer/auto.js +9 -4
  86. package/dist/renderer/auto.js.map +1 -1
  87. package/dist/renderer/bridge.d.ts +3 -7
  88. package/dist/renderer/bridge.d.ts.map +1 -1
  89. package/dist/renderer/bridge.js +39 -65
  90. package/dist/renderer/bridge.js.map +1 -1
  91. package/dist/renderer/components/alert.d.ts.map +1 -1
  92. package/dist/renderer/components/alert.js +4 -2
  93. package/dist/renderer/components/alert.js.map +1 -1
  94. package/dist/renderer/components/choice.d.ts.map +1 -1
  95. package/dist/renderer/components/choice.js +5 -4
  96. package/dist/renderer/components/choice.js.map +1 -1
  97. package/dist/renderer/components/control.d.ts.map +1 -1
  98. package/dist/renderer/components/control.js +16 -9
  99. package/dist/renderer/components/control.js.map +1 -1
  100. package/dist/renderer/components/data.d.ts.map +1 -1
  101. package/dist/renderer/components/data.js +17 -15
  102. package/dist/renderer/components/data.js.map +1 -1
  103. package/dist/renderer/components/form.d.ts.map +1 -1
  104. package/dist/renderer/components/form.js +18 -17
  105. package/dist/renderer/components/form.js.map +1 -1
  106. package/dist/renderer/components/interactive.d.ts.map +1 -1
  107. package/dist/renderer/components/interactive.js +3 -2
  108. package/dist/renderer/components/interactive.js.map +1 -1
  109. package/dist/renderer/components/media.d.ts.map +1 -1
  110. package/dist/renderer/components/media.js +13 -10
  111. package/dist/renderer/components/media.js.map +1 -1
  112. package/dist/renderer/components/pdf.d.ts +1 -10
  113. package/dist/renderer/components/pdf.d.ts.map +1 -1
  114. package/dist/renderer/components/pdf.js +19 -14
  115. package/dist/renderer/components/pdf.js.map +1 -1
  116. package/dist/renderer/components/table.js +2 -2
  117. package/dist/renderer/components/table.js.map +1 -1
  118. package/dist/renderer/components/typography.d.ts.map +1 -1
  119. package/dist/renderer/components/typography.js +4 -2
  120. package/dist/renderer/components/typography.js.map +1 -1
  121. package/dist/renderer/engine.d.ts.map +1 -1
  122. package/dist/renderer/engine.js +5 -6
  123. package/dist/renderer/engine.js.map +1 -1
  124. package/dist/renderer/host-context.d.ts +8 -0
  125. package/dist/renderer/host-context.d.ts.map +1 -0
  126. package/dist/renderer/host-context.js +62 -0
  127. package/dist/renderer/host-context.js.map +1 -0
  128. package/dist/renderer/index.d.ts.map +1 -1
  129. package/dist/renderer/index.js +21 -28
  130. package/dist/renderer/index.js.map +1 -1
  131. package/dist/renderer/rx.d.ts +2 -0
  132. package/dist/renderer/rx.d.ts.map +1 -1
  133. package/dist/renderer/rx.js +24 -24
  134. package/dist/renderer/rx.js.map +1 -1
  135. package/dist/renderer/state.d.ts.map +1 -1
  136. package/dist/renderer/state.js +10 -4
  137. package/dist/renderer/state.js.map +1 -1
  138. package/dist/renderer.auto.min.js +10 -10
  139. package/dist/renderer.min.js +10 -10
  140. package/dist/rx/pipes.d.ts +3 -19
  141. package/dist/rx/pipes.d.ts.map +1 -1
  142. package/dist/rx/pipes.js +3 -19
  143. package/dist/rx/pipes.js.map +1 -1
  144. package/dist/rx/signal.d.ts +3 -13
  145. package/dist/rx/signal.d.ts.map +1 -1
  146. package/dist/rx/signal.js +2 -9
  147. package/dist/rx/signal.js.map +1 -1
  148. package/package.json +4 -4
@@ -1,14 +1,4 @@
1
- /**
2
- * MCP Apps resource helpers — register the prefab viewer as a `ui://` resource.
3
- *
4
- * Covers the three things every MCP Apps host checks and the two the
5
- * 2026-07-28 protocol revision added:
6
- * - the `text/html;profile=mcp-app` MIME type,
7
- * - `_meta.ui` CSP / permissions on BOTH the listing and the content item,
8
- * - the viewer HTML itself (CDN-pinned to this exact package version),
9
- * - `ttlMs` / `cacheScope` on the read result (SEP-2549 `CacheableResult`),
10
- * - the `io.modelcontextprotocol/ui` extension capability (SEP-2133).
11
- */
1
+ /** Register the prefab viewer as a `ui://` MCP Apps resource: MIME type, `_meta.ui` on listing and content, CDN-pinned HTML, cache fields, extension capability. */
12
2
  import type { McpCacheHint, McpResourceReadResult, McpTextResourceContents } from './types.js';
13
3
  import { type ThemeBridge } from './theme-bridge.js';
14
4
  /** CSP configuration for MCP Apps resources. */
@@ -47,11 +37,7 @@ interface McpAppPermissionsWire {
47
37
  clipboardWrite?: Record<string, never>;
48
38
  }
49
39
  /**
50
- * Generate the `_meta` object for MCP Apps `ui://` resource registration.
51
- *
52
- * Includes CSP and Permission Policy configuration per the MCP Apps spec.
53
- * Use on both the resource listing AND the content item (VS Code reads
54
- * only the content item; other hosts may read either).
40
+ * The `_meta` (CSP, permissions) for a `ui://` resource. Put it on the listing and the content item: VS Code reads only the latter.
55
41
  *
56
42
  * @example
57
43
  * ```ts
@@ -96,33 +82,9 @@ export declare const PREFAB_CDN_META: {
96
82
  export declare const PREFAB_RESOURCE_URI = "ui://prefab/viewer";
97
83
  /** MIME type required by MCP Apps hosts. */
98
84
  export declare const MCP_APP_MIME = "text/html;profile=mcp-app";
99
- /**
100
- * Capability key for the MCP Apps extension (versioned independently of core).
101
- *
102
- * The identifier is `…/ui`, and the trap here is that `…/apps` looks right and is
103
- * wrong. The normative source is the MCP Apps spec, which states "This extension is
104
- * identified as: `io.modelcontextprotocol/ui`" in both the current `2026-01-26`
105
- * revision and the draft, and the reference implementation agrees:
106
- * `ext-apps/src/server/index.ts` exports `EXTENSION_ID = "io.modelcontextprotocol/ui"`.
107
- *
108
- * `io.modelcontextprotocol/apps` appears only as illustrative "e.g." text in the Rust
109
- * and C# SDKs' generic `ServerCapabilities.extensions` doc comments (and their test
110
- * fixtures), showing the SHAPE of the extensions map rather than naming this extension.
111
- * Copying it from there declares the capability under a key no host looks up, which
112
- * fails silently: rendering still works, because hosts fall back to detecting apps via
113
- * `_meta.ui` plus the MIME type, so only the SEP-2133 declaration is lost.
114
- *
115
- * Duplicated as a literal rather than imported, because prefab ships zero dependencies.
116
- */
85
+ /** The MCP Apps extension id, `…/ui` per the spec and ext-apps (`…/apps` in some SDK doc examples is only illustrative). */
117
86
  export declare const APPS_EXTENSION = "io.modelcontextprotocol/ui";
118
- /**
119
- * Default cache hint for the viewer resource.
120
- *
121
- * The HTML is a pure function of this package's `VERSION` (the CDN base pins
122
- * the exact version), so it cannot change for a given server build — it is
123
- * safely shared-cacheable. Without this the SDK falls back to the conservative
124
- * `{ ttlMs: 0, cacheScope: 'private' }` and the viewer is re-fetched every time.
125
- */
87
+ /** Viewer cache hint: the HTML is a pure function of `VERSION`, so it is shared-cacheable for a day. */
126
88
  export declare const DEFAULT_VIEWER_CACHE: Required<McpCacheHint>;
127
89
  export interface RendererHtmlOptions {
128
90
  /** Page title. @default 'Prefab' */
@@ -133,21 +95,11 @@ export interface RendererHtmlOptions {
133
95
  stylesheets?: string[];
134
96
  /** Override CDN base URL (no trailing slash). @default jsdelivr CDN */
135
97
  cdnBase?: string;
136
- /**
137
- * Inject a theme bridge stylesheet after `prefab.css`.
138
- *
139
- * `'vscode'` re-declares the tokens VS Code can supply with the
140
- * `--vscode-*` variable first, dropping the MCP Apps `--color-*` layer that
141
- * would otherwise shadow it, so the viewer follows the user's editor theme.
142
- * Emitted before `stylesheets`, which stay the outermost override.
143
- */
98
+ /** Theme bridge stylesheet after `prefab.css` (before `stylesheets`); `'vscode'` follows the editor theme. */
144
99
  themeBridge?: ThemeBridge;
145
100
  }
146
101
  /**
147
- * Generate the HTML page for a prefab MCP Apps viewer resource.
148
- *
149
- * Returns the minimal HTML that loads `prefab.css` and `renderer.auto.min.js`
150
- * from the CDN, plus any additional scripts/stylesheets you specify.
102
+ * The viewer HTML: `prefab.css` and `renderer.auto.min.js` from the CDN, plus your scripts and stylesheets.
151
103
  *
152
104
  * @example
153
105
  * ```ts
@@ -175,22 +127,11 @@ export interface ViewerResourceOptions {
175
127
  stylesheets?: string[];
176
128
  /** Override CDN base URL (no trailing slash). */
177
129
  cdnBase?: string;
178
- /**
179
- * Inject a theme bridge stylesheet. `'vscode'` makes the viewer follow the
180
- * user's editor theme. See {@link RendererHtmlOptions.themeBridge}.
181
- */
130
+ /** See {@link RendererHtmlOptions.themeBridge}. */
182
131
  themeBridge?: ThemeBridge;
183
- /**
184
- * Cache fields for the `resources/read` result (SEP-2549).
185
- * @default { ttlMs: 86_400_000, cacheScope: 'public' }
186
- */
132
+ /** Cache fields for the `resources/read` result (SEP-2549). @default { ttlMs: 86_400_000, cacheScope: 'public' } */
187
133
  cache?: McpCacheHint;
188
- /**
189
- * Declare the `io.modelcontextprotocol/ui` extension capability on the
190
- * server (SEP-2133). Must happen before the server connects; a server that
191
- * is already connected keeps its existing capabilities and a warning is
192
- * logged. @default true
193
- */
134
+ /** Declare the `io.modelcontextprotocol/ui` capability (SEP-2133); only works before the server connects. @default true */
194
135
  declareCapability?: boolean;
195
136
  }
196
137
  /** Registration config accepted by both SDK generations. */
@@ -208,13 +149,7 @@ export type ResourceReadHandler = (uri: URL) => Promise<McpResourceReadResult<Mc
208
149
  interface CapabilityDeclaration {
209
150
  extensions?: Record<string, Record<string, unknown>>;
210
151
  }
211
- /**
212
- * MCP server interface expected by registerViewerResource.
213
- *
214
- * Structural rather than an SDK import, so fastmcp and hand-rolled servers stay
215
- * compatible. `registerResource` is preferred; `resource` is the v1 overload
216
- * that v2 retired and is used only as a fallback.
217
- */
152
+ /** The server shape registerViewerResource needs, structural so any SDK fits; `resource` is the v1 fallback. */
218
153
  export interface McpServerLike {
219
154
  registerResource?(name: string, uri: string, config: ResourceConfig, handler: ResourceReadHandler): unknown;
220
155
  resource?(name: string, uri: string, config: ResourceConfig, handler: ResourceReadHandler): unknown;
@@ -225,21 +160,10 @@ export interface McpServerLike {
225
160
  /** Some wrappers expose capability registration directly. */
226
161
  registerCapabilities?(capabilities: CapabilityDeclaration): void;
227
162
  }
228
- /**
229
- * Fill in and validate the `CacheableResult` fields, rejecting values the SDK
230
- * would silently discard in favour of `ttlMs: 0`.
231
- *
232
- * `defaults` differ per resource kind: the viewer HTML is a pure function of the
233
- * package version and is safely shared-cacheable, while an `a2ui://` surface is
234
- * rebuilt on every read and defaults to no caching. Exported so `./a2ui.ts`
235
- * resolves its hints through the same guard rather than restating it.
236
- */
163
+ /** Fill in and validate `CacheableResult` fields, throwing on values the SDK would silently replace with `ttlMs: 0`. */
237
164
  export declare function resolveCache(hint?: McpCacheHint, defaults?: Required<McpCacheHint>): Required<McpCacheHint>;
238
165
  /**
239
- * Register the prefab viewer as a `ui://` resource on an MCP server.
240
- *
241
- * Handles the MIME type, CSP on both listing and content item, HTML generation,
242
- * the `CacheableResult` fields and the Apps extension capability in one call.
166
+ * Register the prefab viewer as a `ui://` resource. The CSP admits jsDelivr and every origin the page loads from.
243
167
  *
244
168
  * @example
245
169
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"resource.d.ts","sourceRoot":"","sources":["../../src/mcp/resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,YAAY,EAAiB,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAA;AAC7G,OAAO,EAAkB,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAMpE,gDAAgD;AAChD,MAAM,WAAW,SAAS;IACxB,iEAAiE;IACjE,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,+CAA+C;IAC/C,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,0CAA0C;IAC1C,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;IACvB,oCAAoC;IACpC,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B;AAED,yDAAyD;AACzD,MAAM,WAAW,iBAAiB;IAChC,0DAA0D;IAC1D,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,gEAAgE;IAChE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,0DAA0D;IAC1D,cAAc,CAAC,EAAE,OAAO,CAAA;CACzB;AAED,MAAM,WAAW,mBAAmB;IAClC,iCAAiC;IACjC,GAAG,CAAC,EAAE,SAAS,CAAA;IACf,sDAAsD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,25 +1,11 @@
1
- /**
2
- * MCP Apps resource helpers — register the prefab viewer as a `ui://` resource.
3
- *
4
- * Covers the three things every MCP Apps host checks and the two the
5
- * 2026-07-28 protocol revision added:
6
- * - the `text/html;profile=mcp-app` MIME type,
7
- * - `_meta.ui` CSP / permissions on BOTH the listing and the content item,
8
- * - the viewer HTML itself (CDN-pinned to this exact package version),
9
- * - `ttlMs` / `cacheScope` on the read result (SEP-2549 `CacheableResult`),
10
- * - the `io.modelcontextprotocol/ui` extension capability (SEP-2133).
11
- */
1
+ /** Register the prefab viewer as a `ui://` MCP Apps resource: MIME type, `_meta.ui` on listing and content, CDN-pinned HTML, cache fields, extension capability. */
12
2
  import { VERSION } from '../app.js';
13
3
  import { createLogger } from '../core/logger.js';
14
4
  import { escapeHtml } from '../core/escape.js';
15
5
  import { themeBridgeCss } from './theme-bridge.js';
16
6
  const log = createLogger('mcp');
17
7
  /**
18
- * Generate the `_meta` object for MCP Apps `ui://` resource registration.
19
- *
20
- * Includes CSP and Permission Policy configuration per the MCP Apps spec.
21
- * Use on both the resource listing AND the content item (VS Code reads
22
- * only the content item; other hosts may read either).
8
+ * The `_meta` (CSP, permissions) for a `ui://` resource. Put it on the listing and the content item: VS Code reads only the latter.
23
9
  *
24
10
  * @example
25
11
  * ```ts
@@ -79,54 +65,21 @@ export const PREFAB_CDN_META = resourceMeta({
79
65
  export const PREFAB_RESOURCE_URI = 'ui://prefab/viewer';
80
66
  /** MIME type required by MCP Apps hosts. */
81
67
  export const MCP_APP_MIME = 'text/html;profile=mcp-app';
82
- /**
83
- * Capability key for the MCP Apps extension (versioned independently of core).
84
- *
85
- * The identifier is `…/ui`, and the trap here is that `…/apps` looks right and is
86
- * wrong. The normative source is the MCP Apps spec, which states "This extension is
87
- * identified as: `io.modelcontextprotocol/ui`" in both the current `2026-01-26`
88
- * revision and the draft, and the reference implementation agrees:
89
- * `ext-apps/src/server/index.ts` exports `EXTENSION_ID = "io.modelcontextprotocol/ui"`.
90
- *
91
- * `io.modelcontextprotocol/apps` appears only as illustrative "e.g." text in the Rust
92
- * and C# SDKs' generic `ServerCapabilities.extensions` doc comments (and their test
93
- * fixtures), showing the SHAPE of the extensions map rather than naming this extension.
94
- * Copying it from there declares the capability under a key no host looks up, which
95
- * fails silently: rendering still works, because hosts fall back to detecting apps via
96
- * `_meta.ui` plus the MIME type, so only the SEP-2133 declaration is lost.
97
- *
98
- * Duplicated as a literal rather than imported, because prefab ships zero dependencies.
99
- */
68
+ /** The MCP Apps extension id, `…/ui` per the spec and ext-apps (`…/apps` in some SDK doc examples is only illustrative). */
100
69
  export const APPS_EXTENSION = 'io.modelcontextprotocol/ui';
101
- /**
102
- * Default cache hint for the viewer resource.
103
- *
104
- * The HTML is a pure function of this package's `VERSION` (the CDN base pins
105
- * the exact version), so it cannot change for a given server build — it is
106
- * safely shared-cacheable. Without this the SDK falls back to the conservative
107
- * `{ ttlMs: 0, cacheScope: 'private' }` and the viewer is re-fetched every time.
108
- */
70
+ /** Viewer cache hint: the HTML is a pure function of `VERSION`, so it is shared-cacheable for a day. */
109
71
  export const DEFAULT_VIEWER_CACHE = {
110
72
  ttlMs: 86_400_000, // 24h
111
73
  cacheScope: 'public',
112
74
  };
113
- /**
114
- * Runtime whitelist for {@link McpCacheScope}.
115
- *
116
- * Kept as a value (not just the union type) so the guard in `resolveCache` still
117
- * rejects a bad scope handed over from untyped JS — a `!==` chain against the
118
- * union narrows itself away and validates nothing.
119
- */
75
+ /** Runtime list of {@link McpCacheScope}, so untyped JS callers are validated too. */
120
76
  const CACHE_SCOPES = ['public', 'private'];
121
77
  /** CDN base for the @maxhealth.tech/prefab package (exact version, never stale). */
122
78
  function cdnBase() {
123
79
  return `https://cdn.jsdelivr.net/npm/@maxhealth.tech/prefab@${VERSION}/dist`;
124
80
  }
125
81
  /**
126
- * Generate the HTML page for a prefab MCP Apps viewer resource.
127
- *
128
- * Returns the minimal HTML that loads `prefab.css` and `renderer.auto.min.js`
129
- * from the CDN, plus any additional scripts/stylesheets you specify.
82
+ * The viewer HTML: `prefab.css` and `renderer.auto.min.js` from the CDN, plus your scripts and stylesheets.
130
83
  *
131
84
  * @example
132
85
  * ```ts
@@ -141,8 +94,7 @@ function cdnBase() {
141
94
  export function rendererHtml(options) {
142
95
  const title = options?.title ?? 'Prefab';
143
96
  const base = options?.cdnBase ?? cdnBase();
144
- // Order in <head> is load-bearing: prefab.css, then the bridge (which must win
145
- // over it), then the caller's stylesheets as the outermost override.
97
+ // Order matters: prefab.css, then the bridge, then the caller's stylesheets.
146
98
  const bridge = options?.themeBridge
147
99
  ? ` <style>\n${themeBridgeCss(options.themeBridge)}\n </style>\n`
148
100
  : '';
@@ -166,15 +118,7 @@ ${bridge}${extraStyles}</head>
166
118
  ${extraScripts}</body>
167
119
  </html>`;
168
120
  }
169
- /**
170
- * Fill in and validate the `CacheableResult` fields, rejecting values the SDK
171
- * would silently discard in favour of `ttlMs: 0`.
172
- *
173
- * `defaults` differ per resource kind: the viewer HTML is a pure function of the
174
- * package version and is safely shared-cacheable, while an `a2ui://` surface is
175
- * rebuilt on every read and defaults to no caching. Exported so `./a2ui.ts`
176
- * resolves its hints through the same guard rather than restating it.
177
- */
121
+ /** Fill in and validate `CacheableResult` fields, throwing on values the SDK would silently replace with `ttlMs: 0`. */
178
122
  export function resolveCache(hint, defaults = DEFAULT_VIEWER_CACHE) {
179
123
  const ttlMs = hint?.ttlMs ?? defaults.ttlMs;
180
124
  if (!Number.isSafeInteger(ttlMs) || ttlMs < 0) {
@@ -188,8 +132,6 @@ export function resolveCache(hint, defaults = DEFAULT_VIEWER_CACHE) {
188
132
  }
189
133
  /** Declare the MCP Apps extension capability, tolerating servers that cannot. */
190
134
  function declareAppsExtension(server) {
191
- // Not named `declare` — that is a TS modifier keyword at statement position
192
- // and some transpilers refuse to parse a call to a binding of that name.
193
135
  const declareCaps = server.registerCapabilities?.bind(server)
194
136
  ?? server.server?.registerCapabilities?.bind(server.server);
195
137
  if (declareCaps == null)
@@ -198,16 +140,11 @@ function declareAppsExtension(server) {
198
140
  declareCaps({ extensions: { [APPS_EXTENSION]: {} } });
199
141
  }
200
142
  catch (e) {
201
- // Both SDK generations throw when called after connect. The server still
202
- // serves the resource — it just does not advertise the extension.
203
143
  log.warn(`could not declare the ${APPS_EXTENSION} capability (register the viewer before connecting):`, e);
204
144
  }
205
145
  }
206
146
  /**
207
- * Register the prefab viewer as a `ui://` resource on an MCP server.
208
- *
209
- * Handles the MIME type, CSP on both listing and content item, HTML generation,
210
- * the `CacheableResult` fields and the Apps extension capability in one call.
147
+ * Register the prefab viewer as a `ui://` resource. The CSP admits jsDelivr and every origin the page loads from.
211
148
  *
212
149
  * @example
213
150
  * ```ts
@@ -236,17 +173,17 @@ export function registerViewerResource(server, options) {
236
173
  baseUriDomains: options.csp.baseUriDomains ?? [],
237
174
  }
238
175
  : { resourceDomains: ['https://cdn.jsdelivr.net'] };
239
- // Add script origins to CSP resourceDomains
240
- if (options?.scripts && options.scripts.length > 0) {
241
- const scriptOrigins = options.scripts
242
- .map(url => { try {
243
- return new URL(url).origin;
176
+ const loadedFrom = [...(options?.scripts ?? []), ...(options?.stylesheets ?? []), ...(options?.cdnBase != null ? [options.cdnBase] : [])];
177
+ const loadedOrigins = loadedFrom.flatMap(url => {
178
+ try {
179
+ return [new URL(url).origin];
244
180
  }
245
181
  catch {
246
- return null;
247
- } })
248
- .filter((o) => o !== null);
249
- csp.resourceDomains = [...new Set([...(csp.resourceDomains ?? []), ...scriptOrigins])];
182
+ return [];
183
+ }
184
+ });
185
+ if (loadedOrigins.length > 0) {
186
+ csp.resourceDomains = [...new Set([...(csp.resourceDomains ?? []), ...loadedOrigins])];
250
187
  }
251
188
  const meta = resourceMeta({ csp, permissions: options?.permissions });
252
189
  const html = rendererHtml({
@@ -268,13 +205,9 @@ export function registerViewerResource(server, options) {
268
205
  text: html,
269
206
  _meta: meta,
270
207
  }],
271
- // Handler-provided cache fields take precedence over any server hint, and
272
- // make the result spec-compliant on servers that fill in nothing.
273
208
  ttlMs: cache.ttlMs,
274
209
  cacheScope: cache.cacheScope,
275
210
  });
276
- // registerResource is the current API in both SDK generations; resource() is
277
- // the v1 overload that v2 dropped.
278
211
  const register = server.registerResource?.bind(server) ?? server.resource?.bind(server);
279
212
  if (register == null) {
280
213
  throw new TypeError('registerViewerResource: server exposes neither registerResource() nor resource()');
@@ -1 +1 @@
1
- {"version":3,"file":"resource.js","sourceRoot":"","sources":["../../src/mcp/resource.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAE9C,OAAO,EAAE,cAAc,EAAoB,MAAM,mBAAmB,CAAA;AAEpE,MAAM,GAAG,GAAG,YAAY,CAAC,KAAK,CAAC,CAAA;AA2C/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,YAAY,CAAC,OAA6B;IACxD,MAAM,EAAE,GAA6D,EAAE,CAAA;IAEvE,IAAI,OAAO,EAAE,GAAG,EAAE,CAAC;QACjB,EAAE,CAAC,GAAG,GAAG;YACP,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,EAAE;YAClD,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE;YAChD,YAAY,EAAE,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,EAAE;YAC5C,cAAc,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE;SACjD,CAAA;IACH,CAAC;IAED,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC;QACzB,EAAE,CAAC,WAAW,GAAG,EAAE,CAAA;QACnB,IAAI,OAAO,CAAC,WAAW,CAAC,MAAM;YAAE,EAAE,CAAC,WAAW,CAAC,MAAM,GAAG,EAAE,CAAA;QAC1D,IAAI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F,MAAM,QAAQ,GAAG,MAAM,CAAC,gBAAgB,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC,CAAA;IACvF,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,IAAI,SAAS,CAAC,kFAAkF,CAAC,CAAA;IACzG,CAAC;IACD,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAA;AACtC,CAAC"}
@@ -1,36 +1,11 @@
1
- /**
2
- * MCP tool-result envelope.
3
- *
4
- * Every prefab display helper returns the same shape: the wire JSON as a text
5
- * content block plus `structuredContent` for MCP Apps hosts to hand to the
6
- * iframe. Building that envelope in one place keeps the `display_*` builders
7
- * identical by construction.
8
- *
9
- * `structuredContent` is typed through the generic rather than widened to
10
- * `Record<string, unknown>`, so callers keep the wire type and no cast is
11
- * needed anywhere (protocol revision 2026-07-28 loosened the field to any JSON
12
- * value — SEP-2106).
13
- *
14
- * `resultType` (SEP-2322) is deliberately NOT set here. It is a wire-only
15
- * discriminator owned by the SDK's protocol layer: `@modelcontextprotocol/server`
16
- * stamps it at its 2026-era encode seam and strips it before results reach
17
- * consumers, which is why its public result types do not declare it.
18
- *
19
- * The one handler-authored case is `resultType: 'input_required'`, which a
20
- * completed result never carries. That case is built by `./input-required.ts`
21
- * and returned instead of a tool result, so it never travels through here.
22
- */
1
+ /** The one tool-result envelope every `display_*` helper returns. `resultType` (SEP-2322) is left to the SDK, which stamps it on encode. */
23
2
  import type { McpDisplayResult } from './types.js';
24
3
  export interface ToolResultOptions {
25
4
  /** Flag the result as failed (hosts render it as a tool error). */
26
5
  isError?: boolean;
27
6
  }
28
7
  /**
29
- * Wrap a JSON payload as an MCP tool result.
30
- *
31
- * The payload is serialized into `content[0].text` (for hosts and models that
32
- * read text) and passed through as `structuredContent` (for MCP Apps iframes,
33
- * which receive it via `ui/notifications/tool-result`).
8
+ * Wrap a JSON payload as an MCP tool result: serialized into `content[0].text` and passed through as `structuredContent`.
34
9
  *
35
10
  * @example
36
11
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/mcp/result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAO1F"}
1
+ {"version":3,"file":"result.d.ts","sourceRoot":"","sources":["../../src/mcp/result.ts"],"names":[],"mappings":"AAAA,4IAA4I;AAE5I,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAElD,MAAM,WAAW,iBAAiB;IAChC,mEAAmE;IACnE,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAO1F"}
@@ -1,31 +1,6 @@
1
+ /** The one tool-result envelope every `display_*` helper returns. `resultType` (SEP-2322) is left to the SDK, which stamps it on encode. */
1
2
  /**
2
- * MCP tool-result envelope.
3
- *
4
- * Every prefab display helper returns the same shape: the wire JSON as a text
5
- * content block plus `structuredContent` for MCP Apps hosts to hand to the
6
- * iframe. Building that envelope in one place keeps the `display_*` builders
7
- * identical by construction.
8
- *
9
- * `structuredContent` is typed through the generic rather than widened to
10
- * `Record<string, unknown>`, so callers keep the wire type and no cast is
11
- * needed anywhere (protocol revision 2026-07-28 loosened the field to any JSON
12
- * value — SEP-2106).
13
- *
14
- * `resultType` (SEP-2322) is deliberately NOT set here. It is a wire-only
15
- * discriminator owned by the SDK's protocol layer: `@modelcontextprotocol/server`
16
- * stamps it at its 2026-era encode seam and strips it before results reach
17
- * consumers, which is why its public result types do not declare it.
18
- *
19
- * The one handler-authored case is `resultType: 'input_required'`, which a
20
- * completed result never carries. That case is built by `./input-required.ts`
21
- * and returned instead of a tool result, so it never travels through here.
22
- */
23
- /**
24
- * Wrap a JSON payload as an MCP tool result.
25
- *
26
- * The payload is serialized into `content[0].text` (for hosts and models that
27
- * read text) and passed through as `structuredContent` (for MCP Apps iframes,
28
- * which receive it via `ui/notifications/tool-result`).
3
+ * Wrap a JSON payload as an MCP tool result: serialized into `content[0].text` and passed through as `structuredContent`.
29
4
  *
30
5
  * @example
31
6
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/mcp/result.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AASH;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,UAAU,CAAI,OAAU,EAAE,OAA2B;IACnE,MAAM,MAAM,GAAwB;QAClC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1D,iBAAiB,EAAE,OAAO;KAC3B,CAAA;IACD,IAAI,OAAO,EAAE,OAAO;QAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA;IAC3C,OAAO,MAAM,CAAA;AACf,CAAC"}
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/mcp/result.ts"],"names":[],"mappings":"AAAA,4IAA4I;AAS5I;;;;;;;;;;GAUG;AACH,MAAM,UAAU,UAAU,CAAI,OAAU,EAAE,OAA2B;IACnE,MAAM,MAAM,GAAwB;QAClC,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1D,iBAAiB,EAAE,OAAO;KAC3B,CAAA;IACD,IAAI,OAAO,EAAE,OAAO;QAAE,MAAM,CAAC,OAAO,GAAG,IAAI,CAAA;IAC3C,OAAO,MAAM,CAAA;AACf,CAAC"}
@@ -1,20 +1,6 @@
1
1
  /**
2
- * VS Code theme bridge for the viewer HTML.
3
- *
4
- * `prefab.css` resolves every token through a fallback chain: MCP Apps host
5
- * variable first, then the VS Code webview variable, then a static default.
6
- * That ordering is right in general, but it means a host which defines the MCP
7
- * Apps `--color-*` variables shadows the VS Code ones entirely, and the viewer
8
- * stops following the user's editor theme.
9
- *
10
- * This module emits a stylesheet that re-declares the affected tokens with the
11
- * VS Code variable *first* and the MCP Apps layer dropped, at a specificity and
12
- * document position that beat each of `prefab.css`'s four token blocks. It is
13
- * opt-in via `rendererHtml({ themeBridge: 'vscode' })`.
14
- *
15
- * The table below is the single source of truth for the mapping.
16
- * `test/theme-bridge.test.ts` cross-checks every entry against `prefab.css`, so
17
- * the bridge cannot drift from the base theme it overrides.
2
+ * VS Code theme bridge: re-declares tokens with the `--vscode-*` variable first, so a host's MCP Apps `--color-*`
3
+ * layer no longer shadows the editor theme. `test/theme-bridge.test.ts` checks the table against `prefab.css`.
18
4
  */
19
5
  /** How one prefab token is sourced from the VS Code webview. */
20
6
  export interface VsCodeTokenSource {
@@ -25,30 +11,13 @@ export interface VsCodeTokenSource {
25
11
  /** Dark-scheme fallback. Omitted for scheme-independent tokens (fonts). */
26
12
  dark?: string;
27
13
  }
28
- /**
29
- * prefab tokens that VS Code can supply, with the same variables and static
30
- * fallbacks `prefab.css` uses. Tokens VS Code has no equivalent for (`--success`,
31
- * `--warning`, shadows, radii) are deliberately absent: the bridge only overrides
32
- * what the editor can actually provide.
33
- */
14
+ /** prefab tokens VS Code can supply, with `prefab.css`'s own fallbacks; tokens it cannot supply are absent. */
34
15
  export declare const VSCODE_BRIDGE: Readonly<Record<string, VsCodeTokenSource>>;
35
16
  /** Supported theme bridges. */
36
17
  export type ThemeBridge = 'vscode';
37
18
  /**
38
- * Generate the theme-bridge CSS (the contents of a `<style>` element).
39
- *
40
- * Mirrors the selectors `prefab.css` uses for *host-driven* tokens, so the
41
- * override lands in both schemes rather than only in light mode: the `:root`
42
- * default (alongside `[data-theme="light"]`, whose higher specificity would
43
- * otherwise win) and the `prefers-color-scheme: dark` media block. Each selector
44
- * matches its counterpart's specificity and is emitted after `prefab.css`, so it
45
- * wins on document order.
46
- *
47
- * `:root[data-theme="dark"]` is deliberately NOT bridged. That block is
48
- * prefab's standalone dark palette with static values and no host chain at all,
49
- * the explicit separation of host theming (which cascades) from the manual theme
50
- * toggle. Overriding it would make an app that pins `data-theme="dark"` follow
51
- * the editor instead of its own choice.
19
+ * The theme-bridge CSS, matching `prefab.css`'s host-driven selectors in both schemes. `[data-theme="dark"]` is
20
+ * left alone, so an app that pins it keeps its own palette.
52
21
  *
53
22
  * @example
54
23
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"theme-bridge.d.ts","sourceRoot":"","sources":["../../src/mcp/theme-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CA2BrE,CAAA;AAED,+BAA+B;AAC/B,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAA;AAqBlC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAe1D"}
1
+ {"version":3,"file":"theme-bridge.d.ts","sourceRoot":"","sources":["../../src/mcp/theme-bridge.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,gEAAgE;AAChE,MAAM,WAAW,iBAAiB;IAChC,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAA;IACd,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,2EAA2E;IAC3E,IAAI,CAAC,EAAE,MAAM,CAAA;CACd;AAED,+GAA+G;AAC/G,eAAO,MAAM,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CA2BrE,CAAA;AAED,+BAA+B;AAC/B,MAAM,MAAM,WAAW,GAAG,QAAQ,CAAA;AAelC;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,GAAG,MAAM,CAe1D"}
@@ -1,27 +1,8 @@
1
1
  /**
2
- * VS Code theme bridge for the viewer HTML.
3
- *
4
- * `prefab.css` resolves every token through a fallback chain: MCP Apps host
5
- * variable first, then the VS Code webview variable, then a static default.
6
- * That ordering is right in general, but it means a host which defines the MCP
7
- * Apps `--color-*` variables shadows the VS Code ones entirely, and the viewer
8
- * stops following the user's editor theme.
9
- *
10
- * This module emits a stylesheet that re-declares the affected tokens with the
11
- * VS Code variable *first* and the MCP Apps layer dropped, at a specificity and
12
- * document position that beat each of `prefab.css`'s four token blocks. It is
13
- * opt-in via `rendererHtml({ themeBridge: 'vscode' })`.
14
- *
15
- * The table below is the single source of truth for the mapping.
16
- * `test/theme-bridge.test.ts` cross-checks every entry against `prefab.css`, so
17
- * the bridge cannot drift from the base theme it overrides.
18
- */
19
- /**
20
- * prefab tokens that VS Code can supply, with the same variables and static
21
- * fallbacks `prefab.css` uses. Tokens VS Code has no equivalent for (`--success`,
22
- * `--warning`, shadows, radii) are deliberately absent: the bridge only overrides
23
- * what the editor can actually provide.
2
+ * VS Code theme bridge: re-declares tokens with the `--vscode-*` variable first, so a host's MCP Apps `--color-*`
3
+ * layer no longer shadows the editor theme. `test/theme-bridge.test.ts` checks the table against `prefab.css`.
24
4
  */
5
+ /** prefab tokens VS Code can supply, with `prefab.css`'s own fallbacks; tokens it cannot supply are absent. */
25
6
  export const VSCODE_BRIDGE = {
26
7
  'background': { vscode: 'vscode-editor-background', light: '#ffffff', dark: '#09090b' },
27
8
  'foreground': { vscode: 'vscode-editor-foreground', light: '#09090b', dark: '#fafafa' },
@@ -50,13 +31,7 @@ export const VSCODE_BRIDGE = {
50
31
  light: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace',
51
32
  },
52
33
  };
53
- /**
54
- * Runtime whitelist for {@link ThemeBridge}.
55
- *
56
- * Kept as a value, not just the union type, so the guard in `themeBridgeCss`
57
- * still rejects a bad name handed over from untyped JS. A `!==` chain against a
58
- * single-member union narrows itself away and validates nothing.
59
- */
34
+ /** Runtime list of {@link ThemeBridge}, so untyped JS callers are validated too. */
60
35
  const THEME_BRIDGES = ['vscode'];
61
36
  function declarations(scheme, indent) {
62
37
  return Object.entries(VSCODE_BRIDGE)
@@ -68,20 +43,8 @@ function declarations(scheme, indent) {
68
43
  .join('\n');
69
44
  }
70
45
  /**
71
- * Generate the theme-bridge CSS (the contents of a `<style>` element).
72
- *
73
- * Mirrors the selectors `prefab.css` uses for *host-driven* tokens, so the
74
- * override lands in both schemes rather than only in light mode: the `:root`
75
- * default (alongside `[data-theme="light"]`, whose higher specificity would
76
- * otherwise win) and the `prefers-color-scheme: dark` media block. Each selector
77
- * matches its counterpart's specificity and is emitted after `prefab.css`, so it
78
- * wins on document order.
79
- *
80
- * `:root[data-theme="dark"]` is deliberately NOT bridged. That block is
81
- * prefab's standalone dark palette with static values and no host chain at all,
82
- * the explicit separation of host theming (which cascades) from the manual theme
83
- * toggle. Overriding it would make an app that pins `data-theme="dark"` follow
84
- * the editor instead of its own choice.
46
+ * The theme-bridge CSS, matching `prefab.css`'s host-driven selectors in both schemes. `[data-theme="dark"]` is
47
+ * left alone, so an app that pins it keeps its own palette.
85
48
  *
86
49
  * @example
87
50
  * ```ts
@@ -1 +1 @@
1
- {"version":3,"file":"theme-bridge.js","sourceRoot":"","sources":["../../src/mcp/theme-bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAYH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAgD;IACxE,YAAY,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACvF,YAAY,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACvF,MAAM,EAAE,EAAE,MAAM,EAAE,gCAAgC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACvF,iBAAiB,EAAE,EAAE,MAAM,EAAE,gCAAgC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IAClG,SAAS,EAAE,EAAE,MAAM,EAAE,qCAAqC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/F,oBAAoB,EAAE,EAAE,MAAM,EAAE,qCAAqC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IAC1G,SAAS,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IACpF,oBAAoB,EAAE,EAAE,MAAM,EAAE,0BAA0B,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/F,WAAW,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE;IAC/F,sBAAsB,EAAE,EAAE,MAAM,EAAE,mCAAmC,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAA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