@yuriai/web 0.3.4 → 0.3.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-CNOu_vy0.js +1 -0
- package/dist/assets/AgentSelector-K5JSbXv3.js +1 -0
- package/dist/assets/ArchivedSessionsDialog-CU9RXl8K.js +1 -0
- package/dist/assets/AssistantConversationSurface-u3ndSmZP.js +3 -0
- package/dist/assets/AssistantSessionCard-MYBAni6A.js +2 -0
- package/dist/assets/AssistantUnreadBadge-opyLZlZd.js +1 -0
- package/dist/assets/AssistantView-CDPTtrUZ.js +1 -0
- package/dist/assets/AssistantWorkingAvatar-Vghb8xlt.js +1 -0
- package/dist/assets/AssistantsSettingsPage-Dt4OP3J-.js +1 -0
- package/dist/assets/BinaryFileFallback-CJqnlBzh.js +1 -0
- package/dist/assets/BtwPanel-DnMW6R43.js +6 -0
- package/dist/assets/BusyDots-FXSlMe2F.js +4 -0
- package/dist/assets/ChatContainer-Dg9uDBjk.js +65 -0
- package/dist/assets/ChatView-AFUNEBdD.js +3 -0
- package/dist/assets/{DiagramView-DGnmjS2b.js → DiagramView-j7aFp44v.js} +1 -1
- package/dist/assets/{DiffView-Bbit6OZ8.js → DiffView-DZ_gKyTO.js} +2 -2
- package/dist/assets/DiffViewToggle-DkxhEUhV.js +1 -0
- package/dist/assets/ErrorBoundary-CCH4LiRY.js +1 -0
- package/dist/assets/FadeInOnReveal-DO9PZrJL.js +1 -0
- package/dist/assets/{GuiPluginMount-TC5FELtQ.js → GuiPluginMount-BCqt2pmM.js} +1 -1
- package/dist/assets/GuiPluginPage-BSjWEmIu.js +1 -0
- package/dist/assets/GuiPluginSurface-B8QjacMd.js +1 -0
- package/dist/assets/GuiPluginTitlebarItems-DfHugxsx.js +1 -0
- package/dist/assets/{GuiPluginWindow-BkAFJyFd.js → GuiPluginWindow-CDycMqzT.js} +1 -1
- package/dist/assets/Icon-B-w2YKpn.js +1 -0
- package/dist/assets/ImageLoadingPlaceholder-DsgRtfYG.js +1 -0
- package/dist/assets/{LoadingImage-Df22Rkor.js → LoadingImage-B3IL7hnv.js} +1 -1
- package/dist/assets/MarkdownRenderer-CsEylQVj.js +2 -0
- package/dist/assets/{MarkdownRendererImpl-D8q0FMnr.js → MarkdownRendererImpl-CPgpkd9b.js} +1 -1
- package/dist/assets/MarkstreamRendererImpl-BzK1BO80.js +3 -0
- package/dist/assets/{MobileAssistantSettingsPage-Dgq5FMho.js → MobileAssistantSettingsPage-DVpE3b24.js} +1 -1
- package/dist/assets/MobileAssistantTab-BbccE67x.js +1 -0
- package/dist/assets/{MobileBtwPage-DQUkSO6N.js → MobileBtwPage-BRN1gAmR.js} +1 -1
- package/dist/assets/{MobileChangesSurface-DsYNmAuM.js → MobileChangesSurface-BwmSTxeh.js} +2 -2
- package/dist/assets/MobileChatScreen-Bf42GrQ8.js +1 -0
- package/dist/assets/MobileDetailNavigation-DKWnQoSh.js +1 -0
- package/dist/assets/MobileFilesSurface-qkfC06Oh.js +2 -0
- package/dist/assets/MobileHtmlNetworkBoundary-BKSYPR9N.js +2 -0
- package/dist/assets/MobileOverlayPanel-DcRWQlmf.js +1 -0
- package/dist/assets/MobileResizableSheet-CF3Pbot4.js +1 -0
- package/dist/assets/{MobileSettingsTab-DaTtRHo1.js → MobileSettingsTab-of6zpTsr.js} +1 -1
- package/dist/assets/{MobileShareBridge-CZpFYmiy.js → MobileShareBridge-CRq9F1rn.js} +1 -1
- package/dist/assets/MobileSurface-DGNomvlu.js +1 -0
- package/dist/assets/MobileTabPageHeader-0aJFe3_x.js +1 -0
- package/dist/assets/ModelLogo-D27dq-si.js +1 -0
- package/dist/assets/ModelSelector-Dg__8QLh.js +1 -0
- package/dist/assets/MultiRunWindow-COqSg1Nk.js +1 -0
- package/dist/assets/OnboardingScreen-DUNyDwc6.js +1 -0
- package/dist/assets/OverlayScrollbar-DS6XJ1HA.js +1 -0
- package/dist/assets/{PierreDiffViewer-DVKsdwJR.js → PierreDiffViewer-BHwj_6j8.js} +3 -3
- package/dist/assets/ProviderLogo-Cm9RNV_U.js +1 -0
- package/dist/assets/{RemoteAssistantSessionCard-DAoFvZht.js → RemoteAssistantSessionCard-DAjHRUrC.js} +1 -1
- package/dist/assets/RemoteDesktopPanel-Bays6pHh.js +1 -0
- package/dist/assets/ScheduledTasksDialog-DnwBC7cj.js +3 -0
- package/dist/assets/ScrollableOverlay-CkX-buJm.js +1 -0
- package/dist/assets/SettingsGroup-kZ_faXwL.js +1 -0
- package/dist/assets/{SettingsView-DEU94-h1.js → SettingsView-C62JngPE.js} +13 -13
- package/dist/assets/SettingsWindow-Cm8apHAR.js +1 -0
- package/dist/assets/SetupTourDialog-W_UeWH-i.js +1 -0
- package/dist/assets/{SyncActions-CrOoREWF.js → SyncActions-Blnq08ks.js} +1 -1
- package/dist/assets/TerminalView-CMugifkh.js +8 -0
- package/dist/assets/TextSelectionMenu-B2fIBlD3.js +11 -0
- package/dist/assets/{ToolOutputDialog-DpaaQ1uZ.js → ToolOutputDialog-DdSUE2kP.js} +1 -1
- package/dist/assets/{YuriLogo-Cp6vWDWp.js → YuriLogo-Ceon25sC.js} +1 -1
- package/dist/assets/{YuriWordmark-CLGHwobA.js → YuriWordmark-CW53XKgV.js} +1 -1
- package/dist/assets/{assistant-attachment-cache-bRIIESGe.js → assistant-attachment-cache-eNT2QtmP.js} +1 -1
- package/dist/assets/assistantMessagePreview-C7YAFen1.js +1 -0
- package/dist/assets/assistantQueries-DxvTFlpL.js +1 -0
- package/dist/assets/{auto-read-context-ClBUErN2.js → auto-read-context-Ce0o43YI.js} +1 -1
- package/dist/assets/{capgoAdapter-pfQJmvW2.js → capgoAdapter-DQwUA-Nt.js} +1 -1
- package/dist/assets/card-D44sTpdY.js +1 -0
- package/dist/assets/chatUpwardIntent-CnS7WWRL.js +1 -0
- package/dist/assets/checkbox-DaKe0Tlq.js +1 -0
- package/dist/assets/{client-B_907PBv.js → client-ITylDDCS.js} +1 -1
- package/dist/assets/collapsible-CL3SPnOf.js +1 -0
- package/dist/assets/{connection-hint-B-kOWome.js → connection-hint-SMNZFDAe.js} +1 -1
- package/dist/assets/context-menu-DZunhC8o.js +1 -0
- package/dist/assets/diagram-DFXqN638.js +1 -0
- package/dist/assets/dialog-CmjXOKMz.js +1 -0
- package/dist/assets/dropdown-menu-BT_66BFT.js +1 -0
- package/dist/assets/{fileMentionTouchSelection-BQEUty_A.js → fileMentionTouchSelection-B_62hIQI.js} +1 -1
- package/dist/assets/{gitApi-CoVwjIDy.js → gitApi-CBfYFgtd.js} +1 -1
- package/dist/assets/{gitApiHttp-Dd-FwgCq.js → gitApiHttp-Bswf6gnl.js} +1 -1
- package/dist/assets/githubAuthQueries-C5RxUNL2.js +1 -0
- package/dist/assets/historyImportQueries-CZsECryv.js +1 -0
- package/dist/assets/{host-ChBHl_Vl.js → host-C7jHgymK.js} +1 -1
- package/dist/assets/{i18n-DXc6czdR.js → i18n-Dojvs57M.js} +1 -1
- package/dist/assets/{icons-Bd-INsoy.js → icons-D_vRtitD.js} +1 -1
- package/dist/assets/{imageSource-BR4C9TuS.js → imageSource-Cq_p4gAe.js} +1 -1
- package/dist/assets/input-BllFKOjo.js +1 -0
- package/dist/assets/{input-store-BSJBQTMi.js → input-store-dLjM4aiu.js} +1 -1
- package/dist/assets/insertionBoundaries-Br0Bdl9R.js +1 -0
- package/dist/assets/kbd-CwkasrzN.js +1 -0
- package/dist/assets/main-B7wAfq9F.js +2 -0
- package/dist/assets/main-DVmi0I-y.js +169 -0
- package/dist/assets/{markdownHeightCache-CHGGNhWI.js → markdownHeightCache-RX04MAqu.js} +1 -1
- package/dist/assets/mcpQueries-qRW-HQMx.js +1 -0
- package/dist/assets/miniChat-D7-JQ1hw.js +2 -0
- package/dist/assets/mobile-BFQBDlo9.js +2 -0
- package/dist/assets/{mobileBackNavigation-C94n2eLT.js → mobileBackNavigation-DsDUTnFY.js} +1 -1
- package/dist/assets/mobileConnections-PVy2SsQ_.js +2 -0
- package/dist/assets/multirun-C2RRF2Q3.js +3 -0
- package/dist/assets/{native-config-DVg8_Zx1.js → native-config-Czc142JT.js} +1 -1
- package/dist/assets/{nativeComposerCover-Bhv1EKPT.js → nativeComposerCover-DzEGSyOO.js} +1 -1
- package/dist/assets/{navigation-D1klsD7k.js → navigation-C1v9hIAT.js} +2 -2
- package/dist/assets/openRemoteProjectSession-C5z2Juv7.js +1 -0
- package/dist/assets/pluginPresentation-p_0sXPMT.js +2 -0
- package/dist/assets/{project-preview-BCtFY4Rg.js → project-preview-BcLPKzwg.js} +1 -1
- package/dist/assets/{prompt-attachment-upload-B5DHrw6U.js → prompt-attachment-upload-BGppTOgV.js} +1 -1
- package/dist/assets/pwa-Br2HZksc.js +2 -0
- package/dist/assets/queue-abort-optimistic-DciJN9X1.js +1 -0
- package/dist/assets/{quota-CqWNkFzw.js → quota-2PwXAoIg.js} +1 -1
- package/dist/assets/{reference-history-IEuzG8KC.js → reference-history-BwtzPAmA.js} +1 -1
- package/dist/assets/{remote-input-store-C6UIEZxp.js → remote-input-store-DdjKfpxS.js} +1 -1
- package/dist/assets/remoteProjectQueries-BXrXdLjN.js +1 -0
- package/dist/assets/{remoteSessionReference-ex07CtrZ.js → remoteSessionReference-XfJOxItc.js} +1 -1
- package/dist/assets/renderElectronMiniChatApp-BekZAu-s.js +2 -0
- package/dist/assets/renderMobileApp-C5U2cyeq.js +17 -0
- package/dist/assets/{runtime-file-download-BWeoSXRb.js → runtime-file-download-1s2Al1t3.js} +1 -1
- package/dist/assets/runtime-file-resource-C5kmYlLv.js +6 -0
- package/dist/assets/{runtimeConfig-CyvlrO58.js → runtimeConfig-DzYIc49M.js} +1 -1
- package/dist/assets/runtimeEndpointReset-BKLVdNhJ.js +4 -0
- package/dist/assets/select-BOtGs1FV.js +1 -0
- package/dist/assets/{sessionLookup-DQOiycHr.js → sessionLookup-BTQ_AtWh.js} +1 -1
- package/dist/assets/sessionOwnership-BPfk1qCS.js +2 -0
- package/dist/assets/shortcuts-Cu4ioDvH.js +1 -0
- package/dist/assets/sortable-tabs-strip-DACGW9sB.js +1 -0
- package/dist/assets/speechSettingsQueries-BU-4Axb5.js +1 -0
- package/dist/assets/{src-QTj33Z0x.css → src-Dj147H4m.css} +1 -1
- package/dist/assets/{store-C1ifDY0C.js → store-DRUKTpV5.js} +1 -1
- package/dist/assets/switch-DaUn0G3u.js +1 -0
- package/dist/assets/{terminalApi-DXvEquBF.js → terminalApi-ClNhXBA8.js} +1 -1
- package/dist/assets/textarea-IhQHekYx.js +1 -0
- package/dist/assets/{timeFormat-dCsf2MQv.js → timeFormat-BsuUDWLs.js} +1 -1
- package/dist/assets/tooltip-Dw3DApa-.js +1 -0
- package/dist/assets/truncated-path-KHrfQ66P.js +1 -0
- package/dist/assets/{types-DpcA-uDW.js → types-BBBwzIOU.js} +1 -1
- package/dist/assets/ui-CHdferA1.js +13 -0
- package/dist/assets/{useAppFontEffects-rbTKcF0f.js → useAppFontEffects-Dw6o6XbA.js} +4 -4
- package/dist/assets/useDesktopWindowControlsLayout-DAkTdcAP.js +1 -0
- package/dist/assets/{useDictation-CZzAlsW0.js → useDictation-sdgDfATy.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-DiJBIfai.js → useEffectiveDirectory-DZqC-2HE.js} +1 -1
- package/dist/assets/{useFontPreferences-BiRBKhti.js → useFontPreferences-Bb-bxdL8.js} +1 -1
- package/dist/assets/{useGitStore-Bv8xmXDa.js → useGitStore-Bbmai549.js} +1 -1
- package/dist/assets/{useInlineCommentDraftStore-B2mkmAZd.js → useInlineCommentDraftStore-DrC99u6A.js} +1 -1
- package/dist/assets/useMcpConfigStore-ZsZxSrCt.js +1 -0
- package/dist/assets/useMobileSwipeActions-fUp7Bkbn.js +1 -0
- package/dist/assets/useMobileTranscriptSyncHint-B4izCfqe.js +10 -0
- package/dist/assets/useModelLists-B0qSYDby.js +1 -0
- package/dist/assets/useOpenCodeReadiness-B9d-wLZB.js +1 -0
- package/dist/assets/usePluginsStore-BLncdNj-.js +1 -0
- package/dist/assets/useProjectGitActions-CHMe1ku4.js +1 -0
- package/dist/assets/{useProjectGitStore-DzU2pvrH.js → useProjectGitStore-Lz9AV32V.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-tjGuODhu.js → useProjectRuntimeAPIs-D51dVo-V.js} +1 -1
- package/dist/assets/useQuotaStore-mZs9LTwx.js +1 -0
- package/dist/assets/{useSessionBtwStore-CwvlMabN.js → useSessionBtwStore-CYaTDkvT.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-C9SaKeil.js → useStreamingTextThrottle-ul6e3dUd.js} +1 -1
- package/dist/assets/worktreeManager-V6hoSVxH.js +1 -0
- package/dist/assets/{worktreeSourceBranchPreference-CuLKwxkx.js → worktreeSourceBranchPreference-MQFPkOZy.js} +1 -1
- package/dist/index.html +12 -13
- package/dist/mini-chat.html +12 -13
- package/dist/mobile.html +2 -2
- package/package.json +1 -1
- package/server/index.js +1 -0
- package/server/lib/gui-customization/DOCUMENTATION.md +22 -1
- package/server/lib/gui-customization/projects-client.mjs +14 -3
- package/server/lib/gui-customization/projects-lifecycle.js +89 -0
- package/server/lib/gui-customization/projects-lifecycle.test.js +199 -0
- package/server/lib/gui-customization/projects.js +19 -3
- package/server/lib/gui-customization/projects.test.js +6 -0
- package/server/lib/gui-customization/session-skill.js +2 -2
- package/server/lib/gui-customization/session-skill.test.js +6 -0
- package/server/lib/gui-customization/skill/SKILL.md +3 -1
- package/server/lib/gui-customization/skill/references/projects.md +30 -0
- package/server/lib/opencode/feature-routes-runtime.js +5 -0
- package/server/lib/opencode/feature-routes-runtime.test.js +6 -0
- package/dist/assets/AgentAvatar-CHCjMxCF.js +0 -1
- package/dist/assets/AgentSelector-uBoLtut8.js +0 -1
- package/dist/assets/ArchivedSessionsDialog-DZcicxVO.js +0 -1
- package/dist/assets/AssistantConversationSurface-36aP0hRf.js +0 -3
- package/dist/assets/AssistantSessionCard-CZ-1oJiE.js +0 -2
- package/dist/assets/AssistantUnreadBadge-p9mkpbMC.js +0 -1
- package/dist/assets/AssistantView-8fyAae7J.js +0 -1
- package/dist/assets/AssistantWorkingAvatar-CoxhuMvM.js +0 -1
- package/dist/assets/AssistantsSettingsPage-DD6spbXz.js +0 -1
- package/dist/assets/BinaryFileFallback-DgYaMG9f.js +0 -1
- package/dist/assets/BtwPanel-BkobGcf3.js +0 -6
- package/dist/assets/BusyDots-COTTwItx.js +0 -4
- package/dist/assets/ChatContainer-BfQ7RXwY.js +0 -65
- package/dist/assets/ChatView-ByMRjY1h.js +0 -3
- package/dist/assets/DiffViewToggle-BwJ6MYB7.js +0 -1
- package/dist/assets/ErrorBoundary-D7QcwhmL.js +0 -1
- package/dist/assets/FadeInOnReveal-B3uT04YJ.js +0 -1
- package/dist/assets/GuiPluginPage-BPjU8N49.js +0 -1
- package/dist/assets/GuiPluginSurface-CYPH6XzX.js +0 -1
- package/dist/assets/GuiPluginTitlebarItems-DxFINwbr.js +0 -1
- package/dist/assets/Icon-DmykXZL1.js +0 -1
- package/dist/assets/ImageLoadingPlaceholder-DgM_EFHn.js +0 -1
- package/dist/assets/MarkdownRenderer-VvziwyJB.js +0 -2
- package/dist/assets/MarkstreamRendererImpl-U_m_ZKG7.js +0 -3
- package/dist/assets/MobileAssistantTab-CMIQansR.js +0 -1
- package/dist/assets/MobileChatScreen-p356_BCN.js +0 -1
- package/dist/assets/MobileDetailNavigation-ldTzGo19.js +0 -1
- package/dist/assets/MobileFilesSurface-CF3EW_SK.js +0 -2
- package/dist/assets/MobileHtmlNetworkBoundary-DlPF4iPS.js +0 -2
- package/dist/assets/MobileOverlayPanel-C36VWWmN.js +0 -1
- package/dist/assets/MobileResizableSheet-CqphcaKq.js +0 -1
- package/dist/assets/MobileSurface-cmaGf3hZ.js +0 -1
- package/dist/assets/MobileTabPageHeader-D6P4K98S.js +0 -1
- package/dist/assets/ModelLogo-BkbD514M.js +0 -1
- package/dist/assets/ModelSelector-EmtltPnd.js +0 -1
- package/dist/assets/MultiRunWindow-CeSxAB8w.js +0 -1
- package/dist/assets/OnboardingScreen-BubjTNcy.js +0 -1
- package/dist/assets/OverlayScrollbar-D6vmoMkQ.js +0 -1
- package/dist/assets/ProviderLogo-DA98yu7M.js +0 -1
- package/dist/assets/RemoteDesktopPanel-f3vRj4ZP.js +0 -1
- package/dist/assets/ScheduledTasksDialog-D_hBP47Y.js +0 -3
- package/dist/assets/ScrollableOverlay-stxT7gLf.js +0 -1
- package/dist/assets/SettingsGroup-CvaPYznp.js +0 -1
- package/dist/assets/SettingsWindow-DMVAV_el.js +0 -1
- package/dist/assets/SetupTourDialog-BlR7FJvd.js +0 -1
- package/dist/assets/TerminalView-Xcwp3SG1.js +0 -8
- package/dist/assets/TextSelectionMenu-h8iUeNzE.js +0 -11
- package/dist/assets/assistantMessagePreview-DLBvPQtq.js +0 -1
- package/dist/assets/assistantQueries-NdPqu6rx.js +0 -1
- package/dist/assets/card-DmysoUAV.js +0 -1
- package/dist/assets/chatUpwardIntent-B2NrGMm-.js +0 -1
- package/dist/assets/checkbox-BMN5hAVm.js +0 -1
- package/dist/assets/collapsible-Z0IjDAMO.js +0 -1
- package/dist/assets/context-menu-CKlB6wxo.js +0 -1
- package/dist/assets/diagram-CzY6n_4N.js +0 -1
- package/dist/assets/dialog-BeFBA6ja.js +0 -1
- package/dist/assets/dropdown-menu-BblI9sN2.js +0 -1
- package/dist/assets/githubAuthQueries-DqregESf.js +0 -1
- package/dist/assets/historyImportQueries-D00KjUT2.js +0 -1
- package/dist/assets/input-Cf16qJ6g.js +0 -1
- package/dist/assets/insertionBoundaries-Btqgsu1M.js +0 -1
- package/dist/assets/kbd-CamdaxHJ.js +0 -1
- package/dist/assets/main-CXH2hObl.js +0 -169
- package/dist/assets/main-ClH7cLKr.js +0 -2
- package/dist/assets/mcpQueries-Rmp1BKeo.js +0 -1
- package/dist/assets/miniChat-B_Bw6udu.js +0 -2
- package/dist/assets/mobile-BR73yoNi.js +0 -2
- package/dist/assets/mobileConnections-x07fHO_5.js +0 -2
- package/dist/assets/multirun-CKQymP08.js +0 -3
- package/dist/assets/openRemoteProjectSession-DNr74gHD.js +0 -1
- package/dist/assets/pluginPresentation-DtyC8NF2.js +0 -2
- package/dist/assets/pwa-CtDladgB.js +0 -2
- package/dist/assets/queue-abort-optimistic-DFbWDRKT.js +0 -1
- package/dist/assets/remoteProjectQueries-C8382jM8.js +0 -1
- package/dist/assets/renderElectronMiniChatApp-DM9y9qXo.js +0 -2
- package/dist/assets/renderMobileApp-DqpPYtZI.js +0 -17
- package/dist/assets/runtime-file-resource-Bc_ss-sW.js +0 -2
- package/dist/assets/runtimeEndpointReset-C0zNrsI9.js +0 -4
- package/dist/assets/select-vZCgcnYG.js +0 -1
- package/dist/assets/session-startup-barrier-DT-hIBRf.js +0 -1
- package/dist/assets/sessionOwnership-BjhXe6pi.js +0 -2
- package/dist/assets/shortcuts-WkN3Gh8v.js +0 -1
- package/dist/assets/sortable-tabs-strip-DmtfYPz0.js +0 -1
- package/dist/assets/speechSettingsQueries-BmkXNn4w.js +0 -1
- package/dist/assets/switch-CNmsFYfY.js +0 -1
- package/dist/assets/textarea-ZiXxEOHK.js +0 -1
- package/dist/assets/tooltip-CpTbxEOE.js +0 -1
- package/dist/assets/truncated-path-CcmWjgCQ.js +0 -1
- package/dist/assets/ui-ee2iN869.js +0 -13
- package/dist/assets/useDesktopWindowControlsLayout-BOkRz-p9.js +0 -1
- package/dist/assets/useMcpConfigStore-DKTl0PvE.js +0 -1
- package/dist/assets/useMobileSwipeActions-XoxrtaUo.js +0 -1
- package/dist/assets/useMobileTranscriptSyncHint-DM8WG7kz.js +0 -10
- package/dist/assets/useModelLists-Bf60FIJu.js +0 -1
- package/dist/assets/useOpenCodeReadiness-Dm6BjA1T.js +0 -1
- package/dist/assets/usePluginsStore-Du4WlceO.js +0 -1
- package/dist/assets/useProjectGitActions-D3B9ma9z.js +0 -1
- package/dist/assets/useQuotaStore-CSn2pk3T.js +0 -1
- package/dist/assets/worktreeManager-DGu8M01Z.js +0 -1
- package/dist/assets/yuriEvents-BFrD5fMU.js +0 -5
|
@@ -29,7 +29,7 @@ their immutable staged references until a new session is admitted. Contacts use
|
|
|
29
29
|
their own granted `yuri.projects` tools, not this session binding.
|
|
30
30
|
|
|
31
31
|
`projects.js` owns `POST /api/yuri/session-skills/projects` (`describe`, `list`,
|
|
32
|
-
`add`, `remote-hosts`, `add-remote`, `remote-projects`, `sessions`, `read-session`, `create-session`, `prompt-session`). `projects-remote.js` uses the injected `remoteHostGateway` and its immutable task leases; discovery returns authenticated `{hubId,hostId,instanceId}` targets, and explicit targets never fall back to local. `remote-hosts` includes authorized machines with no associated project, reports per-machine failures and releases each probe. `add-remote` uses `gateway.registerProject`, shared with the UI: the target validates/canonicalizes and registers the directory before the Hub saves a deduplicated reference and broadcasts project-order invalidation. A Hub write failure leaves the remote project intact; retrying the same target/path completes association. Paths are never resolved on the Hub filesystem. Lease cleanup runs on every outcome. Remote SDK requests preserve generated request data through the lease; bounded message reads use the existing Host turn-page route. No remote bodies are persisted on Hub. Session creation/prompt require stable caller IDs for ambiguous-result inspection, not automatic replay. This capability neither uses nor grants the desktop SSH helper. The global gate and route require the existing loopback service credential,
|
|
32
|
+
`add`, `task-sessions`, `session-state`, `settle-session`, `unsettle-session`, `archive-session`, `unarchive-session`, `remote-hosts`, `add-remote`, `remote-projects`, `sessions`, `read-session`, `create-session`, `prompt-session`). `projects-remote.js` uses the injected `remoteHostGateway` and its immutable task leases; discovery returns authenticated `{hubId,hostId,instanceId}` targets, and explicit targets never fall back to local. `remote-hosts` includes authorized machines with no associated project, reports per-machine failures and releases each probe. `add-remote` uses `gateway.registerProject`, shared with the UI: the target validates/canonicalizes and registers the directory before the Hub saves a deduplicated reference and broadcasts project-order invalidation. A Hub write failure leaves the remote project intact; retrying the same target/path completes association. Paths are never resolved on the Hub filesystem. Lease cleanup runs on every outcome. Remote SDK requests preserve generated request data through the lease; bounded message reads use the existing Host turn-page route. No remote bodies are persisted on Hub. Session creation/prompt require stable caller IDs for ambiguous-result inspection, not automatic replay. This capability neither uses nor grants the desktop SSH helper. The global gate and route require the existing loopback service credential,
|
|
33
33
|
no browser Origin, shared-service ownership and the session's admitted Host origin.
|
|
34
34
|
The bridge reuses `projects/registry.js`, just like the UI directory API and contact
|
|
35
35
|
tools: strict reads, canonical path deduplication, serialized persistence and
|
|
@@ -46,6 +46,22 @@ client waits five seconds longer for the result). Caller disconnect cancels and
|
|
|
46
46
|
releases the task lease; uncertain writes are inspected by their stable IDs before
|
|
47
47
|
any retry.
|
|
48
48
|
|
|
49
|
+
`projects-lifecycle.js` owns bound-Host task/session archive operations.
|
|
50
|
+
`task-sessions` pages the current index metadata (50 rows), using the same committed
|
|
51
|
+
Host archive filter as the UI; it explicitly distinguishes an exhausted index from
|
|
52
|
+
complete upstream history. It exposes no messages or raw metadata.
|
|
53
|
+
Verification uses `session-state`, which exposes Host archive authority even after
|
|
54
|
+
an archived row leaves the index; nullable task fields do not imply live membership.
|
|
55
|
+
Task archive (`settle-session`) and restore (`unsettle-session`) reuse index writers and the normal
|
|
56
|
+
revision publisher, validating existing membership before writing. Session archive
|
|
57
|
+
and restore reuse `sessionArchiveService.setArchive`, including partial index-repair
|
|
58
|
+
receipts and sanitized errors. Neither path needs a UI password, deletes content,
|
|
59
|
+
changes another runtime partition or bypasses the existing session binding.
|
|
60
|
+
Task projection is not live UI membership: pins and running/pending requests retain
|
|
61
|
+
their existing precedence. Remote targets are rejected by these local operations.
|
|
62
|
+
New admitted sessions get the updated fingerprinted skill and helper after the Host
|
|
63
|
+
is upgraded; existing staged helpers remain immutable, not silently overwritten.
|
|
64
|
+
|
|
49
65
|
`references/plugin-styles.md` inventories existing host CSS variables for plugin-owned
|
|
50
66
|
Solid/DOM content, including colors, typography, geometry, controls and optional
|
|
51
67
|
theme config. The workflow routes every plugin view through this reference. Visual
|
|
@@ -141,6 +157,11 @@ sessions across backend upgrades.
|
|
|
141
157
|
`projects.test.js` exercises project bridge validation, authentication, binding,
|
|
142
158
|
persisted idempotent registration and failure receipts. Shared-service admission
|
|
143
159
|
tests execute the exact staged project helper through the real global auth gate.
|
|
160
|
+
`projects-lifecycle.test.js` executes the staged lifecycle commands through that
|
|
161
|
+
gate with UI password protection enabled, real temporary SQLite/metadata stores
|
|
162
|
+
and the existing archive service. It verifies discovery/pagination, settle and
|
|
163
|
+
archive round trips, missing IDs, binding/runtime rejection, write/read failures,
|
|
164
|
+
revision publication and sanitized partial-repair receipts without production data.
|
|
144
165
|
`session-skill.test.js` exercises staging, complete resource availability, short
|
|
145
166
|
per-session pointers, managed admission/rollback/adopted sessions and external
|
|
146
167
|
ownership. Shared-service admission is covered by
|
|
@@ -8,7 +8,8 @@ async function main() {
|
|
|
8
8
|
try {
|
|
9
9
|
const [encoded, operation] = process.argv.slice(2);
|
|
10
10
|
const binding = JSON.parse(Buffer.from(encoded, 'base64url').toString());
|
|
11
|
-
const
|
|
11
|
+
const lifecycle = ['task-sessions', 'session-state', 'settle-session', 'unsettle-session', 'archive-session', 'unarchive-session'];
|
|
12
|
+
const operations = ['list', 'add', ...lifecycle, 'remote-hosts', 'add-remote', 'remote-projects', 'sessions', 'read-session', 'create-session', 'prompt-session'];
|
|
12
13
|
if (!['describe', ...operations].includes(operation)) throw new Error();
|
|
13
14
|
const origin = new URL(binding.hostOrigin);
|
|
14
15
|
if (origin.protocol !== 'http:' || !['127.0.0.1', '[::1]'].includes(origin.hostname) || origin.username || origin.password) throw new Error();
|
|
@@ -33,7 +34,7 @@ async function main() {
|
|
|
33
34
|
if (!response.ok) {
|
|
34
35
|
const terminal = [401, 403, 501].includes(response.status);
|
|
35
36
|
console.error(JSON.stringify({ error: 'Project API operation failed', status: response.status, terminal,
|
|
36
|
-
...(['invalid_input', 'validation_error', 'project_unavailable', 'project_operation_failed', 'remote_unavailable', 'remote_target_mismatch', 'remote_response_invalid'].includes(result?.code) ? { code: result.code } : {}),
|
|
37
|
+
...(['invalid_input', 'session_not_found', 'session_archived', 'session_operation_failed', 'not_found', 'directory_mismatch', 'validation_error', 'project_unavailable', 'project_operation_failed', 'remote_unavailable', 'remote_target_mismatch', 'remote_response_invalid'].includes(result?.code) ? { code: result.code } : {}),
|
|
37
38
|
recovery: terminal ? 'Stop this workflow; resume only with a new supported session and its bound project describe command.'
|
|
38
39
|
: 'Result not confirmed. Inspect the same target before retrying; retain sessionID/messageID for interrupted writes. Never switch to local or claim success from a failed request.',
|
|
39
40
|
}));
|
|
@@ -43,9 +44,19 @@ async function main() {
|
|
|
43
44
|
if (['add', 'add-remote'].includes(operation) && (typeof result.project?.id !== 'string' || typeof result.project?.path !== 'string' || typeof result.created !== 'boolean')) throw new Error();
|
|
44
45
|
if (operation === 'remote-hosts' && (!Array.isArray(result.hosts) || !Array.isArray(result.failed) || typeof result.complete !== 'boolean')) throw new Error();
|
|
45
46
|
if (operation === 'list' && !Array.isArray(result.projects)) throw new Error();
|
|
47
|
+
if (operation === 'task-sessions' && (!Array.isArray(result.sessions) || result.indexedOnly !== true
|
|
48
|
+
|| typeof result.historyComplete !== 'boolean' || (result.nextCursor !== null && typeof result.nextCursor !== 'string'))) throw new Error();
|
|
49
|
+
if (operation === 'session-state' && (result.sessionID !== input.sessionID || typeof result.indexed !== 'boolean'
|
|
50
|
+
|| !Number.isFinite(result.archivedAt) || (result.settled !== null && typeof result.settled !== 'boolean')
|
|
51
|
+
|| (result.pinned !== null && typeof result.pinned !== 'boolean'))) throw new Error();
|
|
52
|
+
if (['settle-session', 'unsettle-session'].includes(operation)
|
|
53
|
+
&& (result.sessionID !== input.sessionID || result.settled !== (operation === 'settle-session'))) throw new Error();
|
|
54
|
+
if (['archive-session', 'unarchive-session'].includes(operation)
|
|
55
|
+
&& (result.sessionID !== input.sessionID || result.archived !== (operation === 'archive-session')
|
|
56
|
+
|| !Number.isFinite(result.archivedAt) || (result.archivedAt > 0) !== result.archived)) throw new Error();
|
|
46
57
|
if (operation === 'describe' && result.supported !== true) throw new Error();
|
|
47
58
|
console.log(JSON.stringify(operation === 'describe' ? { ...result,
|
|
48
|
-
commands: Object.fromEntries(operations.filter((op) => result.remoteSupported || ['list', 'add'].includes(op)).map((op) => [op, sessionSkillCommand(process.execPath, process.argv[1], encoded, op)])),
|
|
59
|
+
commands: Object.fromEntries(operations.filter((op) => (lifecycle.includes(op) ? result.lifecycleSupported : result.remoteSupported || ['list', 'add'].includes(op))).map((op) => [op, sessionSkillCommand(process.execPath, process.argv[1], encoded, op)])),
|
|
49
60
|
} : result));
|
|
50
61
|
} catch {
|
|
51
62
|
console.error(JSON.stringify({ error: 'Bound project helper failed; the result is unconfirmed', terminal: !bound,
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import path from 'node:path';
|
|
2
|
+
import { applyHostArchiveToIndexSnapshot } from '../session-index/host-authority-snapshot.js';
|
|
3
|
+
|
|
4
|
+
export const lifecycleOperations = ['task-sessions', 'session-state', 'settle-session', 'unsettle-session', 'archive-session', 'unarchive-session'];
|
|
5
|
+
|
|
6
|
+
export function validLifecycleInput(operation, input) {
|
|
7
|
+
if (!input || typeof input !== 'object' || Array.isArray(input)) return false;
|
|
8
|
+
const allowed = operation === 'task-sessions' ? ['directory', 'cursor']
|
|
9
|
+
: ['archive-session', 'unarchive-session'].includes(operation) ? ['sessionID', 'directory'] : ['sessionID'];
|
|
10
|
+
if (Object.entries(input).some(([key, value]) => !allowed.includes(key)
|
|
11
|
+
|| typeof value !== 'string' || !value.trim() || value.length > 4096 || /[\x00-\x1f]/.test(value))) return false;
|
|
12
|
+
if (input.directory !== undefined && !path.isAbsolute(input.directory)) return false;
|
|
13
|
+
if (operation === 'task-sessions') return input.cursor === undefined || /^(0|[1-9]\d{0,8})$/.test(input.cursor);
|
|
14
|
+
return typeof input.sessionID === 'string' && /^ses[A-Za-z0-9_]+$/.test(input.sessionID) && input.sessionID.length <= 256;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const unavailable = () => Object.assign(new Error('Session lifecycle unavailable'), { code: 'unsupported', status: 501 });
|
|
18
|
+
const notFound = () => Object.assign(new Error('Session not found'), { code: 'session_not_found', status: 404 });
|
|
19
|
+
|
|
20
|
+
/** Reuse the same index, Host archive authority and revision publisher as the UI. */
|
|
21
|
+
export function createProjectSessionLifecycle({ sessionIndexService, sessionArchiveService, publishSessionIndexChange, sessionMetadataStore }) {
|
|
22
|
+
if (!sessionIndexService || !sessionArchiveService || !sessionMetadataStore) return null;
|
|
23
|
+
const snapshot = async () => {
|
|
24
|
+
const stored = await sessionMetadataStore.getAll();
|
|
25
|
+
if (!stored || typeof stored !== 'object' || Array.isArray(stored)) throw new Error('Session metadata unavailable');
|
|
26
|
+
return applyHostArchiveToIndexSnapshot(sessionIndexService.snapshot(), stored);
|
|
27
|
+
};
|
|
28
|
+
return async (operation, input) => {
|
|
29
|
+
if (operation === 'task-sessions') {
|
|
30
|
+
const { directories, pinnedSessionIds = [] } = await snapshot();
|
|
31
|
+
const scoped = directories.filter((item) => !input.directory || item.directory === input.directory);
|
|
32
|
+
const pins = new Set(pinnedSessionIds);
|
|
33
|
+
const rows = scoped.flatMap((item) => item.sessions)
|
|
34
|
+
.filter((session) => !session.parentID)
|
|
35
|
+
.map((session) => ({
|
|
36
|
+
sessionID: session.id, directory: session.directory, title: session.title,
|
|
37
|
+
settled: Number(session.time?.settled ?? 0) > 0,
|
|
38
|
+
pinned: pins.has(session.id), activityUpdatedAt: session.metadata?.yuri?.titleRefresh?.activityUpdatedAt,
|
|
39
|
+
}));
|
|
40
|
+
const offset = Number(input.cursor ?? 0);
|
|
41
|
+
return {
|
|
42
|
+
sessions: rows.slice(offset, offset + 50),
|
|
43
|
+
nextCursor: offset + 50 < rows.length ? String(offset + 50) : null,
|
|
44
|
+
indexedOnly: true,
|
|
45
|
+
historyComplete: scoped.length > 0 && scoped.every((item) => item.lastFullSyncedAt > 0 && !item.hasMore),
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const sessionID = input.sessionID;
|
|
49
|
+
if (operation === 'session-state') {
|
|
50
|
+
const hit = sessionIndexService.findBySessionId(sessionID);
|
|
51
|
+
const stored = await sessionMetadataStore.get(sessionID);
|
|
52
|
+
const stamp = stored?.yuri?.archive?.archivedAt;
|
|
53
|
+
if (!hit && !Number.isFinite(stamp)) throw notFound();
|
|
54
|
+
const view = await snapshot();
|
|
55
|
+
const row = view.directories.flatMap((item) => item.sessions).find((item) => item.id === sessionID);
|
|
56
|
+
return {
|
|
57
|
+
sessionID, indexed: Boolean(row),
|
|
58
|
+
archivedAt: Number.isFinite(stamp) ? stamp : hit.archivedAt,
|
|
59
|
+
settled: row ? Number(row.time?.settled ?? 0) > 0 : null,
|
|
60
|
+
pinned: row ? view.pinnedSessionIds.includes(sessionID) : null,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
if (operation === 'settle-session' || operation === 'unsettle-session') {
|
|
64
|
+
const action = operation === 'settle-session' ? 'setSettled' : 'clearSettled';
|
|
65
|
+
if (typeof sessionIndexService[action] !== 'function') throw unavailable();
|
|
66
|
+
// The index writer accepts unknown IDs for pending state; this API confirms only existing sessions.
|
|
67
|
+
const hit = sessionIndexService.findBySessionId(sessionID);
|
|
68
|
+
if (!hit) throw notFound();
|
|
69
|
+
const stored = await sessionMetadataStore.get(sessionID);
|
|
70
|
+
if (Number(stored?.yuri?.archive?.archivedAt ?? hit.archivedAt) > 0) {
|
|
71
|
+
throw Object.assign(new Error('Restore session archive first'), { code: 'session_archived', status: 409 });
|
|
72
|
+
}
|
|
73
|
+
if (!sessionIndexService[action](sessionID)) throw notFound();
|
|
74
|
+
publishSessionIndexChange?.();
|
|
75
|
+
return { sessionID, settled: operation === 'settle-session' };
|
|
76
|
+
}
|
|
77
|
+
const archived = operation === 'archive-session';
|
|
78
|
+
const result = await sessionArchiveService.setArchive({
|
|
79
|
+
sessionID, archivedAt: archived ? Date.now() : 0,
|
|
80
|
+
...(input.directory ? { directory: input.directory } : {}),
|
|
81
|
+
});
|
|
82
|
+
if (!Number.isFinite(result?.archivedAt) || (result.archivedAt > 0) !== archived
|
|
83
|
+
|| typeof result.index?.ok !== 'boolean') throw new Error('Session archive unconfirmed');
|
|
84
|
+
return {
|
|
85
|
+
sessionID, archived, archivedAt: result.archivedAt,
|
|
86
|
+
index: result.index.ok ? { ok: true } : { ok: false, retryable: true },
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import fs from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
import { randomUUID } from 'node:crypto';
|
|
5
|
+
import { spawn } from 'node:child_process';
|
|
6
|
+
import express from 'express';
|
|
7
|
+
import { beforeEach, afterEach, describe, expect, it, vi } from 'vitest';
|
|
8
|
+
import { createUiAuth } from '../ui-auth/ui-auth.js';
|
|
9
|
+
import { registerAuthAndAccessRoutes } from '../opencode/core-routes.js';
|
|
10
|
+
import { createSessionIndexService } from '../session-index/service.js';
|
|
11
|
+
import { createSessionMetadataStore } from '../session-metadata/session-metadata-store.js';
|
|
12
|
+
import { createSessionArchiveService } from '../session-metadata/session-archive.js';
|
|
13
|
+
import { createCustomizationSkillInstaller } from './session-skill.js';
|
|
14
|
+
import { registerProjectsSkill, PROJECTS_SKILL_PATH } from './projects.js';
|
|
15
|
+
import { createProjectSessionLifecycle, lifecycleOperations } from './projects-lifecycle.js';
|
|
16
|
+
|
|
17
|
+
describe('bound session lifecycle helper end to end', () => {
|
|
18
|
+
let root, server, origin, auth, password, index, metadata, archive, records, publish, caller, command, shared, runtime;
|
|
19
|
+
const run = (command, input) => new Promise((resolve, reject) => {
|
|
20
|
+
const child = spawn(command, { shell: true, stdio: ['pipe', 'pipe', 'pipe'] });
|
|
21
|
+
let stdout = '', stderr = '';
|
|
22
|
+
child.stdout.on('data', (chunk) => { stdout += chunk; });
|
|
23
|
+
child.stderr.on('data', (chunk) => { stderr += chunk; });
|
|
24
|
+
child.on('error', reject);
|
|
25
|
+
child.on('close', (code) => {
|
|
26
|
+
try { resolve({ code, stdout, stderr, value: JSON.parse(code === 0 ? stdout : stderr) }); }
|
|
27
|
+
catch (error) { reject(error); }
|
|
28
|
+
});
|
|
29
|
+
child.stdin.end(input === undefined ? '' : JSON.stringify(input));
|
|
30
|
+
});
|
|
31
|
+
const request = (operation, input = {}, headers = auth) => fetch(`${origin}${PROJECTS_SKILL_PATH}`, {
|
|
32
|
+
method: 'POST', headers: { 'content-type': 'application/json', ...headers },
|
|
33
|
+
body: JSON.stringify({ sessionID: caller.id, operation, input }),
|
|
34
|
+
});
|
|
35
|
+
const commands = async () => {
|
|
36
|
+
const result = await run(command);
|
|
37
|
+
expect(result.code).toBe(0);
|
|
38
|
+
expect(result.value.lifecycleSupported).toBe(true);
|
|
39
|
+
expect(Object.keys(result.value.commands)).toEqual(['list', 'add', ...lifecycleOperations]);
|
|
40
|
+
return result.value.commands;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
beforeEach(async () => {
|
|
44
|
+
root = await fs.mkdtemp(path.join(os.tmpdir(), 'project-lifecycle-'));
|
|
45
|
+
password = randomUUID(); shared = true; runtime = 'http://runtime.test';
|
|
46
|
+
auth = { Authorization: `Basic ${Buffer.from(`opencode:${password}`).toString('base64')}` };
|
|
47
|
+
const registrationFile = path.join(root, 'service.json');
|
|
48
|
+
await fs.writeFile(registrationFile, JSON.stringify({ url: runtime, password }), { mode: 0o600 });
|
|
49
|
+
index = createSessionIndexService({ dbPath: path.join(root, 'index.sqlite'), getRuntimeConfig: () => ({ apiBaseUrl: runtime }) });
|
|
50
|
+
metadata = createSessionMetadataStore({ dataDir: root });
|
|
51
|
+
const now = Date.now();
|
|
52
|
+
records = new Map([['ses_target', { id: 'ses_target', title: 'Target', directory: root, time: { created: now, updated: now } }]]);
|
|
53
|
+
index.upsert(records.get('ses_target'));
|
|
54
|
+
index.clearSettled('ses_target');
|
|
55
|
+
publish = vi.fn();
|
|
56
|
+
archive = createSessionArchiveService({
|
|
57
|
+
sessionMetadataStore: metadata, sessionIndexService: index,
|
|
58
|
+
fetchUpstreamSession: async ({ sessionID }) => records.get(sessionID) ?? null,
|
|
59
|
+
broadcastSessionEvent: publish,
|
|
60
|
+
});
|
|
61
|
+
caller = { id: 'ses_caller', metadata: { yuri: { scheduledTaskSkill: {} } } };
|
|
62
|
+
const app = express();
|
|
63
|
+
registerAuthAndAccessRoutes(app, {
|
|
64
|
+
express, tunnelAuthController: { classifyRequestScope: () => 'local' },
|
|
65
|
+
uiAuthController: createUiAuth({ password: randomUUID() }),
|
|
66
|
+
getScheduledTaskSkillAuthHeaders: () => auth,
|
|
67
|
+
});
|
|
68
|
+
registerProjectsSkill(app, {
|
|
69
|
+
express, getIsSharedOpenCodeService: () => shared, getOpenCodeAuthHeaders: () => auth,
|
|
70
|
+
createClient: () => ({ session: { get: async () => caller } }),
|
|
71
|
+
sessionLifecycle: createProjectSessionLifecycle({
|
|
72
|
+
sessionIndexService: index, sessionArchiveService: archive, sessionMetadataStore: metadata,
|
|
73
|
+
publishSessionIndexChange: publish,
|
|
74
|
+
}),
|
|
75
|
+
});
|
|
76
|
+
server = await new Promise((resolve) => { const s = app.listen(0, '127.0.0.1', () => resolve(s)); });
|
|
77
|
+
origin = `http://127.0.0.1:${server.address().port}`;
|
|
78
|
+
caller.metadata.yuri.scheduledTaskSkill.hostOrigin = origin;
|
|
79
|
+
let pointer;
|
|
80
|
+
await createCustomizationSkillInstaller({ yuriDataDir: root })({
|
|
81
|
+
session: { instructions: { entry: { put: ({ value }) => { pointer = value; } } } },
|
|
82
|
+
}, caller.id, { projectBinding: { hostOrigin: origin, upstreamOrigin: runtime, registrationFile } });
|
|
83
|
+
command = pointer.split('Bound project helper: ')[1].split('\n')[0];
|
|
84
|
+
});
|
|
85
|
+
afterEach(async () => {
|
|
86
|
+
archive.stop?.();
|
|
87
|
+
await new Promise((resolve) => server.close(resolve));
|
|
88
|
+
index.close();
|
|
89
|
+
await fs.rm(root, { recursive: true, force: true });
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
it('discovers, settles, re-reads and restores through staged commands without UI password, preserving pins and metadata', async () => {
|
|
93
|
+
expect((await fetch(`${origin}/api/yuri/session-index`)).status).toBe(401);
|
|
94
|
+
index.setPinned('ses_target');
|
|
95
|
+
const cmd = await commands();
|
|
96
|
+
const list = await run(cmd['task-sessions'], {});
|
|
97
|
+
expect(list.value.sessions).toEqual([expect.objectContaining({ sessionID: 'ses_target', settled: false, pinned: true })]);
|
|
98
|
+
expect((await run(cmd['settle-session'], { sessionID: 'ses_target' })).value).toEqual({ sessionID: 'ses_target', settled: true });
|
|
99
|
+
expect(publish).toHaveBeenCalledOnce();
|
|
100
|
+
expect((await run(cmd['task-sessions'], { directory: root })).value.sessions[0]).toMatchObject({ settled: true, pinned: true });
|
|
101
|
+
expect((await run(cmd['session-state'], { sessionID: 'ses_target' })).value).toMatchObject({ indexed: true, settled: true, pinned: true, archivedAt: 0 });
|
|
102
|
+
expect(await metadata.get('ses_target')).toEqual({});
|
|
103
|
+
expect((await run(cmd['unsettle-session'], { sessionID: 'ses_target' })).value.settled).toBe(false);
|
|
104
|
+
expect((await run(cmd['task-sessions'], {})).value.sessions[0].settled).toBe(false);
|
|
105
|
+
expect(publish).toHaveBeenCalledTimes(2);
|
|
106
|
+
expect(list.stdout).not.toContain(password);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it('round-trips session archive through its real owner and persisted metadata, independently of settle', async () => {
|
|
110
|
+
const cmd = await commands();
|
|
111
|
+
const saved = await run(cmd['archive-session'], { sessionID: 'ses_target', directory: root });
|
|
112
|
+
expect(saved.value).toMatchObject({ sessionID: 'ses_target', archived: true, archivedAt: expect.any(Number), index: { ok: true } });
|
|
113
|
+
expect((await createSessionMetadataStore({ dataDir: root }).get('ses_target')).yuri.archive.archivedAt).toBe(saved.value.archivedAt);
|
|
114
|
+
expect((await run(cmd['task-sessions'], {})).value.sessions).toEqual([]);
|
|
115
|
+
expect((await run(cmd['session-state'], { sessionID: 'ses_target' })).value).toEqual({
|
|
116
|
+
sessionID: 'ses_target', indexed: false, archivedAt: saved.value.archivedAt, settled: null, pinned: null,
|
|
117
|
+
});
|
|
118
|
+
const restored = await run(cmd['unarchive-session'], { sessionID: 'ses_target' });
|
|
119
|
+
expect(restored.value).toMatchObject({ archived: false, archivedAt: 0, index: { ok: true } });
|
|
120
|
+
expect((await run(cmd['task-sessions'], {})).value.sessions).toHaveLength(1);
|
|
121
|
+
expect(saved.stdout + restored.stdout).not.toContain(password);
|
|
122
|
+
});
|
|
123
|
+
|
|
124
|
+
it('rejects unknown IDs and invalid input instead of fabricating successful settle writes', async () => {
|
|
125
|
+
const cmd = await commands();
|
|
126
|
+
const result = await run(cmd['settle-session'], { sessionID: 'ses_missing' });
|
|
127
|
+
expect(result).toMatchObject({ code: 1, value: { status: 404, code: 'session_not_found', terminal: false } });
|
|
128
|
+
expect((await run(cmd['archive-session'], { sessionID: 'ses_missing' })).value).toMatchObject({ status: 404, code: 'not_found' });
|
|
129
|
+
expect((await run(cmd['session-state'], { sessionID: 'ses_missing' })).value).toMatchObject({ status: 404, code: 'session_not_found' });
|
|
130
|
+
for (const operation of lifecycleOperations) {
|
|
131
|
+
for (const input of [null, [], { sessionID: 'invalid' }, { sessionID: 'ses_target', target: {} }, { directory: 'relative' }]) {
|
|
132
|
+
expect((await request(operation, input)).status).toBe(400);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
expect(publish).not.toHaveBeenCalled();
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it('gates every lifecycle operation by service authentication and admitted Host, and prevents cross-runtime writes', async () => {
|
|
139
|
+
for (const operation of lifecycleOperations) {
|
|
140
|
+
const input = operation === 'task-sessions' ? {} : { sessionID: 'ses_target' };
|
|
141
|
+
for (const headers of [{}, { Authorization: 'Bearer browser' }, { ...auth, Origin: origin }]) {
|
|
142
|
+
expect((await request(operation, input, headers)).status).toBe(403);
|
|
143
|
+
}
|
|
144
|
+
caller.metadata.yuri.scheduledTaskSkill.hostOrigin = 'http://127.0.0.1:1';
|
|
145
|
+
expect((await request(operation, input)).status).toBe(403);
|
|
146
|
+
caller.metadata.yuri.scheduledTaskSkill.hostOrigin = origin;
|
|
147
|
+
}
|
|
148
|
+
runtime = 'http://other-runtime.test';
|
|
149
|
+
expect((await request('task-sessions')).status).toBe(200);
|
|
150
|
+
expect((await (await request('task-sessions')).json()).sessions).toEqual([]);
|
|
151
|
+
expect((await request('settle-session', { sessionID: 'ses_target' })).status).toBe(404);
|
|
152
|
+
shared = false;
|
|
153
|
+
expect((await request('describe')).status).toBe(403);
|
|
154
|
+
expect(publish).not.toHaveBeenCalled();
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
it('returns metadata read failures as errors and partial archive repair without leaking raw exceptions', async () => {
|
|
158
|
+
const cmd = await commands();
|
|
159
|
+
const failedRead = vi.spyOn(metadata, 'getAll').mockRejectedValueOnce(new Error('private-token'));
|
|
160
|
+
expect((await run(cmd['task-sessions'], {})).value).toMatchObject({ status: 503, code: 'session_operation_failed' });
|
|
161
|
+
failedRead.mockRestore();
|
|
162
|
+
const failedIndex = vi.spyOn(index, 'upsertAndReportChange').mockImplementation(() => { throw new Error('private-token'); });
|
|
163
|
+
const result = await run(cmd['archive-session'], { sessionID: 'ses_target' });
|
|
164
|
+
expect(result.value).toMatchObject({ archived: true, index: { ok: false, retryable: true } });
|
|
165
|
+
expect(result.stdout + result.stderr).not.toContain('private-token');
|
|
166
|
+
failedIndex.mockRestore();
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
it('rejects a stale indexed session archive and propagates metadata/write failures without publishing success', async () => {
|
|
170
|
+
await metadata.setSessionMetadata('ses_target', { yuri: { archive: { archivedAt: Date.now() } } }, { allowArchive: true });
|
|
171
|
+
expect((await request('unsettle-session', { sessionID: 'ses_target' })).status).toBe(409);
|
|
172
|
+
expect((await request('task-sessions')).status).toBe(200);
|
|
173
|
+
expect((await (await request('task-sessions')).json()).sessions).toEqual([]);
|
|
174
|
+
await metadata.setSessionMetadata('ses_target', { yuri: { archive: { archivedAt: 0 } } }, { allowArchive: true });
|
|
175
|
+
const failedRead = vi.spyOn(metadata, 'get').mockRejectedValueOnce(new Error('private-token'));
|
|
176
|
+
expect((await request('settle-session', { sessionID: 'ses_target' })).status).toBe(503);
|
|
177
|
+
failedRead.mockRestore();
|
|
178
|
+
const failedWrite = vi.spyOn(index, 'setSettled').mockImplementationOnce(() => { throw new Error('private-token'); });
|
|
179
|
+
const response = await request('settle-session', { sessionID: 'ses_target' });
|
|
180
|
+
expect(response.status).toBe(503);
|
|
181
|
+
expect(await response.text()).not.toContain('private-token');
|
|
182
|
+
failedWrite.mockRestore();
|
|
183
|
+
expect(publish).not.toHaveBeenCalled();
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
it('paginates a scoped index completely without mistaking it for full upstream history', async () => {
|
|
187
|
+
for (let n = 0; n < 55; n++) index.upsert({ ...records.get('ses_target'), id: `ses_${n}`, directory: path.join(root, `repo-${n}`) });
|
|
188
|
+
const cmd = await commands();
|
|
189
|
+
const first = await run(cmd['task-sessions'], {});
|
|
190
|
+
expect(first.value).toMatchObject({ indexedOnly: true, nextCursor: '50', historyComplete: false });
|
|
191
|
+
expect(first.value.sessions).toHaveLength(50);
|
|
192
|
+
const next = await run(cmd['task-sessions'], { cursor: first.value.nextCursor });
|
|
193
|
+
expect(next.value).toMatchObject({ nextCursor: null });
|
|
194
|
+
expect(next.value.sessions).toHaveLength(6);
|
|
195
|
+
const all = [...first.value.sessions, ...next.value.sessions];
|
|
196
|
+
expect(new Set(all.map((row) => row.sessionID)).size).toBe(56);
|
|
197
|
+
expect((await run(cmd['task-sessions'], { directory: root })).value.sessions).toHaveLength(1);
|
|
198
|
+
});
|
|
199
|
+
});
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import path from 'node:path';
|
|
2
2
|
import { authorizeScheduledTaskSkillRequest } from '../scheduled-tasks/session-skill-contract.js';
|
|
3
3
|
import { remoteProjectOperations, validRemoteProjectInput, runRemoteProjectOperation } from './projects-remote.js';
|
|
4
|
+
import { lifecycleOperations, validLifecycleInput } from './projects-lifecycle.js';
|
|
4
5
|
|
|
5
6
|
export const PROJECTS_SKILL_PATH = '/api/yuri/session-skills/projects';
|
|
6
7
|
|
|
7
8
|
const projectResult = ({ id, path, label }) => ({ id, path, ...(label ? { label } : {}) });
|
|
8
9
|
const validInput = (operation, input) => {
|
|
9
10
|
if (remoteProjectOperations.includes(operation)) return validRemoteProjectInput(operation, input);
|
|
11
|
+
if (lifecycleOperations.includes(operation)) return validLifecycleInput(operation, input);
|
|
10
12
|
if (!input || typeof input !== 'object' || Array.isArray(input)) return false;
|
|
11
13
|
const allowed = operation === 'add' ? ['path', 'label'] : [];
|
|
12
14
|
if (Object.keys(input).some((key) => !allowed.includes(key))) return false;
|
|
@@ -16,22 +18,31 @@ const validInput = (operation, input) => {
|
|
|
16
18
|
};
|
|
17
19
|
|
|
18
20
|
/** Session-bound Host registration; the shared project registry owns persistence. */
|
|
19
|
-
export function registerProjectsSkill(app, { express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, createClient, registerProject, readSettingsFromDiskStrict, sanitizeProjects, remoteHostGateway }) {
|
|
21
|
+
export function registerProjectsSkill(app, { express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders, createClient, registerProject, readSettingsFromDiskStrict, sanitizeProjects, remoteHostGateway, sessionLifecycle }) {
|
|
20
22
|
app.post(PROJECTS_SKILL_PATH, express.json({ limit: '16kb' }), async (req, res) => {
|
|
21
23
|
res.setHeader('Cache-Control', 'no-store');
|
|
22
24
|
if (!getIsSharedOpenCodeService() || !authorizeScheduledTaskSkillRequest(req, getOpenCodeAuthHeaders())) return res.status(403).json({ error: 'Forbidden' });
|
|
23
25
|
const { sessionID, operation, input = {} } = req.body ?? {};
|
|
24
26
|
if (typeof sessionID !== 'string' || !sessionID || sessionID.length > 256
|
|
25
|
-
|| !['describe', 'list', 'add', ...remoteProjectOperations].includes(operation) || !validInput(operation, input)) return res.status(400).json({ code: 'invalid_input', error: 'Invalid project input' });
|
|
27
|
+
|| !['describe', 'list', 'add', ...lifecycleOperations, ...remoteProjectOperations].includes(operation) || !validInput(operation, input)) return res.status(400).json({ code: 'invalid_input', error: 'Invalid project input' });
|
|
26
28
|
try {
|
|
27
29
|
const session = await createClient().session.get({ sessionID });
|
|
28
30
|
const hostOrigin = `http://${req.socket.localAddress === '::1' ? '[::1]' : '127.0.0.1'}:${req.socket.localPort}`;
|
|
29
31
|
if (session.metadata?.yuri?.scheduledTaskSkill?.hostOrigin !== hostOrigin) return res.status(403).json({ error: 'Session is not bound to this Host' });
|
|
30
|
-
if (operation === 'describe') return res.json({ supported: true, remoteSupported: Boolean(remoteHostGateway?.supported && remoteHostGateway?.acquireTask), inputs: { add: '{path: existing absolute Host directory, label?: display name}', list: '{}',
|
|
32
|
+
if (operation === 'describe') return res.json({ supported: true, remoteSupported: Boolean(remoteHostGateway?.supported && remoteHostGateway?.acquireTask), lifecycleSupported: Boolean(sessionLifecycle), inputs: { add: '{path: existing absolute Host directory, label?: display name}', list: '{}',
|
|
33
|
+
'task-sessions': '{directory?: absolute bound-Host directory, cursor?: returned nextCursor} bounded Host index metadata, not full upstream history',
|
|
34
|
+
'session-state': '{sessionID} read Host archive authority and nullable task projection; not upstream existence or live UI state',
|
|
35
|
+
'settle-session': '{sessionID} task-view 「归档」: moves the session to the archived shelf; reversible, returns to active on new activity', 'unsettle-session': '{sessionID} restores a task-view-archived session to active',
|
|
36
|
+
'archive-session': '{sessionID, directory?} session-level archive (archivedAt metadata); not the task-view 「归档」', 'unarchive-session': '{sessionID, directory?}',
|
|
31
37
|
'remote-hosts': '{}', 'add-remote': '{target: {hubId,hostId,instanceId} from remote-hosts, path: existing absolute remote directory, label?}',
|
|
32
38
|
'remote-projects': '{}', sessions: '{target, directory, cursor?}', 'read-session': '{target, directory, sessionID, cursor?}',
|
|
33
39
|
'create-session': '{target, directory, sessionID: new caller-generated ID, title?}', 'prompt-session': '{target, directory, sessionID, messageID: stable caller-generated ID, text}' },
|
|
34
40
|
completion: 'add and add-remote return the persisted project and created=true/false. add-remote registers on the target Host, then saves the Hub reference. Registration does not clone/create files, open a session or change an existing active selection. Retry the same target and path safely after an interrupted response.' });
|
|
41
|
+
if (lifecycleOperations.includes(operation)) {
|
|
42
|
+
if (!sessionLifecycle) return res.status(501).json({ code: 'unsupported', error: 'Session lifecycle is unavailable on this Host' });
|
|
43
|
+
const result = await sessionLifecycle(operation, input);
|
|
44
|
+
return res.json(result);
|
|
45
|
+
}
|
|
35
46
|
if (remoteProjectOperations.includes(operation)) {
|
|
36
47
|
const controller = new AbortController();
|
|
37
48
|
const abort = () => controller.abort();
|
|
@@ -60,6 +71,11 @@ export function registerProjectsSkill(app, { express, getIsSharedOpenCodeService
|
|
|
60
71
|
return res.json({ project: projectResult(project), created });
|
|
61
72
|
} catch (error) {
|
|
62
73
|
if (res.destroyed) return;
|
|
74
|
+
if (lifecycleOperations.includes(operation)) {
|
|
75
|
+
const status = [400, 403, 404, 409, 501, 503].includes(error?.status) ? error.status : 503;
|
|
76
|
+
const code = ['unsupported', 'session_not_found', 'session_archived', 'not_found', 'directory_mismatch', 'validation_error'].includes(error?.code) ? error.code : 'session_operation_failed';
|
|
77
|
+
return res.status(status).json({ code, error: 'Session operation not confirmed; inspect the same session on the bound Host before retrying.' });
|
|
78
|
+
}
|
|
63
79
|
const code = ['validation_error', 'project_unavailable', 'remote_unavailable', 'remote_target_mismatch', 'remote_response_invalid'].includes(error?.code) ? error.code : 'project_operation_failed';
|
|
64
80
|
return res.status(code === 'validation_error' ? 400 : 503).json({ code, error: 'Project operation was not confirmed; inspect the same target before retrying. Never retry against the local Host.' });
|
|
65
81
|
}
|
|
@@ -88,6 +88,12 @@ describe('session project registration API', () => {
|
|
|
88
88
|
expect(registerProject).not.toHaveBeenCalled();
|
|
89
89
|
});
|
|
90
90
|
|
|
91
|
+
it('explicitly reports unsupported lifecycle capability instead of falling through to registration', async () => {
|
|
92
|
+
expect(await (await request('describe')).json()).toMatchObject({ lifecycleSupported: false });
|
|
93
|
+
expect((await request('settle-session', { sessionID: 'ses_target' })).status).toBe(501);
|
|
94
|
+
expect(registerProject).not.toHaveBeenCalled();
|
|
95
|
+
});
|
|
96
|
+
|
|
91
97
|
it('keeps remote discovery under the existing service and per-session admission gate', async () => {
|
|
92
98
|
expect(await (await request('describe')).json()).toMatchObject({ remoteSupported: true });
|
|
93
99
|
expect(await (await request('remote-projects')).json()).toEqual({ projects: [], failed: [], complete: true });
|
|
@@ -31,10 +31,10 @@ export function createCustomizationSkillInstaller({ yuriDataDir }) {
|
|
|
31
31
|
};
|
|
32
32
|
return async (client, sessionID, { remoteBinding, projectBinding } = {}) => {
|
|
33
33
|
const file = await prepare(Boolean(remoteBinding), Boolean(projectBinding));
|
|
34
|
-
const projects = projectBinding ? ` For local/remote project registration, discovering authorized remote machines, or reading/creating/continuing remote sessions, read references/projects.md and run the bound project API helper.\nBound project helper: ${sessionSkillCommand(process.execPath, path.join(path.dirname(file), 'projects.mjs'), Buffer.from(JSON.stringify({ ...projectBinding, sessionID })).toString('base64url'), 'describe')}\n` : ' No bound project helper is provided; project registration and remote project/session access are unavailable through this session skill.';
|
|
34
|
+
const projects = projectBinding ? ` For local/remote project registration, task/session archive and restore, discovering authorized remote machines, or reading/creating/continuing remote sessions, read references/projects.md and run the bound project API helper.\nBound project helper: ${sessionSkillCommand(process.execPath, path.join(path.dirname(file), 'projects.mjs'), Buffer.from(JSON.stringify({ ...projectBinding, sessionID })).toString('base64url'), 'describe')}\n` : ' No bound project helper is provided; project registration, task/session archive and remote project/session access are unavailable through this session skill.';
|
|
35
35
|
const remote = remoteBinding ? ` For SSH setup/config sync or Relay pairing, use only this bound helper after reading references/remote-connections.md. Bound local desktop helper: ${remoteConnectionsCommand(process.execPath, path.join(path.dirname(file), 'remote-connections.mjs'), Buffer.from(JSON.stringify({ ...remoteBinding, sessionID })).toString('base64url'), 'describe')}` : ' No bound SSH/Relay command is provided: these operations are unavailable in this session. Report that limit and stop this branch; use native Settings or a new supported local desktop session. A script or another capability\'s binding does not enable it. There is no credential/filesystem fallback for this capability.';
|
|
36
36
|
await client.session.instructions.entry.put({ sessionID, key: 'yuri.customization',
|
|
37
|
-
value: `Yuri customization: for adding a directory as a project in Yuri (local or remote), remote sessions, SSH connections, configuration sync, Relay pairing, appearance (themes, CSS/layout, Logo, macOS Dock), work-status widgets, global pages/tabs, custom file parsing/previews, preview exports, or GUI panels/commands/settings, read ${JSON.stringify(file)} first. Use the matching reference and apply changes only when requested.${projects}${remote}`,
|
|
37
|
+
value: `Yuri customization: for adding a directory as a project in Yuri (local or remote), task/session archive or restore (归档/恢复), remote sessions, SSH connections, configuration sync, Relay pairing, appearance (themes, CSS/layout, Logo, macOS Dock), work-status widgets, global pages/tabs, custom file parsing/previews, preview exports, or GUI panels/commands/settings, read ${JSON.stringify(file)} first. Use the matching reference and apply changes only when requested.${projects}${remote}`,
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
40
|
}
|
|
@@ -25,6 +25,7 @@ describe('built-in customization instructions', () => {
|
|
|
25
25
|
expect(await fs.readFile(file, 'utf8')).toContain('name: yuri-customization');
|
|
26
26
|
for (const name of ['projects', 'appearance', 'ui-surfaces', 'plugin-styles', 'gui-api', 'workflow', 'global-pages', 'work-status', 'icons', 'file-previews', 'preview-exports', 'remote-connections']) expect((await fs.readFile(path.join(path.dirname(file), 'references', `${name}.md`), 'utf8')).length).toBeGreaterThan(500);
|
|
27
27
|
expect(entry.value).toContain('adding a directory as a project in Yuri');
|
|
28
|
+
expect(entry.value).toContain('task/session archive or restore (归档/恢复)');
|
|
28
29
|
expect(await fs.readFile(file, 'utf8')).toContain('(references/projects.md)');
|
|
29
30
|
const projects = await fs.readFile(path.join(path.dirname(file), 'references', 'projects.md'), 'utf8');
|
|
30
31
|
expect(projects).toContain('POST /api/yuri/session-skills/projects');
|
|
@@ -55,6 +56,11 @@ describe('built-in customization instructions', () => {
|
|
|
55
56
|
expect(projectFile).not.toBe(boundFile);
|
|
56
57
|
expect(projectEntry).toContain('Bound project helper:');
|
|
57
58
|
expect(projectEntry).toContain('local/remote project registration');
|
|
59
|
+
expect(projectEntry).toContain('task/session archive and restore');
|
|
60
|
+
expect(projects).toContain('任务归档');
|
|
61
|
+
expect(projects).toContain('会话归档');
|
|
62
|
+
expect(projects).toContain('lifecycleSupported:true');
|
|
63
|
+
expect(await fs.readFile(path.join(path.dirname(projectFile), 'projects.mjs'), 'utf8')).toContain("'settle-session', 'unsettle-session', 'archive-session', 'unarchive-session'");
|
|
58
64
|
expect(projectEntry).toContain('discovering authorized remote machines');
|
|
59
65
|
expect(await fs.readFile(path.join(path.dirname(projectFile), 'references', 'projects.md'), 'utf8')).toContain('commands.add-remote');
|
|
60
66
|
expect(await fs.readFile(path.join(path.dirname(projectFile), 'projects.mjs'), 'utf8')).toContain("'remote-hosts', 'add-remote'");
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: yuri-customization
|
|
3
|
-
description: Register local or remote Yuri projects, discover authorized remote machines and read/create/continue remote sessions, configure SSH connections, configuration sync and Relay pairing, or customize its GUI through plugins for appearance, pages, widgets, previews, panels and settings.
|
|
3
|
+
description: Register local or remote Yuri projects, archive conversations (task-view 归档 or session archive), discover authorized remote machines and read/create/continue remote sessions, configure SSH connections, configuration sync and Relay pairing, or customize its GUI through plugins for appearance, pages, widgets, previews, panels and settings.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Yuri customization
|
|
7
7
|
|
|
8
8
|
For adding an existing directory to Yuri's project list, follow [projects](references/projects.md) using this session's bound project API helper. Registration is separate from creating files, cloning or opening a conversation.
|
|
9
9
|
|
|
10
|
+
For archiving conversations ("归档", moving tasks to the archived shelf, or session-level archive), use the same bound project helper and [archiving conversations](references/projects.md#archiving-conversations-task-archive-vs-session-archive). The task-view 「归档」 is `settle-session`; do not call UI-authenticated routes or edit Host databases.
|
|
11
|
+
|
|
10
12
|
For adding a remote project on an authorized machine or working with its sessions, use the same bound project helper and the [remote project workflow](references/projects.md#connected-remote-projects-and-sessions). This grants no SSH setup or new connection permission.
|
|
11
13
|
|
|
12
14
|
For SSH setup, configuration sync or Relay pairing, first check this session's pointer for its exact bound local desktop helper command. Without that command, report unavailable and stop this branch: a script file or another capability's binding does not enable it. With the command, follow [remote connections](references/remote-connections.md). For UI changes, use the plugin workflow below. Its GUI contracts describe Yuri's supported subset of the experimental OpenCode GUI SDK 2.2.0, not every capability in the newest upstream Desktop.
|
|
@@ -62,6 +62,36 @@ those retain their own capability contract. When the helper is unavailable, use
|
|
|
62
62
|
the intended Host's project UI or start a supported session. Keep desktop deep
|
|
63
63
|
links for their existing navigation purpose, not as an API authorization fallback.
|
|
64
64
|
|
|
65
|
+
## Archiving conversations (task archive vs session archive)
|
|
66
|
+
|
|
67
|
+
Yuri has two different states that the UI labels alike. Pick by what the user sees:
|
|
68
|
+
|
|
69
|
+
| Term | User wording | Operation | What it changes |
|
|
70
|
+
|---|---|---|---|
|
|
71
|
+
| **任务归档 / Task archive** (`settle`) | In the task view, 「归档」 / "move to the archived shelf" / "clear my task list" | `settle-session`, `unsettle-session` | Host session index only. Reversible; a session returns to active on new user activity. |
|
|
72
|
+
| **会话归档 / Session archive** (`archive`) | Explicit "session-level archive", `archivedAt` | `archive-session`, `unarchive-session` | Session metadata `archivedAt`. The session's own lifecycle state. |
|
|
73
|
+
|
|
74
|
+
Use these qualified Chinese terms in agent explanations; the task-view UI keeps its existing 「归档」 label (no new 「已搁置」 term).
|
|
75
|
+
|
|
76
|
+
Default: when the user says 「归档」 about conversations/tasks without further detail, use `settle-session`. Never use `archive-session` for that request; it is not the task-view action. Neither operation deletes content.
|
|
77
|
+
|
|
78
|
+
1. Run the bound project `describe` command. Continue only when `lifecycleSupported:true`; use the returned commands unchanged. Authentication is owned by the helper: no UI password or browser is required. A missing command or terminal error means stop and request a newly admitted session on an updated Host.
|
|
79
|
+
2. Discover exact IDs with `commands["task-sessions"]`, supplying `{}` or `{"directory":"/workspace/my-project"}` on stdin. Results contain up to 50 metadata rows (`sessionID`, `directory`, `title`, `settled`, `pinned`, `activityUpdatedAt`) and `nextCursor`. Follow every returned cursor using the same directory filter **before writing**, then select only the user's scope. `indexedOnly:true` means this is the bound Host's task index, not every historical OpenCode session; `historyComplete:false` means full upstream history is not confirmed. Re-read after a concurrent catalog change; never interpret a failed read as an empty list.
|
|
80
|
+
3. Supply JSON on stdin to the chosen write command, one session per call:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{"sessionID":"ses_xxxxxxxx"}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
`archive-session` / `unarchive-session` also accept an optional absolute `directory` hint. `sessionID` must be an existing OpenCode session ID (`ses…`).
|
|
87
|
+
4. Completion: settle returns `{"sessionID":"ses_…","settled":true}`, restore returns `settled:false`. Read `commands["session-state"]` with `{"sessionID":"ses_…"}` to verify the Host projection and archive timestamp, or re-list task rows. State returns `indexed`, `archivedAt`, `settled` and `pinned`; the last two are `null` when no task row is projected. It is Host state, not proof of upstream existence or live UI membership. Live running/pending-request sessions may remain visible as active, and settle preserves pins; it does not abort execution or guarantee an empty task view. New user message/inbox activity clears the settle override; assistant completion alone does not.
|
|
88
|
+
Session archive returns `{"sessionID":"ses_…","archived":true,"archivedAt":123,"index":{"ok":true}}`; restore returns `archived:false,archivedAt:0`. `index.ok:false` confirms metadata persistence but not index repair: report partial success and re-check the same ID before retrying; retain the original `archivedAt` receipt.
|
|
89
|
+
5. `session_not_found`/`not_found` (404) means the selected ID is unavailable, not success. `session_archived` (409) means an existing session-level archive must be restored with `unarchive-session`, not `unsettle-session`. Errors remain unconfirmed and raw credentials/errors are not returned. After an interrupted write, inspect the same IDs before retrying; bulk work reports confirmed counts and per-ID failures.
|
|
90
|
+
|
|
91
|
+
These operations affect only the **bound Host** and its current runtime. Task state for Remote Projects belongs to this connected Hub, never the remote machine's database. A remote `{target,...}` is not accepted here; session-level archive of a remote worker through this helper is unsupported. Keep the full remote target and use its supported workflow rather than falling back to a same-named local session.
|
|
92
|
+
|
|
93
|
+
Archive only sessions the user named or clearly scoped, including the current session only when requested. Use the bound helper rather than UI-authenticated HTTP routes, browser cookies, credential discovery or direct SQLite writes. The Host publishes normal index revisions after confirmed task writes.
|
|
94
|
+
|
|
65
95
|
## Connected remote projects and sessions
|
|
66
96
|
|
|
67
97
|
Use this branch to add a remote project on an authorized machine or discover, read, create or continue its sessions. Registration uses the remote machine's filesystem, not this session's local filesystem.
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { registerFsRoutes } from '../fs/routes.js';
|
|
2
2
|
import { registerRemoteConnectionsSkill } from '../gui-customization/remote-connections.js';
|
|
3
3
|
import { registerProjectsSkill } from '../gui-customization/projects.js';
|
|
4
|
+
import { createProjectSessionLifecycle } from '../gui-customization/projects-lifecycle.js';
|
|
4
5
|
import { registerQuotaRoutes } from '../quota/routes.js';
|
|
5
6
|
import { registerSmallModelRoutes } from '../small-model/routes.js';
|
|
6
7
|
import { registerSessionMetadataRoutes } from '../session-metadata/routes.js';
|
|
@@ -161,6 +162,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
161
162
|
globalMessageStreamHub,
|
|
162
163
|
getServerId,
|
|
163
164
|
sessionIndexService,
|
|
165
|
+
publishSessionIndexChange = null,
|
|
164
166
|
notifyContactTurnComplete,
|
|
165
167
|
sessionMetadataStore = null,
|
|
166
168
|
sessionArchiveService = null,
|
|
@@ -311,6 +313,9 @@ export const createFeatureRoutesRuntime = (dependencies) => {
|
|
|
311
313
|
express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders,
|
|
312
314
|
createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
|
|
313
315
|
registerProject: (input) => projectRegistry.register(input), readSettingsFromDiskStrict, sanitizeProjects,
|
|
316
|
+
sessionLifecycle: createProjectSessionLifecycle({
|
|
317
|
+
sessionIndexService, sessionArchiveService, sessionMetadataStore, publishSessionIndexChange,
|
|
318
|
+
}),
|
|
314
319
|
});
|
|
315
320
|
historyImportRuntime = registerHistoryImportRoutes(app, {
|
|
316
321
|
express, uiAuthController, dataDir: yuriDataDir,
|
|
@@ -3,6 +3,12 @@ import { describe, expect, it, vi } from 'vitest';
|
|
|
3
3
|
import { createWorktreeTopologyBroadcaster } from './feature-routes-runtime.js';
|
|
4
4
|
|
|
5
5
|
describe('feature routes runtime composition', () => {
|
|
6
|
+
it('wires the bound lifecycle helper to the UI-owned services and revision publisher', async () => {
|
|
7
|
+
const routes = await fs.readFile(new URL('./feature-routes-runtime.js', import.meta.url), 'utf8');
|
|
8
|
+
const host = await fs.readFile(new URL('../../index.js', import.meta.url), 'utf8');
|
|
9
|
+
expect(routes).toMatch(/sessionLifecycle: createProjectSessionLifecycle\(\{\s*sessionIndexService, sessionArchiveService, sessionMetadataStore, publishSessionIndexChange/);
|
|
10
|
+
expect(host).toContain('publishSessionIndexChange: () => sessionIndexSyncRuntime?.publishChange?.()');
|
|
11
|
+
});
|
|
6
12
|
it('wires session project registration to the shared registry and strict settings reader', async () => {
|
|
7
13
|
const routes = await fs.readFile(new URL('./feature-routes-runtime.js', import.meta.url), 'utf8');
|
|
8
14
|
expect(routes).toMatch(/registerProjectsSkill\(app, \{[\s\S]*?registerProject: \(input\) => projectRegistry.register\(input\), readSettingsFromDiskStrict, sanitizeProjects/);
|