@dxos/plugin-transcription 0.8.3 → 0.8.4-main.03d5cd7b56

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 (344) hide show
  1. package/dist/lib/neutral/TranscriptionContainer-XNGXNGPX.mjs +35 -0
  2. package/dist/lib/neutral/TranscriptionContainer-XNGXNGPX.mjs.map +7 -0
  3. package/dist/lib/neutral/TranscriptionPlugin.mjs +34 -0
  4. package/dist/lib/neutral/TranscriptionPlugin.mjs.map +7 -0
  5. package/dist/lib/neutral/TranscriptionPlugin.node.mjs +25 -0
  6. package/dist/lib/neutral/TranscriptionPlugin.node.mjs.map +7 -0
  7. package/dist/lib/neutral/blueprint-definition-HOXDG5QP.mjs +15 -0
  8. package/dist/lib/neutral/blueprint-definition-HOXDG5QP.mjs.map +7 -0
  9. package/dist/lib/neutral/blueprints/index.mjs +8 -0
  10. package/dist/lib/neutral/capabilities/index.mjs +17 -0
  11. package/dist/lib/neutral/capabilities/index.mjs.map +7 -0
  12. package/dist/lib/neutral/chunk-GL4RS533.mjs +22 -0
  13. package/dist/lib/neutral/chunk-GL4RS533.mjs.map +7 -0
  14. package/dist/lib/neutral/chunk-J5LGTIGS.mjs +10 -0
  15. package/dist/lib/neutral/chunk-KAEXRX3Y.mjs +35 -0
  16. package/dist/lib/neutral/chunk-KAEXRX3Y.mjs.map +7 -0
  17. package/dist/lib/{browser/chunk-IQ5ZRMHZ.mjs → neutral/chunk-LS3R7EQI.mjs} +130 -195
  18. package/dist/lib/neutral/chunk-LS3R7EQI.mjs.map +7 -0
  19. package/dist/lib/neutral/chunk-MLRJWAQH.mjs +179 -0
  20. package/dist/lib/neutral/chunk-MLRJWAQH.mjs.map +7 -0
  21. package/dist/lib/neutral/chunk-NNR3EYR2.mjs +124 -0
  22. package/dist/lib/neutral/chunk-NNR3EYR2.mjs.map +7 -0
  23. package/dist/lib/neutral/chunk-NQQK7UZQ.mjs +244 -0
  24. package/dist/lib/neutral/chunk-NQQK7UZQ.mjs.map +7 -0
  25. package/dist/lib/neutral/chunk-WVEZMGBT.mjs +8 -0
  26. package/dist/lib/neutral/chunk-WVEZMGBT.mjs.map +7 -0
  27. package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs +30 -0
  28. package/dist/lib/neutral/chunk-ZR4BH4QQ.mjs.map +7 -0
  29. package/dist/lib/neutral/components/index.mjs +207 -0
  30. package/dist/lib/neutral/components/index.mjs.map +7 -0
  31. package/dist/lib/neutral/containers/index.mjs +9 -0
  32. package/dist/lib/neutral/containers/index.mjs.map +7 -0
  33. package/dist/lib/neutral/create-2D6S4IMQ.mjs +21 -0
  34. package/dist/lib/neutral/create-2D6S4IMQ.mjs.map +7 -0
  35. package/dist/lib/neutral/hooks/index.mjs +17 -0
  36. package/dist/lib/neutral/index.mjs +44 -0
  37. package/dist/lib/neutral/meta.json +1 -0
  38. package/dist/lib/neutral/meta.mjs +8 -0
  39. package/dist/lib/neutral/meta.mjs.map +7 -0
  40. package/dist/lib/neutral/open-2QB6IIET.mjs +27 -0
  41. package/dist/lib/neutral/open-2QB6IIET.mjs.map +7 -0
  42. package/dist/lib/neutral/operation-handler-NXMOAXFP.mjs +13 -0
  43. package/dist/lib/neutral/operation-handler-NXMOAXFP.mjs.map +7 -0
  44. package/dist/lib/neutral/operations/index.mjs +8 -0
  45. package/dist/lib/neutral/operations/index.mjs.map +7 -0
  46. package/dist/lib/neutral/plugin.mjs +16 -0
  47. package/dist/lib/neutral/plugin.mjs.map +7 -0
  48. package/dist/lib/neutral/react-surface-QF4MUMWG.mjs +26 -0
  49. package/dist/lib/neutral/react-surface-QF4MUMWG.mjs.map +7 -0
  50. package/dist/lib/neutral/summarize-CJPVKWYZ.mjs +78 -0
  51. package/dist/lib/neutral/summarize-CJPVKWYZ.mjs.map +7 -0
  52. package/dist/lib/neutral/text-content-LHSUG2D2.mjs +30 -0
  53. package/dist/lib/neutral/text-content-LHSUG2D2.mjs.map +7 -0
  54. package/dist/lib/{browser/transcriber-OYPLZFG5.mjs → neutral/transcriber-M3R6HPTZ.mjs} +21 -18
  55. package/dist/lib/neutral/transcriber-M3R6HPTZ.mjs.map +7 -0
  56. package/dist/lib/neutral/translations.mjs +22 -0
  57. package/dist/lib/neutral/translations.mjs.map +7 -0
  58. package/dist/lib/neutral/types/index.mjs +12 -0
  59. package/dist/lib/neutral/types/index.mjs.map +7 -0
  60. package/dist/types/src/TranscriptionPlugin.d.ts +3 -1
  61. package/dist/types/src/TranscriptionPlugin.d.ts.map +1 -1
  62. package/dist/types/src/TranscriptionPlugin.node.d.ts +4 -0
  63. package/dist/types/src/TranscriptionPlugin.node.d.ts.map +1 -0
  64. package/dist/types/src/TranscriptionPlugin.test.d.ts +2 -0
  65. package/dist/types/src/TranscriptionPlugin.test.d.ts.map +1 -0
  66. package/dist/types/src/blueprints/index.d.ts +2 -0
  67. package/dist/types/src/blueprints/index.d.ts.map +1 -0
  68. package/dist/types/src/blueprints/transcription-blueprint.d.ts +4 -0
  69. package/dist/types/src/blueprints/transcription-blueprint.d.ts.map +1 -0
  70. package/dist/types/src/capabilities/blueprint-definition.d.ts +6 -0
  71. package/dist/types/src/capabilities/blueprint-definition.d.ts.map +1 -0
  72. package/dist/types/src/capabilities/index.d.ts +10 -4
  73. package/dist/types/src/capabilities/index.d.ts.map +1 -1
  74. package/dist/types/src/capabilities/operation-handler.d.ts +6 -0
  75. package/dist/types/src/capabilities/operation-handler.d.ts.map +1 -0
  76. package/dist/types/src/capabilities/react-surface.d.ts +3 -2
  77. package/dist/types/src/capabilities/react-surface.d.ts.map +1 -1
  78. package/dist/types/src/capabilities/text-content.d.ts +8 -0
  79. package/dist/types/src/capabilities/text-content.d.ts.map +1 -0
  80. package/dist/types/src/capabilities/transcriber.d.ts +4 -3
  81. package/dist/types/src/capabilities/transcriber.d.ts.map +1 -1
  82. package/dist/types/src/components/Transcription/Transcription.d.ts +18 -0
  83. package/dist/types/src/components/Transcription/Transcription.d.ts.map +1 -0
  84. package/dist/types/src/components/Transcription/Transcription.stories.d.ts +40 -0
  85. package/dist/types/src/components/Transcription/Transcription.stories.d.ts.map +1 -0
  86. package/dist/types/src/components/Transcription/index.d.ts +2 -0
  87. package/dist/types/src/components/Transcription/index.d.ts.map +1 -0
  88. package/dist/types/src/components/Transcription/transcription-extension.d.ts +15 -0
  89. package/dist/types/src/components/Transcription/transcription-extension.d.ts.map +1 -0
  90. package/dist/types/src/components/index.d.ts +1 -6
  91. package/dist/types/src/components/index.d.ts.map +1 -1
  92. package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts +6 -0
  93. package/dist/types/src/containers/TranscriptionContainer/TranscriptionContainer.d.ts.map +1 -0
  94. package/dist/types/src/containers/TranscriptionContainer/index.d.ts +2 -0
  95. package/dist/types/src/containers/TranscriptionContainer/index.d.ts.map +1 -0
  96. package/dist/types/src/containers/index.d.ts +3 -0
  97. package/dist/types/src/containers/index.d.ts.map +1 -0
  98. package/dist/types/src/hooks/useAudioFile.d.ts.map +1 -1
  99. package/dist/types/src/hooks/useAudioTrack.d.ts.map +1 -1
  100. package/dist/types/src/hooks/useQueueModelAdapter.d.ts +1 -1
  101. package/dist/types/src/hooks/useQueueModelAdapter.d.ts.map +1 -1
  102. package/dist/types/src/hooks/useTranscriber.d.ts +2 -2
  103. package/dist/types/src/hooks/useTranscriber.d.ts.map +1 -1
  104. package/dist/types/src/hooks/useVoiceInput.d.ts.map +1 -1
  105. package/dist/types/src/index.d.ts +2 -3
  106. package/dist/types/src/index.d.ts.map +1 -1
  107. package/dist/types/src/meta.d.ts +2 -3
  108. package/dist/types/src/meta.d.ts.map +1 -1
  109. package/dist/types/src/model/model.d.ts +2 -2
  110. package/dist/types/src/model/model.d.ts.map +1 -1
  111. package/dist/types/src/{segments-normalization → normalization}/index.d.ts +1 -1
  112. package/dist/types/src/normalization/index.d.ts.map +1 -0
  113. package/dist/types/src/{segments-normalization → normalization}/message-normalizer.d.ts +5 -5
  114. package/dist/types/src/normalization/message-normalizer.d.ts.map +1 -0
  115. package/dist/types/src/normalization/normalization.d.ts +543 -0
  116. package/dist/types/src/normalization/normalization.d.ts.map +1 -0
  117. package/dist/types/src/normalization/normalization.test.d.ts.map +1 -0
  118. package/dist/types/src/normalization/utils.d.ts +3 -0
  119. package/dist/types/src/normalization/utils.d.ts.map +1 -0
  120. package/dist/types/src/operations/create.d.ts +5 -0
  121. package/dist/types/src/operations/create.d.ts.map +1 -0
  122. package/dist/types/src/operations/index.d.ts +3 -0
  123. package/dist/types/src/operations/index.d.ts.map +1 -0
  124. package/dist/types/src/operations/open.d.ts +5 -0
  125. package/dist/types/src/operations/open.d.ts.map +1 -0
  126. package/dist/types/src/operations/summarize.d.ts +8 -0
  127. package/dist/types/src/operations/summarize.d.ts.map +1 -0
  128. package/dist/types/src/plugin.d.ts +4 -0
  129. package/dist/types/src/plugin.d.ts.map +1 -0
  130. package/dist/types/src/stories/FileTranscription.stories.d.ts +18 -0
  131. package/dist/types/src/stories/FileTranscription.stories.d.ts.map +1 -0
  132. package/dist/types/src/stories/KeyWordRecognition.stories.d.ts +14 -0
  133. package/dist/types/src/stories/KeyWordRecognition.stories.d.ts.map +1 -0
  134. package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts +20 -0
  135. package/dist/types/src/stories/MicrophoneTranscription.stories.d.ts.map +1 -0
  136. package/dist/types/src/stories/TranscriptionStory.d.ts +23 -0
  137. package/dist/types/src/stories/TranscriptionStory.d.ts.map +1 -0
  138. package/dist/types/src/stories/useIsSpeaking.d.ts.map +1 -0
  139. package/dist/types/src/testing/testing.d.ts +10 -10
  140. package/dist/types/src/testing/testing.d.ts.map +1 -1
  141. package/dist/types/src/transcriber/media-stream-recorder.d.ts +3 -3
  142. package/dist/types/src/transcriber/media-stream-recorder.d.ts.map +1 -1
  143. package/dist/types/src/transcriber/transcriber.d.ts +60 -5
  144. package/dist/types/src/transcriber/transcriber.d.ts.map +1 -1
  145. package/dist/types/src/transcriber/transcriber.test.d.ts +2 -0
  146. package/dist/types/src/transcriber/transcriber.test.d.ts.map +1 -0
  147. package/dist/types/src/transcriber/transcription-manager.d.ts +12 -13
  148. package/dist/types/src/transcriber/transcription-manager.d.ts.map +1 -1
  149. package/dist/types/src/translations.d.ts +10 -11
  150. package/dist/types/src/translations.d.ts.map +1 -1
  151. package/dist/types/src/types/TranscriptOperation.d.ts +917 -0
  152. package/dist/types/src/types/TranscriptOperation.d.ts.map +1 -0
  153. package/dist/types/src/types/TranscriptionCapabilities.d.ts +17 -0
  154. package/dist/types/src/types/TranscriptionCapabilities.d.ts.map +1 -0
  155. package/dist/types/src/types/defs.d.ts +5 -0
  156. package/dist/types/src/types/defs.d.ts.map +1 -0
  157. package/dist/types/src/types/index.d.ts +3 -2
  158. package/dist/types/src/types/index.d.ts.map +1 -1
  159. package/dist/types/src/util/array.d.ts.map +1 -1
  160. package/dist/types/src/util/get-time-str.d.ts.map +1 -1
  161. package/dist/types/src/util/index.d.ts +1 -0
  162. package/dist/types/src/util/index.d.ts.map +1 -1
  163. package/dist/types/src/util/monitor-audio-level.d.ts.map +1 -1
  164. package/dist/types/src/util/render-byline.d.ts +4 -0
  165. package/dist/types/src/util/render-byline.d.ts.map +1 -0
  166. package/dist/types/tsconfig.tsbuildinfo +1 -1
  167. package/package.json +152 -84
  168. package/src/TranscriptionPlugin.node.ts +20 -0
  169. package/src/TranscriptionPlugin.test.ts +31 -0
  170. package/src/TranscriptionPlugin.tsx +22 -61
  171. package/src/blueprints/index.ts +5 -0
  172. package/src/blueprints/transcription-blueprint.ts +29 -0
  173. package/src/capabilities/blueprint-definition.ts +19 -0
  174. package/src/capabilities/index.ts +11 -6
  175. package/src/capabilities/operation-handler.ts +16 -0
  176. package/src/capabilities/react-surface.tsx +23 -14
  177. package/src/capabilities/text-content.ts +33 -0
  178. package/src/capabilities/transcriber.ts +53 -41
  179. package/src/components/{Transcript/Transcript.stories.tsx → Transcription/Transcription.stories.tsx} +80 -75
  180. package/src/components/Transcription/Transcription.tsx +64 -0
  181. package/src/components/{Transcript → Transcription}/index.ts +1 -1
  182. package/src/components/{Transcript/transcript-extension.ts → Transcription/transcription-extension.ts} +15 -48
  183. package/src/components/index.ts +1 -6
  184. package/src/containers/TranscriptionContainer/TranscriptionContainer.tsx +35 -0
  185. package/src/containers/TranscriptionContainer/index.ts +5 -0
  186. package/src/containers/index.ts +7 -0
  187. package/src/hooks/useAudioFile.ts +49 -53
  188. package/src/hooks/useQueueModelAdapter.ts +1 -1
  189. package/src/hooks/useTranscriber.ts +15 -7
  190. package/src/hooks/useVoiceInput.ts +3 -3
  191. package/src/index.ts +4 -5
  192. package/src/meta.ts +9 -6
  193. package/src/model/model.test.ts +27 -21
  194. package/src/model/model.ts +3 -3
  195. package/src/{segments-normalization → normalization}/message-normalizer.ts +20 -19
  196. package/src/{segments-normalization → normalization}/normalization.test.ts +26 -33
  197. package/src/normalization/normalization.ts +76 -0
  198. package/src/{segments-normalization → normalization}/utils.ts +2 -2
  199. package/src/operations/create.ts +24 -0
  200. package/src/operations/index.ts +11 -0
  201. package/src/operations/open.ts +28 -0
  202. package/src/operations/summarize.ts +101 -0
  203. package/src/plugin.ts +11 -0
  204. package/src/stories/FileTranscription.stories.tsx +269 -0
  205. package/src/{components/stories → stories}/KeyWordRecognition.stories.tsx +46 -40
  206. package/src/stories/MicrophoneTranscription.stories.tsx +264 -0
  207. package/src/stories/TranscriptionStory.tsx +93 -0
  208. package/src/testing/testing.ts +41 -41
  209. package/src/transcriber/media-stream-recorder.ts +4 -4
  210. package/src/transcriber/transcriber.browser.test.ts +5 -5
  211. package/src/transcriber/transcriber.test.ts +104 -0
  212. package/src/transcriber/transcriber.ts +101 -62
  213. package/src/transcriber/transcription-manager.ts +37 -52
  214. package/src/translations.ts +12 -10
  215. package/src/types/TranscriptOperation.ts +103 -0
  216. package/src/types/TranscriptionCapabilities.ts +39 -0
  217. package/src/types/defs.ts +9 -0
  218. package/src/types/index.ts +4 -2
  219. package/src/util/index.ts +1 -0
  220. package/src/util/render-byline.ts +33 -0
  221. package/dist/lib/browser/TranscriptContainer-H3AZQ4CQ.mjs +0 -11
  222. package/dist/lib/browser/chunk-53AXUEIQ.mjs +0 -764
  223. package/dist/lib/browser/chunk-53AXUEIQ.mjs.map +0 -7
  224. package/dist/lib/browser/chunk-GOF7MJNV.mjs +0 -19
  225. package/dist/lib/browser/chunk-GOF7MJNV.mjs.map +0 -7
  226. package/dist/lib/browser/chunk-IQ5ZRMHZ.mjs.map +0 -7
  227. package/dist/lib/browser/chunk-OSISJM2F.mjs +0 -55
  228. package/dist/lib/browser/chunk-OSISJM2F.mjs.map +0 -7
  229. package/dist/lib/browser/chunk-UDCCT32F.mjs +0 -8
  230. package/dist/lib/browser/chunk-UDCCT32F.mjs.map +0 -7
  231. package/dist/lib/browser/chunk-W2KNYJD6.mjs +0 -16
  232. package/dist/lib/browser/chunk-W2KNYJD6.mjs.map +0 -7
  233. package/dist/lib/browser/index.mjs +0 -125
  234. package/dist/lib/browser/index.mjs.map +0 -7
  235. package/dist/lib/browser/intent-resolver-BGADCHVM.mjs +0 -30
  236. package/dist/lib/browser/intent-resolver-BGADCHVM.mjs.map +0 -7
  237. package/dist/lib/browser/meta.json +0 -1
  238. package/dist/lib/browser/react-surface-HMJS5FSS.mjs +0 -34
  239. package/dist/lib/browser/react-surface-HMJS5FSS.mjs.map +0 -7
  240. package/dist/lib/browser/transcriber-OYPLZFG5.mjs.map +0 -7
  241. package/dist/lib/browser/types/index.mjs +0 -14
  242. package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs +0 -32
  243. package/dist/lib/node/TranscriptContainer-KIG3GMAB.cjs.map +0 -7
  244. package/dist/lib/node/chunk-3PYT3BDM.cjs +0 -40
  245. package/dist/lib/node/chunk-3PYT3BDM.cjs.map +0 -7
  246. package/dist/lib/node/chunk-6LW5RA3K.cjs +0 -75
  247. package/dist/lib/node/chunk-6LW5RA3K.cjs.map +0 -7
  248. package/dist/lib/node/chunk-AFUZI63A.cjs +0 -42
  249. package/dist/lib/node/chunk-AFUZI63A.cjs.map +0 -7
  250. package/dist/lib/node/chunk-CVUN3UO7.cjs +0 -778
  251. package/dist/lib/node/chunk-CVUN3UO7.cjs.map +0 -7
  252. package/dist/lib/node/chunk-FKDJNJ57.cjs +0 -35
  253. package/dist/lib/node/chunk-FKDJNJ57.cjs.map +0 -7
  254. package/dist/lib/node/chunk-ZFAUMZXE.cjs +0 -518
  255. package/dist/lib/node/chunk-ZFAUMZXE.cjs.map +0 -7
  256. package/dist/lib/node/index.cjs +0 -133
  257. package/dist/lib/node/index.cjs.map +0 -7
  258. package/dist/lib/node/intent-resolver-LL3TTI4H.cjs +0 -45
  259. package/dist/lib/node/intent-resolver-LL3TTI4H.cjs.map +0 -7
  260. package/dist/lib/node/meta.json +0 -1
  261. package/dist/lib/node/react-surface-N25TBBG4.cjs +0 -56
  262. package/dist/lib/node/react-surface-N25TBBG4.cjs.map +0 -7
  263. package/dist/lib/node/transcriber-6J4FVFSZ.cjs +0 -68
  264. package/dist/lib/node/transcriber-6J4FVFSZ.cjs.map +0 -7
  265. package/dist/lib/node/types/index.cjs +0 -36
  266. package/dist/lib/node/types/index.cjs.map +0 -7
  267. package/dist/lib/node-esm/TranscriptContainer-G75LDEO5.mjs +0 -12
  268. package/dist/lib/node-esm/chunk-56QHOX4A.mjs +0 -765
  269. package/dist/lib/node-esm/chunk-56QHOX4A.mjs.map +0 -7
  270. package/dist/lib/node-esm/chunk-FH75X4JC.mjs +0 -56
  271. package/dist/lib/node-esm/chunk-FH75X4JC.mjs.map +0 -7
  272. package/dist/lib/node-esm/chunk-MFJO7EKD.mjs +0 -10
  273. package/dist/lib/node-esm/chunk-MFJO7EKD.mjs.map +0 -7
  274. package/dist/lib/node-esm/chunk-MFJPEIVB.mjs +0 -17
  275. package/dist/lib/node-esm/chunk-MFJPEIVB.mjs.map +0 -7
  276. package/dist/lib/node-esm/chunk-PRL64SRU.mjs +0 -496
  277. package/dist/lib/node-esm/chunk-PRL64SRU.mjs.map +0 -7
  278. package/dist/lib/node-esm/chunk-TXMDLLBR.mjs +0 -21
  279. package/dist/lib/node-esm/chunk-TXMDLLBR.mjs.map +0 -7
  280. package/dist/lib/node-esm/index.mjs +0 -126
  281. package/dist/lib/node-esm/index.mjs.map +0 -7
  282. package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs +0 -31
  283. package/dist/lib/node-esm/intent-resolver-5LVCYSJS.mjs.map +0 -7
  284. package/dist/lib/node-esm/meta.json +0 -1
  285. package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs +0 -35
  286. package/dist/lib/node-esm/react-surface-JGQSYGRR.mjs.map +0 -7
  287. package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs +0 -57
  288. package/dist/lib/node-esm/transcriber-TVG2MBBN.mjs.map +0 -7
  289. package/dist/lib/node-esm/types/index.mjs +0 -15
  290. package/dist/types/src/capabilities/capabilities.d.ts +0 -17
  291. package/dist/types/src/capabilities/capabilities.d.ts.map +0 -1
  292. package/dist/types/src/capabilities/intent-resolver.d.ts +0 -4
  293. package/dist/types/src/capabilities/intent-resolver.d.ts.map +0 -1
  294. package/dist/types/src/components/Transcript/Transcript.d.ts +0 -20
  295. package/dist/types/src/components/Transcript/Transcript.d.ts.map +0 -1
  296. package/dist/types/src/components/Transcript/Transcript.stories.d.ts +0 -24
  297. package/dist/types/src/components/Transcript/Transcript.stories.d.ts.map +0 -1
  298. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts +0 -28
  299. package/dist/types/src/components/Transcript/deprecated/OldTranscript.d.ts.map +0 -1
  300. package/dist/types/src/components/Transcript/index.d.ts +0 -2
  301. package/dist/types/src/components/Transcript/index.d.ts.map +0 -1
  302. package/dist/types/src/components/Transcript/transcript-extension.d.ts +0 -19
  303. package/dist/types/src/components/Transcript/transcript-extension.d.ts.map +0 -1
  304. package/dist/types/src/components/TranscriptContainer.d.ts +0 -8
  305. package/dist/types/src/components/TranscriptContainer.d.ts.map +0 -1
  306. package/dist/types/src/components/stories/FileTranscription.stories.d.ts +0 -17
  307. package/dist/types/src/components/stories/FileTranscription.stories.d.ts.map +0 -1
  308. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts +0 -10
  309. package/dist/types/src/components/stories/KeyWordRecognition.stories.d.ts.map +0 -1
  310. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts +0 -19
  311. package/dist/types/src/components/stories/MicrophoneTranscription.stories.d.ts.map +0 -1
  312. package/dist/types/src/components/stories/TranscriptionStory.d.ts +0 -11
  313. package/dist/types/src/components/stories/TranscriptionStory.d.ts.map +0 -1
  314. package/dist/types/src/components/stories/useIsSpeaking.d.ts.map +0 -1
  315. package/dist/types/src/segments-normalization/index.d.ts.map +0 -1
  316. package/dist/types/src/segments-normalization/message-normalizer.d.ts.map +0 -1
  317. package/dist/types/src/segments-normalization/normalization.d.ts +0 -329
  318. package/dist/types/src/segments-normalization/normalization.d.ts.map +0 -1
  319. package/dist/types/src/segments-normalization/normalization.test.d.ts.map +0 -1
  320. package/dist/types/src/segments-normalization/utils.d.ts +0 -3
  321. package/dist/types/src/segments-normalization/utils.d.ts.map +0 -1
  322. package/dist/types/src/types/schema.d.ts +0 -41
  323. package/dist/types/src/types/schema.d.ts.map +0 -1
  324. package/dist/types/src/types/types.d.ts +0 -31
  325. package/dist/types/src/types/types.d.ts.map +0 -1
  326. package/src/capabilities/capabilities.ts +0 -33
  327. package/src/capabilities/intent-resolver.ts +0 -24
  328. package/src/components/Transcript/Transcript.tsx +0 -100
  329. package/src/components/Transcript/deprecated/OldTranscript.tsx +0 -260
  330. package/src/components/TranscriptContainer.tsx +0 -30
  331. package/src/components/stories/FileTranscription.stories.tsx +0 -242
  332. package/src/components/stories/MicrophoneTranscription.stories.tsx +0 -280
  333. package/src/components/stories/TranscriptionStory.tsx +0 -41
  334. package/src/segments-normalization/normalization.ts +0 -105
  335. package/src/types/schema.ts +0 -41
  336. package/src/types/types.ts +0 -32
  337. package/dist/lib/{browser/types → neutral/blueprints}/index.mjs.map +0 -0
  338. package/dist/lib/{browser/TranscriptContainer-H3AZQ4CQ.mjs.map → neutral/chunk-J5LGTIGS.mjs.map} +0 -0
  339. package/dist/lib/{node-esm/types → neutral/hooks}/index.mjs.map +0 -0
  340. package/dist/lib/{node-esm/TranscriptContainer-G75LDEO5.mjs.map → neutral/index.mjs.map} +0 -0
  341. package/dist/types/src/{segments-normalization → normalization}/normalization.test.d.ts +0 -0
  342. package/dist/types/src/{components/stories → stories}/useIsSpeaking.d.ts +0 -0
  343. package/src/{segments-normalization → normalization}/index.ts +1 -1
  344. /package/src/{components/stories → stories}/useIsSpeaking.tsx +0 -0
