david e07ae8aa27 fix: read opencode sessions from session_v2/session_message
opencode 2.0.24 migrated its session store: the session, message and
part tables stopped being written, and sessions now live in session_v2
with messages in session_message. The ingest kept querying the abandoned
tables, so every sweep after the migration logged "0 new" and no error.

Session titles are nullable in session_v2, so keep the COALESCE and the
"Session <short id>" fallback.

Transcripts are rebuilt from both message shapes the new store uses:
user turns carry text at $.text, assistant turns carry a typed part list
at $.content of which only "text" parts are conversation (reasoning and
tool parts are not indexed). Rows are ordered by seq, then part index,
so a session reads in order.

Harness reminders arrive as synthetic messages now; drop <system-reminder>
text so it does not consume the 4000-byte summary budget.

Also stop skipping an entry purely on created_at: resuming a session
appends messages without touching the creation time, so the summary is
compared too and the entry refreshes.

Bump the ingester to opencode-db/v2 and cover both message shapes with a
test that builds the new schema in a temp database.

Fixes #6
2026-11-01 13:33:56 -08:00
S
Description
Knowledge index & session tracker for opencode
1.9 MiB
Languages
Go 95.3%
TypeScript 2.3%
HTML 2%
Shell 0.2%
Dockerfile 0.2%