model

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 24 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 model implements a graph-native process/remote model boundary.

The element is deliberately not an interaction policy or an architecture preset. It forwards exactly the descriptor ports selected by graph topology over a protocol-v4 session, confirms the live descriptor and capability identities, and preserves envelope timing/correlation metadata. Omni, duplex, and upstream are therefore graph arrangements over the same element rather than runtime species.

Index

Constants

View Source
const (
	DeploymentRegistryService = "model.external.deployments"
	PayloadCodecService       = "model.external.payload-codec"
	ConfigSchema              = "schema://openrealtime/model/external-config/v1"
)

Variables

This section is empty.

Functions

func ActivityType

func ActivityType() element.Type

func AudioInputType

func AudioInputType() element.Type

Public type helpers support gateways and adapters without exporting mutable package-level Type values.

func CancelType

func CancelType() element.Type

func CommitType

func CommitType() element.Type

func ContextType

func ContextType() element.Type

func FactoryRegistrations

func FactoryRegistrations() ([]graphruntime.FactoryRegistration, error)

func GenerateType

func GenerateType() element.Type

func InteractionActType

func InteractionActType() element.Type

func InteractionType

func InteractionType() element.Type

func NativeStateType

func NativeStateType() element.Type

func OutcomeType

func OutcomeType() element.Type

func PreparedAudioType

func PreparedAudioType() element.Type

func PreparedTextType

func PreparedTextType() element.Type

func RegisterDescriptor

func RegisterDescriptor(catalog *resolve.Catalog) error

RegisterDescriptor and RegisterFactory are isolated integration hooks. The repository-wide catalog intentionally remains untouched in this slice.

func RegisterFactory

func RegisterFactory(registry *graphruntime.Registry) error

func ResultType

func ResultType() element.Type

func StandardDescriptor

func StandardDescriptor() element.Descriptor

StandardDescriptor is the capability superset used by the initial reference graphs. Every port is optional at the descriptor level: the mounted graph selects a subset, and the live handshake must prove every selected port. This avoids manufacturing one binding package per capability combination while preserving startup refusal for unavailable connections.

func TextInputType

func TextInputType() element.Type

func TickType

func TickType() element.Type

func ToolProposalType

func ToolProposalType() element.Type

func ToolResultType

func ToolResultType() element.Type

func ToolsType

func ToolsType() element.Type

func TranscriptType

func TranscriptType() element.Type

func TruncateType

func TruncateType() element.Type

func VideoInputType

func VideoInputType() element.Type

Types

type BinaryPayloadSource

type BinaryPayloadSource interface{ BinaryPayload() []byte }

type Bootstrap

type Bootstrap struct {
	Deployments *DeploymentRegistry
	Codec       *JSONCodec
}

Bootstrap is the deployment-facing owner of external-model dialers and the default strict payload codec. It keeps transport credentials/configuration in services rather than graph values.

func NewBootstrap

func NewBootstrap() *Bootstrap

func (*Bootstrap) Install

func (bootstrap *Bootstrap) Install(services *graphruntime.ServiceSet) error

Install publishes both required services together. Existing registrations are refused so bootstrap cannot silently replace live deployment authority.

func (*Bootstrap) RegisterClient

func (bootstrap *Bootstrap) RegisterClient(reference string, config sidecar.Config) error

RegisterClient installs the concrete child-process/socket sidecar dialer. Remote provider adapters use RegisterDialer with their own Session.

func (*Bootstrap) RegisterDialer

func (bootstrap *Bootstrap) RegisterDialer(reference string, dialer Dialer) error

type Config

type Config struct {
	Deployment           string                          `json:"deployment"`
	Settings             json.RawMessage                 `json:"settings,omitempty"`
	RequiredCapabilities []sidecar.CapabilityRequirement `json:"required_capabilities,omitempty"`
	PortFormats          map[string][]sidecar.WireFormat `json:"port_formats,omitempty"`
}

type DeploymentRegistry

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

DeploymentRegistry resolves symbolic node values to deployment-owned connection details and credentials. Those details never enter Graph IR.

func NewDeploymentRegistry

func NewDeploymentRegistry() *DeploymentRegistry

func (*DeploymentRegistry) Register

func (registry *DeploymentRegistry) Register(reference string, dial Dialer) error

type Dialer

type Dialer func(context.Context, sidecar.Message) (Session, error)

func ClientDialer

func ClientDialer(config sidecar.Config) Dialer

ClientDialer adapts the repository's process/socket sidecar client. Remote Realtime adapters implement Dialer directly and therefore use the same graph contract and attestation path without pretending to be a binding.

