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
@@ -0,0 +1,237 @@
1
+ import { n as isRecord } from "./object-DRSmpe04.js";
2
+ // ../internal/src/console-signature.ts
3
+ /** The signature header: `key=<NAME>, t=<seconds>, origin=<app origin>, body=<SHA-256>, v1=<signature>`. */
4
+ const consoleSignatureHeader = "x-vitehub-signature";
5
+ /** Who calls, as base64url JSON. The signature covers it. See {@link ConsoleCaller}. */
6
+ const consoleCallerHeader = "x-vitehub-caller";
7
+ /** The first line of the signed text. A new format gets a new tag. */
8
+ const consoleSignatureVersion = "vitehub-signature-v1";
9
+ /** The app reads the public key of the caller `<NAME>` from `VITEHUB_CONSOLE_KEY_<NAME>`. */
10
+ const consolePublicKeyPrefix = "VITEHUB_CONSOLE_KEY_";
11
+ const keyNamePattern = /^[A-Z0-9_]{1,64}$/;
12
+ const timestampPattern = /^\d{1,12}$/;
13
+ const maximumCallerLength = 4096;
14
+ const encoder = new TextEncoder();
15
+ const decoder = new TextDecoder();
16
+ const ed25519 = { name: "Ed25519" };
17
+ function base64url(bytes) {
18
+ let binary = "";
19
+ for (const byte of bytes) binary += String.fromCharCode(byte);
20
+ return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
21
+ }
22
+ /** The bytes of a base64url value, or `undefined` when it is not canonical base64url without padding. */
23
+ function fromBase64url(value) {
24
+ if (!/^[\w-]*$/.test(value) || value.length % 4 === 1) return void 0;
25
+ const bytes = Uint8Array.from(atob(value.replace(/-/g, "+").replace(/_/g, "/")), (character) => character.charCodeAt(0));
26
+ return base64url(bytes) === value ? bytes : void 0;
27
+ }
28
+ function bytesOf(body) {
29
+ if (typeof body === "string") return encoder.encode(body);
30
+ return body instanceof Uint8Array ? Uint8Array.from(body) : new Uint8Array(body);
31
+ }
32
+ /** The SHA-256 of the exact body bytes, base64url. A request without a body hashes zero bytes. */
33
+ async function consoleBodySha256(body = "") {
34
+ return base64url(new Uint8Array(await crypto.subtle.digest("SHA-256", bytesOf(body))));
35
+ }
36
+ /** The text that the signature covers. Fields are joined with `\n`. */
37
+ function consoleSignedText(fields) {
38
+ return [
39
+ consoleSignatureVersion,
40
+ fields.method.toUpperCase(),
41
+ fields.target,
42
+ fields.origin,
43
+ fields.timestamp,
44
+ fields.key,
45
+ fields.bodySha256,
46
+ fields.caller
47
+ ].join("\n");
48
+ }
49
+ /** The path and query of a URL, the part of the request target that the signature covers. */
50
+ function requestTarget(url) {
51
+ return `${url.pathname}${url.search}`;
52
+ }
53
+ /** Whether a name can be the `<NAME>` of `VITEHUB_CONSOLE_KEY_<NAME>`: up to 64 of `A-Z`, `0-9`, and `_`. */
54
+ function isConsoleKeyName(name) {
55
+ return keyNamePattern.test(name);
56
+ }
57
+ /** The 32 bytes of a public key, or `undefined` when the value is not a base64url raw Ed25519 public key. */
58
+ function readConsolePublicKey(value) {
59
+ const bytes = fromBase64url(value.trim());
60
+ return bytes?.length === 32 ? bytes : void 0;
61
+ }
62
+ /** Bytes as base64url without padding, the encoding of every key, digest, and signature of the Console. */
63
+ function encodeConsoleBase64url(bytes) {
64
+ return base64url(bytes);
65
+ }
66
+ /** The bytes of a base64url value, or `undefined` when it is not canonical base64url without padding. */
67
+ function decodeConsoleBase64url(value) {
68
+ return fromBase64url(value);
69
+ }
70
+ /** Whether `signature`, base64url, is the Ed25519 signature of `bytes` with `publicKey`. A malformed key or signature does not match. */
71
+ async function verifyConsoleBytes(publicKey, signature, bytes) {
72
+ const decoded = fromBase64url(signature);
73
+ if (decoded?.length !== 64) return false;
74
+ try {
75
+ return await crypto.subtle.verify(ed25519, await crypto.subtle.importKey("raw", publicKey, ed25519, false, ["verify"]), decoded, bytes);
76
+ } catch {
77
+ return false;
78
+ }
79
+ }
80
+ function optionalText(value, maximum = 512) {
81
+ if (value === void 0) return void 0;
82
+ return String(value) === value && value.length > 0 && value.length <= maximum ? value : false;
83
+ }
84
+ /**
85
+ * Read an `x-vitehub-caller` value. Returns `undefined` for anything that is not one of the {@link ConsoleCaller} forms.
86
+ * Fields that this version does not know are ignored, so a newer Console can still call this app. A known field with a
87
+ * value that this version does not know, such as another `surface`, is refused: the app cannot apply its rules.
88
+ */
89
+ function decodeConsoleCaller(value) {
90
+ if (value.length > maximumCallerLength) return void 0;
91
+ const bytes = fromBase64url(value);
92
+ if (!bytes) return void 0;
93
+ let parsed;
94
+ try {
95
+ parsed = JSON.parse(decoder.decode(bytes));
96
+ } catch {
97
+ return;
98
+ }
99
+ if (!isRecord(parsed)) return void 0;
100
+ if (parsed.via === "cli") return parsed.user === void 0 ? { via: "cli" } : void 0;
101
+ if (parsed.via !== "console" || !isRecord(parsed.user)) return void 0;
102
+ if (parsed.surface !== void 0 && parsed.surface !== "mcp" && parsed.surface !== "cli" || parsed.confirmed !== void 0 && (parsed.confirmed !== true || parsed.surface === void 0)) return void 0;
103
+ if (parsed.readOnly !== void 0 && parsed.readOnly !== true) return void 0;
104
+ const call = parsed.surface ? {
105
+ surface: parsed.surface,
106
+ ...parsed.confirmed === true ? { confirmed: true } : {}
107
+ } : {};
108
+ const readOnly = parsed.readOnly === true ? { readOnly: true } : {};
109
+ const id = optionalText(parsed.user.id);
110
+ const name = optionalText(parsed.user.name);
111
+ const email = optionalText(parsed.user.email);
112
+ if (!id || name === false || email === false) return void 0;
113
+ const user = {
114
+ id,
115
+ ...name ? { name } : {},
116
+ ...email ? {
117
+ email,
118
+ ...parsed.user.emailVerified === true ? { emailVerified: true } : {}
119
+ } : {}
120
+ };
121
+ if (parsed.team === void 0) return {
122
+ via: "console",
123
+ user,
124
+ ...call,
125
+ ...readOnly
126
+ };
127
+ if (!isRecord(parsed.team)) return void 0;
128
+ const teamId = optionalText(parsed.team.id);
129
+ const role = optionalText(parsed.team.role);
130
+ if (!teamId || role === false) return void 0;
131
+ return {
132
+ via: "console",
133
+ user,
134
+ team: {
135
+ id: teamId,
136
+ ...role ? { role } : {}
137
+ },
138
+ ...call,
139
+ ...readOnly
140
+ };
141
+ }
142
+ function failure(code, message, status = 401) {
143
+ return {
144
+ code,
145
+ message,
146
+ ok: false,
147
+ status
148
+ };
149
+ }
150
+ /** The public keys of an env, by name, or the failure for an env without any, or with one that is not a key. */
151
+ function readConsolePublicKeys(env) {
152
+ const keys = /* @__PURE__ */ new Map();
153
+ for (const variable of Object.keys(env).sort()) {
154
+ if (!variable.startsWith("VITEHUB_CONSOLE_KEY_")) continue;
155
+ const name = variable.slice(20);
156
+ const value = env[variable];
157
+ if (String(value) !== value || !value.trim()) continue;
158
+ const key = isConsoleKeyName(name) ? readConsolePublicKey(value) : void 0;
159
+ if (!key) return failure("CONSOLE_KEY_MALFORMED", `\`${variable}\` is not an Ed25519 public key: the value must be 43 base64url characters (32 raw bytes) and the name 1 to 64 of A-Z, 0-9, and _. The app refuses every Console request until it is fixed.`, 500);
160
+ keys.set(name, key);
161
+ }
162
+ if (!keys.size) return failure("CONSOLE_KEY_NOT_CONFIGURED", `\`console: true\` needs at least one \`${consolePublicKeyPrefix}<NAME>\` variable in the server environment, and none is set.`, 500);
163
+ return keys;
164
+ }
165
+ function signatureFields(header) {
166
+ const fields = {};
167
+ for (const part of header.split(",")) {
168
+ const separator = part.indexOf("=");
169
+ if (separator === -1) return void 0;
170
+ const name = part.slice(0, separator).trim();
171
+ if (![
172
+ "key",
173
+ "t",
174
+ "origin",
175
+ "body",
176
+ "v1"
177
+ ].includes(name) || Object.hasOwn(fields, name)) return void 0;
178
+ fields[name] = part.slice(separator + 1).trim();
179
+ }
180
+ const { body, key, origin, t, v1 } = fields;
181
+ return body && key && origin && t && v1 ? {
182
+ body,
183
+ key,
184
+ origin,
185
+ t,
186
+ v1
187
+ } : void 0;
188
+ }
189
+ /**
190
+ * Check the signature of a request before its body is read. `origin` is the origin that the app serves, such as its
191
+ * configured public URL. `keys` comes from {@link readConsolePublicKeys}. A match returns the signed body digest: the
192
+ * reader of the body compares it with {@link consoleBodySha256} of the bytes it reads, before it acts on them.
193
+ */
194
+ async function verifyConsoleSignature(options) {
195
+ const header = options.headers.get(consoleSignatureHeader);
196
+ if (header === null) return failure("CONSOLE_SIGNATURE_MISSING", "This request is not signed.");
197
+ const fields = signatureFields(header);
198
+ const callerValue = options.headers.get("x-vitehub-caller") ?? "";
199
+ const caller = decodeConsoleCaller(callerValue);
200
+ const bodyDigest = fields ? fromBase64url(fields.body) : void 0;
201
+ const signature = fields ? fromBase64url(fields.v1) : void 0;
202
+ if (!fields || !isConsoleKeyName(fields.key) || !timestampPattern.test(fields.t) || bodyDigest?.length !== 32 || signature?.length !== 64) return failure("CONSOLE_SIGNATURE_INVALID", `The \`${consoleSignatureHeader}\` header is malformed.`);
203
+ if (!caller) return failure("CONSOLE_SIGNATURE_INVALID", `The \`${consoleCallerHeader}\` header names a caller that this app does not know. A newer Console or CLI may send it: upgrade vite-hub in the app.`);
204
+ const skew = Math.floor((options.now ?? Date.now()) / 1e3) - Number(fields.t);
205
+ if (Math.abs(skew) > 300) {
206
+ const minutes = Math.round(Math.abs(skew) / 60);
207
+ return failure("CONSOLE_SIGNATURE_STALE", `The request was signed ${skew > 0 ? `${minutes} minutes ago` : `${minutes} minutes in the future`}. The app accepts 5 minutes either way.`);
208
+ }
209
+ const origin = new URL(options.origin).origin;
210
+ if (fields.origin !== origin) return failure("CONSOLE_SIGNATURE_ORIGIN", `The request was signed for ${fields.origin}, and this app is ${origin}.`);
211
+ const publicKey = options.keys.get(fields.key);
212
+ if (!publicKey) return failure("CONSOLE_KEY_UNKNOWN", `The request was signed with the key \`${fields.key}\`, and this app has no \`${consolePublicKeyPrefix}${fields.key}\`.`);
213
+ const text = consoleSignedText({
214
+ bodySha256: fields.body,
215
+ caller: callerValue,
216
+ key: fields.key,
217
+ method: options.method,
218
+ origin,
219
+ target: requestTarget(new URL(options.url)),
220
+ timestamp: fields.t
221
+ });
222
+ let matched = false;
223
+ try {
224
+ const key = await crypto.subtle.importKey("raw", publicKey, ed25519, false, ["verify"]);
225
+ matched = await crypto.subtle.verify(ed25519, key, signature, encoder.encode(text));
226
+ } catch {
227
+ matched = false;
228
+ }
229
+ if (!matched) return failure("CONSOLE_SIGNATURE_INVALID", `The signature does not match the request, or it was made with another key than \`${consolePublicKeyPrefix}${fields.key}\`.`);
230
+ return {
231
+ bodySha256: fields.body,
232
+ caller,
233
+ key: fields.key,
234
+ ok: true
235
+ };
236
+ }
237
+ export { encodeConsoleBase64url as a, verifyConsoleBytes as c, decodeConsoleBase64url as i, verifyConsoleSignature as l, consolePublicKeyPrefix as n, isConsoleKeyName as o, consoleSignatureHeader as r, readConsolePublicKeys as s, consoleBodySha256 as t };
@@ -0,0 +1,3 @@
1
+ import { n as AnyOperation } from "../../operations-DgFhA1WE.js";
2
+ /** The Console operations of the document editor sections. The Console registers them only when a document editor section exists. */
3
+ export declare const documentConsoleOperations: readonly AnyOperation[];
@@ -0,0 +1,62 @@
1
+ import { n as consoleDocumentActionNames } from "../../limits-BLo31qDR.js";
2
+ import { a as legacyEvent, i as defineConsoleOperation, l as text, n as consoleOperationRequestBytes, t as actionResult } from "../../operations-byxiZ2R2.js";
3
+ import * as v from "valibot";
4
+ // src/content/console/operations.ts
5
+ const consoleDocumentReadActions = /* @__PURE__ */ new Set([
6
+ "get",
7
+ "list",
8
+ "overview",
9
+ "raw",
10
+ "references",
11
+ "resolve",
12
+ "revisions",
13
+ "search",
14
+ "sessions"
15
+ ]);
16
+ /** The Console operations of the document editor sections. The Console registers them only when a document editor section exists. */
17
+ const documentConsoleOperations = [defineConsoleOperation({
18
+ mcp: false,
19
+ description: "Run one document editor action of a Console section.",
20
+ input: v.strictObject({
21
+ action: v.picklist(consoleDocumentActionNames),
22
+ body: v.optional(v.unknown()),
23
+ section: text
24
+ }),
25
+ kind: "write",
26
+ maxRequestBytes: consoleOperationRequestBytes["documents.action"],
27
+ readOnlyWhen: ({ action, body }) => action === "session" ? typeof body === "object" && body !== null && "action" in body && (body.action === "report" || body.action === "release") : consoleDocumentReadActions.has(action),
28
+ name: "documents.action",
29
+ run: async ({ action, body, section }, context) => {
30
+ const documents = await import("../../console/runtime/server/documents.js");
31
+ if (body === void 0) {
32
+ const actions = await documents.loadConsoleDocumentActions(section);
33
+ const user = await documents.consoleDocumentActionContext(context.access);
34
+ return await documents.runConsoleDocumentAction(() => actions[action](body, user)) ?? null;
35
+ }
36
+ return actionResult(await documents.default(legacyEvent("documents", "POST", {
37
+ body,
38
+ query: {
39
+ action,
40
+ section
41
+ }
42
+ }, context))).value;
43
+ },
44
+ section: (input) => input.section
45
+ }), defineConsoleOperation({
46
+ mcp: false,
47
+ description: "Check that the caller may read a document, and return the app path of its page. The Console then signs a preview Site access token that opens the page with its draft.",
48
+ input: v.strictObject({
49
+ collection: v.pipe(text, v.minLength(1)),
50
+ id: v.pipe(text, v.minLength(1)),
51
+ section: text
52
+ }),
53
+ kind: "read",
54
+ name: "documents.preview",
55
+ run: async ({ collection, id, section }, context) => (await import("../../console/runtime/server/documents.js")).checkConsoleDocumentPreview(context, {
56
+ collection,
57
+ id,
58
+ section
59
+ }),
60
+ section: (input) => input.section
61
+ })];
62
+ export { documentConsoleOperations };
@@ -1,4 +1,4 @@
1
- import { r as ConsoleDatabaseInspection } from "../../../internal-CKocv79I.js";
1
+ import { i as ConsoleDatabaseInspection } from "../../internal-BRNf11h3.js";
2
2
  import { Column } from "drizzle-orm";
