| author | |
| committer | |
| log | 8bfdacf206608c0e14b1c5471dfa1f482a452acc |
| tree | bcb3684209f25e5abb22b0c56fd50c4e090ca24f |
| parent | b6302784f8e058de4fb20dae931b4df29e9302fe |
| signature | Signed by PGP key B5690EEEBB952194 |
Co-authored-by: codex <codex@users.noreply.github.com>4 files changed, 18 insertions(+), 22 deletions(-)
apps/desktop/src/app/DesktopApp.ts+4-3| ... | ... | @@ -17,6 +17,7 @@ import * as DesktopBackendManager from "../backend/DesktopBackendManager.ts"; |
| 17 | 17 | import * as DesktopEnvironment from "./DesktopEnvironment.ts"; |
| 18 | 18 | import * as DesktopLifecycle from "./DesktopLifecycle.ts"; |
| 19 | 19 | import * as DesktopObservability from "./DesktopObservability.ts"; |
| 20 | import * as DesktopShutdown from "./DesktopShutdown.ts"; | |
| 20 | 21 | import * as DesktopServerExposure from "../backend/DesktopServerExposure.ts"; |
| 21 | 22 | import * as DesktopAppSettings from "../settings/DesktopAppSettings.ts"; |
| 22 | 23 | import * as DesktopShellEnvironment from "../shell/DesktopShellEnvironment.ts"; |
| ... | ... | @@ -100,12 +101,12 @@ const handleFatalStartupError = Effect.fn("desktop.startup.handleFatalStartupErr |
| 100 | 101 | ): Effect.fn.Return< |
| 101 | 102 | void, |
| 102 | 103 | never, |
| 103 | | DesktopLifecycle.DesktopShutdown | |
| 104 | | DesktopShutdown.DesktopShutdown | |
| 104 | 105 | | DesktopState.DesktopState |
| 105 | 106 | | ElectronApp.ElectronApp |
| 106 | 107 | | ElectronDialog.ElectronDialog |
| 107 | 108 | > { |
| 108 | const shutdown = yield* DesktopLifecycle.DesktopShutdown; | |
| 109 | const shutdown = yield* DesktopShutdown.DesktopShutdown; | |
| 109 | 110 | const state = yield* DesktopState.DesktopState; |
| 110 | 111 | const electronApp = yield* ElectronApp.ElectronApp; |
| 111 | 112 | const electronDialog = yield* ElectronDialog.ElectronDialog; |
| ... | ... | @@ -237,7 +238,7 @@ const scopedProgram = Effect.scoped( |
| 237 | 238 | yield* Effect.annotateLogsScoped({ scope: "desktop", runId }); |
| 238 | 239 | yield* Effect.annotateCurrentSpan({ scope: "desktop", runId }); |
| 239 | 240 | |
| 240 | const shutdown = yield* DesktopLifecycle.DesktopShutdown; | |
| 241 | const shutdown = yield* DesktopShutdown.DesktopShutdown; | |
| 241 | 242 | const backendManager = yield* DesktopBackendManager.DesktopBackendManager; |
| 242 | 243 | |
| 243 | 244 | yield* Effect.addFinalizer(() => |
apps/desktop/src/app/DesktopLifecycle.ts+4-6| ... | ... | @@ -9,17 +9,15 @@ import type * as Electron from "electron"; |
| 9 | 9 | |
| 10 | 10 | import * as DesktopEnvironment from "./DesktopEnvironment.ts"; |
| 11 | 11 | import * as DesktopObservability from "./DesktopObservability.ts"; |
| 12 | import * as DesktopShutdownModule from "./DesktopShutdown.ts"; | |
| 12 | import * as DesktopShutdown from "./DesktopShutdown.ts"; | |
| 13 | 13 | import * as ElectronApp from "../electron/ElectronApp.ts"; |
| 14 | 14 | import * as ElectronTheme from "../electron/ElectronTheme.ts"; |
| 15 | 15 | import * as DesktopState from "./DesktopState.ts"; |
| 16 | 16 | import * as DesktopWindow from "../window/DesktopWindow.ts"; |
| 17 | 17 | |
| 18 | export { DesktopShutdown, layer as layerShutdown } from "./DesktopShutdown.ts"; | |
| 19 | ||
| 20 | 18 | export type DesktopLifecycleRuntimeServices = |
| 21 | 19 | | DesktopEnvironment.DesktopEnvironment |
| 22 | | DesktopShutdownModule.DesktopShutdown | |
| 20 | | DesktopShutdown.DesktopShutdown | |
| 23 | 21 | | DesktopState.DesktopState |
| 24 | 22 | | DesktopWindow.DesktopWindow |
| 25 | 23 | | ElectronApp.ElectronApp |
| ... | ... | @@ -63,8 +61,8 @@ function addScopedListener<Args extends ReadonlyArray<unknown>>( |
| 63 | 61 | } |
| 64 | 62 | |
| 65 | 63 | const requestDesktopShutdownAndWait = Effect.fn("desktop.lifecycle.requestShutdownAndWait")( |
| 66 | function* (): Effect.fn.Return<void, never, DesktopShutdownModule.DesktopShutdown> { | |
| 67 | const shutdown = yield* DesktopShutdownModule.DesktopShutdown; | |
| 64 | function* (): Effect.fn.Return<void, never, DesktopShutdown.DesktopShutdown> { | |
| 65 | const shutdown = yield* DesktopShutdown.DesktopShutdown; | |
| 68 | 66 | yield* shutdown.request; |
| 69 | 67 | yield* shutdown.awaitComplete; |
| 70 | 68 | }, |
apps/desktop/src/backend/DesktopServerExposure.test.ts+8-12| ... | ... | @@ -9,19 +9,15 @@ import * as Sink from "effect/Sink"; |
| 9 | 9 | import * as Stream from "effect/Stream"; |
| 10 | 10 | import { ChildProcessSpawner } from "effect/unstable/process"; |
| 11 | 11 | |
| 12 | import { | |
| 13 | DesktopEnvironment, | |
| 14 | layer as makeDesktopEnvironmentLayer, | |
| 15 | } from "../app/DesktopEnvironment.ts"; | |
| 12 | import * as DesktopEnvironment from "../app/DesktopEnvironment.ts"; | |
| 16 | 13 | import * as DesktopConfig from "../app/DesktopConfig.ts"; |
| 17 | 14 | import * as DesktopServerExposure from "./DesktopServerExposure.ts"; |
| 18 | import type { DesktopNetworkInterfaces } from "./DesktopServerExposure.ts"; | |
| 19 | 15 | import * as DesktopAppSettings from "../settings/DesktopAppSettings.ts"; |
| 20 | 16 | |
| 21 | 17 | const encoder = new TextEncoder(); |
| 22 | 18 | |
| 23 | const emptyNetworkInterfaces: DesktopNetworkInterfaces = {}; | |
| 24 | const lanNetworkInterfaces: DesktopNetworkInterfaces = { | |
| 19 | const emptyNetworkInterfaces: DesktopServerExposure.DesktopNetworkInterfaces = {}; | |
| 20 | const lanNetworkInterfaces: DesktopServerExposure.DesktopNetworkInterfaces = { | |
| 25 | 21 | en0: [ |
| 26 | 22 | { |
| 27 | 23 | address: "192.168.1.20", |
| ... | ... | @@ -31,7 +27,7 @@ const lanNetworkInterfaces: DesktopNetworkInterfaces = { |
| 31 | 27 | ], |
| 32 | 28 | }; |
| 33 | 29 | |
| 34 | const tailnetNetworkInterfaces: DesktopNetworkInterfaces = { | |
| 30 | const tailnetNetworkInterfaces: DesktopServerExposure.DesktopNetworkInterfaces = { | |
| 35 | 31 | tailscale0: [ |
| 36 | 32 | { |
| 37 | 33 | address: "100.90.1.2", |
| ... | ... | @@ -72,7 +68,7 @@ function dieOnSpawnLayer() { |
| 72 | 68 | } |
| 73 | 69 | |
| 74 | 70 | function makeEnvironmentLayer(baseDir: string, env: Record<string, string | undefined> = {}) { |
| 75 | return makeDesktopEnvironmentLayer({ | |
| 71 | return DesktopEnvironment.layer({ | |
| 76 | 72 | dirname: "/repo/apps/desktop/src", |
| 77 | 73 | homeDirectory: baseDir, |
| 78 | 74 | platform: "darwin", |
| ... | ... | @@ -91,7 +87,7 @@ function makeEnvironmentLayer(baseDir: string, env: Record<string, string | unde |
| 91 | 87 | |
| 92 | 88 | function makeLayer(input: { |
| 93 | 89 | readonly baseDir: string; |
| 94 | readonly networkInterfaces?: DesktopNetworkInterfaces; | |
| 90 | readonly networkInterfaces?: DesktopServerExposure.DesktopNetworkInterfaces; | |
| 95 | 91 | readonly env?: Record<string, string | undefined>; |
| 96 | 92 | readonly spawnerLayer?: Layer.Layer<ChildProcessSpawner.ChildProcessSpawner>; |
| 97 | 93 | }) { |
| ... | ... | @@ -113,12 +109,12 @@ function makeLayer(input: { |
| 113 | 109 | } |
| 114 | 110 | |
| 115 | 111 | const withHarness = <A, E, R>( |
| 116 | networkInterfaces: DesktopNetworkInterfaces, | |
| 112 | networkInterfaces: DesktopServerExposure.DesktopNetworkInterfaces, | |
| 117 | 113 | effect: Effect.Effect< |
| 118 | 114 | A, |
| 119 | 115 | E, |
| 120 | 116 | | R |
| 121 | | DesktopEnvironment | |
| 117 | | DesktopEnvironment.DesktopEnvironment | |
| 122 | 118 | | FileSystem.FileSystem |
| 123 | 119 | | DesktopServerExposure.DesktopServerExposure |
| 124 | 120 | | DesktopAppSettings.DesktopAppSettings |
apps/desktop/src/main.ts+2-1| ... | ... | @@ -35,6 +35,7 @@ import * as DesktopBackendManager from "./backend/DesktopBackendManager.ts"; |
| 35 | 35 | import * as DesktopLocalEnvironmentAuth from "./backend/DesktopLocalEnvironmentAuth.ts"; |
| 36 | 36 | import * as DesktopEnvironment from "./app/DesktopEnvironment.ts"; |
| 37 | 37 | import * as DesktopLifecycle from "./app/DesktopLifecycle.ts"; |
| 38 | import * as DesktopShutdown from "./app/DesktopShutdown.ts"; | |
| 38 | 39 | import * as DesktopObservability from "./app/DesktopObservability.ts"; |
| 39 | 40 | import * as DesktopServerExposure from "./backend/DesktopServerExposure.ts"; |
| 40 | 41 | import * as DesktopClientSettings from "./settings/DesktopClientSettings.ts"; |
| ... | ... | @@ -114,7 +115,7 @@ const electronLayer = Layer.mergeAll( |
| 114 | 115 | |
| 115 | 116 | const desktopFoundationLayer = Layer.mergeAll( |
| 116 | 117 | DesktopState.layer, |
| 117 | DesktopLifecycle.layerShutdown, | |
| 118 | DesktopShutdown.layer, | |
| 118 | 119 | DesktopAppSettings.layer, |
| 119 | 120 | DesktopClientSettings.layer, |
| 120 | 121 | DesktopConnectionCatalogStore.layer.pipe(Layer.provideMerge(DesktopSavedEnvironments.layer)), |