@juspay/neurolink 9.50.1 → 9.51.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 (40) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/browser/neurolink.min.js +282 -282
  3. package/dist/cli/commands/proxy.js +60 -15
  4. package/dist/cli/utils/serverUtils.d.ts +2 -1
  5. package/dist/cli/utils/serverUtils.js +7 -3
  6. package/dist/context/contextCompactor.js +2 -2
  7. package/dist/context/stages/slidingWindowTruncator.d.ts +1 -1
  8. package/dist/context/stages/slidingWindowTruncator.js +3 -3
  9. package/dist/core/modules/Utilities.d.ts +5 -0
  10. package/dist/core/modules/Utilities.js +29 -18
  11. package/dist/lib/context/contextCompactor.js +2 -2
  12. package/dist/lib/context/stages/slidingWindowTruncator.d.ts +1 -1
  13. package/dist/lib/context/stages/slidingWindowTruncator.js +3 -3
  14. package/dist/lib/core/modules/Utilities.d.ts +5 -0
  15. package/dist/lib/core/modules/Utilities.js +29 -18
  16. package/dist/lib/mcp/externalServerManager.d.ts +5 -0
  17. package/dist/lib/mcp/externalServerManager.js +24 -2
  18. package/dist/lib/neurolink.js +37 -3
  19. package/dist/lib/proxy/accountQuota.d.ts +6 -0
  20. package/dist/lib/proxy/accountQuota.js +24 -3
  21. package/dist/lib/proxy/proxyPaths.d.ts +25 -0
  22. package/dist/lib/proxy/proxyPaths.js +35 -0
  23. package/dist/lib/proxy/requestLogger.d.ts +1 -1
  24. package/dist/lib/proxy/requestLogger.js +2 -2
  25. package/dist/lib/services/server/ai/observability/instrumentation.js +39 -1
  26. package/dist/lib/types/cli.d.ts +1 -0
  27. package/dist/lib/types/externalMcp.d.ts +7 -0
  28. package/dist/mcp/externalServerManager.d.ts +5 -0
  29. package/dist/mcp/externalServerManager.js +24 -2
  30. package/dist/neurolink.js +37 -3
  31. package/dist/proxy/accountQuota.d.ts +6 -0
  32. package/dist/proxy/accountQuota.js +24 -3
  33. package/dist/proxy/proxyPaths.d.ts +25 -0
  34. package/dist/proxy/proxyPaths.js +34 -0
  35. package/dist/proxy/requestLogger.d.ts +1 -1
  36. package/dist/proxy/requestLogger.js +2 -2
  37. package/dist/services/server/ai/observability/instrumentation.js +39 -1
  38. package/dist/types/cli.d.ts +1 -0
  39. package/dist/types/externalMcp.d.ts +7 -0
  40. package/package.json +1 -1
