scenarioconversation

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: 53 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 scenarioconversation adapts the stable OpenAI Realtime-compatible session surface to a locked, fine-grained conversational graph. Providers, tools, server hosts, and presentation clients remain exact plugins.

Index

Constants

View Source
const (
	ApplicationReference     = "application.openrealtime.scenario-conversation.v1"
	ApplicationFormatVersion = uint64(10)
)
View Source
const (
	AdapterReference = "go://github.com/bojieli/OpenRealtime/graph/binding/scenarioconversation/session-adapter/v1"
	ProfileName      = "openrealtime.scenario_conversation"
	ProfileRevision  = uint64(3)

	ASRReference             = "deployment.scenario-conversation.asr"
	SpeakerIdentityReference = "deployment.scenario-conversation.speaker-identity"
	PolicyReference          = "deployment.scenario-conversation.semantic-policy"
	ModelReference           = "deployment.scenario-conversation.model"
	TTSReference             = "deployment.scenario-conversation.tts"
	WordTimingReference      = "deployment.scenario-conversation.word-timing"
	PlaybackReference        = "deployment.scenario-conversation.playback"
	ToolReference            = "deployment.scenario-conversation.tools"
	TargetReference          = "deployment.scenario-conversation.target"
	LedgerReference          = "deployment.scenario-conversation.ledger"
	ConfirmationReference    = "deployment.scenario-conversation.confirmation"

	SourceMicrophone   = "microphone"
	SourceText         = "text"
	SourceMessage      = "message"
	SourceOtherSpeaker = voices.OtherSpeakerSource
)

Variables

This section is empty.

Functions

func NewApplicationRegistration

func NewApplicationRegistration(
	source ApplicationRegistrationConfig,
	constructor func(PluginConfig) (graphlaunch.Config, error),
) (launchprofile.Registration, error)

NewApplicationRegistration creates the generic strict-profile application registration for this graph. Resolution exact-matches every selected provider before it constructs the still-resource-free launch configuration.

Types

type ASRFactoryRegistration

type ASRFactoryRegistration struct {
	ApplicationASRSelection
	Factory                func(context.Context, legacy.Options) (v1.PerceptionProvider, error)
	DescribeConfiguration  func(json.RawMessage) (v1.Descriptor, error)
	FactoryConfiguration   func(context.Context, legacy.Options, json.RawMessage) (v1.PerceptionProvider, error)
	ReadinessConfiguration func(context.Context, json.RawMessage) error
}

ASRFactoryRegistration is one broad host inventory entry. The factory is retained but remains unopened until the selected session starts.

type ASRPlugin

type ASRPlugin struct {
	Reference  string
	Artifact   inspect.ArtifactIdentity
	Descriptor v1.Descriptor
	Factory    func(context.Context, legacy.Options) (v1.PerceptionProvider, error)
	// EndOfTurn is the recogniser signal that ends an utterance: end_of_turn,
	// eager, or empty for the acoustic gate alone.
	EndOfTurn string
}

type ApplicationASRSelection

type ApplicationASRSelection struct {
	Reference     string                   `json:"reference"`
	Artifact      inspect.ArtifactIdentity `json:"artifact"`
	Descriptor    v1.Descriptor            `json:"descriptor"`
	Configuration json.RawMessage          `json:"configuration,omitempty"`
	// EndOfTurn lets the recogniser end utterances: end_of_turn closes one
	// when the recogniser ends the turn, eager when it is moderately
	// confident. Empty leaves utterances to the acoustic gate, and an omitted
	// field keeps every existing profile's bytes.
	EndOfTurn string `json:"end_of_turn,omitempty"`
}

ApplicationASRSelection is a serializable exact host-plugin selection. Its reference is a host inventory key; the application maps the matched factory to the graph's fixed ASRReference only after identity verification.

type ApplicationConfig

