ai-agent/internal/tui/messages.go
admin 8dc496b626
Some checks failed
CI / test (push) Has been cancelled
Release / release (push) Failing after 4m36s
first commit
2026-03-08 15:40:34 +07:00

126 lines
1.9 KiB
Go

package tui
import (
"time"
tea "charm.land/bubbletea/v2"
)
type StreamTextMsg struct {
Text string
}
type StreamDoneMsg struct {
EvalCount int
PromptTokens int
}
type ToolCallStartMsg struct {
Name string
Args map[string]any
StartTime time.Time
}
type ToolCallResultMsg struct {
Name string
Result string
IsError bool
Duration time.Duration
}
type ErrorMsg struct {
Msg string
}
type SystemMessageMsg struct {
Msg string
}
type AgentDoneMsg struct{}
type FailedServer struct {
Name string
Reason string
}
type InitCompleteMsg struct {
Model string
ModelList []string
AgentProfile string
AgentList []string
ToolCount int
ServerCount int
NumCtx int
FailedServers []FailedServer
ICEEnabled bool
ICEConversations int
ICESessionID string
}
type CommandResultMsg struct {
Text string
}
type StartupStatusMsg struct {
ID string
Label string
Status string
Detail string
}
type CompletionSearchResultMsg struct {
Tag int
Results []Completion
}
type CompletionDebounceTickMsg struct {
Tag int
Query string
}
type spinnerTickMsg struct{}
type PlanFormCompletedMsg struct {
Prompt string
}
type DoneFlashExpiredMsg struct{}
type SessionCreatedMsg struct {
NoteID int
Err error
}
type SessionListMsg struct {
Sessions []SessionListItem
Err error
}
type SessionLoadedMsg struct {
Entries []ChatEntry
Title string
Err error
}
type ToolApprovalMsg struct {
ToolName string
Args map[string]any
Response chan<- ToolApprovalResponse
}
type ToolApprovalResponse struct {
Allowed bool
Always bool
}
type CommitResultMsg struct {
Message string
Err error
}
func sendMsg(p *tea.Program, msg tea.Msg) {
if p != nil {
p.Send(msg)
}
}