Documentation
¶
Index ¶
- func DetectResponseLanguage(userText, preferred, last string) string
- func ExtractLanguagePreference(text string) string
- type AgentLoop
- func (al *AgentLoop) DispatchNodeRequest(ctx context.Context, req nodes.Request, mode string) (nodes.Response, error)
- func (al *AgentLoop) GetSessionHistory(sessionKey string) []providers.Message
- func (al *AgentLoop) GetStartupInfo() map[string]interface{}
- func (al *AgentLoop) GetToolCatalog() []map[string]interface{}
- func (al *AgentLoop) HandleSubagentRuntime(ctx context.Context, action string, args map[string]interface{}) (interface{}, error)
- 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) SetConfigPath(path string)
- func (al *AgentLoop) SetNodeP2PTransport(t nodes.Transport)
- func (al *AgentLoop) Stop()
- type ContextBuilder
- func (cb *ContextBuilder) AddAssistantMessage(messages []providers.Message, content string, ...) []providers.Message
- func (cb *ContextBuilder) AddToolResult(messages []providers.Message, toolCallID, toolName, result string) []providers.Message
- 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) BuildSystemPrompt() string
- 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 MemoryStore
- func (ms *MemoryStore) AppendToday(content string) error
- func (ms *MemoryStore) GetMemoryContext() string
- func (ms *MemoryStore) GetRecentDailyNotes(days int) string
- func (ms *MemoryStore) ReadLongTerm() string
- func (ms *MemoryStore) ReadToday() string
- func (ms *MemoryStore) WriteLongTerm(content string) error
- 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) DispatchNodeRequest ¶
func (*AgentLoop) GetSessionHistory ¶
func (*AgentLoop) GetStartupInfo ¶
func (*AgentLoop) GetToolCatalog ¶
func (*AgentLoop) HandleSubagentRuntime ¶
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) SetConfigPath ¶
func (*AgentLoop) SetNodeP2PTransport ¶
type ContextBuilder ¶
type ContextBuilder struct {
// contains filtered or unexported fields
}
func NewContextBuilder ¶
func NewContextBuilder(workspace string, toolsSummaryFunc func() []string) *ContextBuilder
func (*ContextBuilder) AddAssistantMessage ¶
func (*ContextBuilder) AddToolResult ¶
func (*ContextBuilder) BuildMessages ¶
func (*ContextBuilder) BuildMessagesWithMemoryNamespace ¶
func (*ContextBuilder) BuildSystemPrompt ¶
func (cb *ContextBuilder) BuildSystemPrompt() string
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 MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
MemoryStore manages persistent memory for the agent. - Long-term memory: MEMORY.md (workspace root, compatible with OpenClaw) - Daily notes: memory/YYYY-MM-DD.md It also supports legacy locations for backward compatibility.
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.
func (*MemoryStore) ReadToday ¶
func (ms *MemoryStore) ReadToday() string
ReadToday reads today's daily note. Returns empty string if the file doesn't exist.
func (*MemoryStore) WriteLongTerm ¶
func (ms *MemoryStore) WriteLongTerm(content string) error
WriteLongTerm writes content to the long-term memory file (MEMORY.md).
type SessionScheduler ¶
type SessionScheduler struct {
// contains filtered or unexported fields
}
func NewSessionScheduler ¶
func NewSessionScheduler(maxParallel int) *SessionScheduler
func (*SessionScheduler) Close ¶
func (s *SessionScheduler) Close()
type StartupCompactionReport ¶
type StartupCompactionReport struct {
TotalSessions int `json:"total_sessions"`
CompactedSessions int `json:"compacted_sessions"`
}
StartupCompactionReport provides startup memory/session maintenance stats.