skybridge 0.0.0-dev.f03017e → 0.0.0-dev.f0394fc

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 (513) hide show
  1. package/README.md +126 -124
  2. package/dist/cli/build-helpers.d.ts +11 -0
  3. package/dist/cli/build-helpers.js +113 -0
  4. package/dist/cli/build-helpers.js.map +1 -0
  5. package/dist/cli/build-helpers.test.js +143 -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 +84 -0
  9. package/dist/cli/build-steps.js.map +1 -0
  10. package/dist/cli/build-steps.test.js +72 -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 +8 -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.map +1 -1
  17. package/dist/cli/resolve-skybridge-config.d.ts +6 -0
  18. package/dist/cli/resolve-skybridge-config.js +28 -0
  19. package/dist/cli/resolve-skybridge-config.js.map +1 -0
  20. package/dist/cli/run-command.js.map +1 -1
  21. package/dist/cli/run-plain.d.ts +18 -0
  22. package/dist/cli/run-plain.js +90 -0
  23. package/dist/cli/run-plain.js.map +1 -0
  24. package/dist/cli/telemetry.js +2 -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.js.map +1 -1
  42. package/dist/cli/use-execute-steps.d.ts +1 -1
  43. package/dist/cli/use-execute-steps.js.map +1 -1
  44. package/dist/cli/use-messages.js.map +1 -1
  45. package/dist/cli/use-nodemon.d.ts +25 -1
  46. package/dist/cli/use-nodemon.js +97 -55
  47. package/dist/cli/use-nodemon.js.map +1 -1
  48. package/dist/cli/use-open-browser.d.ts +1 -0
  49. package/dist/cli/use-open-browser.js +44 -0
  50. package/dist/cli/use-open-browser.js.map +1 -0
  51. package/dist/cli/use-tunnel.d.ts +1 -1
  52. package/dist/cli/use-tunnel.js +102 -68
  53. package/dist/cli/use-tunnel.js.map +1 -1
  54. package/dist/cli/use-typescript-check.d.ts +9 -2
  55. package/dist/cli/use-typescript-check.js +91 -51
  56. package/dist/cli/use-typescript-check.js.map +1 -1
  57. package/dist/commands/build.d.ts +0 -3
  58. package/dist/commands/build.js +2 -38
  59. package/dist/commands/build.js.map +1 -1
  60. package/dist/commands/create.d.ts +9 -0
  61. package/dist/commands/create.js +30 -0
  62. package/dist/commands/create.js.map +1 -0
  63. package/dist/commands/dev.d.ts +2 -0
  64. package/dist/commands/dev.js +84 -5
  65. package/dist/commands/dev.js.map +1 -1
  66. package/dist/commands/start.js +7 -1
  67. package/dist/commands/start.js.map +1 -1
  68. package/dist/commands/telemetry/disable.js.map +1 -1
  69. package/dist/commands/telemetry/enable.js.map +1 -1
  70. package/dist/commands/telemetry/status.js.map +1 -1
  71. package/dist/context-warnings.d.ts +5 -0
  72. package/dist/context-warnings.js +31 -0
  73. package/dist/context-warnings.js.map +1 -0
  74. package/dist/context-warnings.test.js +28 -0
  75. package/dist/context-warnings.test.js.map +1 -0
  76. package/dist/server/app.d.ts +211 -0
  77. package/dist/server/app.js +277 -0
  78. package/dist/server/app.js.map +1 -0
  79. package/dist/server/app.test.d.ts +1 -0
  80. package/dist/server/app.test.js +178 -0
  81. package/dist/server/app.test.js.map +1 -0
  82. package/dist/server/asset-base-url-transform-plugin.d.ts +1 -0
  83. package/dist/server/asset-base-url-transform-plugin.js +17 -2
  84. package/dist/server/asset-base-url-transform-plugin.js.map +1 -1
  85. package/dist/server/asset-base-url-transform-plugin.test.js +80 -1
  86. package/dist/server/asset-base-url-transform-plugin.test.js.map +1 -1
  87. package/dist/server/auth/discovery.d.ts +33 -0
  88. package/dist/server/auth/discovery.js +56 -0
  89. package/dist/server/auth/discovery.js.map +1 -0
  90. package/dist/server/auth/discovery.test.d.ts +1 -0
  91. package/dist/server/auth/discovery.test.js +93 -0
  92. package/dist/server/auth/discovery.test.js.map +1 -0
  93. package/dist/server/auth/index.d.ts +48 -0
  94. package/dist/server/auth/index.js +2 -0
  95. package/dist/server/auth/index.js.map +1 -0
  96. package/dist/server/auth/providers/auth0.d.ts +40 -0
  97. package/dist/server/auth/providers/auth0.js +36 -0
  98. package/dist/server/auth/providers/auth0.js.map +1 -0
  99. package/dist/server/auth/providers/auth0.test.d.ts +1 -0
  100. package/dist/server/auth/providers/auth0.test.js +50 -0
  101. package/dist/server/auth/providers/auth0.test.js.map +1 -0
  102. package/dist/server/auth/providers/authplane.d.ts +49 -0
  103. package/dist/server/auth/providers/authplane.js +57 -0
  104. package/dist/server/auth/providers/authplane.js.map +1 -0
  105. package/dist/server/auth/providers/authplane.test.d.ts +1 -0
  106. package/dist/server/auth/providers/authplane.test.js +143 -0
  107. package/dist/server/auth/providers/authplane.test.js.map +1 -0
  108. package/dist/server/auth/providers/clerk.d.ts +51 -0
  109. package/dist/server/auth/providers/clerk.js +19 -0
  110. package/dist/server/auth/providers/clerk.js.map +1 -0
  111. package/dist/server/auth/providers/clerk.test.d.ts +1 -0
  112. package/dist/server/auth/providers/clerk.test.js +30 -0
  113. package/dist/server/auth/providers/clerk.test.js.map +1 -0
  114. package/dist/server/auth/providers/custom.d.ts +42 -0
  115. package/dist/server/auth/providers/custom.js +59 -0
  116. package/dist/server/auth/providers/custom.js.map +1 -0
  117. package/dist/server/auth/providers/custom.test.d.ts +1 -0
  118. package/dist/server/auth/providers/custom.test.js +161 -0
  119. package/dist/server/auth/providers/custom.test.js.map +1 -0
  120. package/dist/server/auth/providers/descope.d.ts +44 -0
  121. package/dist/server/auth/providers/descope.js +44 -0
  122. package/dist/server/auth/providers/descope.js.map +1 -0
  123. package/dist/server/auth/providers/descope.test.d.ts +1 -0
  124. package/dist/server/auth/providers/descope.test.js +62 -0
  125. package/dist/server/auth/providers/descope.test.js.map +1 -0
  126. package/dist/server/auth/providers/shared.d.ts +2 -0
  127. package/dist/server/auth/providers/shared.js +6 -0
  128. package/dist/server/auth/providers/shared.js.map +1 -0
  129. package/dist/server/auth/providers/shared.test.d.ts +1 -0
  130. package/dist/server/auth/providers/shared.test.js +10 -0
  131. package/dist/server/auth/providers/shared.test.js.map +1 -0
  132. package/dist/server/auth/providers/stytch.d.ts +25 -0
  133. package/dist/server/auth/providers/stytch.js +16 -0
  134. package/dist/server/auth/providers/stytch.js.map +1 -0
  135. package/dist/server/auth/providers/verify-spy.d.ts +12 -0
  136. package/dist/server/auth/providers/verify-spy.js +21 -0
  137. package/dist/server/auth/providers/verify-spy.js.map +1 -0
  138. package/dist/server/auth/providers/workos.d.ts +34 -0
  139. package/dist/server/auth/providers/workos.js +16 -0
  140. package/dist/server/auth/providers/workos.js.map +1 -0
  141. package/dist/server/auth/security-schemes.d.ts +23 -0
  142. package/dist/server/auth/security-schemes.js +64 -0
  143. package/dist/server/auth/security-schemes.js.map +1 -0
  144. package/dist/server/auth/security-schemes.test.d.ts +1 -0
  145. package/dist/server/auth/security-schemes.test.js +99 -0
  146. package/dist/server/auth/security-schemes.test.js.map +1 -0
  147. package/dist/server/auth/setup.d.ts +6 -0
  148. package/dist/server/auth/setup.js +91 -0
  149. package/dist/server/auth/setup.js.map +1 -0
  150. package/dist/server/auth/setup.test.d.ts +1 -0
  151. package/dist/server/auth/setup.test.js +514 -0
  152. package/dist/server/auth/setup.test.js.map +1 -0
  153. package/dist/server/auth/verify.d.ts +48 -0
  154. package/dist/server/auth/verify.js +62 -0
  155. package/dist/server/auth/verify.js.map +1 -0
  156. package/dist/server/auth/verify.test.d.ts +1 -0
  157. package/dist/server/auth/verify.test.js +165 -0
  158. package/dist/server/auth/verify.test.js.map +1 -0
  159. package/dist/server/auth-extra.test-d.d.ts +1 -0
  160. package/dist/server/auth-extra.test-d.js +130 -0
  161. package/dist/server/auth-extra.test-d.js.map +1 -0
  162. package/dist/server/auth.d.ts +57 -0
  163. package/dist/server/auth.js +27 -0
  164. package/dist/server/auth.js.map +1 -0
  165. package/dist/server/build-manifest.test.d.ts +1 -0
  166. package/dist/server/build-manifest.test.js +28 -0
  167. package/dist/server/build-manifest.test.js.map +1 -0
  168. package/dist/server/content-helpers.d.ts +41 -1
  169. package/dist/server/content-helpers.js +33 -0
  170. package/dist/server/content-helpers.js.map +1 -1
  171. package/dist/server/content-helpers.test.js.map +1 -1
  172. package/dist/server/events.d.ts +113 -0
  173. package/dist/server/events.js +318 -0
  174. package/dist/server/events.js.map +1 -0
  175. package/dist/server/events.test.d.ts +1 -0
  176. package/dist/server/events.test.js +172 -0
  177. package/dist/server/events.test.js.map +1 -0
  178. package/dist/server/express.d.ts +24 -7
  179. package/dist/server/express.js +66 -30
  180. package/dist/server/express.js.map +1 -1
  181. package/dist/server/express.test.js +445 -81
  182. package/dist/server/express.test.js.map +1 -1
  183. package/dist/server/file-ref.d.ts +28 -0
  184. package/dist/server/file-ref.js +27 -0
  185. package/dist/server/file-ref.js.map +1 -0
  186. package/dist/server/form-input.d.ts +120 -0
  187. package/dist/server/form-input.js +89 -0
  188. package/dist/server/form-input.js.map +1 -0
  189. package/dist/server/host.d.ts +2 -0
  190. package/dist/server/host.js +11 -0
  191. package/dist/server/host.js.map +1 -0
  192. package/dist/server/host.test.d.ts +1 -0
  193. package/dist/server/host.test.js +13 -0
  194. package/dist/server/host.test.js.map +1 -0
  195. package/dist/server/index.d.ts +20 -2
  196. package/dist/server/index.js +17 -1
  197. package/dist/server/index.js.map +1 -1
  198. package/dist/server/inferUtilityTypes.d.ts +6 -6
  199. package/dist/server/inferUtilityTypes.js.map +1 -1
  200. package/dist/server/mcp-errors.test.d.ts +1 -0
  201. package/dist/server/mcp-errors.test.js +229 -0
  202. package/dist/server/mcp-errors.test.js.map +1 -0
  203. package/dist/server/metric.d.ts +5 -3
  204. package/dist/server/metric.js +5 -5
  205. package/dist/server/metric.js.map +1 -1
  206. package/dist/server/middleware.d.ts +51 -13
  207. package/dist/server/middleware.js +33 -0
  208. package/dist/server/middleware.js.map +1 -1
  209. package/dist/server/middleware.test-d.js +1 -1
  210. package/dist/server/middleware.test-d.js.map +1 -1
  211. package/dist/server/middleware.test.js +242 -134
  212. package/dist/server/middleware.test.js.map +1 -1
  213. package/dist/server/register-tool.test.d.ts +1 -0
  214. package/dist/server/register-tool.test.js +230 -0
  215. package/dist/server/register-tool.test.js.map +1 -0
  216. package/dist/server/requestOrigin.d.ts +7 -0
  217. package/dist/server/requestOrigin.js +25 -0
  218. package/dist/server/requestOrigin.js.map +1 -0
  219. package/dist/server/server.d.ts +548 -56
  220. package/dist/server/server.js +685 -286
  221. package/dist/server/server.js.map +1 -1
  222. package/dist/server/skills-integration.test.d.ts +1 -0
  223. package/dist/server/skills-integration.test.js +86 -0
  224. package/dist/server/skills-integration.test.js.map +1 -0
  225. package/dist/server/skills.d.ts +27 -0
  226. package/dist/server/skills.js +188 -0
  227. package/dist/server/skills.js.map +1 -0
  228. package/dist/server/skills.test.d.ts +1 -0
  229. package/dist/server/skills.test.js +243 -0
  230. package/dist/server/skills.test.js.map +1 -0
  231. package/dist/server/templateHelper.d.ts +0 -5
  232. package/dist/server/templateHelper.js +3 -22
  233. package/dist/server/templateHelper.js.map +1 -1
  234. package/dist/server/templates.generated.d.ts +4 -0
  235. package/dist/server/templates.generated.js +43 -0
  236. package/dist/server/templates.generated.js.map +1 -0
  237. package/dist/server/tool-extra.test.d.ts +1 -0
  238. package/dist/server/tool-extra.test.js +167 -0
  239. package/dist/server/tool-extra.test.js.map +1 -0
  240. package/dist/server/tunnel-proxy-router.d.ts +7 -0
  241. package/dist/server/tunnel-proxy-router.js +110 -0
  242. package/dist/server/tunnel-proxy-router.js.map +1 -0
  243. package/dist/server/tunnel-proxy-router.test.d.ts +1 -0
  244. package/dist/server/tunnel-proxy-router.test.js +229 -0
  245. package/dist/server/tunnel-proxy-router.test.js.map +1 -0
  246. package/dist/server/view-name.test-d.d.ts +1 -0
  247. package/dist/server/view-name.test-d.js +8 -0
  248. package/dist/server/view-name.test-d.js.map +1 -0
  249. package/dist/server/view-resource-resolution.test.d.ts +6 -0
  250. package/dist/server/view-resource-resolution.test.js +176 -0
  251. package/dist/server/view-resource-resolution.test.js.map +1 -0
  252. package/dist/server/viewsDevServer.js +4 -1
  253. package/dist/server/viewsDevServer.js.map +1 -1
  254. package/dist/test/utils.d.ts +9 -11
  255. package/dist/test/utils.js +220 -201
  256. package/dist/test/utils.js.map +1 -1
  257. package/dist/test/view.test.js +199 -113
  258. package/dist/test/view.test.js.map +1 -1
  259. package/dist/version.js +1 -3
  260. package/dist/version.js.map +1 -1
  261. package/dist/views/index.d.ts +10 -0
  262. package/dist/views/index.js +3 -0
  263. package/dist/views/index.js.map +1 -0
  264. package/dist/{web/plugin → views}/scan-views.d.ts +8 -0
  265. package/dist/{web/plugin → views}/scan-views.js +26 -8
  266. package/dist/views/scan-views.js.map +1 -0
  267. package/dist/views/scan-views.test.d.ts +1 -0
  268. package/dist/{web/plugin → views}/scan-views.test.js +33 -1
  269. package/dist/views/scan-views.test.js.map +1 -0
  270. package/dist/views/validate-view.d.ts +1 -0
  271. package/dist/{web/plugin → views}/validate-view.js +2 -2
  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.map +1 -0
  275. package/dist/web/bridges/adaptor.d.ts +62 -0
  276. package/dist/web/bridges/adaptor.js +477 -0
  277. package/dist/web/bridges/adaptor.js.map +1 -0
  278. package/dist/web/bridges/adaptor.test.d.ts +1 -0
  279. package/dist/web/bridges/adaptor.test.js +281 -0
  280. package/dist/web/bridges/adaptor.test.js.map +1 -0
  281. package/dist/web/bridges/apps-sdk/bridge.d.ts +6 -1
  282. package/dist/web/bridges/apps-sdk/bridge.js +15 -3
  283. package/dist/web/bridges/apps-sdk/bridge.js.map +1 -1
  284. package/dist/web/bridges/apps-sdk/index.d.ts +0 -1
  285. package/dist/web/bridges/apps-sdk/index.js +0 -1
  286. package/dist/web/bridges/apps-sdk/index.js.map +1 -1
  287. package/dist/web/bridges/apps-sdk/types.d.ts +10 -4
  288. package/dist/web/bridges/apps-sdk/types.js.map +1 -1
  289. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.d.ts +11 -0
  290. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js +11 -0
  291. package/dist/web/bridges/apps-sdk/use-apps-sdk-context.js.map +1 -1
  292. package/dist/web/bridges/get-adaptor.d.ts +7 -0
  293. package/dist/web/bridges/get-adaptor.js +9 -7
  294. package/dist/web/bridges/get-adaptor.js.map +1 -1
  295. package/dist/web/bridges/get-adaptor.test.d.ts +1 -0
  296. package/dist/web/bridges/get-adaptor.test.js +32 -0
  297. package/dist/web/bridges/get-adaptor.test.js.map +1 -0
  298. package/dist/web/bridges/index.js.map +1 -1
  299. package/dist/web/bridges/mcp-app/bridge.d.ts +15 -2
  300. package/dist/web/bridges/mcp-app/bridge.js +80 -7
  301. package/dist/web/bridges/mcp-app/bridge.js.map +1 -1
  302. package/dist/web/bridges/mcp-app/bridge.test.d.ts +1 -0
  303. package/dist/web/bridges/mcp-app/bridge.test.js +17 -0
  304. package/dist/web/bridges/mcp-app/bridge.test.js.map +1 -0
  305. package/dist/web/bridges/mcp-app/index.d.ts +0 -1
  306. package/dist/web/bridges/mcp-app/index.js +0 -1
  307. package/dist/web/bridges/mcp-app/index.js.map +1 -1
  308. package/dist/web/bridges/mcp-app/types.d.ts +19 -2
  309. package/dist/web/bridges/mcp-app/types.js.map +1 -1
  310. package/dist/web/bridges/mcp-app/use-mcp-app-context.d.ts +13 -1
  311. package/dist/web/bridges/mcp-app/use-mcp-app-context.js +12 -0
  312. package/dist/web/bridges/mcp-app/use-mcp-app-context.js.map +1 -1
  313. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js +1 -1
  314. package/dist/web/bridges/mcp-app/use-mcp-app-context.test.js.map +1 -1
  315. package/dist/web/bridges/mcp-app/view-tools.test.d.ts +1 -0
  316. package/dist/web/bridges/mcp-app/view-tools.test.js +143 -0
  317. package/dist/web/bridges/mcp-app/view-tools.test.js.map +1 -0
  318. package/dist/web/bridges/types.d.ts +174 -11
  319. package/dist/web/bridges/types.js +14 -1
  320. package/dist/web/bridges/types.js.map +1 -1
  321. package/dist/web/bridges/types.test.d.ts +1 -0
  322. package/dist/web/bridges/types.test.js +19 -0
  323. package/dist/web/bridges/types.test.js.map +1 -0
  324. package/dist/web/bridges/use-host-context.d.ts +5 -0
  325. package/dist/web/bridges/use-host-context.js +5 -0
  326. package/dist/web/bridges/use-host-context.js.map +1 -1
  327. package/dist/web/components/modal-provider.d.ts +1 -1
  328. package/dist/web/components/modal-provider.js +4 -3
  329. package/dist/web/components/modal-provider.js.map +1 -1
  330. package/dist/web/create-store.d.ts +26 -0
  331. package/dist/web/create-store.js +35 -9
  332. package/dist/web/create-store.js.map +1 -1
  333. package/dist/web/create-store.test.js +24 -23
  334. package/dist/web/create-store.test.js.map +1 -1
  335. package/dist/web/data-llm.d.ts +35 -2
  336. package/dist/web/data-llm.js +34 -5
  337. package/dist/web/data-llm.js.map +1 -1
  338. package/dist/web/data-llm.test.js +48 -29
  339. package/dist/web/data-llm.test.js.map +1 -1
  340. package/dist/web/generate-helpers.d.ts +25 -19
  341. package/dist/web/generate-helpers.js +23 -17
  342. package/dist/web/generate-helpers.js.map +1 -1
  343. package/dist/web/generate-helpers.test-d.js +14 -12
  344. package/dist/web/generate-helpers.test-d.js.map +1 -1
  345. package/dist/web/generate-helpers.test.js +2 -2
  346. package/dist/web/generate-helpers.test.js.map +1 -1
  347. package/dist/web/helpers/state.d.ts +2 -2
  348. package/dist/web/helpers/state.js +11 -11
  349. package/dist/web/helpers/state.js.map +1 -1
  350. package/dist/web/helpers/state.test.js +9 -9
  351. package/dist/web/helpers/state.test.js.map +1 -1
  352. package/dist/web/hooks/index.d.ts +11 -2
  353. package/dist/web/hooks/index.js +11 -2
  354. package/dist/web/hooks/index.js.map +1 -1
  355. package/dist/web/hooks/openai-extensions.test.d.ts +1 -0
  356. package/dist/web/hooks/openai-extensions.test.js +107 -0
  357. package/dist/web/hooks/openai-extensions.test.js.map +1 -0
  358. package/dist/web/hooks/test/utils.d.ts +7 -2
  359. package/dist/web/hooks/test/utils.js +14 -3
  360. package/dist/web/hooks/test/utils.js.map +1 -1
  361. package/dist/web/hooks/use-call-tool.d.ts +47 -2
  362. package/dist/web/hooks/use-call-tool.js +43 -10
  363. package/dist/web/hooks/use-call-tool.js.map +1 -1
  364. package/dist/web/hooks/use-call-tool.test-d.js.map +1 -1
  365. package/dist/web/hooks/use-call-tool.test.js +75 -29
  366. package/dist/web/hooks/use-call-tool.test.js.map +1 -1
  367. package/dist/web/hooks/use-deep-link.d.ts +22 -0
  368. package/dist/web/hooks/use-deep-link.js +34 -0
  369. package/dist/web/hooks/use-deep-link.js.map +1 -0
  370. package/dist/web/hooks/use-display-mode.d.ts +20 -0
  371. package/dist/web/hooks/use-display-mode.js +20 -0
  372. package/dist/web/hooks/use-display-mode.js.map +1 -1
  373. package/dist/web/hooks/use-display-mode.test-d.js.map +1 -1
  374. package/dist/web/hooks/use-display-mode.test.js +57 -21
  375. package/dist/web/hooks/use-display-mode.test.js.map +1 -1
  376. package/dist/web/hooks/use-download.d.ts +3 -0
  377. package/dist/web/hooks/use-download.js +7 -0
  378. package/dist/web/hooks/use-download.js.map +1 -0
  379. package/dist/web/hooks/use-download.test.d.ts +1 -0
  380. package/dist/web/hooks/use-download.test.js +103 -0
  381. package/dist/web/hooks/use-download.test.js.map +1 -0
  382. package/dist/web/hooks/use-file-resource.d.ts +37 -0
  383. package/dist/web/hooks/use-file-resource.js +98 -0
  384. package/dist/web/hooks/use-file-resource.js.map +1 -0
  385. package/dist/web/hooks/use-file-resource.test.d.ts +1 -0
  386. package/dist/web/hooks/use-file-resource.test.js +65 -0
  387. package/dist/web/hooks/use-file-resource.test.js.map +1 -0
  388. package/dist/web/hooks/use-files.d.ts +32 -0
  389. package/dist/web/hooks/use-files.js +32 -0
  390. package/dist/web/hooks/use-files.js.map +1 -1
  391. package/dist/web/hooks/use-files.test.js +11 -3
  392. package/dist/web/hooks/use-files.test.js.map +1 -1
  393. package/dist/web/hooks/use-host.d.ts +44 -0
  394. package/dist/web/hooks/use-host.js +45 -0
  395. package/dist/web/hooks/use-host.js.map +1 -0
  396. package/dist/web/hooks/use-host.test.d.ts +1 -0
  397. package/dist/web/hooks/use-host.test.js +59 -0
  398. package/dist/web/hooks/use-host.test.js.map +1 -0
  399. package/dist/web/hooks/use-model-context.d.ts +44 -0
  400. package/dist/web/hooks/use-model-context.js +63 -0
  401. package/dist/web/hooks/use-model-context.js.map +1 -0
  402. package/dist/web/hooks/use-open-external.d.ts +17 -0
  403. package/dist/web/hooks/use-open-external.js +16 -0
  404. package/dist/web/hooks/use-open-external.js.map +1 -1
  405. package/dist/web/hooks/use-open-external.test.js +15 -5
  406. package/dist/web/hooks/use-open-external.test.js.map +1 -1
  407. package/dist/web/hooks/use-open-file.d.ts +20 -0
  408. package/dist/web/hooks/use-open-file.js +25 -0
  409. package/dist/web/hooks/use-open-file.js.map +1 -0
  410. package/dist/web/hooks/use-register-view-tool.d.ts +37 -0
  411. package/dist/web/hooks/use-register-view-tool.js +50 -0
  412. package/dist/web/hooks/use-register-view-tool.js.map +1 -0
  413. package/dist/web/hooks/use-request-close.d.ts +16 -0
  414. package/dist/web/hooks/use-request-close.js +21 -0
  415. package/dist/web/hooks/use-request-close.js.map +1 -0
  416. package/dist/web/hooks/use-request-close.test.d.ts +1 -0
  417. package/dist/web/hooks/use-request-close.test.js +47 -0
  418. package/dist/web/hooks/use-request-close.test.js.map +1 -0
  419. package/dist/web/hooks/use-request-modal.d.ts +16 -1
  420. package/dist/web/hooks/use-request-modal.js +19 -4
  421. package/dist/web/hooks/use-request-modal.js.map +1 -1
  422. package/dist/web/hooks/use-request-modal.test.js +12 -2
  423. package/dist/web/hooks/use-request-modal.test.js.map +1 -1
  424. package/dist/web/hooks/use-request-size.d.ts +20 -0
  425. package/dist/web/hooks/use-request-size.js +24 -0
  426. package/dist/web/hooks/use-request-size.js.map +1 -0
  427. package/dist/web/hooks/use-request-size.test.d.ts +1 -0
  428. package/dist/web/hooks/use-request-size.test.js +47 -0
  429. package/dist/web/hooks/use-request-size.test.js.map +1 -0
  430. package/dist/web/hooks/use-send-follow-up-message.d.ts +25 -1
  431. package/dist/web/hooks/use-send-follow-up-message.js +25 -2
  432. package/dist/web/hooks/use-send-follow-up-message.js.map +1 -1
  433. package/dist/web/hooks/use-set-open-in-app-url.d.ts +17 -0
  434. package/dist/web/hooks/use-set-open-in-app-url.js +17 -0
  435. package/dist/web/hooks/use-set-open-in-app-url.js.map +1 -1
  436. package/dist/web/hooks/use-set-open-in-app-url.test.js +26 -12
  437. package/dist/web/hooks/use-set-open-in-app-url.test.js.map +1 -1
  438. package/dist/web/hooks/use-tool-info.d.ts +46 -14
  439. package/dist/web/hooks/use-tool-info.js +29 -7
  440. package/dist/web/hooks/use-tool-info.js.map +1 -1
  441. package/dist/web/hooks/use-tool-info.test-d.js +11 -34
  442. package/dist/web/hooks/use-tool-info.test-d.js.map +1 -1
  443. package/dist/web/hooks/use-tool-info.test.js +42 -37
  444. package/dist/web/hooks/use-tool-info.test.js.map +1 -1
  445. package/dist/web/hooks/use-user.d.ts +5 -2
  446. package/dist/web/hooks/use-user.js +6 -3
  447. package/dist/web/hooks/use-user.js.map +1 -1
  448. package/dist/web/hooks/use-user.test.js +85 -37
  449. package/dist/web/hooks/use-user.test.js.map +1 -1
  450. package/dist/web/hooks/use-view-state.d.ts +25 -0
  451. package/dist/web/hooks/use-view-state.js +42 -0
  452. package/dist/web/hooks/use-view-state.js.map +1 -0
  453. package/dist/web/hooks/use-view-state.test.d.ts +1 -0
  454. package/dist/web/hooks/{use-widget-state.test.js → use-view-state.test.js} +56 -21
  455. package/dist/web/hooks/use-view-state.test.js.map +1 -0
  456. package/dist/web/hooks/use-viewport.d.ts +20 -0
  457. package/dist/web/hooks/use-viewport.js +21 -0
  458. package/dist/web/hooks/use-viewport.js.map +1 -0
  459. package/dist/web/hooks/use-viewport.test.d.ts +1 -0
  460. package/dist/web/hooks/use-viewport.test.js +109 -0
  461. package/dist/web/hooks/use-viewport.test.js.map +1 -0
  462. package/dist/web/index.d.ts +1 -3
  463. package/dist/web/index.js +1 -2
  464. package/dist/web/index.js.map +1 -1
  465. package/dist/web/mount-view.d.ts +21 -0
  466. package/dist/web/mount-view.js +43 -0
  467. package/dist/web/mount-view.js.map +1 -0
  468. package/dist/web/proxy.js.map +1 -1
  469. package/dist/web/types.d.ts +4 -0
  470. package/dist/web/types.js.map +1 -1
  471. package/package.json +46 -28
  472. package/dist/server/templates/development.hbs +0 -12
  473. package/dist/server/templates/production.hbs +0 -6
  474. package/dist/web/bridges/apps-sdk/adaptor.d.ts +0 -24
  475. package/dist/web/bridges/apps-sdk/adaptor.js +0 -87
  476. package/dist/web/bridges/apps-sdk/adaptor.js.map +0 -1
  477. package/dist/web/bridges/mcp-app/adaptor.d.ts +0 -48
  478. package/dist/web/bridges/mcp-app/adaptor.js +0 -268
  479. package/dist/web/bridges/mcp-app/adaptor.js.map +0 -1
  480. package/dist/web/hooks/use-layout.d.ts +0 -22
  481. package/dist/web/hooks/use-layout.js +0 -23
  482. package/dist/web/hooks/use-layout.js.map +0 -1
  483. package/dist/web/hooks/use-layout.test.js +0 -96
  484. package/dist/web/hooks/use-layout.test.js.map +0 -1
  485. package/dist/web/hooks/use-widget-state.d.ts +0 -4
  486. package/dist/web/hooks/use-widget-state.js +0 -32
  487. package/dist/web/hooks/use-widget-state.js.map +0 -1
  488. package/dist/web/hooks/use-widget-state.test.js.map +0 -1
  489. package/dist/web/mount-widget.d.ts +0 -1
  490. package/dist/web/mount-widget.js +0 -27
  491. package/dist/web/mount-widget.js.map +0 -1
  492. package/dist/web/plugin/data-llm.test.js +0 -81
  493. package/dist/web/plugin/data-llm.test.js.map +0 -1
  494. package/dist/web/plugin/plugin.d.ts +0 -5
  495. package/dist/web/plugin/plugin.js +0 -141
  496. package/dist/web/plugin/plugin.js.map +0 -1
  497. package/dist/web/plugin/scan-views.js.map +0 -1
  498. package/dist/web/plugin/scan-views.test.js.map +0 -1
  499. package/dist/web/plugin/transform-data-llm.d.ts +0 -12
  500. package/dist/web/plugin/transform-data-llm.js +0 -96
  501. package/dist/web/plugin/transform-data-llm.js.map +0 -1
  502. package/dist/web/plugin/transform-data-llm.test.js +0 -81
  503. package/dist/web/plugin/transform-data-llm.test.js.map +0 -1
  504. package/dist/web/plugin/validate-view.d.ts +0 -1
  505. package/dist/web/plugin/validate-view.js.map +0 -1
  506. package/dist/web/plugin/validate-view.test.js.map +0 -1
  507. /package/dist/{web/hooks/use-layout.test.d.ts → cli/build-helpers.test.d.ts} +0 -0
  508. /package/dist/{web/hooks/use-widget-state.test.d.ts → cli/build-steps.test.d.ts} +0 -0
  509. /package/dist/{web/plugin/data-llm.test.d.ts → cli/tunnel-control-server.test.d.ts} +0 -0
  510. /package/dist/{web/plugin/scan-views.test.d.ts → cli/tunnel-handler.test.d.ts} +0 -0
  511. /package/dist/{web/plugin/transform-data-llm.test.d.ts → cli/tunnel.test.d.ts} +0 -0
  512. /package/dist/{web/plugin/validate-view.test.d.ts → context-warnings.test.d.ts} +0 -0
  513. /package/dist/{web/plugin → views}/validate-view.test.js +0 -0
