skybridge 0.0.0-dev.fc2f516 → 0.0.0-dev.fc66837

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 (287) hide show
  1. package/LICENSE +21 -674
  2. package/bin/run.js +5 -0
  3. package/dist/cli/header.d.ts +4 -0
  4. package/dist/cli/header.js +6 -0
  5. package/dist/cli/header.js.map +1 -0
  6. package/dist/cli/run-command.d.ts +2 -0
  7. package/dist/cli/run-command.js +43 -0
  8. package/dist/cli/run-command.js.map +1 -0
  9. package/dist/cli/use-execute-steps.d.ts +10 -0
  10. package/dist/cli/use-execute-steps.js +31 -0
  11. package/dist/cli/use-execute-steps.js.map +1 -0
  12. package/dist/commands/build.d.ts +9 -0
  13. package/dist/commands/build.js +44 -0
  14. package/dist/commands/build.js.map +1 -0
  15. package/dist/commands/dev.d.ts +9 -0
  16. package/dist/commands/dev.js +31 -0
  17. package/dist/commands/dev.js.map +1 -0
  18. package/dist/commands/start.d.ts +7 -0
  19. package/dist/commands/start.js +33 -0
  20. package/dist/commands/start.js.map +1 -0
  21. package/dist/server/index.d.ts +4 -0
  22. package/dist/server/index.js.map +1 -0
  23. package/dist/{src/server → server}/inferUtilityTypes.d.ts +10 -0
  24. package/dist/server/inferUtilityTypes.js.map +1 -0
  25. package/dist/server/server.d.ts +99 -0
  26. package/dist/server/server.js +139 -0
  27. package/dist/server/server.js.map +1 -0
  28. package/dist/{src/server → server}/templateHelper.d.ts +3 -0
  29. package/dist/{src/server → server}/templateHelper.js +5 -4
  30. package/dist/server/templateHelper.js.map +1 -0
  31. package/dist/server/templates/development.hbs +66 -0
  32. package/dist/{src/server → server}/templates/production.hbs +1 -0
  33. package/dist/{src/server → server}/widgetsDevServer.d.ts +2 -2
  34. package/dist/{src/server → server}/widgetsDevServer.js +13 -5
  35. package/dist/server/widgetsDevServer.js.map +1 -0
  36. package/dist/{src/test → test}/utils.d.ts +54 -8
  37. package/dist/{src/test → test}/utils.js +86 -8
  38. package/dist/test/utils.js.map +1 -0
  39. package/dist/test/widget.test.js +255 -0
  40. package/dist/test/widget.test.js.map +1 -0
  41. package/dist/web/bridges/apps-sdk/adaptor.d.ts +20 -0
  42. package/dist/web/bridges/apps-sdk/adaptor.js +45 -0
  43. package/dist/web/bridges/apps-sdk/adaptor.js.map +1 -0
  44. package/dist/web/bridges/apps-sdk/bridge.d.ts +10 -0
  45. package/dist/web/bridges/apps-sdk/bridge.js +46 -0
  46. package/dist/web/bridges/apps-sdk/bridge.js.map +1 -0
  47. package/dist/web/bridges/apps-sdk/index.d.ts +5 -0
  48. package/dist/web/bridges/apps-sdk/index.js +5 -0
  49. package/dist/web/bridges/apps-sdk/index.js.map +1 -0
  50. package/dist/{src/web → web/bridges/apps-sdk}/types.d.ts +29 -44
  51. package/dist/{src/web → web/bridges/apps-sdk}/types.js +0 -1
  52. package/dist/web/bridges/apps-sdk/types.js.map +1 -0
  53. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +2 -0
  54. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +7 -0
  55. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -0
  56. package/dist/web/bridges/get-adaptor.d.ts +2 -0
  57. package/dist/web/bridges/get-adaptor.js +8 -0
  58. package/dist/web/bridges/get-adaptor.js.map +1 -0
  59. package/dist/web/bridges/index.d.ts +5 -0
  60. package/dist/web/bridges/index.js +6 -0
  61. package/dist/web/bridges/index.js.map +1 -0
  62. package/dist/web/bridges/mcp-app/adaptor.d.ts +31 -0
  63. package/dist/web/bridges/mcp-app/adaptor.js +157 -0
  64. package/dist/web/bridges/mcp-app/adaptor.js.map +1 -0
  65. package/dist/web/bridges/mcp-app/bridge.d.ts +43 -0
  66. package/dist/web/bridges/mcp-app/bridge.js +255 -0
  67. package/dist/web/bridges/mcp-app/bridge.js.map +1 -0
  68. package/dist/web/bridges/mcp-app/index.d.ts +4 -0
  69. package/dist/web/bridges/mcp-app/index.js +4 -0
  70. package/dist/web/bridges/mcp-app/index.js.map +1 -0
  71. package/dist/web/bridges/mcp-app/types.d.ts +8 -0
  72. package/dist/web/bridges/mcp-app/types.js +2 -0
  73. package/dist/web/bridges/mcp-app/types.js.map +1 -0
  74. package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +5 -0
  75. package/dist/web/bridges/mcp-app/use-mcp-app-context.js +7 -0
  76. package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -0
  77. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +66 -0
  78. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -0
  79. package/dist/web/bridges/types.d.ts +81 -0
  80. package/dist/web/bridges/types.js +2 -0
  81. package/dist/web/bridges/types.js.map +1 -0
  82. package/dist/web/bridges/use-host-context.d.ts +2 -0
  83. package/dist/web/bridges/use-host-context.js +8 -0
  84. package/dist/web/bridges/use-host-context.js.map +1 -0
  85. package/dist/web/create-store.d.ts +3 -0
  86. package/dist/web/create-store.js +24 -0
  87. package/dist/web/create-store.js.map +1 -0
  88. package/dist/web/create-store.test.js +126 -0
  89. package/dist/web/create-store.test.js.map +1 -0
  90. package/dist/{src/web → web}/data-llm.d.ts +1 -0
  91. package/dist/{src/web → web}/data-llm.js +13 -8
  92. package/dist/web/data-llm.js.map +1 -0
  93. package/dist/web/data-llm.test.js +139 -0
  94. package/dist/web/data-llm.test.js.map +1 -0
  95. package/dist/{src/web → web}/generate-helpers.d.ts +13 -12
  96. package/dist/{src/web → web}/generate-helpers.js +7 -5
  97. package/dist/web/generate-helpers.js.map +1 -0
  98. package/dist/{src/web → web}/generate-helpers.test-d.js +62 -4
  99. package/dist/web/generate-helpers.test-d.js.map +1 -0
  100. package/dist/{src/web → web}/generate-helpers.test.js +1 -1
  101. package/dist/web/generate-helpers.test.js.map +1 -0
  102. package/dist/web/helpers/state.d.ts +7 -0
  103. package/dist/web/helpers/state.js +45 -0
  104. package/dist/web/helpers/state.js.map +1 -0
  105. package/dist/web/helpers/state.test.js +53 -0
  106. package/dist/web/helpers/state.test.js.map +1 -0
  107. package/dist/{src/web → web}/hooks/index.d.ts +3 -5
  108. package/dist/{src/web → web}/hooks/index.js +2 -4
  109. package/dist/web/hooks/index.js.map +1 -0
  110. package/dist/web/hooks/test/utils.d.ts +16 -0
  111. package/dist/web/hooks/test/utils.js +60 -0
  112. package/dist/web/hooks/test/utils.js.map +1 -0
  113. package/dist/{src/web → web}/hooks/use-call-tool.d.ts +3 -2
  114. package/dist/{src/web → web}/hooks/use-call-tool.js +12 -4
  115. package/dist/web/hooks/use-call-tool.js.map +1 -0
  116. package/dist/{src/web → web}/hooks/use-call-tool.test-d.js +1 -1
  117. package/dist/web/hooks/use-call-tool.test-d.js.map +1 -0
  118. package/dist/{src/web → web}/hooks/use-call-tool.test.js +35 -16
  119. package/dist/web/hooks/use-call-tool.test.js.map +1 -0
  120. package/dist/{src/web → web}/hooks/use-display-mode.d.ts +1 -1
  121. package/dist/web/hooks/use-display-mode.js +9 -0
  122. package/dist/web/hooks/use-display-mode.js.map +1 -0
  123. package/dist/{src/web → web}/hooks/use-display-mode.test.js +3 -2
  124. package/dist/web/hooks/use-display-mode.test.js.map +1 -0
  125. package/dist/web/hooks/use-files.d.ts +6 -0
  126. package/dist/web/hooks/use-files.js +9 -0
  127. package/dist/web/hooks/use-files.js.map +1 -0
  128. package/dist/{src/web → web}/hooks/use-files.test.js +6 -5
  129. package/dist/web/hooks/use-files.test.js.map +1 -0
  130. package/dist/web/hooks/use-layout.d.ts +22 -0
  131. package/dist/web/hooks/use-layout.js +23 -0
  132. package/dist/web/hooks/use-layout.js.map +1 -0
  133. package/dist/web/hooks/use-layout.test.js +96 -0
  134. package/dist/web/hooks/use-layout.test.js.map +1 -0
  135. package/dist/web/hooks/use-open-external.js +8 -0
  136. package/dist/web/hooks/use-open-external.js.map +1 -0
  137. package/dist/web/hooks/use-open-external.test.js +50 -0
  138. package/dist/web/hooks/use-open-external.test.js.map +1 -0
  139. package/dist/web/hooks/use-request-modal.d.ts +9 -0
  140. package/dist/web/hooks/use-request-modal.js +14 -0
  141. package/dist/web/hooks/use-request-modal.js.map +1 -0
  142. package/dist/web/hooks/use-request-modal.test.js +57 -0
  143. package/dist/web/hooks/use-request-modal.test.js.map +1 -0
  144. package/dist/web/hooks/use-send-follow-up-message.js +8 -0
  145. package/dist/web/hooks/use-send-follow-up-message.js.map +1 -0
  146. package/dist/{src/web → web}/hooks/use-tool-info.d.ts +13 -2
  147. package/dist/web/hooks/use-tool-info.js +26 -0
  148. package/dist/web/hooks/use-tool-info.js.map +1 -0
  149. package/dist/{src/web → web}/hooks/use-tool-info.test-d.js +40 -5
  150. package/dist/web/hooks/use-tool-info.test-d.js.map +1 -0
  151. package/dist/web/hooks/use-tool-info.test.js +130 -0
  152. package/dist/web/hooks/use-tool-info.test.js.map +1 -0
  153. package/dist/web/hooks/use-user.d.ts +18 -0
  154. package/dist/web/hooks/use-user.js +19 -0
  155. package/dist/web/hooks/use-user.js.map +1 -0
  156. package/dist/web/hooks/use-user.test.js +94 -0
  157. package/dist/web/hooks/use-user.test.js.map +1 -0
  158. package/dist/web/hooks/use-widget-state.js +32 -0
  159. package/dist/web/hooks/use-widget-state.js.map +1 -0
  160. package/dist/{src/web → web}/hooks/use-widget-state.test.js +3 -2
  161. package/dist/web/hooks/use-widget-state.test.js.map +1 -0
  162. package/dist/{src/web → web}/index.d.ts +5 -3
  163. package/dist/{src/web → web}/index.js +5 -3
  164. package/dist/web/index.js.map +1 -0
  165. package/dist/web/mount-widget.js.map +1 -0
  166. package/dist/web/plugin/data-llm.test.d.ts +1 -0
  167. package/dist/web/plugin/data-llm.test.js.map +1 -0
  168. package/dist/{src/web → web}/plugin/plugin.js +10 -4
  169. package/dist/web/plugin/plugin.js.map +1 -0
  170. package/dist/{src/web → web}/plugin/transform-data-llm.js +6 -3
  171. package/dist/web/plugin/transform-data-llm.js.map +1 -0
  172. package/dist/web/plugin/transform-data-llm.test.d.ts +1 -0
  173. package/dist/web/plugin/transform-data-llm.test.js.map +1 -0
  174. package/dist/{src/web → web}/proxy.js +6 -1
  175. package/dist/web/proxy.js.map +1 -0
  176. package/dist/web/types.d.ts +16 -0
  177. package/dist/web/types.js +2 -0
  178. package/dist/web/types.js.map +1 -0
  179. package/package.json +54 -32
  180. package/README.md +0 -371
  181. package/dist/src/server/index.d.ts +0 -4
  182. package/dist/src/server/index.js.map +0 -1
  183. package/dist/src/server/inferUtilityTypes.js.map +0 -1
  184. package/dist/src/server/server.d.ts +0 -48
  185. package/dist/src/server/server.js +0 -62
  186. package/dist/src/server/server.js.map +0 -1
  187. package/dist/src/server/templateHelper.js.map +0 -1
  188. package/dist/src/server/templates/development.hbs +0 -12
  189. package/dist/src/server/widgetsDevServer.js.map +0 -1
  190. package/dist/src/test/utils.js.map +0 -1
  191. package/dist/src/test/widget.test.js +0 -90
  192. package/dist/src/test/widget.test.js.map +0 -1
  193. package/dist/src/web/data-llm.js.map +0 -1
  194. package/dist/src/web/data-llm.test.js +0 -76
  195. package/dist/src/web/data-llm.test.js.map +0 -1
  196. package/dist/src/web/generate-helpers.js.map +0 -1
  197. package/dist/src/web/generate-helpers.test-d.js.map +0 -1
  198. package/dist/src/web/generate-helpers.test.js.map +0 -1
  199. package/dist/src/web/hooks/index.js.map +0 -1
  200. package/dist/src/web/hooks/use-call-tool.js.map +0 -1
  201. package/dist/src/web/hooks/use-call-tool.test-d.js.map +0 -1
  202. package/dist/src/web/hooks/use-call-tool.test.js.map +0 -1
  203. package/dist/src/web/hooks/use-display-mode.js +0 -7
  204. package/dist/src/web/hooks/use-display-mode.js.map +0 -1
  205. package/dist/src/web/hooks/use-display-mode.test.js.map +0 -1
  206. package/dist/src/web/hooks/use-files.d.ts +0 -10
  207. package/dist/src/web/hooks/use-files.js +0 -7
  208. package/dist/src/web/hooks/use-files.js.map +0 -1
  209. package/dist/src/web/hooks/use-files.test.js.map +0 -1
  210. package/dist/src/web/hooks/use-locale.d.ts +0 -1
  211. package/dist/src/web/hooks/use-locale.js +0 -5
  212. package/dist/src/web/hooks/use-locale.js.map +0 -1
  213. package/dist/src/web/hooks/use-locale.test.js +0 -21
  214. package/dist/src/web/hooks/use-locale.test.js.map +0 -1
  215. package/dist/src/web/hooks/use-open-external.js +0 -6
  216. package/dist/src/web/hooks/use-open-external.js.map +0 -1
  217. package/dist/src/web/hooks/use-open-external.test.js +0 -24
  218. package/dist/src/web/hooks/use-open-external.test.js.map +0 -1
  219. package/dist/src/web/hooks/use-openai-global.d.ts +0 -2
  220. package/dist/src/web/hooks/use-openai-global.js +0 -23
  221. package/dist/src/web/hooks/use-openai-global.js.map +0 -1
  222. package/dist/src/web/hooks/use-request-modal.d.ts +0 -6
  223. package/dist/src/web/hooks/use-request-modal.js +0 -9
  224. package/dist/src/web/hooks/use-request-modal.js.map +0 -1
  225. package/dist/src/web/hooks/use-request-modal.test.js +0 -24
  226. package/dist/src/web/hooks/use-request-modal.test.js.map +0 -1
  227. package/dist/src/web/hooks/use-send-follow-up-message.js +0 -11
  228. package/dist/src/web/hooks/use-send-follow-up-message.js.map +0 -1
  229. package/dist/src/web/hooks/use-theme.d.ts +0 -1
  230. package/dist/src/web/hooks/use-theme.js +0 -5
  231. package/dist/src/web/hooks/use-theme.js.map +0 -1
  232. package/dist/src/web/hooks/use-theme.test.js +0 -26
  233. package/dist/src/web/hooks/use-theme.test.js.map +0 -1
  234. package/dist/src/web/hooks/use-tool-info.js +0 -22
  235. package/dist/src/web/hooks/use-tool-info.js.map +0 -1
  236. package/dist/src/web/hooks/use-tool-info.test-d.js.map +0 -1
  237. package/dist/src/web/hooks/use-tool-info.test.js +0 -59
  238. package/dist/src/web/hooks/use-tool-info.test.js.map +0 -1
  239. package/dist/src/web/hooks/use-user-agent.d.ts +0 -1
  240. package/dist/src/web/hooks/use-user-agent.js +0 -5
  241. package/dist/src/web/hooks/use-user-agent.js.map +0 -1
  242. package/dist/src/web/hooks/use-user-agent.test.js +0 -31
  243. package/dist/src/web/hooks/use-user-agent.test.js.map +0 -1
  244. package/dist/src/web/hooks/use-widget-state.js +0 -54
  245. package/dist/src/web/hooks/use-widget-state.js.map +0 -1
  246. package/dist/src/web/hooks/use-widget-state.test.js.map +0 -1
  247. package/dist/src/web/index.js.map +0 -1
  248. package/dist/src/web/mount-widget.js.map +0 -1
  249. package/dist/src/web/plugin/data-llm.test.js.map +0 -1
  250. package/dist/src/web/plugin/plugin.js.map +0 -1
  251. package/dist/src/web/plugin/transform-data-llm.js.map +0 -1
  252. package/dist/src/web/plugin/transform-data-llm.test.js.map +0 -1
  253. package/dist/src/web/proxy.js.map +0 -1
  254. package/dist/src/web/types.js.map +0 -1
  255. package/dist/vitest.config.d.ts +0 -2
  256. package/dist/vitest.config.js +0 -8
  257. package/dist/vitest.config.js.map +0 -1
  258. /package/dist/{src/server → server}/index.js +0 -0
  259. /package/dist/{src/server → server}/inferUtilityTypes.js +0 -0
  260. /package/dist/{src/test → test}/widget.test.d.ts +0 -0
  261. /package/dist/{src/web/data-llm.test.d.ts → web/bridges/mcp-app/use-mcp-app-context.test.d.ts} +0 -0
  262. /package/dist/{src/web/generate-helpers.test-d.d.ts → web/create-store.test.d.ts} +0 -0
  263. /package/dist/{src/web/plugin → web}/data-llm.test.d.ts +0 -0
  264. /package/dist/{src/web/generate-helpers.test.d.ts → web/generate-helpers.test-d.d.ts} +0 -0
  265. /package/dist/{src/web/hooks/use-call-tool.test-d.d.ts → web/generate-helpers.test.d.ts} +0 -0
  266. /package/dist/{src/web/hooks/use-call-tool.test.d.ts → web/helpers/state.test.d.ts} +0 -0
  267. /package/dist/{src/web/hooks/use-display-mode.test.d.ts → web/hooks/use-call-tool.test-d.d.ts} +0 -0
  268. /package/dist/{src/web/hooks/use-files.test.d.ts → web/hooks/use-call-tool.test.d.ts} +0 -0
  269. /package/dist/{src/web/hooks/use-locale.test.d.ts → web/hooks/use-display-mode.test.d.ts} +0 -0
  270. /package/dist/{src/web/hooks/use-open-external.test.d.ts → web/hooks/use-files.test.d.ts} +0 -0
  271. /package/dist/{src/web/hooks/use-request-modal.test.d.ts → web/hooks/use-layout.test.d.ts} +0 -0
  272. /package/dist/{src/web → web}/hooks/use-open-external.d.ts +0 -0
  273. /package/dist/{src/web/hooks/use-theme.test.d.ts → web/hooks/use-open-external.test.d.ts} +0 -0
  274. /package/dist/{src/web/hooks/use-tool-info.test-d.d.ts → web/hooks/use-request-modal.test.d.ts} +0 -0
  275. /package/dist/{src/web → web}/hooks/use-send-follow-up-message.d.ts +0 -0
  276. /package/dist/{src/web/hooks/use-tool-info.test.d.ts → web/hooks/use-tool-info.test-d.d.ts} +0 -0
  277. /package/dist/{src/web/hooks/use-user-agent.test.d.ts → web/hooks/use-tool-info.test.d.ts} +0 -0
  278. /package/dist/{src/web/hooks/use-widget-state.test.d.ts → web/hooks/use-user.test.d.ts} +0 -0
  279. /package/dist/{src/web → web}/hooks/use-widget-state.d.ts +0 -0
  280. /package/dist/{src/web/plugin/transform-data-llm.test.d.ts → web/hooks/use-widget-state.test.d.ts} +0 -0
  281. /package/dist/{src/web → web}/mount-widget.d.ts +0 -0
  282. /package/dist/{src/web → web}/mount-widget.js +0 -0
  283. /package/dist/{src/web → web}/plugin/data-llm.test.js +0 -0
  284. /package/dist/{src/web → web}/plugin/plugin.d.ts +0 -0
  285. /package/dist/{src/web → web}/plugin/transform-data-llm.d.ts +0 -0
  286. /package/dist/{src/web → web}/plugin/transform-data-llm.test.js +0 -0
  287. /package/dist/{src/web → web}/proxy.d.ts +0 -0
