@dxos/plugin-transcription 0.8.2-main.fbd8ed0 → 0.8.2-staging.7ac8446

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