vite-hub 0.0.4 → 0.3.1

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 (1432) hide show
  1. package/README.md +265 -14
  2. package/dist/_internal/auth/internal/server.d.ts +1 -0
  3. package/dist/_internal/auth/internal/server.js +2 -0
  4. package/dist/_internal/auth/runtime/server.d.ts +1 -0
  5. package/dist/_internal/auth/runtime/server.js +2 -0
  6. package/dist/_internal/runtime/browser-errors.d.ts +22 -0
  7. package/dist/_internal/runtime/browser-errors.js +156 -0
  8. package/dist/_internal/runtime/internal/h3.d.ts +1 -0
  9. package/dist/_internal/runtime/internal/h3.js +2 -0
  10. package/dist/_internal/runtime/redirects.d.ts +37 -0
  11. package/dist/_internal/runtime/redirects.js +71 -0
  12. package/dist/_internal/runtime/request-policy.d.ts +43 -0
  13. package/dist/_internal/runtime/request-policy.js +62 -0
  14. package/dist/_internal/runtime/security.d.ts +27 -0
  15. package/dist/_internal/runtime/security.js +104 -0
  16. package/dist/access-F0YP5D5E.js +439 -0
  17. package/dist/access-policy-B_DCpZUt.js +73 -0
  18. package/dist/access-policy-BsB3QVe5.d.ts +109 -0
  19. package/dist/account-Bsu-LBOF.d.ts +195 -0
  20. package/dist/agent/capabilities.d.ts +1 -20
  21. package/dist/agent/capabilities.js +1 -7
  22. package/dist/agent/invocations/database.d.ts +1 -0
  23. package/dist/agent/invocations/database.js +2 -0
  24. package/dist/agent/invocations/drizzle.d.ts +1 -0
  25. package/dist/agent/invocations/drizzle.js +2 -0
  26. package/dist/agent/invocations.d.ts +1 -0
  27. package/dist/agent/invocations.js +2 -0
  28. package/dist/agent/observability.d.ts +1 -0
  29. package/dist/agent/observability.js +2 -0
  30. package/dist/agent/page.d.ts +1 -0
  31. package/dist/agent/page.js +2 -0
  32. package/dist/agent/process.d.ts +1 -0
  33. package/dist/agent/process.js +2 -0
  34. package/dist/agent/state.d.ts +1 -0
  35. package/dist/agent/state.js +2 -0
  36. package/dist/agent/ui/vue.d.ts +1 -0
  37. package/dist/agent/ui/vue.js +2 -0
  38. package/dist/agent/ui.d.ts +1 -0
  39. package/dist/agent/ui.js +2 -0
  40. package/dist/agent/vite.d.ts +1 -0
  41. package/dist/agent/vite.js +2 -0
  42. package/dist/agent-invocations.post-DIm8tJV2.js +423 -0
  43. package/dist/agent.d.ts +1 -7
  44. package/dist/agent.js +1 -31
  45. package/dist/agents-C94A4N9u.d.ts +29 -0
  46. package/dist/agents-DnHexzTJ.js +123 -0
  47. package/dist/agents-y5hBFHUQ.js +2 -0
  48. package/dist/auth/abilities.d.ts +1 -0
  49. package/dist/auth/abilities.js +2 -0
  50. package/dist/auth/database.d.ts +1 -0
  51. package/dist/auth/database.js +2 -0
  52. package/dist/auth/forward.d.ts +1 -0
  53. package/dist/auth/forward.js +2 -0
  54. package/dist/auth/mcp.d.ts +1 -0
  55. package/dist/auth/mcp.js +2 -0
  56. package/dist/auth/presets.d.ts +1 -0
  57. package/dist/auth/presets.js +2 -0
  58. package/dist/auth/schema.d.ts +1 -0
  59. package/dist/auth/schema.js +2 -0
  60. package/dist/auth-BFVHYizM.d.ts +120 -0
  61. package/dist/auth-operations-GcQk0O0X.js +34 -0
  62. package/dist/auth-types-DWpTBZvp.d.ts +90 -0
  63. package/dist/bin.d.ts +1 -1
  64. package/dist/bin.js +318 -50
  65. package/dist/blob/client.d.ts +1 -0
  66. package/dist/blob/client.js +2 -0
  67. package/dist/blob/media.d.ts +1 -0
  68. package/dist/blob/media.js +2 -0
  69. package/dist/blob/nuxt-image.d.ts +3 -0
  70. package/dist/blob/nuxt-image.js +3 -0
  71. package/dist/blob/vue.d.ts +1 -0
  72. package/dist/blob/vue.js +2 -0
  73. package/dist/blob-BRV6_wZa.js +26 -0
  74. package/dist/blob-CiUmptIp.d.ts +9 -0
  75. package/dist/bundle.d.ts +1 -0
  76. package/dist/bundle.js +2 -0
  77. package/dist/cache/operations.d.ts +5 -0
  78. package/dist/cache/operations.js +51 -0
  79. package/dist/cache.d.ts +28 -0
  80. package/dist/cache.js +219 -0
  81. package/dist/cli-DjoDGgT4.js +36 -0
  82. package/dist/cli-config--rAg6V-a.js +2 -0
  83. package/dist/cli-config-Bpjjfz5j.js +105 -0
  84. package/dist/cloudflare-env-lookup-DKXdr4P_.js +16 -0
  85. package/dist/cloudflare-prerender.mjs +3 -0
  86. package/dist/cloudflare-workers.d.ts +12 -0
  87. package/dist/cms/access.d.ts +1 -0
  88. package/dist/cms/access.js +2 -0
  89. package/dist/cms/vite.d.ts +1 -0
  90. package/dist/cms/vite.js +2 -0
  91. package/dist/cms.d.ts +3 -0
  92. package/dist/cms.js +3 -0
  93. package/dist/comments/anchor.d.ts +1 -0
  94. package/dist/comments/anchor.js +2 -0
  95. package/dist/comments/client.d.ts +1 -0
  96. package/dist/comments/client.js +2 -0
  97. package/dist/comments/database/postgres.d.ts +1 -0
  98. package/dist/comments/database/postgres.js +2 -0
  99. package/dist/comments/database.d.ts +1 -0
  100. package/dist/comments/database.js +2 -0
  101. package/dist/comments/realtime.d.ts +1 -0
  102. package/dist/comments/realtime.js +2 -0
  103. package/dist/comments/rpc.d.ts +1 -0
  104. package/dist/comments/rpc.js +2 -0
  105. package/dist/comments/runtime/auth.d.ts +1 -0
  106. package/dist/comments/runtime/auth.js +2 -0
  107. package/dist/comments/runtime.d.ts +1 -0
  108. package/dist/comments/runtime.js +2 -0
  109. package/dist/comments/server.d.ts +1 -0
  110. package/dist/comments/server.js +2 -0
  111. package/dist/comments/testing.d.ts +1 -0
  112. package/dist/comments/testing.js +2 -0
  113. package/dist/comments.d.ts +1 -0
  114. package/dist/comments.js +2 -0
  115. package/dist/connections/agent.d.ts +1 -0
  116. package/dist/connections/agent.js +2 -0
  117. package/dist/connections/chatgpt.d.ts +1 -0
  118. package/dist/connections/chatgpt.js +2 -0
  119. package/dist/connections/google.d.ts +1 -0
  120. package/dist/connections/google.js +2 -0
  121. package/dist/connections/operations.d.ts +1 -0
  122. package/dist/connections/operations.js +2 -0
  123. package/dist/connections/server.d.ts +1 -0
  124. package/dist/connections/server.js +2 -0
  125. package/dist/connections.d.ts +1 -0
  126. package/dist/connections.js +2 -0
  127. package/dist/console/auth-types.d.ts +2 -0
  128. package/dist/console/auth-types.js +1 -0
  129. package/dist/console/auth.d.ts +6 -0
  130. package/dist/console/auth.js +9 -0
  131. package/dist/console/runtime/auth-operations.d.ts +35 -0
  132. package/dist/console/runtime/auth-operations.js +2 -0
  133. package/dist/console/runtime/client/account-views.d.ts +17 -0
  134. package/dist/console/runtime/client/account-views.js +8 -0
  135. package/dist/console/runtime/client/account.d.ts +2 -0
  136. package/dist/console/runtime/client/account.js +1125 -0
  137. package/dist/console/runtime/client/add-primitive.ts +59 -0
  138. package/dist/console/runtime/client/app-identity.ts +44 -0
  139. package/dist/console/runtime/client/appearance.d.ts +62 -0
  140. package/dist/console/runtime/client/appearance.js +87 -0
  141. package/dist/console/runtime/client/auth-management.ts +67 -0
  142. package/dist/console/runtime/client/blob-media.d.ts +46 -0
  143. package/dist/console/runtime/client/blob-media.js +257 -0
  144. package/dist/console/runtime/client/command-search.ts +103 -0
  145. package/dist/console/runtime/client/comment-thread.d.ts +33 -0
  146. package/dist/console/runtime/client/comment-thread.js +62 -0
  147. package/dist/console/runtime/client/document-cache.ts +13 -0
  148. package/dist/console/runtime/client/documents.d.ts +3 -0
  149. package/dist/console/runtime/client/documents.js +2 -0
  150. package/dist/console/runtime/client/editor.d.ts +83 -0
  151. package/dist/console/runtime/client/editor.js +269 -0
  152. package/dist/console/runtime/client/env-groups.d.ts +28 -0
  153. package/dist/console/runtime/client/env-groups.js +39 -0
  154. package/dist/console/runtime/client/env-status.d.ts +35 -0
  155. package/dist/console/runtime/client/env-status.js +68 -0
  156. package/dist/console/runtime/client/format.d.ts +91 -0
  157. package/dist/console/runtime/client/format.js +2 -0
  158. package/dist/console/runtime/client/format.ts +267 -0
  159. package/dist/console/runtime/client/highlight-languages.ts +27 -0
  160. package/dist/console/runtime/client/invocation-deletion.d.ts +17 -0
  161. package/dist/console/runtime/client/invocation-deletion.js +25 -0
  162. package/dist/console/runtime/client/invocation.d.ts +28 -0
  163. package/dist/console/runtime/client/invocation.js +81 -0
  164. package/dist/console/runtime/client/live.d.ts +67 -0
  165. package/dist/console/runtime/client/live.js +158 -0
  166. package/dist/console/runtime/client/mcp-client.d.ts +58 -0
  167. package/dist/console/runtime/client/mcp-client.js +125 -0
  168. package/dist/console/runtime/client/media-library.d.ts +2 -0
  169. package/dist/console/runtime/client/media-library.js +2 -0
  170. package/dist/console/runtime/client/media-uploads.d.ts +33 -0
  171. package/dist/console/runtime/client/media-uploads.js +97 -0
  172. package/dist/console/runtime/client/media.d.ts +2 -0
  173. package/dist/console/runtime/client/media.js +13 -0
  174. package/dist/console/runtime/client/operation-view.d.ts +44 -0
  175. package/dist/console/runtime/client/operation-view.js +161 -0
  176. package/dist/console/runtime/client/presence.d.ts +98 -0
  177. package/dist/console/runtime/client/presence.js +255 -0
  178. package/dist/console/runtime/client/preview.d.ts +86 -0
  179. package/dist/console/runtime/client/preview.js +125 -0
  180. package/dist/console/runtime/client/problem.d.ts +19 -0
  181. package/dist/console/runtime/client/problem.js +59 -0
  182. package/dist/console/runtime/client/project-link.d.ts +2 -0
  183. package/dist/console/runtime/client/project-link.js +2 -0
  184. package/dist/console/runtime/client/project-session.d.ts +221 -0
  185. package/dist/console/runtime/client/project-session.js +723 -0
  186. package/dist/console/runtime/client/project.d.ts +48 -0
  187. package/dist/console/runtime/client/project.js +2 -0
  188. package/dist/console/runtime/client/projects.d.ts +2 -0
  189. package/dist/console/runtime/client/projects.js +2 -0
  190. package/dist/console/runtime/client/publish.d.ts +12 -0
  191. package/dist/console/runtime/client/publish.js +18 -0
  192. package/dist/console/runtime/client/rate-limit.d.ts +36 -0
  193. package/dist/console/runtime/client/rate-limit.js +96 -0
  194. package/dist/console/runtime/client/read-only.d.ts +9 -0
  195. package/dist/console/runtime/client/read-only.js +12 -0
  196. package/dist/console/runtime/client/request.d.ts +55 -8
  197. package/dist/console/runtime/client/request.js +2 -133
  198. package/dist/console/runtime/client/route-query.d.ts +60 -0
  199. package/dist/console/runtime/client/route-query.js +2 -0
  200. package/dist/console/runtime/client/schedule-run.d.ts +13 -0
  201. package/dist/console/runtime/client/schedule-run.js +47 -0
  202. package/dist/console/runtime/client/schema-form.d.ts +2 -0
  203. package/dist/console/runtime/client/schema-form.js +296 -0
  204. package/dist/console/runtime/client/sections.d.ts +2 -12
  205. package/dist/console/runtime/client/sections.js +2 -41
  206. package/dist/console/runtime/client/sidebar.ts +84 -0
  207. package/dist/console/runtime/client/site-access.d.ts +32 -0
  208. package/dist/console/runtime/client/site-access.js +932 -0
  209. package/dist/console/runtime/client/stored.d.ts +33 -0
  210. package/dist/console/runtime/client/stored.js +2 -0
  211. package/dist/console/runtime/client/ticket.d.ts +2 -0
  212. package/dist/console/runtime/client/ticket.js +2 -0
  213. package/dist/console/runtime/client/toast.d.ts +39 -0
  214. package/dist/console/runtime/client/toast.js +35 -0
  215. package/dist/console/runtime/client/workflow.d.ts +20 -0
  216. package/dist/console/runtime/client/workflow.js +79 -0
  217. package/dist/console/runtime/components/console-account-api-keys.vue +195 -0
  218. package/dist/console/runtime/components/console-account-env.vue +286 -0
  219. package/dist/console/runtime/components/console-account-home.vue +427 -0
  220. package/dist/console/runtime/components/console-account-link.vue +68 -0
  221. package/dist/console/runtime/components/console-account-menu.vue +126 -0
  222. package/dist/console/runtime/components/console-account-rename.vue +67 -0
  223. package/dist/console/runtime/components/console-account-settings.vue +184 -0
  224. package/dist/console/runtime/components/console-account-setup.vue +82 -0
  225. package/dist/console/runtime/components/console-account-shell.vue +339 -0
  226. package/dist/console/runtime/components/console-account-sign-in.vue +152 -0
  227. package/dist/console/runtime/components/console-account-snippet.vue +89 -0
  228. package/dist/console/runtime/components/console-account-team-settings.vue +131 -0
  229. package/dist/console/runtime/components/console-account-team.vue +199 -0
  230. package/dist/console/runtime/components/console-account-unlink.vue +52 -0
  231. package/dist/console/runtime/components/console-activity-feed.vue +69 -0
  232. package/dist/console/runtime/components/console-add-primitive.vue +176 -0
  233. package/dist/console/runtime/components/console-agent-list.ts +61 -0
  234. package/dist/console/runtime/components/console-agent-session.vue +301 -0
  235. package/dist/console/runtime/components/console-app-crumb.vue +52 -0
  236. package/dist/console/runtime/components/console-app-logo.vue +44 -0
  237. package/dist/console/runtime/components/console-app-settings.vue +271 -0
  238. package/dist/console/runtime/components/console-app.vue +894 -669
  239. package/dist/console/runtime/components/console-auth-action.vue +241 -0
  240. package/dist/console/runtime/components/console-auth-activity.vue +162 -0
  241. package/dist/console/runtime/components/console-auth-chart.vue +105 -0
  242. package/dist/console/runtime/components/console-auth-detail.vue +379 -0
  243. package/dist/console/runtime/components/console-auth-event-list.vue +79 -0
  244. package/dist/console/runtime/components/console-auth-event-setup.vue +39 -0
  245. package/dist/console/runtime/components/console-auth-overview.vue +95 -0
  246. package/dist/console/runtime/components/console-auth-user-events.vue +62 -0
  247. package/dist/console/runtime/components/console-auth.vue +651 -0
  248. package/dist/console/runtime/components/console-blob-detail.vue +83 -0
  249. package/dist/console/runtime/components/console-blob.vue +160 -300
  250. package/dist/console/runtime/components/console-cache.vue +358 -0
  251. package/dist/console/runtime/components/console-code-text.vue +18 -0
  252. package/dist/console/runtime/components/console-comark-component.vue +146 -0
  253. package/dist/console/runtime/components/console-comment-thread.vue +320 -0
  254. package/dist/console/runtime/components/console-confirm.vue +46 -0
  255. package/dist/console/runtime/components/console-connection-state.vue +40 -0
  256. package/dist/console/runtime/components/console-connection.ts +18 -0
  257. package/dist/console/runtime/components/console-database-model.ts +51 -6
  258. package/dist/console/runtime/components/console-database.vue +310 -380
  259. package/dist/console/runtime/components/console-definitions.vue +491 -306
  260. package/dist/console/runtime/components/console-document-dashboard.vue +473 -0
  261. package/dist/console/runtime/components/console-document-diff.vue +43 -0
  262. package/dist/console/runtime/components/console-document-editor.vue +2806 -0
  263. package/dist/console/runtime/components/console-document-history.vue +118 -0
  264. package/dist/console/runtime/components/console-document-list.vue +575 -0
  265. package/dist/console/runtime/components/console-document-preview.vue +409 -0
  266. package/dist/console/runtime/components/console-document-settings.vue +106 -0
  267. package/dist/console/runtime/components/console-documents.vue +544 -0
  268. package/dist/console/runtime/components/console-env-details.vue +49 -0
  269. package/dist/console/runtime/components/console-env.vue +322 -0
  270. package/dist/console/runtime/components/console-facts.ts +13 -0
  271. package/dist/console/runtime/components/console-frame.vue +201 -1
  272. package/dist/console/runtime/components/console-home.vue +575 -155
  273. package/dist/console/runtime/components/console-icon.vue +19 -0
  274. package/dist/console/runtime/components/console-invocation-composer.vue +155 -0
  275. package/dist/console/runtime/components/console-kv.vue +225 -235
  276. package/dist/console/runtime/components/console-lazy-views.ts +2 -0
  277. package/dist/console/runtime/components/console-loading.vue +29 -0
  278. package/dist/console/runtime/components/console-mark.vue +3 -8
  279. package/dist/console/runtime/components/console-markdown-editor.vue +681 -0
  280. package/dist/console/runtime/components/console-mcp-callback.vue +76 -0
  281. package/dist/console/runtime/components/console-mcp-client.vue +255 -0
  282. package/dist/console/runtime/components/console-mcp-connect.vue +162 -0
  283. package/dist/console/runtime/components/console-mcp-connection.vue +219 -0
  284. package/dist/console/runtime/components/console-mcp-content.vue +157 -0
  285. package/dist/console/runtime/components/console-mcp-items.vue +346 -0
  286. package/dist/console/runtime/components/console-media-browser.vue +956 -0
  287. package/dist/console/runtime/components/console-media-crops.vue +168 -0
  288. package/dist/console/runtime/components/console-media-detail.vue +278 -0
  289. package/dist/console/runtime/components/console-media-dialog.vue +74 -0
  290. package/dist/console/runtime/components/console-media-field.vue +161 -0
  291. package/dist/console/runtime/components/console-media-focal.vue +138 -0
  292. package/dist/console/runtime/components/console-media-library.vue +132 -0
  293. package/dist/console/runtime/components/console-media-move.vue +161 -0
  294. package/dist/console/runtime/components/console-media-picker.vue +196 -0
  295. package/dist/console/runtime/components/console-media-uploads.vue +75 -0
  296. package/dist/console/runtime/components/console-new-chat.ts +27 -0
  297. package/dist/console/runtime/components/console-operation-view.vue +327 -0
  298. package/dist/console/runtime/components/console-page-changes.vue +207 -0
  299. package/dist/console/runtime/components/console-page-header.vue +82 -0
  300. package/dist/console/runtime/components/console-page-toolbar.vue +41 -0
  301. package/dist/console/runtime/components/console-presence-avatars.vue +74 -0
  302. package/dist/console/runtime/components/console-project-switcher.vue +212 -0
  303. package/dist/console/runtime/components/console-property-list.vue +41 -0
  304. package/dist/console/runtime/components/console-property-row.vue +59 -0
  305. package/dist/console/runtime/components/console-rail.vue +237 -0
  306. package/dist/console/runtime/components/console-rate-limit.vue +175 -0
  307. package/dist/console/runtime/components/console-relative-time.vue +74 -0
  308. package/dist/console/runtime/components/console-schema-date-input.vue +88 -0
  309. package/dist/console/runtime/components/console-schema-field.vue +450 -0
  310. package/dist/console/runtime/components/console-schema-form.vue +76 -0
  311. package/dist/console/runtime/components/console-schema-list.vue +157 -0
  312. package/dist/console/runtime/components/console-search-palette.vue +1051 -0
  313. package/dist/console/runtime/components/console-search.vue +17 -424
  314. package/dist/console/runtime/components/console-section-icon.vue +18 -0
  315. package/dist/console/runtime/components/console-section.vue +68 -0
  316. package/dist/console/runtime/components/console-seo-panel.vue +261 -0
  317. package/dist/console/runtime/components/console-session-actions.vue +158 -0
  318. package/dist/console/runtime/components/console-session-bootstrap.ts +0 -26
  319. package/dist/console/runtime/components/console-session-cancel.vue +89 -0
  320. package/dist/console/runtime/components/console-session-code-language.ts +32 -0
  321. package/dist/console/runtime/components/console-session-code-preview.vue +42 -40
  322. package/dist/console/runtime/components/console-session-copy-link.vue +11 -0
  323. package/dist/console/runtime/components/console-session-inspector.vue +392 -235
  324. package/dist/console/runtime/components/console-session-loading.vue +19 -27
  325. package/dist/console/runtime/components/console-session-navbar.vue +44 -27
  326. package/dist/console/runtime/components/console-session-trace.vue +30 -84
  327. package/dist/console/runtime/components/console-session.css +438 -818
  328. package/dist/console/runtime/components/console-settings-card.vue +76 -0
  329. package/dist/console/runtime/components/console-settings-value.vue +46 -0
  330. package/dist/console/runtime/components/console-settings.vue +100 -0
  331. package/dist/console/runtime/components/console-setup-hint.vue +15 -0
  332. package/dist/console/runtime/components/console-sidebar-item.vue +62 -0
  333. package/dist/console/runtime/components/console-sidebar-trigger.vue +34 -0
  334. package/dist/console/runtime/components/console-sidebar.vue +352 -0
  335. package/dist/console/runtime/components/console-site.vue +370 -0
  336. package/dist/console/runtime/components/console-skill-file.vue +73 -0
  337. package/dist/console/runtime/components/console-skill-tree.vue +62 -0
  338. package/dist/console/runtime/components/console-skills.vue +193 -0
  339. package/dist/console/runtime/components/console-stat-grid.vue +64 -0
  340. package/dist/console/runtime/components/console-state.vue +150 -0
  341. package/dist/console/runtime/components/console-toaster.vue +75 -0
  342. package/dist/console/runtime/components/console-usage-chart.vue +210 -0
  343. package/dist/console/runtime/components/console-usage-model-detail.vue +138 -0
  344. package/dist/console/runtime/components/console-usage-model.ts +376 -0
  345. package/dist/console/runtime/components/console-usage-share-bar.vue +48 -0
  346. package/dist/console/runtime/components/console-usage.vue +1086 -508
  347. package/dist/console/runtime/components/console-user-menu.vue +42 -0
  348. package/dist/console/runtime/components/console-value.vue +36 -0
  349. package/dist/console/runtime/components/console-workflow-actions.vue +174 -0
  350. package/dist/console/runtime/components/console-workspace-browser.vue +507 -0
  351. package/dist/console/runtime/components/console-workspace-file.ts +12 -0
  352. package/dist/console/runtime/components/console-workspace-history.vue +76 -0
  353. package/dist/console/runtime/components/console-wrap.ts +10 -0
  354. package/dist/console/runtime/components/invocation/agent-capability-inspector.ts +165 -0
  355. package/dist/console/runtime/components/invocation/agent-invocation-list.ts +260 -0
  356. package/dist/console/runtime/components/invocation/agent-invocation-timeline.ts +112 -0
  357. package/dist/console/runtime/components/invocation/agent-invocation.ts +1991 -0
  358. package/dist/console/runtime/components/invocation/index.ts +8 -0
  359. package/dist/console/runtime/components/invocation/internal/brand-icons.ts +65 -0
  360. package/dist/console/runtime/components/invocation/internal/channel-icon.ts +51 -0
  361. package/dist/console/runtime/components/invocation/internal/invocation-activity.ts +745 -0
  362. package/dist/console/runtime/components/invocation/internal/invocation-brand.ts +173 -0
  363. package/dist/console/runtime/components/invocation/internal/invocation-conversation.ts +167 -0
  364. package/dist/console/runtime/components/invocation/internal/invocation-page-changes.ts +64 -0
  365. package/dist/console/runtime/components/invocation/internal/payload-text.ts +27 -0
  366. package/dist/console/runtime/components/invocation/internal/url.ts +8 -0
  367. package/dist/console/runtime/components/invocation/invocation-display.ts +56 -0
  368. package/dist/console/runtime/components/invocation/invocation.css +2789 -0
  369. package/dist/console/runtime/components/invocation/types.ts +97 -0
  370. package/dist/console/runtime/console-route.d.ts +15 -9
  371. package/dist/console/runtime/console-route.js +2 -37
  372. package/dist/console/runtime/definitions.d.ts +2 -2
  373. package/dist/console/runtime/definitions.js +2 -15
  374. package/dist/console/runtime/diagnostics.ts +287 -0
  375. package/dist/console/runtime/mcp-client.d.ts +2 -0
  376. package/dist/console/runtime/mcp-client.js +2 -0
  377. package/dist/console/runtime/page/loader.js +142 -0
  378. package/dist/console/runtime/page-tool/page-tool.js +10 -0
  379. package/dist/console/runtime/public/skills/index.json +47 -0
  380. package/dist/console/runtime/public/skills/vitehub/SKILL.md +99 -0
  381. package/dist/console/runtime/public/skills/vitehub/agents/openai.yaml +4 -0
  382. package/dist/console/runtime/public/skills/vitehub/references/agent-definitions.md +36 -0
  383. package/dist/console/runtime/public/skills/vitehub/references/bundle.md +57 -0
  384. package/dist/console/runtime/public/skills/vitehub/references/capabilities-authority.md +30 -0
  385. package/dist/console/runtime/public/skills/vitehub/references/channels-triggers.md +27 -0
  386. package/dist/console/runtime/public/skills/vitehub/references/framework-composition.md +29 -0
  387. package/dist/console/runtime/public/skills/vitehub/references/preview-contract.md +36 -0
  388. package/dist/console/runtime/public/skills/vitehub/references/primitives/auth.md +14 -0
  389. package/dist/console/runtime/public/skills/vitehub/references/primitives/blob.md +13 -0
  390. package/dist/console/runtime/public/skills/vitehub/references/primitives/browser.md +17 -0
  391. package/dist/console/runtime/public/skills/vitehub/references/primitives/cache.md +13 -0
  392. package/dist/console/runtime/public/skills/vitehub/references/primitives/channels.md +11 -0
  393. package/dist/console/runtime/public/skills/vitehub/references/primitives/connections.md +14 -0
  394. package/dist/console/runtime/public/skills/vitehub/references/primitives/content.md +13 -0
  395. package/dist/console/runtime/public/skills/vitehub/references/primitives/database.md +15 -0
  396. package/dist/console/runtime/public/skills/vitehub/references/primitives/email.md +11 -0
  397. package/dist/console/runtime/public/skills/vitehub/references/primitives/env.md +13 -0
  398. package/dist/console/runtime/public/skills/vitehub/references/primitives/kv.md +13 -0
  399. package/dist/console/runtime/public/skills/vitehub/references/primitives/markdown-template.md +13 -0
  400. package/dist/console/runtime/public/skills/vitehub/references/primitives/queue.md +14 -0
  401. package/dist/console/runtime/public/skills/vitehub/references/primitives/rate-limit.md +11 -0
  402. package/dist/console/runtime/public/skills/vitehub/references/primitives/realtime.md +19 -0
  403. package/dist/console/runtime/public/skills/vitehub/references/primitives/sandbox-task.md +11 -0
  404. package/dist/console/runtime/public/skills/vitehub/references/primitives/sandbox.md +13 -0
  405. package/dist/console/runtime/public/skills/vitehub/references/primitives/schedule.md +11 -0
  406. package/dist/console/runtime/public/skills/vitehub/references/primitives/shell.md +11 -0
  407. package/dist/console/runtime/public/skills/vitehub/references/primitives/source.md +11 -0
  408. package/dist/console/runtime/public/skills/vitehub/references/primitives/workflow.md +11 -0
  409. package/dist/console/runtime/public/skills/vitehub/references/primitives/workspace.md +11 -0
  410. package/dist/console/runtime/public/skills/vitehub/references/project-patterns.md +19 -0
  411. package/dist/console/runtime/public/skills/vitehub/references/project-shapes.md +81 -0
  412. package/dist/console/runtime/public/skills/vitehub/references/proof-recovery.md +31 -0
  413. package/dist/console/runtime/public/skills/vitehub/references/sandboxes-hosts.md +26 -0
  414. package/dist/console/runtime/public/skills/vitehub/references/schedules-workflows-invocations.md +28 -0
  415. package/dist/console/runtime/public/skills/vitehub/references/server-primitives.md +39 -0
  416. package/dist/console/runtime/public/skills/vitehub/references/workspaces-sources-access.md +26 -0
  417. package/dist/console/runtime/rpc.d.ts +2 -35
  418. package/dist/console/runtime/rpc.js +2 -16
  419. package/dist/console/runtime/sections.d.ts +2 -2
  420. package/dist/console/runtime/sections.js +2 -126
  421. package/dist/console/runtime/server/access-policy.d.ts +2 -0
  422. package/dist/console/runtime/server/access-policy.js +2 -0
  423. package/dist/console/runtime/server/agents.get.d.ts +10 -5
  424. package/dist/console/runtime/server/agents.get.js +18 -10
  425. package/dist/console/runtime/server/auth.d.ts +2 -0
  426. package/dist/console/runtime/server/auth.js +81 -0
  427. package/dist/console/runtime/server/blob.d.ts +2 -2
  428. package/dist/console/runtime/server/blob.js +2 -18
  429. package/dist/console/runtime/server/channel-replay.d.ts +23 -0
  430. package/dist/console/runtime/server/channel-replay.js +52 -0
  431. package/dist/console/runtime/server/database.d.ts +1 -1
  432. package/dist/console/runtime/server/database.get.d.ts +34 -6
  433. package/dist/console/runtime/server/database.get.js +77 -40
  434. package/dist/console/runtime/server/database.js +1 -16
  435. package/dist/console/runtime/server/definitions.d.ts +2 -2
  436. package/dist/console/runtime/server/definitions.get.d.ts +10 -9
  437. package/dist/console/runtime/server/definitions.get.js +76 -15
  438. package/dist/console/runtime/server/definitions.js +2 -22
  439. package/dist/console/runtime/server/development.d.ts +2 -0
  440. package/dist/console/runtime/server/development.js +2 -0
  441. package/dist/console/runtime/server/documents.d.ts +2 -0
  442. package/dist/console/runtime/server/documents.js +3 -0
  443. package/dist/console/runtime/server/env.d.ts +6 -0
  444. package/dist/console/runtime/server/env.get.d.ts +9 -0
  445. package/dist/console/runtime/server/env.get.js +16 -0
  446. package/dist/console/runtime/server/env.js +2 -0
  447. package/dist/console/runtime/server/invocation-capabilities.get.d.ts +6 -5
  448. package/dist/console/runtime/server/invocation-capabilities.get.js +14 -11
  449. package/dist/console/runtime/server/invocation-workspace.get.d.ts +8 -0
  450. package/dist/console/runtime/server/invocation-workspace.get.js +77 -0
  451. package/dist/console/runtime/server/invocation.get.d.ts +36 -25
  452. package/dist/console/runtime/server/invocation.get.js +140 -25
  453. package/dist/console/runtime/server/invocations.get.d.ts +12 -5
  454. package/dist/console/runtime/server/invocations.get.js +56 -69
  455. package/dist/console/runtime/server/logs.get.d.ts +16 -0
  456. package/dist/console/runtime/server/logs.get.js +56 -0
  457. package/dist/console/runtime/server/mcp-client-operations.d.ts +5 -0
  458. package/dist/console/runtime/server/mcp-client-operations.js +139 -0
  459. package/dist/console/runtime/server/operation-contributions.d.ts +2 -0
  460. package/dist/console/runtime/server/operation-contributions.js +2 -0
  461. package/dist/console/runtime/server/page-auth.d.ts +18 -0
  462. package/dist/console/runtime/server/page-auth.js +44 -0
  463. package/dist/console/runtime/server/page-session.d.ts +2 -0
  464. package/dist/console/runtime/server/page-session.js +5 -0
  465. package/dist/console/runtime/server/page-tool.d.ts +2 -0
  466. package/dist/console/runtime/server/page-tool.js +105 -0
  467. package/dist/console/runtime/server/rpc.d.ts +27 -0
  468. package/dist/console/runtime/server/rpc.js +222 -0
  469. package/dist/console/runtime/server/runtime.d.ts +2 -0
  470. package/dist/console/runtime/server/runtime.js +2 -0
  471. package/dist/console/runtime/server/search.get.d.ts +2 -6
  472. package/dist/console/runtime/server/search.get.js +97 -2
  473. package/dist/console/runtime/server/sections.d.ts +6 -2
  474. package/dist/console/runtime/server/sections.get.d.ts +2 -9
  475. package/dist/console/runtime/server/sections.get.js +47 -9
  476. package/dist/console/runtime/server/sections.js +7 -16
  477. package/dist/console/runtime/server/setup.d.ts +5 -0
  478. package/dist/console/runtime/server/setup.js +5 -0
  479. package/dist/console/runtime/server/site-entry.d.ts +24 -0
  480. package/dist/console/runtime/server/site-entry.js +142 -0
  481. package/dist/console/runtime/server/site-session.d.ts +85 -0
  482. package/dist/console/runtime/server/site-session.js +2 -0
  483. package/dist/console/runtime/server/status.get.d.ts +16 -0
  484. package/dist/console/runtime/server/status.get.js +30 -0
  485. package/dist/console/runtime/server/tickets.d.ts +2 -0
  486. package/dist/console/runtime/server/tickets.js +2 -0
  487. package/dist/console/runtime/server/usage.get.d.ts +7 -3
  488. package/dist/console/runtime/server/usage.get.js +74 -26
  489. package/dist/console/runtime/server/workspace-files.get.d.ts +12 -0
  490. package/dist/console/runtime/server/workspace-files.get.js +55 -0
  491. package/dist/console/runtime/site-access.d.ts +2 -0
  492. package/dist/console/runtime/site-access.js +2 -0
  493. package/dist/console/runtime/skills.d.ts +18 -0
  494. package/dist/console/runtime/skills.js +17 -0
  495. package/dist/console/server.d.ts +33 -7
  496. package/dist/console/server.js +9 -28
  497. package/dist/console/ui.d.ts +217 -0
  498. package/dist/console/ui.js +3233 -0
  499. package/dist/console-lazy-views-DXnIkdyd.js +2 -0
  500. package/dist/console-route-COvNB_Xj.js +49 -0
  501. package/dist/console.d.ts +3 -2
  502. package/dist/content/client.d.ts +1 -0
  503. package/dist/content/client.js +2 -0
  504. package/dist/content/collections.d.ts +1 -0
  505. package/dist/content/collections.js +2 -0
  506. package/dist/content/database.d.ts +1 -0
  507. package/dist/content/database.js +2 -0
  508. package/dist/content/editor.d.ts +1 -0
  509. package/dist/content/editor.js +2 -0
  510. package/dist/content/markdown.d.ts +1 -0
  511. package/dist/content/markdown.js +2 -0
  512. package/dist/content/preview.d.ts +1 -0
  513. package/dist/content/preview.js +2 -0
  514. package/dist/content/realtime.d.ts +1 -0
  515. package/dist/content/realtime.js +2 -0
  516. package/dist/content/sqlite.d.ts +1 -0
  517. package/dist/content/sqlite.js +2 -0
  518. package/dist/content.d.ts +1 -0
  519. package/dist/content.js +2 -0
  520. package/dist/database-BVyhAxq-.d.ts +6 -0
  521. package/dist/database-J7M0B3ED.js +17 -0
  522. package/dist/decisions/vue.d.ts +1 -0
  523. package/dist/decisions/vue.js +2 -0
  524. package/dist/decisions.d.ts +1 -0
  525. package/dist/decisions.js +2 -0
  526. package/dist/definitions-BDRkT5-f.js +336 -0
  527. package/dist/definitions-CGTWTj67.d.ts +19 -0
  528. package/dist/definitions-CxDT8D8Y.d.ts +243 -0
  529. package/dist/definitions-bepsXY5G.js +98 -0
  530. package/dist/dev-peer-am78OsHH.js +472 -0
  531. package/dist/development-BzeSHZGH.js +18 -0
  532. package/dist/development-DgaQ05jw.d.ts +9 -0
  533. package/dist/device/vue.d.ts +1 -0
  534. package/dist/device/vue.js +2 -0
  535. package/dist/device.d.ts +1 -0
  536. package/dist/device.js +2 -0
  537. package/dist/diagnostics-CjGiniKb.d.ts +11 -0
  538. package/dist/diagnostics-D0DefmQj.js +79 -0
  539. package/dist/docs/assistant.d.ts +1 -0
  540. package/dist/docs/assistant.js +2 -0
  541. package/dist/docs/nuxt.d.ts +3 -0
  542. package/dist/docs/nuxt.js +3 -0
  543. package/dist/docs/server.d.ts +1 -0
  544. package/dist/docs/server.js +2 -0
  545. package/dist/docs.d.ts +1 -0
  546. package/dist/docs.js +2 -0
  547. package/dist/doctor.d.ts +13 -0
  548. package/dist/doctor.js +3096 -0
  549. package/dist/documents-8US1nUgK.js +547 -0
  550. package/dist/documents-C97WMaJZ.d.ts +474 -0
  551. package/dist/documents-DwPfR-fz.js +136 -0
  552. package/dist/documents-RVHsQKFw.d.ts +87 -0
  553. package/dist/durability/operations.d.ts +5 -0
  554. package/dist/durability/operations.js +28 -0
  555. package/dist/email/test.d.ts +1 -0
  556. package/dist/email/test.js +2 -0
  557. package/dist/entries-D48wVEaS.js +142 -0
  558. package/dist/env/bridge.d.ts +1 -0
  559. package/dist/env/bridge.js +2 -0
  560. package/dist/env/database.d.ts +1 -0
  561. package/dist/env/database.js +2 -0
  562. package/dist/env/seal.d.ts +1 -0
  563. package/dist/env/seal.js +2 -0
  564. package/dist/env-Dg1I_DWr.js +11 -0
  565. package/dist/error-diagnostics-C2rjmOlX.js +630 -0
  566. package/dist/error-diagnostics.ts +639 -0
  567. package/dist/forge.d.ts +1 -0
  568. package/dist/forge.js +2 -0
  569. package/dist/format-BOYlanIZ.js +304 -0
  570. package/dist/forms/client.d.ts +1 -0
  571. package/dist/forms/client.js +2 -0
  572. package/dist/forms/database.d.ts +1 -0
  573. package/dist/forms/database.js +2 -0
  574. package/dist/forms/formisch.d.ts +1 -0
  575. package/dist/forms/formisch.js +2 -0
  576. package/dist/forms/operations.d.ts +1 -0
  577. package/dist/forms/operations.js +2 -0
  578. package/dist/forms/runtime.d.ts +1 -0
  579. package/dist/forms/runtime.js +2 -0
  580. package/dist/forms/vue.d.ts +1 -0
  581. package/dist/forms/vue.js +2 -0
  582. package/dist/forms.d.ts +1 -0
  583. package/dist/forms.js +2 -0
  584. package/dist/gateways/ai-sdk.d.ts +1 -0
  585. package/dist/gateways/ai-sdk.js +2 -0
  586. package/dist/gateways.d.ts +1 -0
  587. package/dist/gateways.js +2 -0
  588. package/dist/host-CkL0jjBq.js +11 -0
  589. package/dist/http-error-Bs6e8_-8.js +30 -0
  590. package/dist/i18n/runtime.d.ts +1 -0
  591. package/dist/i18n/runtime.js +2 -0
  592. package/dist/i18n/server.d.ts +1 -0
  593. package/dist/i18n/server.js +2 -0
  594. package/dist/i18n/vue.d.ts +1 -0
  595. package/dist/i18n/vue.js +2 -0
  596. package/dist/i18n.d.ts +1 -0
  597. package/dist/i18n.js +2 -0
  598. package/dist/index.d.ts +7 -2
  599. package/dist/index.js +39 -3
  600. package/dist/inspect-CDw7e0vK.js +127 -0
  601. package/dist/internal/agent-invocations-libsql.d.ts +2 -0
  602. package/dist/internal/agent-invocations-libsql.js +2 -0
  603. package/dist/internal/disabled-redis-driver.d.ts +3 -0
  604. package/dist/internal/disabled-redis-driver.js +7 -0
  605. package/dist/internal/disabled-upstash-driver.d.ts +3 -0
  606. package/dist/internal/disabled-upstash-driver.js +7 -0
  607. package/dist/internal/test-loader.d.ts +8 -0
  608. package/dist/internal/test-loader.js +75 -0
  609. package/dist/internal/test-server.d.ts +1 -0
  610. package/dist/internal/test-server.js +84 -0
  611. package/dist/internal-BP_O70ic.d.ts +59 -0
  612. package/dist/internal-BreyUsQ6.js +31 -0
  613. package/dist/invariant-DolT9EEx.js +22 -0
  614. package/dist/invocation-page-undo-BkUau8X7.js +54 -0
  615. package/dist/invocations-CsucCJuq.js +86 -0
  616. package/dist/limits-BUlwWYQE.js +34 -0
  617. package/dist/logs/host.d.ts +6 -0
  618. package/dist/logs/host.js +2 -0
  619. package/dist/logs/memory.d.ts +2 -0
  620. package/dist/logs/memory.js +2 -0
  621. package/dist/logs/source.d.ts +2 -0
  622. package/dist/logs/source.js +2 -0
  623. package/dist/logs.d.ts +3 -0
  624. package/dist/logs.js +3 -0
  625. package/dist/markdown-template/file.d.ts +1 -0
  626. package/dist/markdown-template/file.js +2 -0
  627. package/dist/mcp-client-CTbTbn7d.js +10 -0
  628. package/dist/mcp-client-C_sEmyQw.d.ts +118 -0
  629. package/dist/mcp-client-D0mUt18v.js +1024 -0
  630. package/dist/mcp.d.ts +1 -0
  631. package/dist/mcp.js +2 -0
  632. package/dist/media-library-BChf8XOd.js +279 -0
  633. package/dist/media-library-CEo-Ye2B.d.ts +212 -0
  634. package/dist/media-uKX4Wy-c.d.ts +74 -0
  635. package/dist/media-wZMY6f2M.js +478 -0
  636. package/dist/memory-2bbl4hcV.d.ts +19 -0
  637. package/dist/memory-DhirB6SA.js +86 -0
  638. package/dist/nuxt-server-imports-Lnaf5Fe-.js +97 -0
  639. package/dist/nuxt.d.ts +14 -60
  640. package/dist/nuxt.js +966 -374
  641. package/dist/object-D8pRdprI.js +15 -0
  642. package/dist/operation-contributions-DflAv5AC.js +50 -0
  643. package/dist/operation-contributions-fZyVo662.d.ts +21 -0
  644. package/dist/operation-definition-Bn8V2hab.js +430 -0
  645. package/dist/operation-registry-BogGwk_I.js +22 -0
  646. package/dist/operation-rpc-DI9txNxK.js +158 -0
  647. package/dist/operations-B6N-ja8x.js +863 -0
  648. package/dist/operations-DX9EkHwb.d.ts +153 -0
  649. package/dist/operations-Dj_cp-UK.js +235 -0
  650. package/dist/operations-H9q0QB2C.js +2 -0
  651. package/dist/operations.d.ts +1 -0
  652. package/dist/operations.js +2 -0
  653. package/dist/optional-owners-Crm6kVS5.js +889 -0
  654. package/dist/owned-paths-BnjT0FhU.js +15 -0
  655. package/dist/page/pill.iife.js +70 -0
  656. package/dist/page-tool-BCRyx3pM.d.ts +68 -0
  657. package/dist/page-tools-BkSSBFoi.js +444 -0
  658. package/dist/page-tools-shared-D3fFoEV2.js +122 -0
  659. package/dist/page-tools-sw4I-Nqx.d.ts +23 -0
  660. package/dist/plugins-5uDXr9Km.d.ts +2124 -0
  661. package/dist/plugins-DQ8pF-38.js +11325 -0
  662. package/dist/presets/babysitter/server.d.ts +1 -0
  663. package/dist/presets/babysitter/server.js +2 -0
  664. package/dist/presets/babysitter.d.ts +1 -0
  665. package/dist/presets/babysitter.js +2 -0
  666. package/dist/presets/labeller.d.ts +1 -0
  667. package/dist/presets/labeller.js +2 -0
  668. package/dist/presets/workspace.d.ts +3 -0
  669. package/dist/presets/workspace.js +3 -0
  670. package/dist/project-5EN7JaXI.d.ts +26 -0
  671. package/dist/project-C2dnB9Kf.js +30 -0
  672. package/dist/project-DOeM0zg3.js +57 -0
  673. package/dist/project-link-D_XQvBOC.d.ts +94 -0
  674. package/dist/project-link-Qi7nltHM.js +149 -0
  675. package/dist/project-root-v6ba4tn7.js +12 -0
  676. package/dist/projects-CAcXztf4.js +154 -0
  677. package/dist/projects-Ddvl9EJp.d.ts +66 -0
  678. package/dist/rate-limit/drivers/cloudflare.d.ts +1 -0
  679. package/dist/rate-limit/drivers/cloudflare.js +2 -0
  680. package/dist/rate-limit/drivers/kv.d.ts +1 -0
  681. package/dist/rate-limit/drivers/kv.js +2 -0
  682. package/dist/rate-limit/drivers/memory.d.ts +1 -0
  683. package/dist/rate-limit/drivers/memory.js +2 -0
  684. package/dist/realtime/agent.d.ts +1 -0
  685. package/dist/realtime/agent.js +2 -0
  686. package/dist/realtime/bus.d.ts +1 -0
  687. package/dist/realtime/bus.js +2 -0
  688. package/dist/realtime/client.d.ts +1 -0
  689. package/dist/realtime/client.js +2 -0
  690. package/dist/registry-CDKLACCZ.js +16 -0
  691. package/dist/registry-zw6aE2N9.js +18 -0
  692. package/dist/request-BUYAlAJl.js +162 -0
  693. package/dist/request-D7h3SQ92.d.ts +21 -0
  694. package/dist/request-origin-Bq7mDQG9.js +23 -0
  695. package/dist/request-yCybBeqT.js +468 -0
  696. package/dist/route-query-CRVWXIrc.js +222 -0
  697. package/dist/rpc-7nlHSv3y.d.ts +37 -0
  698. package/dist/rpc-DIUA61pv.js +4 -0
  699. package/dist/runtime/durability.d.ts +1 -0
  700. package/dist/runtime/durability.js +2 -0
  701. package/dist/runtime-B_btezs1.d.ts +7 -0
  702. package/dist/runtime-DG34DLXc.js +55 -0
  703. package/dist/runtime-DM8Z6KLT.js +10 -0
  704. package/dist/runtime-DxfJOfCd.js +25 -0
  705. package/dist/runtime-YLWfdrtO.js +65 -0
  706. package/dist/runtime-feature-guard-rpZz1eMF.js +55 -0
  707. package/dist/sandbox/ssh.d.ts +1 -0
  708. package/dist/sandbox/ssh.js +2 -0
  709. package/dist/sandbox/task.d.ts +1 -0
  710. package/dist/sandbox/task.js +2 -0
  711. package/dist/scan-module-BTeOuZsp.js +2 -0
  712. package/dist/scan-module-DlHQ8a0X.js +148 -0
  713. package/dist/schedule/os.d.ts +1 -0
  714. package/dist/schedule/os.js +2 -0
  715. package/dist/schedule/runtime/kv.d.ts +1 -0
  716. package/dist/schedule/runtime/kv.js +2 -0
  717. package/dist/schema-form-C-fy3xaU.d.ts +79 -0
  718. package/dist/secret-AZLhaNyr.js +44 -0
  719. package/dist/sections-4xyBoiar.d.ts +159 -0
  720. package/dist/sections-ACHVTCWn.d.ts +10 -0
  721. package/dist/sections-BriKrBgN.d.ts +57 -0
  722. package/dist/sections-C83x0slv.js +13 -0
  723. package/dist/sections-CUJyQA9d.js +122 -0
  724. package/dist/sections-D6AM5Gy5.js +369 -0
  725. package/dist/sections.get-1lHjyKCI.d.ts +20 -0
  726. package/dist/seo/runtime.d.ts +64 -0
  727. package/dist/seo/runtime.js +123 -0
  728. package/dist/seo-CtLywyRx.d.ts +24 -0
  729. package/dist/seo.d.ts +2 -0
  730. package/dist/seo.js +17 -0
  731. package/dist/server-DbjFYSeU.js +18 -0
  732. package/dist/setup-C-5nB7aY.js +22 -0
  733. package/dist/setup-DLZFzuLv.d.ts +12 -0
  734. package/dist/site-access-Bhsty_v4.js +2 -0
  735. package/dist/site-access-BycrwM2v.js +18 -0
  736. package/dist/site-access-CyRtc0gZ.js +292 -0
  737. package/dist/site-access-DxfdOel1.d.ts +55 -0
  738. package/dist/site-session-Jf21TVw8.js +272 -0
  739. package/dist/skills/operations.d.ts +17 -0
  740. package/dist/skills/operations.js +51 -0
  741. package/dist/skills-DdpSMiCI.js +500 -0
  742. package/dist/skills.d.ts +197 -0
  743. package/dist/skills.get-CHQMzSD_.js +48 -0
  744. package/dist/skills.js +2 -0
  745. package/dist/source/drizzle.d.ts +1 -0
  746. package/dist/source/drizzle.js +2 -0
  747. package/dist/source/server.d.ts +1 -24
  748. package/dist/source/server.js +1 -24
  749. package/dist/source/vite.d.ts +1 -8
  750. package/dist/source/vite.js +2 -18
  751. package/dist/source-S-LChQvw.d.ts +59 -0
  752. package/dist/source-w9BHUwyO.js +60 -0
  753. package/dist/source.d.ts +1 -66
  754. package/dist/source.js +1 -103
  755. package/dist/stored-Dhv2qsQv.js +40 -0
  756. package/dist/sync/client.d.ts +1 -0
  757. package/dist/sync/client.js +2 -0
  758. package/dist/sync/database.d.ts +1 -0
  759. package/dist/sync/database.js +2 -0
  760. package/dist/sync/operations.d.ts +1 -0
  761. package/dist/sync/operations.js +2 -0
  762. package/dist/sync/runtime.d.ts +1 -0
  763. package/dist/sync/runtime.js +2 -0
  764. package/dist/sync/vue.d.ts +1 -0
  765. package/dist/sync/vue.js +2 -0
  766. package/dist/sync.d.ts +1 -0
  767. package/dist/sync.js +2 -0
  768. package/dist/task/operations.d.ts +22 -0
  769. package/dist/task/operations.js +36 -0
  770. package/dist/test/register.d.ts +1 -0
  771. package/dist/test/register.js +68 -0
  772. package/dist/test.d.ts +175 -0
  773. package/dist/test.js +49 -0
  774. package/dist/ticket-Pr_8ZtXW.d.ts +14 -0
  775. package/dist/ticket-RKQF6Wy9.js +31 -0
  776. package/dist/tickets-CfJhT7d0.js +358 -0
  777. package/dist/ui/markdown-editor.d.ts +1 -0
  778. package/dist/ui/markdown-editor.js +2 -0
  779. package/dist/ui/playground.d.ts +1 -0
  780. package/dist/ui/playground.js +2 -0
  781. package/dist/ui/styles.css +2 -2562
  782. package/dist/ui/theme.css +2 -0
  783. package/dist/ui/theme.d.ts +1 -0
  784. package/dist/ui/theme.js +2 -0
  785. package/dist/ui/workspace.d.ts +1 -0
  786. package/dist/ui/workspace.js +2 -0
  787. package/dist/usage-Bc0YY_ka.js +569 -0
  788. package/dist/usage-CoQXs5nW.d.ts +22 -0
  789. package/dist/usage-index-CMMT4cXQ.js +335 -0
  790. package/dist/version-DDRL_OYz.js +1080 -0
  791. package/dist/vue-router-C68IU1jM.d.ts +1914 -0
  792. package/dist/web-container/connect.d.ts +1 -0
  793. package/dist/web-container/connect.js +2 -0
  794. package/dist/web-container/env.d.ts +1 -0
  795. package/dist/web-container/env.js +2 -0
  796. package/dist/web-container/snapshot.d.ts +1 -0
  797. package/dist/web-container/snapshot.js +2 -0
  798. package/dist/web-container.d.ts +1 -0
  799. package/dist/web-container.js +2 -0
  800. package/dist/webhooks/database.d.ts +1 -0
  801. package/dist/webhooks/database.js +2 -0
  802. package/dist/webhooks/operations.d.ts +1 -0
  803. package/dist/webhooks/operations.js +2 -0
  804. package/dist/webhooks/runtime.d.ts +1 -0
  805. package/dist/webhooks/runtime.js +2 -0
  806. package/dist/webhooks.d.ts +1 -0
  807. package/dist/webhooks.js +2 -0
  808. package/dist/workflow/openworkflow.d.ts +1 -0
  809. package/dist/workflow/openworkflow.js +2 -0
  810. package/dist/workspace/blob-database.d.ts +1 -0
  811. package/dist/workspace/blob-database.js +2 -0
  812. package/dist/workspace/checkout.d.ts +1 -0
  813. package/dist/workspace/checkout.js +2 -0
  814. package/dist/workspace/files.d.ts +1 -0
  815. package/dist/workspace/files.js +2 -0
  816. package/dist/workspace/lineage.d.ts +1 -0
  817. package/dist/workspace/lineage.js +2 -0
  818. package/dist/workspace-history-CeVwBB6Q.d.ts +52 -0
  819. package/dist/workspace-history-l47NPVSy.js +248 -0
  820. package/package.json +1320 -207
  821. package/dist/_internal/agent/cloudflare/state.d.ts +0 -1
  822. package/dist/_internal/agent/cloudflare/state.js +0 -2
  823. package/dist/_internal/agent/cloudflare.d.ts +0 -1
  824. package/dist/_internal/agent/cloudflare.js +0 -2
  825. package/dist/_internal/agent/eve.d.ts +0 -1
  826. package/dist/_internal/agent/eve.js +0 -2
  827. package/dist/_internal/agent/runtime/workflow.d.ts +0 -1
  828. package/dist/_internal/agent/runtime/workflow.js +0 -2
  829. package/dist/_internal/agent/server/internal.d.ts +0 -1
  830. package/dist/_internal/agent/server/internal.js +0 -2
  831. package/dist/_internal/agent/server/workspace.d.ts +0 -1
  832. package/dist/_internal/agent/server/workspace.js +0 -2
  833. package/dist/_internal/agent/server.d.ts +0 -1
  834. package/dist/_internal/agent/server.js +0 -2
  835. package/dist/_internal/agent/state/sqlite.d.ts +0 -1
  836. package/dist/_internal/agent/state/sqlite.js +0 -2
  837. package/dist/_internal/agent.d.ts +0 -1
  838. package/dist/_internal/agent.js +0 -2
  839. package/dist/_internal/blob/runtime/state.d.ts +0 -1
  840. package/dist/_internal/blob/runtime/state.js +0 -2
  841. package/dist/_internal/blob.d.ts +0 -1
  842. package/dist/_internal/blob.js +0 -2
  843. package/dist/_internal/database/runtime/state.d.ts +0 -4
  844. package/dist/_internal/database/runtime/state.js +0 -5
  845. package/dist/_internal/kv/runtime/disabled-upstash.d.ts +0 -4
  846. package/dist/_internal/kv/runtime/disabled-upstash.js +0 -6
  847. package/dist/_internal/kv.d.ts +0 -1
  848. package/dist/_internal/kv.js +0 -2
  849. package/dist/_internal/markdown-template.d.ts +0 -2
  850. package/dist/_internal/markdown-template.js +0 -2
  851. package/dist/_internal/rate-limit/runtime.d.ts +0 -1
  852. package/dist/_internal/rate-limit/runtime.js +0 -2
  853. package/dist/_internal/sandbox/runtime/state.d.ts +0 -1
  854. package/dist/_internal/sandbox/runtime/state.js +0 -2
  855. package/dist/_internal/schedule/runtime/driver.d.ts +0 -1
  856. package/dist/_internal/schedule/runtime/driver.js +0 -2
  857. package/dist/_internal/schedule/runtime/process.d.ts +0 -1
  858. package/dist/_internal/schedule/runtime/process.js +0 -2
  859. package/dist/_internal/schedule/runtime/static.d.ts +0 -1
  860. package/dist/_internal/schedule/runtime/static.js +0 -2
  861. package/dist/_internal/schedule/runtime.d.ts +0 -1
  862. package/dist/_internal/schedule/runtime.js +0 -2
  863. package/dist/_internal/schedule.d.ts +0 -1
  864. package/dist/_internal/schedule.js +0 -2
  865. package/dist/_internal/workflow/runtime/cloudflare-runner.d.ts +0 -1
  866. package/dist/_internal/workflow/runtime/cloudflare-runner.js +0 -2
  867. package/dist/_internal/workflow/runtime/cloudflare-vite.d.ts +0 -1
  868. package/dist/_internal/workflow/runtime/cloudflare-vite.js +0 -2
  869. package/dist/_internal/workflow/runtime/execute.d.ts +0 -1
  870. package/dist/_internal/workflow/runtime/execute.js +0 -2
  871. package/dist/_internal/workflow/runtime/state.d.ts +0 -1
  872. package/dist/_internal/workflow/runtime/state.js +0 -2
  873. package/dist/_internal/workflow/runtime/vercel-vite.d.ts +0 -1
  874. package/dist/_internal/workflow/runtime/vercel-vite.js +0 -2
  875. package/dist/_internal/workflow.d.ts +0 -1
  876. package/dist/_internal/workflow.js +0 -2
  877. package/dist/_internal/workspace/internal/runtime/hosted-vercel-blob.d.ts +0 -1
  878. package/dist/_internal/workspace/internal/runtime/hosted-vercel-blob.js +0 -2
  879. package/dist/_internal/workspace/internal/runtime/hosted.d.ts +0 -1
  880. package/dist/_internal/workspace/internal/runtime/hosted.js +0 -2
  881. package/dist/_internal/workspace/internal/runtime/state.d.ts +0 -1
  882. package/dist/_internal/workspace/internal/runtime/state.js +0 -2
  883. package/dist/_internal/workspace/runtime.d.ts +0 -1
  884. package/dist/_internal/workspace/runtime.js +0 -2
  885. package/dist/_internal/workspace.d.ts +0 -1
  886. package/dist/_internal/workspace.js +0 -2
  887. package/dist/agent/invocations/sqlite.d.ts +0 -1
  888. package/dist/agent/invocations/sqlite.js +0 -2
  889. package/dist/agent/runtime/process.d.ts +0 -1
  890. package/dist/agent/runtime/process.js +0 -2
  891. package/dist/agent/state/sqlite.d.ts +0 -1
  892. package/dist/agent/state/sqlite.js +0 -2
  893. package/dist/agents-DGL-2SS3.js +0 -53
  894. package/dist/blob/content-type.d.ts +0 -1
  895. package/dist/blob/content-type.js +0 -2
  896. package/dist/blob-_CeYUuZh.d.ts +0 -8
  897. package/dist/box.d.ts +0 -1
  898. package/dist/box.js +0 -2
  899. package/dist/browser/actions.d.ts +0 -1
  900. package/dist/browser/actions.js +0 -2
  901. package/dist/console/runtime/client/time.d.ts +0 -4
  902. package/dist/console/runtime/client/time.js +0 -8
  903. package/dist/console/runtime/components/console-brand.vue +0 -37
  904. package/dist/console/runtime/components/console-health-model.ts +0 -54
  905. package/dist/console/runtime/components/console-health.vue +0 -236
  906. package/dist/console/runtime/components/console-primitive-switcher.vue +0 -69
  907. package/dist/console/runtime/components/console-provider.vue +0 -12
  908. package/dist/console/runtime/pages/agents.vue +0 -58
  909. package/dist/console/runtime/pages/blob.vue +0 -30
  910. package/dist/console/runtime/pages/databases.vue +0 -67
  911. package/dist/console/runtime/pages/index.vue +0 -29
  912. package/dist/console/runtime/pages/kv.vue +0 -68
  913. package/dist/console/runtime/pages/queues.vue +0 -30
  914. package/dist/console/runtime/pages/rate-limits.vue +0 -30
  915. package/dist/console/runtime/pages/sandboxes.vue +0 -27
  916. package/dist/console/runtime/pages/schedules.vue +0 -30
  917. package/dist/console/runtime/pages/workflows.vue +0 -30
  918. package/dist/console/runtime/pages/workspaces.vue +0 -30
  919. package/dist/console/runtime/public/console/chunks/ChatMessage-CVruGJWM.js +0 -1
  920. package/dist/console/runtime/public/console/chunks/ChatPrompt-BmTjPf5_.js +0 -1
  921. package/dist/console/runtime/public/console/chunks/ChatPromptSubmit-DcxguvaS.js +0 -1
  922. package/dist/console/runtime/public/console/chunks/ChatReasoning-DIMO2K2F.js +0 -1
  923. package/dist/console/runtime/public/console/chunks/ChatShimmer-C613EbHI.js +0 -1
  924. package/dist/console/runtime/public/console/chunks/ChatTool-DDmc-ZK6.js +0 -1
  925. package/dist/console/runtime/public/console/chunks/Collapsible-C0CXnWpw.js +0 -1
  926. package/dist/console/runtime/public/console/chunks/CollapsibleTrigger-CmJucLnT.js +0 -1
  927. package/dist/console/runtime/public/console/chunks/Icon-D-AnqCok.js +0 -1
  928. package/dist/console/runtime/public/console/chunks/abap-LtYK6g-v-CLvhMVsD.js +0 -1
  929. package/dist/console/runtime/public/console/chunks/actionscript-3-Czo0lKSf--17pq3dv.js +0 -1
  930. package/dist/console/runtime/public/console/chunks/ada-twHwrVWN-C5qYipkI.js +0 -1
  931. package/dist/console/runtime/public/console/chunks/andromeeda-DnSv6o6l-vGVdxbeo.js +0 -1
  932. package/dist/console/runtime/public/console/chunks/andromeeda-vGVdxbeo.js +0 -1
  933. package/dist/console/runtime/public/console/chunks/angular-html-Ct-40ew8-D8X9MCxo.js +0 -1
  934. package/dist/console/runtime/public/console/chunks/angular-html-DTyieMYv.js +0 -1
  935. package/dist/console/runtime/public/console/chunks/angular-ts-D3gV1N-x.js +0 -1
  936. package/dist/console/runtime/public/console/chunks/angular-ts-D6akBVit-CAEqTior.js +0 -1
  937. package/dist/console/runtime/public/console/chunks/apache-BIl2qPOf-U0d_L8uA.js +0 -1
  938. package/dist/console/runtime/public/console/chunks/apex-BkQQFAhi-VAyPSnFM.js +0 -1
  939. package/dist/console/runtime/public/console/chunks/apl-Cxjn4xYu-QUZjoXcb.js +0 -1
  940. package/dist/console/runtime/public/console/chunks/applescript-CJ80B5XJ-CCn79oCD.js +0 -1
  941. package/dist/console/runtime/public/console/chunks/ara-IxnQjO6j-4CJ0cIlV.js +0 -1
  942. package/dist/console/runtime/public/console/chunks/asciidoc-Dsw6zvwf-DE70LPWp.js +0 -1
  943. package/dist/console/runtime/public/console/chunks/asm-wBDSgBbA-Cmm7eHzH.js +0 -1
  944. package/dist/console/runtime/public/console/chunks/astro-BPVTb8uX-BMHg0UsI.js +0 -1
  945. package/dist/console/runtime/public/console/chunks/astro-CLAWI0Fn.js +0 -1
  946. package/dist/console/runtime/public/console/chunks/aurora-x-CDeNXAV0.js +0 -1
  947. package/dist/console/runtime/public/console/chunks/aurora-x-XJ5I8rFc-CDeNXAV0.js +0 -1
  948. package/dist/console/runtime/public/console/chunks/awk-D6dA05Ye-BWXHIvNe.js +0 -1
  949. package/dist/console/runtime/public/console/chunks/ayu-dark-CBRGL64--DluEY0Gj.js +0 -1
  950. package/dist/console/runtime/public/console/chunks/ayu-dark-DluEY0Gj.js +0 -1
  951. package/dist/console/runtime/public/console/chunks/ayu-light-BlrCS3Ih-C3h-C4tm.js +0 -1
  952. package/dist/console/runtime/public/console/chunks/ayu-light-C3h-C4tm.js +0 -1
  953. package/dist/console/runtime/public/console/chunks/ayu-mirage-Bqwy1Gya.js +0 -1
  954. package/dist/console/runtime/public/console/chunks/ayu-mirage-CqpTmLcF-Bqwy1Gya.js +0 -1
  955. package/dist/console/runtime/public/console/chunks/ballerina-DIdXD2KH-B7ZEbQpA.js +0 -1
  956. package/dist/console/runtime/public/console/chunks/bat-hQslfzu--Bo4NYOV-.js +0 -1
  957. package/dist/console/runtime/public/console/chunks/beancount-CXtOQ8oS-D-usSTwE.js +0 -1
  958. package/dist/console/runtime/public/console/chunks/berry-CgA2ea0_-DKpUyyne.js +0 -1
  959. package/dist/console/runtime/public/console/chunks/bibtex-BzgdqG3s-Ci_nEsc7.js +0 -1
  960. package/dist/console/runtime/public/console/chunks/bicep-CZ338dSk-CUHmPFLl.js +0 -1
  961. package/dist/console/runtime/public/console/chunks/bird2-GLyzhwkD-C6vDhewU.js +0 -1
  962. package/dist/console/runtime/public/console/chunks/blade-0LMawyyw-CZBPwR53.js +0 -1
  963. package/dist/console/runtime/public/console/chunks/blade-CP_mgflB.js +0 -1
  964. package/dist/console/runtime/public/console/chunks/bsl-0NWGiiFE-mk7PqslV.js +0 -1
  965. package/dist/console/runtime/public/console/chunks/bundle-web-DTJmdyvB.js +0 -13
  966. package/dist/console/runtime/public/console/chunks/c-BhmuwSav.js +0 -1
  967. package/dist/console/runtime/public/console/chunks/c-Dc0_AVM6-CjS7AEt5.js +0 -1
  968. package/dist/console/runtime/public/console/chunks/c3-BLXk7BLN-BFHwR3_K.js +0 -1
  969. package/dist/console/runtime/public/console/chunks/cadence-B1ELWULD-CQ2zXKGN.js +0 -1
  970. package/dist/console/runtime/public/console/chunks/cairo-DjG4M3vq-xb-J0v0e.js +0 -1
  971. package/dist/console/runtime/public/console/chunks/catppuccin-frappe-3VR1Za6u.js +0 -1
  972. package/dist/console/runtime/public/console/chunks/catppuccin-frappe-COUg_LSX-3VR1Za6u.js +0 -1
  973. package/dist/console/runtime/public/console/chunks/catppuccin-latte-DwIHMF0Q.js +0 -1
  974. package/dist/console/runtime/public/console/chunks/catppuccin-latte-r30LFfsa-DwIHMF0Q.js +0 -1
  975. package/dist/console/runtime/public/console/chunks/catppuccin-macchiato-D-EwZyPh-DYnBP6_5.js +0 -1
  976. package/dist/console/runtime/public/console/chunks/catppuccin-macchiato-DYnBP6_5.js +0 -1
  977. package/dist/console/runtime/public/console/chunks/catppuccin-mocha-C6RD5yh3-DYhrFGRu.js +0 -1
  978. package/dist/console/runtime/public/console/chunks/catppuccin-mocha-DYhrFGRu.js +0 -1
  979. package/dist/console/runtime/public/console/chunks/chunk-DK3Fl9T5.js +0 -1
  980. package/dist/console/runtime/public/console/chunks/clarity-2iIoRiLx-SemFz856.js +0 -1
  981. package/dist/console/runtime/public/console/chunks/clojure-DDsQ0FaV-DqKBuwfJ.js +0 -1
  982. package/dist/console/runtime/public/console/chunks/cmake-DPsCB_V6-Bj61d0ZC.js +0 -1
  983. package/dist/console/runtime/public/console/chunks/cobol-CocL1RYn-DoHa8rFw.js +0 -1
  984. package/dist/console/runtime/public/console/chunks/codeowners-CxEKPWu0-C8r90Shi.js +0 -1
  985. package/dist/console/runtime/public/console/chunks/codeql-BwdvwJnv-oeQT6MSM.js +0 -1
  986. package/dist/console/runtime/public/console/chunks/coffee-DtqnQNu5-Ca3s2Keu.js +0 -1
  987. package/dist/console/runtime/public/console/chunks/coffee-PUiKoj8Q.js +0 -1
  988. package/dist/console/runtime/public/console/chunks/common-lisp-DJtwvW4V-Cv5bFMCO.js +0 -1
  989. package/dist/console/runtime/public/console/chunks/coq-Ds6Ye5el-BrsZFFmf.js +0 -1
  990. package/dist/console/runtime/public/console/chunks/cpp-CxycoGSa.js +0 -1
  991. package/dist/console/runtime/public/console/chunks/cpp-Mb4ikSI3-tLY9dtiu.js +0 -1
  992. package/dist/console/runtime/public/console/chunks/crystal-D4OMbAh_-C9omPlZ-.js +0 -1
  993. package/dist/console/runtime/public/console/chunks/csharp-CFKaLbHg-oqKa8noW.js +0 -1
  994. package/dist/console/runtime/public/console/chunks/css-DLlZbWMi.js +0 -1
  995. package/dist/console/runtime/public/console/chunks/css-DTzmO9U0-CbxoEllx.js +0 -1
  996. package/dist/console/runtime/public/console/chunks/csv-DqIVFkK7-Dx-8-gkx.js +0 -1
  997. package/dist/console/runtime/public/console/chunks/csv-Dx-8-gkx.js +0 -1
  998. package/dist/console/runtime/public/console/chunks/cue-B5KneM5p-CE9AQfxI.js +0 -1
  999. package/dist/console/runtime/public/console/chunks/cypher-D8Bb8Cq2-ClKdZ_lG.js +0 -1
  1000. package/dist/console/runtime/public/console/chunks/d-BQY8TDgQ-qD-0Kul2.js +0 -1
  1001. package/dist/console/runtime/public/console/chunks/dark-plus-BCxGtnt0-Cs2F2srj.js +0 -1
  1002. package/dist/console/runtime/public/console/chunks/dark-plus-Cs2F2srj.js +0 -1
  1003. package/dist/console/runtime/public/console/chunks/dart-C6DUdjib-CnvKMtbv.js +0 -1
  1004. package/dist/console/runtime/public/console/chunks/dax-S-Noo-ku-BkyTk9wS.js +0 -1
  1005. package/dist/console/runtime/public/console/chunks/desktop-BgOb7Aj4-Dlh5hvp9.js +0 -1
  1006. package/dist/console/runtime/public/console/chunks/diff-Blb4MjsC-woXpYk--.js +0 -1
  1007. package/dist/console/runtime/public/console/chunks/docker-PC1tuYpa-IyjqRm3v.js +0 -1
  1008. package/dist/console/runtime/public/console/chunks/dotenv-Dkdv7Sm2-_5a1GRtc.js +0 -1
  1009. package/dist/console/runtime/public/console/chunks/dracula-BHWKrbxM.js +0 -1
  1010. package/dist/console/runtime/public/console/chunks/dracula-fPErIccy-BHWKrbxM.js +0 -1
  1011. package/dist/console/runtime/public/console/chunks/dracula-soft-5eyTD99u.js +0 -1
  1012. package/dist/console/runtime/public/console/chunks/dracula-soft-BrQbqXs8-5eyTD99u.js +0 -1
  1013. package/dist/console/runtime/public/console/chunks/dream-maker-CngiPd8U-DW3nJb8Q.js +0 -1
  1014. package/dist/console/runtime/public/console/chunks/edge-DrFNu-N9-BY3pzybO.js +0 -1
  1015. package/dist/console/runtime/public/console/chunks/elixir-OpZyQ8Ht-CwWfuiQ1.js +0 -1
  1016. package/dist/console/runtime/public/console/chunks/elm-CjX_545P-Dn-DqM39.js +0 -1
  1017. package/dist/console/runtime/public/console/chunks/emacs-lisp-DxhFFVu_-B4R74twV.js +0 -1
  1018. package/dist/console/runtime/public/console/chunks/erb-trZRdc47-DRBdWH-D.js +0 -1
  1019. package/dist/console/runtime/public/console/chunks/erlang-BJeTH9QH-BfDtvnHZ.js +0 -1
  1020. package/dist/console/runtime/public/console/chunks/everforest-dark-gTeBQCos-sB-x3p7T.js +0 -1
  1021. package/dist/console/runtime/public/console/chunks/everforest-dark-sB-x3p7T.js +0 -1
  1022. package/dist/console/runtime/public/console/chunks/everforest-light-DUjxsp-2-Df2xbC6M.js +0 -1
  1023. package/dist/console/runtime/public/console/chunks/everforest-light-Df2xbC6M.js +0 -1
  1024. package/dist/console/runtime/public/console/chunks/fennel-B3wtZRne-DQxkIbk2.js +0 -1
  1025. package/dist/console/runtime/public/console/chunks/fish-D7qAeWQz-BJitypiv.js +0 -1
  1026. package/dist/console/runtime/public/console/chunks/fluent-BjfpB34g-C03EYrpw.js +0 -1
  1027. package/dist/console/runtime/public/console/chunks/fortran-fixed-form-B_eBTsj9-C2-rkbip.js +0 -1
  1028. package/dist/console/runtime/public/console/chunks/fortran-free-form-yxJ7igsv-CYNrtFtB.js +0 -1
  1029. package/dist/console/runtime/public/console/chunks/fsharp-UvrT6oWG-LCdvSpj6.js +0 -1
  1030. package/dist/console/runtime/public/console/chunks/gdresource-Dl9wvKCd-C3MGX-jo.js +0 -1
  1031. package/dist/console/runtime/public/console/chunks/gdscript-jjgTGGzd-Cp2uCuqX.js +0 -1
  1032. package/dist/console/runtime/public/console/chunks/gdshader-D7JfdFV3-CBce3t8t.js +0 -1
  1033. package/dist/console/runtime/public/console/chunks/genie-DnK2KWIP-CV2tkWYe.js +0 -1
  1034. package/dist/console/runtime/public/console/chunks/gherkin-D6Lr12YQ-DExj1W_8.js +0 -1
  1035. package/dist/console/runtime/public/console/chunks/git-commit-2LMniMoO-CfgJCLX7.js +0 -1
  1036. package/dist/console/runtime/public/console/chunks/git-rebase-DUOURRPN-DbPsFIae.js +0 -1
  1037. package/dist/console/runtime/public/console/chunks/github-dark-C-LZuMrd.js +0 -1
  1038. package/dist/console/runtime/public/console/chunks/github-dark-Dg1hl_QD-C-LZuMrd.js +0 -1
  1039. package/dist/console/runtime/public/console/chunks/github-dark-default-DXG-b-1a.js +0 -1
  1040. package/dist/console/runtime/public/console/chunks/github-dark-default-Dym2P842-DXG-b-1a.js +0 -1
  1041. package/dist/console/runtime/public/console/chunks/github-dark-dimmed-7iDMx266-Bx1FflLF.js +0 -1
  1042. package/dist/console/runtime/public/console/chunks/github-dark-dimmed-Bx1FflLF.js +0 -1
  1043. package/dist/console/runtime/public/console/chunks/github-dark-high-contrast-B_tTalzw.js +0 -1
  1044. package/dist/console/runtime/public/console/chunks/github-dark-high-contrast-DkV2fyPG-B_tTalzw.js +0 -1
  1045. package/dist/console/runtime/public/console/chunks/github-light-BQKYgor9-EUqPIrTm.js +0 -1
  1046. package/dist/console/runtime/public/console/chunks/github-light-EUqPIrTm.js +0 -1
  1047. package/dist/console/runtime/public/console/chunks/github-light-default-BXViO-2h.js +0 -1
  1048. package/dist/console/runtime/public/console/chunks/github-light-default-BZhIfzqQ-BXViO-2h.js +0 -1
  1049. package/dist/console/runtime/public/console/chunks/github-light-high-contrast-B68TUdTA.js +0 -1
  1050. package/dist/console/runtime/public/console/chunks/github-light-high-contrast-C7zHfx4C-B68TUdTA.js +0 -1
  1051. package/dist/console/runtime/public/console/chunks/gleam-CTllUdfC-CSRkHgEL.js +0 -1
  1052. package/dist/console/runtime/public/console/chunks/glimmer-js-D_32hFh8-Dv_1Q6fk.js +0 -1
  1053. package/dist/console/runtime/public/console/chunks/glimmer-ts-CVt002zd-PmMLyqBp.js +0 -1
  1054. package/dist/console/runtime/public/console/chunks/glsl-8MDrjpMp.js +0 -1
  1055. package/dist/console/runtime/public/console/chunks/glsl-pHhzolba-D3h1XPFw.js +0 -1
  1056. package/dist/console/runtime/public/console/chunks/gn-DDjbVPF4-ilITqXS6.js +0 -1
  1057. package/dist/console/runtime/public/console/chunks/gnuplot-DgWvVXI8-7GGW24-e.js +0 -1
  1058. package/dist/console/runtime/public/console/chunks/go-aXtTCanQ-rLFTqkRN.js +0 -1
  1059. package/dist/console/runtime/public/console/chunks/graphql-BjqekQIR-CtUxCAnJ.js +0 -1
  1060. package/dist/console/runtime/public/console/chunks/graphql-C4iAGs1_.js +0 -1
  1061. package/dist/console/runtime/public/console/chunks/groovy-Bw2Ku4bU-CacY0gHj.js +0 -1
  1062. package/dist/console/runtime/public/console/chunks/gruvbox-dark-hard-C820rvS2.js +0 -1
  1063. package/dist/console/runtime/public/console/chunks/gruvbox-dark-hard-CQiwpF03-C820rvS2.js +0 -1
  1064. package/dist/console/runtime/public/console/chunks/gruvbox-dark-medium-BKe6XKBS-BPjhmG05.js +0 -1
  1065. package/dist/console/runtime/public/console/chunks/gruvbox-dark-medium-BPjhmG05.js +0 -1
  1066. package/dist/console/runtime/public/console/chunks/gruvbox-dark-soft-Cz6U6pa4-MrdJrrXF.js +0 -1
  1067. package/dist/console/runtime/public/console/chunks/gruvbox-dark-soft-MrdJrrXF.js +0 -1
  1068. package/dist/console/runtime/public/console/chunks/gruvbox-light-hard-BC_s9l72.js +0 -1
  1069. package/dist/console/runtime/public/console/chunks/gruvbox-light-hard-DgU_i19B-BC_s9l72.js +0 -1
  1070. package/dist/console/runtime/public/console/chunks/gruvbox-light-medium-BAWPOn9u.js +0 -1
  1071. package/dist/console/runtime/public/console/chunks/gruvbox-light-medium-D64I06ER-BAWPOn9u.js +0 -1
  1072. package/dist/console/runtime/public/console/chunks/gruvbox-light-soft-B-YxAs1L-BSMLrYjP.js +0 -1
  1073. package/dist/console/runtime/public/console/chunks/gruvbox-light-soft-BSMLrYjP.js +0 -1
  1074. package/dist/console/runtime/public/console/chunks/hack-BITNGzgt-BwY4KWmq.js +0 -1
  1075. package/dist/console/runtime/public/console/chunks/haml-BJGeH8A5.js +0 -1
  1076. package/dist/console/runtime/public/console/chunks/haml-DVwRP8W9-C4Ue42xj.js +0 -1
  1077. package/dist/console/runtime/public/console/chunks/handlebars-OC1LcHwO.js +0 -1
  1078. package/dist/console/runtime/public/console/chunks/handlebars-T3TJj8Il-BLQCwuJT.js +0 -1
  1079. package/dist/console/runtime/public/console/chunks/haskell-CfGsE1Cf-D8IpX4py.js +0 -1
  1080. package/dist/console/runtime/public/console/chunks/haxe-B0odltAZ-OTjmBuCE.js +0 -1
  1081. package/dist/console/runtime/public/console/chunks/hcl-DHg_Osgo-Dh228itO.js +0 -1
  1082. package/dist/console/runtime/public/console/chunks/hjson-Cuaphql8-CxZEssPk.js +0 -1
  1083. package/dist/console/runtime/public/console/chunks/hlsl-BJLUNfne-Cvrh5tZx.js +0 -1
  1084. package/dist/console/runtime/public/console/chunks/horizon-CE9ld1lL.js +0 -1
  1085. package/dist/console/runtime/public/console/chunks/horizon-DYoumREk-CE9ld1lL.js +0 -1
  1086. package/dist/console/runtime/public/console/chunks/horizon-bright-CPyV7XIA-DSNQnXHK.js +0 -1
  1087. package/dist/console/runtime/public/console/chunks/horizon-bright-DSNQnXHK.js +0 -1
  1088. package/dist/console/runtime/public/console/chunks/houston-B3NWfq0V-CsvMBhTu.js +0 -1
  1089. package/dist/console/runtime/public/console/chunks/houston-CsvMBhTu.js +0 -1
  1090. package/dist/console/runtime/public/console/chunks/html-CamevgpM-BbT95zHF.js +0 -1
  1091. package/dist/console/runtime/public/console/chunks/html-Cs160JwT.js +0 -1
  1092. package/dist/console/runtime/public/console/chunks/html-derivative-GiQ9zDJU.js +0 -1
  1093. package/dist/console/runtime/public/console/chunks/html-derivative-jMOJf6rB-Kh3SdD3S.js +0 -1
  1094. package/dist/console/runtime/public/console/chunks/http-BEHztmFP-BxphIJE7.js +0 -1
  1095. package/dist/console/runtime/public/console/chunks/http-Cgwuv9UR.js +0 -1
  1096. package/dist/console/runtime/public/console/chunks/hurl-DMKCZZMv.js +0 -1
  1097. package/dist/console/runtime/public/console/chunks/hurl-LmFBxrwm-CGo4dqUD.js +0 -1
  1098. package/dist/console/runtime/public/console/chunks/hxml-BQ4V4Tez-BaHUc7lX.js +0 -1
  1099. package/dist/console/runtime/public/console/chunks/hy-CJKxDzbh-CZbG8q4J.js +0 -1
  1100. package/dist/console/runtime/public/console/chunks/imba-96qKoJCa-DsUTQ-LC.js +0 -1
  1101. package/dist/console/runtime/public/console/chunks/imba-DsUTQ-LC.js +0 -1
  1102. package/dist/console/runtime/public/console/chunks/ini-C24lZfdM-B5eOa1yu.js +0 -1
  1103. package/dist/console/runtime/public/console/chunks/java-CUcXVav_.js +0 -1
  1104. package/dist/console/runtime/public/console/chunks/java-Cfowl-Ex-BnGnzH2k.js +0 -1
  1105. package/dist/console/runtime/public/console/chunks/javascript-C4sF7sej-B29qPxDa.js +0 -1
  1106. package/dist/console/runtime/public/console/chunks/javascript-DrVpc-sp.js +0 -1
  1107. package/dist/console/runtime/public/console/chunks/jinja-C17UUgXU.js +0 -1
  1108. package/dist/console/runtime/public/console/chunks/jinja-CCAEwzP4-PaInFpq5.js +0 -1
  1109. package/dist/console/runtime/public/console/chunks/jison-BKCoBkyT-BRL7eVgb.js +0 -1
  1110. package/dist/console/runtime/public/console/chunks/jison-ByjIV4zh.js +0 -1
  1111. package/dist/console/runtime/public/console/chunks/json-E4f3l6hr-DuNL0Aj9.js +0 -1
  1112. package/dist/console/runtime/public/console/chunks/json-qhed-kSA.js +0 -1
  1113. package/dist/console/runtime/public/console/chunks/json5-BR5RXkoi.js +0 -1
  1114. package/dist/console/runtime/public/console/chunks/json5-xULSgPQI-BR5RXkoi.js +0 -1
  1115. package/dist/console/runtime/public/console/chunks/jsonc-CYpm1nAK.js +0 -1
  1116. package/dist/console/runtime/public/console/chunks/jsonc-Cu6rqcrJ-CYpm1nAK.js +0 -1
  1117. package/dist/console/runtime/public/console/chunks/jsonl-Bp0qqr10-CmCQp5Yx.js +0 -1
  1118. package/dist/console/runtime/public/console/chunks/jsonl-CmCQp5Yx.js +0 -1
  1119. package/dist/console/runtime/public/console/chunks/jsonnet-BafgE6cE-CJTPZ8u_.js +0 -1
  1120. package/dist/console/runtime/public/console/chunks/jssm-Dx5A5sBR-DXw9l8Rf.js +0 -1
  1121. package/dist/console/runtime/public/console/chunks/jsx-BZjOirBP-Dga5sQe3.js +0 -1
  1122. package/dist/console/runtime/public/console/chunks/jsx-C-HlKHLe.js +0 -1
  1123. package/dist/console/runtime/public/console/chunks/julia-Ca_tGyZB.js +0 -1
  1124. package/dist/console/runtime/public/console/chunks/julia-nEdJo0dp-CJRta6ZT.js +0 -1
  1125. package/dist/console/runtime/public/console/chunks/just-Brtw3q7S-DmytbepJ.js +0 -1
  1126. package/dist/console/runtime/public/console/chunks/kanagawa-dragon-CXtmUGW6.js +0 -1
  1127. package/dist/console/runtime/public/console/chunks/kanagawa-dragon-DExkuQAs-CXtmUGW6.js +0 -1
  1128. package/dist/console/runtime/public/console/chunks/kanagawa-lotus-BN08jTvb.js +0 -1
  1129. package/dist/console/runtime/public/console/chunks/kanagawa-lotus-qdYh7_RY-BN08jTvb.js +0 -1
  1130. package/dist/console/runtime/public/console/chunks/kanagawa-wave-CSW_hADG-CTweb8Dz.js +0 -1
  1131. package/dist/console/runtime/public/console/chunks/kanagawa-wave-CTweb8Dz.js +0 -1
  1132. package/dist/console/runtime/public/console/chunks/kdl-DkTyxPcj-CsD5j6eV.js +0 -1
  1133. package/dist/console/runtime/public/console/chunks/kotlin-BHE8CoV9-DhhofPvG.js +0 -1
  1134. package/dist/console/runtime/public/console/chunks/kusto-6FdaWTzR-C7mF5XQf.js +0 -1
  1135. package/dist/console/runtime/public/console/chunks/laserwave-C_8bwKvT.js +0 -1
  1136. package/dist/console/runtime/public/console/chunks/laserwave-DkfjiLxA-C_8bwKvT.js +0 -1
  1137. package/dist/console/runtime/public/console/chunks/latex-QHQNiZDD-fcyJN6QK.js +0 -1
  1138. package/dist/console/runtime/public/console/chunks/lean-BwOKScIt-CewbzKMR.js +0 -1
  1139. package/dist/console/runtime/public/console/chunks/less-BzbdhFUi-DVTAwKKz.js +0 -1
  1140. package/dist/console/runtime/public/console/chunks/less-DVTAwKKz.js +0 -1
  1141. package/dist/console/runtime/public/console/chunks/light-plus-DVQuIRkW.js +0 -1
  1142. package/dist/console/runtime/public/console/chunks/light-plus-DuO6rXxZ-DVQuIRkW.js +0 -1
  1143. package/dist/console/runtime/public/console/chunks/liquid-DYQ7uW5u-JGNMHTpg.js +0 -1
  1144. package/dist/console/runtime/public/console/chunks/llvm-uY68ROGz-Cm23YOpf.js +0 -1
  1145. package/dist/console/runtime/public/console/chunks/log-Dad54gsi-BNLmms1o.js +0 -1
  1146. package/dist/console/runtime/public/console/chunks/logo-DTXV8SKw-Cluzi2Zq.js +0 -1
  1147. package/dist/console/runtime/public/console/chunks/lua-BhkUWs1q-CVcL4bwV.js +0 -1
  1148. package/dist/console/runtime/public/console/chunks/luau-YC4aaMmR-FMPmPwt6.js +0 -1
  1149. package/dist/console/runtime/public/console/chunks/make-B2ukzWs3-Dixweg8N.js +0 -1
  1150. package/dist/console/runtime/public/console/chunks/markdown-BYOwaDjH.js +0 -1
  1151. package/dist/console/runtime/public/console/chunks/markdown-CkmxmzqY-BYOwaDjH.js +0 -1
  1152. package/dist/console/runtime/public/console/chunks/marko-BHWvxp04-U7nYXRKW.js +0 -1
  1153. package/dist/console/runtime/public/console/chunks/marko-DmV4Eg2F.js +0 -1
  1154. package/dist/console/runtime/public/console/chunks/material-theme-Bm3Qr25_.js +0 -1
  1155. package/dist/console/runtime/public/console/chunks/material-theme-C_YrwKEa-Bm3Qr25_.js +0 -1
  1156. package/dist/console/runtime/public/console/chunks/material-theme-darker-2IIEA8gg.js +0 -1
  1157. package/dist/console/runtime/public/console/chunks/material-theme-darker-DB3YVCla-2IIEA8gg.js +0 -1
  1158. package/dist/console/runtime/public/console/chunks/material-theme-lighter-D2fgNrBK-uhdI0v04.js +0 -1
  1159. package/dist/console/runtime/public/console/chunks/material-theme-lighter-uhdI0v04.js +0 -1
  1160. package/dist/console/runtime/public/console/chunks/material-theme-ocean-CHQ94UKr.js +0 -1
  1161. package/dist/console/runtime/public/console/chunks/material-theme-ocean-DVy172Rs-CHQ94UKr.js +0 -1
  1162. package/dist/console/runtime/public/console/chunks/material-theme-palenight-B5W6OYN7.js +0 -1
  1163. package/dist/console/runtime/public/console/chunks/material-theme-palenight-uMMwIfpG-B5W6OYN7.js +0 -1
  1164. package/dist/console/runtime/public/console/chunks/matlab-CfRK6IMC-D7qyCx1q.js +0 -1
  1165. package/dist/console/runtime/public/console/chunks/mdc-BVkdQPZX.js +0 -1
  1166. package/dist/console/runtime/public/console/chunks/mdc-Dg7VPYLa-CshLRYP7.js +0 -1
  1167. package/dist/console/runtime/public/console/chunks/mdx-BK9ZufRc-DQZ5AkYe.js +0 -1
  1168. package/dist/console/runtime/public/console/chunks/mdx-DQZ5AkYe.js +0 -1
  1169. package/dist/console/runtime/public/console/chunks/mermaid-r7OoIYpE-Bk4SNUv9.js +0 -1
  1170. package/dist/console/runtime/public/console/chunks/min-dark-BSWPekZh.js +0 -1
  1171. package/dist/console/runtime/public/console/chunks/min-dark-C7Ec8I_2-BSWPekZh.js +0 -1
  1172. package/dist/console/runtime/public/console/chunks/min-light-Be6foA7m-DDpmG2fV.js +0 -1
  1173. package/dist/console/runtime/public/console/chunks/min-light-DDpmG2fV.js +0 -1
  1174. package/dist/console/runtime/public/console/chunks/mipsasm-EL46Y4Xg-BMqwQI7S.js +0 -1
  1175. package/dist/console/runtime/public/console/chunks/mojo-YCzvCoMT-BgCJLMeH.js +0 -1
  1176. package/dist/console/runtime/public/console/chunks/monokai-CREPpJ3k-CdkpiU2Y.js +0 -1
  1177. package/dist/console/runtime/public/console/chunks/monokai-CdkpiU2Y.js +0 -1
  1178. package/dist/console/runtime/public/console/chunks/moonbit-B_9L5rST-CaWjb8XO.js +0 -1
  1179. package/dist/console/runtime/public/console/chunks/move-Dqi5fhOb-B1IS1UjX.js +0 -1
  1180. package/dist/console/runtime/public/console/chunks/narrat-D9rrR0H5-_X_XdTYD.js +0 -1
  1181. package/dist/console/runtime/public/console/chunks/nextflow-CgUAk9iA-CTMUe4Ca.js +0 -1
  1182. package/dist/console/runtime/public/console/chunks/nextflow-groovy-CdFFX-gF-DJMQeKeT.js +0 -1
  1183. package/dist/console/runtime/public/console/chunks/nginx-Q-E8IJvs-DiQO9reH.js +0 -1
  1184. package/dist/console/runtime/public/console/chunks/night-owl-CqqbiLON-DhmEMT88.js +0 -1
  1185. package/dist/console/runtime/public/console/chunks/night-owl-DhmEMT88.js +0 -1
  1186. package/dist/console/runtime/public/console/chunks/night-owl-light-B9vYgGRt-eJ-hLW7d.js +0 -1
  1187. package/dist/console/runtime/public/console/chunks/night-owl-light-eJ-hLW7d.js +0 -1
  1188. package/dist/console/runtime/public/console/chunks/nim-CNcTuF14-W9Ucwkhx.js +0 -1
  1189. package/dist/console/runtime/public/console/chunks/nix-Bm1Ax-Z3-IvuFDN5E.js +0 -1
  1190. package/dist/console/runtime/public/console/chunks/nord-BZ9DVmcN-Cb4Vim4T.js +0 -1
  1191. package/dist/console/runtime/public/console/chunks/nord-Cb4Vim4T.js +0 -1
  1192. package/dist/console/runtime/public/console/chunks/nushell-r7hBzeS_-DcLAeLz5.js +0 -1
  1193. package/dist/console/runtime/public/console/chunks/objective-c-6dJF64Dt-D1A_Heim.js +0 -1
  1194. package/dist/console/runtime/public/console/chunks/objective-cpp-_ooRQ-PY-BsSzOQcm.js +0 -1
  1195. package/dist/console/runtime/public/console/chunks/ocaml-vm1Y8An6-O90oeIOV.js +0 -1
  1196. package/dist/console/runtime/public/console/chunks/odin-vjOJSyfV-B1RWQWA5.js +0 -1
  1197. package/dist/console/runtime/public/console/chunks/one-dark-pro-CLwyXe_n.js +0 -1
  1198. package/dist/console/runtime/public/console/chunks/one-dark-pro-Ev8UPkf4-CLwyXe_n.js +0 -1
  1199. package/dist/console/runtime/public/console/chunks/one-light-CzxBC38_-D7Lr4KcI.js +0 -1
  1200. package/dist/console/runtime/public/console/chunks/one-light-D7Lr4KcI.js +0 -1
  1201. package/dist/console/runtime/public/console/chunks/openscad-jn-f1Ocl-BUDT5pXO.js +0 -1
  1202. package/dist/console/runtime/public/console/chunks/pascal-D8-gNZ2I-4ZHwLPI5.js +0 -1
  1203. package/dist/console/runtime/public/console/chunks/perl-Bbgb6Twx-CHGXAzGq.js +0 -1
  1204. package/dist/console/runtime/public/console/chunks/php-CBOR45_G-D5pyod9R.js +0 -1
  1205. package/dist/console/runtime/public/console/chunks/php-J5BBb-PR.js +0 -1
  1206. package/dist/console/runtime/public/console/chunks/pierre-code-view-DYpF5M8R-BiohFcCD.js +0 -1511
  1207. package/dist/console/runtime/public/console/chunks/pierre-dark-DDWDl8g6-CpLgRqie.js +0 -1
  1208. package/dist/console/runtime/public/console/chunks/pierre-dark-protanopia-deuteranopia-C35UMuvO-B35FxJx-.js +0 -1
  1209. package/dist/console/runtime/public/console/chunks/pierre-dark-soft-Bb-4-biO-kZQmAZld.js +0 -1
  1210. package/dist/console/runtime/public/console/chunks/pierre-dark-tritanopia-CIJISGWF-CpjhbsIL.js +0 -1
  1211. package/dist/console/runtime/public/console/chunks/pierre-dark-vibrant-8oZzB3gw-CpQYzh95.js +0 -1
  1212. package/dist/console/runtime/public/console/chunks/pierre-light-CWhW4NrH-CoaEpmwp.js +0 -1
  1213. package/dist/console/runtime/public/console/chunks/pierre-light-protanopia-deuteranopia-u0U7N4Hn-0fSaH845.js +0 -1
  1214. package/dist/console/runtime/public/console/chunks/pierre-light-soft-BCU6fuhO-lWLdNTOI.js +0 -1
  1215. package/dist/console/runtime/public/console/chunks/pierre-light-tritanopia-3c8Yx3co-CEbqgOJL.js +0 -1
  1216. package/dist/console/runtime/public/console/chunks/pierre-light-vibrant-Cwh332o_-D80Fkn33.js +0 -1
  1217. package/dist/console/runtime/public/console/chunks/pkl-C7lWzykI-ot-7Btpt.js +0 -1
  1218. package/dist/console/runtime/public/console/chunks/plastic-BGkJ2das-DQwYfKfQ.js +0 -1
  1219. package/dist/console/runtime/public/console/chunks/plastic-DQwYfKfQ.js +0 -1
  1220. package/dist/console/runtime/public/console/chunks/plsql-DCNXypXO-DGHpHOYJ.js +0 -1
  1221. package/dist/console/runtime/public/console/chunks/po-IjpR1yHO-BiJDBrnU.js +0 -1
  1222. package/dist/console/runtime/public/console/chunks/poimandres-CpnMgZuc-DRFjx7u4.js +0 -1
  1223. package/dist/console/runtime/public/console/chunks/poimandres-DRFjx7u4.js +0 -1
  1224. package/dist/console/runtime/public/console/chunks/polar-4pN1JrJ8-C7UOKdEL.js +0 -1
  1225. package/dist/console/runtime/public/console/chunks/postcss-BXeXVLqQ.js +0 -1
  1226. package/dist/console/runtime/public/console/chunks/postcss-D1gKt4z_-BXeXVLqQ.js +0 -1
  1227. package/dist/console/runtime/public/console/chunks/powerquery-SrvS_NBM-DNMTfnFr.js +0 -1
  1228. package/dist/console/runtime/public/console/chunks/powershell-CpTLv_ai-DshXNtvi.js +0 -1
  1229. package/dist/console/runtime/public/console/chunks/prisma-BWfa4-tI-BsRQq5mF.js +0 -1
  1230. package/dist/console/runtime/public/console/chunks/prolog-Bacii3Ue-iXnhIJG7.js +0 -1
  1231. package/dist/console/runtime/public/console/chunks/proto-ClkOcAW0-DB4EqR-F.js +0 -1
  1232. package/dist/console/runtime/public/console/chunks/pug-CfJcGJfh.js +0 -1
  1233. package/dist/console/runtime/public/console/chunks/pug-Cn_U_o_I-Cw4zFEpZ.js +0 -1
  1234. package/dist/console/runtime/public/console/chunks/puppet-CQlPp728-CDv2pdJW.js +0 -1
  1235. package/dist/console/runtime/public/console/chunks/purescript-CLpaGMbw-9MfHhQsQ.js +0 -1
  1236. package/dist/console/runtime/public/console/chunks/python-BjnOIxPe-gzcpVVnB.js +0 -1
  1237. package/dist/console/runtime/public/console/chunks/python-gzcpVVnB.js +0 -1
  1238. package/dist/console/runtime/public/console/chunks/qml-DNlrbxJT-B_IzAFFX.js +0 -1
  1239. package/dist/console/runtime/public/console/chunks/qmldir-Dz8ttxjf-DCQb3MpD.js +0 -1
  1240. package/dist/console/runtime/public/console/chunks/qss-Iltvkn1C-Fe1Jh2GI.js +0 -1
  1241. package/dist/console/runtime/public/console/chunks/r-Dzep-lPg.js +0 -1
  1242. package/dist/console/runtime/public/console/chunks/r-VqTZMNY_-EnO4GoeC.js +0 -1
  1243. package/dist/console/runtime/public/console/chunks/racket-DRv7j6nv-DcIDlBhZ.js +0 -1
  1244. package/dist/console/runtime/public/console/chunks/raku-DI9yGpeW-B3gFvitq.js +0 -1
  1245. package/dist/console/runtime/public/console/chunks/razor-Bw2un3e8-CtGvw0jo.js +0 -1
  1246. package/dist/console/runtime/public/console/chunks/red-CJ3rzSJv.js +0 -1
  1247. package/dist/console/runtime/public/console/chunks/red-EHiRGXSv-CJ3rzSJv.js +0 -1
  1248. package/dist/console/runtime/public/console/chunks/reg-DpJf71oO-CRGYupPL.js +0 -1
  1249. package/dist/console/runtime/public/console/chunks/regexp-5HbFqwky-C3xQXL6t.js +0 -1
  1250. package/dist/console/runtime/public/console/chunks/regexp-R83qIIH_.js +0 -1
  1251. package/dist/console/runtime/public/console/chunks/rel-BT0iIKKw-BtDbiS_P.js +0 -1
  1252. package/dist/console/runtime/public/console/chunks/riscv-CvzikGLb-Ckw8ddFX.js +0 -1
  1253. package/dist/console/runtime/public/console/chunks/ron-DzAo6FTJ-VUp2lXgN.js +0 -1
  1254. package/dist/console/runtime/public/console/chunks/rose-pine-BthvhNj6.js +0 -1
  1255. package/dist/console/runtime/public/console/chunks/rose-pine-DTI-z1Qp-BthvhNj6.js +0 -1
  1256. package/dist/console/runtime/public/console/chunks/rose-pine-dawn-BIiGXpWs-Dg85fqjY.js +0 -1
  1257. package/dist/console/runtime/public/console/chunks/rose-pine-dawn-Dg85fqjY.js +0 -1
  1258. package/dist/console/runtime/public/console/chunks/rose-pine-moon-DU4wt90U-hon4tzzS.js +0 -1
  1259. package/dist/console/runtime/public/console/chunks/rose-pine-moon-hon4tzzS.js +0 -1
  1260. package/dist/console/runtime/public/console/chunks/rosmsg-CyYq6XdT-CAekHB0j.js +0 -1
  1261. package/dist/console/runtime/public/console/chunks/rst-BZPDb03W-BDIwqmQR.js +0 -1
  1262. package/dist/console/runtime/public/console/chunks/ruby-BbVp0_gQ-BUOn3oxT.js +0 -1
  1263. package/dist/console/runtime/public/console/chunks/rust-COBzcmTx-Cfkwpbl8.js +0 -1
  1264. package/dist/console/runtime/public/console/chunks/sas-DSkdG4wF-BE4zxtJ7.js +0 -1
  1265. package/dist/console/runtime/public/console/chunks/sass-DI2zJwx7-DXrisJhu.js +0 -1
  1266. package/dist/console/runtime/public/console/chunks/sass-DXrisJhu.js +0 -1
  1267. package/dist/console/runtime/public/console/chunks/scala-CtSYTRYT-DKOlJaKm.js +0 -1
  1268. package/dist/console/runtime/public/console/chunks/scheme-D3A2QBtM-DQCgrYNe.js +0 -1
  1269. package/dist/console/runtime/public/console/chunks/scss-BQ7uffpQ-D2aPazKS.js +0 -1
  1270. package/dist/console/runtime/public/console/chunks/scss-DTeHeodw.js +0 -1
  1271. package/dist/console/runtime/public/console/chunks/sdbl-CdQg5gu1-bTVj8UrX.js +0 -1
  1272. package/dist/console/runtime/public/console/chunks/shaderlab-CWP9wBCf-C6U2tjWC.js +0 -1
  1273. package/dist/console/runtime/public/console/chunks/shellscript-B42c0JAn-D5OxpxEd.js +0 -1
  1274. package/dist/console/runtime/public/console/chunks/shellscript-CLZ0U2zV.js +0 -1
  1275. package/dist/console/runtime/public/console/chunks/shellsession-Oc9-NqAv-C1K_F4Is.js +0 -1
  1276. package/dist/console/runtime/public/console/chunks/slack-dark-BS2AOOdo-DnToyrRv.js +0 -1
  1277. package/dist/console/runtime/public/console/chunks/slack-dark-DnToyrRv.js +0 -1
  1278. package/dist/console/runtime/public/console/chunks/slack-ochin-B2OO5cIa.js +0 -1
  1279. package/dist/console/runtime/public/console/chunks/slack-ochin-Nc7Cucwk-B2OO5cIa.js +0 -1
  1280. package/dist/console/runtime/public/console/chunks/smalltalk-BEQkVl4K-B16xEiuN.js +0 -1
  1281. package/dist/console/runtime/public/console/chunks/snazzy-light-4G7pJPwS.js +0 -1
  1282. package/dist/console/runtime/public/console/chunks/snazzy-light-C2ghKZXY-4G7pJPwS.js +0 -1
  1283. package/dist/console/runtime/public/console/chunks/solarized-dark-DV17i1UV.js +0 -1
  1284. package/dist/console/runtime/public/console/chunks/solarized-dark-UHgjRWhr-DV17i1UV.js +0 -1
  1285. package/dist/console/runtime/public/console/chunks/solarized-light-B-Zcwve2-DSh2HLQt.js +0 -1
  1286. package/dist/console/runtime/public/console/chunks/solarized-light-DSh2HLQt.js +0 -1
  1287. package/dist/console/runtime/public/console/chunks/solidity-lB9VjfB9-CKzVLygQ.js +0 -1
  1288. package/dist/console/runtime/public/console/chunks/soy-tgh9u9aW-Cm_LtJoW.js +0 -1
  1289. package/dist/console/runtime/public/console/chunks/sparql-B4t0ZbEe-CXgkFCv7.js +0 -1
  1290. package/dist/console/runtime/public/console/chunks/splunk-xP_ZjUH2-BC2Px7Mm.js +0 -1
  1291. package/dist/console/runtime/public/console/chunks/sql-C7n9abzK.js +0 -1
  1292. package/dist/console/runtime/public/console/chunks/sql-CrPlEQn4-COghB3-E.js +0 -1
  1293. package/dist/console/runtime/public/console/chunks/ssh-config-DXFPABYp-BgfXC-Er.js +0 -1
  1294. package/dist/console/runtime/public/console/chunks/stata-D_KqT8cj-oQQpG6t_.js +0 -1
  1295. package/dist/console/runtime/public/console/chunks/stylus-B6D30XZt.js +0 -1
  1296. package/dist/console/runtime/public/console/chunks/stylus-ZZDn1yUO-B6D30XZt.js +0 -1
  1297. package/dist/console/runtime/public/console/chunks/surrealql-C0KhgoyZ-DqXNFH_A.js +0 -1
  1298. package/dist/console/runtime/public/console/chunks/svelte-CRpWSJAY.js +0 -1
  1299. package/dist/console/runtime/public/console/chunks/svelte-DuHT0xxw-Bs0TxuUS.js +0 -1
  1300. package/dist/console/runtime/public/console/chunks/swift-BTPQlRLK-DonLKvLd.js +0 -1
  1301. package/dist/console/runtime/public/console/chunks/synthwave-84-CPtGYwOz-nFMaYfgc.js +0 -1
  1302. package/dist/console/runtime/public/console/chunks/synthwave-84-nFMaYfgc.js +0 -1
  1303. package/dist/console/runtime/public/console/chunks/system-verilog-BEoxaBuU-DJ5XKQeo.js +0 -1
  1304. package/dist/console/runtime/public/console/chunks/systemd-DFbUltlW-BxMlprV5.js +0 -1
  1305. package/dist/console/runtime/public/console/chunks/talonscript-CLxaFu-b-CohzipZa.js +0 -1
  1306. package/dist/console/runtime/public/console/chunks/tasl-_AAbKiWM-DMoTqEGO.js +0 -1
  1307. package/dist/console/runtime/public/console/chunks/tcl-DLe0Tsfm-CZd0xW_V.js +0 -1
  1308. package/dist/console/runtime/public/console/chunks/templ-DF54artD-BPb_zNLV.js +0 -1
  1309. package/dist/console/runtime/public/console/chunks/terraform-v0KN9QQh-DswuEJGm.js +0 -1
  1310. package/dist/console/runtime/public/console/chunks/tex-Bbhb8xAP-9R8lE_en.js +0 -1
  1311. package/dist/console/runtime/public/console/chunks/tokyo-night-BKYoawWu-oM2G3aXe.js +0 -1
  1312. package/dist/console/runtime/public/console/chunks/tokyo-night-oM2G3aXe.js +0 -1
  1313. package/dist/console/runtime/public/console/chunks/toml-B7BHZIqX-CcmNWLt0.js +0 -1
  1314. package/dist/console/runtime/public/console/chunks/ts-tags-DH1AB-Ri-CgEe3BFX.js +0 -1
  1315. package/dist/console/runtime/public/console/chunks/ts-tags-DJjZLMnt.js +0 -1
  1316. package/dist/console/runtime/public/console/chunks/tsv-BorGVq2Z-sltzmVWM.js +0 -1
  1317. package/dist/console/runtime/public/console/chunks/tsx-B7QamQLF.js +0 -1
  1318. package/dist/console/runtime/public/console/chunks/tsx-BR8s1Lhs-DiW36VFk.js +0 -1
  1319. package/dist/console/runtime/public/console/chunks/turtle-BEG5g_eT-ByJddavk.js +0 -1
  1320. package/dist/console/runtime/public/console/chunks/tv-WsfYJXat.js +0 -1
  1321. package/dist/console/runtime/public/console/chunks/twig-DziFF7iU-DLOFbR4k.js +0 -1
  1322. package/dist/console/runtime/public/console/chunks/typescript-D8TR6ff2-CCKRkaRI.js +0 -1
  1323. package/dist/console/runtime/public/console/chunks/typescript-DzLO-qqB.js +0 -1
  1324. package/dist/console/runtime/public/console/chunks/typespec-C_R5TbvO-BRdr0IET.js +0 -1
  1325. package/dist/console/runtime/public/console/chunks/typst-BV9w0z8--DI99ib-x.js +0 -1
  1326. package/dist/console/runtime/public/console/chunks/v-DfbeXLo8-DETTlOr0.js +0 -1
  1327. package/dist/console/runtime/public/console/chunks/vala-BnnASFsX-zf12oZj6.js +0 -1
  1328. package/dist/console/runtime/public/console/chunks/vb-DU29mvss-Djn5o6TS.js +0 -1
  1329. package/dist/console/runtime/public/console/chunks/verilog-BW5U03XW-CiiDBU1e.js +0 -1
  1330. package/dist/console/runtime/public/console/chunks/vesper-ClvmKzqD-DdrHHSXu.js +0 -1
  1331. package/dist/console/runtime/public/console/chunks/vesper-DdrHHSXu.js +0 -1
  1332. package/dist/console/runtime/public/console/chunks/vhdl-Co2XFKY7-BroJfC0k.js +0 -1
  1333. package/dist/console/runtime/public/console/chunks/viml-BReTXeDA-DvXPmvsu.js +0 -1
  1334. package/dist/console/runtime/public/console/chunks/vitesse-black-BY6Qtyq--fwtXNY1n.js +0 -1
  1335. package/dist/console/runtime/public/console/chunks/vitesse-black-fwtXNY1n.js +0 -1
  1336. package/dist/console/runtime/public/console/chunks/vitesse-dark-BT-v_EgR-BZCL-v6S.js +0 -1
  1337. package/dist/console/runtime/public/console/chunks/vitesse-dark-BZCL-v6S.js +0 -1
  1338. package/dist/console/runtime/public/console/chunks/vitesse-light-Box8ZFz6-VbXTXTou.js +0 -1
  1339. package/dist/console/runtime/public/console/chunks/vitesse-light-VbXTXTou.js +0 -1
  1340. package/dist/console/runtime/public/console/chunks/vue-BRy8iDCZ-CL7P9CNz.js +0 -1
  1341. package/dist/console/runtime/public/console/chunks/vue-CQQ6_PvN.js +0 -1
  1342. package/dist/console/runtime/public/console/chunks/vue-html-B24bjO_3-BY2skbNe.js +0 -1
  1343. package/dist/console/runtime/public/console/chunks/vue-html-Ce5SCNOK.js +0 -1
  1344. package/dist/console/runtime/public/console/chunks/vue-vine-DKH1_YEZ.js +0 -1
  1345. package/dist/console/runtime/public/console/chunks/vue-vine-l7O7Mg81-CFWzX3HC.js +0 -1
  1346. package/dist/console/runtime/public/console/chunks/vue.runtime.esm-bundler-COh-O3z7.js +0 -3
  1347. package/dist/console/runtime/public/console/chunks/vyper-C6KGx0YU-CgoNMtux.js +0 -1
  1348. package/dist/console/runtime/public/console/chunks/wasm-BRCjOXGL-BnjxR4X6.js +0 -1
  1349. package/dist/console/runtime/public/console/chunks/wasm-BnjxR4X6.js +0 -1
  1350. package/dist/console/runtime/public/console/chunks/wasm-ByWQv1Qj.js +0 -1
  1351. package/dist/console/runtime/public/console/chunks/wasm-gNIKwGlD-ByWQv1Qj.js +0 -1
  1352. package/dist/console/runtime/public/console/chunks/wenyan-BeysbCrW-C8pVoKbM.js +0 -1
  1353. package/dist/console/runtime/public/console/chunks/wgsl-1s5rV5xS-BsKzXJz4.js +0 -1
  1354. package/dist/console/runtime/public/console/chunks/wgsl-BsKzXJz4.js +0 -1
  1355. package/dist/console/runtime/public/console/chunks/wikitext-wjhjmmzD-ClFFjSW2.js +0 -1
  1356. package/dist/console/runtime/public/console/chunks/wit-CeQiCbz_-DdvCle-K.js +0 -1
  1357. package/dist/console/runtime/public/console/chunks/wit-DdvCle-K.js +0 -1
  1358. package/dist/console/runtime/public/console/chunks/wolfram-CcZPfnLd-DLL8P-h_.js +0 -1
  1359. package/dist/console/runtime/public/console/chunks/xml-CduVPlYa-BZCwbgEk.js +0 -1
  1360. package/dist/console/runtime/public/console/chunks/xml-G-voesMw.js +0 -1
  1361. package/dist/console/runtime/public/console/chunks/xsl-BeH_vLTK-DeKk-5KU.js +0 -1
  1362. package/dist/console/runtime/public/console/chunks/yaml-Cb0uRU1q-CkSC4c4u.js +0 -1
  1363. package/dist/console/runtime/public/console/chunks/yaml-rwi0_p6S.js +0 -1
  1364. package/dist/console/runtime/public/console/chunks/zenscript-BoijL7rl-BnlCZFoB.js +0 -1
  1365. package/dist/console/runtime/public/console/chunks/zig-lTQvxhLD-CMLA9XwU.js +0 -1
  1366. package/dist/console/runtime/public/console/console-Bwq3z75a.css +0 -3
  1367. package/dist/console/runtime/public/console/console-Cl-xrMah.js +0 -1371
  1368. package/dist/console/runtime/server/blob.get.d.ts +0 -25
  1369. package/dist/console/runtime/server/blob.get.js +0 -74
  1370. package/dist/console/runtime/server/devframe.d.ts +0 -13
  1371. package/dist/console/runtime/server/devframe.js +0 -133
  1372. package/dist/console/runtime/server/kv.d.ts +0 -2
  1373. package/dist/console/runtime/server/kv.get.d.ts +0 -24
  1374. package/dist/console/runtime/server/kv.get.js +0 -236
  1375. package/dist/console/runtime/server/kv.js +0 -18
  1376. package/dist/console/runtime/server/page.get.d.ts +0 -6
  1377. package/dist/console/runtime/server/page.get.js +0 -33
  1378. package/dist/database/drizzle.d.ts +0 -16
  1379. package/dist/database/drizzle.js +0 -9
  1380. package/dist/database-CW-WjW4u.d.ts +0 -8
  1381. package/dist/definitions-BHmB22eM.d.ts +0 -7
  1382. package/dist/definitions-CfSmoS5G.d.ts +0 -17
  1383. package/dist/email/server.d.ts +0 -1
  1384. package/dist/email/server.js +0 -2
  1385. package/dist/env/presets.d.ts +0 -1
  1386. package/dist/env/presets.js +0 -2
  1387. package/dist/env/provider.d.ts +0 -1
  1388. package/dist/env/provider.js +0 -2
  1389. package/dist/env/schema.d.ts +0 -1
  1390. package/dist/env/schema.js +0 -2
  1391. package/dist/env/secret.d.ts +0 -1
  1392. package/dist/env/secret.js +0 -2
  1393. package/dist/index-B072hyCd.d.ts +0 -59
  1394. package/dist/internal-12r-XCbk.d.ts +0 -20
  1395. package/dist/internal-DzLLx0iR.js +0 -304
  1396. package/dist/invocations-qwMRTSy7.js +0 -364
  1397. package/dist/kv-DLGscNQ_.d.ts +0 -8
  1398. package/dist/request-DxBwxGnk.js +0 -72
  1399. package/dist/request-NErg_P5m.d.ts +0 -43
  1400. package/dist/runtime/node.d.ts +0 -1
  1401. package/dist/runtime/node.js +0 -2
  1402. package/dist/schedule/runtime/driver.d.ts +0 -1
  1403. package/dist/schedule/runtime/driver.js +0 -2
  1404. package/dist/search.get-ClTCn-mh.js +0 -100
  1405. package/dist/sections-7HoMOIGH.d.ts +0 -9
  1406. package/dist/sections-DVsqeLAF.d.ts +0 -100
  1407. package/dist/server-BFxDhCzA.d.ts +0 -78
  1408. package/dist/shell/providers/cloudflare.d.ts +0 -1
  1409. package/dist/shell/providers/cloudflare.js +0 -2
  1410. package/dist/source/content/client.d.ts +0 -1
  1411. package/dist/source/content/client.js +0 -2
  1412. package/dist/source/content.d.ts +0 -1
  1413. package/dist/source/content.js +0 -2
  1414. package/dist/source/file.d.ts +0 -1
  1415. package/dist/source/file.js +0 -2
  1416. package/dist/source/github.d.ts +0 -1
  1417. package/dist/source/github.js +0 -2
  1418. package/dist/source/glob.d.ts +0 -1
  1419. package/dist/source/glob.js +0 -2
  1420. package/dist/source/markdown.d.ts +0 -1
  1421. package/dist/source/markdown.js +0 -2
  1422. package/dist/src-XEJGHDr9.js +0 -5247
  1423. package/dist/types-BucGTJnk.js +0 -168
  1424. package/dist/ui/nuxt.d.ts +0 -3
  1425. package/dist/ui/nuxt.js +0 -3
  1426. package/dist/usage-CoZa_8fx.js +0 -361
  1427. package/dist/workspace/collections/client.d.ts +0 -1
  1428. package/dist/workspace/collections/client.js +0 -2
  1429. package/dist/workspace/collections.d.ts +0 -1
  1430. package/dist/workspace/collections.js +0 -2
  1431. package/dist/workspace/publish.d.ts +0 -1
  1432. package/dist/workspace/publish.js +0 -2
