Track OpenCode child sessions (#343)
Some checks are pending
CI / semgrep (push) Waiting to run

This commit is contained in:
ozymandiashh 2026-05-18 15:51:08 +03:00 committed by GitHub
parent 2013ecbfd9
commit 5a837c94e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 137 additions and 6 deletions

View file

@ -26,6 +26,10 @@ Per `<sessionId>:<messageId>`.
- **Schema validation is loud.** When a required table is missing, the parser logs an actionable warning telling the user which table is gone and what version of OpenCode it expects. This is the right behavior; do not silently swallow these.
- Source paths are encoded as `<dbPath>:<sessionId>`.
- Discovery only emits root sessions (`parent_id IS NULL`) to avoid double
counting. Parsing a root session walks the unarchived `session.parent_id`
subtree, so child and grandchild agent sessions contribute their message,
token, and tool usage back to the root session.
- Each message's `parts` are indexed; preserving the order matters for reasoning-token correctness.
- Tokens are reported across `input`, `output`, `reasoning`, `cache.read`, and `cache.write`. Anthropic semantics.
- External MCP tools are stored as `<server>_<tool>` names (for example