Repository navigation
Upstream sync: provider registry, configurable base dir, UI fixes #30
Changes from 8 commits
3e7fc28
172cac8
e340b70
51745cd
8f41542
d10016d
598fff3
1b5ed3e
eab4201
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -61,8 +61,8 @@ const LOG_DIR_CHANNEL = "desktop:log-dir"; | |
| const LOG_LIST_CHANNEL = "desktop:log-list"; | ||
| const LOG_READ_CHANNEL = "desktop:log-read"; | ||
| const LOG_OPEN_DIR_CHANNEL = "desktop:log-open-dir"; | ||
| const STATE_DIR = | ||
| process.env.T3CODE_STATE_DIR?.trim() || Path.join(OS.homedir(), ".t3", "userdata"); | ||
| const BASE_DIR = process.env.T3CODE_HOME?.trim() || Path.join(OS.homedir(), ".t3"); | ||
| const STATE_DIR = Path.join(BASE_DIR, "userdata"); | ||
|
Comment on lines
+64
to
+65
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Resolve If Suggested fix-const BASE_DIR = process.env.T3CODE_HOME?.trim() || Path.join(OS.homedir(), ".t3");
+const BASE_DIR = Path.resolve(process.env.T3CODE_HOME?.trim() || Path.join(OS.homedir(), ".t3"));
const STATE_DIR = Path.join(BASE_DIR, "userdata");Also applies to: 932-933 🤖 Prompt for AI Agents |
||
| const DESKTOP_SCHEME = "t3"; | ||
| const ROOT_DIR = Path.resolve(__dirname, "../../.."); | ||
| const isDevelopment = Boolean(process.env.VITE_DEV_SERVER_URL); | ||
|
|
@@ -929,7 +929,7 @@ function backendEnv(): NodeJS.ProcessEnv { | |
| T3CODE_MODE: "desktop", | ||
| T3CODE_NO_BROWSER: "1", | ||
| T3CODE_PORT: String(backendPort), | ||
| T3CODE_STATE_DIR: STATE_DIR, | ||
| T3CODE_HOME: BASE_DIR, | ||
| T3CODE_AUTH_TOKEN: backendAuthToken, | ||
| }; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,3 @@ | ||
| import fs from "node:fs"; | ||
| import os from "node:os"; | ||
| import path from "node:path"; | ||
| import { execFileSync } from "node:child_process"; | ||
|
|
||
| import * as NodeServices from "@effect/platform-node/NodeServices"; | ||
|
|
@@ -13,9 +10,11 @@ import { | |
| import { | ||
| Effect, | ||
| Exit, | ||
| FileSystem, | ||
| Layer, | ||
| ManagedRuntime, | ||
| Option, | ||
| Path, | ||
| Ref, | ||
| Schedule, | ||
| Schema, | ||
|
|
@@ -66,7 +65,7 @@ import { | |
| makeTestProviderAdapterHarness, | ||
| type TestProviderAdapterHarness, | ||
| } from "./TestProviderAdapter.integration.ts"; | ||
| import { ServerConfig } from "../src/config.ts"; | ||
| import { deriveServerPaths, ServerConfig } from "../src/config.ts"; | ||
|
|
||
| function runGit(cwd: string, args: ReadonlyArray<string>) { | ||
| return execFileSync("git", args, { | ||
|
|
@@ -76,14 +75,16 @@ function runGit(cwd: string, args: ReadonlyArray<string>) { | |
| }); | ||
| } | ||
|
|
||
| function initializeGitWorkspace(cwd: string) { | ||
| const initializeGitWorkspace = Effect.fn(function* (cwd: string) { | ||
| runGit(cwd, ["init", "--initial-branch=main"]); | ||
| runGit(cwd, ["config", "user.email", "test@example.com"]); | ||
| runGit(cwd, ["config", "user.name", "Test User"]); | ||
| fs.writeFileSync(path.join(cwd, "README.md"), "v1\n", "utf8"); | ||
| const fileSystem = yield* FileSystem.FileSystem; | ||
| const { join } = yield* Path.Path; | ||
| yield* fileSystem.writeFileString(join(cwd, "README.md"), "v1\n"); | ||
| runGit(cwd, ["add", "."]); | ||
| runGit(cwd, ["commit", "-m", "Initial"]); | ||
| } | ||
| }); | ||
|
|
||
| export function gitRefExists(cwd: string, ref: string): boolean { | ||
| try { | ||
|
|
@@ -214,7 +215,9 @@ export const makeOrchestrationIntegrationHarness = ( | |
| options?: MakeOrchestrationIntegrationHarnessOptions, | ||
| ) => | ||
| Effect.gen(function* () { | ||
| const sleep = (ms: number) => Effect.sleep(ms); | ||
| const path = yield* Path.Path; | ||
| const fileSystem = yield* FileSystem.FileSystem; | ||
|
|
||
| const provider = options?.provider ?? "codex"; | ||
| const useRealCodex = options?.realCodex === true; | ||
| const adapterHarness = useRealCodex | ||
|
|
@@ -231,13 +234,16 @@ export const makeOrchestrationIntegrationHarness = ( | |
| listProviders: () => Effect.succeed([adapterHarness.provider]), | ||
| } as typeof ProviderAdapterRegistry.Service) | ||
| : null; | ||
| const rootDir = fs.mkdtempSync(path.join(os.tmpdir(), "t3-orchestration-integration-")); | ||
| const rootDir = yield* fileSystem.makeTempDirectoryScoped({ | ||
| prefix: "t3-orchestration-integration-", | ||
| }); | ||
| const workspaceDir = path.join(rootDir, "workspace"); | ||
| const stateDir = path.join(rootDir, "state"); | ||
| const dbPath = path.join(stateDir, "state.sqlite"); | ||
| fs.mkdirSync(workspaceDir, { recursive: true }); | ||
| fs.mkdirSync(stateDir, { recursive: true }); | ||
| initializeGitWorkspace(workspaceDir); | ||
| const { stateDir, dbPath } = yield* deriveServerPaths(rootDir, undefined).pipe( | ||
| Effect.provideService(Path.Path, path), | ||
| ); | ||
| yield* fileSystem.makeDirectory(workspaceDir, { recursive: true }); | ||
| yield* fileSystem.makeDirectory(stateDir, { recursive: true }); | ||
| yield* initializeGitWorkspace(workspaceDir); | ||
|
Comment on lines
+237
to
+246
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C3 'makeTempDirectoryScoped|Scope\.make|Scope\.close|dispose = Effect\.gen' apps/server/integration/OrchestrationEngineHarness.integration.tsRepository: aaditagrawal/t3code Length of output: 1233 Tie the temp directory to the harness-owned lifecycle.
🤖 Prompt for AI Agents |
||
|
|
||
| const persistenceLayer = makeSqlitePersistenceLive(dbPath); | ||
| const orchestrationLayer = OrchestrationEngineLive.pipe( | ||
|
|
@@ -262,7 +268,7 @@ export const makeOrchestrationIntegrationHarness = ( | |
| }), | ||
| ).pipe( | ||
| Layer.provide(makeCodexAdapterLive()), | ||
| Layer.provideMerge(ServerConfig.layerTest(workspaceDir, stateDir)), | ||
| Layer.provideMerge(ServerConfig.layerTest(workspaceDir, rootDir)), | ||
| Layer.provideMerge(NodeServices.layer), | ||
| Layer.provideMerge(providerSessionDirectoryLayer), | ||
| ); | ||
|
|
@@ -312,7 +318,7 @@ export const makeOrchestrationIntegrationHarness = ( | |
| ); | ||
| const layer = orchestrationReactorLayer.pipe( | ||
| Layer.provide(persistenceLayer), | ||
| Layer.provideMerge(ServerConfig.layerTest(workspaceDir, stateDir)), | ||
| Layer.provideMerge(ServerConfig.layerTest(workspaceDir, rootDir)), | ||
| Layer.provideMerge(NodeServices.layer), | ||
| ); | ||
|
|
||
|
|
@@ -352,7 +358,7 @@ export const makeOrchestrationIntegrationHarness = ( | |
| yield* Stream.runForEach(runtimeReceiptBus.stream, (receipt) => | ||
| Ref.update(receiptHistory, (history) => [...history, receipt]).pipe(Effect.asVoid), | ||
| ).pipe(Effect.forkIn(scope)); | ||
| yield* sleep(10); | ||
| yield* Effect.sleep(10); | ||
|
|
||
| const waitForThread: OrchestrationIntegrationHarness["waitForThread"] = ( | ||
| threadId, | ||
|
|
@@ -469,13 +475,7 @@ export const makeOrchestrationIntegrationHarness = ( | |
| } | ||
| }); | ||
|
|
||
| yield* shutdown.pipe( | ||
| Effect.ensuring( | ||
| Effect.sync(() => { | ||
| fs.rmSync(rootDir, { recursive: true, force: true }); | ||
| }), | ||
| ), | ||
| ); | ||
| yield* shutdown; | ||
| }); | ||
|
|
||
| return { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: aaditagrawal/t3code
Length of output: 1631
Update
T3CODE_STATE_DIRtoT3CODE_HOMEon line 6.The environment variable was renamed to
T3CODE_HOMEthroughout the codebase. Line 6 still references the obsoleteT3CODE_STATE_DIR, which no longer exists in the project. Update to match the current variable name and be consistent with line 8's correct usage of--base-dir.🤖 Prompt for AI Agents