@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,243 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import '@dxos-theme';
6
-
7
- import { type Meta, type StoryObj } from '@storybook/react-vite';
8
- import React, { type FC, useEffect, useMemo, useState } from 'react';
9
-
10
- import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
11
- import { withPluginManager } from '@dxos/app-framework/testing';
12
- import { Key } from '@dxos/echo';
13
- import { ClientPlugin } from '@dxos/plugin-client';
14
- import { PreviewPlugin } from '@dxos/plugin-preview';
15
- import { SpacePlugin } from '@dxos/plugin-space';
16
- import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
17
- import { ThemePlugin } from '@dxos/plugin-theme';
18
- import { faker } from '@dxos/random';
19
- import { useMembers, useSpace } from '@dxos/react-client/echo';
20
- import { IconButton, Toolbar } from '@dxos/react-ui';
21
- import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
22
- import { defaultTx } from '@dxos/react-ui-theme';
23
- import { DataType } from '@dxos/schema';
24
- import { Testing } from '@dxos/schema/testing';
25
- import { withLayout } from '@dxos/storybook-utils';
26
-
27
- import { useQueueModelAdapter } from '../../hooks';
28
- import { SerializationModel } from '../../model';
29
- import {
30
- MessageBuilder,
31
- TestItem,
32
- useTestTranscriptionQueue,
33
- useTestTranscriptionQueueWithEntityExtraction,
34
- } from '../../testing';
35
- import { translations } from '../../translations';
36
-
37
- import { Transcript, type TranscriptProps, renderMarkdown } from './Transcript';
38
-
39
- faker.seed(1);
40
-
41
- /**
42
- * Story wrapper with test controls.
43
- */
44
- const TranscriptContainer: FC<
45
- TranscriptProps & {
46
- running: boolean;
47
- onRunningChange: (running: boolean) => void;
48
- onReset?: () => void;
49
- }
50
- > = ({ space, model, running, onRunningChange, onReset }) => {
51
- return (
52
- <div className='grid grid-rows-[1fr_40px] grow divide-y divide-separator'>
53
- <Transcript space={space} model={model} />
54
- <div className='grid grid-cols-[1fr_16rem] overflow-hidden'>
55
- <div className='flex items-center'>
56
- <SyntaxHighlighter language='json' className='text-sm'>
57
- {JSON.stringify(model.toJSON())}
58
- </SyntaxHighlighter>
59
- </div>
60
- <Toolbar.Root classNames='justify-end'>
61
- <IconButton
62
- icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
63
- label={running ? 'Pause' : 'Start'}
64
- onClick={() => onRunningChange(!running)}
65
- />
66
- {onReset && <IconButton icon='ph--x--regular' label='Reset' onClick={onReset} />}
67
- </Toolbar.Root>
68
- </div>
69
- </div>
70
- );
71
- };
72
-
73
- type StoryProps = { messages?: DataType.Message[] } & Pick<TranscriptProps, 'ignoreAttention' | 'attendableId'>;
74
-
75
- /**
76
- * Basic story mutates array of messages.
77
- */
78
- const BasicStory = ({ messages: initialMessages = [], ...props }: StoryProps) => {
79
- const [reset, setReset] = useState({});
80
- const builder = useMemo(() => new MessageBuilder(), []);
81
- const model = useMemo(
82
- () => new SerializationModel<DataType.Message>(renderMarkdown([]), initialMessages),
83
- [initialMessages, reset],
84
- );
85
- const [running, setRunning] = useState(true);
86
- const [currentMessage, setCurrentMessage] = useState<DataType.Message | null>(null);
87
- useEffect(() => {
88
- if (!running) {
89
- return;
90
- }
91
-
92
- if (!currentMessage) {
93
- void builder.createMessage().then((message) => {
94
- model.appendChunk(message);
95
- setCurrentMessage(message);
96
- });
97
- return;
98
- }
99
-
100
- const i = setInterval(() => {
101
- if (currentMessage?.blocks.length && currentMessage.blocks.length >= 3) {
102
- setCurrentMessage(null);
103
- clearInterval(i);
104
- return;
105
- }
106
-
107
- currentMessage.blocks.push(builder.createBlock());
108
- model.updateChunk(currentMessage);
109
- }, 3_000);
110
-
111
- return () => clearInterval(i);
112
- }, [model, currentMessage, running]);
113
-
114
- const handleReset = () => {
115
- setCurrentMessage(null);
116
- setRunning(false);
117
- setReset({});
118
- };
119
-
120
- return (
121
- <TranscriptContainer
122
- model={model}
123
- running={running}
124
- onRunningChange={setRunning}
125
- onReset={handleReset}
126
- {...props}
127
- />
128
- );
129
- };
130
-
131
- /**
132
- * Queue story mutates queue with model adapter.
133
- */
134
- const QueueStory = ({
135
- messages: initialMessages = [],
136
- queueId,
137
- onReset,
138
- ...props
139
- }: StoryProps & { queueId: Key.ObjectId; onReset: () => void }) => {
140
- const [running, setRunning] = useState(true);
141
- const space = useSpace();
142
- const members = useMembers(space?.key).map((member) => member.identity);
143
- const queue = useTestTranscriptionQueue(space, queueId, running, 2_000);
144
- const model = useQueueModelAdapter(renderMarkdown(members), queue, initialMessages);
145
-
146
- return (
147
- <TranscriptContainer
148
- space={space}
149
- model={model}
150
- running={running}
151
- onRunningChange={setRunning}
152
- onReset={onReset}
153
- {...props}
154
- />
155
- );
156
- };
157
-
158
- // TODO(burdon): Reconcile with QueueStory.
159
- const EntityExtractionQueueStory = () => {
160
- const [running, setRunning] = useState(true);
161
- const space = useSpace();
162
- const members = useMembers(space?.key).map((member) => member.identity);
163
- const queue = useTestTranscriptionQueueWithEntityExtraction(space, undefined, running, 2_000);
164
- const model = useQueueModelAdapter(renderMarkdown(members), queue, []);
165
-
166
- return <TranscriptContainer space={space} model={model} running={running} onRunningChange={setRunning} />;
167
- };
168
-
169
- /**
170
- * Wrapper remounts on refresh to reload queue.
171
- */
172
- const QueueStoryWrapper = () => {
173
- const [queueId] = useState(Key.ObjectId.random());
174
- const [key, setKey] = useState(Key.ObjectId.random().toString());
175
- const handleReset = () => {
176
- setKey(Key.ObjectId.random().toString());
177
- };
178
-
179
- return <QueueStory key={key} queueId={queueId} onReset={handleReset} />;
180
- };
181
-
182
- const meta: Meta<typeof QueueStory> = {
183
- title: 'plugins/plugin-transcription/Transcript',
184
- decorators: [
185
- withPluginManager({
186
- plugins: [
187
- ThemePlugin({ tx: defaultTx }),
188
- StorybookLayoutPlugin(),
189
- ClientPlugin({
190
- types: [TestItem, Testing.DocumentType, DataType.Person, DataType.Organization],
191
- onClientInitialized: async ({ client }) => {
192
- await client.halo.createIdentity();
193
- },
194
- }),
195
- PreviewPlugin(),
196
- SpacePlugin(),
197
- SettingsPlugin(),
198
- IntentPlugin(),
199
- ],
200
- }),
201
- withLayout({ fullscreen: true }),
202
- ],
203
- parameters: {
204
- translations,
205
- },
206
- };
207
-
208
- export default meta;
209
-
210
- type Story = StoryObj<typeof QueueStory>;
211
-
212
- export const Default: Story = {
213
- render: BasicStory,
214
- args: {
215
- ignoreAttention: true,
216
- attendableId: 'story',
217
- messages: await Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())),
218
- },
219
- };
220
-
221
- export const Empty: Story = {
222
- render: BasicStory,
223
- args: {
224
- ignoreAttention: true,
225
- attendableId: 'story',
226
- },
227
- };
228
-
229
- export const WithQueue: Story = {
230
- render: QueueStoryWrapper,
231
- args: {
232
- ignoreAttention: true,
233
- attendableId: 'story',
234
- },
235
- };
236
-
237
- export const WithEntityExtractionQueue: Story = {
238
- render: EntityExtractionQueueStory,
239
- args: {
240
- ignoreAttention: true,
241
- attendableId: 'story',
242
- },
243
- };
@@ -1,101 +0,0 @@
1
- //
2
- // Copyright 2025 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { type Space } from '@dxos/react-client/echo';
8
- import { type Identity } from '@dxos/react-client/halo';
9
- import { IconButton, type ThemedClassName, useThemeContext } from '@dxos/react-ui';
10
- import {
11
- createBasicExtensions,
12
- createMarkdownExtensions,
13
- createRenderer,
14
- createThemeExtensions,
15
- decorateMarkdown,
16
- editorWidth,
17
- preview,
18
- useTextEditor,
19
- } from '@dxos/react-ui-editor';
20
- import { mx } from '@dxos/react-ui-theme';
21
- import { type DataType } from '@dxos/schema';
22
- import { isNotFalsy } from '@dxos/util';
23
-
24
- import { type SerializationModel } from '../../model';
25
- import { type TranscriptType } from '../../types';
26
-
27
- import { transcript } from './transcript-extension';
28
-
29
- export const renderMarkdown =
30
- (identities: Identity[]) =>
31
- (message: DataType.Message, index: number, debug = false): string[] => {
32
- if (message.sender.role === 'assistant') {
33
- // Start/stop block.
34
- return [message.blocks.find((block) => block._tag === 'transcript')?.text ?? '', ''];
35
- }
36
-
37
- // TODO(burdon): Use link/reference markup for users (with popover).
38
- // TODO(burdon): Color and avatar.
39
- const identity = identities.find((identity) => identity.did === message.sender.identityDid);
40
- const name =
41
- identity?.profile?.displayName ??
42
- message.sender.contact?.target?.fullName ??
43
- message.sender.name ??
44
- message.sender.email ??
45
- message.sender.identityDid;
46
- const blocks = message.blocks.filter((block) => block._tag === 'transcript');
47
- return [
48
- `###### ${name}` + (debug ? ` [${index}]:${message.id}` : ''),
49
- blocks.map((block) => block.text.trim()).join(' '),
50
- '',
51
- ];
52
- };
53
-
54
- export type TranscriptProps = ThemedClassName<{
55
- transcript?: TranscriptType;
56
- space?: Space;
57
- model: SerializationModel<DataType.Message>;
58
- // TODO(wittjosiah): Move to container.
59
- attendableId?: string;
60
- ignoreAttention?: boolean;
61
- }>;
62
-
63
- /**
64
- * Transcript component implemented using the editor.
65
- */
66
- export const Transcript = ({
67
- classNames,
68
- transcript: object,
69
- space,
70
- model,
71
- attendableId,
72
- ignoreAttention,
73
- }: TranscriptProps) => {
74
- const { themeMode } = useThemeContext();
75
- const { parentRef } = useTextEditor(() => {
76
- return {
77
- extensions: [
78
- createBasicExtensions({ readOnly: true, lineWrapping: true, search: true }),
79
- createMarkdownExtensions({ themeMode }),
80
- createThemeExtensions({ themeMode }),
81
- decorateMarkdown(),
82
- space && preview(),
83
- transcript({
84
- model,
85
- started: object?.started ? new Date(object.started) : undefined,
86
- renderButton: createRenderer(({ onClick }) => (
87
- <IconButton icon='ph--arrow-line-down--regular' iconOnly label='Scroll to bottom' onClick={onClick} />
88
- )),
89
- }),
90
- ].filter(isNotFalsy),
91
- };
92
- }, [space, model]);
93
-
94
- return (
95
- <div
96
- ref={parentRef}
97
- className={mx('flex grow overflow-hidden', editorWidth, classNames)}
98
- data-popover-collision-boundary={true}
99
- />
100
- );
101
- };
@@ -1,260 +0,0 @@
1
- //
2
- // Copyright 2023 DXOS.org
3
- //
4
-
5
- import { intervalToDuration } from 'date-fns/intervalToDuration';
6
- import { Schema } from 'effect';
7
- import { yieldOrContinue } from 'main-thread-scheduling';
8
- import React, { type FC, type WheelEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';
9
- import { type OnResizeCallback, useResizeDetector } from 'react-resize-detector';
10
-
11
- import { Type } from '@dxos/echo';
12
- import { IconButton, type ThemedClassName, useTranslation } from '@dxos/react-ui';
13
- import { useAttention } from '@dxos/react-ui-attention';
14
- import {
15
- type DxGridAxisMeta,
16
- type DxGridCellValue,
17
- type DxGridElement,
18
- type DxGridPlaneCells,
19
- Grid,
20
- toPlaneCellIndex,
21
- } from '@dxos/react-ui-grid';
22
- import { mx } from '@dxos/react-ui-theme';
23
-
24
- import { TRANSCRIPTION_PLUGIN } from '../../../meta';
25
-
26
- /**
27
- * Transcription fragment.
28
- */
29
- const TranscriptSegment = Schema.Struct({
30
- // TODO(burdon): TS from service is not Unix TS (x1000).
31
- started: Schema.String,
32
- text: Schema.String,
33
- });
34
-
35
- type TranscriptSegment = Schema.Schema.Type<typeof TranscriptSegment>;
36
-
37
- /**
38
- * Transcription block (from single speaker).
39
- */
40
- const TranscriptBlock = Schema.Struct({
41
- id: Schema.String,
42
- authorName: Schema.optional(Schema.String), // TODO(burdon): Replace with identityDid.
43
- authorHue: Schema.optional(Schema.String), // TOOD(burdon): Remove.
44
- segments: Schema.Array(TranscriptSegment),
45
- }).pipe(
46
- Type.Obj({
47
- typename: 'dxos.org/type/TranscriptBlock',
48
- version: '0.1.0',
49
- }),
50
- );
51
-
52
- type TranscriptBlock = Schema.Schema.Type<typeof TranscriptBlock>;
53
-
54
- // TODO(burdon): Actions (e.g., mark, summarize, translate, label, delete).
55
-
56
- const lineHeight = 20;
57
- const cellSpacing = 8 + 2;
58
- const timestampColumnWidth = 68;
59
-
60
- const authorClasses = 'font-medium text-base leading-[20px]';
61
- const timestampClasses = 'text-xs leading-[20px] text-description pie-0 tabular-nums';
62
- const segmentTextClasses = 'text-sm whitespace-normal hyphens-auto';
63
- const measureClasses = mx(
64
- // NOTE(thure): The `inline-start` value must equal `timestampColumnWidth` plus grid’s gap (1px)
65
- 'absolute inline-start-[69px] inline-end-0 invisible z-[-1] border',
66
- 'pli-[--dx-grid-cell-padding-inline] plb-[--dx-grid-cell-padding-block] leading-[20px]',
67
- segmentTextClasses,
68
- );
69
-
70
- const rowDefault = {
71
- grid: { size: lineHeight + cellSpacing },
72
- };
73
-
74
- type QueueRows = [number, number][];
75
-
76
- const mapTranscriptQueue = (blocks?: TranscriptBlock[]): QueueRows => {
77
- if (!blocks || !Array.isArray(blocks) || blocks.length === 0) {
78
- return [];
79
- } else {
80
- return blocks.flatMap((block, blockIndex) => {
81
- return [
82
- [blockIndex, -1],
83
- ...block.segments.map((segment, segmentIndex) => {
84
- return [blockIndex, segmentIndex] as [number, number];
85
- }),
86
- ];
87
- });
88
- }
89
- };
90
-
91
- const pad = (n = 0) => String(n).padStart(2, '0');
92
-
93
- const formatTimestamp = (start: Date, end: Date) => {
94
- const { hours, minutes, seconds } = intervalToDuration({ start, end });
95
- return `${pad(hours)}:${pad(minutes)}:${pad(seconds)}`;
96
- };
97
-
98
- const measureRows = async (
99
- host: HTMLDivElement,
100
- blocks: TranscriptBlock[],
101
- queueMap: QueueRows,
102
- signal: AbortSignal,
103
- ) => {
104
- const result: DxGridAxisMeta = { grid: {} };
105
- for (let row = 0; row < queueMap.length; row++) {
106
- await yieldOrContinue('smooth', signal);
107
- const [blockIndex, segmentIndex] = queueMap[row];
108
- if (segmentIndex < 0) {
109
- result.grid[row] = { size: lineHeight + cellSpacing };
110
- } else {
111
- host.textContent = blocks[blockIndex]!.segments[segmentIndex]!.text;
112
- result.grid[row] = { size: host.offsetHeight };
113
- }
114
- }
115
- return result;
116
- };
117
-
118
- export type TranscriptProps = ThemedClassName<{
119
- blocks?: TranscriptBlock[];
120
- attendableId?: string;
121
- ignoreAttention?: boolean;
122
- }>;
123
-
124
- /**
125
- * @@deprecated
126
- */
127
- export const Transcript: FC<TranscriptProps> = ({ classNames, blocks, attendableId, ignoreAttention }) => {
128
- const { t } = useTranslation(TRANSCRIPTION_PLUGIN);
129
- const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
130
- const [rows, setRows] = useState<DxGridAxisMeta | undefined>(undefined);
131
- const [columns, setColumns] = useState<DxGridAxisMeta | undefined>(undefined);
132
-
133
- const queueMap = useMemo(() => mapTranscriptQueue(blocks), [blocks]);
134
-
135
- const { hasAttention } = useAttention(attendableId);
136
- const [autoScroll, setAutoScroll] = useState(true);
137
- const handleWheel = useCallback(
138
- (event: WheelEvent) => {
139
- setAutoScroll(false);
140
- if (!ignoreAttention && !hasAttention) {
141
- event.stopPropagation();
142
- }
143
- },
144
- [hasAttention, ignoreAttention],
145
- );
146
-
147
- const abortControllerRef = useRef<AbortController>();
148
-
149
- const handleResize = useCallback(
150
- async ({ entry }: { entry: { target: HTMLDivElement } | null }) => {
151
- if (entry?.target && Array.isArray(blocks) && blocks[0] && queueMap) {
152
- abortControllerRef.current?.abort();
153
- abortControllerRef.current = new AbortController();
154
- setColumns({ grid: { 0: { size: timestampColumnWidth }, 1: { size: entry.target.offsetWidth } } });
155
- return measureRows(entry.target, blocks, queueMap, abortControllerRef.current.signal)
156
- .then(setRows)
157
- .catch(() => {
158
- // Aborted mid-measurement by new size.
159
- });
160
- }
161
- },
162
- [blocks, queueMap],
163
- );
164
-
165
- const { width, ref: measureRef } = useResizeDetector({
166
- onResize: handleResize as OnResizeCallback,
167
- refreshOptions: { leading: true },
168
- });
169
-
170
- useEffect(() => {
171
- if (queueMap.length !== Object.keys(rows?.grid ?? {}).length) {
172
- void handleResize({ entry: { target: measureRef.current } }).then(() => {
173
- if (autoScroll) {
174
- // TODO(thure): Implement a deterministic way to do this when `rows` has fully settled and grid has a new `maxPosBlock`.
175
- setTimeout(() => dxGrid?.scrollToEndRow(), 50);
176
- }
177
- });
178
- }
179
- }, [blocks, queueMap, width, autoScroll]);
180
-
181
- useEffect(() => {
182
- if (dxGrid && Array.isArray(blocks) && blocks[0]) {
183
- const transcriptStart = blocks[0]!.segments[0]!.started;
184
- dxGrid.getCells = (range, plane) => {
185
- switch (plane) {
186
- case 'grid': {
187
- const cells: DxGridPlaneCells = {};
188
- for (let row = range.start.row; row <= range.end.row && row < queueMap.length; row++) {
189
- const [blockIndex, segmentIndex] = queueMap[row];
190
-
191
- cells[toPlaneCellIndex({ col: 0, row })] = {
192
- readonly: true,
193
- value:
194
- segmentIndex < 0
195
- ? formatTimestamp(
196
- new Date(transcriptStart),
197
- new Date(blocks[blockIndex]!.segments[Math.max(0, segmentIndex)]!.started),
198
- )
199
- : '',
200
- className: timestampClasses,
201
- } satisfies DxGridCellValue;
202
-
203
- cells[toPlaneCellIndex({ col: 1, row })] = (
204
- segmentIndex < 0
205
- ? {
206
- readonly: true,
207
- accessoryHtml: `<span data-hue="${blocks[blockIndex]!.authorHue}" class="dx-text-hue">${blocks[blockIndex]!.authorName}</span>`,
208
- className: authorClasses,
209
- }
210
- : {
211
- readonly: true,
212
- value: blocks[blockIndex]!.segments[segmentIndex]!.text,
213
- className: segmentTextClasses,
214
- }
215
- ) satisfies DxGridCellValue;
216
- }
217
- return cells;
218
- }
219
- default:
220
- return {};
221
- }
222
- };
223
- }
224
- }, [dxGrid, blocks]);
225
-
226
- const handleScrollToEnd = useCallback(() => {
227
- setAutoScroll(true);
228
- dxGrid?.scrollToEndRow();
229
- }, [dxGrid, autoScroll]);
230
-
231
- return (
232
- <div role='none' className={mx('relative min-bs-0', classNames)}>
233
- <Grid.Root id={`${attendableId}--transcript`}>
234
- <Grid.Content
235
- limitColumns={2}
236
- limitRows={queueMap.length}
237
- columns={columns}
238
- rows={rows}
239
- rowDefault={rowDefault}
240
- onWheel={handleWheel}
241
- className='[--dx-grid-base:var(--dx-baseSurface)] [--dx-grid-lines:var(--dx-baseSurface)] [&_.dx-grid]:min-bs-0 [&_.dx-grid]:min-is-0 [&_.dx-grid]:select-auto'
242
- ref={setDxGrid}
243
- />
244
- </Grid.Root>
245
- <div role='none' {...{ inert: '' }} aria-hidden className={measureClasses} ref={measureRef} />
246
- <IconButton
247
- icon='ph--arrow-line-down--regular'
248
- iconOnly
249
- label={t('scroll to end label')}
250
- tooltipSide='left'
251
- data-state={autoScroll ? 'invisible' : 'visible'}
252
- classNames={[
253
- 'absolute inline-end-2 block-end-2 opacity-0 pointer-events-none',
254
- 'data-[state="visible"]:pointer-events-auto data-[state="visible"]:opacity-100 transition-opacity',
255
- ]}
256
- onClick={handleScrollToEnd}
257
- />
258
- </div>
259
- );
260
- };
@@ -1,36 +0,0 @@
1
- //
2
- // Copyright 2024 DXOS.org
3
- //
4
-
5
- import React from 'react';
6
-
7
- import { fullyQualifiedId, getSpace } from '@dxos/client/echo';
8
- import { useMembers, useQueue } from '@dxos/react-client/echo';
9
- import { StackItem } from '@dxos/react-ui-stack';
10
- import { type DataType } from '@dxos/schema';
11
-
12
- import { useQueueModelAdapter } from '../hooks';
13
- import { type TranscriptType } from '../types';
14
-
15
- import { Transcript, renderMarkdown } from './Transcript';
16
-
17
- export type TranscriptionContainerProps = {
18
- role: string;
19
- transcript: TranscriptType;
20
- };
21
-
22
- export const TranscriptionContainer = ({ transcript }: TranscriptionContainerProps) => {
23
- const attendableId = fullyQualifiedId(transcript);
24
- const space = getSpace(transcript);
25
- const members = useMembers(space?.key).map((member) => member.identity);
26
- const queue = useQueue<DataType.Message>(transcript.queue.dxn, { pollInterval: 1_000 });
27
- const model = useQueueModelAdapter(renderMarkdown(members), queue);
28
-
29
- return (
30
- <StackItem.Content classNames='container-max-width pli-2'>
31
- <Transcript attendableId={attendableId} space={space} model={model} transcript={transcript} />
32
- </StackItem.Content>
33
- );
34
- };
35
-
36
- export default TranscriptionContainer;