services

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2025 License: MIT Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheEntry added in v0.11.0

type CacheEntry struct {
	Content   string    `json:"content"`
	Timestamp time.Time `json:"timestamp"`
	URL       string    `json:"url"`
}

CacheEntry represents a cached fetch result

type FetchService added in v0.11.0

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

FetchService handles content fetching operations

func NewFetchService added in v0.11.0

func NewFetchService(cfg *config.Config) *FetchService

NewFetchService creates a new FetchService

func (*FetchService) ClearCache added in v0.11.0

func (f *FetchService) ClearCache()

ClearCache clears all cached content

func (*FetchService) FetchContent added in v0.11.0

func (f *FetchService) FetchContent(ctx context.Context, target string) (*domain.FetchResult, error)

FetchContent fetches content from a URL or GitHub reference

func (*FetchService) GetCacheStats added in v0.11.0

func (f *FetchService) GetCacheStats() map[string]interface{}

GetCacheStats returns cache statistics

func (*FetchService) ValidateURL added in v0.11.0

func (f *FetchService) ValidateURL(targetURL string) error

ValidateURL checks if a URL's domain is whitelisted for fetching

type FileReadResult added in v0.7.0

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

type GitHubReference added in v0.11.0

type GitHubReference struct {
	Owner  string
	Repo   string
	Number int
	Type   string // "issue" or "pull"
}

GitHubReference represents a GitHub issue or PR reference

type GoogleSearchItem added in v0.13.0

type GoogleSearchItem struct {
	Title   string `json:"title"`
	Link    string `json:"link"`
	Snippet string `json:"snippet"`
}

GoogleSearchItem represents a single search result from Google API

type GoogleSearchResponse added in v0.13.0

type GoogleSearchResponse struct {
	Items []GoogleSearchItem `json:"items"`
}

GoogleSearchResponse represents the response from Google Custom Search API

type HTTPModelService

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

HTTPModelService implements ModelService using HTTP API calls

func NewHTTPModelService

func NewHTTPModelService(baseURL, apiKey string) *HTTPModelService

NewHTTPModelService creates a new HTTP-based model service

func (*HTTPModelService) GetCurrentModel

func (s *HTTPModelService) GetCurrentModel() string

func (*HTTPModelService) IsModelAvailable

func (s *HTTPModelService) IsModelAvailable(modelID string) bool

func (*HTTPModelService) ListModels

func (s *HTTPModelService) ListModels(ctx context.Context) ([]string, error)

func (*HTTPModelService) SelectModel

func (s *HTTPModelService) SelectModel(modelID string) error

func (*HTTPModelService) ValidateModel

func (s *HTTPModelService) ValidateModel(modelID string) error

type InMemoryConversationRepository

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

InMemoryConversationRepository implements ConversationRepository using in-memory storage

func NewInMemoryConversationRepository

func NewInMemoryConversationRepository() *InMemoryConversationRepository

NewInMemoryConversationRepository creates a new in-memory conversation repository

func (*InMemoryConversationRepository) AddMessage

func (*InMemoryConversationRepository) Clear

func (*InMemoryConversationRepository) Export

func (*InMemoryConversationRepository) GetMessageCount

func (r *InMemoryConversationRepository) GetMessageCount() int

func (*InMemoryConversationRepository) GetMessages

func (*InMemoryConversationRepository) UpdateLastMessage

func (r *InMemoryConversationRepository) UpdateLastMessage(content string) error

func (*InMemoryConversationRepository) UpdateLastMessageToolCalls

func (r *InMemoryConversationRepository) UpdateLastMessageToolCalls(toolCalls *[]sdk.ChatCompletionMessageToolCall) error

type LLMToolService

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

LLMToolService implements ToolService with direct tool execution

func NewLLMToolService

func NewLLMToolService(cfg *config.Config, fileService domain.FileService, fetchService domain.FetchService, webSearchService domain.WebSearchService) *LLMToolService

NewLLMToolService creates a new LLM tool service

func (*LLMToolService) ExecuteTool

func (s *LLMToolService) ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (*domain.ToolExecutionResult, error)

func (*LLMToolService) IsToolEnabled

func (s *LLMToolService) IsToolEnabled(name string) bool

func (*LLMToolService) ListTools

func (s *LLMToolService) ListTools() []domain.ToolDefinition

