@athenaintel/react 0.43.0 → 0.48.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/README.md +215 -3
- package/dist/agent-runtime/src/answer-label.cjs +137 -0
- package/dist/agent-runtime/src/answer-label.cjs.map +1 -0
- package/dist/agent-runtime/src/answer-label.d.ts +104 -0
- package/dist/agent-runtime/src/answer-label.js +137 -0
- package/dist/agent-runtime/src/answer-label.js.map +1 -0
- package/dist/agent-runtime/src/answer-rows.cjs +180 -0
- package/dist/agent-runtime/src/answer-rows.cjs.map +1 -0
- package/dist/agent-runtime/src/answer-rows.d.ts +86 -0
- package/dist/agent-runtime/src/answer-rows.js +180 -0
- package/dist/agent-runtime/src/answer-rows.js.map +1 -0
- package/dist/agent-runtime/src/client-tool-bridge.cjs +15 -15
- package/dist/agent-runtime/src/client-tool-bridge.cjs.map +1 -1
- package/dist/agent-runtime/src/conversation-index.cjs +8 -8
- package/dist/agent-runtime/src/conversation-index.cjs.map +1 -1
- package/dist/agent-runtime/src/decision-checks.cjs +207 -0
- package/dist/agent-runtime/src/decision-checks.cjs.map +1 -0
- package/dist/agent-runtime/src/decision-checks.d.ts +142 -0
- package/dist/agent-runtime/src/decision-checks.js +207 -0
- package/dist/agent-runtime/src/decision-checks.js.map +1 -0
- package/dist/agent-runtime/src/desktop-handoff.d.ts +12 -0
- package/dist/agent-runtime/src/errors.cjs +18 -0
- package/dist/agent-runtime/src/errors.cjs.map +1 -1
- package/dist/agent-runtime/src/errors.d.ts +7 -0
- package/dist/agent-runtime/src/errors.js +18 -0
- package/dist/agent-runtime/src/errors.js.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs +12 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.cjs.map +1 -1
- package/dist/agent-runtime/src/generated/runconfig-contract.d.ts +6 -6
- package/dist/agent-runtime/src/generated/runconfig-contract.js +12 -0
- package/dist/agent-runtime/src/generated/runconfig-contract.js.map +1 -1
- package/dist/agent-runtime/src/handoff-arrival.cjs +60 -0
- package/dist/agent-runtime/src/handoff-arrival.cjs.map +1 -0
- package/dist/agent-runtime/src/handoff-arrival.d.ts +46 -0
- package/dist/agent-runtime/src/handoff-arrival.js +60 -0
- package/dist/agent-runtime/src/handoff-arrival.js.map +1 -0
- package/dist/agent-runtime/src/index.d.ts +14 -8
- package/dist/agent-runtime/src/interrupts.cjs +43 -18
- package/dist/agent-runtime/src/interrupts.cjs.map +1 -1
- package/dist/agent-runtime/src/interrupts.d.ts +19 -2
- package/dist/agent-runtime/src/interrupts.js +28 -3
- package/dist/agent-runtime/src/interrupts.js.map +1 -1
- package/dist/agent-runtime/src/lane-history.cjs +8 -8
- package/dist/agent-runtime/src/lane-history.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.cjs +43 -8
- package/dist/agent-runtime/src/messages.cjs.map +1 -1
- package/dist/agent-runtime/src/messages.d.ts +25 -3
- package/dist/agent-runtime/src/messages.js +43 -8
- package/dist/agent-runtime/src/messages.js.map +1 -1
- package/dist/agent-runtime/src/offline-status.cjs +36 -0
- package/dist/agent-runtime/src/offline-status.cjs.map +1 -0
- package/dist/agent-runtime/src/offline-status.d.ts +118 -3
- package/dist/agent-runtime/src/offline-status.js +36 -0
- package/dist/agent-runtime/src/offline-status.js.map +1 -0
- package/dist/agent-runtime/src/queue.cjs +0 -9
- package/dist/agent-runtime/src/queue.cjs.map +1 -1
- package/dist/agent-runtime/src/queue.js +0 -9
- package/dist/agent-runtime/src/queue.js.map +1 -1
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs +9 -9
- package/dist/agent-runtime/src/quota-safe-local-storage-session.cjs.map +1 -1
- package/dist/agent-runtime/src/runtime-catalog.cjs +42 -0
- package/dist/agent-runtime/src/runtime-catalog.cjs.map +1 -0
- package/dist/agent-runtime/src/runtime-catalog.d.ts +35 -0
- package/dist/agent-runtime/src/runtime-catalog.js +42 -0
- package/dist/agent-runtime/src/runtime-catalog.js.map +1 -0
- package/dist/agent-runtime/src/runtime-messages.cjs.map +1 -1
- package/dist/agent-runtime/src/runtime-messages.d.ts +1 -1
- package/dist/agent-runtime/src/runtime-messages.js.map +1 -1
- package/dist/agent-runtime/src/runtime.d.ts +40 -0
- package/dist/agent-runtime/src/statewire-suspended.cjs +3 -3
- package/dist/agent-runtime/src/statewire-suspended.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.cjs +32 -2
- package/dist/agent-runtime/src/subagents.cjs.map +1 -1
- package/dist/agent-runtime/src/subagents.d.ts +9 -0
- package/dist/agent-runtime/src/subagents.js +30 -0
- package/dist/agent-runtime/src/subagents.js.map +1 -1
- package/dist/agent-runtime/src/thread-driver.cjs +67 -0
- package/dist/agent-runtime/src/thread-driver.cjs.map +1 -0
- package/dist/agent-runtime/src/thread-driver.d.ts +49 -0
- package/dist/agent-runtime/src/thread-driver.js +67 -0
- package/dist/agent-runtime/src/thread-driver.js.map +1 -0
- package/dist/agent-runtime/src/thread-handoff-flow-machine.d.ts +172 -0
- package/dist/agent-runtime/src/thread-handoff-protocol.d.ts +756 -0
- package/dist/agent-runtime/src/thread-handoff-qr.d.ts +11 -0
- package/dist/agent-runtime/src/thread-handoff.d.ts +3 -364
- package/dist/agent-runtime/src/thread-status.cjs +3 -3
- package/dist/agent-runtime/src/thread-status.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.cjs +210 -25
- package/dist/agent-runtime/src/tool-metadata.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-metadata.d.ts +12 -0
- package/dist/agent-runtime/src/tool-metadata.js +210 -25
- package/dist/agent-runtime/src/tool-metadata.js.map +1 -1
- package/dist/agent-runtime/src/tool-names.cjs +2 -0
- package/dist/agent-runtime/src/tool-names.cjs.map +1 -1
- package/dist/agent-runtime/src/tool-names.d.ts +2 -0
- package/dist/agent-runtime/src/tool-names.js +2 -0
- package/dist/agent-runtime/src/tool-names.js.map +1 -1
- package/dist/agent-runtime/src/types.d.ts +10 -2
- package/dist/agent-runtime/src/use-conversation-list.cjs +11 -11
- package/dist/agent-runtime/src/use-conversation-list.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs +24 -19
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.d.ts +2 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js +6 -1
- package/dist/agent-runtime/src/use-deep-agent-chat-outbox.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-config.cjs +14 -14
- package/dist/agent-runtime/src/use-deep-agent-config.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs +6 -6
- package/dist/agent-runtime/src/use-deep-agent-edit-submit.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs +16 -16
- package/dist/agent-runtime/src/use-deep-agent-runtime.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs +45 -45
- package/dist/agent-runtime/src/use-deep-agent-thread.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs +547 -124
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +129 -10
- package/dist/agent-runtime/src/use-deep-agent-voice.js +487 -64
- package/dist/agent-runtime/src/use-deep-agent-voice.js.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs +26 -26
- package/dist/agent-runtime/src/use-deep-agent-window-sync.cjs.map +1 -1
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs +4 -4
- package/dist/agent-runtime/src/use-historical-edit-attachments.cjs.map +1 -1
- package/dist/agent-runtime/src/use-thread-handoff-flow.d.ts +28 -26
- package/dist/agent-runtime/src/voice-media.cjs +117 -0
- package/dist/agent-runtime/src/voice-media.cjs.map +1 -0
- package/dist/agent-runtime/src/voice-media.d.ts +49 -0
- package/dist/agent-runtime/src/voice-media.js +117 -0
- package/dist/agent-runtime/src/voice-media.js.map +1 -0
- package/dist/agent-runtime/src/voice-wire-types.d.ts +32 -0
- package/dist/assets/AssetPanel.cjs +11 -11
- package/dist/assets/AssetPanel.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.cjs +11 -9
- package/dist/assets/AthenaAssetEmbed.cjs.map +1 -1
- package/dist/assets/AthenaAssetEmbed.d.ts +7 -0
- package/dist/assets/AthenaAssetEmbed.js +4 -2
- package/dist/assets/AthenaAssetEmbed.js.map +1 -1
- package/dist/assets/AthenaLayout.cjs +16 -16
- package/dist/assets/AthenaLayout.cjs.map +1 -1
- package/dist/assets/use-asset-content.cjs +4 -4
- package/dist/assets/use-asset-content.cjs.map +1 -1
- package/dist/assets/use-asset-embed.cjs +14 -7
- package/dist/assets/use-asset-embed.cjs.map +1 -1
- package/dist/assets/use-asset-embed.d.ts +11 -1
- package/dist/assets/use-asset-embed.js +10 -3
- package/dist/assets/use-asset-embed.js.map +1 -1
- package/dist/auth/AthenaAuthContext.cjs +3 -3
- package/dist/auth/AthenaAuthContext.cjs.map +1 -1
- package/dist/auth/AthenaAuthProvider.cjs +8 -8
- package/dist/auth/AthenaAuthProvider.cjs.map +1 -1
- package/dist/auth/AthenaCredentialSourceContext.cjs +5 -5
- package/dist/auth/AthenaCredentialSourceContext.cjs.map +1 -1
- package/dist/auth/AthenaSSOProvider.cjs +14 -14
- package/dist/auth/AthenaSSOProvider.cjs.map +1 -1
- package/dist/auth/credential-source.cjs +26 -13
- package/dist/auth/credential-source.cjs.map +1 -1
- package/dist/auth/credential-source.d.ts +8 -0
- package/dist/auth/credential-source.js +26 -13
- package/dist/auth/credential-source.js.map +1 -1
- package/dist/catalog/agent-model-options.cjs +25 -17
- package/dist/catalog/agent-model-options.cjs.map +1 -1
- package/dist/catalog/agent-model-options.d.ts +38 -5
- package/dist/catalog/agent-model-options.js +25 -17
- package/dist/catalog/agent-model-options.js.map +1 -1
- package/dist/catalog/channel-refusal.cjs +36 -0
- package/dist/catalog/channel-refusal.cjs.map +1 -0
- package/dist/catalog/channel-refusal.d.ts +29 -0
- package/dist/catalog/channel-refusal.js +36 -0
- package/dist/catalog/channel-refusal.js.map +1 -0
- package/dist/catalog/chat-pickers.cjs +60 -24
- package/dist/catalog/chat-pickers.cjs.map +1 -1
- package/dist/catalog/chat-pickers.d.ts +12 -2
- package/dist/catalog/chat-pickers.js +56 -20
- package/dist/catalog/chat-pickers.js.map +1 -1
- package/dist/catalog/runtime-catalog.cjs +89 -23
- package/dist/catalog/runtime-catalog.cjs.map +1 -1
- package/dist/catalog/runtime-catalog.d.ts +8 -2
- package/dist/catalog/runtime-catalog.js +83 -17
- package/dist/catalog/runtime-catalog.js.map +1 -1
- package/dist/catalog/use-athena-chat-mode.cjs +12 -12
- package/dist/catalog/use-athena-chat-mode.cjs.map +1 -1
- package/dist/chat/AthenaChat.cjs +155 -67
- package/dist/chat/AthenaChat.cjs.map +1 -1
- package/dist/chat/AthenaChat.d.ts +42 -2
- package/dist/chat/AthenaChat.js +106 -18
- package/dist/chat/AthenaChat.js.map +1 -1
- package/dist/chat/AthenaChatErrorBoundary.cjs +3 -3
- package/dist/chat/AthenaChatErrorBoundary.cjs.map +1 -1
- package/dist/chat/DrivingOnChip.cjs +23 -0
- package/dist/chat/DrivingOnChip.cjs.map +1 -0
- package/dist/chat/DrivingOnChip.d.ts +17 -0
- package/dist/chat/DrivingOnChip.js +23 -0
- package/dist/chat/DrivingOnChip.js.map +1 -0
- package/dist/chat/StatewireApprovalCard.cjs +125 -31
- package/dist/chat/StatewireApprovalCard.cjs.map +1 -1
- package/dist/chat/StatewireApprovalCard.d.ts +73 -1
- package/dist/chat/StatewireApprovalCard.js +115 -21
- package/dist/chat/StatewireApprovalCard.js.map +1 -1
- package/dist/chat/StatewireClientToolBridge.cjs +2 -2
- package/dist/chat/StatewireClientToolBridge.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.cjs +25 -63
- package/dist/chat/StatewireQueuedMessages.cjs.map +1 -1
- package/dist/chat/StatewireQueuedMessages.d.ts +11 -13
- package/dist/chat/StatewireQueuedMessages.js +16 -54
- package/dist/chat/StatewireQueuedMessages.js.map +1 -1
- package/dist/chat/WaitingOnYouBanner.cjs +3 -3
- package/dist/chat/WaitingOnYouBanner.cjs.map +1 -1
- package/dist/chat/athena-chat-welcome.cjs +2 -2
- package/dist/chat/athena-chat-welcome.cjs.map +1 -1
- package/dist/chat/athena-citation-links.cjs +5 -5
- package/dist/chat/athena-citation-links.cjs.map +1 -1
- package/dist/chat/athena-composer-controls.cjs +26 -16
- package/dist/chat/athena-composer-controls.cjs.map +1 -1
- package/dist/chat/athena-composer-controls.d.ts +6 -0
- package/dist/chat/athena-composer-controls.js +26 -16
- package/dist/chat/athena-composer-controls.js.map +1 -1
- package/dist/chat/athena-turn-end-status.cjs +42 -0
- package/dist/chat/athena-turn-end-status.cjs.map +1 -0
- package/dist/chat/athena-turn-end-status.d.ts +24 -0
- package/dist/chat/athena-turn-end-status.js +42 -0
- package/dist/chat/athena-turn-end-status.js.map +1 -0
- package/dist/chat/browser-decision-check.cjs +131 -0
- package/dist/chat/browser-decision-check.cjs.map +1 -0
- package/dist/chat/browser-decision-check.d.ts +61 -0
- package/dist/chat/browser-decision-check.js +131 -0
- package/dist/chat/browser-decision-check.js.map +1 -0
- package/dist/chat/chat-outbox-rows.cjs +3 -3
- package/dist/chat/chat-outbox-rows.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.cjs +93 -28
- package/dist/chat/chat-voice-controls.cjs.map +1 -1
- package/dist/chat/chat-voice-controls.d.ts +36 -2
- package/dist/chat/chat-voice-controls.js +89 -24
- package/dist/chat/chat-voice-controls.js.map +1 -1
- package/dist/chat/composer-keyboard-hint.cjs +5 -5
- package/dist/chat/composer-keyboard-hint.cjs.map +1 -1
- package/dist/chat/device-operation.cjs +29 -0
- package/dist/chat/device-operation.cjs.map +1 -0
- package/dist/chat/device-operation.d.ts +34 -0
- package/dist/chat/device-operation.js +29 -0
- package/dist/chat/device-operation.js.map +1 -0
- package/dist/chat/super-grouping/CollapsibleGroup.cjs +14 -14
- package/dist/chat/super-grouping/CollapsibleGroup.cjs.map +1 -1
- package/dist/chat/super-grouping/GroupedMessageParts.cjs +4 -4
- package/dist/chat/super-grouping/GroupedMessageParts.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.cjs +52 -36
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +19 -4
- package/dist/chat/super-grouping/SuperGroupingCard.js +29 -13
- package/dist/chat/super-grouping/SuperGroupingCard.js.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs +32 -32
- package/dist/chat/super-grouping/SuperGroupingTranscript.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingTranscript.js +3 -3
- package/dist/chat/super-grouping/SuperGroupingTranscript.js.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.cjs +73 -40
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +10 -2
- package/dist/chat/super-grouping/ToolTimeline.js +69 -36
- package/dist/chat/super-grouping/ToolTimeline.js.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.cjs +47 -12
- package/dist/chat/super-grouping/activity-timeline.cjs.map +1 -1
- package/dist/chat/super-grouping/activity-timeline.d.ts +21 -0
- package/dist/chat/super-grouping/activity-timeline.js +47 -12
- package/dist/chat/super-grouping/activity-timeline.js.map +1 -1
- package/dist/chat/super-grouping/grouping-function.cjs +4 -0
- package/dist/chat/super-grouping/grouping-function.cjs.map +1 -1
- package/dist/chat/super-grouping/grouping-function.d.ts +7 -0
- package/dist/chat/super-grouping/grouping-function.js +5 -1
- package/dist/chat/super-grouping/grouping-function.js.map +1 -1
- package/dist/chat/super-grouping/index.cjs +6 -0
- package/dist/chat/super-grouping/index.cjs.map +1 -1
- package/dist/chat/super-grouping/index.d.ts +5 -2
- package/dist/chat/super-grouping/index.js +7 -1
- package/dist/chat/super-grouping/index.js.map +1 -1
- package/dist/chat/super-grouping/tool-part-placement.cjs +17 -0
- package/dist/chat/super-grouping/tool-part-placement.cjs.map +1 -0
- package/dist/chat/super-grouping/tool-part-placement.d.ts +22 -0
- package/dist/chat/super-grouping/tool-part-placement.js +17 -0
- package/dist/chat/super-grouping/tool-part-placement.js.map +1 -0
- package/dist/chat/thread-scroll-to-bottom.cjs +2 -2
- package/dist/chat/thread-scroll-to-bottom.cjs.map +1 -1
- package/dist/chat/thread-scroll-to-bottom.d.ts +10 -7
- package/dist/chat/thread-scroll-to-bottom.js +2 -2
- package/dist/chat/thread-scroll-to-bottom.js.map +1 -1
- package/dist/chat/tooltip-icon-button.cjs +2 -2
- package/dist/chat/tooltip-icon-button.cjs.map +1 -1
- package/dist/chat/use-athena-voice-live.cjs +11 -0
- package/dist/chat/use-athena-voice-live.cjs.map +1 -0
- package/dist/chat/use-athena-voice-live.d.ts +11 -0
- package/dist/chat/use-athena-voice-live.js +11 -0
- package/dist/chat/use-athena-voice-live.js.map +1 -0
- package/dist/chat/use-statewire-approval-request.cjs +56 -24
- package/dist/chat/use-statewire-approval-request.cjs.map +1 -1
- package/dist/chat/use-statewire-approval-request.d.ts +33 -4
- package/dist/chat/use-statewire-approval-request.js +41 -9
- package/dist/chat/use-statewire-approval-request.js.map +1 -1
- package/dist/chat-ui/auth/sign-in-card.cjs +2 -2
- package/dist/chat-ui/auth/sign-in-card.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.cjs +138 -107
- package/dist/chat-ui/composer/tiptap-composer.cjs.map +1 -1
- package/dist/chat-ui/composer/tiptap-composer.d.ts +20 -4
- package/dist/chat-ui/composer/tiptap-composer.js +85 -54
- package/dist/chat-ui/composer/tiptap-composer.js.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.cjs +49 -23
- package/dist/chat-ui/header/conversation-history-panel.cjs.map +1 -1
- package/dist/chat-ui/header/conversation-history-panel.d.ts +12 -1
- package/dist/chat-ui/header/conversation-history-panel.js +38 -12
- package/dist/chat-ui/header/conversation-history-panel.js.map +1 -1
- package/dist/chat-ui/index.cjs +18 -0
- package/dist/chat-ui/index.cjs.map +1 -1
- package/dist/chat-ui/index.d.ts +7 -1
- package/dist/chat-ui/index.js +18 -0
- package/dist/chat-ui/index.js.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.cjs +4 -4
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs +10 -9
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js +3 -2
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/mention-suggestion-popup.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs +29 -6
- package/dist/chat-ui/mentions/suggestions/components/menu-list.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.d.ts +7 -1
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js +25 -2
- package/dist/chat-ui/mentions/suggestions/components/menu-list.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/use-keyboard-navigation.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs +2 -2
- package/dist/chat-ui/mentions/suggestions/components/use-menu-navigation.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs +3 -3
- package/dist/chat-ui/mentions/suggestions/data/api-client.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs +56 -2
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.d.ts +12 -0
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.js +56 -2
- package/dist/chat-ui/mentions/suggestions/data/orchestrator.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs +24 -3
- package/dist/chat-ui/mentions/suggestions/data/sources/index.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/sources/index.d.ts +7 -0
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js +24 -3
- package/dist/chat-ui/mentions/suggestions/data/sources/index.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs +35 -13
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.d.ts +15 -1
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js +28 -6
- package/dist/chat-ui/mentions/suggestions/data/use-mention-suggestions.js.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs +9 -6
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.cjs.map +1 -1
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.d.ts +3 -0
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js +5 -2
- package/dist/chat-ui/mentions/suggestions/data/use-menu-items.js.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs +45 -10
- package/dist/chat-ui/mentions/use-account-workspace-id.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.d.ts +24 -1
- package/dist/chat-ui/mentions/use-account-workspace-id.js +46 -11
- package/dist/chat-ui/mentions/use-account-workspace-id.js.map +1 -1
- package/dist/chat-ui/mentions/use-member-avatar.cjs +4 -4
- package/dist/chat-ui/mentions/use-member-avatar.cjs.map +1 -1
- package/dist/chat-ui/mentions/use-mention-asset.cjs +3 -3
- package/dist/chat-ui/mentions/use-mention-asset.cjs.map +1 -1
- package/dist/chat-ui/messages/answer-label.cjs +42 -0
- package/dist/chat-ui/messages/answer-label.cjs.map +1 -0
- package/dist/chat-ui/messages/answer-label.d.ts +33 -0
- package/dist/chat-ui/messages/answer-label.js +42 -0
- package/dist/chat-ui/messages/answer-label.js.map +1 -0
- package/dist/chat-ui/messages/arrival-animation.cjs +13 -0
- package/dist/chat-ui/messages/arrival-animation.cjs.map +1 -0
- package/dist/chat-ui/messages/arrival-animation.d.ts +14 -0
- package/dist/chat-ui/messages/arrival-animation.js +13 -0
- package/dist/chat-ui/messages/arrival-animation.js.map +1 -0
- package/dist/chat-ui/messages/continue-pill.cjs +5 -5
- package/dist/chat-ui/messages/continue-pill.cjs.map +1 -1
- package/dist/chat-ui/messages/handoff-arrival-divider.cjs +44 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.cjs.map +1 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.d.ts +17 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.js +44 -0
- package/dist/chat-ui/messages/handoff-arrival-divider.js.map +1 -0
- package/dist/chat-ui/messages/message-actions-config.cjs +3 -3
- package/dist/chat-ui/messages/message-actions-config.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.cjs +8 -4
- package/dist/chat-ui/messages/message-components.cjs.map +1 -1
- package/dist/chat-ui/messages/message-components.js +5 -1
- package/dist/chat-ui/messages/message-components.js.map +1 -1
- package/dist/chat-ui/messages/message-images.cjs +66 -0
- package/dist/chat-ui/messages/message-images.cjs.map +1 -0
- package/dist/chat-ui/messages/message-images.d.ts +16 -0
- package/dist/chat-ui/messages/message-images.js +66 -0
- package/dist/chat-ui/messages/message-images.js.map +1 -0
- package/dist/chat-ui/messages/user-edit-composer.cjs +2 -2
- package/dist/chat-ui/messages/user-edit-composer.cjs.map +1 -1
- package/dist/chat-ui/messages/wake-marker.cjs +3 -3
- package/dist/chat-ui/messages/wake-marker.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-link.cjs +2 -2
- package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-message-body.cjs +8 -8
- package/dist/chat-ui/rich-text/chat-message-body.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-node-views.cjs +6 -6
- package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
- package/dist/chat-ui/rich-text/dom-output-spec.cjs +2 -2
- package/dist/chat-ui/rich-text/dom-output-spec.cjs.map +1 -1
- package/dist/chat-ui/statewire.cjs +3 -0
- package/dist/chat-ui/statewire.cjs.map +1 -1
- package/dist/chat-ui/statewire.d.ts +2 -1
- package/dist/chat-ui/statewire.js +3 -0
- package/dist/chat-ui/statewire.js.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.cjs +43 -14
- package/dist/chat-ui/thread/chat-thread-shell.cjs.map +1 -1
- package/dist/chat-ui/thread/chat-thread-shell.d.ts +16 -2
- package/dist/chat-ui/thread/chat-thread-shell.js +35 -6
- package/dist/chat-ui/thread/chat-thread-shell.js.map +1 -1
- package/dist/chat-ui/thread/composer-send-or-stop.cjs +30 -20
- package/dist/chat-ui/thread/composer-send-or-stop.cjs.map +1 -1
- package/dist/chat-ui/thread/composer-send-or-stop.d.ts +8 -0
- package/dist/chat-ui/thread/composer-send-or-stop.js +29 -19
- package/dist/chat-ui/thread/composer-send-or-stop.js.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.cjs +20 -21
- package/dist/chat-ui/thread/statewire-history-edge.cjs.map +1 -1
- package/dist/chat-ui/thread/statewire-history-edge.js +3 -4
- package/dist/chat-ui/thread/statewire-history-edge.js.map +1 -1
- package/dist/chat-ui/thread/thread-loading-overlay.cjs +5 -5
- package/dist/chat-ui/thread/thread-loading-overlay.cjs.map +1 -1
- package/dist/collab/client.cjs +40 -3
- package/dist/collab/client.cjs.map +1 -1
- package/dist/collab/client.d.ts +25 -0
- package/dist/collab/client.js +40 -3
- package/dist/collab/client.js.map +1 -1
- package/dist/collab/document-status.cjs +150 -0
- package/dist/collab/document-status.cjs.map +1 -0
- package/dist/collab/document-status.d.ts +68 -0
- package/dist/collab/document-status.js +150 -0
- package/dist/collab/document-status.js.map +1 -0
- package/dist/collab/index.cjs +7 -0
- package/dist/collab/index.cjs.map +1 -1
- package/dist/collab/index.d.ts +6 -1
- package/dist/collab/index.js +7 -0
- package/dist/collab/index.js.map +1 -1
- package/dist/collab/presence-react.cjs +11 -11
- package/dist/collab/presence-react.cjs.map +1 -1
- package/dist/collab/react.cjs +6 -6
- package/dist/collab/react.cjs.map +1 -1
- package/dist/composer/AttachmentContext.cjs +24 -11
- package/dist/composer/AttachmentContext.cjs.map +1 -1
- package/dist/composer/AttachmentContext.js +18 -5
- package/dist/composer/AttachmentContext.js.map +1 -1
- package/dist/composer/ComposerAttachmentPreview.cjs +78 -23
- package/dist/composer/ComposerAttachmentPreview.cjs.map +1 -1
- package/dist/composer/ComposerAttachmentPreview.d.ts +5 -3
- package/dist/composer/ComposerAttachmentPreview.js +79 -24
- package/dist/composer/ComposerAttachmentPreview.js.map +1 -1
- package/dist/composer/ComposerDropZone.cjs +7 -7
- package/dist/composer/ComposerDropZone.cjs.map +1 -1
- package/dist/composer/FileUploadButton.cjs +37 -22
- package/dist/composer/FileUploadButton.cjs.map +1 -1
- package/dist/composer/FileUploadButton.d.ts +6 -0
- package/dist/composer/FileUploadButton.js +34 -19
- package/dist/composer/FileUploadButton.js.map +1 -1
- package/dist/composer/QuoteContext.cjs +8 -8
- package/dist/composer/QuoteContext.cjs.map +1 -1
- package/dist/composer/composer-handoff.cjs +4 -4
- package/dist/composer/composer-handoff.cjs.map +1 -1
- package/dist/composer/useAppendToComposer.cjs +4 -4
- package/dist/composer/useAppendToComposer.cjs.map +1 -1
- package/dist/composer/useAttachFiles.cjs +23 -6
- package/dist/composer/useAttachFiles.cjs.map +1 -1
- package/dist/composer/useAttachFiles.d.ts +15 -7
- package/dist/composer/useAttachFiles.js +22 -5
- package/dist/composer/useAttachFiles.js.map +1 -1
- package/dist/composer/useComposerAttachment.cjs +4 -4
- package/dist/composer/useComposerAttachment.cjs.map +1 -1
- package/dist/composer/useFileUpload.cjs +21 -16
- package/dist/composer/useFileUpload.cjs.map +1 -1
- package/dist/composer/useFileUpload.d.ts +12 -0
- package/dist/composer/useFileUpload.js +12 -7
- package/dist/composer/useFileUpload.js.map +1 -1
- package/dist/composer/useReadComposerDraft.cjs +2 -2
- package/dist/composer/useReadComposerDraft.cjs.map +1 -1
- package/dist/composer/useSendMessage.cjs +4 -4
- package/dist/composer/useSendMessage.cjs.map +1 -1
- package/dist/diagnostics/useAthenaDiagnostics.cjs +4 -4
- package/dist/diagnostics/useAthenaDiagnostics.cjs.map +1 -1
- package/dist/dictation/audio-level-history.cjs +3 -3
- package/dist/dictation/audio-level-history.cjs.map +1 -1
- package/dist/dictation/dictation-controls.cjs +24 -20
- package/dist/dictation/dictation-controls.cjs.map +1 -1
- package/dist/dictation/dictation-controls.d.ts +6 -1
- package/dist/dictation/dictation-controls.js +24 -20
- package/dist/dictation/dictation-controls.js.map +1 -1
- package/dist/dictation/use-athena-dictation-engine.cjs +3 -3
- package/dist/dictation/use-athena-dictation-engine.cjs.map +1 -1
- package/dist/dictation/use-dictation.cjs +22 -22
- package/dist/dictation/use-dictation.cjs.map +1 -1
- package/dist/index.cjs +26 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -3
- package/dist/index.js +26 -2
- package/dist/index.js.map +1 -1
- package/dist/keryx-http/src/receive-only-socket.cjs +40 -0
- package/dist/keryx-http/src/receive-only-socket.cjs.map +1 -0
- package/dist/keryx-http/src/receive-only-socket.d.ts +27 -0
- package/dist/keryx-http/src/receive-only-socket.js +40 -0
- package/dist/keryx-http/src/receive-only-socket.js.map +1 -0
- package/dist/keryx-http/src/update-attributions.cjs +111 -0
- package/dist/keryx-http/src/update-attributions.cjs.map +1 -0
- package/dist/keryx-http/src/update-attributions.d.ts +75 -0
- package/dist/keryx-http/src/update-attributions.js +111 -0
- package/dist/keryx-http/src/update-attributions.js.map +1 -0
- package/dist/lib/owner-document.cjs +6 -6
- package/dist/lib/owner-document.cjs.map +1 -1
- package/dist/lib/use-athena-rest-query.cjs +4 -4
- package/dist/lib/use-athena-rest-query.cjs.map +1 -1
- package/dist/lib/use-document-active.cjs +4 -4
- package/dist/lib/use-document-active.cjs.map +1 -1
- package/dist/lib/use-prefers-reduced-motion.cjs +2 -2
- package/dist/lib/use-prefers-reduced-motion.cjs.map +1 -1
- package/dist/offline/offline-history.cjs +7 -7
- package/dist/offline/offline-history.cjs.map +1 -1
- package/dist/provider/AthenaContext.cjs +3 -3
- package/dist/provider/AthenaContext.cjs.map +1 -1
- package/dist/provider/AthenaProvider.cjs +116 -79
- package/dist/provider/AthenaProvider.cjs.map +1 -1
- package/dist/provider/AthenaProvider.js +40 -3
- package/dist/provider/AthenaProvider.js.map +1 -1
- package/dist/provider/PostHogProvider.cjs +2 -2
- package/dist/provider/PostHogProvider.cjs.map +1 -1
- package/dist/provider/agent-selection-context.cjs +2 -2
- package/dist/provider/agent-selection-context.cjs.map +1 -1
- package/dist/provider/chat-mode-context.cjs +2 -2
- package/dist/provider/chat-mode-context.cjs.map +1 -1
- package/dist/provider/session-persistence-context.cjs +10 -0
- package/dist/provider/session-persistence-context.cjs.map +1 -0
- package/dist/provider/session-persistence-context.d.ts +15 -0
- package/dist/provider/session-persistence-context.js +10 -0
- package/dist/provider/session-persistence-context.js.map +1 -0
- package/dist/provider/statewire-history-context.cjs +4 -4
- package/dist/provider/statewire-history-context.cjs.map +1 -1
- package/dist/provider/statewire-lifecycle-context.cjs +3 -3
- package/dist/provider/statewire-lifecycle-context.cjs.map +1 -1
- package/dist/provider/statewire-window-context.cjs +3 -3
- package/dist/provider/statewire-window-context.cjs.map +1 -1
- package/dist/provider/theme-style-context.cjs +3 -3
- package/dist/provider/theme-style-context.cjs.map +1 -1
- package/dist/react/package.json.cjs +1 -1
- package/dist/react/package.json.js +1 -1
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs +10 -10
- package/dist/runtime/StatewireThreadConfigLaneSync.cjs.map +1 -1
- package/dist/runtime/auth-refusal-restart.cjs +7 -7
- package/dist/runtime/auth-refusal-restart.cjs.map +1 -1
- package/dist/runtime/auth.cjs +13 -13
- package/dist/runtime/auth.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.cjs +1 -0
- package/dist/runtime/statewire-lifecycle.cjs.map +1 -1
- package/dist/runtime/statewire-lifecycle.d.ts +3 -1
- package/dist/runtime/statewire-lifecycle.js +2 -1
- package/dist/runtime/statewire-lifecycle.js.map +1 -1
- package/dist/runtime/statewire-server-lane-context.cjs +2 -2
- package/dist/runtime/statewire-server-lane-context.cjs.map +1 -1
- package/dist/runtime/statewire-session-lane.cjs +4 -4
- package/dist/runtime/statewire-session-lane.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.cjs +10 -8
- package/dist/runtime/useAthenaStatewireRuntime.cjs.map +1 -1
- package/dist/runtime/useAthenaStatewireRuntime.d.ts +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.js +2 -0
- package/dist/runtime/useAthenaStatewireRuntime.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/threads/Inbox.cjs +8 -8
- package/dist/threads/Inbox.cjs.map +1 -1
- package/dist/threads/SessionList.cjs +9 -9
- package/dist/threads/SessionList.cjs.map +1 -1
- package/dist/threads/SessionsPage.cjs +11 -11
- package/dist/threads/SessionsPage.cjs.map +1 -1
- package/dist/threads/index-triggered-refresh.cjs +10 -10
- package/dist/threads/index-triggered-refresh.cjs.map +1 -1
- package/dist/threads/mark-viewed-thread-read.cjs +12 -12
- package/dist/threads/mark-viewed-thread-read.cjs.map +1 -1
- package/dist/threads/offline-session-list.cjs +3 -3
- package/dist/threads/offline-session-list.cjs.map +1 -1
- package/dist/threads/session-list-tab-share.cjs +5 -5
- package/dist/threads/session-list-tab-share.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.cjs +51 -51
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/thread-id-context.cjs +5 -5
- package/dist/threads/thread-id-context.cjs.map +1 -1
- package/dist/threads/use-athena-session-attention.cjs +2 -2
- package/dist/threads/use-athena-session-attention.cjs.map +1 -1
- package/dist/threads/use-athena-sessions.cjs +10 -10
- package/dist/threads/use-athena-sessions.cjs.map +1 -1
- package/dist/threads/use-athena-thread-model.cjs +3 -3
- package/dist/threads/use-athena-thread-model.cjs.map +1 -1
- package/dist/threads/use-rest-conversation-history.cjs +3 -3
- package/dist/threads/use-rest-conversation-history.cjs.map +1 -1
- package/dist/threads/use-statewire-conversation-history.cjs +8 -8
- package/dist/threads/use-statewire-conversation-history.cjs.map +1 -1
- package/dist/threads/use-thread-archive.cjs +9 -9
- package/dist/threads/use-thread-archive.cjs.map +1 -1
- package/dist/threads/use-thread-favorite.cjs +2 -2
- package/dist/threads/use-thread-favorite.cjs.map +1 -1
- package/dist/threads/use-thread-field-override.cjs +20 -20
- package/dist/threads/use-thread-field-override.cjs.map +1 -1
- package/dist/threads/use-thread-read-state.cjs +4 -4
- package/dist/threads/use-thread-read-state.cjs.map +1 -1
- package/dist/threads/use-thread-rename.cjs +2 -2
- package/dist/threads/use-thread-rename.cjs.map +1 -1
- package/dist/threads/useAthenaThreadManager.cjs +2 -2
- package/dist/threads/useAthenaThreadManager.cjs.map +1 -1
- package/dist/tools/NestedPtcMessages.cjs +6 -6
- package/dist/tools/NestedPtcMessages.cjs.map +1 -1
- package/dist/tools/append-document-tool-ui.cjs +7 -7
- package/dist/tools/append-document-tool-ui.cjs.map +1 -1
- package/dist/tools/file-tool-uis.cjs +2 -2
- package/dist/tools/file-tool-uis.cjs.map +1 -1
- package/dist/tools/misc-tool-uis.cjs +2 -2
- package/dist/tools/misc-tool-uis.cjs.map +1 -1
- package/dist/tools/primitives.cjs +6 -6
- package/dist/tools/primitives.cjs.map +1 -1
- package/dist/tools/read-asset-tool-ui.cjs +6 -6
- package/dist/tools/read-asset-tool-ui.cjs.map +1 -1
- package/dist/tools/subagent-task-tool-ui.cjs +21 -21
- package/dist/tools/subagent-task-tool-ui.cjs.map +1 -1
- package/dist/tools/test-recording-tool-uis.cjs +16 -16
- package/dist/tools/test-recording-tool-uis.cjs.map +1 -1
- package/dist/tools/todo-plan-store.cjs +4 -4
- package/dist/tools/todo-plan-store.cjs.map +1 -1
- package/dist/tools/tool-appearance.cjs +3 -3
- package/dist/tools/tool-appearance.cjs.map +1 -1
- package/dist/tools/tool-fallback.cjs +14 -14
- package/dist/tools/tool-fallback.cjs.map +1 -1
- package/dist/tools/tool-uis.cjs +74 -74
- package/dist/tools/tool-uis.cjs.map +1 -1
- package/dist/tools/use-elapsed-seconds.cjs +3 -3
- package/dist/tools/use-elapsed-seconds.cjs.map +1 -1
- package/dist/tools/write-todos-tool-ui.cjs +9 -9
- package/dist/tools/write-todos-tool-ui.cjs.map +1 -1
- package/dist/ui/image-viewer.cjs +382 -0
- package/dist/ui/image-viewer.cjs.map +1 -0
- package/dist/ui/image-viewer.d.ts +50 -0
- package/dist/ui/image-viewer.js +382 -0
- package/dist/ui/image-viewer.js.map +1 -0
- package/dist/voice/chat.cjs +6 -0
- package/dist/voice/chat.cjs.map +1 -1
- package/dist/voice/chat.d.ts +1 -1
- package/dist/voice/chat.js +8 -2
- package/dist/voice/livekit-join.cjs +52 -101
- package/dist/voice/livekit-join.cjs.map +1 -1
- package/dist/voice/livekit-join.d.ts +1 -6
- package/dist/voice/livekit-join.js +52 -101
- package/dist/voice/livekit-join.js.map +1 -1
- package/dist/voice/livekit.cjs.map +1 -1
- package/dist/voice/livekit.d.ts +11 -1
- package/dist/voice/livekit.js.map +1 -1
- package/dist/voice/use-athena-voice-session.cjs +34 -34
- package/dist/voice/use-athena-voice-session.cjs.map +1 -1
- package/dist/workbench/ComputerLiveDesktop.cjs +13 -13
- package/dist/workbench/ComputerLiveDesktop.cjs.map +1 -1
- package/dist/workbench/SessionWorkbench.cjs +22 -22
- package/dist/workbench/SessionWorkbench.cjs.map +1 -1
- package/dist/workbench/session-workbench-context.cjs +3 -3
- package/dist/workbench/session-workbench-context.cjs.map +1 -1
- package/dist/workbench/session-workbench-panes.cjs +8 -8
- package/dist/workbench/session-workbench-panes.cjs.map +1 -1
- package/dist/workbench/workbench-layout-context.cjs +3 -3
- package/dist/workbench/workbench-layout-context.cjs.map +1 -1
- package/package.json +2 -1
|
@@ -1,119 +1,70 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const voiceMedia = require("../agent-runtime/src/voice-media.cjs");
|
|
3
4
|
const livekitClient = require("livekit-client");
|
|
4
|
-
const MICROPHONE_CAPTURE = {
|
|
5
|
-
echoCancellation: true,
|
|
6
|
-
noiseSuppression: true,
|
|
7
|
-
autoGainControl: true
|
|
8
|
-
};
|
|
9
|
-
const disconnectReasonLabel = (reason) => {
|
|
10
|
-
if (reason === void 0) return "room-disconnected";
|
|
11
|
-
const name = livekitClient.DisconnectReason[reason];
|
|
12
|
-
return `room-disconnected:${(name ?? String(reason)).toLowerCase()}`;
|
|
13
|
-
};
|
|
14
5
|
const defaultRoomFactory = () => new livekitClient.Room({
|
|
15
6
|
adaptiveStream: false,
|
|
16
7
|
dynacast: false,
|
|
17
|
-
audioCaptureDefaults:
|
|
8
|
+
audioCaptureDefaults: voiceMedia.VOICE_MICROPHONE_CAPTURE,
|
|
18
9
|
publishDefaults: { stopMicTrackOnMute: true }
|
|
19
10
|
});
|
|
20
|
-
|
|
11
|
+
function joinDeepAgentVoiceRoom({
|
|
21
12
|
answer,
|
|
22
13
|
handlers,
|
|
23
14
|
audioElement,
|
|
24
15
|
roomFactory = defaultRoomFactory
|
|
25
16
|
}) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
closed = true;
|
|
41
|
-
signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
42
|
-
for (const track of attached) {
|
|
43
|
-
try {
|
|
44
|
-
track.detach();
|
|
45
|
-
} catch {
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
attached.clear();
|
|
49
|
-
disconnecting ?? (disconnecting = room.disconnect().then(() => void 0));
|
|
50
|
-
return disconnecting;
|
|
51
|
-
};
|
|
52
|
-
const onAbort = () => {
|
|
53
|
-
rejectEnded(endedError());
|
|
54
|
-
void closeRoom().catch(() => void 0);
|
|
55
|
-
};
|
|
56
|
-
signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
57
|
-
if (signal == null ? void 0 : signal.aborted) onAbort();
|
|
58
|
-
room.on(livekitClient.RoomEvent.TrackSubscribed, (track) => {
|
|
59
|
-
if (closed || track.kind !== livekitClient.Track.Kind.Audio) return;
|
|
60
|
-
track.attach(audioElement() ?? void 0);
|
|
61
|
-
attached.add(track);
|
|
62
|
-
});
|
|
63
|
-
room.on(livekitClient.RoomEvent.TrackUnsubscribed, (track) => {
|
|
64
|
-
if (track.kind !== livekitClient.Track.Kind.Audio) return;
|
|
65
|
-
if (attached.delete(track)) track.detach();
|
|
66
|
-
});
|
|
67
|
-
room.on(livekitClient.RoomEvent.Disconnected, (reason) => {
|
|
68
|
-
if (closed) return;
|
|
69
|
-
if (!connected && reason === livekitClient.DisconnectReason.JOIN_FAILURE) return;
|
|
70
|
-
const label = disconnectReasonLabel(reason);
|
|
71
|
-
rejectEnded(new Error(label));
|
|
72
|
-
void closeRoom().catch(() => void 0);
|
|
73
|
-
if (joined) handlers.onDisconnected(label);
|
|
74
|
-
});
|
|
75
|
-
const checkOpen = () => {
|
|
76
|
-
if (closed) throw endedError();
|
|
77
|
-
};
|
|
78
|
-
const joining = (async () => {
|
|
79
|
-
try {
|
|
80
|
-
checkOpen();
|
|
81
|
-
await room.connect(answer.serverUrl, answer.token);
|
|
82
|
-
connected = true;
|
|
83
|
-
checkOpen();
|
|
84
|
-
await room.localParticipant.setMicrophoneEnabled(
|
|
85
|
-
!handlers.micMuted,
|
|
86
|
-
MICROPHONE_CAPTURE
|
|
87
|
-
);
|
|
88
|
-
checkOpen();
|
|
89
|
-
} catch (error) {
|
|
90
|
-
const alreadyClosed = closed;
|
|
91
|
-
await closeRoom().catch(() => void 0);
|
|
92
|
-
if (alreadyClosed) await room.disconnect().catch(() => void 0);
|
|
93
|
-
throw error;
|
|
94
|
-
}
|
|
95
|
-
})();
|
|
96
|
-
await Promise.race([joining, ended]);
|
|
97
|
-
checkOpen();
|
|
98
|
-
joined = true;
|
|
99
|
-
return {
|
|
100
|
-
setMicrophoneEnabled: (enabled) => {
|
|
101
|
-
const changing = (async () => {
|
|
102
|
-
checkOpen();
|
|
103
|
-
try {
|
|
104
|
-
await room.localParticipant.setMicrophoneEnabled(enabled);
|
|
105
|
-
checkOpen();
|
|
106
|
-
} finally {
|
|
107
|
-
if (closed) await room.disconnect().catch(() => void 0);
|
|
17
|
+
return voiceMedia.connectVoiceMedia({
|
|
18
|
+
handlers,
|
|
19
|
+
createDriver: () => {
|
|
20
|
+
const room = roomFactory();
|
|
21
|
+
let closed = false;
|
|
22
|
+
const attached = /* @__PURE__ */ new Set();
|
|
23
|
+
room.on(livekitClient.RoomEvent.TrackSubscribed, (track, publication, participant) => {
|
|
24
|
+
if (closed || track.kind !== livekitClient.Track.Kind.Audio) return;
|
|
25
|
+
if (participant !== void 0 && voiceMedia.isOwnOtherVoiceDevice({
|
|
26
|
+
identity: participant.identity,
|
|
27
|
+
localIdentity: room.localParticipant.identity
|
|
28
|
+
})) {
|
|
29
|
+
publication == null ? void 0 : publication.setSubscribed(false);
|
|
30
|
+
return;
|
|
108
31
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
32
|
+
track.attach(audioElement() ?? void 0);
|
|
33
|
+
attached.add(track);
|
|
34
|
+
});
|
|
35
|
+
room.on(livekitClient.RoomEvent.TrackUnsubscribed, (track) => {
|
|
36
|
+
if (track.kind !== livekitClient.Track.Kind.Audio) return;
|
|
37
|
+
if (attached.delete(track)) track.detach();
|
|
38
|
+
});
|
|
39
|
+
return {
|
|
40
|
+
connect: () => room.connect(answer.serverUrl, answer.token),
|
|
41
|
+
setMicrophoneEnabled: ({ enabled, initial }) => room.localParticipant.setMicrophoneEnabled(
|
|
42
|
+
enabled,
|
|
43
|
+
initial ? voiceMedia.VOICE_MICROPHONE_CAPTURE : void 0
|
|
44
|
+
),
|
|
45
|
+
disconnect: () => {
|
|
46
|
+
closed = true;
|
|
47
|
+
for (const track of attached) {
|
|
48
|
+
try {
|
|
49
|
+
track.detach();
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
attached.clear();
|
|
54
|
+
return room.disconnect();
|
|
55
|
+
},
|
|
56
|
+
onDisconnected: (listener) => {
|
|
57
|
+
room.on(livekitClient.RoomEvent.Disconnected, (reason) => {
|
|
58
|
+
const name = reason === void 0 ? void 0 : livekitClient.DisconnectReason[reason];
|
|
59
|
+
listener({
|
|
60
|
+
reason: reason === void 0 ? "room-disconnected" : `room-disconnected:${(name ?? String(reason)).toLowerCase()}`,
|
|
61
|
+
joinFailure: reason === livekitClient.DisconnectReason.JOIN_FAILURE
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
};
|
|
115
66
|
}
|
|
116
|
-
};
|
|
67
|
+
});
|
|
117
68
|
}
|
|
118
69
|
exports.joinDeepAgentVoiceRoom = joinDeepAgentVoiceRoom;
|
|
119
70
|
//# sourceMappingURL=livekit-join.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"livekit-join.cjs","sources":["../../src/voice/livekit-join.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"livekit-join.cjs","sources":["../../src/voice/livekit-join.ts"],"sourcesContent":["import {\n connectVoiceMedia,\n isOwnOtherVoiceDevice,\n VOICE_MICROPHONE_CAPTURE,\n} from '@athenaintel/agent-runtime/voice-media';\nimport { DisconnectReason, Room, RoomEvent, Track } from 'livekit-client';\nimport type {\n DeepAgentVoiceLiveKitSession,\n DeepAgentVoiceLiveKitRoom,\n DeepAgentVoiceLiveKitRemoteTrack,\n JoinDeepAgentVoiceRoomOptions,\n} from './livekit';\n\n// One remote audio track: adaptive stream and dynacast are video levers.\nconst defaultRoomFactory = (): DeepAgentVoiceLiveKitRoom =>\n new Room({\n adaptiveStream: false,\n dynacast: false,\n audioCaptureDefaults: VOICE_MICROPHONE_CAPTURE,\n publishDefaults: { stopMicTrackOnMute: true },\n });\n\n/** Browser audio sinks around the same media lifecycle used by native chat. */\nexport function joinDeepAgentVoiceRoom({\n answer,\n handlers,\n audioElement,\n roomFactory = defaultRoomFactory,\n}: JoinDeepAgentVoiceRoomOptions): Promise<DeepAgentVoiceLiveKitSession> {\n return connectVoiceMedia({\n handlers,\n createDriver: () => {\n const room = roomFactory();\n let closed = false;\n const attached = new Set<DeepAgentVoiceLiveKitRemoteTrack>();\n room.on(RoomEvent.TrackSubscribed, (track, publication, participant) => {\n if (closed || track.kind !== Track.Kind.Audio) return;\n // While a call moves here (or away), the person's other device is in\n // the room too. Its microphone must not reach the one sink: attaching\n // it would replace the agent's audio, and its departure would leave\n // this device silent for the rest of the call.\n if (\n participant !== undefined &&\n isOwnOtherVoiceDevice({\n identity: participant.identity,\n localIdentity: room.localParticipant.identity,\n })\n ) {\n publication?.setSubscribed(false);\n return;\n }\n track.attach(audioElement() ?? undefined);\n attached.add(track);\n });\n room.on(RoomEvent.TrackUnsubscribed, (track) => {\n if (track.kind !== Track.Kind.Audio) return;\n if (attached.delete(track)) track.detach();\n });\n return {\n connect: () => room.connect(answer.serverUrl, answer.token),\n setMicrophoneEnabled: ({ enabled, initial }) =>\n room.localParticipant.setMicrophoneEnabled(\n enabled,\n initial ? VOICE_MICROPHONE_CAPTURE : undefined\n ),\n disconnect: () => {\n closed = true;\n for (const track of attached) {\n try {\n track.detach();\n } catch {\n /* Release every remaining sink too. */\n }\n }\n attached.clear();\n return room.disconnect();\n },\n onDisconnected: (listener) => {\n room.on(RoomEvent.Disconnected, (reason) => {\n const name: string | undefined =\n reason === undefined ? undefined : DisconnectReason[reason];\n listener({\n reason:\n reason === undefined\n ? 'room-disconnected'\n : `room-disconnected:${(\n name ?? String(reason)\n ).toLowerCase()}`,\n joinFailure: reason === DisconnectReason.JOIN_FAILURE,\n });\n });\n },\n };\n },\n });\n}\n"],"names":["Room","VOICE_MICROPHONE_CAPTURE","connectVoiceMedia","RoomEvent","Track","isOwnOtherVoiceDevice","DisconnectReason"],"mappings":";;;;AAcA,MAAM,qBAAqB,MACzB,IAAIA,mBAAK;AAAA,EACP,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,sBAAsBC,WAAAA;AAAAA,EACtB,iBAAiB,EAAE,oBAAoB,KAAA;AACzC,CAAC;AAGI,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAAyE;AACvE,SAAOC,6BAAkB;AAAA,IACvB;AAAA,IACA,cAAc,MAAM;AAClB,YAAM,OAAO,YAAA;AACb,UAAI,SAAS;AACb,YAAM,+BAAe,IAAA;AACrB,WAAK,GAAGC,wBAAU,iBAAiB,CAAC,OAAO,aAAa,gBAAgB;AACtE,YAAI,UAAU,MAAM,SAASC,cAAAA,MAAM,KAAK,MAAO;AAK/C,YACE,gBAAgB,UAChBC,iCAAsB;AAAA,UACpB,UAAU,YAAY;AAAA,UACtB,eAAe,KAAK,iBAAiB;AAAA,QAAA,CACtC,GACD;AACA,qDAAa,cAAc;AAC3B;AAAA,QACF;AACA,cAAM,OAAO,aAAA,KAAkB,MAAS;AACxC,iBAAS,IAAI,KAAK;AAAA,MACpB,CAAC;AACD,WAAK,GAAGF,cAAAA,UAAU,mBAAmB,CAAC,UAAU;AAC9C,YAAI,MAAM,SAASC,oBAAM,KAAK,MAAO;AACrC,YAAI,SAAS,OAAO,KAAK,SAAS,OAAA;AAAA,MACpC,CAAC;AACD,aAAO;AAAA,QACL,SAAS,MAAM,KAAK,QAAQ,OAAO,WAAW,OAAO,KAAK;AAAA,QAC1D,sBAAsB,CAAC,EAAE,SAAS,QAAA,MAChC,KAAK,iBAAiB;AAAA,UACpB;AAAA,UACA,UAAUH,WAAAA,2BAA2B;AAAA,QAAA;AAAA,QAEzC,YAAY,MAAM;AAChB,mBAAS;AACT,qBAAW,SAAS,UAAU;AAC5B,gBAAI;AACF,oBAAM,OAAA;AAAA,YACR,QAAQ;AAAA,YAER;AAAA,UACF;AACA,mBAAS,MAAA;AACT,iBAAO,KAAK,WAAA;AAAA,QACd;AAAA,QACA,gBAAgB,CAAC,aAAa;AAC5B,eAAK,GAAGE,cAAAA,UAAU,cAAc,CAAC,WAAW;AAC1C,kBAAM,OACJ,WAAW,SAAY,SAAYG,cAAAA,iBAAiB,MAAM;AAC5D,qBAAS;AAAA,cACP,QACE,WAAW,SACP,sBACA,sBACE,QAAQ,OAAO,MAAM,GACrB,YAAA,CAAa;AAAA,cACrB,aAAa,WAAWA,+BAAiB;AAAA,YAAA,CAC1C;AAAA,UACH,CAAC;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA,CACD;AACH;;"}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
1
|
import type { DeepAgentVoiceLiveKitSession, JoinDeepAgentVoiceRoomOptions } from './livekit';
|
|
2
|
-
/**
|
|
3
|
-
* The LiveKit half of the composer's voice adapter (`livekit.ts`),
|
|
4
|
-
* loaded when a session joins its room: join the room the host minted, publish
|
|
5
|
-
* the microphone, play the agent's track, and report a drop. Everything that
|
|
6
|
-
* needs `livekit-client` at runtime lives here, behind that one import.
|
|
7
|
-
*/
|
|
2
|
+
/** Browser audio sinks around the same media lifecycle used by native chat. */
|
|
8
3
|
export declare function joinDeepAgentVoiceRoom({ answer, handlers, audioElement, roomFactory, }: JoinDeepAgentVoiceRoomOptions): Promise<DeepAgentVoiceLiveKitSession>;
|
|
@@ -1,117 +1,68 @@
|
|
|
1
|
+
import { connectVoiceMedia, VOICE_MICROPHONE_CAPTURE, isOwnOtherVoiceDevice } from "../agent-runtime/src/voice-media.js";
|
|
1
2
|
import { Room, RoomEvent, Track, DisconnectReason } from "livekit-client";
|
|
2
|
-
const MICROPHONE_CAPTURE = {
|
|
3
|
-
echoCancellation: true,
|
|
4
|
-
noiseSuppression: true,
|
|
5
|
-
autoGainControl: true
|
|
6
|
-
};
|
|
7
|
-
const disconnectReasonLabel = (reason) => {
|
|
8
|
-
if (reason === void 0) return "room-disconnected";
|
|
9
|
-
const name = DisconnectReason[reason];
|
|
10
|
-
return `room-disconnected:${(name ?? String(reason)).toLowerCase()}`;
|
|
11
|
-
};
|
|
12
3
|
const defaultRoomFactory = () => new Room({
|
|
13
4
|
adaptiveStream: false,
|
|
14
5
|
dynacast: false,
|
|
15
|
-
audioCaptureDefaults:
|
|
6
|
+
audioCaptureDefaults: VOICE_MICROPHONE_CAPTURE,
|
|
16
7
|
publishDefaults: { stopMicTrackOnMute: true }
|
|
17
8
|
});
|
|
18
|
-
|
|
9
|
+
function joinDeepAgentVoiceRoom({
|
|
19
10
|
answer,
|
|
20
11
|
handlers,
|
|
21
12
|
audioElement,
|
|
22
13
|
roomFactory = defaultRoomFactory
|
|
23
14
|
}) {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
closed = true;
|
|
39
|
-
signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
40
|
-
for (const track of attached) {
|
|
41
|
-
try {
|
|
42
|
-
track.detach();
|
|
43
|
-
} catch {
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
attached.clear();
|
|
47
|
-
disconnecting ?? (disconnecting = room.disconnect().then(() => void 0));
|
|
48
|
-
return disconnecting;
|
|
49
|
-
};
|
|
50
|
-
const onAbort = () => {
|
|
51
|
-
rejectEnded(endedError());
|
|
52
|
-
void closeRoom().catch(() => void 0);
|
|
53
|
-
};
|
|
54
|
-
signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
55
|
-
if (signal == null ? void 0 : signal.aborted) onAbort();
|
|
56
|
-
room.on(RoomEvent.TrackSubscribed, (track) => {
|
|
57
|
-
if (closed || track.kind !== Track.Kind.Audio) return;
|
|
58
|
-
track.attach(audioElement() ?? void 0);
|
|
59
|
-
attached.add(track);
|
|
60
|
-
});
|
|
61
|
-
room.on(RoomEvent.TrackUnsubscribed, (track) => {
|
|
62
|
-
if (track.kind !== Track.Kind.Audio) return;
|
|
63
|
-
if (attached.delete(track)) track.detach();
|
|
64
|
-
});
|
|
65
|
-
room.on(RoomEvent.Disconnected, (reason) => {
|
|
66
|
-
if (closed) return;
|
|
67
|
-
if (!connected && reason === DisconnectReason.JOIN_FAILURE) return;
|
|
68
|
-
const label = disconnectReasonLabel(reason);
|
|
69
|
-
rejectEnded(new Error(label));
|
|
70
|
-
void closeRoom().catch(() => void 0);
|
|
71
|
-
if (joined) handlers.onDisconnected(label);
|
|
72
|
-
});
|
|
73
|
-
const checkOpen = () => {
|
|
74
|
-
if (closed) throw endedError();
|
|
75
|
-
};
|
|
76
|
-
const joining = (async () => {
|
|
77
|
-
try {
|
|
78
|
-
checkOpen();
|
|
79
|
-
await room.connect(answer.serverUrl, answer.token);
|
|
80
|
-
connected = true;
|
|
81
|
-
checkOpen();
|
|
82
|
-
await room.localParticipant.setMicrophoneEnabled(
|
|
83
|
-
!handlers.micMuted,
|
|
84
|
-
MICROPHONE_CAPTURE
|
|
85
|
-
);
|
|
86
|
-
checkOpen();
|
|
87
|
-
} catch (error) {
|
|
88
|
-
const alreadyClosed = closed;
|
|
89
|
-
await closeRoom().catch(() => void 0);
|
|
90
|
-
if (alreadyClosed) await room.disconnect().catch(() => void 0);
|
|
91
|
-
throw error;
|
|
92
|
-
}
|
|
93
|
-
})();
|
|
94
|
-
await Promise.race([joining, ended]);
|
|
95
|
-
checkOpen();
|
|
96
|
-
joined = true;
|
|
97
|
-
return {
|
|
98
|
-
setMicrophoneEnabled: (enabled) => {
|
|
99
|
-
const changing = (async () => {
|
|
100
|
-
checkOpen();
|
|
101
|
-
try {
|
|
102
|
-
await room.localParticipant.setMicrophoneEnabled(enabled);
|
|
103
|
-
checkOpen();
|
|
104
|
-
} finally {
|
|
105
|
-
if (closed) await room.disconnect().catch(() => void 0);
|
|
15
|
+
return connectVoiceMedia({
|
|
16
|
+
handlers,
|
|
17
|
+
createDriver: () => {
|
|
18
|
+
const room = roomFactory();
|
|
19
|
+
let closed = false;
|
|
20
|
+
const attached = /* @__PURE__ */ new Set();
|
|
21
|
+
room.on(RoomEvent.TrackSubscribed, (track, publication, participant) => {
|
|
22
|
+
if (closed || track.kind !== Track.Kind.Audio) return;
|
|
23
|
+
if (participant !== void 0 && isOwnOtherVoiceDevice({
|
|
24
|
+
identity: participant.identity,
|
|
25
|
+
localIdentity: room.localParticipant.identity
|
|
26
|
+
})) {
|
|
27
|
+
publication == null ? void 0 : publication.setSubscribed(false);
|
|
28
|
+
return;
|
|
106
29
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
30
|
+
track.attach(audioElement() ?? void 0);
|
|
31
|
+
attached.add(track);
|
|
32
|
+
});
|
|
33
|
+
room.on(RoomEvent.TrackUnsubscribed, (track) => {
|
|
34
|
+
if (track.kind !== Track.Kind.Audio) return;
|
|
35
|
+
if (attached.delete(track)) track.detach();
|
|
36
|
+
});
|
|
37
|
+
return {
|
|
38
|
+
connect: () => room.connect(answer.serverUrl, answer.token),
|
|
39
|
+
setMicrophoneEnabled: ({ enabled, initial }) => room.localParticipant.setMicrophoneEnabled(
|
|
40
|
+
enabled,
|
|
41
|
+
initial ? VOICE_MICROPHONE_CAPTURE : void 0
|
|
42
|
+
),
|
|
43
|
+
disconnect: () => {
|
|
44
|
+
closed = true;
|
|
45
|
+
for (const track of attached) {
|
|
46
|
+
try {
|
|
47
|
+
track.detach();
|
|
48
|
+
} catch {
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
attached.clear();
|
|
52
|
+
return room.disconnect();
|
|
53
|
+
},
|
|
54
|
+
onDisconnected: (listener) => {
|
|
55
|
+
room.on(RoomEvent.Disconnected, (reason) => {
|
|
56
|
+
const name = reason === void 0 ? void 0 : DisconnectReason[reason];
|
|
57
|
+
listener({
|
|
58
|
+
reason: reason === void 0 ? "room-disconnected" : `room-disconnected:${(name ?? String(reason)).toLowerCase()}`,
|
|
59
|
+
joinFailure: reason === DisconnectReason.JOIN_FAILURE
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
};
|
|
113
64
|
}
|
|
114
|
-
};
|
|
65
|
+
});
|
|
115
66
|
}
|
|
116
67
|
export {
|
|
117
68
|
joinDeepAgentVoiceRoom
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"livekit-join.js","sources":["../../src/voice/livekit-join.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"livekit-join.js","sources":["../../src/voice/livekit-join.ts"],"sourcesContent":["import {\n connectVoiceMedia,\n isOwnOtherVoiceDevice,\n VOICE_MICROPHONE_CAPTURE,\n} from '@athenaintel/agent-runtime/voice-media';\nimport { DisconnectReason, Room, RoomEvent, Track } from 'livekit-client';\nimport type {\n DeepAgentVoiceLiveKitSession,\n DeepAgentVoiceLiveKitRoom,\n DeepAgentVoiceLiveKitRemoteTrack,\n JoinDeepAgentVoiceRoomOptions,\n} from './livekit';\n\n// One remote audio track: adaptive stream and dynacast are video levers.\nconst defaultRoomFactory = (): DeepAgentVoiceLiveKitRoom =>\n new Room({\n adaptiveStream: false,\n dynacast: false,\n audioCaptureDefaults: VOICE_MICROPHONE_CAPTURE,\n publishDefaults: { stopMicTrackOnMute: true },\n });\n\n/** Browser audio sinks around the same media lifecycle used by native chat. */\nexport function joinDeepAgentVoiceRoom({\n answer,\n handlers,\n audioElement,\n roomFactory = defaultRoomFactory,\n}: JoinDeepAgentVoiceRoomOptions): Promise<DeepAgentVoiceLiveKitSession> {\n return connectVoiceMedia({\n handlers,\n createDriver: () => {\n const room = roomFactory();\n let closed = false;\n const attached = new Set<DeepAgentVoiceLiveKitRemoteTrack>();\n room.on(RoomEvent.TrackSubscribed, (track, publication, participant) => {\n if (closed || track.kind !== Track.Kind.Audio) return;\n // While a call moves here (or away), the person's other device is in\n // the room too. Its microphone must not reach the one sink: attaching\n // it would replace the agent's audio, and its departure would leave\n // this device silent for the rest of the call.\n if (\n participant !== undefined &&\n isOwnOtherVoiceDevice({\n identity: participant.identity,\n localIdentity: room.localParticipant.identity,\n })\n ) {\n publication?.setSubscribed(false);\n return;\n }\n track.attach(audioElement() ?? undefined);\n attached.add(track);\n });\n room.on(RoomEvent.TrackUnsubscribed, (track) => {\n if (track.kind !== Track.Kind.Audio) return;\n if (attached.delete(track)) track.detach();\n });\n return {\n connect: () => room.connect(answer.serverUrl, answer.token),\n setMicrophoneEnabled: ({ enabled, initial }) =>\n room.localParticipant.setMicrophoneEnabled(\n enabled,\n initial ? VOICE_MICROPHONE_CAPTURE : undefined\n ),\n disconnect: () => {\n closed = true;\n for (const track of attached) {\n try {\n track.detach();\n } catch {\n /* Release every remaining sink too. */\n }\n }\n attached.clear();\n return room.disconnect();\n },\n onDisconnected: (listener) => {\n room.on(RoomEvent.Disconnected, (reason) => {\n const name: string | undefined =\n reason === undefined ? undefined : DisconnectReason[reason];\n listener({\n reason:\n reason === undefined\n ? 'room-disconnected'\n : `room-disconnected:${(\n name ?? String(reason)\n ).toLowerCase()}`,\n joinFailure: reason === DisconnectReason.JOIN_FAILURE,\n });\n });\n },\n };\n },\n });\n}\n"],"names":[],"mappings":";;AAcA,MAAM,qBAAqB,MACzB,IAAI,KAAK;AAAA,EACP,gBAAgB;AAAA,EAChB,UAAU;AAAA,EACV,sBAAsB;AAAA,EACtB,iBAAiB,EAAE,oBAAoB,KAAA;AACzC,CAAC;AAGI,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAChB,GAAyE;AACvE,SAAO,kBAAkB;AAAA,IACvB;AAAA,IACA,cAAc,MAAM;AAClB,YAAM,OAAO,YAAA;AACb,UAAI,SAAS;AACb,YAAM,+BAAe,IAAA;AACrB,WAAK,GAAG,UAAU,iBAAiB,CAAC,OAAO,aAAa,gBAAgB;AACtE,YAAI,UAAU,MAAM,SAAS,MAAM,KAAK,MAAO;AAK/C,YACE,gBAAgB,UAChB,sBAAsB;AAAA,UACpB,UAAU,YAAY;AAAA,UACtB,eAAe,KAAK,iBAAiB;AAAA,QAAA,CACtC,GACD;AACA,qDAAa,cAAc;AAC3B;AAAA,QACF;AACA,cAAM,OAAO,aAAA,KAAkB,MAAS;AACxC,iBAAS,IAAI,KAAK;AAAA,MACpB,CAAC;AACD,WAAK,GAAG,UAAU,mBAAmB,CAAC,UAAU;AAC9C,YAAI,MAAM,SAAS,MAAM,KAAK,MAAO;AACrC,YAAI,SAAS,OAAO,KAAK,SAAS,OAAA;AAAA,MACpC,CAAC;AACD,aAAO;AAAA,QACL,SAAS,MAAM,KAAK,QAAQ,OAAO,WAAW,OAAO,KAAK;AAAA,QAC1D,sBAAsB,CAAC,EAAE,SAAS,QAAA,MAChC,KAAK,iBAAiB;AAAA,UACpB;AAAA,UACA,UAAU,2BAA2B;AAAA,QAAA;AAAA,QAEzC,YAAY,MAAM;AAChB,mBAAS;AACT,qBAAW,SAAS,UAAU;AAC5B,gBAAI;AACF,oBAAM,OAAA;AAAA,YACR,QAAQ;AAAA,YAER;AAAA,UACF;AACA,mBAAS,MAAA;AACT,iBAAO,KAAK,WAAA;AAAA,QACd;AAAA,QACA,gBAAgB,CAAC,aAAa;AAC5B,eAAK,GAAG,UAAU,cAAc,CAAC,WAAW;AAC1C,kBAAM,OACJ,WAAW,SAAY,SAAY,iBAAiB,MAAM;AAC5D,qBAAS;AAAA,cACP,QACE,WAAW,SACP,sBACA,sBACE,QAAQ,OAAO,MAAM,GACrB,YAAA,CAAa;AAAA,cACrB,aAAa,WAAW,iBAAiB;AAAA,YAAA,CAC1C;AAAA,UACH,CAAC;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAAA,CACD;AACH;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"livekit.cjs","sources":["../../src/voice/livekit.ts"],"sourcesContent":["/** Media credentials already authorized and issued by the chat host. */\nexport interface DeepAgentVoiceLiveKitCredentials {\n serverUrl: string;\n token: string;\n}\n\n/** The media controls the shared chat voice lifecycle drives. */\nexport interface DeepAgentVoiceLiveKitSession {\n setMicrophoneEnabled(enabled: boolean): Promise<void>;\n disconnect(): Promise<void>;\n}\n\n/** Lifecycle controls supplied by the owning chat voice attempt. */\nexport interface DeepAgentVoiceLiveKitHandlers {\n micMuted: boolean;\n /** Ends pending and joined media with the owning chat voice attempt. */\n signal?: AbortSignal;\n onDisconnected: (reason: string) => void;\n}\n\n/** Structural media boundary; compatible with the shared agent runtime. */\nexport interface DeepAgentVoiceLiveKitAdapter {\n connect(\n answer: DeepAgentVoiceLiveKitCredentials,\n handlers: DeepAgentVoiceLiveKitHandlers,\n ): Promise<DeepAgentVoiceLiveKitSession>;\n}\n\n/** The remote-track surface the adapter drives (`RemoteTrack`, structurally). */\nexport interface DeepAgentVoiceLiveKitRemoteTrack {\n readonly kind: 'audio' | 'video' | 'unknown';\n /** Without an element LiveKit creates a detached, autoplaying one. */\n attach(element?: HTMLMediaElement): HTMLMediaElement;\n detach(): HTMLMediaElement[];\n}\n\n/**\n * The slice of `livekit-client`'s `Room` the adapter drives — a real `Room`\n * satisfies it; tests inject a fake through `roomFactory`.\n */\nexport interface DeepAgentVoiceLiveKitRoom {\n readonly localParticipant: {\n setMicrophoneEnabled(\n enabled: boolean,\n options?: {\n echoCancellation?: boolean;\n noiseSuppression?: boolean;\n autoGainControl?: boolean;\n },\n ): Promise<unknown>;\n };\n connect(url: string, token: string): Promise<void>;\n disconnect(): Promise<unknown>;\n on(\n event: 'trackSubscribed',\n listener: (track: DeepAgentVoiceLiveKitRemoteTrack) => void,\n ): unknown;\n on(\n event: 'trackUnsubscribed',\n listener: (track: DeepAgentVoiceLiveKitRemoteTrack) => void,\n ): unknown;\n on(event: 'disconnected', listener: (reason?: number) => void): unknown;\n}\n\nexport interface CreateDeepAgentVoiceLiveKitAdapterOptions {\n /**\n * The `<audio>` sink for the agent participant's track, read when the track\n * arrives; `null` lets LiveKit play through an element of its own.\n */\n audioElement: () => HTMLAudioElement | null;\n /** Test seam; defaults to a fresh `livekit-client` `Room`. */\n roomFactory?: () => DeepAgentVoiceLiveKitRoom;\n}\n\ntype DeepAgentVoiceLiveKitJoin = typeof import('./livekit-join');\n\nlet joinModuleLoad: Promise<DeepAgentVoiceLiveKitJoin> | null = null;\n\n/**\n * The room join and `livekit-client` (~120 KB gzip) are fetched when a voice\n * session starts, not with the composer: every Spaces boot mounts the\n * composer, few start a voice session. One `import()` keeps LiveKit in one\n * lazy chunk group. A failed import is not memoized: the next session imports\n * again.\n */\nexport const loadDeepAgentVoiceLiveKitJoin =\n (): Promise<DeepAgentVoiceLiveKitJoin> => {\n joinModuleLoad ??= import('./livekit-join').catch((error: unknown) => {\n joinModuleLoad = null;\n throw error;\n });\n return joinModuleLoad;\n };\n\n/**\n * The composer's LiveKit leg for the shared voice session\n * (`useDeepAgentVoice({ transport: 'livekit' })`): join the room the host\n * minted, publish the microphone, play the agent's track, and report a drop\n * (`joinDeepAgentVoiceRoom`, loaded on the first join).\n */\nexport const createDeepAgentVoiceLiveKitAdapter = ({\n audioElement,\n roomFactory,\n}: CreateDeepAgentVoiceLiveKitAdapterOptions): DeepAgentVoiceLiveKitAdapter => ({\n async connect(\n answer: DeepAgentVoiceLiveKitCredentials,\n handlers: DeepAgentVoiceLiveKitHandlers,\n ): Promise<DeepAgentVoiceLiveKitSession> {\n const { joinDeepAgentVoiceRoom } = await loadDeepAgentVoiceLiveKitJoin();\n return joinDeepAgentVoiceRoom({\n answer,\n handlers,\n audioElement,\n roomFactory,\n });\n },\n});\n\n/** Join with an already-authorized room answer without eagerly loading LiveKit. */\nexport async function joinDeepAgentVoiceRoom(\n options: JoinDeepAgentVoiceRoomOptions,\n): Promise<DeepAgentVoiceLiveKitSession> {\n const join = await loadDeepAgentVoiceLiveKitJoin();\n return join.joinDeepAgentVoiceRoom(options);\n}\n\nexport interface JoinDeepAgentVoiceRoomOptions {\n answer: DeepAgentVoiceLiveKitCredentials;\n handlers: DeepAgentVoiceLiveKitHandlers;\n audioElement: () => HTMLAudioElement | null;\n roomFactory?: () => DeepAgentVoiceLiveKitRoom;\n}\n"],"names":["joinDeepAgentVoiceRoom"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"livekit.cjs","sources":["../../src/voice/livekit.ts"],"sourcesContent":["/** Media credentials already authorized and issued by the chat host. */\nexport interface DeepAgentVoiceLiveKitCredentials {\n serverUrl: string;\n token: string;\n}\n\n/** The media controls the shared chat voice lifecycle drives. */\nexport interface DeepAgentVoiceLiveKitSession {\n setMicrophoneEnabled(enabled: boolean): Promise<void>;\n disconnect(): Promise<void>;\n}\n\n/** Lifecycle controls supplied by the owning chat voice attempt. */\nexport interface DeepAgentVoiceLiveKitHandlers {\n micMuted: boolean;\n /** Ends pending and joined media with the owning chat voice attempt. */\n signal?: AbortSignal;\n onDisconnected: (reason: string) => void;\n}\n\n/** Structural media boundary; compatible with the shared agent runtime. */\nexport interface DeepAgentVoiceLiveKitAdapter {\n connect(\n answer: DeepAgentVoiceLiveKitCredentials,\n handlers: DeepAgentVoiceLiveKitHandlers,\n ): Promise<DeepAgentVoiceLiveKitSession>;\n}\n\n/** The remote-track surface the adapter drives (`RemoteTrack`, structurally). */\nexport interface DeepAgentVoiceLiveKitRemoteTrack {\n readonly kind: 'audio' | 'video' | 'unknown';\n /** Without an element LiveKit creates a detached, autoplaying one. */\n attach(element?: HTMLMediaElement): HTMLMediaElement;\n detach(): HTMLMediaElement[];\n}\n\n/** The publication a remote track arrived on (`RemoteTrackPublication`, structurally). */\nexport interface DeepAgentVoiceLiveKitRemotePublication {\n setSubscribed(subscribed: boolean): void;\n}\n\n/** Who published a remote track (`RemoteParticipant`, structurally). */\nexport interface DeepAgentVoiceLiveKitRemoteParticipant {\n readonly identity: string;\n}\n\n/**\n * The slice of `livekit-client`'s `Room` the adapter drives — a real `Room`\n * satisfies it; tests inject a fake through `roomFactory`.\n */\nexport interface DeepAgentVoiceLiveKitRoom {\n readonly localParticipant: {\n /** This device's participant, known once the room is joined. */\n readonly identity?: string;\n setMicrophoneEnabled(\n enabled: boolean,\n options?: {\n echoCancellation?: boolean;\n noiseSuppression?: boolean;\n autoGainControl?: boolean;\n },\n ): Promise<unknown>;\n };\n connect(url: string, token: string): Promise<void>;\n disconnect(): Promise<unknown>;\n on(\n event: 'trackSubscribed',\n listener: (\n track: DeepAgentVoiceLiveKitRemoteTrack,\n publication?: DeepAgentVoiceLiveKitRemotePublication,\n participant?: DeepAgentVoiceLiveKitRemoteParticipant,\n ) => void,\n ): unknown;\n on(\n event: 'trackUnsubscribed',\n listener: (track: DeepAgentVoiceLiveKitRemoteTrack) => void,\n ): unknown;\n on(event: 'disconnected', listener: (reason?: number) => void): unknown;\n}\n\nexport interface CreateDeepAgentVoiceLiveKitAdapterOptions {\n /**\n * The `<audio>` sink for the agent participant's track, read when the track\n * arrives; `null` lets LiveKit play through an element of its own.\n */\n audioElement: () => HTMLAudioElement | null;\n /** Test seam; defaults to a fresh `livekit-client` `Room`. */\n roomFactory?: () => DeepAgentVoiceLiveKitRoom;\n}\n\ntype DeepAgentVoiceLiveKitJoin = typeof import('./livekit-join');\n\nlet joinModuleLoad: Promise<DeepAgentVoiceLiveKitJoin> | null = null;\n\n/**\n * The room join and `livekit-client` (~120 KB gzip) are fetched when a voice\n * session starts, not with the composer: every Spaces boot mounts the\n * composer, few start a voice session. One `import()` keeps LiveKit in one\n * lazy chunk group. A failed import is not memoized: the next session imports\n * again.\n */\nexport const loadDeepAgentVoiceLiveKitJoin =\n (): Promise<DeepAgentVoiceLiveKitJoin> => {\n joinModuleLoad ??= import('./livekit-join').catch((error: unknown) => {\n joinModuleLoad = null;\n throw error;\n });\n return joinModuleLoad;\n };\n\n/**\n * The composer's LiveKit leg for the shared voice session\n * (`useDeepAgentVoice({ transport: 'livekit' })`): join the room the host\n * minted, publish the microphone, play the agent's track, and report a drop\n * (`joinDeepAgentVoiceRoom`, loaded on the first join).\n */\nexport const createDeepAgentVoiceLiveKitAdapter = ({\n audioElement,\n roomFactory,\n}: CreateDeepAgentVoiceLiveKitAdapterOptions): DeepAgentVoiceLiveKitAdapter => ({\n async connect(\n answer: DeepAgentVoiceLiveKitCredentials,\n handlers: DeepAgentVoiceLiveKitHandlers,\n ): Promise<DeepAgentVoiceLiveKitSession> {\n const { joinDeepAgentVoiceRoom } = await loadDeepAgentVoiceLiveKitJoin();\n return joinDeepAgentVoiceRoom({\n answer,\n handlers,\n audioElement,\n roomFactory,\n });\n },\n});\n\n/** Join with an already-authorized room answer without eagerly loading LiveKit. */\nexport async function joinDeepAgentVoiceRoom(\n options: JoinDeepAgentVoiceRoomOptions,\n): Promise<DeepAgentVoiceLiveKitSession> {\n const join = await loadDeepAgentVoiceLiveKitJoin();\n return join.joinDeepAgentVoiceRoom(options);\n}\n\nexport interface JoinDeepAgentVoiceRoomOptions {\n answer: DeepAgentVoiceLiveKitCredentials;\n handlers: DeepAgentVoiceLiveKitHandlers;\n audioElement: () => HTMLAudioElement | null;\n roomFactory?: () => DeepAgentVoiceLiveKitRoom;\n}\n"],"names":["joinDeepAgentVoiceRoom"],"mappings":";;AA4FA,IAAI,iBAA4D;AASzD,MAAM,gCACX,MAA0C;AACxC,sCAAmB,QAAA,QAAA,EAAA,KAAA,MAAA,QAAO,oBAAgB,CAAA,EAAE,MAAM,CAAC,UAAmB;AACpE,qBAAiB;AACjB,UAAM;AAAA,EACR,CAAC;AACD,SAAO;AACT;AAQK,MAAM,qCAAqC,CAAC;AAAA,EACjD;AAAA,EACA;AACF,OAAgF;AAAA,EAC9E,MAAM,QACJ,QACA,UACuC;AACvC,UAAM,EAAE,wBAAAA,wBAAAA,IAA2B,MAAM,8BAAA;AACzC,WAAOA,wBAAuB;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EACH;AACF;AAGA,eAAsB,uBACpB,SACuC;AACvC,QAAM,OAAO,MAAM,8BAAA;AACnB,SAAO,KAAK,uBAAuB,OAAO;AAC5C;;;;"}
|
package/dist/voice/livekit.d.ts
CHANGED
|
@@ -26,12 +26,22 @@ export interface DeepAgentVoiceLiveKitRemoteTrack {
|
|
|
26
26
|
attach(element?: HTMLMediaElement): HTMLMediaElement;
|
|
27
27
|
detach(): HTMLMediaElement[];
|
|
28
28
|
}
|
|
29
|
+
/** The publication a remote track arrived on (`RemoteTrackPublication`, structurally). */
|
|
30
|
+
export interface DeepAgentVoiceLiveKitRemotePublication {
|
|
31
|
+
setSubscribed(subscribed: boolean): void;
|
|
32
|
+
}
|
|
33
|
+
/** Who published a remote track (`RemoteParticipant`, structurally). */
|
|
34
|
+
export interface DeepAgentVoiceLiveKitRemoteParticipant {
|
|
35
|
+
readonly identity: string;
|
|
36
|
+
}
|
|
29
37
|
/**
|
|
30
38
|
* The slice of `livekit-client`'s `Room` the adapter drives — a real `Room`
|
|
31
39
|
* satisfies it; tests inject a fake through `roomFactory`.
|
|
32
40
|
*/
|
|
33
41
|
export interface DeepAgentVoiceLiveKitRoom {
|
|
34
42
|
readonly localParticipant: {
|
|
43
|
+
/** This device's participant, known once the room is joined. */
|
|
44
|
+
readonly identity?: string;
|
|
35
45
|
setMicrophoneEnabled(enabled: boolean, options?: {
|
|
36
46
|
echoCancellation?: boolean;
|
|
37
47
|
noiseSuppression?: boolean;
|
|
@@ -40,7 +50,7 @@ export interface DeepAgentVoiceLiveKitRoom {
|
|
|
40
50
|
};
|
|
41
51
|
connect(url: string, token: string): Promise<void>;
|
|
42
52
|
disconnect(): Promise<unknown>;
|
|
43
|
-
on(event: 'trackSubscribed', listener: (track: DeepAgentVoiceLiveKitRemoteTrack) => void): unknown;
|
|
53
|
+
on(event: 'trackSubscribed', listener: (track: DeepAgentVoiceLiveKitRemoteTrack, publication?: DeepAgentVoiceLiveKitRemotePublication, participant?: DeepAgentVoiceLiveKitRemoteParticipant) => void): unknown;
|
|
44
54
|
on(event: 'trackUnsubscribed', listener: (track: DeepAgentVoiceLiveKitRemoteTrack) => void): unknown;
|
|
45
55
|
on(event: 'disconnected', listener: (reason?: number) => void): unknown;
|
|
46
56
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"livekit.js","sources":["../../src/voice/livekit.ts"],"sourcesContent":["/** Media credentials already authorized and issued by the chat host. */\nexport interface DeepAgentVoiceLiveKitCredentials {\n serverUrl: string;\n token: string;\n}\n\n/** The media controls the shared chat voice lifecycle drives. */\nexport interface DeepAgentVoiceLiveKitSession {\n setMicrophoneEnabled(enabled: boolean): Promise<void>;\n disconnect(): Promise<void>;\n}\n\n/** Lifecycle controls supplied by the owning chat voice attempt. */\nexport interface DeepAgentVoiceLiveKitHandlers {\n micMuted: boolean;\n /** Ends pending and joined media with the owning chat voice attempt. */\n signal?: AbortSignal;\n onDisconnected: (reason: string) => void;\n}\n\n/** Structural media boundary; compatible with the shared agent runtime. */\nexport interface DeepAgentVoiceLiveKitAdapter {\n connect(\n answer: DeepAgentVoiceLiveKitCredentials,\n handlers: DeepAgentVoiceLiveKitHandlers,\n ): Promise<DeepAgentVoiceLiveKitSession>;\n}\n\n/** The remote-track surface the adapter drives (`RemoteTrack`, structurally). */\nexport interface DeepAgentVoiceLiveKitRemoteTrack {\n readonly kind: 'audio' | 'video' | 'unknown';\n /** Without an element LiveKit creates a detached, autoplaying one. */\n attach(element?: HTMLMediaElement): HTMLMediaElement;\n detach(): HTMLMediaElement[];\n}\n\n/**\n * The slice of `livekit-client`'s `Room` the adapter drives — a real `Room`\n * satisfies it; tests inject a fake through `roomFactory`.\n */\nexport interface DeepAgentVoiceLiveKitRoom {\n readonly localParticipant: {\n setMicrophoneEnabled(\n enabled: boolean,\n options?: {\n echoCancellation?: boolean;\n noiseSuppression?: boolean;\n autoGainControl?: boolean;\n },\n ): Promise<unknown>;\n };\n connect(url: string, token: string): Promise<void>;\n disconnect(): Promise<unknown>;\n on(\n event: 'trackSubscribed',\n listener: (track: DeepAgentVoiceLiveKitRemoteTrack) => void,\n ): unknown;\n on(\n event: 'trackUnsubscribed',\n listener: (track: DeepAgentVoiceLiveKitRemoteTrack) => void,\n ): unknown;\n on(event: 'disconnected', listener: (reason?: number) => void): unknown;\n}\n\nexport interface CreateDeepAgentVoiceLiveKitAdapterOptions {\n /**\n * The `<audio>` sink for the agent participant's track, read when the track\n * arrives; `null` lets LiveKit play through an element of its own.\n */\n audioElement: () => HTMLAudioElement | null;\n /** Test seam; defaults to a fresh `livekit-client` `Room`. */\n roomFactory?: () => DeepAgentVoiceLiveKitRoom;\n}\n\ntype DeepAgentVoiceLiveKitJoin = typeof import('./livekit-join');\n\nlet joinModuleLoad: Promise<DeepAgentVoiceLiveKitJoin> | null = null;\n\n/**\n * The room join and `livekit-client` (~120 KB gzip) are fetched when a voice\n * session starts, not with the composer: every Spaces boot mounts the\n * composer, few start a voice session. One `import()` keeps LiveKit in one\n * lazy chunk group. A failed import is not memoized: the next session imports\n * again.\n */\nexport const loadDeepAgentVoiceLiveKitJoin =\n (): Promise<DeepAgentVoiceLiveKitJoin> => {\n joinModuleLoad ??= import('./livekit-join').catch((error: unknown) => {\n joinModuleLoad = null;\n throw error;\n });\n return joinModuleLoad;\n };\n\n/**\n * The composer's LiveKit leg for the shared voice session\n * (`useDeepAgentVoice({ transport: 'livekit' })`): join the room the host\n * minted, publish the microphone, play the agent's track, and report a drop\n * (`joinDeepAgentVoiceRoom`, loaded on the first join).\n */\nexport const createDeepAgentVoiceLiveKitAdapter = ({\n audioElement,\n roomFactory,\n}: CreateDeepAgentVoiceLiveKitAdapterOptions): DeepAgentVoiceLiveKitAdapter => ({\n async connect(\n answer: DeepAgentVoiceLiveKitCredentials,\n handlers: DeepAgentVoiceLiveKitHandlers,\n ): Promise<DeepAgentVoiceLiveKitSession> {\n const { joinDeepAgentVoiceRoom } = await loadDeepAgentVoiceLiveKitJoin();\n return joinDeepAgentVoiceRoom({\n answer,\n handlers,\n audioElement,\n roomFactory,\n });\n },\n});\n\n/** Join with an already-authorized room answer without eagerly loading LiveKit. */\nexport async function joinDeepAgentVoiceRoom(\n options: JoinDeepAgentVoiceRoomOptions,\n): Promise<DeepAgentVoiceLiveKitSession> {\n const join = await loadDeepAgentVoiceLiveKitJoin();\n return join.joinDeepAgentVoiceRoom(options);\n}\n\nexport interface JoinDeepAgentVoiceRoomOptions {\n answer: DeepAgentVoiceLiveKitCredentials;\n handlers: DeepAgentVoiceLiveKitHandlers;\n audioElement: () => HTMLAudioElement | null;\n roomFactory?: () => DeepAgentVoiceLiveKitRoom;\n}\n"],"names":["joinDeepAgentVoiceRoom"],"mappings":"
|
|
1
|
+
{"version":3,"file":"livekit.js","sources":["../../src/voice/livekit.ts"],"sourcesContent":["/** Media credentials already authorized and issued by the chat host. */\nexport interface DeepAgentVoiceLiveKitCredentials {\n serverUrl: string;\n token: string;\n}\n\n/** The media controls the shared chat voice lifecycle drives. */\nexport interface DeepAgentVoiceLiveKitSession {\n setMicrophoneEnabled(enabled: boolean): Promise<void>;\n disconnect(): Promise<void>;\n}\n\n/** Lifecycle controls supplied by the owning chat voice attempt. */\nexport interface DeepAgentVoiceLiveKitHandlers {\n micMuted: boolean;\n /** Ends pending and joined media with the owning chat voice attempt. */\n signal?: AbortSignal;\n onDisconnected: (reason: string) => void;\n}\n\n/** Structural media boundary; compatible with the shared agent runtime. */\nexport interface DeepAgentVoiceLiveKitAdapter {\n connect(\n answer: DeepAgentVoiceLiveKitCredentials,\n handlers: DeepAgentVoiceLiveKitHandlers,\n ): Promise<DeepAgentVoiceLiveKitSession>;\n}\n\n/** The remote-track surface the adapter drives (`RemoteTrack`, structurally). */\nexport interface DeepAgentVoiceLiveKitRemoteTrack {\n readonly kind: 'audio' | 'video' | 'unknown';\n /** Without an element LiveKit creates a detached, autoplaying one. */\n attach(element?: HTMLMediaElement): HTMLMediaElement;\n detach(): HTMLMediaElement[];\n}\n\n/** The publication a remote track arrived on (`RemoteTrackPublication`, structurally). */\nexport interface DeepAgentVoiceLiveKitRemotePublication {\n setSubscribed(subscribed: boolean): void;\n}\n\n/** Who published a remote track (`RemoteParticipant`, structurally). */\nexport interface DeepAgentVoiceLiveKitRemoteParticipant {\n readonly identity: string;\n}\n\n/**\n * The slice of `livekit-client`'s `Room` the adapter drives — a real `Room`\n * satisfies it; tests inject a fake through `roomFactory`.\n */\nexport interface DeepAgentVoiceLiveKitRoom {\n readonly localParticipant: {\n /** This device's participant, known once the room is joined. */\n readonly identity?: string;\n setMicrophoneEnabled(\n enabled: boolean,\n options?: {\n echoCancellation?: boolean;\n noiseSuppression?: boolean;\n autoGainControl?: boolean;\n },\n ): Promise<unknown>;\n };\n connect(url: string, token: string): Promise<void>;\n disconnect(): Promise<unknown>;\n on(\n event: 'trackSubscribed',\n listener: (\n track: DeepAgentVoiceLiveKitRemoteTrack,\n publication?: DeepAgentVoiceLiveKitRemotePublication,\n participant?: DeepAgentVoiceLiveKitRemoteParticipant,\n ) => void,\n ): unknown;\n on(\n event: 'trackUnsubscribed',\n listener: (track: DeepAgentVoiceLiveKitRemoteTrack) => void,\n ): unknown;\n on(event: 'disconnected', listener: (reason?: number) => void): unknown;\n}\n\nexport interface CreateDeepAgentVoiceLiveKitAdapterOptions {\n /**\n * The `<audio>` sink for the agent participant's track, read when the track\n * arrives; `null` lets LiveKit play through an element of its own.\n */\n audioElement: () => HTMLAudioElement | null;\n /** Test seam; defaults to a fresh `livekit-client` `Room`. */\n roomFactory?: () => DeepAgentVoiceLiveKitRoom;\n}\n\ntype DeepAgentVoiceLiveKitJoin = typeof import('./livekit-join');\n\nlet joinModuleLoad: Promise<DeepAgentVoiceLiveKitJoin> | null = null;\n\n/**\n * The room join and `livekit-client` (~120 KB gzip) are fetched when a voice\n * session starts, not with the composer: every Spaces boot mounts the\n * composer, few start a voice session. One `import()` keeps LiveKit in one\n * lazy chunk group. A failed import is not memoized: the next session imports\n * again.\n */\nexport const loadDeepAgentVoiceLiveKitJoin =\n (): Promise<DeepAgentVoiceLiveKitJoin> => {\n joinModuleLoad ??= import('./livekit-join').catch((error: unknown) => {\n joinModuleLoad = null;\n throw error;\n });\n return joinModuleLoad;\n };\n\n/**\n * The composer's LiveKit leg for the shared voice session\n * (`useDeepAgentVoice({ transport: 'livekit' })`): join the room the host\n * minted, publish the microphone, play the agent's track, and report a drop\n * (`joinDeepAgentVoiceRoom`, loaded on the first join).\n */\nexport const createDeepAgentVoiceLiveKitAdapter = ({\n audioElement,\n roomFactory,\n}: CreateDeepAgentVoiceLiveKitAdapterOptions): DeepAgentVoiceLiveKitAdapter => ({\n async connect(\n answer: DeepAgentVoiceLiveKitCredentials,\n handlers: DeepAgentVoiceLiveKitHandlers,\n ): Promise<DeepAgentVoiceLiveKitSession> {\n const { joinDeepAgentVoiceRoom } = await loadDeepAgentVoiceLiveKitJoin();\n return joinDeepAgentVoiceRoom({\n answer,\n handlers,\n audioElement,\n roomFactory,\n });\n },\n});\n\n/** Join with an already-authorized room answer without eagerly loading LiveKit. */\nexport async function joinDeepAgentVoiceRoom(\n options: JoinDeepAgentVoiceRoomOptions,\n): Promise<DeepAgentVoiceLiveKitSession> {\n const join = await loadDeepAgentVoiceLiveKitJoin();\n return join.joinDeepAgentVoiceRoom(options);\n}\n\nexport interface JoinDeepAgentVoiceRoomOptions {\n answer: DeepAgentVoiceLiveKitCredentials;\n handlers: DeepAgentVoiceLiveKitHandlers;\n audioElement: () => HTMLAudioElement | null;\n roomFactory?: () => DeepAgentVoiceLiveKitRoom;\n}\n"],"names":["joinDeepAgentVoiceRoom"],"mappings":"AA4FA,IAAI,iBAA4D;AASzD,MAAM,gCACX,MAA0C;AACxC,sCAAmB,OAAO,mBAAgB,EAAE,MAAM,CAAC,UAAmB;AACpE,qBAAiB;AACjB,UAAM;AAAA,EACR,CAAC;AACD,SAAO;AACT;AAQK,MAAM,qCAAqC,CAAC;AAAA,EACjD;AAAA,EACA;AACF,OAAgF;AAAA,EAC9E,MAAM,QACJ,QACA,UACuC;AACvC,UAAM,EAAE,wBAAAA,wBAAAA,IAA2B,MAAM,8BAAA;AACzC,WAAOA,wBAAuB;AAAA,MAC5B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA,CACD;AAAA,EACH;AACF;AAGA,eAAsB,uBACpB,SACuC;AACvC,QAAM,OAAO,MAAM,8BAAA;AACnB,SAAO,KAAK,uBAAuB,OAAO;AAC5C;"}
|