mcp

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2025 License: AGPL-3.0 Imports: 34 Imported by: 0

Documentation

Overview

internal/mcp/path_resolver.go

internal/mcp/workspace_handlers.go

internal/mcp/workspace_manager.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseToolCall

func ParseToolCall(text string) (serverName, toolName string, arguments map[string]interface{}, found bool)

ParseToolCall parses a tool call from AI response

func SetupRecursiveAgent

func SetupRecursiveAgent(server *MateyMCPServer, newTermChatFunc func() interface{})

SetupRecursiveAgent configures the MCP server to use recursive TermChat instances This function should be called from the chat package to avoid circular imports

Types

type AddContextRequest

type AddContextRequest struct {
	Type     string                 `json:"type"`
	FilePath string                 `json:"file_path,omitempty"`
	Content  string                 `json:"content"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
	Priority float64                `json:"priority,omitempty"`
}

AddContextRequest represents a request to add context

type AddContextResponse

type AddContextResponse struct {
	Success    bool                   `json:"success"`
	ItemID     string                 `json:"item_id,omitempty"`
	TokenCount int                    `json:"token_count"`
	Error      string                 `json:"error,omitempty"`
	Metadata   map[string]interface{} `json:"metadata,omitempty"`
}

AddContextResponse represents the response from adding context

type AgentFactory

type AgentFactory func() interface{}

AgentFactory represents a function that can create a new TermChat instance

type AgentProgress

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

AgentProgress tracks progress of a sub-agent execution

func NewAgentProgress

func NewAgentProgress() *AgentProgress

NewAgentProgress creates a new progress tracker

func (*AgentProgress) GetSummary

func (p *AgentProgress) GetSummary() string

GetSummary returns a final summary of the agent execution

func (*AgentProgress) UpdateDisplay

func (p *AgentProgress) UpdateDisplay(toolCall ToolCallSummary)

UpdateDisplay updates the progress display with a new tool call

type AgentResult

type AgentResult struct {
	ObjectiveCompleted bool           `json:"objective_completed"`
	Result             string         `json:"result"`
	ExecutionSummary   string         `json:"execution_summary"`
	ExecutionLog       []string       `json:"execution_log,omitempty"`
	ToolCallsMade      int            `json:"tool_calls_made"`
	ToolsUsed          map[string]int `json:"tools_used"`
	DurationSeconds    float64        `json:"duration_seconds"`
	StructuredData     interface{}    `json:"structured_data,omitempty"`
	Errors             []string       `json:"errors,omitempty"`
}

AgentResult represents the structured result from agent execution

type BashCommandArgs

type BashCommandArgs struct {
	Command          string `json:"command"`
	WorkingDirectory string `json:"working_directory,omitempty"`
	Timeout          int    `json:"timeout,omitempty"` // in seconds
	Description      string `json:"description,omitempty"`
}

BashCommandArgs represents arguments for bash command execution

type BashCommandResult

type BashCommandResult struct {
	Command     string `json:"command"`
	ExitCode    int    `json:"exit_code"`
	Stdout      string `json:"stdout"`
	Stderr      string `json:"stderr"`
	Duration    string `json:"duration"`
	WorkingDir  string `json:"working_dir"`
	Description string `json:"description,omitempty"`
}

BashCommandResult represents the result of bash command execution

type BasicGetWorkingDirectoryResult

type BasicGetWorkingDirectoryResult struct {
	WorkingDirectory string `json:"working_directory"`
	AbsolutePath     string `json:"absolute_path"`
}

BasicGetWorkingDirectoryResult represents the result of getting working directory

type BasicListFilesRequest

type BasicListFilesRequest struct {
	DirectoryPath string `json:"directory_path,omitempty"`
	Recursive     bool   `json:"recursive,omitempty"`
	MaxResults    int    `json:"max_results,omitempty"`
}

BasicListFilesRequest represents a request to list files

type BasicListFilesResult

type BasicListFilesResult struct {
	Files []FileInfo `json:"files"`
	Count int        `json:"count"`
	Error string     `json:"error,omitempty"`
}

BasicListFilesResult represents the result of listing files

type BasicReadFileRequest

type BasicReadFileRequest struct {
	AbsolutePath string `json:"absolute_path"`
	Offset       int    `json:"offset,omitempty"`
	Limit        int    `json:"limit,omitempty"`
}

BasicReadFileRequest represents a request to read a file

type BasicReadFileResult

type BasicReadFileResult struct {
	Content string `json:"content"`
	Error   string `json:"error,omitempty"`
}

BasicReadFileResult represents the result of reading a file

type BasicWriteFileRequest

type BasicWriteFileRequest struct {
	FilePath string `json:"file_path"`
	Content  string `json:"content"`
}

BasicWriteFileRequest represents a request to write a file

type BasicWriteFileResult

type BasicWriteFileResult struct {
	Success  bool   `json:"success"`
	FilePath string `json:"file_path"`
	Error    string `json:"error,omitempty"`
}

BasicWriteFileResult represents the result of writing a file

type ClearContextRequest

type ClearContextRequest struct {
	Types     []string `json:"types,omitempty"`
	OlderThan int64    `json:"older_than,omitempty"` // Unix timestamp
	FilePath  string   `json:"file_path,omitempty"`
}

ClearContextRequest represents a request to clear context

type ClearContextResponse

type ClearContextResponse struct {
	Success      bool                   `json:"success"`
	ItemsRemoved int                    `json:"items_removed"`
	Error        string                 `json:"error,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

ClearContextResponse represents the response from clearing context

type Content

type Content struct {
	Type string `json:"type"`
	Text string `json:"text"`
}

Content represents content in a tool result

type ContextToolConfig

type ContextToolConfig struct {
	MaxTokens          int     `json:"max_tokens"`
	TruncationStrategy string  `json:"truncation_strategy"`
	EnableMentions     bool    `json:"enable_mentions"`
	AutoTrack          bool    `json:"auto_track"`
	RelevanceThreshold float64 `json:"relevance_threshold"`
	MaxContextItems    int     `json:"max_context_items"`
}

ContextToolConfig configures the context-aware MCP tools

type ContextTools

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

ContextTools provides MCP tools with intelligent context management

func NewContextTools

func NewContextTools(
	config ContextToolConfig,
	contextManager *appcontext.ContextManager,
	fileDiscovery *appcontext.FileDiscovery,
	mentionProcessor *appcontext.MentionProcessor,
	parser *treesitter.TreeSitterParser,
) *ContextTools

NewContextTools creates a new context tools instance

func (*ContextTools) AddContext

func (ct *ContextTools) AddContext(ctx context.Context, request AddContextRequest) (*AddContextResponse, error)

AddContext implements the add_context MCP tool

func (*ContextTools) ClearContext

func (ct *ContextTools) ClearContext(ctx context.Context, request ClearContextRequest) (*ClearContextResponse, error)

ClearContext implements the clear_context MCP tool

func (*ContextTools) GetContext

func (ct *ContextTools) GetContext(ctx context.Context, request GetContextRequest) (*GetContextResponse, error)

GetContext implements the get_context MCP tool

func (*ContextTools) GetContextStats

func (ct *ContextTools) GetContextStats(ctx context.Context, request GetContextStatsRequest) (*GetContextStatsResponse, error)

GetContextStats implements the get_context_stats MCP tool

func (*ContextTools) GetRelevantFiles

func (ct *ContextTools) GetRelevantFiles(ctx context.Context, request GetRelevantFilesRequest) (*GetRelevantFilesResponse, error)

GetRelevantFiles implements the get_relevant_files MCP tool

func (*ContextTools) ProcessMentions

func (ct *ContextTools) ProcessMentions(ctx context.Context, request ProcessMentionsRequest) (*ProcessMentionsResponse, error)

ProcessMentions implements the process_mentions MCP tool

type EditFileRequest

type EditFileRequest struct {
	FilePath    string `json:"file_path"`
	Content     string `json:"content,omitempty"`
	DiffContent string `json:"diff_content,omitempty"`
	CreateFile  bool   `json:"create_file,omitempty"`
	ShowPreview bool   `json:"show_preview,omitempty"`
	AutoApprove bool   `json:"auto_approve,omitempty"`
}

EditFileRequest represents a request to edit a file

type EditFileResponse

type EditFileResponse struct {
	Success     bool                   `json:"success"`
	FilePath    string                 `json:"file_path"`
	Applied     bool                   `json:"applied"`
	Preview     string                 `json:"preview,omitempty"`
	DiffPreview string                 `json:"diff_preview,omitempty"`
	Backup      string                 `json:"backup,omitempty"`
	Error       string                 `json:"error,omitempty"`
	Metadata    map[string]interface{} `json:"metadata,omitempty"`
}

EditFileResponse represents the response from editing a file

type EnhancedToolConfig

type EnhancedToolConfig struct {
	EnableVisualDiff  bool   `json:"enable_visual_diff"`
	EnablePreview     bool   `json:"enable_preview"`
	AutoApprove       bool   `json:"auto_approve"`
	MaxFileSize       int64  `json:"max_file_size"`
	ContextTracking   bool   `json:"context_tracking"`
	BackupEnabled     bool   `json:"backup_enabled"`
	ValidationEnabled bool   `json:"validation_enabled"`
	DiffMode          string `json:"diff_mode"` // unified, side-by-side, inline
}

EnhancedToolConfig configures the enhanced MCP tools

type EnhancedTools

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

EnhancedTools provides MCP tools with advanced visual and context features

func NewEnhancedTools

func NewEnhancedTools(
	config EnhancedToolConfig,
	fileEditor *edit.FileEditor,
	contextManager *appcontext.ContextManager,
	fileDiscovery *appcontext.FileDiscovery,
	parser *treesitter.TreeSitterParser,
	mentionProcessor *appcontext.MentionProcessor,
) *EnhancedTools

NewEnhancedTools creates a new enhanced tools instance

func (*EnhancedTools) EditFile

func (et *EnhancedTools) EditFile(ctx context.Context, request EditFileRequest) (*EditFileResponse, error)

EditFile implements the enhanced edit_file MCP tool

func (*EnhancedTools) ListDefinitions

func (et *EnhancedTools) ListDefinitions(ctx context.Context, request ListDefinitionsRequest) (*ListDefinitionsResponse, error)

ListDefinitions implements the list_definitions MCP tool

func (*EnhancedTools) ParseCode

func (et *EnhancedTools) ParseCode(ctx context.Context, request ParseCodeRequest) (*ParseCodeResponse, error)

ParseCode implements the parse_code MCP tool

func (*EnhancedTools) ReadFile

func (et *EnhancedTools) ReadFile(ctx context.Context, request ReadFileRequest) (*ReadFileResponse, error)

ReadFile implements the enhanced read_file MCP tool

func (*EnhancedTools) SearchFiles

func (et *EnhancedTools) SearchFiles(ctx context.Context, request SearchFilesRequest) (*SearchFilesResponse, error)

SearchFiles implements the enhanced search_files MCP tool

type FileInfo

type FileInfo struct {
	Name         string `json:"name"`
	Path         string `json:"path"`
	RelativePath string `json:"relative_path"`
	IsDirectory  bool   `json:"is_directory"`
	Size         int64  `json:"size"`
	ModTime      string `json:"mod_time"`
	Mode         string `json:"mode"`
}

FileInfo represents information about a file

type FileSearchResult

type FileSearchResult struct {
	FilePath     string `json:"file_path"`
	RelativePath string `json:"relative_path"`
	Language     string `json:"language,omitempty"`
	Size         int64  `json:"size"`
	ModTime      string `json:"mod_time"`
	Score        int    `json:"score,omitempty"`
	Preview      string `json:"preview,omitempty"`
	GitStatus    string `json:"git_status,omitempty"`
}

FileSearchResult represents a single file search result

type FilesystemTools

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

FilesystemTools provides basic filesystem operations similar to Gemini CLI

func NewFilesystemTools

func NewFilesystemTools(workingDirectory string) *FilesystemTools

NewFilesystemTools creates a new filesystem tools instance

func (*FilesystemTools) GetWorkingDirectory

func (ft *FilesystemTools) GetWorkingDirectory(ctx context.Context) (*BasicGetWorkingDirectoryResult, error)

GetWorkingDirectory returns the current working directory

func (*FilesystemTools) ListFiles

ListFiles lists files in a directory

func (*FilesystemTools) ReadFile

ReadFile reads a file with optional line range

func (*FilesystemTools) WriteFile

WriteFile writes content to a file

type GetContextRequest

type GetContextRequest struct {
	IncludeFiles    bool     `json:"include_files,omitempty"`
	IncludeEdits    bool     `json:"include_edits,omitempty"`
	IncludeMentions bool     `json:"include_mentions,omitempty"`
	IncludeLogs     bool     `json:"include_logs,omitempty"`
	FilterTypes     []string `json:"filter_types,omitempty"`
	MaxItems        int      `json:"max_items,omitempty"`
	SinceTimestamp  int64    `json:"since_timestamp,omitempty"`
}

GetContextRequest represents a request to get current context

type GetContextResponse

type GetContextResponse struct {
	Success     bool                      `json:"success"`
	Context     *appcontext.ContextWindow `json:"context"`
	Items       []appcontext.ContextItem  `json:"items"`
	TotalTokens int                       `json:"total_tokens"`
	TotalItems  int                       `json:"total_items"`
	Truncated   bool                      `json:"truncated"`
	Strategy    string                    `json:"strategy,omitempty"`
	Error       string                    `json:"error,omitempty"`
	Metadata    map[string]interface{}    `json:"metadata,omitempty"`
}

GetContextResponse represents the response from getting context

type GetContextStatsRequest

type GetContextStatsRequest struct {
	IncludeDetails bool `json:"include_details,omitempty"`
}

GetContextStatsRequest represents a request for context statistics

type GetContextStatsResponse

type GetContextStatsResponse struct {
	Success  bool                   `json:"success"`
	Stats    map[string]interface{} `json:"stats"`
	Error    string                 `json:"error,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

GetContextStatsResponse represents context statistics

type GetRelevantFilesRequest

type GetRelevantFilesRequest struct {
	Query          string   `json:"query"`
	CurrentFile    string   `json:"current_file,omitempty"`
	FileTypes      []string `json:"file_types,omitempty"`
	MaxResults     int      `json:"max_results,omitempty"`
	IncludeContent bool     `json:"include_content,omitempty"`
	UseContext     bool     `json:"use_context,omitempty"`
}

GetRelevantFilesRequest represents a request to get relevant files

type GetRelevantFilesResponse

type GetRelevantFilesResponse struct {
	Success  bool                   `json:"success"`
	Query    string                 `json:"query"`
	Files    []RelevantFile         `json:"files"`
	Count    int                    `json:"count"`
	Error    string                 `json:"error,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

GetRelevantFilesResponse represents the response from getting relevant files

type ListDefinitionsRequest

type ListDefinitionsRequest struct {
	Directory  string   `json:"directory,omitempty"`
	FilePaths  []string `json:"file_paths,omitempty"`
	Types      []string `json:"types,omitempty"`
	Languages  []string `json:"languages,omitempty"`
	MaxResults int      `json:"max_results,omitempty"`
}

ListDefinitionsRequest represents a request to list code definitions

type ListDefinitionsResponse

type ListDefinitionsResponse struct {
	Success     bool                    `json:"success"`
	Definitions []treesitter.Definition `json:"definitions"`
	Count       int                     `json:"count"`
	Error       string                  `json:"error,omitempty"`
	Metadata    map[string]interface{}  `json:"metadata,omitempty"`
}

ListDefinitionsResponse represents the response from listing definitions

type MCPClient

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

MCPClient represents a client for connecting to MCP servers via proxy

func NewMCPClient

func NewMCPClient(proxyURL string) *MCPClient

NewMCPClient creates a new MCP client

func (*MCPClient) CallTool

func (c *MCPClient) CallTool(ctx context.Context, serverName, toolName string, arguments map[string]interface{}) (*ToolResult, error)

CallTool calls a specific tool on an MCP server

func (*MCPClient) ExecuteToolCall

func (c *MCPClient) ExecuteToolCall(ctx context.Context, serverName, toolName string, arguments map[string]interface{}) string

ExecuteToolCall executes a tool call and returns formatted result

func (*MCPClient) GetAvailableTools

func (c *MCPClient) GetAvailableTools(ctx context.Context) string

GetAvailableTools returns a formatted list of all available tools

func (*MCPClient) GetServerTools

func (c *MCPClient) GetServerTools(ctx context.Context, serverName string) ([]Tool, error)

GetServerTools gets all tools for a specific server

func (*MCPClient) ListServers

func (c *MCPClient) ListServers(ctx context.Context) ([]ServerInfo, error)

ListServers lists all available MCP servers

type MCPError

type MCPError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

MCPError represents an error from an MCP server

type MCPRequest

type MCPRequest struct {
	Method string      `json:"method"`
	Params interface{} `json:"params"`
}

MCPRequest represents a request to an MCP server

type MCPResponse

type MCPResponse struct {
	Result interface{} `json:"result,omitempty"`
	Error  *MCPError   `json:"error,omitempty"`
}

MCPResponse represents a response from an MCP server

type MCPServerIntegration

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

MCPServerIntegration provides enhanced MCP server functionality

func NewMCPServerIntegration

func NewMCPServerIntegration(cfg *config.ComposeConfig) (*MCPServerIntegration, error)

NewMCPServerIntegration creates a new MCP server integration

func (*MCPServerIntegration) CallTool

func (msi *MCPServerIntegration) CallTool(ctx context.Context, name string, params json.RawMessage) (interface{}, error)

CallTool handles MCP tool calls

func (*MCPServerIntegration) GetStats

func (msi *MCPServerIntegration) GetStats() map[string]interface{}

GetStats returns statistics about the MCP server integration

func (*MCPServerIntegration) GetToolDefinitions

func (msi *MCPServerIntegration) GetToolDefinitions() []ToolDefinition

GetToolDefinitions returns all available tool definitions

func (*MCPServerIntegration) Shutdown

func (msi *MCPServerIntegration) Shutdown(ctx context.Context) error

Shutdown gracefully shuts down the MCP server integration

type MateyMCPServer

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

MateyMCPServer provides MCP tools for interacting with Matey and the cluster

func NewMateyMCPServer

func NewMateyMCPServer(mateyBinary, configFile, namespace string) *MateyMCPServer

NewMateyMCPServer creates a new Matey MCP server

func (*MateyMCPServer) ExecuteTool

func (m *MateyMCPServer) ExecuteTool(ctx context.Context, name string, arguments map[string]interface{}) (*ToolResult, error)

ExecuteTool executes a tool by name with the given arguments - slimmed down version

func (*MateyMCPServer) GetTools

func (m *MateyMCPServer) GetTools() []Tool

GetTools returns the available MCP tools - slimmed down version with 21 consolidated tools

func (*MateyMCPServer) SetAgentFactory

func (m *MateyMCPServer) SetAgentFactory(factory AgentFactory)

SetAgentFactory sets the factory function for creating TermChat instances

type MountInfo

type MountInfo struct {
	WorkflowName string    `json:"workflowName"`
	ExecutionID  string    `json:"executionID"`
	PVCName      string    `json:"pvcName"`
	MountPath    string    `json:"mountPath"`
	MountedAt    time.Time `json:"mountedAt"`
	LastAccess   time.Time `json:"lastAccess"`
	AccessCount  int64     `json:"accessCount"`
}

MountInfo represents information about a mounted workspace

type ParseCodeRequest

type ParseCodeRequest struct {
	FilePath    string   `json:"file_path"`
	Content     string   `json:"content,omitempty"`
	QueryTypes  []string `json:"query_types,omitempty"`
	IncludeBody bool     `json:"include_body,omitempty"`
}

ParseCodeRequest represents a request to parse code structure

type ParseCodeResponse

type ParseCodeResponse struct {
	Success     bool                    `json:"success"`
	FilePath    string                  `json:"file_path"`
	Language    string                  `json:"language"`
	Definitions []treesitter.Definition `json:"definitions"`
	Structure   map[string]interface{}  `json:"structure,omitempty"`
	Error       string                  `json:"error,omitempty"`
	Metadata    map[string]interface{}  `json:"metadata,omitempty"`
}

ParseCodeResponse represents the response from parsing code

type PathMapping

type PathMapping struct {
	HostPath      string `json:"host_path"`
	ContainerPath string `json:"container_path"`
	ServerName    string `json:"server_name"`
}

PathMapping represents a path mapping between host and container

type PathResolver

type PathResolver struct {
	// Host working directory (where user started)
	HostWorkingDir string

	// Container working directory (for current MCP server)
	ContainerWorkingDir string
	// contains filtered or unexported fields
}

PathResolver handles path translation between different MCP server contexts

func NewPathResolver

func NewPathResolver() *PathResolver

NewPathResolver creates a new path resolver with dynamic mappings

func (*PathResolver) AddMapping

func (pr *PathResolver) AddMapping(hostPath, containerPath, serverName string)

AddMapping adds a custom path mapping

func (*PathResolver) GetContextInfo

func (pr *PathResolver) GetContextInfo() map[string]interface{}

GetContextInfo returns context information for the AI

func (*PathResolver) GetCurrentWorkingDir

func (pr *PathResolver) GetCurrentWorkingDir() string

GetCurrentWorkingDir returns the appropriate working directory for path resolution

func (*PathResolver) ResolveContainerToHost

func (pr *PathResolver) ResolveContainerToHost(containerPath string) string

ResolveContainerToHost converts a container path to host path

func (*PathResolver) ResolveHostToContainer

func (pr *PathResolver) ResolveHostToContainer(hostPath, serverName string) string

ResolveHostToContainer converts a host path to container path for a specific server

func (*PathResolver) ResolveWorkingDir

func (pr *PathResolver) ResolveWorkingDir(workingDir string) string

ResolveWorkingDir resolves a working directory based on context

type ProcessMentionsRequest

type ProcessMentionsRequest struct {
	Text         string `json:"text"`
	ExpandInline bool   `json:"expand_inline,omitempty"`
	TrackContext bool   `json:"track_context,omitempty"`
}

ProcessMentionsRequest represents a request to process @-mentions

type ProcessMentionsResponse

type ProcessMentionsResponse struct {
	Success      bool                   `json:"success"`
	OriginalText string                 `json:"original_text"`
	ExpandedText string                 `json:"expanded_text,omitempty"`
	Mentions     []appcontext.Mention   `json:"mentions"`
	TotalTokens  int                    `json:"total_tokens"`
	Error        string                 `json:"error,omitempty"`
	Metadata     map[string]interface{} `json:"metadata,omitempty"`
}

ProcessMentionsResponse represents the response from processing mentions

type ReadFileRequest

type ReadFileRequest struct {
	FilePath       string `json:"file_path"`
	StartLine      int    `json:"start_line,omitempty"`
	EndLine        int    `json:"end_line,omitempty"`
	IncludeContext bool   `json:"include_context,omitempty"`
	TrackInContext bool   `json:"track_in_context,omitempty"`
}

ReadFileRequest represents a request to read a file with context tracking

type ReadFileResponse

type ReadFileResponse struct {
	Success   bool                   `json:"success"`
	FilePath  string                 `json:"file_path"`
	Content   string                 `json:"content"`
	Language  string                 `json:"language,omitempty"`
	LineCount int                    `json:"line_count"`
	Size      int64                  `json:"size"`
	Context   string                 `json:"context,omitempty"`
	Error     string                 `json:"error,omitempty"`
	Metadata  map[string]interface{} `json:"metadata,omitempty"`
}

ReadFileResponse represents the response from reading a file

type RelevantFile

type RelevantFile struct {
	FilePath       string  `json:"file_path"`
	RelativePath   string  `json:"relative_path"`
	RelevanceScore float64 `json:"relevance_score"`
	Language       string  `json:"language,omitempty"`
	Size           int64   `json:"size"`
	ModTime        string  `json:"mod_time"`
	Reason         string  `json:"reason,omitempty"`
	Preview        string  `json:"preview,omitempty"`
	Context        string  `json:"context,omitempty"`
}

RelevantFile represents a file with relevance scoring

type SearchFilesRequest

type SearchFilesRequest struct {
	Query          string   `json:"query"`
	Extensions     []string `json:"extensions,omitempty"`
	MaxResults     int      `json:"max_results,omitempty"`
	IncludeContent bool     `json:"include_content,omitempty"`
	FuzzySearch    bool     `json:"fuzzy_search,omitempty"`
}

SearchFilesRequest represents a request to search files

type SearchFilesResponse

type SearchFilesResponse struct {
	Success  bool                   `json:"success"`
	Query    string                 `json:"query"`
	Results  []FileSearchResult     `json:"results"`
	Count    int                    `json:"count"`
	Error    string                 `json:"error,omitempty"`
	Metadata map[string]interface{} `json:"metadata,omitempty"`
}

SearchFilesResponse represents the response from searching files

type ServerInfo

type ServerInfo struct {
	Name        string `json:"name"`
	Version     string `json:"version"`
	Description string `json:"description"`
	Tools       []Tool `json:"tools"`
}

ServerInfo represents information about an MCP server

type TermChat

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

TermChat interface for bridging to existing implementations This is a temporary bridge - we'll eliminate this dependency later

type TodoItem

type TodoItem struct {
	ID          string       `json:"id"`
	Content     string       `json:"content"`
	Status      TodoStatus   `json:"status"`
	Priority    TodoPriority `json:"priority"`
	CreatedAt   time.Time    `json:"created_at"`
	UpdatedAt   time.Time    `json:"updated_at"`
	CompletedAt *time.Time   `json:"completed_at,omitempty"`
}

type TodoList

type TodoList struct {
	Items []TodoItem `json:"items"`
}

func (*TodoList) AddItem

func (tl *TodoList) AddItem(content string, priority TodoPriority) string

func (*TodoList) ClearCompleted

func (tl *TodoList) ClearCompleted() int

func (*TodoList) GetStats

func (tl *TodoList) GetStats() map[string]interface{}

func (*TodoList) RemoveItem

func (tl *TodoList) RemoveItem(id string) bool

func (*TodoList) UpdateItemStatus

func (tl *TodoList) UpdateItemStatus(id string, status TodoStatus) bool

type TodoPriority

type TodoPriority string
const (
	TodoPriorityLow    TodoPriority = "low"
	TodoPriorityMedium TodoPriority = "medium"
	TodoPriorityHigh   TodoPriority = "high"
	TodoPriorityUrgent TodoPriority = "urgent"
)

type TodoStatus

type TodoStatus string

TODO types (migrated from chat package)

const (
	TodoStatusPending    TodoStatus = "pending"
	TodoStatusInProgress TodoStatus = "in_progress"
	TodoStatusCompleted  TodoStatus = "completed"
	TodoStatusCancelled  TodoStatus = "cancelled"
)

type Tool

type Tool struct {
	Name        string      `json:"name"`
	Description string      `json:"description"`
	InputSchema interface{} `json:"inputSchema"`
}

Tool represents an MCP tool

type ToolCallResult

type ToolCallResult struct {
	ServerName string
	ToolName   string
	Arguments  map[string]interface{}
	Result     *ToolResult
	Error      error
}

ToolCallResult represents the result of calling an MCP tool

type ToolCallSummary

type ToolCallSummary struct {
	Name     string        // Tool name
	Status   string        // ✓, ⚠, ✗
	Summary  string        // "Found 42 files", "Analyzed 156 lines"
	Duration time.Duration // How long the call took
}

ToolCallSummary represents a summary of a tool call for progress display

type ToolDefinition

type ToolDefinition struct {
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	InputSchema map[string]interface{} `json:"inputSchema"`
}

ToolDefinition represents an MCP tool definition

type ToolHandler

type ToolHandler func(ctx context.Context, params json.RawMessage) (interface{}, error)

ToolHandler represents a function that handles MCP tool calls

type ToolResult

type ToolResult struct {
	Content []Content `json:"content"`
	IsError bool      `json:"isError,omitempty"`
}

ToolResult represents the result of a tool execution

type WorkflowStats

type WorkflowStats struct {
	Total         int
	Succeeded     int
	Failed        int
	Running       int
	Pending       int
	AvgDuration   time.Duration
	LastExecution *time.Time
}

WorkflowStats represents calculated statistics for a specific workflow

type WorkspaceManager

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

WorkspaceManager handles mounting and unmounting of workspace PVCs for chat agent access

func NewWorkspaceManager

func NewWorkspaceManager(k8sClient kubernetes.Interface, namespace string, logger logr.Logger) *WorkspaceManager

NewWorkspaceManager creates a new workspace manager

func (*WorkspaceManager) CleanupExpiredMounts

func (wm *WorkspaceManager) CleanupExpiredMounts()

CleanupExpiredMounts unmounts workspaces that haven't been accessed recently

func (*WorkspaceManager) GetMountPath

func (wm *WorkspaceManager) GetMountPath(workflowName, executionID string) (string, bool)

GetMountPath returns the mount path for a workspace if it's mounted

func (*WorkspaceManager) ListMountedWorkspaces

func (wm *WorkspaceManager) ListMountedWorkspaces() []MountInfo

ListMountedWorkspaces returns a list of currently mounted workspaces

func (*WorkspaceManager) MountWorkspacePVC

func (wm *WorkspaceManager) MountWorkspacePVC(workflowName, executionID string) (string, error)

MountWorkspacePVC mounts a workspace PVC and returns the mount path

func (*WorkspaceManager) Shutdown

func (wm *WorkspaceManager) Shutdown()

Shutdown unmounts all workspaces during server shutdown

func (*WorkspaceManager) UnmountWorkspacePVC

func (wm *WorkspaceManager) UnmountWorkspacePVC(workflowName, executionID string) error

UnmountWorkspacePVC unmounts a workspace PVC

func (*WorkspaceManager) UpdateAccessTime

func (wm *WorkspaceManager) UpdateAccessTime(workflowName, executionID string)

UpdateAccessTime updates the last access time for a mounted workspace

Jump to

Keyboard shortcuts

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