Documentation
¶
Index ¶
- func EstimateMessageTokens(msg provider.Message) int
- func EstimateMessagesTokens(messages []provider.Message) int
- func EstimateSystemPromptTokens(prompt string) int
- func EstimateTokens(text string) int
- func GetContextWindow(models []provider.ModelInfo, modelID string) int
- func IsApproachingLimit(usedTokens, contextWindow int, threshold float64) bool
- type Agent
- type Config
- type ContextManager
- func (cm *ContextManager) CheckAndCompress(ctx context.Context, sessionID string, model string, ...) ([]provider.Message, error)
- func (cm *ContextManager) EstimateCurrentUsage(messages []provider.Message, systemPrompt string) int
- func (cm *ContextManager) GetTokenUsage(sessionID string) TokenUsageData
- func (cm *ContextManager) TrackUsage(sessionID string, usage provider.Usage)
- type ForwardingEventBus
- type SilentEventBus
- type SubAgent
- type SubAgentConfig
- type SummarizeData
- type Summarizer
- type TokenUsageData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EstimateMessageTokens ¶
func EstimateMessagesTokens ¶
func EstimateTokens ¶
func IsApproachingLimit ¶
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent is the core AI coding agent that runs the conversation loop.
func New ¶
func New( client *llm.Client, store session.SessionStore, registry tool.ToolRegistry, perm *permission.Service, bus event.EventBus, ) *Agent
New creates a new Agent.
func (*Agent) Run ¶
Run executes the agent loop for a user prompt. It creates/reuses a session, runs the LLM, executes tools, and repeats until the LLM stops requesting tool calls.
func (*Agent) WithSkills ¶
func (a *Agent) WithSkills(registry skill.SkillRegistry)
type Config ¶
type Config struct {
Model string
MaxTokens int
SystemPrompt string
MaxIterations int
ToolsEnabled bool
}
Config holds agent configuration.
type ContextManager ¶
type ContextManager struct {
// contains filtered or unexported fields
}
func NewContextManager ¶
func NewContextManager(store session.SessionStore, bus event.EventBus, client *llm.Client) *ContextManager
func (*ContextManager) CheckAndCompress ¶
func (*ContextManager) EstimateCurrentUsage ¶
func (cm *ContextManager) EstimateCurrentUsage(messages []provider.Message, systemPrompt string) int
func (*ContextManager) GetTokenUsage ¶
func (cm *ContextManager) GetTokenUsage(sessionID string) TokenUsageData
func (*ContextManager) TrackUsage ¶
func (cm *ContextManager) TrackUsage(sessionID string, usage provider.Usage)
type ForwardingEventBus ¶
type ForwardingEventBus struct {
// contains filtered or unexported fields
}
func NewForwardingEventBus ¶
func NewForwardingEventBus(parent event.EventBus, prefix string) *ForwardingEventBus
func (*ForwardingEventBus) Close ¶
func (f *ForwardingEventBus) Close()
func (*ForwardingEventBus) Publish ¶
func (f *ForwardingEventBus) Publish(evt event.Event)
func (*ForwardingEventBus) Subscribe ¶
func (f *ForwardingEventBus) Subscribe(event.EventHandler) func()
type SilentEventBus ¶
type SilentEventBus struct{}
func (*SilentEventBus) Close ¶
func (s *SilentEventBus) Close()
func (*SilentEventBus) Publish ¶
func (s *SilentEventBus) Publish(event.Event)
func (*SilentEventBus) Subscribe ¶
func (s *SilentEventBus) Subscribe(event.EventHandler) func()
type SubAgent ¶
type SubAgent struct {
// contains filtered or unexported fields
}
func NewSubAgent ¶
func NewSubAgent( prov provider.Provider, store session.SessionStore, config SubAgentConfig, allTools []tool.Tool, ) *SubAgent
func (*SubAgent) SetParentBus ¶
type SubAgentConfig ¶
type SummarizeData ¶
type Summarizer ¶
type Summarizer struct {
// contains filtered or unexported fields
}
func NewSummarizer ¶
func NewSummarizer(client chatCaller, bus event.EventBus) *Summarizer
Click to show internal directories.
Click to hide internal directories.