@yuriai/web 0.2.40-beta.4 → 0.2.40-beta.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.
Files changed (307) hide show
  1. package/dist/assets/{AgentAvatar-BmT_6apW.js → AgentAvatar-XDXiFZvA.js} +1 -1
  2. package/dist/assets/AssistantConversationSurface-B59k-lXE.css +1 -0
  3. package/dist/assets/AssistantConversationSurface-CQnJaKTn.js +3 -0
  4. package/dist/assets/AssistantSessionCard-DXY8-wyP.js +2 -0
  5. package/dist/assets/{AssistantUnreadBadge-C34eOGCL.js → AssistantUnreadBadge-B-G015yE.js} +1 -1
  6. package/dist/assets/{AssistantView-0nXkM9VG.js → AssistantView-CasyQbii.js} +1 -1
  7. package/dist/assets/DiagramView-DhWnsM9v.js +1 -0
  8. package/dist/assets/{FadeInOnReveal-CCVdl9Vt.js → FadeInOnReveal-Ca9EVP3a.js} +1 -1
  9. package/dist/assets/{GuiPluginPage-BMt5AMqg.js → GuiPluginPage-DKOsUpVL.js} +1 -1
  10. package/dist/assets/GuiPluginSurface-BfXMBqdD.js +1 -0
  11. package/dist/assets/{GuiPluginWindow-BVvzrnp1.js → GuiPluginWindow-Dmg2Qui6.js} +1 -1
  12. package/dist/assets/{Icon-B5nBc6dO.js → Icon-ChyA050P.js} +1 -1
  13. package/dist/assets/{ImageLoadingPlaceholder-Bv5mmf2U.js → ImageLoadingPlaceholder-C8QUF5aV.js} +1 -1
  14. package/dist/assets/LoadingImage-BxRq1dMQ.js +1 -0
  15. package/dist/assets/MarkdownRenderer-CvWLikEO.js +2 -0
  16. package/dist/assets/MarkdownRendererImpl-CcNsQOEn.js +10 -0
  17. package/dist/assets/MarkstreamRendererImpl-D9W5XXPo.js +3 -0
  18. package/dist/assets/MobileDetailNavigation-CnwIZn5g.js +1 -0
  19. package/dist/assets/{MobileResizableSheet-D5PcZMuI.js → MobileResizableSheet-Bpp079l7.js} +1 -1
  20. package/dist/assets/MobileShareBridge-C-GpJfF6.js +3 -0
  21. package/dist/assets/MobileSurface-CrNI8cYQ.js +2 -0
  22. package/dist/assets/{MultiRunWindow-rMqP99ID.js → MultiRunWindow-DvywQkz9.js} +1 -1
  23. package/dist/assets/OnboardingScreen-BvueSxVk.js +1 -0
  24. package/dist/assets/{OverlayScrollbar-Byx2H3pc.js → OverlayScrollbar-CPaH_j8g.js} +1 -1
  25. package/dist/assets/RemoteAssistantSessionCard-CFWE00xD.js +1 -0
  26. package/dist/assets/SettingsView-Df6GCFPI.js +29 -0
  27. package/dist/assets/{SettingsWindow-U-RDDOS7.js → SettingsWindow-BpaRjeR-.js} +1 -1
  28. package/dist/assets/SetupTourDialog-DD_4qiTz.js +1 -0
  29. package/dist/assets/TerminalView-CRTtNAfA.js +8 -0
  30. package/dist/assets/ToolOutputDialog-omGmWntf.js +16 -0
  31. package/dist/assets/VoiceSettings-Du-Yd5MF.js +2 -0
  32. package/dist/assets/{YuriLogo-B58GIl2v.js → YuriLogo-CvyJy_R9.js} +1 -1
  33. package/dist/assets/YuriWordmark-B7lmpLRB.js +1 -0
  34. package/dist/assets/{assistant-attachment-cache-Cmzt4xXE.js → assistant-attachment-cache-D-LmCflm.js} +1 -1
  35. package/dist/assets/bootstrap-eLlfzqAI.js +1 -0
  36. package/dist/assets/{capgoAdapter-B5NImlKh.js → capgoAdapter-CqMX4zC-.js} +1 -1
  37. package/dist/assets/{checkbox-Bdj4n5cI.js → checkbox-KNAgqjPZ.js} +1 -1
  38. package/dist/assets/client-1Fk5IbQR.js +7 -0
  39. package/dist/assets/{collapsible-D1JZOgJZ.js → collapsible-CdiLY07j.js} +1 -1
  40. package/dist/assets/{context-menu-DDX0ZFhc.js → context-menu-CO_VRWeV.js} +1 -1
  41. package/dist/assets/{desktopHosts-DovfbQPm.js → desktopHosts-135cuRCE.js} +1 -1
  42. package/dist/assets/{desktopRelayRestore-D4pbpNKN.js → desktopRelayRestore-1aUztDPU.js} +1 -1
  43. package/dist/assets/{device-DNG0cNwQ.js → device-QL8KNSLM.js} +1 -1
  44. package/dist/assets/{diagram-C72TQWfh.js → diagram-9b-Aaful.js} +1 -1
  45. package/dist/assets/{dialog-CIKJalI5.js → dialog-8YYmYPFP.js} +1 -1
  46. package/dist/assets/{es-D0Q_CV0t.js → es-Ba3NUCtE.js} +3 -3
  47. package/dist/assets/{fileMentionTouchSelection-tnd9RDDh.js → fileMentionTouchSelection-CLQBqWR8.js} +1 -1
  48. package/dist/assets/fileReferenceActions-cYqdsXFz.js +1 -0
  49. package/dist/assets/{fr-DrO5SAKl.js → fr-CRhp3hyT.js} +3 -3
  50. package/dist/assets/{gitApi-BI8OG_ts.js → gitApi-uhoLUa-e.js} +11 -7
  51. package/dist/assets/gitApiHttp-B0FJaIhU.js +3 -0
  52. package/dist/assets/{gui-DN2sVP96.js → gui-BMN3-WPc.js} +1 -1
  53. package/dist/assets/historyImportQueries-D_9RlrLp.js +1 -0
  54. package/dist/assets/host-D9EDWNmx.js +1 -0
  55. package/dist/assets/{i18n-UaLestuf.js → i18n-RH7UieOS.js} +1 -1
  56. package/dist/assets/image-loading-DBqnxgDH.js +1 -0
  57. package/dist/assets/{input-gVHSS0EB.js → input-DK8VTvJw.js} +1 -1
  58. package/dist/assets/input-store-CsY-uaSj.js +1 -0
  59. package/dist/assets/insertionBoundaries-rYqUxuB-.js +1 -0
  60. package/dist/assets/{ja-BNeP9_GU.js → ja-D-UPjDY2.js} +3 -3
  61. package/dist/assets/{ko-DRRFD_7l.js → ko-x-z9J5z7.js} +3 -3
  62. package/dist/assets/main-BMx-2MjO.js +169 -0
  63. package/dist/assets/main-DzqojuZ1.js +2 -0
  64. package/dist/assets/{markdownHeightCache-B-FoaQ1U.js → markdownHeightCache-DAvnT6xF.js} +1 -1
  65. package/dist/assets/{markdownTheme-CHNl6tUv.js → markdownTheme-DFDWa8Gh.js} +1 -1
  66. package/dist/assets/mcpQueries-CpH8vPf1.js +1 -0
  67. package/dist/assets/miniChat-BTE_XpRk.js +2 -0
  68. package/dist/assets/mobile-BBZOulQ1.js +2 -0
  69. package/dist/assets/mobileBackNavigation-Cq08UPxZ.js +1 -0
  70. package/dist/assets/mobileConnections-ZehAozpe.js +2 -0
  71. package/dist/assets/multirun-Cll2Meol.js +3 -0
  72. package/dist/assets/{native-DsqzO52u.js → native-CDqNKjmz.js} +1 -1
  73. package/dist/assets/{native-config-DqDXViVx.js → native-config-DtUZFauV.js} +1 -1
  74. package/dist/assets/navigation-J3d8PQcs.js +2 -0
  75. package/dist/assets/openRemoteProjectSession-oJZpCDPT.js +1 -0
  76. package/dist/assets/{pl-BnW5wJrl.js → pl-Cqo1FJwM.js} +3 -3
  77. package/dist/assets/platform-wF65ZFgV.js +1 -0
  78. package/dist/assets/project-preview-2H-TmJkd.js +1 -0
  79. package/dist/assets/projectActions-50e_f9dI.js +1 -0
  80. package/dist/assets/projectMeta-BBpfOmij.js +1 -0
  81. package/dist/assets/prompt-attachment-upload-9fjmgafL.js +1 -0
  82. package/dist/assets/{pt-BR-fZW8CCVQ.js → pt-BR-C930XU1k.js} +3 -3
  83. package/dist/assets/pwa-C8B1Mf_t.js +2 -0
  84. package/dist/assets/queue-abort-optimistic-B1Uskf6F.js +1 -0
  85. package/dist/assets/{react-DeB-Vc_L.js → react-45rBMaUm.js} +1 -1
  86. package/dist/assets/{readiness-CIlvQ-aQ.js → readiness-CrjBrUa_.js} +2 -2
  87. package/dist/assets/reference-history-DqfMBWzF.js +1 -0
  88. package/dist/assets/relay-preview-frame-src-BPyz3nXA.js +1 -0
  89. package/dist/assets/remote-input-store-84i8uDyM.js +1 -0
  90. package/dist/assets/remoteProjectQueries-B6lrEDMq.js +1 -0
  91. package/dist/assets/remoteSessionReference-YiGvdabX.js +1 -0
  92. package/dist/assets/renderElectronMiniChatApp-BuHQB0V8.js +2 -0
  93. package/dist/assets/renderMobileApp-D_VswCi0.js +29 -0
  94. package/dist/assets/{runtime-file-download-DMY1k1af.js → runtime-file-download-D11Nnedg.js} +1 -1
  95. package/dist/assets/runtime-file-resource-CuLP3xp7.js +6 -0
  96. package/dist/assets/runtimeConfig-CMbNyYbK.js +2 -0
  97. package/dist/assets/{runtimeEndpointReset-BOdd_mJM.css → runtimeEndpointReset-BUGfn7y0.css} +1 -1
  98. package/dist/assets/runtimeEndpointReset-zo-HZQgX.js +151 -0
  99. package/dist/assets/safeStorage-DTOhKN0V.js +1 -0
  100. package/dist/assets/scheduledTaskNavigation-y5g8D2ee.js +1 -0
  101. package/dist/assets/{select-BwCKwnTH.js → select-VWoGVTBZ.js} +1 -1
  102. package/dist/assets/sessionLookup-JAf5UU7-.js +1 -0
  103. package/dist/assets/sortable-tabs-strip-Dbt3TTAs.js +1 -0
  104. package/dist/assets/{speechSettingsQueries-C5mPRWIv.js → speechSettingsQueries-Bidfcv0W.js} +1 -1
  105. package/dist/assets/src-BZCFf9_1.css +2 -0
  106. package/dist/assets/{store-CzVMz42v.js → store-DunGyOfe.js} +4 -4
  107. package/dist/assets/terminalApi-Cq0vjFe1.js +1 -0
  108. package/dist/assets/{textarea-CaTDyZrS.js → textarea-vyMsAV5p.js} +1 -1
  109. package/dist/assets/{tooltip-BvZzoiqg.js → tooltip-DWqHWi4N.js} +1 -1
  110. package/dist/assets/tour-CQMBn8gJ.js +1 -0
  111. package/dist/assets/{types-Bm8kDgSv.js → types-DeOkRCgE.js} +1 -1
  112. package/dist/assets/{uk-C4OKsNRv.js → uk-OXQSdzuT.js} +3 -3
  113. package/dist/assets/useAppFontEffects-K31q-1OV.css +1 -0
  114. package/dist/assets/{useAppFontEffects-C9IaiJgF.js → useAppFontEffects-z382Lhm_.js} +63 -58
  115. package/dist/assets/useAssistantUIStore-jOKVcBK8.js +1 -0
  116. package/dist/assets/useDesktopWindowControlsLayout-BEs7i5qj.js +1 -0
  117. package/dist/assets/{useDictation-Sk20Gi0T.js → useDictation-e68rFA6y.js} +1 -1
  118. package/dist/assets/useEffectiveDirectory-CcM3S1OQ.js +1 -0
  119. package/dist/assets/useFontPreferences-CO-L-Gd7.js +1 -0
  120. package/dist/assets/{useMobileHtmlPreviewStore-C03uVLfX.js → useMobileHtmlPreviewStore-EOAzZiAy.js} +1 -1
  121. package/dist/assets/useMobileNavigationStore-BA0IaUi_.js +13 -0
  122. package/dist/assets/usePluginsStore-BG5MW5LR.js +1 -0
  123. package/dist/assets/useProjectRuntimeAPIs-Be4gXG7P.js +1 -0
  124. package/dist/assets/{useStreamingTextThrottle-CeKHHK13.js → useStreamingTextThrottle-DylP9HFC.js} +1 -1
  125. package/dist/assets/{useThemeSystem-CNzUUkFn.js → useThemeSystem-C57Z9mV2.js} +1 -1
  126. package/dist/assets/useUIStore-Cfmg-aDQ.js +1 -0
  127. package/dist/assets/uuid-D-SDZijH.js +1 -0
  128. package/dist/assets/{vendor-base-ui-CzHs0bHY.js → vendor-base-ui-z2M4boRm.js} +1 -1
  129. package/dist/assets/{vendor-cmdk-C_tivUtr.js → vendor-cmdk-BgHvMv5l.js} +1 -1
  130. package/dist/assets/{vendor-dnd-kit-accessibility-BOtnpZt5.js → vendor-dnd-kit-accessibility-gVi9ga0x.js} +1 -1
  131. package/dist/assets/{vendor-dnd-kit-core-DK4OoOTr.js → vendor-dnd-kit-core-Dd5yS2-T.js} +1 -1
  132. package/dist/assets/{vendor-dnd-kit-sortable-Cv69eQm1.js → vendor-dnd-kit-sortable-CV-SGi8y.js} +1 -1
  133. package/dist/assets/{vendor-framer-motion-DDMKlXiP.js → vendor-framer-motion-CF9BQLta.js} +1 -1
  134. package/dist/assets/{vendor-markstream-react-6zxyQLCD.js → vendor-markstream-react-TwEpkgfP.js} +3 -3
  135. package/dist/assets/vendor-motion-Dv27UnOI.js +1 -0
  136. package/dist/assets/{vendor-opencode-client-cQ47ywrT.js → vendor-opencode-client-BM2r1f0o.js} +3 -3
  137. package/dist/assets/{vendor-opencode-plugin-BmdTE4Te.js → vendor-opencode-plugin-ZhpPgHCL.js} +1 -1
  138. package/dist/assets/{vendor-pierre-diffs-BFiZ3IhI.js → vendor-pierre-diffs-tqo4Z3TC.js} +1 -1
  139. package/dist/assets/{vendor-react-DlzBev0S.js → vendor-react-P8wFrkcT.js} +1 -1
  140. package/dist/assets/{vendor-react-drawio-Dyg1-39Q.js → vendor-react-drawio-CQW1YP2l.js} +1 -1
  141. package/dist/assets/vendor-reactuses-core-Dyjw5sZR.js +1 -0
  142. package/dist/assets/{vendor-solid-js-D98iXT7C.js → vendor-solid-js-BBVUd3Hw.js} +1 -1
  143. package/dist/assets/{vendor-sonner-BEHGipm5.js → vendor-sonner-B5HgJenP.js} +1 -1
  144. package/dist/assets/{vendor-stream-diffs-wcQxoPZk.js → vendor-stream-diffs-DCMtZcS3.js} +2 -2
  145. package/dist/assets/vendor-tanstack-query-core-BSjXNgF_.js +1 -0
  146. package/dist/assets/vendor-tanstack-react-query-B-KblYBV.js +1 -0
  147. package/dist/assets/{vendor-tanstack-react-virtual-DSFNK3qc.js → vendor-tanstack-react-virtual-BkuqzrEV.js} +1 -1
  148. package/dist/assets/{vendor-zustand-vDaAPGfl.js → vendor-zustand-Cwko4FG1.js} +1 -1
  149. package/dist/assets/{zh-CN-ieAs59w6.js → zh-CN-B5X8yCZV.js} +3 -3
  150. package/dist/assets/{zh-TW-WWTW1fkP.js → zh-TW-CF6zr1fk.js} +3 -3
  151. package/dist/index.html +32 -27
  152. package/dist/mini-chat.html +32 -27
  153. package/dist/mobile.html +2 -2
  154. package/package.json +3 -2
  155. package/server/index.d.ts +19 -0
  156. package/server/index.js +36 -5
  157. package/server/lib/assistants/DOCUMENTATION.md +87 -0
  158. package/server/lib/assistants/assign.js +10 -7
  159. package/server/lib/assistants/builtin-skills.js +1 -0
  160. package/server/lib/assistants/builtin-skills.test.js +1 -1
  161. package/server/lib/assistants/cards.js +6 -1
  162. package/server/lib/assistants/contact-store.js +22 -5
  163. package/server/lib/assistants/contact-tools.js +46 -26
  164. package/server/lib/assistants/execution-target.js +136 -0
  165. package/server/lib/assistants/opencode-tools.js +22 -9
  166. package/server/lib/assistants/remote-execution.test.js +378 -0
  167. package/server/lib/assistants/remote-watch-reconciler.js +43 -0
  168. package/server/lib/assistants/remote-watch-reconciler.test.js +88 -0
  169. package/server/lib/assistants/routes.js +1 -0
  170. package/server/lib/assistants/service.js +302 -99
  171. package/server/lib/assistants/yuri-project.http.test.js +2 -2
  172. package/server/lib/client-auth/remote-clients.js +11 -0
  173. package/server/lib/content-search/DOCUMENTATION.md +5 -0
  174. package/server/lib/content-search/routes.js +4 -0
  175. package/server/lib/content-search/routes.test.js +10 -0
  176. package/server/lib/event-stream/DOCUMENTATION.md +5 -0
  177. package/server/lib/event-stream/runtime.js +3 -0
  178. package/server/lib/event-stream/upstream-reader.js +1 -1
  179. package/server/lib/gui-customization/DOCUMENTATION.md +8 -2
  180. package/server/lib/gui-customization/projects-client.mjs +10 -8
  181. package/server/lib/gui-customization/projects-remote.js +101 -0
  182. package/server/lib/gui-customization/projects-remote.test.js +125 -0
  183. package/server/lib/gui-customization/projects.js +30 -6
  184. package/server/lib/gui-customization/projects.test.js +66 -1
  185. package/server/lib/gui-customization/session-skill.js +2 -2
  186. package/server/lib/gui-customization/session-skill.test.js +4 -0
  187. package/server/lib/gui-customization/skill/SKILL.md +3 -1
  188. package/server/lib/gui-customization/skill/references/projects.md +30 -3
  189. package/server/lib/gui-customization/skill/references/remote-connections.md +13 -0
  190. package/server/lib/message-queue/DOCUMENTATION.md +4 -0
  191. package/server/lib/message-queue/service.js +2 -1
  192. package/server/lib/message-queue/service.test.js +11 -0
  193. package/server/lib/notifications/emitter-runtime.js +5 -0
  194. package/server/lib/opencode/DOCUMENTATION.md +34 -0
  195. package/server/lib/opencode/core-routes.js +14 -2
  196. package/server/lib/opencode/core-routes.test.js +28 -0
  197. package/server/lib/opencode/feature-routes-runtime.js +8 -1
  198. package/server/lib/opencode/proxy.js +1 -0
  199. package/server/lib/opencode/routes.js +18 -4
  200. package/server/lib/opencode/routes.test.js +22 -0
  201. package/server/lib/opencode/settings-helpers.js +26 -0
  202. package/server/lib/opencode/settings-helpers.test.js +20 -0
  203. package/server/lib/opencode/settings-runtime.js +5 -3
  204. package/server/lib/opencode/settings-runtime.test.js +35 -0
  205. package/server/lib/opencode/v2-client.js +9 -4
  206. package/server/lib/preview/DOCUMENTATION.md +73 -0
  207. package/server/lib/preview/file-preview-path.js +37 -0
  208. package/server/lib/preview/file-target.js +38 -0
  209. package/server/lib/preview/file-target.test.js +111 -0
  210. package/server/lib/preview/proxy-runtime.js +110 -17
  211. package/server/lib/projects/DOCUMENTATION.md +6 -0
  212. package/server/lib/relay/tunnel-host.js +1 -0
  213. package/server/lib/remote-hosts/DOCUMENTATION.md +321 -0
  214. package/server/lib/remote-hosts/configuration.js +15 -0
  215. package/server/lib/remote-hosts/deadline.js +22 -0
  216. package/server/lib/remote-hosts/deadline.test.js +64 -0
  217. package/server/lib/remote-hosts/fixtures/settings-server.mjs +26 -0
  218. package/server/lib/remote-hosts/gateway.js +744 -0
  219. package/server/lib/remote-hosts/json-lifecycle.test.js +90 -0
  220. package/server/lib/remote-hosts/preview-scope.js +23 -0
  221. package/server/lib/remote-hosts/relay-client.ts +3 -0
  222. package/server/lib/remote-hosts/routes.js +429 -0
  223. package/server/lib/remote-hosts/routes.test.js +1427 -0
  224. package/server/lib/remote-hosts/settings-production.test.js +145 -0
  225. package/server/lib/remote-hosts/store.js +124 -0
  226. package/server/lib/remote-hosts/store.test.js +52 -0
  227. package/server/lib/remote-hosts/task-client.js +25 -0
  228. package/server/lib/remote-hosts/task-client.test.js +60 -0
  229. package/server/lib/remote-hosts/transport.js +118 -0
  230. package/server/lib/request-cors.js +1 -1
  231. package/server/lib/request-cors.test.js +1 -0
  232. package/server/lib/scheduled-tasks/session-skill.test.js +33 -2
  233. package/server/lib/session-folders/routes.js +1 -0
  234. package/server/lib/transcript-cache/DOCUMENTATION.md +4 -0
  235. package/server/lib/transcript-cache/routes.js +3 -0
  236. package/server/lib/transcript-cache/service.js +15 -0
  237. package/server/lib/transcript-cache/service.test.js +13 -0
  238. package/server/lib/ui-auth/DOCUMENTATION.md +18 -0
  239. package/server/lib/ui-auth/ui-auth.js +30 -2
  240. package/server/lib/ui-auth/ui-auth.test.js +46 -1
  241. package/dist/assets/AssistantConversationSurface-B-D-mLgs.js +0 -3
  242. package/dist/assets/AssistantConversationSurface-n9w_Av0k.css +0 -1
  243. package/dist/assets/DiagramView-BU6jWxKJ.js +0 -1
  244. package/dist/assets/GuiPluginSurface-kxAcgmf1.js +0 -1
  245. package/dist/assets/LoadingImage-BzBw_1lI.js +0 -1
  246. package/dist/assets/MarkdownRenderer-CoMohPOZ.js +0 -2
  247. package/dist/assets/MarkdownRendererImpl-DoZW1UKH.js +0 -10
  248. package/dist/assets/MarkstreamRendererImpl-B3zd5x2O.js +0 -3
  249. package/dist/assets/MobileDetailNavigation-bEZ_NA03.js +0 -1
  250. package/dist/assets/MobileShareBridge-Cjukxazk.js +0 -3
  251. package/dist/assets/MobileTabPageHeader-Da1maXx-.js +0 -2
  252. package/dist/assets/OnboardingScreen-CZhqHzAj.js +0 -1
  253. package/dist/assets/SettingsView-7Bea2DvF.js +0 -29
  254. package/dist/assets/SetupTourDialog-CKec5tUy.js +0 -1
  255. package/dist/assets/TerminalView-CS1oSAuY.js +0 -8
  256. package/dist/assets/ToolOutputDialog-BWhrFvvI.js +0 -10
  257. package/dist/assets/VoiceSettings-7aFmJq9Z.js +0 -2
  258. package/dist/assets/YuriWordmark--S-QEpRp.js +0 -1
  259. package/dist/assets/appThemeRegistry-LyWTE-mT.js +0 -1
  260. package/dist/assets/bootstrap-BhC95qVC.js +0 -1
  261. package/dist/assets/fileQueries-D9l0crnM.js +0 -1
  262. package/dist/assets/fileReferenceActions-BmquJskG.js +0 -1
  263. package/dist/assets/gitApiHttp-D4d-rgcR.js +0 -9
  264. package/dist/assets/historyImportQueries-DkB2_92i.js +0 -1
  265. package/dist/assets/host-kMLXU0hK.js +0 -1
  266. package/dist/assets/image-loading-BrDob6MW.js +0 -1
  267. package/dist/assets/insertionBoundaries-B-yZI6iY.js +0 -1
  268. package/dist/assets/main-BfAN93rT.js +0 -169
  269. package/dist/assets/main-DYWwmI_W.js +0 -2
  270. package/dist/assets/mcpQueries-CehWHIB1.js +0 -1
  271. package/dist/assets/miniChat-BlkcLQBr.js +0 -2
  272. package/dist/assets/mobile-I3Xe5NtO.js +0 -2
  273. package/dist/assets/mobileBackNavigation-BFUH-c-G.js +0 -1
  274. package/dist/assets/mobileConnections-BFvtbJXX.js +0 -2
  275. package/dist/assets/multirun-DdEjp77z.js +0 -3
  276. package/dist/assets/pathNormalization-ewtPqJWn.js +0 -1
  277. package/dist/assets/platform-DMsFWy1a.js +0 -1
  278. package/dist/assets/projectActions-C-9Z8R7y.js +0 -1
  279. package/dist/assets/projectMeta-BKgum5WN.js +0 -1
  280. package/dist/assets/pwa-BvKUY4Hk.js +0 -2
  281. package/dist/assets/queue-abort-optimistic-BcbiNk8t.js +0 -1
  282. package/dist/assets/renderElectronMiniChatApp-DIjWdFHu.js +0 -2
  283. package/dist/assets/renderMobileApp-CE0QyOH0.js +0 -29
  284. package/dist/assets/runtime-file-resource-CL7EVzOG.js +0 -2
  285. package/dist/assets/runtimeConfig-uhjQn4kK.js +0 -2
  286. package/dist/assets/runtimeEndpointReset-DezNESKT.js +0 -149
  287. package/dist/assets/scheduledTaskNavigation-FMDNRUnX.js +0 -1
  288. package/dist/assets/sessionLookup-DzKZsy-W.js +0 -1
  289. package/dist/assets/sortable-tabs-strip-m5JQrTx4.js +0 -1
  290. package/dist/assets/src-HgtAe3Q4.css +0 -2
  291. package/dist/assets/terminalApi-DK4KmfFn.js +0 -1
  292. package/dist/assets/touch-gestures-CErgaXZ7.js +0 -1
  293. package/dist/assets/tour-DDI0Zg7l.js +0 -1
  294. package/dist/assets/useAppFontEffects-RpgNbjA4.css +0 -1
  295. package/dist/assets/useAssistantUIStore-nNYL140o.js +0 -1
  296. package/dist/assets/useDesktopWindowControlsLayout-C3M12PjJ.js +0 -1
  297. package/dist/assets/useEffectiveDirectory-Do4UqfZR.js +0 -1
  298. package/dist/assets/useFontPreferences-DxzruDDQ.js +0 -1
  299. package/dist/assets/useMobileNavigationStore-InwdmuDX.js +0 -17
  300. package/dist/assets/usePluginsStore-BH4-CNcj.js +0 -1
  301. package/dist/assets/useUIStore-vvNwcOk3.js +0 -1
  302. package/dist/assets/useWorkerHighlightedLines-0XahwAbS.js +0 -7
  303. package/dist/assets/vendor-motion-C9oiAdx-.js +0 -1
  304. package/dist/assets/vendor-reactuses-core-CuTmqEMK.js +0 -1
  305. package/dist/assets/vendor-tanstack-query-core-Y_YoRHtC.js +0 -1
  306. package/dist/assets/vendor-tanstack-react-query-B-Wpqq5J.js +0 -1
  307. /package/dist/assets/{sessionLookup-8C8nv-EP.css → reference-history-8C8nv-EP.css} +0 -0
