refactor(simulation): scope Drive lifecycle with Effect (#36908)

This commit is contained in:
Kit Langton 2026-07-14 17:16:50 -04:00 committed by GitHub
commit 947566f611
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 1313 additions and 600 deletions

View file

@ -76,14 +76,9 @@ function makeRoutes<AuthError, AuthServices>(
const serviceLayer = simulateEnabled()
? Layer.unwrap(
Effect.gen(function* () {
const { simulationReplacements, startDriveServer } = yield* Effect.promise(
() => import("@opencode-ai/simulation/backend"),
)
if (driveEnabled()) startDriveServer()
return AppNodeBuilder.build(applicationServices, [
...replacements,
...(simulateEnabled() ? simulationReplacements : []),
])
const { simulationReplacements } = yield* Effect.promise(() => import("@opencode-ai/simulation/backend"))
const simulation = yield* simulationReplacements()
return AppNodeBuilder.build(applicationServices, [...replacements, ...simulation])
}),
)
: AppNodeBuilder.build(applicationServices, replacements)
@ -116,9 +111,5 @@ function simulateEnabled() {
return !!process.env.OPENCODE_SIMULATE
}
function driveEnabled() {
return !!process.env.OPENCODE_DRIVE
}
export const webHandler = () =>
HttpRouter.toWebHandler(createRoutes().pipe(Layer.provide(HttpServer.layerServices)))