vite-hub 0.4.1 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -14
- package/dist/_internal/runtime/browser-errors.d.ts +12 -4
- package/dist/_internal/runtime/browser-errors.js +69 -27
- package/dist/_internal/runtime/redirects.d.ts +1 -2
- package/dist/_internal/runtime/redirects.js +2 -3
- package/dist/_internal/runtime/request-policy.d.ts +11 -2
- package/dist/_internal/runtime/request-policy.js +25 -6
- package/dist/_internal/runtime/security.d.ts +1 -2
- package/dist/_internal/runtime/security.js +16 -3
- package/dist/{access-BDST818p.js → access-BBHk9b5P.js} +30 -20
- package/dist/{access-policy-DjBKLo3c.js → access-policy-BM48XstY.js} +5 -6
- package/dist/{access-policy-CGXhO3Ee.d.ts → access-policy-CUbJLvlR.d.ts} +4 -8
- package/dist/{account-BnOAU055.d.ts → account-CoAO1F8G.d.ts} +9 -7
- package/dist/agent/invocations/postgres.d.ts +1 -0
- package/dist/agent/invocations/postgres.js +2 -0
- package/dist/{agent-invocations.post-CcPvfA0n.js → agent-invocations.post-BAC1aHnG.js} +16 -18
- package/dist/agents-BClUWOj7.js +1 -0
- package/dist/{agents-BDeazoAW.js → agents-Cz_uhhov.js} +4 -5
- package/dist/{agents-C94A4N9u.d.ts → agents-Gyw4VKPt.d.ts} +0 -2
- package/dist/auth/server.js +1 -2
- package/dist/{auth-BZOy7obk.d.ts → auth-CeKxL2xp.d.ts} +4 -8
- package/dist/{auth-operations-GcQk0O0X.js → auth-operations-arLIY2_2.js} +1 -2
- package/dist/{auth-types-CyqhWvYF.d.ts → auth-types-B4mq4YhK.d.ts} +1 -4
- package/dist/bin.js +34 -23
- package/dist/blob/nuxt-image.js +1 -2
- package/dist/{blob-CFLwMsjH.d.ts → blob-_TtxDb-t.d.ts} +1 -3
- package/dist/{blob-CpvlM8jp.js → blob-eH6j0AQj.js} +5 -6
- package/dist/browser-error-limits-B0yS95zt.js +24 -0
- package/dist/cache/operations.d.ts +2 -4
- package/dist/cache/operations.js +3 -4
- package/dist/cache.d.ts +1 -3
- package/dist/cache.js +2 -3
- package/dist/choices/testing.d.ts +1 -0
- package/dist/choices/testing.js +2 -0
- package/dist/{cli-config-wxKjF2Y0.js → cli-config-BX8H4ZCo.js} +12 -5
- package/dist/cli-config-DgpmE_7z.js +1 -0
- package/dist/cloudflare-app-types.d.ts +18 -0
- package/dist/{cloudflare-env-lookup-DKXdr4P_.js → cloudflare-env-lookup-DcN7pGlv.js} +1 -2
- package/dist/cms.js +1 -2
- package/dist/console/auth-types.d.ts +1 -1
- package/dist/console/auth.d.ts +1 -3
- package/dist/console/auth.js +2 -3
- package/dist/console/runtime/auth-operations.d.ts +1 -3
- package/dist/console/runtime/auth-operations.js +1 -2
- package/dist/console/runtime/client/account-views.d.ts +1 -3
- package/dist/console/runtime/client/account-views.js +1 -2
- package/dist/console/runtime/client/account.d.ts +1 -1
- package/dist/console/runtime/client/account.js +36 -48
- package/dist/console/runtime/client/add-primitive.ts +2 -2
- package/dist/console/runtime/client/appearance.d.ts +1 -2
- package/dist/console/runtime/client/appearance.js +1 -2
- package/dist/console/runtime/client/blob-media.d.ts +2 -4
- package/dist/console/runtime/client/blob-media.js +5 -6
- package/dist/console/runtime/client/comment-thread.d.ts +1 -3
- package/dist/console/runtime/client/comment-thread.js +11 -5
- package/dist/console/runtime/client/content-heads.d.ts +1 -2
- package/dist/console/runtime/client/content-heads.js +2 -3
- package/dist/console/runtime/client/documents.d.ts +2 -2
- package/dist/console/runtime/client/documents.js +1 -2
- package/dist/console/runtime/client/editor.d.ts +3 -5
- package/dist/console/runtime/client/editor.js +1 -2
- package/dist/console/runtime/client/env-groups.d.ts +1 -3
- package/dist/console/runtime/client/env-groups.js +1 -2
- package/dist/console/runtime/client/env-status.d.ts +1 -3
- package/dist/console/runtime/client/env-status.js +1 -2
- package/dist/console/runtime/client/format.d.ts +1 -3
- package/dist/console/runtime/client/format.js +1 -2
- package/dist/console/runtime/client/invocation-deletion.d.ts +1 -2
- package/dist/console/runtime/client/invocation-deletion.js +1 -2
- package/dist/console/runtime/client/invocation.d.ts +1 -2
- package/dist/console/runtime/client/invocation.js +4 -5
- package/dist/console/runtime/client/live.d.ts +2 -4
- package/dist/console/runtime/client/live.js +1 -2
- package/dist/console/runtime/client/mcp-client.d.ts +6 -4
- package/dist/console/runtime/client/mcp-client.js +12 -5
- package/dist/console/runtime/client/media-library.d.ts +1 -1
- package/dist/console/runtime/client/media-library.js +1 -2
- package/dist/console/runtime/client/media-uploads.d.ts +2 -4
- package/dist/console/runtime/client/media-uploads.js +2 -3
- package/dist/console/runtime/client/media.d.ts +1 -1
- package/dist/console/runtime/client/media.js +1 -2
- package/dist/console/runtime/client/operation-view.d.ts +2 -4
- package/dist/console/runtime/client/operation-view.js +4 -5
- package/dist/console/runtime/client/presence.d.ts +2 -4
- package/dist/console/runtime/client/presence.js +1 -2
- package/dist/console/runtime/client/preview.d.ts +1 -3
- package/dist/console/runtime/client/preview.js +1 -2
- package/dist/console/runtime/client/problem.d.ts +2 -4
- package/dist/console/runtime/client/problem.js +3 -4
- package/dist/console/runtime/client/project-link.d.ts +2 -2
- package/dist/console/runtime/client/project-link.js +1 -2
- package/dist/console/runtime/client/project-session.d.ts +19 -10
- package/dist/console/runtime/client/project-session.js +1 -723
- package/dist/console/runtime/client/project.d.ts +1 -3
- package/dist/console/runtime/client/project.js +1 -2
- package/dist/console/runtime/client/projects.d.ts +1 -1
- package/dist/console/runtime/client/projects.js +1 -2
- package/dist/console/runtime/client/publish.d.ts +2 -4
- package/dist/console/runtime/client/publish.js +1 -2
- package/dist/console/runtime/client/rate-limit.d.ts +1 -3
- package/dist/console/runtime/client/rate-limit.js +3 -4
- package/dist/console/runtime/client/read-only.d.ts +2 -4
- package/dist/console/runtime/client/read-only.js +2 -3
- package/dist/console/runtime/client/request.d.ts +2 -70
- package/dist/console/runtime/client/request.js +1 -2
- package/dist/console/runtime/client/route-query.d.ts +4 -5
- package/dist/console/runtime/client/route-query.js +1 -2
- package/dist/console/runtime/client/schedule-run.d.ts +1 -3
- package/dist/console/runtime/client/schedule-run.js +3 -4
- package/dist/console/runtime/client/schema-form.d.ts +1 -1
- package/dist/console/runtime/client/schema-form.js +1 -2
- package/dist/console/runtime/client/sections.d.ts +1 -1
- package/dist/console/runtime/client/sections.js +1 -2
- package/dist/console/runtime/client/site-access.d.ts +41 -10
- package/dist/console/runtime/client/site-access.js +157 -28
- package/dist/console/runtime/client/stored.d.ts +1 -3
- package/dist/console/runtime/client/stored.js +1 -2
- package/dist/console/runtime/client/ticket.d.ts +1 -1
- package/dist/console/runtime/client/ticket.js +1 -2
- package/dist/console/runtime/client/toast.d.ts +1 -3
- package/dist/console/runtime/client/toast.js +1 -2
- package/dist/console/runtime/client/workflow.d.ts +1 -3
- package/dist/console/runtime/client/workflow.js +3 -4
- package/dist/console/runtime/components/console-account-api-keys.vue +4 -4
- package/dist/console/runtime/components/console-account-home.vue +230 -51
- package/dist/console/runtime/components/console-account-link.vue +8 -5
- package/dist/console/runtime/components/console-account-setup.vue +10 -7
- package/dist/console/runtime/components/console-account-shell.vue +13 -19
- package/dist/console/runtime/components/console-account-unlink.vue +2 -3
- package/dist/console/runtime/components/console-app-settings.vue +8 -2
- package/dist/console/runtime/components/console-app.vue +1 -10
- package/dist/console/runtime/components/console-auth-activity.vue +2 -2
- package/dist/console/runtime/components/console-auth-chart.vue +1 -1
- package/dist/console/runtime/components/console-auth-overview.vue +1 -1
- package/dist/console/runtime/components/console-auth.vue +4 -4
- package/dist/console/runtime/components/console-comment-thread.vue +1 -1
- package/dist/console/runtime/components/console-definitions.vue +4 -4
- package/dist/console/runtime/components/console-document-dashboard.vue +2 -2
- package/dist/console/runtime/components/console-document-list.vue +2 -2
- package/dist/console/runtime/components/console-document-settings.vue +1 -1
- package/dist/console/runtime/components/console-env.vue +3 -3
- package/dist/console/runtime/components/console-home.vue +220 -311
- package/dist/console/runtime/components/console-hosted-comments-embed.vue +106 -0
- package/dist/console/runtime/components/console-loading.vue +1 -1
- package/dist/console/runtime/components/console-mcp-callback.vue +6 -1
- package/dist/console/runtime/components/console-mcp-connection.vue +3 -3
- package/dist/console/runtime/components/console-mcp-items.vue +4 -17
- package/dist/console/runtime/components/console-media-browser.vue +20 -30
- package/dist/console/runtime/components/console-media-crops.vue +3 -2
- package/dist/console/runtime/components/console-media-uploads.vue +11 -7
- package/dist/console/runtime/components/console-page-toolbar.vue +5 -10
- package/dist/console/runtime/components/console-schema-list.vue +85 -31
- package/dist/console/runtime/components/console-search-palette.vue +14 -5
- package/dist/console/runtime/components/console-section.vue +2 -1
- package/dist/console/runtime/components/console-session-inspector.vue +5 -0
- package/dist/console/runtime/components/console-session.css +8 -2
- package/dist/console/runtime/components/console-settings-value.vue +4 -5
- package/dist/console/runtime/components/console-sidebar.vue +9 -8
- package/dist/console/runtime/components/console-site.vue +36 -15
- package/dist/console/runtime/components/console-stat-grid.vue +3 -2
- package/dist/console/runtime/components/console-toaster.vue +3 -2
- package/dist/console/runtime/components/console-usage-chart.vue +1 -1
- package/dist/console/runtime/components/console-usage.vue +36 -18
- package/dist/console/runtime/components/invocation/internal/brand-icons.ts +10 -0
- package/dist/console/runtime/components/invocation/internal/invocation-brand.ts +6 -2
- package/dist/console/runtime/components/invocation/invocation.css +4 -27
- package/dist/console/runtime/console-route.d.ts +1 -3
- package/dist/console/runtime/console-route.js +1 -2
- package/dist/console/runtime/definitions.d.ts +1 -1
- package/dist/console/runtime/definitions.js +1 -2
- package/dist/console/runtime/diagnostics.ts +8 -1
- package/dist/console/runtime/mcp-client.d.ts +1 -1
- package/dist/console/runtime/mcp-client.js +1 -2
- package/dist/console/runtime/page/loader.js +45 -52
- package/dist/console/runtime/page-tool/account.js +26 -0
- package/dist/console/runtime/page-tool/page-tool.js +2 -3
- package/dist/console/runtime/public/skills/index.json +1 -1
- package/dist/console/runtime/public/skills/vitehub/SKILL.md +50 -7
- package/dist/console/runtime/public/skills/vitehub/agents/openai.yaml +1 -1
- package/dist/console/runtime/public/skills/vitehub/references/primitives/channels.md +1 -1
- package/dist/console/runtime/public/skills/vitehub/references/primitives/email.md +1 -1
- package/dist/console/runtime/public/skills/vitehub/references/project-shapes.md +1 -1
- package/dist/console/runtime/rpc.d.ts +1 -1
- package/dist/console/runtime/rpc.js +1 -2
- package/dist/console/runtime/sections.d.ts +1 -1
- package/dist/console/runtime/sections.js +1 -2
- package/dist/console/runtime/server/access-policy.d.ts +1 -1
- package/dist/console/runtime/server/access-policy.js +1 -2
- package/dist/console/runtime/server/agents.get.d.ts +2 -3
- package/dist/console/runtime/server/agents.get.js +3 -4
- package/dist/console/runtime/server/auth.d.ts +1 -1
- package/dist/console/runtime/server/auth.js +4 -5
- package/dist/console/runtime/server/blob.d.ts +1 -1
- package/dist/console/runtime/server/blob.js +1 -2
- package/dist/console/runtime/server/channel-replay.d.ts +3 -5
- package/dist/console/runtime/server/channel-replay.js +7 -7
- package/dist/console/runtime/server/database.d.ts +1 -1
- package/dist/console/runtime/server/database.get.d.ts +2 -3
- package/dist/console/runtime/server/database.get.js +4 -5
- package/dist/console/runtime/server/database.js +1 -2
- package/dist/console/runtime/server/definitions.d.ts +1 -1
- package/dist/console/runtime/server/definitions.get.d.ts +4 -6
- package/dist/console/runtime/server/definitions.get.js +5 -6
- package/dist/console/runtime/server/definitions.js +1 -2
- package/dist/console/runtime/server/development.d.ts +1 -1
- package/dist/console/runtime/server/development.js +1 -2
- package/dist/console/runtime/server/documents.d.ts +1 -1
- package/dist/console/runtime/server/documents.js +2 -2
- package/dist/console/runtime/server/env.d.ts +1 -3
- package/dist/console/runtime/server/env.get.d.ts +2 -4
- package/dist/console/runtime/server/env.get.js +7 -8
- package/dist/console/runtime/server/env.js +1 -2
- package/dist/console/runtime/server/invocation-capabilities.get.d.ts +1 -3
- package/dist/console/runtime/server/invocation-capabilities.get.js +4 -5
- package/dist/console/runtime/server/invocation-workspace.get.d.ts +3 -5
- package/dist/console/runtime/server/invocation-workspace.get.js +6 -7
- package/dist/console/runtime/server/invocation.get.d.ts +3 -5
- package/dist/console/runtime/server/invocation.get.js +8 -9
- package/dist/console/runtime/server/invocations.get.d.ts +1 -2
- package/dist/console/runtime/server/invocations.get.js +5 -6
- package/dist/console/runtime/server/logs.get.d.ts +3 -5
- package/dist/console/runtime/server/logs.get.js +7 -8
- package/dist/console/runtime/server/mcp-client-operations.d.ts +2 -4
- package/dist/console/runtime/server/mcp-client-operations.js +5 -7
- package/dist/console/runtime/server/operation-contributions.d.ts +1 -1
- package/dist/console/runtime/server/operation-contributions.js +1 -2
- package/dist/console/runtime/server/page-auth.d.ts +2 -4
- package/dist/console/runtime/server/page-auth.js +1 -2
- package/dist/console/runtime/server/page-tool.d.ts +1 -1
- package/dist/console/runtime/server/page-tool.js +12 -7
- package/dist/console/runtime/server/page-tools-route.d.ts +2 -0
- package/dist/console/runtime/server/page-tools-route.js +4 -0
- package/dist/console/runtime/server/rpc.d.ts +3 -5
- package/dist/console/runtime/server/rpc.js +12 -13
- package/dist/console/runtime/server/runtime.d.ts +1 -1
- package/dist/console/runtime/server/runtime.js +1 -2
- package/dist/console/runtime/server/search.get.d.ts +1 -3
- package/dist/console/runtime/server/search.get.js +3 -5
- package/dist/console/runtime/server/sections.d.ts +5 -5
- package/dist/console/runtime/server/sections.get.d.ts +1 -1
- package/dist/console/runtime/server/sections.get.js +8 -9
- package/dist/console/runtime/server/sections.js +6 -6
- package/dist/console/runtime/server/setup.d.ts +5 -5
- package/dist/console/runtime/server/setup.js +5 -5
- package/dist/console/runtime/server/site-entry.d.ts +1 -3
- package/dist/console/runtime/server/site-entry.js +15 -10
- package/dist/console/runtime/server/site-session.d.ts +12 -22
- package/dist/console/runtime/server/site-session.js +1 -2
- package/dist/console/runtime/server/status.get.d.ts +2 -4
- package/dist/console/runtime/server/status.get.js +6 -7
- package/dist/console/runtime/server/tickets.d.ts +1 -1
- package/dist/console/runtime/server/tickets.js +1 -2
- package/dist/console/runtime/server/usage.get.d.ts +2 -4
- package/dist/console/runtime/server/usage.get.js +8 -9
- package/dist/console/runtime/server/workspace-files.get.d.ts +3 -5
- package/dist/console/runtime/server/workspace-files.get.js +4 -5
- package/dist/console/runtime/site-access.d.ts +1 -1
- package/dist/console/runtime/site-access.js +1 -2
- package/dist/console/runtime/skills.d.ts +1 -3
- package/dist/console/runtime/skills.js +1 -2
- package/dist/console/server.d.ts +7 -11
- package/dist/console/server.js +8 -8
- package/dist/console/ui.d.ts +0 -10
- package/dist/console/ui.js +32 -28
- package/dist/console-lazy-views-VEjcbL4Q.js +1 -0
- package/dist/{console-route-CBuqZ4wO.js → console-route-DbdnLkkF.js} +3 -4
- package/dist/console.d.ts +1 -3
- package/dist/console.js +1 -2
- package/dist/{database-DyPVMjp_.d.ts → database-CPjZ3L0g.d.ts} +1 -3
- package/dist/{database-BdOBjPkS.js → database-CrgBUdIx.js} +3 -4
- package/dist/definition-catalog-1xPPtzOx.js +137 -0
- package/dist/definition-catalog-M5ua7JRS.js +1 -0
- package/dist/{definitions-BW6SvmMM.js → definitions-BFYqXchw.js} +1 -2
- package/dist/{definitions-DB4LbZ7T.d.ts → definitions-ChvMnA1L.d.ts} +0 -2
- package/dist/{definitions-Dbgxfz3I.d.ts → definitions-DRkgHKmk.d.ts} +1 -3
- package/dist/{definitions-CNq_Shkh.js → definitions-M7i2p8SR.js} +5 -6
- package/dist/deployment-CURATxjG.js +229 -0
- package/dist/deployment-l7RuKdEp.js +1 -0
- package/dist/{dev-peer-am78OsHH.js → dev-peer-DBq-isgi.js} +7 -6
- package/dist/{development-zLxOp-AO.js → development-DD567hhJ.js} +2 -3
- package/dist/{development-W5EwONyL.d.ts → development-I40mfD7B.d.ts} +1 -3
- package/dist/{diagnostics-9U_fYxMy.js → diagnostics-B2cqlCSz.js} +3 -3
- package/dist/{diagnostics-CjGiniKb.d.ts → diagnostics-BXxPggRw.d.ts} +1 -3
- package/dist/docs/nuxt.js +1 -2
- package/dist/doctor.d.ts +0 -6
- package/dist/doctor.js +15078 -2377
- package/dist/{documents-CjJTCrY8.js → documents-BOYwZ5g4.js} +7 -8
- package/dist/{documents-qrHHqlNU.js → documents-Ck_iub9w.js} +4 -5
- package/dist/{documents-BASIRZ91.d.ts → documents-DxK0tdjA.d.ts} +3 -5
- package/dist/{documents-CboVhYFz.d.ts → documents-LtkKCxtu.d.ts} +4 -8
- package/dist/durability/operations.d.ts +2 -4
- package/dist/durability/operations.js +3 -4
- package/dist/email/vue.d.ts +1 -0
- package/dist/email/vue.js +2 -0
- package/dist/{entries-Bj-jPs_J.js → entries-UFs9n1MB.js} +2 -3
- package/dist/{env-Dg1I_DWr.js → env-D-wtSupz.js} +2 -3
- package/dist/{error-diagnostics-Bm3JKYjz.js → error-diagnostics-CBtvqI30.js} +33 -22
- package/dist/{operation-definition-a5keEpCd.js → error-diagnostics-kKXseq8d.js} +11 -169
- package/dist/error-diagnostics.ts +33 -23
- package/dist/{optional-owners-BNA2OX6z.js → features-BXRKlmtN.js} +57 -345
- package/dist/features-CD5i5I8V.js +1 -0
- package/dist/{format-BOYlanIZ.js → format-Df-bS4Ly.js} +1 -2
- package/dist/gateways/testing.d.ts +1 -0
- package/dist/gateways/testing.js +2 -0
- package/dist/github-login-W-vaahWP.js +6 -0
- package/dist/{host-CkL0jjBq.js → host-DeNPYIeV.js} +1 -2
- package/dist/{http-error-Bs6e8_-8.js → http-error-BorAxJYM.js} +1 -2
- package/dist/index.d.ts +2 -8
- package/dist/index.js +5 -6
- package/dist/inspect-CWwAuL-B.js +47 -0
- package/dist/internal/agent-invocations-libsql.js +1 -2
- package/dist/internal/disabled-redis-driver.d.ts +1 -3
- package/dist/internal/disabled-redis-driver.js +2 -3
- package/dist/internal/disabled-upstash-driver.d.ts +1 -3
- package/dist/internal/disabled-upstash-driver.js +2 -3
- package/dist/internal/test-loader.d.ts +1 -3
- package/dist/internal/test-loader.js +2 -3
- package/dist/internal/test-server.js +2 -3
- package/dist/{internal-BreyUsQ6.js → internal-0C_CC601.js} +1 -2
- package/dist/{internal-CO4OqqaS.d.ts → internal-CKocv79I.d.ts} +3 -7
- package/dist/{invariant-DolT9EEx.js → invariant-Dj2R1eMr.js} +1 -2
- package/dist/{invocation-page-undo-DIZ-s3xT.js → invocation-page-undo-BEi-rO0Q.js} +5 -6
- package/dist/{invocations-CK_-G540.js → invocations-8NThe8Bx.js} +5 -6
- package/dist/{limits-BUlwWYQE.js → limits-BLo31qDR.js} +1 -2
- package/dist/logs/client.d.ts +19 -0
- package/dist/logs/client.js +11 -0
- package/dist/logs/host.d.ts +2 -4
- package/dist/logs/host.js +1 -2
- package/dist/logs/memory.d.ts +1 -1
- package/dist/logs/memory.js +1 -2
- package/dist/logs/source.d.ts +1 -1
- package/dist/logs/source.js +1 -2
- package/dist/logs.d.ts +2 -2
- package/dist/logs.js +2 -2
- package/dist/{mcp-client-CTbTbn7d.js → mcp-client-Bkh-khvr.js} +1 -2
- package/dist/{mcp-client-By4zk0vU.js → mcp-client-DiObFpDS.js} +35 -22
- package/dist/{mcp-client-C_sEmyQw.d.ts → mcp-client-Q2XbUXuP.d.ts} +1 -4
- package/dist/{media-uKX4Wy-c.d.ts → media-C79RB1oH.d.ts} +0 -2
- package/dist/{media-BHpQ-4jw.js → media-CAKz9yrp.js} +8 -9
- package/dist/{media-library-NaOMBKWS.js → media-library-BDX89xXA.js} +5 -6
- package/dist/{media-library-D9ThbXqs.d.ts → media-library-DxGu6w9z.d.ts} +0 -2
- package/dist/{memory-DTmq-Z6x.js → memory-D3EJS_Bp.js} +21 -10
- package/dist/{memory-2bbl4hcV.d.ts → memory-GK5ZGWrp.d.ts} +1 -3
- package/dist/nuxt-server-auto-imports-4aT5BD4u.js +74 -0
- package/dist/{nuxt-server-imports-DH60Z7LA.js → nuxt-server-imports-BdJqiVhT.js} +10 -18
- package/dist/nuxt.d.ts +1 -3
- package/dist/nuxt.js +339 -189
- package/dist/{object-D8pRdprI.js → object-DRSmpe04.js} +1 -2
- package/dist/{operation-contributions-DpkO_iSU.d.ts → operation-contributions-BCcQVlGb.d.ts} +1 -3
- package/dist/{operation-contributions-BdS0z3tx.js → operation-contributions-D10pjkJF.js} +4 -5
- package/dist/operation-definition-DTpNvLd8.js +164 -0
- package/dist/{operation-registry-BogGwk_I.js → operation-registry-DfQbL7vE.js} +1 -2
- package/dist/{operation-rpc-DI9txNxK.js → operation-rpc-BMdfapja.js} +3 -4
- package/dist/{operations-EOdyctDc.js → operations-CD_mu_Ww.js} +86 -9
- package/dist/operations-D7ENc68Y.js +1 -0
- package/dist/{operations-B0689BG1.d.ts → operations-DgFhA1WE.d.ts} +8 -6
- package/dist/{operations-CWP9dF3i.js → operations-vRLiH7dh.js} +35 -46
- package/dist/optional-owners-DAfShdgV.js +353 -0
- package/dist/out-Cw5Tvr92.js +20989 -0
- package/dist/{owned-paths-BnjT0FhU.js → owned-paths-MjjDftBn.js} +1 -2
- package/dist/page/pill.iife.js +25 -27
- package/dist/{page-tool-CRCK1RHV.d.ts → page-tool-BUnUbuSy.d.ts} +6 -7
- package/dist/{page-tools-BkSSBFoi.js → page-tools-BQzwuAHD.js} +28 -12
- package/dist/{page-tools-sw4I-Nqx.d.ts → page-tools-UwsfvH-B.d.ts} +2 -4
- package/dist/{page-tools-shared-D3fFoEV2.js → page-tools-shared-hJcG_xk8.js} +8 -5
- package/dist/{inspect-CDw7e0vK.js → pathe.M-eThtNZ-D4EC7Wue.js} +2 -31
- package/dist/{plugins-BqAtIEX2.d.ts → plugins-BpiTVULl.d.ts} +252 -262
- package/dist/{plugins-B-DpgDPB.js → plugins-H6-MQrsn.js} +3483 -797
- package/dist/presets/workspace.js +1 -2
- package/dist/project-BxyyclTE.js +58 -0
- package/dist/{project-CufkVP1u.d.ts → project-DKBIHOf4.d.ts} +16 -4
- package/dist/{project-DlWTGB7h.js → project-DRC67Uiu.js} +1 -2
- package/dist/{project-link-D-6UefhA.js → project-link-CeS0T8Pr.js} +57 -9
- package/dist/{project-link-BuOzBH9f.d.ts → project-link-isfdRO3Q.d.ts} +42 -6
- package/dist/{project-root-v6ba4tn7.js → project-root-mAVQGZTX.js} +1 -2
- package/dist/project-session--GN7MduT.js +764 -0
- package/dist/{projects-CAcXztf4.js → projects-BRp0iseV.js} +1 -2
- package/dist/{projects-Ddvl9EJp.d.ts → projects-mgPxrKZr.d.ts} +0 -2
- package/dist/{registry-zw6aE2N9.js → registry-B8JE5NY-.js} +1 -2
- package/dist/{registry-CDKLACCZ.js → registry-CnPC-gNu.js} +1 -2
- package/dist/{request-D7h3SQ92.d.ts → request-BC_krbEr.d.ts} +2 -4
- package/dist/request-CJCPyu2B.d.ts +70 -0
- package/dist/{request-DbFfYmCu.js → request-CQ8TkHLh.js} +4 -5
- package/dist/{request-DE8w_cSM.js → request-Cl68STwT.js} +7 -8
- package/dist/request-origin-pzWr9UUu.js +37 -0
- package/dist/rolldown-runtime-DegdyBIC.js +25 -0
- package/dist/{route-query-CRVWXIrc.js → route-query-BWVl6ZO6.js} +4 -5
- package/dist/{rpc-DIUA61pv.js → rpc-D3tsx5lZ.js} +1 -2
- package/dist/{rpc-7nlHSv3y.d.ts → rpc-oijgKQtD.d.ts} +0 -2
- package/dist/{runtime-YLWfdrtO.js → runtime-CAbuQGMP.js} +3 -4
- package/dist/{runtime-DQuHg7OO.js → runtime-CRJsqVTa.js} +2 -3
- package/dist/{runtime-B_btezs1.d.ts → runtime-Cf8R1Ztr.d.ts} +0 -2
- package/dist/{runtime-DxfJOfCd.js → runtime-CyPZMiyK.js} +2 -3
- package/dist/{runtime-OsEDfbM9.js → runtime-F0CTqBFx.js} +5 -6
- package/dist/{runtime-feature-guard-B64MMW9I.js → runtime-feature-guard-DpUn4Oxc.js} +91 -10
- package/dist/scan-module-B1A24jqP.js +1 -0
- package/dist/{scan-module-Df58L_6T.js → scan-module-BfZvDBxb.js} +2 -4
- package/dist/{schema-form-C-fy3xaU.d.ts → schema-form-Bl79Bdm-.d.ts} +0 -2
- package/dist/{secret-Dy5uqvq9.js → secret-D2KL_o2h.js} +2 -3
- package/dist/{sections-Do7X4Nwt.d.ts → sections-0qrBvGbf.d.ts} +0 -4
- package/dist/{sections-C83x0slv.js → sections-BNTdIEJw.js} +2 -3
- package/dist/{sections-BogiCmtz.d.ts → sections-BTfWK14a.d.ts} +4 -6
- package/dist/{sections-DumoLKQN.js → sections-BiCOk9qP.js} +1 -2
- package/dist/sections-DAtgYMVz.d.ts +8 -0
- package/dist/{sections-et20h8w3.js → sections-HLxb9MrG.js} +14 -7
- package/dist/{sections.get-COiLcQ0P.d.ts → sections.get-CGmtYmfu.d.ts} +2 -4
- package/dist/seo/runtime.d.ts +2 -5
- package/dist/seo/runtime.js +3 -5
- package/dist/{seo-CtLywyRx.d.ts → seo-CgW5uI9L.d.ts} +0 -2
- package/dist/seo.d.ts +1 -1
- package/dist/seo.js +1 -2
- package/dist/{server-BRJE4t-W.js → server-DsOEa4_A.js} +5 -5
- package/dist/{setup-ZbA1by7W.d.ts → setup-Ca7jtBLS.d.ts} +8 -7
- package/dist/{setup-C-5nB7aY.js → setup-DQz_i-ee.js} +16 -5
- package/dist/{site-access-BmE8HGxs.js → site-access-1JIQjY11.js} +16 -16
- package/dist/{site-access-DxfdOel1.d.ts → site-access-CUXIbbbR.d.ts} +0 -2
- package/dist/{site-access-BycrwM2v.js → site-access-CmaZ-oaL.js} +1 -2
- package/dist/site-access-Cvmjb6aw.js +1 -0
- package/dist/{site-session-odJq1dYa.js → site-session-D36fr7Wf.js} +65 -40
- package/dist/skills/operations.d.ts +1 -5
- package/dist/skills/operations.js +4 -5
- package/dist/skills/vitehub/SKILL.md +142 -0
- package/dist/skills/vitehub/agents/openai.yaml +4 -0
- package/dist/skills/vitehub/references/agent-definitions.md +36 -0
- package/dist/skills/vitehub/references/bundle.md +57 -0
- package/dist/skills/vitehub/references/capabilities-authority.md +30 -0
- package/dist/skills/vitehub/references/channels-triggers.md +27 -0
- package/dist/skills/vitehub/references/framework-composition.md +29 -0
- package/dist/skills/vitehub/references/preview-contract.md +44 -0
- package/dist/skills/vitehub/references/primitives/auth.md +14 -0
- package/dist/skills/vitehub/references/primitives/blob.md +13 -0
- package/dist/skills/vitehub/references/primitives/browser.md +17 -0
- package/dist/skills/vitehub/references/primitives/cache.md +13 -0
- package/dist/skills/vitehub/references/primitives/channels.md +11 -0
- package/dist/skills/vitehub/references/primitives/connections.md +14 -0
- package/dist/skills/vitehub/references/primitives/content.md +13 -0
- package/dist/skills/vitehub/references/primitives/database.md +15 -0
- package/dist/skills/vitehub/references/primitives/email.md +11 -0
- package/dist/skills/vitehub/references/primitives/env.md +13 -0
- package/dist/skills/vitehub/references/primitives/kv.md +13 -0
- package/dist/skills/vitehub/references/primitives/markdown-template.md +13 -0
- package/dist/skills/vitehub/references/primitives/queue.md +14 -0
- package/dist/skills/vitehub/references/primitives/rate-limit.md +11 -0
- package/dist/skills/vitehub/references/primitives/realtime.md +19 -0
- package/dist/skills/vitehub/references/primitives/sandbox-task.md +11 -0
- package/dist/skills/vitehub/references/primitives/sandbox.md +13 -0
- package/dist/skills/vitehub/references/primitives/schedule.md +11 -0
- package/dist/skills/vitehub/references/primitives/shell.md +11 -0
- package/dist/skills/vitehub/references/primitives/source.md +11 -0
- package/dist/skills/vitehub/references/primitives/workflow.md +11 -0
- package/dist/skills/vitehub/references/primitives/workspace.md +11 -0
- package/dist/skills/vitehub/references/project-patterns.md +19 -0
- package/dist/skills/vitehub/references/project-shapes.md +81 -0
- package/dist/skills/vitehub/references/proof-recovery.md +31 -0
- package/dist/skills/vitehub/references/sandboxes-hosts.md +26 -0
- package/dist/skills/vitehub/references/schedules-workflows-invocations.md +28 -0
- package/dist/skills/vitehub/references/server-primitives.md +39 -0
- package/dist/skills/vitehub/references/workspaces-sources-access.md +26 -0
- package/dist/{skills-DdpSMiCI.js → skills-C1MaGEbO.js} +1 -2
- package/dist/skills.d.ts +1 -2
- package/dist/{skills.get-Bl8cBe8u.js → skills.get-DAooGWy5.js} +3 -4
- package/dist/skills.js +1 -2
- package/dist/{source-D4wWtoHh.js → source-DYFndd0W.js} +2 -3
- package/dist/{source-S-LChQvw.d.ts → source-DemBtwla.d.ts} +0 -2
- package/dist/{stored-Dhv2qsQv.js → stored-J3TetMKf.js} +1 -2
- package/dist/task/operations.d.ts +1 -5
- package/dist/task/operations.js +3 -4
- package/dist/test/register.js +2 -3
- package/dist/test.d.ts +0 -4
- package/dist/test.js +1 -2
- package/dist/{ticket-Pr_8ZtXW.d.ts → ticket-BFWwevWN.d.ts} +0 -2
- package/dist/{ticket-Cudn1dq3.js → ticket-BwsnryuU.js} +2 -3
- package/dist/{tickets-C_0Fhc00.js → tickets-Cj9_y3gw.js} +14 -16
- package/dist/ui/motion/core.d.ts +1 -0
- package/dist/ui/motion/core.js +2 -0
- package/dist/ui/motion.d.ts +1 -0
- package/dist/ui/motion.js +2 -0
- package/dist/ui/vite.js +1 -2
- package/dist/{usage-CoQXs5nW.d.ts → usage-BduF04ks.d.ts} +0 -2
- package/dist/{usage-B4taNt4a.js → usage-ZV3TBMzE.js} +6 -5
- package/dist/{usage-index-BsGAFzyq.js → usage-index-CR_xTrXO.js} +3 -4
- package/dist/{version-DNmSsk5r.js → version-CAhBr673.js} +59 -21
- package/dist/{vite-stage-mmtwQIMA.js → vite-stage-Dmo4RgnK.js} +32 -8
- package/dist/{vue-router-C68IU1jM.d.ts → vue-router-plZJLlpm.d.ts} +120 -182
- package/dist/workspace/blob-database/postgres.d.ts +1 -0
- package/dist/workspace/blob-database/postgres.js +2 -0
- package/dist/{workspace-history-CraoERnc.js → workspace-history-B52xib2J.js} +3 -4
- package/dist/{workspace-history-CeVwBB6Q.d.ts → workspace-history-WuxgLsi4.d.ts} +0 -2
- package/package.json +190 -149
- package/dist/agents-BoWau_ei.js +0 -2
- package/dist/cli-config-UAGTmuFa.js +0 -2
- package/dist/console/runtime/server/page-session.d.ts +0 -2
- package/dist/console/runtime/server/page-session.js +0 -5
- package/dist/console-lazy-views-DXnIkdyd.js +0 -2
- package/dist/operations-CAQmIxGK.js +0 -2
- package/dist/project-C4N_Zcjl.js +0 -30
- package/dist/request-origin-Bq7mDQG9.js +0 -23
- package/dist/scan-module-D_3X08mj.js +0 -2
- package/dist/sections-CyrXbbkG.d.ts +0 -10
- package/dist/site-access-BbJUe5QI.js +0 -2
- /package/dist/{agent/channels.d.ts → channels/adapters.d.ts} +0 -0
- /package/dist/{agent/channels.js → channels/adapters.js} +0 -0
package/README.md
CHANGED
|
@@ -11,6 +11,18 @@ Use it for a Vite or Nuxt application that needs Server Primitives, Agents, or b
|
|
|
11
11
|
|
|
12
12
|
`VITEHUB_HOST` selects the deployment host and is reserved. For an application Env field named `host`, use `env.source("APP_HOST", { canonical: false })` or a custom Env prefix.
|
|
13
13
|
|
|
14
|
+
## Agent skill
|
|
15
|
+
|
|
16
|
+
The package ships the `vitehub` agent skill at `node_modules/vite-hub/dist/skills/vitehub/`, written for the installed version. It lists the built-ins that apps often write by hand, such as migrations, SQLite backups, proxy sign-in, and deploys.
|
|
17
|
+
|
|
18
|
+
Coding agents don't load skills from `node_modules`. Install it into the project once, and again after `vitehub update`:
|
|
19
|
+
|
|
20
|
+
```sh
|
|
21
|
+
npx skills add ./node_modules/vite-hub/dist/skills/vitehub --agent claude-code codex
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
The CLI copies it to `.agents/skills/vitehub/`, where Codex loads it, and links it from `.claude/skills/vitehub/` for Claude Code. For a single task without installing it, tell the agent to read `node_modules/vite-hub/dist/skills/vitehub/SKILL.md` first.
|
|
25
|
+
|
|
14
26
|
## Install
|
|
15
27
|
|
|
16
28
|
```sh
|
|
@@ -25,10 +37,12 @@ pnpm add vite-hub
|
|
|
25
37
|
| `auth` | `@vite-hub/auth better-auth` |
|
|
26
38
|
| `blob` | `@vite-hub/blob` |
|
|
27
39
|
| `browser` | `@vite-hub/browser` |
|
|
28
|
-
| `channels` | `@vite-hub/channels` |
|
|
29
|
-
| `connections` | `@vite-hub/connections @vite-hub/database drizzle-orm` |
|
|
30
|
-
| `database`, and Connections or Comments, which turn Database on | `@vite-hub/database drizzle-orm
|
|
40
|
+
| `channels` | `@vite-hub/channels`, and `@vite-hub/agent` for built-in adapters from `vite-hub/channels/adapters` |
|
|
41
|
+
| `connections` | `@vite-hub/connections @vite-hub/database drizzle-orm@1.0.0-rc.5` |
|
|
42
|
+
| `database`, and Connections or Comments, which turn Database on | `@vite-hub/database drizzle-orm@1.0.0-rc.5` |
|
|
31
43
|
| `email` | `@vite-hub/email` |
|
|
44
|
+
| Forms | `@vite-hub/forms @vite-hub/database drizzle-orm@1.0.0-rc.5 valibot` |
|
|
45
|
+
| `i18n` | `@vite-hub/i18n` |
|
|
32
46
|
| `kv`, and `cache: { driver: "kv" }` | `@vite-hub/kv` |
|
|
33
47
|
| `queue` | `@vite-hub/queue` |
|
|
34
48
|
| `rateLimit` | `@vite-hub/rate-limit` |
|
|
@@ -36,23 +50,31 @@ pnpm add vite-hub
|
|
|
36
50
|
| `realtime` | `@vite-hub/realtime` |
|
|
37
51
|
| `sandboxTask` | `@vite-hub/sandbox` |
|
|
38
52
|
| `schedule` | `@vite-hub/schedule` |
|
|
53
|
+
| Sync | `@vite-hub/sync @vite-hub/database drizzle-orm@1.0.0-rc.5` |
|
|
54
|
+
| Webhooks | `@vite-hub/webhooks @vite-hub/queue @vite-hub/database drizzle-orm@1.0.0-rc.5` |
|
|
39
55
|
| `workflow` | `@vite-hub/workflow` |
|
|
40
56
|
| `workspace` | `@vite-hub/workspace`, and `@vite-hub/shell` for shell commands |
|
|
41
57
|
| `server/content.ts` | `@vite-hub/content`, and `@vite-hub/cms` for the `cms` preset |
|
|
42
58
|
| `server/comments.ts` | `@vite-hub/comments` |
|
|
43
59
|
| `.template.md` imports | `@vite-hub/markdown-template` |
|
|
44
|
-
| Console with Agents | `@libsql/client drizzle-orm` |
|
|
60
|
+
| Console with Agents | `@libsql/client drizzle-orm@1.0.0-rc.5` |
|
|
45
61
|
| Console MCP client (`console.mcpClient`) | `@modelcontextprotocol/sdk` |
|
|
46
62
|
| `vite-hub/choices` | `@vite-hub/choices` |
|
|
47
63
|
| `vite-hub/device` | `@vite-hub/device` |
|
|
48
64
|
| `vite-hub/forge` | `@vite-hub/forge` |
|
|
49
65
|
| `vite-hub/gateways` | `@vite-hub/gateways` |
|
|
50
66
|
| `vite-hub/ui` | `@vite-hub/ui` |
|
|
67
|
+
| `vite-hub/web-container` | `@vite-hub/web-container` |
|
|
51
68
|
| `vite-hub/console/ui` | `@vite-hub/ui @json-render/core @json-render/vue @vueuse/core` |
|
|
52
69
|
| `vite-hub/docs/*` | `@vite-hub/docs` |
|
|
53
70
|
| `vite-hub/presets/*` | `@vite-hub/presets` |
|
|
71
|
+
| `vitehub migrate` | `@vite-hub/codemods` as a development dependency |
|
|
72
|
+
|
|
73
|
+
If you use Database, including for Connections, Comments, Forms, Sync, or Webhooks, run `pnpm add -D drizzle-kit@1.0.0-rc.5` to generate migrations. With npm, pass `--save-exact` for pinned Drizzle RC packages so `package.json` keeps the exact version instead of a `^` range. For example, run `npm install --save-exact drizzle-orm@1.0.0-rc.5` and `npm install -D --save-exact drizzle-kit@1.0.0-rc.5`.
|
|
54
74
|
|
|
55
|
-
A build with an enabled feature whose package is missing fails with the `pnpm add` command to run.
|
|
75
|
+
A build with an enabled feature whose package is missing fails with the `pnpm add` command to run. Incompatible ViteHub packages fail the build; most other out-of-range peers only warn. An unsupported `drizzle-orm` version also fails the build with `VITE_HUB_PEER_VERSION_UNSUPPORTED` when Database is enabled or the build loads the Drizzle query adapter for Agent Invocations. Agent builds that do not load the adapter can keep an unrelated Drizzle version.
|
|
76
|
+
|
|
77
|
+
Vercel Workflow requires `@vercel/functions` for all definitions; add `workflow` and `@workflow/builders` for native durable definitions. See the [Workflow hosts guide](https://vitehub.dev/docs/workflows/hosts) for installation. Other provider SDKs, such as `@vercel/sandbox` for Sandbox Tasks, stay with their feature guides.
|
|
56
78
|
|
|
57
79
|
You need Node.js 24.15 or newer, Vite 8 or newer, and an ESM package with `"type": "module"` or a `vite.config.mts` file. Hosted primitives and model providers can also require credentials, network access, and billed accounts. Their feature guides list those requirements before the first provider call.
|
|
58
80
|
|
|
@@ -72,7 +94,7 @@ export default defineConfig({
|
|
|
72
94
|
|
|
73
95
|
This registers ViteHub's build integration. Your application still needs a server entry or a framework such as Nuxt. For Nuxt, use the `vite-hub/nuxt` module shown in the [installation guide](https://vitehub.dev/docs/getting-started/installation).
|
|
74
96
|
|
|
75
|
-
On Nuxt 5,
|
|
97
|
+
On Nuxt 5, server code imports ViteHub helpers such as `kv`, `db`, and `sendQueue` from their `vite-hub/*` paths. When the app turns on Nuxt's `experimental: { nitroAutoImports: true }`, the module also auto-imports the server helpers of each enabled feature. A name that the app or another module already gives keeps that source, and ViteHub logs one warning. Read [Nuxt server auto-imports](https://vitehub.dev/docs/frameworks-hosts/nuxt-server-auto-imports).
|
|
76
98
|
|
|
77
99
|
On a Node host with persistent storage, set `dataDir` once. Enabled Agent State, Agent Invocation journal, KV, Blob, and Workspace integrations derive local paths from it. For example, `vitehub({ host: "node", dataDir: "/var/lib/app", agent: true, kv: true, blob: true, workspace: true })` uses that directory without per-store environment variables. Relative paths resolve from the configuration process's working directory. The host must mount persistent storage there; `dataDir` does not create a volume. Other hosts require their own storage providers.
|
|
78
100
|
|
|
@@ -128,7 +150,7 @@ Discovered Database Definitions do not enable Database. Without `database`, impo
|
|
|
128
150
|
|
|
129
151
|
If an enabled capability is not supported by the host, the build fails. You can instead configure an explicit Blob driver through `blob` or compose an owner package directly when the application provides its own portable implementation.
|
|
130
152
|
|
|
131
|
-
|
|
153
|
+
On the Deno host, `schedule: true` writes static Schedules as `Deno.cron` registrations. The generated `.output/main.ts` loads them before the Nitro server. Use the default Agent runtime for deployed routes. The host rejects `agent.runtime: "deno"` because it generates a separate server outside the deployed entrypoint. See the [Deno host guide](https://vitehub.dev/docs/frameworks-hosts/deno).
|
|
132
154
|
|
|
133
155
|
The Deno host emits `.output/deno.json`, stages under `.output/node_modules` the packages that the server bundle keeps external and the Linux glibc binaries that bundled packages load at runtime, such as libSQL's native module, and writes `.output/deploy.mjs`, a non-interactive create-or-update runner used by the `node ./deploy.mjs` command in `.output/nitro.json`; set `DENO_DEPLOY_ORG` before deployment. The runner uses the resolved deployment identity as its app name, with `DENO_DEPLOY_APP` as an optional override, and uploads node modules when it creates or updates an app. The Node host emits a plain Node server artifact suitable for a VPS or container image; Docker is not a host.
|
|
134
156
|
|
|
@@ -153,7 +175,7 @@ Nitro output includes `.vitehub/nitro/error-log.mjs`. It logs each unhandled req
|
|
|
153
175
|
|
|
154
176
|
`vitehub({ redirects: { host: "example.com", https: true, trailingSlash: "remove" } })` sends every request to one canonical address in one redirect: `301` for `GET` and `HEAD`, `308` for other methods. `trailingSlash` changes page paths only. `vite dev`, local names, IP addresses, and preview hosts such as `*.workers.dev` (add more with `previewHosts`) keep their host and scheme. On Cloudflare, ViteHub sets `assets.run_worker_first` so static files redirect too. Move single pages with Nitro `routeRules`. On Cloudflare, ViteHub also writes their redirects to the static `_redirects` file, after the lines of `public/_redirects`. See [Redirect to one canonical address](https://vitehub.dev/docs/frameworks-hosts/redirects).
|
|
155
177
|
|
|
156
|
-
`vitehub({ health: true })` adds `/_vitehub/health` for load balancers and container health checks, on every host. It answers `{ ok: true, version, commit, vitehub }`, where `version` is the app's `package.json` version, `commit` is the commit of the build from the CI or host variables, else from Git, else `null`, and `vitehub` is the installed `vite-hub` version. It checks each Database (`SELECT 1`), each KV store (one read), and each Blob store (opens the root directory on `fs`, lists up to one object on `s3` with `s3:ListBucket`, and checks object metadata on other drivers) of the app, with 2 seconds for each, and answers `503` with `ok: false` when one fails, for example `{ ok: false, commit, vitehub, checks: { database: { default: true }, kv: { default: false } } }`. The error goes to the server log, never to the response. `health: { route: "/api/health" }` moves the route.
|
|
178
|
+
`vitehub({ health: true })` adds `/_vitehub/health` for load balancers and container health checks, on every host. It answers `{ ok: true, version, commit, vitehub }`, where `version` is the app's `package.json` version, `commit` is the commit of the build from the CI or host variables, else from Git, else `null`, and `vitehub` is the installed `vite-hub` version. It checks each Database (`SELECT 1`), each KV store (one read), and each Blob store (opens the root directory on `fs`, lists up to one object on `s3` with `s3:ListBucket`, and checks object metadata on other drivers) of the app, with 2 seconds for each, and answers `503` with `ok: false` when one fails, for example `{ ok: false, commit, vitehub, checks: { database: { default: true }, kv: { default: false } } }`. The error goes to the server log, never to the response. `health: { route: "/api/health" }` moves the route. `health: { checks: ["database"] }` checks only the Database: list any of `"database"`, `"kv"`, and `"blob"`, or `[]` for none. A listed primitive that the app does not turn on fails the build.
|
|
157
179
|
|
|
158
180
|
`vitehub({ publicUrl, seo: { sitemap: true } })` serves `/sitemap.xml` and `/robots.txt` on every host. The sitemap lists the Nuxt pages without a dynamic part, the static prerender routes, the published Content pages with a URL, and the pages that `server/sitemap.ts` returns with `defineSitemap()` from `vite-hub/seo`. `exclude` leaves path prefixes out, and `pages: false` keeps only Content and `server/sitemap.ts` entries. URLs start with `publicUrl`, else the request origin; a build that prerenders the files needs `publicUrl` (`SEO_PUBLIC_URL_MISSING`). `robots: { disallow }` adds `Disallow` lines. ViteHub keeps the app's own `public/robots.txt`, and a server route for `/sitemap.xml` fails the build with `SEO_SITEMAP_ROUTE_EXISTS`. See [Sitemap and robots.txt](https://vitehub.dev/docs/frameworks-hosts/sitemap).
|
|
159
181
|
|
|
@@ -263,7 +285,7 @@ Built-in Agent Drivers and Sandbox runtimes are selected by literal or tagged va
|
|
|
263
285
|
|
|
264
286
|
## Record Agent invocations
|
|
265
287
|
|
|
266
|
-
An app with Nitro-hosted Agents records their invocations in the default journal, with the Console on or off. It is local SQLite at `.vitehub/data/agent-invocations.sqlite`, or `agent-invocations.sqlite` next to a `file:` Agent State database on the node host, or the D1 binding of the default Database Definition in a Cloudflare production build
|
|
288
|
+
An app with Nitro-hosted Agents records their invocations in the default journal, with the Console on or off. It is local SQLite at `.vitehub/data/agent-invocations.sqlite`, or `agent-invocations.sqlite` next to a `file:` Agent State database on the node host, or the D1 binding of the default Database Definition in a Cloudflare production build, or the Postgres `default` Database in a node production build without `databaseUrl` or `dataDir`. The Console only reads it. The Netlify host and `agent.runtime: "deno"` require `agent.invocations: false` and journals configured on each Agent Definition; they reject an omitted or configured app-wide journal with `VITE_HUB_R0132`. Set the default journal options in `agent.invocations`:
|
|
267
289
|
|
|
268
290
|
```ts
|
|
269
291
|
import { vitehub } from "vite-hub"
|
|
@@ -279,9 +301,9 @@ vitehub({
|
|
|
279
301
|
})
|
|
280
302
|
```
|
|
281
303
|
|
|
282
|
-
`databaseUrl` takes a `file:` or libSQL URL, and `VITEHUB_AGENT_INVOCATIONS_DATABASE_URL` overrides it at runtime, with `VITEHUB_AGENT_INVOCATIONS_DATABASE_AUTH_TOKEN` for an authenticated endpoint. `retention` takes `maxAge`, `maxRecords`, and `maxSize`. The SQLite journal keeps every terminal record by default; the D1
|
|
304
|
+
`databaseUrl` takes a `file:` or libSQL URL, and `VITEHUB_AGENT_INVOCATIONS_DATABASE_URL` overrides it at runtime, with `VITEHUB_AGENT_INVOCATIONS_DATABASE_AUTH_TOKEN` for an authenticated endpoint. `retention` takes `maxAge`, `maxRecords`, and `maxSize`. The SQLite journal keeps every terminal record by default; the D1 and Postgres journals default to 30 days and 10,000 terminal records and do not support `maxSize`. On a Worker without D1 or a remote URL, the journal stays in memory. `console.databaseUrl`, `console.retention`, `console.observations`, and `VITEHUB_CONSOLE_DATABASE_URL` are removed and fail with a message that names the new option. ViteHub does not move records from the old `.vitehub/data/console.sqlite` file. See [the default journal](https://vitehub.dev/docs/agents/invocation-storage#use-the-default-journal).
|
|
283
305
|
|
|
284
|
-
`getAgentInvocations()` from `vite-hub/agent` returns the app-wide journal. `await getAgentInvocationsDatabase()` from `vite-hub/agent/invocations/drizzle` opens Drizzle over the default journal on first use, for queries and atomic writes such as `db.batch()` on D1. Check the returned `driver` before destructuring to narrow the D1 or libSQL database and schema types. D1 inserts require non-null `search` and `summary`; libSQL reads allow null while legacy rows await backfill. The D1 `db.transaction()` method rejects before the callback runs. It resolves to `undefined` for another journal store, for `agent.invocations: false`,
|
|
306
|
+
`getAgentInvocations()` from `vite-hub/agent` returns the app-wide journal. `await getAgentInvocationsDatabase()` from `vite-hub/agent/invocations/drizzle` opens Drizzle over the default journal on first use, for queries and atomic writes such as `db.batch()` on D1. Check the returned `driver` before destructuring to narrow the D1 or libSQL database and schema types. D1 inserts require non-null `search` and `summary`; libSQL reads allow null while legacy rows await backfill. The D1 `db.transaction()` method rejects before the callback runs. It resolves to `undefined` for another journal store, for `agent.invocations: false`, for the in-memory journal of a Worker, and for the default journal in a Postgres Database.
|
|
285
307
|
|
|
286
308
|
Set `invocations` on an Agent Definition to record into another journal, such as the app's Database:
|
|
287
309
|
|
|
@@ -298,6 +320,8 @@ Set `agent: { invocations: "database" }` in the `vitehub()` options to give ever
|
|
|
298
320
|
|
|
299
321
|
The store uses a discovered ViteHub Database and creates its journal tables on first use. It supports local SQLite and hosted libSQL through Drizzle, plus native Cloudflare D1. D1 over HTTP is rejected by a read-only probe before schema creation or writes because its raw query results do not contain column names. The `database` option defaults to `default`.
|
|
300
322
|
|
|
323
|
+
On a Postgres Database, the store does not create tables. ViteHub adds `vitehub_agent_invocations` and `vitehub_agent_invocations_observations` to that Database, so `vitehub database generate` writes their migration and `vitehub database migrate` applies it. Without the tables, the first journal operation fails with `AGENT_INVOCATION_POSTGRES_TABLES_MISSING`. Claims expire by the database clock, so several Node instances can share one journal.
|
|
324
|
+
|
|
301
325
|
Retention defaults to 30 days and 10,000 terminal records. To change a limit, pass `createDatabaseAgentInvocationStore({ maxAge, maxRecords })` from `vite-hub/agent/invocations/database` to `defineAgentInvocations({ store })` from `vite-hub/agent/server`. Set either limit to `false` to disable it. The Console shows a configured journal but does not own its retention settings.
|
|
302
326
|
|
|
303
327
|
## Invoke Agents from the Console
|
|
@@ -326,7 +350,7 @@ All Console paths use the application base: an explicit ViteHub application base
|
|
|
326
350
|
|
|
327
351
|
The Console route takes only signed requests on `POST /_vitehub/rpc`. Each caller has an Ed25519 key pair. The app reads the public keys from `VITEHUB_CONSOLE_KEY_<NAME>` variables of the host environment on each request, on Cloudflare from the Worker `env`. A key is 43 base64url characters, the raw 32-byte public key. The ViteHub Console makes one key pair for each linked app and shows its line. `vitehub secret console-key [name]` makes one for the CLI, which signs with `VITEHUB_CONSOLE_PRIVATE_KEY_<NAME>`. A request carries two headers: `x-vitehub-signature: key=<NAME>, t=<seconds>, origin=<app origin>, body=<SHA-256>, v1=<signature>` and `x-vitehub-caller`, the base64url JSON of who calls. The Ed25519 signature covers `vitehub-signature-v1`, the method, the path and query, the app origin, the time, the key name, the SHA-256 of the exact body bytes, and the caller header, one per line. The app origin is `vitehub({ publicUrl })` when it is set, else the URL of the request as the host routed it; `Host` and `X-Forwarded-*` headers never count. The app refuses a time more than 5 minutes off. Refusals are `401` with `CONSOLE_SIGNATURE_MISSING`, `CONSOLE_SIGNATURE_STALE`, `CONSOLE_SIGNATURE_ORIGIN`, `CONSOLE_KEY_UNKNOWN`, `CONSOLE_SIGNATURE_INVALID`, or `CONSOLE_SIGNATURE_BODY`. No key, or a malformed one, is `500` with `CONSOLE_KEY_NOT_CONFIGURED` or `CONSOLE_KEY_MALFORMED`. Bearer tokens and cookies never count. Rotate a key by adding a key with a new name, then removing the old variable. See [Sign Console requests](https://vitehub.dev/docs/console/signed-requests).
|
|
328
352
|
|
|
329
|
-
A call without a signature, with `auth: false` or on a dev server without a `console` option, must come from the app origin, or send `x-vitehub-console: 1` without an `Origin` header, so a foreign page cannot call it without a CORS preflight. Browsers cannot call the Console route from another origin. Each Console operation is one stateless `POST /_vitehub/rpc` request with one birpc call as its JSON body, `{ "m": "<operation>", "a": [input], "t": "q", "i": "<id>" }`, and one birpc reply as its response, so hosts such as Cloudflare Workers can send consecutive calls to different instances. The `project.get` operation (`vitehub project
|
|
353
|
+
A call without a signature, with `auth: false` or on a dev server without a `console` option, must come from the app origin, or send `x-vitehub-console: 1` without an `Origin` header, so a foreign page cannot call it without a CORS preflight. Browsers cannot call the Console route from another origin. Each Console operation is one stateless `POST /_vitehub/rpc` request with one birpc call as its JSON body, `{ "m": "<operation>", "a": [input], "t": "q", "i": "<id>" }`, and one birpc reply as its response, so hosts such as Cloudflare Workers can send consecutive calls to different instances. The `project.get` operation (`vitehub project get`) returns `{ protocol: 1, name, vitehub, build, comments, sections, operations }`: the `vite-hub` version, the time and Git commit of the production build, the open Comments count when available, and the installed sections and operations that `authorize` allows for the caller. The Console page also gets `navigation`, the answer of `sections.list`, so it opens a project with one call. It works without Agents. See [Read the project](https://vitehub.dev/docs/console/sections#read-the-project).
|
|
330
354
|
|
|
331
355
|
[console.vitehub.dev](https://console.vitehub.dev) is the Console app, [`@vite-hub/console`](../console). People sign in with GitHub or a passkey, link apps for their team, and the Console server signs each call with the key of the link. It calls apps from its server, so it cannot open a `vite dev` server on your machine; use the `vitehub` commands there. `hostedConsoleUrl(projectUrl, path)` from `vite-hub/runtime` builds a link to one page of a project, such as `https://console.vitehub.dev/open?project=<app URL>&path=/kv`. The Console opens that page of the app of your team with that URL, or Home when your team has not linked it.
|
|
332
356
|
|
|
@@ -344,11 +368,11 @@ Console image uploads require invocation to be enabled. The Console fixes the Ag
|
|
|
344
368
|
|
|
345
369
|
## Logs
|
|
346
370
|
|
|
347
|
-
`vite-hub/logs`
|
|
371
|
+
`vite-hub/logs` exports the read-only `LogSource` contract and a bounded local buffer (`createLogBuffer()`) for development inspection without adding an exporter. Import Evlog's logger API from `evlog`. Read the [Logs guide](https://vitehub.dev/docs/logs) and [Logs contract](src/logs/README.md) for retention, redaction and source ownership.
|
|
348
372
|
|
|
349
373
|
Logs has its own `logs` key. Turn it on with `vitehub({ console: { auth: false }, logs: true })` during local development. It attaches a bounded buffer to Evlog's existing drain and reuses an installed Evlog Nitro module. Pass `logs: { maxEntries: 256 }` to size the buffer, and `observability: { evlog: { redact: true } }` to configure Evlog when ViteHub owns its setup. If another integration already installed Evlog, configure the options there.
|
|
350
374
|
|
|
351
|
-
`observability: { browserErrors: true }` sends uncaught browser errors to `POST /_vitehub/browser-errors`, and the server logs each one as an error on the Evlog event of that request. A Vite app gets a script in `index.html`, and a Nuxt app a client plugin that also reports `vue:error` and `app:
|
|
375
|
+
`observability: { browserErrors: true }` sends uncaught browser errors to `POST /_vitehub/browser-errors`, and the server logs each one as an error on the Evlog event of that request. A Vite app gets a script in `index.html`, and a Nuxt app a client plugin that also reports `vue:error`, `app:error`, and `app:chunkError`. Both report chunks that fail to load. Send an error that the app catches, or a warning, with `reportBrowserError(error, { action, level, fields })` from `vite-hub/logs/client`. The route takes same-origin requests only, 16 KiB at most, and 20 reports a minute from one address. It is off by default. See [Log browser errors](https://vitehub.dev/docs/logs/configure#log-browser-errors).
|
|
352
376
|
|
|
353
377
|
For production, use `logs: { source: './server/logs.ts' }`. That server module must default-export a `LogSource` from `vite-hub/logs/source` that reads the existing backend. Without `observability`, this form starts no logger, buffer, SDK, or exporter. `logs: true` fails a production build because a temporary process buffer cannot provide shared production history. The source owns retention and cursor semantics and must apply each advertised filter.
|
|
354
378
|
|
|
@@ -1,10 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
/** One browser error, as the server logs it. */
|
|
1
|
+
type BrowserReportField = string | number | boolean | null;
|
|
2
|
+
/** One browser error or warning, as the server logs it. */
|
|
3
3
|
export interface BrowserErrorReport {
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* What caught it: a browser `error` or `unhandledrejection`, a failed asset load (`chunk`), Nuxt's `vue:error`
|
|
6
|
+
* and `app:error`, or `handled` for `reportBrowserError()`.
|
|
7
|
+
*/
|
|
5
8
|
kind: string;
|
|
6
9
|
/** The page path, without its query or hash. */
|
|
7
10
|
path: string;
|
|
11
|
+
/** Only a `handled` report can be a warning. */
|
|
12
|
+
level: "error" | "warn";
|
|
13
|
+
action?: string;
|
|
14
|
+
fields?: Record<string, BrowserReportField>;
|
|
15
|
+
/** How many fields the page or the server dropped because they were invalid or exceeded a limit. */
|
|
16
|
+
droppedFields?: number;
|
|
8
17
|
name: string;
|
|
9
18
|
message: string;
|
|
10
19
|
stack?: string;
|
|
@@ -18,5 +27,4 @@ export declare function createBrowserErrorsHandler(now?: () => number): {
|
|
|
18
27
|
declare const handler: {
|
|
19
28
|
fetch: (request: Request) => Promise<Response>;
|
|
20
29
|
};
|
|
21
|
-
//#endregion
|
|
22
30
|
export { handler as default };
|
|
@@ -1,35 +1,76 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { r as requestLog } from "../../browser-error-limits-B0yS95zt.js";
|
|
2
|
+
import { t as forwardedRequestOrigin } from "../../request-origin-pzWr9UUu.js";
|
|
2
3
|
import { getStandardContext } from "@vite-hub/runtime";
|
|
3
|
-
|
|
4
|
-
/** The largest report body. A report has one error, and its stack is cut to 4,000 characters. */
|
|
5
|
-
const maxBytes = 16384;
|
|
4
|
+
// src/_internal/runtime/browser-errors.ts
|
|
6
5
|
/** Reports from one address in one minute, per server process. */
|
|
7
6
|
const perMinute = 20;
|
|
8
7
|
const kinds = /* @__PURE__ */ new Set([
|
|
9
8
|
"error",
|
|
10
9
|
"unhandledrejection",
|
|
10
|
+
"chunk",
|
|
11
11
|
"vue",
|
|
12
|
-
"nuxt"
|
|
12
|
+
"nuxt",
|
|
13
|
+
"handled"
|
|
13
14
|
]);
|
|
15
|
+
const maxFields = 20;
|
|
16
|
+
const fieldName = /^[A-Za-z][\w.-]{0,39}$/;
|
|
14
17
|
/**
|
|
15
18
|
* The query and hash of each URL in a text: `?` or `#` after a path, and what follows. They hold searches and OAuth
|
|
16
19
|
* codes. "Why?" keeps its `?` because no `/` comes before it.
|
|
17
20
|
*/
|
|
18
21
|
const urlQuery = /[?#](?<=\/[^\s"'`<>()?#]*[?#])[^\s"'`<>()]+/g;
|
|
22
|
+
function cut(value, max) {
|
|
23
|
+
return value.slice(0, max * 2).replace(urlQuery, "").slice(0, max);
|
|
24
|
+
}
|
|
19
25
|
function text(value, max) {
|
|
20
|
-
return typeof value === "string" ? value
|
|
26
|
+
return typeof value === "string" ? cut(value, max) : void 0;
|
|
27
|
+
}
|
|
28
|
+
function isRecord(value) {
|
|
29
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
30
|
+
}
|
|
31
|
+
function parseFields(value) {
|
|
32
|
+
if (!isRecord(value)) return {
|
|
33
|
+
fields: {},
|
|
34
|
+
dropped: value === void 0 ? 0 : 1
|
|
35
|
+
};
|
|
36
|
+
const fields = {};
|
|
37
|
+
let kept = 0;
|
|
38
|
+
let dropped = 0;
|
|
39
|
+
for (const [name, field] of Object.entries(value)) {
|
|
40
|
+
const flat = typeof field === "string" || typeof field === "number" && Number.isFinite(field) || typeof field === "boolean" || field === null;
|
|
41
|
+
if (kept >= maxFields || !fieldName.test(name) || !flat) {
|
|
42
|
+
dropped++;
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
fields[name] = typeof field === "string" ? cut(field, 300) : field;
|
|
46
|
+
kept++;
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
fields,
|
|
50
|
+
dropped
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function pageDropped(value) {
|
|
54
|
+
return typeof value === "number" && Number.isInteger(value) && value > 0 && value <= 1e3 ? value : 0;
|
|
21
55
|
}
|
|
22
56
|
/** The report in a request body, with each field cut to size. `undefined` when the body is not a report. */
|
|
23
57
|
function parseBrowserErrorReport(body) {
|
|
24
|
-
if (
|
|
58
|
+
if (!isRecord(body)) return void 0;
|
|
25
59
|
const kind = Reflect.get(body, "kind");
|
|
26
60
|
const path = Reflect.get(body, "path");
|
|
27
61
|
const message = text(Reflect.get(body, "message"), 1e3);
|
|
28
62
|
if (typeof kind !== "string" || !kinds.has(kind) || typeof path !== "string" || !path.startsWith("/") || message === void 0) return void 0;
|
|
63
|
+
const action = text(Reflect.get(body, "action"), 100);
|
|
64
|
+
const { fields, dropped } = parseFields(Reflect.get(body, "fields"));
|
|
65
|
+
const droppedFields = dropped + pageDropped(Reflect.get(body, "droppedFields"));
|
|
29
66
|
const stack = text(Reflect.get(body, "stack"), 4e3);
|
|
30
67
|
return {
|
|
31
68
|
kind,
|
|
32
69
|
path: path.split(/[?#]/, 1)[0].slice(0, 300),
|
|
70
|
+
level: kind === "handled" && Reflect.get(body, "level") === "warn" ? "warn" : "error",
|
|
71
|
+
...action ? { action } : {},
|
|
72
|
+
...Object.keys(fields).length > 0 ? { fields } : {},
|
|
73
|
+
...droppedFields > 0 ? { droppedFields } : {},
|
|
33
74
|
name: text(Reflect.get(body, "name"), 120) || "Error",
|
|
34
75
|
message,
|
|
35
76
|
...stack ? { stack } : {}
|
|
@@ -67,34 +108,36 @@ function minuteLimit(now) {
|
|
|
67
108
|
return entry.count > perMinute ? Math.ceil((entry.resetAt - time) / 1e3) : void 0;
|
|
68
109
|
};
|
|
69
110
|
}
|
|
70
|
-
/** Evlog's Nitro plugin puts the wide event of each request on `request.context.log`. */
|
|
71
|
-
function requestLogger(request) {
|
|
72
|
-
const context = Reflect.get(request, "context");
|
|
73
|
-
const log = context !== null && typeof context === "object" ? Reflect.get(context, "log") : void 0;
|
|
74
|
-
if (log === null || typeof log !== "object") return void 0;
|
|
75
|
-
const error = Reflect.get(log, "error");
|
|
76
|
-
return typeof error === "function" ? { error: (value, fields) => Reflect.apply(error, log, [value, fields]) } : void 0;
|
|
77
|
-
}
|
|
78
111
|
/**
|
|
79
|
-
* Write the report into the request's wide event at
|
|
112
|
+
* Write the report into the request's wide event at its level, so it goes through the redaction, sampling, and drains
|
|
80
113
|
* of the app's Evlog setup, next to the server's own events. Without Evlog, the server console gets it.
|
|
81
114
|
*/
|
|
82
115
|
function logReport(request, report) {
|
|
83
|
-
const { kind, path, name, message, stack } = report;
|
|
84
|
-
const log =
|
|
116
|
+
const { kind, path, level, action, fields, droppedFields, name, message, stack } = report;
|
|
117
|
+
const log = requestLog(request);
|
|
85
118
|
if (!log) {
|
|
86
|
-
console.
|
|
119
|
+
if (level === "warn") console.warn("[vitehub] Browser warning", report);
|
|
120
|
+
else console.error("[vitehub] Browser error", report);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const browserError = {
|
|
124
|
+
kind,
|
|
125
|
+
path,
|
|
126
|
+
level,
|
|
127
|
+
...action ? { action } : {},
|
|
128
|
+
...fields ? { fields } : {},
|
|
129
|
+
...droppedFields ? { droppedFields } : {}
|
|
130
|
+
};
|
|
131
|
+
if (level === "warn") {
|
|
132
|
+
log.warn(message, { browserError });
|
|
87
133
|
return;
|
|
88
134
|
}
|
|
89
135
|
const error = Object.assign(new Error(message), { name });
|
|
90
136
|
error.stack = stack ?? `${name}: ${message}`;
|
|
91
|
-
log.error(error, { browserError
|
|
92
|
-
kind,
|
|
93
|
-
path
|
|
94
|
-
} });
|
|
137
|
+
log.error(error, { browserError });
|
|
95
138
|
}
|
|
96
139
|
/**
|
|
97
|
-
* The body as text, or `undefined` when it passes
|
|
140
|
+
* The body as text, or `undefined` when it passes the byte limit. It stops reading and cancels the body at the limit, so a
|
|
98
141
|
* body without `Content-Length` cannot make the server hold more than that.
|
|
99
142
|
*/
|
|
100
143
|
async function readBoundedText(request) {
|
|
@@ -106,7 +149,7 @@ async function readBoundedText(request) {
|
|
|
106
149
|
const { done, value } = await reader.read();
|
|
107
150
|
if (done) break;
|
|
108
151
|
size += value.byteLength;
|
|
109
|
-
if (size >
|
|
152
|
+
if (size > 16384) {
|
|
110
153
|
await reader.cancel();
|
|
111
154
|
return;
|
|
112
155
|
}
|
|
@@ -136,7 +179,7 @@ function createBrowserErrorsHandler(now = Date.now) {
|
|
|
136
179
|
if (!sameOrigin(request)) return reply(403);
|
|
137
180
|
const retryAfter = limit(clientAddress(request));
|
|
138
181
|
if (retryAfter !== void 0) return reply(429, { "retry-after": String(retryAfter) });
|
|
139
|
-
if (Number(request.headers.get("content-length")) >
|
|
182
|
+
if (Number(request.headers.get("content-length")) > 16384) return reply(413);
|
|
140
183
|
const body = await readBoundedText(request);
|
|
141
184
|
if (body === void 0) return reply(413);
|
|
142
185
|
let json;
|
|
@@ -152,5 +195,4 @@ function createBrowserErrorsHandler(now = Date.now) {
|
|
|
152
195
|
} };
|
|
153
196
|
}
|
|
154
197
|
const handler = createBrowserErrorsHandler();
|
|
155
|
-
//#endregion
|
|
156
198
|
export { createBrowserErrorsHandler, handler as default, parseBrowserErrorReport };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/_internal/runtime/redirects.d.ts
|
|
2
1
|
/** The resolved `vitehub({ redirects })` options that the generated code passes. */
|
|
3
2
|
export interface RedirectsPolicy {
|
|
4
3
|
/** The canonical host name, in lower case. */
|
|
@@ -34,4 +33,4 @@ export declare function installRedirects(nitroApp: NitroAppLike, policy: Redirec
|
|
|
34
33
|
* between the asset binding and dynamic routes. The binding itself may return an SPA fallback for missing files.
|
|
35
34
|
*/
|
|
36
35
|
export declare function withCloudflareRedirects<Handler extends WorkerHandler>(handler: Handler, policy: RedirectsPolicy): Handler & WorkerHandler;
|
|
37
|
-
|
|
36
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as forwardedRequestOrigin } from "../../request-origin-
|
|
2
|
-
|
|
1
|
+
import { t as forwardedRequestOrigin } from "../../request-origin-pzWr9UUu.js";
|
|
2
|
+
// src/_internal/runtime/redirects.ts
|
|
3
3
|
const ipv4 = /^\d{1,3}(?:\.\d{1,3}){3}$/;
|
|
4
4
|
/**
|
|
5
5
|
* Tells if a request to `hostname` keeps its host and scheme: a local name (`localhost`, `*.localhost`, a name without a
|
|
@@ -67,5 +67,4 @@ function withCloudflareRedirects(handler, policy) {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
|
-
//#endregion
|
|
71
70
|
export { canonicalRedirect, installRedirects, withCloudflareRedirects };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
//#region src/_internal/runtime/request-policy.d.ts
|
|
2
1
|
/** The request options of `vitehub({ trustProxy, sameOriginWrites })` that the generated Nitro plugin passes. */
|
|
3
2
|
export interface RequestPolicyOptions {
|
|
4
3
|
trustProxy?: boolean;
|
|
4
|
+
trustProxyAddress?: boolean;
|
|
5
5
|
/** Path prefixes that skip the same-origin check, or `false` for no check. */
|
|
6
6
|
sameOriginWrites?: false | {
|
|
7
7
|
exclude: string[];
|
|
@@ -27,6 +27,15 @@ interface NitroAppLike {
|
|
|
27
27
|
* request, such as Better Auth, sees `https:` too. It never changes the host, and never turns `https:` into `http:`.
|
|
28
28
|
*/
|
|
29
29
|
export declare function trustForwardedProto(event: RequestEventLike): void;
|
|
30
|
+
/**
|
|
31
|
+
* Behind a proxy, the server sees the proxy as the peer. A proxy adds the address of its own peer, the client, at the end
|
|
32
|
+
* of `X-Forwarded-For`, so this makes the last value the request's `ip`. Standard Context `runtime.clientAddress`, H3's
|
|
33
|
+
* `getRequestIP()`, and Auth's rate limiter and `session.ipAddress` read it. Earlier values come from the client, so
|
|
34
|
+
* they are never read.
|
|
35
|
+
*/
|
|
36
|
+
export declare function trustForwardedFor(event: RequestEventLike): void;
|
|
37
|
+
/** The Node `request` hook of `trustProxy`: the protocol and client address the proxy sends. */
|
|
38
|
+
export declare function trustProxyHeaders(event: RequestEventLike): void;
|
|
30
39
|
/**
|
|
31
40
|
* Tells if a request is a browser write from another origin that carries cookies: an unsafe method, a `Cookie`
|
|
32
41
|
* header, and `Sec-Fetch-Site` other than `same-origin` or `none`, or an `Origin` other than the request origin. The
|
|
@@ -40,4 +49,4 @@ export declare function isCrossOriginWrite(request: Pick<Request, "headers" | "m
|
|
|
40
49
|
* write gets 403 before any middleware or route runs.
|
|
41
50
|
*/
|
|
42
51
|
export declare function installRequestPolicy(nitroApp: NitroAppLike, options: RequestPolicyOptions): void;
|
|
43
|
-
|
|
52
|
+
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as forwardedRequestOrigin } from "../../request-origin-
|
|
2
|
-
|
|
1
|
+
import { t as forwardedRequestOrigin } from "../../request-origin-pzWr9UUu.js";
|
|
2
|
+
// src/_internal/runtime/request-policy.ts
|
|
3
3
|
const safeMethods = /* @__PURE__ */ new Set([
|
|
4
4
|
"GET",
|
|
5
5
|
"HEAD",
|
|
@@ -14,6 +14,25 @@ function trustForwardedProto(event) {
|
|
|
14
14
|
if (event.url.protocol !== "http:") return;
|
|
15
15
|
if (event.req.headers.get("x-forwarded-proto")?.split(",", 1)[0]?.trim().toLowerCase() === "https") event.url.protocol = "https:";
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* Behind a proxy, the server sees the proxy as the peer. A proxy adds the address of its own peer, the client, at the end
|
|
19
|
+
* of `X-Forwarded-For`, so this makes the last value the request's `ip`. Standard Context `runtime.clientAddress`, H3's
|
|
20
|
+
* `getRequestIP()`, and Auth's rate limiter and `session.ipAddress` read it. Earlier values come from the client, so
|
|
21
|
+
* they are never read.
|
|
22
|
+
*/
|
|
23
|
+
function trustForwardedFor(event) {
|
|
24
|
+
const address = event.req.headers.get("x-forwarded-for")?.split(",").map((value) => value.trim()).findLast(Boolean);
|
|
25
|
+
if (address) Object.defineProperty(event.req, "ip", {
|
|
26
|
+
configurable: true,
|
|
27
|
+
enumerable: true,
|
|
28
|
+
value: address
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
/** The Node `request` hook of `trustProxy`: the protocol and client address the proxy sends. */
|
|
32
|
+
function trustProxyHeaders(event) {
|
|
33
|
+
trustForwardedProto(event);
|
|
34
|
+
trustForwardedFor(event);
|
|
35
|
+
}
|
|
17
36
|
function excluded(pathname, exclude) {
|
|
18
37
|
return exclude.some((prefix) => {
|
|
19
38
|
const path = prefix.endsWith("/") ? prefix.slice(0, -1) : prefix;
|
|
@@ -49,14 +68,14 @@ function crossOriginWriteResponse() {
|
|
|
49
68
|
*/
|
|
50
69
|
function installRequestPolicy(nitroApp, options) {
|
|
51
70
|
if (options.trustProxy && nitroApp.hooks) {
|
|
71
|
+
const hook = options.trustProxyAddress ? trustProxyHeaders : trustForwardedProto;
|
|
52
72
|
const requestHooks = nitroApp.hooks._hooks?.request;
|
|
53
|
-
if (Array.isArray(requestHooks)) requestHooks.unshift(
|
|
54
|
-
else nitroApp.hooks.hook("request",
|
|
73
|
+
if (Array.isArray(requestHooks)) requestHooks.unshift(hook);
|
|
74
|
+
else nitroApp.hooks.hook("request", hook);
|
|
55
75
|
}
|
|
56
76
|
const sameOriginWrites = options.sameOriginWrites;
|
|
57
77
|
const fetch = nitroApp.fetch;
|
|
58
78
|
if (!sameOriginWrites || !(fetch instanceof Function)) return;
|
|
59
79
|
nitroApp.fetch = (request, ...rest) => isCrossOriginWrite(request, sameOriginWrites.exclude) ? crossOriginWriteResponse() : Reflect.apply(fetch, nitroApp, [request, ...rest]);
|
|
60
80
|
}
|
|
61
|
-
|
|
62
|
-
export { installRequestPolicy, isCrossOriginWrite, trustForwardedProto };
|
|
81
|
+
export { installRequestPolicy, isCrossOriginWrite, trustForwardedFor, trustForwardedProto, trustProxyHeaders };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/_internal/runtime/security.d.ts
|
|
2
1
|
/** The resolved `vitehub({ security })` options that the generated Nitro plugin passes. */
|
|
3
2
|
export interface SecurityPolicy {
|
|
4
3
|
/** Header names and values to add to every response that does not set the header itself. */
|
|
@@ -24,4 +23,4 @@ export declare function addSecurityHeaders(response: Response, headers: Security
|
|
|
24
23
|
* dispatch through the Fetch bridge, which also keeps native handlers behind these controls.
|
|
25
24
|
*/
|
|
26
25
|
export declare function installSecurity(nitroApp: NitroAppLike, policy: SecurityPolicy): void;
|
|
27
|
-
|
|
26
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { defineDiagnostics } from "nostics";
|
|
2
2
|
import { HTTPError } from "nitro/h3";
|
|
3
3
|
import { limitRequestBody } from "srvx/body-limit";
|
|
4
|
-
|
|
4
|
+
// src/_internal/runtime/security.ts
|
|
5
5
|
const securityDiagnostics = /*#__PURE__*/ defineDiagnostics({
|
|
6
6
|
docsBase: "https://vitehub.dev/docs/development/diagnostics",
|
|
7
7
|
codes: { VITE_HUB_REQUEST_BODY_TOO_LARGE: {
|
|
@@ -36,6 +36,20 @@ function declaredLength(request) {
|
|
|
36
36
|
return value && /^\d+$/.test(value) ? Number(value) : 0;
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
39
|
+
* srvx's `limitRequestBody()` reads `formData()` and `blob()` from a `Response` without the request headers, so a form
|
|
40
|
+
* loses its `multipart/form-data` boundary and `formData()` throws. These two reads keep the headers. The other reads
|
|
41
|
+
* and `body` go to srvx, which counts the bytes.
|
|
42
|
+
*/
|
|
43
|
+
function limitBody(request, limit) {
|
|
44
|
+
const limited = limitRequestBody(request, limit, { createError: bodyTooLargeError });
|
|
45
|
+
if (limited === request) return request;
|
|
46
|
+
return new Proxy(limited, { get(target, prop) {
|
|
47
|
+
if (prop === "formData" || prop === "blob") return async () => new Response(target.body, { headers: request.headers })[prop]();
|
|
48
|
+
if (prop === "clone") return () => limitBody(request.clone(), limit);
|
|
49
|
+
return Reflect.get(target, prop);
|
|
50
|
+
} });
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
39
53
|
* Adds each header that the response does not set itself, so a route that sets a stricter value, such as
|
|
40
54
|
* `X-Frame-Options: DENY`, keeps it. A WebSocket upgrade (101) is left as it is.
|
|
41
55
|
*/
|
|
@@ -67,7 +81,7 @@ function installSecurity(nitroApp, policy) {
|
|
|
67
81
|
let input = request;
|
|
68
82
|
if (maxBodySize !== void 0) {
|
|
69
83
|
if (declaredLength(request) > maxBodySize) return addSecurityHeaders(bodyTooLargeResponse(maxBodySize), headers);
|
|
70
|
-
input =
|
|
84
|
+
input = limitBody(request, maxBodySize);
|
|
71
85
|
}
|
|
72
86
|
if (request.runtime?.node) {
|
|
73
87
|
let body = null;
|
|
@@ -100,5 +114,4 @@ function installSecurity(nitroApp, policy) {
|
|
|
100
114
|
return headers.length > 0 ? addSecurityHeaders(response, headers) : response;
|
|
101
115
|
};
|
|
102
116
|
}
|
|
103
|
-
//#endregion
|
|
104
117
|
export { addSecurityHeaders, bodyTooLargeResponse, installSecurity };
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { r as consoleDiagnosticBody } from "./diagnostics-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { c as isConsoleDevelopmentRuntime, i as consoleRequestError } from "./request-
|
|
9
|
-
import { n as loadConsoleRuntime } from "./runtime-
|
|
1
|
+
import { l as operationListed, o as operationAccessAllows } from "./operations-CD_mu_Ww.js";
|
|
2
|
+
import { a as installedConsoleAccessPolicy, n as consoleAuthorizedSections, t as consoleAuthorizedGrants } from "./access-policy-BM48XstY.js";
|
|
3
|
+
import { r as consoleDiagnosticBody, t as consoleDiagnostic } from "./diagnostics-B2cqlCSz.js";
|
|
4
|
+
import { t as viteHubErrorDiagnostics } from "./error-diagnostics-CBtvqI30.js";
|
|
5
|
+
import { c as readConsolePublicKeys, i as isViteHubLoopbackPeer, l as verifyConsoleSignature } from "./dev-peer-DBq-isgi.js";
|
|
6
|
+
import { r as operationRpcPath } from "./operation-rpc-BMdfapja.js";
|
|
7
|
+
import { i as isConsoleDevelopmentBuild } from "./development-DD567hhJ.js";
|
|
8
|
+
import { c as isConsoleDevelopmentRuntime, i as consoleRequestError } from "./request-CQ8TkHLh.js";
|
|
9
|
+
import { n as loadConsoleRuntime } from "./runtime-CyPZMiyK.js";
|
|
10
|
+
import { formatDiagnostic } from "nostics";
|
|
10
11
|
import { getStandardContext } from "@vite-hub/runtime/internal/h3";
|
|
11
12
|
import { defineGrant } from "@vite-hub/runtime/internal/grant";
|
|
12
13
|
import { isRuntimeResponse } from "@vite-hub/runtime/internal/runtime-type";
|
|
13
14
|
import { resolvePublicUrl } from "@vite-hub/runtime";
|
|
14
|
-
|
|
15
|
+
// src/console/runtime/server/console-signature.ts
|
|
15
16
|
/** The `401` or `500` of a refused signature, with the Console diagnostic fields. */
|
|
16
17
|
function consoleSignatureRejection(status, code, message) {
|
|
17
18
|
return Response.json({
|
|
@@ -28,6 +29,13 @@ function consoleSignatureRejection(status, code, message) {
|
|
|
28
29
|
status
|
|
29
30
|
});
|
|
30
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Print a setup failure of the app, such as a malformed `VITEHUB_CONSOLE_KEY_<NAME>`, in the server log, as an
|
|
34
|
+
* unhandled error prints. Only the caller gets the coded `500`, so without this line the host log shows nothing.
|
|
35
|
+
*/
|
|
36
|
+
function logSetupFailure(code, message) {
|
|
37
|
+
globalThis.console.error(formatDiagnostic(consoleDiagnostic(code, message)));
|
|
38
|
+
}
|
|
31
39
|
/** The host environment of this request: the Cloudflare `env`, then `process.env` for the names it does not set. */
|
|
32
40
|
function requestEnv(event) {
|
|
33
41
|
return {
|
|
@@ -62,10 +70,13 @@ function isConsoleRpcPath(pathname) {
|
|
|
62
70
|
*/
|
|
63
71
|
async function checkConsoleSignature(request, event) {
|
|
64
72
|
const keys = readConsolePublicKeys(requestEnv(event));
|
|
65
|
-
if (!(keys instanceof Map))
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
73
|
+
if (!(keys instanceof Map)) {
|
|
74
|
+
logSetupFailure(keys.code, keys.message);
|
|
75
|
+
return {
|
|
76
|
+
ok: false,
|
|
77
|
+
response: consoleSignatureRejection(keys.status, keys.code, keys.message)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
69
80
|
const url = new URL(request.url);
|
|
70
81
|
if (request.method !== "POST" || !isConsoleRpcPath(url.pathname)) return {
|
|
71
82
|
ok: false,
|
|
@@ -81,9 +92,11 @@ async function checkConsoleSignature(request, event) {
|
|
|
81
92
|
ok: false,
|
|
82
93
|
response: consoleSignatureRejection(401, "CONSOLE_SIGNATURE_MISSING", "This request is not signed.")
|
|
83
94
|
};
|
|
95
|
+
const message = "Signed requests on Node require vitehub({ publicUrl }) to identify this deployment. The request Host cannot supply its identity.";
|
|
96
|
+
logSetupFailure("CONSOLE_SIGNATURE_ORIGIN", message);
|
|
84
97
|
return {
|
|
85
98
|
ok: false,
|
|
86
|
-
response: consoleSignatureRejection(500, "CONSOLE_SIGNATURE_ORIGIN",
|
|
99
|
+
response: consoleSignatureRejection(500, "CONSOLE_SIGNATURE_ORIGIN", message)
|
|
87
100
|
};
|
|
88
101
|
}
|
|
89
102
|
const verified = await verifyConsoleSignature({
|
|
@@ -99,8 +112,7 @@ async function checkConsoleSignature(request, event) {
|
|
|
99
112
|
};
|
|
100
113
|
return verified;
|
|
101
114
|
}
|
|
102
|
-
|
|
103
|
-
//#region src/console/runtime/server/loopback.ts
|
|
115
|
+
// src/console/runtime/server/loopback.ts
|
|
104
116
|
const loopbackHosts = /* @__PURE__ */ new Set([
|
|
105
117
|
"localhost",
|
|
106
118
|
"127.0.0.1",
|
|
@@ -123,8 +135,7 @@ async function isConsoleLoopbackRequest(request, context) {
|
|
|
123
135
|
const forwarded = request.headers.get("x-forwarded-host");
|
|
124
136
|
return isLoopbackHost(hostHeader) && (!forwarded || isLoopbackHost(forwarded)) && await isViteHubLoopbackPeer(request, context.remoteAddress);
|
|
125
137
|
}
|
|
126
|
-
|
|
127
|
-
//#region src/console/runtime/server/access.ts
|
|
138
|
+
// src/console/runtime/server/access.ts
|
|
128
139
|
const consoleAccessGrant = defineGrant("vitehub.console.access", (mode) => mode);
|
|
129
140
|
const checkedRequests = /* @__PURE__ */ new WeakMap();
|
|
130
141
|
const routeScopes = /* @__PURE__ */ new WeakMap();
|
|
@@ -435,5 +446,4 @@ function bindConsoleAccess(access, event) {
|
|
|
435
446
|
checkedRequests.set(request, access);
|
|
436
447
|
return event;
|
|
437
448
|
}
|
|
438
|
-
//#endregion
|
|
439
449
|
export { isConsoleRpcPath as _, consoleAccessWrites as a, consoleOperationGranted as c, consoleRequest as d, readConsoleAccessGrants as f, isConsoleLoopbackRequest as g, withConsoleAccess as h, consoleAccessInvoker as i, consolePerson as l, readConsoleOperationUser as m, bindConsoleAccess as n, consoleImpersonation as o, readConsoleAccessUser as p, consoleAccessAllows as r, consoleOperationAccess as s, allowedConsoleSections as t, consoleRealtimeAccess as u };
|