Documentation
¶
Index ¶
- func DetectResponseLanguage(userText, preferred, last string) string
- func ExtractLanguagePreference(text string) string
- type AgentLoop
- func (al *AgentLoop) DispatchSubagentAndWait(ctx context.Context, req tools.RouterDispatchRequest, ...) (string, error)
- func (al *AgentLoop) GetSessionHistory(sessionKey string) []providers.Message
- func (al *AgentLoop) GetSessionHistoryWindow(sessionKey string, around, before, after, limit int) []providers.Message
- func (al *AgentLoop) GetStartupInfo() map[string]interface{}
- func (al *AgentLoop) GetToolCatalog() []map[string]interface{}
- func (al *AgentLoop) ProcessDirect(ctx context.Context, content, sessionKey string) (string, error)
- func (al *AgentLoop) ProcessDirectWithOptions(ctx context.Context, ...) (string, error)
- func (al *AgentLoop) Run(ctx context.Context) error
- func (al *AgentLoop) RunStartupSelfCheckAllSessions(ctx context.Context) StartupCompactionReport
- func (al *AgentLoop) SearchSessions(query string, kinds []string, excludeKey string, limit int) []session.SessionSearchResult
- func (al *AgentLoop) SetConfigPath(path string)
- func (al *AgentLoop) SetContextEngine(engine ContextEngine)
- func (al *AgentLoop) Stop()
- type ContextBuildRequest
- type ContextBuilder
- func (cb *ContextBuilder) BuildMessages(history []providers.Message, summary string, currentMessage string, ...) []providers.Message
- func (cb *ContextBuilder) BuildMessagesWithMemoryNamespace(history []providers.Message, summary string, currentMessage string, ...) []providers.Message
- func (cb *ContextBuilder) BuildSystemPromptWithMemoryNamespace(memoryNamespace string) string
- func (cb *ContextBuilder) GetSkillsInfo() map[string]interface{}
- func (cb *ContextBuilder) LoadBootstrapFiles() string
- func (cb *ContextBuilder) LoadProjectPlanningFiles() string
- type ContextEngine
- type MemoryStore
- type SessionScheduler
- type StartupCompactionReport
- type TriggerStats
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DetectResponseLanguage ¶
DetectResponseLanguage returns a BCP-47 style language tag for reply policy. Priority: explicit preference > current user text > last session language > default English.
func ExtractLanguagePreference ¶
ExtractLanguagePreference detects explicit user instructions for language switch.
Types ¶
type AgentLoop ¶
type AgentLoop struct {
// contains filtered or unexported fields
}
func NewAgentLoop ¶
func NewAgentLoop(cfg *config.Config, msgBus *bus.MessageBus, provider providers.LLMProvider, cs *cron.CronService) *AgentLoop
func (*AgentLoop) DispatchSubagentAndWait ¶ added in v1.0.0
func (*AgentLoop) GetSessionHistory ¶
func (*AgentLoop) GetSessionHistoryWindow ¶ added in v1.1.0
func (*AgentLoop) GetStartupInfo ¶
func (*AgentLoop) GetToolCatalog ¶
func (*AgentLoop) ProcessDirect ¶
func (*AgentLoop) ProcessDirectWithOptions ¶
func (*AgentLoop) RunStartupSelfCheckAllSessions ¶
func (al *AgentLoop) RunStartupSelfCheckAllSessions(ctx context.Context) StartupCompactionReport
RunStartupSelfCheckAllSessions runs startup compaction checks across loaded sessions.
func (*AgentLoop) SearchSessions ¶ added in v1.1.0
func (*AgentLoop) SetConfigPath ¶
func (*AgentLoop) SetContextEngine ¶ added in v1.2.0
func (al *AgentLoop) SetContextEngine(engine ContextEngine)
type ContextBuildRequest ¶ added in v1.2.0
type ContextBuildRequest struct {
History []providers.Message
Summary string
CurrentMessage string
Media []string
Channel string
ChatID string
ResponseLanguage string
MemoryNamespace string
}
ContextBuildRequest defines inputs for building a provider message window.
type ContextBuilder ¶
type ContextBuilder struct {
// contains filtered or unexported fields
}
func NewContextBuilder ¶
func NewContextBuilder(workspace string, toolsSummaryFunc func() []string) *ContextBuilder
func (*ContextBuilder) BuildMessages ¶
func (*ContextBuilder) BuildMessagesWithMemoryNamespace ¶
func (*ContextBuilder) BuildSystemPromptWithMemoryNamespace ¶
func (cb *ContextBuilder) BuildSystemPromptWithMemoryNamespace(memoryNamespace string) string
func (*ContextBuilder) GetSkillsInfo ¶
func (cb *ContextBuilder) GetSkillsInfo() map[string]interface{}
GetSkillsInfo returns information about loaded skills.
func (*ContextBuilder) LoadBootstrapFiles ¶
func (cb *ContextBuilder) LoadBootstrapFiles() string
func (*ContextBuilder) LoadProjectPlanningFiles ¶
func (cb *ContextBuilder) LoadProjectPlanningFiles() string
type ContextEngine ¶ added in v1.2.0
type ContextEngine interface {
BuildMessages(req ContextBuildRequest) []providers.Message
SkillsInfo() map[string]interface{}
}
ContextEngine allows swapping context-assembly behavior without touching AgentLoop flow.
func NewDefaultContextEngine ¶ added in v1.2.0
func NewDefaultContextEngine(builder *ContextBuilder) ContextEngine
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore manages persistent memory for the agent. - Long-term memory: MEMORY.md - Daily notes: memory/YYYY-MM-DD.md
func NewMemoryStore ¶
func NewMemoryStore(workspace string) *MemoryStore
NewMemoryStore creates a new MemoryStore with the given workspace path. It ensures the memory directory exists.
func NewMemoryStoreWithNamespace ¶
func NewMemoryStoreWithNamespace(workspace, namespace string) *MemoryStore
func (*MemoryStore) AppendToday ¶
func (ms *MemoryStore) AppendToday(content string) error
AppendToday appends content to today's daily note. If the file doesn't exist, it creates a new file with a date header.
func (*MemoryStore) GetMemoryContext ¶
func (ms *MemoryStore) GetMemoryContext() string
GetMemoryContext returns formatted memory context for the agent prompt. Includes long-term memory and recent daily notes.
func (*MemoryStore) GetRecentDailyNotes ¶
func (ms *MemoryStore) GetRecentDailyNotes(days int) string
GetRecentDailyNotes returns daily notes from the last N days. Contents are joined with "---" separator.
func (*MemoryStore) ReadLongTerm ¶
func (ms *MemoryStore) ReadLongTerm() string
ReadLongTerm reads the long-term memory (MEMORY.md). Returns empty string if the file doesn't exist.
type SessionScheduler ¶
type SessionScheduler struct {
// contains filtered or unexported fields
}
func NewSessionScheduler ¶
func NewSessionScheduler(maxParallel int) *SessionScheduler
type StartupCompactionReport ¶
type StartupCompactionReport struct {
TotalSessions int `json:"total_sessions"`
CompactedSessions int `json:"compacted_sessions"`
}
StartupCompactionReport provides startup memory/session maintenance stats.