toolcoordinator

package
v0.166.1 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package toolcoordinator owns the UI side of the tool round-trip - the streaming-status events emitted while the model is producing a tool call, the approval handshake that forwards the user's accept/reject back to the agent, and the execution-progress events while the tool runs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinator

type Coordinator struct {
	// contains filtered or unexported fields
}

Coordinator handles the tool round-trip UI flow.

func NewCoordinator

func NewCoordinator(opts Options) *Coordinator

NewCoordinator creates a new tool execution coordinator.

func (*Coordinator) GetActiveToolCallID

func (c *Coordinator) GetActiveToolCallID() string

GetActiveToolCallID returns the currently active tool call id (thread-safe).

func (*Coordinator) HandleToolApprovalRequested

func (c *Coordinator) HandleToolApprovalRequested(msg domain.ToolApprovalRequestedEvent) tea.Cmd

HandleToolApprovalRequested records the pending tool call in the repo, sets up the approval UI state, broadcasts a notification, and keeps the chat listener pumping while the user decides.

func (*Coordinator) HandleToolApprovalResponse

func (c *Coordinator) HandleToolApprovalResponse(msg domain.ToolApprovalResponseEvent) tea.Cmd

HandleToolApprovalResponse processes the user's accept/reject decision and forwards it to the waiting agent through the response channel.

func (*Coordinator) HandleToolCallReady

func (c *Coordinator) HandleToolCallReady(_ domain.ToolCallReadyEvent) tea.Cmd

HandleToolCallReady refreshes history when a tool call has finished streaming and is ready for the next step.

func (*Coordinator) HandleToolCallUpdate

func (c *Coordinator) HandleToolCallUpdate(msg domain.ToolCallUpdateEvent) tea.Cmd

HandleToolCallUpdate emits a per-tool-call status update during streaming (e.g. "Streaming Read..." → "Completed Read") and keeps the chat listener pumping.

func (*Coordinator) HandleToolCancelled

func (c *Coordinator) HandleToolCancelled(_ domain.ToolCancelledEvent) tea.Cmd

HandleToolCancelled refreshes the conversation view so the synthetic [cancelled] tool entry that the integrity validator persisted becomes visible. No status-bar message - the cancel that triggered this already drove its own status ("User interrupted").

func (*Coordinator) HandleToolExecutionCompleted

func (c *Coordinator) HandleToolExecutionCompleted(msg domain.ToolExecutionCompletedEvent) tea.Cmd

HandleToolExecutionCompleted finalizes the tool round-trip: clears the active-tool indicator, refreshes history, optionally fires a todo-update command, and emits a "Tools completed" status.

func (*Coordinator) HandleToolExecutionProgress

func (c *Coordinator) HandleToolExecutionProgress(msg domain.ToolExecutionProgressEvent) tea.Cmd

HandleToolExecutionProgress translates a tool-execution progress event into the appropriate UI status updates and keeps the right event channel pumping (bash, tool, or chat).

func (*Coordinator) HandleToolExecutionStarted

func (c *Coordinator) HandleToolExecutionStarted(msg domain.ToolExecutionStartedEvent) tea.Cmd

HandleToolExecutionStarted emits the initial "Starting tool execution" status.

func (*Coordinator) SetActiveToolCallID

func (c *Coordinator) SetActiveToolCallID(id string)

SetActiveToolCallID sets the currently active tool call id (thread-safe).

type Options

type Options struct {
	ConversationRepo domain.ConversationRepository
	StateManager     stateManager
	DirectExec       domain.DirectExecutionService
	Listener         domain.ChatEventListener
}

Options bundles the dependencies needed to construct a Coordinator.

Jump to

Keyboard shortcuts

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