offload

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2026 License: Apache-2.0 Imports: 22 Imported by: 2 modules, 1 package

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 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

func MarkKeptVerbatim(st store.Store, original string)

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.

func OwnsKey

func OwnsKey(st store.Store, session, key string) bool

OwnsKey reports whether session stashed key. Exported for the proxy's GET /expand handler to scope retrieval to the caller's session (prevents cross-session/tenant disclosure of offloaded originals). Returns false when either is empty.

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) Enabled

func (f *Cmdfilter) Enabled(*components.Ctx) bool

func (Cmdfilter) Name

func (Cmdfilter) Name() string

func (*Cmdfilter) Offload

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) Enabled

func (Collapse) Enabled(*components.Ctx) bool

func (Collapse) Name

func (Collapse) Name() string

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) Enabled

func (Dedup) Enabled(*components.Ctx) bool

func (Dedup) Name

func (Dedup) Name() string

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) Enabled

func (Extract) Enabled(*components.Ctx) bool

func (Extract) Name

func (Extract) Name() string

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

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) Enabled

func (FailedRun) Enabled(*components.Ctx) bool

func (FailedRun) Name

func (FailedRun) Name() string

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) Enabled

func (Mask) Enabled(*components.Ctx) bool

func (Mask) Name

func (Mask) Name() string

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

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) Enabled

func (Summarize) Enabled(*components.Ctx) bool

func (Summarize) Name

func (Summarize) Name() string

func (*Summarize) NeedsModel

func (*Summarize) NeedsModel() bool

func (*Summarize) Offload

Jump to

Keyboard shortcuts

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