vite-hub 0.3.1 → 0.4.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 (254) hide show
  1. package/README.md +34 -36
  2. package/dist/_internal/runtime/browser-errors.d.ts +1 -1
  3. package/dist/_internal/runtime/browser-errors.js +1 -1
  4. package/dist/{access-F0YP5D5E.js → access-BDST818p.js} +6 -6
  5. package/dist/{access-policy-BsB3QVe5.d.ts → access-policy-CGXhO3Ee.d.ts} +3 -3
  6. package/dist/{access-policy-B_DCpZUt.js → access-policy-DjBKLo3c.js} +2 -2
  7. package/dist/{account-Bsu-LBOF.d.ts → account-BnOAU055.d.ts} +1 -1
  8. package/dist/{agent-invocations.post-DIm8tJV2.js → agent-invocations.post-CcPvfA0n.js} +7 -7
  9. package/dist/{agents-DnHexzTJ.js → agents-BDeazoAW.js} +2 -2
  10. package/dist/{agents-y5hBFHUQ.js → agents-BoWau_ei.js} +1 -1
  11. package/dist/{auth-BFVHYizM.d.ts → auth-BZOy7obk.d.ts} +2 -2
  12. package/dist/{auth-types-DWpTBZvp.d.ts → auth-types-CyqhWvYF.d.ts} +1 -1
  13. package/dist/bin.js +15 -7
  14. package/dist/{blob-CiUmptIp.d.ts → blob-CFLwMsjH.d.ts} +1 -1
  15. package/dist/{blob-BRV6_wZa.js → blob-CpvlM8jp.js} +3 -3
  16. package/dist/cache/operations.d.ts +1 -1
  17. package/dist/cache/operations.js +2 -2
  18. package/dist/cache.js +1 -1
  19. package/dist/choices/vue.d.ts +1 -0
  20. package/dist/choices/vue.js +2 -0
  21. package/dist/choices.d.ts +1 -0
  22. package/dist/choices.js +2 -0
  23. package/dist/cli-config-UAGTmuFa.js +2 -0
  24. package/dist/{cli-config-Bpjjfz5j.js → cli-config-wxKjF2Y0.js} +1 -16
  25. package/dist/console/auth-types.d.ts +1 -1
  26. package/dist/console/auth.d.ts +1 -1
  27. package/dist/console/auth.js +1 -1
  28. package/dist/console/runtime/client/account.d.ts +1 -1
  29. package/dist/console/runtime/client/account.js +2 -2
  30. package/dist/console/runtime/client/blob-media.d.ts +1 -1
  31. package/dist/console/runtime/client/blob-media.js +3 -3
  32. package/dist/console/runtime/client/comment-thread.js +1 -1
  33. package/dist/console/runtime/client/content-heads.d.ts +45 -0
  34. package/dist/console/runtime/client/content-heads.js +58 -0
  35. package/dist/console/runtime/client/documents.d.ts +2 -2
  36. package/dist/console/runtime/client/documents.js +1 -1
  37. package/dist/console/runtime/client/editor.d.ts +1 -1
  38. package/dist/console/runtime/client/invocation.js +3 -3
  39. package/dist/console/runtime/client/live.d.ts +1 -1
  40. package/dist/console/runtime/client/mcp-client.js +1 -1
  41. package/dist/console/runtime/client/media-library.d.ts +1 -1
  42. package/dist/console/runtime/client/media-library.js +1 -1
  43. package/dist/console/runtime/client/media-uploads.d.ts +1 -1
  44. package/dist/console/runtime/client/media-uploads.js +1 -1
  45. package/dist/console/runtime/client/operation-view.d.ts +1 -1
  46. package/dist/console/runtime/client/operation-view.js +2 -2
  47. package/dist/console/runtime/client/presence.d.ts +1 -1
  48. package/dist/console/runtime/client/problem.js +2 -2
  49. package/dist/console/runtime/client/project-link.d.ts +1 -1
  50. package/dist/console/runtime/client/project-link.js +1 -1
  51. package/dist/console/runtime/client/project-session.d.ts +2 -2
  52. package/dist/console/runtime/client/project-session.js +4 -4
  53. package/dist/console/runtime/client/project.d.ts +1 -1
  54. package/dist/console/runtime/client/project.js +1 -1
  55. package/dist/console/runtime/client/publish.d.ts +1 -1
  56. package/dist/console/runtime/client/rate-limit.js +2 -2
  57. package/dist/console/runtime/client/read-only.d.ts +1 -1
  58. package/dist/console/runtime/client/read-only.js +1 -1
  59. package/dist/console/runtime/client/request.js +1 -1
  60. package/dist/console/runtime/client/schedule-run.js +2 -2
  61. package/dist/console/runtime/client/sections.d.ts +1 -1
  62. package/dist/console/runtime/client/sections.js +1 -1
  63. package/dist/console/runtime/client/sidebar.ts +1 -1
  64. package/dist/console/runtime/client/site-access.js +2 -2
  65. package/dist/console/runtime/client/ticket.js +1 -1
  66. package/dist/console/runtime/client/workflow.js +2 -2
  67. package/dist/console/runtime/components/console-content-heads.vue +72 -0
  68. package/dist/console/runtime/components/console-document-dashboard.vue +43 -35
  69. package/dist/console/runtime/components/console-documents.vue +1 -0
  70. package/dist/console/runtime/components/console-markdown-editor.vue +4 -1
  71. package/dist/console/runtime/components/invocation/agent-invocation.ts +18 -5
  72. package/dist/console/runtime/components/invocation/internal/input-attachments.ts +69 -0
  73. package/dist/console/runtime/components/invocation/internal/invocation-activity.ts +67 -12
  74. package/dist/console/runtime/components/invocation/internal/invocation-conversation.ts +12 -4
  75. package/dist/console/runtime/components/invocation/invocation.css +16 -0
  76. package/dist/console/runtime/console-route.js +1 -1
  77. package/dist/console/runtime/definitions.d.ts +1 -1
  78. package/dist/console/runtime/definitions.js +1 -1
  79. package/dist/console/runtime/diagnostics.ts +30 -30
  80. package/dist/console/runtime/page-tool/page-tool.js +1 -1
  81. package/dist/console/runtime/public/skills/vitehub/SKILL.md +3 -3
  82. package/dist/console/runtime/public/skills/vitehub/references/framework-composition.md +1 -1
  83. package/dist/console/runtime/public/skills/vitehub/references/preview-contract.md +9 -1
  84. package/dist/console/runtime/public/skills/vitehub/references/primitives/channels.md +1 -1
  85. package/dist/console/runtime/public/skills/vitehub/references/primitives/database.md +1 -1
  86. package/dist/console/runtime/public/skills/vitehub/references/primitives/markdown-template.md +3 -3
  87. package/dist/console/runtime/public/skills/vitehub/references/project-shapes.md +2 -2
  88. package/dist/console/runtime/public/skills/vitehub/references/sandboxes-hosts.md +4 -4
  89. package/dist/console/runtime/sections.d.ts +1 -1
  90. package/dist/console/runtime/sections.js +1 -1
  91. package/dist/console/runtime/server/access-policy.d.ts +1 -1
  92. package/dist/console/runtime/server/access-policy.js +1 -1
  93. package/dist/console/runtime/server/agents.get.js +2 -2
  94. package/dist/console/runtime/server/auth.d.ts +1 -1
  95. package/dist/console/runtime/server/auth.js +2 -2
  96. package/dist/console/runtime/server/blob.d.ts +1 -1
  97. package/dist/console/runtime/server/blob.js +1 -1
  98. package/dist/console/runtime/server/channel-replay.d.ts +2 -2
  99. package/dist/console/runtime/server/channel-replay.js +4 -4
  100. package/dist/console/runtime/server/database.d.ts +1 -1
  101. package/dist/console/runtime/server/database.get.d.ts +1 -1
  102. package/dist/console/runtime/server/database.get.js +2 -2
  103. package/dist/console/runtime/server/database.js +1 -1
  104. package/dist/console/runtime/server/definitions.d.ts +1 -1
  105. package/dist/console/runtime/server/definitions.get.d.ts +3 -3
  106. package/dist/console/runtime/server/definitions.get.js +3 -3
  107. package/dist/console/runtime/server/definitions.js +1 -1
  108. package/dist/console/runtime/server/development.d.ts +2 -2
  109. package/dist/console/runtime/server/development.js +2 -2
  110. package/dist/console/runtime/server/documents.d.ts +1 -1
  111. package/dist/console/runtime/server/documents.js +1 -1
  112. package/dist/console/runtime/server/env.get.d.ts +1 -1
  113. package/dist/console/runtime/server/env.get.js +3 -3
  114. package/dist/console/runtime/server/invocation-capabilities.get.js +2 -2
  115. package/dist/console/runtime/server/invocation-workspace.get.d.ts +1 -1
  116. package/dist/console/runtime/server/invocation-workspace.get.js +5 -5
  117. package/dist/console/runtime/server/invocation.get.d.ts +1 -1
  118. package/dist/console/runtime/server/invocation.get.js +6 -6
  119. package/dist/console/runtime/server/invocations.get.js +3 -3
  120. package/dist/console/runtime/server/logs.get.d.ts +2 -2
  121. package/dist/console/runtime/server/logs.get.js +5 -5
  122. package/dist/console/runtime/server/mcp-client-operations.d.ts +1 -1
  123. package/dist/console/runtime/server/mcp-client-operations.js +3 -3
  124. package/dist/console/runtime/server/operation-contributions.d.ts +1 -1
  125. package/dist/console/runtime/server/operation-contributions.js +1 -1
  126. package/dist/console/runtime/server/page-auth.d.ts +1 -1
  127. package/dist/console/runtime/server/page-tool.d.ts +1 -1
  128. package/dist/console/runtime/server/page-tool.js +2 -2
  129. package/dist/console/runtime/server/rpc.d.ts +2 -2
  130. package/dist/console/runtime/server/rpc.js +7 -7
  131. package/dist/console/runtime/server/search.get.js +1 -1
  132. package/dist/console/runtime/server/sections.d.ts +4 -4
  133. package/dist/console/runtime/server/sections.get.d.ts +1 -1
  134. package/dist/console/runtime/server/sections.get.js +5 -5
  135. package/dist/console/runtime/server/sections.js +3 -3
  136. package/dist/console/runtime/server/setup.d.ts +3 -3
  137. package/dist/console/runtime/server/setup.js +2 -2
  138. package/dist/console/runtime/server/site-entry.d.ts +1 -1
  139. package/dist/console/runtime/server/site-entry.js +9 -6
  140. package/dist/console/runtime/server/site-session.d.ts +5 -1
  141. package/dist/console/runtime/server/site-session.js +1 -1
  142. package/dist/console/runtime/server/status.get.d.ts +2 -2
  143. package/dist/console/runtime/server/status.get.js +5 -5
  144. package/dist/console/runtime/server/tickets.d.ts +1 -1
  145. package/dist/console/runtime/server/tickets.js +1 -1
  146. package/dist/console/runtime/server/usage.get.d.ts +2 -2
  147. package/dist/console/runtime/server/usage.get.js +7 -7
  148. package/dist/console/runtime/server/workspace-files.get.d.ts +1 -1
  149. package/dist/console/runtime/server/workspace-files.get.js +3 -3
  150. package/dist/console/server.d.ts +5 -5
  151. package/dist/console/server.js +6 -6
  152. package/dist/console/ui.js +121 -20
  153. package/dist/{console-route-COvNB_Xj.js → console-route-CBuqZ4wO.js} +1 -1
  154. package/dist/{database-J7M0B3ED.js → database-BdOBjPkS.js} +1 -1
  155. package/dist/{database-BVyhAxq-.d.ts → database-DyPVMjp_.d.ts} +1 -1
  156. package/dist/{definitions-BDRkT5-f.js → definitions-BW6SvmMM.js} +1 -0
  157. package/dist/{definitions-bepsXY5G.js → definitions-CNq_Shkh.js} +3 -3
  158. package/dist/{definitions-CxDT8D8Y.d.ts → definitions-DB4LbZ7T.d.ts} +2 -0
  159. package/dist/{definitions-CGTWTj67.d.ts → definitions-Dbgxfz3I.d.ts} +1 -1
  160. package/dist/development-W5EwONyL.d.ts +12 -0
  161. package/dist/{development-BzeSHZGH.js → development-zLxOp-AO.js} +12 -2
  162. package/dist/{diagnostics-D0DefmQj.js → diagnostics-9U_fYxMy.js} +30 -30
  163. package/dist/doctor.js +88 -107
  164. package/dist/{documents-C97WMaJZ.d.ts → documents-BASIRZ91.d.ts} +1 -1
  165. package/dist/{documents-RVHsQKFw.d.ts → documents-CboVhYFz.d.ts} +3 -3
  166. package/dist/{documents-DwPfR-fz.js → documents-CjJTCrY8.js} +3 -3
  167. package/dist/{documents-8US1nUgK.js → documents-qrHHqlNU.js} +1 -1
  168. package/dist/durability/operations.d.ts +1 -1
  169. package/dist/durability/operations.js +2 -2
  170. package/dist/{entries-D48wVEaS.js → entries-Bj-jPs_J.js} +1 -1
  171. package/dist/{error-diagnostics-C2rjmOlX.js → error-diagnostics-Bm3JKYjz.js} +19 -11
  172. package/dist/error-diagnostics.ts +19 -11
  173. package/dist/index.d.ts +15 -2
  174. package/dist/index.js +8 -4
  175. package/dist/internal/disabled-redis-driver.js +1 -1
  176. package/dist/internal/disabled-upstash-driver.js +1 -1
  177. package/dist/internal/test-loader.js +1 -1
  178. package/dist/internal/test-server.js +1 -1
  179. package/dist/{internal-BP_O70ic.d.ts → internal-CO4OqqaS.d.ts} +3 -3
  180. package/dist/{invocation-page-undo-BkUau8X7.js → invocation-page-undo-DIZ-s3xT.js} +2 -2
  181. package/dist/{invocations-CsucCJuq.js → invocations-CK_-G540.js} +3 -3
  182. package/dist/logs/memory.js +1 -1
  183. package/dist/logs/source.js +1 -1
  184. package/dist/logs.js +2 -2
  185. package/dist/{mcp-client-D0mUt18v.js → mcp-client-By4zk0vU.js} +6 -6
  186. package/dist/{media-wZMY6f2M.js → media-BHpQ-4jw.js} +4 -4
  187. package/dist/{media-library-CEo-Ye2B.d.ts → media-library-D9ThbXqs.d.ts} +1 -1
  188. package/dist/{media-library-BChf8XOd.js → media-library-NaOMBKWS.js} +2 -2
  189. package/dist/{memory-DhirB6SA.js → memory-DTmq-Z6x.js} +2 -2
  190. package/dist/{nuxt-server-imports-Lnaf5Fe-.js → nuxt-server-imports-DH60Z7LA.js} +3 -2
  191. package/dist/nuxt.d.ts +1 -1
  192. package/dist/nuxt.js +94 -67
  193. package/dist/{operation-contributions-DflAv5AC.js → operation-contributions-BdS0z3tx.js} +2 -2
  194. package/dist/{operation-contributions-fZyVo662.d.ts → operation-contributions-DpkO_iSU.d.ts} +1 -1
  195. package/dist/{operation-definition-Bn8V2hab.js → operation-definition-a5keEpCd.js} +6 -1
  196. package/dist/{operations-DX9EkHwb.d.ts → operations-B0689BG1.d.ts} +5 -0
  197. package/dist/operations-CAQmIxGK.js +2 -0
  198. package/dist/{operations-B6N-ja8x.js → operations-CWP9dF3i.js} +11 -11
  199. package/dist/{operations-Dj_cp-UK.js → operations-EOdyctDc.js} +1 -1
  200. package/dist/{optional-owners-Crm6kVS5.js → optional-owners-BNA2OX6z.js} +37 -23
  201. package/dist/{page-tool-BCRyx3pM.d.ts → page-tool-CRCK1RHV.d.ts} +1 -1
  202. package/dist/{plugins-DQ8pF-38.js → plugins-B-DpgDPB.js} +1459 -714
  203. package/dist/{plugins-5uDXr9Km.d.ts → plugins-BqAtIEX2.d.ts} +75 -56
  204. package/dist/{project-C2dnB9Kf.js → project-C4N_Zcjl.js} +3 -3
  205. package/dist/{project-5EN7JaXI.d.ts → project-CufkVP1u.d.ts} +2 -2
  206. package/dist/{project-DOeM0zg3.js → project-DlWTGB7h.js} +1 -1
  207. package/dist/{project-link-D_XQvBOC.d.ts → project-link-BuOzBH9f.d.ts} +1 -1
  208. package/dist/{project-link-Qi7nltHM.js → project-link-D-6UefhA.js} +2 -2
  209. package/dist/{request-yCybBeqT.js → request-DE8w_cSM.js} +8 -3
  210. package/dist/{request-BUYAlAJl.js → request-DbFfYmCu.js} +2 -2
  211. package/dist/{runtime-DM8Z6KLT.js → runtime-DQuHg7OO.js} +1 -1
  212. package/dist/{runtime-DG34DLXc.js → runtime-OsEDfbM9.js} +1 -1
  213. package/dist/runtime-feature-guard-B64MMW9I.js +140 -0
  214. package/dist/scan-module-D_3X08mj.js +2 -0
  215. package/dist/scan-module-Df58L_6T.js +311 -0
  216. package/dist/{secret-AZLhaNyr.js → secret-Dy5uqvq9.js} +1 -1
  217. package/dist/{sections-BriKrBgN.d.ts → sections-BogiCmtz.d.ts} +2 -2
  218. package/dist/{sections-ACHVTCWn.d.ts → sections-CyrXbbkG.d.ts} +4 -4
  219. package/dist/{sections-4xyBoiar.d.ts → sections-Do7X4Nwt.d.ts} +1 -2
  220. package/dist/{sections-D6AM5Gy5.js → sections-DumoLKQN.js} +2 -3
  221. package/dist/{sections-CUJyQA9d.js → sections-et20h8w3.js} +3 -3
  222. package/dist/{sections.get-1lHjyKCI.d.ts → sections.get-COiLcQ0P.d.ts} +2 -2
  223. package/dist/seo/runtime.js +1 -1
  224. package/dist/{server-DbjFYSeU.js → server-BRJE4t-W.js} +2 -2
  225. package/dist/{setup-DLZFzuLv.d.ts → setup-ZbA1by7W.d.ts} +4 -3
  226. package/dist/{site-access-Bhsty_v4.js → site-access-BbJUe5QI.js} +1 -1
  227. package/dist/{site-access-CyRtc0gZ.js → site-access-BmE8HGxs.js} +4 -4
  228. package/dist/{site-session-Jf21TVw8.js → site-session-odJq1dYa.js} +5 -5
  229. package/dist/skills/operations.d.ts +1 -1
  230. package/dist/skills/operations.js +2 -2
  231. package/dist/skills.d.ts +1 -1
  232. package/dist/{skills.get-CHQMzSD_.js → skills.get-Bl8cBe8u.js} +2 -2
  233. package/dist/{source-w9BHUwyO.js → source-D4wWtoHh.js} +1 -1
  234. package/dist/task/operations.d.ts +1 -1
  235. package/dist/task/operations.js +2 -2
  236. package/dist/test/register.js +1 -1
  237. package/dist/{ticket-RKQF6Wy9.js → ticket-Cudn1dq3.js} +1 -1
  238. package/dist/{tickets-CfJhT7d0.js → tickets-C_0Fhc00.js} +6 -6
  239. package/dist/{usage-Bc0YY_ka.js → usage-B4taNt4a.js} +1 -1
  240. package/dist/{usage-index-CMMT4cXQ.js → usage-index-BsGAFzyq.js} +1 -1
  241. package/dist/{version-DDRL_OYz.js → version-DNmSsk5r.js} +22 -19
  242. package/dist/{cli-DjoDGgT4.js → vite-stage-mmtwQIMA.js} +32 -2
  243. package/dist/{workspace-history-l47NPVSy.js → workspace-history-CraoERnc.js} +1 -1
  244. package/package.json +93 -93
  245. package/dist/cli-config--rAg6V-a.js +0 -2
  246. package/dist/decisions/vue.d.ts +0 -1
  247. package/dist/decisions/vue.js +0 -2
  248. package/dist/decisions.d.ts +0 -1
  249. package/dist/decisions.js +0 -2
  250. package/dist/development-DgaQ05jw.d.ts +0 -9
  251. package/dist/operations-H9q0QB2C.js +0 -2
  252. package/dist/runtime-feature-guard-rpZz1eMF.js +0 -55
  253. package/dist/scan-module-BTeOuZsp.js +0 -2
  254. package/dist/scan-module-DlHQ8a0X.js +0 -148
