@yuriai/web 0.3.8-beta.13 → 0.3.8-beta.15

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 (174) hide show
  1. package/bin/cli.test.js +41 -4
  2. package/bin/lib/DOCUMENTATION.md +3 -2
  3. package/bin/lib/cli-args.js +1 -1
  4. package/bin/lib/commands-connect-url.js +2 -23
  5. package/bin/lib/commands-lifecycle.js +1 -0
  6. package/bin/lib/commands-serve.js +28 -23
  7. package/bin/lib/commands-update.js +1 -0
  8. package/bin/lib/commands-update.test.js +23 -3
  9. package/dist/assets/{AgentAvatar-BY1Uar-W.js → AgentAvatar-C4XFt_M4.js} +1 -1
  10. package/dist/assets/{AgentSelector-BTHcN1FV.js → AgentSelector-DFqp1Q2Q.js} +1 -1
  11. package/dist/assets/{ArchivedSessionsDialog-DSnawUO5.js → ArchivedSessionsDialog-g54oWqpZ.js} +1 -1
  12. package/dist/assets/{AssistantConversationSurface-Cfeh2vaU.js → AssistantConversationSurface-D1hYq8Qv.js} +3 -3
  13. package/dist/assets/{AssistantSessionCard-DEw5qpOl.js → AssistantSessionCard-wXwTXd6g.js} +2 -2
  14. package/dist/assets/{AssistantUnreadBadge-eHop7KFr.js → AssistantUnreadBadge-CRZj3x7N.js} +1 -1
  15. package/dist/assets/{AssistantView-BCzhUUR8.js → AssistantView-8q0gHHJe.js} +1 -1
  16. package/dist/assets/{AssistantWorkingAvatar-lw3h_DYH.js → AssistantWorkingAvatar-CThUPwlO.js} +1 -1
  17. package/dist/assets/{AssistantsSettingsPage-DngM9eGO.js → AssistantsSettingsPage-CmXi5ewY.js} +1 -1
  18. package/dist/assets/{BinaryFileFallback-CtqRJVb8.js → BinaryFileFallback-Bn0tjFbw.js} +1 -1
  19. package/dist/assets/{BtwPanel-DbifCGwT.js → BtwPanel-CCv9Gg5U.js} +1 -1
  20. package/dist/assets/{BusyDots-Bk6p5cua.js → BusyDots-5AETCd_5.js} +1 -1
  21. package/dist/assets/ChatContainer-DMSRIrld.js +65 -0
  22. package/dist/assets/{ChatView-B5ahnMA6.js → ChatView-C3Vy8API.js} +1 -1
  23. package/dist/assets/{DiagramView-CyXHjgFa.js → DiagramView-D45FAF9q.js} +1 -1
  24. package/dist/assets/{DiffView-DFujkn2g.js → DiffView-DuzaQqt9.js} +1 -1
  25. package/dist/assets/{DiffViewToggle-XA_EBPXw.js → DiffViewToggle-BtXeYhd3.js} +1 -1
  26. package/dist/assets/{ErrorBoundary-DeatD_L5.js → ErrorBoundary-CxfZ99MU.js} +1 -1
  27. package/dist/assets/{FadeInOnReveal-iCjNPFx8.js → FadeInOnReveal-DexeWpfu.js} +1 -1
  28. package/dist/assets/{GuiPluginMount-qoJ1nHjE.js → GuiPluginMount-CI9pNDXR.js} +1 -1
  29. package/dist/assets/{GuiPluginPage-BslRq2f5.js → GuiPluginPage-VUfpOHJt.js} +1 -1
  30. package/dist/assets/{GuiPluginSurface-TGUasA-U.js → GuiPluginSurface-CJd_xOQi.js} +1 -1
  31. package/dist/assets/{GuiPluginTitlebarItems-BUf_4msf.js → GuiPluginTitlebarItems-DtTmeb9T.js} +1 -1
  32. package/dist/assets/{GuiPluginWindow-Dt4kKaAD.js → GuiPluginWindow-CxQ9iXB5.js} +1 -1
  33. package/dist/assets/{Icon-BJy61Jon.js → Icon-DzOoxSwi.js} +1 -1
  34. package/dist/assets/{ImageLoadingPlaceholder-trHWUJt-.js → ImageLoadingPlaceholder-1vl5daoR.js} +1 -1
  35. package/dist/assets/{LoadingImage-xhLZPhd9.js → LoadingImage-DZ7p5FPK.js} +1 -1
  36. package/dist/assets/{MarkdownRenderer-DwwztSrL.js → MarkdownRenderer-CSJiFWD9.js} +2 -2
  37. package/dist/assets/{MarkdownRendererImpl-BbwqJp63.js → MarkdownRendererImpl-C9G_bN4T.js} +1 -1
  38. package/dist/assets/{MarkstreamRendererImpl-Bsvs0yhW.js → MarkstreamRendererImpl-DxYYBHex.js} +1 -1
  39. package/dist/assets/{MobileAssistantSettingsPage-NZI62Ey6.js → MobileAssistantSettingsPage-Dni0M0yT.js} +1 -1
  40. package/dist/assets/{MobileAssistantTab-DIrHBsL_.js → MobileAssistantTab-D-nQUU4Z.js} +1 -1
  41. package/dist/assets/{MobileBtwPage-H1GyfL02.js → MobileBtwPage-_TyqZN04.js} +1 -1
  42. package/dist/assets/{MobileChangesSurface-DiZ9RsZk.js → MobileChangesSurface-WG9TeDgt.js} +1 -1
  43. package/dist/assets/{MobileChatScreen-BKtbId56.js → MobileChatScreen-DxJS1Q7i.js} +1 -1
  44. package/dist/assets/{MobileDetailNavigation-BWWiAn9H.js → MobileDetailNavigation-MpDIB9fS.js} +1 -1
  45. package/dist/assets/{MobileFilesSurface-DSX2LTmx.js → MobileFilesSurface-j9wqAq5D.js} +2 -2
  46. package/dist/assets/{MobileHtmlNetworkBoundary-DJy9Q8VV.js → MobileHtmlNetworkBoundary-Cn1oaJPw.js} +2 -2
  47. package/dist/assets/{MobileOverlayPanel-XqAYxe55.js → MobileOverlayPanel-DargINqb.js} +1 -1
  48. package/dist/assets/{MobileResizableSheet-G0ftF_2y.js → MobileResizableSheet-BP5f0TbE.js} +1 -1
  49. package/dist/assets/{MobileSettingsTab-gKqFXYC4.js → MobileSettingsTab-Cyw95F7x.js} +1 -1
  50. package/dist/assets/{MobileShareBridge-C0xW2_n0.js → MobileShareBridge-CrtV4RjV.js} +1 -1
  51. package/dist/assets/{MobileSurface-DZnaMpfo.js → MobileSurface-wpS174pv.js} +1 -1
  52. package/dist/assets/{MobileTabPageHeader-CsmuqMP6.js → MobileTabPageHeader-E8ZU0uzl.js} +1 -1
  53. package/dist/assets/{ModelLogo-B50mkTPp.js → ModelLogo-sKWRbEu8.js} +1 -1
  54. package/dist/assets/{ModelSelector-CdBPSXZ2.js → ModelSelector-COspP6ja.js} +1 -1
  55. package/dist/assets/{MultiRunWindow-CmbU5iWH.js → MultiRunWindow-DjBcR8V9.js} +1 -1
  56. package/dist/assets/{OnboardingScreen-DjVB5jqP.js → OnboardingScreen-BdWTejcj.js} +1 -1
  57. package/dist/assets/{OverlayScrollbar-CLu72YSm.js → OverlayScrollbar-CEyrhwmJ.js} +1 -1
  58. package/dist/assets/{PierreDiffViewer-CIwYEUv3.js → PierreDiffViewer-2p6Xc-67.js} +1 -1
  59. package/dist/assets/{ProviderLogo-DxffoDzo.js → ProviderLogo-Bwh6N-2k.js} +1 -1
  60. package/dist/assets/{RemoteAssistantSessionCard-CrVXWVNC.js → RemoteAssistantSessionCard-DbmTHbYg.js} +1 -1
  61. package/dist/assets/{RemoteDesktopPanel-CW3VO7kH.js → RemoteDesktopPanel-nvSFjW3s.js} +1 -1
  62. package/dist/assets/{ScheduledTasksDialog-CH-yxh54.js → ScheduledTasksDialog-CJQfZGg7.js} +1 -1
  63. package/dist/assets/{ScrollableOverlay-_-c4eChV.js → ScrollableOverlay-BzBFaJRG.js} +1 -1
  64. package/dist/assets/{SettingsGroup-BEuuCHe_.js → SettingsGroup--aqcChkc.js} +1 -1
  65. package/dist/assets/{SettingsView-DTzFUwvv.js → SettingsView-BfZPLtx7.js} +2 -2
  66. package/dist/assets/{SettingsWindow-I98QE5aS.js → SettingsWindow-Dlt582rY.js} +1 -1
  67. package/dist/assets/{SetupTourDialog-3ejWHEJz.js → SetupTourDialog-NbVOePTS.js} +1 -1
  68. package/dist/assets/{SyncActions-BJmY7x7G.js → SyncActions-Cq3jpqup.js} +1 -1
  69. package/dist/assets/TerminalView-DOhD-9Ui.js +9 -0
  70. package/dist/assets/{TextSelectionMenu-BvRgpSxU.js → TextSelectionMenu-Dj5vva1V.js} +1 -1
  71. package/dist/assets/{ToolOutputDialog-DSfZp0SO.js → ToolOutputDialog-CNkcl4wm.js} +5 -5
  72. package/dist/assets/{assistantMessagePreview-gyTcahWF.js → assistantMessagePreview-HDXaIDvw.js} +1 -1
  73. package/dist/assets/{assistantQueries-DDeccc-m.js → assistantQueries-9d7JqkNy.js} +1 -1
  74. package/dist/assets/{auto-read-context-D2UX6oXY.js → auto-read-context-BCeaaC2w.js} +1 -1
  75. package/dist/assets/{capgoAdapter-BucnEwMn.js → capgoAdapter-C40Xnm3I.js} +1 -1
  76. package/dist/assets/{card-C39FDK7q.js → card-Cm-b3g3Y.js} +1 -1
  77. package/dist/assets/{chatUpwardIntent-uv8XbV0r.js → chatUpwardIntent-CcI1_g74.js} +1 -1
  78. package/dist/assets/{checkbox-C3kPdnVf.js → checkbox-B4BCOaCa.js} +1 -1
  79. package/dist/assets/{collapsible-BYAyt7tx.js → collapsible-DBj-0rzi.js} +1 -1
  80. package/dist/assets/{connection-hint-zKPzQOm-.js → connection-hint-Cw59zLLF.js} +1 -1
  81. package/dist/assets/{context-menu-D7tWqAhJ.js → context-menu-CKocvm4c.js} +1 -1
  82. package/dist/assets/{diagram-qoeZRJBj.js → diagram-CJNTqeCv.js} +1 -1
  83. package/dist/assets/{dialog-B9djOKHd.js → dialog-DHqhT2Ls.js} +1 -1
  84. package/dist/assets/{dropdown-menu-Bg9fqXHM.js → dropdown-menu-Ct4M8mhX.js} +1 -1
  85. package/dist/assets/{fileMentionTouchSelection-DBohWG86.js → fileMentionTouchSelection-BpHcgqhk.js} +1 -1
  86. package/dist/assets/{fileReferenceActions-KSYTdo_6.js → fileReferenceActions-BpqKMP6J.js} +1 -1
  87. package/dist/assets/{gitApi-D7UHXMTh.js → gitApi-Byxc9j2j.js} +1 -1
  88. package/dist/assets/{gitApiHttp-Cx9rEFyN.js → gitApiHttp-CStyHJBc.js} +2 -2
  89. package/dist/assets/{icons-BJ-yKguF.js → icons-BNKKEGWN.js} +1 -1
  90. package/dist/assets/{input-DgT2vL85.js → input-DV8YJCiB.js} +1 -1
  91. package/dist/assets/{insertionBoundaries-CNdm9xws.js → insertionBoundaries-FonHeXo1.js} +1 -1
  92. package/dist/assets/{kbd-DTXNf7DP.js → kbd-5hstL3ii.js} +1 -1
  93. package/dist/assets/{main-BYm7jJf7.js → main-C7gMH-j6.js} +2 -2
  94. package/dist/assets/{main-CKpcvsKp.js → main-Cdbm9kl9.js} +14 -14
  95. package/dist/assets/{markdownHeightCache-BthXvgH2.js → markdownHeightCache-BCEqrVq-.js} +1 -1
  96. package/dist/assets/{mcpQueries-yp0LLKop.js → mcpQueries-r-nQNiC3.js} +1 -1
  97. package/dist/assets/{miniChat-CsVxurBz.js → miniChat-BjjPtcy_.js} +2 -2
  98. package/dist/assets/{mobile-Bnn1Av6s.js → mobile-qvd0Mmzl.js} +2 -2
  99. package/dist/assets/{mobileBackNavigation-Dc2Ms_yz.js → mobileBackNavigation-PIgfuhcI.js} +1 -1
  100. package/dist/assets/mobileConnections-D_rJ4JYb.js +2 -0
  101. package/dist/assets/{multirun-YneUyzFb.js → multirun-BdWi45Ka.js} +1 -1
  102. package/dist/assets/{native-config-CHbBpTtL.js → native-config-IL7xEhd_.js} +1 -1
  103. package/dist/assets/{nativeComposerCover-BvxREQD3.js → nativeComposerCover-XcebzoJ9.js} +1 -1
  104. package/dist/assets/{navigation-BcMxWKOy.js → navigation-DndnEFOd.js} +1 -1
  105. package/dist/assets/{openRemoteProjectSession-Bj1JqTJL.js → openRemoteProjectSession-DjHewPaN.js} +1 -1
  106. package/dist/assets/{openSessionFromDeepLink-RIdfYNVc.js → openSessionFromDeepLink-CGzd-psR.js} +2 -2
  107. package/dist/assets/{pluginPresentation-TcpIXFdR.js → pluginPresentation-DcwFbDAx.js} +1 -1
  108. package/dist/assets/{pwa-B0DzO_Wm.js → pwa-CO5ex7Bx.js} +1 -1
  109. package/dist/assets/{queue-abort-optimistic-9kcDZ3sO.js → queue-abort-optimistic-CWrExk4N.js} +1 -1
  110. package/dist/assets/{reference-history-Bpfp7nl-.js → reference-history-TM8GmEOq.js} +1 -1
  111. package/dist/assets/remoteProjectQueries-CopzDHZe.js +1 -0
  112. package/dist/assets/{remoteSessionReference-CzFqDMfO.js → remoteSessionReference-COvISyp6.js} +1 -1
  113. package/dist/assets/{renderElectronMiniChatApp-BMxJmIaf.js → renderElectronMiniChatApp-2UYR3CvZ.js} +2 -2
  114. package/dist/assets/{renderMobileApp-g6VIdksz.js → renderMobileApp-BKYNa8m6.js} +5 -5
  115. package/dist/assets/{runtimeConfig-CQuMlWSU.js → runtimeConfig-h5JOCoZq.js} +1 -1
  116. package/dist/assets/runtimeEndpointReset-ehGqR2xT.js +4 -0
  117. package/dist/assets/{scheduledTaskNavigation-SCU3wxYg.js → scheduledTaskNavigation-BfgxRBkZ.js} +1 -1
  118. package/dist/assets/{select-B0A2UPYI.js → select-BrXKIkdf.js} +1 -1
  119. package/dist/assets/{sessionLookup-CDS-3lqX.js → sessionLookup-C8hJwtOI.js} +1 -1
  120. package/dist/assets/{sessionOwnership-C6kEL9vi.js → sessionOwnership-Be4lp__z.js} +1 -1
  121. package/dist/assets/{shortcuts-DQjWb6-B.js → shortcuts-fTrZjAfF.js} +1 -1
  122. package/dist/assets/{sortable-tabs-strip-CIJ_GrzH.js → sortable-tabs-strip-CtQXM6Q_.js} +1 -1
  123. package/dist/assets/{speechSettingsQueries-BdZipozF.js → speechSettingsQueries-BfULrDJ4.js} +1 -1
  124. package/dist/assets/{switch-BTd4fb-u.js → switch-BzyEGzPy.js} +1 -1
  125. package/dist/assets/{terminalApi-Cs8T3taw.js → terminalApi-Cg9eNRXp.js} +1 -1
  126. package/dist/assets/{textarea-BMLYkY1C.js → textarea-D8ayHQtF.js} +1 -1
  127. package/dist/assets/{tooltip-C7bh8-oj.js → tooltip-ByNu3vY2.js} +1 -1
  128. package/dist/assets/{truncated-path-D4zPMNfI.js → truncated-path-Bxr15UVi.js} +1 -1
  129. package/dist/assets/{types-CAv5YLRJ.js → types-BTZ1c0Jb.js} +1 -1
  130. package/dist/assets/{ui-C93TriAS.js → ui-CuL4d44b.js} +5 -5
  131. package/dist/assets/useAppFontEffects-y-bsvPnx.js +7 -0
  132. package/dist/assets/{useAssistantUIStore-jd_I1qR9.js → useAssistantUIStore-D_7_VmeY.js} +1 -1
  133. package/dist/assets/{useDesktopWindowControlsLayout-BFZelO28.js → useDesktopWindowControlsLayout-2ypf2FpC.js} +1 -1
  134. package/dist/assets/{useDictation-Dw4cPz-9.js → useDictation-dqmYhgvS.js} +1 -1
  135. package/dist/assets/{useEffectiveDirectory-ClRxkgy2.js → useEffectiveDirectory-COpJ0ZIO.js} +1 -1
  136. package/dist/assets/{useFontPreferences-D8ajsrAw.js → useFontPreferences-C_U0TdQZ.js} +1 -1
  137. package/dist/assets/{useGitStore-DDE7AUsk.js → useGitStore-Bx2PuaQ8.js} +1 -1
  138. package/dist/assets/{useInlineCommentDraftStore-oj1WmZIi.js → useInlineCommentDraftStore-D6ouJiNs.js} +1 -1
  139. package/dist/assets/{useMcpConfigStore-DbltISt3.js → useMcpConfigStore-DWigA_d-.js} +1 -1
  140. package/dist/assets/{useMobileSwipeActions-qeExRIFa.js → useMobileSwipeActions-DDLR3cXV.js} +1 -1
  141. package/dist/assets/{useMobileTranscriptSyncHint-CLHeiwxO.js → useMobileTranscriptSyncHint-DVrgKfOa.js} +1 -1
  142. package/dist/assets/{useModelLists-DUUovEwL.js → useModelLists-DuvU2YJn.js} +1 -1
  143. package/dist/assets/{useOpenCodeReadiness-DRZyVsuu.js → useOpenCodeReadiness-CuBypQqR.js} +1 -1
  144. package/dist/assets/{usePluginsStore-W-iNVsmP.js → usePluginsStore-Da1EfCvm.js} +1 -1
  145. package/dist/assets/{useProjectGitActions-BBbZCQTk.js → useProjectGitActions-BboNQAuM.js} +1 -1
  146. package/dist/assets/{useProjectGitStore-DB_eyTwc.js → useProjectGitStore-Bn2qZLge.js} +1 -1
  147. package/dist/assets/{useProjectRuntimeAPIs-CR9pISBy.js → useProjectRuntimeAPIs-CN4OxfbZ.js} +1 -1
  148. package/dist/assets/{useQuotaStore-cFgc-IG2.js → useQuotaStore-BXsKZAl0.js} +1 -1
  149. package/dist/assets/{useSessionBtwStore-CXgbHj8n.js → useSessionBtwStore-_zUbR6v1.js} +1 -1
  150. package/dist/assets/{useStreamingTextThrottle-B5HUK2ar.js → useStreamingTextThrottle-C0rP4Zp3.js} +1 -1
  151. package/dist/assets/{useTerminalStore-BEY9gQzc.js → useTerminalStore-BRbNqUvc.js} +1 -1
  152. package/dist/assets/useUIStore-1DE4XJOx.js +1 -0
  153. package/dist/assets/{worktreeManager-7PwfaVcz.js → worktreeManager-C7sfZBxc.js} +1 -1
  154. package/dist/assets/{worktreeSourceBranchPreference-CL4vcrug.js → worktreeSourceBranchPreference-CNb-gxQ2.js} +1 -1
  155. package/dist/index.html +8 -8
  156. package/dist/mini-chat.html +8 -8
  157. package/dist/mobile.html +1 -1
  158. package/package.json +1 -1
  159. package/server/lib/host-update/DOCUMENTATION.md +5 -2
  160. package/server/lib/notifications/apns-runtime.test.js +3 -3
  161. package/server/lib/opencode/DOCUMENTATION.md +1 -1
  162. package/server/lib/relay/DOCUMENTATION.md +1 -1
  163. package/server/lib/relay/service.js +7 -18
  164. package/server/lib/relay/service.test.js +19 -14
  165. package/server/lib/remote-hosts/DOCUMENTATION.md +5 -1
  166. package/server/lib/remote-hosts/routes.js +44 -0
  167. package/server/lib/remote-hosts/routes.test.js +29 -0
  168. package/dist/assets/ChatContainer-CRupjnre.js +0 -65
  169. package/dist/assets/TerminalView-B2I_vByC.js +0 -9
  170. package/dist/assets/mobileConnections-CPcUZA0K.js +0 -2
  171. package/dist/assets/remoteProjectQueries-DFbTE2e2.js +0 -1
  172. package/dist/assets/runtimeEndpointReset-wwLirdka.js +0 -4
  173. package/dist/assets/useAppFontEffects-C__2VHhM.js +0 -7
  174. package/dist/assets/useUIStore-CxX_u4P7.js +0 -1
