Class: Agent::Sessions::Readers::Copilot
- Defined in:
- lib/agent/sessions/readers/copilot.rb
Overview
GitHub Copilot CLI turns, from the SQLite store the adapter enumerates.
The SCHEMA is verified (schema_version 3 on this machine, 2026-08-24): turns holds id, session_id, turn_index, user_message, assistant_response, timestamp. The CONTENT is not — the one real session here has zero turn rows, so no turn has ever been read. The column names are unambiguous enough to map without guessing at structure, which is why this reader exists at all rather than waiting; what it cannot promise is that a real turn holds plain text in those columns rather than, say, JSON.
fidelity is :messages, not :full — one row is a whole exchange, so the tool calls and reasoning that happened inside it are not recoverable from this table. What a caller gets is what was said, not how.
Constant Summary
Constants inherited from Base
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#each_message ⇒ Object
One row is a user turn AND the assistant's reply, so each row yields two messages.
-
#usage ⇒ Object
No token or cost column exists anywhere in this schema — not on sessions, not on turns.
Methods inherited from Base
#branching?, #compactions, #fidelity, #initialize, #messages, #partial?, #tree, #warnings
Constructor Details
This class inherits a constructor from Agent::Sessions::Readers::Base
Instance Method Details
#each_message ⇒ Object
One row is a user turn AND the assistant's reply, so each row yields two messages. They share a raw record: rule 1 keeps the row intact, and splitting it into two half-rows would misreport what was stored.
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/agent/sessions/readers/copilot.rb', line 23 def return enum_for(:each_message) unless block_given? each_record do |record, _index| user = record["user_message"] yield build(record, :user, user) if usable?(user) reply = record["assistant_response"] yield build(record, :assistant, reply) if usable?(reply) end end |
#usage ⇒ Object
No token or cost column exists anywhere in this schema — not on sessions, not on turns. nil is the format speaking, and must not be mistaken for a session that cost nothing.
37 |
# File 'lib/agent/sessions/readers/copilot.rb', line 37 def usage = nil |