OpenCode is a multiplatform AI coding agent with three deployment shapes (TUI, desktop, IDE extension) sharing a core server in packages/opencode and web UI in packages/app, orchestrated via Bun workspaces across the packages/ directory tree. The codebase uses runtime-conditional database adapters (Bun vs. Node) and publishes ESM modules under MIT, with CLI entry point at ./bin/opencode and IDE integration via the Agent Client Protocol.
OpenCode is an open-source AI coding agent available as a terminal-based TUI, a desktop app, and an IDE extension.[1] OpenCode supports the Agent Client Protocol (ACP), enabling use directly inside compatible editors and IDEs without the TUI.[2]
The root package.json uses Bun workspaces covering all directories under packages/*, packages/console/*, packages/stats/*, packages/sdk/js, and packages/slack.[3] packages/opencode contains the core business logic and server; its src/cli/cmd/tui/ subdirectory holds the TUI, written in SolidJS with opentui.[4] packages/app holds the shared web UI components written in SolidJS, and packages/desktop contains the native desktop app built with Electron, which wraps packages/app.[4] packages/plugin is the source for the @opencode-ai/plugin npm package.[4]
The opencode package is published under the MIT license as an ESM module ("type": "module").[5] The opencode CLI binary entry point is ./bin/opencode, declared in packages/opencode/package.json.[5] packages/opencode/package.json uses a conditional #db import map to select the database adapter: ./src/storage/db.bun.ts for Bun environments and ./src/storage/db.node.ts for Node, defaulting to the Bun adapter.[5]
Sources