Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions packages/opencode/src/account/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Ac

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,
Effect.gen(function* () {
const repo = yield* AccountRepo.Service
Expand Down Expand Up @@ -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 * as Account from "./account"
4 changes: 1 addition & 3 deletions packages/opencode/src/account/repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Ac

export const use = serviceUse(Service)

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const { db } = yield* Database.Service
Expand Down Expand Up @@ -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 * as AccountRepo from "./repo"
10 changes: 1 addition & 9 deletions packages/opencode/src/acp/directory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export const loaderLayer = Layer.effect(
}),
)

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const loader = yield* Loader
Expand Down Expand Up @@ -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({
service: Loader,
layer: loaderLayer,
Expand Down
4 changes: 1 addition & 3 deletions packages/opencode/src/acp/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/AC

type State = Map<string, Info>

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const sessions = yield* Ref.make<State>(new Map())
Expand Down Expand Up @@ -201,8 +201,6 @@ export const layer = Layer.effect(
}),
)

export const defaultLayer = layer

export const node = LayerNode.make({ service: Service, layer, deps: [] })

function makeSession(input: StoreInput): Info {
Expand Down
8 changes: 1 addition & 7 deletions packages/opencode/src/acp/usage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export const contextLimitLoaderLayer = Layer.effect(
}),
)

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const messageLoader = yield* MessageLoader
Expand Down Expand Up @@ -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 contextLimitLoaderNode = makeGlobalNode({
Expand Down
11 changes: 1 addition & 10 deletions packages/opencode/src/agent/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Ag

export const use = serviceUse(Service)

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const config = yield* Config.Service
Expand Down Expand Up @@ -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({
service: LocationServiceMap.Service,
layer: locationServiceMapLayer,
Expand Down
4 changes: 1 addition & 3 deletions packages/opencode/src/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export interface Interface {

export class Service extends Context.Service<Service, Interface>()("@opencode/Auth") {}

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const fsys = yield* FSUtil.Service
Expand Down Expand Up @@ -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 * as Auth from "."
4 changes: 1 addition & 3 deletions packages/opencode/src/background/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export {
} from "@opencode-ai/core/background-job"

/** Keeps the legacy service instance-scoped while sharing the core registry engine. */
export const layer = Layer.effect(
const layer = Layer.effect(
CoreBackgroundJob.Service,
Effect.gen(function* () {
const state = yield* InstanceState.make(() => CoreBackgroundJob.make)
Expand All @@ -32,8 +32,6 @@ export const layer = Layer.effect(
}),
)

export const defaultLayer = layer

export const node = LayerNode.make({ service: CoreBackgroundJob.Service, layer, deps: [] })

export * as BackgroundJob from "./job"
8 changes: 1 addition & 7 deletions packages/opencode/src/command/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface Interface {

export class Service extends Context.Service<Service, Interface>()("@opencode/Command") {}

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const config = yield* Config.Service
Expand Down Expand Up @@ -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 * as Command from "."
12 changes: 1 addition & 11 deletions packages/opencode/src/config/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ function writableGlobal(info: Info) {
return next
}

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const fs = yield* FSUtil.Service
Expand Down Expand Up @@ -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({
service: Service,
layer: layer,
Expand Down
15 changes: 1 addition & 14 deletions packages/opencode/src/control-plane/workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Wo

export const use = serviceUse(Service)

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const auth = yield* Auth.Service
Expand Down Expand Up @@ -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

type HistoryEvent = {
Expand Down
4 changes: 1 addition & 3 deletions packages/opencode/src/effect/runtime-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ export const layer = (overrides: Partial<Info> = {}) =>
}),
).pipe(Layer.provide(emptyConfigLayer))

export const defaultLayer = Service.defaultLayer.pipe(Layer.orDie)

export const node = LayerNode.make({ service: Service, layer: defaultLayer, deps: [] })
export const node = LayerNode.make({ service: Service, layer: Service.defaultLayer.pipe(Layer.orDie), deps: [] })

export * as RuntimeFlags from "./runtime-flags"
import { LayerNode } from "@opencode-ai/core/effect/layer-node"
4 changes: 1 addition & 3 deletions packages/opencode/src/env/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/En

export const use = serviceUse(Service)

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const state = yield* InstanceState.make<State>(Effect.fn("Env.state")(() => Effect.succeed({ ...process.env })))
Expand All @@ -36,8 +36,6 @@ export const layer = Layer.effect(
}),
)

export const defaultLayer = layer

export const node = LayerNode.make({ service: Service, layer: layer, deps: [] })

export * as Env from "."
4 changes: 1 addition & 3 deletions packages/opencode/src/event-v2-bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { Context, Effect, Layer } from "effect"

export class Service extends Context.Service<Service, EventV2.Interface>()("@opencode/EventV2Bridge") {}

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const events = yield* EventV2.Service
Expand Down Expand Up @@ -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 * as EventV2Bridge from "./event-v2-bridge"
8 changes: 1 addition & 7 deletions packages/opencode/src/format/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Fo

export const use = serviceUse(Service)

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const config = yield* Config.Service
Expand Down Expand Up @@ -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({
service: Service,
layer: layer,
Expand Down
4 changes: 1 addition & 3 deletions packages/opencode/src/git/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ const kind = (code: string): Kind => {

export class Service extends Context.Service<Service, Interface>()("@opencode/Git") {}

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const appProcess = yield* AppProcess.Service
Expand Down Expand Up @@ -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 * as Git from "."
4 changes: 1 addition & 3 deletions packages/opencode/src/image/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export interface Interface {

export class Service extends Context.Service<Service, Interface>()("@opencode/Image") {}

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const config = yield* Config.Service
Expand Down Expand Up @@ -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 * as Image from "./image"
8 changes: 1 addition & 7 deletions packages/opencode/src/lsp/lsp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ export interface Interface {

export class Service extends Context.Service<Service, Interface>()("@opencode/LSP") {}

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const config = yield* Config.Service
Expand Down Expand Up @@ -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 const node = LayerNode.make({
Expand Down
4 changes: 1 addition & 3 deletions packages/opencode/src/mcp/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export class Service extends Context.Service<Service, Interface>()("@opencode/Mc

export const use = serviceUse(Service)

export const layer = Layer.effect(
const layer = Layer.effect(
Service,
Effect.gen(function* () {
const fs = yield* FSUtil.Service
Expand Down Expand Up @@ -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 * as McpAuth from "./auth"
Loading
Loading