@@ -12,7 +12,7 @@ import { createProjectDirectoryRuntime } from '../opencode/project-directory-run
12
12
  import { registerProjectsSkill, PROJECTS_SKILL_PATH } from './projects.js';
13
13
 
14
14
  describe('session project registration API', () => {
15
- let root, workspace, settingsPath, runtime, server, origin, getSession, binding, registerProject, shared, failWrites, tips;
15
+ let root, workspace, settingsPath, runtime, server, origin, getSession, binding, registerProject, shared, failWrites, tips, gateway;
16
16
  const auth = { Authorization: `Basic ${Buffer.from('opencode:fixture').toString('base64')}` };
17
17
  beforeEach(async () => {
18
18
  root = await fs.mkdtemp(path.join(os.tmpdir(), 'project-skill-'));
@@ -31,9 +31,11 @@ describe('session project registration API', () => {
31
31
  registerProject = vi.fn((input) => registry.register(input));
32
32
  getSession = vi.fn(async () => ({ metadata: { yuri: { scheduledTaskSkill: { hostOrigin: binding } } } }));
33
33
  const app = express();
34
+ gateway = { supported: true, acquireTask: vi.fn(), registerProject: vi.fn(), list: vi.fn(async () => ({ supported: true, hubId: 'hub', hosts: [], projects: [] })) };
34
35
  registerProjectsSkill(app, { express, getIsSharedOpenCodeService: () => shared, getOpenCodeAuthHeaders: () => auth,
35
36
  createClient: () => ({ session: { get: getSession } }), registerProject, readSettingsFromDiskStrict: runtime.readSettingsFromDiskStrict,
36
37
  sanitizeProjects: normalization.sanitizeProjects,
38
+ remoteHostGateway: gateway,
37
39
  });
38
40
  server = await new Promise((resolve) => { const s = app.listen(0, '127.0.0.1', () => resolve(s)); });
39
41
  origin = `http://127.0.0.1:${server.address().port}`; binding = origin;
@@ -86,6 +88,41 @@ describe('session project registration API', () => {
86
88
  expect(registerProject).not.toHaveBeenCalled();
87
89
  });
88
90
 
91
+ it('keeps remote discovery under the existing service and per-session admission gate', async () => {
92
+ expect(await (await request('describe')).json()).toMatchObject({ remoteSupported: true });
93
+ expect(await (await request('remote-projects')).json()).toEqual({ projects: [], failed: [], complete: true });
94
+ gateway.list.mockClear();
95
+ for (const headers of [{}, { Authorization: 'Bearer browser' }, { ...auth, Origin: origin }]) expect((await request('remote-projects', {}, headers)).status).toBe(403);
96
+ binding = 'http://127.0.0.1:1';
97
+ expect((await request('remote-projects')).status).toBe(403);
98
+ expect(gateway.list).not.toHaveBeenCalled();
99
+ expect(gateway.acquireTask).not.toHaveBeenCalled();
100
+ });
101
+
102
+ it('advertises and gates remote machine discovery and registration independently of local registration', async () => {
103
+ const target = { hubId: 'hub', hostId: 'host', instanceId: 'instance' };
104
+ const input = { target, path: '/remote/repo', label: 'Remote' };
105
+ const described = await (await request('describe')).json();
106
+ expect(described.inputs).toMatchObject({ 'remote-hosts': '{}', 'add-remote': expect.stringContaining('instanceId') });
107
+ expect(await (await request('remote-hosts')).json()).toEqual({ hosts: [], failed: [], complete: true });
108
+ gateway.registerProject.mockResolvedValue({ project: { id: 'remote-ref', path: input.path, hostId: target.hostId }, created: true });
109
+ expect(await (await request('add-remote', input)).json()).toMatchObject({ project: { id: 'remote-ref', path: input.path }, created: true, target });
110
+ expect(gateway.registerProject).toHaveBeenCalledExactlyOnceWith('host', { path: input.path, label: 'Remote' }, { instanceId: 'instance', signal: expect.any(AbortSignal) });
111
+ expect(registerProject).not.toHaveBeenCalled();
112
+ for (const value of [{ ...input, path: 'relative' }, { ...input, target: { hostId: 'host' } }, { ...input, label: '' }, { ...input, activate: true }]) expect((await request('add-remote', value)).status).toBe(400);
113
+ for (const operation of ['remote-hosts', 'add-remote']) {
114
+ for (const headers of [{}, { Authorization: 'Bearer browser' }, { ...auth, Origin: origin }]) expect((await request(operation, operation === 'add-remote' ? input : {}, headers)).status).toBe(403);
115
+ }
116
+ gateway.registerProject.mockRejectedValueOnce(new Error('private-token /local/path'));
117
+ const failed = await request('add-remote', input);
118
+ expect(failed.status).toBe(503);
119
+ expect(await failed.text()).not.toMatch(/private-token|local\/path/);
120
+ binding = 'http://127.0.0.1:1';
121
+ expect((await request('add-remote', input)).status).toBe(403);
122
+ expect((await request('remote-hosts')).status).toBe(403);
123
+ expect(gateway.registerProject).toHaveBeenCalledTimes(2);
124
+ });
125
+
89
126
  it('never reports corrupt reads or failed persistence as successful empty or added results', async () => {
90
127
  for (const corrupt of ['{broken', '[]', 'null', '{"projects":{}}']) {
91
128
  await fs.writeFile(settingsPath, corrupt);
@@ -100,4 +137,32 @@ describe('session project registration API', () => {
100
137
  expect(await fs.readFile(settingsPath, 'utf8')).toBe('{"projects":[]}');
101
138
  expect(tips).not.toHaveBeenCalled();
102
139
  });
140
+
141
+ it('releases remote task demand when the bound caller disconnects', async () => {
142
+ const target = { hubId: 'hub', hostId: 'host', instanceId: 'instance' };
143
+ let entered;
144
+ const started = new Promise((resolve) => { entered = resolve; });
145
+ let released;
146
+ const stopped = new Promise((resolve) => { released = resolve; });
147
+ const release = vi.fn(released);
148
+ gateway.assertProjectDirectory = vi.fn();
149
+ gateway.acquireTask.mockImplementation(async (_id, { signal }) => ({ target, release,
150
+ request: async () => {
151
+ entered();
152
+ await new Promise((_resolve, reject) => {
153
+ signal.addEventListener('abort', () => reject(signal.reason), { once: true });
154
+ });
155
+ },
156
+ }));
157
+ const controller = new AbortController();
158
+ const pending = fetch(`${origin}${PROJECTS_SKILL_PATH}`, { method: 'POST', signal: controller.signal,
159
+ headers: { 'content-type': 'application/json', ...auth },
160
+ body: JSON.stringify({ sessionID: 'ses_one', operation: 'sessions', input: { target, directory: '/repo' } }),
161
+ }).catch(() => null);
162
+ await started;
163
+ controller.abort();
164
+ await pending;
165
+ await stopped;
166
+ expect(release).toHaveBeenCalledOnce();
167
+ });
103
168
  });
@@ -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 project registration, 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 is unavailable through this session skill.';
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.';
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, 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), 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
  }
@@ -54,6 +54,10 @@ describe('built-in customization instructions', () => {
54
54
  const projectFile = JSON.parse(projectEntry.match(/read (".*?") first/)[1]);
55
55
  expect(projectFile).not.toBe(boundFile);
56
56
  expect(projectEntry).toContain('Bound project helper:');
57
+ expect(projectEntry).toContain('local/remote project registration');
58
+ expect(projectEntry).toContain('discovering authorized remote machines');
59
+ expect(await fs.readFile(path.join(path.dirname(projectFile), 'references', 'projects.md'), 'utf8')).toContain('commands.add-remote');
60
+ expect(await fs.readFile(path.join(path.dirname(projectFile), 'projects.mjs'), 'utf8')).toContain("'remote-hosts', 'add-remote'");
57
61
  expect(projectEntry).toContain('No bound SSH/Relay command is provided');
58
62
  expect(await fs.readFile(path.join(path.dirname(projectFile), 'projects.mjs'), 'utf8')).toContain('/api/yuri/session-skills/projects');
59
63
  await expect(fs.stat(path.join(path.dirname(projectFile), 'remote-connections.mjs'))).rejects.toMatchObject({ code: 'ENOENT' });
@@ -1,12 +1,14 @@
1
1
  ---
2
2
  name: yuri-customization
3
- description: Add existing directories as Yuri projects through its API, 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, 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 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
+
10
12
  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.
11
13
 
12
14
  ## Workflow
@@ -1,11 +1,11 @@
1
- # Add a project
1
+ # Projects
2
2
 
3
3
  Register an existing directory through the **bound project API helper** in this
4
4
  session's Yuri customization pointer. This is a Host capability, not a GUI plugin
5
5
  or a desktop deep link. Registration does not create files, clone a repository,
6
6
  open a conversation or switch an existing active project.
7
7
 
8
- ## Workflow
8
+ ## Local project registration
9
9
 
10
10
  1. Resolve the user-requested directory to an absolute path on the bound Yuri
11
11
  Host. Reuse a known directory; directory creation/cloning is a separate action
@@ -41,7 +41,7 @@ workflow until a new supported session's bound describe succeeds.
41
41
  ## Interface and scope
42
42
 
43
43
  The helper calls `POST /api/yuri/session-skills/projects` with
44
- `{sessionID, operation: "describe" | "list" | "add", input}`. It uses the same
44
+ `{sessionID, operation, input}`, using operations returned by `describe`. It uses the same
45
45
  loopback service authentication and admitted-session Host binding as the other
46
46
  built-in session helpers. Only affected project metadata is returned, never full
47
47
  settings or credentials. Use the bound command rather than reconstructing auth or
@@ -61,3 +61,30 @@ this file. Contacts may instead have their own granted `yuri.projects` tools;
61
61
  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
+
65
+ ## Connected remote projects and sessions
66
+
67
+ 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.
68
+
69
+ 1. Run the exact bound project `describe` command. Continue only when `remoteSupported:true`; use its returned commands unchanged. No bound helper or a terminal auth error means stop this branch.
70
+ 2. Choose the target from authenticated discovery:
71
+ - Existing projects: `commands.remote-projects` returns each project with `target:{hubId,hostId,instanceId}` and its raw `path`.
72
+ - A new remote project: `commands.remote-hosts` returns authorized machines as `{name,source,target}`, including machines with no project yet. Match the user's machine to this result; ask when ambiguous. `failed` and `complete:false` mean discovery is partial, not an empty catalog. Recover a failed connection rather than guessing another target.
73
+ - Keep all three target identities with the path and session ID; identical paths/IDs on different Hosts are separate resources. Use returned identities unchanged, not a hostname or SSH address as an ID.
74
+ 3. To register an existing remote directory, run `commands.add-remote` with JSON on stdin:
75
+
76
+ ```json
77
+ {"target":{"hubId":"<returned hubId>","hostId":"<returned hostId>","instanceId":"<returned instanceId>"},"path":"/workspace/my-project","label":"My remote project"}
78
+ ```
79
+
80
+ - Input: `path` is a literal absolute path on that machine (POSIX or Windows); `label` is optional, at most 80 characters. The remote Host validates/canonicalizes and registers it, then the Hub saves its sidebar reference and notifies connected clients.
81
+ - Completion: success returns `{project,created,target}`; `created:false` means the Hub reference already existed. Use the returned canonical `project.path` for session operations. Registration preserves the active project and does not open a session.
82
+ - Recovery: if interrupted or Hub persistence fails, retry the same target/path. The remote project is retained and registration deduplicates it. No local directory check, clone or filesystem creation is part of this operation.
83
+ 4. Supply JSON on stdin to the session operation requested by the user:
84
+ - `sessions`: `{target,directory,cursor?}` returns up to 20 metadata rows and `nextCursor`.
85
+ - `read-session`: `{target,directory,sessionID,cursor?}` returns session metadata plus a bounded, transient message page. Follow its continuation receipt to read more; do not copy raw tool output into Hub history, files or caches.
86
+ - `create-session`: `{target,directory,sessionID,title?}` creates an empty worker. Generate a new caller-owned session ID once and retain it through recovery. Read that same ID after an interrupted response before attempting another creation.
87
+ - `prompt-session`: `{target,directory,sessionID,messageID,text}` continues that exact worker. Generate a message ID once. `admitted:true` confirms submission, not task completion; use `read-session` for the outcome. After an ambiguous timeout inspect the same session/message ID before any retry; never resend with a new ID automatically.
88
+ 5. Report only confirmed outcomes. An unavailable/mismatched target fails explicitly and retains the original reference; recover that connection or ask the user, never retry against the local Host or another connection.
89
+
90
+ Remote session operations require a registered project scope; `add-remote` establishes that scope on an existing authorized connection. These operations do not configure SSH, synchronize credentials, pair Relay, clone, create directories, select the UI project or obtain new machine access. For a machine not yet authorized, first follow the separate [SSH/Relay workflow](remote-connections.md) with its own bound local desktop helper. After setup completes, rediscover the authenticated target through `remote-hosts`; a project helper alone does not grant that connection permission.
@@ -11,10 +11,23 @@ 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
+ 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
+
14
16
  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.
15
17
 
16
18
  Remote Magpie startup reuses a healthy gateway or the `yuri-magpie` tmux session. Automatic startup requires a POSIX target with tmux. No desktop environment is needed. Missing tmux, gateway health failure or sync failure leaves a working SSH connection intact with warnings; retry setup after fixing that target. Configuration/accounts already applied remain and existing sync backup rules apply. External/probe-only SSH instances are not modified by this workflow.
17
19
 
20
+ ### Reconnection and update acceptance
21
+
22
+ For managed SSH connections, report these checks separately. Use the bound helper or Settings → Remote instances; the availability gate below still applies.
23
+
24
+ - **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
+ - **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
+ - **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.
27
+ - **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
+
29
+ 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.
30
+
18
31
  ## Relay pairing
19
32
 
20
33
  Pipe `{}` to `pair` to create a one-time Relay link for **this local desktop**. Use `{"id":"<ready SSH instance>"}` to create one on that remote Host instead. An explicitly requested Relay endpoint can be supplied as `relayUrl`; `label` names the pairing. The normal Host pairing API owns expiry, redemption, Relay enablement and authorization.
@@ -8,6 +8,10 @@ Assistant text delivery parts may carry the optional boolean `synthetic` marker.
8
8
 
9
9
  ## Authority modes: shadow / active / cutover
10
10
 
11
+ Remote Project queue calls execute on the target through the Host-prefixed
12
+ Gateway. This local service rejects serialized remote Location/session identities
13
+ before admission, so their content cannot accidentally enter the Hub queue DB.
14
+
11
15
  Runtime authority is durable per runtime through `getQueueAuthority`/`setQueueAuthority` (`shadow`, `active`, `paused`) with generation CAS, activation epoch, timestamp, manifest hash, and protocol 4.
12
16
 
13
17
  | Authority | Role |
@@ -57,6 +57,7 @@ const fail = (code) => { throw new MessageQueueError(code); };
57
57
  const plainObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value) && (Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
58
58
  const normalizeDirectory = (value) => {
59
59
  if (typeof value !== 'string' || !value.trim()) return null;
60
+ if (value.startsWith('yuri-remote-location:')) return null;
60
61
  const normalized = value.trim().replace(/\\/g, '/').replace(/\/+$/, '') || '/';
61
62
  return normalized.length <= MAX_PATH ? normalized : null;
62
63
  };
@@ -321,7 +322,7 @@ export const createMessageQueueService = ({ dbPath, getRuntimeConfig = () => nul
321
322
  const validateAdmission = (input) => {
322
323
  const item = input?.item;
323
324
  if (!plainObject(input) || Object.keys(input).some((key) => !ADMISSION_KEYS.has(key)) || !plainObject(input.scope) || Object.keys(input.scope).some((key) => !SCOPE_KEYS.has(key)) || !plainObject(item) || Object.keys(item).some((key) => !ITEM_KEYS.has(key))) fail('validation_error');
324
- if (!normalizeDirectory(input.scope.directory) || !nonEmptyString(input.scope.sessionID) || !nonEmptyString(item.queueItemID) || !nonEmptyString(item.operationID) || !nonEmptyString(item.messageID) || typeof item.content !== 'string' || item.content.length > MAX_CONTENT || !Number.isInteger(item.createdAt) || item.createdAt < 0) fail('validation_error');
325
+ if (!normalizeDirectory(input.scope.directory) || !nonEmptyString(input.scope.sessionID) || input.scope.sessionID.startsWith('yuri-remote-session:') || !nonEmptyString(item.queueItemID) || !nonEmptyString(item.operationID) || !nonEmptyString(item.messageID) || typeof item.content !== 'string' || item.content.length > MAX_CONTENT || !Number.isInteger(item.createdAt) || item.createdAt < 0) fail('validation_error');
325
326
  const attachments = validateAttachments(item); const composerAttachmentIdentities = validateComposer(item.composerDocument, item.content); validateComposerMentions(item.composerMentions, item.composerDocument); validateSendConfig(item.sendConfig); validateDeliveryParts(item.deliveryParts, false, { migrationImport: item.migrationImport === true }); validateAssistantAttachmentParts(item.deliveryParts, attachments, { migrationImport: item.migrationImport === true }); validateSyntheticParts(item.syntheticParts, attachments, item.deliveryParts); captureDeliveryTarget(item.deliveryTarget, input.scope, item);
326
327
  if (item.dueAt !== undefined && (!Number.isSafeInteger(item.dueAt) || item.dueAt < 0)) fail('validation_error');
327
328
  if (item.migrationState !== undefined) {
@@ -46,6 +46,17 @@ const createV1Fixture = (pathname, version = '1') => {
46
46
  };
47
47
 
48
48
  describe('message queue service', () => {
49
+ it('rejects remote location/session identities without retaining queue content', () => {
50
+ const service = createService(dbPath());
51
+ try {
52
+ for (const scope of [
53
+ { directory: 'yuri-remote-location:["hub","host","/repo"]', sessionID: 's' },
54
+ { directory: '/repo', sessionID: 'yuri-remote-session:["hub","host","s"]' },
55
+ ]) expect(() => service.admit({ ...admission(), scope })).toThrow(expect.objectContaining({ code: 'validation_error' }));
56
+ expect(service.snapshot().revision).toBe(0);
57
+ } finally { service.close(); }
58
+ });
59
+
49
60
  it('persists message attempts and replays identical receipts after restart', () => {
50
61
  const pathname = dbPath();
51
62
  const first = createService(pathname);
@@ -46,6 +46,7 @@ export const createNotificationEmitterRuntime = (dependencies) => {
46
46
  desktopNotifyPrefix,
47
47
  getUiNotificationClients,
48
48
  getBroadcastGlobalUiEvent,
49
+ getInstanceId,
49
50
  // Optional: in-process desktop shells (Electron main) inject a callback so
50
51
  // notifications are delivered as a direct function call instead of a stdout
51
52
  // stringly-typed IPC.
@@ -107,6 +108,8 @@ export const createNotificationEmitterRuntime = (dependencies) => {
107
108
  };
108
109
 
109
110
  const emitDesktopNotification = (payload) => {
111
+ const instanceId = getInstanceId?.();
112
+ if (instanceId && payload && typeof payload === 'object') payload = { ...payload, instanceId };
110
113
  const desktopNotifyEnabled = getDesktopNotifyEnabled();
111
114
  if (!desktopNotifyEnabled) {
112
115
  return false;
@@ -138,6 +141,8 @@ export const createNotificationEmitterRuntime = (dependencies) => {
138
141
  };
139
142
 
140
143
  const broadcastUiNotification = (payload, options = {}) => {
144
+ const instanceId = getInstanceId?.();
145
+ if (instanceId && payload && typeof payload === 'object') payload = { ...payload, instanceId };
141
146
  const desktopNotifyEnabled = getDesktopNotifyEnabled();
142
147
  if (!payload || typeof payload !== 'object') {
143
148
  return;
@@ -3,6 +3,34 @@
3
3
  ## Purpose
4
4
  This module provides OpenCode server integration utilities for the web server runtime, including configuration management and provider authentication.
5
5
 
6
+ ## Hub-only project layout and discovery
7
+
8
+ Production settings routes receive a synchronous SQLite projection from the
9
+ current Remote Host store. Full settings and both bootstrap variants expose
10
+ read-only `hasRemoteProjects:boolean`; clients cannot persist or override it.
11
+ Bootstrap excludes layout and project/Host contents. The projection creates no
12
+ upstream IO, timer or subscription. Reference changes invalidate through the
13
+ existing safe `yuri:project-order-changed` global event.
14
+
15
+ Full GET/PUT `/api/config/settings` exposes `hubProjectLayout`:
16
+ `{hubId:string, order:string[], collapsed:Record<string,boolean>}`. IDs identify
17
+ local projects or current-Hub remote references, never remote paths or remote
18
+ project IDs. Missing layout reads as current Hub + empty order/map. A foreign
19
+ Hub layout is not projected; writes with the wrong Hub ID return 409. Malformed
20
+ shape/capacity returns 400 before commit. Each list/map is bounded to 10,000
21
+ entries and each ID to 512 characters.
22
+
23
+ The existing settings write lock reads strict disk state and merges incoming
24
+ order first, then omitted previous order entries; collapse merges by key (false
25
+ explicitly expands). This is layout only, not collection replacement: omitted
26
+ projects/references are never removed. Local filesystem validation is not run
27
+ on layout IDs and no layout is written upstream. Concurrent saves serialize;
28
+ failed or unchanged saves emit no order tip, and failed writes preserve the
29
+ previous atomic settings file. Existing local `projects` update validation is
30
+ unchanged. After a changed commit, existing `yuri:project-order-changed` prompts
31
+ other clients to fetch current settings. A write may contain only layout; do not
32
+ serialize remote paths into `projects`.
33
+
6
34
  OpenCode upstream calls are V2-only: startup/readiness probes use `/api/info`
7
35
  without a legacy health fallback. Both Host SSE entrypoints forward upstream
8
36
  to `/api/event`; the Host-owned global WebSocket route is unchanged. Status
@@ -10,6 +38,12 @@ diagnostics use provider/location/session-active V2 routes and location query
10
38
  encoding, not removed V1 endpoints.
11
39
 
12
40
  ## Entrypoints and structure
41
+ - `v2-client.js` retains default Hub-local runtime write admission. Its internal
42
+ `executionAdmission: 'target-yuri-proxy'` option requires an explicit scoped
43
+ transport and delegates admission to an authenticated target Yuri proxy, never
44
+ to a guessed OpenCode endpoint. `../remote-hosts/task-client.js` is the shared
45
+ official SDK factory for that boundary; Assistant and bound-project helpers use
46
+ it instead of copying SDK requests or inheriting the Hub's runtime contract.
13
47
  - `feature-routes-runtime.js` registers the Host-owned history importer before
14
48
  the generic proxy, using the official client, project registry and session
15
49
  index. Its domain contract is in `../history-import/DOCUMENTATION.md`.
@@ -4,6 +4,18 @@ import { REMOTE_CONNECTIONS_SKILL_PATH } from '../gui-customization/remote-conne
4
4
  import { PROJECTS_SKILL_PATH } from '../gui-customization/projects.js';
5
5
  import { MESSAGE_QUEUE_ADMISSION_HTTP_MAX_BYTES } from '../message-queue/service.js';
6
6
 
7
+ const decodeRequestPathForClassification = (pathname) => typeof pathname === 'string'
8
+ ? pathname.replace(/%([a-f0-9]{2})/gi, (_match, hex) => String.fromCharCode(Number.parseInt(hex, 16))) : '';
9
+ const isFilePreviewRequestPath = (pathname) => /^\/api\/(?:hosts\/[^/]+\/api\/)?preview\/proxy\/[^/]+\/_file(?:\/|$)/i
10
+ .test(decodeRequestPathForClassification(pathname));
11
+
12
+ export const redactRequestPathForLog = (pathname) => {
13
+ if (isFilePreviewRequestPath(pathname)) return '/api/preview/proxy/_file/[preview]/[url-auth]/[resource]';
14
+ // Invalid envelopes can still contain credentials; never log a preview tail.
15
+ if (/\/api\/preview\/proxy(?:\/|$)/i.test(decodeRequestPathForClassification(pathname))) return '/api/preview/proxy/[redacted]';
16
+ return typeof pathname === 'string' ? pathname : '';
17
+ };
18
+
7
19
  const parseLoopbackUrl = (rawUrl) => {
8
20
  if (typeof rawUrl !== 'string') {
9
21
  return null;
@@ -669,7 +681,7 @@ export const registerAuthAndAccessRoutes = (app, dependencies) => {
669
681
  // preview proxy validates against the registered target id/TTL. Let those
670
682
  // requests reach that stricter check instead of failing the global UI auth
671
683
  // gate when the short-lived browser URL auth token expires.
672
- if (getRequestPathname(req).startsWith('/api/preview/proxy/') && hasPreviewProxyCredential(req)) {
684
+ if (requestPathname.startsWith('/api/preview/proxy/') && !isFilePreviewRequestPath(requestPathname) && hasPreviewProxyCredential(req)) {
673
685
  return next();
674
686
  }
675
687
 
@@ -1250,7 +1262,7 @@ export const registerCommonRequestMiddleware = (app, dependencies) => {
1250
1262
 
1251
1263
  app.use((req, _res, next) => {
1252
1264
  if (verboseRequestLogs) {
1253
- console.log(`${new Date().toISOString()} - ${req.method} ${req.path}`);
1265
+ console.log(`${new Date().toISOString()} - ${req.method} ${redactRequestPathForLog(req.path)}`);
1254
1266
  }
1255
1267
  next();
1256
1268
  });
@@ -328,6 +328,30 @@ describe('core-routes', () => {
328
328
  expect(dependencies.gracefulShutdown).not.toHaveBeenCalled();
329
329
  });
330
330
 
331
+ it('redacts preview path credentials before verbose request logging, including malformed envelopes', async () => {
332
+ const log = vi.spyOn(console, 'log').mockImplementation(() => {});
333
+ const app = express();
334
+ registerCommonRequestMiddleware(app, { express, verboseRequestLogs: true });
335
+ app.use((_req, res) => res.status(204).end());
336
+ const previewToken = 'c'.repeat(32);
337
+ const urlToken = `yuri_url_${'d'.repeat(32)}`;
338
+ const suffix = `${previewToken}/${urlToken}/index.html`;
339
+ try {
340
+ for (const route of [
341
+ `/api/preview/proxy/${'a'.repeat(32)}/_file/${suffix}`,
342
+ `/api/hosts/remote/api/preview/proxy/bad-id/_file/${suffix}`,
343
+ `/api/preview/proxy/bad-id/%5Ffile/${suffix}`,
344
+ `/api/preview/proxy/bad-id/malformed/${suffix}`,
345
+ ]) await request(app).get(route).expect(204);
346
+ const output = log.mock.calls.map((args) => args.join(' ')).join('\n');
347
+ expect(log).toHaveBeenCalledTimes(4);
348
+ expect(output).not.toContain(previewToken);
349
+ expect(output).not.toContain(urlToken);
350
+ expect(output).toContain('[preview]/[url-auth]');
351
+ expect(output).toContain('[redacted]');
352
+ } finally { log.mockRestore(); }
353
+ });
354
+
331
355
  // Global raw config saves send { content: "<jsonc string>" }. Without this
332
356
  // prefix in the JSON middleware allowlist, PUT arrives with an empty body and
333
357
  // the handler rejects with "Configuration content must be a string".
@@ -1322,6 +1346,10 @@ describe('core-routes', () => {
1322
1346
  .get('/api/yuri/transcript-cache/session?yuri_preview_token=preview-secret')
1323
1347
  .expect(401, 'Authentication required');
1324
1348
  expect(requireAuth).toHaveBeenCalledTimes(2);
1349
+ for (const suffix of ['_file/target-token/-/index.html', '_file', '%5Ffile/bad-target/live-token/file.html']) {
1350
+ await request(app).get(`/api/preview/proxy/abc123/${suffix}?yuri_preview_token=arbitrary`)
1351
+ .set('Cookie', 'yuri_preview_token=arbitrary').expect(401, 'Authentication required');
1352
+ }
1325
1353
  });
1326
1354
 
1327
1355
  it('requires the managed bridge capability independently from UI auth', async () => {
@@ -66,7 +66,8 @@ import { scanClawdHubPage } from '../skills-catalog/clawdhub/scan.js';
66
66
  import { installSkillsFromClawdHub } from '../skills-catalog/clawdhub/install.js';
67
67
 
68
68
  /** Fan-out an Yuri product SSE tip to every /api/yuri/events client. */
69
- export const createYuriEventBroadcaster = ({ getYuriEventClients, writeSseEvent }) => (event) => {
69
+ export const createYuriEventBroadcaster = ({ getYuriEventClients, writeSseEvent, onEvent }) => (event) => {
70
+ onEvent?.(event);
70
71
  const clients = getYuriEventClients();
71
72
  for (const client of clients) {
72
73
  try {
@@ -184,6 +185,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
184
185
  }
185
186
 
186
187
  registerOpenCodeRoutes(app, {
188
+ getRemoteProjectState: routeDependencies.getRemoteProjectState,
187
189
  crypto,
188
190
  clientReloadDelayMs,
189
191
  getOpenCodeResolutionSnapshot,
@@ -305,6 +307,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
305
307
  await refreshAssistantAllowedRoots();
306
308
  const projectRegistry = createProjectRegistry({ persistSettings, validateDirectoryPath });
307
309
  registerProjectsSkill(app, {
310
+ remoteHostGateway: routeDependencies.remoteHostGateway,
308
311
  express, getIsSharedOpenCodeService, getOpenCodeAuthHeaders,
309
312
  createClient: () => makeOpenCodeV2Client({ baseUrl: buildOpenCodeUrl('/', ''), authHeaders: getOpenCodeAuthHeaders(), getRuntimeContract }),
310
313
  registerProject: (input) => projectRegistry.register(input), readSettingsFromDiskStrict, sanitizeProjects,
@@ -338,6 +341,7 @@ export const createFeatureRoutesRuntime = (dependencies) => {
338
341
  onSystemSessionPersisted,
339
342
  });
340
343
  assistantRoutesRuntime = registerAssistantRoutes(app, {
344
+ remoteHostGateway: routeDependencies.remoteHostGateway,
341
345
  yuriDataDir,
342
346
  dbPath: path.join(yuriDataDir, 'assistants.sqlite'),
343
347
  buildOpenCodeUrl,
@@ -499,6 +503,9 @@ export const createFeatureRoutesRuntime = (dependencies) => {
499
503
  const broadcastYuriEvent = createYuriEventBroadcaster({
500
504
  getYuriEventClients,
501
505
  writeSseEvent,
506
+ onEvent: (event) => {
507
+ if (/^yuri:session-(unread|order|folders)-changed$/.test(event?.type || '')) broadcastGlobalUiEvent?.(event);
508
+ },
502
509
  });
503
510
  sessionUnreadRuntime = createSessionUnreadRuntime({
504
511
  store: createSessionUnreadStore({
@@ -748,6 +748,7 @@ export const registerOpenCodeProxy = (app, deps) => {
748
748
 
749
749
  if (subscribeGlobalUiEvent) {
750
750
  unsubscribeHostEvents = subscribeGlobalUiEvent((payload, options = {}) => {
751
+ if (options.targetFilter && !options.targetFilter(res)) return;
751
752
  const envelope = { directory: options.directory || 'global', payload };
752
753
  const block = `data: ${JSON.stringify(envelope)}\n\n`;
753
754
  const filtered = outboundSseFilter ? filterSseBlock(block, outboundSseFilter) : block;
@@ -38,6 +38,7 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
38
38
  readSettingsFromDisk,
39
39
  readSettingsFromDiskMigrated,
40
40
  persistSettings,
41
+ getRemoteProjectState = () => null,
41
42
  validateDirectoryPath,
42
43
  resolveProjectDirectory,
43
44
  getProviderSources,
@@ -63,6 +64,13 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
63
64
  } = dependencies;
64
65
 
65
66
  const upgradeOperation = createUpgradeOperationState();
67
+ const projectSettingsResponse = (response) => {
68
+ const state = getRemoteProjectState();
69
+ if (!state) return response;
70
+ return { ...response, hasRemoteProjects: state.hasRemoteProjects,
71
+ hubProjectLayout: response.hubProjectLayout?.hubId === state.hubId ? response.hubProjectLayout
72
+ : { hubId: state.hubId, order: [], collapsed: {} } };
73
+ };
66
74
  const resolveDataDir = () => yuriDataDir || resolveYuriDataDir();
67
75
 
68
76
  let authLibrary = null;
@@ -296,7 +304,7 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
296
304
  app.get('/api/config/settings', async (req, res) => {
297
305
  try {
298
306
  const settings = await readSettingsFromDiskMigrated();
299
- const response = formatSettingsResponse(settings);
307
+ const response = projectSettingsResponse(formatSettingsResponse(settings));
300
308
  res.json(req.query?.bootstrap === 'true' ? projectBootstrapSettingsResponse(response) : response);
301
309
  } catch (error) {
302
310
  console.error('Failed to read settings:', error);
@@ -307,7 +315,7 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
307
315
  app.get('/api/config/settings/bootstrap', async (_req, res) => {
308
316
  try {
309
317
  const settings = await readSettingsFromDiskMigrated();
310
- const response = formatSettingsResponse(settings);
318
+ const response = projectSettingsResponse(formatSettingsResponse(settings));
311
319
  res.json(projectBootstrapSettingsResponse(response));
312
320
  } catch (error) {
313
321
  console.error('Failed to read bootstrap settings:', error);
@@ -610,7 +618,13 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
610
618
  app.put('/api/config/settings', async (req, res) => {
611
619
  try {
612
620
  const changes = req.body ?? {};
613
- const updated = await persistSettings(changes);
621
+ if (Object.hasOwn(changes, 'hubProjectLayout')) {
622
+ const state = getRemoteProjectState();
623
+ if (typeof changes.hubProjectLayout?.hubId !== 'string') return res.status(400).json({ error: 'Invalid Hub project layout' });
624
+ if (!state || changes.hubProjectLayout.hubId !== state.hubId) return res.status(409).json({ error: 'Hub project layout belongs to another Hub' });
625
+ }
626
+ const updated = projectSettingsResponse(await persistSettings(changes));
627
+ if (Object.prototype.hasOwnProperty.call(changes, 'projects')) app.emit('yuri:projects-changed');
614
628
  // Only after a successful persist — failed saves must not apply runtime flags.
615
629
  if (
616
630
  typeof onSettingsPersisted === 'function'
@@ -626,7 +640,7 @@ export const registerOpenCodeRoutes = (app, dependencies) => {
626
640
  } catch (error) {
627
641
  console.error('[API:PUT /api/config/settings] Failed to save settings:', error);
628
642
  console.error('[API:PUT /api/config/settings] Error stack:', error.stack);
629
- res.status(500).json({ error: 'Failed to save settings' });
643
+ res.status(error?.status === 400 ? 400 : 500).json({ error: 'Failed to save settings' });
630
644
  }
631
645
  });
632
646
 
@@ -37,6 +37,28 @@ const createDependencies = ({ formatSettingsResponse }) => ({
37
37
  });
38
38
 
39
39
  describe('settings route', () => {
40
+ it('projects SQLite discovery and current-Hub layout without reformatting persisted public settings', async () => {
41
+ let hasRemoteProjects = false;
42
+ const dependencies = createDependencies({ formatSettingsResponse: vi.fn(() => ({ hasRemoteProjects: true,
43
+ hubProjectLayout: { hubId: 'foreign', order: ['other'], collapsed: {} } })) });
44
+ dependencies.getRemoteProjectState = () => ({ hubId: 'hub', hasRemoteProjects });
45
+ dependencies.persistSettings.mockResolvedValue({ hasSummaryCustomAPIToken: true,
46
+ hubProjectLayout: { hubId: 'hub', order: ['local'], collapsed: {} } });
47
+ const app = express(); app.use(express.json()); registerOpenCodeRoutes(app, dependencies);
48
+ const cold = await request(app).get('/api/config/settings/bootstrap').expect(200);
49
+ expect(cold.body).toEqual({ schemaVersion: 1, hasRemoteProjects: false });
50
+ hasRemoteProjects = true;
51
+ expect((await request(app).get('/api/config/settings?bootstrap=true').expect(200)).body.hasRemoteProjects).toBe(true);
52
+ expect((await request(app).get('/api/config/settings').expect(200)).body.hubProjectLayout)
53
+ .toEqual({ hubId: 'hub', order: [], collapsed: {} });
54
+ const layout = { hubId: 'hub', order: ['local'], collapsed: {} };
55
+ const written = await request(app).put('/api/config/settings').send({ hubProjectLayout: layout }).expect(200);
56
+ expect(written.body).toMatchObject({ hasSummaryCustomAPIToken: true, hasRemoteProjects: true, hubProjectLayout: layout });
57
+ expect(dependencies.formatSettingsResponse).toHaveBeenCalledTimes(3);
58
+ dependencies.persistSettings.mockClear();
59
+ await request(app).put('/api/config/settings').send({ hubProjectLayout: { ...layout, hubId: 'foreign' } }).expect(409);
60
+ expect(dependencies.persistSettings).not.toHaveBeenCalled();
61
+ });
40
62
  it('returns the full formatted response without the bootstrap query', async () => {
41
63
  const formatted = { themeId: 'default', summaryCustomAPIToken: 'response-secret-sentinel' };
42
64
  const formatSettingsResponse = vi.fn(() => formatted);
@@ -26,6 +26,7 @@ export const projectBootstrapSettingsResponse = (response) => {
26
26
  copyString('defaultVariant');
27
27
  copyString('defaultAgent');
28
28
  copyBoolean('autoCreateWorktree');
29
+ copyBoolean('hasRemoteProjects');
29
30
  copyBoolean('gitmojiEnabled');
30
31
  copyBoolean('defaultFileViewerPreview');
31
32
  copyString('zenModel');
@@ -180,6 +181,20 @@ export const createSettingsHelpers = (dependencies) => {
180
181
  const candidate = payload;
181
182
  const result = {};
182
183
 
184
+ if (Object.hasOwn(candidate, 'hubProjectLayout')) {
185
+ const layout = candidate.hubProjectLayout;
186
+ const validId = (id) => typeof id === 'string' && id.length > 0 && id.length <= 512;
187
+ if (!layout || typeof layout !== 'object' || Array.isArray(layout)
188
+ || !validId(layout.hubId) || !Array.isArray(layout.order) || layout.order.length > 10000
189
+ || !layout.order.every(validId) || !layout.collapsed || typeof layout.collapsed !== 'object'
190
+ || Array.isArray(layout.collapsed) || Object.keys(layout.collapsed).length > 10000
191
+ || !Object.entries(layout.collapsed).every(([id, value]) => validId(id) && typeof value === 'boolean')) {
192
+ throw Object.assign(new Error('Invalid Hub project layout'), { status: 400 });
193
+ }
194
+ result.hubProjectLayout = { hubId: layout.hubId, order: [...new Set(layout.order)],
195
+ collapsed: Object.fromEntries(Object.entries(layout.collapsed)) };
196
+ }
197
+
183
198
  if (typeof candidate.themeId === 'string' && candidate.themeId.length > 0) {
184
199
  result.themeId = candidate.themeId;
185
200
  }
@@ -904,6 +919,17 @@ export const createSettingsHelpers = (dependencies) => {
904
919
  typographySizes: nextTypographySizes
905
920
  };
906
921
 
922
+ if (changes.hubProjectLayout) {
923
+ const incoming = changes.hubProjectLayout;
924
+ const prior = current.hubProjectLayout?.hubId === incoming.hubId ? current.hubProjectLayout : null;
925
+ next.hubProjectLayout = { hubId: incoming.hubId,
926
+ order: [...new Set([...incoming.order, ...(prior?.order || [])])],
927
+ collapsed: { ...prior?.collapsed, ...incoming.collapsed } };
928
+ if (next.hubProjectLayout.order.length > 10000 || Object.keys(next.hubProjectLayout.collapsed).length > 10000) {
929
+ throw Object.assign(new Error('Hub project layout exceeds capacity'), { status: 400 });
930
+ }
931
+ }
932
+
907
933
  return next;
908
934
  };
909
935