tjbot-ce 3.0.1

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 (224) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +382 -0
  3. package/dist/camera/camera.d.ts +62 -0
  4. package/dist/camera/camera.d.ts.map +1 -0
  5. package/dist/camera/camera.js +155 -0
  6. package/dist/camera/camera.js.map +1 -0
  7. package/dist/camera/index.d.ts +18 -0
  8. package/dist/camera/index.d.ts.map +1 -0
  9. package/dist/camera/index.js +18 -0
  10. package/dist/camera/index.js.map +1 -0
  11. package/dist/config/config-types.d.ts +75 -0
  12. package/dist/config/config-types.d.ts.map +1 -0
  13. package/dist/config/config-types.generated.d.ts +495 -0
  14. package/dist/config/config-types.generated.d.ts.map +1 -0
  15. package/dist/config/config-types.generated.js +2 -0
  16. package/dist/config/config-types.generated.js.map +1 -0
  17. package/dist/config/config-types.js +175 -0
  18. package/dist/config/config-types.js.map +1 -0
  19. package/dist/config/index.d.ts +20 -0
  20. package/dist/config/index.d.ts.map +1 -0
  21. package/dist/config/index.js +19 -0
  22. package/dist/config/index.js.map +1 -0
  23. package/dist/config/tjbot-config.d.ts +98 -0
  24. package/dist/config/tjbot-config.d.ts.map +1 -0
  25. package/dist/config/tjbot-config.js +309 -0
  26. package/dist/config/tjbot-config.js.map +1 -0
  27. package/dist/config/vendor/colors.yaml +61 -0
  28. package/dist/config/vendor/model-registry.yaml +275 -0
  29. package/dist/config/vendor/tjbot-config.schema.yaml +792 -0
  30. package/dist/config/vendor/tjbot.default.toml +452 -0
  31. package/dist/led/index.d.ts +20 -0
  32. package/dist/led/index.d.ts.map +1 -0
  33. package/dist/led/index.js +20 -0
  34. package/dist/led/index.js.map +1 -0
  35. package/dist/led/led-common-anode.d.ts +38 -0
  36. package/dist/led/led-common-anode.d.ts.map +1 -0
  37. package/dist/led/led-common-anode.js +79 -0
  38. package/dist/led/led-common-anode.js.map +1 -0
  39. package/dist/led/led-neopixel-spi.d.ts +60 -0
  40. package/dist/led/led-neopixel-spi.d.ts.map +1 -0
  41. package/dist/led/led-neopixel-spi.js +216 -0
  42. package/dist/led/led-neopixel-spi.js.map +1 -0
  43. package/dist/led/led-neopixel-ws281x.js +186 -0
  44. package/dist/led/led-neopixel.d.ts +57 -0
  45. package/dist/led/led-neopixel.d.ts.map +1 -0
  46. package/dist/led/led-neopixel.js +235 -0
  47. package/dist/led/led-neopixel.js.map +1 -0
  48. package/dist/microphone/index.d.ts +18 -0
  49. package/dist/microphone/index.d.ts.map +1 -0
  50. package/dist/microphone/index.js +18 -0
  51. package/dist/microphone/index.js.map +1 -0
  52. package/dist/microphone/microphone.d.ts +65 -0
  53. package/dist/microphone/microphone.d.ts.map +1 -0
  54. package/dist/microphone/microphone.js +179 -0
  55. package/dist/microphone/microphone.js.map +1 -0
  56. package/dist/rpi-drivers/index.d.ts +22 -0
  57. package/dist/rpi-drivers/index.d.ts.map +1 -0
  58. package/dist/rpi-drivers/index.js +22 -0
  59. package/dist/rpi-drivers/index.js.map +1 -0
  60. package/dist/rpi-drivers/rpi-detect.d.ts +24 -0
  61. package/dist/rpi-drivers/rpi-detect.d.ts.map +1 -0
  62. package/dist/rpi-drivers/rpi-detect.js +49 -0
  63. package/dist/rpi-drivers/rpi-detect.js.map +1 -0
  64. package/dist/rpi-drivers/rpi-driver.d.ts +116 -0
  65. package/dist/rpi-drivers/rpi-driver.d.ts.map +1 -0
  66. package/dist/rpi-drivers/rpi-driver.js +261 -0
  67. package/dist/rpi-drivers/rpi-driver.js.map +1 -0
  68. package/dist/rpi-drivers/rpi3-driver.d.ts +47 -0
  69. package/dist/rpi-drivers/rpi3-driver.d.ts.map +1 -0
  70. package/dist/rpi-drivers/rpi3-driver.js +145 -0
  71. package/dist/rpi-drivers/rpi3-driver.js.map +1 -0
  72. package/dist/rpi-drivers/rpi4-driver.d.ts +35 -0
  73. package/dist/rpi-drivers/rpi4-driver.d.ts.map +1 -0
  74. package/dist/rpi-drivers/rpi4-driver.js +101 -0
  75. package/dist/rpi-drivers/rpi4-driver.js.map +1 -0
  76. package/dist/rpi-drivers/rpi5-driver.d.ts +33 -0
  77. package/dist/rpi-drivers/rpi5-driver.d.ts.map +1 -0
  78. package/dist/rpi-drivers/rpi5-driver.js +78 -0
  79. package/dist/rpi-drivers/rpi5-driver.js.map +1 -0
  80. package/dist/servo/index.d.ts +19 -0
  81. package/dist/servo/index.d.ts.map +1 -0
  82. package/dist/servo/index.js +19 -0
  83. package/dist/servo/index.js.map +1 -0
  84. package/dist/servo/servo-constants.d.ts +33 -0
  85. package/dist/servo/servo-constants.d.ts.map +1 -0
  86. package/dist/servo/servo-constants.js +34 -0
  87. package/dist/servo/servo-constants.js.map +1 -0
  88. package/dist/servo/servo-lgpio.d.ts +82 -0
  89. package/dist/servo/servo-lgpio.d.ts.map +1 -0
  90. package/dist/servo/servo-lgpio.js +178 -0
  91. package/dist/servo/servo-lgpio.js.map +1 -0
  92. package/dist/speaker/audio-player.d.ts +30 -0
  93. package/dist/speaker/audio-player.d.ts.map +1 -0
  94. package/dist/speaker/audio-player.js +68 -0
  95. package/dist/speaker/audio-player.js.map +1 -0
  96. package/dist/speaker/index.d.ts +18 -0
  97. package/dist/speaker/index.d.ts.map +1 -0
  98. package/dist/speaker/index.js +18 -0
  99. package/dist/speaker/index.js.map +1 -0
  100. package/dist/speaker/speaker.d.ts +53 -0
  101. package/dist/speaker/speaker.d.ts.map +1 -0
  102. package/dist/speaker/speaker.js +125 -0
  103. package/dist/speaker/speaker.js.map +1 -0
  104. package/dist/stt/backends/azure-stt.d.ts +32 -0
  105. package/dist/stt/backends/azure-stt.d.ts.map +1 -0
  106. package/dist/stt/backends/azure-stt.js +227 -0
  107. package/dist/stt/backends/azure-stt.js.map +1 -0
  108. package/dist/stt/backends/google-cloud-stt.d.ts +31 -0
  109. package/dist/stt/backends/google-cloud-stt.d.ts.map +1 -0
  110. package/dist/stt/backends/google-cloud-stt.js +371 -0
  111. package/dist/stt/backends/google-cloud-stt.js.map +1 -0
  112. package/dist/stt/backends/ibm-watson-stt.d.ts +32 -0
  113. package/dist/stt/backends/ibm-watson-stt.d.ts.map +1 -0
  114. package/dist/stt/backends/ibm-watson-stt.js +190 -0
  115. package/dist/stt/backends/ibm-watson-stt.js.map +1 -0
  116. package/dist/stt/backends/sherpa-onnx-stt.d.ts +117 -0
  117. package/dist/stt/backends/sherpa-onnx-stt.d.ts.map +1 -0
  118. package/dist/stt/backends/sherpa-onnx-stt.js +694 -0
  119. package/dist/stt/backends/sherpa-onnx-stt.js.map +1 -0
  120. package/dist/stt/index.d.ts +20 -0
  121. package/dist/stt/index.d.ts.map +1 -0
  122. package/dist/stt/index.js +21 -0
  123. package/dist/stt/index.js.map +1 -0
  124. package/dist/stt/stt-engine.d.ts +68 -0
  125. package/dist/stt/stt-engine.d.ts.map +1 -0
  126. package/dist/stt/stt-engine.js +99 -0
  127. package/dist/stt/stt-engine.js.map +1 -0
  128. package/dist/stt/stt-utils.d.ts +36 -0
  129. package/dist/stt/stt-utils.d.ts.map +1 -0
  130. package/dist/stt/stt-utils.js +112 -0
  131. package/dist/stt/stt-utils.js.map +1 -0
  132. package/dist/stt/stt.d.ts +52 -0
  133. package/dist/stt/stt.d.ts.map +1 -0
  134. package/dist/stt/stt.js +100 -0
  135. package/dist/stt/stt.js.map +1 -0
  136. package/dist/tjbot.d.ts +317 -0
  137. package/dist/tjbot.d.ts.map +1 -0
  138. package/dist/tjbot.js +736 -0
  139. package/dist/tjbot.js.map +1 -0
  140. package/dist/tts/backends/azure-tts.d.ts +30 -0
  141. package/dist/tts/backends/azure-tts.d.ts.map +1 -0
  142. package/dist/tts/backends/azure-tts.js +92 -0
  143. package/dist/tts/backends/azure-tts.js.map +1 -0
  144. package/dist/tts/backends/google-cloud-tts.d.ts +38 -0
  145. package/dist/tts/backends/google-cloud-tts.d.ts.map +1 -0
  146. package/dist/tts/backends/google-cloud-tts.js +116 -0
  147. package/dist/tts/backends/google-cloud-tts.js.map +1 -0
  148. package/dist/tts/backends/ibm-watson-tts.d.ts +42 -0
  149. package/dist/tts/backends/ibm-watson-tts.d.ts.map +1 -0
  150. package/dist/tts/backends/ibm-watson-tts.js +99 -0
  151. package/dist/tts/backends/ibm-watson-tts.js.map +1 -0
  152. package/dist/tts/backends/sherpa-onnx-tts.d.ts +80 -0
  153. package/dist/tts/backends/sherpa-onnx-tts.d.ts.map +1 -0
  154. package/dist/tts/backends/sherpa-onnx-tts.js +237 -0
  155. package/dist/tts/backends/sherpa-onnx-tts.js.map +1 -0
  156. package/dist/tts/index.d.ts +19 -0
  157. package/dist/tts/index.d.ts.map +1 -0
  158. package/dist/tts/index.js +20 -0
  159. package/dist/tts/index.js.map +1 -0
  160. package/dist/tts/tts-engine.d.ts +67 -0
  161. package/dist/tts/tts-engine.d.ts.map +1 -0
  162. package/dist/tts/tts-engine.js +109 -0
  163. package/dist/tts/tts-engine.js.map +1 -0
  164. package/dist/tts/tts.d.ts +47 -0
  165. package/dist/tts/tts.d.ts.map +1 -0
  166. package/dist/tts/tts.js +101 -0
  167. package/dist/tts/tts.js.map +1 -0
  168. package/dist/utils/colors.d.ts +39 -0
  169. package/dist/utils/colors.d.ts.map +1 -0
  170. package/dist/utils/colors.js +155 -0
  171. package/dist/utils/colors.js.map +1 -0
  172. package/dist/utils/constants.d.ts +41 -0
  173. package/dist/utils/constants.d.ts.map +1 -0
  174. package/dist/utils/constants.js +43 -0
  175. package/dist/utils/constants.js.map +1 -0
  176. package/dist/utils/credentials.d.ts +43 -0
  177. package/dist/utils/credentials.d.ts.map +1 -0
  178. package/dist/utils/credentials.js +121 -0
  179. package/dist/utils/credentials.js.map +1 -0
  180. package/dist/utils/errors.d.ts +26 -0
  181. package/dist/utils/errors.d.ts.map +1 -0
  182. package/dist/utils/errors.js +32 -0
  183. package/dist/utils/errors.js.map +1 -0
  184. package/dist/utils/index.d.ts +25 -0
  185. package/dist/utils/index.d.ts.map +1 -0
  186. package/dist/utils/index.js +23 -0
  187. package/dist/utils/index.js.map +1 -0
  188. package/dist/utils/logging.d.ts +44 -0
  189. package/dist/utils/logging.d.ts.map +1 -0
  190. package/dist/utils/logging.js +113 -0
  191. package/dist/utils/logging.js.map +1 -0
  192. package/dist/utils/model-registry.d.ts +142 -0
  193. package/dist/utils/model-registry.d.ts.map +1 -0
  194. package/dist/utils/model-registry.js +391 -0
  195. package/dist/utils/model-registry.js.map +1 -0
  196. package/dist/utils/utils.d.ts +33 -0
  197. package/dist/utils/utils.d.ts.map +1 -0
  198. package/dist/utils/utils.js +50 -0
  199. package/dist/utils/utils.js.map +1 -0
  200. package/dist/vision/backends/azure-vision.d.ts +33 -0
  201. package/dist/vision/backends/azure-vision.d.ts.map +1 -0
  202. package/dist/vision/backends/azure-vision.js +151 -0
  203. package/dist/vision/backends/azure-vision.js.map +1 -0
  204. package/dist/vision/backends/google-cloud-vision.d.ts +32 -0
  205. package/dist/vision/backends/google-cloud-vision.d.ts.map +1 -0
  206. package/dist/vision/backends/google-cloud-vision.js +193 -0
  207. package/dist/vision/backends/google-cloud-vision.js.map +1 -0
  208. package/dist/vision/backends/onnx.d.ts +116 -0
  209. package/dist/vision/backends/onnx.d.ts.map +1 -0
  210. package/dist/vision/backends/onnx.js +781 -0
  211. package/dist/vision/backends/onnx.js.map +1 -0
  212. package/dist/vision/index.d.ts +19 -0
  213. package/dist/vision/index.d.ts.map +1 -0
  214. package/dist/vision/index.js +20 -0
  215. package/dist/vision/index.js.map +1 -0
  216. package/dist/vision/vision-engine.d.ts +131 -0
  217. package/dist/vision/vision-engine.d.ts.map +1 -0
  218. package/dist/vision/vision-engine.js +97 -0
  219. package/dist/vision/vision-engine.js.map +1 -0
  220. package/dist/vision/vision.d.ts +48 -0
  221. package/dist/vision/vision.d.ts.map +1 -0
  222. package/dist/vision/vision.js +83 -0
  223. package/dist/vision/vision.js.map +1 -0
  224. package/package.json +124 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sherpa-onnx-stt.js","sourceRoot":"","sources":["../../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CAAC,EAAE,CAAC,GAAG,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC;YAC3B,GAAG,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QAC5C,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC;IAED;;OAEG;IACK,MAAM,CAAC,OAAqB;QAChC,IAAI,GAAG,GAAG,CAAC,CAAC;QACZ,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACtC,GAAG,IAAI,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;QACnC,CAAC;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACJ"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2025 IBM Corp. All Rights Reserved.