@@ -0,0 +1,76 @@
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 { Operation } from '@dxos/compute';
9
+ import { log } from '@dxos/log';
10
+ import { trim } from '@dxos/util';
11
+
12
+ import { TranscriptOperation } from '../types';
13
+
14
+ type MessageWithRangeIdType = TranscriptOperation.MessageWithRangeIdType;
15
+ type SentenceNormalizationInputType = TranscriptOperation.SentenceNormalizationInputType;
16
+ const { SentenceNormalization, SentenceNormalizationOutput } = TranscriptOperation;
17
+
18
+ export type MessageWithRangeId = MessageWithRangeIdType;
19
+
20
+ /** @deprecated Use SentenceNormalizationInputType */
21
+ export type NormalizationInput = SentenceNormalizationInputType;
22
+
23
+ /** @deprecated Use SentenceNormalizationOutput */
24
+ export type NormalizationOutput = Schema.Schema.Type<typeof SentenceNormalizationOutput>;
25
+
26
+ /**
27
+ * Sentence normalization for transcription.
28
+ * TODO(dmaretskyi): Reimplement using AiRequest.run or LanguageModel.generateObject - runStructured was removed.
29
+ */
30
+ export const sentenceNormalization = SentenceNormalization.pipe(
31
+ Operation.withHandler(
32
+ Effect.fn(function* ({ messages }) {
33
+ log.info('input', { messages });
34
+ // TODO(dmaretskyi): runStructured was removed from AiRequest. Reimplement using new API.
35
+ return yield* Effect.die(
36
+ new Error(
37
+ 'Sentence normalization needs to be reimplemented - runStructured was removed from AiRequest. Use AiRequest.run or LanguageModel.generateObject.',
38
+ ),
39
+ );
40
+ }),
41
+ ),
42
+ );
43
+
44
+ const _unused = trim`
45
+ You are observing a real-time transcript of a single person speaking.
46
+ The transcription is delivered in chunks of 10 seconds or less. As a result, individual sentences may be split across multiple messages, or multiple sentences may appear within a single message. Additionally, because this is real-time transcription, punctuation and capitalization may be incorrect or missing.
47
+
48
+ # Task Description:
49
+ - Your task is to detect and reconstruct broken or incomplete sentences by merging segments into coherent, grammatically correct sentences where appropriate.
50
+
51
+ # Input Format:
52
+ - The input is an array of messages that contain transcription blocks.
53
+ - Each message is a Message.Message, as described in the output format.
54
+
55
+ # Output Format:
56
+ - You have been provided with the tool that defines the output format; make sure to query it.
57
+ - Do not output anything other than the expected format.
58
+
59
+ # Segment Handling Rules:
60
+ - Sort messages by timestamp.
61
+ - Leave ID of the first message in a sentence.
62
+ - Each divided sentence should be added to the output as a separate message or block within existing messages, preserving the original order.
63
+ - If one message contains multiple sentences, you should not split them.
64
+ - The last sentence may be incomplete; it should still be output as a separate block or message.
65
+ - Keep track of the original timestamps of the messages and blocks and, use the timestamp of the first message/block of a sentence as the 'started' field of the merged message.
66
+ - The 'rangeId' field of the merged message should include 'messageId'-s and 'rangeId'-s of all messages that have been used to construct this message.
67
+
68
+ # Punctuation and Capitalization:
69
+ - Do not rely on the original punctuation and capitalization—they may be incorrect.
70
+ - Use logical reasoning to apply appropriate punctuation (e.g., period, comma, question mark, exclamation mark) and capitalization.
71
+
72
+ # Restrictions:
73
+ - Do not alter the order of the original messages; maintain the natural flow of speech.
74
+ - Do not interpret or infer meaning beyond reconstructing sentences.
75
+ - Do not add or remove any words or phrases.
76
+ `;
@@ -2,8 +2,8 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import { type DataType } from '@dxos/schema';
5
+ import { type Actor } from '@dxos/types';
6
6
 