package/README.md DELETED
@@ -1,371 +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
- > **Tip:** For the best TypeScript experience, use typed hooks throughout your application. They provide autocomplete, type safety, and better IDE support.
105
-
106
- > **Important:** For `generateHelpers` to work correctly, your MCP server must be defined using method chaining (e.g., `server.widget(...).widget(...).registerTool(...)`). This ensures TypeScript can properly infer the tool registry type from the chained calls.
107
-
108
- **Examples:**
109
-
110
- ✅ **Works** - Using method chaining:
111
-
112
- ```ts
113
- import { McpServer } from "skybridge/server";
114
- import { z } from "zod";
115
-
116
- const server = new McpServer({ name: "my-app", version: "1.0" }, {})
117
- .widget("search-voyage", {}, {
118
- inputSchema: { destination: z.string() },
119
- }, async ({ destination }) => {
120
- return { content: [{ type: "text", text: `Found trips to ${destination}` }] };
121
- })
122
- .registerTool("calculate-price", {
123
- inputSchema: { tripId: z.string() },
124
- }, async ({ tripId }) => {
125
- return { content: [{ type: "text", text: `Price for ${tripId}` }] };
126
- });
127
-
128
- export type AppType = typeof server; // ✅ Type inference works correctly
129
- ```
130
-
131
- ❌ **Doesn't work** - Without method chaining:
132
-
133
- ```ts
134
- import { McpServer } from "skybridge/server";
135
- import { z } from "zod";
136
-
137
- const server = new McpServer({ name: "my-app", version: "1.0" }, {});
138
-
139
- server.widget("search-voyage", {}, {
140
- inputSchema: { destination: z.string() },
141
- }, async ({ destination }) => {
142
- return { content: [{ type: "text", text: `Found trips to ${destination}` }] };
143
- });
144
-
145
- server.registerTool("calculate-price", {
146
- inputSchema: { tripId: z.string() },
147
- }, async ({ tripId }) => {
148
- return { content: [{ type: "text", text: `Price for ${tripId}` }] };
149
- });
150
-
151
- export type AppType = typeof server; // ❌ Type inference fails - tool registry is empty
152
- ```
153
-
154
- _Server setup (server/src/index.ts)_
155
-
156
- ```ts
157
- import { McpServer } from "skybridge/server";
158
- import { z } from "zod";
159
-
160
- const server = new McpServer({ name: "my-app", version: "1.0" }, {})
161
- .widget("search-voyage", {}, {
162
- description: "Search for trips",
163
- inputSchema: {
164
- destination: z.string(),
165
- departureDate: z.string().optional(),
166
- },
167
- outputSchema: {
168
- results: z.array(z.object({ id: z.string(), name: z.string() })),
169
- totalCount: z.number(),
170
- },
171
- }, async ({ destination }) => {
172
- // Your tool logic here...
173
- return { content: [{ type: "text", text: `Found trips to ${destination}` }] };
174
- })
175
- .widget("get-details", {}, {
176
- inputSchema: { tripId: z.string() },
177
- }, async ({ tripId }) => {
178
- return { content: [{ type: "text", text: `Details for ${tripId}` }] };
179
- });
180
-
181
- // Export the server type for the client
182
- export type AppType = typeof server;
183
- ```
184
-
185
- _One-time setup (web/src/skybridge.ts)_
186
-
187
- Create typed hooks once and export them for use across your app. This file acts as a bridge between your server types and your widgets:
188
-
189
- ```ts
190
- import type { AppType } from "../server"; // type-only import
191
- import { generateHelpers } from "skybridge/web";
192
-
193
- export const { useCallTool, useToolInfo } = generateHelpers<AppType>();
194
- ```
195
-
196
- _Usage in widgets (web/src/widgets/search.tsx)_
197
-
198
- ```tsx
199
- import { useCallTool, useToolInfo } from "../skybridge"; // import typed hooks
200
-
201
- export function SearchWidget() {
202
- const { callTool, data, isPending } = useCallTool("search-voyage");
203
- // ^ autocomplete for tool names
204
- const toolInfo = useToolInfo<"search-voyage">();
205
- // ^ autocomplete for widget names
206
-
207
- const handleSearch = () => {
208
- callTool({ destination: "Spain" });
209
- // ^ autocomplete for input fields
210
- };
211
-
212
- return (
213
- <div>
214
- <button onClick={handleSearch} disabled={isPending}>
215
- Search
216
- </button>
217
- {toolInfo.isSuccess && (
218
- <div>Found {toolInfo.output.structuredContent.totalCount} results</div>
219
- // ^ typed output
220
- )}
221
- </div>
222
- );
223
- }
224
- ```
225
-
226
- **Hooks**
227
-
228
- The `skybridge/web` package comes with a set of hooks to help you build your widgets :
229
-
230
- - `useOpenAiGlobal`: A generic hook to get any global data from the OpenAI iFrame skybridge runtime (in `window.openai`).
231
- - `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.
232
- - `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.
233
- - `useToolInfo`: A hook to get the tool input, output, and response metadata with type inference. Provides a discriminated union based on status (pending/success).
234
- - `useCallTool`: A @tanstack/react-query inspired hook to send make additional tool calls inside a widget.
235
- - `generateHelpers`: A factory that creates typed versions of `useCallTool` and `useToolInfo` with full type inference from your server type.
236
-
237
- _useOpenAiGlobal_
238
-
239
- ```ts
240
- import { useOpenAiGlobal } from "skybridge/web";
241
-
242
- const theme = useOpenAiGlobal("theme");
243
- ```
244
-
245
- _useToolOutput_
246
-
247
- ```ts
248
- import { useToolOutput } from "skybridge/web";
249
-
250
- const toolOutput = useToolOutput();
251
- ```
252
-
253
- _useToolResponseMetadata_
254
-
255
- ```ts
256
- import { useToolResponseMetadata } from "skybridge/web";
257
-
258
- const toolResponseMetadata = useToolResponseMetadata();
259
- ```
260
-
261
- _useToolInfo_
262
-
263
- ```ts
264
- import { useToolInfo } from "skybridge/web";
265
-
266
- const toolInfo = useToolInfo<{
267
- input: { query: string };
268
- output: { results: string[] };
269
- responseMetadata: { id: number };
270
- }>();
271
-
272
- // toolInfo.input is typed based on the input type
273
- // toolInfo.output.structuredContent is typed based on the output type (undefined when pending)
274
- // toolInfo.status narrows correctly: "pending" | "success"
275
-
276
- if (toolInfo.isPending) {
277
- // toolInfo.output is undefined here (pending state)
278
- console.log(toolInfo.input.query);
279
- }
280
-
281
- if (toolInfo.isSuccess) {
282
- // toolInfo.output.structuredContent is typed here
283
- console.log(toolInfo.output.structuredContent.results);
284
- }
285
- ```
286
-
287
- _useToolInfo_ with typed hooks (recommended)
288
-
289
- ```tsx
290
- import { useToolInfo } from "../skybridge"; // import typed hooks
291
-
292
- export function SearchWidget() {
293
- const toolInfo = useToolInfo<"search-voyage">();
294
- // ^ autocomplete for widget names
295
- // toolInfo.input is typed as { destination: string; departureDate?: string; ... }
296
- // toolInfo.output.structuredContent is typed as { results: Array<...>; totalCount: number; }
297
-
298
- if (toolInfo.isSuccess) {
299
- return <div>Found {toolInfo.output.structuredContent.totalCount} results</div>;
300
- }
301
-
302
- return <div>Searching for {toolInfo.input.destination}...</div>;
303
- }
304
- ```
305
-
306
- _useCallTool_ in synchronous mode
307
-
308
- ```ts
309
- import { useCallTool } from "skybridge/web";
310
-
311
- export const TestTool: React.FunctionComponent = () => {
312
- const { callTool, isPending } = useCallTool("myToolName");
313
-
314
- return (
315
- <div>
316
- <button
317
- disabled={isPending}
318
- onClick={() => {
319
- callTool({ input: "test input" }, {
320
- onSuccess: (data) => {
321
- alert("Tool returned: " + data);
322
- },
323
- });
324
- >
325
- Call Tool inside a widget
326
- </button>
327
- </div>
328
- );
329
- };
330
- ```
331
-
332
- _useCallTool_ in asynchronous mode
333
-
334
- ```ts
335
- import { useCallTool } from "skybridge/web";
336
-
337
- export const TestTool: React.FunctionComponent = () => {
338
- const { callToolAsync, isPending } = useCallTool("myToolName");
339
-
340
- return (
341
- <div>
342
- <button
343
- disabled={isPending}
344
- onClick={async () => {
345
- const data = await callToolAsync({ input: "test input" });
346
- alert("Tool returned: " + data);
347
- }}
348
- >
349
- Call Tool inside a widget
350
- </button>
351
- </div>
352
- );
353
- };
354
- ```
355
-
356
- ## Migrate your existing MCP server to a ChatGPT app
357
-
358
- If you're already using the `@modelcontextprotocol/sdk` to build a MCP server, you can migrate to a ChatGPT app by following these steps:
359
-
360
- 1. Replace your `McpServer` import from `@modelcontextprotocol/sdk` with the same import from `skybridge/server`
361
- 2. Create a new vite project in a folder named `web` and install the `skybridge` package
362
- 3. Replace the `vite.config.ts` file with the following:
363
-
364
- ```ts
365
- import { defineConfig } from "vite";
366
- import { skybridge } from "skybridge/web";
367
-
368
- export default defineConfig({
369
- plugins: [skybridge()],
370
- });
371
- ```
@@ -1,4 +0,0 @@
1
- export { McpServer } from "./server.js";
2
- export { widgetsDevServer } from "./widgetsDevServer.js";
3
- export type { ToolDef, McpServerTypes } from "./server.js";
4
- export type { InferTools, AnyToolRegistry, ToolNames, ToolInput, ToolOutput, } from "./inferUtilityTypes.js";
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"inferUtilityTypes.js","sourceRoot":"","sources":["../../../src/server/inferUtilityTypes.ts"],"names":[],"mappings":""}
@@ -1,48 +0,0 @@
1
- import { McpServer as McpServerBase, type RegisteredTool } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import type { Resource, ToolAnnotations, CallToolResult, ServerRequest, ServerNotification } from "@modelcontextprotocol/sdk/types.js";
3
- import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
4
- import type { ZodRawShape, ZodObject, infer as Infer } from "zod";
5
- export type ToolDef<TInput = unknown, TOutput = unknown> = {
6
- input: TInput;
7
- output: TOutput;
8
- };
9
- type McpServerOriginalResourceConfig = Omit<Resource, "uri" | "name" | "mimeType">;
10
- type McpServerOriginalToolConfig = Omit<Parameters<McpServerBase["registerTool"]>[1], "inputSchema" | "outputSchema">;
11
- type ExtractStructuredContent<T> = T extends {
12
- structuredContent: infer SC;
13
- } ? SC : never;
14
- /**
15
- * Type-level marker interface for cross-package type inference.
16
- * This enables TypeScript to infer tool types across package boundaries
17
- * using structural typing on the $types property, rather than relying on
18
- * class generic inference which fails when McpServer comes from different
19
- * package installations.
20
- *
21
- * Inspired by tRPC's _def pattern and Hono's type markers.
22
- */
23
- export interface McpServerTypes<TTools extends Record<string, ToolDef> = {}> {
24
- readonly tools: TTools;
25
- }
26
- type AddTool<TTools, TName extends string, TInput extends ZodRawShape, TOutput> = McpServer<TTools & {
27
- [K in TName]: ToolDef<Infer<ZodObject<TInput>>, TOutput>;
28
- }>;
29
- type ToolConfig<TInput extends ZodRawShape> = {
30
- title?: string;
31
- description?: string;
32
- inputSchema?: TInput;
33
- outputSchema?: ZodRawShape;
34
- annotations?: ToolAnnotations;
35
- _meta?: Record<string, unknown>;
36
- };
37
- type ToolHandler<TInput extends ZodRawShape, TReturn extends CallToolResult = CallToolResult> = (args: Infer<ZodObject<TInput>>, extra: RequestHandlerExtra<ServerRequest, ServerNotification>) => TReturn | Promise<TReturn>;
38
- export declare class McpServer<TTools extends Record<string, ToolDef> = {}> extends McpServerBase {
39
- readonly $types: McpServerTypes<TTools>;
40
- widget<TName extends string, TInput extends ZodRawShape, TReturn extends CallToolResult>(name: TName, resourceConfig: McpServerOriginalResourceConfig, toolConfig: McpServerOriginalToolConfig & {
41
- inputSchema?: TInput;
42
- outputSchema?: ZodRawShape;
43
- }, toolCallback: ToolHandler<TInput, TReturn>): AddTool<TTools, TName, TInput, ExtractStructuredContent<TReturn>>;
44
- registerTool<TName extends string, InputArgs extends ZodRawShape, TReturn extends CallToolResult>(name: TName, config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs, TReturn>): AddTool<TTools, TName, InputArgs, ExtractStructuredContent<TReturn>>;
45
- registerTool<InputArgs extends ZodRawShape>(name: string, config: ToolConfig<InputArgs>, cb: ToolHandler<InputArgs>): RegisteredTool;
46
- private lookupDistFile;
47
- }
48
- export {};
@@ -1,62 +0,0 @@
1
- import { McpServer as McpServerBase, } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- import { templateHelper } from "./templateHelper.js";
3
- import { readFileSync } from "node:fs";
4
- import path from "node:path";
5
- export class McpServer extends McpServerBase {
6
- widget(name, resourceConfig, toolConfig, toolCallback) {
7
- const uri = `ui://widgets/${name}.html`;
8
- const resourceMetadata = {
9
- ...(resourceConfig._meta ?? {}),
10
- };
11
- if (toolConfig.description !== undefined) {
12
- resourceMetadata["openai/widgetDescription"] = toolConfig.description;
13
- }
14
- this.resource(name, uri, {
15
- ...resourceConfig,
16
- _meta: resourceMetadata,
17
- }, async (_uri, extra) => {
18
- const serverUrl = process.env.NODE_ENV === "production"
19
- ? `https://${extra?.requestInfo?.headers?.["x-forwarded-host"] ??
20
- extra?.requestInfo?.headers?.host}`
21
- : `http://localhost:3000`;
22
- const html = process.env.NODE_ENV === "production"
23
- ? templateHelper.renderProduction({
24
- serverUrl,
25
- widgetFile: this.lookupDistFile(`src/widgets/${name}.tsx`),
26
- styleFile: this.lookupDistFile("style.css"),
27
- })
28
- : templateHelper.renderDevelopment({
29
- serverUrl,
30
- widgetName: name,
31
- });
32
- return {
33
- contents: [
34
- {
35
- uri,
36
- mimeType: "text/html+skybridge",
37
- text: html,
38
- },
39
- ],
40
- };
41
- });
42
- const toolMeta = {
43
- ...toolConfig._meta,
44
- "openai/outputTemplate": uri,
45
- "ui/resourceUri": uri,
46
- };
47
- this.registerTool(name, {
48
- ...toolConfig,
49
- _meta: toolMeta,
50
- }, toolCallback);
51
- return this;
52
- }
53
- registerTool(name, config, cb) {
54
- super.registerTool(name, config, cb);
55
- return this;
56
- }
57
- lookupDistFile(key) {
58
- const manifest = JSON.parse(readFileSync(path.join(process.cwd(), "dist", "assets", ".vite", "manifest.json"), "utf-8"));
59
- return manifest[key]?.file;
60
- }
61
- }
62
- //# sourceMappingURL=server.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,IAAI,aAAa,GAG3B,MAAM,yCA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,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAOtC,MAAM,cAAc;IACV,aAAa,GAAG,IAAI,GAAG,EAAsC,CAAC;IAE9D,YAAY,CAAC,YAAoB;QACvC,IAAI,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,EAAE,CAAC;YACzC,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAE,CAAC;QAC/C,CAAC;QAED,MAAM,YAAY,GAAG,IAAI,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,YAAY,MAAM,CAAC,CAAC;QACzE,MAAM,cAAc,GAAG,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,UAAU,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QAEpD,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;QAC/C,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED,gBAAgB,CAAC,IAIhB;QACC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,IAA+C;QAC/D,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;QAClD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;CACF;AAED,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,cAAc,EAAE,CAAC"}
@@ -1,12 +0,0 @@
1
- <base href="{{serverUrl}}" />
2
- <script type="module">
3
- import { injectIntoGlobalHook } from "{{serverUrl}}/@react-refresh";
4
- injectIntoGlobalHook(window); window.$RefreshReg$ = () => {};
5
- window.$RefreshSig$ = () => (type) => type;
6
- window.__vite_plugin_react_preamble_installed__ = true;
7
- </script>
8
- <script type="module" src="{{serverUrl}}/@vite/client"></script>
9
- <div id="root"></div>
10
- <script type="module">
11
- import('{{serverUrl}}/src/widgets/{{widgetName}}.tsx');
12
- </script>
@@ -1 +0,0 @@
1
- {"version":3,"file":"widgetsDevServer.js","sourceRoot":"","sources":["../../../src/server/widgetsDevServer.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,EAAE,EAAuB,MAAM,SAAS,CAAC;AACvD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,IAA6B,EAAE;IAClE,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAEhC,MAAM,EAAE,YAAY,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,GAChE,MAAM,MAAM,CAAC,MAAM,CAAC,CAAC;IACvB,MAAM,aAAa,GAAG,sBAAsB,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IAC5D,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,CAAC,CAAC;IAEnD,MAAM,YAAY,GAAG,MAAM,kBAAkB,CAC3C,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,aAAa,EAAE,EACzC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,gBAAgB,CAAC,EACvC,UAAU,CACX,CAAC;IAEF,+DAA+D;IAC/D,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,SAAS,EAAE,GAAG,YAAY,EAAE,MAAM,IAAI,EAAE,CAAC;IAEpE,MAAM,IAAI,GAAG,MAAM,YAAY,CAAC;QAC9B,GAAG,SAAS;QACZ,UAAU,EAAE,KAAK,EAAE,kFAAkF;QACrG,OAAO,EAAE,QAAQ;QACjB,MAAM,EAAE;YACN,YAAY,EAAE,IAAI;YAClB,cAAc,EAAE,IA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B,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE;SAC9C,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO;QACL,WAAW,EAAE;YACX,OAAO,EAAE,EAAE,IAAI,EAAE;SAClB;KACF,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,GAA2B;IACpD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC9B,CAAC"}
@@ -1,90 +0,0 @@
1
- import * as fs from "node:fs";
2
- import { afterEach, beforeEach, describe, expect, it, vi, } from "vitest";
3
- import { McpServer } from "../server/server.js";
4
- import { createMockExtra, createMockMcpServer, resetTestEnv, setTestEnv, } from "./utils.js";
5
- const mockManifest = {
6
- "src/widgets/my-widget.tsx": { file: "my-widget.js" },
7
- "style.css": { file: "style.css" },
8
- };
9
- vi.mock("node:fs", async () => {
10
- const actual = await vi.importActual("node:fs");
11
- const readFileSync = vi.fn((path, ...args) => {
12
- if (typeof path === "string" && path.includes("manifest.json")) {
13
- return JSON.stringify(mockManifest);
14
- }
15
- return actual.readFileSync(path, ...args);
16
- });
17
- return {
18
- readFileSync,
19
- default: {
20
- readFileSync,
21
- },
22
- };
23
- });
24
- describe("McpServer.widget", () => {
25
- let server;
26
- let mockResource;
27
- let mockRegisterTool;
28
- let readFileSyncSpy = null;
29
- beforeEach(() => {
30
- ({ server, mockResource, mockRegisterTool } = createMockMcpServer());
31
- });
32
- afterEach(() => {
33
- vi.clearAllMocks();
34
- resetTestEnv();
35
- });
36
- it("should generate correct HTML for development mode", async () => {
37
- setTestEnv({ NODE_ENV: "development" });
38
- const mockToolCallback = vi.fn();
39
- const mockResourceConfig = { description: "Test widget" };
40
- const mockToolConfig = { description: "Test tool" };
41
- server.widget("my-widget", mockResourceConfig, mockToolConfig, mockToolCallback);
42
- // Get the resource callback function
43
- const resourceCallback = mockResource.mock.calls[0]?.[3];
44
- expect(resourceCallback).toBeDefined();
45
- const serverUrl = "http://localhost:3000";
46
- const mockExtra = createMockExtra("__not_used__");
47
- const result = await resourceCallback(new URL("ui://widgets/my-widget.html"), mockExtra);
48
- expect(result).toEqual({
49
- contents: [
50
- {
51
- uri: "ui://widgets/my-widget.html",
52
- mimeType: "text/html+skybridge",
53
- text: expect.stringContaining('<div id="root"></div>'),
54
- },
55
- ],
56
- });
57
- // Check development-specific content
58
- expect(result.contents[0]?.text).toContain(serverUrl + "/@react-refresh");
59
- expect(result.contents[0]?.text).toContain(serverUrl + "/@vite/client");
60
- expect(result.contents[0]?.text).toContain(serverUrl + "/src/widgets/my-widget.tsx");
61
- });
62
- it("should generate correct HTML for production mode", async () => {
63
- setTestEnv({ NODE_ENV: "production" });
64
- const mockToolCallback = vi.fn();
65
- const mockResourceConfig = { description: "Test widget" };
66
- const mockToolConfig = { description: "Test tool" };
67
- server.widget("my-widget", mockResourceConfig, mockToolConfig, mockToolCallback);
68
- // Get the resource callback function
69
- const resourceCallback = mockResource.mock.calls[0]?.[3];
70
- expect(resourceCallback).toBeDefined();
71
- const serverUrl = "https://myapp.com";
72
- const mockExtra = createMockExtra(serverUrl);
73
- const result = await resourceCallback(new URL("ui://widgets/my-widget.html"), mockExtra);
74
- expect(result).toEqual({
75
- contents: [
76
- {
77
- uri: "ui://widgets/my-widget.html",
78
- mimeType: "text/html+skybridge",
79
- text: expect.stringContaining('<div id="root"></div>'),
80
- },
81
- ],
82
- });
83
- // Check production-specific content
84
- expect(result.contents[0]?.text).not.toContain(serverUrl + "@react-refresh");
85
- expect(result.contents[0]?.text).not.toContain(serverUrl + "@vite/client");
86
- expect(result.contents[0]?.text).toContain(serverUrl + "/assets/my-widget.js");
87
- expect(result.contents[0]?.text).toContain(serverUrl + "/assets/style.css");
88
- });
89
- });
90
- //# sourceMappingURL=widget.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"widget.test.js","sourceRoot":"","sources":["../../../src/test/widget.test.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,EACL,SAAS,EACT,UAAU,EACV,QAAQ,EACR,MAAM,EACN,EAAE,EACF,EAAE,GAEH,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,YAAY,EACZ,UAAU,GACX,MAAM,YAAY,CAAC;AAEpB,MAAM,YAAY,GAAG;IACnB,2BAA2B,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE;IACrD,WAAW,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE;CACnC,CAAC;AAEF,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,KAAK,IAAI,EAAE;IAC5B,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,YAAY,CAA2B,SAAS,CAAC,CAAC;IAC1E,MAAM,YAAY,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,IAAY,EAAE,GAAG,IAAW,EAAE,EAAE;QAC1D,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC;YAC/D,OAAO,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;QACtC,CAAC;QACD,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC5C,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,YAAY;QACZ,OAAO,EAAE;YACP,YAAY;SACb;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,IAAI,MAAiB,CAA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