Skip to main content

Module copilot

Module copilot 

Source
Expand description

Serde models for the GitHub Copilot CLI events.jsonl session format.

Current Copilot CLI writes ~/.copilot/session-state/<sessionId>/events.jsonl where every line is a single event carrying its own type discriminator. The analyzer walks these events in order and pulls session metadata from session.start, model switches from session.model_change, tool calls from the tool.execution_start / tool.execution_complete pair, and authoritative per-model token usage from session.shutdown.modelMetrics.

Earlier Copilot CLI releases wrote a single pretty-printed JSON object under ~/.copilot/history-session-state/<sessionId>.json with no token accounting at all; that layout is no longer supported.

Structs§

CopilotEvent
Single line of the Copilot events.jsonl stream.
CopilotModelChangeData
session.model_change payload — each session may switch between models at any point, so the analyzer uses the most recent one when attributing streaming assistant.message tokens that arrive before session.shutdown.
CopilotModelMetric
Per-model block inside CopilotShutdownData::model_metrics.
CopilotModelUsage
Token counts captured by Copilot CLI at session shutdown.
CopilotSessionContext
Workspace context recorded at the start of a Copilot CLI session.
CopilotSessionStartData
session.start payload — session-scoped identifiers and workspace context.
CopilotShutdownData
session.shutdown payload — authoritative per-model token usage.
CopilotToolCompleteData
tool.execution_complete payload — carries the tool’s actual output (file contents on view, creation confirmation on create, …) under result, plus the model that invoked the tool.
CopilotToolStartData
tool.execution_start payload — paired with tool.execution_complete via tool_call_id.