skybridge 0.0.0-dev.e3e0986 → 0.0.0-dev.e43e7b0

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 (189) hide show
  1. package/LICENSE +21 -674
  2. package/dist/src/server/index.d.ts +2 -2
  3. package/dist/src/server/index.js.map +1 -1
  4. package/dist/src/server/inferUtilityTypes.d.ts +46 -15
  5. package/dist/src/server/server.d.ts +66 -11
  6. package/dist/src/server/server.js +57 -27
  7. package/dist/src/server/server.js.map +1 -1
  8. package/dist/src/server/templateHelper.d.ts +3 -0
  9. package/dist/src/server/templateHelper.js +5 -4
  10. package/dist/src/server/templateHelper.js.map +1 -1
  11. package/dist/src/server/templates/development.hbs +57 -3
  12. package/dist/src/server/templates/production.hbs +1 -0
  13. package/dist/src/server/widgetsDevServer.js +13 -5
  14. package/dist/src/server/widgetsDevServer.js.map +1 -1
  15. package/dist/src/test/utils.d.ts +108 -1
  16. package/dist/src/test/utils.js +201 -2
  17. package/dist/src/test/utils.js.map +1 -1
  18. package/dist/src/test/widget.test.js +112 -29
  19. package/dist/src/test/widget.test.js.map +1 -1
  20. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.d.ts +13 -0
  21. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js +33 -0
  22. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js.map +1 -0
  23. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.d.ts +16 -0
  24. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js +115 -0
  25. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js.map +1 -0
  26. package/dist/src/web/bridges/apps-sdk-bridge.d.ts +10 -0
  27. package/dist/src/web/bridges/apps-sdk-bridge.js +46 -0
  28. package/dist/src/web/bridges/apps-sdk-bridge.js.map +1 -0
  29. package/dist/src/web/bridges/hooks/use-adaptor.d.ts +2 -0
  30. package/dist/src/web/bridges/hooks/use-adaptor.js +8 -0
  31. package/dist/src/web/bridges/hooks/use-adaptor.js.map +1 -0
  32. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +2 -0
  33. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js +7 -0
  34. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +1 -0
  35. package/dist/src/web/bridges/hooks/use-bridge.d.ts +2 -0
  36. package/dist/src/web/bridges/hooks/use-bridge.js +8 -0
  37. package/dist/src/web/bridges/hooks/use-bridge.js.map +1 -0
  38. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +5 -0
  39. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js +7 -0
  40. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +1 -0
  41. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +41 -0
  42. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +1 -0
  43. package/dist/src/web/bridges/index.d.ts +4 -0
  44. package/dist/src/web/bridges/index.js +5 -0
  45. package/dist/src/web/bridges/index.js.map +1 -0
  46. package/dist/src/web/bridges/mcp-app-bridge.d.ts +38 -0
  47. package/dist/src/web/bridges/mcp-app-bridge.js +162 -0
  48. package/dist/src/web/bridges/mcp-app-bridge.js.map +1 -0
  49. package/dist/src/web/bridges/types.d.ts +57 -0
  50. package/dist/src/web/bridges/types.js +2 -0
  51. package/dist/src/web/bridges/types.js.map +1 -0
  52. package/dist/src/web/create-store.d.ts +3 -0
  53. package/dist/src/web/create-store.js +25 -0
  54. package/dist/src/web/create-store.js.map +1 -0
  55. package/dist/src/web/create-store.test.js +70 -0
  56. package/dist/src/web/create-store.test.js.map +1 -0
  57. package/dist/src/web/data-llm.d.ts +14 -0
  58. package/dist/src/web/data-llm.js +70 -0
  59. package/dist/src/web/data-llm.js.map +1 -0
  60. package/dist/src/web/data-llm.test.js +76 -0
  61. package/dist/src/web/data-llm.test.js.map +1 -0
  62. package/dist/src/web/generate-helpers.d.ts +115 -0
  63. package/dist/src/web/generate-helpers.js +111 -0
  64. package/dist/src/web/generate-helpers.js.map +1 -0
  65. package/dist/src/web/generate-helpers.test-d.js +209 -0
  66. package/dist/src/web/generate-helpers.test-d.js.map +1 -0
  67. package/dist/src/web/generate-helpers.test.js +17 -0
  68. package/dist/src/web/generate-helpers.test.js.map +1 -0
  69. package/dist/src/web/helpers/state.d.ts +7 -0
  70. package/dist/src/web/helpers/state.js +40 -0
  71. package/dist/src/web/helpers/state.js.map +1 -0
  72. package/dist/src/web/helpers/state.test.d.ts +1 -0
  73. package/dist/src/web/helpers/state.test.js +53 -0
  74. package/dist/src/web/helpers/state.test.js.map +1 -0
  75. package/dist/src/web/hooks/index.d.ts +4 -7
  76. package/dist/src/web/hooks/index.js +4 -7
  77. package/dist/src/web/hooks/index.js.map +1 -1
  78. package/dist/src/web/hooks/test/utils.d.ts +10 -0
  79. package/dist/src/web/hooks/test/utils.js +40 -0
  80. package/dist/src/web/hooks/test/utils.js.map +1 -0
  81. package/dist/src/web/hooks/use-call-tool.d.ts +59 -21
  82. package/dist/src/web/hooks/use-call-tool.js +19 -19
  83. package/dist/src/web/hooks/use-call-tool.js.map +1 -1
  84. package/dist/src/web/hooks/use-call-tool.test-d.d.ts +1 -0
  85. package/dist/src/web/hooks/use-call-tool.test-d.js +104 -0
  86. package/dist/src/web/hooks/use-call-tool.test-d.js.map +1 -0
  87. package/dist/src/web/hooks/use-call-tool.test.js +42 -15
  88. package/dist/src/web/hooks/use-call-tool.test.js.map +1 -1
  89. package/dist/src/web/hooks/use-display-mode.d.ts +1 -1
  90. package/dist/src/web/hooks/use-display-mode.js +6 -3
  91. package/dist/src/web/hooks/use-display-mode.js.map +1 -1
  92. package/dist/src/web/hooks/use-display-mode.test.js +3 -2
  93. package/dist/src/web/hooks/use-display-mode.test.js.map +1 -1
  94. package/dist/src/web/hooks/use-files.test.js +1 -1
  95. package/dist/src/web/hooks/use-files.test.js.map +1 -1
  96. package/dist/src/web/hooks/use-layout.d.ts +22 -0
  97. package/dist/src/web/hooks/use-layout.js +23 -0
  98. package/dist/src/web/hooks/use-layout.js.map +1 -0
  99. package/dist/src/web/hooks/use-layout.test.d.ts +1 -0
  100. package/dist/src/web/hooks/use-layout.test.js +95 -0
  101. package/dist/src/web/hooks/use-layout.test.js.map +1 -0
  102. package/dist/src/web/hooks/use-open-external.js +5 -3
  103. package/dist/src/web/hooks/use-open-external.js.map +1 -1
  104. package/dist/src/web/hooks/use-open-external.test.js +43 -17
  105. package/dist/src/web/hooks/use-open-external.test.js.map +1 -1
  106. package/dist/src/web/hooks/use-openai-global.d.ts +3 -2
  107. package/dist/src/web/hooks/use-openai-global.js +3 -20
  108. package/dist/src/web/hooks/use-openai-global.js.map +1 -1
  109. package/dist/src/web/hooks/use-request-modal.d.ts +6 -3
  110. package/dist/src/web/hooks/use-request-modal.js +6 -1
  111. package/dist/src/web/hooks/use-request-modal.js.map +1 -1
  112. package/dist/src/web/hooks/use-request-modal.test.js +37 -4
  113. package/dist/src/web/hooks/use-request-modal.test.js.map +1 -1
  114. package/dist/src/web/hooks/use-send-follow-up-message.js +3 -6
  115. package/dist/src/web/hooks/use-send-follow-up-message.js.map +1 -1
  116. package/dist/src/web/hooks/use-tool-info.d.ts +13 -2
  117. package/dist/src/web/hooks/use-tool-info.js +15 -11
  118. package/dist/src/web/hooks/use-tool-info.js.map +1 -1
  119. package/dist/src/web/hooks/use-tool-info.test-d.js +40 -5
  120. package/dist/src/web/hooks/use-tool-info.test-d.js.map +1 -1
  121. package/dist/src/web/hooks/use-tool-info.test.js +119 -48
  122. package/dist/src/web/hooks/use-tool-info.test.js.map +1 -1
  123. package/dist/src/web/hooks/use-user.d.ts +18 -0
  124. package/dist/src/web/hooks/use-user.js +19 -0
  125. package/dist/src/web/hooks/use-user.js.map +1 -0
  126. package/dist/src/web/hooks/use-user.test.d.ts +1 -0
  127. package/dist/src/web/hooks/use-user.test.js +93 -0
  128. package/dist/src/web/hooks/use-user.test.js.map +1 -0
  129. package/dist/src/web/hooks/use-widget-state.js +11 -9
  130. package/dist/src/web/hooks/use-widget-state.js.map +1 -1
  131. package/dist/src/web/hooks/use-widget-state.test.js +3 -2
  132. package/dist/src/web/hooks/use-widget-state.test.js.map +1 -1
  133. package/dist/src/web/index.d.ts +7 -4
  134. package/dist/src/web/index.js +7 -4
  135. package/dist/src/web/index.js.map +1 -1
  136. package/dist/src/web/plugin/data-llm.test.d.ts +1 -0
  137. package/dist/src/web/plugin/data-llm.test.js +81 -0
  138. package/dist/src/web/plugin/data-llm.test.js.map +1 -0
  139. package/dist/src/web/plugin/plugin.js +39 -0
  140. package/dist/src/web/plugin/plugin.js.map +1 -0
  141. package/dist/src/web/plugin/transform-data-llm.d.ts +12 -0
  142. package/dist/src/web/plugin/transform-data-llm.js +96 -0
  143. package/dist/src/web/plugin/transform-data-llm.js.map +1 -0
  144. package/dist/src/web/plugin/transform-data-llm.test.d.ts +1 -0
  145. package/dist/src/web/plugin/transform-data-llm.test.js +81 -0
  146. package/dist/src/web/plugin/transform-data-llm.test.js.map +1 -0
  147. package/dist/src/web/proxy.js +6 -1
  148. package/dist/src/web/proxy.js.map +1 -1
  149. package/dist/src/web/types.d.ts +43 -13
  150. package/dist/src/web/types.js +1 -0
  151. package/dist/src/web/types.js.map +1 -1
  152. package/package.json +34 -26
  153. package/README.md +0 -320
  154. package/dist/src/web/hooks/use-locale.d.ts +0 -1
  155. package/dist/src/web/hooks/use-locale.js +0 -5
  156. package/dist/src/web/hooks/use-locale.js.map +0 -1
  157. package/dist/src/web/hooks/use-locale.test.js +0 -21
  158. package/dist/src/web/hooks/use-locale.test.js.map +0 -1
  159. package/dist/src/web/hooks/use-theme.d.ts +0 -1
  160. package/dist/src/web/hooks/use-theme.js +0 -5
  161. package/dist/src/web/hooks/use-theme.js.map +0 -1
  162. package/dist/src/web/hooks/use-theme.test.js +0 -26
  163. package/dist/src/web/hooks/use-theme.test.js.map +0 -1
  164. package/dist/src/web/hooks/use-tool-output.d.ts +0 -4
  165. package/dist/src/web/hooks/use-tool-output.js +0 -9
  166. package/dist/src/web/hooks/use-tool-output.js.map +0 -1
  167. package/dist/src/web/hooks/use-tool-response-metadata.d.ts +0 -4
  168. package/dist/src/web/hooks/use-tool-response-metadata.js +0 -8
  169. package/dist/src/web/hooks/use-tool-response-metadata.js.map +0 -1
  170. package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
  171. package/dist/src/web/hooks/use-user-agent.js +0 -5
  172. package/dist/src/web/hooks/use-user-agent.js.map +0 -1
  173. package/dist/src/web/hooks/use-user-agent.test.js +0 -31
  174. package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
  175. package/dist/src/web/plugin.js +0 -28
  176. package/dist/src/web/plugin.js.map +0 -1
  177. package/dist/src/web/typed-hooks.d.ts +0 -61
  178. package/dist/src/web/typed-hooks.js +0 -61
  179. package/dist/src/web/typed-hooks.js.map +0 -1
  180. package/dist/src/web/typed-hooks.test-d.js +0 -72
  181. package/dist/src/web/typed-hooks.test-d.js.map +0 -1
  182. package/dist/src/web/typed-hooks.test.js +0 -10
  183. package/dist/src/web/typed-hooks.test.js.map +0 -1
  184. /package/dist/src/web/{hooks/use-locale.test.d.ts → bridges/hooks/use-mcp-app-bridge.test.d.ts} +0 -0
  185. /package/dist/src/web/{hooks/use-theme.test.d.ts → create-store.test.d.ts} +0 -0
  186. /package/dist/src/web/{hooks/use-user-agent.test.d.ts → data-llm.test.d.ts} +0 -0
  187. /package/dist/src/web/{typed-hooks.test-d.d.ts → generate-helpers.test-d.d.ts} +0 -0
  188. /package/dist/src/web/{typed-hooks.test.d.ts → generate-helpers.test.d.ts} +0 -0
  189. /package/dist/src/web/{plugin.d.ts → plugin/plugin.d.ts} +0 -0
