@devries-cameron20 / t3code Mirror · read-only / commits / 938b19a6bb
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 25, 03:45 UTC

[codex] Normalize Desktop IPC Effect service (#3203)

Co-authored-by: codex <codex@users.noreply.github.com>

Julius Marminge committed Jun 19, 2026 at 20:10 UTC 938b19a6bb2e361845cb5a497174d4062549c39c
9 files changed +76 -74
apps/desktop/src/ipc/DesktopIpc.ts
+16 -14
@@ -1,5 +1,6 @@
1 import * as Context from "effect/Context";
2 import * as Effect from "effect/Effect";
3 +import * as Layer from "effect/Layer";
4 import * as Schema from "effect/Schema";
5 import * as Scope from "effect/Scope";
6
@@ -33,20 +34,19 @@ export interface DesktopSyncIpcMethod<E, R> {
34 readonly handler: () => Effect.Effect<unknown, E, R>;
35 }
36
36 -export interface DesktopIpcShape {
37 - readonly handle: <E, R>(
38 - input: DesktopIpcMethod<E, R>,
39 - ) => Effect.Effect<void, never, R | Scope.Scope>;
40 - readonly handleSync: <E, R>(
41 - input: DesktopSyncIpcMethod<E, R>,
42 - ) => Effect.Effect<void, never, R | Scope.Scope>;
43 -}
44 -
45 -export class DesktopIpc extends Context.Service<DesktopIpc, DesktopIpcShape>()(
46 - "@t3tools/desktop/ipc/DesktopIpc",
47 -) {}
48 -
49 -export const make = (ipcMain: DesktopIpcMain): DesktopIpcShape =>
37 +export class DesktopIpc extends Context.Service<
38 + DesktopIpc,
39 + {
40 + readonly handle: <E, R>(
41 + input: DesktopIpcMethod<E, R>,
42 + ) => Effect.Effect<void, never, R | Scope.Scope>;
43 + readonly handleSync: <E, R>(
44 + input: DesktopSyncIpcMethod<E, R>,
45 + ) => Effect.Effect<void, never, R | Scope.Scope>;
46 + }
47 +>()("@t3tools/desktop/ipc/DesktopIpc") {}
48 +
49 +export const make = (ipcMain: DesktopIpcMain): DesktopIpc["Service"] =>
50 DesktopIpc.of({
51 handle: Effect.fn("desktop.ipc.registerInvoke")(function* <E, R>({
52 channel,
@@ -97,6 +97,8 @@ export const make = (ipcMain: DesktopIpcMain): DesktopIpcShape =>
97 }),
98 });
99
100 +export const layer = (ipcMain: DesktopIpcMain) => Layer.succeed(DesktopIpc, make(ipcMain));
101 +
102 /**
103 * Convenience helpers for creating IPC methods
104 */
apps/desktop/src/ipc/methods/clientSettings.ts
+3 -3
@@ -5,9 +5,9 @@ import * as Schema from "effect/Schema";
5
6 import * as DesktopClientSettings from "../../settings/DesktopClientSettings.ts";
7 import * as IpcChannels from "../channels.ts";
8 -import { makeIpcMethod } from "../DesktopIpc.ts";
8 +import * as DesktopIpc from "../DesktopIpc.ts";
9
10 -export const getClientSettings = makeIpcMethod({
10 +export const getClientSettings = DesktopIpc.makeIpcMethod({
11 channel: IpcChannels.GET_CLIENT_SETTINGS_CHANNEL,
12 payload: Schema.Void,
13 result: Schema.NullOr(ClientSettingsSchema),
@@ -17,7 +17,7 @@ export const getClientSettings = makeIpcMethod({
17 }),
18 });
19
20 -export const setClientSettings = makeIpcMethod({
20 +export const setClientSettings = DesktopIpc.makeIpcMethod({
21 channel: IpcChannels.SET_CLIENT_SETTINGS_CHANNEL,
22 payload: ClientSettingsSchema,
23 result: Schema.Void,
apps/desktop/src/ipc/methods/connectionCatalog.ts
+4 -4
@@ -4,9 +4,9 @@ import * as Schema from "effect/Schema";
4
5 import * as DesktopConnectionCatalogStore from "../../app/DesktopConnectionCatalogStore.ts";
6 import * as IpcChannels from "../channels.ts";
7 -import { makeIpcMethod } from "../DesktopIpc.ts";
7 +import * as DesktopIpc from "../DesktopIpc.ts";
8
9 -export const getConnectionCatalog = makeIpcMethod({
9 +export const getConnectionCatalog = DesktopIpc.makeIpcMethod({
10 channel: IpcChannels.GET_CONNECTION_CATALOG_CHANNEL,
11 payload: Schema.Void,
12 result: Schema.NullOr(Schema.String),
@@ -16,7 +16,7 @@ export const getConnectionCatalog = makeIpcMethod({
16 }),
17 });
18
19 -export const setConnectionCatalog = makeIpcMethod({
19 +export const setConnectionCatalog = DesktopIpc.makeIpcMethod({
20 channel: IpcChannels.SET_CONNECTION_CATALOG_CHANNEL,
21 payload: Schema.String,
22 result: Schema.Boolean,
@@ -26,7 +26,7 @@ export const setConnectionCatalog = makeIpcMethod({
26 }),
27 });
28
29 -export const clearConnectionCatalog = makeIpcMethod({
29 +export const clearConnectionCatalog = DesktopIpc.makeIpcMethod({
30 channel: IpcChannels.CLEAR_CONNECTION_CATALOG_CHANNEL,
31 payload: Schema.Void,
32 result: Schema.Void,
apps/desktop/src/ipc/methods/preview.ts
+23 -23
@@ -27,7 +27,7 @@ import { pathToFileURL } from "node:url";
27 import * as PreviewManager from "../../preview/Manager.ts";
28 import { PREVIEW_WEBVIEW_PREFERENCES } from "../../preview/WebviewPreferences.ts";
29 import * as IpcChannels from "../channels.ts";
30 -import { makeIpcMethod } from "../DesktopIpc.ts";
30 +import * as DesktopIpc from "../DesktopIpc.ts";
31
32 const broadcast = (channel: string, ...args: ReadonlyArray<unknown>): void => {
33 for (const window of BrowserWindow.getAllWindows()) {
@@ -52,7 +52,7 @@ export const installPreviewEventForwarding = Effect.fn(
52 });
53 });
54
55 -export const createTab = makeIpcMethod({
55 +export const createTab = DesktopIpc.makeIpcMethod({
56 channel: IpcChannels.PREVIEW_CREATE_TAB_CHANNEL,
57 payload: DesktopPreviewTabInputSchema,
58 result: Schema.Void,
@@ -62,7 +62,7 @@ export const createTab = makeIpcMethod({
62 }),
63 });
64
65 -export const closeTab = makeIpcMethod({
65 +export const closeTab = DesktopIpc.makeIpcMethod({
66 channel: IpcChannels.PREVIEW_CLOSE_TAB_CHANNEL,
67 payload: DesktopPreviewTabInputSchema,
68 result: Schema.Void,
@@ -72,7 +72,7 @@ export const closeTab = makeIpcMethod({
72 }),
73 });
74
75 -export const registerWebview = makeIpcMethod({
75 +export const registerWebview = DesktopIpc.makeIpcMethod({
76 channel: IpcChannels.PREVIEW_REGISTER_WEBVIEW_CHANNEL,
77 payload: DesktopPreviewRegisterWebviewInputSchema,
78 result: Schema.Void,
@@ -82,7 +82,7 @@ export const registerWebview = makeIpcMethod({
82 }),
83 });
84
85 -export const navigate = makeIpcMethod({
85 +export const navigate = DesktopIpc.makeIpcMethod({
86 channel: IpcChannels.PREVIEW_NAVIGATE_CHANNEL,
87 payload: DesktopPreviewNavigateInputSchema,
88 result: Schema.Void,
@@ -100,7 +100,7 @@ const tabMethod = (
100 tabId: string,
101 ) => Effect.Effect<void, PreviewManager.PreviewManagerError>,
102 ) =>
103 - makeIpcMethod({
103 + DesktopIpc.makeIpcMethod({
104 channel,
105 payload: DesktopPreviewTabInputSchema,
106 result: Schema.Void,
@@ -166,7 +166,7 @@ export const stopRecording = tabMethod(
166 (manager, tabId) => manager.stopRecording(tabId),
167 );
168
169 -export const clearCookies = makeIpcMethod({
169 +export const clearCookies = DesktopIpc.makeIpcMethod({
170 channel: IpcChannels.PREVIEW_CLEAR_COOKIES_CHANNEL,
171 payload: Schema.Void,
172 result: Schema.Void,
@@ -176,7 +176,7 @@ export const clearCookies = makeIpcMethod({
176 }),
177 });
178
179 -export const clearCache = makeIpcMethod({
179 +export const clearCache = DesktopIpc.makeIpcMethod({
180 channel: IpcChannels.PREVIEW_CLEAR_CACHE_CHANNEL,
181 payload: Schema.Void,
182 result: Schema.Void,
@@ -186,7 +186,7 @@ export const clearCache = makeIpcMethod({
186 }),
187 });
188
189 -export const getPreviewConfig = makeIpcMethod({
189 +export const getPreviewConfig = DesktopIpc.makeIpcMethod({
190 channel: IpcChannels.PREVIEW_GET_CONFIG_CHANNEL,
191 payload: DesktopPreviewConfigInputSchema,
192 result: DesktopPreviewWebviewConfigSchema,
@@ -201,7 +201,7 @@ export const getPreviewConfig = makeIpcMethod({
201 }),
202 });
203
204 -export const setAnnotationTheme = makeIpcMethod({
204 +export const setAnnotationTheme = DesktopIpc.makeIpcMethod({
205 channel: IpcChannels.PREVIEW_SET_ANNOTATION_THEME_CHANNEL,
206 payload: DesktopPreviewAnnotationThemeInputSchema,
207 result: Schema.Void,
@@ -211,7 +211,7 @@ export const setAnnotationTheme = makeIpcMethod({
211 }),
212 });
213
214 -export const pickElement = makeIpcMethod({
214 +export const pickElement = DesktopIpc.makeIpcMethod({
215 channel: IpcChannels.PREVIEW_PICK_ELEMENT_CHANNEL,
216 payload: DesktopPreviewTabInputSchema,
217 result: Schema.NullOr(PreviewAnnotationPayloadSchema),
@@ -221,7 +221,7 @@ export const pickElement = makeIpcMethod({
221 }),
222 });
223
224 -export const captureScreenshot = makeIpcMethod({
224 +export const captureScreenshot = DesktopIpc.makeIpcMethod({
225 channel: IpcChannels.PREVIEW_CAPTURE_SCREENSHOT_CHANNEL,
226 payload: DesktopPreviewTabInputSchema,
227 result: DesktopPreviewScreenshotArtifactSchema,
@@ -231,7 +231,7 @@ export const captureScreenshot = makeIpcMethod({
231 }),
232 });
233
234 -export const revealArtifact = makeIpcMethod({
234 +export const revealArtifact = DesktopIpc.makeIpcMethod({
235 channel: IpcChannels.PREVIEW_REVEAL_ARTIFACT_CHANNEL,
236 payload: DesktopPreviewArtifactInputSchema,
237 result: Schema.Void,
@@ -241,7 +241,7 @@ export const revealArtifact = makeIpcMethod({
241 }),
242 });
243
244 -export const copyArtifactToClipboard = makeIpcMethod({
244 +export const copyArtifactToClipboard = DesktopIpc.makeIpcMethod({
245 channel: IpcChannels.PREVIEW_COPY_ARTIFACT_CHANNEL,
246 payload: DesktopPreviewArtifactInputSchema,
247 result: Schema.Void,
@@ -251,7 +251,7 @@ export const copyArtifactToClipboard = makeIpcMethod({
251 }),
252 });
253
254 -export const automationStatus = makeIpcMethod({
254 +export const automationStatus = DesktopIpc.makeIpcMethod({
255 channel: IpcChannels.PREVIEW_AUTOMATION_STATUS_CHANNEL,
256 payload: DesktopPreviewTabInputSchema,
257 result: PreviewAutomationStatus,
@@ -261,7 +261,7 @@ export const automationStatus = makeIpcMethod({
261 }),
262 });
263
264 -export const automationSnapshot = makeIpcMethod({
264 +export const automationSnapshot = DesktopIpc.makeIpcMethod({
265 channel: IpcChannels.PREVIEW_AUTOMATION_SNAPSHOT_CHANNEL,
266 payload: DesktopPreviewTabInputSchema,
267 result: PreviewAutomationSnapshot,
@@ -271,7 +271,7 @@ export const automationSnapshot = makeIpcMethod({
271 }),
272 });
273
274 -export const automationClick = makeIpcMethod({
274 +export const automationClick = DesktopIpc.makeIpcMethod({
275 channel: IpcChannels.PREVIEW_AUTOMATION_CLICK_CHANNEL,
276 payload: DesktopPreviewAutomationClickInputSchema,
277 result: Schema.Void,
@@ -281,7 +281,7 @@ export const automationClick = makeIpcMethod({
281 }),
282 });
283
284 -export const automationType = makeIpcMethod({
284 +export const automationType = DesktopIpc.makeIpcMethod({
285 channel: IpcChannels.PREVIEW_AUTOMATION_TYPE_CHANNEL,
286 payload: DesktopPreviewAutomationTypeInputSchema,
287 result: Schema.Void,
@@ -291,7 +291,7 @@ export const automationType = makeIpcMethod({
291 }),
292 });
293
294 -export const automationPress = makeIpcMethod({
294 +export const automationPress = DesktopIpc.makeIpcMethod({
295 channel: IpcChannels.PREVIEW_AUTOMATION_PRESS_CHANNEL,
296 payload: DesktopPreviewAutomationPressInputSchema,
297 result: Schema.Void,
@@ -301,7 +301,7 @@ export const automationPress = makeIpcMethod({
301 }),
302 });
303
304 -export const automationScroll = makeIpcMethod({
304 +export const automationScroll = DesktopIpc.makeIpcMethod({
305 channel: IpcChannels.PREVIEW_AUTOMATION_SCROLL_CHANNEL,
306 payload: DesktopPreviewAutomationScrollInputSchema,
307 result: Schema.Void,
@@ -311,7 +311,7 @@ export const automationScroll = makeIpcMethod({
311 }),
312 });
313
314 -export const automationEvaluate = makeIpcMethod({
314 +export const automationEvaluate = DesktopIpc.makeIpcMethod({
315 channel: IpcChannels.PREVIEW_AUTOMATION_EVALUATE_CHANNEL,
316 payload: DesktopPreviewAutomationEvaluateInputSchema,
317 result: Schema.Unknown,
@@ -321,7 +321,7 @@ export const automationEvaluate = makeIpcMethod({
321 }),
322 });
323
324 -export const automationWaitFor = makeIpcMethod({
324 +export const automationWaitFor = DesktopIpc.makeIpcMethod({
325 channel: IpcChannels.PREVIEW_AUTOMATION_WAIT_FOR_CHANNEL,
326 payload: DesktopPreviewAutomationWaitForInputSchema,
327 result: Schema.Void,
@@ -331,7 +331,7 @@ export const automationWaitFor = makeIpcMethod({
331 }),
332 });
333
334 -export const saveRecording = makeIpcMethod({
334 +export const saveRecording = DesktopIpc.makeIpcMethod({
335 channel: IpcChannels.PREVIEW_RECORDING_SAVE_CHANNEL,
336 payload: DesktopPreviewRecordingSaveInputSchema,
337 result: DesktopPreviewRecordingArtifactSchema,
apps/desktop/src/ipc/methods/serverExposure.ts
+5 -5
@@ -9,14 +9,14 @@ import * as Schema from "effect/Schema";
9 import * as DesktopLifecycle from "../../app/DesktopLifecycle.ts";
10 import * as DesktopServerExposure from "../../backend/DesktopServerExposure.ts";
11 import * as IpcChannels from "../channels.ts";
12 -import { makeIpcMethod } from "../DesktopIpc.ts";
12 +import * as DesktopIpc from "../DesktopIpc.ts";
13
14 const SetTailscaleServeEnabledInput = Schema.Struct({
15 enabled: Schema.Boolean,
16 port: Schema.optionalKey(Schema.Number),
17 });
18
19 -export const getServerExposureState = makeIpcMethod({
19 +export const getServerExposureState = DesktopIpc.makeIpcMethod({
20 channel: IpcChannels.GET_SERVER_EXPOSURE_STATE_CHANNEL,
21 payload: Schema.Void,
22 result: DesktopServerExposureStateSchema,
@@ -26,7 +26,7 @@ export const getServerExposureState = makeIpcMethod({
26 }),
27 });
28
29 -export const setServerExposureMode = makeIpcMethod({
29 +export const setServerExposureMode = DesktopIpc.makeIpcMethod({
30 channel: IpcChannels.SET_SERVER_EXPOSURE_MODE_CHANNEL,
31 payload: DesktopServerExposureModeSchema,
32 result: DesktopServerExposureStateSchema,
@@ -41,7 +41,7 @@ export const setServerExposureMode = makeIpcMethod({
41 }),
42 });
43
44 -export const setTailscaleServeEnabled = makeIpcMethod({
44 +export const setTailscaleServeEnabled = DesktopIpc.makeIpcMethod({
45 channel: IpcChannels.SET_TAILSCALE_SERVE_ENABLED_CHANNEL,
46 payload: SetTailscaleServeEnabledInput,
47 result: DesktopServerExposureStateSchema,
@@ -58,7 +58,7 @@ export const setTailscaleServeEnabled = makeIpcMethod({
58 }),
59 });
60
61 -export const getAdvertisedEndpoints = makeIpcMethod({
61 +export const getAdvertisedEndpoints = DesktopIpc.makeIpcMethod({
62 channel: IpcChannels.GET_ADVERTISED_ENDPOINTS_CHANNEL,
63 payload: Schema.Void,
64 result: Schema.Array(AdvertisedEndpoint),
apps/desktop/src/ipc/methods/sshEnvironment.ts
+9 -9
@@ -33,7 +33,7 @@ import * as Effect from "effect/Effect";
33 import * as Schema from "effect/Schema";
34
35 import * as IpcChannels from "../channels.ts";
36 -import { makeIpcMethod } from "../DesktopIpc.ts";
36 +import * as DesktopIpc from "../DesktopIpc.ts";
37 import * as DesktopSshEnvironment from "../../ssh/DesktopSshEnvironment.ts";
38 import * as DesktopSshPasswordPrompts from "../../ssh/DesktopSshPasswordPrompts.ts";
39
@@ -107,7 +107,7 @@ const withLoopbackSshApi =
107 ),
108 );
109
110 -export const discoverSshHosts = makeIpcMethod({
110 +export const discoverSshHosts = DesktopIpc.makeIpcMethod({
111 channel: IpcChannels.DISCOVER_SSH_HOSTS_CHANNEL,
112 payload: Schema.Void,
113 result: Schema.Array(DesktopDiscoveredSshHostSchema),
@@ -117,7 +117,7 @@ export const discoverSshHosts = makeIpcMethod({
117 }),
118 });
119
120 -export const ensureSshEnvironment = makeIpcMethod({
120 +export const ensureSshEnvironment = DesktopIpc.makeIpcMethod({
121 channel: IpcChannels.ENSURE_SSH_ENVIRONMENT_CHANNEL,
122 payload: DesktopSshEnvironmentEnsureInputSchema,
123 result: DesktopSshEnvironmentEnsureResultSchema,
@@ -139,7 +139,7 @@ export const ensureSshEnvironment = makeIpcMethod({
139 }),
140 });
141
142 -export const disconnectSshEnvironment = makeIpcMethod({
142 +export const disconnectSshEnvironment = DesktopIpc.makeIpcMethod({
143 channel: IpcChannels.DISCONNECT_SSH_ENVIRONMENT_CHANNEL,
144 payload: DesktopSshEnvironmentTargetSchema,
145 result: Schema.Void,
@@ -149,7 +149,7 @@ export const disconnectSshEnvironment = makeIpcMethod({
149 }),
150 });
151
152 -export const fetchSshEnvironmentDescriptor = makeIpcMethod({
152 +export const fetchSshEnvironmentDescriptor = DesktopIpc.makeIpcMethod({
153 channel: IpcChannels.FETCH_SSH_ENVIRONMENT_DESCRIPTOR_CHANNEL,
154 payload: DesktopSshHttpBaseUrlInputSchema,
155 result: ExecutionEnvironmentDescriptor,
@@ -160,7 +160,7 @@ export const fetchSshEnvironmentDescriptor = makeIpcMethod({
160 }),
161 });
162
163 -export const bootstrapSshBearerSession = makeIpcMethod({
163 +export const bootstrapSshBearerSession = DesktopIpc.makeIpcMethod({
164 channel: IpcChannels.BOOTSTRAP_SSH_BEARER_SESSION_CHANNEL,
165 payload: DesktopSshBearerBootstrapInputSchema,
166 result: AuthAccessTokenResult,
@@ -177,7 +177,7 @@ export const bootstrapSshBearerSession = makeIpcMethod({
177 }),
178 });
179
180 -export const fetchSshSessionState = makeIpcMethod({
180 +export const fetchSshSessionState = DesktopIpc.makeIpcMethod({
181 channel: IpcChannels.FETCH_SSH_SESSION_STATE_CHANNEL,
182 payload: DesktopSshBearerRequestInputSchema,
183 result: AuthSessionState,
@@ -194,7 +194,7 @@ export const fetchSshSessionState = makeIpcMethod({
194 }),
195 });
196
197 -export const issueSshWebSocketTicket = makeIpcMethod({
197 +export const issueSshWebSocketTicket = DesktopIpc.makeIpcMethod({
198 channel: IpcChannels.ISSUE_SSH_WEBSOCKET_TOKEN_CHANNEL,
199 payload: DesktopSshBearerRequestInputSchema,
200 result: AuthWebSocketTicketResult,
@@ -211,7 +211,7 @@ export const issueSshWebSocketTicket = makeIpcMethod({
211 }),
212 });
213
214 -export const resolveSshPasswordPrompt = makeIpcMethod({
214 +export const resolveSshPasswordPrompt = DesktopIpc.makeIpcMethod({
215 channel: IpcChannels.RESOLVE_SSH_PASSWORD_PROMPT_CHANNEL,
216 payload: DesktopSshPasswordPromptResolutionInputSchema,
217 result: Schema.Void,
apps/desktop/src/ipc/methods/updates.ts
+6 -6
@@ -9,9 +9,9 @@ import * as Schema from "effect/Schema";
9
10 import * as DesktopUpdates from "../../updates/DesktopUpdates.ts";
11 import * as IpcChannels from "../channels.ts";
12 -import { makeIpcMethod } from "../DesktopIpc.ts";
12 +import * as DesktopIpc from "../DesktopIpc.ts";
13
14 -export const getUpdateState = makeIpcMethod({
14 +export const getUpdateState = DesktopIpc.makeIpcMethod({
15 channel: IpcChannels.UPDATE_GET_STATE_CHANNEL,
16 payload: Schema.Void,
17 result: DesktopUpdateStateSchema,
@@ -21,7 +21,7 @@ export const getUpdateState = makeIpcMethod({
21 }),
22 });
23
24 -export const setUpdateChannel = makeIpcMethod({
24 +export const setUpdateChannel = DesktopIpc.makeIpcMethod({
25 channel: IpcChannels.UPDATE_SET_CHANNEL_CHANNEL,
26 payload: DesktopUpdateChannelSchema,
27 result: DesktopUpdateStateSchema,
@@ -31,7 +31,7 @@ export const setUpdateChannel = makeIpcMethod({
31 }),
32 });
33
34 -export const downloadUpdate = makeIpcMethod({
34 +export const downloadUpdate = DesktopIpc.makeIpcMethod({
35 channel: IpcChannels.UPDATE_DOWNLOAD_CHANNEL,
36 payload: Schema.Void,
37 result: DesktopUpdateActionResultSchema,
@@ -41,7 +41,7 @@ export const downloadUpdate = makeIpcMethod({
41 }),
42 });
43
44 -export const installUpdate = makeIpcMethod({
44 +export const installUpdate = DesktopIpc.makeIpcMethod({
45 channel: IpcChannels.UPDATE_INSTALL_CHANNEL,
46 payload: Schema.Void,
47 result: DesktopUpdateActionResultSchema,
@@ -51,7 +51,7 @@ export const installUpdate = makeIpcMethod({
51 }),
52 });
53
54 -export const checkForUpdate = makeIpcMethod({
54 +export const checkForUpdate = DesktopIpc.makeIpcMethod({
55 channel: IpcChannels.UPDATE_CHECK_CHANNEL,
56 payload: Schema.Void,
57 result: DesktopUpdateCheckResultSchema,
apps/desktop/src/ipc/methods/window.ts
+9 -9
@@ -18,7 +18,7 @@ import * as ElectronShell from "../../electron/ElectronShell.ts";
18 import * as ElectronTheme from "../../electron/ElectronTheme.ts";
19 import * as ElectronWindow from "../../electron/ElectronWindow.ts";
20 import * as IpcChannels from "../channels.ts";
21 -import { makeIpcMethod, makeSyncIpcMethod } from "../DesktopIpc.ts";
21 +import * as DesktopIpc from "../DesktopIpc.ts";
22
23 const ContextMenuPosition = Schema.Struct({
24 x: Schema.Number,
@@ -36,7 +36,7 @@ function toWebSocketBaseUrl(httpBaseUrl: URL): string {
36 return url.href;
37 }
38
39 -export const getAppBranding = makeSyncIpcMethod({
39 +export const getAppBranding = DesktopIpc.makeSyncIpcMethod({
40 channel: IpcChannels.GET_APP_BRANDING_CHANNEL,
41 result: Schema.NullOr(DesktopAppBrandingSchema),
42 handler: Effect.fn("desktop.ipc.window.getAppBranding")(function* () {
@@ -45,7 +45,7 @@ export const getAppBranding = makeSyncIpcMethod({
45 }),
46 });
47
48 -export const getLocalEnvironmentBootstrap = makeSyncIpcMethod({
48 +export const getLocalEnvironmentBootstrap = DesktopIpc.makeSyncIpcMethod({
49 channel: IpcChannels.GET_LOCAL_ENVIRONMENT_BOOTSTRAP_CHANNEL,
50 result: Schema.NullOr(DesktopEnvironmentBootstrapSchema),
51 handler: Effect.fn("desktop.ipc.window.getLocalEnvironmentBootstrap")(function* () {
@@ -65,7 +65,7 @@ export const getLocalEnvironmentBootstrap = makeSyncIpcMethod({
65 }),
66 });
67
68 -export const getLocalEnvironmentBearerToken = makeIpcMethod({
68 +export const getLocalEnvironmentBearerToken = DesktopIpc.makeIpcMethod({
69 channel: IpcChannels.GET_LOCAL_ENVIRONMENT_BEARER_TOKEN_CHANNEL,
70 payload: Schema.Void,
71 result: Schema.String,
@@ -75,7 +75,7 @@ export const getLocalEnvironmentBearerToken = makeIpcMethod({
75 }),
76 });
77
78 -export const pickFolder = makeIpcMethod({
78 +export const pickFolder = DesktopIpc.makeIpcMethod({
79 channel: IpcChannels.PICK_FOLDER_CHANNEL,
80 payload: Schema.UndefinedOr(PickFolderOptionsSchema),
81 result: Schema.NullOr(Schema.String),
@@ -91,7 +91,7 @@ export const pickFolder = makeIpcMethod({
91 }),
92 });
93
94 -export const confirm = makeIpcMethod({
94 +export const confirm = DesktopIpc.makeIpcMethod({
95 channel: IpcChannels.CONFIRM_CHANNEL,
96 payload: Schema.String,
97 result: Schema.Boolean,
@@ -104,7 +104,7 @@ export const confirm = makeIpcMethod({
104 }),
105 });
106
107 -export const setTheme = makeIpcMethod({
107 +export const setTheme = DesktopIpc.makeIpcMethod({
108 channel: IpcChannels.SET_THEME_CHANNEL,
109 payload: DesktopThemeSchema,
110 result: Schema.Void,
@@ -114,7 +114,7 @@ export const setTheme = makeIpcMethod({
114 }),
115 });
116
117 -export const showContextMenu = makeIpcMethod({
117 +export const showContextMenu = DesktopIpc.makeIpcMethod({
118 channel: IpcChannels.CONTEXT_MENU_CHANNEL,
119 payload: ContextMenuInput,
120 result: Schema.NullOr(Schema.String),
@@ -135,7 +135,7 @@ export const showContextMenu = makeIpcMethod({
135 }),
136 });
137
138 -export const openExternal = makeIpcMethod({
138 +export const openExternal = DesktopIpc.makeIpcMethod({
139 channel: IpcChannels.OPEN_EXTERNAL_CHANNEL,
140 payload: Schema.String,
141 result: Schema.Boolean,
apps/desktop/src/main.ts
+1 -1
@@ -109,7 +109,7 @@ const electronLayer = Layer.mergeAll(
109 ElectronTheme.layer,
110 ElectronUpdater.layer,
111 ElectronWindow.layer,
112 - Layer.succeed(DesktopIpc.DesktopIpc, DesktopIpc.make(Electron.ipcMain)),
112 + DesktopIpc.layer(Electron.ipcMain),
113 );
114
115 const desktopFoundationLayer = Layer.mergeAll(