33// SPDX-License-Identifier: Apache-2.0
44import { describe , expect , it } from 'vitest' ;
55import type { AgentSessionOptions } from '../agent_session.js' ;
6- import {
7- defaultEndpointingConfig ,
8- defaultInterruptionConfig ,
9- defaultTurnHandlingConfig ,
10- } from './index.js' ;
6+ import { defaultEndpointingConfig } from './endpointing.js' ;
7+ import { defaultInterruptionConfig } from './interruption.js' ;
8+ import { defaultTurnHandlingConfig } from './turnHandling.js' ;
119import { migrateLegacyOptions } from './utils.js' ;
1210
1311describe ( 'migrateLegacyOptions' , ( ) => {
@@ -43,7 +41,7 @@ describe('migrateLegacyOptions', () => {
4341 } ;
4442 const result = migrateLegacyOptions ( input ) ;
4543
46- expect ( result . turnHandling ! . interruption . mode ) . toBe ( false ) ;
44+ expect ( result . turnHandling ! . interruption ! . mode ) . toBe ( false ) ;
4745 expect ( 'voiceOptions' in result ) . toBe ( false ) ;
4846 } ) ;
4947
@@ -56,7 +54,7 @@ describe('migrateLegacyOptions', () => {
5654 const result = migrateLegacyOptions ( input ) ;
5755
5856 // mode should remain undefined (the default) when allowInterruptions is true
59- expect ( result . turnHandling ! . interruption . mode ) . toBe ( defaultInterruptionConfig . mode ) ;
57+ expect ( result . turnHandling ! . interruption ! . mode ) . toBe ( defaultInterruptionConfig . mode ) ;
6058 } ) ;
6159
6260 it ( 'should migrate voiceOptions interruption settings' , ( ) => {
@@ -69,9 +67,9 @@ describe('migrateLegacyOptions', () => {
6967 } ;
7068 const result = migrateLegacyOptions ( input ) ;
7169
72- expect ( result . turnHandling ! . interruption . minDuration ) . toBe ( 0.8 ) ;
73- expect ( result . turnHandling ! . interruption . minWords ) . toBe ( 3 ) ;
74- expect ( result . turnHandling ! . interruption . discardAudioIfUninterruptible ) . toBe ( false ) ;
70+ expect ( result . turnHandling ! . interruption ! . minDuration ) . toBe ( 0.8 ) ;
71+ expect ( result . turnHandling ! . interruption ! . minWords ) . toBe ( 3 ) ;
72+ expect ( result . turnHandling ! . interruption ! . discardAudioIfUninterruptible ) . toBe ( false ) ;
7573 } ) ;
7674
7775 it ( 'should migrate voiceOptions endpointing settings' , ( ) => {
@@ -83,8 +81,8 @@ describe('migrateLegacyOptions', () => {
8381 } ;
8482 const result = migrateLegacyOptions ( input ) ;
8583
86- expect ( result . turnHandling ! . endpointing . minDelay ) . toBe ( 1.0 ) ;
87- expect ( result . turnHandling ! . endpointing . maxDelay ) . toBe ( 5.0 ) ;
84+ expect ( result . turnHandling ! . endpointing ! . minDelay ) . toBe ( 1.0 ) ;
85+ expect ( result . turnHandling ! . endpointing ! . maxDelay ) . toBe ( 5.0 ) ;
8886 } ) ;
8987
9088 it ( 'should migrate voiceOptions.preemptiveGeneration' , ( ) => {
@@ -126,12 +124,12 @@ describe('migrateLegacyOptions', () => {
126124 const result = migrateLegacyOptions ( input ) ;
127125
128126 expect ( result . turnHandling ! . turnDetection ) . toBe ( 'stt' ) ;
129- expect ( result . turnHandling ! . interruption . mode ) . toBe ( false ) ;
130- expect ( result . turnHandling ! . interruption . discardAudioIfUninterruptible ) . toBe ( false ) ;
131- expect ( result . turnHandling ! . interruption . minDuration ) . toBe ( 1.0 ) ;
132- expect ( result . turnHandling ! . interruption . minWords ) . toBe ( 2 ) ;
133- expect ( result . turnHandling ! . endpointing . minDelay ) . toBe ( 0.8 ) ;
134- expect ( result . turnHandling ! . endpointing . maxDelay ) . toBe ( 4.0 ) ;
127+ expect ( result . turnHandling ! . interruption ! . mode ) . toBe ( false ) ;
128+ expect ( result . turnHandling ! . interruption ! . discardAudioIfUninterruptible ) . toBe ( false ) ;
129+ expect ( result . turnHandling ! . interruption ! . minDuration ) . toBe ( 1.0 ) ;
130+ expect ( result . turnHandling ! . interruption ! . minWords ) . toBe ( 2 ) ;
131+ expect ( result . turnHandling ! . endpointing ! . minDelay ) . toBe ( 0.8 ) ;
132+ expect ( result . turnHandling ! . endpointing ! . maxDelay ) . toBe ( 4.0 ) ;
135133 expect ( result . turnHandling ! . preemptiveGeneration ) . toBe ( true ) ;
136134 expect ( result . turnHandling ! . userAwayTimeout ) . toBe ( 20.0 ) ;
137135
@@ -161,6 +159,6 @@ describe('migrateLegacyOptions', () => {
161159 expect ( 'turnDetection' in result ) . toBe ( false ) ;
162160 expect ( 'voiceOptions' in result ) . toBe ( false ) ;
163161 expect ( result . turnHandling ! . turnDetection ) . toBe ( 'vad' ) ;
164- expect ( result . turnHandling ! . endpointing . minDelay ) . toBe ( 1.0 ) ;
162+ expect ( result . turnHandling ! . endpointing ! . minDelay ) . toBe ( 1.0 ) ;
165163 } ) ;
166164} ) ;
0 commit comments