Migrate server entrypoint and RPCs to effectful schema outputs

- Point server bin packaging to `dist/bin.mjs` and run CLI via explicit `NodeRuntime.runMain`
- Use orchestration RPC schema outputs for `getSnapshot` and `replayEvents`
- Populate default thread `interactionMode`/`runtimeMode` during bootstrap and align wsServer test stubs
This commit is contained in:
Julius Marminge committed 2026-03-10 18:23:59 -07:00
1 parent 393c52c214
commit 72e563e5f2
5 files changed
+21 -8

No files matched your search

+1 -1
View File
@@ -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": {
+5 -1
View File
@@ -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<void, unknown, never>;
NodeRuntime.runMain(main);
+11 -1
View File
@@ -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<ProviderRuntimeEvent>,
@@ -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<OrchestrationReadModel, never, never>;
};
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");
+1 -1
View File
@@ -45,7 +45,7 @@
"name": "t3",
"version": "0.0.9",
"bin": {
"t3": "./dist/index.mjs",
"t3": "./dist/bin.mjs",
},
"dependencies": {
"@effect/platform-node": "catalog:",
+3 -4
View File
@@ -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,
});