@dxos/plugin-transcription 0.8.4-main.28f8d3d → 0.8.4-main.406dc2a
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-QN5WUMWJ.mjs +11 -0
- package/dist/lib/browser/blueprint-definition-GO6GTEBT.mjs +150 -0
- package/dist/lib/browser/blueprint-definition-GO6GTEBT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-UKUSJTQW.mjs → chunk-77NWYLC6.mjs} +2 -2
- package/dist/lib/browser/{chunk-5WH45KBY.mjs → chunk-7LNCQDTT.mjs} +9 -4
- package/dist/lib/browser/chunk-7LNCQDTT.mjs.map +7 -0
- package/dist/lib/browser/{chunk-KJIQQHJB.mjs → chunk-COBQIZ6B.mjs} +78 -98
- package/dist/lib/browser/{chunk-KJIQQHJB.mjs.map → chunk-COBQIZ6B.mjs.map} +3 -3
- package/dist/lib/browser/chunk-GGHMOEKZ.mjs +63 -0
- package/dist/lib/browser/chunk-GGHMOEKZ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-SREIAQSP.mjs → chunk-LCK3YRQF.mjs} +5 -5
- package/dist/lib/browser/chunk-LCK3YRQF.mjs.map +7 -0
- package/dist/lib/browser/{chunk-BJWYA2BU.mjs → chunk-ZS2FXKEF.mjs} +141 -168
- package/dist/lib/browser/chunk-ZS2FXKEF.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +22 -18
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-52EPFRMR.mjs +25 -0
- package/dist/lib/browser/intent-resolver-52EPFRMR.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-4MEJMKYQ.mjs → react-surface-LCP2D2MF.mjs} +10 -10
- package/dist/lib/browser/react-surface-LCP2D2MF.mjs.map +7 -0
- package/dist/lib/browser/{transcriber-V77CN7XX.mjs → transcriber-NG5MRCP6.mjs} +7 -7
- package/dist/lib/browser/{transcriber-V77CN7XX.mjs.map → transcriber-NG5MRCP6.mjs.map} +1 -1
- package/dist/lib/browser/types/index.mjs +6 -8
- package/dist/lib/node-esm/{TranscriptContainer-GEUOOYHX.mjs → TranscriptContainer-WCUWVVSD.mjs} +4 -4
- package/dist/lib/node-esm/blueprint-definition-6SU7GLBR.mjs +151 -0
- package/dist/lib/node-esm/blueprint-definition-6SU7GLBR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-A33GNR44.mjs → chunk-A6SB234F.mjs} +78 -98
- package/dist/lib/node-esm/{chunk-A33GNR44.mjs.map → chunk-A6SB234F.mjs.map} +3 -3
- package/dist/lib/node-esm/chunk-FTTZ4YSX.mjs +64 -0
- package/dist/lib/node-esm/chunk-FTTZ4YSX.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-XMUCZBP3.mjs → chunk-KLTPFUKN.mjs} +8 -4
- package/dist/lib/node-esm/chunk-KLTPFUKN.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-PHP7MCAY.mjs → chunk-N5Z4SKPH.mjs} +2 -2
- package/dist/lib/node-esm/{chunk-Y7PCJ34K.mjs → chunk-PEZRQYKO.mjs} +141 -168
- package/dist/lib/node-esm/chunk-PEZRQYKO.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-TM2ASOZA.mjs → chunk-RWRG3S2O.mjs} +5 -5
- package/dist/lib/node-esm/chunk-RWRG3S2O.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +22 -18
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-DZBQQRHN.mjs +26 -0
- package/dist/lib/node-esm/intent-resolver-DZBQQRHN.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-EZUPNHUC.mjs → react-surface-7UC2YXX2.mjs} +10 -10
- package/dist/lib/node-esm/react-surface-7UC2YXX2.mjs.map +7 -0
- package/dist/lib/node-esm/{transcriber-3SX3DNLV.mjs → transcriber-SMU7HD6F.mjs} +7 -7
- package/dist/lib/node-esm/{transcriber-3SX3DNLV.mjs.map → transcriber-SMU7HD6F.mjs.map} +1 -1
- package/dist/lib/node-esm/types/index.mjs +6 -8
- package/dist/types/src/TranscriptionPlugin.d.ts +1 -1
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts.map +1 -1
- package/dist/types/src/capabilities/index.d.ts +3 -2
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +1 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +1 -1
- package/dist/types/src/capabilities/react-surface.d.ts +1 -1
- package/dist/types/src/capabilities/transcriber.d.ts +1 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts +5 -5
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +31 -16
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +3 -3
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +1 -5
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +2 -2
- package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +8 -4
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +13 -6
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +10 -6
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +2 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +3 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/open.d.ts +7 -0
- package/dist/types/src/functions/open.d.ts.map +1 -0
- package/dist/types/src/functions/summarize.d.ts +11 -0
- package/dist/types/src/functions/summarize.d.ts.map +1 -0
- package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +376 -331
- package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +1 -1
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts +3 -7
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/types/Transcript.d.ts +30 -0
- package/dist/types/src/types/Transcript.d.ts.map +1 -0
- package/dist/types/src/types/TranscriptAction.d.ts +23 -0
- package/dist/types/src/types/TranscriptAction.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +0 -26
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -62
- package/src/TranscriptionPlugin.tsx +57 -53
- package/src/capabilities/blueprint-definition.ts +31 -0
- package/src/capabilities/capabilities.ts +3 -3
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +4 -10
- package/src/capabilities/react-surface.tsx +2 -2
- package/src/components/Transcript/Transcript.stories.tsx +32 -30
- package/src/components/Transcript/Transcript.tsx +17 -25
- package/src/components/Transcript/deprecated/OldTranscript.tsx +7 -7
- package/src/components/Transcript/transcript-extension.ts +2 -39
- package/src/components/TranscriptContainer.tsx +6 -6
- package/src/components/stories/FileTranscription.stories.tsx +42 -30
- package/src/components/stories/KeyWordRecognition.stories.tsx +16 -9
- package/src/components/stories/MicrophoneTranscription.stories.tsx +36 -32
- package/src/components/stories/TranscriptionStory.tsx +10 -6
- package/src/functions/index.ts +6 -0
- package/src/functions/open.ts +39 -0
- package/src/functions/summarize.ts +103 -0
- package/src/hooks/useAudioFile.ts +49 -53
- package/src/meta.ts +1 -3
- package/src/segments-normalization/normalization.test.ts +1 -1
- package/src/segments-normalization/normalization.ts +1 -1
- package/src/testing/testing.ts +5 -5
- package/src/transcriber/transcription-manager.ts +17 -38
- package/src/types/{schema.ts → Transcript.ts} +12 -9
- package/src/types/TranscriptAction.ts +24 -0
- package/src/types/index.ts +2 -1
- package/src/types/types.ts +0 -24
- package/dist/lib/browser/TranscriptContainer-FH7VAWYA.mjs +0 -11
- package/dist/lib/browser/chunk-5WH45KBY.mjs.map +0 -7
- package/dist/lib/browser/chunk-BJWYA2BU.mjs.map +0 -7
- package/dist/lib/browser/chunk-KWOOVS5G.mjs +0 -55
- package/dist/lib/browser/chunk-KWOOVS5G.mjs.map +0 -7
- package/dist/lib/browser/chunk-SREIAQSP.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-AOVQ7JI4.mjs +0 -30
- package/dist/lib/browser/intent-resolver-AOVQ7JI4.mjs.map +0 -7
- package/dist/lib/browser/react-surface-4MEJMKYQ.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-IKQMDRY6.mjs +0 -56
- package/dist/lib/node-esm/chunk-IKQMDRY6.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TM2ASOZA.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XMUCZBP3.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-Y7PCJ34K.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-P4XPIKQF.mjs +0 -31
- package/dist/lib/node-esm/intent-resolver-P4XPIKQF.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-EZUPNHUC.mjs.map +0 -7
- package/dist/types/src/types/schema.d.ts +0 -41
- package/dist/types/src/types/schema.d.ts.map +0 -1
- /package/dist/lib/browser/{TranscriptContainer-FH7VAWYA.mjs.map → TranscriptContainer-QN5WUMWJ.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-UKUSJTQW.mjs.map → chunk-77NWYLC6.mjs.map} +0 -0
- /package/dist/lib/node-esm/{TranscriptContainer-GEUOOYHX.mjs.map → TranscriptContainer-WCUWVVSD.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-PHP7MCAY.mjs.map → chunk-N5Z4SKPH.mjs.map} +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
TranscriptContainer_default,
|
|
3
|
+
TranscriptionContainer
|
|
4
|
+
} from "./chunk-ZS2FXKEF.mjs";
|
|
5
|
+
import "./chunk-LCK3YRQF.mjs";
|
|
6
|
+
import "./chunk-7LNCQDTT.mjs";
|
|
7
|
+
export {
|
|
8
|
+
TranscriptionContainer,
|
|
9
|
+
TranscriptContainer_default as default
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=TranscriptContainer-QN5WUMWJ.mjs.map
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import "./chunk-77NWYLC6.mjs";
|
|
2
|
+
import {
|
|
3
|
+
renderByline
|
|
4
|
+
} from "./chunk-ZS2FXKEF.mjs";
|
|
5
|
+
import "./chunk-LCK3YRQF.mjs";
|
|
6
|
+
import {
|
|
7
|
+
Transcript_exports
|
|
8
|
+
} from "./chunk-GGHMOEKZ.mjs";
|
|
9
|
+
import "./chunk-7LNCQDTT.mjs";
|
|
10
|
+
|
|
11
|
+
// src/capabilities/blueprint-definition.ts
|
|
12
|
+
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
13
|
+
import { Blueprint, Template } from "@dxos/blueprints";
|
|
14
|
+
import { trim as trim2 } from "@dxos/util";
|
|
15
|
+
|
|
16
|
+
// src/functions/open.ts
|
|
17
|
+
import * as Effect from "effect/Effect";
|
|
18
|
+
import * as Schema from "effect/Schema";
|
|
19
|
+
import { ArtifactId } from "@dxos/assistant";
|
|
20
|
+
import { Obj } from "@dxos/echo";
|
|
21
|
+
import { DatabaseService, QueueService, defineFunction } from "@dxos/functions";
|
|
22
|
+
import { DataType } from "@dxos/schema";
|
|
23
|
+
var open_default = defineFunction({
|
|
24
|
+
key: "dxos.org/function/transcription/open",
|
|
25
|
+
name: "Open",
|
|
26
|
+
description: "Opens and reads the contents of a transcription object.",
|
|
27
|
+
inputSchema: Schema.Struct({
|
|
28
|
+
id: ArtifactId.annotations({
|
|
29
|
+
description: "The ID of the transcription object."
|
|
30
|
+
})
|
|
31
|
+
}),
|
|
32
|
+
outputSchema: Schema.Struct({
|
|
33
|
+
content: Schema.String
|
|
34
|
+
}),
|
|
35
|
+
handler: Effect.fn(function* ({ data: { id } }) {
|
|
36
|
+
const transcript = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Transcript_exports.Transcript);
|
|
37
|
+
const { dxn } = yield* Effect.promise(() => transcript.queue.load());
|
|
38
|
+
const queue = yield* QueueService.getQueue(dxn);
|
|
39
|
+
yield* Effect.promise(() => queue?.queryObjects());
|
|
40
|
+
const content = queue?.objects.filter((message) => Obj.instanceOf(DataType.Message, message)).flatMap((message, index) => renderByline([])(message, index)).join("\n\n");
|
|
41
|
+
return {
|
|
42
|
+
content
|
|
43
|
+
};
|
|
44
|
+
})
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
// src/functions/summarize.ts
|
|
48
|
+
import * as Array from "effect/Array";
|
|
49
|
+
import * as Effect2 from "effect/Effect";
|
|
50
|
+
import * as Function from "effect/Function";
|
|
51
|
+
import * as Layer from "effect/Layer";
|
|
52
|
+
import * as Option from "effect/Option";
|
|
53
|
+
import * as Schema2 from "effect/Schema";
|
|
54
|
+
import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from "@dxos/ai";
|
|
55
|
+
import { AiSession, GenerationObserver } from "@dxos/assistant";
|
|
56
|
+
import { TracingService, defineFunction as defineFunction2 } from "@dxos/functions";
|
|
57
|
+
import { trim } from "@dxos/util";
|
|
58
|
+
var summarize_default = defineFunction2({
|
|
59
|
+
key: "dxos.org/function/transcription/summarize",
|
|
60
|
+
name: "Summarize",
|
|
61
|
+
description: "Summarize a transcript of a meeting.",
|
|
62
|
+
inputSchema: Schema2.Struct({
|
|
63
|
+
transcript: Schema2.String.annotations({
|
|
64
|
+
description: "The transcript of the meeting."
|
|
65
|
+
}),
|
|
66
|
+
notes: Schema2.optional(Schema2.String).annotations({
|
|
67
|
+
description: "Additional notes from the participants."
|
|
68
|
+
})
|
|
69
|
+
}),
|
|
70
|
+
outputSchema: Schema2.Struct({
|
|
71
|
+
summary: Schema2.String.annotations({
|
|
72
|
+
description: "The summary of the transcript."
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
75
|
+
handler: Effect2.fnUntraced(function* ({ data: { transcript, notes } }) {
|
|
76
|
+
const result = yield* new AiSession().run({
|
|
77
|
+
prompt: `Transcript: ${transcript}
|
|
78
|
+
|
|
79
|
+
Notes: ${notes}`,
|
|
80
|
+
history: [],
|
|
81
|
+
system: systemPrompt,
|
|
82
|
+
observer: GenerationObserver.fromPrinter(new ConsolePrinter({
|
|
83
|
+
tag: "summarize"
|
|
84
|
+
}))
|
|
85
|
+
});
|
|
86
|
+
const summary = Function.pipe(result, Array.findLast((msg) => msg.sender.role === "assistant" && msg.blocks.some((block) => block._tag === "text")), Option.flatMap((msg) => Function.pipe(msg.blocks, Array.findLast((block) => block._tag === "text"), Option.map((block) => block.text))), Option.getOrThrowWith(() => new Error("No summary found")));
|
|
87
|
+
return {
|
|
88
|
+
summary
|
|
89
|
+
};
|
|
90
|
+
}, Effect2.provide(Layer.mergeAll(AiService.model("@anthropic/claude-sonnet-4-0"), ToolResolverService.layerEmpty, ToolExecutionService.layerEmpty, TracingService.layerNoop)))
|
|
91
|
+
});
|
|
92
|
+
var systemPrompt = trim`
|
|
93
|
+
You are a helpful assistant that summarizes transcripts of meetings.
|
|
94
|
+
|
|
95
|
+
# Goal
|
|
96
|
+
Create a markdown summary of the meeting transcript with text notes provided.
|
|
97
|
+
Notes are very important so make sure to include them in the summary if they contain meaningful information.
|
|
98
|
+
|
|
99
|
+
# Formatting
|
|
100
|
+
- Format the summary as a markdown document without extra comments like "Here is the summary of the transcript:".
|
|
101
|
+
- Use markdown formatting for headings and bullet points.
|
|
102
|
+
- Format the summary as a list of key points and takeaways.
|
|
103
|
+
- All names of people should be in bold.
|
|
104
|
+
|
|
105
|
+
# Note Taking
|
|
106
|
+
- Correlate items in the summary with the person of origin to build a coherent narrative.
|
|
107
|
+
- Include short quotes verbatim where appropriate. Especially when concerned with design decisions and problem descriptions.
|
|
108
|
+
|
|
109
|
+
# Tasks
|
|
110
|
+
At the end of the summary include tasks.
|
|
111
|
+
Extract only the tasks that are:
|
|
112
|
+
- Directly actionable.
|
|
113
|
+
- Clearly assigned to a person or team (or can easily be inferred).
|
|
114
|
+
- Strongly implied by the conversation and/or user note (no speculative tasks).
|
|
115
|
+
- Specific enough that someone reading them would know exactly what to do next.
|
|
116
|
+
|
|
117
|
+
Format all tasks as markdown checkboxes using the syntax:
|
|
118
|
+
- [ ] Task description.
|
|
119
|
+
|
|
120
|
+
Additional information can be included (indented).
|
|
121
|
+
|
|
122
|
+
If no actionable tasks are found, omit this tasks section.
|
|
123
|
+
`;
|
|
124
|
+
|
|
125
|
+
// src/capabilities/blueprint-definition.ts
|
|
126
|
+
var functions = [
|
|
127
|
+
open_default,
|
|
128
|
+
summarize_default
|
|
129
|
+
];
|
|
130
|
+
var blueprint_definition_default = (() => {
|
|
131
|
+
return [
|
|
132
|
+
contributes(Capabilities.Functions, functions),
|
|
133
|
+
contributes(Capabilities.BlueprintDefinition, Blueprint.make({
|
|
134
|
+
key: "dxos.org/blueprint/transcription",
|
|
135
|
+
name: "Transcription",
|
|
136
|
+
tools: Blueprint.toolDefinitions({
|
|
137
|
+
functions
|
|
138
|
+
}),
|
|
139
|
+
instructions: Template.make({
|
|
140
|
+
source: trim2`
|
|
141
|
+
You can open and summarize a meeting transcript.
|
|
142
|
+
`
|
|
143
|
+
})
|
|
144
|
+
}))
|
|
145
|
+
];
|
|
146
|
+
});
|
|
147
|
+
export {
|
|
148
|
+
blueprint_definition_default as default
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=blueprint-definition-GO6GTEBT.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/blueprint-definition.ts", "../../../src/functions/open.ts", "../../../src/functions/summarize.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capabilities, contributes } from '@dxos/app-framework';\nimport { Blueprint, Template } from '@dxos/blueprints';\nimport { type FunctionDefinition } from '@dxos/functions';\nimport { trim } from '@dxos/util';\n\nimport { open, summarize } from '../functions';\n\nconst functions: FunctionDefinition[] = [open, summarize];\n\nexport default () => {\n return [\n contributes(Capabilities.Functions, functions),\n contributes(\n Capabilities.BlueprintDefinition,\n Blueprint.make({\n key: 'dxos.org/blueprint/transcription',\n name: 'Transcription',\n tools: Blueprint.toolDefinitions({ functions }),\n instructions: Template.make({\n source: trim`\n You can open and summarize a meeting transcript.\n `,\n }),\n }),\n ),\n ];\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\nimport * as Schema from 'effect/Schema';\n\nimport { ArtifactId } from '@dxos/assistant';\nimport { Obj } from '@dxos/echo';\nimport { DatabaseService, QueueService, defineFunction } from '@dxos/functions';\nimport { DataType } from '@dxos/schema';\n\nimport { renderByline } from '../components';\nimport { Transcript } from '../types';\n\nexport default defineFunction({\n key: 'dxos.org/function/transcription/open',\n name: 'Open',\n description: 'Opens and reads the contents of a transcription object.',\n inputSchema: Schema.Struct({\n id: ArtifactId.annotations({\n description: 'The ID of the transcription object.',\n }),\n }),\n outputSchema: Schema.Struct({\n content: Schema.String,\n }),\n handler: Effect.fn(function* ({ data: { id } }) {\n const transcript = yield* DatabaseService.resolve(ArtifactId.toDXN(id), Transcript.Transcript);\n const { dxn } = yield* Effect.promise(() => transcript.queue.load());\n const queue = yield* QueueService.getQueue(dxn);\n yield* Effect.promise(() => queue?.queryObjects());\n const content = queue?.objects\n .filter((message) => Obj.instanceOf(DataType.Message, message))\n .flatMap((message, index) => renderByline([])(message, index))\n .join('\\n\\n');\n return { content };\n }),\n});\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Array from 'effect/Array';\nimport * as Effect from 'effect/Effect';\nimport * as Function from 'effect/Function';\nimport * as Layer from 'effect/Layer';\nimport * as Option from 'effect/Option';\nimport * as Schema from 'effect/Schema';\n\nimport { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';\nimport { AiSession, GenerationObserver } from '@dxos/assistant';\nimport { TracingService, defineFunction } from '@dxos/functions';\nimport { trim } from '@dxos/util';\n\n/**\n * Summarize a transcript of a meeting.\n */\nexport default defineFunction({\n key: 'dxos.org/function/transcription/summarize',\n name: 'Summarize',\n description: 'Summarize a transcript of a meeting.',\n inputSchema: Schema.Struct({\n transcript: Schema.String.annotations({\n description: 'The transcript of the meeting.',\n }),\n notes: Schema.optional(Schema.String).annotations({\n description: 'Additional notes from the participants.',\n }),\n }),\n outputSchema: Schema.Struct({\n summary: Schema.String.annotations({\n description: 'The summary of the transcript.',\n }),\n }),\n handler: Effect.fnUntraced(\n function* ({ data: { transcript, notes } }) {\n const result = yield* new AiSession().run({\n prompt: `Transcript: ${transcript}\\n\\nNotes: ${notes}`,\n history: [],\n system: systemPrompt,\n observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'summarize' })),\n });\n\n const summary = Function.pipe(\n result,\n Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),\n Option.flatMap((msg) =>\n Function.pipe(\n msg.blocks,\n Array.findLast((block) => block._tag === 'text'),\n Option.map((block) => block.text),\n ),\n ),\n Option.getOrThrowWith(() => new Error('No summary found')),\n );\n\n return { summary };\n },\n Effect.provide(\n Layer.mergeAll(\n AiService.model('@anthropic/claude-sonnet-4-0'),\n ToolResolverService.layerEmpty,\n ToolExecutionService.layerEmpty,\n TracingService.layerNoop,\n ),\n ),\n ),\n});\n\nconst systemPrompt = trim`\n You are a helpful assistant that summarizes transcripts of meetings.\n\n # Goal\n Create a markdown summary of the meeting transcript with text notes provided.\n Notes are very important so make sure to include them in the summary if they contain meaningful information.\n\n # Formatting\n - Format the summary as a markdown document without extra comments like \"Here is the summary of the transcript:\".\n - Use markdown formatting for headings and bullet points.\n - Format the summary as a list of key points and takeaways.\n - All names of people should be in bold.\n\n # Note Taking\n - Correlate items in the summary with the person of origin to build a coherent narrative.\n - Include short quotes verbatim where appropriate. Especially when concerned with design decisions and problem descriptions.\n\n # Tasks\n At the end of the summary include tasks.\n Extract only the tasks that are:\n - Directly actionable.\n - Clearly assigned to a person or team (or can easily be inferred).\n - Strongly implied by the conversation and/or user note (no speculative tasks).\n - Specific enough that someone reading them would know exactly what to do next.\n\n Format all tasks as markdown checkboxes using the syntax:\n - [ ] Task description.\n\n Additional information can be included (indented).\n\n If no actionable tasks are found, omit this tasks section.\n`;\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["Capabilities", "contributes", "Blueprint", "Template", "trim", "Effect", "Schema", "ArtifactId", "Obj", "DatabaseService", "QueueService", "defineFunction", "DataType", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "id", "ArtifactId", "annotations", "outputSchema", "content", "String", "handler", "fn", "data", "transcript", "DatabaseService", "resolve", "toDXN", "Transcript", "dxn", "promise", "queue", "load", "QueueService", "getQueue", "queryObjects", "objects", "filter", "message", "Obj", "instanceOf", "DataType", "Message", "flatMap", "index", "renderByline", "join", "Array", "Effect", "Function", "Layer", "Option", "Schema", "AiService", "ConsolePrinter", "ToolExecutionService", "ToolResolverService", "AiSession", "GenerationObserver", "TracingService", "defineFunction", "trim", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "transcript", "String", "annotations", "notes", "optional", "outputSchema", "summary", "handler", "fnUntraced", "data", "result", "AiSession", "run", "prompt", "history", "system", "systemPrompt", "observer", "GenerationObserver", "fromPrinter", "ConsolePrinter", "tag", "pipe", "findLast", "msg", "sender", "role", "blocks", "some", "block", "_tag", "flatMap", "map", "text", "getOrThrowWith", "Error", "provide", "mergeAll", "AiService", "model", "ToolResolverService", "layerEmpty", "ToolExecutionService", "TracingService", "layerNoop", "trim", "functions", "open", "summarize", "contributes", "Capabilities", "Functions", "BlueprintDefinition", "Blueprint", "make", "key", "name", "tools", "toolDefinitions", "instructions", "Template", "source", "trim"]
|
|
7
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/components/index.ts
|
|
2
2
|
import { lazy } from "react";
|
|
3
|
-
var TranscriptContainer = lazy(() => import("./TranscriptContainer-
|
|
3
|
+
var TranscriptContainer = lazy(() => import("./TranscriptContainer-QN5WUMWJ.mjs"));
|
|
4
4
|
|
|
5
5
|
export {
|
|
6
6
|
TranscriptContainer
|
|
7
7
|
};
|
|
8
|
-
//# sourceMappingURL=chunk-
|
|
8
|
+
//# sourceMappingURL=chunk-77NWYLC6.mjs.map
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __export = (target, all) => {
|
|
3
|
+
for (var name in all)
|
|
4
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
5
|
+
};
|
|
6
|
+
|
|
1
7
|
// src/meta.ts
|
|
2
|
-
var TRANSCRIPTION_PLUGIN = "dxos.org/plugin/transcription";
|
|
3
8
|
var meta = {
|
|
4
|
-
id:
|
|
9
|
+
id: "dxos.org/plugin/transcription",
|
|
5
10
|
name: "Transcription",
|
|
6
11
|
description: "Voice transcription.",
|
|
7
12
|
icon: "ph--microphone--regular",
|
|
@@ -13,7 +18,7 @@ var meta = {
|
|
|
13
18
|
};
|
|
14
19
|
|
|
15
20
|
export {
|
|
16
|
-
|
|
21
|
+
__export,
|
|
17
22
|
meta
|
|
18
23
|
};
|
|
19
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-7LNCQDTT.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/meta.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2023 DXOS.org\n//\n\nimport { type PluginMeta } from '@dxos/app-framework';\n\nexport const meta: PluginMeta = {\n id: 'dxos.org/plugin/transcription',\n name: 'Transcription',\n description: 'Voice transcription.',\n icon: 'ph--microphone--regular',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transcription',\n tags: ['labs'],\n screenshots: [],\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;AAMO,IAAMA,OAAmB;EAC9BC,IAAI;EACJC,MAAM;EACNC,aAAa;EACbC,MAAM;EACNC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa,CAAA;AACf;",
|
|
6
|
+
"names": ["meta", "id", "name", "description", "icon", "source", "tags", "screenshots"]
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TRANSCRIPTION_URL
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-GGHMOEKZ.mjs";
|
|
4
4
|
|
|
5
5
|
// src/transcriber/media-stream-recorder.ts
|
|
6
6
|
import { MediaRecorder, register } from "extendable-media-recorder";
|
|
@@ -9,6 +9,19 @@ import { synchronized } from "@dxos/async";
|
|
|
9
9
|
import { invariant } from "@dxos/invariant";
|
|
10
10
|
import { log } from "@dxos/log";
|
|
11
11
|
import { trace } from "@dxos/tracing";
|
|
12
|
+
function _define_property(obj, key, value) {
|
|
13
|
+
if (key in obj) {
|
|
14
|
+
Object.defineProperty(obj, key, {
|
|
15
|
+
value,
|
|
16
|
+
enumerable: true,
|
|
17
|
+
configurable: true,
|
|
18
|
+
writable: true
|
|
19
|
+
});
|
|
20
|
+
} else {
|
|
21
|
+
obj[key] = value;
|
|
22
|
+
}
|
|
23
|
+
return obj;
|
|
24
|
+
}
|
|
12
25
|
function _ts_decorate(decorators, target, key, desc) {
|
|
13
26
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
14
27
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -22,18 +35,6 @@ var initializeExtendableMediaRecorder = async () => {
|
|
|
22
35
|
await register(await connect());
|
|
23
36
|
};
|
|
24
37
|
var MediaStreamRecorder = class {
|
|
25
|
-
_mediaStreamTrack;
|
|
26
|
-
/**
|
|
27
|
-
* Default MediaRecorder implementation do not support wav encoding.
|
|
28
|
-
*/
|
|
29
|
-
_config;
|
|
30
|
-
_mediaRecorder = void 0;
|
|
31
|
-
_header = void 0;
|
|
32
|
-
_onChunk;
|
|
33
|
-
constructor({ mediaStreamTrack, config }) {
|
|
34
|
-
this._mediaStreamTrack = mediaStreamTrack;
|
|
35
|
-
this._config = config;
|
|
36
|
-
}
|
|
37
38
|
get wavConfig() {
|
|
38
39
|
const settings = this._mediaStreamTrack.getSettings();
|
|
39
40
|
return {
|
|
@@ -49,7 +50,7 @@ var MediaStreamRecorder = class {
|
|
|
49
50
|
this._onChunk = onChunk;
|
|
50
51
|
}
|
|
51
52
|
async start() {
|
|
52
|
-
await (initializingPromise
|
|
53
|
+
await (initializingPromise ?? (initializingPromise = initializeExtendableMediaRecorder())).catch((err) => log.info("initializeExtendableMediaRecorder", {
|
|
53
54
|
err
|
|
54
55
|
}, {
|
|
55
56
|
F: __dxlog_file,
|
|
@@ -116,6 +117,15 @@ var MediaStreamRecorder = class {
|
|
|
116
117
|
data: wav.getSamples()
|
|
117
118
|
});
|
|
118
119
|
}
|
|
120
|
+
constructor({ mediaStreamTrack, config }) {
|
|
121
|
+
_define_property(this, "_mediaStreamTrack", void 0);
|
|
122
|
+
_define_property(this, "_config", void 0);
|
|
123
|
+
_define_property(this, "_mediaRecorder", void 0);
|
|
124
|
+
_define_property(this, "_header", void 0);
|
|
125
|
+
_define_property(this, "_onChunk", void 0);
|
|
126
|
+
this._mediaStreamTrack = mediaStreamTrack;
|
|
127
|
+
this._config = config;
|
|
128
|
+
}
|
|
119
129
|
};
|
|
120
130
|
_ts_decorate([
|
|
121
131
|
synchronized
|
|
@@ -143,6 +153,19 @@ var mergeFloat64Arrays = (arrays) => {
|
|
|
143
153
|
};
|
|
144
154
|
|
|
145
155
|
// src/transcriber/transcriber.ts
|
|
156
|
+
function _define_property2(obj, key, value) {
|
|
157
|
+
if (key in obj) {
|
|
158
|
+
Object.defineProperty(obj, key, {
|
|
159
|
+
value,
|
|
160
|
+
enumerable: true,
|
|
161
|
+
configurable: true,
|
|
162
|
+
writable: true
|
|
163
|
+
});
|
|
164
|
+
} else {
|
|
165
|
+
obj[key] = value;
|
|
166
|
+
}
|
|
167
|
+
return obj;
|
|
168
|
+
}
|
|
146
169
|
function _ts_decorate2(decorators, target, key, desc) {
|
|
147
170
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
148
171
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -151,22 +174,6 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
151
174
|
}
|
|
152
175
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/transcriber.ts";
|
|
153
176
|
var Transcriber = class extends Resource {
|
|
154
|
-
_audioChunks = [];
|
|
155
|
-
_lastUsedTimestamp = 0;
|
|
156
|
-
_openTrigger = new Trigger({
|
|
157
|
-
autoReset: true
|
|
158
|
-
});
|
|
159
|
-
_config;
|
|
160
|
-
_recorder;
|
|
161
|
-
_onSegments;
|
|
162
|
-
_recording = false;
|
|
163
|
-
_transcribeTask = void 0;
|
|
164
|
-
constructor({ config, recorder, onSegments }) {
|
|
165
|
-
super();
|
|
166
|
-
this._config = config;
|
|
167
|
-
this._recorder = recorder;
|
|
168
|
-
this._onSegments = onSegments;
|
|
169
|
-
}
|
|
170
177
|
async _open(ctx) {
|
|
171
178
|
log2.info("opening", void 0, {
|
|
172
179
|
F: __dxlog_file2,
|
|
@@ -315,6 +322,14 @@ var Transcriber = class extends Resource {
|
|
|
315
322
|
text: segment.text.trim()
|
|
316
323
|
}));
|
|
317
324
|
}
|
|
325
|
+
constructor({ config, recorder, onSegments }) {
|
|
326
|
+
super(), _define_property2(this, "_audioChunks", []), _define_property2(this, "_lastUsedTimestamp", 0), _define_property2(this, "_openTrigger", new Trigger({
|
|
327
|
+
autoReset: true
|
|
328
|
+
})), _define_property2(this, "_config", void 0), _define_property2(this, "_recorder", void 0), _define_property2(this, "_onSegments", void 0), _define_property2(this, "_recording", false), _define_property2(this, "_transcribeTask", void 0);
|
|
329
|
+
this._config = config;
|
|
330
|
+
this._recorder = recorder;
|
|
331
|
+
this._onSegments = onSegments;
|
|
332
|
+
}
|
|
318
333
|
};
|
|
319
334
|
_ts_decorate2([
|
|
320
335
|
trace2.span({
|
|
@@ -333,6 +348,19 @@ import { synchronized as synchronized2 } from "@dxos/async";
|
|
|
333
348
|
import { Resource as Resource2 } from "@dxos/context";
|
|
334
349
|
import { Obj } from "@dxos/echo";
|
|
335
350
|
import { DataType } from "@dxos/schema";
|
|
351
|
+
function _define_property3(obj, key, value) {
|
|
352
|
+
if (key in obj) {
|
|
353
|
+
Object.defineProperty(obj, key, {
|
|
354
|
+
value,
|
|
355
|
+
enumerable: true,
|
|
356
|
+
configurable: true,
|
|
357
|
+
writable: true
|
|
358
|
+
});
|
|
359
|
+
} else {
|
|
360
|
+
obj[key] = value;
|
|
361
|
+
}
|
|
362
|
+
return obj;
|
|
363
|
+
}
|
|
336
364
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
337
365
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
338
366
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -343,19 +371,6 @@ var RECORD_INTERVAL = 200;
|
|
|
343
371
|
var PREFIXED_CHUNKS_AMOUNT = 10;
|
|
344
372
|
var TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
|
|
345
373
|
var TranscriptionManager = class extends Resource2 {
|
|
346
|
-
_edgeClient;
|
|
347
|
-
_messageEnricher;
|
|
348
|
-
_audioStreamTrack = void 0;
|
|
349
|
-
_identityDid = void 0;
|
|
350
|
-
_mediaRecorder = void 0;
|
|
351
|
-
_transcriber = void 0;
|
|
352
|
-
_queue = void 0;
|
|
353
|
-
_enabled = signal(false);
|
|
354
|
-
constructor(options) {
|
|
355
|
-
super();
|
|
356
|
-
this._edgeClient = options.edgeClient;
|
|
357
|
-
this._messageEnricher = options.messageEnricher;
|
|
358
|
-
}
|
|
359
374
|
/** @reactive */
|
|
360
375
|
get enabled() {
|
|
361
376
|
return this._enabled.value;
|
|
@@ -381,73 +396,32 @@ var TranscriptionManager = class extends Resource2 {
|
|
|
381
396
|
}
|
|
382
397
|
return this;
|
|
383
398
|
}
|
|
384
|
-
/**
|
|
385
|
-
* Enable or disable transcription.
|
|
386
|
-
* @param enabled - Whether to enable transcription.
|
|
387
|
-
*/
|
|
388
399
|
async setEnabled(enabled) {
|
|
389
400
|
if (this._enabled.value === enabled) {
|
|
390
401
|
return;
|
|
391
402
|
}
|
|
392
403
|
this._enabled.value = enabled ?? false;
|
|
393
|
-
|
|
404
|
+
if (enabled) {
|
|
405
|
+
await this._maybeRestartTranscriber();
|
|
406
|
+
} else {
|
|
407
|
+
await this._stopTranscriber();
|
|
408
|
+
}
|
|
394
409
|
}
|
|
395
410
|
async setAudioTrack(track) {
|
|
396
411
|
if (this._audioStreamTrack === track) {
|
|
397
412
|
return;
|
|
398
413
|
}
|
|
399
414
|
this._audioStreamTrack = track;
|
|
400
|
-
|
|
415
|
+
await this._maybeRestartTranscriber();
|
|
401
416
|
}
|
|
402
417
|
async _open() {
|
|
403
|
-
await this.
|
|
418
|
+
await this._maybeRestartTranscriber();
|
|
404
419
|
}
|
|
405
420
|
async _close() {
|
|
406
|
-
|
|
407
|
-
}
|
|
408
|
-
// TODO(burdon): Change this to setEnables (explicit), not toggle.
|
|
409
|
-
async _toggleTranscriber() {
|
|
410
|
-
await this._maybeReinitTranscriber();
|
|
411
|
-
if (this._enabled.value) {
|
|
412
|
-
await this._transcriber?.open();
|
|
413
|
-
const block = Obj.make(DataType.Message, {
|
|
414
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
415
|
-
blocks: [
|
|
416
|
-
{
|
|
417
|
-
_tag: "transcript",
|
|
418
|
-
text: "Started",
|
|
419
|
-
started: (/* @__PURE__ */ new Date()).toISOString()
|
|
420
|
-
}
|
|
421
|
-
],
|
|
422
|
-
sender: {
|
|
423
|
-
role: "assistant"
|
|
424
|
-
}
|
|
425
|
-
});
|
|
426
|
-
await this._queue?.append([
|
|
427
|
-
block
|
|
428
|
-
]);
|
|
429
|
-
} else {
|
|
430
|
-
await this._transcriber?.close();
|
|
431
|
-
const block = Obj.make(DataType.Message, {
|
|
432
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
433
|
-
blocks: [
|
|
434
|
-
{
|
|
435
|
-
_tag: "transcript",
|
|
436
|
-
text: "Stopped",
|
|
437
|
-
started: (/* @__PURE__ */ new Date()).toISOString()
|
|
438
|
-
}
|
|
439
|
-
],
|
|
440
|
-
sender: {
|
|
441
|
-
role: "assistant"
|
|
442
|
-
}
|
|
443
|
-
});
|
|
444
|
-
await this._queue?.append([
|
|
445
|
-
block
|
|
446
|
-
]);
|
|
447
|
-
}
|
|
421
|
+
await this._stopTranscriber();
|
|
448
422
|
}
|
|
449
|
-
async
|
|
450
|
-
if (!this._audioStreamTrack || !this._enabled.value) {
|
|
423
|
+
async _maybeRestartTranscriber() {
|
|
424
|
+
if (!this._audioStreamTrack || !this._enabled.value || !this.isOpen) {
|
|
451
425
|
return;
|
|
452
426
|
}
|
|
453
427
|
let needReinit = false;
|
|
@@ -470,8 +444,12 @@ var TranscriptionManager = class extends Resource2 {
|
|
|
470
444
|
recorder: this._mediaRecorder,
|
|
471
445
|
onSegments: (segments) => this._onSegments(segments)
|
|
472
446
|
});
|
|
447
|
+
await this._transcriber?.open();
|
|
473
448
|
}
|
|
474
449
|
}
|
|
450
|
+
async _stopTranscriber() {
|
|
451
|
+
await this._transcriber?.close();
|
|
452
|
+
}
|
|
475
453
|
async _onSegments(segments) {
|
|
476
454
|
if (!this.isOpen || !this._queue) {
|
|
477
455
|
return;
|
|
@@ -490,10 +468,12 @@ var TranscriptionManager = class extends Resource2 {
|
|
|
490
468
|
block
|
|
491
469
|
]);
|
|
492
470
|
}
|
|
471
|
+
constructor(options) {
|
|
472
|
+
super(), _define_property3(this, "_edgeClient", void 0), _define_property3(this, "_messageEnricher", void 0), _define_property3(this, "_audioStreamTrack", void 0), _define_property3(this, "_identityDid", void 0), _define_property3(this, "_mediaRecorder", void 0), _define_property3(this, "_transcriber", void 0), _define_property3(this, "_queue", void 0), _define_property3(this, "_enabled", signal(false));
|
|
473
|
+
this._edgeClient = options.edgeClient;
|
|
474
|
+
this._messageEnricher = options.messageEnricher;
|
|
475
|
+
}
|
|
493
476
|
};
|
|
494
|
-
_ts_decorate3([
|
|
495
|
-
synchronized2
|
|
496
|
-
], TranscriptionManager.prototype, "setEnabled", null);
|
|
497
477
|
_ts_decorate3([
|
|
498
478
|
synchronized2
|
|
499
479
|
], TranscriptionManager.prototype, "setAudioTrack", null);
|
|
@@ -503,4 +483,4 @@ export {
|
|
|
503
483
|
Transcriber,
|
|
504
484
|
TranscriptionManager
|
|
505
485
|
};
|
|
506
|
-
//# sourceMappingURL=chunk-
|
|
486
|
+
//# sourceMappingURL=chunk-COBQIZ6B.mjs.map
|