@@ -3,10 +3,15 @@ import { Command, Flags } from "@oclif/core";
3
3
  import { Box, render, Text } from "ink";
4
4
  import { resolvePort } from "../cli/detect-port.js";
5
5
  import { Header } from "../cli/header.js";
6
+ import { resolveSkybridgeConfig } from "../cli/resolve-skybridge-config.js";
7
+ import { runPlain } from "../cli/run-plain.js";
8
+ import { startTunnelControlServer } from "../cli/tunnel-control-server.js";
6
9
  import { useMessages } from "../cli/use-messages.js";
7
- import { useNodemon } from "../cli/use-nodemon.js";
10
+ import { CRASH_MESSAGE, useNodemon } from "../cli/use-nodemon.js";
11
+ import { useOpenBrowser } from "../cli/use-open-browser.js";
8
12
  import { useTunnel } from "../cli/use-tunnel.js";
9
13
  import { useTypeScriptCheck } from "../cli/use-typescript-check.js";
14
+ import { scanAndWriteViewsDts } from "../views/index.js";
10
15
  export default class Dev extends Command {
11
16
  static description = "Start development server";
12
17
  static examples = ["skybridge"];
@@ -20,30 +25,104 @@ export default class Dev extends Command {
20
25
  description: "Open an Alpic tunnel for remote testing",
21
26
  default: false,
22
27
  }),
