Skip to main content

Module opencode

Module opencode 

Source
Expand description

OpenCode: a single SQLite database (~/.local/share/opencode/opencode.db) holding session, message, and part rows.

The native Body is OpenCode’s own export shape — {info, messages: [{info, parts}]} — the format opencode export emits and opencode import consumes. OpenCodeStore reads the DB read-only and assembles that shape; save hands it to opencode import. The codec and native types are pure JSON and compile without the opencode feature; only the store pulls in rusqlite.

A part of type tool splits into a Block::ToolUse on an assistant message and a Block::ToolResult on the following user message, matching the Anthropic shape. Synthetic text parts and internal bookkeeping (step-start/finish, snapshot, patch, …) are dropped from the conversation but preserved in the native body.

Structs§

Export
OpenCode’s export document: a session header plus its messages.
MessageRecord
One message and its parts, as opencode export emits them.
OpenCode
The OpenCode harness marker.
OpenCodeStore
Reads and writes OpenCode sessions in a SQLite database. A Ref is a session id, since every session shares the one database file.