output

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package output defines redaction and truncation contracts for agent-visible output.

Index

Constants

View Source
const DefaultMaxLineCap = 1 << 20

DefaultMaxLineCap bounds an unterminated streaming line before it is forced through redaction. It is intentionally far larger than ordinary secrets.

Variables

This section is empty.

Functions

This section is empty.

Types

type Filter

type Filter interface {
	Apply(stdout string, stderr string) FilterResult
}

Filter redacts and truncates command output before it is returned to an agent.

func NewFilter

func NewFilter(config policy.Output) (Filter, error)

NewFilter compiles output filtering policy.

type FilterResult

type FilterResult struct {
	Stdout          string
	Stderr          string
	OutputTruncated bool
	Redactions      int
}

FilterResult is the agent-visible output after redaction and truncation.

type StreamFilter

type StreamFilter interface {
	Filter
	NewStreamWriter(dst io.Writer) *StreamWriter
}

StreamFilter is a compiled filter that can also redact incremental output.

type StreamWriter

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

StreamWriter line-buffers, redacts, truncates, and forwards one output stream.

It assumes a single goroutine calls Write. Stdout and stderr must use separate instances.

func (*StreamWriter) Emitted

func (w *StreamWriter) Emitted() []byte

func (*StreamWriter) Flush

func (w *StreamWriter) Flush()

Flush emits the final unterminated line after command execution has finished.

func (*StreamWriter) Redactions

func (w *StreamWriter) Redactions() int

func (*StreamWriter) Truncated

func (w *StreamWriter) Truncated() bool

func (*StreamWriter) Write

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

Jump to

Keyboard shortcuts

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