Help us shape the future of Go! Take the 2026 Go Developer Survey

dispatch

package
v0.2.7 Latest Latest
Warning

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

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

Documentation

Overview

Package dispatch runs one tool call: through the ToolExecutor, or through the pause handler registered for that tool.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Executor Executor
	Handlers map[string]pause.Handler // tool name → handler, in place of Executor
	Emitter  Emitter
	History  History
	Caller   ModelCaller
	Replies  ReplyWaiter
	Ender    Ender
	Model    model.ToolCallingChatModel
	Tools    []*schema.ToolInfo
	Logger   *slog.Logger
}

Deps is everything a Dispatcher works with. wire.go fills it.

type Dispatcher

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

func New

func New(d Deps) *Dispatcher

func (*Dispatcher) Dispatch

func (x *Dispatcher) Dispatch(ctx context.Context, tc schema.ToolCall) bool

Dispatch runs one tool call and records its result in the history. It returns false when a pause handler ended the run.

type Emitter

type Emitter interface {
	Emit(data event.Data)
}

Emitter sends events. → emitter.Emitter

type Ender

type Ender interface {
	EndAwaitingHuman(awaiting event.AwaitingInputData)
	EndStopped()
}

Ender ends the run when a pause handler says to. → engine.Finisher

type Executor

type Executor interface {
	ExecuteTool(ctx context.Context, name, arguments string) (string, error)
}

Executor runs a tool. → the caller's loop.ToolExecutor

type History

type History interface {
	Append(msg *schema.Message)
	Messages() []*schema.Message
}

History is the conversation. → state.Run

type ModelCaller

type ModelCaller interface {
	Call(ctx context.Context, m model.ToolCallingChatModel, msgs []*schema.Message, opts ...model.Option) (*schema.Message, error)
}

ModelCaller makes one model call for a pause handler. → modelcall.Caller

type ReplyWaiter

type ReplyWaiter interface {
	WaitInject(ctx context.Context) (string, bool)
}

ReplyWaiter waits for the next injected message. → control.Inbox

Jump to

Keyboard shortcuts

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