3
3
  import { PgTable } from "drizzle-orm/pg-core";
4
4
  import { SQLiteTable } from "drizzle-orm/sqlite-core";
@@ -1,10 +1,10 @@
1
- import { t as consoleHttpError } from "../../../http-error-BorAxJYM.js";
2
- import { t as getConsoleDatabase } from "../../../database-CrgBUdIx.js";
3
- import { t as viteHubErrorDiagnostics } from "../../../error-diagnostics-CBtvqI30.js";
1
+ import { t as consoleHttpError } from "../../http-error-BorAxJYM.js";
2
+ import { t as getConsoleDatabase } from "../../database-CrgBUdIx.js";
3
+ import { t as viteHubErrorDiagnostics } from "../../error-diagnostics-CBtvqI30.js";
4
4
  import { asc, count, desc, getTableColumns, is, or, sql } from "drizzle-orm";
5
5
  import { PgTable, getTableConfig } from "drizzle-orm/pg-core";
6
6
  import { SQLiteTable, getTableConfig as getTableConfig$1 } from "drizzle-orm/sqlite-core";
7
- // src/console/runtime/server/database.get.ts
7
+ // src/database/console/database.get.ts
8
8
  const defaultLimit = 50;
9
9
  const maximumLimit = 100;
10
10
  const maximumSearchLength = 512;
