Skip to content

Commit dc6d395

Browse files
committed
address feedback
1 parent e287569 commit dc6d395

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

packages/opencode/src/effect/app-runtime.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,20 @@ import * as Effect from "effect/Effect"
5151

5252
// Adjusts the default Config layer to ensure that plugins are always initialised before
5353
// any other layers read the current config
54-
const ConfigWithPluginPriority = Layer.unwrap(
54+
const ConfigWithPluginPriority = Layer.effect(
55+
Config.Service,
5556
Effect.gen(function* () {
56-
const configSvc = yield* Config.Service
57-
const pluginSvc = yield* Plugin.Service
57+
const config = yield* Config.Service
58+
const plugin = yield* Plugin.Service
5859

59-
return Layer.succeed(Config.Service, {
60-
...configSvc,
61-
get: () => Effect.andThen(pluginSvc.init(), configSvc.get),
62-
getGlobal: () => Effect.andThen(pluginSvc.init(), configSvc.getGlobal),
63-
getConsoleState: () => Effect.andThen(pluginSvc.init(), configSvc.getConsoleState),
64-
})
60+
return {
61+
...config,
62+
get: () => Effect.andThen(plugin.init(), config.get),
63+
getGlobal: () => Effect.andThen(plugin.init(), config.getGlobal),
64+
getConsoleState: () => Effect.andThen(plugin.init(), config.getConsoleState),
65+
}
6566
}),
66-
).pipe(Layer.provideMerge(Layer.merge(Plugin.defaultLayer, Config.defaultLayer)))
67+
).pipe(Layer.provide(Layer.merge(Plugin.defaultLayer, Config.defaultLayer)))
6768

6869
export const AppLayer = Layer.mergeAll(
6970
Npm.defaultLayer,

0 commit comments

Comments
 (0)