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.
nits
Julius Marminge5a755ada28fa
diff --git a/apps/server/src/wsServer.ts b/apps/server/src/wsServer.tsindex 418255151..2afceede5 100644--- a/apps/server/src/wsServer.ts+++ b/apps/server/src/wsServer.ts@@ -183,23 +183,22 @@ export const createServer = Effect.fn(function* (options: ServerOptions = {}): E});}- const onTerminalEvent = (event: TerminalEvent) =>- Effect.gen(function* () {- const push: WsPush = {- type: "push",- channel: WS_CHANNELS.terminalEvent,- data: event,- };- const message = yield* Schema.encodeEffect(Schema.fromJsonString(WsPush))(push);- let recipients = 0;- for (const client of yield* Ref.get(clients)) {- if (client.readyState === client.OPEN) {- client.send(message);- recipients += 1;- }+ const onTerminalEvent = Effect.fnUntraced(function* (event: TerminalEvent) {+ const push: WsPush = {+ type: "push",+ channel: WS_CHANNELS.terminalEvent,+ data: event,+ };+ const message = yield* Schema.encodeEffect(Schema.fromJsonString(WsPush))(push);+ let recipients = 0;+ for (const client of yield* Ref.get(clients)) {+ if (client.readyState === client.OPEN) {+ client.send(message);+ recipients += 1;}- logOutgoingPush(push, recipients);- }).pipe(Effect.runPromise);+ }+ logOutgoingPush(push, recipients);+ });// HTTP server — serves static files or redirects to Vite dev serverconst httpServer = http.createServer((req, res) => {@@ -289,9 +288,7 @@ export const createServer = Effect.fn(function* (options: ServerOptions = {}): Econst { openInEditor } = yield* Open;const subscriptionsScope = yield* Scope.make("sequential");- yield* Effect.addFinalizer(() =>- Scope.close(subscriptionsScope, Exit.void).pipe(Effect.orElseSucceed(() => undefined)),- );+ yield* Effect.addFinalizer(() => Scope.close(subscriptionsScope, Exit.void));yield* Stream.runForEach(orchestrationEngine.streamDomainEvents, (event) =>Effect.gen(function* () {@@ -312,7 +309,7 @@ export const createServer = Effect.fn(function* (options: ServerOptions = {}): E}),).pipe(Effect.forkIn(subscriptionsScope));- yield* orchestrationReactor.start.pipe(Scope.provide(subscriptionsScope));+ yield* Scope.provide(orchestrationReactor.start, subscriptionsScope);if (autoBootstrapProjectFromCwd) {const snapshot = yield* projectionReadModelQuery.getSnapshot();@@ -332,7 +329,7 @@ export const createServer = Effect.fn(function* (options: ServerOptions = {}): E}}- const routeRequest = Effect.fn(function* (request: WebSocketRequest) {+ const routeRequest = Effect.fnUntraced(function* (request: WebSocketRequest) {switch (request.body._tag) {case ORCHESTRATION_WS_METHODS.getSnapshot:return yield* projectionReadModelQuery.getSnapshot();@@ -573,18 +570,24 @@ export const createServer = Effect.fn(function* (options: ServerOptions = {}): E),);- const unsubscribeTerminalEvents = yield* terminalManager.subscribe(onTerminalEvent);+ const unsubscribeTerminalEvents = yield* terminalManager.subscribe(+ (event) => void Effect.runPromise(onTerminalEvent(event)),+ );yield* Effect.addFinalizer(() =>- Effect.sync(() => {- unsubscribeTerminalEvents();- }),+ Effect.all([Effect.sync(() => unsubscribeTerminalEvents()), terminalManager.dispose()]),);- yield* Effect.addFinalizer(terminalManager.dispose);yield* NodeHttpServer.make(() => httpServer, listenOptions);yield* Effect.addFinalizer(() =>- Effect.all([closeAllClients, closeWebSocketServer.pipe(Effect.orElseSucceed(() => undefined))]),+ Effect.all([+ closeAllClients,+ closeWebSocketServer.pipe(+ Effect.catch((error) =>+ Effect.logWarning("failed to close web socket server", { cause: error }),+ ),+ ),+ ]),);return httpServer;diff --git a/apps/web/src/session-logic.test.ts b/apps/web/src/session-logic.test.tsindex 3ecee7d63..3377268d2 100644--- a/apps/web/src/session-logic.test.ts+++ b/apps/web/src/session-logic.test.ts@@ -69,7 +69,7 @@ describe("derivePendingApprovals", () => {});describe("deriveWorkLogEntries", () => {- it("returns entries in chronological order", () => {+ it("omits tool started entries and keeps completed entries", () => {const activities: OrchestrationThreadActivity[] = [makeActivity({id: "tool-complete",@@ -86,7 +86,7 @@ describe("deriveWorkLogEntries", () => {];const entries = deriveWorkLogEntries(activities, undefined);- expect(entries.map((entry) => entry.id)).toEqual(["tool-start", "tool-complete"]);+ expect(entries.map((entry) => entry.id)).toEqual(["tool-complete"]);});it("filters by turn id when provided", () => {diff --git a/apps/web/src/session-logic.ts b/apps/web/src/session-logic.tsindex 9b24a83bb..114c2272e 100644--- a/apps/web/src/session-logic.ts+++ b/apps/web/src/session-logic.ts@@ -127,6 +127,7 @@ export function deriveWorkLogEntries();return ordered.filter((activity) => (latestTurnId ? activity.turnId === latestTurnId : true))+ .filter((activity) => activity.kind !== "tool.started").filter((activity) => activity.summary !== "Checkpoint captured").map((activity) => {const payload =