Documentation
¶
Overview ¶
Package response defines the final-canonical-stream observer contract. Factories open read-only observers for the active surfaced B-leg; Observe receives post-response-hook and post-gate events immediately before client emit; Finish runs exactly once with a typed StreamOutcome.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Services ¶
type Services struct{}
Services is a forward-compatible observer service bag. Final-stream observation is read-only and does not require State/Aux injection in v1.
type StreamMeta ¶
type StreamMeta struct {
TraceID string
ALegID string
BLegID string
CandidateKey string
BackendID string
BackendPrefixes []string
Model string
AttemptSeq int
Scope scope.PrincipalScopeView
Session session.SessionView
Workspace workspace.WorkspaceView
}
StreamMeta carries attempt-scoped identifiers for final-stream observers. Authoritative session identity lives on Session (SessionView.AuthoritativeSessionID); raw session partitions are intentionally not exposed. BackendPrefixes is provider-neutral candidate prefix evidence for capture gating; runtime clones before open, and observers must treat the slice as immutable.
type StreamObserver ¶
type StreamObserver interface {
Observe(context.Context, lipapi.Event) error
Finish(context.Context, StreamOutcome) error
}
StreamObserver receives defensive final canonical events and a single Finish.
type StreamObserverFactory ¶
type StreamObserverFactory interface {
ID() string
Order() int
FailureMode() sdkhooks.FailureMode
Open(context.Context, StreamMeta, Services) (StreamObserver, error)
}
StreamObserverFactory opens one StreamObserver for an active surfaced B-leg.
func MaterializeSorted ¶
func MaterializeSorted(factories []StreamObserverFactory) []StreamObserverFactory
MaterializeSorted returns a copy of factories sorted for stable execution (same rule as request/completion: ascending Order, ID, registration index). Nil entries are not special-cased; callers must not pass nil interfaces.
type StreamOutcome ¶
type StreamOutcome string
StreamOutcome is the exactly-once terminal disposition for one observer lifecycle.
const ( // OutcomeSuccessReleased means the runtime released a successful response_finished // toward the frontend encoder (not client transport acknowledgement). OutcomeSuccessReleased StreamOutcome = "success_released" // OutcomeFailed means the active B-leg failed before successful release. OutcomeFailed StreamOutcome = "failed" // OutcomeCancelled means the request was cancelled before successful release. OutcomeCancelled StreamOutcome = "cancelled" // OutcomeClosed means the client closed the stream before successful release. OutcomeClosed StreamOutcome = "closed" // OutcomeReplaced means a pre-output recv replacement discarded this B-leg. OutcomeReplaced StreamOutcome = "replaced" // OutcomeGateReplaced means a completion gate replaced the buffered original stream. OutcomeGateReplaced StreamOutcome = "gate_replaced" )