refactor: remove remaining default layer aliases (#34660)
This commit is contained in:
@@ -25,7 +25,7 @@ const Handlers = Runtime.handlers(Commands, {
|
|||||||
})
|
})
|
||||||
|
|
||||||
Runtime.run(Commands, Handlers, { version: "local" }).pipe(
|
Runtime.run(Commands, Handlers, { version: "local" }).pipe(
|
||||||
Effect.provide(Daemon.defaultLayer),
|
Effect.provide(Daemon.layer),
|
||||||
Effect.provide(NodeServices.layer),
|
Effect.provide(NodeServices.layer),
|
||||||
Effect.scoped,
|
Effect.scoped,
|
||||||
NodeRuntime.runMain,
|
NodeRuntime.runMain,
|
||||||
|
|||||||
@@ -189,6 +189,4 @@ export const layer = Layer.effect(
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer
|
|
||||||
|
|
||||||
export * as Daemon from "./daemon"
|
export * as Daemon from "./daemon"
|
||||||
|
|||||||
@@ -238,7 +238,7 @@ const inspectFakeProvider = Effect.gen(function* () {
|
|||||||
// Provide the LLM runtime and the HTTP request executor once. Keep one path
|
// Provide the LLM runtime and the HTTP request executor once. Keep one path
|
||||||
// enabled at a time so the tutorial can demonstrate generate, prepare, stream,
|
// enabled at a time so the tutorial can demonstrate generate, prepare, stream,
|
||||||
// or tool-loop behavior without spending tokens on every example.
|
// or tool-loop behavior without spending tokens on every example.
|
||||||
const requestExecutorLayer = RequestExecutor.defaultLayer
|
const requestExecutorLayer = RequestExecutor.fetchLayer
|
||||||
const llmDeps = Layer.mergeAll(requestExecutorLayer, WebSocketExecutor.layer)
|
const llmDeps = Layer.mergeAll(requestExecutorLayer, WebSocketExecutor.layer)
|
||||||
const llmClientLayer = LLMClient.layer.pipe(Layer.provide(llmDeps))
|
const llmClientLayer = LLMClient.layer.pipe(Layer.provide(llmDeps))
|
||||||
|
|
||||||
|
|||||||
@@ -380,6 +380,6 @@ export const layer: Layer.Layer<Service, never, HttpClient.HttpClient> = Layer.e
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
export const defaultLayer = layer.pipe(Layer.provide(FetchHttpClient.layer))
|
export const fetchLayer = layer.pipe(Layer.provide(FetchHttpClient.layer))
|
||||||
|
|
||||||
export * as RequestExecutor from "./executor"
|
export * as RequestExecutor from "./executor"
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ export type Info = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export class Config extends Context.Service<Config, Info>()("@opencode/ServerAuthConfig") {
|
export class Config extends Context.Service<Config, Info>()("@opencode/ServerAuthConfig") {
|
||||||
static layer(input: Info) {
|
static configLayer(input: Info) {
|
||||||
return Layer.succeed(this, this.of(input))
|
return Layer.succeed(this, this.of(input))
|
||||||
}
|
}
|
||||||
|
|
||||||
static get defaultLayer() {
|
static get layer() {
|
||||||
return Layer.effect(
|
return Layer.effect(
|
||||||
this,
|
this,
|
||||||
Effect.gen(function* () {
|
Effect.gen(function* () {
|
||||||
|
|||||||
@@ -39,13 +39,13 @@ const applicationServices = LayerNode.group([
|
|||||||
export function createRoutes(password?: string) {
|
export function createRoutes(password?: string) {
|
||||||
return makeRoutes(
|
return makeRoutes(
|
||||||
password
|
password
|
||||||
? ServerAuth.Config.layer({ username: "opencode", password: Option.some(password) })
|
? ServerAuth.Config.configLayer({ username: "opencode", password: Option.some(password) })
|
||||||
: ServerAuth.Config.defaultLayer,
|
: ServerAuth.Config.layer,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createEmbeddedRoutes() {
|
export function createEmbeddedRoutes() {
|
||||||
return makeRoutes(ServerAuth.Config.layer({ username: "opencode", password: Option.none() }))
|
return makeRoutes(ServerAuth.Config.configLayer({ username: "opencode", password: Option.none() }))
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeRoutes<AuthError, AuthServices>(auth: Layer.Layer<ServerAuth.Config, AuthError, AuthServices>) {
|
function makeRoutes<AuthError, AuthServices>(auth: Layer.Layer<ServerAuth.Config, AuthError, AuthServices>) {
|
||||||
|
|||||||
Reference in New Issue
Block a user