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