|
1 | | -import { Layer, ManagedRuntime } from "effect" |
| 1 | +import { Effect, Layer, ManagedRuntime } from "effect" |
2 | 2 | import { attach } from "./run-service" |
3 | 3 | import * as Observability from "@opencode-ai/core/effect/observability" |
4 | 4 |
|
@@ -39,6 +39,7 @@ import { Command } from "@/command" |
39 | 39 | import { Truncate } from "@/tool/truncate" |
40 | 40 | import { ToolRegistry } from "@/tool/registry" |
41 | 41 | import { Format } from "@/format" |
| 42 | +import { InstanceBootstrap } from "@/project/bootstrap" |
42 | 43 | import { InstanceStore } from "@/project/instance-store" |
43 | 44 | import { Project } from "@/project/project" |
44 | 45 | import { Vcs } from "@/project/vcs" |
@@ -91,6 +92,7 @@ export const AppLayer = Layer.mergeAll( |
91 | 92 | Truncate.defaultLayer, |
92 | 93 | ToolRegistry.defaultLayer, |
93 | 94 | Format.defaultLayer, |
| 95 | + InstanceBootstrap.defaultLayer, |
94 | 96 | InstanceStore.defaultLayer, |
95 | 97 | Project.defaultLayer, |
96 | 98 | Vcs.defaultLayer, |
@@ -128,3 +130,15 @@ export const AppRuntime: Runtime = { |
128 | 130 | }, |
129 | 131 | dispose: () => rt.dispose(), |
130 | 132 | } |
| 133 | + |
| 134 | +let bootstrapRun: Promise<Effect.Effect<void>> |
| 135 | +export function getBootstrapRunEffect(): Promise<Effect.Effect<void>> { |
| 136 | + if (!bootstrapRun) { |
| 137 | + bootstrapRun = AppRuntime.runPromise( |
| 138 | + Effect.gen(function* () { |
| 139 | + return (yield* InstanceBootstrap.Service).run |
| 140 | + }), |
| 141 | + ) |
| 142 | + } |
| 143 | + return bootstrapRun |
| 144 | +} |
0 commit comments