@thevinci/web 1.0.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 +197 -0
- package/bin/cli-entry.js +55 -0
- package/bin/cli-output.js +145 -0
- package/bin/cli.js +4887 -0
- package/bin/cli.test.js +64 -0
- package/dist/apple-touch-icon-120x120.png +0 -0
- package/dist/apple-touch-icon-152x152.png +0 -0
- package/dist/apple-touch-icon-167x167.png +0 -0
- package/dist/apple-touch-icon-180x180.png +0 -0
- package/dist/apple-touch-icon.png +0 -0
- package/dist/apple-touch-icon.svg +528 -0
- package/dist/assets/JsonTreeView-CSm9OzXG.js +1 -0
- package/dist/assets/KaTeX_AMS-Regular-BQhdFMY1.woff2 +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DMm9YOAa.woff +0 -0
- package/dist/assets/KaTeX_AMS-Regular-DRggAlZN.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-ATXxdsX0.ttf +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-BEiXGLvX.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Bold-Dq_IR9rO.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-CTRA-rTL.woff +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-Di6jR-x-.woff2 +0 -0
- package/dist/assets/KaTeX_Caligraphic-Regular-wX97UBjC.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BdnERNNW.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-BsDP51OF.woff +0 -0
- package/dist/assets/KaTeX_Fraktur-Bold-CL6g_b3V.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CB_wures.ttf +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-CTYiF6lA.woff2 +0 -0
- package/dist/assets/KaTeX_Fraktur-Regular-Dxdc4cR9.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-Cx986IdX.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Bold-Jm3AIy58.woff +0 -0
- package/dist/assets/KaTeX_Main-Bold-waoOVXN0.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DxDJ3AOS.woff2 +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-DzxPMmG6.ttf +0 -0
- package/dist/assets/KaTeX_Main-BoldItalic-SpSLRI95.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-3WenGoN9.ttf +0 -0
- package/dist/assets/KaTeX_Main-Italic-BMLOBm91.woff +0 -0
- package/dist/assets/KaTeX_Main-Italic-NWA7e6Wa.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-B22Nviop.woff2 +0 -0
- package/dist/assets/KaTeX_Main-Regular-Dr94JaBh.woff +0 -0
- package/dist/assets/KaTeX_Main-Regular-ypZvNtVU.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-B3XSjfu4.ttf +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-CZnvNsCZ.woff2 +0 -0
- package/dist/assets/KaTeX_Math-BoldItalic-iY-2wyZ7.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-DA0__PXp.woff +0 -0
- package/dist/assets/KaTeX_Math-Italic-flOr_0UB.ttf +0 -0
- package/dist/assets/KaTeX_Math-Italic-t53AETM-.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-CFMepnvq.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-D1sUS0GD.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Bold-DbIhKOiC.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-C3H0VqGB.woff2 +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-DN2j7dab.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Italic-YYjJ1zSn.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-BNo7hRIc.ttf +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-CS6fqUqJ.woff +0 -0
- package/dist/assets/KaTeX_SansSerif-Regular-DDBCnlJ7.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-C5JkGWo-.ttf +0 -0
- package/dist/assets/KaTeX_Script-Regular-D3wIWfF6.woff2 +0 -0
- package/dist/assets/KaTeX_Script-Regular-D5yQViql.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-C195tn64.woff +0 -0
- package/dist/assets/KaTeX_Size1-Regular-Dbsnue_I.ttf +0 -0
- package/dist/assets/KaTeX_Size1-Regular-mCD8mA8B.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-B7gKUWhC.ttf +0 -0
- package/dist/assets/KaTeX_Size2-Regular-Dy4dx90m.woff2 +0 -0
- package/dist/assets/KaTeX_Size2-Regular-oD1tc_U0.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-CTq5MqoE.woff +0 -0
- package/dist/assets/KaTeX_Size3-Regular-DgpXs0kz.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-BF-4gkZK.woff +0 -0
- package/dist/assets/KaTeX_Size4-Regular-DWFBv043.ttf +0 -0
- package/dist/assets/KaTeX_Size4-Regular-Dl5lxZxV.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-C0xS9mPB.woff +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-CO6r4hn1.woff2 +0 -0
- package/dist/assets/KaTeX_Typewriter-Regular-D3Ib7_Hf.ttf +0 -0
- package/dist/assets/MarkdownRendererImpl-DensKOLc.js +6 -0
- package/dist/assets/MultiRunWindow-Bo7THayo.js +1 -0
- package/dist/assets/OnboardingScreen-BDqmzTVR.js +2 -0
- package/dist/assets/SettingsWindow-coz__Ykw.js +1 -0
- package/dist/assets/TerminalView-DrZ-i3Dr.js +1 -0
- package/dist/assets/ToolOutputDialog-Eglzslt3.js +16 -0
- package/dist/assets/es-4o9ciP61.js +15 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-CvHOgSBP.woff +0 -0
- package/dist/assets/ibm-plex-mono-latin-400-normal-DMJ8VG8y.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-CB9ihrfo.woff +0 -0
- package/dist/assets/ibm-plex-mono-latin-500-normal-DSY6xOcd.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-BgSNZQsw.woff2 +0 -0
- package/dist/assets/ibm-plex-mono-latin-600-normal-DWFSQ4vo.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-400-normal-CDDApCn2.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-latin-400-normal-CYLoc0-x.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-500-normal-6ng42L7E.woff2 +0 -0
- package/dist/assets/ibm-plex-sans-latin-500-normal-BgVn5rGT.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-600-normal-Cu4Hd6ag.woff +0 -0
- package/dist/assets/ibm-plex-sans-latin-600-normal-CuJfVYMP.woff2 +0 -0
- package/dist/assets/index-DLTDToSP.css +1 -0
- package/dist/assets/index-DgiFEKGN.js +1 -0
- package/dist/assets/ko-B20imCHE.js +15 -0
- package/dist/assets/main-BV3KOtdA.css +1 -0
- package/dist/assets/main-CDKJj0sH.js +226 -0
- package/dist/assets/main-LC-PSNVM.js +2 -0
- package/dist/assets/miniChat-CQUiG_cr.js +2 -0
- package/dist/assets/modelPrefsAutoSave-Dm799vzR.js +6986 -0
- package/dist/assets/pl-DQJ7LSzj.js +15 -0
- package/dist/assets/pt-BR-OmjHUz9y.js +15 -0
- package/dist/assets/renderElectronMiniChatApp-CARbeW0G.js +2 -0
- package/dist/assets/uk-BNFxOlO4.js +15 -0
- package/dist/assets/vendor--DBfsbEis.css +1 -0
- package/dist/assets/vendor-.bun-B9l0ZNi2.js +4094 -0
- package/dist/assets/wasm-CG6Dc4jp.js +1 -0
- package/dist/assets/wasmSttWorker-Dtlxac_K.js +1 -0
- package/dist/assets/wasmSttWorker-oo7Dm_jy.js +1806 -0
- package/dist/assets/worker-CbT6TVo7.js +155 -0
- package/dist/assets/zh-CN-C6T-Ac7F.js +15 -0
- package/dist/favicon-16.png +0 -0
- package/dist/favicon-32.png +0 -0
- package/dist/favicon.png +0 -0
- package/dist/favicon.svg +528 -0
- package/dist/index.html +607 -0
- package/dist/logo-dark-192x192.png +0 -0
- package/dist/logo-dark-512x512.png +0 -0
- package/dist/logo-dark-512x512.svg +528 -0
- package/dist/logo-light-192x192.png +0 -0
- package/dist/logo-light-512x512.png +0 -0
- package/dist/logo-light-512x512.svg +528 -0
- package/dist/mini-chat.html +16 -0
- package/dist/pwa-192.png +0 -0
- package/dist/pwa-512.png +0 -0
- package/dist/pwa-maskable-192.png +0 -0
- package/dist/pwa-maskable-512.png +0 -0
- package/dist/site.webmanifest +21 -0
- package/dist/sw.js +1 -0
- package/package.json +118 -0
- package/public/apple-touch-icon-120x120.png +0 -0
- package/public/apple-touch-icon-152x152.png +0 -0
- package/public/apple-touch-icon-167x167.png +0 -0
- package/public/apple-touch-icon-180x180.png +0 -0
- package/public/apple-touch-icon.png +0 -0
- package/public/apple-touch-icon.svg +528 -0
- package/public/favicon-16.png +0 -0
- package/public/favicon-32.png +0 -0
- package/public/favicon.png +0 -0
- package/public/favicon.svg +528 -0
- package/public/logo-dark-192x192.png +0 -0
- package/public/logo-dark-512x512.png +0 -0
- package/public/logo-dark-512x512.svg +528 -0
- package/public/logo-light-192x192.png +0 -0
- package/public/logo-light-512x512.png +0 -0
- package/public/logo-light-512x512.svg +528 -0
- package/public/pwa-192.png +0 -0
- package/public/pwa-512.png +0 -0
- package/public/pwa-maskable-192.png +0 -0
- package/public/pwa-maskable-512.png +0 -0
- package/public/site.webmanifest +21 -0
- package/server/TERMINAL_WS_PROTOCOL.md +48 -0
- package/server/index.d.ts +39 -0
- package/server/index.js +1311 -0
- package/server/lib/cloudflare-tunnel.js +650 -0
- package/server/lib/event-stream/DOCUMENTATION.md +61 -0
- package/server/lib/event-stream/directory-ws-bridge.js +185 -0
- package/server/lib/event-stream/global-hub.js +158 -0
- package/server/lib/event-stream/global-hub.test.js +140 -0
- package/server/lib/event-stream/global-ws-bridge.js +206 -0
- package/server/lib/event-stream/index.js +25 -0
- package/server/lib/event-stream/protocol.js +131 -0
- package/server/lib/event-stream/protocol.test.js +182 -0
- package/server/lib/event-stream/runtime.js +180 -0
- package/server/lib/event-stream/runtime.test.js +512 -0
- package/server/lib/event-stream/upstream-reader.js +226 -0
- package/server/lib/event-stream/upstream-reader.test.js +276 -0
- package/server/lib/fs/DOCUMENTATION.md +36 -0
- package/server/lib/fs/routes.js +1040 -0
- package/server/lib/fs/search.js +238 -0
- package/server/lib/git/DOCUMENTATION.md +152 -0
- package/server/lib/git/credentials.js +74 -0
- package/server/lib/git/identity-storage.js +112 -0
- package/server/lib/git/index.js +6 -0
- package/server/lib/git/routes.js +972 -0
- package/server/lib/git/service.js +3432 -0
- package/server/lib/git/service.test.js +39 -0
- package/server/lib/github/DOCUMENTATION.md +171 -0
- package/server/lib/github/auth.js +307 -0
- package/server/lib/github/device-flow.js +50 -0
- package/server/lib/github/index.js +24 -0
- package/server/lib/github/octokit.js +10 -0
- package/server/lib/github/pr-status.js +519 -0
- package/server/lib/github/repo/fork-detection.js +102 -0
- package/server/lib/github/repo/index.js +55 -0
- package/server/lib/github/routes.js +1560 -0
- package/server/lib/magic-prompts/routes.js +63 -0
- package/server/lib/magic-prompts/runtime.js +119 -0
- package/server/lib/notifications/DOCUMENTATION.md +122 -0
- package/server/lib/notifications/emitter-runtime.js +102 -0
- package/server/lib/notifications/index.js +4 -0
- package/server/lib/notifications/message.js +52 -0
- package/server/lib/notifications/message.test.js +34 -0
- package/server/lib/notifications/push-runtime.js +304 -0
- package/server/lib/notifications/routes.js +315 -0
- package/server/lib/notifications/runtime.js +566 -0
- package/server/lib/notifications/template-runtime.js +349 -0
- package/server/lib/notifications/template-runtime.test.js +26 -0
- package/server/lib/opencode/DOCUMENTATION.md +362 -0
- package/server/lib/opencode/agents.js +634 -0
- package/server/lib/opencode/auth-state-runtime.js +88 -0
- package/server/lib/opencode/auth.js +83 -0
- package/server/lib/opencode/bootstrap-runtime.js +131 -0
- package/server/lib/opencode/cli-entry-runtime.js +43 -0
- package/server/lib/opencode/cli-options.js +128 -0
- package/server/lib/opencode/commands.js +339 -0
- package/server/lib/opencode/config-entity-routes.js +370 -0
- package/server/lib/opencode/core-routes.js +500 -0
- package/server/lib/opencode/core-routes.test.js +26 -0
- package/server/lib/opencode/env-config.js +74 -0
- package/server/lib/opencode/env-keys.js +68 -0
- package/server/lib/opencode/env-runtime.js +1162 -0
- package/server/lib/opencode/env-runtime.test.js +116 -0
- package/server/lib/opencode/feature-routes-runtime.js +244 -0
- package/server/lib/opencode/hmr-state-runtime.js +85 -0
- package/server/lib/opencode/index.js +66 -0
- package/server/lib/opencode/lifecycle.js +1019 -0
- package/server/lib/opencode/lifecycle.test.js +240 -0
- package/server/lib/opencode/mcp.js +278 -0
- package/server/lib/opencode/network-runtime.js +104 -0
- package/server/lib/opencode/network-runtime.test.js +37 -0
- package/server/lib/opencode/opencode-resolution-runtime.js +71 -0
- package/server/lib/opencode/path-utils.js +100 -0
- package/server/lib/opencode/path-utils.test.js +71 -0
- package/server/lib/opencode/project-directory-runtime.js +124 -0
- package/server/lib/opencode/project-icon-routes.js +399 -0
- package/server/lib/opencode/project-icon-routes.test.js +107 -0
- package/server/lib/opencode/providers.js +96 -0
- package/server/lib/opencode/proxy.js +445 -0
- package/server/lib/opencode/pwa-manifest-routes.js +257 -0
- package/server/lib/opencode/pwa-manifest-routes.test.js +133 -0
- package/server/lib/opencode/routes.js +541 -0
- package/server/lib/opencode/server-startup-runtime.js +156 -0
- package/server/lib/opencode/server-utils-runtime.js +168 -0
- package/server/lib/opencode/server-utils-runtime.test.js +135 -0
- package/server/lib/opencode/session-runtime.js +356 -0
- package/server/lib/opencode/session-runtime.test.js +151 -0
- package/server/lib/opencode/settings-helpers.js +770 -0
- package/server/lib/opencode/settings-helpers.test.js +109 -0
- package/server/lib/opencode/settings-normalization-runtime.js +428 -0
- package/server/lib/opencode/settings-runtime.js +826 -0
- package/server/lib/opencode/settings-runtime.test.js +85 -0
- package/server/lib/opencode/shared.js +615 -0
- package/server/lib/opencode/shutdown-runtime.js +139 -0
- package/server/lib/opencode/shutdown-runtime.test.js +58 -0
- package/server/lib/opencode/skill-routes.js +701 -0
- package/server/lib/opencode/skills.js +548 -0
- package/server/lib/opencode/startup-pipeline-runtime.js +130 -0
- package/server/lib/opencode/static-routes-runtime.js +65 -0
- package/server/lib/opencode/theme-runtime.js +167 -0
- package/server/lib/opencode/tunnel-auth.js +591 -0
- package/server/lib/opencode/tunnel-wiring-runtime.js +94 -0
- package/server/lib/opencode/vinci-routes.js +76 -0
- package/server/lib/opencode/watcher.js +115 -0
- package/server/lib/opencode/watcher.test.js +239 -0
- package/server/lib/preview/proxy-runtime.js +1333 -0
- package/server/lib/preview/proxy-runtime.test.js +144 -0
- package/server/lib/projects/project-config.js +567 -0
- package/server/lib/projects/project-config.test.js +175 -0
- package/server/lib/projects/project-id.js +13 -0
- package/server/lib/quota/DOCUMENTATION.md +58 -0
- package/server/lib/quota/index.js +25 -0
- package/server/lib/quota/providers/claude.js +107 -0
- package/server/lib/quota/providers/codex.js +113 -0
- package/server/lib/quota/providers/copilot.js +165 -0
- package/server/lib/quota/providers/google/api.js +92 -0
- package/server/lib/quota/providers/google/auth.js +108 -0
- package/server/lib/quota/providers/google/index.js +124 -0
- package/server/lib/quota/providers/google/transforms.js +109 -0
- package/server/lib/quota/providers/index.js +168 -0
- package/server/lib/quota/providers/interface.js +55 -0
- package/server/lib/quota/providers/kimi.js +108 -0
- package/server/lib/quota/providers/minimax-cn-coding-plan.js +140 -0
- package/server/lib/quota/providers/minimax-coding-plan.js +139 -0
- package/server/lib/quota/providers/nanogpt.js +124 -0
- package/server/lib/quota/providers/ollama-cloud.js +112 -0
- package/server/lib/quota/providers/openai.js +91 -0
- package/server/lib/quota/providers/openrouter.js +92 -0
- package/server/lib/quota/providers/zai.js +91 -0
- package/server/lib/quota/providers/zhipuai-coding-plan.js +133 -0
- package/server/lib/quota/providers/zhipuai.js +114 -0
- package/server/lib/quota/routes.js +27 -0
- package/server/lib/quota/utils/auth.js +50 -0
- package/server/lib/quota/utils/formatters.js +85 -0
- package/server/lib/quota/utils/formatters.test.js +54 -0
- package/server/lib/quota/utils/index.js +10 -0
- package/server/lib/quota/utils/transformers.js +55 -0
- package/server/lib/scheduled-tasks/DOCUMENTATION.md +44 -0
- package/server/lib/scheduled-tasks/routes.js +235 -0
- package/server/lib/scheduled-tasks/runtime.js +773 -0
- package/server/lib/scheduled-tasks/runtime.test.js +100 -0
- package/server/lib/security/request-security.js +115 -0
- package/server/lib/session-folders/routes.js +63 -0
- package/server/lib/session-folders/routes.test.js +102 -0
- package/server/lib/skills-catalog/DOCUMENTATION.md +178 -0
- package/server/lib/skills-catalog/cache.js +29 -0
- package/server/lib/skills-catalog/clawdhub/api.js +158 -0
- package/server/lib/skills-catalog/clawdhub/index.js +30 -0
- package/server/lib/skills-catalog/clawdhub/install.js +238 -0
- package/server/lib/skills-catalog/clawdhub/scan.js +113 -0
- package/server/lib/skills-catalog/curated-sources.js +21 -0
- package/server/lib/skills-catalog/git.js +77 -0
- package/server/lib/skills-catalog/index.js +42 -0
- package/server/lib/skills-catalog/install.js +294 -0
- package/server/lib/skills-catalog/scan.js +221 -0
- package/server/lib/skills-catalog/source.js +87 -0
- package/server/lib/terminal/DOCUMENTATION.md +76 -0
- package/server/lib/terminal/index.js +31 -0
- package/server/lib/terminal/output-replay-buffer.js +78 -0
- package/server/lib/terminal/output-replay-buffer.test.js +75 -0
- package/server/lib/terminal/runtime.js +850 -0
- package/server/lib/terminal/runtime.test.js +96 -0
- package/server/lib/terminal/terminal-ws-protocol.js +68 -0
- package/server/lib/terminal/terminal-ws-protocol.test.js +145 -0
- package/server/lib/text/DOCUMENTATION.md +35 -0
- package/server/lib/text/summarization.js +138 -0
- package/server/lib/text/summarization.test.js +34 -0
- package/server/lib/tts/DOCUMENTATION.md +146 -0
- package/server/lib/tts/base-url.js +62 -0
- package/server/lib/tts/capability-runtime.js +31 -0
- package/server/lib/tts/index.js +19 -0
- package/server/lib/tts/routes.js +261 -0
- package/server/lib/tts/routes.test.js +53 -0
- package/server/lib/tts/service.js +178 -0
- package/server/lib/tts/stt.js +75 -0
- package/server/lib/tunnels/DOCUMENTATION.md +18 -0
- package/server/lib/tunnels/index.js +166 -0
- package/server/lib/tunnels/managed-config.js +201 -0
- package/server/lib/tunnels/providers/cloudflare.js +260 -0
- package/server/lib/tunnels/registry.js +51 -0
- package/server/lib/tunnels/routes.js +605 -0
- package/server/lib/tunnels/types.js +219 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +38 -0
- package/server/lib/ui-auth/ui-auth.js +673 -0
- package/server/lib/ui-auth/ui-passkeys.js +545 -0
- package/server/opencode-proxy.test.js +151 -0
- package/server/proxy-headers.js +61 -0
- package/server/proxy-headers.test.js +58 -0
- package/server/sse-routes.test.js +152 -0
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
|
|
4
|
+
export const TUNNEL_PROVIDER_CLOUDFLARE = 'cloudflare';
|
|
5
|
+
|
|
6
|
+
export const TUNNEL_MODE_QUICK = 'quick';
|
|
7
|
+
export const TUNNEL_MODE_MANAGED_REMOTE = 'managed-remote';
|
|
8
|
+
export const TUNNEL_MODE_MANAGED_LOCAL = 'managed-local';
|
|
9
|
+
|
|
10
|
+
export const TUNNEL_INTENT_EPHEMERAL_PUBLIC = 'ephemeral-public';
|
|
11
|
+
export const TUNNEL_INTENT_PERSISTENT_PUBLIC = 'persistent-public';
|
|
12
|
+
export const TUNNEL_INTENT_PRIVATE_NETWORK = 'private-network';
|
|
13
|
+
|
|
14
|
+
const SUPPORTED_TUNNEL_INTENTS = new Set([
|
|
15
|
+
TUNNEL_INTENT_EPHEMERAL_PUBLIC,
|
|
16
|
+
TUNNEL_INTENT_PERSISTENT_PUBLIC,
|
|
17
|
+
TUNNEL_INTENT_PRIVATE_NETWORK,
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
const SUPPORTED_TUNNEL_MODES = new Set([
|
|
21
|
+
TUNNEL_MODE_QUICK,
|
|
22
|
+
TUNNEL_MODE_MANAGED_REMOTE,
|
|
23
|
+
TUNNEL_MODE_MANAGED_LOCAL,
|
|
24
|
+
]);
|
|
25
|
+
|
|
26
|
+
export class TunnelServiceError extends Error {
|
|
27
|
+
constructor(code, message, details = null) {
|
|
28
|
+
super(message);
|
|
29
|
+
this.name = 'TunnelServiceError';
|
|
30
|
+
this.code = code;
|
|
31
|
+
this.details = details;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const SUPPORTED_TUNNEL_PROVIDERS = new Set([
|
|
36
|
+
TUNNEL_PROVIDER_CLOUDFLARE,
|
|
37
|
+
]);
|
|
38
|
+
|
|
39
|
+
export function normalizeTunnelProvider(value) {
|
|
40
|
+
if (typeof value !== 'string') {
|
|
41
|
+
return TUNNEL_PROVIDER_CLOUDFLARE;
|
|
42
|
+
}
|
|
43
|
+
const provider = value.trim().toLowerCase();
|
|
44
|
+
if (!provider || !SUPPORTED_TUNNEL_PROVIDERS.has(provider)) {
|
|
45
|
+
return TUNNEL_PROVIDER_CLOUDFLARE;
|
|
46
|
+
}
|
|
47
|
+
return provider;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function normalizeTunnelMode(value) {
|
|
51
|
+
if (typeof value !== 'string') {
|
|
52
|
+
return TUNNEL_MODE_QUICK;
|
|
53
|
+
}
|
|
54
|
+
const mode = value.trim().toLowerCase();
|
|
55
|
+
if (!mode) {
|
|
56
|
+
return TUNNEL_MODE_QUICK;
|
|
57
|
+
}
|
|
58
|
+
if (mode === TUNNEL_MODE_QUICK) {
|
|
59
|
+
return TUNNEL_MODE_QUICK;
|
|
60
|
+
}
|
|
61
|
+
if (mode === TUNNEL_MODE_MANAGED_REMOTE) {
|
|
62
|
+
return TUNNEL_MODE_MANAGED_REMOTE;
|
|
63
|
+
}
|
|
64
|
+
if (mode === TUNNEL_MODE_MANAGED_LOCAL) {
|
|
65
|
+
return TUNNEL_MODE_MANAGED_LOCAL;
|
|
66
|
+
}
|
|
67
|
+
return TUNNEL_MODE_QUICK;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export function normalizeTunnelIntent(value) {
|
|
71
|
+
if (typeof value !== 'string') {
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
const intent = value.trim().toLowerCase();
|
|
75
|
+
if (!intent || !SUPPORTED_TUNNEL_INTENTS.has(intent)) {
|
|
76
|
+
return undefined;
|
|
77
|
+
}
|
|
78
|
+
return intent;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function modeIntentFallback(mode) {
|
|
82
|
+
if (mode === TUNNEL_MODE_QUICK) {
|
|
83
|
+
return TUNNEL_INTENT_EPHEMERAL_PUBLIC;
|
|
84
|
+
}
|
|
85
|
+
if (mode === TUNNEL_MODE_MANAGED_REMOTE || mode === TUNNEL_MODE_MANAGED_LOCAL) {
|
|
86
|
+
return TUNNEL_INTENT_PERSISTENT_PUBLIC;
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function normalizeTunnelModeForRequest(value) {
|
|
92
|
+
if (typeof value === 'string') {
|
|
93
|
+
const mode = value.trim().toLowerCase();
|
|
94
|
+
if (mode === TUNNEL_MODE_QUICK || mode === TUNNEL_MODE_MANAGED_REMOTE || mode === TUNNEL_MODE_MANAGED_LOCAL) {
|
|
95
|
+
return mode;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return TUNNEL_MODE_QUICK;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export function normalizeOptionalPath(value) {
|
|
102
|
+
if (value === null) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
if (typeof value !== 'string') {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
const trimmed = value.trim();
|
|
109
|
+
if (!trimmed) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
let resolved;
|
|
113
|
+
if (trimmed === '~') {
|
|
114
|
+
resolved = os.homedir();
|
|
115
|
+
} else if (trimmed.startsWith('~/') || trimmed.startsWith('~\\')) {
|
|
116
|
+
resolved = path.join(os.homedir(), trimmed.slice(2));
|
|
117
|
+
} else {
|
|
118
|
+
resolved = path.resolve(trimmed);
|
|
119
|
+
}
|
|
120
|
+
const home = os.homedir();
|
|
121
|
+
if (resolved !== home && !resolved.startsWith(home + path.sep)) {
|
|
122
|
+
throw new TunnelServiceError(
|
|
123
|
+
'validation_error',
|
|
124
|
+
`Config path must be within the home directory (${home}). Got: ${resolved}`
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
return resolved;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function isSupportedTunnelMode(mode) {
|
|
131
|
+
return SUPPORTED_TUNNEL_MODES.has(mode);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
export function normalizeTunnelStartRequest(input = {}, defaults = {}) {
|
|
135
|
+
const provider = normalizeTunnelProvider(input.provider ?? defaults.provider);
|
|
136
|
+
const mode = normalizeTunnelModeForRequest(input.mode ?? defaults.mode);
|
|
137
|
+
const explicitIntent = normalizeTunnelIntent(input.intent ?? defaults.intent);
|
|
138
|
+
const intent = explicitIntent ?? modeIntentFallback(mode);
|
|
139
|
+
const configPathValue = Object.prototype.hasOwnProperty.call(input, 'configPath')
|
|
140
|
+
? input.configPath
|
|
141
|
+
: defaults.configPath;
|
|
142
|
+
const configPath = normalizeOptionalPath(configPathValue);
|
|
143
|
+
|
|
144
|
+
const token = typeof (input.token ?? defaults.token) === 'string'
|
|
145
|
+
? (input.token ?? defaults.token).trim()
|
|
146
|
+
: '';
|
|
147
|
+
|
|
148
|
+
const hostname = typeof (input.hostname ?? defaults.hostname) === 'string'
|
|
149
|
+
? (input.hostname ?? defaults.hostname).trim().toLowerCase()
|
|
150
|
+
: '';
|
|
151
|
+
|
|
152
|
+
return {
|
|
153
|
+
provider,
|
|
154
|
+
mode,
|
|
155
|
+
intent,
|
|
156
|
+
configPath,
|
|
157
|
+
token,
|
|
158
|
+
hostname,
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
export function validateTunnelStartRequest(request, capabilities) {
|
|
163
|
+
if (!request || typeof request !== 'object') {
|
|
164
|
+
throw new TunnelServiceError('validation_error', 'Tunnel start request must be an object');
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
if (!request.provider) {
|
|
168
|
+
throw new TunnelServiceError('validation_error', 'Tunnel provider is required');
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
if (!isSupportedTunnelMode(request.mode)) {
|
|
172
|
+
throw new TunnelServiceError('mode_unsupported', `Unsupported tunnel mode: ${request.mode}`);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (!capabilities || capabilities.provider !== request.provider) {
|
|
176
|
+
throw new TunnelServiceError('provider_unsupported', `Unsupported tunnel provider: ${request.provider}`);
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
if (!Array.isArray(capabilities.modes)) {
|
|
180
|
+
throw new TunnelServiceError('mode_unsupported', `Provider '${request.provider}' does not declare tunnel modes`);
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
const modeDescriptor = capabilities.modes.find((entry) => entry?.key === request.mode);
|
|
184
|
+
if (!modeDescriptor) {
|
|
185
|
+
throw new TunnelServiceError('mode_unsupported', `Provider '${request.provider}' does not support mode '${request.mode}'`);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (typeof request.intent === 'string' && request.intent.length > 0) {
|
|
189
|
+
if (!SUPPORTED_TUNNEL_INTENTS.has(request.intent)) {
|
|
190
|
+
throw new TunnelServiceError('validation_error', `Unsupported tunnel intent: ${request.intent}`);
|
|
191
|
+
}
|
|
192
|
+
if (modeDescriptor.intent !== request.intent) {
|
|
193
|
+
throw new TunnelServiceError(
|
|
194
|
+
'validation_error',
|
|
195
|
+
`Tunnel intent '${request.intent}' does not match mode '${request.mode}' (expected '${modeDescriptor.intent}')`
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
const requiredFields = Array.isArray(modeDescriptor.requires) ? modeDescriptor.requires : [];
|
|
201
|
+
|
|
202
|
+
if (requiredFields.includes('token')) {
|
|
203
|
+
if (!request.token) {
|
|
204
|
+
throw new TunnelServiceError('validation_error', 'Managed remote tunnel token is required');
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (requiredFields.includes('hostname')) {
|
|
209
|
+
if (!request.hostname) {
|
|
210
|
+
throw new TunnelServiceError('validation_error', 'Managed remote tunnel hostname is required');
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (requiredFields.includes('configPath')) {
|
|
215
|
+
if (request.configPath === undefined || request.configPath === null || request.configPath === '') {
|
|
216
|
+
throw new TunnelServiceError('validation_error', `Mode '${request.mode}' requires a configPath`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
# UI Auth Module Documentation
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
This module owns Vinci UI authentication for browser access, including password session auth, WebAuthn passkeys, and trusted-device session handling.
|
|
5
|
+
|
|
6
|
+
## Entrypoints and structure
|
|
7
|
+
- `packages/web/server/lib/ui-auth/ui-auth.js`: UI auth controller runtime, cookie/session issuance, rate limiting, and auth route handlers.
|
|
8
|
+
- `packages/web/server/lib/ui-auth/ui-passkeys.js`: passkey store and WebAuthn registration/authentication verification helpers.
|
|
9
|
+
|
|
10
|
+
## Public exports (ui-auth.js)
|
|
11
|
+
- `createUiAuth({ password, cookieName, sessionTtlMs, readSettingsFromDiskMigrated })`: creates UI auth controller with methods:
|
|
12
|
+
- `enabled`
|
|
13
|
+
- `requireAuth(req, res, next)`
|
|
14
|
+
- `handleSessionStatus(req, res)`
|
|
15
|
+
- `handleSessionCreate(req, res)`
|
|
16
|
+
- `handlePasskeyStatus(req, res)`
|
|
17
|
+
- `handlePasskeyRegistrationOptions(req, res)`
|
|
18
|
+
- `handlePasskeyRegistrationVerify(req, res)`
|
|
19
|
+
- `handlePasskeyAuthenticationOptions(req, res)`
|
|
20
|
+
- `handlePasskeyAuthenticationVerify(req, res)`
|
|
21
|
+
- `handlePasskeyList(req, res)`
|
|
22
|
+
- `handlePasskeyRevoke(req, res)`
|
|
23
|
+
- `handleResetAuth(req, res)`
|
|
24
|
+
- `ensureSessionToken(req, res)`
|
|
25
|
+
- `dispose()`
|
|
26
|
+
|
|
27
|
+
## Public exports (ui-passkeys.js)
|
|
28
|
+
- `createUiPasskeys({ passwordBinding, readSettingsFromDiskMigrated, storeFile, rpName, challengeTtlMs })`: creates passkey runtime with methods:
|
|
29
|
+
- `enabled`
|
|
30
|
+
- `getStatus(req)`
|
|
31
|
+
- `listPasskeys(req)`
|
|
32
|
+
- `revokePasskey(req, passkeyId)`
|
|
33
|
+
- `clearAllPasskeys()`
|
|
34
|
+
- `beginRegistration(req, { label })`
|
|
35
|
+
- `finishRegistration(payload)`
|
|
36
|
+
- `beginAuthentication(req)`
|
|
37
|
+
- `finishAuthentication(payload)`
|
|
38
|
+
- `dispose()`
|