type ApplicationConfig struct {
	NoiseFilter             *noisefilter.Config                  `json:"noise_filter,omitempty"`
	FormatVersion           uint64                               `json:"format_version"`
	Architecture            legacy.ArchitectureIdentity          `json:"architecture"`
	ASR                     ApplicationASRSelection              `json:"asr"`
	SpeakerIdentity         *ApplicationSpeakerIdentitySelection `json:"speaker_identity,omitempty"`
	Policy                  ApplicationPolicySelection           `json:"policy"`
	SemanticAdmission       SemanticAdmissionSelection           `json:"semantic_admission"`
	Model                   ApplicationModelSelection            `json:"model"`
	TTS                     ApplicationTTSSelection              `json:"tts"`
	WordTiming              *ApplicationWordTimingSelection      `json:"word_timing,omitempty"`
	Tools                   []ToolDeclaration                    `json:"tools"`
	Target                  computeruse.Target                   `json:"target"`
	Gate                    ApplicationGateSelection             `json:"gate"`
	Media                   MediaLimits                          `json:"media"`
	MaxOutputTokens         int                                  `json:"max_output_tokens"`
	ContinuationInstruction string                               `json:"continuation_instruction,omitempty"`
}

ApplicationConfig is the complete plugin-owned, resource-free selection carried by a generic graph launch profile.

func DecodeApplicationConfig

func DecodeApplicationConfig(source json.RawMessage) (ApplicationConfig, error)

DecodeApplicationConfig strictly decodes and validates an exact selection. It performs no factory invocation, environment lookup, secret resolution, graph mount, or listener acquisition.

type ApplicationGateSelection

type ApplicationGateSelection struct {
	Threshold         float64 `json:"threshold"`
	PrefixPaddingMS   int     `json:"prefix_padding_ms"`
	SilenceDurationMS int     `json:"silence_duration_ms"`
	SpeechDurationMS  int     `json:"speech_duration_ms"`
}

ApplicationGateSelection is the JSON-stable acoustic admission policy.

type ApplicationModelSelection

type ApplicationModelSelection struct {
	Reference     string                   `json:"reference"`
	Artifact      inspect.ArtifactIdentity `json:"artifact"`
	Descriptor    continuation.Descriptor  `json:"descriptor"`
	Configuration json.RawMessage          `json:"configuration,omitempty"`
}

ApplicationModelSelection pins one continuation provider without retaining a credential, client, or factory in profile data.

type ApplicationPolicySelection

type ApplicationPolicySelection struct {
	Reference     string                                   `json:"reference"`
	Artifact      inspect.ArtifactIdentity                 `json:"artifact"`
	Descriptor    policyelements.SemanticDeciderDescriptor `json:"descriptor"`
	Configuration json.RawMessage                          `json:"configuration,omitempty"`
}

ApplicationPolicySelection pins one narrow enumerated semantic decider. Configuration is plugin-owned and may name a credential environment variable, but must never contain credential bytes.

type ApplicationRegistrationConfig

type ApplicationRegistrationConfig struct {
	ApplicationArtifact inspect.ArtifactIdentity
	ProviderArtifact    inspect.ArtifactIdentity
	RuntimeArtifact     inspect.ArtifactIdentity
	DependencyArtifact  inspect.ArtifactIdentity
	ASR                 []ASRFactoryRegistration
	SpeakerIdentity     []SpeakerIdentityFactoryRegistration
	Policies            []PolicyFactoryRegistration
	Models              []ModelFactoryRegistration
	TTS                 []TTSFactoryRegistration
	WordTiming          []WordTimingFactoryRegistration
}

ApplicationRegistrationConfig is process-private executable inventory. The supplied artifacts are host/build identities; this package never invents a provider, adapter, or dependency artifact from configuration bytes.

type ApplicationSpeakerIdentitySelection

type ApplicationSpeakerIdentitySelection struct {
	Reference     string                   `json:"reference"`
	Artifact      inspect.ArtifactIdentity `json:"artifact"`
	Descriptor    v1.Descriptor            `json:"descriptor"`
	Model         string                   `json:"model"`
	Configuration json.RawMessage          `json:"configuration,omitempty"`
}

ApplicationSpeakerIdentitySelection pins the optional session-local speaker embedder. Descriptor identifies the adapter contract; Model pins the independently deployed embedding weights.

type ApplicationTTSSelection

type ApplicationTTSSelection struct {
	Reference     string                   `json:"reference"`
	Artifact      inspect.ArtifactIdentity `json:"artifact"`
	Descriptor    v1.Descriptor            `json:"descriptor"`
	Voice         string                   `json:"voice"`
	Configuration json.RawMessage          `json:"configuration,omitempty"`
}

ApplicationTTSSelection pins one speech provider and its fixed voice.

type ApplicationWordTimingSelection

type ApplicationWordTimingSelection struct {
	Reference     string                   `json:"reference"`
	Artifact      inspect.ArtifactIdentity `json:"artifact"`
	IntervalMS    int64                    `json:"interval_ms"`
	Configuration json.RawMessage          `json:"configuration,omitempty"`
}

