@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
@@ -2,20 +2,23 @@ import {
2
2
  MediaStreamRecorder,
3
3
  Transcriber,
4
4
  TranscriptionManager
5
- } from "./chunk-IQ5ZRMHZ.mjs";
6
- import "./chunk-OSISJM2F.mjs";
5
+ } from "./chunk-TKFU53OZ.mjs";
6
+ import "./chunk-HOOPZ7EM.mjs";
7
7
  import {
8
8
  TranscriptionCapabilities
9
- } from "./chunk-W2KNYJD6.mjs";
10
- import "./chunk-GOF7MJNV.mjs";
9
+ } from "./chunk-Q5OC3WVG.mjs";
10
+ import "./chunk-J5LGTIGS.mjs";
11
11
 
12
- // packages/plugins/plugin-transcription/src/capabilities/transcriber.ts
13
- import { contributes } from "@dxos/app-framework";
12
+ // src/capabilities/transcriber/transcriber.ts
13
+ import * as Effect from "effect/Effect";
14
+ import { Capabilities, Capability } from "@dxos/app-framework";
14
15
  import { ClientCapabilities } from "@dxos/plugin-client";
15
16
  var RECORD_INTERVAL = 200;
16
17
  var PREFIXED_CHUNKS_AMOUNT = 10;
17
18
  var TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