package/bin/cli.test.js CHANGED
@@ -224,6 +224,43 @@ describe('cli args', () => {
224
224
  });
225
225
  });
226
226
 
227
+ it.each([true, 'wss://pinned.example/ws'])('keeps saved relay endpoints on managed startup with --relay-host=%s', async (relayHost) => {
228
+ const { applyRelayHostOptIn } = await import('./lib/commands-serve.js');
229
+ const previous = process.env.YURI_RELAY_URL;
230
+ try {
231
+ await withTempYuriDataDir(async (dir) => {
232
+ const settingsPath = path.join(dir, 'settings.json');
233
+ const saved = {
234
+ enabled: true,
235
+ relayUrl: 'wss://primary.example/ws',
236
+ extraRelayUrls: ['wss://paired.example/relay/ws', 'wss://backup.example/ws'],
237
+ };
238
+ fs.writeFileSync(settingsPath, JSON.stringify({ privateRelay: saved, theme: 'dark' }));
239
+
240
+ applyRelayHostOptIn({ relayHost });
241
+ const expected = { ...saved, relayUrl: relayHost === true ? saved.relayUrl : relayHost };
242
+ expect(JSON.parse(fs.readFileSync(settingsPath, 'utf8'))).toEqual({ privateRelay: expected, theme: 'dark' });
243
+
244
+ delete process.env.YURI_RELAY_URL;
245
+ applyRelayHostOptIn({ relayHost: true });
246
+ expect(JSON.parse(fs.readFileSync(settingsPath, 'utf8')).privateRelay).toEqual(expected);
247
+ });
248
+ } finally {
249
+ if (previous === undefined) delete process.env.YURI_RELAY_URL;
250
+ else process.env.YURI_RELAY_URL = previous;
251
+ }
252
+ });
253
+
254
+ it('does not replace unreadable settings with defaults on managed relay startup', async () => {
255
+ const { applyRelayHostOptIn } = await import('./lib/commands-serve.js');
256
+ await withTempYuriDataDir(async (dir) => {
257
+ const settingsPath = path.join(dir, 'settings.json');
258
+ fs.writeFileSync(settingsPath, '{incomplete');
259
+ expect(() => applyRelayHostOptIn({ relayHost: true })).toThrow(/settings/i);
260
+ expect(fs.readFileSync(settingsPath, 'utf8')).toBe('{incomplete');
261
+ });
262
+ });
263
+
227
264
  it('parses connect-url api-only help', () => {
228
265
  const parsed = parseArgs(['connect-url', '--api-only', '--help']);
229
266
 
@@ -810,9 +847,9 @@ describe('lifecycle commands with unmanaged explicit ports', () => {
810
847
  });
811
848
  });
