handlers

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2025 License: MIT Imports: 17 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 AppState

type AppState struct {
	// Current view state
	CurrentView ViewType

	// Services (read-only references)
	ConversationRepo interface{}
	ModelService     interface{}
	ChatService      interface{}
	ToolService      interface{}
	FileService      interface{}

	// UI state
	Width  int
	Height int
	Error  string
	Status string

	// Additional state data
	Data map[string]interface{}
}

AppState represents the application state that handlers can access and modify

type ChatMessageHandler

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

ChatMessageHandler handles chat-related messages

func NewChatMessageHandler

func NewChatMessageHandler(
	chatService domain.ChatService,
	conversationRepo domain.ConversationRepository,
	modelService domain.ModelService,
	commandRegistry *commands.Registry,
	config *config.Config,
) *ChatMessageHandler

NewChatMessageHandler creates a new chat message handler

func (*ChatMessageHandler) CanHandle

func (h *ChatMessageHandler) CanHandle(msg tea.Msg) bool

func (*ChatMessageHandler) GetPriority

func (h *ChatMessageHandler) GetPriority() int

func (*ChatMessageHandler) Handle

func (h *ChatMessageHandler) Handle(msg tea.Msg, state *AppState) (tea.Model, tea.Cmd)

type ChatStreamStartedMsg

type ChatStreamStartedMsg struct {
	EventChannel <-chan domain.ChatEvent
	RequestID    string
}

ChatStreamStartedMsg wraps the event channel for stream processing

type FileMessageHandler

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

FileMessageHandler handles file-related messages

func NewFileMessageHandler

func NewFileMessageHandler(fileService domain.FileService) *FileMessageHandler

func (*FileMessageHandler) CanHandle

func (h *FileMessageHandler) CanHandle(msg tea.Msg) bool

func (*FileMessageHandler) GetPriority

func (h *FileMessageHandler) GetPriority() int

func (*FileMessageHandler) Handle

func (h *FileMessageHandler) Handle(msg tea.Msg, state *AppState) (tea.Model, tea.Cmd)

type HelpMessageHandler

type HelpMessageHandler struct{}

HelpMessageHandler handles help-related messages

func NewHelpMessageHandler

func NewHelpMessageHandler() *HelpMessageHandler

func (*HelpMessageHandler) CanHandle

func (h *HelpMessageHandler) CanHandle(msg tea.Msg) bool

func (*HelpMessageHandler) GetPriority

func (h *HelpMessageHandler) GetPriority() int

func (*HelpMessageHandler) Handle

func (h *HelpMessageHandler) Handle(msg tea.Msg, state *AppState) (tea.Model, tea.Cmd)

type MessageHandler

type MessageHandler interface {
	CanHandle(msg tea.Msg) bool
	Handle(msg tea.Msg, state *AppState) (tea.Model, tea.Cmd)
	GetPriority() int
}

MessageHandler interface for handling different types of messages

type MessageRouter

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

MessageRouter routes messages to appropriate handlers

func NewMessageRouter

func NewMessageRouter() *MessageRouter

NewMessageRouter creates a new message router

func (*MessageRouter) AddHandler

func (r *MessageRouter) AddHandler(handler MessageHandler)

AddHandler adds a message handler to the router

func (*MessageRouter) GetHandlers

func (r *MessageRouter) GetHandlers() []MessageHandler

GetHandlers returns all registered handlers

func (*MessageRouter) RemoveHandler

func (r *MessageRouter) RemoveHandler(handler MessageHandler)

RemoveHandler removes a message handler from the router

func (*MessageRouter) Route

func (r *MessageRouter) Route(msg tea.Msg, state *AppState) (tea.Model, tea.Cmd)

Route routes a message to the appropriate handler

type ProcessNextToolCallMsg added in v0.14.3

type ProcessNextToolCallMsg struct{}

ProcessNextToolCallMsg triggers processing of the next tool call in the queue

type StoreRemainingToolCallsMsg added in v0.14.3

type StoreRemainingToolCallsMsg struct {
	RemainingCalls []sdk.ChatCompletionMessageToolCall
}

StoreRemainingToolCallsMsg stores remaining tool calls for sequential processing

type SwitchModelMsg

type SwitchModelMsg struct{}

SwitchModelMsg indicates that model selection view should be shown

type ToolAutoApproveMsg added in v0.14.1

type ToolAutoApproveMsg struct {
	ToolCall ToolCallRequest
	Response string
}

ToolAutoApproveMsg indicates a tool should be auto-executed without approval

type ToolCallDetectedMsg

type ToolCallDetectedMsg struct {
	ToolCall ToolCallRequest
	Response string
}

ToolCallDetectedMsg indicates a tool call was found in the response

type ToolCallRequest

type ToolCallRequest struct {
	ID        string                 `json:"id"`
	Name      string                 `json:"name"`
	Arguments map[string]interface{} `json:"arguments"`
}

ToolCallRequest represents a parsed tool call from LLM response

func (ToolCallRequest) String added in v0.13.1

func (t ToolCallRequest) String() string

String returns a formatted representation of the tool call

type ToolMessageHandler

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

ToolMessageHandler handles tool-related messages

func NewToolMessageHandler

func NewToolMessageHandler(toolService domain.ToolService) *ToolMessageHandler

func (*ToolMessageHandler) CanHandle

func (h *ToolMessageHandler) CanHandle(msg tea.Msg) bool

func (*ToolMessageHandler) GetPriority

func (h *ToolMessageHandler) GetPriority() int

func (*ToolMessageHandler) Handle

func (h *ToolMessageHandler) Handle(msg tea.Msg, state *AppState) (tea.Model, tea.Cmd)

type UIMessageHandler

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

UIMessageHandler handles UI-related messages

func NewUIMessageHandler

func NewUIMessageHandler(commandRegistry *commands.Registry) *UIMessageHandler

func (*UIMessageHandler) CanHandle

func (h *UIMessageHandler) CanHandle(msg tea.Msg) bool

func (*UIMessageHandler) GetPriority

func (h *UIMessageHandler) GetPriority() int

func (*UIMessageHandler) Handle

func (h *UIMessageHandler) Handle(msg tea.Msg, state *AppState) (tea.Model, tea.Cmd)

type ViewType

type ViewType int

ViewType represents different application views

const (
	ViewModelSelection ViewType = iota
	ViewChat
	ViewFileSelection
	ViewApproval
)

Jump to

Keyboard shortcuts

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