- Add new indirect dependencies including various Charmbracelet packages for improved UI handling. - Enhance logging in the Assistant module by adding tool completion and start logging for better traceability of tool calls. - Modify context handling in the RequestLogger to support a stack-based assistant ID management, improving the logging structure for agent requests. - Implement event service integration for better trace management and debugging capabilities.
90 lines
1.6 KiB
Go
90 lines
1.6 KiB
Go
package context
|
|
|
|
import "time"
|
|
|
|
// EventType represents the type of agent lifecycle event
|
|
type EventType int
|
|
|
|
const (
|
|
EventRequestStart EventType = iota
|
|
EventPhase
|
|
EventPhaseDone
|
|
EventPhaseSkip
|
|
EventLLMCall
|
|
EventLLMDone
|
|
EventToolCall
|
|
EventToolDone
|
|
EventHook
|
|
EventHookDone
|
|
EventA2AStart
|
|
EventA2ADone
|
|
EventRequestEnd
|
|
EventContextFork
|
|
EventContextRelease
|
|
)
|
|
|
|
// AgentEventMsg is sent from RequestLogger to the TUI Program
|
|
type AgentEventMsg struct {
|
|
RequestID string
|
|
ParentID string
|
|
AssistantID string
|
|
Event EventType
|
|
Data map[string]interface{}
|
|
}
|
|
|
|
// AppLogLevel represents the severity of application-side output
|
|
type AppLogLevel int
|
|
|
|
const (
|
|
AppLogLevelLog AppLogLevel = iota
|
|
AppLogLevelInfo
|
|
AppLogLevelWarn
|
|
AppLogLevelError
|
|
AppLogLevelException
|
|
)
|
|
|
|
// AppLogMsg is sent from the DevWriter (gou layer) to the TUI Program
|
|
type AppLogMsg struct {
|
|
Level AppLogLevel
|
|
Content string
|
|
}
|
|
|
|
// AppLogEntry stores a single application output entry
|
|
type AppLogEntry struct {
|
|
Level AppLogLevel
|
|
Content string
|
|
Time time.Time
|
|
}
|
|
|
|
// PanelStatus represents the lifecycle state of a request panel
|
|
type PanelStatus int
|
|
|
|
const (
|
|
PanelRunning PanelStatus = iota
|
|
PanelSuccess
|
|
PanelFailed
|
|
)
|
|
|
|
// NodeKind represents the type of a tree node within a request panel
|
|
type NodeKind int
|
|
|
|
const (
|
|
NodePhase NodeKind = iota
|
|
NodeLLM
|
|
NodeTool
|
|
NodeHook
|
|
NodeA2A
|
|
)
|
|
|
|
// NodeStatus represents the state of a tree node
|
|
type NodeStatus int
|
|
|
|
const (
|
|
NodePending NodeStatus = iota
|
|
NodeRunning
|
|
NodeDone
|
|
NodeFailed
|
|
)
|
|
|
|
// TickMsg triggers periodic UI refresh for elapsed time display
|
|
type TickMsg time.Time
|