binding

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 6, 2026 License: Apache-2.0 Imports: 31 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package binding adapts one existing binding.Binding into a coarse graph element. It lets the current gateway and benchmark oracle run through the graph kernel while finer elements replace the compatibility node.

Index

Constants

View Source
const SessionAdapterProfileFormatVersion uint64 = 1

Variables

This section is empty.

Functions

func SessionAdapterContract

func SessionAdapterContract() plugin.Contract

Types

type AdapterBoundary

type AdapterBoundary struct {
	Operation AdapterOperation     `json:"operation"`
	Boundary  string               `json:"boundary"`
	Direction ir.BoundaryDirection `json:"direction"`
	Type      element.Type         `json:"type"`
}

AdapterBoundary maps one stable gateway operation to one exact Graph IR boundary. Direction and Type are duplicated intentionally: they make the adapter contract reviewable without loading topology, then ValidateGraph proves that declaration is not stale.

type AdapterFactory

AdapterFactory binds one mounted graph to one client session. It must acquire graph ports synchronously and return only after the adapter is ready for Run; this lets NativeBinding start the output drainer before graph nodes can publish readiness or response events.

type AdapterOperation

type AdapterOperation string

AdapterOperation is one direction of the stable gateway/session boundary. A profile lists only operations it supports; absence is the exact, inspectable representation of ErrUnsupported.

const (
	AdapterInputUpdate         AdapterOperation = "gateway.input.update"
	AdapterInputAudio          AdapterOperation = "gateway.input.audio"
	AdapterInputVideo          AdapterOperation = "gateway.input.video"
	AdapterInputText           AdapterOperation = "gateway.input.text"
	AdapterInputToolResult     AdapterOperation = "gateway.input.tool_result"
	AdapterInputCommitAudio    AdapterOperation = "gateway.input.commit_audio"
	AdapterInputCreateResponse AdapterOperation = "gateway.input.create_response"
	AdapterInputCancel         AdapterOperation = "gateway.input.cancel"
	AdapterInputTruncate       AdapterOperation = "gateway.input.truncate"

	AdapterOutputTurnBegin   AdapterOperation = "gateway.output.turn_begin"
	AdapterOutputTurnEnd     AdapterOperation = "gateway.output.turn_end"
	AdapterOutputActivity    AdapterOperation = "gateway.output.activity"
	AdapterOutputTranscript  AdapterOperation = "gateway.output.transcript"
	AdapterOutputObservation AdapterOperation = "gateway.output.observation"
	AdapterOutputSpeechBegin AdapterOperation = "gateway.output.speech_begin"
	AdapterOutputSpeechText  AdapterOperation = "gateway.output.speech_text"
	AdapterOutputSpeechAudio AdapterOperation = "gateway.output.speech_audio"
	AdapterOutputSpeechEnd   AdapterOperation = "gateway.output.speech_end"
	AdapterOutputToolCalls   AdapterOperation = "gateway.output.tool_calls"
	AdapterOutputFailed      AdapterOperation = "gateway.output.failed"
	AdapterOutputDebug       AdapterOperation = "gateway.output.debug"
)

type AdapterRegistration

type AdapterRegistration struct {
	Reference string
	Artifact  inspect.ArtifactIdentity
	Factory   AdapterFactory
}

AdapterRegistration selects the exact executable that realizes a frozen adapter profile. Factory is process-private; Reference and Artifact are the complete public deployment evidence.

func (AdapterRegistration) Validate

func (registration AdapterRegistration) Validate() error

Validate verifies the complete resource-free identity and executable registration. It does not invoke Factory. Catalogs use this method to reject malformed adapter contributions before selecting a graph-specific adapter.

type Binding

type Binding struct {
	// contains filtered or unexported fields
}

Binding preserves the existing external session interface while mounting every session through immutable Graph IR.

func New

func New(underlying legacy.Binding) (*Binding, error)

func NewWithConfig

func NewWithConfig(underlying legacy.Binding, config Config) (*Binding, error)

func (*Binding) Capabilities

func (binding *Binding) Capabilities() legacy.Capabilities

func (*Binding) Graph

func (binding *Binding) Graph() ir.Graph

func (*Binding) Name

func (binding *Binding) Name() string

func (*Binding) Ownership

func (binding *Binding) Ownership() legacy.Ownership

func (*Binding) Start

func (binding *Binding) Start(ctx context.Context, options legacy.Options) (legacy.Runtime, error)

type Config

type Config struct {
	Inspection graphruntime.InspectionConfig
	// ImplementationArtifact is the immutable deployment identity of the
	// compatibility adapter/factory in this process. Trace recording requires
	// this trusted registration evidence; a descriptor digest alone identifies
	// an interface, not the executable material implementing it.
	ImplementationArtifact *inspect.ArtifactIdentity
	TraceRecording         *TraceRecordingConfig
}

