chat-flow-ardymalihi 3.0.0 → 3.0.2

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 (322) hide show
  1. package/package.json +1 -1
  2. package/dist/adapters/db/InMemorySessionRepository.js +0 -15
  3. package/dist/adapters/db/RedisSessionRepository.js +0 -41
  4. package/dist/adapters/intent/IntentMatcher.d.ts +0 -41
  5. package/dist/adapters/intent/IntentMatcher.d.ts.map +0 -1
  6. package/dist/adapters/intent/IntentMatcher.js +0 -167
  7. package/dist/adapters/intent/IntentMatcher.js.map +0 -1
  8. package/dist/adapters/intent/IntentService.d.ts +0 -26
  9. package/dist/adapters/intent/IntentService.d.ts.map +0 -1
  10. package/dist/adapters/intent/IntentService.js +0 -65
  11. package/dist/adapters/intent/IntentService.js.map +0 -1
  12. package/dist/adapters/intent/MockIntentAdapter.js +0 -29
  13. package/dist/adapters/intent/MockIntentService.d.ts +0 -7
  14. package/dist/adapters/intent/MockIntentService.d.ts.map +0 -1
  15. package/dist/adapters/intent/MockIntentService.js +0 -36
  16. package/dist/adapters/intent/MockIntentService.js.map +0 -1
  17. package/dist/adapters/llm/GeminiLLMAdapter.d.ts +0 -10
  18. package/dist/adapters/llm/GeminiLLMAdapter.d.ts.map +0 -1
  19. package/dist/adapters/llm/GeminiLLMAdapter.js +0 -102
  20. package/dist/adapters/llm/GeminiLLMAdapter.js.map +0 -1
  21. package/dist/adapters/llm/MockLLMAdapter.d.ts +0 -5
  22. package/dist/adapters/llm/MockLLMAdapter.d.ts.map +0 -1
  23. package/dist/adapters/llm/MockLLMAdapter.js +0 -31
  24. package/dist/adapters/llm/MockLLMAdapter.js.map +0 -1
  25. package/dist/adapters/llm/OllamaLLMAdapter.d.ts +0 -9
  26. package/dist/adapters/llm/OllamaLLMAdapter.d.ts.map +0 -1
  27. package/dist/adapters/llm/OllamaLLMAdapter.js +0 -74
  28. package/dist/adapters/llm/OllamaLLMAdapter.js.map +0 -1
  29. package/dist/adapters/logger/ConsoleLogger.d.ts +0 -12
  30. package/dist/adapters/logger/ConsoleLogger.d.ts.map +0 -1
  31. package/dist/adapters/logger/ConsoleLogger.js +0 -37
  32. package/dist/adapters/logger/ConsoleLogger.js.map +0 -1
  33. package/dist/adapters/memory/InMemorySessionRepository.js +0 -15
  34. package/dist/adapters/redis/RedisSessionRepository.js +0 -41
  35. package/dist/adapters/repository/InMemoryRepository.d.ts +0 -46
  36. package/dist/adapters/repository/InMemoryRepository.d.ts.map +0 -1
  37. package/dist/adapters/repository/InMemoryRepository.js +0 -235
  38. package/dist/adapters/repository/InMemoryRepository.js.map +0 -1
  39. package/dist/adapters/repository/IntentRepository.d.ts +0 -15
  40. package/dist/adapters/repository/IntentRepository.d.ts.map +0 -1
  41. package/dist/adapters/repository/IntentRepository.js +0 -28
  42. package/dist/adapters/repository/IntentRepository.js.map +0 -1
  43. package/dist/adapters/repository/RedisRepository.d.ts +0 -63
  44. package/dist/adapters/repository/RedisRepository.d.ts.map +0 -1
  45. package/dist/adapters/repository/RedisRepository.js +0 -586
  46. package/dist/adapters/repository/RedisRepository.js.map +0 -1
  47. package/dist/adapters/storage/RedisAudioStorageAdapter.d.ts +0 -33
  48. package/dist/adapters/storage/RedisAudioStorageAdapter.d.ts.map +0 -1
  49. package/dist/adapters/storage/RedisAudioStorageAdapter.js +0 -121
  50. package/dist/adapters/storage/RedisAudioStorageAdapter.js.map +0 -1
  51. package/dist/adapters/storage/RedisBufferStorageAdapter.d.ts +0 -14
  52. package/dist/adapters/storage/RedisBufferStorageAdapter.d.ts.map +0 -1
  53. package/dist/adapters/storage/RedisBufferStorageAdapter.js +0 -94
  54. package/dist/adapters/storage/RedisBufferStorageAdapter.js.map +0 -1
  55. package/dist/adapters/voice/ElevenLabsVoiceAdapter.d.ts +0 -29
  56. package/dist/adapters/voice/ElevenLabsVoiceAdapter.d.ts.map +0 -1
  57. package/dist/adapters/voice/ElevenLabsVoiceAdapter.js +0 -75
  58. package/dist/adapters/voice/ElevenLabsVoiceAdapter.js.map +0 -1
  59. package/dist/adapters/voice/GeminiMultimodalLiveAdapter.d.ts +0 -77
  60. package/dist/adapters/voice/GeminiMultimodalLiveAdapter.d.ts.map +0 -1
  61. package/dist/adapters/voice/GeminiMultimodalLiveAdapter.js +0 -187
  62. package/dist/adapters/voice/GeminiMultimodalLiveAdapter.js.map +0 -1
  63. package/dist/adapters/voice/GeminiVoiceAdapter.d.ts +0 -36
  64. package/dist/adapters/voice/GeminiVoiceAdapter.d.ts.map +0 -1
  65. package/dist/adapters/voice/GeminiVoiceAdapter.js +0 -134
  66. package/dist/adapters/voice/GeminiVoiceAdapter.js.map +0 -1
  67. package/dist/adapters/voice/GoogleTTSAdapter.d.ts +0 -61
  68. package/dist/adapters/voice/GoogleTTSAdapter.d.ts.map +0 -1
  69. package/dist/adapters/voice/GoogleTTSAdapter.js +0 -165
  70. package/dist/adapters/voice/GoogleTTSAdapter.js.map +0 -1
  71. package/dist/adapters/voice/GoogleVoiceAdapter.d.ts +0 -33
  72. package/dist/adapters/voice/GoogleVoiceAdapter.d.ts.map +0 -1
  73. package/dist/adapters/voice/GoogleVoiceAdapter.js +0 -155
  74. package/dist/adapters/voice/GoogleVoiceAdapter.js.map +0 -1
  75. package/dist/adapters/voice/HybridVoiceAdapter.d.ts +0 -54
  76. package/dist/adapters/voice/HybridVoiceAdapter.d.ts.map +0 -1
  77. package/dist/adapters/voice/HybridVoiceAdapter.js +0 -102
  78. package/dist/adapters/voice/HybridVoiceAdapter.js.map +0 -1
  79. package/dist/adapters/voice/LanguageVoiceMapper.d.ts +0 -60
  80. package/dist/adapters/voice/LanguageVoiceMapper.d.ts.map +0 -1
  81. package/dist/adapters/voice/LanguageVoiceMapper.js +0 -130
  82. package/dist/adapters/voice/LanguageVoiceMapper.js.map +0 -1
  83. package/dist/adapters/voice/VertexVoiceAdapter.d.ts +0 -32
  84. package/dist/adapters/voice/VertexVoiceAdapter.d.ts.map +0 -1
  85. package/dist/adapters/voice/VertexVoiceAdapter.js +0 -179
  86. package/dist/adapters/voice/VertexVoiceAdapter.js.map +0 -1
  87. package/dist/adapters/webhook/WebhookService.d.ts +0 -47
  88. package/dist/adapters/webhook/WebhookService.d.ts.map +0 -1
  89. package/dist/adapters/webhook/WebhookService.js +0 -265
  90. package/dist/adapters/webhook/WebhookService.js.map +0 -1
  91. package/dist/adapters/workflow/MockWorkflowAdapter.d.ts +0 -5
  92. package/dist/adapters/workflow/MockWorkflowAdapter.d.ts.map +0 -1
  93. package/dist/adapters/workflow/MockWorkflowAdapter.js +0 -173
  94. package/dist/adapters/workflow/MockWorkflowAdapter.js.map +0 -1
  95. package/dist/adapters/workflow/WorkflowAdapter.d.ts +0 -55
  96. package/dist/adapters/workflow/WorkflowAdapter.d.ts.map +0 -1
  97. package/dist/adapters/workflow/WorkflowAdapter.js +0 -242
  98. package/dist/adapters/workflow/WorkflowAdapter.js.map +0 -1
  99. package/dist/adapters/workflow/actions/getSupportHoursAction.d.ts +0 -10
  100. package/dist/adapters/workflow/actions/getSupportHoursAction.d.ts.map +0 -1
  101. package/dist/adapters/workflow/actions/getSupportHoursAction.js +0 -33
  102. package/dist/adapters/workflow/actions/getSupportHoursAction.js.map +0 -1
  103. package/dist/adapters/workflow/actions/index.d.ts +0 -6
  104. package/dist/adapters/workflow/actions/index.d.ts.map +0 -1
  105. package/dist/adapters/workflow/actions/index.js +0 -22
  106. package/dist/adapters/workflow/actions/index.js.map +0 -1
  107. package/dist/adapters/workflow/actions/pushOutputResultAction.d.ts +0 -11
  108. package/dist/adapters/workflow/actions/pushOutputResultAction.d.ts.map +0 -1
  109. package/dist/adapters/workflow/actions/pushOutputResultAction.js +0 -31
  110. package/dist/adapters/workflow/actions/pushOutputResultAction.js.map +0 -1
  111. package/dist/adapters/workflow/actions/setWorkflowMessageAction.d.ts +0 -12
  112. package/dist/adapters/workflow/actions/setWorkflowMessageAction.d.ts.map +0 -1
  113. package/dist/adapters/workflow/actions/setWorkflowMessageAction.js +0 -32
  114. package/dist/adapters/workflow/actions/setWorkflowMessageAction.js.map +0 -1
  115. package/dist/adapters/workflow/engine/constants.d.ts +0 -3
  116. package/dist/adapters/workflow/engine/constants.d.ts.map +0 -1
  117. package/dist/adapters/workflow/engine/constants.js +0 -6
  118. package/dist/adapters/workflow/engine/constants.js.map +0 -1
  119. package/dist/adapters/workflow/engine/engine.d.ts +0 -32
  120. package/dist/adapters/workflow/engine/engine.d.ts.map +0 -1
  121. package/dist/adapters/workflow/engine/engine.js +0 -623
  122. package/dist/adapters/workflow/engine/engine.js.map +0 -1
  123. package/dist/adapters/workflow/engine/event-registry.d.ts +0 -12
  124. package/dist/adapters/workflow/engine/event-registry.d.ts.map +0 -1
  125. package/dist/adapters/workflow/engine/event-registry.js +0 -33
  126. package/dist/adapters/workflow/engine/event-registry.js.map +0 -1
  127. package/dist/adapters/workflow/engine/interpolator.d.ts +0 -11
  128. package/dist/adapters/workflow/engine/interpolator.d.ts.map +0 -1
  129. package/dist/adapters/workflow/engine/interpolator.js +0 -93
  130. package/dist/adapters/workflow/engine/interpolator.js.map +0 -1
  131. package/dist/adapters/workflow/engine/registry.d.ts +0 -12
  132. package/dist/adapters/workflow/engine/registry.d.ts.map +0 -1
  133. package/dist/adapters/workflow/engine/registry.js +0 -39
  134. package/dist/adapters/workflow/engine/registry.js.map +0 -1
  135. package/dist/adapters/workflow/engine/template-registry.d.ts +0 -60
  136. package/dist/adapters/workflow/engine/template-registry.d.ts.map +0 -1
  137. package/dist/adapters/workflow/engine/template-registry.js +0 -92
  138. package/dist/adapters/workflow/engine/template-registry.js.map +0 -1
  139. package/dist/adapters/workflow/engine/types.d.ts +0 -182
  140. package/dist/adapters/workflow/engine/types.d.ts.map +0 -1
  141. package/dist/adapters/workflow/engine/types.js +0 -3
  142. package/dist/adapters/workflow/engine/types.js.map +0 -1
  143. package/dist/adapters/workflow/engine/utils/format-utils.d.ts +0 -43
  144. package/dist/adapters/workflow/engine/utils/format-utils.d.ts.map +0 -1
  145. package/dist/adapters/workflow/engine/utils/format-utils.js +0 -137
  146. package/dist/adapters/workflow/engine/utils/format-utils.js.map +0 -1
  147. package/dist/adapters/workflow/engine/utils/layout-calculator.d.ts +0 -7
  148. package/dist/adapters/workflow/engine/utils/layout-calculator.d.ts.map +0 -1
  149. package/dist/adapters/workflow/engine/utils/layout-calculator.js +0 -87
  150. package/dist/adapters/workflow/engine/utils/layout-calculator.js.map +0 -1
  151. package/dist/adapters/workflow/engine/utils/slugify.d.ts +0 -2
  152. package/dist/adapters/workflow/engine/utils/slugify.d.ts.map +0 -1
  153. package/dist/adapters/workflow/engine/utils/slugify.js +0 -41
  154. package/dist/adapters/workflow/engine/utils/slugify.js.map +0 -1
  155. package/dist/adapters/workflow/engine/validator.d.ts +0 -9
  156. package/dist/adapters/workflow/engine/validator.d.ts.map +0 -1
  157. package/dist/adapters/workflow/engine/validator.js +0 -425
  158. package/dist/adapters/workflow/engine/validator.js.map +0 -1
  159. package/dist/application/ConversationSession.d.ts +0 -23
  160. package/dist/application/ConversationSession.d.ts.map +0 -1
  161. package/dist/application/ConversationSession.js +0 -83
  162. package/dist/application/ConversationSession.js.map +0 -1
  163. package/dist/application/Message.d.ts +0 -11
  164. package/dist/application/Message.d.ts.map +0 -1
  165. package/dist/application/Message.js +0 -30
  166. package/dist/application/Message.js.map +0 -1
  167. package/dist/application/Orchestrator.d.ts +0 -18
  168. package/dist/application/Orchestrator.d.ts.map +0 -1
  169. package/dist/application/Orchestrator.js +0 -80
  170. package/dist/application/Orchestrator.js.map +0 -1
  171. package/dist/application/SessionState.js +0 -2
  172. package/dist/application/usecases/CreateSession.js +0 -20
  173. package/dist/application/usecases/HandleUserMessage.js +0 -69
  174. package/dist/config/ChatFlowConfig.d.ts +0 -66
  175. package/dist/config/ChatFlowConfig.d.ts.map +0 -1
  176. package/dist/config/ChatFlowConfig.js +0 -54
  177. package/dist/config/ChatFlowConfig.js.map +0 -1
  178. package/dist/config/index.d.ts +0 -2
  179. package/dist/config/index.d.ts.map +0 -1
  180. package/dist/config/index.js +0 -7
  181. package/dist/config/index.js.map +0 -1
  182. package/dist/core/entities/ConversationSession.d.ts +0 -58
  183. package/dist/core/entities/ConversationSession.d.ts.map +0 -1
  184. package/dist/core/entities/ConversationSession.js +0 -160
  185. package/dist/core/entities/ConversationSession.js.map +0 -1
  186. package/dist/core/entities/Message.d.ts +0 -14
  187. package/dist/core/entities/Message.d.ts.map +0 -1
  188. package/dist/core/entities/Message.js +0 -32
  189. package/dist/core/entities/Message.js.map +0 -1
  190. package/dist/core/errors/ChatFlowError.d.ts +0 -71
  191. package/dist/core/errors/ChatFlowError.d.ts.map +0 -1
  192. package/dist/core/errors/ChatFlowError.js +0 -108
  193. package/dist/core/errors/ChatFlowError.js.map +0 -1
  194. package/dist/core/errors/index.d.ts +0 -2
  195. package/dist/core/errors/index.d.ts.map +0 -1
  196. package/dist/core/errors/index.js +0 -15
  197. package/dist/core/errors/index.js.map +0 -1
  198. package/dist/core/utils/AudioStreamBuffer.d.ts +0 -33
  199. package/dist/core/utils/AudioStreamBuffer.d.ts.map +0 -1
  200. package/dist/core/utils/AudioStreamBuffer.js +0 -55
  201. package/dist/core/utils/AudioStreamBuffer.js.map +0 -1
  202. package/dist/core/utils/AudioUtils.d.ts +0 -41
  203. package/dist/core/utils/AudioUtils.d.ts.map +0 -1
  204. package/dist/core/utils/AudioUtils.js +0 -188
  205. package/dist/core/utils/AudioUtils.js.map +0 -1
  206. package/dist/core/utils/LanguageDetector.d.ts +0 -52
  207. package/dist/core/utils/LanguageDetector.d.ts.map +0 -1
  208. package/dist/core/utils/LanguageDetector.js +0 -173
  209. package/dist/core/utils/LanguageDetector.js.map +0 -1
  210. package/dist/core/utils/WavUtils.d.ts +0 -14
  211. package/dist/core/utils/WavUtils.d.ts.map +0 -1
  212. package/dist/core/utils/WavUtils.js +0 -37
  213. package/dist/core/utils/WavUtils.js.map +0 -1
  214. package/dist/db/InMemoryRepository.d.ts +0 -15
  215. package/dist/db/InMemoryRepository.d.ts.map +0 -1
  216. package/dist/db/InMemoryRepository.js +0 -41
  217. package/dist/db/InMemoryRepository.js.map +0 -1
  218. package/dist/db/RedisRepository.d.ts +0 -16
  219. package/dist/db/RedisRepository.d.ts.map +0 -1
  220. package/dist/db/RedisRepository.js +0 -87
  221. package/dist/db/RedisRepository.js.map +0 -1
  222. package/dist/demo/cli-demo.d.ts +0 -2
  223. package/dist/demo/cli-demo.d.ts.map +0 -1
  224. package/dist/demo/cli-demo.js +0 -146
  225. package/dist/demo/cli-demo.js.map +0 -1
  226. package/dist/demo/console-chat.d.ts +0 -2
  227. package/dist/demo/console-chat.d.ts.map +0 -1
  228. package/dist/demo/console-chat.js +0 -148
  229. package/dist/demo/console-chat.js.map +0 -1
  230. package/dist/demo/interactive-voice-chat.d.ts +0 -2
  231. package/dist/demo/interactive-voice-chat.d.ts.map +0 -1
  232. package/dist/demo/interactive-voice-chat.js +0 -180
  233. package/dist/demo/interactive-voice-chat.js.map +0 -1
  234. package/dist/demo/voice-demo.d.ts +0 -2
  235. package/dist/demo/voice-demo.d.ts.map +0 -1
  236. package/dist/demo/voice-demo.js +0 -188
  237. package/dist/demo/voice-demo.js.map +0 -1
  238. package/dist/domain/conversation/ConversationSession.js +0 -82
  239. package/dist/domain/conversation/Message.js +0 -33
  240. package/dist/domain/conversation/SessionState.js +0 -10
  241. package/dist/index.d.ts +0 -26
  242. package/dist/index.d.ts.map +0 -1
  243. package/dist/index.js +0 -76
  244. package/dist/index.js.map +0 -1
  245. package/dist/intent/IntentService.d.ts +0 -17
  246. package/dist/intent/IntentService.d.ts.map +0 -1
  247. package/dist/intent/IntentService.js +0 -57
  248. package/dist/intent/IntentService.js.map +0 -1
  249. package/dist/intent/MockIntentService.d.ts +0 -7
  250. package/dist/intent/MockIntentService.d.ts.map +0 -1
  251. package/dist/intent/MockIntentService.js +0 -36
  252. package/dist/intent/MockIntentService.js.map +0 -1
  253. package/dist/interfaces.d.ts +0 -653
  254. package/dist/interfaces.d.ts.map +0 -1
  255. package/dist/interfaces.js +0 -36
  256. package/dist/interfaces.js.map +0 -1
  257. package/dist/llm/GeminiLLMAdapter.d.ts +0 -10
  258. package/dist/llm/GeminiLLMAdapter.d.ts.map +0 -1
  259. package/dist/llm/GeminiLLMAdapter.js +0 -102
  260. package/dist/llm/GeminiLLMAdapter.js.map +0 -1
  261. package/dist/llm/MockLLMAdapter.d.ts +0 -5
  262. package/dist/llm/MockLLMAdapter.d.ts.map +0 -1
  263. package/dist/llm/MockLLMAdapter.js +0 -31
  264. package/dist/llm/MockLLMAdapter.js.map +0 -1
  265. package/dist/orchestrator/Orchestrator.d.ts +0 -62
  266. package/dist/orchestrator/Orchestrator.d.ts.map +0 -1
  267. package/dist/orchestrator/Orchestrator.js +0 -697
  268. package/dist/orchestrator/Orchestrator.js.map +0 -1
  269. package/dist/ports/IIntentRepository.d.ts +0 -27
  270. package/dist/ports/IIntentRepository.d.ts.map +0 -1
  271. package/dist/ports/IIntentRepository.js +0 -3
  272. package/dist/ports/IIntentRepository.js.map +0 -1
  273. package/dist/ports/IntentPort.js +0 -2
  274. package/dist/ports/LLMPort.js +0 -2
  275. package/dist/ports/SessionRepository.js +0 -2
  276. package/dist/ports/WorkflowPort.js +0 -2
  277. package/dist/scripts/debug-redis.d.ts +0 -2
  278. package/dist/scripts/debug-redis.d.ts.map +0 -1
  279. package/dist/scripts/debug-redis.js +0 -55
  280. package/dist/scripts/debug-redis.js.map +0 -1
  281. package/dist/scripts/seed-collaborative-intents.d.ts +0 -2
  282. package/dist/scripts/seed-collaborative-intents.d.ts.map +0 -1
  283. package/dist/scripts/seed-collaborative-intents.js +0 -90
  284. package/dist/scripts/seed-collaborative-intents.js.map +0 -1
  285. package/dist/scripts/test-isolated-config.d.ts +0 -2
  286. package/dist/scripts/test-isolated-config.d.ts.map +0 -1
  287. package/dist/scripts/test-isolated-config.js +0 -80
  288. package/dist/scripts/test-isolated-config.js.map +0 -1
  289. package/dist/scripts/verify_memory_intents.d.ts +0 -2
  290. package/dist/scripts/verify_memory_intents.d.ts.map +0 -1
  291. package/dist/scripts/verify_memory_intents.js +0 -45
  292. package/dist/scripts/verify_memory_intents.js.map +0 -1
  293. package/dist/scripts/verify_redis_intents.d.ts +0 -2
  294. package/dist/scripts/verify_redis_intents.d.ts.map +0 -1
  295. package/dist/scripts/verify_redis_intents.js +0 -52
  296. package/dist/scripts/verify_redis_intents.js.map +0 -1
  297. package/dist/server/ChatFlowWebSocketServer.d.ts +0 -46
  298. package/dist/server/ChatFlowWebSocketServer.d.ts.map +0 -1
  299. package/dist/server/ChatFlowWebSocketServer.js +0 -344
  300. package/dist/server/ChatFlowWebSocketServer.js.map +0 -1
  301. package/dist/server/realtime-voice-server.d.ts +0 -2
  302. package/dist/server/realtime-voice-server.d.ts.map +0 -1
  303. package/dist/server/realtime-voice-server.js +0 -627
  304. package/dist/server/realtime-voice-server.js.map +0 -1
  305. package/dist/src/api/routes/tenants.d.ts +0 -3
  306. package/dist/src/api/routes/tenants.d.ts.map +0 -1
  307. package/dist/src/api/routes/tenants.js +0 -109
  308. package/dist/src/api/routes/tenants.js.map +0 -1
  309. package/dist/utils/crypto.d.ts +0 -7
  310. package/dist/utils/crypto.d.ts.map +0 -1
  311. package/dist/utils/crypto.js +0 -35
  312. package/dist/utils/crypto.js.map +0 -1
  313. package/dist/utils/encryption-helpers.d.ts +0 -14
  314. package/dist/utils/encryption-helpers.d.ts.map +0 -1
  315. package/dist/utils/encryption-helpers.js +0 -49
  316. package/dist/utils/encryption-helpers.js.map +0 -1
  317. package/dist/verify_memory_intents.js +0 -44
  318. package/dist/verify_redis_intents.js +0 -49
  319. package/dist/workflow/MockWorkflowAdapter.d.ts +0 -5
  320. package/dist/workflow/MockWorkflowAdapter.d.ts.map +0 -1
  321. package/dist/workflow/MockWorkflowAdapter.js +0 -162
  322. package/dist/workflow/MockWorkflowAdapter.js.map +0 -1
