@dxos/plugin-transcription 0.8.4-main.ae835ea → 0.8.4-main.bc2380dfbc

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