Help us shape the future of Go! Take the 2026 Go Developer Survey

livetool

package
v0.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 16, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package livetool reads and bounds transient tool-step bodies: harness's public projection of ToolCallStarted and ToolCallCompleted.

The bodies carry the tool's redacted audit summary and a capped result preview, never raw tool arguments. This package neither widens nor derives either; it only shortens them so one frame fits the transport cap.

Index

Constants

View Source
const (
	// KindStarted is the body type of a tool call that began executing.
	KindStarted = "ToolCallStarted"
	// KindCompleted is the body type of a tool call that finished.
	KindCompleted = "ToolCallCompleted"
)

Variables

This section is empty.

Functions

func Fit

func Fit(body json.RawMessage, limit int) (json.RawMessage, bool)

Fit returns body shortened until its encoding is at most limit bytes. It truncates result_preview first and summary second, each at a rune boundary with a trailing ellipsis, and leaves every other member intact. A body that already fits is returned byte-identical. It refuses a body Parse refuses and one that cannot fit even with both members reduced to the ellipsis.

func Kind

func Kind(body json.RawMessage) (string, bool)

Kind reports which tool-step kind body is, when Parse accepts it.

Types

type Step

type Step struct {
	Version         int    `json:"v"`
	Type            string `json:"type"`
	SessionID       string `json:"session_id"`
	LoopID          string `json:"loop_id"`
	TurnID          string `json:"turn_id"`
	StepID          string `json:"step_id"`
	ToolExecutionID string `json:"tool_execution_id"`
	ToolUseID       string `json:"tool_use_id"`
	ToolName        string `json:"tool_name"`
	Summary         string `json:"summary"`
	IsError         bool   `json:"is_error"`
	ElapsedMillis   uint64 `json:"elapsed_ms"`
	ResultPreview   string `json:"result_preview"`
}

Step is the correlation and visible content of one public tool-step body.

func Parse

func Parse(body json.RawMessage) (Step, bool)

Parse accepts only version-1 ToolCallStarted and ToolCallCompleted bodies carrying loop, turn and tool-execution identities. tool_use_id is optional: a runtime on harness before v0.42.0 does not send it.

Jump to

Keyboard shortcuts

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