feat(server): add loaded locations debug endpoint
This commit is contained in:
parent
c3d26c4912
commit
a75978815a
13 changed files with 118 additions and 1 deletions
|
|
@ -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,
|
||||
|
|
|
|||
14
packages/server/src/handlers/debug.ts
Normal file
14
packages/server/src/handlers/debug.ts
Normal 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))
|
||||
}),
|
||||
),
|
||||
)
|
||||
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue