@juspay/neurolink 8.10.1 → 8.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/lib/types/ttsTypes.d.ts +29 -0
- package/dist/lib/utils/ttsProcessor.d.ts +77 -0
- package/dist/lib/utils/ttsProcessor.js +105 -0
- package/dist/types/ttsTypes.d.ts +29 -0
- package/dist/utils/ttsProcessor.d.ts +77 -0
- package/dist/utils/ttsProcessor.js +104 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [8.11.0](https://github.com/juspay/neurolink/compare/v8.10.1...v8.11.0) (2025-12-12)
|
|
2
|
+
|
|
3
|
+
### Features
|
|
4
|
+
|
|
5
|
+
- **(tts):** implement TTSProcessor skeleton class with handler registry ([8dc63d1](https://github.com/juspay/neurolink/commit/8dc63d15d8b71845145349b932651980aef61aa8))
|
|
6
|
+
|
|
1
7
|
## [8.10.1](https://github.com/juspay/neurolink/compare/v8.10.0...v8.10.1) (2025-12-12)
|
|
2
8
|
|
|
3
9
|
### Bug Fixes
|
|
@@ -85,6 +85,35 @@ export declare const VALID_TTS_QUALITIES: readonly TTSQuality[];
|
|
|
85
85
|
* Type guard to check if an object is a TTSResult
|
|
86
86
|
*/
|
|
87
87
|
export declare function isTTSResult(value: unknown): value is TTSResult;
|
|
88
|
+
/**
|
|
89
|
+
* TTS Handler type for provider-specific implementations
|
|
90
|
+
*
|
|
91
|
+
* Each provider (Google AI, OpenAI, etc.) implements this type
|
|
92
|
+
* to provide TTS generation capabilities using their respective APIs.
|
|
93
|
+
*/
|
|
94
|
+
export type TTSHandler = {
|
|
95
|
+
/**
|
|
96
|
+
* Generate audio from text using provider-specific TTS API
|
|
97
|
+
*
|
|
98
|
+
* @param text - Text to convert to speech
|
|
99
|
+
* @param options - TTS configuration options
|
|
100
|
+
* @returns Audio buffer with metadata
|
|
101
|
+
*/
|
|
102
|
+
synthesize(text: string, options: TTSOptions): Promise<TTSResult>;
|
|
103
|
+
/**
|
|
104
|
+
* Get available voices for the provider
|
|
105
|
+
*
|
|
106
|
+
* @param languageCode - Optional language filter (e.g., "en-US")
|
|
107
|
+
* @returns List of available voices
|
|
108
|
+
*/
|
|
109
|
+
getVoices(languageCode?: string): Promise<TTSVoice[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Validate that the provider is properly configured
|
|
112
|
+
*
|
|
113
|
+
* @returns True if provider can generate TTS
|
|
114
|
+
*/
|
|
115
|
+
isConfigured(): boolean;
|
|
116
|
+
};
|
|
88
117
|
/**
|
|
89
118
|
* Type guard to check if TTSOptions are valid
|
|
90
119
|
*/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-to-Speech (TTS) Processing Utility
|
|
3
|
+
*
|
|
4
|
+
* Central orchestrator for all TTS operations across providers.
|
|
5
|
+
* Manages provider-specific TTS handlers and audio generation.
|
|
6
|
+
*
|
|
7
|
+
* @module utils/ttsProcessor
|
|
8
|
+
*/
|
|
9
|
+
import type { TTSHandler } from "../types/ttsTypes.js";
|
|
10
|
+
/**
|
|
11
|
+
* TTS processor class for orchestrating text-to-speech operations
|
|
12
|
+
*
|
|
13
|
+
* Follows the same pattern as CSVProcessor, ImageProcessor, and PDFProcessor.
|
|
14
|
+
* Provides a unified interface for TTS generation across multiple providers.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Register a handler
|
|
19
|
+
* TTSProcessor.registerHandler('google-ai', googleAIHandler);
|
|
20
|
+
*
|
|
21
|
+
* // Check if provider is supported
|
|
22
|
+
* if (TTSProcessor.supports('google-ai')) {
|
|
23
|
+
* // Provider is registered
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class TTSProcessor {
|
|
28
|
+
/**
|
|
29
|
+
* Handler registry mapping provider names to TTS handlers
|
|
30
|
+
* Uses Map for O(1) lookups and better type safety
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private static readonly handlers;
|
|
35
|
+
/**
|
|
36
|
+
* Register a TTS handler for a specific provider
|
|
37
|
+
*
|
|
38
|
+
* Allows providers to register their TTS implementation at runtime.
|
|
39
|
+
*
|
|
40
|
+
* @param providerName - Provider identifier (e.g., 'google-ai', 'openai')
|
|
41
|
+
* @param handler - TTS handler implementation
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const googleHandler: TTSHandler = {
|
|
46
|
+
* synthesize: async (text, options) => { ... },
|
|
47
|
+
* getVoices: async (languageCode) => { ... },
|
|
48
|
+
* isConfigured: () => true
|
|
49
|
+
* };
|
|
50
|
+
*
|
|
51
|
+
* TTSProcessor.registerHandler('google-ai', googleHandler);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
static registerHandler(providerName: string, handler: TTSHandler): void;
|
|
55
|
+
/**
|
|
56
|
+
* Get a registered TTS handler by provider name
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
* @param providerName - Provider identifier
|
|
60
|
+
* @returns Handler instance or undefined if not registered
|
|
61
|
+
*/
|
|
62
|
+
private static getHandler;
|
|
63
|
+
/**
|
|
64
|
+
* Check if a provider is supported (has a registered TTS handler)
|
|
65
|
+
*
|
|
66
|
+
* @param providerName - Provider identifier
|
|
67
|
+
* @returns True if handler is registered
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* if (TTSProcessor.supports('google-ai')) {
|
|
72
|
+
* console.log('Google AI TTS is supported');
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
static supports(providerName: string): boolean;
|
|
77
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-to-Speech (TTS) Processing Utility
|
|
3
|
+
*
|
|
4
|
+
* Central orchestrator for all TTS operations across providers.
|
|
5
|
+
* Manages provider-specific TTS handlers and audio generation.
|
|
6
|
+
*
|
|
7
|
+
* @module utils/ttsProcessor
|
|
8
|
+
*/
|
|
9
|
+
import { logger } from "./logger.js";
|
|
10
|
+
/**
|
|
11
|
+
* TTS processor class for orchestrating text-to-speech operations
|
|
12
|
+
*
|
|
13
|
+
* Follows the same pattern as CSVProcessor, ImageProcessor, and PDFProcessor.
|
|
14
|
+
* Provides a unified interface for TTS generation across multiple providers.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Register a handler
|
|
19
|
+
* TTSProcessor.registerHandler('google-ai', googleAIHandler);
|
|
20
|
+
*
|
|
21
|
+
* // Check if provider is supported
|
|
22
|
+
* if (TTSProcessor.supports('google-ai')) {
|
|
23
|
+
* // Provider is registered
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export class TTSProcessor {
|
|
28
|
+
/**
|
|
29
|
+
* Handler registry mapping provider names to TTS handlers
|
|
30
|
+
* Uses Map for O(1) lookups and better type safety
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
static handlers = new Map();
|
|
35
|
+
/**
|
|
36
|
+
* Register a TTS handler for a specific provider
|
|
37
|
+
*
|
|
38
|
+
* Allows providers to register their TTS implementation at runtime.
|
|
39
|
+
*
|
|
40
|
+
* @param providerName - Provider identifier (e.g., 'google-ai', 'openai')
|
|
41
|
+
* @param handler - TTS handler implementation
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const googleHandler: TTSHandler = {
|
|
46
|
+
* synthesize: async (text, options) => { ... },
|
|
47
|
+
* getVoices: async (languageCode) => { ... },
|
|
48
|
+
* isConfigured: () => true
|
|
49
|
+
* };
|
|
50
|
+
*
|
|
51
|
+
* TTSProcessor.registerHandler('google-ai', googleHandler);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
static registerHandler(providerName, handler) {
|
|
55
|
+
if (!providerName) {
|
|
56
|
+
throw new Error("Provider name is required");
|
|
57
|
+
}
|
|
58
|
+
if (!handler) {
|
|
59
|
+
throw new Error("Handler is required");
|
|
60
|
+
}
|
|
61
|
+
const normalizedName = providerName.toLowerCase();
|
|
62
|
+
if (this.handlers.has(normalizedName)) {
|
|
63
|
+
logger.warn(`[TTSProcessor] Overwriting existing handler for provider: ${normalizedName}`);
|
|
64
|
+
}
|
|
65
|
+
this.handlers.set(normalizedName, handler);
|
|
66
|
+
logger.debug(`[TTSProcessor] Registered TTS handler for provider: ${normalizedName}`);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get a registered TTS handler by provider name
|
|
70
|
+
*
|
|
71
|
+
* @private
|
|
72
|
+
* @param providerName - Provider identifier
|
|
73
|
+
* @returns Handler instance or undefined if not registered
|
|
74
|
+
*/
|
|
75
|
+
static getHandler(providerName) {
|
|
76
|
+
const normalizedName = providerName.toLowerCase();
|
|
77
|
+
return this.handlers.get(normalizedName);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Check if a provider is supported (has a registered TTS handler)
|
|
81
|
+
*
|
|
82
|
+
* @param providerName - Provider identifier
|
|
83
|
+
* @returns True if handler is registered
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* if (TTSProcessor.supports('google-ai')) {
|
|
88
|
+
* console.log('Google AI TTS is supported');
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
static supports(providerName) {
|
|
93
|
+
if (!providerName) {
|
|
94
|
+
logger.error("[TTSProcessor] Provider name is required for supports check");
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
const normalizedName = providerName.toLowerCase();
|
|
98
|
+
const isSupported = this.handlers.has(normalizedName);
|
|
99
|
+
if (!isSupported) {
|
|
100
|
+
logger.debug(`[TTSProcessor] Provider ${providerName} is not supported`);
|
|
101
|
+
}
|
|
102
|
+
return isSupported;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=ttsProcessor.js.map
|
package/dist/types/ttsTypes.d.ts
CHANGED
|
@@ -85,6 +85,35 @@ export declare const VALID_TTS_QUALITIES: readonly TTSQuality[];
|
|
|
85
85
|
* Type guard to check if an object is a TTSResult
|
|
86
86
|
*/
|
|
87
87
|
export declare function isTTSResult(value: unknown): value is TTSResult;
|
|
88
|
+
/**
|
|
89
|
+
* TTS Handler type for provider-specific implementations
|
|
90
|
+
*
|
|
91
|
+
* Each provider (Google AI, OpenAI, etc.) implements this type
|
|
92
|
+
* to provide TTS generation capabilities using their respective APIs.
|
|
93
|
+
*/
|
|
94
|
+
export type TTSHandler = {
|
|
95
|
+
/**
|
|
96
|
+
* Generate audio from text using provider-specific TTS API
|
|
97
|
+
*
|
|
98
|
+
* @param text - Text to convert to speech
|
|
99
|
+
* @param options - TTS configuration options
|
|
100
|
+
* @returns Audio buffer with metadata
|
|
101
|
+
*/
|
|
102
|
+
synthesize(text: string, options: TTSOptions): Promise<TTSResult>;
|
|
103
|
+
/**
|
|
104
|
+
* Get available voices for the provider
|
|
105
|
+
*
|
|
106
|
+
* @param languageCode - Optional language filter (e.g., "en-US")
|
|
107
|
+
* @returns List of available voices
|
|
108
|
+
*/
|
|
109
|
+
getVoices(languageCode?: string): Promise<TTSVoice[]>;
|
|
110
|
+
/**
|
|
111
|
+
* Validate that the provider is properly configured
|
|
112
|
+
*
|
|
113
|
+
* @returns True if provider can generate TTS
|
|
114
|
+
*/
|
|
115
|
+
isConfigured(): boolean;
|
|
116
|
+
};
|
|
88
117
|
/**
|
|
89
118
|
* Type guard to check if TTSOptions are valid
|
|
90
119
|
*/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-to-Speech (TTS) Processing Utility
|
|
3
|
+
*
|
|
4
|
+
* Central orchestrator for all TTS operations across providers.
|
|
5
|
+
* Manages provider-specific TTS handlers and audio generation.
|
|
6
|
+
*
|
|
7
|
+
* @module utils/ttsProcessor
|
|
8
|
+
*/
|
|
9
|
+
import type { TTSHandler } from "../types/ttsTypes.js";
|
|
10
|
+
/**
|
|
11
|
+
* TTS processor class for orchestrating text-to-speech operations
|
|
12
|
+
*
|
|
13
|
+
* Follows the same pattern as CSVProcessor, ImageProcessor, and PDFProcessor.
|
|
14
|
+
* Provides a unified interface for TTS generation across multiple providers.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Register a handler
|
|
19
|
+
* TTSProcessor.registerHandler('google-ai', googleAIHandler);
|
|
20
|
+
*
|
|
21
|
+
* // Check if provider is supported
|
|
22
|
+
* if (TTSProcessor.supports('google-ai')) {
|
|
23
|
+
* // Provider is registered
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare class TTSProcessor {
|
|
28
|
+
/**
|
|
29
|
+
* Handler registry mapping provider names to TTS handlers
|
|
30
|
+
* Uses Map for O(1) lookups and better type safety
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private static readonly handlers;
|
|
35
|
+
/**
|
|
36
|
+
* Register a TTS handler for a specific provider
|
|
37
|
+
*
|
|
38
|
+
* Allows providers to register their TTS implementation at runtime.
|
|
39
|
+
*
|
|
40
|
+
* @param providerName - Provider identifier (e.g., 'google-ai', 'openai')
|
|
41
|
+
* @param handler - TTS handler implementation
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const googleHandler: TTSHandler = {
|
|
46
|
+
* synthesize: async (text, options) => { ... },
|
|
47
|
+
* getVoices: async (languageCode) => { ... },
|
|
48
|
+
* isConfigured: () => true
|
|
49
|
+
* };
|
|
50
|
+
*
|
|
51
|
+
* TTSProcessor.registerHandler('google-ai', googleHandler);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
static registerHandler(providerName: string, handler: TTSHandler): void;
|
|
55
|
+
/**
|
|
56
|
+
* Get a registered TTS handler by provider name
|
|
57
|
+
*
|
|
58
|
+
* @private
|
|
59
|
+
* @param providerName - Provider identifier
|
|
60
|
+
* @returns Handler instance or undefined if not registered
|
|
61
|
+
*/
|
|
62
|
+
private static getHandler;
|
|
63
|
+
/**
|
|
64
|
+
* Check if a provider is supported (has a registered TTS handler)
|
|
65
|
+
*
|
|
66
|
+
* @param providerName - Provider identifier
|
|
67
|
+
* @returns True if handler is registered
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* ```typescript
|
|
71
|
+
* if (TTSProcessor.supports('google-ai')) {
|
|
72
|
+
* console.log('Google AI TTS is supported');
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
static supports(providerName: string): boolean;
|
|
77
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Text-to-Speech (TTS) Processing Utility
|
|
3
|
+
*
|
|
4
|
+
* Central orchestrator for all TTS operations across providers.
|
|
5
|
+
* Manages provider-specific TTS handlers and audio generation.
|
|
6
|
+
*
|
|
7
|
+
* @module utils/ttsProcessor
|
|
8
|
+
*/
|
|
9
|
+
import { logger } from "./logger.js";
|
|
10
|
+
/**
|
|
11
|
+
* TTS processor class for orchestrating text-to-speech operations
|
|
12
|
+
*
|
|
13
|
+
* Follows the same pattern as CSVProcessor, ImageProcessor, and PDFProcessor.
|
|
14
|
+
* Provides a unified interface for TTS generation across multiple providers.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Register a handler
|
|
19
|
+
* TTSProcessor.registerHandler('google-ai', googleAIHandler);
|
|
20
|
+
*
|
|
21
|
+
* // Check if provider is supported
|
|
22
|
+
* if (TTSProcessor.supports('google-ai')) {
|
|
23
|
+
* // Provider is registered
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export class TTSProcessor {
|
|
28
|
+
/**
|
|
29
|
+
* Handler registry mapping provider names to TTS handlers
|
|
30
|
+
* Uses Map for O(1) lookups and better type safety
|
|
31
|
+
*
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
static handlers = new Map();
|
|
35
|
+
/**
|
|
36
|
+
* Register a TTS handler for a specific provider
|
|
37
|
+
*
|
|
38
|
+
* Allows providers to register their TTS implementation at runtime.
|
|
39
|
+
*
|
|
40
|
+
* @param providerName - Provider identifier (e.g., 'google-ai', 'openai')
|
|
41
|
+
* @param handler - TTS handler implementation
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* const googleHandler: TTSHandler = {
|
|
46
|
+
* synthesize: async (text, options) => { ... },
|
|
47
|
+
* getVoices: async (languageCode) => { ... },
|
|
48
|
+
* isConfigured: () => true
|
|
49
|
+
* };
|
|
50
|
+
*
|
|
51
|
+
* TTSProcessor.registerHandler('google-ai', googleHandler);
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
static registerHandler(providerName, handler) {
|
|
55
|
+
if (!providerName) {
|
|
56
|
+
throw new Error("Provider name is required");
|
|
57
|
+
}
|
|
58
|
+
if (!handler) {
|
|
59
|
+
throw new Error("Handler is required");
|
|
60
|
+
}
|
|
61
|
+
const normalizedName = providerName.toLowerCase();
|
|
62
|
+
if (this.handlers.has(normalizedName)) {
|
|
63
|
+
logger.warn(`[TTSProcessor] Overwriting existing handler for provider: ${normalizedName}`);
|
|
64
|
+
}
|
|
65
|
+
this.handlers.set(normalizedName, handler);
|
|
66
|
+
logger.debug(`[TTSProcessor] Registered TTS handler for provider: ${normalizedName}`);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Get a registered TTS handler by provider name
|
|
70
|
+
*
|
|
71
|
+
* @private
|
|
72
|
+
* @param providerName - Provider identifier
|
|
73
|
+
* @returns Handler instance or undefined if not registered
|
|
74
|
+
*/
|
|
75
|
+
static getHandler(providerName) {
|
|
76
|
+
const normalizedName = providerName.toLowerCase();
|
|
77
|
+
return this.handlers.get(normalizedName);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Check if a provider is supported (has a registered TTS handler)
|
|
81
|
+
*
|
|
82
|
+
* @param providerName - Provider identifier
|
|
83
|
+
* @returns True if handler is registered
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* if (TTSProcessor.supports('google-ai')) {
|
|
88
|
+
* console.log('Google AI TTS is supported');
|
|
89
|
+
* }
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
static supports(providerName) {
|
|
93
|
+
if (!providerName) {
|
|
94
|
+
logger.error("[TTSProcessor] Provider name is required for supports check");
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
const normalizedName = providerName.toLowerCase();
|
|
98
|
+
const isSupported = this.handlers.has(normalizedName);
|
|
99
|
+
if (!isSupported) {
|
|
100
|
+
logger.debug(`[TTSProcessor] Provider ${providerName} is not supported`);
|
|
101
|
+
}
|
|
102
|
+
return isSupported;
|
|
103
|
+
}
|
|
104
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.11.0",
|
|
4
4
|
"description": "Universal AI Development Platform with working MCP integration, multi-provider support, and professional CLI. Built-in tools operational, 58+ external MCP servers discoverable. Connect to filesystem, GitHub, database operations, and more. Build, test, and deploy AI applications with 9 major providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Juspay Technologies",
|