@gaia-framework/backend-core 7.0.0 → 7.1.0-rc.0

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 (338) hide show
  1. package/CHANGELOG.md +13 -0
  2. package/build/openapi/openapi.json +502 -2
  3. package/build/openapi/openapi.yaml +362 -9
  4. package/build/openapi/voice-media-worker.json +1 -1
  5. package/build/openapi/voice-media-worker.yaml +1 -1
  6. package/build/openapi/worker-health.json +1 -1
  7. package/build/openapi/worker-health.yaml +1 -1
  8. package/build/src/config/schema.d.ts +87 -0
  9. package/build/src/config/schema.d.ts.map +1 -1
  10. package/build/src/config/schema.js +57 -1
  11. package/build/src/config/schema.js.map +1 -1
  12. package/build/src/core/application/dtos/llms/responses/LLMInfoDto.d.ts +2 -1
  13. package/build/src/core/application/dtos/llms/responses/LLMInfoDto.d.ts.map +1 -1
  14. package/build/src/core/application/mappers/llms/LLMInfoMapper.d.ts.map +1 -1
  15. package/build/src/core/application/mappers/llms/LLMInfoMapper.js +2 -0
  16. package/build/src/core/application/mappers/llms/LLMInfoMapper.js.map +1 -1
  17. package/build/src/core/application/services/media/VideoGenerationRequestService.js +2 -2
  18. package/build/src/core/application/services/media/VideoGenerationRequestService.js.map +1 -1
  19. package/build/src/core/application/services/runs/RunAppServiceImpl.d.ts.map +1 -1
  20. package/build/src/core/application/services/runs/RunAppServiceImpl.js +16 -4
  21. package/build/src/core/application/services/runs/RunAppServiceImpl.js.map +1 -1
  22. package/build/src/core/application/services/tasks/ScheduledRunDispatchService.d.ts.map +1 -1
  23. package/build/src/core/application/services/tasks/ScheduledRunDispatchService.js +9 -2
  24. package/build/src/core/application/services/tasks/ScheduledRunDispatchService.js.map +1 -1
  25. package/build/src/core/application/services/voice/session/VoiceContextService.js +1 -1
  26. package/build/src/core/application/services/voice/session/VoiceContextService.js.map +1 -1
  27. package/build/src/core/domain/models/llms/LLMInfo.d.ts +2 -1
  28. package/build/src/core/domain/models/llms/LLMInfo.d.ts.map +1 -1
  29. package/build/src/core/domain/models/runs/RunApproval.d.ts +1 -1
  30. package/build/src/core/domain/models/runs/RunApproval.d.ts.map +1 -1
  31. package/build/src/core/domain/models/runs/RunApproval.js.map +1 -1
  32. package/build/src/core/domain/models/speech/Transcription.d.ts +1 -0
  33. package/build/src/core/domain/models/speech/Transcription.d.ts.map +1 -1
  34. package/build/src/core/domain/models/videos/VideoGenerationRequest.d.ts +2 -0
  35. package/build/src/core/domain/models/videos/VideoGenerationRequest.d.ts.map +1 -1
  36. package/build/src/core/domain/models/videos/VideoGenerationRequest.js +5 -1
  37. package/build/src/core/domain/models/videos/VideoGenerationRequest.js.map +1 -1
  38. package/build/src/core/domain/services/chat/ConversationContextService.d.ts +1 -1
  39. package/build/src/core/domain/services/chat/ConversationContextService.d.ts.map +1 -1
  40. package/build/src/core/domain/services/chat/ConversationContextServiceImpl.d.ts +1 -1
  41. package/build/src/core/domain/services/chat/ConversationContextServiceImpl.d.ts.map +1 -1
  42. package/build/src/core/domain/services/chat/ConversationContextServiceImpl.js +12 -3
  43. package/build/src/core/domain/services/chat/ConversationContextServiceImpl.js.map +1 -1
  44. package/build/src/core/domain/services/chat/LLMExecutionServiceImpl.d.ts.map +1 -1
  45. package/build/src/core/domain/services/chat/LLMExecutionServiceImpl.js +4 -1
  46. package/build/src/core/domain/services/chat/LLMExecutionServiceImpl.js.map +1 -1
  47. package/build/src/core/domain/services/chat/VideoInputPolicy.d.ts +5 -0
  48. package/build/src/core/domain/services/chat/VideoInputPolicy.d.ts.map +1 -0
  49. package/build/src/core/domain/services/chat/VideoInputPolicy.js +14 -0
  50. package/build/src/core/domain/services/chat/VideoInputPolicy.js.map +1 -0
  51. package/build/src/core/domain/services/media/TranscriptionPolicy.js +1 -1
  52. package/build/src/core/domain/services/media/TranscriptionPolicy.js.map +1 -1
  53. package/build/src/core/domain/services/models/ModelServiceImpl.d.ts.map +1 -1
  54. package/build/src/core/domain/services/models/ModelServiceImpl.js +4 -2
  55. package/build/src/core/domain/services/models/ModelServiceImpl.js.map +1 -1
  56. package/build/src/core/domain/services/runs/RunToolApprovalProviderCapability.d.ts.map +1 -1
  57. package/build/src/core/domain/services/runs/RunToolApprovalProviderCapability.js +4 -2
  58. package/build/src/core/domain/services/runs/RunToolApprovalProviderCapability.js.map +1 -1
  59. package/build/src/core/infrastructure/ai/alibaba/AlibabaWorkspace.d.ts +8 -0
  60. package/build/src/core/infrastructure/ai/alibaba/AlibabaWorkspace.d.ts.map +1 -0
  61. package/build/src/core/infrastructure/ai/alibaba/AlibabaWorkspace.js +16 -0
  62. package/build/src/core/infrastructure/ai/alibaba/AlibabaWorkspace.js.map +1 -0
  63. package/build/src/core/infrastructure/ai/embedding/providers/google/GoogleAIEmbeddingService.d.ts +2 -3
  64. package/build/src/core/infrastructure/ai/embedding/providers/google/GoogleAIEmbeddingService.d.ts.map +1 -1
  65. package/build/src/core/infrastructure/ai/embedding/providers/google/GoogleAIEmbeddingService.js +42 -17
  66. package/build/src/core/infrastructure/ai/embedding/providers/google/GoogleAIEmbeddingService.js.map +1 -1
  67. package/build/src/core/infrastructure/ai/google/GoogleGenAiConnection.d.ts +15 -0
  68. package/build/src/core/infrastructure/ai/google/GoogleGenAiConnection.d.ts.map +1 -0
  69. package/build/src/core/infrastructure/ai/google/GoogleGenAiConnection.js +21 -0
  70. package/build/src/core/infrastructure/ai/google/GoogleGenAiConnection.js.map +1 -0
  71. package/build/src/core/infrastructure/ai/images/alibaba/QwenImageProviders.d.ts +36 -0
  72. package/build/src/core/infrastructure/ai/images/alibaba/QwenImageProviders.d.ts.map +1 -0
  73. package/build/src/core/infrastructure/ai/images/alibaba/QwenImageProviders.js +108 -0
  74. package/build/src/core/infrastructure/ai/images/alibaba/QwenImageProviders.js.map +1 -0
  75. package/build/src/core/infrastructure/ai/images/google/GoogleAIImageGenerationProvider.d.ts +3 -3
  76. package/build/src/core/infrastructure/ai/images/google/GoogleAIImageGenerationProvider.d.ts.map +1 -1
  77. package/build/src/core/infrastructure/ai/images/google/GoogleAIImageGenerationProvider.js +36 -25
  78. package/build/src/core/infrastructure/ai/images/google/GoogleAIImageGenerationProvider.js.map +1 -1
  79. package/build/src/core/infrastructure/ai/images/togetherai/TogetherImageGenerationProvider.d.ts +12 -0
  80. package/build/src/core/infrastructure/ai/images/togetherai/TogetherImageGenerationProvider.d.ts.map +1 -0
  81. package/build/src/core/infrastructure/ai/images/togetherai/TogetherImageGenerationProvider.js +97 -0
  82. package/build/src/core/infrastructure/ai/images/togetherai/TogetherImageGenerationProvider.js.map +1 -0
  83. package/build/src/core/infrastructure/ai/llm/context/codecs/RunMediaContextCodecs.js +3 -1
  84. package/build/src/core/infrastructure/ai/llm/context/codecs/RunMediaContextCodecs.js.map +1 -1
  85. package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaCatalog.d.ts +12 -0
  86. package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaCatalog.d.ts.map +1 -0
  87. package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaCatalog.js +46 -0
  88. package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaCatalog.js.map +1 -0
  89. package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaLLMProvider.d.ts +24 -0
  90. package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaLLMProvider.d.ts.map +1 -0
  91. package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaLLMProvider.js +100 -0
  92. package/build/src/core/infrastructure/ai/llm/providers/alibaba/AlibabaLLMProvider.js.map +1 -0
  93. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockCatalog.d.ts +53 -0
  94. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockCatalog.d.ts.map +1 -0
  95. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockCatalog.js +178 -0
  96. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockCatalog.js.map +1 -0
  97. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.d.ts +19 -0
  98. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.d.ts.map +1 -0
  99. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.js +59 -0
  100. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockLLMProvider.js.map +1 -0
  101. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.d.ts +8 -0
  102. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.d.ts.map +1 -0
  103. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.js +72 -0
  104. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockMessages.js.map +1 -0
  105. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.d.ts +28 -0
  106. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.d.ts.map +1 -0
  107. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.js +117 -0
  108. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockOutput.js.map +1 -0
  109. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockService.d.ts +44 -0
  110. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockService.d.ts.map +1 -0
  111. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockService.js +148 -0
  112. package/build/src/core/infrastructure/ai/llm/providers/bedrock/BedrockService.js.map +1 -0
  113. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleAIService.d.ts +6 -2
  114. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleAIService.d.ts.map +1 -1
  115. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleAIService.js +47 -37
  116. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleAIService.js.map +1 -1
  117. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleApprovalCoordinator.d.ts +3 -1
  118. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleApprovalCoordinator.d.ts.map +1 -1
  119. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleApprovalCoordinator.js +16 -8
  120. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleApprovalCoordinator.js.map +1 -1
  121. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleChatRoute.d.ts +12 -0
  122. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleChatRoute.d.ts.map +1 -0
  123. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleChatRoute.js +12 -0
  124. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleChatRoute.js.map +1 -0
  125. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleConfig.d.ts.map +1 -1
  126. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleConfig.js +6 -1
  127. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleConfig.js.map +1 -1
  128. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleLLMProvider.d.ts +1 -1
  129. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleLLMProvider.d.ts.map +1 -1
  130. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleLLMProvider.js +12 -6
  131. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleLLMProvider.js.map +1 -1
  132. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleStructuredOutputPolicy.d.ts.map +1 -1
  133. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleStructuredOutputPolicy.js +3 -0
  134. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleStructuredOutputPolicy.js.map +1 -1
  135. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleTokenCountRequest.d.ts +1 -1
  136. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleTokenCountRequest.d.ts.map +1 -1
  137. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleTokenCountRequest.js +14 -1
  138. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleTokenCountRequest.js.map +1 -1
  139. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleToolLoop.d.ts +1 -0
  140. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleToolLoop.d.ts.map +1 -1
  141. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleToolLoop.js +2 -2
  142. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleToolLoop.js.map +1 -1
  143. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleVideoFiles.d.ts +19 -0
  144. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleVideoFiles.d.ts.map +1 -0
  145. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleVideoFiles.js +170 -0
  146. package/build/src/core/infrastructure/ai/llm/providers/google/GoogleVideoFiles.js.map +1 -0
  147. package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatProfiles.d.ts +4 -0
  148. package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatProfiles.d.ts.map +1 -0
  149. package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatProfiles.js +42 -0
  150. package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatProfiles.js.map +1 -0
  151. package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatVideo.d.ts +25 -0
  152. package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatVideo.d.ts.map +1 -0
  153. package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatVideo.js +106 -0
  154. package/build/src/core/infrastructure/ai/llm/providers/google/VertexChatVideo.js.map +1 -0
  155. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleLiveSocket.d.ts +5 -1
  156. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleLiveSocket.d.ts.map +1 -1
  157. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleLiveSocket.js +37 -5
  158. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleLiveSocket.js.map +1 -1
  159. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeConfig.d.ts +2 -2
  160. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeConfig.d.ts.map +1 -1
  161. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeConfig.js +4 -0
  162. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeConfig.js.map +1 -1
  163. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeEventHandlerREgistry.d.ts +1 -1
  164. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeEventHandlerREgistry.d.ts.map +1 -1
  165. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeEventHandlerREgistry.js +2 -2
  166. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeEventHandlerREgistry.js.map +1 -1
  167. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeProvider.d.ts +6 -1
  168. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeProvider.d.ts.map +1 -1
  169. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeProvider.js +29 -12
  170. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeProvider.js.map +1 -1
  171. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeToolApprovals.d.ts +1 -1
  172. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeToolApprovals.d.ts.map +1 -1
  173. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeToolApprovals.js +2 -2
  174. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeToolApprovals.js.map +1 -1
  175. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeTranslationProvider.d.ts +13 -2
  176. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeTranslationProvider.d.ts.map +1 -1
  177. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeTranslationProvider.js +22 -9
  178. package/build/src/core/infrastructure/ai/llm/providers/google/realtime/GoogleRealtimeTranslationProvider.js.map +1 -1
  179. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceCatalog.d.ts +10 -0
  180. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceCatalog.d.ts.map +1 -0
  181. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceCatalog.js +74 -0
  182. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceCatalog.js.map +1 -0
  183. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceLLMProvider.d.ts +25 -0
  184. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceLLMProvider.d.ts.map +1 -0
  185. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceLLMProvider.js +104 -0
  186. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceLLMProvider.js.map +1 -0
  187. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceResponses.d.ts +40 -0
  188. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceResponses.d.ts.map +1 -0
  189. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceResponses.js +39 -0
  190. package/build/src/core/infrastructure/ai/llm/providers/huggingface/HuggingFaceResponses.js.map +1 -0
  191. package/build/src/core/infrastructure/ai/llm/providers/meta/MetaLLMProvider.d.ts.map +1 -1
  192. package/build/src/core/infrastructure/ai/llm/providers/meta/MetaLLMProvider.js +2 -30
  193. package/build/src/core/infrastructure/ai/llm/providers/meta/MetaLLMProvider.js.map +1 -1
  194. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaCatalog.d.ts +9 -0
  195. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaCatalog.d.ts.map +1 -0
  196. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaCatalog.js +87 -0
  197. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaCatalog.js.map +1 -0
  198. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaService.d.ts +2 -2
  199. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaService.d.ts.map +1 -1
  200. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaService.js +7 -10
  201. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaService.js.map +1 -1
  202. package/build/src/core/infrastructure/ai/llm/providers/openai/responses/createPortableResponsesContext.d.ts +5 -0
  203. package/build/src/core/infrastructure/ai/llm/providers/openai/responses/createPortableResponsesContext.d.ts.map +1 -0
  204. package/build/src/core/infrastructure/ai/llm/providers/openai/responses/createPortableResponsesContext.js +33 -0
  205. package/build/src/core/infrastructure/ai/llm/providers/openai/responses/createPortableResponsesContext.js.map +1 -0
  206. package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherCatalog.d.ts +13 -0
  207. package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherCatalog.d.ts.map +1 -0
  208. package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherCatalog.js +95 -0
  209. package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherCatalog.js.map +1 -0
  210. package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherLLMProvider.d.ts +29 -0
  211. package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherLLMProvider.d.ts.map +1 -0
  212. package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherLLMProvider.js +167 -0
  213. package/build/src/core/infrastructure/ai/llm/providers/togetherai/TogetherLLMProvider.js.map +1 -0
  214. package/build/src/core/infrastructure/ai/speech/GoogleSpeechConnection.d.ts +5 -0
  215. package/build/src/core/infrastructure/ai/speech/GoogleSpeechConnection.d.ts.map +1 -0
  216. package/build/src/core/infrastructure/ai/speech/GoogleSpeechConnection.js +26 -0
  217. package/build/src/core/infrastructure/ai/speech/GoogleSpeechConnection.js.map +1 -0
  218. package/build/src/core/infrastructure/ai/speech/stt/AzureSpeechToTextProvider.d.ts +7 -7
  219. package/build/src/core/infrastructure/ai/speech/stt/AzureSpeechToTextProvider.d.ts.map +1 -1
  220. package/build/src/core/infrastructure/ai/speech/stt/AzureSpeechToTextProvider.js +159 -63
  221. package/build/src/core/infrastructure/ai/speech/stt/AzureSpeechToTextProvider.js.map +1 -1
  222. package/build/src/core/infrastructure/ai/speech/stt/GoogleLiveTranscriptionProvider.d.ts +6 -2
  223. package/build/src/core/infrastructure/ai/speech/stt/GoogleLiveTranscriptionProvider.d.ts.map +1 -1
  224. package/build/src/core/infrastructure/ai/speech/stt/GoogleLiveTranscriptionProvider.js +22 -13
  225. package/build/src/core/infrastructure/ai/speech/stt/GoogleLiveTranscriptionProvider.js.map +1 -1
  226. package/build/src/core/infrastructure/ai/speech/stt/GoogleSpeechToTextProvider.d.ts +12 -6
  227. package/build/src/core/infrastructure/ai/speech/stt/GoogleSpeechToTextProvider.d.ts.map +1 -1
  228. package/build/src/core/infrastructure/ai/speech/stt/GoogleSpeechToTextProvider.js +64 -15
  229. package/build/src/core/infrastructure/ai/speech/stt/GoogleSpeechToTextProvider.js.map +1 -1
  230. package/build/src/core/infrastructure/ai/speech/stt/TogetherSpeechToTextProvider.d.ts +15 -0
  231. package/build/src/core/infrastructure/ai/speech/stt/TogetherSpeechToTextProvider.d.ts.map +1 -0
  232. package/build/src/core/infrastructure/ai/speech/stt/TogetherSpeechToTextProvider.js +81 -0
  233. package/build/src/core/infrastructure/ai/speech/stt/TogetherSpeechToTextProvider.js.map +1 -0
  234. package/build/src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.d.ts +26 -0
  235. package/build/src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.d.ts.map +1 -0
  236. package/build/src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.js +80 -0
  237. package/build/src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.js.map +1 -0
  238. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.d.ts +20 -17
  239. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.d.ts.map +1 -1
  240. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.js +20 -9
  241. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.js.map +1 -1
  242. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.d.ts +2 -1
  243. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.d.ts.map +1 -1
  244. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.js +6 -4
  245. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.js.map +1 -1
  246. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsWorker.js +24 -8
  247. package/build/src/core/infrastructure/ai/speech/tts/google/GoogleTtsWorker.js.map +1 -1
  248. package/build/src/core/infrastructure/ai/tools/implementations/images/ImageEditingTool.js +1 -1
  249. package/build/src/core/infrastructure/ai/tools/implementations/images/ImageEditingTool.js.map +1 -1
  250. package/build/src/core/infrastructure/ai/tools/implementations/images/schemas.d.ts +2 -2
  251. package/build/src/core/infrastructure/ai/tools/implementations/images/schemas.js +2 -2
  252. package/build/src/core/infrastructure/ai/tools/implementations/images/schemas.js.map +1 -1
  253. package/build/src/core/infrastructure/ai/tools/implementations/videos/VideoGenerationToolService.d.ts.map +1 -1
  254. package/build/src/core/infrastructure/ai/tools/implementations/videos/VideoGenerationToolService.js +5 -4
  255. package/build/src/core/infrastructure/ai/tools/implementations/videos/VideoGenerationToolService.js.map +1 -1
  256. package/build/src/core/infrastructure/ai/videos/VideoGenerationProviderRegistryImpl.d.ts.map +1 -1
  257. package/build/src/core/infrastructure/ai/videos/VideoGenerationProviderRegistryImpl.js +4 -1
  258. package/build/src/core/infrastructure/ai/videos/VideoGenerationProviderRegistryImpl.js.map +1 -1
  259. package/build/src/core/infrastructure/ai/videos/alibaba/HappyHorseVideoProvider.d.ts +18 -0
  260. package/build/src/core/infrastructure/ai/videos/alibaba/HappyHorseVideoProvider.d.ts.map +1 -0
  261. package/build/src/core/infrastructure/ai/videos/alibaba/HappyHorseVideoProvider.js +88 -0
  262. package/build/src/core/infrastructure/ai/videos/alibaba/HappyHorseVideoProvider.js.map +1 -0
  263. package/build/src/core/infrastructure/ai/videos/google/GoogleVideoGenerationProvider.d.ts +4 -2
  264. package/build/src/core/infrastructure/ai/videos/google/GoogleVideoGenerationProvider.d.ts.map +1 -1
  265. package/build/src/core/infrastructure/ai/videos/google/GoogleVideoGenerationProvider.js +109 -45
  266. package/build/src/core/infrastructure/ai/videos/google/GoogleVideoGenerationProvider.js.map +1 -1
  267. package/build/src/core/infrastructure/ai/videos/google/VertexVeoOutput.d.ts +10 -0
  268. package/build/src/core/infrastructure/ai/videos/google/VertexVeoOutput.d.ts.map +1 -0
  269. package/build/src/core/infrastructure/ai/videos/google/VertexVeoOutput.js +43 -0
  270. package/build/src/core/infrastructure/ai/videos/google/VertexVeoOutput.js.map +1 -0
  271. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoAdapter.d.ts +3 -2
  272. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoAdapter.d.ts.map +1 -1
  273. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoAdapter.js +7 -7
  274. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoAdapter.js.map +1 -1
  275. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoOutput.d.ts.map +1 -1
  276. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoOutput.js +4 -4
  277. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoOutput.js.map +1 -1
  278. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoProtocol.d.ts +3 -2
  279. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoProtocol.d.ts.map +1 -1
  280. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoProtocol.js +13 -4
  281. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoProtocol.js.map +1 -1
  282. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoWorker.js +27 -23
  283. package/build/src/core/infrastructure/ai/videos/google/omni/OmniVideoWorker.js.map +1 -1
  284. package/build/src/core/infrastructure/ai/videos/togetherai/TogetherVideoGenerationProvider.d.ts +14 -0
  285. package/build/src/core/infrastructure/ai/videos/togetherai/TogetherVideoGenerationProvider.d.ts.map +1 -0
  286. package/build/src/core/infrastructure/ai/videos/togetherai/TogetherVideoGenerationProvider.js +113 -0
  287. package/build/src/core/infrastructure/ai/videos/togetherai/TogetherVideoGenerationProvider.js.map +1 -0
  288. package/build/src/core/infrastructure/api/v1/controllers/models/ModelsController.d.ts.map +1 -1
  289. package/build/src/core/infrastructure/api/v1/controllers/models/ModelsController.js +12 -2
  290. package/build/src/core/infrastructure/api/v1/controllers/models/ModelsController.js.map +1 -1
  291. package/build/src/core/infrastructure/api/v1/routers/media/audio/openapi/SpeechRouter.openapi.d.ts +1 -0
  292. package/build/src/core/infrastructure/api/v1/routers/media/audio/openapi/SpeechRouter.openapi.d.ts.map +1 -1
  293. package/build/src/core/infrastructure/api/v1/routers/media/audio/openapi/SpeechRouter.openapi.js +1 -0
  294. package/build/src/core/infrastructure/api/v1/routers/media/audio/openapi/SpeechRouter.openapi.js.map +1 -1
  295. package/build/src/core/infrastructure/api/v1/routers/models/ModelsRouter.openapi.d.ts +36 -34
  296. package/build/src/core/infrastructure/api/v1/routers/models/ModelsRouter.openapi.d.ts.map +1 -1
  297. package/build/src/core/infrastructure/api/v1/routers/models/ModelsRouter.openapi.js +51 -17
  298. package/build/src/core/infrastructure/api/v1/routers/models/ModelsRouter.openapi.js.map +1 -1
  299. package/build/src/core/infrastructure/api/v1/routers/models/catalogRepresentation.d.ts +4 -0
  300. package/build/src/core/infrastructure/api/v1/routers/models/catalogRepresentation.d.ts.map +1 -0
  301. package/build/src/core/infrastructure/api/v1/routers/models/catalogRepresentation.js +4 -0
  302. package/build/src/core/infrastructure/api/v1/routers/models/catalogRepresentation.js.map +1 -0
  303. package/build/src/core/infrastructure/api/v1/routers/runs/openapi/RunsRouter.openapi.js +1 -1
  304. package/build/src/core/infrastructure/api/v1/routers/runs/openapi/RunsRouter.openapi.js.map +1 -1
  305. package/build/src/core/infrastructure/di/builtInLLMProviders.d.ts.map +1 -1
  306. package/build/src/core/infrastructure/di/builtInLLMProviders.js +17 -2
  307. package/build/src/core/infrastructure/di/builtInLLMProviders.js.map +1 -1
  308. package/build/src/core/infrastructure/di/index.d.ts.map +1 -1
  309. package/build/src/core/infrastructure/di/index.js +56 -8
  310. package/build/src/core/infrastructure/di/index.js.map +1 -1
  311. package/build/src/core/infrastructure/di/types.d.ts +1 -0
  312. package/build/src/core/infrastructure/di/types.d.ts.map +1 -1
  313. package/build/src/core/infrastructure/di/types.js +1 -0
  314. package/build/src/core/infrastructure/di/types.js.map +1 -1
  315. package/build/src/core/infrastructure/mappers/chat/default/BasicChatMessageMapper.d.ts.map +1 -1
  316. package/build/src/core/infrastructure/mappers/chat/default/BasicChatMessageMapper.js +4 -6
  317. package/build/src/core/infrastructure/mappers/chat/default/BasicChatMessageMapper.js.map +1 -1
  318. package/build/src/core/infrastructure/mappers/chat/google/GeminiChatMessageMapper.d.ts.map +1 -1
  319. package/build/src/core/infrastructure/mappers/chat/google/GeminiChatMessageMapper.js +9 -0
  320. package/build/src/core/infrastructure/mappers/chat/google/GeminiChatMessageMapper.js.map +1 -1
  321. package/build/src/core/infrastructure/persistence/dao/knex/KnexMessageDao.d.ts.map +1 -1
  322. package/build/src/core/infrastructure/persistence/dao/knex/KnexMessageDao.js +6 -0
  323. package/build/src/core/infrastructure/persistence/dao/knex/KnexMessageDao.js.map +1 -1
  324. package/build/src/core/infrastructure/services/audio/TranscriptionWav.js +1 -1
  325. package/build/src/core/infrastructure/services/audio/TranscriptionWav.js.map +1 -1
  326. package/build/src/core/infrastructure/services/chat/ProviderRequestUsage.js +1 -1
  327. package/build/src/core/infrastructure/services/chat/ProviderRequestUsage.js.map +1 -1
  328. package/build/src/core/infrastructure/services/runs/approval/RunToolInvocationLifecycleImpl.js +1 -0
  329. package/build/src/core/infrastructure/services/runs/approval/RunToolInvocationLifecycleImpl.js.map +1 -1
  330. package/build/src/infrastructure/websockets/adapters/ws/WSAdapter.d.ts.map +1 -1
  331. package/build/src/infrastructure/websockets/adapters/ws/WSAdapter.js +2 -1
  332. package/build/src/infrastructure/websockets/adapters/ws/WSAdapter.js.map +1 -1
  333. package/build/src/modules/workspaces/infrastructure/recovery/operator/authority/observer/ExecutionSources.js +1 -1
  334. package/package.json +2 -1
  335. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaConfig.d.ts +0 -3
  336. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaConfig.d.ts.map +0 -1
  337. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaConfig.js +0 -27
  338. package/build/src/core/infrastructure/ai/llm/providers/nvidia/NvidiaConfig.js.map +0 -1
