@dxos/plugin-transcription 0.8.4-main.28f8d3d → 0.8.4-main.2c6827d

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 (168) hide show
  1. package/dist/lib/browser/TranscriptContainer-OQFBAGSP.mjs +11 -0
  2. package/dist/lib/browser/blueprint-definition-GZ7NOODS.mjs +147 -0
  3. package/dist/lib/browser/blueprint-definition-GZ7NOODS.mjs.map +7 -0
  4. package/dist/lib/browser/{chunk-SREIAQSP.mjs → chunk-3MKZ2MNQ.mjs} +5 -5
  5. package/dist/lib/browser/chunk-3MKZ2MNQ.mjs.map +7 -0
  6. package/dist/lib/browser/{chunk-KJIQQHJB.mjs → chunk-7GNN7E3U.mjs} +18 -58
  7. package/dist/lib/browser/chunk-7GNN7E3U.mjs.map +7 -0
  8. package/dist/lib/browser/{chunk-BJWYA2BU.mjs → chunk-C5YV3JZF.mjs} +91 -135
  9. package/dist/lib/browser/chunk-C5YV3JZF.mjs.map +7 -0
  10. package/dist/lib/browser/{chunk-UKUSJTQW.mjs → chunk-O33THH53.mjs} +2 -2
  11. package/dist/lib/browser/chunk-QOSZIUE2.mjs +32 -0
  12. package/dist/lib/browser/chunk-QOSZIUE2.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-VBUIO677.mjs +29 -0
  14. package/dist/lib/browser/chunk-VBUIO677.mjs.map +7 -0
  15. package/dist/lib/browser/index.mjs +23 -20
  16. package/dist/lib/browser/index.mjs.map +3 -3
  17. package/dist/lib/browser/intent-resolver-5CGCLOXB.mjs +25 -0
  18. package/dist/lib/browser/intent-resolver-5CGCLOXB.mjs.map +7 -0
  19. package/dist/lib/browser/meta.json +1 -1
  20. package/dist/lib/browser/{react-surface-4MEJMKYQ.mjs → react-surface-OK55WK7J.mjs} +9 -11
  21. package/dist/lib/browser/react-surface-OK55WK7J.mjs.map +7 -0
  22. package/dist/lib/browser/{transcriber-V77CN7XX.mjs → transcriber-6YDM5ZDT.mjs} +7 -7
  23. package/dist/lib/browser/{transcriber-V77CN7XX.mjs.map → transcriber-6YDM5ZDT.mjs.map} +1 -1
  24. package/dist/lib/browser/types/index.mjs +4 -8
  25. package/dist/lib/node-esm/{TranscriptContainer-GEUOOYHX.mjs → TranscriptContainer-GM47P6WH.mjs} +4 -4
  26. package/dist/lib/node-esm/blueprint-definition-GAHQBYTF.mjs +148 -0
  27. package/dist/lib/node-esm/blueprint-definition-GAHQBYTF.mjs.map +7 -0
  28. package/dist/lib/node-esm/{chunk-A33GNR44.mjs → chunk-5JN2MHYA.mjs} +18 -58
  29. package/dist/lib/node-esm/chunk-5JN2MHYA.mjs.map +7 -0
  30. package/dist/lib/node-esm/{chunk-Y7PCJ34K.mjs → chunk-IKGUNN3Z.mjs} +91 -135
  31. package/dist/lib/node-esm/chunk-IKGUNN3Z.mjs.map +7 -0
  32. package/dist/lib/node-esm/{chunk-PHP7MCAY.mjs → chunk-SSYFSLB7.mjs} +2 -2
  33. package/dist/lib/node-esm/{chunk-TM2ASOZA.mjs → chunk-SWUVPFKR.mjs} +5 -5
  34. package/dist/lib/node-esm/chunk-SWUVPFKR.mjs.map +7 -0
  35. package/dist/lib/node-esm/chunk-U4YPUD2F.mjs +33 -0
  36. package/dist/lib/node-esm/chunk-U4YPUD2F.mjs.map +7 -0
  37. package/dist/lib/node-esm/chunk-YVNQN2J6.mjs +30 -0
  38. package/dist/lib/node-esm/chunk-YVNQN2J6.mjs.map +7 -0
  39. package/dist/lib/node-esm/index.mjs +23 -20
  40. package/dist/lib/node-esm/index.mjs.map +3 -3
  41. package/dist/lib/node-esm/intent-resolver-4H4CXIAL.mjs +26 -0
  42. package/dist/lib/node-esm/intent-resolver-4H4CXIAL.mjs.map +7 -0
  43. package/dist/lib/node-esm/meta.json +1 -1
  44. package/dist/lib/node-esm/{react-surface-EZUPNHUC.mjs → react-surface-EK6K2MMD.mjs} +9 -11
  45. package/dist/lib/node-esm/react-surface-EK6K2MMD.mjs.map +7 -0
  46. package/dist/lib/node-esm/{transcriber-3SX3DNLV.mjs → transcriber-CPD3FZ7M.mjs} +7 -7
  47. package/dist/lib/node-esm/{transcriber-3SX3DNLV.mjs.map → transcriber-CPD3FZ7M.mjs.map} +1 -1
  48. package/dist/lib/node-esm/types/index.mjs +4 -8
  49. package/dist/types/src/TranscriptionPlugin.d.ts +1 -1
  50. package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
  51. package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
  52. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  53. package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
  54. package/dist/types/src/capabilities/index.d.ts +3 -2
  55. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  56. package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
  57. package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
  58. package/dist/types/src/capabilities/react-surface.d.ts +1 -1
  59. package/dist/types/src/capabilities/transcriber.d.ts +1 -1
  60. package/dist/types/src/components/Transcript/Transcript.d.ts +6 -7
  61. package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
  62. package/dist/types/src/components/Transcript/Transcript.stories.d.ts +33 -18
  63. package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
  64. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +3 -3
  65. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -1
  66. package/dist/types/src/components/Transcript/transcript-extension.d.ts +3 -7
  67. package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -1
  68. package/dist/types/src/components/TranscriptContainer.d.ts +2 -2
  69. package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
  70. package/dist/types/src/components/stories/FileTranscription.stories.d.ts +5 -4
  71. package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
  72. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +10 -6
  73. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
  74. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +7 -6
  75. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
  76. package/dist/types/src/components/stories/TranscriptionStory.d.ts +4 -3
  77. package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
  78. package/dist/types/src/functions/index.d.ts +3 -0
  79. package/dist/types/src/functions/index.d.ts.map +1 -0
  80. package/dist/types/src/functions/open.d.ts +7 -0
  81. package/dist/types/src/functions/open.d.ts.map +1 -0
  82. package/dist/types/src/functions/summarize.d.ts +11 -0
  83. package/dist/types/src/functions/summarize.d.ts.map +1 -0
  84. package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
  85. package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
  86. package/dist/types/src/meta.d.ts +0 -1
  87. package/dist/types/src/meta.d.ts.map +1 -1
  88. package/dist/types/src/segments-normalization/message-normalizer.d.ts +3 -3
  89. package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
  90. package/dist/types/src/segments-normalization/normalization.d.ts +389 -335
  91. package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
  92. package/dist/types/src/segments-normalization/utils.d.ts +2 -2
  93. package/dist/types/src/segments-normalization/utils.d.ts.map +1 -1
  94. package/dist/types/src/testing/testing.d.ts +6 -6
  95. package/dist/types/src/testing/testing.d.ts.map +1 -1
  96. package/dist/types/src/transcriber/transcriber.d.ts +2 -2
  97. package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
  98. package/dist/types/src/transcriber/transcription-manager.d.ts +6 -10
  99. package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
  100. package/dist/types/src/types/TranscriptAction.d.ts +23 -0
  101. package/dist/types/src/types/TranscriptAction.d.ts.map +1 -0
  102. package/dist/types/src/types/index.d.ts +1 -1
  103. package/dist/types/src/types/index.d.ts.map +1 -1
  104. package/dist/types/src/types/types.d.ts +0 -26
  105. package/dist/types/src/types/types.d.ts.map +1 -1
  106. package/dist/types/tsconfig.tsbuildinfo +1 -1
  107. package/package.json +64 -63
  108. package/src/TranscriptionPlugin.tsx +58 -54
  109. package/src/capabilities/blueprint-definition.ts +31 -0
  110. package/src/capabilities/capabilities.ts +3 -3
  111. package/src/capabilities/index.ts +1 -0
  112. package/src/capabilities/intent-resolver.ts +5 -10
  113. package/src/capabilities/react-surface.tsx +2 -2
  114. package/src/components/Transcript/Transcript.stories.tsx +35 -33
  115. package/src/components/Transcript/Transcript.tsx +21 -29
  116. package/src/components/Transcript/deprecated/OldTranscript.tsx +7 -7
  117. package/src/components/Transcript/transcript-extension.ts +11 -44
  118. package/src/components/TranscriptContainer.tsx +10 -10
  119. package/src/components/stories/FileTranscription.stories.tsx +48 -37
  120. package/src/components/stories/KeyWordRecognition.stories.tsx +15 -11
  121. package/src/components/stories/MicrophoneTranscription.stories.tsx +43 -40
  122. package/src/components/stories/TranscriptionStory.tsx +14 -11
  123. package/src/functions/index.ts +6 -0
  124. package/src/functions/open.ts +38 -0
  125. package/src/functions/summarize.ts +103 -0
  126. package/src/hooks/useAudioFile.ts +49 -53
  127. package/src/hooks/useTranscriber.ts +7 -2
  128. package/src/meta.ts +7 -4
  129. package/src/model/model.test.ts +11 -11
  130. package/src/segments-normalization/message-normalizer.ts +6 -6
  131. package/src/segments-normalization/normalization.test.ts +6 -6
  132. package/src/segments-normalization/normalization.ts +7 -7
  133. package/src/segments-normalization/utils.ts +2 -2
  134. package/src/testing/testing.ts +25 -20
  135. package/src/transcriber/transcriber.browser.test.ts +3 -3
  136. package/src/transcriber/transcriber.ts +3 -3
  137. package/src/transcriber/transcription-manager.ts +23 -44
  138. package/src/types/TranscriptAction.ts +23 -0
  139. package/src/types/index.ts +1 -1
  140. package/src/types/types.ts +0 -24
  141. package/dist/lib/browser/TranscriptContainer-FH7VAWYA.mjs +0 -11
  142. package/dist/lib/browser/chunk-5WH45KBY.mjs +0 -19
  143. package/dist/lib/browser/chunk-5WH45KBY.mjs.map +0 -7
  144. package/dist/lib/browser/chunk-BJWYA2BU.mjs.map +0 -7
  145. package/dist/lib/browser/chunk-KJIQQHJB.mjs.map +0 -7
  146. package/dist/lib/browser/chunk-KWOOVS5G.mjs +0 -55
  147. package/dist/lib/browser/chunk-KWOOVS5G.mjs.map +0 -7
  148. package/dist/lib/browser/chunk-SREIAQSP.mjs.map +0 -7
  149. package/dist/lib/browser/intent-resolver-AOVQ7JI4.mjs +0 -30
  150. package/dist/lib/browser/intent-resolver-AOVQ7JI4.mjs.map +0 -7
  151. package/dist/lib/browser/react-surface-4MEJMKYQ.mjs.map +0 -7
  152. package/dist/lib/node-esm/chunk-A33GNR44.mjs.map +0 -7
  153. package/dist/lib/node-esm/chunk-IKQMDRY6.mjs +0 -56
  154. package/dist/lib/node-esm/chunk-IKQMDRY6.mjs.map +0 -7
  155. package/dist/lib/node-esm/chunk-TM2ASOZA.mjs.map +0 -7
  156. package/dist/lib/node-esm/chunk-XMUCZBP3.mjs +0 -21
  157. package/dist/lib/node-esm/chunk-XMUCZBP3.mjs.map +0 -7
  158. package/dist/lib/node-esm/chunk-Y7PCJ34K.mjs.map +0 -7
  159. package/dist/lib/node-esm/intent-resolver-P4XPIKQF.mjs +0 -31
  160. package/dist/lib/node-esm/intent-resolver-P4XPIKQF.mjs.map +0 -7
  161. package/dist/lib/node-esm/react-surface-EZUPNHUC.mjs.map +0 -7
  162. package/dist/types/src/types/schema.d.ts +0 -41
  163. package/dist/types/src/types/schema.d.ts.map +0 -1
  164. package/src/types/schema.ts +0 -41
  165. /package/dist/lib/browser/{TranscriptContainer-FH7VAWYA.mjs.map → TranscriptContainer-OQFBAGSP.mjs.map} +0 -0
  166. /package/dist/lib/browser/{chunk-UKUSJTQW.mjs.map → chunk-O33THH53.mjs.map} +0 -0
  167. /package/dist/lib/node-esm/{TranscriptContainer-GEUOOYHX.mjs.map → TranscriptContainer-GM47P6WH.mjs.map} +0 -0
  168. /package/dist/lib/node-esm/{chunk-PHP7MCAY.mjs.map → chunk-SSYFSLB7.mjs.map} +0 -0