ApplicationWordTimingSelection pins the optional recogniser used only to locate word boundaries in the agent's own audio. Configuration remains plugin-owned; IntervalMS is application policy because it determines how often playback asks the provider to refresh a still-growing utterance.

type MediaLimits

type MediaLimits struct {
	MaxItems        int `json:"max_items"`
	MaxBytes        int `json:"max_bytes"`
	MaxItemBytes    int `json:"max_item_bytes"`
	MaxPending      int `json:"max_pending"`
	MaxActiveLeases int `json:"max_active_leases"`
}

MediaLimits are copied into the graph-native media.RetainedMedia and media.ResolveAttachment node values and into the session resolver bridge. Keeping every bound in the application selection prevents the adapter from silently inventing a process-wide retention policy.

type ModelFactoryRegistration

type ModelFactoryRegistration struct {
	ApplicationModelSelection
	Factory                func(context.Context, legacy.Options) (continuation.Provider, error)
	DescribeConfiguration  func(json.RawMessage) (continuation.Descriptor, error)
	FactoryConfiguration   func(context.Context, legacy.Options, json.RawMessage) (continuation.Provider, error)
	ReadinessConfiguration func(context.Context, json.RawMessage) error
}

type ModelPlugin

type ModelPlugin struct {
	Reference  string
	Artifact   inspect.ArtifactIdentity
	Descriptor continuation.Descriptor
	Factory    func(context.Context, legacy.Options) (continuation.Provider, error)
}

type Plugin

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

Plugin is a resource-free launch contribution. Its coordinator constructs exactly one cross-service bundle per Start call and never at profile decode, application resolution, plan creation, or preflight.

func NewPlugin

func NewPlugin(source PluginConfig) (*Plugin, error)

func (*Plugin) AdapterPlugin

func (plugin *Plugin) AdapterPlugin() graphlaunch.AdapterPlugin

func (*Plugin) AssemblyDependencies

func (plugin *Plugin) AssemblyDependencies() []graphassembly.Dependency

func (*Plugin) MountDependencies

func (plugin *Plugin) MountDependencies() []graphlaunch.MountDependencyPlugin

func (*Plugin) Selection

func (plugin *Plugin) Selection() graphlaunch.AdapterSelection

type PluginConfig

type PluginConfig struct {
	NoiseFilter             *noisefilter.Config `json:"noise_filter,omitempty"`
	RuntimeArtifact         inspect.ArtifactIdentity
	DependencyArtifact      inspect.ArtifactIdentity
	Architecture            projectarch.Definition
	ASR                     ASRPlugin
	SpeakerIdentity         *SpeakerIdentityPlugin
	Policy                  PolicyPlugin
	SemanticAdmission       SemanticAdmissionSelection
	Model                   ModelPlugin
	TTS                     TTSPlugin
	WordTiming              *WordTimingPlugin
	Tools                   []ToolDeclaration
	Target                  computeruse.Target
	Gate                    perception.GateConfig
	Media                   MediaLimits
	MaxOutputTokens         int
	ContinuationInstruction string
}

PluginConfig is the immutable resource-free contribution retained by a launch configuration. Every factory remains unopened until session Start.

func NormalizePluginConfig

func NormalizePluginConfig(source PluginConfig) (PluginConfig, error)

NormalizePluginConfig validates and snapshots one complete resource-free plugin selection. It never invokes a provider factory; graph application registries use it to derive immutable values and dependency identities before a session is allowed to start.

type PolicyFactoryRegistration

type PolicyFactoryRegistration struct {
	ApplicationPolicySelection
	Factory                func(context.Context, legacy.Options) (policyelements.SemanticDecider, error)
	DescribeConfiguration  func(json.RawMessage) (policyelements.SemanticDeciderDescriptor, error)
	FactoryConfiguration   func(context.Context, legacy.Options, json.RawMessage) (policyelements.SemanticDecider, error)
	ReadinessConfiguration func(context.Context, json.RawMessage) error
}

type PolicyPlugin

type PolicyPlugin struct {
	Reference  string
	Artifact   inspect.ArtifactIdentity
	Descriptor policyelements.SemanticDeciderDescriptor
	Factory    func(context.Context, legacy.Options) (policyelements.SemanticDecider, error)
}