@@ -10,9 +10,11 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
- import { GoogleGenAI } from '@google/genai';
13
+ import { AudioTranscriptionConfigMode } from '@google/genai';
14
+ import { createGoogleGenAiClient } from '../../google/GoogleGenAiConnection.js';
15
+ import { googleSpeechConnection } from '../GoogleSpeechConnection.js';
14
16
  import { randomUUID } from 'node:crypto';
15
- import { inject, injectable } from 'inversify';
17
+ import { inject, injectable, injectFromBase } from 'inversify';
16
18
  import { ConfigService } from '@gaia-framework/config';
17
19
  import { resolveTranscriptionModel, validateTranscriptionContext, transcriptionRejection } from '../../../../domain/services/media/TranscriptionPolicy.js';
18
20
  import CoreTypes from '../../../di/types.js';
@@ -23,17 +25,18 @@ let GoogleSpeechToTextProvider = class GoogleSpeechToTextProvider {
23
25
  config;
24
26
  logger;
25
27
  id = 'google';
28
+ get model() { return { ...model, provider: this.id, id: `${this.id}/${model.providerModel}` }; }
26
29
  constructor(config, logger) {
27
30
  this.config = config;
28
31
  this.logger = logger;
29
32
  }
30
33
  isConfigured() {
31
- return !!this.config.getOptionalString('ai.llm.providers.google.apiKey')?.trim();
34
+ return !!googleSpeechConnection(this.config, this.id);
32
35
  }
33
- getModels() { return this.isConfigured() ? [model] : []; }
36
+ getModels() { return this.isConfigured() ? [this.model] : []; }
34
37
  getTranscriptionCapabilities() {
35
38
  return { id: this.id, configured: this.isConfigured(), access: 'unverified', models: [{
36
- ...model, modes: ['file'], settings: [...googleTranscriptionSettings, 'diarization', 'timestamps'],
39
+ ...this.model, modes: ['file'], settings: [...googleTranscriptionSettings, 'diarization', 'timestamps'],
37
40
  languageHintMode: 'multiple', languageHintFormat: 'bcp47', maxKeywords: 1000,
38
41
  diarizationRequiresTimestamps: true,
39
42
  annotationExcludesKeywords: true, timestampGranularity: 'word',
@@ -49,16 +52,39 @@ let GoogleSpeechToTextProvider = class GoogleSpeechToTextProvider {
49
52
  validateTranscriptionContext(options, selected);
50
53
  if (!audio.length || audio.length > Math.min(26_214_400, this.config.getOptionalNumber('ai.speech.transcription.maxUploadBytes') ?? 26_214_400))
51
54
  throw transcriptionRejection('Audio exceeds the Google upload limit or is empty.');
52
- const apiKey = this.config.getOptionalString('ai.llm.providers.google.apiKey')?.trim();
53
- if (!apiKey)
55
+ const connection = googleSpeechConnection(this.config, this.id);
56
+ if (!connection)
54
57
  throw transcriptionFailure(503);
55
58
  const file = transcriptionFile(audio, options);
56
59
  if (!/^audio\/(wav|x-wav|mpeg|mp3|aiff|aac|ogg|flac|m4a|mp4|opus|webm)$/.test(file.type))
57
60
  throw transcriptionRejection('Unsupported Google transcription audio type.');
58
61
  const mimeType = file.type.replace('audio/x-wav', 'audio/wav').replace('audio/mp4', 'audio/m4a');
59
- // Per-upload httpOptions can prepend the API version twice in genai 2.21.0.
60
- const client = new GoogleGenAI({ apiKey, httpOptions: { apiVersion: 'v1beta', timeout: 120_000 } });
61
62
  const signal = transcriptionSignal(options);
63
+ // Configure the HTTP version on the client; per-upload options can duplicate it in the URL.
64
+ const client = createGoogleGenAiClient(connection, { httpOptions: { apiVersion: connection.kind === 'vertex' ? 'v1' : 'v1beta', timeout: 120_000 } });
65
+ if (connection.kind === 'vertex') {
66
+ try {
67
+ signal.throwIfAborted();
68
+ const response = await client.models.generateContent({
69
+ model: selected.providerModel,
70
+ contents: [{ role: 'user', parts: [{ inlineData: { data: audio.toString('base64'), mimeType } }] }],
71
+ config: {
72
+ abortSignal: signal,
73
+ audioTranscriptionConfig: {
74
+ mode: options.mode === 'smart' ? AudioTranscriptionConfigMode.SMART : AudioTranscriptionConfigMode.VERBATIM,
75
+ languageCodes: options.languages?.map(value => Intl.getCanonicalLocales(value)[0]),
76
+ customVocabulary: options.keywords,
77
+ wordTimestamp: options.timestamps,
78
+ diarization: options.diarization,
79
+ },
80
+ },
81
+ });
82
+ return requireRequestedAnnotations(parseVertexTranscription(response), options);
83
+ }
84
+ catch (error) {
85
+ throw normalizeTranscriptionFailure(error, signal);
86
+ }
87
+ }
62
88
  const name = `files/gaia-${randomUUID().replaceAll('-', '')}`;
63
89
  if (signal.aborted)
64
90
  throw normalizeTranscriptionFailure(signal.reason, signal);
@@ -74,12 +100,7 @@ let GoogleSpeechToTextProvider = class GoogleSpeechToTextProvider {
74
100
  }, { signal, timeout: 120_000, maxRetries: 0 });
75
101
  if (response.model && response.model !== selected.providerModel)
76
102
  throw transcriptionFailure(502);
77
- const result = parseGoogleTranscription(response);
78
- if (result.text && options.timestamps && !result.words?.some(word => word.startSeconds !== undefined))
79
- throw transcriptionFailure(502);
80
- if (result.text && options.diarization && !result.words?.some(word => word.speaker !== undefined))
81
- throw transcriptionFailure(502);
82
- return result;
103
+ return requireRequestedAnnotations(parseGoogleTranscription(response), options);
83
104
  }
84
105
  catch (error) {
85
106
  throw normalizeTranscriptionFailure(error, signal);
@@ -100,6 +121,34 @@ GoogleSpeechToTextProvider = __decorate([
100
121
  __metadata("design:paramtypes", [ConfigService, Object])
101
122
  ], GoogleSpeechToTextProvider);
102
123
  export { GoogleSpeechToTextProvider };
124
+ let VertexSpeechToTextProvider = class VertexSpeechToTextProvider extends GoogleSpeechToTextProvider {
125
+ id = 'vertex';
126
+ };
127
+ VertexSpeechToTextProvider = __decorate([
128
+ injectable(),
129
+ injectFromBase()
130
+ ], VertexSpeechToTextProvider);
131
+ export { VertexSpeechToTextProvider };
132
+ function requireRequestedAnnotations(result, options) {
133
+ if (result.text && options.timestamps && !result.words?.some(word => word.startSeconds !== undefined))
134
+ throw transcriptionFailure(502);
135
+ if (result.text && options.diarization && !result.words?.some(word => word.speaker !== undefined))
136
+ throw transcriptionFailure(502);
137
+ return result;
138
+ }
139
+ export function parseVertexTranscription(response) {
140
+ const parts = response.candidates?.[0]?.content?.parts;
141
+ if (!parts?.some(part => typeof part.text === 'string' || part.audioTranscription))
142
+ throw transcriptionFailure(502);
143
+ const transcripts = parts.flatMap(part => part.audioTranscription ? [part.audioTranscription] : []);
144
+ const text = parts.map(part => part.text ?? '').join('') || transcripts.map(entry => entry.text ?? '').join(' ');
145
+ if (text.length > 4_194_304)
146
+ throw transcriptionFailure(502);
147
+ const words = transcripts.flatMap(entry => (entry.words ?? []).map(word => parseWord({
148
+ text: word.word, start_offset: word.startOffset, end_offset: word.endOffset, speaker: entry.speakerLabel,
149
+ })));
150
+ return { text, ...(words.length && { words }) };
151
+ }
103
152
  export function googleFileTranscriptionConfig(options) {
104
153
  return {
105
154
  ...(options.languages && { language_codes: options.languages.map(value => Intl.getCanonicalLocales(value)[0]) }),
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleSpeechToTextProvider.js","sourceRoot":"","sources":["../../../../../../../src/core/infrastructure/ai/speech/stt/GoogleSpeechToTextProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,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AAM,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC1L,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,SAAS,SAAS,CAAC,IAA6B;IAC9C,IAAI,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ;QAAE,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC;IACnE,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,IAAI,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;QAC1F,GAAG,CAAC,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC;QACrF,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,QAAQ,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;KAChF,CAAC;AACJ,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC;QAAE,MAAM,oBAAoB,CAAC,GAAG,CAAC,CAAC;IAClG,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { ConfigService } from '@gaia-framework/config';
2
+ import type { SpeechRecognitionOptions, SpeechToTextProvider } from '../../../../domain/ports/speech/SpeechToTextProvider.js';
3
+ import type { SpeechToTextModelInfo } from '../../../../domain/models/speech/SpeechModelInfo.js';
4
+ import type { TranscriptionModelCapability, TranscriptionProviderCapability } from '../../../../domain/models/speech/Transcription.js';
5
+ export declare class TogetherSpeechToTextProvider implements SpeechToTextProvider {
6
+ private readonly config;
7
+ readonly id = "togetherai";
8
+ constructor(config: ConfigService);
9
+ private get key();
10
+ getModels(): (TranscriptionModelCapability & SpeechToTextModelInfo)[];
11
+ getTranscriptionCapabilities(): TranscriptionProviderCapability;
12
+ recognizeSpeech(audio: Buffer, selected?: string, options?: SpeechRecognitionOptions): Promise<string>;
13
+ transcribe(audio: Buffer, selected?: string, options?: SpeechRecognitionOptions): Promise<import("../../../../domain/models/speech/Transcription.js").TranscriptionResult>;
14
+ }
15
+ //# sourceMappingURL=TogetherSpeechToTextProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TogetherSpeechToTextProvider.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/infrastructure/ai/speech/stt/TogetherSpeechToTextProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,wBAAwB,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AAC9H,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,KAAK,EAAE,4BAA4B,EAAE,+BAA+B,EAAE,MAAM,mDAAmD,CAAC;AAavI,qBACa,4BAA6B,YAAW,oBAAoB;IAG1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFpE,QAAQ,CAAC,EAAE,gBAAgB;gBAEmC,MAAM,EAAE,aAAa;IAEnF,OAAO,KAAK,GAAG,GAGd;IAED,SAAS;IACT,4BAA4B,IAAI,+BAA+B;IAIzD,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,wBAAwB;IAIpF,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,OAAO,GAAE,wBAA6B;CA4B1F"}
@@ -0,0 +1,81 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { inject, injectable } from 'inversify';
14
+ import { ConfigService } from '@gaia-framework/config';
15
+ import CoreTypes from '../../../di/types.js';
16
+ import { resolveTranscriptionModel, validateTranscriptionContext, transcriptionRejection } from '../../../../domain/services/media/TranscriptionPolicy.js';
17
+ import { normalizeTranscriptionFailure, readTranscriptionJson, transcriptionFailure, transcriptionFile, transcriptionSignal } from './TranscriptionHttp.js';
18
+ const maxUploadBytes = 25 * 1024 * 1024;
19
+ const model = {
20
+ id: 'togetherai/openai/whisper-large-v3', providerModel: 'openai/whisper-large-v3',
21
+ displayName: 'Whisper Large v3', provider: 'togetherai', type: 'speech_to_text',
22
+ modes: ['file'], settings: ['languages', 'prompt'], languageHintMode: 'single',
23
+ formats: ['wav', 'mp3', 'm4a', 'mp4', 'webm', 'ogg', 'flac'],
24
+ maxUploadBytes,
25
+ };
26
+ let TogetherSpeechToTextProvider = class TogetherSpeechToTextProvider {
27
+ config;
28
+ id = 'togetherai';
29
+ constructor(config) {
30
+ this.config = config;
31
+ }
32
+ get key() {
33
+ return this.config.getOptionalBoolean('ai.speech.providers.togetherai.enabled')
34
+ ? this.config.getOptionalString('ai.speech.providers.togetherai.apiKey')?.trim() : undefined;
35
+ }
36
+ getModels() { return this.key ? [model] : []; }
37
+ getTranscriptionCapabilities() {
38
+ return { id: this.id, configured: Boolean(this.key), access: 'unverified', models: [model] };
39
+ }
40
+ async recognizeSpeech(audio, selected, options) {
41
+ return (await this.transcribe(audio, selected, options)).text;
42
+ }
43
+ async transcribe(audio, selected, options = {}) {
44
+ const key = this.key;
45
+ if (!key)
46
+ throw transcriptionFailure(503);
47
+ const capability = resolveTranscriptionModel([model], selected, model.providerModel);
48
+ validateTranscriptionContext(options, capability);
49
+ if (!audio.length || audio.length > maxUploadBytes) {
50
+ throw transcriptionRejection('Audio exceeds the Together AI upload limit or is empty.');
51
+ }
52
+ const body = new FormData();
53
+ body.set('file', transcriptionFile(audio, options));
54
+ body.set('model', capability.providerModel);
55
+ if (options.prompt)
56
+ body.set('prompt', options.prompt);
57
+ if (options.languages?.[0])
58
+ body.set('language', options.languages[0]);
59
+ const signal = transcriptionSignal(options);
60
+ try {
61
+ const response = await fetch('https://api.together.ai/v1/audio/transcriptions', {
62
+ method: 'POST', headers: { Authorization: 'Bearer ' + key }, body, signal, redirect: 'error',
63
+ });
64
+ if (!response.ok) {
65
+ await response.body?.cancel();
66
+ throw transcriptionFailure(response.status);
67
+ }
68
+ return await readTranscriptionJson(response);
69
+ }
70
+ catch (error) {
71
+ throw normalizeTranscriptionFailure(error, signal);
72
+ }
73
+ }
74
+ };
75
+ TogetherSpeechToTextProvider = __decorate([
76
+ injectable(),
77
+ __param(0, inject(CoreTypes.ConfigService)),
78
+ __metadata("design:paramtypes", [ConfigService])
79
+ ], TogetherSpeechToTextProvider);
80
+ export { TogetherSpeechToTextProvider };
81
+ //# sourceMappingURL=TogetherSpeechToTextProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TogetherSpeechToTextProvider.js","sourceRoot":"","sources":["../../../../../../../src/core/infrastructure/ai/speech/stt/Tog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AAI,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;QACvD,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAEvE,MAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;QAC5C,IAAI,CAAC;YACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,iDAAiD,EAAE;gBAC9E,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,SAAS,GAAG,GAAG,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO;aAC7F,CAAC,CAAC;YACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;gBACjB,MAAM,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC;gBAC9B,MAAM,oBAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC9C,CAAC;YACD,OAAO,MAAM,qBAAqB,CAAC,QAAQ,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,6BAA6B,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACrD,CAAC;IACH,CAAC;CACF,CAAA;AA/CY,4BAA4B;IADxC,UAAU,EAAE;IAIE,WAAA,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;qCAA0B,aAAa;GAHxE,4BAA4B,CA+CxC"}
@@ -0,0 +1,26 @@
1
+ import { ConfigService } from '@gaia-framework/config';
2
+ import type { TextToSpeechProvider } from '../../../../domain/ports/speech/TextToSpeechProvider.js';
3
+ import type { TextToSpeechModelInfo } from '../../../../domain/models/speech/SpeechModelInfo.js';
4
+ import { type SpeechSynthesisOptions } from '../../../../domain/models/speech/SpeechSynthesis.js';
5
+ export declare class TogetherTextToSpeechProvider implements TextToSpeechProvider {
6
+ private readonly config;
7
+ readonly id = "togetherai";
8
+ constructor(config: ConfigService);
9
+ private get key();
10
+ getModels(): TextToSpeechModelInfo[];
11
+ listVoices(): Promise<{
12
+ name: string;
13
+ voices: {
14
+ name: string;
15
+ gender: string;
16
+ language: string;
17
+ }[];
18
+ }>;
19
+ synthesizeSpeech(text: string, voice?: string, selected?: string, instructions?: string, options?: SpeechSynthesisOptions): Promise<Buffer<ArrayBuffer>>;
20
+ synthesizeSpeechResult(text: string, voice?: string, selected?: string, instructions?: string, options?: SpeechSynthesisOptions): Promise<{
21
+ audio: Buffer<ArrayBuffer>;
22
+ mimeType: string;
23
+ extension: string;
24
+ }>;
25
+ }
26
+ //# sourceMappingURL=TogetherTextToSpeechProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TogetherTextToSpeechProvider.d.ts","sourceRoot":"","sources":["../../../../../../../src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAEvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yDAAyD,CAAC;AACpG,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AACjG,OAAO,EAA6B,KAAK,sBAAsB,EAAE,MAAM,qDAAqD,CAAC;AAY7H,qBACa,4BAA6B,YAAW,oBAAoB;IAG1B,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFpE,QAAQ,CAAC,EAAE,gBAAgB;gBAEmC,MAAM,EAAE,aAAa;IAEnF,OAAO,KAAK,GAAG,GAGd;IAED,SAAS;IACH,UAAU;;;;;;;;IAEV,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB;IAIzH,sBAAsB,CAC1B,IAAI,EAAE,MAAM,EAAE,KAAK,SAAiB,EAAE,QAAQ,SAAsB,EACpE,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,sBAAsB;;;;;CA+B1D"}
@@ -0,0 +1,80 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
+ return function (target, key) { decorator(target, key, paramIndex); }
12
+ };
13
+ import { inject, injectable } from 'inversify';
14
+ import { ConfigService } from '@gaia-framework/config';
15
+ import CoreTypes from '../../../di/types.js';
16
+ import { MAX_SYNTHESIS_AUDIO_BYTES } from '../../../../domain/models/speech/SpeechSynthesis.js';
17
+ import { createAIExecutionFailure } from '../../../../domain/errors/AIExecutionFailure.js';
18
+ const model = {
19
+ id: 'togetherai/hexgrad/Kokoro-82M', providerModel: 'hexgrad/Kokoro-82M',
20
+ displayName: 'Kokoro', provider: 'togetherai', type: 'text_to_speech',
21
+ };
22
+ const voices = [
23
+ { name: 'af_heart', gender: 'female', language: 'en-US' },
24
+ { name: 'am_michael', gender: 'male', language: 'en-US' },
25
+ ];
26
+ let TogetherTextToSpeechProvider = class TogetherTextToSpeechProvider {
27
+ config;
28
+ id = 'togetherai';
29
+ constructor(config) {
30
+ this.config = config;
31
+ }
32
+ get key() {
33
+ return this.config.getOptionalBoolean('ai.speech.providers.togetherai.enabled')
34
+ ? this.config.getOptionalString('ai.speech.providers.togetherai.apiKey')?.trim() : undefined;
35
+ }
36
+ getModels() { return this.key ? [model] : []; }
37
+ async listVoices() { return { name: this.id, voices: this.key ? voices : [] }; }
38
+ async synthesizeSpeech(text, voice, selected, instructions, options) {
39
+ return (await this.synthesizeSpeechResult(text, voice, selected, instructions, options)).audio;
40
+ }
41
+ async synthesizeSpeechResult(text, voice = voices[0].name, selected = model.providerModel, instructions, options) {
42
+ const key = this.key;
43
+ if (!key)
44
+ throw createAIExecutionFailure('provider_unavailable');
45
+ if (![model.id, model.providerModel].includes(selected) || !voices.some(info => info.name === voice)
46
+ || instructions?.trim() || !text.trim())
47
+ throw createAIExecutionFailure('provider_request_rejected');
48
+ const deadline = AbortSignal.timeout(120_000);
49
+ const signal = options?.abortSignal ? AbortSignal.any([deadline, options.abortSignal]) : deadline;
50
+ const response = await fetch('https://api.together.ai/v1/audio/speech', {
51
+ method: 'POST', redirect: 'error', signal,
52
+ headers: { Authorization: 'Bearer ' + key, 'Content-Type': 'application/json' },
53
+ body: JSON.stringify({ model: model.providerModel, input: text, voice, response_format: 'wav' }),
54
+ });
55
+ if (!response.ok || !response.body) {
56
+ await response.body?.cancel();
57
+ throw createAIExecutionFailure(response.status === 429 ? 'provider_rate_limited' : 'provider_unavailable');
58
+ }
59
+ let size = 0;
60
+ const chunks = [];
61
+ for await (const chunk of response.body) {
62
+ size += chunk.length;
63
+ if (size > MAX_SYNTHESIS_AUDIO_BYTES)
64
+ throw createAIExecutionFailure('provider_unavailable');
65
+ chunks.push(chunk);
66
+ }
67
+ const audio = Buffer.concat(chunks, size);
68
+ if (audio.toString('ascii', 0, 4) !== 'RIFF' || audio.toString('ascii', 8, 12) !== 'WAVE') {
69
+ throw createAIExecutionFailure('provider_unavailable');
70
+ }
71
+ return { audio, mimeType: 'audio/wav', extension: 'wav' };
72
+ }
73
+ };
74
+ TogetherTextToSpeechProvider = __decorate([
75
+ injectable(),
76
+ __param(0, inject(CoreTypes.ConfigService)),
77
+ __metadata("design:paramtypes", [ConfigService])
78
+ ], TogetherTextToSpeechProvider);
79
+ export { TogetherTextToSpeechProvider };
80
+ //# sourceMappingURL=TogetherTextToSpeechProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TogetherTextToSpeechProvider.js","sourceRoot":"","sources":["../../../../../../../src/core/infrastructure/ai/speech/tts/TogetherTextToSpeechProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAG7C,OAAO,EAAE,yBAAyB,EAA+B,MAAM,qDAAqD,CAAC;AAC7H,OAAO,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AAE3F,MAAM,KAAK,GAA0B;IACnC,EAAE,EAAE,+BAA+B,EAAE,aAAa,EAAE,oBAAoB;IACxE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,gBAAgB;CACtE,CAAC;AACF,MAAM,MAAM,GAAG;IACb,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;IACzD,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE;CAC1D,CAAC;AAGK,IAAM,4BAA4B,GAAlC,MAAM,4BAA4B;IAGuB;IAFrD,EAAE,GAAG,YAAY,CAAC;IAE3B,YAA8D,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAEvF,IAAY,GAAG;QACb,OAAO,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC,wCAAwC,CAAC;YAC7E,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,uCAAuC,CAAC,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AAI,CAAC,CAAC;QAC1C,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,KAAK,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,MAAM,EAAE,CAAC;YAC1F,MAAM,wBAAwB,CAAC,sBAAsB,CAAC,CAAC;QACzD,CAAC;QACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;IAC5D,CAAC;CACF,CAAA;AAlDY,4BAA4B;IADxC,UAAU,EAAE;IAIE,WAAA,MAAM,CAAC,SAAS,CAAC,aAAa,CAAC,CAAA;qCAA0B,aAAa;GAHxE,4BAA4B,CAkDxC"}
@@ -3,26 +3,26 @@ import type { TextToSpeechProvider } from '../../../../../domain/ports/speech/Te
3
3
  import type { SpeechSynthesisOptions, SpeechSynthesisResult } from '../../../../../domain/models/speech/SpeechSynthesis.js';
4
4
  export declare class GoogleTextToSpeechProvider implements TextToSpeechProvider {
5
5
  private readonly config;
6
- readonly id = "google";
6
+ readonly id: 'google' | 'vertex';
7
7
  constructor(config: ConfigService);
8
8
  private isConfigured;
9
- getModels(): never[] | readonly [{
10
- readonly id: "google/gemini-3.8-flash-lite-tts";
11
- readonly providerModel: "gemini-3.8-flash-lite-tts";
12
- readonly displayName: "Gemini 3.8 Flash-Lite TTS";
13
- readonly provider: "google";
14
- readonly type: "text_to_speech";
15
- readonly supportsInstructions: true;
16
- }, {
17
- readonly id: "google/gemini-3.8-flash-tts";
18
- readonly providerModel: "gemini-3.8-flash-tts";
19
- readonly displayName: "Gemini 3.8 Flash TTS";
20
- readonly provider: "google";
21
- readonly type: "text_to_speech";
22
- readonly supportsInstructions: true;
23
- }];
9
+ getModels(): ({
10
+ provider: "google" | "vertex";
11
+ id: string;
12
+ providerModel: "gemini-3.8-flash-lite-tts";
13
+ displayName: "Gemini 3.8 Flash-Lite TTS";
14
+ type: "text_to_speech";
15
+ supportsInstructions: true;
16
+ } | {
17
+ provider: "google" | "vertex";
18
+ id: string;
19
+ providerModel: "gemini-3.8-flash-tts";
20
+ displayName: "Gemini 3.8 Flash TTS";
21
+ type: "text_to_speech";
22
+ supportsInstructions: true;
23
+ })[];
24
24
  listVoices(): Promise<{
25
- name: string;
25
+ name: "google" | "vertex";
26
26
  voices: {
27
27
  id: "Zephyr" | "Puck" | "Charon" | "Kore" | "Fenrir" | "Leda" | "Orus" | "Aoede" | "Callirrhoe" | "Autonoe" | "Enceladus" | "Iapetus" | "Umbriel" | "Algieba" | "Despina" | "Erinome" | "Algenib" | "Rasalgethi" | "Laomedeia" | "Achernar" | "Alnilam" | "Schedar" | "Gacrux" | "Pulcherrima" | "Achird" | "Zubenelgenubi" | "Vindemiatrix" | "Sadachbia" | "Sadaltager" | "Sulafat";
28
28
  name: "Zephyr" | "Puck" | "Charon" | "Kore" | "Fenrir" | "Leda" | "Orus" | "Aoede" | "Callirrhoe" | "Autonoe" | "Enceladus" | "Iapetus" | "Umbriel" | "Algieba" | "Despina" | "Erinome" | "Algenib" | "Rasalgethi" | "Laomedeia" | "Achernar" | "Alnilam" | "Schedar" | "Gacrux" | "Pulcherrima" | "Achird" | "Zubenelgenubi" | "Vindemiatrix" | "Sadachbia" | "Sadaltager" | "Sulafat";
@@ -36,4 +36,7 @@ export declare class GoogleTextToSpeechProvider implements TextToSpeechProvider
36
36
  synthesizeSpeech(text: string, voice?: string, model?: string, instructions?: string, options?: SpeechSynthesisOptions): Promise<Buffer>;
37
37
  synthesizeSpeechResult(text: string, voice?: string, model?: string, instructions?: string, options?: SpeechSynthesisOptions): Promise<SpeechSynthesisResult>;
38
38
  }
39
+ export declare class VertexTextToSpeechProvider extends GoogleTextToSpeechProvider {
40
+ readonly id: "vertex";
41
+ }
39
42
  //# sourceMappingURL=GoogleTextToSpeechProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleTextToSpeechProvider.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AACvG,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,wDAAwD,CAAC;AAQhE,qBACa,0BAA2B,YAAW,oBAAoB;IAGxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFpE,QAAQ,CAAC,EAAE,YAAY;gBAEuC,MAAM,EAAE,aAAa;IAEnF,OAAO,CAAC,YAAY;IAIpB,SAAS;;;;;;;;;;;;;;;IAIH,UAAU;;;;;;;;;;;;IAeV,gBAAgB,CACpB,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,MAAM,CAAC;IAIZ,sBAAsB,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,qBAAqB,CAAC;CAWlC"}
1
+ {"version":3,"file":"GoogleTextToSpeechProvider.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4DAA4D,CAAC;AACvG,OAAO,KAAK,EACV,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,wDAAwD,CAAC;AAUhE,qBACa,0BAA2B,YAAW,oBAAoB;IAGxB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFpE,QAAQ,CAAC,EAAE,EAAE,QAAQ,GAAG,QAAQ,CAAY;gBAEkB,MAAM,EAAE,aAAa;IAEnF,OAAO,CAAC,YAAY;IAIpB,SAAS;;;;;;;;;;;;;;;IAMH,UAAU;;;;;;;;;;;;IAeV,gBAAgB,CACpB,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,MAAM,CAAC;IAIZ,sBAAsB,CAC1B,IAAI,EAAE,MAAM,EACZ,KAAK,CAAC,EAAE,MAAM,EACd,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,EACrB,OAAO,CAAC,EAAE,sBAAsB,GAC/B,OAAO,CAAC,qBAAqB,CAAC;CAWlC;AAED,qBAEa,0BAA2B,SAAQ,0BAA0B;IACxE,SAAkB,EAAE,EAAG,QAAQ,CAAU;CAC1C"}
@@ -11,10 +11,11 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
11
11
  return function (target, key) { decorator(target, key, paramIndex); }
12
12
  };
13
13
  import { Worker } from 'node:worker_threads';
14
- import { inject, injectable } from 'inversify';
14
+ import { inject, injectable, injectFromBase } from 'inversify';
15
15
  import { ConfigService } from '@gaia-framework/config';
16
16
  import { SpeechSynthesisError, } from '../../../../../domain/errors/SpeechSynthesisError.js';
17
17
  import CoreTypes from '../../../../di/types.js';
18
+ import { googleSpeechConnection } from '../../GoogleSpeechConnection.js';
18
19
  import { googleTtsModels, googleTtsRequest, googleTtsVoices } from './GoogleTtsProtocol.js';
19
20
  let GoogleTextToSpeechProvider = class GoogleTextToSpeechProvider {
20
21
  config;
@@ -23,10 +24,12 @@ let GoogleTextToSpeechProvider = class GoogleTextToSpeechProvider {
23
24
  this.config = config;
24
25
  }
25
26
  isConfigured() {
26
- return !!this.config.getOptionalString('ai.llm.providers.google.apiKey')?.trim();
27
+ return !!googleSpeechConnection(this.config, this.id);
27
28
  }
28
29
  getModels() {
29
- return this.isConfigured() ? googleTtsModels : [];
30
+ return this.isConfigured() ? googleTtsModels.map(model => ({
31
+ ...model, provider: this.id, id: `${this.id}/${model.providerModel}`,
32
+ })) : [];
30
33
  }
31
34
  async listVoices() {
32
35
  return {
@@ -46,13 +49,13 @@ let GoogleTextToSpeechProvider = class GoogleTextToSpeechProvider {
46
49
  return (await this.synthesizeSpeechResult(text, voice, model, instructions, options)).audio;
47
50
  }
48
51
  async synthesizeSpeechResult(text, voice, model, instructions, options) {
49
- const request = googleTtsRequest(text, voice, model, instructions);
50
- const apiKey = this.config.getOptionalString('ai.llm.providers.google.apiKey')?.trim();
51
- if (!apiKey)
52
+ const request = googleTtsRequest(text, voice, model, instructions, this.id);
53
+ const connection = googleSpeechConnection(this.config, this.id);
54
+ if (!connection)
52
55
  throw new SpeechSynthesisError('configuration');
53
56
  const timeout = AbortSignal.timeout(120_000);
54
57
  const signal = options?.abortSignal ? AbortSignal.any([options.abortSignal, timeout]) : timeout;
55
- const audio = await runGoogleTtsWorker(apiKey, request, signal);
58
+ const audio = await runGoogleTtsWorker(connection, request, signal);
56
59
  return { audio, mimeType: 'audio/wav', extension: 'wav' };
57
60
  }
58
61
  };
@@ -62,12 +65,20 @@ GoogleTextToSpeechProvider = __decorate([
62
65
  __metadata("design:paramtypes", [ConfigService])
63
66
  ], GoogleTextToSpeechProvider);
64
67
  export { GoogleTextToSpeechProvider };
65
- function runGoogleTtsWorker(apiKey, request, signal) {
68
+ let VertexTextToSpeechProvider = class VertexTextToSpeechProvider extends GoogleTextToSpeechProvider {
69
+ id = 'vertex';
70
+ };
71
+ VertexTextToSpeechProvider = __decorate([
72
+ injectable(),
73
+ injectFromBase()
74
+ ], VertexTextToSpeechProvider);
75
+ export { VertexTextToSpeechProvider };
76
+ function runGoogleTtsWorker(connection, request, signal) {
66
77
  if (signal.aborted)
67
78
  return Promise.reject(new SpeechSynthesisError('cancelled'));
68
79
  const extension = import.meta.url.endsWith('.ts') ? 'ts' : 'js';
69
80
  const worker = new Worker(new URL(`./GoogleTtsWorker.${extension}`, import.meta.url), {
70
- workerData: { apiKey, request },
81
+ workerData: { connection, request },
71
82
  });
72
83
  return new Promise((resolve, reject) => {
73
84
  let settled = false;
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleTextToSpeechProvider.js","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAMvD,OAAO,EACL,oBAAoB,GAErB,MAAM,sDAAsD,CAAC;AAC9D,OAAO,SAAS,MAAM,yBAAyB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAGrF,IAAM,0BAA0B,GAAhC,MAAM,0BAA0B;IAGyB;IAFrD,EAAE,GAAG,QAAQ,CAAC;IAEvB,YAA8D,MAAqB;QAArB,WAAM,GAAN,MAAM,CAAe;IAAG,CAAC;IAE/E,YAAY;QAClB,OAAO,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,gCAAgC,CAAC,EAAE,IAAI,EAAE,CAAC;IACnF,CAAC;IAED,SAAS;QACP,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,CAAC;IACpD,CAAC;IAED,KAAK,CAAC,UAAU;QACd,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,EAAE;YACb,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE;gBACzB,CAAC,CAAC,eAAe,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KAAK,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAC3F,CAAC;QAEJ,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,KAAgE,EAAE,EAAE;YAC1F,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,KAAK,EAAE,CAAC;gBACR,OAAO;YACT,CAAC;YAED,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM,CAAC,IAAI,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACjD,OAAO;YACT,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gBACjB,MAAM,CAAC,IAAI,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC;gBACnD,OAAO;YACT,CAAC;YAED,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC1E,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACzE,IAAI,MAAM,CAAC,OAAO;YAAE,KAAK,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC"}
1
+ {"version":3,"file":"GoogleTextToSpeechProvider.js","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/speech/tts/google/GoogleTextToSpeechProvider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,EAAE,MAAM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,oBAAoB,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,KAAK,cAAc,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,WAAW,CAAC,CAC3F,CAAC;QAEJ,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QACxD,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,KAAgE,EAAE,EAAE;YAC1F,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,KAAK,EAAE,CAAC;gBACR,OAAO;YACT,CAAC;YAED,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;gBACnB,MAAM,CAAC,IAAI,oBAAoB,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;gBACjD,OAAO;YACT,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;gBACjB,MAAM,CAAC,IAAI,oBAAoB,CAAC,gBAAgB,CAAC,CAAC,CAAC;gBACnD,OAAO;YACT,CAAC;YAED,MAAM,CAAC,SAAS,EAAE,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QAC1E,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,oBAAoB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;QACzE,IAAI,MAAM,CAAC,OAAO;YAAE,KAAK,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -15,7 +15,7 @@ export declare const googleTtsModels: readonly [{
15
15
  readonly supportsInstructions: true;
16
16
  }];
17
17
  export declare const googleTtsVoices: readonly ["Zephyr", "Puck", "Charon", "Kore", "Fenrir", "Leda", "Orus", "Aoede", "Callirrhoe", "Autonoe", "Enceladus", "Iapetus", "Umbriel", "Algieba", "Despina", "Erinome", "Algenib", "Rasalgethi", "Laomedeia", "Achernar", "Alnilam", "Schedar", "Gacrux", "Pulcherrima", "Achird", "Zubenelgenubi", "Vindemiatrix", "Sadachbia", "Sadaltager", "Sulafat"];
18
- export declare function googleTtsRequest(text: string, voice?: string, model?: string, instructions?: string): {
18
+ export declare function googleTtsRequest(text: string, voice?: string, model?: string, instructions?: string, provider?: 'google' | 'vertex'): {
19
19
  model: "gemini-3.8-flash-tts" | "gemini-3.8-flash-lite-tts";
20
20
  store: false;
21
21
  input: {
@@ -40,6 +40,7 @@ export declare function googleTtsRequest(text: string, voice?: string, model?: s
40
40
  };
41
41
  };
42
42
  export declare function parseGoogleTtsResponse(value: unknown, model: string): Buffer;
43
+ export declare function decodeGoogleTtsAudio(data: unknown, mimeType: unknown): Buffer;
43
44
  /** Applied inside a request-owned worker before SDK JSON parsing, including error bodies. */
44
45
  export declare function boundedGoogleResponse(response: Response, limit?: number): Promise<Response>;
45
46
  export declare function normalizeGoogleTtsError(error: unknown): SpeechSynthesisError;
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleTtsProtocol.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAI5F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;EAiBlB,CAAC;AAEX,eAAO,MAAM,eAAe,iWA+BlB,CAAC;AAEX,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,SAAS,EACd,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;EAqCtB;AAMD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CA0C5E;AAED,6FAA6F;AAC7F,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,QAAQ,EAClB,KAAK,SAAmB,GACvB,OAAO,CAAC,QAAQ,CAAC,CA2BnB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAW5E"}
1
+ {"version":3,"file":"GoogleTtsProtocol.d.ts","sourceRoot":"","sources":["../../../../../../../../src/core/infrastructure/ai/speech/tts/google/GoogleTtsProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,sDAAsD,CAAC;AAI5F,eAAO,MAAM,eAAe;;;;;;;;;;;;;;EAiBlB,CAAC;AAEX,eAAO,MAAM,eAAe,iWA+BlB,CAAC;AAEX,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,SAAS,EACd,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,MAAM,EACrB,QAAQ,GAAE,QAAQ,GAAG,QAAmB;;;;;;;;;;;;;;;;;;;;;;;EAqCzC;AAMD,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAyB5E;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAkB7E;AAED,6FAA6F;AAC7F,wBAAsB,qBAAqB,CACzC,QAAQ,EAAE,QAAQ,EAClB,KAAK,SAAmB,GACvB,OAAO,CAAC,QAAQ,CAAC,CA2BnB;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,OAAO,GAAG,oBAAoB,CAW5E"}
@@ -51,10 +51,10 @@ export const googleTtsVoices = [
51
51
  'Sadaltager',
52
52
  'Sulafat',
53
53
  ];
54
- export function googleTtsRequest(text, voice = 'Kore', model, instructions) {
54
+ export function googleTtsRequest(text, voice = 'Kore', model, instructions, provider = 'google') {
55
55
  const selected = model === undefined
56
56
  ? googleTtsModels[0]
57
- : googleTtsModels.find((item) => item.id === model || item.providerModel === model);
57
+ : googleTtsModels.find((item) => `${provider}/${item.providerModel}` === model || item.providerModel === model);
58
58
  if (!selected ||
59
59
  !googleTtsVoices.includes(voice) ||
60
60
  !text.trim() ||
@@ -104,8 +104,10 @@ export function parseGoogleTtsResponse(value, model) {
104
104
  if (audio.length > 1)
105
105
  throw new SpeechSynthesisError('invalid_output');
106
106
  const output = audio[0] ?? record(response.output_audio);
107
- const data = output.data;
108
- if ((output.mime_type !== undefined && output.mime_type !== 'audio/wav') ||
107
+ return decodeGoogleTtsAudio(output.data, output.mime_type);
108
+ }
109
+ export function decodeGoogleTtsAudio(data, mimeType) {
110
+ if ((mimeType !== undefined && mimeType !== 'audio/wav') ||
109
111
  typeof data !== 'string' ||
110
112
  !data.length ||
111
113
  data.length > Math.ceil(MAX_SYNTHESIS_AUDIO_BYTES / 3) * 4 ||