Documentation
¶
Index ¶
- func DeleteModelCapability(database *db.DB, modelID string) error
- func DeleteModelPreference(database *db.DB, id string) error
- func Now() int64
- func SetCallGraphAgentConfig(database *db.DB, c *CallGraphAgentConfig) error
- func SetMemoryConfig(database *db.DB, c *MemoryConfig) error
- func SetModelCapability(database *db.DB, c *ModelCapability) error
- func SetModelPreference(database *db.DB, p *ModelPreference) error
- func SetProviderConfig(database *db.DB, c *ProviderConfig) error
- type CallGraphAgentConfig
- type MemoryConfig
- type MessageID
- type MessageInfo
- type MessageRole
- type MessageWithParts
- type ModelCapability
- type ModelPreference
- type ModelPreferenceStore
- type Part
- type PartID
- type PartType
- type PermissionID
- type ProviderConfig
- type ReasoningPartData
- type Session
- type SessionID
- type Store
- func (s *Store) Create(session *Session) error
- func (s *Store) CreateMessage(msg *MessageInfo) error
- func (s *Store) CreatePart(part *Part) error
- func (s *Store) DB() *db.DB
- func (s *Store) Delete(id SessionID) error
- func (s *Store) Get(id SessionID) (*Session, error)
- func (s *Store) GetMessage(messageID MessageID) (*MessageWithParts, error)
- func (s *Store) GetMessages(sessionID SessionID, before MessageID, limit int) ([]*MessageWithParts, error)
- func (s *Store) GetPart(partID PartID) (*Part, error)
- func (s *Store) GetParts(messageID MessageID) ([]Part, error)
- func (s *Store) List(directory string) ([]*Session, error)
- func (s *Store) Update(session *Session) error
- func (s *Store) UpdateCompactionSummary(id SessionID, summary string) error
- func (s *Store) UpdateMemoryTokensSaved(id SessionID, delta int) error
- func (s *Store) UpdateMessage(msg *MessageInfo) error
- func (s *Store) UpdatePart(part *Part) error
- type TextPartData
- type TokenCounts
- type ToolImage
- type ToolPartData
- type ToolState
- type ToolStatus
- type ToolTime
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteModelCapability ¶ added in v0.6.0
DeleteModelCapability clears a model's cached capability so it is re-probed on next use. An empty modelID clears every cached capability. Used by the manual-refresh path.
func DeleteModelPreference ¶
DeleteModelPreference removes a model preference from the database.
func SetCallGraphAgentConfig ¶ added in v0.5.0
func SetCallGraphAgentConfig(database *db.DB, c *CallGraphAgentConfig) error
SetCallGraphAgentConfig upserts the singleton config row.
func SetMemoryConfig ¶ added in v0.2.1
func SetMemoryConfig(database *db.DB, c *MemoryConfig) error
SetMemoryConfig upserts the agentic-memory config row (id is always 1).
func SetModelCapability ¶ added in v0.6.0
func SetModelCapability(database *db.DB, c *ModelCapability) error
SetModelCapability upserts a probed capability record for a model.
func SetModelPreference ¶
func SetModelPreference(database *db.DB, p *ModelPreference) error
SetModelPreference upserts a model preference into the database.
func SetProviderConfig ¶ added in v0.2.1
func SetProviderConfig(database *db.DB, c *ProviderConfig) error
SetProviderConfig upserts a provider config row.
Types ¶
type CallGraphAgentConfig ¶ added in v0.5.0
type CallGraphAgentConfig struct {
Enabled bool `json:"enabled"`
}
CallGraphAgentConfig holds the global toggle for callgraph agent instructions.
func GetCallGraphAgentConfig ¶ added in v0.5.0
func GetCallGraphAgentConfig(database *db.DB) (*CallGraphAgentConfig, error)
GetCallGraphAgentConfig returns the stored config. If no row exists, returns the default (enabled = true).
type MemoryConfig ¶ added in v0.2.1
type MemoryConfig struct {
Enabled bool `json:"enabled"`
EmbedProviderID string `json:"embedProviderId"`
EmbedModel string `json:"embedModel"`
EmbedAPIKey string `json:"embedApiKey"`
ChatProviderID string `json:"chatProviderId"`
ChatModel string `json:"chatModel"`
ChatAPIKey string `json:"chatApiKey"`
UpdatedAt int64 `json:"updatedAt"`
}
MemoryConfig holds the user's agentic-memory configuration stored in the DB.
func GetMemoryConfig ¶ added in v0.2.1
func GetMemoryConfig(database *db.DB) (*MemoryConfig, error)
GetMemoryConfig returns the stored agentic-memory config. If the row does not exist, it returns a zero-value config (disabled, empty fields).
func MaskedMemoryConfig ¶ added in v0.2.1
func MaskedMemoryConfig(c *MemoryConfig) *MemoryConfig
MaskedMemoryConfig returns a copy of c with API keys replaced by a sentinel so they can be safely sent to the UI.
type MessageInfo ¶
type MessageInfo struct {
ID MessageID `json:"id"`
SessionID SessionID `json:"sessionId"`
Role MessageRole `json:"role"`
Agent string `json:"agent,omitempty"`
ParentID *MessageID `json:"parentId,omitempty"`
Finish *string `json:"finish,omitempty"`
Cost float64 `json:"cost,omitempty"`
Tokens *TokenCounts `json:"tokens,omitempty"`
Error *string `json:"error,omitempty"`
CreatedAt int64 `json:"createdAt"`
}
type MessageRole ¶
type MessageRole string
const ( RoleUser MessageRole = "user" RoleAssistant MessageRole = "assistant" )
type MessageWithParts ¶
type MessageWithParts struct {
Info MessageInfo `json:"info"`
Parts []Part `json:"parts"`
}
type ModelCapability ¶ added in v0.6.0
type ModelCapability struct {
ModelID string `json:"modelId"`
SupportsImages bool `json:"supportsImages"`
ProbedAt int64 `json:"probedAt"`
}
ModelCapability is a probed/known capability record for a model, persisted so the image-support probe runs at most once per model (until manually refreshed).
func GetModelCapability ¶ added in v0.6.0
GetModelCapability returns the persisted capability record for a model. The second return value is false when no record exists (not yet probed).
type ModelPreference ¶
type ModelPreference struct {
ID string `json:"id"`
Enabled bool `json:"enabled"`
ProviderID string `json:"providerId"`
DisplayName string `json:"displayName"`
IsCustom bool `json:"isCustom"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
func GetModelPreferences ¶
func GetModelPreferences(database *db.DB) ([]*ModelPreference, error)
GetModelPreferences returns all model preference overrides from the database.
type ModelPreferenceStore ¶
type ModelPreferenceStore struct{}
type PermissionID ¶
type PermissionID = id.PermissionID
func NewPermissionID ¶
func NewPermissionID() PermissionID
type ProviderConfig ¶ added in v0.2.1
type ProviderConfig struct {
ProviderID string `json:"providerId"`
APIKey string `json:"apiKey"`
BaseURL string `json:"baseUrl"`
UpdatedAt int64 `json:"updatedAt"`
}
ProviderConfig holds credentials for a single LLM provider stored in the DB.
func GetAllProviderConfigs ¶ added in v0.2.1
func GetAllProviderConfigs(database *db.DB) ([]*ProviderConfig, error)
GetAllProviderConfigs returns stored configs for all providers.
func GetProviderConfig ¶ added in v0.2.1
func GetProviderConfig(database *db.DB, providerID string) (*ProviderConfig, error)
GetProviderConfig returns the stored config for a provider. Returns a zero-value config (empty fields) when no row exists.
func MaskedProviderConfig ¶ added in v0.2.1
func MaskedProviderConfig(c *ProviderConfig) *ProviderConfig
MaskedProviderConfig returns a copy with the API key replaced by a sentinel so it can be sent to the UI without leaking the real value.
type ReasoningPartData ¶
type ReasoningPartData struct {
Text string `json:"text"`
}
type Session ¶
type Session struct {
ID SessionID `json:"id"`
ProjectID string `json:"projectId"`
Directory string `json:"directory"`
Title string `json:"title"`
Model string `json:"model,omitempty"`
SessionType string `json:"sessionType,omitempty"`
Permission string `json:"permission,omitempty"`
CompactionSummary string `json:"compactionSummary,omitempty"`
MemoryTokensSaved int `json:"memoryTokensSaved,omitempty"`
CreatedAt int64 `json:"createdAt"`
UpdatedAt int64 `json:"updatedAt"`
}
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func (*Store) CreateMessage ¶
func (s *Store) CreateMessage(msg *MessageInfo) error
func (*Store) CreatePart ¶
func (*Store) DB ¶ added in v0.6.0
DB returns the underlying database handle, used by helpers that operate on other tables (e.g. model capability records).
func (*Store) GetMessage ¶
func (s *Store) GetMessage(messageID MessageID) (*MessageWithParts, error)
func (*Store) GetMessages ¶
func (*Store) UpdateCompactionSummary ¶
UpdateCompactionSummary updates only the compaction_summary column for a session, avoiding the race condition of overwriting other fields (e.g., title, model) that may have changed concurrently.
func (*Store) UpdateMemoryTokensSaved ¶ added in v0.2.1
UpdateMemoryTokensSaved atomically increments memory_tokens_saved by delta (may be negative). delta is clamped above at 1_000_000_000 to prevent overflow; negative values are preserved so callers can track memory overhead accurately.
func (*Store) UpdateMessage ¶
func (s *Store) UpdateMessage(msg *MessageInfo) error
func (*Store) UpdatePart ¶
type TextPartData ¶
type TextPartData struct {
Text string `json:"text"`
}
type TokenCounts ¶
type ToolImage ¶ added in v0.6.0
ToolImage is an image produced by a tool, persisted so the model can be re-sent the image on history replay. Data is base64-encoded image bytes.
type ToolPartData ¶
type ToolState ¶
type ToolState struct {
Status ToolStatus `json:"status"`
Input json.RawMessage `json:"input"`
Output *string `json:"output,omitempty"`
Error *string `json:"error,omitempty"`
Title *string `json:"title,omitempty"`
Metadata json.RawMessage `json:"metadata,omitempty"`
Image *ToolImage `json:"image,omitempty"`
Time ToolTime `json:"time"`
}
type ToolStatus ¶
type ToolStatus string
const ( ToolPending ToolStatus = "pending" ToolRunning ToolStatus = "running" ToolCompleted ToolStatus = "completed" ToolError ToolStatus = "error" )