Documentation
¶
Overview ¶
Package chat implements an interactive TUI chat interface using bubbletea. It provides a coding-agent cockpit for conversing with the Lango agent, including streaming responses, inline tool approval, slash commands, and turn-state visibility.
Index ¶
- type ApprovalRequestMsg
- type BudgetWarningMsg
- type ChannelMessageMsg
- type ChatModel
- type ChatParts
- type ChunkMsg
- type CursorTickMsg
- type DelegationMsg
- type Deps
- type DoneMsg
- type ErrorMsg
- type PendingIndicatorTickMsg
- type RecoveryMsg
- type SystemMsg
- type TUIApprovalProvider
- type TaskStripTickMsg
- type ThinkingFinishedMsg
- type ThinkingStartedMsg
- type ToolFinishedMsg
- type ToolItemState
- type ToolStartedMsg
- type TurnTokenUsageMsg
- type WarningMsg
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApprovalRequestMsg ¶
type ApprovalRequestMsg struct {
Request approval.ApprovalRequest
ViewModel approval.ApprovalViewModel
Response chan<- approval.ApprovalResponse
}
ApprovalRequestMsg delivers an approval request from the agent runtime.
type BudgetWarningMsg ¶
BudgetWarningMsg signals that delegation budget is approaching its limit.
type ChannelMessageMsg ¶
type ChannelMessageMsg struct {
Channel string
SessionKey string
SenderName string
Text string
Timestamp time.Time
Metadata map[string]string
}
ChannelMessageMsg is sent when a channel message is received via EventBus.
type ChatModel ¶
type ChatModel struct {
// contains filtered or unexported fields
}
ChatModel is the root bubbletea model for the interactive TUI chat.
func (*ChatModel) RenderParts ¶
View implements tea.Model. RenderParts returns the discrete rendered sections of the chat view.
func (*ChatModel) SetProgram ¶
SetProgram stores a reference to the tea.Program for sending messages from callbacks.
type ChatParts ¶
type ChatParts struct {
Header string
TurnStrip string
Main string
Pending string // empty when not in pending state
TaskStrip string // empty when no background tasks
Approval string // empty when no approval pending
}
ChatParts holds the discrete rendered sections of the chat view.
type ChunkMsg ¶
type ChunkMsg struct {
Chunk string
}
ChunkMsg delivers a streaming text chunk from the agent.
type CursorTickMsg ¶
CursorTickMsg triggers cursor blink toggle during streaming.
type DelegationMsg ¶
DelegationMsg signals an agent-to-agent delegation event.
type Deps ¶
type Deps struct {
TurnRunner *turnrunner.Runner
Config *config.Config
SessionKey string
BackgroundManager *background.Manager // optional, nil when background tasks unavailable
}
Deps holds the dependencies injected into the chat model.
type DoneMsg ¶
type DoneMsg struct {
Result turnrunner.Result
}
DoneMsg signals that a turn has finished.
type PendingIndicatorTickMsg ¶
PendingIndicatorTickMsg triggers pending indicator update (submit → first event).
type RecoveryMsg ¶
RecoveryMsg signals a recovery decision during structured orchestration.
type SystemMsg ¶
type SystemMsg struct {
Text string
}
SystemMsg is a locally generated informational message.
type TUIApprovalProvider ¶
type TUIApprovalProvider struct {
// contains filtered or unexported fields
}
TUIApprovalProvider implements approval.Provider for the interactive TUI. It sends approval requests to the bubbletea program and waits for the user to respond with a/s/d keys.
func NewTUIApprovalProvider ¶
func NewTUIApprovalProvider(sender func(msg interface{})) *TUIApprovalProvider
NewTUIApprovalProvider creates a TUI approval provider that uses the given bubbletea program send function for dispatching approval UI messages.
func (*TUIApprovalProvider) CanHandle ¶
func (t *TUIApprovalProvider) CanHandle(_ string) bool
CanHandle returns false — TUI provider is a fallback, not a session-prefix router.
func (*TUIApprovalProvider) Name ¶
func (t *TUIApprovalProvider) Name() string
Name returns the provider name for logging.
func (*TUIApprovalProvider) RequestApproval ¶
func (t *TUIApprovalProvider) RequestApproval(ctx context.Context, req approval.ApprovalRequest) (approval.ApprovalResponse, error)
RequestApproval sends an approval request to the TUI and blocks until the user responds or the context is cancelled.
type TaskStripTickMsg ¶
TaskStripTickMsg triggers periodic task strip refresh.
type ThinkingFinishedMsg ¶
ThinkingFinishedMsg signals that the agent has finished thinking/reasoning.
type ThinkingStartedMsg ¶
ThinkingStartedMsg signals that the agent has started thinking/reasoning.
type ToolFinishedMsg ¶
type ToolFinishedMsg struct {
CallID string
ToolName string
Success bool
Duration time.Duration
Output string
}
ToolFinishedMsg signals that a tool invocation has completed.
type ToolItemState ¶
type ToolItemState string
ToolItemState represents the lifecycle state of a tool invocation.
type ToolStartedMsg ¶
ToolStartedMsg signals that a tool invocation has begun.