package/dist/doctor.js CHANGED
@@ -1,6 +1,6 @@
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";
1
+ import { i as importOptionalOwner } from "./optional-owners-BNA2OX6z.js";
2
+ import { n as viteHubServerImports } from "./nuxt-server-imports-DH60Z7LA.js";
3
+ import { a as exports, i as dependencies, o as peerDependencies, r as removedViteHubOptions, t as readViteHubVersion } from "./version-DNmSsk5r.js";
4
4
  import { dirname, relative, resolve } from "node:path";
5
5
  import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
6
6
  import * as v from "valibot";
@@ -78,10 +78,6 @@ const viteHubDoctorDiagnostics = defineDoctorDiagnostics([
78
78
  code: "VHUB0018",
79
79
  ruleId: "vitehub/no-destructure-non-tuples"
80
80
  },
81
- {
82
- code: "VHUB0019",
83
- ruleId: "vitehub/check-response-results"
84
- },
85
81
  {
86
82
  code: "VHUB0020",
87
83
  ruleId: "vitehub/workflow-step-names"
@@ -1063,10 +1059,10 @@ const definitionLocation = createRule({
1063
1059
  }
1064
1060
  });
1065
1061
  const queueOptionKeys = /* @__PURE__ */ new Set([
1066
- "delaySeconds",
1062
+ "contentType",
1063
+ "delay",
1067
1064
  "idempotencyKey",
1068
- "retentionSeconds",
1069
- "contentType"
1065
+ "retention"
1070
1066
  ]);
1071
1067
  function isQueueEnqueue(reference) {
1072
1068
  if (isExport(reference, ["queue"], ["sendQueue", "deferQueue"])) return true;
@@ -1090,7 +1086,7 @@ const queuePayloadOptions = createRule({
1090
1086
  if (!options.length) return;
1091
1087
  ctx.report(diagnostics.VHUB0016({
1092
1088
  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 })`."
1089
+ fix: "Pass the payload and the options as separate arguments: `sendQueue(name, payload, { delay })`."
1094
1090
  }), { range: ctx.range(args[1]) });
1095
1091
  } };
1096
1092
  }
@@ -1143,20 +1139,7 @@ const noModuleScopeDispatch = createRule({
1143
1139
  function nonTupleResult(r, call) {
1144
1140
  const reference = r.callee(call);
1145
1141
  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
- };
1142
+ if (isExport(reference, ["workflow"], "deferWorkflow") || isExport(reference, ["queue"], "useQueue")) return { name: reference.name };
1160
1143
  }
1161
1144
  function arrayPatternTarget(awaited) {
1162
1145
  const { parent, child } = semanticParent(awaited);
@@ -1178,98 +1161,44 @@ const noDestructureNonTuples = createRule({
1178
1161
  const pattern = result && arrayPatternTarget(node);
1179
1162
  if (!result || !pattern) return;
1180
1163
  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.`
1164
+ why: `\`${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.`,
1165
+ fix: `Assign the result directly: \`const value = await ${result.name}(...)\`. Use \`try\`/\`catch\` to handle failures.`
1183
1166
  }), { range: ctx.range(pattern) });
1184
1167
  } };
