@athenaintel/react 0.42.2 → 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 +225 -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/conversation-list-groups.d.ts +74 -0
- 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 +15 -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 -33
- 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 -33
- 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 +572 -134
- package/dist/agent-runtime/src/use-deep-agent-voice.cjs.map +1 -1
- package/dist/agent-runtime/src/use-deep-agent-voice.d.ts +137 -10
- package/dist/agent-runtime/src/use-deep-agent-voice.js +514 -76
- 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 +60 -38
- package/dist/chat/super-grouping/SuperGroupingCard.cjs.map +1 -1
- package/dist/chat/super-grouping/SuperGroupingCard.d.ts +24 -4
- package/dist/chat/super-grouping/SuperGroupingCard.js +37 -15
- 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 +97 -37
- package/dist/chat/super-grouping/ToolTimeline.cjs.map +1 -1
- package/dist/chat/super-grouping/ToolTimeline.d.ts +14 -2
- package/dist/chat/super-grouping/ToolTimeline.js +94 -34
- 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 +6 -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/timeline-step.cjs +61 -2
- package/dist/chat/super-grouping/timeline-step.cjs.map +1 -1
- package/dist/chat/super-grouping/timeline-step.d.ts +13 -1
- package/dist/chat/super-grouping/timeline-step.js +61 -2
- package/dist/chat/super-grouping/timeline-step.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 +147 -38
- package/dist/chat-ui/mentions/mention-chip.cjs.map +1 -1
- package/dist/chat-ui/mentions/mention-chip.d.ts +17 -1
- package/dist/chat-ui/mentions/mention-chip.js +146 -37
- package/dist/chat-ui/mentions/mention-chip.js.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 +140 -0
- package/dist/chat-ui/mentions/use-mention-asset.cjs.map +1 -0
- package/dist/chat-ui/mentions/use-mention-asset.d.ts +16 -0
- package/dist/chat-ui/mentions/use-mention-asset.js +140 -0
- package/dist/chat-ui/mentions/use-mention-asset.js.map +1 -0
- 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 +7 -6
- package/dist/chat-ui/rich-text/chat-link.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-link.d.ts +2 -3
- package/dist/chat-ui/rich-text/chat-link.js +6 -5
- package/dist/chat-ui/rich-text/chat-link.js.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 +7 -6
- package/dist/chat-ui/rich-text/chat-node-views.cjs.map +1 -1
- package/dist/chat-ui/rich-text/chat-node-views.js +1 -0
- package/dist/chat-ui/rich-text/chat-node-views.js.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/references/src/tool-option-schemas.d.ts +0 -34
- 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 +55 -51
- package/dist/threads/statewire-thread-list.cjs.map +1 -1
- package/dist/threads/statewire-thread-list.js +6 -2
- package/dist/threads/statewire-thread-list.js.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-summary.cjs +0 -2
- package/dist/tools/tool-summary.cjs.map +1 -1
- package/dist/tools/tool-summary.js +0 -2
- package/dist/tools/tool-summary.js.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,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const reactStatewire = require("@assistant-ui/react-statewire");
|
|
4
|
-
const
|
|
4
|
+
const require$$0 = require("react");
|
|
5
5
|
const errors = require("./errors.cjs");
|
|
6
6
|
const statewireState = require("./statewire-state.cjs");
|
|
7
7
|
const readSendFailure = (error) => {
|
|
@@ -69,6 +69,47 @@ const parseVoiceLiveKitAnswer = (answer) => {
|
|
|
69
69
|
}
|
|
70
70
|
return { serverUrl, token, roomName };
|
|
71
71
|
};
|
|
72
|
+
class VoiceTransferRoomDroppedError extends Error {
|
|
73
|
+
constructor(reason) {
|
|
74
|
+
super(`The voice room disconnected before the call moved (${reason})`);
|
|
75
|
+
this.reason = reason;
|
|
76
|
+
this.name = "VoiceTransferRoomDroppedError";
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const withAnswerDeadline = async (promise, ms) => {
|
|
80
|
+
let timer = null;
|
|
81
|
+
try {
|
|
82
|
+
return await Promise.race([
|
|
83
|
+
promise,
|
|
84
|
+
new Promise((_, reject) => {
|
|
85
|
+
timer = setTimeout(() => reject(new VoiceAnswerTimeoutError()), ms);
|
|
86
|
+
})
|
|
87
|
+
]);
|
|
88
|
+
} finally {
|
|
89
|
+
if (timer !== null) clearTimeout(timer);
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
const readTransferOffer = (result) => {
|
|
93
|
+
const record = result !== null && typeof result === "object" ? result : null;
|
|
94
|
+
const answer = record == null ? void 0 : record.answer;
|
|
95
|
+
const transferId = record == null ? void 0 : record.transferId;
|
|
96
|
+
return {
|
|
97
|
+
answer: typeof answer === "string" && answer !== "" ? answer : null,
|
|
98
|
+
transferId: typeof transferId === "string" && transferId !== "" ? transferId : null
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
const classifyTransferFailure = (error, stage) => {
|
|
102
|
+
const underlying = stage === "commit" ? error instanceof VoiceTransferRoomDroppedError ? { kind: "room_failed" } : classifyVoiceStartError(error) : classifyStartFailure(error, stage);
|
|
103
|
+
return {
|
|
104
|
+
kind: "transfer_failed",
|
|
105
|
+
stage,
|
|
106
|
+
message: describeVoiceTransferFailure({ reason: underlying.kind }),
|
|
107
|
+
reason: underlying.kind,
|
|
108
|
+
...underlying.code !== void 0 && { code: underlying.code },
|
|
109
|
+
...underlying.status !== void 0 && { status: underlying.status },
|
|
110
|
+
...underlying.fate !== void 0 && { fate: underlying.fate }
|
|
111
|
+
};
|
|
112
|
+
};
|
|
72
113
|
const classifyStartFailure = (error, stage) => {
|
|
73
114
|
const message = errorMessage(error);
|
|
74
115
|
switch (stage) {
|
|
@@ -111,6 +152,7 @@ const isMicrophoneDenied = (error) => {
|
|
|
111
152
|
}
|
|
112
153
|
return /permission|denied|not allowed/i.test(errorMessage(error));
|
|
113
154
|
};
|
|
155
|
+
const describeVoiceTransferFailure = ({ reason }) => reason === "microphone_denied" ? "Microphone access is blocked, so the call stayed on your other device. Allow the microphone for Athena and try again." : "The call couldn't move here and is still on your other device. Try again.";
|
|
114
156
|
const describeVoiceFailure = (failure) => {
|
|
115
157
|
switch (failure.kind) {
|
|
116
158
|
case "microphone_denied":
|
|
@@ -125,6 +167,8 @@ const describeVoiceFailure = (failure) => {
|
|
|
125
167
|
return "The voice room could not be joined. Check your connection and try again.";
|
|
126
168
|
case "media_lost":
|
|
127
169
|
return "The voice connection was lost. Start voice again to continue.";
|
|
170
|
+
case "transfer_failed":
|
|
171
|
+
return describeVoiceTransferFailure({ reason: failure.reason });
|
|
128
172
|
case "server_rejected":
|
|
129
173
|
if (failure.code === "voice-active") {
|
|
130
174
|
return "A voice session is already live on another device or tab. End it there first.";
|
|
@@ -190,7 +234,9 @@ const RELAY_CAPTURE_FRAME_SAMPLES = 1024;
|
|
|
190
234
|
const RELAY_PLAYBACK_LEAD_SECONDS = 0.02;
|
|
191
235
|
const MEDIA_DISCONNECT_GRACE_MS = 5e3;
|
|
192
236
|
const END_BEFORE_RESTART_TIMEOUT_MS = 3e3;
|
|
193
|
-
const
|
|
237
|
+
const TRANSFER_OFFER_TIMEOUT_MS = 15e3;
|
|
238
|
+
const TRANSFER_COMMIT_TIMEOUT_MS = 15e3;
|
|
239
|
+
const mintVoiceId = ({ kind }) => `voice${kind}_${Date.now().toString(36)}${Math.random().toString(36).slice(2, 12)}`;
|
|
194
240
|
const formatVoiceElapsed = (sinceMs, nowMs = Date.now()) => {
|
|
195
241
|
const total = Math.max(0, Math.floor((nowMs - sinceMs) / 1e3));
|
|
196
242
|
const hours = Math.floor(total / 3600);
|
|
@@ -200,8 +246,8 @@ const formatVoiceElapsed = (sinceMs, nowMs = Date.now()) => {
|
|
|
200
246
|
return hours > 0 ? `${hours}:${String(minutes).padStart(2, "0")}:${String(seconds).padStart(2, "0")}` : mmss;
|
|
201
247
|
};
|
|
202
248
|
const useVoiceElapsed = (since) => {
|
|
203
|
-
const [now, setNow] =
|
|
204
|
-
|
|
249
|
+
const [now, setNow] = require$$0.useState(() => Date.now());
|
|
250
|
+
require$$0.useEffect(() => {
|
|
205
251
|
if (since === null) return;
|
|
206
252
|
setNow(Date.now());
|
|
207
253
|
const timer = setInterval(() => setNow(Date.now()), 1e3);
|
|
@@ -209,6 +255,42 @@ const useVoiceElapsed = (since) => {
|
|
|
209
255
|
}, [since]);
|
|
210
256
|
return since === null ? null : formatVoiceElapsed(since, now);
|
|
211
257
|
};
|
|
258
|
+
const VOICE_SURFACE_LABELS = {
|
|
259
|
+
web: "browser",
|
|
260
|
+
mobile: "phone",
|
|
261
|
+
chrome: "Chrome",
|
|
262
|
+
desktop: "desktop app",
|
|
263
|
+
office: "Office"
|
|
264
|
+
};
|
|
265
|
+
const voiceSurfaceLabel = (surface) => VOICE_SURFACE_LABELS[surface];
|
|
266
|
+
const VOICE_MOVE_CALL_HERE_LABEL = "Move call here";
|
|
267
|
+
const VOICE_MOVE_HERE_ACTION = "Move here";
|
|
268
|
+
const VOICE_CONTINUE_BY_VOICE_LABEL = "Continue by voice";
|
|
269
|
+
const describeVoiceLiveElsewhere = (surface) => `Live call on your ${voiceSurfaceLabel(surface)}`;
|
|
270
|
+
const describeVoiceMovedTo = (surface) => `Call moved to your ${voiceSurfaceLabel(surface)}`;
|
|
271
|
+
const VOICE_MOVED_NOTICE_MS = 6e3;
|
|
272
|
+
const useVoiceMovedNotice = (movedTo) => {
|
|
273
|
+
const [expired, setExpired] = require$$0.useState(null);
|
|
274
|
+
require$$0.useEffect(() => {
|
|
275
|
+
if (movedTo === null) return;
|
|
276
|
+
const timer = setTimeout(() => setExpired(movedTo), VOICE_MOVED_NOTICE_MS);
|
|
277
|
+
return () => clearTimeout(timer);
|
|
278
|
+
}, [movedTo]);
|
|
279
|
+
return movedTo !== null && expired !== movedTo ? describeVoiceMovedTo(movedTo.surface) : null;
|
|
280
|
+
};
|
|
281
|
+
const VOICE_SURFACES = new Set(Object.keys(VOICE_SURFACE_LABELS));
|
|
282
|
+
const parseVoiceOwner = (value) => {
|
|
283
|
+
if (value === null || typeof value !== "object") return null;
|
|
284
|
+
const { clientId, surface, since, transferable } = value;
|
|
285
|
+
if (typeof clientId !== "string" || clientId === "") return null;
|
|
286
|
+
if (typeof since !== "number" || !Number.isFinite(since)) return null;
|
|
287
|
+
return {
|
|
288
|
+
clientId,
|
|
289
|
+
surface: typeof surface === "string" && VOICE_SURFACES.has(surface) ? surface : "web",
|
|
290
|
+
since,
|
|
291
|
+
transferable: transferable === true
|
|
292
|
+
};
|
|
293
|
+
};
|
|
212
294
|
const REQUEST_LABELS = {
|
|
213
295
|
"session.commentary.append": "a result for the voice conversation",
|
|
214
296
|
"session.thinking.append": "a context update",
|
|
@@ -277,11 +359,16 @@ const waitForRelayOpen = (ws, timeoutMs) => new Promise((resolve, reject) => {
|
|
|
277
359
|
reject(new Error("The voice relay closed before it opened"));
|
|
278
360
|
});
|
|
279
361
|
});
|
|
362
|
+
const useRetainedHydrated = (value, initial) => {
|
|
363
|
+
const ref = require$$0.useRef(initial);
|
|
364
|
+
if (value !== void 0) ref.current = value;
|
|
365
|
+
return ref.current;
|
|
366
|
+
};
|
|
280
367
|
const useDeepAgentVoice = (options = {}) => {
|
|
281
368
|
const wireSendCommand = reactStatewire.useStatewireSendCommand();
|
|
282
|
-
const sendCommandRef =
|
|
369
|
+
const sendCommandRef = require$$0.useRef(wireSendCommand);
|
|
283
370
|
sendCommandRef.current = wireSendCommand;
|
|
284
|
-
const sendCommand =
|
|
371
|
+
const sendCommand = require$$0.useCallback(
|
|
285
372
|
async (command) => sendCommandRef.current(command),
|
|
286
373
|
[]
|
|
287
374
|
);
|
|
@@ -289,51 +376,104 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
289
376
|
// The raw wire state is non-object until the attach snapshot hydrates it.
|
|
290
377
|
(s) => statewireState.readDeepAgentStreamValues(s).voice ?? null
|
|
291
378
|
);
|
|
292
|
-
const [phase, setPhase] =
|
|
293
|
-
const [failure, setFailure] =
|
|
379
|
+
const [phase, setPhase] = require$$0.useState("idle");
|
|
380
|
+
const [failure, setFailure] = require$$0.useState(null);
|
|
294
381
|
const error = (failure == null ? void 0 : failure.message) ?? null;
|
|
295
|
-
const [micMuted, setMicMutedState] =
|
|
296
|
-
const micMutedRef =
|
|
297
|
-
const micChangeRef =
|
|
298
|
-
const [liveSince, setLiveSince] =
|
|
299
|
-
const [handoffTask, setHandoffTask] =
|
|
300
|
-
const lastActiveTaskRef =
|
|
301
|
-
const pcRef =
|
|
302
|
-
const releasePeerListenersRef =
|
|
303
|
-
const streamRef =
|
|
304
|
-
const wsRef =
|
|
305
|
-
const audioContextRef =
|
|
306
|
-
const audioNodesRef =
|
|
307
|
-
const playheadRef =
|
|
308
|
-
const livekitRef =
|
|
309
|
-
const livekitAbortRef =
|
|
310
|
-
const attemptRef =
|
|
311
|
-
const
|
|
312
|
-
const
|
|
313
|
-
|
|
314
|
-
|
|
382
|
+
const [micMuted, setMicMutedState] = require$$0.useState(false);
|
|
383
|
+
const micMutedRef = require$$0.useRef(false);
|
|
384
|
+
const micChangeRef = require$$0.useRef(0);
|
|
385
|
+
const [liveSince, setLiveSince] = require$$0.useState(null);
|
|
386
|
+
const [handoffTask, setHandoffTask] = require$$0.useState(null);
|
|
387
|
+
const lastActiveTaskRef = require$$0.useRef(null);
|
|
388
|
+
const pcRef = require$$0.useRef(null);
|
|
389
|
+
const releasePeerListenersRef = require$$0.useRef(null);
|
|
390
|
+
const streamRef = require$$0.useRef(null);
|
|
391
|
+
const wsRef = require$$0.useRef(null);
|
|
392
|
+
const audioContextRef = require$$0.useRef(null);
|
|
393
|
+
const audioNodesRef = require$$0.useRef([]);
|
|
394
|
+
const playheadRef = require$$0.useRef(0);
|
|
395
|
+
const livekitRef = require$$0.useRef(null);
|
|
396
|
+
const livekitAbortRef = require$$0.useRef(null);
|
|
397
|
+
const attemptRef = require$$0.useRef(0);
|
|
398
|
+
const callAttemptIdRef = require$$0.useRef("");
|
|
399
|
+
const observedAttempt = reactStatewire.useStatewireState((s) => {
|
|
400
|
+
if (!statewireState.isDeepAgentStateHydrated(s)) return void 0;
|
|
401
|
+
const values = statewireState.readDeepAgentStreamValues(s);
|
|
402
|
+
const value = values.voiceStartFence ?? values.voiceAttemptId;
|
|
403
|
+
return typeof value === "string" ? value : null;
|
|
404
|
+
});
|
|
405
|
+
const observedAttemptRef = require$$0.useRef(void 0);
|
|
406
|
+
if (observedAttempt !== void 0) observedAttemptRef.current = observedAttempt ?? void 0;
|
|
407
|
+
const startingRef = require$$0.useRef(false);
|
|
408
|
+
const startPromiseRef = require$$0.useRef(null);
|
|
409
|
+
const autoRestartedRef = require$$0.useRef(false);
|
|
410
|
+
const onRemoteStreamRef = require$$0.useRef(options.onRemoteStream);
|
|
315
411
|
onRemoteStreamRef.current = options.onRemoteStream;
|
|
316
|
-
const audioSessionRef =
|
|
412
|
+
const audioSessionRef = require$$0.useRef(options.audioSession);
|
|
317
413
|
audioSessionRef.current = options.audioSession;
|
|
318
|
-
const transportRef =
|
|
414
|
+
const transportRef = require$$0.useRef(options.transport ?? "webrtc");
|
|
319
415
|
transportRef.current = options.transport ?? "webrtc";
|
|
320
|
-
const relayUrlRef =
|
|
416
|
+
const relayUrlRef = require$$0.useRef(options.relayUrl);
|
|
321
417
|
relayUrlRef.current = options.relayUrl;
|
|
322
|
-
const livekitAdapterRef =
|
|
418
|
+
const livekitAdapterRef = require$$0.useRef(options.livekit);
|
|
323
419
|
livekitAdapterRef.current = options.livekit;
|
|
324
|
-
const modelRef =
|
|
420
|
+
const modelRef = require$$0.useRef(options.model);
|
|
325
421
|
modelRef.current = options.model;
|
|
326
|
-
const onDiagnosticRef =
|
|
422
|
+
const onDiagnosticRef = require$$0.useRef(options.onDiagnostic);
|
|
327
423
|
onDiagnosticRef.current = options.onDiagnostic;
|
|
328
|
-
const timeoutsRef =
|
|
424
|
+
const timeoutsRef = require$$0.useRef(options.timeouts);
|
|
329
425
|
timeoutsRef.current = options.timeouts;
|
|
330
|
-
const phaseRef =
|
|
426
|
+
const phaseRef = require$$0.useRef("idle");
|
|
331
427
|
phaseRef.current = phase;
|
|
332
|
-
const attemptStartedAtRef =
|
|
333
|
-
const activeAudioSessionRef =
|
|
334
|
-
const startingAudioSessionRef =
|
|
335
|
-
const audioSessionIdleRef =
|
|
336
|
-
const
|
|
428
|
+
const attemptStartedAtRef = require$$0.useRef(0);
|
|
429
|
+
const activeAudioSessionRef = require$$0.useRef(null);
|
|
430
|
+
const startingAudioSessionRef = require$$0.useRef(null);
|
|
431
|
+
const audioSessionIdleRef = require$$0.useRef(Promise.resolve());
|
|
432
|
+
const ownClientIdRef = require$$0.useRef(null);
|
|
433
|
+
const lastOwnedClientIdRef = require$$0.useRef(null);
|
|
434
|
+
const transferRef = require$$0.useRef(null);
|
|
435
|
+
const [movedTo, setMovedTo] = require$$0.useState(null);
|
|
436
|
+
const hydratedTransferCapable = reactStatewire.useStatewireState(
|
|
437
|
+
(s) => statewireState.isDeepAgentStateHydrated(s) ? "voiceOwner" in statewireState.readDeepAgentStreamValues(s) : void 0
|
|
438
|
+
);
|
|
439
|
+
const hydratedVoiceOwner = reactStatewire.useStatewireState(
|
|
440
|
+
(s) => statewireState.isDeepAgentStateHydrated(s) ? statewireState.readDeepAgentStreamValues(s).voiceOwner ?? null : void 0
|
|
441
|
+
);
|
|
442
|
+
const hydratedWireOwnerId = reactStatewire.useStatewireState((s) => {
|
|
443
|
+
if (!statewireState.isDeepAgentStateHydrated(s)) return void 0;
|
|
444
|
+
const wire = statewireState.readDeepAgentStreamValues(s).voice;
|
|
445
|
+
return typeof (wire == null ? void 0 : wire.clientId) === "string" && wire.clientId !== "" ? wire.clientId : null;
|
|
446
|
+
});
|
|
447
|
+
const hydratedWireLive = reactStatewire.useStatewireState((s) => {
|
|
448
|
+
if (!statewireState.isDeepAgentStateHydrated(s)) return void 0;
|
|
449
|
+
const wire = statewireState.readDeepAgentStreamValues(s).voice;
|
|
450
|
+
return (wire == null ? void 0 : wire.status) === "live";
|
|
451
|
+
});
|
|
452
|
+
const transferCapable = useRetainedHydrated(hydratedTransferCapable, false);
|
|
453
|
+
const wireVoiceOwner = useRetainedHydrated(hydratedVoiceOwner, null);
|
|
454
|
+
const wireOwnerId = useRetainedHydrated(hydratedWireOwnerId, null);
|
|
455
|
+
const wireLive = useRetainedHydrated(hydratedWireLive, false);
|
|
456
|
+
const voiceOwner = require$$0.useMemo(
|
|
457
|
+
() => transferCapable ? parseVoiceOwner(wireVoiceOwner) : null,
|
|
458
|
+
[transferCapable, wireVoiceOwner]
|
|
459
|
+
);
|
|
460
|
+
const transferCapableRef = require$$0.useRef(transferCapable);
|
|
461
|
+
transferCapableRef.current = transferCapable;
|
|
462
|
+
const voiceOwnerRef = require$$0.useRef(voiceOwner);
|
|
463
|
+
voiceOwnerRef.current = voiceOwner;
|
|
464
|
+
const wireOwnerIdRef = require$$0.useRef(wireOwnerId);
|
|
465
|
+
wireOwnerIdRef.current = wireOwnerId;
|
|
466
|
+
const canTakeCall = transportRef.current === "livekit" && livekitAdapterRef.current !== void 0;
|
|
467
|
+
const elsewhere = voiceOwner !== null && voiceOwner.transferable && wireLive && canTakeCall && (phase === "idle" || phase === "error") && voiceOwner.clientId !== lastOwnedClientIdRef.current ? voiceOwner : null;
|
|
468
|
+
const elsewhereSurface = (elsewhere == null ? void 0 : elsewhere.surface) ?? null;
|
|
469
|
+
const elsewhereSince = (elsewhere == null ? void 0 : elsewhere.since) ?? null;
|
|
470
|
+
const liveElsewhere = require$$0.useMemo(
|
|
471
|
+
() => elsewhereSurface === null || elsewhereSince === null ? null : { surface: elsewhereSurface, since: elsewhereSince },
|
|
472
|
+
[elsewhereSurface, elsewhereSince]
|
|
473
|
+
);
|
|
474
|
+
const liveElsewhereRef = require$$0.useRef(liveElsewhere);
|
|
475
|
+
liveElsewhereRef.current = liveElsewhere;
|
|
476
|
+
const report = require$$0.useCallback(
|
|
337
477
|
(event, attempt, data) => {
|
|
338
478
|
const observer = onDiagnosticRef.current;
|
|
339
479
|
if (!observer) return;
|
|
@@ -351,13 +491,13 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
351
491
|
},
|
|
352
492
|
[]
|
|
353
493
|
);
|
|
354
|
-
const releaseAudioSession =
|
|
494
|
+
const releaseAudioSession = require$$0.useCallback(() => {
|
|
355
495
|
const session = activeAudioSessionRef.current;
|
|
356
496
|
if (!session) return;
|
|
357
497
|
activeAudioSessionRef.current = null;
|
|
358
498
|
audioSessionIdleRef.current = audioSessionIdleRef.current.then(() => session.stop()).catch(() => void 0);
|
|
359
499
|
}, []);
|
|
360
|
-
const teardown =
|
|
500
|
+
const teardown = require$$0.useCallback(() => {
|
|
361
501
|
attemptRef.current += 1;
|
|
362
502
|
const livekitAbort = livekitAbortRef.current;
|
|
363
503
|
livekitAbortRef.current = null;
|
|
@@ -397,7 +537,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
397
537
|
return (_a = onRemoteStreamRef.current) == null ? void 0 : _a.call(onRemoteStreamRef, null);
|
|
398
538
|
});
|
|
399
539
|
}, [releaseAudioSession]);
|
|
400
|
-
const fail =
|
|
540
|
+
const fail = require$$0.useCallback(
|
|
401
541
|
(nextFailure) => {
|
|
402
542
|
report("error", attemptRef.current, {
|
|
403
543
|
kind: nextFailure.kind,
|
|
@@ -414,10 +554,93 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
414
554
|
},
|
|
415
555
|
[report, teardown]
|
|
416
556
|
);
|
|
417
|
-
const
|
|
557
|
+
const handleMovedAway = require$$0.useCallback(() => {
|
|
558
|
+
var _a;
|
|
559
|
+
const surface = ((_a = voiceOwnerRef.current) == null ? void 0 : _a.surface) ?? "web";
|
|
560
|
+
report("moved", attemptRef.current, { toSurface: surface });
|
|
561
|
+
teardown();
|
|
562
|
+
ownClientIdRef.current = null;
|
|
563
|
+
micMutedRef.current = false;
|
|
564
|
+
setMicMutedState(false);
|
|
565
|
+
setHandoffTask(null);
|
|
566
|
+
setFailure(null);
|
|
567
|
+
setPhase("idle");
|
|
568
|
+
setMovedTo({ surface });
|
|
569
|
+
}, [report, teardown]);
|
|
570
|
+
const ownerMovedAway = require$$0.useCallback(() => {
|
|
571
|
+
const own = ownClientIdRef.current;
|
|
572
|
+
const current = wireOwnerIdRef.current;
|
|
573
|
+
return transferCapableRef.current && own !== null && current !== null && current !== own;
|
|
574
|
+
}, []);
|
|
575
|
+
const acquireAudioSession = require$$0.useCallback(
|
|
576
|
+
async ({
|
|
577
|
+
attempt,
|
|
578
|
+
audioSession
|
|
579
|
+
}) => {
|
|
580
|
+
await audioSessionIdleRef.current;
|
|
581
|
+
if (attemptRef.current !== attempt) {
|
|
582
|
+
report("stale-attempt", attempt, { stage: "audio-session" });
|
|
583
|
+
return false;
|
|
584
|
+
}
|
|
585
|
+
startingAudioSessionRef.current = audioSession;
|
|
586
|
+
try {
|
|
587
|
+
await audioSession.start();
|
|
588
|
+
} finally {
|
|
589
|
+
startingAudioSessionRef.current = null;
|
|
590
|
+
}
|
|
591
|
+
activeAudioSessionRef.current = audioSession;
|
|
592
|
+
if (attemptRef.current !== attempt) {
|
|
593
|
+
report("stale-attempt", attempt, { stage: "audio-session" });
|
|
594
|
+
releaseAudioSession();
|
|
595
|
+
return false;
|
|
596
|
+
}
|
|
597
|
+
report("audio-session-ready", attempt);
|
|
598
|
+
return true;
|
|
599
|
+
},
|
|
600
|
+
[releaseAudioSession, report]
|
|
601
|
+
);
|
|
602
|
+
const joinVoiceRoom = require$$0.useCallback(
|
|
603
|
+
async ({
|
|
604
|
+
attempt,
|
|
605
|
+
room,
|
|
606
|
+
adapter,
|
|
607
|
+
controller = new AbortController(),
|
|
608
|
+
onDisconnectedAfterJoin
|
|
609
|
+
}) => {
|
|
610
|
+
let joined = false;
|
|
611
|
+
let disconnectedWhileJoining = false;
|
|
612
|
+
livekitAbortRef.current = controller;
|
|
613
|
+
const session = await adapter.connect(room, {
|
|
614
|
+
micMuted: micMutedRef.current,
|
|
615
|
+
signal: controller.signal,
|
|
616
|
+
onDisconnected: (reason) => {
|
|
617
|
+
if (attemptRef.current !== attempt) return;
|
|
618
|
+
if (!joined) {
|
|
619
|
+
disconnectedWhileJoining = true;
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
onDisconnectedAfterJoin(reason);
|
|
623
|
+
}
|
|
624
|
+
});
|
|
625
|
+
if (attemptRef.current !== attempt) {
|
|
626
|
+
releaseSafely(() => session.disconnect());
|
|
627
|
+
return false;
|
|
628
|
+
}
|
|
629
|
+
if (disconnectedWhileJoining) {
|
|
630
|
+
releaseSafely(() => session.disconnect());
|
|
631
|
+
throw new Error("The voice room disconnected while joining");
|
|
632
|
+
}
|
|
633
|
+
joined = true;
|
|
634
|
+
livekitRef.current = session;
|
|
635
|
+
report("room-joined", attempt, { roomName: room.roomName });
|
|
636
|
+
return true;
|
|
637
|
+
},
|
|
638
|
+
[report]
|
|
639
|
+
);
|
|
640
|
+
const handleMediaLossRef = require$$0.useRef(
|
|
418
641
|
async () => void 0
|
|
419
642
|
);
|
|
420
|
-
const watchConnection =
|
|
643
|
+
const watchConnection = require$$0.useCallback((pc, attempt) => {
|
|
421
644
|
let disconnectTimer = null;
|
|
422
645
|
const clearDisconnectTimer = () => {
|
|
423
646
|
if (disconnectTimer === null) return;
|
|
@@ -458,7 +681,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
458
681
|
releaseSafely(() => pc.removeEventListener("iceconnectionstatechange", onChange));
|
|
459
682
|
};
|
|
460
683
|
}, [report]);
|
|
461
|
-
const playRelayChunk =
|
|
684
|
+
const playRelayChunk = require$$0.useCallback((audio, data) => {
|
|
462
685
|
const pcm = new Int16Array(data);
|
|
463
686
|
if (pcm.length === 0) return;
|
|
464
687
|
const samples = float32FromPcm16(pcm);
|
|
@@ -471,9 +694,15 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
471
694
|
node.start(startAt);
|
|
472
695
|
playheadRef.current = startAt + buffer.duration;
|
|
473
696
|
}, []);
|
|
474
|
-
const runStartSession =
|
|
697
|
+
const runStartSession = require$$0.useCallback(async ({
|
|
698
|
+
opening
|
|
699
|
+
} = {}) => {
|
|
475
700
|
var _a, _b, _c;
|
|
476
701
|
const attempt = attemptRef.current += 1;
|
|
702
|
+
const attemptId = mintVoiceId({ kind: "attempt" });
|
|
703
|
+
const previousAttemptId = observedAttemptRef.current;
|
|
704
|
+
callAttemptIdRef.current = attemptId;
|
|
705
|
+
ownClientIdRef.current = null;
|
|
477
706
|
startingRef.current = true;
|
|
478
707
|
attemptStartedAtRef.current = Date.now();
|
|
479
708
|
setFailure(null);
|
|
@@ -487,7 +716,10 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
487
716
|
report("stale-attempt", attempt, { stage });
|
|
488
717
|
releaseAudioSession();
|
|
489
718
|
};
|
|
490
|
-
report("start-requested", attempt, {
|
|
719
|
+
report("start-requested", attempt, {
|
|
720
|
+
transport: transportRef.current,
|
|
721
|
+
...opening !== void 0 && { opening }
|
|
722
|
+
});
|
|
491
723
|
try {
|
|
492
724
|
const transport = transportRef.current;
|
|
493
725
|
const mediaDevices = (_a = voiceGlobals.navigator) == null ? void 0 : _a.mediaDevices;
|
|
@@ -509,23 +741,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
509
741
|
const audioSession = audioSessionRef.current;
|
|
510
742
|
if (audioSession) {
|
|
511
743
|
stage = "audio-session";
|
|
512
|
-
await
|
|
513
|
-
if (attemptRef.current !== attempt) {
|
|
514
|
-
report("stale-attempt", attempt, { stage });
|
|
515
|
-
return;
|
|
516
|
-
}
|
|
517
|
-
startingAudioSessionRef.current = audioSession;
|
|
518
|
-
try {
|
|
519
|
-
await audioSession.start();
|
|
520
|
-
} finally {
|
|
521
|
-
startingAudioSessionRef.current = null;
|
|
522
|
-
}
|
|
523
|
-
activeAudioSessionRef.current = audioSession;
|
|
524
|
-
if (attemptRef.current !== attempt) {
|
|
525
|
-
stale();
|
|
526
|
-
return;
|
|
527
|
-
}
|
|
528
|
-
report("audio-session-ready", attempt);
|
|
744
|
+
if (!await acquireAudioSession({ attempt, audioSession })) return;
|
|
529
745
|
}
|
|
530
746
|
const modelOption = modelRef.current;
|
|
531
747
|
const requestedModel = typeof modelOption === "function" ? modelOption() : modelOption;
|
|
@@ -533,18 +749,22 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
533
749
|
const sendVoiceStart = (offer2) => sendCommand({
|
|
534
750
|
type: "voice/start",
|
|
535
751
|
offer: offer2,
|
|
536
|
-
|
|
752
|
+
attemptId,
|
|
753
|
+
...previousAttemptId !== void 0 && { previousAttemptId },
|
|
754
|
+
...model2 !== void 0 && { model: model2 },
|
|
755
|
+
...opening !== void 0 && { opening }
|
|
537
756
|
});
|
|
538
757
|
const negotiateStart = async (offer2) => {
|
|
539
758
|
stage = "negotiate";
|
|
540
759
|
const negotiationStartedAt = Date.now();
|
|
541
760
|
const commandPromise = sendVoiceStart(offer2).catch((commandError) => {
|
|
542
761
|
if (!isRecoveredCommandAuthRejection(commandError)) throw commandError;
|
|
762
|
+
if (attemptRef.current !== attempt) throw commandError;
|
|
543
763
|
return sendVoiceStart(offer2);
|
|
544
764
|
});
|
|
545
765
|
void commandPromise.then(() => {
|
|
546
766
|
if (attemptRef.current !== attempt)
|
|
547
|
-
void sendCommand({ type: "voice/end" }).catch(() => void 0);
|
|
767
|
+
void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
|
|
548
768
|
}).catch(() => void 0);
|
|
549
769
|
let answerTimer = null;
|
|
550
770
|
let result;
|
|
@@ -577,42 +797,24 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
577
797
|
try {
|
|
578
798
|
const room = parseVoiceLiveKitAnswer(answer2);
|
|
579
799
|
stage = "room";
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
micMuted: micMutedRef.current,
|
|
586
|
-
signal: controller.signal,
|
|
587
|
-
onDisconnected: (reason) => {
|
|
588
|
-
if (attemptRef.current !== attempt) return;
|
|
589
|
-
if (!joined) {
|
|
590
|
-
disconnectedWhileJoining = true;
|
|
591
|
-
return;
|
|
592
|
-
}
|
|
593
|
-
void handleMediaLossRef.current(attempt, reason);
|
|
594
|
-
}
|
|
800
|
+
const joinedRoom = await joinVoiceRoom({
|
|
801
|
+
attempt,
|
|
802
|
+
room,
|
|
803
|
+
adapter: livekitAdapter,
|
|
804
|
+
onDisconnectedAfterJoin: (reason) => void handleMediaLossRef.current(attempt, reason)
|
|
595
805
|
});
|
|
596
|
-
if (
|
|
597
|
-
releaseSafely(() => session.disconnect());
|
|
806
|
+
if (!joinedRoom) {
|
|
598
807
|
stale();
|
|
599
808
|
return;
|
|
600
809
|
}
|
|
601
|
-
if (disconnectedWhileJoining) {
|
|
602
|
-
releaseSafely(() => session.disconnect());
|
|
603
|
-
throw new Error("The voice room disconnected while joining");
|
|
604
|
-
}
|
|
605
|
-
joined = true;
|
|
606
|
-
livekitRef.current = session;
|
|
607
|
-
report("room-joined", attempt, { roomName: room.roomName });
|
|
608
810
|
} catch (roomError) {
|
|
609
811
|
if (attemptRef.current === attempt)
|
|
610
|
-
void sendCommand({ type: "voice/end" }).catch(() => void 0);
|
|
812
|
+
void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
|
|
611
813
|
throw roomError;
|
|
612
814
|
}
|
|
613
815
|
report("live", attempt, { transport, ...model2 !== void 0 && { model: model2 } });
|
|
614
816
|
if (micMutedRef.current) {
|
|
615
|
-
void sendCommand({ type: "voice/set-mic", paused: true }).catch(() => void 0);
|
|
817
|
+
void sendCommand({ type: "voice/set-mic", paused: true, attemptId }).catch(() => void 0);
|
|
616
818
|
}
|
|
617
819
|
setPhase("live");
|
|
618
820
|
setLiveSince(Date.now());
|
|
@@ -686,7 +888,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
686
888
|
});
|
|
687
889
|
report("live", attempt, { transport });
|
|
688
890
|
if (micMutedRef.current) {
|
|
689
|
-
void sendCommand({ type: "voice/set-mic", paused: true }).catch(() => void 0);
|
|
891
|
+
void sendCommand({ type: "voice/set-mic", paused: true, attemptId }).catch(() => void 0);
|
|
690
892
|
}
|
|
691
893
|
setPhase("live");
|
|
692
894
|
setLiveSince(Date.now());
|
|
@@ -706,7 +908,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
706
908
|
await ((_a2 = onRemoteStreamRef.current) == null ? void 0 : _a2.call(onRemoteStreamRef, remote));
|
|
707
909
|
} catch (playError) {
|
|
708
910
|
if (attemptRef.current !== attempt) return;
|
|
709
|
-
void sendCommand({ type: "voice/end" }).catch(() => void 0);
|
|
911
|
+
void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
|
|
710
912
|
fail({
|
|
711
913
|
kind: "playback_failed",
|
|
712
914
|
stage: "playback",
|
|
@@ -753,7 +955,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
753
955
|
}
|
|
754
956
|
report("live", attempt, { transport });
|
|
755
957
|
if (micMutedRef.current) {
|
|
756
|
-
void sendCommand({ type: "voice/set-mic", paused: true }).catch(() => void 0);
|
|
958
|
+
void sendCommand({ type: "voice/set-mic", paused: true, attemptId }).catch(() => void 0);
|
|
757
959
|
}
|
|
758
960
|
setPhase("live");
|
|
759
961
|
setLiveSince(Date.now());
|
|
@@ -766,10 +968,19 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
766
968
|
} finally {
|
|
767
969
|
startingRef.current = false;
|
|
768
970
|
}
|
|
769
|
-
}, [
|
|
770
|
-
|
|
971
|
+
}, [
|
|
972
|
+
acquireAudioSession,
|
|
973
|
+
fail,
|
|
974
|
+
joinVoiceRoom,
|
|
975
|
+
playRelayChunk,
|
|
976
|
+
releaseAudioSession,
|
|
977
|
+
report,
|
|
978
|
+
sendCommand,
|
|
979
|
+
watchConnection
|
|
980
|
+
]);
|
|
981
|
+
const startSession = require$$0.useCallback(async (options2 = {}) => {
|
|
771
982
|
if (pcRef.current || wsRef.current || livekitRef.current || startingRef.current) return;
|
|
772
|
-
const run = runStartSession();
|
|
983
|
+
const run = runStartSession(options2);
|
|
773
984
|
startPromiseRef.current = run;
|
|
774
985
|
try {
|
|
775
986
|
await run;
|
|
@@ -777,17 +988,21 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
777
988
|
if (startPromiseRef.current === run) startPromiseRef.current = null;
|
|
778
989
|
}
|
|
779
990
|
}, [runStartSession]);
|
|
780
|
-
const startRef =
|
|
991
|
+
const startRef = require$$0.useRef(startSession);
|
|
781
992
|
startRef.current = startSession;
|
|
782
|
-
const handleMediaLoss =
|
|
993
|
+
const handleMediaLoss = require$$0.useCallback(
|
|
783
994
|
async (attempt, reason) => {
|
|
784
995
|
if (attemptRef.current !== attempt) return;
|
|
996
|
+
if (ownerMovedAway()) {
|
|
997
|
+
handleMovedAway();
|
|
998
|
+
return;
|
|
999
|
+
}
|
|
785
1000
|
report("media-loss", attempt, {
|
|
786
1001
|
reason,
|
|
787
1002
|
restartBudgetLeft: !autoRestartedRef.current
|
|
788
1003
|
});
|
|
789
1004
|
if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
|
|
790
|
-
const ending = sendCommand({ type: "voice/end" }).catch(() => void 0);
|
|
1005
|
+
const ending = sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
|
|
791
1006
|
teardown();
|
|
792
1007
|
const recovery = attemptRef.current;
|
|
793
1008
|
setPhase("idle");
|
|
@@ -805,6 +1020,10 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
805
1020
|
const inflight = startPromiseRef.current;
|
|
806
1021
|
if (inflight) await inflight.catch(() => void 0);
|
|
807
1022
|
if (attemptRef.current !== recovery) return;
|
|
1023
|
+
if (ownerMovedAway()) {
|
|
1024
|
+
handleMovedAway();
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
808
1027
|
if (!autoRestartedRef.current) {
|
|
809
1028
|
autoRestartedRef.current = true;
|
|
810
1029
|
report("auto-restart", recovery, { trigger: "media-loss", reason });
|
|
@@ -827,54 +1046,245 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
827
1046
|
setFailure(lost);
|
|
828
1047
|
setPhase("error");
|
|
829
1048
|
},
|
|
830
|
-
[report, sendCommand, teardown]
|
|
1049
|
+
[handleMovedAway, ownerMovedAway, report, sendCommand, teardown]
|
|
831
1050
|
);
|
|
832
1051
|
handleMediaLossRef.current = handleMediaLoss;
|
|
833
|
-
const start =
|
|
1052
|
+
const start = require$$0.useCallback(async (options2) => {
|
|
834
1053
|
if (pcRef.current || wsRef.current || livekitRef.current || startingRef.current) return;
|
|
835
1054
|
micMutedRef.current = false;
|
|
836
1055
|
setMicMutedState(false);
|
|
837
1056
|
autoRestartedRef.current = false;
|
|
838
1057
|
setHandoffTask(null);
|
|
839
|
-
|
|
1058
|
+
setMovedTo(null);
|
|
1059
|
+
await startSession((options2 == null ? void 0 : options2.opening) === "recap" ? { opening: "recap" } : {});
|
|
840
1060
|
}, [startSession]);
|
|
841
|
-
const
|
|
1061
|
+
const runTransferHere = require$$0.useCallback(async () => {
|
|
1062
|
+
const attempt = attemptRef.current += 1;
|
|
1063
|
+
const attemptId = mintVoiceId({ kind: "attempt" });
|
|
1064
|
+
callAttemptIdRef.current = attemptId;
|
|
1065
|
+
ownClientIdRef.current = null;
|
|
1066
|
+
const transfer = { attempt, transferId: null };
|
|
1067
|
+
transferRef.current = transfer;
|
|
1068
|
+
startingRef.current = true;
|
|
1069
|
+
attemptStartedAtRef.current = Date.now();
|
|
1070
|
+
setFailure(null);
|
|
1071
|
+
setPhase("connecting");
|
|
1072
|
+
let stage = "preflight";
|
|
1073
|
+
const timeouts = timeoutsRef.current;
|
|
1074
|
+
const offerMs = Math.min((timeouts == null ? void 0 : timeouts.answerMs) ?? ANSWER_TIMEOUT_MS, TRANSFER_OFFER_TIMEOUT_MS);
|
|
1075
|
+
const commitMs = (timeouts == null ? void 0 : timeouts.transferCommitMs) ?? TRANSFER_COMMIT_TIMEOUT_MS;
|
|
1076
|
+
const cancel = () => {
|
|
1077
|
+
const transferId = transfer.transferId;
|
|
1078
|
+
if (transferId === null) return;
|
|
1079
|
+
void sendCommand({ type: "voice/transfer-cancel", transferId }).catch(() => void 0);
|
|
1080
|
+
};
|
|
1081
|
+
let promotedCallEnded = false;
|
|
1082
|
+
const endPromotedCall = () => {
|
|
1083
|
+
if (promotedCallEnded) return;
|
|
1084
|
+
promotedCallEnded = true;
|
|
1085
|
+
void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
|
|
1086
|
+
};
|
|
1087
|
+
const stale = () => {
|
|
1088
|
+
report("stale-attempt", attempt, { stage, transfer: true });
|
|
1089
|
+
if (transferRef.current === transfer) {
|
|
1090
|
+
transferRef.current = null;
|
|
1091
|
+
cancel();
|
|
1092
|
+
}
|
|
1093
|
+
releaseAudioSession();
|
|
1094
|
+
};
|
|
1095
|
+
const controller = new AbortController();
|
|
1096
|
+
livekitAbortRef.current = controller;
|
|
1097
|
+
const superseded = new Promise((_, reject) => {
|
|
1098
|
+
controller.signal.addEventListener("abort", () => reject(new Error("The move was superseded")), {
|
|
1099
|
+
once: true
|
|
1100
|
+
});
|
|
1101
|
+
});
|
|
1102
|
+
void superseded.catch(() => void 0);
|
|
1103
|
+
report("start-requested", attempt, { transport: "livekit", transfer: true });
|
|
1104
|
+
try {
|
|
1105
|
+
const livekitAdapter = livekitAdapterRef.current;
|
|
1106
|
+
if (transportRef.current !== "livekit" || !livekitAdapter)
|
|
1107
|
+
throw new Error("Voice is unavailable in this environment");
|
|
1108
|
+
const audioSession = audioSessionRef.current;
|
|
1109
|
+
if (audioSession) {
|
|
1110
|
+
stage = "audio-session";
|
|
1111
|
+
if (!await acquireAudioSession({ attempt, audioSession })) {
|
|
1112
|
+
stale();
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
stage = "negotiate";
|
|
1117
|
+
const negotiationStartedAt = Date.now();
|
|
1118
|
+
const offer = sendCommand({ type: "voice/transfer-offer", attemptId });
|
|
1119
|
+
void offer.then((result) => {
|
|
1120
|
+
if (attemptRef.current === attempt) return;
|
|
1121
|
+
const { transferId } = readTransferOffer(result);
|
|
1122
|
+
if (transferId !== null)
|
|
1123
|
+
void sendCommand({ type: "voice/transfer-cancel", transferId }).catch(() => void 0);
|
|
1124
|
+
}).catch(() => void 0);
|
|
1125
|
+
const offered = readTransferOffer(
|
|
1126
|
+
await withAnswerDeadline(Promise.race([offer, superseded]), offerMs)
|
|
1127
|
+
);
|
|
1128
|
+
report("answer-received", attempt, {
|
|
1129
|
+
negotiationMs: Date.now() - negotiationStartedAt,
|
|
1130
|
+
transfer: true
|
|
1131
|
+
});
|
|
1132
|
+
if (attemptRef.current !== attempt) {
|
|
1133
|
+
stale();
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
stage = "answer";
|
|
1137
|
+
transfer.transferId = offered.transferId;
|
|
1138
|
+
if (offered.transferId === null || offered.answer === null)
|
|
1139
|
+
throw new VoiceNoAnswerError("voice/transfer-offer returned no voice room");
|
|
1140
|
+
const room = parseVoiceLiveKitAnswer(offered.answer);
|
|
1141
|
+
stage = "room";
|
|
1142
|
+
let moved = false;
|
|
1143
|
+
let roomDropped = () => void 0;
|
|
1144
|
+
const dropped = new Promise((_, reject) => {
|
|
1145
|
+
roomDropped = (reason) => reject(new VoiceTransferRoomDroppedError(reason));
|
|
1146
|
+
});
|
|
1147
|
+
void dropped.catch(() => void 0);
|
|
1148
|
+
const joinedRoom = await joinVoiceRoom({
|
|
1149
|
+
attempt,
|
|
1150
|
+
room,
|
|
1151
|
+
adapter: livekitAdapter,
|
|
1152
|
+
controller,
|
|
1153
|
+
onDisconnectedAfterJoin: (reason) => {
|
|
1154
|
+
if (moved) void handleMediaLossRef.current(attempt, reason);
|
|
1155
|
+
else roomDropped(reason);
|
|
1156
|
+
}
|
|
1157
|
+
});
|
|
1158
|
+
if (!joinedRoom) {
|
|
1159
|
+
stale();
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
stage = "commit";
|
|
1163
|
+
const commit = sendCommand({
|
|
1164
|
+
type: "voice/transfer-commit",
|
|
1165
|
+
transferId: offered.transferId,
|
|
1166
|
+
attemptId
|
|
1167
|
+
});
|
|
1168
|
+
void commit.then(
|
|
1169
|
+
() => {
|
|
1170
|
+
if (attemptRef.current !== attempt) endPromotedCall();
|
|
1171
|
+
},
|
|
1172
|
+
(commitError) => {
|
|
1173
|
+
if (attemptRef.current === attempt) return;
|
|
1174
|
+
const failure2 = readSendFailure(commitError);
|
|
1175
|
+
if (failure2 !== null && failure2.fate !== "rejected") endPromotedCall();
|
|
1176
|
+
}
|
|
1177
|
+
);
|
|
1178
|
+
await withAnswerDeadline(Promise.race([commit, dropped, superseded]), commitMs);
|
|
1179
|
+
if (attemptRef.current !== attempt) {
|
|
1180
|
+
stale();
|
|
1181
|
+
return;
|
|
1182
|
+
}
|
|
1183
|
+
moved = true;
|
|
1184
|
+
transferRef.current = null;
|
|
1185
|
+
report("live", attempt, { transport: "livekit", transfer: true });
|
|
1186
|
+
setPhase("live");
|
|
1187
|
+
setLiveSince(Date.now());
|
|
1188
|
+
} catch (transferError) {
|
|
1189
|
+
if (attemptRef.current !== attempt) {
|
|
1190
|
+
stale();
|
|
1191
|
+
return;
|
|
1192
|
+
}
|
|
1193
|
+
cancel();
|
|
1194
|
+
const sendFailure = readSendFailure(transferError);
|
|
1195
|
+
if (stage === "commit" && sendFailure !== null && sendFailure.fate !== "rejected")
|
|
1196
|
+
endPromotedCall();
|
|
1197
|
+
transferRef.current = null;
|
|
1198
|
+
fail(classifyTransferFailure(transferError, stage));
|
|
1199
|
+
} finally {
|
|
1200
|
+
startingRef.current = false;
|
|
1201
|
+
}
|
|
1202
|
+
}, [acquireAudioSession, fail, joinVoiceRoom, releaseAudioSession, report, sendCommand]);
|
|
1203
|
+
const transferHere = require$$0.useCallback(async () => {
|
|
1204
|
+
if (pcRef.current || wsRef.current || livekitRef.current || startingRef.current) return;
|
|
1205
|
+
if (liveElsewhereRef.current === null) return;
|
|
1206
|
+
micMutedRef.current = false;
|
|
1207
|
+
setMicMutedState(false);
|
|
1208
|
+
autoRestartedRef.current = false;
|
|
1209
|
+
setHandoffTask(null);
|
|
1210
|
+
setMovedTo(null);
|
|
1211
|
+
const run = runTransferHere();
|
|
1212
|
+
startPromiseRef.current = run;
|
|
1213
|
+
try {
|
|
1214
|
+
await run;
|
|
1215
|
+
} finally {
|
|
1216
|
+
if (startPromiseRef.current === run) startPromiseRef.current = null;
|
|
1217
|
+
}
|
|
1218
|
+
}, [runTransferHere]);
|
|
1219
|
+
const releaseCall = require$$0.useCallback(() => {
|
|
1220
|
+
const transfer = transferRef.current;
|
|
1221
|
+
transferRef.current = null;
|
|
1222
|
+
if (transfer !== null) {
|
|
1223
|
+
if (transfer.transferId !== null) {
|
|
1224
|
+
void sendCommand({ type: "voice/transfer-cancel", transferId: transfer.transferId }).catch(
|
|
1225
|
+
() => void 0
|
|
1226
|
+
);
|
|
1227
|
+
}
|
|
1228
|
+
return;
|
|
1229
|
+
}
|
|
1230
|
+
void sendCommand({ type: "voice/end", attemptId: callAttemptIdRef.current }).catch(() => void 0);
|
|
1231
|
+
}, [sendCommand]);
|
|
1232
|
+
const end = require$$0.useCallback(() => {
|
|
842
1233
|
if (phase === "connecting" || phase === "live") {
|
|
843
1234
|
report("end", attemptRef.current, { source: "user", phase });
|
|
844
|
-
|
|
845
|
-
|
|
1235
|
+
const moving = transferRef.current !== null;
|
|
1236
|
+
releaseCall();
|
|
1237
|
+
if (!moving && lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
|
|
846
1238
|
}
|
|
847
1239
|
teardown();
|
|
848
1240
|
micMutedRef.current = false;
|
|
849
1241
|
setMicMutedState(false);
|
|
850
1242
|
setPhase("idle");
|
|
851
|
-
}, [phase,
|
|
852
|
-
const setMicMuted =
|
|
1243
|
+
}, [phase, releaseCall, report, teardown]);
|
|
1244
|
+
const setMicMuted = require$$0.useCallback(
|
|
853
1245
|
(muted) => {
|
|
854
1246
|
if (phase !== "live") return;
|
|
855
1247
|
const attempt = attemptRef.current;
|
|
1248
|
+
const attemptId = callAttemptIdRef.current;
|
|
856
1249
|
const change = ++micChangeRef.current;
|
|
857
1250
|
const applyLocal = (value) => {
|
|
858
1251
|
var _a;
|
|
859
1252
|
micMutedRef.current = value;
|
|
860
1253
|
setMicMutedState(value);
|
|
861
|
-
for (const track of ((_a = streamRef.current) == null ? void 0 : _a.getTracks()) ?? []) track.enabled = !value;
|
|
862
1254
|
const room = livekitRef.current;
|
|
863
|
-
|
|
1255
|
+
const mediaFailed = () => {
|
|
1256
|
+
if (attemptRef.current !== attempt || micChangeRef.current !== change || livekitRef.current !== room) return;
|
|
1257
|
+
void sendCommand({ type: "voice/end", attemptId }).catch(() => void 0);
|
|
1258
|
+
if (lastActiveTaskRef.current) setHandoffTask(lastActiveTaskRef.current);
|
|
1259
|
+
fail({
|
|
1260
|
+
kind: "media_lost",
|
|
1261
|
+
stage: "media",
|
|
1262
|
+
reason: "microphone-control-failed",
|
|
1263
|
+
message: "Voice ended because the microphone could not be changed. Start a new call to try again."
|
|
1264
|
+
});
|
|
1265
|
+
};
|
|
1266
|
+
try {
|
|
1267
|
+
for (const track of ((_a = streamRef.current) == null ? void 0 : _a.getTracks()) ?? []) track.enabled = !value;
|
|
1268
|
+
if (room) void room.setMicrophoneEnabled(!value).catch(mediaFailed);
|
|
1269
|
+
return true;
|
|
1270
|
+
} catch {
|
|
1271
|
+
mediaFailed();
|
|
1272
|
+
return false;
|
|
1273
|
+
}
|
|
864
1274
|
};
|
|
865
|
-
applyLocal(muted);
|
|
866
|
-
void sendCommand({ type: "voice/set-mic", paused: muted }).catch(() => {
|
|
1275
|
+
if (!applyLocal(muted)) return;
|
|
1276
|
+
void sendCommand({ type: "voice/set-mic", paused: muted, attemptId }).catch(() => {
|
|
867
1277
|
if (!muted && attemptRef.current === attempt && micChangeRef.current === change) {
|
|
868
1278
|
applyLocal(true);
|
|
869
1279
|
}
|
|
870
1280
|
});
|
|
871
1281
|
},
|
|
872
|
-
[phase, sendCommand]
|
|
1282
|
+
[phase, sendCommand, fail]
|
|
873
1283
|
);
|
|
874
1284
|
const sessionGone = reactStatewire.useStatewireState(
|
|
875
1285
|
(s) => statewireState.isDeepAgentStateHydrated(s) && (statewireState.readDeepAgentStreamValues(s).voice ?? null) === null
|
|
876
1286
|
);
|
|
877
|
-
|
|
1287
|
+
require$$0.useEffect(() => {
|
|
878
1288
|
var _a;
|
|
879
1289
|
if (phase !== "live" || !sessionGone) return;
|
|
880
1290
|
report("server-ended", attemptRef.current, {
|
|
@@ -889,7 +1299,19 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
889
1299
|
void ((_a = startRef.current) == null ? void 0 : _a.call(startRef));
|
|
890
1300
|
}
|
|
891
1301
|
}, [phase, report, sessionGone, teardown]);
|
|
892
|
-
|
|
1302
|
+
require$$0.useEffect(() => {
|
|
1303
|
+
if (phase !== "live" || !transferCapable || wireOwnerId === null) return;
|
|
1304
|
+
const own = ownClientIdRef.current;
|
|
1305
|
+
if (own === null) {
|
|
1306
|
+
const fence = observedAttemptRef.current;
|
|
1307
|
+
if (fence !== void 0 && fence !== callAttemptIdRef.current) return;
|
|
1308
|
+
ownClientIdRef.current = wireOwnerId;
|
|
1309
|
+
lastOwnedClientIdRef.current = wireOwnerId;
|
|
1310
|
+
return;
|
|
1311
|
+
}
|
|
1312
|
+
if (wireOwnerId !== own) handleMovedAway();
|
|
1313
|
+
}, [phase, transferCapable, wireOwnerId, observedAttempt, handleMovedAway]);
|
|
1314
|
+
require$$0.useEffect(
|
|
893
1315
|
() => () => {
|
|
894
1316
|
const phaseAtUnmount = phaseRef.current;
|
|
895
1317
|
if (phaseAtUnmount === "connecting" || phaseAtUnmount === "live") {
|
|
@@ -897,14 +1319,15 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
897
1319
|
source: "unmount",
|
|
898
1320
|
phase: phaseAtUnmount
|
|
899
1321
|
});
|
|
900
|
-
|
|
1322
|
+
releaseCall();
|
|
901
1323
|
}
|
|
1324
|
+
transferRef.current = null;
|
|
902
1325
|
teardown();
|
|
903
1326
|
},
|
|
904
|
-
[
|
|
1327
|
+
[releaseCall, report, teardown]
|
|
905
1328
|
);
|
|
906
1329
|
const activeTask = (voice == null ? void 0 : voice.activeTask) ?? null;
|
|
907
|
-
|
|
1330
|
+
require$$0.useEffect(() => {
|
|
908
1331
|
if (phase === "live") lastActiveTaskRef.current = activeTask;
|
|
909
1332
|
else if (phase === "idle" || phase === "error") lastActiveTaskRef.current = null;
|
|
910
1333
|
}, [phase, activeTask]);
|
|
@@ -913,7 +1336,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
913
1336
|
const status = statewireState.readDeepAgentStreamValues(s).status;
|
|
914
1337
|
return status === "running" || status === "stopping" || status === "input-required";
|
|
915
1338
|
});
|
|
916
|
-
|
|
1339
|
+
require$$0.useEffect(() => {
|
|
917
1340
|
if (handoffTask !== null && !handoffRunActive) setHandoffTask(null);
|
|
918
1341
|
}, [handoffTask, handoffRunActive]);
|
|
919
1342
|
const wireError = reactStatewire.useStatewireState(
|
|
@@ -928,32 +1351,32 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
928
1351
|
const wireModelOptions = reactStatewire.useStatewireState(
|
|
929
1352
|
(s) => statewireState.isDeepAgentStateHydrated(s) ? statewireState.readDeepAgentStreamValues(s).voiceModelOptions ?? null : null
|
|
930
1353
|
);
|
|
931
|
-
const modelOptionsRef =
|
|
932
|
-
const modelOptions =
|
|
1354
|
+
const modelOptionsRef = require$$0.useRef(null);
|
|
1355
|
+
const modelOptions = require$$0.useMemo(() => {
|
|
933
1356
|
const next = parseVoiceModelOptions(wireModelOptions);
|
|
934
1357
|
const previous = modelOptionsRef.current;
|
|
935
1358
|
if (previous !== null && next !== null && sameVoiceModelOptions(previous, next)) return previous;
|
|
936
1359
|
modelOptionsRef.current = next;
|
|
937
1360
|
return next;
|
|
938
1361
|
}, [wireModelOptions]);
|
|
939
|
-
const syncProfile =
|
|
1362
|
+
const syncProfile = require$$0.useCallback(() => {
|
|
940
1363
|
if (phase !== "connecting" && phase !== "live") return;
|
|
941
|
-
void sendCommand({ type: "voice/profile-sync" }).catch(() => void 0);
|
|
1364
|
+
void sendCommand({ type: "voice/profile-sync", attemptId: callAttemptIdRef.current }).catch(() => void 0);
|
|
942
1365
|
}, [phase, sendCommand]);
|
|
943
|
-
const sendContext =
|
|
1366
|
+
const sendContext = require$$0.useCallback(
|
|
944
1367
|
(text) => {
|
|
945
1368
|
const trimmed = text.trim();
|
|
946
1369
|
if (phase !== "live" || !trimmed) return;
|
|
947
|
-
void sendCommand({ type: "voice/context", text: trimmed }).catch(() => void 0);
|
|
1370
|
+
void sendCommand({ type: "voice/context", text: trimmed, attemptId: callAttemptIdRef.current }).catch(() => void 0);
|
|
948
1371
|
},
|
|
949
1372
|
[phase, sendCommand]
|
|
950
1373
|
);
|
|
951
|
-
const sendUserText =
|
|
1374
|
+
const sendUserText = require$$0.useCallback(
|
|
952
1375
|
async (text) => {
|
|
953
1376
|
if (phase !== "live" || !text.trim()) return false;
|
|
954
|
-
const messageId =
|
|
1377
|
+
const messageId = mintVoiceId({ kind: "text" });
|
|
955
1378
|
try {
|
|
956
|
-
await sendCommand({ type: "voice/user-text", text, messageId });
|
|
1379
|
+
await sendCommand({ type: "voice/user-text", text, messageId, attemptId: callAttemptIdRef.current });
|
|
957
1380
|
return true;
|
|
958
1381
|
} catch {
|
|
959
1382
|
return false;
|
|
@@ -961,7 +1384,7 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
961
1384
|
},
|
|
962
1385
|
[phase, sendCommand]
|
|
963
1386
|
);
|
|
964
|
-
return
|
|
1387
|
+
return require$$0.useMemo(
|
|
965
1388
|
() => ({
|
|
966
1389
|
phase,
|
|
967
1390
|
error,
|
|
@@ -978,7 +1401,10 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
978
1401
|
notice,
|
|
979
1402
|
sendContext,
|
|
980
1403
|
model,
|
|
981
|
-
modelOptions
|
|
1404
|
+
modelOptions,
|
|
1405
|
+
liveElsewhere,
|
|
1406
|
+
transferHere,
|
|
1407
|
+
movedTo
|
|
982
1408
|
}),
|
|
983
1409
|
[
|
|
984
1410
|
phase,
|
|
@@ -996,24 +1422,36 @@ const useDeepAgentVoice = (options = {}) => {
|
|
|
996
1422
|
notice,
|
|
997
1423
|
sendContext,
|
|
998
1424
|
model,
|
|
999
|
-
modelOptions
|
|
1425
|
+
modelOptions,
|
|
1426
|
+
liveElsewhere,
|
|
1427
|
+
transferHere,
|
|
1428
|
+
movedTo
|
|
1000
1429
|
]
|
|
1001
1430
|
);
|
|
1002
1431
|
};
|
|
1432
|
+
exports.VOICE_CONTINUE_BY_VOICE_LABEL = VOICE_CONTINUE_BY_VOICE_LABEL;
|
|
1003
1433
|
exports.VOICE_LIVEKIT_ANSWER_PREFIX = VOICE_LIVEKIT_ANSWER_PREFIX;
|
|
1004
1434
|
exports.VOICE_LIVEKIT_OFFER = VOICE_LIVEKIT_OFFER;
|
|
1435
|
+
exports.VOICE_MOVED_NOTICE_MS = VOICE_MOVED_NOTICE_MS;
|
|
1436
|
+
exports.VOICE_MOVE_CALL_HERE_LABEL = VOICE_MOVE_CALL_HERE_LABEL;
|
|
1437
|
+
exports.VOICE_MOVE_HERE_ACTION = VOICE_MOVE_HERE_ACTION;
|
|
1005
1438
|
exports.VOICE_RELAY_ANSWER_PREFIX = VOICE_RELAY_ANSWER_PREFIX;
|
|
1006
1439
|
exports.VOICE_RELAY_SAMPLE_RATE = VOICE_RELAY_SAMPLE_RATE;
|
|
1007
1440
|
exports.VOICE_WEBSOCKET_OFFER = VOICE_WEBSOCKET_OFFER;
|
|
1008
1441
|
exports.classifyVoiceStartError = classifyVoiceStartError;
|
|
1009
1442
|
exports.describeVoiceFailure = describeVoiceFailure;
|
|
1443
|
+
exports.describeVoiceLiveElsewhere = describeVoiceLiveElsewhere;
|
|
1444
|
+
exports.describeVoiceMovedTo = describeVoiceMovedTo;
|
|
1010
1445
|
exports.describeVoiceWireError = describeVoiceWireError;
|
|
1011
1446
|
exports.float32FromPcm16 = float32FromPcm16;
|
|
1012
1447
|
exports.formatVoiceElapsed = formatVoiceElapsed;
|
|
1013
1448
|
exports.parseVoiceLiveKitAnswer = parseVoiceLiveKitAnswer;
|
|
1014
1449
|
exports.parseVoiceModelOptions = parseVoiceModelOptions;
|
|
1450
|
+
exports.parseVoiceOwner = parseVoiceOwner;
|
|
1015
1451
|
exports.pcm16FromFloat32 = pcm16FromFloat32;
|
|
1016
1452
|
exports.useDeepAgentVoice = useDeepAgentVoice;
|
|
1017
1453
|
exports.useVoiceElapsed = useVoiceElapsed;
|
|
1454
|
+
exports.useVoiceMovedNotice = useVoiceMovedNotice;
|
|
1018
1455
|
exports.voiceRelayUrl = voiceRelayUrl;
|
|
1456
|
+
exports.voiceSurfaceLabel = voiceSurfaceLabel;
|
|
1019
1457
|
//# sourceMappingURL=use-deep-agent-voice.cjs.map
|