@dxos/plugin-transcription 0.8.3 → 0.8.4-main.1068cf700f

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.
Files changed (273) hide show
  1. package/dist/lib/browser/TranscriptContainer-MV3JBKLS.mjs +12 -0
  2. package/dist/lib/browser/blueprint-definition-K3E72ZBC.mjs +19 -0
  3. package/dist/lib/browser/blueprint-definition-K3E72ZBC.mjs.map +7 -0
  4. package/dist/lib/browser/blueprints/index.mjs +9 -0
  5. package/dist/lib/browser/chunk-AV44VISC.mjs +148 -0
  6. package/dist/lib/browser/chunk-AV44VISC.mjs.map +7 -0
  7. package/dist/lib/browser/chunk-HOOPZ7EM.mjs +35 -0
  8. package/dist/lib/browser/chunk-HOOPZ7EM.mjs.map +7 -0
  9. package/dist/lib/browser/chunk-J5LGTIGS.mjs +10 -0
  10. package/dist/lib/browser/chunk-J5LGTIGS.mjs.map +7 -0
  11. package/dist/lib/browser/{chunk-53AXUEIQ.mjs → chunk-K3JJ46VV.mjs} +367 -433
  12. package/dist/lib/browser/chunk-K3JJ46VV.mjs.map +7 -0
  13. package/dist/lib/browser/chunk-Q5OC3WVG.mjs +72 -0
  14. package/dist/lib/browser/chunk-Q5OC3WVG.mjs.map +7 -0
  15. package/dist/lib/browser/{chunk-UDCCT32F.mjs → chunk-RUKY36XW.mjs} +3 -3
  16. package/dist/lib/browser/{chunk-IQ5ZRMHZ.mjs → chunk-TKFU53OZ.mjs} +70 -105
  17. package/dist/lib/browser/chunk-TKFU53OZ.mjs.map +7 -0
  18. package/dist/lib/browser/index.mjs +68 -75
  19. package/dist/lib/browser/index.mjs.map +4 -4
  20. package/dist/lib/browser/meta.json +1 -1
  21. package/dist/lib/browser/operation-resolver-GLEBGPKH.mjs +22 -0
  22. package/dist/lib/browser/operation-resolver-GLEBGPKH.mjs.map +7 -0
  23. package/dist/lib/browser/react-surface-AWZ2A5WZ.mjs +35 -0
  24. package/dist/lib/browser/react-surface-AWZ2A5WZ.mjs.map +7 -0
  25. package/dist/lib/browser/{transcriber-OYPLZFG5.mjs → transcriber-SLVQP76E.mjs} +17 -13
  26. package/dist/lib/browser/transcriber-SLVQP76E.mjs.map +7 -0
  27. package/dist/lib/browser/types/index.mjs +8 -8
  28. package/dist/lib/node-esm/{TranscriptContainer-G75LDEO5.mjs → TranscriptContainer-7M43UAZ2.mjs} +5 -4
  29. package/dist/lib/node-esm/TranscriptContainer-7M43UAZ2.mjs.map +7 -0
  30. package/dist/lib/node-esm/blueprint-definition-2WIDDA3Y.mjs +20 -0
  31. package/dist/lib/node-esm/blueprint-definition-2WIDDA3Y.mjs.map +7 -0
  32. package/dist/lib/node-esm/blueprints/index.mjs +10 -0
  33. package/dist/lib/node-esm/blueprints/index.mjs.map +7 -0
  34. package/dist/lib/node-esm/chunk-4BFY6P2D.mjs +73 -0
  35. package/dist/lib/node-esm/chunk-4BFY6P2D.mjs.map +7 -0
  36. package/dist/lib/node-esm/{chunk-PRL64SRU.mjs → chunk-EPC27WWV.mjs} +70 -105
  37. package/dist/lib/node-esm/chunk-EPC27WWV.mjs.map +7 -0
  38. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs +11 -0
  39. package/dist/lib/node-esm/chunk-HSLMI22Q.mjs.map +7 -0
  40. package/dist/lib/node-esm/chunk-NVM2QUMX.mjs +37 -0
  41. package/dist/lib/node-esm/chunk-NVM2QUMX.mjs.map +7 -0
  42. package/dist/lib/node-esm/{chunk-MFJO7EKD.mjs → chunk-SNZAN34I.mjs} +3 -3
  43. package/dist/lib/node-esm/{chunk-56QHOX4A.mjs → chunk-TIUYXGQN.mjs} +367 -433
  44. package/dist/lib/node-esm/chunk-TIUYXGQN.mjs.map +7 -0
  45. package/dist/lib/node-esm/chunk-TTJBW7CY.mjs +149 -0
  46. package/dist/lib/node-esm/chunk-TTJBW7CY.mjs.map +7 -0
  47. package/dist/lib/node-esm/index.mjs +68 -75
  48. package/dist/lib/node-esm/index.mjs.map +4 -4
  49. package/dist/lib/node-esm/meta.json +1 -1
  50. package/dist/lib/node-esm/operation-resolver-SMCFTUFM.mjs +23 -0
  51. package/dist/lib/node-esm/operation-resolver-SMCFTUFM.mjs.map +7 -0
  52. package/dist/lib/node-esm/react-surface-YBBXC4W5.mjs +36 -0
  53. package/dist/lib/node-esm/react-surface-YBBXC4W5.mjs.map +7 -0
  54. package/dist/lib/node-esm/{transcriber-TVG2MBBN.mjs → transcriber-BO2N3UQ4.mjs} +17 -13
  55. package/dist/lib/node-esm/transcriber-BO2N3UQ4.mjs.map +7 -0
  56. package/dist/lib/node-esm/types/index.mjs +8 -8
  57. package/dist/types/src/TranscriptionPlugin.d.ts +2 -1
  58. package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
  59. package/dist/types/src/blueprints/index.d.ts +2 -0
  60. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  61. package/dist/types/src/blueprints/transcription-blueprint.d.ts +21 -0
  62. package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
  63. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts +10 -0
  64. package/dist/types/src/capabilities/blueprint-definition/blueprint-definition.d.ts.map +1 -0
  65. package/dist/types/src/capabilities/blueprint-definition/index.d.ts +3 -0
  66. package/dist/types/src/capabilities/blueprint-definition/index.d.ts.map +1 -0
  67. package/dist/types/src/capabilities/index.d.ts +4 -4
  68. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  69. package/dist/types/src/capabilities/operation-handler/index.d.ts +3 -0
  70. package/dist/types/src/capabilities/operation-handler/index.d.ts.map +1 -0
  71. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts +5 -0
  72. package/dist/types/src/capabilities/operation-handler/operation-handler.d.ts.map +1 -0
  73. package/dist/types/src/capabilities/operation-resolver/index.d.ts +3 -0
  74. package/dist/types/src/capabilities/operation-resolver/index.d.ts.map +1 -0
  75. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts +5 -0
  76. package/dist/types/src/capabilities/operation-resolver/operation-resolver.d.ts.map +1 -0
  77. package/dist/types/src/capabilities/react-surface/index.d.ts +3 -0
  78. package/dist/types/src/capabilities/react-surface/index.d.ts.map +1 -0
  79. package/dist/types/src/capabilities/react-surface/react-surface.d.ts +5 -0
  80. package/dist/types/src/capabilities/react-surface/react-surface.d.ts.map +1 -0
  81. package/dist/types/src/capabilities/transcriber/index.d.ts +3 -0
  82. package/dist/types/src/capabilities/transcriber/index.d.ts.map +1 -0
  83. package/dist/types/src/capabilities/transcriber/transcriber.d.ts +9 -0
  84. package/dist/types/src/capabilities/transcriber/transcriber.d.ts.map +1 -0
  85. package/dist/types/src/components/Transcript/Transcript.d.ts +7 -10
  86. package/dist/types/src/components/Transcript/Transcript.d.ts.map +1 -1
  87. package/dist/types/src/components/Transcript/Transcript.stories.d.ts +34 -18
  88. package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +1 -1
  89. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +12 -12
  90. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +1 -1
  91. package/dist/types/src/components/Transcript/transcript-extension.d.ts +3 -7
  92. package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +1 -1
  93. package/dist/types/src/components/TranscriptContainer.d.ts +5 -6
  94. package/dist/types/src/components/TranscriptContainer.d.ts.map +1 -1
  95. package/dist/types/src/components/index.d.ts +1 -4
  96. package/dist/types/src/components/index.d.ts.map +1 -1
  97. package/dist/types/src/components/stories/FileTranscription.stories.d.ts +8 -7
  98. package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +1 -1
  99. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +10 -6
  100. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +1 -1
  101. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +10 -9
  102. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +1 -1
  103. package/dist/types/src/components/stories/TranscriptionStory.d.ts +4 -3
  104. package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +1 -1
  105. package/dist/types/src/functions/index.d.ts +3 -0
  106. package/dist/types/src/functions/index.d.ts.map +1 -0
  107. package/dist/types/src/functions/open.d.ts +11 -0
  108. package/dist/types/src/functions/open.d.ts.map +1 -0
  109. package/dist/types/src/functions/summarize.d.ts +11 -0
  110. package/dist/types/src/functions/summarize.d.ts.map +1 -0
  111. package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
  112. package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
  113. package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
  114. package/dist/types/src/hooks/useTranscriber.d.ts +2 -2
  115. package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
  116. package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
  117. package/dist/types/src/index.d.ts +1 -1
  118. package/dist/types/src/index.d.ts.map +1 -1
  119. package/dist/types/src/meta.d.ts +2 -3
  120. package/dist/types/src/meta.d.ts.map +1 -1
  121. package/dist/types/src/segments-normalization/message-normalizer.d.ts +5 -5
  122. package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +1 -1
  123. package/dist/types/src/segments-normalization/normalization.d.ts +503 -311
  124. package/dist/types/src/segments-normalization/normalization.d.ts.map +1 -1
  125. package/dist/types/src/segments-normalization/utils.d.ts +2 -2
  126. package/dist/types/src/segments-normalization/utils.d.ts.map +1 -1
  127. package/dist/types/src/testing/testing.d.ts +10 -10
  128. package/dist/types/src/testing/testing.d.ts.map +1 -1
  129. package/dist/types/src/transcriber/index.d.ts +1 -1
  130. package/dist/types/src/transcriber/index.d.ts.map +1 -1
  131. package/dist/types/src/transcriber/media-stream-recorder.d.ts +3 -3
  132. package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
  133. package/dist/types/src/transcriber/transcriber.d.ts +4 -4
  134. package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
  135. package/dist/types/src/transcriber/transcription-manager.d.ts +12 -13
  136. package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
  137. package/dist/types/src/translations.d.ts +11 -11
  138. package/dist/types/src/translations.d.ts.map +1 -1
  139. package/dist/types/src/types/TranscriptAction.d.ts +25 -0
  140. package/dist/types/src/types/TranscriptAction.d.ts.map +1 -0
  141. package/dist/types/src/types/capabilities.d.ts +18 -0
  142. package/dist/types/src/types/capabilities.d.ts.map +1 -0
  143. package/dist/types/src/types/index.d.ts +3 -1
  144. package/dist/types/src/types/index.d.ts.map +1 -1
  145. package/dist/types/src/types/types.d.ts +0 -26
  146. package/dist/types/src/types/types.d.ts.map +1 -1
  147. package/dist/types/src/util/index.d.ts +1 -0
  148. package/dist/types/src/util/index.d.ts.map +1 -1
  149. package/dist/types/src/util/render-byline.d.ts +4 -0
  150. package/dist/types/src/util/render-byline.d.ts.map +1 -0
  151. package/dist/types/tsconfig.tsbuildinfo +1 -1
  152. package/package.json +88 -72
  153. package/src/TranscriptionPlugin.tsx +40 -58
  154. package/src/blueprints/index.ts +5 -0
  155. package/src/blueprints/transcription-blueprint.ts +25 -0
  156. package/src/capabilities/blueprint-definition/blueprint-definition.ts +24 -0
  157. package/src/capabilities/blueprint-definition/index.ts +7 -0
  158. package/src/capabilities/index.ts +4 -7
  159. package/src/capabilities/operation-handler/index.ts +7 -0
  160. package/src/capabilities/operation-handler/operation-handler.ts +25 -0
  161. package/src/capabilities/operation-resolver/index.ts +7 -0
  162. package/src/capabilities/operation-resolver/operation-resolver.ts +25 -0
  163. package/src/capabilities/react-surface/index.ts +7 -0
  164. package/src/capabilities/react-surface/react-surface.tsx +28 -0
  165. package/src/capabilities/transcriber/index.ts +7 -0
  166. package/src/capabilities/transcriber/transcriber.ts +85 -0
  167. package/src/components/Transcript/Transcript.stories.tsx +61 -57
  168. package/src/components/Transcript/Transcript.tsx +25 -59
  169. package/src/components/Transcript/deprecated/OldTranscript.tsx +11 -11
  170. package/src/components/Transcript/transcript-extension.ts +13 -46
  171. package/src/components/TranscriptContainer.tsx +19 -15
  172. package/src/components/stories/FileTranscription.stories.tsx +80 -70
  173. package/src/components/stories/KeyWordRecognition.stories.tsx +17 -13
  174. package/src/components/stories/MicrophoneTranscription.stories.tsx +89 -87
  175. package/src/components/stories/TranscriptionStory.tsx +14 -14
  176. package/src/functions/index.ts +6 -0
  177. package/src/functions/open.ts +37 -0
  178. package/src/functions/summarize.ts +103 -0
  179. package/src/hooks/useAudioFile.ts +49 -53
  180. package/src/hooks/useQueueModelAdapter.ts +1 -1
  181. package/src/hooks/useTranscriber.ts +12 -7
  182. package/src/hooks/useVoiceInput.ts +4 -3
  183. package/src/index.ts +1 -1
  184. package/src/meta.ts +9 -6
  185. package/src/model/model.test.ts +27 -21
  186. package/src/segments-normalization/message-normalizer.ts +19 -14
  187. package/src/segments-normalization/normalization.test.ts +25 -32
  188. package/src/segments-normalization/normalization.ts +59 -49
  189. package/src/segments-normalization/utils.ts +2 -2
  190. package/src/testing/testing.ts +42 -32
  191. package/src/transcriber/index.ts +1 -1
  192. package/src/transcriber/media-stream-recorder.ts +4 -4
  193. package/src/transcriber/transcriber.browser.test.ts +6 -5
  194. package/src/transcriber/transcriber.ts +9 -11
  195. package/src/transcriber/transcription-manager.ts +37 -52
  196. package/src/translations.ts +6 -4
  197. package/src/types/TranscriptAction.ts +32 -0
  198. package/src/types/capabilities.ts +33 -0
  199. package/src/types/index.ts +3 -1
  200. package/src/types/types.ts +0 -23
  201. package/src/util/index.ts +1 -0
  202. package/src/util/render-byline.ts +33 -0
  203. package/dist/lib/browser/TranscriptContainer-H3AZQ4CQ.mjs +0 -11
  204. package/dist/lib/browser/chunk-53AXUEIQ.mjs.map +0 -7
  205. package/dist/lib/browser/chunk-GOF7MJNV.mjs +0 -19
  206. package/dist/lib/browser/chunk-GOF7MJNV.mjs.map +0 -7
  207. package/dist/lib/browser/chunk-IQ5ZRMHZ.mjs.map +0 -7
  208. package/dist/lib/browser/chunk-OSISJM2F.mjs +0 -55
  209. package/dist/lib/browser/chunk-OSISJM2F.mjs.map +0 -7
  210. package/dist/lib/browser/chunk-W2KNYJD6.mjs +0 -16
  211. package/dist/lib/browser/chunk-W2KNYJD6.mjs.map +0 -7
  212. package/dist/lib/browser/intent-resolver-BGADCHVM.mjs +0 -30
  213. package/dist/lib/browser/intent-resolver-BGADCHVM.mjs.map +0 -7
  214. package/dist/lib/browser/react-surface-HMJS5FSS.mjs +0 -34
  215. package/dist/lib/browser/react-surface-HMJS5FSS.mjs.map +0 -7
  216. package/dist/lib/browser/transcriber-OYPLZFG5.mjs.map +0 -7
  217. package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs +0 -32
  218. package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs.map +0 -7
  219. package/dist/lib/node/chunk-3PYT3BDM.cjs +0 -40
  220. package/dist/lib/node/chunk-3PYT3BDM.cjs.map +0 -7
  221. package/dist/lib/node/chunk-6LW5RA3K.cjs +0 -75
  222. package/dist/lib/node/chunk-6LW5RA3K.cjs.map +0 -7
  223. package/dist/lib/node/chunk-AFUZI63A.cjs +0 -42
  224. package/dist/lib/node/chunk-AFUZI63A.cjs.map +0 -7
  225. package/dist/lib/node/chunk-CVUN3UO7.cjs +0 -778
  226. package/dist/lib/node/chunk-CVUN3UO7.cjs.map +0 -7
  227. package/dist/lib/node/chunk-FKDJNJ57.cjs +0 -35
  228. package/dist/lib/node/chunk-FKDJNJ57.cjs.map +0 -7
  229. package/dist/lib/node/chunk-ZFAUMZXE.cjs +0 -518
  230. package/dist/lib/node/chunk-ZFAUMZXE.cjs.map +0 -7
  231. package/dist/lib/node/index.cjs +0 -133
  232. package/dist/lib/node/index.cjs.map +0 -7
  233. package/dist/lib/node/intent-resolver-LL3TTI4H.cjs +0 -45
  234. package/dist/lib/node/intent-resolver-LL3TTI4H.cjs.map +0 -7
  235. package/dist/lib/node/meta.json +0 -1
  236. package/dist/lib/node/react-surface-N25TBBG4.cjs +0 -56
  237. package/dist/lib/node/react-surface-N25TBBG4.cjs.map +0 -7
  238. package/dist/lib/node/transcriber-6J4FVFSZ.cjs +0 -68
  239. package/dist/lib/node/transcriber-6J4FVFSZ.cjs.map +0 -7
  240. package/dist/lib/node/types/index.cjs +0 -36
  241. package/dist/lib/node/types/index.cjs.map +0 -7
  242. package/dist/lib/node-esm/chunk-56QHOX4A.mjs.map +0 -7
  243. package/dist/lib/node-esm/chunk-FH75X4JC.mjs +0 -56
  244. package/dist/lib/node-esm/chunk-FH75X4JC.mjs.map +0 -7
  245. package/dist/lib/node-esm/chunk-MFJPEIVB.mjs +0 -17
  246. package/dist/lib/node-esm/chunk-MFJPEIVB.mjs.map +0 -7
  247. package/dist/lib/node-esm/chunk-PRL64SRU.mjs.map +0 -7
  248. package/dist/lib/node-esm/chunk-TXMDLLBR.mjs +0 -21
  249. package/dist/lib/node-esm/chunk-TXMDLLBR.mjs.map +0 -7
  250. package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs +0 -31
  251. package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs.map +0 -7
  252. package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs +0 -35
  253. package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs.map +0 -7
  254. package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs.map +0 -7
  255. package/dist/types/src/capabilities/capabilities.d.ts +0 -17
  256. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  257. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  258. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  259. package/dist/types/src/capabilities/react-surface.d.ts +0 -4
  260. package/dist/types/src/capabilities/react-surface.d.ts.map +0 -1
  261. package/dist/types/src/capabilities/transcriber.d.ts +0 -8
  262. package/dist/types/src/capabilities/transcriber.d.ts.map +0 -1
  263. package/dist/types/src/types/schema.d.ts +0 -41
  264. package/dist/types/src/types/schema.d.ts.map +0 -1
  265. package/src/capabilities/capabilities.ts +0 -33
  266. package/src/capabilities/intent-resolver.ts +0 -24
  267. package/src/capabilities/react-surface.tsx +0 -22
  268. package/src/capabilities/transcriber.ts +0 -76
  269. package/src/types/schema.ts +0 -41
  270. /package/dist/lib/browser/{TranscriptContainer-H3AZQ4CQ.mjs.map → TranscriptContainer-MV3JBKLS.mjs.map} +0 -0
  271. /package/dist/lib/{node-esm/TranscriptContainer-G75LDEO5.mjs.map → browser/blueprints/index.mjs.map} +0 -0
  272. /package/dist/lib/browser/{chunk-UDCCT32F.mjs.map → chunk-RUKY36XW.mjs.map} +0 -0
  273. /package/dist/lib/node-esm/{chunk-MFJO7EKD.mjs.map → chunk-SNZAN34I.mjs.map} +0 -0
