vite-hub 0.5.0 → 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/_internal/runtime/browser-errors.d.ts +0 -2
- package/dist/_internal/runtime/browser-errors.js +3 -4
- 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 +1 -2
- package/dist/_internal/runtime/request-policy.js +2 -3
- package/dist/_internal/runtime/security.d.ts +1 -2
- package/dist/_internal/runtime/security.js +1 -2
- package/dist/{access-BC9HtX_M.js → access-CUFHPi8T.js} +13 -140
- package/dist/{access-policy-DhsEACna.d.ts → access-DkBck8Vu.d.ts} +17 -21
- package/dist/{access-policy-CVZg9LPR.js → access-policy-BM48XstY.js} +5 -6
- package/dist/{account-Cjj-tYzo.d.ts → account-DNr8fHcQ.d.ts} +5 -7
- package/dist/{console/runtime/server → agent/console}/agents.get.d.ts +2 -3
- package/dist/{console/runtime/server → agent/console}/agents.get.js +3 -4
- package/dist/{console/runtime/server → agent/console}/channel-replay.d.ts +3 -5
- package/dist/{console/runtime/server → agent/console}/channel-replay.js +6 -7
- package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.d.ts +1 -3
- package/dist/{console/runtime/server → agent/console}/invocation-capabilities.get.js +4 -5
- package/dist/agent/console/invocation-workspace.get.d.ts +6 -0
- package/dist/{console/runtime/server → agent/console}/invocation-workspace.get.js +6 -7
- package/dist/{console/runtime/server → agent/console}/invocation.get.d.ts +4 -6
- package/dist/{console/runtime/server → agent/console}/invocation.get.js +8 -9
- package/dist/{console/runtime/server → agent/console}/invocations.get.d.ts +1 -2
- package/dist/{console/runtime/server → agent/console}/invocations.get.js +5 -6
- package/dist/agent/console/invocations.usage.d.ts +6 -0
- 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 -4
- package/dist/{console/runtime/server → agent/console}/status.get.js +6 -7
- package/dist/{server-W0c79AYZ.js → agent-console-CHsLxKk_.js} +4 -4
- package/dist/agent-console-FmaYpVv-.d.ts +14 -0
- package/dist/{agent-invocations.post-C3Onl2yH.js → agent-invocations.post-CF5anHY6.js} +14 -17
- package/dist/agents-DBm_PJie.js +1 -0
- package/dist/{agents-B76RICcy.js → agents-DXLHsE7x.js} +5 -6
- package/dist/{agents-C94A4N9u.d.ts → agents-Gyw4VKPt.d.ts} +0 -2
- package/dist/auth/console/auth.d.ts +25 -0
- package/dist/{console/runtime/server → auth/console}/auth.js +11 -13
- package/dist/auth/console/operations.d.ts +3 -0
- package/dist/auth/console/operations.js +135 -0
- package/dist/auth/server.js +1 -2
- package/dist/{auth-operations-GcQk0O0X.js → auth-operations-BKqoX8Ua.js} +4 -5
- package/dist/{auth-types-D3ugQ8xM.d.ts → auth-types-Cotn7406.d.ts} +4 -21
- package/dist/bin.js +8 -11
- package/dist/blob/console/operations.d.ts +3 -0
- package/dist/blob/console/operations.js +44 -0
- package/dist/blob/nuxt-image.js +1 -2
- package/dist/{blob-BcgsZtqM.js → blob-iw8pWQ6o.js} +5 -6
- package/dist/{blob-iVewd7KQ.d.ts → blob-uNin0_TV.d.ts} +1 -3
- package/dist/{browser-error-limits-CToqAD-O.js → browser-error-limits-B0yS95zt.js} +2 -4
- 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/{cli-config-FPHk1nbC.js → cli-config-BX8H4ZCo.js} +2 -3
- package/dist/cli-config-DgpmE_7z.js +1 -0
- package/dist/cms.js +1 -2
- package/dist/console/auth-types.d.ts +2 -2
- package/dist/console/auth.d.ts +2 -4
- package/dist/console/auth.js +2 -3
- package/dist/console/runtime/auth-operations.d.ts +4 -6
- 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 +29 -45
- package/dist/console/runtime/client/appearance.d.ts +1 -2
- package/dist/console/runtime/client/appearance.js +1 -2
- package/dist/console/runtime/client/auth-management.ts +6 -6
- 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 +3 -4
- 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 +7 -5
- package/dist/console/runtime/client/mcp-client.js +10 -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 +1 -1
- 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 -2
- 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 +83 -16
- package/dist/console/runtime/client/site-access.js +159 -32
- 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/stored.d.ts +1 -3
- package/dist/console/runtime/client/stored.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-home.vue +9 -7
- 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 +7 -2
- 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-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-hosted-comments-embed.vue +106 -0
- package/dist/console/runtime/components/console-mcp-callback.vue +6 -1
- package/dist/console/runtime/components/console-mcp-items.vue +3 -16
- package/dist/console/runtime/components/console-site.vue +10 -8
- package/dist/console/runtime/components/console-usage.vue +2 -2
- 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 +14 -49
- package/dist/console/runtime/mcp-client.d.ts +2 -2
- package/dist/console/runtime/mcp-client.js +1 -2
- 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/account.js +26 -0
- package/dist/console/runtime/page-tool/page-tool.js +2 -2
- package/dist/console/runtime/rpc.d.ts +1 -1
- package/dist/console/runtime/rpc.js +1 -2
- package/dist/console/runtime/sections.d.ts +2 -2
- 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/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 -2
- package/dist/console/runtime/server/database.d.ts +1 -1
- 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 +2 -2
- package/dist/console/runtime/server/documents.js +3 -3
- 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/env.d.ts +1 -3
- package/dist/console/runtime/server/env.js +1 -2
- 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/pill.d.ts +45 -0
- package/dist/console/runtime/server/pill.js +62 -0
- package/dist/console/runtime/server/rpc.d.ts +5 -10
- package/dist/console/runtime/server/rpc.js +19 -27
- package/dist/console/runtime/server/runtime.d.ts +1 -1
- package/dist/console/runtime/server/runtime.js +1 -2
- 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-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 -9
- package/dist/console/runtime/server/site-entry.js +62 -46
- 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/runtime/skills.d.ts +1 -3
- package/dist/console/runtime/skills.js +1 -2
- package/dist/console/server.d.ts +9 -25
- package/dist/console/server.js +8 -8
- package/dist/console/ui.d.ts +0 -10
- package/dist/console/ui.js +14 -27
- package/dist/console-lazy-views-VEjcbL4Q.js +1 -0
- package/dist/{console-route-CM2G5hiC.js → console-route-DbdnLkkF.js} +2 -3
- package/dist/console-signature--55DIKf2.js +237 -0
- package/dist/console.d.ts +1 -3
- package/dist/console.js +1 -2
- 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 +2 -3
- package/dist/{console/runtime/server → database/console}/database.get.js +4 -5
- package/dist/database/console/operations.d.ts +3 -0
- package/dist/database/console/operations.js +49 -0
- package/dist/{database-UMJgnU2z.js → database-CrgBUdIx.js} +3 -4
- package/dist/{database-DC67Ipm-.d.ts → database-yFezh5U1.d.ts} +1 -3
- package/dist/{definition-catalog-BUcclwSH.js → definition-catalog-1xPPtzOx.js} +3 -4
- 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-DTytrw42.js → definitions-DGo2rNQ9.js} +5 -6
- package/dist/{definitions-Dbgxfz3I.d.ts → definitions-DRkgHKmk.d.ts} +1 -3
- package/dist/{deployment-BUshgN5Q.js → deployment-CURATxjG.js} +2 -3
- package/dist/deployment-l7RuKdEp.js +1 -0
- package/dist/{dev-peer-CHjyHYG6.js → dev-peer-CRYp01PE.js} +2 -222
- package/dist/dev-peer-CX5C9243.js +1 -0
- package/dist/{development-zLxOp-AO.js → development-DD567hhJ.js} +2 -3
- package/dist/{development-RnopiRwK.d.ts → development-I40mfD7B.d.ts} +1 -3
- package/dist/{diagnostics-DtR0TAmq.js → diagnostics-DLHqjKGe.js} +3 -9
- package/dist/diagnostics-DgGKvWzF.d.ts +7 -0
- package/dist/docs/nuxt.js +1 -2
- package/dist/doctor.d.ts +0 -6
- package/dist/doctor.js +11492 -12152
- package/dist/{documents-BDR0AkYR.d.ts → documents-A-7Ho0g0.d.ts} +12 -16
- package/dist/{documents-B4R4JSfH.js → documents-BduuZjm3.js} +6 -6
- package/dist/{documents-BASIRZ91.d.ts → documents-CApMRd4o.d.ts} +4 -7
- package/dist/{documents-BewAPY61.js → documents-D6ueeoUR.js} +17 -21
- package/dist/durability/operations.d.ts +2 -4
- package/dist/durability/operations.js +3 -4
- package/dist/{entries-DbyNPLC9.js → entries-UFs9n1MB.js} +2 -3
- package/dist/{console/runtime/server → env/console}/env.get.d.ts +2 -4
- package/dist/env/console/env.get.js +15 -0
- 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/{env-Dg1I_DWr.js → env-D-wtSupz.js} +2 -3
- package/dist/{error-diagnostics-B1yAIaSn.js → error-diagnostics-CBtvqI30.js} +2 -7
- package/dist/{error-diagnostics-C0KyI408.js → error-diagnostics-kKXseq8d.js} +5 -2
- package/dist/error-diagnostics.ts +1 -7
- package/dist/{features-CC5OcZqJ.js → features-BXRKlmtN.js} +5 -6
- package/dist/features-CD5i5I8V.js +1 -0
- package/dist/{format-BOYlanIZ.js → format-Df-bS4Ly.js} +1 -2
- package/dist/{github-login-Bi3bfjRX.js → github-login-W-vaahWP.js} +1 -2
- 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 +1 -7
- package/dist/index.js +5 -7
- package/dist/{inspect-DbZuP_7b.js → inspect-CWwAuL-B.js} +2 -3
- 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-Cc9N0shU.d.ts → internal-BRNf11h3.d.ts} +14 -8
- package/dist/{invariant-DolT9EEx.js → invariant-Dj2R1eMr.js} +1 -2
- package/dist/{invocation-page-undo-DqYcPlkQ.js → invocation-page-undo-DHbXczWY.js} +8 -7
- package/dist/invocations-B60XWNES.js +45 -0
- package/dist/{limits-BUlwWYQE.js → limits-BLo31qDR.js} +1 -2
- package/dist/logs/client.d.ts +1 -3
- package/dist/logs/client.js +1 -2
- package/dist/{console/runtime/server → logs/console}/logs.get.d.ts +3 -5
- package/dist/{console/runtime/server → logs/console}/logs.get.js +7 -8
- package/dist/logs/console/operations.d.ts +3 -0
- package/dist/logs/console/operations.js +23 -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/loopback-Bl9Cvj1k.js +139 -0
- package/dist/mcp/eval.d.ts +1 -0
- package/dist/mcp/eval.js +2 -0
- package/dist/{mcp-client-C_sEmyQw.d.ts → mcp-client-uXVvS7RL.d.ts} +5 -10
- package/dist/{media-uKX4Wy-c.d.ts → media-C79RB1oH.d.ts} +0 -2
- package/dist/{media-D3OfyKni.js → media-CNwnh6CG.js} +8 -9
- package/dist/{media-library-o8RRsnn_.js → media-library-DTC8TLsZ.js} +5 -6
- package/dist/{media-library-D9ThbXqs.d.ts → media-library-DxGu6w9z.d.ts} +0 -2
- package/dist/{memory-C54SDH_l.js → memory-D3EJS_Bp.js} +3 -4
- package/dist/{memory-2bbl4hcV.d.ts → memory-GK5ZGWrp.d.ts} +1 -3
- package/dist/{nuxt-server-auto-imports-cfTZYvgy.js → nuxt-server-auto-imports-4aT5BD4u.js} +1 -2
- package/dist/{nuxt-server-imports-75bWMeXc.js → nuxt-server-imports-BdJqiVhT.js} +1 -2
- package/dist/nuxt.d.ts +1 -3
- package/dist/nuxt.js +276 -182
- package/dist/{object-D8pRdprI.js → object-DRSmpe04.js} +1 -2
- package/dist/{operation-contributions-C3lwePQu.js → operation-contributions-BU10k2QS.js} +9 -9
- package/dist/{operation-contributions-CrdmqtJW.d.ts → operation-contributions-xwjDzj28.d.ts} +6 -7
- package/dist/{operation-definition-DxjKcCGm.js → operation-definition-D04Rdjbe.js} +7 -9
- package/dist/operation-modules-BUXlwjvd.js +1 -0
- package/dist/operation-modules-DHWkPcfS.js +139 -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-D-7ljPqw.js +1 -0
- package/dist/{operations-TTjL_7Zc.d.ts → operations-DgFhA1WE.d.ts} +0 -4
- package/dist/{operations-CFYGXqLm.js → operations-DksTrRMb.js} +4 -5
- package/dist/operations-byxiZ2R2.js +113 -0
- package/dist/{optional-owners-O6sj4uoj.js → optional-owners-Cypch7V3.js} +4 -6
- package/dist/{out-fRNaVslw.js → out-Cw5Tvr92.js} +2933 -2301
- package/dist/{owned-paths-BnjT0FhU.js → owned-paths-MjjDftBn.js} +1 -2
- package/dist/page/pill.iife.js +2 -2
- 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/{pathe.M-eThtNZ-J4gfe1m9.js → pathe.M-eThtNZ-D4EC7Wue.js} +1 -2
- package/dist/{plugins-DoXnU6-s.d.ts → plugins-BmkOoyIh.d.ts} +25 -110
- package/dist/{plugins-BTZQaFtZ.js → plugins-DfXcUnzN.js} +1779 -1384
- package/dist/presets/workspace.js +1 -2
- package/dist/{project-Dgyq1F1V.d.ts → project-B2qWt8on.d.ts} +3 -12
- package/dist/{project-DlWTGB7h.js → project-DRC67Uiu.js} +1 -2
- package/dist/{project-DXZRZEPX.js → project-_juMSuAS.js} +8 -11
- package/dist/{project-link-DT99MoyU.js → project-link-CJbCkOlC.js} +7 -8
- package/dist/{project-link-bNS-KROO.d.ts → project-link-Ck3vuq9w.d.ts} +2 -4
- package/dist/{project-root-v6ba4tn7.js → project-root-mAVQGZTX.js} +1 -2
- package/dist/project-session-8pN7pRo8.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-CMA2UKKq.js → request-D769eiBL.js} +5 -6
- package/dist/{request-D7h3SQ92.d.ts → request-DYmjLTqP.d.ts} +2 -4
- package/dist/{request-SBLxvpyr.d.ts → request-DkoE0b2h.d.ts} +11 -4
- package/dist/{request-Cs0FqxEL.js → request-XFVx7CGC.js} +30 -9
- package/dist/{request-origin-COUkgHd6.js → request-origin-pzWr9UUu.js} +1 -2
- package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-DegdyBIC.js} +2 -3
- package/dist/{route-query-CRVWXIrc.js → route-query-BWVl6ZO6.js} +4 -5
- package/dist/routes-D02vxUSg.js +26 -0
- 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-B-46Bawt.js → runtime-CRJsqVTa.js} +2 -3
- package/dist/{runtime-DxfJOfCd.js → runtime-DA7HJe10.js} +3 -4
- package/dist/runtime-DGvimtvc.d.ts +5 -0
- package/dist/{runtime-CX_l_78I.js → runtime-F0CTqBFx.js} +5 -6
- package/dist/{runtime-feature-guard-CuyPVGj9.js → runtime-feature-guard-BKAMRZzM.js} +6 -7
- 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/search-jgMrZJXR.js +84 -0
- package/dist/{sections-DumoLKQN.js → sections-AUGy9EkY.js} +2 -8
- package/dist/{sections-BogiCmtz.d.ts → sections-BMkFB3S-.d.ts} +4 -6
- package/dist/{sections-C83x0slv.js → sections-BNTdIEJw.js} +2 -3
- package/dist/{sections-Do7X4Nwt.d.ts → sections-DCoCa4nF.d.ts} +1 -8
- package/dist/sections-DjeAUX7o.d.ts +8 -0
- package/dist/{sections-BKUReack.js → sections-ZFAlI4JW.js} +14 -7
- package/dist/{sections.get-H46e2urg.d.ts → sections.get-BY5dClJY.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/{setup-BC0P3eZy.d.ts → setup-BBnZPziq.d.ts} +5 -10
- package/dist/{setup-DNGzawFn.js → setup-yc3_WKNG.js} +4 -17
- 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.d.ts +1 -5
- package/dist/skills/operations.js +4 -5
- package/dist/{skills-DdpSMiCI.js → skills-C1MaGEbO.js} +1 -2
- package/dist/skills.d.ts +1 -2
- package/dist/{skills.get-CRd06TTb.js → skills.get-CW8vc_Hf.js} +3 -4
- package/dist/skills.js +1 -2
- package/dist/{source-Cw3iYvJF.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/ui/vite.js +1 -2
- package/dist/usage-DBi7aOhx.js +33 -0
- package/dist/{version-dkga9imp.js → version-DUCd7Orc.js} +24 -21
- package/dist/{vite-stage-D7fe614I.js → vite-stage-Dmo4RgnK.js} +3 -5
- package/dist/{vue-router-C68IU1jM.d.ts → vue-router-plZJLlpm.d.ts} +120 -182
- 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 -5
- package/dist/{console/runtime/server → workspace/console}/workspace-files.get.js +4 -5
- package/dist/{workspace-history-B95Q-kGI.js → workspace-history-B52xib2J.js} +3 -4
- package/dist/{workspace-history-CeVwBB6Q.d.ts → workspace-history-WuxgLsi4.d.ts} +0 -2
- package/package.json +158 -149
- package/dist/agents-BhFggA26.js +0 -2
- package/dist/auth-GFIN6xSJ.d.ts +0 -120
- package/dist/cli-config-g_mbWdjT.js +0 -2
- package/dist/cloudflare-env-lookup-DKXdr4P_.js +0 -16
- package/dist/console/runtime/client/ticket.d.ts +0 -2
- package/dist/console/runtime/client/ticket.js +0 -2
- package/dist/console/runtime/page/loader.js +0 -134
- package/dist/console/runtime/server/auth.d.ts +0 -2
- package/dist/console/runtime/server/env.get.js +0 -16
- package/dist/console/runtime/server/invocation-workspace.get.d.ts +0 -8
- package/dist/console/runtime/server/mcp-client-operations.d.ts +0 -5
- package/dist/console/runtime/server/mcp-client-operations.js +0 -139
- package/dist/console/runtime/server/page-auth.d.ts +0 -18
- package/dist/console/runtime/server/page-auth.js +0 -44
- 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 -5
- package/dist/console/runtime/server/search.get.d.ts +0 -4
- package/dist/console/runtime/server/search.get.js +0 -97
- package/dist/console/runtime/server/site-session.d.ts +0 -80
- package/dist/console/runtime/server/site-session.js +0 -2
- package/dist/console/runtime/server/tickets.d.ts +0 -2
- package/dist/console/runtime/server/tickets.js +0 -2
- package/dist/console/runtime/server/usage.get.d.ts +0 -10
- package/dist/console/runtime/server/usage.get.js +0 -92
- package/dist/console/runtime/site-access.d.ts +0 -2
- package/dist/console/runtime/site-access.js +0 -2
- package/dist/console-lazy-views-DXnIkdyd.js +0 -2
- package/dist/definition-catalog-og_1razf.js +0 -2
- package/dist/deployment-C2B0hBBj.js +0 -2
- package/dist/diagnostics-CjGiniKb.d.ts +0 -11
- package/dist/features-ujWsvlEH.js +0 -2
- package/dist/invocations-6jxqLkGY.js +0 -86
- package/dist/mcp-client-C91h8Taa.js +0 -1024
- package/dist/mcp-client-CTbTbn7d.js +0 -10
- package/dist/operations-5Lwd1xEI.js +0 -2
- package/dist/operations-ChEXk2ij.js +0 -853
- package/dist/page-tool-PmxH65gt.d.ts +0 -69
- package/dist/page-tools-ClgqElu-.js +0 -462
- package/dist/page-tools-DcCCtDKi.d.ts +0 -23
- package/dist/page-tools-shared-aNC9YtoI.js +0 -125
- package/dist/runtime-B_btezs1.d.ts +0 -7
- package/dist/scan-module-D_3X08mj.js +0 -2
- package/dist/secret-DELGKpCJ.js +0 -44
- package/dist/sections-CFiMNsqu.d.ts +0 -10
- package/dist/site-access-BycrwM2v.js +0 -18
- package/dist/site-access-CAiWyKOD.js +0 -2
- package/dist/site-access-DxfdOel1.d.ts +0 -55
- package/dist/site-access-L1qbvKt6.js +0 -293
- package/dist/site-session-CRwgKtTF.js +0 -300
- 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-DtBAstEU.js +0 -31
- package/dist/ticket-Pr_8ZtXW.d.ts +0 -14
- package/dist/tickets-DahBmKDT.js +0 -357
- package/dist/usage-CoQXs5nW.d.ts +0 -22
- package/dist/usage-index-VJAZ7a0p.js +0 -335
- package/dist/usage-jKtAgJZ0.js +0 -571
- /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
|
@@ -1,723 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import { o as consoleResponseError } from "../../../request-Cs0FqxEL.js";
|
|
3
|
-
import { c as reloadConsoleNavigation, d as seedConsoleNavigation, r as consoleSectionsPath } from "../../../sections-BKUReack.js";
|
|
4
|
-
import { c as consoleProjectProblem, u as probeConsoleProject } from "../../../project-link-DT99MoyU.js";
|
|
5
|
-
import { a as createConsoleProjectStore, i as consoleProjectsStorageKey, o as memoryProjectStorage, r as consoleProjectTarget, t as consoleProjectHost } from "../../../projects-CAcXztf4.js";
|
|
6
|
-
import { a as readStored, i as consoleProjectKey, r as consoleDeviceVersion, t as consoleAccountKey } from "../../../stored-Dhv2qsQv.js";
|
|
7
|
-
import { ref, shallowRef, watch } from "vue";
|
|
8
|
-
import { clearDevice, openDevice, setDeviceAccount } from "@vite-hub/device";
|
|
9
|
-
//#region src/console/runtime/client/project-session.ts
|
|
10
|
-
/** The pages of an `account` Console outside the projects. Each one has its own path, such as `/team`. */
|
|
11
|
-
const consoleAccountPages = [
|
|
12
|
-
"home",
|
|
13
|
-
"team",
|
|
14
|
-
"team-settings",
|
|
15
|
-
"env",
|
|
16
|
-
"settings"
|
|
17
|
-
];
|
|
18
|
-
function accountPageOf(pathname) {
|
|
19
|
-
const page = /^\/([a-z-]+)\/?$/.exec(pathname)?.[1];
|
|
20
|
-
return consoleAccountPages.find((item) => item === page);
|
|
21
|
-
}
|
|
22
|
-
let state;
|
|
23
|
-
let probeVersion = 0;
|
|
24
|
-
/** The `project.get` of the app of a `?app=<id>` link, sent while the account loads. */
|
|
25
|
-
let earlyProbe;
|
|
26
|
-
/** The `project.get` read of the open app. It lives until another app opens, so it can start over on the naming. */
|
|
27
|
-
let projectRead;
|
|
28
|
-
/** The page loads again: the first reload wins, so a sign-out and a read that starts over do not navigate twice. */
|
|
29
|
-
let reloading = false;
|
|
30
|
-
/** The project reads whose answer an `openConsoleProject()` call waits for. That call applies it, not `followProject()`. */
|
|
31
|
-
const awaited = /* @__PURE__ */ new Set();
|
|
32
|
-
/** The account read of an `account` Console. It lives as long as the page, and each answer names the device account. */
|
|
33
|
-
let accountRead;
|
|
34
|
-
/**
|
|
35
|
-
* The page opened from the account that the device kept. Only then does a stored `project.get` answer open the app:
|
|
36
|
-
* the stored answers belong to that account.
|
|
37
|
-
*/
|
|
38
|
-
let openedFromDevice = false;
|
|
39
|
-
let resolveReady;
|
|
40
|
-
const ready = new Promise((resolve) => {
|
|
41
|
-
resolveReady = resolve;
|
|
42
|
-
});
|
|
43
|
-
function useState() {
|
|
44
|
-
if (state) return state;
|
|
45
|
-
const opened = startConsoleProjects({
|
|
46
|
-
base: "",
|
|
47
|
-
home: "/_vitehub/",
|
|
48
|
-
mode: "embedded",
|
|
49
|
-
navigate: () => {},
|
|
50
|
-
pageOrigin: "http://localhost",
|
|
51
|
-
storage: memoryProjectStorage()
|
|
52
|
-
});
|
|
53
|
-
opened.gate.value = { kind: "ready" };
|
|
54
|
-
resolveReady?.();
|
|
55
|
-
return opened;
|
|
56
|
-
}
|
|
57
|
-
/** The project state of the page. `startConsoleProjects()` sets it before the app mounts. */
|
|
58
|
-
function useConsoleProjects() {
|
|
59
|
-
return useState();
|
|
60
|
-
}
|
|
61
|
-
/** Resolves when the Console may send requests to the project, after the boot gate opened it. */
|
|
62
|
-
function consoleProjectReady() {
|
|
63
|
-
return ready;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Where the requests of a project go. An `account` Console sends them to its own server, at `/p/<project id>`, with the
|
|
67
|
-
* session cookie of the Console. The server signs them for the project.
|
|
68
|
-
*/
|
|
69
|
-
function targetOf(projects, project) {
|
|
70
|
-
const target = consoleProjectTarget(project);
|
|
71
|
-
return projects.mode === "account" ? {
|
|
72
|
-
...target,
|
|
73
|
-
origin: "",
|
|
74
|
-
base: `/p/${encodeURIComponent(project.id)}`
|
|
75
|
-
} : target;
|
|
76
|
-
}
|
|
77
|
-
function applyTransport(target) {
|
|
78
|
-
const projects = useState();
|
|
79
|
-
if (projects.mode === "account") {
|
|
80
|
-
const app = projects.current.value ? consoleProjectTarget(projects.current.value) : void 0;
|
|
81
|
-
setConsoleProject({
|
|
82
|
-
...target,
|
|
83
|
-
...app ? { app: {
|
|
84
|
-
origin: app.origin,
|
|
85
|
-
base: app.base
|
|
86
|
-
} } : {},
|
|
87
|
-
remote: true
|
|
88
|
-
});
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
setConsoleProject(target);
|
|
92
|
-
}
|
|
93
|
-
/** Start the project state. Embedded mode opens the app of the page, at `base`. Account mode opens the active project. */
|
|
94
|
-
function startConsoleProjects(options) {
|
|
95
|
-
const store = createConsoleProjectStore(options.storage);
|
|
96
|
-
const projects = store.list();
|
|
97
|
-
let current;
|
|
98
|
-
if (options.mode === "embedded") {
|
|
99
|
-
const url = `${options.pageOrigin}${options.base}`;
|
|
100
|
-
current = store.find(url) ?? {
|
|
101
|
-
id: "",
|
|
102
|
-
url
|
|
103
|
-
};
|
|
104
|
-
} else {
|
|
105
|
-
current = store.active() ?? projects[0];
|
|
106
|
-
if (current && !store.active()) store.select(current.id);
|
|
107
|
-
}
|
|
108
|
-
const started = {
|
|
109
|
-
current: shallowRef(current),
|
|
110
|
-
gate: shallowRef(options.mode !== "embedded" && !current ? { kind: "empty" } : { kind: "opening" }),
|
|
111
|
-
account: shallowRef(),
|
|
112
|
-
openingView: "app",
|
|
113
|
-
home: options.home,
|
|
114
|
-
info: shallowRef(),
|
|
115
|
-
linkOpen: ref(false),
|
|
116
|
-
mode: options.mode,
|
|
117
|
-
names: shallowRef({}),
|
|
118
|
-
navigate: options.navigate,
|
|
119
|
-
pageOrigin: options.pageOrigin,
|
|
120
|
-
projects: shallowRef(projects),
|
|
121
|
-
statuses: shallowRef({}),
|
|
122
|
-
store
|
|
123
|
-
};
|
|
124
|
-
state = started;
|
|
125
|
-
if (options.mode === "embedded") applyTransport({
|
|
126
|
-
origin: "",
|
|
127
|
-
base: options.base
|
|
128
|
-
});
|
|
129
|
-
else if (current) applyTransport(targetOf(started, current));
|
|
130
|
-
return started;
|
|
131
|
-
}
|
|
132
|
-
function open(info) {
|
|
133
|
-
const projects = useState();
|
|
134
|
-
projects.info.value = info;
|
|
135
|
-
const current = projects.current.value;
|
|
136
|
-
if (current?.id) {
|
|
137
|
-
projects.statuses.value = {
|
|
138
|
-
...projects.statuses.value,
|
|
139
|
-
[current.id]: "ready"
|
|
140
|
-
};
|
|
141
|
-
rememberConsoleProjectName(current.id, info.name);
|
|
142
|
-
if (projects.mode === "account") rememberAccountProject(projects.account.value?.teamId, current.id);
|
|
143
|
-
}
|
|
144
|
-
if (info.navigation) seedConsoleNavigation(consoleSectionsPath, info.navigation);
|
|
145
|
-
else reloadConsoleNavigation(consoleSectionsPath);
|
|
146
|
-
projects.gate.value = { kind: "ready" };
|
|
147
|
-
resolveReady?.();
|
|
148
|
-
}
|
|
149
|
-
/** The `project.get` read of a project of an `account` Console. The device keeps its answer for the next visit. */
|
|
150
|
-
function readProject(id) {
|
|
151
|
-
return readStored(consoleProjectKey(id), ({ signal }) => probeConsoleProject({
|
|
152
|
-
origin: "",
|
|
153
|
-
base: `/p/${encodeURIComponent(id)}`
|
|
154
|
-
}, { signal }));
|
|
155
|
-
}
|
|
156
|
-
/** Embedded mode opens the app whatever it answers. Account mode shows the setup step or why the project did not open. */
|
|
157
|
-
function gateOf(probe, target) {
|
|
158
|
-
if (probe.kind === "ready") return void 0;
|
|
159
|
-
const projects = useState();
|
|
160
|
-
if (projects.mode === "embedded") return void 0;
|
|
161
|
-
if (probe.kind === "signed" || probe.kind === "missing" || probe.kind === "failed" && probe.code === "CONSOLE_KEY_NOT_CONFIGURED") {
|
|
162
|
-
const linked = projects.account.value?.projects.find((project) => project.url === target.url);
|
|
163
|
-
if (linked) return {
|
|
164
|
-
kind: "setup",
|
|
165
|
-
project: linked
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
return {
|
|
169
|
-
kind: "problem",
|
|
170
|
-
problem: consoleProjectProblem(probe, {
|
|
171
|
-
host: consoleProjectHost(target),
|
|
172
|
-
url: target.url
|
|
173
|
-
})
|
|
174
|
-
};
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Read `project.get` of the current project and open it, or set the gate that says what it needs. An `account` Console
|
|
178
|
-
* opens at once from the answer that the device kept, then applies the answer of this visit: another navigation, or
|
|
179
|
-
* the step that the project needs now.
|
|
180
|
-
*/
|
|
181
|
-
async function openConsoleProject() {
|
|
182
|
-
const projects = useState();
|
|
183
|
-
const current = projects.current.value;
|
|
184
|
-
if (!current) {
|
|
185
|
-
projects.gate.value = { kind: "empty" };
|
|
186
|
-
return;
|
|
187
|
-
}
|
|
188
|
-
const version = ++probeVersion;
|
|
189
|
-
projects.gate.value = { kind: "opening" };
|
|
190
|
-
const early = earlyProbe;
|
|
191
|
-
earlyProbe = void 0;
|
|
192
|
-
if (early && early.id !== current.id) early.read.stop();
|
|
193
|
-
let probe;
|
|
194
|
-
if (projects.mode === "embedded") probe = await probeConsoleProject({
|
|
195
|
-
...consoleProjectTarget(current),
|
|
196
|
-
origin: ""
|
|
197
|
-
});
|
|
198
|
-
else {
|
|
199
|
-
let read = projectRead?.id === current.id ? projectRead.read : void 0;
|
|
200
|
-
if (read) read.read.refresh();
|
|
201
|
-
else {
|
|
202
|
-
projectRead?.read.stop();
|
|
203
|
-
read = early?.id === current.id ? early.read : readProject(current.id);
|
|
204
|
-
projectRead = {
|
|
205
|
-
id: current.id,
|
|
206
|
-
read
|
|
207
|
-
};
|
|
208
|
-
followProject(read, current);
|
|
209
|
-
if (openedFromDevice && read.stored?.kind === "ready") open(read.stored.info);
|
|
210
|
-
}
|
|
211
|
-
awaited.add(read);
|
|
212
|
-
try {
|
|
213
|
-
probe = await read.answer();
|
|
214
|
-
} finally {
|
|
215
|
-
awaited.delete(read);
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
if (projects !== state || version !== probeVersion || projects.current.value !== current) return;
|
|
219
|
-
applyProbe(probe, current);
|
|
220
|
-
}
|
|
221
|
-
/**
|
|
222
|
-
* Apply each later answer of the `project.get` read of the open app: the read starts over when the page names its
|
|
223
|
-
* account, or when another tab clears the device or signs in as another person.
|
|
224
|
-
*/
|
|
225
|
-
function followProject(read, current) {
|
|
226
|
-
const projects = useState();
|
|
227
|
-
watch(read.read.status, (status) => {
|
|
228
|
-
if (status !== "success" || awaited.has(read) || !read.read.data.value) return;
|
|
229
|
-
if (projects !== state || projectRead?.read !== read || projects.current.value !== current) return;
|
|
230
|
-
const gate = projects.gate.value.kind;
|
|
231
|
-
if (gate === "home" || gate === "account" || gate === "empty") return;
|
|
232
|
-
applyProbe(read.read.data.value, current);
|
|
233
|
-
}, { flush: "sync" });
|
|
234
|
-
}
|
|
235
|
-
/** Open the project with its `project.get` answer, or set the gate that says what it needs. */
|
|
236
|
-
function applyProbe(probe, current) {
|
|
237
|
-
const projects = useState();
|
|
238
|
-
const gate = gateOf(probe, consoleProjectTarget(current));
|
|
239
|
-
if (gate) {
|
|
240
|
-
projects.gate.value = gate;
|
|
241
|
-
return;
|
|
242
|
-
}
|
|
243
|
-
if (probe.kind === "ready") open(probe.info);
|
|
244
|
-
else {
|
|
245
|
-
projects.gate.value = { kind: "ready" };
|
|
246
|
-
resolveReady?.();
|
|
247
|
-
}
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Make a project of the team active and load the Console for it. Before the Console shows a project, it opens the
|
|
251
|
-
* project in place.
|
|
252
|
-
*/
|
|
253
|
-
function switchConsoleProject(id) {
|
|
254
|
-
const projects = useState();
|
|
255
|
-
projects.store.select(id);
|
|
256
|
-
if (projects.mode === "account") rememberAccountProject(projects.account.value?.teamId, id);
|
|
257
|
-
const project = projects.store.get(id);
|
|
258
|
-
if (projects.gate.value.kind === "ready" || !project) {
|
|
259
|
-
projects.navigate(projects.home);
|
|
260
|
-
return;
|
|
261
|
-
}
|
|
262
|
-
projects.current.value = project;
|
|
263
|
-
projects.projects.value = projects.store.list();
|
|
264
|
-
applyTransport(targetOf(projects, project));
|
|
265
|
-
openConsoleProject();
|
|
266
|
-
}
|
|
267
|
-
/** Unlink a project from the team of an `account` Console. The project itself does not change. */
|
|
268
|
-
async function forgetConsoleProject(id) {
|
|
269
|
-
const projects = useState();
|
|
270
|
-
if (projects.mode !== "account" || !projects.store.get(id)) return;
|
|
271
|
-
const { unlinkConsoleAccountProject } = await import("./account.js");
|
|
272
|
-
await unlinkConsoleAccountProject(id);
|
|
273
|
-
reloadConsoleAccount();
|
|
274
|
-
}
|
|
275
|
-
/** Read `project.get` of every project of the team, for the status dots of the switcher. */
|
|
276
|
-
async function checkConsoleProjects() {
|
|
277
|
-
const projects = useState();
|
|
278
|
-
const list = projects.store.list();
|
|
279
|
-
projects.projects.value = list;
|
|
280
|
-
const opened = projects.gate.value.kind === "ready" ? projects.current.value?.id : void 0;
|
|
281
|
-
const pending = list.filter((project) => project.id !== opened);
|
|
282
|
-
projects.statuses.value = {
|
|
283
|
-
...projects.statuses.value,
|
|
284
|
-
...Object.fromEntries(pending.map((project) => [project.id, "checking"]))
|
|
285
|
-
};
|
|
286
|
-
await Promise.all(pending.map(async (project) => {
|
|
287
|
-
const stored = projects.mode === "account" ? readProject(project.id) : void 0;
|
|
288
|
-
if (stored?.stored?.kind === "ready") rememberConsoleProjectName(project.id, stored.stored.info.name);
|
|
289
|
-
const probe = await (stored ? stored.answer() : probeConsoleProject(targetOf(projects, project))).catch(() => ({ kind: "unreachable" }));
|
|
290
|
-
stored?.stop();
|
|
291
|
-
const status = probe.kind === "ready" ? "ready" : probe.kind === "signed" ? "sign-in" : "unreachable";
|
|
292
|
-
projects.statuses.value = {
|
|
293
|
-
...projects.statuses.value,
|
|
294
|
-
[project.id]: status
|
|
295
|
-
};
|
|
296
|
-
if (probe.kind === "ready") rememberConsoleProjectName(project.id, probe.info.name);
|
|
297
|
-
}));
|
|
298
|
-
}
|
|
299
|
-
/** Keep the name that a project of an `account` Console reported, for `consoleProjectDisplayName()`. */
|
|
300
|
-
function rememberConsoleProjectName(id, name) {
|
|
301
|
-
const projects = useState();
|
|
302
|
-
const value = name?.trim();
|
|
303
|
-
if (projects.mode !== "account" || !value || projects.names.value[id] === value) return;
|
|
304
|
-
projects.names.value = {
|
|
305
|
-
...projects.names.value,
|
|
306
|
-
[id]: value
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
/**
|
|
310
|
-
* The name that the Console shows for a project: the label that the person gave the link, else the name that the app
|
|
311
|
-
* reports in `project.get`, else the host. The app reports its `package.json` name, such as `acme-docs`, so the label
|
|
312
|
-
* wins.
|
|
313
|
-
*/
|
|
314
|
-
function consoleProjectDisplayName(project) {
|
|
315
|
-
return project.label || useState().names.value[project.id] || consoleProjectHost(project);
|
|
316
|
-
}
|
|
317
|
-
/**
|
|
318
|
-
* The name of the open project. An `account` Console shows the label of the link first, like
|
|
319
|
-
* `consoleProjectDisplayName()`. Otherwise it is `reported`, the name that the app reports, else the name in `project.get`.
|
|
320
|
-
*/
|
|
321
|
-
function consoleOpenProjectName(reported) {
|
|
322
|
-
const projects = useState();
|
|
323
|
-
return (projects.mode === "account" ? projects.current.value?.label : void 0) || reported || projects.info.value?.name;
|
|
324
|
-
}
|
|
325
|
-
/** Only owners and admins of a team link and unlink its apps. */
|
|
326
|
-
function canManageConsoleProjects(account) {
|
|
327
|
-
return account.roles.includes("owner") || account.roles.includes("admin");
|
|
328
|
-
}
|
|
329
|
-
const accountProjectKey = (teamId) => `vitehub-console:account-project:${teamId}`;
|
|
330
|
-
/** The project that an `account` Console opens next for a team, kept in this browser. */
|
|
331
|
-
function rememberAccountProject(teamId, projectId) {
|
|
332
|
-
if (!teamId) return;
|
|
333
|
-
try {
|
|
334
|
-
globalThis.localStorage?.setItem(accountProjectKey(teamId), projectId);
|
|
335
|
-
} catch {}
|
|
336
|
-
}
|
|
337
|
-
function rememberedAccountProject(teamId) {
|
|
338
|
-
if (!teamId) return void 0;
|
|
339
|
-
try {
|
|
340
|
-
return globalThis.localStorage?.getItem(accountProjectKey(teamId)) ?? void 0;
|
|
341
|
-
} catch {
|
|
342
|
-
return;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
/**
|
|
346
|
-
* Start an `account` Console: read the session, then the projects of the active team from the Console server. Without
|
|
347
|
-
* a session, or on an `/invite/<id>` page, the gate shows the sign-in page.
|
|
348
|
-
*/
|
|
349
|
-
/** A project URL as the Console compares it: the origin and the mount, without a trailing slash. */
|
|
350
|
-
function comparableProjectUrl(value) {
|
|
351
|
-
try {
|
|
352
|
-
const url = new URL(value);
|
|
353
|
-
return `${url.origin}${url.pathname.replace(/\/_vitehub(?:\/.*)?$/, "").replace(/\/+$/, "")}`;
|
|
354
|
-
} catch {
|
|
355
|
-
return;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
/**
|
|
359
|
-
* The app and the page of a link from `hostedConsoleUrl()`, `/open?project=<app URL>&path=<Console path>`, among the
|
|
360
|
-
* projects of the team. `undefined` when the link names no project of the team, or a path that is not a Console page.
|
|
361
|
-
*/
|
|
362
|
-
function consoleOpenLink(search, projects) {
|
|
363
|
-
const query = new URLSearchParams(search);
|
|
364
|
-
const project = comparableProjectUrl(query.get("project") ?? "");
|
|
365
|
-
const raw = query.get("path") ?? "/";
|
|
366
|
-
if (!project || !raw.startsWith("/") || raw.startsWith("//") || raw.includes("\\")) return void 0;
|
|
367
|
-
const path = raw.replace(/^\/_vitehub(?=\/|$)/, "") || "/";
|
|
368
|
-
const match = projects.find((candidate) => comparableProjectUrl(candidate.url) === project);
|
|
369
|
-
return match ? {
|
|
370
|
-
id: match.id,
|
|
371
|
-
path
|
|
372
|
-
} : void 0;
|
|
373
|
-
}
|
|
374
|
-
/**
|
|
375
|
-
* The app page and state of an `/open` link from `GET /_vitehub`, `/open?project=<app URL>&site=<page>&state=<state>`,
|
|
376
|
-
* or `undefined` for another link. `page` is a path of the app below its base, such as `/runs/42`.
|
|
377
|
-
*/
|
|
378
|
-
function consoleSiteLink(search) {
|
|
379
|
-
const query = new URLSearchParams(search);
|
|
380
|
-
const url = comparableProjectUrl(query.get("project") ?? "");
|
|
381
|
-
const page = query.get("site");
|
|
382
|
-
const state = query.get("state") ?? "";
|
|
383
|
-
if (!url || page === null || !/^[\w-]{43}$/.test(state)) return void 0;
|
|
384
|
-
if (!page.startsWith("/") || page.startsWith("//") || page.includes("\\")) return void 0;
|
|
385
|
-
return {
|
|
386
|
-
url,
|
|
387
|
-
page,
|
|
388
|
-
state
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
/**
|
|
392
|
-
* The address of an `/open` link that the Console opens again after a sign-in, such as
|
|
393
|
-
* `/open?project=https%3A%2F%2Fapp.example.com&path=%2Fkv`. It keeps only the project and the path of the link.
|
|
394
|
-
* `undefined` when the link names no project URL or a path that is not a Console page.
|
|
395
|
-
*/
|
|
396
|
-
function consoleOpenReturnPath(home, search) {
|
|
397
|
-
const query = new URLSearchParams(search);
|
|
398
|
-
const project = query.get("project") ?? "";
|
|
399
|
-
const path = query.get("path") ?? "/";
|
|
400
|
-
if (!comparableProjectUrl(project) || !path.startsWith("/") || path.startsWith("//") || path.includes("\\")) return void 0;
|
|
401
|
-
const site = consoleSiteLink(search);
|
|
402
|
-
const back = site ? `&site=${encodeURIComponent(site.page)}&state=${site.state}` : "";
|
|
403
|
-
return `${home.replace(/\/+$/, "")}/open?project=${encodeURIComponent(project)}&path=${encodeURIComponent(path)}${back}`;
|
|
404
|
-
}
|
|
405
|
-
/** The `/invite/<id>` page: the invitation id, or `undefined` on another page. */
|
|
406
|
-
function consoleInvitationOf(pathname) {
|
|
407
|
-
const match = /^\/invite\/([^/]+)\/?$/.exec(pathname);
|
|
408
|
-
return match ? decodeURIComponent(match[1]) : void 0;
|
|
409
|
-
}
|
|
410
|
-
/** The boot read of an `account` Console (`@vite-hub/console`, server/api/account.get.ts). */
|
|
411
|
-
const consoleAccountPath = "/api/account";
|
|
412
|
-
/**
|
|
413
|
-
* The signed-in account, its teams, and the projects of its team, with one session check, or `undefined` before
|
|
414
|
-
* sign-in. With a session cookie, the page HTML already started this request.
|
|
415
|
-
*/
|
|
416
|
-
async function loadConsoleAccount() {
|
|
417
|
-
const response = await fetch(consoleAccountPath, { credentials: "same-origin" });
|
|
418
|
-
if (response.status === 401 || response.status === 403) return void 0;
|
|
419
|
-
if (!response.ok) throw await consoleResponseError(response);
|
|
420
|
-
return await response.json();
|
|
421
|
-
}
|
|
422
|
-
/**
|
|
423
|
-
* The query of an `/open` link with the hash of the address in its `site` page. A browser keeps the hash of
|
|
424
|
-
* `<app>/_vitehub/<page>#<hash>` through the redirects to the Console, and a page of the app reads its hash itself.
|
|
425
|
-
*/
|
|
426
|
-
function withSiteHash(search, hash) {
|
|
427
|
-
const query = new URLSearchParams(search);
|
|
428
|
-
const site = query.get("site");
|
|
429
|
-
if (!hash || hash === "#" || site === null || site.includes("#")) return search;
|
|
430
|
-
query.set("site", `${site}${hash}`);
|
|
431
|
-
return `?${query}`;
|
|
432
|
-
}
|
|
433
|
-
/**
|
|
434
|
-
* Start an `account` Console. Returns the address that the page shows before its router reads it: the page of an
|
|
435
|
-
* `/open` link, or `undefined` to keep the address.
|
|
436
|
-
*
|
|
437
|
-
* With a session cookie, the page opens at once from the account and the `project.get` answer that the device kept
|
|
438
|
-
* from the last visit of this account, then reads both again. When the new answers open another page, such as for
|
|
439
|
-
* another person, another team, or an app that the team unlinked, the Console deletes the stored answers and loads
|
|
440
|
-
* the page again.
|
|
441
|
-
*/
|
|
442
|
-
async function startConsoleAccount(options) {
|
|
443
|
-
showAccountPath = options.showPath;
|
|
444
|
-
await openDevice({ version: consoleDeviceVersion });
|
|
445
|
-
const signedIn = options.boot === "app" || options.boot === "shell";
|
|
446
|
-
const read = readStored(consoleAccountKey, loadConsoleAccount, { account: (account) => account?.user.id ?? null });
|
|
447
|
-
accountRead = read;
|
|
448
|
-
const stored = signedIn && read.stored && opensFromStored(read.stored, options) ? read.stored : void 0;
|
|
449
|
-
const linked = new URLSearchParams(options.search ?? "").get("app");
|
|
450
|
-
if (signedIn && !stored && linked && !accountPageOf(options.pathname)) earlyProbe = {
|
|
451
|
-
id: linked,
|
|
452
|
-
read: readProject(linked)
|
|
453
|
-
};
|
|
454
|
-
if (stored) {
|
|
455
|
-
openedFromDevice = true;
|
|
456
|
-
const address = startAccountState(stored, options);
|
|
457
|
-
followConsoleAccount(read, options);
|
|
458
|
-
return address;
|
|
459
|
-
}
|
|
460
|
-
const address = startAccountState(await read.answer().catch(() => void 0), options);
|
|
461
|
-
followConsoleAccount(read, options);
|
|
462
|
-
return address;
|
|
463
|
-
}
|
|
464
|
-
/**
|
|
465
|
-
* Apply each later answer of the account read: the answer of this visit after a stored account, and the answer after
|
|
466
|
-
* another tab signed out, signed in as another person, or cleared the device, when the read starts over.
|
|
467
|
-
*/
|
|
468
|
-
function followConsoleAccount(read, options) {
|
|
469
|
-
watch(read.read.status, (status) => {
|
|
470
|
-
if (status === "success" && accountRead === read) refreshConsoleAccount(read.read.data.value, options);
|
|
471
|
-
});
|
|
472
|
-
}
|
|
473
|
-
/** Set the projects of the account and the gate of the page. Returns the address that the page shows. */
|
|
474
|
-
function startAccountState(account, options) {
|
|
475
|
-
let storage = memoryProjectStorage();
|
|
476
|
-
let missingApp = false;
|
|
477
|
-
let address;
|
|
478
|
-
const openPath = options.pathname.replace(/\/+$/, "") === `${options.home.replace(/\/+$/, "")}/open`;
|
|
479
|
-
const search = openPath ? withSiteHash(options.search ?? "", options.hash ?? "") : options.search ?? "";
|
|
480
|
-
const site = openPath ? consoleSiteLink(search) : void 0;
|
|
481
|
-
let siteGate;
|
|
482
|
-
if (account) {
|
|
483
|
-
const home = options.home.replace(/\/+$/, "");
|
|
484
|
-
const openLink = options.pathname.replace(/\/+$/, "") === `${home}/open`;
|
|
485
|
-
const opened = openLink ? consoleOpenLink(search, account.projects) : void 0;
|
|
486
|
-
if (opened && !site) address = `${home}${opened.path}`;
|
|
487
|
-
const requested = opened?.id ?? new URLSearchParams(options.search ?? "").get("app") ?? void 0;
|
|
488
|
-
if (requested && account.projects.some((project) => project.id === requested)) rememberAccountProject(account.teamId, requested);
|
|
489
|
-
else if (site) siteGate = {
|
|
490
|
-
kind: "site-refused",
|
|
491
|
-
url: site.url,
|
|
492
|
-
page: site.page,
|
|
493
|
-
linked: false
|
|
494
|
-
};
|
|
495
|
-
else if (requested || openLink) missingApp = true;
|
|
496
|
-
if (site && opened) siteGate = {
|
|
497
|
-
kind: "site",
|
|
498
|
-
page: site.page,
|
|
499
|
-
state: site.state
|
|
500
|
-
};
|
|
501
|
-
const remembered = rememberedAccountProject(account.teamId);
|
|
502
|
-
storage = accountProjectStorage(account, account.projects.find((project) => project.id === remembered)?.id ?? account.projects[0]?.id);
|
|
503
|
-
}
|
|
504
|
-
const started = startConsoleProjects({
|
|
505
|
-
base: "",
|
|
506
|
-
home: options.home,
|
|
507
|
-
mode: "account",
|
|
508
|
-
navigate: options.navigate,
|
|
509
|
-
pageOrigin: options.pageOrigin,
|
|
510
|
-
storage
|
|
511
|
-
});
|
|
512
|
-
started.account.value = account;
|
|
513
|
-
if (options.boot === "shell") started.openingView = "shell";
|
|
514
|
-
const invitation = consoleInvitationOf(options.pathname);
|
|
515
|
-
const page = accountPageOf(options.pathname);
|
|
516
|
-
const returnTo = !account && !invitation && options.pathname.replace(/\/+$/, "") === `${options.home.replace(/\/+$/, "")}/open` ? consoleOpenReturnPath(options.home, search) : void 0;
|
|
517
|
-
if (!account || invitation) started.gate.value = {
|
|
518
|
-
kind: "account",
|
|
519
|
-
...invitation ? { invitation } : {},
|
|
520
|
-
...returnTo ? { returnTo } : {}
|
|
521
|
-
};
|
|
522
|
-
else if (siteGate) started.gate.value = siteGate;
|
|
523
|
-
else if (page) started.gate.value = {
|
|
524
|
-
kind: "home",
|
|
525
|
-
page
|
|
526
|
-
};
|
|
527
|
-
else if (missingApp) started.gate.value = {
|
|
528
|
-
kind: "home",
|
|
529
|
-
page: "home"
|
|
530
|
-
};
|
|
531
|
-
if (started.gate.value.kind !== "opening" || started.current.value?.id !== earlyProbe?.id) {
|
|
532
|
-
earlyProbe?.read.stop();
|
|
533
|
-
earlyProbe = void 0;
|
|
534
|
-
}
|
|
535
|
-
return address ?? (missingApp ? options.home : void 0);
|
|
536
|
-
}
|
|
537
|
-
/**
|
|
538
|
-
* Apply the account of this visit to a page that opened from the stored account. A new name, role, or app shows in
|
|
539
|
-
* place. A sign-out, another person, another team, or an open app that the team no longer has loads the page again,
|
|
540
|
-
* without the stored answers, so nothing of the stored account stays usable.
|
|
541
|
-
*/
|
|
542
|
-
async function refreshConsoleAccount(fresh, options) {
|
|
543
|
-
const projects = useState();
|
|
544
|
-
const shown = projects.account.value;
|
|
545
|
-
if (!shown) {
|
|
546
|
-
if (fresh) reloadConsolePage(`${options.pathname}${options.search ?? ""}`);
|
|
547
|
-
return;
|
|
548
|
-
}
|
|
549
|
-
const current = projects.current.value;
|
|
550
|
-
const store = fresh && createConsoleProjectStore(accountProjectStorage(fresh, current?.id));
|
|
551
|
-
const sameApp = current ? store?.get(current.id)?.url === current.url : projects.gate.value.kind !== "empty" || !store?.list().length;
|
|
552
|
-
if (!fresh || !store || fresh.user.id !== shown.user.id || fresh.teamId !== shown.teamId || !sameApp) {
|
|
553
|
-
++probeVersion;
|
|
554
|
-
reloadConsolePage(`${options.pathname}${options.search ?? ""}`);
|
|
555
|
-
return;
|
|
556
|
-
}
|
|
557
|
-
projects.account.value = fresh;
|
|
558
|
-
projects.store = store;
|
|
559
|
-
projects.projects.value = store.list();
|
|
560
|
-
}
|
|
561
|
-
/** The projects of the team, with `active` as the project that the page opens. */
|
|
562
|
-
function accountProjectStorage(account, active) {
|
|
563
|
-
const storage = memoryProjectStorage();
|
|
564
|
-
storage.setItem(consoleProjectsStorageKey, JSON.stringify({
|
|
565
|
-
...active ? { active } : {},
|
|
566
|
-
projects: account.projects.map((project) => ({
|
|
567
|
-
id: project.id,
|
|
568
|
-
url: project.url,
|
|
569
|
-
...project.label ? { label: project.label } : {}
|
|
570
|
-
}))
|
|
571
|
-
}));
|
|
572
|
-
return storage;
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* Whether the stored account can open the page. A link to an app that it does not have, such as an app that the team
|
|
576
|
-
* linked after it was stored, waits for the account of this visit.
|
|
577
|
-
*/
|
|
578
|
-
function opensFromStored(account, options) {
|
|
579
|
-
const home = options.home.replace(/\/+$/, "");
|
|
580
|
-
if (options.pathname.replace(/\/+$/, "") === `${home}/open`) return consoleOpenLink(options.search ?? "", account.projects) !== void 0;
|
|
581
|
-
const linked = new URLSearchParams(options.search ?? "").get("app");
|
|
582
|
-
return !linked || account.projects.some((project) => project.id === linked);
|
|
583
|
-
}
|
|
584
|
-
/**
|
|
585
|
-
* The ticket link of a `site.link` answer, or `undefined` when it is not `<app>/_vitehub/rpc?ticket=vt1_...` of the app
|
|
586
|
-
* that the Console opened. The Console sends the browser to it, so a linked app must not pick another site.
|
|
587
|
-
*/
|
|
588
|
-
function siteTicketUrl(value, projectUrl) {
|
|
589
|
-
const app = comparableProjectUrl(projectUrl);
|
|
590
|
-
if (typeof value !== "string" || !app) return void 0;
|
|
591
|
-
let url;
|
|
592
|
-
try {
|
|
593
|
-
url = new URL(value);
|
|
594
|
-
} catch {
|
|
595
|
-
return;
|
|
596
|
-
}
|
|
597
|
-
if (`${url.origin}${url.pathname}` !== `${app}/_vitehub/rpc` || !/^vt1_[\w-]{43}$/.test(url.searchParams.get("ticket") ?? "")) return void 0;
|
|
598
|
-
return url.href;
|
|
599
|
-
}
|
|
600
|
-
/**
|
|
601
|
-
* Sign the browser in to the app of a `/_vitehub` link: ask the app for a Site access link bound to the state of that
|
|
602
|
-
* route, and replace this page with it, so Back does not open the used link again. A refusal shows why.
|
|
603
|
-
*/
|
|
604
|
-
async function openConsoleSite() {
|
|
605
|
-
const projects = useState();
|
|
606
|
-
const gate = projects.gate.value;
|
|
607
|
-
const current = projects.current.value;
|
|
608
|
-
if (gate.kind !== "site" || !current) return;
|
|
609
|
-
const refuse = (message) => {
|
|
610
|
-
projects.gate.value = {
|
|
611
|
-
kind: "site-refused",
|
|
612
|
-
url: current.url,
|
|
613
|
-
page: gate.page,
|
|
614
|
-
linked: true,
|
|
615
|
-
message
|
|
616
|
-
};
|
|
617
|
-
};
|
|
618
|
-
let answer;
|
|
619
|
-
try {
|
|
620
|
-
const [{ requestConsoleOperation }, { siteAccessOperations }] = await Promise.all([import("./request.js"), import("../site-access.js")]);
|
|
621
|
-
answer = await requestConsoleOperation(siteAccessOperations.link, {
|
|
622
|
-
path: gate.page,
|
|
623
|
-
state: gate.state
|
|
624
|
-
});
|
|
625
|
-
} catch (error) {
|
|
626
|
-
refuse(error instanceof Error ? error.message : "Try again.");
|
|
627
|
-
return;
|
|
628
|
-
}
|
|
629
|
-
const url = siteTicketUrl(Reflect.get(Object(answer), "url"), current.url);
|
|
630
|
-
if (!url) {
|
|
631
|
-
refuse("The app did not return a sign-in link of its own.");
|
|
632
|
-
return;
|
|
633
|
-
}
|
|
634
|
-
const location = Reflect.get(globalThis, "location");
|
|
635
|
-
Reflect.apply(Reflect.get(Object(location), "replace"), location, [url]);
|
|
636
|
-
}
|
|
637
|
-
/** Puts a path in the address bar without a load. The page sets it, because only the page has a history. */
|
|
638
|
-
let showAccountPath;
|
|
639
|
-
/**
|
|
640
|
-
* Show a page of an `account` Console outside the projects, such as `/team`. Before a project opens, the page changes in
|
|
641
|
-
* place. In an open project, the Console loads again, because the router owns the path there.
|
|
642
|
-
*/
|
|
643
|
-
function showConsoleAccountPage(page) {
|
|
644
|
-
const projects = useState();
|
|
645
|
-
++probeVersion;
|
|
646
|
-
const path = `${projects.home.replace(/\/+$/, "")}/${page}`;
|
|
647
|
-
if (projects.gate.value.kind === "ready") {
|
|
648
|
-
projects.navigate(path);
|
|
649
|
-
return;
|
|
650
|
-
}
|
|
651
|
-
showAccountPath?.(path);
|
|
652
|
-
projects.gate.value = {
|
|
653
|
-
kind: "home",
|
|
654
|
-
page
|
|
655
|
-
};
|
|
656
|
-
}
|
|
657
|
-
/** The address of one app of the team, which opens that app in any tab. */
|
|
658
|
-
function accountProjectPath(id) {
|
|
659
|
-
return `${useState().home}?app=${encodeURIComponent(id)}`;
|
|
660
|
-
}
|
|
661
|
-
/** Open a project of the team from a page outside the projects. The Console loads again at its home path. */
|
|
662
|
-
function openAccountProject(id) {
|
|
663
|
-
const projects = useState();
|
|
664
|
-
rememberAccountProject(projects.account.value?.teamId, id);
|
|
665
|
-
projects.navigate(projects.home);
|
|
666
|
-
}
|
|
667
|
-
/** Link an app to the active team, then open it. Until the app keeps the hash of its token, it opens on the setup step. */
|
|
668
|
-
async function linkAccountProject(url, label) {
|
|
669
|
-
const { linkConsoleAccountProject } = await import("./account.js");
|
|
670
|
-
const project = await linkConsoleAccountProject(url.trim(), label?.trim() || void 0);
|
|
671
|
-
rememberAccountProject(useState().account.value?.teamId, project.id);
|
|
672
|
-
reloadConsoleAccount();
|
|
673
|
-
}
|
|
674
|
-
/** Rename an app of the active team. An empty label removes it, so the Console shows the name that the app reports. */
|
|
675
|
-
async function renameAccountProject(id, label) {
|
|
676
|
-
const { renameConsoleAccountProject } = await import("./account.js");
|
|
677
|
-
await renameConsoleAccountProject(id, label);
|
|
678
|
-
}
|
|
679
|
-
/**
|
|
680
|
-
* Load the Console again from its home page, such as after a sign-in, a team switch, or a new project. The account
|
|
681
|
-
* changed, so the next page must not open from the stored one: the stored answers go first.
|
|
682
|
-
*/
|
|
683
|
-
function reloadConsoleAccount() {
|
|
684
|
-
reloadConsolePage(useState().home);
|
|
685
|
-
}
|
|
686
|
-
/** Sign out of the Console, delete the stored answers in every tab, and load the Console again. */
|
|
687
|
-
async function signOutConsole() {
|
|
688
|
-
const { endConsoleSession } = await import("./account.js");
|
|
689
|
-
await endConsoleSession();
|
|
690
|
-
stopConsoleReads();
|
|
691
|
-
await setDeviceAccount(null);
|
|
692
|
-
reloadConsoleAccount();
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Load the page at `url` without the stored answers. The reads of the boot stop first, and only the first reload of the
|
|
696
|
-
* page navigates.
|
|
697
|
-
*/
|
|
698
|
-
function reloadConsolePage(url) {
|
|
699
|
-
if (reloading) return;
|
|
700
|
-
reloading = true;
|
|
701
|
-
const projects = useState();
|
|
702
|
-
stopConsoleReads();
|
|
703
|
-
clearDevice().then(() => projects.navigate(url));
|
|
704
|
-
}
|
|
705
|
-
/** Stop the reads of the boot before the page loads again, so a read that starts over does not load it a second time. */
|
|
706
|
-
function stopConsoleReads() {
|
|
707
|
-
accountRead?.stop();
|
|
708
|
-
accountRead = void 0;
|
|
709
|
-
projectRead?.read.stop();
|
|
710
|
-
projectRead = void 0;
|
|
711
|
-
}
|
|
712
|
-
/** The page that a completed sign-in opens: the `/open` link that the person followed, else the Console home. */
|
|
713
|
-
function consoleSignInReturnPath() {
|
|
714
|
-
const projects = useState();
|
|
715
|
-
const gate = projects.gate.value;
|
|
716
|
-
return gate.kind === "account" && gate.returnTo ? gate.returnTo : projects.home;
|
|
717
|
-
}
|
|
718
|
-
/** Load the Console after a sign-in on this page, such as with a passkey, at the page that the sign-in opens. */
|
|
719
|
-
function finishConsoleSignIn() {
|
|
720
|
-
useState().navigate(consoleSignInReturnPath());
|
|
721
|
-
}
|
|
722
|
-
//#endregion
|
|
723
|
-
export { accountProjectPath, canManageConsoleProjects, checkConsoleProjects, consoleAccountPages, consoleAccountPath, consoleInvitationOf, consoleOpenLink, consoleOpenProjectName, consoleOpenReturnPath, consoleProjectDisplayName, consoleProjectReady, consoleSignInReturnPath, consoleSiteLink, finishConsoleSignIn, forgetConsoleProject, linkAccountProject, loadConsoleAccount, openAccountProject, openConsoleProject, openConsoleSite, reloadConsoleAccount, rememberAccountProject, rememberConsoleProjectName, renameAccountProject, showConsoleAccountPage, signOutConsole, siteTicketUrl, startConsoleAccount, startConsoleProjects, switchConsoleProject, useConsoleProjects };
|
|
1
|
+
export { t as accountProjectPath, n as canManageConsoleProjects, r as checkConsoleProjects, i as consoleAccountPages, a as consoleAccountPath, o as consoleInvitationOf, s as consoleOpenLink, c as consoleOpenProjectName, l as consoleOpenReturnPath, u as consoleProjectDisplayName, d as consoleProjectReady, f as consoleSignInReturnPath, p as consoleSiteLink, m as finishConsoleSignIn, h as forgetConsoleProject, g as linkAccountProject, _ as loadConsoleAccount, v as openAccountProject, y as openConsoleProject, b as openConsoleSite, x as reloadConsoleAccount, S as rememberAccountProject, C as rememberConsoleProjectName, w as renameAccountProject, T as showConsoleAccountPage, E as signOutConsole, D as siteTicketUrl, O as siteTokenRedirect, k as startConsoleAccount, A as startConsoleProjects, j as switchConsoleProject, M as useConsoleProjects } from "../../../project-session-8pN7pRo8.js";
|