18
- var transcriber_default = (context) => {
19
+ var transcriber_default = Capability.makeModule(Effect.fnUntraced(function* () {
20
+ const capabilities = yield* Capability.Service;
21
+ const registry = yield* Capability.get(Capabilities.AtomRegistry);
19
22
  const getTranscriber = ({ audioStreamTrack, onSegments, transcriberConfig, recorderConfig }) => {
20
23
  return new Transcriber({
21
24
  config: {
@@ -34,10 +37,11 @@ var transcriber_default = (context) => {
34
37
  });
35
38
  };
36
39
  const getTranscriptionManager = ({ messageEnricher }) => {
37
- const client = context.getCapability(ClientCapabilities.Client);
40
+ const client = capabilities.get(ClientCapabilities.Client);
38
41
  const transcriptionManager = new TranscriptionManager({
39
42
  edgeClient: client.edge,
40
- messageEnricher
43
+ messageEnricher,
44
+ registry
41
45
  });
42
46
  const identity = client.halo.identity.get();
43
47
  if (identity) {
@@ -46,11 +50,11 @@ var transcriber_default = (context) => {
46
50
  return transcriptionManager;
47
51
  };
48
52
  return [
49
- contributes(TranscriptionCapabilities.Transcriber, getTranscriber),
50
- contributes(TranscriptionCapabilities.TranscriptionManager, getTranscriptionManager)
53
+ Capability.contributes(TranscriptionCapabilities.Transcriber, getTranscriber),
54
+ Capability.contributes(TranscriptionCapabilities.TranscriptionManager, getTranscriptionManager)
51
55
  ];
52
- };
56
+ }));
53
57
  export {
54
58
  transcriber_default as default
55
59
  };
56
- //# sourceMappingURL=transcriber-OYPLZFG5.mjs.map
60
+ //# sourceMappingURL=transcriber-SLVQP76E.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/transcriber/transcriber.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capabilities, Capability } from '@dxos/app-framework';\nimport { ClientCapabilities } from '@dxos/plugin-client';\n\nimport { MediaStreamRecorder, Transcriber, TranscriptionManager } from '../../transcriber';\nimport { TranscriptionCapabilities } from '../../types';\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 Capability.makeModule(\n Effect.fnUntraced(function* () {\n // Get context for lazy capability access in callbacks.\n const capabilities = yield* Capability.Service;\n const registry = yield* Capability.get(Capabilities.AtomRegistry);\n\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 = capabilities.get(ClientCapabilities.Client);\n const transcriptionManager = new TranscriptionManager({\n edgeClient: client.edge,\n messageEnricher,\n registry,\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 Capability.contributes(TranscriptionCapabilities.Transcriber, getTranscriber),\n Capability.contributes(TranscriptionCapabilities.TranscriptionManager, getTranscriptionManager),\n ];\n }),\n);\n"],
5
+ "mappings": ";;;;;;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,cAAcC,kBAAkB;AACzC,SAASC,0BAA0B;AAUnC,IAAMC,kBAAkB;AAKxB,IAAMC,yBAAyB;AAM/B,IAAMC,iCAAiC;AAKvC,IAAA,sBAAeC,WAAWC,WACjBC,kBAAW,aAAA;AAEhB,QAAMC,eAAe,OAAOH,WAAWI;AACvC,QAAMC,WAAW,OAAOL,WAAWM,IAAIC,aAAaC,YAAY;AAEhE,QAAMC,iBAA2D,CAAC,EAChEC,kBACAC,YACAC,mBACAC,eAAc,MACf;AAEC,WAAO,IAAIC,YAAY;MACrBC,QAAQ;QACNC,6BAA6BjB;QAC7BkB,0BAA0BnB;QAC1B,GAAGc;MACL;MACAM,UAAU,IAAIC,oBAAoB;QAChCC,kBAAkBV;QAClBK,QAAQ;UACNM,UAAUxB;UACV,GAAGgB;QACL;MACF,CAAA;MACAF;IACF,CAAA;EACF;AAEA,QAAMW,0BAA6E,CAAC,EAAEC,gBAAe,MAAE;AACrG,UAAMC,SAASrB,aAAaG,IAAImB,mBAAmBC,MAAM;AACzD,UAAMC,uBAAuB,IAAIC,qBAAqB;MACpDC,YAAYL,OAAOM;MACnBP;MACAlB;IACF,CAAA;AAEA,UAAM0B,WAAWP,OAAOQ,KAAKD,SAASzB,IAAG;AACzC,QAAIyB,UAAU;AACZJ,2BAAqBM,eAAeF,SAASG,GAAG;IAClD;AAEA,WAAOP;EACT;AAEA,SAAO;IACL3B,WAAWmC,YAAYC,0BAA0BtB,aAAaL,cAAAA;IAC9DT,WAAWmC,YAAYC,0BAA0BR,sBAAsBN,uBAAAA;;AAE3E,CAAA,CAAA;",
6
+ "names": ["Effect", "Capabilities", "Capability", "ClientCapabilities", "RECORD_INTERVAL", "PREFIXED_CHUNKS_AMOUNT", "TRANSCRIBE_AFTER_CHUNKS_AMOUNT", "Capability", "makeModule", "fnUntraced", "capabilities", "Service", "registry", "get", "Capabilities", "AtomRegistry", "getTranscriber", "audioStreamTrack", "onSegments", "transcriberConfig", "recorderConfig", "Transcriber", "config", "transcribeAfterChunksAmount", "prefixBufferChunksAmount", "recorder", "MediaStreamRecorder", "mediaStreamTrack", "interval", "getTranscriptionManager", "messageEnricher", "client", "ClientCapabilities", "Client", "transcriptionManager", "TranscriptionManager", "edgeClient", "edge", "identity", "halo", "setIdentityDid", "did", "contributes", "TranscriptionCapabilities"]
7
+ }
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  TRANSCRIPTION_URL,
3
- TranscriptSchema,
4
- TranscriptType,
5
- TranscriptionAction
6
- } from "../chunk-OSISJM2F.mjs";
7
- import "../chunk-GOF7MJNV.mjs";
3
+ TranscriptAction_exports,
4
+ TranscriptOperation,
5
+ TranscriptionCapabilities
6
+ } from "../chunk-Q5OC3WVG.mjs";
7
+ import "../chunk-J5LGTIGS.mjs";
8
8
  export {
9
9
  TRANSCRIPTION_URL,
10
- TranscriptSchema,
11
- TranscriptType,
12
- TranscriptionAction
10
+ TranscriptAction_exports as TranscriptAction,
11
+ TranscriptOperation,
12
+ TranscriptionCapabilities
13
13
  };
14
14
  //# sourceMappingURL=index.mjs.map
@@ -2,11 +2,12 @@ import { createRequire } from 'node:module';const require = createRequire(import
2
2
  import {
3
3
  TranscriptContainer_default,
4
4
  TranscriptionContainer
5
- } from "./chunk-56QHOX4A.mjs";
6
- import "./chunk-MFJPEIVB.mjs";
7
- import "./chunk-TXMDLLBR.mjs";
5
+ } from "./chunk-TIUYXGQN.mjs";
6
+ import "./chunk-NVM2QUMX.mjs";
7
+ import "./chunk-4BFY6P2D.mjs";
8
+ import "./chunk-HSLMI22Q.mjs";
8
9
  export {
9
10
  TranscriptionContainer,
10
11
  TranscriptContainer_default as default
11
12
  };
12
- //# sourceMappingURL=TranscriptContainer-G75LDEO5.mjs.map
13
+ //# sourceMappingURL=TranscriptContainer-7M43UAZ2.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,20 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ transcription_blueprint_exports
4
+ } from "./chunk-TTJBW7CY.mjs";
5
+ import "./chunk-NVM2QUMX.mjs";
6
+ import "./chunk-HSLMI22Q.mjs";
7
+
8
+ // src/capabilities/blueprint-definition/blueprint-definition.ts
9
+ import * as Effect from "effect/Effect";
10
+ import { Capability } from "@dxos/app-framework";
11
+ import { AppCapabilities } from "@dxos/app-toolkit";
12
+ var blueprintDefinition = Capability.makeModule(() => Effect.succeed([
13
+ Capability.contributes(AppCapabilities.Functions, transcription_blueprint_exports.functions),
14
+ Capability.contributes(AppCapabilities.BlueprintDefinition, transcription_blueprint_exports.make())
15
+ ]));
16
+ var blueprint_definition_default = blueprintDefinition;
17
+ export {
18
+ blueprint_definition_default as default
19
+ };
20
+ //# sourceMappingURL=blueprint-definition-2WIDDA3Y.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/capabilities/blueprint-definition/blueprint-definition.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Effect from 'effect/Effect';\n\nimport { Capability } from '@dxos/app-framework';\nimport { AppCapabilities } from '@dxos/app-toolkit';\n\nimport { TranscriptionBlueprint } from '../../blueprints';\n\nexport type BlueprintCapabilities = [\n Capability.Capability<typeof AppCapabilities.Functions>,\n Capability.Capability<typeof AppCapabilities.BlueprintDefinition>,\n];\n\nconst blueprintDefinition = Capability.makeModule<[], BlueprintCapabilities>(() =>\n Effect.succeed([\n Capability.contributes(AppCapabilities.Functions, TranscriptionBlueprint.functions),\n Capability.contributes(AppCapabilities.BlueprintDefinition, TranscriptionBlueprint.make()),\n ]),\n);\n\nexport default blueprintDefinition;\n"],
5
+ "mappings": ";;;;;;;;AAIA,YAAYA,YAAY;AAExB,SAASC,kBAAkB;AAC3B,SAASC,uBAAuB;AAShC,IAAMC,sBAAsBC,WAAWC,WAAsC,MACpEC,eAAQ;EACbF,WAAWG,YAAYC,gBAAgBC,WAAWC,gCAAuBC,SAAS;EAClFP,WAAWG,YAAYC,gBAAgBI,qBAAqBF,gCAAuBG,KAAI,CAAA;CACxF,CAAA;AAGH,IAAA,+BAAeV;",
6
+ "names": ["Effect", "Capability", "AppCapabilities", "blueprintDefinition", "Capability", "makeModule", "succeed", "contributes", "AppCapabilities", "Functions", "TranscriptionBlueprint", "functions", "BlueprintDefinition", "make"]
7
+ }
@@ -0,0 +1,10 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ transcription_blueprint_exports
4
+ } from "../chunk-TTJBW7CY.mjs";
5
+ import "../chunk-NVM2QUMX.mjs";
6
+ import "../chunk-HSLMI22Q.mjs";
7
+ export {
8
+ transcription_blueprint_exports as TranscriptionBlueprint
9
+ };
10
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": [],
4
+ "sourcesContent": [],
5
+ "mappings": "",
6
+ "names": []
7
+ }
@@ -0,0 +1,73 @@
1
+ import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ __export
4
+ } from "./chunk-HSLMI22Q.mjs";
5
+
6
+ // src/types/capabilities.ts
7
+ import { Capability } from "@dxos/app-framework";
8
+
9
+ // src/meta.ts
10
+ import { trim } from "@dxos/util";
11
+ var meta = {
12
+ id: "dxos.org/plugin/transcription",
13
+ name: "Transcription",
14
+ description: trim`
15
+ Real-time voice-to-text transcription service for capturing spoken content.
16
+ Convert audio input into searchable text that integrates seamlessly with notes and documents.
17
+ `,
18
+ icon: "ph--microphone--regular",
19
+ iconHue: "sky",
20
+ source: "https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transcription",
21
+ tags: [
22
+ "labs"
23
+ ],
24
+ screenshots: []
25
+ };
26
+
27
+ // src/types/capabilities.ts
28
+ (function(TranscriptionCapabilities2) {
29
+ TranscriptionCapabilities2.Transcriber = Capability.make(`${meta.id}/capability/transcriber`);
30
+ TranscriptionCapabilities2.TranscriptionManager = Capability.make(`${meta.id}/capability/transcription-manager`);
31
+ })(TranscriptionCapabilities || (TranscriptionCapabilities = {}));
32
+ var TranscriptionCapabilities;
33
+
34
+ // src/types/TranscriptAction.ts
35
+ var TranscriptAction_exports = {};
36
+ __export(TranscriptAction_exports, {
37
+ TranscriptOperation: () => TranscriptOperation
38
+ });
39
+ import * as Schema from "effect/Schema";
40
+ import { SpaceSchema } from "@dxos/client/echo";
41
+ import { Operation } from "@dxos/operation";
42
+ import { Transcript } from "@dxos/types";
43
+ var TRANSCRIPT_OPERATION = `${meta.id}/operation`;
44
+ (function(TranscriptOperation2) {
45
+ TranscriptOperation2.Create = Operation.make({
46
+ meta: {
47
+ key: `${TRANSCRIPT_OPERATION}/create`,
48
+ name: "Create Transcript"
49
+ },
50
+ schema: {
51
+ input: Schema.Struct({
52
+ name: Schema.optional(Schema.String),
53
+ space: SpaceSchema
54
+ }),
55
+ output: Schema.Struct({
56
+ object: Transcript.Transcript
57
+ })
58
+ }
59
+ });
60
+ })(TranscriptOperation || (TranscriptOperation = {}));
61
+ var TranscriptOperation;
62
+
63
+ // src/types/types.ts
64
+ var TRANSCRIPTION_URL = "https://calls-service.dxos.workers.dev";
65
+
66
+ export {
67
+ meta,
68
+ TranscriptionCapabilities,
69
+ TranscriptOperation,
70
+ TranscriptAction_exports,
71
+ TRANSCRIPTION_URL
72
+ };
73
+ //# sourceMappingURL=chunk-4BFY6P2D.mjs.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../src/types/capabilities.ts", "../../../src/meta.ts", "../../../src/types/TranscriptAction.ts", "../../../src/types/types.ts"],
4
+ "sourcesContent": ["//\n// Copyright 2025 DXOS.org\n//\n\nimport { Capability } from '@dxos/app-framework';\n\nimport { meta } from '../meta';\nimport {\n type MediaStreamRecorderProps,\n type Transcriber,\n type TranscriberProps,\n type TranscriptMessageEnricher,\n type TranscriptionManager,\n} from '../transcriber';\n\nexport namespace TranscriptionCapabilities {\n export type GetTranscriberProps = {\n audioStreamTrack: MediaStreamTrack;\n recorderConfig?: Partial<MediaStreamRecorderProps['config']>;\n transcriberConfig?: Partial<TranscriberProps['config']>;\n onSegments: TranscriberProps['onSegments'];\n };\n export type GetTranscriber = (props: GetTranscriberProps) => Transcriber;\n export const Transcriber = Capability.make<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 = Capability.make<GetTranscriptionManager>(\n `${meta.id}/capability/transcription-manager`,\n );\n}\n", "//\n// Copyright 2023 DXOS.org\n//\n\nimport { type Plugin } from '@dxos/app-framework';\nimport { trim } from '@dxos/util';\n\nexport const meta: Plugin.Meta = {\n id: 'dxos.org/plugin/transcription',\n name: 'Transcription',\n description: trim`\n Real-time voice-to-text transcription service for capturing spoken content.\n Convert audio input into searchable text that integrates seamlessly with notes and documents.\n `,\n icon: 'ph--microphone--regular',\n iconHue: 'sky',\n source: 'https://github.com/dxos/dxos/tree/main/packages/plugins/plugin-transcription',\n tags: ['labs'],\n screenshots: [],\n};\n", "//\n// Copyright 2025 DXOS.org\n//\n\nimport * as Schema from 'effect/Schema';\n\nimport { SpaceSchema } from '@dxos/client/echo';\nimport { Operation } from '@dxos/operation';\nimport { Transcript } from '@dxos/types';\n\nimport { meta } from '../meta';\n\n//\n// Operations\n//\n\nconst TRANSCRIPT_OPERATION = `${meta.id}/operation`;\n\nexport namespace TranscriptOperation {\n export const Create = Operation.make({\n meta: { key: `${TRANSCRIPT_OPERATION}/create`, name: 'Create Transcript' },\n schema: {\n input: Schema.Struct({\n name: Schema.optional(Schema.String),\n space: SpaceSchema,\n }),\n output: Schema.Struct({\n object: Transcript.Transcript,\n }),\n },\n });\n}\n", "//\n// Copyright 2025 DXOS.org\n//\n\n/**\n * Endpoint to the calls service.\n */\n// TODO(burdon): Reconfigure/move.\nexport const TRANSCRIPTION_URL = 'https://calls-service.dxos.workers.dev';\n"],
5
+ "mappings": ";;;;;;AAIA,SAASA,kBAAkB;;;ACC3B,SAASC,YAAY;AAEd,IAAMC,OAAoB;EAC/BC,IAAI;EACJC,MAAM;EACNC,aAAaC;;;;EAIbC,MAAM;EACNC,SAAS;EACTC,QAAQ;EACRC,MAAM;IAAC;;EACPC,aAAa,CAAA;AACf;;;UDJiBC,4BAAAA;6BAQFC,cAAcC,WAAWC,KAAqB,GAAGC,KAAKC,EAAE,yBAAyB;6BAMjFC,uBAAuBJ,WAAWC,KAC7C,GAAGC,KAAKC,EAAE,mCAAmC;AAEjD,GAjBiBL,8BAAAA,4BAAAA,CAAAA,EAAAA;;;;AEfjB;;;;AAIA,YAAYO,YAAY;AAExB,SAASC,mBAAmB;AAC5B,SAASC,iBAAiB;AAC1B,SAASC,kBAAkB;AAQ3B,IAAMC,uBAAuB,GAAGC,KAAKC,EAAE;UAEtBC,sBAAAA;uBACFC,SAASC,UAAUC,KAAK;IACnCL,MAAM;MAAEM,KAAK,GAAGP,oBAAAA;MAA+BQ,MAAM;IAAoB;IACzEC,QAAQ;MACNC,OAAcC,cAAO;QACnBH,MAAaI,gBAAgBC,aAAM;QACnCC,OAAOC;MACT,CAAA;MACAC,QAAeL,cAAO;QACpBM,QAAQC,WAAWA;MACrB,CAAA;IACF;EACF,CAAA;AACF,GAbiBf,wBAAAA,sBAAAA,CAAAA,EAAAA;;;;ACVV,IAAMgB,oBAAoB;",
6
+ "names": ["Capability", "trim", "meta", "id", "name", "description", "trim", "icon", "iconHue", "source", "tags", "screenshots", "TranscriptionCapabilities", "Transcriber", "Capability", "make", "meta", "id", "TranscriptionManager", "Schema", "SpaceSchema", "Operation", "Transcript", "TRANSCRIPT_OPERATION", "meta", "id", "TranscriptOperation", "Create", "Operation", "make", "key", "name", "schema", "input", "Struct", "optional", "String", "space", "SpaceSchema", "output", "object", "Transcript", "TRANSCRIPTION_URL"]
7
+ }
@@ -1,9 +1,12 @@
1
1
  import { createRequire } from 'node:module';const require = createRequire(import.meta.url);
