Documentation
¶
Index ¶
- type ApprovalAction
- type BashToolResult
- type CancelledEvent
- type ChatChunkEvent
- type ChatCompleteEvent
- type ChatErrorEvent
- type ChatEvent
- type ChatEventType
- type ChatMetrics
- type ChatService
- type ChatStartEvent
- type ConversationEntry
- type ConversationRepository
- type DeleteToolResult
- type EditOperationResult
- type EditToolResult
- type ExportFormat
- type FetchResult
- type FetchService
- type FileInfo
- type FileReadToolResult
- type FileService
- type FileWriteToolResult
- type ModelService
- type MultiEditToolResult
- type TodoItem
- type TodoWriteToolResult
- type Tool
- type ToolCallEvent
- type ToolDefinition
- type ToolExecutionResult
- type ToolFactory
- type ToolService
- type TreeToolResult
- type WebSearchResponse
- type WebSearchResult
- type WebSearchService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApprovalAction ¶
type ApprovalAction int
ApprovalAction defines the possible approval actions for tool calls
const ( ApprovalApprove ApprovalAction = iota // Approve and execute ApprovalReject // Deny and cancel )
type BashToolResult ¶ added in v0.14.0
type BashToolResult struct { Command string `json:"command"` Output string `json:"output"` Error string `json:"error,omitempty"` ExitCode int `json:"exit_code"` Duration string `json:"duration"` }
BashToolResult represents the result of a bash command execution
type CancelledEvent ¶
CancelledEvent indicates a request was cancelled
func (CancelledEvent) GetRequestID ¶
func (e CancelledEvent) GetRequestID() string
func (CancelledEvent) GetTimestamp ¶
func (e CancelledEvent) GetTimestamp() time.Time
func (CancelledEvent) GetType ¶
func (e CancelledEvent) GetType() ChatEventType
type ChatChunkEvent ¶
type ChatChunkEvent struct { RequestID string Timestamp time.Time Content string ToolCalls []sdk.ChatCompletionMessageToolCall Delta bool }
ChatChunkEvent represents a streaming chunk of chat response
func (ChatChunkEvent) GetRequestID ¶
func (e ChatChunkEvent) GetRequestID() string
func (ChatChunkEvent) GetTimestamp ¶
func (e ChatChunkEvent) GetTimestamp() time.Time
func (ChatChunkEvent) GetType ¶
func (e ChatChunkEvent) GetType() ChatEventType
type ChatCompleteEvent ¶
type ChatCompleteEvent struct { RequestID string Timestamp time.Time Message string ToolCalls []sdk.ChatCompletionMessageToolCall Metrics *ChatMetrics }
ChatCompleteEvent indicates chat completion
func (ChatCompleteEvent) GetRequestID ¶
func (e ChatCompleteEvent) GetRequestID() string
func (ChatCompleteEvent) GetTimestamp ¶
func (e ChatCompleteEvent) GetTimestamp() time.Time
func (ChatCompleteEvent) GetType ¶
func (e ChatCompleteEvent) GetType() ChatEventType
type ChatErrorEvent ¶
ChatErrorEvent represents an error during chat
func (ChatErrorEvent) GetRequestID ¶
func (e ChatErrorEvent) GetRequestID() string
func (ChatErrorEvent) GetTimestamp ¶
func (e ChatErrorEvent) GetTimestamp() time.Time
func (ChatErrorEvent) GetType ¶
func (e ChatErrorEvent) GetType() ChatEventType
type ChatEvent ¶
type ChatEvent interface { GetType() ChatEventType GetRequestID() string GetTimestamp() time.Time }
ChatEvent represents events during chat operations
type ChatEventType ¶
type ChatEventType int
ChatEventType defines types of chat events
const ( EventChatStart ChatEventType = iota EventChatChunk EventChatComplete EventChatError EventToolCall EventCancelled )
type ChatMetrics ¶
type ChatMetrics struct { Duration time.Duration Usage *sdk.CompletionUsage }
ChatMetrics holds performance and usage metrics
type ChatService ¶
type ChatService interface { SendMessage(ctx context.Context, model string, messages []sdk.Message) (<-chan ChatEvent, error) CancelRequest(requestID string) error GetMetrics(requestID string) *ChatMetrics }
ChatService handles chat completion operations
type ChatStartEvent ¶
ChatStartEvent indicates a chat request has started
func (ChatStartEvent) GetRequestID ¶
func (e ChatStartEvent) GetRequestID() string
func (ChatStartEvent) GetTimestamp ¶
func (e ChatStartEvent) GetTimestamp() time.Time
func (ChatStartEvent) GetType ¶
func (e ChatStartEvent) GetType() ChatEventType
type ConversationEntry ¶
type ConversationEntry struct { Message sdk.Message `json:"message"` Model string `json:"model,omitempty"` Time time.Time `json:"time"` ToolExecution *ToolExecutionResult `json:"tool_execution,omitempty"` // For tool result entries }
ConversationEntry represents a message in the conversation with metadata
type ConversationRepository ¶
type ConversationRepository interface { AddMessage(msg ConversationEntry) error GetMessages() []ConversationEntry Clear() error Export(format ExportFormat) ([]byte, error) GetMessageCount() int UpdateLastMessage(content string) error UpdateLastMessageToolCalls(toolCalls *[]sdk.ChatCompletionMessageToolCall) error }
ConversationRepository handles conversation storage and retrieval
type DeleteToolResult ¶ added in v0.18.2
type DeleteToolResult struct { Path string `json:"path"` DeletedFiles []string `json:"deleted_files"` DeletedDirs []string `json:"deleted_dirs"` TotalFilesDeleted int `json:"total_files_deleted"` TotalDirsDeleted int `json:"total_dirs_deleted"` WildcardExpanded bool `json:"wildcard_expanded"` Errors []string `json:"errors,omitempty"` }
DeleteToolResult represents the result of a delete operation
type EditOperationResult ¶ added in v0.22.0
type EditOperationResult struct { OldString string `json:"old_string"` NewString string `json:"new_string"` ReplaceAll bool `json:"replace_all"` ReplacedCount int `json:"replaced_count"` Success bool `json:"success"` Error string `json:"error,omitempty"` }
EditOperationResult represents the result of a single edit operation within MultiEdit
type EditToolResult ¶ added in v0.21.0
type EditToolResult struct { FilePath string `json:"file_path"` OldString string `json:"old_string"` NewString string `json:"new_string"` ReplacedCount int `json:"replaced_count"` ReplaceAll bool `json:"replace_all"` FileModified bool `json:"file_modified"` OriginalSize int64 `json:"original_size"` NewSize int64 `json:"new_size"` BytesDifference int64 `json:"bytes_difference"` }
EditToolResult represents the result of an edit operation
type ExportFormat ¶
type ExportFormat string
ExportFormat defines the format for exporting conversations
const ( ExportMarkdown ExportFormat = "markdown" ExportJSON ExportFormat = "json" ExportText ExportFormat = "text" )
type FetchResult ¶ added in v0.11.1
type FetchResult struct { Content string `json:"content"` URL string `json:"url"` Status int `json:"status"` Size int64 `json:"size"` ContentType string `json:"content_type"` Cached bool `json:"cached"` Metadata map[string]string `json:"metadata,omitempty"` Warning string `json:"warning,omitempty"` }
FetchResult represents the result of a fetch operation
type FetchService ¶ added in v0.11.1
type FetchService interface { ValidateURL(url string) error FetchContent(ctx context.Context, target string) (*FetchResult, error) ClearCache() GetCacheStats() map[string]interface{} }
FetchService handles content fetching operations
type FileReadToolResult ¶ added in v0.14.0
type FileReadToolResult struct { FilePath string `json:"file_path"` Content string `json:"content"` Size int64 `json:"size"` StartLine int `json:"start_line,omitempty"` EndLine int `json:"end_line,omitempty"` Error string `json:"error,omitempty"` }
FileReadToolResult represents the result of a file read operation
type FileService ¶
type FileService interface { ListProjectFiles() ([]string, error) ReadFile(path string) (string, error) ReadFileLines(path string, startLine, endLine int) (string, error) ValidateFile(path string) error GetFileInfo(path string) (FileInfo, error) }
FileService handles file operations
type FileWriteToolResult ¶ added in v0.17.0
type FileWriteToolResult struct { FilePath string `json:"file_path"` BytesWritten int64 `json:"bytes_written"` Created bool `json:"created"` Overwritten bool `json:"overwritten"` DirsCreated bool `json:"dirs_created"` Appended bool `json:"appended"` ChunkIndex int `json:"chunk_index,omitempty"` TotalChunks int `json:"total_chunks,omitempty"` IsComplete bool `json:"is_complete"` Error string `json:"error,omitempty"` }
FileWriteToolResult represents the result of a file write operation
type ModelService ¶
type ModelService interface { ListModels(ctx context.Context) ([]string, error) SelectModel(modelID string) error GetCurrentModel() string IsModelAvailable(modelID string) bool ValidateModel(modelID string) error }
ModelService handles model selection and information
type MultiEditToolResult ¶ added in v0.22.0
type MultiEditToolResult struct { FilePath string `json:"file_path"` Edits []EditOperationResult `json:"edits"` TotalEdits int `json:"total_edits"` SuccessfulEdits int `json:"successful_edits"` FileModified bool `json:"file_modified"` OriginalSize int64 `json:"original_size"` NewSize int64 `json:"new_size"` BytesDifference int64 `json:"bytes_difference"` }
MultiEditToolResult represents the result of a MultiEdit operation
type TodoItem ¶ added in v0.20.0
type TodoItem struct { ID string `json:"id"` Content string `json:"content"` Status string `json:"status"` }
TodoItem represents a single todo item
type TodoWriteToolResult ¶ added in v0.20.0
type TodoWriteToolResult struct { Todos []TodoItem `json:"todos"` TotalTasks int `json:"total_tasks"` CompletedTasks int `json:"completed_tasks"` InProgressTask string `json:"in_progress_task,omitempty"` ValidationOK bool `json:"validation_ok"` }
TodoWriteToolResult represents the result of a TodoWrite operation
type Tool ¶ added in v0.14.1
type Tool interface { // Definition returns the tool definition for the LLM Definition() ToolDefinition // Execute runs the tool with given arguments Execute(ctx context.Context, args map[string]interface{}) (*ToolExecutionResult, error) // Validate checks if the tool arguments are valid Validate(args map[string]interface{}) error // IsEnabled returns whether this tool is enabled IsEnabled() bool }
Tool represents a single tool with its definition, handler, and validator
type ToolCallEvent ¶
ToolCallEvent represents a tool call request
func (ToolCallEvent) GetRequestID ¶
func (e ToolCallEvent) GetRequestID() string
func (ToolCallEvent) GetTimestamp ¶
func (e ToolCallEvent) GetTimestamp() time.Time
func (ToolCallEvent) GetType ¶
func (e ToolCallEvent) GetType() ChatEventType
type ToolDefinition ¶
type ToolDefinition struct { Name string `json:"name"` Description string `json:"description"` Parameters interface{} `json:"parameters"` }
ToolDefinition describes an available tool
type ToolExecutionResult ¶ added in v0.14.0
type ToolExecutionResult struct { ToolName string `json:"tool_name"` Arguments map[string]interface{} `json:"arguments"` Success bool `json:"success"` Duration time.Duration `json:"duration"` Error string `json:"error,omitempty"` Data interface{} `json:"data,omitempty"` Metadata map[string]string `json:"metadata,omitempty"` }
ToolExecutionResult represents the complete result of a tool execution
type ToolFactory ¶ added in v0.14.1
type ToolFactory interface { // CreateTool creates a tool instance by name CreateTool(name string) (Tool, error) // ListAvailableTools returns names of all available tools ListAvailableTools() []string }
ToolFactory creates tool instances
type ToolService ¶
type ToolService interface { ListTools() []ToolDefinition ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (*ToolExecutionResult, error) IsToolEnabled(name string) bool ValidateTool(name string, args map[string]interface{}) error }
ToolService handles tool execution
type TreeToolResult ¶ added in v0.16.0
type TreeToolResult struct { Path string `json:"path"` Output string `json:"output"` TotalFiles int `json:"total_files"` TotalDirs int `json:"total_dirs"` MaxDepth int `json:"max_depth"` MaxFiles int `json:"max_files"` ExcludePatterns []string `json:"exclude_patterns"` ShowHidden bool `json:"show_hidden"` Format string `json:"format"` UsingNativeTree bool `json:"using_native_tree"` Truncated bool `json:"truncated"` }
TreeToolResult represents the result of a tree operation
type WebSearchResponse ¶ added in v0.13.0
type WebSearchResponse struct { Query string `json:"query"` Engine string `json:"engine"` Results []WebSearchResult `json:"results"` Total int `json:"total"` Time time.Duration `json:"time"` Error string `json:"error,omitempty"` }
WebSearchResponse represents the complete search response
type WebSearchResult ¶ added in v0.13.0
type WebSearchResult struct { Title string `json:"title"` URL string `json:"url"` Snippet string `json:"snippet"` }
WebSearchResult represents a single search result
type WebSearchService ¶ added in v0.13.0
type WebSearchService interface { SearchGoogle(ctx context.Context, query string, maxResults int) (*WebSearchResponse, error) SearchDuckDuckGo(ctx context.Context, query string, maxResults int) (*WebSearchResponse, error) IsEnabled() bool SetEnabled(enabled bool) }
WebSearchService handles web search operations