From eb9be04fe8b1eb817e7b02078b61424a1d6c9e60 Mon Sep 17 00:00:00 2001 From: "Can H. Tartanoglu" Date: Tue, 9 Jun 2026 21:25:44 +0200 Subject: [PATCH] fix(plugin): skip cross-kind plugins in readV1Plugin detect mode When readV1Plugin is called with mode='detect' and kind='server', a TUI-only plugin (with id and tui fields but no server field) should be silently skipped instead of throwing TypeError. The existing detect guard only checks whether ALL of {id, server, tui} are absent. Add two additional guards that also short-circuit when the plugin lacks the field for the requested kind. This fixes the server plugin loader (plugin/index.ts) emitting ERROR logs for every file-based TUI-only plugin configured via settings.plugin. --- packages/opencode/src/plugin/shared.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/opencode/src/plugin/shared.ts b/packages/opencode/src/plugin/shared.ts index 1a519359bde6..59d4f97fcdbe 100644 --- a/packages/opencode/src/plugin/shared.ts +++ b/packages/opencode/src/plugin/shared.ts @@ -281,6 +281,9 @@ export function readV1Plugin( throw new TypeError(`Plugin ${spec} must default export an object with ${kind}()`) } if (mode === "detect" && !("id" in value) && !("server" in value) && !("tui" in value)) return + // detect: skip plugins that don't have the requested kind + if (mode === "detect" && kind === "server" && !("server" in value)) return + if (mode === "detect" && kind === "tui" && !("tui" in value)) return const server = "server" in value ? value.server : undefined const tui = "tui" in value ? value.tui : undefined