[codex] Remove redundant Effect type annotations (#3229)

Co-authored-by: codex <[email protected]>
This commit is contained in:
Julius Marmingeandcodex authored and GitHub committed 2026-06-20 00:37:47 -07:00
1 parent 7eda6ba5fc
commit 9a1c4875a3
14 files changed
+69 -123

No files matched your search

+1 -5
View File
@@ -50,11 +50,7 @@ export function makeComponentLogger(component: string): DesktopComponentLogger {
};
}
const readPersistedOtlpTracesUrl: Effect.Effect<
Option.Option<string>,
never,
FileSystem.FileSystem | DesktopEnvironment.DesktopEnvironment
> = Effect.gen(function* () {
const readPersistedOtlpTracesUrl = Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const environment = yield* DesktopEnvironment.DesktopEnvironment;
const raw = yield* fileSystem.readFileString(environment.serverSettingsPath).pipe(Effect.option);
@@ -54,11 +54,7 @@ const { logWarning: logBackendConfigurationWarning } = DesktopObservability.make
"desktop-backend-configuration",
);
const readPersistedBackendObservabilitySettings: Effect.Effect<
BackendObservabilitySettings,
never,
FileSystem.FileSystem | DesktopEnvironment.DesktopEnvironment
> = Effect.gen(function* () {
const readPersistedBackendObservabilitySettings = Effect.gen(function* () {
const fileSystem = yield* FileSystem.FileSystem;
const environment = yield* DesktopEnvironment.DesktopEnvironment;
const exists = yield* fileSystem
@@ -211,11 +211,7 @@ const readLoginShellEnvironment = (
timeout: LOGIN_SHELL_TIMEOUT,
}).pipe(Effect.map((output) => extractEnvironment(output, names)));
const readLaunchctlPath: Effect.Effect<
Option.Option<string>,
never,
ChildProcessSpawner.ChildProcessSpawner
> = runCommandOutput({
const readLaunchctlPath = runCommandOutput({
command: "/bin/launchctl",
args: ["getenv", "PATH"],
timeout: LAUNCHCTL_TIMEOUT,
@@ -37,11 +37,7 @@ const dispatchMenuAction = Effect.fn("desktop.menu.dispatchMenuAction")(function
yield* desktopWindow.dispatchMenuAction(action);
});
const checkForUpdatesFromMenu: Effect.Effect<
void,
never,
DesktopUpdates.DesktopUpdates | ElectronDialog.ElectronDialog
> = Effect.gen(function* () {
const checkForUpdatesFromMenu = Effect.gen(function* () {
const updates = yield* DesktopUpdates.DesktopUpdates;
const electronDialog = yield* ElectronDialog.ElectronDialog;
const result = yield* updates.check("menu");
@@ -65,11 +61,7 @@ const checkForUpdatesFromMenu: Effect.Effect<
}
}).pipe(Effect.withSpan("desktop.menu.checkForUpdates"));
const handleCheckForUpdatesMenuClick: Effect.Effect<
void,
DesktopWindow.DesktopWindowError,
DesktopUpdates.DesktopUpdates | ElectronDialog.ElectronDialog | DesktopWindow.DesktopWindow
> = Effect.gen(function* () {
const handleCheckForUpdatesMenuClick = Effect.gen(function* () {
const updates = yield* DesktopUpdates.DesktopUpdates;
const electronDialog = yield* ElectronDialog.ElectronDialog;
const disabledReason = yield* updates.disabledReason;
+7 -11
View File
@@ -5,24 +5,20 @@ import { Atom } from "effect/unstable/reactivity";
import { runtimeContextLayer } from "../lib/runtime";
import { connectionPlatformLayer } from "./platform";
const providedConnectionPlatformLayer: Layer.Layer<
Layer.Success<typeof connectionPlatformLayer>,
Layer.Error<typeof connectionPlatformLayer>
> = connectionPlatformLayer.pipe(Layer.provide(runtimeContextLayer));
const providedConnectionPlatformLayer = connectionPlatformLayer.pipe(
Layer.provide(runtimeContextLayer),
);
type ConnectionLayerSource =
| typeof Connection.layer
| typeof runtimeContextLayer
| typeof providedConnectionPlatformLayer;
| typeof connectionPlatformLayer;
export const connectionLayer: Layer.Layer<
Layer.Success<ConnectionLayerSource>,
Layer.Error<ConnectionLayerSource>
> = Connection.layer.pipe(
const connectionLayer = Connection.layer.pipe(
Layer.provideMerge(Layer.mergeAll(runtimeContextLayer, providedConnectionPlatformLayer)),
);
export const connectionAtomRuntime: Atom.AtomRuntime<
Layer.Success<typeof connectionLayer>,
Layer.Error<typeof connectionLayer>
Layer.Success<ConnectionLayerSource>,
Layer.Error<ConnectionLayerSource>
> = Atom.runtime(connectionLayer);
+5 -8
View File
@@ -22,10 +22,7 @@ type RuntimeLayerSource =
| typeof httpClientLayer
| typeof tracingLayer;
export const runtimeLayer: Layer.Layer<
Layer.Success<RuntimeLayerSource>,
Layer.Error<RuntimeLayerSource>
> = Layer.merge(
const runtimeLayer = Layer.merge(
managedRelayClientLayer(configuredRelayUrl()),
Socket.layerWebSocketConstructorGlobal,
).pipe(
@@ -35,11 +32,11 @@ export const runtimeLayer: Layer.Layer<
);
export const runtime: ManagedRuntime.ManagedRuntime<
Layer.Success<typeof runtimeLayer>,
Layer.Error<typeof runtimeLayer>
Layer.Success<RuntimeLayerSource>,
Layer.Error<RuntimeLayerSource>
> = ManagedRuntime.make(runtimeLayer);
export const runtimeContextLayer: Layer.Layer<
Layer.Success<typeof runtimeLayer>,
Layer.Error<typeof runtimeLayer>
Layer.Success<RuntimeLayerSource>,
Layer.Error<RuntimeLayerSource>
> = Layer.effectContext(runtime.contextEffect);
+1 -1
View File
@@ -2,5 +2,5 @@ import { createRelayEnvironmentDiscoveryAtoms } from "@t3tools/client-runtime/st
import { connectionAtomRuntime } from "../connection/runtime";
export const relayEnvironmentDiscovery: ReturnType<typeof createRelayEnvironmentDiscoveryAtoms> =
export const relayEnvironmentDiscovery =
createRelayEnvironmentDiscoveryAtoms(connectionAtomRuntime);
+1 -5
View File
@@ -191,11 +191,7 @@ const make = Effect.acquireRelease(
}),
);
export const layer: Layer.Layer<
McpSessionRegistry,
never,
Crypto.Crypto | ServerEnvironment.ServerEnvironment | HttpServer.HttpServer
> = Layer.effect(McpSessionRegistry, make);
export const layer = Layer.effect(McpSessionRegistry, make);
export const issueActiveMcpCredential = (
request: McpCredentialRequest,
@@ -114,11 +114,7 @@ export const deriveProviderInstanceConfigMap = (
* configs, so the only way the watcher could fail is a settings stream
* tear-down, which logs and exits cleanly.
*/
const SettingsWatcherLive: Layer.Layer<
never,
never,
ProviderInstanceRegistryMutator | ServerSettingsService
> = Layer.effectDiscard(
const SettingsWatcherLive = Layer.effectDiscard(
Effect.gen(function* () {
const mutator = yield* ProviderInstanceRegistryMutator;
const serverSettings = yield* ServerSettingsService;
+34 -37
View File
@@ -107,43 +107,40 @@ export function writeStoredBrowserDpopKey(
);
}
export const generateBrowserDpopKey: Effect.Effect<BrowserDpopKey, BrowserDpopError> = Effect.gen(
function* () {
const generated = yield* Effect.tryPromise({
try: () =>
crypto.subtle.generateKey({ name: "ECDSA", namedCurve: "P-256" }, true, [
"sign",
"verify",
]) as Promise<CryptoKeyPair>,
catch: (cause) => dpopError("Could not generate DPoP proof key.", cause),
});
const privateJwk = yield* Effect.tryPromise({
try: () => crypto.subtle.exportKey("jwk", generated.privateKey),
catch: (cause) => dpopError("Could not export DPoP private key.", cause),
});
const publicJwk = yield* Effect.tryPromise({
try: () => crypto.subtle.exportKey("jwk", generated.publicKey),
catch: (cause) => dpopError("Could not export DPoP public key.", cause),
}).pipe(
Effect.flatMap((jwk) => decodeDpopPublicJwk(jwk)),
Effect.mapError((cause) =>
cause instanceof BrowserDpopError
? cause
: dpopError("Generated DPoP public key is invalid.", cause),
),
);
const privateKey = yield* Effect.tryPromise({
try: () =>
importJWK(privateJwk as JWK, "ES256", { extractable: false }) as Promise<CryptoKey>,
catch: (cause) => dpopError("Could not import DPoP private key.", cause),
});
return {
privateKey,
publicJwk,
thumbprint: computeDpopJwkThumbprint(publicJwk),
};
},
);
export const generateBrowserDpopKey = Effect.gen(function* () {
const generated = yield* Effect.tryPromise({
try: () =>
crypto.subtle.generateKey({ name: "ECDSA", namedCurve: "P-256" }, true, [
"sign",
"verify",
]) as Promise<CryptoKeyPair>,
catch: (cause) => dpopError("Could not generate DPoP proof key.", cause),
});
const privateJwk = yield* Effect.tryPromise({
try: () => crypto.subtle.exportKey("jwk", generated.privateKey),
catch: (cause) => dpopError("Could not export DPoP private key.", cause),
});
const publicJwk = yield* Effect.tryPromise({
try: () => crypto.subtle.exportKey("jwk", generated.publicKey),
catch: (cause) => dpopError("Could not export DPoP public key.", cause),
}).pipe(
Effect.flatMap((jwk) => decodeDpopPublicJwk(jwk)),
Effect.mapError((cause) =>
cause instanceof BrowserDpopError
? cause
: dpopError("Generated DPoP public key is invalid.", cause),
),
);
const privateKey = yield* Effect.tryPromise({
try: () => importJWK(privateJwk as JWK, "ES256", { extractable: false }) as Promise<CryptoKey>,
catch: (cause) => dpopError("Could not import DPoP private key.", cause),
});
return {
privateKey,
publicJwk,
thumbprint: computeDpopJwkThumbprint(publicJwk),
};
});
export function createBrowserDpopProof(input: {
readonly method: string;
+7 -11
View File
@@ -5,24 +5,20 @@ import { Atom } from "effect/unstable/reactivity";
import { runtimeContextLayer } from "../lib/runtime";
import { connectionPlatformLayer } from "./platform";
const providedConnectionPlatformLayer: Layer.Layer<
Layer.Success<typeof connectionPlatformLayer>,
Layer.Error<typeof connectionPlatformLayer>
> = connectionPlatformLayer.pipe(Layer.provide(runtimeContextLayer));
const providedConnectionPlatformLayer = connectionPlatformLayer.pipe(
Layer.provide(runtimeContextLayer),
);
type ConnectionLayerSource =
| typeof Connection.layer
| typeof runtimeContextLayer
| typeof providedConnectionPlatformLayer;
| typeof connectionPlatformLayer;
export const connectionLayer: Layer.Layer<
Layer.Success<ConnectionLayerSource>,
Layer.Error<ConnectionLayerSource>
> = Connection.layer.pipe(
const connectionLayer = Connection.layer.pipe(
Layer.provideMerge(Layer.mergeAll(runtimeContextLayer, providedConnectionPlatformLayer)),
);
export const connectionAtomRuntime: Atom.AtomRuntime<
Layer.Success<typeof connectionLayer>,
Layer.Error<typeof connectionLayer>
Layer.Success<ConnectionLayerSource>,
Layer.Error<ConnectionLayerSource>
> = Atom.runtime(connectionLayer);
+5 -8
View File
@@ -54,10 +54,7 @@ export function __setPrimaryHttpRunnerForTests(runner?: PrimaryHttpEffectRunner)
primaryHttpRunner = runner ?? livePrimaryHttpRunner;
}
export const runtimeLayer: Layer.Layer<
Layer.Success<RuntimeLayerSource>,
Layer.Error<RuntimeLayerSource>
> = Layer.mergeAll(
const runtimeLayer = Layer.mergeAll(
httpClientLayer,
browserCryptoLayer,
Socket.layerWebSocketConstructorGlobal,
@@ -68,11 +65,11 @@ export const runtimeLayer: Layer.Layer<
);
export const runtime: ManagedRuntime.ManagedRuntime<
Layer.Success<typeof runtimeLayer>,
Layer.Error<typeof runtimeLayer>
Layer.Success<RuntimeLayerSource>,
Layer.Error<RuntimeLayerSource>
> = ManagedRuntime.make(runtimeLayer);
export const runtimeContextLayer: Layer.Layer<
Layer.Success<typeof runtimeLayer>,
Layer.Error<typeof runtimeLayer>
Layer.Success<RuntimeLayerSource>,
Layer.Error<RuntimeLayerSource>
> = Layer.effectContext(runtime.contextEffect);
+2 -7
View File
@@ -1,4 +1,4 @@
import { ORCHESTRATION_WS_METHODS, type ServerConfig, WS_METHODS } from "@t3tools/contracts";
import { ORCHESTRATION_WS_METHODS, WS_METHODS } from "@t3tools/contracts";
import * as Cause from "effect/Cause";
import * as Context from "effect/Context";
import type * as Duration from "effect/Duration";
@@ -9,7 +9,6 @@ import * as Stream from "effect/Stream";
import * as SubscriptionRef from "effect/SubscriptionRef";
import { RpcClientError } from "effect/unstable/rpc";
import type { ConnectionAttemptError } from "../connection/model.ts";
import { EnvironmentSupervisor } from "../connection/supervisor.ts";
import type { WsRpcProtocolClient } from "../rpc/protocol.ts";
@@ -237,11 +236,7 @@ export function subscribe<TTag extends EnvironmentSubscriptionRpcTag>(
);
}
export const config: Effect.Effect<
ServerConfig,
EnvironmentRpcUnavailableError | ConnectionAttemptError,
EnvironmentSupervisor
> = Effect.gen(function* () {
export const config = Effect.gen(function* () {
const session = yield* currentSession();
return yield* session.initialConfig;
}).pipe(Effect.withSpan("EnvironmentRpc.config"));
+1 -5
View File
@@ -135,11 +135,7 @@ export const parseTailscaleStatus = (
}),
);
export const readTailscaleStatus: Effect.Effect<
TailscaleStatus,
TailscaleCommandError | TailscaleStatusParseError,
ChildProcessSpawner.ChildProcessSpawner
> = Effect.gen(function* () {
export const readTailscaleStatus = Effect.gen(function* () {
const args = ["status", "--json"];
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
const hostPlatform = yield* HostProcessPlatform;