@dxos/plugin-transcription 0.8.4-main.fd6878d → 0.9.0

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