@yuriai/web 0.3.8-beta.13 → 0.3.8-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.test.js +41 -4
- package/bin/lib/DOCUMENTATION.md +3 -2
- package/bin/lib/cli-args.js +1 -1
- package/bin/lib/commands-connect-url.js +2 -23
- package/bin/lib/commands-lifecycle.js +1 -0
- package/bin/lib/commands-serve.js +28 -23
- package/bin/lib/commands-update.js +1 -0
- package/bin/lib/commands-update.test.js +23 -3
- package/dist/assets/{AgentAvatar-BY1Uar-W.js → AgentAvatar-BSBHv-65.js} +1 -1
- package/dist/assets/{AgentSelector-BTHcN1FV.js → AgentSelector-DaT_IvwI.js} +1 -1
- package/dist/assets/{ArchivedSessionsDialog-DSnawUO5.js → ArchivedSessionsDialog-C3Yn2T92.js} +1 -1
- package/dist/assets/{AssistantConversationSurface-Cfeh2vaU.js → AssistantConversationSurface-BnoGpvaw.js} +3 -3
- package/dist/assets/{AssistantSessionCard-DEw5qpOl.js → AssistantSessionCard-D4cDykNE.js} +2 -2
- package/dist/assets/{AssistantUnreadBadge-eHop7KFr.js → AssistantUnreadBadge-kuD0NRB3.js} +1 -1
- package/dist/assets/{AssistantView-BCzhUUR8.js → AssistantView-C-UaXYpz.js} +1 -1
- package/dist/assets/{AssistantWorkingAvatar-lw3h_DYH.js → AssistantWorkingAvatar-VQGkgNuo.js} +1 -1
- package/dist/assets/{AssistantsSettingsPage-DngM9eGO.js → AssistantsSettingsPage-D01452ix.js} +1 -1
- package/dist/assets/{BinaryFileFallback-CtqRJVb8.js → BinaryFileFallback-Darn77R4.js} +1 -1
- package/dist/assets/{BtwPanel-DbifCGwT.js → BtwPanel-CgSxuUbP.js} +1 -1
- package/dist/assets/{BusyDots-Bk6p5cua.js → BusyDots-CTw2sYb1.js} +1 -1
- package/dist/assets/{ChatContainer-CRupjnre.js → ChatContainer-DQ2aAjYQ.js} +4 -4
- package/dist/assets/{ChatView-B5ahnMA6.js → ChatView-BfrJ1ZTv.js} +1 -1
- package/dist/assets/{DiagramView-CyXHjgFa.js → DiagramView-BcD_t3y-.js} +1 -1
- package/dist/assets/{DiffView-DFujkn2g.js → DiffView-DyYip1lP.js} +1 -1
- package/dist/assets/{DiffViewToggle-XA_EBPXw.js → DiffViewToggle-Da3vQFP9.js} +1 -1
- package/dist/assets/{ErrorBoundary-DeatD_L5.js → ErrorBoundary-D6SF_urL.js} +1 -1
- package/dist/assets/{FadeInOnReveal-iCjNPFx8.js → FadeInOnReveal-DJrSq3fM.js} +1 -1
- package/dist/assets/{GuiPluginMount-qoJ1nHjE.js → GuiPluginMount-BD0R2vTk.js} +1 -1
- package/dist/assets/{GuiPluginPage-BslRq2f5.js → GuiPluginPage-DGysjIM8.js} +1 -1
- package/dist/assets/{GuiPluginSurface-TGUasA-U.js → GuiPluginSurface-CIbn8VvC.js} +1 -1
- package/dist/assets/{GuiPluginTitlebarItems-BUf_4msf.js → GuiPluginTitlebarItems-BYCWC7Ia.js} +1 -1
- package/dist/assets/{GuiPluginWindow-Dt4kKaAD.js → GuiPluginWindow-cCmvyMMm.js} +1 -1
- package/dist/assets/{Icon-BJy61Jon.js → Icon-DrsaL1yC.js} +1 -1
- package/dist/assets/{ImageLoadingPlaceholder-trHWUJt-.js → ImageLoadingPlaceholder-Br3hw4E6.js} +1 -1
- package/dist/assets/{LoadingImage-xhLZPhd9.js → LoadingImage-BBQSz8J1.js} +1 -1
- package/dist/assets/{MarkdownRenderer-DwwztSrL.js → MarkdownRenderer-CGgHX4n3.js} +2 -2
- package/dist/assets/{MarkdownRendererImpl-BbwqJp63.js → MarkdownRendererImpl-CiuncbTc.js} +1 -1
- package/dist/assets/{MarkstreamRendererImpl-Bsvs0yhW.js → MarkstreamRendererImpl-DT9tgQ6L.js} +1 -1
- package/dist/assets/{MobileAssistantSettingsPage-NZI62Ey6.js → MobileAssistantSettingsPage-DIilwadN.js} +1 -1
- package/dist/assets/{MobileAssistantTab-DIrHBsL_.js → MobileAssistantTab-CTyT31et.js} +1 -1
- package/dist/assets/{MobileBtwPage-H1GyfL02.js → MobileBtwPage-Buz1Kf7W.js} +1 -1
- package/dist/assets/{MobileChangesSurface-DiZ9RsZk.js → MobileChangesSurface-DsnPRa6f.js} +1 -1
- package/dist/assets/{MobileChatScreen-BKtbId56.js → MobileChatScreen-DRNBeviQ.js} +1 -1
- package/dist/assets/{MobileDetailNavigation-BWWiAn9H.js → MobileDetailNavigation-_0qkfML1.js} +1 -1
- package/dist/assets/{MobileFilesSurface-DSX2LTmx.js → MobileFilesSurface-CKHljNp8.js} +2 -2
- package/dist/assets/{MobileHtmlNetworkBoundary-DJy9Q8VV.js → MobileHtmlNetworkBoundary-BMTmOSuT.js} +2 -2
- package/dist/assets/{MobileOverlayPanel-XqAYxe55.js → MobileOverlayPanel-cwgcgCxI.js} +1 -1
- package/dist/assets/{MobileResizableSheet-G0ftF_2y.js → MobileResizableSheet-DKpNzqfc.js} +1 -1
- package/dist/assets/{MobileSettingsTab-gKqFXYC4.js → MobileSettingsTab-BQnzgATX.js} +1 -1
- package/dist/assets/{MobileShareBridge-C0xW2_n0.js → MobileShareBridge-1O5JUriq.js} +1 -1
- package/dist/assets/{MobileSurface-DZnaMpfo.js → MobileSurface-nz7712mA.js} +1 -1
- package/dist/assets/{MobileTabPageHeader-CsmuqMP6.js → MobileTabPageHeader-B0_vB3Tg.js} +1 -1
- package/dist/assets/{ModelLogo-B50mkTPp.js → ModelLogo-CwKqpjSR.js} +1 -1
- package/dist/assets/{ModelSelector-CdBPSXZ2.js → ModelSelector-C0LV5Vo7.js} +1 -1
- package/dist/assets/{MultiRunWindow-CmbU5iWH.js → MultiRunWindow-C0muk8Ec.js} +1 -1
- package/dist/assets/{OnboardingScreen-DjVB5jqP.js → OnboardingScreen-T4NAO5Nc.js} +1 -1
- package/dist/assets/{OverlayScrollbar-CLu72YSm.js → OverlayScrollbar-CZ86VwiO.js} +1 -1
- package/dist/assets/{PierreDiffViewer-CIwYEUv3.js → PierreDiffViewer-0MHiuNI_.js} +1 -1
- package/dist/assets/{ProviderLogo-DxffoDzo.js → ProviderLogo-BRhDuhtX.js} +1 -1
- package/dist/assets/{RemoteAssistantSessionCard-CrVXWVNC.js → RemoteAssistantSessionCard-BAbf5uBX.js} +1 -1
- package/dist/assets/{RemoteDesktopPanel-CW3VO7kH.js → RemoteDesktopPanel-vKqD4HzW.js} +1 -1
- package/dist/assets/{ScheduledTasksDialog-CH-yxh54.js → ScheduledTasksDialog-BMoHLXYW.js} +1 -1
- package/dist/assets/{ScrollableOverlay-_-c4eChV.js → ScrollableOverlay-CFjKY4OJ.js} +1 -1
- package/dist/assets/{SettingsGroup-BEuuCHe_.js → SettingsGroup-5yNRBDTj.js} +1 -1
- package/dist/assets/{SettingsView-DTzFUwvv.js → SettingsView-4rxkTHGv.js} +1 -1
- package/dist/assets/{SettingsWindow-I98QE5aS.js → SettingsWindow-D5JUctj6.js} +1 -1
- package/dist/assets/{SetupTourDialog-3ejWHEJz.js → SetupTourDialog-Bp8wlcPT.js} +1 -1
- package/dist/assets/{SyncActions-BJmY7x7G.js → SyncActions-DiGfo7cp.js} +1 -1
- package/dist/assets/{TerminalView-B2I_vByC.js → TerminalView-BwradFZm.js} +1 -1
- package/dist/assets/{TextSelectionMenu-BvRgpSxU.js → TextSelectionMenu-DcQCHZnp.js} +1 -1
- package/dist/assets/{ToolOutputDialog-DSfZp0SO.js → ToolOutputDialog-D_Kl-Bc5.js} +1 -1
- package/dist/assets/{assistantMessagePreview-gyTcahWF.js → assistantMessagePreview-a6gzdseQ.js} +1 -1
- package/dist/assets/{assistantQueries-DDeccc-m.js → assistantQueries-6GJP0jCO.js} +1 -1
- package/dist/assets/{auto-read-context-D2UX6oXY.js → auto-read-context-Dov0luVf.js} +1 -1
- package/dist/assets/{capgoAdapter-BucnEwMn.js → capgoAdapter-CVPNGTnk.js} +1 -1
- package/dist/assets/{card-C39FDK7q.js → card-DjqjGN8X.js} +1 -1
- package/dist/assets/{chatUpwardIntent-uv8XbV0r.js → chatUpwardIntent-uWd0ddoK.js} +1 -1
- package/dist/assets/{checkbox-C3kPdnVf.js → checkbox-BIU2MT0K.js} +1 -1
- package/dist/assets/{collapsible-BYAyt7tx.js → collapsible-B2X0QDoQ.js} +1 -1
- package/dist/assets/{connection-hint-zKPzQOm-.js → connection-hint-Ca1b_CjA.js} +1 -1
- package/dist/assets/{context-menu-D7tWqAhJ.js → context-menu-C-FLHb_6.js} +1 -1
- package/dist/assets/{diagram-qoeZRJBj.js → diagram-CJeSxjCC.js} +1 -1
- package/dist/assets/{dialog-B9djOKHd.js → dialog-DnZWrDDM.js} +1 -1
- package/dist/assets/{dropdown-menu-Bg9fqXHM.js → dropdown-menu-CZWYeFpO.js} +1 -1
- package/dist/assets/{fileMentionTouchSelection-DBohWG86.js → fileMentionTouchSelection-Bwr_ZfU3.js} +1 -1
- package/dist/assets/{gitApi-D7UHXMTh.js → gitApi-CT9_Fyh4.js} +1 -1
- package/dist/assets/{icons-BJ-yKguF.js → icons-B6gke_oc.js} +1 -1
- package/dist/assets/{input-DgT2vL85.js → input-DSY3Mg4G.js} +1 -1
- package/dist/assets/{insertionBoundaries-CNdm9xws.js → insertionBoundaries-C1ACCndo.js} +1 -1
- package/dist/assets/{kbd-DTXNf7DP.js → kbd-U9NdVaVr.js} +1 -1
- package/dist/assets/{main-BYm7jJf7.js → main-Bd77IVQE.js} +2 -2
- package/dist/assets/{main-CKpcvsKp.js → main-HeMyVqAF.js} +4 -4
- package/dist/assets/{markdownHeightCache-BthXvgH2.js → markdownHeightCache-BhpqKZQB.js} +1 -1
- package/dist/assets/{mcpQueries-yp0LLKop.js → mcpQueries-BInByFPg.js} +1 -1
- package/dist/assets/{miniChat-CsVxurBz.js → miniChat-Brvg2KsE.js} +2 -2
- package/dist/assets/{mobile-Bnn1Av6s.js → mobile-BOuoV895.js} +2 -2
- package/dist/assets/{mobileBackNavigation-Dc2Ms_yz.js → mobileBackNavigation-CUoYXnE0.js} +1 -1
- package/dist/assets/mobileConnections-DDPYhrR6.js +2 -0
- package/dist/assets/{multirun-YneUyzFb.js → multirun-h_L8IaS5.js} +1 -1
- package/dist/assets/{native-config-CHbBpTtL.js → native-config-DJLqkXGY.js} +1 -1
- package/dist/assets/{nativeComposerCover-BvxREQD3.js → nativeComposerCover-Cnky140u.js} +1 -1
- package/dist/assets/{navigation-BcMxWKOy.js → navigation-b6ZJiTeF.js} +1 -1
- package/dist/assets/{openRemoteProjectSession-Bj1JqTJL.js → openRemoteProjectSession-C85euMiR.js} +1 -1
- package/dist/assets/{openSessionFromDeepLink-RIdfYNVc.js → openSessionFromDeepLink-CDs-skAS.js} +2 -2
- package/dist/assets/{pluginPresentation-TcpIXFdR.js → pluginPresentation-upXqjrId.js} +1 -1
- package/dist/assets/{pwa-B0DzO_Wm.js → pwa-BSv0q2V7.js} +1 -1
- package/dist/assets/{queue-abort-optimistic-9kcDZ3sO.js → queue-abort-optimistic-CkmS8yTs.js} +1 -1
- package/dist/assets/{reference-history-Bpfp7nl-.js → reference-history-BfwrDjks.js} +1 -1
- package/dist/assets/{remoteSessionReference-CzFqDMfO.js → remoteSessionReference-DRv5U8a9.js} +1 -1
- package/dist/assets/{renderElectronMiniChatApp-BMxJmIaf.js → renderElectronMiniChatApp-YbsPMg7E.js} +2 -2
- package/dist/assets/{renderMobileApp-g6VIdksz.js → renderMobileApp-QD_41cfk.js} +4 -4
- package/dist/assets/{runtimeConfig-CQuMlWSU.js → runtimeConfig-BT-o1J3r.js} +1 -1
- package/dist/assets/{runtimeEndpointReset-wwLirdka.js → runtimeEndpointReset-CltKCEAq.js} +2 -2
- package/dist/assets/{select-B0A2UPYI.js → select-DNrc5_kl.js} +1 -1
- package/dist/assets/{sessionLookup-CDS-3lqX.js → sessionLookup-DNi6Sfyx.js} +1 -1
- package/dist/assets/{sessionOwnership-C6kEL9vi.js → sessionOwnership-B4NyrdiS.js} +1 -1
- package/dist/assets/{shortcuts-DQjWb6-B.js → shortcuts-B0XmqH9X.js} +1 -1
- package/dist/assets/{sortable-tabs-strip-CIJ_GrzH.js → sortable-tabs-strip-DqPiLPN2.js} +1 -1
- package/dist/assets/{speechSettingsQueries-BdZipozF.js → speechSettingsQueries-CVATB1QU.js} +1 -1
- package/dist/assets/{switch-BTd4fb-u.js → switch-COh9mZOL.js} +1 -1
- package/dist/assets/{textarea-BMLYkY1C.js → textarea-DnOdSgZM.js} +1 -1
- package/dist/assets/{tooltip-C7bh8-oj.js → tooltip-wFf92wqJ.js} +1 -1
- package/dist/assets/{truncated-path-D4zPMNfI.js → truncated-path-CNuLLJYq.js} +1 -1
- package/dist/assets/{types-CAv5YLRJ.js → types-C4KUivVG.js} +1 -1
- package/dist/assets/{ui-C93TriAS.js → ui-BPOP32rM.js} +4 -4
- package/dist/assets/{useAppFontEffects-C__2VHhM.js → useAppFontEffects-BxzLAPb0.js} +2 -2
- package/dist/assets/{useDesktopWindowControlsLayout-BFZelO28.js → useDesktopWindowControlsLayout-DJTBs9Ai.js} +1 -1
- package/dist/assets/{useEffectiveDirectory-ClRxkgy2.js → useEffectiveDirectory-DleT4CpD.js} +1 -1
- package/dist/assets/{useGitStore-DDE7AUsk.js → useGitStore-DTlP-L0a.js} +1 -1
- package/dist/assets/{useInlineCommentDraftStore-oj1WmZIi.js → useInlineCommentDraftStore-Wde2bT5p.js} +1 -1
- package/dist/assets/{useMcpConfigStore-DbltISt3.js → useMcpConfigStore-CQCdt0vJ.js} +1 -1
- package/dist/assets/{useMobileSwipeActions-qeExRIFa.js → useMobileSwipeActions-k7KGPpqM.js} +1 -1
- package/dist/assets/{useMobileTranscriptSyncHint-CLHeiwxO.js → useMobileTranscriptSyncHint-BLI4fy8Q.js} +1 -1
- package/dist/assets/{useModelLists-DUUovEwL.js → useModelLists-DUsn2kaq.js} +1 -1
- package/dist/assets/{useOpenCodeReadiness-DRZyVsuu.js → useOpenCodeReadiness-Bxz72dNZ.js} +1 -1
- package/dist/assets/{usePluginsStore-W-iNVsmP.js → usePluginsStore-DzweL9M8.js} +1 -1
- package/dist/assets/{useProjectGitActions-BBbZCQTk.js → useProjectGitActions-BPlLnhmx.js} +1 -1
- package/dist/assets/{useProjectGitStore-DB_eyTwc.js → useProjectGitStore-EZRP6D6M.js} +1 -1
- package/dist/assets/{useProjectRuntimeAPIs-CR9pISBy.js → useProjectRuntimeAPIs-Cbt-c1SP.js} +1 -1
- package/dist/assets/{useSessionBtwStore-CXgbHj8n.js → useSessionBtwStore-DjwWijyt.js} +1 -1
- package/dist/assets/{useStreamingTextThrottle-B5HUK2ar.js → useStreamingTextThrottle-B8aWuwgs.js} +1 -1
- package/dist/assets/{worktreeManager-7PwfaVcz.js → worktreeManager-BbQ4inHD.js} +1 -1
- package/dist/assets/{worktreeSourceBranchPreference-CL4vcrug.js → worktreeSourceBranchPreference-7Id37MxY.js} +1 -1
- package/dist/index.html +5 -5
- package/dist/mini-chat.html +5 -5
- package/dist/mobile.html +1 -1
- package/package.json +1 -1
- package/server/lib/host-update/DOCUMENTATION.md +5 -2
- package/server/lib/notifications/apns-runtime.test.js +3 -3
- package/server/lib/opencode/DOCUMENTATION.md +1 -1
- package/server/lib/relay/DOCUMENTATION.md +1 -1
- package/server/lib/relay/service.js +7 -18
- package/server/lib/relay/service.test.js +19 -14
- package/dist/assets/mobileConnections-CPcUZA0K.js +0 -2
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
|
|
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([
|
package/bin/lib/DOCUMENTATION.md
CHANGED
|
@@ -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
|
|
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
|
|
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`.
|
package/bin/lib/cli-args.js
CHANGED
|
@@ -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
|
|
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 {
|
|
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 =
|
|
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
|
-
|
|
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.
|
|
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))
|
|
71
|
-
|
|
72
|
-
|
|
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
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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 =
|
|
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('
|
|
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
|
|
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
|
}
|