handlers

package
v0.12.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: 14 Imported by: 0

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,
) *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 SwitchModelMsg

type SwitchModelMsg struct{}

SwitchModelMsg indicates that model selection view should be shown

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

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{}

UIMessageHandler handles UI-related messages

func NewUIMessageHandler

func NewUIMessageHandler() *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
	ViewHelp
)

Jump to

Keyboard shortcuts

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