@dxos/plugin-transcription 0.8.4-main.c85a9c8dae → 0.8.4-main.dfabb4ec29

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 (303) hide show
  1. package/dist/lib/{browser/TranscriptionContainer-RBFHP2AV.mjs → neutral/TranscriptionContainer-XNGXNGPX.mjs} +10 -16
  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/{browser/blueprint-definition-C6XA2SVZ.mjs → neutral/blueprint-definition-HOXDG5QP.mjs} +4 -7
  8. package/dist/lib/neutral/blueprint-definition-HOXDG5QP.mjs.map +7 -0
  9. package/dist/lib/{browser → neutral}/blueprints/index.mjs +1 -2
  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/{browser/chunk-2B74LZZD.mjs → neutral/chunk-GL4RS533.mjs} +2 -2
  13. package/dist/lib/{browser/chunk-2B74LZZD.mjs.map → neutral/chunk-GL4RS533.mjs.map} +3 -3
  14. package/dist/lib/{browser/chunk-HOOPZ7EM.mjs → neutral/chunk-KAEXRX3Y.mjs} +1 -1
  15. package/dist/lib/{browser/chunk-EV5ZYKET.mjs → neutral/chunk-LS3R7EQI.mjs} +74 -104
  16. package/dist/lib/neutral/chunk-LS3R7EQI.mjs.map +7 -0
  17. package/dist/lib/neutral/chunk-MLRJWAQH.mjs +179 -0
  18. package/dist/lib/neutral/chunk-MLRJWAQH.mjs.map +7 -0
  19. package/dist/lib/neutral/chunk-NNR3EYR2.mjs +124 -0
  20. package/dist/lib/neutral/chunk-NNR3EYR2.mjs.map +7 -0
  21. package/dist/lib/neutral/chunk-NQQK7UZQ.mjs +244 -0
  22. package/dist/lib/neutral/chunk-NQQK7UZQ.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-WVEZMGBT.mjs +8 -0
  24. package/dist/lib/neutral/chunk-WVEZMGBT.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs +30 -0
  26. package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs.map +7 -0
  27. package/dist/lib/neutral/components/index.mjs +207 -0
  28. package/dist/lib/neutral/components/index.mjs.map +7 -0
  29. package/dist/lib/neutral/containers/index.mjs +9 -0
  30. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  31. package/dist/lib/neutral/create-2D6S4IMQ.mjs +21 -0
  32. package/dist/lib/neutral/create-2D6S4IMQ.mjs.map +7 -0
  33. package/dist/lib/neutral/hooks/index.mjs +17 -0
  34. package/dist/lib/neutral/index.mjs +44 -0
  35. package/dist/lib/neutral/meta.json +1 -0
  36. package/dist/lib/neutral/meta.mjs +8 -0
  37. package/dist/lib/neutral/open-2QB6IIET.mjs +27 -0
  38. package/dist/lib/neutral/open-2QB6IIET.mjs.map +7 -0
  39. package/dist/lib/neutral/operation-handler-NXMOAXFP.mjs +13 -0
  40. package/dist/lib/neutral/operation-handler-NXMOAXFP.mjs.map +7 -0
  41. package/dist/lib/neutral/operations/index.mjs +8 -0
  42. package/dist/lib/neutral/plugin.mjs +16 -0
  43. package/dist/lib/neutral/plugin.mjs.map +7 -0
  44. package/dist/lib/neutral/react-surface-QF4MUMWG.mjs +26 -0
  45. package/dist/lib/neutral/react-surface-QF4MUMWG.mjs.map +7 -0
  46. package/dist/lib/neutral/summarize-CJPVKWYZ.mjs +78 -0
  47. package/dist/lib/neutral/summarize-CJPVKWYZ.mjs.map +7 -0
  48. package/dist/lib/neutral/text-content-LHSUG2D2.mjs +30 -0
  49. package/dist/lib/neutral/text-content-LHSUG2D2.mjs.map +7 -0
  50. package/dist/lib/{browser/transcriber-WCPHHJYY.mjs → neutral/transcriber-M3R6HPTZ.mjs} +8 -10
  51. package/dist/lib/neutral/transcriber-M3R6HPTZ.mjs.map +7 -0
  52. package/dist/lib/neutral/translations.mjs +22 -0
  53. package/dist/lib/neutral/translations.mjs.map +7 -0
  54. package/dist/lib/neutral/types/index.mjs +12 -0
  55. package/dist/lib/neutral/types/index.mjs.map +7 -0
  56. package/dist/types/src/TranscriptionPlugin.d.ts +1 -0
  57. package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
  58. package/dist/types/src/TranscriptionPlugin.node.d.ts +4 -0
  59. package/dist/types/src/TranscriptionPlugin.node.d.ts.map +1 -0
  60. package/dist/types/src/TranscriptionPlugin.test.d.ts +2 -0
  61. package/dist/types/src/TranscriptionPlugin.test.d.ts.map +1 -0
  62. package/dist/types/src/blueprints/transcription-blueprint.d.ts +2 -2
  63. package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -1
  64. package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
  65. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  66. package/dist/types/src/capabilities/index.d.ts +10 -4
  67. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  68. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  69. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  70. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/text-content.d.ts +8 -0
  72. package/dist/types/src/capabilities/text-content.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/{transcriber/transcriber.d.ts → transcriber.d.ts} +1 -1
  74. package/dist/types/src/capabilities/transcriber.d.ts.map +1 -0
  75. package/dist/types/src/components/Transcription/Transcription.d.ts +5 -4
  76. package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -1
  77. package/dist/types/src/components/Transcription/Transcription.stories.d.ts +10 -10
  78. package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -1
  79. package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -1
  80. package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +3 -3
  81. package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +1 -1
  82. package/dist/types/src/containers/TranscriptionContainer/index.d.ts +1 -2
  83. package/dist/types/src/containers/TranscriptionContainer/index.d.ts.map +1 -1
  84. package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
  85. package/dist/types/src/hooks/useAudioTrack.d.ts.map +1 -1
  86. package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
  87. package/dist/types/src/hooks/useTranscriber.d.ts +2 -2
  88. package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
  89. package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
  90. package/dist/types/src/index.d.ts +2 -3
  91. package/dist/types/src/index.d.ts.map +1 -1
  92. package/dist/types/src/model/model.d.ts +2 -2
  93. package/dist/types/src/model/model.d.ts.map +1 -1
  94. package/dist/types/src/{segments-normalization → normalization}/index.d.ts +1 -1
  95. package/dist/types/src/normalization/index.d.ts.map +1 -0
  96. package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -0
  97. package/dist/types/src/{segments-normalization → normalization}/normalization.d.ts +330 -321
  98. package/dist/types/src/normalization/normalization.d.ts.map +1 -0
  99. package/dist/types/src/normalization/normalization.test.d.ts.map +1 -0
  100. package/dist/types/src/normalization/utils.d.ts.map +1 -0
  101. package/dist/types/src/operations/create.d.ts +5 -0
  102. package/dist/types/src/operations/create.d.ts.map +1 -0
  103. package/dist/types/src/operations/index.d.ts +3 -0
  104. package/dist/types/src/operations/index.d.ts.map +1 -0
  105. package/dist/types/src/operations/open.d.ts +5 -0
  106. package/dist/types/src/operations/open.d.ts.map +1 -0
  107. package/dist/types/src/operations/summarize.d.ts +8 -0
  108. package/dist/types/src/operations/summarize.d.ts.map +1 -0
  109. package/dist/types/src/plugin.d.ts +4 -0
  110. package/dist/types/src/plugin.d.ts.map +1 -0
  111. package/dist/types/src/{components/stories → stories}/FileTranscription.stories.d.ts +3 -3
  112. package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -0
  113. package/dist/types/src/{components/stories → stories}/KeyWordRecognition.stories.d.ts +2 -2
  114. package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
  115. package/dist/types/src/{components/stories → stories}/MicrophoneTranscription.stories.d.ts +3 -3
  116. package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts.map +1 -0
  117. package/dist/types/src/stories/TranscriptionStory.d.ts +23 -0
  118. package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -0
  119. package/dist/types/src/stories/useIsSpeaking.d.ts.map +1 -0
  120. package/dist/types/src/testing/testing.d.ts.map +1 -1
  121. package/dist/types/src/transcriber/index.d.ts +1 -1
  122. package/dist/types/src/transcriber/index.d.ts.map +1 -1
  123. package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
  124. package/dist/types/src/transcriber/transcriber.d.ts +57 -2
  125. package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
  126. package/dist/types/src/transcriber/transcriber.test.d.ts +2 -0
  127. package/dist/types/src/transcriber/transcriber.test.d.ts.map +1 -0
  128. package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
  129. package/dist/types/src/translations.d.ts +7 -8
  130. package/dist/types/src/translations.d.ts.map +1 -1
  131. package/dist/types/src/types/TranscriptOperation.d.ts +917 -0
  132. package/dist/types/src/types/TranscriptOperation.d.ts.map +1 -0
  133. package/dist/types/src/types/TranscriptionCapabilities.d.ts +17 -0
  134. package/dist/types/src/types/TranscriptionCapabilities.d.ts.map +1 -0
  135. package/dist/types/src/types/{types.d.ts → defs.d.ts} +1 -1
  136. package/dist/types/src/types/defs.d.ts.map +1 -0
  137. package/dist/types/src/types/index.d.ts +3 -4
  138. package/dist/types/src/types/index.d.ts.map +1 -1
  139. package/dist/types/src/util/array.d.ts.map +1 -1
  140. package/dist/types/src/util/get-time-str.d.ts.map +1 -1
  141. package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
  142. package/dist/types/src/util/render-byline.d.ts.map +1 -1
  143. package/dist/types/tsconfig.tsbuildinfo +1 -1
  144. package/package.json +133 -81
  145. package/src/TranscriptionPlugin.node.ts +20 -0
  146. package/src/TranscriptionPlugin.test.ts +31 -0
  147. package/src/TranscriptionPlugin.tsx +8 -29
  148. package/src/blueprints/transcription-blueprint.ts +5 -9
  149. package/src/capabilities/{blueprint-definition/blueprint-definition.ts → blueprint-definition.ts} +3 -1
  150. package/src/capabilities/index.ts +12 -4
  151. package/src/capabilities/operation-handler.ts +16 -0
  152. package/src/capabilities/react-surface.tsx +31 -0
  153. package/src/capabilities/text-content.ts +33 -0
  154. package/src/capabilities/{transcriber/transcriber.ts → transcriber.ts} +5 -2
  155. package/src/components/Transcription/Transcription.stories.tsx +24 -23
  156. package/src/components/Transcription/Transcription.tsx +30 -29
  157. package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +10 -8
  158. package/src/containers/TranscriptionContainer/index.ts +1 -3
  159. package/src/hooks/useTranscriber.ts +5 -2
  160. package/src/hooks/useVoiceInput.ts +0 -1
  161. package/src/index.ts +4 -5
  162. package/src/meta.ts +1 -1
  163. package/src/model/model.test.ts +6 -6
  164. package/src/model/model.ts +3 -3
  165. package/src/{segments-normalization → normalization}/message-normalizer.ts +1 -5
  166. package/src/normalization/normalization.ts +76 -0
  167. package/src/operations/create.ts +24 -0
  168. package/src/operations/index.ts +11 -0
  169. package/src/operations/open.ts +28 -0
  170. package/src/operations/summarize.ts +101 -0
  171. package/src/plugin.ts +11 -0
  172. package/src/{components/stories → stories}/FileTranscription.stories.tsx +33 -16
  173. package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +32 -30
  174. package/src/{components/stories → stories}/MicrophoneTranscription.stories.tsx +18 -36
  175. package/src/stories/TranscriptionStory.tsx +93 -0
  176. package/src/testing/testing.ts +8 -18
  177. package/src/transcriber/index.ts +1 -1
  178. package/src/transcriber/transcriber.browser.test.ts +0 -1
  179. package/src/transcriber/transcriber.test.ts +104 -0
  180. package/src/transcriber/transcriber.ts +94 -53
  181. package/src/translations.ts +7 -7
  182. package/src/types/TranscriptOperation.ts +103 -0
  183. package/src/types/TranscriptionCapabilities.ts +39 -0
  184. package/src/types/index.ts +4 -4
  185. package/dist/lib/browser/TranscriptionContainer-RBFHP2AV.mjs.map +0 -7
  186. package/dist/lib/browser/blueprint-definition-C6XA2SVZ.mjs.map +0 -7
  187. package/dist/lib/browser/chunk-EV5ZYKET.mjs.map +0 -7
  188. package/dist/lib/browser/chunk-GH4IIQ6C.mjs +0 -54
  189. package/dist/lib/browser/chunk-GH4IIQ6C.mjs.map +0 -7
  190. package/dist/lib/browser/chunk-O7ILGNBZ.mjs +0 -148
  191. package/dist/lib/browser/chunk-O7ILGNBZ.mjs.map +0 -7
  192. package/dist/lib/browser/chunk-XLMRCOQN.mjs +0 -668
  193. package/dist/lib/browser/chunk-XLMRCOQN.mjs.map +0 -7
  194. package/dist/lib/browser/index.mjs +0 -114
  195. package/dist/lib/browser/index.mjs.map +0 -7
  196. package/dist/lib/browser/meta.json +0 -1
  197. package/dist/lib/browser/operation-resolver-5BLRH4XE.mjs +0 -23
  198. package/dist/lib/browser/operation-resolver-5BLRH4XE.mjs.map +0 -7
  199. package/dist/lib/browser/react-surface-U2SI74JK.mjs +0 -36
  200. package/dist/lib/browser/react-surface-U2SI74JK.mjs.map +0 -7
  201. package/dist/lib/browser/transcriber-WCPHHJYY.mjs.map +0 -7
  202. package/dist/lib/browser/types/index.mjs +0 -15
  203. package/dist/lib/node-esm/TranscriptionContainer-3OOID5KH.mjs +0 -42
  204. package/dist/lib/node-esm/TranscriptionContainer-3OOID5KH.mjs.map +0 -7
  205. package/dist/lib/node-esm/blueprint-definition-TLXDUXIQ.mjs +0 -19
  206. package/dist/lib/node-esm/blueprint-definition-TLXDUXIQ.mjs.map +0 -7
  207. package/dist/lib/node-esm/blueprints/index.mjs +0 -10
  208. package/dist/lib/node-esm/chunk-6GW5NZYG.mjs +0 -55
  209. package/dist/lib/node-esm/chunk-6GW5NZYG.mjs.map +0 -7
  210. package/dist/lib/node-esm/chunk-7UE7G6DE.mjs +0 -461
  211. package/dist/lib/node-esm/chunk-7UE7G6DE.mjs.map +0 -7
  212. package/dist/lib/node-esm/chunk-DYUGYQCB.mjs +0 -669
  213. package/dist/lib/node-esm/chunk-DYUGYQCB.mjs.map +0 -7
  214. package/dist/lib/node-esm/chunk-F47HK7GT.mjs +0 -24
  215. package/dist/lib/node-esm/chunk-F47HK7GT.mjs.map +0 -7
  216. package/dist/lib/node-esm/chunk-H3MXHMQL.mjs +0 -149
  217. package/dist/lib/node-esm/chunk-H3MXHMQL.mjs.map +0 -7
  218. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +0 -11
  219. package/dist/lib/node-esm/chunk-NVM2QUMX.mjs +0 -37
  220. package/dist/lib/node-esm/chunk-NVM2QUMX.mjs.map +0 -7
  221. package/dist/lib/node-esm/index.mjs +0 -115
  222. package/dist/lib/node-esm/index.mjs.map +0 -7
  223. package/dist/lib/node-esm/meta.json +0 -1
  224. package/dist/lib/node-esm/operation-resolver-CVZB7BF4.mjs +0 -24
  225. package/dist/lib/node-esm/operation-resolver-CVZB7BF4.mjs.map +0 -7
  226. package/dist/lib/node-esm/react-surface-2ICJPBPX.mjs +0 -37
  227. package/dist/lib/node-esm/react-surface-2ICJPBPX.mjs.map +0 -7
  228. package/dist/lib/node-esm/transcriber-2RIHUEX4.mjs +0 -62
  229. package/dist/lib/node-esm/transcriber-2RIHUEX4.mjs.map +0 -7
  230. package/dist/lib/node-esm/types/index.mjs +0 -16
  231. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +0 -6
  232. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +0 -1
  233. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +0 -3
  234. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +0 -1
  235. package/dist/types/src/capabilities/operation-handler/index.d.ts +0 -3
  236. package/dist/types/src/capabilities/operation-handler/index.d.ts.map +0 -1
  237. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +0 -5
  238. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +0 -1
  239. package/dist/types/src/capabilities/operation-resolver/index.d.ts +0 -3
  240. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +0 -1
  241. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +0 -5
  242. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +0 -1
  243. package/dist/types/src/capabilities/react-surface/index.d.ts +0 -3
  244. package/dist/types/src/capabilities/react-surface/index.d.ts.map +0 -1
  245. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +0 -1
  246. package/dist/types/src/capabilities/transcriber/index.d.ts +0 -3
  247. package/dist/types/src/capabilities/transcriber/index.d.ts.map +0 -1
  248. package/dist/types/src/capabilities/transcriber/transcriber.d.ts.map +0 -1
  249. package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +0 -1
  250. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +0 -1
  251. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
  252. package/dist/types/src/components/stories/TranscriptionStory.d.ts +0 -12
  253. package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +0 -1
  254. package/dist/types/src/components/stories/useIsSpeaking.d.ts.map +0 -1
  255. package/dist/types/src/functions/index.d.ts +0 -18
  256. package/dist/types/src/functions/index.d.ts.map +0 -1
  257. package/dist/types/src/functions/open.d.ts +0 -11
  258. package/dist/types/src/functions/open.d.ts.map +0 -1
  259. package/dist/types/src/functions/summarize.d.ts +0 -11
  260. package/dist/types/src/functions/summarize.d.ts.map +0 -1
  261. package/dist/types/src/segments-normalization/index.d.ts.map +0 -1
  262. package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +0 -1
  263. package/dist/types/src/segments-normalization/normalization.d.ts.map +0 -1
  264. package/dist/types/src/segments-normalization/normalization.test.d.ts.map +0 -1
  265. package/dist/types/src/segments-normalization/utils.d.ts.map +0 -1
  266. package/dist/types/src/types/TranscriptAction.d.ts +0 -25
  267. package/dist/types/src/types/TranscriptAction.d.ts.map +0 -1
  268. package/dist/types/src/types/capabilities.d.ts +0 -18
  269. package/dist/types/src/types/capabilities.d.ts.map +0 -1
  270. package/dist/types/src/types/types.d.ts.map +0 -1
  271. package/src/capabilities/blueprint-definition/index.ts +0 -7
  272. package/src/capabilities/operation-handler/index.ts +0 -7
  273. package/src/capabilities/operation-handler/operation-handler.ts +0 -25
  274. package/src/capabilities/operation-resolver/index.ts +0 -7
  275. package/src/capabilities/operation-resolver/operation-resolver.ts +0 -25
  276. package/src/capabilities/react-surface/index.ts +0 -7
  277. package/src/capabilities/react-surface/react-surface.tsx +0 -28
  278. package/src/capabilities/transcriber/index.ts +0 -7
  279. package/src/components/stories/TranscriptionStory.tsx +0 -41
  280. package/src/functions/index.ts +0 -11
  281. package/src/functions/open.ts +0 -37
  282. package/src/functions/summarize.ts +0 -103
  283. package/src/segments-normalization/normalization.ts +0 -115
  284. package/src/types/TranscriptAction.ts +0 -32
  285. package/src/types/capabilities.ts +0 -33
  286. package/dist/lib/{browser → neutral}/blueprints/index.mjs.map +0 -0
  287. package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs +0 -0
  288. package/dist/lib/{browser → neutral}/chunk-J5LGTIGS.mjs.map +0 -0
  289. package/dist/lib/{browser/chunk-HOOPZ7EM.mjs.map → neutral/chunk-KAEXRX3Y.mjs.map} +0 -0
  290. package/dist/lib/{browser/types → neutral/hooks}/index.mjs.map +0 -0
  291. package/dist/lib/{node-esm/blueprints → neutral}/index.mjs.map +0 -0
  292. package/dist/lib/{node-esm/chunk-HSLMI22Q.mjs.map → neutral/meta.mjs.map} +0 -0
  293. package/dist/lib/{node-esm/types → neutral/operations}/index.mjs.map +0 -0
  294. package/dist/types/src/capabilities/{react-surface/react-surface.d.ts → react-surface.d.ts} +0 -0
  295. package/dist/types/src/{segments-normalization → normalization}/message-normalizer.d.ts +0 -0
  296. package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
  297. package/dist/types/src/{segments-normalization → normalization}/utils.d.ts +0 -0
  298. package/dist/types/src/{components/stories → stories}/useIsSpeaking.d.ts +0 -0
  299. package/src/{segments-normalization → normalization}/index.ts +1 -1
  300. package/src/{segments-normalization → normalization}/normalization.test.ts +1 -1
  301. /package/src/{segments-normalization → normalization}/utils.ts +0 -0
  302. /package/src/{components/stories → stories}/useIsSpeaking.tsx +0 -0
  303. /package/src/types/{types.ts → defs.ts} +0 -0
