@dxos/plugin-transcription 0.8.4-main.72ec0f3 → 0.8.4-main.74a063c4e0
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-5LWSJZTZ.mjs +17 -0
- package/dist/lib/browser/chunk-5LWSJZTZ.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/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-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/chunk-X74WYCCE.mjs +19 -0
- package/dist/lib/node-esm/chunk-X74WYCCE.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/{Transcript/Transcript.stories.d.ts → Transcription/Transcription.stories.d.ts} +13 -12
- 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/{Transcript/transcript-extension.d.ts → Transcription/transcription-extension.d.ts} +3 -3
- 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.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 +2 -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/hooks/useVoiceInput.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 +2 -2
- 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/testing/testing.d.ts +4 -4
- 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 +2 -2
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts +6 -3
- 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 -72
- 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 -14
- package/src/capabilities/transcriber.ts +52 -43
- package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +52 -48
- package/src/components/Transcription/Transcription.tsx +64 -0
- package/src/components/{Transcript → Transcription}/index.ts +1 -1
- package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +4 -4
- package/src/components/index.ts +1 -6
- package/src/components/stories/FileTranscription.stories.tsx +26 -33
- package/src/components/stories/KeyWordRecognition.stories.tsx +7 -7
- package/src/components/stories/MicrophoneTranscription.stories.tsx +50 -72
- package/src/components/stories/TranscriptionStory.tsx +7 -8
- package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +33 -0
- package/src/containers/TranscriptionContainer/index.ts +5 -0
- package/src/containers/index.ts +7 -0
- package/src/hooks/useQueueModelAdapter.ts +1 -1
- package/src/hooks/useTranscriber.ts +3 -2
- package/src/hooks/useVoiceInput.ts +2 -3
- package/src/index.ts +1 -1
- package/src/meta.ts +3 -3
- package/src/model/model.test.ts +9 -3
- 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 +12 -7
- package/src/segments-normalization/normalization.test.ts +2 -7
- package/src/segments-normalization/normalization.ts +33 -71
- package/src/testing/testing.ts +17 -22
- package/src/transcriber/media-stream-recorder.ts +3 -3
- package/src/transcriber/transcriber.browser.test.ts +1 -2
- package/src/transcriber/transcriber.ts +5 -5
- package/src/transcriber/transcription-manager.ts +15 -9
- package/src/translations.ts +7 -7
- package/src/{capabilities → types}/capabilities.ts +11 -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-EKSP5DQ6.mjs +0 -11
- package/dist/lib/browser/blueprint-definition-WBWHO4OH.mjs +0 -150
- package/dist/lib/browser/blueprint-definition-WBWHO4OH.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-EHT3TE6U.mjs +0 -738
- package/dist/lib/browser/chunk-EHT3TE6U.mjs.map +0 -7
- package/dist/lib/browser/chunk-OCI42DWB.mjs +0 -8
- package/dist/lib/browser/chunk-OCI42DWB.mjs.map +0 -7
- package/dist/lib/browser/chunk-PVU4XCKI.mjs +0 -466
- package/dist/lib/browser/chunk-PVU4XCKI.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/intent-resolver-ZTKTEAQX.mjs +0 -25
- package/dist/lib/browser/intent-resolver-ZTKTEAQX.mjs.map +0 -7
- package/dist/lib/browser/react-surface-NARMYO2O.mjs +0 -34
- package/dist/lib/browser/react-surface-NARMYO2O.mjs.map +0 -7
- package/dist/lib/browser/transcriber-E2KAOXPS.mjs +0 -56
- package/dist/lib/browser/transcriber-E2KAOXPS.mjs.map +0 -7
- package/dist/lib/node-esm/TranscriptContainer-WU3EDQR3.mjs +0 -12
- package/dist/lib/node-esm/blueprint-definition-WUHZFRWZ.mjs +0 -151
- package/dist/lib/node-esm/blueprint-definition-WUHZFRWZ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-7XASA7DX.mjs +0 -739
- package/dist/lib/node-esm/chunk-7XASA7DX.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-SWUVPFKR.mjs +0 -17
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-UVOYXXDJ.mjs +0 -467
- package/dist/lib/node-esm/chunk-UVOYXXDJ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-X5BKN32O.mjs +0 -10
- package/dist/lib/node-esm/chunk-X5BKN32O.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-5MQA3IUS.mjs +0 -35
- package/dist/lib/node-esm/react-surface-5MQA3IUS.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-ZPJM4U2W.mjs +0 -57
- package/dist/lib/node-esm/transcriber-ZPJM4U2W.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.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.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 -94
- package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
- package/src/components/TranscriptContainer.tsx +0 -37
- 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-EKSP5DQ6.mjs.map → chunk-J5LGTIGS.mjs.map} +0 -0
- /package/dist/lib/node-esm/{TranscriptContainer-WU3EDQR3.mjs.map → chunk-HSLMI22Q.mjs.map} +0 -0
|
@@ -7,67 +7,61 @@ import * as Effect from 'effect/Effect';
|
|
|
7
7
|
import * as Function from 'effect/Function';
|
|
8
8
|
import * as Layer from 'effect/Layer';
|
|
9
9
|
import * as Option from 'effect/Option';
|
|
10
|
-
import * as Schema from 'effect/Schema';
|
|
11
10
|
|
|
12
11
|
import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';
|
|
13
12
|
import { AiSession, GenerationObserver } from '@dxos/assistant';
|
|
14
|
-
import {
|
|
13
|
+
import { FunctionInvocationService, TracingService } from '@dxos/functions';
|
|
14
|
+
import * as Trace from '@dxos/functions/Trace';
|
|
15
|
+
import { Operation } from '@dxos/operation';
|
|
15
16
|
import { trim } from '@dxos/util';
|
|
16
17
|
|
|
18
|
+
import { Summarize } from './definitions';
|
|
19
|
+
|
|
17
20
|
/**
|
|
18
21
|
* Summarize a transcript of a meeting.
|
|
19
22
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
});
|
|
23
|
+
const handler: Operation.WithHandler<typeof Summarize> = Summarize.pipe(
|
|
24
|
+
Operation.withHandler(
|
|
25
|
+
Effect.fnUntraced(
|
|
26
|
+
function* ({ transcript, notes }) {
|
|
27
|
+
const result = yield* new AiSession({
|
|
28
|
+
observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'summarize' })),
|
|
29
|
+
}).run({
|
|
30
|
+
prompt: `Transcript: ${transcript}\n\nNotes: ${notes}`,
|
|
31
|
+
history: [],
|
|
32
|
+
system: systemPrompt,
|
|
33
|
+
});
|
|
45
34
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
35
|
+
const summary = Function.pipe(
|
|
36
|
+
result,
|
|
37
|
+
Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
|
|
38
|
+
Option.flatMap((msg) =>
|
|
39
|
+
Function.pipe(
|
|
40
|
+
msg.blocks,
|
|
41
|
+
Array.findLast((block) => block._tag === 'text'),
|
|
42
|
+
Option.map((block) => block.text),
|
|
43
|
+
),
|
|
54
44
|
),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
);
|
|
45
|
+
Option.getOrThrowWith(() => new Error('No summary found')),
|
|
46
|
+
);
|
|
58
47
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
48
|
+
return { summary };
|
|
49
|
+
},
|
|
50
|
+
Effect.provide(
|
|
51
|
+
Layer.mergeAll(
|
|
52
|
+
AiService.model('@anthropic/claude-sonnet-4-0'),
|
|
53
|
+
ToolResolverService.layerEmpty,
|
|
54
|
+
ToolExecutionService.layerEmpty,
|
|
55
|
+
TracingService.layerNoop,
|
|
56
|
+
FunctionInvocationService.layerNotAvailable,
|
|
57
|
+
Trace.writerLayerNoop,
|
|
58
|
+
),
|
|
67
59
|
),
|
|
68
60
|
),
|
|
69
61
|
),
|
|
70
|
-
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
export default handler;
|
|
71
65
|
|
|
72
66
|
const systemPrompt = trim`
|
|
73
67
|
You are a helpful assistant that summarizes transcripts of meetings.
|
|
@@ -6,8 +6,6 @@
|
|
|
6
6
|
// Copyright 2025 DXOS.org
|
|
7
7
|
//
|
|
8
8
|
|
|
9
|
-
import { effect } from '@preact/signals-core';
|
|
10
|
-
|
|
11
9
|
import { DeferredTask, asyncTimeout } from '@dxos/async';
|
|
12
10
|
import { LifecycleState, Resource } from '@dxos/context';
|
|
13
11
|
import { type Queue } from '@dxos/echo-db';
|
|
@@ -21,7 +19,7 @@ import { getActorId } from './utils';
|
|
|
21
19
|
const PROCESSING_TIMEOUT = 20_000; // ms
|
|
22
20
|
const MAX_RANGE_ID_COUNT = 10;
|
|
23
21
|
|
|
24
|
-
export type
|
|
22
|
+
export type SegmentsNormalizerProps = {
|
|
25
23
|
functionExecutor: FunctionExecutor;
|
|
26
24
|
queue: Queue<Message.Message>;
|
|
27
25
|
startingCursor: QueueCursor;
|
|
@@ -42,7 +40,7 @@ export class MessageNormalizer extends Resource {
|
|
|
42
40
|
private _normalizationTask?: DeferredTask;
|
|
43
41
|
private _lastProcessedMessageIds?: string[];
|
|
44
42
|
|
|
45
|
-
constructor({ functionExecutor, queue, startingCursor }:
|
|
43
|
+
constructor({ functionExecutor, queue, startingCursor }: SegmentsNormalizerProps) {
|
|
46
44
|
super();
|
|
47
45
|
this._functionExecutor = functionExecutor;
|
|
48
46
|
this._queue = queue;
|
|
@@ -51,7 +49,8 @@ export class MessageNormalizer extends Resource {
|
|
|
51
49
|
|
|
52
50
|
protected override async _open(): Promise<void> {
|
|
53
51
|
this._normalizationTask = new DeferredTask(this._ctx, () => this._processMessages());
|
|
54
|
-
|
|
52
|
+
|
|
53
|
+
const updateMessages = () => {
|
|
55
54
|
if (this._lifecycleState !== LifecycleState.OPEN) {
|
|
56
55
|
return;
|
|
57
56
|
}
|
|
@@ -62,8 +61,14 @@ export class MessageNormalizer extends Resource {
|
|
|
62
61
|
});
|
|
63
62
|
|
|
64
63
|
this._normalizationTask!.schedule();
|
|
65
|
-
}
|
|
66
|
-
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// Initial update.
|
|
67
|
+
updateMessages();
|
|
68
|
+
|
|
69
|
+
// Subscribe to queue changes.
|
|
70
|
+
const unsubscribe = this._queue.subscribe(updateMessages);
|
|
71
|
+
this._ctx.onDispose(unsubscribe);
|
|
67
72
|
}
|
|
68
73
|
|
|
69
74
|
// Need to unpack strings from blocks from messages run them through the function and then pack them back into blocks into messages.
|
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import { effect } from '@preact/signals-core';
|
|
6
5
|
import { describe, test } from 'vitest';
|
|
7
6
|
|
|
8
7
|
import { scheduleTaskInterval } from '@dxos/async';
|
|
9
8
|
import { Context } from '@dxos/context';
|
|
10
9
|
import { Obj } from '@dxos/echo';
|
|
11
|
-
import { createQueueDXN } from '@dxos/echo/internal';
|
|
12
10
|
import { MemoryQueue } from '@dxos/echo-db';
|
|
11
|
+
import { createQueueDXN } from '@dxos/echo/internal';
|
|
13
12
|
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
14
13
|
import { log } from '@dxos/log';
|
|
15
14
|
import { type Actor, Message } from '@dxos/types';
|
|
@@ -99,7 +98,7 @@ describe.skip('SentenceNormalization', () => {
|
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
log.info('sentences', {
|
|
102
|
-
|
|
101
|
+
messages: JSON.stringify(messages, null, 2),
|
|
103
102
|
sentences: JSON.stringify(sentences, null, 2),
|
|
104
103
|
});
|
|
105
104
|
throw new Error('test');
|
|
@@ -133,10 +132,6 @@ describe.skip('SentenceNormalization', () => {
|
|
|
133
132
|
|
|
134
133
|
// Start normalizer.
|
|
135
134
|
await normalizer.open();
|
|
136
|
-
effect(() => {
|
|
137
|
-
log.info('normalizer');
|
|
138
|
-
log.info(JSON.stringify(queue.objects, null, 2));
|
|
139
|
-
});
|
|
140
135
|
|
|
141
136
|
await new Promise(() => {});
|
|
142
137
|
});
|
|
@@ -2,85 +2,47 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
// @ts-nocheck
|
|
7
|
-
|
|
5
|
+
import * as Effect from 'effect/Effect';
|
|
8
6
|
import * as Schema from 'effect/Schema';
|
|
9
7
|
|
|
10
|
-
import { AiService, DEFAULT_EDGE_MODEL } from '@dxos/ai';
|
|
11
|
-
import { AiSession } from '@dxos/assistant';
|
|
12
|
-
import { Obj } from '@dxos/echo';
|
|
13
|
-
import { defineFunction } from '@dxos/functions';
|
|
14
|
-
import { ObjectId } from '@dxos/keys';
|
|
15
8
|
import { log } from '@dxos/log';
|
|
16
|
-
import {
|
|
9
|
+
import { Operation } from '@dxos/operation';
|
|
17
10
|
import { trim } from '@dxos/util';
|
|
18
11
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
12
|
+
import {
|
|
13
|
+
SentenceNormalization,
|
|
14
|
+
SentenceNormalizationOutput,
|
|
15
|
+
type MessageWithRangeIdType,
|
|
16
|
+
type SentenceNormalizationInputType,
|
|
17
|
+
} from '../operations/definitions';
|
|
18
|
+
|
|
19
|
+
export type MessageWithRangeId = MessageWithRangeIdType;
|
|
20
|
+
|
|
21
|
+
/** @deprecated Use SentenceNormalizationInputType */
|
|
22
|
+
export type NormalizationInput = SentenceNormalizationInputType;
|
|
23
|
+
|
|
24
|
+
/** @deprecated Use SentenceNormalizationOutput */
|
|
25
|
+
export type NormalizationOutput = Schema.Schema.Type<typeof SentenceNormalizationOutput>;
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Sentence normalization for transcription.
|
|
29
|
+
* TODO(dmaretskyi): Reimplement using AiSession.run or LanguageModel.generateObject - runStructured was removed.
|
|
30
|
+
*/
|
|
31
|
+
export const sentenceNormalization = SentenceNormalization.pipe(
|
|
32
|
+
Operation.withHandler(
|
|
33
|
+
Effect.fn(function* ({ messages }) {
|
|
34
|
+
log.info('input', { messages });
|
|
35
|
+
// TODO(dmaretskyi): runStructured was removed from AiSession. Reimplement using new API.
|
|
36
|
+
return yield* Effect.die(
|
|
37
|
+
new Error(
|
|
38
|
+
'Sentence normalization needs to be reimplemented - runStructured was removed from AiSession. Use AiSession.run or LanguageModel.generateObject.',
|
|
39
|
+
),
|
|
40
|
+
);
|
|
25
41
|
}),
|
|
26
|
-
|
|
42
|
+
),
|
|
27
43
|
);
|
|
28
44
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
export const NormalizationInput = Schema.Struct({
|
|
32
|
-
// TODO(mykola): Move to meta in Message. Use `Message.Message` instead.
|
|
33
|
-
messages: Schema.Array(MessageWithRangeId).annotations({
|
|
34
|
-
description: 'Messages to normalize into sentences.',
|
|
35
|
-
}),
|
|
36
|
-
});
|
|
37
|
-
export interface NormalizationInput extends Schema.Schema.Type<typeof NormalizationInput> {}
|
|
38
|
-
|
|
39
|
-
export const NormalizationOutput = Schema.Struct({
|
|
40
|
-
sentences: Schema.Array(MessageWithRangeId.pipe(Schema.mutable)).pipe(Schema.mutable).annotations({
|
|
41
|
-
description: 'The sentences of the transcript.',
|
|
42
|
-
}),
|
|
43
|
-
});
|
|
44
|
-
export interface NormalizationOutput extends Schema.Schema.Type<typeof NormalizationOutput> {}
|
|
45
|
-
|
|
46
|
-
export const sentenceNormalization = defineFunction<NormalizationInput, NormalizationOutput>({
|
|
47
|
-
description: 'Post process of transcription for sentence normalization',
|
|
48
|
-
inputSchema: NormalizationInput,
|
|
49
|
-
outputSchema: NormalizationOutput,
|
|
50
|
-
handler: async ({ data: { messages }, context }) => {
|
|
51
|
-
log.info('input', { messages });
|
|
52
|
-
const ai = context.getService(AiService);
|
|
53
|
-
const session = new AiSession({ operationModel: 'configured' });
|
|
54
|
-
|
|
55
|
-
// TODO(dmaretskyi): This got broken after effect-ai transition.
|
|
56
|
-
const response = session.runStructured(NormalizationOutput, {
|
|
57
|
-
generationOptions: {
|
|
58
|
-
model: DEFAULT_EDGE_MODEL,
|
|
59
|
-
},
|
|
60
|
-
client: ai.client,
|
|
61
|
-
tools: [],
|
|
62
|
-
artifacts: [],
|
|
63
|
-
history: [
|
|
64
|
-
Obj.make(Message.Message, {
|
|
65
|
-
created: new Date().toISOString(),
|
|
66
|
-
sender: {
|
|
67
|
-
role: 'user',
|
|
68
|
-
},
|
|
69
|
-
blocks: messages.map((message) => ({ _tag: 'text', text: JSON.stringify(message) }) as const),
|
|
70
|
-
}),
|
|
71
|
-
],
|
|
72
|
-
prompt,
|
|
73
|
-
}) as any;
|
|
74
|
-
|
|
75
|
-
response.sentences.forEach((sentence) => {
|
|
76
|
-
sentence.id = ObjectId.random();
|
|
77
|
-
});
|
|
78
|
-
log.info('response', { response });
|
|
79
|
-
return response;
|
|
80
|
-
},
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
const prompt = trim`
|
|
45
|
+
const _unusedPrompt = trim`
|
|
84
46
|
You are observing a real-time transcript of a single person speaking.
|
|
85
47
|
The transcription is delivered in chunks of 10 seconds or less. As a result, individual sentences may be split across multiple messages, or multiple sentences may appear within a single message. Additionally, because this is real-time transcription, punctuation and capitalization may be incorrect or missing.
|
|
86
48
|
|
package/src/testing/testing.ts
CHANGED
|
@@ -11,12 +11,11 @@ import { Filter, type Queue } from '@dxos/client/echo';
|
|
|
11
11
|
import { Context } from '@dxos/context';
|
|
12
12
|
import { type Key, Obj, Ref, Type } from '@dxos/echo';
|
|
13
13
|
import { createQueueDXN } from '@dxos/echo/internal';
|
|
14
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
15
14
|
import { IdentityDid } from '@dxos/keys';
|
|
16
15
|
import { log } from '@dxos/log';
|
|
17
|
-
import {
|
|
16
|
+
import { random } from '@dxos/random';
|
|
18
17
|
import { type Space, useQueue } from '@dxos/react-client/echo';
|
|
19
|
-
import {
|
|
18
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
20
19
|
import { type ContentBlock, Message, Organization, Person } from '@dxos/types';
|
|
21
20
|
import { seedTestData } from '@dxos/types/testing';
|
|
22
21
|
|
|
@@ -31,8 +30,8 @@ export const TestItem = Schema.Struct({
|
|
|
31
30
|
description: 'Product description',
|
|
32
31
|
}),
|
|
33
32
|
}).pipe(
|
|
34
|
-
Type.
|
|
35
|
-
typename: 'dxos.
|
|
33
|
+
Type.object({
|
|
34
|
+
typename: 'org.dxos.type.test',
|
|
36
35
|
version: '0.1.0',
|
|
37
36
|
}),
|
|
38
37
|
);
|
|
@@ -50,8 +49,8 @@ export class MessageBuilder extends AbstractMessageBuilder {
|
|
|
50
49
|
|
|
51
50
|
users = Array.from({ length: 5 }, () => ({
|
|
52
51
|
identityDid: IdentityDid.random().toString(),
|
|
53
|
-
name:
|
|
54
|
-
email:
|
|
52
|
+
name: random.person.fullName(),
|
|
53
|
+
email: random.internet.email(),
|
|
55
54
|
}));
|
|
56
55
|
|
|
57
56
|
start = new Date(Date.now() - 24 * 60 * 60 * 10_000);
|
|
@@ -63,16 +62,21 @@ export class MessageBuilder extends AbstractMessageBuilder {
|
|
|
63
62
|
override async createMessage(numSegments = 1): Promise<Message.Message> {
|
|
64
63
|
return Obj.make(Message.Message, {
|
|
65
64
|
created: this.next().toISOString(),
|
|
66
|
-
sender:
|
|
65
|
+
sender: random.helpers.arrayElement(this.users),
|
|
67
66
|
blocks: Array.from({ length: numSegments }).map(() => this.createBlock()),
|
|
68
67
|
});
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
createBlock(): ContentBlock.Transcript {
|
|
72
|
-
let text =
|
|
71
|
+
let text = random.lorem.paragraph();
|
|
73
72
|
if (this._space) {
|
|
74
|
-
const label =
|
|
75
|
-
const obj = this._space.db.add(
|
|
73
|
+
const label = random.commerce.productName();
|
|
74
|
+
const obj = this._space.db.add(
|
|
75
|
+
Obj.make(TestItem, {
|
|
76
|
+
title: label,
|
|
77
|
+
description: random.lorem.paragraph(),
|
|
78
|
+
}),
|
|
79
|
+
);
|
|
76
80
|
const dxn = Ref.make(obj).dxn.toString();
|
|
77
81
|
const words = text.split(' ');
|
|
78
82
|
words.splice(Math.floor(Math.random() * words.length), 0, `[${label}](${dxn})`);
|
|
@@ -94,14 +98,6 @@ export class MessageBuilder extends AbstractMessageBuilder {
|
|
|
94
98
|
|
|
95
99
|
// TODO(burdon): Reconcile with BlockBuilder.
|
|
96
100
|
class EntityExtractionMessageBuilder extends AbstractMessageBuilder {
|
|
97
|
-
executor = new FunctionExecutor(
|
|
98
|
-
new ServiceContainer().setServices({
|
|
99
|
-
// ai: {
|
|
100
|
-
// client: this.AiService,
|
|
101
|
-
// },
|
|
102
|
-
}),
|
|
103
|
-
);
|
|
104
|
-
|
|
105
101
|
space: Space | undefined;
|
|
106
102
|
currentMessage: number = 0;
|
|
107
103
|
transcriptMessages: Message.Message[] = [];
|
|
@@ -117,12 +113,12 @@ class EntityExtractionMessageBuilder extends AbstractMessageBuilder {
|
|
|
117
113
|
throw new Error('Space not connected');
|
|
118
114
|
}
|
|
119
115
|
|
|
120
|
-
const
|
|
116
|
+
const objects = await this.space.db
|
|
121
117
|
.query(
|
|
122
118
|
Filter.or(
|
|
123
119
|
Filter.type(Person.Person),
|
|
124
120
|
Filter.type(Organization.Organization),
|
|
125
|
-
Filter.type(
|
|
121
|
+
Filter.type(TestSchema.DocumentType),
|
|
126
122
|
),
|
|
127
123
|
)
|
|
128
124
|
.run();
|
|
@@ -134,7 +130,6 @@ class EntityExtractionMessageBuilder extends AbstractMessageBuilder {
|
|
|
134
130
|
|
|
135
131
|
const { message: enhancedMessage } = await processTranscriptMessage({
|
|
136
132
|
input: { message },
|
|
137
|
-
executor: this.executor,
|
|
138
133
|
function: extractionAnthropicFunction,
|
|
139
134
|
});
|
|
140
135
|
|
|
@@ -19,7 +19,7 @@ const initializeExtendableMediaRecorder = async () => {
|
|
|
19
19
|
await register(await connect());
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export type
|
|
22
|
+
export type MediaStreamRecorderProps = {
|
|
23
23
|
mediaStreamTrack: MediaStreamTrack;
|
|
24
24
|
config: {
|
|
25
25
|
interval: number;
|
|
@@ -37,12 +37,12 @@ export class MediaStreamRecorder implements AudioRecorder {
|
|
|
37
37
|
/**
|
|
38
38
|
* Default MediaRecorder implementation do not support wav encoding.
|
|
39
39
|
*/
|
|
40
|
-
private readonly _config:
|
|
40
|
+
private readonly _config: MediaStreamRecorderProps['config'];
|
|
41
41
|
private _mediaRecorder?: IMediaRecorder = undefined;
|
|
42
42
|
private _header?: Uint8Array = undefined;
|
|
43
43
|
private _onChunk?: (chunk: AudioChunk) => void;
|
|
44
44
|
|
|
45
|
-
constructor({ mediaStreamTrack, config }:
|
|
45
|
+
constructor({ mediaStreamTrack, config }: MediaStreamRecorderProps) {
|
|
46
46
|
this._mediaStreamTrack = mediaStreamTrack;
|
|
47
47
|
this._config = config;
|
|
48
48
|
}
|
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
import fs from 'node:fs';
|
|
6
6
|
import path from 'node:path';
|
|
7
|
-
|
|
8
7
|
import { describe, expect, test } from 'vitest';
|
|
9
8
|
import { WaveFile } from 'wavefile';
|
|
10
9
|
|
|
@@ -213,7 +212,7 @@ class MockAudioRecorder implements AudioRecorder {
|
|
|
213
212
|
|
|
214
213
|
@trace.span()
|
|
215
214
|
async start(): Promise<void> {
|
|
216
|
-
log.info('start mock audio recorder', {
|
|
215
|
+
log.info('start mock audio recorder', { wavProps: this.wav.fmt });
|
|
217
216
|
const now = Date.now();
|
|
218
217
|
const samples = this.wav.getSamples();
|
|
219
218
|
const sampleRate = this.wavConfig.sampleRate;
|
|
@@ -10,9 +10,9 @@ import { log } from '@dxos/log';
|
|
|
10
10
|
import { trace } from '@dxos/tracing';
|
|
11
11
|
import { type ContentBlock } from '@dxos/types';
|
|
12
12
|
|
|
13
|
-
import { TRANSCRIPTION_URL } from '
|
|
14
|
-
import { mergeFloat64Arrays } from '../util';
|
|
13
|
+
import { TRANSCRIPTION_URL } from '#types';
|
|
15
14
|
|
|
15
|
+
import { mergeFloat64Arrays } from '../util';
|
|
16
16
|
import { type AudioChunk, type AudioRecorder } from './audio-recorder';
|
|
17
17
|
|
|
18
18
|
type WhisperWord = {
|
|
@@ -63,7 +63,7 @@ export type TranscribeConfig = {
|
|
|
63
63
|
prefixBufferChunksAmount: number;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export type
|
|
66
|
+
export type TranscriberProps = {
|
|
67
67
|
config: TranscribeConfig;
|
|
68
68
|
recorder: AudioRecorder;
|
|
69
69
|
/**
|
|
@@ -86,12 +86,12 @@ export class Transcriber extends Resource {
|
|
|
86
86
|
|
|
87
87
|
private readonly _config: TranscribeConfig;
|
|
88
88
|
private readonly _recorder: AudioRecorder;
|
|
89
|
-
private readonly _onSegments:
|
|
89
|
+
private readonly _onSegments: TranscriberProps['onSegments'];
|
|
90
90
|
|
|
91
91
|
private _recording = false;
|
|
92
92
|
private _transcribeTask?: DeferredTask = undefined;
|
|
93
93
|
|
|
94
|
-
constructor({ config, recorder, onSegments }:
|
|
94
|
+
constructor({ config, recorder, onSegments }: TranscriberProps) {
|
|
95
95
|
super();
|
|
96
96
|
this._config = config;
|
|
97
97
|
this._recorder = recorder;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Atom, type Registry } from '@effect-atom/atom-react';
|
|
6
6
|
|
|
7
7
|
import { synchronized } from '@dxos/async';
|
|
8
8
|
import { Resource } from '@dxos/context';
|
|
@@ -34,6 +34,7 @@ export type TranscriptMessageEnricher = (message: Message.Message) => Promise<Me
|
|
|
34
34
|
|
|
35
35
|
export type TranscriptionManagerOptions = {
|
|
36
36
|
edgeClient: EdgeHttpClient;
|
|
37
|
+
registry: Registry.Registry;
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* Enrich the message before it is written to the transcription queue.
|
|
@@ -47,22 +48,27 @@ export type TranscriptionManagerOptions = {
|
|
|
47
48
|
export class TranscriptionManager extends Resource {
|
|
48
49
|
private readonly _edgeClient: EdgeHttpClient;
|
|
49
50
|
private readonly _messageEnricher?: TranscriptMessageEnricher;
|
|
51
|
+
private readonly _registry: Registry.Registry;
|
|
50
52
|
private _audioStreamTrack?: MediaStreamTrack = undefined;
|
|
51
53
|
private _identityDid?: string = undefined;
|
|
52
54
|
private _mediaRecorder?: MediaStreamRecorder = undefined;
|
|
53
55
|
private _transcriber?: Transcriber = undefined;
|
|
54
56
|
private _queue?: Queue<Message.Message> = undefined;
|
|
55
|
-
private
|
|
57
|
+
private _enabledAtom = Atom.make(false);
|
|
56
58
|
|
|
57
59
|
constructor(options: TranscriptionManagerOptions) {
|
|
58
60
|
super();
|
|
59
61
|
this._edgeClient = options.edgeClient;
|
|
60
62
|
this._messageEnricher = options.messageEnricher;
|
|
63
|
+
this._registry = options.registry;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
+
get enabled(): Atom.Atom<boolean> {
|
|
67
|
+
return this._enabledAtom;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
getEnabled(): boolean {
|
|
71
|
+
return this._registry.get(this._enabledAtom);
|
|
66
72
|
}
|
|
67
73
|
|
|
68
74
|
setQueue(queue: Queue<Message.Message>): this {
|
|
@@ -78,7 +84,7 @@ export class TranscriptionManager extends Resource {
|
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
setRecording(recording?: boolean): this {
|
|
81
|
-
if (!this.isOpen || !this.
|
|
87
|
+
if (!this.isOpen || !this.getEnabled()) {
|
|
82
88
|
return this;
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -91,11 +97,11 @@ export class TranscriptionManager extends Resource {
|
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
async setEnabled(enabled: boolean): Promise<void> {
|
|
94
|
-
if (this.
|
|
100
|
+
if (this.getEnabled() === enabled) {
|
|
95
101
|
return;
|
|
96
102
|
}
|
|
97
103
|
|
|
98
|
-
this.
|
|
104
|
+
this._registry.set(this._enabledAtom, enabled ?? false);
|
|
99
105
|
if (enabled) {
|
|
100
106
|
await this._maybeRestartTranscriber();
|
|
101
107
|
} else {
|
|
@@ -122,7 +128,7 @@ export class TranscriptionManager extends Resource {
|
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
private async _maybeRestartTranscriber(): Promise<void> {
|
|
125
|
-
if (!this._audioStreamTrack || !this.
|
|
131
|
+
if (!this._audioStreamTrack || !this.getEnabled() || !this.isOpen) {
|
|
126
132
|
return;
|
|
127
133
|
}
|
|
128
134
|
|
package/src/translations.ts
CHANGED
|
@@ -4,20 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
import { type Resource } from '@dxos/react-ui';
|
|
6
6
|
|
|
7
|
-
import { meta } from '
|
|
7
|
+
import { meta } from '#meta';
|
|
8
8
|
|
|
9
9
|
export const translations = [
|
|
10
10
|
{
|
|
11
11
|
'en-US': {
|
|
12
12
|
[meta.id]: {
|
|
13
|
-
'plugin
|
|
14
|
-
'transcript
|
|
13
|
+
'plugin.name': 'Transcription',
|
|
14
|
+
'transcript-companion.label': 'Transcript',
|
|
15
15
|
|
|
16
|
-
'delete
|
|
17
|
-
'bookmark
|
|
18
|
-
'scroll
|
|
16
|
+
'delete.button': 'Delete',
|
|
17
|
+
'bookmark.button': 'Bookmark',
|
|
18
|
+
'scroll-to-end.label': 'Scroll to latest',
|
|
19
19
|
|
|
20
|
-
'settings
|
|
20
|
+
'settings.entity-extraction.label': 'Entity extraction',
|
|
21
21
|
},
|
|
22
22
|
},
|
|
23
23
|
},
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
|
+
|
|
7
|
+
import { meta } from '#meta';
|
|
6
8
|
|
|
7
|
-
import { meta } from '../meta';
|
|
8
9
|
import {
|
|
9
|
-
type
|
|
10
|
+
type MediaStreamRecorderProps,
|
|
10
11
|
type Transcriber,
|
|
11
|
-
type
|
|
12
|
+
type TranscriberProps,
|
|
12
13
|
type TranscriptMessageEnricher,
|
|
13
14
|
type TranscriptionManager,
|
|
14
15
|
} from '../transcriber';
|
|
@@ -16,18 +17,18 @@ import {
|
|
|
16
17
|
export namespace TranscriptionCapabilities {
|
|
17
18
|
export type GetTranscriberProps = {
|
|
18
19
|
audioStreamTrack: MediaStreamTrack;
|
|
19
|
-
recorderConfig?: Partial<
|
|
20
|
-
transcriberConfig?: Partial<
|
|
21
|
-
onSegments:
|
|
20
|
+
recorderConfig?: Partial<MediaStreamRecorderProps['config']>;
|
|
21
|
+
transcriberConfig?: Partial<TranscriberProps['config']>;
|
|
22
|
+
onSegments: TranscriberProps['onSegments'];
|
|
22
23
|
};
|
|
23
24
|
export type GetTranscriber = (props: GetTranscriberProps) => Transcriber;
|
|
24
|
-
export const Transcriber =
|
|
25
|
+
export const Transcriber = Capability.make<GetTranscriber>(`${meta.id}.capability.transcriber`);
|
|
25
26
|
|
|
26
27
|
export type GetTranscriptionManagerProps = {
|
|
27
28
|
messageEnricher?: TranscriptMessageEnricher;
|
|
28
29
|
};
|
|
29
30
|
export type GetTranscriptionManager = (props: GetTranscriptionManagerProps) => TranscriptionManager;
|
|
30
|
-
export const TranscriptionManager =
|
|
31
|
-
`${meta.id}
|
|
31
|
+
export const TranscriptionManager = Capability.make<GetTranscriptionManager>(
|
|
32
|
+
`${meta.id}.capability.transcription-manager`,
|
|
32
33
|
);
|
|
33
34
|
}
|
package/src/types/index.ts
CHANGED
package/src/util/index.ts
CHANGED