@livekit/agents 1.0.47 → 1.1.0-dev.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/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/constants.cjs +27 -0
- package/dist/constants.cjs.map +1 -1
- package/dist/constants.d.cts +9 -0
- package/dist/constants.d.ts +9 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +18 -0
- package/dist/constants.js.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/inference/api_protos.d.cts +12 -12
- package/dist/inference/api_protos.d.ts +12 -12
- 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 +147 -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 +121 -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 +181 -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 +147 -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 +329 -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 +295 -0
- package/dist/inference/interruption/ws_transport.js.map +1 -0
- package/dist/inference/llm.cjs +14 -10
- package/dist/inference/llm.cjs.map +1 -1
- package/dist/inference/llm.d.cts +2 -1
- package/dist/inference/llm.d.ts +2 -1
- package/dist/inference/llm.d.ts.map +1 -1
- package/dist/inference/llm.js +8 -10
- package/dist/inference/llm.js.map +1 -1
- package/dist/inference/stt.cjs +7 -2
- package/dist/inference/stt.cjs.map +1 -1
- package/dist/inference/stt.d.cts +2 -0
- package/dist/inference/stt.d.ts +2 -0
- package/dist/inference/stt.d.ts.map +1 -1
- package/dist/inference/stt.js +8 -3
- package/dist/inference/stt.js.map +1 -1
- package/dist/inference/tts.cjs +7 -2
- package/dist/inference/tts.cjs.map +1 -1
- package/dist/inference/tts.d.cts +2 -0
- package/dist/inference/tts.d.ts +2 -0
- package/dist/inference/tts.d.ts.map +1 -1
- package/dist/inference/tts.js +8 -3
- package/dist/inference/tts.js.map +1 -1
- package/dist/inference/utils.cjs +26 -7
- package/dist/inference/utils.cjs.map +1 -1
- package/dist/inference/utils.d.cts +13 -0
- package/dist/inference/utils.d.ts +13 -0
- 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/llm/chat_context.cjs +108 -2
- package/dist/llm/chat_context.cjs.map +1 -1
- package/dist/llm/chat_context.d.cts +28 -1
- package/dist/llm/chat_context.d.ts +28 -1
- package/dist/llm/chat_context.d.ts.map +1 -1
- package/dist/llm/chat_context.js +108 -2
- package/dist/llm/chat_context.js.map +1 -1
- package/dist/llm/chat_context.test.cjs +43 -0
- package/dist/llm/chat_context.test.cjs.map +1 -1
- package/dist/llm/chat_context.test.js +43 -0
- package/dist/llm/chat_context.test.js.map +1 -1
- package/dist/llm/index.cjs +2 -0
- package/dist/llm/index.cjs.map +1 -1
- package/dist/llm/index.d.cts +2 -2
- package/dist/llm/index.d.ts +2 -2
- package/dist/llm/index.d.ts.map +1 -1
- package/dist/llm/index.js +3 -1
- package/dist/llm/index.js.map +1 -1
- package/dist/llm/llm.cjs +16 -1
- package/dist/llm/llm.cjs.map +1 -1
- package/dist/llm/llm.d.cts +9 -0
- package/dist/llm/llm.d.ts +9 -0
- package/dist/llm/llm.d.ts.map +1 -1
- package/dist/llm/llm.js +16 -1
- package/dist/llm/llm.js.map +1 -1
- package/dist/llm/provider_format/index.d.cts +1 -1
- package/dist/llm/provider_format/index.d.ts +1 -1
- package/dist/llm/realtime.cjs +3 -0
- package/dist/llm/realtime.cjs.map +1 -1
- package/dist/llm/realtime.d.cts +1 -0
- package/dist/llm/realtime.d.ts +1 -0
- 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/tool_context.cjs +7 -0
- package/dist/llm/tool_context.cjs.map +1 -1
- package/dist/llm/tool_context.d.cts +10 -2
- package/dist/llm/tool_context.d.ts +10 -2
- package/dist/llm/tool_context.d.ts.map +1 -1
- package/dist/llm/tool_context.js +6 -0
- package/dist/llm/tool_context.js.map +1 -1
- package/dist/metrics/base.cjs.map +1 -1
- package/dist/metrics/base.d.cts +45 -1
- package/dist/metrics/base.d.ts +45 -1
- 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 +3 -0
- package/dist/metrics/usage_collector.cjs.map +1 -1
- package/dist/metrics/usage_collector.d.cts +9 -0
- package/dist/metrics/usage_collector.d.ts +9 -0
- package/dist/metrics/usage_collector.d.ts.map +1 -1
- package/dist/metrics/usage_collector.js +3 -0
- package/dist/metrics/usage_collector.js.map +1 -1
- package/dist/metrics/utils.cjs +9 -0
- package/dist/metrics/utils.cjs.map +1 -1
- package/dist/metrics/utils.d.ts.map +1 -1
- package/dist/metrics/utils.js +9 -0
- package/dist/metrics/utils.js.map +1 -1
- package/dist/stream/multi_input_stream.test.cjs +4 -0
- package/dist/stream/multi_input_stream.test.cjs.map +1 -1
- package/dist/stream/multi_input_stream.test.js +5 -1
- package/dist/stream/multi_input_stream.test.js.map +1 -1
- package/dist/stream/stream_channel.cjs +31 -0
- package/dist/stream/stream_channel.cjs.map +1 -1
- package/dist/stream/stream_channel.d.cts +4 -2
- package/dist/stream/stream_channel.d.ts +4 -2
- package/dist/stream/stream_channel.d.ts.map +1 -1
- package/dist/stream/stream_channel.js +31 -0
- package/dist/stream/stream_channel.js.map +1 -1
- package/dist/stt/stt.cjs +34 -2
- package/dist/stt/stt.cjs.map +1 -1
- package/dist/stt/stt.d.cts +22 -0
- package/dist/stt/stt.d.ts +22 -0
- package/dist/stt/stt.d.ts.map +1 -1
- package/dist/stt/stt.js +34 -2
- package/dist/stt/stt.js.map +1 -1
- package/dist/telemetry/otel_http_exporter.cjs +24 -5
- package/dist/telemetry/otel_http_exporter.cjs.map +1 -1
- package/dist/telemetry/otel_http_exporter.d.cts +1 -0
- package/dist/telemetry/otel_http_exporter.d.ts +1 -0
- package/dist/telemetry/otel_http_exporter.d.ts.map +1 -1
- package/dist/telemetry/otel_http_exporter.js +24 -5
- package/dist/telemetry/otel_http_exporter.js.map +1 -1
- package/dist/telemetry/trace_types.cjs +5 -5
- package/dist/telemetry/trace_types.cjs.map +1 -1
- package/dist/telemetry/trace_types.d.cts +9 -5
- package/dist/telemetry/trace_types.d.ts +9 -5
- package/dist/telemetry/trace_types.d.ts.map +1 -1
- package/dist/telemetry/trace_types.js +5 -5
- package/dist/telemetry/trace_types.js.map +1 -1
- package/dist/telemetry/traces.cjs +47 -8
- package/dist/telemetry/traces.cjs.map +1 -1
- package/dist/telemetry/traces.d.ts.map +1 -1
- package/dist/telemetry/traces.js +47 -8
- package/dist/telemetry/traces.js.map +1 -1
- package/dist/tts/tts.cjs +64 -2
- package/dist/tts/tts.cjs.map +1 -1
- package/dist/tts/tts.d.cts +34 -0
- package/dist/tts/tts.d.ts +34 -0
- package/dist/tts/tts.d.ts.map +1 -1
- package/dist/tts/tts.js +64 -2
- package/dist/tts/tts.js.map +1 -1
- package/dist/utils.cjs +1 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -0
- package/dist/utils.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/voice/agent.cjs +34 -4
- package/dist/voice/agent.cjs.map +1 -1
- package/dist/voice/agent.d.cts +11 -2
- package/dist/voice/agent.d.ts +11 -2
- package/dist/voice/agent.d.ts.map +1 -1
- package/dist/voice/agent.js +34 -4
- package/dist/voice/agent.js.map +1 -1
- package/dist/voice/agent_activity.cjs +292 -44
- package/dist/voice/agent_activity.cjs.map +1 -1
- package/dist/voice/agent_activity.d.cts +27 -6
- package/dist/voice/agent_activity.d.ts +27 -6
- package/dist/voice/agent_activity.d.ts.map +1 -1
- package/dist/voice/agent_activity.js +293 -45
- package/dist/voice/agent_activity.js.map +1 -1
- package/dist/voice/agent_session.cjs +105 -48
- package/dist/voice/agent_session.cjs.map +1 -1
- package/dist/voice/agent_session.d.cts +90 -20
- package/dist/voice/agent_session.d.ts +90 -20
- package/dist/voice/agent_session.d.ts.map +1 -1
- package/dist/voice/agent_session.js +105 -46
- package/dist/voice/agent_session.js.map +1 -1
- package/dist/voice/audio_recognition.cjs +287 -6
- package/dist/voice/audio_recognition.cjs.map +1 -1
- package/dist/voice/audio_recognition.d.cts +42 -3
- package/dist/voice/audio_recognition.d.ts +42 -3
- package/dist/voice/audio_recognition.d.ts.map +1 -1
- package/dist/voice/audio_recognition.js +289 -7
- package/dist/voice/audio_recognition.js.map +1 -1
- package/dist/voice/client_events.cjs +554 -0
- package/dist/voice/client_events.cjs.map +1 -0
- package/dist/voice/client_events.d.cts +195 -0
- package/dist/voice/client_events.d.ts +195 -0
- package/dist/voice/client_events.d.ts.map +1 -0
- package/dist/voice/client_events.js +548 -0
- package/dist/voice/client_events.js.map +1 -0
- package/dist/voice/events.cjs +1 -0
- package/dist/voice/events.cjs.map +1 -1
- package/dist/voice/events.d.cts +8 -5
- package/dist/voice/events.d.ts +8 -5
- package/dist/voice/events.d.ts.map +1 -1
- package/dist/voice/events.js +1 -0
- package/dist/voice/events.js.map +1 -1
- package/dist/voice/generation.cjs +43 -8
- package/dist/voice/generation.cjs.map +1 -1
- package/dist/voice/generation.d.cts +3 -3
- package/dist/voice/generation.d.ts +3 -3
- package/dist/voice/generation.d.ts.map +1 -1
- package/dist/voice/generation.js +43 -8
- package/dist/voice/generation.js.map +1 -1
- package/dist/voice/index.cjs +1 -0
- package/dist/voice/index.cjs.map +1 -1
- package/dist/voice/index.d.cts +1 -0
- package/dist/voice/index.d.ts +1 -0
- package/dist/voice/index.d.ts.map +1 -1
- package/dist/voice/index.js +1 -0
- package/dist/voice/index.js.map +1 -1
- package/dist/voice/report.cjs +20 -8
- package/dist/voice/report.cjs.map +1 -1
- package/dist/voice/report.d.cts +5 -0
- package/dist/voice/report.d.ts +5 -0
- package/dist/voice/report.d.ts.map +1 -1
- package/dist/voice/report.js +20 -8
- package/dist/voice/report.js.map +1 -1
- package/dist/voice/report.test.cjs +106 -0
- package/dist/voice/report.test.cjs.map +1 -0
- package/dist/voice/report.test.js +105 -0
- package/dist/voice/report.test.js.map +1 -0
- package/dist/voice/room_io/room_io.cjs +16 -41
- package/dist/voice/room_io/room_io.cjs.map +1 -1
- package/dist/voice/room_io/room_io.d.cts +4 -9
- package/dist/voice/room_io/room_io.d.ts +4 -9
- package/dist/voice/room_io/room_io.d.ts.map +1 -1
- package/dist/voice/room_io/room_io.js +17 -43
- package/dist/voice/room_io/room_io.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 +3 -0
- package/dist/voice/testing/index.cjs.map +1 -1
- package/dist/voice/testing/index.d.cts +1 -0
- package/dist/voice/testing/index.d.ts +1 -0
- package/dist/voice/testing/index.d.ts.map +1 -1
- package/dist/voice/testing/index.js +2 -0
- package/dist/voice/testing/index.js.map +1 -1
- 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 +97 -0
- package/dist/voice/turn_config/utils.cjs.map +1 -0
- package/dist/voice/turn_config/utils.d.cts +25 -0
- package/dist/voice/turn_config/utils.d.ts +25 -0
- package/dist/voice/turn_config/utils.d.ts.map +1 -0
- package/dist/voice/turn_config/utils.js +73 -0
- package/dist/voice/turn_config/utils.js.map +1 -0
- package/dist/voice/turn_config/utils.test.cjs +86 -0
- package/dist/voice/turn_config/utils.test.cjs.map +1 -0
- package/dist/voice/turn_config/utils.test.js +85 -0
- package/dist/voice/turn_config/utils.test.js.map +1 -0
- package/dist/voice/wire_format.cjs +798 -0
- package/dist/voice/wire_format.cjs.map +1 -0
- package/dist/voice/wire_format.d.cts +5503 -0
- package/dist/voice/wire_format.d.ts +5503 -0
- package/dist/voice/wire_format.d.ts.map +1 -0
- package/dist/voice/wire_format.js +728 -0
- package/dist/voice/wire_format.js.map +1 -0
- package/package.json +2 -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/constants.ts +13 -0
- package/src/index.ts +2 -1
- package/src/inference/interruption/defaults.ts +51 -0
- package/src/inference/interruption/errors.ts +25 -0
- package/src/inference/interruption/http_transport.ts +187 -0
- package/src/inference/interruption/interruption_cache_entry.ts +50 -0
- package/src/inference/interruption/interruption_detector.ts +188 -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 +402 -0
- package/src/inference/llm.ts +9 -12
- package/src/inference/stt.ts +10 -3
- package/src/inference/tts.ts +10 -3
- package/src/inference/utils.ts +29 -1
- package/src/llm/chat_context.test.ts +48 -0
- package/src/llm/chat_context.ts +161 -0
- package/src/llm/index.ts +2 -0
- package/src/llm/llm.ts +16 -0
- package/src/llm/realtime.ts +4 -0
- package/src/llm/tool_context.ts +14 -0
- package/src/metrics/base.ts +48 -1
- package/src/metrics/index.ts +11 -0
- package/src/metrics/model_usage.test.ts +545 -0
- package/src/metrics/model_usage.ts +262 -0
- package/src/metrics/usage_collector.ts +11 -0
- package/src/metrics/utils.ts +11 -0
- package/src/stream/multi_input_stream.test.ts +6 -1
- package/src/stream/stream_channel.ts +34 -2
- package/src/stt/stt.ts +38 -0
- package/src/telemetry/otel_http_exporter.ts +28 -5
- package/src/telemetry/trace_types.ts +11 -8
- package/src/telemetry/traces.ts +111 -54
- package/src/tts/tts.ts +69 -1
- package/src/utils.ts +5 -0
- package/src/voice/agent.ts +41 -3
- package/src/voice/agent_activity.ts +371 -34
- package/src/voice/agent_session.ts +207 -59
- package/src/voice/audio_recognition.ts +385 -9
- package/src/voice/client_events.ts +838 -0
- package/src/voice/events.ts +14 -4
- package/src/voice/generation.ts +52 -9
- package/src/voice/index.ts +1 -0
- package/src/voice/report.test.ts +117 -0
- package/src/voice/report.ts +29 -6
- package/src/voice/room_io/room_io.ts +21 -64
- package/src/voice/testing/fake_llm.ts +138 -0
- package/src/voice/testing/index.ts +2 -0
- 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 +100 -0
- package/src/voice/turn_config/utils.ts +103 -0
- package/src/voice/wire_format.ts +827 -0
|
@@ -15,11 +15,13 @@ import {
|
|
|
15
15
|
isFunctionCallEvent,
|
|
16
16
|
isFunctionCallOutputEvent
|
|
17
17
|
} from "./types.js";
|
|
18
|
+
import { FakeLLM } from "./fake_llm.js";
|
|
18
19
|
export {
|
|
19
20
|
AgentHandoffAssert,
|
|
20
21
|
AssertionError,
|
|
21
22
|
EventAssert,
|
|
22
23
|
EventRangeAssert,
|
|
24
|
+
FakeLLM,
|
|
23
25
|
FunctionCallAssert,
|
|
24
26
|
FunctionCallOutputAssert,
|
|
25
27
|
MessageAssert,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/voice/testing/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Testing utilities for agent evaluation.\n *\n * @example\n * ```typescript\n * import { AgentSession, Agent, voice } from '@livekit/agents';\n *\n * const session = new AgentSession({ llm });\n * await session.start(agent);\n *\n * const result = await session.run({ userInput: 'Hello' });\n * result.expect.nextEvent().isMessage({ role: 'assistant' });\n * result.expect.noMoreEvents();\n * ```\n *\n * @packageDocumentation\n */\n\nexport {\n AgentHandoffAssert,\n AssertionError,\n EventAssert,\n EventRangeAssert,\n FunctionCallAssert,\n FunctionCallOutputAssert,\n MessageAssert,\n RunAssert,\n RunResult,\n} from './run_result.js';\n\nexport {\n isAgentHandoffEvent,\n isChatMessageEvent,\n isFunctionCallEvent,\n isFunctionCallOutputEvent,\n type AgentHandoffAssertOptions,\n type AgentHandoffEvent,\n type ChatMessageEvent,\n type EventType,\n type FunctionCallAssertOptions,\n type FunctionCallEvent,\n type FunctionCallOutputAssertOptions,\n type FunctionCallOutputEvent,\n type MessageAssertOptions,\n type RunEvent,\n} from './types.js';\n"],"mappings":"AAsBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAWK;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/voice/testing/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Testing utilities for agent evaluation.\n *\n * @example\n * ```typescript\n * import { AgentSession, Agent, voice } from '@livekit/agents';\n *\n * const session = new AgentSession({ llm });\n * await session.start(agent);\n *\n * const result = await session.run({ userInput: 'Hello' });\n * result.expect.nextEvent().isMessage({ role: 'assistant' });\n * result.expect.noMoreEvents();\n * ```\n *\n * @packageDocumentation\n */\n\nexport {\n AgentHandoffAssert,\n AssertionError,\n EventAssert,\n EventRangeAssert,\n FunctionCallAssert,\n FunctionCallOutputAssert,\n MessageAssert,\n RunAssert,\n RunResult,\n} from './run_result.js';\n\nexport {\n isAgentHandoffEvent,\n isChatMessageEvent,\n isFunctionCallEvent,\n isFunctionCallOutputEvent,\n type AgentHandoffAssertOptions,\n type AgentHandoffEvent,\n type ChatMessageEvent,\n type EventType,\n type FunctionCallAssertOptions,\n type FunctionCallEvent,\n type FunctionCallOutputAssertOptions,\n type FunctionCallOutputEvent,\n type MessageAssertOptions,\n type RunEvent,\n} from './types.js';\n\nexport { FakeLLM, type FakeLLMResponse } from './fake_llm.js';\n"],"mappings":"AAsBA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAWK;AAEP,SAAS,eAAqC;","names":[]}
|
|
@@ -0,0 +1,33 @@
|
|
|
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 endpointing_exports = {};
|
|
20
|
+
__export(endpointing_exports, {
|
|
21
|
+
defaultEndpointingOptions: () => defaultEndpointingOptions
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(endpointing_exports);
|
|
24
|
+
const defaultEndpointingOptions = {
|
|
25
|
+
mode: "fixed",
|
|
26
|
+
minDelay: 500,
|
|
27
|
+
maxDelay: 3e3
|
|
28
|
+
};
|
|
29
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
30
|
+
0 && (module.exports = {
|
|
31
|
+
defaultEndpointingOptions
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=endpointing.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/voice/turn_config/endpointing.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Configuration for endpointing, which determines when the user's turn is complete.\n */\nexport interface EndpointingOptions {\n /**\n * Endpointing mode. `\"fixed\"` uses a fixed delay, `\"dynamic\"` adjusts delay based on\n * end-of-utterance prediction.\n * @defaultValue \"fixed\"\n */\n mode: 'fixed' | 'dynamic';\n /**\n * Minimum time in milliseconds since the last detected speech before the agent declares the user's\n * turn complete. In VAD mode this effectively behaves like `max(VAD silence, minDelay)`;\n * in STT mode it is applied after the STT end-of-speech signal, so it can be additive with\n * the STT provider's endpointing delay.\n * @defaultValue 500\n */\n minDelay: number;\n /**\n * Maximum time in milliseconds the agent will wait before terminating the turn.\n * @defaultValue 3000\n */\n maxDelay: number;\n}\n\nexport const defaultEndpointingOptions = {\n mode: 'fixed',\n minDelay: 500,\n maxDelay: 3000,\n} as const satisfies EndpointingOptions;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BO,MAAM,4BAA4B;AAAA,EACvC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AACZ;","names":[]}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for endpointing, which determines when the user's turn is complete.
|
|
3
|
+
*/
|
|
4
|
+
export interface EndpointingOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Endpointing mode. `"fixed"` uses a fixed delay, `"dynamic"` adjusts delay based on
|
|
7
|
+
* end-of-utterance prediction.
|
|
8
|
+
* @defaultValue "fixed"
|
|
9
|
+
*/
|
|
10
|
+
mode: 'fixed' | 'dynamic';
|
|
11
|
+
/**
|
|
12
|
+
* Minimum time in milliseconds since the last detected speech before the agent declares the user's
|
|
13
|
+
* turn complete. In VAD mode this effectively behaves like `max(VAD silence, minDelay)`;
|
|
14
|
+
* in STT mode it is applied after the STT end-of-speech signal, so it can be additive with
|
|
15
|
+
* the STT provider's endpointing delay.
|
|
16
|
+
* @defaultValue 500
|
|
17
|
+
*/
|
|
18
|
+
minDelay: number;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum time in milliseconds the agent will wait before terminating the turn.
|
|
21
|
+
* @defaultValue 3000
|
|
22
|
+
*/
|
|
23
|
+
maxDelay: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const defaultEndpointingOptions: {
|
|
26
|
+
readonly mode: "fixed";
|
|
27
|
+
readonly minDelay: 500;
|
|
28
|
+
readonly maxDelay: 3000;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=endpointing.d.ts.map
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for endpointing, which determines when the user's turn is complete.
|
|
3
|
+
*/
|
|
4
|
+
export interface EndpointingOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Endpointing mode. `"fixed"` uses a fixed delay, `"dynamic"` adjusts delay based on
|
|
7
|
+
* end-of-utterance prediction.
|
|
8
|
+
* @defaultValue "fixed"
|
|
9
|
+
*/
|
|
10
|
+
mode: 'fixed' | 'dynamic';
|
|
11
|
+
/**
|
|
12
|
+
* Minimum time in milliseconds since the last detected speech before the agent declares the user's
|
|
13
|
+
* turn complete. In VAD mode this effectively behaves like `max(VAD silence, minDelay)`;
|
|
14
|
+
* in STT mode it is applied after the STT end-of-speech signal, so it can be additive with
|
|
15
|
+
* the STT provider's endpointing delay.
|
|
16
|
+
* @defaultValue 500
|
|
17
|
+
*/
|
|
18
|
+
minDelay: number;
|
|
19
|
+
/**
|
|
20
|
+
* Maximum time in milliseconds the agent will wait before terminating the turn.
|
|
21
|
+
* @defaultValue 3000
|
|
22
|
+
*/
|
|
23
|
+
maxDelay: number;
|
|
24
|
+
}
|
|
25
|
+
export declare const defaultEndpointingOptions: {
|
|
26
|
+
readonly mode: "fixed";
|
|
27
|
+
readonly minDelay: 500;
|
|
28
|
+
readonly maxDelay: 3000;
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=endpointing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpointing.d.ts","sourceRoot":"","sources":["../../../src/voice/turn_config/endpointing.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,IAAI,EAAE,OAAO,GAAG,SAAS,CAAC;IAC1B;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,yBAAyB;;;;CAIC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/voice/turn_config/endpointing.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Configuration for endpointing, which determines when the user's turn is complete.\n */\nexport interface EndpointingOptions {\n /**\n * Endpointing mode. `\"fixed\"` uses a fixed delay, `\"dynamic\"` adjusts delay based on\n * end-of-utterance prediction.\n * @defaultValue \"fixed\"\n */\n mode: 'fixed' | 'dynamic';\n /**\n * Minimum time in milliseconds since the last detected speech before the agent declares the user's\n * turn complete. In VAD mode this effectively behaves like `max(VAD silence, minDelay)`;\n * in STT mode it is applied after the STT end-of-speech signal, so it can be additive with\n * the STT provider's endpointing delay.\n * @defaultValue 500\n */\n minDelay: number;\n /**\n * Maximum time in milliseconds the agent will wait before terminating the turn.\n * @defaultValue 3000\n */\n maxDelay: number;\n}\n\nexport const defaultEndpointingOptions = {\n mode: 'fixed',\n minDelay: 500,\n maxDelay: 3000,\n} as const satisfies EndpointingOptions;\n"],"mappings":"AA4BO,MAAM,4BAA4B;AAAA,EACvC,MAAM;AAAA,EACN,UAAU;AAAA,EACV,UAAU;AACZ;","names":[]}
|
|
@@ -0,0 +1,37 @@
|
|
|
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 interruption_exports = {};
|
|
20
|
+
__export(interruption_exports, {
|
|
21
|
+
defaultInterruptionOptions: () => defaultInterruptionOptions
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(interruption_exports);
|
|
24
|
+
const defaultInterruptionOptions = {
|
|
25
|
+
enabled: true,
|
|
26
|
+
mode: void 0,
|
|
27
|
+
discardAudioIfUninterruptible: true,
|
|
28
|
+
minDuration: 500,
|
|
29
|
+
minWords: 0,
|
|
30
|
+
falseInterruptionTimeout: 2e3,
|
|
31
|
+
resumeFalseInterruption: true
|
|
32
|
+
};
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {
|
|
35
|
+
defaultInterruptionOptions
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=interruption.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/voice/turn_config/interruption.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Configuration for interruption handling.\n */\nexport interface InterruptionOptions {\n /**\n * Whether interruptions are enabled.\n * @defaultValue true\n */\n enabled: boolean;\n /**\n * Interruption handling strategy. `\"adaptive\"` for ML-based detection, `\"vad\"` for simple\n * voice-activity detection. `undefined` means auto-detect.\n * @defaultValue undefined\n */\n mode: 'adaptive' | 'vad' | false | undefined;\n /**\n * When `true`, buffered audio is dropped while the agent is speaking and cannot be interrupted.\n * @defaultValue true\n */\n discardAudioIfUninterruptible: boolean;\n /**\n * Minimum speech length in milliseconds to register as an interruption.\n * @defaultValue 500\n */\n minDuration: number;\n /**\n * Minimum number of words to consider an interruption, only used if STT is enabled.\n * @defaultValue 0\n */\n minWords: number;\n /**\n * If set, emit an `agentFalseInterruption` event after this amount of time if the user is\n * silent and no user transcript is detected after the interruption. Set to `undefined` to\n * disable. The value is in milliseconds.\n * @defaultValue 2000\n */\n falseInterruptionTimeout: number;\n /**\n * Whether to resume the false interruption after the `falseInterruptionTimeout`.\n * @defaultValue true\n */\n resumeFalseInterruption: boolean;\n}\n\nexport const defaultInterruptionOptions = {\n enabled: true,\n mode: undefined,\n discardAudioIfUninterruptible: true,\n minDuration: 500,\n minWords: 0,\n falseInterruptionTimeout: 2000,\n resumeFalseInterruption: true,\n} as const satisfies InterruptionOptions;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA+CO,MAAM,6BAA6B;AAAA,EACxC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,+BAA+B;AAAA,EAC/B,aAAa;AAAA,EACb,UAAU;AAAA,EACV,0BAA0B;AAAA,EAC1B,yBAAyB;AAC3B;","names":[]}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for interruption handling.
|
|
3
|
+
*/
|
|
4
|
+
export interface InterruptionOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Whether interruptions are enabled.
|
|
7
|
+
* @defaultValue true
|
|
8
|
+
*/
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Interruption handling strategy. `"adaptive"` for ML-based detection, `"vad"` for simple
|
|
12
|
+
* voice-activity detection. `undefined` means auto-detect.
|
|
13
|
+
* @defaultValue undefined
|
|
14
|
+
*/
|
|
15
|
+
mode: 'adaptive' | 'vad' | false | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* When `true`, buffered audio is dropped while the agent is speaking and cannot be interrupted.
|
|
18
|
+
* @defaultValue true
|
|
19
|
+
*/
|
|
20
|
+
discardAudioIfUninterruptible: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Minimum speech length in milliseconds to register as an interruption.
|
|
23
|
+
* @defaultValue 500
|
|
24
|
+
*/
|
|
25
|
+
minDuration: number;
|
|
26
|
+
/**
|
|
27
|
+
* Minimum number of words to consider an interruption, only used if STT is enabled.
|
|
28
|
+
* @defaultValue 0
|
|
29
|
+
*/
|
|
30
|
+
minWords: number;
|
|
31
|
+
/**
|
|
32
|
+
* If set, emit an `agentFalseInterruption` event after this amount of time if the user is
|
|
33
|
+
* silent and no user transcript is detected after the interruption. Set to `undefined` to
|
|
34
|
+
* disable. The value is in milliseconds.
|
|
35
|
+
* @defaultValue 2000
|
|
36
|
+
*/
|
|
37
|
+
falseInterruptionTimeout: number;
|
|
38
|
+
/**
|
|
39
|
+
* Whether to resume the false interruption after the `falseInterruptionTimeout`.
|
|
40
|
+
* @defaultValue true
|
|
41
|
+
*/
|
|
42
|
+
resumeFalseInterruption: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare const defaultInterruptionOptions: {
|
|
45
|
+
readonly enabled: true;
|
|
46
|
+
readonly mode: undefined;
|
|
47
|
+
readonly discardAudioIfUninterruptible: true;
|
|
48
|
+
readonly minDuration: 500;
|
|
49
|
+
readonly minWords: 0;
|
|
50
|
+
readonly falseInterruptionTimeout: 2000;
|
|
51
|
+
readonly resumeFalseInterruption: true;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=interruption.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration for interruption handling.
|
|
3
|
+
*/
|
|
4
|
+
export interface InterruptionOptions {
|
|
5
|
+
/**
|
|
6
|
+
* Whether interruptions are enabled.
|
|
7
|
+
* @defaultValue true
|
|
8
|
+
*/
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Interruption handling strategy. `"adaptive"` for ML-based detection, `"vad"` for simple
|
|
12
|
+
* voice-activity detection. `undefined` means auto-detect.
|
|
13
|
+
* @defaultValue undefined
|
|
14
|
+
*/
|
|
15
|
+
mode: 'adaptive' | 'vad' | false | undefined;
|
|
16
|
+
/**
|
|
17
|
+
* When `true`, buffered audio is dropped while the agent is speaking and cannot be interrupted.
|
|
18
|
+
* @defaultValue true
|
|
19
|
+
*/
|
|
20
|
+
discardAudioIfUninterruptible: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Minimum speech length in milliseconds to register as an interruption.
|
|
23
|
+
* @defaultValue 500
|
|
24
|
+
*/
|
|
25
|
+
minDuration: number;
|
|
26
|
+
/**
|
|
27
|
+
* Minimum number of words to consider an interruption, only used if STT is enabled.
|
|
28
|
+
* @defaultValue 0
|
|
29
|
+
*/
|
|
30
|
+
minWords: number;
|
|
31
|
+
/**
|
|
32
|
+
* If set, emit an `agentFalseInterruption` event after this amount of time if the user is
|
|
33
|
+
* silent and no user transcript is detected after the interruption. Set to `undefined` to
|
|
34
|
+
* disable. The value is in milliseconds.
|
|
35
|
+
* @defaultValue 2000
|
|
36
|
+
*/
|
|
37
|
+
falseInterruptionTimeout: number;
|
|
38
|
+
/**
|
|
39
|
+
* Whether to resume the false interruption after the `falseInterruptionTimeout`.
|
|
40
|
+
* @defaultValue true
|
|
41
|
+
*/
|
|
42
|
+
resumeFalseInterruption: boolean;
|
|
43
|
+
}
|
|
44
|
+
export declare const defaultInterruptionOptions: {
|
|
45
|
+
readonly enabled: true;
|
|
46
|
+
readonly mode: undefined;
|
|
47
|
+
readonly discardAudioIfUninterruptible: true;
|
|
48
|
+
readonly minDuration: 500;
|
|
49
|
+
readonly minWords: 0;
|
|
50
|
+
readonly falseInterruptionTimeout: 2000;
|
|
51
|
+
readonly resumeFalseInterruption: true;
|
|
52
|
+
};
|
|
53
|
+
//# sourceMappingURL=interruption.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interruption.d.ts","sourceRoot":"","sources":["../../../src/voice/turn_config/interruption.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;OAGG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;;;OAIG;IACH,IAAI,EAAE,UAAU,GAAG,KAAK,GAAG,KAAK,GAAG,SAAS,CAAC;IAC7C;;;OAGG;IACH,6BAA6B,EAAE,OAAO,CAAC;IACvC;;;OAGG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,wBAAwB,EAAE,MAAM,CAAC;IACjC;;;OAGG;IACH,uBAAuB,EAAE,OAAO,CAAC;CAClC;AAED,eAAO,MAAM,0BAA0B;;;;;;;;CAQC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const defaultInterruptionOptions = {
|
|
2
|
+
enabled: true,
|
|
3
|
+
mode: void 0,
|
|
4
|
+
discardAudioIfUninterruptible: true,
|
|
5
|
+
minDuration: 500,
|
|
6
|
+
minWords: 0,
|
|
7
|
+
falseInterruptionTimeout: 2e3,
|
|
8
|
+
resumeFalseInterruption: true
|
|
9
|
+
};
|
|
10
|
+
export {
|
|
11
|
+
defaultInterruptionOptions
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=interruption.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/voice/turn_config/interruption.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n/**\n * Configuration for interruption handling.\n */\nexport interface InterruptionOptions {\n /**\n * Whether interruptions are enabled.\n * @defaultValue true\n */\n enabled: boolean;\n /**\n * Interruption handling strategy. `\"adaptive\"` for ML-based detection, `\"vad\"` for simple\n * voice-activity detection. `undefined` means auto-detect.\n * @defaultValue undefined\n */\n mode: 'adaptive' | 'vad' | false | undefined;\n /**\n * When `true`, buffered audio is dropped while the agent is speaking and cannot be interrupted.\n * @defaultValue true\n */\n discardAudioIfUninterruptible: boolean;\n /**\n * Minimum speech length in milliseconds to register as an interruption.\n * @defaultValue 500\n */\n minDuration: number;\n /**\n * Minimum number of words to consider an interruption, only used if STT is enabled.\n * @defaultValue 0\n */\n minWords: number;\n /**\n * If set, emit an `agentFalseInterruption` event after this amount of time if the user is\n * silent and no user transcript is detected after the interruption. Set to `undefined` to\n * disable. The value is in milliseconds.\n * @defaultValue 2000\n */\n falseInterruptionTimeout: number;\n /**\n * Whether to resume the false interruption after the `falseInterruptionTimeout`.\n * @defaultValue true\n */\n resumeFalseInterruption: boolean;\n}\n\nexport const defaultInterruptionOptions = {\n enabled: true,\n mode: undefined,\n discardAudioIfUninterruptible: true,\n minDuration: 500,\n minWords: 0,\n falseInterruptionTimeout: 2000,\n resumeFalseInterruption: true,\n} as const satisfies InterruptionOptions;\n"],"mappings":"AA+CO,MAAM,6BAA6B;AAAA,EACxC,SAAS;AAAA,EACT,MAAM;AAAA,EACN,+BAA+B;AAAA,EAC/B,aAAa;AAAA,EACb,UAAU;AAAA,EACV,0BAA0B;AAAA,EAC1B,yBAAyB;AAC3B;","names":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
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 turn_handling_exports = {};
|
|
20
|
+
__export(turn_handling_exports, {
|
|
21
|
+
defaultTurnHandlingOptions: () => defaultTurnHandlingOptions
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(turn_handling_exports);
|
|
24
|
+
var import_endpointing = require("./endpointing.cjs");
|
|
25
|
+
var import_interruption = require("./interruption.cjs");
|
|
26
|
+
const defaultTurnHandlingOptions = {
|
|
27
|
+
turnDetection: void 0,
|
|
28
|
+
interruption: import_interruption.defaultInterruptionOptions,
|
|
29
|
+
endpointing: import_endpointing.defaultEndpointingOptions
|
|
30
|
+
};
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
defaultTurnHandlingOptions
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=turn_handling.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/voice/turn_config/turn_handling.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { TurnDetectionMode } from '../agent_session.js';\nimport { type EndpointingOptions, defaultEndpointingOptions } from './endpointing.js';\nimport { type InterruptionOptions, defaultInterruptionOptions } from './interruption.js';\n\n/**\n * Configuration for the turn handling system. Used to configure the turn taking behavior of the\n * session.\n */\nexport interface TurnHandlingOptions {\n /**\n * Strategy for deciding when the user has finished speaking.\n *\n * - `\"stt\"` – rely on speech-to-text end-of-utterance cues\n * - `\"vad\"` – rely on Voice Activity Detection start/stop cues\n * - `\"realtime_llm\"` – use server-side detection from a realtime LLM\n * - `\"manual\"` – caller controls turn boundaries explicitly\n *\n * If not set, the session chooses the best available mode in priority order\n * `realtime_llm → vad → stt → manual`; it automatically falls back if the necessary model\n * is missing.\n */\n turnDetection: TurnDetectionMode | undefined;\n /**\n * Configuration for endpointing.\n */\n endpointing: Partial<EndpointingOptions>;\n /**\n * Configuration for interruption handling.\n */\n interruption: Partial<InterruptionOptions>;\n}\n\nexport interface InternalTurnHandlingOptions extends TurnHandlingOptions {\n endpointing: EndpointingOptions;\n interruption: InterruptionOptions;\n}\n\nexport const defaultTurnHandlingOptions: InternalTurnHandlingOptions = {\n turnDetection: undefined,\n interruption: defaultInterruptionOptions,\n endpointing: defaultEndpointingOptions,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,yBAAmE;AACnE,0BAAqE;AAmC9D,MAAM,6BAA0D;AAAA,EACrE,eAAe;AAAA,EACf,cAAc;AAAA,EACd,aAAa;AACf;","names":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TurnDetectionMode } from '../agent_session.js';
|
|
2
|
+
import { type EndpointingOptions } from './endpointing.js';
|
|
3
|
+
import { type InterruptionOptions } from './interruption.js';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the turn handling system. Used to configure the turn taking behavior of the
|
|
6
|
+
* session.
|
|
7
|
+
*/
|
|
8
|
+
export interface TurnHandlingOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Strategy for deciding when the user has finished speaking.
|
|
11
|
+
*
|
|
12
|
+
* - `"stt"` – rely on speech-to-text end-of-utterance cues
|
|
13
|
+
* - `"vad"` – rely on Voice Activity Detection start/stop cues
|
|
14
|
+
* - `"realtime_llm"` – use server-side detection from a realtime LLM
|
|
15
|
+
* - `"manual"` – caller controls turn boundaries explicitly
|
|
16
|
+
*
|
|
17
|
+
* If not set, the session chooses the best available mode in priority order
|
|
18
|
+
* `realtime_llm → vad → stt → manual`; it automatically falls back if the necessary model
|
|
19
|
+
* is missing.
|
|
20
|
+
*/
|
|
21
|
+
turnDetection: TurnDetectionMode | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Configuration for endpointing.
|
|
24
|
+
*/
|
|
25
|
+
endpointing: Partial<EndpointingOptions>;
|
|
26
|
+
/**
|
|
27
|
+
* Configuration for interruption handling.
|
|
28
|
+
*/
|
|
29
|
+
interruption: Partial<InterruptionOptions>;
|
|
30
|
+
}
|
|
31
|
+
export interface InternalTurnHandlingOptions extends TurnHandlingOptions {
|
|
32
|
+
endpointing: EndpointingOptions;
|
|
33
|
+
interruption: InterruptionOptions;
|
|
34
|
+
}
|
|
35
|
+
export declare const defaultTurnHandlingOptions: InternalTurnHandlingOptions;
|
|
36
|
+
//# sourceMappingURL=turn_handling.d.ts.map
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { TurnDetectionMode } from '../agent_session.js';
|
|
2
|
+
import { type EndpointingOptions } from './endpointing.js';
|
|
3
|
+
import { type InterruptionOptions } from './interruption.js';
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the turn handling system. Used to configure the turn taking behavior of the
|
|
6
|
+
* session.
|
|
7
|
+
*/
|
|
8
|
+
export interface TurnHandlingOptions {
|
|
9
|
+
/**
|
|
10
|
+
* Strategy for deciding when the user has finished speaking.
|
|
11
|
+
*
|
|
12
|
+
* - `"stt"` – rely on speech-to-text end-of-utterance cues
|
|
13
|
+
* - `"vad"` – rely on Voice Activity Detection start/stop cues
|
|
14
|
+
* - `"realtime_llm"` – use server-side detection from a realtime LLM
|
|
15
|
+
* - `"manual"` – caller controls turn boundaries explicitly
|
|
16
|
+
*
|
|
17
|
+
* If not set, the session chooses the best available mode in priority order
|
|
18
|
+
* `realtime_llm → vad → stt → manual`; it automatically falls back if the necessary model
|
|
19
|
+
* is missing.
|
|
20
|
+
*/
|
|
21
|
+
turnDetection: TurnDetectionMode | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Configuration for endpointing.
|
|
24
|
+
*/
|
|
25
|
+
endpointing: Partial<EndpointingOptions>;
|
|
26
|
+
/**
|
|
27
|
+
* Configuration for interruption handling.
|
|
28
|
+
*/
|
|
29
|
+
interruption: Partial<InterruptionOptions>;
|
|
30
|
+
}
|
|
31
|
+
export interface InternalTurnHandlingOptions extends TurnHandlingOptions {
|
|
32
|
+
endpointing: EndpointingOptions;
|
|
33
|
+
interruption: InterruptionOptions;
|
|
34
|
+
}
|
|
35
|
+
export declare const defaultTurnHandlingOptions: InternalTurnHandlingOptions;
|
|
36
|
+
//# sourceMappingURL=turn_handling.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn_handling.d.ts","sourceRoot":"","sources":["../../../src/voice/turn_config/turn_handling.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,KAAK,kBAAkB,EAA6B,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAE,KAAK,mBAAmB,EAA8B,MAAM,mBAAmB,CAAC;AAEzF;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;;;;;;;OAWG;IACH,aAAa,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC7C;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC,kBAAkB,CAAC,CAAC;IACzC;;OAEG;IACH,YAAY,EAAE,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,2BAA4B,SAAQ,mBAAmB;IACtE,WAAW,EAAE,kBAAkB,CAAC;IAChC,YAAY,EAAE,mBAAmB,CAAC;CACnC;AAED,eAAO,MAAM,0BAA0B,EAAE,2BAIxC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { defaultEndpointingOptions } from "./endpointing.js";
|
|
2
|
+
import { defaultInterruptionOptions } from "./interruption.js";
|
|
3
|
+
const defaultTurnHandlingOptions = {
|
|
4
|
+
turnDetection: void 0,
|
|
5
|
+
interruption: defaultInterruptionOptions,
|
|
6
|
+
endpointing: defaultEndpointingOptions
|
|
7
|
+
};
|
|
8
|
+
export {
|
|
9
|
+
defaultTurnHandlingOptions
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=turn_handling.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/voice/turn_config/turn_handling.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2026 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nimport type { TurnDetectionMode } from '../agent_session.js';\nimport { type EndpointingOptions, defaultEndpointingOptions } from './endpointing.js';\nimport { type InterruptionOptions, defaultInterruptionOptions } from './interruption.js';\n\n/**\n * Configuration for the turn handling system. Used to configure the turn taking behavior of the\n * session.\n */\nexport interface TurnHandlingOptions {\n /**\n * Strategy for deciding when the user has finished speaking.\n *\n * - `\"stt\"` – rely on speech-to-text end-of-utterance cues\n * - `\"vad\"` – rely on Voice Activity Detection start/stop cues\n * - `\"realtime_llm\"` – use server-side detection from a realtime LLM\n * - `\"manual\"` – caller controls turn boundaries explicitly\n *\n * If not set, the session chooses the best available mode in priority order\n * `realtime_llm → vad → stt → manual`; it automatically falls back if the necessary model\n * is missing.\n */\n turnDetection: TurnDetectionMode | undefined;\n /**\n * Configuration for endpointing.\n */\n endpointing: Partial<EndpointingOptions>;\n /**\n * Configuration for interruption handling.\n */\n interruption: Partial<InterruptionOptions>;\n}\n\nexport interface InternalTurnHandlingOptions extends TurnHandlingOptions {\n endpointing: EndpointingOptions;\n interruption: InterruptionOptions;\n}\n\nexport const defaultTurnHandlingOptions: InternalTurnHandlingOptions = {\n turnDetection: undefined,\n interruption: defaultInterruptionOptions,\n endpointing: defaultEndpointingOptions,\n};\n"],"mappings":"AAIA,SAAkC,iCAAiC;AACnE,SAAmC,kCAAkC;AAmC9D,MAAM,6BAA0D;AAAA,EACrE,eAAe;AAAA,EACf,cAAc;AAAA,EACd,aAAa;AACf;","names":[]}
|
|
@@ -0,0 +1,97 @@
|
|
|
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
|
+
mergeWithDefaults: () => mergeWithDefaults,
|
|
22
|
+
migrateLegacyOptions: () => migrateLegacyOptions,
|
|
23
|
+
stripUndefined: () => stripUndefined
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(utils_exports);
|
|
26
|
+
var import_log = require("../../log.cjs");
|
|
27
|
+
var import_agent_session = require("../agent_session.cjs");
|
|
28
|
+
var import_endpointing = require("./endpointing.cjs");
|
|
29
|
+
var import_interruption = require("./interruption.cjs");
|
|
30
|
+
var import_turn_handling = require("./turn_handling.cjs");
|
|
31
|
+
function migrateLegacyOptions(legacyOptions) {
|
|
32
|
+
var _a, _b;
|
|
33
|
+
const logger = (0, import_log.log)();
|
|
34
|
+
const { voiceOptions, turnDetection, options: sessionOptions, ...rest } = legacyOptions;
|
|
35
|
+
if (voiceOptions !== void 0 && sessionOptions !== void 0) {
|
|
36
|
+
logger.warn(
|
|
37
|
+
"Both voiceOptions and options have been supplied as part of the AgentSessionOptions, voiceOptions will be merged with options taking precedence"
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
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;
|
|
41
|
+
const cloneableVoiceOptions = voiceOptions ? {
|
|
42
|
+
...voiceOptions,
|
|
43
|
+
turnHandling: voiceOptions.turnHandling ? { ...voiceOptions.turnHandling, turnDetection: void 0 } : voiceOptions.turnHandling
|
|
44
|
+
} : voiceOptions;
|
|
45
|
+
const cloneableSessionOptions = sessionOptions ? {
|
|
46
|
+
...sessionOptions,
|
|
47
|
+
turnHandling: sessionOptions.turnHandling ? { ...sessionOptions.turnHandling, turnDetection: void 0 } : sessionOptions.turnHandling
|
|
48
|
+
} : sessionOptions;
|
|
49
|
+
const mergedOptions = structuredClone({ ...cloneableVoiceOptions, ...cloneableSessionOptions });
|
|
50
|
+
const turnHandling = {
|
|
51
|
+
interruption: {
|
|
52
|
+
discardAudioIfUninterruptible: mergedOptions == null ? void 0 : mergedOptions.discardAudioIfUninterruptible,
|
|
53
|
+
minDuration: mergedOptions == null ? void 0 : mergedOptions.minInterruptionDuration,
|
|
54
|
+
minWords: mergedOptions == null ? void 0 : mergedOptions.minInterruptionWords
|
|
55
|
+
},
|
|
56
|
+
endpointing: {
|
|
57
|
+
minDelay: mergedOptions == null ? void 0 : mergedOptions.minEndpointingDelay,
|
|
58
|
+
maxDelay: mergedOptions == null ? void 0 : mergedOptions.maxEndpointingDelay
|
|
59
|
+
},
|
|
60
|
+
...mergedOptions.turnHandling,
|
|
61
|
+
// Restore original turnDetection after spread to preserve class instance with methods
|
|
62
|
+
// (structuredClone converts class instances to plain objects, losing prototype methods)
|
|
63
|
+
turnDetection: originalTurnDetection
|
|
64
|
+
};
|
|
65
|
+
if ((mergedOptions == null ? void 0 : mergedOptions.allowInterruptions) === false) {
|
|
66
|
+
turnHandling.interruption.enabled = false;
|
|
67
|
+
}
|
|
68
|
+
const optionsWithDefaults = {
|
|
69
|
+
...import_agent_session.defaultSessionOptions,
|
|
70
|
+
...mergedOptions,
|
|
71
|
+
turnHandling: mergeWithDefaults(turnHandling)
|
|
72
|
+
};
|
|
73
|
+
const newAgentSessionOptions = {
|
|
74
|
+
...rest,
|
|
75
|
+
options: optionsWithDefaults,
|
|
76
|
+
voiceOptions: optionsWithDefaults,
|
|
77
|
+
turnDetection: turnHandling.turnDetection
|
|
78
|
+
};
|
|
79
|
+
return newAgentSessionOptions;
|
|
80
|
+
}
|
|
81
|
+
function stripUndefined(obj) {
|
|
82
|
+
return Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== void 0));
|
|
83
|
+
}
|
|
84
|
+
function mergeWithDefaults(config) {
|
|
85
|
+
return {
|
|
86
|
+
turnDetection: config.turnDetection ?? import_turn_handling.defaultTurnHandlingOptions.turnDetection,
|
|
87
|
+
endpointing: { ...import_endpointing.defaultEndpointingOptions, ...stripUndefined(config.endpointing) },
|
|
88
|
+
interruption: { ...import_interruption.defaultInterruptionOptions, ...stripUndefined(config.interruption) }
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
92
|
+
0 && (module.exports = {
|
|
93
|
+
mergeWithDefaults,
|
|
94
|
+
migrateLegacyOptions,
|
|
95
|
+
stripUndefined
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=utils.cjs.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 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,EAAE,cAAc,eAAe,SAAS,gBAAgB,GAAG,KAAK,IAAI;AAE1E,MAAI,iBAAiB,UAAa,mBAAmB,QAAW;AAC9D,WAAO;AAAA,MACL;AAAA,IACF;AAAA,EACF;AAGA,QAAM,0BACJ,sDAAgB,iBAAhB,mBAA8B,oBAC9B,kDAAc,iBAAd,mBAA4B,kBAC5B;AAIF,QAAM,wBAAwB,eAC1B;AAAA,IACE,GAAG;AAAA,IACH,cAAc,aAAa,eACvB,EAAE,GAAG,aAAa,cAAc,eAAe,OAAU,IACzD,aAAa;AAAA,EACnB,IACA;AACJ,QAAM,0BAA0B,iBAC5B;AAAA,IACE,GAAG;AAAA,IACH,cAAc,eAAe,eACzB,EAAE,GAAG,eAAe,cAAc,eAAe,OAAU,IAC3D,eAAe;AAAA,EACrB,IACA;AAEJ,QAAM,gBAAgB,gBAAgB,EAAE,GAAG,uBAAuB,GAAG,wBAAwB,CAAC;AAE9F,QAAM,eAAoC;AAAA,IACxC,cAAc;AAAA,MACZ,+BAA+B,+CAAe;AAAA,MAC9C,aAAa,+CAAe;AAAA,MAC5B,UAAU,+CAAe;AAAA,IAC3B;AAAA,IACA,aAAa;AAAA,MACX,UAAU,+CAAe;AAAA,MACzB,UAAU,+CAAe;AAAA,IAC3B;AAAA,IAEA,GAAG,cAAc;AAAA;AAAA;AAAA,IAGjB,eAAe;AAAA,EACjB;AAEA,OAAI,+CAAe,wBAAuB,OAAO;AAC/C,iBAAa,aAAa,UAAU;AAAA,EACtC;AAEA,QAAM,sBAAsB;AAAA,IAC1B,GAAG;AAAA,IACH,GAAG;AAAA,IACH,cAAc,kBAAkB,YAAY;AAAA,EAC9C;AAEA,QAAM,yBAEF;AAAA,IACF,GAAG;AAAA,IACH,SAAS;AAAA,IACT,cAAc;AAAA,IACd,eAAe,aAAa;AAAA,EAC9B;AAEA,SAAO;AACT;AAGO,SAAS,eAAiC,KAAoB;AACnE,SAAO,OAAO,YAAY,OAAO,QAAQ,GAAG,EAAE,OAAO,CAAC,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":[]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AgentSessionOptions, type InternalSessionOptions } from '../agent_session.js';
|
|
2
|
+
import { type TurnHandlingOptions } from './turn_handling.js';
|
|
3
|
+
export declare function migrateLegacyOptions<UserData>(legacyOptions: AgentSessionOptions<UserData>): AgentSessionOptions<UserData> & {
|
|
4
|
+
options: InternalSessionOptions;
|
|
5
|
+
};
|
|
6
|
+
/** Remove keys whose value is `undefined` so they don't shadow defaults when spread. */
|
|
7
|
+
export declare function stripUndefined<T extends object>(obj: T): Partial<T>;
|
|
8
|
+
export declare function mergeWithDefaults(config: TurnHandlingOptions): {
|
|
9
|
+
readonly turnDetection: import("../agent_session.js").TurnDetectionMode | undefined;
|
|
10
|
+
readonly endpointing: {
|
|
11
|
+
mode: "fixed" | "dynamic";
|
|
12
|
+
minDelay: number;
|
|
13
|
+
maxDelay: number;
|
|
14
|
+
};
|
|
15
|
+
readonly interruption: {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
mode: false | "vad" | "adaptive" | undefined;
|
|
18
|
+
discardAudioIfUninterruptible: boolean;
|
|
19
|
+
minDuration: number;
|
|
20
|
+
minWords: number;
|
|
21
|
+
falseInterruptionTimeout: number;
|
|
22
|
+
resumeFalseInterruption: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { type AgentSessionOptions, type InternalSessionOptions } from '../agent_session.js';
|
|
2
|
+
import { type TurnHandlingOptions } from './turn_handling.js';
|
|
3
|
+
export declare function migrateLegacyOptions<UserData>(legacyOptions: AgentSessionOptions<UserData>): AgentSessionOptions<UserData> & {
|
|
4
|
+
options: InternalSessionOptions;
|
|
5
|
+
};
|
|
6
|
+
/** Remove keys whose value is `undefined` so they don't shadow defaults when spread. */
|
|
7
|
+
export declare function stripUndefined<T extends object>(obj: T): Partial<T>;
|
|
8
|
+
export declare function mergeWithDefaults(config: TurnHandlingOptions): {
|
|
9
|
+
readonly turnDetection: import("../agent_session.js").TurnDetectionMode | undefined;
|
|
10
|
+
readonly endpointing: {
|
|
11
|
+
mode: "fixed" | "dynamic";
|
|
12
|
+
minDelay: number;
|
|
13
|
+
maxDelay: number;
|
|
14
|
+
};
|
|
15
|
+
readonly interruption: {
|
|
16
|
+
enabled: boolean;
|
|
17
|
+
mode: false | "vad" | "adaptive" | undefined;
|
|
18
|
+
discardAudioIfUninterruptible: boolean;
|
|
19
|
+
minDuration: number;
|
|
20
|
+
minWords: number;
|
|
21
|
+
falseInterruptionTimeout: number;
|
|
22
|
+
resumeFalseInterruption: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +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"}
|