{"modulePath":"github.com/amberpixels/f10/cli","version":"v0.71.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package transcript\n\nPackage transcript reads token usage out of a Claude Code session transcript: one JSON object per line, appended as the session runs. Only counts, model ids and entry ids leave it, never message text.\n\n## Functions\n\n```go\nfunc LastModel(path string) string\n```\nLastModel is the model of the transcript's last main-thread assistant line, \"\" when none is within its last few MiB.\n\n```go\nfunc Read(path string, from Position) (Usage, Position, error)\n```\nRead counts the usage written to the transcript at path, and to its subagent files, since from. A missing main file is an error; an undecodable line is skipped, and a partial last line is left for the next read.\n\n```go\nfunc SubagentDir(path string) string\n```\nSubagentDir is where Claude Code writes a session's subagent transcripts.\n\n## Types\n\n```go\ntype Position struct {\n\tOffsets map[string]int64  `json:\"offsets\"`\n\tLastIDs map[string]string `json:\"last_ids,omitempty\"`\n}\n```\nPosition is how far each file has been read: the byte offset after the last complete line, and the message id counted last, since one API message spans several lines that each repeat its usage.\n\n```go\nfunc Start(path string) (Position, error)\n```\nStart is the position at the current end of the main file and of every subagent file, so a read from it counts only what is written later.\n\n```go\ntype Tokens struct {\n\tInput      int\n\tOutput     int\n\tCacheWrite int\n\tCacheRead  int\n}\n```\nTokens is one API usage, or a sum of them.\n\n```go\nfunc (t Tokens) Zero() bool\n```\nZero reports no tokens at all.\n\n```go\ntype Usage struct {\n\tTokens\n\n\tByModel   map[string]Tokens\n\tSubagents Tokens\n\t// Model is the last model the session's own messages ran on.\n\tModel string\n\t// Through is the uuid of the last entry counted in the main file.\n\tThrough string\n}\n```\nUsage is what a read counted: the session's own messages, by model, and its subagents' (sidechain) messages apart.\n\n```go\nfunc (u Usage) Zero() bool\n```\nZero reports a read that counted nothing.\n\n","path":"github.com/amberpixels/f10/cli/internal/transcript","name":"transcript","synopsis":"Package transcript reads token usage out of a Claude Code session transcript: one JSON object per line, appended as the session runs.","isRedistributable":true}
