@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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audio-level-history.cjs","sources":["../../src/dictation/audio-level-history.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * A rolling window of microphone levels (0..1), newest last, for the\n * composer's waveform strip. `size` slots are always present: unfilled slots\n * are `null` so the strip can draw them as the resting dotted baseline.\n */\nexport type AudioLevelHistory = ReadonlyArray<number | null>;\n\nexport function emptyAudioLevelHistory(size: number): AudioLevelHistory {\n return new Array<number | null>(Math.max(0, size)).fill(null);\n}\n\n/** Append one level, dropping the oldest slot. Pure. */\nexport function pushAudioLevel(history: AudioLevelHistory, level: number): AudioLevelHistory {\n if (history.length === 0) return history;\n const clamped = Math.min(1, Math.max(0, level));\n return [...history.slice(1), clamped];\n}\n\n/**\n * RMS of a PCM sample window scaled to 0..1 for display. Speech peaks sit\n * around 0.1-0.3 RMS, so a gain lifts them into the visible range while the\n * noise floor (about 0.005) stays flat.\n */\nexport function displayLevelFromSamples(samples: ArrayLike<number>, gain = 4): number {\n if (samples.length === 0) return 0;\n let sum = 0;\n for (let i = 0; i < samples.length; i += 1) {\n const sample = samples[i] ?? 0;\n sum += sample * sample;\n }\n const rms = Math.sqrt(sum / samples.length);\n return Math.min(1, rms * gain);\n}\n\ninterface UseAudioLevelHistoryOptions {\n /** Number of bars in the strip. */\n size: number;\n /** Sample cadence in ms; 50ms gives ~20 bars per second. */\n intervalMs?: number;\n}\n\n/**\n * Sample a `MediaStream` through an `AnalyserNode` into a rolling level\n * history. Returns the resting baseline when `stream` is null.\n */\nexport function useAudioLevelHistory(\n stream: MediaStream | null,\n { size, intervalMs = 50 }: UseAudioLevelHistoryOptions,\n): AudioLevelHistory {\n const [history, setHistory] = useState<AudioLevelHistory>(() => emptyAudioLevelHistory(size));\n\n useEffect(() => {\n setHistory(emptyAudioLevelHistory(size));\n if (!stream || typeof window === 'undefined') return;\n const AudioContextCtor =\n window.AudioContext ??\n (window as typeof window & { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;\n if (!AudioContextCtor) return;\n\n let audioContext: AudioContext;\n try {\n audioContext = new AudioContextCtor();\n } catch {\n return;\n }\n const analyser = audioContext.createAnalyser();\n analyser.fftSize = 1024;\n analyser.smoothingTimeConstant = 0;\n let source: MediaStreamAudioSourceNode | null = null;\n try {\n source = audioContext.createMediaStreamSource(stream);\n source.connect(analyser);\n } catch {\n void audioContext.close();\n return;\n }\n const samples = new Float32Array(analyser.fftSize);\n const interval = window.setInterval(() => {\n analyser.getFloatTimeDomainData(samples);\n const level = displayLevelFromSamples(samples);\n setHistory((current) => pushAudioLevel(current, level));\n }, intervalMs);\n\n return () => {\n window.clearInterval(interval);\n try {\n source?.disconnect();\n analyser.disconnect();\n } catch {\n // Already disconnected.\n }\n void audioContext.close();\n };\n }, [stream, size, intervalMs]);\n\n return history;\n}\n"],"names":["useState","useEffect"],"mappings":";;;AASO,SAAS,uBAAuB,MAAiC;AACtE,SAAO,IAAI,MAAqB,KAAK,IAAI,GAAG,IAAI,CAAC,EAAE,KAAK,IAAI;AAC9D;AAGO,SAAS,eAAe,SAA4B,OAAkC;AAC3F,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC;AAC9C,SAAO,CAAC,GAAG,QAAQ,MAAM,CAAC,GAAG,OAAO;AACtC;AAOO,SAAS,wBAAwB,SAA4B,OAAO,GAAW;AACpF,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,MAAI,MAAM;AACV,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK,GAAG;AAC1C,UAAM,SAAS,QAAQ,CAAC,KAAK;AAC7B,WAAO,SAAS;AAAA,EAClB;AACA,QAAM,MAAM,KAAK,KAAK,MAAM,QAAQ,MAAM;AAC1C,SAAO,KAAK,IAAI,GAAG,MAAM,IAAI;AAC/B;AAaO,SAAS,qBACd,QACA,EAAE,MAAM,aAAa,MACF;AACnB,QAAM,CAAC,SAAS,UAAU,IAAIA,
|
|
1
|
+
{"version":3,"file":"audio-level-history.cjs","sources":["../../src/dictation/audio-level-history.ts"],"sourcesContent":["import { useEffect, useState } from 'react';\n\n/**\n * A rolling window of microphone levels (0..1), newest last, for the\n * composer's waveform strip. `size` slots are always present: unfilled slots\n * are `null` so the strip can draw them as the resting dotted baseline.\n */\nexport type AudioLevelHistory = ReadonlyArray<number | null>;\n\nexport function emptyAudioLevelHistory(size: number): AudioLevelHistory {\n return new Array<number | null>(Math.max(0, size)).fill(null);\n}\n\n/** Append one level, dropping the oldest slot. Pure. */\nexport function pushAudioLevel(history: AudioLevelHistory, level: number): AudioLevelHistory {\n if (history.length === 0) return history;\n const clamped = Math.min(1, Math.max(0, level));\n return [...history.slice(1), clamped];\n}\n\n/**\n * RMS of a PCM sample window scaled to 0..1 for display. Speech peaks sit\n * around 0.1-0.3 RMS, so a gain lifts them into the visible range while the\n * noise floor (about 0.005) stays flat.\n */\nexport function displayLevelFromSamples(samples: ArrayLike<number>, gain = 4): number {\n if (samples.length === 0) return 0;\n let sum = 0;\n for (let i = 0; i < samples.length; i += 1) {\n const sample = samples[i] ?? 0;\n sum += sample * sample;\n }\n const rms = Math.sqrt(sum / samples.length);\n return Math.min(1, rms * gain);\n}\n\ninterface UseAudioLevelHistoryOptions {\n /** Number of bars in the strip. */\n size: number;\n /** Sample cadence in ms; 50ms gives ~20 bars per second. */\n intervalMs?: number;\n}\n\n/**\n * Sample a `MediaStream` through an `AnalyserNode` into a rolling level\n * history. Returns the resting baseline when `stream` is null.\n */\nexport function useAudioLevelHistory(\n stream: MediaStream | null,\n { size, intervalMs = 50 }: UseAudioLevelHistoryOptions,\n): AudioLevelHistory {\n const [history, setHistory] = useState<AudioLevelHistory>(() => emptyAudioLevelHistory(size));\n\n useEffect(() => {\n setHistory(emptyAudioLevelHistory(size));\n if (!stream || typeof window === 'undefined') return;\n const AudioContextCtor =\n window.AudioContext ??\n (window as typeof window & { webkitAudioContext?: typeof AudioContext }).webkitAudioContext;\n if (!AudioContextCtor) return;\n\n let audioContext: AudioContext;\n try {\n audioContext = new AudioContextCtor();\n } catch {\n return;\n }\n const analyser = audioContext.createAnalyser();\n analyser.fftSize = 1024;\n analyser.smoothingTimeConstant = 0;\n let source: MediaStreamAudioSourceNode | null = null;\n try {\n source = audioContext.createMediaStreamSource(stream);\n source.connect(analyser);\n } catch {\n void audioContext.close();\n return;\n }\n const samples = new Float32Array(analyser.fftSize);\n const interval = window.setInterval(() => {\n analyser.getFloatTimeDomainData(samples);\n const level = displayLevelFromSamples(samples);\n setHistory((current) => pushAudioLevel(current, level));\n }, intervalMs);\n\n return () => {\n window.clearInterval(interval);\n try {\n source?.disconnect();\n analyser.disconnect();\n } catch {\n // Already disconnected.\n }\n void audioContext.close();\n };\n }, [stream, size, intervalMs]);\n\n return history;\n}\n"],"names":["useState","useEffect"],"mappings":";;;AASO,SAAS,uBAAuB,MAAiC;AACtE,SAAO,IAAI,MAAqB,KAAK,IAAI,GAAG,IAAI,CAAC,EAAE,KAAK,IAAI;AAC9D;AAGO,SAAS,eAAe,SAA4B,OAAkC;AAC3F,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,QAAM,UAAU,KAAK,IAAI,GAAG,KAAK,IAAI,GAAG,KAAK,CAAC;AAC9C,SAAO,CAAC,GAAG,QAAQ,MAAM,CAAC,GAAG,OAAO;AACtC;AAOO,SAAS,wBAAwB,SAA4B,OAAO,GAAW;AACpF,MAAI,QAAQ,WAAW,EAAG,QAAO;AACjC,MAAI,MAAM;AACV,WAAS,IAAI,GAAG,IAAI,QAAQ,QAAQ,KAAK,GAAG;AAC1C,UAAM,SAAS,QA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
|
4
4
|
const lucideReact = require("lucide-react");
|
|
5
5
|
const tooltipIconButton = require("../chat/tooltip-icon-button.cjs");
|
|
6
6
|
const cnfast = require("cnfast");
|
|
7
|
-
const DictationMicButton = ({
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
7
|
+
const DictationMicButton = ({ onClick, disabled, className, title = "Dictate a message", disabledReason = null }) => {
|
|
8
|
+
const unavailable = Boolean(disabledReason);
|
|
9
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
10
|
+
tooltipIconButton.TooltipIconButton,
|
|
11
|
+
{
|
|
12
|
+
tooltip: disabledReason || title,
|
|
13
|
+
side: "bottom",
|
|
14
|
+
type: "button",
|
|
15
|
+
variant: "ghost",
|
|
16
|
+
size: "icon",
|
|
17
|
+
className: cnfast.cn(
|
|
18
|
+
"aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground",
|
|
19
|
+
className,
|
|
20
|
+
unavailable && "cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground"
|
|
21
|
+
),
|
|
22
|
+
"aria-label": title,
|
|
23
|
+
"aria-disabled": unavailable || void 0,
|
|
24
|
+
"data-unavailable": unavailable || void 0,
|
|
25
|
+
onClick: unavailable ? void 0 : onClick,
|
|
26
|
+
disabled: !unavailable && disabled,
|
|
27
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(lucideReact.MicIcon, { className: "aui-composer-dictate-icon size-4" })
|
|
28
|
+
}
|
|
29
|
+
);
|
|
30
|
+
};
|
|
27
31
|
const DictationCancelButton = ({ onClick, disabled, className }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
28
32
|
tooltipIconButton.TooltipIconButton,
|
|
29
33
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictation-controls.cjs","sources":["../../src/dictation/dictation-controls.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { MicIcon, SquareIcon, XIcon } from 'lucide-react';\nimport { TooltipIconButton } from '../chat/tooltip-icon-button';\nimport { cn } from '../lib/utils';\n\ninterface DictationControlProps {\n onClick: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n
|
|
1
|
+
{"version":3,"file":"dictation-controls.cjs","sources":["../../src/dictation/dictation-controls.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { MicIcon, SquareIcon, XIcon } from 'lucide-react';\nimport { TooltipIconButton } from '../chat/tooltip-icon-button';\nimport { cn } from '../lib/utils';\n\ninterface DictationControlProps {\n onClick: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Toolbar mic: starts a dictation session. With a `disabledReason` (Athena can't be reached, so\n * nothing could transcribe) it shows off with the reason as its tooltip, keeping its pointer and\n * focus so the reason reads, and starts nothing.\n */\nexport const DictationMicButton: FC<\n DictationControlProps & { title?: string; disabledReason?: string | null }\n> = ({ onClick, disabled, className, title = 'Dictate a message', disabledReason = null }) => {\n const unavailable = Boolean(disabledReason);\n return (\n <TooltipIconButton\n tooltip={disabledReason || title}\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\n 'aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground',\n className,\n unavailable && 'cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground',\n )}\n aria-label={title}\n aria-disabled={unavailable || undefined}\n data-unavailable={unavailable || undefined}\n onClick={unavailable ? undefined : onClick}\n disabled={!unavailable && disabled}\n >\n <MicIcon className=\"aui-composer-dictate-icon size-4\" />\n </TooltipIconButton>\n );\n};\n\n/** Recording mode, left side: discard the session. */\nexport const DictationCancelButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Cancel dictation\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-cancel size-8 rounded-full', className)}\n aria-label=\"Cancel dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <XIcon className=\"size-4\" />\n </TooltipIconButton>\n);\n\n/** Recording mode, right side: stop and put the words in the composer. */\nexport const DictationStopButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Stop and review\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-stop size-8 rounded-full', className)}\n aria-label=\"Stop dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <SquareIcon className=\"size-3 fill-current\" />\n </TooltipIconButton>\n);\n"],"names":["jsx","TooltipIconButton","cn","MicIcon","XIcon","SquareIcon"],"mappings":";;;;;;AAgBO,MAAM,qBAET,CAAC,EAAE,SAAS,UAAU,WAAW,QAAQ,qBAAqB,iBAAiB,WAAW;AAC5F,QAAM,cAAc,QAAQ,cAAc;AAC1C,SACEA,2BAAAA;AAAAA,IAACC,kBAAAA;AAAAA,IAAA;AAAA,MACC,SAAS,kBAAkB;AAAA,MAC3B,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAWC,OAAAA;AAAAA,QACT;AAAA,QACA;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,MAEjB,cAAY;AAAA,MACZ,iBAAe,eAAe;AAAA,MAC9B,oBAAkB,eAAe;AAAA,MACjC,SAAS,cAAc,SAAY;AAAA,MACnC,UAAU,CAAC,eAAe;AAAA,MAE1B,UAAAF,2BAAAA,IAACG,YAAAA,SAAA,EAAQ,WAAU,mCAAA,CAAmC;AAAA,IAAA;AAAA,EAAA;AAG5D;AAGO,MAAM,wBAAmD,CAAC,EAAE,SAAS,UAAU,gBACpFH,2BAAAA;AAAAA,EAACC,kBAAAA;AAAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAWC,OAAAA,GAAG,mDAAmD,SAAS;AAAA,IAC1E,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAAF,2BAAAA,IAACI,YAAAA,OAAA,EAAM,WAAU,SAAA,CAAS;AAAA,EAAA;AAC5B;AAIK,MAAM,sBAAiD,CAAC,EAAE,SAAS,UAAU,gBAClFJ,2BAAAA;AAAAA,EAACC,kBAAAA;AAAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAWC,OAAAA,GAAG,iDAAiD,SAAS;AAAA,IACxE,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAAF,2BAAAA,IAACK,YAAAA,YAAA,EAAW,WAAU,sBAAA,CAAsB;AAAA,EAAA;AAC9C;;;;"}
|
|
@@ -4,9 +4,14 @@ interface DictationControlProps {
|
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
className?: string;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* Toolbar mic: starts a dictation session. With a `disabledReason` (Athena can't be reached, so
|
|
9
|
+
* nothing could transcribe) it shows off with the reason as its tooltip, keeping its pointer and
|
|
10
|
+
* focus so the reason reads, and starts nothing.
|
|
11
|
+
*/
|
|
8
12
|
export declare const DictationMicButton: FC<DictationControlProps & {
|
|
9
13
|
title?: string;
|
|
14
|
+
disabledReason?: string | null;
|
|
10
15
|
}>;
|
|
11
16
|
/** Recording mode, left side: discard the session. */
|
|
12
17
|
export declare const DictationCancelButton: FC<DictationControlProps>;
|
|
@@ -2,26 +2,30 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { SquareIcon, MicIcon, XIcon } from "lucide-react";
|
|
3
3
|
import { TooltipIconButton } from "../chat/tooltip-icon-button.js";
|
|
4
4
|
import { cn } from "cnfast";
|
|
5
|
-
const DictationMicButton = ({
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
5
|
+
const DictationMicButton = ({ onClick, disabled, className, title = "Dictate a message", disabledReason = null }) => {
|
|
6
|
+
const unavailable = Boolean(disabledReason);
|
|
7
|
+
return /* @__PURE__ */ jsx(
|
|
8
|
+
TooltipIconButton,
|
|
9
|
+
{
|
|
10
|
+
tooltip: disabledReason || title,
|
|
11
|
+
side: "bottom",
|
|
12
|
+
type: "button",
|
|
13
|
+
variant: "ghost",
|
|
14
|
+
size: "icon",
|
|
15
|
+
className: cn(
|
|
16
|
+
"aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground",
|
|
17
|
+
className,
|
|
18
|
+
unavailable && "cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground"
|
|
19
|
+
),
|
|
20
|
+
"aria-label": title,
|
|
21
|
+
"aria-disabled": unavailable || void 0,
|
|
22
|
+
"data-unavailable": unavailable || void 0,
|
|
23
|
+
onClick: unavailable ? void 0 : onClick,
|
|
24
|
+
disabled: !unavailable && disabled,
|
|
25
|
+
children: /* @__PURE__ */ jsx(MicIcon, { className: "aui-composer-dictate-icon size-4" })
|
|
26
|
+
}
|
|
27
|
+
);
|
|
28
|
+
};
|
|
25
29
|
const DictationCancelButton = ({ onClick, disabled, className }) => /* @__PURE__ */ jsx(
|
|
26
30
|
TooltipIconButton,
|
|
27
31
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dictation-controls.js","sources":["../../src/dictation/dictation-controls.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { MicIcon, SquareIcon, XIcon } from 'lucide-react';\nimport { TooltipIconButton } from '../chat/tooltip-icon-button';\nimport { cn } from '../lib/utils';\n\ninterface DictationControlProps {\n onClick: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n
|
|
1
|
+
{"version":3,"file":"dictation-controls.js","sources":["../../src/dictation/dictation-controls.tsx"],"sourcesContent":["import type { FC } from 'react';\nimport { MicIcon, SquareIcon, XIcon } from 'lucide-react';\nimport { TooltipIconButton } from '../chat/tooltip-icon-button';\nimport { cn } from '../lib/utils';\n\ninterface DictationControlProps {\n onClick: () => void;\n disabled?: boolean;\n className?: string;\n}\n\n/**\n * Toolbar mic: starts a dictation session. With a `disabledReason` (Athena can't be reached, so\n * nothing could transcribe) it shows off with the reason as its tooltip, keeping its pointer and\n * focus so the reason reads, and starts nothing.\n */\nexport const DictationMicButton: FC<\n DictationControlProps & { title?: string; disabledReason?: string | null }\n> = ({ onClick, disabled, className, title = 'Dictate a message', disabledReason = null }) => {\n const unavailable = Boolean(disabledReason);\n return (\n <TooltipIconButton\n tooltip={disabledReason || title}\n side=\"bottom\"\n type=\"button\"\n variant=\"ghost\"\n size=\"icon\"\n className={cn(\n 'aui-composer-dictate size-8 rounded-full text-muted-foreground hover:text-foreground',\n className,\n unavailable && 'cursor-not-allowed opacity-30 hover:bg-transparent hover:text-muted-foreground',\n )}\n aria-label={title}\n aria-disabled={unavailable || undefined}\n data-unavailable={unavailable || undefined}\n onClick={unavailable ? undefined : onClick}\n disabled={!unavailable && disabled}\n >\n <MicIcon className=\"aui-composer-dictate-icon size-4\" />\n </TooltipIconButton>\n );\n};\n\n/** Recording mode, left side: discard the session. */\nexport const DictationCancelButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Cancel dictation\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-cancel size-8 rounded-full', className)}\n aria-label=\"Cancel dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <XIcon className=\"size-4\" />\n </TooltipIconButton>\n);\n\n/** Recording mode, right side: stop and put the words in the composer. */\nexport const DictationStopButton: FC<DictationControlProps> = ({ onClick, disabled, className }) => (\n <TooltipIconButton\n tooltip=\"Stop and review\"\n side=\"bottom\"\n type=\"button\"\n variant=\"outline\"\n size=\"icon\"\n className={cn('aui-composer-dictate-stop size-8 rounded-full', className)}\n aria-label=\"Stop dictation\"\n onClick={onClick}\n disabled={disabled}\n >\n <SquareIcon className=\"size-3 fill-current\" />\n </TooltipIconButton>\n);\n"],"names":[],"mappings":";;;;AAgBO,MAAM,qBAET,CAAC,EAAE,SAAS,UAAU,WAAW,QAAQ,qBAAqB,iBAAiB,WAAW;AAC5F,QAAM,cAAc,QAAQ,cAAc;AAC1C,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,SAAS,kBAAkB;AAAA,MAC3B,MAAK;AAAA,MACL,MAAK;AAAA,MACL,SAAQ;AAAA,MACR,MAAK;AAAA,MACL,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,eAAe;AAAA,MAAA;AAAA,MAEjB,cAAY;AAAA,MACZ,iBAAe,eAAe;AAAA,MAC9B,oBAAkB,eAAe;AAAA,MACjC,SAAS,cAAc,SAAY;AAAA,MACnC,UAAU,CAAC,eAAe;AAAA,MAE1B,UAAA,oBAAC,SAAA,EAAQ,WAAU,mCAAA,CAAmC;AAAA,IAAA;AAAA,EAAA;AAG5D;AAGO,MAAM,wBAAmD,CAAC,EAAE,SAAS,UAAU,gBACpF;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAW,GAAG,mDAAmD,SAAS;AAAA,IAC1E,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAA,oBAAC,OAAA,EAAM,WAAU,SAAA,CAAS;AAAA,EAAA;AAC5B;AAIK,MAAM,sBAAiD,CAAC,EAAE,SAAS,UAAU,gBAClF;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,MAAK;AAAA,IACL,SAAQ;AAAA,IACR,MAAK;AAAA,IACL,WAAW,GAAG,iDAAiD,SAAS;AAAA,IACxE,cAAW;AAAA,IACX;AAAA,IACA;AAAA,IAEA,UAAA,oBAAC,YAAA,EAAW,WAAU,sBAAA,CAAsB;AAAA,EAAA;AAC9C;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const require$$0 = require("react");
|
|
4
4
|
const AthenaContext = require("../provider/AthenaContext.cjs");
|
|
5
5
|
const credentialRenewal = require("../runtime/credential-renewal.cjs");
|
|
6
6
|
const dictationEngine = require("./dictation-engine.cjs");
|
|
@@ -48,9 +48,9 @@ function createAthenaUploadTranscriber(getConfig) {
|
|
|
48
48
|
}
|
|
49
49
|
function useAthenaDictationEngine(override) {
|
|
50
50
|
const config = AthenaContext.useAthenaConfig();
|
|
51
|
-
const configRef =
|
|
51
|
+
const configRef = require$$0.useRef(config);
|
|
52
52
|
configRef.current = config;
|
|
53
|
-
return
|
|
53
|
+
return require$$0.useMemo(() => {
|
|
54
54
|
if (override) return override;
|
|
55
55
|
const recorded = recordedDictationEngine.createRecordedDictationEngine({
|
|
56
56
|
transcribe: createAthenaUploadTranscriber(() => configRef.current)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-athena-dictation-engine.cjs","sources":["../../src/dictation/use-athena-dictation-engine.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { type AthenaConfig, useAthenaConfig } from '../provider/AthenaContext';\nimport { sendWithCredentialRenewal } from '../runtime/credential-renewal';\nimport { createWebSpeechDictationEngine, type DictationEngine } from './dictation-engine';\nimport { createRecordedDictationEngine, type DictationTranscriber } from './recorded-dictation-engine';\n\ninterface UploadTranscriptionResponse {\n transcript: string;\n}\n\n/** Agora's REST base from the configured backend URL (which may point at a nested endpoint). */\nexport function transcriptionUploadUrl(backendUrl: string): string {\n return `${backendUrl.replace(/\\/api\\/assistant-ui\\/?$/, '').replace(/\\/$/, '')}/api/transcription/upload`;\n}\n\n/**\n * One line for the composer per way `/transcription/upload` refuses a clip.\n * The copy lives here, apart from the fetch, so it can be pinned by a test.\n */\nexport function transcriptionUploadErrorMessage(status: number): string {\n switch (status) {\n case 401:\n case 403:\n return 'Dictation is not available for this sign-in. Reload and try again.';\n case 413:\n return 'That recording is too long to transcribe.';\n case 422:\n return 'The dictation language was rejected. Use a BCP-47 tag such as en-US.';\n case 429:\n return 'Too many dictations in a row. Wait a moment and try again.';\n case 503:\n return 'Dictation is not set up on this server.';\n default:\n return `Transcription failed (${status}).`;\n }\n}\n\n/**\n * Post a finished clip to agora's `/transcription/upload` route, which runs\n * it through Deepgram and returns the text. Credentials are read at call\n * time so a rotated token is picked up, and a `401` gets one forced renewal\n * (`getToken({ force: true })`) and a resend before it fails. The session\n * language (host `lang` or the document's) is forwarded so non-English speech\n * is recognised as such; the request is dropped when the engine aborts.\n */\nexport function createAthenaUploadTranscriber(\n getConfig: () => Pick<AthenaConfig, 'backendUrl' | 'apiKey' | 'token' | 'getToken'>,\n): DictationTranscriber {\n return async (clip, { lang, signal }) => {\n const config = getConfig();\n const extension = clip.type.includes('mp4') ? 'mp4' : clip.type.includes('ogg') ? 'ogg' : 'webm';\n const response = await sendWithCredentialRenewal(config, (headers) => {\n // A request body is single-use: every attempt builds its own form.\n const form = new FormData();\n form.append('file', clip, `dictation.${extension}`);\n if (lang) form.append('language', lang);\n return fetch(transcriptionUploadUrl(config.backendUrl), {\n method: 'POST',\n headers,\n body: form,\n credentials: 'include',\n signal,\n });\n });\n if (!response.ok) throw new Error(transcriptionUploadErrorMessage(response.status));\n const payload = (await response.json()) as UploadTranscriptionResponse;\n return typeof payload.transcript === 'string' ? payload.transcript : '';\n };\n}\n\n/**\n * The composer's default speech engine: record with `MediaRecorder`, then\n * transcribe the clip through agora (Deepgram). Falls back to the browser's\n * Web Speech API only where `MediaRecorder` is missing. A host-provided\n * `engine` always wins.\n */\nexport function useAthenaDictationEngine(override?: DictationEngine): DictationEngine {\n const config = useAthenaConfig();\n const configRef = useRef(config);\n configRef.current = config;\n return useMemo(() => {\n if (override) return override;\n const recorded = createRecordedDictationEngine({\n transcribe: createAthenaUploadTranscriber(() => configRef.current),\n });\n return recorded.isSupported() ? recorded : createWebSpeechDictationEngine();\n }, [override]);\n}\n"],"names":["sendWithCredentialRenewal","useAthenaConfig","useRef","useMemo","createRecordedDictationEngine","createWebSpeechDictationEngine"],"mappings":";;;;;;;AAWO,SAAS,uBAAuB,YAA4B;AACjE,SAAO,GAAG,WAAW,QAAQ,2BAA2B,EAAE,EAAE,QAAQ,OAAO,EAAE,CAAC;AAChF;AAMO,SAAS,gCAAgC,QAAwB;AACtE,UAAQ,QAAA;AAAA,IACN,KAAK;AAAA,IACL,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,aAAO,yBAAyB,MAAM;AAAA,EAAA;AAE5C;AAUO,SAAS,8BACd,WACsB;AACtB,SAAO,OAAO,MAAM,EAAE,MAAM,aAAa;AACvC,UAAM,SAAS,UAAA;AACf,UAAM,YAAY,KAAK,KAAK,SAAS,KAAK,IAAI,QAAQ,KAAK,KAAK,SAAS,KAAK,IAAI,QAAQ;AAC1F,UAAM,WAAW,MAAMA,kBAAAA,0BAA0B,QAAQ,CAAC,YAAY;AAEpE,YAAM,OAAO,IAAI,SAAA;AACjB,WAAK,OAAO,QAAQ,MAAM,aAAa,SAAS,EAAE;AAClD,UAAI,KAAM,MAAK,OAAO,YAAY,IAAI;AACtC,aAAO,MAAM,uBAAuB,OAAO,UAAU,GAAG;AAAA,QACtD,QAAQ;AAAA,QACR;AAAA,QACA,MAAM;AAAA,QACN,aAAa;AAAA,QACb;AAAA,MAAA,CACD;AAAA,IACH,CAAC;AACD,QAAI,CAAC,SAAS,GAAI,OAAM,IAAI,MAAM,gCAAgC,SAAS,MAAM,CAAC;AAClF,UAAM,UAAW,MAAM,SAAS,KAAA;AAChC,WAAO,OAAO,QAAQ,eAAe,WAAW,QAAQ,aAAa;AAAA,EACvE;AACF;AAQO,SAAS,yBAAyB,UAA6C;AACpF,QAAM,SAASC,cAAAA,gBAAA;AACf,QAAM,YAAYC,
|
|
1
|
+
{"version":3,"file":"use-athena-dictation-engine.cjs","sources":["../../src/dictation/use-athena-dictation-engine.ts"],"sourcesContent":["import { useMemo, useRef } from 'react';\nimport { type AthenaConfig, useAthenaConfig } from '../provider/AthenaContext';\nimport { sendWithCredentialRenewal } from '../runtime/credential-renewal';\nimport { createWebSpeechDictationEngine, type DictationEngine } from './dictation-engine';\nimport { createRecordedDictationEngine, type DictationTranscriber } from './recorded-dictation-engine';\n\ninterface UploadTranscriptionResponse {\n transcript: string;\n}\n\n/** Agora's REST base from the configured backend URL (which may point at a nested endpoint). */\nexport function transcriptionUploadUrl(backendUrl: string): string {\n return `${backendUrl.replace(/\\/api\\/assistant-ui\\/?$/, '').replace(/\\/$/, '')}/api/transcription/upload`;\n}\n\n/**\n * One line for the composer per way `/transcription/upload` refuses a clip.\n * The copy lives here, apart from the fetch, so it can be pinned by a test.\n */\nexport function transcriptionUploadErrorMessage(status: number): string {\n switch (status) {\n case 401:\n case 403:\n return 'Dictation is not available for this sign-in. Reload and try again.';\n case 413:\n return 'That recording is too long to transcribe.';\n case 422:\n return 'The dictation language was rejected. Use a BCP-47 tag such as en-US.';\n case 429:\n return 'Too many dictations in a row. Wait a moment and try again.';\n case 503:\n return 'Dictation is not set up on this server.';\n default:\n return `Transcription failed (${status}).`;\n }\n}\n\n/**\n * Post a finished clip to agora's `/transcription/upload` route, which runs\n * it through Deepgram and returns the text. Credentials are read at call\n * time so a rotated token is picked up, and a `401` gets one forced renewal\n * (`getToken({ force: true })`) and a resend before it fails. The session\n * language (host `lang` or the document's) is forwarded so non-English speech\n * is recognised as such; the request is dropped when the engine aborts.\n */\nexport function createAthenaUploadTranscriber(\n getConfig: () => Pick<AthenaConfig, 'backendUrl' | 'apiKey' | 'token' | 'getToken'>,\n): DictationTranscriber {\n return async (clip, { lang, signal }) => {\n const config = getConfig();\n const extension = clip.type.includes('mp4') ? 'mp4' : clip.type.includes('ogg') ? 'ogg' : 'webm';\n const response = await sendWithCredentialRenewal(config, (headers) => {\n // A request body is single-use: every attempt builds its own form.\n const form = new FormData();\n form.append('file', clip, `dictation.${extension}`);\n if (lang) form.append('language', lang);\n return fetch(transcriptionUploadUrl(config.backendUrl), {\n method: 'POST',\n headers,\n body: form,\n credentials: 'include',\n signal,\n });\n });\n if (!response.ok) throw new Error(transcriptionUploadErrorMessage(response.status));\n const payload = (await response.json()) as UploadTranscriptionResponse;\n return typeof payload.transcript === 'string' ? payload.transcript : '';\n };\n}\n\n/**\n * The composer's default speech engine: record with `MediaRecorder`, then\n * transcribe the clip through agora (Deepgram). Falls back to the browser's\n * Web Speech API only where `MediaRecorder` is missing. A host-provided\n * `engine` always wins.\n */\nexport function useAthenaDictationEngine(override?: DictationEngine): DictationEngine {\n const config = useAthenaConfig();\n const configRef = useRef(config);\n configRef.current = config;\n return useMemo(() => {\n if (override) return override;\n const recorded = createRecordedDictationEngine({\n transcribe: createAthenaUploadTranscriber(() => configRef.current),\n });\n return recorded.isSupported() ? recorded : createWebSpeechDictationEngine();\n }, [override]);\n}\n"],"names":["sendWithCredentialRenewal","useAthenaConfig","useRef","useMemo","createRecordedDictationEngine","createWebSpeechDictationEngine"],"mappings":";;;;;;;AAWO,SAAS,uBAAuB,YAA4B;AACjE,SAAO,GAAG,WAAW,QAAQ,2BAA2B,EAAE,EAAE,QAAQ,OAAO,EAAE,CAAC;AAChF;AAMO,SAAS,gCAAgC,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,WAAWC,gBAAAA,+BAAA;AAAA,EAC7C,GAAG,CAAC,QAAQ,CAAC;AACf;;;;;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const
|
|
3
|
+
const require$$0 = require("react");
|
|
4
4
|
const athenaDiagnostics = require("../diagnostics/athena-diagnostics.cjs");
|
|
5
5
|
const dictationEngine = require("./dictation-engine.cjs");
|
|
6
6
|
const dictationState = require("./dictation-state.cjs");
|
|
@@ -23,37 +23,37 @@ function releaseStream(stream) {
|
|
|
23
23
|
for (const track of stream.getTracks()) track.stop();
|
|
24
24
|
}
|
|
25
25
|
function useDictation(options = {}) {
|
|
26
|
-
const engine =
|
|
26
|
+
const engine = require$$0.useMemo(() => options.engine ?? dictationEngine.createWebSpeechDictationEngine(), [options.engine]);
|
|
27
27
|
const { lang, captureStream = true, onAutoEnd } = options;
|
|
28
|
-
const [state, dispatch] =
|
|
29
|
-
const [stream, setStream] =
|
|
30
|
-
const [isSupported, setIsSupported] =
|
|
31
|
-
const sessionRef =
|
|
32
|
-
const streamRef =
|
|
33
|
-
const stateRef =
|
|
28
|
+
const [state, dispatch] = require$$0.useReducer(dictationState.dictationReducer, dictationState.INITIAL_DICTATION_STATE);
|
|
29
|
+
const [stream, setStream] = require$$0.useState(null);
|
|
30
|
+
const [isSupported, setIsSupported] = require$$0.useState(false);
|
|
31
|
+
const sessionRef = require$$0.useRef(null);
|
|
32
|
+
const streamRef = require$$0.useRef(null);
|
|
33
|
+
const stateRef = require$$0.useRef(state);
|
|
34
34
|
stateRef.current = state;
|
|
35
|
-
const transcriptRef =
|
|
36
|
-
const onAutoEndRef =
|
|
35
|
+
const transcriptRef = require$$0.useRef(EMPTY_TRANSCRIPT);
|
|
36
|
+
const onAutoEndRef = require$$0.useRef(onAutoEnd);
|
|
37
37
|
onAutoEndRef.current = onAutoEnd;
|
|
38
|
-
const stopWaitersRef =
|
|
39
|
-
const sessionErrorRef =
|
|
40
|
-
const generationRef =
|
|
41
|
-
|
|
38
|
+
const stopWaitersRef = require$$0.useRef([]);
|
|
39
|
+
const sessionErrorRef = require$$0.useRef(null);
|
|
40
|
+
const generationRef = require$$0.useRef(0);
|
|
41
|
+
require$$0.useEffect(() => {
|
|
42
42
|
setIsSupported(engine.isSupported());
|
|
43
43
|
}, [engine]);
|
|
44
|
-
const settleWaiters =
|
|
44
|
+
const settleWaiters = require$$0.useCallback((spoken) => {
|
|
45
45
|
const waiters = stopWaitersRef.current;
|
|
46
46
|
stopWaitersRef.current = [];
|
|
47
47
|
const result = { text: spoken, error: sessionErrorRef.current };
|
|
48
48
|
for (const resolve of waiters) resolve(result);
|
|
49
49
|
}, []);
|
|
50
|
-
const releaseSession =
|
|
50
|
+
const releaseSession = require$$0.useCallback(() => {
|
|
51
51
|
sessionRef.current = null;
|
|
52
52
|
releaseStream(streamRef.current);
|
|
53
53
|
streamRef.current = null;
|
|
54
54
|
setStream(null);
|
|
55
55
|
}, []);
|
|
56
|
-
const teardown =
|
|
56
|
+
const teardown = require$$0.useCallback(() => {
|
|
57
57
|
var _a;
|
|
58
58
|
generationRef.current += 1;
|
|
59
59
|
(_a = sessionRef.current) == null ? void 0 : _a.abort();
|
|
@@ -61,7 +61,7 @@ function useDictation(options = {}) {
|
|
|
61
61
|
transcriptRef.current = EMPTY_TRANSCRIPT;
|
|
62
62
|
settleWaiters("");
|
|
63
63
|
}, [releaseSession, settleWaiters]);
|
|
64
|
-
const reportEngineError =
|
|
64
|
+
const reportEngineError = require$$0.useCallback(
|
|
65
65
|
(engineError) => {
|
|
66
66
|
athenaDiagnostics.athenaDiagnostics.emit("composer.dictation", {
|
|
67
67
|
level: "warn",
|
|
@@ -72,7 +72,7 @@ function useDictation(options = {}) {
|
|
|
72
72
|
},
|
|
73
73
|
[engine.id]
|
|
74
74
|
);
|
|
75
|
-
const start =
|
|
75
|
+
const start = require$$0.useCallback(() => {
|
|
76
76
|
if (sessionRef.current) return;
|
|
77
77
|
const generation = generationRef.current + 1;
|
|
78
78
|
generationRef.current = generation;
|
|
@@ -160,7 +160,7 @@ function useDictation(options = {}) {
|
|
|
160
160
|
};
|
|
161
161
|
void run();
|
|
162
162
|
}, [captureStream, engine, lang, releaseSession, reportEngineError, settleWaiters]);
|
|
163
|
-
const stop =
|
|
163
|
+
const stop = require$$0.useCallback(() => {
|
|
164
164
|
const session = sessionRef.current;
|
|
165
165
|
if (!session) {
|
|
166
166
|
if (stateRef.current.status === dictationState.DICTATION_STATUSES.starting) {
|
|
@@ -191,11 +191,11 @@ function useDictation(options = {}) {
|
|
|
191
191
|
session.stop();
|
|
192
192
|
return flushed;
|
|
193
193
|
}, [engine.flushTimeoutMs, releaseSession, reportEngineError, settleWaiters, teardown]);
|
|
194
|
-
const cancel =
|
|
194
|
+
const cancel = require$$0.useCallback(() => {
|
|
195
195
|
teardown();
|
|
196
196
|
dispatch({ type: "cancel" });
|
|
197
197
|
}, [teardown]);
|
|
198
|
-
|
|
198
|
+
require$$0.useEffect(() => () => teardown(), [teardown]);
|
|
199
199
|
const isActive = state.status === dictationState.DICTATION_STATUSES.starting || state.status === dictationState.DICTATION_STATUSES.listening || state.status === dictationState.DICTATION_STATUSES.stopping;
|
|
200
200
|
return {
|
|
201
201
|
status: state.status,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-dictation.cjs","sources":["../../src/dictation/use-dictation.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'react';\nimport { athenaDiagnostics } from '../diagnostics/athena-diagnostics';\nimport {\n createWebSpeechDictationEngine,\n DICTATION_ENGINE_ERROR_KINDS,\n type DictationEngine,\n type DictationEngineError,\n type DictationEngineSession,\n} from './dictation-engine';\nimport {\n DICTATION_STATUSES,\n dictationReducer,\n INITIAL_DICTATION_STATE,\n joinSpeech,\n spokenText,\n type DictationStatus,\n type DictationTranscript,\n} from './dictation-state';\n\nexport interface UseDictationOptions {\n /**\n * Speech engine. Defaults to the browser's Web Speech API; `AthenaChat`\n * passes the record-then-transcribe engine from `useAthenaDictationEngine`.\n */\n engine?: DictationEngine;\n /** BCP-47 language tag. Defaults to the document language, else `en-US`. */\n lang?: string;\n /**\n * Open the microphone through `getUserMedia` so callers get a `stream` for\n * a waveform. Web Speech opens its own capture; this second capture is\n * what the level meter reads. Defaults to true.\n */\n captureStream?: boolean;\n /**\n * The engine ended on its own (silence window, recognizer timeout) while\n * listening, without `stop()` or `cancel()`. Receives the spoken text so\n * the words are not lost; the composer puts them into the draft.\n */\n onAutoEnd?: (spoken: string) => void;\n}\n\nexport interface DictationStopResult {\n /** Spoken text (final plus interim tail) gathered before the engine closed. */\n text: string;\n /**\n * The engine error reported during this session, if any. When set the\n * transcript may be incomplete: a recorded engine whose upload failed has no\n * words to hand over, so callers should not send the draft as if it were.\n */\n error: DictationEngineError | null;\n}\n\nexport interface DictationController {\n status: DictationStatus;\n /** True while starting, listening or stopping. */\n isActive: boolean;\n transcript: DictationTranscript;\n /** `final` plus the interim tail, ready to hand to the composer. */\n text: string;\n error: DictationEngineError | null;\n /** The microphone stream while active (for a waveform), else null. */\n stream: MediaStream | null;\n /** Whether the engine can run here. Hide the control when false. */\n isSupported: boolean;\n /** The engine in use (for its `stoppingLabel` and diagnostics). */\n engine: DictationEngine;\n start: () => void;\n /**\n * Finish recording. Resolves once the engine has flushed (bounded wait), so\n * trailing words are not lost, with the spoken text and any error raised\n * along the way.\n */\n stop: () => Promise<DictationStopResult>;\n /** Discard the session and its transcript. */\n cancel: () => void;\n}\n\n/** How long `stop()` waits for a live engine's final flush before giving up. */\nconst DEFAULT_STOP_FLUSH_TIMEOUT_MS = 1500;\n\ntype StopResolver = (result: DictationStopResult) => void;\n\nconst EMPTY_TRANSCRIPT: DictationTranscript = { final: '', interim: '' };\n\nfunction documentLanguage(): string {\n if (typeof document !== 'undefined' && document.documentElement.lang) {\n return document.documentElement.lang;\n }\n if (typeof navigator !== 'undefined' && navigator.language) return navigator.language;\n return 'en-US';\n}\n\nasync function openMicrophone(): Promise<MediaStream | null> {\n if (typeof navigator === 'undefined' || !navigator.mediaDevices?.getUserMedia) return null;\n return navigator.mediaDevices.getUserMedia({ audio: true });\n}\n\nfunction releaseStream(stream: MediaStream | null): void {\n if (!stream) return;\n for (const track of stream.getTracks()) track.stop();\n}\n\n/**\n * Drive a dictation session: microphone, speech engine, and the transcript\n * state machine. The composer renders the waveform from `stream` and the\n * live caption from `transcript`; on `stop()` it appends `text` to the draft.\n */\nexport function useDictation(options: UseDictationOptions = {}): DictationController {\n const engine = useMemo(() => options.engine ?? createWebSpeechDictationEngine(), [options.engine]);\n const { lang, captureStream = true, onAutoEnd } = options;\n const [state, dispatch] = useReducer(dictationReducer, INITIAL_DICTATION_STATE);\n const [stream, setStream] = useState<MediaStream | null>(null);\n const [isSupported, setIsSupported] = useState(false);\n\n const sessionRef = useRef<DictationEngineSession | null>(null);\n const streamRef = useRef<MediaStream | null>(null);\n const stateRef = useRef(state);\n stateRef.current = state;\n // The authoritative transcript, updated synchronously as the engine reports\n // it. The reducer's copy renders the caption; this one is what `stop()` and\n // `onAutoEnd` hand over, so an engine that flushes its last words and ends\n // in the same tick — before React has rendered — loses nothing.\n const transcriptRef = useRef<DictationTranscript>(EMPTY_TRANSCRIPT);\n const onAutoEndRef = useRef(onAutoEnd);\n onAutoEndRef.current = onAutoEnd;\n // stop() callers waiting for the engine's final flush.\n const stopWaitersRef = useRef<StopResolver[]>([]);\n // Last engine error of the current session, handed to stop() callers\n // synchronously (the reducer's copy may not have rendered yet).\n const sessionErrorRef = useRef<DictationEngineError | null>(null);\n // Distinguishes a fresh session from the callbacks of a torn-down one.\n const generationRef = useRef(0);\n\n useEffect(() => {\n setIsSupported(engine.isSupported());\n }, [engine]);\n\n const settleWaiters = useCallback((spoken: string) => {\n const waiters = stopWaitersRef.current;\n stopWaitersRef.current = [];\n const result: DictationStopResult = { text: spoken, error: sessionErrorRef.current };\n for (const resolve of waiters) resolve(result);\n }, []);\n\n const releaseSession = useCallback(() => {\n sessionRef.current = null;\n releaseStream(streamRef.current);\n streamRef.current = null;\n setStream(null);\n }, []);\n\n const teardown = useCallback(() => {\n generationRef.current += 1;\n sessionRef.current?.abort();\n releaseSession();\n transcriptRef.current = EMPTY_TRANSCRIPT;\n settleWaiters('');\n }, [releaseSession, settleWaiters]);\n\n const reportEngineError = useCallback(\n (engineError: DictationEngineError) => {\n athenaDiagnostics.emit('composer.dictation', {\n level: 'warn',\n data: { phase: 'error', engine: engine.id, kind: engineError.kind },\n });\n sessionErrorRef.current = engineError;\n dispatch({ type: 'error', error: engineError });\n },\n [engine.id],\n );\n\n const start = useCallback(() => {\n if (sessionRef.current) return;\n const generation = generationRef.current + 1;\n generationRef.current = generation;\n transcriptRef.current = EMPTY_TRANSCRIPT;\n sessionErrorRef.current = null;\n dispatch({ type: 'start' });\n athenaDiagnostics.emit('composer.dictation', {\n level: 'debug',\n data: { phase: 'start', engine: engine.id },\n });\n\n const run = async () => {\n let microphone: MediaStream | null = null;\n if (captureStream) {\n try {\n microphone = await openMicrophone();\n } catch (error) {\n if (generationRef.current !== generation) {\n releaseStream(microphone);\n return;\n }\n dispatch({\n type: 'error',\n error: {\n kind: DICTATION_ENGINE_ERROR_KINDS.permission,\n message:\n error instanceof DOMException && error.name === 'NotFoundError'\n ? 'No microphone was found.'\n : 'Microphone access was denied. Allow the microphone for this site and try again.',\n },\n });\n return;\n }\n }\n if (generationRef.current !== generation) {\n releaseStream(microphone);\n return;\n }\n streamRef.current = microphone;\n setStream(microphone);\n\n // An engine may fail synchronously inside start() (Web Speech throws\n // when recognition.start() is refused) and run onError/onEnd before we\n // hold the session. Those callbacks flip this flag so a dead session is\n // never stored, which would make every later mic click return early.\n let terminated = false;\n const endSession = () => {\n terminated = true;\n const current = stateRef.current;\n const spoken = spokenText(transcriptRef.current);\n // No stop() is waiting: the engine gave up on its own. Hand the\n // words over so they land in the draft instead of vanishing.\n const endedOnItsOwn =\n stopWaitersRef.current.length === 0 && current.status === DICTATION_STATUSES.listening;\n // The reducer keeps an error status through 'ended', so an error\n // reported just before the engine closed stays on screen.\n dispatch({ type: 'ended' });\n releaseSession();\n settleWaiters(spoken);\n if (endedOnItsOwn) onAutoEndRef.current?.(spoken);\n };\n let session: DictationEngineSession;\n try {\n session = engine.start({\n stream: microphone,\n lang: lang ?? documentLanguage(),\n callbacks: {\n onTranscript: (update) => {\n if (generationRef.current !== generation) return;\n transcriptRef.current = {\n final: joinSpeech(transcriptRef.current.final, update.final),\n interim: update.interim,\n };\n dispatch({ type: 'transcript', update });\n },\n onError: (engineError) => {\n if (generationRef.current !== generation) return;\n // A silence timeout is the engine giving up politely; keep the\n // words we have instead of showing an error.\n if (engineError.kind === DICTATION_ENGINE_ERROR_KINDS.noSpeech) return;\n reportEngineError(engineError);\n },\n onEnd: () => {\n if (generationRef.current !== generation) return;\n endSession();\n },\n },\n });\n } catch (error) {\n // A relay engine that cannot build its session must not strand the\n // microphone or leave the composer in `starting`.\n releaseSession();\n reportEngineError({\n kind: DICTATION_ENGINE_ERROR_KINDS.connection,\n message: error instanceof Error ? error.message : 'Dictation could not start.',\n });\n return;\n }\n if (terminated) return;\n sessionRef.current = session;\n dispatch({ type: 'listening' });\n };\n void run();\n }, [captureStream, engine, lang, releaseSession, reportEngineError, settleWaiters]);\n\n const stop = useCallback((): Promise<DictationStopResult> => {\n const session = sessionRef.current;\n if (!session) {\n // Stopped while the microphone prompt was still open: nothing was heard\n // yet, and the pending start must not bring the engine up afterwards.\n if (stateRef.current.status === DICTATION_STATUSES.starting) {\n teardown();\n dispatch({ type: 'cancel' });\n return Promise.resolve({ text: '', error: null });\n }\n return Promise.resolve({ text: spokenText(transcriptRef.current), error: sessionErrorRef.current });\n }\n dispatch({ type: 'stop' });\n const flushed = new Promise<DictationStopResult>((resolve) => {\n stopWaitersRef.current.push(resolve);\n window.setTimeout(() => {\n // Bounded wait: a recognizer that never fires onend must not hold the\n // composer hostage. Force the session closed and hand over what was\n // heard so far. An engine that had nothing to show yet (a recorded\n // clip still transcribing) surfaces that as an error rather than\n // passing off silence as the result.\n if (sessionRef.current === session) {\n // Report before abort(): an engine that ends synchronously on\n // abort settles the waiters, and they must see this error.\n if (!spokenText(transcriptRef.current)) {\n reportEngineError({\n kind: DICTATION_ENGINE_ERROR_KINDS.connection,\n message: 'Transcription timed out. Try again.',\n });\n }\n session.abort();\n dispatch({ type: 'ended' });\n releaseSession();\n settleWaiters(spokenText(transcriptRef.current));\n }\n }, engine.flushTimeoutMs ?? DEFAULT_STOP_FLUSH_TIMEOUT_MS);\n });\n session.stop();\n return flushed;\n }, [engine.flushTimeoutMs, releaseSession, reportEngineError, settleWaiters, teardown]);\n\n const cancel = useCallback(() => {\n teardown();\n dispatch({ type: 'cancel' });\n }, [teardown]);\n\n // Release the microphone with the component.\n useEffect(() => () => teardown(), [teardown]);\n\n const isActive =\n state.status === DICTATION_STATUSES.starting ||\n state.status === DICTATION_STATUSES.listening ||\n state.status === DICTATION_STATUSES.stopping;\n\n return {\n status: state.status,\n isActive,\n transcript: state.transcript,\n text: spokenText(state.transcript),\n error: state.error,\n stream,\n isSupported,\n engine,\n start,\n stop,\n cancel,\n };\n}\n"],"names":["useMemo","createWebSpeechDictationEngine","useReducer","dictationReducer","INITIAL_DICTATION_STATE","useState","useRef","useEffect","useCallback","athenaDiagnostics","DICTATION_ENGINE_ERROR_KINDS","spokenText","DICTATION_STATUSES","joinSpeech"],"mappings":";;;;;;AA8EA,MAAM,gCAAgC;AAItC,MAAM,mBAAwC,EAAE,OAAO,IAAI,SAAS,GAAA;AAEpE,SAAS,mBAA2B;AAClC,MAAI,OAAO,aAAa,eAAe,SAAS,gBAAgB,MAAM;AACpE,WAAO,SAAS,gBAAgB;AAAA,EAClC;AACA,MAAI,OAAO,cAAc,eAAe,UAAU,iBAAiB,UAAU;AAC7E,SAAO;AACT;AAEA,eAAe,iBAA8C;;AAC3D,MAAI,OAAO,cAAc,eAAe,GAAC,eAAU,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Y,MAAM;AAC/B,aAAA;AACA,aAAS,EAAE,MAAM,UAAU;AAAA,EAC7B,GAAG,CAAC,QAAQ,CAAC;AAGbD,QAAAA,UAAU,MAAM,MAAM,YAAY,CAAC,QAAQ,CAAC;AAE5C,QAAM,WACJ,MAAM,WAAWK,eAAAA,mBAAmB,YACpC,MAAM,WAAWA,eAAAA,mBAAmB,aACpC,MAAM,WAAWA,eAAAA,mBAAmB;AAEtC,SAAO;AAAA,IACL,QAAQ,MAAM;AAAA,IACd;AAAA,IACA,YAAY,MAAM;AAAA,IAClB,MAAMD,eAAAA,WAAW,MAAM,UAAU;AAAA,IACjC,OAAO,MAAM;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;"}
|
|
1
|
+
{"version":3,"file":"use-dictation.cjs","sources":["../../src/dictation/use-dictation.ts"],"sourcesContent":["import { useCallback, useEffect, useMemo, useReducer, useRef, useState } from 'react';\nimport { athenaDiagnostics } from '../diagnostics/athena-diagnostics';\nimport {\n createWebSpeechDictationEngine,\n DICTATION_ENGINE_ERROR_KINDS,\n type DictationEngine,\n type DictationEngineError,\n type DictationEngineSession,\n} from './dictation-engine';\nimport {\n DICTATION_STATUSES,\n dictationReducer,\n INITIAL_DICTATION_STATE,\n joinSpeech,\n spokenText,\n type DictationStatus,\n type DictationTranscript,\n} from './dictation-state';\n\nexport interface UseDictationOptions {\n /**\n * Speech engine. Defaults to the browser's Web Speech API; `AthenaChat`\n * passes the record-then-transcribe engine from `useAthenaDictationEngine`.\n */\n engine?: DictationEngine;\n /** BCP-47 language tag. Defaults to the document language, else `en-US`. */\n lang?: string;\n /**\n * Open the microphone through `getUserMedia` so callers get a `stream` for\n * a waveform. Web Speech opens its own capture; this second capture is\n * what the level meter reads. Defaults to true.\n */\n captureStream?: boolean;\n /**\n * The engine ended on its own (silence window, recognizer timeout) while\n * listening, without `stop()` or `cancel()`. Receives the spoken text so\n * the words are not lost; the composer puts them into the draft.\n */\n onAutoEnd?: (spoken: string) => void;\n}\n\nexport interface DictationStopResult {\n /** Spoken text (final plus interim tail) gathered before the engine closed. */\n text: string;\n /**\n * The engine error reported during this session, if any. When set the\n * transcript may be incomplete: a recorded engine whose upload failed has no\n * words to hand over, so callers should not send the draft as if it were.\n */\n error: DictationEngineError | null;\n}\n\nexport interface DictationController {\n status: DictationStatus;\n /** True while starting, listening or stopping. */\n isActive: boolean;\n transcript: DictationTranscript;\n /** `final` plus the interim tail, ready to hand to the composer. */\n text: string;\n error: DictationEngineError | null;\n /** The microphone stream while active (for a waveform), else null. */\n stream: MediaStream | null;\n /** Whether the engine can run here. Hide the control when false. */\n isSupported: boolean;\n /** The engine in use (for its `stoppingLabel` and diagnostics). */\n engine: DictationEngine;\n start: () => void;\n /**\n * Finish recording. Resolves once the engine has flushed (bounded wait), so\n * trailing words are not lost, with the spoken text and any error raised\n * along the way.\n */\n stop: () => Promise<DictationStopResult>;\n /** Discard the session and its transcript. */\n cancel: () => void;\n}\n\n/** How long `stop()` waits for a live engine's final flush before giving up. */\nconst DEFAULT_STOP_FLUSH_TIMEOUT_MS = 1500;\n\ntype StopResolver = (result: DictationStopResult) => void;\n\nconst EMPTY_TRANSCRIPT: DictationTranscript = { final: '', interim: '' };\n\nfunction documentLanguage(): string {\n if (typeof document !== 'undefined' && document.documentElement.lang) {\n return document.documentElement.lang;\n }\n if (typeof navigator !== 'undefined' && navigator.language) return navigator.language;\n return 'en-US';\n}\n\nasync function openMicrophone(): Promise<MediaStream | null> {\n if (typeof navigator === 'undefined' || !navigator.mediaDevices?.getUserMedia) return null;\n return navigator.mediaDevices.getUserMedia({ audio: true });\n}\n\nfunction releaseStream(stream: MediaStream | null): void {\n if (!stream) return;\n for (const track of stream.getTracks()) track.stop();\n}\n\n/**\n * Drive a dictation session: microphone, speech engine, and the transcript\n * state machine. The composer renders the waveform from `stream` and the\n * live caption from `transcript`; on `stop()` it appends `text` to the draft.\n */\nexport function useDictation(options: UseDictationOptions = {}): DictationController {\n const engine = useMemo(() => options.engine ?? createWebSpeechDictationEngine(), [options.engine]);\n const { lang, captureStream = true, onAutoEnd } = options;\n const [state, dispatch] = useReducer(dictationReducer, INITIAL_DICTATION_STATE);\n const [stream, setStream] = useState<MediaStream | null>(null);\n const [isSupported, setIsSupported] = useState(false);\n\n const sessionRef = useRef<DictationEngineSession | null>(null);\n const streamRef = useRef<MediaStream | null>(null);\n const stateRef = useRef(state);\n stateRef.current = state;\n // The authoritative transcript, updated synchronously as the engine reports\n // it. The reducer's copy renders the caption; this one is what `stop()` and\n // `onAutoEnd` hand over, so an engine that flushes its last words and ends\n // in the same tick — before React has rendered — loses nothing.\n const transcriptRef = useRef<DictationTranscript>(EMPTY_TRANSCRIPT);\n const onAutoEndRef = useRef(onAutoEnd);\n onAutoEndRef.current = onAutoEnd;\n // stop() callers waiting for the engine's final flush.\n const stopWaitersRef = useRef<StopResolver[]>([]);\n // Last engine error of the current session, handed to stop() callers\n // synchronously (the reducer's copy may not have rendered yet).\n const sessionErrorRef = useRef<DictationEngineError | null>(null);\n // Distinguishes a fresh session from the callbacks of a torn-down one.\n const generationRef = useRef(0);\n\n useEffect(() => {\n setIsSupported(engine.isSupported());\n }, [engine]);\n\n const settleWaiters = useCallback((spoken: string) => {\n const waiters = stopWaitersRef.current;\n stopWaitersRef.current = [];\n const result: DictationStopResult = { text: spoken, error: sessionErrorRef.current };\n for (const resolve of waiters) resolve(result);\n }, []);\n\n const releaseSession = useCallback(() => {\n sessionRef.current = null;\n releaseStream(streamRef.current);\n streamRef.current = null;\n setStream(null);\n }, []);\n\n const teardown = useCallback(() => {\n generationRef.current += 1;\n sessionRef.current?.abort();\n releaseSession();\n transcriptRef.current = EMPTY_TRANSCRIPT;\n settleWaiters('');\n }, [releaseSession, settleWaiters]);\n\n const reportEngineError = useCallback(\n (engineError: DictationEngineError) => {\n athenaDiagnostics.emit('composer.dictation', {\n level: 'warn',\n data: { phase: 'error', engine: engine.id, kind: engineError.kind },\n });\n sessionErrorRef.current = engineError;\n dispatch({ type: 'error', error: engineError });\n },\n [engine.id],\n );\n\n const start = useCallback(() => {\n if (sessionRef.current) return;\n const generation = generationRef.current + 1;\n generationRef.current = generation;\n transcriptRef.current = EMPTY_TRANSCRIPT;\n sessionErrorRef.current = null;\n dispatch({ type: 'start' });\n athenaDiagnostics.emit('composer.dictation', {\n level: 'debug',\n data: { phase: 'start', engine: engine.id },\n });\n\n const run = async () => {\n let microphone: MediaStream | null = null;\n if (captureStream) {\n try {\n microphone = await openMicrophone();\n } catch (error) {\n if (generationRef.current !== generation) {\n releaseStream(microphone);\n return;\n }\n dispatch({\n type: 'error',\n error: {\n kind: DICTATION_ENGINE_ERROR_KINDS.permission,\n message:\n error instanceof DOMException && error.name === 'NotFoundError'\n ? 'No microphone was found.'\n : 'Microphone access was denied. Allow the microphone for this site and try again.',\n },\n });\n return;\n }\n }\n if (generationRef.current !== generation) {\n releaseStream(microphone);\n return;\n }\n streamRef.current = microphone;\n setStream(microphone);\n\n // An engine may fail synchronously inside start() (Web Speech throws\n // when recognition.start() is refused) and run onError/onEnd before we\n // hold the session. Those callbacks flip this flag so a dead session is\n // never stored, which would make every later mic click return early.\n let terminated = false;\n const endSession = () => {\n terminated = true;\n const current = stateRef.current;\n const spoken = spokenText(transcriptRef.current);\n // No stop() is waiting: the engine gave up on its own. Hand the\n // words over so they land in the draft instead of vanishing.\n const endedOnItsOwn =\n stopWaitersRef.current.length === 0 && current.status === DICTATION_STATUSES.listening;\n // The reducer keeps an error status through 'ended', so an error\n // reported just before the engine closed stays on screen.\n dispatch({ type: 'ended' });\n releaseSession();\n settleWaiters(spoken);\n if (endedOnItsOwn) onAutoEndRef.current?.(spoken);\n };\n let session: DictationEngineSession;\n try {\n session = engine.start({\n stream: microphone,\n lang: lang ?? documentLanguage(),\n callbacks: {\n onTranscript: (update) => {\n if (generationRef.current !== generation) return;\n transcriptRef.current = {\n final: joinSpeech(transcriptRef.current.final, update.final),\n interim: update.interim,\n };\n dispatch({ type: 'transcript', update });\n },\n onError: (engineError) => {\n if (generationRef.current !== generation) return;\n // A silence timeout is the engine giving up politely; keep the\n // words we have instead of showing an error.\n if (engineError.kind === DICTATION_ENGINE_ERROR_KINDS.noSpeech) return;\n reportEngineError(engineError);\n },\n onEnd: () => {\n if (generationRef.current !== generation) return;\n endSession();\n },\n },\n });\n } catch (error) {\n // A relay engine that cannot build its session must not strand the\n // microphone or leave the composer in `starting`.\n releaseSession();\n reportEngineError({\n kind: DICTATION_ENGINE_ERROR_KINDS.connection,\n message: error instanceof Error ? error.message : 'Dictation could not start.',\n });\n return;\n }\n if (terminated) return;\n sessionRef.current = session;\n dispatch({ type: 'listening' });\n };\n void run();\n }, [captureStream, engine, lang, releaseSession, reportEngineError, settleWaiters]);\n\n const stop = useCallback((): Promise<DictationStopResult> => {\n const session = sessionRef.current;\n if (!session) {\n // Stopped while the microphone prompt was still open: nothing was heard\n // yet, and the pending start must not bring the engine up afterwards.\n if (stateRef.current.status === DICTATION_STATUSES.starting) {\n teardown();\n dispatch({ type: 'cancel' });\n return Promise.resolve({ text: '', error: null });\n }\n return Promise.resolve({ text: spokenText(transcriptRef.current), error: sessionErrorRef.current });\n }\n dispatch({ type: 'stop' });\n const flushed = new Promise<DictationStopResult>((resolve) => {\n stopWaitersRef.current.push(resolve);\n window.setTimeout(() => {\n // Bounded wait: a recognizer that never fires onend must not hold the\n // composer hostage. Force the session closed and hand over what was\n // heard so far. An engine that had nothing to show yet (a recorded\n // clip still transcribing) surfaces that as an error rather than\n // passing off silence as the result.\n if (sessionRef.current === session) {\n // Report before abort(): an engine that ends synchronously on\n // abort settles the waiters, and they must see this error.\n if (!spokenText(transcriptRef.current)) {\n reportEngineError({\n kind: DICTATION_ENGINE_ERROR_KINDS.connection,\n message: 'Transcription timed out. Try again.',\n });\n }\n session.abort();\n dispatch({ type: 'ended' });\n releaseSession();\n settleWaiters(spokenText(transcriptRef.current));\n }\n }, engine.flushTimeoutMs ?? DEFAULT_STOP_FLUSH_TIMEOUT_MS);\n });\n session.stop();\n return flushed;\n }, [engine.flushTimeoutMs, releaseSession, reportEngineError, settleWaiters, teardown]);\n\n const cancel = useCallback(() => {\n teardown();\n dispatch({ type: 'cancel' });\n }, [teardown]);\n\n // Release the microphone with the component.\n useEffect(() => () => teardown(), [teardown]);\n\n const isActive =\n state.status === DICTATION_STATUSES.starting ||\n state.status === DICTATION_STATUSES.listening ||\n state.status === DICTATION_STATUSES.stopping;\n\n return {\n status: state.status,\n isActive,\n transcript: state.transcript,\n text: spokenText(state.transcript),\n error: state.error,\n stream,\n isSupported,\n engine,\n start,\n stop,\n cancel,\n };\n}\n"],"names":["useMemo","createWebSpeechDictationEngine","useReducer","dictationReducer","INITIAL_DICTATION_STATE","useState","useRef","useEffect","useCallback","athenaDiagnostics","DICTATION_ENGINE_ERROR_KINDS","spokenText","DICTATION_STATUSES","joinSpeech"],"mappings":";;;;;;AA8EA,MAAM,gCAAgC;AAItC,MAAM,mBAAwC,EAAE,OAAO,IAAI,SAAS,GAAA;AAEpE,SAAS,mBAA2B;AAClC,MAAI,OAAO,aAAa,eAAe,SAAS,gBAAgB,MAAM;AACpE,WAAO,SAAS,gBAAgB;AAAA,EAClC;AACA,MAAI,OAAO,cAAc,eAAe,UAAU,iBAAiB,UAAU;AAC7E,SAAO;AACT;AAEA,eAAe,iBAA8C;;AAC3D,MAAI,OAAO,cAAc,eAAe,GAAC,eAAU,iBAAV,mBAAwB,cAAc,QAAO;AACtF,SAAO,UAAU,aAAa,aAAa,EAAE,OAAO,MAAM;AAC5D;AAEA,SAAS,cAAc,QAAkC;AACvD,MAAI,CAAC,OAAQ;AACb,aAAW,SAAS,OAAO,UAAA,SAAmB,KAAA;AAChD;AAOO,SAAS,aAAa,UAA+B,IAAyB;AACnF,QAAM,SAASA,mBAAQ,MAAM,QAAQ,UAAUC,gBAAAA,kCAAkC,CAAC,QAAQ,MAAM,CAAC;AACjG,QAAM,EAAE,MAAM,gBAAgB,MAAM,cAAc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B,MAAMD,eAAAA,WAAW,MAAM,UAAU;AAAA,IACjC,OAAO,MAAM;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;;"}
|
package/dist/index.cjs
CHANGED
|
@@ -18,12 +18,18 @@ const GroupedMessageParts = require("./chat/super-grouping/GroupedMessageParts.c
|
|
|
18
18
|
const groupingFunction = require("./chat/super-grouping/grouping-function.cjs");
|
|
19
19
|
const SuperGroupingCard = require("./chat/super-grouping/SuperGroupingCard.cjs");
|
|
20
20
|
const SuperGroupingTranscript = require("./chat/super-grouping/SuperGroupingTranscript.cjs");
|
|
21
|
+
const toolPartPlacement = require("./chat/super-grouping/tool-part-placement.cjs");
|
|
21
22
|
const turnSegments = require("./chat/super-grouping/turn-segments.cjs");
|
|
22
23
|
const turnTiming = require("./chat/super-grouping/turn-timing.cjs");
|
|
23
24
|
const toolkitMap = require("./chat/super-grouping/toolkit-map.cjs");
|
|
25
|
+
const inlineTools = require("./tools/inline-tools.cjs");
|
|
24
26
|
const StatewireApprovalCard = require("./chat/StatewireApprovalCard.cjs");
|
|
25
27
|
const useStatewireApprovalRequest = require("./chat/use-statewire-approval-request.cjs");
|
|
28
|
+
const deviceOperation = require("./chat/device-operation.cjs");
|
|
29
|
+
const browserDecisionCheck = require("./chat/browser-decision-check.cjs");
|
|
26
30
|
const useAthenaRunLive = require("./chat/use-athena-run-live.cjs");
|
|
31
|
+
const useAthenaVoiceLive = require("./chat/use-athena-voice-live.cjs");
|
|
32
|
+
const athenaTurnEndStatus = require("./chat/athena-turn-end-status.cjs");
|
|
27
33
|
const statewireHistoryEdge = require("./chat-ui/thread/statewire-history-edge.cjs");
|
|
28
34
|
const threadLoadingOverlay = require("./chat-ui/thread/thread-loading-overlay.cjs");
|
|
29
35
|
const statewireWindowContext = require("./provider/statewire-window-context.cjs");
|
|
@@ -36,6 +42,7 @@ const statewireClientTools = require("./chat/statewire-client-tools.cjs");
|
|
|
36
42
|
const statewireLifecycleContext = require("./provider/statewire-lifecycle-context.cjs");
|
|
37
43
|
const statewireLifecycle = require("./runtime/statewire-lifecycle.cjs");
|
|
38
44
|
const statewireThreadList = require("./threads/statewire-thread-list.cjs");
|
|
45
|
+
const DrivingOnChip = require("./chat/DrivingOnChip.cjs");
|
|
39
46
|
const WaitingOnYouBanner = require("./chat/WaitingOnYouBanner.cjs");
|
|
40
47
|
const wakeMarker = require("./chat-ui/messages/wake-marker.cjs");
|
|
41
48
|
const offlineHistory = require("./offline/offline-history.cjs");
|
|
@@ -56,7 +63,6 @@ const toolFallback = require("./tools/tool-fallback.cjs");
|
|
|
56
63
|
const voiceUpdateToolUi = require("./tools/voice-update-tool-ui.cjs");
|
|
57
64
|
const testRecordingToolUis = require("./tools/test-recording-tool-uis.cjs");
|
|
58
65
|
const testRecordingReport = require("./tools/test-recording-report.cjs");
|
|
59
|
-
const inlineTools = require("./tools/inline-tools.cjs");
|
|
60
66
|
const voiceDelegationCard = require("./chat-ui/messages/voice-delegation-card.cjs");
|
|
61
67
|
const NestedPtcMessages = require("./tools/NestedPtcMessages.cjs");
|
|
62
68
|
const readAssetToolUi = require("./tools/read-asset-tool-ui.cjs");
|
|
@@ -91,6 +97,7 @@ const sessionsPageModel = require("./threads/sessions-page-model.cjs");
|
|
|
91
97
|
const sessionListModel = require("./threads/session-list-model.cjs");
|
|
92
98
|
const threadIdContext = require("./threads/thread-id-context.cjs");
|
|
93
99
|
const useAthenaThreadModel = require("./threads/use-athena-thread-model.cjs");
|
|
100
|
+
const sessionPersistenceContext = require("./provider/session-persistence-context.cjs");
|
|
94
101
|
const api = require("./threads/api.cjs");
|
|
95
102
|
const threadPrefetcher = require("./threads/thread-prefetcher.cjs");
|
|
96
103
|
const useRestConversationHistory = require("./threads/use-rest-conversation-history.cjs");
|
|
@@ -121,6 +128,7 @@ const athenaUrls = require("./lib/athena-urls.cjs");
|
|
|
121
128
|
const button = require("./ui/button.cjs");
|
|
122
129
|
const tooltip = require("./ui/tooltip.cjs");
|
|
123
130
|
const collapsible = require("./ui/collapsible.cjs");
|
|
131
|
+
const imageViewer = require("./ui/image-viewer.cjs");
|
|
124
132
|
const lib_ownerDocument = require("./lib/owner-document.cjs");
|
|
125
133
|
const a1 = require("./sheet-range/a1.cjs");
|
|
126
134
|
const rangePreview = require("./sheet-range/range-preview.cjs");
|
|
@@ -173,6 +181,7 @@ exports.AthenaReasoningPart = AthenaChat.AthenaReasoningPart;
|
|
|
173
181
|
exports.AthenaUserMessage = AthenaChat.AthenaUserMessage;
|
|
174
182
|
exports.AthenaChatErrorBoundary = AthenaChatErrorBoundary.AthenaChatErrorBoundary;
|
|
175
183
|
exports.buildActivityTimeline = activityTimeline.buildActivityTimeline;
|
|
184
|
+
exports.countActivityDelegations = activityTimeline.countActivityDelegations;
|
|
176
185
|
exports.countActivityTools = activityTimeline.countActivityTools;
|
|
177
186
|
exports.excludeFinalTextFromGroups = activityTimeline.excludeFinalTextFromGroups;
|
|
178
187
|
exports.excludePartsFromGroups = activityTimeline.excludePartsFromGroups;
|
|
@@ -194,15 +203,28 @@ exports.SuperGroupingFinalText = SuperGroupingCard.SuperGroupingFinalText;
|
|
|
194
203
|
exports.resetRememberedExpansionsForTests = SuperGroupingCard.resetRememberedExpansionsForTests;
|
|
195
204
|
exports.useActivityExpansion = SuperGroupingCard.useActivityExpansion;
|
|
196
205
|
exports.SuperGroupingTranscript = SuperGroupingTranscript.SuperGroupingTranscript;
|
|
206
|
+
exports.ToolPartPlacementProvider = toolPartPlacement.ToolPartPlacementProvider;
|
|
207
|
+
exports.useToolPartPlacement = toolPartPlacement.useToolPartPlacement;
|
|
197
208
|
exports.splitTurnSegments = turnSegments.splitTurnSegments;
|
|
198
209
|
exports.formatWorkDuration = turnTiming.formatWorkDuration;
|
|
199
210
|
exports.readTurnTiming = turnTiming.readTurnTiming;
|
|
200
211
|
exports.workedDurationMs = turnTiming.workedDurationMs;
|
|
201
212
|
exports.defaultGetToolGroupKey = toolkitMap.defaultGetToolGroupKey;
|
|
213
|
+
exports.isSdkInlineTool = inlineTools.isSdkInlineTool;
|
|
202
214
|
exports.StatewireApprovalCard = StatewireApprovalCard.StatewireApprovalCard;
|
|
203
215
|
exports.useStatewireApprovalRequest = useStatewireApprovalRequest.useStatewireApprovalRequest;
|
|
204
216
|
exports.useStatewireApprovalWait = useStatewireApprovalRequest.useStatewireApprovalWait;
|
|
217
|
+
exports.DeviceOperationProvider = deviceOperation.DeviceOperationProvider;
|
|
218
|
+
exports.UNREADABLE_DEVICE_OPERATION = deviceOperation.UNREADABLE_DEVICE_OPERATION;
|
|
219
|
+
exports.deviceOperationStamp = deviceOperation.deviceOperationStamp;
|
|
220
|
+
exports.useDeviceOperationReader = deviceOperation.useDeviceOperationReader;
|
|
221
|
+
exports.agoraApiRoot = browserDecisionCheck.agoraApiRoot;
|
|
222
|
+
exports.useAthenaBrowserDecisionConfirmer = browserDecisionCheck.useAthenaBrowserDecisionConfirmer;
|
|
223
|
+
exports.useBrowserDecisionConfirmer = browserDecisionCheck.useBrowserDecisionConfirmer;
|
|
205
224
|
exports.useAthenaRunLive = useAthenaRunLive.useAthenaRunLive;
|
|
225
|
+
exports.useAthenaVoiceLive = useAthenaVoiceLive.useAthenaVoiceLive;
|
|
226
|
+
exports.AthenaTurnEndStatus = athenaTurnEndStatus.AthenaTurnEndStatus;
|
|
227
|
+
exports.useAthenaTurnEnded = athenaTurnEndStatus.useAthenaTurnEnded;
|
|
206
228
|
exports.StatewireHistoryEdge = statewireHistoryEdge.StatewireHistoryEdge;
|
|
207
229
|
exports.ThreadLoadingOverlay = threadLoadingOverlay.ThreadLoadingOverlay;
|
|
208
230
|
exports.useStatewireToolOutputs = statewireWindowContext.useStatewireToolOutputs;
|
|
@@ -221,6 +243,7 @@ exports.athenaStatewireErrorNotice = statewireLifecycle.athenaStatewireErrorNoti
|
|
|
221
243
|
exports.threadSummaryFromConversation = statewireThreadList.threadSummaryFromConversation;
|
|
222
244
|
exports.useAthenaStatewireThreadList = statewireThreadList.useAthenaStatewireThreadList;
|
|
223
245
|
exports.useRefreshThreadList = statewireThreadList.useRefreshThreadList;
|
|
246
|
+
exports.DrivingOnChip = DrivingOnChip.DrivingOnChip;
|
|
224
247
|
exports.WaitingOnYouBanner = WaitingOnYouBanner.WaitingOnYouBanner;
|
|
225
248
|
exports.WaitingOnYouBannerView = WaitingOnYouBanner.WaitingOnYouBannerView;
|
|
226
249
|
exports.WakeMarkerCard = wakeMarker.WakeMarkerCard;
|
|
@@ -306,7 +329,6 @@ exports.describeTestRecordingStart = testRecordingReport.describeTestRecordingSt
|
|
|
306
329
|
exports.formatRecordingClock = testRecordingReport.formatRecordingClock;
|
|
307
330
|
exports.formatTestRecordingCounts = testRecordingReport.formatTestRecordingCounts;
|
|
308
331
|
exports.parseTestRecordingStopResult = testRecordingReport.parseTestRecordingStopResult;
|
|
309
|
-
exports.isSdkInlineTool = inlineTools.isSdkInlineTool;
|
|
310
332
|
exports.VoiceDelegationCard = voiceDelegationCard.VoiceDelegationCard;
|
|
311
333
|
exports.VoiceDelegationMessage = voiceDelegationCard.VoiceDelegationMessage;
|
|
312
334
|
exports.NestedPtcComponentsProvider = NestedPtcMessages.NestedPtcComponentsProvider;
|
|
@@ -426,6 +448,7 @@ exports.AthenaThreadIdContext = threadIdContext.AthenaThreadIdContext;
|
|
|
426
448
|
exports.useAthenaStatewireThreadId = threadIdContext.useAthenaStatewireThreadId;
|
|
427
449
|
exports.useAthenaThreadId = threadIdContext.useAthenaThreadId;
|
|
428
450
|
exports.useAthenaThreadModel = useAthenaThreadModel.useAthenaThreadModel;
|
|
451
|
+
exports.useAthenaSessionPersistence = sessionPersistenceContext.useAthenaSessionPersistence;
|
|
429
452
|
exports.THREAD_TITLE_MAX_LENGTH = api.THREAD_TITLE_MAX_LENGTH;
|
|
430
453
|
exports.archiveThread = api.archiveThread;
|
|
431
454
|
exports.createThread = api.createThread;
|
|
@@ -502,6 +525,7 @@ exports.TooltipTrigger = tooltip.TooltipTrigger;
|
|
|
502
525
|
exports.Collapsible = collapsible.Collapsible;
|
|
503
526
|
exports.CollapsibleContent = collapsible.CollapsibleContent;
|
|
504
527
|
exports.CollapsibleTrigger = collapsible.CollapsibleTrigger;
|
|
528
|
+
exports.ImageViewer = imageViewer.ImageViewer;
|
|
505
529
|
exports.OwnerDocumentProvider = lib_ownerDocument.OwnerDocumentProvider;
|
|
506
530
|
exports.useIsInPopoutDocument = lib_ownerDocument.useIsInPopoutDocument;
|
|
507
531
|
exports.useOwnerDocument = lib_ownerDocument.useOwnerDocument;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|