@@ -0,0 +1,37 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+ import * as Schema from 'effect/Schema';
7
+
8
+ import { Database, Obj, Type } from '@dxos/echo';
9
+ import { QueueService, defineFunction } from '@dxos/functions';
10
+ import { Message, Transcript } from '@dxos/types';
11
+
12
+ import { renderByline } from '../util';
13
+
14
+ export default defineFunction({
15
+ key: 'dxos.org/function/transcription/open',
16
+ name: 'Open',
17
+ description: 'Opens and reads the contents of a transcription object.',
18
+ inputSchema: Schema.Struct({
19
+ transcript: Type.Ref(Transcript.Transcript).annotations({
20
+ description: 'The ID of the transcription object.',
21
+ }),
22
+ }),
23
+ outputSchema: Schema.Struct({
24
+ content: Schema.String,
25
+ }),
26
+ handler: Effect.fn(function* ({ data: { transcript } }) {
27
+ const transcriptObj = yield* Database.load(transcript);
28
+ const { dxn } = yield* Effect.promise(() => transcriptObj.queue.load());
29
+ const queue = yield* QueueService.getQueue(dxn);
30
+ yield* Effect.promise(() => queue?.queryObjects());
31
+ const content = queue?.objects
32
+ .filter((message) => Obj.instanceOf(Message.Message, message))
33
+ .flatMap((message, index) => renderByline([])(message, index))
34
+ .join('\n\n');
35
+ return { content };
36
+ }),
37
+ });
@@ -0,0 +1,103 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Array from 'effect/Array';
6
+ import * as Effect from 'effect/Effect';
7
+ import * as Function from 'effect/Function';
8
+ import * as Layer from 'effect/Layer';
9
+ import * as Option from 'effect/Option';
10
+ import * as Schema from 'effect/Schema';
11
+
12
+ import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';
13
+ import { AiSession, GenerationObserver } from '@dxos/assistant';
14
+ import { TracingService, defineFunction } from '@dxos/functions';
15
+ import { trim } from '@dxos/util';
16
+
17
+ /**
18
+ * Summarize a transcript of a meeting.
19
+ */
20
+ export default defineFunction({
21
+ key: 'dxos.org/function/transcription/summarize',
22
+ name: 'Summarize',
23
+ description: 'Summarize a transcript of a meeting.',
24
+ inputSchema: Schema.Struct({
25
+ transcript: Schema.String.annotations({
26
+ description: 'The transcript of the meeting.',
27
+ }),
28
+ notes: Schema.optional(Schema.String).annotations({
29
+ description: 'Additional notes from the participants.',
30
+ }),
31
+ }),
32
+ outputSchema: Schema.Struct({
33
+ summary: Schema.String.annotations({
34
+ description: 'The summary of the transcript.',
35
+ }),
36
+ }),
37
+ handler: Effect.fnUntraced(
38
+ function* ({ data: { transcript, notes } }) {
39
+ const result = yield* new AiSession().run({
40
+ prompt: `Transcript: ${transcript}\n\nNotes: ${notes}`,
41
+ history: [],
42
+ system: systemPrompt,
43
+ observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'summarize' })),
44
+ });
45
+
46
+ const summary = Function.pipe(
47
+ result,
48
+ Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
49
+ Option.flatMap((msg) =>
50
+ Function.pipe(
51
+ msg.blocks,
52
+ Array.findLast((block) => block._tag === 'text'),
53
+ Option.map((block) => block.text),
54
+ ),
55
+ ),
56
+ Option.getOrThrowWith(() => new Error('No summary found')),
57
+ );
58
+
59
+ return { summary };
60
+ },
61
+ Effect.provide(
62
+ Layer.mergeAll(
63
+ AiService.model('@anthropic/claude-sonnet-4-0'),
64
+ ToolResolverService.layerEmpty,
65
+ ToolExecutionService.layerEmpty,
66
+ TracingService.layerNoop,
67
+ ),
68
+ ),
69
+ ),
70
+ });
71
+
72
+ const systemPrompt = trim`
73
+ You are a helpful assistant that summarizes transcripts of meetings.
74
+
75
+ # Goal
76
+ Create a markdown summary of the meeting transcript with text notes provided.
77
+ Notes are very important so make sure to include them in the summary if they contain meaningful information.
78
+
79
+ # Formatting
80
+ - Format the summary as a markdown document without extra comments like "Here is the summary of the transcript:".
81
+ - Use markdown formatting for headings and bullet points.
82
+ - Format the summary as a list of key points and takeaways.
83
+ - All names of people should be in bold.
84
+
85
+ # Note Taking
86
+ - Correlate items in the summary with the person of origin to build a coherent narrative.
87
+ - Include short quotes verbatim where appropriate. Especially when concerned with design decisions and problem descriptions.
88
+
89
+ # Tasks
90
+ At the end of the summary include tasks.
91
+ Extract only the tasks that are:
92
+ - Directly actionable.
93
+ - Clearly assigned to a person or team (or can easily be inferred).
94
+ - Strongly implied by the conversation and/or user note (no speculative tasks).
95
+ - Specific enough that someone reading them would know exactly what to do next.
96
+
97
+ Format all tasks as markdown checkboxes using the syntax:
98
+ - [ ] Task description.
99
+
100
+ Additional information can be included (indented).
101
+
102
+ If no actionable tasks are found, omit this tasks section.
103
+ `;
@@ -20,67 +20,63 @@ export const useAudioFile = (audioUrl: string, constraints?: MediaTrackConstrain
20
20
  const ctx = new Context();
21
21
 
22
22
  scheduleTask(ctx, async () => {
23
- const response = await fetch(audioUrl);
24
- const blob = await response.blob();
25
- const objectUrl = URL.createObjectURL(blob);
26
- ctx.onDispose(() => {
27
- URL.revokeObjectURL(objectUrl);
28
- });
23
+ // TODO(wittjosiah): Fetch to external url fails in headless storybook test.
24
+ try {
25
+ const response = await fetch(audioUrl);
26
+ const blob = await response.blob();
27
+ const objectUrl = URL.createObjectURL(blob);
28
+ ctx.onDispose(() => {
29
+ URL.revokeObjectURL(objectUrl);
30
+ });
29
31
 
30
- const audio = new Audio();
31
- audio.src = objectUrl;
32
+ const audio = new Audio();
33
+ audio.src = objectUrl;
32
34
 
33
- await new Promise<void>((resolve, reject) => {
34
- audio.addEventListener(
35
- 'error',
36
- (err) => {
37
- log.error('error', { err });
38
- reject(err);
39
- },
40
- { once: true },
41
- );
42
- audio.addEventListener(
43
- 'canplay',
44
- async () => {
45
- log.info('starting...');
46
- try {
47
- // Try to play the audio
48
- await audio.play();
35
+ await new Promise<void>((resolve, reject) => {
36
+ audio.addEventListener(
37
+ 'error',
38
+ (err) => {
39
+ log.error('error', { err });
40
+ reject(err);
41
+ },
42
+ { once: true },
43
+ );
44
+ audio.addEventListener(
45
+ 'canplay',
46
+ async () => {
49
47
  resolve();
50
- } catch (playError) {
51
- log.error('Play failed', { playError });
52
- // Still resolve as the audio is ready, even if autoplay failed.
53
- resolve();
54
- }
55
- },
56
- { once: true },
57
- );
58
- audio.load();
59
- });
48
+ },
49
+ { once: true },
50
+ );
51
+ audio.load();
52
+ });
60
53
 
61
- const audioCtx = new AudioContext();
54
+ const audioCtx = new AudioContext();
62
55
 
63
- // Resume AudioContext if it's suspended.
64
- if (audioCtx.state === 'suspended') {
65
- await audioCtx.resume();
66
- }
56
+ // Resume AudioContext if it's suspended.
57
+ if (audioCtx.state === 'suspended') {
58
+ await audioCtx.resume();
59
+ }
67
60
 
68
- const destination = audioCtx.createMediaStreamDestination();
69
- destination.channelCount = 1;
61
+ const destination = audioCtx.createMediaStreamDestination();
62
+ destination.channelCount = 1;
70
63
 
71
- const source = audioCtx.createMediaElementSource(audio);
72
- source.connect(destination);
73
- const track = destination.stream.getAudioTracks()[0];
74
- if (constraints) {
75
- await track.applyConstraints(constraints).catch((err) => log.catch(err));
76
- }
64
+ const source = audioCtx.createMediaElementSource(audio);
65
+ source.connect(destination);
66
+ const track = destination.stream.getAudioTracks()[0];
67
+ if (constraints) {
68
+ await track.applyConstraints(constraints).catch((err) => log.catch(err));
69
+ }
77
70
 
78
- // Also connect to speakers so audio is audible.
79
- setStream({
80
- audio,
81
- stream: destination.stream,
82
- track: destination.stream.getAudioTracks()[0],
83
- });
71
+ // Also connect to speakers so audio is audible.
72
+ setStream({
73
+ audio,
74
+ stream: destination.stream,
75
+ track: destination.stream.getAudioTracks()[0],
76
+ });
77
+ } catch (err) {
78
+ log.catch(err);
79
+ }
84
80
  });
85
81
 
86
82
  return () => {
@@ -12,7 +12,7 @@ import { type ChunkRenderer, SerializationModel } from '../model';
12
12
  /**
13
13
  * Model adapter for a queue.
14
14
  */
15
- export const useQueueModelAdapter = <T extends Obj.Any>(
15
+ export const useQueueModelAdapter = <T extends Obj.Unknown>(
16
16
  renderer: ChunkRenderer<T>,
17
17
  queue: Queue<T> | undefined,
18
18
  initialChunks: T[] = [],
@@ -4,30 +4,35 @@
4
4
 
5
5
  import { useEffect, useMemo } from 'react';
6
6
 
7
- import { useCapabilities } from '@dxos/app-framework';
7
+ import { useCapabilities } from '@dxos/app-framework/ui';
8
8
 
9
- import { TranscriptionCapabilities } from '../capabilities';
10
9
  import { type Transcriber } from '../transcriber';
10
+ import { TranscriptionCapabilities } from '../types';
11
11
 
12
12
  /**
13
13
  * Records audio while user is speaking and transcribes it after user is done speaking.
14
14
  */
15
15
  export const useTranscriber = ({
16
16
  audioStreamTrack,
17
- onSegments,
18
- transcriberConfig,
19
17
  recorderConfig,
18
+ transcriberConfig,
19
+ onSegments,
20
20
  }: Partial<TranscriptionCapabilities.GetTranscriberProps>) => {
21
21
  const [getTranscriber] = useCapabilities(TranscriptionCapabilities.Transcriber);
22
22
 
23
23
  // Initialize audio transcription.
24
24
  const transcriber = useMemo<Transcriber | undefined>(() => {
25
- if (!onSegments || !audioStreamTrack || !getTranscriber) {
25
+ if (!getTranscriber || !audioStreamTrack || !onSegments) {
26
26
  return undefined;
27
27
  }
28
28
 
29
- return getTranscriber({ audioStreamTrack, onSegments, transcriberConfig, recorderConfig });
30
- }, [audioStreamTrack, onSegments, getTranscriber, transcriberConfig, recorderConfig]);
29
+ return getTranscriber({
30
+ audioStreamTrack,
31
+ recorderConfig,
32
+ transcriberConfig,
33
+ onSegments,
34
+ });
35
+ }, [getTranscriber, audioStreamTrack, recorderConfig, transcriberConfig, onSegments]);
31
36
 
32
37
  useEffect(() => {
33
38
  return () => {
@@ -2,16 +2,17 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { useState, useEffect, useCallback } from 'react';
5
+ import { useCallback, useEffect, useState } from 'react';
6
6
 
7
7
  import { scheduleMicroTask } from '@dxos/async';
8
8
  import { Context } from '@dxos/context';
9
9
  import { log } from '@dxos/log';
10
10
  import { useSoundEffect } from '@dxos/react-ui-sfx';
11
11
 
12
+ import { type TranscriberProps } from '../transcriber';
13
+
12
14
  import { useAudioTrack } from './useAudioTrack';
13
15
  import { useTranscriber } from './useTranscriber';
14
- import { type TranscriberParams } from '../transcriber';
15
16
 
16
17
  export type UseVoiceInputProps = {
17
18
  active?: boolean;
@@ -25,7 +26,7 @@ export const useVoiceInput = ({ active, onUpdate }: UseVoiceInputProps) => {
25
26
  const soundStart = useSoundEffect('StartRecording');
26
27
  const soundStop = useSoundEffect('StopRecording');
27
28
 
28
- const handleSegments = useCallback<TranscriberParams['onSegments']>(async (segments) => {
29
+ const handleSegments = useCallback<TranscriberProps['onSegments']>(async (segments) => {
29
30
  const text = segments.map((str) => str.text.trim().replace(/[^\w\s]/g, '')).join(' ');
30
31
  onUpdate(text);
31
32
  }, []);
package/src/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- export { TranscriptionCapabilities } from './capabilities';
5
+ export { TranscriptionCapabilities } from './types';
6
6
 
7
7
  export * from './components';
8
8
  export * from './hooks';
package/src/meta.ts CHANGED
@@ -2,15 +2,18 @@
2
2
  // Copyright 2023 DXOS.org
3
3
  //
4
4
 
5
- import { type PluginMeta } from '@dxos/app-framework';
5
+ import { type Plugin } from '@dxos/app-framework';
6
+ import { trim } from '@dxos/util';
6
7
 
7
- export const TRANSCRIPTION_PLUGIN = 'dxos.org/plugin/transcription';
8
-
9
- export const meta: PluginMeta = {
10
- id: TRANSCRIPTION_PLUGIN,
8
+ export const meta: Plugin.Meta = {
9
+ id: 'dxos.org/plugin/transcription',
11
10
  name: 'Transcription',
12
- description: 'Voice transcription.',
11
+ description: trim`
12
+ Real-time voice-to-text transcription service for capturing spoken content.
13
+ Convert audio input into searchable text that integrates seamlessly with notes and documents.
14
+ `,
13
15
  icon: 'ph--microphone--regular',
16
+ iconHue: 'sky',
14
17
  source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transcription',
15
18
  tags: ['labs'],
16
19
  screenshots: [],
@@ -7,18 +7,18 @@ import { describe, test } from 'vitest';
7
7
 
8
8
  import { Obj } from '@dxos/echo';
9
9
  import type { ObjectId } from '@dxos/keys';
10
- import { DataType } from '@dxos/schema';
10
+ import { Message } from '@dxos/types';
11
11
 
12
- import { SerializationModel, DocumentAdapter, type ChunkRenderer } from './model';
12
+ import { type ChunkRenderer, DocumentAdapter, SerializationModel } from './model';
13
13
 
14
- const blockToMarkdown: ChunkRenderer<DataType.Message> = (
15
- message: DataType.Message,
14
+ const blockToMarkdown: ChunkRenderer<Message.Message> = (
15
+ message: Message.Message,
16
16
  index: number,
17
17
  debug = true,
18
18
  ): string[] => {
19
19
  return [
20
20
  `###### ${message.sender.name}`,
21
- ...message.blocks.filter((block) => block.type === 'transcription').map((block) => block.text),
21
+ ...message.blocks.filter((block) => block._tag === 'transcript').map((block) => block.text),
22
22
  '',
23
23
  ];
24
24
  };
@@ -27,17 +27,17 @@ const createDate = () => new Date().toISOString();
27
27
 
28
28
  describe('SerializationModel', () => {
29
29
  test('basic', ({ expect }) => {
30
- const model = new SerializationModel<DataType.Message>(blockToMarkdown);
30
+ const model = new SerializationModel<Message.Message>(blockToMarkdown);
31
31
  expect(model.chunks.length).to.eq(0);
32
32
  expect(model.doc.toString()).to.eq('');
33
33
 
34
34
  // Create message.
35
- const message = Obj.make(DataType.Message, {
35
+ const message = Obj.make(Message.Message, {
36
36
  created: createDate(),
37
37
  sender: { name: 'Alice' },
38
38
  blocks: [
39
39
  {
40
- type: 'transcription',
40
+ _tag: 'transcript',
41
41
  started: createDate(),
42
42
  text: 'Hello world!',
43
43
  },
@@ -51,7 +51,9 @@ describe('SerializationModel', () => {
51
51
  }
52
52
 
53
53
  // Update message.
54
- message.blocks.push({ type: 'transcription', started: createDate(), text: 'Hello again!' });
54
+ Obj.change(message, (m) => {
55
+ m.blocks.push({ _tag: 'transcript', started: createDate(), text: 'Hello again!' });
56
+ });
55
57
  model.updateChunk(message);
56
58
  {
57
59
  const text = model.doc.toString();
@@ -62,19 +64,19 @@ describe('SerializationModel', () => {
62
64
 
63
65
  test('sync - append', ({ expect }) => {
64
66
  const view = new EditorView({ extensions: [], doc: '' });
65
- const model = new SerializationModel<DataType.Message>(blockToMarkdown);
67
+ const model = new SerializationModel<Message.Message>(blockToMarkdown);
66
68
  const adapter = new DocumentAdapter(view);
67
69
  expect(adapter.lineCount()).to.eq(0);
68
70
  expect(view.state.doc.toString()).to.eq('');
69
71
 
70
72
  // Append message.
71
73
  {
72
- const message = Obj.make(DataType.Message, {
74
+ const message = Obj.make(Message.Message, {
73
75
  created: createDate(),
74
76
  sender: { name: 'Alice' },
75
77
  blocks: [
76
78
  {
77
- type: 'transcription',
79
+ _tag: 'transcript',
78
80
  started: createDate(),
79
81
  text: 'Hello world!',
80
82
  },
@@ -87,12 +89,12 @@ describe('SerializationModel', () => {
87
89
 
88
90
  // Append message.
89
91
  {
90
- const message = Obj.make(DataType.Message, {
92
+ const message = Obj.make(Message.Message, {
91
93
  created: createDate(),
92
94
  sender: { name: 'Bob' },
93
95
  blocks: [
94
96
  {
95
- type: 'transcription',
97
+ _tag: 'transcript',
96
98
  started: createDate(),
97
99
  text: 'Hello world!',
98
100
  },
@@ -106,7 +108,7 @@ describe('SerializationModel', () => {
106
108
 
107
109
  test('sync - append, update, delete', ({ expect }) => {
108
110
  const view = new EditorView({ extensions: [], doc: '' });
109
- const model = new SerializationModel<DataType.Message>(blockToMarkdown);
111
+ const model = new SerializationModel<Message.Message>(blockToMarkdown);
110
112
  const adapter = new DocumentAdapter(view);
111
113
  expect(adapter.lineCount()).to.eq(0);
112
114
 
@@ -114,12 +116,12 @@ describe('SerializationModel', () => {
114
116
 
115
117
  // Append message.
116
118
  {
117
- const message = Obj.make(DataType.Message, {
119
+ const message = Obj.make(Message.Message, {
118
120
  created: createDate(),
119
121
  sender: { name: 'Alice' },
120
122
  blocks: [
121
123
  {
122
- type: 'transcription',
124
+ _tag: 'transcript',
123
125
  started: createDate(),
124
126
  text: 'Hello world!',
125
127
  },
@@ -131,13 +133,17 @@ describe('SerializationModel', () => {
131
133
  expect(view.state.doc.toString()).to.eq('###### Alice\nHello world!\n\n');
132
134
 
133
135
  // Update message (add block).
134
- message.blocks.push({ type: 'transcription', started: createDate(), text: 'Hello again!' });
136
+ Obj.change(message, (m) => {
137
+ m.blocks.push({ _tag: 'transcript', started: createDate(), text: 'Hello again!' });
138
+ });
135
139
  model.updateChunk(message);
136
140
  model.sync(adapter);
137
141
  expect(view.state.doc.toString()).to.eq('###### Alice\nHello world!\nHello again!\n\n');
138
142
 
139
143
  // Update message (remove block).
140
- message.blocks.splice(0, 1);
144
+ Obj.change(message, (m) => {
145
+ m.blocks.splice(0, 1);
146
+ });
141
147
  model.updateChunk(message);
142
148
  model.sync(adapter);
143
149
  expect(view.state.doc.toString()).to.eq('###### Alice\nHello again!\n\n');
@@ -147,10 +153,10 @@ describe('SerializationModel', () => {
147
153
 
148
154
  // Append message.
149
155
  {
150
- const message = Obj.make(DataType.Message, {
156
+ const message = Obj.make(Message.Message, {
151
157
  created: createDate(),
152
158
  sender: { name: 'Bob' },
153
- blocks: [{ type: 'transcription', started: createDate(), text: 'Hello again!' }],
159
+ blocks: [{ _tag: 'transcript', started: createDate(), text: 'Hello again!' }],
154
160
  });
155
161
  model.appendChunk(message);
156
162
  model.sync(adapter);
@@ -6,24 +6,22 @@
6
6
  // Copyright 2025 DXOS.org
7
7
  //
8
8
 
9
- import { effect } from '@preact/signals-core';
10
-
11
- import { asyncTimeout, DeferredTask } from '@dxos/async';
9
+ import { DeferredTask, asyncTimeout } from '@dxos/async';
12
10
  import { LifecycleState, Resource } from '@dxos/context';
13
11
  import { type Queue } from '@dxos/echo-db';
14
- import { type FunctionExecutor } from '@dxos/functions';
12
+ import { type FunctionExecutor } from '@dxos/functions-runtime';
15
13
  import { log } from '@dxos/log';
16
- import { type DataType } from '@dxos/schema';
14
+ import { type Message } from '@dxos/types';
17
15
 
18
- import { type MessageWithRangeId, sentenceNormalization } from './normalization';
16
+ import { type MessageWithRangeId, type NormalizationOutput, sentenceNormalization } from './normalization';
19
17
  import { getActorId } from './utils';
20
18
 
21
19
  const PROCESSING_TIMEOUT = 20_000; // ms
22
20
  const MAX_RANGE_ID_COUNT = 10;
23
21
 
24
- export type SegmentsNormalizerParams = {
22
+ export type SegmentsNormalizerProps = {
25
23
  functionExecutor: FunctionExecutor;
26
- queue: Queue<DataType.Message>;
24
+ queue: Queue<Message.Message>;
27
25
  startingCursor: QueueCursor;
28
26
  };
29
27
 
@@ -36,13 +34,13 @@ export type QueueCursor = {
36
34
  // TODO(mykola): .
37
35
  export class MessageNormalizer extends Resource {
38
36
  private readonly _functionExecutor: FunctionExecutor;
39
- private _queue: Queue<DataType.Message>;
37
+ private _queue: Queue<Message.Message>;
40
38
  private _cursor: QueueCursor;
41
39
  private _messagesToProcess: MessageWithRangeId[] = [];
42
40
  private _normalizationTask?: DeferredTask;
43
41
  private _lastProcessedMessageIds?: string[];
44
42
 
45
- constructor({ functionExecutor, queue, startingCursor }: SegmentsNormalizerParams) {
43
+ constructor({ functionExecutor, queue, startingCursor }: SegmentsNormalizerProps) {
46
44
  super();
47
45
  this._functionExecutor = functionExecutor;
48
46
  this._queue = queue;
@@ -51,7 +49,8 @@ export class MessageNormalizer extends Resource {
51
49
 
52
50
  protected override async _open(): Promise<void> {
53
51
  this._normalizationTask = new DeferredTask(this._ctx, () => this._processMessages());
54
- const unsubscribe = effect(() => {
52
+
53
+ const updateMessages = () => {
55
54
  if (this._lifecycleState !== LifecycleState.OPEN) {
56
55
  return;
57
56
  }
@@ -62,8 +61,14 @@ export class MessageNormalizer extends Resource {
62
61
  });
63
62
 
64
63
  this._normalizationTask!.schedule();
65
- });
66
- this._ctx.onDispose(() => unsubscribe());
64
+ };
65
+
66
+ // Initial update.
67
+ updateMessages();
68
+
69
+ // Subscribe to queue changes.
70
+ const unsubscribe = this._queue.subscribe(updateMessages);
71
+ this._ctx.onDispose(unsubscribe);
67
72
  }
68
73
 
69
74
  // Need to unpack strings from blocks from messages run them through the function and then pack them back into blocks into messages.
@@ -81,7 +86,7 @@ export class MessageNormalizer extends Resource {
81
86
 
82
87
  try {
83
88
  // TODO(mykola): Executor should support timeout.
84
- const response = await asyncTimeout(
89
+ const response: NormalizationOutput = await asyncTimeout(
85
90
  this._functionExecutor.invoke(sentenceNormalization, { messages }),
86
91
  PROCESSING_TIMEOUT,
87
92
  );