@dxos/plugin-transcription 0.8.4-main.abd8ff62ef → 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/{browser/chunk-NQQK7UZQ.mjs → neutral/chunk-2O3ONPRZ.mjs} +94 -40
- package/dist/lib/neutral/chunk-2O3ONPRZ.mjs.map +7 -0
- package/dist/lib/{browser/chunk-L4HW35L6.mjs → neutral/chunk-5FXU36PN.mjs} +19 -10
- package/dist/lib/neutral/chunk-5FXU36PN.mjs.map +7 -0
- package/dist/lib/neutral/chunk-GL4RS533.mjs +22 -0
- package/dist/lib/neutral/chunk-GL4RS533.mjs.map +7 -0
- package/dist/lib/{browser/index.mjs → neutral/chunk-ILSA3DU7.mjs} +32 -70
- package/dist/lib/neutral/chunk-ILSA3DU7.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/{browser/blueprints/index.mjs → neutral/chunk-ZR4BH4QQ.mjs} +4 -5
- package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/components/index.mjs +83 -18
- 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/{browser/create-ULR5DPJZ.mjs → neutral/create-RRWRIUSR.mjs} +4 -4
- package/dist/lib/neutral/create-RRWRIUSR.mjs.map +7 -0
- package/dist/lib/{browser → neutral}/hooks/index.mjs +5 -3
- 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/{browser/open-SFMPLZVW.mjs → neutral/open-CVMX5KXZ.mjs} +5 -5
- 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/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/{browser/summarize-BDFX4APN.mjs → neutral/summarize-LA7TRW7A.mjs} +5 -5
- 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/neutral/transcriber-ABHATBVH.mjs +59 -0
- 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.map +1 -1
- package/dist/types/src/TranscriptionPlugin.node.d.ts.map +1 -1
- 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/capabilities/index.d.ts +5 -1
- package/dist/types/src/capabilities/index.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/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 +0 -5
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -1
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +13 -16
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.d.ts +6 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.stories.d.ts +28 -0
- package/dist/types/src/containers/TranscriptionArticle/TranscriptionArticle.stories.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionArticle/index.d.ts +2 -0
- package/dist/types/src/containers/TranscriptionArticle/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +1 -1
- package/dist/types/src/containers/index.d.ts.map +1 -1
- package/dist/types/src/enrichment/conversation.test.d.ts +2 -0
- package/dist/types/src/enrichment/conversation.test.d.ts.map +1 -0
- package/dist/types/src/enrichment/operations.d.ts +200 -0
- package/dist/types/src/enrichment/operations.d.ts.map +1 -0
- package/dist/types/src/enrichment/parser.d.ts +26 -0
- package/dist/types/src/enrichment/parser.d.ts.map +1 -0
- package/dist/types/src/enrichment/stream-simulator.d.ts +38 -0
- package/dist/types/src/enrichment/stream-simulator.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +2 -1
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useFeedModelAdapter.d.ts +12 -0
- package/dist/types/src/hooks/useFeedModelAdapter.d.ts.map +1 -0
- 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/index.d.ts +3 -4
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/normalization/message-normalizer.d.ts +7 -5
- package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -1
- package/dist/types/src/normalization/normalization.d.ts +180 -1
- package/dist/types/src/normalization/normalization.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +2 -2
- package/dist/types/src/operations/create.d.ts.map +1 -1
- package/dist/types/src/operations/index.d.ts +0 -1
- package/dist/types/src/operations/index.d.ts.map +1 -1
- package/dist/types/src/operations/open.d.ts +2 -2
- package/dist/types/src/operations/open.d.ts.map +1 -1
- package/dist/types/src/operations/summarize.d.ts +2 -2
- package/dist/types/src/operations/summarize.d.ts.map +1 -1
- 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 +5 -3
- package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -1
- package/dist/types/src/stories/{MicrophoneTranscription.stories.d.ts → LiveTranscription.stories.d.ts} +4 -4
- package/dist/types/src/stories/LiveTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/stories/TranscriptionStory.d.ts +11 -13
- package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -1
- 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 +5 -6
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +4 -4
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts +6 -4
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +2 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/{operations/definitions.d.ts → types/TranscriptOperation.d.ts} +1 -1
- 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 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +125 -94
- package/src/TranscriptionPlugin.node.ts +3 -31
- package/src/TranscriptionPlugin.test.ts +3 -3
- package/src/TranscriptionPlugin.tsx +3 -31
- package/src/TranscriptionPlugin.workerd.ts +18 -0
- package/src/blueprints/transcription-blueprint.ts +1 -1
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/react-surface.tsx +2 -2
- package/src/capabilities/text-content.ts +33 -0
- package/src/capabilities/transcriber.ts +1 -1
- 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 +116 -150
- package/src/components/Transcription/Transcription.tsx +7 -13
- package/src/components/index.ts +1 -0
- package/src/containers/TranscriptionArticle/TranscriptionArticle.stories.tsx +61 -0
- package/src/containers/TranscriptionArticle/TranscriptionArticle.tsx +62 -0
- package/src/containers/TranscriptionArticle/index.ts +5 -0
- package/src/containers/index.ts +1 -1
- package/src/enrichment/conversation.test.ts +162 -0
- package/src/enrichment/conversation.txt +23 -0
- package/src/enrichment/operations.ts +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/useTranscriptionRecording.ts +87 -0
- package/src/index.ts +3 -9
- package/src/normalization/message-normalizer.ts +25 -13
- package/src/normalization/normalization.test.ts +3 -37
- package/src/normalization/normalization.ts +6 -7
- package/src/operations/create.ts +2 -2
- package/src/operations/index.ts +0 -2
- package/src/operations/open.ts +2 -2
- package/src/operations/summarize.ts +3 -3
- package/src/plugin.ts +11 -0
- package/src/stories/FileTranscription.stories.tsx +49 -175
- package/src/stories/KeyWordRecognition.stories.tsx +7 -9
- package/src/stories/LiveTranscription.stories.tsx +153 -0
- package/src/stories/TranscriptionStory.tsx +32 -24
- package/src/stories/common.ts +233 -0
- package/src/testing/testing.ts +20 -27
- package/src/transcriber/transcriber.test.ts +9 -9
- package/src/transcriber/transcriber.ts +18 -14
- package/src/transcriber/transcription-manager.ts +14 -9
- package/src/translations.ts +3 -0
- package/src/{operations/definitions.ts → types/TranscriptOperation.ts} +2 -0
- package/src/types/TranscriptionCapabilities.ts +39 -0
- package/src/types/index.ts +2 -2
- package/dist/lib/browser/blueprints/index.mjs.map +0 -7
- package/dist/lib/browser/chunk-3L623EVL.mjs +0 -17
- package/dist/lib/browser/chunk-3L623EVL.mjs.map +0 -7
- package/dist/lib/browser/chunk-L4HW35L6.mjs.map +0 -7
- package/dist/lib/browser/chunk-NQQK7UZQ.mjs.map +0 -7
- package/dist/lib/browser/components/index.mjs.map +0 -7
- package/dist/lib/browser/create-ULR5DPJZ.mjs.map +0 -7
- package/dist/lib/browser/index.mjs.map +0 -7
- package/dist/lib/browser/meta.json +0 -1
- package/dist/lib/browser/open-SFMPLZVW.mjs.map +0 -7
- package/dist/lib/browser/operations/index.mjs +0 -13
- package/dist/lib/browser/operations/index.mjs.map +0 -7
- package/dist/lib/browser/summarize-BDFX4APN.mjs.map +0 -7
- package/dist/lib/browser/types/index.mjs +0 -10
- package/dist/lib/node-esm/blueprints/index.mjs +0 -32
- package/dist/lib/node-esm/blueprints/index.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7UIZWCD4.mjs +0 -112
- package/dist/lib/node-esm/chunk-7UIZWCD4.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-C3AE2NYJ.mjs +0 -181
- package/dist/lib/node-esm/chunk-C3AE2NYJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
- package/dist/lib/node-esm/chunk-KO3IOD2O.mjs +0 -19
- package/dist/lib/node-esm/chunk-KO3IOD2O.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-MQK4R6GT.mjs +0 -245
- package/dist/lib/node-esm/chunk-MQK4R6GT.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-O533NBMK.mjs +0 -37
- package/dist/lib/node-esm/chunk-O533NBMK.mjs.map +0 -7
- package/dist/lib/node-esm/components/index.mjs +0 -208
- package/dist/lib/node-esm/components/index.mjs.map +0 -7
- package/dist/lib/node-esm/create-A5QHNWRF.mjs +0 -22
- package/dist/lib/node-esm/create-A5QHNWRF.mjs.map +0 -7
- package/dist/lib/node-esm/hooks/index.mjs +0 -18
- package/dist/lib/node-esm/index.mjs +0 -474
- package/dist/lib/node-esm/index.mjs.map +0 -7
- package/dist/lib/node-esm/meta.json +0 -1
- package/dist/lib/node-esm/open-OI24QNTO.mjs +0 -28
- package/dist/lib/node-esm/open-OI24QNTO.mjs.map +0 -7
- package/dist/lib/node-esm/operations/index.mjs +0 -14
- package/dist/lib/node-esm/operations/index.mjs.map +0 -7
- package/dist/lib/node-esm/summarize-3UNN24I2.mjs +0 -79
- package/dist/lib/node-esm/summarize-3UNN24I2.mjs.map +0 -7
- package/dist/lib/node-esm/types/index.mjs +0 -11
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +0 -6
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +0 -1
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts +0 -2
- package/dist/types/src/containers/TranscriptionContainer/index.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/operations/definitions.d.ts.map +0 -1
- package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
- package/dist/types/src/stories/useIsSpeaking.d.ts +0 -3
- package/dist/types/src/stories/useIsSpeaking.d.ts.map +0 -1
- package/dist/types/src/types/capabilities.d.ts +0 -19
- package/dist/types/src/types/capabilities.d.ts.map +0 -1
- package/dist/types/src/types/defs.d.ts +0 -5
- package/dist/types/src/types/defs.d.ts.map +0 -1
- package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +0 -35
- package/src/containers/TranscriptionContainer/index.ts +0 -5
- package/src/hooks/useQueueModelAdapter.ts +0 -66
- package/src/stories/MicrophoneTranscription.stories.tsx +0 -264
- package/src/stories/useIsSpeaking.tsx +0 -40
- package/src/types/capabilities.ts +0 -39
- package/src/types/defs.ts +0 -9
- /package/dist/lib/{browser/hooks → neutral/blueprints}/index.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-KAEXRX3Y.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-KAEXRX3Y.mjs.map +0 -0
- /package/dist/lib/{browser → neutral}/chunk-MLRJWAQH.mjs +0 -0
- /package/dist/lib/{browser → neutral}/chunk-MLRJWAQH.mjs.map +0 -0
- /package/dist/lib/{browser/types → neutral/hooks}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/hooks → neutral}/index.mjs.map +0 -0
- /package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
- /package/dist/lib/{node-esm/types → neutral/operations}/index.mjs.map +0 -0
package/LICENSE
CHANGED
|
@@ -1,8 +1,105 @@
|
|
|
1
|
-
|
|
2
|
-
Copyright (c) 2022 DXOS
|
|
1
|
+
# Functional Source License, Version 1.1, ALv2 Future License
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
## Abbreviation
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
FSL-1.1-Apache-2.0
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2026 DXOS
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the Apache License, Version 2.0 that is effective on the second anniversary of
|
|
91
|
+
the date we make the Software available. On or after that date, you may use the
|
|
92
|
+
Software under the Apache License, Version 2.0, in which case the following
|
|
93
|
+
will apply:
|
|
94
|
+
|
|
95
|
+
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
|
96
|
+
this file except in compliance with the License.
|
|
97
|
+
|
|
98
|
+
You may obtain a copy of the License at
|
|
99
|
+
|
|
100
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
101
|
+
|
|
102
|
+
Unless required by applicable law or agreed to in writing, software distributed
|
|
103
|
+
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
|
+
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
|
+
specific language governing permissions and limitations under the License.
|
package/README.md
CHANGED
|
@@ -12,4 +12,4 @@ Transcription functionality
|
|
|
12
12
|
|
|
13
13
|
Your ideas, issues, and code are most welcome. Please take a look at our [community code of conduct](https://github.com/dxos/dxos/blob/main/CODE_OF_CONDUCT.md), the [issue guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-issues), and the [PR contribution guide](https://github.com/dxos/dxos/blob/main/CONTRIBUTING.md#submitting-prs).
|
|
14
14
|
|
|
15
|
-
License: [
|
|
15
|
+
License: [FSL-1.1-Apache-2.0](./LICENSE) Copyright 2023 © DXOS
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import {
|
|
2
|
+
renderByline
|
|
3
|
+
} from "./chunk-KAEXRX3Y.mjs";
|
|
4
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
5
|
+
|
|
6
|
+
// src/containers/TranscriptionArticle/TranscriptionArticle.tsx
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { Filter, Obj, Query } from "@dxos/echo";
|
|
9
|
+
import { useMembers, useQuery } from "@dxos/react-client/echo";
|
|
10
|
+
import { Panel } from "@dxos/react-ui";
|
|
11
|
+
import { Menu, MenuBuilder, useMenuBuilder } from "@dxos/react-ui-menu";
|
|
12
|
+
import { Message } from "@dxos/types";
|
|
13
|
+
import { Transcription } from "#components";
|
|
14
|
+
import { useFeedModelAdapter, useTranscriptionRecording } from "#hooks";
|
|
15
|
+
import { meta } from "#meta";
|
|
16
|
+
var TranscriptionArticle = ({ role, subject: transcript, attendableId }) => {
|
|
17
|
+
const db = Obj.getDatabase(transcript);
|
|
18
|
+
const members = useMembers(db?.spaceId).map((member) => member.identity);
|
|
19
|
+
const feed = transcript.feed.target;
|
|
20
|
+
const messages = useQuery(db, feed ? Query.select(Filter.type(Message.Message)).from(feed) : Query.select(Filter.nothing()));
|
|
21
|
+
const model = useFeedModelAdapter(renderByline(members), messages);
|
|
22
|
+
const { recording, toggleRecording } = useTranscriptionRecording(transcript);
|
|
23
|
+
const menuActions = useMenuBuilder(() => MenuBuilder.make().action("toggle-recording", {
|
|
24
|
+
label: [
|
|
25
|
+
recording ? "stop-recording.label" : "start-recording.label",
|
|
26
|
+
{
|
|
27
|
+
ns: meta.id
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
icon: recording ? "ph--stop-circle--regular" : "ph--microphone--regular",
|
|
31
|
+
disposition: "toolbar",
|
|
32
|
+
testId: "transcription.toggle-recording"
|
|
33
|
+
}, toggleRecording).build(), [
|
|
34
|
+
recording,
|
|
35
|
+
toggleRecording
|
|
36
|
+
]);
|
|
37
|
+
return /* @__PURE__ */ React.createElement(Panel.Root, {
|
|
38
|
+
role
|
|
39
|
+
}, /* @__PURE__ */ React.createElement(Menu.Root, {
|
|
40
|
+
...menuActions,
|
|
41
|
+
attendableId
|
|
42
|
+
}, /* @__PURE__ */ React.createElement(Panel.Toolbar, {
|
|
43
|
+
asChild: true
|
|
44
|
+
}, /* @__PURE__ */ React.createElement(Menu.Toolbar, null))), /* @__PURE__ */ React.createElement(Panel.Content, {
|
|
45
|
+
asChild: true
|
|
46
|
+
}, /* @__PURE__ */ React.createElement(Transcription, {
|
|
47
|
+
model,
|
|
48
|
+
transcript
|
|
49
|
+
})));
|
|
50
|
+
};
|
|
51
|
+
export {
|
|
52
|
+
TranscriptionArticle as default
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=TranscriptionArticle-L6XANBH5.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/containers/TranscriptionArticle/TranscriptionArticle.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2024 DXOS.org\n//\n\nimport React from 'react';\n\nimport { type AppSurface } from '@dxos/app-toolkit/ui';\nimport { Filter, Obj, Query } from '@dxos/echo';\nimport { useMembers, useQuery } from '@dxos/react-client/echo';\nimport { Panel } from '@dxos/react-ui';\nimport { Menu, MenuBuilder, useMenuBuilder } from '@dxos/react-ui-menu';\nimport { Message, type Transcript } from '@dxos/types';\n\nimport { Transcription } from '#components';\nimport { useFeedModelAdapter, useTranscriptionRecording } from '#hooks';\nimport { meta } from '#meta';\n\nimport { renderByline } from '../../util';\n\nexport type TranscriptionArticleProps = AppSurface.ObjectArticleProps<Transcript.Transcript>;\n\nexport const TranscriptionArticle = ({ role, subject: transcript, attendableId }: TranscriptionArticleProps) => {\n const db = Obj.getDatabase(transcript);\n const members = useMembers(db?.spaceId).map((member) => member.identity);\n const feed = transcript.feed.target;\n const messages = useQuery(\n db,\n feed ? Query.select(Filter.type(Message.Message)).from(feed) : Query.select(Filter.nothing()),\n );\n const model = useFeedModelAdapter(renderByline(members), messages);\n const { recording, toggleRecording } = useTranscriptionRecording(transcript);\n\n const menuActions = useMenuBuilder(\n () =>\n MenuBuilder.make()\n .action(\n 'toggle-recording',\n {\n label: [recording ? 'stop-recording.label' : 'start-recording.label', { ns: meta.id }],\n icon: recording ? 'ph--stop-circle--regular' : 'ph--microphone--regular',\n disposition: 'toolbar',\n testId: 'transcription.toggle-recording',\n },\n toggleRecording,\n )\n .build(),\n [recording, toggleRecording],\n );\n\n return (\n <Panel.Root role={role}>\n <Menu.Root {...menuActions} attendableId={attendableId}>\n <Panel.Toolbar asChild>\n <Menu.Toolbar />\n </Panel.Toolbar>\n </Menu.Root>\n <Panel.Content asChild>\n <Transcription model={model} transcript={transcript} />\n </Panel.Content>\n </Panel.Root>\n );\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;AAIA,OAAOA,WAAW;AAGlB,SAASC,QAAQC,KAAKC,aAAa;AACnC,SAASC,YAAYC,gBAAgB;AACrC,SAASC,aAAa;AACtB,SAASC,MAAMC,aAAaC,sBAAsB;AAClD,SAASC,eAAgC;AAEzC,SAASC,qBAAqB;AAC9B,SAASC,qBAAqBC,iCAAiC;AAC/D,SAASC,YAAY;AAMd,IAAMC,uBAAuB,CAAC,EAAEC,MAAMC,SAASC,YAAYC,aAAY,MAA6B;AACzG,QAAMC,KAAKC,IAAIC,YAAYJ,UAAAA;AAC3B,QAAMK,UAAUC,WAAWJ,IAAIK,OAAAA,EAASC,IAAI,CAACC,WAAWA,OAAOC,QAAQ;AACvE,QAAMC,OAAOX,WAAWW,KAAKC;AAC7B,QAAMC,WAAWC,SACfZ,IACAS,OAAOI,MAAMC,OAAOC,OAAOC,KAAKC,QAAQA,OAAO,CAAA,EAAGC,KAAKT,IAAAA,IAAQI,MAAMC,OAAOC,OAAOI,QAAO,CAAA,CAAA;AAE5F,QAAMC,QAAQC,oBAAoBC,aAAanB,OAAAA,GAAUQ,QAAAA;AACzD,QAAM,EAAEY,WAAWC,gBAAe,IAAKC,0BAA0B3B,UAAAA;AAEjE,QAAM4B,cAAcC,eAClB,MACEC,YAAYC,KAAI,EACbC,OACC,oBACA;IACEC,OAAO;MAACR,YAAY,yBAAyB;MAAyB;QAAES,IAAIC,KAAKC;MAAG;;IACpFC,MAAMZ,YAAY,6BAA6B;IAC/Ca,aAAa;IACbC,QAAQ;EACV,GACAb,eAAAA,EAEDc,MAAK,GACV;IAACf;IAAWC;GAAgB;AAG9B,SACE,sBAAA,cAACe,MAAMC,MAAI;IAAC5C;KACV,sBAAA,cAAC6C,KAAKD,MAAI;IAAE,GAAGd;IAAa3B;KAC1B,sBAAA,cAACwC,MAAMG,SAAO;IAACC,SAAAA;KACb,sBAAA,cAACF,KAAKC,SAAO,IAAA,CAAA,CAAA,GAGjB,sBAAA,cAACH,MAAMK,SAAO;IAACD,SAAAA;KACb,sBAAA,cAACE,eAAAA;IAAczB;IAActB;;AAIrC;",
|
|
6
|
+
"names": ["React", "Filter", "Obj", "Query", "useMembers", "useQuery", "Panel", "Menu", "MenuBuilder", "useMenuBuilder", "Message", "Transcription", "useFeedModelAdapter", "useTranscriptionRecording", "meta", "TranscriptionArticle", "role", "subject", "transcript", "attendableId", "db", "Obj", "getDatabase", "members", "useMembers", "spaceId", "map", "member", "identity", "feed", "target", "messages", "useQuery", "Query", "select", "Filter", "type", "Message", "from", "nothing", "model", "useFeedModelAdapter", "renderByline", "recording", "toggleRecording", "useTranscriptionRecording", "menuActions", "useMenuBuilder", "MenuBuilder", "make", "action", "label", "ns", "meta", "id", "icon", "disposition", "testId", "build", "Panel", "Root", "Menu", "Toolbar", "asChild", "Content", "Transcription"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/TranscriptionPlugin.tsx
|
|
4
|
+
import { Plugin } from "@dxos/app-framework";
|
|
5
|
+
import { AppActivationEvents, AppPlugin } from "@dxos/app-toolkit";
|
|
6
|
+
import { Transcript } from "@dxos/types";
|
|
7
|
+
import { BlueprintDefinition, OperationHandler, ReactSurface, TextContent, Transcriber } from "#capabilities";
|
|
8
|
+
import { meta } from "#meta";
|
|
9
|
+
import { translations } from "#translations";
|
|
10
|
+
var TranscriptionPlugin = Plugin.define(meta).pipe(AppPlugin.addBlueprintDefinitionModule({
|
|
11
|
+
activate: BlueprintDefinition
|
|
12
|
+
}), AppPlugin.addTextContentModule({
|
|
13
|
+
activate: TextContent
|
|
14
|
+
}), AppPlugin.addOperationHandlerModule({
|
|
15
|
+
activate: OperationHandler
|
|
16
|
+
}), AppPlugin.addSchemaModule({
|
|
17
|
+
schema: [
|
|
18
|
+
Transcript.Transcript
|
|
19
|
+
]
|
|
20
|
+
}), AppPlugin.addSurfaceModule({
|
|
21
|
+
activate: ReactSurface
|
|
22
|
+
}), AppPlugin.addTranslationsModule({
|
|
23
|
+
translations
|
|
24
|
+
}), Plugin.addModule({
|
|
25
|
+
id: "transcription",
|
|
26
|
+
activatesOn: AppActivationEvents.SetupAppGraph,
|
|
27
|
+
activate: Transcriber
|
|
28
|
+
}), Plugin.make);
|
|
29
|
+
var TranscriptionPlugin_default = TranscriptionPlugin;
|
|
30
|
+
export {
|
|
31
|
+
TranscriptionPlugin,
|
|
32
|
+
TranscriptionPlugin_default as default
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=TranscriptionPlugin.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/TranscriptionPlugin.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppActivationEvents, AppPlugin } from '@dxos/app-toolkit';\nimport { Transcript } from '@dxos/types';\n\nimport { BlueprintDefinition, OperationHandler, ReactSurface, TextContent, Transcriber } from '#capabilities';\nimport { meta } from '#meta';\nimport { translations } from '#translations';\n\nexport const TranscriptionPlugin = Plugin.define(meta).pipe(\n AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),\n AppPlugin.addTextContentModule({ activate: TextContent }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Transcript.Transcript] }),\n AppPlugin.addSurfaceModule({ activate: ReactSurface }),\n AppPlugin.addTranslationsModule({ translations }),\n Plugin.addModule({\n id: 'transcription',\n activatesOn: AppActivationEvents.SetupAppGraph,\n activate: Transcriber,\n }),\n Plugin.make,\n);\n\nexport default TranscriptionPlugin;\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,qBAAqBC,iBAAiB;AAC/C,SAASC,kBAAkB;AAE3B,SAASC,qBAAqBC,kBAAkBC,cAAcC,aAAaC,mBAAmB;AAC9F,SAASC,YAAY;AACrB,SAASC,oBAAoB;AAEtB,IAAMC,sBAAsBX,OAAOY,OAAOH,IAAAA,EAAMI,KACrDX,UAAUY,6BAA6B;EAAEC,UAAUX;AAAoB,CAAA,GACvEF,UAAUc,qBAAqB;EAAED,UAAUR;AAAY,CAAA,GACvDL,UAAUe,0BAA0B;EAAEF,UAAUV;AAAiB,CAAA,GACjEH,UAAUgB,gBAAgB;EAAEC,QAAQ;IAAChB,WAAWA;;AAAY,CAAA,GAC5DD,UAAUkB,iBAAiB;EAAEL,UAAUT;AAAa,CAAA,GACpDJ,UAAUmB,sBAAsB;EAAEX;AAAa,CAAA,GAC/CV,OAAOsB,UAAU;EACfC,IAAI;EACJC,aAAavB,oBAAoBwB;EACjCV,UAAUP;AACZ,CAAA,GACAR,OAAO0B,IAAI;AAGb,IAAA,8BAAef;",
|
|
6
|
+
"names": ["Plugin", "AppActivationEvents", "AppPlugin", "Transcript", "BlueprintDefinition", "OperationHandler", "ReactSurface", "TextContent", "Transcriber", "meta", "translations", "TranscriptionPlugin", "define", "pipe", "addBlueprintDefinitionModule", "activate", "addTextContentModule", "addOperationHandlerModule", "addSchemaModule", "schema", "addSurfaceModule", "addTranslationsModule", "addModule", "id", "activatesOn", "SetupAppGraph", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/TranscriptionPlugin.node.ts
|
|
4
|
+
import { Plugin } from "@dxos/app-framework";
|
|
5
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
6
|
+
import { Transcript } from "@dxos/types";
|
|
7
|
+
import { BlueprintDefinition, OperationHandler, TextContent } from "#capabilities";
|
|
8
|
+
import { meta } from "#meta";
|
|
9
|
+
var TranscriptionPlugin = Plugin.define(meta).pipe(AppPlugin.addBlueprintDefinitionModule({
|
|
10
|
+
activate: BlueprintDefinition
|
|
11
|
+
}), AppPlugin.addTextContentModule({
|
|
12
|
+
activate: TextContent
|
|
13
|
+
}), AppPlugin.addOperationHandlerModule({
|
|
14
|
+
activate: OperationHandler
|
|
15
|
+
}), AppPlugin.addSchemaModule({
|
|
16
|
+
schema: [
|
|
17
|
+
Transcript.Transcript
|
|
18
|
+
]
|
|
19
|
+
}), Plugin.make);
|
|
20
|
+
var TranscriptionPlugin_node_default = TranscriptionPlugin;
|
|
21
|
+
export {
|
|
22
|
+
TranscriptionPlugin,
|
|
23
|
+
TranscriptionPlugin_node_default as default
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=TranscriptionPlugin.node.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/TranscriptionPlugin.node.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Transcript } from '@dxos/types';\n\nimport { BlueprintDefinition, OperationHandler, TextContent } from '#capabilities';\nimport { meta } from '#meta';\n\nexport const TranscriptionPlugin = Plugin.define(meta).pipe(\n AppPlugin.addBlueprintDefinitionModule({ activate: BlueprintDefinition }),\n AppPlugin.addTextContentModule({ activate: TextContent }),\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Transcript.Transcript] }),\n Plugin.make,\n);\n\nexport default TranscriptionPlugin;\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAE3B,SAASC,qBAAqBC,kBAAkBC,mBAAmB;AACnE,SAASC,YAAY;AAEd,IAAMC,sBAAsBP,OAAOQ,OAAOF,IAAAA,EAAMG,KACrDR,UAAUS,6BAA6B;EAAEC,UAAUR;AAAoB,CAAA,GACvEF,UAAUW,qBAAqB;EAAED,UAAUN;AAAY,CAAA,GACvDJ,UAAUY,0BAA0B;EAAEF,UAAUP;AAAiB,CAAA,GACjEH,UAAUa,gBAAgB;EAAEC,QAAQ;IAACb,WAAWA;;AAAY,CAAA,GAC5DF,OAAOgB,IAAI;AAGb,IAAA,mCAAeT;",
|
|
6
|
+
"names": ["Plugin", "AppPlugin", "Transcript", "BlueprintDefinition", "OperationHandler", "TextContent", "meta", "TranscriptionPlugin", "define", "pipe", "addBlueprintDefinitionModule", "activate", "addTextContentModule", "addOperationHandlerModule", "addSchemaModule", "schema", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/TranscriptionPlugin.workerd.ts
|
|
4
|
+
import { Plugin } from "@dxos/app-framework";
|
|
5
|
+
import { AppPlugin } from "@dxos/app-toolkit";
|
|
6
|
+
import { Transcript } from "@dxos/types";
|
|
7
|
+
import { OperationHandler } from "#capabilities";
|
|
8
|
+
import { meta } from "#meta";
|
|
9
|
+
var TranscriptionPlugin = Plugin.define(meta).pipe(AppPlugin.addOperationHandlerModule({
|
|
10
|
+
activate: OperationHandler
|
|
11
|
+
}), AppPlugin.addSchemaModule({
|
|
12
|
+
schema: [
|
|
13
|
+
Transcript.Transcript
|
|
14
|
+
]
|
|
15
|
+
}), Plugin.make);
|
|
16
|
+
var TranscriptionPlugin_workerd_default = TranscriptionPlugin;
|
|
17
|
+
export {
|
|
18
|
+
TranscriptionPlugin,
|
|
19
|
+
TranscriptionPlugin_workerd_default as default
|
|
20
|
+
};
|
|
21
|
+
//# sourceMappingURL=TranscriptionPlugin.workerd.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/TranscriptionPlugin.workerd.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { Plugin } from '@dxos/app-framework';\nimport { AppPlugin } from '@dxos/app-toolkit';\nimport { Transcript } from '@dxos/types';\n\nimport { OperationHandler } from '#capabilities';\nimport { meta } from '#meta';\n\nexport const TranscriptionPlugin = Plugin.define(meta).pipe(\n AppPlugin.addOperationHandlerModule({ activate: OperationHandler }),\n AppPlugin.addSchemaModule({ schema: [Transcript.Transcript] }),\n Plugin.make,\n);\n\nexport default TranscriptionPlugin;\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,cAAc;AACvB,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAE3B,SAASC,wBAAwB;AACjC,SAASC,YAAY;AAEd,IAAMC,sBAAsBL,OAAOM,OAAOF,IAAAA,EAAMG,KACrDN,UAAUO,0BAA0B;EAAEC,UAAUN;AAAiB,CAAA,GACjEF,UAAUS,gBAAgB;EAAEC,QAAQ;IAACT,WAAWA;;AAAY,CAAA,GAC5DF,OAAOY,IAAI;AAGb,IAAA,sCAAeP;",
|
|
6
|
+
"names": ["Plugin", "AppPlugin", "Transcript", "OperationHandler", "meta", "TranscriptionPlugin", "define", "pipe", "addOperationHandlerModule", "activate", "addSchemaModule", "schema", "make"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import "./chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/capabilities/blueprint-definition.ts
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { Capability } from "@dxos/app-framework";
|
|
6
|
+
import { AppCapabilities } from "@dxos/app-toolkit";
|
|
7
|
+
import { TranscriptionBlueprint } from "#blueprints";
|
|
8
|
+
var blueprintDefinition = Capability.makeModule(() => Effect.succeed([
|
|
9
|
+
Capability.contributes(AppCapabilities.BlueprintDefinition, TranscriptionBlueprint)
|
|
10
|
+
]));
|
|
11
|
+
var blueprint_definition_default = blueprintDefinition;
|
|
12
|
+
export {
|
|
13
|
+
blueprint_definition_default as default
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=blueprint-definition-HOXDG5QP.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/blueprint-definition.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport type { Blueprint } from '@dxos/compute';\n\nimport { TranscriptionBlueprint } from '#blueprints';\n\nconst blueprintDefinition = Capability.makeModule<\n [],\n Capability.Capability<typeof AppCapabilities.BlueprintDefinition>[]\n>(() => Effect.succeed([Capability.contributes(AppCapabilities.BlueprintDefinition, TranscriptionBlueprint)]));\n\nexport default blueprintDefinition;\n"],
|
|
5
|
+
"mappings": ";;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAIhC,SAASC,8BAA8B;AAEvC,IAAMC,sBAAsBH,WAAWI,WAGrC,MAAaC,eAAQ;EAACL,WAAWM,YAAYL,gBAAgBM,qBAAqBL,sBAAAA;CAAwB,CAAA;AAE5G,IAAA,+BAAeC;",
|
|
6
|
+
"names": ["Effect", "Capability", "AppCapabilities", "TranscriptionBlueprint", "blueprintDefinition", "makeModule", "succeed", "contributes", "BlueprintDefinition"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import "../chunk-J5LGTIGS.mjs";
|
|
2
|
+
|
|
3
|
+
// src/capabilities/index.ts
|
|
4
|
+
import { Capability } from "@dxos/app-framework";
|
|
5
|
+
var BlueprintDefinition = Capability.lazy("BlueprintDefinition", () => import("../blueprint-definition-HOXDG5QP.mjs"));
|
|
6
|
+
var TextContent = Capability.lazy("TextContent", () => import("../text-content-F4ASMITB.mjs"));
|
|
7
|
+
var OperationHandler = Capability.lazy("OperationHandler", () => import("../operation-handler-NXMOAXFP.mjs"));
|
|
8
|
+
var ReactSurface = Capability.lazy("ReactSurface", () => import("../react-surface-YMZRO242.mjs"));
|
|
9
|
+
var Transcriber = Capability.lazy("Transcriber", () => import("../transcriber-ABHATBVH.mjs"));
|
|
10
|
+
export {
|
|
11
|
+
BlueprintDefinition,
|
|
12
|
+
OperationHandler,
|
|
13
|
+
ReactSurface,
|
|
14
|
+
TextContent,
|
|
15
|
+
Transcriber
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/capabilities/index.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n// eslint-disable-next-line unused-imports/no-unused-imports\nimport type { Blueprint, OperationHandlerSet } from '@dxos/compute';\n\nexport const BlueprintDefinition = Capability.lazy('BlueprintDefinition', () => import('./blueprint-definition'));\nexport const TextContent = Capability.lazy('TextContent', () => import('./text-content'));\nexport const OperationHandler = Capability.lazy<OperationHandlerSet.OperationHandlerSet>(\n 'OperationHandler',\n () => import('./operation-handler'),\n);\nexport const ReactSurface = Capability.lazy('ReactSurface', () => import('./react-surface'));\nexport const Transcriber = Capability.lazy('Transcriber', () => import('./transcriber'));\n"],
|
|
5
|
+
"mappings": ";;;AAIA,SAASA,kBAAkB;AAIpB,IAAMC,sBAAsBD,WAAWE,KAAK,uBAAuB,MAAM,OAAO,sCAAA,CAAA;AAChF,IAAMC,cAAcH,WAAWE,KAAK,eAAe,MAAM,OAAO,8BAAA,CAAA;AAChE,IAAME,mBAAmBJ,WAAWE,KACzC,oBACA,MAAM,OAAO,mCAAA,CAAA;AAER,IAAMG,eAAeL,WAAWE,KAAK,gBAAgB,MAAM,OAAO,+BAAA,CAAA;AAClE,IAAMI,cAAcN,WAAWE,KAAK,eAAe,MAAM,OAAO,6BAAA,CAAA;",
|
|
6
|
+
"names": ["Capability", "BlueprintDefinition", "lazy", "TextContent", "OperationHandler", "ReactSurface", "Transcriber"]
|
|
7
|
+
}
|
|
@@ -101,51 +101,31 @@ var useAudioTrack = (active, constraints) => {
|
|
|
101
101
|
return track;
|
|
102
102
|
};
|
|
103
103
|
|
|
104
|
-
// src/hooks/
|
|
105
|
-
import { useEffect as useEffect3, useMemo
|
|
106
|
-
var
|
|
104
|
+
// src/hooks/useFeedModelAdapter.ts
|
|
105
|
+
import { useEffect as useEffect3, useMemo } from "react";
|
|
106
|
+
var useFeedModelAdapter = (renderer, objects, initialChunks = []) => {
|
|
107
107
|
const model = useMemo(() => new SerializationModel(renderer, initialChunks), [
|
|
108
|
-
|
|
108
|
+
renderer
|
|
109
109
|
]);
|
|
110
|
-
const [loaded, setLoaded] = useState3(false);
|
|
111
110
|
useEffect3(() => {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
115
|
-
const update = () => {
|
|
116
|
-
for (const block of queue?.objects ?? []) {
|
|
117
|
-
model.appendChunk(block);
|
|
118
|
-
}
|
|
119
|
-
setLoaded(true);
|
|
120
|
-
};
|
|
121
|
-
let i;
|
|
122
|
-
if (queue.isLoading) {
|
|
123
|
-
i = setInterval(() => {
|
|
124
|
-
if (!queue?.isLoading) {
|
|
125
|
-
clearInterval(i);
|
|
126
|
-
update();
|
|
127
|
-
}
|
|
128
|
-
}, 1e3);
|
|
129
|
-
} else {
|
|
130
|
-
update();
|
|
111
|
+
for (const chunk of objects) {
|
|
112
|
+
model.appendChunk(chunk);
|
|
131
113
|
}
|
|
132
|
-
return () => clearTimeout(i);
|
|
133
114
|
}, [
|
|
134
115
|
model,
|
|
135
|
-
|
|
116
|
+
objects
|
|
136
117
|
]);
|
|
137
118
|
useEffect3(() => {
|
|
138
|
-
if (
|
|
119
|
+
if (model.chunks.length === objects.length) {
|
|
139
120
|
return;
|
|
140
121
|
}
|
|
141
|
-
const chunk =
|
|
122
|
+
const chunk = objects.at(-1);
|
|
142
123
|
if (chunk) {
|
|
143
124
|
model.appendChunk(chunk);
|
|
144
125
|
}
|
|
145
126
|
}, [
|
|
146
127
|
model,
|
|
147
|
-
|
|
148
|
-
queue?.objects.length
|
|
128
|
+
objects.length
|
|
149
129
|
]);
|
|
150
130
|
return model;
|
|
151
131
|
};
|
|
@@ -185,17 +165,90 @@ var useTranscriber = ({ audioStreamTrack, recorderConfig, transcriberConfig, onS
|
|
|
185
165
|
return transcriber;
|
|
186
166
|
};
|
|
187
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 { runAndForwardErrors } 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), 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
|
+
|
|
188
241
|
// src/hooks/useVoiceInput.ts
|
|
189
|
-
import { useCallback, useEffect as
|
|
242
|
+
import { useCallback as useCallback2, useEffect as useEffect6, useState as useState4 } from "react";
|
|
190
243
|
import { scheduleMicroTask } from "@dxos/async";
|
|
191
244
|
import { Context as Context2 } from "@dxos/context";
|
|
192
|
-
import { log as
|
|
245
|
+
import { log as log3 } from "@dxos/log";
|
|
193
246
|
import { useSoundEffect } from "@dxos/react-ui-sfx";
|
|
194
|
-
var
|
|
247
|
+
var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useVoiceInput.ts";
|
|
195
248
|
var useVoiceInput = ({ active, onUpdate }) => {
|
|
196
249
|
const soundStart = useSoundEffect("StartRecording");
|
|
197
250
|
const soundStop = useSoundEffect("StopRecording");
|
|
198
|
-
const handleSegments =
|
|
251
|
+
const handleSegments = useCallback2(async (segments) => {
|
|
199
252
|
const text = segments.map((str) => str.text.trim().replace(/[^\w\s]/g, "")).join(" ");
|
|
200
253
|
onUpdate(text);
|
|
201
254
|
}, []);
|
|
@@ -205,19 +258,19 @@ var useVoiceInput = ({ active, onUpdate }) => {
|
|
|
205
258
|
audioStreamTrack: track,
|
|
206
259
|
onSegments: handleSegments
|
|
207
260
|
});
|
|
208
|
-
|
|
209
|
-
const ctx = new Context2(void 0, { "~LogMeta": "~LogMeta", F:
|
|
261
|
+
useEffect6(() => {
|
|
262
|
+
const ctx = new Context2(void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 29 });
|
|
210
263
|
scheduleMicroTask(ctx, async () => {
|
|
211
264
|
if (active && transcriber) {
|
|
212
265
|
await transcriber.open();
|
|
213
|
-
|
|
266
|
+
log3.info("starting...", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 33, S: void 0 });
|
|
214
267
|
setRecording(true);
|
|
215
268
|
void soundStart.play();
|
|
216
269
|
transcriber.startChunksRecording();
|
|
217
270
|
} else if (!active && transcriber?.isOpen) {
|
|
218
271
|
transcriber?.stopChunksRecording();
|
|
219
272
|
await transcriber?.close();
|
|
220
|
-
|
|
273
|
+
log3.info("stopped", void 0, { "~LogMeta": "~LogMeta", F: __dxlog_file3, L: 40, S: void 0 });
|
|
221
274
|
setRecording(false);
|
|
222
275
|
void soundStop.play();
|
|
223
276
|
}
|
|
@@ -237,8 +290,9 @@ var useVoiceInput = ({ active, onUpdate }) => {
|
|
|
237
290
|
export {
|
|
238
291
|
useAudioFile,
|
|
239
292
|
useAudioTrack,
|
|
240
|
-
|
|
293
|
+
useFeedModelAdapter,
|
|
241
294
|
useTranscriber,
|
|
295
|
+
useTranscriptionRecording,
|
|
242
296
|
useVoiceInput
|
|
243
297
|
};
|
|
244
|
-
//# sourceMappingURL=chunk-
|
|
298
|
+
//# sourceMappingURL=chunk-2O3ONPRZ.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/hooks/useAudioFile.ts", "../../../src/hooks/useAudioTrack.ts", "../../../src/hooks/useFeedModelAdapter.ts", "../../../src/hooks/useTranscriber.ts", "../../../src/hooks/useTranscriptionRecording.ts", "../../../src/hooks/useVoiceInput.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\nimport { scheduleTask } from '@dxos/async';\nimport { Context } from '@dxos/context';\nimport { log } from '@dxos/log';\n\nexport type UseAudioState = {\n audio?: HTMLAudioElement;\n stream?: MediaStream;\n track?: MediaStreamTrack;\n};\n\nexport const useAudioFile = (audioUrl: string, constraints?: MediaTrackConstraints): UseAudioState => {\n const [{ audio, stream, track }, setStream] = useState<UseAudioState>({});\n useEffect(() => {\n const ctx = new Context();\n\n scheduleTask(ctx, async () => {\n // TODO(wittjosiah): Fetch to external url fails in headless storybook test.\n try {\n const response = await fetch(audioUrl);\n const blob = await response.blob();\n const objectUrl = URL.createObjectURL(blob);\n ctx.onDispose(() => {\n URL.revokeObjectURL(objectUrl);\n });\n\n const audio = new Audio();\n audio.src = objectUrl;\n\n await new Promise<void>((resolve, reject) => {\n audio.addEventListener(\n 'error',\n (err) => {\n log.error('error', { err });\n reject(err);\n },\n { once: true },\n );\n audio.addEventListener(\n 'canplay',\n async () => {\n resolve();\n },\n { once: true },\n );\n audio.load();\n });\n\n const audioCtx = new AudioContext();\n\n // Resume AudioContext if it's suspended.\n if (audioCtx.state === 'suspended') {\n await audioCtx.resume();\n }\n\n const destination = audioCtx.createMediaStreamDestination();\n destination.channelCount = 1;\n\n const source = audioCtx.createMediaElementSource(audio);\n source.connect(destination);\n const track = destination.stream.getAudioTracks()[0];\n if (constraints) {\n await track.applyConstraints(constraints).catch((err) => log.catch(err));\n }\n\n // Also connect to speakers so audio is audible.\n setStream({\n audio,\n stream: destination.stream,\n track: destination.stream.getAudioTracks()[0],\n });\n } catch (err) {\n log.catch(err);\n }\n });\n\n return () => {\n void ctx.dispose();\n };\n }, [audioUrl]);\n\n return { audio, stream, track };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useState } from 'react';\n\n/**\n *\n */\n// TODO(burdon): Reconcile with react-ui-sfx and plugin-calls.\nexport const useAudioTrack = (active?: boolean, constraints?: MediaTrackConstraints): MediaStreamTrack | undefined => {\n const [track, setTrack] = useState<MediaStreamTrack>();\n useEffect(() => {\n if (!active) {\n track?.stop();\n setTrack(undefined);\n return;\n }\n\n const initAudio = async () => {\n const audio = new Audio();\n audio.srcObject = await navigator.mediaDevices.getUserMedia({ audio: constraints ?? true });\n const [track] = audio.srcObject.getAudioTracks();\n if (track) {\n setTrack(track);\n }\n };\n\n if (active) {\n void initAudio();\n }\n }, [active]);\n\n return track;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useMemo } from 'react';\n\nimport type { Obj } from '@dxos/echo';\n\nimport { type ChunkRenderer, SerializationModel } from '../model';\n\n/**\n * Feeds an array of objects (typically from `useQuery(db, Query.from(feed))`) into a\n * `SerializationModel`, appending each new tail item as the array grows.\n *\n * @param renderer - chunk renderer.\n * @param objects - current snapshot of feed items.\n * @param initialChunks - chunks to seed the model with on first render.\n */\nexport const useFeedModelAdapter = <T extends Obj.Unknown>(\n renderer: ChunkRenderer<T>,\n objects: readonly T[],\n initialChunks: T[] = [],\n): SerializationModel<T> => {\n const model = useMemo(() => new SerializationModel<T>(renderer, initialChunks), [renderer]);\n\n // Seed the model with the current snapshot on first render and whenever the\n // identity of `objects` changes (e.g. feed swapped).\n useEffect(() => {\n for (const chunk of objects) {\n model.appendChunk(chunk);\n }\n }, [model, objects]);\n\n // Append new tail items as the array grows.\n useEffect(() => {\n if (model.chunks.length === objects.length) {\n return;\n }\n const chunk = objects.at(-1);\n if (chunk) {\n model.appendChunk(chunk);\n }\n }, [model, objects.length]);\n\n return model;\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useEffect, useMemo } from 'react';\n\nimport { useCapabilities } from '@dxos/app-framework/ui';\n\nimport { TranscriptionCapabilities } from '#types';\n\nimport { type Transcriber } from '../transcriber';\n\n/**\n * Records audio while user is speaking and transcribes it after user is done speaking.\n */\nexport const useTranscriber = ({\n audioStreamTrack,\n recorderConfig,\n transcriberConfig,\n onSegments,\n transcribe,\n}: Partial<TranscriptionCapabilities.GetTranscriberProps>) => {\n const [getTranscriber] = useCapabilities(TranscriptionCapabilities.Transcriber);\n\n // Initialize audio transcription.\n const transcriber = useMemo<Transcriber | undefined>(() => {\n if (!getTranscriber || !audioStreamTrack || !onSegments) {\n return undefined;\n }\n\n return getTranscriber({\n audioStreamTrack,\n recorderConfig,\n transcriberConfig,\n onSegments,\n transcribe,\n });\n }, [getTranscriber, audioStreamTrack, recorderConfig, transcriberConfig, onSegments, transcribe]);\n\n useEffect(() => {\n return () => {\n void transcriber?.close();\n };\n }, [transcriber]);\n\n return transcriber;\n};\n", "//\n// Copyright 2024 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { createFeedServiceLayer } from '@dxos/client/echo';\nimport { Feed, Obj } from '@dxos/echo';\nimport { runAndForwardErrors } from '@dxos/effect';\nimport { log } from '@dxos/log';\nimport { getSpace } from '@dxos/react-client/echo';\nimport { useIdentity } from '@dxos/react-client/halo';\nimport { Message, type Transcript } from '@dxos/types';\n\nimport { useAudioTrack } from './useAudioTrack';\nimport { useTranscriber } from './useTranscriber';\n\nexport type TranscriptionRecording = {\n recording: boolean;\n toggleRecording: () => void;\n};\n\n/**\n * Drives the recording lifecycle for a transcript: opens an audio track, feeds it through the\n * transcriber, and appends transcribed message batches to the transcript's feed. Returns the\n * recording flag and a toggle callback for the caller to wire to UI.\n */\nexport const useTranscriptionRecording = (transcript: Transcript.Transcript): TranscriptionRecording => {\n const space = getSpace(transcript);\n const identity = useIdentity();\n const feed = transcript.feed.target;\n\n const [recording, setRecording] = useState(false);\n const track = useAudioTrack(recording);\n\n // Append a transcribed message batch to the transcript's feed.\n const handleSegments = useCallback(\n async (blocks: Message.Message['blocks']) => {\n if (!space || !feed || blocks.length === 0) {\n return;\n }\n const sender = identity ? { identityDid: identity.did, name: identity.profile?.displayName } : {};\n const message = Obj.make(Message.Message, {\n sender,\n created: new Date().toISOString(),\n blocks,\n });\n const feedServiceLayer = createFeedServiceLayer(space.queues);\n await Feed.append(feed, [message]).pipe(Effect.provide(feedServiceLayer), runAndForwardErrors);\n },\n [space, feed, identity],\n );\n\n // Drive the transcriber lifecycle off the recording flag + audio track.\n const transcriber = useTranscriber({ audioStreamTrack: track, onSegments: handleSegments });\n useEffect(() => {\n if (!transcriber) {\n return;\n }\n let cancelled = false;\n // If `open()` rejects (e.g. mic permission denied, device init failure) we must\n // clear `recording` — otherwise the toolbar button reports \"stop\" forever while\n // nothing is actually being captured.\n void transcriber.open().then(\n () => {\n if (!cancelled && recording) {\n transcriber.startChunksRecording();\n }\n },\n (err) => {\n if (!cancelled) {\n log.catch(err);\n setRecording(false);\n }\n },\n );\n return () => {\n cancelled = true;\n transcriber.stopChunksRecording();\n };\n }, [transcriber, recording]);\n\n const toggleRecording = useCallback(() => setRecording((value) => !value), []);\n\n return { recording, toggleRecording };\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { useCallback, useEffect, useState } from 'react';\n\nimport { scheduleMicroTask } from '@dxos/async';\nimport { Context } from '@dxos/context';\nimport { log } from '@dxos/log';\nimport { useSoundEffect } from '@dxos/react-ui-sfx';\n\nimport { type TranscriberProps } from '../transcriber';\nimport { useAudioTrack } from './useAudioTrack';\nimport { useTranscriber } from './useTranscriber';\n\nexport type UseVoiceInputProps = {\n active?: boolean;\n onUpdate: (text: string) => void;\n};\n\n/**\n * Hook for voice input.\n */\nexport const useVoiceInput = ({ active, onUpdate }: UseVoiceInputProps) => {\n const soundStart = useSoundEffect('StartRecording');\n const soundStop = useSoundEffect('StopRecording');\n\n const handleSegments = useCallback<TranscriberProps['onSegments']>(async (segments) => {\n const text = segments.map((str) => str.text.trim().replace(/[^\\w\\s]/g, '')).join(' ');\n onUpdate(text);\n }, []);\n\n // Audio/transcription.\n const [recording, setRecording] = useState(false);\n const track = useAudioTrack(active);\n const transcriber = useTranscriber({\n audioStreamTrack: track,\n onSegments: handleSegments,\n });\n\n // Start/stop transcription.\n useEffect(() => {\n const ctx = new Context();\n scheduleMicroTask(ctx, async () => {\n if (active && transcriber) {\n await transcriber.open();\n log.info('starting...');\n setRecording(true);\n void soundStart.play();\n transcriber.startChunksRecording();\n } else if (!active && transcriber?.isOpen) {\n transcriber?.stopChunksRecording();\n await transcriber?.close();\n log.info('stopped');\n setRecording(false);\n void soundStop.play();\n }\n });\n\n return () => {\n void ctx.dispose();\n };\n }, [active, transcriber]);\n\n return { recording };\n};\n"],
|
|
5
|
+
"mappings": ";;;;;AAIA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", "objectUrl", "createObjectURL", "ctx", "onDispose", "URL", "revokeObjectURL", "audio", "Audio", "Promise", "resolve", "addEventListener", "err", "reject", "once", "audioCtx", "state", "destination", "source", "createMediaElementSource", "connect", "track", "constraints", "applyConstraints", "catch", "setStream", "stream", "audioUrl", "useEffect", "useState", "useAudioTrack", "active", "constraints", "track", "setTrack", "stop", "undefined", "initAudio", "audio", "Audio", "srcObject", "navigator", "mediaDevices", "getUserMedia", "getAudioTracks", "useEffect", "useMemo", "useFeedModelAdapter", "renderer", "objects", "initialChunks", "model", "useMemo", "SerializationModel", "useEffect", "chunk", "appendChunk", "chunks", "length", "at", "useEffect", "useMemo", "useCapabilities", "TranscriptionCapabilities", "useTranscriber", "audioStreamTrack", "recorderConfig", "transcriberConfig", "onSegments", "transcribe", "getTranscriber", "Transcriber", "transcriber", "undefined", "close", "Effect", "useCallback", "useEffect", "useState", "createFeedServiceLayer", "Feed", "Obj", "runAndForwardErrors", "log", "getSpace", "useIdentity", "Message", "__dxlog_file", "identity", "useIdentity", "feed", "transcript", "target", "recording", "setRecording", "track", "useAudioTrack", "useState", "handleSegments", "useCallback", "name", "message", "Obj", "Message", "sender", "created", "Date", "toISOString", "blocks", "pipe", "Effect", "provide", "feedServiceLayer", "space", "onSegments", "useEffect", "cancelled", "transcriber", "startChunksRecording", "err", "log", "toggleRecording", "useCallback", "useEffect", "useState", "scheduleMicroTask", "Context", "log", "useSoundEffect", "__dxlog_file", "soundStop", "useSoundEffect", "handleSegments", "useCallback", "segments", "str", "trim", "onUpdate", "text", "transcriber", "useTranscriber", "audioStreamTrack", "track", "onSegments", "useEffect", "scheduleMicroTask", "active", "log", "setRecording", "soundStart", "startChunksRecording", "stopChunksRecording", "close"]
|
|
7
|
+
}
|