Documentation
¶
Overview ¶
Package execctx attaches stable plugin-facing view snapshots to request context (tasks 4+). The principal field is filled from github.com/matdev83/go-llm-interactive-proxy/pkg/lipsdk/execview context values set at the transport edge, then published here; it does not import transport packages. It does not import provider SDKs.
Index ¶
- Constants
- func AuxiliaryDepth(ctx context.Context) int
- func IncAuxiliaryDepth(ctx context.Context) (context.Context, bool)
- func IsSuppressedPluginID(ctx context.Context, handlerID string) bool
- func RouteCandidatePreferences(ctx context.Context) []string
- func WithAuxiliaryDepth(ctx context.Context, depth int) context.Context
- func WithDetachedSession(ctx context.Context, meta DetachedSession) context.Context
- func WithRouteCandidatePreferences(ctx context.Context, prefs []string) context.Context
- func WithSecureSessionTurn(ctx context.Context, t SecureSessionTurn) context.Context
- func WithSuppressedPluginIDs(ctx context.Context, ids []string) context.Context
- func WithViews(ctx context.Context, v Views) context.Context
- func WithoutRouteCandidatePreferences(ctx context.Context) context.Context
- type DetachedSession
- type SecureSessionTurn
- type SecureSubmitViewsInput
- type SessionMode
- type Views
Constants ¶
const MaxAuxiliaryDepth = 16
MaxAuxiliaryDepth limits nested auxiliary.Execute chains (one primary request has depth 0).
Variables ¶
This section is empty.
Functions ¶
func AuxiliaryDepth ¶
AuxiliaryDepth returns the auxiliary nesting level, or 0 if unset.
func IncAuxiliaryDepth ¶
IncAuxiliaryDepth returns a child context with depth+1 or false if the limit is exceeded.
func IsSuppressedPluginID ¶
IsSuppressedPluginID reports whether handlerID is listed for suppression on this ctx.
func RouteCandidatePreferences ¶
RouteCandidatePreferences returns planner preference keys from WithRouteCandidatePreferences.
func WithAuxiliaryDepth ¶
WithAuxiliaryDepth stores the current auxiliary nesting level (0 = primary path).
func WithDetachedSession ¶
func WithDetachedSession(ctx context.Context, meta DetachedSession) context.Context
WithDetachedSession marks ctx with trusted internal detached execution policy and a defensive copy of the parent lineage metadata.
func WithRouteCandidatePreferences ¶
WithRouteCandidatePreferences attaches advisory routing candidate key ordering hints for the planner (design §12). prefs is copied; duplicate keys may appear but reordering treats first wins.
func WithSecureSessionTurn ¶
func WithSecureSessionTurn(ctx context.Context, t SecureSessionTurn) context.Context
WithSecureSessionTurn attaches validated session and turn ids for downstream attempt recording. A nil parent is treated as context.TODO so the result is always non-nil.
func WithSuppressedPluginIDs ¶
WithSuppressedPluginIDs attaches handler/plugin ids that must be skipped on this execution path (auxiliary loop guards). Matching is exact against handler ID() strings.
func WithViews ¶
WithViews returns a child context carrying v. String maps are copied so later mutation of the caller's maps does not affect stored snapshots. A nil parent is treated as context.TODO so the result is always non-nil.
func WithoutRouteCandidatePreferences ¶
WithoutRouteCandidatePreferences shadows any inherited advisory route hints for a child request. This is used when a private auxiliary call has an explicit selector and must not inherit primary request ordering authority.
Types ¶
type DetachedSession ¶
type DetachedSession struct {
ParentSessionID string
ParentALegID string
ParentTraceID string
ParentBranchBinding string
// AuxiliaryRole is trusted, content-free metadata for internal workload
// classification. It is never copied into a canonical call or used as
// session, route, or continuity authority.
AuxiliaryRole string
}
DetachedSession carries content-free parent lineage for one private auxiliary execution. Parent identifiers are correlation only; the child executor allocates its own A-leg and never uses these values as route or secure-session authority.
func DetachedSessionFromContext ¶
func DetachedSessionFromContext(ctx context.Context) (DetachedSession, bool)
DetachedSessionFromContext returns the trusted parent lineage, if ctx was marked for detached execution.
type SecureSessionTurn ¶
type SecureSessionTurn struct {
SessionID domain.SessionID
TurnID domain.TurnID
// Policy is the effective recording policy for this turn (transcript, audit, redaction).
Policy domain.PolicyMetadata
}
SecureSessionTurn carries validated secure-session identifiers for one prepared turn.
func SecureSessionTurnFromContext ¶
func SecureSessionTurnFromContext(ctx context.Context) (SecureSessionTurn, bool)
SecureSessionTurnFromContext returns the turn binding attached with WithSecureSessionTurn, if any.
type SecureSubmitViewsInput ¶
type SecureSubmitViewsInput struct {
TraceID string
ALeg b2bua.ALegRecord
Call lipapi.Call
HookAnnotations map[string]string
AuthoritativeSessionID string
TurnID string
ResumeEligible bool
PolicyLabels map[string]string
}
SecureSubmitViewsInput carries the parameters for ViewsFromSecureSubmit after [app.Manager.BeginTurn] and B2BUA A-leg fetch.
type SessionMode ¶
type SessionMode uint8
SessionMode identifies the trusted execution policy selected by core before an auxiliary call enters the executor. It is intentionally not part of the canonical Call or any frontend/wire contract.
const ( SessionModeNormal SessionMode = iota SessionModeDetached )
func SessionModeFromContext ¶
func SessionModeFromContext(ctx context.Context) (SessionMode, bool)
SessionModeFromContext returns the explicitly selected internal mode. The bool distinguishes the normal default from a trusted detached marker.
type Views ¶
type Views struct {
Principal execview.PrincipalView
Scope scope.PrincipalScopeView
Session session.SessionView
Attempt execview.AttemptView
Workspace workspace.WorkspaceView
Annotations map[string]string
}
Views bundles typed snapshots for one request (design §2, R3). Scope is the authoritative principal/scope snapshot; Principal is the legacy compatibility projection derived from it. Annotations carry lifecycle-only notes kept separate from trusted attribution (requirements 4.2, 4.3, 4.6, 5.1).
func FromContext ¶
FromContext returns the views attached with WithViews, if any. The returned Views is a deep copy of the stored snapshot so callers cannot mutate the stored scope, principal, session, workspace, or annotation slices/maps through the returned value (requirement 5.5).
func ViewsFromSecureSubmit ¶
func ViewsFromSecureSubmit(in SecureSubmitViewsInput) Views
ViewsFromSecureSubmit builds views after [app.Manager.BeginTurn] and B2BUA A-leg fetch. AuthoritativeSessionID and TurnID come from validated secure-session state; Call must not carry raw resume tokens.
func ViewsFromSubmit ¶
func ViewsFromSubmit(traceID string, aLeg b2bua.ALegRecord, call lipapi.Call, hookAnnotations map[string]string) Views
ViewsFromSubmit builds typed views after submit hooks and A-leg resolution (task 4). Principal is merged from transport auth in the executor when present; workspace is filled after workspace resolution (task 5.1). Attempt fields other than TraceID are filled when an attempt opens (later tasks).