package/dist/doctor.js ADDED
@@ -0,0 +1,3096 @@
1
+ import { i as importOptionalOwner } from "./optional-owners-Crm6kVS5.js";
2
+ import { n as viteHubServerImports } from "./nuxt-server-imports-Lnaf5Fe-.js";
3
+ import { a as exports, i as dependencies, o as peerDependencies, r as removedViteHubOptions, t as readViteHubVersion } from "./version-DDRL_OYz.js";
4
+ import { dirname, relative, resolve } from "node:path";
5
+ import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
6
+ import * as v from "valibot";
7
+ import { createRule, defineDoctorDiagnostics, defineDoctorExtension, defineRulePack } from "vite-doctor/extension";
8
+ const viteHubDoctorDiagnostics = defineDoctorDiagnostics([
9
+ {
10
+ code: "VHUB0001",
11
+ ruleId: "vitehub/no-internal-imports"
12
+ },
13
+ {
14
+ code: "VHUB0002",
15
+ ruleId: "vitehub/no-server-imports-in-client"
16
+ },
17
+ {
18
+ code: "VHUB0003",
19
+ ruleId: "vitehub/destructure-result-tuples"
20
+ },
21
+ {
22
+ code: "VHUB0004",
23
+ ruleId: "vitehub/unseal-secret-env"
24
+ },
25
+ {
26
+ code: "VHUB0005",
27
+ ruleId: "vitehub/no-literal-credentials"
28
+ },
29
+ {
30
+ code: "VHUB0006",
31
+ ruleId: "vitehub/await-async-helpers"
32
+ },
33
+ {
34
+ code: "VHUB0007",
35
+ ruleId: "vitehub/load-provider-env"
36
+ },
37
+ {
38
+ code: "VHUB0008",
39
+ ruleId: "vitehub/check-rate-limit-decision"
40
+ },
41
+ {
42
+ code: "VHUB0009",
43
+ ruleId: "vitehub/rate-limiter-at-module-scope"
44
+ },
45
+ {
46
+ code: "VHUB0010",
47
+ ruleId: "vitehub/auth-runtime-options"
48
+ },
49
+ {
50
+ code: "VHUB0011",
51
+ ruleId: "vitehub/no-agent-connection-actor"
52
+ },
53
+ {
54
+ code: "VHUB0012",
55
+ ruleId: "vitehub/no-nested-blob-reference-schema"
56
+ },
57
+ {
58
+ code: "VHUB0013",
59
+ ruleId: "vitehub/known-definition-names"
60
+ },
61
+ {
62
+ code: "VHUB0014",
63
+ ruleId: "vitehub/definition-default-export"
64
+ },
65
+ {
66
+ code: "VHUB0015",
67
+ ruleId: "vitehub/definition-location"
68
+ },
69
+ {
70
+ code: "VHUB0016",
71
+ ruleId: "vitehub/queue-payload-options"
72
+ },
73
+ {
74
+ code: "VHUB0017",
75
+ ruleId: "vitehub/no-module-scope-dispatch"
76
+ },
77
+ {
78
+ code: "VHUB0018",
79
+ ruleId: "vitehub/no-destructure-non-tuples"
80
+ },
81
+ {
82
+ code: "VHUB0019",
83
+ ruleId: "vitehub/check-response-results"
84
+ },
85
+ {
86
+ code: "VHUB0020",
87
+ ruleId: "vitehub/workflow-step-names"
88
+ },
89
+ {
90
+ code: "VHUB0021",
91
+ ruleId: "vitehub/valid-schedule-cron"
92
+ },
93
+ {
94
+ code: "VHUB0022",
95
+ ruleId: "vitehub/manual-schedule-run"
96
+ },
97
+ {
98
+ code: "VHUB0023",
99
+ ruleId: "vitehub/valid-channel"
100
+ },
101
+ {
102
+ code: "VHUB0024",
103
+ ruleId: "vitehub/realtime-carets"
104
+ },
105
+ {
106
+ code: "VHUB0025",
107
+ ruleId: "vitehub/realtime-persistence"
108
+ },
109
+ {
110
+ code: "VHUB0026",
111
+ ruleId: "vitehub/forge-error-imports"
112
+ },
113
+ {
114
+ code: "VHUB0027",
115
+ ruleId: "vitehub/sandbox-runtime-options"
116
+ },
117
+ {
118
+ code: "VHUB0029",
119
+ ruleId: "vitehub/rate-limit-capability-limiter"
120
+ },
121
+ {
122
+ code: "VHUB0030",
123
+ ruleId: "vitehub/no-vitehub-plugin-in-nuxt"
124
+ },
125
+ {
126
+ code: "VHUB0031",
127
+ ruleId: "vitehub/valid-vitehub-options"
128
+ },
129
+ {
130
+ code: "VHUB0032",
131
+ ruleId: "vitehub/no-nuxthub-leftovers"
132
+ },
133
+ {
134
+ code: "VHUB0033",
135
+ ruleId: "vitehub/no-removed-apis"
136
+ },
137
+ {
138
+ code: "VHUB0034",
139
+ ruleId: "vitehub/markdown-file-path"
140
+ },
141
+ {
142
+ code: "VHUB0035",
143
+ ruleId: "vitehub/comments-entry"
144
+ },
145
+ {
146
+ code: "VHUB0036",
147
+ ruleId: "vitehub/prefer-vite-hub-imports"
148
+ }
149
+ ], { docsBase: (code) => `https://vitehub.dev/docs/reference/doctor-rules#${code.toLowerCase()}` });
150
+ const diagnostics = viteHubDoctorDiagnostics.diagnostics;
151
+ //#endregion
152
+ //#region src/doctor/inventory.ts
153
+ /** Name of the ViteHub Project Inventory contribution, read by rules through `viteHubInventory()`. */
154
+ const inventoryName = "vite-hub";
155
+ const definitionKinds = [
156
+ "agent",
157
+ "browser",
158
+ "channel",
159
+ "connection",
160
+ "database",
161
+ "queue",
162
+ "realtime",
163
+ "sandboxTask",
164
+ "schedule",
165
+ "workflow"
166
+ ];
167
+ const definitionSchema = v.object({
168
+ name: v.string(),
169
+ file: v.string(),
170
+ steps: v.optional(v.array(v.string())),
171
+ manual: v.optional(v.boolean()),
172
+ imports: v.optional(v.array(v.string()))
173
+ });
174
+ const inventorySchema = v.object({
175
+ /** Definitions that each owner package discovers. A kind is missing when its discovery failed. */
176
+ definitions: v.record(v.string(), v.array(definitionSchema)),
177
+ /** Server Env facts from the generated `.vitehub/env/description.mjs`. Missing before the first dev or build run. */
178
+ env: v.optional(v.object({
179
+ secret: v.array(v.string()),
180
+ provider: v.array(v.string())
181
+ })),
182
+ /** Server directories of the app and its Nuxt layers, relative to the project root. */
183
+ serverDirs: v.optional(v.array(v.string())),
184
+ /** Direct dependencies whose installed `package.json` needs `@nuxthub/core`. */
185
+ nuxtHubDependents: v.optional(v.array(v.object({
186
+ name: v.string(),
187
+ field: v.picklist(["peerDependencies", "dependencies"])
188
+ })))
189
+ });
190
+ const emptyInventory = { definitions: {} };
191
+ function viteHubInventory(ctx) {
192
+ const value = ctx.project.inventory?.[inventoryName];
193
+ return v.is(inventorySchema, value) ? value : emptyInventory;
194
+ }
195
+ /** The Definition kind and name for the current file, when an owner package discovers it. */
196
+ function discoveredDefinition(ctx) {
197
+ const { definitions } = viteHubInventory(ctx);
198
+ for (const kind of definitionKinds) {
199
+ const found = definitions[kind]?.find((definition) => definition.file === ctx.file.relativePath);
200
+ if (found) return {
201
+ kind,
202
+ name: found.name
203
+ };
204
+ }
205
+ }
206
+ const discoverers = {
207
+ agent: async (root, serverDirs) => (await importOptionalOwner("@vite-hub/agent", () => import("@vite-hub/agent/vite")))?.listAgentDefinitionFiles(root, serverDirs) ?? [],
208
+ browser: async (root, serverDirs) => (await importOptionalOwner("@vite-hub/browser", () => import("@vite-hub/browser/vite")))?.discoverBrowserDefinitions({
209
+ rootDir: root,
210
+ serverDirs
211
+ }) ?? [],
212
+ channel: async (root, serverDirs) => (await importOptionalOwner("@vite-hub/channels", () => import("@vite-hub/channels/vite")))?.discoverChannelDefinitions({
213
+ rootDir: root,
214
+ serverDirs
215
+ }) ?? [],
216
+ connection: async (root, serverDirs) => (await importOptionalOwner("@vite-hub/connections", () => import("@vite-hub/connections/vite")))?.discoverConnectionDefinitions({
217
+ rootDir: root,
218
+ serverDirs
219
+ }) ?? [],
220
+ database: async (root, serverDirs) => (await importOptionalOwner("@vite-hub/database", () => import("@vite-hub/database/config")))?.discoverDatabaseDefinitions(root, { serverDirs }) ?? [],
221
+ queue: async (root, serverDirs) => (await importOptionalOwner("@vite-hub/queue", () => import("@vite-hub/queue/vite")))?.discoverQueueDefinitions({
222
+ rootDir: root,
223
+ serverDirs
224
+ }) ?? [],
225
+ realtime: async (root, serverDirs) => (await importOptionalOwner("@vite-hub/realtime", () => import("@vite-hub/realtime/vite")))?.discoverRealtimeDefinitions(root, serverDirs) ?? [],
226
+ sandboxTask: async (root) => (await importOptionalOwner("@vite-hub/sandbox", () => import("@vite-hub/sandbox/task/vite")))?.discoverSandboxTaskDefinitions({ rootDir: root }) ?? [],
227
+ schedule: async (root, serverDirs) => (await importOptionalOwner("@vite-hub/schedule", () => import("@vite-hub/schedule/vite")))?.discoverScheduleDefinitions({
228
+ rootDir: root,
229
+ serverDirs
230
+ }) ?? [],
231
+ workflow: async (root, serverDirs) => (await importOptionalOwner("@vite-hub/workflow", () => import("@vite-hub/workflow/vite")))?.discoverWorkflowDefinitions({
232
+ rootDir: root,
233
+ serverDirs
234
+ }) ?? []
235
+ };
236
+ function isDirectory(path) {
237
+ return existsSync(path) && statSync(path).isDirectory();
238
+ }
239
+ /**
240
+ * The server directory of the app and of each Nuxt layer. Doctor resolves Nuxt layers, including `serverDir` and
241
+ * `extends`. Without them, it uses `server/` and the `server/` directory of each layer under `layers/`.
242
+ */
243
+ function serverDirsOf(project) {
244
+ const root = project.root;
245
+ const appServerDir = configuredServerDir(root);
246
+ const isApp = (layer) => resolve(layer.root) === resolve(root);
247
+ const layers = [...project.nuxt?.layers ?? []].sort((a, b) => Number(isApp(b)) - Number(isApp(a)));
248
+ const resolved = layers.map((layer) => resolve(root, layer.serverDir ?? (isApp(layer) ? appServerDir : void 0) ?? resolve(layer.root, "server")));
249
+ if (resolved.length && !layers.some(isApp)) resolved.unshift(resolve(root, appServerDir ?? "server"));
250
+ if (resolved.length) return [...new Set(resolved)];
251
+ if (project.framework !== "nuxt") return [resolve(root, appServerDir ?? "server")];
252
+ const layerRoot = resolve(root, "layers");
253
+ const layerDirs = isDirectory(layerRoot) ? readdirSync(layerRoot, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => resolve(layerRoot, entry.name, "server")) : [];
254
+ return [resolve(root, appServerDir ?? "server"), ...layerDirs.filter(isDirectory)];
255
+ }
256
+ function configuredServerDir(root) {
257
+ for (const name of [
258
+ "nuxt.config.ts",
259
+ "nuxt.config.mts",
260
+ "nuxt.config.js",
261
+ "nuxt.config.mjs"
262
+ ]) {
263
+ const file = resolve(root, name);
264
+ if (!existsSync(file)) continue;
265
+ const match = /\bserverDir\s*:\s*["'`]([^"'`]+)["'`]/.exec(readFileSync(file, "utf8"));
266
+ return match?.[1] && resolve(root, match[1]);
267
+ }
268
+ }
269
+ const describeSchema = v.object({ entries: v.array(v.object({
270
+ path: v.optional(v.string()),
271
+ source: v.string(),
272
+ secret: v.boolean()
273
+ })) });
274
+ /** Reads Server Env paths from the generated description module, as paths below `env.server`. */
275
+ function readEnvFacts(root) {
276
+ const file = resolve(root, ".vitehub/env/description.mjs");
277
+ if (!existsSync(file)) return;
278
+ const encoded = /JSON\.parse\(("(?:[^"\\]|\\.)*")\)/.exec(readFileSync(file, "utf8"))?.[1];
279
+ if (!encoded) return;
280
+ const description = JSON.parse(JSON.parse(encoded));
281
+ if (!v.is(describeSchema, description)) return;
282
+ const paths = (predicate) => description.entries.filter(predicate).flatMap((entry) => entry.path?.startsWith("env.server.") ? [entry.path.slice(11)] : []);
283
+ return {
284
+ secret: paths((entry) => entry.secret),
285
+ provider: paths((entry) => entry.source === "provider")
286
+ };
287
+ }
288
+ const importSpecifier = /(?:\bfrom|\bimport)\s*\(?\s*["'](\.{1,2}\/[^"']+)["']/g;
289
+ /** A Definition file can re-export a module from elsewhere, which then becomes the Definition. */
290
+ function relativeImports(root, file) {
291
+ if (!existsSync(file) || !statSync(file).isFile()) return {};
292
+ const imports = [...readFileSync(file, "utf8").matchAll(importSpecifier)].map((match) => relative(root, resolve(dirname(file), match[1] ?? "")).replaceAll("\\", "/").replace(/\.(?:c|m)?[jt]sx?$/, ""));
293
+ return imports.length ? { imports } : {};
294
+ }
295
+ function isRecord(value) {
296
+ return typeof value === "object" && value !== null && !Array.isArray(value);
297
+ }
298
+ function readJson(file) {
299
+ try {
300
+ const value = JSON.parse(readFileSync(file, "utf8"));
301
+ return isRecord(value) ? value : void 0;
302
+ } catch {
303
+ return;
304
+ }
305
+ }
306
+ /** The installed `package.json` of `name`, from the nearest `node_modules` at or above `root`. */
307
+ function installedManifest(root, name) {
308
+ for (let dir = resolve(root);; dir = dirname(dir)) {
309
+ const file = resolve(dir, "node_modules", name, "package.json");
310
+ if (existsSync(file)) return readJson(file);
311
+ if (dirname(dir) === dir) return void 0;
312
+ }
313
+ }
314
+ /** Direct dependencies of the app that need `@nuxthub/core`. pnpm installs it for them, and their module starts it. */
315
+ function readNuxtHubDependents(root) {
316
+ const manifest = readJson(resolve(root, "package.json"));
317
+ if (!manifest) return [];
318
+ const names = new Set(["dependencies", "devDependencies"].flatMap((field) => {
319
+ const value = manifest[field];
320
+ return isRecord(value) ? Object.keys(value) : [];
321
+ }));
322
+ names.delete("@nuxthub/core");
323
+ return [...names].sort().flatMap((name) => {
324
+ const installed = installedManifest(root, name);
325
+ const field = ["peerDependencies", "dependencies"].find((key) => {
326
+ const dependencies = installed?.[key];
327
+ return isRecord(dependencies) && Object.hasOwn(dependencies, "@nuxthub/core");
328
+ });
329
+ return field ? [{
330
+ name,
331
+ field
332
+ }] : [];
333
+ });
334
+ }
335
+ const viteHubInventoryContributor = {
336
+ name: inventoryName,
337
+ async contribute(project) {
338
+ const root = project.root;
339
+ const serverDirs = serverDirsOf(project);
340
+ const definitions = {};
341
+ await Promise.all(definitionKinds.map(async (kind) => {
342
+ try {
343
+ const found = await discoverers[kind](root, serverDirs);
344
+ const path = (file) => relative(root, file).replaceAll("\\", "/");
345
+ definitions[kind] = found.map((definition) => ({
346
+ name: definition.name,
347
+ file: path(definition.handler),
348
+ ...definition.steps?.length ? { steps: definition.steps.map(path) } : {},
349
+ ...definition.manual === void 0 ? {} : { manual: definition.manual },
350
+ ...relativeImports(root, definition.handler)
351
+ }));
352
+ } catch {}
353
+ }));
354
+ let env;
355
+ try {
356
+ env = readEnvFacts(root);
357
+ } catch {
358
+ env = void 0;
359
+ }
360
+ const nuxtHubDependents = readNuxtHubDependents(root);
361
+ return {
362
+ definitions,
363
+ serverDirs: serverDirs.map((dir) => relative(root, dir).replaceAll("\\", "/")),
364
+ ...env ? { env } : {},
365
+ ...nuxtHubDependents.length ? { nuxtHubDependents } : {}
366
+ };
367
+ }
368
+ };
369
+ //#endregion
370
+ //#region src/doctor/ast.ts
371
+ const astNodeSchema = v.looseObject({ type: v.string() });
372
+ const identifierSchema = v.object({
373
+ type: v.literal("Identifier"),
374
+ name: v.string()
375
+ });
376
+ const stringLiteralSchema = v.object({
377
+ type: v.literal("Literal"),
378
+ value: v.string()
379
+ });
380
+ const templateValueSchema = v.object({ cooked: v.string() });
381
+ const wrapperSchema = v.object({
382
+ type: v.picklist([
383
+ "ParenthesizedExpression",
384
+ "TSAsExpression",
385
+ "TSNonNullExpression",
386
+ "TSSatisfiesExpression",
387
+ "TSTypeAssertion",
388
+ "ChainExpression"
389
+ ]),
390
+ expression: v.unknown()
391
+ });
392
+ const moduleSourceSchema = v.object({
393
+ type: v.picklist([
394
+ "ImportDeclaration",
395
+ "ExportNamedDeclaration",
396
+ "ExportAllDeclaration",
397
+ "ImportExpression"
398
+ ]),
399
+ source: v.object({ value: v.string() }),
400
+ importKind: v.optional(v.string()),
401
+ exportKind: v.optional(v.string()),
402
+ specifiers: v.optional(v.array(v.object({
403
+ importKind: v.optional(v.string()),
404
+ exportKind: v.optional(v.string())
405
+ })))
406
+ });
407
+ const importDeclarationSchema = v.object({
408
+ type: v.literal("ImportDeclaration"),
409
+ importKind: v.optional(v.string()),
410
+ source: v.object({ value: v.string() }),
411
+ specifiers: v.array(v.object({
412
+ type: v.string(),
413
+ importKind: v.optional(v.string()),
414
+ imported: v.optional(v.object({
415
+ type: v.string(),
416
+ name: v.optional(v.string()),
417
+ value: v.optional(v.string())
418
+ })),
419
+ local: identifierSchema
420
+ }))
421
+ });
422
+ function isNode(value) {
423
+ return v.is(astNodeSchema, value);
424
+ }
425
+ function isNodeType(value, type) {
426
+ return isNode(value) && value.type === type;
427
+ }
428
+ function isIdentifier(value, name) {
429
+ return v.is(identifierSchema, value) && (name === void 0 || value.name === name);
430
+ }
431
+ /** Removes parentheses, type assertions, `!`, and optional chains around an expression. */
432
+ function unwrap(node) {
433
+ return v.is(wrapperSchema, node) ? unwrap(node.expression) : node;
434
+ }
435
+ const parents = /* @__PURE__ */ new WeakMap();
436
+ function parentOf(node) {
437
+ if (!isNode(node)) return;
438
+ if (isNode(node.parent)) return node.parent;
439
+ const linked = Reflect.get(node, "__doctorParent");
440
+ return isNode(linked) ? linked : parents.get(node);
441
+ }
442
+ /** Returns the first parent that is not a wrapper from `unwrap()`. */
443
+ function semanticParent(node) {
444
+ let child = node;
445
+ let parent = parentOf(node);
446
+ while (parent && v.is(wrapperSchema, parent)) {
447
+ child = parent;
448
+ parent = parentOf(parent);
449
+ }
450
+ return {
451
+ parent,
452
+ child
453
+ };
454
+ }
455
+ function stringValue(node) {
456
+ const target = unwrap(node);
457
+ if (v.is(stringLiteralSchema, target)) return target.value;
458
+ if (isNodeType(target, "TemplateLiteral") && Array.isArray(target.expressions) && target.expressions.length === 0 && Array.isArray(target.quasis) && target.quasis.length === 1) {
459
+ const quasi = target.quasis[0];
460
+ if (isNode(quasi) && v.is(templateValueSchema, quasi.value)) return quasi.value.cooked;
461
+ }
462
+ }
463
+ function numberValue(node) {
464
+ const target = unwrap(node);
465
+ if (isNodeType(target, "Literal") && typeof target.value === "number") return target.value;
466
+ if (isNodeType(target, "UnaryExpression") && target.operator === "-") {
467
+ const value = numberValue(target.argument);
468
+ return value === void 0 ? void 0 : -value;
469
+ }
470
+ }
471
+ function booleanValue(node) {
472
+ const target = unwrap(node);
473
+ if (isNodeType(target, "Literal") && typeof target.value === "boolean") return target.value;
474
+ }
475
+ /** The static name of a property key: `a`, `"a"`, or `["a"]`. */
476
+ function propertyName(property) {
477
+ if (!isNode(property) || property.type !== "Property" && property.type !== "PropertyDefinition" && property.type !== "MethodDefinition") return;
478
+ if (property.computed !== true && isIdentifier(property.key)) return property.key.name;
479
+ return stringValue(property.key);
480
+ }
481
+ /** The properties of an object literal, including spreads, in source order. */
482
+ function objectProperties(node) {
483
+ const target = unwrap(node);
484
+ if (!isNodeType(target, "ObjectExpression") || !Array.isArray(target.properties)) return [];
485
+ return target.properties.filter(isNode);
486
+ }
487
+ function objectProperty(node, name) {
488
+ return objectProperties(node).findLast((property) => propertyName(property) === name);
489
+ }
490
+ function objectValue(node, name) {
491
+ return objectProperty(node, name)?.value;
492
+ }
493
+ function callArguments(node) {
494
+ const target = unwrap(node);
495
+ return (isNodeType(target, "CallExpression") || isNodeType(target, "NewExpression")) && Array.isArray(target.arguments) ? target.arguments : [];
496
+ }
497
+ /** Static member path of an expression, such as `["blob", "media", "put"]` for `blob.media.put`. */
498
+ function memberPath(node) {
499
+ const target = unwrap(node);
500
+ if (isIdentifier(target)) return [target.name];
501
+ if (!isNodeType(target, "MemberExpression")) return;
502
+ const object = memberPath(target.object);
503
+ if (!object) return;
504
+ const property = target.computed === true ? stringValue(target.property) : isIdentifier(target.property) ? target.property.name : void 0;
505
+ return property === void 0 ? void 0 : [...object, property];
506
+ }
507
+ /** The innermost Identifier at the root of a member chain or call chain: `kv` in `kv.store("a").get`. */
508
+ function chainRoot(node) {
509
+ const target = unwrap(node);
510
+ if (isIdentifier(target)) return target;
511
+ if (isNodeType(target, "MemberExpression")) return chainRoot(target.object);
512
+ if (isNodeType(target, "CallExpression")) return chainRoot(target.callee);
513
+ }
514
+ function moduleSpecifier(node) {
515
+ if (!v.is(moduleSourceSchema, node)) return;
516
+ const specifiers = node.specifiers ?? [];
517
+ return {
518
+ specifier: node.source.value,
519
+ typeOnly: node.importKind === "type" || node.exportKind === "type" || specifiers.length > 0 && specifiers.every((specifier) => specifier.importKind === "type" || specifier.exportKind === "type")
520
+ };
521
+ }
522
+ /** Visitors for every node that names a module: an import, a re-export, and `import()`. */
523
+ function moduleSourceVisitors(visit) {
524
+ const handler = (node) => {
525
+ const source = moduleSpecifier(node);
526
+ if (source && isNode(node)) visit(node, source);
527
+ };
528
+ return {
529
+ ImportDeclaration: handler,
530
+ ExportNamedDeclaration: handler,
531
+ ExportAllDeclaration: handler,
532
+ ImportExpression: handler
533
+ };
534
+ }
535
+ /**
536
+ * Maps a ViteHub import path to one name for the owner package and the `vite-hub` facade:
537
+ * `vite-hub/queue` and `@vite-hub/queue` both return `queue`.
538
+ */
539
+ function vitehubModule(specifier) {
540
+ return /^(?:vite-hub|@vite-hub)\/(.+)$/.exec(specifier)?.[1];
541
+ }
542
+ function isFunctionNode(node) {
543
+ return isNode(node) && [
544
+ "FunctionDeclaration",
545
+ "FunctionExpression",
546
+ "ArrowFunctionExpression"
547
+ ].includes(node.type);
548
+ }
549
+ /** The nearest enclosing function, or `undefined` when the node runs at module scope. */
550
+ function enclosingFunction(node) {
551
+ let current = parentOf(node);
552
+ while (current) {
553
+ if (isFunctionNode(current)) return current;
554
+ if (current.type === "MethodDefinition" || current.type === "PropertyDefinition" && current.static !== true) return current;
555
+ current = parentOf(current);
556
+ }
557
+ }
558
+ function namespaceIdentifier(node) {
559
+ if (isIdentifier(node)) return node;
560
+ if (isNodeType(node, "TSQualifiedName")) return namespaceIdentifier(node.left);
561
+ }
562
+ function instantiatesNamespace(node) {
563
+ if (!isNode(node) || node.declare === true) return false;
564
+ switch (node.type) {
565
+ case "TSInterfaceDeclaration":
566
+ case "TSTypeAliasDeclaration":
567
+ case "TSImportEqualsDeclaration": return false;
568
+ case "TSModuleDeclaration": return Boolean(namespaceIdentifier(node.id)) && instantiatesNamespace(node.body);
569
+ case "TSModuleBlock": return Array.isArray(node.body) && node.body.some(instantiatesNamespace);
570
+ case "ExportNamedDeclaration":
571
+ if (isNodeType(node.declaration, "TSImportEqualsDeclaration")) return node.exportKind !== "type" && node.declaration.importKind !== "type";
572
+ return node.exportKind !== "type" && (node.declaration ? instantiatesNamespace(node.declaration) : Array.isArray(node.specifiers) && node.specifiers.some((specifier) => isNode(specifier) && specifier.exportKind !== "type"));
573
+ default: return true;
574
+ }
575
+ }
576
+ const scopeCreatingTypes = /* @__PURE__ */ new Set([
577
+ "BlockStatement",
578
+ "CatchClause",
579
+ "ForStatement",
580
+ "ForInStatement",
581
+ "ForOfStatement",
582
+ "SwitchStatement",
583
+ "ClassDeclaration",
584
+ "ClassExpression",
585
+ "StaticBlock"
586
+ ]);
587
+ /** Collects bindings for every scope first, so a use can resolve to a declaration later in its scope. */
588
+ function buildScopes(root) {
589
+ const scopes = /* @__PURE__ */ new WeakMap();
590
+ const rootScope = {
591
+ functionScope: true,
592
+ bindings: /* @__PURE__ */ new Map()
593
+ };
594
+ function bind(pattern, scope, binding = {}) {
595
+ if (!isNode(pattern)) return;
596
+ const inner = binding.declaration ? { declaration: binding.declaration } : {};
597
+ switch (pattern.type) {
598
+ case "Identifier":
599
+ if (isIdentifier(pattern)) scope.bindings.set(pattern.name, binding);
600
+ break;
601
+ case "TSParameterProperty":
602
+ bind(pattern.parameter, scope, binding);
603
+ break;
604
+ case "RestElement":
605
+ bind(pattern.argument, scope, inner);
606
+ break;
607
+ case "AssignmentPattern":
608
+ bind(pattern.left, scope, inner);
609
+ break;
610
+ case "ArrayPattern":
611
+ if (Array.isArray(pattern.elements)) for (const element of pattern.elements) bind(element, scope, inner);
612
+ break;
613
+ case "ObjectPattern": if (Array.isArray(pattern.properties)) {
614
+ for (const property of pattern.properties) if (isNode(property)) bind(property.type === "RestElement" ? property.argument : property.value, scope, inner);
615
+ }
616
+ }
617
+ }
618
+ function walk(node, enclosing, parent, ambient = false) {
619
+ if (!isNode(node)) return;
620
+ if (parent) parents.set(node, parent);
621
+ ambient ||= node.declare === true || node.type === "TSModuleDeclaration" && !namespaceIdentifier(node.id);
622
+ if (node.type === "FunctionDeclaration" || node.type === "ClassDeclaration") bind(node.id, enclosing, { declaration: node });
623
+ if (node.type === "TSModuleDeclaration" && !ambient && instantiatesNamespace(node)) bind(namespaceIdentifier(node.id), enclosing);
624
+ const isFunction = isFunctionNode(node);
625
+ const isModule = node.type === "TSModuleDeclaration" || node.type === "TSModuleBlock";
626
+ const scope = isFunction || isModule || scopeCreatingTypes.has(node.type) ? {
627
+ parent: enclosing,
628
+ functionScope: isFunction || isModule || node.type === "StaticBlock",
629
+ bindings: /* @__PURE__ */ new Map()
630
+ } : enclosing;
631
+ scopes.set(node, scope);
632
+ if (isFunction) {
633
+ if (node.type === "FunctionExpression") bind(node.id, scope);
634
+ if (Array.isArray(node.params)) for (const param of node.params) bind(param, scope);
635
+ }
636
+ if (node.type === "ClassExpression" || node.type === "ClassDeclaration") bind(node.id, scope);
637
+ if (node.type === "CatchClause") bind(node.param, scope);
638
+ if (v.is(importDeclarationSchema, node)) for (const specifier of node.specifiers) {
639
+ const name = specifier.type === "ImportDefaultSpecifier" ? "default" : specifier.type === "ImportNamespaceSpecifier" ? "*" : specifier.imported?.name ?? specifier.imported?.value ?? specifier.local.name;
640
+ bind(specifier.local, scope, {
641
+ origin: {
642
+ source: node.source.value,
643
+ name
644
+ },
645
+ declaration: node
646
+ });
647
+ }
648
+ if (node.type === "VariableDeclarator") {
649
+ let target = scope;
650
+ if (parent?.kind === "var") while (!target.functionScope && target.parent) target = target.parent;
651
+ bind(node.id, target, {
652
+ init: node.init,
653
+ declaration: node
654
+ });
655
+ }
656
+ for (const [key, value] of Object.entries(node)) {
657
+ if (key === "parent") continue;
658
+ if (Array.isArray(value)) for (const child of value) walk(child, scope, node, ambient);
659
+ else walk(value, scope, node, ambient);
660
+ }
661
+ }
662
+ walk(root, rootScope);
663
+ return scopes;
664
+ }
665
+ const scopeIndexes = /* @__PURE__ */ new WeakMap();
666
+ function scopeIndex(ctx) {
667
+ const root = ctx.file.scriptAst;
668
+ if (!root) return { lookup: () => void 0 };
669
+ const cached = scopeIndexes.get(root);
670
+ if (cached) return cached;
671
+ const scopes = buildScopes(root);
672
+ const index = { lookup(node, name) {
673
+ let scope = scopes.get(node);
674
+ while (scope) {
675
+ const binding = scope.bindings.get(name);
676
+ if (binding) return binding;
677
+ scope = scope.parent;
678
+ }
679
+ } };
680
+ scopeIndexes.set(root, index);
681
+ return index;
682
+ }
683
+ /** Auto-imports that `vite-hub/nuxt` can register for Nitro server code. */
684
+ const nuxtServerAutoImports = new Map(Object.values(viteHubServerImports).flatMap((sources) => Object.entries(sources).flatMap(([source, names]) => names.map((name) => [name, {
685
+ source,
686
+ name
687
+ }]))));
688
+ function isServerFile(path) {
689
+ return /(?:^|\/)server\//.test(path);
690
+ }
691
+ function isTestFile(path) {
692
+ return /(?:^|\/)(?:test|tests|__tests__|fixtures?)\//.test(path) || /\.(?:test|spec|test-d)\.[^/]+$/.test(path);
693
+ }
694
+ const resolvers = /* @__PURE__ */ new WeakMap();
695
+ function resolver(ctx) {
696
+ const root = ctx.file.scriptAst;
697
+ const cached = root ? resolvers.get(root) : void 0;
698
+ if (cached && cached.ctx.file.path === ctx.file.path) return cached;
699
+ const scopes = scopeIndex(ctx);
700
+ const autoImports = ctx.project.framework === "nuxt" && isServerFile(ctx.file.relativePath) ? nuxtServerAutoImports : /* @__PURE__ */ new Map();
701
+ function binding(node) {
702
+ const target = unwrap(node);
703
+ return isIdentifier(target) ? scopes.lookup(target, target.name) : void 0;
704
+ }
705
+ function originOf(node, seen) {
706
+ const found = scopes.lookup(node, node.name);
707
+ if (!found) {
708
+ const auto = autoImports.get(node.name);
709
+ return auto ? {
710
+ origin: auto,
711
+ rest: []
712
+ } : void 0;
713
+ }
714
+ if (found.origin) return {
715
+ origin: found.origin,
716
+ rest: []
717
+ };
718
+ if (seen.has(found)) return;
719
+ seen.add(found);
720
+ const init = unwrap(found.init);
721
+ if (!isNodeType(found.declaration, "VariableDeclarator") || !isIdentifier(found.declaration.id)) return;
722
+ const path = memberPath(init);
723
+ const root = chainRoot(init);
724
+ if (!path || !root || !isIdentifier(unwrap(init)) && !isNodeType(unwrap(init), "MemberExpression")) return;
725
+ const resolved = originOf(root, seen);
726
+ return resolved && {
727
+ origin: resolved.origin,
728
+ rest: [...resolved.rest, ...path.slice(1)]
729
+ };
730
+ }
731
+ function reference(node) {
732
+ const target = unwrap(node);
733
+ const path = memberPath(target);
734
+ const root = chainRoot(target);
735
+ if (!path || !root) return;
736
+ const resolved = originOf(root, /* @__PURE__ */ new Set());
737
+ if (!resolved) return;
738
+ const module = vitehubModule(resolved.origin.source) ?? (resolved.origin.source.startsWith("#vitehub/") ? resolved.origin.source : void 0);
739
+ if (!module) return;
740
+ const full = [...resolved.rest, ...path.slice(1)];
741
+ if (resolved.origin.name === "*") {
742
+ const [name, ...rest] = full;
743
+ return name ? {
744
+ module,
745
+ name,
746
+ path: rest
747
+ } : void 0;
748
+ }
749
+ return {
750
+ module,
751
+ name: resolved.origin.name,
752
+ path: full
753
+ };
754
+ }
755
+ const result = {
756
+ ctx,
757
+ scopes,
758
+ reference,
759
+ binding,
760
+ callee(node) {
761
+ const target = unwrap(node);
762
+ if (!isNodeType(target, "CallExpression") && !isNodeType(target, "NewExpression")) return;
763
+ return reference(target.callee);
764
+ }
765
+ };
766
+ if (root) resolvers.set(root, result);
767
+ return result;
768
+ }
769
+ /** True when `reference` is the export `name` of one of `modules`, with no member path. */
770
+ function isExport(reference, modules, name) {
771
+ if (!reference || reference.path.length > 0 || !modules.includes(reference.module)) return false;
772
+ return typeof name === "string" ? reference.name === name : name.includes(reference.name);
773
+ }
774
+ /** Visits every script node once, depth first. Use it inside a `Program` visitor only. */
775
+ function walkScript(root, visit) {
776
+ if (!isNode(root)) return;
777
+ visit(root);
778
+ for (const [key, value] of Object.entries(root)) {
779
+ if (key === "parent") continue;
780
+ if (Array.isArray(value)) for (const child of value) walkScript(child, visit);
781
+ else walkScript(value, visit);
782
+ }
783
+ }
784
+ /** The `export default` value of a module, following `export default name` to its `const` initializer. */
785
+ function defaultExport(ctx) {
786
+ const program = ctx.file.scriptAst;
787
+ if (!isNode(program) || !Array.isArray(program.body)) return;
788
+ for (const statement of program.body) {
789
+ if (isNodeType(statement, "ExportDefaultDeclaration")) {
790
+ const declaration = unwrap(statement.declaration);
791
+ if (isIdentifier(declaration)) {
792
+ const found = scopeIndex(ctx).lookup(statement, declaration.name);
793
+ return {
794
+ node: statement,
795
+ value: found?.init ?? found?.declaration ?? declaration
796
+ };
797
+ }
798
+ return {
799
+ node: statement,
800
+ value: declaration
801
+ };
802
+ }
803
+ if (isNodeType(statement, "ExportNamedDeclaration") && Array.isArray(statement.specifiers)) {
804
+ for (const specifier of statement.specifiers) if (isNode(specifier) && (isIdentifier(specifier.exported, "default") || stringValue(specifier.exported) === "default")) return {
805
+ node: statement,
806
+ value: void 0
807
+ };
808
+ }
809
+ }
810
+ }
811
+ const handlerFactories = /* @__PURE__ */ new Set([
812
+ "defineEventHandler",
813
+ "eventHandler",
814
+ "defineHandler",
815
+ "defineCachedEventHandler",
816
+ "defineLazyEventHandler"
817
+ ]);
818
+ const routeDirs = [
819
+ "api",
820
+ "routes",
821
+ "middleware"
822
+ ];
823
+ /**
824
+ * True when Nitro serves the file's default export: the file is under `api/`, `routes/`, or `middleware/` of a server
825
+ * directory. The ViteHub Project Inventory lists the server directories, including a custom Nuxt `serverDir`.
826
+ */
827
+ function isRouteFile(ctx) {
828
+ const path = ctx.file.relativePath;
829
+ return (viteHubInventory(ctx).serverDirs ?? ["server"]).some((dir) => routeDirs.some((route) => path.startsWith(dir ? `${dir}/${route}/` : `${route}/`)));
830
+ }
831
+ /** True when `fn` handles a request: it is passed to `defineEventHandler()`, or it is the default export of a route file. */
832
+ function isRouteHandler(ctx, fn) {
833
+ const { parent } = semanticParent(fn);
834
+ if (parent?.type === "ExportDefaultDeclaration") return isRouteFile(ctx);
835
+ const callee = parent?.type === "CallExpression" ? unwrap(parent.callee) : void 0;
836
+ return isIdentifier(callee) && handlerFactories.has(callee.name);
837
+ }
838
+ //#endregion
839
+ //#region src/doctor/rules/definitions.ts
840
+ /** Runtime Helpers that take a Definition name as their first argument. */
841
+ const namedCalls = [
842
+ {
843
+ modules: ["queue"],
844
+ names: [
845
+ "sendQueue",
846
+ "deferQueue",
847
+ "useQueue"
848
+ ],
849
+ kind: "queue",
850
+ label: "Queue"
851
+ },
852
+ {
853
+ modules: ["workflow"],
854
+ names: [
855
+ "startWorkflow",
856
+ "deferWorkflow",
857
+ "getWorkflowRun",
858
+ "cancelWorkflow"
859
+ ],
860
+ kind: "workflow",
861
+ label: "Workflow"
862
+ },
863
+ {
864
+ modules: ["database"],
865
+ names: ["useDatabase"],
866
+ kind: "database",
867
+ label: "Database"
868
+ },
869
+ {
870
+ modules: ["channels", "channels/server"],
871
+ names: ["useChannel"],
872
+ kind: "channel",
873
+ label: "Channel"
874
+ },
875
+ {
876
+ modules: ["browser"],
877
+ names: ["runBrowser"],
878
+ kind: "browser",
879
+ label: "Browser"
880
+ },
881
+ {
882
+ modules: ["sandbox/task"],
883
+ names: ["runSandboxTask"],
884
+ kind: "sandboxTask",
885
+ label: "Sandbox Task"
886
+ },
887
+ {
888
+ modules: ["schedule"],
889
+ names: ["runSchedule"],
890
+ kind: "schedule",
891
+ label: "Schedule"
892
+ },
893
+ {
894
+ modules: ["connections/server"],
895
+ names: ["useConnection"],
896
+ kind: "connection",
897
+ label: "Connection"
898
+ },
899
+ {
900
+ modules: ["agent/vue"],
901
+ names: ["useAgent"],
902
+ kind: "agent",
903
+ label: "Agent"
904
+ }
905
+ ];
906
+ function namedCall(reference) {
907
+ return namedCalls.find((entry) => isExport(reference, entry.modules, entry.names));
908
+ }
909
+ function quoteList(names) {
910
+ const shown = names.slice(0, 8).map((name) => `\`${name}\``).join(", ");
911
+ return names.length > 8 ? `${shown}, and ${names.length - 8} more` : shown;
912
+ }
913
+ const knownDefinitionNames = createRule({
914
+ meta: {
915
+ id: "vitehub/known-definition-names",
916
+ title: "Use the name of a discovered Definition",
917
+ category: "correctness",
918
+ severity: "error",
919
+ requires: { script: true }
920
+ },
921
+ create(ctx) {
922
+ const r = resolver(ctx);
923
+ const { definitions } = viteHubInventory(ctx);
924
+ const localWorkflows = /* @__PURE__ */ new Set();
925
+ walkScript(ctx.file.scriptAst, (node) => {
926
+ if (!isNodeType(node, "CallExpression")) return;
927
+ const callee = r.callee(node);
928
+ if (!isExport(callee, ["agent"], "agentWorkflow") && !isExport(callee, ["workflow"], "createWorkflow")) return;
929
+ const first = callArguments(node)[0];
930
+ const name = stringValue(first) ?? stringValue(objectValue(first, "name"));
931
+ if (name) localWorkflows.add(name);
932
+ });
933
+ return { CallExpression(node) {
934
+ const reference = r.callee(node);
935
+ const entry = namedCall(reference);
936
+ if (!reference || !entry) return;
937
+ const discovered = definitions[entry.kind];
938
+ if (!discovered?.length) return;
939
+ const known = [...discovered.map((definition) => definition.name), ...entry.kind === "workflow" ? localWorkflows : []];
940
+ const argument = callArguments(node)[0];
941
+ const name = stringValue(argument);
942
+ if (name === void 0) return;
943
+ const base = entry.kind === "connection" ? name.split(":")[0] ?? name : name;
944
+ if (known.includes(base) || entry.kind === "database" && name === "default") return;
945
+ ctx.report(diagnostics.VHUB0013({
946
+ why: `\`${reference.name}("${name}")\` names a ${entry.label} that ViteHub does not discover. The call fails when it runs. Known ${entry.label} names: ${quoteList(known)}.`,
947
+ fix: `Use the name of a discovered ${entry.label}, or add the ${entry.label} Definition file for \`${name}\`.`
948
+ }), { range: ctx.range(argument) });
949
+ } };
950
+ }
951
+ });
952
+ /** Kinds whose runtime loads the default export of each discovered file. */
953
+ const defaultExportKinds = /* @__PURE__ */ new Set([
954
+ "agent",
955
+ "browser",
956
+ "connection",
957
+ "queue",
958
+ "realtime",
959
+ "sandboxTask",
960
+ "schedule",
961
+ "workflow"
962
+ ]);
963
+ const definitionDefaultExport = createRule({
964
+ meta: {
965
+ id: "vitehub/definition-default-export",
966
+ title: "Default-export each discovered Definition",
967
+ category: "correctness",
968
+ severity: "error",
969
+ requires: { script: true }
970
+ },
971
+ create(ctx) {
972
+ if (ctx.file.relativePath.endsWith(".d.ts")) return;
973
+ const discovered = discoveredDefinition(ctx);
974
+ const step = viteHubInventory(ctx).definitions.workflow?.find((workflow) => workflow.steps?.includes(ctx.file.relativePath));
975
+ if (!(discovered && defaultExportKinds.has(discovered.kind)) && !step) return;
976
+ return { Program() {
977
+ if (defaultExport(ctx)) return;
978
+ ctx.report(diagnostics.VHUB0014({
979
+ why: step ? `\`${ctx.file.relativePath}\` is a step of the \`${step.name}\` Workflow, but it has no default export. The Workflow calls the default export, so the step fails when it runs.` : `ViteHub discovers \`${ctx.file.relativePath}\` as the \`${discovered?.name}\` ${discovered?.kind} Definition, but the file has no default export. The Definition fails when it is used.`,
980
+ fix: step ? "Default-export the step function: `export default async function (input) { ... }`." : "Default-export the Definition, for example `export default defineQueue(...)`. Move helper modules out of the discovered directory, for example to `server/utils/`."
981
+ }));
982
+ } };
983
+ }
984
+ });
985
+ const definitionFactories = [
986
+ {
987
+ module: "queue",
988
+ name: "defineQueue",
989
+ kind: "queue"
990
+ },
991
+ {
992
+ module: "workflow",
993
+ name: "defineWorkflow",
994
+ kind: "workflow"
995
+ },
996
+ {
997
+ module: "schedule",
998
+ name: "defineSchedule",
999
+ kind: "schedule"
1000
+ },
1001
+ {
1002
+ module: "browser",
1003
+ name: "defineBrowser",
1004
+ kind: "browser"
1005
+ },
1006
+ {
1007
+ module: "realtime",
1008
+ name: "defineRealtime",
1009
+ kind: "realtime"
1010
+ },
1011
+ {
1012
+ module: "channels",
1013
+ name: "defineChannel",
1014
+ kind: "channel"
1015
+ },
1016
+ {
1017
+ module: "agent",
1018
+ name: "defineAgent",
1019
+ kind: "agent"
1020
+ },
1021
+ {
1022
+ module: "connections",
1023
+ name: "defineConnection",
1024
+ kind: "connection"
1025
+ },
1026
+ {
1027
+ module: "sandbox/task",
1028
+ name: "defineSandboxTask",
1029
+ kind: "sandboxTask"
1030
+ }
1031
+ ];
1032
+ /** An Agent can extend another Agent from any file, so only files meant as Agent Definitions are checked. */
1033
+ const agentDefinitionPath = /(?:^|\/)agents\/|\.agent\.[cm]?[jt]s$/;
1034
+ const definitionLocation = createRule({
1035
+ meta: {
1036
+ id: "vitehub/definition-location",
1037
+ title: "Put each Definition where ViteHub discovers it",
1038
+ category: "correctness",
1039
+ severity: "error",
1040
+ requires: { script: true }
1041
+ },
1042
+ create(ctx) {
1043
+ if (isTestFile(ctx.file.relativePath)) return;
1044
+ const r = resolver(ctx);
1045
+ const { definitions } = viteHubInventory(ctx);
1046
+ return { Program() {
1047
+ const exported = defaultExport(ctx);
1048
+ const value = unwrap(exported?.value);
1049
+ if (!exported || !isNodeType(value, "CallExpression")) return;
1050
+ const reference = r.callee(value);
1051
+ const factory = definitionFactories.find((entry) => isExport(reference, [entry.module], entry.name));
1052
+ if (!factory) return;
1053
+ const files = definitions[factory.kind];
1054
+ if (!files || files.some((definition) => definition.file === ctx.file.relativePath)) return;
1055
+ const module = ctx.file.relativePath.replace(/\.(?:c|m)?[jt]sx?$/, "");
1056
+ if (files.some((definition) => definition.imports?.some((target) => target === module || target === module.replace(/\/index$/, "")))) return;
1057
+ if (factory.kind === "agent" && !agentDefinitionPath.test(ctx.file.relativePath)) return;
1058
+ ctx.report(diagnostics.VHUB0015({
1059
+ why: `\`${ctx.file.relativePath}\` default-exports \`${factory.name}()\`, but ViteHub does not discover this file. The Definition is never registered, so calls to it fail and it never runs.`,
1060
+ fix: `Move the file to the directory or file suffix that ViteHub scans for ${factory.kind} Definitions. The Definitions and discovery reference lists each convention.`
1061
+ }), { range: ctx.range(exported.node) });
1062
+ } };
1063
+ }
1064
+ });
1065
+ const queueOptionKeys = /* @__PURE__ */ new Set([
1066
+ "delaySeconds",
1067
+ "idempotencyKey",
1068
+ "retentionSeconds",
1069
+ "contentType"
1070
+ ]);
1071
+ function isQueueEnqueue(reference) {
1072
+ if (isExport(reference, ["queue"], ["sendQueue", "deferQueue"])) return true;
1073
+ return reference?.module === "queue" && reference.name === "dynamicQueue" && reference.path.length === 1 && ["send", "defer"].includes(reference.path[0] ?? "");
1074
+ }
1075
+ const queuePayloadOptions = createRule({
1076
+ meta: {
1077
+ id: "vitehub/queue-payload-options",
1078
+ title: "Pass Queue options as the third argument",
1079
+ category: "correctness",
1080
+ severity: "warn",
1081
+ requires: { script: true }
1082
+ },
1083
+ create(ctx) {
1084
+ const r = resolver(ctx);
1085
+ return { CallExpression(node) {
1086
+ if (!isQueueEnqueue(r.callee(node))) return;
1087
+ const args = callArguments(node);
1088
+ if (args.length !== 2 || !objectValue(args[1], "payload")) return;
1089
+ const options = objectProperties(args[1]).map((property) => propertyName(property)).filter((key) => key !== void 0 && queueOptionKeys.has(key));
1090
+ if (!options.length) return;
1091
+ ctx.report(diagnostics.VHUB0016({
1092
+ why: `This call sends \`{ payload, ${options.join(", ")} }\` as the job payload. ViteHub does not read enqueue options from the payload, so \`${options.join("`, `")}\` has no effect.`,
1093
+ fix: "Pass the payload and the options as separate arguments: `sendQueue(name, payload, { delaySeconds })`."
1094
+ }), { range: ctx.range(args[1]) });
1095
+ } };
1096
+ }
1097
+ });
1098
+ const dispatchCalls = [
1099
+ {
1100
+ modules: ["queue"],
1101
+ names: [
1102
+ "sendQueue",
1103
+ "deferQueue",
1104
+ "useQueue"
1105
+ ]
1106
+ },
1107
+ {
1108
+ modules: ["workflow"],
1109
+ names: ["startWorkflow", "deferWorkflow"]
1110
+ },
1111
+ {
1112
+ modules: ["sandbox/task"],
1113
+ names: ["runSandboxTask"]
1114
+ },
1115
+ {
1116
+ modules: ["browser"],
1117
+ names: ["runBrowser"]
1118
+ }
1119
+ ];
1120
+ const noModuleScopeDispatch = createRule({
1121
+ meta: {
1122
+ id: "vitehub/no-module-scope-dispatch",
1123
+ title: "Dispatch jobs inside a request",
1124
+ category: "correctness",
1125
+ severity: "warn",
1126
+ requires: { script: true }
1127
+ },
1128
+ create(ctx) {
1129
+ if (isTestFile(ctx.file.relativePath)) return;
1130
+ const r = resolver(ctx);
1131
+ return { CallExpression(node) {
1132
+ if (enclosingFunction(node)) return;
1133
+ const reference = r.callee(node);
1134
+ if (!reference || !dispatchCalls.some((entry) => isExport(reference, entry.modules, entry.names))) return;
1135
+ ctx.report(diagnostics.VHUB0017({
1136
+ why: `\`${reference.name}()\` runs once when the module loads, outside a request. ViteHub reads the host binding and \`waitUntil\` from the active request, so the call can fail or be dropped on Cloudflare and Vercel.`,
1137
+ fix: `Call \`${reference.name}()\` inside a route handler, Queue, Workflow, or Schedule handler.`
1138
+ }), { range: ctx.range(node) });
1139
+ } };
1140
+ }
1141
+ });
1142
+ /** A non-tuple result of a call, or `undefined` when the call is not one of these APIs. */
1143
+ function nonTupleResult(r, call) {
1144
+ const reference = r.callee(call);
1145
+ if (!reference) return;
1146
+ if (isExport(reference, ["sandbox/task"], "runSandboxTask") || isExport(reference, ["browser"], "runBrowser")) return {
1147
+ name: reference.name,
1148
+ kind: "response"
1149
+ };
1150
+ if (isExport(reference, ["workflow"], [
1151
+ "startWorkflow",
1152
+ "deferWorkflow",
1153
+ "getWorkflowRun",
1154
+ "cancelWorkflow",
1155
+ "resumeWorkflow"
1156
+ ]) || isExport(reference, ["queue"], "useQueue") || isExport(reference, ["schedule"], "runSchedule")) return {
1157
+ name: reference.name,
1158
+ kind: "value"
1159
+ };
1160
+ }
1161
+ function arrayPatternTarget(awaited) {
1162
+ const { parent, child } = semanticParent(awaited);
1163
+ if (isNodeType(parent, "VariableDeclarator") && parent.init === child && isNodeType(parent.id, "ArrayPattern")) return parent.id;
1164
+ if (isNodeType(parent, "AssignmentExpression") && parent.right === child && isNodeType(parent.left, "ArrayPattern")) return parent.left;
1165
+ }
1166
+ const noDestructureNonTuples = createRule({
1167
+ meta: {
1168
+ id: "vitehub/no-destructure-non-tuples",
1169
+ title: "Do not destructure results that are not tuples",
1170
+ category: "correctness",
1171
+ severity: "error",
1172
+ requires: { script: true }
1173
+ },
1174
+ create(ctx) {
1175
+ const r = resolver(ctx);
1176
+ return { AwaitExpression(node) {
1177
+ const result = nonTupleResult(r, unwrap(node.argument));
1178
+ const pattern = result && arrayPatternTarget(node);
1179
+ if (!result || !pattern) return;
1180
+ ctx.report(diagnostics.VHUB0018({
1181
+ why: result.kind === "response" ? `\`${result.name}()\` returns a Web \`Response\`, not an \`[error, value]\` tuple. A \`Response\` is not iterable, so this destructuring throws.` : result.name === "runSchedule" ? "`runSchedule()` returns a Schedule Run record, not an `[error, value]` tuple. A failed handler resolves with `status: \"failed\"`, so this destructuring throws." : `\`${result.name}()\` returns its value and throws on failure. It does not return an \`[error, value]\` tuple, so this destructuring throws or reads the wrong values.`,
1182
+ fix: result.kind === "response" ? `Read the response: \`const response = await ${result.name}(...)\`, check \`response.ok\`, then call \`await response.json()\`.` : result.name === "runSchedule" ? "Assign the run, then check it: `const run = await runSchedule(name)`, then `if (run.status === \"failed\")`." : `Assign the result directly: \`const value = await ${result.name}(...)\`. Use \`try\`/\`catch\` to handle failures.`
1183
+ }), { range: ctx.range(pattern) });
1184
+ } };
1185
+ }
1186
+ });
1187
+ const responseMembers = /* @__PURE__ */ new Set([
1188
+ "arrayBuffer",
1189
+ "blob",
1190
+ "body",
1191
+ "bodyUsed",
1192
+ "bytes",
1193
+ "clone",
1194
+ "formData",
1195
+ "headers",
1196
+ "json",
1197
+ "ok",
1198
+ "redirected",
1199
+ "status",
1200
+ "statusText",
1201
+ "text",
1202
+ "type",
1203
+ "url"
1204
+ ]);
1205
+ function responseCall(r, node) {
1206
+ const target = unwrap(node);
1207
+ if (!isNodeType(target, "AwaitExpression")) return;
1208
+ const result = nonTupleResult(r, unwrap(target.argument));
1209
+ return result?.kind === "response" ? result.name : void 0;
1210
+ }
1211
+ const checkResponseResults = createRule({
1212
+ meta: {
1213
+ id: "vitehub/check-response-results",
1214
+ title: "Read Sandbox Task and Browser results as a Response",
1215
+ category: "correctness",
1216
+ severity: "error",
1217
+ requires: { script: true }
1218
+ },
1219
+ create(ctx) {
1220
+ const r = resolver(ctx);
1221
+ function report(node, name, member) {
1222
+ ctx.report(diagnostics.VHUB0019({
1223
+ why: `\`${name}()\` returns a Web \`Response\`. \`${member}\` is not a \`Response\` property, so it is \`undefined\`. A failed run also returns a \`Response\` with an error status, not your data.`,
1224
+ fix: `Check \`response.ok\`, then read the data: \`const data = await response.json()\`.`
1225
+ }), { range: ctx.range(node) });
1226
+ }
1227
+ return {
1228
+ VariableDeclarator(node) {
1229
+ if (!isNodeType(node.id, "ObjectPattern")) return;
1230
+ const name = responseCall(r, node.init);
1231
+ if (!name) return;
1232
+ const member = (Array.isArray(node.id.properties) ? node.id.properties.filter(isNode) : []).map((property) => propertyName(property)).find((key) => key !== void 0 && !responseMembers.has(key));
1233
+ if (member) report(node.id, name, member);
1234
+ },
1235
+ MemberExpression(node) {
1236
+ if (node.computed === true || !isIdentifier(node.property) || responseMembers.has(node.property.name)) return;
1237
+ const object = unwrap(node.object);
1238
+ let name = responseCall(r, object);
1239
+ if (!name && isIdentifier(object)) {
1240
+ const binding = r.binding(object);
1241
+ if (binding && !binding.origin && isNodeType(binding.declaration, "VariableDeclarator") && isIdentifier(binding.declaration.id)) name = responseCall(r, binding.init);
1242
+ }
1243
+ if (name) report(node, name, node.property.name);
1244
+ }
1245
+ };
1246
+ }
1247
+ });
1248
+ /** The step property that the Workflow runtime derives from a step file name. */
1249
+ function stepPropertyName(file) {
1250
+ return (file.split("/").pop() ?? file).replace(/\.(?:c|m)?[jt]s$/i, "").replace(/^\d+[.-]?/, "").replace(/[-_.]+([a-z0-9])/gi, (_, char) => char.toUpperCase());
1251
+ }
1252
+ const sourceFile = /\.(?:c|m)?[jt]sx?$/;
1253
+ /**
1254
+ * The handler of a folder Workflow index: the function passed to `defineWorkflow(name, handler)`, or the
1255
+ * default-exported function. A handler gets `(payload, context)`: `context` names the whole second parameter
1256
+ * (`ctx.steps`), and `steps` names its destructured `steps` property.
1257
+ */
1258
+ function workflowHandler(ctx, r) {
1259
+ const value = unwrap(defaultExport(ctx)?.value);
1260
+ let fn = isNodeType(value, "CallExpression") ? unwrap(callArguments(value)[1]) : value;
1261
+ if (isIdentifier(fn)) {
1262
+ const declaration = r.binding(fn)?.declaration;
1263
+ fn = isNodeType(declaration, "VariableDeclarator") ? unwrap(declaration.init) : declaration;
1264
+ }
1265
+ if (!isFunctionNode(fn) || !isNode(fn) || !Array.isArray(fn.params)) return;
1266
+ let param = unwrap(fn.params[1]);
1267
+ if (isNodeType(param, "AssignmentPattern")) param = unwrap(param.left);
1268
+ if (isIdentifier(param)) return {
1269
+ fn,
1270
+ context: param.name
1271
+ };
1272
+ let target = unwrap((isNodeType(param, "ObjectPattern") && Array.isArray(param.properties) ? param.properties.filter(isNode) : []).find((entry) => propertyName(entry) === "steps")?.value);
1273
+ if (isNodeType(target, "AssignmentPattern")) target = unwrap(target.left);
1274
+ return {
1275
+ fn,
1276
+ ...isIdentifier(target) ? { steps: target.name } : {}
1277
+ };
1278
+ }
1279
+ const workflowStepNames = createRule({
1280
+ meta: {
1281
+ id: "vitehub/workflow-step-names",
1282
+ title: "Call folder Workflow steps by their file names",
1283
+ category: "correctness",
1284
+ severity: "error",
1285
+ requires: { script: true }
1286
+ },
1287
+ create(ctx) {
1288
+ const workflows = viteHubInventory(ctx).definitions.workflow ?? [];
1289
+ const path = ctx.file.relativePath;
1290
+ const workflow = workflows.find((definition) => definition.file === path && definition.steps?.length);
1291
+ const indexless = workflow ? void 0 : workflows.find((definition) => definition.steps?.includes(path) && !sourceFile.test(definition.file));
1292
+ const steps = (workflow ?? indexless)?.steps;
1293
+ if (!steps) return;
1294
+ const owners = /* @__PURE__ */ new Map();
1295
+ for (const step of steps) owners.set(stepPropertyName(step), [...owners.get(stepPropertyName(step)) ?? [], step]);
1296
+ if (indexless) {
1297
+ const name = stepPropertyName(path);
1298
+ const files = owners.get(name) ?? [];
1299
+ if (name && files.length < 2) return;
1300
+ return { Program() {
1301
+ ctx.report(diagnostics.VHUB0020({
1302
+ why: name ? `The step files ${quoteList(files)} of the \`${indexless.name}\` Workflow all become the \`steps.${name}\` property. The Workflow fails when it runs.` : `The step file \`${path}\` has no name after its number prefix, so it has no \`steps\` property. The Workflow fails when it runs.`,
1303
+ fix: "Rename the step files so that each one has a unique name after its number prefix, for example `01.create-user.ts`."
1304
+ }));
1305
+ } };
1306
+ }
1307
+ if (!workflow) return;
1308
+ const names = [...owners.keys()].filter(Boolean);
1309
+ const r = resolver(ctx);
1310
+ const handler = workflowHandler(ctx, r);
1311
+ return {
1312
+ Program() {
1313
+ for (const [name, files] of owners) {
1314
+ if (name && files.length < 2) continue;
1315
+ ctx.report(diagnostics.VHUB0020({
1316
+ why: name ? `The step files ${quoteList(files)} all become the \`steps.${name}\` property. The Workflow fails when it runs.` : `The step file ${quoteList(files)} has no name after its number prefix, so it has no \`steps\` property. The Workflow fails when it runs.`,
1317
+ fix: "Rename the step files so that each one has a unique name after its number prefix, for example `01.create-user.ts`."
1318
+ }));
1319
+ }
1320
+ },
1321
+ MemberExpression(node) {
1322
+ if (node.computed === true || !isIdentifier(node.property)) return;
1323
+ const objectPath = memberPath(node.object);
1324
+ if (!objectPath || objectPath.length > 2) return;
1325
+ const root = chainRoot(node.object);
1326
+ const binding = r.binding(root);
1327
+ if (!root || !binding || !handler || binding !== r.scopes.lookup(handler.fn, root.name)) return;
1328
+ if (!(objectPath.length === 1 ? root.name === handler.steps : root.name === handler.context && objectPath[1] === "steps")) return;
1329
+ const step = node.property.name;
1330
+ if (names.includes(step)) return;
1331
+ ctx.report(diagnostics.VHUB0020({
1332
+ why: `\`steps.${step}\` matches no step file of the \`${workflow.name}\` Workflow, so it is \`undefined\` when the Workflow runs. Known steps: ${quoteList(names)}.`,
1333
+ fix: "Use a known step name, or add a step file. ViteHub removes the number prefix from the file name and converts it to camelCase: `01.send-email.ts` becomes `steps.sendEmail`."
1334
+ }), { range: ctx.range(node) });
1335
+ }
1336
+ };
1337
+ }
1338
+ });
1339
+ const cronFields = [
1340
+ {
1341
+ label: "minute",
1342
+ min: 0,
1343
+ max: 59
1344
+ },
1345
+ {
1346
+ label: "hour",
1347
+ min: 0,
1348
+ max: 23
1349
+ },
1350
+ {
1351
+ label: "day of month",
1352
+ min: 1,
1353
+ max: 31
1354
+ },
1355
+ {
1356
+ label: "month",
1357
+ min: 1,
1358
+ max: 12
1359
+ },
1360
+ {
1361
+ label: "day of week",
1362
+ min: 0,
1363
+ max: 7
1364
+ }
1365
+ ];
1366
+ /** Problems in a five-field cron expression that the Schedule build does not report. */
1367
+ function cronProblems(cron) {
1368
+ const fields = cron.trim().split(/\s+/);
1369
+ if (fields.length !== 5) return [];
1370
+ const problems = [];
1371
+ fields.forEach((field, index) => {
1372
+ const spec = cronFields[index];
1373
+ if (!spec) return;
1374
+ if (!/^[*,/\-0-9]+$/.test(field)) return;
1375
+ for (const part of field.split(",")) {
1376
+ const [range, step] = part.split("/");
1377
+ if (step !== void 0 && !(/^\d+$/.test(step) && Number(step) > 0)) problems.push(`the ${spec.label} step \`/${step}\` is not a positive number`);
1378
+ if (range === void 0 || range === "*") continue;
1379
+ const bounds = range.split("-");
1380
+ const numbers = bounds.map(Number);
1381
+ if (bounds.length > 2 || bounds.some((bound) => !/^\d+$/.test(bound))) {
1382
+ problems.push(`the ${spec.label} field \`${field}\` is not valid`);
1383
+ continue;
1384
+ }
1385
+ for (const value of numbers) if (value < spec.min || value > spec.max) problems.push(`${value} is outside the ${spec.label} range ${spec.min}-${spec.max}`);
1386
+ if (numbers.length === 2 && (numbers[0] ?? 0) > (numbers[1] ?? 0)) problems.push(`the ${spec.label} range \`${range}\` runs backwards`);
1387
+ }
1388
+ });
1389
+ return problems;
1390
+ }
1391
+ const validScheduleCron = createRule({
1392
+ meta: {
1393
+ id: "vitehub/valid-schedule-cron",
1394
+ title: "Use a valid portable cron expression",
1395
+ category: "correctness",
1396
+ severity: "error",
1397
+ requires: { script: true }
1398
+ },
1399
+ create(ctx) {
1400
+ const r = resolver(ctx);
1401
+ return { CallExpression(node) {
1402
+ if (!isExport(r.callee(node), ["schedule"], "defineSchedule")) return;
1403
+ const [first] = callArguments(node);
1404
+ const cronNode = objectValue(first, "cron");
1405
+ const cron = stringValue(cronNode);
1406
+ if (cron === void 0) return;
1407
+ const problems = cronProblems(cron);
1408
+ if (!problems.length) return;
1409
+ ctx.report(diagnostics.VHUB0021({
1410
+ why: `The cron \`${cron}\` is not valid: ${problems.join("; ")}. The Schedule fails at deploy or when it first runs.`,
1411
+ fix: "Use five numeric fields in UTC, such as `0 8 * * 1` for 08:00 every Monday. Set only one of the day of month and the day of week."
1412
+ }), { range: ctx.range(cronNode) });
1413
+ } };
1414
+ }
1415
+ });
1416
+ const manualScheduleRun = createRule({
1417
+ meta: {
1418
+ id: "vitehub/manual-schedule-run",
1419
+ title: "Run only manual Schedules by name",
1420
+ category: "correctness",
1421
+ severity: "error",
1422
+ requires: { script: true }
1423
+ },
1424
+ create(ctx) {
1425
+ const r = resolver(ctx);
1426
+ const schedules = viteHubInventory(ctx).definitions.schedule;
1427
+ if (!schedules?.length) return;
1428
+ return { CallExpression(node) {
1429
+ if (!isExport(r.callee(node), ["schedule"], "runSchedule")) return;
1430
+ const argument = callArguments(node)[0];
1431
+ const name = stringValue(argument);
1432
+ const schedule = schedules.find((definition) => definition.name === name);
1433
+ if (!schedule || schedule.manual === true) return;
1434
+ ctx.report(diagnostics.VHUB0022({
1435
+ why: `\`runSchedule("${schedule.name}")\` runs a Schedule that does not set \`manual: true\`. It throws \`SCHEDULE_MANUAL_RUN_DISABLED\` when it runs.`,
1436
+ fix: `Add \`manual: true\` to \`defineSchedule()\` in \`${schedule.file}\`.`
1437
+ }), { range: ctx.range(argument) });
1438
+ } };
1439
+ }
1440
+ });
1441
+ const chatAdapterNames = [
1442
+ "channelAdapter",
1443
+ "discord",
1444
+ "forgejo",
1445
+ "github",
1446
+ "gitlab",
1447
+ "gmail",
1448
+ "http",
1449
+ "slack",
1450
+ "teams",
1451
+ "telegram",
1452
+ "webChat"
1453
+ ];
1454
+ const rules$5 = [
1455
+ knownDefinitionNames,
1456
+ definitionDefaultExport,
1457
+ definitionLocation,
1458
+ queuePayloadOptions,
1459
+ noModuleScopeDispatch,
1460
+ noDestructureNonTuples,
1461
+ checkResponseResults,
1462
+ workflowStepNames,
1463
+ validScheduleCron,
1464
+ manualScheduleRun,
1465
+ createRule({
1466
+ meta: {
1467
+ id: "vitehub/valid-channel",
1468
+ title: "Give each Channel an adapter that fits its targets",
1469
+ category: "correctness",
1470
+ severity: "error",
1471
+ requires: { script: true }
1472
+ },
1473
+ create(ctx) {
1474
+ const r = resolver(ctx);
1475
+ return { CallExpression(node) {
1476
+ if (!isExport(r.callee(node), ["channels"], "defineChannel")) return;
1477
+ const definition = unwrap(callArguments(node)[0]);
1478
+ if (!isNodeType(definition, "ObjectExpression") || objectProperties(definition).some((property) => property.type === "SpreadElement")) return;
1479
+ const fail = (target, why, fix) => ctx.report(diagnostics.VHUB0023({
1480
+ why,
1481
+ fix
1482
+ }), { range: ctx.range(target) });
1483
+ const adapter = unwrap(objectValue(definition, "adapter"));
1484
+ if (!adapter) {
1485
+ fail(definition, "`defineChannel()` has no `adapter`. It throws `CHANNELS_C0007` when it loads, and `send()` returns that error.", "Add an adapter, such as `stripe()`, `webhook()`, `slack()` from `vite-hub/agent/channels`, or `{ kind, send }`.");
1486
+ return;
1487
+ }
1488
+ if (isNodeType(adapter, "ObjectExpression") && !objectValue(adapter, "kind") && !objectProperties(adapter).some((property) => property.type === "SpreadElement")) fail(adapter, "The adapter has no `kind`. `defineChannel()` throws `CHANNELS_C0007` when it loads.", "Add `kind`, the name of the platform, such as `kind: 'alerts'`.");
1489
+ if (!(isNodeType(adapter, "CallExpression") && chatAdapterNames.some((name) => isExport(r.callee(adapter), ["agent/channels"], name))) && !isNodeType(adapter, "ObjectExpression")) return;
1490
+ const on = unwrap(objectValue(definition, "on"));
1491
+ if (!isNodeType(on, "ObjectExpression")) return;
1492
+ for (const property of objectProperties(on)) {
1493
+ if (property.type === "SpreadElement") continue;
1494
+ const value = unwrap(property.value);
1495
+ if (!isNodeType(value, "ArrowFunctionExpression") && !isNodeType(value, "FunctionExpression")) continue;
1496
+ fail(property, `The \`on\` handler \`${propertyName(property) ?? "?"}\` needs an adapter that receives webhooks. \`defineChannel()\` throws \`CHANNELS_C0010\` when it loads.`, "Use `webhook()` or `stripe()` as the adapter, or `defineChannelTrigger()` for a chat Channel. Chat messages go to the Agent that lists the Channel.");
1497
+ }
1498
+ } };
1499
+ }
1500
+ })
1501
+ ];
1502
+ //#endregion
1503
+ //#region src/doctor/rules/env-and-guards.ts
1504
+ /** `vite-hub/env` and the alias that it replaced, so the rules also check apps that `vitehub migrate` did not move yet. */
1505
+ const serverEnvModules = ["env", "#vitehub/env/server"];
1506
+ /** The export name when `reference` is one of `names` from `modules`. */
1507
+ function matchExport(reference, modules, names) {
1508
+ return reference && isExport(reference, modules, names) ? reference.name : void 0;
1509
+ }
1510
+ /** True for a call of the ViteHub export `name`, or of a global with that name when nothing in scope binds it. */
1511
+ function isViteHubCall(r, call, modules, name) {
1512
+ const target = unwrap(call);
1513
+ if (!isNodeType(target, "CallExpression")) return false;
1514
+ const reference = r.callee(target);
1515
+ if (reference) return isExport(reference, modules, name);
1516
+ const callee = unwrap(target.callee);
1517
+ return isIdentifier(callee, name) && !r.binding(callee);
1518
+ }
1519
+ /** The property path from an object pattern to the identifier `name`, such as `["github", "token"]`. */
1520
+ function patternPath(pattern, name) {
1521
+ const target = unwrap(pattern);
1522
+ if (isIdentifier(target, name)) return [];
1523
+ if (isNodeType(target, "AssignmentPattern")) return patternPath(target.left, name);
1524
+ if (!isNodeType(target, "ObjectPattern") || !Array.isArray(target.properties)) return;
1525
+ for (const property of target.properties) {
1526
+ if (!isNodeType(property, "Property")) continue;
1527
+ const key = propertyName(property);
1528
+ const rest = key === void 0 ? void 0 : patternPath(property.value, name);
1529
+ if (key !== void 0 && rest) return [key, ...rest];
1530
+ }
1531
+ }
1532
+ /** The identifiers that a binding pattern declares, in source order. */
1533
+ function patternBindings(pattern, into = []) {
1534
+ const target = unwrap(pattern);
1535
+ if (isIdentifier(target)) into.push(target);
1536
+ else if (isNodeType(target, "AssignmentPattern")) patternBindings(target.left, into);
1537
+ else if (isNodeType(target, "RestElement")) patternBindings(target.argument, into);
1538
+ else if (isNodeType(target, "ArrayPattern") && Array.isArray(target.elements)) for (const element of target.elements) patternBindings(element, into);
1539
+ else if (isNodeType(target, "ObjectPattern") && Array.isArray(target.properties)) for (const property of target.properties) patternBindings(isNodeType(property, "RestElement") ? property.argument : isNode(property) ? property.value : void 0, into);
1540
+ return into;
1541
+ }
1542
+ /** Resolves expressions that read Server Env: `useServerEnv()`, `await loadServerEnv()`, and names bound from them. */
1543
+ function envPaths(ctx) {
1544
+ const r = resolver(ctx);
1545
+ function root(node, seen = /* @__PURE__ */ new Set()) {
1546
+ const target = unwrap(node);
1547
+ if (seen.has(target)) return;
1548
+ seen.add(target);
1549
+ if (isNodeType(target, "CallExpression") && isExport(r.callee(target), serverEnvModules, "useServerEnv")) return {
1550
+ path: [],
1551
+ sync: true
1552
+ };
1553
+ if (isNodeType(target, "AwaitExpression") && isNodeType(unwrap(target.argument), "CallExpression") && isExport(r.callee(target.argument), serverEnvModules, "loadServerEnv")) return {
1554
+ path: [],
1555
+ sync: false
1556
+ };
1557
+ if (isNodeType(target, "MemberExpression")) {
1558
+ const base = root(target.object, seen);
1559
+ const property = target.computed === true ? stringValue(target.property) : isIdentifier(target.property) ? target.property.name : void 0;
1560
+ return base && property !== void 0 ? {
1561
+ path: [...base.path, property],
1562
+ sync: base.sync
1563
+ } : void 0;
1564
+ }
1565
+ if (isIdentifier(target)) {
1566
+ const declaration = r.binding(target)?.declaration;
1567
+ if (!isNodeType(declaration, "VariableDeclarator")) return;
1568
+ if (isIdentifier(declaration.id)) return root(declaration.init, seen);
1569
+ const path = patternPath(declaration.id, target.name);
1570
+ const base = path && root(declaration.init, seen);
1571
+ return base && path ? {
1572
+ path: [...base.path, ...path],
1573
+ sync: base.sync
1574
+ } : void 0;
1575
+ }
1576
+ }
1577
+ return (node) => root(node);
1578
+ }
1579
+ const coercingCalls = /* @__PURE__ */ new Set([
1580
+ "String",
1581
+ "JSON.stringify",
1582
+ "Buffer.from",
1583
+ "encodeURIComponent",
1584
+ "btoa"
1585
+ ]);
1586
+ const coercingOperators = /* @__PURE__ */ new Set([
1587
+ "+",
1588
+ "==",
1589
+ "!="
1590
+ ]);
1591
+ const strictOperators = /* @__PURE__ */ new Set(["===", "!=="]);
1592
+ /** `value === undefined` and `value == null` test whether an optional secret is set. They read no value. */
1593
+ function isNullish(node) {
1594
+ const target = unwrap(node);
1595
+ return isNodeType(target, "Literal") && target.value === null || isIdentifier(target, "undefined");
1596
+ }
1597
+ const logMethods = /* @__PURE__ */ new Set([
1598
+ "debug",
1599
+ "error",
1600
+ "info",
1601
+ "log",
1602
+ "trace",
1603
+ "warn"
1604
+ ]);
1605
+ /**
1606
+ * True when the nearest call that receives the value is `console.*()` or a logger call such as `logger.info()`.
1607
+ * Converting calls such as `JSON.stringify()` pass the value on. Any other call, such as `fetch()`, uses it first.
1608
+ */
1609
+ function inLogCall(node) {
1610
+ let current = parentOf(node);
1611
+ while (current && !isFunctionNode(current)) {
1612
+ if (current.type === "NewExpression") return false;
1613
+ if (current.type === "CallExpression") {
1614
+ const path = memberPath(current.callee);
1615
+ if (path && (path[0] === "console" || path.length > 1 && logMethods.has(path.at(-1) ?? ""))) return true;
1616
+ if (!path || !coercingCalls.has(path.join("."))) return false;
1617
+ }
1618
+ current = parentOf(current);
1619
+ }
1620
+ return false;
1621
+ }
1622
+ const unsealSecretEnv = createRule({
1623
+ meta: {
1624
+ id: "vitehub/unseal-secret-env",
1625
+ title: "Call `.unseal()` before using a secret Server Env value",
1626
+ category: "correctness",
1627
+ severity: "error",
1628
+ requires: { script: true }
1629
+ },
1630
+ create(ctx) {
1631
+ const secrets = new Set(viteHubInventory(ctx).env?.secret ?? []);
1632
+ if (!secrets.size) return;
1633
+ const envPath = envPaths(ctx);
1634
+ function check(node, use, strict = false) {
1635
+ if (inLogCall(node)) return;
1636
+ const found = envPath(node);
1637
+ if (!found) return;
1638
+ const path = found.path.join(".");
1639
+ if (!secrets.has(path)) return;
1640
+ ctx.report(diagnostics.VHUB0004({
1641
+ why: strict ? `\`${path}\` is a secret Server Env value, a \`SecretEnv\` object. ${use} compares the object, so it is never equal to a string.` : `\`${path}\` is a secret Server Env value, a \`SecretEnv\`. ${use} converts it to the string \`<redacted>\`, so the code sends or compares \`<redacted>\` and not the secret.`,
1642
+ fix: `Call \`.unseal()\` where the code needs the raw value, for example \`${path.split(".").at(-1)}.unseal()\`.`
1643
+ }), { range: ctx.range(node) });
1644
+ }
1645
+ return {
1646
+ TemplateLiteral(node) {
1647
+ for (const expression of node.expressions) check(expression, "A template literal");
1648
+ },
1649
+ BinaryExpression(node) {
1650
+ const strict = strictOperators.has(node.operator);
1651
+ if (!strict && !coercingOperators.has(node.operator)) return;
1652
+ if (node.operator !== "+" && (isNullish(node.left) || isNullish(node.right))) return;
1653
+ check(node.left, `The \`${node.operator}\` operator`, strict);
1654
+ check(node.right, `The \`${node.operator}\` operator`, strict);
1655
+ },
1656
+ CallExpression(node) {
1657
+ const callee = memberPath(node.callee)?.join(".");
1658
+ const encodes = isNodeType(unwrap(node.callee), "MemberExpression") && callee?.endsWith(".encode");
1659
+ if (callee && (coercingCalls.has(callee) || encodes)) for (const argument of callArguments(node)) check(argument, `\`${callee}()\``);
1660
+ },
1661
+ Property(node) {
1662
+ const owner = semanticParent(parentOf(node)).parent;
1663
+ if (owner?.type === "Property" && propertyName(owner) === "headers" || owner?.type === "NewExpression" && isIdentifier(unwrap(owner.callee), "Headers")) check(node.value, "A request header");
1664
+ }
1665
+ };
1666
+ }
1667
+ });
1668
+ const configFile = /(?:^|\/)(?:vite|nuxt)\.config\.[cm]?[jt]s$/;
1669
+ const credentialSuffixes = [
1670
+ "secret",
1671
+ "secrets",
1672
+ "token",
1673
+ "password",
1674
+ "apikey",
1675
+ "privatekey"
1676
+ ];
1677
+ function isCredentialKey(key) {
1678
+ const normalized = key.toLowerCase().replace(/[-_]/g, "");
1679
+ return credentialSuffixes.some((suffix) => normalized.endsWith(suffix));
1680
+ }
1681
+ /** `process.env.X` or `import.meta.env.X`, which a config file reads when it builds. */
1682
+ function isBuildEnvRead(node) {
1683
+ const target = unwrap(node);
1684
+ if (!isNodeType(target, "MemberExpression")) return false;
1685
+ const object = unwrap(target.object);
1686
+ if (isNodeType(object, "MemberExpression") && isNodeType(unwrap(object.object), "MetaProperty") && isIdentifier(object.property, "env")) return true;
1687
+ const path = memberPath(object);
1688
+ return path?.length === 2 && path[0] === "process" && path[1] === "env" || isNodeType(object, "MemberExpression") && isBuildEnvRead(object);
1689
+ }
1690
+ function literalSecret(node) {
1691
+ const value = stringValue(node);
1692
+ return value !== void 0 && value.trim().length > 0;
1693
+ }
1694
+ const gatewayPresets = [
1695
+ "anthropic",
1696
+ "cliproxy",
1697
+ "cloudflare",
1698
+ "defineAiGateway",
1699
+ "litellm",
1700
+ "ollama",
1701
+ "openai",
1702
+ "openrouter",
1703
+ "typesafe",
1704
+ "vercel"
1705
+ ];
1706
+ const noLiteralCredentials = createRule({
1707
+ meta: {
1708
+ id: "vitehub/no-literal-credentials",
1709
+ title: "Keep credentials out of source and build output",
1710
+ category: "security",
1711
+ severity: "error",
1712
+ requires: { script: true }
1713
+ },
1714
+ create(ctx) {
1715
+ const r = resolver(ctx);
1716
+ const isConfig = configFile.test(ctx.file.relativePath);
1717
+ function report(node, why) {
1718
+ ctx.report(diagnostics.VHUB0005({
1719
+ why,
1720
+ fix: "Declare the credential in `env.server` with `env({ secret: true, source: env.source(\"NAME\") })`, set `NAME` in the host environment, and read it at runtime."
1721
+ }), { range: ctx.range(node) });
1722
+ }
1723
+ /** Reports credential-named properties with string literals below `node`. */
1724
+ function literalCredentials(node, owner) {
1725
+ walkScript(unwrap(node), (child) => {
1726
+ if (child.type !== "Property") return;
1727
+ const key = propertyName(child);
1728
+ if (key && isCredentialKey(key) && literalSecret(child.value)) report(child.value, `\`${key}\` in ${owner} is a string literal. The credential is then in source control and in the server bundle.`);
1729
+ });
1730
+ }
1731
+ function serverEnvEntries(node, path) {
1732
+ for (const property of objectProperties(node)) {
1733
+ const key = propertyName(property);
1734
+ if (key === void 0) continue;
1735
+ const value = unwrap(property.value);
1736
+ const entryPath = `${path}.${key}`;
1737
+ if (isBuildEnvRead(value)) report(value, `\`${entryPath}\` reads the host environment when Vite loads the config. ViteHub then writes the value into the generated server module as a literal.`);
1738
+ else if (isNodeType(value, "ObjectExpression")) serverEnvEntries(value, entryPath);
1739
+ else if (isNodeType(value, "CallExpression")) {
1740
+ const options = callArguments(value).findLast((argument) => isNodeType(unwrap(argument), "ObjectExpression"));
1741
+ const fallback = objectProperty(options, "default");
1742
+ if (!fallback) continue;
1743
+ if (isBuildEnvRead(fallback.value)) report(fallback.value, `The \`default\` of \`${entryPath}\` reads the host environment when Vite loads the config. ViteHub writes defaults into the generated server module.`);
1744
+ else if (booleanValue(objectValue(options, "secret")) === true) report(fallback.value, `\`${entryPath}\` is secret but has a \`default\`. ViteHub writes defaults into the generated server module, so the secret is in the build output.`);
1745
+ } else if (isCredentialKey(key) && literalSecret(value)) report(value, `\`${entryPath}\` is a literal value. ViteHub writes literal Server Env values into the generated server module.`);
1746
+ }
1747
+ }
1748
+ function emailOptions(node) {
1749
+ for (const property of objectProperties(objectValue(node, "options"))) {
1750
+ const key = propertyName(property);
1751
+ if (!key || !isCredentialKey(key)) continue;
1752
+ if (literalSecret(property.value) || isBuildEnvRead(property.value)) report(property.value, `The Email option \`${key}\` is read when Vite loads the config, so ViteHub writes it into the build output.`);
1753
+ }
1754
+ }
1755
+ return {
1756
+ Property(node) {
1757
+ if (!isConfig) return;
1758
+ const key = propertyName(node);
1759
+ const owner = semanticParent(parentOf(node)).parent;
1760
+ if (key === "server" && owner?.type === "Property" && propertyName(owner) === "env") serverEnvEntries(node.value, "env.server");
1761
+ if (key === "email" && isNodeType(unwrap(node.value), "ObjectExpression")) emailOptions(node.value);
1762
+ },
1763
+ CallExpression(node) {
1764
+ if (isConfig && isViteHubCall(r, node, ["email/vite"], "hubEmail")) {
1765
+ emailOptions(callArguments(node)[0]);
1766
+ return;
1767
+ }
1768
+ if (isConfig && isViteHubCall(r, node, ["env/vite"], "hubEnv")) {
1769
+ serverEnvEntries(objectValue(callArguments(node)[0], "server"), "env.server");
1770
+ return;
1771
+ }
1772
+ const reference = r.callee(node);
1773
+ if (isViteHubCall(r, node, ["auth"], "defineAuth")) {
1774
+ literalCredentials(callArguments(node)[0], "`defineAuth()`");
1775
+ return;
1776
+ }
1777
+ const provider = matchExport(reference, ["connections/google", "connections"], ["google", "apiKey"]);
1778
+ const gateway = matchExport(reference, ["gateways"], gatewayPresets);
1779
+ if (provider) {
1780
+ literalCredentials(callArguments(node)[0], `\`${provider}()\``);
1781
+ const fallback = unwrap(objectValue(callArguments(node)[0], "fallback"));
1782
+ if (isNodeType(fallback, "ArrowFunctionExpression") && literalSecret(fallback.body)) report(fallback.body, "The `fallback` of `apiKey()` returns a string literal. The key is then in source control and in the server bundle.");
1783
+ } else if (gateway) {
1784
+ const options = callArguments(node)[0];
1785
+ literalCredentials(options, `\`${gateway}()\``);
1786
+ for (const header of objectProperties(objectValue(options, "headers"))) if (literalSecret(header.value)) report(header.value, `A header of \`${gateway}()\` is a string literal. Gateway headers carry credentials.`);
1787
+ }
1788
+ }
1789
+ };
1790
+ }
1791
+ });
1792
+ const promiseMethods = /* @__PURE__ */ new Set([
1793
+ "then",
1794
+ "catch",
1795
+ "finally"
1796
+ ]);
1797
+ /** True when a variable that holds the promise is awaited somewhere in the file. */
1798
+ /** True when a promise in this position is read as its value: in a string, a comparison, a property, or a member read. */
1799
+ function readsPromiseAsValue(parent, child) {
1800
+ return ["TemplateLiteral", "BinaryExpression"].includes(parent.type) || parent.type === "Property" && parent.value === child || parent.type === "MemberExpression" && parent.object === child && !(isIdentifier(parent.property) && promiseMethods.has(parent.property.name));
1801
+ }
1802
+ /** True when a later use of the name that holds the promise reads it as its value. Returning or passing it on is fine. */
1803
+ function misusedLater(r, target) {
1804
+ const own = r.binding(target);
1805
+ if (!own) return false;
1806
+ let misused = false;
1807
+ walkScript(r.ctx.file.scriptAst, (node) => {
1808
+ if (misused || node === target || !isIdentifier(node, target.name) || r.binding(node) !== own) return;
1809
+ const { parent, child } = semanticParent(node);
1810
+ if (parent && readsPromiseAsValue(parent, child)) misused = true;
1811
+ });
1812
+ return misused;
1813
+ }
1814
+ const awaitAsyncHelpers = createRule({
1815
+ meta: {
1816
+ id: "vitehub/await-async-helpers",
1817
+ title: "Await ViteHub guards and async Server Env helpers",
1818
+ category: "correctness",
1819
+ severity: "error",
1820
+ requires: { script: true }
1821
+ },
1822
+ create(ctx) {
1823
+ const r = resolver(ctx);
1824
+ return { CallExpression(node) {
1825
+ const reference = r.callee(node);
1826
+ const { parent, child } = semanticParent(node);
1827
+ if (!parent) return;
1828
+ const guard = matchExport(reference, ["rate-limit"], ["requireRateLimit", "checkRateLimit"]);
1829
+ if (guard) {
1830
+ if (!(parent.type === "ExpressionStatement" || parent.type === "UnaryExpression" && parent.operator === "!" || ["IfStatement", "ConditionalExpression"].includes(parent.type) && parent.test === child)) return;
1831
+ ctx.report(diagnostics.VHUB0006({
1832
+ why: `\`${guard}()\` is async. Without \`await\`, the handler continues before the limit is checked, and a rejected request is not stopped.`,
1833
+ fix: `Write \`await ${guard}(...)\`.`
1834
+ }), { range: ctx.range(node) });
1835
+ return;
1836
+ }
1837
+ const helper = matchExport(reference, serverEnvModules, ["deriveSecret", "loadServerEnv"]);
1838
+ if (!helper) return;
1839
+ let misused = readsPromiseAsValue(parent, child);
1840
+ if (parent.type === "VariableDeclarator" && parent.init === child) misused = isNodeType(parent.id, "ObjectPattern") || isIdentifier(parent.id) && misusedLater(r, parent.id);
1841
+ if (!misused) return;
1842
+ ctx.report(diagnostics.VHUB0006({
1843
+ why: `\`${helper}()\` returns a promise. Without \`await\`, this code reads the promise, not the value, for example \`[object Promise]\` in a string.`,
1844
+ fix: `Write \`await ${helper}(...)\`.`
1845
+ }), { range: ctx.range(node) });
1846
+ } };
1847
+ }
1848
+ });
1849
+ const loadProviderEnv = createRule({
1850
+ meta: {
1851
+ id: "vitehub/load-provider-env",
1852
+ title: "Read provider-backed Server Env with `loadServerEnv()`",
1853
+ category: "correctness",
1854
+ severity: "error",
1855
+ requires: { script: true }
1856
+ },
1857
+ create(ctx) {
1858
+ const providers = new Set(viteHubInventory(ctx).env?.provider ?? []);
1859
+ if (!providers.size) return;
1860
+ const envPath = envPaths(ctx);
1861
+ function report(node, path) {
1862
+ ctx.report(diagnostics.VHUB0007({
1863
+ why: `\`${path}\` comes from an Env provider. \`useServerEnv()\` reads synchronously, so this read throws \`ENV_ASYNC_REQUIRED\` when the request runs.`,
1864
+ fix: "Read the value from `await loadServerEnv(event)`, which loads provider values first."
1865
+ }), { range: ctx.range(node) });
1866
+ }
1867
+ return {
1868
+ MemberExpression(node) {
1869
+ const found = envPath(node);
1870
+ if (found?.sync && providers.has(found.path.join("."))) report(node, found.path.join("."));
1871
+ },
1872
+ VariableDeclarator(node) {
1873
+ if (!isNodeType(node.id, "ObjectPattern")) return;
1874
+ const root = envPath(node.init);
1875
+ if (!root?.sync) return;
1876
+ for (const identifier of patternBindings(node.id)) {
1877
+ const path = patternPath(node.id, identifier.name);
1878
+ const full = path && [...root.path, ...path].join(".");
1879
+ if (full && providers.has(full)) report(identifier, full);
1880
+ }
1881
+ }
1882
+ };
1883
+ }
1884
+ });
1885
+ /** True when `node` is a limiter from `createRateLimiter()`, directly or through a `const`. */
1886
+ function isRateLimiter(r, node, seen = /* @__PURE__ */ new Set()) {
1887
+ const target = unwrap(node);
1888
+ if (seen.has(target)) return false;
1889
+ seen.add(target);
1890
+ if (isNodeType(target, "CallExpression")) return isExport(r.callee(target), ["rate-limit"], "createRateLimiter");
1891
+ const binding = r.binding(target);
1892
+ return Boolean(binding && isNodeType(binding.declaration, "VariableDeclarator") && isIdentifier(binding.declaration.id) && isRateLimiter(r, binding.init, seen));
1893
+ }
1894
+ const checkRateLimitDecision = createRule({
1895
+ meta: {
1896
+ id: "vitehub/check-rate-limit-decision",
1897
+ title: "Check `decision.allowed` from a Rate Limit",
1898
+ category: "correctness",
1899
+ severity: "error",
1900
+ requires: { script: true }
1901
+ },
1902
+ create(ctx) {
1903
+ const r = resolver(ctx);
1904
+ return { CallExpression(node) {
1905
+ const callee = unwrap(node.callee);
1906
+ const name = isExport(r.callee(node), ["rate-limit"], "checkRateLimit") ? "checkRateLimit()" : isNodeType(callee, "MemberExpression") && isIdentifier(callee.property, "consume") && isRateLimiter(r, callee.object) ? "consume()" : void 0;
1907
+ if (!name) return;
1908
+ const awaited = semanticParent(node).parent;
1909
+ if (awaited?.type !== "AwaitExpression") return;
1910
+ const { parent, child } = semanticParent(awaited);
1911
+ if (!parent) return;
1912
+ const ignored = parent.type === "ExpressionStatement";
1913
+ const asBoolean = parent.type === "UnaryExpression" && parent.operator === "!" || parent.type === "LogicalExpression" || [
1914
+ "IfStatement",
1915
+ "WhileStatement",
1916
+ "ConditionalExpression"
1917
+ ].includes(parent.type) && parent.test === child;
1918
+ if (!ignored && !asBoolean) return;
1919
+ const result = name === "checkRateLimit()";
1920
+ ctx.report(diagnostics.VHUB0008({
1921
+ why: ignored ? `\`${name}\` uses a token and returns ${result ? "a Result with the decision" : "a decision"}, but this code ignores it. The operation runs when the limit is reached.` : `\`${name}\` returns ${result ? "an `[error, decision]` Result" : "a decision object"}, which is always truthy. This check never sees a reached limit.`,
1922
+ fix: result ? "Read the Result and stop the operation when it is not allowed: `const [error, decision] = await checkRateLimit(...)`, then `if (error || !decision.allowed) ...`. Use `requireRateLimit()` to reject with status 429." : "Store the decision and stop the operation when it is not allowed: `if (!decision.allowed) ...`. Use `requireRateLimit()` to reject with status 429."
1923
+ }), { range: ctx.range(awaited) });
1924
+ } };
1925
+ }
1926
+ });
1927
+ /** True when the call result is assigned to a name that is declared outside `handler`. */
1928
+ function isAssignedOutside(r, call, handler) {
1929
+ let current = parentOf(call);
1930
+ while (current && current !== handler) {
1931
+ if (isNodeType(current, "AssignmentExpression") && isIdentifier(current.left)) {
1932
+ let declaration = r.binding(current.left)?.declaration;
1933
+ while (declaration && declaration !== handler) declaration = parentOf(declaration);
1934
+ if (!declaration) return true;
1935
+ }
1936
+ current = parentOf(current);
1937
+ }
1938
+ return false;
1939
+ }
1940
+ const rateLimiterAtModuleScope = createRule({
1941
+ meta: {
1942
+ id: "vitehub/rate-limiter-at-module-scope",
1943
+ title: "Create memory Rate Limiters once per module",
1944
+ category: "correctness",
1945
+ severity: "error",
1946
+ requires: { script: true }
1947
+ },
1948
+ create(ctx) {
1949
+ if (isTestFile(ctx.file.relativePath)) return;
1950
+ const r = resolver(ctx);
1951
+ return { CallExpression(node) {
1952
+ if (!isExport(r.callee(node), ["rate-limit/drivers/memory"], "memoryRateLimitDriver")) return;
1953
+ let current = parentOf(node);
1954
+ while (current && !(isFunctionNode(current) && isRouteHandler(ctx, current))) current = parentOf(current);
1955
+ if (!current || isAssignedOutside(r, node, current)) return;
1956
+ ctx.report(diagnostics.VHUB0009({
1957
+ why: "`memoryRateLimitDriver()` keeps its counters in the driver object. This route handler creates a new driver for each request, so every request starts at zero and the limit is never reached.",
1958
+ fix: "Create the driver and its `createRateLimiter()` once at module scope, and use that limiter in the handler."
1959
+ }), { range: ctx.range(node) });
1960
+ } };
1961
+ }
1962
+ });
1963
+ const authRuntimeOptions = /* @__PURE__ */ new Set([
1964
+ "baseURL",
1965
+ "secret",
1966
+ "secrets"
1967
+ ]);
1968
+ const authRuntimeOptionsRule = createRule({
1969
+ meta: {
1970
+ id: "vitehub/auth-runtime-options",
1971
+ title: "Resolve Auth runtime options in the `defineAuth()` callback",
1972
+ category: "correctness",
1973
+ severity: "error",
1974
+ requires: { script: true }
1975
+ },
1976
+ create(ctx) {
1977
+ const r = resolver(ctx);
1978
+ return { CallExpression(node) {
1979
+ if (!isViteHubCall(r, node, ["auth"], "defineAuth")) return;
1980
+ const options = callArguments(node)[0];
1981
+ for (const property of objectProperties(options)) {
1982
+ const key = propertyName(property);
1983
+ if (!key || !authRuntimeOptions.has(key)) continue;
1984
+ ctx.report(diagnostics.VHUB0010({
1985
+ why: `\`defineAuth()\` resolves \`${key}\` at runtime. In the static options object, the build accepts it, then \`defineAuth()\` throws \`AUTH_C0037\` when the server loads the Auth Definition.`,
1986
+ fix: `Pass a callback and return \`${key}\` from it, for example \`defineAuth(({ env, requestOrigin }) => ({ baseURL: requestOrigin, secret: env.auth.secret.unseal() }))\`.`
1987
+ }), { range: ctx.range(property) });
1988
+ }
1989
+ } };
1990
+ }
1991
+ });
1992
+ const noAgentConnectionActor = createRule({
1993
+ meta: {
1994
+ id: "vitehub/no-agent-connection-actor",
1995
+ title: "Do not claim an Agent actor in `useConnection()`",
1996
+ category: "security",
1997
+ severity: "error",
1998
+ requires: { script: true }
1999
+ },
2000
+ create(ctx) {
2001
+ const r = resolver(ctx);
2002
+ return { CallExpression(node) {
2003
+ if (!isExport(r.callee(node), ["connections/server"], "useConnection")) return;
2004
+ const actor = objectProperty(callArguments(node)[1], "actor");
2005
+ const value = stringValue(actor?.value);
2006
+ if (!actor || !value?.startsWith("agent:")) return;
2007
+ ctx.report(diagnostics.VHUB0011({
2008
+ why: `\`actor: "${value}"\` claims an Agent identity. Only the Agent runtime can act as an Agent, so the first call throws \`CONNECTIONS_INVALID_ACTOR\`.`,
2009
+ fix: "Use a server actor such as `\"schedule:gmail\"`, or call the Connection from the Agent with its Connection Capability."
2010
+ }), { range: ctx.range(actor) });
2011
+ } };
2012
+ }
2013
+ });
2014
+ const valibotObjectSchemas = /* @__PURE__ */ new Set([
2015
+ "object",
2016
+ "looseObject",
2017
+ "strictObject",
2018
+ "objectWithRest"
2019
+ ]);
2020
+ /** True for `v.object(...)` or `object(...)` imported from `valibot`. */
2021
+ function isValibotObject(r, call) {
2022
+ const callee = unwrap(call.callee);
2023
+ const root = chainRoot(callee);
2024
+ const origin = root ? r.binding(root)?.origin : void 0;
2025
+ if (origin?.source !== "valibot") return false;
2026
+ if (isIdentifier(callee)) return valibotObjectSchemas.has(origin.name);
2027
+ const path = memberPath(callee);
2028
+ return origin.name === "*" && path?.length === 2 && valibotObjectSchemas.has(path[1] ?? "");
2029
+ }
2030
+ const rules$4 = [
2031
+ unsealSecretEnv,
2032
+ noLiteralCredentials,
2033
+ awaitAsyncHelpers,
2034
+ loadProviderEnv,
2035
+ checkRateLimitDecision,
2036
+ rateLimiterAtModuleScope,
2037
+ authRuntimeOptionsRule,
2038
+ noAgentConnectionActor,
2039
+ createRule({
2040
+ meta: {
2041
+ id: "vitehub/no-nested-blob-reference-schema",
2042
+ title: "Do not nest Blob reference schemas in Valibot objects",
2043
+ category: "correctness",
2044
+ severity: "error",
2045
+ requires: { script: true }
2046
+ },
2047
+ create(ctx) {
2048
+ const r = resolver(ctx);
2049
+ return { CallExpression(node) {
2050
+ if (!isValibotObject(r, node)) return;
2051
+ for (const property of objectProperties(callArguments(node)[0])) {
2052
+ const value = unwrap(property.value);
2053
+ const reference = isNodeType(value, "CallExpression") ? r.callee(value) : void 0;
2054
+ if (!reference || !isExport(reference, ["blob"], ["image", "file"])) continue;
2055
+ ctx.report(diagnostics.VHUB0012({
2056
+ why: `\`${reference.name}()\` is a Standard Schema, not a Valibot schema. Valibot accepts the object, then fails when it parses a value.`,
2057
+ fix: `Validate the field with \`${reference.name}()['~standard'].validate(value)\`, or pass \`${reference.name}()\` where a Standard Schema is read directly, such as an Agent tool \`inputSchema\`.`
2058
+ }), { range: ctx.range(property) });
2059
+ }
2060
+ } };
2061
+ }
2062
+ })
2063
+ ];
2064
+ //#endregion
2065
+ //#region src/doctor/rules/integrations.ts
2066
+ const dependencyFields = [
2067
+ "dependencies",
2068
+ "devDependencies",
2069
+ "peerDependencies",
2070
+ "optionalDependencies"
2071
+ ];
2072
+ /** True when the project `package.json` lists `name` in any dependency field. */
2073
+ function dependsOn(ctx, name) {
2074
+ const manifest = ctx.fs.readJson("package.json");
2075
+ if (!manifest || typeof manifest !== "object") return false;
2076
+ return dependencyFields.some((field) => {
2077
+ const dependencies = Reflect.get(manifest, field);
2078
+ return Boolean(dependencies && typeof dependencies === "object" && Reflect.has(dependencies, name));
2079
+ });
2080
+ }
2081
+ function programBody(ctx) {
2082
+ const program = ctx.file.scriptAst;
2083
+ return isNode(program) && Array.isArray(program.body) ? program.body : [];
2084
+ }
2085
+ /** Import declarations at the top of the file, with the imported name for each local binding. */
2086
+ function importsOf(ctx) {
2087
+ return programBody(ctx).flatMap((statement) => {
2088
+ if (!isNodeType(statement, "ImportDeclaration") || !isNode(statement.source) || typeof statement.source.value !== "string") return [];
2089
+ const specifiers = (Array.isArray(statement.specifiers) ? statement.specifiers : []).flatMap((specifier) => {
2090
+ if (!isNode(specifier) || !isIdentifier(specifier.local)) return [];
2091
+ return [{
2092
+ imported: specifier.type === "ImportDefaultSpecifier" ? "default" : specifier.type === "ImportNamespaceSpecifier" ? "*" : isIdentifier(specifier.imported) ? specifier.imported.name : stringValue(specifier.imported) ?? specifier.local.name,
2093
+ local: specifier.local.name,
2094
+ typeOnly: specifier.importKind === "type",
2095
+ node: specifier
2096
+ }];
2097
+ });
2098
+ return [{
2099
+ source: statement.source.value,
2100
+ node: statement,
2101
+ specifiers,
2102
+ typeOnly: statement.importKind === "type"
2103
+ }];
2104
+ });
2105
+ }
2106
+ /** The ViteHub export that a call or `new` expression calls, when it is `name` from one of `modules`. */
2107
+ function calls(r, node, modules, name) {
2108
+ const reference = r.callee(node);
2109
+ return Boolean(reference && reference.path.length === 0 && modules.includes(reference.module) && reference.name === name);
2110
+ }
2111
+ /** True when `node` calls `vitehub()` imported from the `vite-hub` root. */
2112
+ function isViteHubPluginCall(r, node) {
2113
+ const target = unwrap(node);
2114
+ if (!isNodeType(target, "CallExpression")) return false;
2115
+ const origin = r.binding(target.callee)?.origin;
2116
+ return origin?.source === "vite-hub" && origin.name === "vitehub";
2117
+ }
2118
+ const nuxtConfigFile = /(?:^|\/)nuxt\.config\.[cm]?[jt]s$/;
2119
+ const viteConfigFile = /(?:^|\/)vite\.config\.[cm]?[jt]s$/;
2120
+ /** The object literal that a config file exports, through `defineNuxtConfig()` or `defineConfig()`. */
2121
+ function configObject(ctx) {
2122
+ const exported = unwrap(defaultExport(ctx)?.value);
2123
+ const value = isNodeType(exported, "CallExpression") ? unwrap(callArguments(exported)[0]) : exported;
2124
+ return isNodeType(value, "ObjectExpression") ? value : void 0;
2125
+ }
2126
+ /** The entries of `modules` in a Nuxt config, with the name and inline options of each. */
2127
+ function nuxtModules(config) {
2128
+ const modules = unwrap(objectValue(config, "modules"));
2129
+ if (!isNodeType(modules, "ArrayExpression") || !Array.isArray(modules.elements)) return [];
2130
+ return modules.elements.flatMap((element) => {
2131
+ const name = stringValue(element);
2132
+ if (name) return [{
2133
+ name,
2134
+ node: element
2135
+ }];
2136
+ const entry = unwrap(element);
2137
+ if (!isNodeType(entry, "ArrayExpression") || !Array.isArray(entry.elements)) return [];
2138
+ const tupleName = stringValue(entry.elements[0]);
2139
+ return tupleName ? [{
2140
+ name: tupleName,
2141
+ options: entry.elements[1],
2142
+ node: element
2143
+ }] : [];
2144
+ });
2145
+ }
2146
+ function arrayElements(node) {
2147
+ const target = unwrap(node);
2148
+ return isNodeType(target, "ArrayExpression") && Array.isArray(target.elements) ? target.elements : [];
2149
+ }
2150
+ /** A property value that is present and is not the literal `undefined`. */
2151
+ function hasValue(object, name) {
2152
+ const property = objectProperty(object, name);
2153
+ return Boolean(property && !isIdentifier(unwrap(property.value), "undefined"));
2154
+ }
2155
+ const caretExtension = "@tiptap/extension-collaboration-caret";
2156
+ const realtimeCarets = createRule({
2157
+ meta: {
2158
+ id: "vitehub/realtime-carets",
2159
+ title: "Use the Realtime carets option instead of CollaborationCaret",
2160
+ category: "correctness",
2161
+ severity: "warn",
2162
+ requires: { script: true }
2163
+ },
2164
+ create(ctx) {
2165
+ if (!importsOf(ctx).some((declaration) => vitehubModule(declaration.source)?.startsWith("realtime") && !declaration.typeOnly && declaration.specifiers.some((specifier) => !specifier.typeOnly))) return;
2166
+ return moduleSourceVisitors((node, source) => {
2167
+ if (source.typeOnly || source.specifier !== caretExtension) return;
2168
+ ctx.report(diagnostics.VHUB0024({
2169
+ why: `\`${caretExtension}\` has its own copy of y-tiptap. It cannot find the sync plugin that ViteHub Realtime installs, so it draws no carets.`,
2170
+ fix: "Remove the CollaborationCaret extension. `realtime.extensions` already draws carets. To change their markup, pass `carets: { render, selectionRender }` to `useRealtimeTiptap()`."
2171
+ }), { range: ctx.range(node) });
2172
+ });
2173
+ }
2174
+ });
2175
+ const persistenceDefaults = {
2176
+ debounce: 2e3,
2177
+ maxWait: 1e4
2178
+ };
2179
+ const realtimePersistence = createRule({
2180
+ meta: {
2181
+ id: "vitehub/realtime-persistence",
2182
+ title: "Give Realtime persistence valid timings",
2183
+ category: "correctness",
2184
+ severity: "error",
2185
+ requires: { script: true }
2186
+ },
2187
+ create(ctx) {
2188
+ const r = resolver(ctx);
2189
+ return { CallExpression(node) {
2190
+ if (!calls(r, node, ["realtime"], "defineRealtime")) return;
2191
+ const persistence = unwrap(objectValue(callArguments(node)[0], "persistence"));
2192
+ if (!isNodeType(persistence, "ObjectExpression") || objectProperties(persistence).some((property) => property.type === "SpreadElement")) return;
2193
+ const timings = {};
2194
+ for (const name of ["debounce", "maxWait"]) {
2195
+ const property = objectProperty(persistence, name);
2196
+ if (!property) {
2197
+ timings[name] = persistenceDefaults[name];
2198
+ continue;
2199
+ }
2200
+ const value = numberValue(property.value);
2201
+ const literal = unwrap(property.value);
2202
+ if (value !== void 0 && Number.isFinite(value) && value >= 0) timings[name] = value;
2203
+ else if (value !== void 0 || isNodeType(literal, "Literal") || isNodeType(literal, "TemplateLiteral")) ctx.report(diagnostics.VHUB0025({
2204
+ why: `\`persistence.${name}\` must be a number of milliseconds that is 0 or more. ViteHub Realtime throws \`REALTIME_INVALID_PERSISTENCE\` when the first room opens.`,
2205
+ fix: `Set \`${name}\` to milliseconds, for example \`${name}: ${persistenceDefaults[name]}\`.`
2206
+ }), { range: ctx.range(property) });
2207
+ }
2208
+ if (timings.debounce !== void 0 && timings.maxWait !== void 0 && timings.maxWait < timings.debounce) ctx.report(diagnostics.VHUB0025({
2209
+ why: `\`persistence.maxWait\` (${timings.maxWait} ms) is less than \`persistence.debounce\` (${timings.debounce} ms). ViteHub Realtime throws \`REALTIME_INVALID_PERSISTENCE\` when the first room opens. Unset values use the defaults: debounce ${persistenceDefaults.debounce} ms, maxWait ${persistenceDefaults.maxWait} ms.`,
2210
+ fix: "Make `maxWait` equal to or greater than `debounce`."
2211
+ }), { range: ctx.range(persistence) });
2212
+ } };
2213
+ }
2214
+ });
2215
+ const forgeClasses = /* @__PURE__ */ new Set([
2216
+ "BranchMovedError",
2217
+ "ForgeApiError",
2218
+ "ForgeTimeoutError",
2219
+ "MergeBlockedError",
2220
+ "NotFoundError",
2221
+ "RateLimitedError"
2222
+ ]);
2223
+ const forgeErrorImports = createRule({
2224
+ meta: {
2225
+ id: "vitehub/forge-error-imports",
2226
+ title: "Import Forge error classes from @vite-hub/forge",
2227
+ category: "correctness",
2228
+ severity: "warn",
2229
+ requires: { script: true }
2230
+ },
2231
+ create(ctx) {
2232
+ if (!dependsOn(ctx, "@vite-hub/forge")) return;
2233
+ return { ImportDeclaration(node) {
2234
+ if (node.importKind === "type") return;
2235
+ if (!isNode(node.source) || node.source.value !== "forges") return;
2236
+ const names = (Array.isArray(node.specifiers) ? node.specifiers : []).flatMap((specifier) => isNode(specifier) && specifier.importKind !== "type" && isIdentifier(specifier.imported) && forgeClasses.has(specifier.imported.name) ? [specifier.imported.name] : []);
2237
+ if (!names.length) return;
2238
+ ctx.report(diagnostics.VHUB0026({
2239
+ why: `\`${names.join("`, `")}\` from \`forges\` is a different class from the one that \`@vite-hub/forge\` bundles. \`forgeProvider()\` throws the bundled classes, so \`instanceof\` checks against this import are always false.`,
2240
+ fix: `Import \`${names.join("`, `")}\` from \`@vite-hub/forge\`.`
2241
+ }), { range: ctx.range(node) });
2242
+ } };
2243
+ }
2244
+ });
2245
+ const runtimeNames = /* @__PURE__ */ new Set([
2246
+ "crabbox",
2247
+ "trusted-host",
2248
+ "vercel"
2249
+ ]);
2250
+ const runtimeKinds = /* @__PURE__ */ new Set([
2251
+ "cloudflare",
2252
+ "container",
2253
+ "crabbox",
2254
+ "trusted-host",
2255
+ "vercel"
2256
+ ]);
2257
+ function checkSandboxDefinition(ctx, definition) {
2258
+ const target = unwrap(definition);
2259
+ if (!isNodeType(target, "ObjectExpression") || objectProperties(target).some((property) => property.type === "SpreadElement")) return;
2260
+ const runtimeProperty = objectProperty(target, "runtime");
2261
+ const runtime = unwrap(runtimeProperty?.value);
2262
+ const runtimeName = stringValue(runtime);
2263
+ const kind = isNodeType(runtime, "ObjectExpression") ? stringValue(objectValue(runtime, "kind")) : void 0;
2264
+ if (runtimeProperty && runtimeName !== void 0 && !runtimeNames.has(runtimeName)) ctx.report(diagnostics.VHUB0027({
2265
+ why: runtimeName === "cloudflare" ? "`runtime: \"cloudflare\"` is not a valid Sandbox runtime. Cloudflare needs its Durable Objects namespace, so it has only a tagged form. `resolveSandbox()` throws `SANDBOX_R0031` on each call." : `\`runtime: "${runtimeName}"\` is not a Sandbox runtime. \`resolveSandbox()\` throws \`SANDBOX_R0031\` on each call.`,
2266
+ fix: runtimeName === "cloudflare" ? "Use `runtime: { kind: \"cloudflare\", namespace: env.SANDBOX }`." : "Use `\"crabbox\"`, `\"trusted-host\"`, `\"vercel\"`, a tagged configuration such as `{ kind: \"cloudflare\", namespace }` or `{ kind: \"container\", image }`, or a custom runtime object."
2267
+ }), { range: ctx.range(runtimeProperty) });
2268
+ if (kind !== void 0 && !runtimeKinds.has(kind)) ctx.report(diagnostics.VHUB0027({
2269
+ why: `\`kind: "${kind}"\` is not a Sandbox runtime kind. \`resolveSandbox()\` throws \`SANDBOX_R0033\` on each call.`,
2270
+ fix: "Use `kind: \"crabbox\"`, `\"trusted-host\"`, `\"cloudflare\"`, `\"container\"`, or `\"vercel\"`."
2271
+ }), { range: ctx.range(runtime) });
2272
+ const cwd = hasValue(target, "cwd");
2273
+ const checkout = hasValue(target, "checkout");
2274
+ if (cwd && checkout) ctx.report(diagnostics.VHUB0027({
2275
+ why: "A Sandbox cannot have both `cwd` and `checkout`. `resolveSandbox()` throws `SANDBOX_R0035` on each call.",
2276
+ fix: "Use `cwd` for a directory that the caller owns, or `checkout` for a disposable Git checkout. Remove the other."
2277
+ }), { range: ctx.range(target) });
2278
+ if ((runtimeName === "crabbox" || kind === "crabbox") && !cwd && !checkout) ctx.report(diagnostics.VHUB0027({
2279
+ why: "The `crabbox` runtime needs a working directory. It throws `SANDBOX_R0091` when the Sandbox opens.",
2280
+ fix: "Add `cwd` or `checkout` to the Sandbox definition."
2281
+ }), { range: ctx.range(target) });
2282
+ }
2283
+ const sandboxRuntimeOptions = createRule({
2284
+ meta: {
2285
+ id: "vitehub/sandbox-runtime-options",
2286
+ title: "Give Sandbox definitions a valid runtime",
2287
+ category: "correctness",
2288
+ severity: "error",
2289
+ requires: { script: true }
2290
+ },
2291
+ create(ctx) {
2292
+ const r = resolver(ctx);
2293
+ return { CallExpression(node) {
2294
+ if (calls(r, node, ["sandbox"], "resolveSandbox")) checkSandboxDefinition(ctx, callArguments(node)[0]);
2295
+ else if (calls(r, node, ["agent"], "defineAgent")) checkSandboxDefinition(ctx, objectValue(callArguments(node)[0], "sandbox"));
2296
+ } };
2297
+ }
2298
+ });
2299
+ const rateLimitCapabilityLimiter = createRule({
2300
+ meta: {
2301
+ id: "vitehub/rate-limit-capability-limiter",
2302
+ title: "Give the rateLimit Capability a limiter",
2303
+ category: "correctness",
2304
+ severity: "error",
2305
+ requires: { script: true }
2306
+ },
2307
+ create(ctx) {
2308
+ const r = resolver(ctx);
2309
+ return { CallExpression(node) {
2310
+ if (!calls(r, node, ["agent/capabilities"], "rateLimit")) return;
2311
+ const options = unwrap(callArguments(node)[0]);
2312
+ if (!isNodeType(options, "ObjectExpression") || objectProperties(options).some((property) => property.type === "SpreadElement")) return;
2313
+ if (objectProperty(options, "limiter")) return;
2314
+ const inline = [
2315
+ "limit",
2316
+ "window",
2317
+ "store"
2318
+ ].filter((name) => objectProperty(options, name));
2319
+ ctx.report(diagnostics.VHUB0029({
2320
+ why: inline.length ? `\`rateLimit()\` no longer accepts the inline \`${inline.join("`, `")}\` options. Without \`limiter\`, the Capability throws \`AGENT_R0162\` on the first Invocation.` : "`rateLimit()` needs a `limiter`. Without it, the Capability throws `AGENT_R0162` on the first Invocation.",
2321
+ fix: "Pass a Rate Limiter: `rateLimit({ limiter: createRateLimiter({ driver: memoryRateLimitDriver(), limit: 20, window: \"1m\" }) })`, with `createRateLimiter` from `vite-hub/rate-limit` and `memoryRateLimitDriver` from `vite-hub/rate-limit/drivers/memory`."
2322
+ }), { range: ctx.range(node) });
2323
+ } };
2324
+ }
2325
+ });
2326
+ const noViteHubPluginInNuxt = createRule({
2327
+ meta: {
2328
+ id: "vitehub/no-vitehub-plugin-in-nuxt",
2329
+ title: "Configure ViteHub in Nuxt through the module only",
2330
+ category: "correctness",
2331
+ severity: "warn",
2332
+ requires: { script: true }
2333
+ },
2334
+ create(ctx) {
2335
+ if (!nuxtConfigFile.test(ctx.file.relativePath)) return;
2336
+ const config = configObject(ctx);
2337
+ if (!config || !nuxtModules(config).some((entry) => entry.name === "vite-hub/nuxt")) return;
2338
+ const r = resolver(ctx);
2339
+ for (const plugin of arrayElements(objectValue(objectValue(config, "vite"), "plugins"))) {
2340
+ if (!isViteHubPluginCall(r, plugin)) continue;
2341
+ ctx.report(diagnostics.VHUB0030({
2342
+ why: "`vite-hub/nuxt` installs the `vitehub()` plugins itself. It keeps a plugin from `vite.plugins` that has the same name in place of its own, so the options of this `vitehub()` call silently replace the module options.",
2343
+ fix: "Remove `vitehub()` from `vite.plugins`. Put its options in the `vitehub` key of `nuxt.config.ts`."
2344
+ }), { range: ctx.range(plugin) });
2345
+ }
2346
+ }
2347
+ });
2348
+ /** Feature keys that owner plugins no longer read from the top level of a Vite config. */
2349
+ const topLevelFeatureKeys = [
2350
+ "agent",
2351
+ "auth",
2352
+ "blob",
2353
+ "browser",
2354
+ "database",
2355
+ "kv",
2356
+ "queue",
2357
+ "rateLimit",
2358
+ "sandboxTask",
2359
+ "workflow",
2360
+ "workspace"
2361
+ ];
2362
+ function checkViteHubOptions(ctx, options, where) {
2363
+ const target = unwrap(options);
2364
+ if (!isNodeType(target, "ObjectExpression")) return;
2365
+ for (const property of objectProperties(target)) {
2366
+ const name = propertyName(property);
2367
+ let report;
2368
+ const removed = name !== void 0 && Object.hasOwn(removedViteHubOptions, name) ? removedViteHubOptions[name] : void 0;
2369
+ if (removed) report = {
2370
+ why: `${removed.why} The build fails on this key.`,
2371
+ fix: removed.fix
2372
+ };
2373
+ if (report) ctx.report(diagnostics.VHUB0031({
2374
+ why: `In ${where}: ${report.why}`,
2375
+ fix: report.fix
2376
+ }), { range: ctx.range(property) });
2377
+ }
2378
+ }
2379
+ const validViteHubOptions = createRule({
2380
+ meta: {
2381
+ id: "vitehub/valid-vitehub-options",
2382
+ title: "Use ViteHub options that take effect",
2383
+ category: "correctness",
2384
+ severity: "warn",
2385
+ requires: { script: true }
2386
+ },
2387
+ create(ctx) {
2388
+ if (nuxtConfigFile.test(ctx.file.relativePath)) {
2389
+ const config = configObject(ctx);
2390
+ if (!config) return;
2391
+ const module = nuxtModules(config).find((entry) => entry.name === "vite-hub/nuxt");
2392
+ if (!module) return;
2393
+ checkViteHubOptions(ctx, objectValue(config, "vitehub"), "the `vitehub` key");
2394
+ checkViteHubOptions(ctx, module.options, "the inline `vite-hub/nuxt` options");
2395
+ return;
2396
+ }
2397
+ if (!viteConfigFile.test(ctx.file.relativePath)) return;
2398
+ const config = configObject(ctx);
2399
+ for (const name of ["env", ...topLevelFeatureKeys]) {
2400
+ const property = config ? objectProperty(config, name) : void 0;
2401
+ if (!property) continue;
2402
+ ctx.report(diagnostics.VHUB0031({
2403
+ why: `Vite does not read a top-level \`${name}\` key. Only \`vitehub()\` reads feature options, so this value does nothing.`,
2404
+ fix: `Move it into \`vitehub({ ${name} })\`, or pass it to the feature's own plugin, such as \`${name === "env" ? "hubEnv" : "hubKV"}(options)\`. \`npx @vite-hub/codemods vitehub-options\` moves it.`
2405
+ }), { range: ctx.range(property) });
2406
+ }
2407
+ const r = resolver(ctx);
2408
+ return { CallExpression(node) {
2409
+ if (isViteHubPluginCall(r, node)) checkViteHubOptions(ctx, callArguments(node)[0], "`vitehub()`");
2410
+ } };
2411
+ }
2412
+ });
2413
+ const nuxtHubImport = /^(?:hub:(?:db(?::schema)?|kv|blob)|@nuxthub\/.+)$/;
2414
+ /** Server helpers that NuxtHub auto-imports. ViteHub registers none of them. */
2415
+ const nuxtHubHelpers = /* @__PURE__ */ new Map([
2416
+ ["hubAI", "ViteHub has no AI binding helper. Call the AI SDK from a route or an Agent."],
2417
+ ["hubBlob", "Use `blob` from `vite-hub/blob`. Its methods return `[error, value]` tuples."],
2418
+ ["hubDatabase", "Use the Drizzle `db` from `vite-hub/database`."],
2419
+ ["hubKV", "Use `kv` from `vite-hub/kv`. Its methods return `[error, value]` tuples."]
2420
+ ]);
2421
+ const noNuxtHubLeftovers = createRule({
2422
+ meta: {
2423
+ id: "vitehub/no-nuxthub-leftovers",
2424
+ title: "Finish the move from NuxtHub",
2425
+ category: "correctness",
2426
+ severity: "warn",
2427
+ requires: { script: true }
2428
+ },
2429
+ create(ctx) {
2430
+ const config = nuxtConfigFile.test(ctx.file.relativePath) ? configObject(ctx) : void 0;
2431
+ const modules = config ? nuxtModules(config) : [];
2432
+ if (!(dependsOn(ctx, "vite-hub") || modules.some((entry) => entry.name === "vite-hub/nuxt"))) return;
2433
+ if (config) {
2434
+ for (const entry of modules) {
2435
+ if (entry.name !== "@nuxthub/core") continue;
2436
+ ctx.report(diagnostics.VHUB0032({
2437
+ why: "The Nuxt config still installs `@nuxthub/core`. NuxtHub and ViteHub both register `kv`, `blob`, and database helpers, so the app can call the wrong one.",
2438
+ fix: "Remove `@nuxthub/core` from `modules` and from `package.json`. Use `vite-hub/nuxt`."
2439
+ }), { range: ctx.range(entry.node) });
2440
+ }
2441
+ const hub = objectProperty(config, "hub");
2442
+ if (hub) ctx.report(diagnostics.VHUB0032({
2443
+ why: "`vite-hub/nuxt` does not read the NuxtHub `hub` key, so these features stay off.",
2444
+ fix: "Rename `hub` to `vitehub` and add a `host`. For example, `hub: { db: \"sqlite\" }` becomes `vitehub: { host: \"node\", database: true }`."
2445
+ }), { range: ctx.range(hub) });
2446
+ for (const dependent of viteHubInventory(ctx).nuxtHubDependents ?? []) {
2447
+ const entry = modules.find((module) => module.name === dependent.name);
2448
+ ctx.report(diagnostics.VHUB0032({
2449
+ why: `\`${dependent.name}\` lists \`@nuxthub/core\` in its ${dependent.field}, so the package manager installs NuxtHub for it, and the module can start NuxtHub next to ViteHub. ViteHub does not emulate NuxtHub's module APIs.`,
2450
+ fix: `Remove \`${dependent.name}\` from \`package.json\` and \`modules\`, or replace it. See https://vitehub.dev/docs/getting-started/migrate-from-nuxthub#modules-that-expect-nuxthub.`
2451
+ }), { range: ctx.range(entry?.node ?? objectProperty(config, "modules") ?? config) });
2452
+ }
2453
+ }
2454
+ const r = resolver(ctx);
2455
+ return {
2456
+ ...moduleSourceVisitors((node, source) => {
2457
+ if (!nuxtHubImport.test(source.specifier)) return;
2458
+ ctx.report(diagnostics.VHUB0032({
2459
+ why: `\`${source.specifier}\` is a NuxtHub import. ViteHub does not provide it.`,
2460
+ fix: "Import `kv` from `vite-hub/kv`, `blob` from `vite-hub/blob`, and `db` from `vite-hub/database`. Each KV and Blob method returns an `[error, value]` tuple."
2461
+ }), { range: ctx.range(node) });
2462
+ }),
2463
+ CallExpression(node) {
2464
+ const callee = unwrap(node.callee);
2465
+ const name = isIdentifier(callee) && !r.binding(callee) ? callee.name : void 0;
2466
+ const helper = name ? nuxtHubHelpers.get(name) : void 0;
2467
+ if (!helper) return;
2468
+ ctx.report(diagnostics.VHUB0032({
2469
+ why: `\`${name}()\` is a NuxtHub auto-import. ViteHub does not register it, so the call fails at runtime.`,
2470
+ fix: helper
2471
+ }), { range: ctx.range(node) });
2472
+ }
2473
+ };
2474
+ }
2475
+ });
2476
+ /** Import paths that ViteHub removed, with the path that replaces each one. */
2477
+ const removedPaths = new Map([
2478
+ ["vite-hub/box", {
2479
+ replacement: "vite-hub/sandbox",
2480
+ note: "Box was renamed to Sandbox."
2481
+ }],
2482
+ ["vite-hub/sandbox-task", {
2483
+ replacement: "vite-hub/sandbox/task",
2484
+ note: "Sandbox Task moved into the Sandbox package."
2485
+ }],
2486
+ ["@vite-hub/sandbox-task", {
2487
+ replacement: "@vite-hub/sandbox/task",
2488
+ note: "Sandbox Task moved into the Sandbox package."
2489
+ }],
2490
+ ["vite-hub/content/presets/cms", {
2491
+ replacement: "vite-hub/cms",
2492
+ note: "The CMS has its own package."
2493
+ }],
2494
+ ["@vite-hub/content/presets/cms", {
2495
+ replacement: "@vite-hub/cms",
2496
+ note: "The CMS has its own package."
2497
+ }],
2498
+ ["vite-hub/schedule/runtime/driver", {
2499
+ replacement: "`startSchedule()` from `vite-hub/schedule`, with a Definition without `cron` in `server/schedules/`",
2500
+ note: "Runtime Schedules are started with `startSchedule()`."
2501
+ }],
2502
+ ["vite-hub/database/drizzle", {
2503
+ replacement: "vite-hub/database",
2504
+ note: "`db`, `schema`, `useDatabase`, and `chunkParameters` moved to the Database root. `vitehub migrate` rewrites the import."
2505
+ }],
2506
+ ["@vite-hub/database/drizzle", {
2507
+ replacement: "@vite-hub/database",
2508
+ note: "`db`, `schema`, `useDatabase`, and `chunkParameters` moved to the Database root. `vitehub migrate` rewrites the import."
2509
+ }],
2510
+ ["vite-hub/email/server", {
2511
+ replacement: "vite-hub/email",
2512
+ note: "`email` moved to the Email root. `vitehub migrate` rewrites the import."
2513
+ }],
2514
+ ["@vite-hub/email/server", {
2515
+ replacement: "@vite-hub/email",
2516
+ note: "`email` moved to the Email root. `vitehub migrate` rewrites the import."
2517
+ }],
2518
+ ["#vitehub/env/server", {
2519
+ replacement: "vite-hub/env",
2520
+ note: "`useServerEnv()` and the other Server Env helpers moved to the Env root. `vitehub migrate` rewrites the import."
2521
+ }],
2522
+ ...oneEntryPerConcept()
2523
+ ]);
2524
+ /** Subpaths that moved into the root of their primitive, or into `env/bridge`. `npx @vite-hub/codemods one-entry-imports` moves them. */
2525
+ function oneEntryPerConcept() {
2526
+ const moves = [
2527
+ ...[
2528
+ "file",
2529
+ "files",
2530
+ "github",
2531
+ "glob",
2532
+ "markdown"
2533
+ ].map((name) => [`source/${name}`, "source"]),
2534
+ ...[
2535
+ "presets",
2536
+ "provider",
2537
+ "schema",
2538
+ "secret"
2539
+ ].map((name) => [`env/${name}`, "env"]),
2540
+ ["env/auth", "env/bridge"],
2541
+ ["env/http", "env/bridge"],
2542
+ ["blob/content-type", "blob"],
2543
+ ["blob/ensure", "blob"],
2544
+ ["blob/reference", "blob"],
2545
+ ["browser/actions", "browser"],
2546
+ ["connections/http", "connections"]
2547
+ ];
2548
+ const note = "Each concept has one entry. Run `npx @vite-hub/codemods one-entry-imports` to move the imports.";
2549
+ return [...moves.flatMap(([from, to]) => [[`vite-hub/${from}`, {
2550
+ replacement: `vite-hub/${to}`,
2551
+ note
2552
+ }], [`@vite-hub/${from}`, {
2553
+ replacement: `@vite-hub/${to}`,
2554
+ note
2555
+ }]]), ["vite-hub/task", {
2556
+ replacement: "nitro/task",
2557
+ note: "`vite-hub/task` only re-exported Nitro's task API. Import `defineTask` and `runTask` from `nitro/task`, and the types from `nitro/types`."
2558
+ }]];
2559
+ }
2560
+ /** Exports that ViteHub renamed, by module name from `vitehubModule()`. */
2561
+ const renamedExports = [
2562
+ {
2563
+ modules: (module) => module === "ui" || module.startsWith("ui/"),
2564
+ renames: /* @__PURE__ */ new Map([
2565
+ ["AgentChat", "Chat"],
2566
+ ["AgentChatMessage", "ChatMessage"],
2567
+ ["AgentChatPrompt", "PromptInput"],
2568
+ ["AgentSession", "ChatSession"],
2569
+ ["AgentMarkdown", "Markdown"],
2570
+ ["AgentCodeView", "CodeView"],
2571
+ ["AgentFile", "FileView"],
2572
+ ["AgentFileDiff", "FileDiff"],
2573
+ ["AgentMultiFileDiff", "MultiFileDiff"],
2574
+ ["AgentPatchDiff", "PatchDiff"],
2575
+ ["AgentUnresolvedFile", "UnresolvedFile"],
2576
+ ["AgentFileTree", "FileTree"],
2577
+ ["AgentToolList", "ToolList"],
2578
+ ["AgentTrace", "TraceRun"],
2579
+ ["useAgentFileTree", "useFileTree"],
2580
+ ["useAgentFileTreeSelection", "useFileTreeSelection"]
2581
+ ])
2582
+ },
2583
+ {
2584
+ modules: (module) => module === "agent/capabilities",
2585
+ renames: /* @__PURE__ */ new Map([["cost", "usage"]])
2586
+ },
2587
+ {
2588
+ modules: (module) => module === "schedule" || module === "schedule/runtime",
2589
+ renames: /* @__PURE__ */ new Map([["defineScheduleTarget", "defineSchedule"], ["schedules", "startSchedule"]])
2590
+ }
2591
+ ];
2592
+ const noRemovedApis = createRule({
2593
+ meta: {
2594
+ id: "vitehub/no-removed-apis",
2595
+ title: "Replace removed ViteHub APIs",
2596
+ category: "correctness",
2597
+ severity: "error",
2598
+ requires: { script: true }
2599
+ },
2600
+ create(ctx) {
2601
+ const r = resolver(ctx);
2602
+ return {
2603
+ ...moduleSourceVisitors((node, source) => {
2604
+ const removed = removedPaths.get(source.specifier);
2605
+ if (removed) {
2606
+ ctx.report(diagnostics.VHUB0033({
2607
+ why: `\`${source.specifier}\` no longer exists. ${removed.note}`,
2608
+ fix: `Use ${removed.replacement.includes("`") ? removed.replacement : `\`${removed.replacement}\``}.`
2609
+ }), { range: ctx.range(node) });
2610
+ return;
2611
+ }
2612
+ const module = vitehubModule(source.specifier);
2613
+ const table = module ? renamedExports.find((entry) => entry.modules(module)) : void 0;
2614
+ if (table && isNodeType(node, "ImportDeclaration") && Array.isArray(node.specifiers)) for (const specifier of node.specifiers) {
2615
+ const imported = isNode(specifier) && isIdentifier(specifier.imported) ? specifier.imported.name : void 0;
2616
+ const replacement = imported && table.renames.get(imported);
2617
+ if (!replacement || !isNode(specifier)) continue;
2618
+ ctx.report(diagnostics.VHUB0033({
2619
+ why: `\`${source.specifier}\` no longer exports \`${imported}\`. It was renamed to \`${replacement}\`.`,
2620
+ fix: `Import \`${replacement}\` from \`${source.specifier}\`.`
2621
+ }), { range: ctx.range(specifier) });
2622
+ }
2623
+ }),
2624
+ CallExpression(node) {
2625
+ const options = callArguments(node)[0];
2626
+ if (calls(r, node, ["agent/capabilities"], "gmail")) {
2627
+ const mode = objectProperty(options, "mode");
2628
+ if (mode) ctx.report(diagnostics.VHUB0033({
2629
+ why: "`gmail()` no longer reads `mode`. ViteHub ignores it, so the Agent gets only the default `search` and `read` tools.",
2630
+ fix: "Use `operations`, for example `gmail({ operations: [\"search\", \"read\", \"draft\"] })`, and allow `gmail.users.drafts.create` in the Connection rules."
2631
+ }), { range: ctx.range(mode) });
2632
+ } else if (calls(r, node, ["content", "content/collections"], "documents")) {
2633
+ const route = objectProperty(options, "route");
2634
+ if (route) ctx.report(diagnostics.VHUB0033({
2635
+ why: "`documents()` no longer reads `route`. ViteHub ignores it, so document URLs, the sitemap, and `resolve()` fall back to the document id.",
2636
+ fix: "Rename `route` to `url`."
2637
+ }), { range: ctx.range(route) });
2638
+ }
2639
+ }
2640
+ };
2641
+ }
2642
+ });
2643
+ const markdownFilePath = createRule({
2644
+ meta: {
2645
+ id: "vitehub/markdown-file-path",
2646
+ title: "Pass renderMarkdownFile a path that does not depend on the working directory",
2647
+ category: "correctness",
2648
+ severity: "warn",
2649
+ requires: { script: true }
2650
+ },
2651
+ create(ctx) {
2652
+ const r = resolver(ctx);
2653
+ return { CallExpression(node) {
2654
+ if (!calls(r, node, ["markdown-template/file"], "renderMarkdownFile")) return;
2655
+ const path = callArguments(node)[0];
2656
+ const value = stringValue(path);
2657
+ if (value === void 0 || !/^\.\.?\//.test(value)) return;
2658
+ ctx.report(diagnostics.VHUB0034({
2659
+ why: `\`renderMarkdownFile("${value}")\` resolves the path from the working directory of the process, not from this file. It reads a different file, or none, when the server starts in another directory. Deployed bundles do not include the Markdown file.`,
2660
+ fix: `Import the template, \`import render from "${value.replace(/\.md$/, ".template.md")}"\`, so the build bundles it. To read the file at runtime, pass \`new URL("${value}", import.meta.url)\`.`
2661
+ }), { range: ctx.range(path) });
2662
+ } };
2663
+ }
2664
+ });
2665
+ const commentsEntryFile = /(?:^|\/)server\/comments\.m?[jt]s$/;
2666
+ /** The exported names of the entry, and the export statement of each name. */
2667
+ function namedExports(ctx) {
2668
+ const names = /* @__PURE__ */ new Map();
2669
+ for (const statement of programBody(ctx)) {
2670
+ if (!isNodeType(statement, "ExportNamedDeclaration") || statement.exportKind === "type") continue;
2671
+ const declaration = statement.declaration;
2672
+ if (isNodeType(declaration, "VariableDeclaration") && Array.isArray(declaration.declarations)) {
2673
+ for (const declarator of declaration.declarations) if (isNode(declarator) && isIdentifier(declarator.id)) names.set(declarator.id.name, declarator);
2674
+ }
2675
+ for (const specifier of Array.isArray(statement.specifiers) ? statement.specifiers : []) {
2676
+ if (!isNode(specifier) || specifier.exportKind === "type") continue;
2677
+ const name = isIdentifier(specifier.exported) ? specifier.exported.name : stringValue(specifier.exported);
2678
+ if (name) names.set(name, specifier);
2679
+ }
2680
+ }
2681
+ return names;
2682
+ }
2683
+ const rules$3 = [
2684
+ realtimeCarets,
2685
+ realtimePersistence,
2686
+ forgeErrorImports,
2687
+ sandboxRuntimeOptions,
2688
+ rateLimitCapabilityLimiter,
2689
+ noViteHubPluginInNuxt,
2690
+ validViteHubOptions,
2691
+ noNuxtHubLeftovers,
2692
+ noRemovedApis,
2693
+ markdownFilePath,
2694
+ createRule({
2695
+ meta: {
2696
+ id: "vitehub/comments-entry",
2697
+ title: "Export the live Comments API as `comments`",
2698
+ category: "correctness",
2699
+ severity: "error",
2700
+ requires: { script: true }
2701
+ },
2702
+ create(ctx) {
2703
+ if (!commentsEntryFile.test(ctx.file.relativePath)) return;
2704
+ const r = resolver(ctx);
2705
+ const exported = defaultExport(ctx);
2706
+ const hasDefault = Boolean(exported && !isNodeType(unwrap(exported.value), "TSInterfaceDeclaration"));
2707
+ const named = namedExports(ctx);
2708
+ const comments = named.get("comments");
2709
+ if (hasDefault && comments) ctx.report(diagnostics.VHUB0035({
2710
+ why: "`server/comments.ts` has a default export and a `comments` export. A default export selects Comment operations, so ViteHub never installs the live `comments` API.",
2711
+ fix: "Keep one form. For the live-site API, remove the default export and keep `export const comments = defineComments({ ... })`."
2712
+ }), { range: ctx.range(comments) });
2713
+ return { CallExpression(node) {
2714
+ if (!calls(r, node, ["comments"], "defineComments")) return;
2715
+ const { parent } = semanticParent(node);
2716
+ const declarator = isNodeType(parent, "VariableDeclarator") ? parent : void 0;
2717
+ const exportedName = declarator && isIdentifier(declarator.id) && named.get(declarator.id.name) === declarator ? declarator.id.name : void 0;
2718
+ if (!hasDefault && !comments && exportedName) ctx.report(diagnostics.VHUB0035({
2719
+ why: `\`server/comments.ts\` exports \`defineComments()\` as \`${exportedName}\`. ViteHub installs the live API only for an export named \`comments\`. Without it, the entry selects Comment operations.`,
2720
+ fix: `Rename the export to \`comments\`: \`export const comments = defineComments({ ... })\`.`
2721
+ }), { range: ctx.range(node) });
2722
+ const database = hasDefault ? void 0 : objectProperty(callArguments(node)[0], "database");
2723
+ if (database && stringValue(database.value) === void 0) ctx.report(diagnostics.VHUB0035({
2724
+ why: "ViteHub reads `database` from `defineComments()` without running the file, so it must be a string literal. With any other value, ViteHub stores Comments in the default Database.",
2725
+ fix: "Write the Database name as a string, for example `database: \"analytics\"`."
2726
+ }), { range: ctx.range(database) });
2727
+ } };
2728
+ }
2729
+ })
2730
+ ];
2731
+ //#endregion
2732
+ //#region src/doctor/rules/imports.ts
2733
+ const generatedFile = /(?:^|\/)\.vitehub\//;
2734
+ const generatedImport = /(?:^|\/)(?:\.vitehub|\.nuxt\/vitehub)(?:\/|$)/;
2735
+ const internalImport = /^(?:vite-hub\/_internal|@vite-hub\/internal|@vite-hub\/[^/]+\/_?internal)(?:\/|$)/;
2736
+ /** The `#vitehub/*` aliases that the import paths reference documents. Packages resolve others for generated code. */
2737
+ const publicAliases = /^#vitehub\/(?:auth\/server|emails\/.+|env\/public|schedule\/registry)$/;
2738
+ /** Aliases whose exports moved to a primitive root. `vitehub/no-removed-apis` reports them. */
2739
+ const movedAliases = /^#vitehub\/env\/server$/;
2740
+ const noInternalImports = createRule({
2741
+ meta: {
2742
+ id: "vitehub/no-internal-imports",
2743
+ title: "Import ViteHub through its public paths",
2744
+ category: "imports",
2745
+ severity: "warn",
2746
+ requires: { script: true }
2747
+ },
2748
+ create(ctx) {
2749
+ if (generatedFile.test(ctx.file.relativePath)) return;
2750
+ return moduleSourceVisitors((node, { specifier }) => {
2751
+ if (generatedImport.test(specifier) && !ctx.file.relativePath.endsWith(".d.ts")) ctx.report(diagnostics.VHUB0001({
2752
+ why: `\`${specifier}\` imports a file that ViteHub generates. ViteHub can replace or remove generated files on the next build.`,
2753
+ fix: "Import the stable `#vitehub/*` alias or the `vite-hub/*` path that the ViteHub import paths reference lists."
2754
+ }), { range: ctx.range(node) });
2755
+ else if (internalImport.test(specifier)) ctx.report(diagnostics.VHUB0001({
2756
+ why: `\`${specifier}\` is an internal ViteHub path. Only generated ViteHub code and package implementations use it, and it can change in any release.`,
2757
+ fix: "Import the public `vite-hub/*` path for this feature. The ViteHub import paths reference lists each one."
2758
+ }), { range: ctx.range(node) });
2759
+ else if (specifier.startsWith("#vitehub/") && !publicAliases.test(specifier) && !movedAliases.test(specifier)) ctx.report(diagnostics.VHUB0001({
2760
+ why: `\`${specifier}\` is a module that ViteHub generates for its own runtime code. Its exports can change in any release.`,
2761
+ fix: "Import the public `vite-hub/*` path for this feature. The public aliases are `#vitehub/env/public` for browser code, `#vitehub/auth/server`, `#vitehub/emails/<name>`, and `#vitehub/schedule/registry`."
2762
+ }), { range: ctx.range(node) });
2763
+ });
2764
+ }
2765
+ });
2766
+ const serverOnlyAliases = /* @__PURE__ */ new Set(["#vitehub/env/server", "#vitehub/auth/server"]);
2767
+ /**
2768
+ * Modules that load server runtime code: generated registries, `node:*` built-ins, or `process.env`.
2769
+ * Names are paths after `vite-hub/` or `@vite-hub/`.
2770
+ */
2771
+ const serverOnlyModules = /* @__PURE__ */ new Set([
2772
+ "agent",
2773
+ "agent/capabilities",
2774
+ "agent/channels",
2775
+ "agent/mcp",
2776
+ "blob",
2777
+ "browser",
2778
+ "channels",
2779
+ "comments",
2780
+ "content",
2781
+ "database",
2782
+ "decisions",
2783
+ "email",
2784
+ "forms",
2785
+ "forms/database",
2786
+ "forms/operations",
2787
+ "forms/runtime",
2788
+ "env",
2789
+ "env/bridge",
2790
+ "env/database",
2791
+ "env/seal",
2792
+ "forge",
2793
+ "gateways",
2794
+ "kv",
2795
+ "markdown-template/file",
2796
+ "queue",
2797
+ "rate-limit",
2798
+ "sandbox",
2799
+ "sandbox/ssh",
2800
+ "sandbox/task",
2801
+ "schedule",
2802
+ "schedule/os",
2803
+ "schedule/runtime",
2804
+ "schedule/runtime/kv",
2805
+ "schedule/runtime/process",
2806
+ "sync",
2807
+ "sync/database",
2808
+ "sync/operations",
2809
+ "sync/runtime",
2810
+ "webhooks",
2811
+ "webhooks/database",
2812
+ "webhooks/operations",
2813
+ "webhooks/runtime",
2814
+ "workflow",
2815
+ "workspace",
2816
+ "workspace/runtime"
2817
+ ]);
2818
+ const clientAppDirs = [
2819
+ "components",
2820
+ "composables",
2821
+ "layouts",
2822
+ "middleware",
2823
+ "pages",
2824
+ "plugins",
2825
+ "stores",
2826
+ "utils"
2827
+ ];
2828
+ function isServerOnly(specifier) {
2829
+ if (serverOnlyAliases.has(specifier)) return true;
2830
+ const module = vitehubModule(specifier);
2831
+ if (!module) return false;
2832
+ return serverOnlyModules.has(module) || /(?:^|\/)server(?:\/|$)/.test(module) || /^browser\/(?:controllers|providers)\//.test(module);
2833
+ }
2834
+ function isClientFile(ctx) {
2835
+ const path = ctx.file.relativePath;
2836
+ if (/(?:^|\/)server\//.test(path) || /\.server\.[^/]+$/.test(path)) return false;
2837
+ if (path.endsWith(".vue")) return true;
2838
+ return ctx.project.framework === "nuxt" && clientAppDirs.some((dir) => ctx.file.inAppDir(dir));
2839
+ }
2840
+ const noServerImportsInClient = createRule({
2841
+ meta: {
2842
+ id: "vitehub/no-server-imports-in-client",
2843
+ title: "Keep server-only ViteHub imports out of client code",
2844
+ category: "security",
2845
+ severity: "error",
2846
+ requires: { script: true }
2847
+ },
2848
+ create(ctx) {
2849
+ if (!isClientFile(ctx)) return;
2850
+ return moduleSourceVisitors((node, source) => {
2851
+ if (source.typeOnly || !isServerOnly(source.specifier)) return;
2852
+ ctx.report(diagnostics.VHUB0002({
2853
+ why: `\`${source.specifier}\` is server-only, and \`${ctx.file.relativePath}\` runs in the browser. ViteHub does not block this import, so the client bundle can include server code and Server Env values.`,
2854
+ fix: "Move this code to a server route under `server/` and call that route from the client. Use `#vitehub/env/public` for values that the browser can read."
2855
+ }), { range: ctx.range(node) });
2856
+ });
2857
+ }
2858
+ });
2859
+ const ownerPackages = new Set(Object.keys({
2860
+ ...dependencies,
2861
+ ...peerDependencies
2862
+ }));
2863
+ /** Paths after `vite-hub/` that re-export the owner path after `@vite-hub/`, such as `blob` and `rate-limit/drivers/memory`. */
2864
+ const facadePaths = new Set(Object.keys(exports).flatMap((subpath) => {
2865
+ const path = subpath.replace(/^\.\/?/, "");
2866
+ return path && !path.startsWith("_internal/") && ownerPackages.has(`@vite-hub/${path.split("/")[0]}`) ? [path] : [];
2867
+ }));
2868
+ /** The `vite-hub` package and the owner packages import each other through `@vite-hub/*`. */
2869
+ const viteHubPackage = /^(?:vite-hub|@vite-hub\/.+)$/;
2870
+ const preferViteHubImports = createRule({
2871
+ meta: {
2872
+ id: "vitehub/prefer-vite-hub-imports",
2873
+ title: "Import ViteHub features from vite-hub/*",
2874
+ category: "imports",
2875
+ severity: "warn",
2876
+ requires: { script: true }
2877
+ },
2878
+ create(ctx) {
2879
+ if (generatedFile.test(ctx.file.relativePath)) return;
2880
+ if (viteHubPackage.test(ctx.project.packageName ?? "") || !dependsOn(ctx, "vite-hub")) return;
2881
+ return moduleSourceVisitors((node, { specifier }) => {
2882
+ const path = specifier.startsWith("@vite-hub/") ? vitehubModule(specifier) : void 0;
2883
+ if (!path || !facadePaths.has(path)) return;
2884
+ ctx.report(diagnostics.VHUB0036({
2885
+ why: `This app uses \`vite-hub\`, but imports \`${specifier}\` from the owner package. Apps import ViteHub features from \`vite-hub/*\`, and \`vite-hub/${path}\` re-exports \`${specifier}\`.`,
2886
+ fix: `Import \`vite-hub/${path}\` instead of \`${specifier}\`.`
2887
+ }), { range: ctx.range(node) });
2888
+ });
2889
+ }
2890
+ });
2891
+ const rules$2 = [
2892
+ noInternalImports,
2893
+ noServerImportsInClient,
2894
+ preferViteHubImports
2895
+ ];
2896
+ //#endregion
2897
+ //#region src/doctor/rules/results.ts
2898
+ /** Methods that return `[error, value]` for each Runtime Helper handle. */
2899
+ const tupleMethods = {
2900
+ kv: /* @__PURE__ */ new Set([
2901
+ "clear",
2902
+ "delete",
2903
+ "get",
2904
+ "getAndDelete",
2905
+ "getMany",
2906
+ "has",
2907
+ "increment",
2908
+ "keys",
2909
+ "list",
2910
+ "set",
2911
+ "setIfAbsent",
2912
+ "setMany"
2913
+ ]),
2914
+ blob: /* @__PURE__ */ new Set([
2915
+ "copy",
2916
+ "createMultipartUpload",
2917
+ "delete",
2918
+ "get",
2919
+ "handleMultipartUpload",
2920
+ "handleUpload",
2921
+ "head",
2922
+ "list",
2923
+ "put",
2924
+ "resumeMultipartUpload",
2925
+ "sign"
2926
+ ]),
2927
+ media: /* @__PURE__ */ new Set([
2928
+ "createFolder",
2929
+ "get",
2930
+ "handleUpload",
2931
+ "list",
2932
+ "move",
2933
+ "moveFolder",
2934
+ "put",
2935
+ "remove",
2936
+ "removeFolder",
2937
+ "replaceCrop",
2938
+ "update",
2939
+ "variants"
2940
+ ]),
2941
+ email: /* @__PURE__ */ new Set(["send"]),
2942
+ channel: /* @__PURE__ */ new Set(["send"]),
2943
+ queueClient: /* @__PURE__ */ new Set(["send", "sendBatch"])
2944
+ };
2945
+ function handleKind(r, node, seen = /* @__PURE__ */ new Set()) {
2946
+ const target = unwrap(node);
2947
+ if (seen.has(target)) return;
2948
+ seen.add(target);
2949
+ const reference = r.reference(target);
2950
+ if (reference && reference.path.length === 0) {
2951
+ if (reference.module === "kv" && reference.name === "kv") return "kv";
2952
+ if (reference.module === "blob" && reference.name === "blob") return "blob";
2953
+ if (reference.module === "email" && reference.name === "email") return "email";
2954
+ }
2955
+ if (reference?.module === "blob" && reference.name === "blob" && reference.path.length === 1 && reference.path[0] === "media") return "media";
2956
+ if (isNodeType(target, "MemberExpression") && target.computed !== true && isIdentifier(target.property, "media")) return handleKind(r, target.object, seen) === "blob" ? "media" : void 0;
2957
+ if (isNodeType(target, "CallExpression")) {
2958
+ const callee = unwrap(target.callee);
2959
+ if (isNodeType(callee, "MemberExpression") && callee.computed !== true && isIdentifier(callee.property, "store")) {
2960
+ const kind = handleKind(r, callee.object, seen);
2961
+ return kind === "kv" || kind === "blob" ? kind : void 0;
2962
+ }
2963
+ const called = r.callee(target);
2964
+ if (called && ["channels", "channels/server"].includes(called.module) && called.path.length === 0 && ["useChannel", "createChannel"].includes(called.name)) return "channel";
2965
+ }
2966
+ if (isNodeType(target, "AwaitExpression")) {
2967
+ const called = r.callee(target.argument);
2968
+ if (called?.module === "queue" && (called.name === "useQueue" && called.path.length === 0 || called.name === "dynamicQueue" && called.path.join(".") === "use")) return "queueClient";
2969
+ }
2970
+ const binding = r.binding(target);
2971
+ if (binding && !binding.origin && isNodeType(binding.declaration, "VariableDeclarator") && isIdentifier(binding.declaration.id)) return handleKind(r, binding.init, seen);
2972
+ }
2973
+ /** A display name such as `kv.get()` when `call` returns an `[error, value]` tuple. */
2974
+ function tupleCall(r, call) {
2975
+ const callee = unwrap(call.callee);
2976
+ if (isNodeType(callee, "MemberExpression") && callee.computed !== true && isIdentifier(callee.property)) {
2977
+ const kind = handleKind(r, callee.object);
2978
+ if (kind && tupleMethods[kind].has(callee.property.name)) return `${callee.property.name}()`;
2979
+ }
2980
+ const reference = r.callee(call);
2981
+ if (!reference) return;
2982
+ if (reference.module === "queue" && reference.name === "sendQueue" && reference.path.length === 0) return "sendQueue()";
2983
+ if (reference.module === "queue" && reference.name === "dynamicQueue" && reference.path.join(".") === "send") return "dynamicQueue.send()";
2984
+ if (reference.module === "agent/mcp" && reference.name === "callMcpTool" && reference.path.length === 0) return "callMcpTool()";
2985
+ if (reference.module === "agent/server" && ["enqueueChannelTask", "cancelChannelTask"].includes(reference.name) && reference.path.length === 0) return `${reference.name}()`;
2986
+ if (reference.module === "agent" && ["runAgent", "streamAgent"].includes(reference.name) && reference.path.length === 0) return `${reference.name}()`;
2987
+ }
2988
+ function enclosingFunctionOf(node) {
2989
+ let current = parentOf(node);
2990
+ while (current) {
2991
+ if (isFunctionNode(current)) return current;
2992
+ current = parentOf(current);
2993
+ }
2994
+ }
2995
+ /** True when a name that holds the tuple is later indexed, such as `result[0]`, or destructured. */
2996
+ function readsAsTuple(r, target) {
2997
+ if (!isIdentifier(target)) return false;
2998
+ const own = r.binding(target);
2999
+ if (!own) return false;
3000
+ let found = false;
3001
+ walkScript(r.ctx.file.scriptAst, (node) => {
3002
+ if (found || node === target || !isIdentifier(node, target.name) || r.binding(node) !== own) return;
3003
+ const { parent, child } = semanticParent(node);
3004
+ if (parent?.type === "MemberExpression" && parent.object === child && parent.computed === true && numberValue(parent.property) !== void 0) found = true;
3005
+ else if (parent?.type === "VariableDeclarator" && parent.init === child && isNodeType(parent.id, "ArrayPattern")) found = true;
3006
+ else if (parent?.type === "AssignmentExpression" && parent.right === child && isNodeType(parent.left, "ArrayPattern")) found = true;
3007
+ });
3008
+ return found;
3009
+ }
3010
+ /** How the awaited tuple is used, when the use treats it as the value. */
3011
+ function misuseOf(r, awaited) {
3012
+ const { parent, child } = semanticParent(awaited);
3013
+ if (!parent) return;
3014
+ switch (parent.type) {
3015
+ case "ExpressionStatement": return "dropped";
3016
+ case "VariableDeclarator": return isNodeType(parent.id, "ArrayPattern") || readsAsTuple(r, parent.id) ? void 0 : "value";
3017
+ case "AssignmentExpression": return isNodeType(parent.left, "ArrayPattern") || readsAsTuple(r, parent.left) ? void 0 : "value";
3018
+ case "LogicalExpression":
3019
+ case "BinaryExpression":
3020
+ case "TemplateLiteral":
3021
+ case "SpreadElement": return "value";
3022
+ case "ForOfStatement": return parent.right === child ? "value" : void 0;
3023
+ case "Property": return parent.value === child ? "value" : void 0;
3024
+ case "UnaryExpression": return parent.operator === "!" ? "value" : void 0;
3025
+ case "MemberExpression": {
3026
+ if (parent.object !== child) return;
3027
+ const property = unwrap(parent.property);
3028
+ return parent.computed === true && isNodeType(property, "Literal") && typeof property.value === "number" ? void 0 : "value";
3029
+ }
3030
+ case "IfStatement":
3031
+ case "WhileStatement":
3032
+ case "DoWhileStatement":
3033
+ case "ConditionalExpression": return parent.test === child ? "value" : void 0;
3034
+ case "ReturnStatement": {
3035
+ const fn = enclosingFunctionOf(parent);
3036
+ return fn && isRouteHandler(r.ctx, fn) ? "response" : void 0;
3037
+ }
3038
+ case "ArrowFunctionExpression": return parent.body === child && isRouteHandler(r.ctx, parent) ? "response" : void 0;
3039
+ }
3040
+ }
3041
+ const destructureResultTuples = createRule({
3042
+ meta: {
3043
+ id: "vitehub/destructure-result-tuples",
3044
+ title: "Destructure `[error, value]` results",
3045
+ category: "correctness",
3046
+ severity: "warn",
3047
+ requires: { script: true }
3048
+ },
3049
+ create(ctx) {
3050
+ const r = resolver(ctx);
3051
+ return { CallExpression(node) {
3052
+ const name = tupleCall(r, node);
3053
+ if (!name) return;
3054
+ const { parent } = semanticParent(node);
3055
+ const awaited = parent?.type === "AwaitExpression" ? parent : parent?.type === "ArrowFunctionExpression" || parent?.type === "ReturnStatement" || parent?.type === "ExpressionStatement" ? node : void 0;
3056
+ if (!awaited) return;
3057
+ const misuse = misuseOf(r, awaited);
3058
+ if (!misuse) return;
3059
+ const why = {
3060
+ "value": `\`${name}\` returns an \`[error, value]\` tuple and does not throw on failures. This code uses the tuple as the value. A tuple is always truthy, and the error is lost.`,
3061
+ "response": `\`${name}\` returns an \`[error, value]\` tuple. This route handler returns the tuple, so the client receives \`[error, value]\` as JSON and a failure still answers with status 200.`,
3062
+ "dropped": `\`${name}\` returns an \`[error, value]\` tuple and does not throw on failures. This statement drops the tuple, so a failure is silent.`
3063
+ }[misuse];
3064
+ const call = name.replace("()", "(...)");
3065
+ ctx.report(diagnostics.VHUB0003({
3066
+ why,
3067
+ fix: misuse === "dropped" ? `Read the error: \`const [error] = await ${call}\`, then \`if (error) throw error\`. To ignore a failure on purpose, write \`void await ${call}\`.` : `Destructure the result and handle the error: \`const [error, value] = await ${call}\`, then \`if (error) throw error\`.`
3068
+ }), { range: ctx.range(awaited) });
3069
+ } };
3070
+ }
3071
+ });
3072
+ const rules$1 = [destructureResultTuples];
3073
+ //#endregion
3074
+ //#region src/doctor.ts
3075
+ const rules = [
3076
+ ...rules$2,
3077
+ ...rules$1,
3078
+ ...rules$4,
3079
+ ...rules$5,
3080
+ ...rules$3
3081
+ ];
3082
+ const vitehubDoctorExtension = defineDoctorExtension({
3083
+ name: "vite-hub",
3084
+ rulePacks: [defineRulePack({
3085
+ name: "vitehub",
3086
+ version: readViteHubVersion(),
3087
+ rules,
3088
+ diagnostics: viteHubDoctorDiagnostics,
3089
+ presets: { recommended: rules.map((rule) => rule.meta.id) }
3090
+ })],
3091
+ setup(api) {
3092
+ api.registerProjectInventoryContributor(viteHubInventoryContributor);
3093
+ }
3094
+ });
3095
+ //#endregion
3096
+ export { vitehubDoctorExtension as default, destructureResultTuples, noInternalImports, noServerImportsInClient, preferViteHubImports };