> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trytrellis.app/llms.txt
> Use this file to discover all available pages before exploring further.

# v0.5.0-beta.7

> 2026-04-20

## Bug 修复

* **OpenCode 插件和 OpenCode 1.2.x 不兼容。** 用户启动 OpenCode 时会崩溃：

  ```
  TypeError: fn3 is not a function. (In 'fn3(input)', 'fn3' is an instance of Object)
      at <anonymous> (src/plugin/index.ts:90:28)
  ```

  根因：我们之前发的插件是 `export default { id, server: async (...) => hooks }` 对象。OpenCode 1.2.x 的插件 loader（`packages/opencode/src/plugin/index.ts`）是这么写的：

  ```ts theme={null}
  for (const [_name, fn] of Object.entries(mod)) {
    const init = await fn(input)  // ← line 90: 把 fn 当函数调
    hooks.push(init)
  }
  ```

  它遍历模块**所有**导出（包括 `default`）然后一个一个当函数调。我们的对象导出从来没被 unwrap——runtime 对 `server:` 字段没有特殊处理，所以 `{ id, server }(input)` 直接抛 `fn is not a function`。

  3 个插件全部修复（`inject-subagent-context.js`, `inject-workflow-state.js`, `session-start.js`），改成当前文档规定的工厂函数形式：

  ```js theme={null}
  export default async ({ directory, client }) => {
    const ctx = new TrellisContext(directory)
    return {
      "tool.execute.before": async (input, output) => { /* ... */ },
      "chat.message": async (input, output) => { /* ... */ },
    }
  }
  ```

  对应 `@opencode-ai/plugin` 里的 `Plugin` 类型：`(input: PluginInput) => Promise<Hooks>`。

  **影响范围**：任何配了 OpenCode 的 Trellis 版本（包括 0.4.x 稳定版），只要用户把 OpenCode 升到 1.2.x 就会炸。升级到 `@mindfoldhq/trellis@beta` 恢复启动。

## 升级

```bash theme={null}
trellis update
```

非 breaking 版本，`update.skip` 正常生效。未修改过的 3 个 plugin 文件自动更新；改过的弹标准 `Modified by you` confirm prompt + diff。

安装：`npm install -g @mindfoldhq/trellis@beta`
