@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,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/video/providers/RunwayVideoProvider
|
|
3
|
+
*
|
|
4
|
+
* Video generation provider for the Runway Gen-3 Alpha API.
|
|
5
|
+
*
|
|
6
|
+
* Runway offers high-quality AI video generation with both text-to-video
|
|
7
|
+
* and image-to-video capabilities. This provider implements the submit-then-
|
|
8
|
+
* poll pattern: a generation task is created via POST, then polled via GET
|
|
9
|
+
* until the task reaches a terminal state.
|
|
10
|
+
*
|
|
11
|
+
* ## Supported models
|
|
12
|
+
*
|
|
13
|
+
* | Model ID | Description |
|
|
14
|
+
* |----------------|----------------------------------------|
|
|
15
|
+
* | `gen3a_turbo` | Gen-3 Alpha Turbo — fast, lower cost |
|
|
16
|
+
* | `gen3a` | Gen-3 Alpha — highest quality |
|
|
17
|
+
*
|
|
18
|
+
* ## API flow
|
|
19
|
+
*
|
|
20
|
+
* 1. **Submit** — `POST ${baseURL}/text_to_video` or `/image_to_video`.
|
|
21
|
+
* Returns a task object with `{ id }`.
|
|
22
|
+
* 2. **Poll** — `GET ${baseURL}/tasks/${id}` until `status` is
|
|
23
|
+
* `SUCCEEDED` or `FAILED`.
|
|
24
|
+
* 3. **Result** — `output[0]` on the SUCCEEDED task is the video URL.
|
|
25
|
+
*
|
|
26
|
+
* ## Authentication
|
|
27
|
+
*
|
|
28
|
+
* Requires a `RUNWAY_API_KEY`. Sent as `Authorization: Bearer ${apiKey}`.
|
|
29
|
+
*
|
|
30
|
+
* @see {@link IVideoGenerator} for the provider interface contract.
|
|
31
|
+
*/
|
|
32
|
+
import type { IVideoGenerator } from '../IVideoGenerator.js';
|
|
33
|
+
import type { VideoGenerateRequest, ImageToVideoRequest, VideoResult } from '../types.js';
|
|
34
|
+
/**
|
|
35
|
+
* Configuration for the Runway video generation provider.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const config: RunwayVideoProviderConfig = {
|
|
40
|
+
* apiKey: process.env.RUNWAY_API_KEY!,
|
|
41
|
+
* defaultModelId: 'gen3a_turbo',
|
|
42
|
+
* };
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
export interface RunwayVideoProviderConfig {
|
|
46
|
+
/** Runway API key. Sent as `Authorization: Bearer ${apiKey}`. */
|
|
47
|
+
apiKey: string;
|
|
48
|
+
/**
|
|
49
|
+
* Base URL for the Runway API. Override for testing or proxy setups.
|
|
50
|
+
* @default 'https://api.dev.runwayml.com/v1'
|
|
51
|
+
*/
|
|
52
|
+
baseURL?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Default model to use when the request doesn't specify one.
|
|
55
|
+
* @default 'gen3a_turbo'
|
|
56
|
+
*/
|
|
57
|
+
defaultModelId?: string;
|
|
58
|
+
/**
|
|
59
|
+
* Milliseconds between task status polls.
|
|
60
|
+
* @default 5000
|
|
61
|
+
*/
|
|
62
|
+
pollIntervalMs?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Maximum milliseconds to wait for generation before timing out.
|
|
65
|
+
* @default 300000
|
|
66
|
+
*/
|
|
67
|
+
timeoutMs?: number;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Video generation provider connecting to the Runway Gen-3 Alpha API.
|
|
71
|
+
*
|
|
72
|
+
* Implements the submit-then-poll pattern: a generation request returns
|
|
73
|
+
* a task ID immediately, and the provider polls the status endpoint
|
|
74
|
+
* until completion or timeout.
|
|
75
|
+
*
|
|
76
|
+
* @implements {IVideoGenerator}
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```typescript
|
|
80
|
+
* const provider = new RunwayVideoProvider();
|
|
81
|
+
* await provider.initialize({ apiKey: process.env.RUNWAY_API_KEY! });
|
|
82
|
+
*
|
|
83
|
+
* const result = await provider.generateVideo({
|
|
84
|
+
* modelId: 'gen3a_turbo',
|
|
85
|
+
* prompt: 'A cinematic drone shot over a misty forest at dawn',
|
|
86
|
+
* durationSec: 5,
|
|
87
|
+
* aspectRatio: '16:9',
|
|
88
|
+
* });
|
|
89
|
+
* console.log(result.videos[0].url);
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
export declare class RunwayVideoProvider implements IVideoGenerator {
|
|
93
|
+
/** @inheritdoc */
|
|
94
|
+
readonly providerId = "runway";
|
|
95
|
+
/** @inheritdoc */
|
|
96
|
+
isInitialized: boolean;
|
|
97
|
+
/** @inheritdoc */
|
|
98
|
+
defaultModelId?: string;
|
|
99
|
+
/** Internal resolved configuration. */
|
|
100
|
+
private _config;
|
|
101
|
+
/**
|
|
102
|
+
* Initialize the provider with API credentials and optional configuration.
|
|
103
|
+
*
|
|
104
|
+
* @param config - Configuration object. Must include `apiKey`.
|
|
105
|
+
* @throws {Error} If `apiKey` is missing or empty.
|
|
106
|
+
*/
|
|
107
|
+
initialize(config: Record<string, unknown>): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Generate a video from a text prompt using the Runway text_to_video endpoint.
|
|
110
|
+
*
|
|
111
|
+
* Submits the task, polls until completion, and returns the video result.
|
|
112
|
+
*
|
|
113
|
+
* @param request - Video generation request with prompt and optional params.
|
|
114
|
+
* @returns The generated video result envelope.
|
|
115
|
+
*
|
|
116
|
+
* @throws {Error} If the provider is not initialized.
|
|
117
|
+
* @throws {Error} If the API returns an error or times out.
|
|
118
|
+
*/
|
|
119
|
+
generateVideo(request: VideoGenerateRequest): Promise<VideoResult>;
|
|
120
|
+
/**
|
|
121
|
+
* Generate a video from a source image using the Runway image_to_video endpoint.
|
|
122
|
+
*
|
|
123
|
+
* The source image Buffer is converted to a base64 data URL for the API.
|
|
124
|
+
*
|
|
125
|
+
* @param request - Generation parameters including the source image buffer.
|
|
126
|
+
* @returns The generated video result envelope.
|
|
127
|
+
*
|
|
128
|
+
* @throws {Error} If the provider is not initialized or the API fails.
|
|
129
|
+
*/
|
|
130
|
+
imageToVideo(request: ImageToVideoRequest): Promise<VideoResult>;
|
|
131
|
+
/**
|
|
132
|
+
* Runway supports both text-to-video and image-to-video generation.
|
|
133
|
+
*
|
|
134
|
+
* @param capability - The capability to check.
|
|
135
|
+
* @returns `true` for both `'text-to-video'` and `'image-to-video'`.
|
|
136
|
+
*/
|
|
137
|
+
supports(capability: 'text-to-video' | 'image-to-video'): boolean;
|
|
138
|
+
/**
|
|
139
|
+
* Release any resources held by the provider. No-op for HTTP-only providers.
|
|
140
|
+
*/
|
|
141
|
+
shutdown(): Promise<void>;
|
|
142
|
+
/**
|
|
143
|
+
* Submit a generation task to the Runway API.
|
|
144
|
+
*
|
|
145
|
+
* @param endpoint - API endpoint path ('text_to_video' or 'image_to_video').
|
|
146
|
+
* @param body - Request body with model, prompt, and generation params.
|
|
147
|
+
* @returns The task ID for status polling.
|
|
148
|
+
*
|
|
149
|
+
* @throws {Error} If the submission request fails.
|
|
150
|
+
* @internal
|
|
151
|
+
*/
|
|
152
|
+
private _submitTask;
|
|
153
|
+
/**
|
|
154
|
+
* Poll the Runway task status endpoint until the task reaches a terminal state.
|
|
155
|
+
*
|
|
156
|
+
* @param taskId - The task ID from submission.
|
|
157
|
+
* @returns The completed task status object.
|
|
158
|
+
*
|
|
159
|
+
* @throws {Error} If the task fails or polling times out.
|
|
160
|
+
* @internal
|
|
161
|
+
*/
|
|
162
|
+
private _pollTask;
|
|
163
|
+
/**
|
|
164
|
+
* Build a {@link VideoResult} from a completed Runway task.
|
|
165
|
+
*
|
|
166
|
+
* @param task - The SUCCEEDED task status object.
|
|
167
|
+
* @param model - Model ID used for the generation.
|
|
168
|
+
* @returns Normalized video result envelope.
|
|
169
|
+
*
|
|
170
|
+
* @throws {Error} If the task has no output URLs.
|
|
171
|
+
* @internal
|
|
172
|
+
*/
|
|
173
|
+
private _buildResult;
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=RunwayVideoProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RunwayVideoProvider.d.ts","sourceRoot":"","sources":["../../../../src/core/video/providers/RunwayVideoProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EACV,oBAAoB,EACpB,mBAAmB,EACnB,WAAW,EACZ,MAAM,aAAa,CAAC;AAMrB;;;;;;;;;;GAUG;AACH,MAAM,WAAW,yBAAyB;IACxC,iEAAiE;IACjE,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAsDD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,mBAAoB,YAAW,eAAe;IACzD,kBAAkB;IAClB,SAAgB,UAAU,YAAY;IAEtC,kBAAkB;IACX,aAAa,UAAS;IAE7B,kBAAkB;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;IAE/B,uCAAuC;IACvC,OAAO,CAAC,OAAO,CAAgI;IAM/I;;;;;OAKG;IACG,UAAU,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAkChE;;;;;;;;;;OAUG;IACG,aAAa,CAAC,OAAO,EAAE,oBAAoB,GAAG,OAAO,CAAC,WAAW,CAAC;IAyBxE;;;;;;;;;OASG;IACG,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,WAAW,CAAC;IAiCtE;;;;;OAKG;IACH,QAAQ,CAAC,UAAU,EAAE,eAAe,GAAG,gBAAgB,GAAG,OAAO;IAIjE;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAQ/B;;;;;;;;;OASG;YACW,WAAW;IAyBzB;;;;;;;;OAQG;YACW,SAAS;IAoCvB;;;;;;;;;OASG;IACH,OAAO,CAAC,YAAY;CAqBrB"}
|
|
@@ -0,0 +1,293 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module core/video/providers/RunwayVideoProvider
|
|
3
|
+
*
|
|
4
|
+
* Video generation provider for the Runway Gen-3 Alpha API.
|
|
5
|
+
*
|
|
6
|
+
* Runway offers high-quality AI video generation with both text-to-video
|
|
7
|
+
* and image-to-video capabilities. This provider implements the submit-then-
|
|
8
|
+
* poll pattern: a generation task is created via POST, then polled via GET
|
|
9
|
+
* until the task reaches a terminal state.
|
|
10
|
+
*
|
|
11
|
+
* ## Supported models
|
|
12
|
+
*
|
|
13
|
+
* | Model ID | Description |
|
|
14
|
+
* |----------------|----------------------------------------|
|
|
15
|
+
* | `gen3a_turbo` | Gen-3 Alpha Turbo — fast, lower cost |
|
|
16
|
+
* | `gen3a` | Gen-3 Alpha — highest quality |
|
|
17
|
+
*
|
|
18
|
+
* ## API flow
|
|
19
|
+
*
|
|
20
|
+
* 1. **Submit** — `POST ${baseURL}/text_to_video` or `/image_to_video`.
|
|
21
|
+
* Returns a task object with `{ id }`.
|
|
22
|
+
* 2. **Poll** — `GET ${baseURL}/tasks/${id}` until `status` is
|
|
23
|
+
* `SUCCEEDED` or `FAILED`.
|
|
24
|
+
* 3. **Result** — `output[0]` on the SUCCEEDED task is the video URL.
|
|
25
|
+
*
|
|
26
|
+
* ## Authentication
|
|
27
|
+
*
|
|
28
|
+
* Requires a `RUNWAY_API_KEY`. Sent as `Authorization: Bearer ${apiKey}`.
|
|
29
|
+
*
|
|
30
|
+
* @see {@link IVideoGenerator} for the provider interface contract.
|
|
31
|
+
*/
|
|
32
|
+
// ---------------------------------------------------------------------------
|
|
33
|
+
// Helpers
|
|
34
|
+
// ---------------------------------------------------------------------------
|
|
35
|
+
/**
|
|
36
|
+
* Sleep for the specified number of milliseconds.
|
|
37
|
+
* Used between poll requests to avoid rate-limiting.
|
|
38
|
+
* @param ms - Duration in milliseconds.
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
function sleep(ms) {
|
|
42
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
43
|
+
}
|
|
44
|
+
// ---------------------------------------------------------------------------
|
|
45
|
+
// Implementation
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
/**
|
|
48
|
+
* Video generation provider connecting to the Runway Gen-3 Alpha API.
|
|
49
|
+
*
|
|
50
|
+
* Implements the submit-then-poll pattern: a generation request returns
|
|
51
|
+
* a task ID immediately, and the provider polls the status endpoint
|
|
52
|
+
* until completion or timeout.
|
|
53
|
+
*
|
|
54
|
+
* @implements {IVideoGenerator}
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* const provider = new RunwayVideoProvider();
|
|
59
|
+
* await provider.initialize({ apiKey: process.env.RUNWAY_API_KEY! });
|
|
60
|
+
*
|
|
61
|
+
* const result = await provider.generateVideo({
|
|
62
|
+
* modelId: 'gen3a_turbo',
|
|
63
|
+
* prompt: 'A cinematic drone shot over a misty forest at dawn',
|
|
64
|
+
* durationSec: 5,
|
|
65
|
+
* aspectRatio: '16:9',
|
|
66
|
+
* });
|
|
67
|
+
* console.log(result.videos[0].url);
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
export class RunwayVideoProvider {
|
|
71
|
+
constructor() {
|
|
72
|
+
/** @inheritdoc */
|
|
73
|
+
this.providerId = 'runway';
|
|
74
|
+
/** @inheritdoc */
|
|
75
|
+
this.isInitialized = false;
|
|
76
|
+
}
|
|
77
|
+
// -------------------------------------------------------------------------
|
|
78
|
+
// Lifecycle
|
|
79
|
+
// -------------------------------------------------------------------------
|
|
80
|
+
/**
|
|
81
|
+
* Initialize the provider with API credentials and optional configuration.
|
|
82
|
+
*
|
|
83
|
+
* @param config - Configuration object. Must include `apiKey`.
|
|
84
|
+
* @throws {Error} If `apiKey` is missing or empty.
|
|
85
|
+
*/
|
|
86
|
+
async initialize(config) {
|
|
87
|
+
const apiKey = typeof config.apiKey === 'string' ? config.apiKey.trim() : '';
|
|
88
|
+
if (!apiKey) {
|
|
89
|
+
throw new Error('Runway video provider requires apiKey (RUNWAY_API_KEY).');
|
|
90
|
+
}
|
|
91
|
+
this._config = {
|
|
92
|
+
apiKey,
|
|
93
|
+
baseURL: typeof config.baseURL === 'string' && config.baseURL.trim()
|
|
94
|
+
? config.baseURL.trim()
|
|
95
|
+
: 'https://api.dev.runwayml.com/v1',
|
|
96
|
+
defaultModelId: typeof config.defaultModelId === 'string' && config.defaultModelId.trim()
|
|
97
|
+
? config.defaultModelId.trim()
|
|
98
|
+
: 'gen3a_turbo',
|
|
99
|
+
pollIntervalMs: typeof config.pollIntervalMs === 'number' && config.pollIntervalMs > 0
|
|
100
|
+
? config.pollIntervalMs
|
|
101
|
+
: 5000,
|
|
102
|
+
timeoutMs: typeof config.timeoutMs === 'number' && config.timeoutMs > 0
|
|
103
|
+
? config.timeoutMs
|
|
104
|
+
: 300000,
|
|
105
|
+
};
|
|
106
|
+
this.defaultModelId = this._config.defaultModelId;
|
|
107
|
+
this.isInitialized = true;
|
|
108
|
+
}
|
|
109
|
+
// -------------------------------------------------------------------------
|
|
110
|
+
// Generation
|
|
111
|
+
// -------------------------------------------------------------------------
|
|
112
|
+
/**
|
|
113
|
+
* Generate a video from a text prompt using the Runway text_to_video endpoint.
|
|
114
|
+
*
|
|
115
|
+
* Submits the task, polls until completion, and returns the video result.
|
|
116
|
+
*
|
|
117
|
+
* @param request - Video generation request with prompt and optional params.
|
|
118
|
+
* @returns The generated video result envelope.
|
|
119
|
+
*
|
|
120
|
+
* @throws {Error} If the provider is not initialized.
|
|
121
|
+
* @throws {Error} If the API returns an error or times out.
|
|
122
|
+
*/
|
|
123
|
+
async generateVideo(request) {
|
|
124
|
+
if (!this.isInitialized) {
|
|
125
|
+
throw new Error('Runway video provider is not initialized. Call initialize() first.');
|
|
126
|
+
}
|
|
127
|
+
const model = request.modelId || this.defaultModelId || 'gen3a_turbo';
|
|
128
|
+
const body = {
|
|
129
|
+
model,
|
|
130
|
+
prompt: request.prompt,
|
|
131
|
+
};
|
|
132
|
+
if (request.durationSec !== undefined)
|
|
133
|
+
body.duration = request.durationSec;
|
|
134
|
+
if (request.aspectRatio)
|
|
135
|
+
body.ratio = request.aspectRatio;
|
|
136
|
+
// Step 1: Submit
|
|
137
|
+
const taskId = await this._submitTask('text_to_video', body);
|
|
138
|
+
// Step 2: Poll until done
|
|
139
|
+
const task = await this._pollTask(taskId);
|
|
140
|
+
// Step 3: Extract result
|
|
141
|
+
return this._buildResult(task, model);
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Generate a video from a source image using the Runway image_to_video endpoint.
|
|
145
|
+
*
|
|
146
|
+
* The source image Buffer is converted to a base64 data URL for the API.
|
|
147
|
+
*
|
|
148
|
+
* @param request - Generation parameters including the source image buffer.
|
|
149
|
+
* @returns The generated video result envelope.
|
|
150
|
+
*
|
|
151
|
+
* @throws {Error} If the provider is not initialized or the API fails.
|
|
152
|
+
*/
|
|
153
|
+
async imageToVideo(request) {
|
|
154
|
+
if (!this.isInitialized) {
|
|
155
|
+
throw new Error('Runway video provider is not initialized. Call initialize() first.');
|
|
156
|
+
}
|
|
157
|
+
const model = request.modelId || this.defaultModelId || 'gen3a_turbo';
|
|
158
|
+
// Convert the image buffer to a base64 data URL for the Runway API.
|
|
159
|
+
const imageBase64 = `data:image/png;base64,${request.image.toString('base64')}`;
|
|
160
|
+
const body = {
|
|
161
|
+
model,
|
|
162
|
+
prompt_image: imageBase64,
|
|
163
|
+
};
|
|
164
|
+
if (request.prompt)
|
|
165
|
+
body.prompt = request.prompt;
|
|
166
|
+
if (request.durationSec !== undefined)
|
|
167
|
+
body.duration = request.durationSec;
|
|
168
|
+
if (request.aspectRatio)
|
|
169
|
+
body.ratio = request.aspectRatio;
|
|
170
|
+
// Step 1: Submit
|
|
171
|
+
const taskId = await this._submitTask('image_to_video', body);
|
|
172
|
+
// Step 2: Poll until done
|
|
173
|
+
const task = await this._pollTask(taskId);
|
|
174
|
+
// Step 3: Extract result
|
|
175
|
+
return this._buildResult(task, model);
|
|
176
|
+
}
|
|
177
|
+
// -------------------------------------------------------------------------
|
|
178
|
+
// Capability query
|
|
179
|
+
// -------------------------------------------------------------------------
|
|
180
|
+
/**
|
|
181
|
+
* Runway supports both text-to-video and image-to-video generation.
|
|
182
|
+
*
|
|
183
|
+
* @param capability - The capability to check.
|
|
184
|
+
* @returns `true` for both `'text-to-video'` and `'image-to-video'`.
|
|
185
|
+
*/
|
|
186
|
+
supports(capability) {
|
|
187
|
+
return capability === 'text-to-video' || capability === 'image-to-video';
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Release any resources held by the provider. No-op for HTTP-only providers.
|
|
191
|
+
*/
|
|
192
|
+
async shutdown() {
|
|
193
|
+
this.isInitialized = false;
|
|
194
|
+
}
|
|
195
|
+
// -------------------------------------------------------------------------
|
|
196
|
+
// Private helpers
|
|
197
|
+
// -------------------------------------------------------------------------
|
|
198
|
+
/**
|
|
199
|
+
* Submit a generation task to the Runway API.
|
|
200
|
+
*
|
|
201
|
+
* @param endpoint - API endpoint path ('text_to_video' or 'image_to_video').
|
|
202
|
+
* @param body - Request body with model, prompt, and generation params.
|
|
203
|
+
* @returns The task ID for status polling.
|
|
204
|
+
*
|
|
205
|
+
* @throws {Error} If the submission request fails.
|
|
206
|
+
* @internal
|
|
207
|
+
*/
|
|
208
|
+
async _submitTask(endpoint, body) {
|
|
209
|
+
const url = `${this._config.baseURL}/${endpoint}`;
|
|
210
|
+
const response = await fetch(url, {
|
|
211
|
+
method: 'POST',
|
|
212
|
+
headers: {
|
|
213
|
+
Authorization: `Bearer ${this._config.apiKey}`,
|
|
214
|
+
'Content-Type': 'application/json',
|
|
215
|
+
},
|
|
216
|
+
body: JSON.stringify(body),
|
|
217
|
+
});
|
|
218
|
+
if (!response.ok) {
|
|
219
|
+
const errorText = await response.text();
|
|
220
|
+
throw new Error(`Runway video generation submission failed (${response.status}): ${errorText}`);
|
|
221
|
+
}
|
|
222
|
+
const data = (await response.json());
|
|
223
|
+
if (!data.id) {
|
|
224
|
+
throw new Error('Runway submission response missing task id.');
|
|
225
|
+
}
|
|
226
|
+
return data.id;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Poll the Runway task status endpoint until the task reaches a terminal state.
|
|
230
|
+
*
|
|
231
|
+
* @param taskId - The task ID from submission.
|
|
232
|
+
* @returns The completed task status object.
|
|
233
|
+
*
|
|
234
|
+
* @throws {Error} If the task fails or polling times out.
|
|
235
|
+
* @internal
|
|
236
|
+
*/
|
|
237
|
+
async _pollTask(taskId) {
|
|
238
|
+
const startedAt = Date.now();
|
|
239
|
+
while (Date.now() - startedAt < this._config.timeoutMs) {
|
|
240
|
+
const url = `${this._config.baseURL}/tasks/${taskId}`;
|
|
241
|
+
const response = await fetch(url, {
|
|
242
|
+
headers: {
|
|
243
|
+
Authorization: `Bearer ${this._config.apiKey}`,
|
|
244
|
+
},
|
|
245
|
+
});
|
|
246
|
+
if (!response.ok) {
|
|
247
|
+
const errorText = await response.text();
|
|
248
|
+
throw new Error(`Runway task polling failed (${response.status}): ${errorText}`);
|
|
249
|
+
}
|
|
250
|
+
const task = (await response.json());
|
|
251
|
+
if (task.status === 'SUCCEEDED') {
|
|
252
|
+
return task;
|
|
253
|
+
}
|
|
254
|
+
if (task.status === 'FAILED') {
|
|
255
|
+
const reason = task.failure || task.failureCode || 'unknown error';
|
|
256
|
+
throw new Error(`Runway video generation failed: ${reason}`);
|
|
257
|
+
}
|
|
258
|
+
await sleep(this._config.pollIntervalMs);
|
|
259
|
+
}
|
|
260
|
+
throw new Error(`Runway video generation timed out after ${this._config.timeoutMs}ms for task ${taskId}.`);
|
|
261
|
+
}
|
|
262
|
+
/**
|
|
263
|
+
* Build a {@link VideoResult} from a completed Runway task.
|
|
264
|
+
*
|
|
265
|
+
* @param task - The SUCCEEDED task status object.
|
|
266
|
+
* @param model - Model ID used for the generation.
|
|
267
|
+
* @returns Normalized video result envelope.
|
|
268
|
+
*
|
|
269
|
+
* @throws {Error} If the task has no output URLs.
|
|
270
|
+
* @internal
|
|
271
|
+
*/
|
|
272
|
+
_buildResult(task, model) {
|
|
273
|
+
if (!task.output || task.output.length === 0) {
|
|
274
|
+
throw new Error('Runway task succeeded but returned no video output.');
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
created: Math.floor(Date.now() / 1000),
|
|
278
|
+
modelId: model,
|
|
279
|
+
providerId: this.providerId,
|
|
280
|
+
videos: task.output.map((url) => ({
|
|
281
|
+
url,
|
|
282
|
+
mimeType: 'video/mp4',
|
|
283
|
+
providerMetadata: {
|
|
284
|
+
taskId: task.id,
|
|
285
|
+
},
|
|
286
|
+
})),
|
|
287
|
+
usage: {
|
|
288
|
+
totalVideos: task.output.length,
|
|
289
|
+
},
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
//# sourceMappingURL=RunwayVideoProvider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RunwayVideoProvider.js","sourceRoot":"","sources":["../../../../src/core/video/providers/RunwayVideoProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAuFH,8EAA8E;AAC9E,UAAU;AACV,8EAA8E;AAE9E;;;;;GAKG;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,8EAA8E;AAC9E,iBAAiB;AACjB,8EAA8E;AAE9E;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,mBAAmB;IAAhC;QACE,kBAAkB;QACF,eAAU,GAAG,QAAQ,CAAC;QAEtC,kBAAkB;QACX,kBAAa,GAAG,KAAK,CAAC;IAuQ/B,CAAC;IA/PC,4EAA4E;IAC5E,YAAY;IACZ,4EAA4E;IAE5E;;;;;OAKG;IACH,KAAK,CAAC,UAAU,CAAC,MAA+B;QAC9C,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7E,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CAAC,yDAAyD,CAAC,CAAC;QAC7E,CAAC;QAED,IAAI,CAAC,OAAO,GAAG;YACb,MAAM;YACN,OAAO,EACL,OAAO,MAAM,CAAC,O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