@@ -1,669 +0,0 @@
1
- import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
- import {
3
- TranscriptionCapabilities
4
- } from "./chunk-6GW5NZYG.mjs";
5
-
6
- // src/components/Transcription/Transcription.tsx
7
- import React from "react";
8
- import { useThemeContext } from "@dxos/react-ui";
9
- import { useTextEditor } from "@dxos/react-ui-editor";
10
- import { autoScroll, createBasicExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown, editorSlots, preview } from "@dxos/ui-editor";
11
- import { mx } from "@dxos/ui-theme";
12
- import { isTruthy } from "@dxos/util";
13
-
14
- // src/components/Transcription/transcription-extension.ts
15
- import { RangeSetBuilder } from "@codemirror/state";
16
- import { EditorView, GutterMarker, ViewPlugin, gutter } from "@codemirror/view";
17
- import { format } from "date-fns/format";
18
- import { intervalToDuration } from "date-fns/intervalToDuration";
19
- import { addEventListener, combine } from "@dxos/async";
20
-
21
- // src/model/model.ts
22
- import { Text } from "@codemirror/state";
23
- import { Event } from "@dxos/async";
24
- import { invariant } from "@dxos/invariant";
25
- import { log } from "@dxos/log";
26
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/model/model.ts";
27
- var DocumentAdapter = class {
28
- _view;
29
- constructor(_view) {
30
- this._view = _view;
31
- }
32
- /** The document must always have at least one line. */
33
- lineCount() {
34
- return this._view.state.doc.lines - 1;
35
- }
36
- replaceLines(from, remove, insert) {
37
- log("replaceLines", {
38
- count: this._view.state.doc.lines,
39
- from,
40
- remove,
41
- insert
42
- }, {
43
- F: __dxlog_file,
44
- L: 39,
45
- S: this,
46
- C: (f, a) => f(...a)
47
- });
48
- const numLines = this._view.state.doc.lines;
49
- const posFrom = this._view.state.doc.line(from).from;
50
- const posTo = remove === 0 ? posFrom : this._view.state.doc.line(Math.min(numLines, from + remove)).from;
51
- let text = insert.join("\n");
52
- if (posTo === this._view.state.doc.length) {
53
- text += "\n";
54
- }
55
- this._view.dispatch({
56
- changes: {
57
- from: posFrom,
58
- to: posTo,
59
- insert: text
60
- }
61
- });
62
- }
63
- };
64
- var SerializationModel = class {
65
- _renderer;
66
- /** Ordered set of chunks. */
67
- _chunks = [];
68
- /** Map of chunk IDs to their current line counts. */
69
- _chunkLineCounts = /* @__PURE__ */ new Map();
70
- /** Map of line numbers to chunk IDs. */
71
- _lineToChunk = /* @__PURE__ */ new Map();
72
- /** Track chunk changes since last sync. */
73
- _changes = [];
74
- /** Emits when the document is updated. */
75
- update = new Event();
76
- constructor(_renderer, initialChunks = []) {
77
- this._renderer = _renderer;
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
- // src/components/Transcription/transcription-extension.ts
222
- var transcription = ({ model, started }) => {
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?._tag === "transcript" && 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
- _controls;
251
- _cleanup;
252
- _adapter;
253
- _initialized = false;
254
- constructor(view) {
255
- this._adapter = new DocumentAdapter(view);
256
- const scroller = view.scrollDOM;
257
- let isAutoScrolling = false;
258
- let hasScrolled = false;
259
- let timeout;
260
- const scrollToBottom = (smooth = false) => {
261
- scroller.style.scrollBehavior = smooth ? "smooth" : "";
262
- scroller.classList.add("cm-hide-scrollbar");
263
- isAutoScrolling = true;
264
- clearTimeout(timeout);
265
- timeout = setTimeout(() => {
266
- this._controls?.classList.add("opacity-0");
267
- scroller.classList.remove("cm-hide-scrollbar");
268
- isAutoScrolling = false;
269
- }, 500);
270
- view.dispatch({
271
- effects: EditorView.scrollIntoView(view.state.doc.length, {
272
- y: "end"
273
- })
274
- });
275
- };
276
- this._cleanup = combine(addEventListener(view.scrollDOM, "scroll", () => {
277
- if (!isAutoScrolling) {
278
- hasScrolled = true;
279
- this._controls?.classList.remove("opacity-0");
280
- }
281
- }), model.update.on(() => {
282
- const autoScroll2 = scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight === 0 || !hasScrolled;
283
- model.sync(this._adapter);
284
- if (autoScroll2) {
285
- scrollToBottom(true);
286
- }
287
- }));
288
- }
289
- update(_update) {
290
- if (!this._initialized) {
291
- this._initialized = true;
292
- setTimeout(() => {
293
- model.sync(this._adapter);
294
- });
295
- }
296
- }
297
- destroy() {
298
- this._controls?.remove();
299
- this._cleanup();
300
- }
301
- }),
302
- EditorView.theme({
303
- ".cm-gutters": {
304
- backgroundColor: "var(--color-base-surface)"
305
- },
306
- ".cm-timestamp-gutter": {
307
- width: "6rem",
308
- paddingLeft: "0.5rem",
309
- paddingRight: "1rem"
310
- },
311
- ".cm-timestamp-gutter > .cm-gutterElement > div": {
312
- display: "inline-flex",
313
- textAlign: "right",
314
- padding: "3px"
315
- }
316
- })
317
- ];
318
- };
319
- var TimestampMarker = class extends GutterMarker {
320
- _line;
321
- _timestamp;
322
- _started;
323
- constructor(_line, _timestamp, _started) {
324
- super(), this._line = _line, this._timestamp = _timestamp, this._started = _started;
325
- }
326
- eq(other) {
327
- return this._timestamp === other._timestamp;
328
- }
329
- toDOM(view) {
330
- const el = document.createElement("div");
331
- el.className = "text-sm text-subdued hover:bg-hover-surface cursor-pointer";
332
- el.textContent = formatTimestamp(this._timestamp, this._started);
333
- el.onclick = () => {
334
- const pos = view.state.doc.line(this._line).from;
335
- view.dispatch({
336
- effects: EditorView.scrollIntoView(pos, {
337
- y: "start"
338
- })
339
- });
340
- };
341
- return el;
342
- }
343
- };
344
- var getStartTime = (started, message) => {
345
- if (started) {
346
- return started;
347
- }
348
- if (message?.blocks[0]?._tag === "transcript" && message.blocks[0].started) {
349
- return new Date(message.blocks[0].started);
350
- }
351
- return void 0;
352
- };
353
- var formatTimestamp = (timestamp, relative) => {
354
- if (relative) {
355
- const pad = (n = 0) => String(n).padStart(2, "0");
356
- const { hours, minutes, seconds } = intervalToDuration({
357
- start: relative,
358
- end: timestamp
359
- });
360
- return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
361
- } else {
362
- return format(timestamp, "HH:mm:ss");
363
- }
364
- };
365
-
366
- // src/components/Transcription/Transcription.tsx
367
- var Transcription = ({ classNames, transcript: object, model }) => {
368
- const { themeMode } = useThemeContext();
369
- const { parentRef } = useTextEditor(() => {
370
- return {
371
- extensions: [
372
- createBasicExtensions({
373
- readOnly: true,
374
- lineWrapping: true,
375
- search: true
376
- }),
377
- createMarkdownExtensions(),
378
- createThemeExtensions({
379
- themeMode,
380
- slots: editorSlots
381
- }),
382
- decorateMarkdown(),
383
- preview(),
384
- transcription({
385
- model,
386
- started: object?.started ? new Date(object.started) : void 0
387
- }),
388
- autoScroll()
389
- ].filter(isTruthy)
390
- };
391
- }, [
392
- model
393
- ]);
394
- return /* @__PURE__ */ React.createElement("div", {
395
- ref: parentRef,
396
- className: mx("dx-container", classNames),
397
- "data-popover-collision-boundary": true
398
- });
399
- };
400
-
401
- // src/hooks/useAudioFile.ts
402
- import { useEffect, useState } from "react";
403
- import { scheduleTask } from "@dxos/async";
404
- import { Context } from "@dxos/context";
405
- import { log as log2 } from "@dxos/log";
406
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useAudioFile.ts";
407
- var useAudioFile = (audioUrl, constraints) => {
408
- const [{ audio, stream, track }, setStream] = useState({});
409
- useEffect(() => {
410
- const ctx = new Context(void 0, {
411
- F: __dxlog_file2,
412
- L: 20
413
- });
414
- scheduleTask(ctx, async () => {
415
- try {
416
- const response = await fetch(audioUrl);
417
- const blob = await response.blob();
418
- const objectUrl = URL.createObjectURL(blob);
419
- ctx.onDispose(() => {
420
- URL.revokeObjectURL(objectUrl);
421
- });
422
- const audio2 = new Audio();
423
- audio2.src = objectUrl;
424
- await new Promise((resolve, reject) => {
425
- audio2.addEventListener("error", (err) => {
426
- log2.error("error", {
427
- err
428
- }, {
429
- F: __dxlog_file2,
430
- L: 39,
431
- S: void 0,
432
- C: (f, a) => f(...a)
433
- });
434
- reject(err);
435
- }, {
436
- once: true
437
- });
438
- audio2.addEventListener("canplay", async () => {
439
- resolve();
440
- }, {
441
- once: true
442
- });
443
- audio2.load();
444
- });
445
- const audioCtx = new AudioContext();
446
- if (audioCtx.state === "suspended") {
447
- await audioCtx.resume();
448
- }
449
- const destination = audioCtx.createMediaStreamDestination();
450
- destination.channelCount = 1;
451
- const source = audioCtx.createMediaElementSource(audio2);
452
- source.connect(destination);
453
- const track2 = destination.stream.getAudioTracks()[0];
454
- if (constraints) {
455
- await track2.applyConstraints(constraints).catch((err) => log2.catch(err, void 0, {
456
- F: __dxlog_file2,
457
- L: 68,
458
- S: void 0,
459
- C: (f, a) => f(...a)
460
- }));
461
- }
462
- setStream({
463
- audio: audio2,
464
- stream: destination.stream,
465
- track: destination.stream.getAudioTracks()[0]
466
- });
467
- } catch (err) {
468
- log2.catch(err, void 0, {
469
- F: __dxlog_file2,
470
- L: 78,
471
- S: void 0,
472
- C: (f, a) => f(...a)
473
- });
474
- }
475
- });
476
- return () => {
477
- void ctx.dispose();
478
- };
479
- }, [
480
- audioUrl
481
- ]);
482
- return {
483
- audio,
484
- stream,
485
- track
486
- };
487
- };
488
-
489
- // src/hooks/useAudioTrack.ts
490
- import { useEffect as useEffect2, useState as useState2 } from "react";
491
- var useAudioTrack = (active, constraints) => {
492
- const [track, setTrack] = useState2();
493
- useEffect2(() => {
494
- if (!active) {
495
- track?.stop();
496
- setTrack(void 0);
497
- return;
498
- }
499
- const initAudio = async () => {
500
- const audio = new Audio();
501
- audio.srcObject = await navigator.mediaDevices.getUserMedia({
502
- audio: constraints ?? true
503
- });
504
- const [track2] = audio.srcObject.getAudioTracks();
505
- if (track2) {
506
- setTrack(track2);
507
- }
508
- };
509
- if (active) {
510
- void initAudio();
511
- }
512
- }, [
513
- active
514
- ]);
515
- return track;
516
- };
517
-
518
- // src/hooks/useQueueModelAdapter.ts
519
- import { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
520
- var useQueueModelAdapter = (renderer, queue, initialChunks = []) => {
521
- const model = useMemo(() => new SerializationModel(renderer, initialChunks), [
522
- queue
523
- ]);
524
- const [loaded, setLoaded] = useState3(false);
525
- useEffect3(() => {
526
- if (!queue) {
527
- return;
528
- }
529
- const update = () => {
530
- for (const block of queue?.objects ?? []) {
531
- model.appendChunk(block);
532
- }
533
- setLoaded(true);
534
- };
535
- let i;
536
- if (queue.isLoading) {
537
- i = setInterval(() => {
538
- if (!queue?.isLoading) {
539
- clearInterval(i);
540
- update();
541
- }
542
- }, 1e3);
543
- } else {
544
- update();
545
- }
546
- return () => clearTimeout(i);
547
- }, [
548
- model,
549
- queue
550
- ]);
551
- useEffect3(() => {
552
- if (!loaded || !queue || model.chunks.length === queue.objects.length) {
553
- return;
554
- }
555
- const chunk = queue.objects.at(-1);
556
- if (chunk) {
557
- model.appendChunk(chunk);
558
- }
559
- }, [
560
- model,
561
- loaded,
562
- queue?.objects.length
563
- ]);
564
- return model;
565
- };
566
-
567
- // src/hooks/useTranscriber.ts
568
- import { useEffect as useEffect4, useMemo as useMemo2 } from "react";
569
- import { useCapabilities } from "@dxos/app-framework/ui";
570
- var useTranscriber = ({ audioStreamTrack, recorderConfig, transcriberConfig, onSegments }) => {
571
- const [getTranscriber] = useCapabilities(TranscriptionCapabilities.Transcriber);
572
- const transcriber = useMemo2(() => {
573
- if (!getTranscriber || !audioStreamTrack || !onSegments) {
574
- return void 0;
575
- }
576
- return getTranscriber({
577
- audioStreamTrack,
578
- recorderConfig,
579
- transcriberConfig,
580
- onSegments
581
- });
582
- }, [
583
- getTranscriber,
584
- audioStreamTrack,
585
- recorderConfig,
586
- transcriberConfig,
587
- onSegments
588
- ]);
589
- useEffect4(() => {
590
- return () => {
591
- void transcriber?.close();
592
- };
593
- }, [
594
- transcriber
595
- ]);
596
- return transcriber;
597
- };
598
-
599
- // src/hooks/useVoiceInput.ts
600
- import { useCallback, useEffect as useEffect5, useState as useState4 } from "react";
601
- import { scheduleMicroTask } from "@dxos/async";
602
- import { Context as Context2 } from "@dxos/context";
603
- import { log as log3 } from "@dxos/log";
604
- import { useSoundEffect } from "@dxos/react-ui-sfx";
605
- var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useVoiceInput.ts";
606
- var useVoiceInput = ({ active, onUpdate }) => {
607
- const soundStart = useSoundEffect("StartRecording");
608
- const soundStop = useSoundEffect("StopRecording");
609
- const handleSegments = useCallback(async (segments) => {
610
- const text = segments.map((str) => str.text.trim().replace(/[^\w\s]/g, "")).join(" ");
611
- onUpdate(text);
612
- }, []);
613
- const [recording, setRecording] = useState4(false);
614
- const track = useAudioTrack(active);
615
- const transcriber = useTranscriber({
616
- audioStreamTrack: track,
617
- onSegments: handleSegments
618
- });
619
- useEffect5(() => {
620
- const ctx = new Context2(void 0, {
621
- F: __dxlog_file3,
622
- L: 44
623
- });
624
- scheduleMicroTask(ctx, async () => {
625
- if (active && transcriber) {
626
- await transcriber.open();
627
- log3.info("starting...", void 0, {
628
- F: __dxlog_file3,
629
- L: 48,
630
- S: void 0,
631
- C: (f, a) => f(...a)
632
- });
633
- setRecording(true);
634
- void soundStart.play();
635
- transcriber.startChunksRecording();
636
- } else if (!active && transcriber?.isOpen) {
637
- transcriber?.stopChunksRecording();
638
- await transcriber?.close();
639
- log3.info("stopped", void 0, {
640
- F: __dxlog_file3,
641
- L: 55,
642
- S: void 0,
643
- C: (f, a) => f(...a)
644
- });
645
- setRecording(false);
646
- void soundStop.play();
647
- }
648
- });
649
- return () => {
650
- void ctx.dispose();
651
- };
652
- }, [
653
- active,
654
- transcriber
655
- ]);
656
- return {
657
- recording
658
- };
659
- };
660
-
661
- export {
662
- Transcription,
663
- useAudioFile,
664
- useAudioTrack,
665
- useQueueModelAdapter,
666
- useTranscriber,
667
- useVoiceInput
668
- };
669
- //# sourceMappingURL=chunk-DYUGYQCB.mjs.map