77 type InternalSessionOptions ,
88 defaultSessionOptions ,
99} from '../agent_session.js' ;
10- import { defaultEndpointingConfig } from './endpointing.js' ;
11- import { defaultInterruptionConfig } from './interruption.js' ;
12- import { type TurnHandlingConfig , defaultTurnHandlingConfig } from './turn_handling.js' ;
10+ import { defaultEndpointingOptions } from './endpointing.js' ;
11+ import { defaultInterruptionOptions } from './interruption.js' ;
12+ import { type TurnHandlingOptions , defaultTurnHandlingOptions } from './turn_handling.js' ;
1313
1414export function migrateLegacyOptions < UserData > (
1515 legacyOptions : AgentSessionOptions < UserData > ,
@@ -50,7 +50,7 @@ export function migrateLegacyOptions<UserData>(
5050
5151 const mergedOptions = structuredClone ( { ...cloneableVoiceOptions , ...cloneableSessionOptions } ) ;
5252
53- const turnHandling : TurnHandlingConfig = {
53+ const turnHandling : TurnHandlingOptions = {
5454 interruption : {
5555 discardAudioIfUninterruptible : mergedOptions ?. discardAudioIfUninterruptible ,
5656 minDuration : mergedOptions ?. minInterruptionDuration ,
@@ -68,7 +68,7 @@ export function migrateLegacyOptions<UserData>(
6868 } as const ;
6969
7070 if ( mergedOptions ?. allowInterruptions === false ) {
71- turnHandling . interruption . mode = false ;
71+ turnHandling . interruption . enabled = false ;
7272 }
7373
7474 const optionsWithDefaults = {
@@ -94,10 +94,10 @@ export function stripUndefined<T extends object>(obj: T): Partial<T> {
9494 return Object . fromEntries ( Object . entries ( obj ) . filter ( ( [ , v ] ) => v !== undefined ) ) as Partial < T > ;
9595}
9696
97- export function mergeWithDefaults ( config : TurnHandlingConfig ) {
97+ export function mergeWithDefaults ( config : TurnHandlingOptions ) {
9898 return {
99- turnDetection : config . turnDetection ?? defaultTurnHandlingConfig . turnDetection ,
100- endpointing : { ...defaultEndpointingConfig , ...stripUndefined ( config . endpointing ) } ,
101- interruption : { ...defaultInterruptionConfig , ...stripUndefined ( config . interruption ) } ,
99+ turnDetection : config . turnDetection ?? defaultTurnHandlingOptions . turnDetection ,
100+ endpointing : { ...defaultEndpointingOptions , ...stripUndefined ( config . endpointing ) } ,
101+ interruption : { ...defaultInterruptionOptions , ...stripUndefined ( config . interruption ) } ,
102102 } as const ;
103103}
0 commit comments