skybridge 0.0.0-dev.61ba6ab → 0.0.0-dev.61bfbf3

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 (334) hide show
  1. package/README.md +144 -0
  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/telemetry.d.ts +7 -0
  10. package/dist/cli/telemetry.js +123 -0
  11. package/dist/cli/telemetry.js.map +1 -0
  12. package/dist/cli/use-execute-steps.d.ts +11 -0
  13. package/dist/cli/use-execute-steps.js +36 -0
  14. package/dist/cli/use-execute-steps.js.map +1 -0
  15. package/dist/cli/use-nodemon.d.ts +6 -0
  16. package/dist/cli/use-nodemon.js +61 -0
  17. package/dist/cli/use-nodemon.js.map +1 -0
  18. package/dist/cli/use-typescript-check.d.ts +8 -0
  19. package/dist/cli/use-typescript-check.js +59 -0
  20. package/dist/cli/use-typescript-check.js.map +1 -0
  21. package/dist/commands/build.d.ts +9 -0
  22. package/dist/commands/build.js +46 -0
  23. package/dist/commands/build.js.map +1 -0
  24. package/dist/commands/dev.d.ts +9 -0
  25. package/dist/commands/dev.js +31 -0
  26. package/dist/commands/dev.js.map +1 -0
  27. package/dist/commands/start.d.ts +7 -0
  28. package/dist/commands/start.js +28 -0
  29. package/dist/commands/start.js.map +1 -0
  30. package/dist/commands/telemetry/disable.d.ts +5 -0
  31. package/dist/commands/telemetry/disable.js +14 -0
  32. package/dist/commands/telemetry/disable.js.map +1 -0
  33. package/dist/commands/telemetry/enable.d.ts +5 -0
  34. package/dist/commands/telemetry/enable.js +14 -0
  35. package/dist/commands/telemetry/enable.js.map +1 -0
  36. package/dist/commands/telemetry/status.d.ts +5 -0
  37. package/dist/commands/telemetry/status.js +14 -0
  38. package/dist/commands/telemetry/status.js.map +1 -0
  39. package/dist/server/asset-base-url-transform-plugin.d.ts +11 -0
  40. package/dist/server/asset-base-url-transform-plugin.js +34 -0
  41. package/dist/server/asset-base-url-transform-plugin.js.map +1 -0
  42. package/dist/server/asset-base-url-transform-plugin.test.js +56 -0
  43. package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -0
  44. package/dist/{src/server → server}/index.d.ts +0 -1
  45. package/dist/{src/server → server}/index.js +0 -1
  46. package/dist/server/index.js.map +1 -0
  47. package/dist/server/inferUtilityTypes.js.map +1 -0
  48. package/dist/{src/server → server}/server.d.ts +26 -1
  49. package/dist/server/server.js +153 -0
  50. package/dist/server/server.js.map +1 -0
  51. package/dist/{src/server → server}/templateHelper.d.ts +1 -0
  52. package/dist/server/templateHelper.js.map +1 -0
  53. package/dist/server/templates/development.hbs +67 -0
  54. package/dist/{src/server → server}/templates/production.hbs +1 -2
  55. package/dist/{src/server → server}/widgetsDevServer.d.ts +2 -2
  56. package/dist/server/widgetsDevServer.js +57 -0
  57. package/dist/server/widgetsDevServer.js.map +1 -0
  58. package/dist/test/utils.js.map +1 -0
  59. package/dist/{src/test → test}/widget.test.js +123 -14
  60. package/dist/test/widget.test.js.map +1 -0
  61. package/dist/web/bridges/apps-sdk/adaptor.d.ts +22 -0
  62. package/dist/web/bridges/apps-sdk/adaptor.js +64 -0
  63. package/dist/web/bridges/apps-sdk/adaptor.js.map +1 -0
  64. package/dist/web/bridges/apps-sdk/bridge.d.ts +10 -0
  65. package/dist/{src/web/bridges/apps-sdk-bridge.js → web/bridges/apps-sdk/bridge.js} +2 -2
  66. package/dist/web/bridges/apps-sdk/bridge.js.map +1 -0
  67. package/dist/web/bridges/apps-sdk/index.d.ts +5 -0
  68. package/dist/web/bridges/apps-sdk/index.js +5 -0
  69. package/dist/web/bridges/apps-sdk/index.js.map +1 -0
  70. package/dist/{src/web → web/bridges/apps-sdk}/types.d.ts +22 -56
  71. package/dist/{src/web → web/bridges/apps-sdk}/types.js +0 -1
  72. package/dist/web/bridges/apps-sdk/types.js.map +1 -0
  73. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +2 -0
  74. package/dist/{src/web/bridges/hooks/use-apps-sdk-bridge.js → web/bridges/apps-sdk/use-apps-sdk-context.js} +3 -3
  75. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -0
  76. package/dist/web/bridges/get-adaptor.d.ts +2 -0
  77. package/dist/web/bridges/get-adaptor.js +8 -0
  78. package/dist/web/bridges/get-adaptor.js.map +1 -0
  79. package/dist/web/bridges/index.d.ts +5 -0
  80. package/dist/web/bridges/index.js +6 -0
  81. package/dist/web/bridges/index.js.map +1 -0
  82. package/dist/web/bridges/mcp-app/adaptor.d.ts +36 -0
  83. package/dist/web/bridges/mcp-app/adaptor.js +188 -0
  84. package/dist/web/bridges/mcp-app/adaptor.js.map +1 -0
  85. package/dist/web/bridges/mcp-app/bridge.d.ts +43 -0
  86. package/dist/{src/web/bridges/mcp-app-bridge.js → web/bridges/mcp-app/bridge.js} +109 -16
  87. package/dist/web/bridges/mcp-app/bridge.js.map +1 -0
  88. package/dist/web/bridges/mcp-app/index.d.ts +4 -0
  89. package/dist/web/bridges/mcp-app/index.js +4 -0
  90. package/dist/web/bridges/mcp-app/index.js.map +1 -0
  91. package/dist/web/bridges/mcp-app/types.d.ts +8 -0
  92. package/dist/web/bridges/mcp-app/types.js.map +1 -0
  93. package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +5 -0
  94. package/dist/{src/web/bridges/hooks/use-mcp-app-bridge.js → web/bridges/mcp-app/use-mcp-app-context.js} +3 -3
  95. package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -0
  96. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +66 -0
  97. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -0
  98. package/dist/web/bridges/types.d.ts +98 -0
  99. package/dist/web/bridges/types.js +2 -0
  100. package/dist/{src/web → web}/bridges/types.js.map +1 -1
  101. package/dist/web/bridges/use-host-context.d.ts +2 -0
  102. package/dist/web/bridges/use-host-context.js +8 -0
  103. package/dist/web/bridges/use-host-context.js.map +1 -0
  104. package/dist/web/components/modal-provider.d.ts +4 -0
  105. package/dist/web/components/modal-provider.js +47 -0
  106. package/dist/web/components/modal-provider.js.map +1 -0
  107. package/dist/{src/web → web}/create-store.js +6 -7
  108. package/dist/web/create-store.js.map +1 -0
  109. package/dist/web/create-store.test.js +126 -0
  110. package/dist/web/create-store.test.js.map +1 -0
  111. package/dist/{src/web → web}/data-llm.js +5 -3
  112. package/dist/web/data-llm.js.map +1 -0
  113. package/dist/web/data-llm.test.js +139 -0
  114. package/dist/web/data-llm.test.js.map +1 -0
  115. package/dist/{src/web → web}/generate-helpers.d.ts +3 -2
  116. package/dist/{src/web → web}/generate-helpers.js +1 -1
  117. package/dist/web/generate-helpers.js.map +1 -0
  118. package/dist/web/generate-helpers.test-d.js.map +1 -0
  119. package/dist/web/generate-helpers.test.js.map +1 -0
  120. package/dist/{src/web → web}/helpers/state.js +13 -8
  121. package/dist/web/helpers/state.js.map +1 -0
  122. package/dist/web/helpers/state.test.js.map +1 -0
  123. package/dist/{src/web → web}/hooks/index.d.ts +1 -1
  124. package/dist/{src/web → web}/hooks/index.js +1 -1
  125. package/dist/web/hooks/index.js.map +1 -0
  126. package/dist/{src/web → web}/hooks/test/utils.d.ts +8 -2
  127. package/dist/web/hooks/test/utils.js +60 -0
  128. package/dist/web/hooks/test/utils.js.map +1 -0
  129. package/dist/{src/web → web}/hooks/use-call-tool.d.ts +2 -1
  130. package/dist/{src/web → web}/hooks/use-call-tool.js +2 -2
  131. package/dist/web/hooks/use-call-tool.js.map +1 -0
  132. package/dist/web/hooks/use-call-tool.test-d.js.map +1 -0
  133. package/dist/{src/web → web}/hooks/use-call-tool.test.js +0 -1
  134. package/dist/web/hooks/use-call-tool.test.js.map +1 -0
  135. package/dist/web/hooks/use-display-mode.js +9 -0
  136. package/dist/web/hooks/use-display-mode.js.map +1 -0
  137. package/dist/web/hooks/use-display-mode.test.js.map +1 -0
  138. package/dist/web/hooks/use-files.d.ts +6 -0
  139. package/dist/web/hooks/use-files.js +9 -0
  140. package/dist/web/hooks/use-files.js.map +1 -0
  141. package/dist/{src/web → web}/hooks/use-files.test.js +5 -4
  142. package/dist/web/hooks/use-files.test.js.map +1 -0
  143. package/dist/{src/web → web}/hooks/use-layout.d.ts +2 -2
  144. package/dist/{src/web → web}/hooks/use-layout.js +4 -4
  145. package/dist/web/hooks/use-layout.js.map +1 -0
  146. package/dist/{src/web → web}/hooks/use-layout.test.js +6 -5
  147. package/dist/web/hooks/use-layout.test.js.map +1 -0
  148. package/dist/{src/web → web}/hooks/use-open-external.js +2 -2
  149. package/dist/web/hooks/use-open-external.js.map +1 -0
  150. package/dist/{src/web → web}/hooks/use-open-external.test.js +1 -1
  151. package/dist/web/hooks/use-open-external.test.js.map +1 -0
  152. package/dist/{src/web → web}/hooks/use-request-modal.d.ts +2 -2
  153. package/dist/web/hooks/use-request-modal.js +16 -0
  154. package/dist/web/hooks/use-request-modal.js.map +1 -0
  155. package/dist/web/hooks/use-request-modal.test.js.map +1 -0
  156. package/dist/{src/web → web}/hooks/use-send-follow-up-message.js +2 -2
  157. package/dist/web/hooks/use-send-follow-up-message.js.map +1 -0
  158. package/dist/web/hooks/use-set-open-in-app-url.d.ts +1 -0
  159. package/dist/web/hooks/use-set-open-in-app-url.js +8 -0
  160. package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -0
  161. package/dist/web/hooks/use-set-open-in-app-url.test.js +49 -0
  162. package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -0
  163. package/dist/{src/web → web}/hooks/use-tool-info.js +4 -4
  164. package/dist/web/hooks/use-tool-info.js.map +1 -0
  165. package/dist/web/hooks/use-tool-info.test-d.js.map +1 -0
  166. package/dist/{src/web → web}/hooks/use-tool-info.test.js +4 -4
  167. package/dist/web/hooks/use-tool-info.test.js.map +1 -0
  168. package/dist/{src/web → web}/hooks/use-user.d.ts +1 -1
  169. package/dist/{src/web → web}/hooks/use-user.js +3 -3
  170. package/dist/web/hooks/use-user.js.map +1 -0
  171. package/dist/{src/web → web}/hooks/use-user.test.js +4 -3
  172. package/dist/web/hooks/use-user.test.js.map +1 -0
  173. package/dist/{src/web → web}/hooks/use-widget-state.js +10 -10
  174. package/dist/web/hooks/use-widget-state.js.map +1 -0
  175. package/dist/web/hooks/use-widget-state.test.js.map +1 -0
  176. package/dist/web/index.js.map +1 -0
  177. package/dist/{src/web → web}/mount-widget.js +9 -1
  178. package/dist/web/mount-widget.js.map +1 -0
  179. package/dist/web/plugin/data-llm.test.d.ts +1 -0
  180. package/dist/web/plugin/data-llm.test.js.map +1 -0
  181. package/dist/{src/web → web}/plugin/plugin.js +16 -9
  182. package/dist/web/plugin/plugin.js.map +1 -0
  183. package/dist/web/plugin/transform-data-llm.js.map +1 -0
  184. package/dist/web/plugin/transform-data-llm.test.d.ts +1 -0
  185. package/dist/web/plugin/transform-data-llm.test.js.map +1 -0
  186. package/dist/{src/web → web}/proxy.js +0 -1
  187. package/dist/web/proxy.js.map +1 -0
  188. package/dist/web/types.d.ts +16 -0
  189. package/dist/web/types.js +2 -0
  190. package/dist/web/types.js.map +1 -0
  191. package/package.json +47 -25
  192. package/dist/src/server/devtoolsStaticServer.d.ts +0 -19
  193. package/dist/src/server/devtoolsStaticServer.js +0 -48
  194. package/dist/src/server/devtoolsStaticServer.js.map +0 -1
  195. package/dist/src/server/index.js.map +0 -1
  196. package/dist/src/server/inferUtilityTypes.js.map +0 -1
  197. package/dist/src/server/server.js +0 -82
  198. package/dist/src/server/server.js.map +0 -1
  199. package/dist/src/server/templateHelper.js.map +0 -1
  200. package/dist/src/server/templates/development.hbs +0 -13
  201. package/dist/src/server/widgetsDevServer.js +0 -38
  202. package/dist/src/server/widgetsDevServer.js.map +0 -1
  203. package/dist/src/test/utils.js.map +0 -1
  204. package/dist/src/test/widget.test.js.map +0 -1
  205. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.d.ts +0 -13
  206. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js +0 -33
  207. package/dist/src/web/bridges/adaptors/apps-sdk-adaptor.js.map +0 -1
  208. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.d.ts +0 -16
  209. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js +0 -115
  210. package/dist/src/web/bridges/adaptors/mcp-app-adaptor.js.map +0 -1
  211. package/dist/src/web/bridges/apps-sdk-bridge.d.ts +0 -10
  212. package/dist/src/web/bridges/apps-sdk-bridge.js.map +0 -1
  213. package/dist/src/web/bridges/hooks/use-adaptor.d.ts +0 -2
  214. package/dist/src/web/bridges/hooks/use-adaptor.js +0 -8
  215. package/dist/src/web/bridges/hooks/use-adaptor.js.map +0 -1
  216. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.d.ts +0 -2
  217. package/dist/src/web/bridges/hooks/use-apps-sdk-bridge.js.map +0 -1
  218. package/dist/src/web/bridges/hooks/use-bridge.d.ts +0 -2
  219. package/dist/src/web/bridges/hooks/use-bridge.js +0 -8
  220. package/dist/src/web/bridges/hooks/use-bridge.js.map +0 -1
  221. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.d.ts +0 -5
  222. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.js.map +0 -1
  223. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js +0 -41
  224. package/dist/src/web/bridges/hooks/use-mcp-app-bridge.test.js.map +0 -1
  225. package/dist/src/web/bridges/index.d.ts +0 -4
  226. package/dist/src/web/bridges/index.js +0 -5
  227. package/dist/src/web/bridges/index.js.map +0 -1
  228. package/dist/src/web/bridges/mcp-app-bridge.d.ts +0 -38
  229. package/dist/src/web/bridges/mcp-app-bridge.js.map +0 -1
  230. package/dist/src/web/bridges/types.d.ts +0 -57
  231. package/dist/src/web/create-store.js.map +0 -1
  232. package/dist/src/web/create-store.test.js +0 -70
  233. package/dist/src/web/create-store.test.js.map +0 -1
  234. package/dist/src/web/data-llm.js.map +0 -1
  235. package/dist/src/web/data-llm.test.js +0 -76
  236. package/dist/src/web/data-llm.test.js.map +0 -1
  237. package/dist/src/web/generate-helpers.js.map +0 -1
  238. package/dist/src/web/generate-helpers.test-d.js.map +0 -1
  239. package/dist/src/web/generate-helpers.test.js.map +0 -1
  240. package/dist/src/web/helpers/state.js.map +0 -1
  241. package/dist/src/web/helpers/state.test.js.map +0 -1
  242. package/dist/src/web/hooks/index.js.map +0 -1
  243. package/dist/src/web/hooks/test/utils.js +0 -40
  244. package/dist/src/web/hooks/test/utils.js.map +0 -1
  245. package/dist/src/web/hooks/use-call-tool.js.map +0 -1
  246. package/dist/src/web/hooks/use-call-tool.test-d.js.map +0 -1
  247. package/dist/src/web/hooks/use-call-tool.test.js.map +0 -1
  248. package/dist/src/web/hooks/use-display-mode.js +0 -10
  249. package/dist/src/web/hooks/use-display-mode.js.map +0 -1
  250. package/dist/src/web/hooks/use-display-mode.test.js.map +0 -1
  251. package/dist/src/web/hooks/use-files.d.ts +0 -10
  252. package/dist/src/web/hooks/use-files.js +0 -7
  253. package/dist/src/web/hooks/use-files.js.map +0 -1
  254. package/dist/src/web/hooks/use-files.test.js.map +0 -1
  255. package/dist/src/web/hooks/use-layout.js.map +0 -1
  256. package/dist/src/web/hooks/use-layout.test.js.map +0 -1
  257. package/dist/src/web/hooks/use-open-external.js.map +0 -1
  258. package/dist/src/web/hooks/use-open-external.test.js.map +0 -1
  259. package/dist/src/web/hooks/use-openai-global.d.ts +0 -3
  260. package/dist/src/web/hooks/use-openai-global.js +0 -6
  261. package/dist/src/web/hooks/use-openai-global.js.map +0 -1
  262. package/dist/src/web/hooks/use-request-modal.js +0 -14
  263. package/dist/src/web/hooks/use-request-modal.js.map +0 -1
  264. package/dist/src/web/hooks/use-request-modal.test.js.map +0 -1
  265. package/dist/src/web/hooks/use-send-follow-up-message.js.map +0 -1
  266. package/dist/src/web/hooks/use-tool-info.js.map +0 -1
  267. package/dist/src/web/hooks/use-tool-info.test-d.js.map +0 -1
  268. package/dist/src/web/hooks/use-tool-info.test.js.map +0 -1
  269. package/dist/src/web/hooks/use-user.js.map +0 -1
  270. package/dist/src/web/hooks/use-user.test.js.map +0 -1
  271. package/dist/src/web/hooks/use-widget-state.js.map +0 -1
  272. package/dist/src/web/hooks/use-widget-state.test.js.map +0 -1
  273. package/dist/src/web/index.js.map +0 -1
  274. package/dist/src/web/mount-widget.js.map +0 -1
  275. package/dist/src/web/plugin/data-llm.test.js.map +0 -1
  276. package/dist/src/web/plugin/plugin.js.map +0 -1
  277. package/dist/src/web/plugin/transform-data-llm.js.map +0 -1
  278. package/dist/src/web/plugin/transform-data-llm.test.js.map +0 -1
  279. package/dist/src/web/proxy.js.map +0 -1
  280. package/dist/src/web/types.js.map +0 -1
  281. package/dist/vitest.config.d.ts +0 -2
  282. package/dist/vitest.config.js +0 -8
  283. package/dist/vitest.config.js.map +0 -1
  284. /package/dist/{src/test/widget.test.d.ts → server/asset-base-url-transform-plugin.test.d.ts} +0 -0
  285. /package/dist/{src/server → server}/inferUtilityTypes.d.ts +0 -0
  286. /package/dist/{src/server → server}/inferUtilityTypes.js +0 -0
  287. /package/dist/{src/server → server}/templateHelper.js +0 -0
  288. /package/dist/{src/test → test}/utils.d.ts +0 -0
  289. /package/dist/{src/test → test}/utils.js +0 -0
  290. /package/dist/{src/web/bridges/hooks/use-mcp-app-bridge.test.d.ts → test/widget.test.d.ts} +0 -0
  291. /package/dist/{src/web/bridges → web/bridges/mcp-app}/types.js +0 -0
  292. /package/dist/{src/web/create-store.test.d.ts → web/bridges/mcp-app/use-mcp-app-context.test.d.ts} +0 -0
  293. /package/dist/{src/web → web}/create-store.d.ts +0 -0
  294. /package/dist/{src/web/data-llm.test.d.ts → web/create-store.test.d.ts} +0 -0
  295. /package/dist/{src/web → web}/data-llm.d.ts +0 -0
  296. /package/dist/{src/web/plugin → web}/data-llm.test.d.ts +0 -0
  297. /package/dist/{src/web → web}/generate-helpers.test-d.d.ts +0 -0
  298. /package/dist/{src/web → web}/generate-helpers.test-d.js +0 -0
  299. /package/dist/{src/web → web}/generate-helpers.test.d.ts +0 -0
  300. /package/dist/{src/web → web}/generate-helpers.test.js +0 -0
  301. /package/dist/{src/web → web}/helpers/state.d.ts +0 -0
  302. /package/dist/{src/web → web}/helpers/state.test.d.ts +0 -0
  303. /package/dist/{src/web → web}/helpers/state.test.js +0 -0
  304. /package/dist/{src/web → web}/hooks/use-call-tool.test-d.d.ts +0 -0
  305. /package/dist/{src/web → web}/hooks/use-call-tool.test-d.js +0 -0
  306. /package/dist/{src/web → web}/hooks/use-call-tool.test.d.ts +0 -0
  307. /package/dist/{src/web → web}/hooks/use-display-mode.d.ts +0 -0
  308. /package/dist/{src/web → web}/hooks/use-display-mode.test.d.ts +0 -0
  309. /package/dist/{src/web → web}/hooks/use-display-mode.test.js +0 -0
  310. /package/dist/{src/web → web}/hooks/use-files.test.d.ts +0 -0
  311. /package/dist/{src/web → web}/hooks/use-layout.test.d.ts +0 -0
  312. /package/dist/{src/web → web}/hooks/use-open-external.d.ts +0 -0
  313. /package/dist/{src/web → web}/hooks/use-open-external.test.d.ts +0 -0
  314. /package/dist/{src/web → web}/hooks/use-request-modal.test.d.ts +0 -0
  315. /package/dist/{src/web → web}/hooks/use-request-modal.test.js +0 -0
  316. /package/dist/{src/web → web}/hooks/use-send-follow-up-message.d.ts +0 -0
  317. /package/dist/{src/web/hooks/use-tool-info.test-d.d.ts → web/hooks/use-set-open-in-app-url.test.d.ts} +0 -0
  318. /package/dist/{src/web → web}/hooks/use-tool-info.d.ts +0 -0
  319. /package/dist/{src/web/hooks/use-tool-info.test.d.ts → web/hooks/use-tool-info.test-d.d.ts} +0 -0
  320. /package/dist/{src/web → web}/hooks/use-tool-info.test-d.js +0 -0
  321. /package/dist/{src/web/hooks/use-user.test.d.ts → web/hooks/use-tool-info.test.d.ts} +0 -0
  322. /package/dist/{src/web/hooks/use-widget-state.test.d.ts → web/hooks/use-user.test.d.ts} +0 -0
  323. /package/dist/{src/web → web}/hooks/use-widget-state.d.ts +0 -0
  324. /package/dist/{src/web/plugin/transform-data-llm.test.d.ts → web/hooks/use-widget-state.test.d.ts} +0 -0
  325. /package/dist/{src/web → web}/hooks/use-widget-state.test.js +0 -0
  326. /package/dist/{src/web → web}/index.d.ts +0 -0
  327. /package/dist/{src/web → web}/index.js +0 -0
  328. /package/dist/{src/web → web}/mount-widget.d.ts +0 -0
  329. /package/dist/{src/web → web}/plugin/data-llm.test.js +0 -0
  330. /package/dist/{src/web → web}/plugin/plugin.d.ts +0 -0
  331. /package/dist/{src/web → web}/plugin/transform-data-llm.d.ts +0 -0
  332. /package/dist/{src/web → web}/plugin/transform-data-llm.js +0 -0
  333. /package/dist/{src/web → web}/plugin/transform-data-llm.test.js +0 -0
  334. /package/dist/{src/web → web}/proxy.d.ts +0 -0
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { Command, Flags } from "@oclif/core";
3
+ import { Box, render, Text } from "ink";
4
+ import { Header } from "../cli/header.js";
5
+ import { useNodemon } from "../cli/use-nodemon.js";
6
+ import { useTypeScriptCheck } from "../cli/use-typescript-check.js";
7
+ export default class Dev extends Command {
8
+ static description = "Start development server";
9
+ static examples = ["skybridge"];
10
+ static flags = {
11
+ "use-forwarded-host": Flags.boolean({
12
+ description: "Uses the forwarded host header to construct widget URLs instead of localhost, useful when accessing the dev server through a tunnel (e.g., ngrok)",
13
+ }),
14
+ };
15
+ async run() {
16
+ const { flags } = await this.parse(Dev);
17
+ const env = {
18
+ ...process.env,
19
+ ...(flags["use-forwarded-host"]
20
+ ? { SKYBRIDGE_USE_FORWARDED_HOST: "true" }
21
+ : {}),
22
+ };
23
+ const App = () => {
24
+ const tsErrors = useTypeScriptCheck();
25
+ const messages = useNodemon(env);
26
+ return (_jsxs(Box, { flexDirection: "column", padding: 1, marginLeft: 1, children: [_jsx(Header, { version: this.config.version }), _jsxs(Box, { children: [_jsxs(Text, { color: "green", children: ["\u2192", " "] }), _jsxs(Text, { color: "white", bold: true, children: ["Open DevTools to test your app locally:", " "] }), _jsx(Text, { color: "green", children: "http://localhost:3000/" })] }), _jsxs(Box, { marginBottom: 1, children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsxs(Text, { children: ["MCP server running at:", " "] }), _jsx(Text, { color: "white", bold: true, children: "http://localhost:3000/mcp" })] }), _jsx(Text, { color: "white", underline: true, children: "To test on ChatGPT:" }), _jsxs(Box, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { color: "grey", children: "Make your local server accessible with " }), _jsx(Text, { color: "white", bold: true, children: "ngrok http 3000" })] }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { color: "grey", children: "Connect to ChatGPT with URL " }), _jsx(Text, { color: "white", bold: true, children: "https://xxxxxx.ngrok-free.app/mcp" })] }) }), _jsx(Box, { children: _jsxs(Text, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { children: "Documentation: " }), _jsx(Text, { color: "white", bold: true, children: "https://docs.skybridge.tech/" })] }) }), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { children: "If you like Skybridge, please " }), _jsxs(Text, { color: "white", bold: true, children: ["give it a star", " "] }), _jsx(Text, { children: "on GitHub: " }), _jsx(Text, { color: "white", underline: true, children: "https://github.com/alpic-ai/skybridge" }), _jsx(Text, { color: "grey", children: " \uD83D\uDE4F" })] }) }), tsErrors.length > 0 && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: "red", bold: true, children: "\u26A0\uFE0F TypeScript errors found:" }), tsErrors.map((error) => (_jsxs(Box, { marginLeft: 2, flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: "white", children: error.file }), _jsxs(Text, { color: "grey", children: ["(", error.line, ",", error.col, "):", " "] })] }), _jsx(Box, { marginLeft: 2, children: _jsx(Text, { color: "red", children: error.message }) })] }, `${error.file}:${error.line}:${error.col}`)))] })), messages.length > 0 && (_jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: "white", bold: true, children: "Logs:" }), messages.map((message, index) => (_jsx(Box, { marginLeft: 2, children: message.type === "restart" ? (_jsxs(_Fragment, { children: [_jsxs(Text, { color: "green", children: ["\u2713", " "] }), _jsx(Text, { color: "white", children: message.text })] })) : message.type === "error" ? (_jsx(Text, { color: "red", children: message.text })) : (_jsx(Text, { children: message.text })) }, `${message.type}-${index}-${message.text.slice(0, 20)}`)))] }))] }));
27
+ };
28
+ render(_jsx(App, {}), { exitOnCtrlC: true, patchConsole: true });
29
+ }
30
+ }
31
+ //# sourceMappingURL=dev.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dev.js","sourceRoot":"","sources":["../../src/commands/dev.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACtC,MAAM,CAAU,WAAW,GAAG,0BAA0B,CAAC;IACzD,MAAM,CAAU,QAAQ,GAAG,CAAC,WAAW,CAAC,CAAC;IACzC,MAAM,CAAU,KAAK,GAAG;QACtB,oBAAoB,EAAE,KAAK,CAAC,OAAO,CAAC;YAClC,WAAW,EACT,mJAAmJ;SACtJ,CAAC;KACH,CAAC;IAEK,KAAK,C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AC,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class Start extends Command {
3
+ static description: string;
4
+ static examples: string[];
5
+ static flags: {};
6
+ run(): Promise<void>;
7
+ }
@@ -0,0 +1,28 @@
1
+ import { existsSync } from "node:fs";
2
+ import { resolve } from "node:path";
3
+ import { Command } from "@oclif/core";
4
+ import { runCommand } from "../cli/run-command.js";
5
+ export default class Start extends Command {
6
+ static description = "Start production server";
7
+ static examples = ["skybridge start"];
8
+ static flags = {};
9
+ async run() {
10
+ console.clear();
11
+ const distPath = resolve(process.cwd(), "dist/index.js");
12
+ if (!existsSync(distPath)) {
13
+ console.error("❌ Error: dist/index.js not found");
14
+ console.error("");
15
+ console.error("Please build your project first:");
16
+ console.error(" skybridge build");
17
+ console.error("");
18
+ process.exit(1);
19
+ }
20
+ console.log(`\x1b[36m\x1b[1m⛰ Welcome to Skybridge\x1b[0m \x1b[36mv${this.config.version}\x1b[0m`);
21
+ console.log(`Server running at: \x1b[32m\x1b[1mhttp://localhost:3000/mcp\x1b[0m`);
22
+ await runCommand("node dist/index.js", {
23
+ stdio: ["ignore", "inherit", "inherit"],
24
+ env: { ...process.env, NODE_ENV: "production" },
25
+ });
26
+ }
27
+ }
28
+ //# sourceMappingURL=start.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,KAAM,SAAQ,OAAO;IACxC,MAAM,CAAU,WAAW,GAAG,yBAAyB,CAAC;IACxD,MAAM,CAAU,QAAQ,GAAG,CAAC,iBAAiB,CAAC,CAAC;IAC/C,MAAM,CAAU,KAAK,GAAG,EAAE,CAAC;IAEpB,KAAK,CAAC,GAAG;QACd,OAAO,CAAC,KAAK,EAAE,CAAC;QAEhB,MAAM,QAAQ,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,eAAe,CAAC,CAAC;QACzD,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC1B,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAClD,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAClB,OAAO,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;YAClD,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;YACnC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;YAClB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,OAAO,CAAC,GAAG,CACT,0DAA0D,IAAI,CAAC,MAAM,CAAC,OAAO,SAAS,CACvF,CAAC;QACF,OAAO,CAAC,GAAG,CACT,oEAAoE,CACrE,CAAC;QAEF,MAAM,UAAU,CAAC,oBAAoB,EAAE;YACrC,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;YACvC,GAAG,EAAE,EAAE,GAAG,OAAO,CAAC,GAAG,EAAE,QAAQ,EAAE,YAAY,EAAE;SAChD,CAAC,CAAC;IACL,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class TelemetryDisable extends Command {
3
+ static description: string;
4
+ run(): Promise<void>;
5
+ }
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Command } from "@oclif/core";
3
+ import { Box, render, Text } from "ink";
4
+ import { setEnabled } from "../../cli/telemetry.js";
5
+ export default class TelemetryDisable extends Command {
6
+ static description = "Disable Skybridge telemetry on this machine";
7
+ async run() {
8
+ await this.parse(TelemetryDisable);
9
+ setEnabled(false);
10
+ const App = () => (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: "yellow", children: "\u2713" }), _jsx(Text, { children: " Telemetry has been " }), _jsx(Text, { color: "yellow", bold: true, children: "disabled" })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Config saved to ~/.skybridge/config.json" }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Skybridge never collects Personally Identifiable Information (PII). If you'd like to help us improve Skybridge by allowing anonymous CLI usage data, please reenable telemetry with: skybridge telemetry enable" }) })] }));
11
+ render(_jsx(App, {}));
12
+ }
13
+ }
14
+ //# sourceMappingURL=disable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"disable.js","sourceRoot":"","sources":["../../../src/commands/telemetry/disable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,OAAO;IACnD,MAAM,CAAU,WAAW,GAAG,6CAA6C,CAAC;IAErE,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;QACnC,UAAU,CAAC,KAAK,CAAC,CAAC;QAElB,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,CAChB,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,aACpC,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,uBAAS,EAC7B,KAAC,IAAI,uCAA4B,EACjC,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,+BAElB,IACH,EACN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,yDAAgD,GAC9D,EACN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,gOAKX,GACH,IACF,CACP,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;IAClB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class TelemetryEnable extends Command {
3
+ static description: string;
4
+ run(): Promise<void>;
5
+ }
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Command } from "@oclif/core";
3
+ import { Box, render, Text } from "ink";
4
+ import { setEnabled } from "../../cli/telemetry.js";
5
+ export default class TelemetryEnable extends Command {
6
+ static description = "Enable Skybridge telemetry on this machine";
7
+ async run() {
8
+ await this.parse(TelemetryEnable);
9
+ setEnabled(true);
10
+ const App = () => (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: "green", children: "\u2713" }), _jsx(Text, { children: " Telemetry has been " }), _jsx(Text, { color: "green", bold: true, children: "enabled" })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "gray", children: "Config saved to ~/.skybridge/config.json" }) })] }));
11
+ render(_jsx(App, {}));
12
+ }
13
+ }
14
+ //# sourceMappingURL=enable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"enable.js","sourceRoot":"","sources":["../../../src/commands/telemetry/enable.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,MAAM,CAAU,WAAW,GAAG,4CAA4C,CAAC;IAEpE,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAClC,UAAU,CAAC,IAAI,CAAC,CAAC;QAEjB,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,CAChB,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,aACpC,MAAC,GAAG,eACF,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,uBAAS,EAC5B,KAAC,IAAI,uCAA4B,EACjC,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,8BAEjB,IACH,EACN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,yDAAgD,GAC9D,IACF,CACP,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;IAClB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { Command } from "@oclif/core";
2
+ export default class TelemetryStatus extends Command {
3
+ static description: string;
4
+ run(): Promise<void>;
5
+ }
@@ -0,0 +1,14 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Command } from "@oclif/core";
3
+ import { Box, render, Text } from "ink";
4
+ import { getMachineId, isEnabled } from "../../cli/telemetry.js";
5
+ export default class TelemetryStatus extends Command {
6
+ static description = "Get Skybridge current telemetry settings for this machine";
7
+ async run() {
8
+ await this.parse(TelemetryStatus);
9
+ const enabled = isEnabled();
10
+ const App = () => (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, underline: true, children: "Skybridge Telemetry" }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { children: "Status: " }), enabled ? (_jsx(Text, { color: "green", bold: true, children: "Enabled" })) : (_jsx(Text, { color: "yellow", bold: true, children: "Disabled" }))] }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: "gray", children: "Machine ID: " }), _jsx(Text, { children: getMachineId() })] })] }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { color: "gray", children: "To opt out, run: skybridge telemetry disable" }), _jsx(Text, { color: "gray", children: "Or set: SKYBRIDGE_TELEMETRY_DISABLED=1" }), _jsx(Text, { color: "gray", children: "Debug mode: SKYBRIDGE_TELEMETRY_DEBUG=1" })] })] }));
11
+ render(_jsx(App, {}));
12
+ }
13
+ }
14
+ //# sourceMappingURL=status.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status.js","sourceRoot":"","sources":["../../../src/commands/telemetry/status.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAEjE,MAAM,CAAC,OAAO,OAAO,eAAgB,SAAQ,OAAO;IAClD,MAAM,CAAU,WAAW,GACzB,2DAA2D,CAAC;IAEvD,KAAK,CAAC,GAAG;QACd,MAAM,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;QAClC,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;QAE5B,MAAM,GAAG,GAAG,GAAG,EAAE,CAAC,CAChB,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,aACpC,KAAC,IAAI,IAAC,IAAI,QAAC,SAAS,0CAEb,EAEP,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,aACvC,MAAC,GAAG,eACF,KAAC,IAAI,2BAAgB,EACpB,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,IAAI,8BAEjB,CACR,CAAC,CAAC,CAAC,CACF,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,+BAElB,CACR,IACG,EAEN,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,aACf,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,6BAAoB,EACtC,KAAC,IAAI,cAAE,YAAY,EAAE,GAAQ,IACzB,IACF,EAEN,MAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,aAAa,EAAC,QAAQ,aACvC,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,6DAAoD,EACtE,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,uDAA8C,EAChE,KAAC,IAAI,IAAC,KAAK,EAAC,MAAM,wDAA+C,IAC7D,IACF,CACP,CAAC;QAEF,MAAM,CAAC,KAAC,GAAG,KAAG,CAAC,CAAC;IAClB,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { Plugin } from "vite";
2
+ /**
3
+ * Transforms asset import paths to use the development server base URL.
4
+ */
5
+ export declare function assetBaseUrlTransform(code: string, devServerOrigin: string): string;
6
+ /**
7
+ * Vite plugin that transforms asset import paths to use the development server base URL.
8
+ */
9
+ export declare function assetBaseUrlTransformPlugin(options: {
10
+ devServerOrigin: string;
11
+ }): Plugin;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Transforms asset import paths to use the development server base URL.
3
+ */
4
+ export function assetBaseUrlTransform(code, devServerOrigin) {
5
+ const assetStringPattern = /(?<!https?:\/\/)(["'`])(\/[^"'`]+\.(svg|png|jpeg|jpg|gif|webp|mp3|mp4|woff|woff2|ttf|eot))\1/g;
6
+ code = code.replace(assetStringPattern, (_match, quote, assetPath) => {
7
+ return `${quote}${devServerOrigin}${assetPath}${quote}`;
8
+ });
9
+ return code;
10
+ }
11
+ /**
12
+ * Vite plugin that transforms asset import paths to use the development server base URL.
13
+ */
14
+ export function assetBaseUrlTransformPlugin(options) {
15
+ const { devServerOrigin } = options;
16
+ return {
17
+ name: "asset-base-url-transform",
18
+ enforce: "pre",
19
+ transform(code) {
20
+ if (!code) {
21
+ return null;
22
+ }
23
+ const transformedCode = assetBaseUrlTransform(code, devServerOrigin);
24
+ if (transformedCode === code) {
25
+ return null;
26
+ }
27
+ return {
28
+ code: transformedCode,
29
+ map: null,
30
+ };
31
+ },
32
+ };
33
+ }
34
+ //# sourceMappingURL=asset-base-url-transform-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-base-url-transform-plugin.js","sourceRoot":"","sources":["../../src/server/asset-base-url-transform-plugin.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,UAAU,qBAAqB,CACnC,IAAY,EACZ,eAAuB;IAEvB,MAAM,kBAAkB,GACtB,+FAA+F,CAAC;IAElG,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,kBAAkB,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;QACnE,OAAO,GAAG,KAAK,GAAG,eAAe,GAAG,SAAS,GAAG,KAAK,EAAE,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,2BAA2B,CAAC,OAE3C;IACC,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,CAAC;IAEpC,OAAO;QACL,IAAI,EAAE,0BAA0B;QAChC,OAAO,EAAE,KAAK;QACd,SAAS,CAAC,IAAI;YACZ,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,OAAO,IAAI,CAAC;YACd,CAAC;YAED,MAAM,eAAe,GAAG,qBAAqB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;YAErE,IAAI,eAAe,KAAK,IAAI,EAAE,CAAC;gBAC7B,OAAO,IAAI,CAAC;YACd,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,eAAe;gBACrB,GAAG,EAAE,IAAI;aACV,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,56 @@
1
+ import { describe, expect, it } from "vitest";
2
+ import { assetBaseUrlTransform } from "./asset-base-url-transform-plugin.js";
3
+ describe("assetBaseUrlTransform", () => {
4
+ const devServerOrigin = "http://localhost:3000";
5
+ it("should transform asset paths in single, double, and backtick quotes", () => {
6
+ const cases = [
7
+ {
8
+ desc: "single-quoted",
9
+ code: `const image = '/assets/logo.png';`,
10
+ expected: `const image = '${devServerOrigin}/assets/logo.png';`,
11
+ },
12
+ {
13
+ desc: "double-quoted",
14
+ code: `const image = "/assets/logo.png";`,
15
+ expected: `const image = "${devServerOrigin}/assets/logo.png";`,
16
+ },
17
+ {
18
+ desc: "backtick-quoted",
19
+ code: "const image = `/assets/logo.png`;",
20
+ expected: `const image = \`${devServerOrigin}/assets/logo.png\`;`,
21
+ },
22
+ ];
23
+ for (const { code, expected } of cases) {
24
+ const result = assetBaseUrlTransform(code, devServerOrigin);
25
+ expect(result).toBe(expected);
26
+ }
27
+ });
28
+ it("should transform multiple asset paths", () => {
29
+ const code = `
30
+ const logo = '/assets/logo.png';
31
+ const icon = '/assets/icon.svg';
32
+ const font = '/assets/font.woff2';
33
+ `;
34
+ const result = assetBaseUrlTransform(code, devServerOrigin);
35
+ expect(result).toContain(`${devServerOrigin}/assets/logo.png`);
36
+ expect(result).toContain(`${devServerOrigin}/assets/icon.svg`);
37
+ expect(result).toContain(`${devServerOrigin}/assets/font.woff2`);
38
+ });
39
+ it("should not transform already absolute URLs", () => {
40
+ const code = `
41
+ const local = '/assets/logo.png';
42
+ const http = 'http://example.com/image.png';
43
+ const https = 'https://example.com/image.png';
44
+ `;
45
+ const result = assetBaseUrlTransform(code, devServerOrigin);
46
+ expect(result).toContain(`${devServerOrigin}/assets/logo.png`);
47
+ expect(result).toContain("http://example.com/image.png");
48
+ expect(result).toContain("https://example.com/image.png");
49
+ });
50
+ it("should not transform code without asset paths", () => {
51
+ const code = `const text = "Hello World";`;
52
+ const result = assetBaseUrlTransform(code, devServerOrigin);
53
+ expect(result).toBe(code);
54
+ });
55
+ });
56
+ //# sourceMappingURL=asset-base-url-transform-plugin.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"asset-base-url-transform-plugin.test.js","sourceRoot":"","sources":["../../src/server/asset-base-url-transform-plugin.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAE7E,QAAQ,CAAC,uBAAuB,EAAE,GAAG,EAAE;IACrC,MAAM,eAAe,GAAG,uBAAuB,CAAC;IAEhD,EAAE,CAAC,qEAAqE,EAAE,GAAG,EAAE;QAC7E,MAAM,KAAK,GAAG;YACZ;gBACE,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,mCAAmC;gBACzC,QAAQ,EAAE,kBAAkB,eAAe,oBAAoB;aAChE;YACD;gBACE,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,mCAAmC;gBACzC,QAAQ,EAAE,kBAAkB,eAAe,oBAAoB;aAChE;YACD;gBACE,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,mCAAmC;gBACzC,QAAQ,EAAE,mBAAmB,eAAe,qBAAqB;aAClE;SACF,CAAC;QAEF,KAAK,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,KAAK,EAAE,CAAC;YACvC,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;YAC5D,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QAChC,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,IAAI,GAAG;;;;KAIZ,CAAC;QACF,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAE5D,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,eAAe,kBAAkB,CAAC,CAAC;QAC/D,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,eAAe,kBAAkB,CAAC,CAAC;QAC/D,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,eAAe,oBAAoB,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QACpD,MAAM,IAAI,GAAG;;;;KAIZ,CAAC;QACF,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAE5D,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,GAAG,eAAe,kBAAkB,CAAC,CAAC;QAC/D,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,8BAA8B,CAAC,CAAC;QACzD,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,+BAA+B,CAAC,CAAC;IAC5D,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,+CAA+C,EAAE,GAAG,EAAE;QACvD,MAAM,IAAI,GAAG,6BAA6B,CAAC;QAC3C,MAAM,MAAM,GAAG,qBAAqB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAE5D,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -1,4 +1,3 @@
1
- export { devtoolsStaticServer } from "./devtoolsStaticServer.js";
2
1
  export type { AnyToolRegistry, InferTools, ToolInput, ToolNames, ToolOutput, ToolResponseMetadata, } from "./inferUtilityTypes.js";
3
2
  export type { McpServerTypes, ToolDef, WidgetHostType } from "./server.js";
4
3
  export { McpServer } from "./server.js";
@@ -1,4 +1,3 @@
1
- export { devtoolsStaticServer } from "./devtoolsStaticServer.js";
2
1
  export { McpServer } from "./server.js";
3
2
  export { widgetsDevServer } from "./widgetsDevServer.js";
4
3
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inferUtilityTypes.js","sourceRoot":"","sources":["../../src/server/inferUtilityTypes.ts"],"names":[],"mappings":""}
@@ -1,3 +1,4 @@
1
+ import type { McpUiResourceMeta } from "@modelcontextprotocol/ext-apps";
1
2
  import { McpServer as McpServerBase, type RegisteredTool } from "@modelcontextprotocol/sdk/server/mcp.js";
2
3
  import type { AnySchema, SchemaOutput, ZodRawShapeCompat } from "@modelcontextprotocol/sdk/server/zod-compat.js";
3
4
  import type { RequestHandlerExtra } from "@modelcontextprotocol/sdk/shared/protocol.js";
@@ -7,8 +8,32 @@ export type ToolDef<TInput = unknown, TOutput = unknown, TResponseMetadata = unk
7
8
  output: TOutput;
8
9
  responseMetadata: TResponseMetadata;
9
10
  };
11
+ /**
12
+ * Extended MCP Apps CSP with upcoming fields from ext-apps PR #158
13
+ * and Skybridge-specific fields for OpenAI compatibility
14
+ * @see https://github.com/modelcontextprotocol/ext-apps/pull/158
15
+ */
16
+ type ExtendedMcpUiResourceCsp = McpUiResourceMeta["csp"] & {
17
+ /**
18
+ * Origins that can receive openExternal redirects without safe-link modal (OpenAI-specific)
19
+ * @see https://developers.openai.com/apps-sdk/reference#component-resource-_meta-fields
20
+ */
21
+ redirectDomains?: string[];
22
+ };
23
+ /** Extended MCP Apps resource metadata with upcoming CSP fields */
24
+ type ExtendedMcpUiResourceMeta = Omit<McpUiResourceMeta, "csp"> & {
25
+ csp?: ExtendedMcpUiResourceCsp;
26
+ };
27
+ /** User-provided resource configuration with optional CSP override */
28
+ export type WidgetResourceMeta = {
29
+ ui?: ExtendedMcpUiResourceMeta;
30
+ } & Resource["_meta"];
10
31
  export type WidgetHostType = "apps-sdk" | "mcp-app";
11
- type McpServerOriginalResourceConfig = Omit<Resource, "uri" | "name" | "mimeType">;
32
+ type McpServerOriginalResourceConfig = Omit<Resource, "uri" | "name" | "mimeType" | "_meta"> & {
33
+ _meta?: WidgetResourceMeta;
34
+ /** Restrict host types to a specific subset */
35
+ hosts?: WidgetHostType[];
36
+ };
12
37
  type McpServerOriginalToolConfig = Omit<Parameters<typeof McpServerBase.prototype.registerTool<ZodRawShapeCompat, ZodRawShapeCompat>>[1], "inputSchema" | "outputSchema">;
13
38
  type Simplify<T> = {
14
39
  [K in keyof T]: T[K];
@@ -0,0 +1,153 @@
1
+ import crypto from "node:crypto";
2
+ import { readFileSync } from "node:fs";
3
+ import path from "node:path";
4
+ import { McpServer as McpServerBase, } from "@modelcontextprotocol/sdk/server/mcp.js";
5
+ import { mergeWith, union } from "es-toolkit";
6
+ import { templateHelper } from "./templateHelper.js";
7
+ const mergeWithUnion = (target, source) => {
8
+ return mergeWith(target, source, (targetVal, sourceVal) => {
9
+ if (Array.isArray(targetVal) && Array.isArray(sourceVal)) {
10
+ return union(targetVal, sourceVal);
11
+ }
12
+ });
13
+ };
14
+ export class McpServer extends McpServerBase {
15
+ registerWidget(name, resourceConfig, toolConfig, toolCallback) {
16
+ const userMeta = resourceConfig._meta;
17
+ const toolMeta = {
18
+ ...toolConfig._meta,
19
+ };
20
+ if (!resourceConfig.hosts || resourceConfig.hosts.includes("apps-sdk")) {
21
+ const widgetConfig = {
22
+ hostType: "apps-sdk",
23
+ uri: `ui://widgets/apps-sdk/${name}.html`,
24
+ mimeType: "text/html+skybridge",
25
+ buildContentMeta: ({ resourceDomains, connectDomains, domain }) => {
26
+ const userUi = userMeta?.ui;
27
+ const userCsp = userUi?.csp;
28
+ const defaults = {
29
+ "openai/widgetCSP": {
30
+ resource_domains: resourceDomains,
31
+ connect_domains: connectDomains,
32
+ },
33
+ "openai/widgetDomain": domain,
34
+ "openai/widgetDescription": toolConfig.description,
35
+ };
36
+ const fromUi = {
37
+ "openai/widgetCSP": {
38
+ resource_domains: userCsp?.resourceDomains,
39
+ connect_domains: userCsp?.connectDomains,
40
+ frame_domains: userCsp?.frameDomains,
41
+ redirect_domains: userCsp?.redirectDomains,
42
+ },
43
+ "openai/widgetDomain": userUi?.domain,
44
+ "openai/widgetPrefersBorder": userUi?.prefersBorder,
45
+ };
46
+ const directOpenaiKeys = Object.fromEntries(Object.entries(userMeta ?? {}).filter(([key]) => key.startsWith("openai/")));
47
+ return mergeWithUnion(mergeWithUnion(defaults, fromUi), directOpenaiKeys);
48
+ },
49
+ };
50
+ this.registerWidgetResource({
51
+ name,
52
+ widgetConfig,
53
+ resourceConfig,
54
+ });
55
+ toolMeta["openai/outputTemplate"] = widgetConfig.uri;
56
+ }
57
+ if (!resourceConfig.hosts || resourceConfig.hosts.includes("mcp-app")) {
58
+ const widgetConfig = {
59
+ hostType: "mcp-app",
60
+ uri: `ui://widgets/ext-apps/${name}.html`,
61
+ mimeType: "text/html;profile=mcp-app",
62
+ buildContentMeta: ({ resourceDomains, connectDomains, domain }) => {
63
+ const defaults = {
64
+ ui: {
65
+ csp: {
66
+ resourceDomains,
67
+ connectDomains,
68
+ },
69
+ domain,
70
+ },
71
+ };
72
+ return mergeWithUnion(defaults, { ui: userMeta?.ui });
73
+ },
74
+ };
75
+ this.registerWidgetResource({
76
+ name,
77
+ widgetConfig,
78
+ resourceConfig,
79
+ });
80
+ // @ts-expect-error - For backwards compatibility with Claude current implementation of the specs
81
+ toolMeta["ui/resourceUri"] = widgetConfig.uri;
82
+ toolMeta.ui = { resourceUri: widgetConfig.uri };
83
+ }
84
+ this.registerTool(name, {
85
+ ...toolConfig,
86
+ _meta: toolMeta,
87
+ }, toolCallback);
88
+ return this;
89
+ }
90
+ registerTool(name, config, cb) {
91
+ super.registerTool(name, config, cb);
92
+ return this;
93
+ }
94
+ registerWidgetResource({ name, widgetConfig, resourceConfig, }) {
95
+ const { hostType, uri: widgetUri, mimeType, buildContentMeta, } = widgetConfig;
96
+ this.registerResource(name, widgetUri, { ...resourceConfig, _meta: resourceConfig._meta }, async (uri, extra) => {
97
+ const isProduction = process.env.NODE_ENV === "production";
98
+ const useForwardedHost = process.env.SKYBRIDGE_USE_FORWARDED_HOST === "true";
99
+ const isClaude = extra?.requestInfo?.headers?.["user-agent"] === "Claude-User";
100
+ const hostFromHeaders = extra?.requestInfo?.headers?.["x-forwarded-host"] ??
101
+ extra?.requestInfo?.headers?.host;
102
+ const useExternalHost = isProduction || useForwardedHost || isClaude;
103
+ const serverUrl = useExternalHost
104
+ ? `https://${hostFromHeaders}`
105
+ : "http://localhost:3000";
106
+ const html = isProduction
107
+ ? templateHelper.renderProduction({
108
+ hostType,
109
+ serverUrl,
110
+ widgetFile: this.lookupDistFileWithIndexFallback(`src/widgets/${name}`),
111
+ styleFile: this.lookupDistFile("style.css"),
112
+ })
113
+ : templateHelper.renderDevelopment({
114
+ hostType,
115
+ serverUrl,
116
+ useLocalNetworkAccess: !useExternalHost,
117
+ widgetName: name,
118
+ });
119
+ const VITE_HMR_WEBSOCKET_DEFAULT_URL = "ws://localhost:24678";
120
+ const contentMeta = buildContentMeta({
121
+ resourceDomains: [serverUrl],
122
+ connectDomains: !isProduction ? [VITE_HMR_WEBSOCKET_DEFAULT_URL] : [],
123
+ domain: isClaude
124
+ ? `${crypto
125
+ .createHash("sha256")
126
+ .update(`https://${hostFromHeaders}/mcp`)
127
+ .digest("hex")
128
+ .slice(0, 32)}.claudemcpcontent.com`
129
+ : serverUrl,
130
+ baseUriDomains: [serverUrl],
131
+ });
132
+ return {
133
+ contents: [
134
+ { uri: uri.href, mimeType, text: html, _meta: contentMeta },
135
+ ],
136
+ };
137
+ });
138
+ }
139
+ lookupDistFile(key) {
140
+ const manifest = this.readManifest();
141
+ return manifest[key]?.file;
142
+ }
143
+ lookupDistFileWithIndexFallback(basePath) {
144
+ const manifest = this.readManifest();
145
+ const flatFileKey = `${basePath}.tsx`;
146
+ const indexFileKey = `${basePath}/index.tsx`;
147
+ return manifest[flatFileKey]?.file ?? manifest[indexFileKey]?.file;
148
+ }
149
+ readManifest() {
150
+ return JSON.parse(readFileSync(path.join(process.cwd(), "dist", "assets", ".vite", "manifest.json"), "utf-8"));
151
+ }
152
+ }
153
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/server/server.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAK7B,OAAO,EACL,SAAS,IAAI,aAAa,GAG3B,MAAM,yCAAyC,CAAC;AAcjD,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,cAAc,GAAG,CACrB,MAAS,EACT,MAAS,EACF,EAAE;IACT,OAAO,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE;QACxD,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE,CAAC;YACzD,OAAO,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACrC,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AA6KF,MAAM,OAAO,SAEX,SAAQ,aAAa;IAGrB,cAAc,CAKZ,IAAW,EACX,cAA+C,EAC/C,UAGC,EACD,YAA0C;QAQ1C,MAAM,QAAQ,GAAG,cAAc,CAAC,KAAK,CAAC;QAEtC,MAAM,QAAQ,GAAa;YACzB,GAAG,UAAU,CAAC,KAAK;SACpB,CAAC;QAEF,IAAI,CAAC,cAAc,CAAC,KAAK,IAAI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f,YAAY,CACV,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,eAAe,CAAC,EACpE,OAAO,CACR,CACF,CAAC;IACJ,CAAC;CACF"}
@@ -11,6 +11,7 @@ declare class TemplateHelper {
11
11
  renderDevelopment(data: {
12
12
  hostType: WidgetHostType;
13
13
  serverUrl: string;
14
+ useLocalNetworkAccess: boolean;
14
15
  widgetName: string;
15
16
  }): string;
16
17
  }
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templateHelper.js","sourceRoot":"","sources":["../../src/server/templateHelper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,MAAM,cAAc;IACV,aAAa,GAAG,IAAI,GAAG,EAAsC,CAAC;IAE9D,YAAY,CAAC,YAAoB;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACpD,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,MAAM,CAAC;QAChB,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,IAKhB;QACC,MAAM,QAAQ,GAAG,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;QACjD,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC;IACxB,CAAC;IAED,iBAAiB,CAAC,IAKjB;QACC,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"}
@@ -0,0 +1,67 @@
1
+ <script type="module">window.skybridge = { hostType: "{{hostType}}", serverUrl: "{{serverUrl}}" };</script>
2
+ <script type="module">
3
+ import { injectIntoGlobalHook } from "{{serverUrl}}/assets/@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
+ {{#if useLocalNetworkAccess}}
10
+ <script type="module">
11
+ // Checks for browser support and shows error if local network access is denied
12
+ (async () => {
13
+ if (!navigator.permissions?.query) {
14
+ return;
15
+ }
16
+
17
+ // Skip for non-http(s) protocols (file://, custom protocols in Electron, etc.)
18
+ const protocol = window.location.protocol;
19
+ const isNonHttpProtocol = protocol !== 'http:' && protocol !== 'https:'
20
+ if (isNonHttpProtocol) {
21
+ return;
22
+ }
23
+
24
+ const host = window.location.hostname;
25
+ const isLoopback = host === 'localhost'
26
+ || /^127\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.test(host)
27
+ || host === '::1';
28
+ if (isLoopback) {
29
+ return;
30
+ }
31
+
32
+ try {
33
+ const status = await navigator.permissions.query({ name: "local-network-access" });
34
+ if (status.state === "denied") {
35
+ const errorDiv = document.createElement("div");
36
+ errorDiv.style.cssText = "background: #fef2f2; border: 2px solid #ef4444; border-radius: 8px; padding: 16px; text-align: center; z-index: 10000; font-family: system-ui, sans-serif;";
37
+
38
+ const errorTitle = document.createElement("div");
39
+ errorTitle.style.cssText = "color: #ef4444; font-size: 18px; font-weight: 600; margin-bottom: 8px;";
40
+ errorTitle.textContent = "Error: Local network access permission is denied.";
41
+
42
+ const errorMessage = document.createElement("div");
43
+ errorMessage.style.cssText = "color: #ef4444; font-size: 14px;";
44
+ errorMessage.textContent = "Local network access is required for your widget to connect to the local dev server. Please enable it in your browser settings. ";
45
+
46
+ const link = document.createElement("a");
47
+ link.href = "https://developer.chrome.com/blog/local-network-access";
48
+ link.target = "_blank";
49
+ link.rel = "noopener noreferrer";
50
+ link.style.cssText = "color: #ef4444; text-decoration: underline;";
51
+ link.textContent = "Learn more";
52
+ errorMessage.appendChild(link);
53
+
54
+ errorDiv.appendChild(errorTitle);
55
+ errorDiv.appendChild(errorMessage);
56
+ document.body.appendChild(errorDiv);
57
+ }
58
+ } catch (e) {
59
+ // Permission API doesn't support local-network-access, ignore silently
60
+ }
61
+ })();
62
+ </script>
63
+ {{/if}}
64
+ <div id="root"></div>
65
+ <script type="module" id="dev-widget-entry">
66
+ import('{{serverUrl}}/src/widgets/{{widgetName}}');
67
+ </script>
@@ -1,5 +1,4 @@
1
- <base href="{{serverUrl}}" />
2
- <script type="module">window.skybridge = { hostType: "{{hostType}}" };</script>
1
+ <script type="module">window.skybridge = { hostType: "{{hostType}}", serverUrl: "{{serverUrl}}" };</script>
3
2
  <div id="root"></div>
4
3
  <script type="module">
5
4
  import('{{serverUrl}}/assets/{{widgetFile}}');
@@ -1,4 +1,4 @@
1
- import { type RequestHandler } from "express";
1
+ import { type Router } from "express";
2
2
  /**
3
3
  * Install Vite dev server
4
4
  * This router MUST be installed at the application root, like so:
@@ -9,4 +9,4 @@ import { type RequestHandler } from "express";
9
9
  * app.use(await widgetsRouter());
10
10
  * }
11
11
  */
12
- export declare const widgetsDevServer: () => Promise<RequestHandler>;
12
+ export declare const widgetsDevServer: () => Promise<Router>;