@juspay/neurolink 9.51.3 → 9.51.4

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 (47) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/artifacts/artifactStore.d.ts +56 -0
  3. package/dist/artifacts/artifactStore.js +143 -0
  4. package/dist/browser/neurolink.min.js +307 -296
  5. package/dist/cli/commands/mcp.d.ts +6 -0
  6. package/dist/cli/commands/mcp.js +128 -86
  7. package/dist/core/redisConversationMemoryManager.js +20 -0
  8. package/dist/lib/artifacts/artifactStore.d.ts +56 -0
  9. package/dist/lib/artifacts/artifactStore.js +144 -0
  10. package/dist/lib/core/redisConversationMemoryManager.js +20 -0
  11. package/dist/lib/mcp/externalServerManager.d.ts +6 -0
  12. package/dist/lib/mcp/externalServerManager.js +9 -0
  13. package/dist/lib/mcp/mcpOutputNormalizer.d.ts +49 -0
  14. package/dist/lib/mcp/mcpOutputNormalizer.js +182 -0
  15. package/dist/lib/mcp/toolDiscoveryService.d.ts +10 -0
  16. package/dist/lib/mcp/toolDiscoveryService.js +32 -1
  17. package/dist/lib/memory/memoryRetrievalTools.d.ts +64 -9
  18. package/dist/lib/memory/memoryRetrievalTools.js +77 -9
  19. package/dist/lib/neurolink.d.ts +2 -0
  20. package/dist/lib/neurolink.js +59 -80
  21. package/dist/lib/session/globalSessionState.js +44 -1
  22. package/dist/lib/types/artifactTypes.d.ts +63 -0
  23. package/dist/lib/types/artifactTypes.js +11 -0
  24. package/dist/lib/types/configTypes.d.ts +32 -0
  25. package/dist/lib/types/conversation.d.ts +7 -0
  26. package/dist/lib/types/index.d.ts +2 -0
  27. package/dist/lib/types/mcpOutputTypes.d.ts +40 -0
  28. package/dist/lib/types/mcpOutputTypes.js +9 -0
  29. package/dist/mcp/externalServerManager.d.ts +6 -0
  30. package/dist/mcp/externalServerManager.js +9 -0
  31. package/dist/mcp/mcpOutputNormalizer.d.ts +49 -0
  32. package/dist/mcp/mcpOutputNormalizer.js +181 -0
  33. package/dist/mcp/toolDiscoveryService.d.ts +10 -0
  34. package/dist/mcp/toolDiscoveryService.js +32 -1
  35. package/dist/memory/memoryRetrievalTools.d.ts +64 -9
  36. package/dist/memory/memoryRetrievalTools.js +77 -9
  37. package/dist/neurolink.d.ts +2 -0
  38. package/dist/neurolink.js +59 -80
  39. package/dist/session/globalSessionState.js +44 -1
  40. package/dist/types/artifactTypes.d.ts +63 -0
  41. package/dist/types/artifactTypes.js +10 -0
  42. package/dist/types/configTypes.d.ts +32 -0
  43. package/dist/types/conversation.d.ts +7 -0
  44. package/dist/types/index.d.ts +2 -0
  45. package/dist/types/mcpOutputTypes.d.ts +40 -0
  46. package/dist/types/mcpOutputTypes.js +8 -0
  47. package/package.json +1 -1
package/dist/neurolink.js CHANGED
@@ -40,6 +40,8 @@ import { ToolCallBatcher } from "./mcp/batching/index.js";
40
40
  import { ToolResultCache } from "./mcp/caching/index.js";
41
41
  import { EnhancedToolDiscovery } from "./mcp/enhancedToolDiscovery.js";
42
42
  import { ExternalServerManager } from "./mcp/externalServerManager.js";
43
+ import { McpOutputNormalizer, DEFAULT_MAX_MCP_OUTPUT_BYTES, DEFAULT_WARN_MCP_OUTPUT_BYTES, } from "./mcp/mcpOutputNormalizer.js";
44
+ import { LocalTempArtifactStore } from "./artifacts/artifactStore.js";
43
45
  import { ToolRouter } from "./mcp/routing/index.js";
44
46
  // Import direct tools server for automatic registration
45
47
  import { directToolsServer } from "./mcp/servers/agent/directToolsServer.js";
