@yuriai/web 0.2.40-beta.3 → 0.2.40-beta.5
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/dist/assets/{AgentAvatar-kQhfwlay.js → AgentAvatar-B7KbxN8Y.js} +1 -1
- package/dist/assets/AssistantConversationSurface-BnK_KTBO.js +3 -0
- package/dist/assets/{AssistantUnreadBadge-B2SY-_-u.js → AssistantUnreadBadge-vu4ZhTft.js} +1 -1
- package/dist/assets/{AssistantView-C_hiAuTd.js → AssistantView-CEfEWUIr.js} +1 -1
- package/dist/assets/DiagramView-Dlzr08J_.js +1 -0
- package/dist/assets/{FadeInOnReveal-CMeIdEKz.js → FadeInOnReveal-DMRmNsau.js} +1 -1
- package/dist/assets/{GuiPluginPage-WXqykPAg.js → GuiPluginPage-DVug4z_p.js} +1 -1
- package/dist/assets/GuiPluginSurface-L43o6Xv8.js +1 -0
- package/dist/assets/{GuiPluginWindow-BLzchKn7.js → GuiPluginWindow-tHXkS18H.js} +1 -1
- package/dist/assets/{Icon-DygEqfgq.js → Icon-DizeYahT.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-kbBRpDSD.js → ImageLoadingPlaceholder-BZC5m_km.js} +1 -1
- package/dist/assets/LoadingImage-Csw4L-Dr.js +1 -0
- package/dist/assets/MarkdownRenderer-D_0iKhQN.js +2 -0
- package/dist/assets/MarkdownRendererImpl-BZ0XgjS0.js +10 -0
- package/dist/assets/MarkstreamRendererImpl-DBd6Glg9.js +3 -0
- package/dist/assets/MobileDetailNavigation-xgwvsQuR.js +1 -0
- package/dist/assets/{MobileResizableSheet-Dt2U0JHY.js → MobileResizableSheet-CQQ7O-2X.js} +1 -1
- package/dist/assets/MobileShareBridge-IO45gM2G.js +3 -0
- package/dist/assets/MobileSurface-DmYgZONB.js +2 -0
- package/dist/assets/{MultiRunWindow-BuRo90Ma.js → MultiRunWindow-fJ3XfntS.js} +1 -1
- package/dist/assets/OnboardingScreen-MJS5T5rL.js +1 -0
- package/dist/assets/{OverlayScrollbar-B0X61qR-.js → OverlayScrollbar-jtMYTn1y.js} +1 -1
- package/dist/assets/SettingsView-ZWFLpPSI.js +29 -0
- package/dist/assets/{SettingsWindow-kCbf8IoB.js → SettingsWindow-DGRmrIWz.js} +1 -1
- package/dist/assets/SetupTourDialog-BYbAubwA.js +1 -0
- package/dist/assets/TerminalView-CoJ6_9P1.js +8 -0
- package/dist/assets/ToolOutputDialog-5xBwOJ6a.js +16 -0
- package/dist/assets/VoiceSettings-CN33koSc.js +2 -0
- package/dist/assets/{YuriLogo-B58GIl2v.js → YuriLogo-CvyJy_R9.js} +1 -1
- package/dist/assets/YuriWordmark-DnFAS-Ko.js +1 -0
- package/dist/assets/{assistant-attachment-cache-Cmzt4xXE.js → assistant-attachment-cache-D-LmCflm.js} +1 -1
- package/dist/assets/bootstrap-eLlfzqAI.js +1 -0
- package/dist/assets/{capgoAdapter-DO1rEVQf.js → capgoAdapter-CCLtBZL1.js} +1 -1
- package/dist/assets/{checkbox-BW80bcK5.js → checkbox-rOV6DjeG.js} +1 -1
- package/dist/assets/client-uz8O6TPX.js +7 -0
- package/dist/assets/{collapsible-BOL5Wx2J.js → collapsible-CKswuqAw.js} +1 -1
- package/dist/assets/{context-menu-CiFnjP1q.js → context-menu-B4njwT_M.js} +1 -1
- package/dist/assets/{desktopHosts-DovfbQPm.js → desktopHosts-135cuRCE.js} +1 -1
- package/dist/assets/{desktopRelayRestore-D4pbpNKN.js → desktopRelayRestore-1aUztDPU.js} +1 -1
- package/dist/assets/{device-DNG0cNwQ.js → device-QL8KNSLM.js} +1 -1
- package/dist/assets/{diagram-DRn8iIs1.js → diagram-BppQ_USn.js} +1 -1
- package/dist/assets/{dialog-DQp289fr.js → dialog-Bg8MJnOV.js} +1 -1
- package/dist/assets/{es-D0Q_CV0t.js → es-Ba3NUCtE.js} +3 -3
- package/dist/assets/{fileMentionTouchSelection-582p0uCX.js → fileMentionTouchSelection-D-AdTJVr.js} +1 -1
- package/dist/assets/fileReferenceActions-cYqdsXFz.js +1 -0
- package/dist/assets/{fr-DrO5SAKl.js → fr-CRhp3hyT.js} +3 -3
- package/dist/assets/{gitApi-vYBmQIuU.js → gitApi-DVx_V1x6.js} +11 -7
- package/dist/assets/gitApiHttp-DvTBxvX8.js +3 -0
- package/dist/assets/historyImportQueries-D_9RlrLp.js +1 -0
- package/dist/assets/host-DrGjjO6K.js +1 -0
- package/dist/assets/{i18n-UaLestuf.js → i18n-RH7UieOS.js} +1 -1
- package/dist/assets/image-loading-DBqnxgDH.js +1 -0
- package/dist/assets/{input-B281XcMR.js → input-DRjuZMeA.js} +1 -1
- package/dist/assets/input-store-CjUOfpyA.js +1 -0
- package/dist/assets/insertionBoundaries-DZtQt2Ah.js +1 -0
- package/dist/assets/{ja-BNeP9_GU.js → ja-D-UPjDY2.js} +3 -3
- package/dist/assets/{ko-DRRFD_7l.js → ko-x-z9J5z7.js} +3 -3
- package/dist/assets/main-BMFY9mtb.js +2 -0
- package/dist/assets/main-D2s9J_jN.js +169 -0
- package/dist/assets/{markdownHeightCache-BgYJswDy.js → markdownHeightCache-BL99DlhC.js} +1 -1
- package/dist/assets/{markdownTheme-CHNl6tUv.js → markdownTheme-DFDWa8Gh.js} +1 -1
- package/dist/assets/mcpQueries-HzYMEVWd.js +1 -0
- package/dist/assets/miniChat-BbJ0GKpk.js +2 -0
- package/dist/assets/mobile-_zUth69Z.js +2 -0
- package/dist/assets/mobileBackNavigation--ZdrI-Yj.js +1 -0
- package/dist/assets/mobileConnections-C3eGEOPy.js +2 -0
- package/dist/assets/multirun-CDYNyLBH.js +3 -0
- package/dist/assets/{native-config-BOaqa45X.js → native-config-DOawZfln.js} +1 -1
- package/dist/assets/navigation-Ibk_Pw-q.js +2 -0
- package/dist/assets/{pl-BnW5wJrl.js → pl-Cqo1FJwM.js} +3 -3
- package/dist/assets/platform-wF65ZFgV.js +1 -0
- package/dist/assets/project-preview-2H-TmJkd.js +1 -0
- package/dist/assets/projectActions-50e_f9dI.js +1 -0
- package/dist/assets/projectMeta-D1Ytss9U.js +1 -0
- package/dist/assets/prompt-attachment-upload-BNhDXymd.js +1 -0
- package/dist/assets/{pt-BR-fZW8CCVQ.js → pt-BR-C930XU1k.js} +3 -3
- package/dist/assets/pwa-CXupOTsD.js +2 -0
- package/dist/assets/queue-abort-optimistic-CQXpIlq6.js +1 -0
- package/dist/assets/{react-DPhQUTaH.js → react-CgRToPwO.js} +1 -1
- package/dist/assets/{readiness-BpVAjFhF.js → readiness-BfuZm6Yw.js} +2 -2
- package/dist/assets/relay-preview-frame-src-BPyz3nXA.js +1 -0
- package/dist/assets/remote-input-store-BOdCWpQY.js +1 -0
- package/dist/assets/remoteProjectQueries-CkxdZNw4.js +1 -0
- package/dist/assets/renderElectronMiniChatApp-pJ59iC34.js +2 -0
- package/dist/assets/renderMobileApp-BQFC-gOA.js +29 -0
- package/dist/assets/{runtime-file-download-DMY1k1af.js → runtime-file-download-D11Nnedg.js} +1 -1
- package/dist/assets/runtime-file-resource-CuLP3xp7.js +6 -0
- package/dist/assets/runtimeConfig-tHm7o_0I.js +2 -0
- package/dist/assets/{runtimeEndpointReset-BOdd_mJM.css → runtimeEndpointReset-BUGfn7y0.css} +1 -1
- package/dist/assets/runtimeEndpointReset-BhHWFNvo.js +150 -0
- package/dist/assets/safeStorage-DTOhKN0V.js +1 -0
- package/dist/assets/scheduledTaskNavigation-BIDtQ4wN.js +1 -0
- package/dist/assets/{select-CyPxbnW8.js → select-B1On-Y4Z.js} +1 -1
- package/dist/assets/sessionLookup-RcyTTDOy.js +1 -0
- package/dist/assets/sortable-tabs-strip-nD1Me06z.js +1 -0
- package/dist/assets/{speechSettingsQueries-CTsBn-Ib.js → speechSettingsQueries-BYhNpzDJ.js} +1 -1
- package/dist/assets/src-BZCFf9_1.css +2 -0
- package/dist/assets/{store-CzVMz42v.js → store-DunGyOfe.js} +4 -4
- package/dist/assets/terminalApi-madXrfqA.js +1 -0
- package/dist/assets/{textarea-CjJsstUF.js → textarea-Qt06OhhX.js} +1 -1
- package/dist/assets/{tooltip-Di_DSZ8p.js → tooltip-D382RCy1.js} +1 -1
- package/dist/assets/tour-CQMBn8gJ.js +1 -0
- package/dist/assets/{types-wnqkJWYs.js → types-CHszLAS3.js} +1 -1
- package/dist/assets/{uk-C4OKsNRv.js → uk-OXQSdzuT.js} +3 -3
- package/dist/assets/{useAppFontEffects-BRMf55oN.js → useAppFontEffects-CqXrCJVt.js} +63 -58
- package/dist/assets/useAppFontEffects-K31q-1OV.css +1 -0
- package/dist/assets/useAssistantUIStore-jOKVcBK8.js +1 -0
- package/dist/assets/useDesktopWindowControlsLayout-KH4UP7Gj.js +1 -0
- package/dist/assets/{useDictation-Sk20Gi0T.js → useDictation-Bs7TWO9r.js} +1 -1
- package/dist/assets/useEffectiveDirectory-CCKRdyK9.js +1 -0
- package/dist/assets/useFontPreferences-CPrl1_3z.js +1 -0
- package/dist/assets/{useMobileHtmlPreviewStore-C03uVLfX.js → useMobileHtmlPreviewStore-EOAzZiAy.js} +1 -1
- package/dist/assets/useMobileNavigationStore-BNtVrnSw.js +13 -0
- package/dist/assets/usePluginsStore-bMuGciUE.js +1 -0
- package/dist/assets/useProjectRuntimeAPIs-BFCXBu2J.js +1 -0
- package/dist/assets/{useStreamingTextThrottle-CjMALEr7.js → useStreamingTextThrottle-C8xAqcgP.js} +1 -1
- package/dist/assets/{useThemeSystem-CNzUUkFn.js → useThemeSystem-C57Z9mV2.js} +1 -1
- package/dist/assets/useUIStore-Cfmg-aDQ.js +1 -0
- package/dist/assets/uuid-D-SDZijH.js +1 -0
- package/dist/assets/{vendor-base-ui-CzHs0bHY.js → vendor-base-ui-z2M4boRm.js} +1 -1
- package/dist/assets/{vendor-cmdk-C_tivUtr.js → vendor-cmdk-BgHvMv5l.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-accessibility-BOtnpZt5.js → vendor-dnd-kit-accessibility-gVi9ga0x.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-core-DK4OoOTr.js → vendor-dnd-kit-core-Dd5yS2-T.js} +1 -1
- package/dist/assets/{vendor-dnd-kit-sortable-Cv69eQm1.js → vendor-dnd-kit-sortable-CV-SGi8y.js} +1 -1
- package/dist/assets/{vendor-framer-motion-DDMKlXiP.js → vendor-framer-motion-CF9BQLta.js} +1 -1
- package/dist/assets/{vendor-markstream-react-6zxyQLCD.js → vendor-markstream-react-TwEpkgfP.js} +3 -3
- package/dist/assets/vendor-motion-Dv27UnOI.js +1 -0
- package/dist/assets/{vendor-pierre-diffs-BFiZ3IhI.js → vendor-pierre-diffs-tqo4Z3TC.js} +1 -1
- package/dist/assets/{vendor-react-DlzBev0S.js → vendor-react-P8wFrkcT.js} +1 -1
- package/dist/assets/{vendor-react-drawio-Dyg1-39Q.js → vendor-react-drawio-CQW1YP2l.js} +1 -1
- package/dist/assets/vendor-reactuses-core-Dyjw5sZR.js +1 -0
- package/dist/assets/{vendor-sonner-BEHGipm5.js → vendor-sonner-B5HgJenP.js} +1 -1
- package/dist/assets/{vendor-stream-diffs-wcQxoPZk.js → vendor-stream-diffs-DCMtZcS3.js} +2 -2
- package/dist/assets/vendor-tanstack-query-core-BSjXNgF_.js +1 -0
- package/dist/assets/vendor-tanstack-react-query-B-KblYBV.js +1 -0
- package/dist/assets/{vendor-tanstack-react-virtual-DSFNK3qc.js → vendor-tanstack-react-virtual-BkuqzrEV.js} +1 -1
- package/dist/assets/{vendor-zustand-vDaAPGfl.js → vendor-zustand-Cwko4FG1.js} +1 -1
- package/dist/assets/{zh-CN-ieAs59w6.js → zh-CN-B5X8yCZV.js} +3 -3
- package/dist/assets/{zh-TW-WWTW1fkP.js → zh-TW-CF6zr1fk.js} +3 -3
- package/dist/index.html +32 -27
- package/dist/mini-chat.html +32 -27
- package/dist/mobile.html +2 -2
- package/package.json +3 -2
- package/server/index.d.ts +19 -0
- package/server/index.js +35 -5
- package/server/lib/assistants/builtin-skills.js +1 -1
- package/server/lib/assistants/builtin-skills.test.js +2 -0
- package/server/lib/client-auth/remote-clients.js +11 -0
- package/server/lib/content-search/DOCUMENTATION.md +5 -0
- package/server/lib/content-search/routes.js +4 -0
- package/server/lib/content-search/routes.test.js +10 -0
- package/server/lib/event-stream/DOCUMENTATION.md +5 -0
- package/server/lib/event-stream/runtime.js +3 -0
- package/server/lib/event-stream/upstream-reader.js +1 -1
- package/server/lib/gui-customization/DOCUMENTATION.md +25 -1
- package/server/lib/gui-customization/projects-client.mjs +59 -0
- package/server/lib/gui-customization/projects.js +43 -0
- package/server/lib/gui-customization/projects.test.js +103 -0
- package/server/lib/gui-customization/remote-connections-client.mjs +2 -8
- package/server/lib/gui-customization/session-skill-command.mjs +8 -0
- package/server/lib/gui-customization/session-skill.js +15 -10
- package/server/lib/gui-customization/session-skill.test.js +21 -2
- package/server/lib/gui-customization/skill/SKILL.md +3 -1
- package/server/lib/gui-customization/skill/references/projects.md +63 -0
- package/server/lib/gui-customization/skill/references/remote-connections.md +11 -0
- package/server/lib/message-queue/DOCUMENTATION.md +4 -0
- package/server/lib/message-queue/service.js +2 -1
- package/server/lib/message-queue/service.test.js +11 -0
- package/server/lib/notifications/DOCUMENTATION.md +12 -0
- package/server/lib/notifications/emitter-runtime.js +5 -0
- package/server/lib/notifications/runtime.js +20 -2
- package/server/lib/notifications/runtime.test.js +21 -0
- package/server/lib/notifications/session-unread-runtime.js +51 -13
- package/server/lib/notifications/session-unread.test.js +113 -1
- package/server/lib/opencode/DOCUMENTATION.md +28 -0
- package/server/lib/opencode/core-routes.js +16 -3
- package/server/lib/opencode/core-routes.test.js +28 -0
- package/server/lib/opencode/feature-routes-runtime.js +12 -1
- package/server/lib/opencode/feature-routes-runtime.test.js +4 -0
- package/server/lib/opencode/proxy.js +1 -0
- package/server/lib/opencode/routes.js +18 -4
- package/server/lib/opencode/routes.test.js +22 -0
- package/server/lib/opencode/settings-helpers.js +26 -0
- package/server/lib/opencode/settings-helpers.test.js +20 -0
- package/server/lib/opencode/settings-runtime.js +5 -3
- package/server/lib/opencode/settings-runtime.test.js +35 -0
- package/server/lib/preview/DOCUMENTATION.md +73 -0
- package/server/lib/preview/file-preview-path.js +37 -0
- package/server/lib/preview/file-target.js +38 -0
- package/server/lib/preview/file-target.test.js +111 -0
- package/server/lib/preview/proxy-runtime.js +110 -17
- package/server/lib/projects/DOCUMENTATION.md +12 -3
- package/server/lib/relay/tunnel-host.js +1 -0
- package/server/lib/remote-hosts/DOCUMENTATION.md +269 -0
- package/server/lib/remote-hosts/configuration.js +15 -0
- package/server/lib/remote-hosts/deadline.js +22 -0
- package/server/lib/remote-hosts/deadline.test.js +64 -0
- package/server/lib/remote-hosts/fixtures/settings-server.mjs +26 -0
- package/server/lib/remote-hosts/gateway.js +644 -0
- package/server/lib/remote-hosts/json-lifecycle.test.js +55 -0
- package/server/lib/remote-hosts/preview-scope.js +23 -0
- package/server/lib/remote-hosts/relay-client.ts +3 -0
- package/server/lib/remote-hosts/routes.js +432 -0
- package/server/lib/remote-hosts/routes.test.js +1176 -0
- package/server/lib/remote-hosts/settings-production.test.js +145 -0
- package/server/lib/remote-hosts/store.js +110 -0
- package/server/lib/remote-hosts/store.test.js +33 -0
- package/server/lib/remote-hosts/transport.js +113 -0
- package/server/lib/scheduled-tasks/session-skill.js +2 -1
- package/server/lib/scheduled-tasks/session-skill.test.js +34 -1
- package/server/lib/session-folders/routes.js +1 -0
- package/server/lib/session-index/DOCUMENTATION.md +4 -1
- package/server/lib/session-index/event-ingest.js +8 -0
- package/server/lib/session-index/event-ingest.test.js +16 -0
- package/server/lib/session-index/service.js +1 -0
- package/server/lib/session-index/service.test.js +3 -1
- package/server/lib/session-metadata/DOCUMENTATION.md +18 -1
- package/server/lib/session-title/DOCUMENTATION.md +3 -0
- package/server/lib/session-title/runtime.js +1 -0
- package/server/lib/session-title/runtime.test.js +2 -0
- package/server/lib/transcript-cache/DOCUMENTATION.md +4 -0
- package/server/lib/transcript-cache/routes.js +3 -0
- package/server/lib/transcript-cache/service.js +15 -0
- package/server/lib/transcript-cache/service.test.js +13 -0
- package/server/lib/ui-auth/DOCUMENTATION.md +18 -0
- package/server/lib/ui-auth/ui-auth.js +30 -2
- package/server/lib/ui-auth/ui-auth.test.js +46 -1
- package/dist/assets/AssistantConversationSurface-CW3U6Lhp.js +0 -3
- package/dist/assets/DiagramView-CzhdZEw4.js +0 -1
- package/dist/assets/GuiPluginSurface-BG3hENTt.js +0 -1
- package/dist/assets/LoadingImage-DmucvXdY.js +0 -1
- package/dist/assets/MarkdownRenderer-BkOMcK8x.js +0 -2
- package/dist/assets/MarkdownRendererImpl-B5vJtPoa.js +0 -10
- package/dist/assets/MarkstreamRendererImpl-1J-Gu2M2.js +0 -3
- package/dist/assets/MobileDetailNavigation-48o8aG28.js +0 -1
- package/dist/assets/MobileShareBridge-DnYT3Dbz.js +0 -3
- package/dist/assets/MobileTabPageHeader-D6kqRFm0.js +0 -2
- package/dist/assets/OnboardingScreen-Bn0RgrJU.js +0 -1
- package/dist/assets/SettingsView-Bla2lVqS.js +0 -29
- package/dist/assets/SetupTourDialog-GDRS3gDa.js +0 -1
- package/dist/assets/TerminalView-B1u3s7IN.js +0 -8
- package/dist/assets/ToolOutputDialog-CYUPmbtq.js +0 -10
- package/dist/assets/VoiceSettings-Dy6-nkQo.js +0 -2
- package/dist/assets/YuriWordmark--S-QEpRp.js +0 -1
- package/dist/assets/appThemeRegistry--G1XaYmo.js +0 -1
- package/dist/assets/bootstrap-BhC95qVC.js +0 -1
- package/dist/assets/fileQueries-D9l0crnM.js +0 -1
- package/dist/assets/fileReferenceActions-BmquJskG.js +0 -1
- package/dist/assets/gitApiHttp-D4d-rgcR.js +0 -9
- package/dist/assets/historyImportQueries-DkB2_92i.js +0 -1
- package/dist/assets/host-kMLXU0hK.js +0 -1
- package/dist/assets/image-loading-BrDob6MW.js +0 -1
- package/dist/assets/insertionBoundaries-CB4gv9rr.js +0 -1
- package/dist/assets/main-B1KrAdkh.js +0 -2
- package/dist/assets/main-Caf-6KmT.js +0 -169
- package/dist/assets/mcpQueries-CQyOFjX2.js +0 -1
- package/dist/assets/miniChat-zEoOVjOQ.js +0 -2
- package/dist/assets/mobile-Dt8wAkc4.js +0 -2
- package/dist/assets/mobileBackNavigation-BbKMa0Jb.js +0 -1
- package/dist/assets/mobileConnections-CXYj4P9M.js +0 -2
- package/dist/assets/multirun-9v2r_beX.js +0 -3
- package/dist/assets/pathNormalization-ewtPqJWn.js +0 -1
- package/dist/assets/platform-DMsFWy1a.js +0 -1
- package/dist/assets/projectActions-C-9Z8R7y.js +0 -1
- package/dist/assets/projectMeta-ZouOo-T_.js +0 -1
- package/dist/assets/pwa-syKJBLoe.js +0 -2
- package/dist/assets/queue-abort-optimistic-BYH5yLM2.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-DprABvit.js +0 -2
- package/dist/assets/renderMobileApp-DQmX6iak.js +0 -29
- package/dist/assets/runtime-file-resource-CL7EVzOG.js +0 -2
- package/dist/assets/runtimeConfig-7Umh9QWi.js +0 -2
- package/dist/assets/runtimeEndpointReset-BYtLmSuX.js +0 -149
- package/dist/assets/scheduledTaskNavigation-FMDNRUnX.js +0 -1
- package/dist/assets/sessionLookup-D_fPlqqT.js +0 -1
- package/dist/assets/sortable-tabs-strip-BclS0Hnd.js +0 -1
- package/dist/assets/src-HgtAe3Q4.css +0 -2
- package/dist/assets/terminalApi-DK4KmfFn.js +0 -1
- package/dist/assets/touch-gestures-CErgaXZ7.js +0 -1
- package/dist/assets/tour-DDI0Zg7l.js +0 -1
- package/dist/assets/useAppFontEffects-RpgNbjA4.css +0 -1
- package/dist/assets/useAssistantUIStore-nNYL140o.js +0 -1
- package/dist/assets/useDesktopWindowControlsLayout-Bq9DFNYn.js +0 -1
- package/dist/assets/useEffectiveDirectory-5RwQ_nuK.js +0 -1
- package/dist/assets/useFontPreferences-DxzruDDQ.js +0 -1
- package/dist/assets/useMobileNavigationStore-ePbEoQwb.js +0 -17
- package/dist/assets/usePluginsStore-HJJZ65gd.js +0 -1
- package/dist/assets/useUIStore-vvNwcOk3.js +0 -1
- package/dist/assets/useWorkerHighlightedLines-6x1R4afJ.js +0 -7
- package/dist/assets/vendor-motion-C9oiAdx-.js +0 -1
- package/dist/assets/vendor-reactuses-core-CuTmqEMK.js +0 -1
- package/dist/assets/vendor-tanstack-query-core-Y_YoRHtC.js +0 -1
- package/dist/assets/vendor-tanstack-react-query-B-Wpqq5J.js +0 -1
|
@@ -6,6 +6,7 @@ import path from 'path';
|
|
|
6
6
|
import { createProjectIdFromPath } from '../projects/project-id.js';
|
|
7
7
|
import { createSettingsRuntime } from './settings-runtime.js';
|
|
8
8
|
import { createSettingsNormalizationRuntime } from './settings-normalization-runtime.js';
|
|
9
|
+
import { createSettingsHelpers } from './settings-helpers.js';
|
|
9
10
|
|
|
10
11
|
const createRuntime = async (overrides = {}) => {
|
|
11
12
|
const tempRoot = await fsPromises.mkdtemp(path.join(os.tmpdir(), 'yuri-settings-runtime-'));
|
|
@@ -36,6 +37,40 @@ const createRuntime = async (overrides = {}) => {
|
|
|
36
37
|
};
|
|
37
38
|
|
|
38
39
|
describe('settings runtime', () => {
|
|
40
|
+
it('serializes real Hub layout merge and emits tips only after changed commits; failure retains disk', async () => {
|
|
41
|
+
const helpers = createSettingsHelpers({ normalizePathForPersistence: value => value,
|
|
42
|
+
normalizeDirectoryPath: value => value, sanitizeTypographySizesPartial: () => undefined,
|
|
43
|
+
normalizeStringArray: value => value, sanitizeModelRefs: () => undefined,
|
|
44
|
+
sanitizeSkillCatalogs: () => undefined, sanitizeProjects: value => value });
|
|
45
|
+
let tips = 0; let fail = false;
|
|
46
|
+
const { runtime, settingsFilePath, cleanup } = await createRuntime({
|
|
47
|
+
sanitizeSettingsUpdate: helpers.sanitizeSettingsUpdate, mergePersistedSettings: helpers.mergePersistedSettings,
|
|
48
|
+
onProjectOrderChanged: () => { tips++; },
|
|
49
|
+
fsPromises: { ...fsPromises, rename: async (...args) => { if (fail) throw new Error('layout write failed'); return fsPromises.rename(...args); } },
|
|
50
|
+
});
|
|
51
|
+
try {
|
|
52
|
+
const first = { hubId: 'hub', order: ['local', 'remote-a'], collapsed: { local: true } };
|
|
53
|
+
await runtime.persistSettings({ hubProjectLayout: first });
|
|
54
|
+
expect(tips).toBe(1);
|
|
55
|
+
await runtime.persistSettings({ hubProjectLayout: first });
|
|
56
|
+
expect(tips).toBe(1);
|
|
57
|
+
await Promise.all([
|
|
58
|
+
runtime.persistSettings({ hubProjectLayout: { hubId: 'hub', order: ['remote-b'], collapsed: { 'remote-b': true } } }),
|
|
59
|
+
runtime.persistSettings({ hubProjectLayout: { hubId: 'hub', order: ['remote-a'], collapsed: { local: false } } }),
|
|
60
|
+
]);
|
|
61
|
+
const expected = { hubId: 'hub', order: ['remote-a', 'remote-b', 'local'], collapsed: { local: false, 'remote-b': true } };
|
|
62
|
+
expect((await runtime.readSettingsFromDisk()).hubProjectLayout).toEqual(expected);
|
|
63
|
+
expect(tips).toBe(3);
|
|
64
|
+
fail = true;
|
|
65
|
+
await expect(runtime.persistSettings({ hubProjectLayout: first })).rejects.toThrow('layout write failed');
|
|
66
|
+
expect(tips).toBe(3);
|
|
67
|
+
expect((await runtime.readSettingsFromDisk()).hubProjectLayout).toEqual(expected);
|
|
68
|
+
await fsPromises.writeFile(settingsFilePath, '{malformed');
|
|
69
|
+
await expect(runtime.persistSettings({ hubProjectLayout: first })).rejects.toThrow();
|
|
70
|
+
expect(await fsPromises.readFile(settingsFilePath, 'utf8')).toBe('{malformed');
|
|
71
|
+
expect(tips).toBe(3);
|
|
72
|
+
} finally { await cleanup(); }
|
|
73
|
+
});
|
|
39
74
|
it.each(['read-first', 'write-first', 'functional-write-first'])(
|
|
40
75
|
'keeps a fresh home-directory bootstrap out of the project registry (%s)', async (order) => {
|
|
41
76
|
const { runtime, tempRoot, cleanup } = await createRuntime({
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# Preview targets and resource graphs
|
|
2
|
+
|
|
3
|
+
`proxy-runtime.js` owns the existing `/api/preview/targets` registry and
|
|
4
|
+
`/api/preview/proxy/:id` HTTP/WS transport. Network targets retain the existing
|
|
5
|
+
loopback-origin normalization, resource rewrite, CSP/bridge and redirect behavior.
|
|
6
|
+
|
|
7
|
+
## Project file target
|
|
8
|
+
|
|
9
|
+
`POST /api/preview/targets` accepts `{ kind: 'file', directory, path, ttlMs? }`.
|
|
10
|
+
`directory` and `path` are absolute physical paths, not serialized Location keys.
|
|
11
|
+
Both are canonicalized; the HTML entry must be inside the directory. A Remote
|
|
12
|
+
Project's Hub gateway first obtains its registered project/worktree authority and
|
|
13
|
+
replaces the submitted root with that authority. A caller cannot grant itself an
|
|
14
|
+
arbitrary remote directory. The response is `{ id, kind: 'file', proxyBasePath,
|
|
15
|
+
entryPath, previewToken, expiresAt }`; `entryPath` is encoded project-relative path.
|
|
16
|
+
|
|
17
|
+
File browser URLs use:
|
|
18
|
+
|
|
19
|
+
```
|
|
20
|
+
[Host prefix]/api/preview/proxy/:id/_file/:previewToken/:shortUrlAuthToken/:relativePath
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
All ordinary relative references resolve in the browser: HTML attributes, CSS
|
|
24
|
+
`@import`/`url()`, JS static/dynamic imports and fetch, and nested documents retain
|
|
25
|
+
the entire target/auth/Host prefix. There is no second static server, global
|
|
26
|
+
runtime switch, server-side HTML parser, resource crawler or Relay `srcDoc`
|
|
27
|
+
fallback. Existing preview rewriting handles root-relative references; the
|
|
28
|
+
existing request bridge recognizes the file envelope for root fetch/Request/URL
|
|
29
|
+
inputs. Arbitrary external origins are not rewritten or given Yuri tokens.
|
|
30
|
+
|
|
31
|
+
`file-preview-path.js` is the shared strict envelope parser. It rejects dot
|
|
32
|
+
segments, encoded slash/backslash/control and malformed URI escapes. The only
|
|
33
|
+
credential format is the existing short URL token (`yuri_url_` plus 32 base64url
|
|
34
|
+
characters). GET/HEAD authentication reads that segment through the normal
|
|
35
|
+
ui-auth authorization/revocation gates; the preview token alone is not ordinary
|
|
36
|
+
UI authentication. Explicit bearer auth takes precedence. A `-` segment carries
|
|
37
|
+
no credential and never bypasses normal authentication.
|
|
38
|
+
|
|
39
|
+
After Hub authorization, the Remote Host gateway replaces the Hub URL token with
|
|
40
|
+
`-` before forwarding over the existing authenticated direct/Relay Host transport.
|
|
41
|
+
The Remote's root-resource rewrite emits `REMOTE_PREVIEW_TOKEN_MARKER`, never the
|
|
42
|
+
Hub credential; the existing Hub streaming substitution restores a short Hub-side
|
|
43
|
+
token. Plain relative URLs need no token serialization in response bodies.
|
|
44
|
+
Responses are `no-store`, `no-referrer`, and `nosniff`; the Hub preserves these
|
|
45
|
+
policies. Tokens must never enter logs or external-site URLs/referrers.
|
|
46
|
+
|
|
47
|
+
Every descendant canonicalizes its path again and rejects symlinks outside the
|
|
48
|
+
target root. Files are bounded to 100 MiB. Binary assets stream through Express;
|
|
49
|
+
text HTML/CSS/JS uses the existing preview rewrite/bridge. Directory resources
|
|
50
|
+
resolve `index.html`. Files permit GET/HEAD only; file WebSockets are explicitly
|
|
51
|
+
rejected, including when the normal HTTP preview proxy has attached its automatic
|
|
52
|
+
upgrade listener. Normal network-preview WebSockets are unchanged.
|
|
53
|
+
|
|
54
|
+
`DELETE /api/preview/targets/:id` accepts `{ previewToken }` through normal
|
|
55
|
+
session/client authorization and origin checks. It is idempotent for an already
|
|
56
|
+
missing target. Revocation destroys active responses; expiry checks every request
|
|
57
|
+
and terminates active file responses at the deadline. Client disconnect aborts
|
|
58
|
+
file reads/streams through the existing transport chain. A failed cleanup after
|
|
59
|
+
the captured runtime ends cannot be sent using the next runtime's credentials;
|
|
60
|
+
the old server's grant remains bounded by expiry.
|
|
61
|
+
|
|
62
|
+
## Verification
|
|
63
|
+
|
|
64
|
+
`file-target.test.js` exercises real production Hub + two Host listeners, real
|
|
65
|
+
ui-auth/client revocation, registered directory gateway, every resource kind,
|
|
66
|
+
symlink rejection, Host mismatch, target and URL-token expiry, revoke, and 80 MiB
|
|
67
|
+
stream cancellation. A separate case uses the real E2EE Relay transport for Host
|
|
68
|
+
A, while Host B stays direct. `proxy-runtime.test.js` retains network-preview
|
|
69
|
+
regressions. `scripts/remote-project-file-preview-smoke.mjs` exports the same
|
|
70
|
+
isolated fixture for browser/platform checks and records a source manifest.
|
|
71
|
+
|
|
72
|
+
Browser evidence is not Electron main/preload or Capacitor WKWebView evidence.
|
|
73
|
+
Those platforms require separate application/gateway/native network checks.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { REMOTE_PREVIEW_TOKEN_MARKER } from '../remote-hosts/preview-scope.js';
|
|
2
|
+
|
|
3
|
+
const URL_TOKEN = /^yuri_url_[A-Za-z0-9_-]{32}$/;
|
|
4
|
+
const TOKEN_SEGMENT = /^(?:yuri_url_[A-Za-z0-9_-]{32}|-|__YURI_HUB_URL_AUTH__)$/;
|
|
5
|
+
|
|
6
|
+
/** Only the file-preview envelope may carry URL auth in a path, never other APIs. */
|
|
7
|
+
export const parseFilePreviewPath = (pathname) => {
|
|
8
|
+
if (typeof pathname !== 'string' || /[\\?#\u0000-\u0020]/.test(pathname)) return null;
|
|
9
|
+
const match = /^(\/api\/hosts\/[A-Za-z0-9._~%-]{1,256})?\/api\/preview\/proxy\/([a-f0-9]{16,64})\/_file\/([a-f0-9]{32})\/([^/]+)(\/.*)$/i.exec(pathname);
|
|
10
|
+
if (!match || !TOKEN_SEGMENT.test(match[4])) return null;
|
|
11
|
+
try {
|
|
12
|
+
for (const segment of pathname.split('/').slice(1)) {
|
|
13
|
+
const decoded = decodeURIComponent(segment);
|
|
14
|
+
if (decoded === '.' || decoded === '..' || /[\\/\u0000-\u001f\u007f]/.test(decoded)) return null;
|
|
15
|
+
}
|
|
16
|
+
} catch { return null; }
|
|
17
|
+
const resourcePath = match[5];
|
|
18
|
+
const basePath = pathname.slice(0, -resourcePath.length);
|
|
19
|
+
return { hostPrefix: match[1] || '', id: match[2], previewToken: match[3], urlAuthToken: match[4], resourcePath, basePath };
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const readFilePreviewUrlAuthToken = (pathname) => {
|
|
23
|
+
const parsed = parseFilePreviewPath(pathname);
|
|
24
|
+
return parsed && URL_TOKEN.test(parsed.urlAuthToken) ? parsed.urlAuthToken : '';
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
/** Hub must strip its credential before the existing authenticated Host transport. */
|
|
28
|
+
export const replaceFilePreviewUrlAuthToken = (pathname, replacement = '-') => {
|
|
29
|
+
const parsed = parseFilePreviewPath(pathname);
|
|
30
|
+
if (!parsed || !TOKEN_SEGMENT.test(replacement)) return null;
|
|
31
|
+
return `${parsed.basePath.slice(0, -parsed.urlAuthToken.length)}${replacement}${parsed.resourcePath}`;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const filePreviewResponseBase = (parsed, hostPrefix) => {
|
|
35
|
+
const token = hostPrefix ? REMOTE_PREVIEW_TOKEN_MARKER : parsed.urlAuthToken;
|
|
36
|
+
return `${hostPrefix}/api/preview/proxy/${parsed.id}/_file/${parsed.previewToken}/${token}`;
|
|
37
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
|
|
4
|
+
const inside = (root, file) => {
|
|
5
|
+
const relative = path.relative(root, file);
|
|
6
|
+
return relative === '' || (!relative.startsWith(`..${path.sep}`) && relative !== '..' && !path.isAbsolute(relative));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const createFileTarget = async (directory, filePath) => {
|
|
10
|
+
if (typeof directory !== 'string' || !path.isAbsolute(directory)
|
|
11
|
+
|| typeof filePath !== 'string' || !path.isAbsolute(filePath)) throw Object.assign(new Error('Invalid file target'), { status: 400 });
|
|
12
|
+
const [root, entry] = await Promise.all([fs.realpath(directory), fs.realpath(filePath)]);
|
|
13
|
+
if (!inside(root, entry)) throw Object.assign(new Error('File outside project'), { status: 403 });
|
|
14
|
+
if (!(await fs.stat(root)).isDirectory() || !(await fs.stat(entry)).isFile()
|
|
15
|
+
|| !/\.html?$/i.test(entry)) throw Object.assign(new Error('HTML file required'), { status: 400 });
|
|
16
|
+
const entryPath = `/${path.relative(root, entry).split(path.sep).map(encodeURIComponent).join('/')}`;
|
|
17
|
+
return { kind: 'file', root, entryPath };
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** Resolve every descendant again: a symlink added after registration grants no escape. */
|
|
21
|
+
export const resolveFileTargetResource = async (root, resourcePath) => {
|
|
22
|
+
const decoded = decodeURIComponent(resourcePath);
|
|
23
|
+
let candidate = path.resolve(root, `.${decoded}`);
|
|
24
|
+
if (!inside(root, candidate)) throw Object.assign(new Error('File outside project'), { status: 403 });
|
|
25
|
+
candidate = await fs.realpath(candidate);
|
|
26
|
+
if (!inside(root, candidate)) throw Object.assign(new Error('File outside project'), { status: 403 });
|
|
27
|
+
let stat = await fs.stat(candidate);
|
|
28
|
+
if (stat.isDirectory()) {
|
|
29
|
+
candidate = await fs.realpath(path.join(candidate, 'index.html'));
|
|
30
|
+
if (!inside(root, candidate)) throw Object.assign(new Error('File outside project'), { status: 403 });
|
|
31
|
+
stat = await fs.stat(candidate);
|
|
32
|
+
}
|
|
33
|
+
if (!stat.isFile()) throw Object.assign(new Error('File required'), { status: 400 });
|
|
34
|
+
if (stat.size > 100 * 1024 * 1024) throw Object.assign(new Error('File too large'), { status: 413 });
|
|
35
|
+
return candidate;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const readFileTargetText = (file, signal) => fs.readFile(file, { encoding: 'utf8', signal });
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { afterEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { createFilePreviewSmokeFixture } from '../../../../../scripts/remote-project-file-preview-smoke.mjs';
|
|
3
|
+
import { parseFilePreviewPath, readFilePreviewUrlAuthToken, replaceFilePreviewUrlAuthToken } from './file-preview-path.js';
|
|
4
|
+
import fs from 'node:fs/promises';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
|
|
7
|
+
const cleanups = [];
|
|
8
|
+
afterEach(async () => { vi.restoreAllMocks(); for (const cleanup of cleanups.splice(0).reverse()) await cleanup(); });
|
|
9
|
+
|
|
10
|
+
describe('file preview pathname capability envelope', () => {
|
|
11
|
+
const id = 'a'.repeat(32), preview = 'b'.repeat(32), urlAuth = `yuri_url_${'c'.repeat(32)}`;
|
|
12
|
+
const base = `/api/hosts/remote/api/preview/proxy/${id}/_file/${preview}/${urlAuth}`;
|
|
13
|
+
it('extracts only short URL auth and replaces it before the Remote Host boundary', () => {
|
|
14
|
+
expect(readFilePreviewUrlAuthToken(`${base}/docs/index.html`)).toBe(urlAuth);
|
|
15
|
+
expect(replaceFilePreviewUrlAuthToken(`${base}/docs/index.html`)).toBe(`${base.replace(urlAuth, '-')}/docs/index.html`);
|
|
16
|
+
expect(readFilePreviewUrlAuthToken(`${base.replace(urlAuth, '-')}/docs/index.html`)).toBe('');
|
|
17
|
+
expect(parseFilePreviewPath(`${base}/docs/index.html`)?.resourcePath).toBe('/docs/index.html');
|
|
18
|
+
});
|
|
19
|
+
it('rejects normalized-prefix escape, encoded separators and wrong token formats', () => {
|
|
20
|
+
for (const suffix of ['/../api/session', '/%2e%2e/secret', '/%2fsecret', '/a%5cb', '/bad%00', '/%ff']) {
|
|
21
|
+
expect(parseFilePreviewPath(`${base}${suffix}`)).toBeNull();
|
|
22
|
+
}
|
|
23
|
+
expect(readFilePreviewUrlAuthToken(base.replace(urlAuth, 'long-lived-bearer') + '/index.html')).toBe('');
|
|
24
|
+
expect(readFilePreviewUrlAuthToken(`/api/fs/serve/${urlAuth}`)).toBe('');
|
|
25
|
+
});
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('production file target HTTP resource graph', () => {
|
|
29
|
+
it('uses the real E2EE Relay transport for file graph descendants without forwarding Hub credentials', async () => {
|
|
30
|
+
const fixture = await createFilePreviewSmokeFixture({ relay: true }); cleanups.push(fixture.stop);
|
|
31
|
+
const base = `${fixture.hub.origin}${fixture.targets[0].route}`;
|
|
32
|
+
for (const relative of ['index.html', '../assets/style.css', '../assets/extra.css', '../assets/main.mjs', '../assets/part.mjs', '../assets/dynamic.mjs', '../assets/data.json', '../assets/pixel.svg', 'nested/frame.html']) {
|
|
33
|
+
const response = await fetch(new URL(relative, base));
|
|
34
|
+
expect(response.status).toBe(200); await response.arrayBuffer();
|
|
35
|
+
}
|
|
36
|
+
expect(fixture.requests.filter((req) => req.leakedHubToken)).toEqual([]);
|
|
37
|
+
}, 30_000);
|
|
38
|
+
it('retains two Host scopes across every descendant and denies leaks, writes, symlinks and revocation', async () => {
|
|
39
|
+
const fixture = await createFilePreviewSmokeFixture(); cleanups.push(fixture.stop);
|
|
40
|
+
for (const [index, target] of fixture.targets.entries()) {
|
|
41
|
+
const entry = new URL(target.route, fixture.hub.origin);
|
|
42
|
+
const request = (relative) => fetch(new URL(relative, entry));
|
|
43
|
+
const html = await request('index.html');
|
|
44
|
+
expect(html.status).toBe(200);
|
|
45
|
+
expect(html.headers.get('referrer-policy')).toBe('no-referrer');
|
|
46
|
+
expect(html.headers.get('cache-control')).toContain('no-store');
|
|
47
|
+
const text = await html.text();
|
|
48
|
+
expect(text).toContain(index === 0 ? 'remote-a' : 'remote-b');
|
|
49
|
+
expect((await request('../assets/style.css')).status).toBe(200);
|
|
50
|
+
expect((await request('../assets/extra.css')).status).toBe(200);
|
|
51
|
+
expect((await request('../assets/main.mjs')).headers.get('content-type')).toContain('javascript');
|
|
52
|
+
expect(await (await request('../assets/part.mjs')).text()).toContain(index === 0 ? 'remote-a-module' : 'remote-b-module');
|
|
53
|
+
expect((await request('../assets/dynamic.mjs')).status).toBe(200);
|
|
54
|
+
expect(await (await request('../assets/data.json')).json()).toEqual({ host: index === 0 ? 'remote-a' : 'remote-b' });
|
|
55
|
+
expect((await request('../assets/pixel.svg')).headers.get('content-type')).toContain('image/svg+xml');
|
|
56
|
+
expect((await request('nested/frame.html')).status).toBe(200);
|
|
57
|
+
expect((await request('../escape.txt')).status).toBe(403);
|
|
58
|
+
expect((await fetch(entry, { method: 'POST' })).status).toBeGreaterThanOrEqual(400);
|
|
59
|
+
expect((await fetch(entry.href.replace(target.previewToken, '0'.repeat(32)))).status).toBe(403);
|
|
60
|
+
}
|
|
61
|
+
expect(fixture.requests.filter((req) => req.leakedHubToken)).toEqual([]);
|
|
62
|
+
const [a, b] = fixture.targets;
|
|
63
|
+
expect((await fetch(`${fixture.hub.origin}${a.route.replace('/hosts/a/', '/hosts/b/')}`)).status).toBe(404);
|
|
64
|
+
const revoke = await fixture.hub.call(`/api/hosts/a/api/preview/targets/${a.id}`, 'DELETE', { previewToken: a.previewToken });
|
|
65
|
+
expect(revoke.status).toBe(204);
|
|
66
|
+
expect((await fetch(`${fixture.hub.origin}${a.route}`)).status).toBe(404);
|
|
67
|
+
expect((await fetch(`${fixture.hub.origin}${b.route}`)).status).toBe(200);
|
|
68
|
+
const originalNow = Date.now();
|
|
69
|
+
const clock = vi.spyOn(Date, 'now').mockReturnValue(originalNow + 61_000);
|
|
70
|
+
expect((await fetch(`${fixture.hub.origin}${b.route}`)).status).toBe(401);
|
|
71
|
+
clock.mockRestore();
|
|
72
|
+
const fresh = await (await fixture.hub.call('/auth/url-token', 'POST')).json();
|
|
73
|
+
const renewed = replaceFilePreviewUrlAuthToken(b.route, fresh.token);
|
|
74
|
+
expect((await fetch(`${fixture.hub.origin}${renewed}`)).status).toBe(200);
|
|
75
|
+
await fixture.hub.clients.revokeClient(fixture.hub.issued.client.id);
|
|
76
|
+
expect((await fetch(`${fixture.hub.origin}${renewed}`)).status).toBe(401);
|
|
77
|
+
}, 30_000);
|
|
78
|
+
|
|
79
|
+
it('target expiry is authoritative even with valid bearer auth; revoke and client cancel terminate remote streams', async () => {
|
|
80
|
+
const fixture = await createFilePreviewSmokeFixture(); cleanups.push(fixture.stop);
|
|
81
|
+
const short = await (await fixture.first.call('/api/preview/targets', 'POST', {
|
|
82
|
+
kind: 'file', directory: fixture.first.root, path: path.join(fixture.first.root, 'docs/index.html'), ttlMs: 15_000,
|
|
83
|
+
})).json();
|
|
84
|
+
const shortRoute = `${short.proxyBasePath}/_file/${short.previewToken}/-${short.entryPath}`;
|
|
85
|
+
expect((await fixture.first.call(shortRoute)).status).toBe(200);
|
|
86
|
+
for (const headers of [{}, { cookie: 'yuri_preview_token=arbitrary' }]) {
|
|
87
|
+
expect((await fetch(`${fixture.first.origin}${shortRoute}?yuri_preview_token=arbitrary`, { headers })).status).toBe(401);
|
|
88
|
+
}
|
|
89
|
+
const actualNow = Date.now();
|
|
90
|
+
const clock = vi.spyOn(Date, 'now').mockReturnValue(actualNow + 15_001);
|
|
91
|
+
expect((await fixture.first.call(shortRoute)).status).toBe(404);
|
|
92
|
+
clock.mockRestore();
|
|
93
|
+
const file = await fs.open(path.join(fixture.first.root, 'large.bin'), 'w');
|
|
94
|
+
await file.truncate(80 * 1024 * 1024); await file.close();
|
|
95
|
+
const target = fixture.targets[0];
|
|
96
|
+
const large = new URL('../large.bin', `${fixture.hub.origin}${target.route}`).href;
|
|
97
|
+
const controller = new AbortController();
|
|
98
|
+
const response = await fetch(large, { signal: controller.signal });
|
|
99
|
+
expect(response.status).toBe(200);
|
|
100
|
+
const reader = response.body.getReader(); await reader.read();
|
|
101
|
+
controller.abort();
|
|
102
|
+
await expect(reader.read()).rejects.toThrow();
|
|
103
|
+
await vi.waitFor(() => expect(fixture.first.activePreviewResponses).toBe(0));
|
|
104
|
+
const active = await fetch(large);
|
|
105
|
+
const activeReader = active.body.getReader(); await activeReader.read();
|
|
106
|
+
expect((await fixture.hub.call(`/api/hosts/a/api/preview/targets/${target.id}`, 'DELETE', { previewToken: target.previewToken })).status).toBe(204);
|
|
107
|
+
await expect((async () => { while (!(await activeReader.read()).done) { /* Drain already-buffered transport chunks. */ } })()).rejects.toThrow();
|
|
108
|
+
await vi.waitFor(() => expect(fixture.first.activePreviewResponses).toBe(0));
|
|
109
|
+
expect((await fetch(`${fixture.hub.origin}${fixture.targets[1].route}`)).status).toBe(200);
|
|
110
|
+
}, 30_000);
|
|
111
|
+
});
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
import { remotePreviewPrefix, REMOTE_PREVIEW_TOKEN_MARKER } from '../remote-hosts/preview-scope.js';
|
|
2
|
+
import { parseFilePreviewPath, filePreviewResponseBase } from './file-preview-path.js';
|
|
3
|
+
import { createFileTarget, resolveFileTargetResource, readFileTargetText } from './file-target.js';
|
|
4
|
+
import path from 'node:path';
|
|
5
|
+
|
|
1
6
|
const DEFAULT_TARGET_TTL_MS = 30 * 60 * 1000;
|
|
2
7
|
const TOKEN_COOKIE_NAME = 'yuri_preview_token';
|
|
3
8
|
const TOKEN_QUERY_PARAM = 'yuri_preview_token';
|
|
@@ -169,8 +174,8 @@ export const classifyPreviewNavigation = ({ url, currentUrl, targetOrigin }) =>
|
|
|
169
174
|
}
|
|
170
175
|
|
|
171
176
|
const path = parsed.pathname || '/';
|
|
172
|
-
const proxyMatch = current?.pathname?.match(/^(\/api\/preview\/proxy\/[a-f0-9]{16,64})(?:\/|$)/i);
|
|
173
|
-
if (parsed.origin === current?.origin && path.startsWith('/api/preview/proxy/')) {
|
|
177
|
+
const proxyMatch = current?.pathname?.match(/^((?:\/api\/hosts\/[^/]+)?\/api\/preview\/proxy\/[a-f0-9]{16,64}(?:\/_file\/[a-f0-9]{32}\/(?:yuri_url_[A-Za-z0-9_-]{32}|-))?)(?:\/|$)/i);
|
|
178
|
+
if (parsed.origin === current?.origin && (path.startsWith('/api/preview/proxy/') || (proxyMatch && path.startsWith(`${proxyMatch[1]}/`)))) {
|
|
174
179
|
return { action: 'allow', url: parsed.toString() };
|
|
175
180
|
}
|
|
176
181
|
|
|
@@ -426,11 +431,11 @@ const PREVIEW_BRIDGE_SCRIPT = String.raw`(() => {
|
|
|
426
431
|
const parsed = new URL(value, window.location.href);
|
|
427
432
|
if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return { action: 'allow', url: parsed.toString() };
|
|
428
433
|
const current = new URL(window.location.href);
|
|
429
|
-
const proxyMatch = current.pathname.match(/^(\/api\/preview\/proxy\/[a-f0-9]{16,64})(?:\/|$)/i);
|
|
434
|
+
const proxyMatch = current.pathname.match(/^((?:\/api\/hosts\/[^/]+)?\/api\/preview\/proxy\/[a-f0-9]{16,64}(?:\/_file\/[a-f0-9]{32}\/(?:yuri_url_[A-Za-z0-9_-]{32}|-))?)(?:\/|$)/i);
|
|
430
435
|
if (parsed.origin === current.origin && parsed.pathname === current.pathname && parsed.search === current.search && parsed.hash) {
|
|
431
436
|
return { action: 'allow', url: parsed.toString() };
|
|
432
437
|
}
|
|
433
|
-
if (parsed.origin === current.origin && parsed.pathname.startsWith('/api/preview/proxy/')) {
|
|
438
|
+
if (parsed.origin === current.origin && (parsed.pathname.startsWith('/api/preview/proxy/') || (proxyMatch && parsed.pathname.startsWith(proxyMatch[1] + '/')))) {
|
|
434
439
|
return { action: 'allow', url: parsed.toString() };
|
|
435
440
|
}
|
|
436
441
|
if (proxyMatch && parsed.origin === current.origin && parsed.pathname.startsWith('/') && parsed.pathname.indexOf(proxyMatch[1]) !== 0 && TARGET_ORIGIN) {
|
|
@@ -477,7 +482,7 @@ const PREVIEW_BRIDGE_SCRIPT = String.raw`(() => {
|
|
|
477
482
|
if (window.__yuriViteHmrProxyPatched || typeof window.WebSocket !== 'function') return;
|
|
478
483
|
window.__yuriViteHmrProxyPatched = true;
|
|
479
484
|
const NativeWebSocket = window.WebSocket;
|
|
480
|
-
const proxyMatch = window.location.pathname.match(/^(\/api\/preview\/proxy\/[a-f0-9]{16,64})(?:\/|$)/i);
|
|
485
|
+
const proxyMatch = window.location.pathname.match(/^((?:\/api\/hosts\/[^/]+)?\/api\/preview\/proxy\/[a-f0-9]{16,64}(?:\/_file\/[a-f0-9]{32}\/(?:yuri_url_[A-Za-z0-9_-]{32}|-))?)(?:\/|$)/i);
|
|
481
486
|
if (!proxyMatch) return;
|
|
482
487
|
const proxyBase = proxyMatch[1] + '/';
|
|
483
488
|
const currentSearchParams = new URL(window.location.href).searchParams;
|
|
@@ -544,7 +549,7 @@ const PREVIEW_BRIDGE_SCRIPT = String.raw`(() => {
|
|
|
544
549
|
const installAppRequestProxyPatch = () => {
|
|
545
550
|
if (window.__yuriAppRequestProxyPatched) return;
|
|
546
551
|
window.__yuriAppRequestProxyPatched = true;
|
|
547
|
-
const proxyMatch = window.location.pathname.match(/^(\/api\/preview\/proxy\/[a-f0-9]{16,64})(?:\/|$)/i);
|
|
552
|
+
const proxyMatch = window.location.pathname.match(/^((?:\/api\/hosts\/[^/]+)?\/api\/preview\/proxy\/[a-f0-9]{16,64}(?:\/_file\/[a-f0-9]{32}\/(?:yuri_url_[A-Za-z0-9_-]{32}|-))?)(?:\/|$)/i);
|
|
548
553
|
if (!proxyMatch) return;
|
|
549
554
|
const proxyBase = proxyMatch[1];
|
|
550
555
|
const currentSearchParams = new URL(window.location.href).searchParams;
|
|
@@ -645,6 +650,7 @@ const PREVIEW_BRIDGE_SCRIPT = String.raw`(() => {
|
|
|
645
650
|
if (typeof input === 'string') {
|
|
646
651
|
return nativeFetch(proxiedUrl(input), init);
|
|
647
652
|
}
|
|
653
|
+
if (input instanceof URL) return nativeFetch(proxiedUrl(input.href), init);
|
|
648
654
|
if (input instanceof Request) {
|
|
649
655
|
try {
|
|
650
656
|
const parsed = new URL(input.url);
|
|
@@ -1058,7 +1064,7 @@ export const rewritePreviewBody = ({ bodyText, proxyBasePath, targetOrigin, kind
|
|
|
1058
1064
|
const rewriteResourceUrl = (value) => {
|
|
1059
1065
|
if (typeof value !== 'string' || value.length === 0) return value;
|
|
1060
1066
|
if (value.startsWith('/') && !value.startsWith('//')) {
|
|
1061
|
-
if (value.startsWith('/api/preview/proxy/')) return appendProxyAuthToProxyUrl(value, { previewToken, urlAuthToken });
|
|
1067
|
+
if (value.startsWith('/api/preview/proxy/') || value.startsWith(`${prefix}/`)) return appendProxyAuthToProxyUrl(value, { previewToken, urlAuthToken });
|
|
1062
1068
|
return appendProxyAuthToProxyUrl(`${prefix}${value}`, { previewToken, urlAuthToken });
|
|
1063
1069
|
}
|
|
1064
1070
|
try {
|
|
@@ -1194,11 +1200,17 @@ export const createPreviewProxyRuntime = ({
|
|
|
1194
1200
|
|
|
1195
1201
|
const now = () => Date.now();
|
|
1196
1202
|
|
|
1203
|
+
const revokeTarget = (id) => {
|
|
1204
|
+
const entry = targets.get(id);
|
|
1205
|
+
targets.delete(id);
|
|
1206
|
+
for (const cancel of entry?.resources || []) cancel();
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1197
1209
|
const sweepExpired = () => {
|
|
1198
1210
|
const t = now();
|
|
1199
1211
|
for (const [id, entry] of targets.entries()) {
|
|
1200
1212
|
if (entry.expiresAt <= t) {
|
|
1201
|
-
|
|
1213
|
+
revokeTarget(id);
|
|
1202
1214
|
}
|
|
1203
1215
|
}
|
|
1204
1216
|
};
|
|
@@ -1212,7 +1224,7 @@ export const createPreviewProxyRuntime = ({
|
|
|
1212
1224
|
sweepTimer.unref?.();
|
|
1213
1225
|
};
|
|
1214
1226
|
|
|
1215
|
-
const createTarget = (origin, ttlMs) => {
|
|
1227
|
+
const createTarget = (origin, ttlMs, fileTarget) => {
|
|
1216
1228
|
const id = crypto.randomBytes(16).toString('hex');
|
|
1217
1229
|
const token = crypto.randomBytes(16).toString('hex');
|
|
1218
1230
|
const createdAt = now();
|
|
@@ -1223,6 +1235,8 @@ export const createPreviewProxyRuntime = ({
|
|
|
1223
1235
|
token,
|
|
1224
1236
|
createdAt,
|
|
1225
1237
|
expiresAt,
|
|
1238
|
+
...fileTarget,
|
|
1239
|
+
resources: new Set(),
|
|
1226
1240
|
});
|
|
1227
1241
|
return { id, token, expiresAt };
|
|
1228
1242
|
};
|
|
@@ -1240,17 +1254,19 @@ export const createPreviewProxyRuntime = ({
|
|
|
1240
1254
|
|
|
1241
1255
|
const entry = targets.get(id);
|
|
1242
1256
|
if (!entry || entry.expiresAt <= now()) {
|
|
1243
|
-
|
|
1257
|
+
revokeTarget(id);
|
|
1244
1258
|
return { ok: false, status: 404, error: 'Preview target expired' };
|
|
1245
1259
|
}
|
|
1246
1260
|
|
|
1261
|
+
const filePath = entry.kind === 'file' ? parseFilePreviewPath(pathname) : null;
|
|
1262
|
+
if (entry.kind === 'file' && !filePath) return { ok: false, status: 403, error: 'Invalid file preview path' };
|
|
1247
1263
|
const cookies = parseCookieHeader(req.headers?.cookie);
|
|
1248
|
-
const token = parsed.searchParams.get(TOKEN_QUERY_PARAM) || cookies.get(TOKEN_COOKIE_NAME) || '';
|
|
1264
|
+
const token = filePath?.previewToken || parsed.searchParams.get(TOKEN_QUERY_PARAM) || cookies.get(TOKEN_COOKIE_NAME) || '';
|
|
1249
1265
|
if (!token || token !== entry.token) {
|
|
1250
1266
|
return { ok: false, status: 403, error: 'Preview token missing' };
|
|
1251
1267
|
}
|
|
1252
1268
|
|
|
1253
|
-
return { ok: true, id, entry, parsed };
|
|
1269
|
+
return { ok: true, id, entry, parsed, filePath };
|
|
1254
1270
|
};
|
|
1255
1271
|
|
|
1256
1272
|
const stripProxyPrefix = (pathname, id) => {
|
|
@@ -1362,6 +1378,16 @@ export const createPreviewProxyRuntime = ({
|
|
|
1362
1378
|
}
|
|
1363
1379
|
}
|
|
1364
1380
|
|
|
1381
|
+
if (req.body?.kind === 'file') {
|
|
1382
|
+
const file = await createFileTarget(req.body.directory, req.body.path);
|
|
1383
|
+
if (req.aborted || res.destroyed) return;
|
|
1384
|
+
const target = createTarget(null, req.body.ttlMs, file);
|
|
1385
|
+
res.once('close', () => { if (!res.writableFinished) revokeTarget(target.id); });
|
|
1386
|
+
return res.set('Cache-Control', 'no-store').json({
|
|
1387
|
+
id: target.id, kind: 'file', proxyBasePath: `${remotePreviewPrefix(req)}/api/preview/proxy/${target.id}`,
|
|
1388
|
+
entryPath: file.entryPath, previewToken: target.token, expiresAt: target.expiresAt,
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1365
1391
|
const rawUrl = typeof req.body?.url === 'string' ? req.body.url.trim() : '';
|
|
1366
1392
|
if (!rawUrl) {
|
|
1367
1393
|
return res.status(400).json({ error: 'url is required' });
|
|
@@ -1389,16 +1415,29 @@ export const createPreviewProxyRuntime = ({
|
|
|
1389
1415
|
|
|
1390
1416
|
return res.json({
|
|
1391
1417
|
id: target.id,
|
|
1392
|
-
proxyBasePath: cookiePath
|
|
1418
|
+
proxyBasePath: `${remotePreviewPrefix(req)}${cookiePath}`,
|
|
1393
1419
|
previewToken: target.token,
|
|
1394
1420
|
expiresAt: target.expiresAt,
|
|
1395
1421
|
});
|
|
1396
1422
|
} catch (error) {
|
|
1423
|
+
if (req.body?.kind === 'file') return res.status(error?.status || (error?.code === 'ENOENT' ? 404 : 500)).json({ error: 'File preview unavailable' });
|
|
1397
1424
|
console.error('[preview-proxy] Failed to create target:', error);
|
|
1398
1425
|
return res.status(500).json({ error: 'Failed to create preview target' });
|
|
1399
1426
|
}
|
|
1400
1427
|
});
|
|
1401
1428
|
|
|
1429
|
+
app.delete('/api/preview/targets/:id', express.json(), async (req, res) => {
|
|
1430
|
+
if (uiAuthController?.enabled) {
|
|
1431
|
+
if (!await uiAuthController.ensureSessionToken(req, res)) return res.status(401).json({ error: 'UI authentication required' });
|
|
1432
|
+
if (!await isRequestOriginAllowed(req)) return res.status(403).json({ error: 'Invalid origin' });
|
|
1433
|
+
}
|
|
1434
|
+
const entry = targets.get(req.params.id);
|
|
1435
|
+
if (!entry) return res.status(204).end();
|
|
1436
|
+
if (!req.body?.previewToken || req.body.previewToken !== entry.token) return res.status(403).json({ error: 'Preview token missing' });
|
|
1437
|
+
revokeTarget(req.params.id);
|
|
1438
|
+
return res.status(204).end();
|
|
1439
|
+
});
|
|
1440
|
+
|
|
1402
1441
|
const proxy = createProxyMiddleware({
|
|
1403
1442
|
target: 'http://127.0.0.1',
|
|
1404
1443
|
changeOrigin: true,
|
|
@@ -1417,7 +1456,10 @@ export const createPreviewProxyRuntime = ({
|
|
|
1417
1456
|
// contains the full path.
|
|
1418
1457
|
pathFilter: (pathname, req) => {
|
|
1419
1458
|
const target = req?.originalUrl || pathname || req?.url || '';
|
|
1420
|
-
|
|
1459
|
+
if (!target.startsWith('/api/preview/proxy/')) return false;
|
|
1460
|
+
if (/^\/api\/preview\/proxy\/[a-f0-9]{16,64}\/_file(?:\/|$)/i.test(target)) return false;
|
|
1461
|
+
const resolved = resolveTargetFromRequest(req);
|
|
1462
|
+
return !resolved.ok || resolved.entry.kind !== 'file';
|
|
1421
1463
|
},
|
|
1422
1464
|
router: (req) => {
|
|
1423
1465
|
const resolved = resolveTargetFromRequest(req);
|
|
@@ -1465,8 +1507,9 @@ export const createPreviewProxyRuntime = ({
|
|
|
1465
1507
|
return responseBuffer;
|
|
1466
1508
|
}
|
|
1467
1509
|
|
|
1468
|
-
const
|
|
1469
|
-
const
|
|
1510
|
+
const hubPrefix = remotePreviewPrefix(req);
|
|
1511
|
+
const proxyBasePath = `${hubPrefix}/api/preview/proxy/${resolved.id}`;
|
|
1512
|
+
const urlAuthToken = hubPrefix ? REMOTE_PREVIEW_TOKEN_MARKER : resolved.parsed.searchParams.get(URL_AUTH_TOKEN_QUERY_PARAM) || '';
|
|
1470
1513
|
if (typeof proxyRes.headers?.location === 'string') {
|
|
1471
1514
|
proxyRes.headers.location = rewritePreviewRedirectLocation({
|
|
1472
1515
|
location: proxyRes.headers.location,
|
|
@@ -1475,6 +1518,7 @@ export const createPreviewProxyRuntime = ({
|
|
|
1475
1518
|
previewToken: resolved.entry.token,
|
|
1476
1519
|
urlAuthToken,
|
|
1477
1520
|
});
|
|
1521
|
+
res.setHeader('location', proxyRes.headers.location);
|
|
1478
1522
|
}
|
|
1479
1523
|
|
|
1480
1524
|
const contentType = String(proxyRes.headers?.['content-type'] || '').toLowerCase();
|
|
@@ -1548,19 +1592,68 @@ export const createPreviewProxyRuntime = ({
|
|
|
1548
1592
|
},
|
|
1549
1593
|
});
|
|
1550
1594
|
|
|
1551
|
-
app.use('/api/preview/proxy', (req, res, next) => {
|
|
1595
|
+
app.use('/api/preview/proxy', async (req, res, next) => {
|
|
1552
1596
|
const resolved = resolveTargetFromRequest(req);
|
|
1553
1597
|
if (!resolved.ok) {
|
|
1554
1598
|
return res.status(resolved.status).json({ error: resolved.error });
|
|
1555
1599
|
}
|
|
1600
|
+
if (resolved.entry.kind === 'file') {
|
|
1601
|
+
// Network previews retain a legacy capability-only access gate. A file
|
|
1602
|
+
// target must still pass ordinary client/session auth, even if a caller
|
|
1603
|
+
// supplies that legacy network query/cookie alongside the file envelope.
|
|
1604
|
+
if (typeof uiAuthController?.requireAuth === 'function') {
|
|
1605
|
+
let authorized = false;
|
|
1606
|
+
await uiAuthController.requireAuth(req, res, () => { authorized = true; });
|
|
1607
|
+
if (!authorized) return;
|
|
1608
|
+
} else if (uiAuthController?.enabled && !await uiAuthController.ensureSessionToken(req, res)) {
|
|
1609
|
+
return res.status(401).json({ error: 'UI authentication required' });
|
|
1610
|
+
}
|
|
1611
|
+
if (req.aborted || res.destroyed) return;
|
|
1612
|
+
if (!['GET', 'HEAD'].includes(req.method)) return res.status(405).set('Allow', 'GET, HEAD').end();
|
|
1613
|
+
const controller = new AbortController();
|
|
1614
|
+
const cancel = () => { controller.abort(); res.destroy(); };
|
|
1615
|
+
const cleanup = () => {
|
|
1616
|
+
controller.abort(); clearTimeout(expiry); resolved.entry.resources.delete(cancel);
|
|
1617
|
+
};
|
|
1618
|
+
const expiry = setTimeout(cancel, Math.min(2147483647, Math.max(0, resolved.entry.expiresAt - now())));
|
|
1619
|
+
expiry.unref?.();
|
|
1620
|
+
resolved.entry.resources.add(cancel);
|
|
1621
|
+
res.once('close', cleanup);
|
|
1622
|
+
res.set({ 'Cache-Control': 'no-store', 'Referrer-Policy': 'no-referrer', 'X-Content-Type-Options': 'nosniff' });
|
|
1623
|
+
try {
|
|
1624
|
+
const file = await resolveFileTargetResource(resolved.entry.root, resolved.filePath.resourcePath);
|
|
1625
|
+
controller.signal.throwIfAborted();
|
|
1626
|
+
res.type(path.extname(file));
|
|
1627
|
+
const contentType = String(res.getHeader('Content-Type'));
|
|
1628
|
+
const kind = contentType.includes('text/html') ? 'html' : contentType.includes('text/css') ? 'css'
|
|
1629
|
+
: /javascript|ecmascript/.test(contentType) ? 'javascript' : null;
|
|
1630
|
+
if (!kind || req.method === 'HEAD') return res.sendFile(file, { dotfiles: 'allow', cacheControl: false, lastModified: false });
|
|
1631
|
+
const bodyText = await readFileTargetText(file, controller.signal);
|
|
1632
|
+
controller.signal.throwIfAborted();
|
|
1633
|
+
const proxyBasePath = filePreviewResponseBase(resolved.filePath, remotePreviewPrefix(req));
|
|
1634
|
+
const rewritten = rewritePreviewBody({ bodyText, proxyBasePath, kind });
|
|
1635
|
+
return res.send(kind === 'html' ? injectPreviewBridge(rewritten, '', '') : rewritten);
|
|
1636
|
+
} catch (error) {
|
|
1637
|
+
if (controller.signal.aborted || res.destroyed) return;
|
|
1638
|
+
return res.status(error?.status || (error?.code === 'ENOENT' ? 404 : error?.code === 'EACCES' ? 403 : 500)).json({ error: 'File preview unavailable' });
|
|
1639
|
+
}
|
|
1640
|
+
}
|
|
1556
1641
|
next();
|
|
1557
1642
|
}, proxy);
|
|
1558
1643
|
|
|
1559
1644
|
server.on('upgrade', (req, socket, head) => {
|
|
1645
|
+
if (/^\/api\/preview\/proxy\/[a-f0-9]{16,64}\/_file(?:\/|$)/i.test(req.url || '')) {
|
|
1646
|
+
rejectWebSocketUpgrade(socket, 405, 'File preview is read-only');
|
|
1647
|
+
return;
|
|
1648
|
+
}
|
|
1560
1649
|
const resolved = resolveTargetFromRequest(req);
|
|
1561
1650
|
if (!resolved.ok) {
|
|
1562
1651
|
return;
|
|
1563
1652
|
}
|
|
1653
|
+
if (resolved.entry.kind === 'file') {
|
|
1654
|
+
rejectWebSocketUpgrade(socket, 405, 'File preview is read-only');
|
|
1655
|
+
return;
|
|
1656
|
+
}
|
|
1564
1657
|
|
|
1565
1658
|
const handleUpgrade = async () => {
|
|
1566
1659
|
try {
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
`registry.js` owns registering existing directories. It reuses `validateDirectoryPath`, deterministic
|
|
4
4
|
path-derived IDs and the settings runtime's serialized persistence. The existing
|
|
5
|
-
`POST /api/opencode/directory` API and assistant business tools share this owner.
|
|
6
|
-
The
|
|
5
|
+
`POST /api/opencode/directory` API, the session-bound project API bridge and assistant business tools share this owner.
|
|
6
|
+
The UI directory API still selects the active directory; session/assistant registration does not
|
|
7
7
|
change an existing active selection. The first registered project becomes active
|
|
8
8
|
through the existing settings invariant.
|
|
9
9
|
|
|
@@ -21,9 +21,18 @@ normalization, migration, atomic write and project-order SSE notification paths.
|
|
|
21
21
|
Unlike full-list UI replacement, this form does not sweep other projects for
|
|
22
22
|
missing directories: callers validate the affected resource. Corrupt reads and
|
|
23
23
|
failed writes are errors, not empty state or successful registration. No new
|
|
24
|
-
database, settings file
|
|
24
|
+
database, settings file or client sync protocol is added. The session skill's
|
|
25
|
+
`POST /api/yuri/session-skills/projects` bridge adds authenticated `describe`,
|
|
26
|
+
`list` and `add` operations without exposing the full settings API; its admission
|
|
27
|
+
and result contract live in `../gui-customization/DOCUMENTATION.md`.
|
|
25
28
|
|
|
26
29
|
`registry.test.js` covers canonical alias deduplication, concurrent append/settings
|
|
27
30
|
writes, persistence, offline-project retention, corrupt
|
|
28
31
|
reads and failed-write preservation. Assistant HTTP integration is covered in
|
|
29
32
|
`../assistants/yuri-project.http.test.js`.
|
|
33
|
+
|
|
34
|
+
The Remote Host Gateway mounts authenticated `POST /api/projects` and `PATCH
|
|
35
|
+
/api/projects/:id` local-authority operations using the same registry/settings
|
|
36
|
+
lock. `GET /api/projects` excludes remote references. Remote-first registration,
|
|
37
|
+
metadata write-through and Hub-only reference removal belong to
|
|
38
|
+
`../remote-hosts/`, not this local filesystem registry.
|
|
@@ -49,6 +49,7 @@ const PREVIEW_PROXY_WS_PATH_PREFIX = '/api/preview/proxy/';
|
|
|
49
49
|
*/
|
|
50
50
|
export const isTunnelWsPathAllowed = (path) => {
|
|
51
51
|
if (typeof path !== 'string' || !path) return false;
|
|
52
|
+
if (/^\/api\/hosts\/[^/]+\/api\/(?:terminal\/ws(?:\?|$)|preview\/proxy\/)/.test(path)) return true;
|
|
52
53
|
// Path only (no query) — tunnel open payload already splits query.
|
|
53
54
|
if (ALLOWED_WS_PATHS.has(path)) return true;
|
|
54
55
|
try {
|