Documentation
¶
Overview ¶
Package directexec owns the UI side of user-typed direct-execution commands: `!command` (bash) and `!!Tool(...)` (tool). It synthesizes the conversation entries that wrap each invocation, spawns the goroutine that runs the tool, owns the per-invocation event channel that pipes progress/output back to the Bubble Tea loop, and acts as the BashDetachChannelHolder the agent core looks up via context.
Index ¶
- type Options
- type Service
- func (s *Service) ClearBashDetachChan()
- func (s *Service) GetBashDetachChan() chan<- struct{}
- func (s *Service) HandleBackgroundShellRequest() tea.Cmd
- func (s *Service) HandleBashCommand(commandText string) tea.Cmd
- func (s *Service) HandleBashCommandCompleted(msg domain.BashCommandCompletedEvent) tea.Cmd
- func (s *Service) HandleBashOutputChunk(_ domain.BashOutputChunkEvent) tea.Cmd
- func (s *Service) HandleToolCommand(commandText string) tea.Cmd
- func (s *Service) ParseArguments(argsStr string) (map[string]any, error)
- func (s *Service) ParseToolCall(input string) (string, map[string]any, error)
- func (s *Service) PendingBashChannel() <-chan tea.Msg
- func (s *Service) PendingToolChannel() <-chan tea.Msg
- func (s *Service) SetBashDetachChan(ch chan<- struct{})
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
ConversationRepo domain.ConversationRepository
ToolService domain.ToolService
StateManager domain.StateManager
BackgroundShellService domain.BackgroundShellService
Listener domain.ChatEventListener
}
Options bundles the dependencies needed to construct a Service.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service is the concrete DirectExecutionService.
func NewService ¶
NewService creates a new DirectExecutionService.
func (*Service) ClearBashDetachChan ¶
func (s *Service) ClearBashDetachChan()
ClearBashDetachChan satisfies domain.BashDetachChannelHolder.
func (*Service) GetBashDetachChan ¶
func (s *Service) GetBashDetachChan() chan<- struct{}
GetBashDetachChan satisfies domain.BashDetachChannelHolder.
func (*Service) HandleBackgroundShellRequest ¶
HandleBackgroundShellRequest signals the currently-running bash command to detach to the background.
func (*Service) HandleBashCommand ¶
HandleBashCommand processes bash commands starting with `!`. A trailing `&` hands the command off to the background-shell service; otherwise it executes in the foreground with progress events piped over the bash event channel.
func (*Service) HandleBashCommandCompleted ¶
func (s *Service) HandleBashCommandCompleted(msg domain.BashCommandCompletedEvent) tea.Cmd
HandleBashCommandCompleted handles the terminal event for a foreground bash run: refreshes history, surfaces an error message if the run failed, and (for user-initiated `!command` runs) emits a UserInputEvent to trigger auto-fix.
func (*Service) HandleBashOutputChunk ¶
func (s *Service) HandleBashOutputChunk(_ domain.BashOutputChunkEvent) tea.Cmd
HandleBashOutputChunk is invoked after a bash output chunk reaches the UI. It keeps the bash event channel pumping until the command completes; if no bash channel is active, it falls back to the chat event channel.
func (*Service) HandleToolCommand ¶
HandleToolCommand processes user-typed `!!ToolName(arg="value")` commands. Parses the syntax, validates the tool is enabled, and dispatches to an async executor.
func (*Service) ParseArguments ¶
ParseArguments parses function arguments in the format key="value", key2="value2". Numeric values are stored as float64; everything else as string.
func (*Service) ParseToolCall ¶
ParseToolCall parses a tool call in the format ToolName(arg="value", arg2="value2"). Exposed for testing and for use by the orchestrator that satisfies the legacy domain.ChatHandler interface.
func (*Service) PendingBashChannel ¶
PendingBashChannel returns the in-flight bash event channel (or nil if no bash command is currently executing). The ToolExecutionCoordinator reads this to know which channel to keep pumping in handleBashOutputChunk / handleToolExecutionProgress.
func (*Service) PendingToolChannel ¶
PendingToolChannel returns the in-flight tool event channel (or nil if no !!tool command is currently executing).
func (*Service) SetBashDetachChan ¶
func (s *Service) SetBashDetachChan(ch chan<- struct{})
SetBashDetachChan satisfies domain.BashDetachChannelHolder.