812
849
 
813
- it('restart --port restarts a live unmanaged server through the shared explicit-port discovery path', async () => {
850
+ it.each(['web', 'ssh-remote'])('restart --port preserves the discovered %s runtime', async (runtime) => {
814
851
  await withTempYuriDataDir(async () => {
815
- const server = await startMockYuriServer();
852
+ const server = await startMockYuriServer({ runtime });
816
853
  const calls = [];
817
854
  const host = '127.0.0.1';
818
855
  try {
@@ -821,7 +858,7 @@ describe('lifecycle commands with unmanaged explicit ports', () => {
821
858
  calls.push(['stop', options.port, options.host]);
822
859
  },
823
860
  serve: async (options) => {
824
- calls.push(['serve', options.port, options.host]);
861
+ calls.push(['serve', options.port, options.host, options.restartRuntime]);
825
862
  return options.port;
826
863
  },
827
864
  }, { explicitPort: true, port: server.port, host, json: true }));
@@ -829,7 +866,7 @@ describe('lifecycle commands with unmanaged explicit ports', () => {
829
866
  const payload = JSON.parse(output);
830
867
  expect(calls).toEqual([
831
868
  ['stop', server.port, host],
832
- ['serve', server.port, host],
869
+ ['serve', server.port, host, runtime],
833
870
  ]);
834
871
  expect(payload.restartedCount).toBe(1);
835
872
  expect(payload.results).toEqual([
@@ -23,11 +23,12 @@ Command modules implement user-facing commands and preserve output contracts acr
23
23
  - The Host process always inherits the CLI's Node executable. Do not select Bun based on PATH availability: the Web API owns `better-sqlite3` and requires the prepared Node ABI.
24
24
  - The self-contained launcher passes `--title=yuri`; propagate that explicit title to its daemon so lifecycle identity checks continue to work after relocation to a directory not named Yuri.
25
25
  - Sets `YURI_RUNTIME=web` for ordinary CLI serve (foreground and daemon) so a leftover desktop env cannot host or probe the private relay. Preserves `YURI_RUNTIME=ssh-remote` when SSH manager already set it.
26
- - `--relay-host [url]` is valid only when `YURI_RUNTIME=ssh-remote`. It enables the private relay host before startup: writes `settings.privateRelay.enabled=true` (and optional pinned `relayUrl`), and when a URL is provided also sets `YURI_RELAY_URL`. Ordinary `web` serve rejects the flag.
26
+ - `--relay-host [url]` is valid only in the `ssh-remote` runtime. It enables the private relay host before startup, keeping the saved primary and extra endpoints. An explicit URL updates only the saved primary. `YURI_RELAY_URL` only seeds a missing primary. An unreadable settings file is never overwritten. Ordinary `web` serve rejects the flag.
27
27
 
28
28
  - `commands-lifecycle.js`
29
29
  - Implements `yuri stop` and `yuri restart`.
30
30
  - Owns lifecycle stop/restart semantics, desktop-managed port rejection, unmanaged instance shutdown attempts, PID/instance cleanup, and restart reuse of stored instance options.
31
+ - `restart` and CLI `update` reuse the discovered runtime and read Relay configuration from the Host settings; they do not replay the SSH opt-in.
31
32
 
32
33
  - `commands-status.js`
33
34
  - Implements `yuri status`.
@@ -46,7 +47,7 @@ Command modules implement user-facing commands and preserve output contracts acr
46
47
  - Finds or starts a local instance and prints the browser/connect URL according to the selected output mode.
47
48
  - Emits a **pairing v2** link (`yuri://connect?v=2&p=<base64url>`): it creates a one-time pairing session in the shared store (`client-pairing-sessions.json`) and encodes the pairing id + secret + transport candidates. The client redeems the secret over whichever candidate connects first (`/api/client-auth/pairing/redeem`). No standalone token is embedded — the QR itself is the single-use credential.
48
49
  - The default form advertises the resolved server URL as a direct (lan/tunnel) candidate and folds in a relay candidate when the host relay is enabled, so one link works on-LAN and off-network.
49
- - `--relay` builds a relay-only pairing link (the sole candidate is the relay transport), for sharing with a device that is not on the host's network — no server URL, no auto-start. The relay endpoint follows `YURI_RELAY_URL` / the stored setting / the default, matching the running host; the host must be running with the relay enabled to serve the redeem over the tunnel.
50
+ - `--relay` builds a relay-only pairing link (the sole candidate is the relay transport), for sharing with a device that is not on the host's network — no server URL, no auto-start. The relay endpoint follows the stored setting / `YURI_RELAY_URL` / the default, matching the running host; the host must be running with the relay enabled to serve the redeem over the tunnel.
50
51
 
51
52
  - `commands-update.js`
52
53
  - Implements `yuri update`.
@@ -333,7 +333,7 @@ ENVIRONMENT:
333
333
  YURI_UI_PASSWORD Alternative to --ui-password flag
334
334
  YURI_API_ONLY Set to true/1 to start API routes only
335
335
  YURI_DATA_DIR Override Yuri data directory
336
- YURI_RELAY_URL Pin private relay endpoint (ws:// or wss://)
336
+ YURI_RELAY_URL Initial private relay endpoint if none is saved (ws:// or wss://)
337
337
  OPENCODE_HOST External OpenCode server base URL, e.g. http://hostname:4096
338
338
  OPENCODE_PORT Port of external OpenCode server to connect to
339
339
  OPENCODE_SKIP_START Skip starting OpenCode, use external server
@@ -15,7 +15,7 @@ import { getInstanceFilePath, readInstanceOptions } from './cli-process.js';
15
15
  import { createRemoteClientAuthRuntime } from '../../server/lib/client-auth/remote-clients.js';
16
16
  import { createClientPairingRuntime } from '../../server/lib/client-auth/pairing.js';
17
17
  import { createRelayIdentityRuntime } from '../../server/lib/relay/identity.js';
18
- import { DEFAULT_RELAY_URL } from '../../server/lib/relay/service.js';
18
+ import { resolveEffectiveRelayUrl } from '../../server/lib/relay/service.js';
19
19
  import { bytesToBase64Url } from '../../server/lib/relay/e2ee.js';
20
20
  import {
21
21
  intro as clackIntro,
@@ -31,27 +31,6 @@ const REMOTE_CLIENTS_FILE_NAME = 'remote-clients.json';
31
31
  const SETTINGS_FILE_NAME = 'settings.json';
32
32
  const PAIRING_SESSIONS_FILE_NAME = 'client-pairing-sessions.json';
33
33
 
34
- function isValidRelayUrl(value) {
35
- if (typeof value !== 'string') return false;
36
- try {
37
- const url = new URL(value.trim());
38
- return url.protocol === 'ws:' || url.protocol === 'wss:';
39
- } catch {
40
- return false;
41
- }
42
- }
43
-
44
- // Resolve the relay endpoint the same way the running host does (service.js):
45
- // YURI_RELAY_URL env override, then the stored setting, then the default —
46
- // so the pairing link points at the same relay the host connects out to.
47
- function resolveRelayUrl(settings) {
48
- const envUrl = process.env.YURI_RELAY_URL;
49
- if (isValidRelayUrl(envUrl)) return envUrl.trim();
50
- const stored = settings?.privateRelay?.relayUrl;
51
- if (isValidRelayUrl(stored)) return stored.trim();
52
- return DEFAULT_RELAY_URL;
53
- }
54
-
55
34
  // Minimal settings.json read/write for the relay identity runtime. It reads the
56
35
  // whole object and writes it back with the relay keys added, so other settings
57
36
  // are preserved. Enough for the CLI without wiring the full settings runtime.
@@ -80,7 +59,7 @@ function createSettingsAccessors() {
80
59
  async function buildRelayPairingCandidate() {
81
60
  const accessors = createSettingsAccessors();
82
61
  const settings = await accessors.readSettingsFromDiskMigrated();
83
- const relayUrl = resolveRelayUrl(settings);
62
+ const relayUrl = resolveEffectiveRelayUrl({ settings });
84
63
  const identityRuntime = createRelayIdentityRuntime({ crypto, ...accessors });
85
64
  const identity = await identityRuntime.getRelayIdentity();
86
65
  return {
@@ -349,6 +349,7 @@ async function restartCommand(options, serveCommand) {
349
349
  const restartedPort = await runServe({
350
350
  port: restartPort,
351
351
  host: instanceHost,
352
+ restartRuntime: instance.runtime,
352
353
  explicitPort: true,
353
354
  uiPassword: options.explicitUiPassword ? options.uiPassword : (storedOptions.uiPassword || options.uiPassword),
354
355
  apiOnly: storedOptions.apiOnly === true || options.apiOnly === true,
@@ -2,6 +2,7 @@ import fs from 'fs';
2
2
  import path from 'path';
3
3
  import { pathToFileURL } from 'url';
4
4
  import { spawn } from 'child_process';
5
+ import { randomUUID } from 'node:crypto';
5
6
  import { EXIT_CODE, TunnelCliError } from './cli-errors.js';
6
7
  import { buildLocalUrl, resolveServeHost, assertSafeBrowserPort, hasUiPasswordConfigured, assertAuthenticatedNetworkExposure } from './cli-network.js';
7
8
  import { fetchSystemInfoFromPort } from './cli-http.js';
@@ -13,7 +14,7 @@ import { getPidFilePath, getInstanceFilePath, writePidFile, writeInstanceOptions
13
14
  import { isNetworkExposedBindHost } from '../../server/lib/security/bind-host.js';
14
15
  import {
15
16
  canonicalizeRelayUrl,
16
- DEFAULT_RELAY_URL,
17
+ resolveEffectiveRelayUrl,
17
18
  } from '../../server/lib/relay/service.js';
18
19
  import {
19
20
  intro as clackIntro,
@@ -46,8 +47,7 @@ function assertServeRelayHostAllowed(serveRuntime, options) {
46
47
  }
47
48
 
48
49
  // Persist privateRelay.enabled before the server starts so reconcile /
49
- // startIfEnabled sees the opt-in. Optional URL pins the endpoint in settings
50
- // and YURI_RELAY_URL (env override stays authoritative while set).
50
+ // startIfEnabled sees the opt-in. An explicit URL updates the saved primary.
51
51
  function applyRelayHostOptIn(options) {
52
52
  if (!options?.relayHost) return;
53
53
 
@@ -60,33 +60,36 @@ function applyRelayHostOptIn(options) {
60
60
  EXIT_CODE.USAGE_ERROR,
61
61
  );
62
62
  }
63
- process.env.YURI_RELAY_URL = pinnedUrl;
64
63
  }
65
64
 
66
65
  const settingsPath = path.join(getDataDir(), SETTINGS_FILE_NAME);
67
66
  let settings = {};
68
67
  try {
69
68
  settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
70
- if (!settings || typeof settings !== 'object' || Array.isArray(settings)) settings = {};
71
- } catch {
72
- settings = {};
69
+ if (!settings || typeof settings !== 'object' || Array.isArray(settings)) {
70
+ throw new Error('Expected a settings object');
71
+ }
72
+ } catch (error) {
73
+ if (error.code !== 'ENOENT') {
74
+ throw new Error('Cannot read Yuri settings; existing Relay configuration was not changed.', { cause: error });
75
+ }
73
76
  }
74
77
 
75
- const existingUrl = typeof settings?.privateRelay?.relayUrl === 'string'
76
- ? settings.privateRelay.relayUrl
77
- : null;
78
- const relayUrl = pinnedUrl
79
- ?? (canonicalizeRelayUrl(existingUrl) || DEFAULT_RELAY_URL);
80
-
81
- fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
82
- fs.writeFileSync(
83
- settingsPath,
84
- `${JSON.stringify({
85
- ...settings,
86
- privateRelay: { enabled: true, relayUrl },
87
- }, null, 2)}\n`,
88
- 'utf8',
89
- );
78
+ const stored = settings.privateRelay;
79
+ const relayUrl = pinnedUrl ?? resolveEffectiveRelayUrl({ settings });
80
+ if (stored?.enabled !== true || stored.relayUrl !== relayUrl) {
81
+ fs.mkdirSync(path.dirname(settingsPath), { recursive: true });
82
+ const tempPath = `${settingsPath}.tmp-${randomUUID()}`;
83
+ try {
84
+ fs.writeFileSync(tempPath, `${JSON.stringify({
85
+ ...settings,
86
+ privateRelay: { ...stored, enabled: true, relayUrl },
87
+ }, null, 2)}\n`, { encoding: 'utf8', flag: 'wx', mode: 0o600 });
88
+ fs.renameSync(tempPath, settingsPath);
89
+ } finally {
90
+ fs.rmSync(tempPath, { force: true });
91
+ }
92
+ }
90
93
  }
91
94
 
92
95
  function createServeCommand({
@@ -169,7 +172,9 @@ async function serveCommand(options) {
169
172
  // package scripts. Selecting Bun merely because it is installed makes an
170
173
  // otherwise valid CLI launch fail before the Host can report readiness.
171
174
  const runtimeBin = process.execPath;
172
- const serveRuntime = resolveServeRuntime();
175
+ const serveRuntime = options.restartRuntime === undefined
176
+ ? resolveServeRuntime()
177
+ : resolveServeRuntime({ YURI_RUNTIME: options.restartRuntime });
173
178
  assertServeRelayHostAllowed(serveRuntime, options);
174
179
  applyRelayHostOptIn(options);
175
180
 
@@ -111,6 +111,7 @@ function createUpdateCommand({ importFromFilePath, packageManagerPath, serveComm
111
111
  await serveCommand({
112
112
  port: storedOptions.port || instance.port,
113
113
  host: storedOptions.host,
114
+ restartRuntime: instance.runtime,
114
115
  explicitPort: true,
115
116
  uiPassword: storedOptions.uiPassword,
116
117
  suppressStartupSummary: true,
@@ -6,10 +6,21 @@ import { describe, expect, it, vi } from 'vitest';
6
6
  import { createUpdateCommand } from './commands-update.js';
7
7
 
8
8
  const portableFixture = vi.hoisted(() => ({ installation: null }));
9
+ const lifecycle = vi.hoisted(() => ({
10
+ discoverRunningInstances: vi.fn(async () => []),
11
+ requestServerShutdown: vi.fn(async () => true),
12
+ stopInstanceProcess: vi.fn(async () => true),
13
+ }));
9
14
  vi.mock('../../server/lib/portable-installation.js', async (original) => ({
10
15
  ...await original(),
11
16
  readPortableInstallation: () => portableFixture.installation,
12
17
  }));
18
+ vi.mock('./cli-lifecycle.js', () => ({ discoverRunningInstances: lifecycle.discoverRunningInstances }));
19
+ vi.mock('./cli-http.js', () => ({ requestServerShutdown: lifecycle.requestServerShutdown }));
20
+ vi.mock('./cli-process.js', async (original) => ({
21
+ ...await original(),
22
+ stopInstanceProcess: lifecycle.stopInstanceProcess,
23
+ }));
13
24
 
14
25
  async function withTempYuriDataDir(fn) {
15
26
  const previous = process.env.YURI_DATA_DIR;
@@ -40,14 +51,21 @@ describe('update command', () => {
40
51
  } finally { portableFixture.installation = null; }
41
52
  });
42
53
 
43
- it('uses the package-manager helpers on the update-available path', async () => {
44
- await withTempYuriDataDir(async () => {
54
+ it('updates a managed daemon and restarts it from saved Relay settings without replaying the opt-in', async () => {
55
+ await withTempYuriDataDir(async (dir) => {
45
56
  const originalWrite = process.stdout.write;
46
57
  process.stdout.write = vi.fn(() => true);
58
+ const instanceFilePath = path.join(dir, 'instance.json');
59
+ const port = 3100;
60
+ fs.writeFileSync(instanceFilePath, JSON.stringify({ port, host: '127.0.0.1' }));
61
+ lifecycle.discoverRunningInstances.mockResolvedValueOnce([
62
+ { port, host: '127.0.0.1', pid: 500, runtime: 'ssh-remote', instanceFilePath, pidFilePath: path.join(dir, 'instance.pid') },
63
+ ]);
47
64
  const executeUpdate = vi.fn(() => ({ success: true, exitCode: 0 }));
65
+ const serveCommand = vi.fn();
48
66
  const updateCommand = createUpdateCommand({
49
67
  packageManagerPath: '/fake/package-manager.js',
50
- serveCommand: vi.fn(),
68
+ serveCommand,
51
69
  importFromFilePath: vi.fn(async () => ({
52
70
  checkForUpdates: vi.fn(async () => ({ available: true, version: '9.9.9' })),
53
71
  detectPackageManager: vi.fn(() => 'npm'),
@@ -60,6 +78,8 @@ describe('update command', () => {
60
78
  await updateCommand({ json: true });
61
79
 
62
80
  expect(executeUpdate).toHaveBeenCalledWith('npm', { silent: true });
81
+ expect(serveCommand).toHaveBeenCalledWith(expect.objectContaining({ port, restartRuntime: 'ssh-remote' }));
82
+ expect(serveCommand.mock.calls[0][0]).not.toHaveProperty('relayHost');
63
83
  } finally {
64
84
  process.stdout.write = originalWrite;
65
85
  }