tool

package
v1.88.1 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Overview

Package tool builds the TUI view for a tool call message.

A small lookup table (builders) maps each tool's name to a constructor. Lookup order is: exact tool name, then "category:<category>", then a defaulttool fallback.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(msg *types.Message, sessionState service.SessionStateReader) layout.Model

New returns the appropriate tool view for the given message. Lookup order: exact tool name, then "category:<category>", then default. At each tier a registered custom renderer wins over the built-in one.

func Register added in v1.88.0

func Register(key string, b Builder)

Register installs a custom renderer for the given key, which is a tool name (e.g. "add") or a "category:<name>" key (e.g. "category:compute"). Registering a key that already exists replaces the previous renderer. Registered renderers take precedence over the built-in ones.

Register is safe for concurrent use, but is normally called once at startup (e.g. via tui.WithToolRenderers) before the TUI begins rendering.

Types

type Builder added in v1.88.0

type Builder = func(msg *types.Message, sessionState service.SessionStateReader) layout.Model

Builder constructs the layout.Model for a tool message. Embedders implement this to provide a custom view for a tool and register it via Register.

Jump to

Keyboard shortcuts

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