vite-hub 0.5.1 → 0.6.0

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 (346) hide show
  1. package/README.md +9 -8
  2. package/dist/{access-BBHk9b5P.js → access-CUFHPi8T.js} +9 -133
  3. package/dist/{access-policy-CUbJLvlR.d.ts → access-DkBck8Vu.d.ts} +16 -16
  4. package/dist/{account-CoAO1F8G.d.ts → account-DNr8fHcQ.d.ts} +1 -1
  5. package/dist/{console/runtime/server → agent/console}/agents.get.d.ts +1 -1
  6. package/dist/{console/runtime/server → agent/console}/agents.get.js +3 -3
  7. package/dist/{console/runtime/server → agent/console}/channel-replay.d.ts +2 -2
  8. package/dist/{console/runtime/server → agent/console}/channel-replay.js +6 -6
  9. package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.js +4 -4
  10. package/dist/{console/runtime/server → agent/console}/invocation-workspace.get.d.ts +3 -3
  11. package/dist/{console/runtime/server → agent/console}/invocation-workspace.get.js +6 -6
  12. package/dist/{console/runtime/server → agent/console}/invocation.get.d.ts +4 -4
  13. package/dist/{console/runtime/server → agent/console}/invocation.get.js +8 -8
  14. package/dist/{console/runtime/server → agent/console}/invocations.get.js +5 -5
  15. package/dist/{console/runtime/server/usage.get.d.ts → agent/console/invocations.usage.d.ts} +2 -4
  16. package/dist/agent/console/invocations.usage.js +51 -0
  17. package/dist/agent/console/operations.d.ts +6 -0
  18. package/dist/agent/console/operations.js +247 -0
  19. package/dist/{console/runtime/server → agent/console}/status.get.d.ts +2 -2
  20. package/dist/{console/runtime/server → agent/console}/status.get.js +6 -6
  21. package/dist/{server-DsOEa4_A.js → agent-console-CHsLxKk_.js} +3 -2
  22. package/dist/agent-console-FmaYpVv-.d.ts +14 -0
  23. package/dist/{agent-invocations.post-BAC1aHnG.js → agent-invocations.post-CF5anHY6.js} +8 -8
  24. package/dist/{agents-BClUWOj7.js → agents-DBm_PJie.js} +1 -1
  25. package/dist/{agents-Cz_uhhov.js → agents-DXLHsE7x.js} +2 -2
  26. package/dist/auth/console/auth.d.ts +25 -0
  27. package/dist/{console/runtime/server → auth/console}/auth.js +11 -12
  28. package/dist/auth/console/operations.d.ts +3 -0
  29. package/dist/auth/console/operations.js +135 -0
  30. package/dist/{auth-operations-arLIY2_2.js → auth-operations-BKqoX8Ua.js} +3 -3
  31. package/dist/{auth-types-B4mq4YhK.d.ts → auth-types-Cotn7406.d.ts} +4 -17
  32. package/dist/bin.js +3 -3
  33. package/dist/blob/console/operations.d.ts +3 -0
  34. package/dist/blob/console/operations.js +44 -0
  35. package/dist/{blob-eH6j0AQj.js → blob-iw8pWQ6o.js} +2 -2
  36. package/dist/{blob-_TtxDb-t.d.ts → blob-uNin0_TV.d.ts} +1 -1
  37. package/dist/cache/operations.js +1 -1
  38. package/dist/console/auth-types.d.ts +2 -2
  39. package/dist/console/auth.d.ts +2 -2
  40. package/dist/console/runtime/auth-operations.d.ts +3 -3
  41. package/dist/console/runtime/auth-operations.js +1 -1
  42. package/dist/console/runtime/client/account.d.ts +1 -1
  43. package/dist/console/runtime/client/account.js +2 -2
  44. package/dist/console/runtime/client/auth-management.ts +6 -6
  45. package/dist/console/runtime/client/blob-media.js +2 -2
  46. package/dist/console/runtime/client/comment-thread.js +1 -1
  47. package/dist/console/runtime/client/content-heads.js +1 -1
  48. package/dist/console/runtime/client/documents.d.ts +1 -1
  49. package/dist/console/runtime/client/documents.js +1 -1
  50. package/dist/console/runtime/client/invocation.js +1 -1
  51. package/dist/console/runtime/client/live.d.ts +1 -1
  52. package/dist/console/runtime/client/mcp-client.d.ts +4 -4
  53. package/dist/console/runtime/client/mcp-client.js +4 -6
  54. package/dist/console/runtime/client/media-library.js +1 -1
  55. package/dist/console/runtime/client/media-uploads.js +1 -1
  56. package/dist/console/runtime/client/operation-view.js +1 -1
  57. package/dist/console/runtime/client/presence.d.ts +1 -1
  58. package/dist/console/runtime/client/problem.d.ts +1 -1
  59. package/dist/console/runtime/client/problem.js +2 -2
  60. package/dist/console/runtime/client/project-link.d.ts +1 -1
  61. package/dist/console/runtime/client/project-link.js +1 -1
  62. package/dist/console/runtime/client/project-session.d.ts +2 -2
  63. package/dist/console/runtime/client/project-session.js +1 -1
  64. package/dist/console/runtime/client/publish.d.ts +1 -1
  65. package/dist/console/runtime/client/rate-limit.js +1 -1
  66. package/dist/console/runtime/client/read-only.d.ts +1 -1
  67. package/dist/console/runtime/client/read-only.js +1 -1
  68. package/dist/console/runtime/client/request.d.ts +2 -2
  69. package/dist/console/runtime/client/request.js +1 -1
  70. package/dist/console/runtime/client/schedule-run.js +1 -1
  71. package/dist/console/runtime/client/sections.d.ts +1 -1
  72. package/dist/console/runtime/client/sections.js +1 -1
  73. package/dist/console/runtime/client/site-access.d.ts +48 -9
  74. package/dist/console/runtime/client/site-access.js +18 -11
  75. package/dist/console/runtime/client/site-link.d.ts +2 -0
  76. package/dist/console/runtime/client/site-link.js +1 -0
  77. package/dist/console/runtime/client/workflow.js +1 -1
  78. package/dist/console/runtime/components/console-auth-detail.vue +1 -1
  79. package/dist/console/runtime/components/console-auth-event-list.vue +1 -0
  80. package/dist/console/runtime/components/console-document-editor.vue +3 -4
  81. package/dist/console/runtime/components/console-usage.vue +2 -2
  82. package/dist/console/runtime/diagnostics.ts +14 -56
  83. package/dist/console/runtime/mcp-client.d.ts +2 -2
  84. package/dist/console/runtime/mcp-client.js +1 -1
  85. package/dist/console/runtime/operation-loader.d.ts +1 -0
  86. package/dist/console/runtime/operation-loader.js +10 -0
  87. package/dist/console/runtime/page-tool/page-tool.js +2 -2
  88. package/dist/console/runtime/sections.d.ts +2 -2
  89. package/dist/console/runtime/sections.js +1 -1
  90. package/dist/console/runtime/server/access-policy.d.ts +1 -1
  91. package/dist/console/runtime/server/agent-console.d.ts +2 -0
  92. package/dist/console/runtime/server/agent-console.js +1 -0
  93. package/dist/console/runtime/server/blob.d.ts +1 -1
  94. package/dist/console/runtime/server/blob.js +1 -1
  95. package/dist/console/runtime/server/database.d.ts +1 -1
  96. package/dist/console/runtime/server/definitions.get.d.ts +2 -2
  97. package/dist/console/runtime/server/definitions.get.js +2 -2
  98. package/dist/console/runtime/server/definitions.js +1 -1
  99. package/dist/console/runtime/server/documents.d.ts +2 -2
  100. package/dist/console/runtime/server/documents.js +2 -2
  101. package/dist/console/runtime/server/entry-site-access.d.ts +3 -0
  102. package/dist/console/runtime/server/entry-site-access.js +4 -0
  103. package/dist/console/runtime/server/entry.d.ts +3 -0
  104. package/dist/console/runtime/server/entry.js +4 -0
  105. package/dist/console/runtime/server/operation-contributions.d.ts +1 -1
  106. package/dist/console/runtime/server/operation-contributions.js +1 -1
  107. package/dist/console/runtime/server/pill.d.ts +45 -0
  108. package/dist/console/runtime/server/pill.js +62 -0
  109. package/dist/console/runtime/server/rpc.d.ts +5 -8
  110. package/dist/console/runtime/server/rpc.js +13 -20
  111. package/dist/console/runtime/server/runtime.d.ts +1 -1
  112. package/dist/console/runtime/server/runtime.js +1 -1
  113. package/dist/console/runtime/server/sections.d.ts +4 -4
  114. package/dist/console/runtime/server/sections.get.d.ts +1 -1
  115. package/dist/console/runtime/server/sections.get.js +4 -4
  116. package/dist/console/runtime/server/sections.js +3 -3
  117. package/dist/console/runtime/server/setup.d.ts +4 -4
  118. package/dist/console/runtime/server/setup.js +3 -3
  119. package/dist/console/runtime/server/site-access-operation.d.ts +7 -0
  120. package/dist/console/runtime/server/site-access-operation.js +36 -0
  121. package/dist/console/runtime/server/site-actions.d.ts +73 -0
  122. package/dist/console/runtime/server/site-actions.js +105 -0
  123. package/dist/console/runtime/server/site-entry.d.ts +16 -7
  124. package/dist/console/runtime/server/site-entry.js +59 -42
  125. package/dist/console/runtime/server/site-visitor.d.ts +17 -0
  126. package/dist/console/runtime/server/site-visitor.js +1 -0
  127. package/dist/console/runtime/server/site.d.ts +27 -0
  128. package/dist/console/runtime/server/site.js +1 -0
  129. package/dist/console/server.d.ts +7 -19
  130. package/dist/console/server.js +6 -6
  131. package/dist/console-signature--55DIKf2.js +237 -0
  132. package/dist/content/console/operations.d.ts +3 -0
  133. package/dist/content/console/operations.js +62 -0
  134. package/dist/{console/runtime/server → database/console}/database.get.d.ts +1 -1
  135. package/dist/{console/runtime/server → database/console}/database.get.js +4 -4
  136. package/dist/database/console/operations.d.ts +3 -0
  137. package/dist/database/console/operations.js +49 -0
  138. package/dist/{database-CPjZ3L0g.d.ts → database-yFezh5U1.d.ts} +1 -1
  139. package/dist/{definitions-M7i2p8SR.js → definitions-DGo2rNQ9.js} +1 -1
  140. package/dist/{dev-peer-DBq-isgi.js → dev-peer-CRYp01PE.js} +1 -219
  141. package/dist/dev-peer-CX5C9243.js +1 -0
  142. package/dist/{diagnostics-B2cqlCSz.js → diagnostics-DLHqjKGe.js} +2 -8
  143. package/dist/diagnostics-DgGKvWzF.d.ts +7 -0
  144. package/dist/doctor.js +2 -2
  145. package/dist/{documents-LtkKCxtu.d.ts → documents-A-7Ho0g0.d.ts} +11 -11
  146. package/dist/{documents-Ck_iub9w.js → documents-BduuZjm3.js} +3 -2
  147. package/dist/{documents-DxK0tdjA.d.ts → documents-CApMRd4o.d.ts} +2 -3
  148. package/dist/{documents-BOYwZ5g4.js → documents-D6ueeoUR.js} +12 -15
  149. package/dist/durability/operations.js +1 -1
  150. package/dist/{console/runtime/server → env/console}/env.get.d.ts +2 -2
  151. package/dist/{console/runtime/server → env/console}/env.get.js +7 -7
  152. package/dist/env/console/operations.d.ts +3 -0
  153. package/dist/env/console/operations.js +12 -0
  154. package/dist/env/vite.d.ts +1 -0
  155. package/dist/env/vite.js +2 -0
  156. package/dist/index.d.ts +1 -1
  157. package/dist/index.js +2 -2
  158. package/dist/{internal-CKocv79I.d.ts → internal-BRNf11h3.d.ts} +14 -4
  159. package/dist/{invocation-page-undo-BEi-rO0Q.js → invocation-page-undo-DHbXczWY.js} +6 -4
  160. package/dist/invocations-B60XWNES.js +45 -0
  161. package/dist/{console/runtime/server → logs/console}/logs.get.d.ts +3 -3
  162. package/dist/{console/runtime/server → logs/console}/logs.get.js +7 -7
  163. package/dist/logs/console/operations.d.ts +3 -0
  164. package/dist/logs/console/operations.js +23 -0
  165. package/dist/loopback-Bl9Cvj1k.js +139 -0
  166. package/dist/mcp/eval.d.ts +1 -0
  167. package/dist/mcp/eval.js +2 -0
  168. package/dist/{mcp-client-Q2XbUXuP.d.ts → mcp-client-uXVvS7RL.d.ts} +4 -6
  169. package/dist/{media-CAKz9yrp.js → media-CNwnh6CG.js} +5 -5
  170. package/dist/{media-library-BDX89xXA.js → media-library-DTC8TLsZ.js} +1 -1
  171. package/dist/nuxt.d.ts +1 -1
  172. package/dist/nuxt.js +108 -68
  173. package/dist/{operation-contributions-D10pjkJF.js → operation-contributions-BU10k2QS.js} +7 -6
  174. package/dist/{operation-contributions-BCcQVlGb.d.ts → operation-contributions-xwjDzj28.d.ts} +5 -4
  175. package/dist/{operation-definition-DTpNvLd8.js → operation-definition-D04Rdjbe.js} +2 -1
  176. package/dist/operation-modules-BUXlwjvd.js +1 -0
  177. package/dist/operation-modules-DHWkPcfS.js +139 -0
  178. package/dist/operations-D-7ljPqw.js +1 -0
  179. package/dist/{operations-CD_mu_Ww.js → operations-DksTrRMb.js} +1 -1
  180. package/dist/operations-byxiZ2R2.js +113 -0
  181. package/dist/{optional-owners-DAfShdgV.js → optional-owners-Cypch7V3.js} +0 -1
  182. package/dist/page-tools-BeZrtn4S.js +46 -0
  183. package/dist/page-tools-Chk8Gm9x.d.ts +23 -0
  184. package/dist/page-tools-shared-BLPidmCi.js +39 -0
  185. package/dist/{plugins-BpiTVULl.d.ts → plugins-BmkOoyIh.d.ts} +22 -9
  186. package/dist/{plugins-H6-MQrsn.js → plugins-DfXcUnzN.js} +248 -310
  187. package/dist/{project-DKBIHOf4.d.ts → project-B2qWt8on.d.ts} +2 -7
  188. package/dist/{project-BxyyclTE.js → project-_juMSuAS.js} +5 -7
  189. package/dist/{project-link-CeS0T8Pr.js → project-link-CJbCkOlC.js} +3 -3
  190. package/dist/{project-link-isfdRO3Q.d.ts → project-link-Ck3vuq9w.d.ts} +1 -1
  191. package/dist/{project-session--GN7MduT.js → project-session-8pN7pRo8.js} +4 -4
  192. package/dist/{request-CQ8TkHLh.js → request-D769eiBL.js} +2 -2
  193. package/dist/{request-BC_krbEr.d.ts → request-DYmjLTqP.d.ts} +1 -1
  194. package/dist/{request-CJCPyu2B.d.ts → request-DkoE0b2h.d.ts} +10 -2
  195. package/dist/{request-Cl68STwT.js → request-XFVx7CGC.js} +24 -2
  196. package/dist/routes-D02vxUSg.js +26 -0
  197. package/dist/{runtime-CyPZMiyK.js → runtime-DA7HJe10.js} +1 -1
  198. package/dist/{runtime-Cf8R1Ztr.d.ts → runtime-DGvimtvc.d.ts} +1 -1
  199. package/dist/{runtime-feature-guard-DpUn4Oxc.js → runtime-feature-guard-BKAMRZzM.js} +1 -1
  200. package/dist/search-jgMrZJXR.js +84 -0
  201. package/dist/{sections-BiCOk9qP.js → sections-AUGy9EkY.js} +1 -6
  202. package/dist/{sections-BTfWK14a.d.ts → sections-BMkFB3S-.d.ts} +1 -1
  203. package/dist/{sections-0qrBvGbf.d.ts → sections-DCoCa4nF.d.ts} +1 -4
  204. package/dist/{sections-DAtgYMVz.d.ts → sections-DjeAUX7o.d.ts} +4 -4
  205. package/dist/{sections-HLxb9MrG.js → sections-ZFAlI4JW.js} +2 -2
  206. package/dist/{sections.get-CGmtYmfu.d.ts → sections.get-BY5dClJY.d.ts} +1 -1
  207. package/dist/{setup-Ca7jtBLS.d.ts → setup-BBnZPziq.d.ts} +4 -7
  208. package/dist/{setup-DQz_i-ee.js → setup-yc3_WKNG.js} +1 -13
  209. package/dist/site-CZCIWsUQ.js +169 -0
  210. package/dist/site-link-Bvo2SxPo.js +58 -0
  211. package/dist/site-link-Dtw8MNVB.d.ts +18 -0
  212. package/dist/site-pages-B6J8U2Nq.js +66 -0
  213. package/dist/site-token-Wa7fhjwg.js +215 -0
  214. package/dist/site-visitor-BkhE2TA0.js +89 -0
  215. package/dist/skills/operations.js +2 -2
  216. package/dist/{skills.get-DAooGWy5.js → skills.get-CW8vc_Hf.js} +3 -3
  217. package/dist/task/operations.js +1 -1
  218. package/dist/usage-DBi7aOhx.js +33 -0
  219. package/dist/{version-CAhBr673.js → version-DUCd7Orc.js} +11 -5
  220. package/dist/workspace/console/operations.d.ts +3 -0
  221. package/dist/workspace/console/operations.js +22 -0
  222. package/dist/{console/runtime/server → workspace/console}/workspace-files.get.d.ts +3 -3
  223. package/dist/{console/runtime/server → workspace/console}/workspace-files.get.js +4 -4
  224. package/package.json +91 -82
  225. package/dist/auth-CeKxL2xp.d.ts +0 -116
  226. package/dist/cloudflare-env-lookup-DcN7pGlv.js +0 -15
  227. package/dist/console/runtime/client/ticket.d.ts +0 -2
  228. package/dist/console/runtime/client/ticket.js +0 -1
  229. package/dist/console/runtime/page/loader.js +0 -135
  230. package/dist/console/runtime/server/auth.d.ts +0 -2
  231. package/dist/console/runtime/server/mcp-client-operations.d.ts +0 -3
  232. package/dist/console/runtime/server/mcp-client-operations.js +0 -137
  233. package/dist/console/runtime/server/page-auth.d.ts +0 -16
  234. package/dist/console/runtime/server/page-auth.js +0 -43
  235. package/dist/console/runtime/server/page-tool.d.ts +0 -2
  236. package/dist/console/runtime/server/page-tool.js +0 -110
  237. package/dist/console/runtime/server/page-tools-route.d.ts +0 -2
  238. package/dist/console/runtime/server/page-tools-route.js +0 -4
  239. package/dist/console/runtime/server/search.get.d.ts +0 -2
  240. package/dist/console/runtime/server/search.get.js +0 -95
  241. package/dist/console/runtime/server/site-session.d.ts +0 -79
  242. package/dist/console/runtime/server/site-session.js +0 -1
  243. package/dist/console/runtime/server/tickets.d.ts +0 -2
  244. package/dist/console/runtime/server/tickets.js +0 -1
  245. package/dist/console/runtime/server/usage.get.js +0 -91
  246. package/dist/console/runtime/site-access.d.ts +0 -2
  247. package/dist/console/runtime/site-access.js +0 -1
  248. package/dist/diagnostics-BXxPggRw.d.ts +0 -9
  249. package/dist/invocations-8NThe8Bx.js +0 -85
  250. package/dist/mcp-client-Bkh-khvr.js +0 -9
  251. package/dist/mcp-client-DiObFpDS.js +0 -1037
  252. package/dist/operations-D7ENc68Y.js +0 -1
  253. package/dist/operations-vRLiH7dh.js +0 -852
  254. package/dist/page-tool-BUnUbuSy.d.ts +0 -67
  255. package/dist/page-tools-BQzwuAHD.js +0 -460
  256. package/dist/page-tools-UwsfvH-B.d.ts +0 -21
  257. package/dist/page-tools-shared-hJcG_xk8.js +0 -125
  258. package/dist/secret-D2KL_o2h.js +0 -43
  259. package/dist/site-access-1JIQjY11.js +0 -292
  260. package/dist/site-access-CUXIbbbR.d.ts +0 -53
  261. package/dist/site-access-CmaZ-oaL.js +0 -17
  262. package/dist/site-access-Cvmjb6aw.js +0 -1
  263. package/dist/site-session-D36fr7Wf.js +0 -297
  264. package/dist/skills/vitehub/SKILL.md +0 -142
  265. package/dist/skills/vitehub/agents/openai.yaml +0 -4
  266. package/dist/skills/vitehub/references/agent-definitions.md +0 -36
  267. package/dist/skills/vitehub/references/bundle.md +0 -57
  268. package/dist/skills/vitehub/references/capabilities-authority.md +0 -30
  269. package/dist/skills/vitehub/references/channels-triggers.md +0 -27
  270. package/dist/skills/vitehub/references/framework-composition.md +0 -29
  271. package/dist/skills/vitehub/references/preview-contract.md +0 -44
  272. package/dist/skills/vitehub/references/primitives/auth.md +0 -14
  273. package/dist/skills/vitehub/references/primitives/blob.md +0 -13
  274. package/dist/skills/vitehub/references/primitives/browser.md +0 -17
  275. package/dist/skills/vitehub/references/primitives/cache.md +0 -13
  276. package/dist/skills/vitehub/references/primitives/channels.md +0 -11
  277. package/dist/skills/vitehub/references/primitives/connections.md +0 -14
  278. package/dist/skills/vitehub/references/primitives/content.md +0 -13
  279. package/dist/skills/vitehub/references/primitives/database.md +0 -15
  280. package/dist/skills/vitehub/references/primitives/email.md +0 -11
  281. package/dist/skills/vitehub/references/primitives/env.md +0 -13
  282. package/dist/skills/vitehub/references/primitives/kv.md +0 -13
  283. package/dist/skills/vitehub/references/primitives/markdown-template.md +0 -13
  284. package/dist/skills/vitehub/references/primitives/queue.md +0 -14
  285. package/dist/skills/vitehub/references/primitives/rate-limit.md +0 -11
  286. package/dist/skills/vitehub/references/primitives/realtime.md +0 -19
  287. package/dist/skills/vitehub/references/primitives/sandbox-task.md +0 -11
  288. package/dist/skills/vitehub/references/primitives/sandbox.md +0 -13
  289. package/dist/skills/vitehub/references/primitives/schedule.md +0 -11
  290. package/dist/skills/vitehub/references/primitives/shell.md +0 -11
  291. package/dist/skills/vitehub/references/primitives/source.md +0 -11
  292. package/dist/skills/vitehub/references/primitives/workflow.md +0 -11
  293. package/dist/skills/vitehub/references/primitives/workspace.md +0 -11
  294. package/dist/skills/vitehub/references/project-patterns.md +0 -19
  295. package/dist/skills/vitehub/references/project-shapes.md +0 -81
  296. package/dist/skills/vitehub/references/proof-recovery.md +0 -31
  297. package/dist/skills/vitehub/references/sandboxes-hosts.md +0 -26
  298. package/dist/skills/vitehub/references/schedules-workflows-invocations.md +0 -28
  299. package/dist/skills/vitehub/references/server-primitives.md +0 -39
  300. package/dist/skills/vitehub/references/workspaces-sources-access.md +0 -26
  301. package/dist/ticket-BFWwevWN.d.ts +0 -12
  302. package/dist/ticket-BwsnryuU.js +0 -30
  303. package/dist/tickets-Cj9_y3gw.js +0 -356
  304. package/dist/usage-BduF04ks.d.ts +0 -20
  305. package/dist/usage-ZV3TBMzE.js +0 -570
  306. package/dist/usage-index-CR_xTrXO.js +0 -334
  307. /package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.d.ts +0 -0
  308. /package/dist/{console/runtime/server → agent/console}/invocations.get.d.ts +0 -0
  309. /package/dist/{console/runtime/public/skills → console-skills}/index.json +0 -0
  310. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/SKILL.md +0 -0
  311. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/agents/openai.yaml +0 -0
  312. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/agent-definitions.md +0 -0
  313. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/bundle.md +0 -0
  314. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/capabilities-authority.md +0 -0
  315. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/channels-triggers.md +0 -0
  316. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/framework-composition.md +0 -0
  317. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/preview-contract.md +0 -0
  318. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/auth.md +0 -0
  319. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/blob.md +0 -0
  320. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/browser.md +0 -0
  321. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/cache.md +0 -0
  322. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/channels.md +0 -0
  323. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/connections.md +0 -0
  324. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/content.md +0 -0
  325. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/database.md +0 -0
  326. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/email.md +0 -0
  327. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/env.md +0 -0
  328. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/kv.md +0 -0
  329. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/markdown-template.md +0 -0
  330. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/queue.md +0 -0
  331. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/rate-limit.md +0 -0
  332. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/realtime.md +0 -0
  333. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/sandbox-task.md +0 -0
  334. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/sandbox.md +0 -0
  335. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/schedule.md +0 -0
  336. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/shell.md +0 -0
  337. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/source.md +0 -0
  338. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/workflow.md +0 -0
  339. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/workspace.md +0 -0
  340. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/project-patterns.md +0 -0
  341. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/project-shapes.md +0 -0
  342. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/proof-recovery.md +0 -0
  343. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/sandboxes-hosts.md +0 -0
  344. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/schedules-workflows-invocations.md +0 -0
  345. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/server-primitives.md +0 -0
  346. /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/workspaces-sources-access.md +0 -0