1185
1168
  }
1186
1169
  });
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
1170
  /** The step property that the Workflow runtime derives from a step file name. */
1249
1171
  function stepPropertyName(file) {
1250
1172
  return (file.split("/").pop() ?? file).replace(/\.(?:c|m)?[jt]s$/i, "").replace(/^\d+[.-]?/, "").replace(/[-_.]+([a-z0-9])/gi, (_, char) => char.toUpperCase());
1251
1173
  }
1252
1174
  const sourceFile = /\.(?:c|m)?[jt]sx?$/;
1253
1175
  /**
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.
1176
+ * The handler of a folder Workflow index: the `handler` of the object passed to `defineWorkflow({ handler })`, or the
1177
+ * default-exported function. A handler gets one object: `context` names the whole parameter (`ctx.steps`), and
1178
+ * `steps` names its destructured `steps` property.
1257
1179
  */
1258
1180
  function workflowHandler(ctx, r) {
1259
1181
  const value = unwrap(defaultExport(ctx)?.value);
1260
- let fn = isNodeType(value, "CallExpression") ? unwrap(callArguments(value)[1]) : value;
1182
+ let fn = isNodeType(value, "CallExpression") ? unwrap(objectValue(callArguments(value)[0], "handler")) : value;
1261
1183
  if (isIdentifier(fn)) {
1262
1184
  const declaration = r.binding(fn)?.declaration;
1263
1185
  fn = isNodeType(declaration, "VariableDeclarator") ? unwrap(declaration.init) : declaration;
1264
1186
  }
1265
1187
  if (!isFunctionNode(fn) || !isNode(fn) || !Array.isArray(fn.params)) return;
1266
- let param = unwrap(fn.params[1]);
1188
+ let param = unwrap(fn.params[0]);
1267
1189
  if (isNodeType(param, "AssignmentPattern")) param = unwrap(param.left);
1268
1190
  if (isIdentifier(param)) return {
1269
1191
  fn,
1270
1192
  context: param.name
1271
1193
  };
1272
- let target = unwrap((isNodeType(param, "ObjectPattern") && Array.isArray(param.properties) ? param.properties.filter(isNode) : []).find((entry) => propertyName(entry) === "steps")?.value);
1194
+ const properties = isNodeType(param, "ObjectPattern") && Array.isArray(param.properties) ? param.properties.filter(isNode) : [];
1195
+ const property = properties.find((entry) => propertyName(entry) === "steps");
1196
+ const rest = property ? void 0 : unwrap(properties.find((entry) => isNodeType(entry, "RestElement"))?.argument);
1197
+ if (isIdentifier(rest)) return {
1198
+ fn,
1199
+ context: rest.name
1200
+ };
1201
+ let target = unwrap(property?.value);
1273
1202
  if (isNodeType(target, "AssignmentPattern")) target = unwrap(target.left);
1274
1203
  return {
1275
1204
  fn,
@@ -1445,7 +1374,6 @@ const chatAdapterNames = [
1445
1374
  "github",
1446
1375
  "gitlab",
1447
1376
  "gmail",
1448
- "http",
1449
1377
  "slack",
1450
1378
  "teams",
1451
1379
  "telegram",
@@ -1458,7 +1386,6 @@ const rules$5 = [
1458
1386
  queuePayloadOptions,
1459
1387
  noModuleScopeDispatch,
1460
1388
  noDestructureNonTuples,
1461
- checkResponseResults,
1462
1389
  workflowStepNames,
1463
1390
  validScheduleCron,
1464
1391
  manualScheduleRun,
@@ -2359,13 +2286,20 @@ const topLevelFeatureKeys = [
2359
2286
  "workflow",
2360
2287
  "workspace"
2361
2288
  ];
2362
- function checkViteHubOptions(ctx, options, where) {
2289
+ /** Option objects, such as `cloudflare`, that hold a removed nested key. */
2290
+ const nestedRemovedParents = new Set(Object.keys(removedViteHubOptions).flatMap((key) => key.includes(".") ? [key.slice(0, key.indexOf("."))] : []));
2291
+ function checkViteHubOptions(ctx, options, where, parent) {
2363
2292
  const target = unwrap(options);
2364
2293
  if (!isNodeType(target, "ObjectExpression")) return;
2365
2294
  for (const property of objectProperties(target)) {
2366
2295
  const name = propertyName(property);
2296
+ if (parent === void 0 && name !== void 0 && nestedRemovedParents.has(name)) {
2297
+ checkViteHubOptions(ctx, property.value, `${where}.${name}`, name);
2298
+ continue;
2299
+ }
2367
2300
  let report;
2368
- const removed = name !== void 0 && Object.hasOwn(removedViteHubOptions, name) ? removedViteHubOptions[name] : void 0;
2301
+ const key = name !== void 0 && parent !== void 0 ? `${parent}.${name}` : name;
2302
+ const removed = key !== void 0 && Object.hasOwn(removedViteHubOptions, key) ? removedViteHubOptions[key] : void 0;
2369
2303
  if (removed) report = {
2370
2304
  why: `${removed.why} The build fails on this key.`,
2371
2305
  fix: removed.fix
@@ -2388,10 +2322,33 @@ const validViteHubOptions = createRule({
2388
2322
  if (nuxtConfigFile.test(ctx.file.relativePath)) {
2389
2323
  const config = configObject(ctx);
2390
2324
  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");
2325
+ const scopes = [{
2326
+ name: "",
2327
+ config
2328
+ }, ...objectProperties(config).flatMap((item) => {
2329
+ const name = propertyName(item);
2330
+ const scope = unwrap(item.value);
2331
+ if (!name?.startsWith("$") || !isNodeType(scope, "ObjectExpression")) return [];
2332
+ if (name !== "$env") return [{
2333
+ name,
2334
+ config: scope
2335
+ }];
2336
+ return objectProperties(scope).flatMap((entry) => {
2337
+ const environment = propertyName(entry);
2338
+ const override = unwrap(entry.value);
2339
+ return environment && isNodeType(override, "ObjectExpression") ? [{
2340
+ name: `${name}.${environment}`,
2341
+ config: override
2342
+ }] : [];
2343
+ });
2344
+ })];
2345
+ const hasBaseModule = nuxtModules(config).some((entry) => entry.name === "vite-hub/nuxt");
2346
+ for (const scope of scopes) {
2347
+ const module = nuxtModules(scope.config).find((entry) => entry.name === "vite-hub/nuxt");
2348
+ if (!hasBaseModule && !module) continue;
2349
+ checkViteHubOptions(ctx, objectValue(scope.config, "vitehub"), scope.name ? `the \`${scope.name}.vitehub\` key` : "the `vitehub` key");
2350
+ checkViteHubOptions(ctx, module?.options, "the inline `vite-hub/nuxt` options");
2351
+ }
2395
2352
  return;
2396
2353
  }
2397
2354
  if (!viteConfigFile.test(ctx.file.relativePath)) return;
@@ -2778,8 +2735,8 @@ const serverOnlyModules = /* @__PURE__ */ new Set([
2778
2735
  "channels",
2779
2736
  "comments",
2780
2737
  "content",
2738
+ "choices",
2781
2739
  "database",
2782
- "decisions",
2783
2740
  "email",
2784
2741
  "forms",
2785
2742
  "forms/database",
@@ -2863,7 +2820,7 @@ const ownerPackages = new Set(Object.keys({
2863
2820
  /** Paths after `vite-hub/` that re-export the owner path after `@vite-hub/`, such as `blob` and `rate-limit/drivers/memory`. */
2864
2821
  const facadePaths = new Set(Object.keys(exports).flatMap((subpath) => {
2865
2822
  const path = subpath.replace(/^\.\/?/, "");
2866
- return path && !path.startsWith("_internal/") && ownerPackages.has(`@vite-hub/${path.split("/")[0]}`) ? [path] : [];
2823
+ return path && ownerPackages.has(`@vite-hub/${path.split("/")[0]}`) ? [path] : [];
2867
2824
  }));
2868
2825
  /** The `vite-hub` package and the owner packages import each other through `@vite-hub/*`. */
2869
2826
  const viteHubPackage = /^(?:vite-hub|@vite-hub\/.+)$/;
@@ -2905,7 +2862,6 @@ const tupleMethods = {
2905
2862
  "getMany",
2906
2863
  "has",
2907
2864
  "increment",
2908
- "keys",
2909
2865
  "list",
2910
2866
  "set",
2911
2867
  "setIfAbsent",
@@ -2940,8 +2896,21 @@ const tupleMethods = {
2940
2896
  ]),
2941
2897
  email: /* @__PURE__ */ new Set(["send"]),
2942
2898
  channel: /* @__PURE__ */ new Set(["send"]),
2943
- queueClient: /* @__PURE__ */ new Set(["send", "sendBatch"])
2899
+ queueClient: /* @__PURE__ */ new Set(["send", "sendBatch"]),
2900
+ gateway: /* @__PURE__ */ new Set(["ask"]),
2901
+ translations: /* @__PURE__ */ new Set([
2902
+ "list",
2903
+ "missing",
2904
+ "save"
2905
+ ])
2944
2906
  };
2907
+ /** Exports of `vite-hub/gateways` that return an object with `ask()`. */
2908
+ const gatewayFactories = /* @__PURE__ */ new Set([
2909
+ "askWithModel",
2910
+ "cloudflare",
2911
+ "typesafe",
2912
+ "vercel"
2913
+ ]);
2945
2914
  function handleKind(r, node, seen = /* @__PURE__ */ new Set()) {
2946
2915
  const target = unwrap(node);
2947
2916
  if (seen.has(target)) return;
@@ -2962,6 +2931,8 @@ function handleKind(r, node, seen = /* @__PURE__ */ new Set()) {
2962
2931
  }
2963
2932
  const called = r.callee(target);
2964
2933
  if (called && ["channels", "channels/server"].includes(called.module) && called.path.length === 0 && ["useChannel", "createChannel"].includes(called.name)) return "channel";
2934
+ if (called?.module === "gateways" && called.path.length === 0 && gatewayFactories.has(called.name)) return "gateway";
2935
+ if (called?.module === "i18n/server" && called.path.length === 0 && called.name === "useTranslations") return "translations";
2965
2936
  }
2966
2937
  if (isNodeType(target, "AwaitExpression")) {
2967
2938
  const called = r.callee(target.argument);
@@ -2975,15 +2946,25 @@ function tupleCall(r, call) {
2975
2946
  const callee = unwrap(call.callee);
2976
2947
  if (isNodeType(callee, "MemberExpression") && callee.computed !== true && isIdentifier(callee.property)) {
2977
2948
  const kind = handleKind(r, callee.object);
2978
- if (kind && tupleMethods[kind].has(callee.property.name)) return `${callee.property.name}()`;
2949
+ if (kind && tupleMethods[kind].has(callee.property.name)) return kind === "gateway" ? "gateway.ask()" : `${callee.property.name}()`;
2979
2950
  }
2980
2951
  const reference = r.callee(call);
2981
2952
  if (!reference) return;
2982
2953
  if (reference.module === "queue" && reference.name === "sendQueue" && reference.path.length === 0) return "sendQueue()";
2983
2954
  if (reference.module === "queue" && reference.name === "dynamicQueue" && reference.path.join(".") === "send") return "dynamicQueue.send()";
2955
+ if (reference.module === "schedule" && reference.name === "runSchedule" && reference.path.length === 0) return "runSchedule()";
2956
+ if (reference.module === "workflow" && [
2957
+ "startWorkflow",
2958
+ "getWorkflowRun",
2959
+ "cancelWorkflow",
2960
+ "resumeWorkflow"
2961
+ ].includes(reference.name) && reference.path.length === 0) return `${reference.name}()`;
2984
2962
  if (reference.module === "agent/mcp" && reference.name === "callMcpTool" && reference.path.length === 0) return "callMcpTool()";
2985
2963
  if (reference.module === "agent/server" && ["enqueueChannelTask", "cancelChannelTask"].includes(reference.name) && reference.path.length === 0) return `${reference.name}()`;
2986
2964
  if (reference.module === "agent" && ["runAgent", "streamAgent"].includes(reference.name) && reference.path.length === 0) return `${reference.name}()`;
2965
+ if (reference.module === "browser" && ["runBrowser", "runBrowserContent"].includes(reference.name) && reference.path.length === 0) return `${reference.name}()`;
2966
+ if (reference.module === "sandbox/task" && reference.name === "runSandboxTask" && reference.path.length === 0) return "runSandboxTask()";
2967
+ if (["auth/server", "auth/runtime/console"].includes(reference.module) && ["listAuthEvents", "aggregateAuthEvents"].includes(reference.name) && reference.path.length === 0) return `${reference.name}()`;
2987
2968
  }
2988
2969
  function enclosingFunctionOf(node) {
2989
2970
  let current = parentOf(node);
@@ -1,4 +1,4 @@
1
- import { a as ConsoleDocumentCollection, c as ConsoleDocumentSetup } from "./definitions-CxDT8D8Y.js";
1
+ import { a as ConsoleDocumentCollection, c as ConsoleDocumentSetup } from "./definitions-DB4LbZ7T.js";
2
2
  import { t as ConsoleFieldIssue } from "./schema-form-C-fy3xaU.js";
3
3
  import { t as ConsoleTicketLink } from "./ticket-Pr_8ZtXW.js";
4
4
  //#region src/console/runtime/client/documents.d.ts
@@ -1,7 +1,7 @@
1
- import { a as ConsoleDocumentCollection, c as ConsoleDocumentSetup } from "./definitions-CxDT8D8Y.js";
1
+ import { a as ConsoleDocumentCollection, c as ConsoleDocumentSetup } from "./definitions-DB4LbZ7T.js";
2
2
  import { t as ConsoleRequestEvent } from "./request-D7h3SQ92.js";
3
- import { o as ConsoleAccess, s as ConsoleAccessRoute } from "./access-policy-BsB3QVe5.js";
4
- import { s as ConsoleTicket } from "./auth-BFVHYizM.js";
3
+ import { o as ConsoleAccess, s as ConsoleAccessRoute } from "./access-policy-CGXhO3Ee.js";
4
+ import { s as ConsoleTicket } from "./auth-BZOy7obk.js";
5
5
  //#region src/console/runtime/server/limits.d.ts
6
6
  /** Bodies carry a whole Markdown document, so they may exceed the ordinary Console request limit. */
7
7
  declare const maximumConsoleDocumentRequestBytes: number;
@@ -1,7 +1,7 @@
1
- import { a as parseConsoleDocumentSetup } from "./definitions-BDRkT5-f.js";
1
+ import { a as parseConsoleDocumentSetup } from "./definitions-BW6SvmMM.js";
2
2
  import { n as consoleState } from "./internal-BreyUsQ6.js";
3
- import { h as withConsoleAccess, p as readConsoleAccessUser } from "./access-F0YP5D5E.js";
4
- import { a as consoleRequestJSON, i as consoleRequestError, o as consoleRequestURL, t as assertConsoleRequest } from "./request-BUYAlAJl.js";
3
+ import { h as withConsoleAccess, p as readConsoleAccessUser } from "./access-BDST818p.js";
4
+ import { a as consoleRequestJSON, i as consoleRequestError, o as consoleRequestURL, t as assertConsoleRequest } from "./request-DbFfYmCu.js";
5
5
  import { i as maximumConsoleDocumentRequestBytes, n as consoleDocumentActionNames } from "./limits-BUlwWYQE.js";
6
6
  import { r as getConsoleSections } from "./sections-C83x0slv.js";
7
7
  //#region src/console/runtime/server/documents.ts
@@ -1,4 +1,4 @@
1
- import { d as requestConsoleOperation, t as ConsoleRequestError, u as requestConsole } from "./request-yCybBeqT.js";
1
+ import { d as requestConsoleOperation, t as ConsoleRequestError, u as requestConsole } from "./request-DE8w_cSM.js";
2
2
  import { p as dayLabel } from "./format-BOYlanIZ.js";
3
3
  import { t as consoleQueryText } from "./route-query-CRVWXIrc.js";
4
4
  //#region src/console/runtime/client/documents.ts
@@ -1,4 +1,4 @@
1
- import { n as AnyOperation } from "../operations-DX9EkHwb.js";
1
+ import { n as AnyOperation } from "../operations-B0689BG1.js";
2
2
  //#region src/durability/operations.d.ts
3
3
  /** The `durability.*` operations. `vitehub durability list`, the Console, and agents run them. */
4
4
  export declare const durabilityOperations: readonly AnyOperation[];
@@ -1,5 +1,5 @@
1
- import { t as viteHubErrorDiagnostics } from "../error-diagnostics-C2rjmOlX.js";
2
- import { t as defineOperation } from "../operation-definition-Bn8V2hab.js";
1
+ import { t as viteHubErrorDiagnostics } from "../error-diagnostics-Bm3JKYjz.js";
2
+ import { t as defineOperation } from "../operation-definition-a5keEpCd.js";
3
3
  import * as v from "valibot";
4
4
  import { formatDurabilityTable, getDurabilityReport } from "@vite-hub/runtime/durability";
5
5
  //#region src/durability/operations.ts
@@ -1,4 +1,4 @@
1
- import { t as viteHubErrorDiagnostics } from "./error-diagnostics-C2rjmOlX.js";
1
+ import { t as viteHubErrorDiagnostics } from "./error-diagnostics-Bm3JKYjz.js";
2
2
  import { t as redactInspectionText } from "./inspect-CDw7e0vK.js";
3
3
  /** Largest number of entries that one `cache.delete` with a prefix removes. Run it again to remove more. */
4
4
  const cacheMaximumDeleteCount = 1e3;
@@ -64,10 +64,6 @@ const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
64
64
  why: "Nitro tasks are not enabled in this runtime.",
65
65
  fix: "Add a file to `server/tasks/` and build again. In Nuxt, use Nuxt's own task support."
66
66
  },
67
- VITE_HUB_AGENT_OPTION_MISSING: {
68
- ...dynamicError,
69
- fix: "Set `agent: true` in the ViteHub options to run the Agents. Set `agent: false` to keep them off on purpose."
70
- },
71
67
  VITE_HUB_CACHE_STALE_IF_ERROR_INVALID: {
72
68
  why: ({ value }) => `\`staleIfError\` is the number of seconds after \`maxAge\` during which a failed call returns the stored value, but it is ${value}.`,
73
69
  fix: "Pass a number of seconds that is 0 or more, such as `staleIfError: 86400` for one day. Remove `staleIfError` to return the error at once."
@@ -80,6 +76,14 @@ const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
80
76
  ...dynamicError,
81
77
  fix: "Pass non-empty strings to `tags` and `invalidateTag()`, for example `[\"posts\", \"post:1\"]`."
82
78
  },
79
+ VITE_HUB_DEFINITION_PACKAGE_MISSING: {
80
+ why: ({ definitions, packages }) => `${definitions}, but the app does not have ${packages}.`,
81
+ fix: ({ install, off }) => `Run \`pnpm add ${install}\` in your app. To keep the feature off, set ${off} in the ViteHub options.`
82
+ },
83
+ VITE_HUB_DEFINITION_ROOT_MISMATCH: {
84
+ why: ({ keys, projectRoot, workingDirectory }) => `\`vitehub()\` turns features on from the Definition files of ${workingDirectory}, the project of the working directory, but the Vite root is in ${projectRoot}, which has other Definition files for ${keys}.`,
85
+ fix: ({ keys }) => `Run Vite from the project folder, or set ${keys} to \`true\` or \`false\` in the ViteHub options.`
86
+ },
83
87
  VITE_HUB_DEPLOY_CHECK_INVALID: {
84
88
  why: ({ value }) => `A \`deploy.check\` path must be a path on the deployed site that starts with one \`/\`, such as \`/api/health\`, but it is ${value}.`,
85
89
  fix: "Write each `deploy.check` entry as a path that starts with `/`, without an origin and without spaces, such as `deploy: { check: [\"/\", \"/api/products\"] }`."
@@ -88,6 +92,10 @@ const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
88
92
  why: "`deploy.indexNow` sends the URLs of the public site to IndexNow, and the build does not know that site: `publicUrl` is not a string.",
89
93
  fix: "Set `vitehub({ publicUrl: \"https://shop.example.com\" })` to the origin of the public site, or remove `deploy.indexNow`."
90
94
  },
95
+ VITE_HUB_DOCKERFILE_NATIVE_PACKAGES_NOT_LINUX: {
96
+ why: ({ os, packages }) => `The build ran on ${os}, so these native packages in \`.output\` hold ${os} code: ${packages}. The Linux image of \`.output/Dockerfile\` cannot load them.`,
97
+ fix: "Install dependencies and build the app in the Linux Node image for the target CPU. Use that same base for the generated Dockerfile with `docker build --build-arg VITEHUB_NODE_IMAGE=<image>`. Or set `docker: false` in `vitehub()` and use a Dockerfile with compatible build and runtime stages."
98
+ },
91
99
  VITE_HUB_HOST_PROVIDER_CONFLICT: {
92
100
  why: ({ detected, host, variable }) => `\`vitehub({ host: "${host}" })\` builds ${host} output, but \`${variable}\` is set, so this build runs on the ${detected} host, which cannot run ${host} output.`,
93
101
  fix: ({ host }) => `Remove \`host\` from \`vitehub()\` to build for the host that the environment names. To build ${host} output on purpose, set \`VITEHUB_HOST=${host}\`.`
@@ -154,7 +162,7 @@ const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
154
162
  },
155
163
  VITE_HUB_R0137: {
156
164
  ...dynamicError,
157
- fix: "Set `schedule: { runtime: { driver: \"process\" }, providerOutput: \"auto\" }` in `vitehub()` to run Schedules in the server process, or `schedule: { providerOutput: false }` to start them yourself."
165
+ fix: "Remove `schedule.providerOutput` from `vitehub()` to run Schedules in the server process, or set `schedule: { providerOutput: false }` to start them yourself."
158
166
  },
159
167
  VITE_HUB_R0141: {
160
168
  ...dynamicError,
@@ -374,7 +382,7 @@ const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
374
382
  },
375
383
  VITE_HUB_B0005: {
376
384
  ...dynamicError,
377
- fix: "Set `auth: true` in `vitehub()` and add server/auth.ts with the admin plugin of Better Auth, or remove `console.impersonation`."
385
+ fix: "Add server/auth.ts with the admin plugin of Better Auth, and remove `auth: false` from `vitehub()` if it is there. Or remove `console.impersonation`."
378
386
  },
379
387
  VITE_HUB_R0075: {
380
388
  ...dynamicError,
@@ -430,7 +438,7 @@ const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
430
438
  },
431
439
  VITE_HUB_R0089: {
432
440
  ...dynamicError,
433
- fix: "Choose an Email driver for this host, such as `email: { driver: \"resend\" }` in `vitehub()`, or set `host: \"cloudflare\"`."
441
+ fix: "Set `driver` for the production build, such as `email: { driver: \"resend\" }` in `vitehub()`. Use `driver: \"log\"` to send no email, or build for `host: \"cloudflare\"`."
434
442
  },
435
443
  VITE_HUB_B0008: {
436
444
  ...dynamicError,
@@ -538,15 +546,15 @@ const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
538
546
  },
539
547
  VITE_HUB_LOGS_MAX_ENTRIES_INVALID: {
540
548
  why: "logs.maxEntries must be an integer from 1 to 10000.",
541
- fix: "Set `maxEntries` in `vitehub({ observability: { logs } })` or in `createLogBuffer()` to an integer from 1 to 10000."
549
+ fix: "Set `maxEntries` in `vitehub({ logs })` or in `createLogBuffer()` to an integer from 1 to 10000."
542
550
  },
543
551
  VITE_HUB_LOGS_MAX_ENTRY_BYTES_INVALID: {
544
552
  why: "logs.maxEntryBytes must be an integer from 256 to 262144.",
545
- fix: "Set `maxEntryBytes` in `vitehub({ observability: { logs } })` or in `createLogBuffer()` to an integer from 256 to 262144."
553
+ fix: "Set `maxEntryBytes` in `vitehub({ logs })` or in `createLogBuffer()` to an integer from 256 to 262144."
546
554
  },
547
555
  VITE_HUB_LOGS_SOURCE_MISSING: {
548
- why: "[vitehub] Production Logs needs an existing source. Set observability: { logs: { source: \"./server/logs.ts\" } }. The local buffer is per process and has no durable history.",
549
- fix: "Set `vitehub({ observability: { logs: { source: \"./server/logs.ts\" } } })` to a server file that default-exports a `LogSource`, or remove `observability.logs` from the production build."
556
+ why: "[vitehub] Production Logs needs an existing source. Set logs: { source: \"./server/logs.ts\" }. The local buffer is per process and has no durable history.",
557
+ fix: "Set `vitehub({ logs: { source: \"./server/logs.ts\" } })` to a server file that default-exports a `LogSource`, or remove `logs` from the production build."
550
558
  },
551
559
  VITE_HUB_LOGS_SOURCE_PAGE_TOO_LARGE: {
552
560
  why: ({ limit }) => limit === "entries" ? "The source exceeded the requested page size." : "The source exceeded the response size limit.",
@@ -69,10 +69,6 @@ export const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
69
69
  why: "Nitro tasks are not enabled in this runtime.",
70
70
  fix: "Add a file to `server/tasks/` and build again. In Nuxt, use Nuxt's own task support.",
71
71
  },
72
- VITE_HUB_AGENT_OPTION_MISSING: {
73
- ...dynamicError,
74
- fix: "Set `agent: true` in the ViteHub options to run the Agents. Set `agent: false` to keep them off on purpose.",
75
- },
76
72
  VITE_HUB_CACHE_STALE_IF_ERROR_INVALID: {
77
73
  why: ({ value }: { value: string }) => `\`staleIfError\` is the number of seconds after \`maxAge\` during which a failed call returns the stored value, but it is ${value}.`,
78
74
  fix: "Pass a number of seconds that is 0 or more, such as `staleIfError: 86400` for one day. Remove `staleIfError` to return the error at once.",
@@ -85,6 +81,14 @@ export const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
85
81
  ...dynamicError,
86
82
  fix: "Pass non-empty strings to `tags` and `invalidateTag()`, for example `[\"posts\", \"post:1\"]`.",
87
83
  },
84
+ VITE_HUB_DEFINITION_PACKAGE_MISSING: {
85
+ why: ({ definitions, packages }: { definitions: string, install: string, off: string, packages: string }) => `${definitions}, but the app does not have ${packages}.`,
86
+ fix: ({ install, off }: { definitions: string, install: string, off: string, packages: string }) => `Run \`pnpm add ${install}\` in your app. To keep the feature off, set ${off} in the ViteHub options.`,
87
+ },
88
+ VITE_HUB_DEFINITION_ROOT_MISMATCH: {
89
+ why: ({ keys, projectRoot, workingDirectory }: { keys: string, projectRoot: string, workingDirectory: string }) => `\`vitehub()\` turns features on from the Definition files of ${workingDirectory}, the project of the working directory, but the Vite root is in ${projectRoot}, which has other Definition files for ${keys}.`,
90
+ fix: ({ keys }: { keys: string, projectRoot: string, workingDirectory: string }) => `Run Vite from the project folder, or set ${keys} to \`true\` or \`false\` in the ViteHub options.`,
91
+ },
88
92
  VITE_HUB_DEPLOY_CHECK_INVALID: {
89
93
  why: ({ value }: { value: string }) => `A \`deploy.check\` path must be a path on the deployed site that starts with one \`/\`, such as \`/api/health\`, but it is ${value}.`,
90
94
  fix: "Write each `deploy.check` entry as a path that starts with `/`, without an origin and without spaces, such as `deploy: { check: [\"/\", \"/api/products\"] }`.",
@@ -93,6 +97,10 @@ export const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
93
97
  why: "`deploy.indexNow` sends the URLs of the public site to IndexNow, and the build does not know that site: `publicUrl` is not a string.",
94
98
  fix: "Set `vitehub({ publicUrl: \"https://shop.example.com\" })` to the origin of the public site, or remove `deploy.indexNow`.",
95
99
  },
100
+ VITE_HUB_DOCKERFILE_NATIVE_PACKAGES_NOT_LINUX: {
101
+ why: ({ os, packages }: { os: string, packages: string }) => `The build ran on ${os}, so these native packages in \`.output\` hold ${os} code: ${packages}. The Linux image of \`.output/Dockerfile\` cannot load them.`,
102
+ fix: "Install dependencies and build the app in the Linux Node image for the target CPU. Use that same base for the generated Dockerfile with `docker build --build-arg VITEHUB_NODE_IMAGE=<image>`. Or set `docker: false` in `vitehub()` and use a Dockerfile with compatible build and runtime stages.",
103
+ },
96
104
  VITE_HUB_HOST_PROVIDER_CONFLICT: {
97
105
  why: ({ detected, host, variable }: { detected: string, host: string, variable: string }) => `\`vitehub({ host: "${host}" })\` builds ${host} output, but \`${variable}\` is set, so this build runs on the ${detected} host, which cannot run ${host} output.`,
98
106
  fix: ({ host }: { host: string }) => `Remove \`host\` from \`vitehub()\` to build for the host that the environment names. To build ${host} output on purpose, set \`VITEHUB_HOST=${host}\`.`,
@@ -159,7 +167,7 @@ export const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
159
167
  },
160
168
  VITE_HUB_R0137: {
161
169
  ...dynamicError,
162
- fix: "Set `schedule: { runtime: { driver: \"process\" }, providerOutput: \"auto\" }` in `vitehub()` to run Schedules in the server process, or `schedule: { providerOutput: false }` to start them yourself.",
170
+ fix: "Remove `schedule.providerOutput` from `vitehub()` to run Schedules in the server process, or set `schedule: { providerOutput: false }` to start them yourself.",
163
171
  },
164
172
  VITE_HUB_R0141: {
165
173
  ...dynamicError,
@@ -383,7 +391,7 @@ export const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
383
391
  },
384
392
  VITE_HUB_B0005: {
385
393
  ...dynamicError,
386
- fix: "Set `auth: true` in `vitehub()` and add server/auth.ts with the admin plugin of Better Auth, or remove `console.impersonation`.",
394
+ fix: "Add server/auth.ts with the admin plugin of Better Auth, and remove `auth: false` from `vitehub()` if it is there. Or remove `console.impersonation`.",
387
395
  },
388
396
  VITE_HUB_R0075: {
389
397
  ...dynamicError,
@@ -439,7 +447,7 @@ export const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
439
447
  },
440
448
  VITE_HUB_R0089: {
441
449
  ...dynamicError,
442
- fix: "Choose an Email driver for this host, such as `email: { driver: \"resend\" }` in `vitehub()`, or set `host: \"cloudflare\"`.",
450
+ fix: "Set `driver` for the production build, such as `email: { driver: \"resend\" }` in `vitehub()`. Use `driver: \"log\"` to send no email, or build for `host: \"cloudflare\"`.",
443
451
  },
444
452
  VITE_HUB_B0008: {
445
453
  ...dynamicError,
@@ -549,15 +557,15 @@ export const viteHubErrorDiagnostics = /*#__PURE__*/ defineDiagnostics({
549
557
  },
550
558
  VITE_HUB_LOGS_MAX_ENTRIES_INVALID: {
551
559
  why: "logs.maxEntries must be an integer from 1 to 10000.",
552
- fix: "Set `maxEntries` in `vitehub({ observability: { logs } })` or in `createLogBuffer()` to an integer from 1 to 10000.",
560
+ fix: "Set `maxEntries` in `vitehub({ logs })` or in `createLogBuffer()` to an integer from 1 to 10000.",
553
561
  },
554
562
  VITE_HUB_LOGS_MAX_ENTRY_BYTES_INVALID: {
555
563
  why: "logs.maxEntryBytes must be an integer from 256 to 262144.",
556
- fix: "Set `maxEntryBytes` in `vitehub({ observability: { logs } })` or in `createLogBuffer()` to an integer from 256 to 262144.",
564
+ fix: "Set `maxEntryBytes` in `vitehub({ logs })` or in `createLogBuffer()` to an integer from 256 to 262144.",
557
565
  },
558
566
  VITE_HUB_LOGS_SOURCE_MISSING: {
559
- why: "[vitehub] Production Logs needs an existing source. Set observability: { logs: { source: \"./server/logs.ts\" } }. The local buffer is per process and has no durable history.",
560
- fix: "Set `vitehub({ observability: { logs: { source: \"./server/logs.ts\" } } })` to a server file that default-exports a `LogSource`, or remove `observability.logs` from the production build.",
567
+ why: "[vitehub] Production Logs needs an existing source. Set logs: { source: \"./server/logs.ts\" }. The local buffer is per process and has no durable history.",
568
+ fix: "Set `vitehub({ logs: { source: \"./server/logs.ts\" } })` to a server file that default-exports a `LogSource`, or remove `logs` from the production build.",
561
569
  },
562
570
  VITE_HUB_LOGS_SOURCE_PAGE_TOO_LARGE: {
563
571
  why: ({ limit }: { limit: "entries" | "bytes" }) => limit === "entries" ? "The source exceeded the requested page size." : "The source exceeded the response size limit.",
package/dist/index.d.ts CHANGED
@@ -1,8 +1,21 @@
1
1
  import "@vite-hub/env/vite";
2
- import { A as SameOriginWritesOptions, B as detectHost, C as ObservabilityEvlogOptions, D as ConsoleOptions, E as SystemdOptions, F as HealthOptions, L as DatabaseOptions, M as SecurityOptions, N as SeoOptions, O as AuthOptions, P as DeployOptions, R as CacheOptions, S as WorkspaceOptions, T as ObservabilityOptions, _ as ChannelsOptions, a as ViteHubNodeOptions, b as AgentInvocationsDefault, c as QueueOptions, d as ScheduleOptions, f as SandboxTaskOptions, g as EmailOptions, h as KVOptions, i as ViteHubDeviceOptions, j as SecurityHeaders, k as RedirectsOptions, l as I18nOptions, m as RateLimitOptions, n as ConnectionsOptions, o as ViteHubOptions, p as RealtimeOptions, r as EnvOptions, s as ViteHubQueueOptions, t as AgentOptions, u as WorkflowOptions, v as BrowserOptions, w as ObservabilityLogsOptions, x as AgentInvocationsDefaultJournal, y as BlobOptions, z as ViteHubHost } from "./plugins-5uDXr9Km.js";
2
+ import { A as SameOriginWritesOptions, B as detectHost, C as WorkspaceOptions, D as SystemdOptions, E as ObservabilityOptions, F as HealthOptions, L as DatabaseOptions, M as SecurityOptions, N as SeoOptions, O as ConsoleOptions, P as DeployOptions, R as CacheOptions, S as AgentInvocationsDefaultJournal, T as ObservabilityEvlogOptions, _ as EmailOptions, a as ViteHubDeviceOptions, b as BlobOptions, c as ViteHubQueueOptions, d as WorkflowOptions, f as ScheduleOptions, g as KVOptions, h as RateLimitOptions, i as EnvOptions, j as SecurityHeaders, k as RedirectsOptions, l as QueueOptions, m as RealtimeOptions, n as CloudflareOptions, o as ViteHubNodeOptions, p as SandboxTaskOptions, r as ConnectionsOptions, s as ViteHubOptions, t as AgentOptions, u as I18nOptions, v as ChannelsOptions, w as LogsOptions, x as AgentInvocationsDefault, y as BrowserOptions, z as ViteHubHost } from "./plugins-BqAtIEX2.js";
3
3
  import { PluginOption } from "vite";
4
+ //#region ../auth/dist/types-CruflEFI.d.ts
5
+ //#endregion
6
+ //#region src/types.d.ts
7
+ declare global {
8
+ namespace ViteHub {
9
+ interface AuthRuntimeEnv extends Record<string, unknown> {}
10
+ /** Generated declarations set `definition` to the type of the app's Auth Definition. */
11
+ interface AuthRegistry {}
12
+ }
13
+ }
14
+ /** `false` turns Auth off. `server/auth.ts` turns it on, and `defineAuth()` holds every Auth option. */
15
+ type AuthOptions = false;
16
+ //#endregion
4
17
  //#region src/index.d.ts
5
18
  /** The ViteHub Vite plugins and Nitro, the server of the app. Nitro steps aside when the app adds `nitro()` itself. */
6
19
  export declare function vitehub(options?: ViteHubOptions): PluginOption[];
7
20
  //#endregion
8
- export { type AgentInvocationsDefault, type AgentInvocationsDefaultJournal, type AgentOptions, type AuthOptions, type BlobOptions, type BrowserOptions, type CacheOptions, type ChannelsOptions, type ConnectionsOptions, type ConsoleOptions, type DatabaseOptions, type DeployOptions, type EmailOptions, type EnvOptions, type HealthOptions, type I18nOptions, type KVOptions, type ObservabilityEvlogOptions, type ObservabilityLogsOptions, type ObservabilityOptions, type QueueOptions, type RateLimitOptions, type RealtimeOptions, type RedirectsOptions, type SameOriginWritesOptions, type SandboxTaskOptions, type ScheduleOptions, type SecurityHeaders, type SecurityOptions, type SeoOptions, type SystemdOptions, type ViteHubDeviceOptions, type ViteHubHost, type ViteHubNodeOptions, type ViteHubOptions, type ViteHubQueueOptions, type WorkflowOptions, type WorkspaceOptions, detectHost };
21
+ export { type AgentInvocationsDefault, type AgentInvocationsDefaultJournal, type AgentOptions, type AuthOptions, type BlobOptions, type BrowserOptions, type CacheOptions, type ChannelsOptions, type CloudflareOptions, type ConnectionsOptions, type ConsoleOptions, type DatabaseOptions, type DeployOptions, type EmailOptions, type EnvOptions, type HealthOptions, type I18nOptions, type KVOptions, type LogsOptions, type ObservabilityEvlogOptions, type ObservabilityOptions, type QueueOptions, type RateLimitOptions, type RealtimeOptions, type RedirectsOptions, type SameOriginWritesOptions, type SandboxTaskOptions, type ScheduleOptions, type SecurityHeaders, type SecurityOptions, type SeoOptions, type SystemdOptions, type ViteHubDeviceOptions, type ViteHubHost, type ViteHubNodeOptions, type ViteHubOptions, type ViteHubQueueOptions, type WorkflowOptions, type WorkspaceOptions, detectHost };
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
- import { l as startPackageChecks } from "./optional-owners-Crm6kVS5.js";
2
- import { W as detectHost, n as viteHubPlugins, ot as isIncludedNitroPlugin, st as markIncludedNitroPlugin } from "./plugins-DQ8pF-38.js";
1
+ import { u as startPackageChecks } from "./optional-owners-BNA2OX6z.js";
2
+ import { J as detectHost, ft as isIncludedNitroPlugin, mt as withShortInspect, pt as markIncludedNitroPlugin, r as viteHubPlugins } from "./plugins-B-DpgDPB.js";
3
3
  import { nitro } from "nitro/vite";
4
4
  //#region ../internal/src/build/included-nitro.ts
5
5
  function flattenPlugins(option) {
@@ -32,8 +32,12 @@ function includedNitro(options = {}) {
32
32
  //#region src/index.ts
33
33
  /** The ViteHub Vite plugins and Nitro, the server of the app. Nitro steps aside when the app adds `nitro()` itself. */
34
34
  function vitehub(options = {}) {
35
- startPackageChecks();
36
- return [...viteHubPlugins(options), includedNitro()];
35
+ try {
36
+ startPackageChecks();
37
+ return [...viteHubPlugins(options, false), includedNitro()];
38
+ } catch (error) {
39
+ throw withShortInspect(error);
40
+ }
37
41
  }
38
42
  //#endregion
39
43
  export { detectHost, vitehub };
@@ -1,4 +1,4 @@
1
- import { t as viteHubErrorDiagnostics } from "../error-diagnostics-C2rjmOlX.js";
1
+ import { t as viteHubErrorDiagnostics } from "../error-diagnostics-Bm3JKYjz.js";
2
2
  //#region src/internal/disabled-redis-driver.ts
3
3
  function disabledRedisDriver() {
4
4
  throw viteHubErrorDiagnostics.VITE_HUB_R0001({ message: "[vitehub] The Redis KV driver is unavailable because this ViteHub build does not configure a store that can use Redis." });