@dxos/plugin-transcription 0.8.4-main.ae835ea → 0.8.4-main.bc2380dfbc
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/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 +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/TranscriptionPlugin.workerd.mjs +21 -0
- package/dist/lib/neutral/TranscriptionPlugin.workerd.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-2O3ONPRZ.mjs +298 -0
- package/dist/lib/neutral/chunk-2O3ONPRZ.mjs.map +7 -0
- package/dist/lib/neutral/chunk-5FXU36PN.mjs +120 -0
- package/dist/lib/neutral/chunk-5FXU36PN.mjs.map +7 -0
- package/dist/lib/{browser/chunk-VBUIO677.mjs → neutral/chunk-GL4RS533.mjs} +2 -9
- package/dist/lib/neutral/chunk-GL4RS533.mjs.map +7 -0
- package/dist/lib/{browser/chunk-WH36ENNE.mjs → neutral/chunk-ILSA3DU7.mjs} +102 -133
- package/dist/lib/neutral/chunk-ILSA3DU7.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/neutral/chunk-MLRJWAQH.mjs +179 -0
- package/dist/lib/neutral/chunk-MLRJWAQH.mjs.map +7 -0
- package/dist/lib/neutral/chunk-Y5EQAFFR.mjs +8 -0
- package/dist/lib/neutral/chunk-Y5EQAFFR.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 +272 -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-RRWRIUSR.mjs +21 -0
- package/dist/lib/neutral/create-RRWRIUSR.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/meta.mjs.map +7 -0
- package/dist/lib/neutral/open-CVMX5KXZ.mjs +27 -0
- package/dist/lib/neutral/open-CVMX5KXZ.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-YMZRO242.mjs +26 -0
- package/dist/lib/neutral/react-surface-YMZRO242.mjs.map +7 -0
- package/dist/lib/neutral/summarize-LA7TRW7A.mjs +78 -0
- package/dist/lib/neutral/summarize-LA7TRW7A.mjs.map +7 -0
- package/dist/lib/neutral/text-content-F4ASMITB.mjs +30 -0
- package/dist/lib/neutral/text-content-F4ASMITB.mjs.map +7 -0
- package/dist/lib/{node-esm/transcriber-UGB7ECX6.mjs → neutral/transcriber-ABHATBVH.mjs} +20 -18
- 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 +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/TranscriptionPlugin.workerd.d.ts +4 -0
- package/dist/types/src/TranscriptionPlugin.workerd.d.ts.map +1 -0
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +10 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/text-content.d.ts +8 -0
- package/dist/types/src/capabilities/text-content.d.ts.map +1 -0
- package/dist/types/src/capabilities/transcriber.d.ts +4 -3
- package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
- package/dist/types/src/components/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 +13 -0
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +37 -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 +2 -3
- 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 +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- 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 +2 -2
- 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 +9 -7
- 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 +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 +46 -0
- package/dist/types/src/stories/common.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +13 -14
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/index.d.ts +1 -1
- package/dist/types/src/transcriber/index.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +2 -2
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +61 -6
- 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 +14 -9
- 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 +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/index.d.ts +2 -3
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/array.d.ts.map +1 -1
- package/dist/types/src/util/get-time-str.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
- package/dist/types/src/util/render-byline.d.ts +4 -0
- package/dist/types/src/util/render-byline.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +157 -82
- package/src/TranscriptionPlugin.node.ts +20 -0
- package/src/TranscriptionPlugin.test.ts +31 -0
- package/src/TranscriptionPlugin.tsx +20 -64
- package/src/TranscriptionPlugin.workerd.ts +18 -0
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/transcription-blueprint.ts +29 -0
- package/src/capabilities/blueprint-definition.ts +12 -24
- package/src/capabilities/index.ts +11 -7
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +23 -14
- package/src/capabilities/text-content.ts +33 -0
- package/src/capabilities/transcriber.ts +53 -42
- package/src/components/Oracle/Oracle.stories.tsx +147 -0
- package/src/components/Oracle/Oracle.tsx +141 -0
- package/src/components/Oracle/index.ts +5 -0
- package/src/components/Transcription/Transcription.stories.tsx +213 -0
- package/src/components/Transcription/Transcription.tsx +58 -0
- package/src/components/{Transcript → Transcription}/index.ts +1 -1
- package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +13 -9
- package/src/components/index.ts +2 -6
- 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 +7 -0
- package/src/enrichment/conversation.test.ts +162 -0
- package/src/enrichment/conversation.txt +23 -0
- package/src/enrichment/operations.ts +268 -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 +12 -4
- package/src/hooks/useTranscriptionRecording.ts +87 -0
- package/src/hooks/useVoiceInput.ts +2 -3
- package/src/index.ts +4 -5
- package/src/meta.ts +3 -3
- package/src/model/model.test.ts +20 -14
- package/src/model/model.ts +3 -3
- package/src/{segments-normalization → normalization}/message-normalizer.ts +37 -24
- package/src/{segments-normalization → normalization}/normalization.test.ts +8 -47
- 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 +143 -0
- package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +40 -40
- 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 +49 -56
- package/src/transcriber/index.ts +1 -1
- package/src/transcriber/media-stream-recorder.ts +3 -3
- package/src/transcriber/transcriber.browser.test.ts +4 -5
- package/src/transcriber/transcriber.test.ts +104 -0
- package/src/transcriber/transcriber.ts +105 -60
- package/src/transcriber/transcription-manager.ts +33 -22
- package/src/translations.ts +10 -7
- package/src/types/TranscriptOperation.ts +103 -0
- package/src/types/TranscriptionCapabilities.ts +39 -0
- package/src/types/index.ts +2 -3
- package/src/util/index.ts +1 -0
- package/src/util/render-byline.ts +33 -0
- package/dist/lib/browser/TranscriptContainer-2GSL2XB5.mjs +0 -11
- package/dist/lib/browser/blueprint-definition-UAAJYVLZ.mjs +0 -150
- package/dist/lib/browser/blueprint-definition-UAAJYVLZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs +0 -16
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-535OJKFO.mjs +0 -8
- package/dist/lib/browser/chunk-535OJKFO.mjs.map +0 -7
- package/dist/lib/browser/chunk-7DR6HZEF.mjs +0 -732
- package/dist/lib/browser/chunk-7DR6HZEF.mjs.map +0 -7
- package/dist/lib/browser/chunk-VBUIO677.mjs.map +0 -7
- package/dist/lib/browser/chunk-W7WKZTM4.mjs +0 -63
- package/dist/lib/browser/chunk-W7WKZTM4.mjs.map +0 -7
- package/dist/lib/browser/chunk-WH36ENNE.mjs.map +0 -7
- package/dist/lib/browser/index.mjs +0 -130
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-ZTKTEAQX.mjs +0 -25
- package/dist/lib/browser/intent-resolver-ZTKTEAQX.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/react-surface-KA32A72I.mjs +0 -34
- package/dist/lib/browser/react-surface-KA32A72I.mjs.map +0 -7
- package/dist/lib/browser/transcriber-LWOLYQHC.mjs +0 -56
- package/dist/lib/browser/transcriber-LWOLYQHC.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -12
- package/dist/lib/node-esm/TranscriptContainer-GRLDCESB.mjs +0 -12
- package/dist/lib/node-esm/blueprint-definition-Z3LTZ3ID.mjs +0 -151
- package/dist/lib/node-esm/blueprint-definition-Z3LTZ3ID.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K4AZOB5Y.mjs +0 -733
- package/dist/lib/node-esm/chunk-K4AZOB5Y.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OLMSTF3M.mjs +0 -64
- package/dist/lib/node-esm/chunk-OLMSTF3M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q6WD7L2J.mjs +0 -10
- package/dist/lib/node-esm/chunk-Q6WD7L2J.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs +0 -17
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YFN4FJFK.mjs +0 -467
- package/dist/lib/node-esm/chunk-YFN4FJFK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs +0 -30
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs.map +0 -7
- package/dist/lib/node-esm/index.mjs +0 -131
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-55WH2GY6.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-55WH2GY6.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/react-surface-GU7LW2JO.mjs +0 -35
- package/dist/lib/node-esm/react-surface-GU7LW2JO.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-UGB7ECX6.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -13
- package/dist/types/src/capabilities/capabilities.d.ts +0 -17
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts +0 -20
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +0 -39
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +0 -28
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/index.d.ts +0 -2
- package/dist/types/src/components/Transcript/index.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +0 -15
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +0 -9
- package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +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/functions/index.d.ts +0 -3
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts +0 -7
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/functions/summarize.d.ts +0 -11
- package/dist/types/src/functions/summarize.d.ts.map +0 -1
- package/dist/types/src/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 -476
- package/dist/types/src/segments-normalization/normalization.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/normalization.test.d.ts.map +0 -1
- package/dist/types/src/segments-normalization/utils.d.ts +0 -3
- package/dist/types/src/segments-normalization/utils.d.ts.map +0 -1
- package/dist/types/src/types/Transcript.d.ts +0 -30
- package/dist/types/src/types/Transcript.d.ts.map +0 -1
- package/dist/types/src/types/TranscriptAction.d.ts +0 -23
- package/dist/types/src/types/TranscriptAction.d.ts.map +0 -1
- package/dist/types/src/types/types.d.ts +0 -5
- package/dist/types/src/types/types.d.ts.map +0 -1
- package/src/capabilities/capabilities.ts +0 -33
- package/src/capabilities/intent-resolver.ts +0 -18
- package/src/components/Transcript/Transcript.stories.tsx +0 -245
- package/src/components/Transcript/Transcript.tsx +0 -93
- package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
- package/src/components/TranscriptContainer.tsx +0 -36
- package/src/components/stories/FileTranscription.stories.tsx +0 -256
- package/src/components/stories/MicrophoneTranscription.stories.tsx +0 -285
- package/src/components/stories/TranscriptionStory.tsx +0 -45
- package/src/components/stories/useIsSpeaking.tsx +0 -40
- package/src/functions/index.ts +0 -6
- package/src/functions/open.ts +0 -39
- 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/Transcript.ts +0 -44
- package/src/types/TranscriptAction.ts +0 -24
- package/src/types/types.ts +0 -9
- package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
- package/dist/lib/{browser/TranscriptContainer-2GSL2XB5.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-GRLDCESB.mjs.map → neutral/index.mjs.map} +0 -0
- package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
- package/src/{segments-normalization → normalization}/index.ts +1 -1
|
@@ -2,28 +2,27 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
import { effect } from '@preact/signals-core';
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import type * as Runtime from 'effect/Runtime';
|
|
10
7
|
|
|
11
8
|
import { DeferredTask, asyncTimeout } from '@dxos/async';
|
|
12
9
|
import { LifecycleState, Resource } from '@dxos/context';
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
10
|
+
import { Feed, Filter } from '@dxos/echo';
|
|
11
|
+
import { runAndForwardErrors } from '@dxos/effect';
|
|
12
|
+
import { type FunctionExecutor } from '@dxos/functions-runtime';
|
|
15
13
|
import { log } from '@dxos/log';
|
|
16
|
-
import {
|
|
14
|
+
import { Message } from '@dxos/types';
|
|
17
15
|
|
|
18
|
-
import { type MessageWithRangeId, sentenceNormalization } from './normalization';
|
|
16
|
+
import { type MessageWithRangeId, type NormalizationOutput, sentenceNormalization } from './normalization';
|
|
19
17
|
import { getActorId } from './utils';
|
|
20
18
|
|
|
21
19
|
const PROCESSING_TIMEOUT = 20_000; // ms
|
|
22
20
|
const MAX_RANGE_ID_COUNT = 10;
|
|
23
21
|
|
|
24
|
-
export type
|
|
22
|
+
export type SegmentsNormalizerProps = {
|
|
25
23
|
functionExecutor: FunctionExecutor;
|
|
26
|
-
|
|
24
|
+
feed: Feed.Feed;
|
|
25
|
+
feedRuntime: Runtime.Runtime<Feed.FeedService>;
|
|
27
26
|
startingCursor: QueueCursor;
|
|
28
27
|
};
|
|
29
28
|
|
|
@@ -33,37 +32,51 @@ export type QueueCursor = {
|
|
|
33
32
|
timestamp: string;
|
|
34
33
|
};
|
|
35
34
|
|
|
36
|
-
// TODO(mykola): .
|
|
37
35
|
export class MessageNormalizer extends Resource {
|
|
38
36
|
private readonly _functionExecutor: FunctionExecutor;
|
|
39
|
-
|
|
37
|
+
|
|
38
|
+
private _feed: Feed.Feed;
|
|
39
|
+
private _feedRuntime: Runtime.Runtime<Feed.FeedService>;
|
|
40
40
|
private _cursor: QueueCursor;
|
|
41
41
|
private _messagesToProcess: MessageWithRangeId[] = [];
|
|
42
42
|
private _normalizationTask?: DeferredTask;
|
|
43
43
|
private _lastProcessedMessageIds?: string[];
|
|
44
44
|
|
|
45
|
-
constructor({ functionExecutor,
|
|
45
|
+
constructor({ functionExecutor, feed, feedRuntime, startingCursor }: SegmentsNormalizerProps) {
|
|
46
46
|
super();
|
|
47
47
|
this._functionExecutor = functionExecutor;
|
|
48
|
-
this.
|
|
48
|
+
this._feed = feed;
|
|
49
|
+
this._feedRuntime = feedRuntime;
|
|
49
50
|
this._cursor = startingCursor;
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
protected override async _open(): Promise<void> {
|
|
53
54
|
this._normalizationTask = new DeferredTask(this._ctx, () => this._processMessages());
|
|
54
|
-
|
|
55
|
+
|
|
56
|
+
const queryResult = await Feed.query(this._feed, Filter.type(Message.Message)).pipe(
|
|
57
|
+
Effect.provide(this._feedRuntime),
|
|
58
|
+
runAndForwardErrors,
|
|
59
|
+
);
|
|
60
|
+
|
|
61
|
+
const updateMessages = () => {
|
|
55
62
|
if (this._lifecycleState !== LifecycleState.OPEN) {
|
|
56
63
|
return;
|
|
57
64
|
}
|
|
58
65
|
|
|
59
|
-
this._messagesToProcess =
|
|
66
|
+
this._messagesToProcess = (queryResult.results as Message.Message[]).filter((message) => {
|
|
60
67
|
const actorId = getActorId(message.sender);
|
|
61
68
|
return actorId === this._cursor.actorId && message.created >= this._cursor.timestamp;
|
|
62
69
|
});
|
|
63
70
|
|
|
64
71
|
this._normalizationTask!.schedule();
|
|
65
|
-
}
|
|
66
|
-
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// Initial update.
|
|
75
|
+
updateMessages();
|
|
76
|
+
|
|
77
|
+
// Subscribe to feed changes.
|
|
78
|
+
const unsubscribe = queryResult.subscribe(updateMessages);
|
|
79
|
+
this._ctx.onDispose(unsubscribe);
|
|
67
80
|
}
|
|
68
81
|
|
|
69
82
|
// Need to unpack strings from blocks from messages run them through the function and then pack them back into blocks into messages.
|
|
@@ -81,12 +94,12 @@ export class MessageNormalizer extends Resource {
|
|
|
81
94
|
|
|
82
95
|
try {
|
|
83
96
|
// TODO(mykola): Executor should support timeout.
|
|
84
|
-
const response = await asyncTimeout(
|
|
97
|
+
const response: NormalizationOutput = await asyncTimeout(
|
|
85
98
|
this._functionExecutor.invoke(sentenceNormalization, { messages }),
|
|
86
99
|
PROCESSING_TIMEOUT,
|
|
87
100
|
);
|
|
88
101
|
|
|
89
|
-
this._writeMessages(response.sentences);
|
|
102
|
+
await this._writeMessages(response.sentences);
|
|
90
103
|
this._lastProcessedMessageIds.push(...response.sentences.map((sentence) => sentence.id));
|
|
91
104
|
if (response.sentences.length === 1 && response.sentences.at(-1)!.rangeId!.length > MAX_RANGE_ID_COUNT) {
|
|
92
105
|
log.warn('Sentence is too long', { messages });
|
|
@@ -95,14 +108,14 @@ export class MessageNormalizer extends Resource {
|
|
|
95
108
|
} catch {
|
|
96
109
|
log.error('Failed to normalize segments', { messages });
|
|
97
110
|
// If processing failed, emit the segments as is.
|
|
98
|
-
this._writeMessages(messages);
|
|
111
|
+
await this._writeMessages(messages);
|
|
99
112
|
}
|
|
100
113
|
}
|
|
101
114
|
|
|
102
|
-
private _writeMessages(messages: MessageWithRangeId[]): void {
|
|
115
|
+
private async _writeMessages(messages: MessageWithRangeId[]): Promise<void> {
|
|
103
116
|
log.info('writing messages', { messages });
|
|
104
117
|
const lastMessage = messages[messages.length - 1];
|
|
105
118
|
this._cursor.timestamp = lastMessage.created;
|
|
106
|
-
|
|
119
|
+
await Feed.append(this._feed, messages).pipe(Effect.provide(this._feedRuntime), runAndForwardErrors);
|
|
107
120
|
}
|
|
108
121
|
}
|
|
@@ -2,23 +2,16 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { effect } from '@preact/signals-core';
|
|
6
5
|
import { describe, test } from 'vitest';
|
|
7
6
|
|
|
8
|
-
import { scheduleTaskInterval } from '@dxos/async';
|
|
9
|
-
import { Context } from '@dxos/context';
|
|
10
7
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import {
|
|
12
|
-
import { MemoryQueue } from '@dxos/echo-db';
|
|
13
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions';
|
|
8
|
+
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
14
9
|
import { log } from '@dxos/log';
|
|
15
|
-
import {
|
|
10
|
+
import { type Actor, Message } from '@dxos/types';
|
|
16
11
|
|
|
17
|
-
import { MessageNormalizer } from './message-normalizer';
|
|
18
12
|
import { type MessageWithRangeId, sentenceNormalization } from './normalization';
|
|
19
|
-
import { getActorId } from './utils';
|
|
20
13
|
|
|
21
|
-
const sender:
|
|
14
|
+
const sender: Actor.Actor = {
|
|
22
15
|
identityDid: 'did:key:123',
|
|
23
16
|
};
|
|
24
17
|
|
|
@@ -48,7 +41,7 @@ const messages: MessageWithRangeId[] = [
|
|
|
48
41
|
// No punctuation.
|
|
49
42
|
'in classical physics objects have well-defined properties such as position speed and momentum',
|
|
50
43
|
].map((string, index) =>
|
|
51
|
-
Obj.make(
|
|
44
|
+
Obj.make(Message.Message, {
|
|
52
45
|
created: new Date(Date.now() + 1_000 * index).toISOString(),
|
|
53
46
|
sender,
|
|
54
47
|
blocks: [{ _tag: 'transcript', started: new Date(Date.now() + 1_000 * index).toISOString(), text: string }],
|
|
@@ -99,45 +92,13 @@ describe.skip('SentenceNormalization', () => {
|
|
|
99
92
|
}
|
|
100
93
|
|
|
101
94
|
log.info('sentences', {
|
|
102
|
-
|
|
95
|
+
messages: JSON.stringify(messages, null, 2),
|
|
103
96
|
sentences: JSON.stringify(sentences, null, 2),
|
|
104
97
|
});
|
|
105
98
|
throw new Error('test');
|
|
106
99
|
});
|
|
107
100
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
const queue = new MemoryQueue<DataType.Message>(createQueueDXN());
|
|
112
|
-
const ctx = new Context();
|
|
113
|
-
let idx = 0;
|
|
114
|
-
scheduleTaskInterval(
|
|
115
|
-
ctx,
|
|
116
|
-
async () => {
|
|
117
|
-
if (idx >= messages.length) {
|
|
118
|
-
void ctx.dispose();
|
|
119
|
-
return;
|
|
120
|
-
}
|
|
121
|
-
await queue.append([messages[idx]]);
|
|
122
|
-
idx++;
|
|
123
|
-
},
|
|
124
|
-
2_000,
|
|
125
|
-
);
|
|
126
|
-
|
|
127
|
-
// Create normalizer.
|
|
128
|
-
const normalizer = new MessageNormalizer({
|
|
129
|
-
functionExecutor: getExecutor(),
|
|
130
|
-
queue,
|
|
131
|
-
startingCursor: { actorId: getActorId(sender), timestamp: '0' },
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// Start normalizer.
|
|
135
|
-
await normalizer.open();
|
|
136
|
-
effect(() => {
|
|
137
|
-
log.info('normalizer');
|
|
138
|
-
log.info(JSON.stringify(queue.objects, null, 2));
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
await new Promise(() => {});
|
|
142
|
-
});
|
|
101
|
+
// TODO(burdon): Restore a Feed-based version once `MessageNormalizer` has a
|
|
102
|
+
// space-backed test fixture available; the previous `MemoryQueue`-based
|
|
103
|
+
// test was incompatible with the `Feed.Feed` + `FeedService` refactor.
|
|
143
104
|
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { Operation } from '@dxos/compute';
|
|
9
|
+
import { log } from '@dxos/log';
|
|
10
|
+
import { trim } from '@dxos/util';
|
|
11
|
+
|
|
12
|
+
import { TranscriptOperation } from '../types';
|
|
13
|
+
|
|
14
|
+
type MessageWithRangeIdType = TranscriptOperation.MessageWithRangeIdType;
|
|
15
|
+
type SentenceNormalizationInputType = TranscriptOperation.SentenceNormalizationInputType;
|
|
16
|
+
const { SentenceNormalization, SentenceNormalizationOutput } = TranscriptOperation;
|
|
17
|
+
|
|
18
|
+
export type MessageWithRangeId = MessageWithRangeIdType;
|
|
19
|
+
|
|
20
|
+
/** @deprecated Use SentenceNormalizationInputType */
|
|
21
|
+
export type NormalizationInput = SentenceNormalizationInputType;
|
|
22
|
+
|
|
23
|
+
/** @deprecated Use SentenceNormalizationOutput */
|
|
24
|
+
export type NormalizationOutput = Schema.Schema.Type<typeof SentenceNormalizationOutput>;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Sentence normalization for transcription.
|
|
28
|
+
* TODO(dmaretskyi): Reimplement using AiRequest.run or LanguageModel.generateObject - runStructured was removed.
|
|
29
|
+
*/
|
|
30
|
+
export const sentenceNormalization = SentenceNormalization.pipe(
|
|
31
|
+
Operation.withHandler(
|
|
32
|
+
Effect.fn(function* ({ messages }) {
|
|
33
|
+
log.info('input', { messages });
|
|
34
|
+
// TODO(dmaretskyi): runStructured was removed from AiRequest. Reimplement using new API.
|
|
35
|
+
return yield* Effect.die(
|
|
36
|
+
new Error(
|
|
37
|
+
'Sentence normalization needs to be reimplemented - runStructured was removed from AiRequest.Request. Use AiRequest.run or LanguageModel.generateObject.',
|
|
38
|
+
),
|
|
39
|
+
);
|
|
40
|
+
}),
|
|
41
|
+
),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const _unused = trim`
|
|
45
|
+
You are observing a real-time transcript of a single person speaking.
|
|
46
|
+
The transcription is delivered in chunks of 10 seconds or less. As a result, individual sentences may be split across multiple messages, or multiple sentences may appear within a single message. Additionally, because this is real-time transcription, punctuation and capitalization may be incorrect or missing.
|
|
47
|
+
|
|
48
|
+
# Task Description:
|
|
49
|
+
- Your task is to detect and reconstruct broken or incomplete sentences by merging segments into coherent, grammatically correct sentences where appropriate.
|
|
50
|
+
|
|
51
|
+
# Input Format:
|
|
52
|
+
- The input is an array of messages that contain transcription blocks.
|
|
53
|
+
- Each message is a Message.Message, as described in the output format.
|
|
54
|
+
|
|
55
|
+
# Output Format:
|
|
56
|
+
- You have been provided with the tool that defines the output format; make sure to query it.
|
|
57
|
+
- Do not output anything other than the expected format.
|
|
58
|
+
|
|
59
|
+
# Segment Handling Rules:
|
|
60
|
+
- Sort messages by timestamp.
|
|
61
|
+
- Leave ID of the first message in a sentence.
|
|
62
|
+
- Each divided sentence should be added to the output as a separate message or block within existing messages, preserving the original order.
|
|
63
|
+
- If one message contains multiple sentences, you should not split them.
|
|
64
|
+
- The last sentence may be incomplete; it should still be output as a separate block or message.
|
|
65
|
+
- Keep track of the original timestamps of the messages and blocks and, use the timestamp of the first message/block of a sentence as the 'started' field of the merged message.
|
|
66
|
+
- The 'rangeId' field of the merged message should include 'messageId'-s and 'rangeId'-s of all messages that have been used to construct this message.
|
|
67
|
+
|
|
68
|
+
# Punctuation and Capitalization:
|
|
69
|
+
- Do not rely on the original punctuation and capitalization—they may be incorrect.
|
|
70
|
+
- Use logical reasoning to apply appropriate punctuation (e.g., period, comma, question mark, exclamation mark) and capitalization.
|
|
71
|
+
|
|
72
|
+
# Restrictions:
|
|
73
|
+
- Do not alter the order of the original messages; maintain the natural flow of speech.
|
|
74
|
+
- Do not interpret or infer meaning beyond reconstructing sentences.
|
|
75
|
+
- Do not add or remove any words or phrases.
|
|
76
|
+
`;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { type
|
|
5
|
+
import { type Actor } from '@dxos/types';
|
|
6
6
|
|
|
7
|
-
export const getActorId = (actor:
|
|
7
|
+
export const getActorId = (actor: Actor.Actor) => {
|
|
8
8
|
return actor.identityDid || actor.identityKey || actor.email || actor.name || '';
|
|
9
9
|
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { Feed, Ref } from '@dxos/echo';
|
|
9
|
+
import { Transcript } from '@dxos/types';
|
|
10
|
+
|
|
11
|
+
import { TranscriptOperation } from '../types';
|
|
12
|
+
|
|
13
|
+
const handler: Operation.WithHandler<typeof TranscriptOperation.Create> = TranscriptOperation.Create.pipe(
|
|
14
|
+
Operation.withHandler(
|
|
15
|
+
Effect.fn(function* ({ space }) {
|
|
16
|
+
const feed = space.db.add(Feed.make());
|
|
17
|
+
return {
|
|
18
|
+
object: Transcript.make(Ref.make(feed)),
|
|
19
|
+
};
|
|
20
|
+
}),
|
|
21
|
+
),
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
export default handler;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { OperationHandlerSet } from '@dxos/compute';
|
|
6
|
+
|
|
7
|
+
export const TranscriptionOperationHandlerSet = OperationHandlerSet.lazy(
|
|
8
|
+
() => import('./create'),
|
|
9
|
+
() => import('./open'),
|
|
10
|
+
() => import('./summarize'),
|
|
11
|
+
);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
|
|
7
|
+
import { Operation } from '@dxos/compute';
|
|
8
|
+
import { Database, Feed, Filter } from '@dxos/echo';
|
|
9
|
+
import { Message } from '@dxos/types';
|
|
10
|
+
|
|
11
|
+
import { TranscriptOperation } from '../types';
|
|
12
|
+
import { renderByline } from '../util';
|
|
13
|
+
|
|
14
|
+
const handler: Operation.WithHandler<typeof TranscriptOperation.Open> = TranscriptOperation.Open.pipe(
|
|
15
|
+
Operation.withHandler(
|
|
16
|
+
Effect.fn(function* ({ transcript }) {
|
|
17
|
+
const transcriptObj = yield* Database.load(transcript);
|
|
18
|
+
const feed = yield* Database.load(transcriptObj.feed);
|
|
19
|
+
const messages = yield* Feed.runQuery(feed, Filter.type(Message.Message));
|
|
20
|
+
const content = messages
|
|
21
|
+
.flatMap((message: Message.Message, index: number) => renderByline([])(message, index))
|
|
22
|
+
.join('\n\n');
|
|
23
|
+
return { content };
|
|
24
|
+
}),
|
|
25
|
+
),
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
export default handler;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Function from 'effect/Function';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import * as Option from 'effect/Option';
|
|
10
|
+
|
|
11
|
+
import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
12
|
+
import { AiRequest, GenerationObserver } from '@dxos/assistant';
|
|
13
|
+
import { Trace, Operation, OperationRegistry } from '@dxos/compute';
|
|
14
|
+
import { Database } from '@dxos/echo';
|
|
15
|
+
import { trim } from '@dxos/util';
|
|
16
|
+
|
|
17
|
+
import { TranscriptOperation } from '../types';
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Summarize a transcript of a meeting.
|
|
21
|
+
*/
|
|
22
|
+
const handler: Operation.WithHandler<typeof TranscriptOperation.Summarize> = TranscriptOperation.Summarize.pipe(
|
|
23
|
+
Operation.withHandler(
|
|
24
|
+
Effect.fnUntraced(
|
|
25
|
+
function* ({ transcript, notes }) {
|
|
26
|
+
const result = yield* new AiRequest.Request({
|
|
27
|
+
observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'summarize' })),
|
|
28
|
+
}).run({
|
|
29
|
+
prompt: `Transcript: ${transcript}\n\nNotes: ${notes}`,
|
|
30
|
+
history: [],
|
|
31
|
+
system: systemPrompt,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const summary = Function.pipe(
|
|
35
|
+
result,
|
|
36
|
+
Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
|
|
37
|
+
Option.flatMap((msg) =>
|
|
38
|
+
Function.pipe(
|
|
39
|
+
msg.blocks,
|
|
40
|
+
Array.findLast((block) => block._tag === 'text'),
|
|
41
|
+
Option.map((block) => block.text),
|
|
42
|
+
),
|
|
43
|
+
),
|
|
44
|
+
Option.getOrThrowWith(() => new Error('No summary found')),
|
|
45
|
+
);
|
|
46
|
+
|
|
47
|
+
return { summary };
|
|
48
|
+
},
|
|
49
|
+
Effect.provide(
|
|
50
|
+
Layer.mergeAll(
|
|
51
|
+
AiService.model('@anthropic/claude-sonnet-4-0'),
|
|
52
|
+
ToolResolverService.layerEmpty,
|
|
53
|
+
ToolExecutionService.layerEmpty,
|
|
54
|
+
Trace.writerLayerNoop,
|
|
55
|
+
Database.notAvailable,
|
|
56
|
+
Layer.succeed(Operation.Service, {
|
|
57
|
+
invoke: () => Effect.die('Not available.'),
|
|
58
|
+
schedule: () => Effect.die('Not available.'),
|
|
59
|
+
invokePromise: async () => ({ error: new Error('Not available.') }),
|
|
60
|
+
} as any),
|
|
61
|
+
Layer.succeed(OperationRegistry.Service, { resolve: () => Effect.succeed(undefined) } as any),
|
|
62
|
+
),
|
|
63
|
+
),
|
|
64
|
+
),
|
|
65
|
+
),
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
export default handler;
|
|
69
|
+
|
|
70
|
+
const systemPrompt = trim`
|
|
71
|
+
You are a helpful assistant that summarizes transcripts of meetings.
|
|
72
|
+
|
|
73
|
+
# Goal
|
|
74
|
+
Create a markdown summary of the meeting transcript with text notes provided.
|
|
75
|
+
Notes are very important so make sure to include them in the summary if they contain meaningful information.
|
|
76
|
+
|
|
77
|
+
# Formatting
|
|
78
|
+
- Format the summary as a markdown document without extra comments like "Here is the summary of the transcript:".
|
|
79
|
+
- Use markdown formatting for headings and bullet points.
|
|
80
|
+
- Format the summary as a list of key points and takeaways.
|
|
81
|
+
- All names of people should be in bold.
|
|
82
|
+
|
|
83
|
+
# Note Taking
|
|
84
|
+
- Correlate items in the summary with the person of origin to build a coherent narrative.
|
|
85
|
+
- Include short quotes verbatim where appropriate. Especially when concerned with design decisions and problem descriptions.
|
|
86
|
+
|
|
87
|
+
# Tasks
|
|
88
|
+
At the end of the summary include tasks.
|
|
89
|
+
Extract only the tasks that are:
|
|
90
|
+
- Directly actionable.
|
|
91
|
+
- Clearly assigned to a person or team (or can easily be inferred).
|
|
92
|
+
- Strongly implied by the conversation and/or user note (no speculative tasks).
|
|
93
|
+
- Specific enough that someone reading them would know exactly what to do next.
|
|
94
|
+
|
|
95
|
+
Format all tasks as markdown checkboxes using the syntax:
|
|
96
|
+
- [ ] Task description.
|
|
97
|
+
|
|
98
|
+
Additional information can be included (indented).
|
|
99
|
+
|
|
100
|
+
If no actionable tasks are found, omit this tasks section.
|
|
101
|
+
`;
|
package/src/plugin.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { Plugin } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from './meta';
|
|
8
|
+
|
|
9
|
+
export const TranscriptionPlugin = Plugin.lazy(meta, () => import('#plugin'));
|
|
10
|
+
|
|
11
|
+
export { TranscriptionOperationHandlerSet } from './operations';
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
7
|
+
|
|
8
|
+
import { useAudioFile } from '#hooks';
|
|
9
|
+
|
|
10
|
+
import { type MediaStreamRecorderProps, type TranscriberProps } from '../transcriber';
|
|
11
|
+
import {
|
|
12
|
+
useIsSpeaking,
|
|
13
|
+
createStoryDecorators,
|
|
14
|
+
useStoryAppendSegments,
|
|
15
|
+
useStoryMessageModel,
|
|
16
|
+
useStoryTranscriber,
|
|
17
|
+
} from './common';
|
|
18
|
+
import { TranscriptionStory } from './TranscriptionStory';
|
|
19
|
+
|
|
20
|
+
const DEFAULT_TRANSCRIBER_CONFIG = {
|
|
21
|
+
transcribeAfterChunksAmount: 100,
|
|
22
|
+
prefixBufferChunksAmount: 50,
|
|
23
|
+
normalizeSentences: true,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const DEFAULT_RECORDER_CONFIG = {
|
|
27
|
+
interval: 200,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type DefaultStoryProps = {
|
|
31
|
+
detectSpeaking?: boolean;
|
|
32
|
+
normalizeSentences?: boolean;
|
|
33
|
+
audioUrl: string;
|
|
34
|
+
transcriberConfig?: TranscriberProps['config'];
|
|
35
|
+
recorderConfig?: MediaStreamRecorderProps['config'];
|
|
36
|
+
audioConstraints?: MediaTrackConstraints;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const DefaultStory = ({
|
|
40
|
+
detectSpeaking,
|
|
41
|
+
audioUrl,
|
|
42
|
+
normalizeSentences,
|
|
43
|
+
transcriberConfig = DEFAULT_TRANSCRIBER_CONFIG,
|
|
44
|
+
recorderConfig = DEFAULT_RECORDER_CONFIG,
|
|
45
|
+
audioConstraints,
|
|
46
|
+
}: DefaultStoryProps) => {
|
|
47
|
+
const [running, setRunning] = useState(false);
|
|
48
|
+
|
|
49
|
+
// Optional uploaded file overrides the default URL; revoke the previous URL on change/unmount.
|
|
50
|
+
const [uploadedUrl, setUploadedUrl] = useState<string>();
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
return () => {
|
|
53
|
+
if (uploadedUrl) {
|
|
54
|
+
URL.revokeObjectURL(uploadedUrl);
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
}, [uploadedUrl]);
|
|
58
|
+
|
|
59
|
+
const handleUpload = useCallback((file: File) => {
|
|
60
|
+
setRunning(false);
|
|
61
|
+
setUploadedUrl(URL.createObjectURL(file));
|
|
62
|
+
}, []);
|
|
63
|
+
|
|
64
|
+
const sourceUrl = uploadedUrl ?? audioUrl;
|
|
65
|
+
const { audio, track, stream } = useAudioFile(sourceUrl, audioConstraints);
|
|
66
|
+
const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
|
|
67
|
+
|
|
68
|
+
// Pipe the decoded stream into the <audio> element so the user hears playback.
|
|
69
|
+
const ref = useRef<HTMLAudioElement>(null);
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (ref.current && stream) {
|
|
72
|
+
ref.current.srcObject = stream;
|
|
73
|
+
}
|
|
74
|
+
}, [stream]);
|
|
75
|
+
|
|
76
|
+
// Mirror the toolbar's running flag to the underlying HTMLAudioElement.
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
if (!audio) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (running) {
|
|
83
|
+
void audio.play();
|
|
84
|
+
} else {
|
|
85
|
+
void audio.pause();
|
|
86
|
+
}
|
|
87
|
+
}, [audio, running]);
|
|
88
|
+
|
|
89
|
+
const { model, appendMessage } = useStoryMessageModel();
|
|
90
|
+
const handleSegments = useStoryAppendSegments(appendMessage);
|
|
91
|
+
|
|
92
|
+
useStoryTranscriber({
|
|
93
|
+
audioStreamTrack: track,
|
|
94
|
+
running,
|
|
95
|
+
isSpeaking,
|
|
96
|
+
transcriberConfig,
|
|
97
|
+
recorderConfig,
|
|
98
|
+
onSegments: handleSegments,
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// TODO(burdon): Sentence normalization moved to require a real space-backed Feed + FeedService runtime.
|
|
102
|
+
// Re-enable here once the story has access to one.
|
|
103
|
+
void normalizeSentences;
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<TranscriptionStory
|
|
107
|
+
audioRef={ref}
|
|
108
|
+
disabled={!stream}
|
|
109
|
+
model={model}
|
|
110
|
+
running={running}
|
|
111
|
+
onRunningChange={setRunning}
|
|
112
|
+
onUpload={handleUpload}
|
|
113
|
+
/>
|
|
114
|
+
);
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
const meta = {
|
|
118
|
+
title: 'plugins/plugin-transcription/stories/FileTranscription',
|
|
119
|
+
render: DefaultStory,
|
|
120
|
+
decorators: createStoryDecorators(),
|
|
121
|
+
} satisfies Meta<DefaultStoryProps>;
|
|
122
|
+
|
|
123
|
+
export default meta;
|
|
124
|
+
|
|
125
|
+
type Story = StoryObj<typeof meta>;
|
|
126
|
+
|
|
127
|
+
export const Default: Story = {
|
|
128
|
+
args: {
|
|
129
|
+
detectSpeaking: true,
|
|
130
|
+
// https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
|
|
131
|
+
audioUrl: 'https://dxos.network/audio-london.m4a',
|
|
132
|
+
// textUrl: 'https://dxos.network/audio-london.txt',
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
// TODO(mykola): Fix sentence normalization.
|
|
137
|
+
// export const WithSentenceNormalization: StoryObj<typeof AudioFile> = {
|
|
138
|
+
// args: {
|
|
139
|
+
// detectSpeaking: true,
|
|
140
|
+
// normalizeSentences: true,
|
|
141
|
+
// audioUrl: 'https://dxos.network/audio-london.m4a',
|
|
142
|
+
// },
|
|
143
|
+
// };
|