@@ -3,23 +3,24 @@ import { n as invariantError, t as invariant } from "./invariant-Dj2R1eMr.js";
3
3
  import { a as features, i as featureSupport } from "./features-BXRKlmtN.js";
4
4
  import { n as isRecord$1, r as isRecordOrFunction, t as cloneRecord } from "./object-DRSmpe04.js";
5
5
  import { t as viteHubErrorDiagnostics } from "./error-diagnostics-CBtvqI30.js";
6
- import { a as installCommandArguments, c as optionalFeaturePackages, d as unsupportedPeerPackagesError, i as importOptionalOwner, l as requireOptionalOwner, n as forgetPackageChecks, o as isPackageInstalled, r as hostFeaturePackages, s as isPackageInstalledInApp, t as assertFeaturePackages } from "./optional-owners-DAfShdgV.js";
6
+ import { a as installCommandArguments, c as optionalFeaturePackages, d as unsupportedPeerPackagesError, i as importOptionalOwner, l as requireOptionalOwner, n as forgetPackageChecks, o as isPackageInstalled, r as hostFeaturePackages, s as isPackageInstalledInApp, t as assertFeaturePackages } from "./optional-owners-Cypch7V3.js";
7
7
  import { n as relative$1, r as resolve$1, t as dirname$1 } from "./pathe.M-eThtNZ-D4EC7Wue.js";