@@ -0,0 +1,3 @@
1
+ import { n as AnyOperation } from "../../operations-DgFhA1WE.js";
2
+ /** The Console operations of the Databases section. The Console registers them only when the app has a Database. */
3
+ export declare const databaseConsoleOperations: readonly AnyOperation[];
@@ -0,0 +1,49 @@
1
+ import { r as consoleRequestError } from "../../request-D769eiBL.js";
2
+ import { i as defineConsoleOperation, o as optionalCount, s as optionalText } from "../../operations-byxiZ2R2.js";
3
+ import * as v from "valibot";
4
+ /** The Console operations of the Databases section. The Console registers them only when the app has a Database. */
5
+ const databaseConsoleOperations = [defineConsoleOperation({
6
+ cli: {
7
+ namespace: "database",
8
+ command: "rows",
9
+ positional: ["table"]
10
+ },
11
+ description: "Read the rows of a database table, one page at a time. Without a table it reads the tables only.",
12
+ input: v.strictObject({
13
+ database: optionalText,
14
+ direction: v.optional(v.picklist(["asc", "desc"])),
15
+ limit: optionalCount,
16
+ offset: optionalCount,
17
+ search: optionalText,
18
+ sort: optionalText,
19
+ table: optionalText
20
+ }),
21
+ kind: "read",
22
+ name: "databases.browse",
23
+ run: async (input, context) => {
24
+ const result = await (await import("./database.get.js")).browseConsoleDatabase(input);
25
+ if (input.table && context.surface !== "console" && result.table !== input.table) throw consoleRequestError(404, `The database has no table "${input.table}".`);
26
+ return result;
27
+ },
28
+ section: "databases"
29
+ }), defineConsoleOperation({
30
+ cli: {
31
+ namespace: "database",
32
+ command: "tables"
33
+ },
34
+ description: "List the tables of a database with their columns and relationships.",
35
+ input: v.strictObject({ database: optionalText }),
36
+ kind: "read",
37
+ name: "databases.tables",
38
+ run: async (input) => {
39
+ const { database, databases, relationships, tables } = await (await import("./database.get.js")).browseConsoleDatabase(input);
40
+ return {
41
+ database,
42
+ databases,
43
+ relationships,
44
+ tables
45
+ };
46
+ },
47
+ section: "databases"
48
+ })];
49
+ export { databaseConsoleOperations };
@@ -1,4 +1,4 @@
1
- import { n as ConsoleDatabaseEntry, r as ConsoleDatabaseInspection } from "./internal-CKocv79I.js";
1
+ import { i as ConsoleDatabaseInspection, r as ConsoleDatabaseEntry } from "./internal-BRNf11h3.js";
2
2
  declare function installConsoleDatabase(projectRoot: string, databases: Record<string, ConsoleDatabaseEntry>, names: readonly string[]): ConsoleDatabaseInspection;
