-
Notifications
You must be signed in to change notification settings - Fork 309
fix: port simulation participant sync race #1775
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 1.5.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ import { | |
| type TTSModelString, | ||
| } from '../inference/index.js'; | ||
| import type { OverlappingSpeechEvent } from '../inference/interruption/types.js'; | ||
| import { getJobContext } from '../job.js'; | ||
| import { SimulationMode, getJobContext } from '../job.js'; | ||
| import type { FunctionCall, FunctionCallOutput } from '../llm/chat_context.js'; | ||
| import { | ||
| AgentHandoffItem, | ||
|
|
@@ -533,6 +533,12 @@ export class AgentSession< | |
| return this.sessionOptions.useTtsAlignedTranscript; | ||
| } | ||
|
|
||
| /** @internal */ | ||
| get _textOnly(): boolean { | ||
| const ctx = getJobContext(false); | ||
| return ctx?.simulationContext()?.simulationMode === SimulationMode.SIMULATION_MODE_TEXT; | ||
| } | ||
|
|
||
| set userData(value: UserData) { | ||
| this._userData = value; | ||
| } | ||
|
|
@@ -557,6 +563,12 @@ export class AgentSession< | |
|
|
||
| const tasks: Promise<void>[] = []; | ||
|
|
||
| if (this._textOnly) { | ||
| this.logger.info('text simulation: disabling STT/TTS/VAD and audio I/O'); | ||
| inputOptions = { ...inputOptions, audioEnabled: false }; | ||
| outputOptions = { ...outputOptions, audioEnabled: false }; | ||
| } | ||
|
Comment on lines
+566
to
+570
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 The Trace of the auto-connect flow
Prompt for agentsWas this helpful? React with 👍 or 👎 to provide feedback. |
||
|
|
||
| if (room && !this._roomIO) { | ||
| // Check for existing input/output configuration and warn if needed | ||
| if (this.input.audio && inputOptions?.audioEnabled !== false) { | ||
|
|
@@ -684,6 +696,9 @@ export class AgentSession< | |
| } | ||
|
|
||
| this._recordingOptions = resolveRecordingOptions(record); | ||
| if (this._textOnly) { | ||
| this._recordingOptions.audio = false; | ||
| } | ||
|
|
||
| // Only one AgentSession per job can be the primary (and therefore record). | ||
| // Designate the primary before initRecording so a demoted secondary session | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚩 SimulationMode defaults to TEXT for unspecified modes
At
job.ts:128-129, when themodefield doesn't matchSIMULATION_MODE_AUDIOorSIMULATION_MODE_TEXT(including whenmodeisundefined,0/SIMULATION_MODE_UNSPECIFIED, or any unrecognized value), the getter defaults toSIMULATION_MODE_TEXT. This meansSIMULATION_MODE_UNSPECIFIED(value0) maps to TEXT mode rather than being treated as truly unspecified. The comment says "Simulations predating the mode field were text-only" which explains backward compatibility, but callers should be aware thatSIMULATION_MODE_UNSPECIFIEDtriggers text-only behavior (audio I/O disabled) rather than being a no-op.Was this helpful? React with 👍 or 👎 to provide feedback.