func (*LLMToolService) ValidateTool

func (s *LLMToolService) ValidateTool(name string, args map[string]interface{}) error

type LocalFileService

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

LocalFileService implements FileService using local filesystem operations

func NewLocalFileService

func NewLocalFileService(cfg *config.Config) *LocalFileService

NewLocalFileService creates a new local file service

func (*LocalFileService) GetFileInfo

func (s *LocalFileService) GetFileInfo(path string) (domain.FileInfo, error)

func (*LocalFileService) ListProjectFiles

func (s *LocalFileService) ListProjectFiles() ([]string, error)

func (*LocalFileService) ReadFile

func (s *LocalFileService) ReadFile(path string) (string, error)

func (*LocalFileService) ReadFileLines added in v0.7.0

func (s *LocalFileService) ReadFileLines(path string, startLine, endLine int) (string, error)

func (*LocalFileService) ValidateFile

func (s *LocalFileService) ValidateFile(path string) error

type ModelsResponse

type ModelsResponse struct {
	Data []struct {
		ID     string `json:"id"`
		Object string `json:"object"`
	} `json:"data"`
}

ModelsResponse represents the API response for listing models

type NoOpToolService

type NoOpToolService struct{}

NoOpToolService implements ToolService as a no-op (when tools are disabled)

func NewNoOpToolService

func NewNoOpToolService() *NoOpToolService

NewNoOpToolService creates a new no-op tool service

func (*NoOpToolService) ExecuteTool

func (s *NoOpToolService) ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (*domain.ToolExecutionResult, error)

func (*NoOpToolService) IsToolEnabled

func (s *NoOpToolService) IsToolEnabled(name string) bool

func (*NoOpToolService) ListTools

func (s *NoOpToolService) ListTools() []domain.ToolDefinition

func (*NoOpToolService) ValidateTool

func (s *NoOpToolService) ValidateTool(name string, args map[string]interface{}) error

type StreamingChatService

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

StreamingChatService implements ChatService using streaming SDK client

func NewStreamingChatService

func NewStreamingChatService(baseURL, apiKey string, timeoutSeconds int, toolService domain.ToolService, systemPrompt string) *StreamingChatService

NewStreamingChatService creates a new streaming chat service

func (*StreamingChatService) CancelRequest

func (s *StreamingChatService) CancelRequest(requestID string) error

func (*StreamingChatService) GetMetrics

func (s *StreamingChatService) GetMetrics(requestID string) *domain.ChatMetrics

func (*StreamingChatService) SendMessage

func (s *StreamingChatService) SendMessage(ctx context.Context, model string, messages []sdk.Message) (<-chan domain.ChatEvent, error)

type ToolResult

type ToolResult struct {
	Command  string `json:"command"`
	Output   string `json:"output"`
	Error    string `json:"error,omitempty"`
	ExitCode int    `json:"exit_code"`
	Duration string `json:"duration"`
}

Internal result types for backwards compatibility with existing methods

type WebSearchEngine added in v0.13.0

type WebSearchEngine string

WebSearchEngine represents different search engines

const (
	GoogleSearch     WebSearchEngine = "google"
	DuckDuckGoSearch WebSearchEngine = "duckduckgo"
)

type WebSearchService added in v0.13.0

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

WebSearchService handles web search operations

func NewWebSearchService added in v0.13.0

func NewWebSearchService() *WebSearchService

NewWebSearchService creates a new web search service

func (*WebSearchService) IsEnabled added in v0.13.0

func (s *WebSearchService) IsEnabled() bool

IsEnabled returns whether the web search service is enabled

func (*WebSearchService) SearchDuckDuckGo added in v0.13.0

func (s *WebSearchService) SearchDuckDuckGo(ctx context.Context, query string, maxResults int) (*domain.WebSearchResponse, error)

SearchDuckDuckGo performs a DuckDuckGo search using their instant answer API

func (*WebSearchService) SearchGoogle added in v0.13.0

func (s *WebSearchService) SearchGoogle(ctx context.Context, query string, maxResults int) (*domain.WebSearchResponse, error)

SearchGoogle performs a Google search using the Custom Search JSON API

func (*WebSearchService) SetEnabled added in v0.13.0

func (s *WebSearchService) SetEnabled(enabled bool)

SetEnabled sets the enabled state of the web search service

Jump to

Keyboard shortcuts

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