diff options
| author | Kit Langton <[email protected]> | 2026-04-14 12:53:13 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-04-14 12:53:13 -0400 |
| commit | ff60859e3607c4f270fa50e5d56f8e1cbe763a6e (patch) | |
| tree | 958e22747f63a402d29537e05f3e22d4a9c45732 /packages | |
| parent | 020c47a055532c024eba2089bfea11adea7a545d (diff) | |
| download | opencode-ff60859e3607c4f270fa50e5d56f8e1cbe763a6e.tar.gz opencode-ff60859e3607c4f270fa50e5d56f8e1cbe763a6e.zip | |
fix(project): reuse runtime in instance boot (#22470)
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/opencode/src/project/instance.ts | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/packages/opencode/src/project/instance.ts b/packages/opencode/src/project/instance.ts index 2945c1208..51ae669dc 100644 --- a/packages/opencode/src/project/instance.ts +++ b/packages/opencode/src/project/instance.ts @@ -1,9 +1,9 @@ import { GlobalBus } from "@/bus/global" import { disposeInstance } from "@/effect/instance-registry" +import { makeRuntime } from "@/effect/run-service" import { Filesystem } from "@/util/filesystem" import { iife } from "@/util/iife" import { Log } from "@/util/log" -import { Effect } from "effect" import { LocalContext } from "../util/local-context" import { Project } from "./project" import { WorkspaceContext } from "@/control-plane/workspace-context" @@ -16,6 +16,7 @@ export interface InstanceContext { const context = LocalContext.create<InstanceContext>("instance") const cache = new Map<string, Promise<InstanceContext>>() +const project = makeRuntime(Project.Service, Project.defaultLayer) const disposal = { all: undefined as Promise<void> | undefined, @@ -30,13 +31,13 @@ function boot(input: { directory: string; init?: () => Promise<any>; worktree?: worktree: input.worktree, project: input.project, } - : await Effect.runPromise( - Project.Service.use((svc) => svc.fromDirectory(input.directory)).pipe(Effect.provide(Project.defaultLayer)), - ).then(({ project, sandbox }) => ({ - directory: input.directory, - worktree: sandbox, - project, - })) + : await project + .runPromise((svc) => svc.fromDirectory(input.directory)) + .then(({ project, sandbox }) => ({ + directory: input.directory, + worktree: sandbox, + project, + })) await context.provide(ctx, async () => { await input.init?.() }) |
