@dxos/plugin-transcription 0.8.2-main.f11618f → 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 (239) hide show
  1. package/dist/lib/browser/{TranscriptContainer-D3EH2SLO.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-YRWBY6UK.mjs → chunk-OGNXNGJB.mjs} +27 -15
  11. package/dist/lib/browser/chunk-OGNXNGJB.mjs.map +7 -0
  12. package/dist/lib/browser/{chunk-KSUYWWIU.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 +209 -46
  17. package/dist/lib/browser/index.mjs.map +4 -4
  18. package/dist/lib/browser/{intent-resolver-ZWKYRFE7.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-F7DBDGHS.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-MSBS4VBI.mjs → transcriber-LGMIWDYI.mjs} +7 -8
  26. package/dist/lib/browser/{transcriber-MSBS4VBI.mjs.map → transcriber-LGMIWDYI.mjs.map} +3 -3
  27. package/dist/lib/browser/types/index.mjs +3 -3
  28. package/dist/lib/node/{TranscriptContainer-WCBZMA5K.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-7XIIUVN3.cjs → chunk-FCCJALOT.cjs} +83 -111
  37. package/dist/lib/node/chunk-FCCJALOT.cjs.map +7 -0
  38. package/dist/lib/node/{chunk-OCHTKDL7.cjs → chunk-LP4FG423.cjs} +8 -23
  39. package/dist/lib/node/chunk-LP4FG423.cjs.map +7 -0
  40. package/dist/lib/node/{chunk-IXU57SCA.cjs → chunk-P4VVD6ZO.cjs} +27 -15
  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 +237 -65
  45. package/dist/lib/node/index.cjs.map +4 -4
  46. package/dist/lib/node/{intent-resolver-RM4JOCDV.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-7F37EYZA.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-55OE4X6I.cjs → transcriber-QG5WPKX4.cjs} +13 -14
  54. package/dist/lib/node/{transcriber-55OE4X6I.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-GBPY6KKA.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-OS2ITZUL.mjs → chunk-GIO6J6FE.mjs} +27 -15
  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-UWF6LM27.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 +209 -46
  73. package/dist/lib/node-esm/index.mjs.map +4 -4
  74. package/dist/lib/node-esm/{intent-resolver-HDRFXMKP.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-D3L6VBEV.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-HH7EMCGH.mjs → transcriber-TMPYZ5L4.mjs} +7 -8
  82. package/dist/lib/node-esm/{transcriber-HH7EMCGH.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.map +1 -1
  86. package/dist/types/src/capabilities/capabilities.d.ts +7 -5
  87. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  88. package/dist/types/src/capabilities/index.d.ts +4 -2
  89. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  90. package/dist/types/src/capabilities/meeting-transcription-state.d.ts +4 -2
  91. package/dist/types/src/capabilities/meeting-transcription-state.d.ts.map +1 -1
  92. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  93. package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
  94. package/dist/types/src/components/Transcript/Transcript.d.ts +4 -14
  95. package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
  96. package/dist/types/src/components/Transcript/Transcript.stories.d.ts +4 -19
  97. package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
  98. package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
  99. package/dist/types/src/components/index.d.ts +0 -1
  100. package/dist/types/src/components/index.d.ts.map +1 -1
  101. package/dist/types/src/components/transcription.stories.d.ts +3 -6
  102. package/dist/types/src/components/transcription.stories.d.ts.map +1 -1
  103. package/dist/types/src/hooks/index.d.ts +0 -1
  104. package/dist/types/src/hooks/index.d.ts.map +1 -1
  105. package/dist/types/src/hooks/useTranscriber.d.ts +1 -1
  106. package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
  107. package/dist/types/src/transcriber/transcriber.d.ts +2 -2
  108. package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
  109. package/dist/types/src/transcriber/transcriber.test.d.ts +2 -0
  110. package/dist/types/src/transcriber/transcriber.test.d.ts.map +1 -0
  111. package/dist/types/src/transcriber/transcription-manager.d.ts +15 -17
  112. package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
  113. package/dist/types/src/translations.d.ts +0 -3
  114. package/dist/types/src/translations.d.ts.map +1 -1
  115. package/dist/types/src/types/schema.d.ts +28 -7
  116. package/dist/types/src/types/schema.d.ts.map +1 -1
  117. package/dist/types/src/types/types.d.ts +1 -5
  118. package/dist/types/src/types/types.d.ts.map +1 -1
  119. package/dist/types/src/util/index.d.ts +1 -0
  120. package/dist/types/src/util/index.d.ts.map +1 -1
  121. package/dist/types/src/util/random-queue-dxn.d.ts +3 -0
  122. package/dist/types/src/util/random-queue-dxn.d.ts.map +1 -0
  123. package/package.json +39 -50
  124. package/src/TranscriptionPlugin.tsx +12 -29
  125. package/src/capabilities/app-graph-builder.ts +52 -111
  126. package/src/capabilities/capabilities.ts +3 -4
  127. package/src/capabilities/index.ts +0 -1
  128. package/src/capabilities/intent-resolver.ts +5 -5
  129. package/src/capabilities/meeting-transcription-state.ts +2 -2
  130. package/src/capabilities/react-surface.tsx +4 -12
  131. package/src/capabilities/transcriber.ts +1 -2
  132. package/src/components/Transcript/Transcript.stories.tsx +43 -201
  133. package/src/components/Transcript/Transcript.tsx +208 -83
  134. package/src/components/TranscriptContainer.tsx +6 -11
  135. package/src/components/index.ts +0 -1
  136. package/src/components/transcription.stories.tsx +60 -157
  137. package/src/hooks/index.ts +0 -1
  138. package/src/hooks/useTranscriber.ts +2 -3
  139. package/src/transcriber/{transcriber.browser.test.ts → transcriber.test.ts} +3 -3
  140. package/src/transcriber/transcriber.ts +11 -17
  141. package/src/transcriber/transcription-manager.ts +58 -67
  142. package/src/translations.ts +0 -2
  143. package/src/types/schema.ts +28 -5
  144. package/src/types/types.ts +5 -13
  145. package/src/util/index.ts +1 -0
  146. package/src/util/random-queue-dxn.ts +9 -0
  147. package/dist/lib/browser/app-graph-builder-7HN3M24G.mjs +0 -349
  148. package/dist/lib/browser/app-graph-builder-7HN3M24G.mjs.map +0 -7
  149. package/dist/lib/browser/chunk-BSZSM6KA.mjs +0 -720
  150. package/dist/lib/browser/chunk-BSZSM6KA.mjs.map +0 -7
  151. package/dist/lib/browser/chunk-IWZ7C3OA.mjs +0 -27
  152. package/dist/lib/browser/chunk-IWZ7C3OA.mjs.map +0 -7
  153. package/dist/lib/browser/chunk-KLD7O5GJ.mjs.map +0 -7
  154. package/dist/lib/browser/chunk-KSUYWWIU.mjs.map +0 -7
  155. package/dist/lib/browser/chunk-LTIQFX4W.mjs.map +0 -7
  156. package/dist/lib/browser/chunk-YRWBY6UK.mjs.map +0 -7
  157. package/dist/lib/browser/intent-resolver-ZWKYRFE7.mjs.map +0 -7
  158. package/dist/lib/browser/meeting-transcription-state-MNA2XROE.mjs.map +0 -7
  159. package/dist/lib/browser/react-surface-F7DBDGHS.mjs.map +0 -7
  160. package/dist/lib/browser/settings-6YAHKVKX.mjs +0 -24
  161. package/dist/lib/browser/settings-6YAHKVKX.mjs.map +0 -7
  162. package/dist/lib/node/TranscriptContainer-WCBZMA5K.cjs.map +0 -7
  163. package/dist/lib/node/app-graph-builder-BVWYUGUO.cjs +0 -350
  164. package/dist/lib/node/app-graph-builder-BVWYUGUO.cjs.map +0 -7
  165. package/dist/lib/node/chunk-7XIIUVN3.cjs.map +0 -7
  166. package/dist/lib/node/chunk-IXU57SCA.cjs.map +0 -7
  167. package/dist/lib/node/chunk-J72PUQ3C.cjs.map +0 -7
  168. package/dist/lib/node/chunk-JSCC2AQW.cjs +0 -737
  169. package/dist/lib/node/chunk-JSCC2AQW.cjs.map +0 -7
  170. package/dist/lib/node/chunk-JUGOXWES.cjs.map +0 -7
  171. package/dist/lib/node/chunk-OCHTKDL7.cjs.map +0 -7
  172. package/dist/lib/node/intent-resolver-RM4JOCDV.cjs.map +0 -7
  173. package/dist/lib/node/meeting-transcription-state-5XLTMWPA.cjs.map +0 -7
  174. package/dist/lib/node/react-surface-7F37EYZA.cjs.map +0 -7
  175. package/dist/lib/node/settings-ZMB4XRWS.cjs +0 -38
  176. package/dist/lib/node/settings-ZMB4XRWS.cjs.map +0 -7
  177. package/dist/lib/node-esm/app-graph-builder-QK25O5K5.mjs +0 -350
  178. package/dist/lib/node-esm/app-graph-builder-QK25O5K5.mjs.map +0 -7
  179. package/dist/lib/node-esm/chunk-5E2MR5XK.mjs.map +0 -7
  180. package/dist/lib/node-esm/chunk-B2BD7S4X.mjs +0 -721
  181. package/dist/lib/node-esm/chunk-B2BD7S4X.mjs.map +0 -7
  182. package/dist/lib/node-esm/chunk-DXJN2JWV.mjs +0 -28
  183. package/dist/lib/node-esm/chunk-DXJN2JWV.mjs.map +0 -7
  184. package/dist/lib/node-esm/chunk-OS2ITZUL.mjs.map +0 -7
  185. package/dist/lib/node-esm/chunk-QMHMEKB3.mjs.map +0 -7
  186. package/dist/lib/node-esm/chunk-UWF6LM27.mjs.map +0 -7
  187. package/dist/lib/node-esm/intent-resolver-HDRFXMKP.mjs.map +0 -7
  188. package/dist/lib/node-esm/meeting-transcription-state-3WOZ52BQ.mjs.map +0 -7
  189. package/dist/lib/node-esm/react-surface-D3L6VBEV.mjs.map +0 -7
  190. package/dist/lib/node-esm/settings-I35TVDUG.mjs +0 -25
  191. package/dist/lib/node-esm/settings-I35TVDUG.mjs.map +0 -7
  192. package/dist/types/src/capabilities/settings.d.ts +0 -4
  193. package/dist/types/src/capabilities/settings.d.ts.map +0 -1
  194. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +0 -27
  195. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +0 -1
  196. package/dist/types/src/components/Transcript/transcript-extension.d.ts +0 -19
  197. package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
  198. package/dist/types/src/components/TranscriptionSettings/TranscriptionSettings.d.ts +0 -6
  199. package/dist/types/src/components/TranscriptionSettings/TranscriptionSettings.d.ts.map +0 -1
  200. package/dist/types/src/components/TranscriptionSettings/index.d.ts +0 -2
  201. package/dist/types/src/components/TranscriptionSettings/index.d.ts.map +0 -1
  202. package/dist/types/src/entity-extraction/entity-extraction.d.ts +0 -42
  203. package/dist/types/src/entity-extraction/entity-extraction.d.ts.map +0 -1
  204. package/dist/types/src/entity-extraction/entity-extraction.test.d.ts +0 -2
  205. package/dist/types/src/entity-extraction/entity-extraction.test.d.ts.map +0 -1
  206. package/dist/types/src/entity-extraction/index.d.ts +0 -2
  207. package/dist/types/src/entity-extraction/index.d.ts.map +0 -1
  208. package/dist/types/src/hooks/useQueueModelAdapter.d.ts +0 -7
  209. package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +0 -1
  210. package/dist/types/src/model/index.d.ts +0 -2
  211. package/dist/types/src/model/index.d.ts.map +0 -1
  212. package/dist/types/src/model/model.d.ts +0 -68
  213. package/dist/types/src/model/model.d.ts.map +0 -1
  214. package/dist/types/src/model/model.test.d.ts +0 -2
  215. package/dist/types/src/model/model.test.d.ts.map +0 -1
  216. package/dist/types/src/testing/index.d.ts +0 -2
  217. package/dist/types/src/testing/index.d.ts.map +0 -1
  218. package/dist/types/src/testing/testing.d.ts +0 -39
  219. package/dist/types/src/testing/testing.d.ts.map +0 -1
  220. package/dist/types/src/transcriber/transcriber.browser.test.d.ts +0 -2
  221. package/dist/types/src/transcriber/transcriber.browser.test.d.ts.map +0 -1
  222. package/src/capabilities/settings.ts +0 -20
  223. package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -254
  224. package/src/components/Transcript/transcript-extension.ts +0 -236
  225. package/src/components/TranscriptionSettings/TranscriptionSettings.tsx +0 -26
  226. package/src/components/TranscriptionSettings/index.ts +0 -5
  227. package/src/entity-extraction/entity-extraction.test.ts +0 -97
  228. package/src/entity-extraction/entity-extraction.ts +0 -149
  229. package/src/entity-extraction/index.ts +0 -5
  230. package/src/entity-extraction/system-prompt.tpl +0 -38
  231. package/src/entity-extraction/types.d.ts +0 -8
  232. package/src/hooks/useQueueModelAdapter.ts +0 -63
  233. package/src/model/index.ts +0 -5
  234. package/src/model/model.test.ts +0 -165
  235. package/src/model/model.ts +0 -229
  236. package/src/testing/index.ts +0 -5
  237. package/src/testing/testing.ts +0 -208
  238. /package/dist/lib/browser/{TranscriptContainer-D3EH2SLO.mjs.map → TranscriptContainer-JQ3HFHLQ.mjs.map} +0 -0
  239. /package/dist/lib/node-esm/{TranscriptContainer-GBPY6KKA.mjs.map → TranscriptContainer-ZXUCOWGY.mjs.map} +0 -0
@@ -4,6 +4,5 @@
4
4
 
5
5
  export * from './useAudioFile';
6
6
  export * from './useAudioTrack';
7
- export * from './useQueueModelAdapter';
8
7
  export * from './useTranscriber';
9
8
  export * from './useVoiceInput';
@@ -15,7 +15,6 @@ import { type Transcriber } from '../transcriber';
15
15
  export const useTranscriber = ({
16
16
  audioStreamTrack,
17
17
  onSegments,
18
- config,
19
18
  }: Partial<TranscriptionCapabilities.GetTranscriberProps>) => {
20
19
  const [getTranscriber] = useCapabilities(TranscriptionCapabilities.Transcriber);
21
20
 
@@ -25,8 +24,8 @@ export const useTranscriber = ({
25
24
  return undefined;
26
25
  }
27
26
 
28
- return getTranscriber({ audioStreamTrack, onSegments, config });
29
- }, [audioStreamTrack, onSegments, getTranscriber, config]);
27
+ return getTranscriber({ audioStreamTrack, onSegments });
28
+ }, [audioStreamTrack, onSegments, getTranscriber]);
30
29
 
