Versions in this module Expand all Collapse all v0 v0.1.0 Jul 11, 2026 Changes in this version + const DefaultSessionTitle + func FlattenText(msg Message, includeThinking bool) string + func InferProviderFromModel(model string) (string, bool) + func ResolvePath(path, cwd string) string + func ValidateMediaSupport(msg Message, supportsImage, supportsPDF bool) error + type AfterToolHook func(context.Context, ToolCall, Result) (Result, bool) + type Agent struct + func New(cfg Config) (*Agent, error) + func (a *Agent) Cancel() + func (a *Agent) Chat(ctx context.Context, prompt string, attachments ...Attachment) iter.Seq[Event] + func (a *Agent) ChatMessage(ctx context.Context, userInput Message) iter.Seq[Event] + func (a *Agent) Messages() []Message + func (a *Agent) SessionID() string + type Attachment struct + func Bytes(data []byte, mediaType, name string) Attachment + func Path(path string) Attachment + func PathWithName(path, name string) Attachment + func Text(text, name string) Attachment + type BeforeToolHook func(context.Context, ToolCall) (Result, bool) + type Block struct + Content []Block + Data string + ID string + Input map[string]any + IsError *bool + MIMEType string + Meta map[string]any + Metadata map[string]any + Name string + Output string + Text string + ToolUseID string + Type string + func Build(items []Attachment, cwd string) ([]Block, error) + func DocumentBlock(data, mimeType, name string, meta map[string]any) Block + func ImageBlock(data, mimeType, name string, meta map[string]any) Block + func TextBlock(text string, meta map[string]any) Block + func ThinkingBlock(text string, meta map[string]any) Block + func ToolResultBlock(toolUseID, output string, metadata map[string]any, isError bool, ...) Block + func ToolUseBlock(id, name string, input, meta map[string]any) Block + type Call struct + CWD string + Emit func(string) + ID string + Input T + type Config struct + APIBase string + APIKey string + CWD string + CompactThreshold float64 + Hooks Hooks + MaxTurns int + Messages []Message + Metadata *ModelMetadata + Model string + Provider string + ReasoningEffort string + SessionID string + Store *SessionStore + System string + Temperature *float64 + Tools []Tool + type Event struct + Data map[string]any + Type string + type Hooks struct + AfterTool []AfterToolHook + BeforeTool []BeforeToolHook + type Message struct + Content []Block + Meta map[string]any + Role string + func AssistantMessage(blocks []Block, provider, model, providerMessageID, stopReason string, ...) Message + func BuildMessage(role string, blocks []Block, meta map[string]any) Message + func Clone(msg Message) Message + func CloneMessages(msgs []Message) []Message + func UserTextMessage(text string, meta map[string]any) Message + type ModelMetadata struct + ContextWindow int + MaxOutputTokens int + SupportsImageInput bool + SupportsPDFInput bool + SupportsReasoning bool + func ResolveModel(providerType, model string, ov ModelOverride) ModelMetadata + type ModelOverride struct + ContextWindow int + MaxOutputTokens int + SupportsImageInput *bool + SupportsPDFInput *bool + SupportsReasoning *bool + type Option func(*Tool) + func WithStreaming() Option + type Provider struct + AutoDiscoverable bool + DefaultBaseURL string + DefaultModels []string + EnvAPIKeyNames []string + ID string + Label string + SupportsReasoningEffort bool + func LookupProvider(id string) (Provider, bool) + func Providers() []Provider + type Result struct + Content []Block + IsError bool + Metadata map[string]any + Output string + type SessionData struct + Messages []Message + Session SessionSummary + type SessionMeta struct + CWD string + CreatedAt string + Title string + UpdatedAt string + type SessionStore struct + func NewSessionStore(dataDir string) (*SessionStore, error) + func (s *SessionStore) AppendMessage(sessionID string, msg Message, cwd string) error + func (s *SessionStore) AppendRewind(sessionID string, rewindTo int) error + func (s *SessionStore) ClearSession(sessionID string) error + func (s *SessionStore) CreateSession(sessionID, cwd string) (SessionData, error) + func (s *SessionStore) DeleteSession(sessionID string) error + func (s *SessionStore) DraftSession(cwd string) SessionData + func (s *SessionStore) LatestSession(cwd string) (*SessionSummary, error) + func (s *SessionStore) ListSessions(cwd string) ([]SessionSummary, error) + func (s *SessionStore) LoadSession(sessionID string) (*SessionData, error) + func (s *SessionStore) MessagesPath(sessionID string) string + func (s *SessionStore) SessionDir(sessionID string) string + func (s *SessionStore) SessionExists(sessionID string) bool + type SessionSummary struct + ID string + type Tool struct + Description string + InputSchema map[string]any + Name string + Runner func(context.Context, ToolCall) Result + StreamsOutput bool + func BashTool() Tool + func Define[T any](name, description string, run func(context.Context, Call[T]) Result, ...) Tool + func EditTool() Tool + func ReadTool() Tool + func WriteTool() Tool + type ToolCall struct + CWD string + Emit func(string) + ID string + Input map[string]any + Name string