@juspay/neurolink 9.89.0 → 9.91.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/adapters/tts/googleTTSHandler.d.ts +10 -0
  3. package/dist/adapters/tts/googleTTSHandler.js +27 -18
  4. package/dist/agent/directTools.js +1 -1
  5. package/dist/browser/neurolink.min.js +387 -365
  6. package/dist/core/baseProvider.d.ts +37 -3
  7. package/dist/core/baseProvider.js +167 -44
  8. package/dist/core/modules/GenerationHandler.js +7 -1
  9. package/dist/core/modules/ToolsManager.js +5 -0
  10. package/dist/core/toolDedup.js +4 -1
  11. package/dist/index.d.ts +1 -1
  12. package/dist/index.js +1 -1
  13. package/dist/lib/adapters/tts/googleTTSHandler.d.ts +10 -0
  14. package/dist/lib/adapters/tts/googleTTSHandler.js +27 -18
  15. package/dist/lib/agent/directTools.js +1 -1
  16. package/dist/lib/core/baseProvider.d.ts +37 -3
  17. package/dist/lib/core/baseProvider.js +167 -44
  18. package/dist/lib/core/modules/GenerationHandler.js +7 -1
  19. package/dist/lib/core/modules/ToolsManager.js +5 -0
  20. package/dist/lib/core/toolDedup.js +4 -1
  21. package/dist/lib/index.d.ts +1 -1
  22. package/dist/lib/index.js +1 -1
  23. package/dist/lib/mcp/toolRegistry.js +7 -2
  24. package/dist/lib/neurolink.d.ts +31 -1
  25. package/dist/lib/neurolink.js +151 -26
  26. package/dist/lib/rag/index.d.ts +1 -0
  27. package/dist/lib/rag/index.js +2 -0
  28. package/dist/lib/rag/stores/chroma.d.ts +90 -0
  29. package/dist/lib/rag/stores/chroma.js +281 -0
  30. package/dist/lib/rag/stores/index.d.ts +21 -0
  31. package/dist/lib/rag/stores/index.js +22 -0
  32. package/dist/lib/rag/stores/pgvector.d.ts +95 -0
  33. package/dist/lib/rag/stores/pgvector.js +400 -0
  34. package/dist/lib/rag/stores/pinecone.d.ts +85 -0
  35. package/dist/lib/rag/stores/pinecone.js +159 -0
  36. package/dist/lib/server/routes/agentRoutes.js +25 -2
  37. package/dist/lib/tools/toolDiscovery.d.ts +48 -0
  38. package/dist/lib/tools/toolDiscovery.js +231 -0
  39. package/dist/lib/tools/toolGate.d.ts +16 -0
  40. package/dist/lib/tools/toolGate.js +51 -0
  41. package/dist/lib/tools/toolPolicy.d.ts +40 -0
  42. package/dist/lib/tools/toolPolicy.js +194 -0
  43. package/dist/lib/types/config.d.ts +43 -3
  44. package/dist/lib/types/index.d.ts +3 -0
  45. package/dist/lib/types/index.js +3 -0
  46. package/dist/lib/types/providers.d.ts +8 -0
  47. package/dist/lib/types/rag.d.ts +30 -0
  48. package/dist/lib/types/toolResolution.d.ts +73 -0
  49. package/dist/lib/types/toolResolution.js +11 -0
  50. package/dist/lib/types/vectorStoreChroma.d.ts +67 -0
  51. package/dist/lib/types/vectorStoreChroma.js +12 -0
  52. package/dist/lib/types/vectorStorePinecone.d.ts +48 -0
  53. package/dist/lib/types/vectorStorePinecone.js +12 -0
  54. package/dist/mcp/toolRegistry.js +7 -2
  55. package/dist/neurolink.d.ts +31 -1
  56. package/dist/neurolink.js +151 -26
  57. package/dist/rag/index.d.ts +1 -0
  58. package/dist/rag/index.js +2 -0
  59. package/dist/rag/stores/chroma.d.ts +90 -0
  60. package/dist/rag/stores/chroma.js +280 -0
  61. package/dist/rag/stores/index.d.ts +21 -0
  62. package/dist/rag/stores/index.js +21 -0
  63. package/dist/rag/stores/pgvector.d.ts +95 -0
  64. package/dist/rag/stores/pgvector.js +399 -0
  65. package/dist/rag/stores/pinecone.d.ts +85 -0
  66. package/dist/rag/stores/pinecone.js +158 -0
  67. package/dist/server/routes/agentRoutes.js +25 -2
  68. package/dist/tools/toolDiscovery.d.ts +48 -0
  69. package/dist/tools/toolDiscovery.js +230 -0
  70. package/dist/tools/toolGate.d.ts +16 -0
  71. package/dist/tools/toolGate.js +50 -0
  72. package/dist/tools/toolPolicy.d.ts +40 -0
  73. package/dist/tools/toolPolicy.js +193 -0
  74. package/dist/types/config.d.ts +43 -3
  75. package/dist/types/index.d.ts +3 -0
  76. package/dist/types/index.js +3 -0
  77. package/dist/types/providers.d.ts +8 -0
  78. package/dist/types/rag.d.ts +30 -0
  79. package/dist/types/toolResolution.d.ts +73 -0
  80. package/dist/types/toolResolution.js +10 -0
  81. package/dist/types/vectorStoreChroma.d.ts +67 -0
  82. package/dist/types/vectorStoreChroma.js +11 -0
  83. package/dist/types/vectorStorePinecone.d.ts +48 -0
  84. package/dist/types/vectorStorePinecone.js +11 -0
  85. package/package.json +12 -7
