@dxos/plugin-transcription 0.8.3 → 0.8.4-main.03d5cd7b56
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-IQ5ZRMHZ.mjs → neutral/chunk-LS3R7EQI.mjs} +130 -195
- 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/{browser/transcriber-OYPLZFG5.mjs → neutral/transcriber-M3R6HPTZ.mjs} +21 -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 +6 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +10 -4
- 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 -6
- 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/stories/FileTranscription.stories.d.ts +18 -0
- package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts +14 -0
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
- package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts +20 -0
- 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/media-stream-recorder.d.ts +3 -3
- 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 +12 -13
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +10 -11
- 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/defs.d.ts +5 -0
- package/dist/types/src/types/defs.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +3 -2
- 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 +152 -84
- package/src/TranscriptionPlugin.node.ts +20 -0
- package/src/TranscriptionPlugin.test.ts +31 -0
- package/src/TranscriptionPlugin.tsx +22 -61
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/transcription-blueprint.ts +29 -0
- package/src/capabilities/blueprint-definition.ts +19 -0
- package/src/capabilities/index.ts +11 -6
- 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 -41
- package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +80 -75
- 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} +15 -48
- 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 +49 -53
- package/src/hooks/useQueueModelAdapter.ts +1 -1
- package/src/hooks/useTranscriber.ts +15 -7
- package/src/hooks/useVoiceInput.ts +3 -3
- package/src/index.ts +4 -5
- package/src/meta.ts +9 -6
- package/src/model/model.test.ts +27 -21
- package/src/model/model.ts +3 -3
- package/src/{segments-normalization → normalization}/message-normalizer.ts +20 -19
- package/src/{segments-normalization → normalization}/normalization.test.ts +26 -33
- 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/stories/FileTranscription.stories.tsx +269 -0
- package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +46 -40
- package/src/stories/MicrophoneTranscription.stories.tsx +264 -0
- package/src/stories/TranscriptionStory.tsx +93 -0
- package/src/testing/testing.ts +41 -41
- package/src/transcriber/media-stream-recorder.ts +4 -4
- package/src/transcriber/transcriber.browser.test.ts +5 -5
- package/src/transcriber/transcriber.test.ts +104 -0
- package/src/transcriber/transcriber.ts +101 -62
- package/src/transcriber/transcription-manager.ts +37 -52
- package/src/translations.ts +12 -10
- package/src/types/TranscriptOperation.ts +103 -0
- package/src/types/TranscriptionCapabilities.ts +39 -0
- package/src/types/defs.ts +9 -0
- package/src/types/index.ts +4 -2
- package/src/util/index.ts +1 -0
- package/src/util/render-byline.ts +33 -0
- package/dist/lib/browser/TranscriptContainer-H3AZQ4CQ.mjs +0 -11
- package/dist/lib/browser/chunk-53AXUEIQ.mjs +0 -764
- package/dist/lib/browser/chunk-53AXUEIQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-GOF7MJNV.mjs +0 -19
- package/dist/lib/browser/chunk-GOF7MJNV.mjs.map +0 -7
- package/dist/lib/browser/chunk-IQ5ZRMHZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-OSISJM2F.mjs +0 -55
- package/dist/lib/browser/chunk-OSISJM2F.mjs.map +0 -7
- package/dist/lib/browser/chunk-UDCCT32F.mjs +0 -8
- package/dist/lib/browser/chunk-UDCCT32F.mjs.map +0 -7
- package/dist/lib/browser/chunk-W2KNYJD6.mjs +0 -16
- package/dist/lib/browser/chunk-W2KNYJD6.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -125
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-BGADCHVM.mjs +0 -30
- package/dist/lib/browser/intent-resolver-BGADCHVM.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-HMJS5FSS.mjs +0 -34
- package/dist/lib/browser/react-surface-HMJS5FSS.mjs.map +0 -7
- package/dist/lib/browser/transcriber-OYPLZFG5.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -14
- package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs +0 -32
- package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs.map +0 -7
- package/dist/lib/node/chunk-3PYT3BDM.cjs +0 -40
- package/dist/lib/node/chunk-3PYT3BDM.cjs.map +0 -7
- package/dist/lib/node/chunk-6LW5RA3K.cjs +0 -75
- package/dist/lib/node/chunk-6LW5RA3K.cjs.map +0 -7
- package/dist/lib/node/chunk-AFUZI63A.cjs +0 -42
- package/dist/lib/node/chunk-AFUZI63A.cjs.map +0 -7
- package/dist/lib/node/chunk-CVUN3UO7.cjs +0 -778
- package/dist/lib/node/chunk-CVUN3UO7.cjs.map +0 -7
- package/dist/lib/node/chunk-FKDJNJ57.cjs +0 -35
- package/dist/lib/node/chunk-FKDJNJ57.cjs.map +0 -7
- package/dist/lib/node/chunk-ZFAUMZXE.cjs +0 -518
- package/dist/lib/node/chunk-ZFAUMZXE.cjs.map +0 -7
- package/dist/lib/node/index.cjs +0 -133
- package/dist/lib/node/index.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-LL3TTI4H.cjs +0 -45
- package/dist/lib/node/intent-resolver-LL3TTI4H.cjs.map +0 -7
- package/dist/lib/node/meta.json +0 -1
- package/dist/lib/node/react-surface-N25TBBG4.cjs +0 -56
- package/dist/lib/node/react-surface-N25TBBG4.cjs.map +0 -7
- package/dist/lib/node/transcriber-6J4FVFSZ.cjs +0 -68
- package/dist/lib/node/transcriber-6J4FVFSZ.cjs.map +0 -7
- package/dist/lib/node/types/index.cjs +0 -36
- package/dist/lib/node/types/index.cjs.map +0 -7
- package/dist/lib/node-esm/TranscriptContainer-G75LDEO5.mjs +0 -12
- package/dist/lib/node-esm/chunk-56QHOX4A.mjs +0 -765
- package/dist/lib/node-esm/chunk-56QHOX4A.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-FH75X4JC.mjs +0 -56
- package/dist/lib/node-esm/chunk-FH75X4JC.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MFJO7EKD.mjs +0 -10
- package/dist/lib/node-esm/chunk-MFJO7EKD.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MFJPEIVB.mjs +0 -17
- package/dist/lib/node-esm/chunk-MFJPEIVB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PRL64SRU.mjs +0 -496
- package/dist/lib/node-esm/chunk-PRL64SRU.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TXMDLLBR.mjs +0 -21
- package/dist/lib/node-esm/chunk-TXMDLLBR.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -126
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs +0 -31
- package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs +0 -35
- package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs +0 -57
- package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -15
- 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 -24
- 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 -19
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +0 -8
- package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +0 -17
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +0 -10
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +0 -19
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +0 -11
- 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/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 -329
- 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/schema.d.ts +0 -41
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -31
- 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 -24
- package/src/components/Transcript/Transcript.tsx +0 -100
- package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
- package/src/components/TranscriptContainer.tsx +0 -30
- package/src/components/stories/FileTranscription.stories.tsx +0 -242
- package/src/components/stories/MicrophoneTranscription.stories.tsx +0 -280
- package/src/components/stories/TranscriptionStory.tsx +0 -41
- package/src/segments-normalization/normalization.ts +0 -105
- package/src/types/schema.ts +0 -41
- package/src/types/types.ts +0 -32
- package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
- package/dist/lib/{browser/TranscriptContainer-H3AZQ4CQ.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-G75LDEO5.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
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import React, { useCallback, useEffect, useMemo, useState } from 'react';
|
|
8
|
+
|
|
9
|
+
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
11
|
+
import {
|
|
12
|
+
type ExtractionFunction,
|
|
13
|
+
extractionAnthropicFunction,
|
|
14
|
+
extractionNerFunction,
|
|
15
|
+
getNer,
|
|
16
|
+
processTranscriptMessage,
|
|
17
|
+
} from '@dxos/assistant/extraction';
|
|
18
|
+
import { Filter, type Obj } from '@dxos/echo';
|
|
19
|
+
import { MemoryQueue } from '@dxos/echo-db';
|
|
20
|
+
import { createQueueDXN } from '@dxos/echo/internal';
|
|
21
|
+
import { invariant } from '@dxos/invariant';
|
|
22
|
+
import { log } from '@dxos/log';
|
|
23
|
+
import { ClientPlugin } from '@dxos/plugin-client/plugin';
|
|
24
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
25
|
+
import { PreviewPlugin } from '@dxos/plugin-preview/testing';
|
|
26
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
27
|
+
import { IndexKind, useSpaces } from '@dxos/react-client/echo';
|
|
28
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
29
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
30
|
+
import { Message, Organization, Person } from '@dxos/types';
|
|
31
|
+
import { seedTestData } from '@dxos/types/testing';
|
|
32
|
+
|
|
33
|
+
import { useAudioTrack, useQueueModelAdapter, useTranscriber } from '#hooks';
|
|
34
|
+
import { TestItem } from '#testing';
|
|
35
|
+
|
|
36
|
+
import { type MediaStreamRecorderProps, type TranscriberProps } from '../transcriber';
|
|
37
|
+
import { TranscriptionPlugin } from '../TranscriptionPlugin';
|
|
38
|
+
import { renderByline } from '../util';
|
|
39
|
+
import { TranscriptionStory } from './TranscriptionStory';
|
|
40
|
+
import { useIsSpeaking } from './useIsSpeaking';
|
|
41
|
+
|
|
42
|
+
const TRANSCRIBER_CONFIG = {
|
|
43
|
+
transcribeAfterChunksAmount: 50,
|
|
44
|
+
prefixBufferChunksAmount: 10,
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
const RECORDER_CONFIG = {
|
|
48
|
+
interval: 200,
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type DefaultStoryProps = {
|
|
52
|
+
detectSpeaking?: boolean;
|
|
53
|
+
transcriberConfig: TranscriberProps['config'];
|
|
54
|
+
recorderConfig: MediaStreamRecorderProps['config'];
|
|
55
|
+
audioConstraints?: MediaTrackConstraints;
|
|
56
|
+
entityExtraction: 'none' | 'ner' | 'llm';
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const DefaultStory = ({
|
|
60
|
+
detectSpeaking,
|
|
61
|
+
entityExtraction = 'none',
|
|
62
|
+
transcriberConfig,
|
|
63
|
+
recorderConfig,
|
|
64
|
+
audioConstraints,
|
|
65
|
+
}: DefaultStoryProps) => {
|
|
66
|
+
const [running, setRunning] = useState(false);
|
|
67
|
+
|
|
68
|
+
// Audio.
|
|
69
|
+
const track = useAudioTrack(running, audioConstraints);
|
|
70
|
+
|
|
71
|
+
// Speaking.
|
|
72
|
+
const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
|
|
73
|
+
|
|
74
|
+
// Queue.
|
|
75
|
+
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
76
|
+
const queueDxn = useMemo(() => createQueueDXN(), []);
|
|
77
|
+
const queue = useMemo(() => new MemoryQueue<Message.Message>(queueDxn), [queueDxn]);
|
|
78
|
+
const model = useQueueModelAdapter(renderByline([]), queue);
|
|
79
|
+
const [space] = useSpaces();
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
if (!space) {
|
|
83
|
+
log.warn('no space');
|
|
84
|
+
}
|
|
85
|
+
}, [space]);
|
|
86
|
+
|
|
87
|
+
// Entity extraction.
|
|
88
|
+
const { extractionFunction, objects } = useMemo(() => {
|
|
89
|
+
if (!space) {
|
|
90
|
+
log.warn('no space');
|
|
91
|
+
return {};
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
let extractionFunction: ExtractionFunction | undefined;
|
|
95
|
+
let objects: Promise<Obj.Unknown[]> | undefined;
|
|
96
|
+
|
|
97
|
+
if (entityExtraction === 'ner') {
|
|
98
|
+
// Init model loading. Takes time.
|
|
99
|
+
void getNer();
|
|
100
|
+
extractionFunction = extractionNerFunction;
|
|
101
|
+
} else if (entityExtraction === 'llm') {
|
|
102
|
+
extractionFunction = extractionAnthropicFunction;
|
|
103
|
+
objects = space.db
|
|
104
|
+
.query(
|
|
105
|
+
Filter.or(
|
|
106
|
+
Filter.type(Person.Person),
|
|
107
|
+
Filter.type(Organization.Organization),
|
|
108
|
+
Filter.type(TestSchema.DocumentType),
|
|
109
|
+
),
|
|
110
|
+
)
|
|
111
|
+
.run();
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return { extractionFunction, objects };
|
|
115
|
+
}, [entityExtraction, space]);
|
|
116
|
+
|
|
117
|
+
// Transcriber.
|
|
118
|
+
const handleSegments = useCallback<TranscriberProps['onSegments']>(
|
|
119
|
+
async (blocks) => {
|
|
120
|
+
const message = Message.make({
|
|
121
|
+
sender: { name: 'You' },
|
|
122
|
+
created: new Date().toISOString(),
|
|
123
|
+
blocks,
|
|
124
|
+
});
|
|
125
|
+
if (!space) {
|
|
126
|
+
void queue.append([message]);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
if (entityExtraction !== 'none') {
|
|
131
|
+
invariant(extractionFunction, 'extractionFunction is required');
|
|
132
|
+
const result = await processTranscriptMessage({
|
|
133
|
+
function: extractionFunction,
|
|
134
|
+
input: {
|
|
135
|
+
message,
|
|
136
|
+
objects: await objects,
|
|
137
|
+
},
|
|
138
|
+
options: {
|
|
139
|
+
fallbackToRaw: true,
|
|
140
|
+
timeout: 30_000,
|
|
141
|
+
},
|
|
142
|
+
});
|
|
143
|
+
void queue.append([result.message]);
|
|
144
|
+
} else {
|
|
145
|
+
void queue.append([message]);
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
[queue, space],
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
const transcriber = useTranscriber({
|
|
152
|
+
audioStreamTrack: track,
|
|
153
|
+
onSegments: handleSegments,
|
|
154
|
+
transcriberConfig,
|
|
155
|
+
recorderConfig,
|
|
156
|
+
});
|
|
157
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
void transcriber?.open().then(() => setIsOpen(true));
|
|
160
|
+
return () => {
|
|
161
|
+
void transcriber?.close().then(() => setIsOpen(false));
|
|
162
|
+
};
|
|
163
|
+
}, [transcriber]);
|
|
164
|
+
|
|
165
|
+
// Manage transcription state.
|
|
166
|
+
useEffect(() => {
|
|
167
|
+
if (running && transcriber?.isOpen && isSpeaking) {
|
|
168
|
+
transcriber?.startChunksRecording();
|
|
169
|
+
} else if (!running || !isSpeaking) {
|
|
170
|
+
transcriber?.stopChunksRecording();
|
|
171
|
+
}
|
|
172
|
+
}, [transcriber, running, isOpen, isSpeaking]);
|
|
173
|
+
|
|
174
|
+
return <TranscriptionStory model={model} running={running} onRunningChange={setRunning} />;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const meta = {
|
|
178
|
+
title: 'plugins/plugin-transcription/components/MicrophoneTranscription',
|
|
179
|
+
render: DefaultStory,
|
|
180
|
+
decorators: [
|
|
181
|
+
withLayout({ layout: 'column' }),
|
|
182
|
+
withPluginManager({
|
|
183
|
+
plugins: [
|
|
184
|
+
...corePlugins(),
|
|
185
|
+
StorybookPlugin({}),
|
|
186
|
+
ClientPlugin({
|
|
187
|
+
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
188
|
+
onClientInitialized: ({ client }) =>
|
|
189
|
+
Effect.gen(function* () {
|
|
190
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
191
|
+
// TODO(mykola): Make API easier to use.
|
|
192
|
+
// TODO(mykola): Delete after enabling vector indexing by default.
|
|
193
|
+
// Enable vector indexing.
|
|
194
|
+
yield* Effect.promise(() =>
|
|
195
|
+
client.services.services.QueryService!.setConfig({
|
|
196
|
+
enabled: true,
|
|
197
|
+
indexes: [
|
|
198
|
+
//
|
|
199
|
+
{ kind: IndexKind.Kind.SCHEMA_MATCH },
|
|
200
|
+
{ kind: IndexKind.Kind.GRAPH },
|
|
201
|
+
{ kind: IndexKind.Kind.VECTOR },
|
|
202
|
+
],
|
|
203
|
+
}),
|
|
204
|
+
);
|
|
205
|
+
yield* Effect.promise(() => client.services.services.QueryService!.reindex());
|
|
206
|
+
yield* Effect.promise(() => seedTestData(personalSpace));
|
|
207
|
+
}),
|
|
208
|
+
}),
|
|
209
|
+
|
|
210
|
+
PreviewPlugin(),
|
|
211
|
+
TranscriptionPlugin(),
|
|
212
|
+
],
|
|
213
|
+
fireEvents: [AppActivationEvents.SetupAppGraph],
|
|
214
|
+
}),
|
|
215
|
+
],
|
|
216
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
217
|
+
|
|
218
|
+
export default meta;
|
|
219
|
+
|
|
220
|
+
type Story = StoryObj<typeof meta>;
|
|
221
|
+
|
|
222
|
+
export const Default: Story = {
|
|
223
|
+
args: {
|
|
224
|
+
detectSpeaking: false,
|
|
225
|
+
entityExtraction: 'none',
|
|
226
|
+
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
227
|
+
recorderConfig: RECORDER_CONFIG,
|
|
228
|
+
audioConstraints: {
|
|
229
|
+
echoCancellation: false,
|
|
230
|
+
noiseSuppression: false,
|
|
231
|
+
autoGainControl: false,
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
// NOTE: We are running out of free quota on hugging face entity extraction.
|
|
237
|
+
// TODO(mykola): Fix hugging face quota issues.
|
|
238
|
+
// export const EntityExtraction: Story = {
|
|
239
|
+
// args: {
|
|
240
|
+
// detectSpeaking: true,
|
|
241
|
+
// entityExtraction: 'ner',
|
|
242
|
+
// transcriberConfig: TRANSCRIBER_CONFIG,
|
|
243
|
+
// recorderConfig: RECORDER_CONFIG,
|
|
244
|
+
// audioConstraints: {
|
|
245
|
+
// echoCancellation: true,
|
|
246
|
+
// noiseSuppression: true,
|
|
247
|
+
// autoGainControl: true,
|
|
248
|
+
// },
|
|
249
|
+
// },
|
|
250
|
+
// };
|
|
251
|
+
|
|
252
|
+
export const SpeechDetection: Story = {
|
|
253
|
+
args: {
|
|
254
|
+
detectSpeaking: true,
|
|
255
|
+
entityExtraction: 'none',
|
|
256
|
+
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
257
|
+
recorderConfig: RECORDER_CONFIG,
|
|
258
|
+
audioConstraints: {
|
|
259
|
+
echoCancellation: true,
|
|
260
|
+
noiseSuppression: true,
|
|
261
|
+
autoGainControl: true,
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
};
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import '@dxos-theme';
|
|
6
|
+
|
|
7
|
+
import React, {
|
|
8
|
+
type ChangeEvent,
|
|
9
|
+
type Dispatch,
|
|
10
|
+
type FC,
|
|
11
|
+
type ReactNode,
|
|
12
|
+
type RefObject,
|
|
13
|
+
type SetStateAction,
|
|
14
|
+
useRef,
|
|
15
|
+
} from 'react';
|
|
16
|
+
|
|
17
|
+
import { IconButton, ScrollContainer, Toolbar } from '@dxos/react-ui';
|
|
18
|
+
import { type Message } from '@dxos/types';
|
|
19
|
+
|
|
20
|
+
import { Transcription } from '../components';
|
|
21
|
+
import { type SerializationModel } from '../model';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Story wrapper that renders a transcript with playback controls, an optional audio file
|
|
25
|
+
* upload affordance, and a toolbar slot for additional controls.
|
|
26
|
+
*
|
|
27
|
+
* @param onUpload - Callback fired when the user picks a local audio file via the upload button.
|
|
28
|
+
* @param uploadAccept - HTML `accept` filter for the hidden file input. Defaults to `audio/*`.
|
|
29
|
+
* @param toolbarSlot - Extra content rendered after the upload button inside the toolbar.
|
|
30
|
+
*/
|
|
31
|
+
export const TranscriptionStory: FC<{
|
|
32
|
+
model: SerializationModel<Message.Message>;
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
running: boolean;
|
|
35
|
+
onRunningChange: Dispatch<SetStateAction<boolean>>;
|
|
36
|
+
audioRef?: RefObject<HTMLAudioElement | null>;
|
|
37
|
+
onUpload?: (file: File) => void;
|
|
38
|
+
uploadAccept?: string;
|
|
39
|
+
toolbarSlot?: ReactNode;
|
|
40
|
+
}> = ({ model, running, onRunningChange, audioRef, disabled, onUpload, uploadAccept = 'audio/*', toolbarSlot }) => {
|
|
41
|
+
const fileInputRef = useRef<HTMLInputElement>(null);
|
|
42
|
+
|
|
43
|
+
const handleFileChange = (event: ChangeEvent<HTMLInputElement>) => {
|
|
44
|
+
const file = event.target.files?.[0];
|
|
45
|
+
if (file && onUpload) {
|
|
46
|
+
onUpload(file);
|
|
47
|
+
}
|
|
48
|
+
// Reset so the same file can be re-selected.
|
|
49
|
+
event.target.value = '';
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
{audioRef && <audio ref={audioRef} autoPlay />}
|
|
55
|
+
<Toolbar.Root>
|
|
56
|
+
<IconButton
|
|
57
|
+
iconOnly
|
|
58
|
+
disabled={disabled}
|
|
59
|
+
icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
|
|
60
|
+
label={running ? 'Pause' : 'Play'}
|
|
61
|
+
onClick={() => onRunningChange((running) => !running)}
|
|
62
|
+
/>
|
|
63
|
+
{onUpload && (
|
|
64
|
+
<>
|
|
65
|
+
<input
|
|
66
|
+
ref={fileInputRef}
|
|
67
|
+
type='file'
|
|
68
|
+
accept={uploadAccept}
|
|
69
|
+
disabled={disabled}
|
|
70
|
+
className='hidden'
|
|
71
|
+
onChange={handleFileChange}
|
|
72
|
+
/>
|
|
73
|
+
<IconButton
|
|
74
|
+
iconOnly
|
|
75
|
+
disabled={disabled}
|
|
76
|
+
icon='ph--upload--regular'
|
|
77
|
+
label='Upload audio'
|
|
78
|
+
onClick={() => fileInputRef.current?.click()}
|
|
79
|
+
/>
|
|
80
|
+
</>
|
|
81
|
+
)}
|
|
82
|
+
{toolbarSlot}
|
|
83
|
+
</Toolbar.Root>
|
|
84
|
+
<ScrollContainer.Root pin>
|
|
85
|
+
<ScrollContainer.Content>
|
|
86
|
+
<ScrollContainer.Viewport>
|
|
87
|
+
<Transcription model={model} />
|
|
88
|
+
</ScrollContainer.Viewport>
|
|
89
|
+
</ScrollContainer.Content>
|
|
90
|
+
</ScrollContainer.Root>
|
|
91
|
+
</>
|
|
92
|
+
);
|
|
93
|
+
};
|
package/src/testing/testing.ts
CHANGED
|
@@ -2,24 +2,22 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import
|
|
5
|
+
import * as Schema from 'effect/Schema';
|
|
6
6
|
import { useEffect, useMemo, useState } from 'react';
|
|
7
7
|
|
|
8
|
-
import {
|
|
9
|
-
import { AI_SERVICE_ENDPOINT } from '@dxos/ai/testing';
|
|
10
|
-
import { extractionAnthropicFn, processTranscriptMessage } from '@dxos/assistant';
|
|
8
|
+
import { extractionAnthropicFunction, processTranscriptMessage } from '@dxos/assistant/extraction';
|
|
11
9
|
import { scheduleTaskInterval } from '@dxos/async';
|
|
12
10
|
import { Filter, type Queue } from '@dxos/client/echo';
|
|
13
11
|
import { Context } from '@dxos/context';
|
|
14
12
|
import { type Key, Obj, Ref, Type } from '@dxos/echo';
|
|
15
|
-
import { createQueueDXN } from '@dxos/echo
|
|
16
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions';
|
|
13
|
+
import { createQueueDXN } from '@dxos/echo/internal';
|
|
17
14
|
import { IdentityDid } from '@dxos/keys';
|
|
18
15
|
import { log } from '@dxos/log';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
16
|
+
import { random } from '@dxos/random';
|
|
17
|
+
import { type Space, useQueue } from '@dxos/react-client/echo';
|
|
18
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
19
|
+
import { type ContentBlock, Message, Organization, Person } from '@dxos/types';
|
|
20
|
+
import { seedTestData } from '@dxos/types/testing';
|
|
23
21
|
|
|
24
22
|
// TODO(burdon): Reconcile with plugin-markdown. Move to @dxos/schema/testing.
|
|
25
23
|
export const TestItem = Schema.Struct({
|
|
@@ -32,15 +30,15 @@ export const TestItem = Schema.Struct({
|
|
|
32
30
|
description: 'Product description',
|
|
33
31
|
}),
|
|
34
32
|
}).pipe(
|
|
35
|
-
Type.
|
|
36
|
-
typename: 'dxos.
|
|
33
|
+
Type.object({
|
|
34
|
+
typename: 'org.dxos.type.test',
|
|
37
35
|
version: '0.1.0',
|
|
38
36
|
}),
|
|
39
37
|
);
|
|
40
38
|
|
|
41
39
|
// TODO(wittjosiah): Make builder generic and reuse for all message types.
|
|
42
40
|
abstract class AbstractMessageBuilder {
|
|
43
|
-
abstract createMessage(numSegments?: number): Promise<
|
|
41
|
+
abstract createMessage(numSegments?: number): Promise<Message.Message>;
|
|
44
42
|
}
|
|
45
43
|
|
|
46
44
|
/**
|
|
@@ -51,8 +49,8 @@ export class MessageBuilder extends AbstractMessageBuilder {
|
|
|
51
49
|
|
|
52
50
|
users = Array.from({ length: 5 }, () => ({
|
|
53
51
|
identityDid: IdentityDid.random().toString(),
|
|
54
|
-
name:
|
|
55
|
-
email:
|
|
52
|
+
name: random.person.fullName(),
|
|
53
|
+
email: random.internet.email(),
|
|
56
54
|
}));
|
|
57
55
|
|
|
58
56
|
start = new Date(Date.now() - 24 * 60 * 60 * 10_000);
|
|
@@ -61,27 +59,32 @@ export class MessageBuilder extends AbstractMessageBuilder {
|
|
|
61
59
|
super();
|
|
62
60
|
}
|
|
63
61
|
|
|
64
|
-
override async createMessage(numSegments = 1): Promise<
|
|
65
|
-
return Obj.make(
|
|
62
|
+
override async createMessage(numSegments = 1): Promise<Message.Message> {
|
|
63
|
+
return Obj.make(Message.Message, {
|
|
66
64
|
created: this.next().toISOString(),
|
|
67
|
-
sender:
|
|
65
|
+
sender: random.helpers.arrayElement(this.users),
|
|
68
66
|
blocks: Array.from({ length: numSegments }).map(() => this.createBlock()),
|
|
69
67
|
});
|
|
70
68
|
}
|
|
71
69
|
|
|
72
|
-
createBlock():
|
|
73
|
-
let text =
|
|
70
|
+
createBlock(): ContentBlock.Transcript {
|
|
71
|
+
let text = random.lorem.paragraph();
|
|
74
72
|
if (this._space) {
|
|
75
|
-
const label =
|
|
76
|
-
const obj = this._space.db.add(
|
|
73
|
+
const label = random.commerce.productName();
|
|
74
|
+
const obj = this._space.db.add(
|
|
75
|
+
Obj.make(TestItem, {
|
|
76
|
+
title: label,
|
|
77
|
+
description: random.lorem.paragraph(),
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
77
80
|
const dxn = Ref.make(obj).dxn.toString();
|
|
78
81
|
const words = text.split(' ');
|
|
79
|
-
words.splice(Math.floor(Math.random() * words.length), 0, `[${label}]
|
|
82
|
+
words.splice(Math.floor(Math.random() * words.length), 0, `[${label}](${dxn})`);
|
|
80
83
|
text = words.join(' ');
|
|
81
84
|
}
|
|
82
85
|
|
|
83
86
|
return {
|
|
84
|
-
|
|
87
|
+
_tag: 'transcript',
|
|
85
88
|
started: this.next().toISOString(),
|
|
86
89
|
text,
|
|
87
90
|
};
|
|
@@ -95,15 +98,9 @@ export class MessageBuilder extends AbstractMessageBuilder {
|
|
|
95
98
|
|
|
96
99
|
// TODO(burdon): Reconcile with BlockBuilder.
|
|
97
100
|
class EntityExtractionMessageBuilder extends AbstractMessageBuilder {
|
|
98
|
-
AiService = new EdgeAiServiceClient({
|
|
99
|
-
endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
100
|
-
});
|
|
101
|
-
|
|
102
|
-
executor = new FunctionExecutor(new ServiceContainer().setServices({ ai: { client: this.AiService } }));
|
|
103
|
-
|
|
104
101
|
space: Space | undefined;
|
|
105
102
|
currentMessage: number = 0;
|
|
106
|
-
transcriptMessages:
|
|
103
|
+
transcriptMessages: Message.Message[] = [];
|
|
107
104
|
|
|
108
105
|
async connect(space: Space): Promise<void> {
|
|
109
106
|
this.space = space;
|
|
@@ -111,14 +108,18 @@ class EntityExtractionMessageBuilder extends AbstractMessageBuilder {
|
|
|
111
108
|
this.transcriptMessages = transcriptMessages;
|
|
112
109
|
}
|
|
113
110
|
|
|
114
|
-
override async createMessage(): Promise<
|
|
111
|
+
override async createMessage(): Promise<Message.Message> {
|
|
115
112
|
if (!this.space) {
|
|
116
113
|
throw new Error('Space not connected');
|
|
117
114
|
}
|
|
118
115
|
|
|
119
|
-
const
|
|
116
|
+
const objects = await this.space.db
|
|
120
117
|
.query(
|
|
121
|
-
Filter.or(
|
|
118
|
+
Filter.or(
|
|
119
|
+
Filter.type(Person.Person),
|
|
120
|
+
Filter.type(Organization.Organization),
|
|
121
|
+
Filter.type(TestSchema.DocumentType),
|
|
122
|
+
),
|
|
122
123
|
)
|
|
123
124
|
.run();
|
|
124
125
|
|
|
@@ -129,8 +130,7 @@ class EntityExtractionMessageBuilder extends AbstractMessageBuilder {
|
|
|
129
130
|
|
|
130
131
|
const { message: enhancedMessage } = await processTranscriptMessage({
|
|
131
132
|
input: { message },
|
|
132
|
-
|
|
133
|
-
function: extractionAnthropicFn,
|
|
133
|
+
function: extractionAnthropicFunction,
|
|
134
134
|
});
|
|
135
135
|
|
|
136
136
|
return enhancedMessage;
|
|
@@ -142,7 +142,7 @@ type UseTestTranscriptionQueue = (
|
|
|
142
142
|
queueId?: Key.ObjectId,
|
|
143
143
|
running?: boolean,
|
|
144
144
|
interval?: number,
|
|
145
|
-
) => Queue<
|
|
145
|
+
) => Queue<Message.Message> | undefined;
|
|
146
146
|
|
|
147
147
|
/**
|
|
148
148
|
* Test transcriptionqueue.
|
|
@@ -155,7 +155,7 @@ export const useTestTranscriptionQueue: UseTestTranscriptionQueue = (
|
|
|
155
155
|
) => {
|
|
156
156
|
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
157
157
|
const queueDxn = useMemo(() => (space ? createQueueDXN(space.id, queueId) : undefined), [space, queueId]);
|
|
158
|
-
const queue = useQueue<
|
|
158
|
+
const queue = useQueue<Message.Message>(queueDxn);
|
|
159
159
|
const builder = useMemo(() => new MessageBuilder(space), [space]);
|
|
160
160
|
|
|
161
161
|
useEffect(() => {
|
|
@@ -165,7 +165,7 @@ export const useTestTranscriptionQueue: UseTestTranscriptionQueue = (
|
|
|
165
165
|
|
|
166
166
|
const i = setInterval(() => {
|
|
167
167
|
void builder.createMessage(Math.ceil(Math.random() * 3)).then(async (message) => {
|
|
168
|
-
await queue.append([Obj.make(
|
|
168
|
+
await queue.append([Obj.make(Message.Message, message)]);
|
|
169
169
|
});
|
|
170
170
|
}, interval);
|
|
171
171
|
return () => clearInterval(i);
|
|
@@ -186,7 +186,7 @@ export const useTestTranscriptionQueueWithEntityExtraction: UseTestTranscription
|
|
|
186
186
|
) => {
|
|
187
187
|
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
188
188
|
const queueDxn = useMemo(() => (space ? createQueueDXN(space.id, queueId) : undefined), [space, queueId]);
|
|
189
|
-
const queue = useQueue<
|
|
189
|
+
const queue = useQueue<Message.Message>(queueDxn);
|
|
190
190
|
const [builder] = useState(() => new EntityExtractionMessageBuilder());
|
|
191
191
|
|
|
192
192
|
useEffect(() => {
|
|
@@ -203,7 +203,7 @@ export const useTestTranscriptionQueueWithEntityExtraction: UseTestTranscription
|
|
|
203
203
|
ctx,
|
|
204
204
|
async () => {
|
|
205
205
|
const message = await builder.createMessage();
|
|
206
|
-
void queue.append([Obj.make(
|
|
206
|
+
void queue.append([Obj.make(Message.Message, message)]);
|
|
207
207
|
},
|
|
208
208
|
interval,
|
|
209
209
|
);
|
|
@@ -10,7 +10,7 @@ import { invariant } from '@dxos/invariant';
|
|
|
10
10
|
import { log } from '@dxos/log';
|
|
11
11
|
import { trace } from '@dxos/tracing';
|
|
12
12
|
|
|
13
|
-
import { type
|
|
13
|
+
import { type AudioChunk, type AudioRecorder, type WavConfig } from './audio-recorder';
|
|
14
14
|
|
|
15
15
|
let initializingPromise: Promise<void> | undefined;
|
|
16
16
|
|
|
@@ -19,7 +19,7 @@ const initializeExtendableMediaRecorder = async () => {
|
|
|
19
19
|
await register(await connect());
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export type
|
|
22
|
+
export type MediaStreamRecorderProps = {
|
|
23
23
|
mediaStreamTrack: MediaStreamTrack;
|
|
24
24
|
config: {
|
|
25
25
|
interval: number;
|
|
@@ -37,12 +37,12 @@ export class MediaStreamRecorder implements AudioRecorder {
|
|
|
37
37
|
/**
|
|
38
38
|
* Default MediaRecorder implementation do not support wav encoding.
|
|
39
39
|
*/
|
|
40
|
-
private readonly _config:
|
|
40
|
+
private readonly _config: MediaStreamRecorderProps['config'];
|
|
41
41
|
private _mediaRecorder?: IMediaRecorder = undefined;
|
|
42
42
|
private _header?: Uint8Array = undefined;
|
|
43
43
|
private _onChunk?: (chunk: AudioChunk) => void;
|
|
44
44
|
|
|
45
|
-
constructor({ mediaStreamTrack, config }:
|
|
45
|
+
constructor({ mediaStreamTrack, config }: MediaStreamRecorderProps) {
|
|
46
46
|
this._mediaStreamTrack = mediaStreamTrack;
|
|
47
47
|
this._config = config;
|
|
48
48
|
}
|
|
@@ -9,9 +9,9 @@ import { WaveFile } from 'wavefile';
|
|
|
9
9
|
|
|
10
10
|
import { Trigger } from '@dxos/async';
|
|
11
11
|
import { log } from '@dxos/log';
|
|
12
|
-
import { type DataType } from '@dxos/schema';
|
|
13
12
|
import { openAndClose } from '@dxos/test-utils';
|
|
14
|
-
import {
|
|
13
|
+
import { TRACE_PROCESSOR, trace } from '@dxos/tracing';
|
|
14
|
+
import { type ContentBlock } from '@dxos/types';
|
|
15
15
|
|
|
16
16
|
import { type AudioChunk, type AudioRecorder, Transcriber } from '../transcriber';
|
|
17
17
|
import { mergeFloat64Arrays } from '../util';
|
|
@@ -93,7 +93,7 @@ describe.skip('Transcriber', () => {
|
|
|
93
93
|
});
|
|
94
94
|
|
|
95
95
|
test.skip('transcription of audio recording', { timeout: 10_000 }, async () => {
|
|
96
|
-
const trigger = new Trigger<
|
|
96
|
+
const trigger = new Trigger<ContentBlock.Transcript[]>({ autoReset: true });
|
|
97
97
|
const recorder = new MockAudioRecorder({
|
|
98
98
|
buffer: await readFile('test.wav'),
|
|
99
99
|
chunkDuration: 3_000,
|
|
@@ -127,7 +127,7 @@ describe.skip('Transcriber', () => {
|
|
|
127
127
|
});
|
|
128
128
|
|
|
129
129
|
test.skip('transcription of audio recording with overlapping chunks', { timeout: 20_000 }, async () => {
|
|
130
|
-
const trigger = new Trigger<
|
|
130
|
+
const trigger = new Trigger<ContentBlock.Transcript[]>({ autoReset: true });
|
|
131
131
|
const recorder = new MockAudioRecorder({
|
|
132
132
|
buffer: await readFile('test.wav'),
|
|
133
133
|
chunkDuration: 3_000,
|
|
@@ -212,7 +212,7 @@ class MockAudioRecorder implements AudioRecorder {
|
|
|
212
212
|
|
|
213
213
|
@trace.span()
|
|
214
214
|
async start(): Promise<void> {
|
|
215
|
-
log.info('start mock audio recorder', {
|
|
215
|
+
log.info('start mock audio recorder', { wavProps: this.wav.fmt });
|
|
216
216
|
const now = Date.now();
|
|
217
217
|
const samples = this.wav.getSamples();
|
|
218
218
|
const sampleRate = this.wavConfig.sampleRate;
|