Skip to main content

Module types

Module types 

Source
Expand description

On-disk schema for opencode SQLite databases.

opencode stores everything in opencode.db. Most tables are simple scalar rows, but message.data and part.data are JSON blobs that discriminate on role and type respectively. These types mirror the upstream Zod schemas in packages/opencode/src/session/message-v2.ts closely enough for fidelity, but use Value fallbacks on enum variants we don’t exhaustively enumerate so unknown future payloads survive round-trip.

Structs§

AgentPart
AssistantMessage
CompactionPart
FilePart
Message
A message row plus its associated parts, ordered.
MessagePath
MessageTime
ModelRef
Part
A part row. The data column is the typed variant payload.
PatchPart
Project
A project row. id is the SHA of the repo’s first root commit.
ReasoningPart
RetryPart
RetryTime
Session
A session row — one opencode conversation.
SessionMetadata
Lightweight metadata (no message bodies).
SnapshotPart
StepFinishPart
StepStartPart
SubtaskPart
TextPart
TimeRange
TokenCache
Tokens
ToolPart
ToolRunTime
ToolStartTime
ToolStateCompleted
ToolStateError
ToolStatePending
ToolStateRunning
UserMessage
UserSummary

Enums§

MessageData
message.data — discriminated on role.
PartData
part.data — discriminated on type.
ToolState
Tool-call execution state. Discriminated on status.