28
+ open: Flags.boolean({
29
+ description: "Open DevTools in the browser when the server is ready",
30
+ default: process.env.SKYBRIDGE_OPEN !== "false",
31
+ allowNo: true,
32
+ }),
23
33
  verbose: Flags.boolean({
24
34
  char: "v",
25
35
  description: "Show tunnel logs",
26
36
  default: false,
27
37
  }),
38
+ plain: Flags.boolean({
39
+ description: "Disable the interactive UI and stream raw server logs to stdout, so you can pipe them through a formatter (e.g. `skybridge dev --plain | bunyan`).",
40
+ default: false,
41
+ }),
28
42
  };
29
43
  async run() {
30
44
  const { flags } = await this.parse(Dev);
45
+ // Generate .skybridge/views.d.ts before render() spawns `tsc --noEmit
46
+ // --watch`. Vite's plugin config hook writes the same file when nodemon
47
+ // boots the server, but tsc starts in parallel — if .skybridge/ doesn't
48
+ // exist at tsc startup, its watcher never picks up the late-created file
49
+ // and the dev UI reports phantom TS errors forever.
50
+ const root = process.cwd();
51
+ try {
52
+ scanAndWriteViewsDts(root, (await resolveSkybridgeConfig(root)).viewsDir);
53
+ }
54
+ catch {
55
+ // Best-effort: if the scan fails (e.g. broken vite config, duplicate
56
+ // view names) tsc may show phantom errors, but the dev server should
57
+ // still start so the developer can fix the underlying issue.
58
+ }
31
59
  const { port, fallback, envWarning } = await resolvePort(flags.port);
32
60
  if (envWarning) {
33
61
  this.warn(envWarning);
34
62
  }
63
+ const { port: controlPort, manager: tunnelManager, close: closeTunnelControl, } = await startTunnelControlServer(() => port);
35
64
  const env = {
36
65
  ...process.env,
37
66
  __PORT: String(port),
67
+ __TUNNEL_CONTROL_PORT: String(controlPort),
38
68
  };
69
+ if (flags.plain) {
70
+ const teardown = runPlain({
71
+ env,
72
+ port,
73
+ fallback,
74
+ version: this.config.version,
75
+ tunnel: flags.tunnel,
76
+ tunnelManager,
77
+ });
78
+ // Synchronous-first shutdown: kill the alpic subprocess up front so we
79
+ // can't leave it orphaned even if another SIGINT listener (e.g.
80
+ // nodemon's) exits the process before our async cleanup completes.
81
+ const shutdown = (code) => () => {
82
+ tunnelManager.stop();
83
+ teardown();
84
+ void closeTunnelControl()
85
+ .catch((err) => {
86
+ console.error("Failed to close tunnel control server", err);
87
+ })
88
+ .finally(() => {
89
+ process.exit(code);
90
+ });
91
+ };
92
+ process.once("SIGINT", shutdown(130));
93
+ process.once("SIGTERM", shutdown(143));
94
+ return;
95
+ }
39
96
  const App = () => {
40
97
  const tsErrors = useTypeScriptCheck();
41
98
  const [messages, pushMessage] = useMessages();
42
- useNodemon(env, pushMessage);
43
- const tunnelState = useTunnel(flags.tunnel ? port : null, pushMessage, flags.verbose);
44
- return (_jsxs(Box, { flexDirection: "column", padding: 1, marginLeft: 1, children: [_jsx(Header, { version: this.config.version }), _jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDFE0", " "] }), fallback ? (_jsx(Text, { color: "yellow", children: "3000 in use, running on " })) : (_jsx(Text, { children: "Running on " })), _jsx(Text, { color: "green", children: `http://localhost:${port}/mcp` })] }), _jsxs(Box, { marginBottom: 1, children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsxs(Text, { color: "white", bold: true, children: ["Test locally with DevTools:", " "] }), _jsx(Text, { color: "green", children: `http://localhost:${port}/` })] }), tunnelState.status === "idle" && (_jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDF0D", " "] }), _jsx(Text, { children: "Get a public URL and LLM Playground access with " }), _jsx(Text, { color: "cyan", bold: true, children: "--tunnel" }), _jsx(Text, { children: "." })] })), tunnelState.status === "starting" && (_jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDF0D", " "] }), _jsx(Text, { color: "yellow", children: tunnelState.message })] })), tunnelState.status === "connected" && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDF0D", " "] }), _jsx(Text, { children: "Exposed on " }), _jsx(Text, { color: "green", children: `${tunnelState.url}/mcp` })] }), _jsxs(Box, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsxs(Text, { color: "white", bold: true, children: ["Test with an LLM on Playground:", " "] }), _jsx(Text, { color: "green", children: `${tunnelState.url}/try` })] })] })), tunnelState.status === "error" && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDF0D", " "] }), _jsxs(Text, { color: "red", children: ["Cannot open tunnel: ", tunnelState.message] })] }), _jsxs(Box, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { color: "red", children: `Try manually: npx alpic tunnel --port ${port}` })] })] })), _jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83D\uDEDF", " "] }), _jsx(Text, { children: "Need help? Reach us on " }), _jsx(Text, { color: "white", underline: true, children: "https://discord.alpic.ai" })] }), 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) => (_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.id)))] }))] }));
99
+ const crashed = useNodemon(env, pushMessage);
100
+ useOpenBrowser(port, flags.open);
101
+ const tunnelState = useTunnel(port, pushMessage, flags.verbose, flags.tunnel);
102
+ return (_jsxs(Box, { flexDirection: "column", padding: 1, marginLeft: 1, children: [_jsx(Header, { version: this.config.version }), crashed ? (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "red", children: CRASH_MESSAGE }) })) : (_jsxs(_Fragment, { children: [_jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDFE0", " "] }), fallback ? (_jsx(Text, { color: "yellow", children: "3000 in use, running on " })) : (_jsx(Text, { children: "Running on " })), _jsx(Text, { color: "green", children: `http://localhost:${port}/mcp` })] }), _jsxs(Box, { marginBottom: 1, children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsxs(Text, { color: "white", bold: true, children: ["Test locally with DevTools:", " "] }), _jsx(Text, { color: "green", children: `http://localhost:${port}/` })] })] })), tunnelState.status === "idle" && (_jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDF0D", " "] }), _jsx(Text, { children: "Get a public URL and LLM Playground access with " }), _jsx(Text, { color: "cyan", bold: true, children: "--tunnel" }), _jsx(Text, { children: "." })] })), tunnelState.status === "starting" && (_jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDF0D", " "] }), _jsx(Text, { color: "yellow", children: tunnelState.message })] })), tunnelState.status === "connected" && !crashed && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDF0D", " "] }), _jsx(Text, { children: "Exposed on " }), _jsx(Text, { color: "green", children: `${tunnelState.url}/mcp` })] }), _jsxs(Box, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsxs(Text, { color: "white", bold: true, children: ["Test with an LLM on Playground:", " "] }), _jsx(Text, { color: "green", children: `${tunnelState.url}/try` })] })] })), tunnelState.status === "error" && (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83C\uDF0D", " "] }), _jsxs(Text, { color: "red", children: ["Cannot open tunnel: ", tunnelState.message] })] }), _jsxs(Box, { children: [_jsxs(Text, { color: "#20a832", children: ["\u2192", " "] }), _jsx(Text, { color: "red", children: `Try manually: npx alpic tunnel --port ${port}` })] })] })), _jsxs(Box, { children: [_jsxs(Text, { children: ["\uD83D\uDEDF", " "] }), _jsx(Text, { children: "Need help? Reach us on " }), _jsx(Text, { color: "white", underline: true, children: "https://discord.alpic.ai" })] }), 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) => (_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.id)))] }))] }));
103
+ };
104
+ // Note: `exitOnCtrlC: false` because we own SIGINT below to guarantee
105
+ // alpic gets killed before we exit. If anything ever calls `useInput` or
106
+ // puts stdin into raw mode, also wire an explicit `\x03` keypress to the
107
+ // shutdown function — Ink will otherwise swallow Ctrl-C without ever
108
+ // delivering SIGINT.
109
+ const ink = render(_jsx(App, {}), { exitOnCtrlC: false, patchConsole: true });
110
+ // Synchronous-first shutdown: kill the alpic subprocess up front so we
111
+ // can't leave it orphaned even if another SIGINT listener (e.g. nodemon's)
112
+ // exits the process before our async cleanup completes.
113
+ const shutdown = (code) => () => {
114
+ tunnelManager.stop();
115
+ void closeTunnelControl()
116
+ .catch((err) => {
117
+ console.error("Failed to close tunnel control server", err);
118
+ })
119
+ .finally(() => {
120
+ ink.unmount();
121
+ process.exit(code);
122
+ });
45
123
  };
