@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
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { it, expect, vi } from 'vitest';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import http from 'node:http';
|
|
6
|
+
import { fork } from 'node:child_process';
|
|
7
|
+
import { once } from 'node:events';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
import { createProjectIdFromPath } from '../projects/project-id.js';
|
|
10
|
+
|
|
11
|
+
it('production bootstrap discovers cross-client references and persists Hub-only layout across restart, partition and failure', async () => {
|
|
12
|
+
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'remote-settings-production-'));
|
|
13
|
+
const otherRoot = await fs.mkdtemp(path.join(os.tmpdir(), 'remote-settings-other-'));
|
|
14
|
+
const children = new Set();
|
|
15
|
+
const streams = new Set();
|
|
16
|
+
const remoteRequests = [];
|
|
17
|
+
const upstream = http.createServer(async (req, res) => {
|
|
18
|
+
const pathname = new URL(req.url, 'http://fixture.invalid').pathname;
|
|
19
|
+
const reply = (body, status = 200) => { res.writeHead(status, { 'content-type': 'application/json' }); res.end(JSON.stringify(body)); };
|
|
20
|
+
if (req.headers.authorization === 'Bearer fixture-remote') remoteRequests.push([req.method, pathname]);
|
|
21
|
+
if (pathname === '/api/info' || pathname === '/health') return reply({ version: '2.2.1', healthy: true });
|
|
22
|
+
if (pathname === '/api/hosts/capabilities') return reply({ remoteProjects: true, protocol: 1, instanceId: 'fixture' });
|
|
23
|
+
if (pathname === '/api/projects' && req.method === 'POST') {
|
|
24
|
+
let raw = ''; for await (const chunk of req) raw += chunk;
|
|
25
|
+
const input = JSON.parse(raw);
|
|
26
|
+
return reply({ project: { id: `remote-${input.path}`, path: input.path }, created: true });
|
|
27
|
+
}
|
|
28
|
+
if (['/api/event', '/api/global/event', '/api/hosts/status-stream'].includes(pathname)) {
|
|
29
|
+
res.writeHead(200, { 'content-type': 'text/event-stream' }); res.write(': ready\n\n');
|
|
30
|
+
const timer = setInterval(() => res.write(': heartbeat\n\n'), 100);
|
|
31
|
+
streams.add(res); res.on('close', () => { clearInterval(timer); streams.delete(res); }); return;
|
|
32
|
+
}
|
|
33
|
+
if (pathname === '/api/git/worktrees') return reply([]);
|
|
34
|
+
if (pathname === '/api/yuri/session-index/sync') { for await (const chunk of req) void chunk; return reply({}, 202); }
|
|
35
|
+
if (pathname === '/api/yuri/session-index') return reply({ directories: [], pinnedSessionIds: [] });
|
|
36
|
+
return reply({}, 404);
|
|
37
|
+
});
|
|
38
|
+
await new Promise(resolve => upstream.listen(0, '127.0.0.1', resolve));
|
|
39
|
+
const upstreamOrigin = `http://127.0.0.1:${upstream.address().port}`;
|
|
40
|
+
const start = async directory => {
|
|
41
|
+
const child = fork(path.join(path.dirname(fileURLToPath(import.meta.url)), 'fixtures/settings-server.mjs'), [], { stdio: ['ignore', 'ignore', 'pipe', 'ipc'] });
|
|
42
|
+
children.add(child);
|
|
43
|
+
let errors = ''; child.stderr.on('data', value => { errors += value; });
|
|
44
|
+
const ready = new Promise((resolve, reject) => {
|
|
45
|
+
child.on('message', message => { if (message.tokens) resolve(message); });
|
|
46
|
+
child.once('exit', code => reject(new Error(`server exited ${code}: ${errors}`)));
|
|
47
|
+
});
|
|
48
|
+
child.send({ root: directory, upstream: upstreamOrigin,
|
|
49
|
+
hosts: ['one', 'two'].map(id => ({ id, name: id, source: 'direct', apiUrl: upstreamOrigin, clientToken: 'fixture-remote' })) });
|
|
50
|
+
const info = await ready;
|
|
51
|
+
const request = async (route, body, client = 0, method = body === undefined ? 'GET' : 'PUT') => {
|
|
52
|
+
const response = await fetch(info.origin + route, { method,
|
|
53
|
+
signal: AbortSignal.timeout(5000),
|
|
54
|
+
headers: { authorization: `Bearer ${info.tokens[client]}`, 'content-type': 'application/json' },
|
|
55
|
+
...(body === undefined ? {} : { body: JSON.stringify(body) }) });
|
|
56
|
+
return { status: response.status, body: response.status === 204 ? null : await response.json() };
|
|
57
|
+
};
|
|
58
|
+
const stop = async () => { const exit = once(child, 'exit'); child.send('stop'); await exit; children.delete(child); };
|
|
59
|
+
return { ...info, request, stop };
|
|
60
|
+
};
|
|
61
|
+
try {
|
|
62
|
+
let a = await start(root);
|
|
63
|
+
expect((await a.request('/api/config/settings/bootstrap')).body.hasRemoteProjects).toBe(false);
|
|
64
|
+
expect((await a.request('/api/config/settings?bootstrap=true')).body.hasRemoteProjects).toBe(false);
|
|
65
|
+
const controller = new AbortController();
|
|
66
|
+
let frames = '';
|
|
67
|
+
const stream = await fetch(a.origin + '/api/global/event', { headers: { authorization: `Bearer ${a.tokens[1]}` },
|
|
68
|
+
signal: AbortSignal.any([controller.signal, AbortSignal.timeout(10000)]) });
|
|
69
|
+
const consuming = (async () => { for await (const data of stream.body) frames += Buffer.from(data).toString(); })().catch(() => {});
|
|
70
|
+
await new Promise(resolve => setTimeout(resolve, 150));
|
|
71
|
+
expect(remoteRequests).toEqual([]);
|
|
72
|
+
const first = await a.request('/api/hosts/one/projects', { path: '/remote/does-not-exist-on-hub' }, 0, 'POST');
|
|
73
|
+
expect(first.status).toBe(200);
|
|
74
|
+
await vi.waitFor(() => expect(frames).toContain('yuri:project-order-changed'));
|
|
75
|
+
expect((await a.request('/api/config/settings/bootstrap', undefined, 1)).body.hasRemoteProjects).toBe(true);
|
|
76
|
+
const second = await a.request('/api/hosts/two/projects', { path: '/other/remote' }, 0, 'POST');
|
|
77
|
+
expect(second.status).toBe(200);
|
|
78
|
+
const local = { id: createProjectIdFromPath(root), path: root };
|
|
79
|
+
expect((await a.request('/api/config/settings', { projects: [local] })).status).toBe(200);
|
|
80
|
+
const original = (await a.request('/api/config/settings')).body;
|
|
81
|
+
const hubId = original.hubProjectLayout.hubId;
|
|
82
|
+
const layout = { hubId, order: [first.body.project.id, local.id, second.body.project.id], collapsed: { [first.body.project.id]: true, [local.id]: false } };
|
|
83
|
+
const beforeLayout = remoteRequests.length;
|
|
84
|
+
const tipCount = () => (frames.match(/yuri:project-order-changed/g) || []).length;
|
|
85
|
+
await vi.waitFor(() => expect(tipCount()).toBeGreaterThanOrEqual(3));
|
|
86
|
+
const beforeLayoutTips = tipCount();
|
|
87
|
+
expect((await a.request('/api/config/settings', { hubProjectLayout: layout })).body.hubProjectLayout).toEqual(layout);
|
|
88
|
+
await vi.waitFor(() => expect(tipCount()).toBeGreaterThan(beforeLayoutTips));
|
|
89
|
+
expect((await a.request('/api/config/settings', undefined, 1)).body.hubProjectLayout).toEqual(layout);
|
|
90
|
+
expect(remoteRequests.slice(beforeLayout).some(([, p]) => p === '/api/config/settings')).toBe(false);
|
|
91
|
+
const partial = await a.request('/api/config/settings', { hubProjectLayout: { hubId, order: [local.id], collapsed: { [local.id]: true } } }, 1);
|
|
92
|
+
const merged = { hubId, order: [local.id, first.body.project.id, second.body.project.id], collapsed: { [first.body.project.id]: true, [local.id]: true } };
|
|
93
|
+
expect(partial.body.hubProjectLayout).toEqual(merged);
|
|
94
|
+
expect(partial.body.projects).toEqual(original.projects);
|
|
95
|
+
expect((await a.request('/api/hosts/projects')).body.projects).toHaveLength(2);
|
|
96
|
+
await new Promise(resolve => setTimeout(resolve, 25));
|
|
97
|
+
const beforeInvalidTips = tipCount();
|
|
98
|
+
expect((await a.request('/api/config/settings', { hubProjectLayout: { ...layout, hubId: 'other-hub' } })).status).toBe(409);
|
|
99
|
+
expect((await a.request('/api/config/settings', { hubProjectLayout: { hubId, order: ['/bad'], collapsed: [] } })).status).toBe(400);
|
|
100
|
+
expect((await a.request('/api/config/settings', { hasRemoteProjects: false })).body.hasRemoteProjects).toBe(true);
|
|
101
|
+
const settingsPath = path.join(root, 'hub', 'settings.json');
|
|
102
|
+
const saved = await fs.readFile(settingsPath, 'utf8');
|
|
103
|
+
await fs.rename(settingsPath, settingsPath + '.backup'); await fs.mkdir(settingsPath);
|
|
104
|
+
expect((await a.request('/api/config/settings', { hubProjectLayout: layout })).status).toBe(500);
|
|
105
|
+
await fs.rmdir(settingsPath); await fs.rename(settingsPath + '.backup', settingsPath);
|
|
106
|
+
expect(await fs.readFile(settingsPath, 'utf8')).toBe(saved);
|
|
107
|
+
expect((await a.request('/api/config/settings')).body.hubProjectLayout).toEqual(merged);
|
|
108
|
+
await new Promise(resolve => setTimeout(resolve, 25));
|
|
109
|
+
expect(tipCount()).toBe(beforeInvalidTips);
|
|
110
|
+
controller.abort(); await consuming; await a.stop();
|
|
111
|
+
a = await start(root);
|
|
112
|
+
expect((await a.request('/api/config/settings/bootstrap')).body.hasRemoteProjects).toBe(true);
|
|
113
|
+
expect((await a.request('/api/config/settings')).body.hubProjectLayout).toEqual(merged);
|
|
114
|
+
const lastController = new AbortController();
|
|
115
|
+
let lastFrames = '';
|
|
116
|
+
const lastStream = await fetch(a.origin + '/api/global/event', {
|
|
117
|
+
headers: { authorization: `Bearer ${a.tokens[1]}` }, signal: AbortSignal.any([lastController.signal, AbortSignal.timeout(10000)]) });
|
|
118
|
+
const lastConsuming = (async () => { for await (const data of lastStream.body) lastFrames += Buffer.from(data).toString(); })().catch(() => {});
|
|
119
|
+
const b = await start(otherRoot);
|
|
120
|
+
const other = (await b.request('/api/config/settings')).body;
|
|
121
|
+
expect(other.hubProjectLayout.hubId).not.toBe(hubId);
|
|
122
|
+
expect(other.hubProjectLayout.order).toEqual([]);
|
|
123
|
+
expect(other.hasRemoteProjects).toBe(false);
|
|
124
|
+
expect((await b.request('/api/config/settings', { hubProjectLayout: merged })).status).toBe(409);
|
|
125
|
+
await b.stop();
|
|
126
|
+
expect((await a.request(`/api/hosts/one/projects/${first.body.project.id}`, undefined, 0, 'DELETE')).status).toBe(204);
|
|
127
|
+
await vi.waitFor(() => expect(lastFrames).toContain('yuri:project-order-changed'));
|
|
128
|
+
const firstDeleteTips = (lastFrames.match(/yuri:project-order-changed/g) || []).length;
|
|
129
|
+
expect((await a.request('/api/config/settings/bootstrap', undefined, 1)).body.hasRemoteProjects).toBe(true);
|
|
130
|
+
expect((await a.request(`/api/hosts/two/projects/${second.body.project.id}`, undefined, 0, 'DELETE')).status).toBe(204);
|
|
131
|
+
await vi.waitFor(() => expect((lastFrames.match(/yuri:project-order-changed/g) || []).length).toBeGreaterThan(firstDeleteTips));
|
|
132
|
+
expect((await a.request('/api/config/settings/bootstrap', undefined, 1)).body.hasRemoteProjects).toBe(false);
|
|
133
|
+
expect((await a.request('/api/config/settings')).body.projects).toEqual(original.projects);
|
|
134
|
+
lastController.abort(); await lastConsuming;
|
|
135
|
+
const afterLast = remoteRequests.length;
|
|
136
|
+
await new Promise(resolve => setTimeout(resolve, 150));
|
|
137
|
+
expect(remoteRequests.length).toBe(afterLast);
|
|
138
|
+
await a.stop();
|
|
139
|
+
} finally {
|
|
140
|
+
for (const child of children) { child.kill('SIGTERM'); await once(child, 'exit'); }
|
|
141
|
+
for (const stream of streams) stream.destroy();
|
|
142
|
+
upstream.closeAllConnections(); await new Promise(resolve => upstream.close(resolve));
|
|
143
|
+
await fs.rm(root, { recursive: true, force: true }); await fs.rm(otherRoot, { recursive: true, force: true });
|
|
144
|
+
}
|
|
145
|
+
}, 90000);
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import crypto from 'node:crypto';
|
|
2
|
+
import { createRequire } from 'node:module';
|
|
3
|
+
|
|
4
|
+
const require = createRequire(import.meta.url);
|
|
5
|
+
const metadataKeys = ['label', 'icon', 'iconImage', 'iconBackground', 'color'];
|
|
6
|
+
export const projectMetadata = (value) => Object.fromEntries(metadataKeys
|
|
7
|
+
.filter((key) => Object.hasOwn(value || {}, key)).map((key) => [key, value[key]]));
|
|
8
|
+
|
|
9
|
+
// This database has deliberately no message/part/body columns. Only the remote
|
|
10
|
+
// authority's presentation metadata and connection receipts can cross this seam.
|
|
11
|
+
export function createRemoteHostStore(dbPath) {
|
|
12
|
+
const Database = require('better-sqlite3');
|
|
13
|
+
const db = new Database(dbPath);
|
|
14
|
+
db.pragma('journal_mode = WAL');
|
|
15
|
+
db.exec(`CREATE TABLE IF NOT EXISTS remote_project (
|
|
16
|
+
id TEXT PRIMARY KEY, host_id TEXT NOT NULL, path TEXT NOT NULL,
|
|
17
|
+
remote_project_id TEXT NOT NULL, metadata TEXT NOT NULL, state TEXT NOT NULL,
|
|
18
|
+
added_at INTEGER NOT NULL, UNIQUE(host_id, path));
|
|
19
|
+
CREATE TABLE IF NOT EXISTS remote_host_receipt (
|
|
20
|
+
host_id TEXT PRIMARY KEY, connected_at INTEGER, synced_at INTEGER,
|
|
21
|
+
error_code TEXT, error_message TEXT);
|
|
22
|
+
CREATE TABLE IF NOT EXISTS remote_hub_identity (id TEXT PRIMARY KEY);`);
|
|
23
|
+
db.exec(`CREATE TABLE IF NOT EXISTS remote_organization (
|
|
24
|
+
host_id TEXT NOT NULL, kind TEXT NOT NULL, snapshot TEXT NOT NULL, PRIMARY KEY(host_id, kind));`);
|
|
25
|
+
db.exec('CREATE TABLE IF NOT EXISTS remote_host_display (id TEXT PRIMARY KEY, name TEXT NOT NULL, source TEXT NOT NULL)');
|
|
26
|
+
db.prepare('INSERT INTO remote_hub_identity(id) SELECT ? WHERE NOT EXISTS (SELECT 1 FROM remote_hub_identity)')
|
|
27
|
+
.run(crypto.randomUUID());
|
|
28
|
+
const hubId = db.prepare('SELECT id FROM remote_hub_identity').get().id;
|
|
29
|
+
const decode = (row) => row && ({ id: row.id, hostId: row.host_id, path: row.path,
|
|
30
|
+
remoteProjectId: row.remote_project_id, remoteState: row.state,
|
|
31
|
+
...JSON.parse(row.metadata), addedAt: row.added_at, lastOpenedAt: row.added_at });
|
|
32
|
+
const projects = (hostId) => (hostId
|
|
33
|
+
? db.prepare('SELECT * FROM remote_project WHERE host_id = ? ORDER BY added_at, id').all(hostId)
|
|
34
|
+
: db.prepare('SELECT * FROM remote_project ORDER BY added_at, id').all()).map(decode);
|
|
35
|
+
return {
|
|
36
|
+
hubId, projects,
|
|
37
|
+
hasProjects() { return Boolean(db.prepare('SELECT 1 FROM remote_project LIMIT 1').get()); },
|
|
38
|
+
saveHost(host) {
|
|
39
|
+
db.prepare(`INSERT INTO remote_host_display VALUES (?, ?, ?) ON CONFLICT(id) DO UPDATE SET name=excluded.name,
|
|
40
|
+
source=excluded.source WHERE name != excluded.name OR source != excluded.source`)
|
|
41
|
+
.run(host.id, host.name || host.label || host.id, host.source);
|
|
42
|
+
},
|
|
43
|
+
savedHosts() { return db.prepare('SELECT id, name, source FROM remote_host_display').all(); },
|
|
44
|
+
organization(hostId) {
|
|
45
|
+
return Object.fromEntries(db.prepare('SELECT kind, snapshot FROM remote_organization WHERE host_id = ?').all(hostId)
|
|
46
|
+
.map((row) => [row.kind, JSON.parse(row.snapshot)]));
|
|
47
|
+
},
|
|
48
|
+
saveOrganization(hostId, kind, input) {
|
|
49
|
+
const text = (value) => typeof value === 'string' ? value.slice(0, 4096) : '';
|
|
50
|
+
let snapshot;
|
|
51
|
+
if (kind === 'unread') snapshot = { revision: Number(input.revision) || 0,
|
|
52
|
+
sessions: Object.fromEntries(Object.entries(input.sessions || {}).map(([id, row]) => [text(id), {
|
|
53
|
+
directory: text(row.directory), unreadCount: Number(row.unreadCount) || 0, hasError: row.hasError === true,
|
|
54
|
+
manual: row.manual === true, revision: Number(row.revision) || 0,
|
|
55
|
+
}])) };
|
|
56
|
+
if (kind === 'folders') snapshot = { version: 1, updatedAt: Number(input.updatedAt) || 0,
|
|
57
|
+
foldersMap: Object.fromEntries(Object.entries(input.foldersMap || {}).filter(([, rows]) => Array.isArray(rows))
|
|
58
|
+
.map(([scope, rows]) => [text(scope), rows.map((row) => ({ id: text(row.id), name: text(row.name),
|
|
59
|
+
sessionIds: (row.sessionIds || []).filter((id) => typeof id === 'string').map(text),
|
|
60
|
+
createdAt: Number(row.createdAt) || 0, parentId: row.parentId ? text(row.parentId) : null }))])),
|
|
61
|
+
collapsedFolderIds: (input.collapsedFolderIds || []).filter((id) => typeof id === 'string').map(text) };
|
|
62
|
+
if (kind === 'order') snapshot = { revision: Number(input.revision) || 0,
|
|
63
|
+
sessionOrderByScope: Object.fromEntries(Object.entries(input.sessionOrderByScope || {}).filter(([, rows]) => Array.isArray(rows))
|
|
64
|
+
.map(([scope, rows]) => [text(scope), rows.filter((id) => typeof id === 'string').map(text)])),
|
|
65
|
+
sessionOrderActivityByScope: Object.fromEntries(Object.entries(input.sessionOrderActivityByScope || {})
|
|
66
|
+
.map(([scope, values]) => [text(scope), Object.fromEntries(Object.entries(values || {})
|
|
67
|
+
.filter(([, value]) => typeof value === 'number' && Number.isFinite(value)))])) };
|
|
68
|
+
if (kind === 'worktrees') snapshot = {
|
|
69
|
+
projectDirectories: Object.fromEntries(Object.entries(input.projectDirectories || {}).filter(([, rows]) => Array.isArray(rows))
|
|
70
|
+
.map(([root, rows]) => [text(root), [...new Set(rows.filter((value) => typeof value === 'string' && value).map(text))]])),
|
|
71
|
+
staleProjectDirectories: (input.staleProjectDirectories || []).filter((value) => typeof value === 'string').map(text),
|
|
72
|
+
};
|
|
73
|
+
if (!snapshot) throw new Error('Invalid organization kind');
|
|
74
|
+
db.prepare('INSERT OR REPLACE INTO remote_organization VALUES (?, ?, ?)').run(hostId, kind, JSON.stringify(snapshot));
|
|
75
|
+
},
|
|
76
|
+
saveProject(hostId, remote) {
|
|
77
|
+
const prior = projects(hostId).find((p) => p.path === remote.path);
|
|
78
|
+
const id = prior?.id || `remote-${crypto.createHash('sha256').update(JSON.stringify([hubId, hostId, remote.path])).digest('hex').slice(0, 24)}`;
|
|
79
|
+
db.prepare(`INSERT INTO remote_project VALUES (?, ?, ?, ?, ?, 'ok', ?)
|
|
80
|
+
ON CONFLICT(host_id, path) DO UPDATE SET remote_project_id=excluded.remote_project_id,
|
|
81
|
+
metadata=excluded.metadata, state='ok'`).run(id, hostId, remote.path, remote.id,
|
|
82
|
+
JSON.stringify(projectMetadata(remote)), prior?.addedAt || Date.now());
|
|
83
|
+
return projects(hostId).find((p) => p.id === id);
|
|
84
|
+
},
|
|
85
|
+
refreshProject(reference, remote) {
|
|
86
|
+
if (remote?.path !== reference.path || !remote?.id || remote.hostId) return null;
|
|
87
|
+
const updated = db.prepare(`UPDATE remote_project SET remote_project_id = ?, metadata = ?, state = 'ok'
|
|
88
|
+
WHERE id = ? AND host_id = ? AND path = ? AND added_at = ? AND remote_project_id = ?`).run(remote.id,
|
|
89
|
+
JSON.stringify(projectMetadata(remote)), reference.id, reference.hostId, reference.path, reference.addedAt, reference.remoteProjectId);
|
|
90
|
+
return updated.changes ? projects(reference.hostId).find((p) => p.id === reference.id) : null;
|
|
91
|
+
},
|
|
92
|
+
markProject(id, state) { db.prepare('UPDATE remote_project SET state = ? WHERE id = ?').run(state, id); },
|
|
93
|
+
removeProject(hostId, id) { return db.prepare('DELETE FROM remote_project WHERE host_id = ? AND id = ?').run(hostId, id).changes > 0; },
|
|
94
|
+
receipt(hostId) {
|
|
95
|
+
const row = db.prepare('SELECT * FROM remote_host_receipt WHERE host_id = ?').get(hostId);
|
|
96
|
+
return row ? { lastConnectedAt: row.connected_at || undefined, lastSyncedAt: row.synced_at || undefined,
|
|
97
|
+
...(row.error_code ? { lastError: { code: row.error_code, message: row.error_message } } : {}) } : {};
|
|
98
|
+
},
|
|
99
|
+
saveReceipt(hostId, input) {
|
|
100
|
+
const previous = this.receipt(hostId);
|
|
101
|
+
const value = { ...previous, ...input };
|
|
102
|
+
db.prepare(`INSERT INTO remote_host_receipt VALUES (?, ?, ?, ?, ?)
|
|
103
|
+
ON CONFLICT(host_id) DO UPDATE SET connected_at=excluded.connected_at,
|
|
104
|
+
synced_at=excluded.synced_at, error_code=excluded.error_code, error_message=excluded.error_message`)
|
|
105
|
+
.run(hostId, value.lastConnectedAt || null, value.lastSyncedAt || null,
|
|
106
|
+
value.lastError?.code || null, value.lastError?.message || null);
|
|
107
|
+
},
|
|
108
|
+
close() { db.close(); },
|
|
109
|
+
};
|
|
110
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { it, expect, vi } from 'vitest';
|
|
2
|
+
import fs from 'node:fs/promises';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import { createRemoteHostStore } from './store.js';
|
|
6
|
+
|
|
7
|
+
it('projects the SQLite hint and never revives a removed or replaced reference during metadata refresh', async () => {
|
|
8
|
+
const root = await fs.mkdtemp(path.join(os.tmpdir(), 'remote-store-refresh-'));
|
|
9
|
+
const dbPath = path.join(root, 'remote.sqlite');
|
|
10
|
+
let store = createRemoteHostStore(dbPath);
|
|
11
|
+
const now = vi.spyOn(Date, 'now').mockReturnValue(100);
|
|
12
|
+
try {
|
|
13
|
+
expect(store.hasProjects()).toBe(false);
|
|
14
|
+
const remote = { id: 'project', path: '/remote-only', label: 'original' };
|
|
15
|
+
const reference = store.saveProject('host', remote);
|
|
16
|
+
const hubId = store.hubId;
|
|
17
|
+
expect(store.hasProjects()).toBe(true);
|
|
18
|
+
expect(store.refreshProject(reference, { ...remote, label: 'updated' }).label).toBe('updated');
|
|
19
|
+
expect(store.refreshProject({ ...reference, remoteProjectId: 'stale-remote-id' }, remote)).toBeNull();
|
|
20
|
+
store.removeProject('host', reference.id);
|
|
21
|
+
expect(store.refreshProject(reference, { ...remote, label: 'late' })).toBeNull();
|
|
22
|
+
expect(store.hasProjects()).toBe(false);
|
|
23
|
+
now.mockReturnValue(200);
|
|
24
|
+
const replacement = store.saveProject('host', { ...remote, label: 'new association' });
|
|
25
|
+
expect(replacement.id).toBe(reference.id);
|
|
26
|
+
expect(store.refreshProject(reference, { ...remote, label: 'stale' })).toBeNull();
|
|
27
|
+
expect(store.projects()[0].label).toBe('new association');
|
|
28
|
+
expect(store.refreshProject(replacement, { ...remote, path: '/wrong-path' })).toBeNull();
|
|
29
|
+
store.close(); store = createRemoteHostStore(dbPath);
|
|
30
|
+
expect(store.hubId).toBe(hubId); expect(store.hasProjects()).toBe(true);
|
|
31
|
+
store.removeProject('host', replacement.id); expect(store.hasProjects()).toBe(false);
|
|
32
|
+
} finally { now.mockRestore(); store.close(); await fs.rm(root, { recursive: true, force: true }); }
|
|
33
|
+
});
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { WebSocket } from 'ws';
|
|
2
|
+
import { remoteDeadlineSignal } from './deadline.js';
|
|
3
|
+
|
|
4
|
+
const failure = (code, status = 503) => Object.assign(new Error(code), { code, status });
|
|
5
|
+
const directUrl = (value) => {
|
|
6
|
+
try {
|
|
7
|
+
const url = new URL(value);
|
|
8
|
+
return ['http:', 'https:'].includes(url.protocol) && !url.username && !url.password ? url : null;
|
|
9
|
+
} catch { return null; }
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export async function createRemoteTransport(host, { fetchImpl = fetch, signal } = {}) {
|
|
13
|
+
const boundedSignal = (ms) => remoteDeadlineSignal(ms, signal ? [signal] : []);
|
|
14
|
+
const token = host.clientToken;
|
|
15
|
+
if (!token) throw failure('remote_authorization_required', 401);
|
|
16
|
+
const headers = { ...host.requestHeaders, Authorization: `Bearer ${token}` };
|
|
17
|
+
let base = directUrl(host.apiUrl || host.url);
|
|
18
|
+
let capabilities;
|
|
19
|
+
const readAdmission = async (response) => {
|
|
20
|
+
if (response.status === 401 || response.status === 403) throw failure('remote_authorization_required', response.status);
|
|
21
|
+
const capability = response.ok ? await response.json().catch(() => null) : null;
|
|
22
|
+
if (!capability?.remoteProjects || capability.protocol !== 1 || !capability.instanceId) throw failure('remote_incompatible', 409);
|
|
23
|
+
return capability;
|
|
24
|
+
};
|
|
25
|
+
// A learned direct address must prove identity before it receives a secret.
|
|
26
|
+
if (base && host.relay) {
|
|
27
|
+
try {
|
|
28
|
+
const health = await fetchImpl(new URL('/health', base), { redirect: 'error', signal: boundedSignal(2000) });
|
|
29
|
+
if (!health.ok || (await health.json()).serverId !== host.relay.serverId) base = null;
|
|
30
|
+
} catch { base = null; }
|
|
31
|
+
}
|
|
32
|
+
if (base) {
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetchImpl(new URL('/api/hosts/capabilities', base), {
|
|
35
|
+
headers, redirect: 'error', signal: boundedSignal(3000),
|
|
36
|
+
});
|
|
37
|
+
capabilities = await readAdmission(response);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
if (error.code === 'remote_incompatible') throw error;
|
|
40
|
+
if (!host.relay) throw error;
|
|
41
|
+
base = null;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (base) {
|
|
45
|
+
const sockets = new Set();
|
|
46
|
+
let closed = false;
|
|
47
|
+
const close = () => {
|
|
48
|
+
if (closed) return;
|
|
49
|
+
closed = true; signal?.removeEventListener('abort', close);
|
|
50
|
+
for (const socket of sockets) socket.terminate();
|
|
51
|
+
sockets.clear();
|
|
52
|
+
};
|
|
53
|
+
signal?.addEventListener('abort', close, { once: true });
|
|
54
|
+
if (signal?.aborted) close();
|
|
55
|
+
return {
|
|
56
|
+
capabilities,
|
|
57
|
+
fetch: (route, init = {}) => {
|
|
58
|
+
if (closed) throw failure('stale_host', 409);
|
|
59
|
+
return fetchImpl(new URL(route, base), { ...init,
|
|
60
|
+
signal: AbortSignal.any([...(signal ? [signal] : []), ...(init.signal ? [init.signal] : [])]),
|
|
61
|
+
redirect: 'manual', headers: { ...init.headers, ...headers } });
|
|
62
|
+
},
|
|
63
|
+
openWebSocket(route, protocols = [], { onMessage } = {}) {
|
|
64
|
+
if (closed) throw failure('stale_host', 409);
|
|
65
|
+
const url = new URL(route, base);
|
|
66
|
+
url.protocol = url.protocol === 'https:' ? 'wss:' : 'ws:';
|
|
67
|
+
const socket = new WebSocket(url, protocols, { headers });
|
|
68
|
+
socket.onmessage = onMessage || null;
|
|
69
|
+
sockets.add(socket);
|
|
70
|
+
socket.once('close', () => sockets.delete(socket));
|
|
71
|
+
socket.on('error', () => {});
|
|
72
|
+
socket.binaryType = 'arraybuffer';
|
|
73
|
+
return socket;
|
|
74
|
+
},
|
|
75
|
+
close,
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
if (!host.relay || (host.source === 'ssh' && host.pairingSource !== 'connect-link')) {
|
|
79
|
+
throw failure('remote_transport_unavailable');
|
|
80
|
+
}
|
|
81
|
+
const { createRelayTunnelClient } = await import('./relay-client.bundle.js');
|
|
82
|
+
const tunnel = createRelayTunnelClient({ ...host.relay, batchWindowMs: 0,
|
|
83
|
+
createWireSocket(url) {
|
|
84
|
+
const socket = new WebSocket(url);
|
|
85
|
+
socket.binaryType = 'arraybuffer';
|
|
86
|
+
return socket;
|
|
87
|
+
} });
|
|
88
|
+
const close = () => { signal?.removeEventListener('abort', close); tunnel.close(); };
|
|
89
|
+
signal?.addEventListener('abort', close, { once: true });
|
|
90
|
+
if (signal?.aborted) close();
|
|
91
|
+
const relayFetch = (route, init = {}) => tunnel.fetch(`http://remote.invalid${route}`, {
|
|
92
|
+
...init, signal: AbortSignal.any([...(signal ? [signal] : []), ...(init.signal ? [init.signal] : [])]),
|
|
93
|
+
headers: { ...init.headers, ...headers },
|
|
94
|
+
});
|
|
95
|
+
try {
|
|
96
|
+
capabilities = await readAdmission(await relayFetch('/api/hosts/capabilities', { signal: boundedSignal(10000) }));
|
|
97
|
+
} catch (error) {
|
|
98
|
+
close();
|
|
99
|
+
if (['remote_authorization_required', 'remote_incompatible'].includes(error?.code)) throw error;
|
|
100
|
+
throw failure('remote_relay_unavailable');
|
|
101
|
+
}
|
|
102
|
+
return { capabilities, fetch: relayFetch, async openWebSocket(route, protocols = [], { onMessage } = {}) {
|
|
103
|
+
const response = await relayFetch('/auth/url-token', { method: 'POST', signal: boundedSignal(5000) });
|
|
104
|
+
const authorization = response.ok ? await response.json() : null;
|
|
105
|
+
if (!authorization?.token) throw failure('remote_authorization_required', 401);
|
|
106
|
+
const target = new URL(route, 'http://remote.invalid');
|
|
107
|
+
target.searchParams.set('yuri_url_token', authorization.token);
|
|
108
|
+
const socket = tunnel.openWebSocket(`${target.pathname}${target.search}`, protocols, headers);
|
|
109
|
+
socket.onmessage = onMessage || null;
|
|
110
|
+
return socket;
|
|
111
|
+
},
|
|
112
|
+
close };
|
|
113
|
+
}
|
|
@@ -87,7 +87,8 @@ export const registerScheduledTaskSessionSkill = (app, {
|
|
|
87
87
|
key: SCHEDULED_TASK_SKILL_KEY,
|
|
88
88
|
value: `Yuri built-in skill: scheduled tasks. When the user asks to create, find, edit, pause, resume or delete scheduled tasks (including other projects and global tasks), load the skill by running:\n${scheduledTaskSkillCommand(executable, script, encoded, 'describe')}\nThe result supplies the workflow and authenticated task-management commands. Prefer this session's tasks when the target is unspecified. Do not ask for credentials or project IDs.`,
|
|
89
89
|
});
|
|
90
|
-
|
|
90
|
+
const projectBinding = { hostOrigin, upstreamOrigin, registrationFile };
|
|
91
|
+
await installCustomization(client, created.id, { projectBinding, ...(remoteConnectionsAdapter ? { remoteBinding: projectBinding } : {}) });
|
|
91
92
|
return res.json({ data: created });
|
|
92
93
|
} catch {
|
|
93
94
|
let retainedSessionID = created?.id;
|
|
@@ -13,9 +13,10 @@ import { registerScheduledTaskRoutes } from './routes.js';
|
|
|
13
13
|
import { registerScheduledTaskSessionSkill } from './session-skill.js';
|
|
14
14
|
import { authorizeScheduledTaskSkillRequest, SCHEDULED_TASK_SKILL_PATH } from './session-skill-contract.js';
|
|
15
15
|
import { registerRemoteConnectionsSkill, REMOTE_CONNECTIONS_SKILL_PATH } from '../gui-customization/remote-connections.js';
|
|
16
|
+
import { registerProjectsSkill, PROJECTS_SKILL_PATH } from '../gui-customization/projects.js';
|
|
16
17
|
|
|
17
18
|
describe('built-in session skill with authenticated Host', () => {
|
|
18
|
-
let root, server, origin, ui, sessions, entries, store, password, auth, registrationFile, sdk, sync, failInstructions, failCleanup, connections;
|
|
19
|
+
let root, server, origin, ui, sessions, entries, store, password, auth, registrationFile, sdk, sync, failInstructions, failCleanup, connections, registerProject;
|
|
19
20
|
const upstreamOrigin = 'http://127.0.0.1:4096';
|
|
20
21
|
beforeEach(async () => {
|
|
21
22
|
root = await fs.mkdtemp(path.join(os.tmpdir(), 'session-skill-'));
|
|
@@ -66,6 +67,9 @@ describe('built-in session skill with authenticated Host', () => {
|
|
|
66
67
|
buildOpenCodeUrl: () => upstreamOrigin, getOpenCodeAuthHeaders: () => auth,
|
|
67
68
|
};
|
|
68
69
|
const router = express.Router();
|
|
70
|
+
registerProject = vi.fn(async (input) => ({ project: { id: 'registered', ...input }, created: true, settings: { password } }));
|
|
71
|
+
registerProjectsSkill(app, { express, getIsSharedOpenCodeService: () => true, getOpenCodeAuthHeaders: () => auth, createClient: () => sdk,
|
|
72
|
+
registerProject, readSettingsFromDiskStrict: common.readSettingsFromDiskMigrated, sanitizeProjects: common.sanitizeProjects });
|
|
69
73
|
connections = { list: vi.fn(async () => ({ instances: [] })), setup: vi.fn(async () => ({ id: 'ssh_one', running: true })),
|
|
70
74
|
pair: vi.fn(async () => ({ url: 'yuri://connect?v=2&p=fixture', expiresAt: '2099-01-01' })) };
|
|
71
75
|
registerRemoteConnectionsSkill(app, { express, adapter: connections, getIsSharedOpenCodeService: () => true, getOpenCodeAuthHeaders: () => auth, createClient: () => sdk });
|
|
@@ -191,6 +195,35 @@ describe('built-in session skill with authenticated Host', () => {
|
|
|
191
195
|
expect(connections.setup).toHaveBeenCalledTimes(1);
|
|
192
196
|
});
|
|
193
197
|
|
|
198
|
+
it('executes the exact staged project API helper and refuses browser credentials or changed Host/service bindings', async () => {
|
|
199
|
+
const session = await create();
|
|
200
|
+
const pointer = entries.get(`${session.id}:customization`);
|
|
201
|
+
const command = pointer.split('Bound project helper: ')[1].split('\n')[0];
|
|
202
|
+
const described = await run(command);
|
|
203
|
+
expect(described.code).toBe(0);
|
|
204
|
+
expect(described.value.supported).toBe(true);
|
|
205
|
+
expect(Object.keys(described.value.commands)).toEqual(['list', 'add']);
|
|
206
|
+
const { commands: cmd } = described.value;
|
|
207
|
+
expect((await run(cmd.list)).value.projects).toHaveLength(2);
|
|
208
|
+
const input = { path: path.join(root, 'project-b'), label: 'Existing project' };
|
|
209
|
+
const added = await run(cmd.add, input);
|
|
210
|
+
expect(added.value).toEqual({ project: { id: 'registered', ...input }, created: true });
|
|
211
|
+
expect(registerProject).toHaveBeenCalledExactlyOnceWith(input);
|
|
212
|
+
expect(added.stdout + pointer).not.toContain(password);
|
|
213
|
+
for (const headers of [{}, { Authorization: 'Bearer test-browser-client' }, { ...auth, Origin: origin }, { Authorization: 'Basic wrong' }]) {
|
|
214
|
+
const response = await fetch(`${origin}${PROJECTS_SKILL_PATH}`, { method: 'POST', headers: { 'content-type': 'application/json', ...headers }, body: JSON.stringify({ sessionID: session.id, operation: 'add', input }) });
|
|
215
|
+
expect(response.status).toBe(403);
|
|
216
|
+
}
|
|
217
|
+
sessions.get(session.id).metadata.yuri.scheduledTaskSkill.hostOrigin = 'http://127.0.0.1:1';
|
|
218
|
+
expect((await run(cmd.add, input)).value).toMatchObject({ status: 403, terminal: true });
|
|
219
|
+
expect(registerProject).toHaveBeenCalledTimes(1);
|
|
220
|
+
await fs.writeFile(registrationFile, JSON.stringify({ url: 'http://127.0.0.1:1', password }));
|
|
221
|
+
const stale = await run(cmd.add, input);
|
|
222
|
+
expect(stale.value.terminal).toBe(true);
|
|
223
|
+
expect(stale.stdout + stale.stderr).not.toContain(password);
|
|
224
|
+
expect(registerProject).toHaveBeenCalledTimes(1);
|
|
225
|
+
});
|
|
226
|
+
|
|
194
227
|
it('rejects unbounded connection input and sanitizes remote errors', async () => {
|
|
195
228
|
const session = await create();
|
|
196
229
|
const request = (operation, input) => fetch(`${origin}${REMOTE_CONNECTIONS_SKILL_PATH}`, { method: 'POST',
|
|
@@ -54,6 +54,7 @@ export const registerSessionFoldersRoutes = (app, dependencies) => {
|
|
|
54
54
|
await fsPromises.writeFile(tmp, serialized, 'utf8');
|
|
55
55
|
await fsPromises.rename(tmp, filePath);
|
|
56
56
|
saved = true;
|
|
57
|
+
dependencies.broadcastYuriEvent?.({ type: 'yuri:session-folders-changed', properties: { occurredAt: Date.now() } });
|
|
57
58
|
return res.json({ success: true });
|
|
58
59
|
} catch (error) {
|
|
59
60
|
if (tmp && !saved) {
|
|
@@ -96,7 +96,10 @@ the index excludes them from every snapshot and clears prior summaries when a
|
|
|
96
96
|
coding workers the Assistant subscribed to),
|
|
97
97
|
`metadata.yuri.scheduledTask.taskID`,
|
|
98
98
|
`metadata.yuri.smallModel.purpose`, or
|
|
99
|
-
|
|
99
|
+
`metadata.yuri.llm.purpose`, or `metadata.yuri.worker.parentSessionID`.
|
|
100
|
+
Native `session.metadata.updated` removes newly hidden summaries and pins
|
|
101
|
+
immediately; ordinary metadata-only updates do not fabricate partial rows.
|
|
102
|
+
Metadata remains the ownership/isolation signal;
|
|
100
103
|
reserved title tags are a separate background-list exclusion rule.
|
|
101
104
|
`time.archived` is archive state (Host authority via
|
|
102
105
|
`metadata.yuri.archive.archivedAt` when present — see
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
resolveSessionDirectory,
|
|
6
6
|
} from '../session-metadata/session-projection.js';
|
|
7
7
|
import { extractSessionStatusUpdate } from '../opencode/session-runtime.js';
|
|
8
|
+
import { isVisibleSession } from './service.js';
|
|
8
9
|
|
|
9
10
|
const withDirectory = (session, directory) => {
|
|
10
11
|
if (!session || typeof session !== 'object') return null;
|
|
@@ -37,6 +38,13 @@ export const applySessionIndexEvent = (service, event, observedAt = Date.now(),
|
|
|
37
38
|
|
|
38
39
|
const baseType = normalizeSessionEventType(payload.type);
|
|
39
40
|
|
|
41
|
+
if (baseType === 'session.metadata.updated') {
|
|
42
|
+
if (isHostReady && !isHostReady()) return false;
|
|
43
|
+
const data = payload.data ?? properties;
|
|
44
|
+
if (typeof data.sessionID !== 'string' || !data.metadata || typeof data.metadata !== 'object') return false;
|
|
45
|
+
return !isVisibleSession({ metadata: data.metadata }) ? service.remove(data.sessionID) : false;
|
|
46
|
+
}
|
|
47
|
+
|
|
40
48
|
if (baseType === 'session.model.selected') {
|
|
41
49
|
if (isHostReady && !isHostReady()) return false;
|
|
42
50
|
const data = payload.data ?? properties;
|
|
@@ -3,6 +3,22 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
3
3
|
import { applySessionIndexEvent } from './event-ingest.js';
|
|
4
4
|
|
|
5
5
|
describe('session index event ingest', () => {
|
|
6
|
+
it('removes an indexed CLI worker on authoritative metadata updates without deleting its conversation', () => {
|
|
7
|
+
const service = { remove: vi.fn(() => true), upsertAndReportChange: vi.fn() };
|
|
8
|
+
const event = { payload: { type: 'session.metadata.updated', data: {
|
|
9
|
+
sessionID: 'worker', metadata: { yuri: { worker: { parentSessionID: 'root' } } },
|
|
10
|
+
} } };
|
|
11
|
+
expect(applySessionIndexEvent(service, event, 30, { isHostReady: () => false })).toBe(false);
|
|
12
|
+
expect(service.remove).not.toHaveBeenCalled();
|
|
13
|
+
expect(applySessionIndexEvent(service, event, 30)).toBe(true);
|
|
14
|
+
expect(service.remove).toHaveBeenCalledWith('worker');
|
|
15
|
+
expect(service.upsertAndReportChange).not.toHaveBeenCalled();
|
|
16
|
+
service.remove.mockClear();
|
|
17
|
+
expect(applySessionIndexEvent(service, { payload: { type: 'session.metadata.updated', data: {
|
|
18
|
+
sessionID: 'ordinary', metadata: { yuri: { worker: { parentSessionID: '' } } },
|
|
19
|
+
} } }, 30)).toBe(false);
|
|
20
|
+
expect(service.remove).not.toHaveBeenCalled();
|
|
21
|
+
});
|
|
6
22
|
it('ingests native model selection through the existing-row mutation and respects Host readiness', () => {
|
|
7
23
|
const service = { updateModel: vi.fn(() => true) };
|
|
8
24
|
const model = { providerID: 'p', id: 'model', variant: 'high' };
|
|
@@ -16,6 +16,7 @@ const isContactAssignedSession = (yuri) => yuri?.assigned?.from === 'contact';
|
|
|
16
16
|
const isSystemSession = (session) => {
|
|
17
17
|
const yuri = session?.metadata?.yuri;
|
|
18
18
|
if (!yuri || typeof yuri !== 'object') return false;
|
|
19
|
+
if (nonEmptySystemID(yuri.worker?.parentSessionID)) return true;
|
|
19
20
|
// Contact-assigned workers stay visible in Chat. Only archived Assistant
|
|
20
21
|
// bindings use `yuri.assistant` as a hide marker.
|
|
21
22
|
if (nonEmptySystemID(yuri.assistant?.assistantID) && !isContactAssignedSession(yuri)) return true;
|
|
@@ -406,7 +406,8 @@ describe('Electron session index', () => {
|
|
|
406
406
|
|
|
407
407
|
service.replaceDirectory({
|
|
408
408
|
directory: '/repo',
|
|
409
|
-
sessions: [assistantSession, scheduledSession, smallModelSession, llmSession,
|
|
409
|
+
sessions: [assistantSession, scheduledSession, smallModelSession, llmSession,
|
|
410
|
+
{ ...session('ses_cli_worker', 95), metadata: { yuri: { worker: { parentSessionID: 'root' } } } }, ordinary],
|
|
410
411
|
cursor: null,
|
|
411
412
|
hasMore: false,
|
|
412
413
|
});
|
|
@@ -416,6 +417,7 @@ describe('Electron session index', () => {
|
|
|
416
417
|
service.upsert(scheduledSession);
|
|
417
418
|
service.upsert(smallModelSession);
|
|
418
419
|
service.upsert(llmSession);
|
|
420
|
+
service.upsert({ ...session('ses_cli_worker', 95), metadata: { yuri: { worker: { parentSessionID: 'root' } } } });
|
|
419
421
|
expect(service.snapshot().directories[0].sessions.map((item) => item.id)).toEqual(['ses_ordinary']);
|
|
420
422
|
service.close();
|
|
421
423
|
});
|
|
@@ -95,8 +95,25 @@ The Host has no goal routes, objective-file API, progress auditor or continuatio
|
|
|
95
95
|
System ownership for sidebar / session-index / notifications is established when Host metadata
|
|
96
96
|
carries a non-empty `yuri.assistant.assistantID` (unless
|
|
97
97
|
`assigned.from === 'contact'`), `yuri.scheduledTask.taskID`,
|
|
98
|
-
`yuri.smallModel.purpose`, or `yuri.llm.purpose`. Every system
|
|
98
|
+
`yuri.smallModel.purpose`, or `yuri.llm.purpose`. Every system
|
|
99
99
|
session creator must persist the matching patch through this store. Separately,
|
|
100
100
|
ordinary sidebar/session-index lists also exclude reserved leading title tags
|
|
101
101
|
`[Scheduled]`, `[Assistant]`, and `[yuri-llm]`, including legacy sessions
|
|
102
102
|
without metadata; these tags do not establish metadata ownership.
|
|
103
|
+
|
|
104
|
+
## Delegated CLI workers
|
|
105
|
+
|
|
106
|
+
Use the native subagent tool, or create the session with OpenCode's `parentID`
|
|
107
|
+
before passing its ID to `opencode run --session`. Bare `opencode run` creates
|
|
108
|
+
an ordinary root conversation; agent names, titles and prompt text do not prove
|
|
109
|
+
delegation and must not be used to hide it.
|
|
110
|
+
|
|
111
|
+
For an existing CLI worker whose delegating session is explicitly known, merge
|
|
112
|
+
`{ yuri: { worker: { parentSessionID: "<delegating-session-id>" } } }` through
|
|
113
|
+
`PUT /api/yuri/sessions/:sessionId/metadata`. Preserve the real native `parentID`;
|
|
114
|
+
this marker does not manufacture an upstream ancestry edge. It excludes the
|
|
115
|
+
worker from ordinary session catalogs, unread badges, title refresh and ordinary
|
|
116
|
+
notifications, including standalone VS Code. Transcript content is unchanged.
|
|
117
|
+
Only mark verified delegated workers, never every root session using a secondary
|
|
118
|
+
agent. Remove this marker with `{ yuri: { worker: null } }` to restore ordinary
|
|
119
|
+
visibility on the next catalog refresh; old hidden unread is not resurrected.
|
|
@@ -4,6 +4,9 @@ Server-side watcher that regenerates a session's sidebar title from the
|
|
|
4
4
|
conversation's **main subject** (overall feature / goal) with the small model
|
|
5
5
|
(`lib/small-model`), then PATCHes `title` plus `metadata.yuri.titleRefresh`.
|
|
6
6
|
|
|
7
|
+
Explicit delegated CLI workers (`metadata.yuri.worker.parentSessionID`) are
|
|
8
|
+
system-owned for title refresh, just as they are for catalog/unread visibility.
|
|
9
|
+
|
|
7
10
|
OpenCode starts its own initial title through `SessionTitle.generate`.
|
|
8
11
|
This module auto-refreshes sparsely (first user
|
|
9
12
|
admission of a new session, first newly-sent reply on a fork) and on explicit smart-title
|
|
@@ -156,6 +156,7 @@ const extractSessionStatus = (payload) => {
|
|
|
156
156
|
export const isSystemOwnedSession = (sessionOrInfo) => {
|
|
157
157
|
const yuri = sessionOrInfo?.metadata?.yuri;
|
|
158
158
|
if (!yuri || typeof yuri !== 'object') return false;
|
|
159
|
+
if (typeof yuri.worker?.parentSessionID === 'string' && yuri.worker.parentSessionID) return true;
|
|
159
160
|
if (yuri.assigned?.from === 'contact') return false;
|
|
160
161
|
if (typeof yuri.assistant?.assistantID === 'string' && yuri.assistant.assistantID) return true;
|
|
161
162
|
if (typeof yuri.scheduledTask?.taskID === 'string' && yuri.scheduledTask.taskID) return true;
|
|
@@ -226,6 +226,8 @@ describe('session-title helpers', () => {
|
|
|
226
226
|
});
|
|
227
227
|
|
|
228
228
|
it('detects system-owned sessions from metadata only', () => {
|
|
229
|
+
expect(isSystemOwnedSession({ metadata: { yuri: { worker: { parentSessionID: 'root' } } } })).toBe(true);
|
|
230
|
+
expect(isSystemOwnedSession({ metadata: { yuri: { worker: { parentSessionID: '' } } } })).toBe(false);
|
|
229
231
|
expect(isSystemOwnedSession({
|
|
230
232
|
metadata: { yuri: { assistant: { assistantID: 'assistant_1', name: 'A' } } },
|
|
231
233
|
})).toBe(true);
|