Documentation
¶
Overview ¶
Package copilot reads `copilot -p --output-format json` runs of GitHub Copilot CLI.
The stream carries no token counts. The session's events.jsonl, which Copilot CLI writes under its home, holds one session.usage_record per model request and one session.shutdown with each model's totals. The plan names the session, so the budget is watched in that file during the run. The rows come from the usage records, and the shutdown's totals check them.
Index ¶
Constants ¶
const Name = "copilot"
Name is the costroid/agent tag.
const UnitNanoAIU = "nano-AIU"
UnitNanoAIU is Copilot's own unit for its AI credits: nano-AI units, as totalNanoAiu states them.
Variables ¶
This section is empty.
Functions ¶
func ReadEvents ¶
ReadEvents reads one session's events.jsonl. Each session.usage_record is one request. The records' sums for each model must equal the model's totals in session.shutdown, or the file is refused. keyed says the provider variables named the user's own key, which decides the basis of a record that does not state isByok.
Copilot's own credits, totalNanoAiu and each model's requests.cost, are its figures in its own units. They reach AgentStated and a warning, never a row, and never become dollars.
Types ¶
type Agent ¶
type Agent struct{}
Agent is Copilot CLI.
func (Agent) NewSession ¶
NewSession starts reading a run of the planned command.
type Session ¶
type Session struct {
// contains filtered or unexported fields
}
Session reads one Copilot CLI run. Feed and Tail run on separate goroutines, so the lock covers everything below it.
func (*Session) Feed ¶
Feed reads one stdout line. Only the result line is read: it names the session.