skybridge 0.0.0-dev.db67c37 → 0.0.0-dev.dbab7df

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 (504) hide show
  1. package/README.md +126 -116
  2. package/dist/cli/build-helpers.d.ts +11 -0
  3. package/dist/cli/build-helpers.js +107 -0
  4. package/dist/cli/build-helpers.js.map +1 -0
  5. package/dist/cli/build-helpers.test.js +132 -0
  6. package/dist/cli/build-helpers.test.js.map +1 -0
  7. package/dist/cli/build-steps.d.ts +2 -0
  8. package/dist/cli/build-steps.js +73 -0
  9. package/dist/cli/build-steps.js.map +1 -0
  10. package/dist/cli/build-steps.test.js +52 -0
  11. package/dist/cli/build-steps.test.js.map +1 -0
  12. package/dist/cli/detect-port.d.ts +2 -2
  13. package/dist/cli/detect-port.js +9 -20
  14. package/dist/cli/detect-port.js.map +1 -1
  15. package/dist/cli/header.d.ts +1 -1
  16. package/dist/cli/header.js +1 -1
  17. package/dist/cli/header.js.map +1 -1
  18. package/dist/cli/resolve-skybridge-config.d.ts +5 -0
  19. package/dist/cli/resolve-skybridge-config.js +18 -0
  20. package/dist/cli/resolve-skybridge-config.js.map +1 -0
  21. package/dist/cli/run-command.js.map +1 -1
  22. package/dist/cli/run-plain.d.ts +18 -0
  23. package/dist/cli/run-plain.js +89 -0
  24. package/dist/cli/run-plain.js.map +1 -0
  25. package/dist/cli/telemetry.js.map +1 -1
  26. package/dist/cli/tunnel-control-server.d.ts +9 -0
  27. package/dist/cli/tunnel-control-server.js +31 -0
  28. package/dist/cli/tunnel-control-server.js.map +1 -0
  29. package/dist/cli/tunnel-control-server.test.js +39 -0
  30. package/dist/cli/tunnel-control-server.test.js.map +1 -0
  31. package/dist/cli/tunnel-handler.d.ts +3 -0
  32. package/dist/cli/tunnel-handler.js +48 -0
  33. package/dist/cli/tunnel-handler.js.map +1 -0
  34. package/dist/cli/tunnel-handler.test.js +105 -0
  35. package/dist/cli/tunnel-handler.test.js.map +1 -0
  36. package/dist/cli/tunnel.d.ts +57 -0
  37. package/dist/cli/tunnel.js +154 -0
  38. package/dist/cli/tunnel.js.map +1 -0
  39. package/dist/cli/tunnel.test.js +190 -0
  40. package/dist/cli/tunnel.test.js.map +1 -0
  41. package/dist/cli/types.d.ts +5 -0
  42. package/dist/cli/types.js +2 -0
  43. package/dist/cli/types.js.map +1 -0
  44. package/dist/cli/use-execute-steps.d.ts +1 -1
  45. package/dist/cli/use-execute-steps.js.map +1 -1
  46. package/dist/cli/use-messages.d.ts +3 -0
  47. package/dist/cli/use-messages.js +11 -0
  48. package/dist/cli/use-messages.js.map +1 -0
  49. package/dist/cli/use-nodemon.d.ts +16 -6
  50. package/dist/cli/use-nodemon.js +74 -59
  51. package/dist/cli/use-nodemon.js.map +1 -1
  52. package/dist/cli/use-open-browser.d.ts +1 -0
  53. package/dist/cli/use-open-browser.js +44 -0
  54. package/dist/cli/use-open-browser.js.map +1 -0
  55. package/dist/cli/use-tunnel.d.ts +14 -0
  56. package/dist/cli/use-tunnel.js +131 -0
  57. package/dist/cli/use-tunnel.js.map +1 -0
  58. package/dist/cli/use-typescript-check.d.ts +9 -2
  59. package/dist/cli/use-typescript-check.js +89 -51
  60. package/dist/cli/use-typescript-check.js.map +1 -1
  61. package/dist/commands/build.d.ts +0 -3
  62. package/dist/commands/build.js +3 -18
  63. package/dist/commands/build.js.map +1 -1
  64. package/dist/commands/create.d.ts +9 -0
  65. package/dist/commands/create.js +30 -0
  66. package/dist/commands/create.js.map +1 -0
  67. package/dist/commands/dev.d.ts +4 -1
  68. package/dist/commands/dev.js +94 -8
  69. package/dist/commands/dev.js.map +1 -1
  70. package/dist/commands/start.js +13 -10
  71. package/dist/commands/start.js.map +1 -1
  72. package/dist/commands/telemetry/disable.js.map +1 -1
  73. package/dist/commands/telemetry/enable.js.map +1 -1
  74. package/dist/commands/telemetry/status.js.map +1 -1
  75. package/dist/context-warnings.d.ts +5 -0
  76. package/dist/context-warnings.js +31 -0
  77. package/dist/context-warnings.js.map +1 -0
  78. package/dist/context-warnings.test.js +28 -0
  79. package/dist/context-warnings.test.js.map +1 -0
  80. package/dist/server/app.d.ts +180 -0
  81. package/dist/server/app.js +266 -0
  82. package/dist/server/app.js.map +1 -0
  83. package/dist/server/asset-base-url-transform-plugin.d.ts +6 -6
  84. package/dist/server/asset-base-url-transform-plugin.js +25 -11
  85. package/dist/server/asset-base-url-transform-plugin.js.map +1 -1
  86. package/dist/server/asset-base-url-transform-plugin.test.js +92 -14
  87. package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -1
  88. package/dist/server/auth/discovery.d.ts +33 -0
  89. package/dist/server/auth/discovery.js +56 -0
  90. package/dist/server/auth/discovery.js.map +1 -0
  91. package/dist/server/auth/discovery.test.d.ts +1 -0
  92. package/dist/server/auth/discovery.test.js +93 -0
  93. package/dist/server/auth/discovery.test.js.map +1 -0
  94. package/dist/server/auth/index.d.ts +30 -0
  95. package/dist/server/auth/index.js +2 -0
  96. package/dist/server/auth/index.js.map +1 -0
  97. package/dist/server/auth/providers/auth0.d.ts +40 -0
  98. package/dist/server/auth/providers/auth0.js +31 -0
  99. package/dist/server/auth/providers/auth0.js.map +1 -0
  100. package/dist/server/auth/providers/auth0.test.d.ts +1 -0
  101. package/dist/server/auth/providers/auth0.test.js +50 -0
  102. package/dist/server/auth/providers/auth0.test.js.map +1 -0
  103. package/dist/server/auth/providers/authplane.d.ts +49 -0
  104. package/dist/server/auth/providers/authplane.js +57 -0
  105. package/dist/server/auth/providers/authplane.js.map +1 -0
  106. package/dist/server/auth/providers/authplane.test.d.ts +1 -0
  107. package/dist/server/auth/providers/authplane.test.js +140 -0
  108. package/dist/server/auth/providers/authplane.test.js.map +1 -0
  109. package/dist/server/auth/providers/clerk.d.ts +51 -0
  110. package/dist/server/auth/providers/clerk.js +19 -0
  111. package/dist/server/auth/providers/clerk.js.map +1 -0
  112. package/dist/server/auth/providers/clerk.test.d.ts +1 -0
  113. package/dist/server/auth/providers/clerk.test.js +30 -0
  114. package/dist/server/auth/providers/clerk.test.js.map +1 -0
  115. package/dist/server/auth/providers/custom.d.ts +40 -0
  116. package/dist/server/auth/providers/custom.js +56 -0
  117. package/dist/server/auth/providers/custom.js.map +1 -0
  118. package/dist/server/auth/providers/custom.test.d.ts +1 -0
  119. package/dist/server/auth/providers/custom.test.js +158 -0
  120. package/dist/server/auth/providers/custom.test.js.map +1 -0
  121. package/dist/server/auth/providers/descope.d.ts +44 -0
  122. package/dist/server/auth/providers/descope.js +44 -0
  123. package/dist/server/auth/providers/descope.js.map +1 -0
  124. package/dist/server/auth/providers/descope.test.d.ts +1 -0
  125. package/dist/server/auth/providers/descope.test.js +62 -0
  126. package/dist/server/auth/providers/descope.test.js.map +1 -0
  127. package/dist/server/auth/providers/shared.d.ts +2 -0
  128. package/dist/server/auth/providers/shared.js +6 -0
  129. package/dist/server/auth/providers/shared.js.map +1 -0
  130. package/dist/server/auth/providers/shared.test.d.ts +1 -0
  131. package/dist/server/auth/providers/shared.test.js +10 -0
  132. package/dist/server/auth/providers/shared.test.js.map +1 -0
  133. package/dist/server/auth/providers/stytch.d.ts +25 -0
  134. package/dist/server/auth/providers/stytch.js +16 -0
  135. package/dist/server/auth/providers/stytch.js.map +1 -0
  136. package/dist/server/auth/providers/verify-spy.d.ts +12 -0
  137. package/dist/server/auth/providers/verify-spy.js +21 -0
  138. package/dist/server/auth/providers/verify-spy.js.map +1 -0
  139. package/dist/server/auth/providers/workos.d.ts +33 -0
  140. package/dist/server/auth/providers/workos.js +15 -0
  141. package/dist/server/auth/providers/workos.js.map +1 -0
  142. package/dist/server/auth/security-schemes.d.ts +23 -0
  143. package/dist/server/auth/security-schemes.js +64 -0
  144. package/dist/server/auth/security-schemes.js.map +1 -0
  145. package/dist/server/auth/security-schemes.test.d.ts +1 -0
  146. package/dist/server/auth/security-schemes.test.js +99 -0
  147. package/dist/server/auth/security-schemes.test.js.map +1 -0
  148. package/dist/server/auth/setup.d.ts +6 -0
  149. package/dist/server/auth/setup.js +91 -0
  150. package/dist/server/auth/setup.js.map +1 -0
  151. package/dist/server/auth/setup.test.d.ts +1 -0
  152. package/dist/server/auth/setup.test.js +512 -0
  153. package/dist/server/auth/setup.test.js.map +1 -0
  154. package/dist/server/auth/verify.d.ts +46 -0
  155. package/dist/server/auth/verify.js +62 -0
  156. package/dist/server/auth/verify.js.map +1 -0
  157. package/dist/server/auth/verify.test.d.ts +1 -0
  158. package/dist/server/auth/verify.test.js +149 -0
  159. package/dist/server/auth/verify.test.js.map +1 -0
  160. package/dist/server/auth-extra.test-d.d.ts +1 -0
  161. package/dist/server/auth-extra.test-d.js +70 -0
  162. package/dist/server/auth-extra.test-d.js.map +1 -0
  163. package/dist/server/auth.d.ts +57 -0
  164. package/dist/server/auth.js +27 -0
  165. package/dist/server/auth.js.map +1 -0
  166. package/dist/server/build-manifest.test.d.ts +1 -0
  167. package/dist/server/build-manifest.test.js +28 -0
  168. package/dist/server/build-manifest.test.js.map +1 -0
  169. package/dist/server/content-helpers.d.ts +67 -0
  170. package/dist/server/content-helpers.js +79 -0
  171. package/dist/server/content-helpers.js.map +1 -0
  172. package/dist/server/content-helpers.test.d.ts +1 -0
  173. package/dist/server/content-helpers.test.js +70 -0
  174. package/dist/server/content-helpers.test.js.map +1 -0
  175. package/dist/server/express.d.ts +9 -5
  176. package/dist/server/express.js +49 -44
  177. package/dist/server/express.js.map +1 -1
  178. package/dist/server/express.test.js +470 -25
  179. package/dist/server/express.test.js.map +1 -1
  180. package/dist/server/file-ref.d.ts +28 -0
  181. package/dist/server/file-ref.js +27 -0
  182. package/dist/server/file-ref.js.map +1 -0
  183. package/dist/server/host.d.ts +2 -0
  184. package/dist/server/host.js +11 -0
  185. package/dist/server/host.js.map +1 -0
  186. package/dist/server/host.test.d.ts +1 -0
  187. package/dist/server/host.test.js +13 -0
  188. package/dist/server/host.test.js.map +1 -0
  189. package/dist/server/index.d.ts +21 -4
  190. package/dist/server/index.js +16 -2
  191. package/dist/server/index.js.map +1 -1
  192. package/dist/server/inferUtilityTypes.d.ts +6 -6
  193. package/dist/server/inferUtilityTypes.js.map +1 -1
  194. package/dist/server/mcp-errors.test.d.ts +1 -0
  195. package/dist/server/mcp-errors.test.js +37 -0
  196. package/dist/server/mcp-errors.test.js.map +1 -0
  197. package/dist/server/metric.d.ts +14 -0
  198. package/dist/server/metric.js +62 -0
  199. package/dist/server/metric.js.map +1 -0
  200. package/dist/server/middleware.d.ts +80 -14
  201. package/dist/server/middleware.js +33 -0
  202. package/dist/server/middleware.js.map +1 -1
  203. package/dist/server/middleware.test-d.js +44 -21
  204. package/dist/server/middleware.test-d.js.map +1 -1
  205. package/dist/server/middleware.test.js +229 -53
  206. package/dist/server/middleware.test.js.map +1 -1
  207. package/dist/server/register-tool.test.d.ts +1 -0
  208. package/dist/server/register-tool.test.js +23 -0
  209. package/dist/server/register-tool.test.js.map +1 -0
  210. package/dist/server/requestOrigin.d.ts +7 -0
  211. package/dist/server/requestOrigin.js +25 -0
  212. package/dist/server/requestOrigin.js.map +1 -0
  213. package/dist/server/server.d.ts +377 -95
  214. package/dist/server/server.js +521 -209
  215. package/dist/server/server.js.map +1 -1
  216. package/dist/server/skills-integration.test.d.ts +1 -0
  217. package/dist/server/skills-integration.test.js +79 -0
  218. package/dist/server/skills-integration.test.js.map +1 -0
  219. package/dist/server/skills.d.ts +27 -0
  220. package/dist/server/skills.js +188 -0
  221. package/dist/server/skills.js.map +1 -0
  222. package/dist/server/skills.test.d.ts +1 -0
  223. package/dist/server/skills.test.js +243 -0
  224. package/dist/server/skills.test.js.map +1 -0
  225. package/dist/server/templateHelper.d.ts +5 -8
  226. package/dist/server/templateHelper.js +3 -22
  227. package/dist/server/templateHelper.js.map +1 -1
  228. package/dist/server/templates.generated.d.ts +4 -0
  229. package/dist/server/templates.generated.js +47 -0
  230. package/dist/server/templates.generated.js.map +1 -0
  231. package/dist/server/tool-extra.test.d.ts +1 -0
  232. package/dist/server/tool-extra.test.js +72 -0
  233. package/dist/server/tool-extra.test.js.map +1 -0
  234. package/dist/server/tunnel-proxy-router.d.ts +7 -0
  235. package/dist/server/tunnel-proxy-router.js +110 -0
  236. package/dist/server/tunnel-proxy-router.js.map +1 -0
  237. package/dist/server/tunnel-proxy-router.test.d.ts +1 -0
  238. package/dist/server/tunnel-proxy-router.test.js +229 -0
  239. package/dist/server/tunnel-proxy-router.test.js.map +1 -0
  240. package/dist/server/view-name.test-d.d.ts +1 -0
  241. package/dist/server/view-name.test-d.js +8 -0
  242. package/dist/server/view-name.test-d.js.map +1 -0
  243. package/dist/server/view-resource-resolution.test.d.ts +6 -0
  244. package/dist/server/view-resource-resolution.test.js +172 -0
  245. package/dist/server/view-resource-resolution.test.js.map +1 -0
  246. package/dist/server/viewsDevServer.d.ts +14 -0
  247. package/dist/server/viewsDevServer.js +48 -0
  248. package/dist/server/viewsDevServer.js.map +1 -0
  249. package/dist/standard-schema.d.ts +3 -0
  250. package/dist/standard-schema.js +2 -0
  251. package/dist/standard-schema.js.map +1 -0
  252. package/dist/test/utils.d.ts +21 -31
  253. package/dist/test/utils.js +55 -45
  254. package/dist/test/utils.js.map +1 -1
  255. package/dist/test/view.test.d.ts +1 -0
  256. package/dist/test/view.test.js +536 -0
  257. package/dist/test/view.test.js.map +1 -0
  258. package/dist/version.d.ts +1 -0
  259. package/dist/version.js +3 -0
  260. package/dist/version.js.map +1 -0
  261. package/dist/views/index.d.ts +3 -0
  262. package/dist/views/index.js +3 -0
  263. package/dist/views/index.js.map +1 -0
  264. package/dist/views/scan-views.d.ts +16 -0
  265. package/dist/views/scan-views.js +88 -0
  266. package/dist/views/scan-views.js.map +1 -0
  267. package/dist/views/scan-views.test.d.ts +1 -0
  268. package/dist/views/scan-views.test.js +99 -0
  269. package/dist/views/scan-views.test.js.map +1 -0
  270. package/dist/views/validate-view.d.ts +1 -0
  271. package/dist/views/validate-view.js +9 -0
  272. package/dist/views/validate-view.js.map +1 -0
  273. package/dist/views/validate-view.test.d.ts +1 -0
  274. package/dist/views/validate-view.test.js +24 -0
  275. package/dist/views/validate-view.test.js.map +1 -0
  276. package/dist/web/bridges/adaptor.d.ts +51 -0
  277. package/dist/web/bridges/adaptor.js +327 -0
  278. package/dist/web/bridges/adaptor.js.map +1 -0
  279. package/dist/web/bridges/adaptor.test.d.ts +1 -0
  280. package/dist/web/bridges/adaptor.test.js +225 -0
  281. package/dist/web/bridges/adaptor.test.js.map +1 -0
  282. package/dist/web/bridges/apps-sdk/bridge.d.ts +7 -2
  283. package/dist/web/bridges/apps-sdk/bridge.js +15 -3
  284. package/dist/web/bridges/apps-sdk/bridge.js.map +1 -1
  285. package/dist/web/bridges/apps-sdk/index.d.ts +1 -2
  286. package/dist/web/bridges/apps-sdk/index.js +0 -1
  287. package/dist/web/bridges/apps-sdk/index.js.map +1 -1
  288. package/dist/web/bridges/apps-sdk/types.d.ts +22 -9
  289. package/dist/web/bridges/apps-sdk/types.js.map +1 -1
  290. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +11 -0
  291. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +11 -0
  292. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -1
  293. package/dist/web/bridges/get-adaptor.d.ts +7 -0
  294. package/dist/web/bridges/get-adaptor.js +9 -7
  295. package/dist/web/bridges/get-adaptor.js.map +1 -1
  296. package/dist/web/bridges/get-adaptor.test.d.ts +1 -0
  297. package/dist/web/bridges/get-adaptor.test.js +32 -0
  298. package/dist/web/bridges/get-adaptor.test.js.map +1 -0
  299. package/dist/web/bridges/index.js.map +1 -1
  300. package/dist/web/bridges/mcp-app/bridge.d.ts +27 -31
  301. package/dist/web/bridges/mcp-app/bridge.js +111 -203
  302. package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
  303. package/dist/web/bridges/mcp-app/bridge.test.d.ts +1 -0
  304. package/dist/web/bridges/mcp-app/bridge.test.js +17 -0
  305. package/dist/web/bridges/mcp-app/bridge.test.js.map +1 -0
  306. package/dist/web/bridges/mcp-app/index.d.ts +0 -1
  307. package/dist/web/bridges/mcp-app/index.js +0 -1
  308. package/dist/web/bridges/mcp-app/index.js.map +1 -1
  309. package/dist/web/bridges/mcp-app/types.d.ts +2 -0
  310. package/dist/web/bridges/mcp-app/types.js.map +1 -1
  311. package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +17 -3
  312. package/dist/web/bridges/mcp-app/use-mcp-app-context.js +14 -2
  313. package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -1
  314. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +1 -41
  315. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -1
  316. package/dist/web/bridges/mcp-app/view-tools.test.d.ts +1 -0
  317. package/dist/web/bridges/mcp-app/view-tools.test.js +143 -0
  318. package/dist/web/bridges/mcp-app/view-tools.test.js.map +1 -0
  319. package/dist/web/bridges/types.d.ts +131 -11
  320. package/dist/web/bridges/types.js +14 -1
  321. package/dist/web/bridges/types.js.map +1 -1
  322. package/dist/web/bridges/types.test.d.ts +1 -0
  323. package/dist/web/bridges/types.test.js +19 -0
  324. package/dist/web/bridges/types.test.js.map +1 -0
  325. package/dist/web/bridges/use-host-context.d.ts +5 -0
  326. package/dist/web/bridges/use-host-context.js +5 -0
  327. package/dist/web/bridges/use-host-context.js.map +1 -1
  328. package/dist/web/components/modal-provider.d.ts +1 -1
  329. package/dist/web/components/modal-provider.js +5 -6
  330. package/dist/web/components/modal-provider.js.map +1 -1
  331. package/dist/web/create-store.d.ts +26 -0
  332. package/dist/web/create-store.js +43 -3
  333. package/dist/web/create-store.js.map +1 -1
  334. package/dist/web/create-store.test.js +30 -24
  335. package/dist/web/create-store.test.js.map +1 -1
  336. package/dist/web/data-llm.d.ts +35 -2
  337. package/dist/web/data-llm.js +31 -3
  338. package/dist/web/data-llm.js.map +1 -1
  339. package/dist/web/data-llm.test.js +43 -29
  340. package/dist/web/data-llm.test.js.map +1 -1
  341. package/dist/web/generate-helpers.d.ts +32 -27
  342. package/dist/web/generate-helpers.js +29 -24
  343. package/dist/web/generate-helpers.js.map +1 -1
  344. package/dist/web/generate-helpers.test-d.js +33 -31
  345. package/dist/web/generate-helpers.test-d.js.map +1 -1
  346. package/dist/web/generate-helpers.test.js +2 -2
  347. package/dist/web/generate-helpers.test.js.map +1 -1
  348. package/dist/web/helpers/state.d.ts +2 -2
  349. package/dist/web/helpers/state.js +11 -11
  350. package/dist/web/helpers/state.js.map +1 -1
  351. package/dist/web/helpers/state.test.js +9 -9
  352. package/dist/web/helpers/state.test.js.map +1 -1
  353. package/dist/web/hooks/index.d.ts +7 -2
  354. package/dist/web/hooks/index.js +7 -2
  355. package/dist/web/hooks/index.js.map +1 -1
  356. package/dist/web/hooks/test/utils.d.ts +7 -2
  357. package/dist/web/hooks/test/utils.js +18 -3
  358. package/dist/web/hooks/test/utils.js.map +1 -1
  359. package/dist/web/hooks/use-call-tool.d.ts +45 -0
  360. package/dist/web/hooks/use-call-tool.js +28 -0
  361. package/dist/web/hooks/use-call-tool.js.map +1 -1
  362. package/dist/web/hooks/use-call-tool.test-d.js.map +1 -1
  363. package/dist/web/hooks/use-call-tool.test.js +64 -29
  364. package/dist/web/hooks/use-call-tool.test.js.map +1 -1
  365. package/dist/web/hooks/use-display-mode.d.ts +20 -0
  366. package/dist/web/hooks/use-display-mode.js +20 -0
  367. package/dist/web/hooks/use-display-mode.js.map +1 -1
  368. package/dist/web/hooks/use-display-mode.test-d.js.map +1 -1
  369. package/dist/web/hooks/use-display-mode.test.js +57 -21
  370. package/dist/web/hooks/use-display-mode.test.js.map +1 -1
  371. package/dist/web/hooks/use-download.d.ts +3 -0
  372. package/dist/web/hooks/use-download.js +7 -0
  373. package/dist/web/hooks/use-download.js.map +1 -0
  374. package/dist/web/hooks/use-download.test.d.ts +1 -0
  375. package/dist/web/hooks/use-download.test.js +103 -0
  376. package/dist/web/hooks/use-download.test.js.map +1 -0
  377. package/dist/web/hooks/use-files.d.ts +34 -1
  378. package/dist/web/hooks/use-files.js +33 -0
  379. package/dist/web/hooks/use-files.js.map +1 -1
  380. package/dist/web/hooks/use-files.test.js +31 -3
  381. package/dist/web/hooks/use-files.test.js.map +1 -1
  382. package/dist/web/hooks/use-host.d.ts +22 -0
  383. package/dist/web/hooks/use-host.js +30 -0
  384. package/dist/web/hooks/use-host.js.map +1 -0
  385. package/dist/web/hooks/use-host.test.d.ts +1 -0
  386. package/dist/web/hooks/use-host.test.js +59 -0
  387. package/dist/web/hooks/use-host.test.js.map +1 -0
  388. package/dist/web/hooks/use-open-external.d.ts +17 -0
  389. package/dist/web/hooks/use-open-external.js +16 -0
  390. package/dist/web/hooks/use-open-external.js.map +1 -1
  391. package/dist/web/hooks/use-open-external.test.js +29 -14
  392. package/dist/web/hooks/use-open-external.test.js.map +1 -1
  393. package/dist/web/hooks/use-register-view-tool.d.ts +37 -0
  394. package/dist/web/hooks/use-register-view-tool.js +50 -0
  395. package/dist/web/hooks/use-register-view-tool.js.map +1 -0
  396. package/dist/web/hooks/use-request-close.d.ts +16 -0
  397. package/dist/web/hooks/use-request-close.js +21 -0
  398. package/dist/web/hooks/use-request-close.js.map +1 -0
  399. package/dist/web/hooks/use-request-close.test.d.ts +1 -0
  400. package/dist/web/hooks/use-request-close.test.js +47 -0
  401. package/dist/web/hooks/use-request-close.test.js.map +1 -0
  402. package/dist/web/hooks/use-request-modal.d.ts +16 -1
  403. package/dist/web/hooks/use-request-modal.js +19 -4
  404. package/dist/web/hooks/use-request-modal.js.map +1 -1
  405. package/dist/web/hooks/use-request-modal.test.js +16 -2
  406. package/dist/web/hooks/use-request-modal.test.js.map +1 -1
  407. package/dist/web/hooks/use-request-size.d.ts +20 -0
  408. package/dist/web/hooks/use-request-size.js +24 -0
  409. package/dist/web/hooks/use-request-size.js.map +1 -0
  410. package/dist/web/hooks/use-request-size.test.d.ts +1 -0
  411. package/dist/web/hooks/use-request-size.test.js +47 -0
  412. package/dist/web/hooks/use-request-size.test.js.map +1 -0
  413. package/dist/web/hooks/use-send-follow-up-message.d.ts +19 -1
  414. package/dist/web/hooks/use-send-follow-up-message.js +19 -2
  415. package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
  416. package/dist/web/hooks/use-set-open-in-app-url.d.ts +17 -0
  417. package/dist/web/hooks/use-set-open-in-app-url.js +17 -0
  418. package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -1
  419. package/dist/web/hooks/use-set-open-in-app-url.test.js +29 -9
  420. package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -1
  421. package/dist/web/hooks/use-tool-info.d.ts +46 -14
  422. package/dist/web/hooks/use-tool-info.js +29 -7
  423. package/dist/web/hooks/use-tool-info.js.map +1 -1
  424. package/dist/web/hooks/use-tool-info.test-d.js +11 -34
  425. package/dist/web/hooks/use-tool-info.test-d.js.map +1 -1
  426. package/dist/web/hooks/use-tool-info.test.js +42 -37
  427. package/dist/web/hooks/use-tool-info.test.js.map +1 -1
  428. package/dist/web/hooks/use-user.d.ts +5 -2
  429. package/dist/web/hooks/use-user.js +23 -4
  430. package/dist/web/hooks/use-user.js.map +1 -1
  431. package/dist/web/hooks/use-user.test.js +104 -28
  432. package/dist/web/hooks/use-user.test.js.map +1 -1
  433. package/dist/web/hooks/use-view-state.d.ts +25 -0
  434. package/dist/web/hooks/use-view-state.js +42 -0
  435. package/dist/web/hooks/use-view-state.js.map +1 -0
  436. package/dist/web/hooks/use-view-state.test.d.ts +1 -0
  437. package/dist/web/hooks/use-view-state.test.js +212 -0
  438. package/dist/web/hooks/use-view-state.test.js.map +1 -0
  439. package/dist/web/hooks/use-viewport.d.ts +20 -0
  440. package/dist/web/hooks/use-viewport.js +21 -0
  441. package/dist/web/hooks/use-viewport.js.map +1 -0
  442. package/dist/web/hooks/use-viewport.test.d.ts +1 -0
  443. package/dist/web/hooks/use-viewport.test.js +109 -0
  444. package/dist/web/hooks/use-viewport.test.js.map +1 -0
  445. package/dist/web/index.d.ts +2 -2
  446. package/dist/web/index.js +1 -2
  447. package/dist/web/index.js.map +1 -1
  448. package/dist/web/mount-view.d.ts +21 -0
  449. package/dist/web/{mount-widget.js → mount-view.js} +22 -2
  450. package/dist/web/mount-view.js.map +1 -0
  451. package/dist/web/proxy.js.map +1 -1
  452. package/dist/web/types.d.ts +4 -0
  453. package/dist/web/types.js.map +1 -1
  454. package/package.json +47 -27
  455. package/tsconfig.base.json +5 -0
  456. package/dist/server/const.d.ts +0 -1
  457. package/dist/server/const.js +0 -2
  458. package/dist/server/const.js.map +0 -1
  459. package/dist/server/templates/development.hbs +0 -67
  460. package/dist/server/templates/production.hbs +0 -6
  461. package/dist/server/widgetsDevServer.d.ts +0 -12
  462. package/dist/server/widgetsDevServer.js +0 -63
  463. package/dist/server/widgetsDevServer.js.map +0 -1
  464. package/dist/test/widget.test.js +0 -261
  465. package/dist/test/widget.test.js.map +0 -1
  466. package/dist/web/bridges/apps-sdk/adaptor.d.ts +0 -22
  467. package/dist/web/bridges/apps-sdk/adaptor.js +0 -71
  468. package/dist/web/bridges/apps-sdk/adaptor.js.map +0 -1
  469. package/dist/web/bridges/mcp-app/adaptor.d.ts +0 -36
  470. package/dist/web/bridges/mcp-app/adaptor.js +0 -190
  471. package/dist/web/bridges/mcp-app/adaptor.js.map +0 -1
  472. package/dist/web/hooks/use-layout.d.ts +0 -22
  473. package/dist/web/hooks/use-layout.js +0 -23
  474. package/dist/web/hooks/use-layout.js.map +0 -1
  475. package/dist/web/hooks/use-layout.test.js +0 -96
  476. package/dist/web/hooks/use-layout.test.js.map +0 -1
  477. package/dist/web/hooks/use-widget-state.d.ts +0 -4
  478. package/dist/web/hooks/use-widget-state.js +0 -32
  479. package/dist/web/hooks/use-widget-state.js.map +0 -1
  480. package/dist/web/hooks/use-widget-state.test.js +0 -62
  481. package/dist/web/hooks/use-widget-state.test.js.map +0 -1
  482. package/dist/web/mount-widget.d.ts +0 -1
  483. package/dist/web/mount-widget.js.map +0 -1
  484. package/dist/web/plugin/data-llm.test.js +0 -81
  485. package/dist/web/plugin/data-llm.test.js.map +0 -1
  486. package/dist/web/plugin/plugin.d.ts +0 -2
  487. package/dist/web/plugin/plugin.js +0 -54
  488. package/dist/web/plugin/plugin.js.map +0 -1
  489. package/dist/web/plugin/transform-data-llm.d.ts +0 -12
  490. package/dist/web/plugin/transform-data-llm.js +0 -96
  491. package/dist/web/plugin/transform-data-llm.js.map +0 -1
  492. package/dist/web/plugin/transform-data-llm.test.js +0 -81
  493. package/dist/web/plugin/transform-data-llm.test.js.map +0 -1
  494. package/dist/web/plugin/validate-widget.d.ts +0 -5
  495. package/dist/web/plugin/validate-widget.js +0 -27
  496. package/dist/web/plugin/validate-widget.js.map +0 -1
  497. package/dist/web/plugin/validate-widget.test.js +0 -42
  498. package/dist/web/plugin/validate-widget.test.js.map +0 -1
  499. /package/dist/{test/widget.test.d.ts → cli/build-helpers.test.d.ts} +0 -0
  500. /package/dist/{web/hooks/use-layout.test.d.ts → cli/build-steps.test.d.ts} +0 -0
  501. /package/dist/{web/hooks/use-widget-state.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
  502. /package/dist/{web/plugin/data-llm.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
  503. /package/dist/{web/plugin/transform-data-llm.test.d.ts → cli/tunnel.test.d.ts} +0 -0
  504. /package/dist/{web/plugin/validate-widget.test.d.ts → context-warnings.test.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"view-resource-resolution.test.js","sourceRoot":"","sources":["../../src/server/view-resource-resolution.test.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,MAAM,EACN,iBAAiB,EACjB,6BAA6B,GAC9B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC7D,OAAO,EAAE,kBAAkB,EAAkB,SAAS,EAAE,MAAM,YAAY,CAAC;AAE3E,EAAE,CAAC,IAAI,CA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C,CAAC,CAAC,CAAC;QAC/C,2EAA2E;QAC3E,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAEpC,MAAM,QAAQ,EAAE,CAAC;IACnB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import http from \"node:http\";\nimport {\n Client,\n InMemoryTransport,\n StreamableHTTPClientTransport,\n} from \"@modelcontextprotocol/client\";\nimport type { RequestHandler } from \"express\";\nimport { afterEach, describe, expect, it, vi } from \"vitest\";\nimport { __setBuildManifest, type McpServer, Skybridge } from \"./index.js\";\n\nvi.mock(\"@skybridge/devtools\", () => ({\n devtoolsStaticServer: () =>\n ((_req: unknown, _res: unknown, next: () => void) =>\n next()) as RequestHandler,\n}));\nvi.mock(\"./viewsDevServer.js\", () => ({\n viewsDevServer: (_httpServer: unknown) =>\n ((_req: unknown, _res: unknown, next: () => void) =>\n next()) as RequestHandler,\n}));\n\n// Mirror what the Skybridge Vite plugin generates in `.skybridge/views.d.ts`:\n// narrow `ViewName` so `component: \"widget\"` typechecks against the registry.\ndeclare module \"./server.js\" {\n interface ViewNameRegistry {\n widget: true;\n }\n}\n\n// SKY-435: a view resource must resolve no matter the `?v=` query param value.\n// The version param is a content-derived cache key for external consumers\n// (it busts host/CDN caches when the bundle changes); it is not part of the\n// resource's identity, so a stale, absent, or arbitrary param must still serve\n// the underlying asset.\n\nfunction buildApp(register: (server: McpServer) => void) {\n return new Skybridge({ name: \"test\", version: \"1.0.0\" }, (server) => {\n register(server);\n return server;\n });\n}\n\nasync function connect(register: (server: McpServer) => void) {\n const instance = buildApp(register).createServerInstance();\n const client = new Client({ name: \"test-client\", version: \"1.0.0\" });\n const [clientTransport, serverTransport] =\n InMemoryTransport.createLinkedPair();\n await instance.connect(serverTransport);\n await client.connect(clientTransport);\n return {\n client,\n teardown: async () => {\n await client.close();\n await instance.close();\n },\n };\n}\n\nlet openHttpServer: http.Server | undefined;\nafterEach(() => openHttpServer?.close());\n\n// Connect over real HTTP so forwarded proxy headers reach the resource handler.\nasync function connectHttp(\n register: (server: McpServer) => void,\n headers: Record<string, string>,\n) {\n const { createApp } = await import(\"./express.js\");\n const app = buildApp(register);\n const httpServer = http.createServer();\n await createApp({ app, httpServer });\n const listening = http.createServer(app.express);\n await new Promise<void>((resolve) => listening.listen(0, resolve));\n openHttpServer = listening;\n const port = (listening.address() as { port: number }).port;\n\n const client = new Client({ name: \"test-client\", version: \"1.0.0\" });\n const transport = new StreamableHTTPClientTransport(\n new URL(`http://localhost:${port}/mcp`),\n { requestInit: { headers } },\n );\n await client.connect(transport);\n return {\n client,\n teardown: async () => {\n await client.close();\n },\n };\n}\n\nfunction registerWidget(server: McpServer) {\n server.registerTool(\n { name: \"show\", description: \"show\", view: { component: \"widget\" } },\n () => ({ content: [{ type: \"text\" as const, text: \"ok\" }] }),\n );\n}\n\n/** Narrow a read-resource content entry to its text variant. */\nfunction textContent(contents: Array<{ uri: string }>): {\n uri: string;\n text: string;\n} {\n return contents[0] as { uri: string; text: string };\n}\n\ndescribe(\"view resource resolution (cache key)\", () => {\n afterEach(() => {\n delete process.env.NODE_ENV;\n });\n\n it(\"resolves regardless of the ?v= param and echoes the requested URI\", async () => {\n const { client, teardown } = await connect(registerWidget);\n\n const { resources } = await client.listResources();\n const listed = resources.find((r) =>\n r.uri.startsWith(\"ui://views/ext-apps/widget.html\"),\n );\n // Dev build advertises no cache key.\n expect(listed?.uri).toBe(\"ui://views/ext-apps/widget.html\");\n\n // A stale/arbitrary/absent param all resolve the same underlying asset,\n // and the response echoes the URI the consumer asked for (never rewritten).\n for (const uri of [\n \"ui://views/ext-apps/widget.html?v=stale123\",\n \"ui://views/ext-apps/widget.html?v=whatever-else\",\n \"ui://views/ext-apps/widget.html\",\n ]) {\n const { contents } = await client.readResource({ uri });\n expect(contents).toHaveLength(1);\n const content = textContent(contents);\n expect(typeof content.text).toBe(\"string\");\n expect(content.text.length).toBeGreaterThan(0);\n expect(content.uri).toBe(uri);\n }\n\n await teardown();\n });\n\n it(\"resolves a stale cache key when the canonical URI carries ?v= (prod)\", async () => {\n process.env.NODE_ENV = \"production\";\n __setBuildManifest({\n \"src/views/widget.tsx\": {\n isEntry: true,\n name: \"widget\",\n file: \"assets/widget-ABC123.js\",\n },\n \"style.css\": { file: \"assets/style-XYZ.css\" },\n } as unknown as Record<string, { file: string }>);\n\n const { client, teardown } = await connect(registerWidget);\n\n const { resources } = await client.listResources();\n const listed = resources.find((r) =>\n r.uri.startsWith(\"ui://views/ext-apps/widget.html\"),\n );\n // Production advertises a content-derived cache key.\n expect(listed?.uri).toMatch(\n /^ui:\\/\\/views\\/ext-apps\\/widget\\.html\\?v=[0-9a-f]{8}$/,\n );\n\n // A consumer holding a stale key still resolves the current asset.\n const staleUri = \"ui://views/ext-apps/widget.html?v=00000000\";\n const { contents } = await client.readResource({ uri: staleUri });\n expect(contents).toHaveLength(1);\n const content = textContent(contents);\n expect(typeof content.text).toBe(\"string\");\n expect(content.uri).toBe(staleUri);\n\n await teardown();\n });\n\n it(\"still throws for an unknown view path\", async () => {\n const { client, teardown } = await connect(registerWidget);\n\n await expect(\n client.readResource({ uri: \"ui://views/ext-apps/nope.html?v=1\" }),\n ).rejects.toThrow();\n\n await teardown();\n });\n\n // A proxy routing the request under a path prefix sends x-forwarded-prefix;\n // the view's asset URLs must carry that prefix (and the forwarded origin) so\n // they resolve back through the same routing. Per-request, so one process can\n // serve many hosts/prefixes at once.\n it(\"prefixes emitted asset URLs with x-forwarded-prefix (prod)\", async () => {\n process.env.NODE_ENV = \"production\";\n __setBuildManifest({\n \"src/views/widget.tsx\": {\n isEntry: true,\n name: \"widget\",\n file: \"assets/widget-ABC123.js\",\n },\n \"style.css\": { file: \"assets/style-XYZ.css\" },\n } as unknown as Record<string, { file: string }>);\n\n const { client, teardown } = await connectHttp(registerWidget, {\n \"x-forwarded-host\": \"foo.com\",\n \"x-forwarded-proto\": \"https\",\n \"x-forwarded-prefix\": \"/v1/canary\",\n });\n try {\n const { contents } = await client.readResource({\n uri: \"ui://views/ext-apps/widget.html\",\n });\n const { text } = textContent(contents);\n // Forwarded origin + prefix. (`assets/assets` is the existing layout: the\n // manifest `file` already carries `assets/` and the template prepends\n // `/assets/`; build.tsx's `_redirects` collapses it on the asset host.)\n expect(text).toContain(\n \"https://foo.com/v1/canary/assets/assets/widget-ABC123.js\",\n );\n expect(text).toContain(\n \"https://foo.com/v1/canary/assets/assets/style-XYZ.css\",\n );\n // No unprefixed asset URL leaks through.\n expect(text).not.toContain(\"foo.com/assets/\");\n } finally {\n await teardown();\n }\n });\n\n // Back-compat: older Skybridge advertised the view at `ui://views/apps-sdk/...`\n // via openai/outputTemplate. We no longer advertise it, but apps published then\n // have it cached, so the read must still resolve to the ext-apps content.\n it(\"resolves the legacy apps-sdk URL to the ext-apps content\", async () => {\n const { client, teardown } = await connect(registerWidget);\n\n const legacyUri = \"ui://views/apps-sdk/widget.html\";\n const { contents } = await client.readResource({ uri: legacyUri });\n\n expect(contents).toHaveLength(1);\n const content = contents[0] as {\n uri: string;\n text: string;\n mimeType: string;\n };\n expect(content.mimeType).toBe(\"text/html;profile=mcp-app\");\n expect(content.text.length).toBeGreaterThan(0);\n // The response echoes the requested (legacy) URI, never the canonical one.\n expect(content.uri).toBe(legacyUri);\n\n await teardown();\n });\n});\n"]}
@@ -0,0 +1,14 @@
1
+ import type http from "node:http";
2
+ import { type Router } from "express";
3
+ /**
4
+ * Vite dev-server middleware for view assets.
5
+ *
6
+ * MUST be mounted at the Express app root so Vite can intercept
7
+ * `/@vite/client`, `/@react-refresh`, and `/_skybridge/view/...` imports:
8
+ *
9
+ * const app = express();
10
+ * if (env.NODE_ENV !== "production") {
11
+ * app.use(await viewsDevServer(httpServer));
12
+ * }
13
+ */
14
+ export declare const viewsDevServer: (httpServer: http.Server) => Promise<Router>;
@@ -0,0 +1,48 @@
1
+ import path from "node:path";
2
+ import cors from "cors";
3
+ import express, {} from "express";
4
+ import { assetBaseUrlTransformPlugin } from "./asset-base-url-transform-plugin.js";
5
+ /**
6
+ * Vite dev-server middleware for view assets.
7
+ *
8
+ * MUST be mounted at the Express app root so Vite can intercept
9
+ * `/@vite/client`, `/@react-refresh`, and `/_skybridge/view/...` imports:
10
+ *
11
+ * const app = express();
12
+ * if (env.NODE_ENV !== "production") {
13
+ * app.use(await viewsDevServer(httpServer));
14
+ * }
15
+ */
16
+ export const viewsDevServer = async (httpServer) => {
17
+ const router = express.Router();
18
+ const { createServer, loadConfigFromFile } = await import("vite");
19
+ const root = process.cwd();
20
+ const configFile = path.join(root, "vite.config.ts");
21
+ const configResult = await loadConfigFromFile({ command: "serve", mode: "development" }, configFile, root);
22
+ const { build, preview, plugins: userPlugins = [], server: userServer, ...devConfig } = configResult?.config || {};
23
+ const vite = await createServer({
24
+ ...devConfig,
25
+ // Pass `false` so Vite skips re-resolving a config file — we already
26
+ // loaded and spread the user's config above.
27
+ configFile: false,
28
+ appType: "custom",
29
+ server: {
30
+ // Keep the user's server options (e.g. forwardConsole) but force the
31
+ // three settings skybridge's Express integration requires.
32
+ ...userServer,
33
+ allowedHosts: true,
34
+ middlewareMode: true,
35
+ hmr: {
36
+ server: httpServer,
37
+ },
38
+ },
39
+ root,
40
+ // optimizeDeps is set by the skybridge Vite plugin (entries + include)
41
+ // so it can derive the view glob from `viewsDir`.
42
+ plugins: [...userPlugins, assetBaseUrlTransformPlugin()],
43
+ });
44
+ router.use(cors());
45
+ router.use("/", vite.middlewares);
46
+ return router;
47
+ };
48
+ //# sourceMappingURL=viewsDevServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"viewsDevServer.js","sourceRoot":"","sources":["../../src/server/viewsDevServer.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,EAAE,EAAe,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,2BAA2B,EAAE,MAAM,sCAAsC,CA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M,CAAC;AAChB,CAAC,CAAC","sourcesContent":["import type http from \"node:http\";\nimport path from \"node:path\";\nimport cors from \"cors\";\nimport express, { type Router } from \"express\";\nimport { assetBaseUrlTransformPlugin } from \"./asset-base-url-transform-plugin.js\";\n\n/**\n * Vite dev-server middleware for view assets.\n *\n * MUST be mounted at the Express app root so Vite can intercept\n * `/@vite/client`, `/@react-refresh`, and `/_skybridge/view/...` imports:\n *\n * const app = express();\n * if (env.NODE_ENV !== \"production\") {\n * app.use(await viewsDevServer(httpServer));\n * }\n */\nexport const viewsDevServer = async (\n httpServer: http.Server,\n): Promise<Router> => {\n const router = express.Router();\n\n const { createServer, loadConfigFromFile } = await import(\"vite\");\n\n const root = process.cwd();\n const configFile = path.join(root, \"vite.config.ts\");\n\n const configResult = await loadConfigFromFile(\n { command: \"serve\", mode: \"development\" },\n configFile,\n root,\n );\n\n const {\n build,\n preview,\n plugins: userPlugins = [],\n server: userServer,\n ...devConfig\n } = configResult?.config || {};\n\n const vite = await createServer({\n ...devConfig,\n // Pass `false` so Vite skips re-resolving a config file — we already\n // loaded and spread the user's config above.\n configFile: false,\n appType: \"custom\",\n server: {\n // Keep the user's server options (e.g. forwardConsole) but force the\n // three settings skybridge's Express integration requires.\n ...userServer,\n allowedHosts: true,\n middlewareMode: true,\n hmr: {\n server: httpServer,\n },\n },\n root,\n // optimizeDeps is set by the skybridge Vite plugin (entries + include)\n // so it can derive the view glob from `viewsDir`.\n plugins: [...userPlugins, assetBaseUrlTransformPlugin()],\n });\n\n router.use(cors());\n router.use(\"/\", vite.middlewares);\n\n return router;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import type { StandardSchemaV1 } from "@modelcontextprotocol/server";
2
+ export type RawInputShape = Record<string, StandardSchemaV1>;
3
+ export type InferSchemaOutput<S> = S extends StandardSchemaV1 ? StandardSchemaV1.InferOutput<S> : never;
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=standard-schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"standard-schema.js","sourceRoot":"","sources":["../src/standard-schema.ts"],"names":[],"mappings":"","sourcesContent":["import type { StandardSchemaV1 } from \"@modelcontextprotocol/server\";\n\nexport type RawInputShape = Record<string, StandardSchemaV1>;\n\nexport type InferSchemaOutput<S> = S extends StandardSchemaV1\n ? StandardSchemaV1.InferOutput<S>\n : never;\n"]}
@@ -1,15 +1,13 @@
1
1
  import { type MockInstance } from "vitest";
2
+ import { Skybridge } from "../server/app.js";
2
3
  import { McpServer } from "../server/server.js";
3
- /**
4
- * Creates a real McpServer instance for testing
5
- */
6
4
  export declare function createMockMcpServer(): {
7
5
  server: McpServer;
8
6
  mockRegisterResource: MockInstance<McpServer["registerResource"]>;
9
- mockRegisterTool: MockInstance<McpServer["registerTool"]>;
7
+ mockRegisterTool: MockInstance;
10
8
  };
11
- export declare function createTestServer(): McpServer<Record<never, import("../server/server.js").ToolDef<unknown, unknown, unknown>> & {
12
- "search-voyage": import("../server/server.js").ToolDef<{
9
+ export declare function createTestApp(): Skybridge<Record<never, import("../server/server.js").ToolDef> & {
10
+ "search-trip": import("../server/server.js").ToolDef<{
13
11
  destination: string;
14
12
  departureDate?: string | undefined;
15
13
  maxPrice?: number | undefined;
@@ -30,9 +28,9 @@ export declare function createTestServer(): McpServer<Record<never, import("../s
30
28
  images: string[];
31
29
  }, unknown>;
32
30
  } & {
33
- "no-input-widget": import("../server/server.js").ToolDef<{}, {}, unknown>;
31
+ "no-input-view": import("../server/server.js").ToolDef<{}, {}, unknown>;
34
32
  } & {
35
- "inferred-output-widget": import("../server/server.js").ToolDef<{
33
+ "inferred-output-view": import("../server/server.js").ToolDef<{
36
34
  query: string;
37
35
  }, {
38
36
  inferredResults: {
@@ -60,7 +58,7 @@ export declare function createTestServer(): McpServer<Record<never, import("../s
60
58
  fetchedAt: string;
61
59
  }, unknown>;
62
60
  } & {
63
- "widget-with-metadata": import("../server/server.js").ToolDef<{
61
+ "view-with-metadata": import("../server/server.js").ToolDef<{
64
62
  resourceId: string;
65
63
  }, {
66
64
  data: {
@@ -82,7 +80,7 @@ export declare function createTestServer(): McpServer<Record<never, import("../s
82
80
  source: string;
83
81
  }>;
84
82
  } & {
85
- "widget-with-mixed-returns": import("../server/server.js").ToolDef<{
83
+ "view-with-mixed-returns": import("../server/server.js").ToolDef<{
86
84
  shouldSucceed: boolean;
87
85
  }, {
88
86
  error: string;
@@ -94,18 +92,18 @@ export declare function createTestServer(): McpServer<Record<never, import("../s
94
92
  processedAt: number;
95
93
  region: string;
96
94
  }>;
97
- }>;
98
- export declare function createMinimalTestServer(): McpServer<Record<never, import("../server/server.js").ToolDef<unknown, unknown, unknown>> & {
99
- "search-voyage": import("../server/server.js").ToolDef<{
95
+ }, import("../server/auth.js").ExtraClaims>;
96
+ export declare function createMinimalTestApp(): Skybridge<Record<never, import("../server/server.js").ToolDef> & {
97
+ "search-trip": import("../server/server.js").ToolDef<{
100
98
  destination: string;
101
99
  }, {
102
100
  results: {
103
101
  id: string;
104
102
  }[];
105
103
  }, unknown>;
106
- }>;
107
- export declare function createInterfaceTestServer(): McpServer<Record<never, import("../server/server.js").ToolDef<unknown, unknown, unknown>> & {
108
- "interface-widget": import("../server/server.js").ToolDef<{
104
+ }, import("../server/auth.js").ExtraClaims>;
105
+ export declare function createInterfaceTestApp(): Skybridge<Record<never, import("../server/server.js").ToolDef> & {
106
+ "interface-view": import("../server/server.js").ToolDef<{
109
107
  id: string;
110
108
  }, {
111
109
  itemName: string;
@@ -114,22 +112,14 @@ export declare function createInterfaceTestServer(): McpServer<Record<never, imp
114
112
  processedBy: string;
115
113
  version: number;
116
114
  }>;
117
- }>;
118
- /**
119
- * Mock extra parameter for resource callback
120
- */
121
- export declare function createMockExtra(host: string): {
122
- requestInfo: {
123
- headers: {
124
- host: string;
125
- };
115
+ }, import("../server/auth.js").ExtraClaims>;
116
+ export declare function createMockExtra(host: string, options?: {
117
+ headers?: Record<string, string | string[]>;
118
+ url?: URL | string;
119
+ }): {
120
+ http: {
121
+ req: Request;
126
122
  };
127
123
  };
128
- /**
129
- * Sets up environment variables for testing
130
- */
131
124
  export declare function setTestEnv(env: Record<string, string>): void;
132
- /**
133
- * Resets environment variables
134
- */
135
125
  export declare function resetTestEnv(): void;
@@ -1,28 +1,26 @@
1
+ import { McpServer as McpServerBase } from "@modelcontextprotocol/server";
1
2
  import { vi } from "vitest";
2
3
  import * as z from "zod";
4
+ import { Skybridge } from "../server/app.js";
3
5
  import { McpServer } from "../server/server.js";
4
- /**
5
- * Creates a real McpServer instance for testing
6
- */
7
6
  export function createMockMcpServer() {
8
- // Create a real McpServer instance
9
7
  const server = new McpServer({
10
8
  name: "alpic-openai-app",
11
9
  version: "0.0.1",
12
10
  }, { capabilities: {} });
13
- // Mock the underlying methods to track calls
14
11
  const mockRegisterResource = vi.spyOn(server, "registerResource");
15
- const mockRegisterTool = vi.spyOn(server, "registerTool");
12
+ const mockRegisterTool = vi.spyOn(McpServerBase.prototype, "registerTool");
16
13
  return {
17
14
  server,
18
15
  mockRegisterResource,
19
16
  mockRegisterTool,
20
17
  };
21
18
  }
22
- export function createTestServer() {
23
- return new McpServer({ name: "test-app", version: "1.0.0" }, {})
24
- .registerWidget("search-voyage", {}, {
25
- description: "Search for voyages",
19
+ export function createTestApp() {
20
+ return new Skybridge({ name: "test-app", version: "1.0.0" }, (server) => server
21
+ .registerTool({
22
+ name: "search-trip",
23
+ description: "Search for trips",
26
24
  inputSchema: {
27
25
  destination: z.string(),
28
26
  departureDate: z.string().optional(),
@@ -36,6 +34,7 @@ export function createTestServer() {
36
34
  })),
37
35
  totalCount: z.number(),
38
36
  },
37
+ view: { component: "search-trip" },
39
38
  }, async ({ destination }) => {
40
39
  return {
41
40
  content: [{ type: "text", text: `Found trips to ${destination}` }],
@@ -45,7 +44,8 @@ export function createTestServer() {
45
44
  },
46
45
  };
47
46
  })
48
- .registerWidget("get-trip-details", {}, {
47
+ .registerTool({
48
+ name: "get-trip-details",
49
49
  description: "Get trip details",
50
50
  inputSchema: {
51
51
  tripId: z.string(),
@@ -55,6 +55,7 @@ export function createTestServer() {
55
55
  description: z.string(),
56
56
  images: z.array(z.string()),
57
57
  },
58
+ view: { component: "get-trip-details" },
58
59
  }, async ({ tripId }) => {
59
60
  return {
60
61
  content: [{ type: "text", text: `Details for ${tripId}` }],
@@ -65,21 +66,25 @@ export function createTestServer() {
65
66
  },
66
67
  };
67
68
  })
68
- .registerWidget("no-input-widget", {}, {
69
- description: "Widget with no input",
69
+ .registerTool({
70
+ name: "no-input-view",
71
+ description: "View with no input",
70
72
  inputSchema: {},
71
73
  outputSchema: {},
74
+ view: { component: "no-input-view" },
72
75
  }, async () => {
73
76
  return {
74
77
  content: [{ type: "text", text: "No input needed" }],
75
78
  structuredContent: {},
76
79
  };
77
80
  })
78
- .registerWidget("inferred-output-widget", {}, {
79
- description: "Widget with output inferred from callback",
81
+ .registerTool({
82
+ name: "inferred-output-view",
83
+ description: "View with output inferred from callback",
80
84
  inputSchema: {
81
85
  query: z.string(),
82
86
  },
87
+ view: { component: "inferred-output-view" },
83
88
  }, async ({ query }) => {
84
89
  return {
85
90
  content: [{ type: "text", text: `Query: ${query}` }],
@@ -89,7 +94,8 @@ export function createTestServer() {
89
94
  },
90
95
  };
91
96
  })
92
- .registerTool("calculate-price", {
97
+ .registerTool({
98
+ name: "calculate-price",
93
99
  description: "Calculate trip price",
94
100
  inputSchema: {
95
101
  tripId: z.string(),
@@ -108,7 +114,8 @@ export function createTestServer() {
108
114
  },
109
115
  };
110
116
  })
111
- .registerTool("inferred-tool", {
117
+ .registerTool({
118
+ name: "inferred-tool",
112
119
  description: "Tool with output inferred from callback",
113
120
  inputSchema: {
114
121
  itemId: z.string(),
@@ -122,11 +129,13 @@ export function createTestServer() {
122
129
  },
123
130
  };
124
131
  })
125
- .registerWidget("widget-with-metadata", {}, {
126
- description: "Widget that returns response metadata",
132
+ .registerTool({
133
+ name: "view-with-metadata",
134
+ description: "View that returns response metadata",
127
135
  inputSchema: {
128
136
  resourceId: z.string(),
129
137
  },
138
+ view: { component: "view-with-metadata" },
130
139
  }, async ({ resourceId }) => {
131
140
  return {
132
141
  content: [{ type: "text", text: `Resource: ${resourceId}` }],
@@ -140,7 +149,8 @@ export function createTestServer() {
140
149
  },
141
150
  };
142
151
  })
143
- .registerTool("tool-with-metadata", {
152
+ .registerTool({
153
+ name: "tool-with-metadata",
144
154
  description: "Tool that returns response metadata",
145
155
  inputSchema: {
146
156
  query: z.string(),
@@ -157,20 +167,20 @@ export function createTestServer() {
157
167
  },
158
168
  };
159
169
  })
160
- .registerWidget("widget-with-mixed-returns", {}, {
161
- description: "Widget with mixed return paths (some with _meta, some without)",
170
+ .registerTool({
171
+ name: "view-with-mixed-returns",
172
+ description: "View with mixed return paths (some with _meta, some without)",
162
173
  inputSchema: {
163
174
  shouldSucceed: z.boolean(),
164
175
  },
176
+ view: { component: "view-with-mixed-returns" },
165
177
  }, async ({ shouldSucceed }) => {
166
178
  if (!shouldSucceed) {
167
- // Error path - no _meta
168
179
  return {
169
180
  content: [{ type: "text", text: "Error occurred" }],
170
181
  structuredContent: { error: "Something went wrong" },
171
182
  };
172
183
  }
173
- // Success path - has _meta
174
184
  return {
175
185
  content: [{ type: "text", text: "Success" }],
176
186
  structuredContent: { data: "result" },
@@ -179,30 +189,34 @@ export function createTestServer() {
179
189
  region: "eu-west-1",
180
190
  },
181
191
  };
182
- });
192
+ }));
183
193
  }
184
- export function createMinimalTestServer() {
185
- return new McpServer({ name: "test-app", version: "1.0.0" }, {}).registerWidget("search-voyage", {}, {
186
- description: "Search for voyages",
194
+ export function createMinimalTestApp() {
195
+ return new Skybridge({ name: "test-app", version: "1.0.0" }, (server) => server.registerTool({
196
+ name: "search-trip",
197
+ description: "Search for trips",
187
198
  inputSchema: {
188
199
  destination: z.string(),
189
200
  },
190
201
  outputSchema: {
191
202
  results: z.array(z.object({ id: z.string() })),
192
203
  },
204
+ view: { component: "search-trip" },
193
205
  }, async ({ destination }) => {
194
206
  return {
195
207
  content: [{ type: "text", text: `Found trips to ${destination}` }],
196
208
  structuredContent: { results: [{ id: "1" }] },
197
209
  };
198
- });
210
+ }));
199
211
  }
200
- export function createInterfaceTestServer() {
201
- return new McpServer({ name: "interface-test-app", version: "1.0.0" }, {}).registerWidget("interface-widget", {}, {
202
- description: "Widget with interface-typed output",
212
+ export function createInterfaceTestApp() {
213
+ return new Skybridge({ name: "interface-test-app", version: "1.0.0" }, (server) => server.registerTool({
214
+ name: "interface-view",
215
+ description: "View with interface-typed output",
203
216
  inputSchema: {
204
217
  id: z.string(),
205
218
  },
219
+ view: { component: "interface-view" },
206
220
  }, async ({ id }) => {
207
221
  return {
208
222
  content: [{ type: "text", text: `Item ${id}` }],
@@ -215,27 +229,23 @@ export function createInterfaceTestServer() {
215
229
  version: 1,
216
230
  },
217
231
  };
218
- });
232
+ }));
219
233
  }
220
- /**
221
- * Mock extra parameter for resource callback
222
- */
223
- export function createMockExtra(host) {
234
+ export function createMockExtra(host, options) {
235
+ const headers = new Headers();
236
+ headers.set("host", host);
237
+ for (const [key, value] of Object.entries(options?.headers ?? {})) {
238
+ headers.set(key, Array.isArray(value) ? value.join(", ") : value);
239
+ }
224
240
  return {
225
- requestInfo: {
226
- headers: { host },
241
+ http: {
242
+ req: new Request(String(options?.url ?? `https://${host}`), { headers }),
227
243
  },
228
244
  };
229
245
  }
230
- /**
231
- * Sets up environment variables for testing
232
- */
233
246
  export function setTestEnv(env) {
234
247
  Object.assign(process.env, env);
235
248
  }
236
- /**
237
- * Resets environment variables
238
- */
239
249
  export function resetTestEnv() {
240
250
  delete process.env.NODE_ENV;
241
251
  }
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/test/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAEhD;;GAEG;A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,IAAY,EACZ,OAGC;IAED,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAC9B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC1B,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QAClE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IACpE,CAAC;IACD,OAAO;QACL,IAAI,EAAE;YACJ,GAAG,EAAE,IAAI,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,IAAI,WAAW,IAAI,EAAE,CAAC,EAAE,EAAE,OAAO,EAAE,CAAC;SACzE;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,GAA2B;IACpD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,YAAY;IAC1B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AAC9B,CAAC","sourcesContent":["import { McpServer as McpServerBase } from \"@modelcontextprotocol/server\";\nimport { type MockInstance, vi } from \"vitest\";\nimport * as z from \"zod\";\nimport { Skybridge } from \"../server/app.js\";\nimport { McpServer, type ViewName } from \"../server/server.js\";\n\nexport function createMockMcpServer(): {\n server: McpServer;\n mockRegisterResource: MockInstance<McpServer[\"registerResource\"]>;\n mockRegisterTool: MockInstance;\n} {\n const server = new McpServer(\n {\n name: \"alpic-openai-app\",\n version: \"0.0.1\",\n },\n { capabilities: {} },\n );\n\n const mockRegisterResource = vi.spyOn(server, \"registerResource\");\n const mockRegisterTool = vi.spyOn(McpServerBase.prototype, \"registerTool\");\n\n return {\n server,\n mockRegisterResource,\n mockRegisterTool,\n };\n}\n\nexport function createTestApp() {\n return new Skybridge({ name: \"test-app\", version: \"1.0.0\" }, (server) =>\n server\n .registerTool(\n {\n name: \"search-trip\",\n description: \"Search for trips\",\n inputSchema: {\n destination: z.string(),\n departureDate: z.string().optional(),\n maxPrice: z.number().optional(),\n },\n outputSchema: {\n results: z.array(\n z.object({\n id: z.string(),\n name: z.string(),\n price: z.number(),\n }),\n ),\n totalCount: z.number(),\n },\n view: { component: \"search-trip\" as ViewName },\n },\n async ({ destination }) => {\n return {\n content: [{ type: \"text\", text: `Found trips to ${destination}` }],\n structuredContent: {\n results: [{ id: \"1\", name: \"Trip\", price: 1000 }],\n totalCount: 1,\n },\n };\n },\n )\n .registerTool(\n {\n name: \"get-trip-details\",\n description: \"Get trip details\",\n inputSchema: {\n tripId: z.string(),\n },\n outputSchema: {\n name: z.string(),\n description: z.string(),\n images: z.array(z.string()),\n },\n view: { component: \"get-trip-details\" as ViewName },\n },\n async ({ tripId }) => {\n return {\n content: [{ type: \"text\", text: `Details for ${tripId}` }],\n structuredContent: {\n name: \"Trip\",\n description: \"A great trip\",\n images: [\"image1.jpg\"],\n },\n };\n },\n )\n .registerTool(\n {\n name: \"no-input-view\",\n description: \"View with no input\",\n inputSchema: {},\n outputSchema: {},\n view: { component: \"no-input-view\" as ViewName },\n },\n async () => {\n return {\n content: [{ type: \"text\", text: \"No input needed\" }],\n structuredContent: {},\n };\n },\n )\n .registerTool(\n {\n name: \"inferred-output-view\",\n description: \"View with output inferred from callback\",\n inputSchema: {\n query: z.string(),\n },\n view: { component: \"inferred-output-view\" as ViewName },\n },\n async ({ query }) => {\n return {\n content: [{ type: \"text\", text: `Query: ${query}` }],\n structuredContent: {\n inferredResults: [{ id: \"inferred-1\", score: 0.95 }],\n inferredCount: 1,\n },\n };\n },\n )\n .registerTool(\n {\n name: \"calculate-price\",\n description: \"Calculate trip price\",\n inputSchema: {\n tripId: z.string(),\n passengers: z.number(),\n },\n outputSchema: {\n totalPrice: z.number(),\n currency: z.string(),\n },\n },\n async ({ tripId, passengers }) => {\n return {\n content: [{ type: \"text\", text: `Price for ${tripId}` }],\n structuredContent: {\n totalPrice: 1000 * passengers,\n currency: \"USD\",\n },\n };\n },\n )\n .registerTool(\n {\n name: \"inferred-tool\",\n description: \"Tool with output inferred from callback\",\n inputSchema: {\n itemId: z.string(),\n },\n },\n async ({ itemId }) => {\n return {\n content: [{ type: \"text\", text: `Item: ${itemId}` }],\n structuredContent: {\n itemDetails: { name: \"Inferred Item\", available: true },\n fetchedAt: \"2024-01-01\",\n },\n };\n },\n )\n .registerTool(\n {\n name: \"view-with-metadata\",\n description: \"View that returns response metadata\",\n inputSchema: {\n resourceId: z.string(),\n },\n view: { component: \"view-with-metadata\" as ViewName },\n },\n async ({ resourceId }) => {\n return {\n content: [{ type: \"text\", text: `Resource: ${resourceId}` }],\n structuredContent: {\n data: { id: resourceId, loaded: true },\n },\n _meta: {\n requestId: \"req-123\",\n timestamp: 1704067200000,\n cached: false,\n },\n };\n },\n )\n .registerTool(\n {\n name: \"tool-with-metadata\",\n description: \"Tool that returns response metadata\",\n inputSchema: {\n query: z.string(),\n },\n },\n async ({ query }) => {\n return {\n content: [{ type: \"text\", text: `Query: ${query}` }],\n structuredContent: {\n results: [query],\n },\n _meta: {\n executionTime: 150,\n source: \"cache\",\n },\n };\n },\n )\n .registerTool(\n {\n name: \"view-with-mixed-returns\",\n description:\n \"View with mixed return paths (some with _meta, some without)\",\n inputSchema: {\n shouldSucceed: z.boolean(),\n },\n view: { component: \"view-with-mixed-returns\" as ViewName },\n },\n async ({ shouldSucceed }) => {\n if (!shouldSucceed) {\n return {\n content: [{ type: \"text\", text: \"Error occurred\" }],\n structuredContent: { error: \"Something went wrong\" },\n };\n }\n return {\n content: [{ type: \"text\", text: \"Success\" }],\n structuredContent: { data: \"result\" },\n _meta: {\n processedAt: 1704067200000,\n region: \"eu-west-1\",\n },\n };\n },\n ),\n );\n}\n\nexport function createMinimalTestApp() {\n return new Skybridge({ name: \"test-app\", version: \"1.0.0\" }, (server) =>\n server.registerTool(\n {\n name: \"search-trip\",\n description: \"Search for trips\",\n inputSchema: {\n destination: z.string(),\n },\n outputSchema: {\n results: z.array(z.object({ id: z.string() })),\n },\n view: { component: \"search-trip\" as ViewName },\n },\n async ({ destination }) => {\n return {\n content: [{ type: \"text\", text: `Found trips to ${destination}` }],\n structuredContent: { results: [{ id: \"1\" }] },\n };\n },\n ),\n );\n}\n\ninterface InterfaceOutput {\n itemName: string;\n quantity: number;\n}\n\ninterface InterfaceMeta {\n processedBy: string;\n version: number;\n}\n\ninterface InterfaceReturnType {\n content: [{ type: \"text\"; text: string }];\n structuredContent: InterfaceOutput;\n _meta: InterfaceMeta;\n}\n\nexport function createInterfaceTestApp() {\n return new Skybridge(\n { name: \"interface-test-app\", version: \"1.0.0\" },\n (server) =>\n server.registerTool(\n {\n name: \"interface-view\" as const,\n description: \"View with interface-typed output\",\n inputSchema: {\n id: z.string(),\n },\n view: { component: \"interface-view\" as ViewName },\n },\n async ({ id }): Promise<InterfaceReturnType> => {\n return {\n content: [{ type: \"text\", text: `Item ${id}` }],\n structuredContent: {\n itemName: \"Test Item\",\n quantity: 42,\n },\n _meta: {\n processedBy: \"test\",\n version: 1,\n },\n };\n },\n ),\n );\n}\n\nexport function createMockExtra(\n host: string,\n options?: {\n headers?: Record<string, string | string[]>;\n url?: URL | string;\n },\n) {\n const headers = new Headers();\n headers.set(\"host\", host);\n for (const [key, value] of Object.entries(options?.headers ?? {})) {\n headers.set(key, Array.isArray(value) ? value.join(\", \") : value);\n }\n return {\n http: {\n req: new Request(String(options?.url ?? `https://${host}`), { headers }),\n },\n };\n}\n\nexport function setTestEnv(env: Record<string, string>) {\n Object.assign(process.env, env);\n}\n\nexport function resetTestEnv() {\n delete process.env.NODE_ENV;\n}\n"]}
@@ -0,0 +1 @@
1
+ export {};