@yuriai/web 0.3.6-beta.8 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +19 -3
- package/bin/install-portable.sh +102 -0
- package/bin/install-portable.test.js +112 -0
- package/bin/lib/DOCUMENTATION.md +2 -0
- package/bin/lib/cli-startup.js +7 -2
- package/bin/lib/cli-startup.portable.test.js +30 -0
- package/bin/lib/commands-serve.js +4 -1
- package/bin/lib/commands-update.js +3 -0
- package/bin/lib/commands-update.test.js +18 -0
- package/dist/assets/{AgentAvatar-COZrpK6y.js → AgentAvatar-BOvjZ-DI.js} +1 -1
- package/dist/assets/{AgentSelector-7iPujobN.js → AgentSelector-Dl_zIOMk.js} +1 -1
- package/dist/assets/ArchivedSessionsDialog-Cr9Ji-RY.js +1 -0
- package/dist/assets/{AssistantConversationSurface-C6tCgfuc.js → AssistantConversationSurface-CLdjNFeJ.js} +3 -3
- package/dist/assets/{AssistantSessionCard-BLKXoc6z.js → AssistantSessionCard-BufyrOfo.js} +2 -2
- package/dist/assets/{AssistantUnreadBadge-BSWBtgFe.js → AssistantUnreadBadge-Dn9HAEDr.js} +1 -1
- package/dist/assets/{AssistantView-YdmEtDcb.js → AssistantView-Cg0wPomu.js} +1 -1
- package/dist/assets/{AssistantWorkingAvatar-Cnl5oL-I.js → AssistantWorkingAvatar-1KNjr2A2.js} +1 -1
- package/dist/assets/{AssistantsSettingsPage-CqtitUB4.js → AssistantsSettingsPage-DeYfZAYH.js} +1 -1
- package/dist/assets/{BinaryFileFallback-ITV09rfY.js → BinaryFileFallback-DfD02fS_.js} +1 -1
- package/dist/assets/{BtwPanel-SwSsRp_l.js → BtwPanel-B_2w8P0X.js} +2 -2
- package/dist/assets/BusyDots-CAv4ygIO.js +4 -0
- package/dist/assets/{ChatContainer-C_-17prp.js → ChatContainer-Dgv075jT.js} +23 -23
- package/dist/assets/ChatView-Cr71C0ZB.js +3 -0
- package/dist/assets/{DiagramView-DDMO_6X5.js → DiagramView-CTnpBsWU.js} +1 -1
- package/dist/assets/{DiffView-DCQrow3l.js → DiffView-j_yWF1Mz.js} +2 -2
- package/dist/assets/{DiffViewToggle-uJM3Jn3y.js → DiffViewToggle-CYusbmY5.js} +1 -1
- package/dist/assets/{ErrorBoundary-BFXVt5ct.js → ErrorBoundary-yr_JeVdx.js} +1 -1
- package/dist/assets/{FadeInOnReveal-CrbIIB5N.js → FadeInOnReveal-C56koblQ.js} +1 -1
- package/dist/assets/{GuiPluginMount-FFI3j0Vq.js → GuiPluginMount-CBJiLdzR.js} +1 -1
- package/dist/assets/{GuiPluginPage-B9I2nkDa.js → GuiPluginPage-DJa8gFLk.js} +1 -1
- package/dist/assets/{GuiPluginSurface-D_IoxXvc.js → GuiPluginSurface-Cc7q80jp.js} +1 -1
- package/dist/assets/{GuiPluginTitlebarItems-C4eqm-dM.js → GuiPluginTitlebarItems-rbK3leaL.js} +1 -1
- package/dist/assets/{GuiPluginWindow-BMeBjsJ4.js → GuiPluginWindow-Cpg2HYWe.js} +1 -1
- package/dist/assets/{Icon-C1m8PihJ.js → Icon-C1rjS64C.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-CJmo4kkb.js → ImageLoadingPlaceholder-2hMqBtYh.js} +1 -1
- package/dist/assets/{LoadingImage-956pmYDm.js → LoadingImage-Bs-621ZL.js} +1 -1
- package/dist/assets/MarkdownRenderer-BZl_T1ng.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-B0BDlD7a.js → MarkdownRendererImpl-DiCCNjDr.js} +3 -3
- package/dist/assets/{MarkstreamRendererImpl-CNodTwpI.js → MarkstreamRendererImpl-Bzz3OZlX.js} +2 -2
- package/dist/assets/{MobileAssistantSettingsPage-DMLyFaSP.js → MobileAssistantSettingsPage-pBhJR2t6.js} +1 -1
- package/dist/assets/{MobileAssistantTab-C8r9diC7.js → MobileAssistantTab-Ceo442NF.js} +1 -1
- package/dist/assets/{MobileBtwPage-CoQGTHvz.js → MobileBtwPage-DPPmDMA6.js} +1 -1
- package/dist/assets/{MobileChangesSurface-CmZpDOwU.js → MobileChangesSurface-DfDoSkTS.js} +1 -1
- package/dist/assets/{MobileChatScreen-Db2VIMuY.js → MobileChatScreen-DHTbrnAr.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-DX3hD4c-.js → MobileDetailNavigation-e1u1y59T.js} +1 -1
- package/dist/assets/{MobileFilesSurface-BERQLtDW.js → MobileFilesSurface-CJoqR3By.js} +2 -2
- package/dist/assets/{MobileHtmlNetworkBoundary-5XyCoKjL.js → MobileHtmlNetworkBoundary-GBhYVYvu.js} +2 -2
- package/dist/assets/{MobileOverlayPanel-XkMrn5-W.js → MobileOverlayPanel-DzKTKeZX.js} +1 -1
- package/dist/assets/{MobileResizableSheet-CcOOlg4R.js → MobileResizableSheet-CkA7qhco.js} +1 -1
- package/dist/assets/{MobileSettingsTab-iRC8w_jI.js → MobileSettingsTab-Bv0HsXFH.js} +1 -1
- package/dist/assets/{MobileShareBridge-DSL2iOvl.js → MobileShareBridge-B-co2UPE.js} +1 -1
- package/dist/assets/{MobileSurface-CkgVejQ3.js → MobileSurface-D63k27t5.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-DDqtoIoS.js → MobileTabPageHeader-FmtbGhwq.js} +1 -1
- package/dist/assets/{ModelLogo-DK6xHKii.js → ModelLogo-CMnp5fyy.js} +1 -1
- package/dist/assets/{ModelSelector-DMmMUIB2.js → ModelSelector-BF4wYwaz.js} +1 -1
- package/dist/assets/{MultiRunWindow-B6jL_lNE.js → MultiRunWindow-D0OU63re.js} +1 -1
- package/dist/assets/{OnboardingScreen-BCIOJR5C.js → OnboardingScreen-CDHtDQ0k.js} +1 -1
- package/dist/assets/{OverlayScrollbar-CbdvcSXs.js → OverlayScrollbar-m1EAqRES.js} +1 -1
- package/dist/assets/{PierreDiffViewer-Dn1NIerc.js → PierreDiffViewer-CZk1tZ3K.js} +1 -1
- package/dist/assets/{ProviderLogo-CmOgqmZH.js → ProviderLogo-BqQTME35.js} +1 -1
- package/dist/assets/{RemoteAssistantSessionCard-BydwHPmQ.js → RemoteAssistantSessionCard-CrbCVhqD.js} +1 -1
- package/dist/assets/{RemoteDesktopPanel-q0HrpV8w.js → RemoteDesktopPanel-BzLmzmjb.js} +1 -1
- package/dist/assets/ScheduledTasksDialog-DmtcDZHc.js +3 -0
- package/dist/assets/{ScrollableOverlay-DIkp2MKc.js → ScrollableOverlay-CEglrXfm.js} +1 -1
- package/dist/assets/{SettingsGroup-YUId7nD5.js → SettingsGroup-Bm-l3IIs.js} +1 -1
- package/dist/assets/{SettingsView-DLMfj0mQ.js → SettingsView-CYEjDYWC.js} +15 -15
- package/dist/assets/{SettingsWindow-DCPFcip-.js → SettingsWindow-CvJsxUyu.js} +1 -1
- package/dist/assets/{SetupTourDialog-0bzhfhsY.js → SetupTourDialog-DWaVtkY0.js} +1 -1
- package/dist/assets/{SyncActions-8f50jzAU.js → SyncActions-C0gph0P8.js} +1 -1
- package/dist/assets/TerminalView-Cm8Ts51w.js +9 -0
- package/dist/assets/{TextSelectionMenu-BozjXtuL.js → TextSelectionMenu-Dcv_PdES.js} +2 -2
- package/dist/assets/{ToolOutputDialog-BK0D8GxM.js → ToolOutputDialog-QJpQjmqK.js} +2 -2
- package/dist/assets/{YuriLogo-KR0TAQlB.js → YuriLogo-BbS_Wj4g.js} +1 -1
- package/dist/assets/{YuriWordmark-B0uXpGcz.js → YuriWordmark-CqkcfAJl.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-BNDj8_aw.js → assistant-attachment-cache-CIij0OGm.js} +1 -1
- package/dist/assets/{assistantMessagePreview-Ccp5_-kq.js → assistantMessagePreview-wmP-d_oa.js} +1 -1
- package/dist/assets/{assistantQueries-DDTlQu6m.js → assistantQueries-Dpxq78yP.js} +1 -1
- package/dist/assets/{auto-read-context-C8RimaOE.js → auto-read-context-aRn5yhDb.js} +1 -1
- package/dist/assets/{capgoAdapter-DvATpyxN.js → capgoAdapter-BSnmtwX8.js} +1 -1
- package/dist/assets/{card-alsnQayp.js → card-aoveY4I3.js} +1 -1
- package/dist/assets/{chatUpwardIntent-D_Yt_quU.js → chatUpwardIntent-WxxmOppY.js} +1 -1
- package/dist/assets/{checkbox-LzFeQCyX.js → checkbox-CljLXON1.js} +1 -1
- package/dist/assets/{client-i5Q82JUc.js → client-CmtAKi5B.js} +1 -1
- package/dist/assets/{collapsible-HsY9X-Ve.js → collapsible-DkeWKEAb.js} +1 -1
- package/dist/assets/{connection-hint-DsbzB6Ms.js → connection-hint-DsKyICgn.js} +1 -1
- package/dist/assets/{context-menu-Dpuzxt3o.js → context-menu-XuMa5TsA.js} +1 -1
- package/dist/assets/{desktopHosts-DRAWu-NH.js → desktopHosts-COI-czjF.js} +1 -1
- package/dist/assets/{desktopRelayRestore-DFWsoSoG.js → desktopRelayRestore-BEPNc7qb.js} +1 -1
- package/dist/assets/device-TCHW5U2y.js +2 -0
- package/dist/assets/{diagram-COwAj2NM.js → diagram-DFv7Lh0h.js} +1 -1
- package/dist/assets/dialog-B6B8FIrL.css +1 -0
- package/dist/assets/{dialog-Cv20xnEj.js → dialog-Cx20I73q.js} +1 -1
- package/dist/assets/{dropdown-menu-B_P1dDl7.js → dropdown-menu-XdfySbu2.js} +1 -1
- package/dist/assets/es-CLAEdHpc.js +15 -0
- package/dist/assets/{fileMentionTouchSelection-BRu1cBlZ.js → fileMentionTouchSelection-pXNTKHAc.js} +1 -1
- package/dist/assets/{fileReferenceActions-FVCTQlDH.js → fileReferenceActions-wN7mWY3w.js} +1 -1
- package/dist/assets/fr-BOB0gfdQ.js +13 -0
- package/dist/assets/{gitApi-BH7j-M9u.js → gitApi-LXGRaDt8.js} +1 -1
- package/dist/assets/{gitApiHttp-Be5VpQHC.js → gitApiHttp-ZjM4HkSo.js} +2 -2
- package/dist/assets/{githubAuthQueries-Dli4cDU7.js → githubAuthQueries-3AJp5LD5.js} +1 -1
- package/dist/assets/{historyImportQueries-SUqjfVSc.js → historyImportQueries-B_mfphxe.js} +1 -1
- package/dist/assets/host-fTclNJST.js +1 -0
- package/dist/assets/{i18n-CBCskgqa.js → i18n-iu4pzqPi.js} +1 -1
- package/dist/assets/{icons-BQMGp0ts.js → icons-BWijARKS.js} +1 -1
- package/dist/assets/{imageSource-DoyhaY3E.js → imageSource-qzgDdfT4.js} +1 -1
- package/dist/assets/{input-CY-NU-bG.js → input-BMYgp87Q.js} +1 -1
- package/dist/assets/{input-store-C4dE7Hgl.js → input-store-CzG_3qFv.js} +1 -1
- package/dist/assets/insertionBoundaries-bmxIeFzH.js +1 -0
- package/dist/assets/ja-CfM9jZ6u.js +15 -0
- package/dist/assets/{kbd-DJnHCHPh.js → kbd-6RW-BxuR.js} +1 -1
- package/dist/assets/ko-DZOSVPHB.js +15 -0
- package/dist/assets/main-B-Wdp6An.js +169 -0
- package/dist/assets/main-BLBAaohb.js +2 -0
- package/dist/assets/{markdownHeightCache-BAuvVQZt.js → markdownHeightCache-ojT5txMS.js} +1 -1
- package/dist/assets/{mcpQueries-lBUNZsO9.js → mcpQueries-BRuytwhB.js} +1 -1
- package/dist/assets/miniChat-BsrHy2rU.js +2 -0
- package/dist/assets/mobile-B8SHiXyq.js +2 -0
- package/dist/assets/{mobileBackNavigation-BzQ0WYuk.js → mobileBackNavigation-CVrR_jtn.js} +1 -1
- package/dist/assets/{mobileConnections-CSyrEiXH.js → mobileConnections-iSUwFNqu.js} +2 -2
- package/dist/assets/{multirun-BUjPLUCQ.js → multirun-Y3K5yS-8.js} +1 -1
- package/dist/assets/{native-config-C-fqN2Cf.js → native-config-tvqKHwCC.js} +1 -1
- package/dist/assets/{nativeComposerCover-DT9d7IrX.js → nativeComposerCover-5rYz1E3W.js} +1 -1
- package/dist/assets/{navigation-D2V5N7IH.js → navigation-DFmCAq2g.js} +2 -2
- package/dist/assets/openRemoteProjectSession-CeSahDtQ.js +1 -0
- package/dist/assets/openSessionFromDeepLink-DsZnNy4W.js +2 -0
- package/dist/assets/pl-CaT81Sz8.js +15 -0
- package/dist/assets/platform-B2ylz14u.js +1 -0
- package/dist/assets/{pluginPresentation-CbOzLlWM.js → pluginPresentation-rls1AMJN.js} +2 -2
- package/dist/assets/{project-preview-ClK_VQFz.js → project-preview-yQerlKs2.js} +1 -1
- package/dist/assets/{projectActions-CD3dKulN.js → projectActions-B11KAI3f.js} +1 -1
- package/dist/assets/{prompt-attachment-upload-BG4nBKxi.js → prompt-attachment-upload-BzYqZdzd.js} +1 -1
- package/dist/assets/pt-BR-9p1IKCEF.js +15 -0
- package/dist/assets/pwa-BrLPfcLk.js +2 -0
- package/dist/assets/{queue-abort-optimistic-DcW7tzaK.js → queue-abort-optimistic-CXKdQu_T.js} +1 -1
- package/dist/assets/{quota-Cyq21PUF.js → quota-BhdKv_Wc.js} +1 -1
- package/dist/assets/{reference-history-BZIwpng4.js → reference-history-Bzn-aPYg.js} +1 -1
- package/dist/assets/{remote-input-store-CiwwBt7K.js → remote-input-store-DPw_n0MZ.js} +1 -1
- package/dist/assets/{remoteProjectQueries-CuuZggLJ.js → remoteProjectQueries-BQzoY_Y9.js} +1 -1
- package/dist/assets/{remoteSessionReference-DAt2R0UC.js → remoteSessionReference-DORvqUYQ.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-C7YpH2qP.js → renderElectronMiniChatApp-DXKgwBat.js} +2 -2
- package/dist/assets/renderMobileApp-CKN6rWxR.js +17 -0
- package/dist/assets/{runtime-file-download-RzAqq2xr.js → runtime-file-download-CaeLqIEY.js} +1 -1
- package/dist/assets/{runtime-file-resource-COtIWnSi.js → runtime-file-resource-BGZ4tGr5.js} +1 -1
- package/dist/assets/{runtimeConfig-Byc5NYTD.js → runtimeConfig-BqUZF6Wt.js} +1 -1
- package/dist/assets/runtimeEndpointReset-Bu02gAs3.js +4 -0
- package/dist/assets/{scheduledTaskNavigation-DuM1gQ9g.js → scheduledTaskNavigation-r3g3DfXq.js} +1 -1
- package/dist/assets/{select-DxI3wkmK.js → select-BPIsJWhM.js} +1 -1
- package/dist/assets/{sessionLookup-UJH1iLm2.js → sessionLookup-DZhrkKRI.js} +1 -1
- package/dist/assets/{sessionOwnership-W4KQ8CbY.js → sessionOwnership-LoUNVeuJ.js} +1 -1
- package/dist/assets/{shortcuts-FWBXko6F.js → shortcuts-DMupfl7l.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-Bq5JCAvR.js → sortable-tabs-strip-1bKw81VO.js} +1 -1
- package/dist/assets/{speechSettingsQueries-Cybc1zo2.js → speechSettingsQueries-C3JgzCqy.js} +1 -1
- package/dist/assets/src-BacdFOCS.css +2 -0
- package/dist/assets/{store-BRt8bo0A.js → store-BgsgBTwJ.js} +5 -5
- package/dist/assets/{switch-BDwSWOjd.js → switch-B4-v9kvg.js} +1 -1
- package/dist/assets/{terminalApi-BMMDklSX.js → terminalApi-wdwb9MVG.js} +1 -1
- package/dist/assets/{textarea-BshZJgqE.js → textarea-DExmj0ZR.js} +1 -1
- package/dist/assets/{timeFormat-7kWOlby7.js → timeFormat-BlSO2-ws.js} +1 -1
- package/dist/assets/{tooltip-Cdy71vjH.js → tooltip-Di-WRJUZ.js} +1 -1
- package/dist/assets/{truncated-path-YngMm0g8.js → truncated-path-nKzykV5p.js} +1 -1
- package/dist/assets/types-4xeqxklF.js +2 -0
- package/dist/assets/ui-BCYkB585.js +13 -0
- package/dist/assets/uk-BUSl_Y_1.js +15 -0
- package/dist/assets/useAppFontEffects-BCJPQstm.js +7 -0
- package/dist/assets/{useAssistantUIStore-LaS5RREA.js → useAssistantUIStore-BUWPTwNV.js} +1 -1
- package/dist/assets/{useDesktopWindowControlsLayout-Icn9KYUk.js → useDesktopWindowControlsLayout-BtpyMlOS.js} +1 -1
- package/dist/assets/{useDictation-C1sdxoEy.js → useDictation-4HBMkISY.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-BnoYSkb7.js → useEffectiveDirectory-BYswRwIv.js} +1 -1
- package/dist/assets/useFontPreferences-C4dQT72k.js +1 -0
- package/dist/assets/{useGitStore-FAEWrkVE.js → useGitStore-DqBPgmf-.js} +1 -1
- package/dist/assets/{useInlineCommentDraftStore-CjyZgWKx.js → useInlineCommentDraftStore-CGJ6dM8d.js} +1 -1
- package/dist/assets/useMcpConfigStore-DEcxFuzW.js +1 -0
- package/dist/assets/{useMobileSwipeActions-3JgGyG-s.js → useMobileSwipeActions-DqlR4X-T.js} +1 -1
- package/dist/assets/useMobileTranscriptSyncHint-BDKcqtq_.js +10 -0
- package/dist/assets/{useModelLists-Cz7CBWNr.js → useModelLists-DsFTBlMr.js} +1 -1
- package/dist/assets/{useOpenCodeReadiness-DSTj-ijS.js → useOpenCodeReadiness-CHybAoBh.js} +1 -1
- package/dist/assets/usePluginsStore-BIBHPK4A.js +1 -0
- package/dist/assets/{useProjectGitActions-C0z5ldH7.js → useProjectGitActions-DeFcqi_O.js} +1 -1
- package/dist/assets/{useProjectGitStore-C6ZCDvmO.js → useProjectGitStore-JGZk-NCk.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-Fi6XrG43.js → useProjectRuntimeAPIs-BMBBtJB-.js} +1 -1
- package/dist/assets/{useQuotaStore-yM_EeU_A.js → useQuotaStore-C3qJTiD7.js} +1 -1
- package/dist/assets/{useSessionBtwStore-1yHVqSCf.js → useSessionBtwStore-D7P-pknd.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-BbawjMGN.js → useStreamingTextThrottle-CjWAE0oQ.js} +1 -1
- package/dist/assets/useTerminalStore-C_QzSEgP.js +1 -0
- package/dist/assets/{useUIStore-Dz0bOfkB.js → useUIStore-68ZPpgYA.js} +1 -1
- package/dist/assets/worktreeManager-pRvX5dQT.js +1 -0
- package/dist/assets/{worktreeSourceBranchPreference-BJrbhZ4m.js → worktreeSourceBranchPreference-B7d3RYcc.js} +1 -1
- package/dist/assets/zh-CN-BGKgQtWd.js +15 -0
- package/dist/assets/zh-TW-jM5lIKfe.js +15 -0
- package/dist/index.html +16 -16
- package/dist/mini-chat.html +16 -16
- package/dist/mobile.html +2 -2
- package/package.json +2 -1
- package/server/index.js +22 -10
- package/server/lib/assistants/DOCUMENTATION.md +11 -6
- package/server/lib/assistants/builtin-skills.js +19 -3
- package/server/lib/assistants/builtin-skills.test.js +17 -0
- package/server/lib/assistants/contact-tools.js +47 -3
- package/server/lib/assistants/contact-tools.test.js +59 -0
- package/server/lib/assistants/harness.js +5 -2
- package/server/lib/assistants/harness.test.js +1 -1
- package/server/lib/assistants/routes.js +1 -0
- package/server/lib/assistants/service.js +7 -2
- package/server/lib/assistants/yuri-tools.js +1 -1
- package/server/lib/assistants/yuri-tools.test.js +1 -1
- package/server/lib/gui-customization/DOCUMENTATION.md +32 -7
- package/server/lib/gui-customization/projects-client.mjs +1 -1
- package/server/lib/gui-customization/projects.js +6 -6
- package/server/lib/gui-customization/projects.test.js +13 -2
- package/server/lib/gui-customization/remote-connections-client.mjs +1 -1
- package/server/lib/gui-customization/remote-connections.js +7 -6
- package/server/lib/gui-customization/remote-connections.test.js +17 -0
- package/server/lib/gui-customization/session-skill.js +16 -4
- package/server/lib/gui-customization/session-skill.test.js +16 -0
- package/server/lib/gui-customization/skill/SKILL.md +2 -2
- package/server/lib/gui-customization/skill/references/deep-links.md +15 -11
- package/server/lib/gui-customization/skill/references/gui-api.md +50 -1
- package/server/lib/gui-customization/skill/references/projects.md +19 -0
- package/server/lib/gui-customization/skill/references/remote-connections.md +3 -0
- package/server/lib/gui-customization/skill-caller.js +18 -0
- package/server/lib/host-update/DOCUMENTATION.md +5 -0
- package/server/lib/host-update/cli.js +5 -2
- package/server/lib/host-update/cli.test.js +15 -2
- package/server/lib/opencode/DOCUMENTATION.md +2 -1
- package/server/lib/opencode/custom-provider.test.js +41 -0
- package/server/lib/opencode/feature-routes-runtime.js +20 -3
- package/server/lib/opencode/settings-helpers.js +5 -0
- package/server/lib/opencode/settings-helpers.test.js +10 -0
- package/server/lib/package-manager.js +14 -0
- package/server/lib/package-manager.test.js +7 -0
- package/server/lib/portable-installation.js +34 -0
- package/server/lib/portable-installation.test.js +38 -0
- package/server/lib/session-index/DOCUMENTATION.md +8 -0
- package/server/lib/session-index/adopt-unindexed-session.js +46 -0
- package/server/lib/session-index/adopt-unindexed-session.test.js +77 -0
- package/server/lib/session-index/event-ingest.js +14 -1
- package/server/lib/session-index/event-ingest.test.js +18 -0
- package/dist/assets/ArchivedSessionsDialog-DLZzsdyB.js +0 -1
- package/dist/assets/BusyDots-C2pMtufA.js +0 -4
- package/dist/assets/ChatView-CNNGCekk.js +0 -3
- package/dist/assets/MarkdownRenderer-GdoxOy4f.js +0 -2
- package/dist/assets/ScheduledTasksDialog-DY9GJF-s.js +0 -3
- package/dist/assets/TerminalView-B9AFgs54.js +0 -8
- package/dist/assets/device-gKeFQDLT.js +0 -2
- package/dist/assets/dialog-D9CkSNCA.css +0 -1
- package/dist/assets/es-BuXtFKUW.js +0 -15
- package/dist/assets/fr-BaZeffY9.js +0 -13
- package/dist/assets/host-CgzhgNKF.js +0 -1
- package/dist/assets/insertionBoundaries-DUMGOIsz.js +0 -1
- package/dist/assets/ja-CGVx5A8U.js +0 -15
- package/dist/assets/ko-C663nzbf.js +0 -15
- package/dist/assets/main-CSPEphQ0.js +0 -169
- package/dist/assets/main-VozcdE4o.js +0 -2
- package/dist/assets/miniChat-DuIhQwv6.js +0 -2
- package/dist/assets/mobile-zYF3NcbJ.js +0 -2
- package/dist/assets/openRemoteProjectSession-Dz9GJCUz.js +0 -1
- package/dist/assets/openSessionFromDeepLink-DHu8AmBy.js +0 -2
- package/dist/assets/pl-CeBOMwg9.js +0 -15
- package/dist/assets/platform-z1TeG-ky.js +0 -1
- package/dist/assets/pt-BR-r8268Pk6.js +0 -15
- package/dist/assets/pwa-Dc46OTi7.js +0 -2
- package/dist/assets/renderMobileApp-DkFS7I4O.js +0 -17
- package/dist/assets/runtimeEndpointReset-BOfBQwJk.js +0 -4
- package/dist/assets/src-DYCPWwUH.css +0 -2
- package/dist/assets/types-CjZZGQvx.js +0 -2
- package/dist/assets/ui-DeV7Us1B.js +0 -13
- package/dist/assets/uk-CeQ1XJ99.js +0 -15
- package/dist/assets/useAppFontEffects-CWZFjoHJ.js +0 -7
- package/dist/assets/useFontPreferences-CLUZvRho.js +0 -1
- package/dist/assets/useMcpConfigStore-n8Iyj2v9.js +0 -1
- package/dist/assets/useMobileTranscriptSyncHint-CgAaYuLF.js +0 -10
- package/dist/assets/usePluginsStore-CsChIifx.js +0 -1
- package/dist/assets/worktreeManager-XchvRN9O.js +0 -1
- package/dist/assets/zh-CN-Bv854olO.js +0 -15
- package/dist/assets/zh-TW-gx8cO-Cx.js +0 -15
|
@@ -11,6 +11,8 @@ A helper result with `terminal:true` ends the workflow immediately. HTTP 401/403
|
|
|
11
11
|
3. Start each target independently, then poll `list` until every requested instance has `running:false`. Setup saves/reuses the instance, installs or aligns the managed Yuri/OpenCode runtime, establishes SSH forwarding and pushes configuration. A repeated active setup shares the same target operation. A failed target does not cancel the others.
|
|
12
12
|
4. Report each target separately: `phase:ready` confirms SSH/service readiness, `sync:complete` confirms transfer, and `magpie:ready` confirms gateway health. Warnings and failed/missing checks mean partial completion, not success. Authentication/host-key interaction uses the existing native prompt where available; otherwise the user must prepare their SSH key/agent or saved settings. Keep the other targets progressing.
|
|
13
13
|
|
|
14
|
+
New managed Linux connections download the desktop's matching self-contained release (x64/arm64, glibc 2.36+). It includes private Node, precompiled native modules and OpenCode; the target needs bash, curl or wget, tar and a SHA-256 utility, not Node/npm/Python or build tools. Setup verifies the package before activation and keeps system Node and shell profiles unchanged. Existing saved npm/bun choices and macOS targets retain their package-manager path. Unsupported systems and failed downloads/preflight remain explicit failures, not a request to install a compiler.
|
|
15
|
+
|
|
14
16
|
If the user also requested a project on that machine, continue with [remote project registration](projects.md#connected-remote-projects-and-sessions) through the separately bound project helper. Rediscover the authenticated target with `remote-hosts` after setup; an SSH readiness receipt alone does not register a project or supply its Hub/Host/instance identity.
|
|
15
17
|
|
|
16
18
|
The local Host is the configuration source, regardless of other windows' selected runtimes. If Magpie is **installed**, setup selects its native configuration/authorization transfer when available, provisions the remote headless CLI and verifies its server gateway. An installed but unconfigured source reports `magpie_source_not_configured`; it does not silently switch to a different credential source. Without Magpie, setup uses OpenCode's credential API. Local-path/file plugins are filtered from SSH configuration copies; registry plugins remain.
|
|
@@ -24,6 +26,7 @@ For managed SSH connections, report these checks separately. Use the bound helpe
|
|
|
24
26
|
- **Reconnect:** retry the saved instance ID after disconnecting, and again after restarting the desktop. Each attempt must finish with `running:false` and `phase:ready`; open that remote workspace and verify an authenticated operation against its OpenCode service. A prior ready receipt or a standalone web server's health response does not establish this result.
|
|
25
27
|
- **Runtime readiness:** the executable selected by managed SSH startup must load its server dependencies, load native modules in the selected runtime, and reach authenticated service readiness. A CLI version response or successful package installation alone is insufficient. Record the actual runtime/package versions when available; otherwise mark that evidence unavailable.
|
|
26
28
|
- **Update:** when a different target version is available, reconnect through the normal managed entry. Verify that version alignment completes, the running remote Host reports the target version, and its workspace remains usable. Disconnect and reconnect once more to confirm the updated installation is selected again. Record the before/target/running versions; without a version transition, report update acceptance as unverified.
|
|
29
|
+
- **Portable update:** managed reconnect owns release alignment through the stable launcher. Old release files remain available; download/checksum/preflight failure does not activate the candidate. Portable `yuri update` and HTTP self-update report unsupported; use normal managed reconnect rather than an npm workaround.
|
|
27
30
|
- **Installation ownership:** the executable used on subsequent connections must resolve to the installation that the managed updater replaces. A manually deployed checkout, wrapper or redirected executable requires evidence that an update replaces the selected installation and the next connection uses it; successful startup alone does not prove updateability.
|
|
28
31
|
|
|
29
32
|
Report connection, runtime and update evidence independently from configuration-sync and gateway receipts. If an update or startup fails, report its failed stage and retain the saved instance for retry; success requires a subsequent normal managed connection to reach readiness. These are acceptance criteria, not authorization to rewrite runtime files, executable links or credentials outside the supported setup flow.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
const validID = (value) => typeof value === 'string' && value.length > 0 && value.length <= 256;
|
|
2
|
+
|
|
3
|
+
/** A bridge caller is exactly one admitted Session or one live Assistant contact. */
|
|
4
|
+
export const parseSkillCaller = (body) => {
|
|
5
|
+
const { sessionID, assistantID } = body ?? {};
|
|
6
|
+
if (validID(sessionID) && assistantID === undefined) return { kind: 'session', id: sessionID };
|
|
7
|
+
if (validID(assistantID) && sessionID === undefined) return { kind: 'assistant', id: assistantID };
|
|
8
|
+
return null;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const hostOriginOf = (req) => `http://${req.socket.localAddress === '::1' ? '[::1]' : '127.0.0.1'}:${req.socket.localPort}`;
|
|
12
|
+
|
|
13
|
+
/** Loopback and service credential are checked by the route; this binds the caller to this Host. */
|
|
14
|
+
export const isBoundSkillCaller = async (req, caller, { createClient, hasAssistant }) => {
|
|
15
|
+
if (caller.kind === 'assistant') return Boolean(await hasAssistant?.(caller.id));
|
|
16
|
+
const session = await createClient().session.get({ sessionID: caller.id });
|
|
17
|
+
return session.metadata?.yuri?.scheduledTaskSkill?.hostOrigin === hostOriginOf(req);
|
|
18
|
+
};
|
|
@@ -75,6 +75,11 @@ unsupported or fail preflight without stopping the Host. Use their installation
|
|
|
75
75
|
or service manager instead. Other data scopes sharing one global installation
|
|
76
76
|
must be administratively drained; the installation lock prevents competing
|
|
77
77
|
remote helpers but does not coordinate arbitrary external package managers.
|
|
78
|
+
A self-contained Linux release reports
|
|
79
|
+
`portable_installation_requires_release` without probing a package manager.
|
|
80
|
+
Stop it and use its bundled release installer, or reconnect through an updated
|
|
81
|
+
desktop for SSH version alignment. Neither HTTP updates nor `yuri update` may
|
|
82
|
+
fall back to installing a global npm copy.
|
|
78
83
|
A helper killed before its `finally` cleanup leaves an installation lock in the
|
|
79
84
|
user cache; an operator must verify no helper remains before removing that lock.
|
|
80
85
|
Workers deliberately do not race to reap presumed stale locks.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { fork } from 'node:child_process';
|
|
2
2
|
import { fileURLToPath } from 'node:url';
|
|
3
3
|
import { existsSync } from 'node:fs';
|
|
4
|
+
import path from 'node:path';
|
|
4
5
|
import { discoverCliRelease } from './releases.js';
|
|
5
6
|
|
|
6
7
|
const workerFile = fileURLToPath(new URL('./cli-worker.js', import.meta.url));
|
|
@@ -22,13 +23,14 @@ function startWorker(message, detached = false) {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
export function createCliUpdateAdapter({ packageRoot, dataDir, getPort, shutdown, currentVersion, env = process.env }) {
|
|
25
|
-
const
|
|
26
|
+
const portable = existsSync(path.join(packageRoot, '..', 'portable.json'));
|
|
27
|
+
const unsupported = portable || process.platform === 'win32' || !packageRoot.replaceAll('\\', '/').includes('/node_modules/')
|
|
26
28
|
|| existsSync('/.dockerenv') || env.CONTAINER || env.container || env.INVOCATION_ID || env.PM2_HOME;
|
|
27
29
|
const configuration = () => ({ packageRoot, dataDir, port: getPort(), pid: process.pid });
|
|
28
30
|
let checkedAt = 0;
|
|
29
31
|
const adapter = {
|
|
30
32
|
host: 'cli', external: true, supported: !unsupported,
|
|
31
|
-
reason: unsupported ? 'managed_or_development_installation' : null,
|
|
33
|
+
reason: portable ? 'portable_installation_requires_release' : unsupported ? 'managed_or_development_installation' : null,
|
|
32
34
|
inspect: (channel) => discoverCliRelease(channel, currentVersion),
|
|
33
35
|
async refreshSupport() {
|
|
34
36
|
if (unsupported || Date.now() - checkedAt < 60_000) return;
|
|
@@ -37,6 +39,7 @@ export function createCliUpdateAdapter({ packageRoot, dataDir, getPort, shutdown
|
|
|
37
39
|
checkedAt = Date.now();
|
|
38
40
|
},
|
|
39
41
|
async assertReady() {
|
|
42
|
+
if (unsupported) throw new Error('This installation must be updated through its installer or service manager');
|
|
40
43
|
const { child, ready } = startWorker({ mode: 'probe', ...configuration() });
|
|
41
44
|
try { await ready; } finally { if (child.connected) child.disconnect(); child.unref(); }
|
|
42
45
|
},
|
|
@@ -2,13 +2,14 @@ import { EventEmitter } from 'node:events';
|
|
|
2
2
|
import { beforeEach, expect, it, vi } from 'vitest';
|
|
3
3
|
import { createCliUpdateAdapter } from './cli.js';
|
|
4
4
|
|
|
5
|
-
const fixture = vi.hoisted(() => ({ fork: vi.fn(), inspect: vi.fn(), reject: false, children: [] }));
|
|
5
|
+
const fixture = vi.hoisted(() => ({ fork: vi.fn(), inspect: vi.fn(), reject: false, children: [], portable: false }));
|
|
6
6
|
vi.mock('node:child_process', () => ({ fork: (...args) => fixture.fork(...args) }));
|
|
7
|
-
vi.mock('node:fs', () => ({ existsSync: () =>
|
|
7
|
+
vi.mock('node:fs', () => ({ existsSync: (file) => fixture.portable && file.endsWith('/portable.json') }));
|
|
8
8
|
vi.mock('./releases.js', () => ({ discoverCliRelease: (...args) => fixture.inspect(...args) }));
|
|
9
9
|
|
|
10
10
|
beforeEach(() => {
|
|
11
11
|
fixture.reject = false; fixture.children = []; fixture.inspect.mockReset(); fixture.fork.mockReset();
|
|
12
|
+
fixture.portable = false;
|
|
12
13
|
fixture.fork.mockImplementation(() => {
|
|
13
14
|
const child = Object.assign(new EventEmitter(), {
|
|
14
15
|
connected: true, unref: vi.fn(), kill: vi.fn(), disconnect: vi.fn(), send: vi.fn(),
|
|
@@ -57,3 +58,15 @@ it('advertises development and externally supervised installations as unsupporte
|
|
|
57
58
|
expect(host.supported).toBe(false);
|
|
58
59
|
expect(fixture.fork).not.toHaveBeenCalled();
|
|
59
60
|
});
|
|
61
|
+
|
|
62
|
+
it('advertises portable installs as unsupported without package-manager probes or shutdown', async () => {
|
|
63
|
+
fixture.portable = true;
|
|
64
|
+
const shutdown = vi.fn();
|
|
65
|
+
const host = adapter(shutdown);
|
|
66
|
+
expect(host.supported).toBe(false);
|
|
67
|
+
expect(host.reason).toBe('portable_installation_requires_release');
|
|
68
|
+
await host.refreshSupport();
|
|
69
|
+
await expect(host.assertReady()).rejects.toThrow('installer');
|
|
70
|
+
expect(fixture.fork).not.toHaveBeenCalled();
|
|
71
|
+
expect(shutdown).not.toHaveBeenCalled();
|
|
72
|
+
});
|
|
@@ -81,7 +81,7 @@ encoding, not removed V1 endpoints.
|
|
|
81
81
|
- `packages/web/server/lib/opencode/v1-migration-gate.js`: pure V1→v2 migration admission gate (`GET /api/experimental/migration/v1` → whether transcript may be fetched).
|
|
82
82
|
- `packages/web/server/lib/opencode/managed-capabilities-runtime.js`: managed-child scheduled-task resources, config injection, rotating bridge identity, and bridge authorization.
|
|
83
83
|
- `packages/web/server/lib/opencode/env-runtime.js`: OpenCode CLI/binary resolution and shell environment runtime.
|
|
84
|
-
- `packages/web/server/lib/opencode/ensure-cli.js`: detect local `opencode` version and install the latest stable official V2 into the Yuri data dir when no usable CLI exists. Registry lookup failures remain errors; verified cached installations can be reused offline.
|
|
84
|
+
- `packages/web/server/lib/opencode/ensure-cli.js`: detect local `opencode` version and install the latest stable official V2 into the Yuri data dir when no usable CLI exists. Registry lookup failures remain errors; verified cached installations can be reused offline. The self-contained Linux launcher's PATH supplies its native OpenCode as an ordinary discovered CLI; explicit settings/environment selection still wins.
|
|
85
85
|
- `packages/web/server/lib/opencode/upgrade-screen.js`: startup gate for the running OpenCode below `2.0.20`. Client/schema dependencies accept compatible 2.x updates; fresh installations and required upgrades resolve latest stable 2.x at installation time. The compatible execution floor is independently `2.0.20` (credential API). An unreadable running version is unavailable even when the local CLI is compatible. `POST /api/opencode/install-required` upgrades the selected shared global CLI in place; other supported local installations use the owned-cache installer. Global upgrades do not persist a binary override, so subsequent launches still follow shell discovery. Success requires the running service to meet both the floor and selected target. External services are not replaced; compatible newer shared services are not automatically downgraded. Failure restores binary selection and reports `upgraded: false`, without claiming process or package-manager rollback.
|
|
86
86
|
- `packages/web/server/lib/opencode/env-config.js`: OpenCode-related environment variable parsing and validation (host/port/hostname).
|
|
87
87
|
- `packages/web/server/lib/opencode/hmr-state-runtime.js`: HMR-persistent runtime state initialization, auth-state bootstrap, and HMR sync helpers.
|
|
@@ -117,6 +117,7 @@ encoding, not removed V1 endpoints.
|
|
|
117
117
|
- Missing theme preferences use `carbonfox-light` / `cursor-dark`, matching the shared UI defaults. Existing per-variant IDs and legacy explicitly selected theme IDs remain authoritative; changing the default does not rewrite a user's saved theme.
|
|
118
118
|
- Project registry order and `projectSortOrder` are shared Host authority. After a successful changed write, `onProjectOrderChanged` emits `yuri:project-order-changed` on the existing Yuri SSE channel. Clients GET settings on initial mount, tip, and reconnect. Unchanged and failed writes emit no tip; older settings without a sort mode use `manual`.
|
|
119
119
|
- `packages/web/server/lib/opencode/settings-helpers.js`: Settings payload sanitization/format helpers runtime for response shaping and persisted merge prep.
|
|
120
|
+
- GUI command shortcut overrides use `gui-plugin:` + a JSON tuple of plugin/local command IDs. Keys up to 1024 characters retain their complete identity; oversized plugin keys are omitted rather than truncated into another command's mapping. Existing built-in keys and explicit `__unassigned__` values retain their settings contract.
|
|
120
121
|
- `packages/web/server/lib/opencode/settings-normalization-runtime.js`: path/settings normalization and sanitization helpers runtime used by settings/routes/config wiring.
|
|
121
122
|
- `packages/web/server/lib/opencode/theme-runtime.js`: custom theme JSON validation and theme directory loading runtime for settings utility routes.
|
|
122
123
|
- `packages/web/server/lib/opencode/proxy.js`: OpenCode API/SSE forwarding and readiness-gate route registration.
|
|
@@ -96,6 +96,47 @@ describe('custom provider native V2 persistence', () => {
|
|
|
96
96
|
expect(JSON.stringify(response.body)).not.toContain('fixture-key');
|
|
97
97
|
});
|
|
98
98
|
|
|
99
|
+
it.each([
|
|
100
|
+
'@opencode/ai/providers/openai-compatible',
|
|
101
|
+
'@opencode/ai/providers/openai-compatible/responses',
|
|
102
|
+
])('discovers and saves all 12 models from a standard OpenAI list through the HTTP routes (%s)', async (pkg) => {
|
|
103
|
+
const ids = [
|
|
104
|
+
'gpt-6.1-terra', 'codex-auto-review', 'deepseek-flash', 'gpt-5.6-luna',
|
|
105
|
+
'gpt-6-astra', 'gpt-reserve', 'deepseek-v4-pro', 'gpt-5.6-sol',
|
|
106
|
+
'gpt-5.6-terra', 'gpt-6-luna', 'gpt-6-sol', 'gpt-6.1-sol',
|
|
107
|
+
];
|
|
108
|
+
const payload = {
|
|
109
|
+
data: ids.map((id) => ({ created: 1794458926, id, object: 'model', owned_by: 'openai' })),
|
|
110
|
+
object: 'list',
|
|
111
|
+
};
|
|
112
|
+
const fetch = vi.spyOn(globalThis, 'fetch').mockResolvedValue(new Response(JSON.stringify(payload)));
|
|
113
|
+
configureOpenCodeCredentials(() => client);
|
|
114
|
+
const app = express(); registerCommonRequestMiddleware(app, { express });
|
|
115
|
+
registerOpenCodeRoutes(app, {});
|
|
116
|
+
const discovery = await request(app).post('/api/config/providers/custom/models').send({
|
|
117
|
+
package: pkg, baseURL: 'https://api.example.com/v1', apiKey: 'fixture-key',
|
|
118
|
+
}).expect(200);
|
|
119
|
+
expect(discovery.body).toEqual({ models: ids.map((id) => ({ id, name: id })) });
|
|
120
|
+
expect(fetch).toHaveBeenCalledTimes(1);
|
|
121
|
+
expect(fetch.mock.calls[0][0].toString()).toBe('https://api.example.com/v1/models');
|
|
122
|
+
expect(fetch.mock.calls[0][1].headers.Authorization).toBe('Bearer fixture-key');
|
|
123
|
+
expect(fs.existsSync(file)).toBe(false);
|
|
124
|
+
const config = {
|
|
125
|
+
name: 'Gateway', package: pkg, settings: { baseURL: 'https://api.example.com/v1' },
|
|
126
|
+
models: Object.fromEntries(discovery.body.models.map((model) => [model.id, {
|
|
127
|
+
name: model.name, capabilities: { tools: true, input: ['text'], output: ['text'] },
|
|
128
|
+
}])),
|
|
129
|
+
};
|
|
130
|
+
const saved = await request(app).post('/api/config/providers/custom').send({
|
|
131
|
+
config, apiKey: 'fixture-key',
|
|
132
|
+
}).expect(200);
|
|
133
|
+
const provider = readConfigFile(file).providers[saved.body.providerId];
|
|
134
|
+
expect(provider).toEqual(config);
|
|
135
|
+
expect(Object.keys(provider.models)).toEqual(ids);
|
|
136
|
+
expect(() => Schema.decodeUnknownSync(ConfigProvider.Info)(provider)).not.toThrow();
|
|
137
|
+
expect(fs.readFileSync(file, 'utf8')).not.toContain('fixture-key');
|
|
138
|
+
});
|
|
139
|
+
|
|
99
140
|
it('does not write for an invalid requested directory', async () => {
|
|
100
141
|
configureOpenCodeCredentials(() => client);
|
|
101
142
|
const app = express(); registerCommonRequestMiddleware(app, { express });
|
|
@@ -23,7 +23,8 @@ import { registerProjectIconRoutes } from './project-icon-routes.js';
|
|
|
23
23
|
import { registerScheduledTaskRoutes } from '../scheduled-tasks/routes.js';
|
|
24
24
|
import { registerScheduledTaskToolRoute } from '../scheduled-tasks/managed-tool-route.js';
|
|
25
25
|
import { registerScheduledTaskSessionSkill } from '../scheduled-tasks/session-skill.js';
|
|
26
|
-
import { registerCustomizationSessionSkill } from '../gui-customization/session-skill.js';
|
|
26
|
+
import { registerCustomizationSessionSkill, createCustomizationSkillInstaller } from '../gui-customization/session-skill.js';
|
|
27
|
+
import { readSharedServiceRegistration, resolveSharedServiceRegistrationPath } from './shared-service.js';
|
|
27
28
|
import { registerConversationRoutes } from '../conversations/routes.js';
|
|
28
29
|
import { registerHistoryImportRoutes } from '../history-import/routes.js';
|
|
29
30
|
import { registerSessionTurnPageRoutes } from '../session-turn-pages/routes.js';
|
|
@@ -135,6 +136,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
135
136
|
getIsExternalOpenCode = () => false,
|
|
136
137
|
getIsSharedOpenCodeService = () => false,
|
|
137
138
|
remoteConnectionsAdapter = null,
|
|
139
|
+
getHostPort = () => null,
|
|
138
140
|
forceResolvedOpenCodeBinary = null,
|
|
139
141
|
upgradeOpenCodeCli = null,
|
|
140
142
|
restartOpenCode = null,
|
|
@@ -264,8 +266,22 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
264
266
|
scheduledTaskRouter,
|
|
265
267
|
remoteConnectionsAdapter,
|
|
266
268
|
});
|
|
269
|
+
const hasAssistant = (assistantID) => assistantRoutesRuntime?.service?.hasAssistant(assistantID) ?? false;
|
|
270
|
+
// Contacts run on this Host, so they get the same staged helpers as admitted Sessions, bound to their own ID.
|
|
271
|
+
const customizationSkill = createCustomizationSkillInstaller({ yuriDataDir });
|
|
272
|
+
const resolveAssistantCustomizationSkill = async (assistantID) => {
|
|
273
|
+
const port = getHostPort();
|
|
274
|
+
if (!getIsSharedOpenCodeService() || !port) return null;
|
|
275
|
+
const registrationFile = resolveSharedServiceRegistrationPath();
|
|
276
|
+
const upstreamOrigin = new URL(buildOpenCodeUrl('/', '')).origin;
|
|
277
|
+
const registration = await readSharedServiceRegistration({ file: registrationFile });
|
|
278
|
+
if (!registration?.password || registration.origin !== upstreamOrigin
|
|
279
|
+
|| getOpenCodeAuthHeaders().Authorization !== `Basic ${Buffer.from(`opencode:${registration.password}`).toString('base64')}`) return null;
|
|
280
|
+
const binding = { hostOrigin: `http://127.0.0.1:${port}`, upstreamOrigin, registrationFile };
|
|
281
|
+
return customizationSkill.resolve({ assistantID }, { projectBinding: binding, ...(remoteConnectionsAdapter ? { remoteBinding: binding } : {}) });
|
|
282
|
+
};
|
|
267
283
|
registerRemoteConnectionsSkill(app, {
|
|
268
|
-
express, adapter: remoteConnectionsAdapter, getIsSharedOpenCodeService, getOpenCodeAuthHeaders,
|
|
284
|
+
express, adapter: remoteConnectionsAdapter, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, hasAssistant,
|
|
269
285
|
createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
|
|
270
286
|
});
|
|
271
287
|
registerCustomizationSessionSkill(app, {
|
|
@@ -310,7 +326,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
310
326
|
const projectRegistry = createProjectRegistry({ persistSettings, validateDirectoryPath });
|
|
311
327
|
registerProjectsSkill(app, {
|
|
312
328
|
remoteHostGateway: routeDependencies.remoteHostGateway,
|
|
313
|
-
express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders,
|
|
329
|
+
express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, hasAssistant,
|
|
314
330
|
createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
|
|
315
331
|
registerProject: (input) => projectRegistry.register(input), readSettingsFromDiskStrict, sanitizeProjects,
|
|
316
332
|
sessionLifecycle: createProjectSessionLifecycle({
|
|
@@ -354,6 +370,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
354
370
|
getServerId,
|
|
355
371
|
getAllowedRoots: () => assistantAllowedRoots,
|
|
356
372
|
registerProject: registerAssistantProject,
|
|
373
|
+
resolveCustomizationSkill: resolveAssistantCustomizationSkill,
|
|
357
374
|
listProjects: async () => {
|
|
358
375
|
const settings = await readSettingsFromDiskMigrated();
|
|
359
376
|
return sanitizeProjects(settings?.projects ?? [])
|
|
@@ -76,6 +76,7 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
76
76
|
const SUMMARY_PROMPT_MAX_LENGTH = 16000;
|
|
77
77
|
const VERSION_STRING_MAX_LENGTH = 128;
|
|
78
78
|
const SHORTCUT_OVERRIDE_KEY_MAX_LENGTH = 128;
|
|
79
|
+
const PLUGIN_SHORTCUT_OVERRIDE_KEY_MAX_LENGTH = 1024;
|
|
79
80
|
const SHORTCUT_OVERRIDE_VALUE_MAX_LENGTH = 128;
|
|
80
81
|
const PWA_ORIENTATION_VALUES = new Set(['system', 'portrait', 'landscape']);
|
|
81
82
|
const MOBILE_KEYBOARD_MODE_VALUES = new Set(['native', 'resize-content']);
|
|
@@ -92,6 +93,10 @@ export const createSettingsHelpers = (dependencies) => {
|
|
|
92
93
|
const key = typeof rawKey === 'string' ? rawKey.trim() : '';
|
|
93
94
|
const combo = typeof rawValue === 'string' ? rawValue.trim() : '';
|
|
94
95
|
if (!key || !combo) continue;
|
|
96
|
+
if (key.startsWith('gui-plugin:')) {
|
|
97
|
+
if (key.length <= PLUGIN_SHORTCUT_OVERRIDE_KEY_MAX_LENGTH) result[key] = combo.slice(0, SHORTCUT_OVERRIDE_VALUE_MAX_LENGTH);
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
95
100
|
result[key.slice(0, SHORTCUT_OVERRIDE_KEY_MAX_LENGTH)] = combo.slice(0, SHORTCUT_OVERRIDE_VALUE_MAX_LENGTH);
|
|
96
101
|
}
|
|
97
102
|
return result;
|
|
@@ -279,6 +279,16 @@ describe('settings helpers', () => {
|
|
|
279
279
|
shortcutOverrides: {},
|
|
280
280
|
});
|
|
281
281
|
});
|
|
282
|
+
it('round-trips qualified GUI command identities without truncating colliding prefixes', () => {
|
|
283
|
+
const helpers = createTestHelpers();
|
|
284
|
+
const prefix = `gui-plugin:${JSON.stringify(['package-name'.repeat(15), 'first'])}`;
|
|
285
|
+
const second = `gui-plugin:${JSON.stringify(['package-name'.repeat(15), 'second'])}`;
|
|
286
|
+
const shortcutOverrides = { [prefix]: 'mod+m', [second]: '__unassigned__', open_settings: 'mod+comma' };
|
|
287
|
+
expect(helpers.sanitizeSettingsUpdate({ shortcutOverrides })).toEqual({ shortcutOverrides });
|
|
288
|
+
expect(helpers.sanitizeSettingsUpdate({
|
|
289
|
+
shortcutOverrides: { [`gui-plugin:${'a'.repeat(1024)}`]: 'mod+m', ...shortcutOverrides },
|
|
290
|
+
})).toEqual({ shortcutOverrides });
|
|
291
|
+
});
|
|
282
292
|
|
|
283
293
|
it('accepts OpenCode update notification preference as a persisted shared setting', () => {
|
|
284
294
|
const helpers = createTestHelpers();
|
|
@@ -4,6 +4,7 @@ import fs from 'fs';
|
|
|
4
4
|
import os from 'os';
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { fileURLToPath } from 'url';
|
|
7
|
+
import { readPortableInstallation, portableUpdateError } from './portable-installation.js';
|
|
7
8
|
|
|
8
9
|
const __filename = fileURLToPath(import.meta.url);
|
|
9
10
|
const __dirname = path.dirname(__filename);
|
|
@@ -401,6 +402,17 @@ export function detectPackageManagerDetails() {
|
|
|
401
402
|
};
|
|
402
403
|
}
|
|
403
404
|
|
|
405
|
+
const portable = readPortableInstallation();
|
|
406
|
+
if (portable) {
|
|
407
|
+
return {
|
|
408
|
+
packageManager: 'portable',
|
|
409
|
+
reason: 'self-contained-bundle',
|
|
410
|
+
packagePath: getCurrentPackagePath(),
|
|
411
|
+
packageManagerCommand: null,
|
|
412
|
+
globalNodeModulesRoot: null,
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
|
|
404
416
|
if (cachedDetectedPm) {
|
|
405
417
|
return {
|
|
406
418
|
packageManager: cachedDetectedPm,
|
|
@@ -660,6 +672,8 @@ function isPackageInstalledWith(pm) {
|
|
|
660
672
|
* Get the update command for the detected package manager
|
|
661
673
|
*/
|
|
662
674
|
export function getUpdateCommand(pm = detectPackageManager()) {
|
|
675
|
+
const portable = readPortableInstallation();
|
|
676
|
+
if (portable || pm === 'portable') throw portableUpdateError(portable?.root || path.resolve(__dirname, '../../..'));
|
|
663
677
|
const pmCommand = quoteCommand(resolvePackageManagerCommand(pm));
|
|
664
678
|
switch (pm) {
|
|
665
679
|
case 'pnpm':
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
2
3
|
|
|
3
4
|
// Mock child_process to prevent real spawnSync calls that would hang in tests
|
|
4
5
|
vi.mock('node:child_process', () => ({
|
|
@@ -395,6 +396,12 @@ describe('getCurrentVersion', () => {
|
|
|
395
396
|
});
|
|
396
397
|
|
|
397
398
|
describe('CLI update exports', () => {
|
|
399
|
+
it('never falls back to a shell package manager for portable installations', () => {
|
|
400
|
+
const before = spawnSync.mock.calls.length;
|
|
401
|
+
expect(() => executeUpdate('portable', { silent: true })).toThrow('self-contained Yuri installation');
|
|
402
|
+
expect(spawnSync.mock.calls.length).toBe(before);
|
|
403
|
+
});
|
|
404
|
+
|
|
398
405
|
it('exports package-manager helpers used by the update command', () => {
|
|
399
406
|
expect(typeof detectPackageManager).toBe('function');
|
|
400
407
|
expect(typeof executeUpdate).toBe('function');
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
4
|
+
|
|
5
|
+
export function readPortableInstallation(packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../..')) {
|
|
6
|
+
const root = path.dirname(packageRoot);
|
|
7
|
+
const marker = path.join(root, 'portable.json');
|
|
8
|
+
if (!fs.existsSync(marker)) return null;
|
|
9
|
+
const manifest = JSON.parse(fs.readFileSync(marker, 'utf8'));
|
|
10
|
+
const pkg = JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf8'));
|
|
11
|
+
if (path.basename(packageRoot) !== 'lib' || manifest.format !== 1 || pkg.name !== '@yuriai/web'
|
|
12
|
+
|| manifest.version !== pkg.version || manifest.platform !== process.platform || manifest.arch !== process.arch) {
|
|
13
|
+
throw new Error('Invalid Yuri portable installation; reinstall the matching Linux release');
|
|
14
|
+
}
|
|
15
|
+
let launcher = path.join(root, 'yuri');
|
|
16
|
+
if (path.basename(path.dirname(root)) === 'versions') {
|
|
17
|
+
const current = path.join(root, '../..', 'current');
|
|
18
|
+
if (fs.existsSync(current) && fs.realpathSync(current) === fs.realpathSync(root)) {
|
|
19
|
+
launcher = path.join(current, 'yuri');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return { root, manifest, launcher };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function portableUpdateError(root) {
|
|
26
|
+
const quote = (value) => `'${value.replace(/'/g, "'\\''")}'`;
|
|
27
|
+
const target = path.basename(path.dirname(root)) === 'versions'
|
|
28
|
+
? ` --install-dir ${quote(path.resolve(root, '../..'))} --no-link` : '';
|
|
29
|
+
return new Error(
|
|
30
|
+
`This is a self-contained Yuri installation, not an npm package. ` +
|
|
31
|
+
`Stop its running servers, then run: bash ${quote(path.join(root, 'install.sh'))} --version <version>${target}. ` +
|
|
32
|
+
'SSH-managed installations are updated when reconnecting from Yuri Desktop.'
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { afterEach, expect, it } from 'vitest';
|
|
5
|
+
import { readPortableInstallation } from './portable-installation.js';
|
|
6
|
+
|
|
7
|
+
const directories = [];
|
|
8
|
+
afterEach(() => { for (const root of directories.splice(0)) fs.rmSync(root, { recursive: true, force: true }); });
|
|
9
|
+
|
|
10
|
+
it('recognizes only a valid sibling manifest and never infers ownership from environment', () => {
|
|
11
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'yuri-portable-owner-'));
|
|
12
|
+
directories.push(root);
|
|
13
|
+
const lib = path.join(root, 'lib');
|
|
14
|
+
fs.mkdirSync(lib);
|
|
15
|
+
fs.writeFileSync(path.join(lib, 'package.json'), JSON.stringify({ name: '@yuriai/web', version: '1.2.3' }));
|
|
16
|
+
expect(readPortableInstallation(lib)).toBeNull();
|
|
17
|
+
fs.writeFileSync(path.join(root, 'portable.json'), JSON.stringify({
|
|
18
|
+
format: 1, version: '1.2.3', platform: process.platform, arch: process.arch,
|
|
19
|
+
}));
|
|
20
|
+
expect(readPortableInstallation(lib)).toMatchObject({ root, manifest: { version: '1.2.3' } });
|
|
21
|
+
fs.writeFileSync(path.join(root, 'portable.json'), '{"format":1,"version":"9.9.9"}');
|
|
22
|
+
expect(() => readPortableInstallation(lib)).toThrow('Invalid Yuri portable installation');
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it('uses the installer current symlink for startup without guessing a stable entry for manual archives', () => {
|
|
26
|
+
const install = fs.mkdtempSync(path.join(os.tmpdir(), 'yuri-portable-stable-'));
|
|
27
|
+
directories.push(install);
|
|
28
|
+
const root = path.join(install, 'versions/1.2.3-linux-x64');
|
|
29
|
+
const lib = path.join(root, 'lib');
|
|
30
|
+
fs.mkdirSync(lib, { recursive: true });
|
|
31
|
+
fs.writeFileSync(path.join(lib, 'package.json'), JSON.stringify({ name: '@yuriai/web', version: '1.2.3' }));
|
|
32
|
+
fs.writeFileSync(path.join(root, 'portable.json'), JSON.stringify({
|
|
33
|
+
format: 1, version: '1.2.3', platform: process.platform, arch: process.arch,
|
|
34
|
+
}));
|
|
35
|
+
expect(readPortableInstallation(lib).launcher).toBe(path.join(root, 'yuri'));
|
|
36
|
+
fs.symlinkSync('versions/1.2.3-linux-x64', path.join(install, 'current'));
|
|
37
|
+
expect(readPortableInstallation(lib).launcher).toBe(path.join(install, 'current/yuri'));
|
|
38
|
+
});
|
|
@@ -168,6 +168,14 @@ completion events advance the separate `activity_updated_at` ordering field,
|
|
|
168
168
|
while session status transitions update `status` and `status_changed_at`.
|
|
169
169
|
Renderer event handling never performs these index writes and assistant
|
|
170
170
|
streaming events never change session ordering.
|
|
171
|
+
A user message for a session the index does not hold (an old session outside the
|
|
172
|
+
newest-20 window, or one resumed from history) is handed to
|
|
173
|
+
`adopt-unindexed-session.js`: it reads the session upstream, applies the Host
|
|
174
|
+
projection, lifts its clock to the message time so the retention bound accepts it,
|
|
175
|
+
writes the row and publishes a change. Concurrent messages share one read, a failed
|
|
176
|
+
read is retried by the next message, and a row written live meanwhile wins. Without
|
|
177
|
+
this the task view (which only lists indexed idle sessions) and recency ordering
|
|
178
|
+
would drop such a session as soon as its run ends.
|
|
171
179
|
Native creation projects the event's session identity, location, parent, metadata
|
|
172
180
|
and creation clock before the Host metadata overlay. User inbox enqueue advances
|
|
173
181
|
activity; native execution/retry events update status, and successful completion
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Brings a session back into the index when the user writes to it while the
|
|
3
|
+
* index does not hold it (an old session outside the newest-20 window, or one
|
|
4
|
+
* resumed from history). `touchActivity` only updates existing rows, so without
|
|
5
|
+
* this the session never regains task-view membership or recency ordering.
|
|
6
|
+
*
|
|
7
|
+
* @param {object} deps
|
|
8
|
+
* @param {object} deps.service session-index service
|
|
9
|
+
* @param {(input: { sessionID: string, directory: string | null }) => Promise<object | null>} deps.fetchSession
|
|
10
|
+
* @param {(session: object) => object | null | undefined} deps.projectSession
|
|
11
|
+
* Host authority projection; `null` means Host metadata is unavailable.
|
|
12
|
+
* @param {() => void} deps.onChanged
|
|
13
|
+
* @param {(message: string, error?: unknown) => void} [deps.warn]
|
|
14
|
+
*/
|
|
15
|
+
export const createUnindexedSessionAdopter = ({
|
|
16
|
+
service,
|
|
17
|
+
fetchSession,
|
|
18
|
+
projectSession,
|
|
19
|
+
onChanged,
|
|
20
|
+
warn = console.warn,
|
|
21
|
+
}) => {
|
|
22
|
+
const inFlight = new Set();
|
|
23
|
+
|
|
24
|
+
return (sessionID, directory, activityAt) => {
|
|
25
|
+
if (inFlight.has(sessionID)) return;
|
|
26
|
+
inFlight.add(sessionID);
|
|
27
|
+
void (async () => {
|
|
28
|
+
try {
|
|
29
|
+
const upstream = await fetchSession({ sessionID, directory: directory || null });
|
|
30
|
+
if (!upstream || service.findBySessionId(sessionID)) return;
|
|
31
|
+
const projected = projectSession(upstream);
|
|
32
|
+
if (projected == null) return;
|
|
33
|
+
// The user message is newer than a possibly stale upstream clock; without
|
|
34
|
+
// this the newest-20 retention bound would refuse the row.
|
|
35
|
+
const time = { ...projected.time, updated: Math.max(Number(projected.time?.updated) || 0, activityAt) };
|
|
36
|
+
const upserted = service.upsertAndReportChange({ ...projected, time }, Date.now());
|
|
37
|
+
const touched = service.touchActivity(sessionID, activityAt);
|
|
38
|
+
if (upserted || touched) onChanged();
|
|
39
|
+
} catch (error) {
|
|
40
|
+
warn('[session-index] adopting an unindexed session failed:', error?.message ?? error);
|
|
41
|
+
} finally {
|
|
42
|
+
inFlight.delete(sessionID);
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
};
|
|
46
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
|
2
|
+
import { createUnindexedSessionAdopter } from './adopt-unindexed-session.js';
|
|
3
|
+
|
|
4
|
+
const flush = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
5
|
+
|
|
6
|
+
const setup = (overrides = {}) => {
|
|
7
|
+
const service = {
|
|
8
|
+
findBySessionId: vi.fn(() => null),
|
|
9
|
+
upsertAndReportChange: vi.fn(() => true),
|
|
10
|
+
touchActivity: vi.fn(() => true),
|
|
11
|
+
};
|
|
12
|
+
const deps = {
|
|
13
|
+
service,
|
|
14
|
+
fetchSession: vi.fn(async () => ({ id: 'ses_old', directory: '/repo', time: { created: 1, updated: 2 } })),
|
|
15
|
+
projectSession: vi.fn((session) => ({ ...session, projected: true })),
|
|
16
|
+
onChanged: vi.fn(),
|
|
17
|
+
warn: vi.fn(),
|
|
18
|
+
...overrides,
|
|
19
|
+
};
|
|
20
|
+
return { service, deps, adopt: createUnindexedSessionAdopter(deps) };
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe('createUnindexedSessionAdopter', () => {
|
|
24
|
+
it('writes the projected upstream session and advances activity to the user message', async () => {
|
|
25
|
+
const { service, deps, adopt } = setup();
|
|
26
|
+
adopt('ses_old', '/repo', 900);
|
|
27
|
+
await flush();
|
|
28
|
+
expect(deps.fetchSession).toHaveBeenCalledWith({ sessionID: 'ses_old', directory: '/repo' });
|
|
29
|
+
expect(service.upsertAndReportChange).toHaveBeenCalledWith(
|
|
30
|
+
expect.objectContaining({ id: 'ses_old', projected: true, time: { created: 1, updated: 900 } }),
|
|
31
|
+
expect.any(Number),
|
|
32
|
+
);
|
|
33
|
+
expect(service.touchActivity).toHaveBeenCalledWith('ses_old', 900);
|
|
34
|
+
expect(deps.onChanged).toHaveBeenCalledTimes(1);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('coalesces a burst of messages into one upstream read', async () => {
|
|
38
|
+
const { deps, adopt } = setup();
|
|
39
|
+
adopt('ses_old', '', 1);
|
|
40
|
+
adopt('ses_old', '', 2);
|
|
41
|
+
await flush();
|
|
42
|
+
expect(deps.fetchSession).toHaveBeenCalledTimes(1);
|
|
43
|
+
expect(deps.fetchSession).toHaveBeenCalledWith({ sessionID: 'ses_old', directory: null });
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
it('writes nothing when Host metadata is unavailable or the session is missing upstream', async () => {
|
|
47
|
+
const unavailable = setup({ projectSession: vi.fn(() => null) });
|
|
48
|
+
unavailable.adopt('ses_old', '/repo', 1);
|
|
49
|
+
const missing = setup({ fetchSession: vi.fn(async () => null) });
|
|
50
|
+
missing.adopt('ses_old', '/repo', 1);
|
|
51
|
+
await flush();
|
|
52
|
+
expect(unavailable.service.upsertAndReportChange).not.toHaveBeenCalled();
|
|
53
|
+
expect(missing.service.upsertAndReportChange).not.toHaveBeenCalled();
|
|
54
|
+
expect(unavailable.deps.onChanged).not.toHaveBeenCalled();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
it('keeps a live-written row instead of overwriting it with the upstream read', async () => {
|
|
58
|
+
const { service, adopt } = setup();
|
|
59
|
+
service.findBySessionId.mockReturnValue({ id: 'ses_old' });
|
|
60
|
+
adopt('ses_old', '/repo', 1);
|
|
61
|
+
await flush();
|
|
62
|
+
expect(service.upsertAndReportChange).not.toHaveBeenCalled();
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it('reports a failed fetch and allows a later message to retry', async () => {
|
|
66
|
+
const fetchSession = vi.fn()
|
|
67
|
+
.mockRejectedValueOnce(new Error('offline'))
|
|
68
|
+
.mockResolvedValueOnce({ id: 'ses_old', directory: '/repo', time: {} });
|
|
69
|
+
const { service, deps, adopt } = setup({ fetchSession });
|
|
70
|
+
adopt('ses_old', '/repo', 1);
|
|
71
|
+
await flush();
|
|
72
|
+
expect(deps.warn).toHaveBeenCalledTimes(1);
|
|
73
|
+
adopt('ses_old', '/repo', 2);
|
|
74
|
+
await flush();
|
|
75
|
+
expect(service.upsertAndReportChange).toHaveBeenCalledTimes(1);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
@@ -26,6 +26,9 @@ const withDirectory = (session, directory) => {
|
|
|
26
26
|
* @param {(sessionID: string) => void | Promise<void>} [options.onSessionDeleted]
|
|
27
27
|
* @param {() => boolean} [options.isHostReady]
|
|
28
28
|
* When false, session lifecycle upserts are skipped until metadata is ready.
|
|
29
|
+
* @param {(sessionID: string, directory: string, activityAt: number) => void} [options.onUnindexedUserActivity]
|
|
30
|
+
* Called when a user message targets a session the index does not hold (an old
|
|
31
|
+
* session outside the newest-20 window); the owner adopts it asynchronously.
|
|
29
32
|
*/
|
|
30
33
|
export const applySessionIndexEvent = (service, event, observedAt = Date.now(), options = {}) => {
|
|
31
34
|
if (!service || !event || typeof event !== 'object') return false;
|
|
@@ -35,6 +38,9 @@ export const applySessionIndexEvent = (service, event, observedAt = Date.now(),
|
|
|
35
38
|
const projectSession = typeof options.projectSession === 'function' ? options.projectSession : null;
|
|
36
39
|
const onSessionDeleted = typeof options.onSessionDeleted === 'function' ? options.onSessionDeleted : null;
|
|
37
40
|
const isHostReady = typeof options.isHostReady === 'function' ? options.isHostReady : null;
|
|
41
|
+
const onUnindexedUserActivity = typeof options.onUnindexedUserActivity === 'function'
|
|
42
|
+
? options.onUnindexedUserActivity
|
|
43
|
+
: null;
|
|
38
44
|
|
|
39
45
|
const baseType = normalizeSessionEventType(payload.type);
|
|
40
46
|
|
|
@@ -127,14 +133,21 @@ export const applySessionIndexEvent = (service, event, observedAt = Date.now(),
|
|
|
127
133
|
const activityAt = typeof info.time?.created === 'number' ? info.time.created : observedAt;
|
|
128
134
|
const activityChanged = service.touchActivity(info.sessionID, activityAt);
|
|
129
135
|
const settleCleared = service.clearSettleOverride?.(info.sessionID) ?? false;
|
|
136
|
+
if (!activityChanged && onUnindexedUserActivity && !service.findBySessionId?.(info.sessionID)) {
|
|
137
|
+
onUnindexedUserActivity(info.sessionID, directory, activityAt);
|
|
138
|
+
}
|
|
130
139
|
return activityChanged || settleCleared;
|
|
131
140
|
}
|
|
132
141
|
|
|
133
142
|
if (baseType === 'session.inbox.enqueued') {
|
|
134
143
|
const data = payload.data ?? properties;
|
|
135
144
|
if (data.item?.type !== 'user' || typeof data.sessionID !== 'string') return false;
|
|
136
|
-
const
|
|
145
|
+
const activityAt = data.item.time?.created ?? payload.created ?? observedAt;
|
|
146
|
+
const activityChanged = service.touchActivity(data.sessionID, activityAt);
|
|
137
147
|
const settleCleared = service.clearSettleOverride?.(data.sessionID) ?? false;
|
|
148
|
+
if (!activityChanged && onUnindexedUserActivity && !service.findBySessionId?.(data.sessionID)) {
|
|
149
|
+
onUnindexedUserActivity(data.sessionID, directory, activityAt);
|
|
150
|
+
}
|
|
138
151
|
return activityChanged || settleCleared;
|
|
139
152
|
}
|
|
140
153
|
|
|
@@ -61,6 +61,24 @@ describe('session index event ingest', () => {
|
|
|
61
61
|
expect(applySessionIndexEvent(service, { payload: { type: 'session.idle', properties: { sessionID: 'ses_a' } } }, 30)).toBe(false);
|
|
62
62
|
expect(service.clearSettleOverride).not.toHaveBeenCalled();
|
|
63
63
|
});
|
|
64
|
+
it('hands user input for a session the index does not hold to the adopter, once per event', () => {
|
|
65
|
+
const adopt = vi.fn();
|
|
66
|
+
const service = { touchActivity: vi.fn(() => false), findBySessionId: vi.fn(() => null), clearSettleOverride: vi.fn(() => false) };
|
|
67
|
+
const user = { directory: '/repo', payload: { type: 'message.updated', properties: { info: { role: 'user', sessionID: 'ses_old', time: { created: 5 } } } } };
|
|
68
|
+
applySessionIndexEvent(service, user, 30, { onUnindexedUserActivity: adopt });
|
|
69
|
+
expect(adopt).toHaveBeenCalledWith('ses_old', '/repo', 5);
|
|
70
|
+
adopt.mockClear();
|
|
71
|
+
applySessionIndexEvent(service, { directory: '/repo', payload: { type: 'session.inbox.enqueued', data: { sessionID: 'ses_old', item: { type: 'user', time: { created: 7 } } } } }, 30, { onUnindexedUserActivity: adopt });
|
|
72
|
+
expect(adopt).toHaveBeenCalledWith('ses_old', '/repo', 7);
|
|
73
|
+
});
|
|
74
|
+
it('does not adopt a session the index already holds, or assistant messages', () => {
|
|
75
|
+
const adopt = vi.fn();
|
|
76
|
+
const service = { touchActivity: vi.fn(() => false), findBySessionId: vi.fn(() => ({ id: 'ses_held' })), clearSettleOverride: vi.fn(() => false) };
|
|
77
|
+
const user = { payload: { type: 'message.updated', properties: { info: { role: 'user', sessionID: 'ses_held', time: { created: 5 } } } } };
|
|
78
|
+
applySessionIndexEvent(service, user, 30, { onUnindexedUserActivity: adopt });
|
|
79
|
+
applySessionIndexEvent({ ...service, findBySessionId: () => null }, { payload: { type: 'message.updated', properties: { info: { role: 'assistant', sessionID: 'ses_old' } } } }, 30, { onUnindexedUserActivity: adopt });
|
|
80
|
+
expect(adopt).not.toHaveBeenCalled();
|
|
81
|
+
});
|
|
64
82
|
it('takes moved ownership from native data rather than the old event envelope directory', () => {
|
|
65
83
|
const service = { move: vi.fn(() => true) };
|
|
66
84
|
expect(applySessionIndexEvent(service, { directory: '/old', payload: {
|