fix(server): expose active V2 plugin metadata

Allow the read-only OpenCode /api/plugin endpoint through the workspace proxy so the status panel can distinguish active plugins from configured but unloaded packages.

Keep the route inside the explicit proxy allowlist and cover it with the instance proxy suite. The focused 25-test proxy suite, server typecheck, and diff check pass.
This commit is contained in:
Pascal André 2026-08-18 21:12:49 +02:00
parent 97d4645388
commit e4a2bde33b
No known key found for this signature in database
2 changed files with 8 additions and 1 deletions

View file

@ -132,6 +132,13 @@ describe("instance proxy location enforcement", () => {
assert.match(JSON.parse(response.body).url, /^\/api\/model\/default\?/)
})
it("allows active plugin metadata", async () => {
const { app } = await harness()
const response = await app.inject({ method: "GET", url: "/workspaces/workspace/instance/api/plugin" })
assert.equal(response.statusCode, 200)
assert.match(JSON.parse(response.body).url, /^\/api\/plugin\?/)
})
it("allows ownership-scoped agent fallback lookups", async () => {
const { app } = await harness()
const response = await app.inject({ method: "GET", url: "/workspaces/workspace/instance/api/agent/build" })

View file

@ -895,7 +895,7 @@ function hasDotSegment(value: string): boolean {
function isAllowedInstanceApiRoute(method: string, pathname: string): boolean {
const route = pathname.replace(/\/+$/, "")
const allowed: Array<[string, RegExp]> = [
["GET", /^\/api\/(?:agent|command|config|integration|mcp|model|provider)$/],
["GET", /^\/api\/(?:agent|command|config|integration|mcp|model|plugin|provider)$/],
["GET", /^\/api\/agent\/[^/]+$/],
["GET", /^\/api\/model\/default$/],
["GET", /^\/api\/(?:permission|question)\/request$/],