@dxos/plugin-transcription 0.9.0 → 0.9.1-staging.ee54ba693a
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/PLUGIN.mdl +25 -5
- package/dist/lib/neutral/{TranscriptionArticle-L6XANBH5.mjs → TranscriptionArticle-FEWCWG4A.mjs} +4 -7
- package/dist/lib/neutral/TranscriptionArticle-FEWCWG4A.mjs.map +7 -0
- package/dist/lib/neutral/TranscriptionPlugin.mjs +29 -6
- package/dist/lib/neutral/TranscriptionPlugin.mjs.map +4 -4
- package/dist/lib/neutral/TranscriptionPlugin.node.mjs +3 -3
- package/dist/lib/neutral/TranscriptionPlugin.node.mjs.map +3 -3
- package/dist/lib/neutral/app-graph-builder-GQRMI22E.mjs +48 -0
- package/dist/lib/neutral/app-graph-builder-GQRMI22E.mjs.map +7 -0
- package/dist/lib/neutral/capabilities/index.mjs +19 -5
- package/dist/lib/neutral/capabilities/index.mjs.map +3 -3
- package/dist/lib/neutral/chunk-5BVHY75B.mjs +54 -0
- package/dist/lib/neutral/chunk-5BVHY75B.mjs.map +7 -0
- package/dist/lib/neutral/chunk-HNXSU7HJ.mjs +8 -0
- package/dist/lib/neutral/{chunk-KXJZEYS7.mjs.map → chunk-HNXSU7HJ.mjs.map} +2 -2
- package/dist/lib/neutral/chunk-KOXLGGSL.mjs +30 -0
- package/dist/lib/neutral/chunk-KOXLGGSL.mjs.map +7 -0
- package/dist/lib/neutral/chunk-MDV7NBFJ.mjs +182 -0
- package/dist/lib/neutral/chunk-MDV7NBFJ.mjs.map +7 -0
- package/dist/lib/neutral/components/index.mjs +114 -258
- package/dist/lib/neutral/components/index.mjs.map +4 -4
- package/dist/lib/neutral/containers/index.mjs +1 -1
- package/dist/lib/neutral/{create-RVR7VC33.mjs → create-HNHGCKZ4.mjs} +2 -2
- package/dist/lib/neutral/enrich-message-DSJU4TXC.mjs +24 -0
- package/dist/lib/neutral/enrich-message-DSJU4TXC.mjs.map +7 -0
- package/dist/lib/neutral/entity-lookup-PCDW7NC4.mjs +25 -0
- package/dist/lib/neutral/entity-lookup-PCDW7NC4.mjs.map +7 -0
- package/dist/lib/neutral/hooks/index.mjs +93 -15
- package/dist/lib/neutral/hooks/index.mjs.map +4 -4
- package/dist/lib/neutral/index.mjs +8 -32
- package/dist/lib/neutral/markdown-extension-CCDXXY7E.mjs +16 -0
- package/dist/lib/neutral/markdown-extension-CCDXXY7E.mjs.map +7 -0
- package/dist/lib/neutral/meta.json +1 -1
- package/dist/lib/neutral/meta.mjs +1 -1
- package/dist/lib/neutral/{open-A5KXKRH4.mjs → open-SNMZXXYO.mjs} +4 -6
- package/dist/lib/neutral/open-SNMZXXYO.mjs.map +7 -0
- package/dist/lib/neutral/operations/index.mjs +1 -1
- package/dist/lib/neutral/pipeline-status-XMWMAUJY.mjs +17 -0
- package/dist/lib/neutral/pipeline-status-XMWMAUJY.mjs.map +7 -0
- package/dist/lib/neutral/plugin.mjs +2 -2
- package/dist/lib/neutral/recording-session-IADO7ATU.mjs +15 -0
- package/dist/lib/neutral/recording-session-IADO7ATU.mjs.map +7 -0
- package/dist/lib/neutral/settings-7KE4MABW.mjs +31 -0
- package/dist/lib/neutral/settings-7KE4MABW.mjs.map +7 -0
- package/dist/lib/neutral/skill-definition-DXNK324V.mjs +15 -0
- package/dist/lib/neutral/skill-definition-DXNK324V.mjs.map +7 -0
- package/dist/lib/neutral/skills/index.mjs +8 -0
- package/dist/lib/neutral/{summarize-5XPPMVTE.mjs → summarize-LBUZTOTH.mjs} +4 -4
- package/dist/lib/neutral/summarize-LBUZTOTH.mjs.map +7 -0
- package/dist/lib/neutral/{text-content-KBB37HSM.mjs → text-content-NOWR642C.mjs} +9 -9
- package/dist/lib/neutral/text-content-NOWR642C.mjs.map +7 -0
- package/dist/lib/neutral/transcriber-6XZHUUHK.mjs +174 -0
- package/dist/lib/neutral/transcriber-6XZHUUHK.mjs.map +7 -0
- package/dist/lib/neutral/transcription-driver-DN6ELQXZ.mjs +207 -0
- package/dist/lib/neutral/transcription-driver-DN6ELQXZ.mjs.map +7 -0
- package/dist/lib/neutral/translations.mjs +8 -1
- package/dist/lib/neutral/translations.mjs.map +3 -3
- package/dist/lib/neutral/types/index.mjs +3 -1
- package/dist/types/dx.config.d.ts +28 -0
- package/dist/types/dx.config.d.ts.map +1 -0
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts +5 -0
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -0
- package/dist/types/src/capabilities/entity-lookup.d.ts +10 -0
- package/dist/types/src/capabilities/entity-lookup.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +11 -8
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/markdown-extension.d.ts +5 -0
- package/dist/types/src/capabilities/markdown-extension.d.ts.map +1 -0
- package/dist/types/src/capabilities/pipeline-status.d.ts +9 -0
- package/dist/types/src/capabilities/pipeline-status.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +2 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/recording-session.d.ts +5 -0
- package/dist/types/src/capabilities/recording-session.d.ts.map +1 -0
- package/dist/types/src/capabilities/settings.d.ts +5 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/capabilities/skill-definition.d.ts +5 -0
- package/dist/types/src/capabilities/skill-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/text-content.d.ts +1 -4
- 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/capabilities/transcription-driver.d.ts +5 -0
- package/dist/types/src/capabilities/transcription-driver.d.ts.map +1 -0
- package/dist/types/src/components/Mic/Mic.d.ts +12 -0
- package/dist/types/src/components/Mic/Mic.d.ts.map +1 -0
- package/dist/types/src/components/{Oracle/Oracle.stories.d.ts → Mic/Mic.stories.d.ts} +9 -7
- package/dist/types/src/components/Mic/Mic.stories.d.ts.map +1 -0
- package/dist/types/src/components/Mic/index.d.ts +2 -0
- package/dist/types/src/components/Mic/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -2
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.d.ts.map +1 -1
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.stories.d.ts +7 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.stories.d.ts.map +1 -1
- package/dist/types/src/hooks/index.d.ts +0 -5
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranscriptionRecording.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -3
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +32 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/normalization/message-normalizer.d.ts +2 -2
- package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -1
- package/dist/types/src/normalization/normalization.d.ts +98 -733
- package/dist/types/src/normalization/normalization.d.ts.map +1 -1
- package/dist/types/src/operations/enrich-message.d.ts +9 -0
- package/dist/types/src/operations/enrich-message.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/open.d.ts.map +1 -1
- package/dist/types/src/operations/summarize.d.ts.map +1 -1
- package/dist/types/src/skills/index.d.ts +2 -0
- package/dist/types/src/skills/index.d.ts.map +1 -0
- package/dist/types/src/skills/transcription-skill.d.ts +4 -0
- package/dist/types/src/skills/transcription-skill.d.ts.map +1 -0
- package/dist/types/src/stories/Keyword.stories.d.ts +51 -0
- package/dist/types/src/stories/Keyword.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Pipeline.stories.d.ts +60 -0
- package/dist/types/src/stories/Pipeline.stories.d.ts.map +1 -0
- package/dist/types/src/stories/Transcription.stories.d.ts +23 -0
- package/dist/types/src/stories/Transcription.stories.d.ts.map +1 -0
- package/dist/types/src/testing/decorators.d.ts +21 -0
- package/dist/types/src/testing/decorators.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +1 -0
- package/dist/types/src/testing/index.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +3 -13
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/{transcriber/transcription-manager.d.ts → transcription-manager.d.ts} +6 -5
- package/dist/types/src/transcription-manager.d.ts.map +1 -0
- package/dist/types/src/translations.d.ts +7 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/Settings.d.ts +13 -0
- package/dist/types/src/types/Settings.d.ts.map +1 -0
- package/dist/types/src/types/TranscriptOperation.d.ts +114 -1564
- package/dist/types/src/types/TranscriptOperation.d.ts.map +1 -1
- package/dist/types/src/types/TranscriptionCapabilities.d.ts +52 -11
- package/dist/types/src/types/TranscriptionCapabilities.d.ts.map +1 -1
- package/dist/types/src/types/index.d.ts +1 -0
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +0 -3
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dx.config.ts +42 -0
- package/package.json +69 -69
- package/src/TranscriptionPlugin.node.ts +2 -2
- package/src/TranscriptionPlugin.test.ts +2 -2
- package/src/TranscriptionPlugin.tsx +40 -3
- package/src/capabilities/app-graph-builder.tsx +49 -0
- package/src/capabilities/entity-lookup.ts +32 -0
- package/src/capabilities/index.ts +8 -7
- package/src/capabilities/markdown-extension.ts +17 -0
- package/src/capabilities/pipeline-status.ts +23 -0
- package/src/capabilities/recording-session.ts +17 -0
- package/src/capabilities/settings.ts +34 -0
- package/src/capabilities/skill-definition.ts +15 -0
- package/src/capabilities/text-content.ts +10 -7
- package/src/capabilities/transcriber.ts +5 -48
- package/src/capabilities/transcription-driver.tsx +263 -0
- package/src/components/Mic/Mic.stories.tsx +66 -0
- package/src/components/Mic/Mic.tsx +136 -0
- package/src/components/Mic/index.ts +5 -0
- package/src/components/index.ts +1 -2
- package/src/containers/TranscriptionArticle/TranscriptionArticle.stories.tsx +4 -0
- package/src/containers/TranscriptionArticle/TranscriptionArticle.tsx +5 -6
- package/src/hooks/index.ts +0 -5
- package/src/hooks/useTranscriptionRecording.ts +27 -9
- package/src/index.ts +1 -5
- package/src/meta.ts +2 -35
- package/src/normalization/message-normalizer.ts +3 -3
- package/src/normalization/normalization.ts +3 -0
- package/src/operations/enrich-message.ts +27 -0
- package/src/operations/index.ts +1 -0
- package/src/operations/open.ts +2 -2
- package/src/operations/summarize.ts +2 -2
- package/src/skills/index.ts +5 -0
- package/src/skills/transcription-skill.ts +29 -0
- package/src/stories/Keyword.stories.tsx +98 -0
- package/src/stories/Pipeline.stories.tsx +361 -0
- package/src/stories/Transcription.stories.tsx +178 -0
- package/src/testing/decorators.ts +78 -0
- package/src/testing/index.ts +1 -0
- package/src/testing/testing.ts +14 -134
- package/src/{transcriber/transcription-manager.ts → transcription-manager.ts} +13 -12
- package/src/translations.ts +9 -1
- package/src/types/Settings.ts +59 -0
- package/src/types/TranscriptOperation.ts +22 -4
- package/src/types/TranscriptionCapabilities.ts +61 -20
- package/src/types/index.ts +1 -0
- package/src/util/index.ts +0 -3
- package/dist/lib/neutral/TranscriptionArticle-L6XANBH5.mjs.map +0 -7
- package/dist/lib/neutral/blueprint-definition-DA4QFRYJ.mjs +0 -15
- package/dist/lib/neutral/blueprint-definition-DA4QFRYJ.mjs.map +0 -7
- package/dist/lib/neutral/blueprints/index.mjs +0 -8
- package/dist/lib/neutral/chunk-FHNI26QW.mjs +0 -45
- package/dist/lib/neutral/chunk-FHNI26QW.mjs.map +0 -7
- package/dist/lib/neutral/chunk-KAEXRX3Y.mjs +0 -35
- package/dist/lib/neutral/chunk-KAEXRX3Y.mjs.map +0 -7
- package/dist/lib/neutral/chunk-KMT3BMMQ.mjs +0 -124
- package/dist/lib/neutral/chunk-KMT3BMMQ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-KXJZEYS7.mjs +0 -8
- package/dist/lib/neutral/chunk-MLRJWAQH.mjs +0 -179
- package/dist/lib/neutral/chunk-MLRJWAQH.mjs.map +0 -7
- package/dist/lib/neutral/chunk-TO77KAQK.mjs +0 -298
- package/dist/lib/neutral/chunk-TO77KAQK.mjs.map +0 -7
- package/dist/lib/neutral/chunk-TX3NQISZ.mjs +0 -435
- package/dist/lib/neutral/chunk-TX3NQISZ.mjs.map +0 -7
- package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs +0 -30
- package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs.map +0 -7
- package/dist/lib/neutral/open-A5KXKRH4.mjs.map +0 -7
- package/dist/lib/neutral/summarize-5XPPMVTE.mjs.map +0 -7
- package/dist/lib/neutral/text-content-KBB37HSM.mjs.map +0 -7
- package/dist/lib/neutral/transcriber-OGSF3XO5.mjs +0 -59
- package/dist/lib/neutral/transcriber-OGSF3XO5.mjs.map +0 -7
- package/dist/types/src/blueprints/index.d.ts +0 -2
- package/dist/types/src/blueprints/index.d.ts.map +0 -1
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +0 -4
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +0 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -6
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/components/Oracle/Oracle.d.ts +0 -24
- package/dist/types/src/components/Oracle/Oracle.d.ts.map +0 -1
- package/dist/types/src/components/Oracle/Oracle.stories.d.ts.map +0 -1
- package/dist/types/src/components/Oracle/index.d.ts +0 -2
- package/dist/types/src/components/Oracle/index.d.ts.map +0 -1
- package/dist/types/src/components/Transcription/Transcription.d.ts +0 -11
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +0 -1
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +0 -37
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +0 -1
- package/dist/types/src/components/Transcription/index.d.ts +0 -2
- package/dist/types/src/components/Transcription/index.d.ts.map +0 -1
- package/dist/types/src/components/Transcription/transcription-extension.d.ts +0 -15
- package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +0 -1
- package/dist/types/src/enrichment/conversation.test.d.ts +0 -2
- package/dist/types/src/enrichment/conversation.test.d.ts.map +0 -1
- package/dist/types/src/enrichment/operations.d.ts +0 -200
- package/dist/types/src/enrichment/operations.d.ts.map +0 -1
- package/dist/types/src/enrichment/parser.d.ts +0 -26
- package/dist/types/src/enrichment/parser.d.ts.map +0 -1
- package/dist/types/src/enrichment/stream-simulator.d.ts +0 -38
- package/dist/types/src/enrichment/stream-simulator.d.ts.map +0 -1
- package/dist/types/src/hooks/useAudioFile.d.ts +0 -7
- package/dist/types/src/hooks/useAudioFile.d.ts.map +0 -1
- package/dist/types/src/hooks/useAudioTrack.d.ts +0 -5
- package/dist/types/src/hooks/useAudioTrack.d.ts.map +0 -1
- package/dist/types/src/hooks/useFeedModelAdapter.d.ts +0 -12
- package/dist/types/src/hooks/useFeedModelAdapter.d.ts.map +0 -1
- package/dist/types/src/hooks/useTranscriber.d.ts +0 -7
- package/dist/types/src/hooks/useTranscriber.d.ts.map +0 -1
- package/dist/types/src/hooks/useVoiceInput.d.ts +0 -11
- package/dist/types/src/hooks/useVoiceInput.d.ts.map +0 -1
- package/dist/types/src/model/index.d.ts +0 -2
- package/dist/types/src/model/index.d.ts.map +0 -1
- package/dist/types/src/model/model.d.ts +0 -68
- package/dist/types/src/model/model.d.ts.map +0 -1
- package/dist/types/src/model/model.test.d.ts +0 -2
- package/dist/types/src/model/model.test.d.ts.map +0 -1
- package/dist/types/src/stories/FileTranscription.stories.d.ts +0 -20
- package/dist/types/src/stories/FileTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts +0 -14
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +0 -1
- package/dist/types/src/stories/LiveTranscription.stories.d.ts +0 -20
- package/dist/types/src/stories/LiveTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/stories/TranscriptionStory.d.ts +0 -21
- package/dist/types/src/stories/TranscriptionStory.d.ts.map +0 -1
- package/dist/types/src/stories/common.d.ts +0 -248
- package/dist/types/src/stories/common.d.ts.map +0 -1
- package/dist/types/src/transcriber/audio-recorder.d.ts +0 -47
- package/dist/types/src/transcriber/audio-recorder.d.ts.map +0 -1
- package/dist/types/src/transcriber/index.d.ts +0 -5
- package/dist/types/src/transcriber/index.d.ts.map +0 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +0 -30
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +0 -1
- package/dist/types/src/transcriber/transcriber.browser.test.d.ts +0 -2
- package/dist/types/src/transcriber/transcriber.browser.test.d.ts.map +0 -1
- package/dist/types/src/transcriber/transcriber.d.ts +0 -105
- package/dist/types/src/transcriber/transcriber.d.ts.map +0 -1
- package/dist/types/src/transcriber/transcriber.test.d.ts +0 -2
- package/dist/types/src/transcriber/transcriber.test.d.ts.map +0 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +0 -1
- package/dist/types/src/util/array.d.ts +0 -2
- package/dist/types/src/util/array.d.ts.map +0 -1
- package/dist/types/src/util/monitor-audio-level.d.ts +0 -6
- package/dist/types/src/util/monitor-audio-level.d.ts.map +0 -1
- package/dist/types/src/util/render-byline.d.ts +0 -4
- package/dist/types/src/util/render-byline.d.ts.map +0 -1
- package/src/blueprints/index.ts +0 -5
- package/src/blueprints/transcription-blueprint.ts +0 -29
- package/src/capabilities/blueprint-definition.ts +0 -19
- package/src/components/Oracle/Oracle.stories.tsx +0 -147
- package/src/components/Oracle/Oracle.tsx +0 -142
- package/src/components/Oracle/index.ts +0 -5
- package/src/components/Transcription/Transcription.stories.tsx +0 -213
- package/src/components/Transcription/Transcription.tsx +0 -55
- package/src/components/Transcription/index.ts +0 -5
- package/src/components/Transcription/transcription-extension.ts +0 -203
- package/src/enrichment/conversation.test.ts +0 -162
- package/src/enrichment/conversation.txt +0 -23
- package/src/enrichment/operations.ts +0 -271
- package/src/enrichment/parser.ts +0 -101
- package/src/enrichment/stream-simulator.ts +0 -125
- package/src/hooks/useAudioFile.ts +0 -88
- package/src/hooks/useAudioTrack.ts +0 -35
- package/src/hooks/useFeedModelAdapter.ts +0 -46
- package/src/hooks/useTranscriber.ts +0 -47
- package/src/hooks/useVoiceInput.ts +0 -66
- package/src/model/index.ts +0 -5
- package/src/model/model.test.ts +0 -175
- package/src/model/model.ts +0 -229
- package/src/stories/FileTranscription.stories.tsx +0 -143
- package/src/stories/KeyWordRecognition.stories.tsx +0 -132
- package/src/stories/LiveTranscription.stories.tsx +0 -153
- package/src/stories/TranscriptionStory.tsx +0 -101
- package/src/stories/common.ts +0 -233
- package/src/transcriber/audio-recorder.ts +0 -56
- package/src/transcriber/index.ts +0 -8
- package/src/transcriber/media-stream-recorder.ts +0 -120
- package/src/transcriber/transcriber.browser.test.ts +0 -230
- package/src/transcriber/transcriber.test.ts +0 -104
- package/src/transcriber/transcriber.ts +0 -303
- package/src/util/array.ts +0 -14
- package/src/util/monitor-audio-level.ts +0 -58
- package/src/util/render-byline.ts +0 -33
- /package/dist/lib/neutral/{create-RVR7VC33.mjs.map → create-HNHGCKZ4.mjs.map} +0 -0
- /package/dist/lib/neutral/{blueprints → skills}/index.mjs.map +0 -0
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-J5LGTIGS.mjs";
|
|
4
|
-
|
|
5
|
-
// src/types/TranscriptionCapabilities.ts
|
|
6
|
-
var TranscriptionCapabilities_exports = {};
|
|
7
|
-
__export(TranscriptionCapabilities_exports, {
|
|
8
|
-
TranscriberProvider: () => TranscriberProvider,
|
|
9
|
-
TranscriptionManagerProvider: () => TranscriptionManagerProvider
|
|
10
|
-
});
|
|
11
|
-
import { Capability } from "@dxos/app-framework";
|
|
12
|
-
import { meta } from "#meta";
|
|
13
|
-
var TranscriberProvider = Capability.make(`${meta.id}.capability.transcriber`);
|
|
14
|
-
var TranscriptionManagerProvider = Capability.make(`${meta.id}.capability.transcription-manager`);
|
|
15
|
-
|
|
16
|
-
// src/types/TranscriptOperation.ts
|
|
17
|
-
var TranscriptOperation_exports = {};
|
|
18
|
-
__export(TranscriptOperation_exports, {
|
|
19
|
-
Create: () => Create,
|
|
20
|
-
MessageWithRangeId: () => MessageWithRangeId,
|
|
21
|
-
Open: () => Open,
|
|
22
|
-
SentenceNormalization: () => SentenceNormalization,
|
|
23
|
-
SentenceNormalizationInput: () => SentenceNormalizationInput,
|
|
24
|
-
SentenceNormalizationOutput: () => SentenceNormalizationOutput,
|
|
25
|
-
Summarize: () => Summarize
|
|
26
|
-
});
|
|
27
|
-
import * as Schema from "effect/Schema";
|
|
28
|
-
import { AiService } from "@dxos/ai";
|
|
29
|
-
import { SpaceSchema } from "@dxos/client/echo";
|
|
30
|
-
import { Operation } from "@dxos/compute";
|
|
31
|
-
import { Database, Feed, Ref, Type, DXN } from "@dxos/echo";
|
|
32
|
-
import { Message, Transcript } from "@dxos/types";
|
|
33
|
-
import { meta as meta2 } from "#meta";
|
|
34
|
-
var makeKey = (name) => DXN.make(`${meta2.id}.operation.${name}`);
|
|
35
|
-
var Create = Operation.make({
|
|
36
|
-
meta: {
|
|
37
|
-
key: makeKey("create"),
|
|
38
|
-
name: "Create Transcript",
|
|
39
|
-
icon: "ph--microphone--regular"
|
|
40
|
-
},
|
|
41
|
-
input: Schema.Struct({
|
|
42
|
-
name: Schema.optional(Schema.String),
|
|
43
|
-
space: SpaceSchema
|
|
44
|
-
}),
|
|
45
|
-
output: Schema.Struct({
|
|
46
|
-
object: Type.getSchema(Transcript.Transcript)
|
|
47
|
-
})
|
|
48
|
-
});
|
|
49
|
-
var MessageWithRangeId = Schema.extend(Type.getSchema(Message.Message), Schema.Struct({
|
|
50
|
-
rangeId: Schema.optional(Schema.Array(Schema.String)).annotations({
|
|
51
|
-
description: "The IDs of the messages that contain the sentences."
|
|
52
|
-
})
|
|
53
|
-
}));
|
|
54
|
-
var Open = Operation.make({
|
|
55
|
-
meta: {
|
|
56
|
-
key: DXN.make("org.dxos.function.transcription.open"),
|
|
57
|
-
name: "Open",
|
|
58
|
-
description: "Opens and reads the contents of a transcription object.",
|
|
59
|
-
icon: "ph--folder-open--regular"
|
|
60
|
-
},
|
|
61
|
-
input: Schema.Struct({
|
|
62
|
-
transcript: Ref.Ref(Transcript.Transcript).annotations({
|
|
63
|
-
description: "The ID of the transcription object."
|
|
64
|
-
})
|
|
65
|
-
}),
|
|
66
|
-
output: Schema.Struct({
|
|
67
|
-
content: Schema.String
|
|
68
|
-
}),
|
|
69
|
-
services: [
|
|
70
|
-
Database.Service,
|
|
71
|
-
Feed.FeedService
|
|
72
|
-
]
|
|
73
|
-
});
|
|
74
|
-
var Summarize = Operation.make({
|
|
75
|
-
meta: {
|
|
76
|
-
key: DXN.make("org.dxos.function.transcription.summarize"),
|
|
77
|
-
name: "Summarize",
|
|
78
|
-
description: "Summarize a transcript of a meeting.",
|
|
79
|
-
icon: "ph--text-align-left--regular"
|
|
80
|
-
},
|
|
81
|
-
input: Schema.Struct({
|
|
82
|
-
transcript: Schema.String.annotations({
|
|
83
|
-
description: "The transcript of the meeting."
|
|
84
|
-
}),
|
|
85
|
-
notes: Schema.optional(Schema.String).annotations({
|
|
86
|
-
description: "Additional notes from the participants."
|
|
87
|
-
})
|
|
88
|
-
}),
|
|
89
|
-
output: Schema.Struct({
|
|
90
|
-
summary: Schema.String.annotations({
|
|
91
|
-
description: "The summary of the transcript."
|
|
92
|
-
})
|
|
93
|
-
}),
|
|
94
|
-
services: [
|
|
95
|
-
AiService.AiService
|
|
96
|
-
]
|
|
97
|
-
});
|
|
98
|
-
var SentenceNormalizationInput = Schema.Struct({
|
|
99
|
-
messages: Schema.Array(MessageWithRangeId).annotations({
|
|
100
|
-
description: "Messages to normalize into sentences."
|
|
101
|
-
})
|
|
102
|
-
});
|
|
103
|
-
var SentenceNormalizationOutput = Schema.Struct({
|
|
104
|
-
sentences: Schema.Array(MessageWithRangeId.pipe(Schema.mutable)).pipe(Schema.mutable).annotations({
|
|
105
|
-
description: "The sentences of the transcript."
|
|
106
|
-
})
|
|
107
|
-
});
|
|
108
|
-
var SentenceNormalization = Operation.make({
|
|
109
|
-
meta: {
|
|
110
|
-
key: DXN.make("org.dxos.function.transcription.sentenceNormalization"),
|
|
111
|
-
name: "Sentence Normalization",
|
|
112
|
-
description: "Post process of transcription for sentence normalization",
|
|
113
|
-
icon: "ph--text-t--regular"
|
|
114
|
-
},
|
|
115
|
-
input: SentenceNormalizationInput,
|
|
116
|
-
output: SentenceNormalizationOutput,
|
|
117
|
-
services: []
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
export {
|
|
121
|
-
TranscriptionCapabilities_exports,
|
|
122
|
-
TranscriptOperation_exports
|
|
123
|
-
};
|
|
124
|
-
//# sourceMappingURL=chunk-KMT3BMMQ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/types/TranscriptionCapabilities.ts", "../../../src/types/TranscriptOperation.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport { Capability } from '@dxos/app-framework';\n\nimport { meta } from '#meta';\n\nimport {\n type MediaStreamRecorderProps,\n type Transcriber as TranscriberType,\n type TranscriberProps,\n type TranscriptMessageEnricher,\n type TranscriptionManager as TranscriptionManagerType,\n} from '../transcriber';\n\nexport type TranscriberProviderProps = {\n audioStreamTrack: MediaStreamTrack;\n recorderConfig?: Partial<MediaStreamRecorderProps['config']>;\n transcriberConfig?: Partial<TranscriberProps['config']>;\n onSegments: TranscriberProps['onSegments'];\n transcribe?: TranscriberProps['transcribe'];\n};\n\nexport type TranscriberProvider = (props: TranscriberProviderProps) => TranscriberType;\n\nexport type TranscriptionManagerProviderProps = {\n messageEnricher?: TranscriptMessageEnricher;\n};\n\nexport type TranscriptionManagerProvider = (props: TranscriptionManagerProviderProps) => TranscriptionManagerType;\n\nexport const TranscriberProvider = Capability.make<TranscriberProvider>(`${meta.id}.capability.transcriber`);\n\nexport const TranscriptionManagerProvider = Capability.make<TranscriptionManagerProvider>(\n `${meta.id}.capability.transcription-manager`,\n);\n", "//\n// Copyright 2025 DXOS.org\n//\n\n// @import-as-namespace\n\nimport * as Schema from 'effect/Schema';\n\nimport { AiService } from '@dxos/ai';\nimport { SpaceSchema } from '@dxos/client/echo';\nimport { Operation } from '@dxos/compute';\nimport { Database, Feed, Ref, Type, DXN } from '@dxos/echo';\nimport { Message, Transcript } from '@dxos/types';\n\nimport { meta } from '#meta';\n\nconst makeKey = (name: string) => DXN.make(`${meta.id}.operation.${name}`);\n\nexport const Create = Operation.make({\n meta: { key: makeKey('create'), name: 'Create Transcript', icon: 'ph--microphone--regular' },\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n space: SpaceSchema,\n }),\n output: Schema.Struct({\n object: Type.getSchema(Transcript.Transcript),\n }),\n});\n\nexport const MessageWithRangeId = Schema.extend(\n Type.getSchema(Message.Message),\n Schema.Struct({\n rangeId: Schema.optional(Schema.Array(Schema.String)).annotations({\n description: 'The IDs of the messages that contain the sentences.',\n }),\n }),\n);\n\nexport type MessageWithRangeIdType = Schema.Schema.Type<typeof MessageWithRangeId>;\n\nexport const Open = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.transcription.open'),\n name: 'Open',\n description: 'Opens and reads the contents of a transcription object.',\n icon: 'ph--folder-open--regular',\n },\n input: Schema.Struct({\n transcript: Ref.Ref(Transcript.Transcript).annotations({\n description: 'The ID of the transcription object.',\n }),\n }),\n output: Schema.Struct({\n content: Schema.String,\n }),\n services: [Database.Service, Feed.FeedService],\n});\n\nexport const Summarize = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.transcription.summarize'),\n name: 'Summarize',\n description: 'Summarize a transcript of a meeting.',\n icon: 'ph--text-align-left--regular',\n },\n input: Schema.Struct({\n transcript: Schema.String.annotations({\n description: 'The transcript of the meeting.',\n }),\n notes: Schema.optional(Schema.String).annotations({\n description: 'Additional notes from the participants.',\n }),\n }),\n output: Schema.Struct({\n summary: Schema.String.annotations({\n description: 'The summary of the transcript.',\n }),\n }),\n services: [AiService.AiService],\n});\n\nexport const SentenceNormalizationInput = Schema.Struct({\n messages: Schema.Array(MessageWithRangeId).annotations({\n description: 'Messages to normalize into sentences.',\n }),\n});\n\nexport type SentenceNormalizationInputType = Schema.Schema.Type<typeof SentenceNormalizationInput>;\n\nexport const SentenceNormalizationOutput = Schema.Struct({\n sentences: Schema.Array(MessageWithRangeId.pipe(Schema.mutable)).pipe(Schema.mutable).annotations({\n description: 'The sentences of the transcript.',\n }),\n});\n\nexport const SentenceNormalization = Operation.make({\n meta: {\n key: DXN.make('org.dxos.function.transcription.sentenceNormalization'),\n name: 'Sentence Normalization',\n description: 'Post process of transcription for sentence normalization',\n icon: 'ph--text-t--regular',\n },\n input: SentenceNormalizationInput,\n output: SentenceNormalizationOutput,\n services: [],\n});\n"],
|
|
5
|
-
"mappings": ";;;;;AAAA;;;;;AAMA,SAASA,kBAAkB;AAE3B,SAASC,YAAY;AA0Bd,IAAMC,sBAAsBF,WAAWG,KAA0B,GAAGF,KAAKG,EAAE,yBAAyB;AAEpG,IAAMC,+BAA+BL,WAAWG,KACrD,GAAGF,KAAKG,EAAE,mCAAmC;;;ACrC/C;;;;;;;;;;AAMA,YAAYE,YAAY;AAExB,SAASC,iBAAiB;AAC1B,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAC1B,SAASC,UAAUC,MAAMC,KAAKC,MAAMC,WAAW;AAC/C,SAASC,SAASC,kBAAkB;AAEpC,SAASC,QAAAA,aAAY;AAErB,IAAMC,UAAU,CAACC,SAAiBL,IAAIM,KAAK,GAAGH,MAAKI,EAAE,cAAcF,IAAAA,EAAM;AAElE,IAAMG,SAASb,UAAUW,KAAK;EACnCH,MAAM;IAAEM,KAAKL,QAAQ,QAAA;IAAWC,MAAM;IAAqBK,MAAM;EAA0B;EAC3FC,OAAcC,cAAO;IACnBP,MAAaQ,gBAAgBC,aAAM;IACnCC,OAAOrB;EACT,CAAA;EACAsB,QAAeJ,cAAO;IACpBK,QAAQlB,KAAKmB,UAAUhB,WAAWA,UAAU;EAC9C,CAAA;AACF,CAAA;AAEO,IAAMiB,qBAA4BC,cACvCrB,KAAKmB,UAAUjB,QAAQA,OAAO,GACvBW,cAAO;EACZS,SAAgBR,gBAAgBS,aAAaR,aAAM,CAAA,EAAGS,YAAY;IAChEC,aAAa;EACf,CAAA;AACF,CAAA,CAAA;AAKK,IAAMC,OAAO9B,UAAUW,KAAK;EACjCH,MAAM;IACJM,KAAKT,IAAIM,KAAK,sCAAA;IACdD,MAAM;IACNmB,aAAa;IACbd,MAAM;EACR;EACAC,OAAcC,cAAO;IACnBc,YAAY5B,IAAIA,IAAII,WAAWA,UAAU,EAAEqB,YAAY;MACrDC,aAAa;IACf,CAAA;EACF,CAAA;EACAR,QAAeJ,cAAO;IACpBe,SAAgBb;EAClB,CAAA;EACAc,UAAU;IAAChC,SAASiC;IAAShC,KAAKiC;;AACpC,CAAA;AAEO,IAAMC,YAAYpC,UAAUW,KAAK;EACtCH,MAAM;IACJM,KAAKT,IAAIM,KAAK,2CAAA;IACdD,MAAM;IACNmB,aAAa;IACbd,MAAM;EACR;EACAC,OAAcC,cAAO;IACnBc,YAAmBZ,cAAOS,YAAY;MACpCC,aAAa;IACf,CAAA;IACAQ,OAAcnB,gBAAgBC,aAAM,EAAES,YAAY;MAChDC,aAAa;IACf,CAAA;EACF,CAAA;EACAR,QAAeJ,cAAO;IACpBqB,SAAgBnB,cAAOS,YAAY;MACjCC,aAAa;IACf,CAAA;EACF,CAAA;EACAI,UAAU;IAACnC,UAAUA;;AACvB,CAAA;AAEO,IAAMyC,6BAAoCtB,cAAO;EACtDuB,UAAiBb,aAAMH,kBAAAA,EAAoBI,YAAY;IACrDC,aAAa;EACf,CAAA;AACF,CAAA;AAIO,IAAMY,8BAAqCxB,cAAO;EACvDyB,WAAkBf,aAAMH,mBAAmBmB,KAAYC,cAAO,CAAA,EAAGD,KAAYC,cAAO,EAAEhB,YAAY;IAChGC,aAAa;EACf,CAAA;AACF,CAAA;AAEO,IAAMgB,wBAAwB7C,UAAUW,KAAK;EAClDH,MAAM;IACJM,KAAKT,IAAIM,KAAK,uDAAA;IACdD,MAAM;IACNmB,aAAa;IACbd,MAAM;EACR;EACAC,OAAOuB;EACPlB,QAAQoB;EACRR,UAAU,CAAA;AACZ,CAAA;",
|
|
6
|
-
"names": ["Capability", "meta", "TranscriberProvider", "make", "id", "TranscriptionManagerProvider", "Schema", "AiService", "SpaceSchema", "Operation", "Database", "Feed", "Ref", "Type", "DXN", "Message", "Transcript", "meta", "makeKey", "name", "make", "id", "Create", "key", "icon", "input", "Struct", "optional", "String", "space", "output", "object", "getSchema", "MessageWithRangeId", "extend", "rangeId", "Array", "annotations", "description", "Open", "transcript", "content", "services", "Service", "FeedService", "Summarize", "notes", "summary", "SentenceNormalizationInput", "messages", "SentenceNormalizationOutput", "sentences", "pipe", "mutable", "SentenceNormalization"]
|
|
7
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// src/operations/index.ts
|
|
2
|
-
import { OperationHandlerSet } from "@dxos/compute";
|
|
3
|
-
var TranscriptionOperationHandlerSet = OperationHandlerSet.lazy(() => import("./create-RVR7VC33.mjs"), () => import("./open-A5KXKRH4.mjs"), () => import("./summarize-5XPPMVTE.mjs"));
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
TranscriptionOperationHandlerSet
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=chunk-KXJZEYS7.mjs.map
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
// src/model/model.ts
|
|
2
|
-
import { Text } from "@codemirror/state";
|
|
3
|
-
import { Event } from "@dxos/async";
|
|
4
|
-
import { invariant } from "@dxos/invariant";
|
|
5
|
-
import { log } from "@dxos/log";
|
|
6
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/model/model.ts";
|
|
7
|
-
var DocumentAdapter = class {
|
|
8
|
-
_view;
|
|
9
|
-
constructor(_view) {
|
|
10
|
-
this._view = _view;
|
|
11
|
-
}
|
|
12
|
-
/** The document must always have at least one line. */
|
|
13
|
-
lineCount() {
|
|
14
|
-
return this._view.state.doc.lines - 1;
|
|
15
|
-
}
|
|
16
|
-
replaceLines(from, remove, insert) {
|
|
17
|
-
log("replaceLines", {
|
|
18
|
-
count: this._view.state.doc.lines,
|
|
19
|
-
from,
|
|
20
|
-
remove,
|
|
21
|
-
insert
|
|
22
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 19, S: this });
|
|
23
|
-
const numLines = this._view.state.doc.lines;
|
|
24
|
-
const posFrom = this._view.state.doc.line(from).from;
|
|
25
|
-
const posTo = remove === 0 ? posFrom : this._view.state.doc.line(Math.min(numLines, from + remove)).from;
|
|
26
|
-
let text = insert.join("\n");
|
|
27
|
-
if (posTo === this._view.state.doc.length) {
|
|
28
|
-
text += "\n";
|
|
29
|
-
}
|
|
30
|
-
this._view.dispatch({
|
|
31
|
-
changes: {
|
|
32
|
-
from: posFrom,
|
|
33
|
-
to: posTo,
|
|
34
|
-
insert: text
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var SerializationModel = class {
|
|
40
|
-
_renderer;
|
|
41
|
-
/** Emits when the document is updated. */
|
|
42
|
-
update = new Event();
|
|
43
|
-
/** Ordered set of chunks. */
|
|
44
|
-
_chunks = [];
|
|
45
|
-
/** Map of chunk IDs to their current line counts. */
|
|
46
|
-
_chunkLineCounts = /* @__PURE__ */ new Map();
|
|
47
|
-
/** Map of line numbers to chunk IDs. */
|
|
48
|
-
_lineToChunk = /* @__PURE__ */ new Map();
|
|
49
|
-
/** Track chunk changes since last sync. */
|
|
50
|
-
_changes = [];
|
|
51
|
-
constructor(_renderer, initialChunks = []) {
|
|
52
|
-
this._renderer = _renderer;
|
|
53
|
-
initialChunks.forEach((chunk) => {
|
|
54
|
-
this.appendChunk(chunk);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
toJSON() {
|
|
58
|
-
return {
|
|
59
|
-
chunks: this._chunks.length,
|
|
60
|
-
changes: this._changes.length
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
get doc() {
|
|
64
|
-
return Text.of([
|
|
65
|
-
...this._chunks.flatMap((chunk, index) => this._renderer(chunk, index)),
|
|
66
|
-
""
|
|
67
|
-
]);
|
|
68
|
-
}
|
|
69
|
-
get chunks() {
|
|
70
|
-
return this._chunks;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Get the block ID at the given line number.
|
|
74
|
-
*/
|
|
75
|
-
getChunkAtLine(line) {
|
|
76
|
-
return this._lineToChunk.get(line);
|
|
77
|
-
}
|
|
78
|
-
reset() {
|
|
79
|
-
this._chunks.length = 0;
|
|
80
|
-
this._chunkLineCounts.clear();
|
|
81
|
-
this._lineToChunk.clear();
|
|
82
|
-
this.update.emit();
|
|
83
|
-
return this;
|
|
84
|
-
}
|
|
85
|
-
appendChunk(chunk) {
|
|
86
|
-
const index = this._chunks.length;
|
|
87
|
-
this._chunks.push(chunk);
|
|
88
|
-
this._changes.push({
|
|
89
|
-
type: "append",
|
|
90
|
-
index,
|
|
91
|
-
chunk
|
|
92
|
-
});
|
|
93
|
-
this.update.emit();
|
|
94
|
-
return this;
|
|
95
|
-
}
|
|
96
|
-
updateChunk(chunk) {
|
|
97
|
-
const index = this._chunks.findIndex((c) => c.id === chunk.id);
|
|
98
|
-
invariant(index !== -1, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 102, S: this, A: ["index !== -1", ""] });
|
|
99
|
-
this._chunks[index] = chunk;
|
|
100
|
-
this._changes.push({
|
|
101
|
-
type: "update",
|
|
102
|
-
index,
|
|
103
|
-
chunk
|
|
104
|
-
});
|
|
105
|
-
this.update.emit();
|
|
106
|
-
return this;
|
|
107
|
-
}
|
|
108
|
-
deleteBlock(id) {
|
|
109
|
-
const index = this._chunks.findIndex((c) => c.id === id);
|
|
110
|
-
invariant(index !== -1, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 114, S: this, A: ["index !== -1", ""] });
|
|
111
|
-
this._chunks.splice(index, 1);
|
|
112
|
-
this._changes.push({
|
|
113
|
-
type: "delete",
|
|
114
|
-
index,
|
|
115
|
-
id
|
|
116
|
-
});
|
|
117
|
-
this.update.emit();
|
|
118
|
-
return this;
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Syncs the tracked changes with the ChunkDocument.
|
|
122
|
-
*/
|
|
123
|
-
sync(document) {
|
|
124
|
-
log("sync", {
|
|
125
|
-
changes: this._changes
|
|
126
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 127, S: this });
|
|
127
|
-
for (const change of this._changes) {
|
|
128
|
-
switch (change.type) {
|
|
129
|
-
case "append": {
|
|
130
|
-
const lines = this._renderer(change.chunk, change.index);
|
|
131
|
-
const lastLine = document.lineCount();
|
|
132
|
-
document.replaceLines(lastLine + 1, 0, lines);
|
|
133
|
-
break;
|
|
134
|
-
}
|
|
135
|
-
case "update": {
|
|
136
|
-
let lineStart = 1;
|
|
137
|
-
for (let i = 0; i < change.index; i++) {
|
|
138
|
-
lineStart += this._chunkLineCounts.get(this._chunks[i].id);
|
|
139
|
-
}
|
|
140
|
-
const previousLineCount = this._chunkLineCounts.get(change.chunk.id);
|
|
141
|
-
const newLines = this._renderer(change.chunk, change.index);
|
|
142
|
-
document.replaceLines(lineStart, previousLineCount, newLines);
|
|
143
|
-
break;
|
|
144
|
-
}
|
|
145
|
-
case "delete": {
|
|
146
|
-
let lineStart = 1;
|
|
147
|
-
for (let i = 0; i < change.index; i++) {
|
|
148
|
-
lineStart += this._chunkLineCounts.get(this._chunks[i].id);
|
|
149
|
-
}
|
|
150
|
-
const previousLineCount = this._chunkLineCounts.get(change.id);
|
|
151
|
-
document.replaceLines(lineStart, previousLineCount, []);
|
|
152
|
-
break;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
this._lineToChunk.clear();
|
|
157
|
-
let currentLine = 1;
|
|
158
|
-
for (const [index, chunk] of this._chunks.entries()) {
|
|
159
|
-
const lineCount = this._renderer(chunk, index).length;
|
|
160
|
-
this._chunkLineCounts.set(chunk.id, lineCount);
|
|
161
|
-
this._lineToChunk.set(currentLine, chunk);
|
|
162
|
-
currentLine += lineCount;
|
|
163
|
-
}
|
|
164
|
-
const chunkIds = new Set(this._chunks.map((chunk) => chunk.id));
|
|
165
|
-
for (const id of this._chunkLineCounts.keys()) {
|
|
166
|
-
if (!chunkIds.has(id)) {
|
|
167
|
-
this._chunkLineCounts.delete(id);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
this._changes.length = 0;
|
|
171
|
-
return this;
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
export {
|
|
176
|
-
DocumentAdapter,
|
|
177
|
-
SerializationModel
|
|
178
|
-
};
|
|
179
|
-
//# sourceMappingURL=chunk-MLRJWAQH.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/model/model.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Text } from '@codemirror/state';\nimport { type EditorView } from '@codemirror/view';\n\nimport { Event } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\n\nexport type Chunk = { id: string };\n\n/**\n * Covert block to a set of markdown lines.\n */\nexport type ChunkRenderer<T extends Chunk> = (chunk: T, index: number, debug?: boolean) => string[];\n\n/**\n * Abstract representation of the document model.\n */\nexport interface ChunkDocument {\n lineCount(): number;\n replaceLines(from: number, remove: number, insert: string[]): void;\n}\n\n/**\n * Codemirror document adapter.\n */\nexport class DocumentAdapter implements ChunkDocument {\n constructor(private readonly _view: EditorView) {}\n\n /** The document must always have at least one line. */\n lineCount(): number {\n return this._view.state.doc.lines - 1;\n }\n\n replaceLines(from: number, remove: number, insert: string[]): void {\n log('replaceLines', { count: this._view.state.doc.lines, from, remove, insert });\n\n const numLines = this._view.state.doc.lines;\n const posFrom = this._view.state.doc.line(from).from;\n const posTo = remove === 0 ? posFrom : this._view.state.doc.line(Math.min(numLines, from + remove)).from;\n\n // Don't remove the last line.\n let text = insert.join('\\n');\n if (posTo === this._view.state.doc.length) {\n text += '\\n';\n }\n\n this._view.dispatch({\n changes: { from: posFrom, to: posTo, insert: text },\n });\n }\n}\n\ntype ChunkChange<T extends Chunk> =\n | {\n type: 'append';\n index: number;\n chunk: T;\n }\n | {\n type: 'update';\n index: number;\n chunk: T;\n }\n | {\n type: 'delete';\n index: number;\n id: string;\n };\n\n/**\n * Each Chunk can be converted into a set of lines.\n * Chunks can be added, updated or deleted from the Queue.\n * A Document is an immutable projection that represents a flat list of lines corresponding to the Queue.\n *\n * Ideally we would implement a custom virtual Text model for the View, but this currently isn't possible in Codemirror.\n * Instead this model tracks changes and syncs them with the ChunkDocument.\n */\nexport class SerializationModel<T extends Chunk> {\n /** Emits when the document is updated. */\n public readonly update = new Event<void>();\n\n /** Ordered set of chunks. */\n private readonly _chunks: T[] = [];\n\n /** Map of chunk IDs to their current line counts. */\n private readonly _chunkLineCounts = new Map<string, number>();\n\n /** Map of line numbers to chunk IDs. */\n private readonly _lineToChunk = new Map<number, T>();\n\n /** Track chunk changes since last sync. */\n private readonly _changes: Array<ChunkChange<T>> = [];\n\n constructor(\n private readonly _renderer: ChunkRenderer<T>,\n initialChunks: T[] = [],\n ) {\n initialChunks.forEach((chunk) => {\n this.appendChunk(chunk);\n });\n }\n\n toJSON(): { chunks: number; changes: number } {\n return {\n chunks: this._chunks.length,\n changes: this._changes.length,\n };\n }\n\n get doc() {\n return Text.of([...this._chunks.flatMap((chunk, index) => this._renderer(chunk, index)), '']);\n }\n\n get chunks() {\n return this._chunks;\n }\n\n /**\n * Get the block ID at the given line number.\n */\n getChunkAtLine(line: number): T | undefined {\n return this._lineToChunk.get(line);\n }\n\n reset(): this {\n this._chunks.length = 0;\n this._chunkLineCounts.clear();\n this._lineToChunk.clear();\n this.update.emit();\n return this;\n }\n\n appendChunk(chunk: T): this {\n const index = this._chunks.length;\n this._chunks.push(chunk);\n this._changes.push({ type: 'append', index, chunk });\n this.update.emit();\n return this;\n }\n\n updateChunk(chunk: T): this {\n const index = this._chunks.findIndex((c) => c.id === chunk.id);\n invariant(index !== -1);\n this._chunks[index] = chunk;\n this._changes.push({ type: 'update', index, chunk });\n this.update.emit();\n return this;\n }\n\n deleteBlock(id: string): this {\n const index = this._chunks.findIndex((c) => c.id === id);\n invariant(index !== -1);\n this._chunks.splice(index, 1);\n this._changes.push({ type: 'delete', index, id });\n this.update.emit();\n return this;\n }\n\n /**\n * Syncs the tracked changes with the ChunkDocument.\n */\n sync(document: ChunkDocument): this {\n log('sync', { changes: this._changes });\n\n // Process each change in order.\n for (const change of this._changes) {\n switch (change.type) {\n case 'append': {\n // For appends, convert block to lines and add at the end.\n const lines = this._renderer(change.chunk, change.index);\n const lastLine = document.lineCount();\n document.replaceLines(lastLine + 1, 0, lines);\n break;\n }\n\n case 'update': {\n // For updates, find the block's line range and replace with new lines.\n let lineStart = 1;\n for (let i = 0; i < change.index; i++) {\n lineStart += this._chunkLineCounts.get(this._chunks[i].id)!;\n }\n const previousLineCount = this._chunkLineCounts.get(change.chunk.id)!;\n const newLines = this._renderer(change.chunk, change.index);\n document.replaceLines(lineStart, previousLineCount, newLines);\n break;\n }\n\n case 'delete': {\n // For deletes, find the block's line range and remove those lines.\n let lineStart = 1;\n for (let i = 0; i < change.index; i++) {\n lineStart += this._chunkLineCounts.get(this._chunks[i].id)!;\n }\n const previousLineCount = this._chunkLineCounts.get(change.id)!;\n document.replaceLines(lineStart, previousLineCount, []);\n break;\n }\n }\n }\n\n // Clear the line-to-block mapping.\n this._lineToChunk.clear();\n\n // Update all block line counts and line-to-block mapping after processing changes.\n let currentLine = 1;\n for (const [index, chunk] of this._chunks.entries()) {\n const lineCount = this._renderer(chunk, index).length;\n this._chunkLineCounts.set(chunk.id, lineCount);\n this._lineToChunk.set(currentLine, chunk);\n currentLine += lineCount;\n }\n\n // Clean up deleted blocks.\n const chunkIds = new Set(this._chunks.map((chunk) => chunk.id));\n for (const id of this._chunkLineCounts.keys()) {\n if (!chunkIds.has(id)) {\n this._chunkLineCounts.delete(id);\n }\n }\n\n // Clear changes after sync.\n this._changes.length = 0;\n return this;\n }\n}\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["Text", "Event", "invariant", "log", "_view", "replaceLines", "from", "remove", "insert", "count", "state", "posFrom", "line", "posTo", "text", "dispatch", "_chunkLineCounts", "_lineToChunk", "_changes", "_renderer", "initialChunks", "forEach", "chunk", "appendChunk", "toJSON", "chunks", "changes", "doc", "reset", "clear", "update", "_chunks", "push", "type", "index", "updateChunk", "deleteBlock", "splice", "id", "change", "document", "lastLine", "lines", "lineStart", "previousLineCount", "get", "newLines", "currentLine", "lineCount", "set", "chunkIds"]
|
|
7
|
-
}
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
SerializationModel
|
|
3
|
-
} from "./chunk-MLRJWAQH.mjs";
|
|
4
|
-
|
|
5
|
-
// src/hooks/useAudioFile.ts
|
|
6
|
-
import { useEffect, useState } from "react";
|
|
7
|
-
import { scheduleTask } from "@dxos/async";
|
|
8
|
-
import { Context } from "@dxos/context";
|
|
9
|
-
import { log } from "@dxos/log";
|
|
10
|
-
var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useAudioFile.ts";
|
|
11
|
-
var useAudioFile = (audioUrl, constraints) => {
|
|
12
|
-
const [{ audio, stream, track }, setStream] = useState({});
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
const ctx = new Context(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 11 });
|
|
15
|
-
scheduleTask(ctx, async () => {
|
|
16
|
-
try {
|
|
17
|
-
const response = await fetch(audioUrl);
|
|
18
|
-
const blob = await response.blob();
|
|
19
|
-
const objectUrl = URL.createObjectURL(blob);
|
|
20
|
-
ctx.onDispose(() => {
|
|
21
|
-
URL.revokeObjectURL(objectUrl);
|
|
22
|
-
});
|
|
23
|
-
const audio2 = new Audio();
|
|
24
|
-
audio2.src = objectUrl;
|
|
25
|
-
await new Promise((resolve, reject) => {
|
|
26
|
-
audio2.addEventListener("error", (err) => {
|
|
27
|
-
log.error("error", {
|
|
28
|
-
err
|
|
29
|
-
}, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 25, S: void 0 });
|
|
30
|
-
reject(err);
|
|
31
|
-
}, {
|
|
32
|
-
once: true
|
|
33
|
-
});
|
|
34
|
-
audio2.addEventListener("canplay", async () => {
|
|
35
|
-
resolve();
|
|
36
|
-
}, {
|
|
37
|
-
once: true
|
|
38
|
-
});
|
|
39
|
-
audio2.load();
|
|
40
|
-
});
|
|
41
|
-
const audioCtx = new AudioContext();
|
|
42
|
-
if (audioCtx.state === "suspended") {
|
|
43
|
-
await audioCtx.resume();
|
|
44
|
-
}
|
|
45
|
-
const destination = audioCtx.createMediaStreamDestination();
|
|
46
|
-
destination.channelCount = 1;
|
|
47
|
-
const source = audioCtx.createMediaElementSource(audio2);
|
|
48
|
-
source.connect(destination);
|
|
49
|
-
const track2 = destination.stream.getAudioTracks()[0];
|
|
50
|
-
if (constraints) {
|
|
51
|
-
await track2.applyConstraints(constraints).catch((err) => log.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 50, S: void 0 }));
|
|
52
|
-
}
|
|
53
|
-
setStream({
|
|
54
|
-
audio: audio2,
|
|
55
|
-
stream: destination.stream,
|
|
56
|
-
track: destination.stream.getAudioTracks()[0]
|
|
57
|
-
});
|
|
58
|
-
} catch (err) {
|
|
59
|
-
log.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file, L: 59, S: void 0 });
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
return () => {
|
|
63
|
-
void ctx.dispose();
|
|
64
|
-
};
|
|
65
|
-
}, [
|
|
66
|
-
audioUrl
|
|
67
|
-
]);
|
|
68
|
-
return {
|
|
69
|
-
audio,
|
|
70
|
-
stream,
|
|
71
|
-
track
|
|
72
|
-
};
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
// src/hooks/useAudioTrack.ts
|
|
76
|
-
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
77
|
-
var useAudioTrack = (active, constraints) => {
|
|
78
|
-
const [track, setTrack] = useState2();
|
|
79
|
-
useEffect2(() => {
|
|
80
|
-
if (!active) {
|
|
81
|
-
track?.stop();
|
|
82
|
-
setTrack(void 0);
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
const initAudio = async () => {
|
|
86
|
-
const audio = new Audio();
|
|
87
|
-
audio.srcObject = await navigator.mediaDevices.getUserMedia({
|
|
88
|
-
audio: constraints ?? true
|
|
89
|
-
});
|
|
90
|
-
const [track2] = audio.srcObject.getAudioTracks();
|
|
91
|
-
if (track2) {
|
|
92
|
-
setTrack(track2);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
if (active) {
|
|
96
|
-
void initAudio();
|
|
97
|
-
}
|
|
98
|
-
}, [
|
|
99
|
-
active
|
|
100
|
-
]);
|
|
101
|
-
return track;
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
// src/hooks/useFeedModelAdapter.ts
|
|
105
|
-
import { useEffect as useEffect3, useMemo } from "react";
|
|
106
|
-
var useFeedModelAdapter = (renderer, objects, initialChunks = []) => {
|
|
107
|
-
const model = useMemo(() => new SerializationModel(renderer, initialChunks), [
|
|
108
|
-
renderer
|
|
109
|
-
]);
|
|
110
|
-
useEffect3(() => {
|
|
111
|
-
for (const chunk of objects) {
|
|
112
|
-
model.appendChunk(chunk);
|
|
113
|
-
}
|
|
114
|
-
}, [
|
|
115
|
-
model,
|
|
116
|
-
objects
|
|
117
|
-
]);
|
|
118
|
-
useEffect3(() => {
|
|
119
|
-
if (model.chunks.length === objects.length) {
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
const chunk = objects.at(-1);
|
|
123
|
-
if (chunk) {
|
|
124
|
-
model.appendChunk(chunk);
|
|
125
|
-
}
|
|
126
|
-
}, [
|
|
127
|
-
model,
|
|
128
|
-
objects.length
|
|
129
|
-
]);
|
|
130
|
-
return model;
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
// src/hooks/useTranscriber.ts
|
|
134
|
-
import { useEffect as useEffect4, useMemo as useMemo2 } from "react";
|
|
135
|
-
import { useCapabilities } from "@dxos/app-framework/ui";
|
|
136
|
-
import { TranscriptionCapabilities } from "#types";
|
|
137
|
-
var useTranscriber = ({ audioStreamTrack, recorderConfig, transcriberConfig, onSegments, transcribe }) => {
|
|
138
|
-
const [transcriberProvider] = useCapabilities(TranscriptionCapabilities.TranscriberProvider);
|
|
139
|
-
const transcriber = useMemo2(() => {
|
|
140
|
-
if (!transcriberProvider || !audioStreamTrack || !onSegments) {
|
|
141
|
-
return void 0;
|
|
142
|
-
}
|
|
143
|
-
return transcriberProvider({
|
|
144
|
-
audioStreamTrack,
|
|
145
|
-
recorderConfig,
|
|
146
|
-
transcriberConfig,
|
|
147
|
-
onSegments,
|
|
148
|
-
transcribe
|
|
149
|
-
});
|
|
150
|
-
}, [
|
|
151
|
-
transcriberProvider,
|
|
152
|
-
audioStreamTrack,
|
|
153
|
-
recorderConfig,
|
|
154
|
-
transcriberConfig,
|
|
155
|
-
onSegments,
|
|
156
|
-
transcribe
|
|
157
|
-
]);
|
|
158
|
-
useEffect4(() => {
|
|
159
|
-
return () => {
|
|
160
|
-
void transcriber?.close();
|
|
161
|
-
};
|
|
162
|
-
}, [
|
|
163
|
-
transcriber
|
|
164
|
-
]);
|
|
165
|
-
return transcriber;
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
// src/hooks/useTranscriptionRecording.ts
|
|
169
|
-
import * as Effect from "effect/Effect";
|
|
170
|
-
import { useCallback, useEffect as useEffect5, useState as useState3 } from "react";
|
|
171
|
-
import { createFeedServiceLayer } from "@dxos/client/echo";
|
|
172
|
-
import { Feed, Obj } from "@dxos/echo";
|
|
173
|
-
import { EffectEx } from "@dxos/effect";
|
|
174
|
-
import { log as log2 } from "@dxos/log";
|
|
175
|
-
import { getSpace } from "@dxos/react-client/echo";
|
|
176
|
-
import { useIdentity } from "@dxos/react-client/halo";
|
|
177
|
-
import { Message } from "@dxos/types";
|
|
178
|
-
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useTranscriptionRecording.ts";
|
|
179
|
-
var useTranscriptionRecording = (transcript) => {
|
|
180
|
-
const space = getSpace(transcript);
|
|
181
|
-
const identity = useIdentity();
|
|
182
|
-
const feed = transcript.feed.target;
|
|
183
|
-
const [recording, setRecording] = useState3(false);
|
|
184
|
-
const track = useAudioTrack(recording);
|
|
185
|
-
const handleSegments = useCallback(async (blocks) => {
|
|
186
|
-
if (!space || !feed || blocks.length === 0) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
const sender = identity ? {
|
|
190
|
-
identityDid: identity.did,
|
|
191
|
-
name: identity.profile?.displayName
|
|
192
|
-
} : {};
|
|
193
|
-
const message = Obj.make(Message.Message, {
|
|
194
|
-
sender,
|
|
195
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
196
|
-
blocks
|
|
197
|
-
});
|
|
198
|
-
const feedServiceLayer = createFeedServiceLayer(space.queues);
|
|
199
|
-
await Feed.append(feed, [
|
|
200
|
-
message
|
|
201
|
-
]).pipe(Effect.provide(feedServiceLayer), EffectEx.runAndForwardErrors);
|
|
202
|
-
}, [
|
|
203
|
-
space,
|
|
204
|
-
feed,
|
|
205
|
-
identity
|
|
206
|
-
]);
|
|
207
|
-
const transcriber = useTranscriber({
|
|
208
|
-
audioStreamTrack: track,
|
|
209
|
-
onSegments: handleSegments
|
|
210
|
-
});
|
|
211
|
-
useEffect5(() => {
|
|
212
|
-
if (!transcriber) {
|
|
213
|
-
return;
|
|
214
|
-
}
|
|
215
|
-
let cancelled = false;
|
|
216
|
-
void transcriber.open().then(() => {
|
|
217
|
-
if (!cancelled && recording) {
|
|
218
|
-
transcriber.startChunksRecording();
|
|
219
|
-
}
|
|
220
|
-
}, (err) => {
|
|
221
|
-
if (!cancelled) {
|
|
222
|
-
log2.catch(err, void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file2, L: 67, S: void 0 });
|
|
223
|
-
setRecording(false);
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
return () => {
|
|
227
|
-
cancelled = true;
|
|
228
|
-
transcriber.stopChunksRecording();
|
|
229
|
-
};
|
|
230
|
-
}, [
|
|
231
|
-
transcriber,
|
|
232
|
-
recording
|
|
233
|
-
]);
|
|
234
|
-
const toggleRecording = useCallback(() => setRecording((value) => !value), []);
|
|
235
|
-
return {
|
|
236
|
-
recording,
|
|
237
|
-
toggleRecording
|
|
238
|
-
};
|
|
239
|
-
};
|
|
240
|
-
|
|
241
|
-
// src/hooks/useVoiceInput.ts
|
|
242
|
-
import { useCallback as useCallback2, useEffect as useEffect6, useState as useState4 } from "react";
|
|
243
|
-
import { scheduleMicroTask } from "@dxos/async";
|
|
244
|
-
import { Context as Context2 } from "@dxos/context";
|
|
245
|
-
import { log as log3 } from "@dxos/log";
|
|
246
|
-
import { useSoundEffect } from "@dxos/react-ui-audio";
|
|
247
|
-
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useVoiceInput.ts";
|
|
248
|
-
var useVoiceInput = ({ active, onUpdate }) => {
|
|
249
|
-
const soundStart = useSoundEffect("StartRecording");
|
|
250
|
-
const soundStop = useSoundEffect("StopRecording");
|
|
251
|
-
const handleSegments = useCallback2(async (segments) => {
|
|
252
|
-
const text = segments.map((str) => str.text.trim().replace(/[^\w\s]/g, "")).join(" ");
|
|
253
|
-
onUpdate(text);
|
|
254
|
-
}, []);
|
|
255
|
-
const [recording, setRecording] = useState4(false);
|
|
256
|
-
const track = useAudioTrack(active);
|
|
257
|
-
const transcriber = useTranscriber({
|
|
258
|
-
audioStreamTrack: track,
|
|
259
|
-
onSegments: handleSegments
|
|
260
|
-
});
|
|
261
|
-
useEffect6(() => {
|
|
262
|
-
const ctx = new Context2(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 29 });
|
|
263
|
-
scheduleMicroTask(ctx, async () => {
|
|
264
|
-
if (active && transcriber) {
|
|
265
|
-
await transcriber.open();
|
|
266
|
-
log3.info("starting...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 33, S: void 0 });
|
|
267
|
-
setRecording(true);
|
|
268
|
-
void soundStart.play();
|
|
269
|
-
transcriber.startChunksRecording();
|
|
270
|
-
} else if (!active && transcriber?.isOpen) {
|
|
271
|
-
transcriber?.stopChunksRecording();
|
|
272
|
-
await transcriber?.close();
|
|
273
|
-
log3.info("stopped", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 40, S: void 0 });
|
|
274
|
-
setRecording(false);
|
|
275
|
-
void soundStop.play();
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
return () => {
|
|
279
|
-
void ctx.dispose();
|
|
280
|
-
};
|
|
281
|
-
}, [
|
|
282
|
-
active,
|
|
283
|
-
transcriber
|
|
284
|
-
]);
|
|
285
|
-
return {
|
|
286
|
-
recording
|
|
287
|
-
};
|
|
288
|
-
};
|
|
289
|
-
|
|
290
|
-
export {
|
|
291
|
-
useAudioFile,
|
|
292
|
-
useAudioTrack,
|
|
293
|
-
useFeedModelAdapter,
|
|
294
|
-
useTranscriber,
|
|
295
|
-
useTranscriptionRecording,
|
|
296
|
-
useVoiceInput
|
|
297
|
-
};
|
|
298
|
-
//# sourceMappingURL=chunk-TO77KAQK.mjs.map
|