@vantageos/mosaic 0.4.0 → 0.5.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 (150) hide show
  1. package/CHANGELOG.md +39 -15
  2. package/README.md +114 -5
  3. package/dist/PipelineBoard-FucyGArR.d.cts +759 -0
  4. package/dist/PipelineBoard-FucyGArR.d.ts +759 -0
  5. package/dist/PipelineBoard.markdown-DIcvrS-2.d.cts +16 -0
  6. package/dist/PipelineBoard.markdown-DIcvrS-2.d.ts +16 -0
  7. package/dist/{StatusBadge.schema-1tOjB4Ir.d.cts → StatusBadge.schema-BEjSH2_4.d.cts} +2 -2
  8. package/dist/{StatusBadge.schema-1tOjB4Ir.d.ts → StatusBadge.schema-BEjSH2_4.d.ts} +2 -2
  9. package/dist/{Tabs.schema-BzcEyeq8.d.cts → Tabs.schema-Dqr6vwV3.d.cts} +2 -2
  10. package/dist/{Tabs.schema-BzcEyeq8.d.ts → Tabs.schema-Dqr6vwV3.d.ts} +2 -2
  11. package/dist/Timeline-Coo_3tA_.d.cts +114 -0
  12. package/dist/Timeline-Coo_3tA_.d.ts +114 -0
  13. package/dist/Timeline.markdown-C6UPDv1H.d.cts +4 -0
  14. package/dist/Timeline.markdown-C6UPDv1H.d.ts +4 -0
  15. package/dist/TransactionPreview-BzWDn8kE.d.cts +391 -0
  16. package/dist/TransactionPreview-BzWDn8kE.d.ts +391 -0
  17. package/dist/TransactionPreview.markdown-Dpb0VYgN.d.cts +7 -0
  18. package/dist/TransactionPreview.markdown-Dpb0VYgN.d.ts +7 -0
  19. package/dist/artifacts.cjs +186 -2
  20. package/dist/artifacts.cjs.map +1 -1
  21. package/dist/artifacts.js +186 -2
  22. package/dist/artifacts.js.map +1 -1
  23. package/dist/confirmation.cjs +724 -2
  24. package/dist/confirmation.cjs.map +1 -1
  25. package/dist/confirmation.d.cts +2 -1
  26. package/dist/confirmation.d.ts +2 -1
  27. package/dist/confirmation.js +722 -4
  28. package/dist/confirmation.js.map +1 -1
  29. package/dist/display.cjs +1551 -203
  30. package/dist/display.cjs.map +1 -1
  31. package/dist/display.d.cts +6 -229
  32. package/dist/display.d.ts +6 -229
  33. package/dist/display.js +1535 -206
  34. package/dist/display.js.map +1 -1
  35. package/dist/forms.cjs +139 -46
  36. package/dist/forms.cjs.map +1 -1
  37. package/dist/forms.d.cts +2 -2
  38. package/dist/forms.d.ts +2 -2
  39. package/dist/forms.js +139 -46
  40. package/dist/forms.js.map +1 -1
  41. package/dist/host.cjs +822 -0
  42. package/dist/host.cjs.map +1 -0
  43. package/dist/host.d.cts +287 -0
  44. package/dist/host.d.ts +287 -0
  45. package/dist/host.js +794 -0
  46. package/dist/host.js.map +1 -0
  47. package/dist/{index-CwXVgtGb.d.cts → index-BadRcCbm.d.cts} +28 -11
  48. package/dist/{index-CwXVgtGb.d.ts → index-BadRcCbm.d.ts} +28 -11
  49. package/dist/index.cjs +2198 -247
  50. package/dist/index.cjs.map +1 -1
  51. package/dist/index.d.cts +42 -8
  52. package/dist/index.d.ts +42 -8
  53. package/dist/index.js +2163 -251
  54. package/dist/index.js.map +1 -1
  55. package/dist/input.d.cts +2 -2
  56. package/dist/input.d.ts +2 -2
  57. package/dist/media.cjs +186 -2
  58. package/dist/media.cjs.map +1 -1
  59. package/dist/media.d.cts +1 -1
  60. package/dist/media.d.ts +1 -1
  61. package/dist/media.js +186 -2
  62. package/dist/media.js.map +1 -1
  63. package/dist/preact/artifacts.js +186 -2
  64. package/dist/preact/artifacts.js.map +1 -1
  65. package/dist/preact/confirmation.d.ts +321 -1
  66. package/dist/preact/confirmation.js +625 -4
  67. package/dist/preact/confirmation.js.map +1 -1
  68. package/dist/preact/display.d.ts +544 -47
  69. package/dist/preact/display.js +1190 -126
  70. package/dist/preact/display.js.map +1 -1
  71. package/dist/preact/forms.d.ts +32 -15
  72. package/dist/preact/forms.js +139 -46
  73. package/dist/preact/forms.js.map +1 -1
  74. package/dist/preact/host.d.ts +307 -0
  75. package/dist/preact/host.js +875 -0
  76. package/dist/preact/host.js.map +1 -0
  77. package/dist/preact/media.d.ts +37 -1
  78. package/dist/preact/media.js +423 -0
  79. package/dist/preact/media.js.map +1 -1
  80. package/dist/preact/progress.d.ts +92 -1
  81. package/dist/preact/progress.js +465 -3
  82. package/dist/preact/progress.js.map +1 -1
  83. package/dist/progress.cjs +521 -2
  84. package/dist/progress.cjs.map +1 -1
  85. package/dist/progress.d.cts +2 -1
  86. package/dist/progress.d.ts +2 -1
  87. package/dist/progress.js +518 -3
  88. package/dist/progress.js.map +1 -1
  89. package/dist/react/artifacts.cjs +186 -2
  90. package/dist/react/artifacts.cjs.map +1 -1
  91. package/dist/react/artifacts.js +186 -2
  92. package/dist/react/artifacts.js.map +1 -1
  93. package/dist/react/confirmation.cjs +626 -2
  94. package/dist/react/confirmation.cjs.map +1 -1
  95. package/dist/react/confirmation.d.cts +3 -3
  96. package/dist/react/confirmation.d.ts +3 -3
  97. package/dist/react/confirmation.js +625 -4
  98. package/dist/react/confirmation.js.map +1 -1
  99. package/dist/react/display.cjs +1076 -123
  100. package/dist/react/display.cjs.map +1 -1
  101. package/dist/react/display.d.cts +13 -27
  102. package/dist/react/display.d.ts +13 -27
  103. package/dist/react/display.js +1064 -126
  104. package/dist/react/display.js.map +1 -1
  105. package/dist/react/forms.cjs +139 -46
  106. package/dist/react/forms.cjs.map +1 -1
  107. package/dist/react/forms.d.cts +1 -1
  108. package/dist/react/forms.d.ts +1 -1
  109. package/dist/react/forms.js +139 -46
  110. package/dist/react/forms.js.map +1 -1
  111. package/dist/react/host.cjs +910 -0
  112. package/dist/react/host.cjs.map +1 -0
  113. package/dist/react/host.d.cts +24 -0
  114. package/dist/react/host.d.ts +24 -0
  115. package/dist/react/host.js +875 -0
  116. package/dist/react/host.js.map +1 -0
  117. package/dist/react/input.d.cts +1 -1
  118. package/dist/react/input.d.ts +1 -1
  119. package/dist/react/media.cjs +426 -0
  120. package/dist/react/media.cjs.map +1 -1
  121. package/dist/react/media.d.cts +19 -1
  122. package/dist/react/media.d.ts +19 -1
  123. package/dist/react/media.js +423 -0
  124. package/dist/react/media.js.map +1 -1
  125. package/dist/react/progress.cjs +467 -2
  126. package/dist/react/progress.cjs.map +1 -1
  127. package/dist/react/progress.d.cts +1 -1
  128. package/dist/react/progress.d.ts +1 -1
  129. package/dist/react/progress.js +465 -3
  130. package/dist/react/progress.js.map +1 -1
  131. package/dist/server/resource.cjs +151 -0
  132. package/dist/server/resource.cjs.map +1 -0
  133. package/dist/server/resource.d.cts +90 -0
  134. package/dist/server/resource.d.ts +90 -0
  135. package/dist/server/resource.js +147 -0
  136. package/dist/server/resource.js.map +1 -0
  137. package/dist/server.cjs +1100 -25
  138. package/dist/server.cjs.map +1 -1
  139. package/dist/server.d.cts +84 -5
  140. package/dist/server.d.ts +84 -5
  141. package/dist/server.js +1087 -27
  142. package/dist/server.js.map +1 -1
  143. package/package.json +250 -233
  144. package/registry.yaml +44 -2
  145. package/dist/Alert.schema-LPJE5gFP.d.cts +0 -71
  146. package/dist/Alert.schema-LPJE5gFP.d.ts +0 -71
  147. package/dist/ProgressBar.schema-CdVYx0Wq.d.cts +0 -22
  148. package/dist/ProgressBar.schema-CdVYx0Wq.d.ts +0 -22
  149. package/dist/{ConfirmDialog-B3CQQGmJ.d.cts → ConfirmDialog-BCtOcmHe.d.cts} +1 -1
  150. package/dist/{ConfirmDialog-B3CQQGmJ.d.ts → ConfirmDialog-BCtOcmHe.d.ts} +1 -1
