outputoffload

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package outputoffload keeps large tool outputs out of the context window: the full text is written to a file under .senior-dev/tool-output and the model sees a bounded extract (head, tail and diagnostic-looking lines) plus the path.

Index

Constants

View Source
const (
	HEAD_LINES              = 20
	TAIL_LINES              = 40
	EXTRACT_MAX_CHARS       = 6_000
	OFFLOAD_THRESHOLD_CHARS = 12_000
)

Variables

View Source
var DefaultOffloader = Offloader{Sink: DiskSink{}}

Functions

func ExtractRelevant

func ExtractRelevant(output string, opts *ExtractRelevantOptions) string

ExtractRelevant keeps the head, tail, and diagnostic-looking lines.

Types

type DiskSink

type DiskSink struct{}

func (DiskSink) WriteOutput

func (DiskSink) WriteOutput(path string, output string) (string, error)

type DistillHook

type DistillHook func(fullOutput string) (string, error)

type ExtractRelevantOptions

type ExtractRelevantOptions struct {
	FullOutputPath *string  `json:"fullOutputPath"`
	Path           *string  `json:"path"`
	MaxChars       *float64 `json:"maxChars"`
}

type Offloader

type Offloader struct {
	Sink OutputSink
}

func (Offloader) OffloadLargeOutput

func (o Offloader) OffloadLargeOutput(input OutputOffloadInput, options any) OutputOffloadResult

OffloadLargeOutput applies the offload policy with an injected sink.

type OutputOffloadInput

type OutputOffloadInput struct {
	Output           string `json:"output"`
	Workspace        string `json:"workspace"`
	ToolName         string `json:"toolName"`
	CallID           string `json:"callId"`
	SessionID        string `json:"sessionId,omitempty"`
	EscalationWanted bool   `json:"escalationWanted"`
}

type OutputOffloadOptions

type OutputOffloadOptions struct {
	Hook             DistillHook `json:"-"`
	EscalationWanted bool        `json:"escalationWanted"`
	Force            bool        `json:"-"`
}

type OutputOffloadResult

type OutputOffloadResult struct {
	Inline           string
	OffloadPath      *string
	EscalationWanted bool
}

func OffloadLargeOutput

func OffloadLargeOutput(input OutputOffloadInput, options any) OutputOffloadResult

OffloadLargeOutput uses the production filesystem sink. options accepts nil, OutputOffloadOptions (or a pointer), or a DistillHook.

func (OutputOffloadResult) MarshalJSON

func (r OutputOffloadResult) MarshalJSON() ([]byte, error)

MarshalJSON emits inline first and the optional offloadPath and escalationWanted only when they are set.

type OutputSink

type OutputSink interface {
	WriteOutput(path string, output string) (string, error)
}

OutputSink is the filesystem side effect behind offloadLargeOutput.

Jump to

Keyboard shortcuts

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