46
- render(_jsx(App, {}), { exitOnCtrlC: true, patchConsole: true });
124
+ process.once("SIGINT", shutdown(130));
125
+ process.once("SIGTERM", shutdown(143));
47
126
  }
48
127
  }
49
128
  //# sourceMappingURL=dev.js.map
@@ -1 +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,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;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CAAC,CAAC;YAC9D,CAAC,CAAC;iBACD,OAAO,CAAC,GAAG,EAAE;gBACZ,GAAG,CAAC,OAAO,EAAE,CAAC;gBACd,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACrB,CAAC,CAAC,CAAC;QACP,CAAC,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IACzC,CAAC","sourcesContent":["import { Command, Flags } from \"@oclif/core\";\nimport { Box, render, Text } from \"ink\";\nimport { resolvePort } from \"../cli/detect-port.js\";\nimport { Header } from \"../cli/header.js\";\nimport { resolveSkybridgeConfig } from \"../cli/resolve-skybridge-config.js\";\nimport { runPlain } from \"../cli/run-plain.js\";\nimport { startTunnelControlServer } from \"../cli/tunnel-control-server.js\";\nimport { useMessages } from \"../cli/use-messages.js\";\nimport { CRASH_MESSAGE, useNodemon } from \"../cli/use-nodemon.js\";\nimport { useOpenBrowser } from \"../cli/use-open-browser.js\";\nimport { useTunnel } from \"../cli/use-tunnel.js\";\nimport { useTypeScriptCheck } from \"../cli/use-typescript-check.js\";\nimport { scanAndWriteViewsDts } from \"../views/index.js\";\n\nexport default class Dev extends Command {\n static override description = \"Start development server\";\n static override examples = [\"skybridge\"];\n static override flags = {\n port: Flags.integer({\n char: \"p\",\n description: \"Port to run the server on\",\n min: 1,\n }),\n tunnel: Flags.boolean({\n description: \"Open an Alpic tunnel for remote testing\",\n default: false,\n }),\n open: Flags.boolean({\n description: \"Open DevTools in the browser when the server is ready\",\n default: process.env.SKYBRIDGE_OPEN !== \"false\",\n allowNo: true,\n }),\n verbose: Flags.boolean({\n char: \"v\",\n description: \"Show tunnel logs\",\n default: false,\n }),\n plain: Flags.boolean({\n description:\n \"Disable the interactive UI and stream raw server logs to stdout, so you can pipe them through a formatter (e.g. `skybridge dev --plain | bunyan`).\",\n default: false,\n }),\n };\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(Dev);\n\n // Generate .skybridge/views.d.ts before render() spawns `tsc --noEmit\n // --watch`. Vite's plugin config hook writes the same file when nodemon\n // boots the server, but tsc starts in parallel — if .skybridge/ doesn't\n // exist at tsc startup, its watcher never picks up the late-created file\n // and the dev UI reports phantom TS errors forever.\n const root = process.cwd();\n try {\n scanAndWriteViewsDts(root, (await resolveSkybridgeConfig(root)).viewsDir);\n } catch {\n // Best-effort: if the scan fails (e.g. broken vite config, duplicate\n // view names) tsc may show phantom errors, but the dev server should\n // still start so the developer can fix the underlying issue.\n }\n\n const { port, fallback, envWarning } = await resolvePort(flags.port);\n if (envWarning) {\n this.warn(envWarning);\n }\n\n const {\n port: controlPort,\n manager: tunnelManager,\n close: closeTunnelControl,\n } = await startTunnelControlServer(() => port);\n\n const env = {\n ...process.env,\n __PORT: String(port),\n __TUNNEL_CONTROL_PORT: String(controlPort),\n };\n\n if (flags.plain) {\n const teardown = runPlain({\n env,\n port,\n fallback,\n version: this.config.version,\n tunnel: flags.tunnel,\n tunnelManager,\n });\n\n // Synchronous-first shutdown: kill the alpic subprocess up front so we\n // can't leave it orphaned even if another SIGINT listener (e.g.\n // nodemon's) exits the process before our async cleanup completes.\n const shutdown = (code: number) => () => {\n tunnelManager.stop();\n teardown();\n void closeTunnelControl()\n .catch((err) => {\n console.error(\"Failed to close tunnel control server\", err);\n })\n .finally(() => {\n process.exit(code);\n });\n };\n process.once(\"SIGINT\", shutdown(130));\n process.once(\"SIGTERM\", shutdown(143));\n return;\n }\n\n const App = () => {\n const tsErrors = useTypeScriptCheck();\n const [messages, pushMessage] = useMessages();\n const crashed = useNodemon(env, pushMessage);\n useOpenBrowser(port, flags.open);\n const tunnelState = useTunnel(\n port,\n pushMessage,\n flags.verbose,\n flags.tunnel,\n );\n\n return (\n <Box flexDirection=\"column\" padding={1} marginLeft={1}>\n <Header version={this.config.version} />\n\n {crashed ? (\n <Box marginBottom={1}>\n <Text color=\"red\">{CRASH_MESSAGE}</Text>\n </Box>\n ) : (\n <>\n <Box>\n <Text>🏠{\" \"}</Text>\n {fallback ? (\n <Text color=\"yellow\">3000 in use, running on </Text>\n ) : (\n <Text>Running on </Text>\n )}\n <Text color=\"green\">{`http://localhost:${port}/mcp`}</Text>\n </Box>\n <Box marginBottom={1}>\n <Text color=\"#20a832\">→{\" \"}</Text>\n <Text color=\"white\" bold>\n Test locally with DevTools:{\" \"}\n </Text>\n <Text color=\"green\">{`http://localhost:${port}/`}</Text>\n </Box>\n </>\n )}\n\n {tunnelState.status === \"idle\" && (\n <Box>\n <Text>🌍{\" \"}</Text>\n <Text>Get a public URL and LLM Playground access with </Text>\n <Text color=\"cyan\" bold>\n --tunnel\n </Text>\n <Text>.</Text>\n </Box>\n )}\n {tunnelState.status === \"starting\" && (\n <Box>\n <Text>🌍{\" \"}</Text>\n <Text color=\"yellow\">{tunnelState.message}</Text>\n </Box>\n )}\n {tunnelState.status === \"connected\" && !crashed && (\n <Box flexDirection=\"column\" marginBottom={1}>\n <Box>\n <Text>🌍{\" \"}</Text>\n <Text>Exposed on </Text>\n <Text color=\"green\">{`${tunnelState.url}/mcp`}</Text>\n </Box>\n <Box>\n <Text color=\"#20a832\">→{\" \"}</Text>\n <Text color=\"white\" bold>\n Test with an LLM on Playground:{\" \"}\n </Text>\n <Text color=\"green\">{`${tunnelState.url}/try`}</Text>\n </Box>\n </Box>\n )}\n {tunnelState.status === \"error\" && (\n <Box flexDirection=\"column\" marginBottom={1}>\n <Box>\n <Text>🌍{\" \"}</Text>\n <Text color=\"red\">\n Cannot open tunnel: {tunnelState.message}\n </Text>\n </Box>\n <Box>\n <Text color=\"#20a832\">→{\" \"}</Text>\n <Text color=\"red\">{`Try manually: npx alpic tunnel --port ${port}`}</Text>\n </Box>\n </Box>\n )}\n\n <Box>\n <Text>🛟{\" \"}</Text>\n <Text>Need help? Reach us on </Text>\n <Text color=\"white\" underline>\n https://discord.alpic.ai\n </Text>\n </Box>\n\n {tsErrors.length > 0 && (\n <Box marginTop={1} flexDirection=\"column\">\n <Text color=\"red\" bold>\n ⚠️ TypeScript errors found:\n </Text>\n {tsErrors.map((error) => (\n <Box\n key={`${error.file}:${error.line}:${error.col}`}\n marginLeft={2}\n flexDirection=\"column\"\n >\n <Box>\n <Text color=\"white\">{error.file}</Text>\n <Text color=\"grey\">\n ({error.line},{error.col}):{\" \"}\n </Text>\n </Box>\n <Box marginLeft={2}>\n <Text color=\"red\">{error.message}</Text>\n </Box>\n </Box>\n ))}\n </Box>\n )}\n {messages.length > 0 && (\n <Box marginTop={1} flexDirection=\"column\">\n <Text color=\"white\" bold>\n Logs:\n </Text>\n {messages.map((message) => (\n <Box key={message.id} marginLeft={2}>\n {message.type === \"restart\" ? (\n <>\n <Text color=\"green\">✓{\" \"}</Text>\n <Text color=\"white\">{message.text}</Text>\n </>\n ) : message.type === \"error\" ? (\n <Text color=\"red\">{message.text}</Text>\n ) : (\n <Text>{message.text}</Text>\n )}\n </Box>\n ))}\n </Box>\n )}\n </Box>\n );\n };\n\n // Note: `exitOnCtrlC: false` because we own SIGINT below to guarantee\n // alpic gets killed before we exit. If anything ever calls `useInput` or\n // puts stdin into raw mode, also wire an explicit `\\x03` keypress to the\n // shutdown function — Ink will otherwise swallow Ctrl-C without ever\n // delivering SIGINT.\n const ink = render(<App />, { exitOnCtrlC: false, patchConsole: true });\n\n // Synchronous-first shutdown: kill the alpic subprocess up front so we\n // can't leave it orphaned even if another SIGINT listener (e.g. nodemon's)\n // exits the process before our async cleanup completes.\n const shutdown = (code: number) => () => {\n tunnelManager.stop();\n void closeTunnelControl()\n .catch((err) => {\n console.error(\"Failed to close tunnel control server\", err);\n })\n .finally(() => {\n ink.unmount();\n process.exit(code);\n });\n };\n process.once(\"SIGINT\", shutdown(130));\n process.once(\"SIGTERM\", shutdown(143));\n }\n}\n"]}
@@ -20,7 +20,13 @@ export default class Start extends Command {
20
20
  this.warn(envWarning);
21
21
  }
