fix(cli): emit the OpenCode plugin as a V2 default export - #2089
Conversation
OpenCode's V2 loader validates only the module's default export,
expecting {id, setup()|effect()}. cbm_client_adapter_opencode still
emitted the V1 named export (export const CodebaseMemory = ...), so
every server start failed with SchemaError: Missing key at ["default"].
Wrap the existing hook logic in a default export with an id and a
setup(ctx) function; the returned hooks object is unchanged.
Fixes DeusData#2077
Signed-off-by: Amir Fathi <amirfathi.me@gmail.com>
|
Thanks for opening this — it has been seen, and it is queued. This note is automated, but it is not a brush-off: it exists so you know where your PR stands instead of having to guess from silence. Current review status: working through a backlog. What that means for this PR, concretely:
Things that will genuinely speed it up whenever review does happen:
If this fixes a bug, a reproduction we can run is worth more than a description of the symptom. Thanks for contributing, and sorry in advance for the wait. |
|
Thanks for taking #2077 on so quickly, and for the RED/GREEN evidence — the diagnosis is right: OpenCode's newer config loader validates One thing turned up when running the generated module through OpenCode's own loaders, though. There are two of them, and the one that actually fires The shape that satisfies both loaders: export default {
id: 'codebase-memory-augment',
// server runtime: reads default.server and dispatches the hooks it returns
server: async (ctx) => { /* the existing hook object */ },
// V2 config loader: requires id + setup|effect; no tool domain yet, so nothing to register
setup() {},
};Could you switch |
OpenCode's V2 plugin loader only reads the default export and requires an id plus a setup() or effect() function.
cbm_client_adapter_opencodestill generated the old named export (export const CodebaseMemory = async (ctx) => {...}), so every server start failed withSchemaError: Missing key at ["default"], and the workaround gets overwritten on every install/update since the file is regenerated.Wrapped the same hook logic in a default export with
id: 'codebase-memory-augment'andasync setup(ctx); the returned hooks object (tool.execute.after,experimental.session.compacting) is unchanged.Added a test asserting the generated module has the default export shape and no longer contains the old named export. Ran
scripts/test.sh --suites agent_clientson Ubuntu 24.04: the new test fails without the change and the suite is green on the branch (38 tests).Fixes #2077