Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.
Fix Effect type warnings to pass typecheck
Julius Marminge9c4095aaaa31
diff --git a/apps/server/src/git/Layers/CodexTextGeneration.ts b/apps/server/src/git/Layers/CodexTextGeneration.tsindex 91b29b182..3fbeb1aac 100644--- a/apps/server/src/git/Layers/CodexTextGeneration.ts+++ b/apps/server/src/git/Layers/CodexTextGeneration.ts@@ -129,9 +129,9 @@ const makeCodexTextGeneration = Effect.gen(function* () {const path = yield* Path.Path;const commandSpawner = yield* ChildProcessSpawner.ChildProcessSpawner;- const readStreamAsString = (+ const readStreamAsString = <E>(operation: string,- stream: Stream.Stream<Uint8Array, unknown>,+ stream: Stream.Stream<Uint8Array, E>,): Effect.Effect<string, TextGenerationError> =>Effect.gen(function* () {let text = "";diff --git a/apps/server/src/git/Layers/GitService.ts b/apps/server/src/git/Layers/GitService.tsindex 11aeef30c..d3f07e315 100644--- a/apps/server/src/git/Layers/GitService.ts+++ b/apps/server/src/git/Layers/GitService.ts@@ -39,9 +39,9 @@ function toGitCommandError(});}-const collectOutput = Effect.fn(function* (+const collectOutput = Effect.fn(function* <E>(input: Pick<ExecuteGitInput, "operation" | "cwd" | "args">,- stream: Stream.Stream<Uint8Array, unknown>,+ stream: Stream.Stream<Uint8Array, E>,maxOutputBytes: number,): Effect.fn.Return<string, GitCommandError> {const decoder = new TextDecoder();diff --git a/apps/server/src/orchestration/projector.ts b/apps/server/src/orchestration/projector.tsindex 296cac2cb..bbc1cc8d0 100644--- a/apps/server/src/orchestration/projector.ts+++ b/apps/server/src/orchestration/projector.ts@@ -40,9 +40,12 @@ function decodeForEvent<A>(eventType: OrchestrationEvent["type"],field: string,): Effect.Effect<A, OrchestrationProjectorDecodeError> {- return Schema.decodeUnknownEffect(schema)(value).pipe(- Effect.mapError(toProjectorDecodeError(`${eventType}:${field}`)),- ) as Effect.Effect<A, OrchestrationProjectorDecodeError>;+ return Effect.try({+ // eslint-disable-next-line @typescript-eslint/no-explicit-any+ try: () => Schema.decodeUnknownSync(schema as any)(value) as A,+ catch: (error) =>+ toProjectorDecodeError(`${eventType}:${field}`)(error as Schema.SchemaError),+ });}function retainThreadMessagesAfterRevert(diff --git a/apps/server/src/serverLayers.ts b/apps/server/src/serverLayers.tsindex 3d37cc105..da8def168 100644--- a/apps/server/src/serverLayers.ts+++ b/apps/server/src/serverLayers.ts@@ -17,6 +17,7 @@ import { ProviderCommandReactorLive } from "./orchestration/Layers/ProviderCommaimport { OrchestrationProjectionPipelineLive } from "./orchestration/Layers/ProjectionPipeline";import { OrchestrationProjectionSnapshotQueryLive } from "./orchestration/Layers/ProjectionSnapshotQuery";import { ProviderRuntimeIngestionLive } from "./orchestration/Layers/ProviderRuntimeIngestion";+import { ProviderUnsupportedError } from "./provider/Errors";import { makeCodexAdapterLive } from "./provider/Layers/CodexAdapter";import { ProviderAdapterRegistryLive } from "./provider/Layers/ProviderAdapterRegistry";import { makeProviderServiceLive } from "./provider/Layers/ProviderService";@@ -35,7 +36,7 @@ import { NodePtyAdapterLive } from "./terminal/Layers/NodePTY";export function makeServerProviderLayer(): Layer.Layer<ProviderService,- unknown,+ ProviderUnsupportedError,SqlClient.SqlClient | ServerConfig> {return Effect.gen(function* () {diff --git a/apps/server/src/wsServer.test.ts b/apps/server/src/wsServer.test.tsindex 6e177aa7f..57abed02a 100644--- a/apps/server/src/wsServer.test.ts+++ b/apps/server/src/wsServer.test.ts@@ -323,14 +323,14 @@ describe("WebSocket Server", () => {async function createTestServer(options: {- persistenceLayer?: Layer.Layer<SqlClient.SqlClient, any>;+ persistenceLayer?: Layer.Layer<SqlClient.SqlClient, never>;cwd?: string;autoBootstrapProjectFromCwd?: boolean;logWebSocketEvents?: boolean;devUrl?: string;authToken?: string;stateDir?: string;- providerLayer?: Layer.Layer<ProviderService, unknown>;+ providerLayer?: Layer.Layer<ProviderService, never>;open?: OpenShape;gitManager?: GitManagerShape;gitCore?: Pick<GitCoreShape, "listBranches" | "initRepo" | "pullCurrentBranch">;diff --git a/apps/server/src/wsServer.ts b/apps/server/src/wsServer.tsindex 85986f35e..aa72c851f 100644--- a/apps/server/src/wsServer.ts+++ b/apps/server/src/wsServer.ts@@ -66,14 +66,14 @@ export interface ServerShape {*/readonly start: Effect.Effect<http.Server,- unknown,+ ServerLifecycleError,Scope.Scope | ServerRuntimeServices | ServerConfig>;/*** Wait for process shutdown signals.*/- readonly stopSignal: Effect.Effect<unknown, never>;+ readonly stopSignal: Effect.Effect<void, never>;}/**@@ -165,7 +165,7 @@ class RouteRequestError extends Schema.TaggedErrorClass<RouteRequestError>()("Roexport const createServer = Effect.fn(function* (): Effect.fn.Return<http.Server,- unknown, // TODO: This should not be unknown+ ServerLifecycleError,Scope.Scope | ServerRuntimeServices | ServerConfig> {const serverConfig = yield* ServerConfig;@@ -338,21 +338,27 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<yield* Scope.provide(orchestrationReactor.start, subscriptionsScope);if (autoBootstrapProjectFromCwd) {- const snapshot = yield* projectionReadModelQuery.getSnapshot();- const existing = snapshot.projects.find((project) => project.workspaceRoot === cwd);- if (!existing) {- const createdAt = new Date().toISOString();- const projectName = path.basename(cwd) || "project";- yield* orchestrationEngine.dispatch({- type: "project.create",- commandId: CommandId.makeUnsafe(crypto.randomUUID()),- projectId: ProjectId.makeUnsafe(crypto.randomUUID()),- title: projectName,- workspaceRoot: cwd,- defaultModel: "gpt-5-codex",- createdAt,- });- }+ yield* Effect.gen(function* () {+ const snapshot = yield* projectionReadModelQuery.getSnapshot();+ const existing = snapshot.projects.find((project) => project.workspaceRoot === cwd);+ if (!existing) {+ const createdAt = new Date().toISOString();+ const projectName = path.basename(cwd) || "project";+ yield* orchestrationEngine.dispatch({+ type: "project.create",+ commandId: CommandId.makeUnsafe(crypto.randomUUID()),+ projectId: ProjectId.makeUnsafe(crypto.randomUUID()),+ title: projectName,+ workspaceRoot: cwd,+ defaultModel: "gpt-5-codex",+ createdAt,+ });+ }+ }).pipe(+ Effect.mapError(+ (cause) => new ServerLifecycleError({ operation: "autoBootstrapProject", cause }),+ ),+ );}const routeRequest = Effect.fnUntraced(function* (request: WebSocketRequest) {@@ -618,7 +624,9 @@ export const createServer = Effect.fn(function* (): Effect.fn.Return<);yield* Effect.addFinalizer(() => Effect.sync(() => unsubscribeTerminalEvents()));- yield* NodeHttpServer.make(() => httpServer, listenOptions);+ yield* NodeHttpServer.make(() => httpServer, listenOptions).pipe(+ Effect.mapError((cause) => new ServerLifecycleError({ operation: "httpServerListen", cause })),+ );yield* Effect.addFinalizer(() =>Effect.all([