capabilityfacts

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package capabilityfacts provides neutral capability extraction, turn shape facts, and hash derivation matching canonical lipapi semantics without materializing a lipapi.Call.

Index

Constants

This section is empty.

Variables

View Source
var ErrSemanticFactBudgetExceeded = errors.New("largebody: semantic-fact budget exceeded (optimization decline)")

ErrSemanticFactBudgetExceeded indicates that normalized item/part metadata exceeds the configured semantic-fact budget ceiling.

Functions

func CapabilitiesDigest

func CapabilitiesDigest(caps []lipapi.Capability) [32]byte

CapabilitiesDigest returns a deterministic SHA-256 digest of the given capabilities. It is order-independent and always produces a valid non-zero 32-byte hash.

func DeriveRequiredCapabilities

func DeriveRequiredCapabilities(turn TurnShape, ctrl ControlRequirements) []lipapi.Capability

DeriveRequiredCapabilities derives a deduplicated, bounded slice of lipapi.Capability required by the client turn and control requirements, matching canonical lipapi.RequiredCapabilities semantics.

func ValidateCapabilities

func ValidateCapabilities(caps []lipapi.Capability, maxFactBytes int64) error

ValidateCapabilities validates that every capability name is non-empty and bounded.

Types

type ControlRequirements

type ControlRequirements struct {
	Delivery          lipapi.DeliveryMode
	HasTools          bool
	ParallelToolCalls *bool
	ReasoningEffort   string
	StructuredOutputs bool
	ItemAuthoritative bool
}

ControlRequirements carries request-level control flags and settings needed to derive required capabilities under canonical lipapi semantics without materializing a lipapi.Call.

type TurnItemShape

type TurnItemShape struct {
	Kind    lipapi.ItemKind
	Role    lipapi.Role
	Ordinal int64
	Parts   []TurnPartShape
}

TurnItemShape describes one normalized turn item by kind, role, ordinal, and part shapes only.

func (TurnItemShape) Validate

func (it TurnItemShape) Validate(maxFactBytes int64) error

Validate enforces canonical vocabulary membership and bounds part counts under the semantic-fact budget.

type TurnPartShape

type TurnPartShape struct {
	Kind         lipapi.ContentPartKind
	ContentBytes int64
}

TurnPartShape records the content-part kind and content size in bytes for one normalized turn part without retaining or materializing prompt text.

func (TurnPartShape) Validate

func (p TurnPartShape) Validate() error

Validate enforces canonical vocabulary membership and non-negative sizes.

type TurnShape

type TurnShape struct {
	Items             []TurnItemShape
	TotalContentBytes int64
}

TurnShape is the bounded normalized client-turn shape equivalent to lipapi.NormalizedItems for the certified subset: role/ordinal/content-part kinds and other recorder-required non-content facts (Requirement 14.3). Semantic-fact budget overflow selects canonical processing.

func (TurnShape) MetadataBytes

func (s TurnShape) MetadataBytes() int64

MetadataBytes calculates in-memory metadata size for budget validation.

func (TurnShape) Validate

func (s TurnShape) Validate(maxFactBytes int64) error

Validate bounds item counts under the semantic-fact budget.

Jump to

Keyboard shortcuts

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