2
+ import {
3
+ mergeFloat64Arrays
4
+ } from "./chunk-NVM2QUMX.mjs";
2
5
  import {
3
6
  TRANSCRIPTION_URL
4
- } from "./chunk-FH75X4JC.mjs";
7
+ } from "./chunk-4BFY6P2D.mjs";
5
8
 
6
- // packages/plugins/plugin-transcription/src/transcriber/media-stream-recorder.ts
9
+ // src/transcriber/media-stream-recorder.ts
7
10
  import { MediaRecorder, register } from "extendable-media-recorder";
8
11
  import { WaveFile } from "wavefile";
9
12
  import { synchronized } from "@dxos/async";
@@ -16,16 +19,22 @@ function _ts_decorate(decorators, target, key, desc) {
16
19
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
17
20
  return c > 3 && r && Object.defineProperty(target, key, r), r;
18
21
  }
19
- var __dxlog_file = "/home/runner/work/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/media-stream-recorder.ts";
22
+ var __dxlog_file = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/media-stream-recorder.ts";
20
23
  var initializingPromise;
21
24
  var initializeExtendableMediaRecorder = async () => {
22
25
  const { connect } = await import("extendable-media-recorder-wav-encoder");
23
26
  await register(await connect());
24
27
  };
25
28
  var MediaStreamRecorder = class {
29
+ _mediaStreamTrack;
30
+ /**
31
+ * Default MediaRecorder implementation do not support wav encoding.
32
+ */
33
+ _config;
34
+ _mediaRecorder = void 0;
35
+ _header = void 0;
36
+ _onChunk;
26
37
  constructor({ mediaStreamTrack, config }) {
27
- this._mediaRecorder = void 0;
28
- this._header = void 0;
29
38
  this._mediaStreamTrack = mediaStreamTrack;
30
39
  this._config = config;
31
40
  }
@@ -119,42 +128,32 @@ MediaStreamRecorder = _ts_decorate([
119
128
  trace.resource()
120
129
  ], MediaStreamRecorder);
121
130
 
122
- // packages/plugins/plugin-transcription/src/transcriber/transcriber.ts
131
+ // src/transcriber/transcriber.ts
123
132
  import { WaveFile as WaveFile2 } from "wavefile";
124
133
  import { DeferredTask, Trigger } from "@dxos/async";
125
134
  import { LifecycleState, Resource } from "@dxos/context";
126
135
  import { log as log2 } from "@dxos/log";
127
136
  import { trace as trace2 } from "@dxos/tracing";
128
-
129
- // packages/plugins/plugin-transcription/src/util/array.ts
130
- var mergeFloat64Arrays = (arrays) => {
131
- const newArray = new Float64Array(arrays.reduce((acc, array) => array.length + acc, 0));
132
- let offset = 0;
133
- for (const array of arrays) {
134
- newArray.set(array, offset);
135
- offset += array.length;
136
- }
137
- return newArray;
138
- };
139
-
140
- // packages/plugins/plugin-transcription/src/transcriber/transcriber.ts
141
137
  function _ts_decorate2(decorators, target, key, desc) {
142
138
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
143
139
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
144
140
  else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
145
141
  return c > 3 && r && Object.defineProperty(target, key, r), r;
146
142
  }
147
- var __dxlog_file2 = "/home/runner/work/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/transcriber.ts";
143
+ var __dxlog_file2 = "/__w/dxos/dxos/packages/plugins/plugin-transcription/src/transcriber/transcriber.ts";
148
144
  var Transcriber = class extends Resource {
145
+ _audioChunks = [];
146
+ _lastUsedTimestamp = 0;
147
+ _openTrigger = new Trigger({
148
+ autoReset: true
149
+ });
150
+ _config;
151
+ _recorder;
152
+ _onSegments;
153
+ _recording = false;
154
+ _transcribeTask = void 0;
149
155
  constructor({ config, recorder, onSegments }) {
150
156
  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
157
  this._config = config;
159
158
  this._recorder = recorder;
160
159
  this._onSegments = onSegments;
@@ -162,7 +161,7 @@ var Transcriber = class extends Resource {
162
161
  async _open(ctx) {
163
162
  log2.info("opening", void 0, {
164
163
  F: __dxlog_file2,
165
- L: 101,
164
+ L: 102,
166
165
  S: this,
167
166
  C: (f, a) => f(...a)
168
167
  });
@@ -174,7 +173,7 @@ var Transcriber = class extends Resource {
174
173
  async _close() {
175
174
  log2.info("closing", void 0, {
176
175
  F: __dxlog_file2,
177
- L: 109,
176
+ L: 110,
178
177
  S: this,
179
178
  C: (f, a) => f(...a)
180
179
  });
@@ -185,7 +184,7 @@ var Transcriber = class extends Resource {
185
184
  startChunksRecording() {
186
185
  log2.info("starting", void 0, {
187
186
  F: __dxlog_file2,
188
- L: 116,
187
+ L: 117,
189
188
  S: this,
190
189
  C: (f, a) => f(...a)
191
190
  });
@@ -202,7 +201,7 @@ var Transcriber = class extends Resource {
202
201
  this._transcribeTask?.schedule();
203
202
  log2.info("stopped", void 0, {
204
203
  F: __dxlog_file2,
205
- L: 131,
204
+ L: 132,
206
205
  S: this,
207
206
  C: (f, a) => f(...a)
208
207
  });
@@ -212,7 +211,7 @@ var Transcriber = class extends Resource {
212
211
  chunk
213
212
  }, {
214
213
  F: __dxlog_file2,
215
- L: 135,
214
+ L: 136,
216
215
  S: this,
217
216
  C: (f, a) => f(...a)
218
217
  });
@@ -228,7 +227,7 @@ var Transcriber = class extends Resource {
228
227
  chunks: this._audioChunks.length
229
228
  }, {
230
229
  F: __dxlog_file2,
231
- L: 151,
230
+ L: 152,
232
231
  S: this,
233
232
  C: (f, a) => f(...a)
234
233
  });
@@ -280,7 +279,7 @@ var Transcriber = class extends Resource {
280
279
  string: segments.map((segments2) => segments2.text).join(" ")
281
280
  }, {
282
281
  F: __dxlog_file2,
283
- L: 215,
282
+ L: 216,
284
283
  S: this,
285
284
  C: (f, a) => f(...a)
286
285
  });
@@ -302,7 +301,7 @@ var Transcriber = class extends Resource {
302
301
  }
303
302
  this._lastUsedTimestamp = zeroTimestamp + filteredSegments.at(-1).end * 1e3;
304
303
  return filteredSegments.map((segment) => ({
305
- type: "transcription",
304
+ _tag: "transcript",
306
305
  started: new Date(zeroTimestamp + segment.start * 1e3).toISOString(),
307
306
  text: segment.text.trim()
308
307
  }));
@@ -319,12 +318,12 @@ _ts_decorate2([
319
318
  })
320
319
  ], Transcriber.prototype, "_fetchTranscription", null);
321
320
 
322
- // packages/plugins/plugin-transcription/src/transcriber/transcription-manager.ts
323
- import { signal } from "@preact/signals-core";
321
+ // src/transcriber/transcription-manager.ts
322
+ import { Atom } from "@effect-atom/atom-react";
324
323
  import { synchronized as synchronized2 } from "@dxos/async";
325
324
  import { Resource as Resource2 } from "@dxos/context";
326
325
  import { Obj } from "@dxos/echo";
327
- import { DataType } from "@dxos/schema";
326
+ import { Message } from "@dxos/types";
328
327
  function _ts_decorate3(decorators, target, key, desc) {
329
328
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
330
329
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
@@ -335,20 +334,26 @@ var RECORD_INTERVAL = 200;
335
334
  var PREFIXED_CHUNKS_AMOUNT = 10;
336
335
  var TRANSCRIBE_AFTER_CHUNKS_AMOUNT = 50;
337
336
  var TranscriptionManager = class extends Resource2 {
337
+ _edgeClient;
338
+ _messageEnricher;
339
+ _registry;
340
+ _audioStreamTrack = void 0;
341
+ _identityDid = void 0;
342
+ _mediaRecorder = void 0;
343
+ _transcriber = void 0;
344
+ _queue = void 0;
345
+ _enabledAtom = Atom.make(false);
338
346
  constructor(options) {
339
347
  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
348
  this._edgeClient = options.edgeClient;
347
349
  this._messageEnricher = options.messageEnricher;
350
+ this._registry = options.registry;
348
351
  }
349
- /** @reactive */
350
352
  get enabled() {
351
- return this._enabled.value;
353
+ return this._enabledAtom;
354
+ }
355
+ getEnabled() {
356
+ return this._registry.get(this._enabledAtom);
352
357
  }
353
358
  setQueue(queue) {
354
359
  this._queue = queue;
@@ -361,7 +366,7 @@ var TranscriptionManager = class extends Resource2 {
361
366
  return this;
362
367
  }
363
368
  setRecording(recording) {
364
- if (!this.isOpen || !this._enabled.value) {
369
+ if (!this.isOpen || !this.getEnabled()) {
365
370
  return this;
366
371
  }
367
372
  if (recording) {
@@ -371,73 +376,32 @@ var TranscriptionManager = class extends Resource2 {
371
376
  }
372
377
  return this;
373
378
  }
374
- /**
375
- * Enable or disable transcription.
376
- * @param enabled - Whether to enable transcription.
377
- */
378
379
  async setEnabled(enabled) {
379
- if (this._enabled.value === enabled) {
380
+ if (this.getEnabled() === enabled) {
380
381
  return;
381
382
  }
382
- this._enabled.value = enabled ?? false;
383
- this.isOpen && await this._toggleTranscriber();
383
+ this._registry.set(this._enabledAtom, enabled ?? false);
384
+ if (enabled) {
385
+ await this._maybeRestartTranscriber();
386
+ } else {
387
+ await this._stopTranscriber();
388
+ }
384
389
  }
385
390
  async setAudioTrack(track) {
386
391
  if (this._audioStreamTrack === track) {
387
392
  return;
388
393
  }
389
394
  this._audioStreamTrack = track;
390
- this.isOpen && await this._toggleTranscriber();
395
+ await this._maybeRestartTranscriber();
391
396
  }
392
397
  async _open() {
393
- await this._toggleTranscriber();
398
+ await this._maybeRestartTranscriber();
394
399
  }
395
400
  async _close() {
396
- void this._transcriber?.close();
401
+ await this._stopTranscriber();
397
402
  }
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
- type: "transcription",
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
- type: "transcription",
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
- }
438
- }
439
- async _maybeReinitTranscriber() {
440
- if (!this._audioStreamTrack || !this._enabled.value) {
403
+ async _maybeRestartTranscriber() {
404
+ if (!this._audioStreamTrack || !this.getEnabled() || !this.isOpen) {
441
405
  return;
442
406
  }
443
407
  let needReinit = false;
@@ -460,13 +424,17 @@ var TranscriptionManager = class extends Resource2 {
460
424
  recorder: this._mediaRecorder,
461
425
  onSegments: (segments) => this._onSegments(segments)
462
426
  });
427
+ await this._transcriber?.open();
463
428
  }
464
429
  }
430
+ async _stopTranscriber() {
431
+ await this._transcriber?.close();
432
+ }
465
433
  async _onSegments(segments) {
466
434
  if (!this.isOpen || !this._queue) {
467
435
  return;
468
436
  }
469
- let block = Obj.make(DataType.Message, {
437
+ let block = Obj.make(Message.Message, {
470
438
  created: (/* @__PURE__ */ new Date()).toISOString(),
471
439
  blocks: segments,
472
440
  sender: {
@@ -481,9 +449,6 @@ var TranscriptionManager = class extends Resource2 {
481
449
  ]);
482
450
  }
483
451
  };
484
- _ts_decorate3([
485
- synchronized2
486
- ], TranscriptionManager.prototype, "setEnabled", null);
487
452
  _ts_decorate3([
488
453
  synchronized2
489
454
  ], TranscriptionManager.prototype, "setAudioTrack", null);
@@ -493,4 +458,4 @@ export {
493
458
  Transcriber,
494
459
  TranscriptionManager
495
460
  };
496
- //# sourceMappingURL=chunk-PRL64SRU.mjs.map
461
+ //# sourceMappingURL=chunk-EPC27WWV.mjs.map