@dxos/plugin-transcription 0.8.3 → 0.8.4-main.1c7ec43d41

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.
Files changed (330) hide show
  1. package/dist/lib/browser/blueprints/index.mjs +31 -0
  2. package/dist/lib/browser/blueprints/index.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-3L623EVL.mjs +17 -0
  4. package/dist/lib/browser/chunk-3L623EVL.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  6. package/dist/lib/browser/chunk-KAEXRX3Y.mjs +35 -0
  7. package/dist/lib/browser/chunk-KAEXRX3Y.mjs.map +7 -0
  8. package/dist/lib/browser/chunk-L4HW35L6.mjs +111 -0
  9. package/dist/lib/browser/chunk-L4HW35L6.mjs.map +7 -0
  10. package/dist/lib/browser/chunk-MLRJWAQH.mjs +179 -0
  11. package/dist/lib/browser/chunk-MLRJWAQH.mjs.map +7 -0
  12. package/dist/lib/browser/chunk-NQQK7UZQ.mjs +244 -0
  13. package/dist/lib/browser/chunk-NQQK7UZQ.mjs.map +7 -0
  14. package/dist/lib/browser/components/index.mjs +207 -0
  15. package/dist/lib/browser/components/index.mjs.map +7 -0
  16. package/dist/lib/browser/create-ULR5DPJZ.mjs +21 -0
  17. package/dist/lib/browser/create-ULR5DPJZ.mjs.map +7 -0
  18. package/dist/lib/browser/hooks/index.mjs +17 -0
  19. package/dist/lib/browser/index.mjs +442 -94
  20. package/dist/lib/browser/index.mjs.map +4 -4
  21. package/dist/lib/browser/meta.json +1 -1
  22. package/dist/lib/browser/open-SFMPLZVW.mjs +27 -0
  23. package/dist/lib/browser/open-SFMPLZVW.mjs.map +7 -0
  24. package/dist/lib/browser/operations/index.mjs +13 -0
  25. package/dist/lib/browser/operations/index.mjs.map +7 -0
  26. package/dist/lib/browser/summarize-BDFX4APN.mjs +78 -0
  27. package/dist/lib/browser/summarize-BDFX4APN.mjs.map +7 -0
  28. package/dist/lib/browser/types/index.mjs +4 -8
  29. package/dist/lib/node-esm/blueprints/index.mjs +32 -0
  30. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  31. package/dist/lib/node-esm/chunk-7UIZWCD4.mjs +112 -0
  32. package/dist/lib/node-esm/chunk-7UIZWCD4.mjs.map +7 -0
  33. package/dist/lib/node-esm/chunk-C3AE2NYJ.mjs +181 -0
  34. package/dist/lib/node-esm/chunk-C3AE2NYJ.mjs.map +7 -0
  35. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  36. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  37. package/dist/lib/node-esm/chunk-KO3IOD2O.mjs +19 -0
  38. package/dist/lib/node-esm/chunk-KO3IOD2O.mjs.map +7 -0
  39. package/dist/lib/node-esm/chunk-MQK4R6GT.mjs +245 -0
  40. package/dist/lib/node-esm/chunk-MQK4R6GT.mjs.map +7 -0
  41. package/dist/lib/node-esm/chunk-O533NBMK.mjs +37 -0
  42. package/dist/lib/node-esm/chunk-O533NBMK.mjs.map +7 -0
  43. package/dist/lib/node-esm/components/index.mjs +208 -0
  44. package/dist/lib/node-esm/components/index.mjs.map +7 -0
  45. package/dist/lib/node-esm/create-A5QHNWRF.mjs +22 -0
  46. package/dist/lib/node-esm/create-A5QHNWRF.mjs.map +7 -0
  47. package/dist/lib/node-esm/hooks/index.mjs +18 -0
  48. package/dist/lib/node-esm/hooks/index.mjs.map +7 -0
  49. package/dist/lib/node-esm/index.mjs +442 -94
  50. package/dist/lib/node-esm/index.mjs.map +4 -4
  51. package/dist/lib/node-esm/meta.json +1 -1
  52. package/dist/lib/node-esm/open-OI24QNTO.mjs +28 -0
  53. package/dist/lib/node-esm/open-OI24QNTO.mjs.map +7 -0
  54. package/dist/lib/node-esm/operations/index.mjs +14 -0
  55. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  56. package/dist/lib/node-esm/summarize-3UNN24I2.mjs +79 -0
  57. package/dist/lib/node-esm/summarize-3UNN24I2.mjs.map +7 -0
  58. package/dist/lib/node-esm/types/index.mjs +4 -8
  59. package/dist/types/src/TranscriptionPlugin.d.ts +3 -1
  60. package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
  61. package/dist/types/src/TranscriptionPlugin.node.d.ts +4 -0
  62. package/dist/types/src/TranscriptionPlugin.node.d.ts.map +1 -0
  63. package/dist/types/src/TranscriptionPlugin.test.d.ts +2 -0
  64. package/dist/types/src/TranscriptionPlugin.test.d.ts.map +1 -0
  65. package/dist/types/src/blueprints/index.d.ts +2 -0
  66. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  67. package/dist/types/src/blueprints/transcription-blueprint.d.ts +4 -0
  68. package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
  69. package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
  70. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/index.d.ts +10 -4
  72. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  73. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  74. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  76. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  77. package/dist/types/src/capabilities/text-content.d.ts +8 -0
  78. package/dist/types/src/capabilities/text-content.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/transcriber.d.ts +4 -3
  80. package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
  81. package/dist/types/src/components/Transcription/Transcription.d.ts +18 -0
  82. package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
  83. package/dist/types/src/components/Transcription/Transcription.stories.d.ts +40 -0
  84. package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -0
  85. package/dist/types/src/components/Transcription/index.d.ts +2 -0
  86. package/dist/types/src/components/Transcription/index.d.ts.map +1 -0
  87. package/dist/types/src/components/Transcription/transcription-extension.d.ts +15 -0
  88. package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -0
  89. package/dist/types/src/components/index.d.ts +1 -6
  90. package/dist/types/src/components/index.d.ts.map +1 -1
  91. package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +6 -0
  92. package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +1 -0
  93. package/dist/types/src/containers/TranscriptionContainer/index.d.ts +2 -0
  94. package/dist/types/src/containers/TranscriptionContainer/index.d.ts.map +1 -0
  95. package/dist/types/src/containers/index.d.ts +3 -0
  96. package/dist/types/src/containers/index.d.ts.map +1 -0
  97. package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
  98. package/dist/types/src/hooks/useAudioTrack.d.ts.map +1 -1
  99. package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
  100. package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
  101. package/dist/types/src/hooks/useTranscriber.d.ts +2 -2
  102. package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
  103. package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
  104. package/dist/types/src/index.d.ts +4 -4
  105. package/dist/types/src/index.d.ts.map +1 -1
  106. package/dist/types/src/meta.d.ts +2 -3
  107. package/dist/types/src/meta.d.ts.map +1 -1
  108. package/dist/types/src/model/model.d.ts +2 -2
  109. package/dist/types/src/model/model.d.ts.map +1 -1
  110. package/dist/types/src/{segments-normalization → normalization}/index.d.ts +1 -1
  111. package/dist/types/src/normalization/index.d.ts.map +1 -0
  112. package/dist/types/src/{segments-normalization → normalization}/message-normalizer.d.ts +5 -5
  113. package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -0
  114. package/dist/types/src/normalization/normalization.d.ts +364 -0
  115. package/dist/types/src/normalization/normalization.d.ts.map +1 -0
  116. package/dist/types/src/normalization/normalization.test.d.ts.map +1 -0
  117. package/dist/types/src/normalization/utils.d.ts +3 -0
  118. package/dist/types/src/normalization/utils.d.ts.map +1 -0
  119. package/dist/types/src/operations/create.d.ts +5 -0
  120. package/dist/types/src/operations/create.d.ts.map +1 -0
  121. package/dist/types/src/operations/definitions.d.ts +917 -0
  122. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  123. package/dist/types/src/operations/index.d.ts +4 -0
  124. package/dist/types/src/operations/index.d.ts.map +1 -0
  125. package/dist/types/src/operations/open.d.ts +5 -0
  126. package/dist/types/src/operations/open.d.ts.map +1 -0
  127. package/dist/types/src/operations/summarize.d.ts +8 -0
  128. package/dist/types/src/operations/summarize.d.ts.map +1 -0
  129. package/dist/types/src/stories/FileTranscription.stories.d.ts +18 -0
  130. package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -0
  131. package/dist/types/src/stories/KeyWordRecognition.stories.d.ts +14 -0
  132. package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
  133. package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts +20 -0
  134. package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts.map +1 -0
  135. package/dist/types/src/stories/TranscriptionStory.d.ts +23 -0
  136. package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -0
  137. package/dist/types/src/stories/useIsSpeaking.d.ts.map +1 -0
  138. package/dist/types/src/testing/testing.d.ts +10 -10
  139. package/dist/types/src/testing/testing.d.ts.map +1 -1
  140. package/dist/types/src/transcriber/media-stream-recorder.d.ts +3 -3
  141. package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
  142. package/dist/types/src/transcriber/transcriber.d.ts +60 -5
  143. package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
  144. package/dist/types/src/transcriber/transcriber.test.d.ts +2 -0
  145. package/dist/types/src/transcriber/transcriber.test.d.ts.map +1 -0
  146. package/dist/types/src/transcriber/transcription-manager.d.ts +12 -13
  147. package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
  148. package/dist/types/src/translations.d.ts +10 -11
  149. package/dist/types/src/translations.d.ts.map +1 -1
  150. package/dist/types/src/types/capabilities.d.ts +19 -0
  151. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  152. package/dist/types/src/types/defs.d.ts +5 -0
  153. package/dist/types/src/types/defs.d.ts.map +1 -0
  154. package/dist/types/src/types/index.d.ts +2 -2
  155. package/dist/types/src/types/index.d.ts.map +1 -1
  156. package/dist/types/src/util/array.d.ts.map +1 -1
  157. package/dist/types/src/util/get-time-str.d.ts.map +1 -1
  158. package/dist/types/src/util/index.d.ts +1 -0
  159. package/dist/types/src/util/index.d.ts.map +1 -1
  160. package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
  161. package/dist/types/src/util/render-byline.d.ts +4 -0
  162. package/dist/types/src/util/render-byline.d.ts.map +1 -0
  163. package/dist/types/tsconfig.tsbuildinfo +1 -1
  164. package/package.json +127 -82
  165. package/src/TranscriptionPlugin.node.ts +20 -0
  166. package/src/TranscriptionPlugin.test.ts +31 -0
  167. package/src/TranscriptionPlugin.tsx +22 -61
  168. package/src/blueprints/index.ts +5 -0
  169. package/src/blueprints/transcription-blueprint.ts +29 -0
  170. package/src/capabilities/blueprint-definition.ts +19 -0
  171. package/src/capabilities/index.ts +11 -6
  172. package/src/capabilities/operation-handler.ts +16 -0
  173. package/src/capabilities/react-surface.tsx +23 -14
  174. package/src/capabilities/text-content.ts +33 -0
  175. package/src/capabilities/transcriber.ts +54 -42
  176. package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +78 -73
  177. package/src/components/Transcription/Transcription.tsx +64 -0
  178. package/src/components/{Transcript → Transcription}/index.ts +1 -1
  179. package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +15 -48
  180. package/src/components/index.ts +1 -6
  181. package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +35 -0
  182. package/src/containers/TranscriptionContainer/index.ts +5 -0
  183. package/src/containers/index.ts +7 -0
  184. package/src/hooks/useAudioFile.ts +49 -53
  185. package/src/hooks/useQueueModelAdapter.ts +1 -1
  186. package/src/hooks/useTranscriber.ts +15 -7
  187. package/src/hooks/useVoiceInput.ts +3 -3
  188. package/src/index.ts +10 -5
  189. package/src/meta.ts +9 -6
  190. package/src/model/model.test.ts +27 -21
  191. package/src/model/model.ts +3 -3
  192. package/src/{segments-normalization → normalization}/message-normalizer.ts +20 -19
  193. package/src/{segments-normalization → normalization}/normalization.test.ts +26 -33
  194. package/src/normalization/normalization.ts +77 -0
  195. package/src/{segments-normalization → normalization}/utils.ts +2 -2
  196. package/src/operations/create.ts +24 -0
  197. package/src/operations/definitions.ts +101 -0
  198. package/src/operations/index.ts +13 -0
  199. package/src/operations/open.ts +28 -0
  200. package/src/operations/summarize.ts +101 -0
  201. package/src/{components/stories → stories}/FileTranscription.stories.tsx +99 -72
  202. package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +46 -40
  203. package/src/{components/stories → stories}/MicrophoneTranscription.stories.tsx +85 -101
  204. package/src/stories/TranscriptionStory.tsx +93 -0
  205. package/src/testing/testing.ts +41 -41
  206. package/src/transcriber/media-stream-recorder.ts +4 -4
  207. package/src/transcriber/transcriber.browser.test.ts +5 -5
  208. package/src/transcriber/transcriber.test.ts +104 -0
  209. package/src/transcriber/transcriber.ts +101 -62
  210. package/src/transcriber/transcription-manager.ts +37 -52
  211. package/src/translations.ts +12 -10
  212. package/src/types/capabilities.ts +39 -0
  213. package/src/types/defs.ts +9 -0
  214. package/src/types/index.ts +2 -2
  215. package/src/util/index.ts +1 -0
  216. package/src/util/render-byline.ts +33 -0
  217. package/dist/lib/browser/TranscriptContainer-H3AZQ4CQ.mjs +0 -11
  218. package/dist/lib/browser/chunk-53AXUEIQ.mjs +0 -764
  219. package/dist/lib/browser/chunk-53AXUEIQ.mjs.map +0 -7
  220. package/dist/lib/browser/chunk-GOF7MJNV.mjs +0 -19
  221. package/dist/lib/browser/chunk-GOF7MJNV.mjs.map +0 -7
  222. package/dist/lib/browser/chunk-IQ5ZRMHZ.mjs +0 -495
  223. package/dist/lib/browser/chunk-IQ5ZRMHZ.mjs.map +0 -7
  224. package/dist/lib/browser/chunk-OSISJM2F.mjs +0 -55
  225. package/dist/lib/browser/chunk-OSISJM2F.mjs.map +0 -7
  226. package/dist/lib/browser/chunk-UDCCT32F.mjs +0 -8
  227. package/dist/lib/browser/chunk-UDCCT32F.mjs.map +0 -7
  228. package/dist/lib/browser/chunk-W2KNYJD6.mjs +0 -16
  229. package/dist/lib/browser/chunk-W2KNYJD6.mjs.map +0 -7
  230. package/dist/lib/browser/intent-resolver-BGADCHVM.mjs +0 -30
  231. package/dist/lib/browser/intent-resolver-BGADCHVM.mjs.map +0 -7
  232. package/dist/lib/browser/react-surface-HMJS5FSS.mjs +0 -34
  233. package/dist/lib/browser/react-surface-HMJS5FSS.mjs.map +0 -7
  234. package/dist/lib/browser/transcriber-OYPLZFG5.mjs +0 -56
  235. package/dist/lib/browser/transcriber-OYPLZFG5.mjs.map +0 -7
  236. package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs +0 -32
  237. package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs.map +0 -7
  238. package/dist/lib/node/chunk-3PYT3BDM.cjs +0 -40
  239. package/dist/lib/node/chunk-3PYT3BDM.cjs.map +0 -7
  240. package/dist/lib/node/chunk-6LW5RA3K.cjs +0 -75
  241. package/dist/lib/node/chunk-6LW5RA3K.cjs.map +0 -7
  242. package/dist/lib/node/chunk-AFUZI63A.cjs +0 -42
  243. package/dist/lib/node/chunk-AFUZI63A.cjs.map +0 -7
  244. package/dist/lib/node/chunk-CVUN3UO7.cjs +0 -778
  245. package/dist/lib/node/chunk-CVUN3UO7.cjs.map +0 -7
  246. package/dist/lib/node/chunk-FKDJNJ57.cjs +0 -35
  247. package/dist/lib/node/chunk-FKDJNJ57.cjs.map +0 -7
  248. package/dist/lib/node/chunk-ZFAUMZXE.cjs +0 -518
  249. package/dist/lib/node/chunk-ZFAUMZXE.cjs.map +0 -7
  250. package/dist/lib/node/index.cjs +0 -133
  251. package/dist/lib/node/index.cjs.map +0 -7
  252. package/dist/lib/node/intent-resolver-LL3TTI4H.cjs +0 -45
  253. package/dist/lib/node/intent-resolver-LL3TTI4H.cjs.map +0 -7
  254. package/dist/lib/node/meta.json +0 -1
  255. package/dist/lib/node/react-surface-N25TBBG4.cjs +0 -56
  256. package/dist/lib/node/react-surface-N25TBBG4.cjs.map +0 -7
  257. package/dist/lib/node/transcriber-6J4FVFSZ.cjs +0 -68
  258. package/dist/lib/node/transcriber-6J4FVFSZ.cjs.map +0 -7
  259. package/dist/lib/node/types/index.cjs +0 -36
  260. package/dist/lib/node/types/index.cjs.map +0 -7
  261. package/dist/lib/node-esm/TranscriptContainer-G75LDEO5.mjs +0 -12
  262. package/dist/lib/node-esm/chunk-56QHOX4A.mjs +0 -765
  263. package/dist/lib/node-esm/chunk-56QHOX4A.mjs.map +0 -7
  264. package/dist/lib/node-esm/chunk-FH75X4JC.mjs +0 -56
  265. package/dist/lib/node-esm/chunk-FH75X4JC.mjs.map +0 -7
  266. package/dist/lib/node-esm/chunk-MFJO7EKD.mjs +0 -10
  267. package/dist/lib/node-esm/chunk-MFJO7EKD.mjs.map +0 -7
  268. package/dist/lib/node-esm/chunk-MFJPEIVB.mjs +0 -17
  269. package/dist/lib/node-esm/chunk-MFJPEIVB.mjs.map +0 -7
  270. package/dist/lib/node-esm/chunk-PRL64SRU.mjs +0 -496
  271. package/dist/lib/node-esm/chunk-PRL64SRU.mjs.map +0 -7
  272. package/dist/lib/node-esm/chunk-TXMDLLBR.mjs +0 -21
  273. package/dist/lib/node-esm/chunk-TXMDLLBR.mjs.map +0 -7
  274. package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs +0 -31
  275. package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs.map +0 -7
  276. package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs +0 -35
  277. package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs.map +0 -7
  278. package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs +0 -57
  279. package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs.map +0 -7
  280. package/dist/types/src/capabilities/capabilities.d.ts +0 -17
  281. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  282. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  283. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  284. package/dist/types/src/components/Transcript/Transcript.d.ts +0 -20
  285. package/dist/types/src/components/Transcript/Transcript.d.ts.map +0 -1
  286. package/dist/types/src/components/Transcript/Transcript.stories.d.ts +0 -24
  287. package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +0 -1
  288. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +0 -28
  289. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +0 -1
  290. package/dist/types/src/components/Transcript/index.d.ts +0 -2
  291. package/dist/types/src/components/Transcript/index.d.ts.map +0 -1
  292. package/dist/types/src/components/Transcript/transcript-extension.d.ts +0 -19
  293. package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
  294. package/dist/types/src/components/TranscriptContainer.d.ts +0 -8
  295. package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
  296. package/dist/types/src/components/stories/FileTranscription.stories.d.ts +0 -17
  297. package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +0 -1
  298. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +0 -10
  299. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +0 -1
  300. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +0 -19
  301. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
  302. package/dist/types/src/components/stories/TranscriptionStory.d.ts +0 -11
  303. package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +0 -1
  304. package/dist/types/src/components/stories/useIsSpeaking.d.ts.map +0 -1
  305. package/dist/types/src/segments-normalization/index.d.ts.map +0 -1
  306. package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +0 -1
  307. package/dist/types/src/segments-normalization/normalization.d.ts +0 -329
  308. package/dist/types/src/segments-normalization/normalization.d.ts.map +0 -1
  309. package/dist/types/src/segments-normalization/normalization.test.d.ts.map +0 -1
  310. package/dist/types/src/segments-normalization/utils.d.ts +0 -3
  311. package/dist/types/src/segments-normalization/utils.d.ts.map +0 -1
  312. package/dist/types/src/types/schema.d.ts +0 -41
  313. package/dist/types/src/types/schema.d.ts.map +0 -1
  314. package/dist/types/src/types/types.d.ts +0 -31
  315. package/dist/types/src/types/types.d.ts.map +0 -1
  316. package/src/capabilities/capabilities.ts +0 -33
  317. package/src/capabilities/intent-resolver.ts +0 -24
  318. package/src/components/Transcript/Transcript.tsx +0 -100
  319. package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
  320. package/src/components/TranscriptContainer.tsx +0 -30
  321. package/src/components/stories/TranscriptionStory.tsx +0 -41
  322. package/src/segments-normalization/normalization.ts +0 -105
  323. package/src/types/schema.ts +0 -41
  324. package/src/types/types.ts +0 -32
  325. package/dist/lib/browser/{TranscriptContainer-H3AZQ4CQ.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  326. package/dist/lib/{node-esm/TranscriptContainer-G75LDEO5.mjs.map → browser/hooks/index.mjs.map} +0 -0
  327. package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
  328. package/dist/types/src/{components/stories → stories}/useIsSpeaking.d.ts +0 -0
  329. package/src/{segments-normalization → normalization}/index.ts +1 -1
  330. /package/src/{components/stories → stories}/useIsSpeaking.tsx +0 -0
@@ -1,764 +0,0 @@
1
- import {
2
- TranscriptionCapabilities
3
- } from "./chunk-W2KNYJD6.mjs";
4
-
5
- // packages/plugins/plugin-transcription/src/components/TranscriptContainer.tsx
6
- import { useSignals as _useSignals2 } from "@preact-signals/safe-react/tracking";
7
- import React2 from "react";
8
- import { fullyQualifiedId, getSpace } from "@dxos/client/echo";
9
- import { useMembers, useQueue } from "@dxos/react-client/echo";
10
- import { StackItem } from "@dxos/react-ui-stack";
11
-
12
- // packages/plugins/plugin-transcription/src/components/Transcript/Transcript.tsx
13
- import { useSignals as _useSignals } from "@preact-signals/safe-react/tracking";
14
- import React from "react";
15
- import { IconButton, useThemeContext } from "@dxos/react-ui";
16
- import { createBasicExtensions, createMarkdownExtensions, createRenderer, createThemeExtensions, decorateMarkdown, editorWidth, preview, useTextEditor } from "@dxos/react-ui-editor";
17
- import { mx } from "@dxos/react-ui-theme";
18
- import { isNotFalsy } from "@dxos/util";
19
-
20
- // packages/plugins/plugin-transcription/src/components/Transcript/transcript-extension.ts
21
- import { RangeSetBuilder } from "@codemirror/state";
22
- import { EditorView, GutterMarker, ViewPlugin, gutter } from "@codemirror/view";
23
- import { format } from "date-fns/format";
24
- import { intervalToDuration } from "date-fns/intervalToDuration";
25
- import { addEventListener, combine } from "@dxos/async";
26
-
27
- // packages/plugins/plugin-transcription/src/model/model.ts
28
- import { Text } from "@codemirror/state";
29
- import { Event } from "@dxos/async";
30
- import { invariant } from "@dxos/invariant";
31
- import { log } from "@dxos/log";
32
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-transcription/src/model/model.ts";
33
- var DocumentAdapter = class {
34
- constructor(_view) {
35
- this._view = _view;
36
- }
37
- /** The document must always have at least one line. */
38
- lineCount() {
39
- return this._view.state.doc.lines - 1;
40
- }
41
- replaceLines(from, remove, insert) {
42
- log("replaceLines", {
43
- count: this._view.state.doc.lines,
44
- from,
45
- remove,
46
- insert
47
- }, {
48
- F: __dxlog_file,
49
- L: 39,
50
- S: this,
51
- C: (f, a) => f(...a)
52
- });
53
- const numLines = this._view.state.doc.lines;
54
- const posFrom = this._view.state.doc.line(from).from;
55
- const posTo = remove === 0 ? posFrom : this._view.state.doc.line(Math.min(numLines, from + remove)).from;
56
- let text = insert.join("\n");
57
- if (posTo === this._view.state.doc.length) {
58
- text += "\n";
59
- }
60
- this._view.dispatch({
61
- changes: {
62
- from: posFrom,
63
- to: posTo,
64
- insert: text
65
- }
66
- });
67
- }
68
- };
69
- var SerializationModel = class {
70
- constructor(_renderer, initialChunks = []) {
71
- this._renderer = _renderer;
72
- this._chunks = [];
73
- this._chunkLineCounts = /* @__PURE__ */ new Map();
74
- this._lineToChunk = /* @__PURE__ */ new Map();
75
- this._changes = [];
76
- this.update = new Event();
77
- initialChunks.forEach((chunk) => {
78
- this.appendChunk(chunk);
79
- });
80
- }
81
- toJSON() {
82
- return {
83
- chunks: this._chunks.length,
84
- changes: this._changes.length
85
- };
86
- }
87
- get doc() {
88
- return Text.of([
89
- ...this._chunks.flatMap((chunk, index) => this._renderer(chunk, index)),
90
- ""
91
- ]);
92
- }
93
- get chunks() {
94
- return this._chunks;
95
- }
96
- /**
97
- * Get the block ID at the given line number.
98
- */
99
- getChunkAtLine(line) {
100
- return this._lineToChunk.get(line);
101
- }
102
- reset() {
103
- this._chunks.length = 0;
104
- this._chunkLineCounts.clear();
105
- this._lineToChunk.clear();
106
- this.update.emit();
107
- return this;
108
- }
109
- appendChunk(chunk) {
110
- const index = this._chunks.length;
111
- this._chunks.push(chunk);
112
- this._changes.push({
113
- type: "append",
114
- index,
115
- chunk
116
- });
117
- this.update.emit();
118
- return this;
119
- }
120
- updateChunk(chunk) {
121
- const index = this._chunks.findIndex((c) => c.id === chunk.id);
122
- invariant(index !== -1, void 0, {
123
- F: __dxlog_file,
124
- L: 147,
125
- S: this,
126
- A: [
127
- "index !== -1",
128
- ""
129
- ]
130
- });
131
- this._chunks[index] = chunk;
132
- this._changes.push({
133
- type: "update",
134
- index,
135
- chunk
136
- });
137
- this.update.emit();
138
- return this;
139
- }
140
- deleteBlock(id) {
141
- const index = this._chunks.findIndex((c) => c.id === id);
142
- invariant(index !== -1, void 0, {
143
- F: __dxlog_file,
144
- L: 156,
145
- S: this,
146
- A: [
147
- "index !== -1",
148
- ""
149
- ]
150
- });
151
- this._chunks.splice(index, 1);
152
- this._changes.push({
153
- type: "delete",
154
- index,
155
- id
156
- });
157
- this.update.emit();
158
- return this;
159
- }
160
- /**
161
- * Syncs the tracked changes with the ChunkDocument.
162
- */
163
- sync(document2) {
164
- log("sync", {
165
- changes: this._changes
166
- }, {
167
- F: __dxlog_file,
168
- L: 167,
169
- S: this,
170
- C: (f, a) => f(...a)
171
- });
172
- for (const change of this._changes) {
173
- switch (change.type) {
174
- case "append": {
175
- const lines = this._renderer(change.chunk, change.index);
176
- const lastLine = document2.lineCount();
177
- document2.replaceLines(lastLine + 1, 0, lines);
178
- break;
179
- }
180
- case "update": {
181
- let lineStart = 1;
182
- for (let i = 0; i < change.index; i++) {
183
- lineStart += this._chunkLineCounts.get(this._chunks[i].id);
184
- }
185
- const previousLineCount = this._chunkLineCounts.get(change.chunk.id);
186
- const newLines = this._renderer(change.chunk, change.index);
187
- document2.replaceLines(lineStart, previousLineCount, newLines);
188
- break;
189
- }
190
- case "delete": {
191
- let lineStart = 1;
192
- for (let i = 0; i < change.index; i++) {
193
- lineStart += this._chunkLineCounts.get(this._chunks[i].id);
194
- }
195
- const previousLineCount = this._chunkLineCounts.get(change.id);
196
- document2.replaceLines(lineStart, previousLineCount, []);
197
- break;
198
- }
199
- }
200
- }
201
- this._lineToChunk.clear();
202
- let currentLine = 1;
203
- for (const [index, chunk] of this._chunks.entries()) {
204
- const lineCount = this._renderer(chunk, index).length;
205
- this._chunkLineCounts.set(chunk.id, lineCount);
206
- this._lineToChunk.set(currentLine, chunk);
207
- currentLine += lineCount;
208
- }
209
- const chunkIds = new Set(this._chunks.map((chunk) => chunk.id));
210
- for (const id of this._chunkLineCounts.keys()) {
211
- if (!chunkIds.has(id)) {
212
- this._chunkLineCounts.delete(id);
213
- }
214
- }
215
- this._changes.length = 0;
216
- return this;
217
- }
218
- };
219
-
220
- // packages/plugins/plugin-transcription/src/components/Transcript/transcript-extension.ts
221
- var transcript = ({ model, started, renderButton }) => {
222
- return [
223
- // Show timestamps in the gutter.
224
- gutter({
225
- class: "cm-timestamp-gutter",
226
- lineMarkerChange: (update) => update.docChanged || update.viewportChanged,
227
- markers: (view) => {
228
- const start = getStartTime(started, model.chunks[0]);
229
- const builder = new RangeSetBuilder();
230
- for (const { from, to } of view.visibleRanges) {
231
- let line = view.state.doc.lineAt(from);
232
- while (line.from <= to) {
233
- const block = model.getChunkAtLine(line.number)?.blocks[0];
234
- const timestamp = block?.type === "transcription" && block.started;
235
- if (timestamp) {
236
- builder.add(line.from, line.from, new TimestampMarker(line.number, new Date(timestamp), start));
237
- }
238
- if (line.to + 1 > view.state.doc.length) {
239
- break;
240
- }
241
- line = view.state.doc.lineAt(line.to + 1);
242
- }
243
- }
244
- return builder.finish();
245
- }
246
- }),
247
- // Listen for model updates.
248
- ViewPlugin.fromClass(class {
249
- constructor(view) {
250
- this._initialized = false;
251
- this._adapter = new DocumentAdapter(view);
252
- const scroller = view.scrollDOM;
253
- let isAutoScrolling = false;
254
- let hasScrolled = false;
255
- let timeout;
256
- const scrollToBottom = (smooth = false) => {
257
- scroller.style.scrollBehavior = smooth ? "smooth" : "";
258
- scroller.classList.add("cm-hide-scrollbar");
259
- isAutoScrolling = true;
260
- clearTimeout(timeout);
261
- timeout = setTimeout(() => {
262
- this._controls?.classList.add("opacity-0");
263
- scroller.classList.remove("cm-hide-scrollbar");
264
- isAutoScrolling = false;
265
- }, 500);
266
- view.dispatch({
267
- effects: EditorView.scrollIntoView(view.state.doc.length, {
268
- y: "end"
269
- })
270
- });
271
- };
272
- if (renderButton) {
273
- this._controls = document.createElement("div");
274
- this._controls.classList.add("cm-controls", "transition-opacity", "duration-300", "opacity-0");
275
- view.dom.appendChild(this._controls);
276
- renderButton(this._controls, {
277
- onClick: () => {
278
- scrollToBottom(false);
279
- }
280
- }, view);
281
- }
282
- this._cleanup = combine(addEventListener(view.scrollDOM, "scroll", () => {
283
- if (!isAutoScrolling) {
284
- hasScrolled = true;
285
- this._controls?.classList.remove("opacity-0");
286
- }
287
- }), model.update.on(() => {
288
- const autoScroll = scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight === 0 || !hasScrolled;
289
- model.sync(this._adapter);
290
- if (autoScroll) {
291
- scrollToBottom(true);
292
- }
293
- }));
294
- }
295
- update(update) {
296
- if (!this._initialized) {
297
- this._initialized = true;
298
- setTimeout(() => {
299
- model.sync(this._adapter);
300
- });
301
- }
302
- }
303
- destroy() {
304
- this._controls?.remove();
305
- this._cleanup();
306
- }
307
- }),
308
- EditorView.theme({
309
- ".cm-scroller": {
310
- overflowY: "scroll"
311
- },
312
- ".cm-hide-scrollbar": {
313
- scrollbarWidth: "none",
314
- "-ms-overflow-style": "none"
315
- },
316
- ".cm-hide-scrollbar::-webkit-scrollbar": {
317
- display: "none"
318
- },
319
- ".cm-controls": {
320
- position: "absolute",
321
- bottom: "0.5rem",
322
- right: "0.5rem",
323
- zIndex: 1e3
324
- },
325
- ".cm-line": {
326
- paddingRight: "1rem"
327
- },
328
- ".cm-timestamp-gutter": {
329
- width: "6rem",
330
- paddingRight: "1rem"
331
- },
332
- ".cm-timestamp-gutter > .cm-gutterElement > div": {
333
- display: "inline-flex",
334
- textAlign: "right",
335
- padding: "3px"
336
- }
337
- })
338
- ];
339
- };
340
- var TimestampMarker = class extends GutterMarker {
341
- constructor(_line, _timestamp, _started) {
342
- super(), this._line = _line, this._timestamp = _timestamp, this._started = _started;
343
- }
344
- eq(other) {
345
- return other._timestamp === this._timestamp;
346
- }
347
- toDOM(view) {
348
- const el = document.createElement("div");
349
- el.className = "text-sm text-subdued hover:bg-hoverSurface cursor-pointer";
350
- el.textContent = formatTimestamp(this._timestamp, this._started);
351
- el.onclick = () => {
352
- const pos = view.state.doc.line(this._line).from;
353
- view.dispatch({
354
- effects: EditorView.scrollIntoView(pos, {
355
- y: "start"
356
- })
357
- });
358
- };
359
- return el;
360
- }
361
- };
362
- var getStartTime = (started, message) => {
363
- if (started) {
364
- return started;
365
- }
366
- if (message?.blocks[0]?.type === "transcription" && message.blocks[0].started) {
367
- return new Date(message.blocks[0].started);
368
- }
369
- return void 0;
370
- };
371
- var formatTimestamp = (timestamp, relative) => {
372
- if (relative) {
373
- const pad = (n = 0) => String(n).padStart(2, "0");
374
- const { hours, minutes, seconds } = intervalToDuration({
375
- start: relative,
376
- end: timestamp
377
- });
378
- return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
379
- } else {
380
- return format(timestamp, "HH:mm:ss");
381
- }
382
- };
383
-
384
- // packages/plugins/plugin-transcription/src/components/Transcript/Transcript.tsx
385
- var renderMarkdown = (identities) => (message, index, debug = false) => {
386
- if (message.sender.role === "assistant") {
387
- return [
388
- message.blocks.find((block) => block.type === "transcription")?.text ?? "",
389
- ""
390
- ];
391
- }
392
- const identity = identities.find((identity2) => identity2.did === message.sender.identityDid);
393
- const name = identity?.profile?.displayName ?? message.sender.contact?.target?.fullName ?? message.sender.name ?? message.sender.email ?? message.sender.identityDid;
394
- const blocks = message.blocks.filter((block) => block.type === "transcription");
395
- return [
396
- `###### ${name}` + (debug ? ` [${index}]:${message.id}` : ""),
397
- blocks.map((block) => block.text.trim()).join(" "),
398
- ""
399
- ];
400
- };
401
- var Transcript = ({ classNames, transcript: object, space, model, attendableId, ignoreAttention }) => {
402
- var _effect = _useSignals();
403
- try {
404
- const { themeMode } = useThemeContext();
405
- const { parentRef } = useTextEditor(() => {
406
- return {
407
- extensions: [
408
- createBasicExtensions({
409
- readOnly: true,
410
- lineWrapping: true
411
- }),
412
- createMarkdownExtensions({
413
- themeMode
414
- }),
415
- createThemeExtensions({
416
- themeMode
417
- }),
418
- decorateMarkdown(),
419
- space && preview(),
420
- transcript({
421
- model,
422
- started: object?.started ? new Date(object.started) : void 0,
423
- renderButton: createRenderer(({ onClick }) => /* @__PURE__ */ React.createElement(IconButton, {
424
- icon: "ph--arrow-line-down--regular",
425
- iconOnly: true,
426
- label: "Scroll to bottom",
427
- onClick
428
- }))
429
- })
430
- ].filter(isNotFalsy)
431
- };
432
- }, [
433
- space,
434
- model
435
- ]);
436
- return /* @__PURE__ */ React.createElement("div", {
437
- ref: parentRef,
438
- className: mx("flex grow overflow-hidden", editorWidth, classNames),
439
- "data-popover-collision-boundary": true
440
- });
441
- } finally {
442
- _effect.f();
443
- }
444
- };
445
-
446
- // packages/plugins/plugin-transcription/src/hooks/useAudioFile.ts
447
- import { useEffect, useState } from "react";
448
- import { scheduleTask } from "@dxos/async";
449
- import { Context } from "@dxos/context";
450
- import { log as log2 } from "@dxos/log";
451
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useAudioFile.ts";
452
- var useAudioFile = (audioUrl, constraints) => {
453
- const [{ audio, stream, track }, setStream] = useState({});
454
- useEffect(() => {
455
- const ctx = new Context(void 0, {
456
- F: __dxlog_file2,
457
- L: 20
458
- });
459
- scheduleTask(ctx, async () => {
460
- const response = await fetch(audioUrl);
461
- const blob = await response.blob();
462
- const objectUrl = URL.createObjectURL(blob);
463
- ctx.onDispose(() => {
464
- URL.revokeObjectURL(objectUrl);
465
- });
466
- const audio2 = new Audio();
467
- audio2.src = objectUrl;
468
- await new Promise((resolve, reject) => {
469
- audio2.addEventListener("error", (err) => {
470
- log2.error("error", {
471
- err
472
- }, {
473
- F: __dxlog_file2,
474
- L: 37,
475
- S: void 0,
476
- C: (f, a) => f(...a)
477
- });
478
- reject(err);
479
- }, {
480
- once: true
481
- });
482
- audio2.addEventListener("canplay", async () => {
483
- log2.info("starting...", void 0, {
484
- F: __dxlog_file2,
485
- L: 45,
486
- S: void 0,
487
- C: (f, a) => f(...a)
488
- });
489
- try {
490
- await audio2.play();
491
- resolve();
492
- } catch (playError) {
493
- log2.error("Play failed", {
494
- playError
495
- }, {
496
- F: __dxlog_file2,
497
- L: 51,
498
- S: void 0,
499
- C: (f, a) => f(...a)
500
- });
501
- resolve();
502
- }
503
- }, {
504
- once: true
505
- });
506
- audio2.load();
507
- });
508
- const audioCtx = new AudioContext();
509
- if (audioCtx.state === "suspended") {
510
- await audioCtx.resume();
511
- }
512
- const destination = audioCtx.createMediaStreamDestination();
513
- destination.channelCount = 1;
514
- const source = audioCtx.createMediaElementSource(audio2);
515
- source.connect(destination);
516
- const track2 = destination.stream.getAudioTracks()[0];
517
- if (constraints) {
518
- await track2.applyConstraints(constraints).catch((err) => log2.catch(err, void 0, {
519
- F: __dxlog_file2,
520
- L: 75,
521
- S: void 0,
522
- C: (f, a) => f(...a)
523
- }));
524
- }
525
- setStream({
526
- audio: audio2,
527
- stream: destination.stream,
528
- track: destination.stream.getAudioTracks()[0]
529
- });
530
- });
531
- return () => {
532
- void ctx.dispose();
533
- };
534
- }, [
535
- audioUrl
536
- ]);
537
- return {
538
- audio,
539
- stream,
540
- track
541
- };
542
- };
543
-
544
- // packages/plugins/plugin-transcription/src/hooks/useAudioTrack.ts
545
- import { useEffect as useEffect2, useState as useState2 } from "react";
546
- var useAudioTrack = (active, constraints) => {
547
- const [track, setTrack] = useState2();
548
- useEffect2(() => {
549
- if (!active) {
550
- track?.stop();
551
- setTrack(void 0);
552
- return;
553
- }
554
- const initAudio = async () => {
555
- const audio = new Audio();
556
- audio.srcObject = await navigator.mediaDevices.getUserMedia({
557
- audio: constraints ?? true
558
- });
559
- const [track2] = audio.srcObject.getAudioTracks();
560
- if (track2) {
561
- setTrack(track2);
562
- }
563
- };
564
- if (active) {
565
- void initAudio();
566
- }
567
- }, [
568
- active
569
- ]);
570
- return track;
571
- };
572
-
573
- // packages/plugins/plugin-transcription/src/hooks/useQueueModelAdapter.ts
574
- import { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
575
- var useQueueModelAdapter = (renderer, queue, initialChunks = []) => {
576
- const model = useMemo(() => new SerializationModel(renderer, initialChunks), [
577
- queue
578
- ]);
579
- const [loaded, setLoaded] = useState3(false);
580
- useEffect3(() => {
581
- if (!queue) {
582
- return;
583
- }
584
- const update = () => {
585
- for (const block of queue?.objects ?? []) {
586
- model.appendChunk(block);
587
- }
588
- setLoaded(true);
589
- };
590
- let i;
591
- if (queue.isLoading) {
592
- i = setInterval(() => {
593
- if (!queue?.isLoading) {
594
- clearInterval(i);
595
- update();
596
- }
597
- }, 1e3);
598
- } else {
599
- update();
600
- }
601
- return () => clearTimeout(i);
602
- }, [
603
- model,
604
- queue
605
- ]);
606
- useEffect3(() => {
607
- if (!loaded || !queue || model.chunks.length === queue.objects.length) {
608
- return;
609
- }
610
- const chunk = queue.objects.at(-1);
611
- if (chunk) {
612
- model.appendChunk(chunk);
613
- }
614
- }, [
615
- model,
616
- loaded,
617
- queue?.objects.length
618
- ]);
619
- return model;
620
- };
621
-
622
- // packages/plugins/plugin-transcription/src/hooks/useTranscriber.ts
623
- import { useEffect as useEffect4, useMemo as useMemo2 } from "react";
624
- import { useCapabilities } from "@dxos/app-framework";
625
-
626
- // packages/plugins/plugin-transcription/src/capabilities/index.ts
627
- import { lazy } from "@dxos/app-framework";
628
- var IntentResolver = lazy(() => import("./intent-resolver-BGADCHVM.mjs"));
629
- var ReactSurface = lazy(() => import("./react-surface-HMJS5FSS.mjs"));
630
- var Transcriber = lazy(() => import("./transcriber-OYPLZFG5.mjs"));
631
-
632
- // packages/plugins/plugin-transcription/src/hooks/useTranscriber.ts
633
- var useTranscriber = ({ audioStreamTrack, onSegments, transcriberConfig, recorderConfig }) => {
634
- const [getTranscriber] = useCapabilities(TranscriptionCapabilities.Transcriber);
635
- const transcriber = useMemo2(() => {
636
- if (!onSegments || !audioStreamTrack || !getTranscriber) {
637
- return void 0;
638
- }
639
- return getTranscriber({
640
- audioStreamTrack,
641
- onSegments,
642
- transcriberConfig,
643
- recorderConfig
644
- });
645
- }, [
646
- audioStreamTrack,
647
- onSegments,
648
- getTranscriber,
649
- transcriberConfig,
650
- recorderConfig
651
- ]);
652
- useEffect4(() => {
653
- return () => {
654
- void transcriber?.close();
655
- };
656
- }, [
657
- transcriber
658
- ]);
659
- return transcriber;
660
- };
661
-
662
- // packages/plugins/plugin-transcription/src/hooks/useVoiceInput.ts
663
- import { useState as useState4, useEffect as useEffect5, useCallback } from "react";
664
- import { scheduleMicroTask } from "@dxos/async";
665
- import { Context as Context2 } from "@dxos/context";
666
- import { log as log3 } from "@dxos/log";
667
- import { useSoundEffect } from "@dxos/react-ui-sfx";
668
- var __dxlog_file3 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useVoiceInput.ts";
669
- var useVoiceInput = ({ active, onUpdate }) => {
670
- const soundStart = useSoundEffect("StartRecording");
671
- const soundStop = useSoundEffect("StopRecording");
672
- const handleSegments = useCallback(async (segments) => {
673
- const text = segments.map((str) => str.text.trim().replace(/[^\w\s]/g, "")).join(" ");
674
- onUpdate(text);
675
- }, []);
676
- const [recording, setRecording] = useState4(false);
677
- const track = useAudioTrack(active);
678
- const transcriber = useTranscriber({
679
- audioStreamTrack: track,
680
- onSegments: handleSegments
681
- });
682
- useEffect5(() => {
683
- const ctx = new Context2(void 0, {
684
- F: __dxlog_file3,
685
- L: 43
686
- });
687
- scheduleMicroTask(ctx, async () => {
688
- if (active && transcriber) {
689
- await transcriber.open();
690
- log3.info("starting...", void 0, {
691
- F: __dxlog_file3,
692
- L: 47,
693
- S: void 0,
694
- C: (f, a) => f(...a)
695
- });
696
- setRecording(true);
697
- void soundStart.play();
698
- transcriber.startChunksRecording();
699
- } else if (!active && transcriber?.isOpen) {
700
- transcriber?.stopChunksRecording();
701
- await transcriber?.close();
702
- log3.info("stopped", void 0, {
703
- F: __dxlog_file3,
704
- L: 54,
705
- S: void 0,
706
- C: (f, a) => f(...a)
707
- });
708
- setRecording(false);
709
- void soundStop.play();
710
- }
711
- });
712
- return () => {
713
- void ctx.dispose();
714
- };
715
- }, [
716
- active,
717
- transcriber
718
- ]);
719
- return {
720
- recording
721
- };
722
- };
723
-
724
- // packages/plugins/plugin-transcription/src/components/TranscriptContainer.tsx
725
- var TranscriptionContainer = ({ role, transcript: transcript2 }) => {
726
- var _effect = _useSignals2();
727
- try {
728
- const attendableId = fullyQualifiedId(transcript2);
729
- const space = getSpace(transcript2);
730
- const members = useMembers(space?.key).map((member) => member.identity);
731
- const queue = useQueue(transcript2.queue.dxn, {
732
- pollInterval: 1e3
733
- });
734
- const model = useQueueModelAdapter(renderMarkdown(members), queue);
735
- return /* @__PURE__ */ React2.createElement(StackItem.Content, {
736
- role,
737
- classNames: "container-max-width pli-2"
738
- }, /* @__PURE__ */ React2.createElement(Transcript, {
739
- attendableId,
740
- space,
741
- model,
742
- transcript: transcript2
743
- }));
744
- } finally {
745
- _effect.f();
746
- }
747
- };
748
- var TranscriptContainer_default = TranscriptionContainer;
749
-
750
- export {
751
- renderMarkdown,
752
- Transcript,
753
- useAudioFile,
754
- useAudioTrack,
755
- useQueueModelAdapter,
756
- useTranscriber,
757
- useVoiceInput,
758
- TranscriptionContainer,
759
- TranscriptContainer_default,
760
- IntentResolver,
761
- ReactSurface,
762
- Transcriber
763
- };
764
- //# sourceMappingURL=chunk-53AXUEIQ.mjs.map