internal

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApprovalDecision added in v0.3.0

type ApprovalDecision int

ApprovalDecision represents user's approval decision

const (
	ApprovalDeny ApprovalDecision = iota
	ApprovalAllow
	ApprovalAllowAll
)

func (ApprovalDecision) String added in v0.3.0

func (ad ApprovalDecision) String() string

String returns string representation of approval decision

type ApprovalRequestMsg added in v0.3.3

type ApprovalRequestMsg struct {
	Command string
}

ApprovalRequestMsg is used to request approval for a command

type ApprovalSession added in v0.3.0

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

ApprovalSession tracks approval decisions for a session

func NewApprovalSession added in v0.3.0

func NewApprovalSession() *ApprovalSession

NewApprovalSession creates a new approval session

func (*ApprovalSession) IsApprovalSkipped added in v0.3.0

func (as *ApprovalSession) IsApprovalSkipped() bool

IsApprovalSkipped returns whether approval is being skipped for the session

func (*ApprovalSession) PromptForApprovalBubbleTea added in v0.3.3

func (as *ApprovalSession) PromptForApprovalBubbleTea(command string, program *tea.Program, inputModel *ChatInputModel) (ApprovalDecision, error)

PromptForApprovalBubbleTea prompts the user for command execution approval using Bubble Tea

func (*ApprovalSession) SetSkipApproval added in v0.3.0

func (as *ApprovalSession) SetSkipApproval(skip bool)

SetSkipApproval sets the skip approval flag

type BashTool

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

BashTool represents the Bash tool that LLMs can invoke

func NewBashTool

func NewBashTool(manager *LLMToolsManager) *BashTool

NewBashTool creates a new Bash tool

func (*BashTool) Execute

func (bt *BashTool) Execute(command string) (string, error)

Execute executes a bash command and returns the result

func (*BashTool) ExecuteJSON

func (bt *BashTool) ExecuteJSON(command string) (string, error)

ExecuteJSON executes a bash command and returns JSON result

type ChatInputModel added in v0.3.3

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

ChatInputModel represents a persistent chat input interface

func NewChatInputModel added in v0.3.3

func NewChatInputModel() *ChatInputModel

NewChatInputModel creates a new chat input model

func (*ChatInputModel) ClearStatus added in v0.3.3

func (m *ChatInputModel) ClearStatus()

ClearStatus clears the status message

func (*ChatInputModel) GetApprovalResponse added in v0.3.3

func (m *ChatInputModel) GetApprovalResponse() int

GetApprovalResponse returns the approval response (-1=none, 0=deny, 1=allow, 2=allow all)

func (*ChatInputModel) GetInput added in v0.3.3

func (m *ChatInputModel) GetInput() string

GetInput returns the submitted input and clears the flag

func (*ChatInputModel) HasInput added in v0.3.3

func (m *ChatInputModel) HasInput() bool

HasInput returns true if there's input ready to be processed

func (*ChatInputModel) Init added in v0.3.3

func (m *ChatInputModel) Init() tea.Cmd

func (*ChatInputModel) IsApprovalPending added in v0.3.3

func (m *ChatInputModel) IsApprovalPending() bool

IsApprovalPending returns true if approval is pending

func (*ChatInputModel) IsCancelled added in v0.3.3

func (m *ChatInputModel) IsCancelled() bool

IsCancelled returns true if generation was cancelled

func (*ChatInputModel) IsQuitRequested added in v0.3.3

func (m *ChatInputModel) IsQuitRequested() bool

IsQuitRequested returns true if the user requested to quit

func (*ChatInputModel) ResetApproval added in v0.3.3

func (m *ChatInputModel) ResetApproval()

ResetApproval resets the approval state

func (*ChatInputModel) ResetCancellation added in v0.3.3

func (m *ChatInputModel) ResetCancellation()

ResetCancellation resets the cancellation flag

func (*ChatInputModel) SetSpinnerMessage added in v0.3.3

func (m *ChatInputModel) SetSpinnerMessage(message string) tea.Cmd

SetSpinnerMessage sets a status message with spinner

func (*ChatInputModel) SetStatusMessage added in v0.3.3