@@ -6,29 +6,29 @@ import React from 'react';
6
6
 
7
7
  import { type Space } from '@dxos/react-client/echo';
8
8
  import { type Identity } from '@dxos/react-client/halo';
9
- import { IconButton, type ThemedClassName, useThemeContext } from '@dxos/react-ui';
9
+ import { type ThemedClassName, useThemeContext } from '@dxos/react-ui';
10
10
  import {
11
+ autoScroll,
11
12
  createBasicExtensions,
12
13
  createMarkdownExtensions,
13
- createRenderer,
14
14
  createThemeExtensions,
15
15
  decorateMarkdown,
16
- editorWidth,
16
+ editorSlots,
17
17
  preview,
18
18
  useTextEditor,
19
19
  } from '@dxos/react-ui-editor';
20
20
  import { mx } from '@dxos/react-ui-theme';
21
- import { type DataType } from '@dxos/schema';
22
- import { isNotFalsy } from '@dxos/util';
21
+ import { type Message, type Transcript } from '@dxos/types';
22
+ import { isTruthy } from '@dxos/util';
23
23
 
24
24
  import { type SerializationModel } from '../../model';
25
- import { type TranscriptType } from '../../types';
26
25
 
27
26
  import { transcript } from './transcript-extension';
28
27
 