7
- export const getActorId = (actor: DataType.Actor) => {
7
+ export const getActorId = (actor: Actor.Actor) => {
8
8
  return actor.identityDid || actor.identityKey || actor.email || actor.name || '';
9
9
  };
@@ -0,0 +1,24 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Operation } from '@dxos/compute';
8
+ import { Feed, Ref } from '@dxos/echo';
9
+ import { Transcript } from '@dxos/types';
10
+
11
+ import { TranscriptOperation } from '../types';
12
+
13
+ const handler: Operation.WithHandler<typeof TranscriptOperation.Create> = TranscriptOperation.Create.pipe(
14
+ Operation.withHandler(
15
+ Effect.fn(function* ({ space }) {
16
+ const feed = space.db.add(Feed.make());
17
+ return {
18
+ object: Transcript.make(Ref.make(feed)),
19
+ };
20
+ }),
21
+ ),
22
+ );
23
+
24
+ export default handler;
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { OperationHandlerSet } from '@dxos/compute';
6
+
7
+ export const TranscriptionOperationHandlerSet = OperationHandlerSet.lazy(
8
+ () => import('./create'),
9
+ () => import('./open'),
10
+ () => import('./summarize'),
11
+ );
@@ -0,0 +1,28 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import * as Effect from 'effect/Effect';
6
+
7
+ import { Operation } from '@dxos/compute';
8
+ import { Database, Feed, Filter } from '@dxos/echo';
9
+ import { Message } from '@dxos/types';
10
+
11
+ import { TranscriptOperation } from '../types';
12
+ import { renderByline } from '../util';
13
+
14
+ const handler: Operation.WithHandler<typeof TranscriptOperation.Open> = TranscriptOperation.Open.pipe(
15
+ Operation.withHandler(
16
+ Effect.fn(function* ({ transcript }) {
17
+ const transcriptObj = yield* Database.load(transcript);
18
+ const feed = yield* Database.load(transcriptObj.feed);
19
+ const messages = yield* Feed.runQuery(feed, Filter.type(Message.Message));
20
+ const content = messages
21
+ .flatMap((message: Message.Message, index: number) => renderByline([])(message, index))
22
+ .join('\n\n');
23
+ return { content };
24
+ }),
25
+ ),
26
+ );
27
+
28
+ export default handler;
@@ -0,0 +1,101 @@
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
+
11
+ import { AiService, ConsolePrinter, ToolExecutionService, ToolResolverService } from '@dxos/ai';
12
+ import { AiRequest, GenerationObserver } from '@dxos/assistant';
13
+ import { Trace, Operation, OperationRegistry } from '@dxos/compute';
14
+ import { Database } from '@dxos/echo';
15
+ import { trim } from '@dxos/util';
16
+
17
+ import { TranscriptOperation } from '../types';
18
+
19
+ /**
20
+ * Summarize a transcript of a meeting.
21
+ */
22
+ const handler: Operation.WithHandler<typeof TranscriptOperation.Summarize> = TranscriptOperation.Summarize.pipe(
23
+ Operation.withHandler(
24
+ Effect.fnUntraced(
25
+ function* ({ transcript, notes }) {
26
+ const result = yield* new AiRequest({
27
+ observer: GenerationObserver.fromPrinter(new ConsolePrinter({ tag: 'summarize' })),
28
+ }).run({
29
+ prompt: `Transcript: ${transcript}\n\nNotes: ${notes}`,
30
+ history: [],
31
+ system: systemPrompt,
32
+ });
33
+
34
+ const summary = Function.pipe(
35
+ result,
36
+ Array.findLast((msg) => msg.sender.role === 'assistant' && msg.blocks.some((block) => block._tag === 'text')),
37
+ Option.flatMap((msg) =>
38
+ Function.pipe(
39
+ msg.blocks,
40
+ Array.findLast((block) => block._tag === 'text'),
41
+ Option.map((block) => block.text),
42
+ ),
43
+ ),
44
+ Option.getOrThrowWith(() => new Error('No summary found')),
45
+ );
46
+
47
+ return { summary };
48
+ },
49
+ Effect.provide(
50
+ Layer.mergeAll(
51
+ AiService.model('@anthropic/claude-sonnet-4-0'),
52
+ ToolResolverService.layerEmpty,
53
+ ToolExecutionService.layerEmpty,
54
+ Trace.writerLayerNoop,
55
+ Database.notAvailable,
56
+ Layer.succeed(Operation.Service, {
57
+ invoke: () => Effect.die('Not available.'),
58
+ schedule: () => Effect.die('Not available.'),
59
+ invokePromise: async () => ({ error: new Error('Not available.') }),
60
+ } as any),
61
+ Layer.succeed(OperationRegistry.Service, { resolve: () => Effect.succeed(undefined) } as any),
62
+ ),
63
+ ),
64
+ ),
65
+ ),
66
+ );
67
+
68
+ export default handler;
69
+
70
+ const systemPrompt = trim`
71
+ You are a helpful assistant that summarizes transcripts of meetings.
72
+
73
+ # Goal
74
+ Create a markdown summary of the meeting transcript with text notes provided.
75
+ Notes are very important so make sure to include them in the summary if they contain meaningful information.
76
+
77
+ # Formatting
78
+ - Format the summary as a markdown document without extra comments like "Here is the summary of the transcript:".
79
+ - Use markdown formatting for headings and bullet points.
80
+ - Format the summary as a list of key points and takeaways.
81
+ - All names of people should be in bold.
82
+
83
+ # Note Taking
84
+ - Correlate items in the summary with the person of origin to build a coherent narrative.
85
+ - Include short quotes verbatim where appropriate. Especially when concerned with design decisions and problem descriptions.
86
+
87
+ # Tasks
88
+ At the end of the summary include tasks.
89
+ Extract only the tasks that are:
90
+ - Directly actionable.
91
+ - Clearly assigned to a person or team (or can easily be inferred).
92
+ - Strongly implied by the conversation and/or user note (no speculative tasks).
93
+ - Specific enough that someone reading them would know exactly what to do next.
94
+
95
+ Format all tasks as markdown checkboxes using the syntax:
96
+ - [ ] Task description.
97
+
98
+ Additional information can be included (indented).
99
+
100
+ If no actionable tasks are found, omit this tasks section.
101
+ `;
package/src/plugin.ts ADDED
@@ -0,0 +1,11 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { Plugin } from '@dxos/app-framework';
6
+
7
+ import { meta } from './meta';
8
+
9
+ export const TranscriptionPlugin = Plugin.lazy(meta, () => import('#plugin'));
10
+
11
+ export { TranscriptionOperationHandlerSet } from './operations';
@@ -0,0 +1,269 @@
1
+ //
2
+ // Copyright 2025 DXOS.org
3
+ //
4
+
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
6
+ import * as Effect from 'effect/Effect';
7
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
8
+
9
+ import { withPluginManager } from '@dxos/app-framework/testing';
10
+ import { AppActivationEvents } from '@dxos/app-toolkit';
11
+ import { scheduleTask } from '@dxos/async';
12
+ import { Context } from '@dxos/context';
13
+ import { Obj } from '@dxos/echo';
14
+ import { MemoryQueue } from '@dxos/echo-db';
15
+ import { createQueueDXN } from '@dxos/echo/internal';
16
+ import { FunctionExecutor, ServiceContainer } from '@dxos/functions-runtime';
17
+ import { log } from '@dxos/log';
18
+ import { ClientPlugin } from '@dxos/plugin-client/plugin';
19
+ import { initializeIdentity } from '@dxos/plugin-client/testing';
20
+ import { PreviewPlugin } from '@dxos/plugin-preview/testing';
21
+ import { StorybookPlugin, corePlugins } from '@dxos/plugin-testing';
22
+ import { withLayout } from '@dxos/react-ui/testing';
23
+ import { TestSchema } from '@dxos/schema/testing';
24
+ import { type Actor, Message, Organization, Person } from '@dxos/types';
25
+ import { seedTestData } from '@dxos/types/testing';
26
+
27
+ import { useAudioFile, useQueueModelAdapter, useTranscriber } from '#hooks';
28
+ import { TestItem } from '#testing';
29
+
30
+ import { MessageNormalizer, getActorId } from '../normalization';
31
+ import { type MediaStreamRecorderProps, type TranscriberProps } from '../transcriber';
32
+ import { TranscriptionPlugin } from '../TranscriptionPlugin';
33
+ import { renderByline } from '../util';
34
+ import { TranscriptionStory } from './TranscriptionStory';
35
+ import { useIsSpeaking } from './useIsSpeaking';
36
+
37
+ const AudioFile = ({
38
+ detectSpeaking,
39
+ audioUrl,
40
+ normalizeSentences,
41
+ transcriberConfig,
42
+ recorderConfig,
43
+ audioConstraints,
44
+ }: {
45
+ detectSpeaking?: boolean;
46
+ normalizeSentences?: boolean;
47
+ audioUrl: string;
48
+ transcriberConfig?: TranscriberProps['config'];
49
+ recorderConfig?: MediaStreamRecorderProps['config'];
50
+ audioConstraints?: MediaTrackConstraints;
51
+ }) => {
52
+ const [running, setRunning] = useState(false);
53
+ const actor: Actor.Actor = useMemo(() => ({ name: 'You' }), []);
54
+
55
+ // Optional uploaded file overrides the default URL.
56
+ // The useEffect below revokes the previous URL whenever it changes (and on unmount).
57
+ const [uploadedUrl, setUploadedUrl] = useState<string>();
58
+ useEffect(() => {
59
+ return () => {
60
+ if (uploadedUrl) {
61
+ URL.revokeObjectURL(uploadedUrl);
62
+ }
63
+ };
64
+ }, [uploadedUrl]);
65
+
66
+ const handleUpload = useCallback((file: File) => {
67
+ setRunning(false);
68
+ setUploadedUrl(URL.createObjectURL(file));
69
+ }, []);
70
+
71
+ const sourceUrl = uploadedUrl ?? audioUrl;
72
+
73
+ // Audio.
74
+ const { audio, track, stream } = useAudioFile(sourceUrl, audioConstraints);
75
+
76
+ // Speaking.
77
+ const isSpeaking = detectSpeaking ? useIsSpeaking(track) : true;
78
+ const ref = useRef<HTMLAudioElement>(null);
79
+ useEffect(() => {
80
+ if (ref.current && stream) {
81
+ ref.current.srcObject = stream;
82
+ }
83
+ }, [stream]);
84
+
85
+ useEffect(() => {
86
+ if (!audio) {
87
+ return;
88
+ }
89
+
90
+ if (running) {
91
+ void audio.play();
92
+ } else {
93
+ void audio.pause();
94
+ }
95
+ }, [audio, running]);
96
+
97
+ // Transcriber.
98
+ // TODO(dmaretskyi): Use space.queues.create() instead.
99
+ const queueDxn = useMemo(() => createQueueDXN(), []);
100
+ const queue = useMemo(() => new MemoryQueue<Message.Message>(queueDxn), [queueDxn]);
101
+
102
+ const model = useQueueModelAdapter(renderByline([]), queue);
103
+ const handleSegments = useCallback<TranscriberProps['onSegments']>(
104
+ async (blocks) => {
105
+ void queue?.append([
106
+ Obj.make(Message.Message, {
107
+ created: new Date().toISOString(),
108
+ sender: actor,
109
+ blocks,
110
+ }),
111
+ ]);
112
+ },
113
+ [queue],
114
+ );
115
+
116
+ const transcriber = useTranscriber({
117
+ audioStreamTrack: track,
118
+ onSegments: handleSegments,
119
+ transcriberConfig,
120
+ recorderConfig,
121
+ });
122
+
123
+ // Normalize sentences.
124
+ const normalizer = useMemo(() => {
125
+ if (!normalizeSentences) {
126
+ return;
127
+ }
128
+ const executor = new FunctionExecutor(
129
+ new ServiceContainer().setServices({
130
+ // ai: {
131
+ // client: new Edge AiServiceClient({
132
+ // endpoint: AI_SERVICE_ENDPOINT.REMOTE,
133
+ // defaultGenerationOptions: {
134
+ // model: '@anthropic/claude-3-5-sonnet-20241022',
135
+ // },
136
+ // }),
137
+ // },
138
+ }),
139
+ );
140
+
141
+ return new MessageNormalizer({
142
+ functionExecutor: executor,
143
+ queue,
144
+ startingCursor: { actorId: getActorId(actor), timestamp: new Date().toISOString() },
145
+ });
146
+ }, [normalizeSentences, queue, actor]);
147
+
148
+ useEffect(() => {
149
+ if (!normalizer) {
150
+ return;
151
+ }
152
+ const ctx = new Context();
153
+ scheduleTask(ctx, async () => {
154
+ await normalizer.open();
155
+ ctx.onDispose(async () => {
156
+ await normalizer.close();
157
+ });
158
+ });
159
+ return () => {
160
+ void ctx.dispose();
161
+ };
162
+ }, [normalizer]);
163
+
164
+ const manageChunkRecording = () => {
165
+ if (running && isSpeaking && transcriber) {
166
+ log.info('starting transcription');
167
+ transcriber?.startChunksRecording();
168
+ } else if ((!isSpeaking || !running) && transcriber) {
169
+ log.info('stopping transcription');
170
+ transcriber?.stopChunksRecording();
171
+ }
172
+ };
173
+
174
+ useEffect(() => {
175
+ const ctx = new Context();
176
+ scheduleTask(ctx, async () => {
177
+ if (transcriber && running) {
178
+ await transcriber.open();
179
+ } else if (!running) {
180
+ await transcriber?.close();
181
+ }
182
+ manageChunkRecording();
183
+ });
184
+
185
+ return () => {
186
+ void ctx.dispose();
187
+ };
188
+ }, [transcriber, running]);
189
+
190
+ useEffect(() => {
191
+ manageChunkRecording();
192
+ }, [isSpeaking, stream]);
193
+
194
+ return (
195
+ <TranscriptionStory
196
+ disabled={!stream}
197
+ model={model}
198
+ running={running}
199
+ onRunningChange={setRunning}
200
+ audioRef={ref}
201
+ onUpload={handleUpload}
202
+ />
203
+ );
204
+ };
205
+
206
+ const meta = {
207
+ title: 'plugins/plugin-transcription/components/FileTranscription',
208
+ decorators: [
209
+ withLayout({ layout: 'column' }),
210
+ withPluginManager({
211
+ plugins: [
212
+ ...corePlugins(),
213
+ StorybookPlugin({}),
214
+ ClientPlugin({
215
+ types: [TestItem, Person.Person, Organization.Organization, TestSchema.DocumentType],
216
+ onClientInitialized: ({ client }) =>
217
+ Effect.gen(function* () {
218
+ const { personalSpace } = yield* initializeIdentity(client);
219
+ yield* Effect.promise(() => seedTestData(personalSpace));
220
+ }),
221
+ }),
222
+
223
+ PreviewPlugin(),
224
+ TranscriptionPlugin(),
225
+ ],
226
+ fireEvents: [AppActivationEvents.SetupAppGraph],
227
+ }),
228
+ ],
229
+ } satisfies Meta;
230
+
231
+ export default meta;
232
+
233
+ type Story = StoryObj<typeof meta>;
234
+
235
+ const TRANSCRIBER_CONFIG = {
236
+ transcribeAfterChunksAmount: 100,
237
+ prefixBufferChunksAmount: 50,
238
+ normalizeSentences: true,
239
+ };
240
+
241
+ const RECORDER_CONFIG = {
242
+ interval: 200,
243
+ };
244
+
245
+ export const Default: StoryObj<typeof AudioFile> = {
246
+ render: AudioFile,
247
+ args: {
248
+ detectSpeaking: true,
249
+ // https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
250
+ audioUrl: 'https://dxos.network/audio-london.m4a',
251
+ // textUrl: 'https://dxos.network/audio-london.txt',
252
+ transcriberConfig: TRANSCRIBER_CONFIG,
253
+ recorderConfig: RECORDER_CONFIG,
254
+ },
255
+ };
256
+
257
+ // TODO(mykola): Fix sentence normalization.
258
+ // export const WithSentenceNormalization: StoryObj<typeof AudioFile> = {
259
+ // render: AudioFile,
260
+ // args: {
261
+ // detectSpeaking: true,
262
+ // normalizeSentences: true,
263
+ // // https://learnenglish.britishcouncil.org/general-english/audio-zone/living-london
264
+ // audioUrl: 'https://dxos.network/audio-london.m4a',
265
+ // // textUrl: 'https://dxos.network/audio-london.txt',
266
+ // transcriberConfig: TRANSCRIBER_CONFIG,
267
+ // recorderConfig: RECORDER_CONFIG,
268
+ // },
269
+ // };
@@ -2,22 +2,24 @@
2
2
  // Copyright 2025 DXOS.org
