@yuriai/web 0.2.40-beta.4 → 0.2.40-beta.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (263) hide show
  1. package/dist/assets/{AgentAvatar-BmT_6apW.js → AgentAvatar-B7KbxN8Y.js} +1 -1
  2. package/dist/assets/AssistantConversationSurface-BnK_KTBO.js +3 -0
  3. package/dist/assets/{AssistantUnreadBadge-C34eOGCL.js → AssistantUnreadBadge-vu4ZhTft.js} +1 -1
  4. package/dist/assets/{AssistantView-0nXkM9VG.js → AssistantView-CEfEWUIr.js} +1 -1
  5. package/dist/assets/DiagramView-Dlzr08J_.js +1 -0
  6. package/dist/assets/{FadeInOnReveal-CCVdl9Vt.js → FadeInOnReveal-DMRmNsau.js} +1 -1
  7. package/dist/assets/{GuiPluginPage-BMt5AMqg.js → GuiPluginPage-DVug4z_p.js} +1 -1
  8. package/dist/assets/GuiPluginSurface-L43o6Xv8.js +1 -0
  9. package/dist/assets/{GuiPluginWindow-BVvzrnp1.js → GuiPluginWindow-tHXkS18H.js} +1 -1
  10. package/dist/assets/{Icon-B5nBc6dO.js → Icon-DizeYahT.js} +1 -1
  11. package/dist/assets/{ImageLoadingPlaceholder-Bv5mmf2U.js → ImageLoadingPlaceholder-BZC5m_km.js} +1 -1
  12. package/dist/assets/LoadingImage-Csw4L-Dr.js +1 -0
  13. package/dist/assets/MarkdownRenderer-D_0iKhQN.js +2 -0
  14. package/dist/assets/MarkdownRendererImpl-BZ0XgjS0.js +10 -0
  15. package/dist/assets/MarkstreamRendererImpl-DBd6Glg9.js +3 -0
  16. package/dist/assets/MobileDetailNavigation-xgwvsQuR.js +1 -0
  17. package/dist/assets/{MobileResizableSheet-D5PcZMuI.js → MobileResizableSheet-CQQ7O-2X.js} +1 -1
  18. package/dist/assets/MobileShareBridge-IO45gM2G.js +3 -0
  19. package/dist/assets/MobileSurface-DmYgZONB.js +2 -0
  20. package/dist/assets/{MultiRunWindow-rMqP99ID.js → MultiRunWindow-fJ3XfntS.js} +1 -1
  21. package/dist/assets/OnboardingScreen-MJS5T5rL.js +1 -0
  22. package/dist/assets/{OverlayScrollbar-Byx2H3pc.js → OverlayScrollbar-jtMYTn1y.js} +1 -1
  23. package/dist/assets/SettingsView-ZWFLpPSI.js +29 -0
  24. package/dist/assets/{SettingsWindow-U-RDDOS7.js → SettingsWindow-DGRmrIWz.js} +1 -1
  25. package/dist/assets/SetupTourDialog-BYbAubwA.js +1 -0
  26. package/dist/assets/TerminalView-CoJ6_9P1.js +8 -0
  27. package/dist/assets/ToolOutputDialog-5xBwOJ6a.js +16 -0
  28. package/dist/assets/VoiceSettings-CN33koSc.js +2 -0
  29. package/dist/assets/{YuriLogo-B58GIl2v.js → YuriLogo-CvyJy_R9.js} +1 -1
  30. package/dist/assets/YuriWordmark-DnFAS-Ko.js +1 -0
  31. package/dist/assets/{assistant-attachment-cache-Cmzt4xXE.js → assistant-attachment-cache-D-LmCflm.js} +1 -1
  32. package/dist/assets/bootstrap-eLlfzqAI.js +1 -0
  33. package/dist/assets/{capgoAdapter-B5NImlKh.js → capgoAdapter-CCLtBZL1.js} +1 -1
  34. package/dist/assets/{checkbox-Bdj4n5cI.js → checkbox-rOV6DjeG.js} +1 -1
  35. package/dist/assets/client-uz8O6TPX.js +7 -0
  36. package/dist/assets/{collapsible-D1JZOgJZ.js → collapsible-CKswuqAw.js} +1 -1
  37. package/dist/assets/{context-menu-DDX0ZFhc.js → context-menu-B4njwT_M.js} +1 -1
  38. package/dist/assets/{desktopHosts-DovfbQPm.js → desktopHosts-135cuRCE.js} +1 -1
  39. package/dist/assets/{desktopRelayRestore-D4pbpNKN.js → desktopRelayRestore-1aUztDPU.js} +1 -1
  40. package/dist/assets/{device-DNG0cNwQ.js → device-QL8KNSLM.js} +1 -1
  41. package/dist/assets/{diagram-C72TQWfh.js → diagram-BppQ_USn.js} +1 -1
  42. package/dist/assets/{dialog-CIKJalI5.js → dialog-Bg8MJnOV.js} +1 -1
  43. package/dist/assets/{es-D0Q_CV0t.js → es-Ba3NUCtE.js} +3 -3
  44. package/dist/assets/{fileMentionTouchSelection-tnd9RDDh.js → fileMentionTouchSelection-D-AdTJVr.js} +1 -1
  45. package/dist/assets/fileReferenceActions-cYqdsXFz.js +1 -0
  46. package/dist/assets/{fr-DrO5SAKl.js → fr-CRhp3hyT.js} +3 -3
  47. package/dist/assets/{gitApi-BI8OG_ts.js → gitApi-DVx_V1x6.js} +11 -7
  48. package/dist/assets/gitApiHttp-DvTBxvX8.js +3 -0
  49. package/dist/assets/historyImportQueries-D_9RlrLp.js +1 -0
  50. package/dist/assets/host-DrGjjO6K.js +1 -0
  51. package/dist/assets/{i18n-UaLestuf.js → i18n-RH7UieOS.js} +1 -1
  52. package/dist/assets/image-loading-DBqnxgDH.js +1 -0
  53. package/dist/assets/{input-gVHSS0EB.js → input-DRjuZMeA.js} +1 -1
  54. package/dist/assets/input-store-CjUOfpyA.js +1 -0
  55. package/dist/assets/insertionBoundaries-DZtQt2Ah.js +1 -0
  56. package/dist/assets/{ja-BNeP9_GU.js → ja-D-UPjDY2.js} +3 -3
  57. package/dist/assets/{ko-DRRFD_7l.js → ko-x-z9J5z7.js} +3 -3
  58. package/dist/assets/main-BMFY9mtb.js +2 -0
  59. package/dist/assets/main-D2s9J_jN.js +169 -0
  60. package/dist/assets/{markdownHeightCache-B-FoaQ1U.js → markdownHeightCache-BL99DlhC.js} +1 -1
  61. package/dist/assets/{markdownTheme-CHNl6tUv.js → markdownTheme-DFDWa8Gh.js} +1 -1
  62. package/dist/assets/mcpQueries-HzYMEVWd.js +1 -0
  63. package/dist/assets/miniChat-BbJ0GKpk.js +2 -0
  64. package/dist/assets/mobile-_zUth69Z.js +2 -0
  65. package/dist/assets/mobileBackNavigation--ZdrI-Yj.js +1 -0
  66. package/dist/assets/mobileConnections-C3eGEOPy.js +2 -0
  67. package/dist/assets/multirun-CDYNyLBH.js +3 -0
  68. package/dist/assets/{native-config-DqDXViVx.js → native-config-DOawZfln.js} +1 -1
  69. package/dist/assets/navigation-Ibk_Pw-q.js +2 -0
  70. package/dist/assets/{pl-BnW5wJrl.js → pl-Cqo1FJwM.js} +3 -3
  71. package/dist/assets/platform-wF65ZFgV.js +1 -0
  72. package/dist/assets/project-preview-2H-TmJkd.js +1 -0
  73. package/dist/assets/projectActions-50e_f9dI.js +1 -0
  74. package/dist/assets/projectMeta-D1Ytss9U.js +1 -0
  75. package/dist/assets/prompt-attachment-upload-BNhDXymd.js +1 -0
  76. package/dist/assets/{pt-BR-fZW8CCVQ.js → pt-BR-C930XU1k.js} +3 -3
  77. package/dist/assets/pwa-CXupOTsD.js +2 -0
  78. package/dist/assets/queue-abort-optimistic-CQXpIlq6.js +1 -0
  79. package/dist/assets/{react-DeB-Vc_L.js → react-CgRToPwO.js} +1 -1
  80. package/dist/assets/{readiness-CIlvQ-aQ.js → readiness-BfuZm6Yw.js} +2 -2
  81. package/dist/assets/relay-preview-frame-src-BPyz3nXA.js +1 -0
  82. package/dist/assets/remote-input-store-BOdCWpQY.js +1 -0
  83. package/dist/assets/remoteProjectQueries-CkxdZNw4.js +1 -0
  84. package/dist/assets/renderElectronMiniChatApp-pJ59iC34.js +2 -0
  85. package/dist/assets/renderMobileApp-BQFC-gOA.js +29 -0
  86. package/dist/assets/{runtime-file-download-DMY1k1af.js → runtime-file-download-D11Nnedg.js} +1 -1
  87. package/dist/assets/runtime-file-resource-CuLP3xp7.js +6 -0
  88. package/dist/assets/runtimeConfig-tHm7o_0I.js +2 -0
  89. package/dist/assets/{runtimeEndpointReset-BOdd_mJM.css → runtimeEndpointReset-BUGfn7y0.css} +1 -1
  90. package/dist/assets/runtimeEndpointReset-BhHWFNvo.js +150 -0
  91. package/dist/assets/safeStorage-DTOhKN0V.js +1 -0
  92. package/dist/assets/scheduledTaskNavigation-BIDtQ4wN.js +1 -0
  93. package/dist/assets/{select-BwCKwnTH.js → select-B1On-Y4Z.js} +1 -1
  94. package/dist/assets/sessionLookup-RcyTTDOy.js +1 -0
  95. package/dist/assets/sortable-tabs-strip-nD1Me06z.js +1 -0
  96. package/dist/assets/{speechSettingsQueries-C5mPRWIv.js → speechSettingsQueries-BYhNpzDJ.js} +1 -1
  97. package/dist/assets/src-BZCFf9_1.css +2 -0
  98. package/dist/assets/{store-CzVMz42v.js → store-DunGyOfe.js} +4 -4
  99. package/dist/assets/terminalApi-madXrfqA.js +1 -0
  100. package/dist/assets/{textarea-CaTDyZrS.js → textarea-Qt06OhhX.js} +1 -1
  101. package/dist/assets/{tooltip-BvZzoiqg.js → tooltip-D382RCy1.js} +1 -1
  102. package/dist/assets/tour-CQMBn8gJ.js +1 -0
  103. package/dist/assets/{types-Bm8kDgSv.js → types-CHszLAS3.js} +1 -1
  104. package/dist/assets/{uk-C4OKsNRv.js → uk-OXQSdzuT.js} +3 -3
  105. package/dist/assets/{useAppFontEffects-C9IaiJgF.js → useAppFontEffects-CqXrCJVt.js} +63 -58
  106. package/dist/assets/useAppFontEffects-K31q-1OV.css +1 -0
  107. package/dist/assets/useAssistantUIStore-jOKVcBK8.js +1 -0
  108. package/dist/assets/useDesktopWindowControlsLayout-KH4UP7Gj.js +1 -0
  109. package/dist/assets/{useDictation-Sk20Gi0T.js → useDictation-Bs7TWO9r.js} +1 -1
  110. package/dist/assets/useEffectiveDirectory-CCKRdyK9.js +1 -0
  111. package/dist/assets/useFontPreferences-CPrl1_3z.js +1 -0
  112. package/dist/assets/{useMobileHtmlPreviewStore-C03uVLfX.js → useMobileHtmlPreviewStore-EOAzZiAy.js} +1 -1
  113. package/dist/assets/useMobileNavigationStore-BNtVrnSw.js +13 -0
  114. package/dist/assets/usePluginsStore-bMuGciUE.js +1 -0
  115. package/dist/assets/useProjectRuntimeAPIs-BFCXBu2J.js +1 -0
  116. package/dist/assets/{useStreamingTextThrottle-CeKHHK13.js → useStreamingTextThrottle-C8xAqcgP.js} +1 -1
  117. package/dist/assets/{useThemeSystem-CNzUUkFn.js → useThemeSystem-C57Z9mV2.js} +1 -1
  118. package/dist/assets/useUIStore-Cfmg-aDQ.js +1 -0
  119. package/dist/assets/uuid-D-SDZijH.js +1 -0
  120. package/dist/assets/{vendor-base-ui-CzHs0bHY.js → vendor-base-ui-z2M4boRm.js} +1 -1
  121. package/dist/assets/{vendor-cmdk-C_tivUtr.js → vendor-cmdk-BgHvMv5l.js} +1 -1
  122. package/dist/assets/{vendor-dnd-kit-accessibility-BOtnpZt5.js → vendor-dnd-kit-accessibility-gVi9ga0x.js} +1 -1
  123. package/dist/assets/{vendor-dnd-kit-core-DK4OoOTr.js → vendor-dnd-kit-core-Dd5yS2-T.js} +1 -1
  124. package/dist/assets/{vendor-dnd-kit-sortable-Cv69eQm1.js → vendor-dnd-kit-sortable-CV-SGi8y.js} +1 -1
  125. package/dist/assets/{vendor-framer-motion-DDMKlXiP.js → vendor-framer-motion-CF9BQLta.js} +1 -1
  126. package/dist/assets/{vendor-markstream-react-6zxyQLCD.js → vendor-markstream-react-TwEpkgfP.js} +3 -3
  127. package/dist/assets/vendor-motion-Dv27UnOI.js +1 -0
  128. package/dist/assets/{vendor-pierre-diffs-BFiZ3IhI.js → vendor-pierre-diffs-tqo4Z3TC.js} +1 -1
  129. package/dist/assets/{vendor-react-DlzBev0S.js → vendor-react-P8wFrkcT.js} +1 -1
  130. package/dist/assets/{vendor-react-drawio-Dyg1-39Q.js → vendor-react-drawio-CQW1YP2l.js} +1 -1
  131. package/dist/assets/vendor-reactuses-core-Dyjw5sZR.js +1 -0
  132. package/dist/assets/{vendor-sonner-BEHGipm5.js → vendor-sonner-B5HgJenP.js} +1 -1
  133. package/dist/assets/{vendor-stream-diffs-wcQxoPZk.js → vendor-stream-diffs-DCMtZcS3.js} +2 -2
  134. package/dist/assets/vendor-tanstack-query-core-BSjXNgF_.js +1 -0
  135. package/dist/assets/vendor-tanstack-react-query-B-KblYBV.js +1 -0
  136. package/dist/assets/{vendor-tanstack-react-virtual-DSFNK3qc.js → vendor-tanstack-react-virtual-BkuqzrEV.js} +1 -1
  137. package/dist/assets/{vendor-zustand-vDaAPGfl.js → vendor-zustand-Cwko4FG1.js} +1 -1
  138. package/dist/assets/{zh-CN-ieAs59w6.js → zh-CN-B5X8yCZV.js} +3 -3
  139. package/dist/assets/{zh-TW-WWTW1fkP.js → zh-TW-CF6zr1fk.js} +3 -3
  140. package/dist/index.html +32 -27
  141. package/dist/mini-chat.html +32 -27
  142. package/dist/mobile.html +2 -2
  143. package/package.json +3 -2
  144. package/server/index.d.ts +19 -0
  145. package/server/index.js +35 -5
  146. package/server/lib/client-auth/remote-clients.js +11 -0
  147. package/server/lib/content-search/DOCUMENTATION.md +5 -0
  148. package/server/lib/content-search/routes.js +4 -0
  149. package/server/lib/content-search/routes.test.js +10 -0
  150. package/server/lib/event-stream/DOCUMENTATION.md +5 -0
  151. package/server/lib/event-stream/runtime.js +3 -0
  152. package/server/lib/event-stream/upstream-reader.js +1 -1
  153. package/server/lib/gui-customization/skill/references/remote-connections.md +11 -0
  154. package/server/lib/message-queue/DOCUMENTATION.md +4 -0
  155. package/server/lib/message-queue/service.js +2 -1
  156. package/server/lib/message-queue/service.test.js +11 -0
  157. package/server/lib/notifications/emitter-runtime.js +5 -0
  158. package/server/lib/opencode/DOCUMENTATION.md +28 -0
  159. package/server/lib/opencode/core-routes.js +14 -2
  160. package/server/lib/opencode/core-routes.test.js +28 -0
  161. package/server/lib/opencode/feature-routes-runtime.js +6 -1
  162. package/server/lib/opencode/proxy.js +1 -0
  163. package/server/lib/opencode/routes.js +18 -4
  164. package/server/lib/opencode/routes.test.js +22 -0
  165. package/server/lib/opencode/settings-helpers.js +26 -0
  166. package/server/lib/opencode/settings-helpers.test.js +20 -0
  167. package/server/lib/opencode/settings-runtime.js +5 -3
  168. package/server/lib/opencode/settings-runtime.test.js +35 -0
  169. package/server/lib/preview/DOCUMENTATION.md +73 -0
  170. package/server/lib/preview/file-preview-path.js +37 -0
  171. package/server/lib/preview/file-target.js +38 -0
  172. package/server/lib/preview/file-target.test.js +111 -0
  173. package/server/lib/preview/proxy-runtime.js +110 -17
  174. package/server/lib/projects/DOCUMENTATION.md +6 -0
  175. package/server/lib/relay/tunnel-host.js +1 -0
  176. package/server/lib/remote-hosts/DOCUMENTATION.md +269 -0
  177. package/server/lib/remote-hosts/configuration.js +15 -0
  178. package/server/lib/remote-hosts/deadline.js +22 -0
  179. package/server/lib/remote-hosts/deadline.test.js +64 -0
  180. package/server/lib/remote-hosts/fixtures/settings-server.mjs +26 -0
  181. package/server/lib/remote-hosts/gateway.js +644 -0
  182. package/server/lib/remote-hosts/json-lifecycle.test.js +55 -0
  183. package/server/lib/remote-hosts/preview-scope.js +23 -0
  184. package/server/lib/remote-hosts/relay-client.ts +3 -0
  185. package/server/lib/remote-hosts/routes.js +432 -0
  186. package/server/lib/remote-hosts/routes.test.js +1176 -0
  187. package/server/lib/remote-hosts/settings-production.test.js +145 -0
  188. package/server/lib/remote-hosts/store.js +110 -0
  189. package/server/lib/remote-hosts/store.test.js +33 -0
  190. package/server/lib/remote-hosts/transport.js +113 -0
  191. package/server/lib/session-folders/routes.js +1 -0
  192. package/server/lib/transcript-cache/DOCUMENTATION.md +4 -0
  193. package/server/lib/transcript-cache/routes.js +3 -0
  194. package/server/lib/transcript-cache/service.js +15 -0
  195. package/server/lib/transcript-cache/service.test.js +13 -0
  196. package/server/lib/ui-auth/DOCUMENTATION.md +18 -0
  197. package/server/lib/ui-auth/ui-auth.js +30 -2
  198. package/server/lib/ui-auth/ui-auth.test.js +46 -1
  199. package/dist/assets/AssistantConversationSurface-B-D-mLgs.js +0 -3
  200. package/dist/assets/DiagramView-BU6jWxKJ.js +0 -1
  201. package/dist/assets/GuiPluginSurface-kxAcgmf1.js +0 -1
  202. package/dist/assets/LoadingImage-BzBw_1lI.js +0 -1
  203. package/dist/assets/MarkdownRenderer-CoMohPOZ.js +0 -2
  204. package/dist/assets/MarkdownRendererImpl-DoZW1UKH.js +0 -10
  205. package/dist/assets/MarkstreamRendererImpl-B3zd5x2O.js +0 -3
  206. package/dist/assets/MobileDetailNavigation-bEZ_NA03.js +0 -1
  207. package/dist/assets/MobileShareBridge-Cjukxazk.js +0 -3
  208. package/dist/assets/MobileTabPageHeader-Da1maXx-.js +0 -2
  209. package/dist/assets/OnboardingScreen-CZhqHzAj.js +0 -1
  210. package/dist/assets/SettingsView-7Bea2DvF.js +0 -29
  211. package/dist/assets/SetupTourDialog-CKec5tUy.js +0 -1
  212. package/dist/assets/TerminalView-CS1oSAuY.js +0 -8
  213. package/dist/assets/ToolOutputDialog-BWhrFvvI.js +0 -10
  214. package/dist/assets/VoiceSettings-7aFmJq9Z.js +0 -2
  215. package/dist/assets/YuriWordmark--S-QEpRp.js +0 -1
  216. package/dist/assets/appThemeRegistry-LyWTE-mT.js +0 -1
  217. package/dist/assets/bootstrap-BhC95qVC.js +0 -1
  218. package/dist/assets/fileQueries-D9l0crnM.js +0 -1
  219. package/dist/assets/fileReferenceActions-BmquJskG.js +0 -1
  220. package/dist/assets/gitApiHttp-D4d-rgcR.js +0 -9
  221. package/dist/assets/historyImportQueries-DkB2_92i.js +0 -1
  222. package/dist/assets/host-kMLXU0hK.js +0 -1
  223. package/dist/assets/image-loading-BrDob6MW.js +0 -1
  224. package/dist/assets/insertionBoundaries-B-yZI6iY.js +0 -1
  225. package/dist/assets/main-BfAN93rT.js +0 -169
  226. package/dist/assets/main-DYWwmI_W.js +0 -2
  227. package/dist/assets/mcpQueries-CehWHIB1.js +0 -1
  228. package/dist/assets/miniChat-BlkcLQBr.js +0 -2
  229. package/dist/assets/mobile-I3Xe5NtO.js +0 -2
  230. package/dist/assets/mobileBackNavigation-BFUH-c-G.js +0 -1
  231. package/dist/assets/mobileConnections-BFvtbJXX.js +0 -2
  232. package/dist/assets/multirun-DdEjp77z.js +0 -3
  233. package/dist/assets/pathNormalization-ewtPqJWn.js +0 -1
  234. package/dist/assets/platform-DMsFWy1a.js +0 -1
  235. package/dist/assets/projectActions-C-9Z8R7y.js +0 -1
  236. package/dist/assets/projectMeta-BKgum5WN.js +0 -1
  237. package/dist/assets/pwa-BvKUY4Hk.js +0 -2
  238. package/dist/assets/queue-abort-optimistic-BcbiNk8t.js +0 -1
  239. package/dist/assets/renderElectronMiniChatApp-DIjWdFHu.js +0 -2
  240. package/dist/assets/renderMobileApp-CE0QyOH0.js +0 -29
  241. package/dist/assets/runtime-file-resource-CL7EVzOG.js +0 -2
  242. package/dist/assets/runtimeConfig-uhjQn4kK.js +0 -2
  243. package/dist/assets/runtimeEndpointReset-DezNESKT.js +0 -149
  244. package/dist/assets/scheduledTaskNavigation-FMDNRUnX.js +0 -1
  245. package/dist/assets/sessionLookup-DzKZsy-W.js +0 -1
  246. package/dist/assets/sortable-tabs-strip-m5JQrTx4.js +0 -1
  247. package/dist/assets/src-HgtAe3Q4.css +0 -2
  248. package/dist/assets/terminalApi-DK4KmfFn.js +0 -1
  249. package/dist/assets/touch-gestures-CErgaXZ7.js +0 -1
  250. package/dist/assets/tour-DDI0Zg7l.js +0 -1
  251. package/dist/assets/useAppFontEffects-RpgNbjA4.css +0 -1
  252. package/dist/assets/useAssistantUIStore-nNYL140o.js +0 -1
  253. package/dist/assets/useDesktopWindowControlsLayout-C3M12PjJ.js +0 -1
  254. package/dist/assets/useEffectiveDirectory-Do4UqfZR.js +0 -1
  255. package/dist/assets/useFontPreferences-DxzruDDQ.js +0 -1
  256. package/dist/assets/useMobileNavigationStore-InwdmuDX.js +0 -17
  257. package/dist/assets/usePluginsStore-BH4-CNcj.js +0 -1
  258. package/dist/assets/useUIStore-vvNwcOk3.js +0 -1
  259. package/dist/assets/useWorkerHighlightedLines-0XahwAbS.js +0 -7
  260. package/dist/assets/vendor-motion-C9oiAdx-.js +0 -1
  261. package/dist/assets/vendor-reactuses-core-CuTmqEMK.js +0 -1
  262. package/dist/assets/vendor-tanstack-query-core-Y_YoRHtC.js +0 -1
  263. package/dist/assets/vendor-tanstack-react-query-B-Wpqq5J.js +0 -1