package/dist/host.d.ts ADDED
@@ -0,0 +1,287 @@
1
+ /**
2
+ * Compile-time mirror of `@vantageos/mosaic-i18n` EN/FR locales for all
3
+ * Mosaic components (v0.3.0). Inlined here so that `<Comp>` renderers can
4
+ * resolve `t(key, locale)` without dragging react-i18next into the component
5
+ * runtime (keeps bundle small and tests provider-free). Drift is gated by
6
+ * `mosaic-registry-drift-check.mjs` which validates the canonical
7
+ * `packages/mosaic-i18n/src/locales/{en,fr}.json` against `registry.yaml`.
8
+ *
9
+ * Mosaic standard §8: production JSX MUST resolve user-facing strings via
10
+ * `t()` — no hardcoded English literals.
11
+ *
12
+ * Forms keys added — v0.3.0-C-PR1 (Axis 5/6 i18n pass).
13
+ * Convention: Forms.<Component>.<context>.<id>
14
+ */
15
+ type MosaicLocale = "en" | "fr";
16
+
17
+ /**
18
+ * Typed `ui/update-model-context` content blocks (H03) and the `openai/modelContext` reader.
19
+ *
20
+ * Spec: openai/mcp-extensions docs/spec.md, "ui/update-model-context Extensions"
21
+ * (local copy openai-mcp-ext-spec.md):
22
+ * l.1022 `_meta["openai/title"]`: non-empty string on `text` and `image` blocks.
23
+ * l.1042 `_meta["openai/thumbnail"]`: an `MCP.Icon` on `text` blocks (not yet on iOS, l.1046).
24
+ * l.1070 `annotations.audience: ["assistant"]` hides a block from the user (the model still
25
+ * receives it).
26
+ * l.1072 serialized `structuredContent` in a text block SHOULD set audience `["assistant"]`.
27
+ * l.945 `ui/update-model-context` is idempotent: each call replaces the app's previous context,
28
+ * so an empty `content` array is how a cleared selection is expressed.
29
+ * l.962-975 `hostContext["openai/modelContext"]` = `{ updateId, content?, structuredContent? }`
30
+ * or `null` once the user removed it.
31
+ * Everything here is additive: a host that ignores `_meta` loses only the label.
32
+ */
33
+
34
+ /** `MCP.Icon` (the fields a thumbnail needs). */
35
+ interface IconLike {
36
+ src: string;
37
+ mimeType?: string;
38
+ sizes?: string[];
39
+ }
40
+ type ModelContextBlock = {
41
+ type: string;
42
+ [key: string]: unknown;
43
+ };
44
+ interface TextBlockOptions {
45
+ /** `_meta["openai/title"]`: a human-readable label for the attachment. */
46
+ title?: string;
47
+ /** `_meta["openai/thumbnail"]`. */
48
+ thumbnail?: IconLike;
49
+ /** `annotations.audience: ["assistant"]`: context for the model, no composer attachment. */
50
+ background?: boolean;
51
+ }
52
+ type ModelContextHostState = {
53
+ updateId: string;
54
+ content?: ModelContextBlock[];
55
+ structuredContent?: Record<string, unknown>;
56
+ } | null;
57
+ declare function textBlock(text: string, options?: TextBlockOptions): ModelContextBlock;
58
+ /** Backward-compatible serialization of `structuredContent`, hidden from the user (spec l.1072). */
59
+ declare function structuredContentBlock(value: Record<string, unknown>): ModelContextBlock;
60
+ declare function buildModelContext(input: {
61
+ blocks?: ModelContextBlock[];
62
+ structuredContent?: Record<string, unknown>;
63
+ }): ModelContextParams;
64
+ /**
65
+ * Reads `hostContext["openai/modelContext"]`. `undefined`: key absent or malformed; `null`:
66
+ * the host reports the context cleared.
67
+ */
68
+ declare function readModelContextState(raw: unknown): ModelContextHostState | undefined;
69
+ /**
70
+ * What the model should know about a table selection: one titled block listing each selected row
71
+ * as `header: value` pairs. An empty selection yields an empty `content`, which replaces (clears)
72
+ * the previous context because the call is idempotent per app instance.
73
+ */
74
+ declare function selectionModelContext(rows: Array<Record<string, unknown>>, columns: Array<{
75
+ key: string;
76
+ header: string;
77
+ }>, locale?: MosaicLocale): ModelContextParams;
78
+
79
+ /**
80
+ * Safe-area insets (H01).
81
+ *
82
+ * Spec: MCP Apps 2026-01-26 (ext-apps-spec.mdx l.582-587) `HostContext.safeAreaInsets`
83
+ * = `{ top, right, bottom, left }` in pixels. Claude design guidelines: apply them as padding on
84
+ * the root container (or as `scroll-padding` on scroll-snap containers). Pure and DOM-free
85
+ * except `applySafeAreaInsets`, which takes its target element explicitly.
86
+ */
87
+ interface SafeAreaInsets {
88
+ top: number;
89
+ right: number;
90
+ bottom: number;
91
+ left: number;
92
+ }
93
+ /** Reads `hostContext.safeAreaInsets`; `undefined` unless all four sides are finite px >= 0. */
94
+ declare function readSafeAreaInsets(raw: unknown): SafeAreaInsets | undefined;
95
+ /** CSS padding shorthand (top right bottom left). */
96
+ declare function safeAreaPadding(insets: SafeAreaInsets): string;
97
+ /**
98
+ * Applies the insets as padding on `root` and exposes them as `--mosaic-safe-area-<side>` for
99
+ * scroll-padding. `undefined` clears both (the host reported none).
100
+ */
101
+ declare function applySafeAreaInsets(insets: SafeAreaInsets | undefined, root: HTMLElement): void;
102
+
103
+ /**
104
+ * Host style variables and fonts (H02) — framework-agnostic, structural (no ext-apps import).
105
+ *
106
+ * Spec: MCP Apps 2026-01-26 (ext-apps-spec.mdx):
107
+ * l.547-555 `HostContext.styles = { variables?: Record<McpUiStyleVariableKey, string|undefined>,
108
+ * css?: { fonts?: string } }`
109
+ * l.799-888 `McpUiStyleVariableKey`, the 76 standardized keys below (extracted from the spec
110
+ * block by command, not retyped)
111
+ * l.895-905 "Views should set default fallback values ... to account for hosts who don't pass
112
+ * some or all style variables": here the mosaic-tokens defaults are the fallback,
113
+ * because only the variables the host passes are written.
114
+ * Claude transparent-theming page: fonts need `https://assets.claude.ai` in `resourceDomains`;
115
+ * html and body backgrounds are set to `transparent`.
116
+ * Composes with ext-apps `applyHostStyleVariables` / `applyDocumentTheme` structurally; either can
117
+ * be used instead, nothing here imports them.
118
+ */
119
+ declare const MCP_STYLE_VARIABLE_KEYS: readonly ["--color-background-primary", "--color-background-secondary", "--color-background-tertiary", "--color-background-inverse", "--color-background-ghost", "--color-background-info", "--color-background-danger", "--color-background-success", "--color-background-warning", "--color-background-disabled", "--color-text-primary", "--color-text-secondary", "--color-text-tertiary", "--color-text-inverse", "--color-text-info", "--color-text-danger", "--color-text-success", "--color-text-warning", "--color-text-disabled", "--color-text-ghost", "--color-border-primary", "--color-border-secondary", "--color-border-tertiary", "--color-border-inverse", "--color-border-ghost", "--color-border-info", "--color-border-danger", "--color-border-success", "--color-border-warning", "--color-border-disabled", "--color-ring-primary", "--color-ring-secondary", "--color-ring-inverse", "--color-ring-info", "--color-ring-danger", "--color-ring-success", "--color-ring-warning", "--font-sans", "--font-mono", "--font-weight-normal", "--font-weight-medium", "--font-weight-semibold", "--font-weight-bold", "--font-text-xs-size", "--font-text-sm-size", "--font-text-md-size", "--font-text-lg-size", "--font-heading-xs-size", "--font-heading-sm-size", "--font-heading-md-size", "--font-heading-lg-size", "--font-heading-xl-size", "--font-heading-2xl-size", "--font-heading-3xl-size", "--font-text-xs-line-height", "--font-text-sm-line-height", "--font-text-md-line-height", "--font-text-lg-line-height", "--font-heading-xs-line-height", "--font-heading-sm-line-height", "--font-heading-md-line-height", "--font-heading-lg-line-height", "--font-heading-xl-line-height", "--font-heading-2xl-line-height", "--font-heading-3xl-line-height", "--border-radius-xs", "--border-radius-sm", "--border-radius-md", "--border-radius-lg", "--border-radius-xl", "--border-radius-full", "--border-width-regular", "--shadow-hairline", "--shadow-sm", "--shadow-md", "--shadow-lg"];
120
+ type McpStyleVariableKey = (typeof MCP_STYLE_VARIABLE_KEYS)[number];
121
+ interface HostStyles {
122
+ variables: Partial<Record<McpStyleVariableKey, string>>;
123
+ fonts: string | undefined;
124
+ }
125
+ /**
126
+ * Host variable -> mosaic-tokens custom properties it drives. Declared mapping (a design
127
+ * decision, not a spec fact); `style-variables.test.ts` asserts every target exists in
128
+ * `mosaic-tokens/src/tokens.css`.
129
+ */
130
+ declare const HOST_TO_MOSAIC_TOKENS: Partial<Record<McpStyleVariableKey, readonly string[]>>;
131
+ /** Origin Claude serves host fonts from; add it to `resourceDomains` to load `styles.css.fonts`. */
132
+ declare const CLAUDE_HOST_FONT_ORIGIN = "https://assets.claude.ai";
133
+ /** Reads `hostContext.styles`; unknown keys and non-string values are dropped. */
134
+ declare function readHostStyles(raw: unknown): HostStyles | undefined;
135
+ /**
136
+ * Writes the host variables on `root`, and the mosaic-tokens custom properties they drive.
137
+ * Variables a previous call set and this one no longer carries are cleared; `undefined` clears
138
+ * all. Variables the host never passed are not written, so mosaic-tokens defaults remain.
139
+ */
140
+ declare function applyHostStyleVariables(styles: HostStyles | undefined, root: HTMLElement): void;
141
+ /** Injects `styles.css.fonts` as one `<style>` in `<head>`; replaced on change, removed when absent. */
142
+ declare function applyHostFonts(css: string | undefined, doc: Document): void;
143
+ /** Claude transparent theming: html and body backgrounds are explicitly `transparent`. */
144
+ declare function applyTransparentBackground(doc: Document): void;
145
+
146
+ /** Failure of a host request (`ui/message`, `ui/open-link`): carries the method and the reason. */
147
+ declare class HostRequestError extends Error {
148
+ readonly method: string;
149
+ readonly reason: string;
150
+ constructor(method: string, reason: string);
151
+ }
152
+ interface SendMessageOptions {
153
+ target?: "active" | "new";
154
+ send?: boolean;
155
+ }
156
+ type MessagingAppLike = Pick<HostAppLike, "getHostContext" | "getHostCapabilities" | "sendMessage" | "openLink">;
157
+ /** Sends `text` as a user message. Options need `openai/message` and a non-mobile platform. */
158
+ declare function sendMessage(app: MessagingAppLike, text: string, options?: SendMessageOptions): Promise<void>;
159
+ /** Asks the host to open an http(s) URL. A denial is thrown with the host's own reason. */
160
+ declare function openLink(app: MessagingAppLike, url: string): Promise<void>;
161
+
162
+ /**
163
+ * Host-context layer — framework-agnostic core.
164
+ *
165
+ * Reads the MCP Apps host context (spec 2026-01-26, `ui/notifications/host-context-changed`)
166
+ * through the `@modelcontextprotocol/ext-apps` `App` API, and layers the OpenAI Apps SDK
167
+ * additions on top, strictly additive: a view works with no `openai/*` key at all.
168
+ *
169
+ * The `App` is typed STRUCTURALLY (`HostAppLike`): this module imports nothing at runtime, so
170
+ * mosaic takes no dependency on ext-apps and any `App` instance satisfies the shape. No DOM
171
+ * access happens at import time; `applyMosaicTheme` takes the target element explicitly.
172
+ */
173
+
174
+ type HostDisplayMode = "inline" | "fullscreen" | "pip";
175
+ /** Display modes a mosaic view may request. `pip` is typed out: it is never requested. */
176
+ type RequestableDisplayMode = "inline" | "fullscreen";
177
+ /** The two themes mosaic-tokens styles (`[data-theme="dark"]` overrides the light `:root`). */
178
+ type MosaicTheme = "light" | "dark";
179
+ type HostContainerDimensions = {
180
+ height?: number;
181
+ maxHeight?: number;
182
+ width?: number;
183
+ maxWidth?: number;
184
+ };
185
+ /** Raw host context: the spec's open `[key: string]: unknown` record. */
186
+ type RawHostContext = Record<string, unknown>;
187
+ interface MosaicHostContext {
188
+ theme: MosaicTheme;
189
+ displayMode: HostDisplayMode;
190
+ availableDisplayModes: HostDisplayMode[];
191
+ locale: string | undefined;
192
+ containerDimensions: HostContainerDimensions | undefined;
193
+ /**
194
+ * `hostContext["openai/deepLink"]` when the host provides it: `{ url }`, an app-relative URL
195
+ * (openai/mcp-extensions docs/spec.md l.149-210, `DeepLinkHostState`).
196
+ */
197
+ deepLink: {
198
+ url: string;
199
+ } | undefined;
200
+ /** `hostContext.safeAreaInsets` (MCP Apps spec l.582-587), pixels; undefined when absent. */
201
+ safeAreaInsets: SafeAreaInsets | undefined;
202
+ /** `hostContext.styles` (MCP Apps spec l.547-555); undefined when the host passes none. */
203
+ styles: HostStyles | undefined;
204
+ /** `hostContext["openai/modelContext"]`: the attached context; null = cleared, undefined = absent. */
205
+ modelContext: ModelContextHostState | undefined;
206
+ isChatGpt: boolean;
207
+ raw: RawHostContext;
208
+ }
209
+ interface ModelContextParams {
210
+ content?: Array<{
211
+ type: string;
212
+ [key: string]: unknown;
213
+ }>;
214
+ structuredContent?: Record<string, unknown>;
215
+ }
216
+ type HostCapabilitiesLike = {
217
+ experimental?: Record<string, unknown>;
218
+ };
219
+ /** The slice of the ext-apps `App` this layer uses. */
220
+ interface HostAppLike {
221
+ getHostContext(): RawHostContext | undefined;
222
+ requestDisplayMode(params: {
223
+ mode: HostDisplayMode;
224
+ }): Promise<{
225
+ mode: HostDisplayMode;
226
+ }>;
227
+ updateModelContext(params: ModelContextParams): Promise<unknown>;
228
+ getHostCapabilities?(): HostCapabilitiesLike | undefined;
229
+ /** ext-apps `App.sendMessage` (`ui/message`, spec l.998-1030). */
230
+ sendMessage?(params: {
231
+ role: "user";
232
+ content: Array<{
233
+ type: string;
234
+ [key: string]: unknown;
235
+ }>;
236
+ _meta?: Record<string, unknown>;
237
+ }): Promise<{
238
+ isError?: boolean;
239
+ }>;
240
+ /** ext-apps `App.openLink` (`ui/open-link`, spec l.965-995). */
241
+ openLink?(params: {
242
+ url: string;
243
+ }): Promise<{
244
+ isError?: boolean;
245
+ }>;
246
+ onhostcontextchanged?: ((params: RawHostContext) => void) | undefined;
247
+ }
248
+ /** Thrown when a display mode is requested that mosaic refuses for the current host. */
249
+ declare class DisplayModeRefusedError extends Error {
250
+ readonly mode: string;
251
+ constructor(mode: string);
252
+ }
253
+ /** host theme -> mosaic-tokens theme. Anything that is not "dark" renders light. */
254
+ declare function mapHostTheme(theme: unknown): MosaicTheme;
255
+ /**
256
+ * ChatGPT host detection.
257
+ *
258
+ * DECLARED DIVERGENCE: the OpenAI spec defines no host-identification value (`hostInfo.name` is
259
+ * free-form, e.g. "example-host"), so there is no spec signal to read. The best available
260
+ * evidence is the vendor namespace the spec reserves for ChatGPT: any `openai/*` key in the
261
+ * host context (e.g. `openai/deepLink`, `openai/modelContext`) or in
262
+ * `hostCapabilities.experimental` (e.g. `openai/files`, `openai/message`). No user-agent
263
+ * sniffing. A ChatGPT host that sends neither is not detected; `pip` is typed out regardless,
264
+ * so the runtime refusal is a second line, not the only one.
265
+ */
266
+ declare function isChatGptHost(raw: unknown, capabilities?: HostCapabilitiesLike | null): boolean;
267
+ declare function readHostContext(raw: unknown, capabilities?: HostCapabilitiesLike | null): MosaicHostContext;
268
+ /** Sets `data-theme` on `root`: the attribute mosaic-tokens' dark overrides key on. */
269
+ declare function applyMosaicTheme(theme: MosaicTheme, root: Element): void;
270
+ /**
271
+ * Request a display mode. `pip` is excluded by the type and refused at runtime for a ChatGPT
272
+ * host (a caller that casts past the type still cannot reach the host with it).
273
+ */
274
+ declare function requestDisplayMode(app: HostAppLike, mode: RequestableDisplayMode): Promise<{
275
+ mode: HostDisplayMode;
276
+ }>;
277
+ /** `ui/update-model-context`: tell the model what the user is looking at. */
278
+ declare function updateModelContext(app: HostAppLike, params: ModelContextParams): Promise<unknown>;
279
+ /** Read the live context of an app, with the same ChatGPT detection `requestDisplayMode` uses. */
280
+ declare function readAppHostContext(app: HostAppLike): MosaicHostContext;
281
+ /**
282
+ * Subscribe to host context changes. Any number of subscribers, unsubscribed in any order.
283
+ * Notifications carry a partial context, merged over what the app already holds.
284
+ */
285
+ declare function subscribeHostContext(app: HostAppLike, listener: (ctx: MosaicHostContext) => void): () => void;
286
+
287
+ export { CLAUDE_HOST_FONT_ORIGIN, DisplayModeRefusedError, HOST_TO_MOSAIC_TOKENS, type HostAppLike, type HostCapabilitiesLike, type HostContainerDimensions, type HostDisplayMode, HostRequestError, type HostStyles, type IconLike, MCP_STYLE_VARIABLE_KEYS, type McpStyleVariableKey, type MessagingAppLike, type ModelContextBlock, type ModelContextHostState, type ModelContextParams, type MosaicHostContext, type MosaicTheme, type RawHostContext, type RequestableDisplayMode, type SafeAreaInsets, type SendMessageOptions, type TextBlockOptions, applyHostFonts, applyHostStyleVariables, applyMosaicTheme, applySafeAreaInsets, applyTransparentBackground, buildModelContext, isChatGptHost, mapHostTheme, openLink, readAppHostContext, readHostContext, readHostStyles, readModelContextState, readSafeAreaInsets, requestDisplayMode, safeAreaPadding, selectionModelContext, sendMessage, structuredContentBlock, subscribeHostContext, textBlock, updateModelContext };