3
+ * Copyright 2026-present TJBot Contributors. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ export { STTController } from './stt.js';
18
+ export { createSTTEngine } from './stt-engine.js';
19
+ export type { STTEngine, STTRequestOptions } from './stt-engine.js';
20
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/stt/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAGlD,YAAY,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright 2025 IBM Corp. All Rights Reserved.
3
+ * Copyright 2026-present TJBot Contributors. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ // STT controller
18
+ export { STTController } from './stt.js';
19
+ // STT engine factory (async)
20
+ export { createSTTEngine } from './stt-engine.js';
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/stt/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,iBAAiB;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,6BAA6B;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Copyright 2025 IBM Corp. All Rights Reserved.
3
+ * Copyright 2026-present TJBot Contributors. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ListenConfig, STTEngineConfig } from '../config/index.js';
18
+ export interface STTRequestOptions {
19
+ /** Optional callback for streaming partial results */
20
+ onPartialResult?: (text: string) => void;
21
+ /** Optional callback for final result */
22
+ onFinalResult?: (text: string) => void;
23
+ /** Optional abort signal to end transcription (e.g., on Ctrl+C) */
24
+ abortSignal?: AbortSignal;
25
+ }
26
+ /**
27
+ * Abstract base class for speech-to-text engines.
28
+ * Implementations must extend this class and implement initialize() and transcribe().
29
+ * @public
30
+ */
31
+ export declare abstract class STTEngine {
32
+ protected config: STTEngineConfig;
33
+ constructor(config?: STTEngineConfig);
34
+ /**
35
+ * Initialize the STT engine. Must be called before transcribe().
36
+ * @param microphoneRate Sample rate of the microphone audio (e.g., 44100)
37
+ * @param microphoneChannels Number of audio channels from the microphone (e.g., 2 for stereo)
38
+ * @throws {TJBotError} if initialization fails
39
+ * @public
40
+ */
41
+ abstract initialize(microphoneRate: number, microphoneChannels: number): Promise<void>;
42
+ /**
43
+ * Clean up resources used by the STT engine.
44
+ * Optional method for backends that need to release resources.
45
+ * @public
46
+ */
47
+ cleanup?(): Promise<void>;
48
+ /**
49
+ * Transcribe audio from a microphone stream.
50
+ * @param micStream - The readable stream from the microphone
51
+ * @param options - Configuration options for transcription
52
+ * @returns {Promise<string>} The transcribed text
53
+ * @throws {TJBotError} if transcription fails or stream is unavailable
54
+ * @public
55
+ */
56
+ abstract transcribe(micStream: NodeJS.ReadableStream, options: STTRequestOptions): Promise<string>;
57
+ protected ensureStream(stream: NodeJS.ReadableStream | undefined): NodeJS.ReadableStream;
58
+ }
59
+ /**
60
+ * Create an STT engine instance based on the configuration.
61
+ * Uses dynamic imports to lazily load backend implementations only when needed.
62
+ * @param listenConfig - Configuration for the STT engine
63
+ * @returns {Promise<STTEngine>} Initialized STT engine instance
64
+ * @throws {TJBotError} if backend type is unknown or dependencies are not installed
65
+ * @public
66
+ */
67
+ export declare function createSTTEngine(listenConfig: ListenConfig): Promise<STTEngine>;
68
+ //# sourceMappingURL=stt-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stt-engine.d.ts","sourceRoot":"","sources":["../../src/stt/stt-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EACH,YAAY,EAGZ,eAAe,EAElB,MAAM,oBAAoB,CAAC;AAG5B,MAAM,WAAW,iBAAiB;IAC9B,sDAAsD;IACtD,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,yCAAyC;IACzC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,mEAAmE;IACnE,WAAW,CAAC,EAAE,WAAW,CAAC;CAC7B;AAED;;;;GAIG;AACH,8BAAsB,SAAS;IAC3B,SAAS,CAAC,MAAM,EAAE,eAAe,CAAC;gBAEtB,MAAM,CAAC,EAAE,eAAe;IAIpC;;;;;;OAMG;IACH,QAAQ,CAAC,UAAU,CAAC,cAAc,EAAE,MAAM,EAAE,kBAAkB,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAEtF;;;;OAIG;IACH,OAAO,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IAEzB;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,CAAC,SAAS,EAAE,MAAM,CAAC,cAAc,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC;IAElG,SAAS,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,GAAG,SAAS,GAAG,MAAM,CAAC,cAAc;CAM3F;AAED;;;;;;;GAOG;AACH,wBAAsB,eAAe,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAmEpF"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Copyright 2025 IBM Corp. All Rights Reserved.
3
+ * Copyright 2026-present TJBot Contributors. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { getSTTBackendConfig, } from '../config/index.js';
18
+ import { TJBotError } from '../utils/index.js';
19
+ /**
20
+ * Abstract base class for speech-to-text engines.
21
+ * Implementations must extend this class and implement initialize() and transcribe().
22
+ * @public
23
+ */
24
+ export class STTEngine {
25
+ config;
26
+ constructor(config) {
27
+ this.config = config ?? {};
28
+ }
29
+ ensureStream(stream) {
30
+ if (!stream) {
31
+ throw new TJBotError('Microphone stream is not available');
32
+ }
33
+ return stream;
34
+ }
35
+ }
36
+ /**
37
+ * Create an STT engine instance based on the configuration.
38
+ * Uses dynamic imports to lazily load backend implementations only when needed.
39
+ * @param listenConfig - Configuration for the STT engine
40
+ * @returns {Promise<STTEngine>} Initialized STT engine instance
41
+ * @throws {TJBotError} if backend type is unknown or dependencies are not installed
42
+ * @public
43
+ */
44
+ export async function createSTTEngine(listenConfig) {
45
+ const backend = (listenConfig.backend?.type ?? 'local');
46
+ try {
47
+ if (backend === 'none') {
48
+ // Return a stub engine that throws on all method calls
49
+ class NoneSTTEngine extends STTEngine {
50
+ async initialize() {
51
+ // No-op for 'none' backend
52
+ }
53
+ async transcribe() {
54
+ throw new TJBotError('STT is disabled. Configure a speech-to-text backend (local, ibm-watson-stt, google-cloud-stt, or azure-stt) to use speech recognition.');
55
+ }
56
+ }
57
+ return new NoneSTTEngine();
58
+ }
59
+ if (backend === 'local') {
60
+ const module = await import('./backends/sherpa-onnx-stt.js');
61
+ if (!module?.SherpaONNXSTTEngine) {
62
+ throw new TJBotError('STT backend "local" is unavailable (missing SherpaONNXSTTEngine export).');
63
+ }
64
+ const config = getSTTBackendConfig(listenConfig.backend, backend);
65
+ return new module.SherpaONNXSTTEngine(config);
66
+ }
67
+ if (backend === 'ibm-watson-stt') {
68
+ const module = await import('./backends/ibm-watson-stt.js');
69
+ if (!module?.IBMWatsonSTTEngine) {
70
+ throw new TJBotError('STT backend "ibm-watson-stt" is unavailable (missing IBMWatsonSTTEngine export).');
71
+ }
72
+ const config = getSTTBackendConfig(listenConfig.backend, backend);
73
+ return new module.IBMWatsonSTTEngine(config);
74
+ }
75
+ if (backend === 'google-cloud-stt') {
76
+ const module = await import('./backends/google-cloud-stt.js');
77
+ if (!module?.GoogleCloudSTTEngine) {
78
+ throw new TJBotError('STT backend "google-cloud-stt" is unavailable (missing GoogleCloudSTTEngine export).');
79
+ }
80
+ const config = getSTTBackendConfig(listenConfig.backend, backend);
81
+ return new module.GoogleCloudSTTEngine(config);
82
+ }
83
+ if (backend === 'azure-stt') {
84
+ const module = await import('./backends/azure-stt.js');
85
+ if (!module?.AzureSTTEngine) {
86
+ throw new TJBotError('STT backend "azure-stt" is unavailable (missing AzureSTTEngine export).');
87
+ }
88
+ const config = getSTTBackendConfig(listenConfig.backend, backend);
89
+ return new module.AzureSTTEngine(config);
90
+ }
91
+ throw new TJBotError(`Unknown STT backend type: ${backend}`);
92
+ }
93
+ catch (error) {
94
+ throw new TJBotError(`Failed to load STT backend "${backend}". Ensure dependencies are installed.`, {
95
+ cause: error,
96
+ });
97
+ }
98
+ }
99
+ //# sourceMappingURL=stt-engine.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stt-engine.js","sourceRoot":"","sources":["../../src/stt/stt-engine.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAKH,mBAAmB,GACtB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,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ACxB,CAAC,CAAC;IACP,CAAC;AACL,CAAC"}
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Copyright 2025 IBM Corp. All Rights Reserved.
3
+ * Copyright 2026-present TJBot Contributors. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ListenConfig } from '../config/index.js';
18
+ export type STTModelType = 'streaming' | 'offline';
19
+ export type STTModelFlavor = 'streaming-zipformer' | 'streaming-paraformer' | 'offline-whisper' | 'offline-moonshine';
20
+ /**
21
+ * Infer sherpa-onnx local model flavor from model name/URL.
22
+ * Throws a TJBotError if the flavor cannot be determined.
23
+ */
24
+ export declare function inferLocalModelFlavor(modelName?: string, modelUrl?: string): STTModelFlavor;
25
+ export declare function toModelType(flavor: STTModelFlavor): STTModelType;
26
+ export declare function inferSTTMode(listenConfig: ListenConfig): STTModelType;
27
+ export interface StreamEndTranscriptResolutionOptions {
28
+ finalTranscript?: string;
29
+ partialTranscript?: string;
30
+ allowPartialOnTimeoutLikeEnd?: boolean;
31
+ timeoutLikeEnd: boolean;
32
+ }
33
+ export declare function isTimeoutLikeStreamEndReason(reason: string | undefined | null): boolean;
34
+ export declare function isNoSpeechLikeReason(reason: string | undefined | null): boolean;
35
+ export declare function resolveTranscriptForStreamEnd(options: StreamEndTranscriptResolutionOptions): string | undefined;
36
+ //# sourceMappingURL=stt-utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stt-utils.d.ts","sourceRoot":"","sources":["../../src/stt/stt-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAkB,MAAM,oBAAoB,CAAC;AAGlE,MAAM,MAAM,YAAY,GAAG,WAAW,GAAG,SAAS,CAAC;AACnD,MAAM,MAAM,cAAc,GAAG,qBAAqB,GAAG,sBAAsB,GAAG,iBAAiB,GAAG,mBAAmB,CAAC;AAEtH;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,cAAc,CAmB3F;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,YAAY,CAEhE;AAED,wBAAgB,YAAY,CAAC,YAAY,EAAE,YAAY,GAAG,YAAY,CAkCrE;AAkBD,MAAM,WAAW,oCAAoC;IACjD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,cAAc,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAMvF;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAAG,OAAO,CAM/E;AAED,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,oCAAoC,GAAG,MAAM,GAAG,SAAS,CAY/G"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * Copyright 2025 IBM Corp. All Rights Reserved.
3
+ * Copyright 2026-present TJBot Contributors. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { TJBotError } from '../utils/index.js';
18
+ /**
19
+ * Infer sherpa-onnx local model flavor from model name/URL.
20
+ * Throws a TJBotError if the flavor cannot be determined.
21
+ */
22
+ export function inferLocalModelFlavor(modelName, modelUrl) {
23
+ const name = modelName?.toLowerCase() ?? '';
24
+ const url = modelUrl?.toLowerCase() ?? '';
25
+ const haystack = `${name} ${url}`;
26
+ const isWhisper = /whisper/.test(haystack);
27
+ const isMoonshine = /moonshine/.test(haystack);
28
+ const isZipformer = /zipformer|transducer|streaming-zipformer/.test(haystack);
29
+ const isParaformer = /paraformer/.test(haystack);
30
+ if (isWhisper)
31
+ return 'offline-whisper';
32
+ if (isMoonshine)
33
+ return 'offline-moonshine';
34
+ if (isZipformer)
35
+ return 'streaming-zipformer';
36
+ if (isParaformer)
37
+ return 'streaming-paraformer';
38
+ throw new TJBotError('Unable to infer STT model type. Provide a sherpa-onnx model name/URL that indicates whisper, moonshine, zipformer, or paraformer.');
39
+ }
40
+ export function toModelType(flavor) {
41
+ return flavor.startsWith('streaming') ? 'streaming' : 'offline';
42
+ }
43
+ export function inferSTTMode(listenConfig) {
44
+ const backend = listenConfig.backend?.type;
45
+ if (backend === 'ibm-watson-stt') {
46
+ const config = listenConfig.backend?.['ibm-watson-stt'];
47
+ if (config.interimResults) {
48
+ return 'streaming';
49
+ }
50
+ else {
51
+ return 'offline';
52
+ }
53
+ }
54
+ if (backend === 'google-cloud-stt') {
55
+ const config = listenConfig.backend?.['google-cloud-stt'];
56
+ if (config.interimResults) {
57
+ return 'streaming';
58
+ }
59
+ else {
60
+ return 'offline';
61
+ }
62
+ }
63
+ if (backend === 'azure-stt') {
64
+ // Azure is single-shot request/response; treat as offline for listen() API usage
65
+ return 'offline';
66
+ }
67
+ if (backend === 'local') {
68
+ const modelName = listenConfig.backend?.local?.model ?? '';
69
+ const modelUrl = listenConfig.backend?.local?.modelUrl ?? '';
70
+ const flavor = inferLocalModelFlavor(modelName, modelUrl);
71
+ return toModelType(flavor);
72
+ }
73
+ throw new TJBotError(`Unknown STT backend type: ${backend}`);
74
+ }
75
+ const TIMEOUT_LIKE_STREAM_END_PATTERNS = [
76
+ /max duration.*5 minutes.*stream/i,
77
+ /maximum stream duration/i,
78
+ /stream.*time(?:d)? out/i,
79
+ /request.*time(?:d)? out/i,
80
+ /session stopped/i,
81
+ /inactivity timeout/i,
82
+ ];
83
+ const NO_SPEECH_LIKE_REASON_PATTERNS = [
84
+ /no speech/i,
85
+ /no audio/i,
86
+ /speech inactivity/i,
87
+ /inactivity timeout/i,
88
+ ];
89
+ export function isTimeoutLikeStreamEndReason(reason) {
90
+ if (!reason) {
91
+ return false;
92
+ }
93
+ return TIMEOUT_LIKE_STREAM_END_PATTERNS.some((pattern) => pattern.test(reason));
94
+ }
95
+ export function isNoSpeechLikeReason(reason) {
96
+ if (!reason) {
97
+ return false;
98
+ }
99
+ return NO_SPEECH_LIKE_REASON_PATTERNS.some((pattern) => pattern.test(reason));
100
+ }
101
+ export function resolveTranscriptForStreamEnd(options) {
102
+ const finalTranscript = options.finalTranscript?.trim();
103
+ if (finalTranscript) {
104
+ return finalTranscript;
105
+ }
106
+ const partialTranscript = options.partialTranscript?.trim();
107
+ if (options.timeoutLikeEnd && (options.allowPartialOnTimeoutLikeEnd ?? true) && partialTranscript) {
108
+ return partialTranscript;
109
+ }
110
+ return undefined;
111
+ }
112
+ //# sourceMappingURL=stt-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stt-utils.js","sourceRoot":"","sources":["../../src/stt/stt-utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAGH,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAK/C;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,SAAkB,EAAE,QAAiB;IACvE,MAAM,IAAI,GAAG,SAAS,EAAE,WAAW,EAAE,IAAI,EAAE,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V,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,8BAA8B,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;AAClF,CAAC;AAED,MAAM,UAAU,6BAA6B,CAAC,OAA6C;IACvF,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,IAAI,EAAE,CAAC;IACxD,IAAI,eAAe,EAAE,CAAC;QAClB,OAAO,eAAe,CAAC;IAC3B,CAAC;IAED,MAAM,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,EAAE,IAAI,EAAE,CAAC;IAC5D,IAAI,OAAO,CAAC,cAAc,IAAI,CAAC,OAAO,CAAC,4BAA4B,IAAI,IAAI,CAAC,IAAI,iBAAiB,EAAE,CAAC;QAChG,OAAO,iBAAiB,CAAC;IAC7B,CAAC;IAED,OAAO,SAAS,CAAC;AACrB,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Copyright 2025 IBM Corp. All Rights Reserved.
3
+ * Copyright 2026-present TJBot Contributors. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ListenConfig } from '../config/index.js';
18
+ import { MicrophoneController } from '../microphone/index.js';
19
+ /**
20
+ * STT controller manages speech-to-text synthesis and engine lifecycle.
21
+ * STT engine is eagerly initialized during setupMicrophone() and cached for reuse.
22
+ */
23
+ export declare class STTController {
24
+ private sttEngine?;
25
+ private microphoneController;
26
+ private listenConfig?;
27
+ constructor(microphoneController: MicrophoneController);
28
+ /**
29
+ * Initialize the STT backend
30
+ * Called during setupMicrophone to eagerly load STT engine
31
+ * @param config Configuration object with backend, IBM settings, and Sherpa settings
32
+ */
33
+ initialize(config: ListenConfig): Promise<void>;
34
+ /**
35
+ * Transcribe audio from a microphone stream.
36
+ * Lazily initializes the STT engine on first call.
37
+ * Manages the microphone lifecycle (start/stop) internally.
38
+ *
39
+ * @returns The transcribed text
40
+ */
41
+ transcribe(options?: {
42
+ onPartialResult?: (text: string) => void;
43
+ onFinalResult?: (text: string) => void;
44
+ abortSignal?: AbortSignal;
45
+ }): Promise<string>;
46
+ private isNoSpeechError;
47
+ /**
48
+ * Clean up STT resources.
49
+ */
50
+ cleanup(): Promise<void>;
51
+ }
52
+ //# sourceMappingURL=stt.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stt.d.ts","sourceRoot":"","sources":["../../src/stt/stt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAO9D;;;GAGG;AACH,qBAAa,aAAa;IACtB,OAAO,CAAC,SAAS,CAAC,CAAY;IAC9B,OAAO,CAAC,oBAAoB,CAAuB;IACnD,OAAO,CAAC,YAAY,CAAC,CAAe;gBAExB,oBAAoB,EAAE,oBAAoB;IAKtD;;;;OAIG;IACG,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC;IAarD;;;;;;OAMG;IACG,UAAU,CAAC,OAAO,CAAC,EAAE;QACvB,eAAe,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACzC,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QACvC,WAAW,CAAC,EAAE,WAAW,CAAC;KAC7B,GAAG,OAAO,CAAC,MAAM,CAAC;IAoCnB,OAAO,CAAC,eAAe;IAIvB;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAOjC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Copyright 2025 IBM Corp. All Rights Reserved.
3
+ * Copyright 2026-present TJBot Contributors. All Rights Reserved.
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { TJBotError } from '../utils/errors.js';
18
+ import { getLogger } from '../utils/logging.js';
19
+ import { createSTTEngine } from './stt-engine.js';
20
+ const logger = getLogger(import.meta.url);
21
+ /**
22
+ * STT controller manages speech-to-text synthesis and engine lifecycle.
23
+ * STT engine is eagerly initialized during setupMicrophone() and cached for reuse.
24
+ */
25
+ export class STTController {
26
+ sttEngine;
27
+ microphoneController;
28
+ listenConfig;
29
+ constructor(microphoneController) {
30
+ this.sttEngine = undefined;
31
+ this.microphoneController = microphoneController;
32
+ }
33
+ /**
34
+ * Initialize the STT backend
35
+ * Called during setupMicrophone to eagerly load STT engine
36
+ * @param config Configuration object with backend, IBM settings, and Sherpa settings
37
+ */
38
+ async initialize(config) {
39
+ this.listenConfig = config;
40
+ this.sttEngine = await createSTTEngine(this.listenConfig);
41
+ const microphoneRate = this.listenConfig.microphoneRate;
42
+ const microphoneChannels = this.listenConfig.microphoneChannels;
43
+ logger.debug(`Initializing STT engine with microphone settings: rate=${microphoneRate}, channels=${microphoneChannels}`);
44
+ await this.sttEngine.initialize(microphoneRate, microphoneChannels);
45
+ }
46
+ /**
47
+ * Transcribe audio from a microphone stream.
48
+ * Lazily initializes the STT engine on first call.
49
+ * Manages the microphone lifecycle (start/stop) internally.
50
+ *
51
+ * @returns The transcribed text
52
+ */
53
+ async transcribe(options) {
54
+ if (this.listenConfig === undefined) {
55
+ throw new TJBotError('STT engine not initialized. Call initialize() before transcribing.');
56
+ }
57
+ if (this.sttEngine === undefined) {
58
+ throw new TJBotError('STT engine not initialized. Call initialize() before transcribing.');
59
+ }
60
+ while (true) {
61
+ // Start microphone
62
+ this.microphoneController.start();
63
+ try {
64
+ const micStream = this.microphoneController.getInputStream();
65
+ const transcript = await this.sttEngine.transcribe(micStream, {
66
+ onPartialResult: options?.onPartialResult,
67
+ onFinalResult: options?.onFinalResult,
68
+ abortSignal: options?.abortSignal,
69
+ });
70
+ logger.debug(`Transcript: ${transcript}`);
71
+ return transcript;
72
+ }
73
+ catch (error) {
74
+ if (this.isNoSpeechError(error)) {
75
+ logger.verbose('No speech detected; continuing to listen');
76
+ continue;
77
+ }
78
+ throw error;
79
+ }
80
+ finally {
81
+ // Pause between utterances so repeated listen() calls can reuse the live stream.
82
+ this.microphoneController.pause();
83
+ }
84
+ }
85
+ }
86
+ isNoSpeechError(error) {
87
+ return error instanceof TJBotError && error.code === 'stt.no-speech';
88
+ }
89
+ /**
90
+ * Clean up STT resources.
91
+ */
92
+ async cleanup() {
93
+ if (this.sttEngine) {
94
+ logger.debug('STTController cleanup');
95
+ await this.sttEngine.cleanup?.();
96
+ this.sttEngine = undefined;
97
+ }
98
+ }
99
+ }
100
+ //# sourceMappingURL=stt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stt.js","sourceRoot":"","sources":["../../src/stt/stt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAa,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAE7D,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CA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