@livekit/agents 1.1.0-dev.0 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (292) hide show
  1. package/dist/cli.cjs +2 -0
  2. package/dist/cli.cjs.map +1 -1
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +2 -0
  5. package/dist/cli.js.map +1 -1
  6. package/dist/constants.cjs +3 -0
  7. package/dist/constants.cjs.map +1 -1
  8. package/dist/constants.d.cts +1 -0
  9. package/dist/constants.d.ts +1 -0
  10. package/dist/constants.d.ts.map +1 -1
  11. package/dist/constants.js +2 -0
  12. package/dist/constants.js.map +1 -1
  13. package/dist/cpu.cjs +189 -0
  14. package/dist/cpu.cjs.map +1 -0
  15. package/dist/cpu.d.cts +24 -0
  16. package/dist/cpu.d.ts +24 -0
  17. package/dist/cpu.d.ts.map +1 -0
  18. package/dist/cpu.js +152 -0
  19. package/dist/cpu.js.map +1 -0
  20. package/dist/cpu.test.cjs +227 -0
  21. package/dist/cpu.test.cjs.map +1 -0
  22. package/dist/cpu.test.js +204 -0
  23. package/dist/cpu.test.js.map +1 -0
  24. package/dist/index.cjs +12 -10
  25. package/dist/index.cjs.map +1 -1
  26. package/dist/index.d.cts +13 -13
  27. package/dist/index.d.ts +13 -13
  28. package/dist/index.d.ts.map +1 -1
  29. package/dist/index.js +11 -10
  30. package/dist/index.js.map +1 -1
  31. package/dist/inference/interruption/defaults.cjs +1 -1
  32. package/dist/inference/interruption/defaults.cjs.map +1 -1
  33. package/dist/inference/interruption/defaults.d.cts +1 -1
  34. package/dist/inference/interruption/defaults.d.ts +1 -1
  35. package/dist/inference/interruption/defaults.d.ts.map +1 -1
  36. package/dist/inference/interruption/defaults.js +1 -1
  37. package/dist/inference/interruption/defaults.js.map +1 -1
  38. package/dist/inference/interruption/http_transport.cjs +44 -28
  39. package/dist/inference/interruption/http_transport.cjs.map +1 -1
  40. package/dist/inference/interruption/http_transport.d.ts.map +1 -1
  41. package/dist/inference/interruption/http_transport.js +45 -29
  42. package/dist/inference/interruption/http_transport.js.map +1 -1
  43. package/dist/inference/interruption/interruption_detector.cjs +22 -5
  44. package/dist/inference/interruption/interruption_detector.cjs.map +1 -1
  45. package/dist/inference/interruption/interruption_detector.d.cts +2 -2
  46. package/dist/inference/interruption/interruption_detector.d.ts +2 -2
  47. package/dist/inference/interruption/interruption_detector.d.ts.map +1 -1
  48. package/dist/inference/interruption/interruption_detector.js +22 -5
  49. package/dist/inference/interruption/interruption_detector.js.map +1 -1
  50. package/dist/inference/interruption/interruption_stream.cjs +4 -4
  51. package/dist/inference/interruption/interruption_stream.cjs.map +1 -1
  52. package/dist/inference/interruption/interruption_stream.js +4 -4
  53. package/dist/inference/interruption/interruption_stream.js.map +1 -1
  54. package/dist/inference/interruption/types.cjs.map +1 -1
  55. package/dist/inference/interruption/types.d.cts +2 -2
  56. package/dist/inference/interruption/types.d.ts +2 -2
  57. package/dist/inference/interruption/types.d.ts.map +1 -1
  58. package/dist/inference/interruption/ws_transport.cjs +60 -47
  59. package/dist/inference/interruption/ws_transport.cjs.map +1 -1
  60. package/dist/inference/interruption/ws_transport.d.ts.map +1 -1
  61. package/dist/inference/interruption/ws_transport.js +60 -47
  62. package/dist/inference/interruption/ws_transport.js.map +1 -1
  63. package/dist/inference/llm.cjs.map +1 -1
  64. package/dist/inference/llm.d.cts +1 -1
  65. package/dist/inference/llm.d.ts +1 -1
  66. package/dist/inference/llm.d.ts.map +1 -1
  67. package/dist/inference/llm.js.map +1 -1
  68. package/dist/inference/stt.cjs +20 -12
  69. package/dist/inference/stt.cjs.map +1 -1
  70. package/dist/inference/stt.d.cts +3 -2
  71. package/dist/inference/stt.d.ts +3 -2
  72. package/dist/inference/stt.d.ts.map +1 -1
  73. package/dist/inference/stt.js +20 -12
  74. package/dist/inference/stt.js.map +1 -1
  75. package/dist/inference/stt.test.cjs +14 -0
  76. package/dist/inference/stt.test.cjs.map +1 -1
  77. package/dist/inference/stt.test.js +14 -0
  78. package/dist/inference/stt.test.js.map +1 -1
  79. package/dist/inference/tts.cjs +13 -4
  80. package/dist/inference/tts.cjs.map +1 -1
  81. package/dist/inference/tts.d.cts +8 -1
  82. package/dist/inference/tts.d.ts +8 -1
  83. package/dist/inference/tts.d.ts.map +1 -1
  84. package/dist/inference/tts.js +13 -4
  85. package/dist/inference/tts.js.map +1 -1
  86. package/dist/inference/tts.test.cjs +10 -0
  87. package/dist/inference/tts.test.cjs.map +1 -1
  88. package/dist/inference/tts.test.js +10 -0
  89. package/dist/inference/tts.test.js.map +1 -1
  90. package/dist/ipc/job_proc_lazy_main.cjs +41 -23
  91. package/dist/ipc/job_proc_lazy_main.cjs.map +1 -1
  92. package/dist/ipc/job_proc_lazy_main.js +41 -23
  93. package/dist/ipc/job_proc_lazy_main.js.map +1 -1
  94. package/dist/job.cjs +1 -1
  95. package/dist/job.cjs.map +1 -1
  96. package/dist/job.js +1 -1
  97. package/dist/job.js.map +1 -1
  98. package/dist/language.cjs +394 -0
  99. package/dist/language.cjs.map +1 -0
  100. package/dist/language.d.cts +15 -0
  101. package/dist/language.d.ts +15 -0
  102. package/dist/language.d.ts.map +1 -0
  103. package/dist/language.js +363 -0
  104. package/dist/language.js.map +1 -0
  105. package/dist/language.test.cjs +43 -0
  106. package/dist/language.test.cjs.map +1 -0
  107. package/dist/language.test.js +49 -0
  108. package/dist/language.test.js.map +1 -0
  109. package/dist/llm/index.cjs +2 -0
  110. package/dist/llm/index.cjs.map +1 -1
  111. package/dist/llm/index.d.cts +1 -1
  112. package/dist/llm/index.d.ts +1 -1
  113. package/dist/llm/index.d.ts.map +1 -1
  114. package/dist/llm/index.js +2 -0
  115. package/dist/llm/index.js.map +1 -1
  116. package/dist/stream/deferred_stream.cjs +6 -2
  117. package/dist/stream/deferred_stream.cjs.map +1 -1
  118. package/dist/stream/deferred_stream.d.ts.map +1 -1
  119. package/dist/stream/deferred_stream.js +6 -2
  120. package/dist/stream/deferred_stream.js.map +1 -1
  121. package/dist/stt/stt.cjs.map +1 -1
  122. package/dist/stt/stt.d.cts +2 -1
  123. package/dist/stt/stt.d.ts +2 -1
  124. package/dist/stt/stt.d.ts.map +1 -1
  125. package/dist/stt/stt.js.map +1 -1
  126. package/dist/utils.cjs +15 -0
  127. package/dist/utils.cjs.map +1 -1
  128. package/dist/utils.d.cts +8 -0
  129. package/dist/utils.d.ts +8 -0
  130. package/dist/utils.d.ts.map +1 -1
  131. package/dist/utils.js +13 -0
  132. package/dist/utils.js.map +1 -1
  133. package/dist/version.cjs +1 -1
  134. package/dist/version.js +1 -1
  135. package/dist/voice/agent.cjs +14 -17
  136. package/dist/voice/agent.cjs.map +1 -1
  137. package/dist/voice/agent.d.cts +10 -11
  138. package/dist/voice/agent.d.ts +10 -11
  139. package/dist/voice/agent.d.ts.map +1 -1
  140. package/dist/voice/agent.js +15 -18
  141. package/dist/voice/agent.js.map +1 -1
  142. package/dist/voice/agent.test.cjs +194 -0
  143. package/dist/voice/agent.test.cjs.map +1 -1
  144. package/dist/voice/agent.test.js +195 -1
  145. package/dist/voice/agent.test.js.map +1 -1
  146. package/dist/voice/agent_activity.cjs +116 -39
  147. package/dist/voice/agent_activity.cjs.map +1 -1
  148. package/dist/voice/agent_activity.d.cts +2 -0
  149. package/dist/voice/agent_activity.d.ts +2 -0
  150. package/dist/voice/agent_activity.d.ts.map +1 -1
  151. package/dist/voice/agent_activity.js +117 -40
  152. package/dist/voice/agent_activity.js.map +1 -1
  153. package/dist/voice/agent_activity.test.cjs +135 -0
  154. package/dist/voice/agent_activity.test.cjs.map +1 -0
  155. package/dist/voice/agent_activity.test.js +134 -0
  156. package/dist/voice/agent_activity.test.js.map +1 -0
  157. package/dist/voice/agent_session.cjs +38 -38
  158. package/dist/voice/agent_session.cjs.map +1 -1
  159. package/dist/voice/agent_session.d.cts +65 -56
  160. package/dist/voice/agent_session.d.ts +65 -56
  161. package/dist/voice/agent_session.d.ts.map +1 -1
  162. package/dist/voice/agent_session.js +37 -37
  163. package/dist/voice/agent_session.js.map +1 -1
  164. package/dist/voice/audio_recognition.cjs +106 -52
  165. package/dist/voice/audio_recognition.cjs.map +1 -1
  166. package/dist/voice/audio_recognition.d.cts +4 -2
  167. package/dist/voice/audio_recognition.d.ts +4 -2
  168. package/dist/voice/audio_recognition.d.ts.map +1 -1
  169. package/dist/voice/audio_recognition.js +106 -52
  170. package/dist/voice/audio_recognition.js.map +1 -1
  171. package/dist/voice/audio_recognition_span.test.cjs +84 -22
  172. package/dist/voice/audio_recognition_span.test.cjs.map +1 -1
  173. package/dist/voice/audio_recognition_span.test.js +90 -23
  174. package/dist/voice/audio_recognition_span.test.js.map +1 -1
  175. package/dist/voice/events.cjs +1 -1
  176. package/dist/voice/events.cjs.map +1 -1
  177. package/dist/voice/events.d.cts +4 -3
  178. package/dist/voice/events.d.ts +4 -3
  179. package/dist/voice/events.d.ts.map +1 -1
  180. package/dist/voice/events.js +1 -1
  181. package/dist/voice/events.js.map +1 -1
  182. package/dist/voice/index.cjs +9 -1
  183. package/dist/voice/index.cjs.map +1 -1
  184. package/dist/voice/index.d.cts +1 -1
  185. package/dist/voice/index.d.ts +1 -1
  186. package/dist/voice/index.d.ts.map +1 -1
  187. package/dist/voice/index.js +10 -1
  188. package/dist/voice/index.js.map +1 -1
  189. package/dist/voice/remote_session.cjs +922 -0
  190. package/dist/voice/remote_session.cjs.map +1 -0
  191. package/dist/voice/remote_session.d.cts +108 -0
  192. package/dist/voice/remote_session.d.ts +108 -0
  193. package/dist/voice/remote_session.d.ts.map +1 -0
  194. package/dist/voice/remote_session.js +887 -0
  195. package/dist/voice/remote_session.js.map +1 -0
  196. package/dist/voice/report.cjs +11 -10
  197. package/dist/voice/report.cjs.map +1 -1
  198. package/dist/voice/report.d.cts +5 -3
  199. package/dist/voice/report.d.ts +5 -3
  200. package/dist/voice/report.d.ts.map +1 -1
  201. package/dist/voice/report.js +11 -10
  202. package/dist/voice/report.js.map +1 -1
  203. package/dist/voice/report.test.cjs +15 -0
  204. package/dist/voice/report.test.cjs.map +1 -1
  205. package/dist/voice/report.test.js +15 -0
  206. package/dist/voice/report.test.js.map +1 -1
  207. package/dist/voice/room_io/room_io.cjs +39 -0
  208. package/dist/voice/room_io/room_io.cjs.map +1 -1
  209. package/dist/voice/room_io/room_io.d.cts +3 -1
  210. package/dist/voice/room_io/room_io.d.ts +3 -1
  211. package/dist/voice/room_io/room_io.d.ts.map +1 -1
  212. package/dist/voice/room_io/room_io.js +40 -1
  213. package/dist/voice/room_io/room_io.js.map +1 -1
  214. package/dist/voice/turn_config/interruption.cjs.map +1 -1
  215. package/dist/voice/turn_config/interruption.d.cts +1 -1
  216. package/dist/voice/turn_config/interruption.d.ts +1 -1
  217. package/dist/voice/turn_config/interruption.d.ts.map +1 -1
  218. package/dist/voice/turn_config/interruption.js.map +1 -1
  219. package/dist/voice/turn_config/utils.cjs +95 -35
  220. package/dist/voice/turn_config/utils.cjs.map +1 -1
  221. package/dist/voice/turn_config/utils.d.cts +17 -5
  222. package/dist/voice/turn_config/utils.d.ts +17 -5
  223. package/dist/voice/turn_config/utils.d.ts.map +1 -1
  224. package/dist/voice/turn_config/utils.js +93 -35
  225. package/dist/voice/turn_config/utils.js.map +1 -1
  226. package/dist/voice/turn_config/utils.test.cjs +83 -41
  227. package/dist/voice/turn_config/utils.test.cjs.map +1 -1
  228. package/dist/voice/turn_config/utils.test.js +84 -42
  229. package/dist/voice/turn_config/utils.test.js.map +1 -1
  230. package/dist/worker.cjs +6 -29
  231. package/dist/worker.cjs.map +1 -1
  232. package/dist/worker.d.ts.map +1 -1
  233. package/dist/worker.js +6 -19
  234. package/dist/worker.js.map +1 -1
  235. package/package.json +3 -2
  236. package/src/cli.ts +2 -0
  237. package/src/constants.ts +1 -0
  238. package/src/cpu.test.ts +239 -0
  239. package/src/cpu.ts +173 -0
  240. package/src/index.ts +13 -15
  241. package/src/inference/interruption/defaults.ts +1 -1
  242. package/src/inference/interruption/http_transport.ts +49 -30
  243. package/src/inference/interruption/interruption_detector.ts +22 -6
  244. package/src/inference/interruption/interruption_stream.ts +4 -4
  245. package/src/inference/interruption/types.ts +2 -2
  246. package/src/inference/interruption/ws_transport.ts +63 -59
  247. package/src/inference/llm.ts +3 -1
  248. package/src/inference/stt.test.ts +17 -0
  249. package/src/inference/stt.ts +22 -14
  250. package/src/inference/tts.test.ts +12 -0
  251. package/src/inference/tts.ts +22 -6
  252. package/src/ipc/job_proc_lazy_main.ts +44 -24
  253. package/src/job.ts +1 -1
  254. package/src/language.test.ts +62 -0
  255. package/src/language.ts +380 -0
  256. package/src/llm/index.ts +2 -0
  257. package/src/stream/deferred_stream.ts +5 -1
  258. package/src/stt/stt.ts +2 -1
  259. package/src/utils.ts +20 -0
  260. package/src/voice/agent.test.ts +208 -1
  261. package/src/voice/agent.ts +21 -22
  262. package/src/voice/agent_activity.test.ts +194 -0
  263. package/src/voice/agent_activity.ts +161 -43
  264. package/src/voice/agent_session.ts +103 -92
  265. package/src/voice/audio_recognition.ts +124 -61
  266. package/src/voice/audio_recognition_span.test.ts +115 -35
  267. package/src/voice/events.ts +4 -3
  268. package/src/voice/index.ts +10 -1
  269. package/src/voice/remote_session.ts +1083 -0
  270. package/src/voice/report.test.ts +22 -3
  271. package/src/voice/report.ts +31 -14
  272. package/src/voice/room_io/room_io.ts +52 -2
  273. package/src/voice/turn_config/interruption.ts +1 -1
  274. package/src/voice/turn_config/utils.test.ts +91 -43
  275. package/src/voice/turn_config/utils.ts +120 -56
  276. package/src/worker.ts +34 -50
  277. package/dist/voice/client_events.cjs +0 -554
  278. package/dist/voice/client_events.cjs.map +0 -1
  279. package/dist/voice/client_events.d.cts +0 -195
  280. package/dist/voice/client_events.d.ts +0 -195
  281. package/dist/voice/client_events.d.ts.map +0 -1
  282. package/dist/voice/client_events.js +0 -548
  283. package/dist/voice/client_events.js.map +0 -1
  284. package/dist/voice/wire_format.cjs +0 -798
  285. package/dist/voice/wire_format.cjs.map +0 -1
  286. package/dist/voice/wire_format.d.cts +0 -5503
  287. package/dist/voice/wire_format.d.ts +0 -5503
  288. package/dist/voice/wire_format.d.ts.map +0 -1
  289. package/dist/voice/wire_format.js +0 -728
  290. package/dist/voice/wire_format.js.map +0 -1
  291. package/src/voice/client_events.ts +0 -838
  292. package/src/voice/wire_format.ts +0 -827
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/voice/turn_config/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { log } from '../../log.js';\nimport {\n type AgentSessionOptions,\n type InternalSessionOptions,\n defaultSessionOptions,\n} from '../agent_session.js';\nimport { defaultEndpointingOptions } from './endpointing.js';\nimport { defaultInterruptionOptions } from './interruption.js';\nimport { type TurnHandlingOptions, defaultTurnHandlingOptions } from './turn_handling.js';\n\nexport function migrateLegacyOptions<UserData>(\n legacyOptions: AgentSessionOptions<UserData>,\n): AgentSessionOptions<UserData> & { options: InternalSessionOptions } {\n const logger = log();\n const { voiceOptions, turnDetection, options: sessionOptions, ...rest } = legacyOptions;\n\n if (voiceOptions !== undefined && sessionOptions !== undefined) {\n logger.warn(\n 'Both voiceOptions and options have been supplied as part of the AgentSessionOptions, voiceOptions will be merged with options taking precedence',\n );\n }\n\n // Preserve turnDetection before cloning since structuredClone converts class instances to plain objects\n const originalTurnDetection =\n sessionOptions?.turnHandling?.turnDetection ??\n voiceOptions?.turnHandling?.turnDetection ??\n turnDetection;\n\n // Exclude potentially non-cloneable turnDetection objects before structuredClone.\n // They are restored from originalTurnDetection below.\n const cloneableVoiceOptions = voiceOptions\n ? {\n ...voiceOptions,\n turnHandling: voiceOptions.turnHandling\n ? { ...voiceOptions.turnHandling, turnDetection: undefined }\n : voiceOptions.turnHandling,\n }\n : voiceOptions;\n const cloneableSessionOptions = sessionOptions\n ? {\n ...sessionOptions,\n turnHandling: sessionOptions.turnHandling\n ? { ...sessionOptions.turnHandling, turnDetection: undefined }\n : sessionOptions.turnHandling,\n }\n : sessionOptions;\n\n const mergedOptions = structuredClone({ ...cloneableVoiceOptions, ...cloneableSessionOptions });\n\n const turnHandling: TurnHandlingOptions = {\n interruption: {\n discardAudioIfUninterruptible: mergedOptions?.discardAudioIfUninterruptible,\n minDuration: mergedOptions?.minInterruptionDuration,\n minWords: mergedOptions?.minInterruptionWords,\n },\n endpointing: {\n minDelay: mergedOptions?.minEndpointingDelay,\n maxDelay: mergedOptions?.maxEndpointingDelay,\n },\n\n ...mergedOptions.turnHandling,\n // Restore original turnDetection after spread to preserve class instance with methods\n // (structuredClone converts class instances to plain objects, losing prototype methods)\n turnDetection: originalTurnDetection,\n } as const;\n\n if (mergedOptions?.allowInterruptions === false) {\n turnHandling.interruption.enabled = false;\n }\n\n const optionsWithDefaults = {\n ...defaultSessionOptions,\n ...mergedOptions,\n turnHandling: mergeWithDefaults(turnHandling),\n };\n\n const newAgentSessionOptions: AgentSessionOptions<UserData> & {\n options: InternalSessionOptions;\n } = {\n ...rest,\n options: optionsWithDefaults,\n voiceOptions: optionsWithDefaults,\n turnDetection: turnHandling.turnDetection,\n };\n\n return newAgentSessionOptions;\n}\n\n/** Remove keys whose value is `undefined` so they don't shadow defaults when spread. */\nexport function stripUndefined<T extends object>(obj: T): Partial<T> {\n return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)) as Partial<T>;\n}\n\nexport function mergeWithDefaults(config: TurnHandlingOptions) {\n return {\n turnDetection: config.turnDetection ?? defaultTurnHandlingOptions.turnDetection,\n endpointing: { ...defaultEndpointingOptions, ...stripUndefined(config.endpointing) },\n interruption: { ...defaultInterruptionOptions, ...stripUndefined(config.interruption) },\n } as const;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAAoB;AACpB,2BAIO;AACP,yBAA0C;AAC1C,0BAA2C;AAC3C,2BAAqE;AAE9D,SAAS,qBACd,eACqE;AAfvE;AAgBE,QAAM,aAAS,gBAAI;AACnB,QAAM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AAC,CAAC,EAAE,CAAC,MAAM,MAAM,MAAS,CAAC;AAClF;AAEO,SAAS,kBAAkB,QAA6B;AAC7D,SAAO;AAAA,IACL,eAAe,OAAO,iBAAiB,gDAA2B;AAAA,IAClE,aAAa,EAAE,GAAG,8CAA2B,GAAG,eAAe,OAAO,WAAW,EAAE;AAAA,IACnF,cAAc,EAAE,GAAG,gDAA4B,GAAG,eAAe,OAAO,YAAY,EAAE;AAAA,EACxF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/voice/turn_config/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { log } from '../../log.js';\nimport {\n type AgentSessionOptions,\n type InternalSessionOptions,\n type TurnDetectionMode,\n type VoiceOptions,\n} from '../agent_session.js';\nimport { defaultEndpointingOptions } from './endpointing.js';\nimport { defaultInterruptionOptions } from './interruption.js';\nimport { type TurnHandlingOptions, defaultTurnHandlingOptions } from './turn_handling.js';\n\nconst defaultSessionOptions = {\n maxToolSteps: 3,\n preemptiveGeneration: true,\n userAwayTimeout: 15.0,\n aecWarmupDuration: 3000,\n turnHandling: {},\n useTtsAlignedTranscript: true,\n} as const satisfies AgentSessionOptions;\n\nconst defaultLegacyVoiceOptions: VoiceOptions = {\n minEndpointingDelay: defaultTurnHandlingOptions.endpointing.minDelay,\n maxEndpointingDelay: defaultTurnHandlingOptions.endpointing.maxDelay,\n maxToolSteps: defaultSessionOptions.maxToolSteps,\n preemptiveGeneration: defaultSessionOptions.preemptiveGeneration,\n};\n\nexport function migrateLegacyOptions<UserData>(legacyOptions: AgentSessionOptions<UserData>): {\n agentSessionOptions: InternalSessionOptions<UserData>;\n legacyVoiceOptions: VoiceOptions;\n} {\n const logger = log();\n const {\n voiceOptions,\n turnDetection,\n stt,\n vad,\n llm,\n tts,\n userData,\n connOptions,\n ...sessionOptions\n } = legacyOptions;\n\n if (voiceOptions !== undefined) {\n logger.warn(\n 'voiceOptions is deprecated, use top-level SessionOptions fields on AgentSessionOptions instead',\n );\n }\n\n const turnHandling: TurnHandlingOptions = {\n interruption: {\n discardAudioIfUninterruptible: voiceOptions?.discardAudioIfUninterruptible,\n minDuration: voiceOptions?.minInterruptionDuration,\n minWords: voiceOptions?.minInterruptionWords,\n ...sessionOptions.turnHandling?.interruption,\n },\n endpointing: {\n minDelay: voiceOptions?.minEndpointingDelay,\n maxDelay: voiceOptions?.maxEndpointingDelay,\n ...sessionOptions.turnHandling?.endpointing,\n },\n\n turnDetection: sessionOptions?.turnHandling?.turnDetection ?? turnDetection,\n } as const;\n\n if (\n voiceOptions?.allowInterruptions === false &&\n turnHandling.interruption.enabled === undefined\n ) {\n turnHandling.interruption.enabled = false;\n }\n\n const migratedVoiceOptions: AgentSessionOptions<UserData> = {};\n\n if (voiceOptions?.maxToolSteps !== undefined) {\n migratedVoiceOptions.maxToolSteps = voiceOptions.maxToolSteps;\n }\n if (voiceOptions?.preemptiveGeneration !== undefined) {\n migratedVoiceOptions.preemptiveGeneration = voiceOptions.preemptiveGeneration;\n }\n if (voiceOptions?.userAwayTimeout !== undefined) {\n migratedVoiceOptions.userAwayTimeout = voiceOptions.userAwayTimeout;\n }\n\n const legacyVoiceOptions = { ...defaultLegacyVoiceOptions, ...voiceOptions };\n\n const agentSessionOptions = {\n stt,\n vad,\n llm,\n tts,\n userData,\n connOptions,\n ...defaultSessionOptions,\n ...migratedVoiceOptions,\n ...sessionOptions,\n turnHandling: mergeWithDefaults(turnHandling),\n // repopulate the deprecated voice options with migrated options for backwards compatibility\n voiceOptions: legacyVoiceOptions,\n };\n\n return { agentSessionOptions, legacyVoiceOptions };\n}\n\n/** Remove keys whose value is `undefined` so they don't shadow defaults when spread. */\nexport function stripUndefined<T extends object>(obj: T): Partial<T> {\n return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)) as Partial<T>;\n}\n\nexport function mergeWithDefaults(config: TurnHandlingOptions) {\n return {\n turnDetection: config.turnDetection ?? defaultTurnHandlingOptions.turnDetection,\n endpointing: { ...defaultEndpointingOptions, ...stripUndefined(config.endpointing) },\n interruption: { ...defaultInterruptionOptions, ...stripUndefined(config.interruption) },\n } as const;\n}\n\n/**\n * Build a partial {@link TurnHandlingOptions} from deprecated Agent constructor fields.\n * Mirrors the Python Agent compatibility path, but keeps the JS API surface explicit.\n */\nexport function migrateTurnHandling(opts: {\n turnDetection?: TurnDetectionMode;\n allowInterruptions?: boolean;\n minEndpointingDelay?: number;\n maxEndpointingDelay?: number;\n turnHandling?: TurnHandlingOptions;\n}): Partial<TurnHandlingOptions> {\n if (opts.turnHandling !== undefined) {\n return opts.turnHandling;\n }\n\n const migrated: Partial<TurnHandlingOptions> = {};\n\n const endpointing: Partial<TurnHandlingOptions['endpointing']> = {};\n if (opts.minEndpointingDelay !== undefined) {\n endpointing.minDelay = opts.minEndpointingDelay;\n }\n if (opts.maxEndpointingDelay !== undefined) {\n endpointing.maxDelay = opts.maxEndpointingDelay;\n }\n if (Object.keys(endpointing).length > 0) {\n migrated.endpointing = endpointing;\n }\n\n const interruption: Partial<TurnHandlingOptions['interruption']> = {};\n if (opts.allowInterruptions === false) {\n interruption.enabled = false;\n }\n if (Object.keys(interruption).length > 0) {\n migrated.interruption = interruption;\n }\n\n if (opts.turnDetection !== undefined) {\n migrated.turnDetection = opts.turnDetection;\n }\n\n return {\n ...(migrated.endpointing ? { endpointing: migrated.endpointing } : {}),\n ...(migrated.interruption ? { interruption: migrated.interruption } : {}),\n ...(migrated.turnDetection !== undefined ? { turnDetection: migrated.turnDetection } : {}),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,iBAAoB;AACpB,2BAKO;AACP,yBAA0C;AAC1C,0BAA2C;AAC3C,2BAAqE;AAErE,MAAM,wBAAwB;AAAA,EAC5B,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,mBAAmB;AAA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GAAI,SAAS,cAAc,EAAE,aAAa,SAAS,YAAY,IAAI,CAAC;AAAA,IACpE,GAAI,SAAS,eAAe,EAAE,cAAc,SAAS,aAAa,IAAI,CAAC;AAAA,IACvE,GAAI,SAAS,kBAAkB,SAAY,EAAE,eAAe,SAAS,cAAc,IAAI,CAAC;AAAA,EAC1F;AACF;","names":[]}
@@ -1,12 +1,13 @@
1
- import { type AgentSessionOptions, type InternalSessionOptions } from '../agent_session.js';
1
+ import { type AgentSessionOptions, type InternalSessionOptions, type TurnDetectionMode, type VoiceOptions } from '../agent_session.js';
2
2
  import { type TurnHandlingOptions } from './turn_handling.js';
3
- export declare function migrateLegacyOptions<UserData>(legacyOptions: AgentSessionOptions<UserData>): AgentSessionOptions<UserData> & {
4
- options: InternalSessionOptions;
3
+ export declare function migrateLegacyOptions<UserData>(legacyOptions: AgentSessionOptions<UserData>): {
4
+ agentSessionOptions: InternalSessionOptions<UserData>;
5
+ legacyVoiceOptions: VoiceOptions;
5
6
  };
6
7
  /** Remove keys whose value is `undefined` so they don't shadow defaults when spread. */
7
8
  export declare function stripUndefined<T extends object>(obj: T): Partial<T>;
8
9
  export declare function mergeWithDefaults(config: TurnHandlingOptions): {
9
- readonly turnDetection: import("../agent_session.js").TurnDetectionMode | undefined;
10
+ readonly turnDetection: TurnDetectionMode | undefined;
10
11
  readonly endpointing: {
11
12
  mode: "fixed" | "dynamic";
12
13
  minDelay: number;
@@ -14,7 +15,7 @@ export declare function mergeWithDefaults(config: TurnHandlingOptions): {
14
15
  };
15
16
  readonly interruption: {
16
17
  enabled: boolean;
17
- mode: false | "vad" | "adaptive" | undefined;
18
+ mode: "vad" | "adaptive" | undefined;
18
19
  discardAudioIfUninterruptible: boolean;
19
20
  minDuration: number;
20
21
  minWords: number;
@@ -22,4 +23,15 @@ export declare function mergeWithDefaults(config: TurnHandlingOptions): {
22
23
  resumeFalseInterruption: boolean;
23
24
  };
24
25
  };
26
+ /**
27
+ * Build a partial {@link TurnHandlingOptions} from deprecated Agent constructor fields.
28
+ * Mirrors the Python Agent compatibility path, but keeps the JS API surface explicit.
29
+ */
30
+ export declare function migrateTurnHandling(opts: {
31
+ turnDetection?: TurnDetectionMode;
32
+ allowInterruptions?: boolean;
33
+ minEndpointingDelay?: number;
34
+ maxEndpointingDelay?: number;
35
+ turnHandling?: TurnHandlingOptions;
36
+ }): Partial<TurnHandlingOptions>;
25
37
  //# sourceMappingURL=utils.d.ts.map
@@ -1,12 +1,13 @@
1
- import { type AgentSessionOptions, type InternalSessionOptions } from '../agent_session.js';
1
+ import { type AgentSessionOptions, type InternalSessionOptions, type TurnDetectionMode, type VoiceOptions } from '../agent_session.js';
2
2
  import { type TurnHandlingOptions } from './turn_handling.js';
3
- export declare function migrateLegacyOptions<UserData>(legacyOptions: AgentSessionOptions<UserData>): AgentSessionOptions<UserData> & {
4
- options: InternalSessionOptions;
3
+ export declare function migrateLegacyOptions<UserData>(legacyOptions: AgentSessionOptions<UserData>): {
4
+ agentSessionOptions: InternalSessionOptions<UserData>;
5
+ legacyVoiceOptions: VoiceOptions;
5
6
  };
6
7
  /** Remove keys whose value is `undefined` so they don't shadow defaults when spread. */
7
8
  export declare function stripUndefined<T extends object>(obj: T): Partial<T>;
8
9
  export declare function mergeWithDefaults(config: TurnHandlingOptions): {
9
- readonly turnDetection: import("../agent_session.js").TurnDetectionMode | undefined;
10
+ readonly turnDetection: TurnDetectionMode | undefined;
10
11
  readonly endpointing: {
11
12
  mode: "fixed" | "dynamic";
12
13
  minDelay: number;
@@ -14,7 +15,7 @@ export declare function mergeWithDefaults(config: TurnHandlingOptions): {
14
15
  };
15
16
  readonly interruption: {
16
17
  enabled: boolean;
17
- mode: false | "vad" | "adaptive" | undefined;
18
+ mode: "vad" | "adaptive" | undefined;
18
19
  discardAudioIfUninterruptible: boolean;
19
20
  minDuration: number;
20
21
  minWords: number;
@@ -22,4 +23,15 @@ export declare function mergeWithDefaults(config: TurnHandlingOptions): {
22
23
  resumeFalseInterruption: boolean;
23
24
  };
24
25
  };
26
+ /**
27
+ * Build a partial {@link TurnHandlingOptions} from deprecated Agent constructor fields.
28
+ * Mirrors the Python Agent compatibility path, but keeps the JS API surface explicit.
29
+ */
30
+ export declare function migrateTurnHandling(opts: {
31
+ turnDetection?: TurnDetectionMode;
32
+ allowInterruptions?: boolean;
33
+ minEndpointingDelay?: number;
34
+ maxEndpointingDelay?: number;
35
+ turnHandling?: TurnHandlingOptions;
36
+ }): Partial<TurnHandlingOptions>;
25
37
  //# sourceMappingURL=utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/voice/turn_config/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAE5B,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,mBAAmB,EAA8B,MAAM,oBAAoB,CAAC;AAE1F,wBAAgB,oBAAoB,CAAC,QAAQ,EAC3C,aAAa,EAAE,mBAAmB,CAAC,QAAQ,CAAC,GAC3C,mBAAmB,CAAC,QAAQ,CAAC,GAAG;IAAE,OAAO,EAAE,sBAAsB,CAAA;CAAE,CA0ErE;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEnE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,mBAAmB;;;;;;;;;;;;;;;;EAM5D"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/voice/turn_config/utils.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,YAAY,EAClB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EAAE,KAAK,mBAAmB,EAA8B,MAAM,oBAAoB,CAAC;AAkB1F,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,aAAa,EAAE,mBAAmB,CAAC,QAAQ,CAAC,GAAG;IAC5F,mBAAmB,EAAE,sBAAsB,CAAC,QAAQ,CAAC,CAAC;IACtD,kBAAkB,EAAE,YAAY,CAAC;CAClC,CAyEA;AAED,wFAAwF;AACxF,wBAAgB,cAAc,CAAC,CAAC,SAAS,MAAM,EAAE,GAAG,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEnE;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,mBAAmB;;;;;;;;;;;;;;;;EAM5D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE;IACxC,aAAa,CAAC,EAAE,iBAAiB,CAAC;IAClC,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmC/B"}
@@ -1,59 +1,85 @@
1
1
  import { log } from "../../log.js";
2
2
  import {
3
- defaultSessionOptions
4
3
  } from "../agent_session.js";
5
4
  import { defaultEndpointingOptions } from "./endpointing.js";
6
5
  import { defaultInterruptionOptions } from "./interruption.js";
7
6
  import { defaultTurnHandlingOptions } from "./turn_handling.js";
7
+ const defaultSessionOptions = {
8
+ maxToolSteps: 3,
9
+ preemptiveGeneration: true,
10
+ userAwayTimeout: 15,
11
+ aecWarmupDuration: 3e3,
12
+ turnHandling: {},
13
+ useTtsAlignedTranscript: true
14
+ };
15
+ const defaultLegacyVoiceOptions = {
16
+ minEndpointingDelay: defaultTurnHandlingOptions.endpointing.minDelay,
17
+ maxEndpointingDelay: defaultTurnHandlingOptions.endpointing.maxDelay,
18
+ maxToolSteps: defaultSessionOptions.maxToolSteps,
19
+ preemptiveGeneration: defaultSessionOptions.preemptiveGeneration
20
+ };
8
21
  function migrateLegacyOptions(legacyOptions) {
9
- var _a, _b;
22
+ var _a, _b, _c;
10
23
  const logger = log();
11
- const { voiceOptions, turnDetection, options: sessionOptions, ...rest } = legacyOptions;
12
- if (voiceOptions !== void 0 && sessionOptions !== void 0) {
24
+ const {
25
+ voiceOptions,
26
+ turnDetection,
27
+ stt,
28
+ vad,
29
+ llm,
30
+ tts,
31
+ userData,
32
+ connOptions,
33
+ ...sessionOptions
34
+ } = legacyOptions;
35
+ if (voiceOptions !== void 0) {
13
36
  logger.warn(
14
- "Both voiceOptions and options have been supplied as part of the AgentSessionOptions, voiceOptions will be merged with options taking precedence"
37
+ "voiceOptions is deprecated, use top-level SessionOptions fields on AgentSessionOptions instead"
15
38
  );
16
39
  }
17
- const originalTurnDetection = ((_a = sessionOptions == null ? void 0 : sessionOptions.turnHandling) == null ? void 0 : _a.turnDetection) ?? ((_b = voiceOptions == null ? void 0 : voiceOptions.turnHandling) == null ? void 0 : _b.turnDetection) ?? turnDetection;
18
- const cloneableVoiceOptions = voiceOptions ? {
19
- ...voiceOptions,
20
- turnHandling: voiceOptions.turnHandling ? { ...voiceOptions.turnHandling, turnDetection: void 0 } : voiceOptions.turnHandling
21
- } : voiceOptions;
22
- const cloneableSessionOptions = sessionOptions ? {
23
- ...sessionOptions,
24
- turnHandling: sessionOptions.turnHandling ? { ...sessionOptions.turnHandling, turnDetection: void 0 } : sessionOptions.turnHandling
25
- } : sessionOptions;
26
- const mergedOptions = structuredClone({ ...cloneableVoiceOptions, ...cloneableSessionOptions });
27
40
  const turnHandling = {
28
41
  interruption: {
29
- discardAudioIfUninterruptible: mergedOptions == null ? void 0 : mergedOptions.discardAudioIfUninterruptible,
30
- minDuration: mergedOptions == null ? void 0 : mergedOptions.minInterruptionDuration,
31
- minWords: mergedOptions == null ? void 0 : mergedOptions.minInterruptionWords
42
+ discardAudioIfUninterruptible: voiceOptions == null ? void 0 : voiceOptions.discardAudioIfUninterruptible,
43
+ minDuration: voiceOptions == null ? void 0 : voiceOptions.minInterruptionDuration,
44
+ minWords: voiceOptions == null ? void 0 : voiceOptions.minInterruptionWords,
45
+ ...(_a = sessionOptions.turnHandling) == null ? void 0 : _a.interruption
32
46
  },
33
47
  endpointing: {
34
- minDelay: mergedOptions == null ? void 0 : mergedOptions.minEndpointingDelay,
35
- maxDelay: mergedOptions == null ? void 0 : mergedOptions.maxEndpointingDelay
48
+ minDelay: voiceOptions == null ? void 0 : voiceOptions.minEndpointingDelay,
49
+ maxDelay: voiceOptions == null ? void 0 : voiceOptions.maxEndpointingDelay,
50
+ ...(_b = sessionOptions.turnHandling) == null ? void 0 : _b.endpointing
36
51
  },
37
- ...mergedOptions.turnHandling,
38
- // Restore original turnDetection after spread to preserve class instance with methods
39
- // (structuredClone converts class instances to plain objects, losing prototype methods)
40
- turnDetection: originalTurnDetection
52
+ turnDetection: ((_c = sessionOptions == null ? void 0 : sessionOptions.turnHandling) == null ? void 0 : _c.turnDetection) ?? turnDetection
41
53
  };
42
- if ((mergedOptions == null ? void 0 : mergedOptions.allowInterruptions) === false) {
54
+ if ((voiceOptions == null ? void 0 : voiceOptions.allowInterruptions) === false && turnHandling.interruption.enabled === void 0) {
43
55
  turnHandling.interruption.enabled = false;
44
56
  }
45
- const optionsWithDefaults = {
57
+ const migratedVoiceOptions = {};
58
+ if ((voiceOptions == null ? void 0 : voiceOptions.maxToolSteps) !== void 0) {
59
+ migratedVoiceOptions.maxToolSteps = voiceOptions.maxToolSteps;
60
+ }
61
+ if ((voiceOptions == null ? void 0 : voiceOptions.preemptiveGeneration) !== void 0) {
62
+ migratedVoiceOptions.preemptiveGeneration = voiceOptions.preemptiveGeneration;
63
+ }
64
+ if ((voiceOptions == null ? void 0 : voiceOptions.userAwayTimeout) !== void 0) {
65
+ migratedVoiceOptions.userAwayTimeout = voiceOptions.userAwayTimeout;
66
+ }
67
+ const legacyVoiceOptions = { ...defaultLegacyVoiceOptions, ...voiceOptions };
68
+ const agentSessionOptions = {
69
+ stt,
70
+ vad,
71
+ llm,
72
+ tts,
73
+ userData,
74
+ connOptions,
46
75
  ...defaultSessionOptions,
47
- ...mergedOptions,
48
- turnHandling: mergeWithDefaults(turnHandling)
49
- };
50
- const newAgentSessionOptions = {
51
- ...rest,
52
- options: optionsWithDefaults,
53
- voiceOptions: optionsWithDefaults,
54
- turnDetection: turnHandling.turnDetection
76
+ ...migratedVoiceOptions,
77
+ ...sessionOptions,
78
+ turnHandling: mergeWithDefaults(turnHandling),
79
+ // repopulate the deprecated voice options with migrated options for backwards compatibility
80
+ voiceOptions: legacyVoiceOptions
55
81
  };
56
- return newAgentSessionOptions;
82
+ return { agentSessionOptions, legacyVoiceOptions };
57
83
  }
58
84
  function stripUndefined(obj) {
59
85
  return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
@@ -65,9 +91,41 @@ function mergeWithDefaults(config) {
65
91
  interruption: { ...defaultInterruptionOptions, ...stripUndefined(config.interruption) }
66
92
  };
67
93
  }
94
+ function migrateTurnHandling(opts) {
95
+ if (opts.turnHandling !== void 0) {
96
+ return opts.turnHandling;
97
+ }
98
+ const migrated = {};
99
+ const endpointing = {};
100
+ if (opts.minEndpointingDelay !== void 0) {
101
+ endpointing.minDelay = opts.minEndpointingDelay;
102
+ }
103
+ if (opts.maxEndpointingDelay !== void 0) {
104
+ endpointing.maxDelay = opts.maxEndpointingDelay;
105
+ }
106
+ if (Object.keys(endpointing).length > 0) {
107
+ migrated.endpointing = endpointing;
108
+ }
109
+ const interruption = {};
110
+ if (opts.allowInterruptions === false) {
111
+ interruption.enabled = false;
112
+ }
113
+ if (Object.keys(interruption).length > 0) {
114
+ migrated.interruption = interruption;
115
+ }
116
+ if (opts.turnDetection !== void 0) {
117
+ migrated.turnDetection = opts.turnDetection;
118
+ }
119
+ return {
120
+ ...migrated.endpointing ? { endpointing: migrated.endpointing } : {},
121
+ ...migrated.interruption ? { interruption: migrated.interruption } : {},
122
+ ...migrated.turnDetection !== void 0 ? { turnDetection: migrated.turnDetection } : {}
123
+ };
124
+ }
68
125
  export {
69
126
  mergeWithDefaults,
70
127
  migrateLegacyOptions,
128
+ migrateTurnHandling,
71
129
  stripUndefined
72
130
  };
73
131
  //# sourceMappingURL=utils.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/voice/turn_config/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { log } from '../../log.js';\nimport {\n type AgentSessionOptions,\n type InternalSessionOptions,\n defaultSessionOptions,\n} from '../agent_session.js';\nimport { defaultEndpointingOptions } from './endpointing.js';\nimport { defaultInterruptionOptions } from './interruption.js';\nimport { type TurnHandlingOptions, defaultTurnHandlingOptions } from './turn_handling.js';\n\nexport function migrateLegacyOptions<UserData>(\n legacyOptions: AgentSessionOptions<UserData>,\n): AgentSessionOptions<UserData> & { options: InternalSessionOptions } {\n const logger = log();\n const { voiceOptions, turnDetection, options: sessionOptions, ...rest } = legacyOptions;\n\n if (voiceOptions !== undefined && sessionOptions !== undefined) {\n logger.warn(\n 'Both voiceOptions and options have been supplied as part of the AgentSessionOptions, voiceOptions will be merged with options taking precedence',\n );\n }\n\n // Preserve turnDetection before cloning since structuredClone converts class instances to plain objects\n const originalTurnDetection =\n sessionOptions?.turnHandling?.turnDetection ??\n voiceOptions?.turnHandling?.turnDetection ??\n turnDetection;\n\n // Exclude potentially non-cloneable turnDetection objects before structuredClone.\n // They are restored from originalTurnDetection below.\n const cloneableVoiceOptions = voiceOptions\n ? {\n ...voiceOptions,\n turnHandling: voiceOptions.turnHandling\n ? { ...voiceOptions.turnHandling, turnDetection: undefined }\n : voiceOptions.turnHandling,\n }\n : voiceOptions;\n const cloneableSessionOptions = sessionOptions\n ? {\n ...sessionOptions,\n turnHandling: sessionOptions.turnHandling\n ? { ...sessionOptions.turnHandling, turnDetection: undefined }\n : sessionOptions.turnHandling,\n }\n : sessionOptions;\n\n const mergedOptions = structuredClone({ ...cloneableVoiceOptions, ...cloneableSessionOptions });\n\n const turnHandling: TurnHandlingOptions = {\n interruption: {\n discardAudioIfUninterruptible: mergedOptions?.discardAudioIfUninterruptible,\n minDuration: mergedOptions?.minInterruptionDuration,\n minWords: mergedOptions?.minInterruptionWords,\n },\n endpointing: {\n minDelay: mergedOptions?.minEndpointingDelay,\n maxDelay: mergedOptions?.maxEndpointingDelay,\n },\n\n ...mergedOptions.turnHandling,\n // Restore original turnDetection after spread to preserve class instance with methods\n // (structuredClone converts class instances to plain objects, losing prototype methods)\n turnDetection: originalTurnDetection,\n } as const;\n\n if (mergedOptions?.allowInterruptions === false) {\n turnHandling.interruption.enabled = false;\n }\n\n const optionsWithDefaults = {\n ...defaultSessionOptions,\n ...mergedOptions,\n turnHandling: mergeWithDefaults(turnHandling),\n };\n\n const newAgentSessionOptions: AgentSessionOptions<UserData> & {\n options: InternalSessionOptions;\n } = {\n ...rest,\n options: optionsWithDefaults,\n voiceOptions: optionsWithDefaults,\n turnDetection: turnHandling.turnDetection,\n };\n\n return newAgentSessionOptions;\n}\n\n/** Remove keys whose value is `undefined` so they don't shadow defaults when spread. */\nexport function stripUndefined<T extends object>(obj: T): Partial<T> {\n return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)) as Partial<T>;\n}\n\nexport function mergeWithDefaults(config: TurnHandlingOptions) {\n return {\n turnDetection: config.turnDetection ?? defaultTurnHandlingOptions.turnDetection,\n endpointing: { ...defaultEndpointingOptions, ...stripUndefined(config.endpointing) },\n interruption: { ...defaultInterruptionOptions, ...stripUndefined(config.interruption) },\n } as const;\n}\n"],"mappings":"AAGA,SAAS,WAAW;AACpB;AAAA,EAGE;AAAA,OACK;AACP,SAAS,iCAAiC;AAC1C,SAAS,kCAAkC;AAC3C,SAAmC,kCAAkC;AAE9D,SAAS,qBACd,eACqE;AAfvE;AAgBE,QAAM,SAAS,IAAI;AACnB,QAAM,EAAE,cAAc,eAAe,SAAS,gBAAgB,GAAG,KAAK,IAAI;AAE1E,MAAI,iBAAiB,UAAa,mBAAmB,QAAW;AAC9D,WAAO;AA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,OAAO,iBAAiB,2BAA2B;AAAA,IAClE,aAAa,EAAE,GAAG,2BAA2B,GAAG,eAAe,OAAO,WAAW,EAAE;AAAA,IACnF,cAAc,EAAE,GAAG,4BAA4B,GAAG,eAAe,OAAO,YAAY,EAAE;AAAA,EACxF;AACF;","names":[]}
1
+ {"version":3,"sources":["../../../src/voice/turn_config/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { log } from '../../log.js';\nimport {\n type AgentSessionOptions,\n type InternalSessionOptions,\n type TurnDetectionMode,\n type VoiceOptions,\n} from '../agent_session.js';\nimport { defaultEndpointingOptions } from './endpointing.js';\nimport { defaultInterruptionOptions } from './interruption.js';\nimport { type TurnHandlingOptions, defaultTurnHandlingOptions } from './turn_handling.js';\n\nconst defaultSessionOptions = {\n maxToolSteps: 3,\n preemptiveGeneration: true,\n userAwayTimeout: 15.0,\n aecWarmupDuration: 3000,\n turnHandling: {},\n useTtsAlignedTranscript: true,\n} as const satisfies AgentSessionOptions;\n\nconst defaultLegacyVoiceOptions: VoiceOptions = {\n minEndpointingDelay: defaultTurnHandlingOptions.endpointing.minDelay,\n maxEndpointingDelay: defaultTurnHandlingOptions.endpointing.maxDelay,\n maxToolSteps: defaultSessionOptions.maxToolSteps,\n preemptiveGeneration: defaultSessionOptions.preemptiveGeneration,\n};\n\nexport function migrateLegacyOptions<UserData>(legacyOptions: AgentSessionOptions<UserData>): {\n agentSessionOptions: InternalSessionOptions<UserData>;\n legacyVoiceOptions: VoiceOptions;\n} {\n const logger = log();\n const {\n voiceOptions,\n turnDetection,\n stt,\n vad,\n llm,\n tts,\n userData,\n connOptions,\n ...sessionOptions\n } = legacyOptions;\n\n if (voiceOptions !== undefined) {\n logger.warn(\n 'voiceOptions is deprecated, use top-level SessionOptions fields on AgentSessionOptions instead',\n );\n }\n\n const turnHandling: TurnHandlingOptions = {\n interruption: {\n discardAudioIfUninterruptible: voiceOptions?.discardAudioIfUninterruptible,\n minDuration: voiceOptions?.minInterruptionDuration,\n minWords: voiceOptions?.minInterruptionWords,\n ...sessionOptions.turnHandling?.interruption,\n },\n endpointing: {\n minDelay: voiceOptions?.minEndpointingDelay,\n maxDelay: voiceOptions?.maxEndpointingDelay,\n ...sessionOptions.turnHandling?.endpointing,\n },\n\n turnDetection: sessionOptions?.turnHandling?.turnDetection ?? turnDetection,\n } as const;\n\n if (\n voiceOptions?.allowInterruptions === false &&\n turnHandling.interruption.enabled === undefined\n ) {\n turnHandling.interruption.enabled = false;\n }\n\n const migratedVoiceOptions: AgentSessionOptions<UserData> = {};\n\n if (voiceOptions?.maxToolSteps !== undefined) {\n migratedVoiceOptions.maxToolSteps = voiceOptions.maxToolSteps;\n }\n if (voiceOptions?.preemptiveGeneration !== undefined) {\n migratedVoiceOptions.preemptiveGeneration = voiceOptions.preemptiveGeneration;\n }\n if (voiceOptions?.userAwayTimeout !== undefined) {\n migratedVoiceOptions.userAwayTimeout = voiceOptions.userAwayTimeout;\n }\n\n const legacyVoiceOptions = { ...defaultLegacyVoiceOptions, ...voiceOptions };\n\n const agentSessionOptions = {\n stt,\n vad,\n llm,\n tts,\n userData,\n connOptions,\n ...defaultSessionOptions,\n ...migratedVoiceOptions,\n ...sessionOptions,\n turnHandling: mergeWithDefaults(turnHandling),\n // repopulate the deprecated voice options with migrated options for backwards compatibility\n voiceOptions: legacyVoiceOptions,\n };\n\n return { agentSessionOptions, legacyVoiceOptions };\n}\n\n/** Remove keys whose value is `undefined` so they don't shadow defaults when spread. */\nexport function stripUndefined<T extends object>(obj: T): Partial<T> {\n return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== undefined)) as Partial<T>;\n}\n\nexport function mergeWithDefaults(config: TurnHandlingOptions) {\n return {\n turnDetection: config.turnDetection ?? defaultTurnHandlingOptions.turnDetection,\n endpointing: { ...defaultEndpointingOptions, ...stripUndefined(config.endpointing) },\n interruption: { ...defaultInterruptionOptions, ...stripUndefined(config.interruption) },\n } as const;\n}\n\n/**\n * Build a partial {@link TurnHandlingOptions} from deprecated Agent constructor fields.\n * Mirrors the Python Agent compatibility path, but keeps the JS API surface explicit.\n */\nexport function migrateTurnHandling(opts: {\n turnDetection?: TurnDetectionMode;\n allowInterruptions?: boolean;\n minEndpointingDelay?: number;\n maxEndpointingDelay?: number;\n turnHandling?: TurnHandlingOptions;\n}): Partial<TurnHandlingOptions> {\n if (opts.turnHandling !== undefined) {\n return opts.turnHandling;\n }\n\n const migrated: Partial<TurnHandlingOptions> = {};\n\n const endpointing: Partial<TurnHandlingOptions['endpointing']> = {};\n if (opts.minEndpointingDelay !== undefined) {\n endpointing.minDelay = opts.minEndpointingDelay;\n }\n if (opts.maxEndpointingDelay !== undefined) {\n endpointing.maxDelay = opts.maxEndpointingDelay;\n }\n if (Object.keys(endpointing).length > 0) {\n migrated.endpointing = endpointing;\n }\n\n const interruption: Partial<TurnHandlingOptions['interruption']> = {};\n if (opts.allowInterruptions === false) {\n interruption.enabled = false;\n }\n if (Object.keys(interruption).length > 0) {\n migrated.interruption = interruption;\n }\n\n if (opts.turnDetection !== undefined) {\n migrated.turnDetection = opts.turnDetection;\n }\n\n return {\n ...(migrated.endpointing ? { endpointing: migrated.endpointing } : {}),\n ...(migrated.interruption ? { interruption: migrated.interruption } : {}),\n ...(migrated.turnDetection !== undefined ? { turnDetection: migrated.turnDetection } : {}),\n };\n}\n"],"mappings":"AAGA,SAAS,WAAW;AACpB;AAAA,OAKO;AACP,SAAS,iCAAiC;AAC1C,SAAS,kCAAkC;AAC3C,SAAmC,kCAAkC;AAErE,MAAM,wBAAwB;AAAA,EAC5B,cAAc;AAAA,EACd,sBAAsB;AAAA,EACtB,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,cAAc,CAAC;AAAA,EACf,yBAAyB;AAC3B;AAEA,MAAM,4BAA0C;AAAA,EAC9C,qBAAqB,2BAA2B,YAAY;AAAA,EAC5D,qBAAqB,2BAA2B,YAAY;AAAA,EAC5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,SAAY,EAAE,eAAe,SAAS,cAAc,IAAI,CAAC;AAAA,EAC1F;AACF;","names":[]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  var import_vitest = require("vitest");
3
3
  var import_log = require("../../log.cjs");
4
+ var import_agent_session = require("../agent_session.cjs");
4
5
  var import_endpointing = require("./endpointing.cjs");
5
6
  var import_interruption = require("./interruption.cjs");
6
7
  var import_turn_handling = require("./turn_handling.cjs");
@@ -10,18 +11,18 @@ var import_utils = require("./utils.cjs");
10
11
  });
11
12
  (0, import_vitest.describe)("migrateLegacyOptions", () => {
12
13
  (0, import_vitest.it)("should return all defaults when no options are provided", () => {
13
- const result = (0, import_utils.migrateLegacyOptions)({});
14
- (0, import_vitest.expect)(result.options.turnHandling).toEqual({
14
+ const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({});
15
+ (0, import_vitest.expect)(result.turnHandling).toEqual({
15
16
  turnDetection: import_turn_handling.defaultTurnHandlingOptions.turnDetection,
16
17
  endpointing: import_endpointing.defaultEndpointingOptions,
17
18
  interruption: import_interruption.defaultInterruptionOptions
18
19
  });
19
- (0, import_vitest.expect)(result.options.maxToolSteps).toBe(3);
20
- (0, import_vitest.expect)(result.options.preemptiveGeneration).toBe(false);
21
- (0, import_vitest.expect)(result.options.userAwayTimeout).toBe(15);
20
+ (0, import_vitest.expect)(result.maxToolSteps).toBe(import_agent_session.defaultAgentSessionOptions.maxToolSteps);
21
+ (0, import_vitest.expect)(result.preemptiveGeneration).toBe(import_agent_session.defaultAgentSessionOptions.preemptiveGeneration);
22
+ (0, import_vitest.expect)(result.userAwayTimeout).toBe(import_agent_session.defaultAgentSessionOptions.userAwayTimeout);
22
23
  });
23
24
  (0, import_vitest.it)("should migrate legacy flat fields into nested turnHandling config", () => {
24
- const result = (0, import_utils.migrateLegacyOptions)({
25
+ const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({
25
26
  voiceOptions: {
26
27
  minInterruptionDuration: 1e3,
27
28
  minInterruptionWords: 3,
@@ -30,57 +31,98 @@ var import_utils = require("./utils.cjs");
30
31
  maxEndpointingDelay: 5e3
31
32
  }
32
33
  });
33
- (0, import_vitest.expect)(result.options.turnHandling.interruption.minDuration).toBe(1e3);
34
- (0, import_vitest.expect)(result.options.turnHandling.interruption.minWords).toBe(3);
35
- (0, import_vitest.expect)(result.options.turnHandling.interruption.discardAudioIfUninterruptible).toBe(false);
36
- (0, import_vitest.expect)(result.options.turnHandling.endpointing.minDelay).toBe(800);
37
- (0, import_vitest.expect)(result.options.turnHandling.endpointing.maxDelay).toBe(5e3);
34
+ (0, import_vitest.expect)(result.turnHandling.interruption.minDuration).toBe(1e3);
35
+ (0, import_vitest.expect)(result.turnHandling.interruption.minWords).toBe(3);
36
+ (0, import_vitest.expect)(result.turnHandling.interruption.discardAudioIfUninterruptible).toBe(false);
37
+ (0, import_vitest.expect)(result.turnHandling.endpointing.minDelay).toBe(800);
38
+ (0, import_vitest.expect)(result.turnHandling.endpointing.maxDelay).toBe(5e3);
38
39
  });
39
40
  (0, import_vitest.it)("should set interruption.enabled to false when allowInterruptions is false", () => {
40
- const result = (0, import_utils.migrateLegacyOptions)({
41
- options: {
42
- allowInterruptions: false
43
- }
41
+ const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({
42
+ voiceOptions: { allowInterruptions: false }
44
43
  });
45
- (0, import_vitest.expect)(result.options.turnHandling.interruption.enabled).toBe(false);
44
+ (0, import_vitest.expect)(result.turnHandling.interruption.enabled).toBe(false);
46
45
  });
47
- (0, import_vitest.it)("should give options precedence over voiceOptions when both are provided", () => {
48
- const result = (0, import_utils.migrateLegacyOptions)({
46
+ (0, import_vitest.it)("should give top-level fields precedence over voiceOptions", () => {
47
+ const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({
49
48
  voiceOptions: {
50
49
  minInterruptionDuration: 1e3,
51
50
  maxEndpointingDelay: 5e3,
52
51
  maxToolSteps: 10
53
52
  },
54
- options: {
55
- minInterruptionDuration: 2e3,
56
- maxEndpointingDelay: 8e3,
57
- maxToolSteps: 5
58
- }
59
- });
60
- (0, import_vitest.expect)(result.options.turnHandling.interruption.minDuration).toBe(2e3);
61
- (0, import_vitest.expect)(result.options.turnHandling.endpointing.maxDelay).toBe(8e3);
62
- (0, import_vitest.expect)(result.options.maxToolSteps).toBe(5);
63
- });
64
- (0, import_vitest.it)("should let explicit turnHandling override legacy flat fields", () => {
65
- const result = (0, import_utils.migrateLegacyOptions)({
66
- options: {
67
- minInterruptionDuration: 1e3,
68
- minEndpointingDelay: 800,
69
- turnHandling: {
70
- interruption: { minDuration: 3e3 },
71
- endpointing: { minDelay: 2e3 }
53
+ turnHandling: {
54
+ interruption: {
55
+ minDuration: 2e3
56
+ },
57
+ endpointing: {
58
+ maxDelay: 8e3
72
59
  }
73
- }
60
+ },
61
+ maxToolSteps: 5
74
62
  });
75
- (0, import_vitest.expect)(result.options.turnHandling.interruption.minDuration).toBe(3e3);
76
- (0, import_vitest.expect)(result.options.turnHandling.endpointing.minDelay).toBe(2e3);
63
+ (0, import_vitest.expect)(result.turnHandling.interruption.minDuration).toBe(2e3);
64
+ (0, import_vitest.expect)(result.turnHandling.endpointing.maxDelay).toBe(8e3);
65
+ (0, import_vitest.expect)(result.maxToolSteps).toBe(5);
77
66
  });
78
67
  (0, import_vitest.it)("should preserve top-level turnDetection in the result", () => {
79
- const result = (0, import_utils.migrateLegacyOptions)({
68
+ const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({
80
69
  turnDetection: "vad"
81
70
  });
71
+ (0, import_vitest.expect)(result.turnHandling.turnDetection).toBe("vad");
72
+ });
73
+ });
74
+ (0, import_vitest.describe)("migrateTurnHandling", () => {
75
+ (0, import_vitest.it)("should return empty partial when no deprecated Agent fields are given", () => {
76
+ const result = (0, import_utils.migrateTurnHandling)({});
77
+ (0, import_vitest.expect)(result).toEqual({});
78
+ });
79
+ (0, import_vitest.it)("should set interruption.enabled to false when allowInterruptions is false", () => {
80
+ const result = (0, import_utils.migrateTurnHandling)({ allowInterruptions: false });
81
+ (0, import_vitest.expect)(result.interruption).toEqual({ enabled: false });
82
+ (0, import_vitest.expect)(result.endpointing).toBeUndefined();
83
+ (0, import_vitest.expect)(result.turnDetection).toBeUndefined();
84
+ });
85
+ (0, import_vitest.it)("should not set interruption when allowInterruptions is true or undefined", () => {
86
+ (0, import_vitest.expect)((0, import_utils.migrateTurnHandling)({ allowInterruptions: true })).toEqual({});
87
+ (0, import_vitest.expect)((0, import_utils.migrateTurnHandling)({ allowInterruptions: void 0 })).toEqual({});
88
+ });
89
+ (0, import_vitest.it)("should map minEndpointingDelay to endpointing.minDelay", () => {
90
+ const result = (0, import_utils.migrateTurnHandling)({ minEndpointingDelay: 800 });
91
+ (0, import_vitest.expect)(result.endpointing).toEqual({ minDelay: 800 });
92
+ });
93
+ (0, import_vitest.it)("should map maxEndpointingDelay to endpointing.maxDelay", () => {
94
+ const result = (0, import_utils.migrateTurnHandling)({ maxEndpointingDelay: 5e3 });
95
+ (0, import_vitest.expect)(result.endpointing).toEqual({ maxDelay: 5e3 });
96
+ });
97
+ (0, import_vitest.it)("should pass through turnDetection", () => {
98
+ const result = (0, import_utils.migrateTurnHandling)({ turnDetection: "vad" });
82
99
  (0, import_vitest.expect)(result.turnDetection).toBe("vad");
83
- (0, import_vitest.expect)(result.options.turnHandling.turnDetection).toBe("vad");
100
+ });
101
+ (0, import_vitest.it)("should combine all deprecated Agent fields", () => {
102
+ const result = (0, import_utils.migrateTurnHandling)({
103
+ turnDetection: "stt",
104
+ allowInterruptions: false,
105
+ minEndpointingDelay: 400,
106
+ maxEndpointingDelay: 3e3
107
+ });
108
+ (0, import_vitest.expect)(result.turnDetection).toBe("stt");
109
+ (0, import_vitest.expect)(result.interruption).toEqual({ enabled: false });
110
+ (0, import_vitest.expect)(result.endpointing).toEqual({ minDelay: 400, maxDelay: 3e3 });
111
+ });
112
+ (0, import_vitest.it)("should ignore deprecated Agent fields when explicit turnHandling is provided", () => {
113
+ const turnHandling = {
114
+ endpointing: { minDelay: 999, maxDelay: 4e3 },
115
+ interruption: { enabled: true },
116
+ turnDetection: "vad"
117
+ };
118
+ const result = (0, import_utils.migrateTurnHandling)({
119
+ turnHandling,
120
+ turnDetection: "stt",
121
+ allowInterruptions: false,
122
+ minEndpointingDelay: 100,
123
+ maxEndpointingDelay: 200
124
+ });
125
+ (0, import_vitest.expect)(result).toEqual(turnHandling);
84
126
  });
85
127
  });
86
128
  //# sourceMappingURL=utils.test.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/voice/turn_config/utils.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { beforeAll, describe, expect, it } from 'vitest';\nimport { initializeLogger } from '../../log.js';\nimport { defaultEndpointingOptions } from './endpointing.js';\nimport { defaultInterruptionOptions } from './interruption.js';\nimport { defaultTurnHandlingOptions } from './turn_handling.js';\nimport { migrateLegacyOptions } from './utils.js';\n\nbeforeAll(() => {\n initializeLogger({ pretty: true, level: 'info' });\n});\n\ndescribe('migrateLegacyOptions', () => {\n it('should return all defaults when no options are provided', () => {\n const result = migrateLegacyOptions({});\n\n expect(result.options.turnHandling).toEqual({\n turnDetection: defaultTurnHandlingOptions.turnDetection,\n endpointing: defaultEndpointingOptions,\n interruption: defaultInterruptionOptions,\n });\n expect(result.options.maxToolSteps).toBe(3);\n expect(result.options.preemptiveGeneration).toBe(false);\n expect(result.options.userAwayTimeout).toBe(15.0);\n });\n\n it('should migrate legacy flat fields into nested turnHandling config', () => {\n const result = migrateLegacyOptions({\n voiceOptions: {\n minInterruptionDuration: 1000,\n minInterruptionWords: 3,\n discardAudioIfUninterruptible: false,\n minEndpointingDelay: 800,\n maxEndpointingDelay: 5000,\n },\n });\n\n expect(result.options.turnHandling.interruption!.minDuration).toBe(1000);\n expect(result.options.turnHandling.interruption!.minWords).toBe(3);\n expect(result.options.turnHandling.interruption!.discardAudioIfUninterruptible).toBe(false);\n expect(result.options.turnHandling.endpointing!.minDelay).toBe(800);\n expect(result.options.turnHandling.endpointing!.maxDelay).toBe(5000);\n });\n\n it('should set interruption.enabled to false when allowInterruptions is false', () => {\n const result = migrateLegacyOptions({\n options: {\n allowInterruptions: false,\n },\n });\n\n expect(result.options.turnHandling.interruption!.enabled).toBe(false);\n });\n\n it('should give options precedence over voiceOptions when both are provided', () => {\n const result = migrateLegacyOptions({\n voiceOptions: {\n minInterruptionDuration: 1000,\n maxEndpointingDelay: 5000,\n maxToolSteps: 10,\n },\n options: {\n minInterruptionDuration: 2000,\n maxEndpointingDelay: 8000,\n maxToolSteps: 5,\n },\n });\n\n expect(result.options.turnHandling.interruption!.minDuration).toBe(2000);\n expect(result.options.turnHandling.endpointing!.maxDelay).toBe(8000);\n expect(result.options.maxToolSteps).toBe(5);\n });\n\n it('should let explicit turnHandling override legacy flat fields', () => {\n const result = migrateLegacyOptions({\n options: {\n minInterruptionDuration: 1000,\n minEndpointingDelay: 800,\n turnHandling: {\n interruption: { minDuration: 3000 },\n endpointing: { minDelay: 2000 },\n },\n },\n });\n\n expect(result.options.turnHandling.interruption!.minDuration).toBe(3000);\n expect(result.options.turnHandling.endpointing!.minDelay).toBe(2000);\n });\n\n it('should preserve top-level turnDetection in the result', () => {\n const result = migrateLegacyOptions({\n turnDetection: 'vad',\n });\n\n expect(result.turnDetection).toBe('vad');\n expect(result.options.turnHandling.turnDetection).toBe('vad');\n });\n});\n"],"mappings":";AAGA,oBAAgD;AAChD,iBAAiC;AACjC,yBAA0C;AAC1C,0BAA2C;AAC3C,2BAA2C;AAC3C,mBAAqC;AAAA,IAErC,yBAAU,MAAM;AACd,mCAAiB,EAAE,QAAQ,MAAM,OAAO,OAAO,CAAC;AAClD,CAAC;AAAA,IAED,wBAAS,wBAAwB,MAAM;AACrC,wBAAG,2DAA2D,MAAM;AAClE,UAAM,aAAS,mCAAqB,CAAC,CAAC;AAEtC,8BAAO,OAAO,QAAQ,YAAY,EAAE,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AA,IACF,CAAC;AAED,8BAAO,OAAO,QAAQ,aAAa,aAAc,WAAW,EAAE,KAAK,GAAI;AACvE,8BAAO,OAAO,QAAQ,aAAa,YAAa,QAAQ,EAAE,KAAK,GAAI;AACnE,8BAAO,OAAO,QAAQ,YAAY,EAAE,KAAK,CAAC;AAAA,EAC5C,CAAC;AAED,wBAAG,gEAAgE,MAAM;AACvE,UAAM,aAAS,mCAAqB;AAAA,MAClC,SAAS;AAAA,QACP,yBAAyB;AAAA,QACzB,qBAAqB;AAAA,QACrB,cAAc;AAAA,UACZ,cAAc,EAAE,aAAa,IAAK;AAAA,UAClC,aAAa,EAAE,UAAU,IAAK;AAAA,QAChC;AAAA,MACF;AAAA,IACF,CAAC;AAED,8BAAO,OAAO,QAAQ,aAAa,aAAc,WAAW,EAAE,KAAK,GAAI;AACvE,8BAAO,OAAO,QAAQ,aAAa,YAAa,QAAQ,EAAE,KAAK,GAAI;AAAA,EACrE,CAAC;AAED,wBAAG,yDAAyD,MAAM;AAChE,UAAM,aAAS,mCAAqB;AAAA,MAClC,eAAe;AAAA,IACjB,CAAC;AAED,8BAAO,OAAO,aAAa,EAAE,KAAK,KAAK;AACvC,8BAAO,OAAO,QAAQ,aAAa,aAAa,EAAE,KAAK,KAAK;AAAA,EAC9D,CAAC;AACH,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../src/voice/turn_config/utils.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport { beforeAll, describe, expect, it } from 'vitest';\nimport { initializeLogger } from '../../log.js';\nimport { defaultAgentSessionOptions } from '../agent_session.js';\nimport { defaultEndpointingOptions } from './endpointing.js';\nimport { defaultInterruptionOptions } from './interruption.js';\nimport { defaultTurnHandlingOptions } from './turn_handling.js';\nimport { migrateLegacyOptions, migrateTurnHandling } from './utils.js';\n\nbeforeAll(() => {\n initializeLogger({ pretty: true, level: 'info' });\n});\n\ndescribe('migrateLegacyOptions', () => {\n it('should return all defaults when no options are provided', () => {\n const { agentSessionOptions: result } = migrateLegacyOptions({});\n\n expect(result.turnHandling).toEqual({\n turnDetection: defaultTurnHandlingOptions.turnDetection,\n endpointing: defaultEndpointingOptions,\n interruption: defaultInterruptionOptions,\n });\n expect(result.maxToolSteps).toBe(defaultAgentSessionOptions.maxToolSteps);\n expect(result.preemptiveGeneration).toBe(defaultAgentSessionOptions.preemptiveGeneration);\n expect(result.userAwayTimeout).toBe(defaultAgentSessionOptions.userAwayTimeout);\n });\n\n it('should migrate legacy flat fields into nested turnHandling config', () => {\n const { agentSessionOptions: result } = migrateLegacyOptions({\n voiceOptions: {\n minInterruptionDuration: 1000,\n minInterruptionWords: 3,\n discardAudioIfUninterruptible: false,\n minEndpointingDelay: 800,\n maxEndpointingDelay: 5000,\n },\n });\n\n expect(result.turnHandling.interruption!.minDuration).toBe(1000);\n expect(result.turnHandling.interruption!.minWords).toBe(3);\n expect(result.turnHandling.interruption!.discardAudioIfUninterruptible).toBe(false);\n expect(result.turnHandling.endpointing!.minDelay).toBe(800);\n expect(result.turnHandling.endpointing!.maxDelay).toBe(5000);\n });\n\n it('should set interruption.enabled to false when allowInterruptions is false', () => {\n const { agentSessionOptions: result } = migrateLegacyOptions({\n voiceOptions: { allowInterruptions: false },\n });\n\n expect(result.turnHandling.interruption!.enabled).toBe(false);\n });\n\n it('should give top-level fields precedence over voiceOptions', () => {\n const { agentSessionOptions: result } = migrateLegacyOptions({\n voiceOptions: {\n minInterruptionDuration: 1000,\n maxEndpointingDelay: 5000,\n maxToolSteps: 10,\n },\n turnHandling: {\n interruption: {\n minDuration: 2000,\n },\n endpointing: {\n maxDelay: 8000,\n },\n },\n maxToolSteps: 5,\n });\n\n expect(result.turnHandling.interruption!.minDuration).toBe(2000);\n expect(result.turnHandling.endpointing!.maxDelay).toBe(8000);\n expect(result.maxToolSteps).toBe(5);\n });\n\n it('should preserve top-level turnDetection in the result', () => {\n const { agentSessionOptions: result } = migrateLegacyOptions({\n turnDetection: 'vad',\n });\n\n expect(result.turnHandling.turnDetection).toBe('vad');\n });\n});\n\ndescribe('migrateTurnHandling', () => {\n it('should return empty partial when no deprecated Agent fields are given', () => {\n const result = migrateTurnHandling({});\n expect(result).toEqual({});\n });\n\n it('should set interruption.enabled to false when allowInterruptions is false', () => {\n const result = migrateTurnHandling({ allowInterruptions: false });\n expect(result.interruption).toEqual({ enabled: false });\n expect(result.endpointing).toBeUndefined();\n expect(result.turnDetection).toBeUndefined();\n });\n\n it('should not set interruption when allowInterruptions is true or undefined', () => {\n expect(migrateTurnHandling({ allowInterruptions: true })).toEqual({});\n expect(migrateTurnHandling({ allowInterruptions: undefined })).toEqual({});\n });\n\n it('should map minEndpointingDelay to endpointing.minDelay', () => {\n const result = migrateTurnHandling({ minEndpointingDelay: 800 });\n expect(result.endpointing).toEqual({ minDelay: 800 });\n });\n\n it('should map maxEndpointingDelay to endpointing.maxDelay', () => {\n const result = migrateTurnHandling({ maxEndpointingDelay: 5000 });\n expect(result.endpointing).toEqual({ maxDelay: 5000 });\n });\n\n it('should pass through turnDetection', () => {\n const result = migrateTurnHandling({ turnDetection: 'vad' });\n expect(result.turnDetection).toBe('vad');\n });\n\n it('should combine all deprecated Agent fields', () => {\n const result = migrateTurnHandling({\n turnDetection: 'stt',\n allowInterruptions: false,\n minEndpointingDelay: 400,\n maxEndpointingDelay: 3000,\n });\n expect(result.turnDetection).toBe('stt');\n expect(result.interruption).toEqual({ enabled: false });\n expect(result.endpointing).toEqual({ minDelay: 400, maxDelay: 3000 });\n });\n\n it('should ignore deprecated Agent fields when explicit turnHandling is provided', () => {\n const turnHandling = {\n endpointing: { minDelay: 999, maxDelay: 4000 },\n interruption: { enabled: true },\n turnDetection: 'vad' as const,\n };\n const result = migrateTurnHandling({\n turnHandling,\n turnDetection: 'stt',\n allowInterruptions: false,\n minEndpointingDelay: 100,\n maxEndpointingDelay: 200,\n });\n expect(result).toEqual(turnHandling);\n });\n});\n"],"mappings":";AAGA,o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