@devries-cameron20 / t3code-1 / commits / 5b8a69c7b9
Fork 0

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

refactor(desktop): classify backend exports (#10265)

Julius Marminge committed Sep 7, 2026 at 15:00 UTC 5b8a69c7b90b751507d0ab762dd77aaa2048408b
10 files changed +14 -59
apps/desktop/scripts/electron-launcher.mjs
+3 -3
@@ -15,8 +15,8 @@ const repoRoot = NodePath.resolve(desktopDir, "..", "..");
15 const devBundleIdSuffix = NodePath.basename(repoRoot)
16 .toLowerCase()
17 .replaceAll(/[^a-z0-9]+/g, "");
18 -export const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)";
19 -export const APP_BUNDLE_ID = isDevelopment
18 +const APP_DISPLAY_NAME = isDevelopment ? "T3 Code (Dev)" : "T3 Code (Alpha)";
19 +const APP_BUNDLE_ID = isDevelopment
20 ? `com.t3tools.t3code.dev.${devBundleIdSuffix || "local"}`
21 : "com.t3tools.t3code";
22 const APP_PROTOCOL_SCHEMES = isDevelopment ? ["t3code-dev"] : ["t3code"];
@@ -387,7 +387,7 @@ function resolveLinuxSandboxArgs(electronBinaryPath) {
387 return ["--no-sandbox"];
388 }
389
390 -export function resolveElectronPath() {
390 +function resolveElectronPath() {
391 const electronBinaryPath = resolveElectronBinaryPath();
392
393 if (hostPlatform !== "darwin") {
apps/desktop/src/backend/DesktopBackendConfiguration.ts
+1
@@ -737,6 +737,7 @@ const resolveWslStartConfig = Effect.fn("desktop.backendConfiguration.resolveWsl
737 } satisfies DesktopBackendManager.DesktopBackendStartConfig;
738 });
739
740 +/** @public Service construction is part of the canonical Effect module API. */
741 export const make = Effect.gen(function* () {
742 const environment = yield* DesktopEnvironment.DesktopEnvironment;
743 const fileSystem = yield* FileSystem.FileSystem;
apps/desktop/src/backend/DesktopLocalEnvironmentAuth.ts
+1
@@ -42,6 +42,7 @@ export class DesktopLocalEnvironmentAuth extends Context.Service<
42 }
43 >()("@t3tools/desktop/backend/DesktopLocalEnvironmentAuth") {}
44
45 +/** @public Service construction is part of the canonical Effect module API. */
46 export const make = Effect.gen(function* () {
47 const pool = yield* DesktopBackendPool.DesktopBackendPool;
48 const httpClient = yield* HttpClient.HttpClient;
apps/desktop/src/backend/DesktopNetworkInterfaces.ts
+1
@@ -39,6 +39,7 @@ export class DesktopNetworkInterfaces extends Context.Service<
39 }
40 >()("@t3tools/desktop/backend/DesktopNetworkInterfaces") {}
41
42 +/** @public Service construction is part of the canonical Effect module API. */
43 export const make = Effect.gen(function* () {
44 const platform = yield* HostProcessPlatform;
45 return DesktopNetworkInterfaces.of({
apps/desktop/src/backend/DesktopServerExposure.ts
+2 -1
@@ -27,7 +27,7 @@ import { resolveTailscaleAdvertisedEndpoints } from "./tailscaleEndpointProvider
27
28 const TAILSCALE_STATUS_CACHE_TTL = Duration.seconds(60);
29
30 -export const DESKTOP_LOOPBACK_HOST = "127.0.0.1";
30 +const DESKTOP_LOOPBACK_HOST = "127.0.0.1";
31 const DESKTOP_LAN_BIND_HOST = "0.0.0.0";
32
33 interface ResolvedDesktopServerExposure {
@@ -411,6 +411,7 @@ const requiresBackendRelaunch = (previous: RuntimeState, next: RuntimeState): bo
411 previous.bindHost !== next.bindHost ||
412 previous.localHttpUrl !== next.localHttpUrl;
413
414 +/** @public Service construction is part of the canonical Effect module API. */
415 export const make = Effect.gen(function* () {
416 const config = yield* DesktopConfig.DesktopConfig;
417 const networkInterfaces = yield* DesktopNetworkInterfaces.DesktopNetworkInterfaces;
apps/desktop/src/backend/tailscaleEndpointProvider.ts
+1 -1
@@ -14,7 +14,7 @@ import * as ChildProcessSpawner from "effect/unstable/process/ChildProcessSpawne
14
15 import type { NetworkInterfaces } from "./DesktopNetworkInterfaces.ts";
16
17 -export { isTailscaleIpv4Address, parseTailscaleMagicDnsName } from "@t3tools/tailscale";
17 +export { parseTailscaleMagicDnsName } from "@t3tools/tailscale";
18
19 const TAILSCALE_ENDPOINT_PROVIDER: AdvertisedEndpointProvider = {
20 id: "tailscale",
apps/desktop/src/settings/DesktopAppSettings.ts
+2 -1
@@ -55,7 +55,7 @@ export interface DesktopSettingsChange {
55 readonly changed: boolean;
56 }
57
58 -export const DEFAULT_TAILSCALE_SERVE_PORT = 443;
58 +const DEFAULT_TAILSCALE_SERVE_PORT = 443;
59 const MIN_MAIN_WINDOW_SIZE = {
60 width: 840,
61 height: 620,
@@ -450,6 +450,7 @@ const writeSettings = Effect.fn("desktop.settings.writeSettings")(function* (inp
450 );
451 });
452
453 +/** @public Service construction is part of the canonical Effect module API. */
454 export const make = Effect.gen(function* () {
455 const environment = yield* DesktopEnvironment.DesktopEnvironment;
456 const fileSystem = yield* FileSystem.FileSystem;
apps/desktop/src/settings/DesktopSavedEnvironments.ts
+1 -53
@@ -9,7 +9,6 @@ import * as Layer from "effect/Layer";
9 import * as Option from "effect/Option";
10 import * as Path from "effect/Path";
11 import * as Schema from "effect/Schema";
12 -import * as Ref from "effect/Ref";
12
13 import * as DesktopEnvironment from "../app/DesktopEnvironment.ts";
14 import * as ElectronSafeStorage from "../electron/ElectronSafeStorage.ts";
@@ -365,6 +364,7 @@ function decodeSecretBytes(
364 );
365 }
366
367 +/** @public Service construction is part of the canonical Effect module API. */
368 export const make = Effect.gen(function* () {
369 const environment = yield* DesktopEnvironment.DesktopEnvironment;
370 const fileSystem = yield* FileSystem.FileSystem;
@@ -555,55 +555,3 @@ export const make = Effect.gen(function* () {
555 });
556
557 export const layer = Layer.effect(DesktopSavedEnvironments, make);
558 -
559 -export const layerTest = (input?: {
560 - readonly records?: readonly PersistedSavedEnvironmentRecord[];
561 - readonly secrets?: ReadonlyMap<string, string>;
562 -}) =>
563 - Layer.effect(
564 - DesktopSavedEnvironments,
565 - Effect.gen(function* () {
566 - const recordsRef = yield* Ref.make(input?.records ?? []);
567 - const secretsRef = yield* Ref.make(new Map(input?.secrets ?? []));
568 -
569 - return DesktopSavedEnvironments.of({
570 - getRegistry: Ref.get(recordsRef),
571 - setRegistry: (records) => Ref.set(recordsRef, records),
572 - removeEnvironment: (environmentId) =>
573 - Ref.update(recordsRef, (records) =>
574 - records.filter((record) => record.environmentId !== environmentId),
575 - ).pipe(
576 - Effect.andThen(
577 - Ref.update(secretsRef, (secrets) => {
578 - const nextSecrets = new Map(secrets);
579 - nextSecrets.delete(environmentId);
580 - return nextSecrets;
581 - }),
582 - ),
583 - ),
584 - getSecret: (environmentId) =>
585 - Ref.get(secretsRef).pipe(
586 - Effect.map((secrets) => Option.fromNullishOr(secrets.get(environmentId))),
587 - ),
588 - setSecret: ({ environmentId, secret }) =>
589 - Ref.get(recordsRef).pipe(
590 - Effect.flatMap((records) => {
591 - if (!records.some((record) => record.environmentId === environmentId)) {
592 - return Effect.succeed(false);
593 - }
594 - return Ref.update(secretsRef, (secrets) => {
595 - const nextSecrets = new Map(secrets);
596 - nextSecrets.set(environmentId, secret);
597 - return nextSecrets;
598 - }).pipe(Effect.as(true));
599 - }),
600 - ),
601 - removeSecret: (environmentId) =>
602 - Ref.update(secretsRef, (secrets) => {
603 - const nextSecrets = new Map(secrets);
604 - nextSecrets.delete(environmentId);
605 - return nextSecrets;
606 - }),
607 - });
608 - }),
609 - );
apps/desktop/src/telemetry/DesktopTelemetryPublisher.ts
+1
@@ -145,6 +145,7 @@ function sampleInterval(
145 return LIVE_SAMPLE_INTERVAL;
146 }
147
148 +/** @public Service construction is part of the canonical Effect module API. */
149 export const make = Effect.fn("desktop.telemetryPublisher.make")(function* () {
150 const electronApp = yield* ElectronApp.ElectronApp;
151 const powerMonitor = yield* ElectronPowerMonitor.ElectronPowerMonitor;
apps/desktop/src/wsl/DesktopWslServerTree.ts
+1
@@ -116,6 +116,7 @@ const copyTree = (
116 }),
117 );
118
119 +/** @public Service construction is part of the canonical Effect module API. */
120 export const make = Effect.gen(function* () {
121 const environment = yield* DesktopEnvironment.DesktopEnvironment;
122 const fs = yield* FileSystem.FileSystem;