request

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: 12 Imported by: 0

Documentation

Overview

Package request defines the request-wide shaping stage contract (design §5, R12). Transforms run on the canonical lipapi.Call after submit hooks and tool catalog filtering, before per-attempt request-part hooks. Attempt-scoped identifiers are not populated in RequestMeta at this stage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttemptDecision

type AttemptDecision struct {
	Kind       AttemptDecisionKind
	ReasonCode string
}

type AttemptDecisionKind

type AttemptDecisionKind string
const (
	AttemptContinue         AttemptDecisionKind = "continue"
	AttemptExcludeCandidate AttemptDecisionKind = "exclude_candidate"
)

type AttemptMeta

type AttemptMeta struct {
	TraceID         string
	ALegID          string
	CandidateKey    string
	BackendID       string
	BackendPrefixes []string
	Model           string
	ReplaySupport   lipapi.ReasoningReplaySupport
	Scope           scope.PrincipalScopeView
	Session         session.SessionView
	Workspace       workspace.WorkspaceView
}

type AttemptTransform

type AttemptTransform interface {
	ID() string
	Order() int
	FailureMode() sdkhooks.FailureMode
	HandleAttempt(context.Context, *lipapi.Call, AttemptMeta, Services) (AttemptDecision, error)
}

func MaterializeAttemptsSorted

func MaterializeAttemptsSorted(transforms []AttemptTransform) []AttemptTransform

MaterializeAttemptsSorted returns a copy of attempt transforms sorted for stable execution (same rule as MaterializeSorted: ascending Order, ID, registration index). Nil entries are not special-cased; callers must not pass nil interfaces (matches MaterializeSorted for request.Transform).

type RequestMeta

type RequestMeta struct {
	TraceID     string
	Annotations map[string]string
	Principal   execview.PrincipalView
	Scope       scope.PrincipalScopeView
	Session     session.SessionView
	Workspace   workspace.WorkspaceView
}

RequestMeta is read-only policy and routing context for request-wide transforms. AttemptView is unset at this pipeline position (BLeg not allocated yet). Scope is the authoritative principal/scope attribution, carried separately from the legacy Principal projection (requirement 2.6). A zero Scope preserves local/anonymous identity semantics.

type Services

type Services struct {
	State state.Store
	Aux   auxiliary.Client
}

Services exposes narrow capabilities for transforms (design §2).

type Transform

type Transform interface {
	ID() string
	Order() int
	FailureMode() sdkhooks.FailureMode
	Handle(ctx context.Context, call *lipapi.Call, meta RequestMeta, svc Services) error
}

Transform mutates the canonical call with full visibility over messages, tools, and options. It is distinct from sdkhooks.SubmitHook (early reject/annotate) and from per-part hooks.

func MaterializeSorted

func MaterializeSorted(transforms []Transform) []Transform

MaterializeSorted returns a copy of transforms sorted for stable execution (same rule as the hook bus: ascending Order, ID, registration index).

Jump to

Keyboard shortcuts

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