Does this use the opencode SDK or opencode directly?
This post might have stale content, as main is 2407 commits ahead.
does this use the opencode SDK, or opencode directly?
This project uses the @opencode-ai/sdk (the SDK), not the opencode CLI directly for programmatic interactions.
From the search results:
-
Dependencies (
package.jsonanddiscord/package.json):"@opencode-ai/sdk": "^1.1.12"- the SDK package"@opencode-ai/plugin": "^1.1.12"- plugin package
-
SDK imports (e.g.,
discord/src/opencode.ts,discord/src/tools.ts):import { ... } from '@opencode-ai/sdk' import { ... } from '@opencode-ai/sdk/v2' -
However, it does spawn the
opencodeCLI binary for the server:- In
discord/src/opencode.tsline 119:const opencodeCommand = process.env.OPENCODE_PATH || '${opencodeBinDir}/opencode' - It spawns
opencode serve --port ${port}to start the opencode server process
- In
So the architecture is:
- Server: Spawned via the
opencodeCLI (opencode serve) - Client interaction: Done via the
@opencode-ai/sdkpackage (usingcreateOpencodeClient,OpencodeClient, etc.)
END OF POST