@@ -216,6 +218,8 @@ export class NeuroLink {
216
218
  mcpToolBatcher;
217
219
  mcpEnhancedDiscovery;
218
220
  mcpToolMiddlewares = [];
221
+ /** Artifact store for externalized MCP tool outputs (set when strategy=externalize). */
222
+ mcpArtifactStore;
219
223
  _disableToolCacheForCurrentRequest = false;
220
224
  mcpEnhancementsConfig;
221
225
  // Enhanced error handling support
@@ -818,6 +822,25 @@ export class NeuroLink {
818
822
  });
819
823
  }
820
824
  // ToolRouter — lazy-initialized when 2+ external servers exist (see addExternalMCPServer)
825
+ // McpOutputNormalizer — active when mcp.outputLimits is configured
826
+ if (mcpConfig?.outputLimits) {
827
+ const strategy = mcpConfig.outputLimits.strategy ?? "externalize";
828
+ const maxBytes = mcpConfig.outputLimits.maxBytes ?? DEFAULT_MAX_MCP_OUTPUT_BYTES;
829
+ const warnBytes = mcpConfig.outputLimits.warnBytes ?? DEFAULT_WARN_MCP_OUTPUT_BYTES;
830
+ let artifactStore;
831
+ if (strategy === "externalize") {
832
+ artifactStore = new LocalTempArtifactStore();
833
+ this.mcpArtifactStore = artifactStore;
834
+ logger.debug("[NeuroLink] MCP artifact store initialized (local-temp)");
835
+ }
836
+ const normalizer = new McpOutputNormalizer({ strategy, maxBytes, warnBytes }, artifactStore);
837
+ this.externalServerManager.setOutputNormalizer(normalizer);
838
+ logger.debug("[NeuroLink] MCP output normalizer initialized", {
839
+ strategy,
840
+ maxBytes,
841
+ warnBytes,
842
+ });
843
+ }
821
844
  }
