Documentation
¶
Index ¶
- type ChatResponseEvent
- type ChatStartedEvent
- type EventBus
- type EventHandler
- type InMemoryBus
- type NoOpEventBus
- type NoOpPublisher
- type NotificationEvent
- type Publisher
- type Subscriber
- type TokenCountEvent
- type ToolCallMessageEvent
- type ToolConfirmationRequest
- type ToolConfirmationResponse
- type ToolExecutedEvent
- type UserConfirmationRequest
- type UserConfirmationResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChatResponseEvent ¶
type ChatResponseEvent struct {
Message string
Response string
Error error
UserInput string // Add UserInput field
}
ChatResponseEvent is published when AI generates a response
func (ChatResponseEvent) Topic ¶
func (e ChatResponseEvent) Topic() string
Topic returns the event topic for chat responses
type ChatStartedEvent ¶
type ChatStartedEvent struct {
Message string
}
ChatStartedEvent is published when chat processing begins
func (ChatStartedEvent) Topic ¶
func (e ChatStartedEvent) Topic() string
Topic returns the event topic for chat started events
type EventBus ¶
type EventBus interface {
Publisher
Subscriber
}
EventBus provides both publishing and subscribing
type EventHandler ¶
type EventHandler func(event interface{})
EventHandler is a function that handles an event
type InMemoryBus ¶
type InMemoryBus struct {
// contains filtered or unexported fields
}
InMemoryBus implements EventBus with in-memory storage
func (*InMemoryBus) Publish ¶
func (b *InMemoryBus) Publish(eventType string, event interface{})
Publish sends an event to all subscribers of that event type
func (*InMemoryBus) Subscribe ¶
func (b *InMemoryBus) Subscribe(eventType string, handler EventHandler)
Subscribe adds a handler for a specific event type
type NoOpEventBus ¶
type NoOpEventBus struct{}
NoOpEventBus is an event bus that does nothing (for testing)
func (*NoOpEventBus) Publish ¶
func (n *NoOpEventBus) Publish(topic string, event interface{})
Publish does nothing
func (*NoOpEventBus) Subscribe ¶
func (n *NoOpEventBus) Subscribe(topic string, handler EventHandler)
Subscribe does nothing
type NoOpPublisher ¶
type NoOpPublisher struct{}
NoOpPublisher is a publisher that does nothing (for testing or when events are not needed)
func (*NoOpPublisher) Publish ¶
func (n *NoOpPublisher) Publish(topic string, event interface{})
Publish does nothing
type NotificationEvent ¶
type NotificationEvent struct {
Message string
Role string // assistant, system or error
ContentType string // text or thought
Error error
}
NotificationEvent is published to give user intermediary feedback. Reasoning, errors
func (NotificationEvent) Topic ¶
func (e NotificationEvent) Topic() string
Topic returns the event topic for notification events
type Publisher ¶
type Publisher interface {
Publish(eventType string, event interface{})
}
Publisher allows publishing events
type Subscriber ¶
type Subscriber interface {
Subscribe(eventType string, handler EventHandler)
}
Subscriber allows subscribing to events
type TokenCountEvent ¶
type TokenCountEvent struct {
RequestID string
CachedTokens int32
ToolUseTokens int32
InputTokens int32
OutputTokens int32
TotalTokens int32
}
TokenCountEvent is published when token counts are available
func (TokenCountEvent) Topic ¶
func (e TokenCountEvent) Topic() string
Topic returns the event topic for token count events
type ToolCallMessageEvent ¶
ToolCallMessageEvent is published when a tool call wants to display a message to the user
func (ToolCallMessageEvent) Topic ¶
func (e ToolCallMessageEvent) Topic() string
Topic returns the event topic for tool call messages
type ToolConfirmationRequest ¶
type ToolConfirmationRequest struct {
ExecutionID string
ToolName string
Command string
Message string
}
ToolConfirmationRequest represents a request for user confirmation before executing a tool
func (ToolConfirmationRequest) Topic ¶
func (e ToolConfirmationRequest) Topic() string
Topic returns the event topic for tool confirmation requests
type ToolConfirmationResponse ¶
ToolConfirmationResponse represents a user's response to a confirmation request
func (ToolConfirmationResponse) Topic ¶
func (e ToolConfirmationResponse) Topic() string
Topic returns the event topic for tool confirmation responses
type ToolExecutedEvent ¶
type ToolExecutedEvent struct {
ExecutionID string
ToolName string
Parameters map[string]any
Message string
Result map[string]any // The actual result returned by the tool
}
ToolExecutedEvent represents a tool that has been executed
func (ToolExecutedEvent) Topic ¶
func (e ToolExecutedEvent) Topic() string
Topic returns the event topic for tool execution
type UserConfirmationRequest ¶
type UserConfirmationRequest struct {
ExecutionID string
Title string // Title of the confirmation dialog
Content string // Content to display (diff, plan, etc.)
ContentType string // "diff", "plan", etc. for rendering hints
FilePath string // Optional: for file-specific confirmations
Message string // Optional: custom message
ConfirmText string // Optional: custom confirm button text
CancelText string // Optional: custom cancel button text
}
UserConfirmationRequest represents a generic request for user confirmation with content preview
func (UserConfirmationRequest) Topic ¶
func (e UserConfirmationRequest) Topic() string
Topic returns the event topic for user confirmation requests
type UserConfirmationResponse ¶
UserConfirmationResponse represents a user's response to a confirmation request
func (UserConfirmationResponse) Topic ¶
func (e UserConfirmationResponse) Topic() string
Topic returns the event topic for user confirmation responses