3
3
  //
4
4
 
5
- import '@dxos-theme';
6
-
7
- import { type StoryObj, type Meta } from '@storybook/react';
5
+ import { type Meta, type StoryObj } from '@storybook/react-vite';
8
6
  import React, { useEffect, useMemo, useState } from 'react';
9
7
 
10
8
  import { log } from '@dxos/log';
11
- import { Toolbar } from '@dxos/react-ui';
12
- import { mx } from '@dxos/react-ui-theme';
13
- import { withLayout, withTheme } from '@dxos/storybook-utils';
9
+ import { Panel, Toolbar } from '@dxos/react-ui';
10
+ import { withLayout, withTheme } from '@dxos/react-ui/testing';
11
+ import { mx } from '@dxos/ui-theme';
14
12
 
15
13
  type Word = {
16
14
  text: string;
17
15
  matched: boolean;
18
16
  };
19
17
 
20
- const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
18
+ type DefaultStoryProps = {
19
+ keywords: string[];
20
+ };
21
+
22
+ const DefaultStory = ({ keywords }: DefaultStoryProps) => {
21
23
  const [running, setRunning] = useState(false);
22
24
  const [matchingWords, setMatchingWords] = useState<Word[]>(keywords.map((word) => ({ text: word, matched: false })));
23
25
 
@@ -84,45 +86,49 @@ const SpeechRecognition = ({ keywords }: { keywords: string[] }) => {
84
86
  }, [running, recognition]);
