@dxos/plugin-transcription 0.8.4-main.c85a9c8dae → 0.8.4-main.d9fc60f731
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/LICENSE +102 -5
- package/PLUGIN.mdl +401 -0
- package/README.md +1 -1
- package/dist/lib/neutral/TranscriptionArticle-L6XANBH5.mjs +54 -0
- package/dist/lib/neutral/TranscriptionArticle-L6XANBH5.mjs.map +7 -0
- package/dist/lib/neutral/TranscriptionPlugin.mjs +46 -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/TranscriptionPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/TranscriptionPlugin.workerd.mjs.map +7 -0
- package/dist/lib/{browser/blueprint-definition-C6XA2SVZ.mjs → neutral/blueprint-definition-HOXDG5QP.mjs} +4 -7
- package/dist/lib/neutral/blueprint-definition-HOXDG5QP.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/blueprints/index.mjs +1 -2
- package/dist/lib/neutral/capabilities/index.mjs +17 -0
- package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
- package/dist/lib/neutral/chunk-2O3ONPRZ.mjs +298 -0
- package/dist/lib/neutral/chunk-2O3ONPRZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-FHNI26QW.mjs +45 -0
- package/dist/lib/neutral/chunk-FHNI26QW.mjs.map +7 -0
- package/dist/lib/{browser/chunk-EV5ZYKET.mjs → neutral/chunk-ILSA3DU7.mjs} +87 -112
- package/dist/lib/neutral/chunk-ILSA3DU7.mjs.map +7 -0
- package/dist/lib/{browser/chunk-HOOPZ7EM.mjs → neutral/chunk-KAEXRX3Y.mjs} +1 -1
- package/dist/lib/neutral/chunk-KVUT2KYT.mjs +124 -0
- package/dist/lib/neutral/chunk-KVUT2KYT.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-Y4YI44ZD.mjs +8 -0
- package/dist/lib/neutral/chunk-Y4YI44ZD.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 +273 -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-VWFMMAUY.mjs +21 -0
- package/dist/lib/neutral/create-VWFMMAUY.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +19 -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/open-V772IQYW.mjs +27 -0
- package/dist/lib/neutral/open-V772IQYW.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/plugin.mjs +16 -0
- package/dist/lib/neutral/plugin.mjs.map +7 -0
- package/dist/lib/neutral/react-surface-YMZRO242.mjs +26 -0
- package/dist/lib/neutral/react-surface-YMZRO242.mjs.map +7 -0
- package/dist/lib/neutral/summarize-6PDRGTKE.mjs +78 -0
- package/dist/lib/neutral/summarize-6PDRGTKE.mjs.map +7 -0
- package/dist/lib/neutral/text-content-KBB37HSM.mjs +30 -0
- package/dist/lib/neutral/text-content-KBB37HSM.mjs.map +7 -0
- package/dist/lib/{browser/transcriber-WCPHHJYY.mjs → neutral/transcriber-ABHATBVH.mjs} +8 -10
- package/dist/lib/neutral/transcriber-ABHATBVH.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +24 -0
- package/dist/lib/neutral/translations.mjs.map +7 -0
- package/dist/lib/neutral/types/index.mjs +10 -0
- package/dist/lib/neutral/types/index.mjs.map +7 -0
- package/dist/types/src/TranscriptionPlugin.d.ts +1 -0
- 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/TranscriptionPlugin.workerd.d.ts +4 -0
- package/dist/types/src/TranscriptionPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +2 -2
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -1
- 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.map +1 -0
- 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/transcriber.d.ts → transcriber.d.ts} +1 -1
- package/dist/types/src/capabilities/transcriber.d.ts.map +1 -0
- package/dist/types/src/components/Oracle/Oracle.d.ts +24 -0
- package/dist/types/src/components/Oracle/Oracle.d.ts.map +1 -0
- package/dist/types/src/components/Oracle/Oracle.stories.d.ts +32 -0
- package/dist/types/src/components/Oracle/Oracle.stories.d.ts.map +1 -0
- package/dist/types/src/components/Oracle/index.d.ts +2 -0
- package/dist/types/src/components/Oracle/index.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/Transcription.d.ts +5 -9
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -1
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +21 -24
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -1
- package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.d.ts +6 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.stories.d.ts +28 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionArticle/index.d.ts +2 -0
- package/dist/types/src/containers/TranscriptionArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/enrichment/conversation.test.d.ts +2 -0
- package/dist/types/src/enrichment/conversation.test.d.ts.map +1 -0
- package/dist/types/src/enrichment/operations.d.ts +200 -0
- package/dist/types/src/enrichment/operations.d.ts.map +1 -0
- package/dist/types/src/enrichment/parser.d.ts +26 -0
- package/dist/types/src/enrichment/parser.d.ts.map +1 -0
- package/dist/types/src/enrichment/stream-simulator.d.ts +38 -0
- package/dist/types/src/enrichment/stream-simulator.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- 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/useFeedModelAdapter.d.ts +12 -0
- package/dist/types/src/hooks/useFeedModelAdapter.d.ts.map +1 -0
- 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/useTranscriptionRecording.d.ts +12 -0
- package/dist/types/src/hooks/useTranscriptionRecording.d.ts.map +1 -0
- 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 +1 -1
- 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 +7 -5
- package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -0
- package/dist/types/src/normalization/normalization.d.ts +834 -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.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 +20 -0
- package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/{components/stories → stories}/KeyWordRecognition.stories.d.ts +2 -2
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
- package/dist/types/src/{components/stories/MicrophoneTranscription.stories.d.ts → stories/LiveTranscription.stories.d.ts} +7 -7
- package/dist/types/src/stories/LiveTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts +21 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -0
- package/dist/types/src/stories/common.d.ts +248 -0
- package/dist/types/src/stories/common.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +5 -6
- 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.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +58 -3
- 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 +6 -4
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +9 -8
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/TranscriptOperation.d.ts +1670 -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/index.d.ts +2 -4
- 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/monitor-audio-level.d.ts.map +1 -1
- package/dist/types/src/util/render-byline.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +140 -86
- package/src/TranscriptionPlugin.node.ts +20 -0
- package/src/TranscriptionPlugin.test.ts +31 -0
- package/src/TranscriptionPlugin.tsx +14 -29
- package/src/TranscriptionPlugin.workerd.ts +18 -0
- package/src/blueprints/transcription-blueprint.ts +5 -9
- package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
- package/src/capabilities/index.ts +12 -4
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +31 -0
- package/src/capabilities/text-content.ts +33 -0
- package/src/capabilities/{transcriber/transcriber.ts → transcriber.ts} +5 -2
- package/src/components/Oracle/Oracle.stories.tsx +147 -0
- package/src/components/Oracle/Oracle.tsx +142 -0
- package/src/components/Oracle/index.ts +5 -0
- package/src/components/Transcription/Transcription.stories.tsx +125 -158
- package/src/components/Transcription/Transcription.tsx +33 -38
- package/src/components/index.ts +1 -0
- package/src/containers/TranscriptionArticle/TranscriptionArticle.stories.tsx +61 -0
- package/src/containers/TranscriptionArticle/TranscriptionArticle.tsx +62 -0
- package/src/containers/TranscriptionArticle/index.ts +5 -0
- package/src/containers/index.ts +1 -1
- package/src/enrichment/conversation.test.ts +162 -0
- package/src/enrichment/conversation.txt +23 -0
- package/src/enrichment/operations.ts +271 -0
- package/src/enrichment/parser.ts +101 -0
- package/src/enrichment/stream-simulator.ts +125 -0
- package/src/hooks/index.ts +2 -1
- package/src/hooks/useFeedModelAdapter.ts +46 -0
- package/src/hooks/useTranscriber.ts +5 -2
- package/src/hooks/useTranscriptionRecording.ts +87 -0
- package/src/hooks/useVoiceInput.ts +0 -1
- package/src/index.ts +4 -5
- package/src/meta.ts +28 -6
- package/src/model/model.test.ts +8 -8
- package/src/model/model.ts +3 -3
- package/src/{segments-normalization → normalization}/message-normalizer.ts +25 -17
- package/src/{segments-normalization → normalization}/normalization.test.ts +3 -37
- package/src/normalization/normalization.ts +76 -0
- 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 +143 -0
- package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +38 -38
- package/src/stories/LiveTranscription.stories.tsx +153 -0
- package/src/stories/TranscriptionStory.tsx +101 -0
- package/src/stories/common.ts +233 -0
- package/src/testing/testing.ts +29 -51
- package/src/transcriber/index.ts +1 -1
- package/src/transcriber/transcriber.browser.test.ts +0 -1
- package/src/transcriber/transcriber.test.ts +104 -0
- package/src/transcriber/transcriber.ts +100 -55
- package/src/transcriber/transcription-manager.ts +14 -9
- package/src/translations.ts +10 -7
- package/src/types/TranscriptOperation.ts +106 -0
- package/src/types/TranscriptionCapabilities.ts +39 -0
- package/src/types/index.ts +2 -4
- package/src/vite-env.d.ts +10 -0
- package/dist/lib/browser/TranscriptionContainer-RBFHP2AV.mjs +0 -41
- package/dist/lib/browser/TranscriptionContainer-RBFHP2AV.mjs.map +0 -7
- package/dist/lib/browser/blueprint-definition-C6XA2SVZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-2B74LZZD.mjs +0 -22
- package/dist/lib/browser/chunk-2B74LZZD.mjs.map +0 -7
- package/dist/lib/browser/chunk-EV5ZYKET.mjs.map +0 -7
- package/dist/lib/browser/chunk-GH4IIQ6C.mjs +0 -54
- package/dist/lib/browser/chunk-GH4IIQ6C.mjs.map +0 -7
- package/dist/lib/browser/chunk-O7ILGNBZ.mjs +0 -148
- package/dist/lib/browser/chunk-O7ILGNBZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-XLMRCOQN.mjs +0 -668
- package/dist/lib/browser/chunk-XLMRCOQN.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -114
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/operation-resolver-5BLRH4XE.mjs +0 -23
- package/dist/lib/browser/operation-resolver-5BLRH4XE.mjs.map +0 -7
- package/dist/lib/browser/react-surface-U2SI74JK.mjs +0 -36
- package/dist/lib/browser/react-surface-U2SI74JK.mjs.map +0 -7
- package/dist/lib/browser/transcriber-WCPHHJYY.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -15
- package/dist/lib/node-esm/TranscriptionContainer-3OOID5KH.mjs +0 -42
- package/dist/lib/node-esm/TranscriptionContainer-3OOID5KH.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-TLXDUXIQ.mjs +0 -19
- package/dist/lib/node-esm/blueprint-definition-TLXDUXIQ.mjs.map +0 -7
- package/dist/lib/node-esm/blueprints/index.mjs +0 -10
- package/dist/lib/node-esm/chunk-6GW5NZYG.mjs +0 -55
- package/dist/lib/node-esm/chunk-6GW5NZYG.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7UE7G6DE.mjs +0 -461
- package/dist/lib/node-esm/chunk-7UE7G6DE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-DYUGYQCB.mjs +0 -669
- package/dist/lib/node-esm/chunk-DYUGYQCB.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-F47HK7GT.mjs +0 -24
- package/dist/lib/node-esm/chunk-F47HK7GT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-H3MXHMQL.mjs +0 -149
- package/dist/lib/node-esm/chunk-H3MXHMQL.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-NVM2QUMX.mjs +0 -37
- package/dist/lib/node-esm/chunk-NVM2QUMX.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -115
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/operation-resolver-CVZB7BF4.mjs +0 -24
- package/dist/lib/node-esm/operation-resolver-CVZB7BF4.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-2ICJPBPX.mjs +0 -37
- package/dist/lib/node-esm/react-surface-2ICJPBPX.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-2RIHUEX4.mjs +0 -62
- package/dist/lib/node-esm/transcriber-2RIHUEX4.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -16
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +0 -5
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/transcriber/index.d.ts +0 -3
- package/dist/types/src/capabilities/transcriber/index.d.ts.map +0 -1
- package/dist/types/src/capabilities/transcriber/transcriber.d.ts.map +0 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +0 -18
- 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 +0 -3
- package/dist/types/src/components/stories/useIsSpeaking.d.ts.map +0 -1
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +0 -6
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +0 -1
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts +0 -3
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -18
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts +0 -11
- 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/hooks/useQueueModelAdapter.d.ts +0 -8
- package/dist/types/src/hooks/useQueueModelAdapter.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 -534
- 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.map +0 -1
- package/dist/types/src/types/TranscriptAction.d.ts +0 -25
- package/dist/types/src/types/TranscriptAction.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -18
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -5
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/blueprint-definition/index.ts +0 -7
- package/src/capabilities/operation-handler/index.ts +0 -7
- package/src/capabilities/operation-handler/operation-handler.ts +0 -25
- package/src/capabilities/operation-resolver/index.ts +0 -7
- package/src/capabilities/operation-resolver/operation-resolver.ts +0 -25
- package/src/capabilities/react-surface/index.ts +0 -7
- package/src/capabilities/react-surface/react-surface.tsx +0 -28
- package/src/capabilities/transcriber/index.ts +0 -7
- package/src/components/stories/FileTranscription.stories.tsx +0 -252
- package/src/components/stories/MicrophoneTranscription.stories.tsx +0 -282
- package/src/components/stories/TranscriptionStory.tsx +0 -41
- package/src/components/stories/useIsSpeaking.tsx +0 -40
- package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +0 -33
- package/src/containers/TranscriptionContainer/index.ts +0 -7
- package/src/functions/index.ts +0 -11
- package/src/functions/open.ts +0 -37
- package/src/functions/summarize.ts +0 -103
- package/src/hooks/useQueueModelAdapter.ts +0 -66
- package/src/segments-normalization/normalization.ts +0 -115
- package/src/types/TranscriptAction.ts +0 -32
- package/src/types/capabilities.ts +0 -33
- package/src/types/types.ts +0 -9
- package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
- package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- package/dist/lib/{browser/chunk-HOOPZ7EM.mjs.map → neutral/chunk-KAEXRX3Y.mjs.map} +0 -0
- package/dist/lib/{browser/types → neutral/hooks}/index.mjs.map +0 -0
- package/dist/lib/{node-esm/blueprints → neutral}/index.mjs.map +0 -0
- package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
- package/dist/lib/{node-esm/types → neutral/operations}/index.mjs.map +0 -0
- package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
- package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
- package/dist/types/src/{segments-normalization → normalization}/utils.d.ts +0 -0
- package/src/{segments-normalization → normalization}/index.ts +1 -1
- /package/src/{segments-normalization → normalization}/utils.ts +0 -0
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
|
|
7
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
8
|
-
import { OperationResolver } from '@dxos/operation';
|
|
9
|
-
import { Transcript } from '@dxos/types';
|
|
10
|
-
|
|
11
|
-
import { TranscriptOperation } from '../../types';
|
|
12
|
-
|
|
13
|
-
export default Capability.makeModule(() =>
|
|
14
|
-
Effect.succeed(
|
|
15
|
-
Capability.contributes(Capabilities.OperationResolver, [
|
|
16
|
-
OperationResolver.make({
|
|
17
|
-
operation: TranscriptOperation.Create,
|
|
18
|
-
handler: ({ space }) =>
|
|
19
|
-
Effect.succeed({
|
|
20
|
-
object: Transcript.make(space.queues.create().dxn),
|
|
21
|
-
}),
|
|
22
|
-
}),
|
|
23
|
-
]),
|
|
24
|
-
),
|
|
25
|
-
);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import * as Effect from 'effect/Effect';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
|
|
8
|
-
import { Capabilities, Capability } from '@dxos/app-framework';
|
|
9
|
-
import { Surface } from '@dxos/app-framework/ui';
|
|
10
|
-
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { Transcript } from '@dxos/types';
|
|
12
|
-
|
|
13
|
-
import { TranscriptionContainer } from '../../containers';
|
|
14
|
-
import { meta } from '../../meta';
|
|
15
|
-
|
|
16
|
-
export default Capability.makeModule(() =>
|
|
17
|
-
Effect.succeed(
|
|
18
|
-
Capability.contributes(Capabilities.ReactSurface, [
|
|
19
|
-
Surface.create({
|
|
20
|
-
id: `${meta.id}/article/transcript`,
|
|
21
|
-
role: ['article', 'section'],
|
|
22
|
-
filter: (data): data is { subject: Transcript.Transcript } =>
|
|
23
|
-
Obj.instanceOf(Transcript.Transcript, data.subject),
|
|
24
|
-
component: ({ data, role }) => <TranscriptionContainer role={role} subject={data.subject} />,
|
|
25
|
-
}),
|
|
26
|
-
]),
|
|
27
|
-
),
|
|
28
|
-
);
|
|
@@ -1,252 +0,0 @@
|
|
|
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, useRef, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
-
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
11
|
-
import { scheduleTask } from '@dxos/async';
|
|
12
|
-
import { Context } from '@dxos/context';
|
|
13
|
-
import { Obj } from '@dxos/echo';
|
|
14
|
-
import { createQueueDXN } from '@dxos/echo/internal';
|
|
15
|
-
import { MemoryQueue } from '@dxos/echo-db';
|
|
16
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
17
|
-
import { log } from '@dxos/log';
|
|
18
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
19
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
20
|
-
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
21
|
-
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
22
|
-
import { TestSchema } from '@dxos/schema/testing';
|
|
23
|
-
import { type Actor, Message, Organization, Person } from '@dxos/types';
|
|
24
|
-
import { seedTestData } from '@dxos/types/testing';
|
|
25
|
-
|
|
26
|
-
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '../../hooks';
|
|
27
|
-
import { MessageNormalizer, getActorId } from '../../segments-normalization';
|
|
28
|
-
import { TestItem } from '../../testing';
|
|
29
|
-
import { type MediaStreamRecorderProps, type TranscriberProps } from '../../transcriber';
|
|
30
|
-
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
31
|
-
import { renderByline } from '../../util';
|
|
32
|
-
|
|
33
|
-
import { TranscriptionStory } from './TranscriptionStory';
|
|
34
|
-
import { useIsSpeaking } from './useIsSpeaking';
|
|
35
|
-
|
|
36
|
-
const AudioFile = ({
|
|
37
|
-
detectSpeaking,
|
|
38
|
-
audioUrl,
|
|
39
|
-
normalizeSentences,
|
|
40
|
-
transcriberConfig,
|
|
41
|
-
recorderConfig,
|
|
42
|
-
audioConstraints,
|
|
43
|
-
}: {
|
|
44
|
-
detectSpeaking?: boolean;
|
|
45
|
-
normalizeSentences?: boolean;
|
|
46
|
-
audioUrl: string;
|
|
47
|
-
transcriberConfig?: TranscriberProps['config'];
|
|
48
|
-
recorderConfig?: MediaStreamRecorderProps['config'];
|
|
49
|
-
audioConstraints?: MediaTrackConstraints;
|
|
50
|
-
}) => {
|
|
51
|
-
const [running, setRunning] = useState(false);
|
|
52
|
-
const actor: Actor.Actor = useMemo(() => ({ name: 'You' }), []);
|
|
53
|
-
|
|
54
|
-
// Audio.
|
|
55
|
-
const { audio, track, stream } = useAudioFile(audioUrl, audioConstraints);
|
|
56
|
-
|
|
57
|
-
// Speaking.
|
|
58
|
-
const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
|
|
59
|
-
const ref = useRef<HTMLAudioElement>(null);
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
if (ref.current && stream) {
|
|
62
|
-
ref.current.srcObject = stream;
|
|
63
|
-
}
|
|
64
|
-
}, [stream]);
|
|
65
|
-
|
|
66
|
-
useEffect(() => {
|
|
67
|
-
if (!audio) {
|
|
68
|
-
return;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
if (running) {
|
|
72
|
-
void audio.play();
|
|
73
|
-
} else {
|
|
74
|
-
void audio.pause();
|
|
75
|
-
}
|
|
76
|
-
}, [audio, running]);
|
|
77
|
-
|
|
78
|
-
// Transcriber.
|
|
79
|
-
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
80
|
-
const queueDxn = useMemo(() => createQueueDXN(), []);
|
|
81
|
-
const queue = useMemo(() => new MemoryQueue<Message.Message>(queueDxn), [queueDxn]);
|
|
82
|
-
|
|
83
|
-
const model = useQueueModelAdapter(renderByline([]), queue);
|
|
84
|
-
const handleSegments = useCallback<TranscriberProps['onSegments']>(
|
|
85
|
-
async (blocks) => {
|
|
86
|
-
void queue?.append([
|
|
87
|
-
Obj.make(Message.Message, {
|
|
88
|
-
created: new Date().toISOString(),
|
|
89
|
-
sender: actor,
|
|
90
|
-
blocks,
|
|
91
|
-
}),
|
|
92
|
-
]);
|
|
93
|
-
},
|
|
94
|
-
[queue],
|
|
95
|
-
);
|
|
96
|
-
|
|
97
|
-
const transcriber = useTranscriber({
|
|
98
|
-
audioStreamTrack: track,
|
|
99
|
-
onSegments: handleSegments,
|
|
100
|
-
transcriberConfig,
|
|
101
|
-
recorderConfig,
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
// Normalize sentences.
|
|
105
|
-
const normalizer = useMemo(() => {
|
|
106
|
-
if (!normalizeSentences) {
|
|
107
|
-
return;
|
|
108
|
-
}
|
|
109
|
-
const executor = new FunctionExecutor(
|
|
110
|
-
new ServiceContainer().setServices({
|
|
111
|
-
// ai: {
|
|
112
|
-
// client: new Edge AiServiceClient({
|
|
113
|
-
// endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
114
|
-
// defaultGenerationOptions: {
|
|
115
|
-
// model: '@anthropic/claude-3-5-sonnet-20241022',
|
|
116
|
-
// },
|
|
117
|
-
// }),
|
|
118
|
-
// },
|
|
119
|
-
}),
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
return new MessageNormalizer({
|
|
123
|
-
functionExecutor: executor,
|
|
124
|
-
queue,
|
|
125
|
-
startingCursor: { actorId: getActorId(actor), timestamp: new Date().toISOString() },
|
|
126
|
-
});
|
|
127
|
-
}, [normalizeSentences, queue, actor]);
|
|
128
|
-
|
|
129
|
-
useEffect(() => {
|
|
130
|
-
if (!normalizer) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
const ctx = new Context();
|
|
134
|
-
scheduleTask(ctx, async () => {
|
|
135
|
-
await normalizer.open();
|
|
136
|
-
ctx.onDispose(async () => {
|
|
137
|
-
await normalizer.close();
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
return () => {
|
|
141
|
-
void ctx.dispose();
|
|
142
|
-
};
|
|
143
|
-
}, [normalizer]);
|
|
144
|
-
|
|
145
|
-
const manageChunkRecording = () => {
|
|
146
|
-
if (running && isSpeaking && transcriber) {
|
|
147
|
-
log.info('starting transcription');
|
|
148
|
-
transcriber?.startChunksRecording();
|
|
149
|
-
} else if ((!isSpeaking || !running) && transcriber) {
|
|
150
|
-
log.info('stopping transcription');
|
|
151
|
-
transcriber?.stopChunksRecording();
|
|
152
|
-
}
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
useEffect(() => {
|
|
156
|
-
const ctx = new Context();
|
|
157
|
-
scheduleTask(ctx, async () => {
|
|
158
|
-
if (transcriber && running) {
|
|
159
|
-
await transcriber.open();
|
|
160
|
-
} else if (!running) {
|
|
161
|
-
await transcriber?.close();
|
|
162
|
-
}
|
|
163
|
-
manageChunkRecording();
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
return () => {
|
|
167
|
-
void ctx.dispose();
|
|
168
|
-
};
|
|
169
|
-
}, [transcriber, running]);
|
|
170
|
-
|
|
171
|
-
useEffect(() => {
|
|
172
|
-
manageChunkRecording();
|
|
173
|
-
}, [isSpeaking, stream]);
|
|
174
|
-
|
|
175
|
-
return (
|
|
176
|
-
<TranscriptionStory
|
|
177
|
-
disabled={!stream}
|
|
178
|
-
model={model}
|
|
179
|
-
running={running}
|
|
180
|
-
onRunningChange={setRunning}
|
|
181
|
-
audioRef={ref}
|
|
182
|
-
/>
|
|
183
|
-
);
|
|
184
|
-
};
|
|
185
|
-
|
|
186
|
-
const meta = {
|
|
187
|
-
title: 'plugins/plugin-transcription/components/FileTranscription',
|
|
188
|
-
decorators: [
|
|
189
|
-
withTheme(),
|
|
190
|
-
withLayout({ layout: 'column' }),
|
|
191
|
-
withPluginManager({
|
|
192
|
-
plugins: [
|
|
193
|
-
...corePlugins(),
|
|
194
|
-
StorybookPlugin({}),
|
|
195
|
-
ClientPlugin({
|
|
196
|
-
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
197
|
-
onClientInitialized: ({ client }) =>
|
|
198
|
-
Effect.gen(function* () {
|
|
199
|
-
yield* Effect.promise(() => client.halo.createIdentity());
|
|
200
|
-
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
201
|
-
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
202
|
-
yield* Effect.promise(() => seedTestData(client.spaces.default));
|
|
203
|
-
}),
|
|
204
|
-
}),
|
|
205
|
-
|
|
206
|
-
PreviewPlugin(),
|
|
207
|
-
TranscriptionPlugin(),
|
|
208
|
-
],
|
|
209
|
-
fireEvents: [AppActivationEvents.SetupAppGraph],
|
|
210
|
-
}),
|
|
211
|
-
],
|
|
212
|
-
} satisfies Meta;
|
|
213
|
-
|
|
214
|
-
export default meta;
|
|
215
|
-
|
|
216
|
-
type Story = StoryObj<typeof meta>;
|
|
217
|
-
|
|
218
|
-
const TRANSCRIBER_CONFIG = {
|
|
219
|
-
transcribeAfterChunksAmount: 100,
|
|
220
|
-
prefixBufferChunksAmount: 50,
|
|
221
|
-
normalizeSentences: true,
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
const RECORDER_CONFIG = {
|
|
225
|
-
interval: 200,
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
export const Default: StoryObj<typeof AudioFile> = {
|
|
229
|
-
render: AudioFile,
|
|
230
|
-
args: {
|
|
231
|
-
detectSpeaking: true,
|
|
232
|
-
// https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
|
|
233
|
-
audioUrl: 'https://dxos.network/audio-london.m4a',
|
|
234
|
-
// textUrl: 'https://dxos.network/audio-london.txt',
|
|
235
|
-
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
236
|
-
recorderConfig: RECORDER_CONFIG,
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
// TODO(mykola): Fix sentence normalization.
|
|
241
|
-
// export const WithSentenceNormalization: StoryObj<typeof AudioFile> = {
|
|
242
|
-
// render: AudioFile,
|
|
243
|
-
// args: {
|
|
244
|
-
// detectSpeaking: true,
|
|
245
|
-
// normalizeSentences: true,
|
|
246
|
-
// // https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
|
|
247
|
-
// audioUrl: 'https://dxos.network/audio-london.m4a',
|
|
248
|
-
// // textUrl: 'https://dxos.network/audio-london.txt',
|
|
249
|
-
// transcriberConfig: TRANSCRIBER_CONFIG,
|
|
250
|
-
// recorderConfig: RECORDER_CONFIG,
|
|
251
|
-
// },
|
|
252
|
-
// };
|
|
@@ -1,282 +0,0 @@
|
|
|
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 { createQueueDXN } from '@dxos/echo/internal';
|
|
20
|
-
import { MemoryQueue } from '@dxos/echo-db';
|
|
21
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
22
|
-
import { invariant } from '@dxos/invariant';
|
|
23
|
-
import { log } from '@dxos/log';
|
|
24
|
-
import { ClientPlugin } from '@dxos/plugin-client';
|
|
25
|
-
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
26
|
-
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
27
|
-
import { IndexKind, useSpace } from '@dxos/react-client/echo';
|
|
28
|
-
import { withLayout, withTheme } 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
|
-
import { type MediaStreamRecorderProps, type TranscriberProps } from '../../transcriber';
|
|
36
|
-
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
37
|
-
import { renderByline } from '../../util';
|
|
38
|
-
|
|
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 StoryProps = {
|
|
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
|
-
}: StoryProps) => {
|
|
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 = useSpace();
|
|
80
|
-
|
|
81
|
-
useEffect(() => {
|
|
82
|
-
if (!space) {
|
|
83
|
-
log.warn('no space');
|
|
84
|
-
}
|
|
85
|
-
}, [space]);
|
|
86
|
-
|
|
87
|
-
// Entity extraction.
|
|
88
|
-
const { extractionFunction, executor, objects } = useMemo(() => {
|
|
89
|
-
if (!space) {
|
|
90
|
-
log.warn('no space');
|
|
91
|
-
return {};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
let executor: FunctionExecutor | undefined;
|
|
95
|
-
let extractionFunction: ExtractionFunction | undefined;
|
|
96
|
-
let objects: Promise<Obj.Unknown[]> | undefined;
|
|
97
|
-
|
|
98
|
-
if (entityExtraction === 'ner') {
|
|
99
|
-
// Init model loading. Takes time.
|
|
100
|
-
void getNer();
|
|
101
|
-
extractionFunction = extractionNerFunction;
|
|
102
|
-
} else if (entityExtraction === 'llm') {
|
|
103
|
-
extractionFunction = extractionAnthropicFunction;
|
|
104
|
-
objects = space.db
|
|
105
|
-
.query(
|
|
106
|
-
Filter.or(
|
|
107
|
-
Filter.type(Person.Person),
|
|
108
|
-
Filter.type(Organization.Organization),
|
|
109
|
-
Filter.type(TestSchema.DocumentType),
|
|
110
|
-
),
|
|
111
|
-
)
|
|
112
|
-
.run();
|
|
113
|
-
}
|
|
114
|
-
if (entityExtraction !== 'none') {
|
|
115
|
-
executor = new FunctionExecutor(
|
|
116
|
-
new ServiceContainer().setServices({
|
|
117
|
-
// ai: {
|
|
118
|
-
// client: new Edge AiServiceClient({
|
|
119
|
-
// endpoint: AI_SERVICE_ENDPOINT.REMOTE,
|
|
120
|
-
// }),
|
|
121
|
-
// },
|
|
122
|
-
// database: { db: space!.db },
|
|
123
|
-
}),
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return { extractionFunction, executor, objects };
|
|
128
|
-
}, [entityExtraction, space]);
|
|
129
|
-
|
|
130
|
-
// Transcriber.
|
|
131
|
-
const handleSegments = useCallback<TranscriberProps['onSegments']>(
|
|
132
|
-
async (blocks) => {
|
|
133
|
-
const message = Message.make({
|
|
134
|
-
sender: { name: 'You' },
|
|
135
|
-
created: new Date().toISOString(),
|
|
136
|
-
blocks,
|
|
137
|
-
});
|
|
138
|
-
if (!space) {
|
|
139
|
-
void queue.append([message]);
|
|
140
|
-
return;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
if (entityExtraction !== 'none') {
|
|
144
|
-
invariant(extractionFunction, 'extractionFunction is required');
|
|
145
|
-
invariant(executor, 'executor is required');
|
|
146
|
-
const result = await processTranscriptMessage({
|
|
147
|
-
executor,
|
|
148
|
-
function: extractionFunction,
|
|
149
|
-
input: {
|
|
150
|
-
message,
|
|
151
|
-
objects: await objects,
|
|
152
|
-
},
|
|
153
|
-
options: {
|
|
154
|
-
fallbackToRaw: true,
|
|
155
|
-
timeout: 30_000,
|
|
156
|
-
},
|
|
157
|
-
});
|
|
158
|
-
void queue.append([result.message]);
|
|
159
|
-
} else {
|
|
160
|
-
void queue.append([message]);
|
|
161
|
-
}
|
|
162
|
-
},
|
|
163
|
-
[queue, space],
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
const transcriber = useTranscriber({
|
|
167
|
-
audioStreamTrack: track,
|
|
168
|
-
onSegments: handleSegments,
|
|
169
|
-
transcriberConfig,
|
|
170
|
-
recorderConfig,
|
|
171
|
-
});
|
|
172
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
173
|
-
useEffect(() => {
|
|
174
|
-
void transcriber?.open().then(() => setIsOpen(true));
|
|
175
|
-
return () => {
|
|
176
|
-
void transcriber?.close().then(() => setIsOpen(false));
|
|
177
|
-
};
|
|
178
|
-
}, [transcriber]);
|
|
179
|
-
|
|
180
|
-
// Manage transcription state.
|
|
181
|
-
useEffect(() => {
|
|
182
|
-
if (running && transcriber?.isOpen && isSpeaking) {
|
|
183
|
-
transcriber?.startChunksRecording();
|
|
184
|
-
} else if (!running || !isSpeaking) {
|
|
185
|
-
transcriber?.stopChunksRecording();
|
|
186
|
-
}
|
|
187
|
-
}, [transcriber, running, isOpen, isSpeaking]);
|
|
188
|
-
|
|
189
|
-
return <TranscriptionStory model={model} running={running} onRunningChange={setRunning} />;
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
const meta = {
|
|
193
|
-
title: 'plugins/plugin-transcription/components/MicrophoneTranscription',
|
|
194
|
-
render: DefaultStory,
|
|
195
|
-
decorators: [
|
|
196
|
-
withTheme(),
|
|
197
|
-
withLayout({ layout: 'column' }),
|
|
198
|
-
withPluginManager({
|
|
199
|
-
plugins: [
|
|
200
|
-
...corePlugins(),
|
|
201
|
-
StorybookPlugin({}),
|
|
202
|
-
ClientPlugin({
|
|
203
|
-
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
204
|
-
onClientInitialized: ({ client }) =>
|
|
205
|
-
Effect.gen(function* () {
|
|
206
|
-
yield* Effect.promise(() => client.halo.createIdentity());
|
|
207
|
-
yield* Effect.promise(() => client.spaces.waitUntilReady());
|
|
208
|
-
yield* Effect.promise(() => client.spaces.default.waitUntilReady());
|
|
209
|
-
// TODO(mykola): Make API easier to use.
|
|
210
|
-
// TODO(mykola): Delete after enabling vector indexing by default.
|
|
211
|
-
// Enable vector indexing.
|
|
212
|
-
yield* Effect.promise(() =>
|
|
213
|
-
client.services.services.QueryService!.setConfig({
|
|
214
|
-
enabled: true,
|
|
215
|
-
indexes: [
|
|
216
|
-
//
|
|
217
|
-
{ kind: IndexKind.Kind.SCHEMA_MATCH },
|
|
218
|
-
{ kind: IndexKind.Kind.GRAPH },
|
|
219
|
-
{ kind: IndexKind.Kind.VECTOR },
|
|
220
|
-
],
|
|
221
|
-
}),
|
|
222
|
-
);
|
|
223
|
-
yield* Effect.promise(() => client.services.services.QueryService!.reindex());
|
|
224
|
-
yield* Effect.promise(() => seedTestData(client.spaces.default));
|
|
225
|
-
}),
|
|
226
|
-
}),
|
|
227
|
-
|
|
228
|
-
PreviewPlugin(),
|
|
229
|
-
TranscriptionPlugin(),
|
|
230
|
-
],
|
|
231
|
-
fireEvents: [AppActivationEvents.SetupAppGraph],
|
|
232
|
-
}),
|
|
233
|
-
],
|
|
234
|
-
} satisfies Meta<typeof DefaultStory>;
|
|
235
|
-
|
|
236
|
-
export default meta;
|
|
237
|
-
|
|
238
|
-
type Story = StoryObj<typeof meta>;
|
|
239
|
-
|
|
240
|
-
export const Default: Story = {
|
|
241
|
-
args: {
|
|
242
|
-
detectSpeaking: false,
|
|
243
|
-
entityExtraction: 'none',
|
|
244
|
-
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
245
|
-
recorderConfig: RECORDER_CONFIG,
|
|
246
|
-
audioConstraints: {
|
|
247
|
-
echoCancellation: false,
|
|
248
|
-
noiseSuppression: false,
|
|
249
|
-
autoGainControl: false,
|
|
250
|
-
},
|
|
251
|
-
},
|
|
252
|
-
};
|
|
253
|
-
|
|
254
|
-
// NOTE: We are running out of free quota on hugging face entity extraction.
|
|
255
|
-
// TODO(mykola): Fix hugging face quota issues.
|
|
256
|
-
// export const EntityExtraction: Story = {
|
|
257
|
-
// args: {
|
|
258
|
-
// detectSpeaking: true,
|
|
259
|
-
// entityExtraction: 'ner',
|
|
260
|
-
// transcriberConfig: TRANSCRIBER_CONFIG,
|
|
261
|
-
// recorderConfig: RECORDER_CONFIG,
|
|
262
|
-
// audioConstraints: {
|
|
263
|
-
// echoCancellation: true,
|
|
264
|
-
// noiseSuppression: true,
|
|
265
|
-
// autoGainControl: true,
|
|
266
|
-
// },
|
|
267
|
-
// },
|
|
268
|
-
// };
|
|
269
|
-
|
|
270
|
-
export const SpeechDetection: Story = {
|
|
271
|
-
args: {
|
|
272
|
-
detectSpeaking: true,
|
|
273
|
-
entityExtraction: 'none',
|
|
274
|
-
transcriberConfig: TRANSCRIBER_CONFIG,
|
|
275
|
-
recorderConfig: RECORDER_CONFIG,
|
|
276
|
-
audioConstraints: {
|
|
277
|
-
echoCancellation: true,
|
|
278
|
-
noiseSuppression: true,
|
|
279
|
-
autoGainControl: true,
|
|
280
|
-
},
|
|
281
|
-
},
|
|
282
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import React, { type Dispatch, type FC, type RefObject, type SetStateAction } from 'react';
|
|
8
|
-
|
|
9
|
-
import { IconButton, ScrollContainer, Toolbar } from '@dxos/react-ui';
|
|
10
|
-
import { type Message } from '@dxos/types';
|
|
11
|
-
|
|
12
|
-
import { type SerializationModel } from '../../model';
|
|
13
|
-
import { Transcription } from '../Transcription';
|
|
14
|
-
|
|
15
|
-
export const TranscriptionStory: FC<{
|
|
16
|
-
model: SerializationModel<Message.Message>;
|
|
17
|
-
disabled?: boolean;
|
|
18
|
-
running: boolean;
|
|
19
|
-
onRunningChange: Dispatch<SetStateAction<boolean>>;
|
|
20
|
-
audioRef?: RefObject<HTMLAudioElement | null>;
|
|
21
|
-
}> = ({ model, running, onRunningChange, audioRef, disabled }) => {
|
|
22
|
-
return (
|
|
23
|
-
<div className='flex flex-col w-[30rem]'>
|
|
24
|
-
{audioRef && <audio ref={audioRef} autoPlay />}
|
|
25
|
-
<Toolbar.Root>
|
|
26
|
-
<IconButton
|
|
27
|
-
iconOnly
|
|
28
|
-
disabled={disabled}
|
|
29
|
-
icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
|
|
30
|
-
label={running ? 'Pause' : 'Play'}
|
|
31
|
-
onClick={() => onRunningChange((running) => !running)}
|
|
32
|
-
/>
|
|
33
|
-
</Toolbar.Root>
|
|
34
|
-
<ScrollContainer.Root pin>
|
|
35
|
-
<ScrollContainer.Viewport>
|
|
36
|
-
<Transcription model={model} />
|
|
37
|
-
</ScrollContainer.Viewport>
|
|
38
|
-
</ScrollContainer.Root>
|
|
39
|
-
</div>
|
|
40
|
-
);
|
|
41
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// Copyright 2025 DXOS.org
|
|
3
|
-
//
|
|
4
|
-
|
|
5
|
-
import '@dxos-theme';
|
|
6
|
-
|
|
7
|
-
import { useEffect, useMemo, useState } from 'react';
|
|
8
|
-
|
|
9
|
-
import { scheduleTask } from '@dxos/async';
|
|
10
|
-
import { Context } from '@dxos/context';
|
|
11
|
-
import { SpeakingMonitor } from '@dxos/plugin-thread';
|
|
12
|
-
|
|
13
|
-
export const useIsSpeaking = (track?: MediaStreamTrack) => {
|
|
14
|
-
const [isSpeaking, setIsSpeaking] = useState(false);
|
|
15
|
-
const speakingMonitor = useMemo(() => {
|
|
16
|
-
if (!track) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
return new SpeakingMonitor(track);
|
|
20
|
-
}, [track]);
|
|
21
|
-
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (!speakingMonitor) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
const ctx = new Context();
|
|
28
|
-
scheduleTask(ctx, async () => {
|
|
29
|
-
speakingMonitor.speakingChanged.on(ctx, () => setIsSpeaking(speakingMonitor.isSpeaking));
|
|
30
|
-
await speakingMonitor.open();
|
|
31
|
-
ctx.onDispose(() => speakingMonitor.close());
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
return () => {
|
|
35
|
-
void ctx.dispose();
|
|
36
|
-
};
|
|
37
|
-
}, [speakingMonitor]);
|
|
38
|
-
|
|
39
|
-
return isSpeaking;
|
|
40
|
-
};
|