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 24, 07:45 UTC
refactor(desktop): classify electron exports (#10266)
Julius Marminge committed
Sep 7, 2026 at 15:00 UTC
5a853a4b4513467fd1be3d62fe7dc974cea07c3c
10 files changed
+14
-5
apps/desktop/src/electron/ElectronApp.ts
+1
@@ -98,6 +98,7 @@ const addScopedAppListener = <Args extends ReadonlyArray<unknown>>(
98
}),
99
).pipe(Effect.asVoid);
100
101
+/** @public Service construction is part of the canonical Effect module API. */
102
export const make = ElectronApp.of({
103
metadata: Effect.gen(function* () {
104
const appVersion = yield* Effect.try({
apps/desktop/src/electron/ElectronDialog.ts
+1
@@ -102,6 +102,7 @@ export class ElectronDialog extends Context.Service<
102
}
103
>()("@t3tools/desktop/electron/ElectronDialog") {}
104
105
+/** @public Service construction is part of the canonical Effect module API. */
106
export const make = ElectronDialog.of({
107
pickFolder: Effect.fn("desktop.electron.dialog.pickFolder")(function* (input) {
108
const ownerWindowId = Option.match(input.owner, {
apps/desktop/src/electron/ElectronMenu.ts
+1
@@ -110,6 +110,7 @@ const normalizePosition = (
110
Option.map(({ x, y }) => ({ x: Math.floor(x * zoomFactor), y: Math.floor(y * zoomFactor) })),
111
);
112
113
+/** @public Service construction is part of the canonical Effect module API. */
114
export const make = Effect.gen(function* () {
115
const platform = yield* HostProcessPlatform;
116
let destructiveMenuIconCache: Option.Option<Electron.NativeImage> | undefined;
apps/desktop/src/electron/ElectronPowerMonitor.ts
+1
@@ -75,6 +75,7 @@ const onSpeedLimitChange: ElectronPowerMonitor["Service"]["onSpeedLimitChange"]
75
).pipe(Effect.asVoid);
76
};
77
78
+/** @public Service construction is part of the canonical Effect module API. */
79
export const make = ElectronPowerMonitor.of({
80
isOnBatteryPower: Effect.sync(() => Electron.powerMonitor.isOnBatteryPower()),
81
getSystemIdleTime: Effect.sync(() => Electron.powerMonitor.getSystemIdleTime()),
apps/desktop/src/electron/ElectronProtocol.ts
+5
-4
@@ -9,14 +9,14 @@ import * as Scope from "effect/Scope";
9
import * as Electron from "electron";
10
11
export const DESKTOP_HOST = "app";
12
-export const DESKTOP_PRODUCTION_SCHEME = "t3code";
13
-export const DESKTOP_DEVELOPMENT_SCHEME = "t3code-dev";
12
+const DESKTOP_PRODUCTION_SCHEME = "t3code";
13
+const DESKTOP_DEVELOPMENT_SCHEME = "t3code-dev";
14
15
export function getDesktopScheme(isDevelopment: boolean): string {
16
return isDevelopment ? DESKTOP_DEVELOPMENT_SCHEME : DESKTOP_PRODUCTION_SCHEME;
17
}
18
19
-export function getDesktopOrigin(isDevelopment: boolean): string {
19
+function getDesktopOrigin(isDevelopment: boolean): string {
20
return `${getDesktopScheme(isDevelopment)}://${DESKTOP_HOST}`;
21
}
22
@@ -109,7 +109,7 @@ function withContentSecurityPolicy(response: Response, policy: string): Response
109
/**
110
* Must run synchronously during process bootstrap, before Electron emits `ready`.
111
*/
112
-export function registerDesktopSchemePrivilegesSync(): void {
112
+function registerDesktopSchemePrivilegesSync(): void {
113
Electron.protocol.registerSchemesAsPrivileged([
114
{
115
scheme: DESKTOP_PRODUCTION_SCHEME,
@@ -205,6 +205,7 @@ async function fetchWithTransientRetry(url: string, init: RequestInit): Promise<
205
throw lastError;
206
}
207
208
+/** @public Service construction is part of the canonical Effect module API. */
209
export const make = Effect.gen(function* () {
210
const registered = yield* Ref.make(false);
211
apps/desktop/src/electron/ElectronSafeStorage.ts
+1
-1
@@ -50,7 +50,6 @@ export const ElectronSafeStorageError = Schema.Union([
50
ElectronSafeStorageDecryptError,
51
]);
52
export type ElectronSafeStorageError = typeof ElectronSafeStorageError.Type;
53
-export const isElectronSafeStorageError = Schema.is(ElectronSafeStorageError);
53
54
export class ElectronSafeStorage extends Context.Service<
55
ElectronSafeStorage,
@@ -66,6 +65,7 @@ export class ElectronSafeStorage extends Context.Service<
65
}
66
>()("@t3tools/desktop/electron/ElectronSafeStorage") {}
67
68
+/** @public Service construction is part of the canonical Effect module API. */
69
export const make = Effect.gen(function* () {
70
const platform = yield* HostProcessPlatform;
71
apps/desktop/src/electron/ElectronShell.ts
+1
@@ -67,6 +67,7 @@ export class ElectronShell extends Context.Service<
67
}
68
>()("@t3tools/desktop/electron/ElectronShell") {}
69
70
+/** @public Service construction is part of the canonical Effect module API. */
71
export const make = ElectronShell.of({
72
openExternal: (rawUrl) =>
73
Option.match(parseSafeExternalUrl(rawUrl), {
apps/desktop/src/electron/ElectronTheme.ts
+1
@@ -28,6 +28,7 @@ export class ElectronTheme extends Context.Service<
28
}
29
>()("@t3tools/desktop/electron/ElectronTheme") {}
30
31
+/** @public Service construction is part of the canonical Effect module API. */
32
export const make = ElectronTheme.of({
33
shouldUseDarkColors: Effect.sync(() => Electron.nativeTheme.shouldUseDarkColors),
34
setSource: (theme) =>
apps/desktop/src/electron/ElectronUpdater.ts
+1
@@ -80,6 +80,7 @@ export class ElectronUpdater extends Context.Service<
80
}
81
>()("@t3tools/desktop/electron/ElectronUpdater") {}
82
83
+/** @public Service construction is part of the canonical Effect module API. */
84
export const make = ElectronUpdater.of({
85
setFeedURL: (options) =>
86
Effect.suspend(() => {
apps/desktop/src/electron/ElectronWindow.ts
+1
@@ -95,6 +95,7 @@ export class ElectronWindow extends Context.Service<
95
}
96
>()("@t3tools/desktop/electron/ElectronWindow") {}
97
98
+/** @public Service construction is part of the canonical Effect module API. */
99
export const make = Effect.gen(function* () {
100
const platform = yield* HostProcessPlatform;
101
const mainWindowRef = yield* Ref.make<Option.Option<Electron.BrowserWindow>>(Option.none());