@@ -445,7 +445,45 @@ function initializeExternalOpenTelemetryMode(config, resource, otlpEndpoint, ser
445
445
  const provider = globalProvider;
446
446
  if (globalProvider && typeof provider.addSpanProcessor === "function") {
447
447
  provider.addSpanProcessor(new ContextEnricher());
448
- const skipLangfuse = config.skipLangfuseSpanProcessor === true || !langfuseProcessor;
448
+ // Auto-detect: skip if consumer already registered a LangfuseSpanProcessor.
449
+ //
450
+ // Detection strategy (ordered by robustness):
451
+ // 1. `instanceof LangfuseSpanProcessor` — reliable when both sides use
452
+ // the same @langfuse/otel package instance (same module identity).
453
+ // 2. Duck-type check for Langfuse-specific public member
454
+ // (`langfuseClient` property) — survives minification.
455
+ // 3. `constructor.name === "LangfuseSpanProcessor"` — last resort,
456
+ // brittle under minification or bundler renaming.
457
+ //
458
+ // NOTE: `_registeredSpanProcessors` is an internal OpenTelemetry field.
459
+ // If the OTel SDK removes or renames it, the array defaults to [] and
460
+ // `hasExistingLangfuse` is false — NeuroLink registers its own processor
461
+ // (same behavior as before this check). Consumers can always force skip
462
+ // via `skipLangfuseSpanProcessor: true`.
463
+ const existingProcessors = provider
464
+ ._registeredSpanProcessors ?? [];
465
+ const hasExistingLangfuse = existingProcessors.some((p) => {
466
+ if (p === null || p === undefined || typeof p !== "object") {
467
+ return false;
468
+ }
469
+ // Prefer instanceof — works when same @langfuse/otel package is shared
470
+ if (p instanceof LangfuseSpanProcessor) {
471
+ return true;
472
+ }
473
+ // Duck-type: Langfuse processor exposes a langfuseClient property
474
+ if ("langfuseClient" in p) {
475
+ return true;
476
+ }
477
+ // Fallback: constructor name (brittle under minification)
478
+ return (p.constructor?.name ===
479
+ "LangfuseSpanProcessor");
480
+ });
481
+ const skipLangfuse = config.skipLangfuseSpanProcessor === true ||
482
+ !langfuseProcessor ||
483
+ hasExistingLangfuse;
484
+ if (hasExistingLangfuse && !config.skipLangfuseSpanProcessor) {
485
+ logger.info(`${LOG_PREFIX} Auto-detected existing LangfuseSpanProcessor — skipping SDK registration to avoid duplicates`);
486
+ }
449
487
  if (!skipLangfuse && langfuseProcessor) {
450
488
  provider.addSpanProcessor(langfuseProcessor);
451
489
  }
@@ -765,6 +765,7 @@ export type ProxyStartArgs = {
765
765
  config?: string;
766
766
  envFile?: string;
767
767
  passthrough?: boolean;
768
+ dev?: boolean;
768
769
  };
769
770
  /** Arguments accepted by `neurolink proxy status` */
770
771
  export type ProxyStatusArgs = {
@@ -228,6 +228,7 @@ export type ExternalMCPServerEvents = {
228
228
  /** Server status changed */
229
229
  statusChanged: {
230
230
  serverId: string;
231
+ serverName: string;
231
232
  oldStatus: ExternalMCPServerStatus;
232
233
  newStatus: ExternalMCPServerStatus;
233
234
  timestamp: Date;
@@ -235,24 +236,28 @@ export type ExternalMCPServerEvents = {
235
236
  /** Server connected successfully */
236
237
  connected: {
237
238
  serverId: string;
239
+ serverName: string;
238
240
  toolCount: number;
239
241
  timestamp: Date;
240
242
  };
241
243
  /** Server disconnected */
242
244
  disconnected: {
243
245
  serverId: string;
246
+ serverName: string;
244
247
  reason?: string;
245
248
  timestamp: Date;
246
249
  };
247
250
  /** Server failed */
248
251
  failed: {
249
252
  serverId: string;
253
+ serverName: string;
250
254
  error: string;
251
255
  timestamp: Date;
252
256
  };
253
257
  /** Tool discovered */
254
258
  toolDiscovered: {
255
259
  serverId: string;
260
+ serverName: string;
256
261
  toolName: string;
257
262
  toolInfo: ExternalMCPToolInfo;
258
263
  timestamp: Date;
@@ -260,12 +265,14 @@ export type ExternalMCPServerEvents = {
260
265
  /** Tool removed */
261
266
  toolRemoved: {
262
267
  serverId: string;
268
+ serverName: string;
263
269
  toolName: string;
264
270
  timestamp: Date;
265
271
  };
266
272
  /** Health check completed */
267
273
  healthCheck: {
268
274
  serverId: string;
275
+ serverName: string;
269
276
  health: ExternalMCPServerHealth;
270
277
  timestamp: Date;
271
278
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "9.50.1",
3
+ "version": "9.51.0",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "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 13 providers: OpenAI, Anthropic, Google AI, AWS Bedrock, Azure, Hugging Face, Ollama, and Mistral AI.",
6
6
  "author": {