8
8
  import { n as redactInspectionText, r as summarizeDefinitions, t as collectViteHubResourceSummaries } from "./inspect-CWwAuL-B.js";
9
9
  import { t as internalErrorDiagnostics } from "./error-diagnostics-kKXseq8d.js";
10
10
  import { i as removeViteHubDevServerFile, o as writeViteHubDevServerFile, r as readViteHubDevServerFile, t as loadAllEnv } from "./vite-stage-Dmo4RgnK.js";
11
- import { D as resolveConsoleSectionIds, b as isConsoleMcpClientEnabled, v as insertConsoleSection } from "./sections-BiCOk9qP.js";
11
+ import { E as resolveConsoleSectionIds, v as insertConsoleSection } from "./sections-AUGy9EkY.js";
12
12
  import { n as callOperationRpc, r as operationRpcPath } from "./operation-rpc-BMdfapja.js";
13
- import { n as addViteHubDevPeerUpgradeSigner, o as consolePublicKeyPrefix, r as isViteHubLoopbackAddress, t as addViteHubDevPeerDevHandler } from "./dev-peer-DBq-isgi.js";
14
- import { a as createOperationRegistry, i as collectOperationContributions, p as operationsOf } from "./operations-CD_mu_Ww.js";
15
- import { a as exports, n as assertNoRemovedViteHubOptions, t as readViteHubVersion } from "./version-CAhBr673.js";
13
+ import { n as consolePublicKeyPrefix } from "./console-signature--55DIKf2.js";
14
+ import { a as createOperationRegistry, i as collectOperationContributions, p as operationsOf } from "./operations-DksTrRMb.js";
15
+ import { a as exports, n as assertNoRemovedViteHubOptions, t as readViteHubVersion } from "./version-DUCd7Orc.js";
16
16
  import { _ as moduleLanguage, f as scanModule, v as walk } from "./scan-module-BfZvDBxb.js";
17
+ import { a as ownModule, i as createImportPath, n as loadConsoleOperations, r as generatedModules, t as consoleOperationModules } from "./operation-modules-DHWkPcfS.js";
17
18
  import { a as normalizeNitroPreset, c as resolveDeploymentPlan, i as hostFromNitroPreset, r as findProviderHostConflict, s as resolveBuildHost, t as assertDeploymentService } from "./deployment-CURATxjG.js";
18
19
  import { f as writeFileIfChanged$1, l as normalizePathDefinitionName, n as discoverDefinitions, r as hasDefinitionFiles, t as createDirectoryDefinitionSource } from "./definition-catalog-1xPPtzOx.js";
19
20
  import { n as evlogBridgeKey, t as browserErrorMaxBytes } from "./browser-error-limits-B0yS95zt.js";
20
21
  import { t as renderServedSkillsRegistryPlugin } from "./registry-B8JE5NY-.js";
21
- import { i as viteHubPageToolsAssets, n as viteHubBasePath, r as viteHubPageSessionPath } from "./page-tools-shared-hJcG_xk8.js";
22
- import { n as isViteHubSecretEqual } from "./secret-D2KL_o2h.js";
22
+ import { t as viteHubBasePath } from "./page-tools-shared-BLPidmCi.js";
23
+ import { i as isViteHubLoopbackAddress, n as addViteHubDevPeerUpgradeSigner, t as addViteHubDevPeerDevHandler } from "./dev-peer-CRYp01PE.js";
23
24
  import { t as githubAuthorLogin } from "./github-login-W-vaahWP.js";
24
25
  import { t as renderTaskRegistryPlugin } from "./registry-CnPC-gNu.js";
25
26
  import { builtinModules, createRequire, findPackageJSON, isBuiltin } from "node:module";
@@ -34,9 +35,9 @@ import { tmpdir } from "node:os";
34
35
  import { isRuntimeDiagnostic } from "@vite-hub/runtime";
35
36
  import { parseJSONC } from "confbox/jsonc";
36
37
  import { describeServerEnv } from "@vite-hub/env/server";
38
+ import { env, hubEnv } from "@vite-hub/env/vite";
37
39
  import { findContentEntry, hubSource, prepareSourceGeneration, toRuntimeModuleSpecifier } from "@vite-hub/source/vite";
38
40
  import { defaultServerConditions, loadEnv, mergeConfig, parseAst } from "vite";
39
- import { env, hubEnv } from "@vite-hub/env/vite";
40
41
  import { hubBundle } from "@vite-hub/bundle/vite";
41
42
  import { createHash, randomUUID } from "node:crypto";
42
43
  import { readInstanceCount, sqliteUrlInput } from "@vite-hub/runtime/durability";
@@ -128,7 +129,7 @@ function loadNativePackageModule(id) {
128
129
  }
129
130
  function reexportNativeModule(file) {
130
131
  const url = JSON.stringify(pathToFileURL(realpathSync(file)).href);
131
- const hasDefault = /\bexport default\b|\bas default\b/.test(readFileSync(file, "utf8"));
132
+ const hasDefault = /^export\s+default\b|^export\s*\{[^}]*\bdefault\s*[,}]/m.test(readFileSync(file, "utf8"));
132
133
  const native = JSON.stringify(`data:text/javascript,${encodeURIComponent(`export * from ${url}${hasDefault ? `\nexport { default } from ${url}` : ""}`)}`);
133
134
  return `export * from ${native}\n${hasDefault ? `export { default } from ${native}\n` : ""}`;
134
135
  }
@@ -1458,7 +1459,11 @@ const encodedAliasExactMarker = "\0vitehub-exact:";
1458
1459
  /** Select the runtime constants from one resolved Vite configuration. */
1459
1460
  function resolveViteHubBundleDefines(config) {
1460
1461
  const defines = {};
1461
- for (const name of ["__VITEHUB_PUBLIC_URL__", "__VITEHUB_APP_BASE_URL__"]) {
1462
+ for (const name of [
1463
+ "__VITEHUB_PUBLIC_URL__",
1464
+ "__VITEHUB_APP_BASE_URL__",
1465
+ "__VITEHUB_CONSOLE_URL__"
1466
+ ]) {
1462
1467
  const value = config.define?.[name];
1463
1468
  if (typeof value === "string") defines[name] = value;
1464
1469
  }
@@ -1848,20 +1853,20 @@ function createFileUrlPlugin() {
1848
1853
  }
1849
1854
  };
1850
1855
  }