Config keeps live-inspection retention and trace recording explicit. A nil TraceRecording disables the recorder and its capture/allocation overhead.

type MountDependencyFactory

type MountDependencyFactory func(
	context.Context, legacy.Options,
) ([]graphruntime.PreparedMountDependency, error)

MountDependencyFactory supplies only per-session service objects whose names, artifacts, and mount scope were already frozen into the prepared graph plan. It cannot replace process services, implementations, secret providers, or dependency identities.

type NativeBinding

type NativeBinding struct {
	// contains filtered or unexported fields
}

NativeBinding creates one independently mounted graph per Realtime session. It is the inverse of Binding: Binding places a legacy runtime behind a coarse compatibility node, while NativeBinding presents a fine-grained graph to the unchanged protocol gateway.

func NewNative

func NewNative(config NativeConfig) (*NativeBinding, error)

NewNative validates and freezes the process-level graph session contract. It performs no provider discovery, secret resolution, or resource mounting; those operations remain behind Start and graph/assembly's exact preflight.

func (*NativeBinding) Graph

func (binding *NativeBinding) Graph() ir.Graph

func (*NativeBinding) Name

func (binding *NativeBinding) Name() string

func (*NativeBinding) SessionAdapterProfile

func (binding *NativeBinding) SessionAdapterProfile() SessionAdapterProfile

SessionAdapterProfile is the graph-native protocol contract consumed by the gateway. Returning a defensive clone keeps the binding's mounted boundary selection immutable without recreating legacy Ownership/Capabilities methods.

func (*NativeBinding) Start

func (binding *NativeBinding) Start(
	ctx context.Context, options legacy.Options,
) (legacy.Runtime, error)

type NativeConfig

type NativeConfig struct {
	Plan *graphconfig.Plan
	// Catalog and SecretCatalog are the complete resource-free process
	// inventory validated when the binding is constructed, before a listener
	// can accept traffic.
	Catalog       graphassembly.Catalog
	SecretCatalog *graphsecret.Document

	MountDependencies MountDependencyFactory
	AdapterProfile    SessionAdapterProfile
	Adapter           AdapterRegistration

	Inspection      graphruntime.InspectionConfig
	ShutdownTimeout time.Duration
	TraceRecording  *TraceRecordingConfig
}

NativeConfig describes a graph-native binding. Plan and AdapterProfile are immutable and shared by sessions; Catalog is selected and preflighted once; MountDependencies may supply only the exact session-scoped service values that preflight deliberately left unacquired.

type NativeRuntime

type NativeRuntime struct {
	// contains filtered or unexported fields
}

NativeRuntime supervises one adapter and one mounted graph as a single session. The management plane observes the mounted graph directly; protocol calls remain delegated to the boundary adapter.

func (*NativeRuntime) Audio

func (runtime *NativeRuntime) Audio(ctx context.Context, frame perception.Frame) error

func (*NativeRuntime) Cancel

func (runtime *NativeRuntime) Cancel(ctx context.Context, reason string) error

func (*NativeRuntime) Close

func (runtime *NativeRuntime) Close(ctx context.Context, cause error) error

func (*NativeRuntime) CommitAudio

func (runtime *NativeRuntime) CommitAudio(ctx context.Context) error

func (*NativeRuntime) CreateResponse

func (runtime *NativeRuntime) CreateResponse(ctx context.Context) error

func (*NativeRuntime) Done

func (runtime *NativeRuntime) Done() <-chan struct{}

func (*NativeRuntime) Graph

func (runtime *NativeRuntime) Graph() ir.Graph

func (*NativeRuntime) Live

func (runtime *NativeRuntime) Live() inspect.Live

func (*NativeRuntime) RecordedTrace

func (runtime *NativeRuntime) RecordedTrace() (inspect.LiveTrace, error)

func (*NativeRuntime) Status

func (runtime *NativeRuntime) Status() legacy.Status

func (*NativeRuntime) Text

func (runtime *NativeRuntime) Text(ctx context.Context, input legacy.TextInput) error

func (*NativeRuntime) ToolResult

func (runtime *NativeRuntime) ToolResult(ctx context.Context, result trajectory.ToolResult) error

func (*NativeRuntime) Trajectory

func (runtime *NativeRuntime) Trajectory() trajectory.Snapshot

func (*NativeRuntime) Truncate

func (runtime *NativeRuntime) Truncate(ctx context.Context, truncation legacy.Truncation) error

func (*NativeRuntime) Update

func (runtime *NativeRuntime) Update(ctx context.Context, settings legacy.Settings) error

func (*NativeRuntime) Video

func (runtime *NativeRuntime) Video(ctx context.Context, frame perception.Frame) error

type Runtime

type Runtime struct {
	// contains filtered or unexported fields
}

Runtime is the current management-plane session interface backed by graph observation/action channels.

