| 1 | import type { CodexSettings, ProviderInstanceId } from "@t3tools/contracts"; |
| 2 | import * as Effect from "effect/Effect"; |
| 3 | import * as Path from "effect/Path"; |
| 4 | import { resolveCodexHomeLayout } from "./Drivers/CodexHomeLayout.ts"; |
| 5 | |
| 6 | export const resolveManagedCodexHomeLayout = Effect.fn("resolveManagedCodexHomeLayout")(function* ( |
| 7 | stateDir: string, |
| 8 | instanceId: ProviderInstanceId, |
| 9 | config: CodexSettings, |
| 10 | ) { |
| 11 | const path = yield* Path.Path; |
| 12 | return yield* resolveCodexHomeLayout({ |
| 13 | ...config, |
| 14 | shadowHomePath: |
| 15 | config.shadowHomePath.trim() || |
| 16 | (instanceId === "codex" |
| 17 | ? "" |
| 18 | : path.join(stateDir, "providers", "codex", instanceId, "shadow")), |
| 19 | }); |
| 20 | }); |