Documentation
¶
Overview ¶
Package execbackend defines the executor-consumed outbound seam for opening canonical backend attempts (introduce-hexagonal-architecture). Concrete backend plugins and composition roots construct Backend values; the executor consumes them without importing provider or transport packages.
Package execbackend Backend execution lifecycle and capability contracts.
Index ¶
- Constants
- func CloneBackendPrefixes(be Backend) []string
- func DrainPromptCacheObservations(stream lipapi.ManagedEventStream) []promptcache.Observation
- func EffectiveCaps(ctx context.Context, be Backend, call lipapi.Call, ...) lipapi.BackendCaps
- func EffectiveDialectSupport(ctx context.Context, be Backend, call lipapi.Call, ...) lipapi.DialectSupport
- func EffectivePromptCacheProfile(ctx context.Context, be Backend, call lipapi.Call, ...) promptcache.Profile
- func EffectiveReplaySupport(ctx context.Context, be Backend, call lipapi.Call, ...) lipapi.ReasoningReplaySupport
- func EffectiveTransportCaps(ctx context.Context, be Backend, call lipapi.Call, ...) lipapi.BackendTransportCaps
- func EffectiveWireDomainSupport(ctx context.Context, be Backend, facts largebody.WireDomainFacts) largebody.WireDomainSupport
- func EffectiveWireOpen(ctx context.Context, be Backend, req largebody.WireOpenRequest) (lipapi.ManagedEventStream, error)
- func EffectiveWireRequestSupport(ctx context.Context, be Backend, facts largebody.WireRequestFacts, ...) largebody.WireRequestSupport
- func IgnoresClampViaCodexUnsupportedGenParams(call lipapi.Call) bool
- type Backend
- type BillingFinalizationInput
- type BillingFinalizationResult
- type CapabilityPreflight
- type EconomicEvidence
- type EconomicEvidenceSource
- type WireBackend
- type WireOpener
Constants ¶
const CodexIgnoreUnsupportedGenParamsExt = "openai_codex.ignore_unsupported_gen_params"
CodexIgnoreUnsupportedGenParamsExt is the canonical-call extension key (bool). When true, temperature, top_p, and max_output_tokens are dropped instead of failing payload build; used by codex-client-compat for OpenCode and similar clients.
Variables ¶
This section is empty.
Functions ¶
func CloneBackendPrefixes ¶
func DrainPromptCacheObservations ¶
func DrainPromptCacheObservations(stream lipapi.ManagedEventStream) []promptcache.Observation
DrainPromptCacheObservations drains only the optional host-only sideband. Implementations decide whether a successful terminal committed the buffer.
func EffectiveCaps ¶
func EffectiveCaps( ctx context.Context, be Backend, call lipapi.Call, cand routing.AttemptCandidate, ) lipapi.BackendCaps
EffectiveCaps returns the caps used for negotiation for one backend and candidate.
func EffectiveDialectSupport ¶
func EffectiveDialectSupport( ctx context.Context, be Backend, call lipapi.Call, cand routing.AttemptCandidate, ) lipapi.DialectSupport
func EffectivePromptCacheProfile ¶
func EffectivePromptCacheProfile(ctx context.Context, be Backend, call lipapi.Call, cand routing.AttemptCandidate) promptcache.Profile
EffectivePromptCacheProfile resolves capability for the selected effective model/candidate. A nil resolver is intentionally observation/control unknown.
func EffectiveReplaySupport ¶
func EffectiveReplaySupport( ctx context.Context, be Backend, call lipapi.Call, cand routing.AttemptCandidate, ) lipapi.ReasoningReplaySupport
func EffectiveTransportCaps ¶
func EffectiveTransportCaps( ctx context.Context, be Backend, call lipapi.Call, cand routing.AttemptCandidate, ) lipapi.BackendTransportCaps
EffectiveTransportCaps returns the transport caps used for negotiation for one backend and candidate.
func EffectiveWireDomainSupport ¶
func EffectiveWireDomainSupport( ctx context.Context, be Backend, facts largebody.WireDomainFacts, ) largebody.WireDomainSupport
EffectiveWireDomainSupport resolves pure late-route domain wire compatibility (Requirement 7, design section 9).
Rules (Task 8.1): - Nil resolver / unknown => canonical (Compatible: false). - Universal domain requires AnyAcceptedModel; otherwise fails closed to canonical. - Pure, no I/O.
func EffectiveWireOpen ¶
func EffectiveWireOpen(ctx context.Context, be Backend, req largebody.WireOpenRequest) (lipapi.ManagedEventStream, error)
EffectiveWireOpen opens a wire attempt on be, using OpenWire or WireBackend (design section 9, Requirement 8).
func EffectiveWireRequestSupport ¶
func EffectiveWireRequestSupport( ctx context.Context, be Backend, facts largebody.WireRequestFacts, cand routing.AttemptCandidate, ) largebody.WireRequestSupport
EffectiveWireRequestSupport resolves pure exact wire compatibility for one candidate (design section 9, Requirements 8, 9).
Rules (Task 8.1):
- Nil resolver / unknown => canonical (Compatible: false).
- Output can declare rewrite need only if supplied rewrite semantics support it; declaring NeedsModelRewrite when facts.Rewrite does not support it fails closed to canonical.
- Pure, no I/O.
func IgnoresClampViaCodexUnsupportedGenParams ¶
IgnoresClampViaCodexUnsupportedGenParams returns true when the codex-client-compat extension requests dropping unsupported generation parameters including max output.
Types ¶
type Backend ¶
type Backend struct {
Caps lipapi.BackendCaps
// ResolveCaps, when set, supplies model/candidate-aware capabilities; otherwise Caps is used.
ResolveCaps func(ctx context.Context, call lipapi.Call, cand routing.AttemptCandidate) lipapi.BackendCaps
// ResolveWireCaps, when set, supplies candidate/model-aware capabilities for wire fast-path evaluation without requiring a synthesized lipapi.Call.
ResolveWireCaps func(ctx context.Context, cand routing.AttemptCandidate) lipapi.BackendCaps
TransportCaps lipapi.BackendTransportCaps
// ResolveTransportCaps, when set, supplies model/candidate-aware transport capabilities; otherwise TransportCaps is used.
ResolveTransportCaps func(ctx context.Context, call lipapi.Call, cand routing.AttemptCandidate) lipapi.BackendTransportCaps
Open func(ctx context.Context, call lipapi.Call, cand routing.AttemptCandidate) (lipapi.ManagedEventStream, error)
ModelInventory modelinventory.Provider
// BackendPrefixes names this connector kind for model-inventory discovery. Prefixes may be
// shared by instances of the same backend kind, but different backend kinds must not claim the
// same prefix. Canonical model IDs must not use the qualifier form "<prefix>:<canonical-id>".
BackendPrefixes []string
// ReplaySupport is the static historical-reasoning dialect profile for this backend.
// Prefer ResolveReplaySupport when support depends on candidate/model.
ReplaySupport lipapi.ReasoningReplaySupport
// ResolveReplaySupport, when set, supplies candidate/model-aware replay support; otherwise ReplaySupport is used.
ResolveReplaySupport func(ctx context.Context, call lipapi.Call, cand routing.AttemptCandidate) lipapi.ReasoningReplaySupport
// DialectSupport declares exact item/reasoning/compaction/extension dialects this backend satisfies.
DialectSupport lipapi.DialectSupport
// ResolveDialectSupport, when set, supplies candidate/model-aware dialect support; otherwise DialectSupport is used.
ResolveDialectSupport func(ctx context.Context, call lipapi.Call, cand routing.AttemptCandidate) lipapi.DialectSupport
// ResolvePromptCacheProfile supplies model/candidate-aware provider-neutral
// residency capability. nil means observation/control unsupported.
ResolvePromptCacheProfile func(context.Context, lipapi.Call, routing.AttemptCandidate) promptcache.Profile
// RenewPromptCache and ReleasePromptCache are direct operations on an
// already-issued backend-owned handle. They never receive a selector and
// must not invoke ordinary route selection or inference.
RenewPromptCache func(context.Context, promptcache.RenewRequest) (promptcache.RenewResponse, error)
ReleasePromptCache func(context.Context, promptcache.ReleaseRequest) error
BillingFinalizationSupported bool
FinalizeBilling func(ctx context.Context, in BillingFinalizationInput) (lipapi.Event, error)
// FinalizeBillingV2 preserves host-only economic observations returned by
// an executable connector. FinalizeBilling remains the compatibility
// projection consumed by legacy authority paths.
FinalizeBillingV2 func(ctx context.Context, in BillingFinalizationInput) (BillingFinalizationResult, error)
// EnforcesMaxOutputTokens reports whether this backend serializes a
// non-nil/positive MaxOutputTokens onto the provider wire so an authority
// spend-cap clamp actually binds. Zero value (false) is fail-closed: the
// executor excludes candidates that cannot represent the clamp rather than
// opening with an unenforced limit. Backends that drop or omit the option
// (Codex, ACP family, OpenCode, local-stub) must leave this false.
EnforcesMaxOutputTokens bool
// IgnoresAuthorityMaxOutputTokensClamp, when set, reports call-specific reasons
// the backend drops MaxOutputTokens despite EnforcesMaxOutputTokens.
IgnoresAuthorityMaxOutputTokensClamp func(call lipapi.Call) bool
ProviderCounter accountingapp.ProviderCounter
// LocalCounter, when set, supplies instance-local tokenizer counting for
// compatible modes configured with an explicit tokenizer override.
LocalCounter accountingapp.LocalCounter
// TokenizerID is the bounded configured local tokenizer identifier exposed
// for diagnostics and accounting when LocalCounter is attached.
TokenizerID string
// Close, when non-nil, releases backend-owned persistent runtime resources
// (for example a companion process). nil means the backend owns no such
// resources or cleans them through individual streams. Callers treat a
// non-nil callback as idempotent; it is not a request-cancellation API.
Close func() error
// Optional generation-local lifecycle / transport seams. nil means unsupported.
// Composition roots adapt these into candidate prepare/rollback ownership;
// legacy backends that only set Close remain fully compatible.
Start func(context.Context) error
Stop func(context.Context) error
CleanupIdleTransports func(context.Context) error
// PreflightCapability, when set, is an explicit non-billable readiness probe.
// It is never invoked automatically as a publication gate.
PreflightCapability func(context.Context) (CapabilityPreflight, error)
// ResolveWireRequest, when set, supplies candidate-aware pure exact wire
// capability proof for one candidate (design section 9, Requirements 8, 9).
// nil means wire execution unsupported (canonical fallback).
ResolveWireRequest func(ctx context.Context, facts largebody.WireRequestFacts, cand routing.AttemptCandidate) largebody.WireRequestSupport
// ResolveWireDomain, when set, supplies pure late-route domain wire
// capability proof (Requirement 7, design section 9).
// nil means wire execution unsupported (canonical fallback).
ResolveWireDomain func(ctx context.Context, facts largebody.WireDomainFacts) largebody.WireDomainSupport
// WireBackend, when non-nil, provides the optional wire capability interface.
WireBackend largebody.WireBackend
// OpenWire, when set, opens a backend attempt directly from a wire request
// without constructing a lipapi.Call (design section 9, Requirement 8).
OpenWire func(ctx context.Context, req largebody.WireOpenRequest) (lipapi.ManagedEventStream, error)
}
Backend opens a canonical event stream for one route candidate. Client operation and delivery metadata are carried on lipapi.Call.Invocation.
func (Backend) AsWireBackend ¶
func (be Backend) AsWireBackend() largebody.WireBackend
AsWireBackend adapts be into largebody.WireBackend.
func (Backend) AsWireOpener ¶
func (be Backend) AsWireOpener() largebody.WireOpener
AsWireOpener adapts be into largebody.WireOpener if supported.
type BillingFinalizationResult ¶
type BillingFinalizationResult struct {
Usage lipapi.Event
EconomicEvidence []EconomicEvidence
}
BillingFinalizationResult keeps the canonical compatibility usage event and the additive host-only V2 observations from one idempotent finalizer call. The executor owns terminal capture; no finalizer result is client content.
type CapabilityPreflight ¶
CapabilityPreflight is an optional non-billable backend readiness probe result. Billable must be false when consumed by candidate composition (req 8.11).
type EconomicEvidence ¶
type EconomicEvidence struct {
Observation metering.Observation
Coverage string
CoverageReason string
}
EconomicEvidence is the neutral core handoff for one validated connector observation. Coverage is transport metadata retained through the adapter boundary; Observation is the canonical metering model consumed by core. Keeping this carrier in execbackend prevents core from importing gRPC or the executable backend-plugin wire package.
type EconomicEvidenceSource ¶
type EconomicEvidenceSource interface {
DrainEconomicEvidenceRecords() []EconomicEvidence
}
EconomicEvidenceSource is the narrow host-to-core drain seam for the neutral finalizer/stream evidence carrier. It is intentionally separate from the executable connector ABI and has no transport dependency.
type WireBackend ¶
type WireBackend = largebody.WireBackend
WireBackend is the optional internal interface implemented by backends supporting direct wire execution (design section 9, Requirements 7, 8, 9).
type WireOpener ¶
type WireOpener = largebody.WireOpener
WireOpener is the optional internal interface implemented by backends supporting opening direct wire attempts (design section 9, Requirement 8).