@dxos/plugin-transcription 0.8.4-main.f9ba587 → 0.8.4-main.fcfe5033a5

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 (243) hide show
  1. package/dist/lib/browser/blueprints/index.mjs +31 -0
  2. package/dist/lib/browser/blueprints/index.mjs.map +7 -0
  3. package/dist/lib/browser/chunk-5LWSJZTZ.mjs +17 -0
  4. package/dist/lib/browser/chunk-5LWSJZTZ.mjs.map +7 -0
  5. package/dist/lib/browser/chunk-HOOPZ7EM.mjs +35 -0
  6. package/dist/lib/browser/chunk-HOOPZ7EM.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  8. package/dist/lib/browser/chunk-KOX4WNAR.mjs +111 -0
  9. package/dist/lib/browser/chunk-KOX4WNAR.mjs.map +7 -0
  10. package/dist/lib/browser/create-BTWYQ6IM.mjs +21 -0
  11. package/dist/lib/browser/create-BTWYQ6IM.mjs.map +7 -0
  12. package/dist/lib/browser/index.mjs +1181 -93
  13. package/dist/lib/browser/index.mjs.map +4 -4
  14. package/dist/lib/browser/meta.json +1 -1
  15. package/dist/lib/browser/open-CYRYIEZI.mjs +27 -0
  16. package/dist/lib/browser/open-CYRYIEZI.mjs.map +7 -0
  17. package/dist/lib/browser/operations/index.mjs +13 -0
  18. package/dist/lib/browser/operations/index.mjs.map +7 -0
  19. package/dist/lib/browser/summarize-X2ZYTN7S.mjs +79 -0
  20. package/dist/lib/browser/summarize-X2ZYTN7S.mjs.map +7 -0
  21. package/dist/lib/browser/types/index.mjs +4 -8
  22. package/dist/lib/node-esm/blueprints/index.mjs +32 -0
  23. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  24. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  25. package/dist/lib/node-esm/chunk-MT5I4NH5.mjs +112 -0
  26. package/dist/lib/node-esm/chunk-MT5I4NH5.mjs.map +7 -0
  27. package/dist/lib/node-esm/chunk-NVM2QUMX.mjs +37 -0
  28. package/dist/lib/node-esm/chunk-NVM2QUMX.mjs.map +7 -0
  29. package/dist/lib/node-esm/chunk-X74WYCCE.mjs +19 -0
  30. package/dist/lib/node-esm/chunk-X74WYCCE.mjs.map +7 -0
  31. package/dist/lib/node-esm/create-MLUFPST2.mjs +22 -0
  32. package/dist/lib/node-esm/create-MLUFPST2.mjs.map +7 -0
  33. package/dist/lib/node-esm/index.mjs +1181 -93
  34. package/dist/lib/node-esm/index.mjs.map +4 -4
  35. package/dist/lib/node-esm/meta.json +1 -1
  36. package/dist/lib/node-esm/open-5IOC2U4Z.mjs +28 -0
  37. package/dist/lib/node-esm/open-5IOC2U4Z.mjs.map +7 -0
  38. package/dist/lib/node-esm/operations/index.mjs +14 -0
  39. package/dist/lib/node-esm/operations/index.mjs.map +7 -0
  40. package/dist/lib/node-esm/summarize-IORITU7T.mjs +80 -0
  41. package/dist/lib/node-esm/summarize-IORITU7T.mjs.map +7 -0
  42. package/dist/lib/node-esm/types/index.mjs +4 -8
  43. package/dist/types/src/TranscriptionPlugin.d.ts +2 -1
  44. package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
  45. package/dist/types/src/blueprints/index.d.ts +2 -0
  46. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  47. package/dist/types/src/blueprints/transcription-blueprint.d.ts +4 -0
  48. package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
  49. package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
  50. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  51. package/dist/types/src/capabilities/index.d.ts +6 -4
  52. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  53. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  54. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  55. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  56. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  57. package/dist/types/src/capabilities/transcriber.d.ts +4 -3
  58. package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
  59. package/dist/types/src/components/Transcription/Transcription.d.ts +18 -0
  60. package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
  61. package/dist/types/src/components/Transcription/Transcription.stories.d.ts +40 -0
  62. package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -0
  63. package/dist/types/src/components/Transcription/index.d.ts +2 -0
  64. package/dist/types/src/components/Transcription/index.d.ts.map +1 -0
  65. package/dist/types/src/components/Transcription/transcription-extension.d.ts +15 -0
  66. package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -0
  67. package/dist/types/src/components/index.d.ts +1 -3
  68. package/dist/types/src/components/index.d.ts.map +1 -1
  69. package/dist/types/src/components/stories/FileTranscription.stories.d.ts +8 -7
  70. package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
  71. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +10 -6
  72. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
  73. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +11 -10
  74. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
  75. package/dist/types/src/components/stories/TranscriptionStory.d.ts +4 -3
  76. package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
  77. package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +6 -0
  78. package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +1 -0
  79. package/dist/types/src/containers/TranscriptionContainer/index.d.ts +2 -0
  80. package/dist/types/src/containers/TranscriptionContainer/index.d.ts.map +1 -0
  81. package/dist/types/src/containers/index.d.ts +3 -0
  82. package/dist/types/src/containers/index.d.ts.map +1 -0
  83. package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
  84. package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
  85. package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
  86. package/dist/types/src/hooks/useTranscriber.d.ts +1 -1
  87. package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
  88. package/dist/types/src/index.d.ts +1 -1
  89. package/dist/types/src/index.d.ts.map +1 -1
  90. package/dist/types/src/meta.d.ts +2 -3
  91. package/dist/types/src/meta.d.ts.map +1 -1
  92. package/dist/types/src/operations/create.d.ts +5 -0
  93. package/dist/types/src/operations/create.d.ts.map +1 -0
  94. package/dist/types/src/operations/definitions.d.ts +917 -0
  95. package/dist/types/src/operations/definitions.d.ts.map +1 -0
  96. package/dist/types/src/operations/index.d.ts +4 -0
  97. package/dist/types/src/operations/index.d.ts.map +1 -0
  98. package/dist/types/src/operations/open.d.ts +5 -0
  99. package/dist/types/src/operations/open.d.ts.map +1 -0
  100. package/dist/types/src/operations/summarize.d.ts +8 -0
  101. package/dist/types/src/operations/summarize.d.ts.map +1 -0
  102. package/dist/types/src/segments-normalization/message-normalizer.d.ts +5 -5
  103. package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
  104. package/dist/types/src/segments-normalization/normalization.d.ts +363 -328
  105. package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
  106. package/dist/types/src/segments-normalization/utils.d.ts +2 -2
  107. package/dist/types/src/segments-normalization/utils.d.ts.map +1 -1
  108. package/dist/types/src/testing/testing.d.ts +10 -10
  109. package/dist/types/src/testing/testing.d.ts.map +1 -1
  110. package/dist/types/src/transcriber/index.d.ts +1 -1
  111. package/dist/types/src/transcriber/index.d.ts.map +1 -1
  112. package/dist/types/src/transcriber/media-stream-recorder.d.ts +3 -3
  113. package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
  114. package/dist/types/src/transcriber/transcriber.d.ts +4 -4
  115. package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
  116. package/dist/types/src/transcriber/transcription-manager.d.ts +12 -13
  117. package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
  118. package/dist/types/src/translations.d.ts +7 -7
  119. package/dist/types/src/translations.d.ts.map +1 -1
  120. package/dist/types/src/types/capabilities.d.ts +18 -0
  121. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  122. package/dist/types/src/types/index.d.ts +1 -1
  123. package/dist/types/src/types/index.d.ts.map +1 -1
  124. package/dist/types/src/types/types.d.ts +0 -26
  125. package/dist/types/src/types/types.d.ts.map +1 -1
  126. package/dist/types/src/util/index.d.ts +1 -0
  127. package/dist/types/src/util/index.d.ts.map +1 -1
  128. package/dist/types/src/util/render-byline.d.ts +4 -0
  129. package/dist/types/src/util/render-byline.d.ts.map +1 -0
  130. package/dist/types/tsconfig.tsbuildinfo +1 -1
  131. package/package.json +109 -73
  132. package/src/TranscriptionPlugin.tsx +46 -59
  133. package/src/blueprints/index.ts +5 -0
  134. package/src/blueprints/transcription-blueprint.ts +30 -0
  135. package/src/capabilities/blueprint-definition.ts +17 -0
  136. package/src/capabilities/index.ts +9 -6
  137. package/src/capabilities/operation-handler.ts +16 -0
  138. package/src/capabilities/react-surface.tsx +23 -14
  139. package/src/capabilities/transcriber.ts +52 -42
  140. package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +73 -66
  141. package/src/components/Transcription/Transcription.tsx +64 -0
  142. package/src/components/{Transcript → Transcription}/index.ts +1 -1
  143. package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +15 -48
  144. package/src/components/index.ts +1 -6
  145. package/src/components/stories/FileTranscription.stories.tsx +78 -70
  146. package/src/components/stories/KeyWordRecognition.stories.tsx +17 -13
  147. package/src/components/stories/MicrophoneTranscription.stories.tsx +84 -100
  148. package/src/components/stories/TranscriptionStory.tsx +15 -13
  149. package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +35 -0
  150. package/src/containers/TranscriptionContainer/index.ts +5 -0
  151. package/src/containers/index.ts +7 -0
  152. package/src/hooks/useAudioFile.ts +49 -53
  153. package/src/hooks/useQueueModelAdapter.ts +1 -1
  154. package/src/hooks/useTranscriber.ts +9 -3
  155. package/src/hooks/useVoiceInput.ts +3 -3
  156. package/src/index.ts +1 -1
  157. package/src/meta.ts +9 -6
  158. package/src/model/model.test.ts +27 -21
  159. package/src/operations/create.ts +24 -0
  160. package/src/operations/definitions.ts +101 -0
  161. package/src/operations/index.ts +13 -0
  162. package/src/operations/open.ts +28 -0
  163. package/src/operations/summarize.ts +102 -0
  164. package/src/segments-normalization/message-normalizer.ts +19 -14
  165. package/src/segments-normalization/normalization.test.ts +26 -33
  166. package/src/segments-normalization/normalization.ts +67 -96
  167. package/src/segments-normalization/utils.ts +2 -2
  168. package/src/testing/testing.ts +41 -41
  169. package/src/transcriber/index.ts +1 -1
  170. package/src/transcriber/media-stream-recorder.ts +4 -4
  171. package/src/transcriber/transcriber.browser.test.ts +5 -5
  172. package/src/transcriber/transcriber.ts +10 -12
  173. package/src/transcriber/transcription-manager.ts +37 -52
  174. package/src/translations.ts +7 -7
  175. package/src/types/capabilities.ts +34 -0
  176. package/src/types/index.ts +1 -1
  177. package/src/types/types.ts +0 -23
  178. package/src/util/index.ts +1 -0
  179. package/src/util/render-byline.ts +33 -0
  180. package/dist/lib/browser/TranscriptContainer-E5NBJPAY.mjs +0 -11
  181. package/dist/lib/browser/chunk-5WH45KBY.mjs +0 -19
  182. package/dist/lib/browser/chunk-5WH45KBY.mjs.map +0 -7
  183. package/dist/lib/browser/chunk-EQBICGOD.mjs +0 -8
  184. package/dist/lib/browser/chunk-EQBICGOD.mjs.map +0 -7
  185. package/dist/lib/browser/chunk-F2WY3YTD.mjs +0 -764
  186. package/dist/lib/browser/chunk-F2WY3YTD.mjs.map +0 -7
  187. package/dist/lib/browser/chunk-R7INNNUQ.mjs +0 -55
  188. package/dist/lib/browser/chunk-R7INNNUQ.mjs.map +0 -7
  189. package/dist/lib/browser/chunk-U6QBOGTN.mjs +0 -16
  190. package/dist/lib/browser/chunk-U6QBOGTN.mjs.map +0 -7
  191. package/dist/lib/browser/chunk-VDKDOZRR.mjs +0 -495
  192. package/dist/lib/browser/chunk-VDKDOZRR.mjs.map +0 -7
  193. package/dist/lib/browser/intent-resolver-3O33MMP5.mjs +0 -30
  194. package/dist/lib/browser/intent-resolver-3O33MMP5.mjs.map +0 -7
  195. package/dist/lib/browser/react-surface-FJTMNF3K.mjs +0 -34
  196. package/dist/lib/browser/react-surface-FJTMNF3K.mjs.map +0 -7
  197. package/dist/lib/browser/transcriber-YVOTUBKQ.mjs +0 -56
  198. package/dist/lib/browser/transcriber-YVOTUBKQ.mjs.map +0 -7
  199. package/dist/lib/node-esm/TranscriptContainer-UOS7JG72.mjs +0 -12
  200. package/dist/lib/node-esm/chunk-DN522SAP.mjs +0 -10
  201. package/dist/lib/node-esm/chunk-DN522SAP.mjs.map +0 -7
  202. package/dist/lib/node-esm/chunk-HSCG4XPR.mjs +0 -496
  203. package/dist/lib/node-esm/chunk-HSCG4XPR.mjs.map +0 -7
  204. package/dist/lib/node-esm/chunk-Q3JKLPTW.mjs +0 -765
  205. package/dist/lib/node-esm/chunk-Q3JKLPTW.mjs.map +0 -7
  206. package/dist/lib/node-esm/chunk-RHF2ALML.mjs +0 -17
  207. package/dist/lib/node-esm/chunk-RHF2ALML.mjs.map +0 -7
  208. package/dist/lib/node-esm/chunk-U65ZWK3L.mjs +0 -56
  209. package/dist/lib/node-esm/chunk-U65ZWK3L.mjs.map +0 -7
  210. package/dist/lib/node-esm/chunk-XMUCZBP3.mjs +0 -21
  211. package/dist/lib/node-esm/chunk-XMUCZBP3.mjs.map +0 -7
  212. package/dist/lib/node-esm/intent-resolver-YMN5SXNC.mjs +0 -31
  213. package/dist/lib/node-esm/intent-resolver-YMN5SXNC.mjs.map +0 -7
  214. package/dist/lib/node-esm/react-surface-57TSIDR2.mjs +0 -35
  215. package/dist/lib/node-esm/react-surface-57TSIDR2.mjs.map +0 -7
  216. package/dist/lib/node-esm/transcriber-GPBV52ZR.mjs +0 -57
  217. package/dist/lib/node-esm/transcriber-GPBV52ZR.mjs.map +0 -7
  218. package/dist/types/src/capabilities/capabilities.d.ts +0 -17
  219. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  220. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  221. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  222. package/dist/types/src/components/Transcript/Transcript.d.ts +0 -20
  223. package/dist/types/src/components/Transcript/Transcript.d.ts.map +0 -1
  224. package/dist/types/src/components/Transcript/Transcript.stories.d.ts +0 -24
  225. package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +0 -1
  226. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +0 -28
  227. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +0 -1
  228. package/dist/types/src/components/Transcript/index.d.ts +0 -2
  229. package/dist/types/src/components/Transcript/index.d.ts.map +0 -1
  230. package/dist/types/src/components/Transcript/transcript-extension.d.ts +0 -19
  231. package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
  232. package/dist/types/src/components/TranscriptContainer.d.ts +0 -9
  233. package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
  234. package/dist/types/src/types/schema.d.ts +0 -41
  235. package/dist/types/src/types/schema.d.ts.map +0 -1
  236. package/src/capabilities/capabilities.ts +0 -33
  237. package/src/capabilities/intent-resolver.ts +0 -24
  238. package/src/components/Transcript/Transcript.tsx +0 -100
  239. package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
  240. package/src/components/TranscriptContainer.tsx +0 -35
  241. package/src/types/schema.ts +0 -41
  242. /package/dist/lib/browser/{TranscriptContainer-E5NBJPAY.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
  243. /package/dist/lib/node-esm/{TranscriptContainer-UOS7JG72.mjs.map → chunk-HSLMI22Q.mjs.map} +0 -0
@@ -2,54 +2,53 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
5
  import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import * as Effect from 'effect/Effect';
7
+ import type * as Types from 'effect/Types';
8
8
  import React, { type FC, useEffect, useMemo, useState } from 'react';
9
9
 
10
- import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
11
10
  import { withPluginManager } from '@dxos/app-framework/testing';
12
11
  import { Key } from '@dxos/echo';
13
12
  import { ClientPlugin } from '@dxos/plugin-client';
13
+ import { initializeIdentity } from '@dxos/plugin-client/testing';
14
14
  import { PreviewPlugin } from '@dxos/plugin-preview';
15
- import { SpacePlugin } from '@dxos/plugin-space';
16
- import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
17
- import { ThemePlugin } from '@dxos/plugin-theme';
18
- import { faker } from '@dxos/random';
19
- import { useMembers, useSpace } from '@dxos/react-client/echo';
15
+ import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
16
+ import { random } from '@dxos/random';
17
+ import { useMembers, useSpaces } from '@dxos/react-client/echo';
20
18
  import { IconButton, Toolbar } from '@dxos/react-ui';
21
19
  import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
22
- import { defaultTx } from '@dxos/react-ui-theme';
23
- import { DataType } from '@dxos/schema';
24
- import { Testing } from '@dxos/schema/testing';
25
- import { withLayout } from '@dxos/storybook-utils';
20
+ import { withLayout } from '@dxos/react-ui/testing';
21
+ import { TestSchema } from '@dxos/schema/testing';
22
+ import { type ContentBlock, type Message, Organization, Person } from '@dxos/types';
26
23
 
27
- import { renderMarkdown, Transcript, type TranscriptProps } from './Transcript';
28
- import { useQueueModelAdapter } from '../../hooks';
29
- import { SerializationModel } from '../../model';
24
+ import { useQueueModelAdapter } from '#hooks';
30
25
  import {
31
26
  MessageBuilder,
32
27
  TestItem,
33
28
  useTestTranscriptionQueue,
34
29
  useTestTranscriptionQueueWithEntityExtraction,
35
- } from '../../testing';
30
+ } from '#testing';
31
+
32
+ import { SerializationModel } from '../../model';
36
33
  import { translations } from '../../translations';
