services

package
v0.11.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CacheEntry added in v0.11.1

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.1

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

FetchService handles content fetching operations

func NewFetchService added in v0.11.1

func NewFetchService(cfg *config.Config) *FetchService

NewFetchService creates a new FetchService

func (*FetchService) ClearCache added in v0.11.1

func (f *FetchService) ClearCache()

ClearCache clears all cached content

func (*FetchService) FetchContent added in v0.11.1

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.1

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

GetCacheStats returns cache statistics

func (*FetchService) ValidateURL added in v0.11.1

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

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

type FileReadResult added in v0.8.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"`
}

FileReadResult represents the result of a file read operation

type GitHubReference added in v0.11.1

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

GitHubReference represents a GitHub issue or PR reference

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) *LLMToolService

NewLLMToolService creates a new LLM tool service

func (*LLMToolService) ExecuteTool

func (s *LLMToolService) ExecuteTool(ctx context.Context, name string, args map[string]interface{}) (string, 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.8.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{}) (string, 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"`
}

ToolResult represents the result of a tool execution

Jump to

Keyboard shortcuts

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