22
22
  console.clear();
23
- const indexPath = resolve(process.cwd(), "dist/server.js");
23
+ // `dist/index.js` is the natural entry (the user's `await app.run()`
24
+ // binds the port). Prefer `dist/__entry.js` when present because it
25
+ // primes the Vite manifest first — without it, hashed asset URLs in
26
+ // views won't resolve.
27
+ const entryPath = resolve(process.cwd(), "dist/__entry.js");
28
+ const fallbackPath = resolve(process.cwd(), "dist/index.js");
29
+ const indexPath = existsSync(entryPath) ? entryPath : fallbackPath;
24
30
  if (!existsSync(indexPath)) {
25
31
  console.error("❌ Error: No build output found");
26
32
  console.error("");
@@ -1 +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,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AACpD,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;QACtB,IAAI,EAAE,KAAK,CAAC,OAAO,CAAC;YAClB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,2BAA2B;YACxC,GAAG,EAAE,CAAC;SACP,CAAC;KACH,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1C,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC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AAS,CAAC,EAAE,CAAC;YAC3B,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAChD,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,8CAA8C,IAAI,CAAC,MAAM,CAAC,OAAO,SAAS,CAC3E,CAAC;QACF,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,CAAC,GAAG,CACT,mEAAmE,IAAI,aAAa,CACrF,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,GAAG,CAAC,uCAAuC,IAAI,aAAa,CAAC,CAAC;QACxE,CAAC;QAED,MAAM,UAAU,CAAC,QAAQ,SAAS,EAAE,EAAE;YACpC,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAC;YACvC,GAAG,EAAE;gBACH,GAAG,OAAO,CAAC,GAAG;gBACd,QAAQ,EAAE,YAAY;gBACtB,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC;aACrB;SACF,CAAC,CAAC;IACL,CAAC","sourcesContent":["import { existsSync } from \"node:fs\";\nimport { resolve } from \"node:path\";\nimport { Command, Flags } from \"@oclif/core\";\nimport { resolvePort } from \"../cli/detect-port.js\";\nimport { runCommand } from \"../cli/run-command.js\";\n\nexport default class Start extends Command {\n static override description = \"Start production server\";\n static override examples = [\"skybridge start\"];\n static override flags = {\n port: Flags.integer({\n char: \"p\",\n description: \"Port to run the server on\",\n min: 1,\n }),\n };\n\n public async run(): Promise<void> {\n const { flags } = await this.parse(Start);\n const { port, fallback, envWarning } = await resolvePort(flags.port);\n if (envWarning) {\n this.warn(envWarning);\n }\n\n console.clear();\n\n // `dist/index.js` is the natural entry (the user's `await app.run()`\n // binds the port). Prefer `dist/__entry.js` when present because it\n // primes the Vite manifest first — without it, hashed asset URLs in\n // views won't resolve.\n const entryPath = resolve(process.cwd(), \"dist/__entry.js\");\n const fallbackPath = resolve(process.cwd(), \"dist/index.js\");\n const indexPath = existsSync(entryPath) ? entryPath : fallbackPath;\n\n if (!existsSync(indexPath)) {\n console.error(\"❌ Error: No build output found\");\n console.error(\"\");\n console.error(\"Please build your project first:\");\n console.error(\" skybridge build\");\n console.error(\"\");\n process.exit(1);\n }\n\n console.log(\n `\\x1b[36m\\x1b[1m⛰ Skybridge\\x1b[0m \\x1b[36mv${this.config.version}\\x1b[0m`,\n );\n if (fallback) {\n console.log(\n `\\x1b[33m3000 in use, running on\\x1b[0m \\x1b[32mhttp://localhost:${port}/mcp\\x1b[0m`,\n );\n } else {\n console.log(`Running on \\x1b[32mhttp://localhost:${port}/mcp\\x1b[0m`);\n }\n\n await runCommand(`node ${indexPath}`, {\n stdio: [\"ignore\", \"inherit\", \"inherit\"],\n env: {\n ...process.env,\n NODE_ENV: \"production\",\n __PORT: String(port),\n },\n });\n }\n}\n"]}
@@ -1 +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,GAA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I,+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","sourcesContent":["import { Command } from \"@oclif/core\";\nimport { Box, render, Text } from \"ink\";\nimport { setEnabled } from \"../../cli/telemetry.js\";\n\nexport default class TelemetryDisable extends Command {\n static override description = \"Disable Skybridge telemetry on this machine\";\n\n public async run(): Promise<void> {\n await this.parse(TelemetryDisable);\n setEnabled(false);\n\n const App = () => (\n <Box flexDirection=\"column\" padding={1}>\n <Box>\n <Text color=\"yellow\">✓</Text>\n <Text> Telemetry has been </Text>\n <Text color=\"yellow\" bold>\n disabled\n </Text>\n </Box>\n <Box marginTop={1}>\n <Text color=\"gray\">Config saved to ~/.skybridge/config.json</Text>\n </Box>\n <Box marginTop={1}>\n <Text color=\"gray\">\n Skybridge never collects Personally Identifiable Information (PII).\n If you'd like to help us improve Skybridge by allowing anonymous CLI\n usage data, please reenable telemetry with: skybridge telemetry\n enable\n </Text>\n </Box>\n </Box>\n );\n\n render(<App />);\n }\n}\n"]}
@@ -1 +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;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AC,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","sourcesContent":["import { Command } from \"@oclif/core\";\nimport { Box, render, Text } from \"ink\";\nimport { setEnabled } from \"../../cli/telemetry.js\";\n\nexport default class TelemetryEnable extends Command {\n static override description = \"Enable Skybridge telemetry on this machine\";\n\n public async run(): Promise<void> {\n await this.parse(TelemetryEnable);\n setEnabled(true);\n\n const App = () => (\n <Box flexDirection=\"column\" padding={1}>\n <Box>\n <Text color=\"green\">✓</Text>\n <Text> Telemetry has been </Text>\n <Text color=\"green\" bold>\n enabled\n </Text>\n </Box>\n <Box marginTop={1}>\n <Text color=\"gray\">Config saved to ~/.skybridge/config.json</Text>\n </Box>\n </Box>\n );\n\n render(<App />);\n }\n}\n"]}
@@ -1 +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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M,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","sourcesContent":["import { Command } from \"@oclif/core\";\nimport { Box, render, Text } from \"ink\";\nimport { getMachineId, isEnabled } from \"../../cli/telemetry.js\";\n\nexport default class TelemetryStatus extends Command {\n static override description =\n \"Get Skybridge current telemetry settings for this machine\";\n\n public async run(): Promise<void> {\n await this.parse(TelemetryStatus);\n const enabled = isEnabled();\n\n const App = () => (\n <Box flexDirection=\"column\" padding={1}>\n <Text bold underline>\n Skybridge Telemetry\n </Text>\n\n <Box marginTop={1} flexDirection=\"column\">\n <Box>\n <Text>Status: </Text>\n {enabled ? (\n <Text color=\"green\" bold>\n Enabled\n </Text>\n ) : (\n <Text color=\"yellow\" bold>\n Disabled\n </Text>\n )}\n </Box>\n\n <Box marginTop={1}>\n <Text color=\"gray\">Machine ID: </Text>\n <Text>{getMachineId()}</Text>\n </Box>\n </Box>\n\n <Box marginTop={1} flexDirection=\"column\">\n <Text color=\"gray\">To opt out, run: skybridge telemetry disable</Text>\n <Text color=\"gray\">Or set: SKYBRIDGE_TELEMETRY_DISABLED=1</Text>\n <Text color=\"gray\">Debug mode: SKYBRIDGE_TELEMETRY_DEBUG=1</Text>\n </Box>\n </Box>\n );\n\n render(<App />);\n }\n}\n"]}
@@ -0,0 +1,5 @@
1
+ export declare const TOOL_OUTPUT_WARNING_TOKENS = 5000;
2
+ export declare const VIEW_STATE_WARNING_TOKENS = 20000;
3
+ export declare function estimateContextTokens(value: unknown): number;
4
+ export declare function warnOnLargeToolOutput(result: unknown, toolName: string): void;
5
+ export declare function warnOnLargeViewState(value: unknown, source: string): void;
@@ -0,0 +1,31 @@
1
+ export const TOOL_OUTPUT_WARNING_TOKENS = 5_000;
2
+ export const VIEW_STATE_WARNING_TOKENS = 20_000;
3
+ export function estimateContextTokens(value) {
4
+ try {
5
+ const serialized = JSON.stringify(value);
6
+ if (!serialized) {
7
+ return 0;
8
+ }
9
+ return Math.ceil(new TextEncoder().encode(serialized).length / 4);
10
+ }
11
+ catch {
12
+ return 0;
13
+ }
14
+ }
15
+ export function warnOnLargeToolOutput(result, toolName) {
16
+ if (!result || typeof result !== "object" || Array.isArray(result)) {
17
+ return;
18
+ }
19
+ const { _meta, ...modelVisibleResult } = result;
20
+ const tokenCount = estimateContextTokens(modelVisibleResult);
21
+ if (tokenCount >= TOOL_OUTPUT_WARNING_TOKENS) {
22
+ console.warn(`[skybridge] Tool "${toolName}" returned ${tokenCount} estimated model-visible tokens; this reaches the ${TOOL_OUTPUT_WARNING_TOKENS}-token warning threshold and may overload model context. Content and structured content are included in this estimate.`);
23
+ }
24
+ }
25
+ export function warnOnLargeViewState(value, source) {
26
+ const tokenCount = estimateContextTokens(value);
27
+ if (tokenCount >= VIEW_STATE_WARNING_TOKENS) {
28
+ console.warn(`[skybridge] ${source} is persisting ${tokenCount} estimated tokens in model-visible view state; this reaches the ${VIEW_STATE_WARNING_TOKENS}-token warning threshold and may overload model context. Persisted view state and data-llm context are included in this estimate.`);
29
+ }
30
+ }
31
+ //# sourceMappingURL=context-warnings.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-warnings.js","sourceRoot":"","sources":["../src/context-warnings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,0BAA0B,GAAG,KAAK,CAAC;AAChD,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEhD,MAAM,UAAU,qBAAqB,CAAC,KAAc;IAClD,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,UAAU,EAAE,CAAC;YAChB,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IACpE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,CAAC,CAAC;IACX,CAAC;AACH,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAe,EAAE,QAAgB;IACrE,IAAI,CAAC,MAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QACnE,OAAO;IACT,CAAC;IACD,MAAM,EAAE,KAAK,EAAE,GAAG,kBAAkB,EAAE,GAAG,MAAiC,CAAC;IAC3E,MAAM,UAAU,GAAG,qBAAqB,CAAC,kBAAkB,CAAC,CAAC;IAC7D,IAAI,UAAU,IAAI,0BAA0B,EAAE,CAAC;QAC7C,OAAO,CAAC,IAAI,CACV,qBAAqB,QAAQ,cAAc,UAAU,qDAAqD,0BAA0B,wHAAwH,CAC7P,CAAC;IACJ,CAAC;AACH,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAc,EAAE,MAAc;IACjE,MAAM,UAAU,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,UAAU,IAAI,yBAAyB,EAAE,CAAC;QAC5C,OAAO,CAAC,IAAI,CACV,eAAe,MAAM,kBAAkB,UAAU,mEAAmE,yBAAyB,mIAAmI,CACjR,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["export const TOOL_OUTPUT_WARNING_TOKENS = 5_000;\nexport const VIEW_STATE_WARNING_TOKENS = 20_000;\n\nexport function estimateContextTokens(value: unknown): number {\n try {\n const serialized = JSON.stringify(value);\n if (!serialized) {\n return 0;\n }\n return Math.ceil(new TextEncoder().encode(serialized).length / 4);\n } catch {\n return 0;\n }\n}\n\nexport function warnOnLargeToolOutput(result: unknown, toolName: string): void {\n if (!result || typeof result !== \"object\" || Array.isArray(result)) {\n return;\n }\n const { _meta, ...modelVisibleResult } = result as Record<string, unknown>;\n const tokenCount = estimateContextTokens(modelVisibleResult);\n if (tokenCount >= TOOL_OUTPUT_WARNING_TOKENS) {\n console.warn(\n `[skybridge] Tool \"${toolName}\" returned ${tokenCount} estimated model-visible tokens; this reaches the ${TOOL_OUTPUT_WARNING_TOKENS}-token warning threshold and may overload model context. Content and structured content are included in this estimate.`,\n );\n }\n}\n\nexport function warnOnLargeViewState(value: unknown, source: string): void {\n const tokenCount = estimateContextTokens(value);\n if (tokenCount >= VIEW_STATE_WARNING_TOKENS) {\n console.warn(\n `[skybridge] ${source} is persisting ${tokenCount} estimated tokens in model-visible view state; this reaches the ${VIEW_STATE_WARNING_TOKENS}-token warning threshold and may overload model context. Persisted view state and data-llm context are included in this estimate.`,\n );\n }\n}\n"]}
@@ -0,0 +1,28 @@
1
+ import { describe, expect, it, vi } from "vitest";
2
+ import { estimateContextTokens, TOOL_OUTPUT_WARNING_TOKENS, warnOnLargeToolOutput, } from "./context-warnings.js";
3
+ describe("context warnings", () => {
4
+ it("estimates UTF-8 bytes and returns zero for no content", () => {
5
+ expect(estimateContextTokens("é")).toBe(1);
6
+ expect(estimateContextTokens(undefined)).toBe(0);
7
+ });
8
+ it("warns when model-visible tool output reaches the threshold", () => {
9
+ const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => { });
10
+ warnOnLargeToolOutput({
11
+ content: [
12
+ {
13
+ type: "text",
14
+ text: "x".repeat(TOOL_OUTPUT_WARNING_TOKENS * 4),
15
+ },
16
+ ],
17
+ }, "large-output");
18
+ expect(warnSpy).toHaveBeenCalledWith(expect.stringContaining('Tool "large-output" returned'));
19
+ warnSpy.mockRestore();
20
+ });
21
+ it("does not warn for large metadata", () => {
22
+ const warnSpy = vi.spyOn(console, "warn").mockImplementation(() => { });
23
+ warnOnLargeToolOutput({ content: [], _meta: { private: "x".repeat(100_000) } }, "large-meta");
24
+ expect(warnSpy).not.toHaveBeenCalled();
25
+ warnSpy.mockRestore();
26
+ });
27
+ });
28
+ //# sourceMappingURL=context-warnings.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"context-warnings.test.js","sourceRoot":"","sources":["../src/context-warnings.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAClD,OAAO,EACL,qBAAqB,EACrB,0BAA0B,EAC1B,qBAAqB,GACtB,MAAM,uBAAuB,CAAC;AAE/B,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,EAAE,CAAC,uDAAuD,EAAE,GAAG,EAAE;QAC/D,MAAM,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAC3C,MAAM,CAAC,qBAAqB,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,GAAG,EAAE;QACpE,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAEvE,qBAAqB,CACnB;YACE,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,0BAA0B,GAAG,CAAC,CAAC;iBACjD;aACF;SACF,EACD,cAAc,CACf,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAClC,MAAM,CAAC,gBAAgB,CAAC,8BAA8B,CAAC,CACxD,CAAC;QACF,OAAO,CAAC,WAAW,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,kBAAkB,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;QAEvE,qBAAqB,CACnB,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,EAAE,EACxD,YAAY,CACb,CAAC;QAEF,MAAM,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;QACvC,OAAO,CAAC,WAAW,EAAE,CAAC;IACxB,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC","sourcesContent":["import { describe, expect, it, vi } from \"vitest\";\nimport {\n estimateContextTokens,\n TOOL_OUTPUT_WARNING_TOKENS,\n warnOnLargeToolOutput,\n} from \"./context-warnings.js\";\n\ndescribe(\"context warnings\", () => {\n it(\"estimates UTF-8 bytes and returns zero for no content\", () => {\n expect(estimateContextTokens(\"é\")).toBe(1);\n expect(estimateContextTokens(undefined)).toBe(0);\n });\n\n it(\"warns when model-visible tool output reaches the threshold\", () => {\n const warnSpy = vi.spyOn(console, \"warn\").mockImplementation(() => {});\n\n warnOnLargeToolOutput(\n {\n content: [\n {\n type: \"text\",\n text: \"x\".repeat(TOOL_OUTPUT_WARNING_TOKENS * 4),\n },\n ],\n },\n \"large-output\",\n );\n\n expect(warnSpy).toHaveBeenCalledWith(\n expect.stringContaining('Tool \"large-output\" returned'),\n );\n warnSpy.mockRestore();\n });\n\n it(\"does not warn for large metadata\", () => {\n const warnSpy = vi.spyOn(console, \"warn\").mockImplementation(() => {});\n\n warnOnLargeToolOutput(\n { content: [], _meta: { private: \"x\".repeat(100_000) } },\n \"large-meta\",\n );\n\n expect(warnSpy).not.toHaveBeenCalled();\n warnSpy.mockRestore();\n });\n});\n"]}
@@ -0,0 +1,211 @@
1
+ import type { Implementation, Server as SdkServer, ServerOptions } from "@modelcontextprotocol/server";
2
+ import type { ErrorRequestHandler, Express, RequestHandler } from "express";
3
+ import type { OAuthConfig, OAuthProvider } from "./auth/index.js";
4
+ import type { ExtraClaims } from "./auth.js";
5
+ import type { McpMiddlewareEntry } from "./middleware.js";
6
+ import { type JsonOptions, McpServer, type McpServerTypes, type ToolDef } from "./server.js";
7
+ /**
8
+ * The `handler` field of {@link SkybridgeConfig}: builds the app's MCP
9
+ * surface. Runs again for **every incoming request**, on a fresh
10
+ * {@link McpServer}, so keep it to registration: pools, clients and any other
11
+ * one-time work belong in `setup`, whose result is the second argument. It
12
+ * must **return** the chained server so `typeof app` carries the registered
13
+ * tool types.
14
+ *
15
+ * @typeParam TConfig - What `setup` resolved to, passed as the second argument.
16
+ */
17
+ export type SkybridgeHandler<TTools extends Record<string, ToolDef>, TConfig, TAuthExtra extends ExtraClaims> = (server: McpServer<Record<never, ToolDef>, TAuthExtra>, config: TConfig) => McpServer<TTools, TAuthExtra>;
18
+ /**
19
+ * What the `oauth` field accepts: an {@link OAuthConfig}, a provider
20
+ * (`oauth: auth0Provider(...)`), or a function of the `setup` result returning
21
+ * either. Providers and functions resolve once, at {@link Skybridge.run} or on
22
+ * the first request, never at module import. Anything asynchronous belongs in
23
+ * a provider's `resolve`.
24
+ */
25
+ export type SkybridgeOAuthInput<TConfig, TExtra extends ExtraClaims> = OAuthConfig<TExtra> | OAuthProvider<TExtra> | ((config: TConfig) => OAuthConfig<TExtra> | OAuthProvider<TExtra>);
26
+ /**
27
+ * Everything a Skybridge app needs in one bag: the MCP implementation info
28
+ * (`name`, `version`, …), the SDK's {@link ServerOptions} (`capabilities`,
29
+ * `instructions`, …), the Express and skills options, and the app's behavior
30
+ * (`setup`, `oauth`, `handler`).
31
+ *
32
+ * All type parameters are inferred from the value: the config from `setup`,
33
+ * the auth claims from `oauth`, and the tool registry from the server
34
+ * `handler` returns.
35
+ */
36
+ export type SkybridgeConfig<TTools extends Record<string, ToolDef> = Record<never, ToolDef>, TConfig = undefined, TAuthExtra extends ExtraClaims = ExtraClaims> = Implementation & ServerOptions & {
37
+ /** Options for the built-in `express.json()` middleware, e.g. `{ limit: "10mb" }`. */
38
+ json?: JsonOptions;
39
+ /**
40
+ * @experimental Serve Agent Skills from `src/skills` over MCP (SEP-2640).
41
+ * API may change.
42
+ */
43
+ skills?: boolean;
44
+ /**
45
+ * Replaces the error reporter of the built-in `/mcp` handler. Receives every
46
+ * error the MCP SDK handler or its Node adapter reports: rejected requests,
47
+ * including the `UnsupportedProtocolVersionError` the default skips, and
48
+ * failures to build or serve the per-request server. Reporting only: the
49
+ * response does not change. It can run before the response is sent, so keep
50
+ * it fast and synchronous. Default: `console.error` for every error the MCP
51
+ * SDK handler reports, except `UnsupportedProtocolVersionError`. Node
52
+ * adapter errors are not logged by default.
53
+ */
54
+ onMcpError?: (error: Error) => void;
55
+ /**
56
+ * Loads whatever the app needs up front (remote config, secrets, datasets,
57
+ * …). Runs **once** — at {@link Skybridge.run} or on the first request,
58
+ * never at module import — and its awaited return value is passed to an
59
+ * `oauth` function and to `handler` as the second argument.
60
+ */
61
+ setup?: () => TConfig;
62
+ /**
63
+ * Resource-server OAuth. When set, mounts the well-known metadata routes
64
+ * and bearer auth on `/mcp`, and the verifier's claims type
65
+ * `extra.http.authInfo.extra` in tool handlers.
66
+ */
67
+ oauth?: SkybridgeOAuthInput<Awaited<TConfig>, TAuthExtra>;
68
+ /** Registers the MCP surface, per request. See {@link SkybridgeHandler}. */
69
+ handler: SkybridgeHandler<TTools, Awaited<TConfig>, TAuthExtra>;
70
+ };
71
+ /**
72
+ * A Skybridge app: the HTTP surface (Express, OAuth metadata, the `/mcp`
73
+ * route) plus a handler that builds the MCP server for each request.
74
+ *
75
+ * The handler runs for every request, so tools, resources, prompts and views
76
+ * are always registered on the instance that serves the request. Anything in
77
+ * the handler body other than registration therefore runs per request too.
78
+ * Anything asynchronous the app needs (remote config, secrets, …) goes in
79
+ * `setup`, which runs once and feeds the handler's second argument.
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * export const app = new Skybridge({
84
+ * name: "my-app",
85
+ * version: "1.0.0",
86
+ * setup: async () => loadConfig(),
87
+ * oauth: (config) => descopeProvider({ url: config.mcpServerUrl }),
88
+ * handler: (server, config) =>
89
+ * server.registerTool(
90
+ * {
91
+ * name: "search",
92
+ * inputSchema: { query: z.string() },
93
+ * view: { component: "search" },
94
+ * },
95
+ * async ({ query }) => ({ content: `Results for ${query}` }),
96
+ * ),
97
+ * });
98
+ *
99
+ * export type AppType = typeof app;
100
+ * ```
101
+ *
102
+ * @see https://docs.skybridge.tech/api-reference/mcp-server
103
+ */
104
+ export declare class Skybridge<TTools extends Record<string, ToolDef> = Record<never, ToolDef>, TConfig = undefined, TAuthExtra extends ExtraClaims = ExtraClaims> {
105
+ readonly $types: McpServerTypes<TTools>;
106
+ private readonly serverInfo;
107
+ private readonly serverOptions;
108
+ private readonly skills?;
109
+ private oauthEnabled;
110
+ private readonly handler;
111
+ private readonly setup?;
112
+ private readonly oauthInput?;
113
+ private config?;
114
+ private readonly expressApp;
115
+ private readonly onMcpError?;
116
+ private readonly errorMiddleware;
117
+ private readonly mcpMiddlewareEntries;
118
+ private resolveResourceMetadataUrl?;
119
+ private readyPromise?;
120
+ private slowHandlerWarned;
121
+ constructor({ name, title, version, description, icons, websiteUrl, json, skills, onMcpError, setup, oauth, handler, ...serverOptions }: SkybridgeConfig<TTools, TConfig, TAuthExtra>);
122
+ /**
123
+ * Resolve `setup` and `oauth`, then wire OAuth onto the Express app. Runs
124
+ * once; every entry point that needs a built server awaits it, and a failed
125
+ * attempt is retried on the next call.
126
+ *
127
+ * @internal
128
+ */
129
+ ready(): Promise<void>;
130
+ /**
131
+ * The underlying Express app. Use this to extend the HTTP server with
132
+ * custom routes, middleware, or settings — e.g.
133
+ * `app.express.get("/health", ...)`.
134
+ *
135
+ * `express.json()` is pre-applied — tune it via the `json` config field,
136
+ * e.g. `new Skybridge({ name, version, json: { limit: "10mb" }, handler })`.
137
+ * Register your handlers before `run()`; after `run()`, dev-mode middleware,
138
+ * the `/mcp` route, and the default error handler are appended in that order.
139
+ *
140
+ * Note: Alpic Cloud only routes traffic to `/mcp` — custom routes work
141
+ * locally and on self-hosted deployments.
142
+ */
143
+ get express(): Express;
144
+ /**
145
+ * Build a fresh server for one stateless HTTP request, as
146
+ * `createMcpHandler`'s factory contract requires: the handler runs again so
147
+ * the SDK's handler closures belong to the instance whose protocol era it
148
+ * stamps. Sharing one instance's handler maps instead would bind them to an
149
+ * instance that is never marked, pinning every request to the 2025 codec and
150
+ * letting concurrent callers overwrite each other's negotiated version.
151
+ *
152
+ * Awaits `setup` and the `oauth` input on first use. Additional middleware
153
+ * wraps the app pipeline for this instance only; it is not registered on the app.
154
+ *
155
+ * @internal
156
+ */
157
+ createServerInstance(middleware?: McpMiddlewareEntry[]): Promise<SdkServer>;
158
+ /** Register outer MCP middleware on this app, in registration order. @internal */
159
+ withMcpMiddleware(entry: McpMiddlewareEntry): this;
160
+ /**
161
+ * Connect a Skybridge app to an MCP transport. Use this when you're
162
+ * embedding Skybridge in a host that already manages its own transport
163
+ * (e.g. stdio for desktop apps); for HTTP, prefer {@link Skybridge.run}
164
+ * which sets the transport up for you.
165
+ */
166
+ connect(transport: Parameters<SdkServer["connect"]>[0]): Promise<void>;
167
+ /**
168
+ * Register Express middleware on the underlying app. Mirrors `app.use` —
169
+ * pass handlers directly or a path-prefixed handler list. Register before
170
+ * {@link Skybridge.run}; ordering matches Express.
171
+ *
172
+ * Note: Alpic Cloud only routes traffic to `/mcp`. Custom paths work
173
+ * locally and on self-hosted deployments.
174
+ */
175
+ use(...handlers: RequestHandler[]): this;
176
+ use(path: string, ...handlers: RequestHandler[]): this;
177
+ /**
178
+ * Register Express error-handling middleware to run after the built-in
179
+ * `/mcp` route (or your custom route). Use this to log or transform errors
180
+ * thrown by tool handlers before the default error handler responds.
181
+ *
182
+ * @example
183
+ * ```ts
184
+ * app.useOnError((err, _req, _res, next) => {
185
+ * logger.error(err);
186
+ * next(err);
187
+ * });
188
+ * ```
189
+ */
190
+ useOnError(...handlers: ErrorRequestHandler[]): this;
191
+ useOnError(path: string, ...handlers: ErrorRequestHandler[]): this;
192
+ /**
193
+ * Start the HTTP server. Listens on `process.env.__PORT` (default `3000`),
194
+ * mounts the `/mcp` route, and applies any custom Express middleware
195
+ * registered via {@link Skybridge.use} / {@link Skybridge.useOnError}.
196
+ *
197
+ * On Cloudflare Workers / workerd, returns an object exposing `fetch` so
198
+ * the runtime can bridge incoming requests to the Node HTTP server. On
199
+ * Vercel (`VERCEL === "1"`), returns the Express app directly so the
200
+ * serverless function entry can call it as a `(req, res)` handler. On
201
+ * Node, returns `undefined` once listening. When the process was spawned
202
+ * with an IPC channel, the bound port is reported to the parent as
203
+ * `{ type: "skybridge:listening", port }`, the readiness signal test runners
204
+ * wait on instead of polling.
205
+ */
206
+ run(): Promise<{
207
+ fetch: (...args: unknown[]) => unknown;
208
+ } | Express | undefined>;
209
+ private buildServer;
210
+ private instrumentHandlers;
211
+ }