Skip to content

Commit e1dae3c

Browse files
fix: preserve runtime behavior and generated protocol schemas
1 parent 0d000c2 commit e1dae3c

14 files changed

Lines changed: 32268 additions & 9692 deletions

File tree

‎apps/server/src/cli/config.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ it.layer(NodeServices.layer)("cli config resolution", (it) => {
506506
resolved.terminalLogsDir,
507507
resolved.attachmentsDir,
508508
resolved.worktreesDir,
509+
path.dirname(resolved.serverLogPath),
509510
path.dirname(resolved.serverTracePath),
510511
]) {
511512
expect(yield* fs.exists(directory)).toBe(true);

‎apps/server/src/cli/triage.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@ export const triageCommand = Command.make("triage", {
201201
dbPath: paths.dbPath,
202202
settingsPath: paths.settingsPath,
203203
logsDir: paths.logsDir,
204+
serverLogPath: paths.serverLogPath,
204205
serverTracePath: paths.serverTracePath,
205206
providerEventLogPath: paths.providerEventLogPath,
206207
terminalLogsDir: paths.terminalLogsDir,

‎apps/server/src/cli/triagePrompt.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ it("context file carries every path the playbook depends on", () => {
5252
dbPath: "/home/u/.t3/userdata/state.sqlite",
5353
settingsPath: "/home/u/.t3/userdata/settings.json",
5454
logsDir: "/home/u/.t3/userdata/logs",
55+
serverLogPath: "/home/u/.t3/userdata/logs/server.log",
5556
serverTracePath: "/home/u/.t3/userdata/logs/server.trace.ndjson",
5657
providerEventLogPath: "/home/u/.t3/userdata/logs/provider/events.log",
5758
terminalLogsDir: "/home/u/.t3/userdata/logs/terminals",

‎apps/server/src/cli/triagePrompt.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ export interface TriageContextInput {
176176
readonly dbPath: string;
177177
readonly settingsPath: string;
178178
readonly logsDir: string;
179+
readonly serverLogPath: string;
179180
readonly serverTracePath: string;
180181
readonly providerEventLogPath: string;
181182
readonly terminalLogsDir: string;
@@ -204,6 +205,7 @@ Generated by \`t3 triage\` at ${input.generatedAt}.
204205
- Database (SQLite; write only with the user's explicit permission): ${input.paths.dbPath}
205206
- Settings: ${input.paths.settingsPath}
206207
- Logs dir: ${input.paths.logsDir}
208+
- Server log: ${input.paths.serverLogPath}
207209
- Server trace (ndjson): ${input.paths.serverTracePath}
208210
- Provider event log: ${input.paths.providerEventLogPath}
209211
- Terminal logs: ${input.paths.terminalLogsDir}

‎apps/server/src/config.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ export interface ServerDerivedPaths {
4343
/** Screenshots the agent asks the collaborative browser to keep for the user. */
4444
readonly browserArtifactsDir: string;
4545
readonly logsDir: string;
46+
readonly serverLogPath: string;
4647
readonly serverTracePath: string;
4748
readonly providerLogsDir: string;
4849
readonly providerEventLogPath: string;
@@ -146,6 +147,7 @@ export const deriveServerPaths = Effect.fn(function* (
146147
attachmentsDir,
147148
browserArtifactsDir: join(stateDir, "browser-artifacts"),
148149
logsDir,
150+
serverLogPath: join(logsDir, "server.log"),
149151
serverTracePath: join(logsDir, "server.trace.ndjson"),
150152
providerLogsDir,
151153
providerEventLogPath: join(providerLogsDir, "events.log"),

‎apps/web/src/components/ui/sidebar.tsx‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import { getLocalStorageItem, setLocalStorageItem } from "~/hooks/useLocalStorag
2020
import { resolveSidebarState, type ResponsiveSidebarState } from "./sidebarState";
2121
import * as Schema from "effect/Schema";
2222

23+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
24+
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
2325
const SIDEBAR_WIDTH = "16rem";
2426
const SIDEBAR_WIDTH_MOBILE = "calc(100vw - var(--spacing(3)))";
2527
const SIDEBAR_WIDTH_ICON = "3rem";
@@ -108,13 +110,21 @@ function SidebarProvider({
108110
const [_open, _setOpen] = React.useState(defaultOpen);
109111
const open = openProp ?? _open;
110112
const setOpen = React.useCallback(
111-
(value: boolean | ((value: boolean) => boolean)) => {
113+
async (value: boolean | ((value: boolean) => boolean)) => {
112114
const openState = typeof value === "function" ? value(open) : value;
113115
if (setOpenProp) {
114116
setOpenProp(openState);
115117
} else {
116118
_setOpen(openState);
117119
}
120+
121+
// This sets the cookie to keep the sidebar state.
122+
await cookieStore.set({
123+
expires: Date.now() + SIDEBAR_COOKIE_MAX_AGE * 1000,
124+
name: SIDEBAR_COOKIE_NAME,
125+
path: "/",
126+
value: String(openState),
127+
});
118128
},
119129
[setOpenProp, open],
120130
);

‎docs/operations/observability.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,3 +566,5 @@ Current high-value span and metric boundaries include:
566566
- logs outside spans are not persisted in the trace file; SSH-managed launch stdout/stderr is still
567567
captured in its launcher log
568568
- metrics are not snapshotted locally
569+
- the old `serverLogPath` still exists in config for compatibility, but the trace file is the primary
570+
structured persisted artifact

‎package.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
"sync:repos": "node scripts/sync-reference-repos.ts"
5151
},
5252
"devDependencies": {
53-
"@babel/parser": "7.29.7",
5453
"@effect/tsgo": "catalog:",
5554
"@types/node": "catalog:",
5655
"knip": "6.34.0",

‎packages/effect-codex-app-server/scripts/generate.ts‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import {
1616
HttpClientResponse,
1717
} from "effect/unstable/http";
1818
import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
19-
import { deduplicateGeneratedSchemas } from "../../../scripts/lib/deduplicateGeneratedSchemas.ts";
2019

2120
const UPSTREAM_REF = "678157acaa819d5510adfe359abb5d0392cfe461";
2221
const USER_AGENT = "effect-codex-app-server-generator";
@@ -414,7 +413,7 @@ function addAsyncQuestionFields(value: Schema.Json): Schema.Json {
414413
return {
415414
...value,
416415
properties: {
417-
...properties,
416+
...Object.fromEntries(Object.entries(properties).filter(([key]) => key !== "type")),
418417
delivery: { anyOf: [{ type: "string", enum: ["async"] }, { type: "null" }] },
419418
questions: {
420419
anyOf: [
@@ -434,6 +433,7 @@ function addAsyncQuestionFields(value: Schema.Json): Schema.Json {
434433
{ type: "null" },
435434
],
436435
},
436+
type: itemType,
437437
},
438438
};
439439
}
@@ -689,16 +689,6 @@ function rewriteExternalRefs(
689689
const generateFiles = Effect.fn("generateFiles")(function* () {
690690
yield* ensureGeneratedDir();
691691

692-
if (process.argv.includes("--deduplicate-existing")) {
693-
const fs = yield* FileSystem.FileSystem;
694-
const { schemaOutputPath } = yield* getGeneratedPaths();
695-
yield* fs.writeFileString(
696-
schemaOutputPath,
697-
deduplicateGeneratedSchemas(yield* fs.readFileString(schemaOutputPath)),
698-
);
699-
return;
700-
}
701-
702692
const [rootJsonEntries, v1JsonEntries, v2JsonEntries] = yield* Effect.all([
703693
fetchDirectoryEntries("schema/json"),
704694
fetchDirectoryEntries("schema/json/v1"),
@@ -771,7 +761,8 @@ const generateFiles = Effect.fn("generateFiles")(function* () {
771761
for (const [name, schema] of Object.entries(aggregateSchemas).toSorted(([left], [right]) =>
772762
left.localeCompare(right),
773763
)) {
774-
generator.addSchema(name, addAsyncQuestionFields(schema) as never);
764+
aggregateSchemas[name] = addAsyncQuestionFields(schema);
765+
generator.addSchema(name, aggregateSchemas[name] as never);
775766
}
776767

777768
const generatedEntries = new Map<string, string>();
@@ -915,7 +906,7 @@ const generateFiles = Effect.fn("generateFiles")(function* () {
915906
const fs = yield* FileSystem.FileSystem;
916907
const { generatedDir, metaOutputPath, namespacesOutputPath, schemaOutputPath } =
917908
yield* getGeneratedPaths();
918-
yield* fs.writeFileString(schemaOutputPath, deduplicateGeneratedSchemas(schemaOutput));
909+
yield* fs.writeFileString(schemaOutputPath, schemaOutput);
919910
yield* fs.writeFileString(metaOutputPath, metaOutput);
920911
yield* fs.writeFileString(namespacesOutputPath, namespacesOutput);
921912

0 commit comments

Comments
 (0)