Versions in this module Expand all Collapse all v0 v0.2.1 May 16, 2026 v0.2.0 May 16, 2026 v0.1.3 Jul 4, 2026 v0.1.1 Jun 25, 2026 Changes in this version + var ErrBudgetExceeded = errors.New("eyrie: virtual key budget exceeded") + var ErrUnknownVirtualKey = errors.New("eyrie: unknown virtual key") + type Alias struct + Alias string + NodeID string + type AnalyticsStore interface + GetCostSummary func(ctx context.Context, since time.Time) ([]UsageStats, error) + GetProviderHealth func(ctx context.Context, since time.Time) ([]ProviderHealthRecord, error) + GetUsageStats func(ctx context.Context, since time.Time) ([]UsageStats, error) + RecordCost func(ctx context.Context, rec *CostRecord) error + type BudgetStore struct + func OpenBudgetStore(path string) (*BudgetStore, error) + func (s *BudgetStore) CheckBudget(ctx context.Context, virtualKey string, estCostUSD float64) error + func (s *BudgetStore) Close() error + func (s *BudgetStore) CreateVirtualKey(ctx context.Context, id, name, provider string, limitUSD float64) error + func (s *BudgetStore) Get(ctx context.Context, virtualKey string) (*VirtualKey, error) + func (s *BudgetStore) ProviderSecret(ctx context.Context, virtualKey, provider string) (string, error) + func (s *BudgetStore) RecordUsage(ctx context.Context, virtualKey string, costUSD float64, ...) error + func (s *BudgetStore) SetProviderSecret(ctx context.Context, virtualKey, provider, apiKey string) error + type CostRecord struct + CacheCreationTokens int + CacheReadTokens int + CostUSD float64 + CreatedAt time.Time + ID int64 + InputTokens int + LatencyMs int + Model string + OutputTokens int + Provider string + type DAG struct + func NewDAG(dbPath string, sessionID string) (*DAG, error) + func NewDAGFromStore(store Store, sessionID string) *DAG + func (d *DAG) Append(ctx context.Context, parentID string, role string, content string) (*DAGNode, error) + func (d *DAG) Branches(ctx context.Context, nodeID string) ([]*DAGNode, error) + func (d *DAG) Close() error + func (d *DAG) Fork(ctx context.Context, nodeID string) (*DAGNode, error) + func (d *DAG) Head(ctx context.Context) (*DAGNode, error) + func (d *DAG) History(ctx context.Context, nodeID string) ([]*DAGNode, error) + func (d *DAG) Prune(ctx context.Context, nodeID string) error + func (d *DAG) SetHead(ctx context.Context, nodeID string) error + type DAGNode struct + Content string + CreatedAt time.Time + ID string + Metadata map[string]string + Model string + ParentID string + Role string + type Node struct + Content string + CreatedAt time.Time + ID string + LatencyMs int + Metadata json.RawMessage + Model string + NodeType NodeType + OutputGroupID string + ParentID string + Provider string + RootID string + Sequence int + Status string + StopReason string + SystemPrompt string + Title string + TokensCacheCreation int + TokensCacheRead int + TokensIn int + TokensOut int + TokensReasoning int + type NodeType string + const NodeTypeAssistant + const NodeTypeSystem + const NodeTypeToolCall + const NodeTypeToolResult + const NodeTypeUser + type Option func(*openConfig) + func WithMaxOpenConns(n int) Option + type ProviderHealthRecord struct + AvgLatencyMs float64 + ErrorCount int + ErrorRate float64 + LastRequestAt time.Time + P50LatencyMs float64 + P95LatencyMs float64 + P99LatencyMs float64 + Provider string + RequestCount int + type SQLiteAnalyticsStore struct + func NewSQLiteAnalyticsStore(s *SQLiteStore) *SQLiteAnalyticsStore + func NewSQLiteAnalyticsStoreFromDB(db *sql.DB) *SQLiteAnalyticsStore + func (a *SQLiteAnalyticsStore) GetCostSummary(ctx context.Context, since time.Time) ([]UsageStats, error) + func (a *SQLiteAnalyticsStore) GetProviderHealth(ctx context.Context, since time.Time) ([]ProviderHealthRecord, error) + func (a *SQLiteAnalyticsStore) GetUsageStats(ctx context.Context, since time.Time) ([]UsageStats, error) + func (a *SQLiteAnalyticsStore) MigrateAnalytics() error + func (a *SQLiteAnalyticsStore) RecordCost(ctx context.Context, rec *CostRecord) error + type SQLiteStore struct + func Open(path string, opts ...Option) (*SQLiteStore, error) + func (s *SQLiteStore) Close() error + func (s *SQLiteStore) CreateAlias(ctx context.Context, alias, nodeID string) error + func (s *SQLiteStore) CreateNode(ctx context.Context, node *Node) error + func (s *SQLiteStore) DeleteAlias(ctx context.Context, alias string) error + func (s *SQLiteStore) DeleteNode(ctx context.Context, id string) error + func (s *SQLiteStore) GetAncestors(ctx context.Context, id string) ([]*Node, error) + func (s *SQLiteStore) GetNode(ctx context.Context, id string) (*Node, error) + func (s *SQLiteStore) GetNodeByAlias(ctx context.Context, alias string) (*Node, error) + func (s *SQLiteStore) GetNodeByPrefix(ctx context.Context, prefix string) (*Node, error) + func (s *SQLiteStore) GetNodeChildren(ctx context.Context, id string) ([]*Node, error) + func (s *SQLiteStore) GetOrphanedToolUses(ctx context.Context, ancestorIDs []string) (map[string][]string, error) + func (s *SQLiteStore) GetSubtree(ctx context.Context, id string) ([]*Node, error) + func (s *SQLiteStore) IndexToolIDs(ctx context.Context, nodeID string, toolIDs []string, role string) error + func (s *SQLiteStore) ListAliases(ctx context.Context, nodeID string) ([]Alias, error) + func (s *SQLiteStore) ListRootNodes(ctx context.Context) ([]*Node, error) + func (s *SQLiteStore) UpdateNode(ctx context.Context, node *Node) error + type Store interface + Close func() error + CreateAlias func(ctx context.Context, alias, nodeID string) error + CreateNode func(ctx context.Context, node *Node) error + DeleteAlias func(ctx context.Context, alias string) error + DeleteNode func(ctx context.Context, id string) error + GetAncestors func(ctx context.Context, id string) ([]*Node, error) + GetNode func(ctx context.Context, id string) (*Node, error) + GetNodeByAlias func(ctx context.Context, alias string) (*Node, error) + GetNodeByPrefix func(ctx context.Context, prefix string) (*Node, error) + GetNodeChildren func(ctx context.Context, id string) ([]*Node, error) + GetOrphanedToolUses func(ctx context.Context, ancestorIDs []string) (map[string][]string, error) + GetSubtree func(ctx context.Context, id string) ([]*Node, error) + IndexToolIDs func(ctx context.Context, nodeID string, toolIDs []string, role string) error + ListAliases func(ctx context.Context, nodeID string) ([]Alias, error) + ListRootNodes func(ctx context.Context) ([]*Node, error) + UpdateNode func(ctx context.Context, node *Node) error + type UsageStats struct + AvgLatencyMs float64 + ErrorCount int + ErrorRate float64 + Model string + Provider string + RequestCount int + TotalCacheCreation int + TotalCacheRead int + TotalCostUSD float64 + TotalInputTokens int + TotalOutputTokens int + type VirtualKey struct + CreatedAt time.Time + ID string + LimitUSD float64 + Name string + Provider string + TokensIn int + TokensOut int + UsedUSD float64