@livekit/agents 0.0.0-20260120144724
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/LICENSE +201 -0
- package/README.md +17 -0
- package/dist/_exceptions.cjs +109 -0
- package/dist/_exceptions.cjs.map +1 -0
- package/dist/_exceptions.d.cts +64 -0
- package/dist/_exceptions.d.ts +64 -0
- package/dist/_exceptions.d.ts.map +1 -0
- package/dist/_exceptions.js +80 -0
- package/dist/_exceptions.js.map +1 -0
- package/dist/audio.cjs +170 -0
- package/dist/audio.cjs.map +1 -0
- package/dist/audio.d.cts +46 -0
- package/dist/audio.d.ts +46 -0
- package/dist/audio.d.ts.map +1 -0
- package/dist/audio.js +133 -0
- package/dist/audio.js.map +1 -0
- package/dist/cli.cjs +171 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/cli.d.cts +14 -0
- package/dist/cli.d.ts +14 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +145 -0
- package/dist/cli.js.map +1 -0
- 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 +44 -0
- package/dist/constants.cjs.map +1 -0
- package/dist/constants.d.cts +7 -0
- package/dist/constants.d.ts +7 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +15 -0
- package/dist/constants.js.map +1 -0
- package/dist/generator.cjs +36 -0
- package/dist/generator.cjs.map +1 -0
- package/dist/generator.d.cts +23 -0
- package/dist/generator.d.ts +23 -0
- package/dist/generator.d.ts.map +1 -0
- package/dist/generator.js +11 -0
- package/dist/generator.js.map +1 -0
- package/dist/http_server.cjs +75 -0
- package/dist/http_server.cjs.map +1 -0
- package/dist/http_server.d.cts +20 -0
- package/dist/http_server.d.ts +20 -0
- package/dist/http_server.d.ts.map +1 -0
- package/dist/http_server.js +51 -0
- package/dist/http_server.js.map +1 -0
- package/dist/index.cjs +100 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +35 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/inference/api_protos.cjs +104 -0
- package/dist/inference/api_protos.cjs.map +1 -0
- package/dist/inference/api_protos.d.cts +222 -0
- package/dist/inference/api_protos.d.ts +222 -0
- package/dist/inference/api_protos.d.ts.map +1 -0
- package/dist/inference/api_protos.js +70 -0
- package/dist/inference/api_protos.js.map +1 -0
- package/dist/inference/index.cjs +56 -0
- package/dist/inference/index.cjs.map +1 -0
- package/dist/inference/index.d.cts +8 -0
- package/dist/inference/index.d.ts +8 -0
- package/dist/inference/index.d.ts.map +1 -0
- package/dist/inference/index.js +23 -0
- package/dist/inference/index.js.map +1 -0
- package/dist/inference/interruption/AdaptiveInterruptionDetector.cjs +152 -0
- package/dist/inference/interruption/AdaptiveInterruptionDetector.cjs.map +1 -0
- package/dist/inference/interruption/AdaptiveInterruptionDetector.d.cts +50 -0
- package/dist/inference/interruption/AdaptiveInterruptionDetector.d.ts +50 -0
- package/dist/inference/interruption/AdaptiveInterruptionDetector.d.ts.map +1 -0
- package/dist/inference/interruption/AdaptiveInterruptionDetector.js +125 -0
- package/dist/inference/interruption/AdaptiveInterruptionDetector.js.map +1 -0
- package/dist/inference/interruption/InterruptionStream.cjs +310 -0
- package/dist/inference/interruption/InterruptionStream.cjs.map +1 -0
- package/dist/inference/interruption/InterruptionStream.d.cts +57 -0
- package/dist/inference/interruption/InterruptionStream.d.ts +57 -0
- package/dist/inference/interruption/InterruptionStream.d.ts.map +1 -0
- package/dist/inference/interruption/InterruptionStream.js +288 -0
- package/dist/inference/interruption/InterruptionStream.js.map +1 -0
- package/dist/inference/interruption/defaults.cjs +76 -0
- package/dist/inference/interruption/defaults.cjs.map +1 -0
- package/dist/inference/interruption/defaults.d.cts +14 -0
- package/dist/inference/interruption/defaults.d.ts +14 -0
- package/dist/inference/interruption/defaults.d.ts.map +1 -0
- package/dist/inference/interruption/defaults.js +42 -0
- package/dist/inference/interruption/defaults.js.map +1 -0
- package/dist/inference/interruption/errors.cjs +2 -0
- package/dist/inference/interruption/errors.cjs.map +1 -0
- package/dist/inference/interruption/errors.d.cts +2 -0
- package/dist/inference/interruption/errors.d.ts +2 -0
- package/dist/inference/interruption/errors.d.ts.map +1 -0
- package/dist/inference/interruption/errors.js +1 -0
- package/dist/inference/interruption/errors.js.map +1 -0
- package/dist/inference/interruption/http_transport.cjs +57 -0
- package/dist/inference/interruption/http_transport.cjs.map +1 -0
- package/dist/inference/interruption/http_transport.d.cts +23 -0
- package/dist/inference/interruption/http_transport.d.ts +23 -0
- package/dist/inference/interruption/http_transport.d.ts.map +1 -0
- package/dist/inference/interruption/http_transport.js +33 -0
- package/dist/inference/interruption/http_transport.js.map +1 -0
- package/dist/inference/interruption/index.cjs +34 -0
- package/dist/inference/interruption/index.cjs.map +1 -0
- package/dist/inference/interruption/index.d.cts +5 -0
- package/dist/inference/interruption/index.d.ts +5 -0
- package/dist/inference/interruption/index.d.ts.map +1 -0
- package/dist/inference/interruption/index.js +7 -0
- package/dist/inference/interruption/index.js.map +1 -0
- package/dist/inference/interruption/interruption.cjs +85 -0
- package/dist/inference/interruption/interruption.cjs.map +1 -0
- package/dist/inference/interruption/interruption.d.cts +48 -0
- package/dist/inference/interruption/interruption.d.ts +48 -0
- package/dist/inference/interruption/interruption.d.ts.map +1 -0
- package/dist/inference/interruption/interruption.js +59 -0
- package/dist/inference/interruption/interruption.js.map +1 -0
- package/dist/inference/llm.cjs +347 -0
- package/dist/inference/llm.cjs.map +1 -0
- package/dist/inference/llm.d.cts +114 -0
- package/dist/inference/llm.d.ts +114 -0
- package/dist/inference/llm.d.ts.map +1 -0
- package/dist/inference/llm.js +318 -0
- package/dist/inference/llm.js.map +1 -0
- package/dist/inference/stt.cjs +371 -0
- package/dist/inference/stt.cjs.map +1 -0
- package/dist/inference/stt.d.cts +91 -0
- package/dist/inference/stt.d.ts +91 -0
- package/dist/inference/stt.d.ts.map +1 -0
- package/dist/inference/stt.js +350 -0
- package/dist/inference/stt.js.map +1 -0
- package/dist/inference/tts.cjs +439 -0
- package/dist/inference/tts.cjs.map +1 -0
- package/dist/inference/tts.d.cts +80 -0
- package/dist/inference/tts.d.ts +80 -0
- package/dist/inference/tts.d.ts.map +1 -0
- package/dist/inference/tts.js +417 -0
- package/dist/inference/tts.js.map +1 -0
- package/dist/inference/utils.cjs +89 -0
- package/dist/inference/utils.cjs.map +1 -0
- package/dist/inference/utils.d.cts +6 -0
- package/dist/inference/utils.d.ts +6 -0
- package/dist/inference/utils.d.ts.map +1 -0
- package/dist/inference/utils.js +63 -0
- package/dist/inference/utils.js.map +1 -0
- package/dist/inference/utils.test.cjs +20 -0
- package/dist/inference/utils.test.cjs.map +1 -0
- package/dist/inference/utils.test.js +19 -0
- package/dist/inference/utils.test.js.map +1 -0
- package/dist/inference_runner.cjs +37 -0
- package/dist/inference_runner.cjs.map +1 -0
- package/dist/inference_runner.d.cts +11 -0
- package/dist/inference_runner.d.ts +11 -0
- package/dist/inference_runner.d.ts.map +1 -0
- package/dist/inference_runner.js +13 -0
- package/dist/inference_runner.js.map +1 -0
- package/dist/ipc/index.cjs +23 -0
- package/dist/ipc/index.cjs.map +1 -0
- package/dist/ipc/index.d.cts +2 -0
- package/dist/ipc/index.d.ts +2 -0
- package/dist/ipc/index.d.ts.map +1 -0
- package/dist/ipc/index.js +2 -0
- package/dist/ipc/index.js.map +1 -0
- package/dist/ipc/inference_executor.cjs +17 -0
- package/dist/ipc/inference_executor.cjs.map +1 -0
- package/dist/ipc/inference_executor.d.cts +4 -0
- package/dist/ipc/inference_executor.d.ts +4 -0
- package/dist/ipc/inference_executor.d.ts.map +1 -0
- package/dist/ipc/inference_executor.js +1 -0
- package/dist/ipc/inference_executor.js.map +1 -0
- package/dist/ipc/inference_proc_executor.cjs +101 -0
- package/dist/ipc/inference_proc_executor.cjs.map +1 -0
- package/dist/ipc/inference_proc_executor.d.cts +23 -0
- package/dist/ipc/inference_proc_executor.d.ts +23 -0
- package/dist/ipc/inference_proc_executor.d.ts.map +1 -0
- package/dist/ipc/inference_proc_executor.js +75 -0
- package/dist/ipc/inference_proc_executor.js.map +1 -0
- package/dist/ipc/inference_proc_lazy_main.cjs +86 -0
- package/dist/ipc/inference_proc_lazy_main.cjs.map +1 -0
- package/dist/ipc/inference_proc_lazy_main.d.cts +2 -0
- package/dist/ipc/inference_proc_lazy_main.d.ts +2 -0
- package/dist/ipc/inference_proc_lazy_main.d.ts.map +1 -0
- package/dist/ipc/inference_proc_lazy_main.js +85 -0
- package/dist/ipc/inference_proc_lazy_main.js.map +1 -0
- package/dist/ipc/job_executor.cjs +34 -0
- package/dist/ipc/job_executor.cjs.map +1 -0
- package/dist/ipc/job_executor.d.cts +18 -0
- package/dist/ipc/job_executor.d.ts +18 -0
- package/dist/ipc/job_executor.d.ts.map +1 -0
- package/dist/ipc/job_executor.js +10 -0
- package/dist/ipc/job_executor.js.map +1 -0
- package/dist/ipc/job_proc_executor.cjs +115 -0
- package/dist/ipc/job_proc_executor.cjs.map +1 -0
- package/dist/ipc/job_proc_executor.d.cts +19 -0
- package/dist/ipc/job_proc_executor.d.ts +19 -0
- package/dist/ipc/job_proc_executor.d.ts.map +1 -0
- package/dist/ipc/job_proc_executor.js +89 -0
- package/dist/ipc/job_proc_executor.js.map +1 -0
- package/dist/ipc/job_proc_lazy_main.cjs +210 -0
- package/dist/ipc/job_proc_lazy_main.cjs.map +1 -0
- package/dist/ipc/job_proc_lazy_main.d.cts +2 -0
- package/dist/ipc/job_proc_lazy_main.d.ts +2 -0
- package/dist/ipc/job_proc_lazy_main.d.ts.map +1 -0
- package/dist/ipc/job_proc_lazy_main.js +187 -0
- package/dist/ipc/job_proc_lazy_main.js.map +1 -0
- package/dist/ipc/message.cjs +17 -0
- package/dist/ipc/message.cjs.map +1 -0
- package/dist/ipc/message.d.cts +58 -0
- package/dist/ipc/message.d.ts +58 -0
- package/dist/ipc/message.d.ts.map +1 -0
- package/dist/ipc/message.js +1 -0
- package/dist/ipc/message.js.map +1 -0
- package/dist/ipc/proc_pool.cjs +164 -0
- package/dist/ipc/proc_pool.cjs.map +1 -0
- package/dist/ipc/proc_pool.d.cts +31 -0
- package/dist/ipc/proc_pool.d.ts +31 -0
- package/dist/ipc/proc_pool.d.ts.map +1 -0
- package/dist/ipc/proc_pool.js +140 -0
- package/dist/ipc/proc_pool.js.map +1 -0
- package/dist/ipc/supervised_proc.cjs +229 -0
- package/dist/ipc/supervised_proc.cjs.map +1 -0
- package/dist/ipc/supervised_proc.d.cts +32 -0
- package/dist/ipc/supervised_proc.d.ts +32 -0
- package/dist/ipc/supervised_proc.d.ts.map +1 -0
- package/dist/ipc/supervised_proc.js +195 -0
- package/dist/ipc/supervised_proc.js.map +1 -0
- 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 +373 -0
- package/dist/job.cjs.map +1 -0
- package/dist/job.d.cts +141 -0
- package/dist/job.d.ts +141 -0
- package/dist/job.d.ts.map +1 -0
- package/dist/job.js +332 -0
- package/dist/job.js.map +1 -0
- package/dist/llm/chat_context.cjs +527 -0
- package/dist/llm/chat_context.cjs.map +1 -0
- package/dist/llm/chat_context.d.cts +223 -0
- package/dist/llm/chat_context.d.ts +223 -0
- package/dist/llm/chat_context.d.ts.map +1 -0
- package/dist/llm/chat_context.js +496 -0
- package/dist/llm/chat_context.js.map +1 -0
- package/dist/llm/chat_context.test.cjs +911 -0
- package/dist/llm/chat_context.test.cjs.map +1 -0
- package/dist/llm/chat_context.test.js +916 -0
- package/dist/llm/chat_context.test.js.map +1 -0
- 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 +79 -0
- package/dist/llm/index.cjs.map +1 -0
- package/dist/llm/index.d.cts +9 -0
- package/dist/llm/index.d.ts +9 -0
- package/dist/llm/index.d.ts.map +1 -0
- package/dist/llm/index.js +61 -0
- package/dist/llm/index.js.map +1 -0
- package/dist/llm/llm.cjs +226 -0
- package/dist/llm/llm.cjs.map +1 -0
- package/dist/llm/llm.d.cts +94 -0
- package/dist/llm/llm.d.ts +94 -0
- package/dist/llm/llm.d.ts.map +1 -0
- package/dist/llm/llm.js +201 -0
- package/dist/llm/llm.js.map +1 -0
- package/dist/llm/provider_format/google.cjs +132 -0
- package/dist/llm/provider_format/google.cjs.map +1 -0
- package/dist/llm/provider_format/google.d.cts +6 -0
- package/dist/llm/provider_format/google.d.ts +6 -0
- package/dist/llm/provider_format/google.d.ts.map +1 -0
- package/dist/llm/provider_format/google.js +108 -0
- package/dist/llm/provider_format/google.js.map +1 -0
- package/dist/llm/provider_format/google.test.cjs +724 -0
- package/dist/llm/provider_format/google.test.cjs.map +1 -0
- package/dist/llm/provider_format/google.test.js +728 -0
- package/dist/llm/provider_format/google.test.js.map +1 -0
- package/dist/llm/provider_format/index.cjs +40 -0
- package/dist/llm/provider_format/index.cjs.map +1 -0
- package/dist/llm/provider_format/index.d.cts +4 -0
- package/dist/llm/provider_format/index.d.ts +4 -0
- package/dist/llm/provider_format/index.d.ts.map +1 -0
- package/dist/llm/provider_format/index.js +16 -0
- package/dist/llm/provider_format/index.js.map +1 -0
- package/dist/llm/provider_format/openai.cjs +138 -0
- package/dist/llm/provider_format/openai.cjs.map +1 -0
- package/dist/llm/provider_format/openai.d.cts +3 -0
- package/dist/llm/provider_format/openai.d.ts +3 -0
- package/dist/llm/provider_format/openai.d.ts.map +1 -0
- package/dist/llm/provider_format/openai.js +114 -0
- package/dist/llm/provider_format/openai.js.map +1 -0
- package/dist/llm/provider_format/openai.test.cjs +557 -0
- package/dist/llm/provider_format/openai.test.cjs.map +1 -0
- package/dist/llm/provider_format/openai.test.js +561 -0
- package/dist/llm/provider_format/openai.test.js.map +1 -0
- package/dist/llm/provider_format/utils.cjs +146 -0
- package/dist/llm/provider_format/utils.cjs.map +1 -0
- package/dist/llm/provider_format/utils.d.cts +38 -0
- package/dist/llm/provider_format/utils.d.ts +38 -0
- package/dist/llm/provider_format/utils.d.ts.map +1 -0
- package/dist/llm/provider_format/utils.js +122 -0
- package/dist/llm/provider_format/utils.js.map +1 -0
- package/dist/llm/realtime.cjs +77 -0
- package/dist/llm/realtime.cjs.map +1 -0
- package/dist/llm/realtime.d.cts +106 -0
- package/dist/llm/realtime.d.ts +106 -0
- package/dist/llm/realtime.d.ts.map +1 -0
- package/dist/llm/realtime.js +52 -0
- package/dist/llm/realtime.js.map +1 -0
- package/dist/llm/remote_chat_context.cjs +112 -0
- package/dist/llm/remote_chat_context.cjs.map +1 -0
- package/dist/llm/remote_chat_context.d.cts +25 -0
- package/dist/llm/remote_chat_context.d.ts +25 -0
- package/dist/llm/remote_chat_context.d.ts.map +1 -0
- package/dist/llm/remote_chat_context.js +88 -0
- package/dist/llm/remote_chat_context.js.map +1 -0
- package/dist/llm/remote_chat_context.test.cjs +225 -0
- package/dist/llm/remote_chat_context.test.cjs.map +1 -0
- package/dist/llm/remote_chat_context.test.js +224 -0
- package/dist/llm/remote_chat_context.test.js.map +1 -0
- package/dist/llm/tool_context.cjs +152 -0
- package/dist/llm/tool_context.cjs.map +1 -0
- package/dist/llm/tool_context.d.cts +153 -0
- package/dist/llm/tool_context.d.ts +153 -0
- package/dist/llm/tool_context.d.ts.map +1 -0
- package/dist/llm/tool_context.js +119 -0
- package/dist/llm/tool_context.js.map +1 -0
- package/dist/llm/tool_context.test.cjs +359 -0
- package/dist/llm/tool_context.test.cjs.map +1 -0
- package/dist/llm/tool_context.test.js +336 -0
- package/dist/llm/tool_context.test.js.map +1 -0
- package/dist/llm/tool_context.type.test.cjs +92 -0
- package/dist/llm/tool_context.type.test.cjs.map +1 -0
- package/dist/llm/tool_context.type.test.js +91 -0
- package/dist/llm/tool_context.type.test.js.map +1 -0
- package/dist/llm/utils.cjs +267 -0
- package/dist/llm/utils.cjs.map +1 -0
- package/dist/llm/utils.d.cts +41 -0
- package/dist/llm/utils.d.ts +41 -0
- package/dist/llm/utils.d.ts.map +1 -0
- package/dist/llm/utils.js +230 -0
- package/dist/llm/utils.js.map +1 -0
- package/dist/llm/utils.test.cjs +513 -0
- package/dist/llm/utils.test.cjs.map +1 -0
- package/dist/llm/utils.test.js +490 -0
- package/dist/llm/utils.test.js.map +1 -0
- 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 +81 -0
- package/dist/log.cjs.map +1 -0
- package/dist/log.d.cts +20 -0
- package/dist/log.d.ts +20 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +54 -0
- package/dist/log.js.map +1 -0
- package/dist/metrics/base.cjs +17 -0
- package/dist/metrics/base.cjs.map +1 -0
- package/dist/metrics/base.d.cts +150 -0
- package/dist/metrics/base.d.ts +150 -0
- package/dist/metrics/base.d.ts.map +1 -0
- package/dist/metrics/base.js +1 -0
- package/dist/metrics/base.js.map +1 -0
- package/dist/metrics/index.cjs +32 -0
- package/dist/metrics/index.cjs.map +1 -0
- package/dist/metrics/index.d.cts +4 -0
- package/dist/metrics/index.d.ts +4 -0
- package/dist/metrics/index.d.ts.map +1 -0
- package/dist/metrics/index.js +7 -0
- package/dist/metrics/index.js.map +1 -0
- package/dist/metrics/usage_collector.cjs +58 -0
- package/dist/metrics/usage_collector.cjs.map +1 -0
- package/dist/metrics/usage_collector.d.cts +15 -0
- package/dist/metrics/usage_collector.d.ts +15 -0
- package/dist/metrics/usage_collector.d.ts.map +1 -0
- package/dist/metrics/usage_collector.js +34 -0
- package/dist/metrics/usage_collector.js.map +1 -0
- package/dist/metrics/utils.cjs +74 -0
- package/dist/metrics/utils.cjs.map +1 -0
- package/dist/metrics/utils.d.cts +3 -0
- package/dist/metrics/utils.d.ts +3 -0
- package/dist/metrics/utils.d.ts.map +1 -0
- package/dist/metrics/utils.js +50 -0
- package/dist/metrics/utils.js.map +1 -0
- package/dist/plugin.cjs +62 -0
- package/dist/plugin.cjs.map +1 -0
- package/dist/plugin.d.cts +24 -0
- package/dist/plugin.d.ts +24 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +37 -0
- package/dist/plugin.js.map +1 -0
- package/dist/stream/deferred_stream.cjs +106 -0
- package/dist/stream/deferred_stream.cjs.map +1 -0
- package/dist/stream/deferred_stream.d.cts +32 -0
- package/dist/stream/deferred_stream.d.ts +32 -0
- package/dist/stream/deferred_stream.d.ts.map +1 -0
- package/dist/stream/deferred_stream.js +81 -0
- package/dist/stream/deferred_stream.js.map +1 -0
- package/dist/stream/deferred_stream.test.cjs +527 -0
- package/dist/stream/deferred_stream.test.cjs.map +1 -0
- package/dist/stream/deferred_stream.test.js +526 -0
- package/dist/stream/deferred_stream.test.js.map +1 -0
- package/dist/stream/identity_transform.cjs +42 -0
- package/dist/stream/identity_transform.cjs.map +1 -0
- package/dist/stream/identity_transform.d.cts +6 -0
- package/dist/stream/identity_transform.d.ts +6 -0
- package/dist/stream/identity_transform.d.ts.map +1 -0
- package/dist/stream/identity_transform.js +18 -0
- package/dist/stream/identity_transform.js.map +1 -0
- package/dist/stream/identity_transform.test.cjs +125 -0
- package/dist/stream/identity_transform.test.cjs.map +1 -0
- package/dist/stream/identity_transform.test.js +124 -0
- package/dist/stream/identity_transform.test.js.map +1 -0
- package/dist/stream/index.cjs +38 -0
- package/dist/stream/index.cjs.map +1 -0
- package/dist/stream/index.d.cts +5 -0
- package/dist/stream/index.d.ts +5 -0
- package/dist/stream/index.d.ts.map +1 -0
- package/dist/stream/index.js +11 -0
- package/dist/stream/index.js.map +1 -0
- package/dist/stream/merge_readable_streams.cjs +59 -0
- package/dist/stream/merge_readable_streams.cjs.map +1 -0
- package/dist/stream/merge_readable_streams.d.cts +4 -0
- package/dist/stream/merge_readable_streams.d.ts +4 -0
- package/dist/stream/merge_readable_streams.d.ts.map +1 -0
- package/dist/stream/merge_readable_streams.js +35 -0
- package/dist/stream/merge_readable_streams.js.map +1 -0
- package/dist/stream/stream_channel.cjs +57 -0
- package/dist/stream/stream_channel.cjs.map +1 -0
- package/dist/stream/stream_channel.d.cts +11 -0
- package/dist/stream/stream_channel.d.ts +11 -0
- package/dist/stream/stream_channel.d.ts.map +1 -0
- package/dist/stream/stream_channel.js +33 -0
- package/dist/stream/stream_channel.js.map +1 -0
- package/dist/stream/stream_channel.test.cjs +124 -0
- package/dist/stream/stream_channel.test.cjs.map +1 -0
- package/dist/stream/stream_channel.test.js +123 -0
- package/dist/stream/stream_channel.test.js.map +1 -0
- package/dist/stt/index.cjs +38 -0
- package/dist/stt/index.cjs.map +1 -0
- package/dist/stt/index.d.cts +3 -0
- package/dist/stt/index.d.ts +3 -0
- package/dist/stt/index.d.ts.map +1 -0
- package/dist/stt/index.js +14 -0
- package/dist/stt/index.js.map +1 -0
- package/dist/stt/stream_adapter.cjs +115 -0
- package/dist/stt/stream_adapter.cjs.map +1 -0
- package/dist/stt/stream_adapter.d.cts +23 -0
- package/dist/stt/stream_adapter.d.ts +23 -0
- package/dist/stt/stream_adapter.d.ts.map +1 -0
- package/dist/stt/stream_adapter.js +90 -0
- package/dist/stt/stream_adapter.js.map +1 -0
- package/dist/stt/stt.cjs +253 -0
- package/dist/stt/stt.cjs.map +1 -0
- package/dist/stt/stt.d.cts +158 -0
- package/dist/stt/stt.d.ts +158 -0
- package/dist/stt/stt.d.ts.map +1 -0
- package/dist/stt/stt.js +227 -0
- package/dist/stt/stt.js.map +1 -0
- 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 +147 -0
- package/dist/telemetry/otel_http_exporter.cjs.map +1 -0
- package/dist/telemetry/otel_http_exporter.d.cts +62 -0
- package/dist/telemetry/otel_http_exporter.d.ts +62 -0
- package/dist/telemetry/otel_http_exporter.d.ts.map +1 -0
- package/dist/telemetry/otel_http_exporter.js +123 -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 +206 -0
- package/dist/telemetry/trace_types.cjs.map +1 -0
- package/dist/telemetry/trace_types.d.cts +61 -0
- package/dist/telemetry/trace_types.d.ts +61 -0
- package/dist/telemetry/trace_types.d.ts.map +1 -0
- package/dist/telemetry/trace_types.js +123 -0
- package/dist/telemetry/trace_types.js.map +1 -0
- package/dist/telemetry/traces.cjs +444 -0
- package/dist/telemetry/traces.cjs.map +1 -0
- package/dist/telemetry/traces.d.cts +114 -0
- package/dist/telemetry/traces.d.ts +114 -0
- package/dist/telemetry/traces.d.ts.map +1 -0
- package/dist/telemetry/traces.js +409 -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/basic.cjs +105 -0
- package/dist/tokenize/basic/basic.cjs.map +1 -0
- package/dist/tokenize/basic/basic.d.cts +24 -0
- package/dist/tokenize/basic/basic.d.ts +24 -0
- package/dist/tokenize/basic/basic.d.ts.map +1 -0
- package/dist/tokenize/basic/basic.js +67 -0
- package/dist/tokenize/basic/basic.js.map +1 -0
- package/dist/tokenize/basic/hyphenator.cjs +425 -0
- package/dist/tokenize/basic/hyphenator.cjs.map +1 -0
- package/dist/tokenize/basic/hyphenator.d.cts +17 -0
- package/dist/tokenize/basic/hyphenator.d.ts +17 -0
- package/dist/tokenize/basic/hyphenator.d.ts.map +1 -0
- package/dist/tokenize/basic/hyphenator.js +401 -0
- package/dist/tokenize/basic/hyphenator.js.map +1 -0
- package/dist/tokenize/basic/index.cjs +37 -0
- package/dist/tokenize/basic/index.cjs.map +1 -0
- package/dist/tokenize/basic/index.d.cts +2 -0
- package/dist/tokenize/basic/index.d.ts +2 -0
- package/dist/tokenize/basic/index.d.ts.map +1 -0
- package/dist/tokenize/basic/index.js +15 -0
- package/dist/tokenize/basic/index.js.map +1 -0
- package/dist/tokenize/basic/paragraph.cjs +57 -0
- package/dist/tokenize/basic/paragraph.cjs.map +1 -0
- package/dist/tokenize/basic/paragraph.d.cts +5 -0
- package/dist/tokenize/basic/paragraph.d.ts +5 -0
- package/dist/tokenize/basic/paragraph.d.ts.map +1 -0
- package/dist/tokenize/basic/paragraph.js +33 -0
- package/dist/tokenize/basic/paragraph.js.map +1 -0
- package/dist/tokenize/basic/sentence.cjs +97 -0
- package/dist/tokenize/basic/sentence.cjs.map +1 -0
- package/dist/tokenize/basic/sentence.d.cts +5 -0
- package/dist/tokenize/basic/sentence.d.ts +5 -0
- package/dist/tokenize/basic/sentence.d.ts.map +1 -0
- package/dist/tokenize/basic/sentence.js +73 -0
- package/dist/tokenize/basic/sentence.js.map +1 -0
- package/dist/tokenize/basic/word.cjs +44 -0
- package/dist/tokenize/basic/word.cjs.map +1 -0
- package/dist/tokenize/basic/word.d.cts +5 -0
- package/dist/tokenize/basic/word.d.ts +5 -0
- package/dist/tokenize/basic/word.d.ts.map +1 -0
- package/dist/tokenize/basic/word.js +20 -0
- package/dist/tokenize/basic/word.js.map +1 -0
- package/dist/tokenize/index.cjs +55 -0
- package/dist/tokenize/index.cjs.map +1 -0
- package/dist/tokenize/index.d.cts +5 -0
- package/dist/tokenize/index.d.ts +5 -0
- package/dist/tokenize/index.d.ts.map +1 -0
- package/dist/tokenize/index.js +19 -0
- package/dist/tokenize/index.js.map +1 -0
- package/dist/tokenize/token_stream.cjs +168 -0
- package/dist/tokenize/token_stream.cjs.map +1 -0
- package/dist/tokenize/token_stream.d.cts +40 -0
- package/dist/tokenize/token_stream.d.ts +40 -0
- package/dist/tokenize/token_stream.d.ts.map +1 -0
- package/dist/tokenize/token_stream.js +142 -0
- package/dist/tokenize/token_stream.js.map +1 -0
- package/dist/tokenize/tokenizer.cjs +184 -0
- package/dist/tokenize/tokenizer.cjs.map +1 -0
- package/dist/tokenize/tokenizer.d.cts +55 -0
- package/dist/tokenize/tokenizer.d.ts +55 -0
- package/dist/tokenize/tokenizer.d.ts.map +1 -0
- package/dist/tokenize/tokenizer.js +156 -0
- package/dist/tokenize/tokenizer.js.map +1 -0
- package/dist/tokenize/tokenizer.test.cjs +220 -0
- package/dist/tokenize/tokenizer.test.cjs.map +1 -0
- package/dist/tokenize/tokenizer.test.js +219 -0
- package/dist/tokenize/tokenizer.test.js.map +1 -0
- package/dist/transcription.cjs +247 -0
- package/dist/transcription.cjs.map +1 -0
- package/dist/transcription.d.cts +31 -0
- package/dist/transcription.d.ts +31 -0
- package/dist/transcription.d.ts.map +1 -0
- package/dist/transcription.js +222 -0
- package/dist/transcription.js.map +1 -0
- package/dist/tts/index.cjs +38 -0
- package/dist/tts/index.cjs.map +1 -0
- package/dist/tts/index.d.cts +3 -0
- package/dist/tts/index.d.ts +3 -0
- package/dist/tts/index.d.ts.map +1 -0
- package/dist/tts/index.js +14 -0
- package/dist/tts/index.js.map +1 -0
- package/dist/tts/stream_adapter.cjs +105 -0
- package/dist/tts/stream_adapter.cjs.map +1 -0
- package/dist/tts/stream_adapter.d.cts +20 -0
- package/dist/tts/stream_adapter.d.ts +20 -0
- package/dist/tts/stream_adapter.d.ts.map +1 -0
- package/dist/tts/stream_adapter.js +80 -0
- package/dist/tts/stream_adapter.js.map +1 -0
- package/dist/tts/tts.cjs +431 -0
- package/dist/tts/tts.cjs.map +1 -0
- package/dist/tts/tts.d.cts +161 -0
- package/dist/tts/tts.d.ts +161 -0
- package/dist/tts/tts.d.ts.map +1 -0
- package/dist/tts/tts.js +405 -0
- package/dist/tts/tts.js.map +1 -0
- package/dist/types.cjs +49 -0
- package/dist/types.cjs.map +1 -0
- package/dist/types.d.cts +44 -0
- package/dist/types.d.ts +44 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +23 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/ws_transport.cjs +51 -0
- package/dist/utils/ws_transport.cjs.map +1 -0
- package/dist/utils/ws_transport.d.cts +9 -0
- package/dist/utils/ws_transport.d.ts +9 -0
- package/dist/utils/ws_transport.d.ts.map +1 -0
- package/dist/utils/ws_transport.js +17 -0
- package/dist/utils/ws_transport.js.map +1 -0
- package/dist/utils/ws_transport.test.cjs +212 -0
- package/dist/utils/ws_transport.test.cjs.map +1 -0
- package/dist/utils/ws_transport.test.js +211 -0
- package/dist/utils/ws_transport.test.js.map +1 -0
- package/dist/utils.cjs +669 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.cts +244 -0
- package/dist/utils.d.ts +244 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +617 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.test.cjs +492 -0
- package/dist/utils.test.cjs.map +1 -0
- package/dist/utils.test.js +491 -0
- package/dist/utils.test.js.map +1 -0
- package/dist/vad.cjs +211 -0
- package/dist/vad.cjs.map +1 -0
- package/dist/vad.d.cts +105 -0
- package/dist/vad.d.ts +105 -0
- package/dist/vad.d.ts.map +1 -0
- package/dist/vad.js +185 -0
- package/dist/vad.js.map +1 -0
- package/dist/version.cjs +29 -0
- package/dist/version.cjs.map +1 -0
- package/dist/version.d.cts +2 -0
- package/dist/version.d.ts +2 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +5 -0
- package/dist/version.js.map +1 -0
- package/dist/voice/agent.cjs +308 -0
- package/dist/voice/agent.cjs.map +1 -0
- package/dist/voice/agent.d.cts +83 -0
- package/dist/voice/agent.d.ts +83 -0
- package/dist/voice/agent.d.ts.map +1 -0
- package/dist/voice/agent.js +287 -0
- package/dist/voice/agent.js.map +1 -0
- package/dist/voice/agent.test.cjs +61 -0
- package/dist/voice/agent.test.cjs.map +1 -0
- package/dist/voice/agent.test.js +60 -0
- package/dist/voice/agent.test.js.map +1 -0
- package/dist/voice/agent_activity.cjs +1784 -0
- package/dist/voice/agent_activity.cjs.map +1 -0
- package/dist/voice/agent_activity.d.cts +116 -0
- package/dist/voice/agent_activity.d.ts +116 -0
- package/dist/voice/agent_activity.d.ts.map +1 -0
- package/dist/voice/agent_activity.js +1780 -0
- package/dist/voice/agent_activity.js.map +1 -0
- package/dist/voice/agent_session.cjs +592 -0
- package/dist/voice/agent_session.cjs.map +1 -0
- package/dist/voice/agent_session.d.cts +165 -0
- package/dist/voice/agent_session.d.ts +165 -0
- package/dist/voice/agent_session.d.ts.map +1 -0
- package/dist/voice/agent_session.js +582 -0
- package/dist/voice/agent_session.js.map +1 -0
- package/dist/voice/audio_recognition.cjs +668 -0
- package/dist/voice/audio_recognition.cjs.map +1 -0
- package/dist/voice/audio_recognition.d.cts +127 -0
- package/dist/voice/audio_recognition.d.ts +127 -0
- package/dist/voice/audio_recognition.d.ts.map +1 -0
- package/dist/voice/audio_recognition.js +647 -0
- package/dist/voice/audio_recognition.js.map +1 -0
- package/dist/voice/avatar/datastream_io.cjs +204 -0
- package/dist/voice/avatar/datastream_io.cjs.map +1 -0
- package/dist/voice/avatar/datastream_io.d.cts +37 -0
- package/dist/voice/avatar/datastream_io.d.ts +37 -0
- package/dist/voice/avatar/datastream_io.d.ts.map +1 -0
- package/dist/voice/avatar/datastream_io.js +188 -0
- package/dist/voice/avatar/datastream_io.js.map +1 -0
- package/dist/voice/avatar/index.cjs +23 -0
- package/dist/voice/avatar/index.cjs.map +1 -0
- package/dist/voice/avatar/index.d.cts +2 -0
- package/dist/voice/avatar/index.d.ts +2 -0
- package/dist/voice/avatar/index.d.ts.map +1 -0
- package/dist/voice/avatar/index.js +2 -0
- package/dist/voice/avatar/index.js.map +1 -0
- package/dist/voice/background_audio.cjs +366 -0
- package/dist/voice/background_audio.cjs.map +1 -0
- package/dist/voice/background_audio.d.cts +121 -0
- package/dist/voice/background_audio.d.ts +121 -0
- package/dist/voice/background_audio.d.ts.map +1 -0
- package/dist/voice/background_audio.js +342 -0
- package/dist/voice/background_audio.js.map +1 -0
- package/dist/voice/events.cjs +147 -0
- package/dist/voice/events.cjs.map +1 -0
- package/dist/voice/events.d.cts +127 -0
- package/dist/voice/events.d.ts +127 -0
- package/dist/voice/events.d.ts.map +1 -0
- package/dist/voice/events.js +112 -0
- package/dist/voice/events.js.map +1 -0
- package/dist/voice/generation.cjs +747 -0
- package/dist/voice/generation.cjs.map +1 -0
- package/dist/voice/generation.d.cts +116 -0
- package/dist/voice/generation.d.ts +116 -0
- package/dist/voice/generation.d.ts.map +1 -0
- package/dist/voice/generation.js +719 -0
- package/dist/voice/generation.js.map +1 -0
- 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 +49 -0
- package/dist/voice/index.cjs.map +1 -0
- package/dist/voice/index.d.cts +10 -0
- package/dist/voice/index.d.ts +10 -0
- package/dist/voice/index.d.ts.map +1 -0
- package/dist/voice/index.js +16 -0
- package/dist/voice/index.js.map +1 -0
- 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 +270 -0
- package/dist/voice/io.cjs.map +1 -0
- package/dist/voice/io.d.cts +126 -0
- package/dist/voice/io.d.ts +126 -0
- package/dist/voice/io.d.ts.map +1 -0
- package/dist/voice/io.js +242 -0
- package/dist/voice/io.js.map +1 -0
- 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 +542 -0
- package/dist/voice/recorder_io/recorder_io.cjs.map +1 -0
- package/dist/voice/recorder_io/recorder_io.d.cts +100 -0
- package/dist/voice/recorder_io/recorder_io.d.ts +100 -0
- package/dist/voice/recorder_io/recorder_io.d.ts.map +1 -0
- package/dist/voice/recorder_io/recorder_io.js +508 -0
- package/dist/voice/recorder_io/recorder_io.js.map +1 -0
- package/dist/voice/report.cjs +75 -0
- package/dist/voice/report.cjs.map +1 -0
- package/dist/voice/report.d.cts +42 -0
- package/dist/voice/report.d.ts +42 -0
- package/dist/voice/report.d.ts.map +1 -0
- package/dist/voice/report.js +50 -0
- package/dist/voice/report.js.map +1 -0
- package/dist/voice/room_io/_input.cjs +133 -0
- package/dist/voice/room_io/_input.cjs.map +1 -0
- package/dist/voice/room_io/_input.d.cts +24 -0
- package/dist/voice/room_io/_input.d.ts +24 -0
- package/dist/voice/room_io/_input.d.ts.map +1 -0
- package/dist/voice/room_io/_input.js +114 -0
- package/dist/voice/room_io/_input.js.map +1 -0
- package/dist/voice/room_io/_output.cjs +359 -0
- package/dist/voice/room_io/_output.cjs.map +1 -0
- package/dist/voice/room_io/_output.d.cts +77 -0
- package/dist/voice/room_io/_output.d.ts +77 -0
- package/dist/voice/room_io/_output.d.ts.map +1 -0
- package/dist/voice/room_io/_output.js +343 -0
- package/dist/voice/room_io/_output.js.map +1 -0
- package/dist/voice/room_io/index.cjs +25 -0
- package/dist/voice/room_io/index.cjs.map +1 -0
- package/dist/voice/room_io/index.d.cts +3 -0
- package/dist/voice/room_io/index.d.ts +3 -0
- package/dist/voice/room_io/index.d.ts.map +1 -0
- package/dist/voice/room_io/index.js +3 -0
- package/dist/voice/room_io/index.js.map +1 -0
- package/dist/voice/room_io/room_io.cjs +373 -0
- package/dist/voice/room_io/room_io.cjs.map +1 -0
- package/dist/voice/room_io/room_io.d.cts +94 -0
- package/dist/voice/room_io/room_io.d.ts +94 -0
- package/dist/voice/room_io/room_io.d.ts.map +1 -0
- package/dist/voice/room_io/room_io.js +364 -0
- package/dist/voice/room_io/room_io.js.map +1 -0
- package/dist/voice/run_context.cjs +51 -0
- package/dist/voice/run_context.cjs.map +1 -0
- package/dist/voice/run_context.d.cts +22 -0
- package/dist/voice/run_context.d.ts +22 -0
- package/dist/voice/run_context.d.ts.map +1 -0
- package/dist/voice/run_context.js +27 -0
- package/dist/voice/run_context.js.map +1 -0
- package/dist/voice/speech_handle.cjs +228 -0
- package/dist/voice/speech_handle.cjs.map +1 -0
- package/dist/voice/speech_handle.d.cts +97 -0
- package/dist/voice/speech_handle.d.ts +97 -0
- package/dist/voice/speech_handle.d.ts.map +1 -0
- package/dist/voice/speech_handle.js +204 -0
- package/dist/voice/speech_handle.js.map +1 -0
- package/dist/voice/transcription/_utils.cjs +45 -0
- package/dist/voice/transcription/_utils.cjs.map +1 -0
- package/dist/voice/transcription/_utils.d.cts +3 -0
- package/dist/voice/transcription/_utils.d.ts +3 -0
- package/dist/voice/transcription/_utils.d.ts.map +1 -0
- package/dist/voice/transcription/_utils.js +21 -0
- package/dist/voice/transcription/_utils.js.map +1 -0
- package/dist/voice/transcription/index.cjs +23 -0
- package/dist/voice/transcription/index.cjs.map +1 -0
- package/dist/voice/transcription/index.d.cts +2 -0
- package/dist/voice/transcription/index.d.ts +2 -0
- package/dist/voice/transcription/index.d.ts.map +1 -0
- package/dist/voice/transcription/index.js +2 -0
- package/dist/voice/transcription/index.js.map +1 -0
- package/dist/voice/transcription/synchronizer.cjs +379 -0
- package/dist/voice/transcription/synchronizer.cjs.map +1 -0
- package/dist/voice/transcription/synchronizer.d.cts +87 -0
- package/dist/voice/transcription/synchronizer.d.ts +87 -0
- package/dist/voice/transcription/synchronizer.d.ts.map +1 -0
- package/dist/voice/transcription/synchronizer.js +354 -0
- package/dist/voice/transcription/synchronizer.js.map +1 -0
- package/dist/worker.cjs +680 -0
- package/dist/worker.cjs.map +1 -0
- package/dist/worker.d.cts +119 -0
- package/dist/worker.d.ts +119 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +645 -0
- package/dist/worker.js.map +1 -0
- package/package.json +86 -0
- 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/_exceptions.ts +137 -0
- package/src/audio.ts +205 -0
- package/src/cli.ts +224 -0
- package/src/connection_pool.test.ts +346 -0
- package/src/connection_pool.ts +307 -0
- package/src/constants.ts +9 -0
- package/src/generator.ts +38 -0
- package/src/http_server.ts +64 -0
- package/src/index.ts +41 -0
- package/src/inference/api_protos.ts +82 -0
- package/src/inference/index.ts +32 -0
- package/src/inference/interruption/AdaptiveInterruptionDetector.ts +166 -0
- package/src/inference/interruption/InterruptionStream.ts +397 -0
- package/src/inference/interruption/defaults.ts +33 -0
- package/src/inference/interruption/errors.ts +0 -0
- package/src/inference/interruption/http_transport.ts +61 -0
- package/src/inference/interruption/index.ts +4 -0
- package/src/inference/interruption/interruption.ts +88 -0
- package/src/inference/llm.ts +532 -0
- package/src/inference/stt.ts +524 -0
- package/src/inference/tts.ts +574 -0
- package/src/inference/utils.test.ts +31 -0
- package/src/inference/utils.ts +81 -0
- package/src/inference_runner.ts +19 -0
- package/src/ipc/index.ts +5 -0
- package/src/ipc/inference_executor.ts +7 -0
- package/src/ipc/inference_proc_executor.ts +101 -0
- package/src/ipc/inference_proc_lazy_main.ts +115 -0
- package/src/ipc/job_executor.ts +23 -0
- package/src/ipc/job_proc_executor.ts +122 -0
- package/src/ipc/job_proc_lazy_main.ts +247 -0
- package/src/ipc/message.ts +52 -0
- package/src/ipc/proc_pool.ts +164 -0
- package/src/ipc/supervised_proc.test.ts +153 -0
- package/src/ipc/supervised_proc.ts +242 -0
- package/src/job.ts +461 -0
- package/src/llm/__snapshots__/chat_context.test.ts.snap +527 -0
- package/src/llm/__snapshots__/tool_context.test.ts.snap +177 -0
- package/src/llm/__snapshots__/zod-utils.test.ts.snap +559 -0
- package/src/llm/chat_context.test.ts +1057 -0
- package/src/llm/chat_context.ts +759 -0
- package/src/llm/fallback_adapter.test.ts +238 -0
- package/src/llm/fallback_adapter.ts +391 -0
- package/src/llm/index.ts +74 -0
- package/src/llm/llm.ts +303 -0
- package/src/llm/provider_format/google.test.ts +843 -0
- package/src/llm/provider_format/google.ts +134 -0
- package/src/llm/provider_format/index.ts +23 -0
- package/src/llm/provider_format/openai.test.ts +675 -0
- package/src/llm/provider_format/openai.ts +146 -0
- package/src/llm/provider_format/utils.ts +187 -0
- package/src/llm/realtime.ts +163 -0
- package/src/llm/remote_chat_context.test.ts +290 -0
- package/src/llm/remote_chat_context.ts +114 -0
- package/src/llm/tool_context.test.ts +407 -0
- package/src/llm/tool_context.ts +343 -0
- package/src/llm/tool_context.type.test.ts +115 -0
- package/src/llm/utils.test.ts +670 -0
- package/src/llm/utils.ts +336 -0
- package/src/llm/zod-utils.test.ts +577 -0
- package/src/llm/zod-utils.ts +153 -0
- package/src/log.ts +83 -0
- package/src/metrics/base.ts +168 -0
- package/src/metrics/index.ts +15 -0
- package/src/metrics/usage_collector.ts +46 -0
- package/src/metrics/utils.ts +64 -0
- package/src/plugin.ts +46 -0
- package/src/stream/deferred_stream.test.ts +755 -0
- package/src/stream/deferred_stream.ts +127 -0
- package/src/stream/identity_transform.test.ts +179 -0
- package/src/stream/identity_transform.ts +18 -0
- package/src/stream/index.ts +7 -0
- package/src/stream/merge_readable_streams.ts +40 -0
- package/src/stream/stream_channel.test.ts +166 -0
- package/src/stream/stream_channel.ts +44 -0
- package/src/stt/index.ts +15 -0
- package/src/stt/stream_adapter.ts +107 -0
- package/src/stt/stt.ts +374 -0
- package/src/telemetry/index.ts +28 -0
- package/src/telemetry/logging.ts +55 -0
- package/src/telemetry/otel_http_exporter.ts +195 -0
- package/src/telemetry/pino_otel_transport.ts +265 -0
- package/src/telemetry/trace_types.ts +95 -0
- package/src/telemetry/traces.ts +612 -0
- package/src/telemetry/utils.ts +61 -0
- package/src/tokenize/basic/basic.ts +83 -0
- package/src/tokenize/basic/hyphenator.ts +434 -0
- package/src/tokenize/basic/index.ts +11 -0
- package/src/tokenize/basic/paragraph.ts +43 -0
- package/src/tokenize/basic/sentence.ts +89 -0
- package/src/tokenize/basic/word.ts +27 -0
- package/src/tokenize/index.ts +16 -0
- package/src/tokenize/token_stream.ts +180 -0
- package/src/tokenize/tokenizer.test.ts +255 -0
- package/src/tokenize/tokenizer.ts +152 -0
- package/src/transcription.ts +307 -0
- package/src/tts/index.ts +12 -0
- package/src/tts/stream_adapter.ts +110 -0
- package/src/tts/tts.ts +598 -0
- package/src/types.ts +66 -0
- package/src/utils/ws_transport.test.ts +282 -0
- package/src/utils/ws_transport.ts +22 -0
- package/src/utils.test.ts +651 -0
- package/src/utils.ts +871 -0
- package/src/vad.ts +262 -0
- package/src/version.ts +5 -0
- package/src/voice/agent.test.ts +80 -0
- package/src/voice/agent.ts +418 -0
- package/src/voice/agent_activity.ts +2375 -0
- package/src/voice/agent_session.ts +866 -0
- package/src/voice/audio_recognition.ts +877 -0
- package/src/voice/avatar/datastream_io.ts +247 -0
- package/src/voice/avatar/index.ts +4 -0
- package/src/voice/background_audio.ts +491 -0
- package/src/voice/events.ts +261 -0
- package/src/voice/generation.ts +946 -0
- package/src/voice/generation_tools.test.ts +268 -0
- package/src/voice/index.ts +12 -0
- package/src/voice/interruption_detection.test.ts +151 -0
- package/src/voice/io.ts +347 -0
- package/src/voice/recorder_io/index.ts +4 -0
- package/src/voice/recorder_io/recorder_io.ts +690 -0
- package/src/voice/report.ts +100 -0
- package/src/voice/room_io/_input.ts +162 -0
- package/src/voice/room_io/_output.ts +439 -0
- package/src/voice/room_io/index.ts +5 -0
- package/src/voice/room_io/room_io.ts +518 -0
- package/src/voice/run_context.ts +34 -0
- package/src/voice/speech_handle.ts +250 -0
- package/src/voice/transcription/_utils.ts +25 -0
- package/src/voice/transcription/index.ts +4 -0
- package/src/voice/transcription/synchronizer.ts +477 -0
- package/src/worker.ts +798 -0
|
@@ -0,0 +1,49 @@
|
|
|
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 __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var voice_exports = {};
|
|
21
|
+
__export(voice_exports, {
|
|
22
|
+
Agent: () => import_agent.Agent,
|
|
23
|
+
AgentSession: () => import_agent_session.AgentSession,
|
|
24
|
+
RunContext: () => import_run_context.RunContext,
|
|
25
|
+
StopResponse: () => import_agent.StopResponse
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(voice_exports);
|
|
28
|
+
var import_agent = require("./agent.cjs");
|
|
29
|
+
var import_agent_session = require("./agent_session.cjs");
|
|
30
|
+
__reExport(voice_exports, require("./avatar/index.cjs"), module.exports);
|
|
31
|
+
__reExport(voice_exports, require("./background_audio.cjs"), module.exports);
|
|
32
|
+
__reExport(voice_exports, require("./events.cjs"), module.exports);
|
|
33
|
+
var import_io = require("./io.cjs");
|
|
34
|
+
__reExport(voice_exports, require("./report.cjs"), module.exports);
|
|
35
|
+
__reExport(voice_exports, require("./room_io/index.cjs"), module.exports);
|
|
36
|
+
var import_run_context = require("./run_context.cjs");
|
|
37
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
38
|
+
0 && (module.exports = {
|
|
39
|
+
Agent,
|
|
40
|
+
AgentSession,
|
|
41
|
+
RunContext,
|
|
42
|
+
StopResponse,
|
|
43
|
+
...require("./avatar/index.cjs"),
|
|
44
|
+
...require("./background_audio.cjs"),
|
|
45
|
+
...require("./events.cjs"),
|
|
46
|
+
...require("./report.cjs"),
|
|
47
|
+
...require("./room_io/index.cjs")
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/voice/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nexport { Agent, StopResponse, type AgentOptions, type ModelSettings } from './agent.js';\nexport { AgentSession, type AgentSessionOptions } from './agent_session.js';\nexport * from './avatar/index.js';\nexport * from './background_audio.js';\nexport * from './events.js';\nexport { type TimedString } from './io.js';\nexport * from './report.js';\nexport * from './room_io/index.js';\nexport { RunContext } from './run_context.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,mBAA2E;AAC3E,2BAAuD;AACvD,0BAAc,8BALd;AAMA,0BAAc,kCANd;AAOA,0BAAc,wBAPd;AAQA,gBAAiC;AACjC,0BAAc,wBATd;AAUA,0BAAc,+BAVd;AAWA,yBAA2B;","names":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Agent, StopResponse, type AgentOptions, type ModelSettings } from './agent.js';
|
|
2
|
+
export { AgentSession, type AgentSessionOptions } from './agent_session.js';
|
|
3
|
+
export * from './avatar/index.js';
|
|
4
|
+
export * from './background_audio.js';
|
|
5
|
+
export * from './events.js';
|
|
6
|
+
export { type TimedString } from './io.js';
|
|
7
|
+
export * from './report.js';
|
|
8
|
+
export * from './room_io/index.js';
|
|
9
|
+
export { RunContext } from './run_context.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Agent, StopResponse, type AgentOptions, type ModelSettings } from './agent.js';
|
|
2
|
+
export { AgentSession, type AgentSessionOptions } from './agent_session.js';
|
|
3
|
+
export * from './avatar/index.js';
|
|
4
|
+
export * from './background_audio.js';
|
|
5
|
+
export * from './events.js';
|
|
6
|
+
export { type TimedString } from './io.js';
|
|
7
|
+
export * from './report.js';
|
|
8
|
+
export * from './room_io/index.js';
|
|
9
|
+
export { RunContext } from './run_context.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/voice/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAE,MAAM,YAAY,CAAC;AACxF,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAC5E,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Agent, StopResponse } from "./agent.js";
|
|
2
|
+
import { AgentSession } from "./agent_session.js";
|
|
3
|
+
export * from "./avatar/index.js";
|
|
4
|
+
export * from "./background_audio.js";
|
|
5
|
+
export * from "./events.js";
|
|
6
|
+
import {} from "./io.js";
|
|
7
|
+
export * from "./report.js";
|
|
8
|
+
export * from "./room_io/index.js";
|
|
9
|
+
import { RunContext } from "./run_context.js";
|
|
10
|
+
export {
|
|
11
|
+
Agent,
|
|
12
|
+
AgentSession,
|
|
13
|
+
RunContext,
|
|
14
|
+
StopResponse
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/voice/index.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\nexport { Agent, StopResponse, type AgentOptions, type ModelSettings } from './agent.js';\nexport { AgentSession, type AgentSessionOptions } from './agent_session.js';\nexport * from './avatar/index.js';\nexport * from './background_audio.js';\nexport * from './events.js';\nexport { type TimedString } from './io.js';\nexport * from './report.js';\nexport * from './room_io/index.js';\nexport { RunContext } from './run_context.js';\n"],"mappings":"AAGA,SAAS,OAAO,oBAA2D;AAC3E,SAAS,oBAA8C;AACvD,cAAc;AACd,cAAc;AACd,cAAc;AACd,eAAiC;AACjC,cAAc;AACd,cAAc;AACd,SAAS,kBAAkB;","names":[]}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var import_vitest = require("vitest");
|
|
3
|
+
var import_word = require("../tokenize/basic/word.cjs");
|
|
4
|
+
(0, import_vitest.describe)("Interruption Detection - Word Counting", () => {
|
|
5
|
+
(0, import_vitest.describe)("Word Splitting Behavior", () => {
|
|
6
|
+
(0, import_vitest.it)("should count empty string as 0 words", () => {
|
|
7
|
+
const text = "";
|
|
8
|
+
const wordCount = (0, import_word.splitWords)(text, true).length;
|
|
9
|
+
(0, import_vitest.expect)(wordCount).toBe(0);
|
|
10
|
+
});
|
|
11
|
+
(0, import_vitest.it)("should count single word correctly", () => {
|
|
12
|
+
const text = "hello";
|
|
13
|
+
const wordCount = (0, import_word.splitWords)(text, true).length;
|
|
14
|
+
(0, import_vitest.expect)(wordCount).toBe(1);
|
|
15
|
+
});
|
|
16
|
+
(0, import_vitest.it)("should count two words correctly", () => {
|
|
17
|
+
const text = "hello world";
|
|
18
|
+
const wordCount = (0, import_word.splitWords)(text, true).length;
|
|
19
|
+
(0, import_vitest.expect)(wordCount).toBe(2);
|
|
20
|
+
});
|
|
21
|
+
(0, import_vitest.it)("should count multiple words correctly", () => {
|
|
22
|
+
const text = "hello this is a full sentence";
|
|
23
|
+
const wordCount = (0, import_word.splitWords)(text, true).length;
|
|
24
|
+
(0, import_vitest.expect)(wordCount).toBe(6);
|
|
25
|
+
});
|
|
26
|
+
(0, import_vitest.it)("should handle punctuation correctly", () => {
|
|
27
|
+
const text = "hello, world!";
|
|
28
|
+
const wordCount = (0, import_word.splitWords)(text, true).length;
|
|
29
|
+
(0, import_vitest.expect)(wordCount).toBe(2);
|
|
30
|
+
});
|
|
31
|
+
(0, import_vitest.it)("should handle multiple spaces between words", () => {
|
|
32
|
+
const text = "hello world";
|
|
33
|
+
const wordCount = (0, import_word.splitWords)(text, true).length;
|
|
34
|
+
(0, import_vitest.expect)(wordCount).toBe(2);
|
|
35
|
+
});
|
|
36
|
+
(0, import_vitest.it)("should count whitespace-only string as 0 words", () => {
|
|
37
|
+
const text = " ";
|
|
38
|
+
const wordCount = (0, import_word.splitWords)(text, true).length;
|
|
39
|
+
(0, import_vitest.expect)(wordCount).toBe(0);
|
|
40
|
+
});
|
|
41
|
+
(0, import_vitest.it)("should handle leading and trailing whitespace", () => {
|
|
42
|
+
const text = " hello world ";
|
|
43
|
+
const wordCount = (0, import_word.splitWords)(text, true).length;
|
|
44
|
+
(0, import_vitest.expect)(wordCount).toBe(2);
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
(0, import_vitest.describe)("Integration: Full Interruption Check Logic", () => {
|
|
48
|
+
(0, import_vitest.it)("should block interruption for empty transcript with threshold 2", () => {
|
|
49
|
+
const text = "";
|
|
50
|
+
const minInterruptionWords = 2;
|
|
51
|
+
const normalizedText = text ?? "";
|
|
52
|
+
const wordCount = (0, import_word.splitWords)(normalizedText, true).length;
|
|
53
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
54
|
+
(0, import_vitest.expect)(normalizedText).toBe("");
|
|
55
|
+
(0, import_vitest.expect)(wordCount).toBe(0);
|
|
56
|
+
(0, import_vitest.expect)(shouldBlock).toBe(true);
|
|
57
|
+
});
|
|
58
|
+
(0, import_vitest.it)("should block interruption for undefined transcript with threshold 2", () => {
|
|
59
|
+
const text = void 0;
|
|
60
|
+
const minInterruptionWords = 2;
|
|
61
|
+
const normalizedText = text ?? "";
|
|
62
|
+
const wordCount = (0, import_word.splitWords)(normalizedText, true).length;
|
|
63
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
64
|
+
(0, import_vitest.expect)(normalizedText).toBe("");
|
|
65
|
+
(0, import_vitest.expect)(wordCount).toBe(0);
|
|
66
|
+
(0, import_vitest.expect)(shouldBlock).toBe(true);
|
|
67
|
+
});
|
|
68
|
+
(0, import_vitest.it)("should block interruption for single word with threshold 2", () => {
|
|
69
|
+
const text = "hello";
|
|
70
|
+
const minInterruptionWords = 2;
|
|
71
|
+
const normalizedText = text ?? "";
|
|
72
|
+
const wordCount = (0, import_word.splitWords)(normalizedText, true).length;
|
|
73
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
74
|
+
(0, import_vitest.expect)(normalizedText).toBe("hello");
|
|
75
|
+
(0, import_vitest.expect)(wordCount).toBe(1);
|
|
76
|
+
(0, import_vitest.expect)(shouldBlock).toBe(true);
|
|
77
|
+
});
|
|
78
|
+
(0, import_vitest.it)("should allow interruption when word count exactly meets threshold", () => {
|
|
79
|
+
const text = "hello world";
|
|
80
|
+
const minInterruptionWords = 2;
|
|
81
|
+
const normalizedText = text ?? "";
|
|
82
|
+
const wordCount = (0, import_word.splitWords)(normalizedText, true).length;
|
|
83
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
84
|
+
(0, import_vitest.expect)(normalizedText).toBe("hello world");
|
|
85
|
+
(0, import_vitest.expect)(wordCount).toBe(2);
|
|
86
|
+
(0, import_vitest.expect)(shouldBlock).toBe(false);
|
|
87
|
+
});
|
|
88
|
+
(0, import_vitest.it)("should allow interruption when word count exceeds threshold", () => {
|
|
89
|
+
const text = "hello this is a full sentence";
|
|
90
|
+
const minInterruptionWords = 2;
|
|
91
|
+
const normalizedText = text ?? "";
|
|
92
|
+
const wordCount = (0, import_word.splitWords)(normalizedText, true).length;
|
|
93
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
94
|
+
(0, import_vitest.expect)(normalizedText).toBe("hello this is a full sentence");
|
|
95
|
+
(0, import_vitest.expect)(wordCount).toBe(6);
|
|
96
|
+
(0, import_vitest.expect)(shouldBlock).toBe(false);
|
|
97
|
+
});
|
|
98
|
+
(0, import_vitest.it)("should apply consistent word counting logic in both methods", () => {
|
|
99
|
+
const transcripts = ["", "hello", "hello world", "this is a longer sentence"];
|
|
100
|
+
const threshold = 2;
|
|
101
|
+
transcripts.forEach((transcript) => {
|
|
102
|
+
const text1 = transcript;
|
|
103
|
+
const normalizedText1 = text1 ?? "";
|
|
104
|
+
const wordCount1 = (0, import_word.splitWords)(normalizedText1, true).length;
|
|
105
|
+
const shouldBlock1 = wordCount1 < threshold;
|
|
106
|
+
const wordCount2 = (0, import_word.splitWords)(transcript, true).length;
|
|
107
|
+
const shouldBlock2 = wordCount2 < threshold;
|
|
108
|
+
(0, import_vitest.expect)(wordCount1).toBe(wordCount2);
|
|
109
|
+
(0, import_vitest.expect)(shouldBlock1).toBe(shouldBlock2);
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
});
|
|
114
|
+
//# sourceMappingURL=interruption_detection.test.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/voice/interruption_detection.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Unit tests for interruption detection logic in AgentActivity.\n *\n * Tests the refactored minInterruptionWords check which ensures:\n * - Consistent word count filtering across all speech scenarios\n * - Proper handling of empty strings, undefined, and short speech\n * - Interruptions allowed only when word count meets or exceeds minInterruptionWords threshold\n */\nimport { describe, expect, it } from 'vitest';\nimport { splitWords } from '../tokenize/basic/word.js';\n\ndescribe('Interruption Detection - Word Counting', () => {\n describe('Word Splitting Behavior', () => {\n it('should count empty string as 0 words', () => {\n const text = '';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(0);\n });\n\n it('should count single word correctly', () => {\n const text = 'hello';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(1);\n });\n\n it('should count two words correctly', () => {\n const text = 'hello world';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(2);\n });\n\n it('should count multiple words correctly', () => {\n const text = 'hello this is a full sentence';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(6);\n });\n\n it('should handle punctuation correctly', () => {\n const text = 'hello, world!';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(2);\n });\n\n it('should handle multiple spaces between words', () => {\n const text = 'hello world';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(2);\n });\n\n it('should count whitespace-only string as 0 words', () => {\n const text = ' ';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(0);\n });\n\n it('should handle leading and trailing whitespace', () => {\n const text = ' hello world ';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(2);\n });\n });\n\n describe('Integration: Full Interruption Check Logic', () => {\n it('should block interruption for empty transcript with threshold 2', () => {\n const text = '';\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('');\n expect(wordCount).toBe(0);\n expect(shouldBlock).toBe(true);\n });\n\n it('should block interruption for undefined transcript with threshold 2', () => {\n const text: string | undefined = undefined;\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('');\n expect(wordCount).toBe(0);\n expect(shouldBlock).toBe(true);\n });\n\n it('should block interruption for single word with threshold 2', () => {\n const text = 'hello';\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('hello');\n expect(wordCount).toBe(1);\n expect(shouldBlock).toBe(true);\n });\n\n it('should allow interruption when word count exactly meets threshold', () => {\n const text = 'hello world';\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('hello world');\n expect(wordCount).toBe(2);\n expect(shouldBlock).toBe(false);\n });\n\n it('should allow interruption when word count exceeds threshold', () => {\n const text = 'hello this is a full sentence';\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('hello this is a full sentence');\n expect(wordCount).toBe(6);\n expect(shouldBlock).toBe(false);\n });\n\n it('should apply consistent word counting logic in both methods', () => {\n const transcripts = ['', 'hello', 'hello world', 'this is a longer sentence'];\n const threshold = 2;\n\n transcripts.forEach((transcript) => {\n const text1 = transcript;\n const normalizedText1 = text1 ?? '';\n const wordCount1 = splitWords(normalizedText1, true).length;\n const shouldBlock1 = wordCount1 < threshold;\n\n const wordCount2 = splitWords(transcript, true).length;\n const shouldBlock2 = wordCount2 < threshold;\n\n expect(wordCount1).toBe(wordCount2);\n expect(shouldBlock1).toBe(shouldBlock2);\n });\n });\n });\n});\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { describe, expect, it } from "vitest";
|
|
2
|
+
import { splitWords } from "../tokenize/basic/word.js";
|
|
3
|
+
describe("Interruption Detection - Word Counting", () => {
|
|
4
|
+
describe("Word Splitting Behavior", () => {
|
|
5
|
+
it("should count empty string as 0 words", () => {
|
|
6
|
+
const text = "";
|
|
7
|
+
const wordCount = splitWords(text, true).length;
|
|
8
|
+
expect(wordCount).toBe(0);
|
|
9
|
+
});
|
|
10
|
+
it("should count single word correctly", () => {
|
|
11
|
+
const text = "hello";
|
|
12
|
+
const wordCount = splitWords(text, true).length;
|
|
13
|
+
expect(wordCount).toBe(1);
|
|
14
|
+
});
|
|
15
|
+
it("should count two words correctly", () => {
|
|
16
|
+
const text = "hello world";
|
|
17
|
+
const wordCount = splitWords(text, true).length;
|
|
18
|
+
expect(wordCount).toBe(2);
|
|
19
|
+
});
|
|
20
|
+
it("should count multiple words correctly", () => {
|
|
21
|
+
const text = "hello this is a full sentence";
|
|
22
|
+
const wordCount = splitWords(text, true).length;
|
|
23
|
+
expect(wordCount).toBe(6);
|
|
24
|
+
});
|
|
25
|
+
it("should handle punctuation correctly", () => {
|
|
26
|
+
const text = "hello, world!";
|
|
27
|
+
const wordCount = splitWords(text, true).length;
|
|
28
|
+
expect(wordCount).toBe(2);
|
|
29
|
+
});
|
|
30
|
+
it("should handle multiple spaces between words", () => {
|
|
31
|
+
const text = "hello world";
|
|
32
|
+
const wordCount = splitWords(text, true).length;
|
|
33
|
+
expect(wordCount).toBe(2);
|
|
34
|
+
});
|
|
35
|
+
it("should count whitespace-only string as 0 words", () => {
|
|
36
|
+
const text = " ";
|
|
37
|
+
const wordCount = splitWords(text, true).length;
|
|
38
|
+
expect(wordCount).toBe(0);
|
|
39
|
+
});
|
|
40
|
+
it("should handle leading and trailing whitespace", () => {
|
|
41
|
+
const text = " hello world ";
|
|
42
|
+
const wordCount = splitWords(text, true).length;
|
|
43
|
+
expect(wordCount).toBe(2);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
describe("Integration: Full Interruption Check Logic", () => {
|
|
47
|
+
it("should block interruption for empty transcript with threshold 2", () => {
|
|
48
|
+
const text = "";
|
|
49
|
+
const minInterruptionWords = 2;
|
|
50
|
+
const normalizedText = text ?? "";
|
|
51
|
+
const wordCount = splitWords(normalizedText, true).length;
|
|
52
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
53
|
+
expect(normalizedText).toBe("");
|
|
54
|
+
expect(wordCount).toBe(0);
|
|
55
|
+
expect(shouldBlock).toBe(true);
|
|
56
|
+
});
|
|
57
|
+
it("should block interruption for undefined transcript with threshold 2", () => {
|
|
58
|
+
const text = void 0;
|
|
59
|
+
const minInterruptionWords = 2;
|
|
60
|
+
const normalizedText = text ?? "";
|
|
61
|
+
const wordCount = splitWords(normalizedText, true).length;
|
|
62
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
63
|
+
expect(normalizedText).toBe("");
|
|
64
|
+
expect(wordCount).toBe(0);
|
|
65
|
+
expect(shouldBlock).toBe(true);
|
|
66
|
+
});
|
|
67
|
+
it("should block interruption for single word with threshold 2", () => {
|
|
68
|
+
const text = "hello";
|
|
69
|
+
const minInterruptionWords = 2;
|
|
70
|
+
const normalizedText = text ?? "";
|
|
71
|
+
const wordCount = splitWords(normalizedText, true).length;
|
|
72
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
73
|
+
expect(normalizedText).toBe("hello");
|
|
74
|
+
expect(wordCount).toBe(1);
|
|
75
|
+
expect(shouldBlock).toBe(true);
|
|
76
|
+
});
|
|
77
|
+
it("should allow interruption when word count exactly meets threshold", () => {
|
|
78
|
+
const text = "hello world";
|
|
79
|
+
const minInterruptionWords = 2;
|
|
80
|
+
const normalizedText = text ?? "";
|
|
81
|
+
const wordCount = splitWords(normalizedText, true).length;
|
|
82
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
83
|
+
expect(normalizedText).toBe("hello world");
|
|
84
|
+
expect(wordCount).toBe(2);
|
|
85
|
+
expect(shouldBlock).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
it("should allow interruption when word count exceeds threshold", () => {
|
|
88
|
+
const text = "hello this is a full sentence";
|
|
89
|
+
const minInterruptionWords = 2;
|
|
90
|
+
const normalizedText = text ?? "";
|
|
91
|
+
const wordCount = splitWords(normalizedText, true).length;
|
|
92
|
+
const shouldBlock = wordCount < minInterruptionWords;
|
|
93
|
+
expect(normalizedText).toBe("hello this is a full sentence");
|
|
94
|
+
expect(wordCount).toBe(6);
|
|
95
|
+
expect(shouldBlock).toBe(false);
|
|
96
|
+
});
|
|
97
|
+
it("should apply consistent word counting logic in both methods", () => {
|
|
98
|
+
const transcripts = ["", "hello", "hello world", "this is a longer sentence"];
|
|
99
|
+
const threshold = 2;
|
|
100
|
+
transcripts.forEach((transcript) => {
|
|
101
|
+
const text1 = transcript;
|
|
102
|
+
const normalizedText1 = text1 ?? "";
|
|
103
|
+
const wordCount1 = splitWords(normalizedText1, true).length;
|
|
104
|
+
const shouldBlock1 = wordCount1 < threshold;
|
|
105
|
+
const wordCount2 = splitWords(transcript, true).length;
|
|
106
|
+
const shouldBlock2 = wordCount2 < threshold;
|
|
107
|
+
expect(wordCount1).toBe(wordCount2);
|
|
108
|
+
expect(shouldBlock1).toBe(shouldBlock2);
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
//# sourceMappingURL=interruption_detection.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/voice/interruption_detection.test.ts"],"sourcesContent":["// SPDX-FileCopyrightText: 2025 LiveKit, Inc.\n//\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * Unit tests for interruption detection logic in AgentActivity.\n *\n * Tests the refactored minInterruptionWords check which ensures:\n * - Consistent word count filtering across all speech scenarios\n * - Proper handling of empty strings, undefined, and short speech\n * - Interruptions allowed only when word count meets or exceeds minInterruptionWords threshold\n */\nimport { describe, expect, it } from 'vitest';\nimport { splitWords } from '../tokenize/basic/word.js';\n\ndescribe('Interruption Detection - Word Counting', () => {\n describe('Word Splitting Behavior', () => {\n it('should count empty string as 0 words', () => {\n const text = '';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(0);\n });\n\n it('should count single word correctly', () => {\n const text = 'hello';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(1);\n });\n\n it('should count two words correctly', () => {\n const text = 'hello world';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(2);\n });\n\n it('should count multiple words correctly', () => {\n const text = 'hello this is a full sentence';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(6);\n });\n\n it('should handle punctuation correctly', () => {\n const text = 'hello, world!';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(2);\n });\n\n it('should handle multiple spaces between words', () => {\n const text = 'hello world';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(2);\n });\n\n it('should count whitespace-only string as 0 words', () => {\n const text = ' ';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(0);\n });\n\n it('should handle leading and trailing whitespace', () => {\n const text = ' hello world ';\n const wordCount = splitWords(text, true).length;\n expect(wordCount).toBe(2);\n });\n });\n\n describe('Integration: Full Interruption Check Logic', () => {\n it('should block interruption for empty transcript with threshold 2', () => {\n const text = '';\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('');\n expect(wordCount).toBe(0);\n expect(shouldBlock).toBe(true);\n });\n\n it('should block interruption for undefined transcript with threshold 2', () => {\n const text: string | undefined = undefined;\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('');\n expect(wordCount).toBe(0);\n expect(shouldBlock).toBe(true);\n });\n\n it('should block interruption for single word with threshold 2', () => {\n const text = 'hello';\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('hello');\n expect(wordCount).toBe(1);\n expect(shouldBlock).toBe(true);\n });\n\n it('should allow interruption when word count exactly meets threshold', () => {\n const text = 'hello world';\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('hello world');\n expect(wordCount).toBe(2);\n expect(shouldBlock).toBe(false);\n });\n\n it('should allow interruption when word count exceeds threshold', () => {\n const text = 'hello this is a full sentence';\n const minInterruptionWords = 2;\n\n const normalizedText = text ?? '';\n const wordCount = splitWords(normalizedText, true).length;\n const shouldBlock = wordCount < minInterruptionWords;\n\n expect(normalizedText).toBe('hello this is a full sentence');\n expect(wordCount).toBe(6);\n expect(shouldBlock).toBe(false);\n });\n\n it('should apply consistent word counting logic in both methods', () => {\n const transcripts = ['', 'hello', 'hello world', 'this is a longer sentence'];\n const threshold = 2;\n\n transcripts.forEach((transcript) => {\n const text1 = transcript;\n const normalizedText1 = text1 ?? '';\n const wordCount1 = splitWords(normalizedText1, true).length;\n const shouldBlock1 = wordCount1 < threshold;\n\n const wordCount2 = splitWords(transcript, true).length;\n const shouldBlock2 = wordCount2 < threshold;\n\n expect(wordCount1).toBe(wordCount2);\n expect(shouldBlock1).toBe(shouldBlock2);\n });\n });\n });\n});\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,270 @@
|
|
|
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 io_exports = {};
|
|
20
|
+
__export(io_exports, {
|
|
21
|
+
AgentInput: () => AgentInput,
|
|
22
|
+
AgentOutput: () => AgentOutput,
|
|
23
|
+
AudioInput: () => AudioInput,
|
|
24
|
+
AudioOutput: () => AudioOutput,
|
|
25
|
+
TextOutput: () => TextOutput
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(io_exports);
|
|
28
|
+
var import_node_events = require("node:events");
|
|
29
|
+
var import_log = require("../log.cjs");
|
|
30
|
+
var import_deferred_stream = require("../stream/deferred_stream.cjs");
|
|
31
|
+
var import_utils = require("../utils.cjs");
|
|
32
|
+
class AudioInput {
|
|
33
|
+
deferredStream = new import_deferred_stream.DeferredReadableStream();
|
|
34
|
+
get stream() {
|
|
35
|
+
return this.deferredStream.stream;
|
|
36
|
+
}
|
|
37
|
+
onAttached() {
|
|
38
|
+
}
|
|
39
|
+
onDetached() {
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
class AudioOutput extends import_node_events.EventEmitter {
|
|
43
|
+
constructor(sampleRate, nextInChain, capabilities = { pause: false }) {
|
|
44
|
+
super();
|
|
45
|
+
this.sampleRate = sampleRate;
|
|
46
|
+
this.nextInChain = nextInChain;
|
|
47
|
+
this.capabilities = capabilities;
|
|
48
|
+
if (this.nextInChain) {
|
|
49
|
+
this.nextInChain.on(
|
|
50
|
+
AudioOutput.EVENT_PLAYBACK_FINISHED,
|
|
51
|
+
(ev) => this.onPlaybackFinished(ev)
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
static EVENT_PLAYBACK_FINISHED = "playbackFinished";
|
|
56
|
+
playbackFinishedFuture = new import_utils.Future();
|
|
57
|
+
_capturing = false;
|
|
58
|
+
playbackFinishedCount = 0;
|
|
59
|
+
playbackSegmentsCount = 0;
|
|
60
|
+
lastPlaybackEvent = {
|
|
61
|
+
playbackPosition: 0,
|
|
62
|
+
interrupted: false
|
|
63
|
+
};
|
|
64
|
+
logger = (0, import_log.log)();
|
|
65
|
+
capabilities;
|
|
66
|
+
/**
|
|
67
|
+
* Whether this output and all outputs in the chain support pause/resume.
|
|
68
|
+
*/
|
|
69
|
+
get canPause() {
|
|
70
|
+
var _a;
|
|
71
|
+
return this.capabilities.pause && (((_a = this.nextInChain) == null ? void 0 : _a.canPause) ?? true);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Capture an audio frame for playback, frames can be pushed faster than real-time
|
|
75
|
+
*/
|
|
76
|
+
async captureFrame(_frame) {
|
|
77
|
+
if (!this._capturing) {
|
|
78
|
+
this._capturing = true;
|
|
79
|
+
this.playbackSegmentsCount++;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Wait for the past audio segments to finish playing out.
|
|
84
|
+
*
|
|
85
|
+
* @returns The event that was emitted when the audio finished playing out (only the last segment information)
|
|
86
|
+
*/
|
|
87
|
+
async waitForPlayout() {
|
|
88
|
+
const target = this.playbackSegmentsCount;
|
|
89
|
+
while (this.playbackFinishedCount < target) {
|
|
90
|
+
await this.playbackFinishedFuture.await;
|
|
91
|
+
this.playbackFinishedFuture = new import_utils.Future();
|
|
92
|
+
}
|
|
93
|
+
return this.lastPlaybackEvent;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Developers building audio sinks must call this method when a playback/segment is finished.
|
|
97
|
+
* Segments are segmented by calls to flush() or clearBuffer()
|
|
98
|
+
*/
|
|
99
|
+
onPlaybackFinished(options) {
|
|
100
|
+
if (this.playbackFinishedCount >= this.playbackSegmentsCount) {
|
|
101
|
+
this.logger.warn("playback_finished called more times than playback segments were captured");
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
this.lastPlaybackEvent = options;
|
|
105
|
+
this.playbackFinishedCount++;
|
|
106
|
+
this.playbackFinishedFuture.resolve();
|
|
107
|
+
this.emit(AudioOutput.EVENT_PLAYBACK_FINISHED, options);
|
|
108
|
+
}
|
|
109
|
+
flush() {
|
|
110
|
+
this._capturing = false;
|
|
111
|
+
}
|
|
112
|
+
onAttached() {
|
|
113
|
+
if (this.nextInChain) {
|
|
114
|
+
this.nextInChain.onAttached();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
onDetached() {
|
|
118
|
+
if (this.nextInChain) {
|
|
119
|
+
this.nextInChain.onDetached();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Pause the audio playback
|
|
124
|
+
*/
|
|
125
|
+
pause() {
|
|
126
|
+
if (this.nextInChain) {
|
|
127
|
+
this.nextInChain.pause();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Resume the audio playback
|
|
132
|
+
*/
|
|
133
|
+
resume() {
|
|
134
|
+
if (this.nextInChain) {
|
|
135
|
+
this.nextInChain.resume();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
class TextOutput {
|
|
140
|
+
constructor(nextInChain) {
|
|
141
|
+
this.nextInChain = nextInChain;
|
|
142
|
+
}
|
|
143
|
+
onAttached() {
|
|
144
|
+
if (this.nextInChain) {
|
|
145
|
+
this.nextInChain.onAttached();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
onDetached() {
|
|
149
|
+
if (this.nextInChain) {
|
|
150
|
+
this.nextInChain.onDetached();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
class AgentInput {
|
|
155
|
+
constructor(audioChanged) {
|
|
156
|
+
this.audioChanged = audioChanged;
|
|
157
|
+
}
|
|
158
|
+
_audioStream = null;
|
|
159
|
+
// enabled by default
|
|
160
|
+
_audioEnabled = true;
|
|
161
|
+
setAudioEnabled(enable) {
|
|
162
|
+
if (enable === this._audioEnabled) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
this._audioEnabled = enable;
|
|
166
|
+
if (!this._audioStream) {
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
if (enable) {
|
|
170
|
+
this._audioStream.onAttached();
|
|
171
|
+
} else {
|
|
172
|
+
this._audioStream.onDetached();
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
get audioEnabled() {
|
|
176
|
+
return this._audioEnabled;
|
|
177
|
+
}
|
|
178
|
+
get audio() {
|
|
179
|
+
return this._audioStream;
|
|
180
|
+
}
|
|
181
|
+
set audio(stream) {
|
|
182
|
+
this._audioStream = stream;
|
|
183
|
+
this.audioChanged();
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
class AgentOutput {
|
|
187
|
+
constructor(audioChanged, transcriptionChanged) {
|
|
188
|
+
this.audioChanged = audioChanged;
|
|
189
|
+
this.transcriptionChanged = transcriptionChanged;
|
|
190
|
+
}
|
|
191
|
+
_audioSink = null;
|
|
192
|
+
_transcriptionSink = null;
|
|
193
|
+
_audioEnabled = true;
|
|
194
|
+
_transcriptionEnabled = true;
|
|
195
|
+
setAudioEnabled(enabled) {
|
|
196
|
+
if (enabled === this._audioEnabled) {
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
this._audioEnabled = enabled;
|
|
200
|
+
if (!this._audioSink) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (enabled) {
|
|
204
|
+
this._audioSink.onAttached();
|
|
205
|
+
} else {
|
|
206
|
+
this._audioSink.onDetached();
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
setTranscriptionEnabled(enabled) {
|
|
210
|
+
if (enabled === this._transcriptionEnabled) {
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
this._transcriptionEnabled = enabled;
|
|
214
|
+
if (!this._transcriptionSink) {
|
|
215
|
+
return;
|
|
216
|
+
}
|
|
217
|
+
if (enabled) {
|
|
218
|
+
this._transcriptionSink.onAttached();
|
|
219
|
+
} else {
|
|
220
|
+
this._transcriptionSink.onDetached();
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
get audioEnabled() {
|
|
224
|
+
return this._audioEnabled;
|
|
225
|
+
}
|
|
226
|
+
get transcriptionEnabled() {
|
|
227
|
+
return this._transcriptionEnabled;
|
|
228
|
+
}
|
|
229
|
+
get audio() {
|
|
230
|
+
return this._audioSink;
|
|
231
|
+
}
|
|
232
|
+
set audio(sink) {
|
|
233
|
+
if (sink === this._audioSink) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
if (this._audioSink) {
|
|
237
|
+
this._audioSink.onDetached();
|
|
238
|
+
}
|
|
239
|
+
this._audioSink = sink;
|
|
240
|
+
this.audioChanged();
|
|
241
|
+
if (this._audioSink) {
|
|
242
|
+
this._audioSink.onAttached();
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
get transcription() {
|
|
246
|
+
return this._transcriptionSink;
|
|
247
|
+
}
|
|
248
|
+
set transcription(sink) {
|
|
249
|
+
if (sink === this._transcriptionSink) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
if (this._transcriptionSink) {
|
|
253
|
+
this._transcriptionSink.onDetached();
|
|
254
|
+
}
|
|
255
|
+
this._transcriptionSink = sink;
|
|
256
|
+
this.transcriptionChanged();
|
|
257
|
+
if (this._transcriptionSink) {
|
|
258
|
+
this._transcriptionSink.onAttached();
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
263
|
+
0 && (module.exports = {
|
|
264
|
+
AgentInput,
|
|
265
|
+
AgentOutput,
|
|
266
|
+
AudioInput,
|
|
267
|
+
AudioOutput,
|
|
268
|
+
TextOutput
|
|
269
|
+
});
|
|
270
|
+
//# sourceMappingURL=io.cjs.map
|