@dxos/plugin-transcription 0.8.3 → 0.8.4-main.03d5cd7b56

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