29
- export const renderMarkdown =
28
+ // TODO(thure): Move this?
29
+ export const renderByline =
30
30
  (identities: Identity[]) =>
31
- (message: DataType.Message, index: number, debug = false): string[] => {
31
+ (message: Message.Message, index: number, debug = false): string[] => {
32
32
  if (message.sender.role === 'assistant') {
33
33
  // Start/stop block.
34
34
  return [message.blocks.find((block) => block._tag === 'transcript')?.text ?? '', ''];
@@ -45,17 +45,18 @@ export const renderMarkdown =
45
45
  message.sender.identityDid;
46
46
  const blocks = message.blocks.filter((block) => block._tag === 'transcript');
47
47
  return [
48
+ // TODO(thure): Use an XML tag with the bits needed here.
48
49
  `###### ${name}` + (debug ? ` [${index}]:${message.id}` : ''),
49
50
  blocks.map((block) => block.text.trim()).join(' '),
50
51
  '',
51
52
  ];
52
53
  };
53
54
 
54
- export type TranscriptProps = ThemedClassName<{
55
- transcript?: TranscriptType;
55
+ export type TranscriptViewProps = ThemedClassName<{
56
56
  space?: Space;
57
- model: SerializationModel<DataType.Message>;
58
- // TODO(wittjosiah): Move to container.
57
+ transcript?: Transcript.Transcript;
58
+ model: SerializationModel<Message.Message>;
59
+ // TODO(burdon): Are these still in use?
59
60
  attendableId?: string;
60
61
  ignoreAttention?: boolean;
61
62
  }>;
@@ -63,39 +64,30 @@ export type TranscriptProps = ThemedClassName<{
63
64
  /**
64
65
  * Transcript component implemented using the editor.
65
66
  */
66
- export const Transcript = ({
67
- classNames,
68
- transcript: object,
69
- space,
70
- model,
71
- attendableId,
72
- ignoreAttention,
73
- }: TranscriptProps) => {
67
+ export const TranscriptView = ({ classNames, space, transcript: object, model }: TranscriptViewProps) => {
74
68
  const { themeMode } = useThemeContext();
75
69
  const { parentRef } = useTextEditor(() => {
76
70
  return {
77
71
  extensions: [
78
72
  createBasicExtensions({ readOnly: true, lineWrapping: true, search: true }),
79
- createMarkdownExtensions({ themeMode }),
80
- createThemeExtensions({ themeMode }),
73
+ createMarkdownExtensions(),
74
+ createThemeExtensions({ themeMode, slots: editorSlots }),
81
75
  decorateMarkdown(),
82
- space && preview(),
76
+ preview(),
83
77
  transcript({
84
78
  model,
85
79
  started: object?.started ? new Date(object.started) : undefined,
86
- renderButton: createRenderer(({ onClick }) => (
87
- <IconButton icon='ph--arrow-line-down--regular' iconOnly label='Scroll to bottom' onClick={onClick} />
88
- )),
89
80
  }),
90
- ].filter(isNotFalsy),
81
+ autoScroll(),
82
+ ].filter(isTruthy),
91
83
  };
92
84
  }, [space, model]);
93
85
 
94
86
  return (
95
87
  <div
96
88
  ref={parentRef}
97
- className={mx('flex grow overflow-hidden', editorWidth, classNames)}
98
- data-popover-collision-boundary={true}
89
+ className={mx('flex grow overflow-hidden container-max-width', classNames)}
90
+ data-popover-collision-boundary={true /* TODO(thure): Make this a constant and document it. */}
99
91
  />
100
92
  );
101
93
  };
@@ -3,7 +3,7 @@
3
3
  //
4
4
 
5
5
  import { intervalToDuration } from 'date-fns/intervalToDuration';
6
- import { Schema } from 'effect';
6
+ import * as Schema from 'effect/Schema';
7
7
  import { yieldOrContinue } from 'main-thread-scheduling';
8
8
  import React, { type FC, type WheelEvent, useCallback, useEffect, useMemo, useRef, useState } from 'react';
9
9
  import { type OnResizeCallback, useResizeDetector } from 'react-resize-detector';
@@ -21,7 +21,7 @@ import {
21
21
  } from '@dxos/react-ui-grid';
22
22
  import { mx } from '@dxos/react-ui-theme';
23
23
 
24
- import { TRANSCRIPTION_PLUGIN } from '../../../meta';
24
+ import { meta } from '../../../meta';
25
25
 
26
26
  /**
27
27
  * Transcription fragment.
@@ -115,7 +115,7 @@ const measureRows = async (
115
115
  return result;
116
116
  };
117
117
 
118
- export type TranscriptProps = ThemedClassName<{
118
+ export type TranscriptViewProps = ThemedClassName<{
119
119
  blocks?: TranscriptBlock[];
120
120
  attendableId?: string;
121
121
  ignoreAttention?: boolean;
@@ -124,8 +124,8 @@ export type TranscriptProps = ThemedClassName<{
124
124
  /**
125
125
  * @@deprecated
126
126
  */
127
- export const Transcript: FC<TranscriptProps> = ({ classNames, blocks, attendableId, ignoreAttention }) => {
128
- const { t } = useTranslation(TRANSCRIPTION_PLUGIN);
127
+ export const Transcript: FC<TranscriptViewProps> = ({ classNames, blocks, attendableId, ignoreAttention }) => {
128
+ const { t } = useTranslation(meta.id);
129
129
  const [dxGrid, setDxGrid] = useState<DxGridElement | null>(null);
130
130
  const [rows, setRows] = useState<DxGridAxisMeta | undefined>(undefined);
131
131
  const [columns, setColumns] = useState<DxGridAxisMeta | undefined>(undefined);
@@ -144,7 +144,7 @@ export const Transcript: FC<TranscriptProps> = ({ classNames, blocks, attendable
144
144
  [hasAttention, ignoreAttention],
145
145
  );
146
146
 
147
- const abortControllerRef = useRef<AbortController>();
147
+ const abortControllerRef = useRef<AbortController>(null);
148
148
 
149
149
  const handleResize = useCallback(
150
150
  async ({ entry }: { entry: { target: HTMLDivElement } | null }) => {
@@ -242,7 +242,7 @@ export const Transcript: FC<TranscriptProps> = ({ classNames, blocks, attendable
242
242
  ref={setDxGrid}
243
243
  />
244
244
  </Grid.Root>
245
- <div role='none' {...{ inert: '' }} aria-hidden className={measureClasses} ref={measureRef} />
245
+ <div role='none' {...{ inert: true }} aria-hidden className={measureClasses} ref={measureRef} />
246
246
  <IconButton
247
247
  icon='ph--arrow-line-down--regular'
248
248
  iconOnly
@@ -8,8 +8,7 @@ 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
 
@@ -17,15 +16,14 @@ import { DocumentAdapter, type SerializationModel } from '../../model';
17
16
  * Data structure that maps Chunks queue to lines with transcript state.
18
17
  */
19
18
  export type TranscriptOptions = {
20
- model: SerializationModel<DataType.Message>;
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 transcript = ({ model, started }: TranscriptOptions): Extension => {
29
27
  return [
30
28
  // Show timestamps in the gutter.
31
29
  gutter({
@@ -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(--dx-baseSurface)',
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,11 +160,11 @@ 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
169
  el.className = 'text-sm text-subdued hover:bg-hoverSurface cursor-pointer';
203
170
  el.textContent = formatTimestamp(this._timestamp, this._started);
@@ -213,7 +180,7 @@ 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
  }
@@ -4,31 +4,31 @@
4
4
 
5
5
  import React from 'react';
6
6
 
7
- import { fullyQualifiedId, getSpace } from '@dxos/client/echo';
7
+ import { getSpace } from '@dxos/client/echo';
8
+ import { Obj } from '@dxos/echo';
8
9
  import { useMembers, useQueue } from '@dxos/react-client/echo';
9
10
  import { StackItem } from '@dxos/react-ui-stack';
10
- import { type DataType } from '@dxos/schema';
11
+ import { type Message, type Transcript } from '@dxos/types';
11
12
 
12
13
  import { useQueueModelAdapter } from '../hooks';
13
- import { type TranscriptType } from '../types';
14
14
 
15
- import { Transcript, renderMarkdown } from './Transcript';
15
+ import { TranscriptView, renderByline } from './Transcript';
16
16
 
17
17
  export type TranscriptionContainerProps = {
18
18
  role: string;
19
- transcript: TranscriptType;
19
+ transcript: Transcript.Transcript;
20
20
  };
21
21
 
22
22
  export const TranscriptionContainer = ({ transcript }: TranscriptionContainerProps) => {
23
- const attendableId = fullyQualifiedId(transcript);
23
+ const attendableId = Obj.getDXN(transcript).toString();
24
24
  const space = getSpace(transcript);
25
25
  const members = useMembers(space?.key).map((member) => member.identity);
26
- const queue = useQueue<DataType.Message>(transcript.queue.dxn, { pollInterval: 1_000 });
27
- const model = useQueueModelAdapter(renderMarkdown(members), queue);
26
+ const queue = useQueue<Message.Message>(transcript.queue.dxn, { pollInterval: 1_000 });
27
+ const model = useQueueModelAdapter(renderByline(members), queue);
28
28
 
29
29
  return (
30
- <StackItem.Content classNames='container-max-width pli-2'>
31
- <Transcript attendableId={attendableId} space={space} model={model} transcript={transcript} />
30
+ <StackItem.Content>
31
+ <TranscriptView attendableId={attendableId} space={space} model={model} transcript={transcript} />
32
32
  </StackItem.Content>
33
33
  );
34
34
  };
@@ -2,8 +2,6 @@
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';
8
6
  import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
9
7
 
@@ -12,26 +10,27 @@ import { withPluginManager } from '@dxos/app-framework/testing';
12
10
  import { scheduleTask } from '@dxos/async';
13
11
  import { Context } from '@dxos/context';
14
12
  import { Obj } from '@dxos/echo';
13
+ import { createQueueDXN } from '@dxos/echo/internal';
15
14
  import { MemoryQueue } from '@dxos/echo-db';
16
- import { createQueueDXN } from '@dxos/echo-schema';
17
- import { FunctionExecutor, ServiceContainer } from '@dxos/functions';
15
+ import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
18
16
  import { log } from '@dxos/log';
19
17
  import { ClientPlugin } from '@dxos/plugin-client';
20
18
  import { PreviewPlugin } from '@dxos/plugin-preview';
21
19
  import { SpacePlugin } from '@dxos/plugin-space';
22
20
  import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
23
21
  import { ThemePlugin } from '@dxos/plugin-theme';
22
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
24
23
  import { defaultTx } from '@dxos/react-ui-theme';
25
- import { DataType } from '@dxos/schema';
26
- import { Testing, seedTestData } from '@dxos/schema/testing';
27
- import { withLayout, withTheme } from '@dxos/storybook-utils';
24
+ import { Testing } from '@dxos/schema/testing';
25
+ import { type Actor, Message, Organization, Person } from '@dxos/types';
26
+ import { seedTestData } from '@dxos/types/testing';
28
27
 
29
28
  import { useAudioFile, useQueueModelAdapter, useTranscriber } from '../../hooks';
30
29
  import { MessageNormalizer, getActorId } from '../../segments-normalization';
31
30
  import { TestItem } from '../../testing';
32
31
  import { type MediaStreamRecorderParams, type TranscriberParams } from '../../transcriber';
33
32
  import { TranscriptionPlugin } from '../../TranscriptionPlugin';
34
- import { renderMarkdown } from '../Transcript';
33
+ import { renderByline } from '../Transcript';
35
34
 
36
35
  import { TranscriptionStory } from './TranscriptionStory';
37
36
  import { useIsSpeaking } from './useIsSpeaking';
@@ -52,7 +51,7 @@ const AudioFile = ({
52
51
  audioConstraints?: MediaTrackConstraints;
53
52
  }) => {
54
53
  const [running, setRunning] = useState(false);
55
- const actor: DataType.Actor = useMemo(() => ({ name: 'You' }), []);
54
+ const actor: Actor.Actor = useMemo(() => ({ name: 'You' }), []);
56
55
 
57
56
  // Audio.
58
57
  const { audio, track, stream } = useAudioFile(audioUrl, audioConstraints);
@@ -68,7 +67,6 @@ const AudioFile = ({
68
67
 
69
68
  useEffect(() => {
70
69
  if (!audio) {
71
- log.warn('no audio');
72
70
  return;
73
71
  }
74
72
 
@@ -82,13 +80,13 @@ const AudioFile = ({
82
80
  // Transcriber.
83
81
  // TODO(dmaretskyi): Use space.queues.create() instead.
84
82
  const queueDxn = useMemo(() => createQueueDXN(), []);
85
- const queue = useMemo(() => new MemoryQueue<DataType.Message>(queueDxn), [queueDxn]);
83
+ const queue = useMemo(() => new MemoryQueue<Message.Message>(queueDxn), [queueDxn]);
86
84
 
87
- const model = useQueueModelAdapter(renderMarkdown([]), queue);
85
+ const model = useQueueModelAdapter(renderByline([]), queue);
88
86
  const handleSegments = useCallback<TranscriberParams['onSegments']>(
89
87
  async (blocks) => {
90
88
  void queue?.append([
91
- Obj.make(DataType.Message, {
89
+ Obj.make(Message.Message, {
92
90
  created: new Date().toISOString(),
93
91
  sender: actor,
94
92
  blocks,
@@ -147,10 +145,10 @@ const AudioFile = ({
147
145
  }, [normalizer]);
148
146
 
149
147
  const manageChunkRecording = () => {
150
- if (running && isSpeaking) {
148
+ if (running && isSpeaking && transcriber) {
151
149
  log.info('starting transcription');
152
150
  transcriber?.startChunksRecording();
153
- } else if (!isSpeaking || !running) {
151
+ } else if ((!isSpeaking || !running) && transcriber) {
154
152
  log.info('stopping transcription');
155
153
  transcriber?.stopChunksRecording();
156
154
  }
@@ -176,18 +174,26 @@ const AudioFile = ({
176
174
  manageChunkRecording();
177
175
  }, [isSpeaking, stream]);
178
176
 
179
- return <TranscriptionStory model={model} running={running} onRunningChange={setRunning} audioRef={ref} />;
177
+ return (
178
+ <TranscriptionStory
179
+ disabled={!stream}
180
+ model={model}
181
+ running={running}
182
+ onRunningChange={setRunning}
183
+ audioRef={ref}
184
+ />
185
+ );
180
186
  };
181
187
 
182
- const meta: Meta<typeof AudioFile> = {
188
+ const meta = {
183
189
  title: 'plugins/plugin-transcription/FileTranscription',
184
190
  decorators: [
191
+ withTheme,
192
+ withLayout({ container: 'column' }),
185
193
  withPluginManager({
186
194
  plugins: [
187
- ThemePlugin({ tx: defaultTx }),
188
- StorybookLayoutPlugin(),
189
195
  ClientPlugin({
190
- types: [TestItem, DataType.Person, DataType.Organization, Testing.DocumentType],
196
+ types: [TestItem, Person.Person, Organization.Organization, Testing.DocumentType],
191
197
  onClientInitialized: async ({ client }) => {
192
198
  await client.halo.createIdentity();
193
199
  await client.spaces.waitUntilReady();
@@ -195,21 +201,25 @@ const meta: Meta<typeof AudioFile> = {
195
201
  await seedTestData(client.spaces.default);
196
202
  },
197
203
  }),
198
- SpacePlugin(),
204
+ SpacePlugin({}),
205
+ IntentPlugin(),
206
+
207
+ // UI
208
+ ThemePlugin({ tx: defaultTx }),
199
209
  SettingsPlugin(),
200
210
  PreviewPlugin(),
201
- IntentPlugin(),
202
211
  TranscriptionPlugin(),
212
+ StorybookLayoutPlugin({}),
203
213
  ],
204
214
  fireEvents: [Events.SetupAppGraph],
205
215
  }),
206
- withTheme,
207
- withLayout({ fullscreen: true, classNames: 'justify-center' }),
208
216
  ],
209
- };
217
+ } satisfies Meta;
210
218
 
211
219
  export default meta;
212
220
 
221
+ type Story = StoryObj<typeof meta>;
222
+
213
223
  const TRANSCRIBER_CONFIG = {
214
224
  transcribeAfterChunksAmount: 100,
215
225
  prefixBufferChunksAmount: 50,
@@ -232,15 +242,16 @@ export const Default: StoryObj<typeof AudioFile> = {
232
242
  },
233
243
  };
234
244
 
235
- export const WithSentenceNormalization: StoryObj<typeof AudioFile> = {
236
- render: AudioFile,
237
- args: {
238
- detectSpeaking: true,
239
- normalizeSentences: true,
240
- // https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
241
- audioUrl: 'https://dxos.network/audio-london.m4a',
242
- // textUrl: 'https://dxos.network/audio-london.txt',
243
- transcriberConfig: TRANSCRIBER_CONFIG,
244
- recorderConfig: RECORDER_CONFIG,
245
- },
246
- };
245
+ // TODO(mykola): Fix sentence normalization.
246
+ // export const WithSentenceNormalization: StoryObj<typeof AudioFile> = {
247
+ // render: AudioFile,
248
+ // args: {
249
+ // detectSpeaking: true,
250
+ // normalizeSentences: true,
251
+ // // https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
252
+ // audioUrl: 'https://dxos.network/audio-london.m4a',
253
+ // // textUrl: 'https://dxos.network/audio-london.txt',
254
+ // transcriberConfig: TRANSCRIBER_CONFIG,
255
+ // recorderConfig: RECORDER_CONFIG,
256
+ // },
257
+ // };
@@ -2,22 +2,24 @@
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';
8
6
  import React, { useEffect, useMemo, useState } from 'react';
9
7
 
10
8
  import { log } from '@dxos/log';
11
9
  import { Toolbar } from '@dxos/react-ui';
10
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
12
11
  import { mx } from '@dxos/react-ui-theme';
13
- import { withLayout, withTheme } from '@dxos/storybook-utils';
14
12
 
15
13
  type Word = {
16
14
  text: string;
17
15
  matched: boolean;
18
16
  };
19
17
 
20
- const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
18
+ type StoryProps = {
19
+ keywords: string[];
20
+ };
21
+
22
+ const DefaultStory = ({ keywords }: StoryProps) => {
21
23
  const [running, setRunning] = useState(false);
22
24
  const [matchingWords, setMatchingWords] = useState<Word[]>(keywords.map((word) => ({ text: word, matched: false })));
23
25
 
@@ -84,7 +86,7 @@ const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
84
86
  }, [running, recognition]);
85
87
 
86
88
  return (
87
- <div className={mx('flex flex-col gap-2 w-[30rem]')}>
89
+ <div className={mx('flex flex-col gap-2 is-[30rem]')}>
88
90
  <Toolbar.Root>
89
91
  <Toolbar.IconButton
90
92
  iconOnly
@@ -99,7 +101,7 @@ const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
99
101
  <span
100
102
  key={index}
101
103
  className={mx(
102
- 'px-3 py-1 m-2 rounded border',
104
+ 'pli-3 plb-1 m-2 rounded border',
103
105
  word.matched ? 'bg-red-200 text-red-800 border-red-300' : 'bg-gray-200 text-gray-600 border-gray-300',
104
106
  )}
105
107
  >
@@ -113,15 +115,17 @@ const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
113
115
  );
114
116
  };
115
117
 
116
- const meta: Meta<typeof SpeechRecognition> = {
118
+ const meta = {
117
119
  title: 'plugins/plugin-transcription/KeyWordDetection',
118
- decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'justify-center' })],
119
- };
120
+ render: DefaultStory,
121
+ decorators: [withTheme, withLayout({ container: 'column' })],
122
+ } satisfies Meta<typeof DefaultStory>;
120
123
 
121
124
  export default meta;
122
125
 
123
- export const SpeechRecognitionAPI: StoryObj<typeof SpeechRecognition> = {
124
- render: SpeechRecognition,
126
+ type Story = StoryObj<typeof meta>;
127
+
128
+ export const SpeechRecognitionAPI: Story = {
125
129
  args: {
126
130
  keywords: ['kai', 'computer', 'hello'],
127
131
  },