refactor(simulation): scope Drive lifecycle with Effect (#36908)
This commit is contained in:
parent
a149a61a89
commit
947566f611
30 changed files with 1313 additions and 600 deletions
|
|
@ -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)))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue