@livekit/agents 1.1.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.
- package/dist/audio.cjs +89 -3
- package/dist/audio.cjs.map +1 -1
- package/dist/audio.d.cts +36 -1
- package/dist/audio.d.ts +36 -1
- package/dist/audio.d.ts.map +1 -1
- package/dist/audio.js +76 -2
- package/dist/audio.js.map +1 -1
- package/dist/beta/index.cjs +29 -0
- package/dist/beta/index.cjs.map +1 -0
- package/dist/beta/index.d.cts +2 -0
- package/dist/beta/index.d.ts +2 -0
- package/dist/beta/index.d.ts.map +1 -0
- package/dist/beta/index.js +7 -0
- package/dist/beta/index.js.map +1 -0
- package/dist/beta/workflows/index.cjs +29 -0
- package/dist/beta/workflows/index.cjs.map +1 -0
- package/dist/beta/workflows/index.d.cts +2 -0
- package/dist/beta/workflows/index.d.ts +2 -0
- package/dist/beta/workflows/index.d.ts.map +1 -0
- package/dist/beta/workflows/index.js +7 -0
- package/dist/beta/workflows/index.js.map +1 -0
- package/dist/beta/workflows/task_group.cjs +162 -0
- package/dist/beta/workflows/task_group.cjs.map +1 -0
- package/dist/beta/workflows/task_group.d.cts +32 -0
- package/dist/beta/workflows/task_group.d.ts +32 -0
- package/dist/beta/workflows/task_group.d.ts.map +1 -0
- package/dist/beta/workflows/task_group.js +138 -0
- package/dist/beta/workflows/task_group.js.map +1 -0
- package/dist/cli.cjs +44 -46
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts +3 -3
- package/dist/cli.d.ts +3 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +45 -47
- package/dist/cli.js.map +1 -1
- package/dist/connection_pool.cjs +242 -0
- package/dist/connection_pool.cjs.map +1 -0
- package/dist/connection_pool.d.cts +123 -0
- package/dist/connection_pool.d.ts +123 -0
- package/dist/connection_pool.d.ts.map +1 -0
- package/dist/connection_pool.js +218 -0
- package/dist/connection_pool.js.map +1 -0
- package/dist/connection_pool.test.cjs +256 -0
- package/dist/connection_pool.test.cjs.map +1 -0
- package/dist/connection_pool.test.js +255 -0
- package/dist/connection_pool.test.js.map +1 -0
- package/dist/constants.cjs +30 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +10 -0
- package/dist/constants.d.ts +10 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +20 -0
- package/dist/constants.js.map +1 -1
- package/dist/cpu.cjs +189 -0
- package/dist/cpu.cjs.map +1 -0
- package/dist/cpu.d.cts +24 -0
- package/dist/cpu.d.ts +24 -0
- package/dist/cpu.d.ts.map +1 -0
- package/dist/cpu.js +152 -0
- package/dist/cpu.js.map +1 -0
- package/dist/cpu.test.cjs +227 -0
- package/dist/cpu.test.cjs.map +1 -0
- package/dist/cpu.test.js +204 -0
- package/dist/cpu.test.js.map +1 -0
- package/dist/http_server.cjs +9 -6
- package/dist/http_server.cjs.map +1 -1
- package/dist/http_server.d.cts +5 -1
- package/dist/http_server.d.ts +5 -1
- package/dist/http_server.d.ts.map +1 -1
- package/dist/http_server.js +9 -6
- package/dist/http_server.js.map +1 -1
- package/dist/index.cjs +24 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -11
- package/dist/index.d.ts +15 -11
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -9
- package/dist/index.js.map +1 -1
- package/dist/inference/api_protos.cjs +70 -2
- package/dist/inference/api_protos.cjs.map +1 -1
- package/dist/inference/api_protos.d.cts +373 -32
- package/dist/inference/api_protos.d.ts +373 -32
- package/dist/inference/api_protos.d.ts.map +1 -1
- package/dist/inference/api_protos.js +62 -2
- package/dist/inference/api_protos.js.map +1 -1
- package/dist/inference/index.cjs +8 -0
- package/dist/inference/index.cjs.map +1 -1
- package/dist/inference/index.d.cts +3 -4
- package/dist/inference/index.d.ts +3 -4
- package/dist/inference/index.d.ts.map +1 -1
- package/dist/inference/index.js +18 -3
- package/dist/inference/index.js.map +1 -1
- package/dist/inference/interruption/defaults.cjs +81 -0
- package/dist/inference/interruption/defaults.cjs.map +1 -0
- package/dist/inference/interruption/defaults.d.cts +19 -0
- package/dist/inference/interruption/defaults.d.ts +19 -0
- package/dist/inference/interruption/defaults.d.ts.map +1 -0
- package/dist/inference/interruption/defaults.js +46 -0
- package/dist/inference/interruption/defaults.js.map +1 -0
- package/dist/inference/interruption/errors.cjs +44 -0
- package/dist/inference/interruption/errors.cjs.map +1 -0
- package/dist/inference/interruption/errors.d.cts +12 -0
- package/dist/inference/interruption/errors.d.ts +12 -0
- package/dist/inference/interruption/errors.d.ts.map +1 -0
- package/dist/inference/interruption/errors.js +20 -0
- package/dist/inference/interruption/errors.js.map +1 -0
- package/dist/inference/interruption/http_transport.cjs +163 -0
- package/dist/inference/interruption/http_transport.cjs.map +1 -0
- package/dist/inference/interruption/http_transport.d.cts +63 -0
- package/dist/inference/interruption/http_transport.d.ts +63 -0
- package/dist/inference/interruption/http_transport.d.ts.map +1 -0
- package/dist/inference/interruption/http_transport.js +137 -0
- package/dist/inference/interruption/http_transport.js.map +1 -0
- package/dist/inference/interruption/interruption_cache_entry.cjs +58 -0
- package/dist/inference/interruption/interruption_cache_entry.cjs.map +1 -0
- package/dist/inference/interruption/interruption_cache_entry.d.cts +30 -0
- package/dist/inference/interruption/interruption_cache_entry.d.ts +30 -0
- package/dist/inference/interruption/interruption_cache_entry.d.ts.map +1 -0
- package/dist/inference/interruption/interruption_cache_entry.js +34 -0
- package/dist/inference/interruption/interruption_cache_entry.js.map +1 -0
- package/dist/inference/interruption/interruption_detector.cjs +198 -0
- package/dist/inference/interruption/interruption_detector.cjs.map +1 -0
- package/dist/inference/interruption/interruption_detector.d.cts +59 -0
- package/dist/inference/interruption/interruption_detector.d.ts +59 -0
- package/dist/inference/interruption/interruption_detector.d.ts.map +1 -0
- package/dist/inference/interruption/interruption_detector.js +164 -0
- package/dist/inference/interruption/interruption_detector.js.map +1 -0
- package/dist/inference/interruption/interruption_stream.cjs +368 -0
- package/dist/inference/interruption/interruption_stream.cjs.map +1 -0
- package/dist/inference/interruption/interruption_stream.d.cts +46 -0
- package/dist/inference/interruption/interruption_stream.d.ts +46 -0
- package/dist/inference/interruption/interruption_stream.d.ts.map +1 -0
- package/dist/inference/interruption/interruption_stream.js +344 -0
- package/dist/inference/interruption/interruption_stream.js.map +1 -0
- package/dist/inference/interruption/types.cjs +17 -0
- package/dist/inference/interruption/types.cjs.map +1 -0
- package/dist/inference/interruption/types.d.cts +66 -0
- package/dist/inference/interruption/types.d.ts +66 -0
- package/dist/inference/interruption/types.d.ts.map +1 -0
- package/dist/inference/interruption/types.js +1 -0
- package/dist/inference/interruption/types.js.map +1 -0
- package/dist/inference/interruption/utils.cjs +130 -0
- package/dist/inference/interruption/utils.cjs.map +1 -0
- package/dist/inference/interruption/utils.d.cts +41 -0
- package/dist/inference/interruption/utils.d.ts +41 -0
- package/dist/inference/interruption/utils.d.ts.map +1 -0
- package/dist/inference/interruption/utils.js +105 -0
- package/dist/inference/interruption/utils.js.map +1 -0
- package/dist/inference/interruption/utils.test.cjs +105 -0
- package/dist/inference/interruption/utils.test.cjs.map +1 -0
- package/dist/inference/interruption/utils.test.js +104 -0
- package/dist/inference/interruption/utils.test.js.map +1 -0
- package/dist/inference/interruption/ws_transport.cjs +342 -0
- package/dist/inference/interruption/ws_transport.cjs.map +1 -0
- package/dist/inference/interruption/ws_transport.d.cts +33 -0
- package/dist/inference/interruption/ws_transport.d.ts +33 -0
- package/dist/inference/interruption/ws_transport.d.ts.map +1 -0
- package/dist/inference/interruption/ws_transport.js +308 -0
- package/dist/inference/interruption/ws_transport.js.map +1 -0
- package/dist/inference/llm.cjs +106 -66
- package/dist/inference/llm.cjs.map +1 -1
- package/dist/inference/llm.d.cts +65 -43
- package/dist/inference/llm.d.ts +65 -43
- package/dist/inference/llm.d.ts.map +1 -1
- package/dist/inference/llm.js +100 -66
- package/dist/inference/llm.js.map +1 -1
- package/dist/inference/stt.cjs +319 -170
- package/dist/inference/stt.cjs.map +1 -1
- package/dist/inference/stt.d.cts +64 -15
- package/dist/inference/stt.d.ts +64 -15
- package/dist/inference/stt.d.ts.map +1 -1
- package/dist/inference/stt.js +319 -170
- package/dist/inference/stt.js.map +1 -1
- package/dist/inference/stt.test.cjs +218 -0
- package/dist/inference/stt.test.cjs.map +1 -0
- package/dist/inference/stt.test.js +217 -0
- package/dist/inference/stt.test.js.map +1 -0
- package/dist/inference/tts.cjs +249 -71
- package/dist/inference/tts.cjs.map +1 -1
- package/dist/inference/tts.d.cts +55 -16
- package/dist/inference/tts.d.ts +55 -16
- package/dist/inference/tts.d.ts.map +1 -1
- package/dist/inference/tts.js +249 -77
- package/dist/inference/tts.js.map +1 -1
- package/dist/inference/tts.test.cjs +233 -0
- package/dist/inference/tts.test.cjs.map +1 -0
- package/dist/inference/tts.test.js +232 -0
- package/dist/inference/tts.test.js.map +1 -0
- package/dist/inference/utils.cjs +26 -7
- package/dist/inference/utils.cjs.map +1 -1
- package/dist/inference/utils.d.cts +14 -1
- package/dist/inference/utils.d.ts +14 -1
- package/dist/inference/utils.d.ts.map +1 -1
- package/dist/inference/utils.js +18 -2
- package/dist/inference/utils.js.map +1 -1
- package/dist/ipc/inference_proc_executor.cjs +6 -3
- package/dist/ipc/inference_proc_executor.cjs.map +1 -1
- package/dist/ipc/inference_proc_executor.d.ts.map +1 -1
- package/dist/ipc/inference_proc_executor.js +6 -3
- package/dist/ipc/inference_proc_executor.js.map +1 -1
- package/dist/ipc/inference_proc_lazy_main.cjs +13 -1
- package/dist/ipc/inference_proc_lazy_main.cjs.map +1 -1
- package/dist/ipc/inference_proc_lazy_main.js +13 -1
- package/dist/ipc/inference_proc_lazy_main.js.map +1 -1
- package/dist/ipc/job_proc_executor.cjs +6 -1
- package/dist/ipc/job_proc_executor.cjs.map +1 -1
- package/dist/ipc/job_proc_executor.d.ts.map +1 -1
- package/dist/ipc/job_proc_executor.js +6 -1
- package/dist/ipc/job_proc_executor.js.map +1 -1
- package/dist/ipc/job_proc_lazy_main.cjs +89 -17
- package/dist/ipc/job_proc_lazy_main.cjs.map +1 -1
- package/dist/ipc/job_proc_lazy_main.js +68 -18
- package/dist/ipc/job_proc_lazy_main.js.map +1 -1
- package/dist/ipc/supervised_proc.cjs +34 -8
- package/dist/ipc/supervised_proc.cjs.map +1 -1
- package/dist/ipc/supervised_proc.d.cts +8 -0
- package/dist/ipc/supervised_proc.d.ts +8 -0
- package/dist/ipc/supervised_proc.d.ts.map +1 -1
- package/dist/ipc/supervised_proc.js +34 -8
- package/dist/ipc/supervised_proc.js.map +1 -1
- package/dist/ipc/supervised_proc.test.cjs +145 -0
- package/dist/ipc/supervised_proc.test.cjs.map +1 -0
- package/dist/ipc/supervised_proc.test.js +122 -0
- package/dist/ipc/supervised_proc.test.js.map +1 -0
- package/dist/job.cjs +109 -1
- package/dist/job.cjs.map +1 -1
- package/dist/job.d.cts +14 -0
- package/dist/job.d.ts +14 -0
- package/dist/job.d.ts.map +1 -1
- package/dist/job.js +99 -1
- package/dist/job.js.map +1 -1
- package/dist/language.cjs +394 -0
- package/dist/language.cjs.map +1 -0
- package/dist/language.d.cts +15 -0
- package/dist/language.d.ts +15 -0
- package/dist/language.d.ts.map +1 -0
- package/dist/language.js +363 -0
- package/dist/language.js.map +1 -0
- package/dist/language.test.cjs +43 -0
- package/dist/language.test.cjs.map +1 -0
- package/dist/language.test.js +49 -0
- package/dist/language.test.js.map +1 -0
- package/dist/llm/chat_context.cjs +274 -3
- package/dist/llm/chat_context.cjs.map +1 -1
- package/dist/llm/chat_context.d.cts +86 -2
- package/dist/llm/chat_context.d.ts +86 -2
- package/dist/llm/chat_context.d.ts.map +1 -1
- package/dist/llm/chat_context.js +273 -3
- package/dist/llm/chat_context.js.map +1 -1
- package/dist/llm/chat_context.test.cjs +574 -0
- package/dist/llm/chat_context.test.cjs.map +1 -1
- package/dist/llm/chat_context.test.js +574 -0
- package/dist/llm/chat_context.test.js.map +1 -1
- package/dist/llm/fallback_adapter.cjs +278 -0
- package/dist/llm/fallback_adapter.cjs.map +1 -0
- package/dist/llm/fallback_adapter.d.cts +73 -0
- package/dist/llm/fallback_adapter.d.ts +73 -0
- package/dist/llm/fallback_adapter.d.ts.map +1 -0
- package/dist/llm/fallback_adapter.js +254 -0
- package/dist/llm/fallback_adapter.js.map +1 -0
- package/dist/llm/fallback_adapter.test.cjs +176 -0
- package/dist/llm/fallback_adapter.test.cjs.map +1 -0
- package/dist/llm/fallback_adapter.test.js +175 -0
- package/dist/llm/fallback_adapter.test.js.map +1 -0
- package/dist/llm/index.cjs +9 -0
- package/dist/llm/index.cjs.map +1 -1
- package/dist/llm/index.d.cts +4 -3
- package/dist/llm/index.d.ts +4 -3
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +11 -1
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/llm.cjs +65 -11
- package/dist/llm/llm.cjs.map +1 -1
- package/dist/llm/llm.d.cts +13 -2
- package/dist/llm/llm.d.ts +13 -2
- package/dist/llm/llm.d.ts.map +1 -1
- package/dist/llm/llm.js +65 -11
- package/dist/llm/llm.js.map +1 -1
- package/dist/llm/provider_format/google.cjs +6 -2
- package/dist/llm/provider_format/google.cjs.map +1 -1
- package/dist/llm/provider_format/google.d.cts +1 -1
- package/dist/llm/provider_format/google.d.ts +1 -1
- package/dist/llm/provider_format/google.d.ts.map +1 -1
- package/dist/llm/provider_format/google.js +6 -2
- package/dist/llm/provider_format/google.js.map +1 -1
- package/dist/llm/provider_format/google.test.cjs +48 -0
- package/dist/llm/provider_format/google.test.cjs.map +1 -1
- package/dist/llm/provider_format/google.test.js +54 -1
- package/dist/llm/provider_format/google.test.js.map +1 -1
- package/dist/llm/provider_format/index.cjs +2 -0
- package/dist/llm/provider_format/index.cjs.map +1 -1
- package/dist/llm/provider_format/index.d.cts +2 -2
- package/dist/llm/provider_format/index.d.ts +2 -2
- package/dist/llm/provider_format/index.d.ts.map +1 -1
- package/dist/llm/provider_format/index.js +6 -1
- package/dist/llm/provider_format/index.js.map +1 -1
- package/dist/llm/provider_format/openai.cjs +126 -24
- package/dist/llm/provider_format/openai.cjs.map +1 -1
- package/dist/llm/provider_format/openai.d.cts +1 -0
- package/dist/llm/provider_format/openai.d.ts +1 -0
- package/dist/llm/provider_format/openai.d.ts.map +1 -1
- package/dist/llm/provider_format/openai.js +124 -23
- package/dist/llm/provider_format/openai.js.map +1 -1
- package/dist/llm/provider_format/openai.test.cjs +393 -0
- package/dist/llm/provider_format/openai.test.cjs.map +1 -1
- package/dist/llm/provider_format/openai.test.js +400 -2
- package/dist/llm/provider_format/openai.test.js.map +1 -1
- package/dist/llm/provider_format/utils.cjs +5 -4
- package/dist/llm/provider_format/utils.cjs.map +1 -1
- package/dist/llm/provider_format/utils.d.ts.map +1 -1
- package/dist/llm/provider_format/utils.js +5 -4
- package/dist/llm/provider_format/utils.js.map +1 -1
- package/dist/llm/realtime.cjs +3 -0
- package/dist/llm/realtime.cjs.map +1 -1
- package/dist/llm/realtime.d.cts +15 -1
- package/dist/llm/realtime.d.ts +15 -1
- package/dist/llm/realtime.d.ts.map +1 -1
- package/dist/llm/realtime.js +3 -0
- package/dist/llm/realtime.js.map +1 -1
- package/dist/llm/remote_chat_context.cjs.map +1 -1
- package/dist/llm/remote_chat_context.d.cts +2 -0
- package/dist/llm/remote_chat_context.d.ts +2 -0
- package/dist/llm/remote_chat_context.d.ts.map +1 -1
- package/dist/llm/remote_chat_context.js.map +1 -1
- package/dist/llm/tool_context.cjs +50 -2
- package/dist/llm/tool_context.cjs.map +1 -1
- package/dist/llm/tool_context.d.cts +47 -11
- package/dist/llm/tool_context.d.ts +47 -11
- package/dist/llm/tool_context.d.ts.map +1 -1
- package/dist/llm/tool_context.js +48 -3
- package/dist/llm/tool_context.js.map +1 -1
- package/dist/llm/tool_context.test.cjs +197 -0
- package/dist/llm/tool_context.test.cjs.map +1 -1
- package/dist/llm/tool_context.test.js +175 -0
- package/dist/llm/tool_context.test.js.map +1 -1
- package/dist/llm/utils.cjs +18 -12
- package/dist/llm/utils.cjs.map +1 -1
- package/dist/llm/utils.d.cts +2 -3
- package/dist/llm/utils.d.ts +2 -3
- package/dist/llm/utils.d.ts.map +1 -1
- package/dist/llm/utils.js +18 -12
- package/dist/llm/utils.js.map +1 -1
- package/dist/llm/zod-utils.cjs +102 -0
- package/dist/llm/zod-utils.cjs.map +1 -0
- package/dist/llm/zod-utils.d.cts +65 -0
- package/dist/llm/zod-utils.d.ts +65 -0
- package/dist/llm/zod-utils.d.ts.map +1 -0
- package/dist/llm/zod-utils.js +64 -0
- package/dist/llm/zod-utils.js.map +1 -0
- package/dist/llm/zod-utils.test.cjs +472 -0
- package/dist/llm/zod-utils.test.cjs.map +1 -0
- package/dist/llm/zod-utils.test.js +455 -0
- package/dist/llm/zod-utils.test.js.map +1 -0
- package/dist/log.cjs +45 -14
- package/dist/log.cjs.map +1 -1
- package/dist/log.d.cts +8 -1
- package/dist/log.d.ts +8 -1
- package/dist/log.d.ts.map +1 -1
- package/dist/log.js +45 -15
- package/dist/log.js.map +1 -1
- package/dist/metrics/base.cjs.map +1 -1
- package/dist/metrics/base.d.cts +75 -19
- package/dist/metrics/base.d.ts +75 -19
- package/dist/metrics/base.d.ts.map +1 -1
- package/dist/metrics/index.cjs +5 -0
- package/dist/metrics/index.cjs.map +1 -1
- package/dist/metrics/index.d.cts +2 -1
- package/dist/metrics/index.d.ts +2 -1
- package/dist/metrics/index.d.ts.map +1 -1
- package/dist/metrics/index.js +6 -0
- package/dist/metrics/index.js.map +1 -1
- package/dist/metrics/model_usage.cjs +189 -0
- package/dist/metrics/model_usage.cjs.map +1 -0
- package/dist/metrics/model_usage.d.cts +92 -0
- package/dist/metrics/model_usage.d.ts +92 -0
- package/dist/metrics/model_usage.d.ts.map +1 -0
- package/dist/metrics/model_usage.js +164 -0
- package/dist/metrics/model_usage.js.map +1 -0
- package/dist/metrics/model_usage.test.cjs +474 -0
- package/dist/metrics/model_usage.test.cjs.map +1 -0
- package/dist/metrics/model_usage.test.js +476 -0
- package/dist/metrics/model_usage.test.js.map +1 -0
- package/dist/metrics/usage_collector.cjs +5 -2
- package/dist/metrics/usage_collector.cjs.map +1 -1
- package/dist/metrics/usage_collector.d.cts +10 -1
- package/dist/metrics/usage_collector.d.ts +10 -1
- package/dist/metrics/usage_collector.d.ts.map +1 -1
- package/dist/metrics/usage_collector.js +5 -2
- package/dist/metrics/usage_collector.js.map +1 -1
- package/dist/metrics/utils.cjs +23 -7
- package/dist/metrics/utils.cjs.map +1 -1
- package/dist/metrics/utils.d.ts.map +1 -1
- package/dist/metrics/utils.js +23 -7
- package/dist/metrics/utils.js.map +1 -1
- package/dist/stream/deferred_stream.cjs +31 -10
- package/dist/stream/deferred_stream.cjs.map +1 -1
- package/dist/stream/deferred_stream.d.cts +6 -1
- package/dist/stream/deferred_stream.d.ts +6 -1
- package/dist/stream/deferred_stream.d.ts.map +1 -1
- package/dist/stream/deferred_stream.js +31 -10
- package/dist/stream/deferred_stream.js.map +1 -1
- package/dist/stream/deferred_stream.test.cjs +2 -2
- package/dist/stream/deferred_stream.test.cjs.map +1 -1
- package/dist/stream/deferred_stream.test.js +2 -2
- package/dist/stream/deferred_stream.test.js.map +1 -1
- package/dist/stream/index.cjs +3 -0
- package/dist/stream/index.cjs.map +1 -1
- package/dist/stream/index.d.cts +1 -0
- package/dist/stream/index.d.ts +1 -0
- package/dist/stream/index.d.ts.map +1 -1
- package/dist/stream/index.js +2 -0
- package/dist/stream/index.js.map +1 -1
- package/dist/stream/multi_input_stream.cjs +139 -0
- package/dist/stream/multi_input_stream.cjs.map +1 -0
- package/dist/stream/multi_input_stream.d.cts +55 -0
- package/dist/stream/multi_input_stream.d.ts +55 -0
- package/dist/stream/multi_input_stream.d.ts.map +1 -0
- package/dist/stream/multi_input_stream.js +115 -0
- package/dist/stream/multi_input_stream.js.map +1 -0
- package/dist/stream/multi_input_stream.test.cjs +344 -0
- package/dist/stream/multi_input_stream.test.cjs.map +1 -0
- package/dist/stream/multi_input_stream.test.js +343 -0
- package/dist/stream/multi_input_stream.test.js.map +1 -0
- package/dist/stream/stream_channel.cjs +39 -1
- package/dist/stream/stream_channel.cjs.map +1 -1
- package/dist/stream/stream_channel.d.cts +5 -2
- package/dist/stream/stream_channel.d.ts +5 -2
- package/dist/stream/stream_channel.d.ts.map +1 -1
- package/dist/stream/stream_channel.js +39 -1
- package/dist/stream/stream_channel.js.map +1 -1
- package/dist/stream/stream_channel.test.cjs +27 -0
- package/dist/stream/stream_channel.test.cjs.map +1 -1
- package/dist/stream/stream_channel.test.js +27 -0
- package/dist/stream/stream_channel.test.js.map +1 -1
- package/dist/stt/stream_adapter.cjs +24 -9
- package/dist/stt/stream_adapter.cjs.map +1 -1
- package/dist/stt/stream_adapter.d.cts +7 -3
- package/dist/stt/stream_adapter.d.ts +7 -3
- package/dist/stt/stream_adapter.d.ts.map +1 -1
- package/dist/stt/stream_adapter.js +24 -9
- package/dist/stt/stream_adapter.js.map +1 -1
- package/dist/stt/stt.cjs +86 -19
- package/dist/stt/stt.cjs.map +1 -1
- package/dist/stt/stt.d.cts +60 -5
- package/dist/stt/stt.d.ts +60 -5
- package/dist/stt/stt.d.ts.map +1 -1
- package/dist/stt/stt.js +88 -21
- package/dist/stt/stt.js.map +1 -1
- package/dist/telemetry/index.cjs +72 -0
- package/dist/telemetry/index.cjs.map +1 -0
- package/dist/telemetry/index.d.cts +7 -0
- package/dist/telemetry/index.d.ts +7 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +37 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/logging.cjs +65 -0
- package/dist/telemetry/logging.cjs.map +1 -0
- package/dist/telemetry/logging.d.cts +21 -0
- package/dist/telemetry/logging.d.ts +21 -0
- package/dist/telemetry/logging.d.ts.map +1 -0
- package/dist/telemetry/logging.js +40 -0
- package/dist/telemetry/logging.js.map +1 -0
- package/dist/telemetry/otel_http_exporter.cjs +166 -0
- package/dist/telemetry/otel_http_exporter.cjs.map +1 -0
- package/dist/telemetry/otel_http_exporter.d.cts +63 -0
- package/dist/telemetry/otel_http_exporter.d.ts +63 -0
- package/dist/telemetry/otel_http_exporter.d.ts.map +1 -0
- package/dist/telemetry/otel_http_exporter.js +142 -0
- package/dist/telemetry/otel_http_exporter.js.map +1 -0
- package/dist/telemetry/pino_otel_transport.cjs +217 -0
- package/dist/telemetry/pino_otel_transport.cjs.map +1 -0
- package/dist/telemetry/pino_otel_transport.d.cts +58 -0
- package/dist/telemetry/pino_otel_transport.d.ts +58 -0
- package/dist/telemetry/pino_otel_transport.d.ts.map +1 -0
- package/dist/telemetry/pino_otel_transport.js +189 -0
- package/dist/telemetry/pino_otel_transport.js.map +1 -0
- package/dist/telemetry/trace_types.cjs +233 -0
- package/dist/telemetry/trace_types.cjs.map +1 -0
- package/dist/telemetry/trace_types.d.cts +74 -0
- package/dist/telemetry/trace_types.d.ts +74 -0
- package/dist/telemetry/trace_types.d.ts.map +1 -0
- package/dist/telemetry/trace_types.js +141 -0
- package/dist/telemetry/trace_types.js.map +1 -0
- package/dist/telemetry/traces.cjs +484 -0
- package/dist/telemetry/traces.cjs.map +1 -0
- package/dist/telemetry/traces.d.cts +116 -0
- package/dist/telemetry/traces.d.ts +116 -0
- package/dist/telemetry/traces.d.ts.map +1 -0
- package/dist/telemetry/traces.js +449 -0
- package/dist/telemetry/traces.js.map +1 -0
- package/dist/telemetry/utils.cjs +86 -0
- package/dist/telemetry/utils.cjs.map +1 -0
- package/dist/telemetry/utils.d.cts +5 -0
- package/dist/telemetry/utils.d.ts +5 -0
- package/dist/telemetry/utils.d.ts.map +1 -0
- package/dist/telemetry/utils.js +51 -0
- package/dist/telemetry/utils.js.map +1 -0
- package/dist/tokenize/basic/sentence.cjs +3 -3
- package/dist/tokenize/basic/sentence.cjs.map +1 -1
- package/dist/tokenize/basic/sentence.js +3 -3
- package/dist/tokenize/basic/sentence.js.map +1 -1
- package/dist/tokenize/tokenizer.test.cjs +3 -1
- package/dist/tokenize/tokenizer.test.cjs.map +1 -1
- package/dist/tokenize/tokenizer.test.js +3 -1
- package/dist/tokenize/tokenizer.test.js.map +1 -1
- package/dist/transcription.cjs.map +1 -1
- package/dist/transcription.d.cts +6 -0
- package/dist/transcription.d.ts +6 -0
- package/dist/transcription.d.ts.map +1 -1
- package/dist/transcription.js.map +1 -1
- package/dist/tts/fallback_adapter.cjs +466 -0
- package/dist/tts/fallback_adapter.cjs.map +1 -0
- package/dist/tts/fallback_adapter.d.cts +110 -0
- package/dist/tts/fallback_adapter.d.ts +110 -0
- package/dist/tts/fallback_adapter.d.ts.map +1 -0
- package/dist/tts/fallback_adapter.js +442 -0
- package/dist/tts/fallback_adapter.js.map +1 -0
- package/dist/tts/index.cjs +3 -0
- package/dist/tts/index.cjs.map +1 -1
- package/dist/tts/index.d.cts +1 -0
- package/dist/tts/index.d.ts +1 -0
- package/dist/tts/index.d.ts.map +1 -1
- package/dist/tts/index.js +2 -0
- package/dist/tts/index.js.map +1 -1
- package/dist/tts/stream_adapter.cjs +25 -8
- package/dist/tts/stream_adapter.cjs.map +1 -1
- package/dist/tts/stream_adapter.d.cts +6 -3
- package/dist/tts/stream_adapter.d.ts +6 -3
- package/dist/tts/stream_adapter.d.ts.map +1 -1
- package/dist/tts/stream_adapter.js +25 -8
- package/dist/tts/stream_adapter.js.map +1 -1
- package/dist/tts/tts.cjs +189 -57
- package/dist/tts/tts.cjs.map +1 -1
- package/dist/tts/tts.d.cts +58 -6
- package/dist/tts/tts.d.ts +58 -6
- package/dist/tts/tts.d.ts.map +1 -1
- package/dist/tts/tts.js +191 -59
- package/dist/tts/tts.js.map +1 -1
- package/dist/types.cjs +24 -32
- package/dist/types.cjs.map +1 -1
- package/dist/types.d.cts +45 -10
- package/dist/types.d.ts +45 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +20 -30
- package/dist/types.js.map +1 -1
- package/dist/utils.cjs +122 -26
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +41 -1
- package/dist/utils.d.ts +41 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +117 -25
- package/dist/utils.js.map +1 -1
- package/dist/utils.test.cjs +73 -1
- package/dist/utils.test.cjs.map +1 -1
- package/dist/utils.test.js +74 -10
- package/dist/utils.test.js.map +1 -1
- package/dist/vad.cjs +35 -15
- package/dist/vad.cjs.map +1 -1
- package/dist/vad.d.cts +15 -5
- package/dist/vad.d.ts +15 -5
- package/dist/vad.d.ts.map +1 -1
- package/dist/vad.js +35 -15
- package/dist/vad.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.cjs.map +1 -1
- package/dist/version.d.cts +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/dist/voice/agent.cjs +258 -35
- package/dist/voice/agent.cjs.map +1 -1
- package/dist/voice/agent.d.cts +54 -13
- package/dist/voice/agent.d.ts +54 -13
- package/dist/voice/agent.d.ts.map +1 -1
- package/dist/voice/agent.js +254 -34
- package/dist/voice/agent.js.map +1 -1
- package/dist/voice/agent.test.cjs +314 -0
- package/dist/voice/agent.test.cjs.map +1 -1
- package/dist/voice/agent.test.js +316 -2
- package/dist/voice/agent.test.js.map +1 -1
- package/dist/voice/agent_activity.cjs +1116 -385
- package/dist/voice/agent_activity.cjs.map +1 -1
- package/dist/voice/agent_activity.d.cts +72 -11
- package/dist/voice/agent_activity.d.ts +72 -11
- package/dist/voice/agent_activity.d.ts.map +1 -1
- package/dist/voice/agent_activity.js +1119 -383
- package/dist/voice/agent_activity.js.map +1 -1
- package/dist/voice/agent_activity.test.cjs +135 -0
- package/dist/voice/agent_activity.test.cjs.map +1 -0
- package/dist/voice/agent_activity.test.js +134 -0
- package/dist/voice/agent_activity.test.js.map +1 -0
- package/dist/voice/agent_session.cjs +550 -90
- package/dist/voice/agent_session.cjs.map +1 -1
- package/dist/voice/agent_session.d.cts +185 -25
- package/dist/voice/agent_session.d.ts +185 -25
- package/dist/voice/agent_session.d.ts.map +1 -1
- package/dist/voice/agent_session.js +556 -91
- package/dist/voice/agent_session.js.map +1 -1
- package/dist/voice/audio_recognition.cjs +605 -46
- package/dist/voice/audio_recognition.cjs.map +1 -1
- package/dist/voice/audio_recognition.d.cts +96 -4
- package/dist/voice/audio_recognition.d.ts +96 -4
- package/dist/voice/audio_recognition.d.ts.map +1 -1
- package/dist/voice/audio_recognition.js +611 -47
- package/dist/voice/audio_recognition.js.map +1 -1
- package/dist/voice/audio_recognition_span.test.cjs +295 -0
- package/dist/voice/audio_recognition_span.test.cjs.map +1 -0
- package/dist/voice/audio_recognition_span.test.js +299 -0
- package/dist/voice/audio_recognition_span.test.js.map +1 -0
- package/dist/voice/avatar/datastream_io.cjs +7 -1
- package/dist/voice/avatar/datastream_io.cjs.map +1 -1
- package/dist/voice/avatar/datastream_io.d.cts +1 -0
- package/dist/voice/avatar/datastream_io.d.ts +1 -0
- package/dist/voice/avatar/datastream_io.d.ts.map +1 -1
- package/dist/voice/avatar/datastream_io.js +7 -1
- package/dist/voice/avatar/datastream_io.js.map +1 -1
- package/dist/voice/background_audio.cjs +367 -0
- package/dist/voice/background_audio.cjs.map +1 -0
- package/dist/voice/background_audio.d.cts +123 -0
- package/dist/voice/background_audio.d.ts +123 -0
- package/dist/voice/background_audio.d.ts.map +1 -0
- package/dist/voice/background_audio.js +343 -0
- package/dist/voice/background_audio.js.map +1 -0
- package/dist/voice/events.cjs +3 -0
- package/dist/voice/events.cjs.map +1 -1
- package/dist/voice/events.d.cts +16 -9
- package/dist/voice/events.d.ts +16 -9
- package/dist/voice/events.d.ts.map +1 -1
- package/dist/voice/events.js +3 -0
- package/dist/voice/events.js.map +1 -1
- package/dist/voice/generation.cjs +205 -41
- package/dist/voice/generation.cjs.map +1 -1
- package/dist/voice/generation.d.cts +21 -5
- package/dist/voice/generation.d.ts +21 -5
- package/dist/voice/generation.d.ts.map +1 -1
- package/dist/voice/generation.js +215 -43
- package/dist/voice/generation.js.map +1 -1
- package/dist/voice/generation_tools.test.cjs +236 -0
- package/dist/voice/generation_tools.test.cjs.map +1 -0
- package/dist/voice/generation_tools.test.js +235 -0
- package/dist/voice/generation_tools.test.js.map +1 -0
- package/dist/voice/index.cjs +33 -2
- package/dist/voice/index.cjs.map +1 -1
- package/dist/voice/index.d.cts +8 -2
- package/dist/voice/index.d.ts +8 -2
- package/dist/voice/index.d.ts.map +1 -1
- package/dist/voice/index.js +19 -2
- package/dist/voice/index.js.map +1 -1
- package/dist/voice/interruption_detection.test.cjs +114 -0
- package/dist/voice/interruption_detection.test.cjs.map +1 -0
- package/dist/voice/interruption_detection.test.js +113 -0
- package/dist/voice/interruption_detection.test.js.map +1 -0
- package/dist/voice/io.cjs +66 -6
- package/dist/voice/io.cjs.map +1 -1
- package/dist/voice/io.d.cts +67 -7
- package/dist/voice/io.d.ts +67 -7
- package/dist/voice/io.d.ts.map +1 -1
- package/dist/voice/io.js +62 -5
- package/dist/voice/io.js.map +1 -1
- package/dist/voice/recorder_io/index.cjs +23 -0
- package/dist/voice/recorder_io/index.cjs.map +1 -0
- package/dist/voice/recorder_io/index.d.cts +2 -0
- package/dist/voice/recorder_io/index.d.ts +2 -0
- package/dist/voice/recorder_io/index.d.ts.map +1 -0
- package/dist/voice/recorder_io/index.js +2 -0
- package/dist/voice/recorder_io/index.js.map +1 -0
- package/dist/voice/recorder_io/recorder_io.cjs +607 -0
- package/dist/voice/recorder_io/recorder_io.cjs.map +1 -0
- package/dist/voice/recorder_io/recorder_io.d.cts +106 -0
- package/dist/voice/recorder_io/recorder_io.d.ts +106 -0
- package/dist/voice/recorder_io/recorder_io.d.ts.map +1 -0
- package/dist/voice/recorder_io/recorder_io.js +573 -0
- package/dist/voice/recorder_io/recorder_io.js.map +1 -0
- package/dist/voice/remote_session.cjs +922 -0
- package/dist/voice/remote_session.cjs.map +1 -0
- package/dist/voice/remote_session.d.cts +108 -0
- package/dist/voice/remote_session.d.ts +108 -0
- package/dist/voice/remote_session.d.ts.map +1 -0
- package/dist/voice/remote_session.js +887 -0
- package/dist/voice/remote_session.js.map +1 -0
- package/dist/voice/report.cjs +88 -0
- package/dist/voice/report.cjs.map +1 -0
- package/dist/voice/report.d.cts +49 -0
- package/dist/voice/report.d.ts +49 -0
- package/dist/voice/report.d.ts.map +1 -0
- package/dist/voice/report.js +63 -0
- package/dist/voice/report.js.map +1 -0
- package/dist/voice/report.test.cjs +121 -0
- package/dist/voice/report.test.cjs.map +1 -0
- package/dist/voice/report.test.js +120 -0
- package/dist/voice/report.test.js.map +1 -0
- package/dist/voice/room_io/_input.cjs +40 -7
- package/dist/voice/room_io/_input.cjs.map +1 -1
- package/dist/voice/room_io/_input.d.cts +5 -2
- package/dist/voice/room_io/_input.d.ts +5 -2
- package/dist/voice/room_io/_input.d.ts.map +1 -1
- package/dist/voice/room_io/_input.js +41 -8
- package/dist/voice/room_io/_input.js.map +1 -1
- package/dist/voice/room_io/_output.cjs +19 -11
- package/dist/voice/room_io/_output.cjs.map +1 -1
- package/dist/voice/room_io/_output.d.cts +7 -4
- package/dist/voice/room_io/_output.d.ts +7 -4
- package/dist/voice/room_io/_output.d.ts.map +1 -1
- package/dist/voice/room_io/_output.js +20 -12
- package/dist/voice/room_io/_output.js.map +1 -1
- package/dist/voice/room_io/room_io.cjs +33 -6
- package/dist/voice/room_io/room_io.cjs.map +1 -1
- package/dist/voice/room_io/room_io.d.cts +29 -9
- package/dist/voice/room_io/room_io.d.ts +29 -9
- package/dist/voice/room_io/room_io.d.ts.map +1 -1
- package/dist/voice/room_io/room_io.js +33 -7
- package/dist/voice/room_io/room_io.js.map +1 -1
- package/dist/voice/speech_handle.cjs +22 -4
- package/dist/voice/speech_handle.cjs.map +1 -1
- package/dist/voice/speech_handle.d.cts +17 -2
- package/dist/voice/speech_handle.d.ts +17 -2
- package/dist/voice/speech_handle.d.ts.map +1 -1
- package/dist/voice/speech_handle.js +21 -4
- package/dist/voice/speech_handle.js.map +1 -1
- package/dist/voice/testing/fake_llm.cjs +127 -0
- package/dist/voice/testing/fake_llm.cjs.map +1 -0
- package/dist/voice/testing/fake_llm.d.cts +30 -0
- package/dist/voice/testing/fake_llm.d.ts +30 -0
- package/dist/voice/testing/fake_llm.d.ts.map +1 -0
- package/dist/voice/testing/fake_llm.js +103 -0
- package/dist/voice/testing/fake_llm.js.map +1 -0
- package/dist/voice/testing/index.cjs +57 -0
- package/dist/voice/testing/index.cjs.map +1 -0
- package/dist/voice/testing/index.d.cts +21 -0
- package/dist/voice/testing/index.d.ts +21 -0
- package/dist/voice/testing/index.d.ts.map +1 -0
- package/dist/voice/testing/index.js +35 -0
- package/dist/voice/testing/index.js.map +1 -0
- package/dist/voice/testing/run_result.cjs +817 -0
- package/dist/voice/testing/run_result.cjs.map +1 -0
- package/dist/voice/testing/run_result.d.cts +385 -0
- package/dist/voice/testing/run_result.d.ts +385 -0
- package/dist/voice/testing/run_result.d.ts.map +1 -0
- package/dist/voice/testing/run_result.js +790 -0
- package/dist/voice/testing/run_result.js.map +1 -0
- package/dist/voice/testing/types.cjs +46 -0
- package/dist/voice/testing/types.cjs.map +1 -0
- package/dist/voice/testing/types.d.cts +83 -0
- package/dist/voice/testing/types.d.ts +83 -0
- package/dist/voice/testing/types.d.ts.map +1 -0
- package/dist/voice/testing/types.js +19 -0
- package/dist/voice/testing/types.js.map +1 -0
- package/dist/voice/transcription/synchronizer.cjs +139 -15
- package/dist/voice/transcription/synchronizer.cjs.map +1 -1
- package/dist/voice/transcription/synchronizer.d.cts +35 -4
- package/dist/voice/transcription/synchronizer.d.ts +35 -4
- package/dist/voice/transcription/synchronizer.d.ts.map +1 -1
- package/dist/voice/transcription/synchronizer.js +143 -16
- package/dist/voice/transcription/synchronizer.js.map +1 -1
- package/dist/voice/transcription/synchronizer.test.cjs +151 -0
- package/dist/voice/transcription/synchronizer.test.cjs.map +1 -0
- package/dist/voice/transcription/synchronizer.test.js +150 -0
- package/dist/voice/transcription/synchronizer.test.js.map +1 -0
- package/dist/voice/turn_config/endpointing.cjs +33 -0
- package/dist/voice/turn_config/endpointing.cjs.map +1 -0
- package/dist/voice/turn_config/endpointing.d.cts +30 -0
- package/dist/voice/turn_config/endpointing.d.ts +30 -0
- package/dist/voice/turn_config/endpointing.d.ts.map +1 -0
- package/dist/voice/turn_config/endpointing.js +9 -0
- package/dist/voice/turn_config/endpointing.js.map +1 -0
- package/dist/voice/turn_config/interruption.cjs +37 -0
- package/dist/voice/turn_config/interruption.cjs.map +1 -0
- package/dist/voice/turn_config/interruption.d.cts +53 -0
- package/dist/voice/turn_config/interruption.d.ts +53 -0
- package/dist/voice/turn_config/interruption.d.ts.map +1 -0
- package/dist/voice/turn_config/interruption.js +13 -0
- package/dist/voice/turn_config/interruption.js.map +1 -0
- package/dist/voice/turn_config/turn_handling.cjs +35 -0
- package/dist/voice/turn_config/turn_handling.cjs.map +1 -0
- package/dist/voice/turn_config/turn_handling.d.cts +36 -0
- package/dist/voice/turn_config/turn_handling.d.ts +36 -0
- package/dist/voice/turn_config/turn_handling.d.ts.map +1 -0
- package/dist/voice/turn_config/turn_handling.js +11 -0
- package/dist/voice/turn_config/turn_handling.js.map +1 -0
- package/dist/voice/turn_config/utils.cjs +157 -0
- package/dist/voice/turn_config/utils.cjs.map +1 -0
- package/dist/voice/turn_config/utils.d.cts +37 -0
- package/dist/voice/turn_config/utils.d.ts +37 -0
- package/dist/voice/turn_config/utils.d.ts.map +1 -0
- package/dist/voice/turn_config/utils.js +131 -0
- package/dist/voice/turn_config/utils.js.map +1 -0
- package/dist/voice/turn_config/utils.test.cjs +128 -0
- package/dist/voice/turn_config/utils.test.cjs.map +1 -0
- package/dist/voice/turn_config/utils.test.js +127 -0
- package/dist/voice/turn_config/utils.test.js.map +1 -0
- package/dist/voice/utils.cjs +47 -0
- package/dist/voice/utils.cjs.map +1 -0
- package/dist/voice/utils.d.cts +4 -0
- package/dist/voice/utils.d.ts +4 -0
- package/dist/voice/utils.d.ts.map +1 -0
- package/dist/voice/utils.js +23 -0
- package/dist/voice/utils.js.map +1 -0
- package/dist/worker.cjs +44 -52
- package/dist/worker.cjs.map +1 -1
- package/dist/worker.d.cts +18 -8
- package/dist/worker.d.ts +18 -8
- package/dist/worker.d.ts.map +1 -1
- package/dist/worker.js +43 -43
- package/dist/worker.js.map +1 -1
- package/package.json +32 -12
- package/resources/NOTICE +2 -0
- package/resources/keyboard-typing.ogg +0 -0
- package/resources/keyboard-typing2.ogg +0 -0
- package/resources/office-ambience.ogg +0 -0
- package/src/audio.ts +132 -1
- package/src/beta/index.ts +9 -0
- package/src/beta/workflows/index.ts +9 -0
- package/src/beta/workflows/task_group.ts +194 -0
- package/src/cli.ts +57 -66
- package/src/connection_pool.test.ts +346 -0
- package/src/connection_pool.ts +307 -0
- package/src/constants.ts +14 -0
- package/src/cpu.test.ts +239 -0
- package/src/cpu.ts +173 -0
- package/src/http_server.ts +18 -6
- package/src/index.ts +15 -13
- package/src/inference/api_protos.ts +85 -2
- package/src/inference/index.ts +32 -4
- package/src/inference/interruption/defaults.ts +51 -0
- package/src/inference/interruption/errors.ts +25 -0
- package/src/inference/interruption/http_transport.ts +206 -0
- package/src/inference/interruption/interruption_cache_entry.ts +50 -0
- package/src/inference/interruption/interruption_detector.ts +204 -0
- package/src/inference/interruption/interruption_stream.ts +467 -0
- package/src/inference/interruption/types.ts +84 -0
- package/src/inference/interruption/utils.test.ts +132 -0
- package/src/inference/interruption/utils.ts +137 -0
- package/src/inference/interruption/ws_transport.ts +406 -0
- package/src/inference/llm.ts +214 -163
- package/src/inference/stt.test.ts +253 -0
- package/src/inference/stt.ts +449 -208
- package/src/inference/tts.test.ts +267 -0
- package/src/inference/tts.ts +377 -115
- package/src/inference/utils.ts +30 -2
- package/src/ipc/inference_proc_executor.ts +11 -3
- package/src/ipc/inference_proc_lazy_main.ts +13 -1
- package/src/ipc/job_proc_executor.ts +11 -1
- package/src/ipc/job_proc_lazy_main.ts +86 -20
- package/src/ipc/supervised_proc.test.ts +153 -0
- package/src/ipc/supervised_proc.ts +39 -10
- package/src/job.ts +120 -1
- package/src/language.test.ts +62 -0
- package/src/language.ts +380 -0
- package/src/llm/__snapshots__/zod-utils.test.ts.snap +559 -0
- package/src/llm/chat_context.test.ts +655 -0
- package/src/llm/chat_context.ts +412 -2
- package/src/llm/fallback_adapter.test.ts +238 -0
- package/src/llm/fallback_adapter.ts +391 -0
- package/src/llm/index.ts +11 -0
- package/src/llm/llm.ts +77 -12
- package/src/llm/provider_format/google.test.ts +72 -1
- package/src/llm/provider_format/google.ts +10 -6
- package/src/llm/provider_format/index.ts +7 -2
- package/src/llm/provider_format/openai.test.ts +480 -2
- package/src/llm/provider_format/openai.ts +152 -21
- package/src/llm/provider_format/utils.ts +11 -5
- package/src/llm/realtime.ts +23 -2
- package/src/llm/remote_chat_context.ts +2 -2
- package/src/llm/tool_context.test.ts +210 -1
- package/src/llm/tool_context.ts +115 -17
- package/src/llm/utils.ts +24 -16
- package/src/llm/zod-utils.test.ts +577 -0
- package/src/llm/zod-utils.ts +153 -0
- package/src/log.ts +71 -19
- package/src/metrics/base.ts +78 -19
- package/src/metrics/index.ts +12 -0
- package/src/metrics/model_usage.test.ts +545 -0
- package/src/metrics/model_usage.ts +262 -0
- package/src/metrics/usage_collector.ts +14 -3
- package/src/metrics/utils.ts +27 -7
- package/src/stream/deferred_stream.test.ts +3 -3
- package/src/stream/deferred_stream.ts +43 -11
- package/src/stream/index.ts +1 -0
- package/src/stream/multi_input_stream.test.ts +545 -0
- package/src/stream/multi_input_stream.ts +172 -0
- package/src/stream/stream_channel.test.ts +37 -0
- package/src/stream/stream_channel.ts +43 -3
- package/src/stt/stream_adapter.ts +30 -9
- package/src/stt/stt.ts +131 -22
- package/src/telemetry/index.ts +28 -0
- package/src/telemetry/logging.ts +55 -0
- package/src/telemetry/otel_http_exporter.ts +218 -0
- package/src/telemetry/pino_otel_transport.ts +265 -0
- package/src/telemetry/trace_types.ts +109 -0
- package/src/telemetry/traces.ts +673 -0
- package/src/telemetry/utils.ts +61 -0
- package/src/tokenize/basic/sentence.ts +3 -3
- package/src/tokenize/tokenizer.test.ts +4 -0
- package/src/transcription.ts +6 -0
- package/src/tts/fallback_adapter.ts +579 -0
- package/src/tts/index.ts +1 -0
- package/src/tts/stream_adapter.ts +38 -8
- package/src/tts/tts.ts +245 -62
- package/src/types.ts +62 -33
- package/src/utils.test.ts +90 -10
- package/src/utils.ts +176 -31
- package/src/vad.ts +42 -18
- package/src/version.ts +1 -1
- package/src/voice/agent.test.ts +347 -2
- package/src/voice/agent.ts +346 -44
- package/src/voice/agent_activity.test.ts +194 -0
- package/src/voice/agent_activity.ts +1457 -388
- package/src/voice/agent_session.ts +817 -112
- package/src/voice/audio_recognition.ts +845 -70
- package/src/voice/audio_recognition_span.test.ts +341 -0
- package/src/voice/avatar/datastream_io.ts +9 -1
- package/src/voice/background_audio.ts +494 -0
- package/src/voice/events.ts +27 -7
- package/src/voice/generation.ts +310 -56
- package/src/voice/generation_tools.test.ts +268 -0
- package/src/voice/index.ts +17 -3
- package/src/voice/interruption_detection.test.ts +151 -0
- package/src/voice/io.ts +115 -12
- package/src/voice/recorder_io/index.ts +4 -0
- package/src/voice/recorder_io/recorder_io.ts +783 -0
- package/src/voice/remote_session.ts +1083 -0
- package/src/voice/report.test.ts +136 -0
- package/src/voice/report.ts +140 -0
- package/src/voice/room_io/_input.ts +45 -10
- package/src/voice/room_io/_output.ts +26 -14
- package/src/voice/room_io/room_io.ts +67 -22
- package/src/voice/speech_handle.ts +38 -6
- package/src/voice/testing/fake_llm.ts +138 -0
- package/src/voice/testing/index.ts +52 -0
- package/src/voice/testing/run_result.ts +995 -0
- package/src/voice/testing/types.ts +118 -0
- package/src/voice/transcription/synchronizer.test.ts +206 -0
- package/src/voice/transcription/synchronizer.ts +204 -19
- package/src/voice/turn_config/endpointing.ts +33 -0
- package/src/voice/turn_config/interruption.ts +56 -0
- package/src/voice/turn_config/turn_handling.ts +45 -0
- package/src/voice/turn_config/utils.test.ts +148 -0
- package/src/voice/turn_config/utils.ts +167 -0
- package/src/voice/utils.ts +29 -0
- package/src/worker.ts +92 -78
- package/src/llm/__snapshots__/utils.test.ts.snap +0 -65
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import { log } from "../../log.js";
|
|
2
|
+
import {
|
|
3
|
+
} from "../agent_session.js";
|
|
4
|
+
import { defaultEndpointingOptions } from "./endpointing.js";
|
|
5
|
+
import { defaultInterruptionOptions } from "./interruption.js";
|
|
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
|
+
};
|
|
21
|
+
function migrateLegacyOptions(legacyOptions) {
|
|
22
|
+
var _a, _b, _c;
|
|
23
|
+
const logger = log();
|
|
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) {
|
|
36
|
+
logger.warn(
|
|
37
|
+
"voiceOptions is deprecated, use top-level SessionOptions fields on AgentSessionOptions instead"
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
const turnHandling = {
|
|
41
|
+
interruption: {
|
|
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
|
|
46
|
+
},
|
|
47
|
+
endpointing: {
|
|
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
|
|
51
|
+
},
|
|
52
|
+
turnDetection: ((_c = sessionOptions == null ? void 0 : sessionOptions.turnHandling) == null ? void 0 : _c.turnDetection) ?? turnDetection
|
|
53
|
+
};
|
|
54
|
+
if ((voiceOptions == null ? void 0 : voiceOptions.allowInterruptions) === false && turnHandling.interruption.enabled === void 0) {
|
|
55
|
+
turnHandling.interruption.enabled = false;
|
|
56
|
+
}
|
|
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,
|
|
75
|
+
...defaultSessionOptions,
|
|
76
|
+
...migratedVoiceOptions,
|
|
77
|
+
...sessionOptions,
|
|
78
|
+
turnHandling: mergeWithDefaults(turnHandling),
|
|
79
|
+
// repopulate the deprecated voice options with migrated options for backwards compatibility
|
|
80
|
+
voiceOptions: legacyVoiceOptions
|
|
81
|
+
};
|
|
82
|
+
return { agentSessionOptions, legacyVoiceOptions };
|
|
83
|
+
}
|
|
84
|
+
function stripUndefined(obj) {
|
|
85
|
+
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
|
|
86
|
+
}
|
|
87
|
+
function mergeWithDefaults(config) {
|
|
88
|
+
return {
|
|
89
|
+
turnDetection: config.turnDetection ?? defaultTurnHandlingOptions.turnDetection,
|
|
90
|
+
endpointing: { ...defaultEndpointingOptions, ...stripUndefined(config.endpointing) },
|
|
91
|
+
interruption: { ...defaultInterruptionOptions, ...stripUndefined(config.interruption) }
|
|
92
|
+
};
|
|
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
|
+
}
|
|
125
|
+
export {
|
|
126
|
+
mergeWithDefaults,
|
|
127
|
+
migrateLegacyOptions,
|
|
128
|
+
migrateTurnHandling,
|
|
129
|
+
stripUndefined
|
|
130
|
+
};
|
|
131
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +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 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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MAAI,OAAO,KAAK,YAAY,EAAE,SAAS,GAAG;AACxC,aAAS,eAAe;AAAA,EAC1B;AAEA,MAAI,KAAK,kBAAkB,QAAW;AACpC,aAAS,gBAAgB,KAAK;AAAA,EAChC;AAEA,SAAO;AAAA,IACL,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":[]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_vitest = require("vitest");
|
|
3
|
+
var import_log = require("../../log.cjs");
|
|
4
|
+
var import_agent_session = require("../agent_session.cjs");
|
|
5
|
+
var import_endpointing = require("./endpointing.cjs");
|
|
6
|
+
var import_interruption = require("./interruption.cjs");
|
|
7
|
+
var import_turn_handling = require("./turn_handling.cjs");
|
|
8
|
+
var import_utils = require("./utils.cjs");
|
|
9
|
+
(0, import_vitest.beforeAll)(() => {
|
|
10
|
+
(0, import_log.initializeLogger)({ pretty: true, level: "info" });
|
|
11
|
+
});
|
|
12
|
+
(0, import_vitest.describe)("migrateLegacyOptions", () => {
|
|
13
|
+
(0, import_vitest.it)("should return all defaults when no options are provided", () => {
|
|
14
|
+
const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({});
|
|
15
|
+
(0, import_vitest.expect)(result.turnHandling).toEqual({
|
|
16
|
+
turnDetection: import_turn_handling.defaultTurnHandlingOptions.turnDetection,
|
|
17
|
+
endpointing: import_endpointing.defaultEndpointingOptions,
|
|
18
|
+
interruption: import_interruption.defaultInterruptionOptions
|
|
19
|
+
});
|
|
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);
|
|
23
|
+
});
|
|
24
|
+
(0, import_vitest.it)("should migrate legacy flat fields into nested turnHandling config", () => {
|
|
25
|
+
const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({
|
|
26
|
+
voiceOptions: {
|
|
27
|
+
minInterruptionDuration: 1e3,
|
|
28
|
+
minInterruptionWords: 3,
|
|
29
|
+
discardAudioIfUninterruptible: false,
|
|
30
|
+
minEndpointingDelay: 800,
|
|
31
|
+
maxEndpointingDelay: 5e3
|
|
32
|
+
}
|
|
33
|
+
});
|
|
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);
|
|
39
|
+
});
|
|
40
|
+
(0, import_vitest.it)("should set interruption.enabled to false when allowInterruptions is false", () => {
|
|
41
|
+
const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({
|
|
42
|
+
voiceOptions: { allowInterruptions: false }
|
|
43
|
+
});
|
|
44
|
+
(0, import_vitest.expect)(result.turnHandling.interruption.enabled).toBe(false);
|
|
45
|
+
});
|
|
46
|
+
(0, import_vitest.it)("should give top-level fields precedence over voiceOptions", () => {
|
|
47
|
+
const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({
|
|
48
|
+
voiceOptions: {
|
|
49
|
+
minInterruptionDuration: 1e3,
|
|
50
|
+
maxEndpointingDelay: 5e3,
|
|
51
|
+
maxToolSteps: 10
|
|
52
|
+
},
|
|
53
|
+
turnHandling: {
|
|
54
|
+
interruption: {
|
|
55
|
+
minDuration: 2e3
|
|
56
|
+
},
|
|
57
|
+
endpointing: {
|
|
58
|
+
maxDelay: 8e3
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
maxToolSteps: 5
|
|
62
|
+
});
|
|
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);
|
|
66
|
+
});
|
|
67
|
+
(0, import_vitest.it)("should preserve top-level turnDetection in the result", () => {
|
|
68
|
+
const { agentSessionOptions: result } = (0, import_utils.migrateLegacyOptions)({
|
|
69
|
+
turnDetection: "vad"
|
|
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" });
|
|
99
|
+
(0, import_vitest.expect)(result.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);
|
|
126
|
+
});
|
|
127
|
+
});
|
|
128
|
+
//# sourceMappingURL=utils.test.cjs.map
|
|
@@ -0,0 +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 { 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,oBAAgD;AAChD,iBAAiC;AACjC,2BAA2C;AAC3C,yBAA0C;AAC1C,0BAA2C;AAC3C,2BAA2C;AAC3C,mBAA0D;AAAA,IAE1D,yBAAU,MAAM;AACd,mCAAiB,EAAE,QAAQ,MAAM,OAAO,OAAO,CAAC;AAClD,CAAC;AAAA,IAED,wBAAS,wBAAwB,MAAM;AACrC,wBAAG,2DAA2D,MAAM;AAClE,UAAM,EAAE,qBAAqB,OAAO,QAAI,mCAAqB,CAAC,CAAC;AAE/D,8BAAO,OAAO,YAAY,EAAE,QAAQ;AAAA,MAClC,eAAe,gDAA2B;AAAA,MAC1C,aAAa;AAAA,MACb,cAAc;AAAA,IAChB,CAAC;AACD,8BAAO,OAAO,YAAY,EAAE,KAAK,gDAA2B,YAAY;AACxE,8BAAO,OAAO,oBAAoB,EAAE,KAAK,gDAA2B,oBAAoB;AAC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AE,eAAe,MAAM,CAAC;AAC3D,8BAAO,OAAO,aAAa,EAAE,KAAK,KAAK;AAAA,EACzC,CAAC;AAED,wBAAG,8CAA8C,MAAM;AACrD,UAAM,aAAS,kCAAoB;AAAA,MACjC,eAAe;AAAA,MACf,oBAAoB;AAAA,MACpB,qBAAqB;AAAA,MACrB,qBAAqB;AAAA,IACvB,CAAC;AACD,8BAAO,OAAO,aAAa,EAAE,KAAK,KAAK;AACvC,8BAAO,OAAO,YAAY,EAAE,QAAQ,EAAE,SAAS,MAAM,CAAC;AACtD,8BAAO,OAAO,WAAW,EAAE,QAAQ,EAAE,UAAU,KAAK,UAAU,IAAK,CAAC;AAAA,EACtE,CAAC;AAED,wBAAG,gFAAgF,MAAM;AACvF,UAAM,eAAe;AAAA,MACnB,aAAa,EAAE,UAAU,KAAK,UAAU,IAAK;AAAA,MAC7C,cAAc,EAAE,SAAS,KAAK;AAAA,MAC9B,eAAe;AAAA,IACjB;AACA,UAAM,aAAS,kCAAoB;AAAA,MACjC;AAAA,MACA,eAAe;AAAA,MACf,oBAAoB;AAAA,MACpB,qBAAqB;AAAA,MACrB,qBAAqB;AAAA,IACvB,CAAC;AACD,8BAAO,MAAM,EAAE,QAAQ,YAAY;AAAA,EACrC,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { beforeAll, describe, expect, it } from "vitest";
|
|
2
|
+
import { initializeLogger } from "../../log.js";
|
|
3
|
+
import { defaultAgentSessionOptions } from "../agent_session.js";
|
|
4
|
+
import { defaultEndpointingOptions } from "./endpointing.js";
|
|
5
|
+
import { defaultInterruptionOptions } from "./interruption.js";
|
|
6
|
+
import { defaultTurnHandlingOptions } from "./turn_handling.js";
|
|
7
|
+
import { migrateLegacyOptions, migrateTurnHandling } from "./utils.js";
|
|
8
|
+
beforeAll(() => {
|
|
9
|
+
initializeLogger({ pretty: true, level: "info" });
|
|
10
|
+
});
|
|
11
|
+
describe("migrateLegacyOptions", () => {
|
|
12
|
+
it("should return all defaults when no options are provided", () => {
|
|
13
|
+
const { agentSessionOptions: result } = migrateLegacyOptions({});
|
|
14
|
+
expect(result.turnHandling).toEqual({
|
|
15
|
+
turnDetection: defaultTurnHandlingOptions.turnDetection,
|
|
16
|
+
endpointing: defaultEndpointingOptions,
|
|
17
|
+
interruption: defaultInterruptionOptions
|
|
18
|
+
});
|
|
19
|
+
expect(result.maxToolSteps).toBe(defaultAgentSessionOptions.maxToolSteps);
|
|
20
|
+
expect(result.preemptiveGeneration).toBe(defaultAgentSessionOptions.preemptiveGeneration);
|
|
21
|
+
expect(result.userAwayTimeout).toBe(defaultAgentSessionOptions.userAwayTimeout);
|
|
22
|
+
});
|
|
23
|
+
it("should migrate legacy flat fields into nested turnHandling config", () => {
|
|
24
|
+
const { agentSessionOptions: result } = migrateLegacyOptions({
|
|
25
|
+
voiceOptions: {
|
|
26
|
+
minInterruptionDuration: 1e3,
|
|
27
|
+
minInterruptionWords: 3,
|
|
28
|
+
discardAudioIfUninterruptible: false,
|
|
29
|
+
minEndpointingDelay: 800,
|
|
30
|
+
maxEndpointingDelay: 5e3
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
expect(result.turnHandling.interruption.minDuration).toBe(1e3);
|
|
34
|
+
expect(result.turnHandling.interruption.minWords).toBe(3);
|
|
35
|
+
expect(result.turnHandling.interruption.discardAudioIfUninterruptible).toBe(false);
|
|
36
|
+
expect(result.turnHandling.endpointing.minDelay).toBe(800);
|
|
37
|
+
expect(result.turnHandling.endpointing.maxDelay).toBe(5e3);
|
|
38
|
+
});
|
|
39
|
+
it("should set interruption.enabled to false when allowInterruptions is false", () => {
|
|
40
|
+
const { agentSessionOptions: result } = migrateLegacyOptions({
|
|
41
|
+
voiceOptions: { allowInterruptions: false }
|
|
42
|
+
});
|
|
43
|
+
expect(result.turnHandling.interruption.enabled).toBe(false);
|
|
44
|
+
});
|
|
45
|
+
it("should give top-level fields precedence over voiceOptions", () => {
|
|
46
|
+
const { agentSessionOptions: result } = migrateLegacyOptions({
|
|
47
|
+
voiceOptions: {
|
|
48
|
+
minInterruptionDuration: 1e3,
|
|
49
|
+
maxEndpointingDelay: 5e3,
|
|
50
|
+
maxToolSteps: 10
|
|
51
|
+
},
|
|
52
|
+
turnHandling: {
|
|
53
|
+
interruption: {
|
|
54
|
+
minDuration: 2e3
|
|
55
|
+
},
|
|
56
|
+
endpointing: {
|
|
57
|
+
maxDelay: 8e3
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
maxToolSteps: 5
|
|
61
|
+
});
|
|
62
|
+
expect(result.turnHandling.interruption.minDuration).toBe(2e3);
|
|
63
|
+
expect(result.turnHandling.endpointing.maxDelay).toBe(8e3);
|
|
64
|
+
expect(result.maxToolSteps).toBe(5);
|
|
65
|
+
});
|
|
66
|
+
it("should preserve top-level turnDetection in the result", () => {
|
|
67
|
+
const { agentSessionOptions: result } = migrateLegacyOptions({
|
|
68
|
+
turnDetection: "vad"
|
|
69
|
+
});
|
|
70
|
+
expect(result.turnHandling.turnDetection).toBe("vad");
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
describe("migrateTurnHandling", () => {
|
|
74
|
+
it("should return empty partial when no deprecated Agent fields are given", () => {
|
|
75
|
+
const result = migrateTurnHandling({});
|
|
76
|
+
expect(result).toEqual({});
|
|
77
|
+
});
|
|
78
|
+
it("should set interruption.enabled to false when allowInterruptions is false", () => {
|
|
79
|
+
const result = migrateTurnHandling({ allowInterruptions: false });
|
|
80
|
+
expect(result.interruption).toEqual({ enabled: false });
|
|
81
|
+
expect(result.endpointing).toBeUndefined();
|
|
82
|
+
expect(result.turnDetection).toBeUndefined();
|
|
83
|
+
});
|
|
84
|
+
it("should not set interruption when allowInterruptions is true or undefined", () => {
|
|
85
|
+
expect(migrateTurnHandling({ allowInterruptions: true })).toEqual({});
|
|
86
|
+
expect(migrateTurnHandling({ allowInterruptions: void 0 })).toEqual({});
|
|
87
|
+
});
|
|
88
|
+
it("should map minEndpointingDelay to endpointing.minDelay", () => {
|
|
89
|
+
const result = migrateTurnHandling({ minEndpointingDelay: 800 });
|
|
90
|
+
expect(result.endpointing).toEqual({ minDelay: 800 });
|
|
91
|
+
});
|
|
92
|
+
it("should map maxEndpointingDelay to endpointing.maxDelay", () => {
|
|
93
|
+
const result = migrateTurnHandling({ maxEndpointingDelay: 5e3 });
|
|
94
|
+
expect(result.endpointing).toEqual({ maxDelay: 5e3 });
|
|
95
|
+
});
|
|
96
|
+
it("should pass through turnDetection", () => {
|
|
97
|
+
const result = migrateTurnHandling({ turnDetection: "vad" });
|
|
98
|
+
expect(result.turnDetection).toBe("vad");
|
|
99
|
+
});
|
|
100
|
+
it("should combine all deprecated Agent fields", () => {
|
|
101
|
+
const result = migrateTurnHandling({
|
|
102
|
+
turnDetection: "stt",
|
|
103
|
+
allowInterruptions: false,
|
|
104
|
+
minEndpointingDelay: 400,
|
|
105
|
+
maxEndpointingDelay: 3e3
|
|
106
|
+
});
|
|
107
|
+
expect(result.turnDetection).toBe("stt");
|
|
108
|
+
expect(result.interruption).toEqual({ enabled: false });
|
|
109
|
+
expect(result.endpointing).toEqual({ minDelay: 400, maxDelay: 3e3 });
|
|
110
|
+
});
|
|
111
|
+
it("should ignore deprecated Agent fields when explicit turnHandling is provided", () => {
|
|
112
|
+
const turnHandling = {
|
|
113
|
+
endpointing: { minDelay: 999, maxDelay: 4e3 },
|
|
114
|
+
interruption: { enabled: true },
|
|
115
|
+
turnDetection: "vad"
|
|
116
|
+
};
|
|
117
|
+
const result = migrateTurnHandling({
|
|
118
|
+
turnHandling,
|
|
119
|
+
turnDetection: "stt",
|
|
120
|
+
allowInterruptions: false,
|
|
121
|
+
minEndpointingDelay: 100,
|
|
122
|
+
maxEndpointingDelay: 200
|
|
123
|
+
});
|
|
124
|
+
expect(result).toEqual(turnHandling);
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
//# sourceMappingURL=utils.test.js.map
|
|
@@ -0,0 +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 { 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,SAAS,WAAW,UAAU,QAAQ,UAAU;AAChD,SAAS,wBAAwB;AACjC,SAAS,kCAAkC;AAC3C,SAAS,iCAAiC;AAC1C,SAAS,kCAAkC;AAC3C,SAAS,kCAAkC;AAC3C,SAAS,sBAAsB,2BAA2B;AAE1D,UAAU,MAAM;AACd,mBAAiB,EAAE,QAAQ,MAAM,OAAO,OAAO,CAAC;AAClD,CAAC;AAED,SAAS,wBAAwB,MAAM;AACrC,KAAG,2DAA2D,MAAM;AAClE,UAAM,EAAE,qBAAqB,OAAO,IAAI,qBAAqB,CAAC,CAAC;AAE/D,WAAO,OAAO,YAAY,EAAE,QAAQ;AAAA,MAClC,eAAe,2BAA2B;AAAA,MAC1C,aAAa;AAAA,MACb,cAAc;AAAA,IAChB,CAAC;AACD,WAAO,OAAO,YAAY,EAAE,KAAK,2BAA2B,YAAY;AACxE,WAAO,OAAO,oBAAoB,EAAE,KAAK,2BAA2B,oBAAoB;AACxF,WAAO,OAAO,eAAe,EAAE,KAAK,2BAA2B,eAAe;AAAA,EAChF,CAAC;AAED,KAAG,qEAAqE,MAAM;AAC5E,UAAM,EAAE,qBAAqB,OAAO,IAAI,qBAAqB;AAAA,MAC3D,cAAc;AAAA,QACZ,yBAAyB;AAAA,QACzB,sBAAsB;AAAA,QACtB,+BAA+B;AAAA,QAC/B,qB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WAAO,OAAO,YAAY,EAAE,QAAQ,EAAE,SAAS,MAAM,CAAC;AACtD,WAAO,OAAO,WAAW,EAAE,QAAQ,EAAE,UAAU,KAAK,UAAU,IAAK,CAAC;AAAA,EACtE,CAAC;AAED,KAAG,gFAAgF,MAAM;AACvF,UAAM,eAAe;AAAA,MACnB,aAAa,EAAE,UAAU,KAAK,UAAU,IAAK;AAAA,MAC7C,cAAc,EAAE,SAAS,KAAK;AAAA,MAC9B,eAAe;AAAA,IACjB;AACA,UAAM,SAAS,oBAAoB;AAAA,MACjC;AAAA,MACA,eAAe;AAAA,MACf,oBAAoB;AAAA,MACpB,qBAAqB;AAAA,MACrB,qBAAqB;AAAA,IACvB,CAAC;AACD,WAAO,MAAM,EAAE,QAAQ,YAAY;AAAA,EACrC,CAAC;AACH,CAAC;","names":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
setParticipantSpanAttributes: () => setParticipantSpanAttributes
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
|
+
var import_telemetry = require("../telemetry/index.cjs");
|
|
25
|
+
function setParticipantSpanAttributes(span, participant) {
|
|
26
|
+
if (participant.sid) {
|
|
27
|
+
span.setAttribute(import_telemetry.traceTypes.ATTR_PARTICIPANT_ID, participant.sid);
|
|
28
|
+
}
|
|
29
|
+
span.setAttribute(import_telemetry.traceTypes.ATTR_PARTICIPANT_IDENTITY, participant.identity);
|
|
30
|
+
span.setAttribute(import_telemetry.traceTypes.ATTR_PARTICIPANT_KIND, participantKindName(participant.kind));
|
|
31
|
+
}
|
|
32
|
+
function participantKindName(kind) {
|
|
33
|
+
const names = {
|
|
34
|
+
0: "STANDARD",
|
|
35
|
+
1: "INGRESS",
|
|
36
|
+
2: "EGRESS",
|
|
37
|
+
3: "SIP",
|
|
38
|
+
4: "AGENT",
|
|
39
|
+
5: "CONNECTOR"
|
|
40
|
+
};
|
|
41
|
+
return names[kind] ?? String(kind);
|
|
42
|
+
}
|
|
43
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
44
|
+
0 && (module.exports = {
|
|
45
|
+
setParticipantSpanAttributes
|
|
46
|
+
});
|
|
47
|
+
//# sourceMappingURL=utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/voice/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { Participant, ParticipantKind } from '@livekit/rtc-node';\nimport type { Span } from '@opentelemetry/api';\nimport { traceTypes } from '../telemetry/index.js';\n\nexport function setParticipantSpanAttributes(\n span: Span,\n participant: Pick<Participant, 'sid' | 'identity' | 'kind'>,\n): void {\n if (participant.sid) {\n span.setAttribute(traceTypes.ATTR_PARTICIPANT_ID, participant.sid);\n }\n span.setAttribute(traceTypes.ATTR_PARTICIPANT_IDENTITY, participant.identity);\n span.setAttribute(traceTypes.ATTR_PARTICIPANT_KIND, participantKindName(participant.kind));\n}\n\nfunction participantKindName(kind: ParticipantKind): string {\n const names: Record<number, string> = {\n 0: 'STANDARD',\n 1: 'INGRESS',\n 2: 'EGRESS',\n 3: 'SIP',\n 4: 'AGENT',\n 5: 'CONNECTOR',\n };\n return names[kind as number] ?? String(kind);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,uBAA2B;AAEpB,SAAS,6BACd,MACA,aACM;AACN,MAAI,YAAY,KAAK;AACnB,SAAK,aAAa,4BAAW,qBAAqB,YAAY,GAAG;AAAA,EACnE;AACA,OAAK,aAAa,4BAAW,2BAA2B,YAAY,QAAQ;AAC5E,OAAK,aAAa,4BAAW,uBAAuB,oBAAoB,YAAY,IAAI,CAAC;AAC3F;AAEA,SAAS,oBAAoB,MAA+B;AAC1D,QAAM,QAAgC;AAAA,IACpC,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACA,SAAO,MAAM,IAAc,KAAK,OAAO,IAAI;AAC7C;","names":[]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Participant } from '@livekit/rtc-node';
|
|
2
|
+
import type { Span } from '@opentelemetry/api';
|
|
3
|
+
export declare function setParticipantSpanAttributes(span: Span, participant: Pick<Participant, 'sid' | 'identity' | 'kind'>): void;
|
|
4
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Participant } from '@livekit/rtc-node';
|
|
2
|
+
import type { Span } from '@opentelemetry/api';
|
|
3
|
+
export declare function setParticipantSpanAttributes(span: Span, participant: Pick<Participant, 'sid' | 'identity' | 'kind'>): void;
|
|
4
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/voice/utils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAmB,MAAM,mBAAmB,CAAC;AACtE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAG/C,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,KAAK,GAAG,UAAU,GAAG,MAAM,CAAC,GAC1D,IAAI,CAMN"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { traceTypes } from "../telemetry/index.js";
|
|
2
|
+
function setParticipantSpanAttributes(span, participant) {
|
|
3
|
+
if (participant.sid) {
|
|
4
|
+
span.setAttribute(traceTypes.ATTR_PARTICIPANT_ID, participant.sid);
|
|
5
|
+
}
|
|
6
|
+
span.setAttribute(traceTypes.ATTR_PARTICIPANT_IDENTITY, participant.identity);
|
|
7
|
+
span.setAttribute(traceTypes.ATTR_PARTICIPANT_KIND, participantKindName(participant.kind));
|
|
8
|
+
}
|
|
9
|
+
function participantKindName(kind) {
|
|
10
|
+
const names = {
|
|
11
|
+
0: "STANDARD",
|
|
12
|
+
1: "INGRESS",
|
|
13
|
+
2: "EGRESS",
|
|
14
|
+
3: "SIP",
|
|
15
|
+
4: "AGENT",
|
|
16
|
+
5: "CONNECTOR"
|
|
17
|
+
};
|
|
18
|
+
return names[kind] ?? String(kind);
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
setParticipantSpanAttributes
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/voice/utils.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { Participant, ParticipantKind } from '@livekit/rtc-node';\nimport type { Span } from '@opentelemetry/api';\nimport { traceTypes } from '../telemetry/index.js';\n\nexport function setParticipantSpanAttributes(\n span: Span,\n participant: Pick<Participant, 'sid' | 'identity' | 'kind'>,\n): void {\n if (participant.sid) {\n span.setAttribute(traceTypes.ATTR_PARTICIPANT_ID, participant.sid);\n }\n span.setAttribute(traceTypes.ATTR_PARTICIPANT_IDENTITY, participant.identity);\n span.setAttribute(traceTypes.ATTR_PARTICIPANT_KIND, participantKindName(participant.kind));\n}\n\nfunction participantKindName(kind: ParticipantKind): string {\n const names: Record<number, string> = {\n 0: 'STANDARD',\n 1: 'INGRESS',\n 2: 'EGRESS',\n 3: 'SIP',\n 4: 'AGENT',\n 5: 'CONNECTOR',\n };\n return names[kind as number] ?? String(kind);\n}\n"],"mappings":"AAKA,SAAS,kBAAkB;AAEpB,SAAS,6BACd,MACA,aACM;AACN,MAAI,YAAY,KAAK;AACnB,SAAK,aAAa,WAAW,qBAAqB,YAAY,GAAG;AAAA,EACnE;AACA,OAAK,aAAa,WAAW,2BAA2B,YAAY,QAAQ;AAC5E,OAAK,aAAa,WAAW,uBAAuB,oBAAoB,YAAY,IAAI,CAAC;AAC3F;AAEA,SAAS,oBAAoB,MAA+B;AAC1D,QAAM,QAAgC;AAAA,IACpC,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,IACH,GAAG;AAAA,EACL;AACA,SAAO,MAAM,IAAc,KAAK,OAAO,IAAI;AAC7C;","names":[]}
|