package/CHANGELOG.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## [9.91.0](https://github.com/juspay/neurolink/compare/v9.90.0...v9.91.0) (2026-07-17)
2
+
3
+ ### Features
4
+
5
+ - **(tools):** unified tool policy gate + on-demand MCP tool discovery ([52a749c](https://github.com/juspay/neurolink/commit/52a749c8e36e7f501f1265f5f0b6505a483c5fd9))
6
+
7
+ ## [9.90.0](https://github.com/juspay/neurolink/compare/v9.89.0...v9.90.0) (2026-07-17)
8
+
9
+ ### Features
10
+
11
+ - **(rag):** Pinecone, pgvector, and Chroma vector-store adapters (client injection) ([615e83b](https://github.com/juspay/neurolink/commit/615e83b604665922b4081c709694a268d43a0b95))
12
+
13
+ ### Bug Fixes
14
+
15
+ - **(deps):** move lazily-imported cloud provider SDKs to optionalDependencies ([732f8aa](https://github.com/juspay/neurolink/commit/732f8aa2ff4009b987fb97d937747a168a6ef85b))
16
+
1
17
  ## [9.89.0](https://github.com/juspay/neurolink/compare/v9.88.12...v9.89.0) (2026-07-17)
2
18
 
3
19
  ### Features
@@ -24,6 +24,7 @@ export declare class GoogleTTSHandler implements TTSHandler {
24
24
  * before invoking provider handlers, not inside this class.
25
25
  */
26
26
  readonly maxTextLength: number;
27
+ private readonly credentialsPath;
27
28
  constructor(credentialsPath?: string);
28
29
  /**
29
30
  * Validate that the provider is properly configured
@@ -31,6 +32,15 @@ export declare class GoogleTTSHandler implements TTSHandler {
31
32
  * @returns True if provider can generate TTS
32
33
  */
33
34
  isConfigured(): boolean;
35
+ /**
36
+ * Lazily construct (and cache) the Google Cloud TTS client.
37
+ *
38
+ * `@google-cloud/text-to-speech` is an optional dependency: importing it
39
+ * only happens here, on first actual use, so a handler instance can be
40
+ * constructed (e.g. during auto-registration at module load) without the
41
+ * package being installed.
42
+ */
43
+ private getClient;
34
44
  /**
35
45
  * Get available voices for the provider
36
46
  *
@@ -1,12 +1,3 @@
1
- /**
2
- * Google Cloud Text-to-Speech Handler
3
- *
4
- * Handler for Google Cloud Text-to-Speech API integration.
5
- *
6
- * @module adapters/tts/googleTTSHandler
7
- * @see https://cloud.google.com/text-to-speech/docs
8
- */
9
- import { TextToSpeechClient } from "@google-cloud/text-to-speech";
10
1
  import { TTSError, TTS_ERROR_CODES } from "../../utils/ttsProcessor.js";
11
2
  import { ErrorCategory, ErrorSeverity } from "../../constants/enums.js";
12
3
  import { logger } from "../../utils/logger.js";
@@ -36,11 +27,10 @@ export class GoogleTTSHandler {
36
27
  * before invoking provider handlers, not inside this class.
37
28
  */
38
29
  maxTextLength = GoogleTTSHandler.DEFAULT_MAX_TEXT_LENGTH;
30
+ credentialsPath;
39
31
  constructor(credentialsPath) {
40
- const path = credentialsPath ?? process.env.GOOGLE_APPLICATION_CREDENTIALS;
41
- if (path) {
42
- this.client = new TextToSpeechClient({ keyFilename: path });
43
- }
32
+ this.credentialsPath =
33
+ credentialsPath ?? process.env.GOOGLE_APPLICATION_CREDENTIALS;
44
34
  }
45
35
  /**
46
36
  * Validate that the provider is properly configured
@@ -48,7 +38,24 @@ export class GoogleTTSHandler {
48
38
  * @returns True if provider can generate TTS
49
39
  */
50
40
  isConfigured() {
51
- return this.client !== null;
41
+ return this.credentialsPath !== undefined;
42
+ }
43
+ /**
44
+ * Lazily construct (and cache) the Google Cloud TTS client.
45
+ *
46
+ * `@google-cloud/text-to-speech` is an optional dependency: importing it
47
+ * only happens here, on first actual use, so a handler instance can be
48
+ * constructed (e.g. during auto-registration at module load) without the
49
+ * package being installed.
50
+ */
51
+ async getClient() {
52
+ if (!this.client) {
53
+ const { TextToSpeechClient } = await import("@google-cloud/text-to-speech");
54
+ this.client = new TextToSpeechClient({
55
+ keyFilename: this.credentialsPath,
56
+ });
57
+ }
58
+ return this.client;
52
59
  }
53
60
  /**
54
61
  * Get available voices for the provider
@@ -60,7 +67,7 @@ export class GoogleTTSHandler {
60
67
  * @returns List of available voices
61
68
  */
62
69
  async getVoices(languageCode) {
63
- if (!this.client) {
70
+ if (!this.isConfigured()) {
64
71
  throw new TTSError({
65
72
  code: TTS_ERROR_CODES.PROVIDER_NOT_CONFIGURED,
66
73
  message: "Google Cloud TTS client not initialized. Set GOOGLE_APPLICATION_CREDENTIALS or pass credentials path.",
@@ -69,6 +76,7 @@ export class GoogleTTSHandler {
69
76
  retriable: false,
70
77
  });
71
78
  }
79
+ const client = await this.getClient();
72
80
  const span = SpanSerializer.createSpan(SpanType.TTS, "tts.google.listVoices", {
73
81
  "tts.operation": "listVoices",
74
82
  "tts.provider": "google",
@@ -84,7 +92,7 @@ export class GoogleTTSHandler {
84
92
  return this.voicesCache.voices;
85
93
  }
86
94
  // Call Google Cloud listVoices API
87
- const [response] = await this.client.listVoices(languageCode ? { languageCode } : {});
95
+ const [response] = await client.listVoices(languageCode ? { languageCode } : {});
88
96
  if (!response.voices || response.voices.length === 0) {
89
97
  logger.warn("Google Cloud TTS returned no voices");
90
98
  const endedSpan = SpanSerializer.endSpan(span, SpanStatus.OK);
@@ -149,7 +157,7 @@ export class GoogleTTSHandler {
149
157
  * @returns Audio buffer with metadata
150
158
  */
151
159
  async synthesize(text, options) {
152
- if (!this.client) {
160
+ if (!this.isConfigured()) {
153
161
  throw new TTSError({
154
162
  code: TTS_ERROR_CODES.PROVIDER_NOT_CONFIGURED,
155
163
  message: "Google Cloud TTS client not initialized. Set GOOGLE_APPLICATION_CREDENTIALS or pass credentials path.",
@@ -158,6 +166,7 @@ export class GoogleTTSHandler {
158
166
  retriable: false,
159
167
  });
160
168
  }
169
+ const client = await this.getClient();
161
170
  const voiceId = options.voice ?? "en-US-Neural2-C";
162
171
  const span = SpanSerializer.createSpan(SpanType.TTS, "tts.google.synthesize", {
163
172
  "tts.operation": "synthesize",
@@ -196,7 +205,7 @@ export class GoogleTTSHandler {
196
205
  volumeGainDb: options.volumeGainDb ?? 0.0,
197
206
  },
198
207
  };
199
- const [response] = await this.client.synthesizeSpeech(request, {
208
+ const [response] = await client.synthesizeSpeech(request, {
200
209
  timeout: GoogleTTSHandler.DEFAULT_API_TIMEOUT_MS,
201
210
  });
202
211
  const audioContent = response.audioContent;
@@ -3,7 +3,6 @@ import * as fs from "fs";
3
3
  import * as path from "path";
4
4
  import { execFile } from "child_process";
5
5
  import { logger } from "../utils/logger.js";
6
- import { VertexAI } from "@google-cloud/vertexai";
7
6
  import { CSVProcessor } from "../utils/csvProcessor.js";
8
7
  import { shouldEnableBashTool } from "../utils/toolUtils.js";
9
8
  import { tool } from "../utils/tool.js";
@@ -604,6 +603,7 @@ export const directAgentTools = {
604
603
  };
605
604
  }
606
605
  const limitedResults = Math.min(Math.max(maxResults, 1), 5);
606
+ const { VertexAI } = await import("@google-cloud/vertexai");
607
607
  const vertex_ai = new VertexAI({
608
608
  project: hasProjectId,
609
609
  location: projectLocation,