domain

package
v0.29.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApplicationState added in v0.27.0

type ApplicationState struct {
	// contains filtered or unexported fields
}

ApplicationState represents the overall application state with proper typing

func NewApplicationState added in v0.27.0

func NewApplicationState() *ApplicationState

NewApplicationState creates a new application state

func (*ApplicationState) ApproveCurrentTool added in v0.27.0

func (s *ApplicationState) ApproveCurrentTool() error

ApproveCurrentTool approves the current tool for execution

func (*ApplicationState) ClearApprovalUIState added in v0.27.0

func (s *ApplicationState) ClearApprovalUIState()

ClearApprovalUIState clears the approval UI state

func (*ApplicationState) ClearFileSelectionState added in v0.27.0

func (s *ApplicationState) ClearFileSelectionState()

ClearFileSelectionState clears the file selection state

func (*ApplicationState) CompleteCurrentTool added in v0.27.0

func (s *ApplicationState) CompleteCurrentTool(result *ToolExecutionResult) error

CompleteCurrentTool marks the current tool as completed and moves to next

func (*ApplicationState) DenyCurrentTool added in v0.27.0

func (s *ApplicationState) DenyCurrentTool() error

DenyCurrentTool denies the current tool execution

func (*ApplicationState) EndChatSession added in v0.27.0

func (s *ApplicationState) EndChatSession()

EndChatSession cleans up the chat session

func (*ApplicationState) EndToolExecution added in v0.27.0

func (s *ApplicationState) EndToolExecution()

EndToolExecution cleans up the tool execution session

func (*ApplicationState) FailCurrentTool added in v0.27.0

func (s *ApplicationState) FailCurrentTool(result *ToolExecutionResult) error

FailCurrentTool marks the current tool as failed and moves to next

func (*ApplicationState) GetApprovalUIState added in v0.27.0

func (s *ApplicationState) GetApprovalUIState() *ApprovalUIState

GetApprovalUIState returns the current approval UI state

func (*ApplicationState) GetChatSession added in v0.27.0

func (s *ApplicationState) GetChatSession() *ChatSession

GetChatSession returns the current chat session

func (*ApplicationState) GetCurrentView added in v0.27.0

func (s *ApplicationState) GetCurrentView() ViewState

GetCurrentView returns the current view state

func (*ApplicationState) GetDimensions added in v0.27.0

func (s *ApplicationState) GetDimensions() (int, int)

GetDimensions returns the current UI dimensions

func (*ApplicationState) GetFileSelectionState added in v0.27.0

func (s *ApplicationState) GetFileSelectionState() *FileSelectionState

GetFileSelectionState returns the current file selection state

func (*ApplicationState) GetStateSnapshot added in v0.27.0

func (s *ApplicationState) GetStateSnapshot() StateSnapshot

GetStateSnapshot returns a complete snapshot of the current state

func (*ApplicationState) GetToolExecution added in v0.27.0

func (s *ApplicationState) GetToolExecution() *ToolExecutionSession

GetToolExecution returns the current tool execution session

func (*ApplicationState) IsDebugMode added in v0.27.0

func (s *ApplicationState) IsDebugMode() bool

IsDebugMode returns whether debug mode is enabled

func (*ApplicationState) SetApprovalSelectedIndex added in v0.27.0

func (s *ApplicationState) SetApprovalSelectedIndex(index int)

SetApprovalSelectedIndex sets the approval selection index

func (*ApplicationState) SetDebugMode added in v0.27.0

func (s *ApplicationState) SetDebugMode(enabled bool)

SetDebugMode enables or disables debug mode

func (*ApplicationState) SetDimensions added in v0.27.0

func (s *ApplicationState) SetDimensions(width, height int)

SetDimensions updates the UI dimensions

func (*ApplicationState) SetFileSelectedIndex added in v0.27.0

func (s *ApplicationState) SetFileSelectedIndex(index int)

SetFileSelectedIndex sets the selected file index

func (*ApplicationState) SetToolApprovalRequired added in v0.27.0

func (s *ApplicationState) SetToolApprovalRequired(required bool) error

SetToolApprovalRequired marks the current tool as requiring approval

func (*ApplicationState) SetupApprovalUI added in v0.27.0

func (s *ApplicationState) SetupApprovalUI()

SetupApprovalUI initializes approval UI state

func (*ApplicationState) SetupFileSelection added in v0.27.0

func (s *ApplicationState) SetupFileSelection(files []string)

SetupFileSelection initializes file selection state

func (*ApplicationState) StartChatSession added in v0.27.0

func (s *ApplicationState) StartChatSession(requestID, model string, eventChan <-chan ChatEvent)

StartChatSession initializes a new chat session

func (*ApplicationState) StartToolExecution added in v0.27.0

func (s *ApplicationState) StartToolExecution(tools []ToolCall)

StartToolExecution initializes a new tool execution session

func (*ApplicationState) TransitionToView added in v0.27.0

