feat(api): publish v2 reference

This commit is contained in:
Dax Raad 2026-07-06 01:29:08 -04:00
commit eed23d8ee9
40 changed files with 26473 additions and 147 deletions

View file

@ -4,17 +4,19 @@ import { Schema } from "effect"
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
import { LocationQuery, locationQueryOpenApi } from "./location.js"
export const AgentGroup = HttpApiGroup.make("server.agent").add(
HttpApiEndpoint.get("agent.list", "/api/agent", {
query: LocationQuery,
success: Location.response(Schema.Array(Agent.Info)),
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.agent.list",
summary: "List agents",
description: "Retrieve currently registered agents.",
}),
),
)
export const AgentGroup = HttpApiGroup.make("server.agent")
.add(
HttpApiEndpoint.get("agent.list", "/api/agent", {
query: LocationQuery,
success: Location.response(Schema.Array(Agent.Info)),
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.agent.list",
summary: "List agents",
description: "Retrieve currently registered agents.",
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "agent" }))

View file

@ -21,7 +21,7 @@ export const CommandGroup = HttpApiGroup.make("server.command")
)
.annotateMerge(
OpenApi.annotations({
title: "commands",
title: "command",
description: "Experimental command routes.",
}),
)

View file

@ -20,6 +20,7 @@ export const CredentialGroup = HttpApiGroup.make("server.credential")
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "credential" }))
.add(
HttpApiEndpoint.delete("credential.remove", "/api/credential/:credentialID", {
params: { credentialID: Credential.ID },

View file

@ -2,14 +2,16 @@ 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.",
}),
),
)
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.",
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "debug" }))

View file

@ -55,7 +55,7 @@ const make = <const Definitions extends ReadonlyArray<Definition>>(definitions:
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "events", description: "Experimental event stream routes." })),
.annotateMerge(OpenApi.annotations({ title: "event", description: "Experimental event stream routes." })),
}
}

View file

@ -144,4 +144,4 @@ export const makeFormGroup = <
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "forms", description: "Session form routes." }))
.annotateMerge(OpenApi.annotations({ title: "form", description: "Session form routes." }))

View file

@ -1,14 +1,16 @@
import { Schema } from "effect"
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
export const HealthGroup = HttpApiGroup.make("server.health").add(
HttpApiEndpoint.get("health.get", "/api/health", {
success: Schema.Struct({ healthy: Schema.Literal(true) }),
}).annotateMerge(
OpenApi.annotations({
identifier: "v2.health.get",
summary: "Check server health",
description: "Check whether the API server is ready to accept requests.",
}),
),
)
export const HealthGroup = HttpApiGroup.make("server.health")
.add(
HttpApiEndpoint.get("health.get", "/api/health", {
success: Schema.Struct({ healthy: Schema.Literal(true) }),
}).annotateMerge(
OpenApi.annotations({
identifier: "v2.health.get",
summary: "Check server health",
description: "Check whether the API server is ready to accept requests.",
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "health" }))

View file

@ -126,5 +126,5 @@ export const IntegrationGroup = HttpApiGroup.make("server.integration")
),
)
.annotateMerge(
OpenApi.annotations({ title: "integrations", description: "Integration discovery and authentication routes." }),
OpenApi.annotations({ title: "integration", description: "Integration discovery and authentication routes." }),
)

View file

@ -26,17 +26,19 @@ export const locationQueryOpenApi = OpenApi.annotations({
},
})
export const LocationGroup = HttpApiGroup.make("server.location").add(
HttpApiEndpoint.get("location.get", "/api/location", {
query: LocationQuery,
success: Location.Info,
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.location.get",
summary: "Get location",
description: "Resolve the requested location or the server default location.",
}),
),
)
export const LocationGroup = HttpApiGroup.make("server.location")
.add(
HttpApiEndpoint.get("location.get", "/api/location", {
query: LocationQuery,
success: Location.Info,
})
.annotateMerge(locationQueryOpenApi)
.annotateMerge(
OpenApi.annotations({
identifier: "v2.location.get",
summary: "Get location",
description: "Resolve the requested location or the server default location.",
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "location" }))

View file

@ -51,7 +51,7 @@ export const MessageGroup = HttpApiGroup.make("server.message")
)
.annotateMerge(
OpenApi.annotations({
title: "messages",
title: "session",
description: "Experimental message routes.",
}),
)

View file

@ -38,7 +38,7 @@ export const ModelGroup = HttpApiGroup.make("server.model")
)
.annotateMerge(
OpenApi.annotations({
title: "models",
title: "model",
description: "Experimental model routes.",
}),
)

View file

@ -134,4 +134,4 @@ export const makePermissionGroup = <
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "permissions", description: "Experimental permission routes." }))
.annotateMerge(OpenApi.annotations({ title: "permission", description: "Experimental permission routes." }))

View file

@ -21,7 +21,7 @@ export const PluginGroup = HttpApiGroup.make("server.plugin")
)
.annotateMerge(
OpenApi.annotations({
title: "plugins",
title: "plugin",
description: "Experimental plugin routes.",
}),
)

View file

@ -1,10 +1,22 @@
import { Project } from "@opencode-ai/schema/project"
import { Schema } from "effect"
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
import { LocationQuery, locationQueryOpenApi } from "./location.js"
const root = "/api/project"
export const ProjectGroup = HttpApiGroup.make("server.project")
.add(
HttpApiEndpoint.get("project.list", root, {
success: Schema.Array(Project.Info),
}).annotateMerge(
OpenApi.annotations({
identifier: "v2.project.list",
summary: "List projects",
description: "List known projects.",
}),
),
)
.add(
HttpApiEndpoint.get("project.current", `${root}/current`, {
query: LocationQuery,
@ -36,7 +48,7 @@ export const ProjectGroup = HttpApiGroup.make("server.project")
)
.annotateMerge(
OpenApi.annotations({
title: "projects",
title: "project",
description: "Location-scoped project routes.",
}),
)

View file

@ -39,7 +39,7 @@ export const ProviderGroup = HttpApiGroup.make("server.provider")
)
.annotateMerge(
OpenApi.annotations({
title: "providers",
title: "provider",
description: "Experimental provider routes.",
}),
)

View file

@ -30,7 +30,7 @@ export const makeQuestionGroup = <
}),
),
)
.annotateMerge(OpenApi.annotations({ title: "questions", description: "Experimental question routes." }))
.annotateMerge(OpenApi.annotations({ title: "question", description: "Experimental question routes." }))
// Effect applies group middleware only to endpoints already added; session endpoints use session placement below.
.middleware(locationMiddleware)
.add(
@ -80,5 +80,5 @@ export const makeQuestionGroup = <
),
)
.annotateMerge(
OpenApi.annotations({ title: "session questions", description: "Experimental session question routes." }),
OpenApi.annotations({ title: "question", description: "Experimental session question routes." }),
)

View file

@ -567,7 +567,7 @@ export const makeSessionGroup = <I extends HttpApiMiddleware.AnyId, S>(sessionLo
)
.annotateMerge(
OpenApi.annotations({
title: "sessions",
title: "session",
description: "Experimental session routes.",
}),
)

View file

@ -21,7 +21,7 @@ export const SkillGroup = HttpApiGroup.make("server.skill")
)
.annotateMerge(
OpenApi.annotations({
title: "skills",
title: "skill",
description: "Experimental skill routes.",
}),
)