Skip to content

Commit 812011c

Browse files
committed
refactor: remove makeRuntime from TuiConfig, use AppRuntime
Add TuiConfig.defaultLayer to AppLayer so TuiConfig.Service is available via the shared runtime. Replace the local makeRuntime with dynamic import of AppRuntime in the facade functions to avoid circular deps. Keeps facade functions (get, waitForDependencies) intact since they are spied on by test/fixture/tui-runtime.ts mockTuiRuntime helper.
1 parent 87b2a9d commit 812011c

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

packages/opencode/src/config/tui.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { isRecord } from "@/util/record"
1212
import { Global } from "@/global"
1313
import { Filesystem } from "@/util/filesystem"
1414
import { InstanceState } from "@/effect/instance-state"
15-
import { makeRuntime } from "@/effect/run-service"
1615
import { AppFileSystem } from "@/filesystem"
1716

1817
export namespace TuiConfig {
@@ -170,14 +169,14 @@ export namespace TuiConfig {
170169

171170
export const defaultLayer = layer.pipe(Layer.provide(Config.defaultLayer))
172171

173-
const { runPromise } = makeRuntime(Service, defaultLayer)
174-
175172
export async function get() {
176-
return runPromise((svc) => svc.get())
173+
const { AppRuntime } = await import("@/effect/app-runtime")
174+
return AppRuntime.runPromise(Service.use((svc) => svc.get()))
177175
}
178176

179177
export async function waitForDependencies() {
180-
await runPromise((svc) => svc.waitForDependencies())
178+
const { AppRuntime } = await import("@/effect/app-runtime")
179+
await AppRuntime.runPromise(Service.use((svc) => svc.waitForDependencies()))
181180
}
182181

183182
async function loadFile(filepath: string): Promise<Info> {

packages/opencode/src/effect/app-runtime.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { Pty } from "@/pty"
4747
import { Installation } from "@/installation"
4848
import { ShareNext } from "@/share/share-next"
4949
import { SessionShare } from "@/share/session"
50+
import { TuiConfig } from "@/config/tui"
5051

5152
export const AppLayer = Layer.mergeAll(
5253
Observability.layer,
@@ -95,6 +96,7 @@ export const AppLayer = Layer.mergeAll(
9596
Installation.defaultLayer,
9697
ShareNext.defaultLayer,
9798
SessionShare.defaultLayer,
99+
TuiConfig.defaultLayer,
98100
)
99101

100102
const rt = ManagedRuntime.make(AppLayer, { memoMap })

0 commit comments

Comments
 (0)