tooling

package
v2026.909.1 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const MissingToolIntentDisplay = "Intent missing"
View Source
const ToolIntentSchemaDescription = "Required brief phrase describing why this tool call is being made"

Variables

View Source
var ErrLegacyToolBlockComplete = errors.New("legacy tool_calls block complete")
View Source
var ErrMalformedLegacyTool = errors.New("malformed legacy tool block")
View Source
var ErrMalformedNativeTool = errors.New("malformed native tool call")
View Source
var ErrMissingToolIntent = errors.New("missing tool intent")
View Source
var ErrUnknownLegacyTool = errors.New("unknown legacy tool name")

Functions

func BaseNameFromFuncName

func BaseNameFromFuncName(full string) string

func ExtractToolIntent

func ExtractToolIntent(rawArgs json.RawMessage) string

func FormatToolDisplayLines

func FormatToolDisplayLines(name string, rawArgs json.RawMessage) []string

func FormatToolResultDisplayLines added in v2026.602.2

func FormatToolResultDisplayLines(toolName string, payload string) []string

func FuncName

func FuncName(fn any) (string, error)

func FuncSignature

func FuncSignature(fn any) (string, error)

func HighlightGoLineForTest added in v2026.613.0

func HighlightGoLineForTest(line string) string

func LegacyProseOutsideToolCalls

func LegacyProseOutsideToolCalls(text string) string

func SchemaWithRequiredToolIntent added in v2026.909.0

func SchemaWithRequiredToolIntent(schema map[string]any) map[string]any

SchemaWithRequiredToolIntent returns a shallow-cloned JSON Schema with the Solomon intent contract added. The intent property is reserved by Solomon and is always a required non-empty-string field at the dispatch boundary.

func SplitStyledRangeForTest added in v2026.613.0

func SplitStyledRangeForTest(styled string, start, end int) string

func StripLegacyToolBlocks

func StripLegacyToolBlocks(text string) string

func ToolIntent added in v2026.909.0

func ToolIntent(rawArgs json.RawMessage) (string, bool)

ToolIntent returns the non-empty string intent carried by a JSON tool argument object. A non-string intent is not considered valid.

func ToolIntentDisplay added in v2026.909.0

func ToolIntentDisplay(rawArgs json.RawMessage) string

func UserFacingLegacyToolError

func UserFacingLegacyToolError(err error) string

func ValidateInvocationIntents added in v2026.909.0

func ValidateInvocationIntents(invs []Invocation) error

func ValidateInvocationNames

func ValidateInvocationNames(invs []Invocation, allowed map[string]struct{}) error

func ValidateLegacyToolLines

func ValidateLegacyToolLines(text string) error

func ValidateNativeInvocation added in v2026.909.0

func ValidateNativeInvocation(inv Invocation) error

func ValidateNativeInvocations added in v2026.909.0

func ValidateNativeInvocations(invs []Invocation) error

func ValidateToolIntent added in v2026.909.0

func ValidateToolIntent(rawArgs json.RawMessage) error

ValidateToolIntent enforces the Solomon tool-call contract at the dispatch boundary. Invalid JSON is left to the argument decoder so callers retain the more useful malformed-arguments error.

func WriteToolDisplayLines

func WriteToolDisplayLines(out io.Writer, cpSeq int, branchKey string, lines []string)

func WriteToolDisplayLinesWithPrefixes added in v2026.716.0

func WriteToolDisplayLinesWithPrefixes(out io.Writer, firstPrefixPlain, continuationPrefixPlain string, lines []string)

WriteToolDisplayLinesWithPrefixes renders lines with explicit first-line and continuation prefixes while retaining terminal-aware soft wrapping.

func WriteToolDisplayLinesWithPrefixesAndWidth added in v2026.716.0

func WriteToolDisplayLinesWithPrefixesAndWidth(out io.Writer, firstPrefixPlain, continuationPrefixPlain string, lines []string, width int)

func WriteToolDisplayLinesWithWidth added in v2026.613.0

func WriteToolDisplayLinesWithWidth(out io.Writer, cpSeq int, branchKey string, lines []string, width int)

Types

type FormatToolLinesFunc

type FormatToolLinesFunc func(name string, args json.RawMessage) []string

type Invocation

type Invocation struct {
	Name       string
	Args       json.RawMessage
	ToolCallID string
}

func ExtractToolInvocations

func ExtractToolInvocations(text string) ([]Invocation, error)

func ParseToolCallsBlock

func ParseToolCallsBlock(block string) ([]Invocation, error)

type LegacyStreamWriter

type LegacyStreamWriter struct {
	Out     io.Writer
	Format  FormatToolLinesFunc
	Allowed map[string]struct{}
	// contains filtered or unexported fields
}

func NewLegacyStreamWriter

func NewLegacyStreamWriter(out io.Writer, format FormatToolLinesFunc, allowed map[string]struct{}) *LegacyStreamWriter

func (*LegacyStreamWriter) DisplayRendered

func (w *LegacyStreamWriter) DisplayRendered() bool

func (*LegacyStreamWriter) Flush

func (w *LegacyStreamWriter) Flush() error

func (*LegacyStreamWriter) HasOpenToolCalls

func (w *LegacyStreamWriter) HasOpenToolCalls() bool

func (*LegacyStreamWriter) Invocations

func (w *LegacyStreamWriter) Invocations() []Invocation

func (*LegacyStreamWriter) TruncatedContent

func (w *LegacyStreamWriter) TruncatedContent() string

func (*LegacyStreamWriter) Write

func (w *LegacyStreamWriter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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