Documentation
¶
Index ¶
Constants ¶
View Source
const DefaultMaxInput = 200 * 1024
DefaultMaxInput is the default stdin cap (200 KiB).
Variables ¶
View Source
var ErrNoInput = errors.New("no input: pass a question as an argument or pipe content to stdin")
ErrNoInput is returned when there's neither an argument nor piped stdin.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// Arg is the positional argument (or "-" to mean "read from stdin
// explicitly"). Empty string means no arg was given.
Arg string
// ArgGiven distinguishes an explicit empty-string argument from no arg
// being present at all. Cobra doesn't let you pass an empty positional,
// so this mostly matches Arg != "", but we make it explicit for clarity
// in tests.
ArgGiven bool
// MaxInput caps stdin bytes. 0 → DefaultMaxInput.
MaxInput int
// Stdin is the reader to consume. Injected for testing. When nil,
// os.Stdin is used.
Stdin io.Reader
// StdinIsTerminal reports whether the caller's stdin is a TTY. When
// nil, Resolve checks os.Stdin directly.
StdinIsTerminal func() bool
// Nonce overrides the random suffix used in the content wrapping tag.
// Tests inject a deterministic value; production leaves it empty and
// Resolve generates 64 fresh random bits.
Nonce string
}
Options controls Resolve behavior. Fields map 1-to-1 to CLI flags.
type Result ¶
type Result struct {
// UserMessage is the fully-composed text sent to the model.
UserMessage string
// Question is the human-readable form recorded in history: argument if
// present, else stdin, without the wrapping tags.
Question string
// StdinContent is the raw stdin payload before any wrapping or escaping.
// Empty when stdin wasn't read. Decision mode echoes this to stdout on a
// gate-open verdict so `cmd | qq --unless "..." | next` stays composable.
StdinContent string
// Truncated is true if stdin hit the size cap.
Truncated bool
// Source explains where the content came from, for error messages.
Source string
// ContentTag is the per-invocation tag name used to wrap stdin when arg
// and stdin were both present. Empty when no wrapping happened. The
// caller mirrors it into the system prompt so the model knows which
// region is untrusted.
ContentTag string
}
Result is the outcome of resolving CLI args + stdin into a single user message plus a "question" string for history.
Click to show internal directories.
Click to hide internal directories.