31
30
  useEffect(() => {
32
31
  return () => {
@@ -9,11 +9,11 @@ import { WaveFile } from 'wavefile';
9
9
 
10
10
  import { Trigger } from '@dxos/async';
11
11
  import { log } from '@dxos/log';
12
- import { type TranscriptionContentBlock } from '@dxos/schema';
13
12
  import { openAndClose } from '@dxos/test-utils';
14
13
  import { trace, TRACE_PROCESSOR } from '@dxos/tracing';
15
14
 
16
15
  import { type AudioChunk, type AudioRecorder, Transcriber } from '../transcriber';
16
+ import { type TranscriptSegment } from '../types';
17
17
  import { mergeFloat64Arrays } from '../util';
18
18
 
19
19
  // TODO(burdon): ReferenceError: Worker is not defined (Can only run with web workers).
@@ -93,7 +93,7 @@ describe.skip('Transcriber', () => {
93
93
  });
94
94
 
95
95
  test.skip('transcription of audio recording', { timeout: 10_000 }, async () => {
96
- const trigger = new Trigger<TranscriptionContentBlock[]>({ autoReset: true });
96
+ const trigger = new Trigger<TranscriptSegment[]>({ autoReset: true });
97
97
  const recorder = new MockAudioRecorder({
98
98
  buffer: await readFile('test.wav'),
99
99
  chunkDuration: 3_000,
@@ -127,7 +127,7 @@ describe.skip('Transcriber', () => {
127
127
  });
128
128
 
129
129
  test.skip('transcription of audio recording with overlapping chunks', { timeout: 20_000 }, async () => {
130
- const trigger = new Trigger<TranscriptionContentBlock[]>({ autoReset: true });
130
+ const trigger = new Trigger<TranscriptSegment[]>({ autoReset: true });
131
131
  const recorder = new MockAudioRecorder({
132
132
  buffer: await readFile('test.wav'),
133
133
  chunkDuration: 3_000,
@@ -7,11 +7,10 @@ import { WaveFile } from 'wavefile';
7
7
  import { DeferredTask, Trigger } from '@dxos/async';
8
8
  import { type Context, LifecycleState, Resource } from '@dxos/context';
9
9
  import { log } from '@dxos/log';
10
- import { type TranscriptionContentBlock } from '@dxos/schema';
11
10
  import { trace } from '@dxos/tracing';
12
11
 
13
12
  import { type AudioRecorder, type AudioChunk } from './audio-recorder';
14
- import { TRANSCRIPTION_URL } from '../types';
13
+ import { TRANSCRIPTION_URL, type TranscriptSegment } from '../types';
15
14
  import { mergeFloat64Arrays } from '../util';
16
15
 
17
16
  type WhisperWord = {
@@ -65,7 +64,7 @@ export type TranscribeConfig = {
65
64
  export type TranscriberParams = {
66
65
  config: TranscribeConfig;
67
66
  recorder: AudioRecorder;
68
- onSegments: (segments: TranscriptionContentBlock[]) => Promise<void>;
67
+ onSegments: (segments: TranscriptSegment[]) => Promise<void>;
69
68
  };
70
69
 
71
70
  /**
@@ -94,7 +93,6 @@ export class Transcriber extends Resource {
94
93
  }
95
94
 
96
95
  protected override async _open(ctx: Context) {
97
- log.info('opening');
98
96
  this._recorder.setOnChunk((chunk) => this._saveAudioChunk(chunk));
99
97
  await this._recorder.start();
100
98
  this._transcribeTask = new DeferredTask(ctx, async () => this._transcribe());
@@ -102,18 +100,15 @@ export class Transcriber extends Resource {
102
100
  }
103
101
 
104
102
  protected override async _close() {
105
- log.info('closing');
106
103
  this._recording = false;
107
104
  this._transcribeTask = undefined;
108
105
  await this._recorder.stop();
109
106
  }
110
107
 
111
108
  startChunksRecording() {
112
- log.info('starting');
113
109
  if (this._lifecycleState !== LifecycleState.OPEN) {
114
110
  return;
115
111
  }
116
-
117
112
  this._recording = true;
118
113
  }
119
114
 
@@ -121,10 +116,8 @@ export class Transcriber extends Resource {
121
116
  if (this._lifecycleState !== LifecycleState.OPEN || !this._recording) {
122
117
  return;
123
118
  }
124
-
125
119
  this._recording = false;
126
120
  this._transcribeTask?.schedule();
127
- log.info('stopped');
128
121
  }
129
122
 
130
123
  private _saveAudioChunk(chunk: AudioChunk) {
@@ -201,22 +194,24 @@ export class Transcriber extends Resource {
201
194
 
202
195
  if (!response.ok) {
203
196
  this._audioChunks = [];
204
- throw new Error(`Transcription failed: ${response.statusText}`);
197
+ throw new Error('Failed to transcribe');
205
198
  }
206
199
 
207
- const { segments } = (await response.json()) as {
200
+ const {
201
+ segments,
202
+ }: {
208
203
  segments: WhisperSegment[];
209
- };
204
+ } = await response.json();
210
205
 
211
206
  log.info('transcription response', {
212
- segments: segments.length,
207
+ segments,
213
208
  string: segments.map((segments) => segments.text).join(' '),
214
209
  });
215
210
 
216
211
  return segments;
217
212
  }
218
213
 
219
- private _alignSegments(segments: WhisperSegment[], originalChunks: AudioChunk[]): TranscriptionContentBlock[] {
214
+ private _alignSegments(segments: WhisperSegment[], originalChunks: AudioChunk[]): TranscriptSegment[] {
220
215
  // Absolute zero for all relative timestamps in the segments.
221
216
  const zeroTimestamp = originalChunks.at(0)!.timestamp;
222
217
 
@@ -245,9 +240,8 @@ export class Transcriber extends Resource {
245
240
 
246
241
  // Add absolute timestamp to each segment.
247
242
  return filteredSegments.map((segment) => ({
248
- type: 'transcription',
249
- started: new Date(zeroTimestamp + segment.start * 1_000).toISOString(),
250
- text: segment.text.trim(),
243
+ started: new Date(zeroTimestamp + segment.start * 1_000),
244
+ text: segment.text,
251
245
  }));
252
246
  }
253
247
  }
@@ -5,14 +5,15 @@
5
5
  import { synchronized } from '@dxos/async';
6
6
  import { Resource } from '@dxos/context';
7
7
  import { QueueImpl, type Queue } from '@dxos/echo-db';
8
- import { create } from '@dxos/echo-schema';
9
- import { type DXN } from '@dxos/keys';
10
- import { log } from '@dxos/log';
8
+ import { createStatic } from '@dxos/echo-schema';
9
+ import { invariant } from '@dxos/invariant';
10
+ import { DXN } from '@dxos/keys';
11
11
  import { type EdgeHttpClient } from '@dxos/react-edge-client';
12
- import { MessageType, type TranscriptionContentBlock } from '@dxos/schema';
12
+ import { type HuePalette } from '@dxos/react-ui-theme';
13
13
 
14
14
  import { MediaStreamRecorder } from './media-stream-recorder';
15
15
  import { Transcriber } from './transcriber';
16
+ import { TranscriptBlock, type TranscriptSegment } from '../types';
16
17
 
17
18
  /**
18
19
  * Length of the chunk in ms.
@@ -30,34 +31,23 @@ const PREFIXED_CHUNKS_AMOUNT = 10;
30
31
  */
31
32
  const TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
32
33
 
33
- export type TranscriptMessageEnricher = (message: MessageType) => Promise<MessageType>;
34
-
35
- export type TranscriptionManagerOptions = {
36
- edgeClient: EdgeHttpClient;
37
-
38
- /**
39
- * Enrich the message before it is written to the transcription queue.
40
- */
41
- messageEnricher?: TranscriptMessageEnricher;
42
- };
43
-
44
34
  /**
45
35
  * Manages transcription state for a meeting.
46
36
  */
37
+ // TODO(mykola): Reconcile with transcriber capability.
47
38
  export class TranscriptionManager extends Resource {
48
39
  private readonly _edgeClient: EdgeHttpClient;
49
- private readonly _messageEnricher?: TranscriptMessageEnricher;
50
40
  private _audioStreamTrack?: MediaStreamTrack = undefined;
51
- private _identityDid?: string = undefined;
41
+ private _name?: string = undefined;
42
+ private _hue?: HuePalette = undefined;
52
43
  private _mediaRecorder?: MediaStreamRecorder = undefined;
53
44
  private _transcriber?: Transcriber = undefined;
54
- private _queue?: Queue<MessageType> = undefined;
55
45
  private _enabled = false;
46
+ private _queue?: Queue<TranscriptBlock> = undefined;
56
47
 
57
- constructor(options: TranscriptionManagerOptions) {
48
+ constructor(edgeClient: EdgeHttpClient) {
58
49
  super();
59
- this._edgeClient = options.edgeClient;
60
- this._messageEnricher = options.messageEnricher;
50
+ this._edgeClient = edgeClient;
61
51
  }
62
52
 
63
53
  protected override async _open() {
@@ -68,24 +58,10 @@ export class TranscriptionManager extends Resource {
68
58
  void this._transcriber?.close();
69
59
  }
70
60
 
71
- setQueue(queueDxn: DXN): TranscriptionManager {
72
- if (this._queue?.dxn.toString() !== queueDxn.toString()) {
73
- log.info('setQueue', { queueDxn: queueDxn.toString() });
74
- this._queue = new QueueImpl<MessageType>(this._edgeClient, queueDxn);
75
- }
76
- return this;
77
- }
78
-
79
- setIdentityDid(did: string): TranscriptionManager {
80
- if (this._identityDid !== did) {
81
- this._identityDid = did;
82
- }
83
- return this;
84
- }
85
-
86
- setRecording(recording?: boolean): TranscriptionManager {
61
+ @synchronized
62
+ setRecording(recording?: boolean) {
87
63
  if (!this.isOpen || !this._enabled) {
88
- return this;
64
+ return;
89
65
  }
90
66
 
91
67
  if (recording) {
@@ -93,7 +69,6 @@ export class TranscriptionManager extends Resource {
93
69
  } else {
94
70
  this._transcriber?.stopChunksRecording();
95
71
  }
96
- return this;
97
72
  }
98
73
 
99
74
  /**
@@ -105,9 +80,7 @@ export class TranscriptionManager extends Resource {
105
80
  if (this._enabled === enabled) {
106
81
  return;
107
82
  }
108
-
109
83
  this._enabled = enabled ?? false;
110
- // TODO(burdon): Why is toggle called here?
111
84
  this.isOpen && (await this._toggleTranscriber());
112
85
  }
113
86
 
@@ -116,33 +89,60 @@ export class TranscriptionManager extends Resource {
116
89
  if (this._audioStreamTrack === track) {
117
90
  return;
118
91
  }
119
-
120
92
  this._audioStreamTrack = track;
121
93
  this.isOpen && (await this._toggleTranscriber());
122
94
  }
123
95
 
124
- // TODO(burdon): Change this to setEnables (explicit), not toggle.
96
+ /**
97
+ * Set the queue to save the transcription to.
98
+ * @param queue - The queue to save the transcription to or the DXN of the queue.
99
+ */
100
+ @synchronized
101
+ setQueue(queue?: Queue<TranscriptBlock> | string) {
102
+ switch (typeof queue) {
103
+ case 'string':
104
+ if (this._queue?.dxn.toString() === queue) {
105
+ return;
106
+ }
107
+ this._queue = new QueueImpl<TranscriptBlock>(this._edgeClient, DXN.parse(queue));
108
+ break;
109
+ case 'object':
110
+ if (this._queue === queue) {
111
+ return;
112
+ }
113
+ invariant(queue instanceof QueueImpl);
114
+ this._queue = queue;
115
+ break;
116
+ case 'undefined':
117
+ this._queue = undefined;
118
+ break;
119
+ }
120
+ }
121
+
122
+ @synchronized
123
+ setName(name: string) {
124
+ if (this._name === name) {
125
+ return;
126
+ }
127
+ this._name = name;
128
+ }
129
+
130
+ @synchronized
131
+ setHue(hue: HuePalette) {
132
+ if (this._hue === hue) {
133
+ return;
134
+ }
135
+ this._hue = hue;
136
+ }
137
+
125
138
  private async _toggleTranscriber() {
126
139
  await this._maybeReinitTranscriber();
127
140
 
128
141
  // Open or close transcriber if transcription is enabled or disabled.
129
142
  if (this._enabled) {
130
143
  await this._transcriber?.open();
131
- // TODO(burdon): Started and stopped blocks appear twice.
132
- const block = create(MessageType, {
133
- created: new Date().toISOString(),
134
- blocks: [{ type: 'transcription', text: 'Started', started: new Date().toISOString() }],
135
- sender: { role: 'assistant' },
136
- });
137
- this._queue?.append([block]);
138
144
  } else {
139
145
  await this._transcriber?.close();
140
- const block = create(MessageType, {
141
- created: new Date().toISOString(),
142
- blocks: [{ type: 'transcription', text: 'Stopped', started: new Date().toISOString() }],
143
- sender: { role: 'assistant' },
144
- });
145
- this._queue?.append([block]);
146
146
  }
147
147
  }
148
148
 
@@ -173,21 +173,12 @@ export class TranscriptionManager extends Resource {
173
173
  }
174
174
  }
175
175
 
176
- private async _onSegments(segments: TranscriptionContentBlock[]) {
176
+ private async _onSegments(segments: TranscriptSegment[]) {
177
177
  if (!this.isOpen || !this._queue) {
178
178
  return;
179
179
  }
180
180
 
181
- let block = create(MessageType, {
182
- created: new Date().toISOString(),
183
- blocks: segments,
184
- sender: { identityDid: this._identityDid },
185
- });
186
-
187
- if (this._messageEnricher) {
188
- block = await this._messageEnricher(block);
189
- }
190
-
181
+ const block = createStatic(TranscriptBlock, { authorName: this._name, authorHue: this._hue, segments });
191
182
  this._queue.append([block]);
192
183
  }
193
184
  }
@@ -22,8 +22,6 @@ export default [
22
22
  'delete button': 'Delete',
23
23
  'bookmark button': 'Bookmark',
24
24
  'scroll to end label': 'Scroll to latest',
25
-
26
- 'settings entity extraction label': 'Entity extraction',
27
25
  },
28
26
  },
29
27
  },
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { Expando, Ref, S, TypedObject } from '@dxos/echo-schema';
5
+ import { EchoObject, Expando, Ref, S, TypedObject } from '@dxos/echo-schema';
6
6
 
7
7
  /**
8
8
  * Root transcript object created when the user starts a transcription.
@@ -10,9 +10,9 @@ import { Expando, Ref, S, TypedObject } from '@dxos/echo-schema';
10
10
  export const TranscriptSchema = S.Struct({
11
11
  name: S.String,
12
12
 
13
- // TODO(burdon): Use Date or string?
14
- started: S.optional(S.String),
15
- ended: S.optional(S.String),
13
+ // TODO(burdon): Use string for dates?
14
+ started: S.optional(S.Date),
15
+ ended: S.optional(S.Date),
16
16
 
17
17
  /**
18
18
  * Queue containing TranscriptBlock objects.
@@ -33,7 +33,30 @@ export class TranscriptType extends TypedObject({
33
33
  * Contains metadata for the recording and transcript.
34
34
  */
35
35
  const TranscriptHeader = S.Struct({
36
- started: S.optional(S.String),
36
+ started: S.optional(S.Date),
37
37
  });
38
38
 
39
39
  export type TranscriptHeader = S.Schema.Type<typeof TranscriptHeader>;
40
+
41
+ /**
42
+ * Transcription fragment.
43
+ */
44
+ const TranscriptSegment = S.Struct({
45
+ // TODO(burdon): TS from service is not Unix TS (x1000).
46
+ started: S.Date,
47
+ text: S.String,
48
+ });
49
+
50
+ export type TranscriptSegment = S.Schema.Type<typeof TranscriptSegment>;
51
+
52
+ /**
53
+ * Transcription block (from single speaker).
54
+ */
55
+ export const TranscriptBlock = S.Struct({
56
+ id: S.String,
57
+ authorName: S.optional(S.String), // TODO(burdon): IdentityDid.
58
+ authorHue: S.optional(S.String),
59
+ segments: S.Array(TranscriptSegment),
60
+ }).pipe(EchoObject({ typename: 'dxos.org/type/TranscriptBlock', version: '0.1.0' }));
61
+
62
+ export type TranscriptBlock = S.Schema.Type<typeof TranscriptBlock>;
@@ -2,8 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { SpaceIdSchema, S, isInstanceOf } from '@dxos/echo-schema';
6
- import { isLiveObject } from '@dxos/react-client/echo';
5
+ import { S, isInstanceOf } from '@dxos/echo-schema';
6
+ import { isReactiveObject } from '@dxos/react-client/echo';
7
7
 
8
8
  import { TranscriptType } from './schema';
9
9
  import { TRANSCRIPTION_PLUGIN } from '../meta';
@@ -22,7 +22,8 @@ export namespace TranscriptionAction {
22
22
  export class Create extends S.TaggedClass<Create>()(`${TRANSCRIPTION_ACTION}/create`, {
23
23
  input: S.Struct({
24
24
  name: S.optional(S.String),
25
- spaceId: SpaceIdSchema,
25
+ // TODO(wittjosiah): SpaceId.
26
+ spaceId: S.String,
26
27
  }),
27
28
  output: S.Struct({
28
29
  object: TranscriptType,
@@ -31,14 +32,5 @@ export namespace TranscriptionAction {
31
32
  }
32
33
 
33
34
  export const isTranscript = (object: unknown): object is typeof TranscriptType => {
34
- return isLiveObject(object) && isInstanceOf(TranscriptType, object);
35
+ return isReactiveObject(object) && isInstanceOf(TranscriptType, object);
35
36
  };
36
-
37
- // TODO(burdon): Create with decode consistently: S.decodeSync(TranscriptionSettingsSchema)({}))
38
- export const TranscriptionSettingsSchema = S.mutable(
39
- S.Struct({
40
- entityExtraction: S.optional(S.Boolean).pipe(S.withConstructorDefault(() => true)),
41
- }),
42
- );
43
-
44
- export type TranscriptionSettingsProps = S.Schema.Type<typeof TranscriptionSettingsSchema>;
package/src/util/index.ts CHANGED
@@ -5,3 +5,4 @@
5
5
  export * from './array';
6
6
  export * from './get-time-str';
7
7
  export * from './monitor-audio-level';
8
+ export * from './random-queue-dxn';
@@ -0,0 +1,9 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { ObjectId } from '@dxos/echo-schema';
6
+ import { DXN, QueueSubspaceTags, SpaceId } from '@dxos/keys';
7
+
8
+ export const randomQueueDxn = (spaceId?: SpaceId) =>
9
+ new DXN(DXN.kind.QUEUE, [QueueSubspaceTags.DATA, spaceId ?? SpaceId.random(), ObjectId.random()]);