feat(server): add loaded locations debug endpoint

This commit is contained in:
Dax Raad 2026-07-05 15:58:43 -04:00
commit a75978815a
13 changed files with 118 additions and 1 deletions

View file

@ -13,6 +13,7 @@ import { EventHandler } from "./handlers/event"
import { AgentHandler } from "./handlers/agent"
import { PluginHandler } from "./handlers/plugin"
import { HealthHandler } from "./handlers/health"
import { DebugHandler } from "./handlers/debug"
import { PtyHandler } from "./handlers/pty"
import { ShellHandler } from "./handlers/shell"
import { QuestionHandler } from "./handlers/question"
@ -27,6 +28,7 @@ import { VcsHandler } from "./handlers/vcs"
export const handlers = Layer.mergeAll(
HealthHandler,
DebugHandler,
LocationHandler,
AgentHandler,
PluginHandler,

View file

@ -0,0 +1,14 @@
import { LocationServiceMap } from "@opencode-ai/core/location-service-map"
import { Effect, Option, RcMap } from "effect"
import { HttpApiBuilder } from "effect/unstable/httpapi"
import { Api } from "../api"
export const DebugHandler = HttpApiBuilder.group(Api, "server.debug", (handlers) =>
handlers.handle(
"debug.location",
Effect.fn(function* () {
const locations = Option.getOrThrow(yield* Effect.serviceOption(LocationServiceMap.Service))
return Array.from(yield* RcMap.keys(locations.rcMap))
}),
),
)

View file

@ -83,7 +83,7 @@ function makeRoutes<AuthError, AuthServices>(
: AppNodeBuilder.build(applicationServices, replacements)
return HttpApiBuilder.layer(Api, { openapiPath: "/openapi.json" }).pipe(
Layer.provide(handlers),
Layer.provide(handlers.pipe(Layer.provide(serviceLayer))),
Layer.provide(formLocationLayer),
Layer.provide(sessionLocationLayer),
Layer.provide(layer),