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:
Dax Raad 2026-07-01 00:53:22 -04:00
commit 6a91a682e4
13 changed files with 998 additions and 883 deletions

View file

@ -10,6 +10,7 @@ import { CommandHandler } from "./handlers/command"
import { SkillHandler } from "./handlers/skill"
import { EventHandler } from "./handlers/event"
import { AgentHandler } from "./handlers/agent"
import { PluginHandler } from "./handlers/plugin"
import { HealthHandler } from "./handlers/health"
import { PtyHandler } from "./handlers/pty"
import { ShellHandler } from "./handlers/shell"
@ -26,6 +27,7 @@ export const handlers = Layer.mergeAll(
HealthHandler,
LocationHandler,
AgentHandler,
PluginHandler,
SessionHandler,
MessageHandler,
ModelHandler,

View file

@ -0,0 +1,13 @@
import { PluginV2 } from "@opencode-ai/core/plugin"
import { Effect } from "effect"
import { HttpApiBuilder } from "effect/unstable/httpapi"
import { Api } from "../api"
import { response } from "../location"
export const PluginHandler = HttpApiBuilder.group(Api, "server.plugin", (handlers) =>
handlers.handle("plugin.list", () =>
Effect.gen(function* () {
return yield* response(PluginV2.Service.use((plugin) => plugin.list()))
}),
),
)