@dxos/plugin-transcription 0.8.4-main.ae835ea → 0.8.4-main.bc674ce
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-6EHKWVS4.mjs +12 -0
- package/dist/lib/browser/blueprint-definition-FTRNMLJZ.mjs +18 -0
- package/dist/lib/browser/blueprint-definition-FTRNMLJZ.mjs.map +7 -0
- package/dist/lib/browser/blueprints/index.mjs +9 -0
- package/dist/lib/browser/chunk-HOOPZ7EM.mjs +35 -0
- package/dist/lib/browser/chunk-HOOPZ7EM.mjs.map +7 -0
- package/dist/lib/browser/{chunk-7DR6HZEF.mjs → chunk-ICM7JRCO.mjs} +64 -98
- package/dist/lib/browser/chunk-ICM7JRCO.mjs.map +7 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
- package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
- package/dist/lib/browser/chunk-Q5OC3WVG.mjs +72 -0
- package/dist/lib/browser/chunk-Q5OC3WVG.mjs.map +7 -0
- package/dist/lib/browser/{chunk-535OJKFO.mjs → chunk-SYGEFDWO.mjs} +2 -2
- package/dist/lib/browser/{chunk-WH36ENNE.mjs → chunk-TKFU53OZ.mjs} +19 -25
- package/dist/lib/browser/chunk-TKFU53OZ.mjs.map +7 -0
- package/dist/lib/browser/{blueprint-definition-UAAJYVLZ.mjs → chunk-ZZF7ICVM.mjs} +31 -31
- package/dist/lib/browser/chunk-ZZF7ICVM.mjs.map +7 -0
- package/dist/lib/browser/index.mjs +59 -72
- package/dist/lib/browser/index.mjs.map +4 -4
- package/dist/lib/browser/meta.json +1 -1
- package/dist/lib/browser/operation-resolver-ZUWTU7C5.mjs +22 -0
- package/dist/lib/browser/operation-resolver-ZUWTU7C5.mjs.map +7 -0
- package/dist/lib/browser/react-surface-ZXH5267I.mjs +34 -0
- package/dist/lib/browser/react-surface-ZXH5267I.mjs.map +7 -0
- package/dist/lib/browser/{transcriber-LWOLYQHC.mjs → transcriber-EZZTUCPE.mjs} +17 -13
- package/dist/lib/browser/transcriber-EZZTUCPE.mjs.map +7 -0
- package/dist/lib/browser/types/index.mjs +7 -5
- package/dist/lib/node-esm/{TranscriptContainer-GRLDCESB.mjs → TranscriptContainer-5YT5W73I.mjs} +5 -4
- package/dist/lib/node-esm/TranscriptContainer-5YT5W73I.mjs.map +7 -0
- package/dist/lib/node-esm/blueprint-definition-IOX35YUX.mjs +19 -0
- package/dist/lib/node-esm/blueprint-definition-IOX35YUX.mjs.map +7 -0
- package/dist/lib/node-esm/blueprints/index.mjs +10 -0
- package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-4BFY6P2D.mjs +73 -0
- package/dist/lib/node-esm/chunk-4BFY6P2D.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-K4AZOB5Y.mjs → chunk-BX2AB7S7.mjs} +64 -98
- package/dist/lib/node-esm/chunk-BX2AB7S7.mjs.map +7 -0
- package/dist/lib/node-esm/{blueprint-definition-Z3LTZ3ID.mjs → chunk-CWP22IHV.mjs} +31 -31
- package/dist/lib/node-esm/chunk-CWP22IHV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-YFN4FJFK.mjs → chunk-EPC27WWV.mjs} +19 -25
- package/dist/lib/node-esm/chunk-EPC27WWV.mjs.map +7 -0
- package/dist/lib/node-esm/{chunk-Q6WD7L2J.mjs → chunk-GVAVEVZ6.mjs} +2 -2
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
- package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
- package/dist/lib/node-esm/chunk-NVM2QUMX.mjs +37 -0
- package/dist/lib/node-esm/chunk-NVM2QUMX.mjs.map +7 -0
- package/dist/lib/node-esm/index.mjs +59 -72
- package/dist/lib/node-esm/index.mjs.map +4 -4
- package/dist/lib/node-esm/meta.json +1 -1
- package/dist/lib/node-esm/operation-resolver-Z72B4H2Q.mjs +23 -0
- package/dist/lib/node-esm/operation-resolver-Z72B4H2Q.mjs.map +7 -0
- package/dist/lib/node-esm/react-surface-6GUBZX2V.mjs +35 -0
- package/dist/lib/node-esm/react-surface-6GUBZX2V.mjs.map +7 -0
- package/dist/lib/node-esm/{transcriber-UGB7ECX6.mjs → transcriber-RGW3YYT4.mjs} +17 -13
- package/dist/lib/node-esm/transcriber-RGW3YYT4.mjs.map +7 -0
- package/dist/lib/node-esm/types/index.mjs +7 -5
- package/dist/types/src/TranscriptionPlugin.d.ts +2 -1
- package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
- package/dist/types/src/blueprints/index.d.ts +2 -0
- package/dist/types/src/blueprints/index.d.ts.map +1 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts +21 -0
- package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +9 -0
- package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
- package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/index.d.ts +4 -5
- package/dist/types/src/capabilities/index.d.ts.map +1 -1
- package/dist/types/src/capabilities/operation-handler/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +5 -0
- package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
- package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
- package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
- package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
- package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
- package/dist/types/src/capabilities/transcriber/index.d.ts +3 -0
- package/dist/types/src/capabilities/transcriber/index.d.ts.map +1 -0
- package/dist/types/src/capabilities/transcriber/transcriber.d.ts +9 -0
- package/dist/types/src/capabilities/transcriber/transcriber.d.ts.map +1 -0
- package/dist/types/src/components/Transcript/Transcript.d.ts +5 -8
- package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts +4 -3
- package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +9 -9
- package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -1
- package/dist/types/src/components/Transcript/transcript-extension.d.ts +2 -2
- package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -1
- package/dist/types/src/components/TranscriptContainer.d.ts +4 -6
- package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
- package/dist/types/src/components/index.d.ts +1 -1
- package/dist/types/src/components/index.d.ts.map +1 -1
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts +3 -3
- package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +3 -3
- package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
- package/dist/types/src/components/stories/TranscriptionStory.d.ts +2 -2
- package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
- package/dist/types/src/functions/open.d.ts +1 -1
- package/dist/types/src/functions/summarize.d.ts +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
- package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
- package/dist/types/src/hooks/useTranscriber.d.ts +1 -1
- package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
- package/dist/types/src/index.d.ts +1 -1
- package/dist/types/src/index.d.ts.map +1 -1
- package/dist/types/src/meta.d.ts +2 -2
- package/dist/types/src/meta.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/message-normalizer.d.ts +5 -5
- package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
- package/dist/types/src/segments-normalization/normalization.d.ts +502 -457
- 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 +9 -9
- package/dist/types/src/testing/testing.d.ts.map +1 -1
- package/dist/types/src/transcriber/media-stream-recorder.d.ts +2 -2
- package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcriber.d.ts +4 -4
- package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
- package/dist/types/src/transcriber/transcription-manager.d.ts +9 -6
- package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
- package/dist/types/src/types/TranscriptAction.d.ts +22 -20
- package/dist/types/src/types/TranscriptAction.d.ts.map +1 -1
- package/dist/types/src/types/capabilities.d.ts +18 -0
- package/dist/types/src/types/capabilities.d.ts.map +1 -0
- package/dist/types/src/types/index.d.ts +2 -1
- package/dist/types/src/types/index.d.ts.map +1 -1
- package/dist/types/src/util/index.d.ts +1 -0
- package/dist/types/src/util/index.d.ts.map +1 -1
- package/dist/types/src/util/render-byline.d.ts +4 -0
- package/dist/types/src/util/render-byline.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +83 -69
- package/src/TranscriptionPlugin.tsx +34 -58
- package/src/blueprints/index.ts +5 -0
- package/src/blueprints/transcription-blueprint.ts +25 -0
- package/src/capabilities/blueprint-definition/blueprint-definition.ts +23 -0
- package/src/capabilities/blueprint-definition/index.ts +7 -0
- package/src/capabilities/index.ts +4 -8
- package/src/capabilities/operation-handler/index.ts +7 -0
- package/src/capabilities/operation-handler/operation-handler.ts +25 -0
- package/src/capabilities/operation-resolver/index.ts +7 -0
- package/src/capabilities/operation-resolver/operation-resolver.ts +25 -0
- package/src/capabilities/react-surface/index.ts +7 -0
- package/src/capabilities/react-surface/react-surface.tsx +27 -0
- package/src/capabilities/transcriber/index.ts +7 -0
- package/src/capabilities/transcriber/transcriber.ts +85 -0
- package/src/components/Transcript/Transcript.stories.tsx +38 -37
- package/src/components/Transcript/Transcript.tsx +11 -38
- package/src/components/Transcript/deprecated/OldTranscript.tsx +2 -2
- package/src/components/Transcript/transcript-extension.ts +10 -6
- package/src/components/TranscriptContainer.tsx +15 -17
- package/src/components/stories/FileTranscription.stories.tsx +27 -31
- package/src/components/stories/KeyWordRecognition.stories.tsx +4 -4
- package/src/components/stories/MicrophoneTranscription.stories.tsx +47 -50
- package/src/components/stories/TranscriptionStory.tsx +7 -11
- package/src/functions/open.ts +6 -6
- package/src/hooks/useQueueModelAdapter.ts +1 -1
- package/src/hooks/useTranscriber.ts +8 -3
- package/src/hooks/useVoiceInput.ts +2 -2
- package/src/index.ts +1 -1
- package/src/meta.ts +2 -2
- package/src/model/model.test.ts +20 -14
- package/src/segments-normalization/message-normalizer.ts +18 -13
- package/src/segments-normalization/normalization.test.ts +5 -10
- package/src/segments-normalization/normalization.ts +6 -6
- package/src/segments-normalization/utils.ts +2 -2
- package/src/testing/testing.ts +28 -18
- package/src/transcriber/media-stream-recorder.ts +3 -3
- package/src/transcriber/transcriber.browser.test.ts +4 -4
- package/src/transcriber/transcriber.ts +6 -6
- package/src/transcriber/transcription-manager.ts +21 -15
- package/src/types/TranscriptAction.ts +21 -13
- package/src/{capabilities → types}/capabilities.ts +8 -8
- package/src/types/index.ts +2 -1
- package/src/util/index.ts +1 -0
- package/src/util/render-byline.ts +33 -0
- package/dist/lib/browser/TranscriptContainer-2GSL2XB5.mjs +0 -11
- package/dist/lib/browser/blueprint-definition-UAAJYVLZ.mjs.map +0 -7
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs +0 -16
- package/dist/lib/browser/chunk-3MKZ2MNQ.mjs.map +0 -7
- package/dist/lib/browser/chunk-7DR6HZEF.mjs.map +0 -7
- package/dist/lib/browser/chunk-VBUIO677.mjs +0 -29
- package/dist/lib/browser/chunk-VBUIO677.mjs.map +0 -7
- package/dist/lib/browser/chunk-W7WKZTM4.mjs +0 -63
- package/dist/lib/browser/chunk-W7WKZTM4.mjs.map +0 -7
- package/dist/lib/browser/chunk-WH36ENNE.mjs.map +0 -7
- package/dist/lib/browser/intent-resolver-ZTKTEAQX.mjs +0 -25
- package/dist/lib/browser/intent-resolver-ZTKTEAQX.mjs.map +0 -7
- package/dist/lib/browser/react-surface-KA32A72I.mjs +0 -34
- package/dist/lib/browser/react-surface-KA32A72I.mjs.map +0 -7
- package/dist/lib/browser/transcriber-LWOLYQHC.mjs.map +0 -7
- package/dist/lib/node-esm/blueprint-definition-Z3LTZ3ID.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-K4AZOB5Y.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-OLMSTF3M.mjs +0 -64
- package/dist/lib/node-esm/chunk-OLMSTF3M.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs +0 -17
- package/dist/lib/node-esm/chunk-SWUVPFKR.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YFN4FJFK.mjs.map +0 -7
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs +0 -30
- package/dist/lib/node-esm/chunk-YVNQN2J6.mjs.map +0 -7
- package/dist/lib/node-esm/intent-resolver-55WH2GY6.mjs +0 -26
- package/dist/lib/node-esm/intent-resolver-55WH2GY6.mjs.map +0 -7
- package/dist/lib/node-esm/react-surface-GU7LW2JO.mjs +0 -35
- package/dist/lib/node-esm/react-surface-GU7LW2JO.mjs.map +0 -7
- package/dist/lib/node-esm/transcriber-UGB7ECX6.mjs.map +0 -7
- package/dist/types/src/capabilities/blueprint-definition.d.ts +0 -5
- package/dist/types/src/capabilities/blueprint-definition.d.ts.map +0 -1
- package/dist/types/src/capabilities/capabilities.d.ts +0 -17
- package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
- package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
- package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
- package/dist/types/src/capabilities/react-surface.d.ts +0 -4
- package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
- package/dist/types/src/capabilities/transcriber.d.ts +0 -8
- package/dist/types/src/capabilities/transcriber.d.ts.map +0 -1
- package/dist/types/src/types/Transcript.d.ts +0 -30
- package/dist/types/src/types/Transcript.d.ts.map +0 -1
- package/src/capabilities/blueprint-definition.ts +0 -31
- package/src/capabilities/intent-resolver.ts +0 -18
- package/src/capabilities/react-surface.tsx +0 -22
- package/src/capabilities/transcriber.ts +0 -77
- package/src/types/Transcript.ts +0 -44
- /package/dist/lib/browser/{TranscriptContainer-2GSL2XB5.mjs.map → TranscriptContainer-6EHKWVS4.mjs.map} +0 -0
- /package/dist/lib/{node-esm/TranscriptContainer-GRLDCESB.mjs.map → browser/blueprints/index.mjs.map} +0 -0
- /package/dist/lib/browser/{chunk-535OJKFO.mjs.map → chunk-SYGEFDWO.mjs.map} +0 -0
- /package/dist/lib/node-esm/{chunk-Q6WD7L2J.mjs.map → chunk-GVAVEVZ6.mjs.map} +0 -0
package/src/testing/testing.ts
CHANGED
|
@@ -11,13 +11,14 @@ import { Filter, type Queue } from '@dxos/client/echo';
|
|
|
11
11
|
import { Context } from '@dxos/context';
|
|
12
12
|
import { type Key, Obj, Ref, Type } from '@dxos/echo';
|
|
13
13
|
import { createQueueDXN } from '@dxos/echo/internal';
|
|
14
|
-
import { FunctionExecutor, ServiceContainer } from '@dxos/functions';
|
|
14
|
+
import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
|
|
15
15
|
import { IdentityDid } from '@dxos/keys';
|
|
16
16
|
import { log } from '@dxos/log';
|
|
17
17
|
import { faker } from '@dxos/random';
|
|
18
18
|
import { type Space, useQueue } from '@dxos/react-client/echo';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
19
|
+
import { TestSchema } from '@dxos/schema/testing';
|
|
20
|
+
import { type ContentBlock, Message, Organization, Person } from '@dxos/types';
|
|
21
|
+
import { seedTestData } from '@dxos/types/testing';
|
|
21
22
|
|
|
22
23
|
// TODO(burdon): Reconcile with plugin-markdown. Move to @dxos/schema/testing.
|
|
23
24
|
export const TestItem = Schema.Struct({
|
|
@@ -30,7 +31,7 @@ export const TestItem = Schema.Struct({
|
|
|
30
31
|
description: 'Product description',
|
|
31
32
|
}),
|
|
32
33
|
}).pipe(
|
|
33
|
-
Type.
|
|
34
|
+
Type.object({
|
|
34
35
|
typename: 'dxos.org/type/Test',
|
|
35
36
|
version: '0.1.0',
|
|
36
37
|
}),
|
|
@@ -38,7 +39,7 @@ export const TestItem = Schema.Struct({
|
|
|
38
39
|
|
|
39
40
|
// TODO(wittjosiah): Make builder generic and reuse for all message types.
|
|
40
41
|
abstract class AbstractMessageBuilder {
|
|
41
|
-
abstract createMessage(numSegments?: number): Promise<
|
|
42
|
+
abstract createMessage(numSegments?: number): Promise<Message.Message>;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
/**
|
|
@@ -59,19 +60,24 @@ export class MessageBuilder extends AbstractMessageBuilder {
|
|
|
59
60
|
super();
|
|
60
61
|
}
|
|
61
62
|
|
|
62
|
-
override async createMessage(numSegments = 1): Promise<
|
|
63
|
-
return Obj.make(
|
|
63
|
+
override async createMessage(numSegments = 1): Promise<Message.Message> {
|
|
64
|
+
return Obj.make(Message.Message, {
|
|
64
65
|
created: this.next().toISOString(),
|
|
65
66
|
sender: faker.helpers.arrayElement(this.users),
|
|
66
67
|
blocks: Array.from({ length: numSegments }).map(() => this.createBlock()),
|
|
67
68
|
});
|
|
68
69
|
}
|
|
69
70
|
|
|
70
|
-
createBlock():
|
|
71
|
+
createBlock(): ContentBlock.Transcript {
|
|
71
72
|
let text = faker.lorem.paragraph();
|
|
72
73
|
if (this._space) {
|
|
73
74
|
const label = faker.commerce.productName();
|
|
74
|
-
const obj = this._space.db.add(
|
|
75
|
+
const obj = this._space.db.add(
|
|
76
|
+
Obj.make(TestItem, {
|
|
77
|
+
title: label,
|
|
78
|
+
description: faker.lorem.paragraph(),
|
|
79
|
+
}),
|
|
80
|
+
);
|
|
75
81
|
const dxn = Ref.make(obj).dxn.toString();
|
|
76
82
|
const words = text.split(' ');
|
|
77
83
|
words.splice(Math.floor(Math.random() * words.length), 0, `[${label}](${dxn})`);
|
|
@@ -103,7 +109,7 @@ class EntityExtractionMessageBuilder extends AbstractMessageBuilder {
|
|
|
103
109
|
|
|
104
110
|
space: Space | undefined;
|
|
105
111
|
currentMessage: number = 0;
|
|
106
|
-
transcriptMessages:
|
|
112
|
+
transcriptMessages: Message.Message[] = [];
|
|
107
113
|
|
|
108
114
|
async connect(space: Space): Promise<void> {
|
|
109
115
|
this.space = space;
|
|
@@ -111,14 +117,18 @@ class EntityExtractionMessageBuilder extends AbstractMessageBuilder {
|
|
|
111
117
|
this.transcriptMessages = transcriptMessages;
|
|
112
118
|
}
|
|
113
119
|
|
|
114
|
-
override async createMessage(): Promise<
|
|
120
|
+
override async createMessage(): Promise<Message.Message> {
|
|
115
121
|
if (!this.space) {
|
|
116
122
|
throw new Error('Space not connected');
|
|
117
123
|
}
|
|
118
124
|
|
|
119
|
-
const
|
|
125
|
+
const objects = await this.space.db
|
|
120
126
|
.query(
|
|
121
|
-
Filter.or(
|
|
127
|
+
Filter.or(
|
|
128
|
+
Filter.type(Person.Person),
|
|
129
|
+
Filter.type(Organization.Organization),
|
|
130
|
+
Filter.type(TestSchema.DocumentType),
|
|
131
|
+
),
|
|
122
132
|
)
|
|
123
133
|
.run();
|
|
124
134
|
|
|
@@ -142,7 +152,7 @@ type UseTestTranscriptionQueue = (
|
|
|
142
152
|
queueId?: Key.ObjectId,
|
|
143
153
|
running?: boolean,
|
|
144
154
|
interval?: number,
|
|
145
|
-
) => Queue<
|
|
155
|
+
) => Queue<Message.Message> | undefined;
|
|
146
156
|
|
|
147
157
|
/**
|
|
148
158
|
* Test transcriptionqueue.
|
|
@@ -155,7 +165,7 @@ export const useTestTranscriptionQueue: UseTestTranscriptionQueue = (
|
|
|
155
165
|
) => {
|
|
156
166
|
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
157
167
|
const queueDxn = useMemo(() => (space ? createQueueDXN(space.id, queueId) : undefined), [space, queueId]);
|
|
158
|
-
const queue = useQueue<
|
|
168
|
+
const queue = useQueue<Message.Message>(queueDxn);
|
|
159
169
|
const builder = useMemo(() => new MessageBuilder(space), [space]);
|
|
160
170
|
|
|
161
171
|
useEffect(() => {
|
|
@@ -165,7 +175,7 @@ export const useTestTranscriptionQueue: UseTestTranscriptionQueue = (
|
|
|
165
175
|
|
|
166
176
|
const i = setInterval(() => {
|
|
167
177
|
void builder.createMessage(Math.ceil(Math.random() * 3)).then(async (message) => {
|
|
168
|
-
await queue.append([Obj.make(
|
|
178
|
+
await queue.append([Obj.make(Message.Message, message)]);
|
|
169
179
|
});
|
|
170
180
|
}, interval);
|
|
171
181
|
return () => clearInterval(i);
|
|
@@ -186,7 +196,7 @@ export const useTestTranscriptionQueueWithEntityExtraction: UseTestTranscription
|
|
|
186
196
|
) => {
|
|
187
197
|
// TODO(dmaretskyi): Use space.queues.create() instead.
|
|
188
198
|
const queueDxn = useMemo(() => (space ? createQueueDXN(space.id, queueId) : undefined), [space, queueId]);
|
|
189
|
-
const queue = useQueue<
|
|
199
|
+
const queue = useQueue<Message.Message>(queueDxn);
|
|
190
200
|
const [builder] = useState(() => new EntityExtractionMessageBuilder());
|
|
191
201
|
|
|
192
202
|
useEffect(() => {
|
|
@@ -203,7 +213,7 @@ export const useTestTranscriptionQueueWithEntityExtraction: UseTestTranscription
|
|
|
203
213
|
ctx,
|
|
204
214
|
async () => {
|
|
205
215
|
const message = await builder.createMessage();
|
|
206
|
-
void queue.append([Obj.make(
|
|
216
|
+
void queue.append([Obj.make(Message.Message, message)]);
|
|
207
217
|
},
|
|
208
218
|
interval,
|
|
209
219
|
);
|
|
@@ -19,7 +19,7 @@ const initializeExtendableMediaRecorder = async () => {
|
|
|
19
19
|
await register(await connect());
|
|
20
20
|
};
|
|
21
21
|
|
|
22
|
-
export type
|
|
22
|
+
export type MediaStreamRecorderProps = {
|
|
23
23
|
mediaStreamTrack: MediaStreamTrack;
|
|
24
24
|
config: {
|
|
25
25
|
interval: number;
|
|
@@ -37,12 +37,12 @@ export class MediaStreamRecorder implements AudioRecorder {
|
|
|
37
37
|
/**
|
|
38
38
|
* Default MediaRecorder implementation do not support wav encoding.
|
|
39
39
|
*/
|
|
40
|
-
private readonly _config:
|
|
40
|
+
private readonly _config: MediaStreamRecorderProps['config'];
|
|
41
41
|
private _mediaRecorder?: IMediaRecorder = undefined;
|
|
42
42
|
private _header?: Uint8Array = undefined;
|
|
43
43
|
private _onChunk?: (chunk: AudioChunk) => void;
|
|
44
44
|
|
|
45
|
-
constructor({ mediaStreamTrack, config }:
|
|
45
|
+
constructor({ mediaStreamTrack, config }: MediaStreamRecorderProps) {
|
|
46
46
|
this._mediaStreamTrack = mediaStreamTrack;
|
|
47
47
|
this._config = config;
|
|
48
48
|
}
|
|
@@ -10,9 +10,9 @@ import { WaveFile } from 'wavefile';
|
|
|
10
10
|
|
|
11
11
|
import { Trigger } from '@dxos/async';
|
|
12
12
|
import { log } from '@dxos/log';
|
|
13
|
-
import { type DataType } from '@dxos/schema';
|
|
14
13
|
import { openAndClose } from '@dxos/test-utils';
|
|
15
14
|
import { TRACE_PROCESSOR, trace } from '@dxos/tracing';
|
|
15
|
+
import { type ContentBlock } from '@dxos/types';
|
|
16
16
|
|
|
17
17
|
import { type AudioChunk, type AudioRecorder, Transcriber } from '../transcriber';
|
|
18
18
|
import { mergeFloat64Arrays } from '../util';
|
|
@@ -94,7 +94,7 @@ describe.skip('Transcriber', () => {
|
|
|
94
94
|
});
|
|
95
95
|
|
|
96
96
|
test.skip('transcription of audio recording', { timeout: 10_000 }, async () => {
|
|
97
|
-
const trigger = new Trigger<
|
|
97
|
+
const trigger = new Trigger<ContentBlock.Transcript[]>({ autoReset: true });
|
|
98
98
|
const recorder = new MockAudioRecorder({
|
|
99
99
|
buffer: await readFile('test.wav'),
|
|
100
100
|
chunkDuration: 3_000,
|
|
@@ -128,7 +128,7 @@ describe.skip('Transcriber', () => {
|
|
|
128
128
|
});
|
|
129
129
|
|
|
130
130
|
test.skip('transcription of audio recording with overlapping chunks', { timeout: 20_000 }, async () => {
|
|
131
|
-
const trigger = new Trigger<
|
|
131
|
+
const trigger = new Trigger<ContentBlock.Transcript[]>({ autoReset: true });
|
|
132
132
|
const recorder = new MockAudioRecorder({
|
|
133
133
|
buffer: await readFile('test.wav'),
|
|
134
134
|
chunkDuration: 3_000,
|
|
@@ -213,7 +213,7 @@ class MockAudioRecorder implements AudioRecorder {
|
|
|
213
213
|
|
|
214
214
|
@trace.span()
|
|
215
215
|
async start(): Promise<void> {
|
|
216
|
-
log.info('start mock audio recorder', {
|
|
216
|
+
log.info('start mock audio recorder', { wavProps: this.wav.fmt });
|
|
217
217
|
const now = Date.now();
|
|
218
218
|
const samples = this.wav.getSamples();
|
|
219
219
|
const sampleRate = this.wavConfig.sampleRate;
|
|
@@ -7,8 +7,8 @@ import { WaveFile } from 'wavefile';
|
|
|
7
7
|
import { DeferredTask, Trigger } from '@dxos/async';
|
|
8
8
|
import { type Context, LifecycleState, Resource } from '@dxos/context';
|
|
9
9
|
import { log } from '@dxos/log';
|
|
10
|
-
import { type DataType } from '@dxos/schema';
|
|
11
10
|
import { trace } from '@dxos/tracing';
|
|
11
|
+
import { type ContentBlock } from '@dxos/types';
|
|
12
12
|
|
|
13
13
|
import { TRANSCRIPTION_URL } from '../types';
|
|
14
14
|
import { mergeFloat64Arrays } from '../util';
|
|
@@ -63,14 +63,14 @@ export type TranscribeConfig = {
|
|
|
63
63
|
prefixBufferChunksAmount: number;
|
|
64
64
|
};
|
|
65
65
|
|
|
66
|
-
export type
|
|
66
|
+
export type TranscriberProps = {
|
|
67
67
|
config: TranscribeConfig;
|
|
68
68
|
recorder: AudioRecorder;
|
|
69
69
|
/**
|
|
70
70
|
* Callback to handle the transcribed segments, after all segment transformers are applied.
|
|
71
71
|
* @param segments - The transcribed segments.
|
|
72
72
|
*/
|
|
73
|
-
onSegments: (segments:
|
|
73
|
+
onSegments: (segments: ContentBlock.Transcript[]) => Promise<void>;
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
/**
|
|
@@ -86,12 +86,12 @@ export class Transcriber extends Resource {
|
|
|
86
86
|
|
|
87
87
|
private readonly _config: TranscribeConfig;
|
|
88
88
|
private readonly _recorder: AudioRecorder;
|
|
89
|
-
private readonly _onSegments:
|
|
89
|
+
private readonly _onSegments: TranscriberProps['onSegments'];
|
|
90
90
|
|
|
91
91
|
private _recording = false;
|
|
92
92
|
private _transcribeTask?: DeferredTask = undefined;
|
|
93
93
|
|
|
94
|
-
constructor({ config, recorder, onSegments }:
|
|
94
|
+
constructor({ config, recorder, onSegments }: TranscriberProps) {
|
|
95
95
|
super();
|
|
96
96
|
this._config = config;
|
|
97
97
|
this._recorder = recorder;
|
|
@@ -221,7 +221,7 @@ export class Transcriber extends Resource {
|
|
|
221
221
|
return segments;
|
|
222
222
|
}
|
|
223
223
|
|
|
224
|
-
private _alignSegments(segments: WhisperSegment[], originalChunks: AudioChunk[]):
|
|
224
|
+
private _alignSegments(segments: WhisperSegment[], originalChunks: AudioChunk[]): ContentBlock.Transcript[] {
|
|
225
225
|
// Absolute zero for all relative timestamps in the segments.
|
|
226
226
|
const zeroTimestamp = originalChunks.at(0)!.timestamp;
|
|
227
227
|
|
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Atom, type Registry } from '@effect-atom/atom-react';
|
|
6
6
|
|
|
7
7
|
import { synchronized } from '@dxos/async';
|
|
8
8
|
import { Resource } from '@dxos/context';
|
|
9
9
|
import { Obj } from '@dxos/echo';
|
|
10
10
|
import { type Queue } from '@dxos/echo-db';
|
|
11
11
|
import { type EdgeHttpClient } from '@dxos/react-edge-client';
|
|
12
|
-
import {
|
|
12
|
+
import { type ContentBlock, Message } from '@dxos/types';
|
|
13
13
|
|
|
14
14
|
import { MediaStreamRecorder } from './media-stream-recorder';
|
|
15
15
|
import { Transcriber } from './transcriber';
|
|
@@ -30,10 +30,11 @@ const PREFIXED_CHUNKS_AMOUNT = 10;
|
|
|
30
30
|
*/
|
|
31
31
|
const TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
|
|
32
32
|
|
|
33
|
-
export type TranscriptMessageEnricher = (message:
|
|
33
|
+
export type TranscriptMessageEnricher = (message: Message.Message) => Promise<Message.Message>;
|
|
34
34
|
|
|
35
35
|
export type TranscriptionManagerOptions = {
|
|
36
36
|
edgeClient: EdgeHttpClient;
|
|
37
|
+
registry: Registry.Registry;
|
|
37
38
|
|
|
38
39
|
/**
|
|
39
40
|
* Enrich the message before it is written to the transcription queue.
|
|
@@ -47,25 +48,30 @@ export type TranscriptionManagerOptions = {
|
|
|
47
48
|
export class TranscriptionManager extends Resource {
|
|
48
49
|
private readonly _edgeClient: EdgeHttpClient;
|
|
49
50
|
private readonly _messageEnricher?: TranscriptMessageEnricher;
|
|
51
|
+
private readonly _registry: Registry.Registry;
|
|
50
52
|
private _audioStreamTrack?: MediaStreamTrack = undefined;
|
|
51
53
|
private _identityDid?: string = undefined;
|
|
52
54
|
private _mediaRecorder?: MediaStreamRecorder = undefined;
|
|
53
55
|
private _transcriber?: Transcriber = undefined;
|
|
54
|
-
private _queue?: Queue<
|
|
55
|
-
private
|
|
56
|
+
private _queue?: Queue<Message.Message> = undefined;
|
|
57
|
+
private _enabledAtom = Atom.make(false);
|
|
56
58
|
|
|
57
59
|
constructor(options: TranscriptionManagerOptions) {
|
|
58
60
|
super();
|
|
59
61
|
this._edgeClient = options.edgeClient;
|
|
60
62
|
this._messageEnricher = options.messageEnricher;
|
|
63
|
+
this._registry = options.registry;
|
|
61
64
|
}
|
|
62
65
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return this._enabled.value;
|
|
66
|
+
get enabled(): Atom.Atom<boolean> {
|
|
67
|
+
return this._enabledAtom;
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
|
|
70
|
+
getEnabled(): boolean {
|
|
71
|
+
return this._registry.get(this._enabledAtom);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
setQueue(queue: Queue<Message.Message>): this {
|
|
69
75
|
this._queue = queue;
|
|
70
76
|
return this;
|
|
71
77
|
}
|
|
@@ -78,7 +84,7 @@ export class TranscriptionManager extends Resource {
|
|
|
78
84
|
}
|
|
79
85
|
|
|
80
86
|
setRecording(recording?: boolean): this {
|
|
81
|
-
if (!this.isOpen || !this.
|
|
87
|
+
if (!this.isOpen || !this.getEnabled()) {
|
|
82
88
|
return this;
|
|
83
89
|
}
|
|
84
90
|
|
|
@@ -91,11 +97,11 @@ export class TranscriptionManager extends Resource {
|
|
|
91
97
|
}
|
|
92
98
|
|
|
93
99
|
async setEnabled(enabled: boolean): Promise<void> {
|
|
94
|
-
if (this.
|
|
100
|
+
if (this.getEnabled() === enabled) {
|
|
95
101
|
return;
|
|
96
102
|
}
|
|
97
103
|
|
|
98
|
-
this.
|
|
104
|
+
this._registry.set(this._enabledAtom, enabled ?? false);
|
|
99
105
|
if (enabled) {
|
|
100
106
|
await this._maybeRestartTranscriber();
|
|
101
107
|
} else {
|
|
@@ -122,7 +128,7 @@ export class TranscriptionManager extends Resource {
|
|
|
122
128
|
}
|
|
123
129
|
|
|
124
130
|
private async _maybeRestartTranscriber(): Promise<void> {
|
|
125
|
-
if (!this._audioStreamTrack || !this.
|
|
131
|
+
if (!this._audioStreamTrack || !this.getEnabled() || !this.isOpen) {
|
|
126
132
|
return;
|
|
127
133
|
}
|
|
128
134
|
|
|
@@ -154,12 +160,12 @@ export class TranscriptionManager extends Resource {
|
|
|
154
160
|
await this._transcriber?.close();
|
|
155
161
|
}
|
|
156
162
|
|
|
157
|
-
private async _onSegments(segments:
|
|
163
|
+
private async _onSegments(segments: ContentBlock.Transcript[]): Promise<void> {
|
|
158
164
|
if (!this.isOpen || !this._queue) {
|
|
159
165
|
return;
|
|
160
166
|
}
|
|
161
167
|
|
|
162
|
-
let block = Obj.make(
|
|
168
|
+
let block = Obj.make(Message.Message, {
|
|
163
169
|
created: new Date().toISOString(),
|
|
164
170
|
blocks: segments,
|
|
165
171
|
sender: { identityDid: this._identityDid },
|
|
@@ -5,20 +5,28 @@
|
|
|
5
5
|
import * as Schema from 'effect/Schema';
|
|
6
6
|
|
|
7
7
|
import { SpaceSchema } from '@dxos/client/echo';
|
|
8
|
+
import { Operation } from '@dxos/operation';
|
|
9
|
+
import { Transcript } from '@dxos/types';
|
|
8
10
|
|
|
9
11
|
import { meta } from '../meta';
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
//
|
|
14
|
+
// Operations
|
|
15
|
+
//
|
|
16
|
+
|
|
17
|
+
const TRANSCRIPT_OPERATION = `${meta.id}/operation`;
|
|
12
18
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
19
|
+
export namespace TranscriptOperation {
|
|
20
|
+
export const Create = Operation.make({
|
|
21
|
+
meta: { key: `${TRANSCRIPT_OPERATION}/create`, name: 'Create Transcript' },
|
|
22
|
+
schema: {
|
|
23
|
+
input: Schema.Struct({
|
|
24
|
+
name: Schema.optional(Schema.String),
|
|
25
|
+
space: SpaceSchema,
|
|
26
|
+
}),
|
|
27
|
+
output: Schema.Struct({
|
|
28
|
+
object: Transcript.Transcript,
|
|
29
|
+
}),
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
// Copyright 2025 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { Capability } from '@dxos/app-framework';
|
|
6
6
|
|
|
7
7
|
import { meta } from '../meta';
|
|
8
8
|
import {
|
|
9
|
-
type
|
|
9
|
+
type MediaStreamRecorderProps,
|
|
10
10
|
type Transcriber,
|
|
11
|
-
type
|
|
11
|
+
type TranscriberProps,
|
|
12
12
|
type TranscriptMessageEnricher,
|
|
13
13
|
type TranscriptionManager,
|
|
14
14
|
} from '../transcriber';
|
|
@@ -16,18 +16,18 @@ import {
|
|
|
16
16
|
export namespace TranscriptionCapabilities {
|
|
17
17
|
export type GetTranscriberProps = {
|
|
18
18
|
audioStreamTrack: MediaStreamTrack;
|
|
19
|
-
recorderConfig?: Partial<
|
|
20
|
-
transcriberConfig?: Partial<
|
|
21
|
-
onSegments:
|
|
19
|
+
recorderConfig?: Partial<MediaStreamRecorderProps['config']>;
|
|
20
|
+
transcriberConfig?: Partial<TranscriberProps['config']>;
|
|
21
|
+
onSegments: TranscriberProps['onSegments'];
|
|
22
22
|
};
|
|
23
23
|
export type GetTranscriber = (props: GetTranscriberProps) => Transcriber;
|
|
24
|
-
export const Transcriber =
|
|
24
|
+
export const Transcriber = Capability.make<GetTranscriber>(`${meta.id}/capability/transcriber`);
|
|
25
25
|
|
|
26
26
|
export type GetTranscriptionManagerProps = {
|
|
27
27
|
messageEnricher?: TranscriptMessageEnricher;
|
|
28
28
|
};
|
|
29
29
|
export type GetTranscriptionManager = (props: GetTranscriptionManagerProps) => TranscriptionManager;
|
|
30
|
-
export const TranscriptionManager =
|
|
30
|
+
export const TranscriptionManager = Capability.make<GetTranscriptionManager>(
|
|
31
31
|
`${meta.id}/capability/transcription-manager`,
|
|
32
32
|
);
|
|
33
33
|
}
|
package/src/types/index.ts
CHANGED
package/src/util/index.ts
CHANGED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Copyright 2025 DXOS.org
|
|
3
|
+
//
|
|
4
|
+
|
|
5
|
+
import { type Identity } from '@dxos/react-client/halo';
|
|
6
|
+
import { type Message } from '@dxos/types';
|
|
7
|
+
|
|
8
|
+
// TODO(thure): Move this?
|
|
9
|
+
export const renderByline =
|
|
10
|
+
(identities: Identity[]) =>
|
|
11
|
+
(message: Message.Message, index: number, debug = false): string[] => {
|
|
12
|
+
if (message.sender.role === 'assistant') {
|
|
13
|
+
// Start/stop block.
|
|
14
|
+
return [message.blocks.find((block) => block._tag === 'transcript')?.text ?? '', ''];
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
// TODO(burdon): Use link/reference markup for users (with popover).
|
|
18
|
+
// TODO(burdon): Color and avatar.
|
|
19
|
+
const identity = identities.find((identity) => identity.did === message.sender.identityDid);
|
|
20
|
+
const name =
|
|
21
|
+
identity?.profile?.displayName ??
|
|
22
|
+
message.sender.contact?.target?.fullName ??
|
|
23
|
+
message.sender.name ??
|
|
24
|
+
message.sender.email ??
|
|
25
|
+
message.sender.identityDid;
|
|
26
|
+
const blocks = message.blocks.filter((block) => block._tag === 'transcript');
|
|
27
|
+
return [
|
|
28
|
+
// TODO(thure): Use an XML tag with the bits needed here.
|
|
29
|
+
`###### ${name}` + (debug ? ` [${index}]:${message.id}` : ''),
|
|
30
|
+
blocks.map((block) => block.text.trim()).join(' '),
|
|
31
|
+
'',
|
|
32
|
+
];
|
|
33
|
+
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
TranscriptContainer_default,
|
|
3
|
-
TranscriptionContainer
|
|
4
|
-
} from "./chunk-7DR6HZEF.mjs";
|
|
5
|
-
import "./chunk-3MKZ2MNQ.mjs";
|
|
6
|
-
import "./chunk-VBUIO677.mjs";
|
|
7
|
-
export {
|
|
8
|
-
TranscriptionContainer,
|
|
9
|
-
TranscriptContainer_default as default
|
|
10
|
-
};
|
|
11
|
-
//# sourceMappingURL=TranscriptContainer-2GSL2XB5.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
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,16 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
meta
|
|
3
|
-
} from "./chunk-VBUIO677.mjs";
|
|
4
|
-
|
|
5
|
-
// src/capabilities/capabilities.ts
|
|
6
|
-
import { defineCapability } from "@dxos/app-framework";
|
|
7
|
-
(function(TranscriptionCapabilities2) {
|
|
8
|
-
TranscriptionCapabilities2.Transcriber = defineCapability(`${meta.id}/capability/transcriber`);
|
|
9
|
-
TranscriptionCapabilities2.TranscriptionManager = defineCapability(`${meta.id}/capability/transcription-manager`);
|
|
10
|
-
})(TranscriptionCapabilities || (TranscriptionCapabilities = {}));
|
|
11
|
-
var TranscriptionCapabilities;
|
|
12
|
-
|
|
13
|
-
export {
|
|
14
|
-
TranscriptionCapabilities
|
|
15
|
-
};
|
|
16
|
-
//# sourceMappingURL=chunk-3MKZ2MNQ.mjs.map
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../../src/capabilities/capabilities.ts"],
|
|
4
|
-
"sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { defineCapability } from '@dxos/app-framework';\n\nimport { meta } from '../meta';\nimport {\n type MediaStreamRecorderParams,\n type Transcriber,\n type TranscriberParams,\n type TranscriptMessageEnricher,\n type TranscriptionManager,\n} from '../transcriber';\n\nexport namespace TranscriptionCapabilities {\n export type GetTranscriberProps = {\n audioStreamTrack: MediaStreamTrack;\n recorderConfig?: Partial<MediaStreamRecorderParams['config']>;\n transcriberConfig?: Partial<TranscriberParams['config']>;\n onSegments: TranscriberParams['onSegments'];\n };\n export type GetTranscriber = (props: GetTranscriberProps) => Transcriber;\n export const Transcriber = defineCapability<GetTranscriber>(`${meta.id}/capability/transcriber`);\n\n export type GetTranscriptionManagerProps = {\n messageEnricher?: TranscriptMessageEnricher;\n };\n export type GetTranscriptionManager = (props: GetTranscriptionManagerProps) => TranscriptionManager;\n export const TranscriptionManager = defineCapability<GetTranscriptionManager>(\n `${meta.id}/capability/transcription-manager`,\n );\n}\n"],
|
|
5
|
-
"mappings": ";;;;;AAIA,SAASA,wBAAwB;UAWhBC,4BAAAA;6BAQFC,cAAcC,iBAAiC,GAAGC,KAAKC,EAAE,yBAAyB;6BAMlFC,uBAAuBH,iBAClC,GAAGC,KAAKC,EAAE,mCAAmC;AAEjD,GAjBiBJ,8BAAAA,4BAAAA,CAAAA,EAAAA;;",
|
|
6
|
-
"names": ["defineCapability", "TranscriptionCapabilities", "Transcriber", "defineCapability", "meta", "id", "TranscriptionManager"]
|
|
7
|
-
}
|