822
845
  /**
823
846
  * Register file reference tools with the MCP tool registry.
@@ -937,90 +960,46 @@ export class NeuroLink {
937
960
  "redis" in memConfig &&
938
961
  !!memConfig.redis) ||
939
962
  process.env.STORAGE_TYPE === "redis";
940
- if (!memConfig?.enabled || !hasRedisConfig) {
941
- logger.debug("[NeuroLink] Skipping memory retrieval tools requires Redis conversation memory");
963
+ const hasArtifactStore = !!this.mcpArtifactStore;
964
+ // Register when Redis is configured OR when an artifact store exists.
965
+ // Artifact store alone is sufficient for the artifactId retrieval path —
966
+ // session history retrieval just returns a clear error when Redis is absent.
967
+ if ((!memConfig?.enabled || !hasRedisConfig) && !hasArtifactStore) {
968
+ logger.debug("[NeuroLink] Skipping memory retrieval tools — requires Redis conversation memory or an artifact store");
942
969
  return;
943
970
  }
944
- const tools = {
945
- retrieve_context: {
946
- description: "Retrieve messages from conversation memory. Use this to access full tool " +
947
- "outputs when a result was truncated, review previous assistant responses, " +
948
- "or search through conversation history.",
949
- execute: async (params) => {
950
- // Lazy access: conversationMemory is initialized on first generate() call
951
- const memoryManager = this.conversationMemory;
952
- if (!memoryManager || !("getSessionRaw" in memoryManager)) {
953
- return {
954
- success: false,
955
- error: "Memory retrieval not available — Redis memory manager not initialized",
956
- metadata: {
957
- toolName: "retrieve_context",
958
- serverId: "direct",
959
- executionTime: 0,
960
- },
961
- };
962
- }
963
- const actualTools = createMemoryRetrievalTools(memoryManager);
964
- const result = await actualTools.retrieve_context.execute(params, {
965
- toolCallId: "memory-retrieval",
966
- messages: [],
967
- });
968
- // Check if the tool itself reported an error
969
- const hasError = result &&
970
- typeof result === "object" &&
971
- "error" in result &&
972
- !("messages" in result);
973
- const errorMsg = hasError
974
- ? result.error
975
- : undefined;
976
- return {
977
- success: !hasError,
978
- data: result,
979
- ...(errorMsg ? { error: errorMsg } : {}),
980
- metadata: {
981
- toolName: "retrieve_context",
982
- serverId: "direct",
983
- executionTime: 0,
984
- },
985
- };
986
- },
971
+ // Extract the canonical tool definition (schema + description) from the
972
+ // memoryRetrievalTools factory. We pass undefined as the memoryManager here
973
+ // because we only need the Zod inputSchema and description at registration
974
+ // time the actual manager is resolved lazily at execution time.
975
+ const canonicalTools = createMemoryRetrievalTools(undefined, this.mcpArtifactStore);
976
+ const retrieveContextDef = canonicalTools.retrieve_context;
977
+ // Register via this.registerTool() so the tool ends up in the "user-defined"
978
+ // category inside toolRegistry. getCustomTools() returns that category, which
979
+ // is what ToolsManager reads to build the tool schema sent to the LLM.
980
+ // (Tools registered via toolRegistry.registerTool() directly land in the
981
+ // "built-in" category and are never included in the LLM's tool schema.)
982
+ this.registerTool("retrieve_context", {
983
+ name: "retrieve_context",
984
+ description: retrieveContextDef.description ?? "Retrieve context or artifacts",
985
+ // Pass the Zod schema so ToolsManager gives the LLM full parameter types.
986
+ // registerTool() detects isZodSchema on inputSchema and preserves it.
987
+ inputSchema: retrieveContextDef
988
+ .inputSchema,
989
+ execute: async (params) => {
990
+ // Lazy: conversationMemory is initialized on the first generate() call.
991
+ // When only an artifact store is present (no Redis), memoryManager is
992
+ // undefined — createMemoryRetrievalTools handles that via an explicit guard.
993
+ const memoryManager = this.conversationMemory;
994
+ const tools = createMemoryRetrievalTools(memoryManager, this.mcpArtifactStore);
995
+ // Return the result directly so the LLM receives clean output instead
996
+ // of a nested { success, data, metadata } wrapper.
997
+ // Bounded by TOOL_TIMEOUTS.EXECUTION_DEFAULT_MS so a stalled Redis or
998
+ // filesystem backend never hangs the tool call indefinitely.
999
+ return await withTimeout(tools.retrieve_context.execute(params, { toolCallId: "memory-retrieval", messages: [] }), TOOL_TIMEOUTS.EXECUTION_DEFAULT_MS, ErrorFactory.toolTimeout("retrieve_context", TOOL_TIMEOUTS.EXECUTION_DEFAULT_MS));
987
1000
  },
988
- };
989
- const registrations = Object.entries(tools).map(async ([toolName, toolDef]) => {
990
- const toolId = `direct.${toolName}`;
991
- const toolInfo = {
992
- name: toolName,
993
- description: toolDef.description,
994
- inputSchema: {},
995
- serverId: "direct",
996
- category: "built-in",
997
- };
998
- await this.toolRegistry.registerTool(toolId, toolInfo, {
999
- execute: async (params) => {
1000
- try {
1001
- return await toolDef.execute(params);
1002
- }
1003
- catch (error) {
1004
- // Known limitation: this non-throwing error path returns
1005
- // { success: false } without recording errorCategories in
1006
- // toolExecutionMetrics. These are internal memory-tool failures
1007
- // (low frequency), so the risk of metric gaps is minimal.
1008
- // A full fix would require access to the metrics map here,
1009
- // which is not available in the registration closure.
1010
- return {
1011
- success: false,
1012
- error: error instanceof Error ? error.message : String(error),
1013
- metadata: { toolName, serverId: "direct", executionTime: 0 },
1014
- };
1015
- }
1016
- },
1017
- description: toolDef.description,
1018
- inputSchema: {},
1019
- });
1020
- });
1021
- void Promise.all(registrations).then(() => {
1022
- logger.info("[NeuroLink] Memory retrieval tools registered");
1023
1001
  });
1002
+ logger.info("[NeuroLink] Memory retrieval tools registered");
1024
1003
  }
1025
1004
  /** Format memory context for prompt inclusion */