1851
- /**
1852
- * Copies a `.wasm?module` import next to the bundle and keeps it as a relative `.wasm` import. Wrangler and Nitro load
1853
- * such an import as a compiled WebAssembly module, which Workers need because they can't compile WebAssembly bytes.
1854
- * Node.js compiles WebAssembly bytes, so there the import becomes the bytes of the file.
1855
- */
1856
1856
  function createWasmModulePlugin(outdir, workingDir, copy) {
1857
1857
  return {
1858
1858
  name: "vitehub-wasm-module",
1859
1859
  async resolveId(source, importer, extra) {
1860
- if (!source.endsWith(".wasm?module")) return;
1861
- const resolved = await this.resolve(source.slice(0, -7), importerFor(importer, workingDir), {
1860
+ const explicitModule = source.endsWith(".wasm?module");
1861
+ if (!explicitModule && (!copy || !source.endsWith(".wasm") || extra.custom?.[skipMarkdownTemplateResolve])) return;
1862
+ const path = explicitModule ? source.slice(0, -7) : source;
1863
+ const resolved = await this.resolve(path, importerFor(importer, workingDir), {
1862
1864
  custom: extra.custom,
1863
- kind: extra.kind
1865
+ isEntry: extra.isEntry,
1866
+ kind: extra.kind,
1867
+ skipSelf: true
1864
1868
  });
1869
+ if (!explicitModule && (!isFileResolution(resolved) || !resolved.id.endsWith(".wasm"))) return resolved ?? void 0;
1865
1870
  if (!isFileResolution(resolved)) this.error(`[vitehub] Could not resolve ${JSON.stringify(source)}.`);
1866
1871
  if (!copy) return resolved.id;
1867
1872
  const bytes = await readFile(resolved.id);
@@ -2079,46 +2084,6 @@ async function bundleEsmEntry(entryFile, outfile, options = {}) {
2079
2084
  await writeFile(outfile, chunk.code, { signal: options.signal });
2080
2085
  options.signal?.throwIfAborted();
2081
2086
  }
2082
- // ../internal/src/build/paths.ts
2083
- function resolveRuntimeModule(packageDir, modulePath) {
2084
- const distFile = resolve$1(packageDir, "dist", `${modulePath}.js`);
2085
- return existsSync(distFile) ? distFile : resolve$1(packageDir, "src", `${modulePath}.ts`);
2086
- }
2087
- const packageDirs = /* @__PURE__ */ new Map();
2088
- function findPackageDir(file) {
2089
- const start = dirname$1(file);
2090
- const cached = packageDirs.get(start);
2091
- if (cached) return cached;
2092
- let dir = start;
2093
- while (!existsSync(resolve$1(dir, "package.json"))) {
2094
- const parent = dirname$1(dir);
2095
- invariant(parent !== dir, `a file that a package resolver found has a package.json above it (${file})`);
2096
- dir = parent;
2097
- }
2098
- packageDirs.set(start, dir);
2099
- return dir;
2100
- }
2101
- /**
2102
- * The absolute path of a module that the calling package builds, such as `ownModule(import.meta.url, "runtime/state")`.
2103
- * Owner plugins write this path into generated code, so the module needs no package export, and an app resolves it
2104
- * only when the owner's feature is on. It is the `dist` file, or the `src` file before the package is built.
2105
- */
2106
- function ownModule(importMetaUrl, modulePath) {
2107
- return resolveRuntimeModule(findPackageDir(fileURLToPath(importMetaUrl)), modulePath);
2108
- }
2109
- function createImportPath(fromFile, targetFile) {
2110
- const fromDir = realpathIfExists(dirname$1(fromFile));
2111
- const target = realpathIfExists(targetFile);
2112
- const importPath = relative$1(fromDir, target);
2113
- return importPath.startsWith(".") ? importPath : `./${importPath}`;
2114
- }
2115
- function realpathIfExists(path) {
2116
- try {
2117
- return realpathSync.native(path);
2118
- } catch {
2119
- return resolve$1(path);
2120
- }
2121
- }
2122
2087
  // ../../node_modules/.pnpm/balanced-match@4.0.4/node_modules/balanced-match/dist/esm/index.js
2123
2088
  const balanced = (a, b, str) => {
2124
2089
  const ma = a instanceof RegExp ? maybeMatch(a, str) : a;
@@ -8065,27 +8030,6 @@ function hasRedisStore(kv) {
8065
8030
  if (!kv) return false;
8066
8031
  return Object.values(kv.stores || { default: kv.store }).some((store) => store.driver === "redis");
8067
8032
  }
8068
- // src/internal/generated-modules.ts
8069
- /**
8070
- * Modules of this package that only generated code imports. Generated code imports each one by its absolute path, so
8071
- * each is a build entry and not a package export.
8072
- */
8073
- const generatedModules = {
8074
- commentsRealtime: ownModule(import.meta.url, "comments/realtime"),
8075
- commentsRuntimeAuth: ownModule(import.meta.url, "comments/runtime/auth"),
8076
- connectionsAgent: ownModule(import.meta.url, "connections/agent"),
8077
- consoleBlob: ownModule(import.meta.url, "console/runtime/server/blob"),
8078
- consoleDatabase: ownModule(import.meta.url, "console/runtime/server/database"),
8079
- consoleDefinitions: ownModule(import.meta.url, "console/runtime/server/definitions"),
8080
- consoleDocuments: ownModule(import.meta.url, "console/runtime/server/documents"),
8081
- consoleEnv: ownModule(import.meta.url, "console/runtime/server/env"),
8082
- consoleOperations: ownModule(import.meta.url, "console/runtime/server/operation-contributions"),
8083
- consolePageAuth: ownModule(import.meta.url, "console/runtime/server/page-auth"),
8084
- consolePageTool: ownModule(import.meta.url, "console/runtime/server/page-tool"),
8085
- consoleSections: ownModule(import.meta.url, "console/runtime/server/sections"),
8086
- consoleSetup: ownModule(import.meta.url, "console/runtime/server/setup"),
8087
- consoleSiteSession: ownModule(import.meta.url, "console/runtime/server/site-session")
8088
- };
8089
8033
  // ../internal/src/forge.ts
8090
8034
  /**
8091
8035
  * Server Env of each Forge, keyed by the `env.server.<forge>.<field>` path.
@@ -8224,14 +8168,7 @@ async function flattenPluginOptions(plugins) {
8224
8168
  return flattened;
8225
8169
  }
8226
8170
  Object.freeze({ vitehubAuthAccess: "handler" });
8227
- /**
8228
- * The route meta of a generated handler that checks access on every request, even when the app adds no rule: a required
8229
- * `authorize` policy, an explicit `access` rule, a required access token, or a signature. Auth access routes still apply
8230
- * to it, so an app rule stays in force. `checksOwnAccess(event)` of `vite-hub/auth` reads it, so app middleware can skip
8231
- * the route. A route that can run without a check, such as a browser error sink, an optional `authorize`, or a webhook
8232
- * with `secret: false`, must not use it.
8233
- */
8234
- const ownAccessRouteMeta = Object.freeze({ vitehubOwnAccess: true });
8171
+ Object.freeze({ vitehubOwnAccess: true });
8235
8172
  function cloneArray(value) {
8236
8173
  return Array.isArray(value) ? [...value] : [];
8237
8174
  }
@@ -8569,6 +8506,7 @@ const viteHubRuntimeDefines = [
8569
8506
  "__VITEHUB_APP_BASE_URL__",
8570
8507
  "__VITEHUB_AUTH_APP_BASE_URL__",
8571
8508
  "__VITEHUB_AUTH_DEV__",
8509
+ "__VITEHUB_CONSOLE_URL__",
8572
8510
  "__VITEHUB_PRESETS_BUILD_REVISION__",
8573
8511
  "__VITEHUB_PUBLIC_URL__"
8574
8512
  ];
@@ -10583,9 +10521,9 @@ function withConsoleDocumentEditorSections(sections, catalog) {
10583
10521
  * and checked again when the app starts.
10584
10522
  */
10585
10523
  async function assertUniqueOperationNames(contributions) {
10586
- const { consoleOperations } = await import("./operations-D7ENc68Y.js");
10524
+ const { loadConsoleOperations } = await import("./operation-modules-BUXlwjvd.js");
10587
10525
  const sources = [{
10588
- operations: [...consoleOperations],
10526
+ operations: await loadConsoleOperations(),
10589
10527
  plugin: "vite-hub"
10590
10528
  }];
10591
10529
  for (const contribution of contributions) try {
@@ -10734,29 +10672,6 @@ function operationsCheckPlugin() {
10734
10672
  };
10735
10673
  }
10736
10674
  // ../internal/src/build/page-tools.ts
10737
- /**
10738
- * Adds the session route `GET <mount>/_vitehub/page/tools` and the loader script at
10739
- * `<mount>/_vitehub/page/assets/loader.js` to a Nitro configuration. Each owner package of a page tool calls it from its
10740
- * Vite plugin, so the routes exist without the Console. The first owner wins: a later call keeps the route and the asset
10741
- * that are already there, because the page tools registry is shared by every copy of this package.
10742
- */
10743
- function addViteHubPageToolRoutes(kit, options) {
10744
- const mount = options.mount ?? "";
10745
- const route = `${mount}${viteHubPageSessionPath}`;
10746
- const assetsBase = `${mount}${viteHubPageToolsAssets}`;
10747
- if (!(Array.isArray(kit.config.handlers) ? kit.config.handlers : []).some((handler) => Object(handler) === handler && Reflect.get(Object(handler), "route") === route)) kit.addHandler({
10748
- handler: options.handler,
10749
- meta: { ...ownAccessRouteMeta },
10750
- route
10751
- });
10752
- const assets = Array.isArray(kit.config.publicAssets) ? [...kit.config.publicAssets] : [];
10753
- if (!assets.some((asset) => Object(asset) === asset && Reflect.get(Object(asset), "baseURL") === assetsBase)) assets.push({
10754
- baseURL: assetsBase,
10755
- dir: options.loader,
10756
- maxAge: 300
10757
- });
10758
- kit.config.publicAssets = assets;
10759
- }
10760
10675
  function readString(value, key) {
10761
10676
  const field = value !== null && typeof value === "object" ? Reflect.get(value, key) : void 0;
10762
10677
  return typeof field === "string" ? field : void 0;
@@ -10783,6 +10698,21 @@ function viteHubPageToolsBase(config, env = process.env) {
10783
10698
  mount: nitroBase && (base === nitroBase || base.startsWith(`${nitroBase}/`)) ? base.slice(nitroBase.length) : base
10784
10699
  };
10785
10700
  }
10701
+ // ../internal/src/secret.ts
10702
+ const secretEncoder = new TextEncoder();
10703
+ /**
10704
+ * Compares a request value with an expected secret in constant time for the length of `expected`. Returns `false`
10705
+ * when either value is missing or empty. It uses no Node API, so it also runs in Worker runtimes.
10706
+ */
10707
+ function isViteHubSecretEqual(actual, expected) {
10708
+ if (!actual || !expected) return false;
10709
+ const left = secretEncoder.encode(actual);
10710
+ const right = secretEncoder.encode(expected);
10711
+ let difference = left.length ^ right.length;
10712
+ for (let index = 0; index < right.length; index += 1) difference |= (left[index] ?? 0) ^ right[index];
10713
+ return difference === 0;
10714
+ }
10715
+ Object.freeze({ prefix: "sha256=" });
10786
10716
  // ../internal/src/dev-endpoint.ts
10787
10717
  function firstHeader(value) {
10788
10718
  return Array.isArray(value) ? value[0] : value;
@@ -11449,7 +11379,7 @@ async function collectConsoleBuild(options) {
11449
11379
  };
11450
11380
  }
11451
11381
  const collected = /* @__PURE__ */ new Map();
11452
- /** The build facts of a project, collected once per process, so each write of the generated plugin names the same build. */
11382
+ /** The build facts of a project, collected once per process, so each write of the generated Console app module names the same build. */
11453
11383
  function consoleBuildOf(projectRoot) {
11454
11384
  let build = collected.get(projectRoot);
11455
11385
  if (!build) collected.set(projectRoot, build = collectConsoleBuild({ cwd: projectRoot }));
@@ -11467,15 +11397,13 @@ function resolveConsoleProjectName(projectRoot, name) {
11467
11397
  } catch {}
11468
11398
  return basename(projectRoot);
11469
11399
  }
11470
- // src/console/plugin.ts
11400
+ // src/console/app-module.ts
11471
11401
  function resolveConsoleRuntimeRoot() {
11472
11402
  const root = [fileURLToPath(new URL("./runtime", import.meta.url)), fileURLToPath(new URL("./console/runtime", import.meta.url))].find((root) => ["rpc.ts", "rpc.js"].some((file) => existsSync(join(root, "server", file))));
11473
11403
  if (!root) throw viteHubErrorDiagnostics.VITE_HUB_B0001({ message: "[vitehub] Could not locate the packaged Console runtime." });
11474
11404
  return root;
11475
11405
  }
11476
11406
  const consoleRuntimeRoot = resolveConsoleRuntimeRoot();
11477
- /** The ViteHub skill and its well-known index, which the Console serves at `/_vitehub/.well-known/skills`. */
11478
- const consoleSkillsRoot = join(consoleRuntimeRoot, "public/skills");
11479
11407
  const consoleRuntimeCapabilityImports = [
11480
11408
  {
11481
11409
  exportName: "blob",
@@ -11510,7 +11438,17 @@ const consoleRuntimeCapabilityImports = [
11510
11438
  name: "kv"
11511
11439
  }
11512
11440
  ];
11513
- /** The Agent capabilities of a Console invocation. They load with the first invocation, not when the server starts. */
11441
+ function resolveConsoleRuntimeCapabilityImports(imports, plugins) {
11442
+ if (!plugins) return imports;
11443
+ return {
11444
+ ...imports,
11445
+ ...!imports?.email && plugins.some((plugin) => plugin.name === "@vite-hub/email/vite") ? { email: "vite-hub/email" } : {},
11446
+ ...!imports?.realtime && plugins.some((plugin) => plugin.name === "@vite-hub/realtime/vite") ? { realtime: "vite-hub/realtime/agent" } : {}
11447
+ };
11448
+ }
11449
+ function renderPickedImport(module, bindings) {
11450
+ return `import(${JSON.stringify(module)}).then(({ ${bindings} }) => ({ ${bindings} }))`;
11451
+ }
11514
11452
  function renderConsoleRuntimeCapabilities(imports) {
11515
11453
  if (!imports) return void 0;
11516
11454
  const capabilities = consoleRuntimeCapabilityImports.flatMap(({ exportName, name }) => {
@@ -11524,7 +11462,7 @@ function renderConsoleRuntimeCapabilities(imports) {
11524
11462
  }];
11525
11463
  });
11526
11464
  if (!capabilities.length) return void 0;
11527
- return `capabilities: async () => { const [${capabilities.map(({ alias, exportName }) => `{ ${exportName}: ${alias} }`).join(", ")}] = await Promise.all([${capabilities.map(({ module }) => `import(${JSON.stringify(module)})`).join(", ")}]); return { ${capabilities.map(({ alias, name }) => `${name}: ${alias}`).join(", ")} } }`;
11465
+ return `capabilities: async () => { const [${capabilities.map(({ alias, exportName }) => `{ ${exportName}: ${alias} }`).join(", ")}] = await Promise.all([${capabilities.map(({ exportName, module }) => renderPickedImport(module, exportName)).join(", ")}]); return { ${capabilities.map(({ alias, name }) => `${name}: ${alias}`).join(", ")} } }`;
11528
11466
  }
11529
11467
  function renderConsoleAccess(access) {
11530
11468
  if (!access) return {
@@ -11543,18 +11481,23 @@ function renderConsoleAccess(access) {
11543
11481
  install: [`installConsoleAccess({ ${fields.join(", ")} })`]
11544
11482
  };
11545
11483
  }
11546
- /** The URL of the Console page tool script below the app base. Its version query changes when the script changes. */
11547
- const consolePageToolScript = "/_vitehub/console/assets/page-tool.js?v=2";
11548
- function renderConsolePageTool(pageTool, auth) {
11549
- if (!pageTool) return "export default function viteHubConsolePlugin() {}";
11550
- const user = auth ? `, user: async request => (await import(${JSON.stringify(generatedModules.consolePageAuth)})).consolePageAuthUser(request)` : `, site: async request => (await import(${JSON.stringify(generatedModules.consoleSiteSession)})).readConsoleSiteVisitor(request)`;
11551
- return `export default function viteHubConsolePlugin(nitroApp) { installConsolePageTool(nitroApp, { base: ${JSON.stringify(pageTool.base)}, script: ${JSON.stringify(consolePageToolScript)}${user} }) }`;
11484
+ function consoleAppModuleSections({ access, catalog, sections, site = false }) {
11485
+ return withConsoleDocumentEditorSections(site ? [...sections, "site"] : sections, catalog).filter((section) => !access?.hiddenSections?.includes(section));
11486
+ }
11487
+ /** Whether the generated Console app module registers a document editor, which turns on `import.meta.viteHubConsoleDocuments`. */
11488
+ function consoleAppModuleHasDocumentEditors(options) {
11489
+ return describeConsoleDocumentEditors(consoleAppModuleSections(options), options.catalog.documents ?? {}).length > 0;
11552
11490
  }
11553
- function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSections, navigationSections, catalog, blobStores, invoke = false, access, runtimeCapabilityImports, development = false, pageTool }, build) {
11491
+ function renderConsoleAppModule({ projectRoot, name, sections: configuredSections, operationSections = configuredSections, navigationSections, catalog, blobStores, invoke = false, access, runtimeCapabilityImports, development = false, site = false }, build) {
11554
11492
  const agents = catalog.agents;
11555
11493
  const accessCode = renderConsoleAccess(access);
11556
11494
  const operations = catalog.operations ?? [];
11557
- const sections = withConsoleDocumentEditorSections(pageTool ? [...configuredSections, "site"] : configuredSections, catalog).filter((section) => !access?.hiddenSections?.includes(section));
11495
+ const sections = consoleAppModuleSections({
11496
+ access,
11497
+ catalog,
11498
+ sections: configuredSections,
11499
+ site
11500
+ });
11558
11501
  const documentEditors = describeConsoleDocumentEditors(sections, catalog.documents ?? {});
11559
11502
  const runtimeCapabilities = renderConsoleRuntimeCapabilities(runtimeCapabilityImports);
11560
11503
  const agentSkills = agents.map((agent) => requireOptionalOwner(ownerModules.agentVite, "agent").readColocatedAgentSkills(agent.handler));
@@ -11566,10 +11509,6 @@ function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSecti
11566
11509
  const agentsEnabled = sections.includes("agents");
11567
11510
  const blobEnabled = sections.includes("blob");
11568
11511
  const databaseEnabled = sections.includes("databases");
11569
- const databaseNames = catalog.content.databases?.kind === "definition-catalog" ? catalog.content.databases.definitions.map((definition) => definition.name) : [];
11570
- const siteDatabaseEnabled = !development && sections.includes("site") && configuredSections.includes("databases");
11571
- const firstDatabase = databaseNames.includes("default") ? "default" : [...databaseNames].sort((left, right) => left.localeCompare(right))[0];
11572
- const mcpClientEnabled = sections.includes("mcp-client");
11573
11512
  const schedulesEnabled = sections.includes("schedules");
11574
11513
  const runnableSchedules = (invoke ? catalog.manualSchedules ?? [] : []).map((schedule) => ` [${JSON.stringify(schedule.name)}]: () => import(${JSON.stringify(pathToFileURL(schedule.handler).href)}),`).join("").replace(/,$/, " ");
11575
11514
  const registered = new Map(describeConsoleContributedSections(sections).map((section) => [section.id, section]));
@@ -11579,19 +11518,28 @@ function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSecti
11579
11518
  });
11580
11519
  const runtimeReaders = describeConsoleRuntimeReaders(sections).filter((reader) => catalog.sectionOverrides?.[reader.section]?.view.kind !== "operation-view");
11581
11520
  const definitionsEnabled = databaseEnabled || contributedSections.length > 0;
11521
+ const ownOperations = consoleOperationModules.filter((entry) => entry.enabled({
11522
+ documents: documentEditors.length > 0,
11523
+ sections: operationSections,
11524
+ site: sections.includes("site")
11525
+ })).map((entry, index) => ({
11526
+ binding: `vitehubConsoleOwnOperations${index}`,
11527
+ entry
11528
+ }));
11529
+ const agentRealtime = ownOperations.some(({ entry }) => entry.module === generatedModules.consoleAgentOperations) ? runtimeCapabilityImports?.realtime : void 0;
11582
11530
  const runtimeImports = [
11583
11531
  {
11584
11532
  bindings: "installConsoleOperations",
11585
11533
  module: generatedModules.consoleOperations
11586
11534
  },
11535
+ ...ownOperations.map(({ binding, entry }) => ({
11536
+ bindings: `${entry.export}: ${binding}${agentRealtime && entry.module === generatedModules.consoleAgentOperations ? ", installConsoleAgentRealtime" : ""}`,
11537
+ module: entry.module
11538
+ })),
11587
11539
  ...operations.map((operation, index) => ({
11588
11540
  bindings: `${operation.export}: vitehubConsoleOperations${index}`,
11589
11541
  module: operation.module
11590
11542
  })),
11591
- ...mcpClientEnabled ? [{
11592
- bindings: "consoleMcpClientOperations: vitehubConsoleMcpClientOperations",
11593
- module: "vite-hub/console/mcp-client"
11594
- }] : [],
11595
11543
  ...blobEnabled ? [{
11596
11544
  bindings: "installConsoleBlob",
11597
11545
  module: generatedModules.consoleBlob
@@ -11637,24 +11585,23 @@ function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSecti
11637
11585
  const runtimeInstall = [
11638
11586
  ...blobEnabled ? [`installConsoleBlob(${JSON.stringify(projectRoot)}, vitehubConsoleBlob, ${JSON.stringify(blobStores)})`] : [],
11639
11587
  ...sections.includes("env") ? [`installConsoleEnv(${JSON.stringify(projectRoot)}, describeServerEnv())`] : [],
11640
- `installConsoleOperations([${[...mcpClientEnabled ? ["{ operations: vitehubConsoleMcpClientOperations, plugin: \"vite-hub\" }"] : [], ...operations.map((operation, index) => `{ operations: vitehubConsoleOperations${index}, plugin: ${JSON.stringify(operation.plugin)} }`)].join(", ")}], { invoke: ${invoke} })`,
11588
+ ...agentRealtime ? [`installConsoleAgentRealtime(() => import(${JSON.stringify(agentRealtime)}))`] : [],
11589
+ `installConsoleOperations([${[...ownOperations.map(({ binding }) => `{ operations: ${binding}, plugin: "vite-hub" }`), ...operations.map((operation, index) => `{ operations: vitehubConsoleOperations${index}, plugin: ${JSON.stringify(operation.plugin)} }`)].join(", ")}], { invoke: ${invoke} })`,
11641
11590
  ...definitionsEnabled ? [`installConsoleDefinitions(${JSON.stringify(projectRoot)}, ${JSON.stringify(catalog.content)}, ${JSON.stringify(contributedSections)}${runtimeReaders.length ? `, { ${runtimeReaders.map((reader, index) => `${JSON.stringify(reader.section)}: vitehubConsoleRuntimeReader${index}`).join(", ")} }` : ""})`] : [],
11642
11591
  ...schedulesEnabled ? [`installConsoleSchedules(${JSON.stringify(projectRoot)}, {${runnableSchedules}})`] : [],
11643
- ...databaseEnabled ? [`installConsoleDatabase(${JSON.stringify(projectRoot)}, vitehubConsoleDatabases, ${JSON.stringify(databaseNames)})`] : [],
11592
+ ...databaseEnabled ? [`installConsoleDatabase(${JSON.stringify(projectRoot)}, vitehubConsoleDatabases, ${JSON.stringify(catalog.content.databases?.kind === "definition-catalog" ? catalog.content.databases.definitions.map((definition) => definition.name) : [])})`] : [],
11644
11593
  ...agentsEnabled ? [`installConsoleAgentDefinitions([${definitions}], { projectRoot: ${JSON.stringify(projectRoot)}${invoke ? ", invoke: true" : ""}${runtimeCapabilities ? `, ${runtimeCapabilities}` : ""} })`] : []
11645
11594
  ];
11646
11595
  return [
11647
- `import { ${access ? "installConsoleAccess, " : ""}${build ? "installConsoleBuild, " : ""}installConsoleDevelopment, installConsoleProjectName, installConsoleRuntime, installConsoleSections, ${siteDatabaseEnabled ? "installConsoleSiteDatabase, " : ""}installConsoleVersion } from ${JSON.stringify(generatedModules.consoleSetup)}`,
11596
+ `import { ${access ? "installConsoleAccess, " : ""}${build ? "installConsoleBuild, " : ""}installConsoleDevelopment, installConsoleProjectName, installConsoleRuntime, installConsoleSections, installConsoleVersion } from ${JSON.stringify(generatedModules.consoleSetup)}`,
11648
11597
  ...accessCode.imports,
11649
- ...pageTool ? [`import { installConsolePageTool } from ${JSON.stringify(generatedModules.consolePageTool)}`] : [],
11650
11598
  ...documentEditors.length ? [`import { installConsoleDocuments } from ${JSON.stringify(generatedModules.consoleDocuments)}`] : [],
11651
11599
  ...documentEditors.map((editor, index) => `import { ${editor.export} as vitehubConsoleDocumentActions${index} } from ${JSON.stringify(editor.module)}`),
11652
11600
  `installConsoleDevelopment(${JSON.stringify(projectRoot)}, ${JSON.stringify(development)}${development && sections.includes("setup") ? `, ${JSON.stringify(setupDevRoute)}` : ""})`,
11653
11601
  ...accessCode.install,
11654
11602
  `installConsoleSections(${JSON.stringify(projectRoot)}, ${JSON.stringify(sections)}${navigationSections ? `, ${JSON.stringify(navigationSections)}` : ""})`,
11655
- ...siteDatabaseEnabled ? [`installConsoleSiteDatabase(async () => (await import("@vite-hub/database/runtime/registry")).databases${firstDatabase === void 0 ? "" : `, ${JSON.stringify(firstDatabase)}`})`] : [],
11656
11603
  `installConsoleRuntime(async () => {`,
11657
- ` const [${[...runtimeImports.map((entry) => `{ ${entry.bindings} }`), ...agentModules.map((entry) => entry.binding)].join(", ")}] = await Promise.all([${[...runtimeImports, ...agentModules].map((entry) => `import(${JSON.stringify(entry.module)})`).join(", ")}])`,
11604
+ ` const [${[...runtimeImports.map((entry) => `{ ${entry.bindings} }`), ...agentModules.map((entry) => entry.binding)].join(", ")}] = await Promise.all([${[...runtimeImports.map((entry) => renderPickedImport(entry.module, entry.bindings)), ...agentModules.map((entry) => `import(${JSON.stringify(entry.module)})`)].join(", ")}])`,
11658
11605
  " return () => {",
11659
11606
  ...runtimeInstall.map((line) => ` ${line}`),
11660
11607
  " }",
@@ -11663,15 +11610,14 @@ function renderConsoleNitroPlugin({ projectRoot, name, sections: configuredSecti
11663
11610
  `installConsoleVersion(${JSON.stringify(readViteHubVersion())})`,
11664
11611
  ...build ? [`installConsoleBuild(${JSON.stringify(build)})`] : [],
11665
11612
  ...documentEditors.length ? [`installConsoleDocuments(${JSON.stringify(projectRoot)}, { ${documentEditors.map((editor, index) => `${JSON.stringify(editor.section)}: { actions: vitehubConsoleDocumentActions${index}, load: () => import(${JSON.stringify(pathToFileURL(editor.entry).href)}) }`).join(", ")} })`] : [],
11666
- renderConsolePageTool(pageTool, configuredSections.includes("auth")),
11667
11613
  ""
11668
11614
  ].join("\n");
11669
11615
  }
11670
- /** Write the generated Console Nitro plugin. */
11671
- async function writeConsoleNitroPlugin(options) {
11616
+ /** Write the generated Console app module. */
11617
+ async function writeConsoleAppModule(options) {
11672
11618
  const { file, active = () => true } = options;
11673
11619
  if (!active()) return;
11674
- const contents = renderConsoleNitroPlugin(options, options.development ? void 0 : {
11620
+ const contents = renderConsoleAppModule(options, options.development ? void 0 : {
11675
11621
  ...await consoleBuildOf(options.projectRoot),
11676
11622
  ...options.target
11677
11623
  });
@@ -11699,44 +11645,6 @@ function mountPath(base, path) {
11699
11645
  * so an app route file on the same path keeps the app Auth access routes.
11700
11646
  */
11701
11647
  const consoleRouteMeta = { vitehubAuthAccess: "handler" };
11702
- /**
11703
- * Serves the ViteHub skill at `/_vitehub/.well-known/skills` for `npx skills add <app>/_vitehub`. The files are static and
11704
- * public, and match the installed `vite-hub` version. Nitro adds the application base to the path.
11705
- */
11706
- function addConsoleAppRoutes(nitro, consoleRuntimeRoot, base) {
11707
- const skills = join(consoleRuntimeRoot, "public/skills");
11708
- nitro.publicAssets = [{
11709
- baseURL: mountPath(base, "/_vitehub/.well-known/skills"),
11710
- dir: skills,
11711
- fallthrough: false
11712
- }, ...(nitro.publicAssets ?? []).filter((asset) => asset.dir !== skills)];
11713
- addConsolePageToolRoutes(nitro, consoleRuntimeRoot, viteHubBasePath(base));
11714
- }
11715
- /**
11716
- * Serves the script of the **Console** page tool at `<mount>/_vitehub/console/assets`, and the page tools session
11717
- * `GET <mount>/_vitehub/page/tools` with the loader at `<mount>/_vitehub/page/assets`, so the Console link works in
11718
- * an app without Comments. When Comments added the session and the loader first, they stay as they are. `mount` is the
11719
- * route prefix from `viteHubPageToolsBase()`, or empty when Nitro adds the app base, as with Nuxt.
11720
- */
11721
- function addConsolePageToolRoutes(nitro, consoleRuntimeRoot, mount = "") {
11722
- const script = join(consoleRuntimeRoot, "page-tool");
11723
- const loader = join(consoleRuntimeRoot, "page");
11724
- const handler = join(consoleRuntimeRoot, "server/page-tools-route.js");
11725
- nitro.handlers = (nitro.handlers ?? []).filter((candidate) => candidate.handler !== handler);
11726
- nitro.publicAssets = [...(nitro.publicAssets ?? []).filter((asset) => asset.dir !== script && asset.dir !== loader), {
11727
- baseURL: `${mount}/_vitehub/console/assets`,
11728
- dir: script,
11729
- maxAge: 300
11730
- }];
11731
- const kit = createNitroServerKit(nitro);
11732
- addViteHubPageToolRoutes(kit, {
11733
- handler,
11734
- loader,
11735
- mount
11736
- });
11737
- nitro.handlers = kit.config.handlers;
11738
- nitro.publicAssets = kit.config.publicAssets;
11739
- }
11740
11648
  const consoleRouteGuardName = "vite-hub/console-route-guard";
11741
11649
  /**
11742
11650
  * A Nitro module that refuses an app route file, such as `server/routes/_vitehub/rpc.post.ts`, on a Console route.
@@ -11749,85 +11657,95 @@ function consoleRouteGuard(routes) {
11749
11657
  name: consoleRouteGuardName,
11750
11658
  setup(nitro) {
11751
11659
  nitro.hooks.hook("build:before", () => {
11752
- const conflict = nitro.scannedHandlers.find((candidate) => !candidate.middleware && candidate.route !== void 0 && routes.includes(candidate.route));
11660
+ const conflict = nitro.scannedHandlers.find((candidate) => !candidate.middleware && candidate.route !== void 0 && routes.includes(withoutTrailingSlashes(candidate.route)));
11753
11661
  if (!conflict) return;
11754
11662
  throw viteHubErrorDiagnostics.VITE_HUB_R0040({ message: `Cannot mount the ViteHub Console handler at "${conflict.route}" because the app route "${conflict.handler}" uses that path. Move the app route to another path.` });
11755
11663
  });
11756
11664
  }
11757
11665
  };
11758
11666
  }
11667
+ function withoutTrailingSlashes(path) {
11668
+ return path.replace(/\/+$/, "");
11669
+ }
11759
11670
  function isConsoleRouteGuard(value) {
11760
11671
  return value instanceof Object && "name" in value && value.name === consoleRouteGuardName;
11761
11672
  }
11762
11673
  /**
11763
- * Add the Console routes of the app. The ViteHub Console and the CLI `POST` signed calls to `/_vitehub/rpc`, and a
11764
- * browser `GET`s it with a one-time ticket that an operation made, such as for impersonation or Content preview. A
11765
- * browser that opens `/_vitehub` or `/_vitehub/<page>` goes back to that page with the pill. See `server/site-entry.ts`.
11674
+ * Add the Console route of the app: lazy handlers under `<base>/_vitehub`. The ViteHub Console and the CLI `POST` signed
11675
+ * calls to `/_vitehub/rpc`. A browser that opens `/_vitehub` or `/_vitehub/<page>` goes to the page of the app with the
11676
+ * pill, or, in an app without Comments, to that page of the app in the ViteHub Console. See `server/site-entry.ts`.
11677
+ * `/_vitehub/site` takes the tokens of the Console: impersonation and Content preview in every app, and with
11678
+ * `siteAccess`, in an app with Comments, Site access. See `server/site.ts`.
11766
11679
  */
11767
- function addConsoleRpcHandler(nitro, consoleRuntimeRoot, base) {
11680
+ function addConsoleRpcHandler(nitro, consoleRuntimeRoot, base, options = {}) {
11768
11681
  const kit = createNitroServerKit(nitro);
11769
11682
  const handlers = kit.config.handlers;
11770
- const registrations = [
11771
- {
11772
- suffix: "/_vitehub/rpc",
11773
- handler: join(consoleRuntimeRoot, "server/rpc.js")
11774
- },
11775
- {
11776
- suffix: "/_vitehub",
11777
- handler: join(consoleRuntimeRoot, "server/site-entry.js")
11778
- },
11779
- {
11780
- suffix: "/_vitehub/**",
11781
- handler: join(consoleRuntimeRoot, "server/site-entry.js")
11782
- }
11683
+ const consoleEntry = join(consoleRuntimeRoot, "server/entry.js");
11684
+ const siteAccessEntry = join(consoleRuntimeRoot, "server/entry-site-access.js");
11685
+ const entries = [consoleEntry, siteAccessEntry];
11686
+ const handler = options.siteAccess ? siteAccessEntry : consoleEntry;
11687
+ const suffixes = [
11688
+ "/_vitehub/**",
11689
+ "/_vitehub",
11690
+ "/_vitehub/rpc",
11691
+ "/_vitehub/site"
11783
11692
  ];
11784
- const ownedHandlers = new Set(registrations.map((registration) => registration.handler));
11785
- const ownedSuffixes = registrations.map((registration) => registration.suffix);
11786
- const retainedHandlers = handlers.filter((candidate) => {
11787
- if (!ownedHandlers.has(candidate.handler)) return true;
11788
- const route = candidate.route;
11789
- return route !== void 0 && !ownedSuffixes.some((suffix) => route === suffix || route.endsWith(suffix));
11790
- });
11693
+ const retainedHandlers = handlers.filter((candidate) => !entries.includes(candidate.handler) || !suffixes.some((suffix) => candidate.route?.endsWith(suffix)));
11791
11694
  handlers.splice(0, handlers.length, ...retainedHandlers);
11792
- const routes = [];
11793
- for (const registration of registrations) {
11794
- const route = mountPath(base, registration.suffix);
11795
- routes.push(route);
11796
- const conflict = retainedHandlers.find((candidate) => candidate.route === route && candidate.handler !== registration.handler);
11797
- if (conflict) throw viteHubErrorDiagnostics.VITE_HUB_R0040({ message: `Cannot mount the ViteHub Console handler at "${route}" because that route already uses "${conflict.handler}".` });
11798
- const handler = {
11799
- handler: registration.handler,
11800
- route
11801
- };
11802
- handler.meta = { ...consoleRouteMeta };
11803
- handler.lazy = true;
11804
- kit.addHandler(handler, "end");
11805
- }
11695
+ const routes = suffixes.map((path) => mountPath(base, path));
11696
+ const taken = (path) => routes.includes(withoutTrailingSlashes(path));
11697
+ const conflict = retainedHandlers.find((candidate) => candidate.route !== void 0 && taken(candidate.route));
11698
+ if (conflict) throw viteHubErrorDiagnostics.VITE_HUB_R0040({ message: `Cannot mount the ViteHub Console handler at "${conflict.route}" because that route already uses "${conflict.handler}".` });
11699
+ const routeConflict = Object.keys(nitro.routes ?? {}).find(taken);
11700
+ if (routeConflict) throw viteHubErrorDiagnostics.VITE_HUB_R0040({ message: `Cannot mount the ViteHub Console handler at "${routeConflict}" because the Nitro routes option uses that path. Move the app route to another path.` });
11701
+ for (const route of routes) kit.addHandler({
11702
+ handler,
11703
+ lazy: true,
11704
+ meta: { ...consoleRouteMeta },
11705
+ route
11706
+ }, "end");
11707
+ const operationLoader = join(consoleRuntimeRoot, "operation-loader.js");
11708
+ nitro.plugins = [.../* @__PURE__ */ new Set([...nitro.plugins ?? [], operationLoader])];
11806
11709
  nitro.handlers = kit.config.handlers;
11807
11710
  nitro.modules = [...(nitro.modules ?? []).filter((module) => !isConsoleRouteGuard(module)), consoleRouteGuard(routes)];
11808
- const plugins = kit.config.plugins;
11809
- if (nitro.plugins) nitro.plugins.splice(0, nitro.plugins.length, ...plugins);
11810
- else nitro.plugins = plugins;
11711
+ }
11712
+ // src/console/site-access.ts
11713
+ /**
11714
+ * Whether the app has Site access: the Comments pill, which reads the person of the site cookie. Comments is on with
11715
+ * `server/comments.ts` or the `comments` option, and `overlay: false` leaves the pill out. Vite and Nuxt read this one
11716
+ * value for the `/_vitehub/site` route, the `/_vitehub/<page>` route, and the `site` section of the Console.
11717
+ */
11718
+ function resolveConsoleSiteAccess(comments, options) {
11719
+ const commentsVite = ownerModules.commentsVite;
11720
+ if (comments === false || !commentsVite) return false;
11721
+ if (typeof comments === "object" && comments.overlay === false) return false;
11722
+ return Boolean(comments) || commentsVite.findCommentsEntry(options.projectRoot, options.serverDirs) !== void 0;
11811
11723
  }
11812
11724
  // src/console/operation-features.ts
11813
11725
  /** Every module that the operation transform changes reads one of these `import.meta.viteHubConsole*` flags. */
11814
11726
  const consoleOperationFeaturesFilter = { code: "import.meta.viteHubConsole" };
11815
11727
  /**
11816
11728
  * Remove disabled operation loaders before server bundlers follow their optional imports. The document editor and media
11817
- * library code stays only when an installed owner package, such as `@vite-hub/content`, contributes a document editor.
11729
+ * library code stays only when the app configures a document editor section that an owner package, such as
11730
+ * `@vite-hub/content`, contributes. With `development: false`, the development-only loopback peer check is removed.
11818
11731
  */
11819
- function transformConsoleOperationFeatures(code, sections, documents = consoleDocumentEditorSectionIds.length > 0) {
11820
- const transformed = code.replaceAll("import.meta.viteHubConsoleOperationSections", JSON.stringify(sections)).replaceAll("import.meta.viteHubConsoleAgents", String(sections.includes("agents"))).replaceAll("import.meta.viteHubConsoleAuth", String(sections.includes("auth"))).replaceAll("import.meta.viteHubConsoleDatabase", String(sections.includes("databases"))).replaceAll("import.meta.viteHubConsoleWorkspaces", String(sections.includes("workspaces"))).replaceAll("import.meta.viteHubConsoleDocuments", String(documents));
11732
+ function transformConsoleOperationFeatures(code, sections, documents, development) {
11733
+ const featured = code.replaceAll("import.meta.viteHubConsoleAgents", String(sections.includes("agents"))).replaceAll("import.meta.viteHubConsoleAuth", String(sections.includes("auth"))).replaceAll("import.meta.viteHubConsoleDocuments", String(documents ?? consoleDocumentEditorSectionIds.some((section) => sections.includes(section))));
11734
+ const transformed = development === void 0 ? featured : featured.replaceAll("import.meta.viteHubConsoleDevelopment", String(development));
11821
11735
  return transformed === code ? void 0 : transformed;
11822
11736
  }
11823
- /** Nuxt's Nitro bundles the Console independently of the app's Vite plugins. */
11824
- function consoleOperationFeatures(sections) {
11737
+ /**
11738
+ * Nuxt's Nitro bundles the Console independently of the app's Vite plugins. `documents` reads the document editors of the
11739
+ * written Console app module, because discovery finds them after the plugin is installed. A development server keeps the
11740
+ * document code whenever an owner contributes an editor, because it caches the transform and an editor can appear later.
11741
+ */
11742
+ function consoleOperationFeatures(sections, documents = () => void 0, development) {
11825
11743
  return {
11826
11744
  name: "vite-hub/console-operation-features",
11827
11745
  transform: {
11828
11746
  filter: consoleOperationFeaturesFilter,
11829
11747
  handler(code) {
11830
- const transformed = transformConsoleOperationFeatures(code, sections);
11748
+ const transformed = transformConsoleOperationFeatures(code, sections, documents(), development);
11831
11749
  return transformed === void 0 ? void 0 : {
11832
11750
  code: transformed,
11833
11751
  map: null
@@ -11855,15 +11773,18 @@ function consoleDevAccessNotice(mode, address, env = process.env) {
11855
11773
  return `[vitehub] The dev server listens on ${address.address}, and the Console endpoint takes calls without a signature. It refuses other machines, but a tunnel or a proxy on this machine can reach it. ${fix} before you share this dev server: ${guide}`;
11856
11774
  }
11857
11775
  // src/console/vite.ts
11858
- const generatedConsolePlugin = ".vitehub/nitro/console/plugin.mjs";
11859
- const generatedDevelopmentConsolePlugin = ".vitehub/nitro/console/plugin-dev.mjs";
11776
+ const generatedConsoleApp = ".vitehub/nitro/console/app.mjs";
11777
+ const generatedDevelopmentConsoleApp = ".vitehub/nitro/console/app-dev.mjs";
11778
+ /** The import that the Console routes and the Agent `console` capability use to load the generated Console app module. */
11779
+ const consoleAppModuleId = "#vitehub/console/app";
11860
11780
  /**
11861
- * The generated Console plugin of a project. A development server writes its own file: it installs the local access
11862
- * mode and development routes, and it rewrites the file when the project changes. A build that runs while the dev
11863
- * server is up would otherwise bundle that file and ship development access to production.
11781
+ * The generated Console app module of a project. The Console routes import it on their first request, so it never
11782
+ * loads when the server starts. A development server writes its own file: it installs the local access mode and
11783
+ * development routes, and it rewrites the file when the project changes. A build that runs while the dev server is up
11784
+ * would otherwise bundle that file and ship development access to production.
11864
11785
  */
11865
- function resolveGeneratedConsolePlugin(root, development = false) {
11866
- return resolve(root, development ? generatedDevelopmentConsolePlugin : generatedConsolePlugin);
11786
+ function resolveGeneratedConsoleApp(root, development = false) {
11787
+ return resolve(root, development ? generatedDevelopmentConsoleApp : generatedConsoleApp);
11867
11788
  }
11868
11789
  const localDevelopmentConsole = Object.freeze({
11869
11790
  auth: false,
@@ -11877,9 +11798,27 @@ const removedConsoleOptions = {
11877
11798
  retention: "The Agent Invocation journal does not depend on the Console. Set agent: { invocations: { retention } } in vitehub() instead.",
11878
11799
  embed: `Apps do not serve the Console page. Open the app in the ViteHub Console at https://console.vitehub.dev. Remove console.embed. See ${consoleGuide}`,
11879
11800
  mcp: `Apps do not serve a Console MCP at /_vitehub/mcp. Agents use the ViteHub MCP of the Console at https://console.vitehub.dev/mcp. Remove console.mcp. See ${consoleGuide}`,
11801
+ mcpClient: `Apps do not run an MCP client. The MCP client section of the ViteHub Console connects to MCP servers from the Console server, so the app needs no @modelcontextprotocol/sdk and no VITEHUB_CONSOLE_MCP_KEY. Remove console.mcpClient. See ${consoleGuide}`,
11880
11802
  origins: `Apps take no Console calls from browsers. The ViteHub Console signs calls on its server. Remove console.origins. See ${consoleGuide}`,
11803
+ pill: `Apps do not add the Console link to their pages. The Comments pill loads the Console segment from the ViteHub Console, and an app without Comments opens through the Console at https://console.vitehub.dev. Remove console.pill. See ${consoleGuide}`,
11881
11804
  signInPage: `Apps do not serve a Console sign-in page. People sign in to the ViteHub Console at https://console.vitehub.dev. Remove console.signInPage. See ${consoleGuide}`
11882
11805
  };
11806
+ const loopbackConsoleHosts = /* @__PURE__ */ new Set([
11807
+ "localhost",
11808
+ "127.0.0.1",
11809
+ "[::1]"
11810
+ ]);
11811
+ /** The origin of a `console.url` value, or `undefined` when it is not an `https:` origin or a loopback `http:` origin. */
11812
+ function consoleOrigin(value) {
11813
+ if (typeof value !== "string" || !URL.canParse(value)) return void 0;
11814
+ const url = new URL(value);
11815
+ if (!(url.protocol === "https:" || url.protocol === "http:" && loopbackConsoleHosts.has(url.hostname)) || url.username || url.password || url.pathname !== "/" || url.search || url.hash || value.includes("@")) return void 0;
11816
+ return url.origin;
11817
+ }
11818
+ /** The origin of the ViteHub Console that the app links to: `console.url`, or `undefined` for the hosted Console. */
11819
+ function resolveConsoleUrl(configured) {
11820
+ return configured?.url === void 0 ? void 0 : consoleOrigin(configured.url);
11821
+ }
11883
11822
  /** The fix of a removed `console.auth` value. */
11884
11823
  function removedConsoleAuth(auth) {
11885
11824
  if (auth === "token") return "console.auth: \"token\" was removed. Signed calls are the default now. Remove console.auth, or set console: true.";
@@ -11901,13 +11840,13 @@ function resolveConsoleOptions(value) {
11901
11840
  if (auth !== void 0 && auth !== false) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: "[vitehub] console.auth must be false, for development without signed calls, or left out." });
11902
11841
  const impersonation = Reflect.get(value, "impersonation");
11903
11842
  if (impersonation !== void 0 && impersonation !== true && impersonation !== false) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: "[vitehub] console.impersonation must be true or false." });
11904
- const pill = Reflect.get(value, "pill");
11905
- if (pill !== void 0 && pill !== false) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: "[vitehub] console.pill must be false, to leave the Console link out of the page tools pill, or left out." });
11906
11843
  const sections = Reflect.get(value, "sections");
11907
11844
  if (sections !== void 0 && (!(sections instanceof Object) || Array.isArray(sections) || Object.values(sections).some((entry) => entry !== false))) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: "[vitehub] console.sections maps a section id to false, such as { content: false }." });
11845
+ const url = Reflect.get(value, "url");
11846
+ if (url !== void 0 && consoleOrigin(url) === void 0) throw viteHubErrorDiagnostics.VITE_HUB_B0004({ message: `[vitehub] console.url must be the https:// origin of a ViteHub Console without a path, such as "https://console.example.com", or http://localhost for a Console on this computer.` });
11908
11847
  return value;
11909
11848
  }
11910
- function configureConsoleNitroRoutes(nitro, baseURL, sections, rpcOnly = false) {
11849
+ function configureConsoleNitroRoutes(nitro, baseURL, siteAccess, app) {
11911
11850
  const mount = viteHubPageToolsBase({
11912
11851
  base: baseURL,
11913
11852
  nitro
@@ -11916,24 +11855,16 @@ function configureConsoleNitroRoutes(nitro, baseURL, sections, rpcOnly = false)
11916
11855
  ...nitro,
11917
11856
  handlers: Array.isArray(nitro.handlers) ? [...nitro.handlers] : []
11918
11857
  });
11919
- addConsoleRpcHandler(kit.config, consoleRuntimeRoot, mount);
11920
- if (!rpcOnly) addConsolePageToolRoutes(kit.config, consoleRuntimeRoot, mount);
11921
- const userPublicAssets = (kit.config.publicAssets ?? []).filter((asset) => asset?.dir !== consoleSkillsRoot);
11922
- return {
11923
- kit,
11924
- publicAssets: [...rpcOnly ? [] : [{
11925
- baseURL: consoleMountPath(mount, "/_vitehub/.well-known/skills"),
11926
- dir: consoleSkillsRoot,
11927
- fallthrough: false
11928
- }], ...userPublicAssets]
11858
+ addConsoleRpcHandler(kit.config, consoleRuntimeRoot, mount, { siteAccess });
11859
+ if (app) kit.config.alias = {
11860
+ ...kit.config.alias instanceof Object ? kit.config.alias : {},
11861
+ [consoleAppModuleId]: app
11929
11862
  };
11930
- }
11931
- function consoleMountPath(base, path) {
11932
- return `${viteHubBasePath(base)}${path}`;
11863
+ return kit;
11933
11864
  }
11934
11865
  /**
11935
- * The variables that a deployed Console reads: a `VITEHUB_CONSOLE_KEY_<NAME>` public key for each linked Console, and
11936
- * `VITEHUB_CONSOLE_MCP_KEY`, which seals MCP connections when `mcpClient` is on. Without `console`, it reads none.
11866
+ * The variables that a deployed Console reads: a `VITEHUB_CONSOLE_KEY_<NAME>` public key for each linked Console.
11867
+ * Without `console`, it reads none.
11937
11868
  */
11938
11869
  function consoleDeploymentEnv(configured) {
11939
11870
  if (!configured) return [];
@@ -11944,13 +11875,7 @@ function consoleDeploymentEnv(configured) {
11944
11875
  secret: false,
11945
11876
  hasDefault: false,
11946
11877
  owners: ["console"]
11947
- }, ...isConsoleMcpClientEnabled(configured) ? [{
11948
- names: ["VITEHUB_CONSOLE_MCP_KEY"],
11949
- required: false,
11950
- secret: true,
11951
- hasDefault: false,
11952
- owners: ["console"]
11953
- }] : []];
11878
+ }];
11954
11879
  }
11955
11880
  /** Reject a production build that takes Console calls without a signature. */
11956
11881
  function assertConsoleProductionAuth(configured) {
@@ -11985,14 +11910,10 @@ function resolveConsoleAccessBuild(configured, options) {
11985
11910
  function assertConsoleAccess(configured, options) {
11986
11911
  if (configured.impersonation === true && !options.auth) throw viteHubErrorDiagnostics.VITE_HUB_B0005({ message: "[vitehub] console.impersonation needs app Auth. Add server/auth.ts with Better Auth's admin plugin, or remove console.impersonation." });
11987
11912
  }
11988
- function generatedConsolePluginRegistration(value) {
11989
- const normalized = value.replaceAll("\\", "/");
11990
- return normalized === generatedConsolePlugin || /\/\.vitehub\/nitro\/console\/plugin(?:-[^/]+)?\.mjs$/.test(normalized);
11991
- }
11992
11913
  function consoleVitePlugin(options) {
11993
11914
  let sections = options.sections ?? [];
11994
11915
  let blobStores = options.blobStores ?? [];
11995
- let generatedPlugin;
11916
+ let generatedApp;
11996
11917
  let databaseDiscoveryRoot;
11997
11918
  let projectRoot;
11998
11919
  let rateLimitDiscoveryRoot;
@@ -12010,12 +11931,16 @@ function consoleVitePlugin(options) {
12010
11931
  const consoleBuildCatalogs = /* @__PURE__ */ new Map();
12011
11932
  let baseURL = "/";
12012
11933
  let applicationBase = "/";
11934
+ const siteAccess = () => projectRoot !== void 0 && resolveConsoleSiteAccess(options.comments, {
11935
+ projectRoot,
11936
+ serverDirs
11937
+ });
12013
11938
  function consoleAccess() {
12014
11939
  if (!resolvedConsoleConfiguration || !root) return;
12015
11940
  return resolveConsoleAccessBuild(resolvedConsoleConfiguration, { root });
12016
11941
  }
12017
- /** The options of the generated Console Nitro plugin, read from the current state when it is written. */
12018
- function consolePluginOptions() {
11942
+ /** The options of the generated Console app module, read from the current state when it is written. */
11943
+ function consoleAppModuleOptions() {
12019
11944
  return {
12020
11945
  access: consoleAccess(),
12021
11946
  active: () => !options.invocationRootState?.closed,
@@ -12023,7 +11948,8 @@ function consoleVitePlugin(options) {
12023
11948
  development,
12024
11949
  invoke,
12025
11950
  name: options.name,
12026
- runtimeCapabilityImports: options.runtimeCapabilityImports,
11951
+ operationSections: options.operationSections,
11952
+ runtimeCapabilityImports: resolveConsoleRuntimeCapabilityImports(options.runtimeCapabilityImports, resolvedPlugins),
12027
11953
  sections,
12028
11954
  ...development ? {} : { target: {
12029
11955
  ...options.host ? { host: options.host } : {},
@@ -12033,11 +11959,11 @@ function consoleVitePlugin(options) {
12033
11959
  }
12034
11960
  } },
12035
11961
  navigationSections: options.rpcOnly ? sections.filter((section) => section === "setup") : void 0,
12036
- ...options.rpcOnly || resolvedConsoleConfiguration?.pill === false ? {} : { pageTool: { base: applicationBase } }
11962
+ ...options.rpcOnly || !siteAccess() ? {} : { site: true }
12037
11963
  };
12038
11964
  }
12039
11965
  const refreshConsoleCatalog = serializeConsoleRefresh(async () => {
12040
- if (!generatedPlugin || !projectRoot || !root) return;
11966
+ if (!generatedApp || !projectRoot || !root) return;
12041
11967
  const catalog = await discoverConsoleBuildCatalog({
12042
11968
  contentImportBase: options.contentImportBase,
12043
11969
  databaseDiscoveryRoot,
@@ -12054,10 +11980,10 @@ function consoleVitePlugin(options) {
12054
11980
  workspaceDiscoveryRoot
12055
11981
  });
12056
11982
  consoleBuildCatalogs.set(projectRoot, catalog);
12057
- await writeConsoleNitroPlugin({
12058
- ...consolePluginOptions(),
11983
+ await writeConsoleAppModule({
11984
+ ...consoleAppModuleOptions(),
12059
11985
  catalog,
12060
- file: generatedPlugin,
11986
+ file: generatedApp,
12061
11987
  projectRoot
12062
11988
  });
12063
11989
  });
@@ -12088,10 +12014,22 @@ function consoleVitePlugin(options) {
12088
12014
  const framework = nitro.options.framework;
12089
12015
  nitroVersion = framework?.name === "nitro" ? framework.version : void 0;
12090
12016
  } },
12017
+ resolveId: {
12018
+ order: "pre",
12019
+ filter: { id: /^#vitehub\/console\/app$/ },
12020
+ handler() {
12021
+ return generatedApp;
12022
+ }
12023
+ },
12091
12024
  transform: {
12092
12025
  filter: consoleOperationFeaturesFilter,
12093
12026
  handler(code) {
12094
- const transformed = transformConsoleOperationFeatures(code, options.operationSections ?? sections);
12027
+ const catalog = projectRoot ? consoleBuildCatalogs.get(projectRoot) : void 0;
12028
+ const documents = development ? consoleDocumentEditorSectionIds.length > 0 : catalog ? consoleAppModuleHasDocumentEditors({
12029
+ ...consoleAppModuleOptions(),
12030
+ catalog
12031
+ }) : void 0;
12032
+ const transformed = transformConsoleOperationFeatures(code, options.operationSections ?? sections, documents, development);
12095
12033
  return transformed === void 0 ? void 0 : {
12096
12034
  code: transformed,
12097
12035
  map: null
@@ -12141,7 +12079,7 @@ function consoleVitePlugin(options) {
12141
12079
  projectRoot = resolveViteHubProjectRoot(root);
12142
12080
  const build = environment.command === "build";
12143
12081
  invoke = configured.invoke ?? !build;
12144
- generatedPlugin = resolveGeneratedConsolePlugin(projectRoot, development);
12082
+ generatedApp = resolveGeneratedConsoleApp(projectRoot, development);
12145
12083
  if (!cliDiscovery) {
12146
12084
  const resolvedOnlySections = /* @__PURE__ */ new Set([
12147
12085
  "databases",
@@ -12165,24 +12103,24 @@ function consoleVitePlugin(options) {
12165
12103
  workspaceDiscoveryRoot
12166
12104
  });
12167
12105
  consoleBuildCatalogs.set(projectRoot, catalog);
12168
- await writeConsoleNitroPlugin({
12169
- ...consolePluginOptions(),
12106
+ await writeConsoleAppModule({
12107
+ ...consoleAppModuleOptions(),
12170
12108
  catalog,
12171
- file: generatedPlugin,
12109
+ file: generatedApp,
12172
12110
  projectRoot
12173
12111
  });
12174
12112
  }
12175
12113
  const consoleConfig = viteConfig;
12176
- const { kit, publicAssets } = configureConsoleNitroRoutes(consoleConfig.nitro ? { ...consoleConfig.nitro } : {}, applicationBase, sections, options.rpcOnly);
12177
- if (Array.isArray(kit.config.plugins)) {
12178
- const plugins = kit.config.plugins.filter((candidate) => !generatedConsolePluginRegistration(candidate));
12179
- kit.config.plugins.splice(0, kit.config.plugins.length, ...plugins);
12180
- }
12181
- kit.addPlugin(generatedPlugin);
12182
- consoleConfig.nitro = {
12183
- ...kit.config,
12184
- publicAssets
12114
+ const nitroConfig = { ...configureConsoleNitroRoutes(consoleConfig.nitro ? { ...consoleConfig.nitro } : {}, applicationBase, siteAccess(), generatedApp).config };
12115
+ consoleConfig.nitro = nitroConfig;
12116
+ const consoleUrl = resolveConsoleUrl(configured);
12117
+ if (!consoleUrl) return;
12118
+ const define = JSON.stringify(consoleUrl);
12119
+ if (viteConfig["__vitehubNitroConfigContext"] === true) nitroConfig.replace = {
12120
+ ...nitroConfig.replace instanceof Object ? nitroConfig.replace : {},
12121
+ __VITEHUB_CONSOLE_URL__: define
12185
12122
  };
12123
+ return { define: { __VITEHUB_CONSOLE_URL__: define } };
12186
12124
  },
12187
12125
  async configResolved(config) {
12188
12126
  root = config.root;
@@ -12190,7 +12128,7 @@ function consoleVitePlugin(options) {
12190
12128
  baseURL = viteHubPageToolsBase(config).base || "/";
12191
12129
  applicationBase = baseURL;
12192
12130
  projectRoot ||= resolveViteHubProjectRoot(config.root);
12193
- generatedPlugin ||= resolveGeneratedConsolePlugin(projectRoot, development);
12131
+ generatedApp ||= resolveGeneratedConsoleApp(projectRoot, development);
12194
12132
  const viteConfig = config;
12195
12133
  const database = getResolvedFeatureOptions(config, "database");
12196
12134
  const rateLimit = getResolvedFeatureOptions(config, "rateLimit");
@@ -12213,13 +12151,9 @@ function consoleVitePlugin(options) {
12213
12151
  sections = sections.filter((section) => section !== "sandbox-tasks");
12214
12152
  if (sandboxTask) sections = [...sections, "sandbox-tasks"];
12215
12153
  }
12216
- const { kit, publicAssets } = configureConsoleNitroRoutes(viteConfig.nitro ??= {}, viteHubPageToolsBase(config).base, sections, options.rpcOnly);
12217
- viteConfig.nitro = {
12218
- ...kit.config,
12219
- publicAssets
12220
- };
12221
- generatedPlugin = resolveGeneratedConsolePlugin(projectRoot, development);
12154
+ generatedApp = resolveGeneratedConsoleApp(projectRoot, development);
12222
12155
  serverDirs = config[VITEHUB_SERVER_DIRS];
12156
+ viteConfig.nitro = { ...configureConsoleNitroRoutes(viteConfig.nitro ??= {}, viteHubPageToolsBase(config).base, siteAccess(), generatedApp).config };
12223
12157
  if (!cliDiscovery) await refreshConsoleCatalog();
12224
12158
  },
12225
12159
  configureServer(server) {
@@ -12253,19 +12187,14 @@ function consoleVitePlugin(options) {
12253
12187
  function consoleOperationContributions(sections) {
12254
12188
  return [{
12255
12189
  export: "consoleOperations",
12256
- load: async () => (await import("./operations-D7ENc68Y.js")).consoleOperations.filter((operation) => sections().includes("databases") || !operation.name.startsWith("databases.")),
12190
+ load: async () => (await loadConsoleOperations()).filter((operation) => sections().includes("databases") || !operation.name.startsWith("databases.")),
12257
12191
  module: "vite-hub/console/server",
12258
12192
  runtime: false
12259
- }, ...sections().includes("mcp-client") ? [{
12260
- export: "consoleMcpClientOperations",
12261
- load: async () => (await import("./console/runtime/server/mcp-client-operations.js")).consoleMcpClientOperations,
12262
- module: "vite-hub/console/mcp-client",
12263
- runtime: false
12264
- }] : []];
12193
+ }];
12265
12194
  }
12266
12195
  /**
12267
12196
  * Keeps `vite-hub` in the server environments of an app with Agents, so the Console and the app read one Agent
12268
- * Invocation journal, and records when those environments close, so a closed server writes no generated plugin.
12197
+ * Invocation journal, and records when those environments close, so a closed server writes no generated app module.
12269
12198
  */
12270
12199
  function consoleInvocationRootPlugin(state = {}) {
12271
12200
  const activeEnvironments = /* @__PURE__ */ new Set();
@@ -14296,7 +14225,6 @@ function createViteHubPlugins(options, reportVersionError) {
14296
14225
  ["channels", options.channels],
14297
14226
  ["comments", options.comments],
14298
14227
  ["console agents", configuredConsole && options.agent],
14299
- ["console mcp-client", isConsoleMcpClientEnabled(configuredConsole)],
14300
14228
  ["connections", options.connections],
14301
14229
  ["database", options.database && !options.connections],
14302
14230
  ["email", options.email],
@@ -14422,19 +14350,19 @@ function createViteHubPlugins(options, reportVersionError) {
14422
14350
  if (redirects) plugins.push(redirectsVitePlugin(redirects));
14423
14351
  if (options.webContainer) plugins.push(requireOptionalOwner(ownerModules.webContainerVite, "webContainer").webContainerVitePlugin(options.webContainer));
14424
14352
  plugins.push(staleChunkReloadVitePlugin());
14353
+ const devOperationsOnly = options.console === void 0;
14425
14354
  const runtimeCapabilityImports = {
14426
14355
  blob: blobEnabled ? "vite-hub/blob" : false,
14427
14356
  connections: options.connections ? generatedModules.connectionsAgent : false,
14428
- console: configuredConsole ? "vite-hub/console/server" : false,
14357
+ console: configuredConsole || devOperationsOnly ? generatedModules.consoleAgent : false,
14429
14358
  db: options.database ? "@vite-hub/database/runtime/registry" : false,
14430
14359
  i18n: options.i18n ? "vite-hub/i18n/server" : false,
14431
14360
  realtime: options.realtime ? "vite-hub/realtime/agent" : false,
14432
- ...emailVite ? { email: "vite-hub/email" } : {},
14361
+ ...emailVite && options.email ? { email: "vite-hub/email" } : {},
14433
14362
  ...kvVite ? { kv: "vite-hub/kv" } : {}
14434
14363
  };
14435
14364
  plugins.push(setupDevPlugin());
14436
14365
  plugins.push(operationsCheckPlugin());
14437
- const devOperationsOnly = options.console === void 0;
14438
14366
  if (configuredConsole || devOperationsOnly) {
14439
14367
  const invocationRootState = {};
14440
14368
  const consolePlugin = consoleVitePlugin({
@@ -14447,6 +14375,7 @@ function createViteHubPlugins(options, reportVersionError) {
14447
14375
  blobStores: blobStoreNames,
14448
14376
  console: configuredConsole || void 0,
14449
14377
  rpcOnly: devOperationsOnly,
14378
+ comments: options.comments,
14450
14379
  runtimeCapabilityImports,
14451
14380
  databaseDiscoveryRoot: options.database && options.database !== true ? options.database.projectRoot : void 0,
14452
14381
  rateLimitDiscoveryRoot: options.rateLimit && options.rateLimit !== true ? options.rateLimit.projectRoot : void 0,
@@ -14596,8 +14525,17 @@ function createViteHubPlugins(options, reportVersionError) {
14596
14525
  rateLimit: "vite-hub/rate-limit",
14597
14526
  realtime: generatedModules.commentsRealtime,
14598
14527
  runtime: "vite-hub/comments/runtime",
14528
+ ...configuredConsole ? { siteVisitor: generatedModules.consoleSiteVisitor } : {},
14599
14529
  webhooks: "vite-hub/webhooks"
14600
- }
14530
+ },
14531
+ ...configuredConsole ? { pillSegments: [{
14532
+ module: generatedModules.consolePill,
14533
+ export: "installConsolePill",
14534
+ options: {
14535
+ version: readViteHubVersion(),
14536
+ useCurrentGrants: configuredConsole.authorize === void 0
14537
+ }
14538
+ }] } : {}
14601
14539
  });
14602
14540
  if (options.realtime) plugins.push(requireOptionalOwner(ownerModules.realtimeVite, "realtime").hubRealtime({
14603
14541
  ...options.name ? { namespace: options.name } : {},
@@ -14753,4 +14691,4 @@ function viteHubPlugins(options, reportVersionError = true) {
14753
14691
  }
14754
14692
  return [...create(options), rootPlugin()];
14755
14693
  }
14756
- export { startViteHubHints as $, cloudflareEmailDevShimSource as A, disabledUpstashDriver as B, consoleDocumentEditorSectionIds as C, staleChunkReloadPluginName as D, installStaleChunkReloadNuxt as E, defaultJournalNeedsLibsql as F, resolveDefinitionFeatures as G, hasUpstashStore as H, writeAgentInvocationsNitroPlugin as I, nitroCacheBypass as J, markCmsPresetFeaturesResolved as K, generatedModules as L, VITEHUB_AGENT_JOURNAL_STORE as M, assertAgentInvocationsRetention as N, drizzleBuildCheckPlugin as O, assertAgentInvocationsUrl as P, reportViteHubHint as Q, disabledKVConfigModule as R, consoleContributedSections as S, isConsoleContributedSectionId as T, redisDriverSpecifier as U, hasRedisStore as V, upstashDriverSpecifier as W, importRolldownExperimental as X, describeDeploymentPlanOutput as Y, VITEHUB_NUXT_HINTS as Z, addConsoleRpcHandler as _, VITEHUB_SERVER_DIRS as _t, cloudflareExportConditions as a, isDefaultAgentJournal as at, resolveConsoleProjectName as b, resolveViteHubProjectRoot as bt, consoleInvocationRootPlugin as c, isIncludedNitroPlugin as ct, resolveConsoleAccessBuild as d, withShortInspect as dt, agentJournalStateUrl as et, resolveConsoleOptions as f, VITEHUB_APP_BASE_URL as ft, addConsoleAppRoutes as g, VITEHUB_PROJECT_ROOT as gt, consoleOperationFeatures as h, VITEHUB_PREPARE as ht, installBrowserErrorsNuxt as i, withDataDir as it, cloudflareWorkersDevShimSource as j, forgeBuildCheckPlugin as k, consoleOperationContributions as l, markIncludedNitroPlugin as lt, consoleDevAccessNotice as m, VITEHUB_NITRO_CONFIG_CONTEXT as mt, resolveSandboxTaskDriver as n, withComments as nt, assertConsoleAccess as o, hasSyncDirectory as ot, resolveGeneratedConsolePlugin as p, VITEHUB_GENERATED_ROOT as pt, resolveCmsPresetFeatures as q, viteHubPlugins as r, withConnectionsDatabase as rt, assertConsoleProductionAuth as s, ownerModules as st, applyCloudflareNodeCompatOptOut as t, defaultDatabaseD1Binding as tt, generatedConsolePluginRegistration as u, withPrintedDiagnostics as ut, serializeConsoleRefresh as v, getResolvedFeatureOptions as vt, discoverConsoleEntrySections as w, discoverConsoleBuildCatalog as x, writeConsoleNitroPlugin as y, resolveNuxtServerDirs as yt, disabledRedisDriver as z };
14694
+ export { VITEHUB_NUXT_HINTS as $, staleChunkReloadPluginName as A, disabledKVConfigModule as B, resolveConsoleProjectName as C, discoverConsoleEntrySections as D, consoleDocumentEditorSectionIds as E, VITEHUB_AGENT_JOURNAL_STORE as F, redisDriverSpecifier as G, disabledUpstashDriver as H, assertAgentInvocationsRetention as I, markCmsPresetFeaturesResolved as J, upstashDriverSpecifier as K, assertAgentInvocationsUrl as L, forgeBuildCheckPlugin as M, cloudflareEmailDevShimSource as N, isConsoleContributedSectionId as O, cloudflareWorkersDevShimSource as P, importRolldownExperimental as Q, defaultJournalNeedsLibsql as R, writeConsoleAppModule as S, resolveViteHubProjectRoot as St, consoleContributedSections as T, hasRedisStore as U, disabledRedisDriver as V, hasUpstashStore as W, nitroCacheBypass as X, resolveCmsPresetFeatures as Y, describeDeploymentPlanOutput as Z, resolveConsoleSiteAccess as _, VITEHUB_PREPARE as _t, cloudflareExportConditions as a, withConnectionsDatabase as at, consoleAppModuleHasDocumentEditors as b, getResolvedFeatureOptions as bt, consoleAppModuleId as c, hasSyncDirectory as ct, resolveConsoleAccessBuild as d, markIncludedNitroPlugin as dt, reportViteHubHint as et, resolveConsoleOptions as f, withPrintedDiagnostics as ft, consoleOperationFeatures as g, VITEHUB_NITRO_CONFIG_CONTEXT as gt, consoleDevAccessNotice as h, VITEHUB_GENERATED_ROOT as ht, installBrowserErrorsNuxt as i, withComments as it, drizzleBuildCheckPlugin as j, installStaleChunkReloadNuxt as k, consoleInvocationRootPlugin as l, ownerModules as lt, resolveGeneratedConsoleApp as m, VITEHUB_APP_BASE_URL as mt, resolveSandboxTaskDriver as n, agentJournalStateUrl as nt, assertConsoleAccess as o, withDataDir as ot, resolveConsoleUrl as p, withShortInspect as pt, resolveDefinitionFeatures as q, viteHubPlugins as r, defaultDatabaseD1Binding as rt, assertConsoleProductionAuth as s, isDefaultAgentJournal as st, applyCloudflareNodeCompatOptOut as t, startViteHubHints as tt, consoleOperationContributions as u, isIncludedNitroPlugin as ut, addConsoleRpcHandler as v, VITEHUB_PROJECT_ROOT as vt, discoverConsoleBuildCatalog as w, resolveConsoleRuntimeCapabilityImports as x, resolveNuxtServerDirs as xt, serializeConsoleRefresh as y, VITEHUB_SERVER_DIRS as yt, writeAgentInvocationsNitroPlugin as z };