common

package
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxParamsLen is the maximum length for params in "Calling tool X with parameters: ..."
	MaxParamsLen = 400
	// MaxResultLen is the maximum length for result in "Result of X: ..."
	MaxResultLen = 500
)

Variables

This section is empty.

Functions

func ActionDisplayName

func ActionDisplayName(action types.Action) string

ActionDisplayName returns the action's display name for status messages, or "Tool" if nil.

func Truncate

func Truncate(s string, maxLen int) string

Truncate returns s truncated to maxLen with "..." suffix if truncated.

Types

type StatusAccumulator

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

StatusAccumulator holds accumulated status lines for a job's placeholder message. Callers (connectors) are responsible for mutex and for clearing when the job ends.

func NewStatusAccumulator

func NewStatusAccumulator() *StatusAccumulator

NewStatusAccumulator returns a new accumulator.

func (*StatusAccumulator) AppendReasoning

func (a *StatusAccumulator) AppendReasoning(reasoning string)

AppendReasoning appends a "Current thought: ..." line when reasoning is non-empty.

func (*StatusAccumulator) AppendToolCall

func (a *StatusAccumulator) AppendToolCall(actionName string, params string)

AppendToolCall appends a "Calling tool X with parameters: ..." line (params truncated).

func (*StatusAccumulator) AppendToolResult

func (a *StatusAccumulator) AppendToolResult(actionName string, result string)

AppendToolResult appends a "Result of X: ..." line (result truncated).

func (*StatusAccumulator) BuildMessage

func (a *StatusAccumulator) BuildMessage(thinkingPrefix string, maxTotalLen int) string

BuildMessage returns thinkingPrefix + "\n\n" + joined lines, truncated to maxTotalLen if needed. If over the limit, the message is truncated from the start (oldest content dropped) so the latest lines stay visible.

Jump to

Keyboard shortcuts

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