From ca8cb53f46eb42e1c11c6fa221855165bebbdce8 Mon Sep 17 00:00:00 2001 From: GoldJohnKing Date: Tue, 18 Aug 2026 21:27:47 +0800 Subject: fix(opencode): skip V2 setup when V1 invokes it with a V1-shaped ctx opencode 1.18.18 also calls default.setup, but with a ctx that lacks the skill/session domains, so the defensive try/catch logged a TypeError into every V1 session transcript even though V1 is fully served by the SuperpowersPlugin named export. Detect the V1 shape and return quietly. --- .opencode/plugins/superpowers.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to '.opencode/plugins') diff --git a/.opencode/plugins/superpowers.js b/.opencode/plugins/superpowers.js index e547e87..223e727 100644 --- a/.opencode/plugins/superpowers.js +++ b/.opencode/plugins/superpowers.js @@ -155,6 +155,13 @@ export const SuperpowersPlugin = async ({ client, directory }) => { * equivalent of V1's experimental.chat.messages.transform. */ async function setup(ctx) { + // V1 (observed on opencode 1.18.18) also invokes default.setup, but with a + // V1-shaped ctx that lacks the skill/session domains. Detect it and return + // quietly — V1 is served entirely by the SuperpowersPlugin named export. + if (!ctx || !ctx.skill || typeof ctx.skill.transform !== 'function' || !ctx.session || typeof ctx.session.hook !== 'function') { + return; + } + // 1. Register skills (one transform; one draft.add per skill) try { const skills = []; -- cgit