type EncodedPayload

type EncodedPayload struct {
	JSON   json.RawMessage
	Binary []byte
	Media  *sidecar.MediaFrameMetadata
}

EncodedPayload is the complete language-neutral body of one element frame. JSON, binary data, and authenticated media metadata are kept together so an adapter cannot accidentally derive inconsistent wire evidence in two calls.

type Factory

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

Factory may wrap any descriptor that declares the external-model config schema and services. The zero value supplies StandardDescriptor.

func NewFactory

func NewFactory(descriptor element.Descriptor) (Factory, error)

func (Factory) Descriptor

func (factory Factory) Descriptor() element.Descriptor

func (Factory) Mount

func (factory Factory) Mount(
	_ context.Context, mount element.MountContext,
) (element.Runnable, error)

func (Factory) ValidateConfig

func (factory Factory) ValidateConfig(source json.RawMessage) error

type JSONCodec

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

JSONCodec provides deterministic strict JSON transport and optional exact Go reconstruction. It owns returned buffers and is safe for concurrent use.

func NewJSONCodec

func NewJSONCodec() *JSONCodec

NewJSONCodec returns an empty codec. NewStandardJSONCodec installs the repository's graph-native mappings for production use.

func NewStandardJSONCodec

func NewStandardJSONCodec() *JSONCodec

NewStandardJSONCodec returns the production codec for graph-native model ports whose Go representation is established in this repository. Unknown extension types remain explicitly opaque and may be registered by the deployment before installation.

func (*JSONCodec) Decode

func (codec *JSONCodec) Decode(valueType element.Type, encoded EncodedPayload) (any, error)

func (*JSONCodec) Encode

func (codec *JSONCodec) Encode(valueType element.Type, payload any) (EncodedPayload, error)

func (*JSONCodec) Register

func (codec *JSONCodec) Register(valueType element.Type, factory PayloadFactory) error

func (*JSONCodec) RegisterAdapter

func (codec *JSONCodec) RegisterAdapter(valueType element.Type, adapter PayloadAdapter) error

func (*JSONCodec) Registered

func (codec *JSONCodec) Registered(valueType element.Type) bool

Registered is retained as a readable alias for deployment code that wants to inspect the immutable codec registry before installing it as a service.

func (*JSONCodec) Supports

func (codec *JSONCodec) Supports(valueType element.Type) bool

type MediaPayloadReceiver

type MediaPayloadReceiver interface {
	SetMediaFrameMetadata(sidecar.MediaFrameMetadata) error
}

type MediaPayloadSource

type MediaPayloadSource interface {
	MediaFrameMetadata() *sidecar.MediaFrameMetadata
}

type OpaquePayload

type OpaquePayload struct {
	JSON   json.RawMessage
	Binary []byte
	Media  *sidecar.MediaFrameMetadata
}

type PayloadAdapter

type PayloadAdapter struct {
	Factory       PayloadFactory
	MarshalJSON   func(any) (json.RawMessage, error)
	ExtractBinary func(any) ([]byte, *sidecar.MediaFrameMetadata, error)
	AttachBinary  func(any, []byte, *sidecar.MediaFrameMetadata) error
	// contains filtered or unexported fields
}

PayloadAdapter owns reconstruction for one exact graph type. Nil hooks use strict JSON plus the generic BinaryPayload*/MediaPayload* interfaces.

type PayloadCodec

type PayloadCodec interface {
	Encode(element.Type, any) (EncodedPayload, error)
	Decode(element.Type, EncodedPayload) (any, error)
	Supports(element.Type) bool
}

PayloadCodec separates language-neutral wire representation from Go-native values. Unknown types remain OpaquePayload; registered types reconstruct an exact graph-native value.

type PayloadFactory

type PayloadFactory func() any

type Session

type Session interface {
	Ready() sidecar.Message
	Frames() <-chan sidecar.Message
	Err() error
	Send(sidecar.Message) error
	Close() error
}

Session is the lifecycle and frame surface shared by a spawned sidecar, a persistent model server, and an upstream Realtime protocol adapter.

type VideoInputFrame

type VideoInputFrame struct {
	StreamID         string           `json:"stream_id"`
	Frame            perception.Frame `json:"frame"`
	FrameRateMilliHz int              `json:"frame_rate_millihz"`
}

VideoInputFrame is one directly observed image addressed to a live model stream. FrameRateMilliHz is explicit protocol evidence; it must not be guessed from arrival cadence by the transport adapter.

Jump to

Keyboard shortcuts

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