@dxos/plugin-transcription 0.8.4-main.ae835ea → 0.8.4-main.bcb3aa67d6
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.
- package/dist/lib/browser/blueprints/index.mjs +31 -0
- package/dist/lib/browser/blueprints/index.mjs.map +7 -0
- package/dist/lib/browser/chunk-HOOPZ7EM.mjs +35 -0
- package/dist/lib/browser/chunk-HOOPZ7EM.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-RIUSFL62.mjs +112 -0
- package/dist/lib/browser/chunk-RIUSFL62.mjs.map +7 -0
- package/dist/lib/browser/chunk-YXU2ZO6W.mjs +17 -0
- package/dist/lib/browser/chunk-YXU2ZO6W.mjs.map +7 -0
- package/dist/lib/browser/create-IZPB7VZW.mjs +19 -0
- package/dist/lib/browser/create-IZPB7VZW.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +1178 -97
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/open-SN5O5I6X.mjs +29 -0
- package/dist/lib/browser/open-SN5O5I6X.mjs.map +7 -0
- package/dist/lib/browser/operations/index.mjs +13 -0
- package/dist/lib/browser/operations/index.mjs.map +7 -0
- package/dist/lib/browser/summarize-5MZENAU5.mjs +71 -0
- package/dist/lib/browser/summarize-5MZENAU5.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -6
- package/dist/lib/node-esm/blueprints/index.mjs +32 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-3GSFEN4L.mjs +113 -0
- package/dist/lib/node-esm/chunk-3GSFEN4L.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-BR2R6PCT.mjs +19 -0
- package/dist/lib/node-esm/chunk-BR2R6PCT.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-NVM2QUMX.mjs +37 -0
- package/dist/lib/node-esm/chunk-NVM2QUMX.mjs.map +7 -0
- package/dist/lib/node-esm/create-TQDGXQBL.mjs +20 -0
- package/dist/lib/node-esm/create-TQDGXQBL.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +1178 -97
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/open-4GAAWWKJ.mjs +30 -0
- package/dist/lib/node-esm/open-4GAAWWKJ.mjs.map +7 -0
- package/dist/lib/node-esm/operations/index.mjs +14 -0
- package/dist/lib/node-esm/operations/index.mjs.map +7 -0
- package/dist/lib/node-esm/summarize-RVOSRHEC.mjs +72 -0
- package/dist/lib/node-esm/summarize-RVOSRHEC.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -6
- package/dist/types/src/TranscriptionPlugin.d.ts +2 -1
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +4 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -4
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +6 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
- package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface.d.ts +3 -2
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/transcriber.d.ts +4 -3
- package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
- package/dist/types/src/components/Transcription/Transcription.d.ts +22 -0
- package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts +40 -0
- package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/index.d.ts +2 -0
- package/dist/types/src/components/Transcription/index.d.ts.map +1 -0
- package/dist/types/src/components/Transcription/transcription-extension.d.ts +15 -0
- package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -3
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +3 -3
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +2 -2
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +5 -5
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +2 -2
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +6 -0
- package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +1 -0
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts +3 -0
- package/dist/types/src/containers/TranscriptionContainer/index.d.ts.map +1 -0
- package/dist/types/src/containers/index.d.ts +3 -0
- package/dist/types/src/containers/index.d.ts.map +1 -0
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranscriber.d.ts +1 -1
- package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/operations/create.d.ts +5 -0
- package/dist/types/src/operations/create.d.ts.map +1 -0
- package/dist/types/src/operations/definitions.d.ts +905 -0
- package/dist/types/src/operations/definitions.d.ts.map +1 -0
- package/dist/types/src/operations/index.d.ts +4 -0
- package/dist/types/src/operations/index.d.ts.map +1 -0
- package/dist/types/src/operations/open.d.ts +5 -0
- package/dist/types/src/operations/open.d.ts.map +1 -0
- package/dist/types/src/operations/summarize.d.ts +8 -0
- package/dist/types/src/operations/summarize.d.ts.map +1 -0
- package/dist/types/src/segments-normalization/message-normalizer.d.ts +5 -5
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +360 -474
- package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/utils.d.ts +2 -2
- package/dist/types/src/segments-normalization/utils.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +9 -9
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +2 -2
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +4 -4
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts +9 -6
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +7 -7
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +18 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -2
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/render-byline.d.ts +4 -0
- package/dist/types/src/util/render-byline.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +105 -70
- package/src/TranscriptionPlugin.tsx +40 -60
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/transcription-blueprint.ts +30 -0
- package/src/capabilities/blueprint-definition.ts +10 -24
- package/src/capabilities/index.ts +9 -7
- package/src/capabilities/operation-handler.ts +16 -0
- package/src/capabilities/react-surface.tsx +21 -13
- package/src/capabilities/transcriber.ts +51 -43
- package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +49 -45
- package/src/components/Transcription/Transcription.tsx +65 -0
- package/src/components/{Transcript → Transcription}/index.ts +1 -1
- package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +13 -9
- package/src/components/index.ts +1 -6
- package/src/components/stories/FileTranscription.stories.tsx +30 -36
- package/src/components/stories/KeyWordRecognition.stories.tsx +6 -6
- package/src/components/stories/MicrophoneTranscription.stories.tsx +53 -74
- package/src/components/stories/TranscriptionStory.tsx +7 -9
- package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +32 -0
- package/src/containers/TranscriptionContainer/index.ts +7 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useQueueModelAdapter.ts +1 -1
- package/src/hooks/useTranscriber.ts +8 -3
- package/src/hooks/useVoiceInput.ts +2 -2
- package/src/index.ts +1 -1
- package/src/meta.ts +3 -3
- package/src/model/model.test.ts +20 -14
- package/src/operations/create.ts +22 -0
- package/src/operations/definitions.ts +102 -0
- package/src/operations/index.ts +13 -0
- package/src/operations/open.ts +31 -0
- package/src/{functions → operations}/summarize.ts +41 -47
- package/src/segments-normalization/message-normalizer.ts +18 -13
- package/src/segments-normalization/normalization.test.ts +6 -11
- package/src/segments-normalization/normalization.ts +34 -72
- package/src/segments-normalization/utils.ts +2 -2
- package/src/testing/testing.ts +28 -28
- package/src/transcriber/media-stream-recorder.ts +3 -3
- package/src/transcriber/transcriber.browser.test.ts +4 -4
- package/src/transcriber/transcriber.ts +7 -7
- package/src/transcriber/transcription-manager.ts +21 -15
- package/src/translations.ts +7 -7
- package/src/{capabilities → types}/capabilities.ts +10 -10
- package/src/types/index.ts +1 -2
- package/src/util/index.ts +1 -0
- package/src/util/render-byline.ts +33 -0
- package/dist/lib/browser/TranscriptContainer-2GSL2XB5.mjs +0 -11
- package/dist/lib/browser/blueprint-definition-UAAJYVLZ.mjs +0 -150
- package/dist/lib/browser/blueprint-definition-UAAJYVLZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs +0 -16
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-535OJKFO.mjs +0 -8
- package/dist/lib/browser/chunk-535OJKFO.mjs.map +0 -7
- package/dist/lib/browser/chunk-7DR6HZEF.mjs +0 -732
- package/dist/lib/browser/chunk-7DR6HZEF.mjs.map +0 -7
- package/dist/lib/browser/chunk-VBUIO677.mjs +0 -29
- package/dist/lib/browser/chunk-VBUIO677.mjs.map +0 -7
- package/dist/lib/browser/chunk-W7WKZTM4.mjs +0 -63
- package/dist/lib/browser/chunk-W7WKZTM4.mjs.map +0 -7
- package/dist/lib/browser/chunk-WH36ENNE.mjs +0 -466
- package/dist/lib/browser/chunk-WH36ENNE.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-ZTKTEAQX.mjs +0 -25
- package/dist/lib/browser/intent-resolver-ZTKTEAQX.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KA32A72I.mjs +0 -34
- package/dist/lib/browser/react-surface-KA32A72I.mjs.map +0 -7
- package/dist/lib/browser/transcriber-LWOLYQHC.mjs +0 -56
- package/dist/lib/browser/transcriber-LWOLYQHC.mjs.map +0 -7
- package/dist/lib/node-esm/TranscriptContainer-GRLDCESB.mjs +0 -12
- package/dist/lib/node-esm/blueprint-definition-Z3LTZ3ID.mjs +0 -151
- package/dist/lib/node-esm/blueprint-definition-Z3LTZ3ID.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K4AZOB5Y.mjs +0 -733
- package/dist/lib/node-esm/chunk-K4AZOB5Y.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OLMSTF3M.mjs +0 -64
- package/dist/lib/node-esm/chunk-OLMSTF3M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Q6WD7L2J.mjs +0 -10
- package/dist/lib/node-esm/chunk-Q6WD7L2J.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs +0 -17
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YFN4FJFK.mjs +0 -467
- package/dist/lib/node-esm/chunk-YFN4FJFK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs +0 -30
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-55WH2GY6.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-55WH2GY6.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-GU7LW2JO.mjs +0 -35
- package/dist/lib/node-esm/react-surface-GU7LW2JO.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-UGB7ECX6.mjs +0 -57
- package/dist/lib/node-esm/transcriber-UGB7ECX6.mjs.map +0 -7
- package/dist/types/src/capabilities/capabilities.d.ts +0 -17
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts +0 -20
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +0 -39
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +0 -28
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/index.d.ts +0 -2
- package/dist/types/src/components/Transcript/index.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +0 -15
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +0 -9
- package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
- package/dist/types/src/functions/index.d.ts +0 -3
- package/dist/types/src/functions/index.d.ts.map +0 -1
- package/dist/types/src/functions/open.d.ts +0 -7
- package/dist/types/src/functions/open.d.ts.map +0 -1
- package/dist/types/src/functions/summarize.d.ts +0 -11
- package/dist/types/src/functions/summarize.d.ts.map +0 -1
- package/dist/types/src/types/Transcript.d.ts +0 -30
- package/dist/types/src/types/Transcript.d.ts.map +0 -1
- package/dist/types/src/types/TranscriptAction.d.ts +0 -23
- package/dist/types/src/types/TranscriptAction.d.ts.map +0 -1
- package/src/capabilities/intent-resolver.ts +0 -18
- package/src/components/Transcript/Transcript.tsx +0 -93
- package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
- package/src/components/TranscriptContainer.tsx +0 -36
- package/src/functions/index.ts +0 -6
- package/src/functions/open.ts +0 -39
- package/src/types/Transcript.ts +0 -44
- package/src/types/TranscriptAction.ts +0 -24
- /package/dist/lib/browser/{TranscriptContainer-2GSL2XB5.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/node-esm/{TranscriptContainer-GRLDCESB.mjs.map → chunk-HSLMI22Q.mjs.map} +0 -0
package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx}
RENAMED
|
@@ -3,36 +3,36 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
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';
|
|
6
8
|
import React, { type FC, useEffect, useMemo, useState } from 'react';
|
|
7
9
|
|
|
8
|
-
import { IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
9
10
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
11
|
import { Key } from '@dxos/echo';
|
|
11
12
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
13
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
12
14
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
13
|
-
import {
|
|
14
|
-
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
15
|
-
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
15
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
16
16
|
import { faker } from '@dxos/random';
|
|
17
17
|
import { useMembers, useSpace } from '@dxos/react-client/echo';
|
|
18
18
|
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
19
|
-
import {
|
|
19
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
20
20
|
import { SyntaxHighlighter } from '@dxos/react-ui-syntax-highlighter';
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import { Testing } from '@dxos/schema/testing';
|
|
21
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
22
|
+
import { type ContentBlock, type Message, Organization, Person } from '@dxos/types';
|
|
24
23
|
|
|
25
|
-
import { useQueueModelAdapter } from '
|
|
24
|
+
import { useQueueModelAdapter } from '#hooks';
|
|
26
25
|
import { SerializationModel } from '../../model';
|
|
27
26
|
import {
|
|
28
27
|
MessageBuilder,
|
|
29
28
|
TestItem,
|
|
30
29
|
useTestTranscriptionQueue,
|
|
31
30
|
useTestTranscriptionQueueWithEntityExtraction,
|
|
32
|
-
} from '
|
|
31
|
+
} from '#testing';
|
|
33
32
|
import { translations } from '../../translations';
|
|
33
|
+
import { renderByline } from '../../util';
|
|
34
34
|
|
|
35
|
-
import {
|
|
35
|
+
import { Transcription, type TranscriptionProps } from './Transcription';
|
|
36
36
|
|
|
37
37
|
faker.seed(1);
|
|
38
38
|
|
|
@@ -40,15 +40,15 @@ faker.seed(1);
|
|
|
40
40
|
* Story wrapper with test controls.
|
|
41
41
|
*/
|
|
42
42
|
const TranscriptContainer: FC<
|
|
43
|
-
|
|
43
|
+
TranscriptionProps & {
|
|
44
44
|
running: boolean;
|
|
45
45
|
onRunningChange: (running: boolean) => void;
|
|
46
46
|
onReset?: () => void;
|
|
47
47
|
}
|
|
48
|
-
> = ({
|
|
48
|
+
> = ({ model, running, onRunningChange, onReset }) => {
|
|
49
49
|
return (
|
|
50
50
|
<div className='grid grid-rows-[1fr_40px] grow divide-y divide-separator'>
|
|
51
|
-
<
|
|
51
|
+
<Transcription model={model} />
|
|
52
52
|
<div className='grid grid-cols-[1fr_16rem] overflow-hidden'>
|
|
53
53
|
<div className='flex items-center'>
|
|
54
54
|
<SyntaxHighlighter language='json' className='text-sm'>
|
|
@@ -68,20 +68,24 @@ const TranscriptContainer: FC<
|
|
|
68
68
|
);
|
|
69
69
|
};
|
|
70
70
|
|
|
71
|
-
type
|
|
71
|
+
type DefaultStoryProps = { messages?: Message.Message[] } & Pick<
|
|
72
|
+
TranscriptionProps,
|
|
73
|
+
'ignoreAttention' | 'attendableId'
|
|
74
|
+
>;
|
|
72
75
|
|
|
73
76
|
/**
|
|
74
77
|
* Basic story mutates array of messages.
|
|
75
78
|
*/
|
|
76
|
-
const BasicStory = ({ messages: initialMessages = [], ...props }:
|
|
79
|
+
const BasicStory = ({ messages: initialMessages = [], ...props }: DefaultStoryProps) => {
|
|
77
80
|
const [reset, setReset] = useState({});
|
|
78
81
|
const builder = useMemo(() => new MessageBuilder(), []);
|
|
79
82
|
const model = useMemo(
|
|
80
|
-
() => new SerializationModel<
|
|
83
|
+
() => new SerializationModel<Message.Message>(renderByline([]), initialMessages),
|
|
81
84
|
[initialMessages, reset],
|
|
82
85
|
);
|
|
83
86
|
const [running, setRunning] = useState(true);
|
|
84
|
-
|
|
87
|
+
// Use mutable type for local message building (not ECHO-managed).
|
|
88
|
+
const [currentMessage, setCurrentMessage] = useState<Types.Mutable<Message.Message> | null>(null);
|
|
85
89
|
useEffect(() => {
|
|
86
90
|
if (!running) {
|
|
87
91
|
return;
|
|
@@ -102,7 +106,7 @@ const BasicStory = ({ messages: initialMessages = [], ...props }: StoryProps) =>
|
|
|
102
106
|
return;
|
|
103
107
|
}
|
|
104
108
|
|
|
105
|
-
currentMessage.blocks.push(builder.createBlock());
|
|
109
|
+
(currentMessage.blocks as ContentBlock.Any[]).push(builder.createBlock());
|
|
106
110
|
model.updateChunk(currentMessage);
|
|
107
111
|
}, 3_000);
|
|
108
112
|
|
|
@@ -134,22 +138,15 @@ const QueueStory = ({
|
|
|
134
138
|
queueId,
|
|
135
139
|
onReset,
|
|
136
140
|
...props
|
|
137
|
-
}:
|
|
141
|
+
}: DefaultStoryProps & { queueId: Key.ObjectId; onReset: () => void }) => {
|
|
138
142
|
const [running, setRunning] = useState(true);
|
|
139
143
|
const space = useSpace();
|
|
140
|
-
const members = useMembers(space?.
|
|
144
|
+
const members = useMembers(space?.id).map((member) => member.identity);
|
|
141
145
|
const queue = useTestTranscriptionQueue(space, queueId, running, 2_000);
|
|
142
146
|
const model = useQueueModelAdapter(renderByline(members), queue, initialMessages);
|
|
143
147
|
|
|
144
148
|
return (
|
|
145
|
-
<TranscriptContainer
|
|
146
|
-
space={space}
|
|
147
|
-
model={model}
|
|
148
|
-
running={running}
|
|
149
|
-
onRunningChange={setRunning}
|
|
150
|
-
onReset={onReset}
|
|
151
|
-
{...props}
|
|
152
|
-
/>
|
|
149
|
+
<TranscriptContainer model={model} running={running} onRunningChange={setRunning} onReset={onReset} {...props} />
|
|
153
150
|
);
|
|
154
151
|
};
|
|
155
152
|
|
|
@@ -161,7 +158,7 @@ const EntityExtractionQueueStory = () => {
|
|
|
161
158
|
const queue = useTestTranscriptionQueueWithEntityExtraction(space, undefined, running, 2_000);
|
|
162
159
|
const model = useQueueModelAdapter(renderByline(members), queue, []);
|
|
163
160
|
|
|
164
|
-
return <TranscriptContainer
|
|
161
|
+
return <TranscriptContainer model={model} running={running} onRunningChange={setRunning} />;
|
|
165
162
|
};
|
|
166
163
|
|
|
167
164
|
/**
|
|
@@ -178,25 +175,22 @@ const QueueStoryWrapper = () => {
|
|
|
178
175
|
};
|
|
179
176
|
|
|
180
177
|
const meta = {
|
|
181
|
-
title: 'plugins/plugin-transcription/
|
|
178
|
+
title: 'plugins/plugin-transcription/components/Transcription',
|
|
182
179
|
decorators: [
|
|
183
|
-
|
|
180
|
+
withLayout({ layout: 'fullscreen' }),
|
|
184
181
|
withPluginManager({
|
|
185
182
|
plugins: [
|
|
183
|
+
...corePlugins(),
|
|
184
|
+
StorybookPlugin({}),
|
|
186
185
|
ClientPlugin({
|
|
187
|
-
types: [TestItem,
|
|
188
|
-
onClientInitialized:
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
types: [TestItem, TestSchema.DocumentType, Person.Person, Organization.Organization],
|
|
187
|
+
onClientInitialized: ({ client }) =>
|
|
188
|
+
Effect.gen(function* () {
|
|
189
|
+
yield* initializeIdentity(client);
|
|
190
|
+
}),
|
|
191
191
|
}),
|
|
192
|
-
SpacePlugin({}),
|
|
193
|
-
IntentPlugin(),
|
|
194
|
-
SettingsPlugin(),
|
|
195
192
|
|
|
196
|
-
// UI
|
|
197
193
|
PreviewPlugin(),
|
|
198
|
-
ThemePlugin({ tx: defaultTx }),
|
|
199
|
-
StorybookLayoutPlugin({}),
|
|
200
194
|
],
|
|
201
195
|
}),
|
|
202
196
|
],
|
|
@@ -208,12 +202,22 @@ const meta = {
|
|
|
208
202
|
|
|
209
203
|
export default meta;
|
|
210
204
|
|
|
211
|
-
|
|
212
|
-
|
|
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
|
+
};
|
|
215
|
+
|
|
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
|
|
|
@@ -0,0 +1,65 @@
|
|
|
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
|
+
|
|
25
|
+
import { transcription } from './transcription-extension';
|
|
26
|
+
|
|
27
|
+
export { renderByline };
|
|
28
|
+
|
|
29
|
+
export type TranscriptionProps = {
|
|
30
|
+
transcript?: Transcript.Transcript;
|
|
31
|
+
model: SerializationModel<Message.Message>;
|
|
32
|
+
// TODO(burdon): Are these still in use?
|
|
33
|
+
attendableId?: string;
|
|
34
|
+
ignoreAttention?: boolean;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Transcript component implemented using the editor.
|
|
39
|
+
*/
|
|
40
|
+
export const Transcription = composable<HTMLDivElement, TranscriptionProps>(
|
|
41
|
+
({ transcript: object, model, children, ...props }, forwardedRef) => {
|
|
42
|
+
const { themeMode } = useThemeContext();
|
|
43
|
+
const { parentRef } = useTextEditor(() => {
|
|
44
|
+
return {
|
|
45
|
+
extensions: [
|
|
46
|
+
createBasicExtensions({ readOnly: true, lineWrapping: true, search: true }),
|
|
47
|
+
createMarkdownExtensions(),
|
|
48
|
+
createThemeExtensions({ themeMode, slots: documentSlots }),
|
|
49
|
+
decorateMarkdown(),
|
|
50
|
+
preview(),
|
|
51
|
+
transcription({ model, started: object?.started ? new Date(object.started) : undefined }),
|
|
52
|
+
autoScroll(),
|
|
53
|
+
].filter(isTruthy),
|
|
54
|
+
};
|
|
55
|
+
}, [model]);
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<div
|
|
59
|
+
{...composableProps(props, { classNames: 'dx-container' })}
|
|
60
|
+
ref={parentRef}
|
|
61
|
+
data-popover-collision-boundary={true /* TODO(thure): Make this a constant and document it. */}
|
|
62
|
+
/>
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
);
|
|
@@ -8,22 +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
|
|
11
|
+
import { type Message } from '@dxos/types';
|
|
12
12
|
|
|
13
13
|
import { DocumentAdapter, type SerializationModel } from '../../model';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Data structure that maps Chunks queue to lines with transcript state.
|
|
17
17
|
*/
|
|
18
|
-
export type
|
|
19
|
-
model: SerializationModel<
|
|
18
|
+
export type TranscriptionOptions = {
|
|
19
|
+
model: SerializationModel<Message.Message>;
|
|
20
20
|
started?: Date;
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
/**
|
|
24
24
|
* Scrolling transcript with timestamps.
|
|
25
25
|
*/
|
|
26
|
-
export const
|
|
26
|
+
export const transcription = ({ model, started }: TranscriptionOptions): Extension => {
|
|
27
27
|
return [
|
|
28
28
|
// Show timestamps in the gutter.
|
|
29
29
|
gutter({
|
|
@@ -131,8 +131,12 @@ export const transcript = ({ model, started }: TranscriptOptions): Extension =>
|
|
|
131
131
|
),
|
|
132
132
|
|
|
133
133
|
EditorView.theme({
|
|
134
|
+
'.cm-gutters': {
|
|
135
|
+
backgroundColor: 'var(--color-base-surface)',
|
|
136
|
+
},
|
|
134
137
|
'.cm-timestamp-gutter': {
|
|
135
138
|
width: '6rem',
|
|
139
|
+
paddingLeft: '0.5rem',
|
|
136
140
|
paddingRight: '1rem',
|
|
137
141
|
},
|
|
138
142
|
'.cm-timestamp-gutter > .cm-gutterElement > div': {
|
|
@@ -156,13 +160,13 @@ class TimestampMarker extends GutterMarker {
|
|
|
156
160
|
super();
|
|
157
161
|
}
|
|
158
162
|
|
|
159
|
-
override eq(other: this)
|
|
160
|
-
return
|
|
163
|
+
override eq(other: this) {
|
|
164
|
+
return this._timestamp === other._timestamp;
|
|
161
165
|
}
|
|
162
166
|
|
|
163
|
-
override toDOM(view: EditorView)
|
|
167
|
+
override toDOM(view: EditorView) {
|
|
164
168
|
const el = document.createElement('div');
|
|
165
|
-
el.className = 'text-sm text-subdued hover:bg-
|
|
169
|
+
el.className = 'text-sm text-subdued hover:bg-hover-surface cursor-pointer';
|
|
166
170
|
el.textContent = formatTimestamp(this._timestamp, this._started);
|
|
167
171
|
// TODO(burdon): Click to bookmark or copy hyperlink.
|
|
168
172
|
el.onclick = () => {
|
|
@@ -176,7 +180,7 @@ class TimestampMarker extends GutterMarker {
|
|
|
176
180
|
}
|
|
177
181
|
}
|
|
178
182
|
|
|
179
|
-
const getStartTime = (started?: Date, message?:
|
|
183
|
+
const getStartTime = (started?: Date, message?: Message.Message): Date | undefined => {
|
|
180
184
|
if (started) {
|
|
181
185
|
return started;
|
|
182
186
|
}
|
package/src/components/index.ts
CHANGED
|
@@ -3,33 +3,33 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type Meta, type StoryObj } from '@storybook/react-vite';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
6
7
|
import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
|
|
7
8
|
|
|
8
|
-
import { Events, IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
9
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
10
|
+
import { AppActivationEvents } from '@dxos/app-toolkit';
|
|
10
11
|
import { scheduleTask } from '@dxos/async';
|
|
11
12
|
import { Context } from '@dxos/context';
|
|
12
13
|
import { Obj } from '@dxos/echo';
|
|
13
14
|
import { createQueueDXN } from '@dxos/echo/internal';
|
|
14
15
|
import { MemoryQueue } from '@dxos/echo-db';
|
|
15
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions';
|
|
16
|
+
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
16
17
|
import { log } from '@dxos/log';
|
|
17
18
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
19
|
+
import { initializeIdentity } from '@dxos/plugin-client/testing';
|
|
18
20
|
import { PreviewPlugin } from '@dxos/plugin-preview';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { DataType } from '@dxos/schema';
|
|
25
|
-
import { Testing, seedTestData } from '@dxos/schema/testing';
|
|
21
|
+
import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
|
|
22
|
+
import { withLayout } from '@dxos/react-ui/testing';
|
|
23
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
24
|
+
import { type Actor, Message, Organization, Person } from '@dxos/types';
|
|
25
|
+
import { seedTestData } from '@dxos/types/testing';
|
|
26
26
|
|
|
27
|
-
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '
|
|
27
|
+
import { useAudioFile, useQueueModelAdapter, useTranscriber } from '#hooks';
|
|
28
28
|
import { MessageNormalizer, getActorId } from '../../segments-normalization';
|
|
29
|
-
import { TestItem } from '
|
|
30
|
-
import { type
|
|
29
|
+
import { TestItem } from '#testing';
|
|
30
|
+
import { type MediaStreamRecorderProps, type TranscriberProps } from '../../transcriber';
|
|
31
31
|
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
32
|
-
import { renderByline } from '
|
|
32
|
+
import { renderByline } from '../../util';
|
|
33
33
|
|
|
34
34
|
import { TranscriptionStory } from './TranscriptionStory';
|
|
35
35
|
import { useIsSpeaking } from './useIsSpeaking';
|
|
@@ -45,12 +45,12 @@ const AudioFile = ({
|
|
|
45
45
|
detectSpeaking?: boolean;
|
|
46
46
|
normalizeSentences?: boolean;
|
|
47
47
|
audioUrl: string;
|
|
48
|
-
transcriberConfig?:
|
|
49
|
-
recorderConfig?:
|
|
48
|
+
transcriberConfig?: TranscriberProps['config'];
|
|
49
|
+
recorderConfig?: MediaStreamRecorderProps['config'];
|
|
50
50
|
audioConstraints?: MediaTrackConstraints;
|
|
51
51
|
}) => {
|
|
52
52
|
const [running, setRunning] = useState(false);
|
|
53
|
-
const actor:
|
|
53
|
+
const actor: Actor.Actor = useMemo(() => ({ name: 'You' }), []);
|
|
54
54
|
|
|
55
55
|
// Audio.
|
|
56
56
|
const { audio, track, stream } = useAudioFile(audioUrl, audioConstraints);
|
|
@@ -79,13 +79,13 @@ const AudioFile = ({
|
|
|
79
79
|
// Transcriber.
|
|
80
80
|
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
81
81
|
const queueDxn = useMemo(() => createQueueDXN(), []);
|
|
82
|
-
const queue = useMemo(() => new MemoryQueue<
|
|
82
|
+
const queue = useMemo(() => new MemoryQueue<Message.Message>(queueDxn), [queueDxn]);
|
|
83
83
|
|
|
84
84
|
const model = useQueueModelAdapter(renderByline([]), queue);
|
|
85
|
-
const handleSegments = useCallback<
|
|
85
|
+
const handleSegments = useCallback<TranscriberProps['onSegments']>(
|
|
86
86
|
async (blocks) => {
|
|
87
87
|
void queue?.append([
|
|
88
|
-
Obj.make(
|
|
88
|
+
Obj.make(Message.Message, {
|
|
89
89
|
created: new Date().toISOString(),
|
|
90
90
|
sender: actor,
|
|
91
91
|
blocks,
|
|
@@ -185,32 +185,26 @@ const AudioFile = ({
|
|
|
185
185
|
};
|
|
186
186
|
|
|
187
187
|
const meta = {
|
|
188
|
-
title: 'plugins/plugin-transcription/FileTranscription',
|
|
188
|
+
title: 'plugins/plugin-transcription/components/FileTranscription',
|
|
189
189
|
decorators: [
|
|
190
|
-
|
|
191
|
-
withLayout({ container: 'column' }),
|
|
190
|
+
withLayout({ layout: 'column' }),
|
|
192
191
|
withPluginManager({
|
|
193
192
|
plugins: [
|
|
193
|
+
...corePlugins(),
|
|
194
|
+
StorybookPlugin({}),
|
|
194
195
|
ClientPlugin({
|
|
195
|
-
types: [TestItem,
|
|
196
|
-
onClientInitialized:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
},
|
|
196
|
+
types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
|
|
197
|
+
onClientInitialized: ({ client }) =>
|
|
198
|
+
Effect.gen(function* () {
|
|
199
|
+
const { personalSpace } = yield* initializeIdentity(client);
|
|
200
|
+
yield* Effect.promise(() => seedTestData(personalSpace));
|
|
201
|
+
}),
|
|
202
202
|
}),
|
|
203
|
-
SpacePlugin({}),
|
|
204
|
-
IntentPlugin(),
|
|
205
203
|
|
|
206
|
-
// UI
|
|
207
|
-
ThemePlugin({ tx: defaultTx }),
|
|
208
|
-
SettingsPlugin(),
|
|
209
204
|
PreviewPlugin(),
|
|
210
205
|
TranscriptionPlugin(),
|
|
211
|
-
StorybookLayoutPlugin({}),
|
|
212
206
|
],
|
|
213
|
-
fireEvents: [
|
|
207
|
+
fireEvents: [AppActivationEvents.SetupAppGraph],
|
|
214
208
|
}),
|
|
215
209
|
],
|
|
216
210
|
} satisfies Meta;
|
|
@@ -8,18 +8,18 @@ import React, { useEffect, useMemo, useState } from 'react';
|
|
|
8
8
|
import { log } from '@dxos/log';
|
|
9
9
|
import { Toolbar } from '@dxos/react-ui';
|
|
10
10
|
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
11
|
-
import { mx } from '@dxos/
|
|
11
|
+
import { mx } from '@dxos/ui-theme';
|
|
12
12
|
|
|
13
13
|
type Word = {
|
|
14
14
|
text: string;
|
|
15
15
|
matched: boolean;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
type
|
|
18
|
+
type DefaultStoryProps = {
|
|
19
19
|
keywords: string[];
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
const DefaultStory = ({ keywords }:
|
|
22
|
+
const DefaultStory = ({ keywords }: DefaultStoryProps) => {
|
|
23
23
|
const [running, setRunning] = useState(false);
|
|
24
24
|
const [matchingWords, setMatchingWords] = useState<Word[]>(keywords.map((word) => ({ text: word, matched: false })));
|
|
25
25
|
|
|
@@ -101,7 +101,7 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
101
101
|
<span
|
|
102
102
|
key={index}
|
|
103
103
|
className={mx(
|
|
104
|
-
'px-3 py-1 m-2 rounded border',
|
|
104
|
+
'px-3 py-1 m-2 rounded-sm border',
|
|
105
105
|
word.matched ? 'bg-red-200 text-red-800 border-red-300' : 'bg-gray-200 text-gray-600 border-gray-300',
|
|
106
106
|
)}
|
|
107
107
|
>
|
|
@@ -116,9 +116,9 @@ const DefaultStory = ({ keywords }: StoryProps) => {
|
|
|
116
116
|
};
|
|
117
117
|
|
|
118
118
|
const meta = {
|
|
119
|
-
title: 'plugins/plugin-transcription/KeyWordDetection',
|
|
119
|
+
title: 'plugins/plugin-transcription/components/KeyWordDetection',
|
|
120
120
|
render: DefaultStory,
|
|
121
|
-
decorators: [withTheme, withLayout({
|
|
121
|
+
decorators: [withTheme(), withLayout({ layout: 'column' })],
|
|
122
122
|
} satisfies Meta<typeof DefaultStory>;
|
|
123
123
|
|
|
124
124
|
export default meta;
|