Documentation
¶
Index ¶
- func AppendCompileSession(filePath string, data CompileSessionData) error
- func AppendRecord(filePath string, record Record) error
- func AppendSkillExecution(filePath string, data SkillExecutionData) error
- func CheckSkillExecution(toolName, eventType, sessionID string, toolInput map[string]interface{}, ...)
- func PrintStats(statsPath string, nextInfo *NextCompileInfo, asJSON bool) error
- type Aggregated
- type CompileSessionData
- type NextCompileInfo
- type Record
- type RecordType
- type SkillExecutionData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendCompileSession ¶
func AppendCompileSession(filePath string, data CompileSessionData) error
AppendCompileSession records a compile session to the stats file.
func AppendRecord ¶
AppendRecord marshals and appends a record to the JSONL file.
func AppendSkillExecution ¶
func AppendSkillExecution(filePath string, data SkillExecutionData) error
AppendSkillExecution records a skill execution to the stats file.
func CheckSkillExecution ¶
func CheckSkillExecution(toolName, eventType, sessionID string, toolInput map[string]interface{}, paths config.Paths)
CheckSkillExecution examines tool event fields and, if they represent an AJ-generated skill execution, records it to the stats file.
func PrintStats ¶
func PrintStats(statsPath string, nextInfo *NextCompileInfo, asJSON bool) error
PrintStats reads the stats file and prints a formatted dashboard.
Types ¶
type Aggregated ¶
type Aggregated struct {
CompileSessions int `json:"compile_sessions"`
CompileInputTokens int `json:"compile_input_tokens"`
CompileOutputTokens int `json:"compile_output_tokens"`
CompileTotalCost float64 `json:"compile_total_cost_usd"`
SkillExecutions int `json:"skill_executions"`
SkillSuccesses int `json:"skill_successes"`
SkillFailures int `json:"skill_failures"`
EstTokensSaved int `json:"estimated_tokens_saved"`
}
Aggregated holds aggregated stats for display.
func Aggregate ¶
func Aggregate(records []Record) Aggregated
Aggregate computes aggregated stats from records.
type CompileSessionData ¶
type CompileSessionData struct {
SessionID string `json:"session_id"`
InputTokens int `json:"input_tokens"`
OutputTokens int `json:"output_tokens"`
CacheCreationTokens int `json:"cache_creation_input_tokens"`
CacheReadTokens int `json:"cache_read_input_tokens"`
TotalCostUSD float64 `json:"total_cost_usd"`
DurationMs int64 `json:"duration_ms"`
NumTurns int `json:"num_turns"`
SkillsCreated int `json:"skills_created"`
SkillsUpdated int `json:"skills_updated"`
SessionsProcessed int `json:"sessions_processed"`
EventsProcessed int `json:"events_processed"`
DeterministicPatterns int `json:"deterministic_patterns"`
LLMPatterns int `json:"llm_patterns"`
}
CompileSessionData holds metrics for a single compile invocation.
type NextCompileInfo ¶ added in v0.1.7
type NextCompileInfo struct {
TriggerMode string `json:"trigger_mode"`
LastCompileTime *time.Time `json:"last_compile_time,omitempty"`
IntervalMinutes int `json:"interval_minutes,omitempty"`
MinutesRemaining *int `json:"minutes_remaining,omitempty"`
EventThreshold int `json:"event_threshold,omitempty"`
EventsSinceCompile int `json:"events_since_compile,omitempty"`
EventsRemaining *int `json:"events_remaining,omitempty"`
}
NextCompileInfo describes progress toward the next auto-compile.
type Record ¶
type Record struct {
Type RecordType `json:"type"`
Timestamp time.Time `json:"timestamp"`
Data json.RawMessage `json:"data"`
}
Record is the envelope written to stats.jsonl.
func ReadAllRecords ¶
ReadAllRecords reads all records from the stats JSONL file. Malformed lines are silently skipped.
type RecordType ¶
type RecordType string
RecordType identifies the kind of stats record.
const ( RecordCompileSession RecordType = "compile_session" RecordSkillExecution RecordType = "skill_execution" )