feat(core): add plugin list endpoint
Adds a plugin.list HTTP endpoint that reports currently loaded plugins, wires it through protocol, server, and generated clients, and merges it into sdk-next's plugin API. Also updates the sample plugin to register a primary agent instead of a subagent for local testing.
This commit is contained in:
parent
f8626865b9
commit
6a91a682e4
13 changed files with 998 additions and 883 deletions
|
|
@ -13,6 +13,7 @@ import { SkillGroup } from "./groups/skill"
|
|||
import { EventGroup, makeEventGroup } from "./groups/event"
|
||||
import type { Definition } from "@opencode-ai/schema/event"
|
||||
import { AgentGroup } from "./groups/agent"
|
||||
import { PluginGroup } from "./groups/plugin"
|
||||
import { HealthGroup } from "./groups/health"
|
||||
import { PtyGroup } from "./groups/pty"
|
||||
import { ShellGroup } from "./groups/shell"
|
||||
|
|
@ -42,6 +43,7 @@ const makeApiFromGroup = <
|
|||
.add(HealthGroup)
|
||||
.add(LocationGroup.middleware(locationMiddleware))
|
||||
.add(AgentGroup.middleware(locationMiddleware))
|
||||
.add(PluginGroup.middleware(locationMiddleware))
|
||||
.add(makeSessionGroup(sessionLocationMiddleware))
|
||||
.add(MessageGroup.middleware(sessionLocationMiddleware))
|
||||
.add(ModelGroup.middleware(locationMiddleware))
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ export const groupNames = {
|
|||
"server.health": "health",
|
||||
"server.location": "location",
|
||||
"server.agent": "agent",
|
||||
"server.plugin": "plugin",
|
||||
"server.session": "session",
|
||||
"server.message": "message",
|
||||
"server.model": "model",
|
||||
|
|
|
|||
27
packages/protocol/src/groups/plugin.ts
Normal file
27
packages/protocol/src/groups/plugin.ts
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
import { Location } from "@opencode-ai/schema/location"
|
||||
import { Plugin } from "@opencode-ai/schema/plugin"
|
||||
import { Schema } from "effect"
|
||||
import { HttpApiEndpoint, HttpApiGroup, OpenApi } from "effect/unstable/httpapi"
|
||||
import { LocationQuery, locationQueryOpenApi } from "./location"
|
||||
|
||||
export const PluginGroup = HttpApiGroup.make("server.plugin")
|
||||
.add(
|
||||
HttpApiEndpoint.get("plugin.list", "/api/plugin", {
|
||||
query: LocationQuery,
|
||||
success: Location.response(Schema.Array(Plugin.Info)),
|
||||
})
|
||||
.annotateMerge(locationQueryOpenApi)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
identifier: "v2.plugin.list",
|
||||
summary: "List plugins",
|
||||
description: "Retrieve currently loaded plugins.",
|
||||
}),
|
||||
),
|
||||
)
|
||||
.annotateMerge(
|
||||
OpenApi.annotations({
|
||||
title: "plugins",
|
||||
description: "Experimental plugin routes.",
|
||||
}),
|
||||
)
|
||||
Loading…
Add table
Add a link
Reference in a new issue