Documentation
¶
Overview ¶
Package adapter is the anti-corruption layer between public backendplugin DTOs and core-consumed execbackend.Backend / lipapi streams.
It must not import provider SDKs. internal/core must not import this package's processhost/grpc dependencies transitively through core packages.
Index ¶
- func Build(session ExecuteSession, profile backendplugin.ResolvedProfile, opt Options) *processhost.BuildResult
- func InvocationFromCall(call lipapi.Call, cand routing.AttemptCandidate, neg backendplugin.Negotiation) (backendplugin.Invocation, error)
- type CancellationProgress
- type ClassifiedError
- type ExecuteFailureError
- type ExecuteFailureKind
- type ExecuteSession
- type GRPCSession
- type NegotiatedSession
- type OptionalBillingFinalizer
- type OptionalPromptCacheController
- type OptionalTokenCounter
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Build ¶
func Build(session ExecuteSession, profile backendplugin.ResolvedProfile, opt Options) *processhost.BuildResult
Build constructs a composition-owned backend from a configured plugin session.
func InvocationFromCall ¶
func InvocationFromCall(call lipapi.Call, cand routing.AttemptCandidate, neg backendplugin.Negotiation) (backendplugin.Invocation, error)
InvocationFromCall maps a core call into the public plugin Invocation DTO.
Types ¶
type CancellationProgress ¶
type CancellationProgress struct {
Requested bool
Cause lipapi.CancelCause
EffectiveDeadline time.Time
OutcomeSeen bool
OutcomeAcknowledged bool
OutcomeMode backendplugin.CancelMode
OutcomeReason backendplugin.CancelReason
OutcomeDetail string
ForcedAbort bool
TerminalSeen bool
}
type ClassifiedError ¶
ClassifiedError is a sanitized plugin/transport error for core ownership.
func (*ClassifiedError) Error ¶
func (e *ClassifiedError) Error() string
func (*ClassifiedError) Unwrap ¶
func (e *ClassifiedError) Unwrap() error
Unwrap exposes lipapi.ErrRecoverablePreOutput for pre-output retryable failures so the existing executor seam can swallow/failover without importing adapter.
type ExecuteFailureError ¶
type ExecuteFailureError struct {
Kind ExecuteFailureKind
Err error
OutputCommitted bool
}
ExecuteFailureError is the classified Execute boundary error.
func ClassifyExecuteError ¶
func ClassifyExecuteError(err error, committed bool) *ExecuteFailureError
ClassifyExecuteError classifies an ExecuteSession error at the openStream boundary.
func ProtocolViolation ¶
func ProtocolViolation(err error) *ExecuteFailureError
ProtocolViolation wraps err as an ABI protocol violation.
func TransportDeath ¶
func TransportDeath(err error) *ExecuteFailureError
TransportDeath wraps err as transport/process death.
func (*ExecuteFailureError) Error ¶
func (e *ExecuteFailureError) Error() string
func (*ExecuteFailureError) InvalidatesGeneration ¶
func (e *ExecuteFailureError) InvalidatesGeneration() bool
InvalidatesGeneration reports whether the failure requires generation invalidation.
func (*ExecuteFailureError) ToClassifiedError ¶
func (e *ExecuteFailureError) ToClassifiedError() *ClassifiedError
ToClassifiedError maps the failure to a sanitized ClassifiedError for core.
func (*ExecuteFailureError) Unwrap ¶
func (e *ExecuteFailureError) Unwrap() error
type ExecuteFailureKind ¶
type ExecuteFailureKind int
ExecuteFailureKind is the stable ExecuteSession failure classification.
const ( // ExecuteFailureProvider is a provider-declared error (terminal PluginError). ExecuteFailureProvider ExecuteFailureKind = iota + 1 // ExecuteFailureCanceled is host/context or deadline cancellation. ExecuteFailureCanceled // ExecuteFailureTransportDeath is transport loss or process death. ExecuteFailureTransportDeath // ExecuteFailureProtocolViolation is an ABI/stream protocol violation. ExecuteFailureProtocolViolation )
type ExecuteSession ¶
type ExecuteSession interface {
Resolve(ctx context.Context, modelID *string) (backendplugin.ResolvedProfile, error)
ListModels(ctx context.Context, maxModels uint32) (backendplugin.ListModelsResponse, error)
Execute(stream backendplugin.ExecuteStream) error
Close(ctx context.Context) error
}
ExecuteSession is the host-facing configured plugin instance seam.
type GRPCSession ¶
type GRPCSession = publichost.Session
GRPCSession is retained as an internal compatibility alias. The supported implementation and lifecycle authority live in the public host package.
func DialConfiguredSession ¶
func DialConfiguredSession( ctx context.Context, conn net.Conn, instanceID, factoryKind string, configYAML []byte, secrets backendplugin.SecretBundle, policy backendplugin.RuntimePolicy, ) (*GRPCSession, backendplugin.ResolvedProfile, error)
DialConfiguredSession negotiates and configures a GRPCSession over an already peer-authenticated connection. It is the default DialAndConfigure path for discovered host-backed factories.
type NegotiatedSession ¶
type NegotiatedSession interface {
ExecuteSession
Negotiation() backendplugin.Negotiation
}
NegotiatedSession exposes the protocol negotiation outcome bound at dial time.
type OptionalBillingFinalizer ¶
type OptionalBillingFinalizer interface {
FinalizeBilling(ctx context.Context, req backendplugin.FinalizeBillingRequest) (backendplugin.FinalizeBillingResponse, error)
}
OptionalBillingFinalizer is satisfied when billing finalization is advertised.
type OptionalPromptCacheController ¶
type OptionalPromptCacheController interface {
RenewPromptCache(context.Context, promptcache.RenewRequest) (promptcache.RenewResponse, error)
ReleasePromptCache(context.Context, promptcache.ReleaseRequest) error
}
OptionalPromptCacheController is satisfied only when the connector negotiated and implemented the dedicated maintenance plane.
type OptionalTokenCounter ¶
type OptionalTokenCounter interface {
CountTokens(ctx context.Context, req backendplugin.CountTokensRequest) (backendplugin.CountTokensResponse, error)
}
OptionalTokenCounter is satisfied when counting is advertised.
type Options ¶
type Options struct {
MetadataTimeout time.Duration
MaxPendingEvents int
MaxStreamFrame int
MaxStderrBytes int
CancelTimeout time.Duration
DisableGRPCRetry bool
RoutePrefixes []string
InstanceID string
EnforcesMaxOutput bool
Stderr io.Reader
InvalidateGeneration func()
Negotiation backendplugin.Negotiation
}
Options configures adapter deadlines and stream bounds.