1026
1005
  formatMemoryContext(memoryContext, currentInput) {
@@ -1,6 +1,33 @@
1
1
  import { nanoid } from "nanoid";
2
2
  import { NeuroLink } from "../neurolink.js";
3
3
  import { buildObservabilityConfigFromEnv } from "../utils/observabilityHelpers.js";
4
+ /**
5
+ * Build mcp.outputLimits config from environment variables.
6
+ * Reads NEUROLINK_MCP_OUTPUT_STRATEGY and NEUROLINK_MCP_MAX_OUTPUT_BYTES.
7
+ * Returns undefined when neither variable is set (no overhead).
8
+ */
9
+ function buildMcpOutputLimitsFromEnv() {
10
+ const strategyRaw = process.env.NEUROLINK_MCP_OUTPUT_STRATEGY;
11
+ const maxBytesRaw = process.env.NEUROLINK_MCP_MAX_OUTPUT_BYTES;
12
+ const warnBytesRaw = process.env.NEUROLINK_MCP_WARN_OUTPUT_BYTES;
13
+ if (!strategyRaw && !maxBytesRaw) {
14
+ return undefined;
15
+ }
16
+ const strategy = strategyRaw === "inline" || strategyRaw === "externalize"
17
+ ? strategyRaw
18
+ : "externalize"; // safe default when only maxBytes is set
19
+ const maxBytes = maxBytesRaw ? parseInt(maxBytesRaw, 10) : undefined;
20
+ const warnBytes = warnBytesRaw ? parseInt(warnBytesRaw, 10) : undefined;
21
+ return {
22
+ strategy,
23
+ ...(maxBytes !== undefined && Number.isFinite(maxBytes) && maxBytes >= 0
24
+ ? { maxBytes }
25
+ : {}),
26
+ ...(warnBytes !== undefined && Number.isFinite(warnBytes) && warnBytes >= 0
27
+ ? { warnBytes }
28
+ : {}),
29
+ };
30
+ }
4
31
  export class GlobalSessionManager {
5
32
  static instance;
6
33
  loopSession = null;
@@ -25,6 +52,14 @@ export class GlobalSessionManager {
25
52
  if (observabilityConfig) {
26
53
  neurolinkOptions.observability = observabilityConfig;
27
54
  }
55
+ // Add MCP output limits from environment variables (CLI usage)
56
+ const mcpOutputLimits = buildMcpOutputLimitsFromEnv();
57
+ if (mcpOutputLimits) {
58
+ neurolinkOptions.mcp = {
59
+ ...neurolinkOptions.mcp,
60
+ outputLimits: mcpOutputLimits,
61
+ };
62
+ }
28
63
  this.loopSession = {
29
64
  neurolinkInstance: new NeuroLink(neurolinkOptions),
30
65
  sessionId,
@@ -99,7 +134,15 @@ export class GlobalSessionManager {
99
134
  }
100
135
  // Create new NeuroLink with observability config from environment (CLI usage)
101
136
  const observabilityConfig = buildObservabilityConfigFromEnv();
102
- return new NeuroLink(observabilityConfig ? { observability: observabilityConfig } : undefined);
137
+ const mcpOutputLimits = buildMcpOutputLimitsFromEnv();
138
+ const options = {};
139
+ if (observabilityConfig) {
140
+ options.observability = observabilityConfig;
141
+ }
142
+ if (mcpOutputLimits) {
143
+ options.mcp = { outputLimits: mcpOutputLimits };
144
+ }
145
+ return new NeuroLink(Object.keys(options).length ? options : undefined);
103
146
  }
104
147
  getCurrentSessionId() {
105
148
  return this.getLoopSession()?.sessionId;
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Artifact Store Types (canonical location)
3
+ *
4
+ * Types for the MCP large-output artifact storage system.
5
+ * When mcp.outputLimits.strategy = "externalize", oversized MCP tool outputs
6
+ * are stored as artifacts and the model receives a compact surrogate instead.
7
+ *
8
+ * @module types/artifactTypes
9
+ */
10
+ /** Metadata recorded alongside a stored artifact. */
11
+ export type ArtifactMeta = {
12
+ /** Tool name that produced the output. */
13
+ toolName: string;
14
+ /** MCP server ID. */
15
+ serverId: string;
16
+ /** Session that triggered the tool call (optional). */
17
+ sessionId?: string;
18
+ /** Serialized byte size of the full payload. */
19
+ sizeBytes: number;
20
+ /** Whether the payload is valid JSON or plain text. */
21
+ contentType: "json" | "text";
22
+ /** Unix epoch ms when the artifact was created. */
23
+ createdAt: number;
24
+ };
25
+ /** Lightweight descriptor returned after a successful ArtifactStore.store(). */
26
+ export type ArtifactRef = {
27
+ /** UUID v4 — stable identifier used in surrogate results and metadata. */
28
+ id: string;
29
+ /** First N characters of the payload (for surrogate headers). */
30
+ preview: string;
31
+ /** Full serialized byte size. */
32
+ sizeBytes: number;
33
+ /** Stored metadata. */
34
+ meta: ArtifactMeta;
35
+ };
36
+ /**
37
+ * Pluggable storage contract for externalized MCP tool outputs.
38
+ *
39
+ * Default backend: LocalTempArtifactStore (filesystem, single-process).
40
+ * Future backends can implement this interface for S3, Redis blobs, etc.
41
+ */
42
+ export interface ArtifactStore {
43
+ /**
44
+ * Persist a payload and return a lightweight reference.
45
+ * @param payload Serialized tool output (JSON string or plain text).
46
+ * @param meta Descriptor without `createdAt` (assigned internally).
47
+ */
48
+ store(payload: string, meta: Omit<ArtifactMeta, "createdAt">): Promise<ArtifactRef>;
49
+ /**
50
+ * Retrieve the full payload by artifact ID.
51
+ * Returns `null` if the artifact is not found or has been cleaned up.
52
+ */
53
+ retrieve(id: string): Promise<string | null>;
54
+ /** Delete a single artifact. No-op if the ID does not exist. */
55
+ delete(id: string): Promise<void>;
56
+ /**
57
+ * Delete all artifacts older than `olderThanMs` milliseconds.
58
+ * Returns the number of artifacts deleted.
59
+ */
60
+ cleanup(olderThanMs: number): Promise<number>;
61
+ /** Generate a short preview string from a serialized payload. */
62
+ generatePreview(payload: string): string;
63
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Artifact Store Types (canonical location)
3
+ *
4
+ * Types for the MCP large-output artifact storage system.
5
+ * When mcp.outputLimits.strategy = "externalize", oversized MCP tool outputs
6
+ * are stored as artifacts and the model receives a compact surrogate instead.
7
+ *
8
+ * @module types/artifactTypes
9
+ */
10
+ export {};
@@ -90,6 +90,38 @@ export type MCPEnhancementsConfig = {
90
90
  };
91
91
  /** Global tool middleware applied to every tool execution. Default: empty. */
92
92
  middleware?: ToolMiddleware[];
93
+ /**
94
+ * Large MCP tool output handling.
95
+ *
96
+ * MCP servers can return arbitrarily large payloads. Without limits these
97
+ * are loaded entirely into memory, cached in full, stored whole in Redis, and
98
+ * injected into the LLM context window — all of which silently fail at scale.
99
+ *
100
+ * When configured, NeuroLink intercepts oversized outputs at the tool boundary
101
+ * (before caching and before memory persistence) and applies the chosen
102
+ * strategy so the model receives a compact surrogate instead of a firehose.
103
+ *
104
+ * Two strategies:
105
+ * - "inline" Keep sending the full payload to the model regardless of
106
+ * size. A warning is emitted above warnBytes.
107
+ * - "externalize" Store the full payload on disk as an artifact and return a
108
+ * compact surrogate with a head/tail preview and an artifact
109
+ * ID. The model uses `retrieve_context` with that ID to read
110
+ * the full output on demand, with offset/limit pagination.
111
+ *
112
+ * Defaults (when `outputLimits` is set):
113
+ * strategy = "externalize"
114
+ * maxBytes = 100 KB (100 * 1024)
115
+ * warnBytes = 50 KB (50 * 1024)
116
+ */
117
+ outputLimits?: {
118
+ /** What to do when output exceeds maxBytes. Default: "externalize". */
119
+ strategy?: "inline" | "externalize";
120
+ /** Byte ceiling above which the strategy fires. Default: 102400 (100 KB). */
121
+ maxBytes?: number;
122
+ /** Bytes at which a warning is emitted even when still inline. Default: 51200 (50 KB). */
123
+ warnBytes?: number;
124
+ };
93
125
  };
94
126
  /**
95
127
  * Authentication configuration for NeuroLink SDK
@@ -231,6 +231,13 @@ export type ChatMessageMetadata = {
231
231
  toolOutputPreview?: string;
232
232
  /** Original byte size of the full tool output before any truncation */
233
233
  originalSize?: number;
234
+ /**
235
+ * Artifact store ID for an externalized MCP tool output.
236
+ * Set when `mcp.outputLimits.strategy = "externalize"` and the tool output
237
+ * exceeded `maxBytes`. Use retrieve_context with this ID to fetch the full
238
+ * payload from the local artifact store.
239
+ */
240
+ artifactId?: string;
234
241
  };
235
242
  /**
236
243
  * Chat message format for conversation history
@@ -6,6 +6,8 @@ export * from "./cli.js";
6
6
  export * from "./common.js";
7
7
  export type { AnalyticsConfig, BackupInfo, BackupMetadata, CacheConfig, ConfigUpdateOptions, ConfigValidationResult, FallbackConfig, MCPEnhancementsConfig, NeuroLinkConfig, PerformanceConfig, RetryConfig, ToolConfig, } from "./configTypes.js";
8
8
  export type { ExternalMCPConfigValidation, ExternalMCPManagerConfig, ExternalMCPOperationResult, ExternalMCPServerEvents, ExternalMCPServerHealth, ExternalMCPServerInstance, ExternalMCPServerStatus, ExternalMCPToolContext, ExternalMCPToolInfo, ExternalMCPToolResult, } from "./externalMcp.js";
9
+ export type { ArtifactMeta, ArtifactRef, ArtifactStore, } from "./artifactTypes.js";
10
+ export type { McpOutputContext, McpOutputNormalizerConfig, McpOutputStrategy, NormalizedMcpOutput, } from "./mcpOutputTypes.js";
9
11
  export type { AuthorizationUrlResult, CircuitBreakerConfig, CircuitBreakerEvents, CircuitBreakerState, CircuitBreakerStats, DiscoveredMcp, ExternalToolExecutionOptions, FlexibleValidationResult, HTTPRetryConfig, MCPClientResult, MCPConnectedServer, MCPDiscoveredServer, MCPExecutableTool, MCPOAuthConfig, MCPServerCategory, MCPServerConfig, MCPServerConnectionStatus, MCPServerInfo, MCPServerMetadata, MCPServerRegistryEntry, MCPServerStatus, MCPStatus, MCPToolInfo, MCPToolMetadata, MCPTransportType, McpMetadata, McpRegistry, NeuroLinkExecutionContext, NeuroLinkMCPServer, NeuroLinkMCPTool, OAuthClientInformation, OAuthTokens as McpOAuthTokens, RateLimitConfig, TokenBucketRateLimitConfig, TokenExchangeRequest, TokenStorage, ToolDiscoveryResult, ToolRegistryEvents, ToolValidationResult, } from "./mcpTypes.js";
10
12
  export type { ModelCapability, ModelFilter, ModelPricing, ModelResolutionContext, ModelStats, ModelUseCase, } from "./providers.js";
11
13
  export * from "./providers.js";
@@ -0,0 +1,40 @@
1
+ /**
2
+ * MCP Output Normalizer Types (canonical location)
3
+ *
4
+ * Types for the large MCP response handling system.
5
+ *
6
+ * @module types/mcpOutputTypes
7
+ */
8
+ /**
9
+ * Two honest strategies for oversized MCP tool outputs:
10
+ * - "inline" Full payload always sent to the model (warning logged above warnBytes).
11
+ * - "externalize" Full payload stored as an artifact; model receives a compact
12
+ * surrogate with head/tail preview and an artifact ID it can
13
+ * resolve via retrieve_context with offset/limit pagination.
14
+ */
15
+ export type McpOutputStrategy = "inline" | "externalize";
16
+ /** Configuration for McpOutputNormalizer. */
17
+ export type McpOutputNormalizerConfig = {
18
+ strategy: McpOutputStrategy;
19
+ /** Byte ceiling above which the strategy fires. */
20
+ maxBytes: number;
21
+ /** Bytes at which a warning is emitted while still inline. */
22
+ warnBytes: number;
23
+ };
24
+ /** Contextual info passed alongside the raw MCP callResult. */
25
+ export type McpOutputContext = {
26
+ toolName: string;
27
+ serverId: string;
28
+ sessionId?: string;
29
+ };
30
+ /** Value returned by McpOutputNormalizer.normalize(). */
31
+ export type NormalizedMcpOutput = {
32
+ /** The result to substitute for the raw callResult. May be a surrogate. */
33
+ result: unknown;
34
+ /** Whether the full payload was written to the artifact store. */
35
+ isExternalized: boolean;
36
+ /** Artifact ID when isExternalized === true. */
37
+ artifactId?: string;
38
+ /** Serialized byte size of the original payload. */
39
+ originalBytes: number;
40
+ };
@@ -0,0 +1,8 @@
1
+ /**
2
+ * MCP Output Normalizer Types (canonical location)
3
+ *
4
+ * Types for the large MCP response handling system.
5
+ *
6
+ * @module types/mcpOutputTypes
7
+ */
8
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "9.51.3",
3
+ "version": "9.51.4",
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": {