3
3
  declare function getConsoleDatabase(): ConsoleDatabaseInspection;
4
4
  export { installConsoleDatabase as n, getConsoleDatabase as t };
@@ -1,5 +1,5 @@
1
1
  import { n as consoleState, t as consoleSchedulesKey } from "./internal-0C_CC601.js";
2
- import { x as isConsoleSectionId } from "./sections-BiCOk9qP.js";
2
+ import { b as isConsoleSectionId } from "./sections-AUGy9EkY.js";
3
3
  import { a as parseConsoleDocumentSetup, o as parseConsoleRecordActivity, s as parseConsoleRecordLink } from "./definitions-BFYqXchw.js";
4
4
  import { t as viteHubErrorDiagnostics } from "./error-diagnostics-CBtvqI30.js";
5
5
  // src/console/runtime/server/definitions.ts
@@ -1,221 +1,3 @@
1
- import { n as isRecord } from "./object-DRSmpe04.js";
2
- // ../internal/src/console-signature.ts
3
- /** The signature header: `key=<NAME>, t=<seconds>, origin=<app origin>, body=<SHA-256>, v1=<signature>`. */
4
- const consoleSignatureHeader = "x-vitehub-signature";
5
- /** Who calls, as base64url JSON. The signature covers it. See {@link ConsoleCaller}. */
6
- const consoleCallerHeader = "x-vitehub-caller";
7
- /** The first line of the signed text. A new format gets a new tag. */
8
- const consoleSignatureVersion = "vitehub-signature-v1";
9
- /** The app reads the public key of the caller `<NAME>` from `VITEHUB_CONSOLE_KEY_<NAME>`. */
10
- const consolePublicKeyPrefix = "VITEHUB_CONSOLE_KEY_";
11
- const keyNamePattern = /^[A-Z0-9_]{1,64}$/;
12
- const timestampPattern = /^\d{1,12}$/;
13
- const maximumCallerLength = 4096;
14
- const encoder$1 = new TextEncoder();
15
- const decoder = new TextDecoder();
16
- const ed25519 = { name: "Ed25519" };
17
- function base64url$1(bytes) {
18
- let binary = "";
19
- for (const byte of bytes) binary += String.fromCharCode(byte);
20
- return btoa(binary).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
21
- }
22
- /** The bytes of a base64url value, or `undefined` when it is not canonical base64url without padding. */
23
- function fromBase64url$1(value) {
24
- if (!/^[\w-]*$/.test(value) || value.length % 4 === 1) return void 0;
25
- const bytes = Uint8Array.from(atob(value.replace(/-/g, "+").replace(/_/g, "/")), (character) => character.charCodeAt(0));
26
- return base64url$1(bytes) === value ? bytes : void 0;
27
- }
28
- function bytesOf(body) {
29
- if (typeof body === "string") return encoder$1.encode(body);
30
- return body instanceof Uint8Array ? Uint8Array.from(body) : new Uint8Array(body);
31
- }
32
- /** The SHA-256 of the exact body bytes, base64url. A request without a body hashes zero bytes. */
33
- async function consoleBodySha256(body = "") {
34
- return base64url$1(new Uint8Array(await crypto.subtle.digest("SHA-256", bytesOf(body))));
35
- }
36
- /** The text that the signature covers. Fields are joined with `\n`. */
37
- function consoleSignedText(fields) {
38
- return [
39
- consoleSignatureVersion,
40
- fields.method.toUpperCase(),
41
- fields.target,
42
- fields.origin,
43
- fields.timestamp,
44
- fields.key,
45
- fields.bodySha256,
46
- fields.caller
47
- ].join("\n");
48
- }
49
- /** The path and query of a URL, the part of the request target that the signature covers. */
50
- function requestTarget(url) {
51
- return `${url.pathname}${url.search}`;
52
- }
53
- /** Whether a name can be the `<NAME>` of `VITEHUB_CONSOLE_KEY_<NAME>`: up to 64 of `A-Z`, `0-9`, and `_`. */
54
- function isConsoleKeyName(name) {
55
- return keyNamePattern.test(name);
56
- }
57
- /** The 32 bytes of a public key, or `undefined` when the value is not a base64url raw Ed25519 public key. */
58
- function readConsolePublicKey(value) {
59
- const bytes = fromBase64url$1(value.trim());
60
- return bytes?.length === 32 ? bytes : void 0;
61
- }
62
- function optionalText(value, maximum = 512) {
63
- if (value === void 0) return void 0;
64
- return String(value) === value && value.length > 0 && value.length <= maximum ? value : false;
65
- }
66
- /**
67
- * Read an `x-vitehub-caller` value. Returns `undefined` for anything that is not one of the {@link ConsoleCaller} forms.
68
- * Fields that this version does not know are ignored, so a newer Console can still call this app. A known field with a
69
- * value that this version does not know, such as another `surface`, is refused: the app cannot apply its rules.
70
- */
71
- function decodeConsoleCaller(value) {
72
- if (value.length > maximumCallerLength) return void 0;
73
- const bytes = fromBase64url$1(value);
74
- if (!bytes) return void 0;
75
- let parsed;
76
- try {
77
- parsed = JSON.parse(decoder.decode(bytes));
78
- } catch {
79
- return;
80
- }
81
- if (!isRecord(parsed)) return void 0;
82
- if (parsed.via === "cli") return parsed.user === void 0 ? { via: "cli" } : void 0;
83
- if (parsed.via !== "console" || !isRecord(parsed.user)) return void 0;
84
- if (parsed.surface !== void 0 && parsed.surface !== "mcp" || parsed.confirmed !== void 0 && (parsed.confirmed !== true || parsed.surface !== "mcp")) return void 0;
85
- if (parsed.readOnly !== void 0 && parsed.readOnly !== true) return void 0;
86
- const mcp = parsed.surface === "mcp" ? {
87
- surface: "mcp",
88
- ...parsed.confirmed === true ? { confirmed: true } : {}
89
- } : {};
90
- const readOnly = parsed.readOnly === true ? { readOnly: true } : {};
91
- const id = optionalText(parsed.user.id);
92
- const name = optionalText(parsed.user.name);
93
- const email = optionalText(parsed.user.email);
94
- if (!id || name === false || email === false) return void 0;
95
- const user = {
96
- id,
97
- ...name ? { name } : {},
98
- ...email ? {
99
- email,
100
- ...parsed.user.emailVerified === true ? { emailVerified: true } : {}
101
- } : {}
102
- };
103
- if (parsed.team === void 0) return {
104
- via: "console",
105
- user,
106
- ...mcp,
107
- ...readOnly
108
- };
109
- if (!isRecord(parsed.team)) return void 0;
110
- const teamId = optionalText(parsed.team.id);
111
- const role = optionalText(parsed.team.role);
112
- if (!teamId || role === false) return void 0;
113
- return {
114
- via: "console",
115
- user,
116
- team: {
117
- id: teamId,
118
- ...role ? { role } : {}
119
- },
120
- ...mcp,
121
- ...readOnly
122
- };
123
- }
124
- function failure(code, message, status = 401) {
125
- return {
126
- code,
127
- message,
128
- ok: false,
129
- status
130
- };
131
- }
132
- /** The public keys of an env, by name, or the failure for an env without any, or with one that is not a key. */
133
- function readConsolePublicKeys(env) {
134
- const keys = /* @__PURE__ */ new Map();
135
- for (const variable of Object.keys(env).sort()) {
136
- if (!variable.startsWith("VITEHUB_CONSOLE_KEY_")) continue;
137
- const name = variable.slice(20);
138
- const value = env[variable];
139
- if (String(value) !== value || !value.trim()) continue;
140
- const key = isConsoleKeyName(name) ? readConsolePublicKey(value) : void 0;
141
- if (!key) return failure("CONSOLE_KEY_MALFORMED", `\`${variable}\` is not an Ed25519 public key: the value must be 43 base64url characters (32 raw bytes) and the name 1 to 64 of A-Z, 0-9, and _. The app refuses every Console request until it is fixed.`, 500);
142
- keys.set(name, key);
143
- }
144
- if (!keys.size) return failure("CONSOLE_KEY_NOT_CONFIGURED", `\`console: true\` needs at least one \`${consolePublicKeyPrefix}<NAME>\` variable in the server environment, and none is set.`, 500);
145
- return keys;
146
- }
147
- function signatureFields(header) {
148
- const fields = {};
149
- for (const part of header.split(",")) {
150
- const separator = part.indexOf("=");
151
- if (separator === -1) return void 0;
152
- const name = part.slice(0, separator).trim();
153
- if (![
154
- "key",
155
- "t",
156
- "origin",
157
- "body",
158
- "v1"
159
- ].includes(name) || Object.hasOwn(fields, name)) return void 0;
160
- fields[name] = part.slice(separator + 1).trim();
161
- }
162
- const { body, key, origin, t, v1 } = fields;
163
- return body && key && origin && t && v1 ? {
164
- body,
165
- key,
166
- origin,
167
- t,
168
- v1
169
- } : void 0;
170
- }
171
- /**
172
- * Check the signature of a request before its body is read. `origin` is the origin that the app serves, such as its
173
- * configured public URL. `keys` comes from {@link readConsolePublicKeys}. A match returns the signed body digest: the
174
- * reader of the body compares it with {@link consoleBodySha256} of the bytes it reads, before it acts on them.
175
- */
176
- async function verifyConsoleSignature(options) {
177
- const header = options.headers.get(consoleSignatureHeader);
178
- if (header === null) return failure("CONSOLE_SIGNATURE_MISSING", "This request is not signed.");
179
- const fields = signatureFields(header);
180
- const callerValue = options.headers.get("x-vitehub-caller") ?? "";
181
- const caller = decodeConsoleCaller(callerValue);
182
- const bodyDigest = fields ? fromBase64url$1(fields.body) : void 0;
183
- const signature = fields ? fromBase64url$1(fields.v1) : void 0;
184
- if (!fields || !isConsoleKeyName(fields.key) || !timestampPattern.test(fields.t) || bodyDigest?.length !== 32 || signature?.length !== 64) return failure("CONSOLE_SIGNATURE_INVALID", `The \`${consoleSignatureHeader}\` header is malformed.`);
185
- if (!caller) return failure("CONSOLE_SIGNATURE_INVALID", `The \`${consoleCallerHeader}\` header names a caller that this app does not know. A newer Console or CLI may send it: upgrade vite-hub in the app.`);
186
- const skew = Math.floor((options.now ?? Date.now()) / 1e3) - Number(fields.t);
187
- if (Math.abs(skew) > 300) {
188
- const minutes = Math.round(Math.abs(skew) / 60);
189
- return failure("CONSOLE_SIGNATURE_STALE", `The request was signed ${skew > 0 ? `${minutes} minutes ago` : `${minutes} minutes in the future`}. The app accepts 5 minutes either way.`);
190
- }
191
- const origin = new URL(options.origin).origin;
192
- if (fields.origin !== origin) return failure("CONSOLE_SIGNATURE_ORIGIN", `The request was signed for ${fields.origin}, and this app is ${origin}.`);
193
- const publicKey = options.keys.get(fields.key);
194
- if (!publicKey) return failure("CONSOLE_KEY_UNKNOWN", `The request was signed with the key \`${fields.key}\`, and this app has no \`${consolePublicKeyPrefix}${fields.key}\`.`);
195
- const text = consoleSignedText({
196
- bodySha256: fields.body,
197
- caller: callerValue,
198
- key: fields.key,
199
- method: options.method,
200
- origin,
201
- target: requestTarget(new URL(options.url)),
202
- timestamp: fields.t
203
- });
204
- let matched = false;
205
- try {
206
- const key = await crypto.subtle.importKey("raw", publicKey, ed25519, false, ["verify"]);
207
- matched = await crypto.subtle.verify(ed25519, key, signature, encoder$1.encode(text));
208
- } catch {
209
- matched = false;
210
- }
211
- if (!matched) return failure("CONSOLE_SIGNATURE_INVALID", `The signature does not match the request, or it was made with another key than \`${consolePublicKeyPrefix}${fields.key}\`.`);
212
- return {
213
- bodySha256: fields.body,
214
- caller,
215
- key: fields.key,
216
- ok: true
217
- };
218
- }
219
1
  // ../internal/src/dev-peer.ts