85
87
 
86
88
  return (
87
- <div className={mx('flex flex-col gap-2 w-[30rem]')}>
88
- <Toolbar.Root>
89
- <Toolbar.IconButton
90
- iconOnly
91
- icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
92
- label={running ? 'Pause' : 'Play'}
93
- onClick={() => setRunning((running) => !running)}
94
- />
95
- </Toolbar.Root>
96
-
97
- <div className='flex flex-wrap'>
98
- {matchingWords.map((word, index) => (
99
- <span
100
- key={index}
101
- className={mx(
102
- 'px-3 py-1 m-2 rounded border',
103
- word.matched ? 'bg-red-200 text-red-800 border-red-300' : 'bg-gray-200 text-gray-600 border-gray-300',
104
- )}
105
- >
106
- {word.text}
107
- </span>
108
- ))}
109
- </div>
110
-
111
- <span>{transcript || (running ? 'Listening...' : 'Click play to start speech recognition')}</span>
112
- </div>
89
+ <Panel.Root>
90
+ <Panel.Toolbar asChild>
91
+ <Toolbar.Root>
92
+ <Toolbar.IconButton
93
+ iconOnly
94
+ icon={running ? 'ph--pause--regular' : 'ph--play--regular'}
95
+ label={running ? 'Pause' : 'Play'}
96
+ onClick={() => setRunning((running) => !running)}
97
+ />
98
+ </Toolbar.Root>
99
+ </Panel.Toolbar>
100
+
101
+ <Panel.Content>
102
+ <div className='p-4 grid grid-cols-[repeat(auto-fill,minmax(6rem,1fr))] gap-2'>
103
+ {matchingWords.map((word, index) => (
104
+ <span
105
+ key={index}
106
+ className={mx(
107
+ 'grid place-items-center p-2 aspect-square rounded-sm border border-separator',
108
+ word.matched && 'border-red-300',
109
+ )}
110
+ >
111
+ {word.text}
112
+ </span>
113
+ ))}
114
+ </div>
115
+ </Panel.Content>
116
+ </Panel.Root>
113
117
  );
114
118
  };
115
119
 
116
- const meta: Meta<typeof SpeechRecognition> = {
117
- title: 'plugins/plugin-transcription/KeyWordDetection',
118
- decorators: [withTheme, withLayout({ fullscreen: true, classNames: 'justify-center' })],
119
- };
120
+ const meta = {
121
+ title: 'plugins/plugin-transcription/components/KeyWordDetection',
122
+ render: DefaultStory,
123
+ decorators: [withTheme(), withLayout({ layout: 'column' })],
124
+ } satisfies Meta<typeof DefaultStory>;
120
125
 
121
126
  export default meta;
122
127
 
123
- export const SpeechRecognitionAPI: StoryObj<typeof SpeechRecognition> = {
124
- render: SpeechRecognition,
128
+ type Story = StoryObj<typeof meta>;
129
+
130
+ export const SpeechRecognitionAPI: Story = {
125
131
  args: {
126
- keywords: ['kai', 'computer', 'hello'],
132
+ keywords: ['kai', 'computer', 'hello', 'dxos'],
127
133
  },
128
134
  };