@@ -1,71 +0,0 @@
1
- /**
2
- * Base error class for all Chat-Flow errors
3
- */
4
- export declare class ChatFlowError extends Error {
5
- readonly code: string;
6
- readonly statusCode: number;
7
- readonly details?: Record<string, any> | undefined;
8
- constructor(message: string, code: string, statusCode?: number, details?: Record<string, any> | undefined);
9
- toJSON(): {
10
- name: string;
11
- message: string;
12
- code: string;
13
- statusCode: number;
14
- details: Record<string, any> | undefined;
15
- };
16
- }
17
- /**
18
- * Error thrown when a session is not found
19
- */
20
- export declare class SessionNotFoundError extends ChatFlowError {
21
- constructor(sessionId: string);
22
- }
23
- /**
24
- * Error thrown when session creation fails
25
- */
26
- export declare class SessionCreationError extends ChatFlowError {
27
- constructor(reason: string, details?: Record<string, any>);
28
- }
29
- /**
30
- * Error thrown when intent detection fails
31
- */
32
- export declare class IntentDetectionError extends ChatFlowError {
33
- constructor(reason: string, details?: Record<string, any>);
34
- }
35
- /**
36
- * Error thrown when intent is not found
37
- */
38
- export declare class IntentNotFoundError extends ChatFlowError {
39
- constructor(intentName: string);
40
- }
41
- /**
42
- * Error thrown when workflow execution fails
43
- */
44
- export declare class WorkflowExecutionError extends ChatFlowError {
45
- constructor(workflowId: string, reason: string, details?: Record<string, any>);
46
- }
47
- /**
48
- * Error thrown when LLM operations fail
49
- */
50
- export declare class LLMError extends ChatFlowError {
51
- constructor(reason: string, details?: Record<string, any>);
52
- }
53
- /**
54
- * Error thrown when repository operations fail
55
- */
56
- export declare class RepositoryError extends ChatFlowError {
57
- constructor(operation: string, reason: string, details?: Record<string, any>);
58
- }
59
- /**
60
- * Error thrown when validation fails
61
- */
62
- export declare class ValidationError extends ChatFlowError {
63
- constructor(field: string, reason: string);
64
- }
65
- /**
66
- * Error thrown when configuration is invalid
67
- */
68
- export declare class ConfigurationError extends ChatFlowError {
69
- constructor(reason: string, details?: Record<string, any>);
70
- }
71
- //# sourceMappingURL=ChatFlowError.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatFlowError.d.ts","sourceRoot":"","sources":["../../../src/core/errors/ChatFlowError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,qBA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,aAAa;gBAClC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAQ5C;AAED;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,aAAa;gBACrC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;CAQ5D"}
@@ -1,108 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigurationError = exports.ValidationError = exports.RepositoryError = exports.LLMError = exports.WorkflowExecutionError = exports.IntentNotFoundError = exports.IntentDetectionError = exports.SessionCreationError = exports.SessionNotFoundError = exports.ChatFlowError = void 0;
4
- /**
5
- * Base error class for all Chat-Flow errors
6
- */
7
- class ChatFlowError extends Error {
8
- constructor(message, code, statusCode = 500, details) {
9
- super(message);
10
- this.code = code;
11
- this.statusCode = statusCode;
12
- this.details = details;
13
- this.name = this.constructor.name;
14
- Error.captureStackTrace(this, this.constructor);
15
- }
16
- toJSON() {
17
- return {
18
- name: this.name,
19
- message: this.message,
20
- code: this.code,
21
- statusCode: this.statusCode,
22
- details: this.details
23
- };
24
- }
25
- }
26
- exports.ChatFlowError = ChatFlowError;
27
- /**
28
- * Error thrown when a session is not found
29
- */
30
- class SessionNotFoundError extends ChatFlowError {
31
- constructor(sessionId) {
32
- super(`Session ${sessionId} not found`, 'SESSION_NOT_FOUND', 404, { sessionId });
33
- }
34
- }
35
- exports.SessionNotFoundError = SessionNotFoundError;
36
- /**
37
- * Error thrown when session creation fails
38
- */
39
- class SessionCreationError extends ChatFlowError {
40
- constructor(reason, details) {
41
- super(`Failed to create session: ${reason}`, 'SESSION_CREATION_FAILED', 500, details);
42
- }
43
- }
44
- exports.SessionCreationError = SessionCreationError;
45
- /**
46
- * Error thrown when intent detection fails
47
- */
48
- class IntentDetectionError extends ChatFlowError {
49
- constructor(reason, details) {
50
- super(`Intent detection failed: ${reason}`, 'INTENT_DETECTION_FAILED', 500, details);
51
- }
52
- }
53
- exports.IntentDetectionError = IntentDetectionError;
54
- /**
55
- * Error thrown when intent is not found
56
- */
57
- class IntentNotFoundError extends ChatFlowError {
58
- constructor(intentName) {
59
- super(`Intent ${intentName} not found`, 'INTENT_NOT_FOUND', 404, { intentName });
60
- }
61
- }
62
- exports.IntentNotFoundError = IntentNotFoundError;
63
- /**
64
- * Error thrown when workflow execution fails
65
- */
66
- class WorkflowExecutionError extends ChatFlowError {
67
- constructor(workflowId, reason, details) {
68
- super(`Workflow ${workflowId} execution failed: ${reason}`, 'WORKFLOW_EXECUTION_FAILED', 500, { workflowId, ...details });
69
- }
70
- }
71
- exports.WorkflowExecutionError = WorkflowExecutionError;
72
- /**
73
- * Error thrown when LLM operations fail
74
- */
75
- class LLMError extends ChatFlowError {
76
- constructor(reason, details) {
77
- super(`LLM operation failed: ${reason}`, 'LLM_OPERATION_FAILED', 500, details);
78
- }
79
- }
80
- exports.LLMError = LLMError;
81
- /**
82
- * Error thrown when repository operations fail
83
- */
84
- class RepositoryError extends ChatFlowError {
85
- constructor(operation, reason, details) {
86
- super(`Repository ${operation} failed: ${reason}`, 'REPOSITORY_OPERATION_FAILED', 500, { operation, ...details });
87
- }
88
- }
89
- exports.RepositoryError = RepositoryError;
90
- /**
91
- * Error thrown when validation fails
92
- */
93
- class ValidationError extends ChatFlowError {
94
- constructor(field, reason) {
95
- super(`Validation failed for ${field}: ${reason}`, 'VALIDATION_FAILED', 400, { field });
96
- }
97
- }
98
- exports.ValidationError = ValidationError;
99
- /**
100
- * Error thrown when configuration is invalid
101
- */
102
- class ConfigurationError extends ChatFlowError {
103
- constructor(reason, details) {
104
- super(`Configuration error: ${reason}`, 'CONFIGURATION_ERROR', 500, details);
105
- }
106
- }
107
- exports.ConfigurationError = ConfigurationError;
108
- //# sourceMappingURL=ChatFlowError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChatFlowError.js","sourceRoot":"","sources":["../../../src/core/errors/ChatFlowError.ts"],"names":[],"mappings":";;;AAAA;;GAEG;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1,2 +0,0 @@
1
- export { ChatFlowError, SessionNotFoundError, SessionCreationError, IntentDetectionError, IntentNotFoundError, WorkflowExecutionError, LLMError, RepositoryError, ValidationError, ConfigurationError } from './ChatFlowError';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,aAAa,EACb,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,QAAQ,EACR,eAAe,EACf,eAAe,EACf,kBAAkB,EACrB,MAAM,iBAAiB,CAAC"}
@@ -1,15 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ConfigurationError = exports.ValidationError = exports.RepositoryError = exports.LLMError = exports.WorkflowExecutionError = exports.IntentNotFoundError = exports.IntentDetectionError = exports.SessionCreationError = exports.SessionNotFoundError = exports.ChatFlowError = void 0;
4
- var ChatFlowError_1 = require("./ChatFlowError");
5
- Object.defineProperty(exports, "ChatFlowError", { enumerable: true, get: function () { return ChatFlowError_1.ChatFlowError; } });
6
- Object.defineProperty(exports, "SessionNotFoundError", { enumerable: true, get: function () { return ChatFlowError_1.SessionNotFoundError; } });
7
- Object.defineProperty(exports, "SessionCreationError", { enumerable: true, get: function () { return ChatFlowError_1.SessionCreationError; } });
8
- Object.defineProperty(exports, "IntentDetectionError", { enumerable: true, get: function () { return ChatFlowError_1.IntentDetectionError; } });
9
- Object.defineProperty(exports, "IntentNotFoundError", { enumerable: true, get: function () { return ChatFlowError_1.IntentNotFoundError; } });
10
- Object.defineProperty(exports, "WorkflowExecutionError", { enumerable: true, get: function () { return ChatFlowError_1.WorkflowExecutionError; } });
11
- Object.defineProperty(exports, "LLMError", { enumerable: true, get: function () { return ChatFlowError_1.LLMError; } });
12
- Object.defineProperty(exports, "RepositoryError", { enumerable: true, get: function () { return ChatFlowError_1.RepositoryError; } });
13
- Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return ChatFlowError_1.ValidationError; } });
14
- Object.defineProperty(exports, "ConfigurationError", { enumerable: true, get: function () { return ChatFlowError_1.ConfigurationError; } });
15
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/errors/index.ts"],"names":[],"mappings":";;;AAAA,iDAWyB;AAVrB,8GAAA,aAAa,OAAA;AACb,qHAAA,oBAAoB,OAAA;AACpB,qHAAA,oBAAoB,OAAA;AACpB,qHAAA,oBAAoB,OAAA;AACpB,oHAAA,mBAAmB,OAAA;AACnB,uHAAA,sBAAsB,OAAA;AACtB,yGAAA,QAAQ,OAAA;AACR,gHAAA,eAAe,OAAA;AACf,gHAAA,eAAe,OAAA;AACf,mHAAA,kBAAkB,OAAA"}
@@ -1,33 +0,0 @@
1
- import { Buffer } from 'buffer';
2
- /**
3
- * Audio Stream Buffer
4
- *
5
- * Efficiently accumulates binary audio chunks from a WebSocket stream.
6
- * Provides methods to append data and flush the buffer for processing (STT).
7
- */
8
- export declare class AudioStreamBuffer {
9
- private chunks;
10
- private totalLength;
11
- /**
12
- * Append a binary chunk to the stream
13
- */
14
- append(chunk: Buffer): void;
15
- /**
16
- * Get current size of buffer in bytes
17
- */
18
- get size(): number;
19
- /**
20
- * Clear buffer
21
- */
22
- clear(): void;
23
- /**
24
- * Flush the buffer and return the concatenated audio data.
25
- * Optionally clears the buffer after flushing.
26
- */
27
- flush(clear?: boolean): Buffer;
28
- /**
29
- * Output Base64 string (for legacy STT APIs that expect Base64)
30
- */
31
- toBase64(clear?: boolean): string;
32
- }
33
- //# sourceMappingURL=AudioStreamBuffer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioStreamBuffer.d.ts","sourceRoot":"","sources":["../../../src/core/utils/AudioStreamBuffer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;;;GAKG;AACH,qBAAa,iBAAiB;IAC1B,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,WAAW,CAAa;IAEhC;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAK3B;;OAEG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;;OAGG;IACH,KAAK,CAAC,KAAK,GAAE,OAAc,GAAG,MAAM;IAUpC;;OAEG;IACH,QAAQ,CAAC,KAAK,GAAE,OAAc,GAAG,MAAM;CAG1C"}
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.AudioStreamBuffer = void 0;
4
- const buffer_1 = require("buffer");
5
- /**
6
- * Audio Stream Buffer
7
- *
8
- * Efficiently accumulates binary audio chunks from a WebSocket stream.
9
- * Provides methods to append data and flush the buffer for processing (STT).
10
- */
11
- class AudioStreamBuffer {
12
- constructor() {
13
- this.chunks = [];
14
- this.totalLength = 0;
15
- }
16
- /**
17
- * Append a binary chunk to the stream
18
- */
19
- append(chunk) {
20
- this.chunks.push(chunk);
21
- this.totalLength += chunk.length;
22
- }
23
- /**
24
- * Get current size of buffer in bytes
25
- */
26
- get size() {
27
- return this.totalLength;
28
- }
29
- /**
30
- * Clear buffer
31
- */
32
- clear() {
33
- this.chunks = [];
34
- this.totalLength = 0;
35
- }
36
- /**
37
- * Flush the buffer and return the concatenated audio data.
38
- * Optionally clears the buffer after flushing.
39
- */
40
- flush(clear = true) {
41
- const result = buffer_1.Buffer.concat(this.chunks, this.totalLength);
42
- if (clear) {
43
- this.clear();
44
- }
45
- return result;
46
- }
47
- /**
48
- * Output Base64 string (for legacy STT APIs that expect Base64)
49
- */
50
- toBase64(clear = true) {
51
- return this.flush(clear).toString('base64');
52
- }
53
- }
54
- exports.AudioStreamBuffer = AudioStreamBuffer;
55
- //# sourceMappingURL=AudioStreamBuffer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioStreamBuffer.js","sourceRoot":"","sources":["../../../src/core/utils/AudioStreamBuffer.ts"],"names":[],"mappings":";;;AAAA,mCAAgC;AAEhC;;;;;GAKG;AACH,MAAa,iBAAiB;IAA9B;QACY,WAAM,GAAa,EAAE,CAAC;QACtB,gBAAW,GAAW,CAAC,CAAC;IA6CpC,CAAC;IA3CG;;OAEG;IACH,MAAM,CAAC,KAAa;QAChB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,CAAC,WAAW,IAAI,KAAK,CAAC,MAAM,CAAC;IACrC,CAAC;IAED;;OAEG;IACH,IAAI,IAAI;QACJ,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED;;OAEG;IACH,KAAK;QACD,IAAI,CAAC,MAAM,GAAG,EAAE,CAAC;QACjB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;IACzB,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,QAAiB,IAAI;QACvB,MAAM,MAAM,GAAG,eAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC;QAE5D,IAAI,KAAK,EAAE,CAAC;YACR,IAAI,CAAC,KAAK,EAAE,CAAC;QACjB,CAAC;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;IAED;;OAEG;IACH,QAAQ,CAAC,QAAiB,IAAI;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAChD,CAAC;CACJ;AA/CD,8CA+CC"}
@@ -1,41 +0,0 @@
1
- import { AudioFormatMetadata } from '../../interfaces';
2
- /**
3
- * Audio Conversion Utilities
4
- *
5
- * Provides utilities for converting between different audio formats
6
- * All conversions target LINEAR16 PCM at 16kHz mono for consistency
7
- */
8
- export declare const TARGET_SAMPLE_RATE = 16000;
9
- export declare const TARGET_CHANNELS = 1;
10
- export declare const TARGET_BIT_DEPTH = 16;
11
- /**
12
- * Convert incoming audio to target PCM format (16kHz, mono, 16-bit)
13
- */
14
- export declare function convertToTargetFormat(audioData: Buffer, formatMetadata?: AudioFormatMetadata): Promise<Buffer>;
15
- /**
16
- * Extract PCM from WAV file and resample if needed
17
- */
18
- export declare function extractAndResampleWAV(wavData: Buffer, metadata: AudioFormatMetadata): Buffer;
19
- /**
20
- * Convert MP3 to PCM
21
- * For now, we'll use a simple approach - MP3 decoding without external deps
22
- * In production, consider using a library like 'lamejs' or 'mp3-parser'
23
- */
24
- export declare function convertMP3ToPCM(mp3Data: Buffer, metadata: AudioFormatMetadata): Buffer;
25
- /**
26
- * Resample PCM audio to target sample rate
27
- */
28
- export declare function resamplePCM(pcmData: Buffer, metadata: AudioFormatMetadata): Buffer;
29
- /**
30
- * Read a sample from PCM data
31
- */
32
- export declare function readSample(buffer: Buffer, sampleIndex: number, channels: number, bitDepth: number): number;
33
- /**
34
- * Write a sample to PCM data
35
- */
36
- export declare function writeSample(buffer: Buffer, sampleIndex: number, value: number, bitDepth: number): void;
37
- /**
38
- * Create WAV file from raw PCM data
39
- */
40
- export declare function wrapPCMInWAV(pcmData: Buffer): Buffer;
41
- //# sourceMappingURL=AudioUtils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utils/AudioUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD;;;;;GAKG;AAGH,eAAO,MAAM,kBAAkB,QAAQ,CAAC;AACxC,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,CAoBpH;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CA6B5F;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CAQtF;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,mBAAmB,GAAG,MAAM,CA4ClF;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAqB1G;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAQtG;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAiCpD"}
@@ -1,188 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TARGET_BIT_DEPTH = exports.TARGET_CHANNELS = exports.TARGET_SAMPLE_RATE = void 0;
4
- exports.convertToTargetFormat = convertToTargetFormat;
5
- exports.extractAndResampleWAV = extractAndResampleWAV;
6
- exports.convertMP3ToPCM = convertMP3ToPCM;
7
- exports.resamplePCM = resamplePCM;
8
- exports.readSample = readSample;
9
- exports.writeSample = writeSample;
10
- exports.wrapPCMInWAV = wrapPCMInWAV;
11
- /**
12
- * Audio Conversion Utilities
13
- *
14
- * Provides utilities for converting between different audio formats
15
- * All conversions target LINEAR16 PCM at 16kHz mono for consistency
16
- */
17
- // Target audio format for storage
18
- exports.TARGET_SAMPLE_RATE = 16000;
19
- exports.TARGET_CHANNELS = 1;
20
- exports.TARGET_BIT_DEPTH = 16;
21
- /**
22
- * Convert incoming audio to target PCM format (16kHz, mono, 16-bit)
23
- */
24
- async function convertToTargetFormat(audioData, formatMetadata) {
25
- if (!formatMetadata) {
26
- // Assume WAV format if no metadata provided (backward compatibility)
27
- formatMetadata = { format: 'wav', sampleRate: 48000, channels: 1, bitDepth: 16 };
28
- }
29
- switch (formatMetadata.format) {
30
- case 'wav':
31
- return extractAndResampleWAV(audioData, formatMetadata);
32
- case 'mp3':
33
- return convertMP3ToPCM(audioData, formatMetadata);
34
- case 'pcm':
35
- return resamplePCM(audioData, formatMetadata);
36
- default:
37
- console.warn(`[AudioUtils] Unsupported format: ${formatMetadata.format}, storing as-is`);
38
- return audioData;
39
- }
40
- }
41
- /**
42
- * Extract PCM from WAV file and resample if needed
43
- */
44
- function extractAndResampleWAV(wavData, metadata) {
45
- // WAV file structure:
46
- // - RIFF header (12 bytes)
47
- // - fmt chunk (24 bytes typically)
48
- // - data chunk header (8 bytes)
49
- // - PCM data
50
- // Find 'data' chunk
51
- const dataMarker = Buffer.from('data');
52
- let dataStart = -1;
53
- for (let i = 0; i < wavData.length - 4; i++) {
54
- if (wavData.slice(i, i + 4).equals(dataMarker)) {
55
- // Found 'data' marker, PCM starts 8 bytes after (4 for 'data', 4 for size)
56
- dataStart = i + 8;
57
- break;
58
- }
59
- }
60
- if (dataStart === -1) {
61
- console.warn('[AudioUtils] Could not find data chunk in WAV, using entire buffer');
62
- dataStart = 44; // Standard WAV header size
63
- }
64
- // Extract raw PCM data
65
- const pcmData = wavData.slice(dataStart);
66
- // Resample if needed
67
- return resamplePCM(pcmData, metadata);
68
- }
69
- /**
70
- * Convert MP3 to PCM
71
- * For now, we'll use a simple approach - MP3 decoding without external deps
72
- * In production, consider using a library like 'lamejs' or 'mp3-parser'
73
- */
74
- function convertMP3ToPCM(mp3Data, metadata) {
75
- // MP3 decoding is complex. For now, we'll log a warning and pass through
76
- // The user should ideally change the provider output to WAV format
77
- console.warn('[AudioUtils] MP3 decoding not yet implemented. Audio may not concatenate properly.');
78
- console.warn('[AudioUtils] Consider changing provider output format to WAV.');
79
- // Return as-is for now - this will need proper MP3 decoder
80
- return mp3Data;
81
- }
82
- /**
83
- * Resample PCM audio to target sample rate
84
- */
85
- function resamplePCM(pcmData, metadata) {
86
- const sourceSampleRate = metadata.sampleRate || exports.TARGET_SAMPLE_RATE;
87
- const sourceChannels = metadata.channels || exports.TARGET_CHANNELS;
88
- const sourceBitDepth = metadata.bitDepth || exports.TARGET_BIT_DEPTH;
89
- // If already in target format, return as-is
90
- if (sourceSampleRate === exports.TARGET_SAMPLE_RATE &&
91
- sourceChannels === exports.TARGET_CHANNELS &&
92
- sourceBitDepth === exports.TARGET_BIT_DEPTH) {
93
- return pcmData;
94
- }
95
- // Calculate bytes per sample
96
- const sourceBytesPerSample = (sourceBitDepth / 8) * sourceChannels;
97
- const targetBytesPerSample = (exports.TARGET_BIT_DEPTH / 8) * exports.TARGET_CHANNELS;
98
- // Calculate number of samples
99
- const sourceSampleCount = Math.floor(pcmData.length / sourceBytesPerSample);
100
- const targetSampleCount = Math.floor((sourceSampleCount * exports.TARGET_SAMPLE_RATE) / sourceSampleRate);
101
- // Create output buffer
102
- const output = Buffer.alloc(targetSampleCount * targetBytesPerSample);
103
- // Simple linear interpolation resampling
104
- for (let i = 0; i < targetSampleCount; i++) {
105
- const sourceIndex = (i * sourceSampleRate) / exports.TARGET_SAMPLE_RATE;
106
- const sourceIndexFloor = Math.floor(sourceIndex);
107
- const sourceIndexCeil = Math.ceil(sourceIndex);
108
- const fraction = sourceIndex - sourceIndexFloor;
109
- // Get samples (handle stereo to mono conversion if needed)
110
- let sample1 = readSample(pcmData, sourceIndexFloor, sourceChannels, sourceBitDepth);
111
- let sample2 = readSample(pcmData, sourceIndexCeil < sourceSampleCount ? sourceIndexCeil : sourceIndexFloor, sourceChannels, sourceBitDepth);
112
- // Interpolate
113
- const interpolated = Math.round(sample1 * (1 - fraction) + sample2 * fraction);
114
- // Write sample
115
- writeSample(output, i, interpolated, exports.TARGET_BIT_DEPTH);
116
- }
117
- return output;
118
- }
119
- /**
120
- * Read a sample from PCM data
121
- */
122
- function readSample(buffer, sampleIndex, channels, bitDepth) {
123
- const bytesPerSample = (bitDepth / 8) * channels;
124
- const offset = sampleIndex * bytesPerSample;
125
- if (offset >= buffer.length) {
126
- return 0;
127
- }
128
- // Read first channel (mono or left channel for stereo)
129
- if (bitDepth === 16) {
130
- return buffer.readInt16LE(offset);
131
- }
132
- else if (bitDepth === 8) {
133
- return buffer.readInt8(offset) * 256; // Scale to 16-bit range
134
- }
135
- else if (bitDepth === 24) {
136
- const byte1 = buffer.readUInt8(offset);
137
- const byte2 = buffer.readUInt8(offset + 1);
138
- const byte3 = buffer.readInt8(offset + 2);
139
- return ((byte3 << 16) | (byte2 << 8) | byte1) >> 8; // Scale down to 16-bit
140
- }
141
- else {
142
- return buffer.readInt16LE(offset);
143
- }
144
- }
145
- /**
146
- * Write a sample to PCM data
147
- */
148
- function writeSample(buffer, sampleIndex, value, bitDepth) {
149
- const offset = sampleIndex * (bitDepth / 8);
150
- if (bitDepth === 16) {
151
- // Clamp to 16-bit range
152
- const clamped = Math.max(-32768, Math.min(32767, value));
153
- buffer.writeInt16LE(clamped, offset);
154
- }
155
- }
156
- /**
157
- * Create WAV file from raw PCM data
158
- */
159
- function wrapPCMInWAV(pcmData) {
160
- const sampleRate = exports.TARGET_SAMPLE_RATE;
161
- const channels = exports.TARGET_CHANNELS;
162
- const bitDepth = exports.TARGET_BIT_DEPTH;
163
- const byteRate = sampleRate * channels * (bitDepth / 8);
164
- const blockAlign = channels * (bitDepth / 8);
165
- const dataSize = pcmData.length;
166
- const fileSize = 36 + dataSize;
167
- // Create WAV header
168
- const header = Buffer.alloc(44);
169
- // RIFF chunk descriptor
170
- header.write('RIFF', 0);
171
- header.writeUInt32LE(fileSize, 4);
172
- header.write('WAVE', 8);
173
- // fmt sub-chunk
174
- header.write('fmt ', 12);
175
- header.writeUInt32LE(16, 16); // Subchunk1Size (16 for PCM)
176
- header.writeUInt16LE(1, 20); // AudioFormat (1 for PCM)
177
- header.writeUInt16LE(channels, 22);
178
- header.writeUInt32LE(sampleRate, 24);
179
- header.writeUInt32LE(byteRate, 28);
180
- header.writeUInt16LE(blockAlign, 32);
181
- header.writeUInt16LE(bitDepth, 34);
182
- // data sub-chunk
183
- header.write('data', 36);
184
- header.writeUInt32LE(dataSize, 40);
185
- // Concatenate header and PCM data
186
- return Buffer.concat([header, pcmData]);
187
- }
188
- //# sourceMappingURL=AudioUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AudioUtils.js","sourceRoot":"","sources":["../../../src/core/utils/AudioUtils.ts"],"names":[],"mappings":";;;AAiBA,sDAoBC;AAKD,sDA6BC;AAOD,0CAQC;AAKD,kCA4CC;AAKD,gCAqBC;AAKD,kCAQC;AAKD,oCAiCC;AAlND;;;;;GAKG;AAEH,kCAAkC;AACrB,QAAA,kBAAkB,GAAG,KAAK,CAAC;AAC3B,QAAA,eAAe,GAAG,CAAC,CAAC;AACpB,QAAA,gBAAgB,GAAG,EAAE,CAAC;AAEnC;;GAEG;AACI,KAAK,UAAU,qBAAqB,CAAC,SAAiB,EAAE,cAAoC;IAC/F,IAAI,CAAC,cAAc,EAAE,CAAC;QAClB,qEAAqE;QACrE,cAAc,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC;IACrF,CAAC;IAED,QAAQ,cAAc,CAAC,MAAM,EAAE,CAAC;QAC5B,KAAK,KAAK;YACN,OAAO,qBAAqB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAE5D,KAAK,KAAK;YACN,OAAO,eAAe,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAEtD,KAAK,KAAK;YACN,OAAO,WAAW,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;QAElD;YACI,OAAO,CAAC,IAAI,CAAC,oCAAoC,cAAc,CAAC,MAAM,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oB;IACpB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAEhC,wBAAwB;IACxB,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IACxB,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;IAClC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;IAExB,gBAAgB;IAChB,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzB,MAAM,CAAC,aAAa,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,6BAA6B;IAC3D,MAAM,CAAC,aAAa,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAE,0BAA0B;IACxD,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACnC,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IACnC,MAAM,CAAC,aAAa,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACrC,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEnC,iBAAiB;IACjB,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACzB,MAAM,CAAC,aAAa,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;IAEnC,kCAAkC;IAClC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;AAC5C,CAAC"}
@@ -1,52 +0,0 @@
1
- import { ILLMAdapter } from '../../interfaces';
2
- /**
3
- * Language Detection Utility
4
- *
5
- * Detects the language of user messages using LLM analysis.
6
- * Returns ISO 639-1 language codes (e.g., 'en', 'ar', 'fa', 'es').
7
- */
8
- export declare class LanguageDetector {
9
- private llm;
10
- private cache;
11
- constructor(llm: ILLMAdapter);
12
- /**
13
- * Detect language from text
14
- * @param text Text to analyze
15
- * @param languageHints Optional array of preferred languages (e.g., from supportedLanguages config)
16
- * @returns ISO 639-1 language code (e.g., 'en', 'ar', 'fa')
17
- */
18
- detectLanguage(text: string, languageHints?: string[]): Promise<string>;
19
- /**
20
- * Detect if text uses a specific character set (fast heuristic)
21
- * This avoids expensive LLM calls when character set hasn't changed
22
- * @param text Text to analyze
23
- * @returns Character set type
24
- */
25
- detectCharacterSet(text: string): 'arabic' | 'persian' | 'cjk' | 'cyrillic' | 'latin';
26
- /**
27
- * Check if character set changed from previous language
28
- * @param text Current text
29
- * @param previousLanguage Previously detected language code
30
- * @returns True if character set changed, suggesting language might have changed
31
- */
32
- hasCharacterSetChanged(text: string, previousLanguage: string | null): boolean;
33
- /**
34
- * Get expected character set for a language code
35
- */
36
- private getCharacterSetForLanguage;
37
- /**
38
- * Get language name from code
39
- * @param code ISO 639-1 language code
40
- * @returns Human-readable language name
41
- */
42
- getLanguageName(code: string): string;
43
- /**
44
- * Clear the cache
45
- */
46
- clearCache(): void;
47
- /**
48
- * Generate cache key from text
49
- */
50
- private getCacheKey;
51
- }
52
- //# sourceMappingURL=LanguageDetector.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LanguageDetector.d.ts","sourceRoot":"","sources":["../../../src/core/utils/LanguageDetector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C;;;;;GAKG;AACH,qBAAa,gBAAgB;IAGb,OAAO,CAAC,GAAG;IAFvB,OAAO,CAAC,KAAK,CAAkC;gBAE3B,GAAG,EAAE,WAAW;IAEpC;;;;;OAKG;IACG,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IA2D7E;;;;;OAKG;IACH,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,UAAU,GAAG,OAAO;IAwBrF;;;;;OAKG;IACH,sBAAsB,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO;IAS9E;;OAEG;IACH,OAAO,CAAC,0BAA0B;IAclC;;;;OAIG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IA2BrC;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,OAAO,CAAC,WAAW;CAItB"}