reasoningblock

package
v1.19.3 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Model

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

Model represents a collapsible reasoning + tool calls block.

func New

func New(id, agentName string, sessionState *service.SessionState) *Model

New creates a new reasoning block.

func (*Model) AddToolCall

func (m *Model) AddToolCall(msg *types.Message) tea.Cmd

AddToolCall adds a tool call to the block.

func (*Model) AgentName

func (m *Model) AgentName() string

AgentName returns the agent name for this block.

func (*Model) AppendReasoning

func (m *Model) AppendReasoning(content string)

AppendReasoning appends to the reasoning content. Creates a new reasoning item if the last item was a tool, otherwise appends to the last reasoning item.

func (*Model) GetSize

func (m *Model) GetSize() (int, int)

GetSize returns the current dimensions.

func (*Model) HasToolCall

func (m *Model) HasToolCall(toolCallID string) bool

HasToolCall returns true if the block contains the given tool call ID.

func (*Model) Height

func (m *Model) Height() int

Height calculates the rendered height.

func (*Model) ID

func (m *Model) ID() string

ID returns the block's unique identifier.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the component.

func (*Model) IsExpanded

func (m *Model) IsExpanded() bool

IsExpanded returns the current expanded state.

func (*Model) IsHeaderLine

func (m *Model) IsHeaderLine(lineIdx int) bool

IsHeaderLine returns true if the given line index is the header (line 0).

func (*Model) IsToggleLine

func (m *Model) IsToggleLine(lineIdx int) bool

IsToggleLine returns true if clicking this line should toggle the block. Only the header is toggleable.

func (*Model) Reasoning

func (m *Model) Reasoning() string

Reasoning returns the full reasoning content (concatenated from all reasoning items).

func (*Model) SetExpanded

func (m *Model) SetExpanded(expanded bool)

SetExpanded sets the expanded state directly.

func (*Model) SetReasoning

func (m *Model) SetReasoning(content string)

SetReasoning sets reasoning content (replaces all content items with a single reasoning item).

func (*Model) SetSize

func (m *Model) SetSize(width, height int) tea.Cmd

SetSize sets the component dimensions.

func (*Model) Toggle

func (m *Model) Toggle()

Toggle switches between expanded and collapsed state.

func (*Model) ToolCount

func (m *Model) ToolCount() int

ToolCount returns the number of tool calls in this block.

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (layout.Model, tea.Cmd)

Update handles messages.

func (*Model) UpdateToolCall

func (m *Model) UpdateToolCall(toolCallID string, status types.ToolStatus, args string)

UpdateToolCall updates an existing tool call in the block.

func (*Model) UpdateToolResult

func (m *Model) UpdateToolResult(toolCallID, content string, status types.ToolStatus, result *tools.ToolCallResult) tea.Cmd

UpdateToolResult updates tool result for a tool call.

func (*Model) View

func (m *Model) View() string

View renders the block.

type ToggleMsg

type ToggleMsg struct {
	BlockID string
}

ToggleMsg is sent when the block should toggle expanded/collapsed state.

Jump to

Keyboard shortcuts

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