handlers

package
v0.52.0 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 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 ChatCommandHandler added in v0.45.4

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

ChatCommandHandler handles various command types

func NewChatCommandHandler added in v0.45.4

func NewChatCommandHandler(handler *ChatHandler) *ChatCommandHandler

NewChatCommandHandler creates a new command handler

func (*ChatCommandHandler) ParseArguments added in v0.45.4

func (c *ChatCommandHandler) ParseArguments(argsStr string) (map[string]any, error)

ParseArguments parses function arguments in the format key="value", key2="value2" (exposed for testing)

func (*ChatCommandHandler) ParseToolCall added in v0.45.4

func (c *ChatCommandHandler) ParseToolCall(input string) (string, map[string]any, error)

ParseToolCall parses a tool call in the format ToolName(arg="value", arg2="value2") (exposed for testing)

type ChatEventHandler added in v0.45.4

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

ChatEventHandler handles chat events

func NewChatEventHandler added in v0.45.4

func NewChatEventHandler(handler *ChatHandler) *ChatEventHandler

NewChatEventHandler creates a new event handler

func (*ChatEventHandler) FormatMetrics added in v0.45.4

func (e *ChatEventHandler) FormatMetrics(metrics *domain.ChatMetrics) string

type ChatHandler added in v0.27.0

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

ChatHandler handles chat-related messages using the new state management system

func NewChatHandler added in v0.27.0

func NewChatHandler(
	agentService domain.AgentService,
	conversationRepo domain.ConversationRepository,
	modelService domain.ModelService,
	configService domain.ConfigService,
	toolService domain.ToolService,
	fileService domain.FileService,
	shortcutRegistry *shortcuts.Registry,
) *ChatHandler

NewChatHandler creates a new chat handler

func (*ChatHandler) CanHandle added in v0.27.0

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

CanHandle determines if this handler can process the message

func (*ChatHandler) ExtractMarkdownSummary added in v0.45.4

func (h *ChatHandler) ExtractMarkdownSummary(content string) (string, bool)

ExtractMarkdownSummary extracts markdown summary (exposed for testing)

func (*ChatHandler) FormatMetrics added in v0.45.4

func (h *ChatHandler) FormatMetrics(metrics *domain.ChatMetrics) string

FormatMetrics formats metrics for display (exposed for testing)

func (*ChatHandler) GetName added in v0.27.0

func (h *ChatHandler) GetName() string

GetName returns the handler name

func (*ChatHandler) GetPriority added in v0.27.0

func (h *ChatHandler) GetPriority() int

GetPriority returns the handler priority

func (*ChatHandler) Handle added in v0.27.0

func (h *ChatHandler) Handle(
	msg tea.Msg,
	stateManager *services.StateManager,
) (tea.Model, tea.Cmd)

Handle processes the message using the state manager

func (*ChatHandler) ParseArguments added in v0.45.4

func (h *ChatHandler) ParseArguments(argsStr string) (map[string]any, error)

ParseArguments parses function arguments (exposed for testing)

func (*ChatHandler) ParseToolCall added in v0.45.4

func (h *ChatHandler) ParseToolCall(input string) (string, map[string]any, error)

ParseToolCall parses tool call syntax (exposed for testing)

type ChatMessageProcessor added in v0.45.4

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

ChatMessageProcessor handles message processing logic

func NewChatMessageProcessor added in v0.45.4

func NewChatMessageProcessor(handler *ChatHandler) *ChatMessageProcessor

NewChatMessageProcessor creates a new message processor

func (*ChatMessageProcessor) ExtractMarkdownSummary added in v0.45.4

func (p *ChatMessageProcessor) ExtractMarkdownSummary(content string) (string, bool)

ExtractMarkdownSummary extracts the "## Summary" section from markdown content (exposed for testing)

type ChatShortcutHandler added in v0.45.4

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

ChatShortcutHandler handles shortcut execution and side effects

func NewChatShortcutHandler added in v0.45.4

func NewChatShortcutHandler(handler *ChatHandler) *ChatShortcutHandler

NewChatShortcutHandler creates a new shortcut handler

type MessageHandler

type MessageHandler interface {
	CanHandle(msg tea.Msg) bool
	Handle(msg tea.Msg, stateManager *services.StateManager) (tea.Model, tea.Cmd)
	GetPriority() int
	GetName() string
}

MessageHandler interface for the modern architecture

type MessageRouter

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

MessageRouter routes messages to handlers using the new state management system

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) GetHandlerByName added in v0.27.0

func (r *MessageRouter) GetHandlerByName(name string) MessageHandler

GetHandlerByName returns a handler by name

func (*MessageRouter) GetHandlerCount added in v0.27.0

func (r *MessageRouter) GetHandlerCount() int

GetHandlerCount returns the number of registered handlers

func (*MessageRouter) GetHandlers

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

GetHandlers returns all registered handlers

func (*MessageRouter) RemoveHandler

func (r *MessageRouter) RemoveHandler(handlerName string)

RemoveHandler removes a message handler from the router

func (*MessageRouter) Route

func (r *MessageRouter) Route(
	msg tea.Msg,
	stateManager *services.StateManager,
) (tea.Model, tea.Cmd)

Route routes a message to the appropriate handler

Jump to

Keyboard shortcuts

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