forked from anomalyco/opencode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpty-environment.ts
More file actions
24 lines (22 loc) · 818 Bytes
/
Copy pathpty-environment.ts
File metadata and controls
24 lines (22 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
export * as PluginPtyEnvironment from "./pty-environment"
import { PtyEnvironment } from "@opencode-ai/server/pty-environment"
import { Effect, Layer } from "effect"
import { InstanceStore } from "@/project/instance-store"
import { Plugin } from "."
export const layer = Layer.effect(
PtyEnvironment.Service,
Effect.gen(function* () {
const plugin = yield* Plugin.Service
const instances = yield* InstanceStore.Service
return PtyEnvironment.Service.of({
get: Effect.fn("PtyEnvironment.get")(function* (input) {
return yield* instances.provide(
{ directory: input.directory },
plugin
.trigger("shell.env", { cwd: input.cwd }, { env: {} as Record<string, string> })
.pipe(Effect.map((result) => result.env)),
)
}),
})
}),
)