serveview

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package serveview is the pure construction layer for what the engine serves the agent: it owns the size policy — part kinds, caps, the calibrated default budget — and the bounded-part construction the engine delegates to, keeping the engine orchestration-only (d-tac-qwc). It is to serves what presenters are to finders: rendering policy kept separable from the machinery that assembles the data.

Index

Constants

View Source
const ItemAllowanceBytes = 150

ItemAllowanceBytes is the default per-item byte allowance for count-capped typed rows whose rendered size is unknowable before templating; byte safety comes from the serve-size regression harness, which fails when template growth breaks the fit (d-tac-qwc).

Variables

This section is empty.

Functions

func BoundValue

func BoundValue(v any, cap Cap) (any, *truncate.Cut)

BoundValue applies a cap to one part value at a serve seam. A Carrier passes its payload through with the producer's cut meta surfaced; a string takes the byte cap; any other value passes uncut — its bound lives where the value is built, not at the seam. The returned cut is nil when nothing was dropped.

Types

type Budget

type Budget struct {
	// Total is the advisory whole-serve target the authoring arithmetic
	// checks against; the engine never enforces it at runtime — everything
	// legitimately cuttable is cut at its own part cap, and a cut
	// instruction is a broken instruction, not a smaller one (d-tac-rzi).
	Total int
	// contains filtered or unexported fields
}

Budget is the size policy for one automatic serve.

func Default

func Default() Budget

Default is the calibrated default budget. Total is grounded in the verified ~10K-token host output floor (20260719-122547-s-tac-40d) at roughly 3.5 bytes per token; the per-kind caps come from the 2026-08-30 calibration of every shipped procedure's serves against the SDD repository's own graph (d-tac-rzi slice 1) and join runtime resolution as each kind's honest cut mechanism lands.

func (Budget) Cap

func (b Budget) Cap(kind PartKind) Cap

Cap returns the budget's default cap for a part kind (zero = unbounded).

type Cap

type Cap struct {
	MaxBytes int
	MaxItems int
}

Cap bounds one part: MaxBytes for rendered text, MaxItems for typed data. The zero value means unbounded.

func Effective

func Effective(declared, registered Cap) Cap

Effective resolves one part's cap: the spec's declaration wins, else the query's registration default. Budget defaults per part kind are wired in by the seams as each kind's honest cut lands — a byte default applied to an entry list before the pipeline can cut it at entry boundaries would reintroduce the mid-entry cut this work removes.

func (Cap) Zero

func (c Cap) Zero() bool

Zero reports whether no bound is declared.

type PartKind

type PartKind string

PartKind classifies a serve part by how it scales and what unit an honest cut works in.

const (
	// PartText is one producer-rendered blob (a view layout, entry chains as
	// rendered text) — cut in bytes at line boundaries.
	PartText PartKind = "text"
	// PartEntryList scales in whole entries — cut only at entry boundaries.
	PartEntryList PartKind = "entry-list"
	// PartLineList is newline-joined single-line rows (topic labels).
	PartLineList PartKind = "line-list"
	// PartItemList is typed rows a template ranges over — cut by count.
	PartItemList PartKind = "item-list"
	// PartStoreValue is an interpolated store value.
	PartStoreValue PartKind = "store-value"
	// PartDraft is the engine-owned draft playback lane.
	PartDraft PartKind = "draft"
	// PartFraming is one shell framing lane.
	PartFraming PartKind = "framing"
	// PartProduced is the terminal serve's engine-written values block.
	PartProduced PartKind = "produced"
)

Jump to

Keyboard shortcuts

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