Documentation
¶
Overview ¶
Package speech implements graph-native speech synthesis and playback elements. Synthesis and playback are intentionally separate: generating audio is reversible computation, while handing a paced frame to a sink is an irreversible external effect.
Index ¶
- Constants
- func AudioType() element.Type
- func CancelType() element.Type
- func Descriptors() []element.Descriptor
- func FactoryRegistrations() ([]graphruntime.FactoryRegistration, error)
- func PlaybackDescriptor() element.Descriptor
- func PlaybackOutcomeType() element.Type
- func PlaybackReceiptType() element.Type
- func PlaybackReleaseType() element.Type
- func ProviderResolutionType() element.Type
- func RegisterDescriptors(catalog *resolve.Catalog) error
- func RegisterFactories(registry *graphruntime.Registry) error
- func SinkResolutionType() element.Type
- func SynthesisOutcomeType() element.Type
- func TTSDescriptor() element.Descriptor
- func TextSegmentType() element.Type
- func TransitionType() element.Type
- type AudioFrame
- type AudioFrameKind
- type Cancel
- type OutcomeKind
- type PlaybackConfig
- type PlaybackOutcome
- type PlaybackReceipt
- type PlaybackReceiptKind
- type PlaybackRelease
- type PlaybackSink
- type PlaybackSinkFactory
- type PlaybackSinkRegistry
- type PlaybackTimingSource
- type ProviderResolution
- type SinkResolution
- type Stage
- type State
- type SynthesisOutcome
- type TTSConfig
- type TTSProviderFactory
- type TTSProviderRegistry
- type TextSegment
- type Transition
Constants ¶
const ( TTSProviderRegistryService = "speech.tts.providers" PlaybackSinkRegistryService = "speech.playback.sinks" IrreversibilityLedgerService = "action.irreversibility.ledger" PlaybackSchedulerService = "speech.playback.scheduler" )
Variables ¶
This section is empty.
Functions ¶
func CancelType ¶
func Descriptors ¶
func Descriptors() []element.Descriptor
func FactoryRegistrations ¶
func FactoryRegistrations() ([]graphruntime.FactoryRegistration, error)
func PlaybackDescriptor ¶
func PlaybackDescriptor() element.Descriptor
func PlaybackOutcomeType ¶
func PlaybackReceiptType ¶
func PlaybackReleaseType ¶
PlaybackReleaseType carries the exact output state that a policy consumer must apply before exposing the corresponding turn completion.
func ProviderResolutionType ¶
func RegisterDescriptors ¶
func RegisterFactories ¶
func RegisterFactories(registry *graphruntime.Registry) error
func SinkResolutionType ¶
func SynthesisOutcomeType ¶
func TTSDescriptor ¶
func TTSDescriptor() element.Descriptor
func TextSegmentType ¶
Public type helpers let graph boundaries construct exact envelopes without exporting mutable package-level Type values.
func TransitionType ¶
Types ¶
type AudioFrame ¶
type AudioFrame struct {
Kind AudioFrameKind `json:"kind"`
UtteranceID string `json:"utterance_id"`
Utterance action.Utterance `json:"utterance,omitempty"`
SpeechAuthority string `json:"speech_authority,omitempty"`
Chunk v1.SpeechChunk `json:"chunk,omitempty"`
Terminal SynthesisOutcome `json:"terminal,omitempty"`
}
AudioFrame is the explicit framing carried by the Segmented audio port. Begin owns utterance metadata, Chunk owns immutable PCM, and End carries the synthesis terminal result. Playback never guesses completion from silence.
type AudioFrameKind ¶
type AudioFrameKind string
const ( AudioBegin AudioFrameKind = "begin" AudioChunk AudioFrameKind = "chunk" AudioEnd AudioFrameKind = "end" )
type Cancel ¶
type Cancel struct {
UtteranceID string `json:"utterance_id,omitempty"`
RunID string `json:"run_id,omitempty"`
Reason string `json:"reason,omitempty"`
}
Cancel is an addressed interruption. An empty ID uses the envelope's cancellation scope; it never means "cancel every utterance" implicitly. Cancel stops speech. Addressed to an utterance it stops that one; addressed to a run it stops every utterance of the run - the one playing, the ones queued, and any that arrive later - because a run that was cancelled has nothing left worth hearing. A count the policy stopped kept playing for six seconds when only the utterances already seen were named.
type OutcomeKind ¶
type OutcomeKind string
const ( OutcomeSucceeded OutcomeKind = "succeeded" OutcomeCancelled OutcomeKind = "cancelled" OutcomeRefused OutcomeKind = "refused" OutcomeFailed OutcomeKind = "failed" OutcomeIgnored OutcomeKind = "ignored" )
type PlaybackConfig ¶
type PlaybackOutcome ¶
type PlaybackReceipt ¶
type PlaybackReceipt struct {
Kind PlaybackReceiptKind `json:"kind"`
Sequence uint64 `json:"sequence"`
Utterance action.Utterance `json:"utterance"`
Frame action.Frame `json:"frame,omitempty"`
Outcome action.Outcome `json:"outcome,omitempty"`
}
PlaybackReceipt is a post-success receipt for one concrete sink effect. Every kind has its own graph port, so an adapter can attest a presentation seam without aliasing a generic status stream. Sequence and the receipt envelopes' causal parents establish the exact effect order.
type PlaybackReceiptKind ¶
type PlaybackReceiptKind string
const ( PlaybackReserved PlaybackReceiptKind = "reserved" PlaybackBegun PlaybackReceiptKind = "begun" PlaybackTextCommitted PlaybackReceiptKind = "text_committed" PlaybackAudioEmitted PlaybackReceiptKind = "audio_emitted" PlaybackEnded PlaybackReceiptKind = "ended" PlaybackReleased PlaybackReceiptKind = "released" )
type PlaybackRelease ¶
type PlaybackRelease struct {
Receipt PlaybackReceipt `json:"receipt"`
AgentOutput coreinteraction.AgentOutput `json:"agent_output"`
AgentOutputItemID string `json:"agent_output_item_id"`
}
type PlaybackSink ¶
type PlaybackSink interface {
action.SpeechSink
Descriptor() v1.Descriptor
}
PlaybackSink extends the proven action-plane sink contract with a live descriptor. A legacy sink can be adapted explicitly; the graph never treats a deployment assertion as proof of what resource was actually mounted.
type PlaybackSinkFactory ¶
type PlaybackSinkFactory func() (PlaybackSink, error)
type PlaybackSinkRegistry ¶
type PlaybackSinkRegistry struct {
// contains filtered or unexported fields
}
func NewPlaybackSinkRegistry ¶
func NewPlaybackSinkRegistry() *PlaybackSinkRegistry
func (*PlaybackSinkRegistry) Register ¶
func (registry *PlaybackSinkRegistry) Register( reference string, descriptor v1.Descriptor, factory PlaybackSinkFactory, ) error
type PlaybackTimingSource ¶
type PlaybackTimingSource interface {
PlaybackTiming() spoken.TrackerConfig
}
PlaybackTimingSource is the optional deployment seam through which an exact playback sink supplies its session-local word aligner. The graph element owns the Tracker because it alone sees both all synthesised audio and the exact frames that crossed the playback boundary.
type ProviderResolution ¶
type ProviderResolution struct {
Reference string `json:"reference"`
Descriptor v1.Descriptor `json:"descriptor"`
Selected map[string]bool `json:"selected,omitempty"`
}
type SinkResolution ¶
type SinkResolution struct {
Reference string `json:"reference"`
Descriptor v1.Descriptor `json:"descriptor"`
Selected map[string]bool `json:"selected,omitempty"`
}
type SynthesisOutcome ¶
type TTSProviderFactory ¶
type TTSProviderFactory func() (v1.SpeechProvider, error)
type TTSProviderRegistry ¶
type TTSProviderRegistry struct {
// contains filtered or unexported fields
}
TTSProviderRegistry is deployment-owned provider resolution. Graph source contains only the symbolic reference selected in the separate values artifact; credentials and concrete clients never enter topology or Graph IR.
func NewTTSProviderRegistry ¶
func NewTTSProviderRegistry() *TTSProviderRegistry
func (*TTSProviderRegistry) Register ¶
func (registry *TTSProviderRegistry) Register( reference string, descriptor v1.Descriptor, factory TTSProviderFactory, ) error
type TextSegment ¶
type TextSegment struct {
ID string `json:"id"`
Text string `json:"text"`
Producer string `json:"producer,omitempty"`
Phase trajectory.Phase `json:"phase,omitempty"`
SpeechAuthority string `json:"speech_authority,omitempty"`
SourceRevision uint64 `json:"source_revision,omitempty"`
AssistantItemIDs []string `json:"assistant_item_ids,omitempty"`
Continuer bool `json:"continuer,omitempty"`
SpokeOver bool `json:"spoke_over,omitempty"`
}
TextSegment is one complete, safe-to-speak unit. Segmentation policy lives upstream and can therefore be replaced without changing either TTS or playback. Phase is provenance only; no phase is privileged or forbidden.
type Transition ¶
type Transition struct {
UtteranceID string `json:"utterance_id"`
Stage Stage `json:"stage"`
State State `json:"state"`
CrossedBoundary bool `json:"crossed_boundary"`
PlayedNS uint64 `json:"played_ns,omitempty"`
Reason string `json:"reason,omitempty"`
LedgerState action.State `json:"ledger_state,omitempty"`
}
Transition makes the lifecycle visible to graph policy and inspection. CrossedBoundary is false for reversible cancellation and true once at least one audio frame may have reached the world.