Versions in this module Expand all Collapse all v0 v0.2.0 May 18, 2026 Changes in this version + const DefaultBlobMaxTotal + const DefaultBlobTTL + const EventChunk + const EventInbox + const EventThinkDone + const EventThinkError + const EventThreadDone + const EventThreadStart + const EventToolChunk + const MaxSpawnDepth + var BuildTime = "dev" + var ErrRealtimeNotImplemented = errors.New("realtime provider not implemented yet") + var ErrStreamIdleTimeout = errors.New("stream idle timeout (provider went silent mid-response)") + var GeminiModelOrder = []string + var Version = "dev" + func BuildMCPBinary(t *testing.T, dir string) string + func ChatContainsAny(replies []ChatReply, keywords ...string) bool + func CountTool(entries []ScenarioAuditEntry, tool string) int + func ModelContextWindow(modelID string) int + func Run() + func RunScenario(t *testing.T, s Scenario) + func SetVersion(version, buildTime string) + func ThreadIDs(th *Thinker) []string + func WaitFor(t *testing.T, timeout, interval time.Duration, desc string, cond func() bool) + func WriteJSONFile(t *testing.T, dir, name string, v any) + type APIEvent struct + Duration string + Iteration int + Message string + ThreadID string + Time time.Time + Type string + type APIServer struct + type AnthropicProvider struct + func (p *AnthropicProvider) AvailableBuiltinTools() []BuiltinTool + func (p *AnthropicProvider) Chat(ctx context.Context, messages []Message, model string, tools []NativeTool, ...) (ChatResponse, error) + func (p *AnthropicProvider) CostPer1M() (float64, float64, float64) + func (p *AnthropicProvider) Models() map[ModelTier]string + func (p *AnthropicProvider) Name() string + func (p *AnthropicProvider) SetBuiltinTools(tools []string) + func (p *AnthropicProvider) SupportsNativeTools() bool + func (p *AnthropicProvider) WithBuiltins(builtins []string) LLMProvider + type AudioFormat string + const AudioG711ALaw + const AudioG711ULaw + const AudioPCM16 + type AudioURL struct + MimeType string + URL string + type BlobStore struct + func NewBlobStore(maxTotal int64, ttl time.Duration) *BlobStore + func (bs *BlobStore) Close() + func (bs *BlobStore) Count() int + func (bs *BlobStore) Get(ref string) ([]byte, string, bool) + func (bs *BlobStore) Put(mime string, data []byte) string + func (bs *BlobStore) RehydrateFileRefs(args map[string]string) map[string]string + func (bs *BlobStore) RewriteBinaryToHandle(text string) string + type BuiltinTool struct + Name string + Type string + type ChatReply struct + Message string + User string + func ReadChatReplies(dir string) []ChatReply + type ChatResponse struct + Reasoning string + ServerResults []ServerToolResult + Text string + ToolCalls []NativeToolCall + Usage TokenUsage + type ComputerConfig struct + APIKey string + Height int + ProjectID string + Type string + URL string + Width int + type Config struct + Computer *ComputerConfig + Directive string + MCPServers []MCPServerConfig + Mode RunMode + Provider *ProviderConfig + Providers []ProviderConfig + RealtimeEnabled bool + Threads []PersistentThread + Unconscious bool + func NewConfig() *Config + func (c *Config) ClearThreads() + func (c *Config) GetDefaultProvider() *ProviderConfig + func (c *Config) GetDirective() string + func (c *Config) GetMCPServers() []MCPServerConfig + func (c *Config) GetMode() RunMode + func (c *Config) GetProvider() *ProviderConfig + func (c *Config) GetProviderByName(name string) *ProviderConfig + func (c *Config) GetProviders() []ProviderConfig + func (c *Config) GetThreads() []PersistentThread + func (c *Config) RealtimeEnabledFlag() bool + func (c *Config) RemoveMCPServer(name string) + func (c *Config) RemoveProvider(name string) + func (c *Config) RemoveThread(id string) + func (c *Config) Save() error + func (c *Config) SaveMCPServer(cfg MCPServerConfig) + func (c *Config) SaveThread(pt PersistentThread) + func (c *Config) SetDefaultProvider(name string) + func (c *Config) SetDirective(d string) + func (c *Config) SetMode(m RunMode) + func (c *Config) SetProvider(pc *ProviderConfig) + func (c *Config) SetProviderModel(tier string, modelID string) + func (c *Config) SetProviderName(name string) + type ConsoleLogger struct + func NewConsoleLogger(t *Telemetry) *ConsoleLogger + func (c *ConsoleLogger) Run() + type ContentPart struct + AudioURL *AudioURL + ImageURL *ImageURL + InputAudio *InputAudio + Text string + Type string + type Delta struct + Content string + type DirectiveChangeData struct + New string + Old string + type Event struct + ConsumedEvents []string + ContextChars int + ContextMsgs int + Duration time.Duration + Error error + From string + Iteration int + MemoryCount int + Model ModelTier + Parts []ContentPart + Rate ThinkRate + Replies []string + SleepDuration time.Duration + Text string + ThreadCount int + To string + ToolCalls []string + ToolName string + ToolResult *ToolResult + Type string + Usage TokenUsage + type EventBus struct + func NewEventBus() *EventBus + func (b *EventBus) DropStats() map[string]uint64 + func (b *EventBus) Publish(ev Event) + func (b *EventBus) Subscribe(id string, buffer int) *Subscription + func (b *EventBus) SubscribeAll(id string, buffer int) *Subscription + func (b *EventBus) Unsubscribe(id string) + type ExtraSystemBlock struct + Bytes int + Preview string + type GoogleModel struct + CachedPer1M float64 + ID string + InputPer1M float64 + MaxOutputTokens int + OutputPer1M float64 + type GoogleProvider struct + func (p *GoogleProvider) ActiveModel() string + func (p *GoogleProvider) AvailableBuiltinTools() []BuiltinTool + func (p *GoogleProvider) AvailableModels() []string + func (p *GoogleProvider) Chat(ctx context.Context, messages []Message, model string, tools []NativeTool, ...) (ChatResponse, error) + func (p *GoogleProvider) CostPer1M() (float64, float64, float64) + func (p *GoogleProvider) Models() map[ModelTier]string + func (p *GoogleProvider) Name() string + func (p *GoogleProvider) SetBuiltinTools(tools []string) + func (p *GoogleProvider) SetModel(modelID string) + func (p *GoogleProvider) SupportsNativeTools() bool + func (p *GoogleProvider) WithBuiltins(builtins []string) LLMProvider + type ImageURL struct + Detail string + URL string + type IndexEntry struct + Description string + Name string + NoSpawn bool + Server string + type InputAudio struct + Data string + Format string + type LLMChunkData struct + Iteration int + Text string + type LLMDoneData struct + ContextChars int + ContextMsgs int + DurationMs int64 + Iteration int + MaxContextTokens int + MemoryCount int + Message string + Model string + Rate string + ThreadCount int + TokensCached int + TokensIn int + TokensOut int + type LLMErrorData struct + Error string + Iteration int + Model string + type LLMProvider interface + AvailableBuiltinTools func() []BuiltinTool + Chat func(ctx context.Context, messages []Message, model string, tools []NativeTool, ...) (ChatResponse, error) + CostPer1M func() (float64, float64, float64) + Models func() map[ModelTier]string + Name func() string + SetBuiltinTools func(tools []string) + SupportsNativeTools func() bool + WithBuiltins func(builtins []string) LLMProvider + func NewAnthropicProvider(apiKey string) LLMProvider + func NewFireworksProvider(apiKey string) LLMProvider + func NewGoogleProvider(apiKey string) LLMProvider + func NewNvidiaProvider(apiKey string) LLMProvider + func NewOllamaProvider(host string) LLMProvider + func NewOpenAINativeProvider(apiKey string) LLMProvider + func NewOpenAIProvider(apiKey string) LLMProvider + func NewOpenCodeGoProvider(apiKey string) LLMProvider + func NewVeniceProvider(apiKey string) LLMProvider + type MCPConn interface + CallTool func(name string, args map[string]string) (string, error) + Close func() + GetName func() string + ListTools func() ([]mcpToolDef, error) + type MCPHTTPServer struct + Name string + func (s *MCPHTTPServer) CallTool(name string, args map[string]string) (string, error) + func (s *MCPHTTPServer) Close() + func (s *MCPHTTPServer) GetName() string + func (s *MCPHTTPServer) ListTools() ([]mcpToolDef, error) + type MCPServer struct + Name string + func (s *MCPServer) CallTool(name string, args map[string]string) (string, error) + func (s *MCPServer) Close() + func (s *MCPServer) GetName() string + func (s *MCPServer) ListTools() ([]mcpToolDef, error) + type MCPServerConfig struct + Args []string + Command string + Env map[string]string + Name string + NoSpawn bool + Transport string + URL string + type MCPServerInfo struct + Name string + ToolCount int + type MemoryRecord struct + Content string + Embedding []float64 + ID string + IDTarget string + Reason string + Supersedes string + TS time.Time + Tags []string + Tombstone bool + Weight float64 + func (r MemoryRecord) IsTombstone() bool + type MemoryStore struct + func NewMemoryStore(apiKey string) *MemoryStore + func (ms *MemoryStore) Active() []MemoryRecord + func (ms *MemoryStore) All() []MemoryRecord + func (ms *MemoryStore) BuildContext(records []MemoryRecord) string + func (ms *MemoryStore) Count() int + func (ms *MemoryStore) Drop(id, reason string) error + func (ms *MemoryStore) Enabled() bool + func (ms *MemoryStore) HasID(id string) bool + func (ms *MemoryStore) Recall(query string, n int) []MemoryRecord + func (ms *MemoryStore) Remember(content string, tags []string, weight float64) (string, error) + func (ms *MemoryStore) RememberWithID(id, content string, tags []string, weight float64) (string, error) + func (ms *MemoryStore) Search(query string, limit int) []MemoryRecord + func (ms *MemoryStore) Supersede(oldID, content string, tags []string, weight float64, reason string) (string, error) + type Message struct + Content string + Parts []ContentPart + Reasoning string + Role string + ToolCalls []NativeToolCall + ToolResults []ToolResult + func (m Message) HasParts() bool + func (m Message) TextContent() string + type ModelTier int + const ModelLarge + const ModelMedium + const ModelSmall + func (m ModelTier) String() string + type NativeTool struct + Description string + Name string + Parameters map[string]any + type NativeToolCall struct + Args map[string]string + ID string + Name string + ThoughtSignature string + type NativeToolSize struct + Bytes int + Kind string + Name string + type OpenAICompatProvider struct + func (p *OpenAICompatProvider) AvailableBuiltinTools() []BuiltinTool + func (p *OpenAICompatProvider) Chat(ctx context.Context, messages []Message, model string, tools []NativeTool, ...) (ChatResponse, error) + func (p *OpenAICompatProvider) CostPer1M() (float64, float64, float64) + func (p *OpenAICompatProvider) Models() map[ModelTier]string + func (p *OpenAICompatProvider) Name() string + func (p *OpenAICompatProvider) SetBuiltinTools(tools []string) + func (p *OpenAICompatProvider) SupportsNativeTools() bool + func (p *OpenAICompatProvider) WithBuiltins(builtins []string) LLMProvider + type OpenAINativeProvider struct + func (p *OpenAINativeProvider) AvailableBuiltinTools() []BuiltinTool + func (p *OpenAINativeProvider) Chat(ctx context.Context, messages []Message, model string, tools []NativeTool, ...) (ChatResponse, error) + func (p *OpenAINativeProvider) CostPer1M() (float64, float64, float64) + func (p *OpenAINativeProvider) Models() map[ModelTier]string + func (p *OpenAINativeProvider) Name() string + func (p *OpenAINativeProvider) SetBuiltinTools(tools []string) + func (p *OpenAINativeProvider) SupportsNativeTools() bool + func (p *OpenAINativeProvider) WithBuiltins(builtins []string) LLMProvider + type OpenAIRealtimeProvider struct + func NewOpenAIRealtimeProvider(apiKey string) *OpenAIRealtimeProvider + func (p *OpenAIRealtimeProvider) CostPer1M() (in, cached, out, audio float64) + func (p *OpenAIRealtimeProvider) DefaultVoice() string + func (p *OpenAIRealtimeProvider) Models() map[ModelTier]string + func (p *OpenAIRealtimeProvider) Name() string + func (p *OpenAIRealtimeProvider) Open(ctx context.Context, opts RealtimeSessionOpts) (RealtimeSession, error) + type PersistentThread struct + Depth int + Directive string + ID string + MCPNames []string + Name string + ParentID string + Realtime bool + System bool + Tools []string + Voice string + type Phase struct + Name string + Setup func(t *testing.T, dir string) + Timeout time.Duration + Verify func(t *testing.T, dir string, th *Thinker) + Wait func(t *testing.T, dir string, th *Thinker) bool + type PromptComposition struct + ConvBytes int + ExtraBytes int + ExtraSystem []ExtraSystemBlock + GrandTotal int + ModelMaxTokens int + NativeBytes int + NativeTools []NativeToolSize + System SystemBreakdown + type PromptTokensDetails struct + CachedTokens int + type ProviderConfig struct + BuiltinTools []string + Default bool + Models map[string]string + Name string + RealtimeVoice string + type ProviderPool struct + func (pp *ProviderPool) Count() int + func (pp *ProviderPool) Default() LLMProvider + func (pp *ProviderPool) DefaultName() string + func (pp *ProviderPool) Fallback(exclude string) LLMProvider + func (pp *ProviderPool) Get(name string) LLMProvider + func (pp *ProviderPool) HasRealtimeProvider() bool + func (pp *ProviderPool) Names() []string + func (pp *ProviderPool) ProviderSummary(name string) string + func (pp *ProviderPool) RealtimeByName(name string) RealtimeProvider + func (pp *ProviderPool) RealtimeDefault() RealtimeProvider + func (pp *ProviderPool) RealtimeNames() []string + type RealtimeEvent struct + Audio []byte + Err error + Final bool + ToolArgs string + ToolCallID string + ToolName string + Transcript string + Type RealtimeEventType + type RealtimeEventType string + const RealtimeEventAudioOut + const RealtimeEventError + const RealtimeEventResponseDone + const RealtimeEventSessionEnded + const RealtimeEventToolCall + const RealtimeEventTranscriptInput + const RealtimeEventTranscriptOutput + type RealtimeProvider interface + CostPer1M func() (in, cached, out, audio float64) + DefaultVoice func() string + Models func() map[ModelTier]string + Name func() string + Open func(ctx context.Context, opts RealtimeSessionOpts) (RealtimeSession, error) + type RealtimeSession interface + Close func() error + Events func() <-chan RealtimeEvent + Interrupt func() error + SendAudio func(pcm []byte) error + SendText func(role, text string) error + SendToolResult func(callID, result string, isError bool) error + UpdateInstructions func(directive string) error + type RealtimeSessionOpts struct + AudioInFmt AudioFormat + AudioOutFmt AudioFormat + Instructions string + Model string + Temperature float64 + Tools []NativeTool + Voice string + type RealtimeThinker struct + func (rt *RealtimeThinker) Run() + type Request struct + Messages []Message + Model string + Stream bool + type RunMode string + const ModeAutonomous + const ModeCautious + const ModeLearn + type Scenario struct + DataSetup func(t *testing.T, dir string) + Directive string + MCPServers []MCPServerConfig + Name string + Phases []Phase + Providers []ProviderConfig + Timeout time.Duration + type ScenarioAuditEntry struct + Args map[string]string + Time string + Tool string + func ReadAuditEntries(dir string) []ScenarioAuditEntry + type ServerToolResult struct + Code string + Error string + Output string + ToolName string + type Session struct + func NewSession(baseDir, threadID string) *Session + func (s *Session) Append(entry SessionEntry) + func (s *Session) AppendMessage(msg Message, iteration int, usage TokenUsage) + func (s *Session) Compact(summarize func(text string) string) + func (s *Session) Count() int + func (s *Session) Delete() + func (s *Session) LoadTail(n int) (messages []Message, compactedSummaries []string) + func (s *Session) NeedsCompaction() bool + func (s *Session) Rename(newThreadID string) error + type SessionEntry struct + Content string + Iteration int + OrigCount int + Parts []ContentPart + Role string + Summary string + Timestamp time.Time + TokensIn int + TokensOut int + ToolCalls []NativeToolCall + ToolResults []ToolResult + type SpawnOpts struct + AudioIn <-chan []byte + AudioOut chan<- []byte + BuiltinTools []string + BypassNoSpawn bool + DeferRun bool + Depth int + InitialMessages []string + MCPNames []string + MediaParts []ContentPart + ParentID string + Paused bool + ProviderName string + Realtime bool + Tools []string + Voice string + type StreamChoice struct + Delta Delta + type StreamEvent struct + Choices []StreamChoice + Usage *Usage + type Subscription struct + C chan Event + Dropped uint64 + ID string + Wake chan struct{} + type SystemBreakdown struct + ActiveThreads int + Base int + BlobHint int + CoreTools int + Directive int + MCPServers int + MCPToolDocs int + Other int + PreviousContext int + Providers int + RetrievedTools int + SafetyMode int + Skills int + Total int + type Telemetry struct + func NewTelemetry() *Telemetry + func (t *Telemetry) DroppedLiveEvents() int64 + func (t *Telemetry) Emit(eventType, threadID string, data any) + func (t *Telemetry) EmitLive(eventType, threadID string, data any) + func (t *Telemetry) Events(since int) ([]TelemetryEvent, int) + func (t *Telemetry) Stop() + func (t *Telemetry) StoredEvents(since int) ([]TelemetryEvent, int) + type TelemetryEvent struct + Data json.RawMessage + ID string + InstanceID int64 + ThreadID string + Time time.Time + Type string + type ThinkRate int + const RateFast + const RateNormal + const RateReactive + const RateSleep + const RateSlow + func (r ThinkRate) Delay() time.Duration + func (r ThinkRate) String() string + type Thinker struct + func NewThinker(apiKey string, provider LLMProvider, cfg ...*Config) *Thinker + func (t *Thinker) APIEvents(since int) ([]APIEvent, int) + func (t *Thinker) Config() *Config + func (t *Thinker) Inject(msg string) + func (t *Thinker) InjectConsole(msg string) + func (t *Thinker) InjectWithParts(text string, parts []ContentPart) + func (t *Thinker) Iteration() int + func (t *Thinker) Memory() *MemoryStore + func (t *Thinker) Messages() []Message + func (t *Thinker) Pool() *ProviderPool + func (t *Thinker) ReloadDirective() + func (t *Thinker) ResetConversation() + func (t *Thinker) Run() + func (t *Thinker) SetComputer(c computer.Computer) + func (t *Thinker) Shutdown() + func (t *Thinker) Stop() + func (t *Thinker) Threads() *ThreadManager + func (t *Thinker) TogglePause() + type Thread struct + Children *ThreadManager + Depth int + Directive string + ID string + MCPNames []string + Name string + Parent *Thinker + ParentID string + Realtime *RealtimeThinker + Started time.Time + Thinker *Thinker + Tools map[string]bool + type ThreadDoneData struct + ParentID string + Result string + type ThreadInfo struct + ContextChars int + ContextMsgs int + Depth int + Directive string + ID string + Iteration int + MCPNames []string + Model ModelTier + Name string + ParentID string + Provider string + Rate ThinkRate + Running bool + Started time.Time + SubThreads int + Tools []string + func AllThreadInfos(tm *ThreadManager) []ThreadInfo + type ThreadManager struct + func NewThreadManager(parent *Thinker) *ThreadManager + func (tm *ThreadManager) Count() int + func (tm *ThreadManager) Kill(id string) + func (tm *ThreadManager) KillAll() + func (tm *ThreadManager) List() []ThreadInfo + func (tm *ThreadManager) PauseAll(paused bool) + func (tm *ThreadManager) Rename(oldID, newID string) error + func (tm *ThreadManager) Send(id, message string) bool + func (tm *ThreadManager) SendWithParts(id, message string, parts []ContentPart) bool + func (tm *ThreadManager) Spawn(id, directive string, tools []string, initialMessages ...string) error + func (tm *ThreadManager) SpawnWithMedia(id, directive string, tools []string, parts []ContentPart, ...) error + func (tm *ThreadManager) SpawnWithOpts(id, directive string, tools []string, opts SpawnOpts) error + func (tm *ThreadManager) StartAll() + func (tm *ThreadManager) Update(id, name, directive string, tools []string) error + type ThreadMessageData struct + From string + Message string + To string + type ThreadRenamedData struct + Name string + NewID string + OldID string + ParentID string + type ThreadSpawnData struct + Directive string + ParentID string + Tools []string + type TokenUsage struct + AudioTokens int + CachedTokens int + CompletionTokens int + PromptTokens int + type ToolCallData struct + Args map[string]string + ID string + Name string + Reason string + type ToolDef struct + Core bool + Description string + Handler func(args map[string]string) ToolResponse + InputSchema map[string]any + MCP bool + MCPServer string + MainOnly bool + Name string + Rules string + Syntax string + SystemOnly bool + ThreadOnly bool + type ToolHandler func(t *Thinker, calls []toolCall, consumed []string) (replies []string, toolNames []string, results []ToolResult) + type ToolIndex struct + func NewToolIndex() *ToolIndex + func (ix *ToolIndex) Add(server string, tools []mcpToolDef, noSpawn bool) + func (ix *ToolIndex) AllNames(allowNoSpawn bool) []string + func (ix *ToolIndex) Count() int + func (ix *ToolIndex) Get(name string) (IndexEntry, bool) + func (ix *ToolIndex) Remove(server string) + func (ix *ToolIndex) Search(query string, k int, allowNoSpawn bool) []IndexEntry + func (ix *ToolIndex) Servers() []string + func (ix *ToolIndex) ToolCountByServer() map[string]int + func (ix *ToolIndex) ToolsForServer(server string) []string + type ToolRegistry struct + func NewToolRegistry(apiKey string) *ToolRegistry + func (tr *ToolRegistry) AllToolNames() []string + func (tr *ToolRegistry) AllTools() []*ToolDef + func (tr *ToolRegistry) CoreDocs(includeMainOnly bool, includeSystemOnly ...bool) string + func (tr *ToolRegistry) CoreDocsSummary(includeMainOnly bool, includeSystemOnly ...bool) string + func (tr *ToolRegistry) Count() int + func (tr *ToolRegistry) Counts() (core, rag, total int) + func (tr *ToolRegistry) Dispatch(name string, args map[string]string) (ToolResponse, bool) + func (tr *ToolRegistry) Get(name string) *ToolDef + func (tr *ToolRegistry) NativeTools(allowlist, active map[string]bool) []NativeTool + func (tr *ToolRegistry) Register(tool *ToolDef) + func (tr *ToolRegistry) RemoveByMCPServer(serverName string) + type ToolResponse struct + Image []byte + Text string + type ToolResult struct + CallID string + Content string + Image []byte + IsError bool + type ToolResultData struct + DurationMs int64 + ID string + Name string + Result string + Success bool + type Usage struct + CompletionTokens int + PromptTokens int + PromptTokensDetails *PromptTokensDetails + TotalTokens int v0.1.0 Mar 27, 2026