@dxos/plugin-transcription 0.8.2-main.12df754 → 0.8.2-main.36232bc
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-4D4BHE7G.mjs → TranscriptContainer-2VFHUHLE.mjs} +3 -3
- package/dist/lib/browser/app-graph-builder-TDP6PYV6.mjs +350 -0
- package/dist/lib/browser/app-graph-builder-TDP6PYV6.mjs.map +7 -0
- package/dist/lib/browser/{chunk-DR3NBV6Q.mjs → chunk-KSUYWWIU.mjs} +105 -78
- package/dist/lib/browser/chunk-KSUYWWIU.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5BE6RTNC.mjs → chunk-LTIQFX4W.mjs} +1 -1
- package/dist/lib/browser/{chunk-5BE6RTNC.mjs.map → chunk-LTIQFX4W.mjs.map} +1 -1
- package/dist/lib/browser/{chunk-RHHJZQPM.mjs → chunk-NFVDICSJ.mjs} +133 -116
- package/dist/lib/browser/chunk-NFVDICSJ.mjs.map +7 -0
- package/dist/lib/browser/chunk-O6RY7FNK.mjs +27 -0
- package/dist/lib/browser/chunk-O6RY7FNK.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5Q3R53U3.mjs → chunk-YRWBY6UK.mjs} +9 -21
- package/dist/lib/browser/chunk-YRWBY6UK.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +29 -17
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/{intent-resolver-ZQQEH27F.mjs → intent-resolver-ZWKYRFE7.mjs} +4 -4
- package/dist/lib/browser/{intent-resolver-ZQQEH27F.mjs.map → intent-resolver-ZWKYRFE7.mjs.map} +2 -2
- package/dist/lib/browser/{meeting-transcription-state-5D52VTHU.mjs → meeting-transcription-state-MNA2XROE.mjs} +2 -2
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-HETJ5XY6.mjs → react-surface-F32UNCKZ.mjs} +18 -7
- package/dist/lib/browser/react-surface-F32UNCKZ.mjs.map +7 -0
- package/dist/lib/browser/settings-6YAHKVKX.mjs +24 -0
- package/dist/lib/browser/settings-6YAHKVKX.mjs.map +7 -0
- package/dist/lib/browser/{transcriber-SMRLU2KY.mjs → transcriber-MSBS4VBI.mjs} +4 -4
- package/dist/lib/browser/types/index.mjs +3 -3
- package/dist/lib/node/{TranscriptContainer-ZWP6UKY6.cjs → TranscriptContainer-E2D7PKO3.cjs} +8 -8
- package/dist/lib/node/{TranscriptContainer-ZWP6UKY6.cjs.map → TranscriptContainer-E2D7PKO3.cjs.map} +2 -2
- package/dist/lib/node/app-graph-builder-W4VDMVGV.cjs +351 -0
- package/dist/lib/node/app-graph-builder-W4VDMVGV.cjs.map +7 -0
- package/dist/lib/node/{chunk-LA73IHCB.cjs → chunk-7XIIUVN3.cjs} +108 -80
- package/dist/lib/node/chunk-7XIIUVN3.cjs.map +7 -0
- package/dist/lib/node/{chunk-3QEJ5EBO.cjs → chunk-IXU57SCA.cjs} +10 -22
- package/dist/lib/node/chunk-IXU57SCA.cjs.map +7 -0
- package/dist/lib/node/{chunk-HYGDHS6X.cjs → chunk-JUGOXWES.cjs} +4 -4
- package/dist/lib/node/{chunk-HYGDHS6X.cjs.map → chunk-JUGOXWES.cjs.map} +1 -1
- package/dist/lib/node/{chunk-KO6MKCED.cjs → chunk-NBC6V3M2.cjs} +136 -118
- package/dist/lib/node/chunk-NBC6V3M2.cjs.map +7 -0
- package/dist/lib/node/{chunk-WXG4Z2EZ.cjs → chunk-TJMZ26GS.cjs} +23 -8
- package/dist/lib/node/chunk-TJMZ26GS.cjs.map +7 -0
- package/dist/lib/node/index.cjs +46 -34
- package/dist/lib/node/index.cjs.map +3 -3
- package/dist/lib/node/{intent-resolver-VY3XWYAA.cjs → intent-resolver-RM4JOCDV.cjs} +8 -8
- package/dist/lib/node/{intent-resolver-VY3XWYAA.cjs.map → intent-resolver-RM4JOCDV.cjs.map} +2 -2
- package/dist/lib/node/{meeting-transcription-state-OYWCY5XE.cjs → meeting-transcription-state-5XLTMWPA.cjs} +6 -6
- package/dist/lib/node/meta.json +1 -1
- package/dist/lib/node/{react-surface-M2JQIIDY.cjs → react-surface-YQHBGPOC.cjs} +20 -11
- package/dist/lib/node/react-surface-YQHBGPOC.cjs.map +7 -0
- package/dist/lib/node/settings-ZMB4XRWS.cjs +38 -0
- package/dist/lib/node/settings-ZMB4XRWS.cjs.map +7 -0
- package/dist/lib/node/{transcriber-E6AAB4SU.cjs → transcriber-55OE4X6I.cjs} +10 -10
- package/dist/lib/node/types/index.cjs +8 -8
- package/dist/lib/node/types/index.cjs.map +1 -1
- package/dist/lib/node-esm/{TranscriptContainer-3HJ752CP.mjs → TranscriptContainer-5N3BSK2S.mjs} +3 -3
- package/dist/lib/node-esm/app-graph-builder-DDDVKUHS.mjs +351 -0
- package/dist/lib/node-esm/app-graph-builder-DDDVKUHS.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-SDMGJZLN.mjs → chunk-4RMJO6QQ.mjs} +133 -116
- package/dist/lib/node-esm/chunk-4RMJO6QQ.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YXZOLOFT.mjs → chunk-5E2MR5XK.mjs} +1 -1
- package/dist/lib/node-esm/{chunk-YXZOLOFT.mjs.map → chunk-5E2MR5XK.mjs.map} +1 -1
- package/dist/lib/node-esm/chunk-HZBSWUJH.mjs +28 -0
- package/dist/lib/node-esm/chunk-HZBSWUJH.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-54HDN33F.mjs → chunk-OS2ITZUL.mjs} +9 -21
- package/dist/lib/node-esm/chunk-OS2ITZUL.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-K3R3YK3S.mjs → chunk-UWF6LM27.mjs} +105 -78
- package/dist/lib/node-esm/chunk-UWF6LM27.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +29 -17
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/{intent-resolver-FCTNJPWY.mjs → intent-resolver-HDRFXMKP.mjs} +4 -4
- package/dist/lib/node-esm/{intent-resolver-FCTNJPWY.mjs.map → intent-resolver-HDRFXMKP.mjs.map} +2 -2
- package/dist/lib/node-esm/{meeting-transcription-state-XMZJ45P4.mjs → meeting-transcription-state-3WOZ52BQ.mjs} +2 -2
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-PXFSIM6V.mjs → react-surface-DRDNXTFZ.mjs} +18 -7
- package/dist/lib/node-esm/react-surface-DRDNXTFZ.mjs.map +7 -0
- package/dist/lib/node-esm/settings-I35TVDUG.mjs +25 -0
- package/dist/lib/node-esm/settings-I35TVDUG.mjs.map +7 -0
- package/dist/lib/node-esm/{transcriber-REAGRCPY.mjs → transcriber-HH7EMCGH.mjs} +4 -4
- package/dist/lib/node-esm/types/index.mjs +3 -3
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/app-graph-builder.d.ts.map +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts +1 -1
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +1 -0
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
- package/dist/types/src/capabilities/settings.d.ts +4 -0
- package/dist/types/src/capabilities/settings.d.ts.map +1 -0
- package/dist/types/src/components/Transcript/Transcript.d.ts +6 -4
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +8 -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 +4 -4
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -1
- package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/TranscriptionSettings/TranscriptionSettings.d.ts +6 -0
- package/dist/types/src/components/TranscriptionSettings/TranscriptionSettings.d.ts.map +1 -0
- package/dist/types/src/components/TranscriptionSettings/index.d.ts +2 -0
- package/dist/types/src/components/TranscriptionSettings/index.d.ts.map +1 -0
- package/dist/types/src/components/index.d.ts +1 -0
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/transcription.stories.d.ts +6 -3
- package/dist/types/src/components/transcription.stories.d.ts.map +1 -1
- package/dist/types/src/entity-extraction/entity-extraction.d.ts +33 -7
- package/dist/types/src/entity-extraction/entity-extraction.d.ts.map +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts +2 -2
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
- package/dist/types/src/model/model.d.ts +23 -23
- package/dist/types/src/model/model.d.ts.map +1 -1
- 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 +39 -0
- package/dist/types/src/testing/testing.d.ts.map +1 -0
- 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 +17 -15
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/translations.d.ts +3 -0
- package/dist/types/src/translations.d.ts.map +1 -1
- package/dist/types/src/types/schema.d.ts +0 -21
- package/dist/types/src/types/schema.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +5 -1
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/package.json +48 -45
- package/src/TranscriptionPlugin.tsx +29 -12
- package/src/capabilities/app-graph-builder.ts +99 -29
- package/src/capabilities/capabilities.ts +1 -1
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +2 -2
- package/src/capabilities/react-surface.tsx +12 -4
- package/src/capabilities/settings.ts +20 -0
- package/src/components/Transcript/Transcript.stories.tsx +71 -35
- package/src/components/Transcript/Transcript.tsx +30 -29
- package/src/components/Transcript/deprecated/{Transcript.tsx → OldTranscript.tsx} +24 -1
- package/src/components/Transcript/transcript-extension.ts +20 -17
- package/src/components/TranscriptContainer.tsx +6 -4
- package/src/components/TranscriptionSettings/TranscriptionSettings.tsx +26 -0
- package/src/components/TranscriptionSettings/index.ts +5 -0
- package/src/components/index.ts +1 -0
- package/src/components/transcription.stories.tsx +77 -29
- package/src/entity-extraction/entity-extraction.test.ts +55 -9
- package/src/entity-extraction/entity-extraction.ts +105 -55
- package/src/entity-extraction/system-prompt.tpl +38 -9
- package/src/hooks/useQueueModelAdapter.ts +44 -11
- package/src/model/model.test.ts +85 -43
- package/src/model/model.ts +59 -59
- package/src/testing/index.ts +5 -0
- package/src/testing/testing.ts +208 -0
- package/src/transcriber/transcriber.browser.test.ts +3 -3
- package/src/transcriber/transcriber.ts +16 -10
- package/src/transcriber/transcription-manager.ts +66 -57
- package/src/translations.ts +2 -0
- package/src/types/schema.ts +1 -24
- package/src/types/types.ts +11 -3
- package/dist/lib/browser/app-graph-builder-I4SSIQMW.mjs +0 -168
- package/dist/lib/browser/app-graph-builder-I4SSIQMW.mjs.map +0 -7
- package/dist/lib/browser/chunk-5Q3R53U3.mjs.map +0 -7
- package/dist/lib/browser/chunk-DR3NBV6Q.mjs.map +0 -7
- package/dist/lib/browser/chunk-GI5LZ4SV.mjs +0 -8
- package/dist/lib/browser/chunk-GI5LZ4SV.mjs.map +0 -7
- package/dist/lib/browser/chunk-RHHJZQPM.mjs.map +0 -7
- package/dist/lib/browser/react-surface-HETJ5XY6.mjs.map +0 -7
- package/dist/lib/node/app-graph-builder-WWC4WNTG.cjs +0 -177
- package/dist/lib/node/app-graph-builder-WWC4WNTG.cjs.map +0 -7
- package/dist/lib/node/chunk-3QEJ5EBO.cjs.map +0 -7
- package/dist/lib/node/chunk-KO6MKCED.cjs.map +0 -7
- package/dist/lib/node/chunk-LA73IHCB.cjs.map +0 -7
- package/dist/lib/node/chunk-WXG4Z2EZ.cjs.map +0 -7
- package/dist/lib/node/react-surface-M2JQIIDY.cjs.map +0 -7
- package/dist/lib/node-esm/app-graph-builder-PPJQAFSI.mjs +0 -169
- package/dist/lib/node-esm/app-graph-builder-PPJQAFSI.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-54HDN33F.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K3R3YK3S.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SDMGJZLN.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XY22OP6H.mjs +0 -10
- package/dist/lib/node-esm/chunk-XY22OP6H.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-PXFSIM6V.mjs.map +0 -7
- package/dist/types/src/components/Transcript/deprecated/Transcript.d.ts +0 -13
- package/dist/types/src/components/Transcript/deprecated/Transcript.d.ts.map +0 -1
- package/dist/types/src/components/Transcript/testings.d.ts +0 -51
- package/dist/types/src/components/Transcript/testings.d.ts.map +0 -1
- package/dist/types/src/testing/test-data.d.ts +0 -73
- package/dist/types/src/testing/test-data.d.ts.map +0 -1
- package/src/components/Transcript/testings.ts +0 -182
- package/src/testing/test-data.ts +0 -314
- /package/dist/lib/browser/{TranscriptContainer-4D4BHE7G.mjs.map → TranscriptContainer-2VFHUHLE.mjs.map} +0 -0
- /package/dist/lib/browser/{meeting-transcription-state-5D52VTHU.mjs.map → meeting-transcription-state-MNA2XROE.mjs.map} +0 -0
- /package/dist/lib/browser/{transcriber-SMRLU2KY.mjs.map → transcriber-MSBS4VBI.mjs.map} +0 -0
- /package/dist/lib/node/{meeting-transcription-state-OYWCY5XE.cjs.map → meeting-transcription-state-5XLTMWPA.cjs.map} +0 -0
- /package/dist/lib/node/{transcriber-E6AAB4SU.cjs.map → transcriber-55OE4X6I.cjs.map} +0 -0
- /package/dist/lib/node-esm/{TranscriptContainer-3HJ752CP.mjs.map → TranscriptContainer-5N3BSK2S.mjs.map} +0 -0
- /package/dist/lib/node-esm/{meeting-transcription-state-XMZJ45P4.mjs.map → meeting-transcription-state-3WOZ52BQ.mjs.map} +0 -0
- /package/dist/lib/node-esm/{transcriber-REAGRCPY.mjs.map → transcriber-HH7EMCGH.mjs.map} +0 -0
|
@@ -26,15 +26,15 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
26
26
|
mod
|
|
27
27
|
));
|
|
28
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
var
|
|
30
|
-
__export(
|
|
29
|
+
var chunk_7XIIUVN3_exports = {};
|
|
30
|
+
__export(chunk_7XIIUVN3_exports, {
|
|
31
31
|
MediaStreamRecorder: () => MediaStreamRecorder,
|
|
32
32
|
Transcriber: () => Transcriber,
|
|
33
33
|
TranscriptionManager: () => TranscriptionManager
|
|
34
34
|
});
|
|
35
|
-
module.exports = __toCommonJS(
|
|
35
|
+
module.exports = __toCommonJS(chunk_7XIIUVN3_exports);
|
|
36
36
|
var import_chunk_J72PUQ3C = require("./chunk-J72PUQ3C.cjs");
|
|
37
|
-
var
|
|
37
|
+
var import_chunk_IXU57SCA = require("./chunk-IXU57SCA.cjs");
|
|
38
38
|
var import_extendable_media_recorder = require("extendable-media-recorder");
|
|
39
39
|
var import_wavefile = require("wavefile");
|
|
40
40
|
var import_async = require("@dxos/async");
|
|
@@ -50,8 +50,8 @@ var import_async3 = require("@dxos/async");
|
|
|
50
50
|
var import_context2 = require("@dxos/context");
|
|
51
51
|
var import_echo_db = require("@dxos/echo-db");
|
|
52
52
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
53
|
-
var
|
|
54
|
-
var
|
|
53
|
+
var import_log3 = require("@dxos/log");
|
|
54
|
+
var import_schema = require("@dxos/schema");
|
|
55
55
|
function _ts_decorate(decorators, target, key, desc) {
|
|
56
56
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
57
57
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -182,17 +182,35 @@ var Transcriber = class extends import_context.Resource {
|
|
|
182
182
|
this._onSegments = onSegments;
|
|
183
183
|
}
|
|
184
184
|
async _open(ctx) {
|
|
185
|
+
import_log2.log.info("opening", void 0, {
|
|
186
|
+
F: __dxlog_file2,
|
|
187
|
+
L: 97,
|
|
188
|
+
S: this,
|
|
189
|
+
C: (f, a) => f(...a)
|
|
190
|
+
});
|
|
185
191
|
this._recorder.setOnChunk((chunk) => this._saveAudioChunk(chunk));
|
|
186
192
|
await this._recorder.start();
|
|
187
193
|
this._transcribeTask = new import_async2.DeferredTask(ctx, async () => this._transcribe());
|
|
188
194
|
this._openTrigger.wake();
|
|
189
195
|
}
|
|
190
196
|
async _close() {
|
|
197
|
+
import_log2.log.info("closing", void 0, {
|
|
198
|
+
F: __dxlog_file2,
|
|
199
|
+
L: 105,
|
|
200
|
+
S: this,
|
|
201
|
+
C: (f, a) => f(...a)
|
|
202
|
+
});
|
|
191
203
|
this._recording = false;
|
|
192
204
|
this._transcribeTask = void 0;
|
|
193
205
|
await this._recorder.stop();
|
|
194
206
|
}
|
|
195
207
|
startChunksRecording() {
|
|
208
|
+
import_log2.log.info("starting", void 0, {
|
|
209
|
+
F: __dxlog_file2,
|
|
210
|
+
L: 112,
|
|
211
|
+
S: this,
|
|
212
|
+
C: (f, a) => f(...a)
|
|
213
|
+
});
|
|
196
214
|
if (this._lifecycleState !== import_context.LifecycleState.OPEN) {
|
|
197
215
|
return;
|
|
198
216
|
}
|
|
@@ -204,13 +222,19 @@ var Transcriber = class extends import_context.Resource {
|
|
|
204
222
|
}
|
|
205
223
|
this._recording = false;
|
|
206
224
|
this._transcribeTask?.schedule();
|
|
225
|
+
import_log2.log.info("stopped", void 0, {
|
|
226
|
+
F: __dxlog_file2,
|
|
227
|
+
L: 127,
|
|
228
|
+
S: this,
|
|
229
|
+
C: (f, a) => f(...a)
|
|
230
|
+
});
|
|
207
231
|
}
|
|
208
232
|
_saveAudioChunk(chunk) {
|
|
209
233
|
(0, import_log2.log)("saving audio chunk", {
|
|
210
234
|
chunk
|
|
211
235
|
}, {
|
|
212
236
|
F: __dxlog_file2,
|
|
213
|
-
L:
|
|
237
|
+
L: 131,
|
|
214
238
|
S: this,
|
|
215
239
|
C: (f, a) => f(...a)
|
|
216
240
|
});
|
|
@@ -226,7 +250,7 @@ var Transcriber = class extends import_context.Resource {
|
|
|
226
250
|
chunks: this._audioChunks.length
|
|
227
251
|
}, {
|
|
228
252
|
F: __dxlog_file2,
|
|
229
|
-
L:
|
|
253
|
+
L: 147,
|
|
230
254
|
S: this,
|
|
231
255
|
C: (f, a) => f(...a)
|
|
232
256
|
});
|
|
@@ -259,7 +283,7 @@ var Transcriber = class extends import_context.Resource {
|
|
|
259
283
|
this._audioChunks = [];
|
|
260
284
|
throw new Error("No audio to send for transcribing");
|
|
261
285
|
}
|
|
262
|
-
const response = await fetch(`${
|
|
286
|
+
const response = await fetch(`${import_chunk_IXU57SCA.TRANSCRIPTION_URL}/transcribe`, {
|
|
263
287
|
method: "POST",
|
|
264
288
|
body: JSON.stringify({
|
|
265
289
|
audio
|
|
@@ -270,15 +294,15 @@ var Transcriber = class extends import_context.Resource {
|
|
|
270
294
|
});
|
|
271
295
|
if (!response.ok) {
|
|
272
296
|
this._audioChunks = [];
|
|
273
|
-
throw new Error(
|
|
297
|
+
throw new Error(`Transcription failed: ${response.statusText}`);
|
|
274
298
|
}
|
|
275
299
|
const { segments } = await response.json();
|
|
276
300
|
import_log2.log.info("transcription response", {
|
|
277
|
-
segments,
|
|
301
|
+
segments: segments.length,
|
|
278
302
|
string: segments.map((segments2) => segments2.text).join(" ")
|
|
279
303
|
}, {
|
|
280
304
|
F: __dxlog_file2,
|
|
281
|
-
L:
|
|
305
|
+
L: 211,
|
|
282
306
|
S: this,
|
|
283
307
|
C: (f, a) => f(...a)
|
|
284
308
|
});
|
|
@@ -300,8 +324,9 @@ var Transcriber = class extends import_context.Resource {
|
|
|
300
324
|
}
|
|
301
325
|
this._lastUsedTimestamp = zeroTimestamp + filteredSegments.at(-1).end * 1e3;
|
|
302
326
|
return filteredSegments.map((segment) => ({
|
|
327
|
+
type: "transcription",
|
|
303
328
|
started: new Date(zeroTimestamp + segment.start * 1e3).toISOString(),
|
|
304
|
-
text: segment.text
|
|
329
|
+
text: segment.text.trim()
|
|
305
330
|
}));
|
|
306
331
|
}
|
|
307
332
|
};
|
|
@@ -326,16 +351,16 @@ var RECORD_INTERVAL = 200;
|
|
|
326
351
|
var PREFIXED_CHUNKS_AMOUNT = 10;
|
|
327
352
|
var TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
|
|
328
353
|
var TranscriptionManager = class extends import_context2.Resource {
|
|
329
|
-
constructor(
|
|
354
|
+
constructor(options) {
|
|
330
355
|
super();
|
|
331
356
|
this._audioStreamTrack = void 0;
|
|
332
|
-
this.
|
|
333
|
-
this._hue = void 0;
|
|
357
|
+
this._identityDid = void 0;
|
|
334
358
|
this._mediaRecorder = void 0;
|
|
335
359
|
this._transcriber = void 0;
|
|
336
|
-
this._enabled = false;
|
|
337
360
|
this._queue = void 0;
|
|
338
|
-
this.
|
|
361
|
+
this._enabled = false;
|
|
362
|
+
this._edgeClient = options.edgeClient;
|
|
363
|
+
this._messageEnricher = options.messageEnricher;
|
|
339
364
|
}
|
|
340
365
|
async _open() {
|
|
341
366
|
await this._toggleTranscriber();
|
|
@@ -343,15 +368,36 @@ var TranscriptionManager = class extends import_context2.Resource {
|
|
|
343
368
|
async _close() {
|
|
344
369
|
void this._transcriber?.close();
|
|
345
370
|
}
|
|
371
|
+
setQueue(queueDxn) {
|
|
372
|
+
if (this._queue?.dxn.toString() !== queueDxn.toString()) {
|
|
373
|
+
import_log3.log.info("setQueue", {
|
|
374
|
+
queueDxn: queueDxn.toString()
|
|
375
|
+
}, {
|
|
376
|
+
F: __dxlog_file3,
|
|
377
|
+
L: 73,
|
|
378
|
+
S: this,
|
|
379
|
+
C: (f, a) => f(...a)
|
|
380
|
+
});
|
|
381
|
+
this._queue = new import_echo_db.QueueImpl(this._edgeClient, queueDxn);
|
|
382
|
+
}
|
|
383
|
+
return this;
|
|
384
|
+
}
|
|
385
|
+
setIdentityDid(did) {
|
|
386
|
+
if (this._identityDid !== did) {
|
|
387
|
+
this._identityDid = did;
|
|
388
|
+
}
|
|
389
|
+
return this;
|
|
390
|
+
}
|
|
346
391
|
setRecording(recording) {
|
|
347
392
|
if (!this.isOpen || !this._enabled) {
|
|
348
|
-
return;
|
|
393
|
+
return this;
|
|
349
394
|
}
|
|
350
395
|
if (recording) {
|
|
351
396
|
this._transcriber?.startChunksRecording();
|
|
352
397
|
} else {
|
|
353
398
|
this._transcriber?.stopChunksRecording();
|
|
354
399
|
}
|
|
400
|
+
return this;
|
|
355
401
|
}
|
|
356
402
|
/**
|
|
357
403
|
* Enable or disable transcription.
|
|
@@ -371,56 +417,45 @@ var TranscriptionManager = class extends import_context2.Resource {
|
|
|
371
417
|
this._audioStreamTrack = track;
|
|
372
418
|
this.isOpen && await this._toggleTranscriber();
|
|
373
419
|
}
|
|
374
|
-
|
|
375
|
-
* Set the queue to save the transcription to.
|
|
376
|
-
* @param queue - The queue to save the transcription to or the DXN of the queue.
|
|
377
|
-
*/
|
|
378
|
-
setQueue(queue) {
|
|
379
|
-
switch (typeof queue) {
|
|
380
|
-
case "string":
|
|
381
|
-
if (this._queue?.dxn.toString() === queue) {
|
|
382
|
-
return;
|
|
383
|
-
}
|
|
384
|
-
this._queue = new import_echo_db.QueueImpl(this._edgeClient, import_keys.DXN.parse(queue));
|
|
385
|
-
break;
|
|
386
|
-
case "object":
|
|
387
|
-
if (this._queue === queue) {
|
|
388
|
-
return;
|
|
389
|
-
}
|
|
390
|
-
(0, import_invariant2.invariant)(queue instanceof import_echo_db.QueueImpl, void 0, {
|
|
391
|
-
F: __dxlog_file3,
|
|
392
|
-
L: 113,
|
|
393
|
-
S: this,
|
|
394
|
-
A: [
|
|
395
|
-
"queue instanceof QueueImpl",
|
|
396
|
-
""
|
|
397
|
-
]
|
|
398
|
-
});
|
|
399
|
-
this._queue = queue;
|
|
400
|
-
break;
|
|
401
|
-
case "undefined":
|
|
402
|
-
this._queue = void 0;
|
|
403
|
-
break;
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
setName(name) {
|
|
407
|
-
if (this._name === name) {
|
|
408
|
-
return;
|
|
409
|
-
}
|
|
410
|
-
this._name = name;
|
|
411
|
-
}
|
|
412
|
-
setHue(hue) {
|
|
413
|
-
if (this._hue === hue) {
|
|
414
|
-
return;
|
|
415
|
-
}
|
|
416
|
-
this._hue = hue;
|
|
417
|
-
}
|
|
420
|
+
// TODO(burdon): Change this to setEnables (explicit), not toggle.
|
|
418
421
|
async _toggleTranscriber() {
|
|
419
422
|
await this._maybeReinitTranscriber();
|
|
420
423
|
if (this._enabled) {
|
|
421
424
|
await this._transcriber?.open();
|
|
425
|
+
const block = (0, import_echo_schema.create)(import_schema.MessageType, {
|
|
426
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
427
|
+
blocks: [
|
|
428
|
+
{
|
|
429
|
+
type: "transcription",
|
|
430
|
+
text: "Started",
|
|
431
|
+
started: (/* @__PURE__ */ new Date()).toISOString()
|
|
432
|
+
}
|
|
433
|
+
],
|
|
434
|
+
sender: {
|
|
435
|
+
role: "assistant"
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
this._queue?.append([
|
|
439
|
+
block
|
|
440
|
+
]);
|
|
422
441
|
} else {
|
|
423
442
|
await this._transcriber?.close();
|
|
443
|
+
const block = (0, import_echo_schema.create)(import_schema.MessageType, {
|
|
444
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
445
|
+
blocks: [
|
|
446
|
+
{
|
|
447
|
+
type: "transcription",
|
|
448
|
+
text: "Stopped",
|
|
449
|
+
started: (/* @__PURE__ */ new Date()).toISOString()
|
|
450
|
+
}
|
|
451
|
+
],
|
|
452
|
+
sender: {
|
|
453
|
+
role: "assistant"
|
|
454
|
+
}
|
|
455
|
+
});
|
|
456
|
+
this._queue?.append([
|
|
457
|
+
block
|
|
458
|
+
]);
|
|
424
459
|
}
|
|
425
460
|
}
|
|
426
461
|
async _maybeReinitTranscriber() {
|
|
@@ -451,38 +486,31 @@ var TranscriptionManager = class extends import_context2.Resource {
|
|
|
451
486
|
if (!this.isOpen || !this._queue) {
|
|
452
487
|
return;
|
|
453
488
|
}
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
489
|
+
let block = (0, import_echo_schema.create)(import_schema.MessageType, {
|
|
490
|
+
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
491
|
+
blocks: segments,
|
|
492
|
+
sender: {
|
|
493
|
+
identityDid: this._identityDid
|
|
494
|
+
}
|
|
458
495
|
});
|
|
496
|
+
if (this._messageEnricher) {
|
|
497
|
+
block = await this._messageEnricher(block);
|
|
498
|
+
}
|
|
459
499
|
this._queue.append([
|
|
460
500
|
block
|
|
461
501
|
]);
|
|
462
502
|
}
|
|
463
503
|
};
|
|
464
|
-
_ts_decorate3([
|
|
465
|
-
import_async3.synchronized
|
|
466
|
-
], TranscriptionManager.prototype, "setRecording", null);
|
|
467
504
|
_ts_decorate3([
|
|
468
505
|
import_async3.synchronized
|
|
469
506
|
], TranscriptionManager.prototype, "setEnabled", null);
|
|
470
507
|
_ts_decorate3([
|
|
471
508
|
import_async3.synchronized
|
|
472
509
|
], TranscriptionManager.prototype, "setAudioTrack", null);
|
|
473
|
-
_ts_decorate3([
|
|
474
|
-
import_async3.synchronized
|
|
475
|
-
], TranscriptionManager.prototype, "setQueue", null);
|
|
476
|
-
_ts_decorate3([
|
|
477
|
-
import_async3.synchronized
|
|
478
|
-
], TranscriptionManager.prototype, "setName", null);
|
|
479
|
-
_ts_decorate3([
|
|
480
|
-
import_async3.synchronized
|
|
481
|
-
], TranscriptionManager.prototype, "setHue", null);
|
|
482
510
|
// Annotate the CommonJS export names for ESM import in node:
|
|
483
511
|
0 && (module.exports = {
|
|
484
512
|
MediaStreamRecorder,
|
|
485
513
|
Transcriber,
|
|
486
514
|
TranscriptionManager
|
|
487
515
|
});
|
|
488
|
-
//# sourceMappingURL=chunk-
|
|
516
|
+
//# sourceMappingURL=chunk-7XIIUVN3.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/transcriber/media-stream-recorder.ts", "../../../src/transcriber/transcriber.ts", "../../../src/transcriber/transcription-manager.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type IBlobEvent, type IMediaRecorder, MediaRecorder, register } from 'extendable-media-recorder';\nimport { WaveFile } from 'wavefile';\n\nimport { synchronized } from '@dxos/async';\nimport { invariant } from '@dxos/invariant';\nimport { log } from '@dxos/log';\nimport { trace } from '@dxos/tracing';\n\nimport { type WavConfig, type AudioChunk, type AudioRecorder } from './audio-recorder';\n\nlet initializingPromise: Promise<void> | undefined;\n\nconst initializeExtendableMediaRecorder = async () => {\n const { connect } = await import('extendable-media-recorder-wav-encoder');\n await register(await connect());\n};\n\n/**\n * Recorder that uses the MediaContext API and AudioNode API to record audio.\n *\n * It records MediaStream using https://www.npmjs.com/package/extendable-media-recorder.\n */\n@trace.resource()\nexport class MediaStreamRecorder implements AudioRecorder {\n private readonly _mediaStreamTrack: MediaStreamTrack;\n /**\n * Default MediaRecorder implementation do not support wav encoding.\n */\n private readonly _interval: number;\n private _mediaRecorder?: IMediaRecorder = undefined;\n private _header?: Uint8Array = undefined;\n private _onChunk?: (chunk: AudioChunk) => void;\n\n constructor({ mediaStreamTrack, interval }: { mediaStreamTrack: MediaStreamTrack; interval: number }) {\n this._mediaStreamTrack = mediaStreamTrack;\n this._interval = interval;\n }\n\n get wavConfig(): WavConfig {\n const settings = this._mediaStreamTrack.getSettings();\n return {\n channels: settings.channelCount ?? 1,\n sampleRate: settings.sampleRate ?? 16000,\n bitDepthCode: settings.sampleSize ? String(settings.sampleSize) : '16',\n };\n }\n\n get mediaStreamTrack() {\n return this._mediaStreamTrack;\n }\n\n setOnChunk(onChunk: (chunk: AudioChunk) => void): void {\n this._onChunk = onChunk;\n }\n\n async start() {\n await (initializingPromise ??= initializeExtendableMediaRecorder()).catch((err) =>\n log.info('initializeExtendableMediaRecorder', { err }),\n );\n\n if (!this._mediaRecorder) {\n const stream = new MediaStream([this._mediaStreamTrack]);\n this._mediaRecorder = new MediaRecorder(stream, { mimeType: 'audio/wav' });\n }\n\n if (this._mediaRecorder.state === 'recording') {\n return;\n }\n invariant(this._onChunk, 'MediaStreamRecorder: onChunk is not set');\n this._mediaRecorder.ondataavailable = (event) => this._ondataavailable(event);\n this._mediaRecorder.start(this._interval);\n }\n\n async stop() {\n if (this._mediaRecorder?.state !== 'recording') {\n return;\n }\n this._mediaRecorder.stop();\n }\n\n @synchronized\n private async _ondataavailable(event: IBlobEvent) {\n const blob = event.data;\n const uint8Array = new Uint8Array(await blob.arrayBuffer());\n\n // First chunk from the MediaRecorder has a header.\n const isHeader =\n uint8Array[0] === 0x52 && // R\n uint8Array[1] === 0x49 && // I\n uint8Array[2] === 0x46 && // F\n uint8Array[3] === 0x46; // F\n let wav: WaveFile;\n\n if (isHeader) {\n wav = new WaveFile(uint8Array);\n this._header = uint8Array.slice(0, 44);\n } else if (this._header) {\n wav = new WaveFile(new Uint8Array([...this._header, ...uint8Array]));\n } else {\n log.warn('MediaStreamRecorder: no header');\n return;\n }\n\n this._onChunk!({\n timestamp: Date.now(),\n data: wav.getSamples(),\n });\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { WaveFile } from 'wavefile';\n\nimport { DeferredTask, Trigger } from '@dxos/async';\nimport { type Context, LifecycleState, Resource } from '@dxos/context';\nimport { log } from '@dxos/log';\nimport { type TranscriptionContentBlock } from '@dxos/schema';\nimport { trace } from '@dxos/tracing';\n\nimport { type AudioRecorder, type AudioChunk } from './audio-recorder';\nimport { TRANSCRIPTION_URL } from '../types';\nimport { mergeFloat64Arrays } from '../util';\n\ntype WhisperWord = {\n word: string;\n\n /**\n * Time in seconds from the start of the audio.\n */\n start: number;\n\n /**\n * Time in seconds from the start of the audio.\n */\n end: number;\n};\n\ntype WhisperSegment = {\n text: string;\n\n /**\n * Time in seconds from the start of the audio.\n */\n start: number;\n\n /**\n * Time in seconds from the start of the audio.\n */\n end: number;\n\n /**\n * Probability of no speech in the segment.\n */\n no_speech_prob: number;\n\n words: WhisperWord[];\n};\n\nexport type TranscribeConfig = {\n /**\n * Number of chunks to transcribe automatically after.\n */\n transcribeAfterChunksAmount: number;\n\n /**\n * Number of chunks to save before the user starts speaking.\n * This is needed to catch the beginning of the user's speech.\n */\n prefixBufferChunksAmount: number;\n};\n\nexport type TranscriberParams = {\n config: TranscribeConfig;\n recorder: AudioRecorder;\n onSegments: (segments: TranscriptionContentBlock[]) => Promise<void>;\n};\n\n/**\n * Handles transcription of audio chunks.\n * If user is not speaking, the last `minChunksAmount` chunks are saved and transcribed.\n * If user is speaking, the chunks are added to the buffer until the user is done talking.\n */\nexport class Transcriber extends Resource {\n private _audioChunks: AudioChunk[] = [];\n private _lastUsedTimestamp = 0;\n\n private readonly _openTrigger = new Trigger({ autoReset: true });\n\n private readonly _config: TranscribeConfig;\n private readonly _recorder: AudioRecorder;\n private readonly _onSegments: TranscriberParams['onSegments'];\n\n private _recording = false;\n private _transcribeTask?: DeferredTask = undefined;\n\n constructor({ config, recorder, onSegments }: TranscriberParams) {\n super();\n this._config = config;\n this._recorder = recorder;\n this._onSegments = onSegments;\n }\n\n protected override async _open(ctx: Context) {\n log.info('opening');\n this._recorder.setOnChunk((chunk) => this._saveAudioChunk(chunk));\n await this._recorder.start();\n this._transcribeTask = new DeferredTask(ctx, async () => this._transcribe());\n this._openTrigger.wake();\n }\n\n protected override async _close() {\n log.info('closing');\n this._recording = false;\n this._transcribeTask = undefined;\n await this._recorder.stop();\n }\n\n startChunksRecording() {\n log.info('starting');\n if (this._lifecycleState !== LifecycleState.OPEN) {\n return;\n }\n\n this._recording = true;\n }\n\n stopChunksRecording() {\n if (this._lifecycleState !== LifecycleState.OPEN || !this._recording) {\n return;\n }\n\n this._recording = false;\n this._transcribeTask?.schedule();\n log.info('stopped');\n }\n\n private _saveAudioChunk(chunk: AudioChunk) {\n log('saving audio chunk', { chunk });\n this._audioChunks.push(chunk);\n\n // Clean the buffer if the user is not speaking and the transcription task is not scheduled.\n if (\n !this._recording &&\n (!this._transcribeTask || !this._transcribeTask.scheduled) &&\n this._audioChunks.length >= this._config.prefixBufferChunksAmount\n ) {\n this._audioChunks = this._dropOldChunks();\n } else if (this._audioChunks.length >= this._config.transcribeAfterChunksAmount && this._recording) {\n this._transcribeTask?.schedule();\n }\n }\n\n private async _transcribe() {\n log('transcribing', { chunks: this._audioChunks.length });\n const chunks = this._audioChunks;\n this._audioChunks = this._dropOldChunks();\n if (chunks.length === 0) {\n return;\n }\n\n const audio = await this._mergeAudioChunks(chunks);\n const segments = await this._fetchTranscription(audio);\n if (!Array.isArray(segments) || segments.length === 0) {\n return;\n }\n\n const alignedSegments = this._alignSegments(segments, chunks);\n if (alignedSegments.length > 0) {\n await this._onSegments(alignedSegments);\n }\n }\n\n private _dropOldChunks() {\n return this._config.prefixBufferChunksAmount > 0\n ? this._audioChunks.slice(-this._config.prefixBufferChunksAmount)\n : [];\n }\n\n @trace.span({ showInBrowserTimeline: true })\n private async _mergeAudioChunks(chunks: AudioChunk[]) {\n const file = new WaveFile();\n const wavConfig = this._recorder.wavConfig;\n\n file.fromScratch(\n wavConfig.channels,\n wavConfig.sampleRate,\n wavConfig.bitDepthCode,\n mergeFloat64Arrays(chunks.map(({ data }) => data)),\n );\n\n return file.toBase64();\n }\n\n @trace.span({ showInBrowserTimeline: true })\n private async _fetchTranscription(audio: string) {\n if (audio.length === 0) {\n this._audioChunks = [];\n throw new Error('No audio to send for transcribing');\n }\n\n const response = await fetch(`${TRANSCRIPTION_URL}/transcribe`, {\n method: 'POST',\n body: JSON.stringify({ audio }),\n headers: {\n 'Content-Type': 'application/json',\n },\n });\n\n if (!response.ok) {\n this._audioChunks = [];\n throw new Error(`Transcription failed: ${response.statusText}`);\n }\n\n const { segments } = (await response.json()) as {\n segments: WhisperSegment[];\n };\n\n log.info('transcription response', {\n segments: segments.length,\n string: segments.map((segments) => segments.text).join(' '),\n });\n\n return segments;\n }\n\n private _alignSegments(segments: WhisperSegment[], originalChunks: AudioChunk[]): TranscriptionContentBlock[] {\n // Absolute zero for all relative timestamps in the segments.\n const zeroTimestamp = originalChunks.at(0)!.timestamp;\n\n const filteredSegments = segments\n // Use segments that end after the last used timestamp.\n // Segments could overlap, so we need to filter words that starts after the last used timestamp.\n .filter((segment) => zeroTimestamp + segment.end * 1_000 >= this._lastUsedTimestamp)\n // Use words that starts after the last used timestamp.\n .map((segment) => {\n const words = segment.words.filter((word) => zeroTimestamp + word.start * 1_000 >= this._lastUsedTimestamp);\n return {\n ...segment,\n words,\n text: words.map((word) => word.word).join(''),\n start: words.at(0)?.start ?? segment.end,\n };\n })\n .filter((segment) => segment.words.length > 0);\n\n if (filteredSegments.length === 0) {\n return [];\n }\n\n // Update last timestamp.\n this._lastUsedTimestamp = zeroTimestamp + filteredSegments.at(-1)!.end * 1_000;\n\n // Add absolute timestamp to each segment.\n return filteredSegments.map((segment) => ({\n type: 'transcription',\n started: new Date(zeroTimestamp + segment.start * 1_000).toISOString(),\n text: segment.text.trim(),\n }));\n }\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { synchronized } from '@dxos/async';\nimport { Resource } from '@dxos/context';\nimport { QueueImpl, type Queue } from '@dxos/echo-db';\nimport { create } from '@dxos/echo-schema';\nimport { type DXN } from '@dxos/keys';\nimport { log } from '@dxos/log';\nimport { type EdgeHttpClient } from '@dxos/react-edge-client';\nimport { MessageType, type TranscriptionContentBlock } from '@dxos/schema';\n\nimport { MediaStreamRecorder } from './media-stream-recorder';\nimport { Transcriber } from './transcriber';\n\n/**\n * Length of the chunk in ms.\n */\nconst RECORD_INTERVAL = 200;\n\n/**\n * Number of chunks to save before the user starts speaking.\n */\nconst PREFIXED_CHUNKS_AMOUNT = 10;\n\n/**\n * Number of chunks to transcribe automatically after.\n * Combined should be mess than 25MB or whisper would fail.\n */\nconst TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;\n\nexport type TranscriptMessageEnricher = (message: MessageType) => Promise<MessageType>;\n\nexport type TranscriptionManagerOptions = {\n edgeClient: EdgeHttpClient;\n\n /**\n * Enrich the message before it is written to the transcription queue.\n */\n messageEnricher?: TranscriptMessageEnricher;\n};\n\n/**\n * Manages transcription state for a meeting.\n */\nexport class TranscriptionManager extends Resource {\n private readonly _edgeClient: EdgeHttpClient;\n private readonly _messageEnricher?: TranscriptMessageEnricher;\n private _audioStreamTrack?: MediaStreamTrack = undefined;\n private _identityDid?: string = undefined;\n private _mediaRecorder?: MediaStreamRecorder = undefined;\n private _transcriber?: Transcriber = undefined;\n private _queue?: Queue<MessageType> = undefined;\n private _enabled = false;\n\n constructor(options: TranscriptionManagerOptions) {\n super();\n this._edgeClient = options.edgeClient;\n this._messageEnricher = options.messageEnricher;\n }\n\n protected override async _open() {\n await this._toggleTranscriber();\n }\n\n protected override async _close() {\n void this._transcriber?.close();\n }\n\n setQueue(queueDxn: DXN): TranscriptionManager {\n if (this._queue?.dxn.toString() !== queueDxn.toString()) {\n log.info('setQueue', { queueDxn: queueDxn.toString() });\n this._queue = new QueueImpl<MessageType>(this._edgeClient, queueDxn);\n }\n return this;\n }\n\n setIdentityDid(did: string): TranscriptionManager {\n if (this._identityDid !== did) {\n this._identityDid = did;\n }\n return this;\n }\n\n setRecording(recording?: boolean): TranscriptionManager {\n if (!this.isOpen || !this._enabled) {\n return this;\n }\n\n if (recording) {\n this._transcriber?.startChunksRecording();\n } else {\n this._transcriber?.stopChunksRecording();\n }\n return this;\n }\n\n /**\n * Enable or disable transcription.\n * @param enabled - Whether to enable transcription.\n */\n @synchronized\n async setEnabled(enabled?: boolean) {\n if (this._enabled === enabled) {\n return;\n }\n\n this._enabled = enabled ?? false;\n // TODO(burdon): Why is toggle called here?\n this.isOpen && (await this._toggleTranscriber());\n }\n\n @synchronized\n async setAudioTrack(track?: MediaStreamTrack) {\n if (this._audioStreamTrack === track) {\n return;\n }\n\n this._audioStreamTrack = track;\n this.isOpen && (await this._toggleTranscriber());\n }\n\n // TODO(burdon): Change this to setEnables (explicit), not toggle.\n private async _toggleTranscriber() {\n await this._maybeReinitTranscriber();\n\n // Open or close transcriber if transcription is enabled or disabled.\n if (this._enabled) {\n await this._transcriber?.open();\n // TODO(burdon): Started and stopped blocks appear twice.\n const block = create(MessageType, {\n created: new Date().toISOString(),\n blocks: [{ type: 'transcription', text: 'Started', started: new Date().toISOString() }],\n sender: { role: 'assistant' },\n });\n this._queue?.append([block]);\n } else {\n await this._transcriber?.close();\n const block = create(MessageType, {\n created: new Date().toISOString(),\n blocks: [{ type: 'transcription', text: 'Stopped', started: new Date().toISOString() }],\n sender: { role: 'assistant' },\n });\n this._queue?.append([block]);\n }\n }\n\n private async _maybeReinitTranscriber() {\n if (!this._audioStreamTrack || !this._enabled) {\n return;\n }\n\n // Reinitialize transcriber if queue or media stream track has changed.\n let needReinit = false;\n if (this._audioStreamTrack !== this._mediaRecorder?.mediaStreamTrack) {\n this._mediaRecorder = new MediaStreamRecorder({\n mediaStreamTrack: this._audioStreamTrack,\n interval: RECORD_INTERVAL,\n });\n needReinit = true;\n }\n if (needReinit) {\n await this._transcriber?.close();\n this._transcriber = new Transcriber({\n config: {\n transcribeAfterChunksAmount: TRANSCRIBE_AFTER_CHUNKS_AMOUNT,\n prefixBufferChunksAmount: PREFIXED_CHUNKS_AMOUNT,\n },\n recorder: this._mediaRecorder,\n onSegments: (segments) => this._onSegments(segments),\n });\n }\n }\n\n private async _onSegments(segments: TranscriptionContentBlock[]) {\n if (!this.isOpen || !this._queue) {\n return;\n }\n\n let block = create(MessageType, {\n created: new Date().toISOString(),\n blocks: segments,\n sender: { identityDid: this._identityDid },\n });\n\n if (this._messageEnricher) {\n block = await this._messageEnricher(block);\n }\n\n this._queue.append([block]);\n }\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,uCAA8E;AAC9E,sBAAyB;AAEzB,mBAA6B;AAC7B,uBAA0B;AAC1B,iBAAoB;AACpB,qBAAsB;ACNtB,IAAAA,mBAAyB;AAEzB,IAAAC,gBAAsC;AACtC,qBAAuD;AACvD,IAAAC,cAAoB;AAEpB,IAAAC,kBAAsB;ACNtB,IAAAF,gBAA6B;AAC7B,IAAAG,kBAAyB;AACzB,qBAAsC;AACtC,yBAAuB;AAEvB,IAAAF,cAAoB;AAEpB,oBAA4D;;;;;;;;AFG5D,IAAIG;AAEJ,IAAMC,oCAAoC,YAAA;AACxC,QAAM,EAAEC,QAAO,IAAK,MAAM,OAAO,uCAAA;AACjC,YAAMC,2CAAS,MAAMD,QAAAA,CAAAA;AACvB;AAQO,IAAME,sBAAN,MAAMA;EAUXC,YAAY,EAAEC,kBAAkBC,SAAQ,GAA8D;AAJ9FC,SAAAA,iBAAkCC;AAClCC,SAAAA,UAAuBD;AAI7B,SAAKE,oBAAoBL;AACzB,SAAKM,YAAYL;EACnB;EAEA,IAAIM,YAAuB;AACzB,UAAMC,WAAW,KAAKH,kBAAkBI,YAAW;AACnD,WAAO;MACLC,UAAUF,SAASG,gBAAgB;MACnCC,YAAYJ,SAASI,cAAc;MACnCC,cAAcL,SAASM,aAAaC,OAAOP,SAASM,UAAU,IAAI;IACpE;EACF;EAEA,IAAId,mBAAmB;AACrB,WAAO,KAAKK;EACd;EAEAW,WAAWC,SAA4C;AACrD,SAAKC,WAAWD;EAClB;EAEA,MAAME,QAAQ;AACZ,WAAOzB,wBAAwBC,kCAAAA,GAAqCyB,MAAM,CAACC,QACzEC,eAAIC,KAAK,qCAAqC;MAAEF;IAAI,GAAA;;;;;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AAY;MAC9B,CAAA;AACA,WAAK9B,QAAQ+B,OAAO;QAACP;OAAM;IAC7B;EACF;EAEA,MAAcF,0BAA0B;AACtC,QAAI,CAAC,KAAKzB,qBAAqB,CAAC,KAAKI,UAAU;AAC7C;IACF;AAGA,QAAI+B,aAAa;AACjB,QAAI,KAAKnC,sBAAsB,KAAKrI,gBAAgBF,kBAAkB;AACpE,WAAKE,iBAAiB,IAAIJ,oBAAoB;QAC5CE,kBAAkB,KAAKuI;QACvBtI,UAAUiI;MACZ,CAAA;AACAwC,mBAAa;IACf;AACA,QAAIA,YAAY;AACd,YAAM,KAAKjC,cAAcQ,MAAAA;AACzB,WAAKR,eAAe,IAAItF,YAAY;QAClCE,QAAQ;UACNgC,6BAA6B+C;UAC7BjD,0BAA0BgD;QAC5B;QACA7E,UAAU,KAAKpD;QACfqD,YAAY,CAACkC,aAAa,KAAKxB,YAAYwB,QAAAA;MAC7C,CAAA;IACF;EACF;EAEA,MAAcxB,YAAYwB,UAAuC;AAC/D,QAAI,CAAC,KAAKkE,UAAU,CAAC,KAAKjB,QAAQ;AAChC;IACF;AAEA,QAAIwB,YAAQC,2BAAOC,2BAAa;MAC9BC,UAAS,oBAAIxH,KAAAA,GAAOiF,YAAW;MAC/BwC,QAAQ7E;MACR8E,QAAQ;QAAEI,aAAa,KAAKnC;MAAa;IAC3C,CAAA;AAEA,QAAI,KAAKM,kBAAkB;AACzBoB,cAAQ,MAAM,KAAKpB,iBAAiBoB,KAAAA;IACtC;AAEA,SAAKxB,OAAO+B,OAAO;MAACP;KAAM;EAC5B;AACF;;EA1FGlH,cAAAA;GAxDUqF,qBAAAA,WAAAA,cAAAA,IAAAA;;EAmEVrF,cAAAA;GAnEUqF,qBAAAA,WAAAA,iBAAAA,IAAAA;",
|
|
6
|
+
"names": ["import_wavefile", "import_async", "import_log", "import_tracing", "import_context", "initializingPromise", "initializeExtendableMediaRecorder", "connect", "register", "MediaStreamRecorder", "constructor", "mediaStreamTrack", "interval", "_mediaRecorder", "undefined", "_header", "_mediaStreamTrack", "_interval", "wavConfig", "settings", "getSettings", "channels", "channelCount", "sampleRate", "bitDepthCode", "sampleSize", "String", "setOnChunk", "onChunk", "_onChunk", "start", "catch", "err", "log", "info", "stream", "MediaStream", "MediaRecorder", "mimeType", "state", "invariant", "ondataavailable", "event", "_ondataavailable", "stop", "blob", "data", "uint8Array", "Uint8Array", "arrayBuffer", "isHeader", "wav", "WaveFile", "slice", "warn", "timestamp", "Date", "now", "getSamples", "synchronized", "trace", "resource", "Transcriber", "Resource", "config", "recorder", "onSegments", "_audioChunks", "_lastUsedTimestamp", "_openTrigger", "Trigger", "autoReset", "_recording", "_transcribeTask", "_config", "_recorder", "_onSegments", "_open", "ctx", "chunk", "_saveAudioChunk", "DeferredTask", "_transcribe", "wake", "_close", "startChunksRecording", "_lifecycleState", "LifecycleState", "OPEN", "stopChunksRecording", "schedule", "push", "scheduled", "length", "prefixBufferChunksAmount", "_dropOldChunks", "transcribeAfterChunksAmount", "chunks", "audio", "_mergeAudioChunks", "segments", "_fetchTranscription", "Array", "isArray", "alignedSegments", "_alignSegments", "file", "fromScratch", "mergeFloat64Arrays", "map", "toBase64", "Error", "response", "fetch", "TRANSCRIPTION_URL", "method", "body", "JSON", "stringify", "headers", "ok", "statusText", "json", "string", "text", "join", "originalChunks", "zeroTimestamp", "at", "filteredSegments", "filter", "segment", "end", "words", "word", "type", "started", "toISOString", "trim", "span", "showInBrowserTimeline", "RECORD_INTERVAL", "PREFIXED_CHUNKS_AMOUNT", "TRANSCRIBE_AFTER_CHUNKS_AMOUNT", "TranscriptionManager", "options", "_audioStreamTrack", "_identityDid", "_transcriber", "_queue", "_enabled", "_edgeClient", "edgeClient", "_messageEnricher", "messageEnricher", "_toggleTranscriber", "close", "setQueue", "queueDxn", "dxn", "toString", "QueueImpl", "setIdentityDid", "did", "setRecording", "recording", "isOpen", "setEnabled", "enabled", "setAudioTrack", "track", "_maybeReinitTranscriber", "open", "block", "create", "MessageType", "created", "blocks", "sender", "role", "append", "needReinit", "identityDid"]
|
|
7
|
+
}
|
|
@@ -16,16 +16,16 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_IXU57SCA_exports = {};
|
|
20
|
+
__export(chunk_IXU57SCA_exports, {
|
|
21
21
|
TRANSCRIPTION_URL: () => TRANSCRIPTION_URL,
|
|
22
|
-
TranscriptBlock: () => TranscriptBlock,
|
|
23
22
|
TranscriptSchema: () => TranscriptSchema,
|
|
24
23
|
TranscriptType: () => TranscriptType,
|
|
25
24
|
TranscriptionAction: () => TranscriptionAction,
|
|
25
|
+
TranscriptionSettingsSchema: () => TranscriptionSettingsSchema,
|
|
26
26
|
isTranscript: () => isTranscript
|
|
27
27
|
});
|
|
28
|
-
module.exports = __toCommonJS(
|
|
28
|
+
module.exports = __toCommonJS(chunk_IXU57SCA_exports);
|
|
29
29
|
var import_chunk_NVZWGFJL = require("./chunk-NVZWGFJL.cjs");
|
|
30
30
|
var import_echo_schema = require("@dxos/echo-schema");
|
|
31
31
|
var import_echo_schema2 = require("@dxos/echo-schema");
|
|
@@ -49,20 +49,6 @@ var TranscriptType = class extends (0, import_echo_schema.TypedObject)({
|
|
|
49
49
|
var TranscriptHeader = import_echo_schema.S.Struct({
|
|
50
50
|
started: import_echo_schema.S.optional(import_echo_schema.S.String)
|
|
51
51
|
});
|
|
52
|
-
var TranscriptSegment = import_echo_schema.S.Struct({
|
|
53
|
-
// TODO(burdon): TS from service is not Unix TS (x1000).
|
|
54
|
-
started: import_echo_schema.S.String,
|
|
55
|
-
text: import_echo_schema.S.String
|
|
56
|
-
});
|
|
57
|
-
var TranscriptBlock = import_echo_schema.S.Struct({
|
|
58
|
-
id: import_echo_schema.S.String,
|
|
59
|
-
authorName: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
60
|
-
authorHue: import_echo_schema.S.optional(import_echo_schema.S.String),
|
|
61
|
-
segments: import_echo_schema.S.Array(TranscriptSegment)
|
|
62
|
-
}).pipe((0, import_echo_schema.EchoObject)({
|
|
63
|
-
typename: "dxos.org/type/TranscriptBlock",
|
|
64
|
-
version: "0.1.0"
|
|
65
|
-
}));
|
|
66
52
|
var TRANSCRIPTION_URL = "https://calls-service.dxos.workers.dev";
|
|
67
53
|
var TranscriptionAction;
|
|
68
54
|
(function(TranscriptionAction2) {
|
|
@@ -70,8 +56,7 @@ var TranscriptionAction;
|
|
|
70
56
|
class Create extends import_echo_schema2.S.TaggedClass()(`${TRANSCRIPTION_ACTION}/create`, {
|
|
71
57
|
input: import_echo_schema2.S.Struct({
|
|
72
58
|
name: import_echo_schema2.S.optional(import_echo_schema2.S.String),
|
|
73
|
-
|
|
74
|
-
spaceId: import_echo_schema2.S.String
|
|
59
|
+
spaceId: import_echo_schema2.SpaceIdSchema
|
|
75
60
|
}),
|
|
76
61
|
output: import_echo_schema2.S.Struct({
|
|
77
62
|
object: TranscriptType
|
|
@@ -83,13 +68,16 @@ var TranscriptionAction;
|
|
|
83
68
|
var isTranscript = (object) => {
|
|
84
69
|
return (0, import_echo.isLiveObject)(object) && (0, import_echo_schema2.isInstanceOf)(TranscriptType, object);
|
|
85
70
|
};
|
|
71
|
+
var TranscriptionSettingsSchema = import_echo_schema2.S.mutable(import_echo_schema2.S.Struct({
|
|
72
|
+
entityExtraction: import_echo_schema2.S.optional(import_echo_schema2.S.Boolean).pipe(import_echo_schema2.S.withConstructorDefault(() => true))
|
|
73
|
+
}));
|
|
86
74
|
// Annotate the CommonJS export names for ESM import in node:
|
|
87
75
|
0 && (module.exports = {
|
|
88
76
|
TRANSCRIPTION_URL,
|
|
89
|
-
TranscriptBlock,
|
|
90
77
|
TranscriptSchema,
|
|
91
78
|
TranscriptType,
|
|
92
79
|
TranscriptionAction,
|
|
80
|
+
TranscriptionSettingsSchema,
|
|
93
81
|
isTranscript
|
|
94
82
|
});
|
|
95
|
-
//# sourceMappingURL=chunk-
|
|
83
|
+
//# sourceMappingURL=chunk-IXU57SCA.cjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/types/schema.ts", "../../../src/types/types.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Expando, Ref, S, TypedObject } from '@dxos/echo-schema';\n\n/**\n * Root transcript object created when the user starts a transcription.\n */\nexport const TranscriptSchema = S.Struct({\n name: S.String,\n\n // TODO(burdon): Use Date or string?\n started: S.optional(S.String),\n ended: S.optional(S.String),\n\n /**\n * Queue containing TranscriptBlock objects.\n */\n // TODO(wittjosiah): Should be a ref to a queue.\n queue: Ref(Expando),\n});\n\nexport class TranscriptType extends TypedObject({\n typename: 'dxos.org/type/Transcript',\n version: '0.1.0',\n})(TranscriptSchema.fields) {}\n\n// TODO(burdon): Do these need to be kept in sync with EDGE?\n\n/**\n * First message in queue.\n * Contains metadata for the recording and transcript.\n */\nconst TranscriptHeader = S.Struct({\n started: S.optional(S.String),\n});\n\nexport type TranscriptHeader = S.Schema.Type<typeof TranscriptHeader>;\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport { SpaceIdSchema, S, isInstanceOf } from '@dxos/echo-schema';\nimport { isLiveObject } from '@dxos/react-client/echo';\n\nimport { TranscriptType } from './schema';\nimport { TRANSCRIPTION_PLUGIN } from '../meta';\n\n// TODO(burdon): Move to separate proto.\n\n/**\n * Endpoint to the calls service.\n */\n// TODO(burdon): Reconfigure/move.\nexport const TRANSCRIPTION_URL = 'https://calls-service.dxos.workers.dev';\n\nexport namespace TranscriptionAction {\n const TRANSCRIPTION_ACTION = `${TRANSCRIPTION_PLUGIN}/action`;\n\n export class Create extends S.TaggedClass<Create>()(`${TRANSCRIPTION_ACTION}/create`, {\n input: S.Struct({\n name: S.optional(S.String),\n spaceId: SpaceIdSchema,\n }),\n output: S.Struct({\n object: TranscriptType,\n }),\n }) {}\n}\n\nexport const isTranscript = (object: unknown): object is typeof TranscriptType => {\n return isLiveObject(object) && isInstanceOf(TranscriptType, object);\n};\n\n// TODO(burdon): Create with decode consistently: S.decodeSync(TranscriptionSettingsSchema)({}))\nexport const TranscriptionSettingsSchema = S.mutable(\n S.Struct({\n entityExtraction: S.optional(S.Boolean).pipe(S.withConstructorDefault(() => true)),\n }),\n);\n\nexport type TranscriptionSettingsProps = S.Schema.Type<typeof TranscriptionSettingsSchema>;\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,yBAA6C;ACA7C,IAAAA,sBAA+C;AAC/C,kBAA6B;ADItB,IAAMC,mBAAmBC,qBAAEC,OAAO;EACvCC,MAAMF,qBAAEG;;EAGRC,SAASJ,qBAAEK,SAASL,qBAAEG,MAAM;EAC5BG,OAAON,qBAAEK,SAASL,qBAAEG,MAAM;;;;;EAM1BI,WAAOC,wBAAIC,0BAAAA;AACb,CAAA;AAEO,IAAMC,iBAAN,kBAA6BC,gCAAY;EAC9CC,UAAU;EACVC,SAAS;AACX,CAAA,EAAGd,iBAAiBe,MAAM,EAAA;AAAG;AAQ7B,IAAMC,mBAAmBf,qBAAEC,OAAO;EAChCG,SAASJ,qBAAEK,SAASL,qBAAEG,MAAM;AAC9B,CAAA;ACpBO,IAAMa,oBAAoB;;UAEhBC,sBAAAA;AACf,QAAMC,uBAAuB,GAAGC,0CAAAA;EAEzB,MAAMC,eAAepB,oBAAAA,EAAEqB,YAAW,EAAW,GAAGH,oBAAAA,WAA+B;IACpFI,OAAOtB,oBAAAA,EAAEC,OAAO;MACdC,MAAMF,oBAAAA,EAAEK,SAASL,oBAAAA,EAAEG,MAAM;MACzBoB,SAASC;IACX,CAAA;IACAC,QAAQzB,oBAAAA,EAAEC,OAAO;MACfyB,QAAQhB;IACV,CAAA;EACF,CAAA,EAAA;EAAI;uBARSU,SAAAA;AASf,GAZiBH,wBAAAA,sBAAAA,CAAAA,EAAAA;AAcV,IAAMU,eAAe,CAACD,WAAAA;AAC3B,aAAOE,0BAAaF,MAAAA,SAAWG,kCAAanB,gBAAgBgB,MAAAA;AAC9D;AAGO,IAAMI,8BAA8B9B,oBAAAA,EAAE+B,QAC3C/B,oBAAAA,EAAEC,OAAO;EACP+B,kBAAkBhC,oBAAAA,EAAEK,SAASL,oBAAAA,EAAEiC,OAAO,EAAEC,KAAKlC,oBAAAA,EAAEmC,uBAAuB,MAAM,IAAA,CAAA;AAC9E,CAAA,CAAA;",
|
|
6
|
+
"names": ["import_echo_schema", "TranscriptSchema", "S", "Struct", "name", "String", "started", "optional", "ended", "queue", "Ref", "Expando", "TranscriptType", "TypedObject", "typename", "version", "fields", "TranscriptHeader", "TRANSCRIPTION_URL", "TranscriptionAction", "TRANSCRIPTION_ACTION", "TRANSCRIPTION_PLUGIN", "Create", "TaggedClass", "input", "spaceId", "SpaceIdSchema", "output", "object", "isTranscript", "isLiveObject", "isInstanceOf", "TranscriptionSettingsSchema", "mutable", "entityExtraction", "Boolean", "pipe", "withConstructorDefault"]
|
|
7
|
+
}
|
|
@@ -16,11 +16,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
16
16
|
return to;
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var
|
|
20
|
-
__export(
|
|
19
|
+
var chunk_JUGOXWES_exports = {};
|
|
20
|
+
__export(chunk_JUGOXWES_exports, {
|
|
21
21
|
TranscriptionCapabilities: () => TranscriptionCapabilities
|
|
22
22
|
});
|
|
23
|
-
module.exports = __toCommonJS(
|
|
23
|
+
module.exports = __toCommonJS(chunk_JUGOXWES_exports);
|
|
24
24
|
var import_chunk_NVZWGFJL = require("./chunk-NVZWGFJL.cjs");
|
|
25
25
|
var import_app_framework = require("@dxos/app-framework");
|
|
26
26
|
var TranscriptionCapabilities;
|
|
@@ -32,4 +32,4 @@ var TranscriptionCapabilities;
|
|
|
32
32
|
0 && (module.exports = {
|
|
33
33
|
TranscriptionCapabilities
|
|
34
34
|
});
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-JUGOXWES.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type Live } from '@dxos/live-object';\n\nimport { TRANSCRIPTION_PLUGIN } from '../meta';\nimport { type TranscriberParams, type Transcriber, type TranscriptionManager } from '../transcriber';\n\nexport namespace TranscriptionCapabilities {\n export type GetTranscriberProps = {\n audioStreamTrack: MediaStreamTrack;\n onSegments: TranscriberParams['onSegments'];\n config?: TranscriberParams['config'];\n };\n export type GetTranscriber = (props: GetTranscriberProps) => Transcriber;\n export const Transcriber = defineCapability<GetTranscriber>(`${TRANSCRIPTION_PLUGIN}/capability/transcriber`);\n\n export type MeetingTranscriptionState = Live<{\n
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\nimport { type Live } from '@dxos/live-object';\n\nimport { TRANSCRIPTION_PLUGIN } from '../meta';\nimport { type TranscriberParams, type Transcriber, type TranscriptionManager } from '../transcriber';\n\nexport namespace TranscriptionCapabilities {\n export type GetTranscriberProps = {\n audioStreamTrack: MediaStreamTrack;\n onSegments: TranscriberParams['onSegments'];\n config?: TranscriberParams['config'];\n };\n export type GetTranscriber = (props: GetTranscriberProps) => Transcriber;\n export const Transcriber = defineCapability<GetTranscriber>(`${TRANSCRIPTION_PLUGIN}/capability/transcriber`);\n\n export type MeetingTranscriptionState = Live<{\n transcriptionManager?: TranscriptionManager;\n enabled: boolean; // TODO(burdon): Move state into TranscriptionManager.\n }>;\n export const MeetingTranscriptionState = defineCapability<MeetingTranscriptionState>(\n `${TRANSCRIPTION_PLUGIN}/capability/meeting-transcription-state`,\n );\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;AAIA,2BAAiC;;UAMhBA,4BAAAA;6BAOFC,kBAAcC,uCAAiC,GAAGC,0CAAAA,yBAA6C;6BAM/FC,gCAA4BF,uCACvC,GAAGC,0CAAAA,yCAA6D;AAEpE,GAhBiBH,8BAAAA,4BAAAA,CAAAA,EAAAA;",
|
|
6
6
|
"names": ["TranscriptionCapabilities", "Transcriber", "defineCapability", "TRANSCRIPTION_PLUGIN", "MeetingTranscriptionState"]
|
|
7
7
|
}
|