@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.
- package/dist/lib/browser/TranscriptContainer-OQFBAGSP.mjs +11 -0
- package/dist/lib/browser/blueprint-definition-GZ7NOODS.mjs +147 -0
- package/dist/lib/browser/blueprint-definition-GZ7NOODS.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SREIAQSP.mjs → chunk-3MKZ2MNQ.mjs} +5 -5
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KJIQQHJB.mjs → chunk-7GNN7E3U.mjs} +18 -58
- package/dist/lib/browser/chunk-7GNN7E3U.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BJWYA2BU.mjs → chunk-C5YV3JZF.mjs} +91 -135
- package/dist/lib/browser/chunk-C5YV3JZF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UKUSJTQW.mjs → chunk-O33THH53.mjs} +2 -2
- package/dist/lib/browser/chunk-QOSZIUE2.mjs +32 -0
- package/dist/lib/browser/chunk-QOSZIUE2.mjs.map +7 -0
- package/dist/lib/browser/chunk-VBUIO677.mjs +29 -0
- package/dist/lib/browser/chunk-VBUIO677.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +23 -20
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-5CGCLOXB.mjs +25 -0
- package/dist/lib/browser/intent-resolver-5CGCLOXB.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-4MEJMKYQ.mjs → react-surface-OK55WK7J.mjs} +9 -11
- package/dist/lib/browser/react-surface-OK55WK7J.mjs.map +7 -0
- package/dist/lib/browser/{transcriber-V77CN7XX.mjs → transcriber-6YDM5ZDT.mjs} +7 -7
- package/dist/lib/browser/{transcriber-V77CN7XX.mjs.map → transcriber-6YDM5ZDT.mjs.map} +1 -1
- package/dist/lib/browser/types/index.mjs +4 -8
- package/dist/lib/node-esm/{TranscriptContainer-GEUOOYHX.mjs → TranscriptContainer-GM47P6WH.mjs} +4 -4
- package/dist/lib/node-esm/blueprint-definition-GAHQBYTF.mjs +148 -0
- package/dist/lib/node-esm/blueprint-definition-GAHQBYTF.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-A33GNR44.mjs → chunk-5JN2MHYA.mjs} +18 -58
- package/dist/lib/node-esm/chunk-5JN2MHYA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Y7PCJ34K.mjs → chunk-IKGUNN3Z.mjs} +91 -135
- package/dist/lib/node-esm/chunk-IKGUNN3Z.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PHP7MCAY.mjs → chunk-SSYFSLB7.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-TM2ASOZA.mjs → chunk-SWUVPFKR.mjs} +5 -5
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-U4YPUD2F.mjs +33 -0
- package/dist/lib/node-esm/chunk-U4YPUD2F.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs +30 -0
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +23 -20
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-4H4CXIAL.mjs +26 -0
- package/dist/lib/node-esm/intent-resolver-4H4CXIAL.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-EZUPNHUC.mjs → react-surface-EK6K2MMD.mjs} +9 -11
- package/dist/lib/node-esm/react-surface-EK6K2MMD.mjs.map +7 -0
- package/dist/lib/node-esm/{transcriber-3SX3DNLV.mjs → transcriber-CPD3FZ7M.mjs} +7 -7
- package/dist/lib/node-esm/{transcriber-3SX3DNLV.mjs.map → transcriber-CPD3FZ7M.mjs.map} +1 -1
- package/dist/lib/node-esm/types/index.mjs +4 -8
- package/dist/types/src/TranscriptionPlugin.d.ts +1 -1
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/transcriber.d.ts +1 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts +6 -7
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +33 -18
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +3 -3
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +3 -7
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +2 -2
- package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +5 -4
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +10 -6
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +7 -6
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +4 -3
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +3 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/open.d.ts +7 -0
- package/dist/types/src/functions/open.d.ts.map +1 -0
- package/dist/types/src/functions/summarize.d.ts +11 -0
- package/dist/types/src/functions/summarize.d.ts.map +1 -0
- package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/message-normalizer.d.ts +3 -3
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +389 -335
- 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 +6 -6
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +2 -2
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts +6 -10
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/types/TranscriptAction.d.ts +23 -0
- package/dist/types/src/types/TranscriptAction.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +0 -26
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +64 -63
- package/src/TranscriptionPlugin.tsx +58 -54
- package/src/capabilities/blueprint-definition.ts +31 -0
- package/src/capabilities/capabilities.ts +3 -3
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +5 -10
- package/src/capabilities/react-surface.tsx +2 -2
- package/src/components/Transcript/Transcript.stories.tsx +35 -33
- package/src/components/Transcript/Transcript.tsx +21 -29
- package/src/components/Transcript/deprecated/OldTranscript.tsx +7 -7
- package/src/components/Transcript/transcript-extension.ts +11 -44
- package/src/components/TranscriptContainer.tsx +10 -10
- package/src/components/stories/FileTranscription.stories.tsx +48 -37
- package/src/components/stories/KeyWordRecognition.stories.tsx +15 -11
- package/src/components/stories/MicrophoneTranscription.stories.tsx +43 -40
- package/src/components/stories/TranscriptionStory.tsx +14 -11
- package/src/functions/index.ts +6 -0
- package/src/functions/open.ts +38 -0
- package/src/functions/summarize.ts +103 -0
- package/src/hooks/useAudioFile.ts +49 -53
- package/src/hooks/useTranscriber.ts +7 -2
- package/src/meta.ts +7 -4
- package/src/model/model.test.ts +11 -11
- package/src/segments-normalization/message-normalizer.ts +6 -6
- package/src/segments-normalization/normalization.test.ts +6 -6
- package/src/segments-normalization/normalization.ts +7 -7
- package/src/segments-normalization/utils.ts +2 -2
- package/src/testing/testing.ts +25 -20
- package/src/transcriber/transcriber.browser.test.ts +3 -3
- package/src/transcriber/transcriber.ts +3 -3
- package/src/transcriber/transcription-manager.ts +23 -44
- package/src/types/TranscriptAction.ts +23 -0
- package/src/types/index.ts +1 -1
- package/src/types/types.ts +0 -24
- package/dist/lib/browser/TranscriptContainer-FH7VAWYA.mjs +0 -11
- package/dist/lib/browser/chunk-5WH45KBY.mjs +0 -19
- package/dist/lib/browser/chunk-5WH45KBY.mjs.map +0 -7
- package/dist/lib/browser/chunk-BJWYA2BU.mjs.map +0 -7
- package/dist/lib/browser/chunk-KJIQQHJB.mjs.map +0 -7
- package/dist/lib/browser/chunk-KWOOVS5G.mjs +0 -55
- package/dist/lib/browser/chunk-KWOOVS5G.mjs.map +0 -7
- package/dist/lib/browser/chunk-SREIAQSP.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AOVQ7JI4.mjs +0 -30
- package/dist/lib/browser/intent-resolver-AOVQ7JI4.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4MEJMKYQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-A33GNR44.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IKQMDRY6.mjs +0 -56
- package/dist/lib/node-esm/chunk-IKQMDRY6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TM2ASOZA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XMUCZBP3.mjs +0 -21
- package/dist/lib/node-esm/chunk-XMUCZBP3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y7PCJ34K.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-P4XPIKQF.mjs +0 -31
- package/dist/lib/node-esm/intent-resolver-P4XPIKQF.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-EZUPNHUC.mjs.map +0 -7
- package/dist/types/src/types/schema.d.ts +0 -41
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/types/schema.ts +0 -41
- /package/dist/lib/browser/{TranscriptContainer-FH7VAWYA.mjs.map → TranscriptContainer-OQFBAGSP.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-UKUSJTQW.mjs.map → chunk-O33THH53.mjs.map} +0 -0
- /package/dist/lib/node-esm/{TranscriptContainer-GEUOOYHX.mjs.map → TranscriptContainer-GM47P6WH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-PHP7MCAY.mjs.map → chunk-SSYFSLB7.mjs.map} +0 -0
|
@@ -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, useState } from 'react';
|
|
9
7
|
|
|
@@ -11,15 +9,15 @@ import { Events, IntentPlugin, SettingsPlugin } from '@dxos/app-framework';
|
|
|
11
9
|
import { withPluginManager } from '@dxos/app-framework/testing';
|
|
12
10
|
import {
|
|
13
11
|
type ExtractionFunction,
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
extractionAnthropicFunction,
|
|
13
|
+
extractionNerFunction,
|
|
16
14
|
getNer,
|
|
17
15
|
processTranscriptMessage,
|
|
18
16
|
} from '@dxos/assistant/extraction';
|
|
19
17
|
import { Filter, Obj, type Type } from '@dxos/echo';
|
|
18
|
+
import { createQueueDXN } from '@dxos/echo/internal';
|
|
20
19
|
import { MemoryQueue } from '@dxos/echo-db';
|
|
21
|
-
import {
|
|
22
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions';
|
|
20
|
+
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
23
21
|
import { invariant } from '@dxos/invariant';
|
|
24
22
|
import { log } from '@dxos/log';
|
|
25
23
|
import { ClientPlugin } from '@dxos/plugin-client';
|
|
@@ -28,16 +26,17 @@ import { SpacePlugin } from '@dxos/plugin-space';
|
|
|
28
26
|
import { StorybookLayoutPlugin } from '@dxos/plugin-storybook-layout';
|
|
29
27
|
import { ThemePlugin } from '@dxos/plugin-theme';
|
|
30
28
|
import { IndexKind, useSpace } from '@dxos/react-client/echo';
|
|
29
|
+
import { withLayout, withTheme } from '@dxos/react-ui/testing';
|
|
31
30
|
import { defaultTx } from '@dxos/react-ui-theme';
|
|
32
|
-
import {
|
|
33
|
-
import {
|
|
34
|
-
import {
|
|
31
|
+
import { Testing } from '@dxos/schema/testing';
|
|
32
|
+
import { Message, Organization, Person } from '@dxos/types';
|
|
33
|
+
import { seedTestData } from '@dxos/types/testing';
|
|
35
34
|
|
|
36
35
|
import { useAudioTrack, useQueueModelAdapter, useTranscriber } from '../../hooks';
|
|
37
36
|
import { TestItem } from '../../testing';
|
|
38
37
|
import { type MediaStreamRecorderParams, type TranscriberParams } from '../../transcriber';
|
|
39
38
|
import { TranscriptionPlugin } from '../../TranscriptionPlugin';
|
|
40
|
-
import {
|
|
39
|
+
import { renderByline } from '../Transcript';
|
|
41
40
|
|
|
42
41
|
import { TranscriptionStory } from './TranscriptionStory';
|
|
43
42
|
import { useIsSpeaking } from './useIsSpeaking';
|
|
@@ -77,8 +76,8 @@ const DefaultStory = ({
|
|
|
77
76
|
// Queue.
|
|
78
77
|
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
79
78
|
const queueDxn = useMemo(() => createQueueDXN(), []);
|
|
80
|
-
const queue = useMemo(() => new MemoryQueue<
|
|
81
|
-
const model = useQueueModelAdapter(
|
|
79
|
+
const queue = useMemo(() => new MemoryQueue<Message.Message>(queueDxn), [queueDxn]);
|
|
80
|
+
const model = useQueueModelAdapter(renderByline([]), queue);
|
|
82
81
|
const space = useSpace();
|
|
83
82
|
|
|
84
83
|
useEffect(() => {
|
|
@@ -101,14 +100,14 @@ const DefaultStory = ({
|
|
|
101
100
|
if (entityExtraction === 'ner') {
|
|
102
101
|
// Init model loading. Takes time.
|
|
103
102
|
void getNer();
|
|
104
|
-
extractionFunction =
|
|
103
|
+
extractionFunction = extractionNerFunction;
|
|
105
104
|
} else if (entityExtraction === 'llm') {
|
|
106
|
-
extractionFunction =
|
|
105
|
+
extractionFunction = extractionAnthropicFunction;
|
|
107
106
|
objects = space.db
|
|
108
107
|
.query(
|
|
109
108
|
Filter.or(
|
|
110
|
-
Filter.type(
|
|
111
|
-
Filter.type(
|
|
109
|
+
Filter.type(Person.Person),
|
|
110
|
+
Filter.type(Organization.Organization),
|
|
112
111
|
Filter.type(Testing.DocumentType),
|
|
113
112
|
),
|
|
114
113
|
)
|
|
@@ -134,7 +133,7 @@ const DefaultStory = ({
|
|
|
134
133
|
// Transcriber.
|
|
135
134
|
const handleSegments = useCallback<TranscriberParams['onSegments']>(
|
|
136
135
|
async (blocks) => {
|
|
137
|
-
const message = Obj.make(
|
|
136
|
+
const message = Obj.make(Message.Message, {
|
|
138
137
|
sender: { name: 'You' },
|
|
139
138
|
created: new Date().toISOString(),
|
|
140
139
|
blocks,
|
|
@@ -193,16 +192,16 @@ const DefaultStory = ({
|
|
|
193
192
|
return <TranscriptionStory model={model} running={running} onRunningChange={setRunning} />;
|
|
194
193
|
};
|
|
195
194
|
|
|
196
|
-
const meta
|
|
195
|
+
const meta = {
|
|
197
196
|
title: 'plugins/plugin-transcription/MicrophoneTranscription',
|
|
198
197
|
render: DefaultStory,
|
|
199
198
|
decorators: [
|
|
199
|
+
withTheme,
|
|
200
|
+
withLayout({ container: 'column' }),
|
|
200
201
|
withPluginManager({
|
|
201
202
|
plugins: [
|
|
202
|
-
ThemePlugin({ tx: defaultTx }),
|
|
203
|
-
StorybookLayoutPlugin(),
|
|
204
203
|
ClientPlugin({
|
|
205
|
-
types: [TestItem,
|
|
204
|
+
types: [TestItem, Person.Person, Organization.Organization, Testing.DocumentType],
|
|
206
205
|
onClientInitialized: async ({ client }) => {
|
|
207
206
|
await client.halo.createIdentity();
|
|
208
207
|
await client.spaces.waitUntilReady();
|
|
@@ -223,22 +222,24 @@ const meta: Meta<typeof DefaultStory> = {
|
|
|
223
222
|
await seedTestData(client.spaces.default);
|
|
224
223
|
},
|
|
225
224
|
}),
|
|
226
|
-
SpacePlugin(),
|
|
225
|
+
SpacePlugin({}),
|
|
226
|
+
IntentPlugin(),
|
|
227
227
|
SettingsPlugin(),
|
|
228
|
+
|
|
229
|
+
// UI
|
|
230
|
+
ThemePlugin({ tx: defaultTx }),
|
|
228
231
|
PreviewPlugin(),
|
|
229
|
-
IntentPlugin(),
|
|
230
232
|
TranscriptionPlugin(),
|
|
233
|
+
StorybookLayoutPlugin({}),
|
|
231
234
|
],
|
|
232
235
|
fireEvents: [Events.SetupAppGraph],
|
|
233
236
|
}),
|
|
234
|
-
withTheme,
|
|
235
|
-
withLayout({ fullscreen: true, classNames: 'justify-center' }),
|
|
236
237
|
],
|
|
237
|
-
}
|
|
238
|
+
} satisfies Meta<typeof DefaultStory>;
|
|
238
239
|
|
|
239
240
|
export default meta;
|
|
240
241
|
|
|
241
|
-
type Story = StoryObj<typeof
|
|
242
|
+
type Story = StoryObj<typeof meta>;
|
|
242
243
|
|
|
243
244
|
export const Default: Story = {
|
|
244
245
|
args: {
|
|
@@ -254,19 +255,21 @@ export const Default: Story = {
|
|
|
254
255
|
},
|
|
255
256
|
};
|
|
256
257
|
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
}
|
|
258
|
+
// NOTE: We are running out of free quota on hugging face entity extraction.
|
|
259
|
+
// TODO(mykola): Fix hugging face quota issues.
|
|
260
|
+
// export const EntityExtraction: Story = {
|
|
261
|
+
// args: {
|
|
262
|
+
// detectSpeaking: true,
|
|
263
|
+
// entityExtraction: 'ner',
|
|
264
|
+
// transcriberConfig: TRANSCRIBER_CONFIG,
|
|
265
|
+
// recorderConfig: RECORDER_CONFIG,
|
|
266
|
+
// audioConstraints: {
|
|
267
|
+
// echoCancellation: true,
|
|
268
|
+
// noiseSuppression: true,
|
|
269
|
+
// autoGainControl: true,
|
|
270
|
+
// },
|
|
271
|
+
// },
|
|
272
|
+
// };
|
|
270
273
|
|
|
271
274
|
export const SpeechDetection: Story = {
|
|
272
275
|
args: {
|
|
@@ -7,35 +7,38 @@ import '@dxos-theme';
|
|
|
7
7
|
import React, { type Dispatch, type FC, type RefObject, type SetStateAction } from 'react';
|
|
8
8
|
|
|
9
9
|
import { useSpace } from '@dxos/react-client/echo';
|
|
10
|
-
import { IconButton, Toolbar } from '@dxos/react-ui';
|
|
11
|
-
import {
|
|
12
|
-
import { type DataType } from '@dxos/schema';
|
|
10
|
+
import { IconButton, ScrollContainer, Toolbar } from '@dxos/react-ui';
|
|
11
|
+
import { type Message } from '@dxos/types';
|
|
13
12
|
|
|
14
13
|
import { type SerializationModel } from '../../model';
|
|
15
|
-
import {
|
|
14
|
+
import { TranscriptView } from '../Transcript';
|
|
16
15
|
|
|
17
16
|
export const TranscriptionStory: FC<{
|
|
18
|
-
model: SerializationModel<
|
|
17
|
+
model: SerializationModel<Message.Message>;
|
|
18
|
+
disabled?: boolean;
|
|
19
19
|
running: boolean;
|
|
20
20
|
onRunningChange: Dispatch<SetStateAction<boolean>>;
|
|
21
|
-
audioRef?: RefObject<HTMLAudioElement>;
|
|
22
|
-
}> = ({ model, running, onRunningChange, audioRef }) => {
|
|
21
|
+
audioRef?: RefObject<HTMLAudioElement | null>;
|
|
22
|
+
}> = ({ model, running, onRunningChange, audioRef, disabled }) => {
|
|
23
23
|
const space = useSpace();
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
|
-
<div className='flex flex-col
|
|
26
|
+
<div className='flex flex-col is-[30rem]'>
|
|
27
27
|
{audioRef && <audio ref={audioRef} autoPlay />}
|
|
28
28
|
<Toolbar.Root>
|
|
29
29
|
<IconButton
|
|
30
30
|
iconOnly
|
|
31
|
+
disabled={disabled}
|
|
31
32
|
icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
|
|
32
33
|
label={running ? 'Pause' : 'Play'}
|
|
33
34
|
onClick={() => onRunningChange((running) => !running)}
|
|
34
35
|
/>
|
|
35
36
|
</Toolbar.Root>
|
|
36
|
-
<ScrollContainer>
|
|
37
|
-
<
|
|
38
|
-
|
|
37
|
+
<ScrollContainer.Root pin>
|
|
38
|
+
<ScrollContainer.Viewport>
|
|
39
|
+
<TranscriptView space={space} model={model} />
|
|
40
|
+
</ScrollContainer.Viewport>
|
|
41
|
+
</ScrollContainer.Root>
|
|
39
42
|
</div>
|
|
40
43
|
);
|
|
41
44
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
6
|
+
import * as Schema from 'effect/Schema';
|
|
7
|
+
|
|
8
|
+
import { ArtifactId } from '@dxos/assistant';
|
|
9
|
+
import { Obj } from '@dxos/echo';
|
|
10
|
+
import { DatabaseService, QueueService, defineFunction } from '@dxos/functions';
|
|
11
|
+
import { Message, Transcript } from '@dxos/types';
|
|
12
|
+
|
|
13
|
+
import { renderByline } from '../components';
|
|
14
|
+
|
|
15
|
+
export default defineFunction({
|
|
16
|
+
key: 'dxos.org/function/transcription/open',
|
|
17
|
+
name: 'Open',
|
|
18
|
+
description: 'Opens and reads the contents of a transcription object.',
|
|
19
|
+
inputSchema: Schema.Struct({
|
|
20
|
+
id: ArtifactId.annotations({
|
|
21
|
+
description: 'The ID of the transcription object.',
|
|
22
|
+
}),
|
|
23
|
+
}),
|
|
24
|
+
outputSchema: Schema.Struct({
|
|
25
|
+
content: Schema.String,
|
|
26
|
+
}),
|
|
27
|
+
handler: Effect.fn(function* ({ data: { id } }) {
|
|
28
|
+
const transcript = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Transcript.Transcript);
|
|
29
|
+
const { dxn } = yield* Effect.promise(() => transcript.queue.load());
|
|
30
|
+
const queue = yield* QueueService.getQueue(dxn);
|
|
31
|
+
yield* Effect.promise(() => queue?.queryObjects());
|
|
32
|
+
const content = queue?.objects
|
|
33
|
+
.filter((message) => Obj.instanceOf(Message.Message, message))
|
|
34
|
+
.flatMap((message, index) => renderByline([])(message, index))
|
|
35
|
+
.join('\n\n');
|
|
36
|
+
return { content };
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import * as Array from 'effect/Array';
|
|
6
|
+
import * as Effect from 'effect/Effect';
|
|
7
|
+
import * as Function from 'effect/Function';
|
|
8
|
+
import * as Layer from 'effect/Layer';
|
|
9
|
+
import * as Option from 'effect/Option';
|
|
10
|
+
import * as Schema from 'effect/Schema';
|
|
11
|
+
|
|
12
|
+
import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
13
|
+
import { AiSession, GenerationObserver } from '@dxos/assistant';
|
|
14
|
+
import { TracingService, defineFunction } from '@dxos/functions';
|
|
15
|
+
import { trim } from '@dxos/util';
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Summarize a transcript of a meeting.
|
|
19
|
+
*/
|
|
20
|
+
export default defineFunction({
|
|
21
|
+
key: 'dxos.org/function/transcription/summarize',
|
|
22
|
+
name: 'Summarize',
|
|
23
|
+
description: 'Summarize a transcript of a meeting.',
|
|
24
|
+
inputSchema: Schema.Struct({
|
|
25
|
+
transcript: Schema.String.annotations({
|
|
26
|
+
description: 'The transcript of the meeting.',
|
|
27
|
+
}),
|
|
28
|
+
notes: Schema.optional(Schema.String).annotations({
|
|
29
|
+
description: 'Additional notes from the participants.',
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
outputSchema: Schema.Struct({
|
|
33
|
+
summary: Schema.String.annotations({
|
|
34
|
+
description: 'The summary of the transcript.',
|
|
35
|
+
}),
|
|
36
|
+
}),
|
|
37
|
+
handler: Effect.fnUntraced(
|
|
38
|
+
function* ({ data: { transcript, notes } }) {
|
|
39
|
+
const result = yield* new AiSession().run({
|
|
40
|
+
prompt: `Transcript: ${transcript}\n\nNotes: ${notes}`,
|
|
41
|
+
history: [],
|
|
42
|
+
system: systemPrompt,
|
|
43
|
+
observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'summarize' })),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const summary = Function.pipe(
|
|
47
|
+
result,
|
|
48
|
+
Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
|
|
49
|
+
Option.flatMap((msg) =>
|
|
50
|
+
Function.pipe(
|
|
51
|
+
msg.blocks,
|
|
52
|
+
Array.findLast((block) => block._tag === 'text'),
|
|
53
|
+
Option.map((block) => block.text),
|
|
54
|
+
),
|
|
55
|
+
),
|
|
56
|
+
Option.getOrThrowWith(() => new Error('No summary found')),
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
return { summary };
|
|
60
|
+
},
|
|
61
|
+
Effect.provide(
|
|
62
|
+
Layer.mergeAll(
|
|
63
|
+
AiService.model('@anthropic/claude-sonnet-4-0'),
|
|
64
|
+
ToolResolverService.layerEmpty,
|
|
65
|
+
ToolExecutionService.layerEmpty,
|
|
66
|
+
TracingService.layerNoop,
|
|
67
|
+
),
|
|
68
|
+
),
|
|
69
|
+
),
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const systemPrompt = trim`
|
|
73
|
+
You are a helpful assistant that summarizes transcripts of meetings.
|
|
74
|
+
|
|
75
|
+
# Goal
|
|
76
|
+
Create a markdown summary of the meeting transcript with text notes provided.
|
|
77
|
+
Notes are very important so make sure to include them in the summary if they contain meaningful information.
|
|
78
|
+
|
|
79
|
+
# Formatting
|
|
80
|
+
- Format the summary as a markdown document without extra comments like "Here is the summary of the transcript:".
|
|
81
|
+
- Use markdown formatting for headings and bullet points.
|
|
82
|
+
- Format the summary as a list of key points and takeaways.
|
|
83
|
+
- All names of people should be in bold.
|
|
84
|
+
|
|
85
|
+
# Note Taking
|
|
86
|
+
- Correlate items in the summary with the person of origin to build a coherent narrative.
|
|
87
|
+
- Include short quotes verbatim where appropriate. Especially when concerned with design decisions and problem descriptions.
|
|
88
|
+
|
|
89
|
+
# Tasks
|
|
90
|
+
At the end of the summary include tasks.
|
|
91
|
+
Extract only the tasks that are:
|
|
92
|
+
- Directly actionable.
|
|
93
|
+
- Clearly assigned to a person or team (or can easily be inferred).
|
|
94
|
+
- Strongly implied by the conversation and/or user note (no speculative tasks).
|
|
95
|
+
- Specific enough that someone reading them would know exactly what to do next.
|
|
96
|
+
|
|
97
|
+
Format all tasks as markdown checkboxes using the syntax:
|
|
98
|
+
- [ ] Task description.
|
|
99
|
+
|
|
100
|
+
Additional information can be included (indented).
|
|
101
|
+
|
|
102
|
+
If no actionable tasks are found, omit this tasks section.
|
|
103
|
+
`;
|
|
@@ -20,67 +20,63 @@ export const useAudioFile = (audioUrl: string, constraints?: MediaTrackConstrain
|
|
|
20
20
|
const ctx = new Context();
|
|
21
21
|
|
|
22
22
|
scheduleTask(ctx, async () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
URL.
|
|
28
|
-
|
|
23
|
+
// TODO(wittjosiah): Fetch to external url fails in headless storybook test.
|
|
24
|
+
try {
|
|
25
|
+
const response = await fetch(audioUrl);
|
|
26
|
+
const blob = await response.blob();
|
|
27
|
+
const objectUrl = URL.createObjectURL(blob);
|
|
28
|
+
ctx.onDispose(() => {
|
|
29
|
+
URL.revokeObjectURL(objectUrl);
|
|
30
|
+
});
|
|
29
31
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
const audio = new Audio();
|
|
33
|
+
audio.src = objectUrl;
|
|
32
34
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
log.info('starting...');
|
|
46
|
-
try {
|
|
47
|
-
// Try to play the audio
|
|
48
|
-
await audio.play();
|
|
35
|
+
await new Promise<void>((resolve, reject) => {
|
|
36
|
+
audio.addEventListener(
|
|
37
|
+
'error',
|
|
38
|
+
(err) => {
|
|
39
|
+
log.error('error', { err });
|
|
40
|
+
reject(err);
|
|
41
|
+
},
|
|
42
|
+
{ once: true },
|
|
43
|
+
);
|
|
44
|
+
audio.addEventListener(
|
|
45
|
+
'canplay',
|
|
46
|
+
async () => {
|
|
49
47
|
resolve();
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
{ once: true },
|
|
57
|
-
);
|
|
58
|
-
audio.load();
|
|
59
|
-
});
|
|
48
|
+
},
|
|
49
|
+
{ once: true },
|
|
50
|
+
);
|
|
51
|
+
audio.load();
|
|
52
|
+
});
|
|
60
53
|
|
|
61
|
-
|
|
54
|
+
const audioCtx = new AudioContext();
|
|
62
55
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
56
|
+
// Resume AudioContext if it's suspended.
|
|
57
|
+
if (audioCtx.state === 'suspended') {
|
|
58
|
+
await audioCtx.resume();
|
|
59
|
+
}
|
|
67
60
|
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
const destination = audioCtx.createMediaStreamDestination();
|
|
62
|
+
destination.channelCount = 1;
|
|
70
63
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
const source = audioCtx.createMediaElementSource(audio);
|
|
65
|
+
source.connect(destination);
|
|
66
|
+
const track = destination.stream.getAudioTracks()[0];
|
|
67
|
+
if (constraints) {
|
|
68
|
+
await track.applyConstraints(constraints).catch((err) => log.catch(err));
|
|
69
|
+
}
|
|
77
70
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
71
|
+
// Also connect to speakers so audio is audible.
|
|
72
|
+
setStream({
|
|
73
|
+
audio,
|
|
74
|
+
stream: destination.stream,
|
|
75
|
+
track: destination.stream.getAudioTracks()[0],
|
|
76
|
+
});
|
|
77
|
+
} catch (err) {
|
|
78
|
+
log.catch(err);
|
|
79
|
+
}
|
|
84
80
|
});
|
|
85
81
|
|
|
86
82
|
return () => {
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import { useEffect, useMemo } from 'react';
|
|
6
6
|
|
|
7
|
-
import { useCapabilities } from '@dxos/app-framework';
|
|
7
|
+
import { useCapabilities } from '@dxos/app-framework/react';
|
|
8
8
|
|
|
9
9
|
import { TranscriptionCapabilities } from '../capabilities';
|
|
10
10
|
import { type Transcriber } from '../transcriber';
|
|
@@ -26,7 +26,12 @@ export const useTranscriber = ({
|
|
|
26
26
|
return undefined;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
return getTranscriber({
|
|
29
|
+
return getTranscriber({
|
|
30
|
+
audioStreamTrack,
|
|
31
|
+
recorderConfig,
|
|
32
|
+
transcriberConfig,
|
|
33
|
+
onSegments,
|
|
34
|
+
});
|
|
30
35
|
}, [getTranscriber, audioStreamTrack, recorderConfig, transcriberConfig, onSegments]);
|
|
31
36
|
|
|
32
37
|
useEffect(() => {
|
package/src/meta.ts
CHANGED
|
@@ -3,14 +3,17 @@
|
|
|
3
3
|
//
|
|
4
4
|
|
|
5
5
|
import { type PluginMeta } from '@dxos/app-framework';
|
|
6
|
-
|
|
7
|
-
export const TRANSCRIPTION_PLUGIN = 'dxos.org/plugin/transcription';
|
|
6
|
+
import { trim } from '@dxos/util';
|
|
8
7
|
|
|
9
8
|
export const meta: PluginMeta = {
|
|
10
|
-
id:
|
|
9
|
+
id: 'dxos.org/plugin/transcription',
|
|
11
10
|
name: 'Transcription',
|
|
12
|
-
description:
|
|
11
|
+
description: trim`
|
|
12
|
+
Real-time voice-to-text transcription service for capturing spoken content.
|
|
13
|
+
Convert audio input into searchable text that integrates seamlessly with notes and documents.
|
|
14
|
+
`,
|
|
13
15
|
icon: 'ph--microphone--regular',
|
|
16
|
+
iconHue: 'sky',
|
|
14
17
|
source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transcription',
|
|
15
18
|
tags: ['labs'],
|
|
16
19
|
screenshots: [],
|
package/src/model/model.test.ts
CHANGED
|
@@ -7,12 +7,12 @@ import { describe, test } from 'vitest';
|
|
|
7
7
|
|
|
8
8
|
import { Obj } from '@dxos/echo';
|
|
9
9
|
import type { ObjectId } from '@dxos/keys';
|
|
10
|
-
import {
|
|
10
|
+
import { Message } from '@dxos/types';
|
|
11
11
|
|
|
12
12
|
import { type ChunkRenderer, DocumentAdapter, SerializationModel } from './model';
|
|
13
13
|
|
|
14
|
-
const blockToMarkdown: ChunkRenderer<
|
|
15
|
-
message:
|
|
14
|
+
const blockToMarkdown: ChunkRenderer<Message.Message> = (
|
|
15
|
+
message: Message.Message,
|
|
16
16
|
index: number,
|
|
17
17
|
debug = true,
|
|
18
18
|
): string[] => {
|
|
@@ -27,12 +27,12 @@ const createDate = () => new Date().toISOString();
|
|
|
27
27
|
|
|
28
28
|
describe('SerializationModel', () => {
|
|
29
29
|
test('basic', ({ expect }) => {
|
|
30
|
-
const model = new SerializationModel<
|
|
30
|
+
const model = new SerializationModel<Message.Message>(blockToMarkdown);
|
|
31
31
|
expect(model.chunks.length).to.eq(0);
|
|
32
32
|
expect(model.doc.toString()).to.eq('');
|
|
33
33
|
|
|
34
34
|
// Create message.
|
|
35
|
-
const message = Obj.make(
|
|
35
|
+
const message = Obj.make(Message.Message, {
|
|
36
36
|
created: createDate(),
|
|
37
37
|
sender: { name: 'Alice' },
|
|
38
38
|
blocks: [
|
|
@@ -62,14 +62,14 @@ describe('SerializationModel', () => {
|
|
|
62
62
|
|
|
63
63
|
test('sync - append', ({ expect }) => {
|
|
64
64
|
const view = new EditorView({ extensions: [], doc: '' });
|
|
65
|
-
const model = new SerializationModel<
|
|
65
|
+
const model = new SerializationModel<Message.Message>(blockToMarkdown);
|
|
66
66
|
const adapter = new DocumentAdapter(view);
|
|
67
67
|
expect(adapter.lineCount()).to.eq(0);
|
|
68
68
|
expect(view.state.doc.toString()).to.eq('');
|
|
69
69
|
|
|
70
70
|
// Append message.
|
|
71
71
|
{
|
|
72
|
-
const message = Obj.make(
|
|
72
|
+
const message = Obj.make(Message.Message, {
|
|
73
73
|
created: createDate(),
|
|
74
74
|
sender: { name: 'Alice' },
|
|
75
75
|
blocks: [
|
|
@@ -87,7 +87,7 @@ describe('SerializationModel', () => {
|
|
|
87
87
|
|
|
88
88
|
// Append message.
|
|
89
89
|
{
|
|
90
|
-
const message = Obj.make(
|
|
90
|
+
const message = Obj.make(Message.Message, {
|
|
91
91
|
created: createDate(),
|
|
92
92
|
sender: { name: 'Bob' },
|
|
93
93
|
blocks: [
|
|
@@ -106,7 +106,7 @@ describe('SerializationModel', () => {
|
|
|
106
106
|
|
|
107
107
|
test('sync - append, update, delete', ({ expect }) => {
|
|
108
108
|
const view = new EditorView({ extensions: [], doc: '' });
|
|
109
|
-
const model = new SerializationModel<
|
|
109
|
+
const model = new SerializationModel<Message.Message>(blockToMarkdown);
|
|
110
110
|
const adapter = new DocumentAdapter(view);
|
|
111
111
|
expect(adapter.lineCount()).to.eq(0);
|
|
112
112
|
|
|
@@ -114,7 +114,7 @@ describe('SerializationModel', () => {
|
|
|
114
114
|
|
|
115
115
|
// Append message.
|
|
116
116
|
{
|
|
117
|
-
const message = Obj.make(
|
|
117
|
+
const message = Obj.make(Message.Message, {
|
|
118
118
|
created: createDate(),
|
|
119
119
|
sender: { name: 'Alice' },
|
|
120
120
|
blocks: [
|
|
@@ -147,7 +147,7 @@ describe('SerializationModel', () => {
|
|
|
147
147
|
|
|
148
148
|
// Append message.
|
|
149
149
|
{
|
|
150
|
-
const message = Obj.make(
|
|
150
|
+
const message = Obj.make(Message.Message, {
|
|
151
151
|
created: createDate(),
|
|
152
152
|
sender: { name: 'Bob' },
|
|
153
153
|
blocks: [{ _tag: 'transcript', started: createDate(), text: 'Hello again!' }],
|
|
@@ -11,11 +11,11 @@ import { effect } from '@preact/signals-core';
|
|
|
11
11
|
import { DeferredTask, asyncTimeout } from '@dxos/async';
|
|
12
12
|
import { LifecycleState, Resource } from '@dxos/context';
|
|
13
13
|
import { type Queue } from '@dxos/echo-db';
|
|
14
|
-
import { type FunctionExecutor } from '@dxos/functions';
|
|
14
|
+
import { type FunctionExecutor } from '@dxos/functions-runtime';
|
|
15
15
|
import { log } from '@dxos/log';
|
|
16
|
-
import { type
|
|
16
|
+
import { type Message } from '@dxos/types';
|
|
17
17
|
|
|
18
|
-
import { type MessageWithRangeId, sentenceNormalization } from './normalization';
|
|
18
|
+
import { type MessageWithRangeId, type NormalizationOutput, sentenceNormalization } from './normalization';
|
|
19
19
|
import { getActorId } from './utils';
|
|
20
20
|
|
|
21
21
|
const PROCESSING_TIMEOUT = 20_000; // ms
|
|
@@ -23,7 +23,7 @@ const MAX_RANGE_ID_COUNT = 10;
|
|
|
23
23
|
|
|
24
24
|
export type SegmentsNormalizerParams = {
|
|
25
25
|
functionExecutor: FunctionExecutor;
|
|
26
|
-
queue: Queue<
|
|
26
|
+
queue: Queue<Message.Message>;
|
|
27
27
|
startingCursor: QueueCursor;
|
|
28
28
|
};
|
|
29
29
|
|
|
@@ -36,7 +36,7 @@ export type QueueCursor = {
|
|
|
36
36
|
// TODO(mykola): .
|
|
37
37
|
export class MessageNormalizer extends Resource {
|
|
38
38
|
private readonly _functionExecutor: FunctionExecutor;
|
|
39
|
-
private _queue: Queue<
|
|
39
|
+
private _queue: Queue<Message.Message>;
|
|
40
40
|
private _cursor: QueueCursor;
|
|
41
41
|
private _messagesToProcess: MessageWithRangeId[] = [];
|
|
42
42
|
private _normalizationTask?: DeferredTask;
|
|
@@ -81,7 +81,7 @@ export class MessageNormalizer extends Resource {
|
|
|
81
81
|
|
|
82
82
|
try {
|
|
83
83
|
// TODO(mykola): Executor should support timeout.
|
|
84
|
-
const response = await asyncTimeout(
|
|
84
|
+
const response: NormalizationOutput = await asyncTimeout(
|
|
85
85
|
this._functionExecutor.invoke(sentenceNormalization, { messages }),
|
|
86
86
|
PROCESSING_TIMEOUT,
|
|
87
87
|
);
|