@dxos/plugin-transcription 0.8.4-main.2e9d522 → 0.8.4-main.3c1ae3b
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-CYFNAJR5.mjs +11 -0
- package/dist/lib/browser/blueprint-definition-V2FCESA2.mjs +148 -0
- package/dist/lib/browser/blueprint-definition-V2FCESA2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-U6QBOGTN.mjs → chunk-3MKZ2MNQ.mjs} +5 -5
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs.map +7 -0
- package/dist/lib/browser/{chunk-FFEPEPCU.mjs → chunk-7GNN7E3U.mjs} +51 -80
- package/dist/lib/browser/chunk-7GNN7E3U.mjs.map +7 -0
- package/dist/lib/browser/chunk-QOSZIUE2.mjs +32 -0
- package/dist/lib/browser/chunk-QOSZIUE2.mjs.map +7 -0
- package/dist/lib/browser/{chunk-5KPYIC3N.mjs → chunk-TKPWXMFW.mjs} +341 -366
- package/dist/lib/browser/chunk-TKPWXMFW.mjs.map +7 -0
- package/dist/lib/browser/chunk-VBUIO677.mjs +29 -0
- package/dist/lib/browser/chunk-VBUIO677.mjs.map +7 -0
- package/dist/lib/browser/{chunk-4FJIYH7T.mjs → chunk-VGTA4QFL.mjs} +2 -2
- package/dist/lib/browser/index.mjs +23 -20
- package/dist/lib/browser/index.mjs.map +3 -3
- package/dist/lib/browser/intent-resolver-5CGCLOXB.mjs +25 -0
- package/dist/lib/browser/intent-resolver-5CGCLOXB.mjs.map +7 -0
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/{react-surface-E5D5AE3F.mjs → react-surface-LQYCO3FR.mjs} +9 -11
- package/dist/lib/browser/react-surface-LQYCO3FR.mjs.map +7 -0
- package/dist/lib/browser/{transcriber-PXT4QBFY.mjs → transcriber-6YDM5ZDT.mjs} +7 -7
- package/dist/lib/browser/transcriber-6YDM5ZDT.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +4 -8
- package/dist/lib/node-esm/{TranscriptContainer-VBAOM5DG.mjs → TranscriptContainer-LOD4X5WH.mjs} +4 -4
- package/dist/lib/node-esm/blueprint-definition-5CJWJRO4.mjs +149 -0
- package/dist/lib/node-esm/blueprint-definition-5CJWJRO4.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-HT3W7LDP.mjs → chunk-5JN2MHYA.mjs} +51 -80
- package/dist/lib/node-esm/chunk-5JN2MHYA.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-TJKAO7VR.mjs → chunk-FXZHX3PK.mjs} +341 -366
- package/dist/lib/node-esm/chunk-FXZHX3PK.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-RHF2ALML.mjs → chunk-SWUVPFKR.mjs} +5 -5
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Y2B4HWSS.mjs → chunk-T77E2ZS6.mjs} +2 -2
- package/dist/lib/node-esm/chunk-U4YPUD2F.mjs +33 -0
- package/dist/lib/node-esm/chunk-U4YPUD2F.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs +30 -0
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +23 -20
- package/dist/lib/node-esm/index.mjs.map +3 -3
- package/dist/lib/node-esm/intent-resolver-4H4CXIAL.mjs +26 -0
- package/dist/lib/node-esm/intent-resolver-4H4CXIAL.mjs.map +7 -0
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/{react-surface-QRDJOHN5.mjs → react-surface-NP3QNDJX.mjs} +9 -11
- package/dist/lib/node-esm/react-surface-NP3QNDJX.mjs.map +7 -0
- package/dist/lib/node-esm/{transcriber-YUTEVANE.mjs → transcriber-CPD3FZ7M.mjs} +7 -7
- package/dist/lib/node-esm/transcriber-CPD3FZ7M.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +4 -8
- package/dist/types/src/TranscriptionPlugin.d.ts +1 -1
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/capabilities/blueprint-definition.d.ts +5 -0
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/capabilities.d.ts +1 -1
- 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/capabilities/transcriber.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.d.ts +6 -7
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +33 -18
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +3 -3
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +3 -7
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +2 -2
- package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +5 -4
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +10 -6
- package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +7 -6
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +4 -3
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
- package/dist/types/src/functions/index.d.ts +3 -0
- package/dist/types/src/functions/index.d.ts.map +1 -0
- package/dist/types/src/functions/open.d.ts +7 -0
- package/dist/types/src/functions/open.d.ts.map +1 -0
- package/dist/types/src/functions/summarize.d.ts +11 -0
- package/dist/types/src/functions/summarize.d.ts.map +1 -0
- package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
- package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +0 -1
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/message-normalizer.d.ts +3 -3
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +410 -365
- package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/utils.d.ts +2 -2
- package/dist/types/src/segments-normalization/utils.d.ts.map +1 -1
- package/dist/types/src/testing/testing.d.ts +7 -7
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +2 -2
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts +6 -10
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/types/TranscriptAction.d.ts +23 -0
- package/dist/types/src/types/TranscriptAction.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +1 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/types/types.d.ts +0 -26
- package/dist/types/src/types/types.d.ts.map +1 -1
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +66 -63
- package/src/TranscriptionPlugin.tsx +58 -54
- package/src/capabilities/blueprint-definition.ts +31 -0
- package/src/capabilities/capabilities.ts +6 -6
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/intent-resolver.ts +6 -11
- package/src/capabilities/react-surface.tsx +2 -2
- package/src/capabilities/transcriber.ts +3 -2
- package/src/components/Transcript/Transcript.stories.tsx +38 -35
- package/src/components/Transcript/Transcript.tsx +24 -31
- package/src/components/Transcript/deprecated/OldTranscript.tsx +9 -9
- package/src/components/Transcript/transcript-extension.ts +11 -44
- package/src/components/TranscriptContainer.tsx +11 -10
- package/src/components/stories/FileTranscription.stories.tsx +54 -42
- package/src/components/stories/KeyWordRecognition.stories.tsx +16 -12
- package/src/components/stories/MicrophoneTranscription.stories.tsx +55 -50
- package/src/components/stories/TranscriptionStory.tsx +14 -11
- 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/hooks/useTranscriber.ts +7 -2
- package/src/hooks/useVoiceInput.ts +3 -2
- package/src/meta.ts +7 -4
- package/src/model/model.test.ts +12 -12
- package/src/segments-normalization/message-normalizer.ts +7 -7
- package/src/segments-normalization/normalization.test.ts +10 -10
- package/src/segments-normalization/normalization.ts +43 -42
- package/src/segments-normalization/utils.ts +2 -2
- package/src/testing/testing.ts +34 -24
- package/src/transcriber/media-stream-recorder.ts +1 -1
- package/src/transcriber/transcriber.browser.test.ts +5 -4
- package/src/transcriber/transcriber.ts +5 -4
- package/src/transcriber/transcription-manager.ts +23 -44
- package/src/types/TranscriptAction.ts +23 -0
- package/src/types/index.ts +1 -1
- package/src/types/types.ts +0 -23
- package/dist/lib/browser/TranscriptContainer-6WCKCXQ6.mjs +0 -11
- package/dist/lib/browser/chunk-5KPYIC3N.mjs.map +0 -7
- package/dist/lib/browser/chunk-5WH45KBY.mjs +0 -19
- package/dist/lib/browser/chunk-5WH45KBY.mjs.map +0 -7
- package/dist/lib/browser/chunk-FFEPEPCU.mjs.map +0 -7
- package/dist/lib/browser/chunk-R7INNNUQ.mjs +0 -55
- package/dist/lib/browser/chunk-R7INNNUQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-U6QBOGTN.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-3O33MMP5.mjs +0 -30
- package/dist/lib/browser/intent-resolver-3O33MMP5.mjs.map +0 -7
- package/dist/lib/browser/react-surface-E5D5AE3F.mjs.map +0 -7
- package/dist/lib/browser/transcriber-PXT4QBFY.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-HT3W7LDP.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-RHF2ALML.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-TJKAO7VR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-U65ZWK3L.mjs +0 -56
- package/dist/lib/node-esm/chunk-U65ZWK3L.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-XMUCZBP3.mjs +0 -21
- package/dist/lib/node-esm/chunk-XMUCZBP3.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-YMN5SXNC.mjs +0 -31
- package/dist/lib/node-esm/intent-resolver-YMN5SXNC.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-QRDJOHN5.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-YUTEVANE.mjs.map +0 -7
- package/dist/types/src/types/schema.d.ts +0 -41
- package/dist/types/src/types/schema.d.ts.map +0 -1
- package/src/types/schema.ts +0 -41
- /package/dist/lib/browser/{TranscriptContainer-6WCKCXQ6.mjs.map → TranscriptContainer-CYFNAJR5.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-4FJIYH7T.mjs.map → chunk-VGTA4QFL.mjs.map} +0 -0
- /package/dist/lib/node-esm/{TranscriptContainer-VBAOM5DG.mjs.map → TranscriptContainer-LOD4X5WH.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-Y2B4HWSS.mjs.map → chunk-T77E2ZS6.mjs.map} +0 -0
|
@@ -1,34 +1,32 @@
|
|
|
1
|
-
import "./chunk-
|
|
1
|
+
import "./chunk-VGTA4QFL.mjs";
|
|
2
2
|
import {
|
|
3
3
|
TranscriptionContainer
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import
|
|
6
|
-
TranscriptType
|
|
7
|
-
} from "./chunk-R7INNNUQ.mjs";
|
|
8
|
-
import "./chunk-U6QBOGTN.mjs";
|
|
4
|
+
} from "./chunk-TKPWXMFW.mjs";
|
|
5
|
+
import "./chunk-3MKZ2MNQ.mjs";
|
|
9
6
|
import {
|
|
10
7
|
meta
|
|
11
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VBUIO677.mjs";
|
|
12
9
|
|
|
13
10
|
// src/capabilities/react-surface.tsx
|
|
14
11
|
import React from "react";
|
|
15
12
|
import { Capabilities, contributes, createSurface } from "@dxos/app-framework";
|
|
16
13
|
import { Obj } from "@dxos/echo";
|
|
17
|
-
|
|
14
|
+
import { Transcript } from "@dxos/types";
|
|
15
|
+
var react_surface_default = (() => contributes(Capabilities.ReactSurface, [
|
|
18
16
|
createSurface({
|
|
19
17
|
id: `${meta.id}/article/transcript`,
|
|
20
18
|
role: [
|
|
21
19
|
"article",
|
|
22
20
|
"section"
|
|
23
21
|
],
|
|
24
|
-
filter: (data) => Obj.instanceOf(
|
|
22
|
+
filter: (data) => Obj.instanceOf(Transcript.Transcript, data.subject),
|
|
25
23
|
component: ({ data, role }) => /* @__PURE__ */ React.createElement(TranscriptionContainer, {
|
|
26
24
|
transcript: data.subject,
|
|
27
25
|
role
|
|
28
26
|
})
|
|
29
27
|
})
|
|
30
|
-
]);
|
|
28
|
+
]));
|
|
31
29
|
export {
|
|
32
30
|
react_surface_default as default
|
|
33
31
|
};
|
|
34
|
-
//# sourceMappingURL=react-surface-
|
|
32
|
+
//# sourceMappingURL=react-surface-LQYCO3FR.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/react-surface.tsx"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport React from 'react';\n\nimport { Capabilities, contributes, createSurface } from '@dxos/app-framework';\nimport { Obj } from '@dxos/echo';\nimport { Transcript } from '@dxos/types';\n\nimport { TranscriptionContainer } from '../components';\nimport { meta } from '../meta';\n\nexport default () =>\n contributes(Capabilities.ReactSurface, [\n createSurface({\n id: `${meta.id}/article/transcript`,\n role: ['article', 'section'],\n filter: (data): data is { subject: Transcript.Transcript } => Obj.instanceOf(Transcript.Transcript, data.subject),\n component: ({ data, role }) => <TranscriptionContainer transcript={data.subject} role={role} />,\n }),\n ]);\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;AAIA,OAAOA,WAAW;AAElB,SAASC,cAAcC,aAAaC,qBAAqB;AACzD,SAASC,WAAW;AACpB,SAASC,kBAAkB;AAK3B,IAAA,yBAAe,MACbC,YAAYC,aAAaC,cAAc;EACrCC,cAAc;IACZC,IAAI,GAAGC,KAAKD,EAAE;IACdE,MAAM;MAAC;MAAW;;IAClBC,QAAQ,CAACC,SAAqDC,IAAIC,WAAWC,WAAWA,YAAYH,KAAKI,OAAO;IAChHC,WAAW,CAAC,EAAEL,MAAMF,KAAI,MAAO,sBAAA,cAACQ,wBAAAA;MAAuBC,YAAYP,KAAKI;MAASN;;EACnF,CAAA;CACD;",
|
|
6
|
+
"names": ["React", "Capabilities", "contributes", "createSurface", "Obj", "Transcript", "contributes", "Capabilities", "ReactSurface", "createSurface", "id", "meta", "role", "filter", "data", "Obj", "instanceOf", "Transcript", "subject", "component", "TranscriptionContainer", "transcript"]
|
|
7
|
+
}
|
|
@@ -2,12 +2,12 @@ import {
|
|
|
2
2
|
MediaStreamRecorder,
|
|
3
3
|
Transcriber,
|
|
4
4
|
TranscriptionManager
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-7GNN7E3U.mjs";
|
|
6
|
+
import "./chunk-QOSZIUE2.mjs";
|
|
7
7
|
import {
|
|
8
8
|
TranscriptionCapabilities
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-3MKZ2MNQ.mjs";
|
|
10
|
+
import "./chunk-VBUIO677.mjs";
|
|
11
11
|
|
|
12
12
|
// src/capabilities/transcriber.ts
|
|
13
13
|
import { contributes } from "@dxos/app-framework";
|
|
@@ -15,7 +15,7 @@ import { ClientCapabilities } from "@dxos/plugin-client";
|
|
|
15
15
|
var RECORD_INTERVAL = 200;
|
|
16
16
|
var PREFIXED_CHUNKS_AMOUNT = 10;
|
|
17
17
|
var TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
|
|
18
|
-
var transcriber_default = (context) => {
|
|
18
|
+
var transcriber_default = ((context) => {
|
|
19
19
|
const getTranscriber = ({ audioStreamTrack, onSegments, transcriberConfig, recorderConfig }) => {
|
|
20
20
|
return new Transcriber({
|
|
21
21
|
config: {
|
|
@@ -49,8 +49,8 @@ var transcriber_default = (context) => {
|
|
|
49
49
|
contributes(TranscriptionCapabilities.Transcriber, getTranscriber),
|
|
50
50
|
contributes(TranscriptionCapabilities.TranscriptionManager, getTranscriptionManager)
|
|
51
51
|
];
|
|
52
|
-
};
|
|
52
|
+
});
|
|
53
53
|
export {
|
|
54
54
|
transcriber_default as default
|
|
55
55
|
};
|
|
56
|
-
//# sourceMappingURL=transcriber-
|
|
56
|
+
//# sourceMappingURL=transcriber-6YDM5ZDT.mjs.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/capabilities/transcriber.ts"],
|
|
4
|
+
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { type PluginContext, contributes } from '@dxos/app-framework';\nimport { ClientCapabilities } from '@dxos/plugin-client';\n\nimport { MediaStreamRecorder, Transcriber, TranscriptionManager } from '../transcriber';\n\nimport { TranscriptionCapabilities } from './capabilities';\n\n// TODO(burdon): Move to config?\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\n/**\n * Records audio while user is speaking and transcribes it after user is done speaking.\n */\nexport default (context: PluginContext) => {\n const getTranscriber: TranscriptionCapabilities.GetTranscriber = ({\n audioStreamTrack,\n onSegments,\n transcriberConfig,\n recorderConfig,\n }) => {\n // Initialize audio transcription.\n return new Transcriber({\n config: {\n transcribeAfterChunksAmount: TRANSCRIBE_AFTER_CHUNKS_AMOUNT,\n prefixBufferChunksAmount: PREFIXED_CHUNKS_AMOUNT,\n ...transcriberConfig,\n },\n recorder: new MediaStreamRecorder({\n mediaStreamTrack: audioStreamTrack,\n config: {\n interval: RECORD_INTERVAL,\n ...recorderConfig,\n },\n }),\n onSegments,\n });\n };\n\n const getTranscriptionManager: TranscriptionCapabilities.GetTranscriptionManager = ({ messageEnricher }) => {\n const client = context.getCapability(ClientCapabilities.Client);\n const transcriptionManager = new TranscriptionManager({\n edgeClient: client.edge,\n messageEnricher,\n });\n\n const identity = client.halo.identity.get();\n if (identity) {\n transcriptionManager.setIdentityDid(identity.did);\n }\n\n return transcriptionManager;\n };\n\n return [\n contributes(TranscriptionCapabilities.Transcriber, getTranscriber),\n contributes(TranscriptionCapabilities.TranscriptionManager, getTranscriptionManager),\n ];\n};\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;AAIA,SAA6BA,mBAAmB;AAChD,SAASC,0BAA0B;AAWnC,IAAMC,kBAAkB;AAKxB,IAAMC,yBAAyB;AAM/B,IAAMC,iCAAiC;AAKvC,IAAA,uBAAe,CAACC,YAAAA;AACd,QAAMC,iBAA2D,CAAC,EAChEC,kBACAC,YACAC,mBACAC,eAAc,MACf;AAEC,WAAO,IAAIC,YAAY;MACrBC,QAAQ;QACNC,6BAA6BT;QAC7BU,0BAA0BX;QAC1B,GAAGM;MACL;MACAM,UAAU,IAAIC,oBAAoB;QAChCC,kBAAkBV;QAClBK,QAAQ;UACNM,UAAUhB;UACV,GAAGQ;QACL;MACF,CAAA;MACAF;IACF,CAAA;EACF;AAEA,QAAMW,0BAA6E,CAAC,EAAEC,gBAAe,MAAE;AACrG,UAAMC,SAAShB,QAAQiB,cAAcC,mBAAmBC,MAAM;AAC9D,UAAMC,uBAAuB,IAAIC,qBAAqB;MACpDC,YAAYN,OAAOO;MACnBR;IACF,CAAA;AAEA,UAAMS,WAAWR,OAAOS,KAAKD,SAASE,IAAG;AACzC,QAAIF,UAAU;AACZJ,2BAAqBO,eAAeH,SAASI,GAAG;IAClD;AAEA,WAAOR;EACT;AAEA,SAAO;IACLS,YAAYC,0BAA0BxB,aAAaL,cAAAA;IACnD4B,YAAYC,0BAA0BT,sBAAsBP,uBAAAA;;AAEhE;",
|
|
6
|
+
"names": ["contributes", "ClientCapabilities", "RECORD_INTERVAL", "PREFIXED_CHUNKS_AMOUNT", "TRANSCRIBE_AFTER_CHUNKS_AMOUNT", "context", "getTranscriber", "audioStreamTrack", "onSegments", "transcriberConfig", "recorderConfig", "Transcriber", "config", "transcribeAfterChunksAmount", "prefixBufferChunksAmount", "recorder", "MediaStreamRecorder", "mediaStreamTrack", "interval", "getTranscriptionManager", "messageEnricher", "client", "getCapability", "ClientCapabilities", "Client", "transcriptionManager", "TranscriptionManager", "edgeClient", "edge", "identity", "halo", "get", "setIdentityDid", "did", "contributes", "TranscriptionCapabilities"]
|
|
7
|
+
}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
TRANSCRIPTION_URL,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "../chunk-R7INNNUQ.mjs";
|
|
7
|
-
import "../chunk-5WH45KBY.mjs";
|
|
3
|
+
TranscriptAction_exports
|
|
4
|
+
} from "../chunk-QOSZIUE2.mjs";
|
|
5
|
+
import "../chunk-VBUIO677.mjs";
|
|
8
6
|
export {
|
|
9
7
|
TRANSCRIPTION_URL,
|
|
10
|
-
|
|
11
|
-
TranscriptType,
|
|
12
|
-
TranscriptionAction
|
|
8
|
+
TranscriptAction_exports as TranscriptAction
|
|
13
9
|
};
|
|
14
10
|
//# sourceMappingURL=index.mjs.map
|
package/dist/lib/node-esm/{TranscriptContainer-VBAOM5DG.mjs → TranscriptContainer-LOD4X5WH.mjs}
RENAMED
|
@@ -2,11 +2,11 @@ import { createRequire } from 'node:module';const require = createRequire(import
|
|
|
2
2
|
import {
|
|
3
3
|
TranscriptContainer_default,
|
|
4
4
|
TranscriptionContainer
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-FXZHX3PK.mjs";
|
|
6
|
+
import "./chunk-SWUVPFKR.mjs";
|
|
7
|
+
import "./chunk-YVNQN2J6.mjs";
|
|
8
8
|
export {
|
|
9
9
|
TranscriptionContainer,
|
|
10
10
|
TranscriptContainer_default as default
|
|
11
11
|
};
|
|
12
|
-
//# sourceMappingURL=TranscriptContainer-
|
|
12
|
+
//# sourceMappingURL=TranscriptContainer-LOD4X5WH.mjs.map
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
|
+
import "./chunk-T77E2ZS6.mjs";
|
|
3
|
+
import {
|
|
4
|
+
renderByline
|
|
5
|
+
} from "./chunk-FXZHX3PK.mjs";
|
|
6
|
+
import "./chunk-SWUVPFKR.mjs";
|
|
7
|
+
import "./chunk-YVNQN2J6.mjs";
|
|
8
|
+
|
|
9
|
+
// src/capabilities/blueprint-definition.ts
|
|
10
|
+
import { Capabilities, contributes } from "@dxos/app-framework";
|
|
11
|
+
import { Blueprint, Template } from "@dxos/blueprints";
|
|
12
|
+
import { trim as trim2 } from "@dxos/util";
|
|
13
|
+
|
|
14
|
+
// src/functions/open.ts
|
|
15
|
+
import * as Effect from "effect/Effect";
|
|
16
|
+
import * as Schema from "effect/Schema";
|
|
17
|
+
import { ArtifactId } from "@dxos/assistant";
|
|
18
|
+
import { Obj } from "@dxos/echo";
|
|
19
|
+
import { Database } from "@dxos/echo";
|
|
20
|
+
import { QueueService, defineFunction } from "@dxos/functions";
|
|
21
|
+
import { Message, Transcript } from "@dxos/types";
|
|
22
|
+
var open_default = defineFunction({
|
|
23
|
+
key: "dxos.org/function/transcription/open",
|
|
24
|
+
name: "Open",
|
|
25
|
+
description: "Opens and reads the contents of a transcription object.",
|
|
26
|
+
inputSchema: Schema.Struct({
|
|
27
|
+
id: ArtifactId.annotations({
|
|
28
|
+
description: "The ID of the transcription object."
|
|
29
|
+
})
|
|
30
|
+
}),
|
|
31
|
+
outputSchema: Schema.Struct({
|
|
32
|
+
content: Schema.String
|
|
33
|
+
}),
|
|
34
|
+
handler: Effect.fn(function* ({ data: { id } }) {
|
|
35
|
+
const transcript = yield* Database.Service.resolve(ArtifactId.toDXN(id), Transcript.Transcript);
|
|
36
|
+
const { dxn } = yield* Effect.promise(() => transcript.queue.load());
|
|
37
|
+
const queue = yield* QueueService.getQueue(dxn);
|
|
38
|
+
yield* Effect.promise(() => queue?.queryObjects());
|
|
39
|
+
const content = queue?.objects.filter((message) => Obj.instanceOf(Message.Message, message)).flatMap((message, index) => renderByline([])(message, index)).join("\n\n");
|
|
40
|
+
return {
|
|
41
|
+
content
|
|
42
|
+
};
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// src/functions/summarize.ts
|
|
47
|
+
import * as Array from "effect/Array";
|
|
48
|
+
import * as Effect2 from "effect/Effect";
|
|
49
|
+
import * as Function from "effect/Function";
|
|
50
|
+
import * as Layer from "effect/Layer";
|
|
51
|
+
import * as Option from "effect/Option";
|
|
52
|
+
import * as Schema2 from "effect/Schema";
|
|
53
|
+
import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from "@dxos/ai";
|
|
54
|
+
import { AiSession, GenerationObserver } from "@dxos/assistant";
|
|
55
|
+
import { TracingService, defineFunction as defineFunction2 } from "@dxos/functions";
|
|
56
|
+
import { trim } from "@dxos/util";
|
|
57
|
+
var summarize_default = defineFunction2({
|
|
58
|
+
key: "dxos.org/function/transcription/summarize",
|
|
59
|
+
name: "Summarize",
|
|
60
|
+
description: "Summarize a transcript of a meeting.",
|
|
61
|
+
inputSchema: Schema2.Struct({
|
|
62
|
+
transcript: Schema2.String.annotations({
|
|
63
|
+
description: "The transcript of the meeting."
|
|
64
|
+
}),
|
|
65
|
+
notes: Schema2.optional(Schema2.String).annotations({
|
|
66
|
+
description: "Additional notes from the participants."
|
|
67
|
+
})
|
|
68
|
+
}),
|
|
69
|
+
outputSchema: Schema2.Struct({
|
|
70
|
+
summary: Schema2.String.annotations({
|
|
71
|
+
description: "The summary of the transcript."
|
|
72
|
+
})
|
|
73
|
+
}),
|
|
74
|
+
handler: Effect2.fnUntraced(function* ({ data: { transcript, notes } }) {
|
|
75
|
+
const result = yield* new AiSession().run({
|
|
76
|
+
prompt: `Transcript: ${transcript}
|
|
77
|
+
|
|
78
|
+
Notes: ${notes}`,
|
|
79
|
+
history: [],
|
|
80
|
+
system: systemPrompt,
|
|
81
|
+
observer: GenerationObserver.fromPrinter(new ConsolePrinter({
|
|
82
|
+
tag: "summarize"
|
|
83
|
+
}))
|
|
84
|
+
});
|
|
85
|
+
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")));
|
|
86
|
+
return {
|
|
87
|
+
summary
|
|
88
|
+
};
|
|
89
|
+
}, Effect2.provide(Layer.mergeAll(AiService.model("@anthropic/claude-sonnet-4-0"), ToolResolverService.layerEmpty, ToolExecutionService.layerEmpty, TracingService.layerNoop)))
|
|
90
|
+
});
|
|
91
|
+
var systemPrompt = trim`
|
|
92
|
+
You are a helpful assistant that summarizes transcripts of meetings.
|
|
93
|
+
|
|
94
|
+
# Goal
|
|
95
|
+
Create a markdown summary of the meeting transcript with text notes provided.
|
|
96
|
+
Notes are very important so make sure to include them in the summary if they contain meaningful information.
|
|
97
|
+
|
|
98
|
+
# Formatting
|
|
99
|
+
- Format the summary as a markdown document without extra comments like "Here is the summary of the transcript:".
|
|
100
|
+
- Use markdown formatting for headings and bullet points.
|
|
101
|
+
- Format the summary as a list of key points and takeaways.
|
|
102
|
+
- All names of people should be in bold.
|
|
103
|
+
|
|
104
|
+
# Note Taking
|
|
105
|
+
- Correlate items in the summary with the person of origin to build a coherent narrative.
|
|
106
|
+
- Include short quotes verbatim where appropriate. Especially when concerned with design decisions and problem descriptions.
|
|
107
|
+
|
|
108
|
+
# Tasks
|
|
109
|
+
At the end of the summary include tasks.
|
|
110
|
+
Extract only the tasks that are:
|
|
111
|
+
- Directly actionable.
|
|
112
|
+
- Clearly assigned to a person or team (or can easily be inferred).
|
|
113
|
+
- Strongly implied by the conversation and/or user note (no speculative tasks).
|
|
114
|
+
- Specific enough that someone reading them would know exactly what to do next.
|
|
115
|
+
|
|
116
|
+
Format all tasks as markdown checkboxes using the syntax:
|
|
117
|
+
- [ ] Task description.
|
|
118
|
+
|
|
119
|
+
Additional information can be included (indented).
|
|
120
|
+
|
|
121
|
+
If no actionable tasks are found, omit this tasks section.
|
|
122
|
+
`;
|
|
123
|
+
|
|
124
|
+
// src/capabilities/blueprint-definition.ts
|
|
125
|
+
var functions = [
|
|
126
|
+
open_default,
|
|
127
|
+
summarize_default
|
|
128
|
+
];
|
|
129
|
+
var blueprint_definition_default = (() => {
|
|
130
|
+
return [
|
|
131
|
+
contributes(Capabilities.Functions, functions),
|
|
132
|
+
contributes(Capabilities.BlueprintDefinition, Blueprint.make({
|
|
133
|
+
key: "dxos.org/blueprint/transcription",
|
|
134
|
+
name: "Transcription",
|
|
135
|
+
tools: Blueprint.toolDefinitions({
|
|
136
|
+
functions
|
|
137
|
+
}),
|
|
138
|
+
instructions: Template.make({
|
|
139
|
+
source: trim2`
|
|
140
|
+
You can open and summarize a meeting transcript.
|
|
141
|
+
`
|
|
142
|
+
})
|
|
143
|
+
}))
|
|
144
|
+
];
|
|
145
|
+
});
|
|
146
|
+
export {
|
|
147
|
+
blueprint_definition_default as default
|
|
148
|
+
};
|
|
149
|
+
//# sourceMappingURL=blueprint-definition-5CJWJRO4.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 { Database } from '@dxos/echo';\nimport { QueueService, defineFunction } from '@dxos/functions';\nimport { Message, Transcript } from '@dxos/types';\n\nimport { renderByline } from '../components';\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* Database.Service.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(Message.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", "Database", "QueueService", "defineFunction", "Message", "Transcript", "defineFunction", "key", "name", "description", "inputSchema", "Struct", "id", "ArtifactId", "annotations", "outputSchema", "content", "String", "handler", "fn", "data", "transcript", "Database", "Service", "resolve", "toDXN", "Transcript", "dxn", "promise", "queue", "load", "QueueService", "getQueue", "queryObjects", "objects", "filter", "message", "Obj", "instanceOf", "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,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
TRANSCRIPTION_URL
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-U4YPUD2F.mjs";
|
|
5
5
|
|
|
6
6
|
// src/transcriber/media-stream-recorder.ts
|
|
7
7
|
import { MediaRecorder, register } from "extendable-media-recorder";
|
|
@@ -23,9 +23,15 @@ var initializeExtendableMediaRecorder = async () => {
|
|
|
23
23
|
await register(await connect());
|
|
24
24
|
};
|
|
25
25
|
var MediaStreamRecorder = class {
|
|
26
|
+
_mediaStreamTrack;
|
|
27
|
+
/**
|
|
28
|
+
* Default MediaRecorder implementation do not support wav encoding.
|
|
29
|
+
*/
|
|
30
|
+
_config;
|
|
31
|
+
_mediaRecorder = void 0;
|
|
32
|
+
_header = void 0;
|
|
33
|
+
_onChunk;
|
|
26
34
|
constructor({ mediaStreamTrack, config }) {
|
|
27
|
-
this._mediaRecorder = void 0;
|
|
28
|
-
this._header = void 0;
|
|
29
35
|
this._mediaStreamTrack = mediaStreamTrack;
|
|
30
36
|
this._config = config;
|
|
31
37
|
}
|
|
@@ -146,15 +152,18 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
146
152
|
}
|
|
147
153
|
var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/transcriber.ts";
|
|
148
154
|
var Transcriber = class extends Resource {
|
|
155
|
+
_audioChunks = [];
|
|
156
|
+
_lastUsedTimestamp = 0;
|
|
157
|
+
_openTrigger = new Trigger({
|
|
158
|
+
autoReset: true
|
|
159
|
+
});
|
|
160
|
+
_config;
|
|
161
|
+
_recorder;
|
|
162
|
+
_onSegments;
|
|
163
|
+
_recording = false;
|
|
164
|
+
_transcribeTask = void 0;
|
|
149
165
|
constructor({ config, recorder, onSegments }) {
|
|
150
166
|
super();
|
|
151
|
-
this._audioChunks = [];
|
|
152
|
-
this._lastUsedTimestamp = 0;
|
|
153
|
-
this._openTrigger = new Trigger({
|
|
154
|
-
autoReset: true
|
|
155
|
-
});
|
|
156
|
-
this._recording = false;
|
|
157
|
-
this._transcribeTask = void 0;
|
|
158
167
|
this._config = config;
|
|
159
168
|
this._recorder = recorder;
|
|
160
169
|
this._onSegments = onSegments;
|
|
@@ -162,7 +171,7 @@ var Transcriber = class extends Resource {
|
|
|
162
171
|
async _open(ctx) {
|
|
163
172
|
log2.info("opening", void 0, {
|
|
164
173
|
F: __dxlog_file2,
|
|
165
|
-
L:
|
|
174
|
+
L: 102,
|
|
166
175
|
S: this,
|
|
167
176
|
C: (f, a) => f(...a)
|
|
168
177
|
});
|
|
@@ -174,7 +183,7 @@ var Transcriber = class extends Resource {
|
|
|
174
183
|
async _close() {
|
|
175
184
|
log2.info("closing", void 0, {
|
|
176
185
|
F: __dxlog_file2,
|
|
177
|
-
L:
|
|
186
|
+
L: 110,
|
|
178
187
|
S: this,
|
|
179
188
|
C: (f, a) => f(...a)
|
|
180
189
|
});
|
|
@@ -185,7 +194,7 @@ var Transcriber = class extends Resource {
|
|
|
185
194
|
startChunksRecording() {
|
|
186
195
|
log2.info("starting", void 0, {
|
|
187
196
|
F: __dxlog_file2,
|
|
188
|
-
L:
|
|
197
|
+
L: 117,
|
|
189
198
|
S: this,
|
|
190
199
|
C: (f, a) => f(...a)
|
|
191
200
|
});
|
|
@@ -202,7 +211,7 @@ var Transcriber = class extends Resource {
|
|
|
202
211
|
this._transcribeTask?.schedule();
|
|
203
212
|
log2.info("stopped", void 0, {
|
|
204
213
|
F: __dxlog_file2,
|
|
205
|
-
L:
|
|
214
|
+
L: 132,
|
|
206
215
|
S: this,
|
|
207
216
|
C: (f, a) => f(...a)
|
|
208
217
|
});
|
|
@@ -212,7 +221,7 @@ var Transcriber = class extends Resource {
|
|
|
212
221
|
chunk
|
|
213
222
|
}, {
|
|
214
223
|
F: __dxlog_file2,
|
|
215
|
-
L:
|
|
224
|
+
L: 136,
|
|
216
225
|
S: this,
|
|
217
226
|
C: (f, a) => f(...a)
|
|
218
227
|
});
|
|
@@ -228,7 +237,7 @@ var Transcriber = class extends Resource {
|
|
|
228
237
|
chunks: this._audioChunks.length
|
|
229
238
|
}, {
|
|
230
239
|
F: __dxlog_file2,
|
|
231
|
-
L:
|
|
240
|
+
L: 152,
|
|
232
241
|
S: this,
|
|
233
242
|
C: (f, a) => f(...a)
|
|
234
243
|
});
|
|
@@ -280,7 +289,7 @@ var Transcriber = class extends Resource {
|
|
|
280
289
|
string: segments.map((segments2) => segments2.text).join(" ")
|
|
281
290
|
}, {
|
|
282
291
|
F: __dxlog_file2,
|
|
283
|
-
L:
|
|
292
|
+
L: 216,
|
|
284
293
|
S: this,
|
|
285
294
|
C: (f, a) => f(...a)
|
|
286
295
|
});
|
|
@@ -324,7 +333,7 @@ import { signal } from "@preact/signals-core";
|
|
|
324
333
|
import { synchronized as synchronized2 } from "@dxos/async";
|
|
325
334
|
import { Resource as Resource2 } from "@dxos/context";
|
|
326
335
|
import { Obj } from "@dxos/echo";
|
|
327
|
-
import {
|
|
336
|
+
import { Message } from "@dxos/types";
|
|
328
337
|
function _ts_decorate3(decorators, target, key, desc) {
|
|
329
338
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
330
339
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -335,14 +344,16 @@ var RECORD_INTERVAL = 200;
|
|
|
335
344
|
var PREFIXED_CHUNKS_AMOUNT = 10;
|
|
336
345
|
var TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
|
|
337
346
|
var TranscriptionManager = class extends Resource2 {
|
|
347
|
+
_edgeClient;
|
|
348
|
+
_messageEnricher;
|
|
349
|
+
_audioStreamTrack = void 0;
|
|
350
|
+
_identityDid = void 0;
|
|
351
|
+
_mediaRecorder = void 0;
|
|
352
|
+
_transcriber = void 0;
|
|
353
|
+
_queue = void 0;
|
|
354
|
+
_enabled = signal(false);
|
|
338
355
|
constructor(options) {
|
|
339
356
|
super();
|
|
340
|
-
this._audioStreamTrack = void 0;
|
|
341
|
-
this._identityDid = void 0;
|
|
342
|
-
this._mediaRecorder = void 0;
|
|
343
|
-
this._transcriber = void 0;
|
|
344
|
-
this._queue = void 0;
|
|
345
|
-
this._enabled = signal(false);
|
|
346
357
|
this._edgeClient = options.edgeClient;
|
|
347
358
|
this._messageEnricher = options.messageEnricher;
|
|
348
359
|
}
|
|
@@ -371,73 +382,32 @@ var TranscriptionManager = class extends Resource2 {
|
|
|
371
382
|
}
|
|
372
383
|
return this;
|
|
373
384
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Enable or disable transcription.
|
|
376
|
-
* @param enabled - Whether to enable transcription.
|
|
377
|
-
*/
|
|
378
385
|
async setEnabled(enabled) {
|
|
379
386
|
if (this._enabled.value === enabled) {
|
|
380
387
|
return;
|
|
381
388
|
}
|
|
382
389
|
this._enabled.value = enabled ?? false;
|
|
383
|
-
|
|
390
|
+
if (enabled) {
|
|
391
|
+
await this._maybeRestartTranscriber();
|
|
392
|
+
} else {
|
|
393
|
+
await this._stopTranscriber();
|
|
394
|
+
}
|
|
384
395
|
}
|
|
385
396
|
async setAudioTrack(track) {
|
|
386
397
|
if (this._audioStreamTrack === track) {
|
|
387
398
|
return;
|
|
388
399
|
}
|
|
389
400
|
this._audioStreamTrack = track;
|
|
390
|
-
|
|
401
|
+
await this._maybeRestartTranscriber();
|
|
391
402
|
}
|
|
392
403
|
async _open() {
|
|
393
|
-
await this.
|
|
404
|
+
await this._maybeRestartTranscriber();
|
|
394
405
|
}
|
|
395
406
|
async _close() {
|
|
396
|
-
|
|
397
|
-
}
|
|
398
|
-
// TODO(burdon): Change this to setEnables (explicit), not toggle.
|
|
399
|
-
async _toggleTranscriber() {
|
|
400
|
-
await this._maybeReinitTranscriber();
|
|
401
|
-
if (this._enabled.value) {
|
|
402
|
-
await this._transcriber?.open();
|
|
403
|
-
const block = Obj.make(DataType.Message, {
|
|
404
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
405
|
-
blocks: [
|
|
406
|
-
{
|
|
407
|
-
_tag: "transcript",
|
|
408
|
-
text: "Started",
|
|
409
|
-
started: (/* @__PURE__ */ new Date()).toISOString()
|
|
410
|
-
}
|
|
411
|
-
],
|
|
412
|
-
sender: {
|
|
413
|
-
role: "assistant"
|
|
414
|
-
}
|
|
415
|
-
});
|
|
416
|
-
await this._queue?.append([
|
|
417
|
-
block
|
|
418
|
-
]);
|
|
419
|
-
} else {
|
|
420
|
-
await this._transcriber?.close();
|
|
421
|
-
const block = Obj.make(DataType.Message, {
|
|
422
|
-
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
423
|
-
blocks: [
|
|
424
|
-
{
|
|
425
|
-
_tag: "transcript",
|
|
426
|
-
text: "Stopped",
|
|
427
|
-
started: (/* @__PURE__ */ new Date()).toISOString()
|
|
428
|
-
}
|
|
429
|
-
],
|
|
430
|
-
sender: {
|
|
431
|
-
role: "assistant"
|
|
432
|
-
}
|
|
433
|
-
});
|
|
434
|
-
await this._queue?.append([
|
|
435
|
-
block
|
|
436
|
-
]);
|
|
437
|
-
}
|
|
407
|
+
await this._stopTranscriber();
|
|
438
408
|
}
|
|
439
|
-
async
|
|
440
|
-
if (!this._audioStreamTrack || !this._enabled.value) {
|
|
409
|
+
async _maybeRestartTranscriber() {
|
|
410
|
+
if (!this._audioStreamTrack || !this._enabled.value || !this.isOpen) {
|
|
441
411
|
return;
|
|
442
412
|
}
|
|
443
413
|
let needReinit = false;
|
|
@@ -460,13 +430,17 @@ var TranscriptionManager = class extends Resource2 {
|
|
|
460
430
|
recorder: this._mediaRecorder,
|
|
461
431
|
onSegments: (segments) => this._onSegments(segments)
|
|
462
432
|
});
|
|
433
|
+
await this._transcriber?.open();
|
|
463
434
|
}
|
|
464
435
|
}
|
|
436
|
+
async _stopTranscriber() {
|
|
437
|
+
await this._transcriber?.close();
|
|
438
|
+
}
|
|
465
439
|
async _onSegments(segments) {
|
|
466
440
|
if (!this.isOpen || !this._queue) {
|
|
467
441
|
return;
|
|
468
442
|
}
|
|
469
|
-
let block = Obj.make(
|
|
443
|
+
let block = Obj.make(Message.Message, {
|
|
470
444
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
471
445
|
blocks: segments,
|
|
472
446
|
sender: {
|
|
@@ -481,9 +455,6 @@ var TranscriptionManager = class extends Resource2 {
|
|
|
481
455
|
]);
|
|
482
456
|
}
|
|
483
457
|
};
|
|
484
|
-
_ts_decorate3([
|
|
485
|
-
synchronized2
|
|
486
|
-
], TranscriptionManager.prototype, "setEnabled", null);
|
|
487
458
|
_ts_decorate3([
|
|
488
459
|
synchronized2
|
|
489
460
|
], TranscriptionManager.prototype, "setAudioTrack", null);
|
|
@@ -493,4 +464,4 @@ export {
|
|
|
493
464
|
Transcriber,
|
|
494
465
|
TranscriptionManager
|
|
495
466
|
};
|
|
496
|
-
//# sourceMappingURL=chunk-
|
|
467
|
+
//# sourceMappingURL=chunk-5JN2MHYA.mjs.map
|