Documentation
¶
Overview ¶
Package sqlite persists QUANTUM_LOG data locally using a CGo-free driver.
Index ¶
- func Checkpoint(ctx context.Context, path string) (result error)
- func ValidateAllocations(allocations []AllocationInput) error
- type Allocation
- type AllocationInput
- type AnchorMismatch
- type BudgetAlert
- type BudgetInput
- type BudgetRecord
- type CopilotOTLPEvidenceQuery
- type ExportRecord
- type LedgerAnchor
- type ModelCallInput
- type PricingRecalculateQuery
- type PricingRuleRecord
- type ProjectReport
- type ProjectSummary
- type ProjectTag
- type RawEventInput
- type Store
- func (s *Store) AddPricingRule(ctx context.Context, rule pricing.Rule) (PricingRuleRecord, error)
- func (s *Store) AddProjectTag(ctx context.Context, projectID, key, value string) error
- func (s *Store) AppendRawEvent(ctx context.Context, input RawEventInput) (string, error)
- func (s *Store) AssignUnattributedModelCall(ctx context.Context, modelCallID, projectID string) error
- func (s *Store) BudgetAlerts(ctx context.Context, now time.Time) ([]BudgetAlert, error)
- func (s *Store) Close() error
- func (s *Store) CreateWorkContext(ctx context.Context, input WorkContextInput) (domain.WorkContext, error)
- func (s *Store) Doctor(ctx context.Context) error
- func (s *Store) EnsureSession(ctx context.Context, id, agentName string, startedAt time.Time) error
- func (s *Store) ExportModelCalls(ctx context.Context, query PricingRecalculateQuery) ([]ExportRecord, error)
- func (s *Store) FinishTask(ctx context.Context, id, result string) error
- func (s *Store) HasRecentCopilotOTLPModelCall(ctx context.Context, query CopilotOTLPEvidenceQuery) (bool, error)
- func (s *Store) LedgerAnchors(ctx context.Context) ([]LedgerAnchor, error)
- func (s *Store) ListPricingRules(ctx context.Context) ([]PricingRuleRecord, error)
- func (s *Store) ListProjects(ctx context.Context) ([]ProjectSummary, error)
- func (s *Store) ListTasks(ctx context.Context, projectSlug string) ([]TaskRecord, error)
- func (s *Store) ModelCallAllocations(ctx context.Context, modelCallID string) ([]Allocation, error)
- func (s *Store) ProjectByLocation(ctx context.Context, path string) (domain.Project, domain.ProjectLocation, bool, error)
- func (s *Store) ProjectBySlug(ctx context.Context, slug string) (domain.Project, domain.ProjectLocation, bool, error)
- func (s *Store) ProjectReport(ctx context.Context, slug string, now time.Time) (ProjectReport, error)
- func (s *Store) ProjectTags(ctx context.Context, projectID string) ([]ProjectTag, error)
- func (s *Store) RecalculateCosts(ctx context.Context, query PricingRecalculateQuery) (int, error)
- func (s *Store) RecordModelCall(ctx context.Context, input ModelCallInput) (string, error)
- func (s *Store) RegisterProject(ctx context.Context, name, slug, path string) (domain.Project, domain.ProjectLocation, error)
- func (s *Store) RegisteredPaths(ctx context.Context) (map[string]string, error)
- func (s *Store) RepairModelCallAllocation(ctx context.Context, modelCallID, projectID string) error
- func (s *Store) ReplaceAllocations(ctx context.Context, subjectType, subjectID string, ...) error
- func (s *Store) SetBudget(ctx context.Context, input BudgetInput) (BudgetRecord, error)
- func (s *Store) StartTask(ctx context.Context, input TaskInput) (string, error)
- func (s *Store) TaskSummary(ctx context.Context, id string) (TaskSummary, error)
- func (s *Store) UnattributedSummary(ctx context.Context) (UnattributedSummary, error)
- func (s *Store) Usage(ctx context.Context, query UsageQuery) (UsageReport, error)
- func (s *Store) VerifyAnchors(ctx context.Context, expected []LedgerAnchor) ([]AnchorMismatch, error)
- func (s *Store) VerifyLedger(ctx context.Context, sessionID string) error
- func (s *Store) Warnings() []string
- type TaskInput
- type TaskRecord
- type TaskSummary
- type UnattributedModelCall
- type UnattributedSummary
- type UsageQuery
- type UsageReport
- type UsageRow
- type WorkContextInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Checkpoint ¶ added in v0.2.0
Checkpoint validates and checkpoints a quiescent local ledger without migrations.
func ValidateAllocations ¶
func ValidateAllocations(allocations []AllocationInput) error
Types ¶
type Allocation ¶
type AllocationInput ¶
type AnchorMismatch ¶ added in v0.2.0
type BudgetAlert ¶ added in v0.2.0
type BudgetAlert struct {
BudgetRecord
AllocatedCostUSDMicros int64 `json:"allocated_cost_usd_micros"`
ThresholdUSDMicros int64 `json:"threshold_usd_micros"`
Alert string `json:"alert"`
}
type BudgetInput ¶ added in v0.2.0
type BudgetRecord ¶ added in v0.2.0
type CopilotOTLPEvidenceQuery ¶ added in v0.3.1
type ExportRecord ¶
type ExportRecord struct {
ID string `json:"id"`
OccurredAt time.Time `json:"occurred_at"`
ProjectSlug string `json:"project_slug"`
ProjectLocationPath string `json:"project_location_path,omitempty"`
Provider string `json:"provider"`
Model string `json:"model"`
Agent string `json:"agent"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
ReasoningTokens int64 `json:"reasoning_tokens"`
CachedInputTokens int64 `json:"cached_input_tokens"`
CacheWriteTokens int64 `json:"cache_write_tokens"`
TotalTokens int64 `json:"total_tokens"`
EstimatedCostUSDMicros int64 `json:"estimated_cost_usd_micros"`
CaptureQuality string `json:"capture_quality"`
Allocations []Allocation `json:"allocations"`
}
type LedgerAnchor ¶ added in v0.2.0
type ModelCallInput ¶
type ModelCallInput struct {
ProjectID string
ProjectLocationID string
WorkContextID string
TaskID string
SessionID string
TurnID string
Provider string
ModelID string
AgentName string
InputTokens int64
OutputTokens int64
ReasoningTokens int64
CachedInputTokens int64
CacheWriteTokens int64
EstimatedCostUSDMicros int64
EstimatedCostEURMicros int64
OccurredAt time.Time
CaptureQuality string
}
type PricingRuleRecord ¶
type ProjectReport ¶ added in v0.2.0
type ProjectReport struct {
Project ProjectSummary `json:"project"`
Tags []ProjectTag `json:"tags"`
ActiveTaskCount int64 `json:"active_task_count"`
ObservedModelCallCount int64 `json:"observed_model_call_count"`
ObservedTokens int64 `json:"observed_tokens"`
AllocatedCostUSDMicros int64 `json:"allocated_cost_usd_micros"`
BudgetAlerts []BudgetAlert `json:"budget_alerts"`
}
type ProjectSummary ¶
type ProjectTag ¶
type RawEventInput ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func OpenReadOnly ¶ added in v0.2.0
OpenReadOnly opens an initialized database without creating files or applying migrations.
func (*Store) AddPricingRule ¶
func (*Store) AddProjectTag ¶
func (*Store) AppendRawEvent ¶
func (*Store) AssignUnattributedModelCall ¶ added in v0.2.0
func (*Store) BudgetAlerts ¶ added in v0.2.0
func (*Store) CreateWorkContext ¶
func (s *Store) CreateWorkContext(ctx context.Context, input WorkContextInput) (domain.WorkContext, error)
func (*Store) EnsureSession ¶
func (*Store) ExportModelCalls ¶
func (s *Store) ExportModelCalls(ctx context.Context, query PricingRecalculateQuery) ([]ExportRecord, error)
func (*Store) HasRecentCopilotOTLPModelCall ¶ added in v0.3.1
func (*Store) LedgerAnchors ¶ added in v0.2.0
func (s *Store) LedgerAnchors(ctx context.Context) ([]LedgerAnchor, error)
func (*Store) ListPricingRules ¶
func (s *Store) ListPricingRules(ctx context.Context) ([]PricingRuleRecord, error)
func (*Store) ListProjects ¶
func (s *Store) ListProjects(ctx context.Context) ([]ProjectSummary, error)
func (*Store) ModelCallAllocations ¶
func (*Store) ProjectByLocation ¶ added in v0.2.0
func (*Store) ProjectBySlug ¶
func (*Store) ProjectReport ¶ added in v0.2.0
func (*Store) ProjectTags ¶
func (*Store) RecalculateCosts ¶
func (*Store) RecordModelCall ¶
func (*Store) RegisterProject ¶
func (*Store) RegisteredPaths ¶
func (*Store) RepairModelCallAllocation ¶
func (*Store) ReplaceAllocations ¶
func (*Store) SetBudget ¶ added in v0.2.0
func (s *Store) SetBudget(ctx context.Context, input BudgetInput) (BudgetRecord, error)
func (*Store) TaskSummary ¶ added in v0.2.0
func (*Store) UnattributedSummary ¶ added in v0.2.0
func (s *Store) UnattributedSummary(ctx context.Context) (UnattributedSummary, error)
UnattributedSummary intentionally reports calls without allocations. A manual repair or split removes a call from this queue without rewriting raw usage.
func (*Store) Usage ¶
func (s *Store) Usage(ctx context.Context, query UsageQuery) (UsageReport, error)
func (*Store) VerifyAnchors ¶ added in v0.2.0
func (s *Store) VerifyAnchors(ctx context.Context, expected []LedgerAnchor) ([]AnchorMismatch, error)
func (*Store) VerifyLedger ¶
type TaskRecord ¶
type TaskRecord struct {
ID string `json:"id"`
ProjectSlug string `json:"project_slug"`
Title string `json:"title"`
TaskType string `json:"task_type"`
Status string `json:"status"`
Result string `json:"result"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
}
type TaskSummary ¶ added in v0.2.0
type TaskSummary struct {
TaskRecord
ModelCallCount int64 `json:"model_call_count"`
ObservedTokens int64 `json:"observed_tokens"`
AllocatedCostUSDMicros int64 `json:"allocated_cost_usd_micros"`
}
TaskSummary reports task lifecycle data plus usage already recorded against it. It does not infer usage from an agent session or project.
type UnattributedModelCall ¶ added in v0.2.0
type UnattributedSummary ¶ added in v0.2.0
type UnattributedSummary struct {
ModelCallCount int64 `json:"model_call_count"`
ObservedTokens int64 `json:"observed_tokens"`
EstimatedCostUSDMicros int64 `json:"estimated_cost_usd_micros"`
ModelCalls []UnattributedModelCall `json:"model_calls"`
}
type UsageQuery ¶
type UsageReport ¶
type UsageRow ¶
type UsageRow struct {
ProjectSlug string `json:"project_slug"`
AgentName string `json:"agent_name"`
Provider string `json:"provider"`
Model string `json:"model"`
CaptureQuality string `json:"capture_quality"`
InputTokens int64 `json:"input_tokens"`
OutputTokens int64 `json:"output_tokens"`
ReasoningTokens int64 `json:"reasoning_tokens"`
CachedInputTokens int64 `json:"cached_input_tokens"`
CacheWriteTokens int64 `json:"cache_write_tokens"`
TotalTokens int64 `json:"total_tokens"`
AllocatedCostUSDMicros int64 `json:"allocated_cost_usd_micros"`
}
Click to show internal directories.
Click to hide internal directories.