func (s *ApplicationState) TransitionToView(newView ViewState) error

TransitionToView changes the current view with validation

func (*ApplicationState) UpdateChatStatus added in v0.27.0

func (s *ApplicationState) UpdateChatStatus(status ChatStatus) error

UpdateChatStatus updates the chat session status

func (*ApplicationState) UpdateFileSearchQuery added in v0.27.0

func (s *ApplicationState) UpdateFileSearchQuery(query string)

UpdateFileSearchQuery updates the file search query

type ApprovalAction

type ApprovalAction int

ApprovalAction defines the possible approval actions for tool calls

const (
	ApprovalApprove ApprovalAction = iota
	ApprovalReject
)

func (ApprovalAction) String added in v0.27.0

func (a ApprovalAction) String() string

type ApprovalUIState added in v0.27.0

type ApprovalUIState struct {
	SelectedIndex int `json:"selected_index"`
}

ApprovalUIState represents the state of approval UI

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

type CancelledEvent struct {
	RequestID string
	Timestamp time.Time
	Reason    string
}

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
	ReasoningContent 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

type ChatErrorEvent struct {
	RequestID string
	Timestamp time.Time
	Error     error
}

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
	EventToolCallStart
	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, requestID string, model string, messages []sdk.Message) (<-chan ChatEvent, error)
	CancelRequest(requestID string) error
	GetMetrics(requestID string) *ChatMetrics
}

ChatService handles chat completion operations

type ChatSession added in v0.27.0

type ChatSession struct {
	RequestID       string
	Status          ChatStatus
	StartTime       time.Time
	Model           string
	EventChannel    <-chan ChatEvent
	IsFirstChunk    bool
	HasToolCalls    bool
	PendingMessages []sdk.Message
	LastActivity    time.Time
}

ChatSession represents an active chat session state

type ChatSessionSnapshot added in v0.27.0

type ChatSessionSnapshot struct {
	RequestID    string    `json:"request_id"`
	Status       string    `json:"status"`
	Model        string    `json:"model"`
	StartTime    time.Time `json:"start_time"`
	IsFirstChunk bool      `json:"is_first_chunk"`
	HasToolCalls bool      `json:"has_tool_calls"`
	LastActivity time.Time `json:"last_activity"`
}

ChatSessionSnapshot represents a snapshot of chat session state

type ChatStartEvent

type ChatStartEvent struct {
	RequestID string
	Timestamp time.Time
	Model     string
}

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 ChatStatus added in v0.27.0

type ChatStatus int

ChatStatus represents the current chat operation status

const (
	ChatStatusIdle ChatStatus = iota
	ChatStatusStarting
	ChatStatusThinking
	ChatStatusGenerating
	ChatStatusReceivingTools
	ChatStatusWaitingTools
	ChatStatusCompleted
	ChatStatusError
	ChatStatusCancelled
)

func (ChatStatus) String added in v0.27.0

func (c ChatStatus) String() string

type ConfigService added in v0.27.0

type ConfigService interface {
	// Tool approval configuration
	IsApprovalRequired(toolName string) bool

	// Debug and output configuration
	IsDebugMode() bool
	GetOutputDirectory() string

	// Gateway configuration
	GetGatewayURL() string
	GetAPIKey() string
	GetTimeout() int

	// Chat configuration
	GetSystemPrompt() string
	GetDefaultModel() string
}

ConfigService provides configuration-related functionality

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"`
}

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
	AddTokenUsage(inputTokens, outputTokens, totalTokens int) error
	GetSessionTokens() SessionTokenStats
}

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"`
	Diff            string `json:"diff,omitempty"`
}

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 FileInfo

type FileInfo struct {
	Path  string
	Size  int64
	IsDir bool
}

FileInfo contains file metadata

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 FileSelectionState added in v0.27.0

type FileSelectionState struct {
	Files         []string `json:"files"`
	SearchQuery   string   `json:"search_query"`
	SelectedIndex int      `json:"selected_index"`
}

FileSelectionState represents the state of file selection UI

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 SessionTokenStats added in v0.28.0

type SessionTokenStats struct {
	TotalInputTokens  int `json:"total_input_tokens"`
	TotalOutputTokens int `json:"total_output_tokens"`
	TotalTokens       int `json:"total_tokens"`
	RequestCount      int `json:"request_count"`
}

SessionTokenStats tracks accumulated token usage across a session

type StateSnapshot added in v0.27.0

type StateSnapshot struct {
	CurrentView   string                 `json:"current_view"`
	PreviousView  string                 `json:"previous_view"`
	Width         int                    `json:"width"`
	Height        int                    `json:"height"`
	DebugMode     bool                   `json:"debug_mode"`
	Timestamp     time.Time              `json:"timestamp"`
	ChatSession   *ChatSessionSnapshot   `json:"chat_session,omitempty"`
	ToolExecution *ToolExecutionSnapshot `json:"tool_execution,omitempty"`
}

