|
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 |
|
@@ -40,6 +40,7 @@ import { Command } from "@/command" |
40 | 40 | import { Truncate } from "@/tool/truncate" |
41 | 41 | import { ToolRegistry } from "@/tool/registry" |
42 | 42 | import { Format } from "@/format" |
| 43 | +import { InstanceBootstrap } from "@/project/bootstrap" |
43 | 44 | import { InstanceStore } from "@/project/instance-store" |
44 | 45 | import { Project } from "@/project/project" |
45 | 46 | import { Vcs } from "@/project/vcs" |
@@ -93,6 +94,7 @@ export const AppLayer = Layer.mergeAll( |
93 | 94 | Truncate.defaultLayer, |
94 | 95 | ToolRegistry.defaultLayer, |
95 | 96 | Format.defaultLayer, |
| 97 | + InstanceBootstrap.defaultLayer, |
96 | 98 | InstanceStore.defaultLayer, |
97 | 99 | Project.defaultLayer, |
98 | 100 | Vcs.defaultLayer, |
@@ -130,3 +132,15 @@ export const AppRuntime: Runtime = { |
130 | 132 | }, |
131 | 133 | dispose: () => rt.dispose(), |
132 | 134 | } |
| 135 | + |
| 136 | +let bootstrapRun: Promise<Effect.Effect<void>> |
| 137 | +export function getBootstrapRunEffect(): Promise<Effect.Effect<void>> { |
| 138 | + if (!bootstrapRun) { |
| 139 | + bootstrapRun = AppRuntime.runPromise( |
| 140 | + Effect.gen(function* () { |
| 141 | + return (yield* InstanceBootstrap.Service).run |
| 142 | + }), |
| 143 | + ) |
| 144 | + } |
| 145 | + return bootstrapRun |
| 146 | +} |
0 commit comments