budget

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBudget  = 4 * 1024  // bytes
	ExplicitBudget = 64 * 1024 // bytes
)

The two budget tiers. DefaultBudget caps broad sweeps (outlines, whole packages, every text tool); ExplicitBudget caps explicit, informed requests (a named file with full=true, a symbols fetch) — a higher ceiling sized for real single-file reads, not a bypass.

Variables

This section is empty.

Functions

func Wrapped

func Wrapped(full, gnowebURL, kind, source string) (text string, truncated bool)

Wrapped applies the DefaultBudget (broad-sweep tier) and wraps surviving content in an untrusted-content envelope. See WrappedAt.

func WrappedAt

func WrappedAt(full, gnowebURL, kind, source string, limit int) (text string, truncated bool)

WrappedAt applies the given budget limit to chain-derived content and wraps the surviving content in an untrusted-content envelope tagged with kind/source. When the content is over budget it is dropped for gnomcp's own truncation summary (framing, not chain bytes), returned unwrapped; truncated reports which case. Explicit, path-targeted tools (e.g. gno_render) pass ExplicitBudget — the same ceiling as a named full-file read.

Types

type Result

type Result struct {
	Summary   string `json:"summary,omitempty"`
	GnowebURL string `json:"gnoweb_url"`
	Truncated bool   `json:"truncated"`
	Size      int    `json:"size"`
	Full      string `json:"full,omitempty"`
}

func Apply

func Apply(full, gnowebURL string, limit int) Result

Jump to

Keyboard shortcuts

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