func (*Runtime) Audio

func (runtime *Runtime) Audio(ctx context.Context, frame perception.Frame) error

func (*Runtime) Cancel

func (runtime *Runtime) Cancel(ctx context.Context, reason string) error

func (*Runtime) Close

func (runtime *Runtime) Close(ctx context.Context, cause error) error

func (*Runtime) CommitAudio

func (runtime *Runtime) CommitAudio(ctx context.Context) error

func (*Runtime) CreateResponse

func (runtime *Runtime) CreateResponse(ctx context.Context) error

func (*Runtime) Graph

func (runtime *Runtime) Graph() ir.Graph

func (*Runtime) Live

func (runtime *Runtime) Live() inspect.Live

func (*Runtime) RecordedTrace

func (runtime *Runtime) RecordedTrace() (inspect.LiveTrace, error)

RecordedTrace exposes the graph runtime's bounded payload-free recorder. It fails closed when the binding was created without explicit recording.

func (*Runtime) Status

func (runtime *Runtime) Status() legacy.Status

func (*Runtime) Text

func (runtime *Runtime) Text(ctx context.Context, input legacy.TextInput) error

func (*Runtime) ToolResult

func (runtime *Runtime) ToolResult(ctx context.Context, result trajectory.ToolResult) error

func (*Runtime) Trajectory

func (runtime *Runtime) Trajectory() trajectory.Snapshot

func (*Runtime) Truncate

func (runtime *Runtime) Truncate(ctx context.Context, truncation legacy.Truncation) error

func (*Runtime) Update

func (runtime *Runtime) Update(ctx context.Context, settings legacy.Settings) error

func (*Runtime) Video

func (runtime *Runtime) Video(ctx context.Context, frame perception.Frame) error

type SessionAdapter

SessionAdapter is the deliberately small seam between the stable Realtime session API and a graph's exported typed boundaries. Implementations contain protocol-to-boundary translation only; conversation policy belongs in graph elements. Run drains graph outputs until its context is cancelled.

NativeRuntime keeps the gateway's legacy.Runtime surface stable. The adapter deliberately excludes Status: graph identity comes from the immutable plan, while live node, capability, deployment, and adapter evidence comes from the mounted graph's authenticated inspection snapshot. An adapter must not manufacture a competing topology/role projection or mount a second graph.

type SessionAdapterProfile

type SessionAdapterProfile struct {
	FormatVersion     uint64              `json:"format_version"`
	Name              string              `json:"name"`
	Revision          uint64              `json:"revision"`
	GraphFingerprint  string              `json:"graph_fingerprint"`
	Contract          plugin.Contract     `json:"contract"`
	Ownership         legacy.Ownership    `json:"ownership"`
	Capabilities      legacy.Capabilities `json:"capabilities"`
	Boundaries        []AdapterBoundary   `json:"boundaries"`
	BoundaryMapDigest string              `json:"boundary_map_digest"`
	ProjectionDigest  string              `json:"projection_digest"`
	Fingerprint       string              `json:"fingerprint"`
}

SessionAdapterProfile is the immutable protocol-to-graph projection. Name, ownership, and capabilities are derived from this fingerprinted artifact; NativeConfig cannot assert independent values that drift from it.

func FreezeSessionAdapterProfile

func FreezeSessionAdapterProfile(source SessionAdapterProfile) (SessionAdapterProfile, error)

func (SessionAdapterProfile) Clone

func (SessionAdapterProfile) Validate

func (profile SessionAdapterProfile) Validate() error

func (SessionAdapterProfile) ValidateGraph

func (profile SessionAdapterProfile) ValidateGraph(graph ir.Graph) error

type TraceRecordingConfig

type TraceRecordingConfig struct {
	Limits           inspect.TraceLimits
	MaxRetainedBytes int
	CaptureInterval  time.Duration
}

TraceRecordingConfig contains only reusable bounds. Start generates a fresh per-session correlation key; callers cannot accidentally reuse one session's pseudonymization authority in another.

Directories

Path Synopsis
Package adaptivevideo adapts the stable Realtime video and observation operations to the typed boundaries exported by a graph-native adaptive video composition.
Package adaptivevideo adapts the stable Realtime video and observation operations to the typed boundaries exported by a graph-native adaptive video composition.
Package realtimecu adapts the stable OpenAI Realtime-compatible session surface to the locked graph-native Realtime-CU authority graph.
Package realtimecu adapts the stable OpenAI Realtime-compatible session surface to the locked graph-native Realtime-CU authority graph.
Package scenarioconversation adapts the stable OpenAI Realtime-compatible session surface to a locked, fine-grained conversational graph.
Package scenarioconversation adapts the stable OpenAI Realtime-compatible session surface to a locked, fine-grained conversational graph.

Jump to

Keyboard shortcuts

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