@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,668 +0,0 @@
1
- import {
2
- TranscriptionCapabilities
3
- } from "./chunk-GH4IIQ6C.mjs";
4
-
5
- // src/components/Transcription/Transcription.tsx
6
- import React from "react";
7
- import { useThemeContext } from "@dxos/react-ui";
8
- import { useTextEditor } from "@dxos/react-ui-editor";
9
- import { autoScroll, createBasicExtensions, createMarkdownExtensions, createThemeExtensions, decorateMarkdown, editorSlots, preview } from "@dxos/ui-editor";
10
- import { mx } from "@dxos/ui-theme";
11
- import { isTruthy } from "@dxos/util";
12
-
13
- // src/components/Transcription/transcription-extension.ts
14
- import { RangeSetBuilder } from "@codemirror/state";
15
- import { EditorView, GutterMarker, ViewPlugin, gutter } from "@codemirror/view";
16
- import { format } from "date-fns/format";
17
- import { intervalToDuration } from "date-fns/intervalToDuration";
18
- import { addEventListener, combine } from "@dxos/async";
19
-
20
- // src/model/model.ts
21
- import { Text } from "@codemirror/state";
22
- import { Event } from "@dxos/async";
23
- import { invariant } from "@dxos/invariant";
24
- import { log } from "@dxos/log";
25
- var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/model/model.ts";
26
- var DocumentAdapter = class {
27
- _view;
28
- constructor(_view) {
29
- this._view = _view;
30
- }
31
- /** The document must always have at least one line. */
32
- lineCount() {
33
- return this._view.state.doc.lines - 1;
34
- }
35
- replaceLines(from, remove, insert) {
36
- log("replaceLines", {
37
- count: this._view.state.doc.lines,
38
- from,
39
- remove,
40
- insert
41
- }, {
42
- F: __dxlog_file,
43
- L: 39,
44
- S: this,
45
- C: (f, a) => f(...a)
46
- });
47
- const numLines = this._view.state.doc.lines;
48
- const posFrom = this._view.state.doc.line(from).from;
49
- const posTo = remove === 0 ? posFrom : this._view.state.doc.line(Math.min(numLines, from + remove)).from;
50
- let text = insert.join("\n");
51
- if (posTo === this._view.state.doc.length) {
52
- text += "\n";
53
- }
54
- this._view.dispatch({
55
- changes: {
56
- from: posFrom,
57
- to: posTo,
58
- insert: text
59
- }
60
- });
61
- }
62
- };
63
- var SerializationModel = class {
64
- _renderer;
65
- /** Ordered set of chunks. */
66
- _chunks = [];
67
- /** Map of chunk IDs to their current line counts. */
68
- _chunkLineCounts = /* @__PURE__ */ new Map();
69
- /** Map of line numbers to chunk IDs. */
70
- _lineToChunk = /* @__PURE__ */ new Map();
71
- /** Track chunk changes since last sync. */
72
- _changes = [];
73
- /** Emits when the document is updated. */
74
- update = new Event();
75
- constructor(_renderer, initialChunks = []) {
76
- this._renderer = _renderer;
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
- // src/components/Transcription/transcription-extension.ts
221
- var transcription = ({ model, started }) => {
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?._tag === "transcript" && 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
- _controls;
250
- _cleanup;
251
- _adapter;
252
- _initialized = false;
253
- constructor(view) {
254
- this._adapter = new DocumentAdapter(view);
255
- const scroller = view.scrollDOM;
256
- let isAutoScrolling = false;
257
- let hasScrolled = false;
258
- let timeout;
259
- const scrollToBottom = (smooth = false) => {
260
- scroller.style.scrollBehavior = smooth ? "smooth" : "";
261
- scroller.classList.add("cm-hide-scrollbar");
262
- isAutoScrolling = true;
263
- clearTimeout(timeout);
264
- timeout = setTimeout(() => {
265
- this._controls?.classList.add("opacity-0");
266
- scroller.classList.remove("cm-hide-scrollbar");
267
- isAutoScrolling = false;
268
- }, 500);
269
- view.dispatch({
270
- effects: EditorView.scrollIntoView(view.state.doc.length, {
271
- y: "end"
272
- })
273
- });
274
- };
275
- this._cleanup = combine(addEventListener(view.scrollDOM, "scroll", () => {
276
- if (!isAutoScrolling) {
277
- hasScrolled = true;
278
- this._controls?.classList.remove("opacity-0");
279
- }
280
- }), model.update.on(() => {
281
- const autoScroll2 = scroller.scrollHeight - scroller.scrollTop - scroller.clientHeight === 0 || !hasScrolled;
282
- model.sync(this._adapter);
283
- if (autoScroll2) {
284
- scrollToBottom(true);
285
- }
286
- }));
287
- }
288
- update(_update) {
289
- if (!this._initialized) {
290
- this._initialized = true;
291
- setTimeout(() => {
292
- model.sync(this._adapter);
293
- });
294
- }
295
- }
296
- destroy() {
297
- this._controls?.remove();
298
- this._cleanup();
299
- }
300
- }),
301
- EditorView.theme({
302
- ".cm-gutters": {
303
- backgroundColor: "var(--color-base-surface)"
304
- },
305
- ".cm-timestamp-gutter": {
306
- width: "6rem",
307
- paddingLeft: "0.5rem",
308
- paddingRight: "1rem"
309
- },
310
- ".cm-timestamp-gutter > .cm-gutterElement > div": {
311
- display: "inline-flex",
312
- textAlign: "right",
313
- padding: "3px"
314
- }
315
- })
316
- ];
317
- };
318
- var TimestampMarker = class extends GutterMarker {
319
- _line;
320
- _timestamp;
321
- _started;
322
- constructor(_line, _timestamp, _started) {
323
- super(), this._line = _line, this._timestamp = _timestamp, this._started = _started;
324
- }
325
- eq(other) {
326
- return this._timestamp === other._timestamp;
327
- }
328
- toDOM(view) {
329
- const el = document.createElement("div");
330
- el.className = "text-sm text-subdued hover:bg-hover-surface cursor-pointer";
331
- el.textContent = formatTimestamp(this._timestamp, this._started);
332
- el.onclick = () => {
333
- const pos = view.state.doc.line(this._line).from;
334
- view.dispatch({
335
- effects: EditorView.scrollIntoView(pos, {
336
- y: "start"
337
- })
338
- });
339
- };
340
- return el;
341
- }
342
- };
343
- var getStartTime = (started, message) => {
344
- if (started) {
345
- return started;
346
- }
347
- if (message?.blocks[0]?._tag === "transcript" && message.blocks[0].started) {
348
- return new Date(message.blocks[0].started);
349
- }
350
- return void 0;
351
- };
352
- var formatTimestamp = (timestamp, relative) => {
353
- if (relative) {
354
- const pad = (n = 0) => String(n).padStart(2, "0");
355
- const { hours, minutes, seconds } = intervalToDuration({
356
- start: relative,
357
- end: timestamp
358
- });
359
- return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
360
- } else {
361
- return format(timestamp, "HH:mm:ss");
362
- }
363
- };
364
-
365
- // src/components/Transcription/Transcription.tsx
366
- var Transcription = ({ classNames, transcript: object, model }) => {
367
- const { themeMode } = useThemeContext();
368
- const { parentRef } = useTextEditor(() => {
369
- return {
370
- extensions: [
371
- createBasicExtensions({
372
- readOnly: true,
373
- lineWrapping: true,
374
- search: true
375
- }),
376
- createMarkdownExtensions(),
377
- createThemeExtensions({
378
- themeMode,
379
- slots: editorSlots
380
- }),
381
- decorateMarkdown(),
382
- preview(),
383
- transcription({
384
- model,
385
- started: object?.started ? new Date(object.started) : void 0
386
- }),
387
- autoScroll()
388
- ].filter(isTruthy)
389
- };
390
- }, [
391
- model
392
- ]);
393
- return /* @__PURE__ */ React.createElement("div", {
394
- ref: parentRef,
395
- className: mx("dx-container", classNames),
396
- "data-popover-collision-boundary": true
397
- });
398
- };
399
-
400
- // src/hooks/useAudioFile.ts
401
- import { useEffect, useState } from "react";
402
- import { scheduleTask } from "@dxos/async";
403
- import { Context } from "@dxos/context";
404
- import { log as log2 } from "@dxos/log";
405
- var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useAudioFile.ts";
406
- var useAudioFile = (audioUrl, constraints) => {
407
- const [{ audio, stream, track }, setStream] = useState({});
408
- useEffect(() => {
409
- const ctx = new Context(void 0, {
410
- F: __dxlog_file2,
411
- L: 20
412
- });
413
- scheduleTask(ctx, async () => {
414
- try {
415
- const response = await fetch(audioUrl);
416
- const blob = await response.blob();
417
- const objectUrl = URL.createObjectURL(blob);
418
- ctx.onDispose(() => {
419
- URL.revokeObjectURL(objectUrl);
420
- });
421
- const audio2 = new Audio();
422
- audio2.src = objectUrl;
423
- await new Promise((resolve, reject) => {
424
- audio2.addEventListener("error", (err) => {
425
- log2.error("error", {
426
- err
427
- }, {
428
- F: __dxlog_file2,
429
- L: 39,
430
- S: void 0,
431
- C: (f, a) => f(...a)
432
- });
433
- reject(err);
434
- }, {
435
- once: true
436
- });
437
- audio2.addEventListener("canplay", async () => {
438
- resolve();
439
- }, {
440
- once: true
441
- });
442
- audio2.load();
443
- });
444
- const audioCtx = new AudioContext();
445
- if (audioCtx.state === "suspended") {
446
- await audioCtx.resume();
447
- }
448
- const destination = audioCtx.createMediaStreamDestination();
449
- destination.channelCount = 1;
450
- const source = audioCtx.createMediaElementSource(audio2);
451
- source.connect(destination);
452
- const track2 = destination.stream.getAudioTracks()[0];
453
- if (constraints) {
454
- await track2.applyConstraints(constraints).catch((err) => log2.catch(err, void 0, {
455
- F: __dxlog_file2,
456
- L: 68,
457
- S: void 0,
458
- C: (f, a) => f(...a)
459
- }));
460
- }
461
- setStream({
462
- audio: audio2,
463
- stream: destination.stream,
464
- track: destination.stream.getAudioTracks()[0]
465
- });
466
- } catch (err) {
467
- log2.catch(err, void 0, {
468
- F: __dxlog_file2,
469
- L: 78,
470
- S: void 0,
471
- C: (f, a) => f(...a)
472
- });
473
- }
474
- });
475
- return () => {
476
- void ctx.dispose();
477
- };
478
- }, [
479
- audioUrl
480
- ]);
481
- return {
482
- audio,
483
- stream,
484
- track
485
- };
486
- };
487
-
488
- // src/hooks/useAudioTrack.ts
489
- import { useEffect as useEffect2, useState as useState2 } from "react";
490
- var useAudioTrack = (active, constraints) => {
491
- const [track, setTrack] = useState2();
492
- useEffect2(() => {
493
- if (!active) {
494
- track?.stop();
495
- setTrack(void 0);
496
- return;
497
- }
498
- const initAudio = async () => {
499
- const audio = new Audio();
500
- audio.srcObject = await navigator.mediaDevices.getUserMedia({
501
- audio: constraints ?? true
502
- });
503
- const [track2] = audio.srcObject.getAudioTracks();
504
- if (track2) {
505
- setTrack(track2);
506
- }
507
- };
508
- if (active) {
509
- void initAudio();
510
- }
511
- }, [
512
- active
513
- ]);
514
- return track;
515
- };
516
-
517
- // src/hooks/useQueueModelAdapter.ts
518
- import { useEffect as useEffect3, useMemo, useState as useState3 } from "react";
519
- var useQueueModelAdapter = (renderer, queue, initialChunks = []) => {
520
- const model = useMemo(() => new SerializationModel(renderer, initialChunks), [
521
- queue
522
- ]);
523
- const [loaded, setLoaded] = useState3(false);
524
- useEffect3(() => {
525
- if (!queue) {
526
- return;
527
- }
528
- const update = () => {
529
- for (const block of queue?.objects ?? []) {
530
- model.appendChunk(block);
531
- }
532
- setLoaded(true);
533
- };
534
- let i;
535
- if (queue.isLoading) {
536
- i = setInterval(() => {
537
- if (!queue?.isLoading) {
538
- clearInterval(i);
539
- update();
540
- }
541
- }, 1e3);
542
- } else {
543
- update();
544
- }
545
- return () => clearTimeout(i);
546
- }, [
547
- model,
548
- queue
549
- ]);
550
- useEffect3(() => {
551
- if (!loaded || !queue || model.chunks.length === queue.objects.length) {
552
- return;
553
- }
554
- const chunk = queue.objects.at(-1);
555
- if (chunk) {
556
- model.appendChunk(chunk);
557
- }
558
- }, [
559
- model,
560
- loaded,
561
- queue?.objects.length
562
- ]);
563
- return model;
564
- };
565
-
566
- // src/hooks/useTranscriber.ts
567
- import { useEffect as useEffect4, useMemo as useMemo2 } from "react";
568
- import { useCapabilities } from "@dxos/app-framework/ui";
569
- var useTranscriber = ({ audioStreamTrack, recorderConfig, transcriberConfig, onSegments }) => {
570
- const [getTranscriber] = useCapabilities(TranscriptionCapabilities.Transcriber);
571
- const transcriber = useMemo2(() => {
572
- if (!getTranscriber || !audioStreamTrack || !onSegments) {
573
- return void 0;
574
- }
575
- return getTranscriber({
576
- audioStreamTrack,
577
- recorderConfig,
578
- transcriberConfig,
579
- onSegments
580
- });
581
- }, [
582
- getTranscriber,
583
- audioStreamTrack,
584
- recorderConfig,
585
- transcriberConfig,
586
- onSegments
587
- ]);
588
- useEffect4(() => {
589
- return () => {
590
- void transcriber?.close();
591
- };
592
- }, [
593
- transcriber
594
- ]);
595
- return transcriber;
596
- };
597
-
598
- // src/hooks/useVoiceInput.ts
599
- import { useCallback, useEffect as useEffect5, useState as useState4 } from "react";
600
- import { scheduleMicroTask } from "@dxos/async";
601
- import { Context as Context2 } from "@dxos/context";
602
- import { log as log3 } from "@dxos/log";
603
- import { useSoundEffect } from "@dxos/react-ui-sfx";
604
- var __dxlog_file3 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/hooks/useVoiceInput.ts";
605
- var useVoiceInput = ({ active, onUpdate }) => {
606
- const soundStart = useSoundEffect("StartRecording");
607
- const soundStop = useSoundEffect("StopRecording");
608
- const handleSegments = useCallback(async (segments) => {
609
- const text = segments.map((str) => str.text.trim().replace(/[^\w\s]/g, "")).join(" ");
610
- onUpdate(text);
611
- }, []);
612
- const [recording, setRecording] = useState4(false);
613
- const track = useAudioTrack(active);
614
- const transcriber = useTranscriber({
615
- audioStreamTrack: track,
616
- onSegments: handleSegments
617
- });
618
- useEffect5(() => {
619
- const ctx = new Context2(void 0, {
620
- F: __dxlog_file3,
621
- L: 44
622
- });
623
- scheduleMicroTask(ctx, async () => {
624
- if (active && transcriber) {
625
- await transcriber.open();
626
- log3.info("starting...", void 0, {
627
- F: __dxlog_file3,
628
- L: 48,
629
- S: void 0,
630
- C: (f, a) => f(...a)
631
- });
632
- setRecording(true);
633
- void soundStart.play();
634
- transcriber.startChunksRecording();
635
- } else if (!active && transcriber?.isOpen) {
636
- transcriber?.stopChunksRecording();
637
- await transcriber?.close();
638
- log3.info("stopped", void 0, {
639
- F: __dxlog_file3,
640
- L: 55,
641
- S: void 0,
642
- C: (f, a) => f(...a)
643
- });
644
- setRecording(false);
645
- void soundStop.play();
646
- }
647
- });
648
- return () => {
649
- void ctx.dispose();
650
- };
651
- }, [
652
- active,
653
- transcriber
654
- ]);
655
- return {
656
- recording
657
- };
658
- };
659
-
660
- export {
661
- Transcription,
662
- useAudioFile,
663
- useAudioTrack,
664
- useQueueModelAdapter,
665
- useTranscriber,
666
- useVoiceInput
667
- };
668
- //# sourceMappingURL=chunk-XLMRCOQN.mjs.map