Skip to main content

Bug Fixes

  • OpenCode plugins were incompatible with OpenCode 1.2.x. Users saw OpenCode crash on startup with:
    TypeError: fn3 is not a function. (In 'fn3(input)', 'fn3' is an instance of Object)
        at <anonymous> (src/plugin/index.ts:90:28)
    
    Root cause: we shipped plugins as export default { id, server: async (...) => hooks } — an object. OpenCode 1.2.x’s plugin loader (packages/opencode/src/plugin/index.ts) does this:
    for (const [_name, fn] of Object.entries(mod)) {
      const init = await fn(input)  // ← line 90: expects fn to be a function
      hooks.push(init)
    }
    
    It iterates every module export (including default) and calls each one as a function. Our object export was never unwrapped — the runtime has no special case for a server: property, so { id, server }(input) threw fn is not a function. Fixed across all 3 plugins (inject-subagent-context.js, inject-workflow-state.js, session-start.js) by switching to the current factory-function shape:
    export default async ({ directory, client }) => {
      const ctx = new TrellisContext(directory)
      return {
        "tool.execute.before": async (input, output) => { /* ... */ },
        "chat.message": async (input, output) => { /* ... */ },
      }
    }
    
    This matches the documented Plugin type in @opencode-ai/plugin: (input: PluginInput) => Promise<Hooks>. Impact: any Trellis version (including 0.4.x stable) configured for OpenCode was affected as soon as OpenCode updated to 1.2.x. Upgrade to @mindfoldhq/trellis@beta to restore startup.

Upgrade

trellis update
Not breaking. update.skip is respected. The 3 plugin files auto-update if you haven’t modified them; standard Modified by you confirm prompt with diff if you did. Install: npm install -g @mindfoldhq/trellis@beta