Documentation
¶
Index ¶
- Variables
- func CanonicalModel(model *string, provider string) string
- func CanonicalProvider(harness string, provider *string) (string, string)
- func ClaudeCodeMessage(ctx context.Context, source NativeSource, options ParseOptions, ...) (RawTokenFact, []Diagnostic, bool)
- func CodexIntField(usage map[string]interface{}, name string) *int64
- func CodexMessageIdentity(turnID *string, occurredAtMs int64, line int, snapshot CodexSnapshot) string
- func CodexReplayFingerprint(turnID, provider, model *string, snapshot CodexSnapshot, valid bool) string
- func CodexTokens(usage map[string]interface{}) (TokenComponents, []Diagnostic, bool)
- func HasInvalidIntegerField(record map[string]interface{}, names ...string) bool
- func IntField(record map[string]interface{}, names ...string) *int64
- func NativeTupleHash(parts ...string) string
- func Nested(record map[string]interface{}, key string) map[string]interface{}
- func NormalizationRuleSignature(harness string) string
- func OpenCodeMessage(source NativeSource, options ParseOptions, messageID string, sessionID *string, ...) (RawTokenFact, []Diagnostic, bool)
- func PiMessage(ctx context.Context, source NativeSource, options ParseOptions, ...) (RawTokenFact, []Diagnostic, bool)
- func Process(ctx context.Context, records []evidence.Stored) (evidence.Projection, error)
- func SourceIdentityJSON(sessionSource string, requestID *string) *string
- func SourceSessionIdentity(metadata *string) string
- func StableHash(value string) string
- func StringField(record map[string]interface{}, names ...string) *string
- func StringValue(record map[string]interface{}, fallback string, names ...string) string
- func TokenComponentSum(values ...*int64) (int64, bool)
- type CodexSnapshot
- type CodexUsageSnapshot
- type Diagnostic
- type Harness
- type NativeSource
- type ParseOptions
- type RawTokenFact
- type TokenComponents
Constants ¶
This section is empty.
Variables ¶
var ModelPrefixes = map[string]string{
"fireworks": "accounts/fireworks/models/",
}
var ProviderAliases = map[Harness]map[string]string{ HarnessOpenCode: {"fireworks-ai": "fireworks"}, HarnessPi: {"openai-codex": "openai", "fireworks-ai": "fireworks"}, HarnessCodex: {"fireworks-ai": "fireworks"}, HarnessClaudeCode: {"fireworks-ai": "fireworks"}, }
Source identifiers stay in raw_token_usage; these rules affect canonical facts only.
Functions ¶
func CanonicalModel ¶
func ClaudeCodeMessage ¶
func ClaudeCodeMessage(ctx context.Context, source NativeSource, options ParseOptions, fallbackSessionID string, record map[string]interface{}) (RawTokenFact, []Diagnostic, bool)
func CodexIntField ¶
func CodexMessageIdentity ¶
func CodexMessageIdentity(turnID *string, occurredAtMs int64, line int, snapshot CodexSnapshot) string
CodexMessageIdentity retains native turn/time/snapshot identity, including the line witness required when cumulative source usage is absent.
func CodexReplayFingerprint ¶
func CodexReplayFingerprint(turnID, provider, model *string, snapshot CodexSnapshot, valid bool) string
CodexReplayFingerprint is proof only for complete, native integer snapshots.
func CodexTokens ¶
func CodexTokens(usage map[string]interface{}) (TokenComponents, []Diagnostic, bool)
func HasInvalidIntegerField ¶
func NativeTupleHash ¶
Native tuples use unambiguous encoding; source IDs may contain separators.
func OpenCodeMessage ¶
func OpenCodeMessage(source NativeSource, options ParseOptions, messageID string, sessionID *string, created *int64, data string, v2 bool) (RawTokenFact, []Diagnostic, bool)
OpenCodeMessage interprets native message metadata. Optional row fields are pointers so SQL nullability stays in the reader adapter.
func PiMessage ¶
func PiMessage(ctx context.Context, source NativeSource, options ParseOptions, sessionID string, nativeSession bool, record map[string]interface{}) (RawTokenFact, []Diagnostic, bool)
func Process ¶
Process is deterministic and has no database, filesystem or Git reads. All interpretation happens here, after the server durably accepts evidence.
func SourceIdentityJSON ¶
func SourceSessionIdentity ¶
func StableHash ¶
func StringField ¶
func StringValue ¶
func TokenComponentSum ¶
Types ¶
type CodexSnapshot ¶
type CodexSnapshot struct {
Last *CodexUsageSnapshot `json:"last"`
Total *CodexUsageSnapshot `json:"total"`
}
type CodexUsageSnapshot ¶
type CodexUsageSnapshot struct {
Input *int64 `json:"input"`
CachedInput *int64 `json:"cachedInput"`
CacheRead *int64 `json:"cacheRead"`
Output *int64 `json:"output"`
Reasoning *int64 `json:"reasoning"`
Total *int64 `json:"total"`
}
Snapshot fields preserve source presence and both cache aliases. Replay proof must compare the source counters, not normalized/clamped token components.
func CodexSnapshotFromUsage ¶
func CodexSnapshotFromUsage(usage map[string]interface{}) (*CodexUsageSnapshot, bool)
type Diagnostic ¶
type Diagnostic struct {
Harness Harness
RawFactKey, Severity, Code, Message string
MetadataJSON *string
}
func FinalizeClaudeCodeFact ¶
func FinalizeClaudeCodeFact(fact *RawTokenFact) ([]Diagnostic, bool)
type NativeSource ¶
type ParseOptions ¶
type RawTokenFact ¶
type RawTokenFact struct {
Harness Harness
SourceID string
SourceKind string
Collector string
Parser string
ObservedAtMs int64
OccurredAtMs *int64
SessionID *string
MessageID *string
Provider *string
Model *string
UsageScope string
Quality string
InputTokens *int64
OutputTokens *int64
ReasoningTokens *int64
CacheReadTokens *int64
CacheWriteTokens *int64
TotalTokens *int64
MetadataJSON *string
DedupeKey string
}
type TokenComponents ¶
type TokenComponents struct{ Input, Output, Reasoning, CacheRead, CacheWrite, Total *int64 }
TokenComponents are exclusive components after source-native normalization.