@agent-native/toolkit 0.0.0-beta-20260819143124
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 +151 -0
- package/agent-native.eject.json +588 -0
- package/dist/app-shell/header-actions.d.ts +18 -0
- package/dist/app-shell/header-actions.d.ts.map +1 -0
- package/dist/app-shell/header-actions.js +52 -0
- package/dist/app-shell/header-actions.js.map +1 -0
- package/dist/app-shell/index.d.ts +3 -0
- package/dist/app-shell/index.d.ts.map +1 -0
- package/dist/app-shell/index.js +3 -0
- package/dist/app-shell/index.js.map +1 -0
- package/dist/app-shell/sidebar-footer-actions.d.ts +14 -0
- package/dist/app-shell/sidebar-footer-actions.d.ts.map +1 -0
- package/dist/app-shell/sidebar-footer-actions.js +10 -0
- package/dist/app-shell/sidebar-footer-actions.js.map +1 -0
- package/dist/app-shell/sidebar-footer-actions.spec.d.ts +2 -0
- package/dist/app-shell/sidebar-footer-actions.spec.d.ts.map +1 -0
- package/dist/app-shell/sidebar-footer-actions.spec.js +43 -0
- package/dist/app-shell/sidebar-footer-actions.spec.js.map +1 -0
- package/dist/canvas-annotations/CanvasCommentPins.d.ts +68 -0
- package/dist/canvas-annotations/CanvasCommentPins.d.ts.map +1 -0
- package/dist/canvas-annotations/CanvasCommentPins.js +513 -0
- package/dist/canvas-annotations/CanvasCommentPins.js.map +1 -0
- package/dist/canvas-annotations/DrawOverlay.d.ts +108 -0
- package/dist/canvas-annotations/DrawOverlay.d.ts.map +1 -0
- package/dist/canvas-annotations/DrawOverlay.js +746 -0
- package/dist/canvas-annotations/DrawOverlay.js.map +1 -0
- package/dist/canvas-annotations/DrawOverlay.spec.d.ts +2 -0
- package/dist/canvas-annotations/DrawOverlay.spec.d.ts.map +1 -0
- package/dist/canvas-annotations/DrawOverlay.spec.js +111 -0
- package/dist/canvas-annotations/DrawOverlay.spec.js.map +1 -0
- package/dist/canvas-annotations/index.d.ts +4 -0
- package/dist/canvas-annotations/index.d.ts.map +1 -0
- package/dist/canvas-annotations/index.js +3 -0
- package/dist/canvas-annotations/index.js.map +1 -0
- package/dist/canvas-annotations/types.d.ts +8 -0
- package/dist/canvas-annotations/types.d.ts.map +1 -0
- package/dist/canvas-annotations/types.js +2 -0
- package/dist/canvas-annotations/types.js.map +1 -0
- package/dist/canvas-interactions/canvas-interactions.d.ts +334 -0
- package/dist/canvas-interactions/canvas-interactions.d.ts.map +1 -0
- package/dist/canvas-interactions/canvas-interactions.js +486 -0
- package/dist/canvas-interactions/canvas-interactions.js.map +1 -0
- package/dist/canvas-interactions/canvas-interactions.spec.d.ts +2 -0
- package/dist/canvas-interactions/canvas-interactions.spec.d.ts.map +1 -0
- package/dist/canvas-interactions/canvas-interactions.spec.js +593 -0
- package/dist/canvas-interactions/canvas-interactions.spec.js.map +1 -0
- package/dist/canvas-interactions/index.d.ts +2 -0
- package/dist/canvas-interactions/index.d.ts.map +1 -0
- package/dist/canvas-interactions/index.js +2 -0
- package/dist/canvas-interactions/index.js.map +1 -0
- package/dist/chat-history/ChatHistoryList.d.ts +103 -0
- package/dist/chat-history/ChatHistoryList.d.ts.map +1 -0
- package/dist/chat-history/ChatHistoryList.js +102 -0
- package/dist/chat-history/ChatHistoryList.js.map +1 -0
- package/dist/chat-history/ChatHistoryList.spec.d.ts +2 -0
- package/dist/chat-history/ChatHistoryList.spec.d.ts.map +1 -0
- package/dist/chat-history/ChatHistoryList.spec.js +293 -0
- package/dist/chat-history/ChatHistoryList.spec.js.map +1 -0
- package/dist/chat-history/ChatHistoryRail.d.ts +33 -0
- package/dist/chat-history/ChatHistoryRail.d.ts.map +1 -0
- package/dist/chat-history/ChatHistoryRail.js +35 -0
- package/dist/chat-history/ChatHistoryRail.js.map +1 -0
- package/dist/chat-history/ChatHistoryRail.spec.d.ts +2 -0
- package/dist/chat-history/ChatHistoryRail.spec.d.ts.map +1 -0
- package/dist/chat-history/ChatHistoryRail.spec.js +157 -0
- package/dist/chat-history/ChatHistoryRail.spec.js.map +1 -0
- package/dist/chat-history/index.d.ts +4 -0
- package/dist/chat-history/index.d.ts.map +1 -0
- package/dist/chat-history/index.js +4 -0
- package/dist/chat-history/index.js.map +1 -0
- package/dist/chat-history/useChatHistoryRailController.d.ts +26 -0
- package/dist/chat-history/useChatHistoryRailController.d.ts.map +1 -0
- package/dist/chat-history/useChatHistoryRailController.js +36 -0
- package/dist/chat-history/useChatHistoryRailController.js.map +1 -0
- package/dist/chat-history/useChatHistoryRailController.spec.d.ts +2 -0
- package/dist/chat-history/useChatHistoryRailController.spec.d.ts.map +1 -0
- package/dist/chat-history/useChatHistoryRailController.spec.js +101 -0
- package/dist/chat-history/useChatHistoryRailController.spec.js.map +1 -0
- package/dist/chat-history.css +469 -0
- package/dist/collab-ui/AgentPresenceChip.d.ts +12 -0
- package/dist/collab-ui/AgentPresenceChip.d.ts.map +1 -0
- package/dist/collab-ui/AgentPresenceChip.js +42 -0
- package/dist/collab-ui/AgentPresenceChip.js.map +1 -0
- package/dist/collab-ui/LiveCursorOverlay.d.ts +46 -0
- package/dist/collab-ui/LiveCursorOverlay.d.ts.map +1 -0
- package/dist/collab-ui/LiveCursorOverlay.js +125 -0
- package/dist/collab-ui/LiveCursorOverlay.js.map +1 -0
- package/dist/collab-ui/PresenceBar.d.ts +30 -0
- package/dist/collab-ui/PresenceBar.d.ts.map +1 -0
- package/dist/collab-ui/PresenceBar.js +172 -0
- package/dist/collab-ui/PresenceBar.js.map +1 -0
- package/dist/collab-ui/PresenceBar.spec.d.ts +2 -0
- package/dist/collab-ui/PresenceBar.spec.d.ts.map +1 -0
- package/dist/collab-ui/PresenceBar.spec.js +30 -0
- package/dist/collab-ui/PresenceBar.spec.js.map +1 -0
- package/dist/collab-ui/RecentEditHighlights.d.ts +46 -0
- package/dist/collab-ui/RecentEditHighlights.d.ts.map +1 -0
- package/dist/collab-ui/RecentEditHighlights.js +154 -0
- package/dist/collab-ui/RecentEditHighlights.js.map +1 -0
- package/dist/collab-ui/RemoteSelectionRings.d.ts +53 -0
- package/dist/collab-ui/RemoteSelectionRings.d.ts.map +1 -0
- package/dist/collab-ui/RemoteSelectionRings.js +130 -0
- package/dist/collab-ui/RemoteSelectionRings.js.map +1 -0
- package/dist/collab-ui/agent-identity.d.ts +9 -0
- package/dist/collab-ui/agent-identity.d.ts.map +1 -0
- package/dist/collab-ui/agent-identity.js +9 -0
- package/dist/collab-ui/agent-identity.js.map +1 -0
- package/dist/collab-ui/index.d.ts +9 -0
- package/dist/collab-ui/index.d.ts.map +1 -0
- package/dist/collab-ui/index.js +9 -0
- package/dist/collab-ui/index.js.map +1 -0
- package/dist/collab-ui/lead-client.d.ts +3 -0
- package/dist/collab-ui/lead-client.d.ts.map +1 -0
- package/dist/collab-ui/lead-client.js +29 -0
- package/dist/collab-ui/lead-client.js.map +1 -0
- package/dist/collab-ui/types.d.ts +48 -0
- package/dist/collab-ui/types.d.ts.map +1 -0
- package/dist/collab-ui/types.js +52 -0
- package/dist/collab-ui/types.js.map +1 -0
- package/dist/collab-ui/types.spec.d.ts +2 -0
- package/dist/collab-ui/types.spec.d.ts.map +1 -0
- package/dist/collab-ui/types.spec.js +15 -0
- package/dist/collab-ui/types.spec.js.map +1 -0
- package/dist/composer/AgentComposerFrame.d.ts +19 -0
- package/dist/composer/AgentComposerFrame.d.ts.map +1 -0
- package/dist/composer/AgentComposerFrame.js +17 -0
- package/dist/composer/AgentComposerFrame.js.map +1 -0
- package/dist/composer/ComposerPlusMenu.d.ts +30 -0
- package/dist/composer/ComposerPlusMenu.d.ts.map +1 -0
- package/dist/composer/ComposerPlusMenu.js +635 -0
- package/dist/composer/ComposerPlusMenu.js.map +1 -0
- package/dist/composer/ComposerPlusMenu.spec.d.ts +2 -0
- package/dist/composer/ComposerPlusMenu.spec.d.ts.map +1 -0
- package/dist/composer/ComposerPlusMenu.spec.js +12 -0
- package/dist/composer/ComposerPlusMenu.spec.js.map +1 -0
- package/dist/composer/MentionPopover.d.ts +29 -0
- package/dist/composer/MentionPopover.d.ts.map +1 -0
- package/dist/composer/MentionPopover.js +221 -0
- package/dist/composer/MentionPopover.js.map +1 -0
- package/dist/composer/PastedTextChip.d.ts +9 -0
- package/dist/composer/PastedTextChip.d.ts.map +1 -0
- package/dist/composer/PastedTextChip.js +71 -0
- package/dist/composer/PastedTextChip.js.map +1 -0
- package/dist/composer/PastedTextChip.spec.d.ts +2 -0
- package/dist/composer/PastedTextChip.spec.d.ts.map +1 -0
- package/dist/composer/PastedTextChip.spec.js +42 -0
- package/dist/composer/PastedTextChip.spec.js.map +1 -0
- package/dist/composer/PromptComposer.d.ts +151 -0
- package/dist/composer/PromptComposer.d.ts.map +1 -0
- package/dist/composer/PromptComposer.js +322 -0
- package/dist/composer/PromptComposer.js.map +1 -0
- package/dist/composer/PromptComposer.spec.d.ts +2 -0
- package/dist/composer/PromptComposer.spec.d.ts.map +1 -0
- package/dist/composer/PromptComposer.spec.js +87 -0
- package/dist/composer/PromptComposer.spec.js.map +1 -0
- package/dist/composer/RealtimeVoiceMode.d.ts +108 -0
- package/dist/composer/RealtimeVoiceMode.d.ts.map +1 -0
- package/dist/composer/RealtimeVoiceMode.js +312 -0
- package/dist/composer/RealtimeVoiceMode.js.map +1 -0
- package/dist/composer/RealtimeVoiceMode.spec.d.ts +2 -0
- package/dist/composer/RealtimeVoiceMode.spec.d.ts.map +1 -0
- package/dist/composer/RealtimeVoiceMode.spec.js +540 -0
- package/dist/composer/RealtimeVoiceMode.spec.js.map +1 -0
- package/dist/composer/TiptapComposer.d.ts +288 -0
- package/dist/composer/TiptapComposer.d.ts.map +1 -0
- package/dist/composer/TiptapComposer.js +2233 -0
- package/dist/composer/TiptapComposer.js.map +1 -0
- package/dist/composer/TiptapComposer.spec.d.ts +2 -0
- package/dist/composer/TiptapComposer.spec.d.ts.map +1 -0
- package/dist/composer/TiptapComposer.spec.js +415 -0
- package/dist/composer/TiptapComposer.spec.js.map +1 -0
- package/dist/composer/VoiceButton.d.ts +27 -0
- package/dist/composer/VoiceButton.d.ts.map +1 -0
- package/dist/composer/VoiceButton.js +151 -0
- package/dist/composer/VoiceButton.js.map +1 -0
- package/dist/composer/VoiceButton.spec.d.ts +2 -0
- package/dist/composer/VoiceButton.spec.d.ts.map +1 -0
- package/dist/composer/VoiceButton.spec.js +27 -0
- package/dist/composer/VoiceButton.spec.js.map +1 -0
- package/dist/composer/asset-picker-url.d.ts +16 -0
- package/dist/composer/asset-picker-url.d.ts.map +1 -0
- package/dist/composer/asset-picker-url.js +64 -0
- package/dist/composer/asset-picker-url.js.map +1 -0
- package/dist/composer/asset-picker-url.spec.d.ts +2 -0
- package/dist/composer/asset-picker-url.spec.d.ts.map +1 -0
- package/dist/composer/asset-picker-url.spec.js +23 -0
- package/dist/composer/asset-picker-url.spec.js.map +1 -0
- package/dist/composer/attachment-accept.d.ts +9 -0
- package/dist/composer/attachment-accept.d.ts.map +1 -0
- package/dist/composer/attachment-accept.js +69 -0
- package/dist/composer/attachment-accept.js.map +1 -0
- package/dist/composer/attachment-accept.spec.d.ts +2 -0
- package/dist/composer/attachment-accept.spec.d.ts.map +1 -0
- package/dist/composer/attachment-accept.spec.js +24 -0
- package/dist/composer/attachment-accept.spec.js.map +1 -0
- package/dist/composer/draft-key.d.ts +2 -0
- package/dist/composer/draft-key.d.ts.map +1 -0
- package/dist/composer/draft-key.js +8 -0
- package/dist/composer/draft-key.js.map +1 -0
- package/dist/composer/draft-key.spec.d.ts +2 -0
- package/dist/composer/draft-key.spec.d.ts.map +1 -0
- package/dist/composer/draft-key.spec.js +13 -0
- package/dist/composer/draft-key.spec.js.map +1 -0
- package/dist/composer/extensions/FileReference.d.ts +3 -0
- package/dist/composer/extensions/FileReference.d.ts.map +1 -0
- package/dist/composer/extensions/FileReference.js +36 -0
- package/dist/composer/extensions/FileReference.js.map +1 -0
- package/dist/composer/extensions/MentionReference.d.ts +3 -0
- package/dist/composer/extensions/MentionReference.d.ts.map +1 -0
- package/dist/composer/extensions/MentionReference.js +66 -0
- package/dist/composer/extensions/MentionReference.js.map +1 -0
- package/dist/composer/extensions/SkillReference.d.ts +3 -0
- package/dist/composer/extensions/SkillReference.d.ts.map +1 -0
- package/dist/composer/extensions/SkillReference.js +40 -0
- package/dist/composer/extensions/SkillReference.js.map +1 -0
- package/dist/composer/index.d.ts +16 -0
- package/dist/composer/index.d.ts.map +1 -0
- package/dist/composer/index.js +14 -0
- package/dist/composer/index.js.map +1 -0
- package/dist/composer/model-selection.d.ts +12 -0
- package/dist/composer/model-selection.d.ts.map +1 -0
- package/dist/composer/model-selection.js +31 -0
- package/dist/composer/model-selection.js.map +1 -0
- package/dist/composer/model-selection.spec.d.ts +2 -0
- package/dist/composer/model-selection.spec.d.ts.map +1 -0
- package/dist/composer/model-selection.spec.js +38 -0
- package/dist/composer/model-selection.spec.js.map +1 -0
- package/dist/composer/pasted-text.d.ts +31 -0
- package/dist/composer/pasted-text.d.ts.map +1 -0
- package/dist/composer/pasted-text.js +130 -0
- package/dist/composer/pasted-text.js.map +1 -0
- package/dist/composer/pasted-text.spec.d.ts +2 -0
- package/dist/composer/pasted-text.spec.d.ts.map +1 -0
- package/dist/composer/pasted-text.spec.js +107 -0
- package/dist/composer/pasted-text.spec.js.map +1 -0
- package/dist/composer/prompt-attachments.d.ts +18 -0
- package/dist/composer/prompt-attachments.d.ts.map +1 -0
- package/dist/composer/prompt-attachments.js +65 -0
- package/dist/composer/prompt-attachments.js.map +1 -0
- package/dist/composer/prompt-attachments.spec.d.ts +2 -0
- package/dist/composer/prompt-attachments.spec.d.ts.map +1 -0
- package/dist/composer/prompt-attachments.spec.js +63 -0
- package/dist/composer/prompt-attachments.spec.js.map +1 -0
- package/dist/composer/realtime-voice-audio-level.d.ts +14 -0
- package/dist/composer/realtime-voice-audio-level.d.ts.map +1 -0
- package/dist/composer/realtime-voice-audio-level.js +48 -0
- package/dist/composer/realtime-voice-audio-level.js.map +1 -0
- package/dist/composer/realtime-voice-audio-level.spec.d.ts +2 -0
- package/dist/composer/realtime-voice-audio-level.spec.d.ts.map +1 -0
- package/dist/composer/realtime-voice-audio-level.spec.js +32 -0
- package/dist/composer/realtime-voice-audio-level.spec.js.map +1 -0
- package/dist/composer/realtime-voice-transcript.d.ts +26 -0
- package/dist/composer/realtime-voice-transcript.d.ts.map +1 -0
- package/dist/composer/realtime-voice-transcript.js +103 -0
- package/dist/composer/realtime-voice-transcript.js.map +1 -0
- package/dist/composer/realtime-voice-transcript.spec.d.ts +2 -0
- package/dist/composer/realtime-voice-transcript.spec.d.ts.map +1 -0
- package/dist/composer/realtime-voice-transcript.spec.js +76 -0
- package/dist/composer/realtime-voice-transcript.spec.js.map +1 -0
- package/dist/composer/runtime-adapters.d.ts +169 -0
- package/dist/composer/runtime-adapters.d.ts.map +1 -0
- package/dist/composer/runtime-adapters.js +141 -0
- package/dist/composer/runtime-adapters.js.map +1 -0
- package/dist/composer/runtime-adapters.spec.d.ts +2 -0
- package/dist/composer/runtime-adapters.spec.d.ts.map +1 -0
- package/dist/composer/runtime-adapters.spec.js +69 -0
- package/dist/composer/runtime-adapters.spec.js.map +1 -0
- package/dist/composer/types.d.ts +60 -0
- package/dist/composer/types.d.ts.map +1 -0
- package/dist/composer/types.js +2 -0
- package/dist/composer/types.js.map +1 -0
- package/dist/composer/use-file-search.d.ts +6 -0
- package/dist/composer/use-file-search.d.ts.map +1 -0
- package/dist/composer/use-file-search.js +53 -0
- package/dist/composer/use-file-search.js.map +1 -0
- package/dist/composer/use-mention-search.d.ts +6 -0
- package/dist/composer/use-mention-search.d.ts.map +1 -0
- package/dist/composer/use-mention-search.js +75 -0
- package/dist/composer/use-mention-search.js.map +1 -0
- package/dist/composer/use-skills.d.ts +7 -0
- package/dist/composer/use-skills.d.ts.map +1 -0
- package/dist/composer/use-skills.js +40 -0
- package/dist/composer/use-skills.js.map +1 -0
- package/dist/composer/useRealtimeVoiceMode.d.ts +189 -0
- package/dist/composer/useRealtimeVoiceMode.d.ts.map +1 -0
- package/dist/composer/useRealtimeVoiceMode.js +1899 -0
- package/dist/composer/useRealtimeVoiceMode.js.map +1 -0
- package/dist/composer/useRealtimeVoiceMode.spec.d.ts +2 -0
- package/dist/composer/useRealtimeVoiceMode.spec.d.ts.map +1 -0
- package/dist/composer/useRealtimeVoiceMode.spec.js +716 -0
- package/dist/composer/useRealtimeVoiceMode.spec.js.map +1 -0
- package/dist/composer/useVoiceDictation.browser.spec.d.ts +2 -0
- package/dist/composer/useVoiceDictation.browser.spec.d.ts.map +1 -0
- package/dist/composer/useVoiceDictation.browser.spec.js +220 -0
- package/dist/composer/useVoiceDictation.browser.spec.js.map +1 -0
- package/dist/composer/useVoiceDictation.d.ts +58 -0
- package/dist/composer/useVoiceDictation.d.ts.map +1 -0
- package/dist/composer/useVoiceDictation.js +1058 -0
- package/dist/composer/useVoiceDictation.js.map +1 -0
- package/dist/composer/useVoiceDictation.spec.d.ts +2 -0
- package/dist/composer/useVoiceDictation.spec.d.ts.map +1 -0
- package/dist/composer/useVoiceDictation.spec.js +32 -0
- package/dist/composer/useVoiceDictation.spec.js.map +1 -0
- package/dist/conformance/__fixtures__/css-in-js-adapter.d.ts +7 -0
- package/dist/conformance/__fixtures__/css-in-js-adapter.d.ts.map +1 -0
- package/dist/conformance/__fixtures__/css-in-js-adapter.js +84 -0
- package/dist/conformance/__fixtures__/css-in-js-adapter.js.map +1 -0
- package/dist/conformance/conformance.spec.d.ts +2 -0
- package/dist/conformance/conformance.spec.d.ts.map +1 -0
- package/dist/conformance/conformance.spec.js +87 -0
- package/dist/conformance/conformance.spec.js.map +1 -0
- package/dist/conformance/index.d.ts +4 -0
- package/dist/conformance/index.d.ts.map +1 -0
- package/dist/conformance/index.js +4 -0
- package/dist/conformance/index.js.map +1 -0
- package/dist/conformance/runner.d.ts +12 -0
- package/dist/conformance/runner.d.ts.map +1 -0
- package/dist/conformance/runner.js +515 -0
- package/dist/conformance/runner.js.map +1 -0
- package/dist/conformance/types.d.ts +26 -0
- package/dist/conformance/types.d.ts.map +1 -0
- package/dist/conformance/types.js +13 -0
- package/dist/conformance/types.js.map +1 -0
- package/dist/conformance/version.d.ts +6 -0
- package/dist/conformance/version.d.ts.map +1 -0
- package/dist/conformance/version.js +14 -0
- package/dist/conformance/version.js.map +1 -0
- package/dist/context-ui/ContextMeter.d.ts +11 -0
- package/dist/context-ui/ContextMeter.d.ts.map +1 -0
- package/dist/context-ui/ContextMeter.js +40 -0
- package/dist/context-ui/ContextMeter.js.map +1 -0
- package/dist/context-ui/ContextMeter.spec.d.ts +2 -0
- package/dist/context-ui/ContextMeter.spec.d.ts.map +1 -0
- package/dist/context-ui/ContextMeter.spec.js +52 -0
- package/dist/context-ui/ContextMeter.spec.js.map +1 -0
- package/dist/context-ui/ContextSegmentRow.d.ts +16 -0
- package/dist/context-ui/ContextSegmentRow.d.ts.map +1 -0
- package/dist/context-ui/ContextSegmentRow.js +92 -0
- package/dist/context-ui/ContextSegmentRow.js.map +1 -0
- package/dist/context-ui/ContextTreemap.d.ts +8 -0
- package/dist/context-ui/ContextTreemap.d.ts.map +1 -0
- package/dist/context-ui/ContextTreemap.js +58 -0
- package/dist/context-ui/ContextTreemap.js.map +1 -0
- package/dist/context-ui/ContextXRayPanel.d.ts +14 -0
- package/dist/context-ui/ContextXRayPanel.d.ts.map +1 -0
- package/dist/context-ui/ContextXRayPanel.js +209 -0
- package/dist/context-ui/ContextXRayPanel.js.map +1 -0
- package/dist/context-ui/format.d.ts +6 -0
- package/dist/context-ui/format.d.ts.map +1 -0
- package/dist/context-ui/format.js +58 -0
- package/dist/context-ui/format.js.map +1 -0
- package/dist/context-ui/index.d.ts +7 -0
- package/dist/context-ui/index.d.ts.map +1 -0
- package/dist/context-ui/index.js +6 -0
- package/dist/context-ui/index.js.map +1 -0
- package/dist/context-ui/types.d.ts +41 -0
- package/dist/context-ui/types.d.ts.map +1 -0
- package/dist/context-ui/types.js +8 -0
- package/dist/context-ui/types.js.map +1 -0
- package/dist/dashboard/DataTable.d.ts +20 -0
- package/dist/dashboard/DataTable.d.ts.map +1 -0
- package/dist/dashboard/DataTable.js +87 -0
- package/dist/dashboard/DataTable.js.map +1 -0
- package/dist/dashboard/DateRangePicker.d.ts +15 -0
- package/dist/dashboard/DateRangePicker.d.ts.map +1 -0
- package/dist/dashboard/DateRangePicker.js +15 -0
- package/dist/dashboard/DateRangePicker.js.map +1 -0
- package/dist/dashboard/GenericChartPanel.d.ts +57 -0
- package/dist/dashboard/GenericChartPanel.d.ts.map +1 -0
- package/dist/dashboard/GenericChartPanel.js +119 -0
- package/dist/dashboard/GenericChartPanel.js.map +1 -0
- package/dist/dashboard/GenericChartPanel.spec.d.ts +2 -0
- package/dist/dashboard/GenericChartPanel.spec.d.ts.map +1 -0
- package/dist/dashboard/GenericChartPanel.spec.js +41 -0
- package/dist/dashboard/GenericChartPanel.spec.js.map +1 -0
- package/dist/dashboard/MetricCard.d.ts +14 -0
- package/dist/dashboard/MetricCard.d.ts.map +1 -0
- package/dist/dashboard/MetricCard.js +10 -0
- package/dist/dashboard/MetricCard.js.map +1 -0
- package/dist/dashboard/StatsCard.d.ts +16 -0
- package/dist/dashboard/StatsCard.d.ts.map +1 -0
- package/dist/dashboard/StatsCard.js +8 -0
- package/dist/dashboard/StatsCard.js.map +1 -0
- package/dist/dashboard/dashboard-layout.d.ts +49 -0
- package/dist/dashboard/dashboard-layout.d.ts.map +1 -0
- package/dist/dashboard/dashboard-layout.js +231 -0
- package/dist/dashboard/dashboard-layout.js.map +1 -0
- package/dist/dashboard/dashboard-layout.spec.d.ts +2 -0
- package/dist/dashboard/dashboard-layout.spec.d.ts.map +1 -0
- package/dist/dashboard/dashboard-layout.spec.js +52 -0
- package/dist/dashboard/dashboard-layout.spec.js.map +1 -0
- package/dist/dashboard/index.d.ts +7 -0
- package/dist/dashboard/index.d.ts.map +1 -0
- package/dist/dashboard/index.js +7 -0
- package/dist/dashboard/index.js.map +1 -0
- package/dist/data-grid/DataGrid.d.ts +92 -0
- package/dist/data-grid/DataGrid.d.ts.map +1 -0
- package/dist/data-grid/DataGrid.js +315 -0
- package/dist/data-grid/DataGrid.js.map +1 -0
- package/dist/data-grid/DataGrid.spec.d.ts +2 -0
- package/dist/data-grid/DataGrid.spec.d.ts.map +1 -0
- package/dist/data-grid/DataGrid.spec.js +134 -0
- package/dist/data-grid/DataGrid.spec.js.map +1 -0
- package/dist/data-grid/index.d.ts +2 -0
- package/dist/data-grid/index.d.ts.map +1 -0
- package/dist/data-grid/index.js +2 -0
- package/dist/data-grid/index.js.map +1 -0
- package/dist/design-system/components.d.ts +58 -0
- package/dist/design-system/components.d.ts.map +1 -0
- package/dist/design-system/components.js +88 -0
- package/dist/design-system/components.js.map +1 -0
- package/dist/design-system/context.d.ts +11 -0
- package/dist/design-system/context.d.ts.map +1 -0
- package/dist/design-system/context.js +17 -0
- package/dist/design-system/context.js.map +1 -0
- package/dist/design-system/default-adapter.d.ts +3 -0
- package/dist/design-system/default-adapter.d.ts.map +1 -0
- package/dist/design-system/default-adapter.js +172 -0
- package/dist/design-system/default-adapter.js.map +1 -0
- package/dist/design-system/default-adapter.spec.d.ts +2 -0
- package/dist/design-system/default-adapter.spec.d.ts.map +1 -0
- package/dist/design-system/default-adapter.spec.js +108 -0
- package/dist/design-system/default-adapter.spec.js.map +1 -0
- package/dist/design-system/definition.d.ts +9 -0
- package/dist/design-system/definition.d.ts.map +1 -0
- package/dist/design-system/definition.js +4 -0
- package/dist/design-system/definition.js.map +1 -0
- package/dist/design-system/design-system.spec.d.ts +2 -0
- package/dist/design-system/design-system.spec.d.ts.map +1 -0
- package/dist/design-system/design-system.spec.js +208 -0
- package/dist/design-system/design-system.spec.js.map +1 -0
- package/dist/design-system/error-boundary.d.ts +18 -0
- package/dist/design-system/error-boundary.d.ts.map +1 -0
- package/dist/design-system/error-boundary.js +16 -0
- package/dist/design-system/error-boundary.js.map +1 -0
- package/dist/design-system/index.d.ts +8 -0
- package/dist/design-system/index.d.ts.map +1 -0
- package/dist/design-system/index.js +8 -0
- package/dist/design-system/index.js.map +1 -0
- package/dist/design-system/theme.d.ts +30 -0
- package/dist/design-system/theme.d.ts.map +1 -0
- package/dist/design-system/theme.js +95 -0
- package/dist/design-system/theme.js.map +1 -0
- package/dist/design-system/theme.spec.d.ts +2 -0
- package/dist/design-system/theme.spec.d.ts.map +1 -0
- package/dist/design-system/theme.spec.js +43 -0
- package/dist/design-system/theme.spec.js.map +1 -0
- package/dist/design-system/types.d.ts +292 -0
- package/dist/design-system/types.d.ts.map +1 -0
- package/dist/design-system/types.js +2 -0
- package/dist/design-system/types.js.map +1 -0
- package/dist/design-tweaks/index.d.ts +2 -0
- package/dist/design-tweaks/index.d.ts.map +1 -0
- package/dist/design-tweaks/index.js +2 -0
- package/dist/design-tweaks/index.js.map +1 -0
- package/dist/design-tweaks/scrub-input-utils.d.ts +61 -0
- package/dist/design-tweaks/scrub-input-utils.d.ts.map +1 -0
- package/dist/design-tweaks/scrub-input-utils.js +235 -0
- package/dist/design-tweaks/scrub-input-utils.js.map +1 -0
- package/dist/design-tweaks/scrub-input.d.ts +70 -0
- package/dist/design-tweaks/scrub-input.d.ts.map +1 -0
- package/dist/design-tweaks/scrub-input.js +319 -0
- package/dist/design-tweaks/scrub-input.js.map +1 -0
- package/dist/design-tweaks/visual-style-controls.d.ts +90 -0
- package/dist/design-tweaks/visual-style-controls.d.ts.map +1 -0
- package/dist/design-tweaks/visual-style-controls.js +423 -0
- package/dist/design-tweaks/visual-style-controls.js.map +1 -0
- package/dist/design-tweaks/visual-style-controls.spec.d.ts +2 -0
- package/dist/design-tweaks/visual-style-controls.spec.d.ts.map +1 -0
- package/dist/design-tweaks/visual-style-controls.spec.js +84 -0
- package/dist/design-tweaks/visual-style-controls.spec.js.map +1 -0
- package/dist/editor/BubbleToolbar.d.ts +37 -0
- package/dist/editor/BubbleToolbar.d.ts.map +1 -0
- package/dist/editor/BubbleToolbar.js +171 -0
- package/dist/editor/BubbleToolbar.js.map +1 -0
- package/dist/editor/CodeBlockNode.d.ts +49 -0
- package/dist/editor/CodeBlockNode.d.ts.map +1 -0
- package/dist/editor/CodeBlockNode.js +127 -0
- package/dist/editor/CodeBlockNode.js.map +1 -0
- package/dist/editor/DragHandle.d.ts +103 -0
- package/dist/editor/DragHandle.d.ts.map +1 -0
- package/dist/editor/DragHandle.js +1101 -0
- package/dist/editor/DragHandle.js.map +1 -0
- package/dist/editor/DragHandle.spec.d.ts +2 -0
- package/dist/editor/DragHandle.spec.d.ts.map +1 -0
- package/dist/editor/DragHandle.spec.js +495 -0
- package/dist/editor/DragHandle.spec.js.map +1 -0
- package/dist/editor/ImageExtension.d.ts +63 -0
- package/dist/editor/ImageExtension.d.ts.map +1 -0
- package/dist/editor/ImageExtension.js +243 -0
- package/dist/editor/ImageExtension.js.map +1 -0
- package/dist/editor/ImageExtension.roundtrip.spec.d.ts +2 -0
- package/dist/editor/ImageExtension.roundtrip.spec.d.ts.map +1 -0
- package/dist/editor/ImageExtension.roundtrip.spec.js +103 -0
- package/dist/editor/ImageExtension.roundtrip.spec.js.map +1 -0
- package/dist/editor/RegistryBlockContext.d.ts +68 -0
- package/dist/editor/RegistryBlockContext.d.ts.map +1 -0
- package/dist/editor/RegistryBlockContext.js +10 -0
- package/dist/editor/RegistryBlockContext.js.map +1 -0
- package/dist/editor/RegistryBlockNode.d.ts +66 -0
- package/dist/editor/RegistryBlockNode.d.ts.map +1 -0
- package/dist/editor/RegistryBlockNode.js +406 -0
- package/dist/editor/RegistryBlockNode.js.map +1 -0
- package/dist/editor/RegistryBlockNode.spec.d.ts +2 -0
- package/dist/editor/RegistryBlockNode.spec.d.ts.map +1 -0
- package/dist/editor/RegistryBlockNode.spec.js +215 -0
- package/dist/editor/RegistryBlockNode.spec.js.map +1 -0
- package/dist/editor/RichMarkdownEditor.collab.spec.d.ts +2 -0
- package/dist/editor/RichMarkdownEditor.collab.spec.d.ts.map +1 -0
- package/dist/editor/RichMarkdownEditor.collab.spec.js +65 -0
- package/dist/editor/RichMarkdownEditor.collab.spec.js.map +1 -0
- package/dist/editor/RichMarkdownEditor.d.ts +52 -0
- package/dist/editor/RichMarkdownEditor.d.ts.map +1 -0
- package/dist/editor/RichMarkdownEditor.js +38 -0
- package/dist/editor/RichMarkdownEditor.js.map +1 -0
- package/dist/editor/RichMarkdownEditor.roundtrip.spec.d.ts +2 -0
- package/dist/editor/RichMarkdownEditor.roundtrip.spec.d.ts.map +1 -0
- package/dist/editor/RichMarkdownEditor.roundtrip.spec.js +186 -0
- package/dist/editor/RichMarkdownEditor.roundtrip.spec.js.map +1 -0
- package/dist/editor/RunId.d.ts +28 -0
- package/dist/editor/RunId.d.ts.map +1 -0
- package/dist/editor/RunId.js +60 -0
- package/dist/editor/RunId.js.map +1 -0
- package/dist/editor/SharedRichEditor.d.ts +112 -0
- package/dist/editor/SharedRichEditor.d.ts.map +1 -0
- package/dist/editor/SharedRichEditor.js +159 -0
- package/dist/editor/SharedRichEditor.js.map +1 -0
- package/dist/editor/SharedRichEditor.spec.d.ts +2 -0
- package/dist/editor/SharedRichEditor.spec.d.ts.map +1 -0
- package/dist/editor/SharedRichEditor.spec.js +63 -0
- package/dist/editor/SharedRichEditor.spec.js.map +1 -0
- package/dist/editor/SlashCommandMenu.d.ts +59 -0
- package/dist/editor/SlashCommandMenu.d.ts.map +1 -0
- package/dist/editor/SlashCommandMenu.js +279 -0
- package/dist/editor/SlashCommandMenu.js.map +1 -0
- package/dist/editor/SlashCommandMenu.spec.d.ts +2 -0
- package/dist/editor/SlashCommandMenu.spec.d.ts.map +1 -0
- package/dist/editor/SlashCommandMenu.spec.js +67 -0
- package/dist/editor/SlashCommandMenu.spec.js.map +1 -0
- package/dist/editor/disableHistory.spec.d.ts +2 -0
- package/dist/editor/disableHistory.spec.d.ts.map +1 -0
- package/dist/editor/disableHistory.spec.js +73 -0
- package/dist/editor/disableHistory.spec.js.map +1 -0
- package/dist/editor/extensions.d.ts +178 -0
- package/dist/editor/extensions.d.ts.map +1 -0
- package/dist/editor/extensions.js +264 -0
- package/dist/editor/extensions.js.map +1 -0
- package/dist/editor/gfmDoc.d.ts +24 -0
- package/dist/editor/gfmDoc.d.ts.map +1 -0
- package/dist/editor/gfmDoc.js +83 -0
- package/dist/editor/gfmDoc.js.map +1 -0
- package/dist/editor/gfmDoc.spec.d.ts +2 -0
- package/dist/editor/gfmDoc.spec.d.ts.map +1 -0
- package/dist/editor/gfmDoc.spec.js +194 -0
- package/dist/editor/gfmDoc.spec.js.map +1 -0
- package/dist/editor/index.d.ts +16 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +15 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/editor/registrySlashCommands.d.ts +68 -0
- package/dist/editor/registrySlashCommands.d.ts.map +1 -0
- package/dist/editor/registrySlashCommands.js +51 -0
- package/dist/editor/registrySlashCommands.js.map +1 -0
- package/dist/editor/structuralReorderUndo.spec.d.ts +2 -0
- package/dist/editor/structuralReorderUndo.spec.d.ts.map +1 -0
- package/dist/editor/structuralReorderUndo.spec.js +120 -0
- package/dist/editor/structuralReorderUndo.spec.js.map +1 -0
- package/dist/editor/surgical-apply.d.ts +66 -0
- package/dist/editor/surgical-apply.d.ts.map +1 -0
- package/dist/editor/surgical-apply.js +147 -0
- package/dist/editor/surgical-apply.js.map +1 -0
- package/dist/editor/surgical-apply.spec.d.ts +2 -0
- package/dist/editor/surgical-apply.spec.d.ts.map +1 -0
- package/dist/editor/surgical-apply.spec.js +257 -0
- package/dist/editor/surgical-apply.spec.js.map +1 -0
- package/dist/editor/useCollabReconcile.concurrent.spec.d.ts +2 -0
- package/dist/editor/useCollabReconcile.concurrent.spec.d.ts.map +1 -0
- package/dist/editor/useCollabReconcile.concurrent.spec.js +641 -0
- package/dist/editor/useCollabReconcile.concurrent.spec.js.map +1 -0
- package/dist/editor/useCollabReconcile.d.ts +117 -0
- package/dist/editor/useCollabReconcile.d.ts.map +1 -0
- package/dist/editor/useCollabReconcile.idempotent.spec.d.ts +2 -0
- package/dist/editor/useCollabReconcile.idempotent.spec.d.ts.map +1 -0
- package/dist/editor/useCollabReconcile.idempotent.spec.js +248 -0
- package/dist/editor/useCollabReconcile.idempotent.spec.js.map +1 -0
- package/dist/editor/useCollabReconcile.js +521 -0
- package/dist/editor/useCollabReconcile.js.map +1 -0
- package/dist/editor.css +587 -0
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.d.ts.map +1 -0
- package/dist/hooks/index.js +3 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +16 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/hooks/use-toast.d.ts +45 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/hooks/use-toast.js +127 -0
- package/dist/hooks/use-toast.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/onboarding/index.d.ts +2 -0
- package/dist/onboarding/index.d.ts.map +1 -0
- package/dist/onboarding/index.js +2 -0
- package/dist/onboarding/index.js.map +1 -0
- package/dist/provider.d.ts +15 -0
- package/dist/provider.d.ts.map +1 -0
- package/dist/provider.js +60 -0
- package/dist/provider.js.map +1 -0
- package/dist/sharing/SharePrimitives.d.ts +42 -0
- package/dist/sharing/SharePrimitives.d.ts.map +1 -0
- package/dist/sharing/SharePrimitives.js +53 -0
- package/dist/sharing/SharePrimitives.js.map +1 -0
- package/dist/sharing/VisibilityBadge.d.ts +11 -0
- package/dist/sharing/VisibilityBadge.d.ts.map +1 -0
- package/dist/sharing/VisibilityBadge.js +19 -0
- package/dist/sharing/VisibilityBadge.js.map +1 -0
- package/dist/sharing/VisibilityBadge.spec.d.ts +2 -0
- package/dist/sharing/VisibilityBadge.spec.d.ts.map +1 -0
- package/dist/sharing/VisibilityBadge.spec.js +60 -0
- package/dist/sharing/VisibilityBadge.spec.js.map +1 -0
- package/dist/sharing/index.d.ts +3 -0
- package/dist/sharing/index.d.ts.map +1 -0
- package/dist/sharing/index.js +3 -0
- package/dist/sharing/index.js.map +1 -0
- package/dist/styles.css +232 -0
- package/dist/ui/accordion.d.ts +8 -0
- package/dist/ui/accordion.d.ts.map +1 -0
- package/dist/ui/accordion.js +14 -0
- package/dist/ui/accordion.js.map +1 -0
- package/dist/ui/alert-dialog.d.ts +21 -0
- package/dist/ui/alert-dialog.d.ts.map +1 -0
- package/dist/ui/alert-dialog.js +27 -0
- package/dist/ui/alert-dialog.js.map +1 -0
- package/dist/ui/alert.d.ts +9 -0
- package/dist/ui/alert.d.ts.map +1 -0
- package/dist/ui/alert.js +23 -0
- package/dist/ui/alert.js.map +1 -0
- package/dist/ui/aspect-ratio.d.ts +4 -0
- package/dist/ui/aspect-ratio.d.ts.map +1 -0
- package/dist/ui/aspect-ratio.js +4 -0
- package/dist/ui/aspect-ratio.js.map +1 -0
- package/dist/ui/avatar.d.ts +7 -0
- package/dist/ui/avatar.d.ts.map +1 -0
- package/dist/ui/avatar.js +12 -0
- package/dist/ui/avatar.js.map +1 -0
- package/dist/ui/badge.d.ts +10 -0
- package/dist/ui/badge.d.ts.map +1 -0
- package/dist/ui/badge.js +21 -0
- package/dist/ui/badge.js.map +1 -0
- package/dist/ui/breadcrumb.d.ts +20 -0
- package/dist/ui/breadcrumb.d.ts.map +1 -0
- package/dist/ui/breadcrumb.js +24 -0
- package/dist/ui/breadcrumb.js.map +1 -0
- package/dist/ui/button.d.ts +18 -0
- package/dist/ui/button.d.ts.map +1 -0
- package/dist/ui/button.js +67 -0
- package/dist/ui/button.js.map +1 -0
- package/dist/ui/calendar.d.ts +9 -0
- package/dist/ui/calendar.d.ts.map +1 -0
- package/dist/ui/calendar.js +74 -0
- package/dist/ui/calendar.js.map +1 -0
- package/dist/ui/card.d.ts +9 -0
- package/dist/ui/card.d.ts.map +1 -0
- package/dist/ui/card.js +17 -0
- package/dist/ui/card.js.map +1 -0
- package/dist/ui/carousel.d.ts +19 -0
- package/dist/ui/carousel.d.ts.map +1 -0
- package/dist/ui/carousel.js +99 -0
- package/dist/ui/carousel.js.map +1 -0
- package/dist/ui/chart.d.ts +80 -0
- package/dist/ui/chart.d.ts.map +1 -0
- package/dist/ui/chart.js +131 -0
- package/dist/ui/chart.js.map +1 -0
- package/dist/ui/checkbox.d.ts +5 -0
- package/dist/ui/checkbox.d.ts.map +1 -0
- package/dist/ui/checkbox.js +9 -0
- package/dist/ui/checkbox.js.map +1 -0
- package/dist/ui/collapsible.d.ts +6 -0
- package/dist/ui/collapsible.d.ts.map +1 -0
- package/dist/ui/collapsible.js +6 -0
- package/dist/ui/collapsible.js.map +1 -0
- package/dist/ui/command.d.ts +85 -0
- package/dist/ui/command.d.ts.map +1 -0
- package/dist/ui/command.js +29 -0
- package/dist/ui/command.js.map +1 -0
- package/dist/ui/command.spec.d.ts +2 -0
- package/dist/ui/command.spec.d.ts.map +1 -0
- package/dist/ui/command.spec.js +29 -0
- package/dist/ui/command.spec.js.map +1 -0
- package/dist/ui/context-menu.d.ts +28 -0
- package/dist/ui/context-menu.d.ts.map +1 -0
- package/dist/ui/context-menu.js +34 -0
- package/dist/ui/context-menu.js.map +1 -0
- package/dist/ui/date-picker.d.ts +10 -0
- package/dist/ui/date-picker.d.ts.map +1 -0
- package/dist/ui/date-picker.js +20 -0
- package/dist/ui/date-picker.js.map +1 -0
- package/dist/ui/dialog.d.ts +32 -0
- package/dist/ui/dialog.d.ts.map +1 -0
- package/dist/ui/dialog.js +26 -0
- package/dist/ui/dialog.js.map +1 -0
- package/dist/ui/dialog.spec.d.ts +2 -0
- package/dist/ui/dialog.spec.d.ts.map +1 -0
- package/dist/ui/dialog.spec.js +21 -0
- package/dist/ui/dialog.spec.js.map +1 -0
- package/dist/ui/drawer.d.ts +35 -0
- package/dist/ui/drawer.d.ts.map +1 -0
- package/dist/ui/drawer.js +25 -0
- package/dist/ui/drawer.js.map +1 -0
- package/dist/ui/dropdown-menu.d.ts +32 -0
- package/dist/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/ui/dropdown-menu.js +42 -0
- package/dist/ui/dropdown-menu.js.map +1 -0
- package/dist/ui/form.d.ts +26 -0
- package/dist/ui/form.d.ts.map +1 -0
- package/dist/ui/form.js +63 -0
- package/dist/ui/form.js.map +1 -0
- package/dist/ui/hover-card.d.ts +7 -0
- package/dist/ui/hover-card.d.ts.map +1 -0
- package/dist/ui/hover-card.js +10 -0
- package/dist/ui/hover-card.js.map +1 -0
- package/dist/ui/index.d.ts +53 -0
- package/dist/ui/index.d.ts.map +1 -0
- package/dist/ui/index.js +53 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/ui/input-otp.d.ts +35 -0
- package/dist/ui/input-otp.d.ts.map +1 -0
- package/dist/ui/input-otp.js +19 -0
- package/dist/ui/input-otp.js.map +1 -0
- package/dist/ui/input.d.ts +4 -0
- package/dist/ui/input.d.ts.map +1 -0
- package/dist/ui/input.js +9 -0
- package/dist/ui/input.js.map +1 -0
- package/dist/ui/label.d.ts +6 -0
- package/dist/ui/label.d.ts.map +1 -0
- package/dist/ui/label.js +10 -0
- package/dist/ui/label.js.map +1 -0
- package/dist/ui/logo.d.ts +7 -0
- package/dist/ui/logo.d.ts.map +1 -0
- package/dist/ui/logo.js +10 -0
- package/dist/ui/logo.js.map +1 -0
- package/dist/ui/menubar.d.ts +29 -0
- package/dist/ui/menubar.d.ts.map +1 -0
- package/dist/ui/menubar.js +36 -0
- package/dist/ui/menubar.js.map +1 -0
- package/dist/ui/navigation-menu.d.ts +13 -0
- package/dist/ui/navigation-menu.d.ts.map +1 -0
- package/dist/ui/navigation-menu.js +25 -0
- package/dist/ui/navigation-menu.js.map +1 -0
- package/dist/ui/pagination.d.ts +29 -0
- package/dist/ui/pagination.d.ts.map +1 -0
- package/dist/ui/pagination.js +24 -0
- package/dist/ui/pagination.js.map +1 -0
- package/dist/ui/popover.d.ts +11 -0
- package/dist/ui/popover.d.ts.map +1 -0
- package/dist/ui/popover.js +16 -0
- package/dist/ui/popover.js.map +1 -0
- package/dist/ui/progress.d.ts +5 -0
- package/dist/ui/progress.d.ts.map +1 -0
- package/dist/ui/progress.js +8 -0
- package/dist/ui/progress.js.map +1 -0
- package/dist/ui/radio-group.d.ts +6 -0
- package/dist/ui/radio-group.d.ts.map +1 -0
- package/dist/ui/radio-group.js +15 -0
- package/dist/ui/radio-group.js.map +1 -0
- package/dist/ui/resizable.d.ts +8 -0
- package/dist/ui/resizable.d.ts.map +1 -0
- package/dist/ui/resizable.js +9 -0
- package/dist/ui/resizable.js.map +1 -0
- package/dist/ui/scroll-area.d.ts +6 -0
- package/dist/ui/scroll-area.d.ts.map +1 -0
- package/dist/ui/scroll-area.js +12 -0
- package/dist/ui/scroll-area.js.map +1 -0
- package/dist/ui/select.d.ts +16 -0
- package/dist/ui/select.d.ts.map +1 -0
- package/dist/ui/select.js +27 -0
- package/dist/ui/select.js.map +1 -0
- package/dist/ui/separator.d.ts +5 -0
- package/dist/ui/separator.d.ts.map +1 -0
- package/dist/ui/separator.js +8 -0
- package/dist/ui/separator.js.map +1 -0
- package/dist/ui/sheet.d.ts +29 -0
- package/dist/ui/sheet.d.ts.map +1 -0
- package/dist/ui/sheet.js +37 -0
- package/dist/ui/sheet.js.map +1 -0
- package/dist/ui/sidebar.d.ts +71 -0
- package/dist/ui/sidebar.d.ts.map +1 -0
- package/dist/ui/sidebar.js +230 -0
- package/dist/ui/sidebar.js.map +1 -0
- package/dist/ui/skeleton.d.ts +3 -0
- package/dist/ui/skeleton.d.ts.map +1 -0
- package/dist/ui/skeleton.js +7 -0
- package/dist/ui/skeleton.js.map +1 -0
- package/dist/ui/slider.d.ts +5 -0
- package/dist/ui/slider.d.ts.map +1 -0
- package/dist/ui/slider.js +8 -0
- package/dist/ui/slider.js.map +1 -0
- package/dist/ui/sonner.d.ts +5 -0
- package/dist/ui/sonner.d.ts.map +1 -0
- package/dist/ui/sonner.js +25 -0
- package/dist/ui/sonner.js.map +1 -0
- package/dist/ui/spinner.d.ts +3 -0
- package/dist/ui/spinner.d.ts.map +1 -0
- package/dist/ui/spinner.js +7 -0
- package/dist/ui/spinner.js.map +1 -0
- package/dist/ui/switch.d.ts +5 -0
- package/dist/ui/switch.d.ts.map +1 -0
- package/dist/ui/switch.js +8 -0
- package/dist/ui/switch.js.map +1 -0
- package/dist/ui/table.d.ts +11 -0
- package/dist/ui/table.d.ts.map +1 -0
- package/dist/ui/table.js +21 -0
- package/dist/ui/table.js.map +1 -0
- package/dist/ui/tabs.d.ts +8 -0
- package/dist/ui/tabs.d.ts.map +1 -0
- package/dist/ui/tabs.js +13 -0
- package/dist/ui/tabs.js.map +1 -0
- package/dist/ui/textarea.d.ts +6 -0
- package/dist/ui/textarea.d.ts.map +1 -0
- package/dist/ui/textarea.js +9 -0
- package/dist/ui/textarea.js.map +1 -0
- package/dist/ui/toast.d.ts +16 -0
- package/dist/ui/toast.d.ts.map +1 -0
- package/dist/ui/toast.js +34 -0
- package/dist/ui/toast.js.map +1 -0
- package/dist/ui/toaster.d.ts +2 -0
- package/dist/ui/toaster.d.ts.map +1 -0
- package/dist/ui/toaster.js +10 -0
- package/dist/ui/toaster.js.map +1 -0
- package/dist/ui/toggle-group.d.ts +13 -0
- package/dist/ui/toggle-group.d.ts.map +1 -0
- package/dist/ui/toggle-group.js +21 -0
- package/dist/ui/toggle-group.js.map +1 -0
- package/dist/ui/toggle.d.ts +13 -0
- package/dist/ui/toggle.d.ts.map +1 -0
- package/dist/ui/toggle.js +26 -0
- package/dist/ui/toggle.js.map +1 -0
- package/dist/ui/tooltip.d.ts +11 -0
- package/dist/ui/tooltip.d.ts.map +1 -0
- package/dist/ui/tooltip.js +18 -0
- package/dist/ui/tooltip.js.map +1 -0
- package/dist/ui/use-toast.d.ts +3 -0
- package/dist/ui/use-toast.d.ts.map +1 -0
- package/dist/ui/use-toast.js +3 -0
- package/dist/ui/use-toast.js.map +1 -0
- package/dist/utils.d.ts +4 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +7 -0
- package/dist/utils.js.map +1 -0
- package/migration-manifest.json +4 -0
- package/package.json +369 -0
- package/src/app-shell/header-actions.tsx +84 -0
- package/src/app-shell/index.ts +2 -0
- package/src/app-shell/sidebar-footer-actions.spec.tsx +81 -0
- package/src/app-shell/sidebar-footer-actions.tsx +45 -0
- package/src/canvas-annotations/CanvasCommentPins.tsx +861 -0
- package/src/canvas-annotations/DrawOverlay.spec.tsx +145 -0
- package/src/canvas-annotations/DrawOverlay.tsx +1233 -0
- package/src/canvas-annotations/index.ts +15 -0
- package/src/canvas-annotations/types.ts +14 -0
- package/src/canvas-interactions/canvas-interactions.spec.ts +765 -0
- package/src/canvas-interactions/canvas-interactions.ts +965 -0
- package/src/canvas-interactions/index.ts +67 -0
- package/src/chat-history/ChatHistoryList.spec.tsx +485 -0
- package/src/chat-history/ChatHistoryList.tsx +481 -0
- package/src/chat-history/ChatHistoryRail.spec.tsx +312 -0
- package/src/chat-history/ChatHistoryRail.tsx +150 -0
- package/src/chat-history/index.ts +21 -0
- package/src/chat-history/useChatHistoryRailController.spec.tsx +131 -0
- package/src/chat-history/useChatHistoryRailController.ts +76 -0
- package/src/chat-history.css +469 -0
- package/src/collab-ui/AgentPresenceChip.tsx +69 -0
- package/src/collab-ui/LiveCursorOverlay.tsx +241 -0
- package/src/collab-ui/PresenceBar.spec.tsx +44 -0
- package/src/collab-ui/PresenceBar.tsx +373 -0
- package/src/collab-ui/RecentEditHighlights.tsx +239 -0
- package/src/collab-ui/RemoteSelectionRings.tsx +227 -0
- package/src/collab-ui/agent-identity.ts +16 -0
- package/src/collab-ui/index.ts +39 -0
- package/src/collab-ui/lead-client.ts +32 -0
- package/src/collab-ui/types.spec.ts +18 -0
- package/src/collab-ui/types.ts +96 -0
- package/src/composer/AgentComposerFrame.tsx +62 -0
- package/src/composer/ComposerPlusMenu.spec.ts +14 -0
- package/src/composer/ComposerPlusMenu.tsx +1266 -0
- package/src/composer/MentionPopover.tsx +483 -0
- package/src/composer/PastedTextChip.spec.tsx +58 -0
- package/src/composer/PastedTextChip.tsx +178 -0
- package/src/composer/PromptComposer.spec.ts +110 -0
- package/src/composer/PromptComposer.tsx +796 -0
- package/src/composer/RealtimeVoiceMode.spec.tsx +998 -0
- package/src/composer/RealtimeVoiceMode.tsx +1019 -0
- package/src/composer/TiptapComposer.spec.ts +592 -0
- package/src/composer/TiptapComposer.tsx +3746 -0
- package/src/composer/VoiceButton.spec.ts +49 -0
- package/src/composer/VoiceButton.tsx +329 -0
- package/src/composer/asset-picker-url.spec.ts +56 -0
- package/src/composer/asset-picker-url.ts +80 -0
- package/src/composer/attachment-accept.spec.ts +32 -0
- package/src/composer/attachment-accept.ts +75 -0
- package/src/composer/draft-key.spec.ts +19 -0
- package/src/composer/draft-key.ts +7 -0
- package/src/composer/extensions/FileReference.tsx +55 -0
- package/src/composer/extensions/MentionReference.tsx +93 -0
- package/src/composer/extensions/SkillReference.tsx +56 -0
- package/src/composer/index.ts +86 -0
- package/src/composer/model-selection.spec.ts +45 -0
- package/src/composer/model-selection.ts +51 -0
- package/src/composer/pasted-text.spec.ts +162 -0
- package/src/composer/pasted-text.ts +160 -0
- package/src/composer/prompt-attachments.spec.ts +80 -0
- package/src/composer/prompt-attachments.ts +93 -0
- package/src/composer/realtime-voice-audio-level.spec.ts +47 -0
- package/src/composer/realtime-voice-audio-level.ts +65 -0
- package/src/composer/realtime-voice-transcript.spec.ts +95 -0
- package/src/composer/realtime-voice-transcript.ts +134 -0
- package/src/composer/runtime-adapters.spec.tsx +102 -0
- package/src/composer/runtime-adapters.tsx +364 -0
- package/src/composer/types.ts +66 -0
- package/src/composer/use-file-search.ts +64 -0
- package/src/composer/use-mention-search.ts +90 -0
- package/src/composer/use-skills.ts +45 -0
- package/src/composer/useRealtimeVoiceMode.spec.ts +952 -0
- package/src/composer/useRealtimeVoiceMode.tsx +2388 -0
- package/src/composer/useVoiceDictation.browser.spec.tsx +265 -0
- package/src/composer/useVoiceDictation.spec.ts +45 -0
- package/src/composer/useVoiceDictation.ts +1256 -0
- package/src/conformance/__fixtures__/css-in-js-adapter.tsx +401 -0
- package/src/conformance/conformance.spec.tsx +143 -0
- package/src/conformance/index.ts +3 -0
- package/src/conformance/runner.tsx +862 -0
- package/src/conformance/types.ts +45 -0
- package/src/conformance/version.ts +22 -0
- package/src/context-ui/ContextMeter.spec.tsx +73 -0
- package/src/context-ui/ContextMeter.tsx +131 -0
- package/src/context-ui/ContextSegmentRow.tsx +273 -0
- package/src/context-ui/ContextTreemap.tsx +131 -0
- package/src/context-ui/ContextXRayPanel.tsx +491 -0
- package/src/context-ui/format.ts +42 -0
- package/src/context-ui/index.ts +15 -0
- package/src/context-ui/types.ts +57 -0
- package/src/dashboard/DataTable.tsx +273 -0
- package/src/dashboard/DateRangePicker.tsx +57 -0
- package/src/dashboard/GenericChartPanel.spec.tsx +53 -0
- package/src/dashboard/GenericChartPanel.tsx +461 -0
- package/src/dashboard/MetricCard.tsx +54 -0
- package/src/dashboard/StatsCard.tsx +49 -0
- package/src/dashboard/dashboard-layout.spec.ts +79 -0
- package/src/dashboard/dashboard-layout.ts +329 -0
- package/src/dashboard/index.ts +6 -0
- package/src/data-grid/DataGrid.spec.tsx +243 -0
- package/src/data-grid/DataGrid.tsx +754 -0
- package/src/data-grid/index.ts +15 -0
- package/src/design-system/components.tsx +196 -0
- package/src/design-system/context.tsx +31 -0
- package/src/design-system/default-adapter.spec.tsx +158 -0
- package/src/design-system/default-adapter.tsx +923 -0
- package/src/design-system/definition.ts +14 -0
- package/src/design-system/design-system.spec.tsx +356 -0
- package/src/design-system/error-boundary.tsx +37 -0
- package/src/design-system/index.ts +7 -0
- package/src/design-system/theme.spec.ts +61 -0
- package/src/design-system/theme.ts +145 -0
- package/src/design-system/types.ts +367 -0
- package/src/design-tweaks/index.ts +1 -0
- package/src/design-tweaks/scrub-input-utils.ts +311 -0
- package/src/design-tweaks/scrub-input.tsx +525 -0
- package/src/design-tweaks/visual-style-controls.spec.tsx +172 -0
- package/src/design-tweaks/visual-style-controls.tsx +1043 -0
- package/src/editor/BubbleToolbar.tsx +253 -0
- package/src/editor/CodeBlockNode.tsx +254 -0
- package/src/editor/DragHandle.spec.ts +694 -0
- package/src/editor/DragHandle.ts +1491 -0
- package/src/editor/ImageExtension.roundtrip.spec.ts +117 -0
- package/src/editor/ImageExtension.ts +306 -0
- package/src/editor/RegistryBlockContext.tsx +107 -0
- package/src/editor/RegistryBlockNode.spec.ts +279 -0
- package/src/editor/RegistryBlockNode.tsx +652 -0
- package/src/editor/RichMarkdownEditor.collab.spec.ts +79 -0
- package/src/editor/RichMarkdownEditor.roundtrip.spec.ts +226 -0
- package/src/editor/RichMarkdownEditor.tsx +81 -0
- package/src/editor/RunId.ts +61 -0
- package/src/editor/SharedRichEditor.spec.tsx +82 -0
- package/src/editor/SharedRichEditor.tsx +353 -0
- package/src/editor/SlashCommandMenu.spec.ts +90 -0
- package/src/editor/SlashCommandMenu.tsx +396 -0
- package/src/editor/disableHistory.spec.ts +85 -0
- package/src/editor/extensions.ts +454 -0
- package/src/editor/gfmDoc.spec.ts +230 -0
- package/src/editor/gfmDoc.ts +92 -0
- package/src/editor/index.ts +96 -0
- package/src/editor/registrySlashCommands.ts +131 -0
- package/src/editor/structuralReorderUndo.spec.ts +144 -0
- package/src/editor/surgical-apply.spec.ts +279 -0
- package/src/editor/surgical-apply.ts +192 -0
- package/src/editor/useCollabReconcile.concurrent.spec.ts +781 -0
- package/src/editor/useCollabReconcile.idempotent.spec.ts +324 -0
- package/src/editor/useCollabReconcile.ts +684 -0
- package/src/editor.css +587 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/use-mobile.tsx +21 -0
- package/src/hooks/use-toast.ts +188 -0
- package/src/index.ts +10 -0
- package/src/onboarding/index.ts +1 -0
- package/src/provider.tsx +148 -0
- package/src/sharing/SharePrimitives.tsx +224 -0
- package/src/sharing/VisibilityBadge.spec.ts +96 -0
- package/src/sharing/VisibilityBadge.tsx +37 -0
- package/src/sharing/index.ts +16 -0
- package/src/styles.css +232 -0
- package/src/ui/accordion.tsx +56 -0
- package/src/ui/alert-dialog.tsx +141 -0
- package/src/ui/alert.tsx +59 -0
- package/src/ui/aspect-ratio.tsx +5 -0
- package/src/ui/avatar.tsx +48 -0
- package/src/ui/badge.tsx +37 -0
- package/src/ui/breadcrumb.tsx +115 -0
- package/src/ui/button.tsx +167 -0
- package/src/ui/calendar.tsx +214 -0
- package/src/ui/card.tsx +86 -0
- package/src/ui/carousel.tsx +260 -0
- package/src/ui/chart.tsx +375 -0
- package/src/ui/checkbox.tsx +28 -0
- package/src/ui/collapsible.tsx +9 -0
- package/src/ui/command.spec.tsx +51 -0
- package/src/ui/command.tsx +174 -0
- package/src/ui/context-menu.tsx +202 -0
- package/src/ui/date-picker.tsx +67 -0
- package/src/ui/dialog.spec.tsx +43 -0
- package/src/ui/dialog.tsx +171 -0
- package/src/ui/drawer.tsx +126 -0
- package/src/ui/dropdown-menu.tsx +222 -0
- package/src/ui/form.tsx +177 -0
- package/src/ui/hover-card.tsx +27 -0
- package/src/ui/index.ts +52 -0
- package/src/ui/input-otp.tsx +69 -0
- package/src/ui/input.tsx +22 -0
- package/src/ui/label.tsx +24 -0
- package/src/ui/logo.tsx +36 -0
- package/src/ui/menubar.tsx +235 -0
- package/src/ui/navigation-menu.tsx +128 -0
- package/src/ui/pagination.tsx +121 -0
- package/src/ui/popover.tsx +58 -0
- package/src/ui/progress.tsx +27 -0
- package/src/ui/radio-group.tsx +42 -0
- package/src/ui/resizable.tsx +43 -0
- package/src/ui/scroll-area.tsx +46 -0
- package/src/ui/select.tsx +162 -0
- package/src/ui/separator.tsx +29 -0
- package/src/ui/sheet.tsx +160 -0
- package/src/ui/sidebar.tsx +776 -0
- package/src/ui/skeleton.tsx +18 -0
- package/src/ui/slider.tsx +26 -0
- package/src/ui/sonner.tsx +58 -0
- package/src/ui/spinner.tsx +17 -0
- package/src/ui/switch.tsx +27 -0
- package/src/ui/table.tsx +110 -0
- package/src/ui/tabs.tsx +53 -0
- package/src/ui/textarea.tsx +23 -0
- package/src/ui/toast.tsx +127 -0
- package/src/ui/toaster.tsx +33 -0
- package/src/ui/toggle-group.tsx +59 -0
- package/src/ui/toggle.tsx +43 -0
- package/src/ui/tooltip.tsx +57 -0
- package/src/ui/use-toast.ts +3 -0
- package/src/utils.ts +8 -0
|
@@ -0,0 +1,1058 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Voice dictation hook for the agent composer.
|
|
3
|
+
*
|
|
4
|
+
* Wires voice providers behind a single state machine:
|
|
5
|
+
* - "auto" / "openai" / "builder" / "builder-gemini" / "gemini" / "groq"
|
|
6
|
+
* — MediaRecorder → POST /_agent-native/transcribe-voice
|
|
7
|
+
* - "google-realtime"
|
|
8
|
+
* — MediaRecorder chunks → POST /_agent-native/transcribe-stream/session
|
|
9
|
+
* → managed WebSocket → Google Speech-to-Text streaming
|
|
10
|
+
* - "browser" — Web Speech API (low quality, offline capable)
|
|
11
|
+
*
|
|
12
|
+
* Provider preference lives in application_state under
|
|
13
|
+
* `voice-transcription-prefs` (`{ transcriptionMode, provider, instructions }`).
|
|
14
|
+
* The composer reads it on every start so settings changes take effect
|
|
15
|
+
* immediately without unmounting the composer.
|
|
16
|
+
*
|
|
17
|
+
* The hook exposes amplitude (0..1) and duration (ms) so the composer can
|
|
18
|
+
* render the Lovable-style live waveform + MM:SS timer.
|
|
19
|
+
*/
|
|
20
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
21
|
+
import { applyVoiceContextReplacements, useComposerRuntimeAdapters, } from "./runtime-adapters.js";
|
|
22
|
+
const PREFS_KEY = "voice-transcription-prefs";
|
|
23
|
+
const CLEANUP_PREFS_KEY = "voice-cleanup-prefs";
|
|
24
|
+
const PREFS_URL = `/_agent-native/application-state/${PREFS_KEY}`;
|
|
25
|
+
const CLEANUP_PREFS_URL = `/_agent-native/application-state/${CLEANUP_PREFS_KEY}`;
|
|
26
|
+
const TRANSCRIBE_URL = "/_agent-native/transcribe-voice";
|
|
27
|
+
const GOOGLE_REALTIME_SESSION_URL = "/_agent-native/transcribe-stream/session";
|
|
28
|
+
const GOOGLE_REALTIME_WS_PROTOCOL = "google-realtime.v1";
|
|
29
|
+
function isVoiceProvider(value) {
|
|
30
|
+
return (value === "auto" ||
|
|
31
|
+
value === "openai" ||
|
|
32
|
+
value === "browser" ||
|
|
33
|
+
value === "google-realtime" ||
|
|
34
|
+
value === "builder-gemini" ||
|
|
35
|
+
value === "builder" ||
|
|
36
|
+
value === "gemini" ||
|
|
37
|
+
value === "groq");
|
|
38
|
+
}
|
|
39
|
+
function isTranscriptionMode(value) {
|
|
40
|
+
return (value === "mac-native" || value === "google-realtime" || value === "batch");
|
|
41
|
+
}
|
|
42
|
+
async function defaultProvider() {
|
|
43
|
+
return "auto";
|
|
44
|
+
}
|
|
45
|
+
function normalizeProviderForMode(mode, provider) {
|
|
46
|
+
if (mode === "mac-native")
|
|
47
|
+
return "browser";
|
|
48
|
+
if (mode === "google-realtime")
|
|
49
|
+
return "google-realtime";
|
|
50
|
+
if (mode === "batch") {
|
|
51
|
+
if (!provider || provider === "browser")
|
|
52
|
+
return "auto";
|
|
53
|
+
return provider === "builder" ? "builder-gemini" : provider;
|
|
54
|
+
}
|
|
55
|
+
if (!provider)
|
|
56
|
+
return null;
|
|
57
|
+
return provider === "builder" ? "builder-gemini" : provider;
|
|
58
|
+
}
|
|
59
|
+
async function readVoicePrefs(resolvePath) {
|
|
60
|
+
const cleanupPrefs = await readVoiceCleanupPrefs(resolvePath);
|
|
61
|
+
try {
|
|
62
|
+
const res = await fetch(resolvePath(PREFS_URL));
|
|
63
|
+
if (!res.ok) {
|
|
64
|
+
return {
|
|
65
|
+
provider: await defaultProvider(),
|
|
66
|
+
cleanupEnabled: cleanupPrefs.enabled,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const body = (await res.json());
|
|
70
|
+
const value = body?.value ??
|
|
71
|
+
body;
|
|
72
|
+
const mode = isTranscriptionMode(value?.transcriptionMode)
|
|
73
|
+
? value.transcriptionMode
|
|
74
|
+
: undefined;
|
|
75
|
+
const p = body?.provider ??
|
|
76
|
+
body?.value?.provider;
|
|
77
|
+
const instructions = body?.instructions ??
|
|
78
|
+
body?.value?.instructions;
|
|
79
|
+
const provider = normalizeProviderForMode(mode, isVoiceProvider(p) ? p : null);
|
|
80
|
+
if (provider) {
|
|
81
|
+
return {
|
|
82
|
+
transcriptionMode: mode,
|
|
83
|
+
provider,
|
|
84
|
+
cleanupEnabled: cleanupPrefs.enabled,
|
|
85
|
+
instructions: typeof instructions === "string" ? instructions.trim() : undefined,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
/* fall through */
|
|
91
|
+
}
|
|
92
|
+
return {
|
|
93
|
+
provider: await defaultProvider(),
|
|
94
|
+
cleanupEnabled: cleanupPrefs.enabled,
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
async function readVoiceCleanupPrefs(resolvePath) {
|
|
98
|
+
try {
|
|
99
|
+
const res = await fetch(resolvePath(CLEANUP_PREFS_URL));
|
|
100
|
+
if (!res.ok)
|
|
101
|
+
return {};
|
|
102
|
+
const body = (await res.json());
|
|
103
|
+
const value = body?.value ??
|
|
104
|
+
body;
|
|
105
|
+
return { enabled: value?.enabled === true };
|
|
106
|
+
}
|
|
107
|
+
catch {
|
|
108
|
+
return {};
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function getSpeechRecognitionCtor() {
|
|
112
|
+
if (typeof window === "undefined")
|
|
113
|
+
return null;
|
|
114
|
+
return (window.SpeechRecognition ||
|
|
115
|
+
window.webkitSpeechRecognition ||
|
|
116
|
+
null);
|
|
117
|
+
}
|
|
118
|
+
function pickMimeType() {
|
|
119
|
+
if (typeof MediaRecorder === "undefined")
|
|
120
|
+
return "audio/webm";
|
|
121
|
+
const candidates = [
|
|
122
|
+
"audio/webm;codecs=opus",
|
|
123
|
+
"audio/webm",
|
|
124
|
+
"audio/mp4",
|
|
125
|
+
"audio/ogg;codecs=opus",
|
|
126
|
+
];
|
|
127
|
+
for (const mime of candidates) {
|
|
128
|
+
try {
|
|
129
|
+
if (MediaRecorder.isTypeSupported(mime))
|
|
130
|
+
return mime;
|
|
131
|
+
}
|
|
132
|
+
catch {
|
|
133
|
+
/* ignore */
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return "audio/webm";
|
|
137
|
+
}
|
|
138
|
+
async function resolveVoiceContextPack(source) {
|
|
139
|
+
try {
|
|
140
|
+
const value = typeof source === "function" ? await source() : source;
|
|
141
|
+
return value && typeof value === "object" ? value : undefined;
|
|
142
|
+
}
|
|
143
|
+
catch {
|
|
144
|
+
return undefined;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function appendVoiceContext(form, contextPack) {
|
|
148
|
+
if (!contextPack)
|
|
149
|
+
return;
|
|
150
|
+
try {
|
|
151
|
+
form.append("voiceContext", JSON.stringify(contextPack));
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
/* best effort */
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export function providerForTextCleanup(provider) {
|
|
158
|
+
return provider === "google-realtime" ? "auto" : provider;
|
|
159
|
+
}
|
|
160
|
+
async function cleanupRecognizedText({ text, provider, instructions, contextPack, resolvePath, replaceContext, }) {
|
|
161
|
+
if (provider === "browser") {
|
|
162
|
+
return replaceContext(text, contextPack);
|
|
163
|
+
}
|
|
164
|
+
const form = new FormData();
|
|
165
|
+
form.append("text", text);
|
|
166
|
+
form.append("provider", providerForTextCleanup(provider));
|
|
167
|
+
if (instructions?.trim()) {
|
|
168
|
+
form.append("instructions", instructions.trim());
|
|
169
|
+
}
|
|
170
|
+
appendVoiceContext(form, contextPack);
|
|
171
|
+
const res = await fetch(resolvePath(TRANSCRIBE_URL), {
|
|
172
|
+
method: "POST",
|
|
173
|
+
body: form,
|
|
174
|
+
});
|
|
175
|
+
if (!res.ok) {
|
|
176
|
+
const body = await res
|
|
177
|
+
.json()
|
|
178
|
+
.catch(() => ({ error: `HTTP ${res.status}` }));
|
|
179
|
+
throw new Error(body.error || `Transcript cleanup failed (${res.status})`);
|
|
180
|
+
}
|
|
181
|
+
const data = (await res.json());
|
|
182
|
+
return (data.text ?? "").trim() || text;
|
|
183
|
+
}
|
|
184
|
+
function microphoneBlockedByPermissionsPolicy() {
|
|
185
|
+
if (typeof document === "undefined")
|
|
186
|
+
return false;
|
|
187
|
+
const doc = document;
|
|
188
|
+
const policy = doc.permissionsPolicy ?? doc.featurePolicy ?? null;
|
|
189
|
+
if (!policy?.allowsFeature)
|
|
190
|
+
return false;
|
|
191
|
+
try {
|
|
192
|
+
return !policy.allowsFeature("microphone");
|
|
193
|
+
}
|
|
194
|
+
catch {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
export function voiceDictationStartErrorMessage(error) {
|
|
199
|
+
const name = typeof error?.name === "string"
|
|
200
|
+
? error.name
|
|
201
|
+
: "";
|
|
202
|
+
const message = typeof error?.message === "string"
|
|
203
|
+
? error.message
|
|
204
|
+
: "";
|
|
205
|
+
if (microphoneBlockedByPermissionsPolicy() ||
|
|
206
|
+
/permissions[- ]policy|feature policy/i.test(message)) {
|
|
207
|
+
return "This app is blocking microphone access through its browser permissions policy. Reload the app, or open it directly in a browser tab.";
|
|
208
|
+
}
|
|
209
|
+
if (name === "NotAllowedError" ||
|
|
210
|
+
name === "SecurityError" ||
|
|
211
|
+
/permission|denied|not allowed/i.test(message)) {
|
|
212
|
+
return "Microphone access is blocked. Click the site controls icon in the address bar, set Microphone to Allow for this app, then try again.";
|
|
213
|
+
}
|
|
214
|
+
if (name === "NotFoundError" || name === "DevicesNotFoundError") {
|
|
215
|
+
return "No microphone was found. Plug one in or choose a different input, then try again.";
|
|
216
|
+
}
|
|
217
|
+
if (name === "NotReadableError" || name === "TrackStartError") {
|
|
218
|
+
return "Your microphone is busy in another app. Close the other app or choose a different input, then try again.";
|
|
219
|
+
}
|
|
220
|
+
return message || "Could not start recording";
|
|
221
|
+
}
|
|
222
|
+
/** Retrying these through another provider re-prompts and fails the same way. */
|
|
223
|
+
function isMicPermissionError(error) {
|
|
224
|
+
return (error === "not-allowed" ||
|
|
225
|
+
error === "service-not-allowed" ||
|
|
226
|
+
error === "audio-capture");
|
|
227
|
+
}
|
|
228
|
+
export function voiceDictationSpeechErrorMessage(error) {
|
|
229
|
+
if (error === "not-allowed" || error === "service-not-allowed") {
|
|
230
|
+
return voiceDictationStartErrorMessage({
|
|
231
|
+
name: "NotAllowedError",
|
|
232
|
+
message: error,
|
|
233
|
+
});
|
|
234
|
+
}
|
|
235
|
+
if (error === "audio-capture") {
|
|
236
|
+
return "No microphone was found. Plug one in or choose a different input, then try again.";
|
|
237
|
+
}
|
|
238
|
+
if (error === "network") {
|
|
239
|
+
return "Speech recognition couldn't reach its service. Check your connection, or pick a different source in Settings → Voice Transcription.";
|
|
240
|
+
}
|
|
241
|
+
if (error === "aborted" || error === undefined) {
|
|
242
|
+
return "Dictation stopped before it captured any audio. Another app or tab may be holding the microphone — close it, or pick a different source in Settings → Voice Transcription.";
|
|
243
|
+
}
|
|
244
|
+
return `Speech recognition error: ${error}`;
|
|
245
|
+
}
|
|
246
|
+
export function useVoiceDictation(options) {
|
|
247
|
+
const adapters = useComposerRuntimeAdapters();
|
|
248
|
+
const resolvePath = adapters.resolvePath;
|
|
249
|
+
const replaceContext = adapters.voice.applyContextReplacements ?? applyVoiceContextReplacements;
|
|
250
|
+
const { onTranscript, onError, onLiveUpdate, contextPack } = options;
|
|
251
|
+
const onTranscriptRef = useRef(onTranscript);
|
|
252
|
+
const onErrorRef = useRef(onError);
|
|
253
|
+
const onLiveUpdateRef = useRef(onLiveUpdate);
|
|
254
|
+
const contextPackRef = useRef(contextPack);
|
|
255
|
+
onTranscriptRef.current = onTranscript;
|
|
256
|
+
onErrorRef.current = onError;
|
|
257
|
+
onLiveUpdateRef.current = onLiveUpdate;
|
|
258
|
+
contextPackRef.current = contextPack;
|
|
259
|
+
const [state, setState] = useState("idle");
|
|
260
|
+
const [amplitude, setAmplitude] = useState(0);
|
|
261
|
+
const [durationMs, setDurationMs] = useState(0);
|
|
262
|
+
const [errorMessage, setErrorMessage] = useState(null);
|
|
263
|
+
const [provider, setProvider] = useState("auto");
|
|
264
|
+
// Keep refs for teardown / cross-branch access.
|
|
265
|
+
const mediaStreamRef = useRef(null);
|
|
266
|
+
const mediaRecorderRef = useRef(null);
|
|
267
|
+
const chunksRef = useRef([]);
|
|
268
|
+
const audioContextRef = useRef(null);
|
|
269
|
+
const analyserRef = useRef(null);
|
|
270
|
+
const rafRef = useRef(null);
|
|
271
|
+
const timerRef = useRef(null);
|
|
272
|
+
const startedAtRef = useRef(0);
|
|
273
|
+
const cancelledRef = useRef(false);
|
|
274
|
+
const speechRef = useRef(null);
|
|
275
|
+
const speechTranscriptRef = useRef("");
|
|
276
|
+
const activeProviderRef = useRef("browser");
|
|
277
|
+
// Parallel live recognition for OpenAI mode (provides instant preview while MediaRecorder captures)
|
|
278
|
+
const liveSpeechRef = useRef(null);
|
|
279
|
+
const liveTextRef = useRef("");
|
|
280
|
+
const realtimeSocketRef = useRef(null);
|
|
281
|
+
const realtimeFinalRef = useRef("");
|
|
282
|
+
const realtimeInterimRef = useRef("");
|
|
283
|
+
const realtimeStopTimeoutRef = useRef(null);
|
|
284
|
+
const mediaRecorderSupported = typeof window !== "undefined" &&
|
|
285
|
+
typeof navigator !== "undefined" &&
|
|
286
|
+
!!navigator.mediaDevices?.getUserMedia &&
|
|
287
|
+
typeof window.MediaRecorder !== "undefined";
|
|
288
|
+
const speechSupported = !!getSpeechRecognitionCtor();
|
|
289
|
+
const supported = mediaRecorderSupported || speechSupported;
|
|
290
|
+
const teardown = useCallback(() => {
|
|
291
|
+
if (rafRef.current != null) {
|
|
292
|
+
cancelAnimationFrame(rafRef.current);
|
|
293
|
+
rafRef.current = null;
|
|
294
|
+
}
|
|
295
|
+
if (timerRef.current != null) {
|
|
296
|
+
clearInterval(timerRef.current);
|
|
297
|
+
timerRef.current = null;
|
|
298
|
+
}
|
|
299
|
+
if (mediaStreamRef.current) {
|
|
300
|
+
for (const track of mediaStreamRef.current.getTracks()) {
|
|
301
|
+
track.stop();
|
|
302
|
+
}
|
|
303
|
+
mediaStreamRef.current = null;
|
|
304
|
+
}
|
|
305
|
+
if (audioContextRef.current) {
|
|
306
|
+
audioContextRef.current.close().catch(() => { });
|
|
307
|
+
audioContextRef.current = null;
|
|
308
|
+
}
|
|
309
|
+
if (speechRef.current) {
|
|
310
|
+
// Stop the Web Speech session before dropping the ref so the browser
|
|
311
|
+
// releases the mic and stops dispatching onresult events into a stale
|
|
312
|
+
// closure. abort() is fire-and-forget (no final result); stop() would
|
|
313
|
+
// deliver remaining partials but we've already cleared state.
|
|
314
|
+
try {
|
|
315
|
+
speechRef.current.abort?.();
|
|
316
|
+
}
|
|
317
|
+
catch {
|
|
318
|
+
/* ignore */
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
if (liveSpeechRef.current) {
|
|
322
|
+
try {
|
|
323
|
+
liveSpeechRef.current.abort?.();
|
|
324
|
+
}
|
|
325
|
+
catch {
|
|
326
|
+
/* ignore */
|
|
327
|
+
}
|
|
328
|
+
liveSpeechRef.current = null;
|
|
329
|
+
}
|
|
330
|
+
if (realtimeSocketRef.current) {
|
|
331
|
+
const socket = realtimeSocketRef.current;
|
|
332
|
+
realtimeSocketRef.current = null;
|
|
333
|
+
try {
|
|
334
|
+
socket.close();
|
|
335
|
+
}
|
|
336
|
+
catch {
|
|
337
|
+
/* ignore */
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
if (realtimeStopTimeoutRef.current) {
|
|
341
|
+
clearTimeout(realtimeStopTimeoutRef.current);
|
|
342
|
+
realtimeStopTimeoutRef.current = null;
|
|
343
|
+
}
|
|
344
|
+
analyserRef.current = null;
|
|
345
|
+
mediaRecorderRef.current = null;
|
|
346
|
+
chunksRef.current = [];
|
|
347
|
+
speechRef.current = null;
|
|
348
|
+
speechTranscriptRef.current = "";
|
|
349
|
+
liveTextRef.current = "";
|
|
350
|
+
realtimeFinalRef.current = "";
|
|
351
|
+
realtimeInterimRef.current = "";
|
|
352
|
+
setAmplitude(0);
|
|
353
|
+
}, []);
|
|
354
|
+
useEffect(() => teardown, [teardown]);
|
|
355
|
+
const failWith = useCallback((message) => {
|
|
356
|
+
setErrorMessage(message);
|
|
357
|
+
setState("error");
|
|
358
|
+
onErrorRef.current?.(message);
|
|
359
|
+
teardown();
|
|
360
|
+
}, [teardown]);
|
|
361
|
+
const getVoiceContextPack = useCallback(() => resolveVoiceContextPack(contextPackRef.current), []);
|
|
362
|
+
const startMeter = useCallback((stream) => {
|
|
363
|
+
try {
|
|
364
|
+
const AudioCtor = typeof window !== "undefined"
|
|
365
|
+
? window.AudioContext || window.webkitAudioContext || null
|
|
366
|
+
: null;
|
|
367
|
+
if (!AudioCtor)
|
|
368
|
+
return;
|
|
369
|
+
const ctx = new AudioCtor();
|
|
370
|
+
const source = ctx.createMediaStreamSource(stream);
|
|
371
|
+
const analyser = ctx.createAnalyser();
|
|
372
|
+
analyser.fftSize = 512;
|
|
373
|
+
source.connect(analyser);
|
|
374
|
+
audioContextRef.current = ctx;
|
|
375
|
+
analyserRef.current = analyser;
|
|
376
|
+
const buffer = new Uint8Array(analyser.frequencyBinCount);
|
|
377
|
+
const tick = () => {
|
|
378
|
+
if (!analyserRef.current)
|
|
379
|
+
return;
|
|
380
|
+
analyserRef.current.getByteTimeDomainData(buffer);
|
|
381
|
+
let sumSquares = 0;
|
|
382
|
+
for (let i = 0; i < buffer.length; i++) {
|
|
383
|
+
const n = (buffer[i] - 128) / 128;
|
|
384
|
+
sumSquares += n * n;
|
|
385
|
+
}
|
|
386
|
+
const rms = Math.sqrt(sumSquares / buffer.length);
|
|
387
|
+
setAmplitude(Math.min(1, rms * 2.5));
|
|
388
|
+
rafRef.current = requestAnimationFrame(tick);
|
|
389
|
+
};
|
|
390
|
+
rafRef.current = requestAnimationFrame(tick);
|
|
391
|
+
}
|
|
392
|
+
catch {
|
|
393
|
+
/* analyser is best-effort */
|
|
394
|
+
}
|
|
395
|
+
}, []);
|
|
396
|
+
const startTimer = useCallback(() => {
|
|
397
|
+
startedAtRef.current = Date.now();
|
|
398
|
+
setDurationMs(0);
|
|
399
|
+
timerRef.current = setInterval(() => {
|
|
400
|
+
setDurationMs(Date.now() - startedAtRef.current);
|
|
401
|
+
}, 100);
|
|
402
|
+
}, []);
|
|
403
|
+
const startOpenAi = useCallback(async (providerPref, instructions) => {
|
|
404
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
405
|
+
// User may have pressed Escape (cancel) while the permission prompt was
|
|
406
|
+
// open. If so, stop the stream and bail before we start recording.
|
|
407
|
+
if (cancelledRef.current) {
|
|
408
|
+
for (const track of stream.getTracks())
|
|
409
|
+
track.stop();
|
|
410
|
+
cancelledRef.current = false;
|
|
411
|
+
setState("idle");
|
|
412
|
+
return;
|
|
413
|
+
}
|
|
414
|
+
mediaStreamRef.current = stream;
|
|
415
|
+
const mimeType = pickMimeType();
|
|
416
|
+
const recorder = new MediaRecorder(stream, { mimeType });
|
|
417
|
+
mediaRecorderRef.current = recorder;
|
|
418
|
+
chunksRef.current = [];
|
|
419
|
+
recorder.ondataavailable = (e) => {
|
|
420
|
+
if (e.data && e.data.size > 0)
|
|
421
|
+
chunksRef.current.push(e.data);
|
|
422
|
+
};
|
|
423
|
+
recorder.onstop = async () => {
|
|
424
|
+
const localChunks = chunksRef.current.slice();
|
|
425
|
+
const localMime = recorder.mimeType || mimeType;
|
|
426
|
+
const liveSnapshot = liveTextRef.current;
|
|
427
|
+
teardown();
|
|
428
|
+
if (cancelledRef.current) {
|
|
429
|
+
cancelledRef.current = false;
|
|
430
|
+
setState("idle");
|
|
431
|
+
return;
|
|
432
|
+
}
|
|
433
|
+
if (localChunks.length === 0) {
|
|
434
|
+
if (liveSnapshot)
|
|
435
|
+
onTranscriptRef.current?.(liveSnapshot.trim());
|
|
436
|
+
setState("idle");
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
setState("transcribing");
|
|
440
|
+
try {
|
|
441
|
+
const audioBlob = new Blob(localChunks, { type: localMime });
|
|
442
|
+
const form = new FormData();
|
|
443
|
+
form.append("audio", audioBlob, `voice.${localMime.split("/")[1] ?? "webm"}`);
|
|
444
|
+
form.append("provider", providerPref);
|
|
445
|
+
if (instructions?.trim()) {
|
|
446
|
+
form.append("instructions", instructions.trim());
|
|
447
|
+
}
|
|
448
|
+
appendVoiceContext(form, await getVoiceContextPack());
|
|
449
|
+
const res = await fetch(resolvePath(TRANSCRIBE_URL), {
|
|
450
|
+
method: "POST",
|
|
451
|
+
body: form,
|
|
452
|
+
});
|
|
453
|
+
if (!res.ok) {
|
|
454
|
+
const body = await res
|
|
455
|
+
.json()
|
|
456
|
+
.catch(() => ({ error: `HTTP ${res.status}` }));
|
|
457
|
+
throw new Error(body.error || `Transcription failed (${res.status})`);
|
|
458
|
+
}
|
|
459
|
+
if (cancelledRef.current) {
|
|
460
|
+
cancelledRef.current = false;
|
|
461
|
+
setState("idle");
|
|
462
|
+
return;
|
|
463
|
+
}
|
|
464
|
+
const data = (await res.json());
|
|
465
|
+
const text = (data.text ?? "").trim();
|
|
466
|
+
if (text) {
|
|
467
|
+
onTranscriptRef.current?.(text);
|
|
468
|
+
}
|
|
469
|
+
else if (liveSnapshot) {
|
|
470
|
+
onTranscriptRef.current?.(liveSnapshot.trim());
|
|
471
|
+
}
|
|
472
|
+
setState("idle");
|
|
473
|
+
}
|
|
474
|
+
catch (err) {
|
|
475
|
+
if (cancelledRef.current) {
|
|
476
|
+
cancelledRef.current = false;
|
|
477
|
+
setState("idle");
|
|
478
|
+
return;
|
|
479
|
+
}
|
|
480
|
+
if (liveSnapshot) {
|
|
481
|
+
onTranscriptRef.current?.(liveSnapshot.trim());
|
|
482
|
+
setState("idle");
|
|
483
|
+
}
|
|
484
|
+
else {
|
|
485
|
+
failWith(err?.message ??
|
|
486
|
+
"Transcription failed. Check your voice transcription provider in settings.");
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
startMeter(stream);
|
|
491
|
+
startTimer();
|
|
492
|
+
setState("recording");
|
|
493
|
+
recorder.start();
|
|
494
|
+
// Start parallel Web Speech recognition for live preview text.
|
|
495
|
+
// This runs alongside MediaRecorder so the user sees words appear
|
|
496
|
+
// immediately while the server provider processes the full recording later.
|
|
497
|
+
const SpeechCtor = getSpeechRecognitionCtor();
|
|
498
|
+
if (SpeechCtor) {
|
|
499
|
+
const liveSpeech = new SpeechCtor();
|
|
500
|
+
liveSpeech.continuous = true;
|
|
501
|
+
liveSpeech.interimResults = true;
|
|
502
|
+
liveSpeech.lang =
|
|
503
|
+
(typeof navigator !== "undefined" && navigator.language) || "en-US";
|
|
504
|
+
liveSpeechRef.current = liveSpeech;
|
|
505
|
+
liveTextRef.current = "";
|
|
506
|
+
liveSpeech.onresult = (event) => {
|
|
507
|
+
let interim = "";
|
|
508
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
509
|
+
const result = event.results[i];
|
|
510
|
+
const text = result[0]?.transcript ?? "";
|
|
511
|
+
if (result.isFinal) {
|
|
512
|
+
liveTextRef.current += text;
|
|
513
|
+
}
|
|
514
|
+
else {
|
|
515
|
+
interim += text;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
onLiveUpdateRef.current?.(liveTextRef.current, interim);
|
|
519
|
+
};
|
|
520
|
+
liveSpeech.onend = () => {
|
|
521
|
+
if (liveSpeechRef.current === liveSpeech) {
|
|
522
|
+
try {
|
|
523
|
+
liveSpeech.start();
|
|
524
|
+
}
|
|
525
|
+
catch {
|
|
526
|
+
/* ignore */
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
liveSpeech.onerror = () => { };
|
|
531
|
+
try {
|
|
532
|
+
liveSpeech.start();
|
|
533
|
+
}
|
|
534
|
+
catch {
|
|
535
|
+
/* best effort — live preview just won't appear */
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}, [
|
|
539
|
+
startMeter,
|
|
540
|
+
startTimer,
|
|
541
|
+
teardown,
|
|
542
|
+
failWith,
|
|
543
|
+
getVoiceContextPack,
|
|
544
|
+
resolvePath,
|
|
545
|
+
]);
|
|
546
|
+
const startBrowser = useCallback(async (prefs,
|
|
547
|
+
/** Return true to take over when the recognizer never opened the mic.
|
|
548
|
+
* Brave ships `webkitSpeechRecognition` with no speech backend, so
|
|
549
|
+
* feature detection alone cannot tell dictation will work. */
|
|
550
|
+
onUnavailable) => {
|
|
551
|
+
const Ctor = getSpeechRecognitionCtor();
|
|
552
|
+
if (!Ctor) {
|
|
553
|
+
throw new Error("Your browser doesn't support speech recognition. Add an OpenAI API key in settings for Whisper transcription.");
|
|
554
|
+
}
|
|
555
|
+
if (cancelledRef.current) {
|
|
556
|
+
cancelledRef.current = false;
|
|
557
|
+
setState("idle");
|
|
558
|
+
return;
|
|
559
|
+
}
|
|
560
|
+
const recognition = new Ctor();
|
|
561
|
+
recognition.continuous = true;
|
|
562
|
+
recognition.interimResults = true;
|
|
563
|
+
recognition.lang =
|
|
564
|
+
(typeof navigator !== "undefined" && navigator.language) || "en-US";
|
|
565
|
+
speechRef.current = recognition;
|
|
566
|
+
speechTranscriptRef.current = "";
|
|
567
|
+
let capturing = false;
|
|
568
|
+
let fatal = false;
|
|
569
|
+
let lastError;
|
|
570
|
+
// Opening our own capture before the speech service has claimed the
|
|
571
|
+
// device makes Chrome abort the session outright. Attach the meter only
|
|
572
|
+
// once recognition is actually listening.
|
|
573
|
+
recognition.onaudiostart = () => {
|
|
574
|
+
capturing = true;
|
|
575
|
+
if (cancelledRef.current)
|
|
576
|
+
return;
|
|
577
|
+
void Promise.resolve()
|
|
578
|
+
.then(() => navigator.mediaDevices?.getUserMedia({ audio: true }))
|
|
579
|
+
.then((stream) => {
|
|
580
|
+
if (!stream)
|
|
581
|
+
return;
|
|
582
|
+
if (cancelledRef.current || speechRef.current !== recognition) {
|
|
583
|
+
for (const track of stream.getTracks())
|
|
584
|
+
track.stop();
|
|
585
|
+
return;
|
|
586
|
+
}
|
|
587
|
+
mediaStreamRef.current = stream;
|
|
588
|
+
startMeter(stream);
|
|
589
|
+
})
|
|
590
|
+
.catch(() => {
|
|
591
|
+
/* the meter is decoration; recognition owns the real capture */
|
|
592
|
+
});
|
|
593
|
+
};
|
|
594
|
+
recognition.onresult = (event) => {
|
|
595
|
+
capturing = true;
|
|
596
|
+
let interim = "";
|
|
597
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
598
|
+
const result = event.results[i];
|
|
599
|
+
const text = result[0]?.transcript ?? "";
|
|
600
|
+
if (result.isFinal) {
|
|
601
|
+
speechTranscriptRef.current += text;
|
|
602
|
+
}
|
|
603
|
+
else {
|
|
604
|
+
interim += text;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
onLiveUpdateRef.current?.(speechTranscriptRef.current, interim);
|
|
608
|
+
};
|
|
609
|
+
// `end` always follows `error`, so every outcome is decided there. Acting
|
|
610
|
+
// here too would either pre-empt the fallback or be overwritten by it.
|
|
611
|
+
recognition.onerror = (event) => {
|
|
612
|
+
lastError = event?.error;
|
|
613
|
+
if (event?.error === "no-speech" || event?.error === "aborted")
|
|
614
|
+
return;
|
|
615
|
+
fatal = true;
|
|
616
|
+
};
|
|
617
|
+
recognition.onend = () => {
|
|
618
|
+
const text = speechTranscriptRef.current.trim();
|
|
619
|
+
const wasCancelled = cancelledRef.current;
|
|
620
|
+
cancelledRef.current = false;
|
|
621
|
+
teardown();
|
|
622
|
+
if (wasCancelled) {
|
|
623
|
+
setState("idle");
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
if (!text) {
|
|
627
|
+
// A recognizer that failed, or that ended before the mic ever opened,
|
|
628
|
+
// produced nothing usable — that is not the same as hearing silence.
|
|
629
|
+
if (fatal || !capturing) {
|
|
630
|
+
if (onUnavailable?.(lastError))
|
|
631
|
+
return;
|
|
632
|
+
failWith(voiceDictationSpeechErrorMessage(lastError));
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
setState("idle");
|
|
636
|
+
return;
|
|
637
|
+
}
|
|
638
|
+
void (async () => {
|
|
639
|
+
let finalText = text;
|
|
640
|
+
if (prefs.cleanupEnabled) {
|
|
641
|
+
setState("transcribing");
|
|
642
|
+
try {
|
|
643
|
+
finalText = await cleanupRecognizedText({
|
|
644
|
+
text,
|
|
645
|
+
provider: prefs.provider,
|
|
646
|
+
instructions: prefs.instructions,
|
|
647
|
+
contextPack: await getVoiceContextPack(),
|
|
648
|
+
resolvePath,
|
|
649
|
+
replaceContext,
|
|
650
|
+
});
|
|
651
|
+
}
|
|
652
|
+
catch {
|
|
653
|
+
finalText = text;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
if (!cancelledRef.current && finalText) {
|
|
657
|
+
onTranscriptRef.current?.(finalText);
|
|
658
|
+
}
|
|
659
|
+
cancelledRef.current = false;
|
|
660
|
+
setState("idle");
|
|
661
|
+
})();
|
|
662
|
+
};
|
|
663
|
+
startTimer();
|
|
664
|
+
setState("recording");
|
|
665
|
+
recognition.start();
|
|
666
|
+
}, [
|
|
667
|
+
startMeter,
|
|
668
|
+
startTimer,
|
|
669
|
+
teardown,
|
|
670
|
+
failWith,
|
|
671
|
+
getVoiceContextPack,
|
|
672
|
+
replaceContext,
|
|
673
|
+
resolvePath,
|
|
674
|
+
]);
|
|
675
|
+
const startGoogleRealtime = useCallback(async (prefs) => {
|
|
676
|
+
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
|
|
677
|
+
if (cancelledRef.current) {
|
|
678
|
+
for (const track of stream.getTracks())
|
|
679
|
+
track.stop();
|
|
680
|
+
cancelledRef.current = false;
|
|
681
|
+
setState("idle");
|
|
682
|
+
return;
|
|
683
|
+
}
|
|
684
|
+
const sessionRes = await fetch(resolvePath(GOOGLE_REALTIME_SESSION_URL), {
|
|
685
|
+
method: "POST",
|
|
686
|
+
headers: { "Content-Type": "application/json" },
|
|
687
|
+
body: JSON.stringify({
|
|
688
|
+
language: (typeof navigator !== "undefined" && navigator.language) || "en-US",
|
|
689
|
+
}),
|
|
690
|
+
});
|
|
691
|
+
const sessionBody = (await sessionRes
|
|
692
|
+
.json()
|
|
693
|
+
.catch(() => ({ error: `HTTP ${sessionRes.status}` })));
|
|
694
|
+
if (!sessionRes.ok ||
|
|
695
|
+
!sessionBody.websocketUrl ||
|
|
696
|
+
!sessionBody.sessionToken) {
|
|
697
|
+
for (const track of stream.getTracks())
|
|
698
|
+
track.stop();
|
|
699
|
+
throw new Error(sessionBody.error ||
|
|
700
|
+
`Could not start Google realtime transcription (${sessionRes.status})`);
|
|
701
|
+
}
|
|
702
|
+
if (cancelledRef.current) {
|
|
703
|
+
for (const track of stream.getTracks())
|
|
704
|
+
track.stop();
|
|
705
|
+
cancelledRef.current = false;
|
|
706
|
+
setState("idle");
|
|
707
|
+
return;
|
|
708
|
+
}
|
|
709
|
+
mediaStreamRef.current = stream;
|
|
710
|
+
const mimeType = pickMimeType();
|
|
711
|
+
const recorder = new MediaRecorder(stream, { mimeType });
|
|
712
|
+
mediaRecorderRef.current = recorder;
|
|
713
|
+
realtimeFinalRef.current = "";
|
|
714
|
+
realtimeInterimRef.current = "";
|
|
715
|
+
let finalized = false;
|
|
716
|
+
let recorderStarted = false;
|
|
717
|
+
const finish = (errorMessage) => {
|
|
718
|
+
if (finalized)
|
|
719
|
+
return;
|
|
720
|
+
finalized = true;
|
|
721
|
+
void (async () => {
|
|
722
|
+
const finalText = realtimeFinalRef.current.trim();
|
|
723
|
+
const interimText = realtimeInterimRef.current.trim();
|
|
724
|
+
const text = [finalText, interimText]
|
|
725
|
+
.filter(Boolean)
|
|
726
|
+
.join(" ")
|
|
727
|
+
.trim();
|
|
728
|
+
teardown();
|
|
729
|
+
if (cancelledRef.current) {
|
|
730
|
+
cancelledRef.current = false;
|
|
731
|
+
setState("idle");
|
|
732
|
+
return;
|
|
733
|
+
}
|
|
734
|
+
if (text) {
|
|
735
|
+
let cleanedText = text;
|
|
736
|
+
if (prefs.cleanupEnabled) {
|
|
737
|
+
setState("transcribing");
|
|
738
|
+
try {
|
|
739
|
+
cleanedText = await cleanupRecognizedText({
|
|
740
|
+
text,
|
|
741
|
+
provider: prefs.provider,
|
|
742
|
+
instructions: prefs.instructions,
|
|
743
|
+
contextPack: await getVoiceContextPack(),
|
|
744
|
+
resolvePath,
|
|
745
|
+
replaceContext,
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
catch {
|
|
749
|
+
cleanedText = text;
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
if (!cancelledRef.current && cleanedText) {
|
|
753
|
+
onTranscriptRef.current?.(cleanedText);
|
|
754
|
+
}
|
|
755
|
+
cancelledRef.current = false;
|
|
756
|
+
setState("idle");
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
if (errorMessage) {
|
|
760
|
+
failWith(errorMessage);
|
|
761
|
+
return;
|
|
762
|
+
}
|
|
763
|
+
setState("idle");
|
|
764
|
+
})();
|
|
765
|
+
};
|
|
766
|
+
recorder.ondataavailable = async (event) => {
|
|
767
|
+
if (!event.data || event.data.size === 0)
|
|
768
|
+
return;
|
|
769
|
+
const socket = realtimeSocketRef.current;
|
|
770
|
+
if (!socket || socket.readyState !== WebSocket.OPEN)
|
|
771
|
+
return;
|
|
772
|
+
try {
|
|
773
|
+
socket.send(await event.data.arrayBuffer());
|
|
774
|
+
}
|
|
775
|
+
catch (err) {
|
|
776
|
+
finish(err?.message ?? "Realtime audio upload failed");
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
recorder.onstop = () => {
|
|
780
|
+
const socket = realtimeSocketRef.current;
|
|
781
|
+
if (!socket || socket.readyState !== WebSocket.OPEN) {
|
|
782
|
+
finish();
|
|
783
|
+
return;
|
|
784
|
+
}
|
|
785
|
+
setState("transcribing");
|
|
786
|
+
try {
|
|
787
|
+
socket.send(JSON.stringify({ type: "stop" }));
|
|
788
|
+
}
|
|
789
|
+
catch {
|
|
790
|
+
finish();
|
|
791
|
+
return;
|
|
792
|
+
}
|
|
793
|
+
realtimeStopTimeoutRef.current = window.setTimeout(() => {
|
|
794
|
+
const activeSocket = realtimeSocketRef.current;
|
|
795
|
+
if (activeSocket?.readyState === WebSocket.OPEN) {
|
|
796
|
+
try {
|
|
797
|
+
activeSocket.close();
|
|
798
|
+
}
|
|
799
|
+
catch {
|
|
800
|
+
finish();
|
|
801
|
+
}
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
finish();
|
|
805
|
+
}, 10000);
|
|
806
|
+
};
|
|
807
|
+
const socket = new WebSocket(sessionBody.websocketUrl, [
|
|
808
|
+
sessionBody.websocketProtocol || GOOGLE_REALTIME_WS_PROTOCOL,
|
|
809
|
+
sessionBody.sessionToken,
|
|
810
|
+
]);
|
|
811
|
+
socket.binaryType = "arraybuffer";
|
|
812
|
+
realtimeSocketRef.current = socket;
|
|
813
|
+
socket.onmessage = (event) => {
|
|
814
|
+
if (cancelledRef.current) {
|
|
815
|
+
finish();
|
|
816
|
+
return;
|
|
817
|
+
}
|
|
818
|
+
const raw = typeof event.data === "string"
|
|
819
|
+
? event.data
|
|
820
|
+
: event.data instanceof Blob
|
|
821
|
+
? null
|
|
822
|
+
: new TextDecoder().decode(event.data);
|
|
823
|
+
if (!raw)
|
|
824
|
+
return;
|
|
825
|
+
let message;
|
|
826
|
+
try {
|
|
827
|
+
message = JSON.parse(raw);
|
|
828
|
+
}
|
|
829
|
+
catch {
|
|
830
|
+
return;
|
|
831
|
+
}
|
|
832
|
+
if (!message?.type)
|
|
833
|
+
return;
|
|
834
|
+
if (message.type === "ready") {
|
|
835
|
+
if (!recorderStarted) {
|
|
836
|
+
recorderStarted = true;
|
|
837
|
+
startMeter(stream);
|
|
838
|
+
startTimer();
|
|
839
|
+
setState("recording");
|
|
840
|
+
recorder.start(100);
|
|
841
|
+
}
|
|
842
|
+
return;
|
|
843
|
+
}
|
|
844
|
+
if (message.type === "partial") {
|
|
845
|
+
realtimeInterimRef.current = (message.text ?? "").trim();
|
|
846
|
+
onLiveUpdateRef.current?.(realtimeFinalRef.current, realtimeInterimRef.current);
|
|
847
|
+
return;
|
|
848
|
+
}
|
|
849
|
+
if (message.type === "final") {
|
|
850
|
+
const next = (message.text ?? "").trim();
|
|
851
|
+
if (next) {
|
|
852
|
+
realtimeFinalRef.current = [realtimeFinalRef.current.trim(), next]
|
|
853
|
+
.filter(Boolean)
|
|
854
|
+
.join(" ");
|
|
855
|
+
}
|
|
856
|
+
realtimeInterimRef.current = "";
|
|
857
|
+
onLiveUpdateRef.current?.(realtimeFinalRef.current, "");
|
|
858
|
+
return;
|
|
859
|
+
}
|
|
860
|
+
if (message.type === "error") {
|
|
861
|
+
finish(message.error || "Google realtime transcription failed");
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
if (message.type === "end") {
|
|
865
|
+
finish();
|
|
866
|
+
}
|
|
867
|
+
};
|
|
868
|
+
socket.onerror = () => {
|
|
869
|
+
finish("Google realtime transcription connection failed");
|
|
870
|
+
};
|
|
871
|
+
socket.onclose = () => {
|
|
872
|
+
finish();
|
|
873
|
+
};
|
|
874
|
+
socket.onopen = () => {
|
|
875
|
+
if (cancelledRef.current) {
|
|
876
|
+
finish();
|
|
877
|
+
return;
|
|
878
|
+
}
|
|
879
|
+
try {
|
|
880
|
+
socket.send(JSON.stringify({
|
|
881
|
+
type: "start",
|
|
882
|
+
language: (typeof navigator !== "undefined" && navigator.language) ||
|
|
883
|
+
"en-US",
|
|
884
|
+
interimResults: true,
|
|
885
|
+
mimeType,
|
|
886
|
+
}));
|
|
887
|
+
}
|
|
888
|
+
catch (err) {
|
|
889
|
+
finish(err?.message ?? "Could not start realtime stream");
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
}, [
|
|
893
|
+
startMeter,
|
|
894
|
+
startTimer,
|
|
895
|
+
teardown,
|
|
896
|
+
failWith,
|
|
897
|
+
getVoiceContextPack,
|
|
898
|
+
replaceContext,
|
|
899
|
+
resolvePath,
|
|
900
|
+
]);
|
|
901
|
+
const start = useCallback(async () => {
|
|
902
|
+
if (state === "recording" || state === "starting")
|
|
903
|
+
return;
|
|
904
|
+
setErrorMessage(null);
|
|
905
|
+
setState("starting");
|
|
906
|
+
cancelledRef.current = false;
|
|
907
|
+
const prefs = await readVoicePrefs(resolvePath);
|
|
908
|
+
const pref = prefs.provider;
|
|
909
|
+
setProvider(pref);
|
|
910
|
+
// In "auto" mode, prefer browser-native SpeechRecognition when available.
|
|
911
|
+
// It requires no server-side API key, streams words incrementally into the
|
|
912
|
+
// composer, and matches the macros-app record-button experience. Fall back
|
|
913
|
+
// to the server upload path only when SpeechRecognition isn't supported.
|
|
914
|
+
// Explicit server providers (builder, gemini, groq, openai) always use the
|
|
915
|
+
// MediaRecorder → server upload path regardless.
|
|
916
|
+
const resolvedProvider = pref === "auto" && speechSupported
|
|
917
|
+
? "browser"
|
|
918
|
+
: pref === "auto" ||
|
|
919
|
+
pref === "builder" ||
|
|
920
|
+
pref === "builder-gemini" ||
|
|
921
|
+
pref === "gemini" ||
|
|
922
|
+
pref === "groq"
|
|
923
|
+
? "openai"
|
|
924
|
+
: pref;
|
|
925
|
+
activeProviderRef.current = resolvedProvider;
|
|
926
|
+
try {
|
|
927
|
+
if (resolvedProvider === "openai") {
|
|
928
|
+
if (!mediaRecorderSupported) {
|
|
929
|
+
throw new Error("Your browser doesn't support audio recording. Use the browser provider in Settings → Voice Transcription.");
|
|
930
|
+
}
|
|
931
|
+
await startOpenAi(pref, prefs.instructions);
|
|
932
|
+
}
|
|
933
|
+
else if (resolvedProvider === "google-realtime") {
|
|
934
|
+
if (!mediaRecorderSupported) {
|
|
935
|
+
throw new Error("Your browser doesn't support audio recording, so Google realtime transcription can't start.");
|
|
936
|
+
}
|
|
937
|
+
await startGoogleRealtime(prefs);
|
|
938
|
+
}
|
|
939
|
+
else {
|
|
940
|
+
// Only "auto" promised a working recognizer of any kind; an explicit
|
|
941
|
+
// browser preference must surface its own failure instead.
|
|
942
|
+
await startBrowser(prefs, pref === "auto" && mediaRecorderSupported
|
|
943
|
+
? (error) => {
|
|
944
|
+
if (isMicPermissionError(error))
|
|
945
|
+
return false;
|
|
946
|
+
activeProviderRef.current = "openai";
|
|
947
|
+
setState("starting");
|
|
948
|
+
void startOpenAi("auto", prefs.instructions).catch((err) => failWith(voiceDictationStartErrorMessage(err)));
|
|
949
|
+
return true;
|
|
950
|
+
}
|
|
951
|
+
: undefined);
|
|
952
|
+
}
|
|
953
|
+
}
|
|
954
|
+
catch (err) {
|
|
955
|
+
if (cancelledRef.current) {
|
|
956
|
+
cancelledRef.current = false;
|
|
957
|
+
teardown();
|
|
958
|
+
setState("idle");
|
|
959
|
+
return;
|
|
960
|
+
}
|
|
961
|
+
failWith(voiceDictationStartErrorMessage(err));
|
|
962
|
+
}
|
|
963
|
+
}, [
|
|
964
|
+
state,
|
|
965
|
+
speechSupported,
|
|
966
|
+
mediaRecorderSupported,
|
|
967
|
+
startOpenAi,
|
|
968
|
+
startGoogleRealtime,
|
|
969
|
+
startBrowser,
|
|
970
|
+
failWith,
|
|
971
|
+
]);
|
|
972
|
+
const stop = useCallback(() => {
|
|
973
|
+
if (state !== "recording")
|
|
974
|
+
return;
|
|
975
|
+
cancelledRef.current = false;
|
|
976
|
+
if ((activeProviderRef.current === "openai" ||
|
|
977
|
+
activeProviderRef.current === "google-realtime") &&
|
|
978
|
+
mediaRecorderRef.current) {
|
|
979
|
+
try {
|
|
980
|
+
mediaRecorderRef.current.stop();
|
|
981
|
+
}
|
|
982
|
+
catch {
|
|
983
|
+
teardown();
|
|
984
|
+
setState("idle");
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
else if (speechRef.current) {
|
|
988
|
+
try {
|
|
989
|
+
speechRef.current.stop();
|
|
990
|
+
}
|
|
991
|
+
catch {
|
|
992
|
+
teardown();
|
|
993
|
+
setState("idle");
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
else {
|
|
997
|
+
teardown();
|
|
998
|
+
setState("idle");
|
|
999
|
+
}
|
|
1000
|
+
}, [state, teardown]);
|
|
1001
|
+
const cancel = useCallback(() => {
|
|
1002
|
+
if (state !== "recording" &&
|
|
1003
|
+
state !== "starting" &&
|
|
1004
|
+
state !== "transcribing")
|
|
1005
|
+
return;
|
|
1006
|
+
cancelledRef.current = true;
|
|
1007
|
+
if ((activeProviderRef.current === "openai" ||
|
|
1008
|
+
activeProviderRef.current === "google-realtime") &&
|
|
1009
|
+
mediaRecorderRef.current) {
|
|
1010
|
+
try {
|
|
1011
|
+
mediaRecorderRef.current.stop();
|
|
1012
|
+
}
|
|
1013
|
+
catch {
|
|
1014
|
+
/* ignore */
|
|
1015
|
+
}
|
|
1016
|
+
}
|
|
1017
|
+
else if (speechRef.current) {
|
|
1018
|
+
try {
|
|
1019
|
+
speechRef.current.abort?.();
|
|
1020
|
+
}
|
|
1021
|
+
catch {
|
|
1022
|
+
/* ignore */
|
|
1023
|
+
}
|
|
1024
|
+
}
|
|
1025
|
+
teardown();
|
|
1026
|
+
setState("idle");
|
|
1027
|
+
}, [state, teardown]);
|
|
1028
|
+
// Auto-dismiss error after 8s so a stale "permission denied" message doesn't
|
|
1029
|
+
// sit forever after the user fixes the underlying permission. Manual dismiss
|
|
1030
|
+
// (via dismissError) and click-to-retry both also clear the error sooner.
|
|
1031
|
+
useEffect(() => {
|
|
1032
|
+
if (state !== "error")
|
|
1033
|
+
return;
|
|
1034
|
+
const handle = setTimeout(() => {
|
|
1035
|
+
setErrorMessage(null);
|
|
1036
|
+
setState("idle");
|
|
1037
|
+
}, 8000);
|
|
1038
|
+
return () => clearTimeout(handle);
|
|
1039
|
+
}, [state]);
|
|
1040
|
+
const dismissError = useCallback(() => {
|
|
1041
|
+
setErrorMessage(null);
|
|
1042
|
+
if (state === "error")
|
|
1043
|
+
setState("idle");
|
|
1044
|
+
}, [state]);
|
|
1045
|
+
return {
|
|
1046
|
+
state,
|
|
1047
|
+
amplitude,
|
|
1048
|
+
durationMs,
|
|
1049
|
+
errorMessage,
|
|
1050
|
+
provider,
|
|
1051
|
+
supported,
|
|
1052
|
+
start,
|
|
1053
|
+
stop,
|
|
1054
|
+
cancel,
|
|
1055
|
+
dismissError,
|
|
1056
|
+
};
|
|
1057
|
+
}
|
|
1058
|
+
//# sourceMappingURL=useVoiceDictation.js.map
|