func (m *ChatInputModel) SetStatusMessage(message string)

SetStatusMessage sets a status message

func (*ChatInputModel) Update added in v0.3.3

func (m *ChatInputModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ChatInputModel) UpdateHistory added in v0.3.3

func (m *ChatInputModel) UpdateHistory(history []string)

UpdateHistory updates the chat history

func (*ChatInputModel) View added in v0.3.3

func (m *ChatInputModel) View() string

type ChatManagerModel added in v0.4.0

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

ChatManagerModel manages the overall chat interface including file selection

func NewChatManagerModel added in v0.4.0

func NewChatManagerModel() *ChatManagerModel

NewChatManagerModel creates a new chat manager

func (*ChatManagerModel) GetApprovalResponse added in v0.4.0

func (m *ChatManagerModel) GetApprovalResponse() int

func (*ChatManagerModel) GetChatInput added in v0.4.0

func (m *ChatManagerModel) GetChatInput() *ChatInputModel

GetChatInput returns the underlying chat input model

func (*ChatManagerModel) GetInput added in v0.4.0

func (m *ChatManagerModel) GetInput() string

func (*ChatManagerModel) HasInput added in v0.4.0

func (m *ChatManagerModel) HasInput() bool

Delegate methods to chat input

func (*ChatManagerModel) Init added in v0.4.0

func (m *ChatManagerModel) Init() tea.Cmd

func (*ChatManagerModel) IsApprovalPending added in v0.4.0

func (m *ChatManagerModel) IsApprovalPending() bool

func (*ChatManagerModel) IsCancelled added in v0.4.0

func (m *ChatManagerModel) IsCancelled() bool

func (*ChatManagerModel) IsQuitRequested added in v0.4.0

func (m *ChatManagerModel) IsQuitRequested() bool

func (*ChatManagerModel) ResetApproval added in v0.4.0

func (m *ChatManagerModel) ResetApproval()

func (*ChatManagerModel) ResetCancellation added in v0.4.0

func (m *ChatManagerModel) ResetCancellation()

func (*ChatManagerModel) Update added in v0.4.0

func (m *ChatManagerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ChatManagerModel) View added in v0.4.0

func (m *ChatManagerModel) View() string

type FileSelectedMsg added in v0.4.0

type FileSelectedMsg struct {
	FilePath string
}

FileSelectedMsg is used to indicate a file was selected

type FileSelectionRequestMsg added in v0.4.0

type FileSelectionRequestMsg struct{}

FileSelectionRequestMsg is used to request file selection

type FileSelectorModel added in v0.4.0

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

FileSelectorModel represents a file selection interface

func NewFileSelectorModel added in v0.4.0

func NewFileSelectorModel(files []string) *FileSelectorModel

NewFileSelectorModel creates a new file selector

func (*FileSelectorModel) GetSelected added in v0.4.0

func (m *FileSelectorModel) GetSelected() string

GetSelected returns the selected file

func (*FileSelectorModel) Init added in v0.4.0

func (m *FileSelectorModel) Init() tea.Cmd

func (*FileSelectorModel) IsCancelled added in v0.4.0

func (m *FileSelectorModel) IsCancelled() bool

IsCancelled returns true if selection was cancelled

func (*FileSelectorModel) IsDone added in v0.4.0

func (m *FileSelectorModel) IsDone() bool

IsDone returns true if selection process is complete

func (*FileSelectorModel) IsSelected added in v0.4.0

func (m *FileSelectorModel) IsSelected() bool

IsSelected returns true if a file was selected

func (*FileSelectorModel) Update added in v0.4.0

func (m *FileSelectorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*FileSelectorModel) View added in v0.4.0

func (m *FileSelectorModel) View() string

type HelpViewerModel added in v0.3.3

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

HelpViewerModel represents a professional help display interface

func NewHelpViewerModel added in v0.3.3

func NewHelpViewerModel() *HelpViewerModel

NewHelpViewerModel creates a new help viewer

func (*HelpViewerModel) Init added in v0.3.3

func (m *HelpViewerModel) Init() tea.Cmd

func (*HelpViewerModel) IsDone added in v0.3.3

