Documentation
¶
Overview ¶
Package model holds the shared, frozen types of MyToken!!!!!. Changing any exported signature here requires lead approval (docs/ARCHITECTURE.md#data-model).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttribSource ¶
type AttribSource string
AttribSource records how a provider was determined.
const ( AttribLog AttribSource = "log" AttribCCSwitch AttribSource = "cc-switch" AttribConfig AttribSource = "config-timeline" AttribInferred AttribSource = "inferred" AttribUserRule AttribSource = "user-rule" )
type Bill ¶
Bill preserves a tool's explicitly reported charge in its native unit. It is independent of CostUSD: credits are never converted to or added to USD.
type Boundary ¶
type Boundary string
Boundary is an explicitly observed context lifecycle change before a request. Empty means unknown; missing records and model changes are not boundaries.
type Harness ¶
type Harness string
Harness identifies the AI coding tool that produced a log.
const ( ClaudeCode Harness = "claude-code" Codex Harness = "codex" Gemini Harness = "gemini" DSH Harness = "dsh" OpenCode Harness = "opencode" Crush Harness = "crush" Cline Harness = "cline" Roo Harness = "roo" Kilo Harness = "kilo" Pi Harness = "pi" Grok Harness = "grok" OpenClaw Harness = "openclaw" Droid Harness = "droid" Goose Harness = "goose" Forge Harness = "forge" ClaudeDesktop Harness = "claude-desktop" Qwen Harness = "qwen" Kimi Harness = "kimi" OpenClaude Harness = "openclaude" WorkBuddy Harness = "workbuddy" CodeBuddy Harness = "codebuddy" CodeBuddyCN Harness = "codebuddy-cn" Cindy Harness = "cindy" Hermes Harness = "hermes" Amp Harness = "amp" Kiro Harness = "kiro" Codebuff Harness = "codebuff" Mux Harness = "mux" Zed Harness = "zed" Antigravity Harness = "antigravity" ZCode Harness = "zcode" MiniMaxCode Harness = "minimax-code" MiMoCode Harness = "mimo-code" StepCode Harness = "step-code" Trae Harness = "trae" Qoder Harness = "qoder" )
func (Harness) DisplayName ¶
DisplayName is the human label of a harness.
type SessionMeta ¶
type SessionMeta struct {
Harness Harness `json:"harness"`
SessionID string `json:"sessionId"`
ParentID string `json:"parentId,omitempty"`
Title string `json:"title,omitempty"` // first user message, ≤60 runes, no newlines
Project string `json:"project,omitempty"`
StartedAt time.Time `json:"startedAt"`
UpdatedAt time.Time `json:"updatedAt"`
}
SessionMeta describes a session. Title is the only conversation text stored.
type Tokens ¶
type Tokens struct {
Input int64 `json:"input"`
Output int64 `json:"output"`
CacheRead int64 `json:"cacheRead"`
CacheWrite int64 `json:"cacheWrite"`
// CacheWrite1h is the part of CacheWrite written with the 1-hour TTL
// (Anthropic cache_creation.ephemeral_1h_input_tokens). It is a subset,
// never added on top: CacheWrite is always the total of both tiers, and
// CacheWrite-CacheWrite1h is the 5-minute tier. Priced at 2x input
// instead of 1.25x.
CacheWrite1h int64 `json:"cacheWrite1h,omitempty"`
Reasoning int64 `json:"reasoning"`
}
Tokens are the five token classes. Parsers must not double count: if a log's output already includes reasoning, Output must exclude it.
type UsageEvent ¶
type UsageEvent struct {
Harness Harness `json:"harness"`
DedupKey string `json:"dedupKey"` // stable; harness request/message id, else sha1(file+offset)
SessionID string `json:"sessionId"` // subagents use their own id
ParentID string `json:"parentId,omitempty"`
ProjectPath string `json:"projectPath,omitempty"`
Timestamp time.Time `json:"timestamp"` // UTC
Model string `json:"model"`
Provider string `json:"provider,omitempty"` // set only when the log itself says so
BaseURL string `json:"baseUrl,omitempty"`
Tokens Tokens `json:"tokens"`
CostUSD *float64 `json:"costUsd,omitempty"` // cost reported by the log, if any
RequestID string `json:"requestId,omitempty"` // upstream request/response ID, never a local fallback
Boundary Boundary `json:"boundary,omitempty"`
Bill *Bill `json:"bill,omitempty"`
// DecodeMS is the generation window of this request in milliseconds, when
// the log itself timed it: the distance from the first streamed output
// token to the record that closed the message. Only a tool that journals its
// own token stream can report it. It is a measurement, never a guess; zero
// means the log did not say, and consumers fall back to estimating speed
// from the gaps between requests.
DecodeMS int64 `json:"decodeMs,omitempty"`
// GitBranch is the git branch the source log itself recorded for this
// request: Claude Code writes a top-level `gitBranch` on a transcript line,
// Codex writes `session_meta.payload.git.branch` once per rollout. It is
// evidence carried by the record, never a read of the working tree or of
// the current session's HEAD; the branch a log did not state stays "" and
// readers report it as unknown rather than dropping the request.
GitBranch string `json:"gitBranch,omitempty"`
}
UsageEvent is one model request's usage, the single source of truth.