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

@ -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()))
}),
),
)