directexec

package
v0.228.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 9, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseArguments added in v0.190.0

func ParseArguments(argsStr string) (map[string]any, error)

ParseArguments parses function arguments in the format key="value", key2="value2". Numeric values are stored as float64; everything else as string.

func ParseToolCall added in v0.190.0

func ParseToolCall(input string) (string, map[string]any, error)

ParseToolCall is the package-level parser behind Service.ParseToolCall, so non-TUI front ends (headless) accept the same `!!Tool(arg="v")` syntax.

Types

type Options

type Options struct {
	ConversationRepo       convdomain.ConversationRepository
	ToolService            agentdomain.ToolService
	StateStore             stateStore
	BackgroundShellService scheddomain.BackgroundShellService
	Listener               tui.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

func NewService(opts Options) *Service

NewService creates a new DirectExecutionService.

func (*Service) ClearBashDetachChan

func (s *Service) ClearBashDetachChan()

ClearBashDetachChan satisfies agentdomain.BashDetachChannelHolder.

func (*Service) GetBashDetachChan

func (s *Service) GetBashDetachChan() chan<- struct{}

GetBashDetachChan satisfies agentdomain.BashDetachChannelHolder.

func (*Service) HandleBackgroundShellRequest

func (s *Service) HandleBackgroundShellRequest() tea.Cmd

HandleBackgroundShellRequest signals the currently-running bash command to detach to the background.

func (*Service) HandleBashCommand

func (s *Service) HandleBashCommand(commandText string) tea.Cmd

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 tui.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(_ agentdomain.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. Chunks that arrived on the chat channel are re-armed by ChatHandler.Handle.

func (*Service) HandleToolCommand

func (s *Service) HandleToolCommand(commandText string) tea.Cmd

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

func (s *Service) ParseArguments(argsStr string) (map[string]any, error)

ParseArguments parses `key=value` pairs; see ParseToolCall.

func (*Service) ParseToolCall

func (s *Service) ParseToolCall(input string) (string, map[string]any, error)

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 ui.ChatHandler interface.

func (*Service) PendingBashChannel

func (s *Service) PendingBashChannel() <-chan tea.Msg

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

func (s *Service) PendingToolChannel() <-chan tea.Msg

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 agentdomain.BashDetachChannelHolder.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL