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.
- package/README.md +9 -8
- package/dist/{access-BBHk9b5P.js → access-CUFHPi8T.js} +9 -133
- package/dist/{access-policy-CUbJLvlR.d.ts → access-DkBck8Vu.d.ts} +16 -16
- package/dist/{account-CoAO1F8G.d.ts → account-DNr8fHcQ.d.ts} +1 -1
- package/dist/{console/runtime/server → agent/console}/agents.get.d.ts +1 -1
- package/dist/{console/runtime/server → agent/console}/agents.get.js +3 -3
- package/dist/{console/runtime/server → agent/console}/channel-replay.d.ts +2 -2
- package/dist/{console/runtime/server → agent/console}/channel-replay.js +6 -6
- package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.js +4 -4
- package/dist/{console/runtime/server → agent/console}/invocation-workspace.get.d.ts +3 -3
- package/dist/{console/runtime/server → agent/console}/invocation-workspace.get.js +6 -6
- package/dist/{console/runtime/server → agent/console}/invocation.get.d.ts +4 -4
- package/dist/{console/runtime/server → agent/console}/invocation.get.js +8 -8
- package/dist/{console/runtime/server → agent/console}/invocations.get.js +5 -5
- package/dist/{console/runtime/server/usage.get.d.ts → agent/console/invocations.usage.d.ts} +2 -4
- package/dist/agent/console/invocations.usage.js +51 -0
- package/dist/agent/console/operations.d.ts +6 -0
- package/dist/agent/console/operations.js +247 -0
- package/dist/{console/runtime/server → agent/console}/status.get.d.ts +2 -2
- package/dist/{console/runtime/server → agent/console}/status.get.js +6 -6
- package/dist/{server-DsOEa4_A.js → agent-console-CHsLxKk_.js} +3 -2
- package/dist/agent-console-FmaYpVv-.d.ts +14 -0
- package/dist/{agent-invocations.post-BAC1aHnG.js → agent-invocations.post-CF5anHY6.js} +8 -8
- package/dist/{agents-BClUWOj7.js → agents-DBm_PJie.js} +1 -1
- package/dist/{agents-Cz_uhhov.js → agents-DXLHsE7x.js} +2 -2
- package/dist/auth/console/auth.d.ts +25 -0
- package/dist/{console/runtime/server → auth/console}/auth.js +11 -12
- package/dist/auth/console/operations.d.ts +3 -0
- package/dist/auth/console/operations.js +135 -0
- package/dist/{auth-operations-arLIY2_2.js → auth-operations-BKqoX8Ua.js} +3 -3
- package/dist/{auth-types-B4mq4YhK.d.ts → auth-types-Cotn7406.d.ts} +4 -17
- package/dist/bin.js +3 -3
- package/dist/blob/console/operations.d.ts +3 -0
- package/dist/blob/console/operations.js +44 -0
- package/dist/{blob-eH6j0AQj.js → blob-iw8pWQ6o.js} +2 -2
- package/dist/{blob-_TtxDb-t.d.ts → blob-uNin0_TV.d.ts} +1 -1
- package/dist/cache/operations.js +1 -1
- package/dist/console/auth-types.d.ts +2 -2
- package/dist/console/auth.d.ts +2 -2
- package/dist/console/runtime/auth-operations.d.ts +3 -3
- package/dist/console/runtime/auth-operations.js +1 -1
- package/dist/console/runtime/client/account.d.ts +1 -1
- package/dist/console/runtime/client/account.js +2 -2
- package/dist/console/runtime/client/auth-management.ts +6 -6
- package/dist/console/runtime/client/blob-media.js +2 -2
- package/dist/console/runtime/client/comment-thread.js +1 -1
- package/dist/console/runtime/client/content-heads.js +1 -1
- package/dist/console/runtime/client/documents.d.ts +1 -1
- package/dist/console/runtime/client/documents.js +1 -1
- package/dist/console/runtime/client/invocation.js +1 -1
- package/dist/console/runtime/client/live.d.ts +1 -1
- package/dist/console/runtime/client/mcp-client.d.ts +4 -4
- package/dist/console/runtime/client/mcp-client.js +4 -6
- package/dist/console/runtime/client/media-library.js +1 -1
- package/dist/console/runtime/client/media-uploads.js +1 -1
- package/dist/console/runtime/client/operation-view.js +1 -1
- package/dist/console/runtime/client/presence.d.ts +1 -1
- package/dist/console/runtime/client/problem.d.ts +1 -1
- package/dist/console/runtime/client/problem.js +2 -2
- package/dist/console/runtime/client/project-link.d.ts +1 -1
- package/dist/console/runtime/client/project-link.js +1 -1
- package/dist/console/runtime/client/project-session.d.ts +2 -2
- package/dist/console/runtime/client/project-session.js +1 -1
- package/dist/console/runtime/client/publish.d.ts +1 -1
- package/dist/console/runtime/client/rate-limit.js +1 -1
- package/dist/console/runtime/client/read-only.d.ts +1 -1
- package/dist/console/runtime/client/read-only.js +1 -1
- package/dist/console/runtime/client/request.d.ts +2 -2
- package/dist/console/runtime/client/request.js +1 -1
- package/dist/console/runtime/client/schedule-run.js +1 -1
- package/dist/console/runtime/client/sections.d.ts +1 -1
- package/dist/console/runtime/client/sections.js +1 -1
- package/dist/console/runtime/client/site-access.d.ts +48 -9
- package/dist/console/runtime/client/site-access.js +18 -11
- package/dist/console/runtime/client/site-link.d.ts +2 -0
- package/dist/console/runtime/client/site-link.js +1 -0
- package/dist/console/runtime/client/workflow.js +1 -1
- package/dist/console/runtime/components/console-auth-detail.vue +1 -1
- package/dist/console/runtime/components/console-auth-event-list.vue +1 -0
- package/dist/console/runtime/components/console-document-editor.vue +3 -4
- package/dist/console/runtime/components/console-usage.vue +2 -2
- package/dist/console/runtime/diagnostics.ts +14 -56
- package/dist/console/runtime/mcp-client.d.ts +2 -2
- package/dist/console/runtime/mcp-client.js +1 -1
- package/dist/console/runtime/operation-loader.d.ts +1 -0
- package/dist/console/runtime/operation-loader.js +10 -0
- package/dist/console/runtime/page-tool/page-tool.js +2 -2
- package/dist/console/runtime/sections.d.ts +2 -2
- package/dist/console/runtime/sections.js +1 -1
- package/dist/console/runtime/server/access-policy.d.ts +1 -1
- package/dist/console/runtime/server/agent-console.d.ts +2 -0
- package/dist/console/runtime/server/agent-console.js +1 -0
- package/dist/console/runtime/server/blob.d.ts +1 -1
- package/dist/console/runtime/server/blob.js +1 -1
- package/dist/console/runtime/server/database.d.ts +1 -1
- package/dist/console/runtime/server/definitions.get.d.ts +2 -2
- package/dist/console/runtime/server/definitions.get.js +2 -2
- package/dist/console/runtime/server/definitions.js +1 -1
- package/dist/console/runtime/server/documents.d.ts +2 -2
- package/dist/console/runtime/server/documents.js +2 -2
- package/dist/console/runtime/server/entry-site-access.d.ts +3 -0
- package/dist/console/runtime/server/entry-site-access.js +4 -0
- package/dist/console/runtime/server/entry.d.ts +3 -0
- package/dist/console/runtime/server/entry.js +4 -0
- package/dist/console/runtime/server/operation-contributions.d.ts +1 -1
- package/dist/console/runtime/server/operation-contributions.js +1 -1
- package/dist/console/runtime/server/pill.d.ts +45 -0
- package/dist/console/runtime/server/pill.js +62 -0
- package/dist/console/runtime/server/rpc.d.ts +5 -8
- package/dist/console/runtime/server/rpc.js +13 -20
- package/dist/console/runtime/server/runtime.d.ts +1 -1
- package/dist/console/runtime/server/runtime.js +1 -1
- package/dist/console/runtime/server/sections.d.ts +4 -4
- package/dist/console/runtime/server/sections.get.d.ts +1 -1
- package/dist/console/runtime/server/sections.get.js +4 -4
- package/dist/console/runtime/server/sections.js +3 -3
- package/dist/console/runtime/server/setup.d.ts +4 -4
- package/dist/console/runtime/server/setup.js +3 -3
- package/dist/console/runtime/server/site-access-operation.d.ts +7 -0
- package/dist/console/runtime/server/site-access-operation.js +36 -0
- package/dist/console/runtime/server/site-actions.d.ts +73 -0
- package/dist/console/runtime/server/site-actions.js +105 -0
- package/dist/console/runtime/server/site-entry.d.ts +16 -7
- package/dist/console/runtime/server/site-entry.js +59 -42
- package/dist/console/runtime/server/site-visitor.d.ts +17 -0
- package/dist/console/runtime/server/site-visitor.js +1 -0
- package/dist/console/runtime/server/site.d.ts +27 -0
- package/dist/console/runtime/server/site.js +1 -0
- package/dist/console/server.d.ts +7 -19
- package/dist/console/server.js +6 -6
- package/dist/console-signature--55DIKf2.js +237 -0
- package/dist/content/console/operations.d.ts +3 -0
- package/dist/content/console/operations.js +62 -0
- package/dist/{console/runtime/server → database/console}/database.get.d.ts +1 -1
- package/dist/{console/runtime/server → database/console}/database.get.js +4 -4
- package/dist/database/console/operations.d.ts +3 -0
- package/dist/database/console/operations.js +49 -0
- package/dist/{database-CPjZ3L0g.d.ts → database-yFezh5U1.d.ts} +1 -1
- package/dist/{definitions-M7i2p8SR.js → definitions-DGo2rNQ9.js} +1 -1
- package/dist/{dev-peer-DBq-isgi.js → dev-peer-CRYp01PE.js} +1 -219
- package/dist/dev-peer-CX5C9243.js +1 -0
- package/dist/{diagnostics-B2cqlCSz.js → diagnostics-DLHqjKGe.js} +2 -8
- package/dist/diagnostics-DgGKvWzF.d.ts +7 -0
- package/dist/doctor.js +2 -2
- package/dist/{documents-LtkKCxtu.d.ts → documents-A-7Ho0g0.d.ts} +11 -11
- package/dist/{documents-Ck_iub9w.js → documents-BduuZjm3.js} +3 -2
- package/dist/{documents-DxK0tdjA.d.ts → documents-CApMRd4o.d.ts} +2 -3
- package/dist/{documents-BOYwZ5g4.js → documents-D6ueeoUR.js} +12 -15
- package/dist/durability/operations.js +1 -1
- package/dist/{console/runtime/server → env/console}/env.get.d.ts +2 -2
- package/dist/{console/runtime/server → env/console}/env.get.js +7 -7
- package/dist/env/console/operations.d.ts +3 -0
- package/dist/env/console/operations.js +12 -0
- package/dist/env/vite.d.ts +1 -0
- package/dist/env/vite.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/{internal-CKocv79I.d.ts → internal-BRNf11h3.d.ts} +14 -4
- package/dist/{invocation-page-undo-BEi-rO0Q.js → invocation-page-undo-DHbXczWY.js} +6 -4
- package/dist/invocations-B60XWNES.js +45 -0
- package/dist/{console/runtime/server → logs/console}/logs.get.d.ts +3 -3
- package/dist/{console/runtime/server → logs/console}/logs.get.js +7 -7
- package/dist/logs/console/operations.d.ts +3 -0
- package/dist/logs/console/operations.js +23 -0
- package/dist/loopback-Bl9Cvj1k.js +139 -0
- package/dist/mcp/eval.d.ts +1 -0
- package/dist/mcp/eval.js +2 -0
- package/dist/{mcp-client-Q2XbUXuP.d.ts → mcp-client-uXVvS7RL.d.ts} +4 -6
- package/dist/{media-CAKz9yrp.js → media-CNwnh6CG.js} +5 -5
- package/dist/{media-library-BDX89xXA.js → media-library-DTC8TLsZ.js} +1 -1
- package/dist/nuxt.d.ts +1 -1
- package/dist/nuxt.js +108 -68
- package/dist/{operation-contributions-D10pjkJF.js → operation-contributions-BU10k2QS.js} +7 -6
- package/dist/{operation-contributions-BCcQVlGb.d.ts → operation-contributions-xwjDzj28.d.ts} +5 -4
- package/dist/{operation-definition-DTpNvLd8.js → operation-definition-D04Rdjbe.js} +2 -1
- package/dist/operation-modules-BUXlwjvd.js +1 -0
- package/dist/operation-modules-DHWkPcfS.js +139 -0
- package/dist/operations-D-7ljPqw.js +1 -0
- package/dist/{operations-CD_mu_Ww.js → operations-DksTrRMb.js} +1 -1
- package/dist/operations-byxiZ2R2.js +113 -0
- package/dist/{optional-owners-DAfShdgV.js → optional-owners-Cypch7V3.js} +0 -1
- package/dist/page-tools-BeZrtn4S.js +46 -0
- package/dist/page-tools-Chk8Gm9x.d.ts +23 -0
- package/dist/page-tools-shared-BLPidmCi.js +39 -0
- package/dist/{plugins-BpiTVULl.d.ts → plugins-BmkOoyIh.d.ts} +22 -9
- package/dist/{plugins-H6-MQrsn.js → plugins-DfXcUnzN.js} +248 -310
- package/dist/{project-DKBIHOf4.d.ts → project-B2qWt8on.d.ts} +2 -7
- package/dist/{project-BxyyclTE.js → project-_juMSuAS.js} +5 -7
- package/dist/{project-link-CeS0T8Pr.js → project-link-CJbCkOlC.js} +3 -3
- package/dist/{project-link-isfdRO3Q.d.ts → project-link-Ck3vuq9w.d.ts} +1 -1
- package/dist/{project-session--GN7MduT.js → project-session-8pN7pRo8.js} +4 -4
- package/dist/{request-CQ8TkHLh.js → request-D769eiBL.js} +2 -2
- package/dist/{request-BC_krbEr.d.ts → request-DYmjLTqP.d.ts} +1 -1
- package/dist/{request-CJCPyu2B.d.ts → request-DkoE0b2h.d.ts} +10 -2
- package/dist/{request-Cl68STwT.js → request-XFVx7CGC.js} +24 -2
- package/dist/routes-D02vxUSg.js +26 -0
- package/dist/{runtime-CyPZMiyK.js → runtime-DA7HJe10.js} +1 -1
- package/dist/{runtime-Cf8R1Ztr.d.ts → runtime-DGvimtvc.d.ts} +1 -1
- package/dist/{runtime-feature-guard-DpUn4Oxc.js → runtime-feature-guard-BKAMRZzM.js} +1 -1
- package/dist/search-jgMrZJXR.js +84 -0
- package/dist/{sections-BiCOk9qP.js → sections-AUGy9EkY.js} +1 -6
- package/dist/{sections-BTfWK14a.d.ts → sections-BMkFB3S-.d.ts} +1 -1
- package/dist/{sections-0qrBvGbf.d.ts → sections-DCoCa4nF.d.ts} +1 -4
- package/dist/{sections-DAtgYMVz.d.ts → sections-DjeAUX7o.d.ts} +4 -4
- package/dist/{sections-HLxb9MrG.js → sections-ZFAlI4JW.js} +2 -2
- package/dist/{sections.get-CGmtYmfu.d.ts → sections.get-BY5dClJY.d.ts} +1 -1
- package/dist/{setup-Ca7jtBLS.d.ts → setup-BBnZPziq.d.ts} +4 -7
- package/dist/{setup-DQz_i-ee.js → setup-yc3_WKNG.js} +1 -13
- package/dist/site-CZCIWsUQ.js +169 -0
- package/dist/site-link-Bvo2SxPo.js +58 -0
- package/dist/site-link-Dtw8MNVB.d.ts +18 -0
- package/dist/site-pages-B6J8U2Nq.js +66 -0
- package/dist/site-token-Wa7fhjwg.js +215 -0
- package/dist/site-visitor-BkhE2TA0.js +89 -0
- package/dist/skills/operations.js +2 -2
- package/dist/{skills.get-DAooGWy5.js → skills.get-CW8vc_Hf.js} +3 -3
- package/dist/task/operations.js +1 -1
- package/dist/usage-DBi7aOhx.js +33 -0
- package/dist/{version-CAhBr673.js → version-DUCd7Orc.js} +11 -5
- package/dist/workspace/console/operations.d.ts +3 -0
- package/dist/workspace/console/operations.js +22 -0
- package/dist/{console/runtime/server → workspace/console}/workspace-files.get.d.ts +3 -3
- package/dist/{console/runtime/server → workspace/console}/workspace-files.get.js +4 -4
- package/package.json +91 -82
- package/dist/auth-CeKxL2xp.d.ts +0 -116
- package/dist/cloudflare-env-lookup-DcN7pGlv.js +0 -15
- package/dist/console/runtime/client/ticket.d.ts +0 -2
- package/dist/console/runtime/client/ticket.js +0 -1
- package/dist/console/runtime/page/loader.js +0 -135
- package/dist/console/runtime/server/auth.d.ts +0 -2
- package/dist/console/runtime/server/mcp-client-operations.d.ts +0 -3
- package/dist/console/runtime/server/mcp-client-operations.js +0 -137
- package/dist/console/runtime/server/page-auth.d.ts +0 -16
- package/dist/console/runtime/server/page-auth.js +0 -43
- package/dist/console/runtime/server/page-tool.d.ts +0 -2
- package/dist/console/runtime/server/page-tool.js +0 -110
- package/dist/console/runtime/server/page-tools-route.d.ts +0 -2
- package/dist/console/runtime/server/page-tools-route.js +0 -4
- package/dist/console/runtime/server/search.get.d.ts +0 -2
- package/dist/console/runtime/server/search.get.js +0 -95
- package/dist/console/runtime/server/site-session.d.ts +0 -79
- package/dist/console/runtime/server/site-session.js +0 -1
- package/dist/console/runtime/server/tickets.d.ts +0 -2
- package/dist/console/runtime/server/tickets.js +0 -1
- package/dist/console/runtime/server/usage.get.js +0 -91
- package/dist/console/runtime/site-access.d.ts +0 -2
- package/dist/console/runtime/site-access.js +0 -1
- package/dist/diagnostics-BXxPggRw.d.ts +0 -9
- package/dist/invocations-8NThe8Bx.js +0 -85
- package/dist/mcp-client-Bkh-khvr.js +0 -9
- package/dist/mcp-client-DiObFpDS.js +0 -1037
- package/dist/operations-D7ENc68Y.js +0 -1
- package/dist/operations-vRLiH7dh.js +0 -852
- package/dist/page-tool-BUnUbuSy.d.ts +0 -67
- package/dist/page-tools-BQzwuAHD.js +0 -460
- package/dist/page-tools-UwsfvH-B.d.ts +0 -21
- package/dist/page-tools-shared-hJcG_xk8.js +0 -125
- package/dist/secret-D2KL_o2h.js +0 -43
- package/dist/site-access-1JIQjY11.js +0 -292
- package/dist/site-access-CUXIbbbR.d.ts +0 -53
- package/dist/site-access-CmaZ-oaL.js +0 -17
- package/dist/site-access-Cvmjb6aw.js +0 -1
- package/dist/site-session-D36fr7Wf.js +0 -297
- package/dist/skills/vitehub/SKILL.md +0 -142
- package/dist/skills/vitehub/agents/openai.yaml +0 -4
- package/dist/skills/vitehub/references/agent-definitions.md +0 -36
- package/dist/skills/vitehub/references/bundle.md +0 -57
- package/dist/skills/vitehub/references/capabilities-authority.md +0 -30
- package/dist/skills/vitehub/references/channels-triggers.md +0 -27
- package/dist/skills/vitehub/references/framework-composition.md +0 -29
- package/dist/skills/vitehub/references/preview-contract.md +0 -44
- package/dist/skills/vitehub/references/primitives/auth.md +0 -14
- package/dist/skills/vitehub/references/primitives/blob.md +0 -13
- package/dist/skills/vitehub/references/primitives/browser.md +0 -17
- package/dist/skills/vitehub/references/primitives/cache.md +0 -13
- package/dist/skills/vitehub/references/primitives/channels.md +0 -11
- package/dist/skills/vitehub/references/primitives/connections.md +0 -14
- package/dist/skills/vitehub/references/primitives/content.md +0 -13
- package/dist/skills/vitehub/references/primitives/database.md +0 -15
- package/dist/skills/vitehub/references/primitives/email.md +0 -11
- package/dist/skills/vitehub/references/primitives/env.md +0 -13
- package/dist/skills/vitehub/references/primitives/kv.md +0 -13
- package/dist/skills/vitehub/references/primitives/markdown-template.md +0 -13
- package/dist/skills/vitehub/references/primitives/queue.md +0 -14
- package/dist/skills/vitehub/references/primitives/rate-limit.md +0 -11
- package/dist/skills/vitehub/references/primitives/realtime.md +0 -19
- package/dist/skills/vitehub/references/primitives/sandbox-task.md +0 -11
- package/dist/skills/vitehub/references/primitives/sandbox.md +0 -13
- package/dist/skills/vitehub/references/primitives/schedule.md +0 -11
- package/dist/skills/vitehub/references/primitives/shell.md +0 -11
- package/dist/skills/vitehub/references/primitives/source.md +0 -11
- package/dist/skills/vitehub/references/primitives/workflow.md +0 -11
- package/dist/skills/vitehub/references/primitives/workspace.md +0 -11
- package/dist/skills/vitehub/references/project-patterns.md +0 -19
- package/dist/skills/vitehub/references/project-shapes.md +0 -81
- package/dist/skills/vitehub/references/proof-recovery.md +0 -31
- package/dist/skills/vitehub/references/sandboxes-hosts.md +0 -26
- package/dist/skills/vitehub/references/schedules-workflows-invocations.md +0 -28
- package/dist/skills/vitehub/references/server-primitives.md +0 -39
- package/dist/skills/vitehub/references/workspaces-sources-access.md +0 -26
- package/dist/ticket-BFWwevWN.d.ts +0 -12
- package/dist/ticket-BwsnryuU.js +0 -30
- package/dist/tickets-Cj9_y3gw.js +0 -356
- package/dist/usage-BduF04ks.d.ts +0 -20
- package/dist/usage-ZV3TBMzE.js +0 -570
- package/dist/usage-index-CR_xTrXO.js +0 -334
- /package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.d.ts +0 -0
- /package/dist/{console/runtime/server → agent/console}/invocations.get.d.ts +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/index.json +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/SKILL.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/agents/openai.yaml +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/agent-definitions.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/bundle.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/capabilities-authority.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/channels-triggers.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/framework-composition.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/preview-contract.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/auth.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/blob.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/browser.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/cache.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/channels.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/connections.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/content.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/database.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/email.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/env.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/kv.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/markdown-template.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/queue.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/rate-limit.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/realtime.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/sandbox-task.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/sandbox.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/schedule.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/shell.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/source.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/workflow.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/primitives/workspace.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/project-patterns.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/project-shapes.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/proof-recovery.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/sandboxes-hosts.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/schedules-workflows-invocations.md +0 -0
- /package/dist/{console/runtime/public/skills → console-skills}/vitehub/references/server-primitives.md +0 -0
- /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-
|
|
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 {
|
|
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
|
|
14
|
-
import { a as createOperationRegistry, i as collectOperationContributions, p as operationsOf } from "./operations-
|
|
15
|
-
import { a as exports, n as assertNoRemovedViteHubOptions, t as readViteHubVersion } from "./version-
|
|
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 {
|
|
22
|
-
import { n as
|
|
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 =
|
|
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 [
|
|
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
|
-
|
|
1861
|
-
|
|
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
|
-
|
|
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 {
|
|
10524
|
+
const { loadConsoleOperations } = await import("./operation-modules-BUXlwjvd.js");
|
|
10587
10525
|
const sources = [{
|
|
10588
|
-
operations:
|
|
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
|
|
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/
|
|
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
|
-
|
|
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 }) =>
|
|
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
|
-
|
|
11547
|
-
|
|
11548
|
-
|
|
11549
|
-
|
|
11550
|
-
|
|
11551
|
-
return
|
|
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
|
|
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 =
|
|
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
|
-
|
|
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(
|
|
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,
|
|
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
|
|
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
|
|
11671
|
-
async function
|
|
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 =
|
|
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
|
|
11764
|
-
*
|
|
11765
|
-
*
|
|
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
|
|
11771
|
-
|
|
11772
|
-
|
|
11773
|
-
|
|
11774
|
-
|
|
11775
|
-
|
|
11776
|
-
|
|
11777
|
-
|
|
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
|
|
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
|
-
|
|
11794
|
-
|
|
11795
|
-
|
|
11796
|
-
|
|
11797
|
-
|
|
11798
|
-
|
|
11799
|
-
|
|
11800
|
-
|
|
11801
|
-
}
|
|
11802
|
-
|
|
11803
|
-
|
|
11804
|
-
|
|
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
|
-
|
|
11809
|
-
|
|
11810
|
-
|
|
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
|
|
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
|
|
11820
|
-
const
|
|
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
|
-
/**
|
|
11824
|
-
|
|
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
|
|
11859
|
-
const
|
|
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
|
|
11862
|
-
*
|
|
11863
|
-
*
|
|
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
|
|
11866
|
-
return resolve(root, development ?
|
|
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,
|
|
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 (
|
|
11921
|
-
|
|
11922
|
-
|
|
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
|
|
11936
|
-
*
|
|
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
|
-
}
|
|
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
|
|
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
|
|
12018
|
-
function
|
|
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
|
-
|
|
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 ||
|
|
11962
|
+
...options.rpcOnly || !siteAccess() ? {} : { site: true }
|
|
12037
11963
|
};
|
|
12038
11964
|
}
|
|
12039
11965
|
const refreshConsoleCatalog = serializeConsoleRefresh(async () => {
|
|
12040
|
-
if (!
|
|
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
|
|
12058
|
-
...
|
|
11983
|
+
await writeConsoleAppModule({
|
|
11984
|
+
...consoleAppModuleOptions(),
|
|
12059
11985
|
catalog,
|
|
12060
|
-
file:
|
|
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
|
|
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
|
-
|
|
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
|
|
12169
|
-
...
|
|
12106
|
+
await writeConsoleAppModule({
|
|
12107
|
+
...consoleAppModuleOptions(),
|
|
12170
12108
|
catalog,
|
|
12171
|
-
file:
|
|
12109
|
+
file: generatedApp,
|
|
12172
12110
|
projectRoot
|
|
12173
12111
|
});
|
|
12174
12112
|
}
|
|
12175
12113
|
const consoleConfig = viteConfig;
|
|
12176
|
-
const
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
}
|
|
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
|
|
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 ?
|
|
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 {
|
|
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 };
|