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