@dxos/plugin-transcription 0.8.2-staging.7ac8446 → 0.8.3-main.672df60
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-3EH6QHPJ.mjs +11 -0
- package/dist/lib/browser/{chunk-K7FOYAXO.mjs → chunk-DL2276CA.mjs} +2 -2
- package/dist/lib/browser/{chunk-6ZR5MDK3.mjs → chunk-GOF7MJNV.mjs} +3 -3
- package/dist/lib/browser/{chunk-6ZR5MDK3.mjs.map → chunk-GOF7MJNV.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-YCZISX63.mjs → chunk-LMLE2QYX.mjs} +130 -99
- package/dist/lib/browser/chunk-LMLE2QYX.mjs.map +7 -0
- package/dist/lib/browser/chunk-NODIXNQP.mjs +54 -0
- package/dist/lib/browser/chunk-NODIXNQP.mjs.map +7 -0
- package/dist/lib/browser/chunk-RULOUJHH.mjs +764 -0
- package/dist/lib/browser/chunk-RULOUJHH.mjs.map +7 -0
- package/dist/lib/browser/{chunk-YEPT334A.mjs → chunk-W2KNYJD6.mjs} +4 -4
- package/dist/lib/browser/chunk-W2KNYJD6.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +31 -219
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/{intent-resolver-4R66ZCKT.mjs → intent-resolver-I2LJSQDR.mjs} +7 -11
- package/dist/lib/browser/intent-resolver-I2LJSQDR.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-FQUHU5G7.mjs → react-surface-FPVBUAW4.mjs} +11 -9
- package/dist/lib/browser/react-surface-FPVBUAW4.mjs.map +7 -0
- package/dist/lib/browser/transcriber-KV5VJ6EZ.mjs +56 -0
- package/dist/lib/browser/transcriber-KV5VJ6EZ.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -8
- package/dist/lib/node/{TranscriptContainer-QEYTTT2V.cjs → TranscriptContainer-JXOIM6N6.cjs} +9 -8
- package/dist/lib/node/TranscriptContainer-JXOIM6N6.cjs.map +7 -0
- package/dist/lib/node/{chunk-NVZWGFJL.cjs → chunk-AFUZI63A.cjs} +6 -6
- package/dist/lib/node/{chunk-NVZWGFJL.cjs.map → chunk-AFUZI63A.cjs.map} +1 -1
- package/dist/lib/node/chunk-CQSQI53U.cjs +778 -0
- package/dist/lib/node/chunk-CQSQI53U.cjs.map +7 -0
- package/dist/lib/node/chunk-EIMUQYCZ.cjs +74 -0
- package/dist/lib/node/chunk-EIMUQYCZ.cjs.map +7 -0
- package/dist/lib/node/{chunk-CZMLKKWT.cjs → chunk-FKDJNJ57.cjs} +8 -8
- package/dist/lib/node/chunk-FKDJNJ57.cjs.map +7 -0
- package/dist/lib/node/{chunk-LP4FG423.cjs → chunk-IY6IM7GC.cjs} +5 -5
- package/dist/lib/node/{chunk-FCCJALOT.cjs → chunk-JABOFOJ5.cjs} +129 -99
- package/dist/lib/node/chunk-JABOFOJ5.cjs.map +7 -0
- package/dist/lib/node/index.cjs +60 -254
- package/dist/lib/node/index.cjs.map +4 -4
- package/dist/lib/node/{intent-resolver-WMMCOUEH.cjs → intent-resolver-LLMGF5I5.cjs} +10 -11
- package/dist/lib/node/intent-resolver-LLMGF5I5.cjs.map +7 -0
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-WI2MGWCC.cjs → react-surface-REQZMCYO.cjs} +13 -11
- package/dist/lib/node/react-surface-REQZMCYO.cjs.map +7 -0
- package/dist/lib/node/transcriber-ZSDN6GMP.cjs +68 -0
- package/dist/lib/node/transcriber-ZSDN6GMP.cjs.map +7 -0
- package/dist/lib/node/types/index.cjs +7 -11
- package/dist/lib/node/types/index.cjs.map +2 -2
- package/dist/lib/node-esm/{TranscriptContainer-ZXUCOWGY.mjs → TranscriptContainer-K5VZZ4OB.mjs} +4 -3
- package/dist/lib/node-esm/chunk-BRPFVRAD.mjs +55 -0
- package/dist/lib/node-esm/chunk-BRPFVRAD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YQYBLFNI.mjs → chunk-GD5IZDKD.mjs} +130 -99
- package/dist/lib/node-esm/chunk-GD5IZDKD.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PTZHDZ36.mjs → chunk-MFJPEIVB.mjs} +4 -4
- package/dist/lib/node-esm/chunk-MFJPEIVB.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-J4D2RBBH.mjs → chunk-SKK7VDQZ.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-X4DDJIVL.mjs → chunk-TXMDLLBR.mjs} +3 -3
- package/dist/lib/node-esm/{chunk-X4DDJIVL.mjs.map → chunk-TXMDLLBR.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-V54MCG5P.mjs +765 -0
- package/dist/lib/node-esm/chunk-V54MCG5P.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +31 -219
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/{intent-resolver-QN2LO5TX.mjs → intent-resolver-WOZKOEBW.mjs} +7 -11
- package/dist/lib/node-esm/intent-resolver-WOZKOEBW.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-PCH6NTVB.mjs → react-surface-ROQN77NT.mjs} +11 -9
- package/dist/lib/node-esm/react-surface-ROQN77NT.mjs.map +7 -0
- package/dist/lib/node-esm/transcriber-JHPFZVJJ.mjs +57 -0
- package/dist/lib/node-esm/transcriber-JHPFZVJJ.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -8
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +8 -10
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +2 -183
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +2 -2
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/transcriber.d.ts +2 -1
- package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts +14 -4
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +19 -4
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +27 -0
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -0
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +19 -0
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -0
- package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +17 -0
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +10 -0
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -0
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +19 -0
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -0
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +11 -0
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -0
- package/dist/types/src/components/stories/useIsSpeaking.d.ts +3 -0
- package/dist/types/src/components/stories/useIsSpeaking.d.ts.map +1 -0
- package/dist/types/src/hooks/index.d.ts +1 -0
- package/dist/types/src/hooks/index.d.ts.map +1 -1
- package/dist/types/src/hooks/useAudioFile.d.ts +1 -1
- package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
- package/dist/types/src/hooks/useAudioTrack.d.ts +1 -1
- package/dist/types/src/hooks/useAudioTrack.d.ts.map +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts +7 -0
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -0
- 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/model/index.d.ts +2 -0
- package/dist/types/src/model/index.d.ts.map +1 -0
- package/dist/types/src/model/model.d.ts +68 -0
- package/dist/types/src/model/model.d.ts.map +1 -0
- package/dist/types/src/model/model.test.d.ts +2 -0
- package/dist/types/src/model/model.test.d.ts.map +1 -0
- package/dist/types/src/segments-normalization/index.d.ts +4 -0
- package/dist/types/src/segments-normalization/index.d.ts.map +1 -0
- package/dist/types/src/segments-normalization/message-normalizer.d.ts +26 -0
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -0
- package/dist/types/src/segments-normalization/normalization.d.ts +520 -0
- package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -0
- package/dist/types/src/segments-normalization/normalization.test.d.ts +2 -0
- package/dist/types/src/segments-normalization/normalization.test.d.ts.map +1 -0
- package/dist/types/src/segments-normalization/utils.d.ts +3 -0
- package/dist/types/src/segments-normalization/utils.d.ts.map +1 -0
- package/dist/types/src/testing/index.d.ts +2 -0
- package/dist/types/src/testing/index.d.ts.map +1 -0
- package/dist/types/src/testing/testing.d.ts +40 -0
- package/dist/types/src/testing/testing.d.ts.map +1 -0
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +8 -5
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.browser.test.d.ts +2 -0
- package/dist/types/src/transcriber/transcriber.browser.test.d.ts.map +1 -0
- package/dist/types/src/transcriber/transcriber.d.ts +6 -2
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts +20 -16
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -20
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +23 -40
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +15 -8
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/src/util/array.d.ts.map +1 -1
- package/dist/types/src/util/get-time-str.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +0 -1
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +62 -41
- package/src/TranscriptionPlugin.tsx +14 -21
- package/src/capabilities/capabilities.ts +15 -8
- package/src/capabilities/index.ts +0 -2
- package/src/capabilities/intent-resolver.ts +7 -8
- package/src/capabilities/react-surface.tsx +5 -4
- package/src/capabilities/transcriber.ts +34 -6
- package/src/components/Transcript/Transcript.stories.tsx +201 -43
- package/src/components/Transcript/Transcript.tsx +83 -208
- package/src/components/Transcript/deprecated/OldTranscript.tsx +260 -0
- package/src/components/Transcript/transcript-extension.ts +236 -0
- package/src/components/TranscriptContainer.tsx +11 -6
- package/src/components/stories/FileTranscription.stories.tsx +240 -0
- package/src/components/stories/KeyWordRecognition.stories.tsx +128 -0
- package/src/components/stories/MicrophoneTranscription.stories.tsx +274 -0
- package/src/components/stories/TranscriptionStory.tsx +41 -0
- package/src/components/stories/useIsSpeaking.tsx +40 -0
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useAudioFile.ts +39 -9
- package/src/hooks/useAudioTrack.ts +2 -2
- package/src/hooks/useQueueModelAdapter.ts +65 -0
- package/src/hooks/useTranscriber.ts +4 -2
- package/src/meta.ts +2 -2
- package/src/model/index.ts +5 -0
- package/src/model/model.test.ts +169 -0
- package/src/model/model.ts +229 -0
- package/src/segments-normalization/index.ts +7 -0
- package/src/segments-normalization/message-normalizer.ts +108 -0
- package/src/segments-normalization/normalization.test.ts +142 -0
- package/src/segments-normalization/normalization.ts +103 -0
- package/src/segments-normalization/utils.ts +9 -0
- package/src/testing/index.ts +5 -0
- package/src/testing/testing.ts +216 -0
- package/src/transcriber/media-stream-recorder.ts +14 -7
- package/src/transcriber/{transcriber.test.ts → transcriber.browser.test.ts} +7 -7
- package/src/transcriber/transcriber.ts +33 -20
- package/src/transcriber/transcription-manager.ts +81 -70
- package/src/translations.ts +2 -3
- package/src/types/schema.ts +11 -33
- package/src/types/types.ts +8 -12
- package/src/util/index.ts +0 -1
- package/dist/lib/browser/TranscriptContainer-JQ3HFHLQ.mjs +0 -10
- package/dist/lib/browser/app-graph-builder-VDQOVX7P.mjs +0 -191
- package/dist/lib/browser/app-graph-builder-VDQOVX7P.mjs.map +0 -7
- package/dist/lib/browser/chunk-G4B6CPC2.mjs +0 -253
- package/dist/lib/browser/chunk-G4B6CPC2.mjs.map +0 -7
- package/dist/lib/browser/chunk-GU2BNYKZ.mjs +0 -35
- package/dist/lib/browser/chunk-GU2BNYKZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-OGNXNGJB.mjs +0 -73
- package/dist/lib/browser/chunk-OGNXNGJB.mjs.map +0 -7
- package/dist/lib/browser/chunk-YCZISX63.mjs.map +0 -7
- package/dist/lib/browser/chunk-YEPT334A.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-4R66ZCKT.mjs.map +0 -7
- package/dist/lib/browser/meeting-transcription-state-DLFHQK72.mjs +0 -18
- package/dist/lib/browser/meeting-transcription-state-DLFHQK72.mjs.map +0 -7
- package/dist/lib/browser/react-surface-FQUHU5G7.mjs.map +0 -7
- package/dist/lib/browser/transcriber-LGMIWDYI.mjs +0 -36
- package/dist/lib/browser/transcriber-LGMIWDYI.mjs.map +0 -7
- package/dist/lib/node/TranscriptContainer-QEYTTT2V.cjs.map +0 -7
- package/dist/lib/node/app-graph-builder-IFSIVNUR.cjs +0 -200
- package/dist/lib/node/app-graph-builder-IFSIVNUR.cjs.map +0 -7
- package/dist/lib/node/chunk-3KHUSQNW.cjs +0 -55
- package/dist/lib/node/chunk-3KHUSQNW.cjs.map +0 -7
- package/dist/lib/node/chunk-CZMLKKWT.cjs.map +0 -7
- package/dist/lib/node/chunk-FCCJALOT.cjs.map +0 -7
- package/dist/lib/node/chunk-P4VVD6ZO.cjs +0 -95
- package/dist/lib/node/chunk-P4VVD6ZO.cjs.map +0 -7
- package/dist/lib/node/chunk-UOFHT4GZ.cjs +0 -280
- package/dist/lib/node/chunk-UOFHT4GZ.cjs.map +0 -7
- package/dist/lib/node/intent-resolver-WMMCOUEH.cjs.map +0 -7
- package/dist/lib/node/meeting-transcription-state-URIYILEQ.cjs +0 -34
- package/dist/lib/node/meeting-transcription-state-URIYILEQ.cjs.map +0 -7
- package/dist/lib/node/react-surface-WI2MGWCC.cjs.map +0 -7
- package/dist/lib/node/transcriber-QG5WPKX4.cjs +0 -49
- package/dist/lib/node/transcriber-QG5WPKX4.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-UL6XLIZY.mjs +0 -192
- package/dist/lib/node-esm/app-graph-builder-UL6XLIZY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-6X7X2UZF.mjs +0 -254
- package/dist/lib/node-esm/chunk-6X7X2UZF.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-GIO6J6FE.mjs +0 -74
- package/dist/lib/node-esm/chunk-GIO6J6FE.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HKATMD34.mjs +0 -37
- package/dist/lib/node-esm/chunk-HKATMD34.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-PTZHDZ36.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YQYBLFNI.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-QN2LO5TX.mjs.map +0 -7
- package/dist/lib/node-esm/meeting-transcription-state-ZYVRAW6Y.mjs +0 -19
- package/dist/lib/node-esm/meeting-transcription-state-ZYVRAW6Y.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-PCH6NTVB.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-TMPYZ5L4.mjs +0 -37
- package/dist/lib/node-esm/transcriber-TMPYZ5L4.mjs.map +0 -7
- package/dist/types/src/capabilities/app-graph-builder.d.ts +0 -181
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +0 -1
- package/dist/types/src/capabilities/meeting-transcription-state.d.ts +0 -6
- package/dist/types/src/capabilities/meeting-transcription-state.d.ts.map +0 -1
- package/dist/types/src/components/transcription.stories.d.ts +0 -15
- package/dist/types/src/components/transcription.stories.d.ts.map +0 -1
- package/dist/types/src/transcriber/transcriber.test.d.ts +0 -2
- package/dist/types/src/transcriber/transcriber.test.d.ts.map +0 -1
- package/dist/types/src/util/random-queue-dxn.d.ts +0 -3
- package/dist/types/src/util/random-queue-dxn.d.ts.map +0 -1
- package/src/capabilities/app-graph-builder.ts +0 -152
- package/src/capabilities/meeting-transcription-state.ts +0 -16
- package/src/components/transcription.stories.tsx +0 -196
- package/src/util/random-queue-dxn.ts +0 -9
- /package/dist/lib/browser/{TranscriptContainer-JQ3HFHLQ.mjs.map → TranscriptContainer-3EH6QHPJ.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-K7FOYAXO.mjs.map → chunk-DL2276CA.mjs.map} +0 -0
- /package/dist/lib/node/{chunk-LP4FG423.cjs.map → chunk-IY6IM7GC.cjs.map} +0 -0
- /package/dist/lib/node-esm/{TranscriptContainer-ZXUCOWGY.mjs.map → TranscriptContainer-K5VZZ4OB.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-J4D2RBBH.mjs.map → chunk-SKK7VDQZ.mjs.map} +0 -0
|
@@ -2,18 +2,17 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
+
import { signal } from '@preact/signals-core';
|
|
6
|
+
|
|
5
7
|
import { synchronized } from '@dxos/async';
|
|
6
8
|
import { Resource } from '@dxos/context';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { invariant } from '@dxos/invariant';
|
|
10
|
-
import { DXN } from '@dxos/keys';
|
|
9
|
+
import { type Queue } from '@dxos/echo-db';
|
|
10
|
+
import { create } from '@dxos/echo-schema';
|
|
11
11
|
import { type EdgeHttpClient } from '@dxos/react-edge-client';
|
|
12
|
-
import {
|
|
12
|
+
import { DataType } from '@dxos/schema';
|
|
13
13
|
|
|
14
14
|
import { MediaStreamRecorder } from './media-stream-recorder';
|
|
15
15
|
import { Transcriber } from './transcriber';
|
|
16
|
-
import { TranscriptBlock, type TranscriptSegment } from '../types';
|
|
17
16
|
|
|
18
17
|
/**
|
|
19
18
|
* Length of the chunk in ms.
|
|
@@ -31,37 +30,56 @@ const PREFIXED_CHUNKS_AMOUNT = 10;
|
|
|
31
30
|
*/
|
|
32
31
|
const TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
|
|
33
32
|
|
|
33
|
+
export type TranscriptMessageEnricher = (message: DataType.Message) => Promise<DataType.Message>;
|
|
34
|
+
|
|
35
|
+
export type TranscriptionManagerOptions = {
|
|
36
|
+
edgeClient: EdgeHttpClient;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Enrich the message before it is written to the transcription queue.
|
|
40
|
+
*/
|
|
41
|
+
messageEnricher?: TranscriptMessageEnricher;
|
|
42
|
+
};
|
|
43
|
+
|
|
34
44
|
/**
|
|
35
45
|
* Manages transcription state for a meeting.
|
|
36
46
|
*/
|
|
37
|
-
// TODO(mykola): Reconcile with transcriber capability.
|
|
38
47
|
export class TranscriptionManager extends Resource {
|
|
39
48
|
private readonly _edgeClient: EdgeHttpClient;
|
|
49
|
+
private readonly _messageEnricher?: TranscriptMessageEnricher;
|
|
40
50
|
private _audioStreamTrack?: MediaStreamTrack = undefined;
|
|
41
|
-
private
|
|
42
|
-
private _hue?: HuePalette = undefined;
|
|
51
|
+
private _identityDid?: string = undefined;
|
|
43
52
|
private _mediaRecorder?: MediaStreamRecorder = undefined;
|
|
44
53
|
private _transcriber?: Transcriber = undefined;
|
|
45
|
-
private
|
|
46
|
-
private
|
|
54
|
+
private _queue?: Queue<DataType.Message> = undefined;
|
|
55
|
+
private _enabled = signal(false);
|
|
47
56
|
|
|
48
|
-
constructor(
|
|
57
|
+
constructor(options: TranscriptionManagerOptions) {
|
|
49
58
|
super();
|
|
50
|
-
this._edgeClient = edgeClient;
|
|
59
|
+
this._edgeClient = options.edgeClient;
|
|
60
|
+
this._messageEnricher = options.messageEnricher;
|
|
51
61
|
}
|
|
52
62
|
|
|
53
|
-
|
|
54
|
-
|
|
63
|
+
/** @reactive */
|
|
64
|
+
get enabled() {
|
|
65
|
+
return this._enabled.value;
|
|
55
66
|
}
|
|
56
67
|
|
|
57
|
-
|
|
58
|
-
|
|
68
|
+
setQueue(queue: Queue<DataType.Message>): this {
|
|
69
|
+
this._queue = queue;
|
|
70
|
+
return this;
|
|
59
71
|
}
|
|
60
72
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
73
|
+
setIdentityDid(did: string): this {
|
|
74
|
+
if (this._identityDid !== did) {
|
|
75
|
+
this._identityDid = did;
|
|
76
|
+
}
|
|
77
|
+
return this;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
setRecording(recording?: boolean): this {
|
|
81
|
+
if (!this.isOpen || !this._enabled.value) {
|
|
82
|
+
return this;
|
|
65
83
|
}
|
|
66
84
|
|
|
67
85
|
if (recording) {
|
|
@@ -69,6 +87,7 @@ export class TranscriptionManager extends Resource {
|
|
|
69
87
|
} else {
|
|
70
88
|
this._transcriber?.stopChunksRecording();
|
|
71
89
|
}
|
|
90
|
+
return this;
|
|
72
91
|
}
|
|
73
92
|
|
|
74
93
|
/**
|
|
@@ -76,78 +95,61 @@ export class TranscriptionManager extends Resource {
|
|
|
76
95
|
* @param enabled - Whether to enable transcription.
|
|
77
96
|
*/
|
|
78
97
|
@synchronized
|
|
79
|
-
async setEnabled(enabled?: boolean) {
|
|
80
|
-
if (this._enabled === enabled) {
|
|
98
|
+
async setEnabled(enabled?: boolean): Promise<void> {
|
|
99
|
+
if (this._enabled.value === enabled) {
|
|
81
100
|
return;
|
|
82
101
|
}
|
|
83
|
-
|
|
102
|
+
|
|
103
|
+
this._enabled.value = enabled ?? false;
|
|
104
|
+
// TODO(burdon): Why is toggle called here?
|
|
84
105
|
this.isOpen && (await this._toggleTranscriber());
|
|
85
106
|
}
|
|
86
107
|
|
|
87
108
|
@synchronized
|
|
88
|
-
async setAudioTrack(track?: MediaStreamTrack) {
|
|
109
|
+
async setAudioTrack(track?: MediaStreamTrack): Promise<void> {
|
|
89
110
|
if (this._audioStreamTrack === track) {
|
|
90
111
|
return;
|
|
91
112
|
}
|
|
113
|
+
|
|
92
114
|
this._audioStreamTrack = track;
|
|
93
115
|
this.isOpen && (await this._toggleTranscriber());
|
|
94
116
|
}
|
|
95
117
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
* @param queue - The queue to save the transcription to or the DXN of the queue.
|
|
99
|
-
*/
|
|
100
|
-
@synchronized
|
|
101
|
-
setQueue(queue?: Queue<TranscriptBlock> | string) {
|
|
102
|
-
switch (typeof queue) {
|
|
103
|
-
case 'string':
|
|
104
|
-
if (this._queue?.dxn.toString() === queue) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
this._queue = new QueueImpl<TranscriptBlock>(this._edgeClient, DXN.parse(queue));
|
|
108
|
-
break;
|
|
109
|
-
case 'object':
|
|
110
|
-
if (this._queue === queue) {
|
|
111
|
-
return;
|
|
112
|
-
}
|
|
113
|
-
invariant(queue instanceof QueueImpl);
|
|
114
|
-
this._queue = queue;
|
|
115
|
-
break;
|
|
116
|
-
case 'undefined':
|
|
117
|
-
this._queue = undefined;
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
@synchronized
|
|
123
|
-
setName(name: string) {
|
|
124
|
-
if (this._name === name) {
|
|
125
|
-
return;
|
|
126
|
-
}
|
|
127
|
-
this._name = name;
|
|
118
|
+
protected override async _open(): Promise<void> {
|
|
119
|
+
await this._toggleTranscriber();
|
|
128
120
|
}
|
|
129
121
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
if (this._hue === hue) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
this._hue = hue;
|
|
122
|
+
protected override async _close(): Promise<void> {
|
|
123
|
+
void this._transcriber?.close();
|
|
136
124
|
}
|
|
137
125
|
|
|
138
|
-
|
|
126
|
+
// TODO(burdon): Change this to setEnables (explicit), not toggle.
|
|
127
|
+
private async _toggleTranscriber(): Promise<void> {
|
|
139
128
|
await this._maybeReinitTranscriber();
|
|
140
129
|
|
|
141
130
|
// Open or close transcriber if transcription is enabled or disabled.
|
|
142
|
-
if (this._enabled) {
|
|
131
|
+
if (this._enabled.value) {
|
|
143
132
|
await this._transcriber?.open();
|
|
133
|
+
// TODO(burdon): Started and stopped blocks appear twice.
|
|
134
|
+
const block = create(DataType.Message, {
|
|
135
|
+
created: new Date().toISOString(),
|
|
136
|
+
blocks: [{ type: 'transcription', text: 'Started', started: new Date().toISOString() }],
|
|
137
|
+
sender: { role: 'assistant' },
|
|
138
|
+
});
|
|
139
|
+
this._queue?.append([block]);
|
|
144
140
|
} else {
|
|
145
141
|
await this._transcriber?.close();
|
|
142
|
+
const block = create(DataType.Message, {
|
|
143
|
+
created: new Date().toISOString(),
|
|
144
|
+
blocks: [{ type: 'transcription', text: 'Stopped', started: new Date().toISOString() }],
|
|
145
|
+
sender: { role: 'assistant' },
|
|
146
|
+
});
|
|
147
|
+
this._queue?.append([block]);
|
|
146
148
|
}
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
private async _maybeReinitTranscriber() {
|
|
150
|
-
if (!this._audioStreamTrack || !this._enabled) {
|
|
151
|
+
private async _maybeReinitTranscriber(): Promise<void> {
|
|
152
|
+
if (!this._audioStreamTrack || !this._enabled.value) {
|
|
151
153
|
return;
|
|
152
154
|
}
|
|
153
155
|
|
|
@@ -156,7 +158,7 @@ export class TranscriptionManager extends Resource {
|
|
|
156
158
|
if (this._audioStreamTrack !== this._mediaRecorder?.mediaStreamTrack) {
|
|
157
159
|
this._mediaRecorder = new MediaStreamRecorder({
|
|
158
160
|
mediaStreamTrack: this._audioStreamTrack,
|
|
159
|
-
interval: RECORD_INTERVAL,
|
|
161
|
+
config: { interval: RECORD_INTERVAL },
|
|
160
162
|
});
|
|
161
163
|
needReinit = true;
|
|
162
164
|
}
|
|
@@ -173,12 +175,21 @@ export class TranscriptionManager extends Resource {
|
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
177
|
|
|
176
|
-
private async _onSegments(segments:
|
|
178
|
+
private async _onSegments(segments: DataType.MessageBlock.Transcription[]): Promise<void> {
|
|
177
179
|
if (!this.isOpen || !this._queue) {
|
|
178
180
|
return;
|
|
179
181
|
}
|
|
180
182
|
|
|
181
|
-
|
|
183
|
+
let block = create(DataType.Message, {
|
|
184
|
+
created: new Date().toISOString(),
|
|
185
|
+
blocks: segments,
|
|
186
|
+
sender: { identityDid: this._identityDid },
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
if (this._messageEnricher) {
|
|
190
|
+
block = await this._messageEnricher(block);
|
|
191
|
+
}
|
|
192
|
+
|
|
182
193
|
this._queue.append([block]);
|
|
183
194
|
}
|
|
184
195
|
}
|
package/src/translations.ts
CHANGED
|
@@ -16,12 +16,11 @@ export default [
|
|
|
16
16
|
'plugin name': 'Transcription',
|
|
17
17
|
'transcript companion label': 'Transcript',
|
|
18
18
|
|
|
19
|
-
'start transcription label': 'Start transcription',
|
|
20
|
-
'stop transcription label': 'Stop transcription',
|
|
21
|
-
|
|
22
19
|
'delete button': 'Delete',
|
|
23
20
|
'bookmark button': 'Bookmark',
|
|
24
21
|
'scroll to end label': 'Scroll to latest',
|
|
22
|
+
|
|
23
|
+
'settings entity extraction label': 'Entity extraction',
|
|
25
24
|
},
|
|
26
25
|
},
|
|
27
26
|
},
|
package/src/types/schema.ts
CHANGED
|
@@ -2,17 +2,18 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { Expando, Ref, TypedObject } from '@dxos/echo-schema';
|
|
6
8
|
|
|
7
9
|
/**
|
|
8
10
|
* Root transcript object created when the user starts a transcription.
|
|
9
11
|
*/
|
|
10
|
-
export const TranscriptSchema =
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
ended: S.optional(S.Date),
|
|
12
|
+
export const TranscriptSchema = Schema.Struct({
|
|
13
|
+
// TODO(wittjosiah): Remove?
|
|
14
|
+
// TODO(burdon): Use Date or string?
|
|
15
|
+
started: Schema.optional(Schema.String),
|
|
16
|
+
ended: Schema.optional(Schema.String),
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Queue containing TranscriptBlock objects.
|
|
@@ -32,31 +33,8 @@ export class TranscriptType extends TypedObject({
|
|
|
32
33
|
* First message in queue.
|
|
33
34
|
* Contains metadata for the recording and transcript.
|
|
34
35
|
*/
|
|
35
|
-
const TranscriptHeader =
|
|
36
|
-
started:
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
export type TranscriptHeader = S.Schema.Type<typeof TranscriptHeader>;
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Transcription fragment.
|
|
43
|
-
*/
|
|
44
|
-
const TranscriptSegment = S.Struct({
|
|
45
|
-
// TODO(burdon): TS from service is not Unix TS (x1000).
|
|
46
|
-
started: S.Date,
|
|
47
|
-
text: S.String,
|
|
36
|
+
const TranscriptHeader = Schema.Struct({
|
|
37
|
+
started: Schema.optional(Schema.String),
|
|
48
38
|
});
|
|
49
39
|
|
|
50
|
-
export type
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Transcription block (from single speaker).
|
|
54
|
-
*/
|
|
55
|
-
export const TranscriptBlock = S.Struct({
|
|
56
|
-
id: S.String,
|
|
57
|
-
authorName: S.optional(S.String), // TODO(burdon): IdentityDid.
|
|
58
|
-
authorHue: S.optional(S.String),
|
|
59
|
-
segments: S.Array(TranscriptSegment),
|
|
60
|
-
}).pipe(EchoObject({ typename: 'dxos.org/type/TranscriptBlock', version: '0.1.0' }));
|
|
61
|
-
|
|
62
|
-
export type TranscriptBlock = S.Schema.Type<typeof TranscriptBlock>;
|
|
40
|
+
export type TranscriptHeader = Schema.Schema.Type<typeof TranscriptHeader>;
|
package/src/types/types.ts
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
6
|
-
|
|
5
|
+
import { Schema } from 'effect';
|
|
6
|
+
|
|
7
|
+
import { SpaceId } from '@dxos/react-client/echo';
|
|
7
8
|
|
|
8
9
|
import { TranscriptType } from './schema';
|
|
9
10
|
import { TRANSCRIPTION_PLUGIN } from '../meta';
|
|
@@ -19,18 +20,13 @@ export const TRANSCRIPTION_URL = 'https://calls-service.dxos.workers.dev';
|
|
|
19
20
|
export namespace TranscriptionAction {
|
|
20
21
|
const TRANSCRIPTION_ACTION = `${TRANSCRIPTION_PLUGIN}/action`;
|
|
21
22
|
|
|
22
|
-
export class Create extends
|
|
23
|
-
input:
|
|
24
|
-
name:
|
|
25
|
-
|
|
26
|
-
spaceId: S.String,
|
|
23
|
+
export class Create extends Schema.TaggedClass<Create>()(`${TRANSCRIPTION_ACTION}/create`, {
|
|
24
|
+
input: Schema.Struct({
|
|
25
|
+
name: Schema.optional(Schema.String),
|
|
26
|
+
spaceId: SpaceId,
|
|
27
27
|
}),
|
|
28
|
-
output:
|
|
28
|
+
output: Schema.Struct({
|
|
29
29
|
object: TranscriptType,
|
|
30
30
|
}),
|
|
31
31
|
}) {}
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
export const isTranscript = (object: unknown): object is typeof TranscriptType => {
|
|
35
|
-
return isReactiveObject(object) && isInstanceOf(TranscriptType, object);
|
|
36
|
-
};
|
package/src/util/index.ts
CHANGED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TranscriptContainer_default,
|
|
3
|
-
TranscriptionContainer
|
|
4
|
-
} from "./chunk-G4B6CPC2.mjs";
|
|
5
|
-
import "./chunk-6ZR5MDK3.mjs";
|
|
6
|
-
export {
|
|
7
|
-
TranscriptionContainer,
|
|
8
|
-
TranscriptContainer_default as default
|
|
9
|
-
};
|
|
10
|
-
//# sourceMappingURL=TranscriptContainer-JQ3HFHLQ.mjs.map
|
|
@@ -1,191 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TranscriptionManager
|
|
3
|
-
} from "./chunk-YCZISX63.mjs";
|
|
4
|
-
import "./chunk-GU2BNYKZ.mjs";
|
|
5
|
-
import {
|
|
6
|
-
TranscriptionCapabilities
|
|
7
|
-
} from "./chunk-YEPT334A.mjs";
|
|
8
|
-
import {
|
|
9
|
-
TranscriptType,
|
|
10
|
-
TranscriptionAction
|
|
11
|
-
} from "./chunk-OGNXNGJB.mjs";
|
|
12
|
-
import {
|
|
13
|
-
TRANSCRIPTION_PLUGIN
|
|
14
|
-
} from "./chunk-6ZR5MDK3.mjs";
|
|
15
|
-
|
|
16
|
-
// packages/plugins/plugin-transcription/src/capabilities/app-graph-builder.ts
|
|
17
|
-
import { Capabilities, contributes, createIntent } from "@dxos/app-framework";
|
|
18
|
-
import { fullyQualifiedId, getSpace, makeRef } from "@dxos/client/echo";
|
|
19
|
-
import { generateName } from "@dxos/display-name";
|
|
20
|
-
import { getSchemaTypename, isInstanceOf } from "@dxos/echo-schema";
|
|
21
|
-
import { invariant } from "@dxos/invariant";
|
|
22
|
-
import { ClientCapabilities } from "@dxos/plugin-client";
|
|
23
|
-
import { PLANK_COMPANION_TYPE, ATTENDABLE_PATH_SEPARATOR } from "@dxos/plugin-deck/types";
|
|
24
|
-
import { createExtension } from "@dxos/plugin-graph";
|
|
25
|
-
import { MeetingCapabilities } from "@dxos/plugin-meeting";
|
|
26
|
-
import { MeetingType } from "@dxos/plugin-meeting/types";
|
|
27
|
-
import { buf } from "@dxos/protocols/buf";
|
|
28
|
-
import { TranscriptionPayloadSchema } from "@dxos/protocols/buf/dxos/edge/calls_pb";
|
|
29
|
-
import { keyToFallback } from "@dxos/util";
|
|
30
|
-
var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-transcription/src/capabilities/app-graph-builder.ts";
|
|
31
|
-
var codec = {
|
|
32
|
-
encode: (message) => {
|
|
33
|
-
return buf.toBinary(TranscriptionPayloadSchema, buf.create(TranscriptionPayloadSchema, message));
|
|
34
|
-
},
|
|
35
|
-
decode: (message) => {
|
|
36
|
-
return buf.fromBinary(TranscriptionPayloadSchema, message);
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
var getMeetingTranscript = async (context, meeting) => {
|
|
40
|
-
const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);
|
|
41
|
-
const typename = getSchemaTypename(TranscriptType);
|
|
42
|
-
const existing = await meeting.artifacts[typename]?.load();
|
|
43
|
-
if (existing instanceof TranscriptType) {
|
|
44
|
-
return existing;
|
|
45
|
-
}
|
|
46
|
-
const space = getSpace(meeting);
|
|
47
|
-
invariant(space, void 0, {
|
|
48
|
-
F: __dxlog_file,
|
|
49
|
-
L: 52,
|
|
50
|
-
S: void 0,
|
|
51
|
-
A: [
|
|
52
|
-
"space",
|
|
53
|
-
""
|
|
54
|
-
]
|
|
55
|
-
});
|
|
56
|
-
const { data } = await dispatch(createIntent(TranscriptionAction.Create, {
|
|
57
|
-
spaceId: space.id
|
|
58
|
-
}));
|
|
59
|
-
meeting.artifacts[typename] = makeRef(data.object);
|
|
60
|
-
return data?.object;
|
|
61
|
-
};
|
|
62
|
-
var app_graph_builder_default = (context) => contributes(Capabilities.AppGraphBuilder, [
|
|
63
|
-
createExtension({
|
|
64
|
-
id: `${TRANSCRIPTION_PLUGIN}/meeting-transcript`,
|
|
65
|
-
filter: (node) => isInstanceOf(MeetingType, node.data) && node.type !== PLANK_COMPANION_TYPE,
|
|
66
|
-
actions: ({ node }) => {
|
|
67
|
-
const meeting = node.data;
|
|
68
|
-
const state = context.requestCapability(TranscriptionCapabilities.MeetingTranscriptionState);
|
|
69
|
-
return [
|
|
70
|
-
{
|
|
71
|
-
id: `${fullyQualifiedId(meeting)}/action/start-stop-transcription`,
|
|
72
|
-
data: async () => {
|
|
73
|
-
const call = context.requestCapability(MeetingCapabilities.CallManager);
|
|
74
|
-
invariant(state.transcriptionManager, void 0, {
|
|
75
|
-
F: __dxlog_file,
|
|
76
|
-
L: 73,
|
|
77
|
-
S: void 0,
|
|
78
|
-
A: [
|
|
79
|
-
"state.transcriptionManager",
|
|
80
|
-
""
|
|
81
|
-
]
|
|
82
|
-
});
|
|
83
|
-
state.enabled = !state.enabled;
|
|
84
|
-
void state.transcriptionManager.setEnabled(state.enabled);
|
|
85
|
-
const transcript = await getMeetingTranscript(context, meeting);
|
|
86
|
-
invariant(transcript, "Failed to create transcript", {
|
|
87
|
-
F: __dxlog_file,
|
|
88
|
-
L: 77,
|
|
89
|
-
S: void 0,
|
|
90
|
-
A: [
|
|
91
|
-
"transcript",
|
|
92
|
-
"'Failed to create transcript'"
|
|
93
|
-
]
|
|
94
|
-
});
|
|
95
|
-
call.setActivity(getSchemaTypename(TranscriptType), {
|
|
96
|
-
value: codec.encode({
|
|
97
|
-
enabled: state.enabled,
|
|
98
|
-
queueDxn: transcript.queue.dxn.toString()
|
|
99
|
-
})
|
|
100
|
-
});
|
|
101
|
-
},
|
|
102
|
-
properties: {
|
|
103
|
-
label: state.enabled ? [
|
|
104
|
-
"stop transcription label",
|
|
105
|
-
{
|
|
106
|
-
ns: TRANSCRIPTION_PLUGIN
|
|
107
|
-
}
|
|
108
|
-
] : [
|
|
109
|
-
"start transcription label",
|
|
110
|
-
{
|
|
111
|
-
ns: TRANSCRIPTION_PLUGIN
|
|
112
|
-
}
|
|
113
|
-
],
|
|
114
|
-
icon: "ph--record--regular",
|
|
115
|
-
disposition: "toolbar",
|
|
116
|
-
classNames: state.enabled ? "text-activeInCall" : ""
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
];
|
|
120
|
-
},
|
|
121
|
-
connector: ({ node }) => {
|
|
122
|
-
const meeting = node.data;
|
|
123
|
-
const client = context.requestCapability(ClientCapabilities.Client);
|
|
124
|
-
const state = context.requestCapability(TranscriptionCapabilities.MeetingTranscriptionState);
|
|
125
|
-
return [
|
|
126
|
-
{
|
|
127
|
-
id: `${fullyQualifiedId(meeting)}${ATTENDABLE_PATH_SEPARATOR}${getSchemaTypename(TranscriptType)}`,
|
|
128
|
-
type: PLANK_COMPANION_TYPE,
|
|
129
|
-
data: meeting.artifacts[getSchemaTypename(TranscriptType)]?.target,
|
|
130
|
-
properties: {
|
|
131
|
-
label: [
|
|
132
|
-
"transcript companion label",
|
|
133
|
-
{
|
|
134
|
-
ns: TRANSCRIPTION_PLUGIN
|
|
135
|
-
}
|
|
136
|
-
],
|
|
137
|
-
icon: "ph--subtitles--regular",
|
|
138
|
-
disposition: "hidden",
|
|
139
|
-
schema: TranscriptType,
|
|
140
|
-
getIntent: ({ space }) => createIntent(TranscriptionAction.Create, {
|
|
141
|
-
spaceId: space.id
|
|
142
|
-
}),
|
|
143
|
-
onJoin: () => {
|
|
144
|
-
const transcriptionManager = new TranscriptionManager(client.edge);
|
|
145
|
-
const identity = client.halo.identity.get();
|
|
146
|
-
invariant(identity, void 0, {
|
|
147
|
-
F: __dxlog_file,
|
|
148
|
-
L: 116,
|
|
149
|
-
S: void 0,
|
|
150
|
-
A: [
|
|
151
|
-
"identity",
|
|
152
|
-
""
|
|
153
|
-
]
|
|
154
|
-
});
|
|
155
|
-
transcriptionManager.setName(identity.profile?.displayName ?? generateName(identity.identityKey.toHex()));
|
|
156
|
-
const fallbackValue = keyToFallback(identity.identityKey);
|
|
157
|
-
const userHue = identity.profile?.data?.hue || fallbackValue.hue;
|
|
158
|
-
transcriptionManager.setHue(userHue);
|
|
159
|
-
void transcriptionManager.open();
|
|
160
|
-
state.transcriptionManager = transcriptionManager;
|
|
161
|
-
},
|
|
162
|
-
onLeave: () => {
|
|
163
|
-
void state.transcriptionManager?.close();
|
|
164
|
-
state.transcriptionManager = void 0;
|
|
165
|
-
state.enabled = false;
|
|
166
|
-
},
|
|
167
|
-
onCallStateUpdated: (callState) => {
|
|
168
|
-
const typename = getSchemaTypename(TranscriptType);
|
|
169
|
-
const transcription = typename ? callState.activities?.[typename] : void 0;
|
|
170
|
-
if (!transcription?.payload?.value) {
|
|
171
|
-
return;
|
|
172
|
-
}
|
|
173
|
-
const payload = codec.decode(transcription.payload.value);
|
|
174
|
-
state.enabled = payload.enabled;
|
|
175
|
-
void state.transcriptionManager?.setEnabled(payload.enabled);
|
|
176
|
-
void state.transcriptionManager?.setQueue(payload.queueDxn);
|
|
177
|
-
},
|
|
178
|
-
onMediaStateUpdated: ([mediaState, isSpeaking]) => {
|
|
179
|
-
void state.transcriptionManager?.setAudioTrack(mediaState.audioTrack);
|
|
180
|
-
void state.transcriptionManager?.setRecording(isSpeaking);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
];
|
|
185
|
-
}
|
|
186
|
-
})
|
|
187
|
-
]);
|
|
188
|
-
export {
|
|
189
|
-
app_graph_builder_default as default
|
|
190
|
-
};
|
|
191
|
-
//# sourceMappingURL=app-graph-builder-VDQOVX7P.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/app-graph-builder.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes, createIntent, type PluginsContext } from '@dxos/app-framework';\nimport { fullyQualifiedId, getSpace, makeRef, type Space } from '@dxos/client/echo';\nimport { generateName } from '@dxos/display-name';\nimport { getSchemaTypename, isInstanceOf } from '@dxos/echo-schema';\nimport { invariant } from '@dxos/invariant';\nimport { ClientCapabilities } from '@dxos/plugin-client';\nimport { PLANK_COMPANION_TYPE, ATTENDABLE_PATH_SEPARATOR } from '@dxos/plugin-deck/types';\nimport { createExtension, type Node } from '@dxos/plugin-graph';\nimport { MeetingCapabilities, type CallState, type MediaState } from '@dxos/plugin-meeting';\nimport { MeetingType } from '@dxos/plugin-meeting/types';\nimport { buf } from '@dxos/protocols/buf';\nimport {\n TranscriptionPayloadSchema,\n type TranscriptionPayload as TranscriptionPayloadProto,\n} from '@dxos/protocols/buf/dxos/edge/calls_pb';\nimport { keyToFallback } from '@dxos/util';\n\nimport { TranscriptionCapabilities } from './capabilities';\nimport { TRANSCRIPTION_PLUGIN } from '../meta';\nimport { TranscriptionManager } from '../transcriber';\nimport { TranscriptionAction, TranscriptType } from '../types';\n\n// TODO(wittjosiah): Factor out.\n// TODO(wittjosiah): Can we stop using protobuf for this?\ntype TranscriptionPayload = buf.MessageInitShape<typeof TranscriptionPayloadSchema>;\nconst codec = {\n encode: (message: TranscriptionPayload): Uint8Array => {\n return buf.toBinary(TranscriptionPayloadSchema, buf.create(TranscriptionPayloadSchema, message));\n },\n decode: (message: Uint8Array): TranscriptionPayloadProto => {\n return buf.fromBinary(TranscriptionPayloadSchema, message);\n },\n};\n\nconst getMeetingTranscript = async (\n context: PluginsContext,\n meeting: MeetingType,\n): Promise<TranscriptType | undefined> => {\n const { dispatchPromise: dispatch } = context.requestCapability(Capabilities.IntentDispatcher);\n\n const typename = getSchemaTypename(TranscriptType)!;\n const existing = await meeting.artifacts[typename]?.load();\n if (existing instanceof TranscriptType) {\n return existing;\n }\n\n const space = getSpace(meeting);\n invariant(space);\n const { data } = await dispatch(createIntent(TranscriptionAction.Create, { spaceId: space.id }));\n meeting.artifacts[typename] = makeRef(data!.object);\n return data?.object;\n};\n\n// TODO(wittjosiah): Introduce a sound that plays when transcription is activated/deactivated.\nexport default (context: PluginsContext) =>\n contributes(Capabilities.AppGraphBuilder, [\n createExtension({\n id: `${TRANSCRIPTION_PLUGIN}/meeting-transcript`,\n filter: (node): node is Node<MeetingType> =>\n isInstanceOf(MeetingType, node.data) && node.type !== PLANK_COMPANION_TYPE,\n actions: ({ node }) => {\n const meeting = node.data;\n const state = context.requestCapability(TranscriptionCapabilities.MeetingTranscriptionState);\n return [\n {\n id: `${fullyQualifiedId(meeting)}/action/start-stop-transcription`,\n data: async () => {\n const call = context.requestCapability(MeetingCapabilities.CallManager);\n invariant(state.transcriptionManager);\n state.enabled = !state.enabled;\n void state.transcriptionManager.setEnabled(state.enabled);\n const transcript = await getMeetingTranscript(context, meeting);\n invariant(transcript, 'Failed to create transcript');\n call.setActivity(getSchemaTypename(TranscriptType)!, {\n value: codec.encode({\n enabled: state.enabled,\n queueDxn: transcript.queue.dxn.toString(),\n }),\n });\n },\n properties: {\n label: state.enabled\n ? ['stop transcription label', { ns: TRANSCRIPTION_PLUGIN }]\n : ['start transcription label', { ns: TRANSCRIPTION_PLUGIN }],\n icon: 'ph--record--regular',\n disposition: 'toolbar',\n classNames: state.enabled ? 'text-activeInCall' : '',\n },\n },\n ];\n },\n connector: ({ node }) => {\n const meeting = node.data;\n const client = context.requestCapability(ClientCapabilities.Client);\n const state = context.requestCapability(TranscriptionCapabilities.MeetingTranscriptionState);\n\n return [\n {\n id: `${fullyQualifiedId(meeting)}${ATTENDABLE_PATH_SEPARATOR}${getSchemaTypename(TranscriptType)}`,\n type: PLANK_COMPANION_TYPE,\n data: meeting.artifacts[getSchemaTypename(TranscriptType)!]?.target,\n properties: {\n label: ['transcript companion label', { ns: TRANSCRIPTION_PLUGIN }],\n icon: 'ph--subtitles--regular',\n disposition: 'hidden',\n schema: TranscriptType,\n getIntent: ({ space }: { space: Space }) =>\n createIntent(TranscriptionAction.Create, { spaceId: space.id }),\n onJoin: () => {\n const transcriptionManager = new TranscriptionManager(client.edge);\n const identity = client.halo.identity.get();\n invariant(identity);\n transcriptionManager.setName(\n identity.profile?.displayName ?? generateName(identity.identityKey.toHex()),\n );\n const fallbackValue = keyToFallback(identity!.identityKey);\n const userHue = identity!.profile?.data?.hue || fallbackValue.hue;\n transcriptionManager.setHue(userHue);\n void transcriptionManager.open();\n state.transcriptionManager = transcriptionManager;\n },\n onLeave: () => {\n void state.transcriptionManager?.close();\n state.transcriptionManager = undefined;\n state.enabled = false;\n },\n onCallStateUpdated: (callState: CallState) => {\n const typename = getSchemaTypename(TranscriptType);\n const transcription = typename ? callState.activities?.[typename] : undefined;\n if (!transcription?.payload?.value) {\n return;\n }\n\n const payload = codec.decode(transcription.payload.value);\n state.enabled = payload.enabled;\n void state.transcriptionManager?.setEnabled(payload.enabled);\n void state.transcriptionManager?.setQueue(payload.queueDxn);\n },\n onMediaStateUpdated: ([mediaState, isSpeaking]: [MediaState, boolean]) => {\n void state.transcriptionManager?.setAudioTrack(mediaState.audioTrack);\n void state.transcriptionManager?.setRecording(isSpeaking);\n },\n },\n },\n ];\n },\n }),\n ]);\n"],
|
|
5
|
-
"mappings": "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",
|
|
6
|
-
"names": ["Capabilities", "contributes", "createIntent", "fullyQualifiedId", "getSpace", "makeRef", "generateName", "getSchemaTypename", "isInstanceOf", "invariant", "ClientCapabilities", "PLANK_COMPANION_TYPE", "ATTENDABLE_PATH_SEPARATOR", "createExtension", "MeetingCapabilities", "MeetingType", "buf", "TranscriptionPayloadSchema", "keyToFallback", "codec", "encode", "message", "buf", "toBinary", "TranscriptionPayloadSchema", "create", "decode", "fromBinary", "getMeetingTranscript", "context", "meeting", "dispatchPromise", "dispatch", "requestCapability", "Capabilities", "IntentDispatcher", "typename", "getSchemaTypename", "TranscriptType", "existing", "artifacts", "load", "space", "getSpace", "invariant", "data", "createIntent", "TranscriptionAction", "Create", "spaceId", "id", "makeRef", "object", "contributes", "AppGraphBuilder", "createExtension", "TRANSCRIPTION_PLUGIN", "filter", "node", "isInstanceOf", "MeetingType", "type", "PLANK_COMPANION_TYPE", "actions", "state", "TranscriptionCapabilities", "MeetingTranscriptionState", "fullyQualifiedId", "call", "MeetingCapabilities", "CallManager", "transcriptionManager", "enabled", "setEnabled", "transcript", "setActivity", "value", "queueDxn", "queue", "dxn", "toString", "properties", "label", "ns", "icon", "disposition", "classNames", "connector", "client", "ClientCapabilities", "Client", "ATTENDABLE_PATH_SEPARATOR", "target", "schema", "getIntent", "onJoin", "TranscriptionManager", "edge", "identity", "halo", "get", "setName", "profile", "displayName", "generateName", "identityKey", "toHex", "fallbackValue", "keyToFallback", "userHue", "hue", "setHue", "open", "onLeave", "close", "undefined", "onCallStateUpdated", "callState", "transcription", "activities", "payload", "setQueue", "onMediaStateUpdated", "mediaState", "isSpeaking", "setAudioTrack", "audioTrack", "setRecording"]
|
|
7
|
-
}
|