Documentation
¶
Overview ¶
Package offload holds the lossy-but-reversible components (they drop bytes and stash the original for the expand tool loop). Each registers itself via init(); a binary blank-imports components/all to pull them in.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarkKeptVerbatim ¶
MarkKeptVerbatim records that this original content was expanded and must not be re-compacted (keyed by content hash, session-independent). Exported for the proxy's expand loop, which has the restored original but not the offload Ctx.
Types ¶
type Cmdfilter ¶
type Cmdfilter struct {
// contains filtered or unexported fields
}
Cmdfilter shrinks tool-output messages with declarative DSL filters. It is an Offload: it stashes the original before filtering so the expand tool can recover it. Filters match on the tool output's first non-empty line (the proxy-world stand-in for rtk's shell command).
func (*Cmdfilter) Offload ¶
func (f *Cmdfilter) Offload(req *schemas.BifrostChatRequest, rep *components.Report, c *components.Ctx) ([]string, error)
type Collapse ¶
type Collapse struct {
// contains filtered or unexported fields
}
Collapse is the content-agnostic fallback for an oversized tool output that no more specific component handled: it keeps a head + tail window, stashes the full original, and leaves an expand marker. Runs late in the pipeline (after cmdfilter/format), and skips anything already carrying a marker so it never double-collapses.
func (*Collapse) Offload ¶
func (cl *Collapse) Offload(req *schemas.BifrostChatRequest, rep *components.Report, c *components.Ctx) ([]string, error)
type Dedup ¶
type Dedup struct {
// contains filtered or unexported fields
}
Dedup replaces a tool output that is byte-identical to an earlier one in the same request with a short pointer + expand marker, stashing the original. Exact-match only in v1; near-duplicate (similarity threshold) is deferred.
func (*Dedup) Offload ¶
func (d *Dedup) Offload(req *schemas.BifrostChatRequest, rep *components.Report, c *components.Ctx) ([]string, error)
type Extract ¶
type Extract struct {
// contains filtered or unexported fields
}
Extract is the DETERMINISTIC (no-LLM) tool-output reducer. It runs every request (cheap) and is deliberately CONSERVATIVE: it removes only OBVIOUS, provably redundant noise (exactly repeated lines/blocks, runs of blank lines, progress bars/spinners) via collapseObviousNoise, keeping every unique informative line verbatim. This guarantees it can never hide content the agent needs and force it to redo work. Relevance-aware, aggressive trimming (regex rewrites, summaries) is the job of the separate `extract_llm` component — configure them together (`[extract, extract_llm]`) so the cheap pass runs every step and the LLM pass only every few steps.
It is byte-stable on unchanged content (deterministic per-message), so it is cache-safe and needs no cache-boundary restriction. The full original is stashed under a marker (reversible via the expand tool).
func (*Extract) Offload ¶
func (e *Extract) Offload(req *bschemas.BifrostChatRequest, rep *components.Report, c *components.Ctx) ([]string, error)
type ExtractLLM ¶
type ExtractLLM struct {
// contains filtered or unexported fields
}
ExtractLLM is the relevance-aware, LLM-driven tool-output reducer. A cheap model writes a small Starlark program that trims ONE tool output down to what the agent needs next (it may delete OR rewrite via regex, preserving ids/paths/errors verbatim, and may emit a one-line SUMMARY that goes into the marker). The program runs in a sandbox (no imports/IO, step+time limited) and the result must pass a sanity check (non-empty, strictly smaller, keep-ids present); on any miss the item is left verbatim. The full original is always stashed (reversible via expand).
It is the EXPENSIVE pass, so it is throttled (per-session cadence + per-request cap) and — in cache-aware mode — only rewrites tool outputs in the uncached tail that are still medium/large AFTER the deterministic components ran. Prior compactions are reused byte-for-byte from state so the request prefix stays stable.
func (*ExtractLLM) Enabled ¶
func (*ExtractLLM) Enabled(*components.Ctx) bool
func (*ExtractLLM) Name ¶
func (*ExtractLLM) Name() string
func (*ExtractLLM) Offload ¶
func (e *ExtractLLM) Offload(req *bschemas.BifrostChatRequest, rep *components.Report, c *components.Ctx) ([]string, error)
type FailedRun ¶
type FailedRun struct {
// contains filtered or unexported fields
}
FailedRun collapses earlier test/build runs that a later run supersedes: only the most recent run-like tool output is kept in full; earlier ones become a pointer + stash. This is the "provable-reason" collapse — a superseded run is safely recoverable via expand if the agent still needs it.
func (*FailedRun) Offload ¶
func (fr *FailedRun) Offload(req *schemas.BifrostChatRequest, rep *components.Report, c *components.Ctx) ([]string, error)
type Mask ¶
type Mask struct {
// contains filtered or unexported fields
}
Mask hides older tool outputs beyond a keep-recent window (after CE-Manager's context garbage collection): the newest KeepRecent tool results stay verbatim, older ones are replaced with a short marker + stash. Age-based, complementary to the content-based offloaders.
func (*Mask) Offload ¶
func (m *Mask) Offload(req *bschemas.BifrostChatRequest, rep *components.Report, c *components.Ctx) ([]string, error)
type SmartCrush ¶
type SmartCrush struct {
// contains filtered or unexported fields
}
SmartCrush is headroom's statistical JSON-array compressor, in essence: keep a first-K/last-K anchor window plus any item that carries an error signal, drop the rest, and stash the full original. Schema-preserving (kept items are verbatim originals). v1 uses fixed anchors; headroom's Kneedle adaptive-K is a documented refinement.
func (SmartCrush) Enabled ¶
func (SmartCrush) Enabled(*components.Ctx) bool
func (SmartCrush) Name ¶
func (SmartCrush) Name() string
func (*SmartCrush) Offload ¶
func (s *SmartCrush) Offload(req *bschemas.BifrostChatRequest, rep *components.Report, c *components.Ctx) ([]string, error)
type Summarize ¶
type Summarize struct {
// contains filtered or unexported fields
}
Summarize compresses the middle of a long trajectory into one LLM-written summary (ported from CE-Manager's ReSum-style summarizer). It restructures the message list to [msg0, <summary system message>, last-K messages], replacing everything in between. It is an Offload: the replaced span is stashed under a <<cg:HASH>> marker (carried in the summary message) so the expand tool can restore it. NeedsModel — it no-ops when no model is available.
This is the one component that changes the message count; apply.Body rebuilds the body preserving the retained messages' original bytes.
func (*Summarize) NeedsModel ¶
func (*Summarize) Offload ¶
func (s *Summarize) Offload(req *bschemas.BifrostChatRequest, rep *components.Report, c *components.Ctx) ([]string, error)