220
2
  /**
221
3
  * Proof that a development request came from this machine, for dev servers that run the app behind a proxy.
@@ -470,4 +252,4 @@ function addViteHubDevPeerDevHandler(devHandlers) {
470
252
  devHandlers.unshift({ handler: devHandler });
471
253
  }
472
254
  readViteHubDevPeerKey();
473
- export { consoleBodySha256 as a, readConsolePublicKeys as c, isViteHubLoopbackPeer as i, verifyConsoleSignature as l, addViteHubDevPeerUpgradeSigner as n, consolePublicKeyPrefix as o, isViteHubLoopbackAddress as r, consoleSignatureHeader as s, addViteHubDevPeerDevHandler as t };
255
+ export { isViteHubLoopbackHost as a, signViteHubDevPeer as c, viteHubDevPeerDevHandler as d, viteHubDevPeerHeader as f, viteHubDevPeerUpgradeListener as h, isViteHubLoopbackAddress as i, useViteHubDevPeerKey as l, viteHubDevPeerMaxAgeMs as m, addViteHubDevPeerUpgradeSigner as n, isViteHubLoopbackPeer as o, viteHubDevPeerKeyEnv as p, isViteHubForwardedRequest as r, readViteHubDevPeerKey as s, addViteHubDevPeerDevHandler as t, verifyViteHubDevPeer as u };
@@ -0,0 +1 @@
1
+ export { t as addViteHubDevPeerDevHandler, n as addViteHubDevPeerUpgradeSigner, r as isViteHubForwardedRequest, i as isViteHubLoopbackAddress, a as isViteHubLoopbackHost, o as isViteHubLoopbackPeer, s as readViteHubDevPeerKey, c as signViteHubDevPeer, l as useViteHubDevPeerKey, u as verifyViteHubDevPeer, d as viteHubDevPeerDevHandler, f as viteHubDevPeerHeader, p as viteHubDevPeerKeyEnv, m as viteHubDevPeerMaxAgeMs, h as viteHubDevPeerUpgradeListener } from "./dev-peer-CRYp01PE.js";
@@ -26,21 +26,15 @@ const consoleDiagnostics = /*#__PURE__*/ defineDiagnostics({ codes: {
26
26
  CONSOLE_KEY_UNKNOWN: code("The app has no public key with the name that the signature names.", "Set the `VITEHUB_CONSOLE_KEY_<NAME>` line from the Console setup page, or from `vitehub secret console-key`, on the app. Then restart or deploy the server.", `${consoleGuide}/signed-requests`, "docs"),
27
27
  CONSOLE_KEY_NOT_CONFIGURED: code("`console: true` needs a `VITEHUB_CONSOLE_KEY_<NAME>` variable in the server environment.", "Link the app in the ViteHub Console and set the line that it shows, or run `vitehub secret console-key` and set its public key line. On Cloudflare, run `wrangler secret put VITEHUB_CONSOLE_KEY_<NAME>`. Then restart or deploy the server.", `${consoleGuide}/signed-requests`, "docs"),
28
28
  CONSOLE_KEY_MALFORMED: code("A `VITEHUB_CONSOLE_KEY_<NAME>` variable is not an Ed25519 public key.", "Set the value to the 43 base64url characters that the Console setup page or `vitehub secret console-key` prints, with no quotes or spaces. Then restart or deploy the server.", `${consoleGuide}/signed-requests`, "docs"),
29
- CONSOLE_SITE_SECRET_MISSING: code("Site access without Auth seals the browser's cookie with VITEHUB_SECRET, and the app has none.", "Set VITEHUB_SECRET on the server. Generate one with `openssl rand -base64 32`, then restart or deploy.", `${consoleGuide}/site-access#site-access-without-auth`, "docs"),
30
- CONSOLE_TICKET_INVALID: code("This one-time link expired, was used, or was changed.", "Open the page again from the ViteHub Console. Each link works once, within 60 seconds.", `${consoleGuide}/site-access#one-time-links`, "docs"),
31
- CONSOLE_TICKET_MISMATCH: code("This one-time link was made for another person or another app.", "Open the page from the ViteHub Console in the browser where you are signed in to the app with the email of your Console account.", `${consoleGuide}/site-access#one-time-links`, "docs"),
32
- CONSOLE_TICKET_NO_PERSON: code("A one-time link opens the app as the person who asks for it, and this call names no person. A `vitehub` command signs its calls with a key, not as a person.", "Make the link in the ViteHub Console, where you are signed in. On a development server, which the Console cannot reach, invite the browser as a guest: `vitehub site invite <name> --grants <role>`.", `${consoleGuide}/site-access#site-access-from-the-terminal`, "docs"),
33
- CONSOLE_TICKET_STORE_MISSING: code("One-time links need a store that every instance of the app shares, and the app has none.", "Add app Auth with a Database, such as `defineAuth({ database: authDatabase() })`, then run `vitehub database migrate`. Its verification table keeps each link until it is used. Without Auth, add a Database: when the default KV store cannot take a key out once, such as Cloudflare KV, the links go in its `vitehub_console_site` table. Or use a default KV store on Redis, Upstash, or the `database` driver.", `${consoleGuide}/site-access#one-time-links`, "docs"),
34
29
  CONSOLE_LOOPBACK_ONLY: code("The development Console without signed calls accepts only requests from this machine.", "Call it from this machine, such as with `vitehub` commands, or remove console.auth so the app takes calls that the ViteHub Console and the CLI sign.", `${consoleGuide}/access#who-can-call-the-endpoint`, "docs"),
35
30
  CONSOLE_MCP_UNREACHABLE: code("The MCP server did not answer, or it failed the MCP handshake.", "Check that the server runs and that the URL is its Streamable HTTP endpoint, such as /mcp.", `${consoleGuide}/mcp-client`, "retry"),
36
31
  CONSOLE_MCP_SIGNED_OUT: code("The MCP server rejects the credentials of this connection.", "Sign in again. For a token, connect again with a new one.", `${consoleGuide}/mcp-client`, "docs"),
37
32
  CONSOLE_MCP_AUTHORIZATION_FAILED: code("The OAuth sign-in with the MCP server failed.", "Start the sign-in again. The server must publish RFC 9728 metadata that names an authorization server with client registration.", `${consoleGuide}/mcp-client`, "docs"),
38
- CONSOLE_MCP_KEY_INVALID: code("VITEHUB_CONSOLE_MCP_KEY is not 32 random bytes, so the Console cannot seal MCP connections.", "Set VITEHUB_CONSOLE_MCP_KEY to 32 random bytes as base64 or hex, such as the output of openssl rand -base64 32.", `${consoleGuide}/mcp-client#keep-connections-across-restarts`, "docs"),
39
- CONSOLE_MCP_KV_REQUIRED: code("VITEHUB_CONSOLE_MCP_KEY is set, but the app has no configured default KV store for MCP connections.", "Set kv: true in vitehub(), or configure a default KV store, then rebuild the app.", `${consoleGuide}/mcp-client#keep-connections-across-restarts`, "docs"),
40
- CONSOLE_MCP_LIST_INCOMPLETE: code("The MCP server sent a list of more than 20 pages, so the Console did not show it.", "Make the MCP server send its tools, resources, resource templates, or prompts in 20 pages or fewer, such as with more items in each page.", `${consoleGuide}/mcp-client`, "docs"),
41
33
  CONSOLE_REQUEST_INVALID: code("The server cannot read this Console request.", "Reload the Console. If this continues, deploy the Console and the server from the same build.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "reload"),
42
34
  CONSOLE_NOT_FOUND: code("The item does not exist, or the server removed it.", "Reload the Console to see the current data.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "reload"),
43
35
  CONSOLE_CONFLICT: code("The data changed after the Console loaded it.", "Reload the Console, then try again.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "reload"),
36
+ CONSOLE_SITE_ACCOUNT_MISMATCH: code("Impersonation uses the app session of this browser, and it belongs to another person than your Console account, or it has no session.", "Sign in to the app in this browser with the email of your ViteHub Console account, then start the impersonation again from the Console. Stop an impersonation in the browser that started it.", `${consoleGuide}/site-access#impersonation-and-content-preview`, "docs"),
37
+ CONSOLE_SITE_TOKEN_REFUSED: code("The app refused the Site access token that the ViteHub Console sent.", "Open the site again from the ViteHub Console, in the same browser. Check that the app has the `VITEHUB_CONSOLE_KEY_<NAME>` of its link and that `vitehub({ publicUrl })` is the URL that you open.", `${consoleGuide}/site-access#how-the-app-checks-a-visit`, "docs"),
44
38
  CONSOLE_UNAVAILABLE: code("The server did not answer. It can be restarting, offline, or rate limited.", "Wait a moment, then try again.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "retry"),
45
39
  CONSOLE_REQUEST_FAILED: code("The server could not complete the request.", "Try again. If this continues, read the server logs for this request.", `${consoleGuide}/limits-and-errors#fix-common-failures`, "retry")
46
40
  } });