PolicyPlugin is the exact semantic-admission provider selected by one launch profile. It is deliberately not a continuation provider: its enumerated decision and optional declared standing-policy extraction capabilities remain control-plane inputs and cannot propose tools or acquire speech authority.

type SemanticAdmissionSelection

type SemanticAdmissionSelection struct {
	StandingExtraction bool `json:"standing_extraction,omitempty"`
	StandingMemory     int  `json:"standing_memory,omitempty"`
	// Rules is the one instruction the interaction policy reads at every
	// event. Empty selects interaction.ChoiceInstruction; the room passes it
	// explicitly so the frozen profile records the text it ran with.
	Rules string `json:"rules,omitempty"`
}

SemanticAdmissionSelection pins the provider-neutral control-plane policy stages enabled for one graph application. Provider capability and policy use are separate: a plug-in may expose standing extraction while a profile deliberately leaves it disabled.

type SpeakerIdentityFactoryRegistration

type SpeakerIdentityFactoryRegistration struct {
	ApplicationSpeakerIdentitySelection
	Factory                func(context.Context, legacy.Options) (voices.Embedder, error)
	DescribeConfiguration  func(json.RawMessage) (v1.Descriptor, string, error)
	FactoryConfiguration   func(context.Context, legacy.Options, json.RawMessage) (voices.Embedder, error)
	ReadinessConfiguration func(context.Context, json.RawMessage) error
}

type SpeakerIdentityPlugin

type SpeakerIdentityPlugin struct {
	Reference  string
	Artifact   inspect.ArtifactIdentity
	Descriptor v1.Descriptor
	Model      string
	Factory    func(context.Context, legacy.Options) (voices.Embedder, error)
}

SpeakerIdentityPlugin is the optional exact speaker-embedding selection. The factory creates one embedder per session; the recogniser that enrols and compares voices is also session-local and is never shared across calls.

type TTSFactoryRegistration

type TTSFactoryRegistration struct {
	ApplicationTTSSelection
	Factory                func(context.Context, legacy.Options) (v1.SpeechProvider, error)
	DescribeConfiguration  func(json.RawMessage) (v1.Descriptor, string, error)
	FactoryConfiguration   func(context.Context, legacy.Options, json.RawMessage) (v1.SpeechProvider, error)
	ReadinessConfiguration func(context.Context, json.RawMessage) error
}

type TTSPlugin

type TTSPlugin struct {
	Reference  string
	Artifact   inspect.ArtifactIdentity
	Descriptor v1.Descriptor
	Voice      string
	Factory    func(context.Context, legacy.Options) (v1.SpeechProvider, error)
}

type ToolDeclaration

type ToolDeclaration struct {
	Name                string                                `json:"name"`
	Description         string                                `json:"description"`
	Parameters          json.RawMessage                       `json:"parameters"`
	ArgumentNormalizers []legacyaction.ToolArgumentNormalizer `json:"argument_normalizers,omitempty"`
	Confirm             legacyaction.Confirm                  `json:"confirm,omitempty"`
	Background          bool                                  `json:"background,omitempty"`
	Target              string                                `json:"target,omitempty"`
}

ToolDeclaration is the exact client-executed action surface admitted by one profile. Dispatcher is deliberately absent: each mounted session installs its own graph-authorized client rendezvous.

type WordTimingFactoryRegistration

type WordTimingFactoryRegistration struct {
	Reference              string
	Artifact               inspect.ArtifactIdentity
	Factory                func(context.Context, legacy.Options) (spoken.Aligner, error)
	ValidateConfiguration  func(json.RawMessage) error
	FactoryConfiguration   func(context.Context, legacy.Options, json.RawMessage) (spoken.Aligner, error)
	ReadinessConfiguration func(context.Context, json.RawMessage) error
}

WordTimingFactoryRegistration has no graph descriptor because the provider emits no graph payload. Exact configuration bytes and the linked artifact still remain profile-pinned, and the factory stays unopened until a session constructs its playback sink.

type WordTimingPlugin

type WordTimingPlugin struct {
	Reference string
	Artifact  inspect.ArtifactIdentity
	Interval  time.Duration
	Factory   func(context.Context, legacy.Options) (spoken.Aligner, error)
}

WordTimingPlugin is the optional recogniser that locates words inside the agent's own synthesised audio. It is deliberately separate from ASR: ASR decides what the user said, while this provider only times text the agent already knows exactly because it generated that text itself.

Jump to

Keyboard shortcuts

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