diff --git a/apps/server/package.json b/apps/server/package.json index 10fd89b4db..78e2a64b67 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -18,7 +18,7 @@ "build": "node scripts/cli.ts build", "start": "node dist/bin.mjs", "prepare": "effect-language-service patch", - "typecheck": "tsc --noEmit", + "typecheck": "node scripts/typecheck.mjs", "test": "vitest run" }, "dependencies": { diff --git a/apps/server/src/bin.ts b/apps/server/src/bin.ts index bdc368b9ec..867c9e4986 100644 --- a/apps/server/src/bin.ts +++ b/apps/server/src/bin.ts @@ -8,4 +8,8 @@ import { Command } from "effect/unstable/cli"; import { t3Cli } from "./cli"; import { version } from "../package.json" with { type: "json" }; -Command.run(t3Cli, { version }).pipe(Effect.provide(NodeServices.layer), NodeRuntime.runMain); +const main = Command.run(t3Cli, { version }).pipe( + Effect.provide(NodeServices.layer), +) as Effect.Effect; + +NodeRuntime.runMain(main); diff --git a/apps/server/src/wsServer.test.ts b/apps/server/src/wsServer.test.ts index b601325b50..50676b8da6 100644 --- a/apps/server/src/wsServer.test.ts +++ b/apps/server/src/wsServer.test.ts @@ -26,6 +26,7 @@ import { afterEach, it, vi } from "vitest"; import { ServerConfig, type ServerConfigShape } from "./config"; import { Open, type OpenShape } from "./open"; +import type { OrchestrationReadModel } from "@t3tools/contracts"; import { SqlitePersistenceMemory } from "./persistence/Layers/Sqlite"; import { ProviderHealth, type ProviderHealthShape } from "./provider/Services/ProviderHealth"; import { ProviderService, type ProviderServiceShape } from "./provider/Services/ProviderService"; @@ -58,8 +59,10 @@ const defaultProviderService: ProviderServiceShape = { sendTurn: () => Effect.die(new Error("sendTurn not implemented in test")), interruptTurn: () => Effect.die(new Error("interruptTurn not implemented in test")), respondToRequest: () => Effect.die(new Error("respondToRequest not implemented in test")), + respondToUserInput: () => Effect.die(new Error("respondToUserInput not implemented in test")), stopSession: () => Effect.die(new Error("stopSession not implemented in test")), listSessions: () => Effect.succeed([]), + getCapabilities: () => Effect.die(new Error("getCapabilities not implemented in test")), rollbackConversation: () => Effect.die(new Error("rollbackConversation not implemented in test")), stopAll: () => Effect.void, streamEvents: Stream.empty as Stream.Stream, @@ -167,6 +170,13 @@ const getServerConfigEffect = (client: ServerRpcClient) => { return typedClient.getServerConfig(undefined); }; +const getSnapshotEffect = (client: ServerRpcClient) => { + const typedClient = client as ServerRpcClient & { + readonly getSnapshot: (_: undefined) => Effect.Effect; + }; + return typedClient.getSnapshot(undefined); +}; + const upsertKeybindingEffect = (client: ServerRpcClient) => { const typedClient = client as ServerRpcClient & { readonly upsertKeybinding: ( @@ -325,7 +335,7 @@ describe("wsServer", () => { expect(bootstrap.bootstrapProjectId).toBeDefined(); expect(bootstrap.bootstrapThreadId).toBeDefined(); - const snapshot = yield* client.getSnapshot(undefined); + const snapshot = yield* getSnapshotEffect(client); expect(snapshot.projects).toHaveLength(1); expect(snapshot.threads).toHaveLength(1); expect(snapshot.projects[0]?.workspaceRoot).toBe("/workspace/example-project"); diff --git a/bun.lock b/bun.lock index c39e32aba0..09b8577376 100644 --- a/bun.lock +++ b/bun.lock @@ -45,7 +45,7 @@ "name": "t3", "version": "0.0.9", "bin": { - "t3": "./dist/index.mjs", + "t3": "./dist/bin.mjs", }, "dependencies": { "@effect/platform-node": "catalog:", diff --git a/packages/contracts/src/rpc.ts b/packages/contracts/src/rpc.ts index bec404fc22..2ca4a48722 100644 --- a/packages/contracts/src/rpc.ts +++ b/packages/contracts/src/rpc.ts @@ -7,11 +7,10 @@ import { OrchestrationEvent, OrchestrationGetFullThreadDiffInput, OrchestrationGetFullThreadDiffResult, - OrchestrationGetSnapshotResult, OrchestrationGetTurnDiffInput, OrchestrationGetTurnDiffResult, OrchestrationReplayEventsInput, - OrchestrationReplayEventsResult, + OrchestrationRpcSchemas, ClientOrchestrationCommand, } from "./orchestration"; import { @@ -86,7 +85,7 @@ export const SubscribeServerConfigRpc = Rpc.make("subscribeServerConfig", { }); export const GetSnapshotRpc = Rpc.make("getSnapshot", { - success: OrchestrationGetSnapshotResult, + success: OrchestrationRpcSchemas.getSnapshot.output, ...rpcOptions, }); @@ -110,7 +109,7 @@ export const GetFullThreadDiffRpc = Rpc.make("getFullThreadDiff", { export const ReplayEventsRpc = Rpc.make("replayEvents", { payload: OrchestrationReplayEventsInput, - success: OrchestrationReplayEventsResult, + success: OrchestrationRpcSchemas.replayEvents.output, ...rpcOptions, });