Compare commits
4 commits
dev
...
pty-env-ro
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ae4399155a | ||
|
|
ca3eb4dab2 | ||
|
|
324fcaa430 | ||
|
|
cd3cf08eb0 |
51 changed files with 53 additions and 421 deletions
|
|
@ -186,7 +186,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Ac
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer: Layer.Layer<Service, never, AccountRepo.Service | HttpClient.HttpClient> = Layer.effect(
|
const layer: Layer.Layer<Service, never, AccountRepo.Service | HttpClient.HttpClient> = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const repo = yield* AccountRepo.Service
|
const repo = yield* AccountRepo.Service
|
||||||
|
|
@ -456,8 +456,6 @@ export const layer: Layer.Layer<Service, never, AccountRepo.Service | HttpClient
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(AccountRepo.defaultLayer), Layer.provide(FetchHttpClient.layer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [AccountRepo.node, httpClient] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [AccountRepo.node, httpClient] })
|
||||||
|
|
||||||
export * as Account from "./account"
|
export * as Account from "./account"
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Ac
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const { db } = yield* Database.Service
|
const { db } = yield* Database.Service
|
||||||
|
|
@ -166,8 +166,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(Database.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Database.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Database.node] })
|
||||||
|
|
||||||
export * as AccountRepo from "./repo"
|
export * as AccountRepo from "./repo"
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ export const loaderLayer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const loader = yield* Loader
|
const loader = yield* Loader
|
||||||
|
|
@ -201,14 +201,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(loaderLayer),
|
|
||||||
Layer.provide(Provider.defaultLayer),
|
|
||||||
Layer.provide(Agent.defaultLayer),
|
|
||||||
Layer.provide(Command.defaultLayer),
|
|
||||||
Layer.provide(LayerNode.compile(InstanceStore.node, [[InstanceStore.bootstrapNode, InstanceBootstrap.node]])),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const loaderNode = LayerNode.make({
|
export const loaderNode = LayerNode.make({
|
||||||
service: Loader,
|
service: Loader,
|
||||||
layer: loaderLayer,
|
layer: loaderLayer,
|
||||||
|
|
|
||||||
|
|
@ -94,7 +94,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/AC
|
||||||
|
|
||||||
type State = Map<string, Info>
|
type State = Map<string, Info>
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const sessions = yield* Ref.make<State>(new Map())
|
const sessions = yield* Ref.make<State>(new Map())
|
||||||
|
|
@ -201,8 +201,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer, deps: [] })
|
export const node = LayerNode.make({ service: Service, layer, deps: [] })
|
||||||
|
|
||||||
function makeSession(input: StoreInput): Info {
|
function makeSession(input: StoreInput): Info {
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ export const contextLimitLoaderLayer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const messageLoader = yield* MessageLoader
|
const messageLoader = yield* MessageLoader
|
||||||
|
|
@ -226,12 +226,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(contextLimitLoaderLayer),
|
|
||||||
Layer.provide(Provider.defaultLayer),
|
|
||||||
Layer.provide(LayerNode.compile(InstanceStore.node, [[InstanceStore.bootstrapNode, InstanceBootstrap.node]])),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const messageLoaderNode = LayerNode.unbound(MessageLoader, Node.tags.values.global)
|
export const messageLoaderNode = LayerNode.unbound(MessageLoader, Node.tags.values.global)
|
||||||
|
|
||||||
export const contextLimitLoaderNode = makeGlobalNode({
|
export const contextLimitLoaderNode = makeGlobalNode({
|
||||||
|
|
|
||||||
|
|
@ -85,7 +85,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Ag
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const config = yield* Config.Service
|
const config = yield* Config.Service
|
||||||
|
|
@ -438,15 +438,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(Plugin.defaultLayer),
|
|
||||||
Layer.provide(Provider.defaultLayer),
|
|
||||||
Layer.provide(Auth.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(Skill.defaultLayer),
|
|
||||||
Layer.provide(locationServiceMapLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
const locationServiceMapNode = LayerNode.make({
|
const locationServiceMapNode = LayerNode.make({
|
||||||
service: LocationServiceMap.Service,
|
service: LocationServiceMap.Service,
|
||||||
layer: locationServiceMapLayer,
|
layer: locationServiceMapLayer,
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Auth") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Auth") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const fsys = yield* FSUtil.Service
|
const fsys = yield* FSUtil.Service
|
||||||
|
|
@ -92,8 +92,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(FSUtil.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node] })
|
||||||
|
|
||||||
export * as Auth from "."
|
export * as Auth from "."
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ export {
|
||||||
} from "@opencode-ai/core/background-job"
|
} from "@opencode-ai/core/background-job"
|
||||||
|
|
||||||
/** Keeps the legacy service instance-scoped while sharing the core registry engine. */
|
/** Keeps the legacy service instance-scoped while sharing the core registry engine. */
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
CoreBackgroundJob.Service,
|
CoreBackgroundJob.Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const state = yield* InstanceState.make(() => CoreBackgroundJob.make)
|
const state = yield* InstanceState.make(() => CoreBackgroundJob.make)
|
||||||
|
|
@ -32,8 +32,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: CoreBackgroundJob.Service, layer, deps: [] })
|
export const node = LayerNode.make({ service: CoreBackgroundJob.Service, layer, deps: [] })
|
||||||
|
|
||||||
export * as BackgroundJob from "./job"
|
export * as BackgroundJob from "./job"
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Command") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Command") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const config = yield* Config.Service
|
const config = yield* Config.Service
|
||||||
|
|
@ -172,12 +172,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(MCP.defaultLayer),
|
|
||||||
Layer.provide(Skill.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Config.node, MCP.node, Skill.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Config.node, MCP.node, Skill.node] })
|
||||||
|
|
||||||
export * as Command from "."
|
export * as Command from "."
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,7 @@ function writableGlobal(info: Info) {
|
||||||
return next
|
return next
|
||||||
}
|
}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const fs = yield* FSUtil.Service
|
const fs = yield* FSUtil.Service
|
||||||
|
|
@ -671,16 +671,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(EffectFlock.defaultLayer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(Env.defaultLayer),
|
|
||||||
Layer.provide(Auth.defaultLayer),
|
|
||||||
Layer.provide(Account.defaultLayer),
|
|
||||||
Layer.provide(Npm.defaultLayer),
|
|
||||||
Layer.provide(FetchHttpClient.layer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Wo
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const auth = yield* Auth.Service
|
const auth = yield* Auth.Service
|
||||||
|
|
@ -893,19 +893,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(Auth.defaultLayer),
|
|
||||||
Layer.provide(Session.defaultLayer),
|
|
||||||
Layer.provide(SessionPrompt.defaultLayer),
|
|
||||||
Layer.provide(Project.defaultLayer),
|
|
||||||
Layer.provide(Vcs.defaultLayer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(Database.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(FetchHttpClient.layer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
const TIMEOUT = 5000
|
const TIMEOUT = 5000
|
||||||
|
|
||||||
type HistoryEvent = {
|
type HistoryEvent = {
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,7 @@ export const layer = (overrides: Partial<Info> = {}) =>
|
||||||
}),
|
}),
|
||||||
).pipe(Layer.provide(emptyConfigLayer))
|
).pipe(Layer.provide(emptyConfigLayer))
|
||||||
|
|
||||||
export const defaultLayer = Service.defaultLayer.pipe(Layer.orDie)
|
export const node = LayerNode.make({ service: Service, layer: Service.defaultLayer.pipe(Layer.orDie), deps: [] })
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: defaultLayer, deps: [] })
|
|
||||||
|
|
||||||
export * as RuntimeFlags from "./runtime-flags"
|
export * as RuntimeFlags from "./runtime-flags"
|
||||||
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
|
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
|
||||||
|
|
|
||||||
4
packages/opencode/src/env/index.ts
vendored
4
packages/opencode/src/env/index.ts
vendored
|
|
@ -16,7 +16,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/En
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const state = yield* InstanceState.make<State>(Effect.fn("Env.state")(() => Effect.succeed({ ...process.env })))
|
const state = yield* InstanceState.make<State>(Effect.fn("Env.state")(() => Effect.succeed({ ...process.env })))
|
||||||
|
|
@ -36,8 +36,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [] })
|
||||||
|
|
||||||
export * as Env from "."
|
export * as Env from "."
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import { Context, Effect, Layer } from "effect"
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, EventV2.Interface>()("@opencode/EventV2Bridge") {}
|
export class Service extends Context.Service<Service, EventV2.Interface>()("@opencode/EventV2Bridge") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const events = yield* EventV2.Service
|
const events = yield* EventV2.Service
|
||||||
|
|
@ -66,8 +66,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(EventV2.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2.node] })
|
||||||
|
|
||||||
export * as EventV2Bridge from "./event-v2-bridge"
|
export * as EventV2Bridge from "./event-v2-bridge"
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Fo
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const config = yield* Config.Service
|
const config = yield* Config.Service
|
||||||
|
|
@ -194,12 +194,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(AppProcess.defaultLayer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -100,7 +100,7 @@ const kind = (code: string): Kind => {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Git") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Git") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const appProcess = yield* AppProcess.Service
|
const appProcess = yield* AppProcess.Service
|
||||||
|
|
@ -343,8 +343,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(AppProcess.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [AppProcess.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [AppProcess.node] })
|
||||||
|
|
||||||
export * as Git from "."
|
export * as Git from "."
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Image") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Image") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const config = yield* Config.Service
|
const config = yield* Config.Service
|
||||||
|
|
@ -167,8 +167,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(Config.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Config.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Config.node] })
|
||||||
|
|
||||||
export * as Image from "./image"
|
export * as Image from "./image"
|
||||||
|
|
|
||||||
|
|
@ -135,7 +135,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/LSP") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/LSP") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const config = yield* Config.Service
|
const config = yield* Config.Service
|
||||||
|
|
@ -496,12 +496,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export * as Diagnostic from "./diagnostic"
|
export * as Diagnostic from "./diagnostic"
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Mc
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const fs = yield* FSUtil.Service
|
const fs = yield* FSUtil.Service
|
||||||
|
|
@ -158,8 +158,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(EffectFlock.defaultLayer), Layer.provide(FSUtil.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node, EffectFlock.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node, EffectFlock.node] })
|
||||||
|
|
||||||
export * as McpAuth from "./auth"
|
export * as McpAuth from "./auth"
|
||||||
|
|
|
||||||
|
|
@ -194,7 +194,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/MC
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner
|
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner
|
||||||
|
|
@ -1003,16 +1003,6 @@ export const layer = Layer.effect(
|
||||||
|
|
||||||
export type AuthStatus = "authenticated" | "expired" | "not_authenticated"
|
export type AuthStatus = "authenticated" | "expired" | "not_authenticated"
|
||||||
|
|
||||||
// --- Per-service runtime ---
|
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(McpAuth.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(CrossSpawnSpawner.defaultLayer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -39,7 +39,7 @@ export function evaluate(permission: string, pattern: string, ...rulesets: Permi
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Permission") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Permission") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const events = yield* EventV2Bridge.Service
|
const events = yield* EventV2Bridge.Service
|
||||||
|
|
@ -213,8 +213,6 @@ export function disabled(tools: string[], ruleset: PermissionV1.Ruleset): Set<st
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(EventV2Bridge.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2Bridge.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2Bridge.node] })
|
||||||
|
|
||||||
export * as Permission from "."
|
export * as Permission from "."
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ async function applyPlugin(load: PluginLoader.Loaded, input: PluginInput, hooks:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const events = yield* EventV2Bridge.Service
|
const events = yield* EventV2Bridge.Service
|
||||||
|
|
@ -305,12 +305,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ import { Service } from "./bootstrap-service"
|
||||||
export { Service } from "./bootstrap-service"
|
export { Service } from "./bootstrap-service"
|
||||||
export type { Interface } from "./bootstrap-service"
|
export type { Interface } from "./bootstrap-service"
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
// Yield each bootstrap dep at layer init so `run` itself has R = never.
|
// Yield each bootstrap dep at layer init so `run` itself has R = never.
|
||||||
|
|
@ -49,19 +49,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer: Layer.Layer<Service> = layer.pipe(
|
|
||||||
Layer.provide([
|
|
||||||
Config.defaultLayer,
|
|
||||||
Format.defaultLayer,
|
|
||||||
LSP.defaultLayer,
|
|
||||||
Plugin.defaultLayer,
|
|
||||||
Project.defaultLayer,
|
|
||||||
ShareNext.defaultLayer,
|
|
||||||
Snapshot.defaultLayer,
|
|
||||||
Vcs.defaultLayer,
|
|
||||||
]),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = makeGlobalNode({
|
export const node = makeGlobalNode({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ interface Entry {
|
||||||
readonly deferred: Deferred.Deferred<InstanceContext>
|
readonly deferred: Deferred.Deferred<InstanceContext>
|
||||||
}
|
}
|
||||||
|
|
||||||
export const layer: Layer.Layer<Service, never, Project.Service | InstanceBootstrap.Service> = Layer.effect(
|
const layer: Layer.Layer<Service, never, Project.Service | InstanceBootstrap.Service> = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const project = yield* Project.Service
|
const project = yield* Project.Service
|
||||||
|
|
@ -202,8 +202,6 @@ export const layer: Layer.Layer<Service, never, Project.Service | InstanceBootst
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(Project.defaultLayer))
|
|
||||||
|
|
||||||
export const bootstrapNode = LayerNode.unbound(InstanceBootstrap.Service, Node.tags.values.global)
|
export const bootstrapNode = LayerNode.unbound(InstanceBootstrap.Service, Node.tags.values.global)
|
||||||
|
|
||||||
export const node = makeGlobalNode({
|
export const node = makeGlobalNode({
|
||||||
|
|
|
||||||
|
|
@ -103,7 +103,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Pr
|
||||||
|
|
||||||
type GitResult = { code: number; text: string; stderr: string }
|
type GitResult = { code: number; text: string; stderr: string }
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const fs = yield* FSUtil.Service
|
const fs = yield* FSUtil.Service
|
||||||
|
|
@ -463,17 +463,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(ProjectV2.defaultLayer),
|
|
||||||
Layer.provide(ProjectDirectories.defaultLayer),
|
|
||||||
Layer.provide(AppProcess.defaultLayer),
|
|
||||||
Layer.provide(CrossSpawnSpawner.defaultLayer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(Database.defaultLayer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
|
|
|
||||||
|
|
@ -295,7 +295,7 @@ interface State {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Vcs") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Vcs") {}
|
||||||
|
|
||||||
export const layer: Layer.Layer<Service, never, Git.Service | EventV2Bridge.Service> = Layer.effect(
|
const layer: Layer.Layer<Service, never, Git.Service | EventV2Bridge.Service> = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const git = yield* Git.Service
|
const git = yield* Git.Service
|
||||||
|
|
@ -418,8 +418,6 @@ export const layer: Layer.Layer<Service, never, Git.Service | EventV2Bridge.Serv
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(Git.defaultLayer), Layer.provide(EventV2Bridge.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Git.node, EventV2Bridge.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Git.node, EventV2Bridge.node] })
|
||||||
|
|
||||||
export * as Vcs from "./vcs"
|
export * as Vcs from "./vcs"
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Pr
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer: Layer.Layer<Service, never, Auth.Service | Plugin.Service> = Layer.effect(
|
const layer: Layer.Layer<Service, never, Auth.Service | Plugin.Service> = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const auth = yield* Auth.Service
|
const auth = yield* Auth.Service
|
||||||
|
|
@ -224,10 +224,6 @@ export const layer: Layer.Layer<Service, never, Auth.Service | Plugin.Service> =
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = Layer.suspend(() =>
|
|
||||||
layer.pipe(Layer.provide(Auth.defaultLayer), Layer.provide(Plugin.defaultLayer)),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Auth.node, Plugin.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [Auth.node, Plugin.node] })
|
||||||
|
|
||||||
export * as ProviderAuth from "./auth"
|
export * as ProviderAuth from "./auth"
|
||||||
|
|
|
||||||
|
|
@ -1299,7 +1299,7 @@ function modelSuggestions(provider: Info | undefined, modelID: ModelV2.ID, enabl
|
||||||
.map((item) => item.id)
|
.map((item) => item.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const fs = yield* FSUtil.Service
|
const fs = yield* FSUtil.Service
|
||||||
|
|
@ -1949,18 +1949,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = Layer.suspend(() =>
|
|
||||||
layer.pipe(
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(Env.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(Auth.defaultLayer),
|
|
||||||
Layer.provide(Plugin.defaultLayer),
|
|
||||||
Layer.provide(ModelsDev.defaultLayer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
const priority = ["gpt-5", "claude-sonnet-4", "big-pickle", "gemini-3-pro"]
|
const priority = ["gpt-5", "claude-sonnet-4", "big-pickle", "gemini-3-pro"]
|
||||||
const smallModelFamilyPriority = ["gemini-flash", "gpt-nano", "claude-haiku"]
|
const smallModelFamilyPriority = ["gemini-flash", "gpt-nano", "claude-haiku"]
|
||||||
export function sort<T extends { id: string }>(models: T[]) {
|
export function sort<T extends { id: string }>(models: T[]) {
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Question") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Question") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const events = yield* EventV2Bridge.Service
|
const events = yield* EventV2Bridge.Service
|
||||||
|
|
@ -156,8 +156,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(EventV2Bridge.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2Bridge.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2Bridge.node] })
|
||||||
|
|
||||||
export * as Question from "."
|
export * as Question from "."
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,6 @@ import { handlers } from "@opencode-ai/server/handlers"
|
||||||
import { locationServiceMapLayer } from "@opencode-ai/core/location-services"
|
import { locationServiceMapLayer } from "@opencode-ai/core/location-services"
|
||||||
import { layer as locationLayer } from "@opencode-ai/server/location"
|
import { layer as locationLayer } from "@opencode-ai/server/location"
|
||||||
import { sessionLocationLayer } from "@opencode-ai/server/middleware/session-location"
|
import { sessionLocationLayer } from "@opencode-ai/server/middleware/session-location"
|
||||||
import { PtyEnvironment } from "@opencode-ai/server/pty-environment"
|
|
||||||
import { schemaErrorLayer as v2SchemaErrorLayer } from "@opencode-ai/server/middleware/schema-error"
|
import { schemaErrorLayer as v2SchemaErrorLayer } from "@opencode-ai/server/middleware/schema-error"
|
||||||
import { workspaceHandlers } from "./handlers/workspace"
|
import { workspaceHandlers } from "./handlers/workspace"
|
||||||
import { instanceContextLayer } from "./middleware/instance-context"
|
import { instanceContextLayer } from "./middleware/instance-context"
|
||||||
|
|
@ -293,7 +292,6 @@ export function createRoutes(
|
||||||
|
|
||||||
Layer.provide(sessionLocationLayer),
|
Layer.provide(sessionLocationLayer),
|
||||||
Layer.provide(locationLayer),
|
Layer.provide(locationLayer),
|
||||||
Layer.provide(PtyEnvironment.layer),
|
|
||||||
Layer.provide(
|
Layer.provide(
|
||||||
SessionV2.defaultLayer.pipe(
|
SessionV2.defaultLayer.pipe(
|
||||||
Layer.provide(SessionExecutionLocal.defaultLayer),
|
Layer.provide(SessionExecutionLocal.defaultLayer),
|
||||||
|
|
|
||||||
|
|
@ -153,7 +153,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Se
|
||||||
|
|
||||||
export const use = serviceUse(Service)
|
export const use = serviceUse(Service)
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const config = yield* Config.Service
|
const config = yield* Config.Service
|
||||||
|
|
@ -544,19 +544,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = Layer.suspend(() =>
|
|
||||||
layer.pipe(
|
|
||||||
Layer.provide(Provider.defaultLayer),
|
|
||||||
Layer.provide(Session.defaultLayer),
|
|
||||||
Layer.provide(SessionProcessor.defaultLayer),
|
|
||||||
Layer.provide(Agent.defaultLayer),
|
|
||||||
Layer.provide(Plugin.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Instruction") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Instruction") {}
|
||||||
|
|
||||||
export const layer: Layer.Layer<
|
const layer: Layer.Layer<
|
||||||
Service,
|
Service,
|
||||||
never,
|
never,
|
||||||
FSUtil.Service | Config.Service | Global.Service | HttpClient.HttpClient | RuntimeFlags.Service
|
FSUtil.Service | Config.Service | Global.Service | HttpClient.HttpClient | RuntimeFlags.Service
|
||||||
|
|
@ -224,14 +224,6 @@ export const layer: Layer.Layer<
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(Global.layer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(FetchHttpClient.layer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export function loaded(messages: SessionV1.WithParts[]) {
|
export function loaded(messages: SessionV1.WithParts[]) {
|
||||||
return extract(messages)
|
return extract(messages)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { Context, Effect, Layer } from "effect"
|
||||||
import * as Stream from "effect/Stream"
|
import * as Stream from "effect/Stream"
|
||||||
import { streamText, wrapLanguageModel, type ModelMessage, type Tool } from "ai"
|
import { streamText, wrapLanguageModel, type ModelMessage, type Tool } from "ai"
|
||||||
import type { LLMEvent } from "@opencode-ai/llm"
|
import type { LLMEvent } from "@opencode-ai/llm"
|
||||||
import { LLMClient, RequestExecutor, WebSocketExecutor } from "@opencode-ai/llm/route"
|
import { LLMClient } from "@opencode-ai/llm/route"
|
||||||
import type { LLMClientService } from "@opencode-ai/llm/route"
|
import type { LLMClientService } from "@opencode-ai/llm/route"
|
||||||
import { GitLabWorkflowLanguageModel } from "gitlab-ai-provider"
|
import { GitLabWorkflowLanguageModel } from "gitlab-ai-provider"
|
||||||
import { ProviderTransform } from "@/provider/transform"
|
import { ProviderTransform } from "@/provider/transform"
|
||||||
|
|
@ -384,26 +384,11 @@ const live: Layer.Layer<
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const layer = live.pipe(Layer.provide(Permission.defaultLayer), Layer.provide(EventV2Bridge.defaultLayer))
|
|
||||||
|
|
||||||
export const defaultLayer = Layer.suspend(() =>
|
|
||||||
layer.pipe(
|
|
||||||
Layer.provide(Auth.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(Provider.defaultLayer),
|
|
||||||
Layer.provide(Plugin.defaultLayer),
|
|
||||||
Layer.provide(
|
|
||||||
LLMClient.layer.pipe(Layer.provide(Layer.mergeAll(RequestExecutor.defaultLayer, WebSocketExecutor.layer))),
|
|
||||||
),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const hasToolCalls = LLMRequestPrep.hasToolCalls
|
export const hasToolCalls = LLMRequestPrep.hasToolCalls
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: live,
|
||||||
deps: [
|
deps: [
|
||||||
Auth.node,
|
Auth.node,
|
||||||
Config.node,
|
Config.node,
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ type StreamEvent = LLMEvent
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionProcessor") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionProcessor") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const session = yield* Session.Service
|
const session = yield* Session.Service
|
||||||
|
|
@ -694,23 +694,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = Layer.suspend(() =>
|
|
||||||
layer.pipe(
|
|
||||||
Layer.provide(Session.defaultLayer),
|
|
||||||
Layer.provide(Snapshot.defaultLayer),
|
|
||||||
Layer.provide(Agent.defaultLayer),
|
|
||||||
Layer.provide(LLM.defaultLayer),
|
|
||||||
Layer.provide(Permission.defaultLayer),
|
|
||||||
Layer.provide(Plugin.defaultLayer),
|
|
||||||
Layer.provide(SessionSummary.defaultLayer),
|
|
||||||
Layer.provide(SessionStatus.defaultLayer),
|
|
||||||
Layer.provide(Image.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(Database.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -110,7 +110,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionPrompt") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionPrompt") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const status = yield* SessionStatus.Service
|
const status = yield* SessionStatus.Service
|
||||||
|
|
@ -1490,40 +1490,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = Layer.suspend(() =>
|
|
||||||
layer.pipe(
|
|
||||||
Layer.provide(SessionRunState.defaultLayer),
|
|
||||||
Layer.provide(SessionStatus.defaultLayer),
|
|
||||||
Layer.provide(SessionCompaction.defaultLayer),
|
|
||||||
Layer.provide(SessionProcessor.defaultLayer),
|
|
||||||
Layer.provide(Command.defaultLayer),
|
|
||||||
Layer.provide(Permission.defaultLayer),
|
|
||||||
Layer.provide(MCP.defaultLayer),
|
|
||||||
Layer.provide(LSP.defaultLayer),
|
|
||||||
Layer.provide(ToolRegistry.defaultLayer),
|
|
||||||
Layer.provide(Truncate.defaultLayer),
|
|
||||||
Layer.provide(Provider.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(Instruction.defaultLayer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(Plugin.defaultLayer),
|
|
||||||
Layer.provide(Session.defaultLayer),
|
|
||||||
Layer.provide(SessionRevert.defaultLayer),
|
|
||||||
Layer.provide(SessionSummary.defaultLayer),
|
|
||||||
Layer.provide(Image.defaultLayer),
|
|
||||||
Layer.provide(
|
|
||||||
Layer.mergeAll(
|
|
||||||
Agent.defaultLayer,
|
|
||||||
Database.defaultLayer,
|
|
||||||
SystemPrompt.defaultLayer,
|
|
||||||
LLM.defaultLayer,
|
|
||||||
CrossSpawnSpawner.defaultLayer,
|
|
||||||
RuntimeFlags.defaultLayer,
|
|
||||||
EventV2Bridge.defaultLayer,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
const ModelRef = Schema.Struct({
|
const ModelRef = Schema.Struct({
|
||||||
providerID: ProviderV2.ID,
|
providerID: ProviderV2.ID,
|
||||||
modelID: ModelV2.ID,
|
modelID: ModelV2.ID,
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionRevert") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionRevert") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const sessions = yield* Session.Service
|
const sessions = yield* Session.Service
|
||||||
|
|
@ -137,17 +137,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = Layer.suspend(() =>
|
|
||||||
layer.pipe(
|
|
||||||
Layer.provide(SessionRunState.defaultLayer),
|
|
||||||
Layer.provide(Session.defaultLayer),
|
|
||||||
Layer.provide(Snapshot.defaultLayer),
|
|
||||||
Layer.provide(Storage.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(SessionSummary.defaultLayer),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionRunState") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionRunState") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const background = yield* BackgroundJob.Service
|
const background = yield* BackgroundJob.Service
|
||||||
|
|
@ -108,11 +108,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(BackgroundJob.defaultLayer),
|
|
||||||
Layer.provide(SessionStatus.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
const cancelBackgroundJobs = Effect.fn("SessionRunState.cancelBackgroundJobs")(function* (
|
const cancelBackgroundJobs = Effect.fn("SessionRunState.cancelBackgroundJobs")(function* (
|
||||||
background: BackgroundJob.Interface,
|
background: BackgroundJob.Interface,
|
||||||
sessionID: SessionID,
|
sessionID: SessionID,
|
||||||
|
|
|
||||||
|
|
@ -488,7 +488,7 @@ export type Patch = Omit<Partial<Info>, "time" | "share" | "summary" | "revert"
|
||||||
permission?: Info["permission"] | null
|
permission?: Info["permission"] | null
|
||||||
}
|
}
|
||||||
|
|
||||||
export const layer: Layer.Layer<
|
const layer: Layer.Layer<
|
||||||
Service,
|
Service,
|
||||||
never,
|
never,
|
||||||
BackgroundJob.Service | RuntimeFlags.Service | Database.Service | EventV2Bridge.Service
|
BackgroundJob.Service | RuntimeFlags.Service | Database.Service | EventV2Bridge.Service
|
||||||
|
|
@ -940,19 +940,6 @@ export const layer: Layer.Layer<
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(BackgroundJob.defaultLayer),
|
|
||||||
Layer.provide(Database.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(
|
|
||||||
SessionV2.defaultLayer.pipe(
|
|
||||||
Layer.provide(SessionExecutionLocal.defaultLayer),
|
|
||||||
Layer.provide(locationServiceMapLayer),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
const cancelBackgroundJobs = Effect.fn("Session.cancelBackgroundJobs")(function* (
|
const cancelBackgroundJobs = Effect.fn("Session.cancelBackgroundJobs")(function* (
|
||||||
background: BackgroundJob.Interface,
|
background: BackgroundJob.Interface,
|
||||||
sessionID: SessionID,
|
sessionID: SessionID,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionStatus") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionStatus") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const events = yield* EventV2Bridge.Service
|
const events = yield* EventV2Bridge.Service
|
||||||
|
|
@ -51,8 +51,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(EventV2Bridge.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2Bridge.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2Bridge.node] })
|
||||||
|
|
||||||
export * as SessionStatus from "./status"
|
export * as SessionStatus from "./status"
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionSummary") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionSummary") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const sessions = yield* Session.Service
|
const sessions = yield* Session.Service
|
||||||
|
|
@ -145,15 +145,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = Layer.suspend(() =>
|
|
||||||
layer.pipe(
|
|
||||||
Layer.provide(Session.defaultLayer),
|
|
||||||
Layer.provide(Snapshot.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const DiffInput = Schema.Struct({
|
export const DiffInput = Schema.Struct({
|
||||||
sessionID: SessionID,
|
sessionID: SessionID,
|
||||||
messageID: Schema.optional(MessageID),
|
messageID: Schema.optional(MessageID),
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SystemPrompt") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SystemPrompt") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const skill = yield* Skill.Service
|
const skill = yield* Skill.Service
|
||||||
|
|
@ -128,12 +128,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(Skill.defaultLayer),
|
|
||||||
Layer.provide(MCP.defaultLayer),
|
|
||||||
Layer.provide(locationServiceMapLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
const locationServiceMapNode = LayerNode.make({
|
const locationServiceMapNode = LayerNode.make({
|
||||||
service: LocationServiceMap.Service,
|
service: LocationServiceMap.Service,
|
||||||
layer: locationServiceMapLayer,
|
layer: locationServiceMapLayer,
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionTodo") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionTodo") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const events = yield* EventV2Bridge.Service
|
const events = yield* EventV2Bridge.Service
|
||||||
|
|
@ -69,8 +69,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(EventV2Bridge.defaultLayer), Layer.provide(Database.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2Bridge.node, Database.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [EventV2Bridge.node, Database.node] })
|
||||||
|
|
||||||
export * as Todo from "./todo"
|
export * as Todo from "./todo"
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionShare") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SessionShare") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const cfg = yield* Config.Service
|
const cfg = yield* Config.Service
|
||||||
|
|
@ -49,13 +49,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(ShareNext.defaultLayer),
|
|
||||||
Layer.provide(Session.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -109,7 +109,7 @@ function key(item: Data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const account = yield* Account.Service
|
const account = yield* Account.Service
|
||||||
|
|
@ -362,16 +362,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(Account.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(Database.defaultLayer),
|
|
||||||
Layer.provide(FetchHttpClient.layer),
|
|
||||||
Layer.provide(Provider.defaultLayer),
|
|
||||||
Layer.provide(Session.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/SkillDiscovery") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/SkillDiscovery") {}
|
||||||
|
|
||||||
export const layer: Layer.Layer<Service, never, FSUtil.Service | Path.Path | HttpClient.HttpClient> = Layer.effect(
|
const layer: Layer.Layer<Service, never, FSUtil.Service | Path.Path | HttpClient.HttpClient> = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const fs = yield* FSUtil.Service
|
const fs = yield* FSUtil.Service
|
||||||
|
|
@ -135,12 +135,6 @@ export const layer: Layer.Layer<Service, never, FSUtil.Service | Path.Path | Htt
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer: Layer.Layer<Service> = layer.pipe(
|
|
||||||
Layer.provide(FetchHttpClient.layer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(NodePath.layer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node, path, httpClient] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node, path, httpClient] })
|
||||||
|
|
||||||
export * as Discovery from "./discovery"
|
export * as Discovery from "./discovery"
|
||||||
|
|
|
||||||
|
|
@ -247,7 +247,7 @@ const loadSkills = Effect.fnUntraced(function* (
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Skill") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Skill") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const discovery = yield* Discovery.Service
|
const discovery = yield* Discovery.Service
|
||||||
|
|
@ -318,15 +318,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(Discovery.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(Global.layer),
|
|
||||||
Layer.provide(RuntimeFlags.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export function fmt(list: Info[], opts: { verbose: boolean }) {
|
export function fmt(list: Info[], opts: { verbose: boolean }) {
|
||||||
const described = list.filter((skill) => skill.description !== undefined)
|
const described = list.filter((skill) => skill.description !== undefined)
|
||||||
if (described.length === 0) return "No skills are currently available."
|
if (described.length === 0) return "No skills are currently available."
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Snapshot") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Snapshot") {}
|
||||||
|
|
||||||
export const layer: Layer.Layer<Service, never, FSUtil.Service | AppProcess.Service | Config.Service> = Layer.effect(
|
const layer: Layer.Layer<Service, never, FSUtil.Service | AppProcess.Service | Config.Service> = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const fs = yield* FSUtil.Service
|
const fs = yield* FSUtil.Service
|
||||||
|
|
@ -798,12 +798,6 @@ export const layer: Layer.Layer<Service, never, FSUtil.Service | AppProcess.Serv
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(
|
|
||||||
Layer.provide(AppProcess.defaultLayer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
|
|
@ -210,7 +210,7 @@ const MIGRATIONS: Migration[] = [
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const fs = yield* FSUtil.Service
|
const fs = yield* FSUtil.Service
|
||||||
|
|
@ -322,8 +322,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(FSUtil.defaultLayer), Layer.provide(Git.defaultLayer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node, Git.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node, Git.node] })
|
||||||
|
|
||||||
export * as Storage from "./storage"
|
export * as Storage from "./storage"
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ import { Glob } from "@opencode-ai/core/util/glob"
|
||||||
import path from "path"
|
import path from "path"
|
||||||
import { pathToFileURL } from "url"
|
import { pathToFileURL } from "url"
|
||||||
import { Effect, Layer, Context } from "effect"
|
import { Effect, Layer, Context } from "effect"
|
||||||
import { FetchHttpClient, HttpClient } from "effect/unstable/http"
|
|
||||||
import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner"
|
import { ChildProcessSpawner } from "effect/unstable/process/ChildProcessSpawner"
|
||||||
import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
|
import { CrossSpawnSpawner } from "@opencode-ai/core/cross-spawn-spawner"
|
||||||
import { Format } from "../format"
|
import { Format } from "../format"
|
||||||
|
|
@ -80,7 +79,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/ToolRegistry") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/ToolRegistry") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const config = yield* Config.Service
|
const config = yield* Config.Service
|
||||||
|
|
@ -315,30 +314,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = Layer.suspend(() =>
|
|
||||||
layer
|
|
||||||
.pipe(
|
|
||||||
Layer.provide(Config.defaultLayer),
|
|
||||||
Layer.provide(Plugin.defaultLayer),
|
|
||||||
Layer.provide(Question.defaultLayer),
|
|
||||||
Layer.provide(Todo.defaultLayer),
|
|
||||||
Layer.provide(Skill.defaultLayer),
|
|
||||||
Layer.provide(Agent.defaultLayer),
|
|
||||||
Layer.provide(Session.defaultLayer),
|
|
||||||
Layer.provide(BackgroundJob.defaultLayer),
|
|
||||||
Layer.provide(Provider.defaultLayer),
|
|
||||||
Layer.provide(LSP.defaultLayer),
|
|
||||||
Layer.provide(Instruction.defaultLayer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(EventV2Bridge.defaultLayer),
|
|
||||||
Layer.provide(FetchHttpClient.layer),
|
|
||||||
Layer.provide(Format.defaultLayer),
|
|
||||||
Layer.provide(CrossSpawnSpawner.defaultLayer),
|
|
||||||
Layer.provide(Truncate.defaultLayer),
|
|
||||||
)
|
|
||||||
.pipe(Layer.provide(Database.defaultLayer), Layer.provide(RuntimeFlags.defaultLayer)),
|
|
||||||
)
|
|
||||||
|
|
||||||
function isZodType(value: unknown): value is z.ZodType {
|
function isZodType(value: unknown): value is z.ZodType {
|
||||||
return typeof value === "object" && value !== null && "_zod" in value
|
return typeof value === "object" && value !== null && "_zod" in value
|
||||||
}
|
}
|
||||||
|
|
@ -417,7 +392,7 @@ function isJsonSchemaObject(value: unknown): value is Record<string, unknown> {
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer.pipe(Layer.provide(Ripgrep.defaultLayer)),
|
layer,
|
||||||
deps: [
|
deps: [
|
||||||
Config.node,
|
Config.node,
|
||||||
Plugin.node,
|
Plugin.node,
|
||||||
|
|
@ -438,6 +413,7 @@ export const node = LayerNode.make({
|
||||||
Truncate.node,
|
Truncate.node,
|
||||||
RuntimeFlags.node,
|
RuntimeFlags.node,
|
||||||
Database.node,
|
Database.node,
|
||||||
|
Ripgrep.node,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ export interface Interface {
|
||||||
|
|
||||||
export class Service extends Context.Service<Service, Interface>()("@opencode/Truncate") {}
|
export class Service extends Context.Service<Service, Interface>()("@opencode/Truncate") {}
|
||||||
|
|
||||||
export const layer = Layer.effect(
|
const layer = Layer.effect(
|
||||||
Service,
|
Service,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
const fs = yield* FSUtil.Service
|
const fs = yield* FSUtil.Service
|
||||||
|
|
@ -151,8 +151,6 @@ export const layer = Layer.effect(
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(FSUtil.defaultLayer), Layer.provide(NodePath.layer))
|
|
||||||
|
|
||||||
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node] })
|
export const node = LayerNode.make({ service: Service, layer: layer, deps: [FSUtil.node] })
|
||||||
|
|
||||||
export * as Truncate from "./truncate"
|
export * as Truncate from "./truncate"
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
|
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
|
||||||
import { path } from "@opencode-ai/core/effect/app-node-platform"
|
import { path } from "@opencode-ai/core/effect/app-node-platform"
|
||||||
import { Global } from "@opencode-ai/core/global"
|
import { Global } from "@opencode-ai/core/global"
|
||||||
import { InstanceBootstrap } from "@/project/bootstrap"
|
|
||||||
import { InstanceStore } from "@/project/instance-store"
|
import { InstanceStore } from "@/project/instance-store"
|
||||||
import { Project } from "@/project/project"
|
import { Project } from "@/project/project"
|
||||||
import { Database } from "@opencode-ai/core/database/database"
|
import { Database } from "@opencode-ai/core/database/database"
|
||||||
|
|
@ -14,7 +13,6 @@ import { GlobalBus } from "@/bus/global"
|
||||||
import { Git } from "@/git"
|
import { Git } from "@/git"
|
||||||
import { Effect, Layer, Path, Schema, Scope, Context } from "effect"
|
import { Effect, Layer, Path, Schema, Scope, Context } from "effect"
|
||||||
import { ChildProcess } from "effect/unstable/process"
|
import { ChildProcess } from "effect/unstable/process"
|
||||||
import { NodePath } from "@effect/platform-node"
|
|
||||||
import { FSUtil } from "@opencode-ai/core/fs-util"
|
import { FSUtil } from "@opencode-ai/core/fs-util"
|
||||||
import { AppProcess } from "@opencode-ai/core/process"
|
import { AppProcess } from "@opencode-ai/core/process"
|
||||||
import { InstanceState } from "@/effect/instance-state"
|
import { InstanceState } from "@/effect/instance-state"
|
||||||
|
|
@ -131,7 +129,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Wo
|
||||||
|
|
||||||
type GitResult = { code: number; text: string; stderr: string }
|
type GitResult = { code: number; text: string; stderr: string }
|
||||||
|
|
||||||
export const layer: Layer.Layer<
|
const layer: Layer.Layer<
|
||||||
Service,
|
Service,
|
||||||
never,
|
never,
|
||||||
| FSUtil.Service
|
| FSUtil.Service
|
||||||
|
|
@ -616,19 +614,6 @@ export const layer: Layer.Layer<
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const appLayer = layer.pipe(
|
|
||||||
Layer.provide(Git.defaultLayer),
|
|
||||||
Layer.provide(AppProcess.defaultLayer),
|
|
||||||
Layer.provide(Project.defaultLayer),
|
|
||||||
Layer.provide(Database.defaultLayer),
|
|
||||||
Layer.provide(FSUtil.defaultLayer),
|
|
||||||
Layer.provide(NodePath.layer),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const defaultLayer = appLayer.pipe(
|
|
||||||
Layer.provide(LayerNode.compile(InstanceStore.node, [[InstanceStore.bootstrapNode, InstanceBootstrap.node]])),
|
|
||||||
)
|
|
||||||
|
|
||||||
export const node = LayerNode.make({
|
export const node = LayerNode.make({
|
||||||
service: Service,
|
service: Service,
|
||||||
layer: layer,
|
layer: layer,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue