UNPKG

@juspay/neurolink

Version:

Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio

68 lines (67 loc) 2.29 kB
/** * Music Generation Processing Utility * * Central registry + dispatch for music-generation handlers across * providers (Beatoven, ElevenLabs Music, Lyria, Replicate-hosted models). * * Mirrors the static-handler-registry pattern established by * `TTSProcessor` / `STTProcessor` / `VideoProcessor`. * * @module utils/musicProcessor */ import { ErrorCategory, ErrorSeverity } from "../constants/enums.js"; import type { MusicHandler, MusicOptions, MusicResult } from "../types/index.js"; import { NeuroLinkError } from "./errorHandling.js"; /** * Music-specific error codes. */ export declare const MUSIC_ERROR_CODES: { readonly PROVIDER_NOT_SUPPORTED: "MUSIC_PROVIDER_NOT_SUPPORTED"; readonly PROVIDER_NOT_CONFIGURED: "MUSIC_PROVIDER_NOT_CONFIGURED"; readonly GENERATION_FAILED: "MUSIC_GENERATION_FAILED"; readonly POLL_TIMEOUT: "MUSIC_POLL_TIMEOUT"; readonly PROMPT_REQUIRED: "MUSIC_PROMPT_REQUIRED"; readonly DURATION_INVALID: "MUSIC_DURATION_INVALID"; readonly INVALID_INPUT: "MUSIC_INVALID_INPUT"; }; /** * Typed error class for music-generation failures. */ export declare class MusicError extends NeuroLinkError { constructor(options: { code: string; message: string; category?: ErrorCategory; severity?: ErrorSeverity; retriable?: boolean; context?: Record<string, unknown>; originalError?: Error; }); } /** * Static processor managing the music handler registry. */ export declare class MusicProcessor { private static readonly handlers; /** * Register a music handler for a specific provider. */ static registerHandler(providerName: string, handler: MusicHandler): void; /** * Check if a provider has a registered music handler. */ static supports(providerName: string): boolean; /** * List the names of all registered providers. */ static listProviders(): string[]; private static getHandler; private static buildSpanAttributes; /** * Generate a music track via the registered handler. * * @throws MusicError on registry miss, handler-not-configured, or * generation failure. */ static generate(provider: string, options: MusicOptions): Promise<MusicResult>; }