terminal

package
v0.0.0-...-0f11aa8 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func StartREPL

func StartREPL(ctx context.Context, sessionID string, initialMessages []llm.Message, engine llm.Engine, modelName, theme, agentName string, hitl *BubbleTeaHITL, in io.Reader, out io.Writer, opts ...TerminalOption) error

StartREPL begins a synchronous interactive loop wrapping the engine stream.

Types

type BubbleTeaHITL

type BubbleTeaHITL struct {
	RequestCh chan ToolApprovalRequestMsg
}

BubbleTeaHITL implements llm.HITLHandler and passes requests out via an unbuffered channel to the UI loop.

func NewBubbleTeaHITL

func NewBubbleTeaHITL() *BubbleTeaHITL

NewBubbleTeaHITL creates a new interactive HITL hook.

func (*BubbleTeaHITL) ApproveTool

func (h *BubbleTeaHITL) ApproveTool(ctx context.Context, req llm.ToolRequestPart) (bool, error)

ApproveTool blocks the engine thread and proxies the approval request to BubbleTea for interactive input.

type TerminalFormatter

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

func NewTerminalFormatter

func NewTerminalFormatter(base ui.ToolFormatter, width int) *TerminalFormatter

func (*TerminalFormatter) FormatToolCall

func (f *TerminalFormatter) FormatToolCall(toolName string, args map[string]interface{}) string

func (*TerminalFormatter) FormatToolResult

func (f *TerminalFormatter) FormatToolResult(toolName string, result interface{}, isError bool) string

type TerminalOption

type TerminalOption func(*terminalConfig)

func WithToolDisplayConfig

func WithToolDisplayConfig(configs map[string]ui.ToolDisplayConfig, defaultIcon string) TerminalOption

type ToolApprovalRequestMsg

type ToolApprovalRequestMsg struct {
	Req     llm.ToolRequestPart
	ReplyCh chan bool
}

ToolApprovalRequestMsg is dispatched to the BubbleTea event loop when a tool needs interactive approval.

Jump to

Keyboard shortcuts

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