@dxos/plugin-transcription 0.8.4-main.dedc0f3 → 0.8.4-main.dfabb4ec29
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/dist/lib/neutral/TranscriptionContainer-XNGXNGPX.mjs +35 -0
- package/dist/lib/neutral/TranscriptionContainer-XNGXNGPX.mjs.map +7 -0
- package/dist/lib/neutral/TranscriptionPlugin.mjs +34 -0
- package/dist/lib/neutral/TranscriptionPlugin.mjs.map +7 -0
- package/dist/lib/neutral/TranscriptionPlugin.node.mjs +25 -0
- package/dist/lib/neutral/TranscriptionPlugin.node.mjs.map +7 -0
- package/dist/lib/neutral/blueprint-definition-HOXDG5QP.mjs +15 -0
- package/dist/lib/neutral/blueprint-definition-HOXDG5QP.mjs.map +7 -0
- package/dist/lib/neutral/blueprints/index.mjs +8 -0
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GL4RS533.mjs +22 -0
- package/dist/lib/neutral/chunk-GL4RS533.mjs.map +7 -0
- package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/neutral/chunk-KAEXRX3Y.mjs +35 -0
- package/dist/lib/neutral/chunk-KAEXRX3Y.mjs.map +7 -0
- package/dist/lib/{browser/chunk-BA64VLLR.mjs → neutral/chunk-LS3R7EQI.mjs} +129 -185
- package/dist/lib/neutral/chunk-LS3R7EQI.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MLRJWAQH.mjs +179 -0
- package/dist/lib/neutral/chunk-MLRJWAQH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NNR3EYR2.mjs +124 -0
- package/dist/lib/neutral/chunk-NNR3EYR2.mjs.map +7 -0
- package/dist/lib/neutral/chunk-NQQK7UZQ.mjs +244 -0
- package/dist/lib/neutral/chunk-NQQK7UZQ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-WVEZMGBT.mjs +8 -0
- package/dist/lib/neutral/chunk-WVEZMGBT.mjs.map +7 -0
- package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs +30 -0
- package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +207 -0
- package/dist/lib/neutral/components/index.mjs.map +7 -0
- package/dist/lib/neutral/containers/index.mjs +9 -0
- package/dist/lib/neutral/containers/index.mjs.map +7 -0
- package/dist/lib/neutral/create-2D6S4IMQ.mjs +21 -0
- package/dist/lib/neutral/create-2D6S4IMQ.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +17 -0
- package/dist/lib/neutral/index.mjs +44 -0
- package/dist/lib/neutral/meta.json +1 -0
- package/dist/lib/neutral/meta.mjs +8 -0
- package/dist/lib/neutral/meta.mjs.map +7 -0
- package/dist/lib/neutral/open-2QB6IIET.mjs +27 -0
- package/dist/lib/neutral/open-2QB6IIET.mjs.map +7 -0
- package/dist/lib/neutral/operation-handler-NXMOAXFP.mjs +13 -0
- package/dist/lib/neutral/operation-handler-NXMOAXFP.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +8 -0
- package/dist/lib/neutral/operations/index.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-QF4MUMWG.mjs +26 -0
- package/dist/lib/neutral/react-surface-QF4MUMWG.mjs.map +7 -0
- package/dist/lib/neutral/summarize-CJPVKWYZ.mjs +78 -0
- package/dist/lib/neutral/summarize-CJPVKWYZ.mjs.map +7 -0
- package/dist/lib/neutral/text-content-LHSUG2D2.mjs +30 -0
- package/dist/lib/neutral/text-content-LHSUG2D2.mjs.map +7 -0
- package/dist/lib/{node-esm/transcriber-QPS55YP2.mjs → neutral/transcriber-M3R6HPTZ.mjs} +20 -18
- package/dist/lib/neutral/transcriber-M3R6HPTZ.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +22 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +12 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/TranscriptionPlugin.d.ts +3 -1
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/TranscriptionPlugin.node.d.ts +4 -0
- package/dist/types/src/TranscriptionPlugin.node.d.ts.map +1 -0
- package/dist/types/src/TranscriptionPlugin.test.d.ts +2 -0
- package/dist/types/src/TranscriptionPlugin.test.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +10 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/text-content.d.ts +8 -0
- package/dist/types/src/capabilities/text-content.d.ts.map +1 -0
- package/dist/types/src/capabilities/transcriber.d.ts +4 -3
- package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
- package/dist/types/src/components/Transcription/Transcription.d.ts +18 -0
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +40 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/index.d.ts +2 -0
- package/dist/types/src/components/Transcription/index.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/transcription-extension.d.ts +15 -0
- package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +6 -0
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts +2 -0
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
- package/dist/types/src/hooks/useAudioTrack.d.ts.map +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranscriber.d.ts +2 -2
- package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
- package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +2 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -3
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/model/model.d.ts +2 -2
- package/dist/types/src/model/model.d.ts.map +1 -1
- package/dist/types/src/{segments-normalization → normalization}/index.d.ts +1 -1
- package/dist/types/src/normalization/index.d.ts.map +1 -0
- package/dist/types/src/{segments-normalization → normalization}/message-normalizer.d.ts +5 -5
- package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -0
- package/dist/types/src/normalization/normalization.d.ts +543 -0
- package/dist/types/src/normalization/normalization.d.ts.map +1 -0
- package/dist/types/src/normalization/normalization.test.d.ts.map +1 -0
- package/dist/types/src/normalization/utils.d.ts +3 -0
- package/dist/types/src/normalization/utils.d.ts.map +1 -0
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +3 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/summarize.d.ts +8 -0
- package/dist/types/src/operations/summarize.d.ts.map +1 -0
- package/dist/types/src/plugin.d.ts +4 -0
- package/dist/types/src/plugin.d.ts.map +1 -0
- package/dist/types/src/{components/stories → stories}/FileTranscription.stories.d.ts +3 -4
- package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/{components/stories → stories}/KeyWordRecognition.stories.d.ts +2 -3
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
- package/dist/types/src/{components/stories → stories}/MicrophoneTranscription.stories.d.ts +5 -6
- package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts +23 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -0
- package/dist/types/src/stories/useIsSpeaking.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +10 -10
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/index.d.ts +1 -1
- package/dist/types/src/transcriber/index.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +2 -2
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +60 -5
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.test.d.ts +2 -0
- package/dist/types/src/transcriber/transcriber.test.d.ts.map +1 -0
- package/dist/types/src/transcriber/transcription-manager.d.ts +9 -6
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -8
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/TranscriptOperation.d.ts +917 -0
- package/dist/types/src/types/TranscriptOperation.d.ts.map +1 -0
- package/dist/types/src/types/TranscriptionCapabilities.d.ts +17 -0
- package/dist/types/src/types/TranscriptionCapabilities.d.ts.map +1 -0
- package/dist/types/src/types/{types.d.ts → defs.d.ts} +1 -1
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/array.d.ts.map +1 -1
- package/dist/types/src/util/get-time-str.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
- package/dist/types/src/util/render-byline.d.ts +4 -0
- package/dist/types/src/util/render-byline.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +148 -82
- package/src/TranscriptionPlugin.node.ts +20 -0
- package/src/TranscriptionPlugin.test.ts +31 -0
- package/src/TranscriptionPlugin.tsx +22 -66
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/transcription-blueprint.ts +29 -0
- package/src/capabilities/blueprint-definition.ts +12 -24
- package/src/capabilities/index.ts +11 -7
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +23 -14
- package/src/capabilities/text-content.ts +33 -0
- package/src/capabilities/transcriber.ts +53 -42
- package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +62 -59
- package/src/components/Transcription/Transcription.tsx +64 -0
- package/src/components/{Transcript → Transcription}/index.ts +1 -1
- package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +13 -9
- package/src/components/index.ts +1 -6
- package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +35 -0
- package/src/containers/TranscriptionContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useAudioFile.ts +50 -45
- package/src/hooks/useQueueModelAdapter.ts +1 -1
- package/src/hooks/useTranscriber.ts +12 -4
- package/src/hooks/useVoiceInput.ts +2 -3
- package/src/index.ts +4 -5
- package/src/meta.ts +9 -6
- package/src/model/model.test.ts +20 -14
- package/src/model/model.ts +3 -3
- package/src/{segments-normalization → normalization}/message-normalizer.ts +19 -18
- package/src/{segments-normalization → normalization}/normalization.test.ts +7 -12
- package/src/normalization/normalization.ts +76 -0
- package/src/{segments-normalization → normalization}/utils.ts +2 -2
- package/src/operations/create.ts +24 -0
- package/src/operations/index.ts +11 -0
- package/src/operations/open.ts +28 -0
- package/src/operations/summarize.ts +101 -0
- package/src/plugin.ts +11 -0
- package/src/{components/stories → stories}/FileTranscription.stories.tsx +56 -43
- package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +36 -36
- package/src/{components/stories → stories}/MicrophoneTranscription.stories.tsx +60 -81
- package/src/stories/TranscriptionStory.tsx +93 -0
- package/src/testing/testing.ts +37 -37
- package/src/transcriber/index.ts +1 -1
- package/src/transcriber/media-stream-recorder.ts +3 -3
- package/src/transcriber/transcriber.browser.test.ts +4 -5
- package/src/transcriber/transcriber.test.ts +104 -0
- package/src/transcriber/transcriber.ts +99 -58
- package/src/transcriber/transcription-manager.ts +21 -15
- package/src/translations.ts +7 -7
- package/src/types/TranscriptOperation.ts +103 -0
- package/src/types/TranscriptionCapabilities.ts +39 -0
- package/src/types/index.ts +4 -3
- package/src/util/index.ts +1 -0
- package/src/util/render-byline.ts +33 -0
- package/dist/lib/browser/TranscriptContainer-4RBK74JP.mjs +0 -11
- package/dist/lib/browser/blueprint-definition-TJABB43G.mjs +0 -142
- package/dist/lib/browser/blueprint-definition-TJABB43G.mjs.map +0 -7
- package/dist/lib/browser/chunk-3X7HP44M.mjs +0 -26
- package/dist/lib/browser/chunk-3X7HP44M.mjs.map +0 -7
- package/dist/lib/browser/chunk-AGZYQGSP.mjs +0 -8
- package/dist/lib/browser/chunk-AGZYQGSP.mjs.map +0 -7
- package/dist/lib/browser/chunk-BA64VLLR.mjs.map +0 -7
- package/dist/lib/browser/chunk-HXVGV7T6.mjs +0 -63
- package/dist/lib/browser/chunk-HXVGV7T6.mjs.map +0 -7
- package/dist/lib/browser/chunk-TNEQFHIU.mjs +0 -16
- package/dist/lib/browser/chunk-TNEQFHIU.mjs.map +0 -7
- package/dist/lib/browser/chunk-VVXRHJCH.mjs +0 -746
- package/dist/lib/browser/chunk-VVXRHJCH.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -131
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-T3EGLS3L.mjs +0 -25
- package/dist/lib/browser/intent-resolver-T3EGLS3L.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-4Y3YISAD.mjs +0 -34
- package/dist/lib/browser/react-surface-4Y3YISAD.mjs.map +0 -7
- package/dist/lib/browser/transcriber-JOOAQVYV.mjs +0 -56
- package/dist/lib/browser/transcriber-JOOAQVYV.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -12
- package/dist/lib/node-esm/TranscriptContainer-EGAAYVOP.mjs +0 -12
- package/dist/lib/node-esm/blueprint-definition-R4UF7YJZ.mjs +0 -143
- package/dist/lib/node-esm/blueprint-definition-R4UF7YJZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-3QAIZGMW.mjs +0 -17
- package/dist/lib/node-esm/chunk-3QAIZGMW.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-CF5Z6FAB.mjs +0 -10
- package/dist/lib/node-esm/chunk-CF5Z6FAB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-J5GQ3KGX.mjs +0 -487
- package/dist/lib/node-esm/chunk-J5GQ3KGX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-QARUDLHN.mjs +0 -27
- package/dist/lib/node-esm/chunk-QARUDLHN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SFQNMFHX.mjs +0 -747
- package/dist/lib/node-esm/chunk-SFQNMFHX.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-W72HVQMD.mjs +0 -64
- package/dist/lib/node-esm/chunk-W72HVQMD.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -132
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-VDHCUAIO.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-VDHCUAIO.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-ZIXDGJAN.mjs +0 -35
- package/dist/lib/node-esm/react-surface-ZIXDGJAN.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-QPS55YP2.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -13
- package/dist/types/src/capabilities/capabilities.d.ts +0 -17
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts +0 -20
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +0 -39
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +0 -28
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/index.d.ts +0 -2
- package/dist/types/src/components/Transcript/index.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +0 -15
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +0 -9
- package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +0 -12
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +0 -1
- package/dist/types/src/components/stories/useIsSpeaking.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -3
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts +0 -7
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/functions/summarize.d.ts +0 -11
- package/dist/types/src/functions/summarize.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/index.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +0 -461
- package/dist/types/src/segments-normalization/normalization.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/normalization.test.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/utils.d.ts +0 -3
- package/dist/types/src/segments-normalization/utils.d.ts.map +0 -1
- package/dist/types/src/types/Transcript.d.ts +0 -30
- package/dist/types/src/types/Transcript.d.ts.map +0 -1
- package/dist/types/src/types/TranscriptAction.d.ts +0 -23
- package/dist/types/src/types/TranscriptAction.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -33
- package/src/capabilities/intent-resolver.ts +0 -18
- package/src/components/Transcript/Transcript.tsx +0 -93
- package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
- package/src/components/TranscriptContainer.tsx +0 -36
- package/src/components/stories/TranscriptionStory.tsx +0 -45
- package/src/functions/index.ts +0 -6
- package/src/functions/open.ts +0 -37
- package/src/functions/summarize.ts +0 -97
- package/src/segments-normalization/normalization.ts +0 -115
- package/src/types/Transcript.ts +0 -44
- package/src/types/TranscriptAction.ts +0 -24
- package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
- package/dist/lib/{browser/TranscriptContainer-4RBK74JP.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
- package/dist/lib/{node-esm/types → neutral/hooks}/index.mjs.map +0 -0
- package/dist/lib/{node-esm/TranscriptContainer-EGAAYVOP.mjs.map → neutral/index.mjs.map} +0 -0
- package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
- package/dist/types/src/{components/stories → stories}/useIsSpeaking.d.ts +0 -0
- package/src/{segments-normalization → normalization}/index.ts +1 -1
- /package/src/{components/stories → stories}/useIsSpeaking.tsx +0 -0
- /package/src/types/{types.ts → defs.ts} +0 -0
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
6
8
|
import { ClientCapabilities } from '@dxos/plugin-client';
|
|
7
9
|
|
|
8
|
-
import {
|
|
10
|
+
import { TranscriptionCapabilities } from '#types';
|
|
9
11
|
|
|
10
|
-
import {
|
|
12
|
+
import { MediaStreamRecorder, Transcriber, TranscriptionManager } from '../transcriber';
|
|
11
13
|
|
|
12
14
|
// TODO(burdon): Move to config?
|
|
13
15
|
|
|
@@ -30,48 +32,57 @@ const TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
|
|
|
30
32
|
/**
|
|
31
33
|
* Records audio while user is speaking and transcribes it after user is done speaking.
|
|
32
34
|
*/
|
|
33
|
-
export default (
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
mediaStreamTrack: audioStreamTrack,
|
|
35
|
+
export default Capability.makeModule(
|
|
36
|
+
Effect.fnUntraced(function* () {
|
|
37
|
+
// Get context for lazy capability access in callbacks.
|
|
38
|
+
const capabilities = yield* Capability.Service;
|
|
39
|
+
const registry = yield* Capability.get(Capabilities.AtomRegistry);
|
|
40
|
+
|
|
41
|
+
const getTranscriber: TranscriptionCapabilities.GetTranscriber = ({
|
|
42
|
+
audioStreamTrack,
|
|
43
|
+
onSegments,
|
|
44
|
+
transcriberConfig,
|
|
45
|
+
recorderConfig,
|
|
46
|
+
transcribe,
|
|
47
|
+
}) => {
|
|
48
|
+
// Initialize audio transcription.
|
|
49
|
+
return new Transcriber({
|
|
49
50
|
config: {
|
|
50
|
-
|
|
51
|
-
|
|
51
|
+
transcribeAfterChunksAmount: TRANSCRIBE_AFTER_CHUNKS_AMOUNT,
|
|
52
|
+
prefixBufferChunksAmount: PREFIXED_CHUNKS_AMOUNT,
|
|
53
|
+
...transcriberConfig,
|
|
52
54
|
},
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
recorder: new MediaStreamRecorder({
|
|
56
|
+
mediaStreamTrack: audioStreamTrack,
|
|
57
|
+
config: {
|
|
58
|
+
interval: RECORD_INTERVAL,
|
|
59
|
+
...recorderConfig,
|
|
60
|
+
},
|
|
61
|
+
}),
|
|
62
|
+
onSegments,
|
|
63
|
+
transcribe,
|
|
64
|
+
});
|
|
65
|
+
};
|
|
57
66
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
67
|
+
const getTranscriptionManager: TranscriptionCapabilities.GetTranscriptionManager = ({ messageEnricher }) => {
|
|
68
|
+
const client = capabilities.get(ClientCapabilities.Client);
|
|
69
|
+
const transcriptionManager = new TranscriptionManager({
|
|
70
|
+
edgeClient: client.edge.http,
|
|
71
|
+
messageEnricher,
|
|
72
|
+
registry,
|
|
73
|
+
});
|
|
64
74
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
const identity = client.halo.identity.get();
|
|
76
|
+
if (identity) {
|
|
77
|
+
transcriptionManager.setIdentityDid(identity.did);
|
|
78
|
+
}
|
|
69
79
|
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
return transcriptionManager;
|
|
81
|
+
};
|
|
72
82
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
}
|
|
83
|
+
return [
|
|
84
|
+
Capability.contributes(TranscriptionCapabilities.Transcriber, getTranscriber),
|
|
85
|
+
Capability.contributes(TranscriptionCapabilities.TranscriptionManager, getTranscriptionManager),
|
|
86
|
+
];
|
|
87
|
+
}),
|
|
88
|
+
);
|
package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx}
RENAMED
|
@@ -2,60 +2,56 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import type * as Types from 'effect/Types';
|
|
8
8
|
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
9
9
|
|
|
10
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
11
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
11
|
import { Key } from '@dxos/echo';
|
|
13
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import { useMembers, useSpace } from '@dxos/react-client/echo';
|
|
12
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
13
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
14
|
+
import { PreviewPlugin } from '@dxos/plugin-preview/testing';
|
|
15
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
16
|
+
import { random } from '@dxos/random';
|
|
17
|
+
import { useMembers, useSpaces } from '@dxos/react-client/echo';
|
|
20
18
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import {
|
|
25
|
-
import { withLayout } from '@dxos/storybook-utils';
|
|
19
|
+
import { JsonHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
20
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
21
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
22
|
+
import { type ContentBlock, type Message, Organization, Person } from '@dxos/types';
|
|
26
23
|
|
|
27
|
-
import { useQueueModelAdapter } from '
|
|
28
|
-
import { SerializationModel } from '../../model';
|
|
24
|
+
import { useQueueModelAdapter } from '#hooks';
|
|
29
25
|
import {
|
|
30
26
|
MessageBuilder,
|
|
31
27
|
TestItem,
|
|
32
28
|
useTestTranscriptionQueue,
|
|
33
29
|
useTestTranscriptionQueueWithEntityExtraction,
|
|
34
|
-
} from '
|
|
35
|
-
import { translations } from '
|
|
30
|
+
} from '#testing';
|
|
31
|
+
import { translations } from '#translations';
|
|
36
32
|
|
|
37
|
-
import {
|
|
33
|
+
import { SerializationModel } from '../../model';
|
|
34
|
+
import { renderByline } from '../../util';
|
|
35
|
+
import { Transcription, type TranscriptionProps } from './Transcription';
|
|
38
36
|
|
|
39
|
-
|
|
37
|
+
random.seed(1);
|
|
40
38
|
|
|
41
39
|
/**
|
|
42
40
|
* Story wrapper with test controls.
|
|
43
41
|
*/
|
|
44
42
|
const TranscriptContainer: FC<
|
|
45
|
-
|
|
43
|
+
TranscriptionProps & {
|
|
46
44
|
running: boolean;
|
|
47
45
|
onRunningChange: (running: boolean) => void;
|
|
48
46
|
onReset?: () => void;
|
|
49
47
|
}
|
|
50
|
-
> = ({
|
|
48
|
+
> = ({ model, running, onRunningChange, onReset }) => {
|
|
51
49
|
return (
|
|
52
50
|
<div className='grid grid-rows-[1fr_40px] grow divide-y divide-separator'>
|
|
53
|
-
<
|
|
51
|
+
<Transcription model={model} />
|
|
54
52
|
<div className='grid grid-cols-[1fr_16rem] overflow-hidden'>
|
|
55
53
|
<div className='flex items-center'>
|
|
56
|
-
<
|
|
57
|
-
{JSON.stringify(model.toJSON())}
|
|
58
|
-
</SyntaxHighlighter>
|
|
54
|
+
<JsonHighlighter data={model.toJSON()} indent={0} classNames='text-sm' />
|
|
59
55
|
</div>
|
|
60
56
|
<Toolbar.Root classNames='justify-end'>
|
|
61
57
|
<IconButton
|
|
@@ -70,20 +66,24 @@ const TranscriptContainer: FC<
|
|
|
70
66
|
);
|
|
71
67
|
};
|
|
72
68
|
|
|
73
|
-
type
|
|
69
|
+
type DefaultStoryProps = { messages?: Message.Message[] } & Pick<
|
|
70
|
+
TranscriptionProps,
|
|
71
|
+
'ignoreAttention' | 'attendableId'
|
|
72
|
+
>;
|
|
74
73
|
|
|
75
74
|
/**
|
|
76
75
|
* Basic story mutates array of messages.
|
|
77
76
|
*/
|
|
78
|
-
const BasicStory = ({ messages: initialMessages = [], ...props }:
|
|
77
|
+
const BasicStory = ({ messages: initialMessages = [], ...props }: DefaultStoryProps) => {
|
|
79
78
|
const [reset, setReset] = useState({});
|
|
80
79
|
const builder = useMemo(() => new MessageBuilder(), []);
|
|
81
80
|
const model = useMemo(
|
|
82
|
-
() => new SerializationModel<
|
|
81
|
+
() => new SerializationModel<Message.Message>(renderByline([]), initialMessages),
|
|
83
82
|
[initialMessages, reset],
|
|
84
83
|
);
|
|
85
84
|
const [running, setRunning] = useState(true);
|
|
86
|
-
|
|
85
|
+
// Use mutable type for local message building (not ECHO-managed).
|
|
86
|
+
const [currentMessage, setCurrentMessage] = useState<Types.Mutable<Message.Message> | null>(null);
|
|
87
87
|
useEffect(() => {
|
|
88
88
|
if (!running) {
|
|
89
89
|
return;
|
|
@@ -104,7 +104,7 @@ const BasicStory = ({ messages: initialMessages = [], ...props }: StoryProps) =>
|
|
|
104
104
|
return;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
currentMessage.blocks.push(builder.createBlock());
|
|
107
|
+
(currentMessage.blocks as ContentBlock.Any[]).push(builder.createBlock());
|
|
108
108
|
model.updateChunk(currentMessage);
|
|
109
109
|
}, 3_000);
|
|
110
110
|
|
|
@@ -136,34 +136,27 @@ const QueueStory = ({
|
|
|
136
136
|
queueId,
|
|
137
137
|
onReset,
|
|
138
138
|
...props
|
|
139
|
-
}:
|
|
139
|
+
}: DefaultStoryProps & { queueId: Key.ObjectId; onReset: () => void }) => {
|
|
140
140
|
const [running, setRunning] = useState(true);
|
|
141
|
-
const space =
|
|
142
|
-
const members = useMembers(space?.
|
|
141
|
+
const [space] = useSpaces();
|
|
142
|
+
const members = useMembers(space?.id).map((member) => member.identity);
|
|
143
143
|
const queue = useTestTranscriptionQueue(space, queueId, running, 2_000);
|
|
144
144
|
const model = useQueueModelAdapter(renderByline(members), queue, initialMessages);
|
|
145
145
|
|
|
146
146
|
return (
|
|
147
|
-
<TranscriptContainer
|
|
148
|
-
space={space}
|
|
149
|
-
model={model}
|
|
150
|
-
running={running}
|
|
151
|
-
onRunningChange={setRunning}
|
|
152
|
-
onReset={onReset}
|
|
153
|
-
{...props}
|
|
154
|
-
/>
|
|
147
|
+
<TranscriptContainer model={model} running={running} onRunningChange={setRunning} onReset={onReset} {...props} />
|
|
155
148
|
);
|
|
156
149
|
};
|
|
157
150
|
|
|
158
151
|
// TODO(burdon): Reconcile with QueueStory.
|
|
159
152
|
const EntityExtractionQueueStory = () => {
|
|
160
153
|
const [running, setRunning] = useState(true);
|
|
161
|
-
const space =
|
|
154
|
+
const [space] = useSpaces();
|
|
162
155
|
const members = useMembers(space?.key).map((member) => member.identity);
|
|
163
156
|
const queue = useTestTranscriptionQueueWithEntityExtraction(space, undefined, running, 2_000);
|
|
164
157
|
const model = useQueueModelAdapter(renderByline(members), queue, []);
|
|
165
158
|
|
|
166
|
-
return <TranscriptContainer
|
|
159
|
+
return <TranscriptContainer model={model} running={running} onRunningChange={setRunning} />;
|
|
167
160
|
};
|
|
168
161
|
|
|
169
162
|
/**
|
|
@@ -180,39 +173,49 @@ const QueueStoryWrapper = () => {
|
|
|
180
173
|
};
|
|
181
174
|
|
|
182
175
|
const meta = {
|
|
183
|
-
title: 'plugins/plugin-transcription/
|
|
176
|
+
title: 'plugins/plugin-transcription/components/Transcription',
|
|
184
177
|
decorators: [
|
|
178
|
+
withLayout({ layout: 'fullscreen' }),
|
|
185
179
|
withPluginManager({
|
|
186
180
|
plugins: [
|
|
187
|
-
|
|
188
|
-
|
|
181
|
+
...corePlugins(),
|
|
182
|
+
StorybookPlugin({}),
|
|
189
183
|
ClientPlugin({
|
|
190
|
-
types: [TestItem,
|
|
191
|
-
onClientInitialized:
|
|
192
|
-
|
|
193
|
-
|
|
184
|
+
types: [TestItem, TestSchema.DocumentType, Person.Person, Organization.Organization],
|
|
185
|
+
onClientInitialized: ({ client }) =>
|
|
186
|
+
Effect.gen(function* () {
|
|
187
|
+
yield* initializeIdentity(client);
|
|
188
|
+
}),
|
|
194
189
|
}),
|
|
190
|
+
|
|
195
191
|
PreviewPlugin(),
|
|
196
|
-
SpacePlugin(),
|
|
197
|
-
SettingsPlugin(),
|
|
198
|
-
IntentPlugin(),
|
|
199
192
|
],
|
|
200
193
|
}),
|
|
201
|
-
withLayout({ fullscreen: true }),
|
|
202
194
|
],
|
|
203
195
|
parameters: {
|
|
196
|
+
layout: 'fullscreen',
|
|
204
197
|
translations,
|
|
205
198
|
},
|
|
206
199
|
} satisfies Meta;
|
|
207
200
|
|
|
208
201
|
export default meta;
|
|
209
202
|
|
|
210
|
-
|
|
211
|
-
|
|
203
|
+
const DefaultStory = (props: DefaultStoryProps) => {
|
|
204
|
+
const [messages, setMessages] = useState<Message.Message[]>([]);
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
void Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())).then(setMessages);
|
|
207
|
+
}, []);
|
|
208
|
+
if (messages.length === 0) {
|
|
209
|
+
return <div>Loading messages...</div>;
|
|
210
|
+
}
|
|
211
|
+
return <BasicStory {...props} messages={messages} />;
|
|
212
|
+
};
|
|
213
|
+
|
|
214
|
+
export const Default: StoryObj<typeof DefaultStory> = {
|
|
215
|
+
render: DefaultStory,
|
|
212
216
|
args: {
|
|
213
217
|
ignoreAttention: true,
|
|
214
218
|
attendableId: 'story',
|
|
215
|
-
messages: await Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())),
|
|
216
219
|
},
|
|
217
220
|
};
|
|
218
221
|
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { useThemeContext } from '@dxos/react-ui';
|
|
8
|
+
import { useTextEditor } from '@dxos/react-ui-editor';
|
|
9
|
+
import { type Message, type Transcript } from '@dxos/types';
|
|
10
|
+
import {
|
|
11
|
+
autoScroll,
|
|
12
|
+
createBasicExtensions,
|
|
13
|
+
createMarkdownExtensions,
|
|
14
|
+
createThemeExtensions,
|
|
15
|
+
decorateMarkdown,
|
|
16
|
+
documentSlots,
|
|
17
|
+
preview,
|
|
18
|
+
} from '@dxos/ui-editor';
|
|
19
|
+
import { composable, composableProps } from '@dxos/ui-theme';
|
|
20
|
+
import { isTruthy } from '@dxos/util';
|
|
21
|
+
|
|
22
|
+
import { type SerializationModel } from '../../model';
|
|
23
|
+
import { renderByline } from '../../util';
|
|
24
|
+
import { transcription } from './transcription-extension';
|
|
25
|
+
|
|
26
|
+
export { renderByline };
|
|
27
|
+
|
|
28
|
+
export type TranscriptionProps = {
|
|
29
|
+
transcript?: Transcript.Transcript;
|
|
30
|
+
model: SerializationModel<Message.Message>;
|
|
31
|
+
// TODO(burdon): Are these still in use?
|
|
32
|
+
attendableId?: string;
|
|
33
|
+
ignoreAttention?: boolean;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Transcript component implemented using the editor.
|
|
38
|
+
*/
|
|
39
|
+
export const Transcription = composable<HTMLDivElement, TranscriptionProps>(
|
|
40
|
+
({ transcript: object, model, children, ...props }, forwardedRef) => {
|
|
41
|
+
const { themeMode } = useThemeContext();
|
|
42
|
+
const { parentRef } = useTextEditor(() => {
|
|
43
|
+
return {
|
|
44
|
+
extensions: [
|
|
45
|
+
createBasicExtensions({ readOnly: true, lineWrapping: true, search: true }),
|
|
46
|
+
createMarkdownExtensions(),
|
|
47
|
+
createThemeExtensions({ themeMode, slots: documentSlots }),
|
|
48
|
+
decorateMarkdown(),
|
|
49
|
+
preview(),
|
|
50
|
+
transcription({ model, started: object?.started ? new Date(object.started) : undefined }),
|
|
51
|
+
autoScroll(),
|
|
52
|
+
].filter(isTruthy),
|
|
53
|
+
};
|
|
54
|
+
}, [model]);
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div
|
|
58
|
+
{...composableProps(props, { classNames: 'dx-container' })}
|
|
59
|
+
ref={parentRef}
|
|
60
|
+
data-popover-collision-boundary={true /* TODO(thure): Make this a constant and document it. */}
|
|
61
|
+
/>
|
|
62
|
+
);
|
|
63
|
+
},
|
|
64
|
+
);
|
|
@@ -8,22 +8,22 @@ import { format } from 'date-fns/format';
|
|
|
8
8
|
import { intervalToDuration } from 'date-fns/intervalToDuration';
|
|
9
9
|
|
|
10
10
|
import { type CleanupFn, addEventListener, combine } from '@dxos/async';
|
|
11
|
-
import { type
|
|
11
|
+
import { type Message } from '@dxos/types';
|
|
12
12
|
|
|
13
13
|
import { DocumentAdapter, type SerializationModel } from '../../model';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Data structure that maps Chunks queue to lines with transcript state.
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
19
|
-
model: SerializationModel<
|
|
18
|
+
export type TranscriptionOptions = {
|
|
19
|
+
model: SerializationModel<Message.Message>;
|
|
20
20
|
started?: Date;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Scrolling transcript with timestamps.
|
|
25
25
|
*/
|
|
26
|
-
export const
|
|
26
|
+
export const transcription = ({ model, started }: TranscriptionOptions): Extension => {
|
|
27
27
|
return [
|
|
28
28
|
// Show timestamps in the gutter.
|
|
29
29
|
gutter({
|
|
@@ -131,8 +131,12 @@ export const transcript = ({ model, started }: TranscriptOptions): Extension =>
|
|
|
131
131
|
),
|
|
132
132
|
|
|
133
133
|
EditorView.theme({
|
|
134
|
+
'.cm-gutters': {
|
|
135
|
+
backgroundColor: 'var(--color-base-surface)',
|
|
136
|
+
},
|
|
134
137
|
'.cm-timestamp-gutter': {
|
|
135
138
|
width: '6rem',
|
|
139
|
+
paddingLeft: '0.5rem',
|
|
136
140
|
paddingRight: '1rem',
|
|
137
141
|
},
|
|
138
142
|
'.cm-timestamp-gutter > .cm-gutterElement > div': {
|
|
@@ -156,13 +160,13 @@ class TimestampMarker extends GutterMarker {
|
|
|
156
160
|
super();
|
|
157
161
|
}
|
|
158
162
|
|
|
159
|
-
override eq(other: this)
|
|
160
|
-
return
|
|
163
|
+
override eq(other: this) {
|
|
164
|
+
return this._timestamp === other._timestamp;
|
|
161
165
|
}
|
|
162
166
|
|
|
163
|
-
override toDOM(view: EditorView)
|
|
167
|
+
override toDOM(view: EditorView) {
|
|
164
168
|
const el = document.createElement('div');
|
|
165
|
-
el.className = 'text-sm text-subdued hover:bg-
|
|
169
|
+
el.className = 'text-sm text-subdued hover:bg-hover-surface cursor-pointer';
|
|
166
170
|
el.textContent = formatTimestamp(this._timestamp, this._started);
|
|
167
171
|
// TODO(burdon): Click to bookmark or copy hyperlink.
|
|
168
172
|
el.onclick = () => {
|
|
@@ -176,7 +180,7 @@ class TimestampMarker extends GutterMarker {
|
|
|
176
180
|
}
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
const getStartTime = (started?: Date, message?:
|
|
183
|
+
const getStartTime = (started?: Date, message?: Message.Message): Date | undefined => {
|
|
180
184
|
if (started) {
|
|
181
185
|
return started;
|
|
182
186
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2024 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { type AppSurface } from '@dxos/app-toolkit/ui';
|
|
8
|
+
import { Feed, Obj } from '@dxos/echo';
|
|
9
|
+
import { useMembers, useQueue } from '@dxos/react-client/echo';
|
|
10
|
+
import { Panel } from '@dxos/react-ui';
|
|
11
|
+
import { type Message, type Transcript } from '@dxos/types';
|
|
12
|
+
|
|
13
|
+
import { Transcription } from '#components';
|
|
14
|
+
import { useQueueModelAdapter } from '#hooks';
|
|
15
|
+
|
|
16
|
+
import { renderByline } from '../../util';
|
|
17
|
+
|
|
18
|
+
export type TranscriptionContainerProps = AppSurface.ObjectArticleProps<Transcript.Transcript>;
|
|
19
|
+
|
|
20
|
+
export const TranscriptionContainer = ({ role, subject: transcript, attendableId }: TranscriptionContainerProps) => {
|
|
21
|
+
const db = Obj.getDatabase(transcript);
|
|
22
|
+
const members = useMembers(db?.spaceId).map((member) => member.identity);
|
|
23
|
+
const feed = transcript.feed.target;
|
|
24
|
+
const queueDxn = feed ? Feed.getQueueDxn(feed) : undefined;
|
|
25
|
+
const queue = useQueue<Message.Message>(queueDxn, { pollInterval: 1_000 });
|
|
26
|
+
const model = useQueueModelAdapter(renderByline(members), queue);
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Panel.Root role={role}>
|
|
30
|
+
<Panel.Content asChild>
|
|
31
|
+
<Transcription attendableId={attendableId} model={model} transcript={transcript} />
|
|
32
|
+
</Panel.Content>
|
|
33
|
+
</Panel.Root>
|
|
34
|
+
);
|
|
35
|
+
};
|
|
@@ -20,58 +20,63 @@ export const useAudioFile = (audioUrl: string, constraints?: MediaTrackConstrain
|
|
|
20
20
|
const ctx = new Context();
|
|
21
21
|
|
|
22
22
|
scheduleTask(ctx, async () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
URL.
|
|
28
|
-
|
|
23
|
+
// TODO(wittjosiah): Fetch to external url fails in headless storybook test.
|
|
24
|
+
try {
|
|
25
|
+
const response = await fetch(audioUrl);
|
|
26
|
+
const blob = await response.blob();
|
|
27
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
28
|
+
ctx.onDispose(() => {
|
|
29
|
+
URL.revokeObjectURL(objectUrl);
|
|
30
|
+
});
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const audio = new Audio();
|
|
33
|
+
audio.src = objectUrl;
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
35
|
+
await new Promise<void>((resolve, reject) => {
|
|
36
|
+
audio.addEventListener(
|
|
37
|
+
'error',
|
|
38
|
+
(err) => {
|
|
39
|
+
log.error('error', { err });
|
|
40
|
+
reject(err);
|
|
41
|
+
},
|
|
42
|
+
{ once: true },
|
|
43
|
+
);
|
|
44
|
+
audio.addEventListener(
|
|
45
|
+
'canplay',
|
|
46
|
+
async () => {
|
|
47
|
+
resolve();
|
|
48
|
+
},
|
|
49
|
+
{ once: true },
|
|
50
|
+
);
|
|
51
|
+
audio.load();
|
|
52
|
+
});
|
|
51
53
|
|
|
52
|
-
|
|
54
|
+
const audioCtx = new AudioContext();
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
// Resume AudioContext if it's suspended.
|
|
57
|
+
if (audioCtx.state === 'suspended') {
|
|
58
|
+
await audioCtx.resume();
|
|
59
|
+
}
|
|
58
60
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
+
const destination = audioCtx.createMediaStreamDestination();
|
|
62
|
+
destination.channelCount = 1;
|
|
61
63
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
const source = audioCtx.createMediaElementSource(audio);
|
|
65
|
+
source.connect(destination);
|
|
66
|
+
const track = destination.stream.getAudioTracks()[0];
|
|
67
|
+
if (constraints) {
|
|
68
|
+
await track.applyConstraints(constraints).catch((err) => log.catch(err));
|
|
69
|
+
}
|
|
68
70
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
// Also connect to speakers so audio is audible.
|
|
72
|
+
setStream({
|
|
73
|
+
audio,
|
|
74
|
+
stream: destination.stream,
|
|
75
|
+
track: destination.stream.getAudioTracks()[0],
|
|
76
|
+
});
|
|
77
|
+
} catch (err) {
|
|
78
|
+
log.catch(err);
|
|
79
|
+
}
|
|
75
80
|
});
|
|
76
81
|
|
|
77
82
|
return () => {
|
|
@@ -12,7 +12,7 @@ import { type ChunkRenderer, SerializationModel } from '../model';
|
|
|
12
12
|
/**
|
|
13
13
|
* Model adapter for a queue.
|
|
14
14
|
*/
|
|
15
|
-
export const useQueueModelAdapter = <T extends Obj.
|
|
15
|
+
export const useQueueModelAdapter = <T extends Obj.Unknown>(
|
|
16
16
|
renderer: ChunkRenderer<T>,
|
|
17
17
|
queue: Queue<T> | undefined,
|
|
18
18
|
initialChunks: T[] = [],
|