@framers/agentos 0.1.119 → 0.1.121
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.
- package/README.md +21 -0
- package/dist/api/agency.d.ts.map +1 -1
- package/dist/api/agency.js +227 -84
- package/dist/api/agency.js.map +1 -1
- package/dist/api/analyzeVideo.d.ts +127 -0
- package/dist/api/analyzeVideo.d.ts.map +1 -0
- package/dist/api/analyzeVideo.js +136 -0
- package/dist/api/analyzeVideo.js.map +1 -0
- package/dist/api/detectScenes.d.ts +82 -0
- package/dist/api/detectScenes.d.ts.map +1 -0
- package/dist/api/detectScenes.js +67 -0
- package/dist/api/detectScenes.js.map +1 -0
- package/dist/api/generateImage.d.ts +7 -0
- package/dist/api/generateImage.d.ts.map +1 -1
- package/dist/api/generateImage.js +133 -9
- package/dist/api/generateImage.js.map +1 -1
- package/dist/api/generateMusic.d.ts +98 -0
- package/dist/api/generateMusic.d.ts.map +1 -0
- package/dist/api/generateMusic.js +319 -0
- package/dist/api/generateMusic.js.map +1 -0
- package/dist/api/generateSFX.d.ts +96 -0
- package/dist/api/generateSFX.d.ts.map +1 -0
- package/dist/api/generateSFX.js +317 -0
- package/dist/api/generateSFX.js.map +1 -0
- package/dist/api/generateVideo.d.ts +113 -0
- package/dist/api/generateVideo.d.ts.map +1 -0
- package/dist/api/generateVideo.js +342 -0
- package/dist/api/generateVideo.js.map +1 -0
- package/dist/api/model.d.ts.map +1 -1
- package/dist/api/model.js +8 -4
- package/dist/api/model.js.map +1 -1
- package/dist/api/performOCR.d.ts +169 -0
- package/dist/api/performOCR.d.ts.map +1 -0
- package/dist/api/performOCR.js +198 -0
- package/dist/api/performOCR.js.map +1 -0
- package/dist/api/provider-defaults.d.ts +7 -5
- package/dist/api/provider-defaults.d.ts.map +1 -1
- package/dist/api/provider-defaults.js +32 -10
- package/dist/api/provider-defaults.js.map +1 -1
- package/dist/api/strategies/debate.d.ts.map +1 -1
- package/dist/api/strategies/debate.js +1 -0
- package/dist/api/strategies/debate.js.map +1 -1
- package/dist/api/strategies/graph.d.ts.map +1 -1
- package/dist/api/strategies/graph.js +69 -13
- package/dist/api/strategies/graph.js.map +1 -1
- package/dist/api/strategies/hierarchical.d.ts.map +1 -1
- package/dist/api/strategies/hierarchical.js +1 -0
- package/dist/api/strategies/hierarchical.js.map +1 -1
- package/dist/api/strategies/parallel.d.ts.map +1 -1
- package/dist/api/strategies/parallel.js +1 -0
- package/dist/api/strategies/parallel.js.map +1 -1
- package/dist/api/strategies/review-loop.d.ts.map +1 -1
- package/dist/api/strategies/review-loop.js +1 -0
- package/dist/api/strategies/review-loop.js.map +1 -1
- package/dist/api/strategies/sequential.d.ts.map +1 -1
- package/dist/api/strategies/sequential.js +54 -48
- package/dist/api/strategies/sequential.js.map +1 -1
- package/dist/api/streamBuffer.d.ts +20 -0
- package/dist/api/streamBuffer.d.ts.map +1 -0
- package/dist/api/streamBuffer.js +81 -0
- package/dist/api/streamBuffer.js.map +1 -0
- package/dist/api/types.d.ts +145 -5
- package/dist/api/types.d.ts.map +1 -1
- package/dist/api/types.js.map +1 -1
- package/dist/channels/adapters/RedditChannelAdapter.js.map +1 -1
- package/dist/core/audio/AudioProcessor.d.ts.map +1 -1
- package/dist/core/audio/AudioProcessor.js +1 -0
- package/dist/core/audio/AudioProcessor.js.map +1 -1
- package/dist/core/audio/EnvironmentalCalibrator.d.ts.map +1 -1
- package/dist/core/audio/EnvironmentalCalibrator.js +1 -0
- package/dist/core/audio/EnvironmentalCalibrator.js.map +1 -1
- package/dist/core/audio/FallbackAudioProxy.d.ts +169 -0
- package/dist/core/audio/FallbackAudioProxy.d.ts.map +1 -0
- package/dist/core/audio/FallbackAudioProxy.js +236 -0
- package/dist/core/audio/FallbackAudioProxy.js.map +1 -0
- package/dist/core/audio/IAudioGenerator.d.ts +103 -0
- package/dist/core/audio/IAudioGenerator.d.ts.map +1 -0
- package/dist/core/audio/IAudioGenerator.js +24 -0
- package/dist/core/audio/IAudioGenerator.js.map +1 -0
- package/dist/core/audio/index.d.ts +54 -0
- package/dist/core/audio/index.d.ts.map +1 -1
- package/dist/core/audio/index.js +93 -0
- package/dist/core/audio/index.js.map +1 -1
- package/dist/core/audio/providers/AudioGenLocalProvider.d.ts +136 -0
- package/dist/core/audio/providers/AudioGenLocalProvider.d.ts.map +1 -0
- package/dist/core/audio/providers/AudioGenLocalProvider.js +235 -0
- package/dist/core/audio/providers/AudioGenLocalProvider.js.map +1 -0
- package/dist/core/audio/providers/ElevenLabsSFXProvider.d.ts +107 -0
- package/dist/core/audio/providers/ElevenLabsSFXProvider.d.ts.map +1 -0
- package/dist/core/audio/providers/ElevenLabsSFXProvider.js +154 -0
- package/dist/core/audio/providers/ElevenLabsSFXProvider.js.map +1 -0
- package/dist/core/audio/providers/FalAudioProvider.d.ts +207 -0
- package/dist/core/audio/providers/FalAudioProvider.d.ts.map +1 -0
- package/dist/core/audio/providers/FalAudioProvider.js +315 -0
- package/dist/core/audio/providers/FalAudioProvider.js.map +1 -0
- package/dist/core/audio/providers/MusicGenLocalProvider.d.ts +136 -0
- package/dist/core/audio/providers/MusicGenLocalProvider.d.ts.map +1 -0
- package/dist/core/audio/providers/MusicGenLocalProvider.js +235 -0
- package/dist/core/audio/providers/MusicGenLocalProvider.js.map +1 -0
- package/dist/core/audio/providers/ReplicateAudioProvider.d.ts +200 -0
- package/dist/core/audio/providers/ReplicateAudioProvider.d.ts.map +1 -0
- package/dist/core/audio/providers/ReplicateAudioProvider.js +346 -0
- package/dist/core/audio/providers/ReplicateAudioProvider.js.map +1 -0
- package/dist/core/audio/providers/StableAudioProvider.d.ts +138 -0
- package/dist/core/audio/providers/StableAudioProvider.d.ts.map +1 -0
- package/dist/core/audio/providers/StableAudioProvider.js +192 -0
- package/dist/core/audio/providers/StableAudioProvider.js.map +1 -0
- package/dist/core/audio/providers/SunoProvider.d.ts +182 -0
- package/dist/core/audio/providers/SunoProvider.d.ts.map +1 -0
- package/dist/core/audio/providers/SunoProvider.js +312 -0
- package/dist/core/audio/providers/SunoProvider.js.map +1 -0
- package/dist/core/audio/providers/UdioProvider.d.ts +177 -0
- package/dist/core/audio/providers/UdioProvider.d.ts.map +1 -0
- package/dist/core/audio/providers/UdioProvider.js +305 -0
- package/dist/core/audio/providers/UdioProvider.js.map +1 -0
- package/dist/core/audio/types.d.ts +257 -0
- package/dist/core/audio/types.d.ts.map +1 -0
- package/dist/core/audio/types.js +21 -0
- package/dist/core/audio/types.js.map +1 -0
- package/dist/core/images/FallbackImageProxy.d.ts +183 -0
- package/dist/core/images/FallbackImageProxy.d.ts.map +1 -0
- package/dist/core/images/FallbackImageProxy.js +283 -0
- package/dist/core/images/FallbackImageProxy.js.map +1 -0
- package/dist/core/images/IImageProvider.d.ts +1 -1
- package/dist/core/images/IImageProvider.d.ts.map +1 -1
- package/dist/core/images/index.d.ts +1 -0
- package/dist/core/images/index.d.ts.map +1 -1
- package/dist/core/images/index.js +1 -0
- package/dist/core/images/index.js.map +1 -1
- package/dist/core/llm/providers/AIModelProviderManager.d.ts +3 -1
- package/dist/core/llm/providers/AIModelProviderManager.d.ts.map +1 -1
- package/dist/core/llm/providers/AIModelProviderManager.js +8 -0
- package/dist/core/llm/providers/AIModelProviderManager.js.map +1 -1
- package/dist/core/llm/providers/errors/ClaudeCodeProviderError.d.ts +52 -0
- package/dist/core/llm/providers/errors/ClaudeCodeProviderError.d.ts.map +1 -0
- package/dist/core/llm/providers/errors/ClaudeCodeProviderError.js +36 -0
- package/dist/core/llm/providers/errors/ClaudeCodeProviderError.js.map +1 -0
- package/dist/core/llm/providers/errors/GeminiCLIProviderError.d.ts +32 -0
- package/dist/core/llm/providers/errors/GeminiCLIProviderError.d.ts.map +1 -0
- package/dist/core/llm/providers/errors/GeminiCLIProviderError.js +27 -0
- package/dist/core/llm/providers/errors/GeminiCLIProviderError.js.map +1 -0
- package/dist/core/llm/providers/implementations/ClaudeCodeCLIBridge.d.ts +38 -0
- package/dist/core/llm/providers/implementations/ClaudeCodeCLIBridge.d.ts.map +1 -0
- package/dist/core/llm/providers/implementations/ClaudeCodeCLIBridge.js +128 -0
- package/dist/core/llm/providers/implementations/ClaudeCodeCLIBridge.js.map +1 -0
- package/dist/core/llm/providers/implementations/ClaudeCodeProvider.d.ts +107 -0
- package/dist/core/llm/providers/implementations/ClaudeCodeProvider.d.ts.map +1 -0
- package/dist/core/llm/providers/implementations/ClaudeCodeProvider.js +504 -0
- package/dist/core/llm/providers/implementations/ClaudeCodeProvider.js.map +1 -0
- package/dist/core/llm/providers/implementations/GeminiCLIBridge.d.ts +60 -0
- package/dist/core/llm/providers/implementations/GeminiCLIBridge.d.ts.map +1 -0
- package/dist/core/llm/providers/implementations/GeminiCLIBridge.js +177 -0
- package/dist/core/llm/providers/implementations/GeminiCLIBridge.js.map +1 -0
- package/dist/core/llm/providers/implementations/GeminiCLIProvider.d.ts +55 -0
- package/dist/core/llm/providers/implementations/GeminiCLIProvider.d.ts.map +1 -0
- package/dist/core/llm/providers/implementations/GeminiCLIProvider.js +447 -0
- package/dist/core/llm/providers/implementations/GeminiCLIProvider.js.map +1 -0
- package/dist/core/media/ProviderPreferences.d.ts +158 -0
- package/dist/core/media/ProviderPreferences.d.ts.map +1 -0
- package/dist/core/media/ProviderPreferences.js +183 -0
- package/dist/core/media/ProviderPreferences.js.map +1 -0
- package/dist/core/subprocess/CLIRegistry.d.ts +71 -0
- package/dist/core/subprocess/CLIRegistry.d.ts.map +1 -0
- package/dist/core/subprocess/CLIRegistry.js +210 -0
- package/dist/core/subprocess/CLIRegistry.js.map +1 -0
- package/dist/core/subprocess/CLISubprocessBridge.d.ts +117 -0
- package/dist/core/subprocess/CLISubprocessBridge.d.ts.map +1 -0
- package/dist/core/subprocess/CLISubprocessBridge.js +199 -0
- package/dist/core/subprocess/CLISubprocessBridge.js.map +1 -0
- package/dist/core/subprocess/errors.d.ts +76 -0
- package/dist/core/subprocess/errors.d.ts.map +1 -0
- package/dist/core/subprocess/errors.js +75 -0
- package/dist/core/subprocess/errors.js.map +1 -0
- package/dist/core/subprocess/index.d.ts +11 -0
- package/dist/core/subprocess/index.d.ts.map +1 -0
- package/dist/core/subprocess/index.js +10 -0
- package/dist/core/subprocess/index.js.map +1 -0
- package/dist/core/subprocess/types.d.ts +100 -0
- package/dist/core/subprocess/types.d.ts.map +1 -0
- package/dist/core/subprocess/types.js +9 -0
- package/dist/core/subprocess/types.js.map +1 -0
- package/dist/core/video/FallbackVideoProxy.d.ts +166 -0
- package/dist/core/video/FallbackVideoProxy.d.ts.map +1 -0
- package/dist/core/video/FallbackVideoProxy.js +228 -0
- package/dist/core/video/FallbackVideoProxy.js.map +1 -0
- package/dist/core/video/IVideoAnalyzer.d.ts +29 -0
- package/dist/core/video/IVideoAnalyzer.d.ts.map +1 -0
- package/dist/core/video/IVideoAnalyzer.js +12 -0
- package/dist/core/video/IVideoAnalyzer.js.map +1 -0
- package/dist/core/video/IVideoGenerator.d.ts +76 -0
- package/dist/core/video/IVideoGenerator.d.ts.map +1 -0
- package/dist/core/video/IVideoGenerator.js +13 -0
- package/dist/core/video/IVideoGenerator.js.map +1 -0
- package/dist/core/video/VideoAnalyzer.d.ts +278 -0
- package/dist/core/video/VideoAnalyzer.d.ts.map +1 -0
- package/dist/core/video/VideoAnalyzer.js +648 -0
- package/dist/core/video/VideoAnalyzer.js.map +1 -0
- package/dist/core/video/index.d.ts +55 -0
- package/dist/core/video/index.d.ts.map +1 -0
- package/dist/core/video/index.js +78 -0
- package/dist/core/video/index.js.map +1 -0
- package/dist/core/video/providers/FalVideoProvider.d.ts +195 -0
- package/dist/core/video/providers/FalVideoProvider.d.ts.map +1 -0
- package/dist/core/video/providers/FalVideoProvider.js +322 -0
- package/dist/core/video/providers/FalVideoProvider.js.map +1 -0
- package/dist/core/video/providers/ReplicateVideoProvider.d.ts +194 -0
- package/dist/core/video/providers/ReplicateVideoProvider.d.ts.map +1 -0
- package/dist/core/video/providers/ReplicateVideoProvider.js +356 -0
- package/dist/core/video/providers/ReplicateVideoProvider.js.map +1 -0
- package/dist/core/video/providers/RunwayVideoProvider.d.ts +175 -0
- package/dist/core/video/providers/RunwayVideoProvider.d.ts.map +1 -0
- package/dist/core/video/providers/RunwayVideoProvider.js +293 -0
- package/dist/core/video/providers/RunwayVideoProvider.js.map +1 -0
- package/dist/core/video/types.d.ts +441 -0
- package/dist/core/video/types.d.ts.map +1 -0
- package/dist/core/video/types.js +10 -0
- package/dist/core/video/types.js.map +1 -0
- package/dist/core/vision/SceneDetector.d.ts +180 -0
- package/dist/core/vision/SceneDetector.d.ts.map +1 -0
- package/dist/core/vision/SceneDetector.js +366 -0
- package/dist/core/vision/SceneDetector.js.map +1 -0
- package/dist/core/vision/index.d.ts +2 -1
- package/dist/core/vision/index.d.ts.map +1 -1
- package/dist/core/vision/index.js +1 -0
- package/dist/core/vision/index.js.map +1 -1
- package/dist/core/vision/types.d.ts +125 -0
- package/dist/core/vision/types.d.ts.map +1 -1
- package/dist/discovery/CapabilityDiscoveryEngine.d.ts +32 -0
- package/dist/discovery/CapabilityDiscoveryEngine.d.ts.map +1 -1
- package/dist/discovery/CapabilityDiscoveryEngine.js +46 -0
- package/dist/discovery/CapabilityDiscoveryEngine.js.map +1 -1
- package/dist/extensions/MultiRegistryLoader.js.map +1 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/memory/CognitiveMemoryManager.d.ts +40 -0
- package/dist/memory/CognitiveMemoryManager.d.ts.map +1 -1
- package/dist/memory/CognitiveMemoryManager.js +54 -1
- package/dist/memory/CognitiveMemoryManager.js.map +1 -1
- package/dist/memory/facade/Memory.d.ts +4 -0
- package/dist/memory/facade/Memory.d.ts.map +1 -1
- package/dist/memory/facade/Memory.js +140 -4
- package/dist/memory/facade/Memory.js.map +1 -1
- package/dist/memory/facade/types.d.ts +30 -2
- package/dist/memory/facade/types.d.ts.map +1 -1
- package/dist/memory/index.d.ts +1 -0
- package/dist/memory/index.d.ts.map +1 -1
- package/dist/memory/index.js +1 -0
- package/dist/memory/index.js.map +1 -1
- package/dist/memory/store/HnswSidecar.d.ts +115 -0
- package/dist/memory/store/HnswSidecar.d.ts.map +1 -0
- package/dist/memory/store/HnswSidecar.js +256 -0
- package/dist/memory/store/HnswSidecar.js.map +1 -0
- package/dist/memory/types.d.ts +15 -0
- package/dist/memory/types.d.ts.map +1 -1
- package/dist/query-router/QueryClassifier.d.ts +192 -21
- package/dist/query-router/QueryClassifier.d.ts.map +1 -1
- package/dist/query-router/QueryClassifier.js +604 -23
- package/dist/query-router/QueryClassifier.js.map +1 -1
- package/dist/query-router/QueryDispatcher.d.ts +106 -8
- package/dist/query-router/QueryDispatcher.d.ts.map +1 -1
- package/dist/query-router/QueryDispatcher.js +387 -8
- package/dist/query-router/QueryDispatcher.js.map +1 -1
- package/dist/query-router/QueryRouter.d.ts +198 -14
- package/dist/query-router/QueryRouter.d.ts.map +1 -1
- package/dist/query-router/QueryRouter.js +738 -50
- package/dist/query-router/QueryRouter.js.map +1 -1
- package/dist/query-router/index.d.ts +1 -1
- package/dist/query-router/index.d.ts.map +1 -1
- package/dist/query-router/index.js +1 -1
- package/dist/query-router/index.js.map +1 -1
- package/dist/query-router/types.d.ts +396 -3
- package/dist/query-router/types.d.ts.map +1 -1
- package/dist/query-router/types.js +35 -0
- package/dist/query-router/types.js.map +1 -1
- package/dist/rag/HydeRetriever.d.ts +108 -0
- package/dist/rag/HydeRetriever.d.ts.map +1 -1
- package/dist/rag/HydeRetriever.js +184 -0
- package/dist/rag/HydeRetriever.js.map +1 -1
- package/dist/rag/IRetrievalAugmentor.d.ts +15 -0
- package/dist/rag/IRetrievalAugmentor.d.ts.map +1 -1
- package/dist/rag/RetrievalAugmentor.d.ts +58 -0
- package/dist/rag/RetrievalAugmentor.d.ts.map +1 -1
- package/dist/rag/RetrievalAugmentor.js +200 -32
- package/dist/rag/RetrievalAugmentor.js.map +1 -1
- package/dist/rag/VectorStoreManager.js +1 -1
- package/dist/rag/audit/RAGAuditCollector.d.ts +7 -0
- package/dist/rag/audit/RAGAuditCollector.d.ts.map +1 -1
- package/dist/rag/audit/RAGAuditCollector.js +10 -0
- package/dist/rag/audit/RAGAuditCollector.js.map +1 -1
- package/dist/rag/audit/RAGAuditTypes.d.ts +10 -1
- package/dist/rag/audit/RAGAuditTypes.d.ts.map +1 -1
- package/dist/rag/chunking/SemanticChunker.d.ts +210 -0
- package/dist/rag/chunking/SemanticChunker.d.ts.map +1 -0
- package/dist/rag/chunking/SemanticChunker.js +460 -0
- package/dist/rag/chunking/SemanticChunker.js.map +1 -0
- package/dist/rag/chunking/index.d.ts +10 -0
- package/dist/rag/chunking/index.d.ts.map +1 -0
- package/dist/rag/chunking/index.js +10 -0
- package/dist/rag/chunking/index.js.map +1 -0
- package/dist/rag/implementations/vector_stores/PineconeVectorStore.d.ts +103 -0
- package/dist/rag/implementations/vector_stores/PineconeVectorStore.d.ts.map +1 -0
- package/dist/rag/implementations/vector_stores/PineconeVectorStore.js +315 -0
- package/dist/rag/implementations/vector_stores/PineconeVectorStore.js.map +1 -0
- package/dist/rag/implementations/vector_stores/PostgresVectorStore.d.ts +107 -0
- package/dist/rag/implementations/vector_stores/PostgresVectorStore.d.ts.map +1 -0
- package/dist/rag/implementations/vector_stores/PostgresVectorStore.js +438 -0
- package/dist/rag/implementations/vector_stores/PostgresVectorStore.js.map +1 -0
- package/dist/rag/index.d.ts +15 -1
- package/dist/rag/index.d.ts.map +1 -1
- package/dist/rag/index.js +32 -0
- package/dist/rag/index.js.map +1 -1
- package/dist/rag/migration/MigrationEngine.d.ts +47 -0
- package/dist/rag/migration/MigrationEngine.d.ts.map +1 -0
- package/dist/rag/migration/MigrationEngine.js +168 -0
- package/dist/rag/migration/MigrationEngine.js.map +1 -0
- package/dist/rag/migration/adapters/PineconeSourceAdapter.d.ts +23 -0
- package/dist/rag/migration/adapters/PineconeSourceAdapter.d.ts.map +1 -0
- package/dist/rag/migration/adapters/PineconeSourceAdapter.js +63 -0
- package/dist/rag/migration/adapters/PineconeSourceAdapter.js.map +1 -0
- package/dist/rag/migration/adapters/PostgresSourceAdapter.d.ts +30 -0
- package/dist/rag/migration/adapters/PostgresSourceAdapter.d.ts.map +1 -0
- package/dist/rag/migration/adapters/PostgresSourceAdapter.js +71 -0
- package/dist/rag/migration/adapters/PostgresSourceAdapter.js.map +1 -0
- package/dist/rag/migration/adapters/PostgresTargetAdapter.d.ts +38 -0
- package/dist/rag/migration/adapters/PostgresTargetAdapter.d.ts.map +1 -0
- package/dist/rag/migration/adapters/PostgresTargetAdapter.js +114 -0
- package/dist/rag/migration/adapters/PostgresTargetAdapter.js.map +1 -0
- package/dist/rag/migration/adapters/QdrantSourceAdapter.d.ts +36 -0
- package/dist/rag/migration/adapters/QdrantSourceAdapter.d.ts.map +1 -0
- package/dist/rag/migration/adapters/QdrantSourceAdapter.js +109 -0
- package/dist/rag/migration/adapters/QdrantSourceAdapter.js.map +1 -0
- package/dist/rag/migration/adapters/QdrantTargetAdapter.d.ts +35 -0
- package/dist/rag/migration/adapters/QdrantTargetAdapter.d.ts.map +1 -0
- package/dist/rag/migration/adapters/QdrantTargetAdapter.js +110 -0
- package/dist/rag/migration/adapters/QdrantTargetAdapter.js.map +1 -0
- package/dist/rag/migration/adapters/SqliteSourceAdapter.d.ts +37 -0
- package/dist/rag/migration/adapters/SqliteSourceAdapter.d.ts.map +1 -0
- package/dist/rag/migration/adapters/SqliteSourceAdapter.js +72 -0
- package/dist/rag/migration/adapters/SqliteSourceAdapter.js.map +1 -0
- package/dist/rag/migration/adapters/SqliteTargetAdapter.d.ts +47 -0
- package/dist/rag/migration/adapters/SqliteTargetAdapter.d.ts.map +1 -0
- package/dist/rag/migration/adapters/SqliteTargetAdapter.js +93 -0
- package/dist/rag/migration/adapters/SqliteTargetAdapter.js.map +1 -0
- package/dist/rag/migration/types.d.ts +108 -0
- package/dist/rag/migration/types.d.ts.map +1 -0
- package/dist/rag/migration/types.js +11 -0
- package/dist/rag/migration/types.js.map +1 -0
- package/dist/rag/multimodal/MultimodalIndexer.d.ts +35 -0
- package/dist/rag/multimodal/MultimodalIndexer.d.ts.map +1 -1
- package/dist/rag/multimodal/MultimodalIndexer.js +66 -1
- package/dist/rag/multimodal/MultimodalIndexer.js.map +1 -1
- package/dist/rag/multimodal/types.d.ts +24 -0
- package/dist/rag/multimodal/types.d.ts.map +1 -1
- package/dist/rag/raptor/RaptorTree.d.ts +268 -0
- package/dist/rag/raptor/RaptorTree.d.ts.map +1 -0
- package/dist/rag/raptor/RaptorTree.js +443 -0
- package/dist/rag/raptor/RaptorTree.js.map +1 -0
- package/dist/rag/raptor/index.d.ts +11 -0
- package/dist/rag/raptor/index.d.ts.map +1 -0
- package/dist/rag/raptor/index.js +11 -0
- package/dist/rag/raptor/index.js.map +1 -0
- package/dist/rag/reranking/providers/CohereReranker.js.map +1 -1
- package/dist/rag/search/BM25Index.d.ts +282 -0
- package/dist/rag/search/BM25Index.d.ts.map +1 -0
- package/dist/rag/search/BM25Index.js +344 -0
- package/dist/rag/search/BM25Index.js.map +1 -0
- package/dist/rag/search/HybridSearcher.d.ts +198 -0
- package/dist/rag/search/HybridSearcher.d.ts.map +1 -0
- package/dist/rag/search/HybridSearcher.js +316 -0
- package/dist/rag/search/HybridSearcher.js.map +1 -0
- package/dist/rag/search/index.d.ts +12 -0
- package/dist/rag/search/index.d.ts.map +1 -0
- package/dist/rag/search/index.js +12 -0
- package/dist/rag/search/index.js.map +1 -0
- package/dist/rag/setup/DockerDetector.d.ts +67 -0
- package/dist/rag/setup/DockerDetector.d.ts.map +1 -0
- package/dist/rag/setup/DockerDetector.js +125 -0
- package/dist/rag/setup/DockerDetector.js.map +1 -0
- package/dist/rag/setup/PostgresSetup.d.ts +20 -0
- package/dist/rag/setup/PostgresSetup.d.ts.map +1 -0
- package/dist/rag/setup/PostgresSetup.js +133 -0
- package/dist/rag/setup/PostgresSetup.js.map +1 -0
- package/dist/rag/setup/QdrantSetup.d.ts +26 -0
- package/dist/rag/setup/QdrantSetup.d.ts.map +1 -0
- package/dist/rag/setup/QdrantSetup.js +96 -0
- package/dist/rag/setup/QdrantSetup.js.map +1 -0
- package/dist/rag/setup/types.d.ts +55 -0
- package/dist/rag/setup/types.d.ts.map +1 -0
- package/dist/rag/setup/types.js +6 -0
- package/dist/rag/setup/types.js.map +1 -0
- package/dist/rag/unified/UnifiedRetriever.d.ts +472 -0
- package/dist/rag/unified/UnifiedRetriever.d.ts.map +1 -0
- package/dist/rag/unified/UnifiedRetriever.js +887 -0
- package/dist/rag/unified/UnifiedRetriever.js.map +1 -0
- package/dist/rag/unified/index.d.ts +24 -0
- package/dist/rag/unified/index.d.ts.map +1 -0
- package/dist/rag/unified/index.js +23 -0
- package/dist/rag/unified/index.js.map +1 -0
- package/dist/rag/unified/types.d.ts +546 -0
- package/dist/rag/unified/types.d.ts.map +1 -0
- package/dist/rag/unified/types.js +177 -0
- package/dist/rag/unified/types.js.map +1 -0
- package/dist/speech/providers/AssemblyAISTTProvider.js.map +1 -1
- package/dist/speech/providers/AzureSpeechSTTProvider.js.map +1 -1
- package/dist/speech/providers/BuiltInAdaptiveVadProvider.d.ts +1 -1
- package/dist/speech/providers/DeepgramBatchSTTProvider.js.map +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,346 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/audio/providers/ReplicateAudioProvider
|
|
3
|
+
*
|
|
4
|
+
* Audio generation provider for the Replicate API, supporting both music
|
|
5
|
+
* and sound effects through different default models.
|
|
6
|
+
*
|
|
7
|
+
* Replicate hosts open-source audio models (MusicGen, AudioGen, etc.) behind
|
|
8
|
+
* a uniform predictions API. This provider mirrors the pattern established
|
|
9
|
+
* by {@link ReplicateVideoProvider}: create a prediction with `Prefer: wait`,
|
|
10
|
+
* then poll if it hasn't completed inline.
|
|
11
|
+
*
|
|
12
|
+
* ## Supported models
|
|
13
|
+
*
|
|
14
|
+
* | Model ID | Type | Description |
|
|
15
|
+
* |-----------------------|-------|--------------------------------|
|
|
16
|
+
* | `meta/musicgen` | Music | Meta's MusicGen on Replicate |
|
|
17
|
+
* | `meta/audiogen` | SFX | Meta's AudioGen on Replicate |
|
|
18
|
+
*
|
|
19
|
+
* ## API flow (submit + sync wait + optional poll)
|
|
20
|
+
*
|
|
21
|
+
* 1. **Create prediction** — `POST ${baseURL}/predictions` with
|
|
22
|
+
* `Prefer: wait=60`. If the model finishes within 60 seconds the
|
|
23
|
+
* response already contains the output.
|
|
24
|
+
* 2. **Poll** (if needed) — `GET prediction.urls.get` until `status` is
|
|
25
|
+
* `succeeded`, `failed`, or `canceled`.
|
|
26
|
+
* 3. **Result** — `output` is the audio URL (string or first array element).
|
|
27
|
+
*
|
|
28
|
+
* ## Authentication
|
|
29
|
+
*
|
|
30
|
+
* Requires a `REPLICATE_API_TOKEN`. Sent as `Authorization: Token ${apiKey}`.
|
|
31
|
+
*
|
|
32
|
+
* @see {@link IAudioGenerator} for the provider interface contract.
|
|
33
|
+
* @see {@link ReplicateVideoProvider} for the video counterpart.
|
|
34
|
+
*/
|
|
35
|
+
// ---------------------------------------------------------------------------
|
|
36
|
+
// Helpers
|
|
37
|
+
// ---------------------------------------------------------------------------
|
|
38
|
+
/**
|
|
39
|
+
* Sleep for the specified number of milliseconds.
|
|
40
|
+
* @param ms - Duration in milliseconds.
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
function sleep(ms) {
|
|
44
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Extract an audio URL from the Replicate prediction output.
|
|
48
|
+
*
|
|
49
|
+
* Replicate returns output in different shapes depending on the model:
|
|
50
|
+
* - A plain URL string
|
|
51
|
+
* - An array of URL strings (first element is the audio)
|
|
52
|
+
* - An object with a `url` or `audio` property
|
|
53
|
+
*
|
|
54
|
+
* @param output - Raw output from the prediction.
|
|
55
|
+
* @returns The audio URL string, or `undefined` if not found.
|
|
56
|
+
* @internal
|
|
57
|
+
*/
|
|
58
|
+
function extractAudioUrl(output) {
|
|
59
|
+
if (typeof output === 'string')
|
|
60
|
+
return output;
|
|
61
|
+
if (Array.isArray(output)) {
|
|
62
|
+
for (const item of output) {
|
|
63
|
+
if (typeof item === 'string')
|
|
64
|
+
return item;
|
|
65
|
+
if (item && typeof item === 'object') {
|
|
66
|
+
const obj = item;
|
|
67
|
+
if (typeof obj.url === 'string')
|
|
68
|
+
return obj.url;
|
|
69
|
+
if (typeof obj.audio === 'string')
|
|
70
|
+
return obj.audio;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
|
75
|
+
if (output && typeof output === 'object') {
|
|
76
|
+
const obj = output;
|
|
77
|
+
if (typeof obj.url === 'string')
|
|
78
|
+
return obj.url;
|
|
79
|
+
if (typeof obj.audio === 'string')
|
|
80
|
+
return obj.audio;
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
// ---------------------------------------------------------------------------
|
|
85
|
+
// Implementation
|
|
86
|
+
// ---------------------------------------------------------------------------
|
|
87
|
+
/**
|
|
88
|
+
* Audio generation provider connecting to the Replicate predictions API.
|
|
89
|
+
*
|
|
90
|
+
* Follows the same submit-then-poll pattern as {@link ReplicateVideoProvider}:
|
|
91
|
+
* create a prediction with `Prefer: wait=60`, then poll if the model takes
|
|
92
|
+
* longer than the wait window.
|
|
93
|
+
*
|
|
94
|
+
* Routes to different default models based on whether music or SFX is requested.
|
|
95
|
+
*
|
|
96
|
+
* @implements {IAudioGenerator}
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const provider = new ReplicateAudioProvider();
|
|
101
|
+
* await provider.initialize({ apiKey: process.env.REPLICATE_API_TOKEN! });
|
|
102
|
+
*
|
|
103
|
+
* const music = await provider.generateMusic({
|
|
104
|
+
* prompt: 'Upbeat indie rock with driving guitars',
|
|
105
|
+
* });
|
|
106
|
+
*
|
|
107
|
+
* const sfx = await provider.generateSFX({
|
|
108
|
+
* prompt: 'Glass shattering on a hard floor',
|
|
109
|
+
* });
|
|
110
|
+
* ```
|
|
111
|
+
*/
|
|
112
|
+
export class ReplicateAudioProvider {
|
|
113
|
+
constructor() {
|
|
114
|
+
/** @inheritdoc */
|
|
115
|
+
this.providerId = 'replicate-audio';
|
|
116
|
+
/** @inheritdoc */
|
|
117
|
+
this.isInitialized = false;
|
|
118
|
+
}
|
|
119
|
+
// -------------------------------------------------------------------------
|
|
120
|
+
// Lifecycle
|
|
121
|
+
// -------------------------------------------------------------------------
|
|
122
|
+
/**
|
|
123
|
+
* Initialize the provider with API credentials and optional configuration.
|
|
124
|
+
*
|
|
125
|
+
* @param config - Configuration object. Must include `apiKey`.
|
|
126
|
+
* @throws {Error} If `apiKey` is missing or empty.
|
|
127
|
+
*/
|
|
128
|
+
async initialize(config) {
|
|
129
|
+
const apiKey = typeof config.apiKey === 'string' ? config.apiKey.trim() : '';
|
|
130
|
+
if (!apiKey) {
|
|
131
|
+
throw new Error('Replicate audio provider requires apiKey (REPLICATE_API_TOKEN).');
|
|
132
|
+
}
|
|
133
|
+
this._config = {
|
|
134
|
+
apiKey,
|
|
135
|
+
baseURL: typeof config.baseURL === 'string' && config.baseURL.trim()
|
|
136
|
+
? config.baseURL.trim()
|
|
137
|
+
: 'https://api.replicate.com/v1',
|
|
138
|
+
defaultMusicModel: typeof config.defaultMusicModel === 'string' && config.defaultMusicModel.trim()
|
|
139
|
+
? config.defaultMusicModel.trim()
|
|
140
|
+
: 'meta/musicgen',
|
|
141
|
+
defaultSfxModel: typeof config.defaultSfxModel === 'string' && config.defaultSfxModel.trim()
|
|
142
|
+
? config.defaultSfxModel.trim()
|
|
143
|
+
: 'meta/audiogen',
|
|
144
|
+
pollIntervalMs: typeof config.pollIntervalMs === 'number' && config.pollIntervalMs > 0
|
|
145
|
+
? config.pollIntervalMs
|
|
146
|
+
: 5000,
|
|
147
|
+
timeoutMs: typeof config.timeoutMs === 'number' && config.timeoutMs > 0
|
|
148
|
+
? config.timeoutMs
|
|
149
|
+
: 300000,
|
|
150
|
+
};
|
|
151
|
+
this.defaultModelId = this._config.defaultMusicModel;
|
|
152
|
+
this.isInitialized = true;
|
|
153
|
+
}
|
|
154
|
+
// -------------------------------------------------------------------------
|
|
155
|
+
// Generation
|
|
156
|
+
// -------------------------------------------------------------------------
|
|
157
|
+
/**
|
|
158
|
+
* Generate music from a text prompt using a music model on Replicate.
|
|
159
|
+
*
|
|
160
|
+
* @param request - Music generation request with prompt and optional params.
|
|
161
|
+
* @returns The generated audio result envelope.
|
|
162
|
+
*
|
|
163
|
+
* @throws {Error} If the provider is not initialized.
|
|
164
|
+
* @throws {Error} If the API returns an error or times out.
|
|
165
|
+
*/
|
|
166
|
+
async generateMusic(request) {
|
|
167
|
+
if (!this.isInitialized) {
|
|
168
|
+
throw new Error('Replicate audio provider is not initialized. Call initialize() first.');
|
|
169
|
+
}
|
|
170
|
+
const model = request.modelId || this._config.defaultMusicModel;
|
|
171
|
+
const input = {
|
|
172
|
+
prompt: request.prompt,
|
|
173
|
+
};
|
|
174
|
+
if (request.durationSec !== undefined)
|
|
175
|
+
input.duration = request.durationSec;
|
|
176
|
+
const prediction = await this._runPrediction(model, input);
|
|
177
|
+
return this._buildResult(prediction, model);
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* Generate a sound effect from a text prompt using an SFX model on Replicate.
|
|
181
|
+
*
|
|
182
|
+
* @param request - SFX generation request with prompt and optional params.
|
|
183
|
+
* @returns The generated audio result envelope.
|
|
184
|
+
*
|
|
185
|
+
* @throws {Error} If the provider is not initialized.
|
|
186
|
+
* @throws {Error} If the API returns an error or times out.
|
|
187
|
+
*/
|
|
188
|
+
async generateSFX(request) {
|
|
189
|
+
if (!this.isInitialized) {
|
|
190
|
+
throw new Error('Replicate audio provider is not initialized. Call initialize() first.');
|
|
191
|
+
}
|
|
192
|
+
const model = request.modelId || this._config.defaultSfxModel;
|
|
193
|
+
const input = {
|
|
194
|
+
prompt: request.prompt,
|
|
195
|
+
};
|
|
196
|
+
if (request.durationSec !== undefined)
|
|
197
|
+
input.duration = request.durationSec;
|
|
198
|
+
const prediction = await this._runPrediction(model, input);
|
|
199
|
+
return this._buildResult(prediction, model);
|
|
200
|
+
}
|
|
201
|
+
// -------------------------------------------------------------------------
|
|
202
|
+
// Capability query
|
|
203
|
+
// -------------------------------------------------------------------------
|
|
204
|
+
/**
|
|
205
|
+
* Replicate audio supports both music and SFX generation through
|
|
206
|
+
* different model routing.
|
|
207
|
+
*
|
|
208
|
+
* @param capability - The capability to check.
|
|
209
|
+
* @returns `true` for both `'music'` and `'sfx'`.
|
|
210
|
+
*/
|
|
211
|
+
supports(capability) {
|
|
212
|
+
return capability === 'music' || capability === 'sfx';
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Release any resources held by the provider. No-op for HTTP-only providers.
|
|
216
|
+
*/
|
|
217
|
+
async shutdown() {
|
|
218
|
+
this.isInitialized = false;
|
|
219
|
+
}
|
|
220
|
+
// -------------------------------------------------------------------------
|
|
221
|
+
// Private helpers
|
|
222
|
+
// -------------------------------------------------------------------------
|
|
223
|
+
/**
|
|
224
|
+
* Create a prediction and wait for it to complete.
|
|
225
|
+
*
|
|
226
|
+
* Uses `Prefer: wait=60` to get synchronous completion for fast models.
|
|
227
|
+
* Falls back to polling if the prediction hasn't completed within the
|
|
228
|
+
* wait window.
|
|
229
|
+
*
|
|
230
|
+
* @param model - Model identifier (e.g. 'meta/musicgen').
|
|
231
|
+
* @param input - Model input parameters.
|
|
232
|
+
* @returns The completed prediction object.
|
|
233
|
+
*
|
|
234
|
+
* @throws {Error} If prediction creation fails, the prediction fails,
|
|
235
|
+
* is canceled, or times out.
|
|
236
|
+
* @internal
|
|
237
|
+
*/
|
|
238
|
+
async _runPrediction(model, input) {
|
|
239
|
+
let prediction = await this._createPrediction(model, input);
|
|
240
|
+
// If the prediction hasn't reached a terminal state, poll for it.
|
|
241
|
+
if (prediction.status
|
|
242
|
+
&& !['succeeded', 'failed', 'canceled'].includes(prediction.status)
|
|
243
|
+
&& prediction.urls?.get) {
|
|
244
|
+
prediction = await this._pollPrediction(prediction.urls.get);
|
|
245
|
+
}
|
|
246
|
+
if (prediction.status === 'failed') {
|
|
247
|
+
throw new Error(`Replicate audio generation failed: ${prediction.error ?? 'unknown error'}`);
|
|
248
|
+
}
|
|
249
|
+
if (prediction.status === 'canceled') {
|
|
250
|
+
throw new Error('Replicate audio generation was canceled.');
|
|
251
|
+
}
|
|
252
|
+
return prediction;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Create a new prediction via `POST /predictions`.
|
|
256
|
+
*
|
|
257
|
+
* @param model - Model identifier.
|
|
258
|
+
* @param input - Model input parameters.
|
|
259
|
+
* @returns The prediction response (may or may not be completed).
|
|
260
|
+
*
|
|
261
|
+
* @throws {Error} If the HTTP request fails.
|
|
262
|
+
* @internal
|
|
263
|
+
*/
|
|
264
|
+
async _createPrediction(model, input) {
|
|
265
|
+
const body = {
|
|
266
|
+
model,
|
|
267
|
+
input,
|
|
268
|
+
};
|
|
269
|
+
const response = await fetch(`${this._config.baseURL}/predictions`, {
|
|
270
|
+
method: 'POST',
|
|
271
|
+
headers: {
|
|
272
|
+
Authorization: `Token ${this._config.apiKey}`,
|
|
273
|
+
'Content-Type': 'application/json',
|
|
274
|
+
Prefer: 'wait=60',
|
|
275
|
+
},
|
|
276
|
+
body: JSON.stringify(body),
|
|
277
|
+
});
|
|
278
|
+
if (!response.ok) {
|
|
279
|
+
const errorText = await response.text();
|
|
280
|
+
throw new Error(`Replicate audio prediction submission failed (${response.status}): ${errorText}`);
|
|
281
|
+
}
|
|
282
|
+
return (await response.json());
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Poll a prediction URL until it reaches a terminal state.
|
|
286
|
+
*
|
|
287
|
+
* @param url - The `prediction.urls.get` URL to poll.
|
|
288
|
+
* @returns The completed prediction object.
|
|
289
|
+
*
|
|
290
|
+
* @throws {Error} If polling fails or times out.
|
|
291
|
+
* @internal
|
|
292
|
+
*/
|
|
293
|
+
async _pollPrediction(url) {
|
|
294
|
+
const startedAt = Date.now();
|
|
295
|
+
while (Date.now() - startedAt < this._config.timeoutMs) {
|
|
296
|
+
const response = await fetch(url, {
|
|
297
|
+
headers: {
|
|
298
|
+
Authorization: `Token ${this._config.apiKey}`,
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
if (!response.ok) {
|
|
302
|
+
const errorText = await response.text();
|
|
303
|
+
throw new Error(`Replicate audio prediction polling failed (${response.status}): ${errorText}`);
|
|
304
|
+
}
|
|
305
|
+
const prediction = (await response.json());
|
|
306
|
+
if (!prediction.status
|
|
307
|
+
|| ['succeeded', 'failed', 'canceled'].includes(prediction.status)) {
|
|
308
|
+
return prediction;
|
|
309
|
+
}
|
|
310
|
+
await sleep(this._config.pollIntervalMs);
|
|
311
|
+
}
|
|
312
|
+
throw new Error(`Replicate audio generation timed out after ${this._config.timeoutMs}ms.`);
|
|
313
|
+
}
|
|
314
|
+
/**
|
|
315
|
+
* Build an {@link AudioResult} from a completed Replicate prediction.
|
|
316
|
+
*
|
|
317
|
+
* @param prediction - The succeeded prediction object.
|
|
318
|
+
* @param model - Model ID used for the generation.
|
|
319
|
+
* @returns Normalized audio result envelope.
|
|
320
|
+
*
|
|
321
|
+
* @throws {Error} If no audio URL could be extracted from the output.
|
|
322
|
+
* @internal
|
|
323
|
+
*/
|
|
324
|
+
_buildResult(prediction, model) {
|
|
325
|
+
const audioUrl = extractAudioUrl(prediction.output);
|
|
326
|
+
if (!audioUrl) {
|
|
327
|
+
throw new Error('Replicate audio prediction succeeded but returned no audio output.');
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
created: Math.floor(Date.now() / 1000),
|
|
331
|
+
modelId: model,
|
|
332
|
+
providerId: this.providerId,
|
|
333
|
+
audio: [{
|
|
334
|
+
url: audioUrl,
|
|
335
|
+
mimeType: 'audio/mpeg',
|
|
336
|
+
providerMetadata: {
|
|
337
|
+
predictionId: prediction.id,
|
|
338
|
+
},
|
|
339
|
+
}],
|
|
340
|
+
usage: {
|
|
341
|
+
totalAudioClips: 1,
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
//# sourceMappingURL=ReplicateAudioProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReplicateAudioProvider.js","sourceRoot":"","sources":["../../../../src/core/audio/providers/ReplicateAudioProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAoFH,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;GAIG;AACH,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;;;;;GAWG;AACH,SAAS,eAAe,CAAC,MAAe;IACtC,IAAI,OAAO,MAAM,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC;IAE9C,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;QAC1B,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;YAC1B,IAAI,OAAO,IAAI,KAAK,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAC1C,IAAI,IAAI,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;gBACrC,MAAM,GAAG,GAAG,IAA+B,CAAC;gBAC5C,IAAI,OAAO,GAAG,CAAC,GAAG,KAAK,QAAQ;oBAAE,OAAO,GAAG,CAAC,GAAG,CAAC;gBAChD,IAAI,OAAO,GAAG,CAAC,KAAK,KAAK,QAAQ;oBAAE,OAAO,GAAG,CAAC,KAAK,CAAC;YACtD,CAAC;QACH,CAAC;QACD,OAAO,SA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C;QACxF,CAAC;QAED,OAAO;YACL,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;YACtC,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,IAAI,CAAC,UAAU;YAC3B,KAAK,EAAE,CAAC;oBACN,GAAG,EAAE,QAAQ;oBACb,QAAQ,EAAE,YAAY;oBACtB,gBAAgB,EAAE;wBAChB,YAAY,EAAE,UAAU,CAAC,EAAE;qBAC5B;iBACF,CAAC;YACF,KAAK,EAAE;gBACL,eAAe,EAAE,CAAC;aACnB;SACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/audio/providers/StableAudioProvider
|
|
3
|
+
*
|
|
4
|
+
* Audio generation provider for the Stability AI Stable Audio API.
|
|
5
|
+
*
|
|
6
|
+
* Stable Audio generates both music and sound effects from text prompts
|
|
7
|
+
* using the Stable Audio Open model. The API is synchronous: a single
|
|
8
|
+
* POST request returns audio data directly (no queue or polling).
|
|
9
|
+
*
|
|
10
|
+
* ## Supported models
|
|
11
|
+
*
|
|
12
|
+
* | Model ID | Description |
|
|
13
|
+
* |----------------------------|------------------------------------|
|
|
14
|
+
* | `stable-audio-open-1.0` | Stable Audio Open 1.0 — default |
|
|
15
|
+
*
|
|
16
|
+
* ## API flow (synchronous)
|
|
17
|
+
*
|
|
18
|
+
* 1. **Generate** — `POST ${baseURL}/audio/generate` with prompt, duration,
|
|
19
|
+
* and output format. Returns audio data directly in the response body.
|
|
20
|
+
*
|
|
21
|
+
* ## Authentication
|
|
22
|
+
*
|
|
23
|
+
* Requires a `STABILITY_API_KEY`. Sent as `Authorization: Bearer ${apiKey}`.
|
|
24
|
+
*
|
|
25
|
+
* @see {@link IAudioGenerator} for the provider interface contract.
|
|
26
|
+
*/
|
|
27
|
+
import type { IAudioGenerator } from '../IAudioGenerator.js';
|
|
28
|
+
import type { MusicGenerateRequest, SFXGenerateRequest, AudioResult } from '../types.js';
|
|
29
|
+
/**
|
|
30
|
+
* Configuration for the Stability AI audio generation provider.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* const config: StableAudioProviderConfig = {
|
|
35
|
+
* apiKey: process.env.STABILITY_API_KEY!,
|
|
36
|
+
* defaultModelId: 'stable-audio-open-1.0',
|
|
37
|
+
* };
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
export interface StableAudioProviderConfig {
|
|
41
|
+
/** Stability AI API key. Sent as `Authorization: Bearer ${apiKey}`. */
|
|
42
|
+
apiKey: string;
|
|
43
|
+
/**
|
|
44
|
+
* Base URL for the Stability AI API. Override for testing or proxy setups.
|
|
45
|
+
* @default 'https://api.stability.ai/v2beta'
|
|
46
|
+
*/
|
|
47
|
+
baseURL?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Default model to use when the request doesn't specify one.
|
|
50
|
+
* @default 'stable-audio-open-1.0'
|
|
51
|
+
*/
|
|
52
|
+
defaultModelId?: string;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Audio generation provider connecting to the Stability AI Stable Audio API.
|
|
56
|
+
*
|
|
57
|
+
* Implements a synchronous request pattern: a single POST request returns
|
|
58
|
+
* the generated audio data directly. Supports both music and SFX generation.
|
|
59
|
+
*
|
|
60
|
+
* @implements {IAudioGenerator}
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const provider = new StableAudioProvider();
|
|
65
|
+
* await provider.initialize({ apiKey: process.env.STABILITY_API_KEY! });
|
|
66
|
+
*
|
|
67
|
+
* const result = await provider.generateMusic({
|
|
68
|
+
* prompt: 'Upbeat electronic dance track with heavy bass',
|
|
69
|
+
* durationSec: 30,
|
|
70
|
+
* });
|
|
71
|
+
* console.log(result.audio[0].url);
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
export declare class StableAudioProvider implements IAudioGenerator {
|
|
75
|
+
/** @inheritdoc */
|
|
76
|
+
readonly providerId = "stable-audio";
|
|
77
|
+
/** @inheritdoc */
|
|
78
|
+
isInitialized: boolean;
|
|
79
|
+
/** @inheritdoc */
|
|
80
|
+
defaultModelId?: string;
|
|
81
|
+
/** Internal resolved configuration. */
|
|
82
|
+
private _config;
|
|
83
|
+
/**
|
|
84
|
+
* Initialize the provider with API credentials and optional configuration.
|
|
85
|
+
*
|
|
86
|
+
* @param config - Configuration object. Must include `apiKey`.
|
|
87
|
+
* @throws {Error} If `apiKey` is missing or empty.
|
|
88
|
+
*/
|
|
89
|
+
initialize(config: Record<string, unknown>): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Generate music from a text prompt using the Stability AI audio endpoint.
|
|
92
|
+
*
|
|
93
|
+
* @param request - Music generation request with prompt and optional params.
|
|
94
|
+
* @returns The generated audio result envelope.
|
|
95
|
+
*
|
|
96
|
+
* @throws {Error} If the provider is not initialized.
|
|
97
|
+
* @throws {Error} If the API returns an error.
|
|
98
|
+
*/
|
|
99
|
+
generateMusic(request: MusicGenerateRequest): Promise<AudioResult>;
|
|
100
|
+
/**
|
|
101
|
+
* Generate a sound effect from a text prompt using the Stability AI audio endpoint.
|
|
102
|
+
*
|
|
103
|
+
* @param request - SFX generation request with prompt and optional params.
|
|
104
|
+
* @returns The generated audio result envelope.
|
|
105
|
+
*
|
|
106
|
+
* @throws {Error} If the provider is not initialized.
|
|
107
|
+
* @throws {Error} If the API returns an error.
|
|
108
|
+
*/
|
|
109
|
+
generateSFX(request: SFXGenerateRequest): Promise<AudioResult>;
|
|
110
|
+
/**
|
|
111
|
+
* Stable Audio supports both music and SFX generation.
|
|
112
|
+
*
|
|
113
|
+
* @param capability - The capability to check.
|
|
114
|
+
* @returns `true` for both `'music'` and `'sfx'`.
|
|
115
|
+
*/
|
|
116
|
+
supports(capability: 'music' | 'sfx'): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Release any resources held by the provider. No-op for HTTP-only providers.
|
|
119
|
+
*/
|
|
120
|
+
shutdown(): Promise<void>;
|
|
121
|
+
/**
|
|
122
|
+
* Send a synchronous audio generation request to the Stability AI API.
|
|
123
|
+
*
|
|
124
|
+
* The API returns audio data directly in the response body (no queue or
|
|
125
|
+
* polling required). The response is treated as a binary blob and converted
|
|
126
|
+
* to a base64-encoded string.
|
|
127
|
+
*
|
|
128
|
+
* @param prompt - Text description of the desired audio.
|
|
129
|
+
* @param durationSec - Desired duration in seconds.
|
|
130
|
+
* @param modelId - Optional model override.
|
|
131
|
+
* @returns Normalized audio result envelope.
|
|
132
|
+
*
|
|
133
|
+
* @throws {Error} If the HTTP request fails.
|
|
134
|
+
* @internal
|
|
135
|
+
*/
|
|
136
|
+
private _generate;
|
|
137
|
+
}
|
|
138
|
+
//# sourceMappingURL=StableAudioProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StableAudioProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/audio/providers/StableAudioProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAMzF;;;;;;;;;;GAUG;AACH,MAAM,WAAW,yBAAyB;IACxC,uEAAuE;IACvE,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAMD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,kBAAkB;IAClB,SAAgB,UAAU,kBAAkB;IAE5C,kBAAkB;IACX,aAAa,UAAS;IAE7B,kBAAkB;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;IAE/B,u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