@@ -1,3 +1,8 @@
1
+ import { remotePreviewPrefix, REMOTE_PREVIEW_TOKEN_MARKER } from '../remote-hosts/preview-scope.js';
2
+ import { parseFilePreviewPath, filePreviewResponseBase } from './file-preview-path.js';
3
+ import { createFileTarget, resolveFileTargetResource, readFileTargetText } from './file-target.js';
4
+ import path from 'node:path';
5
+
1
6
  const DEFAULT_TARGET_TTL_MS = 30 * 60 * 1000;
2
7
  const TOKEN_COOKIE_NAME = 'yuri_preview_token';
3
8
  const TOKEN_QUERY_PARAM = 'yuri_preview_token';
@@ -169,8 +174,8 @@ export const classifyPreviewNavigation = ({ url, currentUrl, targetOrigin }) =>
169
174
  }
170
175
 
171
176
  const path = parsed.pathname || '/';
172
- const proxyMatch = current?.pathname?.match(/^(\/api\/preview\/proxy\/[a-f0-9]{16,64})(?:\/|$)/i);
173
- if (parsed.origin === current?.origin && path.startsWith('/api/preview/proxy/')) {
177
+ const proxyMatch = current?.pathname?.match(/^((?:\/api\/hosts\/[^/]+)?\/api\/preview\/proxy\/[a-f0-9]{16,64}(?:\/_file\/[a-f0-9]{32}\/(?:yuri_url_[A-Za-z0-9_-]{32}|-))?)(?:\/|$)/i);
178
+ if (parsed.origin === current?.origin && (path.startsWith('/api/preview/proxy/') || (proxyMatch && path.startsWith(`${proxyMatch[1]}/`)))) {
174
179
  return { action: 'allow', url: parsed.toString() };
175
180
  }
176
181
 
@@ -426,11 +431,11 @@ const PREVIEW_BRIDGE_SCRIPT = String.raw`(() => {
426
431
  const parsed = new URL(value, window.location.href);
427
432
  if (parsed.protocol !== 'http:' && parsed.protocol !== 'https:') return { action: 'allow', url: parsed.toString() };
428
433
  const current = new URL(window.location.href);
429
- const proxyMatch = current.pathname.match(/^(\/api\/preview\/proxy\/[a-f0-9]{16,64})(?:\/|$)/i);
434
+ const proxyMatch = current.pathname.match(/^((?:\/api\/hosts\/[^/]+)?\/api\/preview\/proxy\/[a-f0-9]{16,64}(?:\/_file\/[a-f0-9]{32}\/(?:yuri_url_[A-Za-z0-9_-]{32}|-))?)(?:\/|$)/i);
430
435
  if (parsed.origin === current.origin && parsed.pathname === current.pathname && parsed.search === current.search && parsed.hash) {
431
436
  return { action: 'allow', url: parsed.toString() };
432
437
  }
433
- if (parsed.origin === current.origin && parsed.pathname.startsWith('/api/preview/proxy/')) {
438
+ if (parsed.origin === current.origin && (parsed.pathname.startsWith('/api/preview/proxy/') || (proxyMatch && parsed.pathname.startsWith(proxyMatch[1] + '/')))) {
434
439
  return { action: 'allow', url: parsed.toString() };
435
440
  }
436
441
  if (proxyMatch && parsed.origin === current.origin && parsed.pathname.startsWith('/') && parsed.pathname.indexOf(proxyMatch[1]) !== 0 && TARGET_ORIGIN) {
@@ -477,7 +482,7 @@ const PREVIEW_BRIDGE_SCRIPT = String.raw`(() => {
477
482
  if (window.__yuriViteHmrProxyPatched || typeof window.WebSocket !== 'function') return;
478
483
  window.__yuriViteHmrProxyPatched = true;
479
484
  const NativeWebSocket = window.WebSocket;
480
- const proxyMatch = window.location.pathname.match(/^(\/api\/preview\/proxy\/[a-f0-9]{16,64})(?:\/|$)/i);
485
+ const proxyMatch = window.location.pathname.match(/^((?:\/api\/hosts\/[^/]+)?\/api\/preview\/proxy\/[a-f0-9]{16,64}(?:\/_file\/[a-f0-9]{32}\/(?:yuri_url_[A-Za-z0-9_-]{32}|-))?)(?:\/|$)/i);
481
486
  if (!proxyMatch) return;
482
487
  const proxyBase = proxyMatch[1] + '/';
483
488
  const currentSearchParams = new URL(window.location.href).searchParams;
@@ -544,7 +549,7 @@ const PREVIEW_BRIDGE_SCRIPT = String.raw`(() => {
544
549
  const installAppRequestProxyPatch = () => {
545
550
  if (window.__yuriAppRequestProxyPatched) return;
546
551
  window.__yuriAppRequestProxyPatched = true;
547
- const proxyMatch = window.location.pathname.match(/^(\/api\/preview\/proxy\/[a-f0-9]{16,64})(?:\/|$)/i);
552
+ const proxyMatch = window.location.pathname.match(/^((?:\/api\/hosts\/[^/]+)?\/api\/preview\/proxy\/[a-f0-9]{16,64}(?:\/_file\/[a-f0-9]{32}\/(?:yuri_url_[A-Za-z0-9_-]{32}|-))?)(?:\/|$)/i);
548
553
  if (!proxyMatch) return;
549
554
  const proxyBase = proxyMatch[1];
550
555
  const currentSearchParams = new URL(window.location.href).searchParams;
@@ -645,6 +650,7 @@ const PREVIEW_BRIDGE_SCRIPT = String.raw`(() => {
645
650
  if (typeof input === 'string') {
646
651
  return nativeFetch(proxiedUrl(input), init);
647
652
  }
653
+ if (input instanceof URL) return nativeFetch(proxiedUrl(input.href), init);
648
654
  if (input instanceof Request) {
649
655
  try {
650
656
  const parsed = new URL(input.url);
@@ -1058,7 +1064,7 @@ export const rewritePreviewBody = ({ bodyText, proxyBasePath, targetOrigin, kind
1058
1064
  const rewriteResourceUrl = (value) => {
1059
1065
  if (typeof value !== 'string' || value.length === 0) return value;
1060
1066
  if (value.startsWith('/') && !value.startsWith('//')) {
1061
- if (value.startsWith('/api/preview/proxy/')) return appendProxyAuthToProxyUrl(value, { previewToken, urlAuthToken });
1067
+ if (value.startsWith('/api/preview/proxy/') || value.startsWith(`${prefix}/`)) return appendProxyAuthToProxyUrl(value, { previewToken, urlAuthToken });
1062
1068
  return appendProxyAuthToProxyUrl(`${prefix}${value}`, { previewToken, urlAuthToken });
1063
1069
  }
1064
1070
  try {
@@ -1194,11 +1200,17 @@ export const createPreviewProxyRuntime = ({
1194
1200
 
1195
1201
  const now = () => Date.now();
1196
1202
 
1203
+ const revokeTarget = (id) => {
1204
+ const entry = targets.get(id);
1205
+ targets.delete(id);
1206
+ for (const cancel of entry?.resources || []) cancel();
1207
+ };
1208
+
1197
1209
  const sweepExpired = () => {
1198
1210
  const t = now();
1199
1211
  for (const [id, entry] of targets.entries()) {
1200
1212
  if (entry.expiresAt <= t) {
1201
- targets.delete(id);
1213
+ revokeTarget(id);
1202
1214
  }
1203
1215
  }
1204
1216
  };
@@ -1212,7 +1224,7 @@ export const createPreviewProxyRuntime = ({
1212
1224
  sweepTimer.unref?.();
1213
1225
  };
1214
1226
 
1215
- const createTarget = (origin, ttlMs) => {
1227
+ const createTarget = (origin, ttlMs, fileTarget) => {
1216
1228
  const id = crypto.randomBytes(16).toString('hex');
1217
1229
  const token = crypto.randomBytes(16).toString('hex');
1218
1230
  const createdAt = now();
@@ -1223,6 +1235,8 @@ export const createPreviewProxyRuntime = ({
1223
1235
  token,
1224
1236
  createdAt,
1225
1237
  expiresAt,
1238
+ ...fileTarget,
1239
+ resources: new Set(),
1226
1240
  });
1227
1241
  return { id, token, expiresAt };
1228
1242
  };
@@ -1240,17 +1254,19 @@ export const createPreviewProxyRuntime = ({
1240
1254
 
1241
1255
  const entry = targets.get(id);
1242
1256
  if (!entry || entry.expiresAt <= now()) {
1243
- targets.delete(id);
1257
+ revokeTarget(id);
1244
1258
  return { ok: false, status: 404, error: 'Preview target expired' };
1245
1259
  }
1246
1260
 
1261
+ const filePath = entry.kind === 'file' ? parseFilePreviewPath(pathname) : null;
1262
+ if (entry.kind === 'file' && !filePath) return { ok: false, status: 403, error: 'Invalid file preview path' };
1247
1263
  const cookies = parseCookieHeader(req.headers?.cookie);
1248
- const token = parsed.searchParams.get(TOKEN_QUERY_PARAM) || cookies.get(TOKEN_COOKIE_NAME) || '';
1264
+ const token = filePath?.previewToken || parsed.searchParams.get(TOKEN_QUERY_PARAM) || cookies.get(TOKEN_COOKIE_NAME) || '';
1249
1265
  if (!token || token !== entry.token) {
1250
1266
  return { ok: false, status: 403, error: 'Preview token missing' };
1251
1267
  }
1252
1268
 
1253
- return { ok: true, id, entry, parsed };
1269
+ return { ok: true, id, entry, parsed, filePath };
1254
1270
  };
1255
1271
 
1256
1272
  const stripProxyPrefix = (pathname, id) => {
@@ -1362,6 +1378,16 @@ export const createPreviewProxyRuntime = ({
1362
1378
  }
1363
1379
  }
1364
1380
 
1381
+ if (req.body?.kind === 'file') {
1382
+ const file = await createFileTarget(req.body.directory, req.body.path);
1383
+ if (req.aborted || res.destroyed) return;
1384
+ const target = createTarget(null, req.body.ttlMs, file);
1385
+ res.once('close', () => { if (!res.writableFinished) revokeTarget(target.id); });
1386
+ return res.set('Cache-Control', 'no-store').json({
1387
+ id: target.id, kind: 'file', proxyBasePath: `${remotePreviewPrefix(req)}/api/preview/proxy/${target.id}`,
1388
+ entryPath: file.entryPath, previewToken: target.token, expiresAt: target.expiresAt,
1389
+ });
1390
+ }
1365
1391
  const rawUrl = typeof req.body?.url === 'string' ? req.body.url.trim() : '';
1366
1392
  if (!rawUrl) {
1367
1393
  return res.status(400).json({ error: 'url is required' });
@@ -1389,16 +1415,29 @@ export const createPreviewProxyRuntime = ({
1389
1415
 
1390
1416
  return res.json({
1391
1417
  id: target.id,
1392
- proxyBasePath: cookiePath,
1418
+ proxyBasePath: `${remotePreviewPrefix(req)}${cookiePath}`,
1393
1419
  previewToken: target.token,
1394
1420
  expiresAt: target.expiresAt,
1395
1421
  });
1396
1422
  } catch (error) {
1423
+ if (req.body?.kind === 'file') return res.status(error?.status || (error?.code === 'ENOENT' ? 404 : 500)).json({ error: 'File preview unavailable' });
1397
1424
  console.error('[preview-proxy] Failed to create target:', error);
1398
1425
  return res.status(500).json({ error: 'Failed to create preview target' });
1399
1426
  }
1400
1427
  });
1401
1428
 
1429
+ app.delete('/api/preview/targets/:id', express.json(), async (req, res) => {
1430
+ if (uiAuthController?.enabled) {
1431
+ if (!await uiAuthController.ensureSessionToken(req, res)) return res.status(401).json({ error: 'UI authentication required' });
1432
+ if (!await isRequestOriginAllowed(req)) return res.status(403).json({ error: 'Invalid origin' });
1433
+ }
1434
+ const entry = targets.get(req.params.id);
1435
+ if (!entry) return res.status(204).end();
1436
+ if (!req.body?.previewToken || req.body.previewToken !== entry.token) return res.status(403).json({ error: 'Preview token missing' });
1437
+ revokeTarget(req.params.id);
1438
+ return res.status(204).end();
1439
+ });
1440
+
1402
1441
  const proxy = createProxyMiddleware({
1403
1442
  target: 'http://127.0.0.1',
1404
1443
  changeOrigin: true,
@@ -1417,7 +1456,10 @@ export const createPreviewProxyRuntime = ({
1417
1456
  // contains the full path.
1418
1457
  pathFilter: (pathname, req) => {
1419
1458
  const target = req?.originalUrl || pathname || req?.url || '';
1420
- return target.startsWith('/api/preview/proxy/');
1459
+ if (!target.startsWith('/api/preview/proxy/')) return false;
1460
+ if (/^\/api\/preview\/proxy\/[a-f0-9]{16,64}\/_file(?:\/|$)/i.test(target)) return false;
1461
+ const resolved = resolveTargetFromRequest(req);
1462
+ return !resolved.ok || resolved.entry.kind !== 'file';
1421
1463
  },
1422
1464
  router: (req) => {
1423
1465
  const resolved = resolveTargetFromRequest(req);
@@ -1465,8 +1507,9 @@ export const createPreviewProxyRuntime = ({
1465
1507
  return responseBuffer;
1466
1508
  }
1467
1509
 
1468
- const proxyBasePath = `/api/preview/proxy/${resolved.id}`;
1469
- const urlAuthToken = resolved.parsed.searchParams.get(URL_AUTH_TOKEN_QUERY_PARAM) || '';
1510
+ const hubPrefix = remotePreviewPrefix(req);
1511
+ const proxyBasePath = `${hubPrefix}/api/preview/proxy/${resolved.id}`;
1512
+ const urlAuthToken = hubPrefix ? REMOTE_PREVIEW_TOKEN_MARKER : resolved.parsed.searchParams.get(URL_AUTH_TOKEN_QUERY_PARAM) || '';
1470
1513
  if (typeof proxyRes.headers?.location === 'string') {
1471
1514
  proxyRes.headers.location = rewritePreviewRedirectLocation({
1472
1515
  location: proxyRes.headers.location,
@@ -1475,6 +1518,7 @@ export const createPreviewProxyRuntime = ({
1475
1518
  previewToken: resolved.entry.token,
1476
1519
  urlAuthToken,
1477
1520
  });
1521
+ res.setHeader('location', proxyRes.headers.location);
1478
1522
  }
1479
1523
 
1480
1524
  const contentType = String(proxyRes.headers?.['content-type'] || '').toLowerCase();
@@ -1548,19 +1592,68 @@ export const createPreviewProxyRuntime = ({
1548
1592
  },
1549
1593
  });
1550
1594
 
1551
- app.use('/api/preview/proxy', (req, res, next) => {
1595
+ app.use('/api/preview/proxy', async (req, res, next) => {
1552
1596
  const resolved = resolveTargetFromRequest(req);
1553
1597
  if (!resolved.ok) {
1554
1598
  return res.status(resolved.status).json({ error: resolved.error });
1555
1599
  }
1600
+ if (resolved.entry.kind === 'file') {
1601
+ // Network previews retain a legacy capability-only access gate. A file
1602
+ // target must still pass ordinary client/session auth, even if a caller
1603
+ // supplies that legacy network query/cookie alongside the file envelope.
1604
+ if (typeof uiAuthController?.requireAuth === 'function') {
1605
+ let authorized = false;
1606
+ await uiAuthController.requireAuth(req, res, () => { authorized = true; });
1607
+ if (!authorized) return;
1608
+ } else if (uiAuthController?.enabled && !await uiAuthController.ensureSessionToken(req, res)) {
1609
+ return res.status(401).json({ error: 'UI authentication required' });
1610
+ }
1611
+ if (req.aborted || res.destroyed) return;
1612
+ if (!['GET', 'HEAD'].includes(req.method)) return res.status(405).set('Allow', 'GET, HEAD').end();
1613
+ const controller = new AbortController();
1614
+ const cancel = () => { controller.abort(); res.destroy(); };
1615
+ const cleanup = () => {
1616
+ controller.abort(); clearTimeout(expiry); resolved.entry.resources.delete(cancel);
1617
+ };
1618
+ const expiry = setTimeout(cancel, Math.min(2147483647, Math.max(0, resolved.entry.expiresAt - now())));
1619
+ expiry.unref?.();
1620
+ resolved.entry.resources.add(cancel);
1621
+ res.once('close', cleanup);
1622
+ res.set({ 'Cache-Control': 'no-store', 'Referrer-Policy': 'no-referrer', 'X-Content-Type-Options': 'nosniff' });
1623
+ try {
1624
+ const file = await resolveFileTargetResource(resolved.entry.root, resolved.filePath.resourcePath);
1625
+ controller.signal.throwIfAborted();
1626
+ res.type(path.extname(file));
1627
+ const contentType = String(res.getHeader('Content-Type'));
1628
+ const kind = contentType.includes('text/html') ? 'html' : contentType.includes('text/css') ? 'css'
1629
+ : /javascript|ecmascript/.test(contentType) ? 'javascript' : null;
1630
+ if (!kind || req.method === 'HEAD') return res.sendFile(file, { dotfiles: 'allow', cacheControl: false, lastModified: false });
1631
+ const bodyText = await readFileTargetText(file, controller.signal);
1632
+ controller.signal.throwIfAborted();
1633
+ const proxyBasePath = filePreviewResponseBase(resolved.filePath, remotePreviewPrefix(req));
1634
+ const rewritten = rewritePreviewBody({ bodyText, proxyBasePath, kind });
1635
+ return res.send(kind === 'html' ? injectPreviewBridge(rewritten, '', '') : rewritten);
1636
+ } catch (error) {
1637
+ if (controller.signal.aborted || res.destroyed) return;
1638
+ return res.status(error?.status || (error?.code === 'ENOENT' ? 404 : error?.code === 'EACCES' ? 403 : 500)).json({ error: 'File preview unavailable' });
1639
+ }
1640
+ }
1556
1641
  next();
1557
1642
  }, proxy);
1558
1643
 
1559
1644
  server.on('upgrade', (req, socket, head) => {
1645
+ if (/^\/api\/preview\/proxy\/[a-f0-9]{16,64}\/_file(?:\/|$)/i.test(req.url || '')) {
1646
+ rejectWebSocketUpgrade(socket, 405, 'File preview is read-only');
1647
+ return;
1648
+ }
1560
1649
  const resolved = resolveTargetFromRequest(req);
1561
1650
  if (!resolved.ok) {
1562
1651
  return;
1563
1652
  }
1653
+ if (resolved.entry.kind === 'file') {
1654
+ rejectWebSocketUpgrade(socket, 405, 'File preview is read-only');
1655
+ return;
1656
+ }
1564
1657
 
1565
1658
  const handleUpgrade = async () => {
1566
1659
  try {
@@ -30,3 +30,9 @@ and result contract live in `../gui-customization/DOCUMENTATION.md`.
30
30
  writes, persistence, offline-project retention, corrupt
31
31
  reads and failed-write preservation. Assistant HTTP integration is covered in
32
32
  `../assistants/yuri-project.http.test.js`.
33
+
34
+ The Remote Host Gateway mounts authenticated `POST /api/projects` and `PATCH
35
+ /api/projects/:id` local-authority operations using the same registry/settings
36
+ lock. `GET /api/projects` excludes remote references. Remote-first registration,
37
+ metadata write-through and Hub-only reference removal belong to
38
+ `../remote-hosts/`, not this local filesystem registry.
@@ -49,6 +49,7 @@ const PREVIEW_PROXY_WS_PATH_PREFIX = '/api/preview/proxy/';
49
49
  */
50
50
  export const isTunnelWsPathAllowed = (path) => {
51
51
  if (typeof path !== 'string' || !path) return false;
52
+ if (/^\/api\/hosts\/[^/]+\/api\/(?:terminal\/ws(?:\?|$)|preview\/proxy\/)/.test(path)) return true;
52
53
  // Path only (no query) — tunnel open payload already splits query.
53
54
  if (ALLOWED_WS_PATHS.has(path)) return true;
54
55
  try {
@@ -0,0 +1,269 @@
1
+ # Remote Host Gateway
2
+
3
+ `server/index.js` constructs this module before the generic OpenCode proxy and
4
+ stops it before closing the local session index. Electron injects the process-local
5
+ adapter from `packages/electron/remote-hosts.mjs`. The adapter reads that computer's
6
+ saved hosts/SSH manager, never the focused window's selected runtime. CLI/web/VS
7
+ Code instances without an adapter report `supported: false`; desktop and
8
+ SSH-managed PC instances expose the local-project authority protocol.
9
+
10
+ ## Ownership and persistence
11
+
12
+ - `store.js` owns `remote-hosts.sqlite`: stable Hub identity, remote-project
13
+ references, safe presentation fields, connection receipts and bounded-shape
14
+ unread/folder/order snapshots. `(hostId, path)` is unique. Missing hosts retain
15
+ their reference and display record; removing a reference never deletes remote
16
+ sessions, files or projects.
17
+ `saveProject` is explicit association/upsert; asynchronous metadata completions
18
+ use `refreshProject(reference, remote)` instead. The latter only updates the
19
+ matching existing id/Host/path/addedAt/remoteProjectId row and returns null if it was removed
20
+ or replaced. A late refresh or PATCH must never recreate a deleted reference.
21
+ `hasProjects()` uses SQLite EXISTS-style `SELECT 1 ... LIMIT 1`, never a Host
22
+ lookup, subscription or timer. Existing settings bootstrap and full settings
23
+ project it as read-only `hasRemoteProjects`. Successful reference creation or
24
+ removal sends the existing content-free `yuri:project-order-changed` global
25
+ invalidation tip, including the first/last reference transition. Clients refresh
26
+ their existing bootstrap/settings query, not an unconditional hosts request.
27
+ Hub project order and collapse live only in settings `hubProjectLayout`, not
28
+ in remote metadata or local `projects`. See the settings module contract.
29
+ - `gateway.js` owns connections, shared status/content readers, generation fences,
30
+ owner cancellation and the fair two-slot refresh queue. Remote summaries use
31
+ the existing session-index service and its newest-20 directory bound. Each
32
+ partition hashes `hub:<stable Hub ID>:remote-host:<host ID>`; no mutable local
33
+ runtime endpoint or local filesystem resolution participates.
34
+ - `transport.js` owns authenticated direct/SSH-forwarded requests and reuses the
35
+ normative E2EE Relay client. `build:remote-host-relay` compiles that client once;
36
+ normal web build/prepack and `build:llm-bridge` include the build. The generated
37
+ bundle ships inside the web server resources, not as a new dependency.
38
+ - `routes.js` owns external authorization, host-scoped HTTP/WS routing and demand
39
+ tracking on the existing global client stream. `preview-scope.js` carries only
40
+ a relative host prefix and a nonsecret marker across the remote preview pipe;
41
+ real Hub URL tokens are inserted on the Hub, never sent upstream.
42
+
43
+ There is no remote message/part/transcript table. Remote content events bypass the
44
+ Hub's transcript, message queue, search indexing and upstream watcher side effects.
45
+ Remote queue requests execute on the target machine through the prefix proxy.
46
+ The local HTTP transcript-cache rejects explicit remote scopes; client IndexedDB
47
+ is the only Hub-client content acceleration store. Configuration catalogs are
48
+ read-only projected views; raw settings/config files and machine mutations are
49
+ not proxy capabilities.
50
+
51
+ ## HTTP protocol
52
+
53
+ - `GET /api/hosts`: `{supported, hubId, hosts, projects, reason?}`; local SQLite /
54
+ saved descriptors only, no probe. Public hosts contain id/name/source/state,
55
+ available, generation, safe error/timestamps/version, never URLs/credentials.
56
+ `scopeGeneration` is an opaque in-process authorization/configuration epoch,
57
+ independent of `generation`, which identifies the physical event connection.
58
+ Releasing an unreferenced short HTTP transport leaves its scope epoch intact;
59
+ credential/target descriptor changes or observed Host removal and re-addition
60
+ create a fresh epoch, including when old credentials are restored (no ABA reuse).
61
+ The identity record has no transport, reader, timer or background IO. It is
62
+ bounded by the current saved Host catalog and cleared on shutdown. Clients fence
63
+ captured HTTP/query scopes by this epoch and continue fencing events by wire
64
+ generation. Current-connection checks still reject late physical responses.
65
+ - `GET /api/hosts/projects`: persisted Hub references.
66
+ - `POST /api/hosts/:hostId/projects {path,label?}`: remote register first, then
67
+ upsert the Hub reference. A Hub disk failure leaves the remote project intact;
68
+ retry associates the same canonical remote path and deterministic Hub ID.
69
+ - `PATCH /api/hosts/:hostId/projects/:projectId`: remote metadata write-through;
70
+ cache updates only on successful authority response.
71
+ - `DELETE` on that path removes only the reference.
72
+ - `GET /api/hosts/:hostId/summaries`: immediate SQLite snapshot, stale marker,
73
+ connection receipts and unread/folder/order snapshots. Offline live status is
74
+ `metadata.yuri.sessionStatus = {type:'unknown',lastKnown}`.
75
+ Opening a replacement status stream does not make persisted activity live:
76
+ the snapshot remains stale/unknown until that connection completes its refresh.
77
+ `worktrees` contains `projectDirectories: Record<projectRoot, string[]>` and
78
+ `staleProjectDirectories: string[]`. These are path-only metadata from the
79
+ remote Git worktree catalog, never locally resolved paths. Root subdirectories
80
+ and verified worktrees outside the project root participate in summaries,
81
+ status ingestion and content leases. Explicit project roots take precedence;
82
+ a nested source project maps only its suffix within the longest authoritative
83
+ checkout: `/repo/src` with checkouts `/repo` and `/other` maps `/other/src`,
84
+ never the entire `/other`. Filesystem presence remains a remote operation;
85
+ the Hub does not stat or resolve these paths on its own filesystem.
86
+ - `POST /api/hosts/:hostId/connect`: explicit foreground wake. The response awaits
87
+ native SSH preparation and authenticated capability admission; callers entering
88
+ the directory picker wait for this acknowledgement, not a cached status label.
89
+ Without project references no status stream is opened, so the response's live
90
+ status can still be `connecting` despite successful HTTP admission. Subsequent
91
+ short requests reuse the native manager's matching live Ready tunnel rather
92
+ than repeatedly restarting SSH initialization.
93
+ - `POST /api/hosts/:hostId/subscriptions {directory,sessionId?}`: content lease;
94
+ `DELETE /.../subscriptions/:id` releases only the authenticated owner's lease.
95
+ - The shared worktree dialog forwards read-only (`GET`/`HEAD`)
96
+ `/api/github/auth/status`, `/api/github/issues/{list,get,comments}`,
97
+ `/api/github/pulls/{list,context}`, and `/api/magic-prompts`. These exact
98
+ routes supply Host GitHub availability, linked context and prompt templates;
99
+ GitHub authentication mutations and prompt-template writes remain forbidden.
100
+ - `/api/hosts/:hostId/api/*`: supported project/session APIs preserve method,
101
+ body, query, directory headers, cancellation and streaming. Client credentials,
102
+ cookies, arbitrary destinations, recursive host APIs and machine-level writes
103
+ do not cross this boundary. Large bodies/streams do not inherit the index's
104
+ 15-second response-body deadline. Every proxy request still has a bounded
105
+ response-header wait; receiving headers clears that deadline for streaming bodies.
106
+ Snapshots/session reads use the short request budget. Mutations (including
107
+ synchronous shell) and file/preview transfers use a separate five-minute
108
+ operation header budget, rather than being cut off by the 15-second index
109
+ budget. Ordinary JSON bodies remain bounded; file/SSE bodies stay cancellable
110
+ without a fixed total-body deadline.
111
+ `deadline.js` preserves those budgets and TimeoutError semantics while clearing
112
+ deadline timers immediately when their request/connection parent is cancelled.
113
+ Its unref timers weakly retain their owner and are finalized when an abandoned
114
+ signal is collected; completed calls cannot keep a disconnected Host's timeout
115
+ work alive. Streaming responses retain only the existing response-header timer,
116
+ never a new fixed body deadline. Cancellation still reaches the transport and
117
+ all existing authorization/generation fences remain authoritative.
118
+ Gateway-owned `json()` reads additionally retain a request-local consumption
119
+ signal through body parsing and the final descriptor/current-connection check.
120
+ Their `finally` cancels only that local owner on success or failure, clearing
121
+ its deadline without cancelling the shared connection or sibling requests.
122
+ Receiving headers alone never completes this owner; raw/streaming `request()`
123
+ responses retain their existing lifecycle and budgets.
124
+ Optional file reads preserve the Remote's `x-yuri-file-exists` response header:
125
+ an existing empty file and a missing file both have empty bodies, but remain
126
+ distinct. Attachment uploads preserve `x-yuri-content-length`, `x-yuri-sha256`,
127
+ `x-yuri-mime` and `x-yuri-filename` along with their original body bytes; size
128
+ and digest validation still execute on the Remote. These allowlisted metadata
129
+ headers never replace Remote authentication or forward Hub credentials.
130
+ - `/api/hosts/:hostId/api/terminal/ws` and `/api/hosts/:hostId/api/preview/proxy/*`
131
+ mount real upgrades, mirrored in Relay and URL-token allowlists. Host removal
132
+ closes direct sockets and Relay substreams, including pending handshakes.
133
+ Client revocation tracks the raw upgrade socket before waiting for the upstream;
134
+ authorization is checked again immediately before accepting the upgrade.
135
+ Upstream message handling is installed at socket creation, before awaiting
136
+ physical connection validation or downstream authorization. Frames arriving
137
+ during admission (including the terminal protocol's immediate binary `ok`)
138
+ are held in an ordered, memory-only queue capped at 1 MiB and 256 frames.
139
+ They are forwarded with unchanged text/binary types only after the second
140
+ authorization check and client upgrade. Overflow fails the upgrade and closes
141
+ the upstream; revocation, socket closure and failure discard the queue.
142
+ Direct and E2EE Relay use the same admission path. No greeting is synthesized
143
+ and no terminal handshake timeout is extended to conceal missing frames.
144
+
145
+ The target-side local authority is `GET/POST /api/projects` and `PATCH
146
+ /api/projects/:id`. It only returns local projects. Authenticated
147
+ `/api/hosts/capabilities` advertises protocol 1 and the stable instance identity;
148
+ old/unavailable capability servers return a structured incompatible failure.
149
+ Transport admission uses this protected endpoint for both client authorization
150
+ and protocol negotiation, then reuses the result in the Gateway. It does not
151
+ require a separate `/auth/session` round trip or accept an unauthenticated health
152
+ response as authorization.
153
+
154
+ ## Real time and lifecycle
155
+
156
+ The target-side `/api/hosts/status-stream` subscribes to the target's existing
157
+ server-owned event hub and product tips. It projects only session-summary/status
158
+ fields; token/part/message deltas and inbox bodies never travel this status stream.
159
+ Native execution/inbox boundaries, unread/order/folder and project revisions are
160
+ covered. The Hub holds one such subscription per referenced host while an
161
+ authorized global client stream is present, and no periodic full-list poll.
162
+ Short HTTP operations retain only their target transport, not a status observer;
163
+ creating projects without a global stream cannot start background index scans.
164
+ After the final project reference is removed, the last temporary HTTP/WS holder
165
+ also closes that Host connection when it releases. A global Hub stream alone
166
+ does not keep an unreferenced Host alive; late release callbacks after shutdown
167
+ do not query the already-closed SQLite store.
168
+ The first status connection, reconnection and `yuri:worktree-topology-changed`
169
+ invalidate the remote worktree catalog. Ordinary summary/status changes reuse
170
+ it. Refresh requests retain the existing per-Host serial/two-Host global budget.
171
+ Those topology edges also enqueue the referenced roots and verified worktrees
172
+ through the remote `/api/yuri/session-index/sync` scheduler. Merely reading its
173
+ SQLite snapshot would leave a headless remote's imported sessions undiscovered.
174
+ Subsequent revision tips pull the updated snapshot; ordinary index tips never
175
+ enqueue the same scan again. An empty snapshot while the scheduler is active
176
+ remains stale. No remote UI window is required to initialize the index.
177
+ A failed project's catalog keeps its prior mapping with an explicit stale root;
178
+ it cannot erase another project's summaries or replace failure with empty success.
179
+ Removing a verified worktree hides its old summary partition without deleting
180
+ remote sessions. The directory resolver is built once per snapshot, rather than
181
+ reading the SQLite project/catalog tables for each session bucket.
182
+
183
+ OpenCode form reads/replies (`/api/form`) are project/session operations and pass
184
+ through the same authenticated Host proxy as permission and question operations.
185
+ Reconnection uses bounded jittered backoff; one-second source heartbeats permit
186
+ the 1.5-second stream stall detector to invalidate live status promptly.
187
+
188
+ The client's existing global stream carries:
189
+
190
+ ```ts
191
+ { type: 'yuri:host-status', properties: { hubId, hostId, host } }
192
+ { type: 'yuri:host-event', properties: { hubId, hostId, generation, directory?, payload } }
193
+ ```
194
+
195
+ Content demand is shared by `(hostId,directory,sessionId)`. Its eight-channel cap
196
+ never evicts an active reader: a ninth distinct active channel returns 429. Zero
197
+ observer channels are immediately released. Every active lease gets its own
198
+ `yuri:content-ready` payload `{id:leaseId,sessionId,channelId,readyGeneration}`;
199
+ late joiners get current ready and upstream reconnect changes readyGeneration.
200
+ Clients deduplicate by lease plus ready generation, then fetch the authority tail.
201
+ The last global stream for an owner releases all its leases. Pending acquisitions
202
+ capture the owner's cancellation generation and cannot recreate a revoked lease.
203
+
204
+ No references means zero added background network requests/readers/timers. No
205
+ clients means status/content readers, retry timers and Relay sockets are closed.
206
+ Interactive session reads/mutations preempt every host's refresh; interrupted
207
+ refreshes are requeued. Continued network waits suppress only their own host's
208
+ refresh, so a slow response cannot freeze unrelated hosts. Up to two hosts refresh concurrently,
209
+ one per host. Failure/partial/aborted reads preserve the prior snapshot.
210
+
211
+ ## Security
212
+
213
+ Aggregation requires a real desktop-local bearer or a current desktop/mobile
214
+ pairing grant. A password-less browser cookie is not a grant. URL-token requests
215
+ resolve the issuing client and recheck revocation/expiry. Every host-event send
216
+ uses a live resource filter in SSE, WS and the OpenCode SSE proxy subscriber;
217
+ unpaired global-stream consumers cannot receive remote content. Revocation
218
+ invalidates the filter before closing streams and outstanding operations.
219
+
220
+ Native setting changes reconcile ownership and replace connection generations.
221
+ SSH preparation installs its placeholder/promise before awaiting native work so
222
+ parallel cold requests share one preparation and transport. Credentials never
223
+ appear in public hosts, event envelopes or diagnostic errors. Direct candidates
224
+ of Relay-paired devices must prove server identity without credentials first.
225
+ Unpaired SSH never gets a Relay fallback. Target credentials remain in the Hub.
226
+ Native SSH errors are reduced to safe authentication/unreachable/service-starting
227
+ codes before crossing the adapter. Relay admission failures keep authorization
228
+ and incompatibility distinct from Relay unreachability; raw diagnostics remain
229
+ outside Gateway responses and receipts.
230
+
231
+ ## Validation and evidence boundary
232
+
233
+ `routes.test.js` uses real HTTP servers, production route registration/auth,
234
+ SQLite, real WS upgrades, the real E2EE tunnel client and the private Relay server.
235
+ It covers dual-write recovery, write-through, generation/authorization races,
236
+ unauthorized fanout, per-client shared content readiness, zero-work startup,
237
+ resource cleanup, host removal, preview assets/redirects, repeated Relay concurrent
238
+ requests/creation/terminal and delayed concurrent SSH preparation.
239
+ The three-Host collision fixture also checks SQLite reopen isolation, offline
240
+ retention and the global two-refresh/per-Host one-refresh budget while one Host
241
+ is stalled. The production `scripts/remote-projects-smoke.mjs` exercises the real
242
+ `startWebUiServer` middleware, registration, forwarding and reference removal;
243
+ its synthetic direct origin does not establish physical SSH/Relay/UI parity.
244
+
245
+ These are deterministic correctness/operation-count checks, not production
246
+ Electron/iOS timing, CPU/memory, WAN or physical SSH evidence. Those gates remain
247
+ separate in the feature acceptance record; do not infer them from this suite.
248
+
249
+ Latest backend validation covered 173 passing tests across the Gateway, transcript
250
+ cache, queue, content search, auth, event runtime, SSE reader, folders and Relay
251
+ cross-compatibility suites. The Gateway HTTP suite has 20 cases, including failed
252
+ metadata write preservation and remote removal/reassociation. Electron's package
253
+ suite passed 504 tests with 14 skipped native evidence cases. Web production build,
254
+ Electron main bundle, Web type-check, Electron syntax checks and focused backend
255
+ syntax checks passed. Web lint has its existing path-normalization warning;
256
+ Electron lint is a no-op. Dead-code inspection reported no Remote Host module
257
+ or notification-identity findings. The unmodified production smoke passed twice
258
+ after capability admission replaced the separate auth-session preflight.
259
+
260
+ Integration follow-up added three red-to-green production HTTP/WS cases for
261
+ revocation during handshake, bounded response-header waits and cross-host refresh
262
+ while an interactive body remains open. All 23 Gateway cases pass; the combined
263
+ auth/event-stream run passes 111 tests. The full Web project subsequently passed
264
+ 4014 tests with 20 skipped (305 passing files and 6 skipped).
265
+
266
+ This is not a complete feature acceptance result: skipped native evidence remains
267
+ unverified, and real desktop/Capacitor UI, physical SSH/WAN and production
268
+ performance must be validated by the integrating owner. No release or installer
269
+ launch is implied by bundle success.
@@ -0,0 +1,15 @@
1
+ const secretField = /^(?:api[_-]?key|password|secret|token|access[_-]?token|refresh[_-]?token|authorization|credentials?|clientToken|headers|env)$/i;
2
+
3
+ /** Config directories are read-only views, not a path to remote provider/MCP secrets. */
4
+ export function projectRemoteConfiguration(value) {
5
+ if (Array.isArray(value)) return value.map(projectRemoteConfiguration);
6
+ if (value && typeof value === 'object') return Object.fromEntries(Object.entries(value)
7
+ .filter(([name]) => !secretField.test(name)).map(([name, child]) => [name, projectRemoteConfiguration(child)]));
8
+ if (typeof value === 'string' && /^https?:\/\//i.test(value)) {
9
+ try {
10
+ const url = new URL(value);
11
+ if (url.username || url.password) { url.username = ''; url.password = ''; return url.toString(); }
12
+ } catch { /* Non-URL text stays display metadata. */ }
13
+ }
14
+ return value;
15
+ }
@@ -0,0 +1,22 @@
1
+ const deadlines = new FinalizationRegistry((timer) => clearTimeout(timer));
2
+ // Keep the timer callback's closure separate from the returned signal and its owner.
3
+ const expire = (reference) => () => reference.deref()?.controller.abort(
4
+ new DOMException('The operation was aborted due to timeout', 'TimeoutError'),
5
+ );
6
+
7
+ export const remoteDeadlineSignal = (milliseconds, parents = []) => {
8
+ const controller = new AbortController();
9
+ const signal = AbortSignal.any([...parents, controller.signal]);
10
+ if (signal.aborted) return signal;
11
+ const owner = { controller };
12
+ const timer = setTimeout(expire(new WeakRef(owner)), milliseconds);
13
+ timer.unref?.();
14
+ signal.addEventListener('abort', () => {
15
+ clearTimeout(timer);
16
+ deadlines.unregister(owner);
17
+ }, { once: true });
18
+ // Like AbortSignal.timeout, an abandoned signal must not be retained by its timer.
19
+ // Unlike a standalone timeout, parent cancellation also disposes the deadline now.
20
+ deadlines.register(signal, timer, owner);
21
+ return signal;
22
+ };