Documentation
¶
Overview ¶
Package injection applies a bounded, provider-neutral continuity projection to a canonical call. It owns only the pure request mutation; durable branch pending/release state remains with the preserver and coordinator layers.
Index ¶
- Constants
- Variables
- func HasProjection(call lipapi.Call, e capsule.Envelope, expectedBranch string, ...) bool
- func Serialize(e capsule.Envelope, expectedBranch string, limits ProjectionLimits) ([]byte, error)
- func SerializeBlock(e capsule.Envelope, expectedBranch string, limits ProjectionLimits) ([]byte, error)
- func TokenEquivalent(b []byte) int
- type AppliedMarker
- type Input
- type Limits
- type Marker
- type Outcome
- type ProjectionLimits
Constants ¶
const ( // ProjectionVersion is the model-facing continuity block format version. ProjectionVersion = 1 // BlockStart and BlockEnd are deliberately explicit delimiters. They make // the proxy-owned block distinguishable from user text without exposing // storage integrity metadata. BlockStart = "<LIP-CONTINUITY version=\"1\" begin>\n" BlockEnd = "\n<LIP-CONTINUITY version=\"1\" end>" )
Variables ¶
var ( ErrInvalidInput = errors.New("compactioncontinuity/injection: invalid input") ErrInvalidMarker = errors.New("compactioncontinuity/injection: invalid call-local marker") ErrProjectionBudget = errors.New("compactioncontinuity/injection: projection budget exceeded") ErrProjectionVerify = errors.New("compactioncontinuity/injection: capsule verification failed") ErrProjectionInvalid = errors.New("compactioncontinuity/injection: injected call is invalid") )
Functions ¶
func HasProjection ¶
func HasProjection(call lipapi.Call, e capsule.Envelope, expectedBranch string, limits ProjectionLimits) bool
HasProjection reports whether the current authority's final canonical carrier already contains this exact bounded projection. It is call-local deduplication only; durable branch release state remains coordinator-owned.
func SerializeBlock ¶
func SerializeBlock(e capsule.Envelope, expectedBranch string, limits ProjectionLimits) ([]byte, error)
SerializeBlock verifies e against expectedBranch and emits the stable, delimited model-facing projection. BranchBinding and ContentDigest are integrity metadata and are intentionally absent from the projection.
func TokenEquivalent ¶
TokenEquivalent returns the deterministic conservative budget estimate used by this package. It is intentionally a byte-equivalent estimate, not provider tokenizer output.
Types ¶
type AppliedMarker ¶
type AppliedMarker = Marker
AppliedMarker is a descriptive alias for callers that want to distinguish the returned marker from durable branch watermarks.
type Input ¶
type Input struct {
Call lipapi.Call
Capsule capsule.Envelope
ExpectedBranchBinding string
BoundaryKey string
Limits ProjectionLimits
// Marker is the ephemeral marker from a prior attempt in this call-local
// lifecycle. A matching marker makes injection an idempotent no-op.
Marker Marker
}
Input is the pure injection request. Capsule must already be a locally available value; Inject rechecks its branch binding and content digest before creating any model-facing text.
type Limits ¶
type Limits = ProjectionLimits
Limits is the short name used by orchestration callers.
type Marker ¶
Marker identifies one call-local application. It deliberately contains no durable state and is returned to the caller for retry/failover preparation.
type Outcome ¶
type Outcome struct {
Call lipapi.Call
Marker Marker
Applied bool
Bytes int
TokenEquivalent int
Block []byte
}
Outcome describes one pure application attempt. On every error, Call is the exact input value and Marker is zero. On a matching marker, Call and Marker are retained and Applied is false.
type ProjectionLimits ¶
ProjectionLimits bounds the complete serialized model-facing block. A zero bound means that dimension is not additionally constrained; negative bounds are invalid. TokenEquivalent uses the conservative one UTF-8 byte per unit convention shared by capsule bounds and extractor accounting.