package/README.md DELETED
@@ -1,320 +0,0 @@
1
- <div align="center">
2
-
3
- # Skybridge
4
-
5
- **Skybridge is the TypeScript framework for building ChatGPT apps**
6
-
7
- [![By Alpic](https://img.shields.io/badge/Made%20by%20Alpic-f6ffed?logo=alpic)](https://alpic.ai)
8
-
9
- ![NPM Downloads](https://img.shields.io/npm/dm/skybridge?color=e90060)
10
- ![NPM Version](https://img.shields.io/npm/v/skybridge?color=e90060)
11
- ![GitHub License](https://img.shields.io/github/license/alpic-ai/skybridge?color=e90060)
12
-
13
- </div>
14
-
15
- Skybridge comes with 2 packages:
16
-
17
- - `skybridge/server`: A drop-in replacement of the `@modelcontextprotocol/sdk` official `McpServer` class with extra features for widget development.
18
- - `skybridge/web`: A react library with hooks and components to build widgets on the underlying _OpenAI iFrame skybridge_ runtime.
19
-
20
- ## Quick start
21
-
22
- To get started in less than a minute, you can [create a new repository](https://github.com/new?template_name=apps-sdk-template&template_owner=alpic-ai) using our [ChatGPT SDK template](https://github.com/alpic-ai/apps-sdk-template). This template includes a basic setup for both the server and the widgets.
23
-
24
- ## Installation
25
-
26
- ```bash
27
- pnpm add skybridge
28
- ```
29
-
30
- ## Concepts
31
-
32
- ### Widgets
33
-
34
- > A widget is a UI component that turns structured tool results into a human-friendly UI. Those are built using React components. They are rendered inside an iframe inline with the conversation on ChatGPT.
35
-
36
- Each widget in your app must have a unique name. The name is used to bridge the tool invocation result with the widget React component.
37
-
38
- For example, in order to register a new widget named `pokemon` on your ChatGPT app. You should have the following file structure and file contents:
39
-
40
- _Project structure_
41
-
42
- ```
43
- server/
44
- └── src/
45
- └── index.ts // Register the widget with McpServer.widget()
46
- web/
47
- └── src/
48
- └── widgets/
49
- └── pokemon.tsx // Use the same widget name as the file name
50
- ```
51
-
52
- _server/src/index.ts_
53
-
54
- ```ts
55
- import { McpServer } from "skybridge/server";
56
-
57
- const server = new McpServer();
58
-
59
- server.widget(
60
- "pokemon"
61
- // Remaining arguments...
62
- );
63
- ```
64
-
65
- _web/src/widgets/pokemon.tsx_
66
-
67
- ```ts
68
- import { mountWidget } from "skybridge/web";
69
-
70
- const Pokemon: React.FunctionComponent = () => {
71
- // Your React component code goes here...
72
- };
73
-
74
- mountWidget(<Pokemon />);
75
- ```
76
-
77
- ## Packages
78
-
79
- ### skybridge/server
80
-
81
- The `skybridge/server` package is a drop-in replacement of the `@modelcontextprotocol/sdk` official `McpServer` class with extra features for widget development. If you're already using the `@modelcontextprotocol/sdk`, you can simply replace your `McpServer` import with `skybridge/server` and you're good to go.
82
-
83
- ### skybridge/web
84
-
85
- The `skybridge/web` package is a react library with hooks and components to build widgets on the underlying _OpenAI iFrame skybridge_ runtime.
86
-
87
- **Vite plugin**
88
-
89
- The `skybridge/web` package comes with a Vite plugin that allows you to build your widgets as regular Vite apps.
90
-
91
- ```ts
92
- import { defineConfig } from "vite";
93
- import { skybridge } from "skybridge/web";
94
-
95
- export default defineConfig({
96
- plugins: [skybridge()],
97
- });
98
- ```
99
-
100
- **Typed Hooks**
101
-
102
- Skybridge provides fully typed hooks that give you autocomplete for tool names and type inference for inputs/outputs - similar to tRPC. This is opt-in and requires exporting your server type.
103
-
104
- _Server setup (server/src/index.ts)_
105
-
106
- ```ts
107
- import { McpServer } from "skybridge/server";
108
- import { z } from "zod";
109
-
110
- const server = new McpServer({ name: "my-app", version: "1.0" }, {})
111
- .widget("search-voyage", {}, {
112
- description: "Search for trips",
113
- inputSchema: {
114
- destination: z.string(),
115
- departureDate: z.string().optional(),
116
- },
117
- outputSchema: {
118
- results: z.array(z.object({ id: z.string(), name: z.string() })),
119
- },
120
- }, async ({ destination }) => {
121
- // Your tool logic here...
122
- return { content: [{ type: "text", text: `Found trips to ${destination}` }] };
123
- })
124
- .widget("get-details", {}, {
125
- inputSchema: { tripId: z.string() },
126
- }, async ({ tripId }) => {
127
- return { content: [{ type: "text", text: `Details for ${tripId}` }] };
128
- });
129
-
130
- // Export the server type for the client
131
- export type AppType = typeof server;
132
- ```
133
-
134
- _One-time setup (web/src/skybridge.ts)_
135
-
136
- Create typed hooks once and export them for use across your app:
137
-
138
- ```ts
139
- import type { AppType } from "../server"; // type-only import
140
- import { createTypedHooks } from "skybridge/web";
141
-
142
- export const { useCallTool, useToolInfo } = createTypedHooks<AppType>();
143
- ```
144
-
145
- _Usage in widgets (web/src/widgets/search.tsx)_
146
-
147
- ```tsx
148
- import { useCallTool, useToolInfo } from "../skybridge"; // import typed hooks
149
-
150
- export function SearchWidget() {
151
- const { callTool, data, isPending } = useCallTool("search-voyage");
152
- // ^ autocomplete for tool names
153
- const toolInfo = useToolInfo<"search-voyage">();
154
- // ^ autocomplete for widget names
155
-
156
- const handleSearch = () => {
157
- callTool({ destination: "Spain" });
158
- // ^ autocomplete for input fields
159
- };
160
-
161
- return (
162
- <div>
163
- <button onClick={handleSearch} disabled={isPending}>
164
- Search
165
- </button>
166
- {toolInfo.isSuccess && (
167
- <div>Found {toolInfo.output.totalCount} results</div>
168
- // ^ typed output
169
- )}
170
- </div>
171
- );
172
- }
173
- ```
174
-
175
- **Hooks**
176
-
177
- The `skybridge/web` package comes with a set of hooks to help you build your widgets :
178
-
179
- - `useOpenAiGlobal`: A generic hook to get any global data from the OpenAI iFrame skybridge runtime (in `window.openai`).
180
- - `useToolOutput`: A hook to get the initial tool `structuredContent` returned when rendering the widget for the first time. The data inside this hook is not updated when the tool is called again.
181
- - `useToolResponseMetadata`: A hook to get the initial tool `meta` returned when rendering the widget for the first time. The data inside this hook is not updated when the tool is called again.
182
- - `useToolInfo`: A hook to get the tool input, output, and response metadata with type inference. Provides a discriminated union based on status (pending/success).
183
- - `useCallTool`: A @tanstack/react-query inspired hook to send make additional tool calls inside a widget.
184
- - `createTypedHooks`: A factory that creates typed versions of `useCallTool` and `useToolInfo` with full type inference from your server type.
185
-
186
- _useOpenAiGlobal_
187
-
188
- ```ts
189
- import { useOpenAiGlobal } from "skybridge/web";
190
-
191
- const theme = useOpenAiGlobal("theme");
192
- ```
193
-
194
- _useToolOutput_
195
-
196
- ```ts
197
- import { useToolOutput } from "skybridge/web";
198
-
199
- const toolOutput = useToolOutput();
200
- ```
201
-
202
- _useToolResponseMetadata_
203
-
204
- ```ts
205
- import { useToolResponseMetadata } from "skybridge/web";
206
-
207
- const toolResponseMetadata = useToolResponseMetadata();
208
- ```
209
-
210
- _useToolInfo_
211
-
212
- ```ts
213
- import { useToolInfo } from "skybridge/web";
214
-
215
- const toolInfo = useToolInfo<{
216
- input: { query: string };
217
- output: { results: string[] };
218
- responseMetadata: { id: number };
219
- }>();
220
-
221
- // toolInfo.input is typed based on the input type
222
- // toolInfo.output is typed based on the output type (undefined when pending)
223
- // toolInfo.status narrows correctly: "pending" | "success"
224
-
225
- if (toolInfo.isPending) {
226
- // toolInfo.output is undefined here
227
- console.log(toolInfo.input.query);
228
- }
229
-
230
- if (toolInfo.isSuccess) {
231
- // toolInfo.output is typed here
232
- console.log(toolInfo.output.results);
233
- }
234
- ```
235
-
236
- _useToolInfo_ with typed hooks (recommended)
237
-
238
- ```tsx
239
- import { useToolInfo } from "../skybridge"; // import typed hooks
240
-
241
- export function SearchWidget() {
242
- const toolInfo = useToolInfo<"search-voyage">();
243
- // ^ autocomplete for widget names
244
- // toolInfo.input is typed as { destination: string; departureDate?: string; ... }
245
- // toolInfo.output is typed as { results: Array<...>; totalCount: number; } | undefined
246
-
247
- if (toolInfo.isSuccess) {
248
- return <div>Found {toolInfo.output.totalCount} results</div>;
249
- }
250
-
251
- return <div>Searching for {toolInfo.input.destination}...</div>;
252
- }
253
- ```
254
-
255
- _useCallTool_ in synchronous mode
256
-
257
- ```ts
258
- import { useCallTool } from "skybridge/web";
259
-
260
- export const TestTool: React.FunctionComponent = () => {
261
- const { callTool, isPending } = useCallTool("myToolName");
262
-
263
- return (
264
- <div>
265
- <button
266
- disabled={isPending}
267
- onClick={() => {
268
- callTool({ input: "test input" }, {
269
- onSuccess: (data) => {
270
- alert("Tool returned: " + data);
271
- },
272
- });
273
- >
274
- Call Tool inside a widget
275
- </button>
276
- </div>
277
- );
278
- };
279
- ```
280
-
281
- _useCallTool_ in asynchronous mode
282
-
283
- ```ts
284
- import { useCallTool } from "skybridge/web";
285
-
286
- export const TestTool: React.FunctionComponent = () => {
287
- const { callToolAsync, isPending } = useCallTool("myToolName");
288
-
289
- return (
290
- <div>
291
- <button
292
- disabled={isPending}
293
- onClick={async () => {
294
- const data = await callToolAsync({ input: "test input" });
295
- alert("Tool returned: " + data);
296
- }}
297
- >
298
- Call Tool inside a widget
299
- </button>
300
- </div>
301
- );
302
- };
303
- ```
304
-
305
- ## Migrate your existing MCP server to a ChatGPT app
306
-
307
- If you're already using the `@modelcontextprotocol/sdk` to build a MCP server, you can migrate to a ChatGPT app by following these steps:
308
-
309
- 1. Replace your `McpServer` import from `@modelcontextprotocol/sdk` with the same import from `skybridge/server`
310
- 2. Create a new vite project in a folder named `web` and install the `skybridge` package
311
- 3. Replace the `vite.config.ts` file with the following:
312
-
313
- ```ts
314
- import { defineConfig } from "vite";
315
- import { skybridge } from "skybridge/web";
316
-
317
- export default defineConfig({
318
- plugins: [skybridge()],
319
- });
320
- ```
@@ -1 +0,0 @@
1
- export declare function useLocale(): string;
@@ -1,5 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- export function useLocale() {
3
- return useOpenAiGlobal("locale");
4
- }
5
- //# sourceMappingURL=use-locale.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-locale.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-locale.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,SAAS;IACvB,OAAO,eAAe,CAAC,QAAQ,CAAE,CAAC;AACpC,CAAC"}
@@ -1,21 +0,0 @@
1
- import { useLocale } from "./use-locale.js";
2
- import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
3
- import { renderHook } from "@testing-library/react";
4
- describe("useLocale", () => {
5
- let OpenaiMock;
6
- beforeEach(() => {
7
- OpenaiMock = {
8
- locale: "en-US",
9
- };
10
- vi.stubGlobal("openai", OpenaiMock);
11
- });
12
- afterEach(() => {
13
- vi.unstubAllGlobals();
14
- vi.resetAllMocks();
15
- });
16
- it("should return the current locale from window.openai.locale", () => {
17
- const { result } = renderHook(() => useLocale());
18
- expect(result.current).toBe("en-US");
19
- });
20
- });
21
- //# sourceMappingURL=use-locale.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-locale.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-locale.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,QAAQ,CAAC,WAAW,EAAE,GAAG,EAAE;IACzB,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,MAAM,EAAE,OAAO;SAChB,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,SAAS,EAAE,CAAC,CAAC;QAEjD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1 +0,0 @@
1
- export declare function useTheme(): import("../types.js").Theme;
@@ -1,5 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- export function useTheme() {
3
- return useOpenAiGlobal("theme");
4
- }
5
- //# sourceMappingURL=use-theme.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-theme.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,QAAQ;IACtB,OAAO,eAAe,CAAC,OAAO,CAAE,CAAC;AACnC,CAAC"}
@@ -1,26 +0,0 @@
1
- import { useTheme } from "./use-theme.js";
2
- import { describe, it, expect, vi, beforeEach, afterEach } from "vitest";
3
- import { renderHook } from "@testing-library/react";
4
- describe("useTheme", () => {
5
- let OpenaiMock;
6
- beforeEach(() => {
7
- OpenaiMock = {
8
- theme: "light",
9
- };
10
- vi.stubGlobal("openai", OpenaiMock);
11
- });
12
- afterEach(() => {
13
- vi.unstubAllGlobals();
14
- vi.resetAllMocks();
15
- });
16
- it("should return the current theme from window.openai.theme", () => {
17
- const { result } = renderHook(() => useTheme());
18
- expect(result.current).toBe("light");
19
- });
20
- it("should return dark theme when set to dark", () => {
21
- OpenaiMock.theme = "dark";
22
- const { result } = renderHook(() => useTheme());
23
- expect(result.current).toBe("dark");
24
- });
25
- });
26
- //# sourceMappingURL=use-theme.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-theme.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-theme.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IACxB,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,KAAK,EAAE,OAAO;SACf,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,0DAA0D,EAAE,GAAG,EAAE;QAClE,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,GAAG,EAAE;QACnD,UAAU,CAAC,KAAK,GAAG,MAAM,CAAC;QAC1B,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC;QAEhD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated This hook is deprecated. Use `useToolInfo()` instead and access the `output` property.
3
- */
4
- export declare function useToolOutput(): import("../types.js").UnknownObject | undefined;
@@ -1,9 +0,0 @@
1
- import { useToolInfo } from "./use-tool-info.js";
2
- /**
3
- * @deprecated This hook is deprecated. Use `useToolInfo()` instead and access the `output` property.
4
- */
5
- export function useToolOutput() {
6
- const { output } = useToolInfo();
7
- return output;
8
- }
9
- //# sourceMappingURL=use-tool-output.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-tool-output.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-output.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,EAAE,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEjC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -1,4 +0,0 @@
1
- /**
2
- * @deprecated This hook is deprecated. Use `useToolInfo()` instead and access the `responseMetadata` property.
3
- */
4
- export declare function useToolResponseMetadata(): import("../types.js").UnknownObject | null | undefined;
@@ -1,8 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- /**
3
- * @deprecated This hook is deprecated. Use `useToolInfo()` instead and access the `responseMetadata` property.
4
- */
5
- export function useToolResponseMetadata() {
6
- return useOpenAiGlobal("toolResponseMetadata");
7
- }
8
- //# sourceMappingURL=use-tool-response-metadata.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-tool-response-metadata.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-tool-response-metadata.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD;;GAEG;AACH,MAAM,UAAU,uBAAuB;IACrC,OAAO,eAAe,CAAC,sBAAsB,CAAC,CAAC;AACjD,CAAC"}
@@ -1 +0,0 @@
1
- export declare function useUserAgent(): import("../types.js").UserAgent;
@@ -1,5 +0,0 @@
1
- import { useOpenAiGlobal } from "./use-openai-global.js";
2
- export function useUserAgent() {
3
- return useOpenAiGlobal("userAgent");
4
- }
5
- //# sourceMappingURL=use-user-agent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-user-agent.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user-agent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,MAAM,UAAU,YAAY;IAC1B,OAAO,eAAe,CAAC,WAAW,CAAE,CAAC;AACvC,CAAC"}
@@ -1,31 +0,0 @@
1
- import { useUserAgent } from "./use-user-agent.js";
2
- import { describe, it, expect, vi, beforeEach, afterEach, } from "vitest";
3
- import { renderHook } from "@testing-library/react";
4
- describe("useUserAgent", () => {
5
- let OpenaiMock;
6
- beforeEach(() => {
7
- OpenaiMock = {
8
- userAgent: {
9
- device: { type: "mobile" },
10
- capabilities: { hover: false, touch: true },
11
- },
12
- };
13
- vi.stubGlobal("openai", OpenaiMock);
14
- });
15
- afterEach(() => {
16
- vi.unstubAllGlobals();
17
- vi.resetAllMocks();
18
- });
19
- it("should return the current user agent from window.openai.userAgent", () => {
20
- OpenaiMock.userAgent = {
21
- device: { type: "mobile" },
22
- capabilities: { hover: false, touch: true },
23
- };
24
- const { result } = renderHook(() => useUserAgent());
25
- expect(result.current).toEqual({
26
- device: { type: "mobile" },
27
- capabilities: { hover: false, touch: true },
28
- });
29
- });
30
- });
31
- //# sourceMappingURL=use-user-agent.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-user-agent.test.js","sourceRoot":"","sources":["../../../../src/web/hooks/use-user-agent.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,QAAQ,EACR,EAAE,EACF,MAAM,EACN,EAAE,EACF,UAAU,EACV,SAAS,GAEV,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAGpD,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,IAAI,UAEH,CAAC;IAEF,UAAU,CAAC,GAAG,EAAE;QACd,UAAU,GAAG;YACX,SAAS,EAAE;gBACT,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;gBAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;aAC5C;SACF,CAAC;QACF,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IACtC,CAAC,CAAC,CAAC;IAEH,SAAS,CAAC,GAAG,EAAE;QACb,EAAE,CAAC,gBAAgB,EAAE,CAAC;QACtB,EAAE,CAAC,aAAa,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,UAAU,CAAC,SAAS,GAAG;YACrB,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;SAC5C,CAAC;QACF,MAAM,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC;QAEpD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;YAC7B,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,YAAY,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE;SAC5C,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,28 +0,0 @@
1
- export function skybridge() {
2
- return {
3
- name: "skybridge",
4
- async config(config) {
5
- // Dynamic imports to ensure Node modules are only loaded in Node.js context
6
- const { globSync } = await import("node:fs");
7
- const { resolve } = await import("node:path");
8
- const projectRoot = config.root || process.cwd();
9
- const widgetsPattern = resolve(projectRoot, "src/widgets/*.{js,ts,jsx,tsx,html}");
10
- const input = Object.fromEntries(globSync(widgetsPattern).map((file) => [
11
- file.match(/src\/widgets\/(.+)\.tsx$/)?.[1],
12
- file,
13
- ]));
14
- return {
15
- base: "/assets",
16
- build: {
17
- manifest: true,
18
- minify: true,
19
- cssCodeSplit: false,
20
- rollupOptions: {
21
- input,
22
- },
23
- },
24
- };
25
- },
26
- };
27
- }
28
- //# sourceMappingURL=plugin.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plugin.js","sourceRoot":"","sources":["../../../src/web/plugin.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,SAAS;IACvB,OAAO;QACL,IAAI,EAAE,WAAW;QAEjB,KAAK,CAAC,MAAM,CAAC,MAAM;YACjB,4EAA4E;YAC5E,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;YAC7C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC;YAE9C,MAAM,WAAW,GAAG,MAAM,CAAC,IAAI,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;YACjD,MAAM,cAAc,GAAG,OAAO,CAC5B,WAAW,EACX,oCAAoC,CACrC,CAAC;YAEF,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAC9B,QAAQ,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC;gBACrC,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC3C,IAAI;aACL,CAAC,CACH,CAAC;YAEF,OAAO;gBACL,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE;oBACL,QAAQ,EAAE,IAAI;oBACd,MAAM,EAAE,IAAI;oBACZ,YAAY,EAAE,KAAK;oBACnB,aAAa,EAAE;wBACb,KAAK;qBACN;iBACF;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -1,61 +0,0 @@
1
- import { useCallTool } from "./hooks/use-call-tool.js";
2
- import type { ToolPendingState, ToolSuccessState } from "./hooks/use-tool-info.js";
3
- import type { McpServer, InferWidgets, AnyWidgetRegistry, WidgetInput, WidgetOutput } from "../server/index.js";
4
- import type { CallToolArgs, UnknownObject } from "./types.js";
5
- type TypedCallToolReturn<TInput, TOutput> = ReturnType<typeof useCallTool<TInput & CallToolArgs, {
6
- structuredContent: TOutput & UnknownObject;
7
- }>>;
8
- type TypedToolInfoReturn<TInput extends UnknownObject, TOutput extends UnknownObject, TResponseMetadata extends UnknownObject> = ToolPendingState<TInput> | ToolSuccessState<TInput, TOutput, TResponseMetadata>;
9
- /**
10
- * Creates typed versions of skybridge hooks with full type inference
11
- * for tool names, inputs, and outputs.
12
- *
13
- * Set this up once in a dedicated file and export the typed hooks:
14
- *
15
- * @example
16
- * ```typescript
17
- * // web/src/skybridge.ts (one-time setup)
18
- * import type { AppType } from "../server";
19
- * import { createTypedHooks } from "skybridge/web";
20
- *
21
- * export const { useCallTool, useToolInfo } = createTypedHooks<AppType>();
22
- * ```
23
- *
24
- * ```typescript
25
- * // web/src/widgets/search.tsx (usage)
26
- * import { useCallTool, useToolInfo } from "../skybridge";
27
- *
28
- * export function SearchWidget() {
29
- * const { callTool, data } = useCallTool("search");
30
- * // ^ autocomplete for tool names
31
- * callTool({ query: "test" });
32
- * // ^ autocomplete for input fields
33
- *
34
- * const toolInfo = useToolInfo<"search">();
35
- * // ^ autocomplete for tool names
36
- * // toolInfo.input is typed based on widget input schema
37
- * // toolInfo.output is typed based on widget output schema
38
- * }
39
- * ```
40
- */
41
- export declare function createTypedHooks<T extends McpServer<AnyWidgetRegistry>>(): {
42
- /**
43
- * Typed version of useCallTool that provides autocomplete for tool names
44
- * and type inference for inputs and outputs.
45
- */
46
- useCallTool: <K extends keyof InferWidgets<T> & string>(name: K) => TypedCallToolReturn<InferWidgets<T>[K]["input"], InferWidgets<T>[K]["output"]>;
47
- /**
48
- * Typed version of useToolInfo that provides autocomplete for widget names
49
- * and type inference for inputs, outputs, and responseMetadata.
50
- *
51
- * @example
52
- * ```typescript
53
- * const toolInfo = useToolInfo<"search-voyage">();
54
- * // toolInfo.input is typed as { destination: string; ... }
55
- * // toolInfo.output is typed as { results: Array<...>; ... } | undefined
56
- * // toolInfo.status narrows correctly: "pending" | "success"
57
- * ```
58
- */
59
- useToolInfo: <K extends keyof InferWidgets<T> & string>() => TypedToolInfoReturn<WidgetInput<T, K> & UnknownObject, WidgetOutput<T, K> & UnknownObject, UnknownObject>;
60
- };
61
- export {};
@@ -1,61 +0,0 @@
1
- import { useCallTool } from "./hooks/use-call-tool.js";
2
- import { useToolInfo } from "./hooks/use-tool-info.js";
3
- /**
4
- * Creates typed versions of skybridge hooks with full type inference
5
- * for tool names, inputs, and outputs.
6
- *
7
- * Set this up once in a dedicated file and export the typed hooks:
8
- *
9
- * @example
10
- * ```typescript
11
- * // web/src/skybridge.ts (one-time setup)
12
- * import type { AppType } from "../server";
13
- * import { createTypedHooks } from "skybridge/web";
14
- *
15
- * export const { useCallTool, useToolInfo } = createTypedHooks<AppType>();
16
- * ```
17
- *
18
- * ```typescript
19
- * // web/src/widgets/search.tsx (usage)
20
- * import { useCallTool, useToolInfo } from "../skybridge";
21
- *
22
- * export function SearchWidget() {
23
- * const { callTool, data } = useCallTool("search");
24
- * // ^ autocomplete for tool names
25
- * callTool({ query: "test" });
26
- * // ^ autocomplete for input fields
27
- *
28
- * const toolInfo = useToolInfo<"search">();
29
- * // ^ autocomplete for tool names
30
- * // toolInfo.input is typed based on widget input schema
31
- * // toolInfo.output is typed based on widget output schema
32
- * }
33
- * ```
34
- */
35
- export function createTypedHooks() {
36
- return {
37
- /**
38
- * Typed version of useCallTool that provides autocomplete for tool names
39
- * and type inference for inputs and outputs.
40
- */
41
- useCallTool: (name) => {
42
- return useCallTool(name);
43
- },
44
- /**
45
- * Typed version of useToolInfo that provides autocomplete for widget names
46
- * and type inference for inputs, outputs, and responseMetadata.
47
- *
48
- * @example
49
- * ```typescript
50
- * const toolInfo = useToolInfo<"search-voyage">();
51
- * // toolInfo.input is typed as { destination: string; ... }
52
- * // toolInfo.output is typed as { results: Array<...>; ... } | undefined
53
- * // toolInfo.status narrows correctly: "pending" | "success"
54
- * ```
55
- */
56
- useToolInfo: () => {
57
- return useToolInfo();
58
- },
59
- };
60
- }
61
- //# sourceMappingURL=typed-hooks.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typed-hooks.js","sourceRoot":"","sources":["../../../src/web/typed-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAgCvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,UAAU,gBAAgB;IAI9B,OAAO;QACL;;;WAGG;QACH,WAAW,EAAE,CACX,IAAO,EAIP,EAAE;YACF,OAAO,WAAW,CAGhB,IAAI,CAGL,CAAC;QACJ,CAAC;QACD;;;;;;;;;;;WAWG;QACH,WAAW,EAAE,GAIX,EAAE;YACF,OAAO,WAAW,EAQjB,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}