feat(server): add loaded locations debug endpoint
This commit is contained in:
@@ -16,6 +16,7 @@ import type { Definition } from "@opencode-ai/schema/event"
|
||||
import { AgentGroup } from "./groups/agent.js"
|
||||
import { PluginGroup } from "./groups/plugin.js"
|
||||
import { HealthGroup } from "./groups/health.js"
|
||||
import { DebugGroup } from "./groups/debug.js"
|
||||
import { PtyGroup } from "./groups/pty.js"
|
||||
import { ShellGroup } from "./groups/shell.js"
|
||||
import { makeQuestionGroup } from "./groups/question.js"
|
||||
@@ -81,6 +82,7 @@ type ApiGroups<
|
||||
Event extends HttpApiGroup.Any,
|
||||
> =
|
||||
| typeof HealthGroup
|
||||
| typeof DebugGroup
|
||||
| LocationGroups<LocationId>
|
||||
| FormGroups<LocationId, LocationService, FormLocationId, FormLocationService>
|
||||
| SessionGroups<SessionLocationId, SessionLocationService>
|
||||
@@ -165,6 +167,7 @@ const makeApiFromGroup = <
|
||||
.add(ReferenceGroup.middleware(locationMiddleware))
|
||||
.add(ProjectCopyGroup.middleware(locationMiddleware))
|
||||
.add(VcsGroup.middleware(locationMiddleware))
|
||||
.add(DebugGroup)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
title: "opencode HttpApi",
|
||||
|
||||
@@ -34,6 +34,7 @@ export const ClientApi: ClientApiShape = makeDefaultApi({
|
||||
|
||||
export const groupNames = {
|
||||
"server.health": "health",
|
||||
"server.debug": "debug",
|
||||
"server.location": "location",
|
||||
"server.agent": "agent",
|
||||
"server.plugin": "plugin",
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import { Location } from "@opencode-ai/schema/location"
|
||||
import { Schema } from "effect"
|
||||
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
|
||||
|
||||
export const DebugGroup = HttpApiGroup.make("server.debug").add(
|
||||
HttpApiEndpoint.get("debug.location", "/api/debug/location", {
|
||||
success: Schema.Array(Location.Ref),
|
||||
}).annotateMerge(
|
||||
OpenApi.annotations({
|
||||
identifier: "v2.debug.location",
|
||||
summary: "List loaded locations",
|
||||
description: "List locations currently loaded by the server.",
|
||||
}),
|
||||
),
|
||||
)
|
||||
Reference in New Issue
Block a user