Documentation
¶
Overview ¶
Package readtoolresult implements read_tool_result: the tool a model calls to page back through a tool result the loop retained in full when it was shown only a shaped preview.
The tool is a thin, strict front end over Harness's tool.ToolResultReader. Harness owns everything that decides WHAT may be read: it binds one reader per (session, calling loop), resolves the capture id against that loop's own captures, verifies the stored object end to end, and fits each page under the loop's preview budget. The model can name only a capture id — never a session, tenant, object reference, backend key or path — so this package has nothing to authorize and no identity to resolve. What it owns is the argument boundary: PrepareCall refuses anything that is not exactly {capture_id, offset?, max_bytes?}, and a reader failure is reported as the reader's own model-safe text, never its cause.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PrepareError ¶
type PrepareError struct {
// contains filtered or unexported fields
}
PrepareError is a refused argument document. Its message is model-safe.
func (*PrepareError) Error ¶
func (e *PrepareError) Error() string
type Tool ¶
type Tool struct {
// contains filtered or unexported fields
}
Tool is the read_tool_result tool bound to one loop's reader.
func New ¶
func New(reader tool.ToolResultReader) *Tool
New binds the tool to reader, the loop-scoped reader Harness supplies in tool.Bindings.ToolResults. A nil or typed-nil reader yields a tool that refuses every call.
func (*Tool) Info ¶
Info returns the tool's self-description. The name is Harness's constant, so the retention marker and the tool cannot drift apart.
func (*Tool) InvokableRun ¶
InvokableRun reads the prepared page. It never re-parses argsJSON and never returns a Go error: every failure is a result the model can act on, carrying only model-safe text.
func (*Tool) PrepareCall ¶
func (t *Tool) PrepareCall(_ context.Context, _ uuid.UUID, argsJSON string) (tool.Request, tool.PreparedArtifact, error)
PrepareCall decodes and validates the arguments once and freezes them. It refuses: anything but exactly one JSON object; unknown or duplicated members; member names that differ from capture_id, offset and max_bytes in any way, including case; a capture_id that is not a canonical lower-case UUID (the only form the marker prints); an offset or max_bytes that is not a non-negative integer; and max_bytes of zero. max_bytes above the page ceiling is clamped to it.
The request carries no requirements: a loop reading its own retained output performs no new effect, and the reader Harness bound already confines it to that loop's captures.