34
+ import { renderByline } from '../../util';
35
+ import { Transcription, type TranscriptionProps } from './Transcription';
37
36
 
38
- faker.seed(1);
37
+ random.seed(1);
39
38
 
40
39
  /**
41
40
  * Story wrapper with test controls.
42
41
  */
43
42
  const TranscriptContainer: FC<
44
- TranscriptProps & {
43
+ TranscriptionProps & {
45
44
  running: boolean;
46
45
  onRunningChange: (running: boolean) => void;
47
46
  onReset?: () => void;
48
47
  }
49
- > = ({ space, model, running, onRunningChange, onReset }) => {
48
+ > = ({ model, running, onRunningChange, onReset }) => {
50
49
  return (
51
50
  <div className='grid grid-rows-[1fr_40px] grow divide-y divide-separator'>
52
- <Transcript space={space} model={model} />
51
+ <Transcription model={model} />
53
52
  <div className='grid grid-cols-[1fr_16rem] overflow-hidden'>
54
53
  <div className='flex items-center'>
55
54
  <SyntaxHighlighter language='json' className='text-sm'>
@@ -69,20 +68,24 @@ const TranscriptContainer: FC<
69
68
  );
70
69
  };
71
70
 
72
- type StoryProps = { messages?: DataType.Message[] } & Pick<TranscriptProps, 'ignoreAttention' | 'attendableId'>;
71
+ type DefaultStoryProps = { messages?: Message.Message[] } & Pick<
72
+ TranscriptionProps,
73
+ 'ignoreAttention' | 'attendableId'
74
+ >;
73
75
 
74
76
  /**
75
77
  * Basic story mutates array of messages.
76
78
  */
77
- const BasicStory = ({ messages: initialMessages = [], ...props }: StoryProps) => {
79
+ const BasicStory = ({ messages: initialMessages = [], ...props }: DefaultStoryProps) => {
78
80
  const [reset, setReset] = useState({});
79
81
  const builder = useMemo(() => new MessageBuilder(), []);
80
82
  const model = useMemo(
81
- () => new SerializationModel<DataType.Message>(renderMarkdown([]), initialMessages),
83
+ () => new SerializationModel<Message.Message>(renderByline([]), initialMessages),
82
84
  [initialMessages, reset],
83
85
  );
84
86
  const [running, setRunning] = useState(true);
85
- const [currentMessage, setCurrentMessage] = useState<DataType.Message | null>(null);
87
+ // Use mutable type for local message building (not ECHO-managed).
88
+ const [currentMessage, setCurrentMessage] = useState<Types.Mutable<Message.Message> | null>(null);
86
89
  useEffect(() => {
87
90
  if (!running) {
88
91
  return;
@@ -103,7 +106,7 @@ const BasicStory = ({ messages: initialMessages = [], ...props }: StoryProps) =>
103
106
  return;
104
107
  }
105
108
 
106
- currentMessage.blocks.push(builder.createBlock());
109
+ (currentMessage.blocks as ContentBlock.Any[]).push(builder.createBlock());
107
110
  model.updateChunk(currentMessage);
108
111
  }, 3_000);
109
112
 
@@ -135,34 +138,27 @@ const QueueStory = ({
135
138
  queueId,
136
139
  onReset,
137
140
  ...props
138
- }: StoryProps & { queueId: Key.ObjectId; onReset: () => void }) => {
141
+ }: DefaultStoryProps & { queueId: Key.ObjectId; onReset: () => void }) => {
139
142
  const [running, setRunning] = useState(true);
140
- const space = useSpace();
141
- const members = useMembers(space?.key).map((member) => member.identity);
143
+ const [space] = useSpaces();
144
+ const members = useMembers(space?.id).map((member) => member.identity);
142
145
  const queue = useTestTranscriptionQueue(space, queueId, running, 2_000);
143
- const model = useQueueModelAdapter(renderMarkdown(members), queue, initialMessages);
146
+ const model = useQueueModelAdapter(renderByline(members), queue, initialMessages);
144
147
 
145
148
  return (
146
- <TranscriptContainer
147
- space={space}
148
- model={model}
149
- running={running}
150
- onRunningChange={setRunning}
151
- onReset={onReset}
152
- {...props}
153
- />
149
+ <TranscriptContainer model={model} running={running} onRunningChange={setRunning} onReset={onReset} {...props} />
154
150
  );
155
151
  };
156
152
 
157
153
  // TODO(burdon): Reconcile with QueueStory.
158
154
  const EntityExtractionQueueStory = () => {
159
155
  const [running, setRunning] = useState(true);
160
- const space = useSpace();
156
+ const [space] = useSpaces();
161
157
  const members = useMembers(space?.key).map((member) => member.identity);
162
158
  const queue = useTestTranscriptionQueueWithEntityExtraction(space, undefined, running, 2_000);
163
- const model = useQueueModelAdapter(renderMarkdown(members), queue, []);
159
+ const model = useQueueModelAdapter(renderByline(members), queue, []);
164
160
 
165
- return <TranscriptContainer space={space} model={model} running={running} onRunningChange={setRunning} />;
161
+ return <TranscriptContainer model={model} running={running} onRunningChange={setRunning} />;
166
162
  };
167
163
 
168
164
  /**
@@ -178,46 +174,54 @@ const QueueStoryWrapper = () => {
178
174
  return <QueueStory key={key} queueId={queueId} onReset={handleReset} />;
179
175
  };
180
176
 
181
- const meta: Meta<typeof QueueStory> = {
182
- title: 'plugins/plugin-transcription/Transcript',
177
+ const meta = {
178
+ title: 'plugins/plugin-transcription/components/Transcription',
183
179
  decorators: [
180
+ withLayout({ layout: 'fullscreen' }),
184
181
  withPluginManager({
185
182
  plugins: [
186
- ThemePlugin({ tx: defaultTx }),
187
- StorybookLayoutPlugin(),
183
+ ...corePlugins(),
184
+ StorybookPlugin({}),
188
185
  ClientPlugin({
189
- types: [TestItem, Testing.DocumentType, DataType.Person, DataType.Organization],
190
- onClientInitialized: async (_, client) => {
191
- await client.halo.createIdentity();
192
- },
186
+ types: [TestItem, TestSchema.DocumentType, Person.Person, Organization.Organization],
187
+ onClientInitialized: ({ client }) =>
188
+ Effect.gen(function* () {
189
+ yield* initializeIdentity(client);
190
+ }),
193
191
  }),
192
+
194
193
  PreviewPlugin(),
195
- SpacePlugin(),
196
- SettingsPlugin(),
197
- IntentPlugin(),
198
194
  ],
199
195
  }),
200
- withLayout({ fullscreen: true }),
201
196
  ],
202
197
  parameters: {
198
+ layout: 'fullscreen',
203
199
  translations,
204
200
  },
205
- };
201
+ } satisfies Meta;
206
202
 
207
203
  export default meta;
208
204
 
209
- type Story = StoryObj<typeof QueueStory>;
205
+ const DefaultStory = (props: DefaultStoryProps) => {
206
+ const [messages, setMessages] = useState<Message.Message[]>([]);
207
+ useEffect(() => {
208
+ void Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())).then(setMessages);
209
+ }, []);
210
+ if (messages.length === 0) {
211
+ return <div>Loading messages...</div>;
212
+ }
213
+ return <BasicStory {...props} messages={messages} />;
214
+ };
210
215
 
211
- export const Default: Story = {
212
- render: BasicStory,
216
+ export const Default: StoryObj<typeof DefaultStory> = {
217
+ render: DefaultStory,
213
218
  args: {
214
219
  ignoreAttention: true,
215
220
  attendableId: 'story',
216
- messages: await Promise.all(Array.from({ length: 10 }, () => MessageBuilder.singleton.createMessage())),
217
221
  },
218
222
  };
219
223
 
220
- export const Empty: Story = {
224
+ export const Empty: StoryObj<typeof BasicStory> = {
221
225
  render: BasicStory,
222
226
  args: {
223
227
  ignoreAttention: true,
@@ -225,7 +229,7 @@ export const Empty: Story = {
225
229
  },
226
230
  };
227
231
 
228
- export const WithQueue: Story = {
232
+ export const WithQueue: StoryObj<typeof QueueStoryWrapper> = {
229
233
  render: QueueStoryWrapper,
230
234
  args: {
231
235
  ignoreAttention: true,
@@ -233,10 +237,13 @@ export const WithQueue: Story = {
233
237
  },
234
238
  };
235
239
 
236
- export const WithEntityExtractionQueue: Story = {
237
- render: EntityExtractionQueueStory,
238
- args: {
239
- ignoreAttention: true,
240
- attendableId: 'story',
241
- },
242
- };
240
+ // NOTE: We are running out of free quota on hugging face entity extraction.
241
+ // TODO(mykola): Fix AI service in entity extraction function.
242
+ // TODO(mykola): Fix hugging face quota issues.
243
+ // export const WithEntityExtractionQueue: StoryObj<typeof EntityExtractionQueueStory> = {
244
+ // render: EntityExtractionQueueStory,
245
+ // args: {
246
+ // ignoreAttention: true,
247
+ // attendableId: 'story',
248
+ // },
249
+ // };
@@ -0,0 +1,64 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import React from 'react';
6
+
7
+ import { useThemeContext } from '@dxos/react-ui';
8
+ import { useTextEditor } from '@dxos/react-ui-editor';
9
+ import { type Message, type Transcript } from '@dxos/types';
10
+ import {
11
+ autoScroll,
12
+ createBasicExtensions,
13
+ createMarkdownExtensions,
14
+ createThemeExtensions,
15
+ decorateMarkdown,
16
+ documentSlots,
17
+ preview,
18
+ } from '@dxos/ui-editor';
19
+ import { composable, composableProps } from '@dxos/ui-theme';
20
+ import { isTruthy } from '@dxos/util';
21
+
22
+ import { type SerializationModel } from '../../model';
23
+ import { renderByline } from '../../util';
24
+ import { transcription } from './transcription-extension';
25
+
26
+ export { renderByline };
27
+
28
+ export type TranscriptionProps = {
29
+ transcript?: Transcript.Transcript;
30
+ model: SerializationModel<Message.Message>;
31
+ // TODO(burdon): Are these still in use?
32
+ attendableId?: string;
33
+ ignoreAttention?: boolean;
34
+ };
35
+
36
+ /**
37
+ * Transcript component implemented using the editor.
38
+ */
39
+ export const Transcription = composable<HTMLDivElement, TranscriptionProps>(
40
+ ({ transcript: object, model, children, ...props }, forwardedRef) => {
41
+ const { themeMode } = useThemeContext();
42
+ const { parentRef } = useTextEditor(() => {
43
+ return {
44
+ extensions: [
45
+ createBasicExtensions({ readOnly: true, lineWrapping: true, search: true }),
46
+ createMarkdownExtensions(),
47
+ createThemeExtensions({ themeMode, slots: documentSlots }),
48
+ decorateMarkdown(),
49
+ preview(),
50
+ transcription({ model, started: object?.started ? new Date(object.started) : undefined }),
51
+ autoScroll(),
52
+ ].filter(isTruthy),
53
+ };
54
+ }, [model]);
55
+
56
+ return (
57
+ <div
58
+ {...composableProps(props, { classNames: 'dx-container' })}
59
+ ref={parentRef}
60
+ data-popover-collision-boundary={true /* TODO(thure): Make this a constant and document it. */}
61
+ />
62
+ );
63
+ },
64
+ );
@@ -2,4 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export * from './Transcript';
5
+ export * from './Transcription';
@@ -8,24 +8,22 @@ import { format } from 'date-fns/format';
8
8
  import { intervalToDuration } from 'date-fns/intervalToDuration';
9
9
 
10
10
  import { type CleanupFn, addEventListener, combine } from '@dxos/async';
11
- import { type RenderCallback } from '@dxos/react-ui-editor';
12
- import { type DataType } from '@dxos/schema';
11
+ import { type Message } from '@dxos/types';
13
12
 
14
13
  import { DocumentAdapter, type SerializationModel } from '../../model';
15
14
 
16
15
  /**
17
16
  * Data structure that maps Chunks queue to lines with transcript state.
18
17
  */
19
- export type TranscriptOptions = {
20
- model: SerializationModel<DataType.Message>;
18
+ export type TranscriptionOptions = {
19
+ model: SerializationModel<Message.Message>;
21
20
  started?: Date;
22
- renderButton?: RenderCallback<{ onClick: () => void }>;
23
21
  };
24
22
 
25
23
  /**
26
24
  * Scrolling transcript with timestamps.
27
25
  */
28
- export const transcript = ({ model, started, renderButton }: TranscriptOptions): Extension => {
26
+ export const transcription = ({ model, started }: TranscriptionOptions): Extension => {
29
27
  return [
30
28
  // Show timestamps in the gutter.
31
29
  gutter({
@@ -38,7 +36,7 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
38
36
  let line = view.state.doc.lineAt(from);
39
37
  while (line.from <= to) {
40
38
  const block = model.getChunkAtLine(line.number)?.blocks[0];
41
- const timestamp = block?.type === 'transcription' && block.started;
39
+ const timestamp = block?._tag === 'transcript' && block.started;
42
40
  if (timestamp) {
43
41
  builder.add(line.from, line.from, new TimestampMarker(line.number, new Date(timestamp), start));
44
42
  }
@@ -90,22 +88,6 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
90
88
  });
91
89
  };
92
90
 
93
- // Scroll button.
94
- if (renderButton) {
95
- this._controls = document.createElement('div');
96
- this._controls.classList.add('cm-controls', 'transition-opacity', 'duration-300', 'opacity-0');
97
- view.dom.appendChild(this._controls);
98
- renderButton(
99
- this._controls,
100
- {
101
- onClick: () => {
102
- scrollToBottom(false);
103
- },
104
- },
105
- view,
106
- );
107
- }
108
-
109
91
  // Event listeners.
110
92
  this._cleanup = combine(
111
93
  addEventListener(view.scrollDOM, 'scroll', () => {
@@ -131,7 +113,7 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
131
113
  );
132
114
  }
133
115
 
134
- update(update: ViewUpdate) {
116
+ update(_update: ViewUpdate) {
135
117
  // Initial sync.
136
118
  if (!this._initialized) {
137
119
  this._initialized = true;
@@ -149,27 +131,12 @@ export const transcript = ({ model, started, renderButton }: TranscriptOptions):
149
131
  ),
150
132
 
151
133
  EditorView.theme({
152
- '.cm-scroller': {
153
- overflowY: 'scroll',
154
- },
155
- '.cm-hide-scrollbar': {
156
- scrollbarWidth: 'none',
157
- '-ms-overflow-style': 'none',
158
- },
159
- '.cm-hide-scrollbar::-webkit-scrollbar': {
160
- display: 'none',
161
- },
162
- '.cm-controls': {
163
- position: 'absolute',
164
- bottom: '0.5rem',
165
- right: '0.5rem',
166
- zIndex: 1000,
167
- },
168
- '.cm-line': {
169
- paddingRight: '1rem',
134
+ '.cm-gutters': {
135
+ backgroundColor: 'var(--color-base-surface)',
170
136
  },
171
137
  '.cm-timestamp-gutter': {
172
138
  width: '6rem',
139
+ paddingLeft: '0.5rem',
173
140
  paddingRight: '1rem',
174
141
  },
175
142
  '.cm-timestamp-gutter > .cm-gutterElement > div': {
@@ -193,13 +160,13 @@ class TimestampMarker extends GutterMarker {
193
160
  super();
194
161
  }
195
162
 
196
- override eq(other: this): boolean {
197
- return other._timestamp === this._timestamp;
163
+ override eq(other: this) {
164
+ return this._timestamp === other._timestamp;
198
165
  }
199
166
 
200
- override toDOM(view: EditorView): HTMLDivElement {
167
+ override toDOM(view: EditorView) {
201
168
  const el = document.createElement('div');
202
- el.className = 'text-sm text-subdued hover:bg-hoverSurface cursor-pointer';
169
+ el.className = 'text-sm text-subdued hover:bg-hover-surface cursor-pointer';
203
170
  el.textContent = formatTimestamp(this._timestamp, this._started);
204
171
  // TODO(burdon): Click to bookmark or copy hyperlink.
205
172
  el.onclick = () => {
@@ -213,12 +180,12 @@ class TimestampMarker extends GutterMarker {
213
180
  }
214
181
  }
215
182
 
216
- const getStartTime = (started?: Date, message?: DataType.Message): Date | undefined => {
183
+ const getStartTime = (started?: Date, message?: Message.Message): Date | undefined => {
217
184
  if (started) {
218
185
  return started;
219
186
  }
220
187
 
221
- if (message?.blocks[0]?.type === 'transcription' && message.blocks[0].started) {
188
+ if (message?.blocks[0]?._tag === 'transcript' && message.blocks[0].started) {
222
189
  return new Date(message.blocks[0].started);
223
190
  }
224
191
 
@@ -2,9 +2,4 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { lazy } from 'react';
6
-
7
- export * from './Transcript';
8
- export * from './TranscriptContainer';
9
-
10
- export const TranscriptContainer = lazy(() => import('./TranscriptContainer'));
5
+ export * from './Transcription';