@juspay/neurolink 9.54.5 → 9.54.7
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 +4 -0
- package/dist/action/actionInputs.d.ts +1 -1
- package/dist/adapters/video/directorPipeline.js +6 -0
- package/dist/adapters/video/vertexVideoHandler.js +6 -0
- package/dist/agent/directTools.d.ts +3 -23
- package/dist/auth/AuthProviderFactory.d.ts +1 -3
- package/dist/auth/anthropicOAuth.d.ts +4 -7
- package/dist/auth/anthropicOAuth.js +23 -0
- package/dist/auth/errors.d.ts +1 -1
- package/dist/auth/index.d.ts +11 -0
- package/dist/auth/index.js +14 -0
- package/dist/auth/middleware/AuthMiddleware.d.ts +5 -60
- package/dist/auth/middleware/AuthMiddleware.js +3 -0
- package/dist/auth/middleware/rateLimitByUser.d.ts +4 -93
- package/dist/auth/middleware/rateLimitByUser.js +4 -0
- package/dist/auth/providers/BaseAuthProvider.d.ts +1 -1
- package/dist/auth/providers/CognitoProvider.js +3 -0
- package/dist/auth/providers/KeycloakProvider.js +3 -0
- package/dist/auth/providers/auth0.d.ts +1 -1
- package/dist/auth/sessionManager.d.ts +2 -0
- package/dist/auth/sessionManager.js +53 -11
- package/dist/auth/tokenStore.d.ts +2 -1
- package/dist/auth/tokenStore.js +45 -4
- package/dist/autoresearch/tools.d.ts +1 -16
- package/dist/browser/neurolink.min.js +353 -353
- package/dist/cli/commands/config.d.ts +3 -123
- package/dist/cli/commands/config.js +4 -2
- package/dist/cli/commands/evaluate.d.ts +1 -19
- package/dist/cli/commands/proxy.d.ts +1 -1
- package/dist/cli/commands/proxy.js +3 -0
- package/dist/cli/commands/rag.js +3 -0
- package/dist/cli/commands/setup-anthropic.d.ts +2 -6
- package/dist/cli/commands/setup-anthropic.js +1 -1
- package/dist/cli/commands/setup-azure.d.ts +2 -6
- package/dist/cli/commands/setup-azure.js +1 -1
- package/dist/cli/commands/setup-bedrock.d.ts +2 -6
- package/dist/cli/commands/setup-bedrock.js +1 -1
- package/dist/cli/commands/setup-gcp.d.ts +2 -6
- package/dist/cli/commands/setup-google-ai.d.ts +2 -6
- package/dist/cli/commands/setup-google-ai.js +1 -1
- package/dist/cli/commands/setup-huggingface.d.ts +1 -5
- package/dist/cli/commands/setup-mistral.d.ts +1 -5
- package/dist/cli/commands/setup-openai.d.ts +2 -6
- package/dist/cli/commands/setup-openai.js +1 -1
- package/dist/cli/commands/setup.d.ts +1 -8
- package/dist/cli/commands/task.js +1 -0
- package/dist/cli/commands/voiceServer.d.ts +1 -4
- package/dist/cli/loop/session.js +31 -10
- package/dist/cli/utils/interactiveSetup.d.ts +2 -15
- package/dist/cli/utils/videoFileUtils.d.ts +1 -15
- package/dist/client/aiSdkAdapter.d.ts +1 -1
- package/dist/client/aiSdkAdapter.js +1 -0
- package/dist/client/httpClient.d.ts +2 -2
- package/dist/client/httpClient.js +13 -0
- package/dist/client/sseClient.d.ts +2 -2
- package/dist/client/sseClient.js +29 -0
- package/dist/client/streamingClient.d.ts +2 -0
- package/dist/client/streamingClient.js +19 -0
- package/dist/client/wsClient.d.ts +7 -2
- package/dist/client/wsClient.js +90 -10
- package/dist/context/budgetChecker.js +3 -1
- package/dist/context/contextCompactor.js +163 -143
- package/dist/context/fileSummarizationService.d.ts +1 -9
- package/dist/context/summarizationEngine.js +29 -16
- package/dist/core/baseProvider.js +124 -153
- package/dist/core/infrastructure/baseRegistry.d.ts +1 -7
- package/dist/core/modules/GenerationHandler.d.ts +3 -2
- package/dist/core/modules/GenerationHandler.js +9 -1
- package/dist/core/modules/StreamHandler.js +9 -0
- package/dist/core/modules/ToolsManager.js +18 -2
- package/dist/core/toolEvents.d.ts +0 -1
- package/dist/evaluation/BatchEvaluator.d.ts +1 -97
- package/dist/evaluation/EvaluationAggregator.d.ts +1 -118
- package/dist/evaluation/EvaluatorFactory.d.ts +1 -13
- package/dist/evaluation/EvaluatorRegistry.d.ts +1 -50
- package/dist/evaluation/errors/EvaluationError.d.ts +2 -27
- package/dist/evaluation/hooks/langfuseAdapter.d.ts +1 -39
- package/dist/evaluation/hooks/observabilityHooks.d.ts +3 -55
- package/dist/evaluation/hooks/observabilityHooks.js +3 -0
- package/dist/evaluation/pipeline/strategies/batchStrategy.d.ts +7 -61
- package/dist/evaluation/pipeline/strategies/batchStrategy.js +7 -7
- package/dist/evaluation/ragasEvaluator.js +54 -37
- package/dist/evaluation/reporting/metricsCollector.d.ts +1 -60
- package/dist/evaluation/reporting/reportGenerator.d.ts +1 -17
- package/dist/evaluation/scorers/rule/contentSimilarityScorer.d.ts +1 -29
- package/dist/evaluation/scorers/rule/formatScorer.d.ts +1 -42
- package/dist/evaluation/scorers/rule/keywordCoverageScorer.d.ts +1 -19
- package/dist/evaluation/scorers/rule/lengthScorer.d.ts +1 -33
- package/dist/factories/providerFactory.d.ts +1 -16
- package/dist/factories/providerFactory.js +2 -0
- package/dist/image-gen/ImageGenService.d.ts +3 -0
- package/dist/image-gen/ImageGenService.js +3 -0
- package/dist/lib/action/actionInputs.d.ts +1 -1
- package/dist/lib/adapters/video/directorPipeline.js +6 -0
- package/dist/lib/adapters/video/vertexVideoHandler.js +6 -0
- package/dist/lib/agent/directTools.d.ts +3 -23
- package/dist/lib/auth/AuthProviderFactory.d.ts +1 -3
- package/dist/lib/auth/anthropicOAuth.d.ts +4 -7
- package/dist/lib/auth/anthropicOAuth.js +23 -0
- package/dist/lib/auth/errors.d.ts +1 -1
- package/dist/lib/auth/index.d.ts +11 -0
- package/dist/lib/auth/index.js +14 -0
- package/dist/lib/auth/middleware/AuthMiddleware.d.ts +5 -60
- package/dist/lib/auth/middleware/AuthMiddleware.js +3 -0
- package/dist/lib/auth/middleware/rateLimitByUser.d.ts +4 -93
- package/dist/lib/auth/middleware/rateLimitByUser.js +4 -0
- package/dist/lib/auth/providers/BaseAuthProvider.d.ts +1 -1
- package/dist/lib/auth/providers/CognitoProvider.js +3 -0
- package/dist/lib/auth/providers/KeycloakProvider.js +3 -0
- package/dist/lib/auth/providers/auth0.d.ts +1 -1
- package/dist/lib/auth/sessionManager.d.ts +2 -0
- package/dist/lib/auth/sessionManager.js +53 -11
- package/dist/lib/auth/tokenStore.d.ts +2 -1
- package/dist/lib/auth/tokenStore.js +45 -4
- package/dist/lib/autoresearch/tools.d.ts +1 -16
- package/dist/lib/client/aiSdkAdapter.d.ts +1 -1
- package/dist/lib/client/aiSdkAdapter.js +1 -0
- package/dist/lib/client/httpClient.d.ts +2 -2
- package/dist/lib/client/httpClient.js +13 -0
- package/dist/lib/client/sseClient.d.ts +2 -2
- package/dist/lib/client/sseClient.js +29 -0
- package/dist/lib/client/streamingClient.d.ts +2 -0
- package/dist/lib/client/streamingClient.js +19 -0
- package/dist/lib/client/wsClient.d.ts +7 -2
- package/dist/lib/client/wsClient.js +90 -10
- package/dist/lib/context/budgetChecker.js +3 -1
- package/dist/lib/context/contextCompactor.js +163 -143
- package/dist/lib/context/fileSummarizationService.d.ts +1 -9
- package/dist/lib/context/summarizationEngine.js +29 -16
- package/dist/lib/core/baseProvider.js +124 -153
- package/dist/lib/core/infrastructure/baseRegistry.d.ts +1 -7
- package/dist/lib/core/modules/GenerationHandler.d.ts +3 -2
- package/dist/lib/core/modules/GenerationHandler.js +9 -1
- package/dist/lib/core/modules/StreamHandler.js +9 -0
- package/dist/lib/core/modules/ToolsManager.js +18 -2
- package/dist/lib/core/toolEvents.d.ts +0 -1
- package/dist/lib/evaluation/BatchEvaluator.d.ts +1 -97
- package/dist/lib/evaluation/EvaluationAggregator.d.ts +1 -118
- package/dist/lib/evaluation/EvaluatorFactory.d.ts +1 -13
- package/dist/lib/evaluation/EvaluatorRegistry.d.ts +1 -50
- package/dist/lib/evaluation/errors/EvaluationError.d.ts +2 -27
- package/dist/lib/evaluation/hooks/langfuseAdapter.d.ts +1 -39
- package/dist/lib/evaluation/hooks/observabilityHooks.d.ts +3 -55
- package/dist/lib/evaluation/hooks/observabilityHooks.js +3 -0
- package/dist/lib/evaluation/pipeline/strategies/batchStrategy.d.ts +7 -61
- package/dist/lib/evaluation/pipeline/strategies/batchStrategy.js +7 -7
- package/dist/lib/evaluation/ragasEvaluator.js +54 -37
- package/dist/lib/evaluation/reporting/metricsCollector.d.ts +1 -60
- package/dist/lib/evaluation/reporting/reportGenerator.d.ts +1 -17
- package/dist/lib/evaluation/scorers/rule/contentSimilarityScorer.d.ts +1 -29
- package/dist/lib/evaluation/scorers/rule/formatScorer.d.ts +1 -42
- package/dist/lib/evaluation/scorers/rule/keywordCoverageScorer.d.ts +1 -19
- package/dist/lib/evaluation/scorers/rule/lengthScorer.d.ts +1 -33
- package/dist/lib/factories/providerFactory.d.ts +1 -16
- package/dist/lib/factories/providerFactory.js +2 -0
- package/dist/lib/image-gen/ImageGenService.d.ts +3 -0
- package/dist/lib/image-gen/ImageGenService.js +3 -0
- package/dist/lib/mcp/batching/requestBatcher.js +99 -73
- package/dist/lib/mcp/httpRateLimiter.js +3 -1
- package/dist/lib/mcp/httpRetryHandler.js +3 -1
- package/dist/lib/mcp/mcpClientFactory.js +3 -1
- package/dist/lib/mcp/multiServerManager.d.ts +1 -14
- package/dist/lib/mcp/servers/aiProviders/aiAnalysisTools.js +5 -1
- package/dist/lib/mcp/servers/aiProviders/aiWorkflowTools.js +1 -0
- package/dist/lib/mcp/toolDiscoveryService.js +70 -57
- package/dist/lib/mcp/toolRegistry.js +11 -1
- package/dist/lib/memory/hippocampusInitializer.d.ts +1 -2
- package/dist/lib/memory/hippocampusInitializer.js +1 -1
- package/dist/lib/memory/memoryRetrievalTools.js +182 -141
- package/dist/lib/models/anthropicModels.d.ts +0 -1
- package/dist/lib/models/anthropicModels.js +1 -0
- package/dist/lib/neurolink.js +237 -41
- package/dist/lib/observability/exporterRegistry.d.ts +3 -22
- package/dist/lib/observability/exporters/sentryExporter.js +1 -0
- package/dist/lib/observability/metricsAggregator.d.ts +1 -31
- package/dist/lib/observability/retryPolicy.d.ts +0 -1
- package/dist/lib/observability/sampling/samplers.d.ts +0 -1
- package/dist/lib/observability/spanProcessor.d.ts +0 -1
- package/dist/lib/observability/tokenTracker.d.ts +7 -16
- package/dist/lib/observability/tokenTracker.js +6 -4
- package/dist/lib/observability/utils/spanSerializer.d.ts +5 -1
- package/dist/lib/observability/utils/spanSerializer.js +24 -4
- package/dist/lib/processors/base/BaseFileProcessor.js +66 -53
- package/dist/lib/processors/document/ExcelProcessor.d.ts +1 -1
- package/dist/lib/processors/errors/errorHelpers.d.ts +1 -31
- package/dist/lib/processors/errors/errorSerializer.d.ts +1 -45
- package/dist/lib/processors/registry/ProcessorRegistry.js +17 -6
- package/dist/lib/providers/amazonBedrock.js +189 -15
- package/dist/lib/providers/amazonSagemaker.js +25 -11
- package/dist/lib/providers/anthropic.js +13 -0
- package/dist/lib/providers/azureOpenai.js +2 -0
- package/dist/lib/providers/googleAiStudio.js +82 -0
- package/dist/lib/providers/googleNativeGemini3.d.ts +1 -2
- package/dist/lib/providers/googleVertex.js +52 -0
- package/dist/lib/providers/huggingFace.js +2 -0
- package/dist/lib/providers/litellm.js +2 -0
- package/dist/lib/providers/mistral.js +2 -0
- package/dist/lib/providers/ollama.js +84 -5
- package/dist/lib/providers/openAI.d.ts +2 -0
- package/dist/lib/providers/openAI.js +17 -6
- package/dist/lib/providers/openRouter.js +2 -0
- package/dist/lib/providers/openaiCompatible.js +2 -0
- package/dist/lib/providers/sagemaker/detection.d.ts +1 -33
- package/dist/lib/providers/sagemaker/diagnostics.d.ts +1 -25
- package/dist/lib/providers/sagemaker/language-model.d.ts +1 -1
- package/dist/lib/proxy/proxyConfig.js +4 -0
- package/dist/lib/proxy/proxyEnv.d.ts +1 -17
- package/dist/lib/proxy/proxyHealth.d.ts +0 -1
- package/dist/lib/proxy/proxyTracer.d.ts +1 -36
- package/dist/lib/proxy/proxyTracer.js +9 -0
- package/dist/lib/proxy/quietDetector.d.ts +1 -7
- package/dist/lib/proxy/rawStreamCapture.d.ts +1 -10
- package/dist/lib/proxy/requestLogger.d.ts +1 -21
- package/dist/lib/proxy/routingPolicy.d.ts +1 -2
- package/dist/lib/proxy/sseInterceptor.d.ts +1 -66
- package/dist/lib/proxy/sseInterceptor.js +6 -0
- package/dist/lib/proxy/updateChecker.d.ts +1 -6
- package/dist/lib/proxy/updateState.d.ts +1 -12
- package/dist/lib/rag/chunkers/BaseChunker.js +36 -22
- package/dist/lib/rag/chunking/jsonChunker.d.ts +1 -1
- package/dist/lib/rag/errors/RAGError.d.ts +1 -2
- package/dist/lib/rag/ragIntegration.js +45 -32
- package/dist/lib/rag/reranker/reranker.js +151 -122
- package/dist/lib/rag/retrieval/vectorQueryTool.js +79 -65
- package/dist/lib/sdk/toolRegistration.d.ts +10 -44
- package/dist/lib/sdk/toolRegistration.js +1 -1
- package/dist/lib/server/middleware/abortSignal.d.ts +1 -11
- package/dist/lib/server/middleware/auth.d.ts +1 -21
- package/dist/lib/server/middleware/auth.js +12 -0
- package/dist/lib/server/middleware/common.js +48 -32
- package/dist/lib/server/middleware/deprecation.d.ts +1 -20
- package/dist/lib/server/middleware/rateLimit.d.ts +1 -75
- package/dist/lib/server/middleware/validation.d.ts +3 -81
- package/dist/lib/server/middleware/validation.js +3 -0
- package/dist/lib/server/openapi/generator.d.ts +1 -47
- package/dist/lib/server/routes/agentRoutes.js +112 -57
- package/dist/lib/server/routes/claudeProxyRoutes.d.ts +1 -6
- package/dist/lib/server/routes/claudeProxyRoutes.js +127 -13
- package/dist/lib/server/routes/healthRoutes.js +58 -12
- package/dist/lib/server/routes/index.d.ts +1 -26
- package/dist/lib/server/routes/mcpRoutes.js +40 -7
- package/dist/lib/server/routes/memoryRoutes.js +22 -7
- package/dist/lib/server/routes/openApiRoutes.js +30 -6
- package/dist/lib/server/routes/toolRoutes.js +140 -68
- package/dist/lib/server/streaming/dataStream.d.ts +1 -35
- package/dist/lib/server/streaming/dataStream.js +15 -0
- package/dist/lib/services/server/ai/observability/instrumentation.js +114 -14
- package/dist/lib/session/globalSessionState.d.ts +1 -10
- package/dist/lib/tasks/tools/taskTools.d.ts +2 -2
- package/dist/lib/telemetry/traceContext.d.ts +9 -0
- package/dist/lib/telemetry/traceContext.js +19 -0
- package/dist/lib/telemetry/tracers.d.ts +2 -0
- package/dist/lib/telemetry/tracers.js +2 -0
- package/dist/lib/types/action.d.ts +2 -0
- package/dist/lib/types/artifact.d.ts +7 -0
- package/dist/lib/types/auth.d.ts +125 -18
- package/dist/lib/types/autoresearch.d.ts +12 -0
- package/dist/lib/types/cli.d.ts +415 -0
- package/dist/lib/types/client.d.ts +34 -0
- package/dist/lib/types/common.d.ts +12 -41
- package/dist/lib/types/context.d.ts +5 -0
- package/dist/lib/types/evaluation.d.ts +332 -1
- package/dist/lib/types/file.d.ts +4 -0
- package/dist/lib/types/mcp.d.ts +102 -2
- package/dist/lib/types/middleware.d.ts +116 -0
- package/dist/lib/types/multimodal.d.ts +65 -0
- package/dist/lib/types/observability.d.ts +81 -0
- package/dist/lib/types/processor.d.ts +47 -0
- package/dist/lib/types/providers.d.ts +120 -16
- package/dist/lib/types/proxy.d.ts +321 -1
- package/dist/lib/types/rag.d.ts +22 -0
- package/dist/lib/types/scorer.d.ts +141 -0
- package/dist/lib/types/server.d.ts +99 -0
- package/dist/lib/types/span.d.ts +2 -1
- package/dist/lib/types/span.js +1 -0
- package/dist/lib/types/tools.d.ts +44 -0
- package/dist/lib/types/tts.d.ts +6 -0
- package/dist/lib/types/utilities.d.ts +22 -0
- package/dist/lib/types/workflow.d.ts +18 -0
- package/dist/lib/utils/async/retry.d.ts +2 -8
- package/dist/lib/utils/async/retry.js +9 -9
- package/dist/lib/utils/imageCompressor.d.ts +1 -21
- package/dist/lib/utils/imageCompressor.js +5 -1
- package/dist/lib/utils/messageBuilder.d.ts +1 -1
- package/dist/lib/utils/redis.d.ts +1 -4
- package/dist/lib/utils/sanitizers/filename.d.ts +0 -1
- package/dist/lib/utils/toolEndEmitter.d.ts +25 -0
- package/dist/lib/utils/toolEndEmitter.js +65 -0
- package/dist/lib/workflow/config.d.ts +7 -32
- package/dist/lib/workflow/core/ensembleExecutor.js +28 -0
- package/dist/lib/workflow/core/judgeScorer.js +23 -0
- package/dist/lib/workflow/core/responseConditioner.js +17 -0
- package/dist/lib/workflow/core/workflowRunner.d.ts +1 -19
- package/dist/lib/workflow/core/workflowRunner.js +202 -147
- package/dist/mcp/batching/requestBatcher.js +99 -73
- package/dist/mcp/httpRateLimiter.js +3 -1
- package/dist/mcp/httpRetryHandler.js +3 -1
- package/dist/mcp/mcpClientFactory.js +3 -1
- package/dist/mcp/multiServerManager.d.ts +1 -14
- package/dist/mcp/servers/aiProviders/aiAnalysisTools.js +5 -1
- package/dist/mcp/servers/aiProviders/aiWorkflowTools.js +1 -0
- package/dist/mcp/toolDiscoveryService.js +70 -57
- package/dist/mcp/toolRegistry.js +11 -1
- package/dist/memory/hippocampusInitializer.d.ts +1 -2
- package/dist/memory/hippocampusInitializer.js +1 -1
- package/dist/memory/memoryRetrievalTools.js +182 -141
- package/dist/models/anthropicModels.d.ts +0 -1
- package/dist/models/anthropicModels.js +1 -0
- package/dist/neurolink.js +237 -41
- package/dist/observability/exporterRegistry.d.ts +3 -22
- package/dist/observability/exporters/sentryExporter.js +1 -0
- package/dist/observability/metricsAggregator.d.ts +1 -31
- package/dist/observability/retryPolicy.d.ts +0 -1
- package/dist/observability/sampling/samplers.d.ts +0 -1
- package/dist/observability/spanProcessor.d.ts +0 -1
- package/dist/observability/tokenTracker.d.ts +7 -16
- package/dist/observability/tokenTracker.js +6 -4
- package/dist/observability/utils/spanSerializer.d.ts +5 -1
- package/dist/observability/utils/spanSerializer.js +24 -4
- package/dist/processors/base/BaseFileProcessor.js +66 -53
- package/dist/processors/document/ExcelProcessor.d.ts +1 -1
- package/dist/processors/errors/errorHelpers.d.ts +1 -31
- package/dist/processors/errors/errorSerializer.d.ts +1 -45
- package/dist/processors/registry/ProcessorRegistry.js +17 -6
- package/dist/providers/amazonBedrock.js +189 -15
- package/dist/providers/amazonSagemaker.js +25 -11
- package/dist/providers/anthropic.js +13 -0
- package/dist/providers/azureOpenai.js +2 -0
- package/dist/providers/googleAiStudio.js +82 -0
- package/dist/providers/googleNativeGemini3.d.ts +1 -2
- package/dist/providers/googleVertex.js +52 -0
- package/dist/providers/huggingFace.js +2 -0
- package/dist/providers/litellm.js +2 -0
- package/dist/providers/mistral.js +2 -0
- package/dist/providers/ollama.js +84 -5
- package/dist/providers/openAI.d.ts +2 -0
- package/dist/providers/openAI.js +17 -6
- package/dist/providers/openRouter.js +2 -0
- package/dist/providers/openaiCompatible.js +2 -0
- package/dist/providers/sagemaker/detection.d.ts +1 -33
- package/dist/providers/sagemaker/diagnostics.d.ts +1 -25
- package/dist/providers/sagemaker/language-model.d.ts +1 -1
- package/dist/proxy/proxyConfig.js +4 -0
- package/dist/proxy/proxyEnv.d.ts +1 -17
- package/dist/proxy/proxyHealth.d.ts +0 -1
- package/dist/proxy/proxyTracer.d.ts +1 -36
- package/dist/proxy/proxyTracer.js +9 -0
- package/dist/proxy/quietDetector.d.ts +1 -7
- package/dist/proxy/rawStreamCapture.d.ts +1 -10
- package/dist/proxy/requestLogger.d.ts +1 -21
- package/dist/proxy/routingPolicy.d.ts +1 -2
- package/dist/proxy/sseInterceptor.d.ts +1 -66
- package/dist/proxy/sseInterceptor.js +6 -0
- package/dist/proxy/updateChecker.d.ts +1 -6
- package/dist/proxy/updateState.d.ts +1 -12
- package/dist/rag/chunkers/BaseChunker.js +36 -22
- package/dist/rag/chunking/jsonChunker.d.ts +1 -1
- package/dist/rag/errors/RAGError.d.ts +1 -2
- package/dist/rag/ragIntegration.js +45 -32
- package/dist/rag/reranker/reranker.js +151 -122
- package/dist/rag/retrieval/vectorQueryTool.js +79 -65
- package/dist/sdk/toolRegistration.d.ts +10 -44
- package/dist/sdk/toolRegistration.js +1 -1
- package/dist/server/middleware/abortSignal.d.ts +1 -11
- package/dist/server/middleware/auth.d.ts +1 -21
- package/dist/server/middleware/auth.js +12 -0
- package/dist/server/middleware/common.js +48 -32
- package/dist/server/middleware/deprecation.d.ts +1 -20
- package/dist/server/middleware/rateLimit.d.ts +1 -75
- package/dist/server/middleware/validation.d.ts +3 -81
- package/dist/server/middleware/validation.js +3 -0
- package/dist/server/openapi/generator.d.ts +1 -47
- package/dist/server/routes/agentRoutes.js +112 -57
- package/dist/server/routes/claudeProxyRoutes.d.ts +1 -6
- package/dist/server/routes/claudeProxyRoutes.js +127 -13
- package/dist/server/routes/healthRoutes.js +58 -12
- package/dist/server/routes/index.d.ts +1 -26
- package/dist/server/routes/mcpRoutes.js +40 -7
- package/dist/server/routes/memoryRoutes.js +22 -7
- package/dist/server/routes/openApiRoutes.js +30 -6
- package/dist/server/routes/toolRoutes.js +140 -68
- package/dist/server/streaming/dataStream.d.ts +1 -35
- package/dist/server/streaming/dataStream.js +15 -0
- package/dist/services/server/ai/observability/instrumentation.js +114 -14
- package/dist/session/globalSessionState.d.ts +1 -10
- package/dist/tasks/tools/taskTools.d.ts +2 -2
- package/dist/telemetry/traceContext.d.ts +9 -0
- package/dist/telemetry/traceContext.js +18 -0
- package/dist/telemetry/tracers.d.ts +2 -0
- package/dist/telemetry/tracers.js +2 -0
- package/dist/types/action.d.ts +2 -0
- package/dist/types/artifact.d.ts +7 -0
- package/dist/types/auth.d.ts +125 -18
- package/dist/types/autoresearch.d.ts +12 -0
- package/dist/types/cli.d.ts +415 -0
- package/dist/types/client.d.ts +34 -0
- package/dist/types/common.d.ts +12 -41
- package/dist/types/context.d.ts +5 -0
- package/dist/types/evaluation.d.ts +332 -1
- package/dist/types/file.d.ts +4 -0
- package/dist/types/mcp.d.ts +102 -2
- package/dist/types/middleware.d.ts +116 -0
- package/dist/types/multimodal.d.ts +65 -0
- package/dist/types/observability.d.ts +81 -0
- package/dist/types/processor.d.ts +47 -0
- package/dist/types/providers.d.ts +120 -16
- package/dist/types/proxy.d.ts +321 -1
- package/dist/types/rag.d.ts +22 -0
- package/dist/types/scorer.d.ts +141 -0
- package/dist/types/server.d.ts +99 -0
- package/dist/types/span.d.ts +2 -1
- package/dist/types/span.js +1 -0
- package/dist/types/tools.d.ts +44 -0
- package/dist/types/tts.d.ts +6 -0
- package/dist/types/utilities.d.ts +22 -0
- package/dist/types/workflow.d.ts +18 -0
- package/dist/utils/async/retry.d.ts +2 -8
- package/dist/utils/async/retry.js +9 -9
- package/dist/utils/imageCompressor.d.ts +1 -21
- package/dist/utils/imageCompressor.js +5 -1
- package/dist/utils/messageBuilder.d.ts +1 -1
- package/dist/utils/redis.d.ts +1 -4
- package/dist/utils/sanitizers/filename.d.ts +0 -1
- package/dist/utils/toolEndEmitter.d.ts +25 -0
- package/dist/utils/toolEndEmitter.js +64 -0
- package/dist/workflow/config.d.ts +4 -29
- package/dist/workflow/core/ensembleExecutor.js +28 -0
- package/dist/workflow/core/judgeScorer.js +23 -0
- package/dist/workflow/core/responseConditioner.js +17 -0
- package/dist/workflow/core/workflowRunner.d.ts +1 -19
- package/dist/workflow/core/workflowRunner.js +202 -147
- package/package.json +2 -1
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { z } from "zod";
|
|
8
8
|
import { AIProviderName } from "../constants/enums.js";
|
|
9
|
-
import type { JsonValue, ConditioningConfig, ExecutionConfig, JudgeConfig, WorkflowModelConfig, ModelGroup, WorkflowConfig } from "../types/index.js";
|
|
9
|
+
import type { JsonValue, ConditioningConfig, ExecutionConfig, JudgeConfig, WorkflowModelConfig, ModelGroup, WorkflowConfig, WorkflowValidation } from "../types/index.js";
|
|
10
10
|
export declare const MIN_SCORE = 0;
|
|
11
11
|
export declare const MAX_SCORE = 100;
|
|
12
12
|
export declare const MAX_REASONING_LENGTH = 200;
|
|
@@ -41,9 +41,9 @@ export declare const JudgeConfigSchema: z.ZodObject<{
|
|
|
41
41
|
criteria: z.ZodArray<z.ZodString>;
|
|
42
42
|
outputFormat: z.ZodEnum<{
|
|
43
43
|
scores: "scores";
|
|
44
|
-
detailed: "detailed";
|
|
45
44
|
ranking: "ranking";
|
|
46
45
|
best: "best";
|
|
46
|
+
detailed: "detailed";
|
|
47
47
|
}>;
|
|
48
48
|
customPrompt: z.ZodOptional<z.ZodString>;
|
|
49
49
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -195,9 +195,9 @@ export declare const WorkflowConfigSchema: z.ZodObject<{
|
|
|
195
195
|
criteria: z.ZodArray<z.ZodString>;
|
|
196
196
|
outputFormat: z.ZodEnum<{
|
|
197
197
|
scores: "scores";
|
|
198
|
-
detailed: "detailed";
|
|
199
198
|
ranking: "ranking";
|
|
200
199
|
best: "best";
|
|
200
|
+
detailed: "detailed";
|
|
201
201
|
}>;
|
|
202
202
|
customPrompt: z.ZodOptional<z.ZodString>;
|
|
203
203
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -219,9 +219,9 @@ export declare const WorkflowConfigSchema: z.ZodObject<{
|
|
|
219
219
|
criteria: z.ZodArray<z.ZodString>;
|
|
220
220
|
outputFormat: z.ZodEnum<{
|
|
221
221
|
scores: "scores";
|
|
222
|
-
detailed: "detailed";
|
|
223
222
|
ranking: "ranking";
|
|
224
223
|
best: "best";
|
|
224
|
+
detailed: "detailed";
|
|
225
225
|
}>;
|
|
226
226
|
customPrompt: z.ZodOptional<z.ZodString>;
|
|
227
227
|
systemPrompt: z.ZodOptional<z.ZodString>;
|
|
@@ -330,54 +330,30 @@ export declare const DEFAULT_JUDGE_CONFIG: {
|
|
|
330
330
|
* @returns Complete workflow configuration with defaults applied
|
|
331
331
|
*/
|
|
332
332
|
export declare function mergeWithDefaults(config: WorkflowConfig): WorkflowConfig;
|
|
333
|
-
/**
|
|
334
|
-
* Validation result for workflow configuration
|
|
335
|
-
*/
|
|
336
|
-
type WorkflowConfigValidationResult = {
|
|
337
|
-
success: boolean;
|
|
338
|
-
data?: WorkflowConfig;
|
|
339
|
-
error?: z.ZodError;
|
|
340
|
-
};
|
|
341
333
|
/**
|
|
342
334
|
* Validate workflow configuration
|
|
343
335
|
* @param config - Partial workflow configuration to validate
|
|
344
336
|
* @returns Validation result with parsed data or error details
|
|
345
337
|
*/
|
|
346
|
-
export declare function validateWorkflowConfig(config: Partial<WorkflowConfig>):
|
|
338
|
+
export declare function validateWorkflowConfig(config: Partial<WorkflowConfig>): WorkflowValidation<WorkflowConfig>;
|
|
347
339
|
/**
|
|
348
340
|
* Create workflow configuration from partial
|
|
349
341
|
* @param partial - Partial configuration with required fields (id, name, type, models)
|
|
350
342
|
* @returns Complete workflow configuration with defaults applied
|
|
351
343
|
*/
|
|
352
344
|
export declare function createWorkflowConfig(partial: Partial<WorkflowConfig> & Pick<WorkflowConfig, "id" | "name" | "type" | "models">): WorkflowConfig;
|
|
353
|
-
/**
|
|
354
|
-
* Validation result for model configuration
|
|
355
|
-
*/
|
|
356
|
-
type ModelConfigValidationResult = {
|
|
357
|
-
success: boolean;
|
|
358
|
-
data?: WorkflowModelConfig;
|
|
359
|
-
error?: z.ZodError;
|
|
360
|
-
};
|
|
361
345
|
/**
|
|
362
346
|
* Validate model configuration
|
|
363
347
|
* @param config - Partial model configuration to validate
|
|
364
348
|
* @returns Validation result with parsed data or error details
|
|
365
349
|
*/
|
|
366
|
-
export declare function validateModelConfig(config: Partial<WorkflowModelConfig>):
|
|
367
|
-
/**
|
|
368
|
-
* Validation result for judge configuration
|
|
369
|
-
*/
|
|
370
|
-
type JudgeConfigValidationResult = {
|
|
371
|
-
success: boolean;
|
|
372
|
-
data?: JudgeConfig;
|
|
373
|
-
error?: z.ZodError;
|
|
374
|
-
};
|
|
350
|
+
export declare function validateModelConfig(config: Partial<WorkflowModelConfig>): WorkflowValidation<WorkflowModelConfig>;
|
|
375
351
|
/**
|
|
376
352
|
* Validate judge configuration
|
|
377
353
|
* @param config - Partial judge configuration to validate
|
|
378
354
|
* @returns Validation result with parsed data or error details
|
|
379
355
|
*/
|
|
380
|
-
export declare function validateJudgeConfig(config: Partial<JudgeConfig>):
|
|
356
|
+
export declare function validateJudgeConfig(config: Partial<JudgeConfig>): WorkflowValidation<JudgeConfig>;
|
|
381
357
|
/**
|
|
382
358
|
* Check if workflow has judge configuration
|
|
383
359
|
* @param config - Workflow configuration to check
|
|
@@ -398,4 +374,3 @@ export declare function getAllJudges(config: WorkflowConfig): JudgeConfig[];
|
|
|
398
374
|
* @returns Estimated cost in USD
|
|
399
375
|
*/
|
|
400
376
|
export declare function estimateWorkflowCost(config: WorkflowConfig, estimatedTokens: number): number;
|
|
401
|
-
export {};
|
|
@@ -7,6 +7,8 @@ import { AIProviderFactory } from "../../core/factory.js";
|
|
|
7
7
|
import { logger } from "../../utils/logger.js";
|
|
8
8
|
import { SpanSerializer, SpanType, SpanStatus, getMetricsAggregator, } from "../../observability/index.js";
|
|
9
9
|
import { WorkflowError } from "../../types/index.js";
|
|
10
|
+
import { withSpan } from "../../telemetry/withSpan.js";
|
|
11
|
+
import { tracers } from "../../telemetry/tracers.js";
|
|
10
12
|
const functionTag = "EnsembleExecutor";
|
|
11
13
|
// ============================================================================
|
|
12
14
|
// EXECUTION FUNCTIONS
|
|
@@ -17,6 +19,16 @@ const functionTag = "EnsembleExecutor";
|
|
|
17
19
|
* @returns Ensemble execution result with all responses and metrics
|
|
18
20
|
*/
|
|
19
21
|
export async function executeEnsemble(options) {
|
|
22
|
+
return withSpan({
|
|
23
|
+
name: "neurolink.workflow.ensemble.execute",
|
|
24
|
+
tracer: tracers.workflow,
|
|
25
|
+
attributes: {
|
|
26
|
+
"workflow.model_count": options.models.length,
|
|
27
|
+
"workflow.parallelism": options.executionConfig?.parallelism ?? 10,
|
|
28
|
+
},
|
|
29
|
+
}, async (otelSpan) => executeEnsembleInner(options, otelSpan));
|
|
30
|
+
}
|
|
31
|
+
async function executeEnsembleInner(options, otelSpan) {
|
|
20
32
|
const startTime = Date.now();
|
|
21
33
|
const { prompt, models, executionConfig, systemPrompt, workflowDefaults } = options;
|
|
22
34
|
const span = SpanSerializer.createSpan(SpanType.WORKFLOW, "workflow.ensemble", {
|
|
@@ -75,6 +87,9 @@ export async function executeEnsemble(options) {
|
|
|
75
87
|
const spanStatus = successCount > 0 ? SpanStatus.OK : SpanStatus.ERROR;
|
|
76
88
|
const endedSpan = SpanSerializer.endSpan(span, spanStatus, successCount === 0 ? "No successful model responses" : undefined);
|
|
77
89
|
getMetricsAggregator().recordSpan(endedSpan);
|
|
90
|
+
otelSpan.setAttribute("workflow.success_count", successCount);
|
|
91
|
+
otelSpan.setAttribute("workflow.failure_count", failureCount);
|
|
92
|
+
otelSpan.setAttribute("workflow.total_time_ms", totalTime);
|
|
78
93
|
return {
|
|
79
94
|
responses,
|
|
80
95
|
totalTime,
|
|
@@ -272,6 +287,16 @@ export function getFastestResponse(responses) {
|
|
|
272
287
|
* @returns Ensemble execution result with all responses
|
|
273
288
|
*/
|
|
274
289
|
export async function executeModelGroups(groups, prompt, _executionConfig, systemPrompt, workflowDefaultSystemPrompt) {
|
|
290
|
+
return withSpan({
|
|
291
|
+
name: "neurolink.workflow.layers.execute",
|
|
292
|
+
tracer: tracers.workflow,
|
|
293
|
+
attributes: {
|
|
294
|
+
"workflow.group_count": groups.length,
|
|
295
|
+
"workflow.total_models": groups.reduce((n, g) => n + g.models.length, 0),
|
|
296
|
+
},
|
|
297
|
+
}, async (otelSpan) => executeModelGroupsInner(groups, prompt, _executionConfig, systemPrompt, workflowDefaultSystemPrompt, otelSpan));
|
|
298
|
+
}
|
|
299
|
+
async function executeModelGroupsInner(groups, prompt, _executionConfig, systemPrompt, workflowDefaultSystemPrompt, otelSpan) {
|
|
275
300
|
const startTime = Date.now();
|
|
276
301
|
const allResponses = [];
|
|
277
302
|
const allErrors = [];
|
|
@@ -325,6 +350,9 @@ export async function executeModelGroups(groups, prompt, _executionConfig, syste
|
|
|
325
350
|
successCount: totalSuccessCount,
|
|
326
351
|
failureCount: totalFailureCount,
|
|
327
352
|
});
|
|
353
|
+
otelSpan.setAttribute("workflow.success_count", totalSuccessCount);
|
|
354
|
+
otelSpan.setAttribute("workflow.failure_count", totalFailureCount);
|
|
355
|
+
otelSpan.setAttribute("workflow.total_time_ms", totalTime);
|
|
328
356
|
return {
|
|
329
357
|
responses: allResponses,
|
|
330
358
|
totalTime,
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
* workflow/core/judgeScorer.ts
|
|
3
3
|
* Judge-based scoring system for ensemble response evaluation
|
|
4
4
|
*/
|
|
5
|
+
import { SpanStatusCode } from "@opentelemetry/api";
|
|
5
6
|
import { AIProviderFactory } from "../../core/factory.js";
|
|
6
7
|
import { logger } from "../../utils/logger.js";
|
|
7
8
|
import { SpanSerializer, SpanType, SpanStatus, getMetricsAggregator, } from "../../observability/index.js";
|
|
9
|
+
import { withSpan } from "../../telemetry/withSpan.js";
|
|
10
|
+
import { tracers } from "../../telemetry/tracers.js";
|
|
8
11
|
import { MAX_REASONING_LENGTH } from "../config.js";
|
|
9
12
|
import { WorkflowError } from "../../types/index.js";
|
|
10
13
|
const functionTag = "JudgeScorer";
|
|
@@ -17,6 +20,17 @@ const functionTag = "JudgeScorer";
|
|
|
17
20
|
* @returns Score result with judge evaluation
|
|
18
21
|
*/
|
|
19
22
|
export async function scoreEnsemble(options) {
|
|
23
|
+
return withSpan({
|
|
24
|
+
name: "neurolink.workflow.judge.score",
|
|
25
|
+
tracer: tracers.workflow,
|
|
26
|
+
attributes: {
|
|
27
|
+
"workflow.judges_count": options.judges.length,
|
|
28
|
+
"workflow.responses_count": options.responses.length,
|
|
29
|
+
"workflow.pattern": options.judges.length > 1 ? "multi-judge" : "single-judge",
|
|
30
|
+
},
|
|
31
|
+
}, async (otelSpan) => scoreEnsembleInner(options, otelSpan));
|
|
32
|
+
}
|
|
33
|
+
async function scoreEnsembleInner(options, otelSpan) {
|
|
20
34
|
const startTime = Date.now();
|
|
21
35
|
const { judges, responses, originalPrompt, systemPrompt, timeout, workflowDefaults, } = options;
|
|
22
36
|
const span = SpanSerializer.createSpan(SpanType.WORKFLOW, "workflow.judge", {
|
|
@@ -47,6 +61,7 @@ export async function scoreEnsemble(options) {
|
|
|
47
61
|
span.durationMs = judgeTime;
|
|
48
62
|
const endedSpan = SpanSerializer.endSpan(span, SpanStatus.OK);
|
|
49
63
|
getMetricsAggregator().recordSpan(endedSpan);
|
|
64
|
+
otelSpan.setAttribute("workflow.judge_time_ms", judgeTime);
|
|
50
65
|
return {
|
|
51
66
|
scores: judgeResult,
|
|
52
67
|
judgeTime,
|
|
@@ -59,6 +74,8 @@ export async function scoreEnsemble(options) {
|
|
|
59
74
|
span.durationMs = judgeTime;
|
|
60
75
|
const endedSpan = SpanSerializer.endSpan(span, SpanStatus.OK);
|
|
61
76
|
getMetricsAggregator().recordSpan(endedSpan);
|
|
77
|
+
otelSpan.setAttribute("workflow.judge_time_ms", judgeTime);
|
|
78
|
+
otelSpan.setAttribute("workflow.judges_completed", judges.length);
|
|
62
79
|
return {
|
|
63
80
|
scores: multiJudgeResult,
|
|
64
81
|
judgeTime,
|
|
@@ -73,6 +90,12 @@ export async function scoreEnsemble(options) {
|
|
|
73
90
|
span.durationMs = Date.now() - startTime;
|
|
74
91
|
const endedSpan = SpanSerializer.endSpan(span, SpanStatus.ERROR, err.message);
|
|
75
92
|
getMetricsAggregator().recordSpan(endedSpan);
|
|
93
|
+
// Mark the outer OTel span as ERROR since we return instead of rethrowing
|
|
94
|
+
otelSpan.recordException(err);
|
|
95
|
+
otelSpan.setStatus({
|
|
96
|
+
code: SpanStatusCode.ERROR,
|
|
97
|
+
message: err.message,
|
|
98
|
+
});
|
|
76
99
|
const workflowError = error instanceof WorkflowError
|
|
77
100
|
? error
|
|
78
101
|
: new WorkflowError(err.message, {
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { logger } from "../../utils/logger.js";
|
|
9
9
|
import { AIProviderFactory } from "../../core/factory.js";
|
|
10
|
+
import { withSpan } from "../../telemetry/withSpan.js";
|
|
11
|
+
import { tracers } from "../../telemetry/tracers.js";
|
|
10
12
|
const functionTag = "ResponseConditioner";
|
|
11
13
|
// ============================================================================
|
|
12
14
|
// CONDITIONING FUNCTIONS
|
|
@@ -18,6 +20,18 @@ const functionTag = "ResponseConditioner";
|
|
|
18
20
|
* @returns Conditioned result with synthesized improved content
|
|
19
21
|
*/
|
|
20
22
|
export async function conditionResponse(options) {
|
|
23
|
+
return withSpan({
|
|
24
|
+
name: "neurolink.workflow.response.condition",
|
|
25
|
+
tracer: tracers.workflow,
|
|
26
|
+
attributes: {
|
|
27
|
+
"workflow.conditioning.enabled": Boolean(options.config?.useConfidence),
|
|
28
|
+
"workflow.conditioning.has_synthesis_model": Boolean(options.config?.synthesisModel),
|
|
29
|
+
"workflow.conditioning.original_length": options.content.length,
|
|
30
|
+
"workflow.conditioning.responses_count": options.allResponses?.length ?? 0,
|
|
31
|
+
},
|
|
32
|
+
}, async (otelSpan) => conditionResponseInner(options, otelSpan));
|
|
33
|
+
}
|
|
34
|
+
async function conditionResponseInner(options, otelSpan) {
|
|
21
35
|
const startTime = Date.now();
|
|
22
36
|
const { content, selectedResponse, allResponses, judgeScores, config, originalPrompt, } = options;
|
|
23
37
|
logger.debug(`[${functionTag}] Conditioning response with synthesis`, {
|
|
@@ -55,6 +69,9 @@ export async function conditionResponse(options) {
|
|
|
55
69
|
finalLength: synthesizedContent.length,
|
|
56
70
|
improvement: synthesizedContent.length - content.length,
|
|
57
71
|
});
|
|
72
|
+
otelSpan.setAttribute("workflow.conditioning.applied", true);
|
|
73
|
+
otelSpan.setAttribute("workflow.conditioning.synthesis", true);
|
|
74
|
+
otelSpan.setAttribute("workflow.conditioning.final_length", synthesizedContent.length);
|
|
58
75
|
return {
|
|
59
76
|
content: synthesizedContent,
|
|
60
77
|
conditioningTime,
|
|
@@ -11,24 +11,7 @@
|
|
|
11
11
|
*
|
|
12
12
|
* @module workflow/core/workflowRunner
|
|
13
13
|
*/
|
|
14
|
-
import type { RunWorkflowOptions, WorkflowConfig, WorkflowResult } from "../../types/index.js";
|
|
15
|
-
/**
|
|
16
|
-
* Progressive workflow response for streaming
|
|
17
|
-
*/
|
|
18
|
-
type WorkflowStreamChunk = {
|
|
19
|
-
/**
|
|
20
|
-
* Type of response chunk
|
|
21
|
-
*/
|
|
22
|
-
type: "preliminary" | "final";
|
|
23
|
-
/**
|
|
24
|
-
* Response content
|
|
25
|
-
*/
|
|
26
|
-
content: string;
|
|
27
|
-
/**
|
|
28
|
-
* Partial workflow result (only ensemble data for preliminary)
|
|
29
|
-
*/
|
|
30
|
-
partialResult?: Partial<WorkflowResult>;
|
|
31
|
-
};
|
|
14
|
+
import type { RunWorkflowOptions, WorkflowConfig, WorkflowResult, WorkflowStreamChunk } from "../../types/index.js";
|
|
32
15
|
/**
|
|
33
16
|
* Execute a complete workflow
|
|
34
17
|
*
|
|
@@ -76,4 +59,3 @@ export declare function runWorkflow(config: WorkflowConfig, options: RunWorkflow
|
|
|
76
59
|
* ```
|
|
77
60
|
*/
|
|
78
61
|
export declare function runWorkflowWithStreaming(config: WorkflowConfig, options: RunWorkflowOptions): AsyncGenerator<WorkflowStreamChunk, void, undefined>;
|
|
79
|
-
export {};
|