import type { CollectOptions, CollectResult, CollectorAvailability, UsageCollector } from '../../models/usage-record.js'; export interface OpenCodeCursor { /** Per store path: the highest `message.time_updated` already ingested. */ stores: Record; /** * Per store path: the highest `session_message.time_updated` already ingested. * Absent in cursors written before OpenCode 2.x support, which reads as 0 and * so reads the table once from the start. */ sessionMessages?: Record; } /** * Reads token usage straight out of OpenCode's SQLite database. * * Grain: one record per assistant *message*. * * Why message grain and not the `session` rollup columns, which look more * convenient: on the machine this was developed against, the `message` table and * the independent `part` (step-finish) table agree byte-for-byte, while the * `session` rollup was stale for 4 sessions and lost 545,977 input tokens -- * three of them recorded `tokens_input = 0` despite having real messages. * OpenCode's own `stats` command reads the rollup for its headline block but the * message grain for its per-model block, so the two halves of its output do not * agree with each other. Message grain is the corroborated number, and it is * also the only grain that attributes tokens to the right model when a session * switches models partway through. `ai-usage verify` reconciles all three grains. */ export declare class OpenCodeCollector implements UsageCollector { readonly name = "opencode"; readonly client: "opencode"; isAvailable(): Promise; collect(options: CollectOptions): Promise; private collectStore; }