StateSnapshot represents a point-in-time snapshot of application state

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]any) (*ToolExecutionResult, error)

	// Validate checks if the tool arguments are valid
	Validate(args map[string]any) error

	// IsEnabled returns whether this tool is enabled
	IsEnabled() bool
}

Tool represents a single tool with its definition, handler, and validator

type ToolCall added in v0.27.0

type ToolCall struct {
	ID        string               `json:"id"`
	Name      string               `json:"name"`
	Arguments map[string]any       `json:"arguments"`
	Status    ToolCallStatus       `json:"status"`
	Result    *ToolExecutionResult `json:"result,omitempty"`
	StartTime time.Time            `json:"start_time"`
	EndTime   *time.Time           `json:"end_time,omitempty"`
}

ToolCall represents a tool call with proper typing

type ToolCallEvent

type ToolCallEvent struct {
	RequestID  string
	Timestamp  time.Time
	ToolCallID string
	ToolName   string
	Args       string
}

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 ToolCallSnapshot added in v0.27.0

type ToolCallSnapshot struct {
	ID        string    `json:"id"`
	Name      string    `json:"name"`
	Status    string    `json:"status"`
	StartTime time.Time `json:"start_time"`
}

ToolCallSnapshot represents a snapshot of tool call state

type ToolCallStartEvent added in v0.27.0

type ToolCallStartEvent struct {
	RequestID string
	Timestamp time.Time
}

ToolCallStartEvent indicates tool calls have started being received

func (ToolCallStartEvent) GetRequestID added in v0.27.0

func (e ToolCallStartEvent) GetRequestID() string

func (ToolCallStartEvent) GetTimestamp added in v0.27.0

func (e ToolCallStartEvent) GetTimestamp() time.Time

func (ToolCallStartEvent) GetType added in v0.27.0

func (e ToolCallStartEvent) GetType() ChatEventType

type ToolCallStatus added in v0.27.0

type ToolCallStatus int

ToolCallStatus represents the status of an individual tool call

const (
	ToolCallStatusPending ToolCallStatus = iota
	ToolCallStatusWaitingApproval
	ToolCallStatusExecuting
	ToolCallStatusCompleted
	ToolCallStatusFailed
	ToolCallStatusCancelled
	ToolCallStatusDenied
)

func (ToolCallStatus) String added in v0.27.0

func (t ToolCallStatus) String() string

type ToolDefinition

type ToolDefinition struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Parameters  any    `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]any    `json:"arguments"`
	Success   bool              `json:"success"`
	Duration  time.Duration     `json:"duration"`
	Error     string            `json:"error,omitempty"`
	Data      any               `json:"data,omitempty"`
	Metadata  map[string]string `json:"metadata,omitempty"`
	Diff      string            `json:"diff,omitempty"`
}

ToolExecutionResult represents the complete result of a tool execution

type ToolExecutionSession added in v0.27.0

type ToolExecutionSession struct {
	CurrentTool      *ToolCall
	RemainingTools   []ToolCall
	TotalTools       int
	CompletedTools   int
	Status           ToolExecutionStatus
	RequiresApproval bool
	ApprovalChoice   ApprovalAction
	StartTime        time.Time
}

ToolExecutionSession represents an active tool execution session

type ToolExecutionSnapshot added in v0.27.0

type ToolExecutionSnapshot struct {
	Status           string            `json:"status"`
	TotalTools       int               `json:"total_tools"`
	CompletedTools   int               `json:"completed_tools"`
	RequiresApproval bool              `json:"requires_approval"`
	StartTime        time.Time         `json:"start_time"`
	CurrentTool      *ToolCallSnapshot `json:"current_tool,omitempty"`
}

ToolExecutionSnapshot represents a snapshot of tool execution state

type ToolExecutionStatus added in v0.27.0

type ToolExecutionStatus int

ToolExecutionStatus represents the overall tool execution session status

const (
	ToolExecutionStatusIdle ToolExecutionStatus = iota
	ToolExecutionStatusProcessing
	ToolExecutionStatusWaitingApproval
	ToolExecutionStatusExecuting
	ToolExecutionStatusCompleted
	ToolExecutionStatusFailed
)

func (ToolExecutionStatus) String added in v0.27.0

func (t ToolExecutionStatus) String() string

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]any) (*ToolExecutionResult, error)
	IsToolEnabled(name string) bool
	ValidateTool(name string, args map[string]any) 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 ViewState added in v0.27.0

type ViewState int

ViewState represents the current view with proper state management

const (
	ViewStateModelSelection ViewState = iota
	ViewStateChat
	ViewStateFileSelection
	ViewStateToolApproval
)

func (ViewState) String added in v0.27.0

func (v ViewState) String() string

type WebFetchService added in v0.29.2

type WebFetchService interface {
	ValidateURL(url string) error
	FetchContent(ctx context.Context, target string) (*FetchResult, error)
	ClearCache()
	GetCacheStats() map[string]any
}

WebFetchService handles content fetching operations

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL