Documentation
¶
Overview ¶
Package acoustic exposes acoustic admission and endpoint ownership as independently composable graph elements. The admission element answers the physical question "is speech audible?"; the endpoint policy answers the interaction question "does this pause end the turn?".
Index ¶
- func ActivityType() element.Type
- func Descriptors() []element.Descriptor
- func EndpointPolicyDescriptor() element.Descriptor
- func EnergyAdmissionDescriptor() element.Descriptor
- func FactoryRegistrations() ([]graphruntime.FactoryRegistration, error)
- func RegisterDescriptors(catalog *resolve.Catalog) error
- func RegisterFactories(registry *graphruntime.Registry) error
- type AdmissionConfig
- type AdmissionOutcome
- type AdmissionPhase
- type AdmissionState
- type AudioCommit
- type EndpointCandidate
- type EndpointMode
- type EndpointOutcome
- type EndpointPolicyConfig
- type EndpointPolicyState
- type EndpointVerdict
- type GateAction
- type GateCommand
- type InputFrame
- type OutcomeKind
- type SpeechActivity
- type SpeechActivityKind
- type TimingTick
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ActivityType ¶
ActivityType returns the exact typed acoustic-transition contract used by graph-native interaction policies. Acoustic activity is evidence only; it does not itself imply that any downstream work should be interrupted.
func Descriptors ¶
func Descriptors() []element.Descriptor
func EndpointPolicyDescriptor ¶
func EndpointPolicyDescriptor() element.Descriptor
func EnergyAdmissionDescriptor ¶
func EnergyAdmissionDescriptor() element.Descriptor
func FactoryRegistrations ¶
func FactoryRegistrations() ([]graphruntime.FactoryRegistration, error)
func RegisterDescriptors ¶
func RegisterFactories ¶
func RegisterFactories(registry *graphruntime.Registry) error
Types ¶
type AdmissionConfig ¶
type AdmissionConfig struct {
Threshold *float64 `json:"threshold,omitempty"`
PrefixPaddingMS *int `json:"prefix_padding_ms,omitempty"`
SilenceDurationMS *int `json:"silence_duration_ms,omitempty"`
SpeechDurationMS *int `json:"speech_duration_ms,omitempty"`
Source string `json:"source,omitempty"`
CancellationMemory int `json:"cancellation_memory,omitempty"`
TerminalMemory int `json:"terminal_memory,omitempty"`
MaxFrameBytes int `json:"max_frame_bytes,omitempty"`
MaxSampleRateHz uint32 `json:"max_sample_rate_hz,omitempty"`
}
AdmissionConfig bounds both DSP allocation and remembered terminal state. Pointer-valued gate settings preserve the distinction between omitted defaults and intentionally configured zero values.
type AdmissionOutcome ¶
type AdmissionPhase ¶
type AdmissionPhase string
const ( AdmissionAwaitingPolicy AdmissionPhase = "awaiting_policy" AdmissionIdle AdmissionPhase = "idle" AdmissionListening AdmissionPhase = "listening" AdmissionSpeaking AdmissionPhase = "speaking" AdmissionAwaiting AdmissionPhase = "awaiting_endpoint" )
type AdmissionState ¶
type AdmissionState struct {
Sequence uint64 `json:"sequence"`
Phase AdmissionPhase `json:"phase"`
Mode EndpointMode `json:"mode,omitempty"`
PolicySequence uint64 `json:"policy_sequence,omitempty"`
StreamID string `json:"stream_id,omitempty"`
Source string `json:"source,omitempty"`
SampleRateHz uint32 `json:"sample_rate_hz,omitempty"`
CandidateID string `json:"candidate_id,omitempty"`
SpeechActive bool `json:"speech_active,omitempty"`
FramesSeen uint64 `json:"frames_seen,omitempty"`
FramesAdmitted uint64 `json:"frames_admitted,omitempty"`
GateGeneration uint64 `json:"gate_generation,omitempty"`
CancellationsRetained int `json:"cancellations_retained,omitempty"`
TerminalsRetained int `json:"terminals_retained,omitempty"`
}
AdmissionState is bounded, payload-free operational state suitable for graph inspection.
type AudioCommit ¶
type AudioCommit struct {
StreamID string `json:"stream_id,omitempty"`
Reason string `json:"reason,omitempty"`
}
AudioCommit is the client-owned/manual endpoint trigger.
type EndpointCandidate ¶
type EndpointCandidate struct {
ID string `json:"id"`
StreamID string `json:"stream_id"`
Source string `json:"source"`
DetectedNS uint64 `json:"detected_ns,omitempty"`
AudioEndMS int `json:"audio_end_ms"`
SilenceNS uint64 `json:"silence_ns"`
SampleRateHz uint32 `json:"sample_rate_hz"`
Sequence uint64 `json:"sequence"`
}
EndpointCandidate is evidence that the energy gate observed sustained silence. It is not itself an endpoint decision.
type EndpointMode ¶
type EndpointMode string
EndpointMode names who owns a silence candidate.
const ( EndpointAutomatic EndpointMode = "automatic" EndpointManual EndpointMode = "manual" EndpointExternal EndpointMode = "external" )
type EndpointOutcome ¶
type EndpointOutcome struct {
Kind OutcomeKind `json:"kind"`
Operation string `json:"operation"`
StreamID string `json:"stream_id,omitempty"`
CandidateID string `json:"candidate_id,omitempty"`
Action GateAction `json:"action,omitempty"`
Code string `json:"code,omitempty"`
Message string `json:"message,omitempty"`
}
type EndpointPolicyConfig ¶
type EndpointPolicyConfig struct {
Mode EndpointMode `json:"mode,omitempty"`
CandidateTimeoutMS int `json:"candidate_timeout_ms,omitempty"`
Fallback GateAction `json:"fallback,omitempty"`
CancellationMemory int `json:"cancellation_memory,omitempty"`
TerminalMemory int `json:"terminal_memory,omitempty"`
}
EndpointPolicyConfig selects endpoint ownership. In external mode the timeout is evaluated only when TimingTick arrives.
type EndpointPolicyState ¶
type EndpointPolicyState struct {
Sequence uint64 `json:"sequence"`
Mode EndpointMode `json:"mode"`
PendingCandidateID string `json:"pending_candidate_id,omitempty"`
PendingStreamID string `json:"pending_stream_id,omitempty"`
PendingVerdictID string `json:"pending_verdict_id,omitempty"`
PendingVerdictStreamID string `json:"pending_verdict_stream_id,omitempty"`
DeadlineNS uint64 `json:"deadline_ns,omitempty"`
LastTickNS uint64 `json:"last_tick_ns,omitempty"`
Fallback GateAction `json:"fallback,omitempty"`
CancellationsRetained int `json:"cancellations_retained,omitempty"`
TerminalsRetained int `json:"terminals_retained,omitempty"`
}
EndpointPolicyState makes endpoint ownership, pending work, and its explicit tick deadline visible to the rest of the graph.
type EndpointVerdict ¶
type EndpointVerdict struct {
CandidateID string `json:"candidate_id"`
StreamID string `json:"stream_id,omitempty"`
Action GateAction `json:"action"`
Reason string `json:"reason,omitempty"`
}
EndpointVerdict is supplied by a separately composed interaction policy in external mode.
type GateAction ¶
type GateAction string
GateAction is the complete vocabulary accepted by EnergyAdmission.
const ( GateClose GateAction = "close" GateReopen GateAction = "reopen" GateForceClose GateAction = "force_close" )
type GateCommand ¶
type GateCommand struct {
Action GateAction `json:"action"`
CandidateID string `json:"candidate_id,omitempty"`
StreamID string `json:"stream_id,omitempty"`
Reason string `json:"reason,omitempty"`
}
GateCommand resolves a silence candidate or explicitly commits an active manual stream. CandidateID is mandatory for close/reopen and optional for a force-close.
type InputFrame ¶
type InputFrame struct {
StreamID string `json:"stream_id"`
Frame coreperception.Frame `json:"frame"`
}
InputFrame addresses one immutable raw audio frame to a logical stream.
type OutcomeKind ¶
type OutcomeKind string
const ( OutcomeSucceeded OutcomeKind = "succeeded" OutcomePending OutcomeKind = "pending" OutcomeCanceled OutcomeKind = "canceled" OutcomeRefused OutcomeKind = "refused" OutcomeIgnored OutcomeKind = "ignored" OutcomeFailed OutcomeKind = "failed" )
type SpeechActivity ¶
type SpeechActivity struct {
Kind SpeechActivityKind `json:"kind"`
StreamID string `json:"stream_id"`
Source string `json:"source"`
AtNS uint64 `json:"at_ns,omitempty"`
SampleRateHz uint32 `json:"sample_rate_hz"`
AudioStartMS int `json:"audio_start_ms,omitempty"`
AudioEndMS int `json:"audio_end_ms,omitempty"`
}
SpeechActivity exposes acoustic transitions without claiming turn ownership. A stopped event is emitted only after an endpoint command accepts the candidate; a rejected pause is represented by a candidate and reopen.
type SpeechActivityKind ¶
type SpeechActivityKind string
const ( SpeechStarted SpeechActivityKind = "started" SpeechStopped SpeechActivityKind = "stopped" )
type TimingTick ¶
type TimingTick struct {
NowNS uint64 `json:"now_ns"`
}
TimingTick drives deadlines. EndpointPolicy never creates a hidden timer. The first tick after a candidate starts its timeout, and later ticks must be monotonic in that same producer-defined domain. Capture timestamps are observation evidence and are deliberately never compared with NowNS.