func (m *HelpViewerModel) IsDone() bool

IsDone returns true if help viewing is complete

func (*HelpViewerModel) Update added in v0.3.3

func (m *HelpViewerModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*HelpViewerModel) View added in v0.3.3

func (m *HelpViewerModel) View() string

type LLMToolsManager

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

LLMToolsManager provides tools that LLMs can invoke

func NewLLMToolsManager

func NewLLMToolsManager(cfg *config.Config) *LLMToolsManager

NewLLMToolsManager creates a new LLM tools manager

func NewLLMToolsManagerWithUI added in v0.3.3

func NewLLMToolsManagerWithUI(cfg *config.Config, program *tea.Program, inputModel *ChatInputModel) *LLMToolsManager

NewLLMToolsManagerWithUI creates a new LLM tools manager with UI integration

func (*LLMToolsManager) GetAvailableTools

func (manager *LLMToolsManager) GetAvailableTools() []ToolDefinition

GetAvailableTools returns the list of available tools for LLMs

func (*LLMToolsManager) InvokeTool

func (manager *LLMToolsManager) InvokeTool(toolName string, parameters map[string]interface{}) (string, error)

InvokeTool invokes a tool by name with given parameters

type ModelSelectorModel added in v0.3.3

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

ModelSelectorModel represents a professional model selection interface

func NewModelSelectorModel added in v0.3.3

func NewModelSelectorModel(models []string) *ModelSelectorModel

NewModelSelectorModel creates a new model selector

func (*ModelSelectorModel) GetSelected added in v0.3.3

func (m *ModelSelectorModel) GetSelected() string

GetSelected returns the selected model

func (*ModelSelectorModel) Init added in v0.3.3

func (m *ModelSelectorModel) Init() tea.Cmd

func (*ModelSelectorModel) IsCancelled added in v0.3.3

func (m *ModelSelectorModel) IsCancelled() bool

IsCancelled returns true if selection was cancelled

func (*ModelSelectorModel) IsDone added in v0.3.3

func (m *ModelSelectorModel) IsDone() bool

IsDone returns true if selection process is complete

func (*ModelSelectorModel) IsSelected added in v0.3.3

func (m *ModelSelectorModel) IsSelected() bool

IsSelected returns true if a model was selected

func (*ModelSelectorModel) Update added in v0.3.3

func (m *ModelSelectorModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

func (*ModelSelectorModel) View added in v0.3.3

func (m *ModelSelectorModel) View() string

type SetStatusMsg added in v0.3.3

type SetStatusMsg struct {
	Message string
	Spinner bool
}

SetStatusMsg is used to set status

type SpinnerTick added in v0.3.3

type SpinnerTick struct{}

SpinnerTick represents a spinner animation tick

type ToolDefinition

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

ToolDefinition represents a tool definition for LLMs

type ToolEngine

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

ToolEngine manages tool execution with security controls

func NewToolEngine

func NewToolEngine(cfg *config.Config) *ToolEngine

NewToolEngine creates a new tool engine

func NewToolEngineWithUI added in v0.3.3

func NewToolEngineWithUI(cfg *config.Config, program *tea.Program, inputModel *ChatInputModel) *ToolEngine

NewToolEngineWithUI creates a new tool engine with UI integration

func (*ToolEngine) ExecuteBash

func (te *ToolEngine) ExecuteBash(command string) (*ToolResult, error)

ExecuteBash executes a bash command with security validation

func (*ToolEngine) GetApprovalSession added in v0.3.0

func (te *ToolEngine) GetApprovalSession() *ApprovalSession

GetApprovalSession returns the approval session

func (*ToolEngine) ListAllowedCommands

func (te *ToolEngine) ListAllowedCommands() []string

ListAllowedCommands returns the list of whitelisted commands

func (*ToolEngine) ValidateCommand

func (te *ToolEngine) ValidateCommand(command string) error

ValidateCommand checks if a command would be allowed without executing it

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

type UpdateHistoryMsg added in v0.3.3

type UpdateHistoryMsg struct {
	History []string
}

UpdateHistoryMsg is used to update chat history

Jump to

Keyboard shortcuts

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