@juspay/neurolink 11.13.0 → 11.13.2
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 +2 -6
- package/dist/browser/neurolink.min.js +681 -842
- package/dist/cli/commands/agent.js +2 -2
- package/dist/cli/commands/auth.d.ts +1 -1
- package/dist/cli/commands/auth.js +11 -11
- package/dist/cli/commands/authProviders.d.ts +1 -1
- package/dist/cli/commands/authProviders.js +2 -2
- package/dist/cli/commands/autoresearch.js +5 -5
- package/dist/cli/commands/config.d.ts +1 -1
- package/dist/cli/commands/config.js +4 -4
- package/dist/cli/commands/docs.d.ts +1 -1
- package/dist/cli/commands/evaluate.d.ts +1 -1
- package/dist/cli/commands/evaluate.js +4 -4
- package/dist/cli/commands/mcp.js +14 -14
- package/dist/cli/commands/models.js +3 -3
- package/dist/cli/commands/observability.d.ts +1 -1
- package/dist/cli/commands/observability.js +3 -3
- package/dist/cli/commands/ollama.js +1 -1
- package/dist/cli/commands/proxy.d.ts +2 -2
- package/dist/cli/commands/proxy.js +45 -45
- package/dist/cli/commands/proxyAnalyze.d.ts +1 -1
- package/dist/cli/commands/proxyAnalyze.js +2 -2
- package/dist/cli/commands/proxyReplay.d.ts +1 -1
- package/dist/cli/commands/proxyReplay.js +2 -2
- package/dist/cli/commands/rag.js +10 -10
- package/dist/cli/commands/serve.js +7 -7
- package/dist/cli/commands/server.js +6 -6
- package/dist/cli/commands/setup-anthropic.d.ts +1 -1
- package/dist/cli/commands/setup-anthropic.js +3 -3
- package/dist/cli/commands/setup-azure.d.ts +1 -1
- package/dist/cli/commands/setup-azure.js +3 -3
- package/dist/cli/commands/setup-bedrock.d.ts +1 -1
- package/dist/cli/commands/setup-bedrock.js +3 -3
- package/dist/cli/commands/setup-gcp.d.ts +1 -1
- package/dist/cli/commands/setup-gcp.js +1 -1
- package/dist/cli/commands/setup-google-ai.d.ts +1 -1
- package/dist/cli/commands/setup-google-ai.js +4 -4
- package/dist/cli/commands/setup-huggingface.d.ts +1 -1
- package/dist/cli/commands/setup-huggingface.js +1 -1
- package/dist/cli/commands/setup-mistral.d.ts +1 -1
- package/dist/cli/commands/setup-mistral.js +3 -3
- package/dist/cli/commands/setup-openai.d.ts +1 -1
- package/dist/cli/commands/setup-openai.js +3 -3
- package/dist/cli/commands/setup.d.ts +1 -1
- package/dist/cli/commands/setup.js +4 -4
- package/dist/cli/commands/task.js +4 -4
- package/dist/cli/commands/telemetry.d.ts +1 -1
- package/dist/cli/commands/telemetry.js +4 -4
- package/dist/cli/commands/voiceServer.d.ts +1 -1
- package/dist/cli/commands/voiceServer.js +6 -2
- package/dist/cli/commands/workflow.js +5 -5
- package/dist/cli/errorHandler.js +3 -3
- package/dist/cli/factories/commandFactory.js +13 -13
- package/dist/cli/factories/ollamaCommandFactory.js +3 -3
- package/dist/cli/factories/sagemakerCommandFactory.js +5 -5
- package/dist/cli/index.js +1 -1
- package/dist/cli/loop/conversationSelector.d.ts +1 -1
- package/dist/cli/loop/conversationSelector.js +3 -3
- package/dist/cli/loop/optionsSchema.d.ts +1 -1
- package/dist/cli/loop/optionsSchema.js +1 -1
- package/dist/cli/loop/session.d.ts +1 -1
- package/dist/cli/loop/session.js +6 -6
- package/dist/cli/parser.js +10 -2
- package/dist/cli/proxy-clients/claudeCode.d.ts +1 -1
- package/dist/cli/proxy-clients/claudeCode.js +1 -1
- package/dist/cli/proxy-clients/codex.d.ts +1 -1
- package/dist/cli/proxy-clients/codex.js +1 -1
- package/dist/cli/proxy-clients/copilot.d.ts +1 -1
- package/dist/cli/proxy-clients/copilot.js +1 -1
- package/dist/cli/proxy-clients/openCode.d.ts +1 -1
- package/dist/cli/proxy-clients/openCode.js +1 -1
- package/dist/cli/proxy-clients/qwenCode.d.ts +1 -1
- package/dist/cli/proxy-clients/qwenCode.js +1 -1
- package/dist/cli/proxy-clients/registry.d.ts +1 -1
- package/dist/cli/proxy-clients/registry.js +1 -1
- package/dist/cli/utils/audioFileUtils.d.ts +1 -1
- package/dist/cli/utils/audioPlayer.d.ts +1 -1
- package/dist/cli/utils/classifierRouterFlags.d.ts +1 -1
- package/dist/cli/utils/classifierRouterFlags.js +1 -1
- package/dist/cli/utils/completeSetup.d.ts +1 -1
- package/dist/cli/utils/completeSetup.js +1 -1
- package/dist/cli/utils/envManager.d.ts +1 -1
- package/dist/cli/utils/envManager.js +1 -1
- package/dist/cli/utils/inputValidation.js +2 -2
- package/dist/cli/utils/interactiveSetup.d.ts +2 -2
- package/dist/cli/utils/interactiveSetup.js +3 -3
- package/dist/cli/utils/ollamaUtils.d.ts +1 -1
- package/dist/cli/utils/ollamaUtils.js +1 -1
- package/dist/cli/utils/skillsFlags.d.ts +1 -1
- package/dist/cli/utils/toolRoutingFlags.d.ts +1 -1
- package/dist/cli/utils/toolRoutingFlags.js +1 -1
- package/dist/cli/utils/videoFileUtils.d.ts +1 -1
- package/dist/processors/data/XmlProcessor.d.ts +14 -0
- package/dist/processors/data/XmlProcessor.js +14 -0
- package/dist/processors/document/PptxProcessor.d.ts +9 -0
- package/dist/processors/document/PptxProcessor.js +9 -0
- package/dist/processors/media/VideoProcessor.js +30 -2
- package/dist/providers/amazonBedrock/client.js +1 -2
- package/dist/providers/googleVertex/index.d.ts +0 -1
- package/dist/providers/googleVertex/index.js +0 -1
- package/dist/rag/document/loaders.js +49 -21
- package/dist/server/abstract/baseServerAdapter.d.ts +13 -0
- package/dist/server/abstract/baseServerAdapter.js +39 -1
- package/dist/server/adapters/expressAdapter.js +15 -5
- package/dist/server/adapters/fastifyAdapter.js +15 -5
- package/dist/server/adapters/koaAdapter.js +16 -6
- package/dist/types/generate.d.ts +7 -0
- package/dist/types/stream.d.ts +1 -1
- package/docs-site/mcp-server/search.js +20 -12
- package/docs-site/mcp-server/types.d.ts +12 -5
- package/docs-site/static/search-index.json +1 -0
- package/package.json +16 -16
- package/dist/lib/action/actionExecutor.d.ts +0 -29
- package/dist/lib/action/actionExecutor.js +0 -291
- package/dist/lib/action/actionInputs.d.ts +0 -25
- package/dist/lib/action/actionInputs.js +0 -294
- package/dist/lib/action/githubIntegration.d.ts +0 -21
- package/dist/lib/action/githubIntegration.js +0 -188
- package/dist/lib/action/index.d.ts +0 -7
- package/dist/lib/action/index.js +0 -13
- package/dist/lib/adapters/audioFormatSupport.d.ts +0 -53
- package/dist/lib/adapters/audioFormatSupport.js +0 -201
- package/dist/lib/adapters/imageFormatSupport.d.ts +0 -75
- package/dist/lib/adapters/imageFormatSupport.js +0 -284
- package/dist/lib/adapters/providerImageAdapter.d.ts +0 -51
- package/dist/lib/adapters/providerImageAdapter.js +0 -704
- package/dist/lib/adapters/replicate/auth.d.ts +0 -19
- package/dist/lib/adapters/replicate/auth.js +0 -33
- package/dist/lib/adapters/replicate/predictionLifecycle.d.ts +0 -46
- package/dist/lib/adapters/replicate/predictionLifecycle.js +0 -289
- package/dist/lib/adapters/tts/cartesiaHandler.d.ts +0 -12
- package/dist/lib/adapters/tts/cartesiaHandler.js +0 -131
- package/dist/lib/adapters/tts/googleTTSHandler.d.ts +0 -97
- package/dist/lib/adapters/tts/googleTTSHandler.js +0 -353
- package/dist/lib/adapters/video/directorPipeline.d.ts +0 -31
- package/dist/lib/adapters/video/directorPipeline.js +0 -523
- package/dist/lib/adapters/video/ffmpegAdapter.d.ts +0 -84
- package/dist/lib/adapters/video/ffmpegAdapter.js +0 -207
- package/dist/lib/adapters/video/frameExtractor.d.ts +0 -28
- package/dist/lib/adapters/video/frameExtractor.js +0 -144
- package/dist/lib/adapters/video/klingVideoHandler.d.ts +0 -37
- package/dist/lib/adapters/video/klingVideoHandler.js +0 -306
- package/dist/lib/adapters/video/replicateVideoHandler.d.ts +0 -29
- package/dist/lib/adapters/video/replicateVideoHandler.js +0 -168
- package/dist/lib/adapters/video/runwayVideoHandler.d.ts +0 -32
- package/dist/lib/adapters/video/runwayVideoHandler.js +0 -317
- package/dist/lib/adapters/video/vertexVideoHandler.d.ts +0 -119
- package/dist/lib/adapters/video/vertexVideoHandler.js +0 -804
- package/dist/lib/adapters/video/videoAnalyzer.d.ts +0 -26
- package/dist/lib/adapters/video/videoAnalyzer.js +0 -239
- package/dist/lib/adapters/video/videoMerger.d.ts +0 -22
- package/dist/lib/adapters/video/videoMerger.js +0 -172
- package/dist/lib/agent/agent.d.ts +0 -104
- package/dist/lib/agent/agent.js +0 -433
- package/dist/lib/agent/agentNetwork.d.ts +0 -87
- package/dist/lib/agent/agentNetwork.js +0 -501
- package/dist/lib/agent/agentToolRegistrar.d.ts +0 -48
- package/dist/lib/agent/agentToolRegistrar.js +0 -337
- package/dist/lib/agent/communication/index.d.ts +0 -9
- package/dist/lib/agent/communication/index.js +0 -10
- package/dist/lib/agent/communication/message-bus.d.ts +0 -113
- package/dist/lib/agent/communication/message-bus.js +0 -407
- package/dist/lib/agent/coordination/coordinator.d.ts +0 -83
- package/dist/lib/agent/coordination/coordinator.js +0 -599
- package/dist/lib/agent/coordination/index.d.ts +0 -10
- package/dist/lib/agent/coordination/index.js +0 -11
- package/dist/lib/agent/coordination/task-distributor.d.ts +0 -113
- package/dist/lib/agent/coordination/task-distributor.js +0 -586
- package/dist/lib/agent/directTools.d.ts +0 -306
- package/dist/lib/agent/directTools.js +0 -907
- package/dist/lib/agent/index.d.ts +0 -41
- package/dist/lib/agent/index.js +0 -49
- package/dist/lib/agent/isolatedAgentRunner.d.ts +0 -73
- package/dist/lib/agent/isolatedAgentRunner.js +0 -947
- package/dist/lib/agent/orchestration/index.d.ts +0 -10
- package/dist/lib/agent/orchestration/index.js +0 -11
- package/dist/lib/agent/orchestration/orchestrator.d.ts +0 -114
- package/dist/lib/agent/orchestration/orchestrator.js +0 -479
- package/dist/lib/agent/orchestration/topology.d.ts +0 -164
- package/dist/lib/agent/orchestration/topology.js +0 -521
- package/dist/lib/agent/prompts/routingPrompts.d.ts +0 -63
- package/dist/lib/agent/prompts/routingPrompts.js +0 -202
- package/dist/lib/agent/structuredRecovery.d.ts +0 -30
- package/dist/lib/agent/structuredRecovery.js +0 -105
- package/dist/lib/analytics/index.d.ts +0 -7
- package/dist/lib/analytics/index.js +0 -8
- package/dist/lib/analytics/parseQualityScore.d.ts +0 -9
- package/dist/lib/analytics/parseQualityScore.js +0 -30
- package/dist/lib/analytics/pricing.d.ts +0 -27
- package/dist/lib/analytics/pricing.js +0 -42
- package/dist/lib/analytics/service.d.ts +0 -36
- package/dist/lib/analytics/service.js +0 -394
- package/dist/lib/analytics/storage.d.ts +0 -19
- package/dist/lib/analytics/storage.js +0 -33
- package/dist/lib/artifacts/artifactStore.d.ts +0 -55
- package/dist/lib/artifacts/artifactStore.js +0 -145
- package/dist/lib/auth/AuthProviderFactory.d.ts +0 -69
- package/dist/lib/auth/AuthProviderFactory.js +0 -112
- package/dist/lib/auth/AuthProviderRegistry.d.ts +0 -33
- package/dist/lib/auth/AuthProviderRegistry.js +0 -191
- package/dist/lib/auth/RequestContext.d.ts +0 -23
- package/dist/lib/auth/RequestContext.js +0 -79
- package/dist/lib/auth/accountPool.d.ts +0 -68
- package/dist/lib/auth/accountPool.js +0 -179
- package/dist/lib/auth/anthropicOAuth.d.ts +0 -400
- package/dist/lib/auth/anthropicOAuth.js +0 -1143
- package/dist/lib/auth/authContext.d.ts +0 -198
- package/dist/lib/auth/authContext.js +0 -315
- package/dist/lib/auth/codexOAuth.d.ts +0 -67
- package/dist/lib/auth/codexOAuth.js +0 -203
- package/dist/lib/auth/errors.d.ts +0 -63
- package/dist/lib/auth/errors.js +0 -40
- package/dist/lib/auth/index.d.ts +0 -41
- package/dist/lib/auth/index.js +0 -86
- package/dist/lib/auth/middleware/AuthMiddleware.d.ts +0 -127
- package/dist/lib/auth/middleware/AuthMiddleware.js +0 -523
- package/dist/lib/auth/middleware/rateLimitByUser.d.ts +0 -193
- package/dist/lib/auth/middleware/rateLimitByUser.js +0 -559
- package/dist/lib/auth/providers/BaseAuthProvider.d.ts +0 -259
- package/dist/lib/auth/providers/BaseAuthProvider.js +0 -724
- package/dist/lib/auth/providers/CognitoProvider.d.ts +0 -61
- package/dist/lib/auth/providers/CognitoProvider.js +0 -308
- package/dist/lib/auth/providers/KeycloakProvider.d.ts +0 -61
- package/dist/lib/auth/providers/KeycloakProvider.js +0 -396
- package/dist/lib/auth/providers/auth0.d.ts +0 -59
- package/dist/lib/auth/providers/auth0.js +0 -275
- package/dist/lib/auth/providers/betterAuth.d.ts +0 -51
- package/dist/lib/auth/providers/betterAuth.js +0 -183
- package/dist/lib/auth/providers/clerk.d.ts +0 -65
- package/dist/lib/auth/providers/clerk.js +0 -318
- package/dist/lib/auth/providers/custom.d.ts +0 -64
- package/dist/lib/auth/providers/custom.js +0 -113
- package/dist/lib/auth/providers/firebase.d.ts +0 -63
- package/dist/lib/auth/providers/firebase.js +0 -231
- package/dist/lib/auth/providers/jwt.d.ts +0 -68
- package/dist/lib/auth/providers/jwt.js +0 -217
- package/dist/lib/auth/providers/oauth2.d.ts +0 -73
- package/dist/lib/auth/providers/oauth2.js +0 -304
- package/dist/lib/auth/providers/supabase.d.ts +0 -63
- package/dist/lib/auth/providers/supabase.js +0 -260
- package/dist/lib/auth/providers/workos.d.ts +0 -61
- package/dist/lib/auth/providers/workos.js +0 -289
- package/dist/lib/auth/serverBridge.d.ts +0 -14
- package/dist/lib/auth/serverBridge.js +0 -26
- package/dist/lib/auth/sessionManager.d.ts +0 -118
- package/dist/lib/auth/sessionManager.js +0 -511
- package/dist/lib/auth/tokenStore.d.ts +0 -283
- package/dist/lib/auth/tokenStore.js +0 -929
- package/dist/lib/autoresearch/config.d.ts +0 -11
- package/dist/lib/autoresearch/config.js +0 -109
- package/dist/lib/autoresearch/errors.d.ts +0 -40
- package/dist/lib/autoresearch/errors.js +0 -21
- package/dist/lib/autoresearch/index.d.ts +0 -23
- package/dist/lib/autoresearch/index.js +0 -35
- package/dist/lib/autoresearch/phasePolicy.d.ts +0 -9
- package/dist/lib/autoresearch/phasePolicy.js +0 -70
- package/dist/lib/autoresearch/promptCompiler.d.ts +0 -15
- package/dist/lib/autoresearch/promptCompiler.js +0 -121
- package/dist/lib/autoresearch/repoPolicy.d.ts +0 -32
- package/dist/lib/autoresearch/repoPolicy.js +0 -129
- package/dist/lib/autoresearch/resultRecorder.d.ts +0 -20
- package/dist/lib/autoresearch/resultRecorder.js +0 -131
- package/dist/lib/autoresearch/runner.d.ts +0 -10
- package/dist/lib/autoresearch/runner.js +0 -109
- package/dist/lib/autoresearch/stateStore.d.ts +0 -12
- package/dist/lib/autoresearch/stateStore.js +0 -164
- package/dist/lib/autoresearch/summaryParser.d.ts +0 -16
- package/dist/lib/autoresearch/summaryParser.js +0 -95
- package/dist/lib/autoresearch/tools.d.ts +0 -27
- package/dist/lib/autoresearch/tools.js +0 -618
- package/dist/lib/autoresearch/worker.d.ts +0 -71
- package/dist/lib/autoresearch/worker.js +0 -418
- package/dist/lib/avatar/index.d.ts +0 -26
- package/dist/lib/avatar/index.js +0 -86
- package/dist/lib/avatar/providers/DIDAvatar.d.ts +0 -49
- package/dist/lib/avatar/providers/DIDAvatar.js +0 -502
- package/dist/lib/avatar/providers/HeyGenAvatar.d.ts +0 -30
- package/dist/lib/avatar/providers/HeyGenAvatar.js +0 -338
- package/dist/lib/avatar/providers/ReplicateAvatar.d.ts +0 -36
- package/dist/lib/avatar/providers/ReplicateAvatar.js +0 -268
- package/dist/lib/client/aiSdkAdapter.d.ts +0 -196
- package/dist/lib/client/aiSdkAdapter.js +0 -498
- package/dist/lib/client/auth.d.ts +0 -248
- package/dist/lib/client/auth.js +0 -469
- package/dist/lib/client/errors.d.ts +0 -298
- package/dist/lib/client/errors.js +0 -553
- package/dist/lib/client/httpClient.d.ts +0 -296
- package/dist/lib/client/httpClient.js +0 -851
- package/dist/lib/client/index.d.ts +0 -103
- package/dist/lib/client/index.js +0 -174
- package/dist/lib/client/interceptors.d.ts +0 -207
- package/dist/lib/client/interceptors.js +0 -620
- package/dist/lib/client/reactHooks.d.ts +0 -238
- package/dist/lib/client/reactHooks.js +0 -1168
- package/dist/lib/client/sseClient.d.ts +0 -115
- package/dist/lib/client/sseClient.js +0 -575
- package/dist/lib/client/streamingClient.d.ts +0 -255
- package/dist/lib/client/streamingClient.js +0 -963
- package/dist/lib/client/wsClient.d.ts +0 -127
- package/dist/lib/client/wsClient.js +0 -450
- package/dist/lib/config/configManager.d.ts +0 -60
- package/dist/lib/config/configManager.js +0 -304
- package/dist/lib/config/conversationMemory.d.ts +0 -51
- package/dist/lib/config/conversationMemory.js +0 -87
- package/dist/lib/config/modelSpecificPrompts.d.ts +0 -9
- package/dist/lib/config/modelSpecificPrompts.js +0 -39
- package/dist/lib/config/taskClassificationConfig.d.ts +0 -51
- package/dist/lib/config/taskClassificationConfig.js +0 -149
- package/dist/lib/constants/contextWindows.d.ts +0 -89
- package/dist/lib/constants/contextWindows.js +0 -568
- package/dist/lib/constants/enums.d.ts +0 -979
- package/dist/lib/constants/enums.js +0 -1247
- package/dist/lib/constants/index.d.ts +0 -184
- package/dist/lib/constants/index.js +0 -209
- package/dist/lib/constants/networkErrorCodes.d.ts +0 -14
- package/dist/lib/constants/networkErrorCodes.js +0 -22
- package/dist/lib/constants/performance.d.ts +0 -366
- package/dist/lib/constants/performance.js +0 -390
- package/dist/lib/constants/retry.d.ts +0 -224
- package/dist/lib/constants/retry.js +0 -267
- package/dist/lib/constants/timeouts.d.ts +0 -225
- package/dist/lib/constants/timeouts.js +0 -183
- package/dist/lib/constants/tokens.d.ts +0 -294
- package/dist/lib/constants/tokens.js +0 -381
- package/dist/lib/constants/videoErrors.d.ts +0 -49
- package/dist/lib/constants/videoErrors.js +0 -51
- package/dist/lib/context/anthropicLoopGuard.d.ts +0 -47
- package/dist/lib/context/anthropicLoopGuard.js +0 -186
- package/dist/lib/context/budgetChecker.d.ts +0 -33
- package/dist/lib/context/budgetChecker.js +0 -132
- package/dist/lib/context/contextCompactor.d.ts +0 -19
- package/dist/lib/context/contextCompactor.js +0 -258
- package/dist/lib/context/effectiveHistory.d.ts +0 -52
- package/dist/lib/context/effectiveHistory.js +0 -106
- package/dist/lib/context/emergencyTruncation.d.ts +0 -21
- package/dist/lib/context/emergencyTruncation.js +0 -89
- package/dist/lib/context/errorDetection.d.ts +0 -36
- package/dist/lib/context/errorDetection.js +0 -190
- package/dist/lib/context/errors.d.ts +0 -19
- package/dist/lib/context/errors.js +0 -22
- package/dist/lib/context/fileSummarizationService.d.ts +0 -45
- package/dist/lib/context/fileSummarizationService.js +0 -256
- package/dist/lib/context/fileSummarizer.d.ts +0 -55
- package/dist/lib/context/fileSummarizer.js +0 -146
- package/dist/lib/context/fileTokenBudget.d.ts +0 -52
- package/dist/lib/context/fileTokenBudget.js +0 -128
- package/dist/lib/context/geminiLoopGuard.d.ts +0 -54
- package/dist/lib/context/geminiLoopGuard.js +0 -141
- package/dist/lib/context/loopGuardCore.d.ts +0 -43
- package/dist/lib/context/loopGuardCore.js +0 -146
- package/dist/lib/context/openaiCompatLoopGuard.d.ts +0 -42
- package/dist/lib/context/openaiCompatLoopGuard.js +0 -173
- package/dist/lib/context/prompts/summarizationPrompt.d.ts +0 -16
- package/dist/lib/context/prompts/summarizationPrompt.js +0 -118
- package/dist/lib/context/stages/fileReadDeduplicator.d.ts +0 -8
- package/dist/lib/context/stages/fileReadDeduplicator.js +0 -67
- package/dist/lib/context/stages/slidingWindowTruncator.d.ts +0 -15
- package/dist/lib/context/stages/slidingWindowTruncator.js +0 -237
- package/dist/lib/context/stages/structuredSummarizer.d.ts +0 -8
- package/dist/lib/context/stages/structuredSummarizer.js +0 -123
- package/dist/lib/context/stages/toolOutputPruner.d.ts +0 -8
- package/dist/lib/context/stages/toolOutputPruner.js +0 -53
- package/dist/lib/context/stepBudgetGuard.d.ts +0 -61
- package/dist/lib/context/stepBudgetGuard.js +0 -358
- package/dist/lib/context/summarizationEngine.d.ts +0 -45
- package/dist/lib/context/summarizationEngine.js +0 -162
- package/dist/lib/context/toolOutputLimits.d.ts +0 -36
- package/dist/lib/context/toolOutputLimits.js +0 -95
- package/dist/lib/context/toolPairRepair.d.ts +0 -43
- package/dist/lib/context/toolPairRepair.js +0 -242
- package/dist/lib/core/analytics.d.ts +0 -11
- package/dist/lib/core/analytics.js +0 -117
- package/dist/lib/core/baseProvider.d.ts +0 -500
- package/dist/lib/core/baseProvider.js +0 -2081
- package/dist/lib/core/constants.d.ts +0 -146
- package/dist/lib/core/constants.js +0 -278
- package/dist/lib/core/conversationMemoryFactory.d.ts +0 -19
- package/dist/lib/core/conversationMemoryFactory.js +0 -147
- package/dist/lib/core/conversationMemoryInitializer.d.ts +0 -14
- package/dist/lib/core/conversationMemoryInitializer.js +0 -129
- package/dist/lib/core/conversationMemoryManager.d.ts +0 -110
- package/dist/lib/core/conversationMemoryManager.js +0 -471
- package/dist/lib/core/dynamicModels.d.ts +0 -89
- package/dist/lib/core/dynamicModels.js +0 -337
- package/dist/lib/core/evaluation.d.ts +0 -18
- package/dist/lib/core/evaluation.js +0 -310
- package/dist/lib/core/evaluationProviders.d.ts +0 -60
- package/dist/lib/core/evaluationProviders.js +0 -249
- package/dist/lib/core/factory.d.ts +0 -54
- package/dist/lib/core/factory.js +0 -364
- package/dist/lib/core/geminiLoopAdapter.d.ts +0 -20
- package/dist/lib/core/geminiLoopAdapter.js +0 -171
- package/dist/lib/core/handlerRegistry.d.ts +0 -29
- package/dist/lib/core/handlerRegistry.js +0 -62
- package/dist/lib/core/infrastructure/baseError.d.ts +0 -21
- package/dist/lib/core/infrastructure/baseError.js +0 -23
- package/dist/lib/core/infrastructure/baseFactory.d.ts +0 -16
- package/dist/lib/core/infrastructure/baseFactory.js +0 -55
- package/dist/lib/core/infrastructure/baseRegistry.d.ts +0 -19
- package/dist/lib/core/infrastructure/baseRegistry.js +0 -54
- package/dist/lib/core/infrastructure/index.d.ts +0 -5
- package/dist/lib/core/infrastructure/index.js +0 -6
- package/dist/lib/core/infrastructure/retry.d.ts +0 -2
- package/dist/lib/core/infrastructure/retry.js +0 -21
- package/dist/lib/core/infrastructure/typedEventEmitter.d.ts +0 -8
- package/dist/lib/core/infrastructure/typedEventEmitter.js +0 -24
- package/dist/lib/core/loopEngine.d.ts +0 -21
- package/dist/lib/core/loopEngine.js +0 -272
- package/dist/lib/core/modelConfiguration.d.ts +0 -179
- package/dist/lib/core/modelConfiguration.js +0 -549
- package/dist/lib/core/modules/GenerationHandler.d.ts +0 -135
- package/dist/lib/core/modules/GenerationHandler.js +0 -1028
- package/dist/lib/core/modules/MessageBuilder.d.ts +0 -24
- package/dist/lib/core/modules/MessageBuilder.js +0 -311
- package/dist/lib/core/modules/StreamHandler.d.ts +0 -70
- package/dist/lib/core/modules/StreamHandler.js +0 -229
- package/dist/lib/core/modules/TelemetryHandler.d.ts +0 -70
- package/dist/lib/core/modules/TelemetryHandler.js +0 -229
- package/dist/lib/core/modules/ToolsManager.d.ts +0 -105
- package/dist/lib/core/modules/ToolsManager.js +0 -737
- package/dist/lib/core/modules/Utilities.d.ts +0 -90
- package/dist/lib/core/modules/Utilities.js +0 -347
- package/dist/lib/core/modules/structuredOutputPolicy.d.ts +0 -91
- package/dist/lib/core/modules/structuredOutputPolicy.js +0 -136
- package/dist/lib/core/nativeToolFormat.d.ts +0 -33
- package/dist/lib/core/nativeToolFormat.js +0 -31
- package/dist/lib/core/redisConversationMemoryManager.d.ts +0 -235
- package/dist/lib/core/redisConversationMemoryManager.js +0 -1724
- package/dist/lib/core/serviceRegistry.d.ts +0 -40
- package/dist/lib/core/serviceRegistry.js +0 -113
- package/dist/lib/core/streamAnalytics.d.ts +0 -27
- package/dist/lib/core/streamAnalytics.js +0 -132
- package/dist/lib/core/streamChannel.d.ts +0 -10
- package/dist/lib/core/streamChannel.js +0 -77
- package/dist/lib/core/toolDedup.d.ts +0 -51
- package/dist/lib/core/toolDedup.js +0 -197
- package/dist/lib/core/toolEvents.d.ts +0 -2
- package/dist/lib/core/toolEvents.js +0 -8
- package/dist/lib/core/toolExecutionRecorder.d.ts +0 -76
- package/dist/lib/core/toolExecutionRecorder.js +0 -261
- package/dist/lib/core/toolRouting.d.ts +0 -68
- package/dist/lib/core/toolRouting.js +0 -496
- package/dist/lib/core/toolRoutingCache.d.ts +0 -64
- package/dist/lib/core/toolRoutingCache.js +0 -155
- package/dist/lib/core/toolRoutingEmbedding.d.ts +0 -112
- package/dist/lib/core/toolRoutingEmbedding.js +0 -323
- package/dist/lib/dynamic/dynamicResolver.d.ts +0 -282
- package/dist/lib/dynamic/dynamicResolver.js +0 -634
- package/dist/lib/dynamic/index.d.ts +0 -10
- package/dist/lib/dynamic/index.js +0 -13
- package/dist/lib/dynamic/resolution.d.ts +0 -17
- package/dist/lib/dynamic/resolution.js +0 -22
- package/dist/lib/evaluation/BatchEvaluator.d.ts +0 -65
- package/dist/lib/evaluation/BatchEvaluator.js +0 -271
- package/dist/lib/evaluation/EvaluationAggregator.d.ts +0 -156
- package/dist/lib/evaluation/EvaluationAggregator.js +0 -378
- package/dist/lib/evaluation/EvaluatorFactory.d.ts +0 -102
- package/dist/lib/evaluation/EvaluatorFactory.js +0 -281
- package/dist/lib/evaluation/EvaluatorRegistry.d.ts +0 -111
- package/dist/lib/evaluation/EvaluatorRegistry.js +0 -185
- package/dist/lib/evaluation/contextBuilder.d.ts +0 -44
- package/dist/lib/evaluation/contextBuilder.js +0 -132
- package/dist/lib/evaluation/errors/EvaluationError.d.ts +0 -161
- package/dist/lib/evaluation/errors/EvaluationError.js +0 -207
- package/dist/lib/evaluation/errors/index.d.ts +0 -4
- package/dist/lib/evaluation/errors/index.js +0 -5
- package/dist/lib/evaluation/hooks/index.d.ts +0 -6
- package/dist/lib/evaluation/hooks/index.js +0 -7
- package/dist/lib/evaluation/hooks/langfuseAdapter.d.ts +0 -62
- package/dist/lib/evaluation/hooks/langfuseAdapter.js +0 -173
- package/dist/lib/evaluation/hooks/observabilityHooks.d.ts +0 -77
- package/dist/lib/evaluation/hooks/observabilityHooks.js +0 -187
- package/dist/lib/evaluation/index.d.ts +0 -41
- package/dist/lib/evaluation/index.js +0 -78
- package/dist/lib/evaluation/pipeline/evaluationPipeline.d.ts +0 -83
- package/dist/lib/evaluation/pipeline/evaluationPipeline.js +0 -397
- package/dist/lib/evaluation/pipeline/index.d.ts +0 -8
- package/dist/lib/evaluation/pipeline/index.js +0 -9
- package/dist/lib/evaluation/pipeline/pipelineBuilder.d.ts +0 -126
- package/dist/lib/evaluation/pipeline/pipelineBuilder.js +0 -261
- package/dist/lib/evaluation/pipeline/presets.d.ts +0 -66
- package/dist/lib/evaluation/pipeline/presets.js +0 -225
- package/dist/lib/evaluation/pipeline/strategies/batchStrategy.d.ts +0 -46
- package/dist/lib/evaluation/pipeline/strategies/batchStrategy.js +0 -242
- package/dist/lib/evaluation/pipeline/strategies/index.d.ts +0 -6
- package/dist/lib/evaluation/pipeline/strategies/index.js +0 -7
- package/dist/lib/evaluation/pipeline/strategies/samplingStrategy.d.ts +0 -76
- package/dist/lib/evaluation/pipeline/strategies/samplingStrategy.js +0 -247
- package/dist/lib/evaluation/prompts.d.ts +0 -22
- package/dist/lib/evaluation/prompts.js +0 -74
- package/dist/lib/evaluation/ragasEvaluator.d.ts +0 -28
- package/dist/lib/evaluation/ragasEvaluator.js +0 -127
- package/dist/lib/evaluation/reporting/index.d.ts +0 -6
- package/dist/lib/evaluation/reporting/index.js +0 -7
- package/dist/lib/evaluation/reporting/metricsCollector.d.ts +0 -88
- package/dist/lib/evaluation/reporting/metricsCollector.js +0 -286
- package/dist/lib/evaluation/reporting/reportGenerator.d.ts +0 -57
- package/dist/lib/evaluation/reporting/reportGenerator.js +0 -375
- package/dist/lib/evaluation/retryManager.d.ts +0 -39
- package/dist/lib/evaluation/retryManager.js +0 -79
- package/dist/lib/evaluation/scorers/baseScorer.d.ts +0 -82
- package/dist/lib/evaluation/scorers/baseScorer.js +0 -233
- package/dist/lib/evaluation/scorers/customScorerUtils.d.ts +0 -86
- package/dist/lib/evaluation/scorers/customScorerUtils.js +0 -382
- package/dist/lib/evaluation/scorers/index.d.ts +0 -10
- package/dist/lib/evaluation/scorers/index.js +0 -17
- package/dist/lib/evaluation/scorers/llm/answerRelevancyScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/answerRelevancyScorer.js +0 -100
- package/dist/lib/evaluation/scorers/llm/baseLLMScorer.d.ts +0 -69
- package/dist/lib/evaluation/scorers/llm/baseLLMScorer.js +0 -282
- package/dist/lib/evaluation/scorers/llm/biasDetectionScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/biasDetectionScorer.js +0 -128
- package/dist/lib/evaluation/scorers/llm/contextPrecisionScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/contextPrecisionScorer.js +0 -93
- package/dist/lib/evaluation/scorers/llm/contextRelevancyScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/contextRelevancyScorer.js +0 -108
- package/dist/lib/evaluation/scorers/llm/faithfulnessScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/faithfulnessScorer.js +0 -122
- package/dist/lib/evaluation/scorers/llm/hallucinationScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/hallucinationScorer.js +0 -141
- package/dist/lib/evaluation/scorers/llm/index.d.ts +0 -15
- package/dist/lib/evaluation/scorers/llm/index.js +0 -17
- package/dist/lib/evaluation/scorers/llm/promptAlignmentScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/promptAlignmentScorer.js +0 -107
- package/dist/lib/evaluation/scorers/llm/summarizationScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/summarizationScorer.js +0 -115
- package/dist/lib/evaluation/scorers/llm/toneConsistencyScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/toneConsistencyScorer.js +0 -107
- package/dist/lib/evaluation/scorers/llm/toxicityScorer.d.ts +0 -12
- package/dist/lib/evaluation/scorers/llm/toxicityScorer.js +0 -122
- package/dist/lib/evaluation/scorers/rule/baseRuleScorer.d.ts +0 -77
- package/dist/lib/evaluation/scorers/rule/baseRuleScorer.js +0 -234
- package/dist/lib/evaluation/scorers/rule/contentSimilarityScorer.d.ts +0 -81
- package/dist/lib/evaluation/scorers/rule/contentSimilarityScorer.js +0 -353
- package/dist/lib/evaluation/scorers/rule/formatScorer.d.ts +0 -107
- package/dist/lib/evaluation/scorers/rule/formatScorer.js +0 -471
- package/dist/lib/evaluation/scorers/rule/index.d.ts +0 -9
- package/dist/lib/evaluation/scorers/rule/index.js +0 -11
- package/dist/lib/evaluation/scorers/rule/keywordCoverageScorer.d.ts +0 -66
- package/dist/lib/evaluation/scorers/rule/keywordCoverageScorer.js +0 -348
- package/dist/lib/evaluation/scorers/rule/lengthScorer.d.ts +0 -74
- package/dist/lib/evaluation/scorers/rule/lengthScorer.js +0 -352
- package/dist/lib/evaluation/scorers/scorerBuilder.d.ts +0 -160
- package/dist/lib/evaluation/scorers/scorerBuilder.js +0 -421
- package/dist/lib/evaluation/scorers/scorerRegistry.d.ts +0 -65
- package/dist/lib/evaluation/scorers/scorerRegistry.js +0 -540
- package/dist/lib/evaluation/scoring.d.ts +0 -15
- package/dist/lib/evaluation/scoring.js +0 -61
- package/dist/lib/factories/providerDescriptors.d.ts +0 -18
- package/dist/lib/factories/providerDescriptors.js +0 -547
- package/dist/lib/factories/providerFactory.d.ts +0 -87
- package/dist/lib/factories/providerFactory.js +0 -199
- package/dist/lib/factories/providerRegistry.d.ts +0 -58
- package/dist/lib/factories/providerRegistry.js +0 -549
- package/dist/lib/features/ppt/constants.d.ts +0 -121
- package/dist/lib/features/ppt/constants.js +0 -897
- package/dist/lib/features/ppt/contentPlanner.d.ts +0 -47
- package/dist/lib/features/ppt/contentPlanner.js +0 -558
- package/dist/lib/features/ppt/index.d.ts +0 -11
- package/dist/lib/features/ppt/index.js +0 -33
- package/dist/lib/features/ppt/pptError.d.ts +0 -38
- package/dist/lib/features/ppt/pptError.js +0 -54
- package/dist/lib/features/ppt/presentationOrchestrator.d.ts +0 -37
- package/dist/lib/features/ppt/presentationOrchestrator.js +0 -231
- package/dist/lib/features/ppt/slideGenerator.d.ts +0 -56
- package/dist/lib/features/ppt/slideGenerator.js +0 -542
- package/dist/lib/features/ppt/slideRenderers.d.ts +0 -347
- package/dist/lib/features/ppt/slideRenderers.js +0 -2384
- package/dist/lib/features/ppt/slideTypeInference.d.ts +0 -91
- package/dist/lib/features/ppt/slideTypeInference.js +0 -406
- package/dist/lib/features/ppt/utils.d.ts +0 -103
- package/dist/lib/features/ppt/utils.js +0 -446
- package/dist/lib/files/fileReferenceRegistry.d.ts +0 -275
- package/dist/lib/files/fileReferenceRegistry.js +0 -1559
- package/dist/lib/files/fileTools.d.ts +0 -176
- package/dist/lib/files/fileTools.js +0 -435
- package/dist/lib/files/index.d.ts +0 -13
- package/dist/lib/files/index.js +0 -14
- package/dist/lib/files/streamingReader.d.ts +0 -93
- package/dist/lib/files/streamingReader.js +0 -322
- package/dist/lib/hitl/hitlErrors.d.ts +0 -38
- package/dist/lib/hitl/hitlErrors.js +0 -55
- package/dist/lib/hitl/hitlManager.d.ts +0 -100
- package/dist/lib/hitl/hitlManager.js +0 -461
- package/dist/lib/hitl/index.d.ts +0 -7
- package/dist/lib/hitl/index.js +0 -10
- package/dist/lib/image-gen/ImageGenService.d.ts +0 -146
- package/dist/lib/image-gen/ImageGenService.js +0 -349
- package/dist/lib/image-gen/imageGenTools.d.ts +0 -109
- package/dist/lib/image-gen/imageGenTools.js +0 -305
- package/dist/lib/image-gen/index.d.ts +0 -45
- package/dist/lib/image-gen/index.js +0 -49
- package/dist/lib/index.d.ts +0 -447
- package/dist/lib/index.js +0 -748
- package/dist/lib/knowledge/context.d.ts +0 -18
- package/dist/lib/knowledge/context.js +0 -92
- package/dist/lib/knowledge/defaults.d.ts +0 -24
- package/dist/lib/knowledge/defaults.js +0 -30
- package/dist/lib/knowledge/engine.d.ts +0 -35
- package/dist/lib/knowledge/engine.js +0 -180
- package/dist/lib/knowledge/index.d.ts +0 -15
- package/dist/lib/knowledge/index.js +0 -16
- package/dist/lib/knowledge/indexCache.d.ts +0 -19
- package/dist/lib/knowledge/indexCache.js +0 -110
- package/dist/lib/knowledge/knowledgeIndex.d.ts +0 -41
- package/dist/lib/knowledge/knowledgeIndex.js +0 -205
- package/dist/lib/knowledge/normalize.d.ts +0 -32
- package/dist/lib/knowledge/normalize.js +0 -75
- package/dist/lib/knowledge/resolve.d.ts +0 -18
- package/dist/lib/knowledge/resolve.js +0 -157
- package/dist/lib/knowledge/retrieval.d.ts +0 -16
- package/dist/lib/knowledge/retrieval.js +0 -222
- package/dist/lib/mcp/agentExposure.d.ts +0 -83
- package/dist/lib/mcp/agentExposure.js +0 -357
- package/dist/lib/mcp/auth/index.d.ts +0 -6
- package/dist/lib/mcp/auth/index.js +0 -12
- package/dist/lib/mcp/auth/oauthClientProvider.d.ts +0 -93
- package/dist/lib/mcp/auth/oauthClientProvider.js +0 -331
- package/dist/lib/mcp/auth/tokenStorage.d.ts +0 -56
- package/dist/lib/mcp/auth/tokenStorage.js +0 -135
- package/dist/lib/mcp/batching/index.d.ts +0 -1
- package/dist/lib/mcp/batching/index.js +0 -2
- package/dist/lib/mcp/batching/requestBatcher.d.ts +0 -130
- package/dist/lib/mcp/batching/requestBatcher.js +0 -468
- package/dist/lib/mcp/caching/index.d.ts +0 -1
- package/dist/lib/mcp/caching/index.js +0 -2
- package/dist/lib/mcp/caching/toolCache.d.ts +0 -154
- package/dist/lib/mcp/caching/toolCache.js +0 -434
- package/dist/lib/mcp/elicitation/elicitationManager.d.ts +0 -169
- package/dist/lib/mcp/elicitation/elicitationManager.js +0 -377
- package/dist/lib/mcp/elicitation/index.d.ts +0 -1
- package/dist/lib/mcp/elicitation/index.js +0 -3
- package/dist/lib/mcp/elicitationProtocol.d.ts +0 -139
- package/dist/lib/mcp/elicitationProtocol.js +0 -376
- package/dist/lib/mcp/enhancedToolDiscovery.d.ts +0 -125
- package/dist/lib/mcp/enhancedToolDiscovery.js +0 -482
- package/dist/lib/mcp/externalServerManager.d.ts +0 -189
- package/dist/lib/mcp/externalServerManager.js +0 -1525
- package/dist/lib/mcp/factory.d.ts +0 -60
- package/dist/lib/mcp/factory.js +0 -162
- package/dist/lib/mcp/flexibleToolValidator.d.ts +0 -46
- package/dist/lib/mcp/flexibleToolValidator.js +0 -162
- package/dist/lib/mcp/httpRateLimiter.d.ts +0 -152
- package/dist/lib/mcp/httpRateLimiter.js +0 -386
- package/dist/lib/mcp/httpRetryHandler.d.ts +0 -62
- package/dist/lib/mcp/httpRetryHandler.js +0 -180
- package/dist/lib/mcp/index.d.ts +0 -60
- package/dist/lib/mcp/index.js +0 -82
- package/dist/lib/mcp/mcpCircuitBreaker.d.ts +0 -123
- package/dist/lib/mcp/mcpCircuitBreaker.js +0 -428
- package/dist/lib/mcp/mcpClientFactory.d.ts +0 -109
- package/dist/lib/mcp/mcpClientFactory.js +0 -714
- package/dist/lib/mcp/mcpOutputNormalizer.d.ts +0 -47
- package/dist/lib/mcp/mcpOutputNormalizer.js +0 -183
- package/dist/lib/mcp/mcpRegistryClient.d.ts +0 -129
- package/dist/lib/mcp/mcpRegistryClient.js +0 -489
- package/dist/lib/mcp/mcpServerBase.d.ts +0 -162
- package/dist/lib/mcp/mcpServerBase.js +0 -377
- package/dist/lib/mcp/multiServerManager.d.ts +0 -182
- package/dist/lib/mcp/multiServerManager.js +0 -580
- package/dist/lib/mcp/registry.d.ts +0 -94
- package/dist/lib/mcp/registry.js +0 -159
- package/dist/lib/mcp/routing/index.d.ts +0 -1
- package/dist/lib/mcp/routing/index.js +0 -2
- package/dist/lib/mcp/routing/toolRouter.d.ts +0 -110
- package/dist/lib/mcp/routing/toolRouter.js +0 -417
- package/dist/lib/mcp/serverCapabilities.d.ts +0 -175
- package/dist/lib/mcp/serverCapabilities.js +0 -503
- package/dist/lib/mcp/servers/agent/directToolsServer.d.ts +0 -8
- package/dist/lib/mcp/servers/agent/directToolsServer.js +0 -152
- package/dist/lib/mcp/servers/aiProviders/aiAnalysisTools.d.ts +0 -6
- package/dist/lib/mcp/servers/aiProviders/aiAnalysisTools.js +0 -364
- package/dist/lib/mcp/servers/aiProviders/aiCoreServer.d.ts +0 -10
- package/dist/lib/mcp/servers/aiProviders/aiCoreServer.js +0 -232
- package/dist/lib/mcp/servers/aiProviders/aiWorkflowTools.d.ts +0 -5
- package/dist/lib/mcp/servers/aiProviders/aiWorkflowTools.js +0 -584
- package/dist/lib/mcp/servers/utilities/utilityServer.d.ts +0 -8
- package/dist/lib/mcp/servers/utilities/utilityServer.js +0 -327
- package/dist/lib/mcp/toolAnnotations.d.ts +0 -57
- package/dist/lib/mcp/toolAnnotations.js +0 -240
- package/dist/lib/mcp/toolConverter.d.ts +0 -87
- package/dist/lib/mcp/toolConverter.js +0 -259
- package/dist/lib/mcp/toolDiscoveryService.d.ts +0 -144
- package/dist/lib/mcp/toolDiscoveryService.js +0 -978
- package/dist/lib/mcp/toolIntegration.d.ts +0 -92
- package/dist/lib/mcp/toolIntegration.js +0 -335
- package/dist/lib/mcp/toolRegistry.d.ts +0 -151
- package/dist/lib/mcp/toolRegistry.js +0 -755
- package/dist/lib/memory/hippocampusInitializer.d.ts +0 -2
- package/dist/lib/memory/hippocampusInitializer.js +0 -50
- package/dist/lib/memory/memoryRetrievalTools.d.ts +0 -13
- package/dist/lib/memory/memoryRetrievalTools.js +0 -267
- package/dist/lib/middleware/builtin/analytics.d.ts +0 -16
- package/dist/lib/middleware/builtin/analytics.js +0 -133
- package/dist/lib/middleware/builtin/autoEvaluation.d.ts +0 -11
- package/dist/lib/middleware/builtin/autoEvaluation.js +0 -201
- package/dist/lib/middleware/builtin/guardrails.d.ts +0 -7
- package/dist/lib/middleware/builtin/guardrails.js +0 -110
- package/dist/lib/middleware/builtin/lifecycle.d.ts +0 -2
- package/dist/lib/middleware/builtin/lifecycle.js +0 -161
- package/dist/lib/middleware/factory.d.ts +0 -69
- package/dist/lib/middleware/factory.js +0 -328
- package/dist/lib/middleware/index.d.ts +0 -11
- package/dist/lib/middleware/index.js +0 -17
- package/dist/lib/middleware/registry.d.ts +0 -76
- package/dist/lib/middleware/registry.js +0 -296
- package/dist/lib/middleware/utils/guardrailsUtils.d.ts +0 -50
- package/dist/lib/middleware/utils/guardrailsUtils.js +0 -397
- package/dist/lib/models/anthropicModels.d.ts +0 -261
- package/dist/lib/models/anthropicModels.js +0 -556
- package/dist/lib/models/manifestRegistry.d.ts +0 -33
- package/dist/lib/models/manifestRegistry.js +0 -174
- package/dist/lib/models/manifests/anthropic.d.ts +0 -9
- package/dist/lib/models/manifests/anthropic.js +0 -346
- package/dist/lib/models/manifests/azure.d.ts +0 -2
- package/dist/lib/models/manifests/azure.js +0 -87
- package/dist/lib/models/manifests/bedrock.d.ts +0 -2
- package/dist/lib/models/manifests/bedrock.js +0 -75
- package/dist/lib/models/manifests/cloudflare.d.ts +0 -8
- package/dist/lib/models/manifests/cloudflare.js +0 -19
- package/dist/lib/models/manifests/cohere.d.ts +0 -8
- package/dist/lib/models/manifests/cohere.js +0 -19
- package/dist/lib/models/manifests/deepseek.d.ts +0 -8
- package/dist/lib/models/manifests/deepseek.js +0 -19
- package/dist/lib/models/manifests/fireworks.d.ts +0 -8
- package/dist/lib/models/manifests/fireworks.js +0 -19
- package/dist/lib/models/manifests/google-ai.d.ts +0 -2
- package/dist/lib/models/manifests/google-ai.js +0 -28
- package/dist/lib/models/manifests/groq.d.ts +0 -8
- package/dist/lib/models/manifests/groq.js +0 -19
- package/dist/lib/models/manifests/huggingface.d.ts +0 -8
- package/dist/lib/models/manifests/huggingface.js +0 -19
- package/dist/lib/models/manifests/ideogram.d.ts +0 -8
- package/dist/lib/models/manifests/ideogram.js +0 -19
- package/dist/lib/models/manifests/jina.d.ts +0 -8
- package/dist/lib/models/manifests/jina.js +0 -19
- package/dist/lib/models/manifests/litellm.d.ts +0 -8
- package/dist/lib/models/manifests/litellm.js +0 -19
- package/dist/lib/models/manifests/llamacpp.d.ts +0 -8
- package/dist/lib/models/manifests/llamacpp.js +0 -19
- package/dist/lib/models/manifests/lm-studio.d.ts +0 -8
- package/dist/lib/models/manifests/lm-studio.js +0 -19
- package/dist/lib/models/manifests/mistral.d.ts +0 -2
- package/dist/lib/models/manifests/mistral.js +0 -50
- package/dist/lib/models/manifests/nvidia-nim.d.ts +0 -8
- package/dist/lib/models/manifests/nvidia-nim.js +0 -19
- package/dist/lib/models/manifests/ollama.d.ts +0 -2
- package/dist/lib/models/manifests/ollama.js +0 -72
- package/dist/lib/models/manifests/openai-compatible.d.ts +0 -8
- package/dist/lib/models/manifests/openai-compatible.js +0 -19
- package/dist/lib/models/manifests/openai.d.ts +0 -11
- package/dist/lib/models/manifests/openai.js +0 -560
- package/dist/lib/models/manifests/openrouter.d.ts +0 -8
- package/dist/lib/models/manifests/openrouter.js +0 -19
- package/dist/lib/models/manifests/perplexity.d.ts +0 -8
- package/dist/lib/models/manifests/perplexity.js +0 -19
- package/dist/lib/models/manifests/recraft.d.ts +0 -8
- package/dist/lib/models/manifests/recraft.js +0 -19
- package/dist/lib/models/manifests/replicate.d.ts +0 -8
- package/dist/lib/models/manifests/replicate.js +0 -19
- package/dist/lib/models/manifests/sagemaker.d.ts +0 -8
- package/dist/lib/models/manifests/sagemaker.js +0 -19
- package/dist/lib/models/manifests/stability.d.ts +0 -8
- package/dist/lib/models/manifests/stability.js +0 -19
- package/dist/lib/models/manifests/together-ai.d.ts +0 -8
- package/dist/lib/models/manifests/together-ai.js +0 -19
- package/dist/lib/models/manifests/vertex.d.ts +0 -8
- package/dist/lib/models/manifests/vertex.js +0 -19
- package/dist/lib/models/manifests/voyage.d.ts +0 -8
- package/dist/lib/models/manifests/voyage.js +0 -19
- package/dist/lib/models/manifests/xai.d.ts +0 -8
- package/dist/lib/models/manifests/xai.js +0 -19
- package/dist/lib/models/modelRegistry.d.ts +0 -74
- package/dist/lib/models/modelRegistry.js +0 -2695
- package/dist/lib/models/modelResolver.d.ts +0 -74
- package/dist/lib/models/modelResolver.js +0 -470
- package/dist/lib/music/index.d.ts +0 -27
- package/dist/lib/music/index.js +0 -94
- package/dist/lib/music/providers/BeatovenMusic.d.ts +0 -31
- package/dist/lib/music/providers/BeatovenMusic.js +0 -334
- package/dist/lib/music/providers/ElevenLabsMusic.d.ts +0 -30
- package/dist/lib/music/providers/ElevenLabsMusic.js +0 -169
- package/dist/lib/music/providers/LyriaMusic.d.ts +0 -29
- package/dist/lib/music/providers/LyriaMusic.js +0 -173
- package/dist/lib/music/providers/ReplicateMusic.d.ts +0 -31
- package/dist/lib/music/providers/ReplicateMusic.js +0 -262
- package/dist/lib/neurolink.d.ts +0 -2662
- package/dist/lib/neurolink.js +0 -12946
- package/dist/lib/observability/exporterRegistry.d.ts +0 -133
- package/dist/lib/observability/exporterRegistry.js +0 -414
- package/dist/lib/observability/exporters/arizeExporter.d.ts +0 -32
- package/dist/lib/observability/exporters/arizeExporter.js +0 -139
- package/dist/lib/observability/exporters/baseExporter.d.ts +0 -117
- package/dist/lib/observability/exporters/baseExporter.js +0 -191
- package/dist/lib/observability/exporters/braintrustExporter.d.ts +0 -30
- package/dist/lib/observability/exporters/braintrustExporter.js +0 -155
- package/dist/lib/observability/exporters/datadogExporter.d.ts +0 -37
- package/dist/lib/observability/exporters/datadogExporter.js +0 -197
- package/dist/lib/observability/exporters/index.d.ts +0 -13
- package/dist/lib/observability/exporters/index.js +0 -14
- package/dist/lib/observability/exporters/laminarExporter.d.ts +0 -48
- package/dist/lib/observability/exporters/laminarExporter.js +0 -304
- package/dist/lib/observability/exporters/langfuseExporter.d.ts +0 -48
- package/dist/lib/observability/exporters/langfuseExporter.js +0 -210
- package/dist/lib/observability/exporters/langsmithExporter.d.ts +0 -26
- package/dist/lib/observability/exporters/langsmithExporter.js +0 -144
- package/dist/lib/observability/exporters/otelExporter.d.ts +0 -39
- package/dist/lib/observability/exporters/otelExporter.js +0 -165
- package/dist/lib/observability/exporters/posthogExporter.d.ts +0 -48
- package/dist/lib/observability/exporters/posthogExporter.js +0 -289
- package/dist/lib/observability/exporters/sentryExporter.d.ts +0 -32
- package/dist/lib/observability/exporters/sentryExporter.js +0 -167
- package/dist/lib/observability/index.d.ts +0 -23
- package/dist/lib/observability/index.js +0 -32
- package/dist/lib/observability/metricsAggregator.d.ts +0 -126
- package/dist/lib/observability/metricsAggregator.js +0 -553
- package/dist/lib/observability/otelBridge.d.ts +0 -49
- package/dist/lib/observability/otelBridge.js +0 -141
- package/dist/lib/observability/retryPolicy.d.ts +0 -154
- package/dist/lib/observability/retryPolicy.js +0 -384
- package/dist/lib/observability/sampling/index.d.ts +0 -4
- package/dist/lib/observability/sampling/index.js +0 -5
- package/dist/lib/observability/sampling/samplers.d.ts +0 -104
- package/dist/lib/observability/sampling/samplers.js +0 -217
- package/dist/lib/observability/spanProcessor.d.ts +0 -115
- package/dist/lib/observability/spanProcessor.js +0 -304
- package/dist/lib/observability/tokenTracker.d.ts +0 -109
- package/dist/lib/observability/tokenTracker.js +0 -416
- package/dist/lib/observability/utils/index.d.ts +0 -4
- package/dist/lib/observability/utils/index.js +0 -5
- package/dist/lib/observability/utils/safeMetadata.d.ts +0 -10
- package/dist/lib/observability/utils/safeMetadata.js +0 -26
- package/dist/lib/observability/utils/spanSerializer.d.ts +0 -119
- package/dist/lib/observability/utils/spanSerializer.js +0 -314
- package/dist/lib/processors/archive/ArchiveProcessor.d.ts +0 -323
- package/dist/lib/processors/archive/ArchiveProcessor.js +0 -1662
- package/dist/lib/processors/archive/index.d.ts +0 -33
- package/dist/lib/processors/archive/index.js +0 -44
- package/dist/lib/processors/archive/zipEntryReader.d.ts +0 -51
- package/dist/lib/processors/archive/zipEntryReader.js +0 -81
- package/dist/lib/processors/base/BaseFileProcessor.d.ts +0 -309
- package/dist/lib/processors/base/BaseFileProcessor.js +0 -769
- package/dist/lib/processors/base/index.d.ts +0 -13
- package/dist/lib/processors/base/index.js +0 -23
- package/dist/lib/processors/cli/fileProcessorCli.d.ts +0 -124
- package/dist/lib/processors/cli/fileProcessorCli.js +0 -392
- package/dist/lib/processors/cli/index.d.ts +0 -36
- package/dist/lib/processors/cli/index.js +0 -53
- package/dist/lib/processors/code/ConfigProcessor.d.ts +0 -169
- package/dist/lib/processors/code/ConfigProcessor.js +0 -405
- package/dist/lib/processors/code/SourceCodeProcessor.d.ts +0 -172
- package/dist/lib/processors/code/SourceCodeProcessor.js +0 -309
- package/dist/lib/processors/code/index.d.ts +0 -44
- package/dist/lib/processors/code/index.js +0 -65
- package/dist/lib/processors/config/fileExtensions.d.ts +0 -280
- package/dist/lib/processors/config/fileExtensions.js +0 -485
- package/dist/lib/processors/config/fileTypeRegistry.d.ts +0 -106
- package/dist/lib/processors/config/fileTypeRegistry.js +0 -702
- package/dist/lib/processors/config/index.d.ts +0 -33
- package/dist/lib/processors/config/index.js +0 -104
- package/dist/lib/processors/config/languageMap.d.ts +0 -62
- package/dist/lib/processors/config/languageMap.js +0 -414
- package/dist/lib/processors/config/mimeConstants.d.ts +0 -373
- package/dist/lib/processors/config/mimeConstants.js +0 -348
- package/dist/lib/processors/config/sizeLimits.d.ts +0 -198
- package/dist/lib/processors/config/sizeLimits.js +0 -262
- package/dist/lib/processors/data/JsonProcessor.d.ts +0 -120
- package/dist/lib/processors/data/JsonProcessor.js +0 -206
- package/dist/lib/processors/data/XmlProcessor.d.ts +0 -158
- package/dist/lib/processors/data/XmlProcessor.js +0 -288
- package/dist/lib/processors/data/YamlProcessor.d.ts +0 -161
- package/dist/lib/processors/data/YamlProcessor.js +0 -297
- package/dist/lib/processors/data/index.d.ts +0 -49
- package/dist/lib/processors/data/index.js +0 -83
- package/dist/lib/processors/document/ExcelProcessor.d.ts +0 -250
- package/dist/lib/processors/document/ExcelProcessor.js +0 -615
- package/dist/lib/processors/document/OpenDocumentProcessor.d.ts +0 -67
- package/dist/lib/processors/document/OpenDocumentProcessor.js +0 -236
- package/dist/lib/processors/document/PptxProcessor.d.ts +0 -77
- package/dist/lib/processors/document/PptxProcessor.js +0 -262
- package/dist/lib/processors/document/RtfProcessor.d.ts +0 -150
- package/dist/lib/processors/document/RtfProcessor.js +0 -364
- package/dist/lib/processors/document/WordProcessor.d.ts +0 -166
- package/dist/lib/processors/document/WordProcessor.js +0 -365
- package/dist/lib/processors/document/index.d.ts +0 -55
- package/dist/lib/processors/document/index.js +0 -100
- package/dist/lib/processors/errors/FileErrorCode.d.ts +0 -86
- package/dist/lib/processors/errors/FileErrorCode.js +0 -256
- package/dist/lib/processors/errors/errorHelpers.d.ts +0 -121
- package/dist/lib/processors/errors/errorHelpers.js +0 -387
- package/dist/lib/processors/errors/errorSerializer.d.ts +0 -96
- package/dist/lib/processors/errors/errorSerializer.js +0 -508
- package/dist/lib/processors/errors/index.d.ts +0 -46
- package/dist/lib/processors/errors/index.js +0 -50
- package/dist/lib/processors/index.d.ts +0 -79
- package/dist/lib/processors/index.js +0 -133
- package/dist/lib/processors/integration/FileProcessorIntegration.d.ts +0 -176
- package/dist/lib/processors/integration/FileProcessorIntegration.js +0 -279
- package/dist/lib/processors/integration/index.d.ts +0 -41
- package/dist/lib/processors/integration/index.js +0 -48
- package/dist/lib/processors/markup/HtmlProcessor.d.ts +0 -167
- package/dist/lib/processors/markup/HtmlProcessor.js +0 -252
- package/dist/lib/processors/markup/MarkdownProcessor.d.ts +0 -163
- package/dist/lib/processors/markup/MarkdownProcessor.js +0 -249
- package/dist/lib/processors/markup/SvgProcessor.d.ts +0 -154
- package/dist/lib/processors/markup/SvgProcessor.js +0 -245
- package/dist/lib/processors/markup/TextProcessor.d.ts +0 -133
- package/dist/lib/processors/markup/TextProcessor.js +0 -191
- package/dist/lib/processors/markup/index.d.ts +0 -66
- package/dist/lib/processors/markup/index.js +0 -111
- package/dist/lib/processors/media/AudioProcessor.d.ts +0 -266
- package/dist/lib/processors/media/AudioProcessor.js +0 -712
- package/dist/lib/processors/media/VideoProcessor.d.ts +0 -337
- package/dist/lib/processors/media/VideoProcessor.js +0 -1154
- package/dist/lib/processors/media/index.d.ts +0 -26
- package/dist/lib/processors/media/index.js +0 -30
- package/dist/lib/processors/registry/ProcessorRegistry.d.ts +0 -347
- package/dist/lib/processors/registry/ProcessorRegistry.js +0 -715
- package/dist/lib/processors/registry/index.d.ts +0 -2
- package/dist/lib/processors/registry/index.js +0 -10
- package/dist/lib/providers/amazonBedrock/client.d.ts +0 -93
- package/dist/lib/providers/amazonBedrock/client.js +0 -1178
- package/dist/lib/providers/amazonBedrock/constants.d.ts +0 -1
- package/dist/lib/providers/amazonBedrock/constants.js +0 -3
- package/dist/lib/providers/amazonBedrock/index.d.ts +0 -3
- package/dist/lib/providers/amazonBedrock/index.js +0 -4
- package/dist/lib/providers/amazonBedrock/inferenceProfile.d.ts +0 -72
- package/dist/lib/providers/amazonBedrock/inferenceProfile.js +0 -186
- package/dist/lib/providers/amazonBedrock/loopAdapter.d.ts +0 -36
- package/dist/lib/providers/amazonBedrock/loopAdapter.js +0 -278
- package/dist/lib/providers/amazonBedrock/utils.d.ts +0 -1
- package/dist/lib/providers/amazonBedrock/utils.js +0 -4
- package/dist/lib/providers/amazonSagemaker.d.ts +0 -108
- package/dist/lib/providers/amazonSagemaker.js +0 -292
- package/dist/lib/providers/anthropic/cacheControl.d.ts +0 -12
- package/dist/lib/providers/anthropic/cacheControl.js +0 -15
- package/dist/lib/providers/anthropic/client.d.ts +0 -149
- package/dist/lib/providers/anthropic/client.js +0 -1862
- package/dist/lib/providers/anthropic/constants.d.ts +0 -3
- package/dist/lib/providers/anthropic/constants.js +0 -7
- package/dist/lib/providers/anthropic/index.d.ts +0 -2
- package/dist/lib/providers/anthropic/index.js +0 -3
- package/dist/lib/providers/anthropic/loopAdapter.d.ts +0 -26
- package/dist/lib/providers/anthropic/loopAdapter.js +0 -326
- package/dist/lib/providers/anthropic/rateLimitCapture.d.ts +0 -82
- package/dist/lib/providers/anthropic/rateLimitCapture.js +0 -375
- package/dist/lib/providers/anthropic/structuredOutput.d.ts +0 -58
- package/dist/lib/providers/anthropic/structuredOutput.js +0 -98
- package/dist/lib/providers/anthropic/toolOutput.d.ts +0 -9
- package/dist/lib/providers/anthropic/toolOutput.js +0 -39
- package/dist/lib/providers/anthropicImageBlocks.d.ts +0 -47
- package/dist/lib/providers/anthropicImageBlocks.js +0 -223
- package/dist/lib/providers/azureOpenai.d.ts +0 -67
- package/dist/lib/providers/azureOpenai.js +0 -230
- package/dist/lib/providers/cohere.d.ts +0 -54
- package/dist/lib/providers/cohere.js +0 -183
- package/dist/lib/providers/configuredOpenAICompat.d.ts +0 -24
- package/dist/lib/providers/configuredOpenAICompat.js +0 -67
- package/dist/lib/providers/deepseek.d.ts +0 -47
- package/dist/lib/providers/deepseek.js +0 -121
- package/dist/lib/providers/googleAiStudio/client.d.ts +0 -92
- package/dist/lib/providers/googleAiStudio/client.js +0 -1661
- package/dist/lib/providers/googleAiStudio/index.d.ts +0 -1
- package/dist/lib/providers/googleAiStudio/index.js +0 -2
- package/dist/lib/providers/googleNativeGemini3/index.d.ts +0 -1
- package/dist/lib/providers/googleNativeGemini3/index.js +0 -2
- package/dist/lib/providers/googleNativeGemini3/utils.d.ts +0 -482
- package/dist/lib/providers/googleNativeGemini3/utils.js +0 -1527
- package/dist/lib/providers/googleVertex/client.d.ts +0 -415
- package/dist/lib/providers/googleVertex/client.js +0 -7018
- package/dist/lib/providers/googleVertex/constants.d.ts +0 -5
- package/dist/lib/providers/googleVertex/constants.js +0 -27
- package/dist/lib/providers/googleVertex/index.d.ts +0 -3
- package/dist/lib/providers/googleVertex/index.js +0 -4
- package/dist/lib/providers/googleVertex/utils.d.ts +0 -12
- package/dist/lib/providers/googleVertex/utils.js +0 -287
- package/dist/lib/providers/huggingFace/client.d.ts +0 -31
- package/dist/lib/providers/huggingFace/client.js +0 -103
- package/dist/lib/providers/huggingFace/index.d.ts +0 -1
- package/dist/lib/providers/huggingFace/index.js +0 -2
- package/dist/lib/providers/ideogram.d.ts +0 -34
- package/dist/lib/providers/ideogram.js +0 -184
- package/dist/lib/providers/jina.d.ts +0 -58
- package/dist/lib/providers/jina.js +0 -217
- package/dist/lib/providers/litellm/client.d.ts +0 -84
- package/dist/lib/providers/litellm/client.js +0 -504
- package/dist/lib/providers/litellm/index.d.ts +0 -1
- package/dist/lib/providers/litellm/index.js +0 -2
- package/dist/lib/providers/llamaCpp.d.ts +0 -24
- package/dist/lib/providers/llamaCpp.js +0 -80
- package/dist/lib/providers/lmStudio.d.ts +0 -29
- package/dist/lib/providers/lmStudio.js +0 -88
- package/dist/lib/providers/nvidiaNim/client.d.ts +0 -60
- package/dist/lib/providers/nvidiaNim/client.js +0 -291
- package/dist/lib/providers/nvidiaNim/constants.d.ts +0 -1
- package/dist/lib/providers/nvidiaNim/constants.js +0 -2
- package/dist/lib/providers/nvidiaNim/index.d.ts +0 -2
- package/dist/lib/providers/nvidiaNim/index.js +0 -3
- package/dist/lib/providers/ollama/client.d.ts +0 -71
- package/dist/lib/providers/ollama/client.js +0 -283
- package/dist/lib/providers/ollama/constants.d.ts +0 -4
- package/dist/lib/providers/ollama/constants.js +0 -6
- package/dist/lib/providers/ollama/index.d.ts +0 -2
- package/dist/lib/providers/ollama/index.js +0 -3
- package/dist/lib/providers/openAI/client.d.ts +0 -76
- package/dist/lib/providers/openAI/client.js +0 -503
- package/dist/lib/providers/openAI/index.d.ts +0 -1
- package/dist/lib/providers/openAI/index.js +0 -2
- package/dist/lib/providers/openRouter/client.d.ts +0 -75
- package/dist/lib/providers/openRouter/client.js +0 -402
- package/dist/lib/providers/openRouter/constants.d.ts +0 -1
- package/dist/lib/providers/openRouter/constants.js +0 -2
- package/dist/lib/providers/openRouter/index.d.ts +0 -3
- package/dist/lib/providers/openRouter/index.js +0 -4
- package/dist/lib/providers/openRouter/utils.d.ts +0 -1
- package/dist/lib/providers/openRouter/utils.js +0 -6
- package/dist/lib/providers/openaiChatCompletionsBase.d.ts +0 -212
- package/dist/lib/providers/openaiChatCompletionsBase.js +0 -1154
- package/dist/lib/providers/openaiChatCompletionsClient.d.ts +0 -70
- package/dist/lib/providers/openaiChatCompletionsClient.js +0 -684
- package/dist/lib/providers/openaiCompatCatalog.d.ts +0 -24
- package/dist/lib/providers/openaiCompatCatalog.js +0 -270
- package/dist/lib/providers/openaiCompatible/client.d.ts +0 -21
- package/dist/lib/providers/openaiCompatible/client.js +0 -91
- package/dist/lib/providers/openaiCompatible/constants.d.ts +0 -1
- package/dist/lib/providers/openaiCompatible/constants.js +0 -2
- package/dist/lib/providers/openaiCompatible/index.d.ts +0 -3
- package/dist/lib/providers/openaiCompatible/index.js +0 -4
- package/dist/lib/providers/openaiCompatible/utils.d.ts +0 -5
- package/dist/lib/providers/openaiCompatible/utils.js +0 -17
- package/dist/lib/providers/providerTypeUtils.d.ts +0 -23
- package/dist/lib/providers/providerTypeUtils.js +0 -41
- package/dist/lib/providers/recraft.d.ts +0 -34
- package/dist/lib/providers/recraft.js +0 -197
- package/dist/lib/providers/replicate.d.ts +0 -74
- package/dist/lib/providers/replicate.js +0 -416
- package/dist/lib/providers/sagemaker/adaptive-semaphore.d.ts +0 -74
- package/dist/lib/providers/sagemaker/adaptive-semaphore.js +0 -216
- package/dist/lib/providers/sagemaker/client.d.ts +0 -161
- package/dist/lib/providers/sagemaker/client.js +0 -509
- package/dist/lib/providers/sagemaker/config.d.ts +0 -87
- package/dist/lib/providers/sagemaker/config.js +0 -355
- package/dist/lib/providers/sagemaker/detection.d.ts +0 -121
- package/dist/lib/providers/sagemaker/detection.js +0 -607
- package/dist/lib/providers/sagemaker/diagnostics.d.ts +0 -14
- package/dist/lib/providers/sagemaker/diagnostics.js +0 -138
- package/dist/lib/providers/sagemaker/error-constants.d.ts +0 -78
- package/dist/lib/providers/sagemaker/error-constants.js +0 -228
- package/dist/lib/providers/sagemaker/errors.d.ts +0 -90
- package/dist/lib/providers/sagemaker/errors.js +0 -301
- package/dist/lib/providers/sagemaker/index.d.ts +0 -34
- package/dist/lib/providers/sagemaker/index.js +0 -69
- package/dist/lib/providers/sagemaker/language-model.d.ts +0 -207
- package/dist/lib/providers/sagemaker/language-model.js +0 -805
- package/dist/lib/providers/sagemaker/parsers.d.ts +0 -111
- package/dist/lib/providers/sagemaker/parsers.js +0 -644
- package/dist/lib/providers/sagemaker/streaming.d.ts +0 -48
- package/dist/lib/providers/sagemaker/streaming.js +0 -390
- package/dist/lib/providers/sagemaker/structured-parser.d.ts +0 -117
- package/dist/lib/providers/sagemaker/structured-parser.js +0 -626
- package/dist/lib/providers/stability.d.ts +0 -37
- package/dist/lib/providers/stability.js +0 -191
- package/dist/lib/providers/voyage.d.ts +0 -46
- package/dist/lib/providers/voyage.js +0 -176
- package/dist/lib/proxy/accountCooldown.d.ts +0 -5
- package/dist/lib/proxy/accountCooldown.js +0 -121
- package/dist/lib/proxy/accountQuota.d.ts +0 -84
- package/dist/lib/proxy/accountQuota.js +0 -459
- package/dist/lib/proxy/accountQuotaRefreshCoordinator.d.ts +0 -19
- package/dist/lib/proxy/accountQuotaRefreshCoordinator.js +0 -105
- package/dist/lib/proxy/accountSelection.d.ts +0 -8
- package/dist/lib/proxy/accountSelection.js +0 -26
- package/dist/lib/proxy/accountUsage.d.ts +0 -45
- package/dist/lib/proxy/accountUsage.js +0 -302
- package/dist/lib/proxy/awsProxyIntegration.d.ts +0 -23
- package/dist/lib/proxy/awsProxyIntegration.js +0 -286
- package/dist/lib/proxy/claudeFormat.d.ts +0 -129
- package/dist/lib/proxy/claudeFormat.js +0 -600
- package/dist/lib/proxy/cloaking/index.d.ts +0 -43
- package/dist/lib/proxy/cloaking/index.js +0 -88
- package/dist/lib/proxy/cloaking/plugins/headerScrubber.d.ts +0 -9
- package/dist/lib/proxy/cloaking/plugins/headerScrubber.js +0 -87
- package/dist/lib/proxy/cloaking/plugins/sessionIdentity.d.ts +0 -11
- package/dist/lib/proxy/cloaking/plugins/sessionIdentity.js +0 -42
- package/dist/lib/proxy/cloaking/plugins/systemPromptInjector.d.ts +0 -11
- package/dist/lib/proxy/cloaking/plugins/systemPromptInjector.js +0 -84
- package/dist/lib/proxy/cloaking/plugins/tlsFingerprint.d.ts +0 -14
- package/dist/lib/proxy/cloaking/plugins/tlsFingerprint.js +0 -39
- package/dist/lib/proxy/cloaking/plugins/wordObfuscator.d.ts +0 -9
- package/dist/lib/proxy/cloaking/plugins/wordObfuscator.js +0 -122
- package/dist/lib/proxy/codexAccountUsage.d.ts +0 -26
- package/dist/lib/proxy/codexAccountUsage.js +0 -174
- package/dist/lib/proxy/codexUsage.d.ts +0 -68
- package/dist/lib/proxy/codexUsage.js +0 -247
- package/dist/lib/proxy/globalInstaller.d.ts +0 -19
- package/dist/lib/proxy/globalInstaller.js +0 -242
- package/dist/lib/proxy/logCleanupScheduler.d.ts +0 -12
- package/dist/lib/proxy/logCleanupScheduler.js +0 -74
- package/dist/lib/proxy/logCleanupWorkerEntry.d.ts +0 -1
- package/dist/lib/proxy/logCleanupWorkerEntry.js +0 -15
- package/dist/lib/proxy/modelRouter.d.ts +0 -34
- package/dist/lib/proxy/modelRouter.js +0 -74
- package/dist/lib/proxy/oauthFetch.d.ts +0 -36
- package/dist/lib/proxy/oauthFetch.js +0 -353
- package/dist/lib/proxy/openaiFormat.d.ts +0 -139
- package/dist/lib/proxy/openaiFormat.js +0 -817
- package/dist/lib/proxy/providerTransportCoordinator.d.ts +0 -17
- package/dist/lib/proxy/providerTransportCoordinator.js +0 -156
- package/dist/lib/proxy/proxyActivity.d.ts +0 -8
- package/dist/lib/proxy/proxyActivity.js +0 -117
- package/dist/lib/proxy/proxyAnalysis.d.ts +0 -3
- package/dist/lib/proxy/proxyAnalysis.js +0 -985
- package/dist/lib/proxy/proxyConfig.d.ts +0 -42
- package/dist/lib/proxy/proxyConfig.js +0 -700
- package/dist/lib/proxy/proxyDispatcher.d.ts +0 -5
- package/dist/lib/proxy/proxyDispatcher.js +0 -61
- package/dist/lib/proxy/proxyEnv.d.ts +0 -3
- package/dist/lib/proxy/proxyEnv.js +0 -73
- package/dist/lib/proxy/proxyFetch.d.ts +0 -50
- package/dist/lib/proxy/proxyFetch.js +0 -729
- package/dist/lib/proxy/proxyHealth.d.ts +0 -20
- package/dist/lib/proxy/proxyHealth.js +0 -76
- package/dist/lib/proxy/proxyLifecycle.d.ts +0 -13
- package/dist/lib/proxy/proxyLifecycle.js +0 -383
- package/dist/lib/proxy/proxyPaths.d.ts +0 -17
- package/dist/lib/proxy/proxyPaths.js +0 -42
- package/dist/lib/proxy/proxyReplay.d.ts +0 -10
- package/dist/lib/proxy/proxyReplay.js +0 -765
- package/dist/lib/proxy/proxyTracer.d.ts +0 -128
- package/dist/lib/proxy/proxyTracer.js +0 -748
- package/dist/lib/proxy/proxyTranslationEngine.d.ts +0 -125
- package/dist/lib/proxy/proxyTranslationEngine.js +0 -740
- package/dist/lib/proxy/quietDetector.d.ts +0 -17
- package/dist/lib/proxy/quietDetector.js +0 -125
- package/dist/lib/proxy/quotaHeaders.d.ts +0 -73
- package/dist/lib/proxy/quotaHeaders.js +0 -189
- package/dist/lib/proxy/rawStreamCapture.d.ts +0 -2
- package/dist/lib/proxy/rawStreamCapture.js +0 -129
- package/dist/lib/proxy/requestLogger.d.ts +0 -78
- package/dist/lib/proxy/requestLogger.js +0 -770
- package/dist/lib/proxy/rollingProxyServer.d.ts +0 -3
- package/dist/lib/proxy/rollingProxyServer.js +0 -220
- package/dist/lib/proxy/rollingWorkerProcess.d.ts +0 -2
- package/dist/lib/proxy/rollingWorkerProcess.js +0 -199
- package/dist/lib/proxy/rollingWorkerProtocol.d.ts +0 -5
- package/dist/lib/proxy/rollingWorkerProtocol.js +0 -46
- package/dist/lib/proxy/rollingWorkerSupervisor.d.ts +0 -44
- package/dist/lib/proxy/rollingWorkerSupervisor.js +0 -530
- package/dist/lib/proxy/routingEvidence.d.ts +0 -17
- package/dist/lib/proxy/routingEvidence.js +0 -59
- package/dist/lib/proxy/routingPolicy.d.ts +0 -19
- package/dist/lib/proxy/routingPolicy.js +0 -75
- package/dist/lib/proxy/runtimeConfig.d.ts +0 -27
- package/dist/lib/proxy/runtimeConfig.js +0 -448
- package/dist/lib/proxy/snapshotPersistence.d.ts +0 -2
- package/dist/lib/proxy/snapshotPersistence.js +0 -41
- package/dist/lib/proxy/socketWorkerRuntime.d.ts +0 -14
- package/dist/lib/proxy/socketWorkerRuntime.js +0 -322
- package/dist/lib/proxy/sseInterceptor.d.ts +0 -41
- package/dist/lib/proxy/sseInterceptor.js +0 -496
- package/dist/lib/proxy/streamOutcome.d.ts +0 -5
- package/dist/lib/proxy/streamOutcome.js +0 -104
- package/dist/lib/proxy/systemRelocation.d.ts +0 -21
- package/dist/lib/proxy/systemRelocation.js +0 -51
- package/dist/lib/proxy/tokenRefresh.d.ts +0 -18
- package/dist/lib/proxy/tokenRefresh.js +0 -257
- package/dist/lib/proxy/updateChecker.d.ts +0 -17
- package/dist/lib/proxy/updateChecker.js +0 -98
- package/dist/lib/proxy/updateCoordinator.d.ts +0 -7
- package/dist/lib/proxy/updateCoordinator.js +0 -60
- package/dist/lib/proxy/updateState.d.ts +0 -69
- package/dist/lib/proxy/updateState.js +0 -309
- package/dist/lib/proxy/updaterSupervisor.d.ts +0 -3
- package/dist/lib/proxy/updaterSupervisor.js +0 -58
- package/dist/lib/proxy/usageStats.d.ts +0 -91
- package/dist/lib/proxy/usageStats.js +0 -1154
- package/dist/lib/proxy/utils/noProxyUtils.d.ts +0 -39
- package/dist/lib/proxy/utils/noProxyUtils.js +0 -150
- package/dist/lib/proxy/workerLog.d.ts +0 -6
- package/dist/lib/proxy/workerLog.js +0 -42
- package/dist/lib/rag/ChunkerFactory.d.ts +0 -91
- package/dist/lib/rag/ChunkerFactory.js +0 -321
- package/dist/lib/rag/ChunkerRegistry.d.ts +0 -91
- package/dist/lib/rag/ChunkerRegistry.js +0 -422
- package/dist/lib/rag/chunkers/BaseChunker.d.ts +0 -53
- package/dist/lib/rag/chunkers/BaseChunker.js +0 -158
- package/dist/lib/rag/chunkers/CharacterChunker.d.ts +0 -18
- package/dist/lib/rag/chunkers/CharacterChunker.js +0 -29
- package/dist/lib/rag/chunkers/HTMLChunker.d.ts +0 -19
- package/dist/lib/rag/chunkers/HTMLChunker.js +0 -39
- package/dist/lib/rag/chunkers/JSONChunker.d.ts +0 -19
- package/dist/lib/rag/chunkers/JSONChunker.js +0 -69
- package/dist/lib/rag/chunkers/LaTeXChunker.d.ts +0 -15
- package/dist/lib/rag/chunkers/LaTeXChunker.js +0 -64
- package/dist/lib/rag/chunkers/MarkdownChunker.d.ts +0 -37
- package/dist/lib/rag/chunkers/MarkdownChunker.js +0 -315
- package/dist/lib/rag/chunkers/RecursiveChunker.d.ts +0 -27
- package/dist/lib/rag/chunkers/RecursiveChunker.js +0 -140
- package/dist/lib/rag/chunkers/SemanticMarkdownChunker.d.ts +0 -22
- package/dist/lib/rag/chunkers/SemanticMarkdownChunker.js +0 -139
- package/dist/lib/rag/chunkers/SentenceChunker.d.ts +0 -19
- package/dist/lib/rag/chunkers/SentenceChunker.js +0 -67
- package/dist/lib/rag/chunkers/TokenChunker.d.ts +0 -19
- package/dist/lib/rag/chunkers/TokenChunker.js +0 -62
- package/dist/lib/rag/chunkers/index.d.ts +0 -15
- package/dist/lib/rag/chunkers/index.js +0 -16
- package/dist/lib/rag/chunking/characterChunker.d.ts +0 -16
- package/dist/lib/rag/chunking/characterChunker.js +0 -143
- package/dist/lib/rag/chunking/chunkerRegistry.d.ts +0 -67
- package/dist/lib/rag/chunking/chunkerRegistry.js +0 -195
- package/dist/lib/rag/chunking/htmlChunker.d.ts +0 -34
- package/dist/lib/rag/chunking/htmlChunker.js +0 -248
- package/dist/lib/rag/chunking/index.d.ts +0 -15
- package/dist/lib/rag/chunking/index.js +0 -18
- package/dist/lib/rag/chunking/jsonChunker.d.ts +0 -20
- package/dist/lib/rag/chunking/jsonChunker.js +0 -282
- package/dist/lib/rag/chunking/latexChunker.d.ts +0 -26
- package/dist/lib/rag/chunking/latexChunker.js +0 -252
- package/dist/lib/rag/chunking/markdownChunker.d.ts +0 -35
- package/dist/lib/rag/chunking/markdownChunker.js +0 -383
- package/dist/lib/rag/chunking/recursiveChunker.d.ts +0 -19
- package/dist/lib/rag/chunking/recursiveChunker.js +0 -149
- package/dist/lib/rag/chunking/semanticChunker.d.ts +0 -41
- package/dist/lib/rag/chunking/semanticChunker.js +0 -306
- package/dist/lib/rag/chunking/sentenceChunker.d.ts +0 -25
- package/dist/lib/rag/chunking/sentenceChunker.js +0 -231
- package/dist/lib/rag/chunking/tokenChunker.d.ts +0 -36
- package/dist/lib/rag/chunking/tokenChunker.js +0 -184
- package/dist/lib/rag/document/MDocument.d.ts +0 -198
- package/dist/lib/rag/document/MDocument.js +0 -392
- package/dist/lib/rag/document/index.d.ts +0 -5
- package/dist/lib/rag/document/index.js +0 -6
- package/dist/lib/rag/document/loaders.d.ts +0 -142
- package/dist/lib/rag/document/loaders.js +0 -544
- package/dist/lib/rag/errors/RAGError.d.ts +0 -244
- package/dist/lib/rag/errors/RAGError.js +0 -275
- package/dist/lib/rag/errors/index.d.ts +0 -6
- package/dist/lib/rag/errors/index.js +0 -7
- package/dist/lib/rag/graphRag/graphRAG.d.ts +0 -115
- package/dist/lib/rag/graphRag/graphRAG.js +0 -402
- package/dist/lib/rag/graphRag/index.d.ts +0 -4
- package/dist/lib/rag/graphRag/index.js +0 -5
- package/dist/lib/rag/index.d.ts +0 -104
- package/dist/lib/rag/index.js +0 -144
- package/dist/lib/rag/metadata/MetadataExtractorFactory.d.ts +0 -103
- package/dist/lib/rag/metadata/MetadataExtractorFactory.js +0 -419
- package/dist/lib/rag/metadata/MetadataExtractorRegistry.d.ts +0 -99
- package/dist/lib/rag/metadata/MetadataExtractorRegistry.js +0 -363
- package/dist/lib/rag/metadata/index.d.ts +0 -6
- package/dist/lib/rag/metadata/index.js +0 -10
- package/dist/lib/rag/metadata/metadataExtractor.d.ts +0 -69
- package/dist/lib/rag/metadata/metadataExtractor.js +0 -281
- package/dist/lib/rag/pipeline/RAGPipeline.d.ts +0 -105
- package/dist/lib/rag/pipeline/RAGPipeline.js +0 -436
- package/dist/lib/rag/pipeline/contextAssembly.d.ts +0 -80
- package/dist/lib/rag/pipeline/contextAssembly.js +0 -342
- package/dist/lib/rag/pipeline/index.d.ts +0 -5
- package/dist/lib/rag/pipeline/index.js +0 -6
- package/dist/lib/rag/ragIntegration.d.ts +0 -30
- package/dist/lib/rag/ragIntegration.js +0 -327
- package/dist/lib/rag/reranker/RerankerFactory.d.ts +0 -124
- package/dist/lib/rag/reranker/RerankerFactory.js +0 -431
- package/dist/lib/rag/reranker/RerankerRegistry.d.ts +0 -119
- package/dist/lib/rag/reranker/RerankerRegistry.js +0 -403
- package/dist/lib/rag/reranker/index.d.ts +0 -6
- package/dist/lib/rag/reranker/index.js +0 -10
- package/dist/lib/rag/reranker/reranker.d.ts +0 -70
- package/dist/lib/rag/reranker/reranker.js +0 -307
- package/dist/lib/rag/resilience/CircuitBreaker.d.ts +0 -142
- package/dist/lib/rag/resilience/CircuitBreaker.js +0 -432
- package/dist/lib/rag/resilience/RetryHandler.d.ts +0 -95
- package/dist/lib/rag/resilience/RetryHandler.js +0 -305
- package/dist/lib/rag/resilience/index.d.ts +0 -7
- package/dist/lib/rag/resilience/index.js +0 -8
- package/dist/lib/rag/retrieval/hybridSearch.d.ts +0 -53
- package/dist/lib/rag/retrieval/hybridSearch.js +0 -339
- package/dist/lib/rag/retrieval/index.d.ts +0 -5
- package/dist/lib/rag/retrieval/index.js +0 -6
- package/dist/lib/rag/retrieval/vectorQueryTool.d.ts +0 -72
- package/dist/lib/rag/retrieval/vectorQueryTool.js +0 -325
- package/dist/lib/rag/stores/chroma.d.ts +0 -90
- package/dist/lib/rag/stores/chroma.js +0 -281
- package/dist/lib/rag/stores/index.d.ts +0 -21
- package/dist/lib/rag/stores/index.js +0 -22
- package/dist/lib/rag/stores/pgvector.d.ts +0 -95
- package/dist/lib/rag/stores/pgvector.js +0 -400
- package/dist/lib/rag/stores/pinecone.d.ts +0 -85
- package/dist/lib/rag/stores/pinecone.js +0 -159
- package/dist/lib/routing/classifierRouter.d.ts +0 -52
- package/dist/lib/routing/classifierRouter.js +0 -269
- package/dist/lib/routing/classifierStrategies.d.ts +0 -23
- package/dist/lib/routing/classifierStrategies.js +0 -156
- package/dist/lib/routing/index.d.ts +0 -9
- package/dist/lib/routing/index.js +0 -10
- package/dist/lib/routing/modelPool.d.ts +0 -83
- package/dist/lib/routing/modelPool.js +0 -243
- package/dist/lib/routing/requestRouter.d.ts +0 -30
- package/dist/lib/routing/requestRouter.js +0 -81
- package/dist/lib/sdk/toolRegistration.d.ts +0 -74
- package/dist/lib/sdk/toolRegistration.js +0 -383
- package/dist/lib/server/abstract/baseServerAdapter.d.ts +0 -171
- package/dist/lib/server/abstract/baseServerAdapter.js +0 -575
- package/dist/lib/server/adapters/expressAdapter.d.ts +0 -70
- package/dist/lib/server/adapters/expressAdapter.js +0 -487
- package/dist/lib/server/adapters/fastifyAdapter.d.ts +0 -70
- package/dist/lib/server/adapters/fastifyAdapter.js +0 -473
- package/dist/lib/server/adapters/honoAdapter.d.ts +0 -77
- package/dist/lib/server/adapters/honoAdapter.js +0 -633
- package/dist/lib/server/adapters/index.d.ts +0 -7
- package/dist/lib/server/adapters/index.js +0 -8
- package/dist/lib/server/adapters/koaAdapter.d.ts +0 -79
- package/dist/lib/server/adapters/koaAdapter.js +0 -511
- package/dist/lib/server/errors.d.ts +0 -193
- package/dist/lib/server/errors.js +0 -487
- package/dist/lib/server/factory/serverAdapterFactory.d.ts +0 -73
- package/dist/lib/server/factory/serverAdapterFactory.js +0 -161
- package/dist/lib/server/index.d.ts +0 -46
- package/dist/lib/server/index.js +0 -122
- package/dist/lib/server/middleware/abortSignal.d.ts +0 -52
- package/dist/lib/server/middleware/abortSignal.js +0 -112
- package/dist/lib/server/middleware/auth.d.ts +0 -166
- package/dist/lib/server/middleware/auth.js +0 -404
- package/dist/lib/server/middleware/cache.d.ts +0 -161
- package/dist/lib/server/middleware/cache.js +0 -370
- package/dist/lib/server/middleware/common.d.ts +0 -108
- package/dist/lib/server/middleware/common.js +0 -297
- package/dist/lib/server/middleware/deprecation.d.ts +0 -40
- package/dist/lib/server/middleware/deprecation.js +0 -191
- package/dist/lib/server/middleware/index.d.ts +0 -12
- package/dist/lib/server/middleware/index.js +0 -13
- package/dist/lib/server/middleware/mcpBodyAttachment.d.ts +0 -42
- package/dist/lib/server/middleware/mcpBodyAttachment.js +0 -64
- package/dist/lib/server/middleware/rateLimit.d.ts +0 -70
- package/dist/lib/server/middleware/rateLimit.js +0 -224
- package/dist/lib/server/middleware/validation.d.ts +0 -69
- package/dist/lib/server/middleware/validation.js +0 -393
- package/dist/lib/server/openapi/generator.d.ts +0 -61
- package/dist/lib/server/openapi/generator.js +0 -399
- package/dist/lib/server/openapi/index.d.ts +0 -7
- package/dist/lib/server/openapi/index.js +0 -37
- package/dist/lib/server/openapi/schemas.d.ts +0 -94
- package/dist/lib/server/openapi/schemas.js +0 -696
- package/dist/lib/server/openapi/templates.d.ts +0 -108
- package/dist/lib/server/openapi/templates.js +0 -375
- package/dist/lib/server/routes/agentRoutes.d.ts +0 -9
- package/dist/lib/server/routes/agentRoutes.js +0 -423
- package/dist/lib/server/routes/claudeProxyRoutes.d.ts +0 -491
- package/dist/lib/server/routes/claudeProxyRoutes.js +0 -6455
- package/dist/lib/server/routes/codexProxyRoutes.d.ts +0 -64
- package/dist/lib/server/routes/codexProxyRoutes.js +0 -482
- package/dist/lib/server/routes/healthRoutes.d.ts +0 -9
- package/dist/lib/server/routes/healthRoutes.js +0 -234
- package/dist/lib/server/routes/index.d.ts +0 -25
- package/dist/lib/server/routes/index.js +0 -66
- package/dist/lib/server/routes/mcpRoutes.d.ts +0 -9
- package/dist/lib/server/routes/mcpRoutes.js +0 -376
- package/dist/lib/server/routes/memoryRoutes.d.ts +0 -11
- package/dist/lib/server/routes/memoryRoutes.js +0 -366
- package/dist/lib/server/routes/openApiRoutes.d.ts +0 -34
- package/dist/lib/server/routes/openApiRoutes.js +0 -151
- package/dist/lib/server/routes/openaiProxyRoutes.d.ts +0 -38
- package/dist/lib/server/routes/openaiProxyRoutes.js +0 -404
- package/dist/lib/server/routes/toolRoutes.d.ts +0 -9
- package/dist/lib/server/routes/toolRoutes.js +0 -272
- package/dist/lib/server/streaming/dataStream.d.ts +0 -212
- package/dist/lib/server/streaming/dataStream.js +0 -502
- package/dist/lib/server/streaming/index.d.ts +0 -5
- package/dist/lib/server/streaming/index.js +0 -17
- package/dist/lib/server/utils/redaction.d.ts +0 -68
- package/dist/lib/server/utils/redaction.js +0 -321
- package/dist/lib/server/utils/validation.d.ts +0 -153
- package/dist/lib/server/utils/validation.js +0 -265
- package/dist/lib/server/voice/frameBus.d.ts +0 -8
- package/dist/lib/server/voice/frameBus.js +0 -25
- package/dist/lib/server/voice/tokenCompare.d.ts +0 -14
- package/dist/lib/server/voice/tokenCompare.js +0 -23
- package/dist/lib/server/voice/turnManager.d.ts +0 -15
- package/dist/lib/server/voice/turnManager.js +0 -36
- package/dist/lib/server/voice/voiceServerApp.d.ts +0 -1
- package/dist/lib/server/voice/voiceServerApp.js +0 -177
- package/dist/lib/server/voice/voiceWebSocketHandler.d.ts +0 -24
- package/dist/lib/server/voice/voiceWebSocketHandler.js +0 -669
- package/dist/lib/server/websocket/WebSocketHandler.d.ts +0 -107
- package/dist/lib/server/websocket/WebSocketHandler.js +0 -384
- package/dist/lib/server/websocket/index.d.ts +0 -4
- package/dist/lib/server/websocket/index.js +0 -5
- package/dist/lib/services/server/ai/observability/instrumentation.d.ts +0 -229
- package/dist/lib/services/server/ai/observability/instrumentation.js +0 -1244
- package/dist/lib/session/globalSessionState.d.ts +0 -71
- package/dist/lib/session/globalSessionState.js +0 -235
- package/dist/lib/skills/skillMatcher.d.ts +0 -55
- package/dist/lib/skills/skillMatcher.js +0 -170
- package/dist/lib/skills/skillSessionTracker.d.ts +0 -52
- package/dist/lib/skills/skillSessionTracker.js +0 -150
- package/dist/lib/skills/skillStoreRedis.d.ts +0 -30
- package/dist/lib/skills/skillStoreRedis.js +0 -114
- package/dist/lib/skills/skillStoreS3.d.ts +0 -56
- package/dist/lib/skills/skillStoreS3.js +0 -305
- package/dist/lib/skills/skillStores.d.ts +0 -58
- package/dist/lib/skills/skillStores.js +0 -341
- package/dist/lib/skills/skillTools.d.ts +0 -35
- package/dist/lib/skills/skillTools.js +0 -451
- package/dist/lib/skills/skillsManager.d.ts +0 -78
- package/dist/lib/skills/skillsManager.js +0 -281
- package/dist/lib/tasks/autoresearchTaskExecutor.d.ts +0 -31
- package/dist/lib/tasks/autoresearchTaskExecutor.js +0 -304
- package/dist/lib/tasks/backends/bullmqBackend.d.ts +0 -33
- package/dist/lib/tasks/backends/bullmqBackend.js +0 -206
- package/dist/lib/tasks/backends/nodeTimeoutBackend.d.ts +0 -27
- package/dist/lib/tasks/backends/nodeTimeoutBackend.js +0 -141
- package/dist/lib/tasks/backends/taskBackendRegistry.d.ts +0 -31
- package/dist/lib/tasks/backends/taskBackendRegistry.js +0 -66
- package/dist/lib/tasks/errors.d.ts +0 -33
- package/dist/lib/tasks/errors.js +0 -19
- package/dist/lib/tasks/store/fileTaskStore.d.ts +0 -43
- package/dist/lib/tasks/store/fileTaskStore.js +0 -179
- package/dist/lib/tasks/store/redisTaskStore.d.ts +0 -43
- package/dist/lib/tasks/store/redisTaskStore.js +0 -222
- package/dist/lib/tasks/taskExecutor.d.ts +0 -22
- package/dist/lib/tasks/taskExecutor.js +0 -170
- package/dist/lib/tasks/taskManager.d.ts +0 -65
- package/dist/lib/tasks/taskManager.js +0 -545
- package/dist/lib/tasks/tools/taskTools.d.ts +0 -20
- package/dist/lib/tasks/tools/taskTools.js +0 -265
- package/dist/lib/telemetry/attributes.d.ts +0 -136
- package/dist/lib/telemetry/attributes.js +0 -165
- package/dist/lib/telemetry/index.d.ts +0 -20
- package/dist/lib/telemetry/index.js +0 -28
- package/dist/lib/telemetry/telemetryService.d.ts +0 -58
- package/dist/lib/telemetry/telemetryService.js +0 -387
- package/dist/lib/telemetry/traceContext.d.ts +0 -9
- package/dist/lib/telemetry/traceContext.js +0 -19
- package/dist/lib/telemetry/tracers.d.ts +0 -38
- package/dist/lib/telemetry/tracers.js +0 -40
- package/dist/lib/telemetry/withSpan.d.ts +0 -39
- package/dist/lib/telemetry/withSpan.js +0 -138
- package/dist/lib/tools/toolDiscovery.d.ts +0 -70
- package/dist/lib/tools/toolDiscovery.js +0 -303
- package/dist/lib/tools/toolGate.d.ts +0 -16
- package/dist/lib/tools/toolGate.js +0 -51
- package/dist/lib/tools/toolPolicy.d.ts +0 -40
- package/dist/lib/tools/toolPolicy.js +0 -194
- package/dist/lib/types/action.d.ts +0 -207
- package/dist/lib/types/action.js +0 -7
- package/dist/lib/types/agentNetwork.d.ts +0 -1199
- package/dist/lib/types/agentNetwork.js +0 -8
- package/dist/lib/types/aliases.d.ts +0 -368
- package/dist/lib/types/aliases.js +0 -50
- package/dist/lib/types/analytics.d.ts +0 -215
- package/dist/lib/types/analytics.js +0 -6
- package/dist/lib/types/artifact.d.ts +0 -70
- package/dist/lib/types/artifact.js +0 -11
- package/dist/lib/types/auth.d.ts +0 -1140
- package/dist/lib/types/auth.js +0 -10
- package/dist/lib/types/autoresearch.d.ts +0 -206
- package/dist/lib/types/autoresearch.js +0 -18
- package/dist/lib/types/avatar.d.ts +0 -150
- package/dist/lib/types/avatar.js +0 -20
- package/dist/lib/types/circuitBreakerErrors.d.ts +0 -30
- package/dist/lib/types/circuitBreakerErrors.js +0 -35
- package/dist/lib/types/classifierRouter.d.ts +0 -194
- package/dist/lib/types/classifierRouter.js +0 -17
- package/dist/lib/types/cli.d.ts +0 -1734
- package/dist/lib/types/cli.js +0 -22
- package/dist/lib/types/client.d.ts +0 -1287
- package/dist/lib/types/client.js +0 -11
- package/dist/lib/types/codex.d.ts +0 -95
- package/dist/lib/types/codex.js +0 -15
- package/dist/lib/types/common.d.ts +0 -434
- package/dist/lib/types/common.js +0 -52
- package/dist/lib/types/config.d.ts +0 -506
- package/dist/lib/types/config.js +0 -54
- package/dist/lib/types/content.d.ts +0 -18
- package/dist/lib/types/content.js +0 -20
- package/dist/lib/types/context.d.ts +0 -587
- package/dist/lib/types/context.js +0 -401
- package/dist/lib/types/conversation.d.ts +0 -637
- package/dist/lib/types/conversation.js +0 -48
- package/dist/lib/types/conversationMemoryInterface.d.ts +0 -59
- package/dist/lib/types/conversationMemoryInterface.js +0 -7
- package/dist/lib/types/domain.d.ts +0 -62
- package/dist/lib/types/domain.js +0 -6
- package/dist/lib/types/dynamic.d.ts +0 -110
- package/dist/lib/types/dynamic.js +0 -10
- package/dist/lib/types/elicitation.d.ts +0 -278
- package/dist/lib/types/elicitation.js +0 -11
- package/dist/lib/types/enums.d.ts +0 -9
- package/dist/lib/types/enums.js +0 -10
- package/dist/lib/types/errors.d.ts +0 -188
- package/dist/lib/types/errors.js +0 -262
- package/dist/lib/types/evaluation.d.ts +0 -647
- package/dist/lib/types/evaluation.js +0 -2
- package/dist/lib/types/evaluationProviders.d.ts +0 -104
- package/dist/lib/types/evaluationProviders.js +0 -6
- package/dist/lib/types/exporter.d.ts +0 -257
- package/dist/lib/types/exporter.js +0 -6
- package/dist/lib/types/externalMcp.d.ts +0 -349
- package/dist/lib/types/externalMcp.js +0 -7
- package/dist/lib/types/file.d.ts +0 -616
- package/dist/lib/types/file.js +0 -5
- package/dist/lib/types/fileReference.d.ts +0 -243
- package/dist/lib/types/fileReference.js +0 -22
- package/dist/lib/types/generate.d.ts +0 -1520
- package/dist/lib/types/generate.js +0 -2
- package/dist/lib/types/grounding.d.ts +0 -231
- package/dist/lib/types/grounding.js +0 -12
- package/dist/lib/types/guardrails.d.ts +0 -116
- package/dist/lib/types/guardrails.js +0 -2
- package/dist/lib/types/hitl.d.ts +0 -237
- package/dist/lib/types/hitl.js +0 -9
- package/dist/lib/types/imageGen.d.ts +0 -255
- package/dist/lib/types/imageGen.js +0 -25
- package/dist/lib/types/index.d.ts +0 -86
- package/dist/lib/types/index.js +0 -98
- package/dist/lib/types/ioProcessor.d.ts +0 -119
- package/dist/lib/types/ioProcessor.js +0 -10
- package/dist/lib/types/isolatedAgent.d.ts +0 -365
- package/dist/lib/types/isolatedAgent.js +0 -12
- package/dist/lib/types/knowledge.d.ts +0 -342
- package/dist/lib/types/knowledge.js +0 -30
- package/dist/lib/types/livekit.d.ts +0 -512
- package/dist/lib/types/livekit.js +0 -13
- package/dist/lib/types/loopEngine.d.ts +0 -306
- package/dist/lib/types/loopEngine.js +0 -2
- package/dist/lib/types/mcp.d.ts +0 -2135
- package/dist/lib/types/mcp.js +0 -6
- package/dist/lib/types/mcpOutput.d.ts +0 -40
- package/dist/lib/types/mcpOutput.js +0 -9
- package/dist/lib/types/memory.d.ts +0 -96
- package/dist/lib/types/memory.js +0 -23
- package/dist/lib/types/middleware.d.ts +0 -435
- package/dist/lib/types/middleware.js +0 -2
- package/dist/lib/types/model.d.ts +0 -342
- package/dist/lib/types/model.js +0 -32
- package/dist/lib/types/modelPool.d.ts +0 -47
- package/dist/lib/types/modelPool.js +0 -11
- package/dist/lib/types/multimodal.d.ts +0 -614
- package/dist/lib/types/multimodal.js +0 -144
- package/dist/lib/types/music.d.ts +0 -172
- package/dist/lib/types/music.js +0 -21
- package/dist/lib/types/nativeTools.d.ts +0 -16
- package/dist/lib/types/nativeTools.js +0 -2
- package/dist/lib/types/noOutputSentinel.d.ts +0 -26
- package/dist/lib/types/noOutputSentinel.js +0 -2
- package/dist/lib/types/observability.d.ts +0 -502
- package/dist/lib/types/observability.js +0 -7
- package/dist/lib/types/openaiCompatible.d.ts +0 -287
- package/dist/lib/types/openaiCompatible.js +0 -2
- package/dist/lib/types/ppt.d.ts +0 -1093
- package/dist/lib/types/ppt.js +0 -37
- package/dist/lib/types/processor.d.ts +0 -993
- package/dist/lib/types/processor.js +0 -91
- package/dist/lib/types/providers.d.ts +0 -2155
- package/dist/lib/types/providers.js +0 -112
- package/dist/lib/types/proxy.d.ts +0 -2789
- package/dist/lib/types/proxy.js +0 -17
- package/dist/lib/types/proxyClient.d.ts +0 -54
- package/dist/lib/types/proxyClient.js +0 -2
- package/dist/lib/types/rag.d.ts +0 -1332
- package/dist/lib/types/rag.js +0 -2
- package/dist/lib/types/realtime.d.ts +0 -243
- package/dist/lib/types/realtime.js +0 -70
- package/dist/lib/types/replicate.d.ts +0 -67
- package/dist/lib/types/replicate.js +0 -10
- package/dist/lib/types/requestRouter.d.ts +0 -75
- package/dist/lib/types/requestRouter.js +0 -16
- package/dist/lib/types/safeFetch.d.ts +0 -24
- package/dist/lib/types/safeFetch.js +0 -7
- package/dist/lib/types/scorer.d.ts +0 -564
- package/dist/lib/types/scorer.js +0 -6
- package/dist/lib/types/sdk.d.ts +0 -23
- package/dist/lib/types/sdk.js +0 -9
- package/dist/lib/types/server.d.ts +0 -1192
- package/dist/lib/types/server.js +0 -68
- package/dist/lib/types/service.d.ts +0 -79
- package/dist/lib/types/service.js +0 -6
- package/dist/lib/types/skills.d.ts +0 -427
- package/dist/lib/types/skills.js +0 -17
- package/dist/lib/types/span.d.ts +0 -247
- package/dist/lib/types/span.js +0 -96
- package/dist/lib/types/stream.d.ts +0 -771
- package/dist/lib/types/stream.js +0 -2
- package/dist/lib/types/streamDedup.d.ts +0 -14
- package/dist/lib/types/streamDedup.js +0 -2
- package/dist/lib/types/streaming.d.ts +0 -15
- package/dist/lib/types/streaming.js +0 -2
- package/dist/lib/types/stt.d.ts +0 -585
- package/dist/lib/types/stt.js +0 -90
- package/dist/lib/types/subscription.d.ts +0 -1064
- package/dist/lib/types/subscription.js +0 -10
- package/dist/lib/types/task.d.ts +0 -313
- package/dist/lib/types/task.js +0 -37
- package/dist/lib/types/taskClassification.d.ts +0 -52
- package/dist/lib/types/taskClassification.js +0 -6
- package/dist/lib/types/toolDedup.d.ts +0 -45
- package/dist/lib/types/toolDedup.js +0 -14
- package/dist/lib/types/toolResolution.d.ts +0 -83
- package/dist/lib/types/toolResolution.js +0 -11
- package/dist/lib/types/toolRouting.d.ts +0 -350
- package/dist/lib/types/toolRouting.js +0 -19
- package/dist/lib/types/tools.d.ts +0 -531
- package/dist/lib/types/tools.js +0 -26
- package/dist/lib/types/tts.d.ts +0 -195
- package/dist/lib/types/tts.js +0 -65
- package/dist/lib/types/utilities.d.ts +0 -310
- package/dist/lib/types/utilities.js +0 -5
- package/dist/lib/types/vectorStoreChroma.d.ts +0 -67
- package/dist/lib/types/vectorStoreChroma.js +0 -12
- package/dist/lib/types/vectorStorePinecone.d.ts +0 -48
- package/dist/lib/types/vectorStorePinecone.js +0 -12
- package/dist/lib/types/video.d.ts +0 -89
- package/dist/lib/types/video.js +0 -15
- package/dist/lib/types/voice.d.ts +0 -272
- package/dist/lib/types/voice.js +0 -137
- package/dist/lib/types/workflow.d.ts +0 -598
- package/dist/lib/types/workflow.js +0 -24
- package/dist/lib/utils/analyticsUtils.d.ts +0 -37
- package/dist/lib/utils/analyticsUtils.js +0 -110
- package/dist/lib/utils/anthropicCacheBreakpoints.d.ts +0 -43
- package/dist/lib/utils/anthropicCacheBreakpoints.js +0 -151
- package/dist/lib/utils/anthropicTraceSanitizer.d.ts +0 -7
- package/dist/lib/utils/anthropicTraceSanitizer.js +0 -26
- package/dist/lib/utils/async/delay.d.ts +0 -40
- package/dist/lib/utils/async/delay.js +0 -43
- package/dist/lib/utils/async/index.d.ts +0 -23
- package/dist/lib/utils/async/index.js +0 -24
- package/dist/lib/utils/async/retry.d.ts +0 -107
- package/dist/lib/utils/async/retry.js +0 -172
- package/dist/lib/utils/async/withTimeout.d.ts +0 -85
- package/dist/lib/utils/async/withTimeout.js +0 -144
- package/dist/lib/utils/asyncMutex.d.ts +0 -14
- package/dist/lib/utils/asyncMutex.js +0 -61
- package/dist/lib/utils/audioFormatDetector.d.ts +0 -15
- package/dist/lib/utils/audioFormatDetector.js +0 -34
- package/dist/lib/utils/avatarProcessor.d.ts +0 -78
- package/dist/lib/utils/avatarProcessor.js +0 -173
- package/dist/lib/utils/cloneOptions.d.ts +0 -36
- package/dist/lib/utils/cloneOptions.js +0 -62
- package/dist/lib/utils/conversationMemory.d.ts +0 -80
- package/dist/lib/utils/conversationMemory.js +0 -670
- package/dist/lib/utils/csvProcessor.d.ts +0 -221
- package/dist/lib/utils/csvProcessor.js +0 -1527
- package/dist/lib/utils/csvUtils.d.ts +0 -26
- package/dist/lib/utils/csvUtils.js +0 -85
- package/dist/lib/utils/errorClassifier.d.ts +0 -30
- package/dist/lib/utils/errorClassifier.js +0 -183
- package/dist/lib/utils/errorHandling.d.ts +0 -398
- package/dist/lib/utils/errorHandling.js +0 -1282
- package/dist/lib/utils/evaluationUtils.d.ts +0 -27
- package/dist/lib/utils/evaluationUtils.js +0 -132
- package/dist/lib/utils/factoryProcessing.d.ts +0 -71
- package/dist/lib/utils/factoryProcessing.js +0 -590
- package/dist/lib/utils/fileDetector.d.ts +0 -198
- package/dist/lib/utils/fileDetector.js +0 -2806
- package/dist/lib/utils/generation.d.ts +0 -8
- package/dist/lib/utils/generation.js +0 -9
- package/dist/lib/utils/generationErrors.d.ts +0 -10
- package/dist/lib/utils/generationErrors.js +0 -11
- package/dist/lib/utils/imageCache.d.ts +0 -124
- package/dist/lib/utils/imageCache.js +0 -437
- package/dist/lib/utils/imageDetection.d.ts +0 -15
- package/dist/lib/utils/imageDetection.js +0 -53
- package/dist/lib/utils/imageProcessor.d.ts +0 -296
- package/dist/lib/utils/imageProcessor.js +0 -1158
- package/dist/lib/utils/isoBmff.d.ts +0 -24
- package/dist/lib/utils/isoBmff.js +0 -83
- package/dist/lib/utils/json/coerce.d.ts +0 -30
- package/dist/lib/utils/json/coerce.js +0 -412
- package/dist/lib/utils/json/extract.d.ts +0 -112
- package/dist/lib/utils/json/extract.js +0 -299
- package/dist/lib/utils/json/index.d.ts +0 -36
- package/dist/lib/utils/json/index.js +0 -37
- package/dist/lib/utils/json/safeParse.d.ts +0 -130
- package/dist/lib/utils/json/safeParse.js +0 -191
- package/dist/lib/utils/lifecycleCallbacks.d.ts +0 -56
- package/dist/lib/utils/lifecycleCallbacks.js +0 -100
- package/dist/lib/utils/lifecycleTimeout.d.ts +0 -25
- package/dist/lib/utils/lifecycleTimeout.js +0 -39
- package/dist/lib/utils/logSanitize.d.ts +0 -285
- package/dist/lib/utils/logSanitize.js +0 -555
- package/dist/lib/utils/logger.d.ts +0 -273
- package/dist/lib/utils/logger.js +0 -516
- package/dist/lib/utils/loggingFetch.d.ts +0 -29
- package/dist/lib/utils/loggingFetch.js +0 -60
- package/dist/lib/utils/loopUtils.d.ts +0 -70
- package/dist/lib/utils/loopUtils.js +0 -263
- package/dist/lib/utils/markupSniff.d.ts +0 -37
- package/dist/lib/utils/markupSniff.js +0 -125
- package/dist/lib/utils/mcpDefaults.d.ts +0 -54
- package/dist/lib/utils/mcpDefaults.js +0 -135
- package/dist/lib/utils/mcpErrorText.d.ts +0 -37
- package/dist/lib/utils/mcpErrorText.js +0 -95
- package/dist/lib/utils/mediaDuration.d.ts +0 -23
- package/dist/lib/utils/mediaDuration.js +0 -45
- package/dist/lib/utils/messageBuilder.d.ts +0 -59
- package/dist/lib/utils/messageBuilder.js +0 -2716
- package/dist/lib/utils/mimeTypeHints.d.ts +0 -40
- package/dist/lib/utils/mimeTypeHints.js +0 -122
- package/dist/lib/utils/modelAliasResolver.d.ts +0 -17
- package/dist/lib/utils/modelAliasResolver.js +0 -55
- package/dist/lib/utils/modelChoices.d.ts +0 -75
- package/dist/lib/utils/modelChoices.js +0 -698
- package/dist/lib/utils/modelDetection.d.ts +0 -37
- package/dist/lib/utils/modelDetection.js +0 -131
- package/dist/lib/utils/modelRouter.d.ts +0 -91
- package/dist/lib/utils/modelRouter.js +0 -293
- package/dist/lib/utils/multimodalOptionsBuilder.d.ts +0 -74
- package/dist/lib/utils/multimodalOptionsBuilder.js +0 -74
- package/dist/lib/utils/musicProcessor.d.ts +0 -77
- package/dist/lib/utils/musicProcessor.js +0 -190
- package/dist/lib/utils/noOutputSentinel.d.ts +0 -67
- package/dist/lib/utils/noOutputSentinel.js +0 -180
- package/dist/lib/utils/observabilityHelpers.d.ts +0 -27
- package/dist/lib/utils/observabilityHelpers.js +0 -48
- package/dist/lib/utils/optionsConversion.d.ts +0 -47
- package/dist/lib/utils/optionsConversion.js +0 -128
- package/dist/lib/utils/optionsUtils.d.ts +0 -175
- package/dist/lib/utils/optionsUtils.js +0 -970
- package/dist/lib/utils/parameterValidation.d.ts +0 -200
- package/dist/lib/utils/parameterValidation.js +0 -981
- package/dist/lib/utils/pdfProcessor.d.ts +0 -137
- package/dist/lib/utils/pdfProcessor.js +0 -689
- package/dist/lib/utils/performance.d.ts +0 -93
- package/dist/lib/utils/performance.js +0 -223
- package/dist/lib/utils/piiDetector.d.ts +0 -24
- package/dist/lib/utils/piiDetector.js +0 -221
- package/dist/lib/utils/pricing.d.ts +0 -26
- package/dist/lib/utils/pricing.js +0 -890
- package/dist/lib/utils/promptRedaction.d.ts +0 -22
- package/dist/lib/utils/promptRedaction.js +0 -63
- package/dist/lib/utils/providerConfig.d.ts +0 -393
- package/dist/lib/utils/providerConfig.js +0 -1363
- package/dist/lib/utils/providerErrorClassification.d.ts +0 -58
- package/dist/lib/utils/providerErrorClassification.js +0 -149
- package/dist/lib/utils/providerHealth.d.ts +0 -253
- package/dist/lib/utils/providerHealth.js +0 -1479
- package/dist/lib/utils/providerRetry.d.ts +0 -68
- package/dist/lib/utils/providerRetry.js +0 -230
- package/dist/lib/utils/providerSetupMessages.d.ts +0 -8
- package/dist/lib/utils/providerSetupMessages.js +0 -122
- package/dist/lib/utils/providerUtils.d.ts +0 -38
- package/dist/lib/utils/providerUtils.js +0 -366
- package/dist/lib/utils/rateLimiter.d.ts +0 -75
- package/dist/lib/utils/rateLimiter.js +0 -201
- package/dist/lib/utils/redis.d.ts +0 -119
- package/dist/lib/utils/redis.js +0 -530
- package/dist/lib/utils/responseValidator.d.ts +0 -21
- package/dist/lib/utils/responseValidator.js +0 -354
- package/dist/lib/utils/retryAfter.d.ts +0 -7
- package/dist/lib/utils/retryAfter.js +0 -44
- package/dist/lib/utils/retryHandler.d.ts +0 -82
- package/dist/lib/utils/retryHandler.js +0 -270
- package/dist/lib/utils/retryability.d.ts +0 -27
- package/dist/lib/utils/retryability.js +0 -45
- package/dist/lib/utils/safeFetch.d.ts +0 -26
- package/dist/lib/utils/safeFetch.js +0 -121
- package/dist/lib/utils/sanitizers/filename.d.ts +0 -116
- package/dist/lib/utils/sanitizers/filename.js +0 -366
- package/dist/lib/utils/sanitizers/html.d.ts +0 -170
- package/dist/lib/utils/sanitizers/html.js +0 -326
- package/dist/lib/utils/sanitizers/index.d.ts +0 -26
- package/dist/lib/utils/sanitizers/index.js +0 -30
- package/dist/lib/utils/sanitizers/svg.d.ts +0 -71
- package/dist/lib/utils/sanitizers/svg.js +0 -482
- package/dist/lib/utils/schemaConversion.d.ts +0 -56
- package/dist/lib/utils/schemaConversion.js +0 -656
- package/dist/lib/utils/sizeGuard.d.ts +0 -34
- package/dist/lib/utils/sizeGuard.js +0 -45
- package/dist/lib/utils/ssrfGuard.d.ts +0 -60
- package/dist/lib/utils/ssrfGuard.js +0 -446
- package/dist/lib/utils/sttProcessor.d.ts +0 -125
- package/dist/lib/utils/sttProcessor.js +0 -301
- package/dist/lib/utils/systemMessages.d.ts +0 -29
- package/dist/lib/utils/systemMessages.js +0 -45
- package/dist/lib/utils/taskClassificationUtils.d.ts +0 -55
- package/dist/lib/utils/taskClassificationUtils.js +0 -150
- package/dist/lib/utils/taskClassifier.d.ts +0 -23
- package/dist/lib/utils/taskClassifier.js +0 -95
- package/dist/lib/utils/textEncoding.d.ts +0 -25
- package/dist/lib/utils/textEncoding.js +0 -141
- package/dist/lib/utils/thinkingConfig.d.ts +0 -76
- package/dist/lib/utils/thinkingConfig.js +0 -105
- package/dist/lib/utils/timeout.d.ts +0 -158
- package/dist/lib/utils/timeout.js +0 -427
- package/dist/lib/utils/tokenEstimation.d.ts +0 -90
- package/dist/lib/utils/tokenEstimation.js +0 -187
- package/dist/lib/utils/tokenLimits.d.ts +0 -53
- package/dist/lib/utils/tokenLimits.js +0 -236
- package/dist/lib/utils/tokenUtils.d.ts +0 -101
- package/dist/lib/utils/tokenUtils.js +0 -323
- package/dist/lib/utils/tool.d.ts +0 -8
- package/dist/lib/utils/tool.js +0 -9
- package/dist/lib/utils/toolCallRepair.d.ts +0 -14
- package/dist/lib/utils/toolCallRepair.js +0 -286
- package/dist/lib/utils/toolChoice.d.ts +0 -4
- package/dist/lib/utils/toolChoice.js +0 -7
- package/dist/lib/utils/toolEndEmitter.d.ts +0 -25
- package/dist/lib/utils/toolEndEmitter.js +0 -65
- package/dist/lib/utils/toolUtils.d.ts +0 -40
- package/dist/lib/utils/toolUtils.js +0 -76
- package/dist/lib/utils/transformationUtils.d.ts +0 -218
- package/dist/lib/utils/transformationUtils.js +0 -578
- package/dist/lib/utils/tripwireEvaluator.d.ts +0 -73
- package/dist/lib/utils/tripwireEvaluator.js +0 -285
- package/dist/lib/utils/tryImport.d.ts +0 -35
- package/dist/lib/utils/tryImport.js +0 -95
- package/dist/lib/utils/ttsProcessor.d.ts +0 -159
- package/dist/lib/utils/ttsProcessor.js +0 -293
- package/dist/lib/utils/typeUtils.d.ts +0 -77
- package/dist/lib/utils/typeUtils.js +0 -98
- package/dist/lib/utils/videoAnalysisProcessor.d.ts +0 -24
- package/dist/lib/utils/videoAnalysisProcessor.js +0 -61
- package/dist/lib/utils/videoProcessor.d.ts +0 -64
- package/dist/lib/utils/videoProcessor.js +0 -196
- package/dist/lib/voice/RealtimeVoiceAPI.d.ts +0 -186
- package/dist/lib/voice/RealtimeVoiceAPI.js +0 -431
- package/dist/lib/voice/audio-utils.d.ts +0 -135
- package/dist/lib/voice/audio-utils.js +0 -435
- package/dist/lib/voice/errors.d.ts +0 -123
- package/dist/lib/voice/errors.js +0 -386
- package/dist/lib/voice/index.d.ts +0 -49
- package/dist/lib/voice/index.js +0 -177
- package/dist/lib/voice/livekit/brain.d.ts +0 -21
- package/dist/lib/voice/livekit/brain.js +0 -75
- package/dist/lib/voice/livekit/config.d.ts +0 -52
- package/dist/lib/voice/livekit/config.js +0 -134
- package/dist/lib/voice/livekit/eventBridge.d.ts +0 -27
- package/dist/lib/voice/livekit/eventBridge.js +0 -360
- package/dist/lib/voice/livekit/index.d.ts +0 -22
- package/dist/lib/voice/livekit/index.js +0 -23
- package/dist/lib/voice/livekit/realtimeEventBridge.d.ts +0 -14
- package/dist/lib/voice/livekit/realtimeEventBridge.js +0 -161
- package/dist/lib/voice/livekit/realtimeMcpTools.d.ts +0 -31
- package/dist/lib/voice/livekit/realtimeMcpTools.js +0 -206
- package/dist/lib/voice/livekit/realtimeVoiceAgent.d.ts +0 -26
- package/dist/lib/voice/livekit/realtimeVoiceAgent.js +0 -365
- package/dist/lib/voice/livekit/roomContext.d.ts +0 -23
- package/dist/lib/voice/livekit/roomContext.js +0 -57
- package/dist/lib/voice/livekit/roomDispatch.d.ts +0 -24
- package/dist/lib/voice/livekit/roomDispatch.js +0 -31
- package/dist/lib/voice/livekit/schemaSanitizer.d.ts +0 -26
- package/dist/lib/voice/livekit/schemaSanitizer.js +0 -144
- package/dist/lib/voice/livekit/tokens.d.ts +0 -19
- package/dist/lib/voice/livekit/tokens.js +0 -51
- package/dist/lib/voice/livekit/vertexAuth.d.ts +0 -30
- package/dist/lib/voice/livekit/vertexAuth.js +0 -73
- package/dist/lib/voice/livekit/voiceAgent.d.ts +0 -32
- package/dist/lib/voice/livekit/voiceAgent.js +0 -425
- package/dist/lib/voice/livekit/voiceAgentWorker.d.ts +0 -29
- package/dist/lib/voice/livekit/voiceAgentWorker.js +0 -122
- package/dist/lib/voice/providers/AzureSTT.d.ts +0 -47
- package/dist/lib/voice/providers/AzureSTT.js +0 -345
- package/dist/lib/voice/providers/AzureTTS.d.ts +0 -59
- package/dist/lib/voice/providers/AzureTTS.js +0 -349
- package/dist/lib/voice/providers/CartesiaTTS.d.ts +0 -31
- package/dist/lib/voice/providers/CartesiaTTS.js +0 -189
- package/dist/lib/voice/providers/DeepgramSTT.d.ts +0 -40
- package/dist/lib/voice/providers/DeepgramSTT.js +0 -550
- package/dist/lib/voice/providers/ElevenLabsTTS.d.ts +0 -53
- package/dist/lib/voice/providers/ElevenLabsTTS.js +0 -311
- package/dist/lib/voice/providers/FishAudioTTS.d.ts +0 -27
- package/dist/lib/voice/providers/FishAudioTTS.js +0 -183
- package/dist/lib/voice/providers/GeminiLive.d.ts +0 -52
- package/dist/lib/voice/providers/GeminiLive.js +0 -372
- package/dist/lib/voice/providers/GoogleSTT.d.ts +0 -60
- package/dist/lib/voice/providers/GoogleSTT.js +0 -454
- package/dist/lib/voice/providers/OpenAIRealtime.d.ts +0 -47
- package/dist/lib/voice/providers/OpenAIRealtime.js +0 -412
- package/dist/lib/voice/providers/OpenAISTT.d.ts +0 -41
- package/dist/lib/voice/providers/OpenAISTT.js +0 -286
- package/dist/lib/voice/providers/OpenAITTS.d.ts +0 -55
- package/dist/lib/voice/providers/OpenAITTS.js +0 -285
- package/dist/lib/voice/stream-handler.d.ts +0 -166
- package/dist/lib/voice/stream-handler.js +0 -514
- package/dist/lib/workflow/LAYER-EXAMPLES.d.ts +0 -13
- package/dist/lib/workflow/LAYER-EXAMPLES.js +0 -312
- package/dist/lib/workflow/PROMPT-EXAMPLES.d.ts +0 -117
- package/dist/lib/workflow/PROMPT-EXAMPLES.js +0 -246
- package/dist/lib/workflow/config.d.ts +0 -376
- package/dist/lib/workflow/config.js +0 -399
- package/dist/lib/workflow/core/ensembleExecutor.d.ts +0 -55
- package/dist/lib/workflow/core/ensembleExecutor.js +0 -451
- package/dist/lib/workflow/core/judgeScorer.d.ts +0 -25
- package/dist/lib/workflow/core/judgeScorer.js +0 -568
- package/dist/lib/workflow/core/responseConditioner.d.ts +0 -21
- package/dist/lib/workflow/core/responseConditioner.js +0 -243
- package/dist/lib/workflow/core/workflowRegistry.d.ts +0 -72
- package/dist/lib/workflow/core/workflowRegistry.js +0 -305
- package/dist/lib/workflow/core/workflowRunner.d.ts +0 -61
- package/dist/lib/workflow/core/workflowRunner.js +0 -642
- package/dist/lib/workflow/index.d.ts +0 -21
- package/dist/lib/workflow/index.js +0 -46
- package/dist/lib/workflow/utils/workflowMetrics.d.ts +0 -74
- package/dist/lib/workflow/utils/workflowMetrics.js +0 -312
- package/dist/lib/workflow/utils/workflowValidation.d.ts +0 -29
- package/dist/lib/workflow/utils/workflowValidation.js +0 -421
- package/dist/lib/workflow/workflows/adaptiveWorkflow.d.ts +0 -72
- package/dist/lib/workflow/workflows/adaptiveWorkflow.js +0 -367
- package/dist/lib/workflow/workflows/consensusWorkflow.d.ts +0 -69
- package/dist/lib/workflow/workflows/consensusWorkflow.js +0 -193
- package/dist/lib/workflow/workflows/fallbackWorkflow.d.ts +0 -49
- package/dist/lib/workflow/workflows/fallbackWorkflow.js +0 -226
- package/dist/lib/workflow/workflows/multiJudgeWorkflow.d.ts +0 -70
- package/dist/lib/workflow/workflows/multiJudgeWorkflow.js +0 -352
- package/dist/providers/googleVertex/utils.d.ts +0 -12
- package/dist/providers/googleVertex/utils.js +0 -286
|
@@ -1,1154 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Abstract base class for providers that talk to an OpenAI chat-completions
|
|
3
|
-
* shaped HTTP endpoint. Owns the entire request/stream/tool-loop pipeline
|
|
4
|
-
* so concrete providers only declare configuration + provider-specific
|
|
5
|
-
* quirks (env var names, default model, error mapping).
|
|
6
|
-
*
|
|
7
|
-
* Currently extended by:
|
|
8
|
-
* - OpenAICompatibleProvider (generic /v1/chat/completions backend)
|
|
9
|
-
* - LiteLLMProvider (LiteLLM proxy server)
|
|
10
|
-
* - DeepSeekProvider (api.deepseek.com)
|
|
11
|
-
*
|
|
12
|
-
* Subclasses provide:
|
|
13
|
-
* - getProviderName() / getDefaultModel() / formatProviderError() (abstract)
|
|
14
|
-
* - optional overrides: getFallbackModelName, getFallbackModels,
|
|
15
|
-
* adjustBuildBodyOptions, onStreamStart, getAvailableModels
|
|
16
|
-
*
|
|
17
|
-
* Nothing here imports from "ai" or "@ai-sdk/*". The base class is a
|
|
18
|
-
* direct HTTP client + multi-step tool-execution loop driven by SSE.
|
|
19
|
-
*/
|
|
20
|
-
import { trace } from "@opentelemetry/api";
|
|
21
|
-
import { getAvailableInputTokens, getRuntimeContextWindow, getRuntimeOutputCeiling, registerRuntimeContextWindow, } from "../constants/contextWindows.js";
|
|
22
|
-
import { guardOpenAICompatConversation } from "../context/openaiCompatLoopGuard.js";
|
|
23
|
-
import { isContextOverflowError, parseProviderOverflowDetails, } from "../context/errorDetection.js";
|
|
24
|
-
import { ContextBudgetExceededError } from "../context/errors.js";
|
|
25
|
-
import { BaseProvider } from "../core/baseProvider.js";
|
|
26
|
-
import { DEFAULT_MAX_STEPS } from "../core/constants.js";
|
|
27
|
-
import { streamAnalyticsCollector } from "../core/streamAnalytics.js";
|
|
28
|
-
import { createProxyFetch } from "../proxy/proxyFetch.js";
|
|
29
|
-
import { logger } from "../utils/logger.js";
|
|
30
|
-
import { redactUrlCredentials } from "../utils/logSanitize.js";
|
|
31
|
-
import { NoOutputGeneratedError } from "../utils/generationErrors.js";
|
|
32
|
-
import { buildNoOutputSentinel, stampNoOutputSpan, } from "../utils/noOutputSentinel.js";
|
|
33
|
-
import { composeAbortSignalsScoped, createTimeoutController, mergeAbortSignals, } from "../utils/timeout.js";
|
|
34
|
-
import { emitToolEndFromStepFinish } from "../utils/toolEndEmitter.js";
|
|
35
|
-
import { resolveToolChoice } from "../utils/toolChoice.js";
|
|
36
|
-
import { transformToolExecutions } from "../utils/transformationUtils.js";
|
|
37
|
-
import { withProviderRetry } from "../utils/providerRetry.js";
|
|
38
|
-
import { resolveDeferredTool } from "../tools/toolDiscovery.js";
|
|
39
|
-
import { buildAPIError, buildBody, buildToolsForOpenAI, buildWireToolNameMaps, createDeferredAnalytics, ensureJsonWordInBody, estimateWireTokens, mapNeuroLinkToolChoice, mergeUsage, messageBuilderToOpenAI, parseSSEStream, stringifyToolOutput, stripTrailingSlash, v3ResponseFormatToOpenAI, v3ToolChoiceToOpenAI, v3ToolsToOpenAI, } from "./openaiChatCompletionsClient.js";
|
|
40
|
-
import { createStreamChannel } from "../core/streamChannel.js";
|
|
41
|
-
/**
|
|
42
|
-
* Safety margin (tokens) when fitting `max_tokens` to a runtime-discovered
|
|
43
|
-
* context window: the char-based input estimate and the backend's own prompt
|
|
44
|
-
* framing differ by a few hundred tokens, so an exact fit would still 400.
|
|
45
|
-
*/
|
|
46
|
-
const WINDOW_FIT_MARGIN_TOKENS = 512;
|
|
47
|
-
/**
|
|
48
|
-
* Abstract HTTP+SSE provider for OpenAI chat-completions-shaped endpoints.
|
|
49
|
-
*/
|
|
50
|
-
export class OpenAIChatCompletionsProvider extends BaseProvider {
|
|
51
|
-
config;
|
|
52
|
-
resolvedModel;
|
|
53
|
-
constructor(providerName, modelName, sdk, config) {
|
|
54
|
-
super(modelName, providerName, sdk);
|
|
55
|
-
this.config = config;
|
|
56
|
-
}
|
|
57
|
-
// ===========================================================================
|
|
58
|
-
// Optional overridable hooks
|
|
59
|
-
// ===========================================================================
|
|
60
|
-
/**
|
|
61
|
-
* Model name to return when `getDefaultModel()` is empty AND
|
|
62
|
-
* auto-discovery via `/models` finds nothing. Default "gpt-3.5-turbo".
|
|
63
|
-
*/
|
|
64
|
-
getFallbackModelName() {
|
|
65
|
-
return "gpt-3.5-turbo";
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Hardcoded model names returned from `getAvailableModels()` when the
|
|
69
|
-
* remote `/models` endpoint can't be reached. Default empty.
|
|
70
|
-
*/
|
|
71
|
-
getFallbackModels() {
|
|
72
|
-
return [];
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Hook to mutate the `buildBody` options before the wire body is
|
|
76
|
-
* constructed. Default identity. Override for model-specific quirks
|
|
77
|
-
* (e.g. LiteLLM's Gemini 2.5 maxTokens skip).
|
|
78
|
-
*/
|
|
79
|
-
adjustBuildBodyOptions(_modelId, opts) {
|
|
80
|
-
return opts;
|
|
81
|
-
}
|
|
82
|
-
/**
|
|
83
|
-
* Hook to adjust the OpenAI `response_format` after it's converted from the
|
|
84
|
-
* V3 responseFormat (non-streaming `doGenerate` path). Default identity.
|
|
85
|
-
* Override for providers that don't support a given format type — e.g.
|
|
86
|
-
* DeepSeek rejects `response_format: { type: "json_schema" }` ("This
|
|
87
|
-
* response_format type is unavailable now"); the `@ai-sdk/openai-compatible`
|
|
88
|
-
* path this replaced declared `supportsStructuredOutputs: false`, which
|
|
89
|
-
* downgraded `json_schema` to `json_object`. Subclasses replicate that here.
|
|
90
|
-
*/
|
|
91
|
-
adjustResponseFormat(rf, _modelId) {
|
|
92
|
-
return rf;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* When true (default), `response_format` is NOT sent on requests that carry
|
|
96
|
-
* tools. The AI SDK sets responseFormat on EVERY step of a tool loop, and
|
|
97
|
-
* generic/proxy backends (LiteLLM→vllm/GLM, openai-compatible, local
|
|
98
|
-
* servers) may silently honor it over tool calling — answering with
|
|
99
|
-
* final-shape JSON on step 1 instead of running the agentic loop. No error
|
|
100
|
-
* is raised, so the runtime tools↔schema conflict detector cannot catch it.
|
|
101
|
-
* The schema is still enforced post-hoc (GenerationHandler coerces the final
|
|
102
|
-
* text against it) — the same contract as the Gemini tools↔schema exclusion.
|
|
103
|
-
* Mirrors the streaming path, which never sends response_format.
|
|
104
|
-
*
|
|
105
|
-
* Backends with first-party support for tools + json_schema in one request
|
|
106
|
-
* (OpenAI, Azure OpenAI) override this to false.
|
|
107
|
-
*/
|
|
108
|
-
suppressResponseFormatWithTools() {
|
|
109
|
-
return true;
|
|
110
|
-
}
|
|
111
|
-
/**
|
|
112
|
-
* Hook to adjust the fully-built wire request body before it is sent, on
|
|
113
|
-
* both the streaming and non-streaming paths. Default identity. Override for
|
|
114
|
-
* provider/model quirks that can't be expressed through buildBody options —
|
|
115
|
-
* e.g. Azure's newer reasoning deployments (o-series, gpt-5+) reject
|
|
116
|
-
* `max_tokens` and require `max_completion_tokens`.
|
|
117
|
-
*/
|
|
118
|
-
adjustRequestBody(body, _modelId) {
|
|
119
|
-
return body;
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Hook called when a request fails with HTTP 400. Return a modified body to
|
|
123
|
-
* retry ONCE with it; return undefined (default) to propagate the error
|
|
124
|
-
* unchanged. Applies on both the non-streaming doGenerate path and the
|
|
125
|
-
* streaming path. NVIDIA NIM uses this to strip `chat_template` /
|
|
126
|
-
* `chat_template_kwargs.reasoning_budget` when a model server rejects them,
|
|
127
|
-
* restoring the pre-migration fetch-level retry behavior.
|
|
128
|
-
*/
|
|
129
|
-
adjustBodyAfter400(_body, _error) {
|
|
130
|
-
return undefined;
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* Fit the outgoing `max_tokens` to what the target deployment can actually
|
|
134
|
-
* accept, using ONLY runtime-discovered limits — static table values are
|
|
135
|
-
* guesses, and hard-enforcing a guess would falsely reject requests the
|
|
136
|
-
* real deployment accepts:
|
|
137
|
-
*
|
|
138
|
-
* effective = min(requested, discovered output ceiling,
|
|
139
|
-
* discovered window − estimated input − margin)
|
|
140
|
-
*
|
|
141
|
-
* Returns the caller's value untouched when nothing was discovered, and
|
|
142
|
-
* `undefined` when the caller sent nothing and no ceiling is known (the
|
|
143
|
-
* wire then omits max_tokens and the backend applies its own default — no
|
|
144
|
-
* invented numbers). Throws ContextBudgetExceededError when the estimated
|
|
145
|
-
* input ALONE exceeds a discovered window: that request cannot succeed,
|
|
146
|
-
* and failing fast with honest numbers beats a guaranteed provider 400
|
|
147
|
-
* (plus any proxy-side fallback cascade) after a full round-trip.
|
|
148
|
-
*/
|
|
149
|
-
resolveWireMaxTokens(modelId, requested, messages, tools) {
|
|
150
|
-
const ceiling = getRuntimeOutputCeiling(this.providerName, modelId);
|
|
151
|
-
let effective = requested;
|
|
152
|
-
if (ceiling !== undefined &&
|
|
153
|
-
(effective === undefined || effective > ceiling)) {
|
|
154
|
-
if (effective !== undefined) {
|
|
155
|
-
logger.debug(`${this.providerName}: clamping max_tokens ${effective} to the advertised ${modelId} output ceiling ${ceiling}`);
|
|
156
|
-
}
|
|
157
|
-
effective = ceiling;
|
|
158
|
-
}
|
|
159
|
-
const window = getRuntimeContextWindow(this.providerName, modelId);
|
|
160
|
-
if (window !== undefined) {
|
|
161
|
-
const estimatedInput = estimateWireTokens(messages, tools, this.providerName);
|
|
162
|
-
const fit = window - estimatedInput - WINDOW_FIT_MARGIN_TOKENS;
|
|
163
|
-
if (fit <= 0) {
|
|
164
|
-
throw new ContextBudgetExceededError(`Estimated input (${estimatedInput} tokens) alone exceeds the ` +
|
|
165
|
-
`${this.providerName}/${modelId} context window advertised by ` +
|
|
166
|
-
`the serving infrastructure (${window} tokens). Reduce the ` +
|
|
167
|
-
`prompt/conversation size — no max_tokens value can make this ` +
|
|
168
|
-
`request fit.`, {
|
|
169
|
-
estimatedTokens: estimatedInput,
|
|
170
|
-
availableTokens: Math.max(0, window - WINDOW_FIT_MARGIN_TOKENS),
|
|
171
|
-
stagesUsed: [],
|
|
172
|
-
breakdown: {},
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
if (effective !== undefined && effective > fit) {
|
|
176
|
-
logger.warn(`${this.providerName}: max_tokens ${effective} cannot fit the ` +
|
|
177
|
-
`${modelId} window (${window}) with ~${estimatedInput} input ` +
|
|
178
|
-
`tokens — re-fitting to ${fit}`);
|
|
179
|
-
effective = fit;
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return effective;
|
|
183
|
-
}
|
|
184
|
-
/**
|
|
185
|
-
* Learn from a provider context-overflow 400 and, when possible, produce a
|
|
186
|
-
* corrected body for the one-shot retry slot. Two dynamic effects, zero
|
|
187
|
-
* static data:
|
|
188
|
-
*
|
|
189
|
-
* - the window stated in the error is registered with the runtime
|
|
190
|
-
* resolver, so every later budget check / compaction / max_tokens fit
|
|
191
|
-
* uses the backend's own number — self-healing even when a discovery
|
|
192
|
-
* endpoint (`/model/info`) is absent or unauthorized;
|
|
193
|
-
* - when the error also states the real input size (vllm/LiteLLM
|
|
194
|
-
* phrasing) and the body carried `max_tokens`, it is re-fit to
|
|
195
|
-
* `window − input − margin` and the request retried once.
|
|
196
|
-
*
|
|
197
|
-
* Returns undefined when the error is not an overflow, or when no smaller
|
|
198
|
-
* `max_tokens` can make the request fit (input alone too large) — the
|
|
199
|
-
* original error then propagates unchanged.
|
|
200
|
-
*/
|
|
201
|
-
correctBodyAfterContextOverflow(body, error) {
|
|
202
|
-
if (!isContextOverflowError(error)) {
|
|
203
|
-
return undefined;
|
|
204
|
-
}
|
|
205
|
-
const details = parseProviderOverflowDetails(error) ??
|
|
206
|
-
parseProviderOverflowDetails(error.responseBody);
|
|
207
|
-
if (!details || details.budgetTokens <= 0) {
|
|
208
|
-
return undefined;
|
|
209
|
-
}
|
|
210
|
-
registerRuntimeContextWindow(this.providerName, body.model, details.budgetTokens);
|
|
211
|
-
// When the body carried no max_tokens (server-defaulted output), the
|
|
212
|
-
// vllm/LiteLLM phrasing still states what the backend counted — use it
|
|
213
|
-
// so those requests get a re-fit retry too instead of propagating.
|
|
214
|
-
const previousMaxTokens = typeof body.max_tokens === "number"
|
|
215
|
-
? body.max_tokens
|
|
216
|
-
: details.requestedOutputTokens;
|
|
217
|
-
if (previousMaxTokens === undefined || details.actualTokens <= 0) {
|
|
218
|
-
return undefined;
|
|
219
|
-
}
|
|
220
|
-
const refit = details.budgetTokens - details.actualTokens - WINDOW_FIT_MARGIN_TOKENS;
|
|
221
|
-
if (refit <= 0 || refit >= previousMaxTokens) {
|
|
222
|
-
return undefined;
|
|
223
|
-
}
|
|
224
|
-
logger.warn(`${this.providerName}: ${body.model} rejected the request as over-window — retrying once with max_tokens re-fit from the provider's own numbers`, {
|
|
225
|
-
window: details.budgetTokens,
|
|
226
|
-
inputTokens: details.actualTokens,
|
|
227
|
-
previousMaxTokens,
|
|
228
|
-
refitMaxTokens: refit,
|
|
229
|
-
});
|
|
230
|
-
return { ...body, max_tokens: refit };
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Hook called once at the start of every `executeStream` invocation.
|
|
234
|
-
* Return lifecycle listeners (onUsage / onFinish) to receive deferred
|
|
235
|
-
* analytics events as the stream progresses. Default returns undefined
|
|
236
|
-
* (no extra wiring). LiteLLM uses this for the OTel span wrap with cost.
|
|
237
|
-
*/
|
|
238
|
-
onStreamStart(_modelId) {
|
|
239
|
-
return undefined;
|
|
240
|
-
}
|
|
241
|
-
/**
|
|
242
|
-
* Returns true if `resolveModelName` should fall back to fetching
|
|
243
|
-
* `getAvailableModels()` and picking the first one when no explicit
|
|
244
|
-
* model is configured. Default true. Subclasses with a non-empty
|
|
245
|
-
* `getDefaultModel()` will never hit this branch anyway.
|
|
246
|
-
*/
|
|
247
|
-
shouldAutoDiscoverModel() {
|
|
248
|
-
return true;
|
|
249
|
-
}
|
|
250
|
-
/**
|
|
251
|
-
* Builds the chat-completions request URL for a model. Default is
|
|
252
|
-
* `${baseURL}/chat/completions`. Override for providers with a different
|
|
253
|
-
* routing scheme (e.g. Azure's deployment-based path + api-version query).
|
|
254
|
-
*/
|
|
255
|
-
getChatCompletionsURL(_modelId) {
|
|
256
|
-
return `${stripTrailingSlash(this.config.baseURL)}/chat/completions`;
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Auth headers merged into every request. Default is a Bearer token.
|
|
260
|
-
* Override for providers that authenticate differently (e.g. Azure, which
|
|
261
|
-
* uses an `api-key` header instead of `Authorization: Bearer`).
|
|
262
|
-
*/
|
|
263
|
-
getAuthHeaders() {
|
|
264
|
-
return { Authorization: `Bearer ${this.config.apiKey}` };
|
|
265
|
-
}
|
|
266
|
-
// ===========================================================================
|
|
267
|
-
// Public/protected concrete methods (shared by all subclasses)
|
|
268
|
-
// ===========================================================================
|
|
269
|
-
/**
|
|
270
|
-
* Health-check hook — part of the documented public provider contract
|
|
271
|
-
* (`docs/provider-integration/00-architecture.md`). Default returns true
|
|
272
|
-
* when an apiKey is configured; local providers (LM Studio, llama.cpp)
|
|
273
|
-
* override this to probe the server's `/models` endpoint.
|
|
274
|
-
*/
|
|
275
|
-
async validateConfiguration() {
|
|
276
|
-
return (typeof this.config.apiKey === "string" &&
|
|
277
|
-
this.config.apiKey.trim().length > 0);
|
|
278
|
-
}
|
|
279
|
-
/**
|
|
280
|
-
* Shared local-runtime reachability probe: GET `${baseURL}/models` with a
|
|
281
|
-
* short timeout, requiring at least one model entry with a non-empty id.
|
|
282
|
-
* Local providers (Ollama, LM Studio, llama.cpp) call this from their own
|
|
283
|
-
* validateConfiguration() override instead of relying on the base class's
|
|
284
|
-
* "apiKey is a non-empty string" default, which can't detect an
|
|
285
|
-
* unreachable local server.
|
|
286
|
-
*/
|
|
287
|
-
async probeModelsEndpoint(headers = {}) {
|
|
288
|
-
try {
|
|
289
|
-
const url = `${stripTrailingSlash(this.config.baseURL)}/models`;
|
|
290
|
-
const proxyFetch = createProxyFetch();
|
|
291
|
-
const response = await proxyFetch(url, {
|
|
292
|
-
headers: { ...headers, "Content-Type": "application/json" },
|
|
293
|
-
signal: AbortSignal.timeout(5000),
|
|
294
|
-
});
|
|
295
|
-
if (!response.ok) {
|
|
296
|
-
return false;
|
|
297
|
-
}
|
|
298
|
-
const data = (await response
|
|
299
|
-
.json()
|
|
300
|
-
.catch(() => null));
|
|
301
|
-
return Boolean(data?.data?.some((m) => typeof m?.id === "string" && m.id.trim().length > 0));
|
|
302
|
-
}
|
|
303
|
-
catch (error) {
|
|
304
|
-
logger.debug(`[${this.constructor.name}] probeModelsEndpoint failed`, {
|
|
305
|
-
baseURL: redactUrlCredentials(this.config.baseURL),
|
|
306
|
-
error: error instanceof Error ? error.message : String(error),
|
|
307
|
-
});
|
|
308
|
-
return false;
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
/**
|
|
312
|
-
* Snapshot of the provider's resolved configuration — part of the documented
|
|
313
|
-
* public provider contract (`docs/provider-integration/00-architecture.md`).
|
|
314
|
-
* Subclasses inherit this; override only to expose extra fields.
|
|
315
|
-
*/
|
|
316
|
-
getConfiguration() {
|
|
317
|
-
return {
|
|
318
|
-
provider: this.providerName,
|
|
319
|
-
model: this.modelName,
|
|
320
|
-
defaultModel: this.getDefaultModel(),
|
|
321
|
-
baseURL: this.config.baseURL,
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
/**
|
|
325
|
-
* Returns a minimal V3-shaped model used by BaseProvider's `generate()`
|
|
326
|
-
* non-streaming path. Driven by the parent's `generateText`. The
|
|
327
|
-
* streaming path bypasses this entirely.
|
|
328
|
-
*/
|
|
329
|
-
async getAISDKModel() {
|
|
330
|
-
const modelId = await this.resolveModelName();
|
|
331
|
-
// buildDelegatingModel returns `unknown`, so this is a single
|
|
332
|
-
// unknown-to-target assertion.
|
|
333
|
-
return this.buildDelegatingModel(modelId);
|
|
334
|
-
}
|
|
335
|
-
async resolveModelName() {
|
|
336
|
-
if (this.resolvedModel) {
|
|
337
|
-
return this.resolvedModel;
|
|
338
|
-
}
|
|
339
|
-
const explicit = this.modelName || this.getDefaultModel();
|
|
340
|
-
if (explicit && explicit.trim() !== "") {
|
|
341
|
-
this.resolvedModel = explicit;
|
|
342
|
-
if (this.modelName !== explicit) {
|
|
343
|
-
this.refreshHandlersForModel(explicit);
|
|
344
|
-
}
|
|
345
|
-
return explicit;
|
|
346
|
-
}
|
|
347
|
-
if (this.shouldAutoDiscoverModel()) {
|
|
348
|
-
try {
|
|
349
|
-
const available = await this.getAvailableModels();
|
|
350
|
-
if (available.length > 0) {
|
|
351
|
-
this.resolvedModel = available[0];
|
|
352
|
-
this.refreshHandlersForModel(available[0]);
|
|
353
|
-
logger.info(`🔍 Auto-discovered model: ${available[0]} from ${available.length} available models`);
|
|
354
|
-
return available[0];
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
catch (err) {
|
|
358
|
-
logger.warn("Model auto-discovery failed, using fallback:", err);
|
|
359
|
-
}
|
|
360
|
-
// Auto-discovery was attempted but yielded no model (local server/model
|
|
361
|
-
// not up yet, transient probe failure, …). Use the fallback for THIS
|
|
362
|
-
// call but persist NOTHING — not `resolvedModel`, and not `this.modelName`
|
|
363
|
-
// either. `refreshHandlersForModel()` sets `this.modelName = model`, which
|
|
364
|
-
// the explicit branch above would then memoize on the next call, pinning
|
|
365
|
-
// the instance to the fallback and defeating the retry. Returning the
|
|
366
|
-
// bare fallback (it is still used as the wire `modelId`) lets a later
|
|
367
|
-
// call re-probe once the server/model becomes available — matching the
|
|
368
|
-
// pre-migration local providers.
|
|
369
|
-
return this.getFallbackModelName();
|
|
370
|
-
}
|
|
371
|
-
// No auto-discovery for this provider — the fallback is stable, so memoize
|
|
372
|
-
// it (and refresh handlers so telemetry/pricing reflect the resolved name).
|
|
373
|
-
const fallback = this.getFallbackModelName();
|
|
374
|
-
this.resolvedModel = fallback;
|
|
375
|
-
this.refreshHandlersForModel(fallback);
|
|
376
|
-
return fallback;
|
|
377
|
-
}
|
|
378
|
-
buildDelegatingModel(modelId) {
|
|
379
|
-
const url = this.getChatCompletionsURL(modelId);
|
|
380
|
-
const fetchImpl = createProxyFetch();
|
|
381
|
-
const getAuthHeaders = this.getAuthHeaders.bind(this);
|
|
382
|
-
const providerName = this.providerName;
|
|
383
|
-
const adjustBuildBodyOptions = this.adjustBuildBodyOptions.bind(this);
|
|
384
|
-
const adjustResponseFormat = this.adjustResponseFormat.bind(this);
|
|
385
|
-
const adjustRequestBody = this.adjustRequestBody.bind(this);
|
|
386
|
-
const adjustBodyAfter400 = this.adjustBodyAfter400.bind(this);
|
|
387
|
-
const correctBodyAfterContextOverflow = this.correctBodyAfterContextOverflow.bind(this);
|
|
388
|
-
const resolveWireMaxTokens = this.resolveWireMaxTokens.bind(this);
|
|
389
|
-
const suppressResponseFormatWithTools = this.suppressResponseFormatWithTools.bind(this);
|
|
390
|
-
const getTimeoutForOptions = (opts) => this.getTimeout((opts ?? {}));
|
|
391
|
-
return {
|
|
392
|
-
specificationVersion: "v3",
|
|
393
|
-
provider: providerName,
|
|
394
|
-
modelId,
|
|
395
|
-
supportedUrls: {},
|
|
396
|
-
doGenerate: async (options) => {
|
|
397
|
-
// Wire-name mapping: only materializes when at least one tool name
|
|
398
|
-
// is outside the OpenAI-compatible alphabet (see
|
|
399
|
-
// buildWireToolNameMaps) — the common all-valid case is a no-op.
|
|
400
|
-
const wireNameMaps = buildWireToolNameMaps((options.tools ?? [])
|
|
401
|
-
.filter((t) => t.type === "function")
|
|
402
|
-
.map((t) => t.name));
|
|
403
|
-
const baseMessages = messageBuilderToOpenAI(options.prompt, wireNameMaps?.toWire);
|
|
404
|
-
const hasTools = Array.isArray(options.tools) && options.tools.length > 0;
|
|
405
|
-
const responseFormat = options.responseFormat &&
|
|
406
|
-
!(hasTools && suppressResponseFormatWithTools())
|
|
407
|
-
? adjustResponseFormat(v3ResponseFormatToOpenAI(options.responseFormat), modelId)
|
|
408
|
-
: undefined;
|
|
409
|
-
// ensureJsonWordInBody runs LAST — on the body after adjustRequestBody —
|
|
410
|
-
// so the json_object word guard reflects whatever a subclass left on
|
|
411
|
-
// the wire (it may rewrite response_format/messages), not an
|
|
412
|
-
// intermediate state.
|
|
413
|
-
const wireTools = v3ToolsToOpenAI(options.tools, wireNameMaps?.toWire);
|
|
414
|
-
// Fit max_tokens to the runtime-discovered output ceiling and
|
|
415
|
-
// context window (no-op when nothing was discovered).
|
|
416
|
-
const wireMaxTokens = resolveWireMaxTokens(modelId, options.maxOutputTokens, baseMessages, wireTools);
|
|
417
|
-
const body = ensureJsonWordInBody(adjustRequestBody(buildBody({
|
|
418
|
-
modelId,
|
|
419
|
-
messages: baseMessages,
|
|
420
|
-
options: adjustBuildBodyOptions(modelId, {
|
|
421
|
-
maxTokens: wireMaxTokens,
|
|
422
|
-
temperature: options.temperature,
|
|
423
|
-
topP: options.topP,
|
|
424
|
-
presencePenalty: options.presencePenalty,
|
|
425
|
-
frequencyPenalty: options.frequencyPenalty,
|
|
426
|
-
seed: options.seed,
|
|
427
|
-
stopSequences: options.stopSequences,
|
|
428
|
-
}),
|
|
429
|
-
tools: wireTools,
|
|
430
|
-
...(options.toolChoice
|
|
431
|
-
? {
|
|
432
|
-
toolChoice: v3ToolChoiceToOpenAI(options.toolChoice, wireNameMaps?.toWire),
|
|
433
|
-
}
|
|
434
|
-
: {}),
|
|
435
|
-
streaming: false,
|
|
436
|
-
...(responseFormat ? { responseFormat } : {}),
|
|
437
|
-
}), modelId));
|
|
438
|
-
// Per-step timeout: the AI-SDK V3 call options never carry `timeout`,
|
|
439
|
-
// so resolving from them always returned the provider default — a
|
|
440
|
-
// caller's explicit `timeout: "15m"` bounded the outer loop but each
|
|
441
|
-
// step request stayed capped at the default (litellm: 5m). The
|
|
442
|
-
// orchestrator forwards the caller's resolved timeout via
|
|
443
|
-
// providerOptions.neurolink.timeoutMs; prefer it when present.
|
|
444
|
-
const nlStepTimeoutMs = options.providerOptions?.neurolink?.timeoutMs;
|
|
445
|
-
const timeoutController = createTimeoutController(typeof nlStepTimeoutMs === "number"
|
|
446
|
-
? nlStepTimeoutMs
|
|
447
|
-
: getTimeoutForOptions(options), providerName, "generate");
|
|
448
|
-
// Scoped composition: a plain AbortSignal.any per step accumulates
|
|
449
|
-
// registrations on the long-lived generate-call signal for the whole
|
|
450
|
-
// turn (MaxListenersExceededWarning at 10+ steps); dispose() detaches
|
|
451
|
-
// this step's listeners the moment the request settles.
|
|
452
|
-
const { signal: composedSignal, dispose: disposeComposedSignal } = composeAbortSignalsScoped(options.abortSignal, timeoutController?.controller.signal);
|
|
453
|
-
let json;
|
|
454
|
-
try {
|
|
455
|
-
let res = await fetchImpl(url, {
|
|
456
|
-
method: "POST",
|
|
457
|
-
headers: {
|
|
458
|
-
"Content-Type": "application/json",
|
|
459
|
-
...getAuthHeaders(),
|
|
460
|
-
},
|
|
461
|
-
body: JSON.stringify(body),
|
|
462
|
-
...(composedSignal ? { signal: composedSignal } : {}),
|
|
463
|
-
});
|
|
464
|
-
if (!res.ok) {
|
|
465
|
-
const apiErr = await buildAPIError(url, body, res);
|
|
466
|
-
// One-shot 400 retry. The overflow corrector runs FIRST (it can
|
|
467
|
-
// re-fit max_tokens from the provider's own numbers and also
|
|
468
|
-
// self-heals the runtime window registry); its output then feeds
|
|
469
|
-
// a subclass hook that may strip a rejected field (e.g. NIM's
|
|
470
|
-
// chat_template / reasoning_budget), so a body that needs BOTH
|
|
471
|
-
// fixes gets both — a plain `??` between the two would let
|
|
472
|
-
// whichever ran first silently win and drop the other's fix. The
|
|
473
|
-
// retry runs under the SAME timeout controller as the first
|
|
474
|
-
// attempt, so the configured timeout caps the overall call —
|
|
475
|
-
// matching the streaming path, which reuses its composed signal
|
|
476
|
-
// for the retry.
|
|
477
|
-
const retryBody = res.status === 400
|
|
478
|
-
? (() => {
|
|
479
|
-
const typedErr = apiErr;
|
|
480
|
-
const overflowCorrected = correctBodyAfterContextOverflow(body, typedErr);
|
|
481
|
-
return (adjustBodyAfter400(overflowCorrected ?? body, typedErr) ??
|
|
482
|
-
overflowCorrected);
|
|
483
|
-
})()
|
|
484
|
-
: undefined;
|
|
485
|
-
if (!retryBody) {
|
|
486
|
-
throw apiErr;
|
|
487
|
-
}
|
|
488
|
-
res = await fetchImpl(url, {
|
|
489
|
-
method: "POST",
|
|
490
|
-
headers: {
|
|
491
|
-
"Content-Type": "application/json",
|
|
492
|
-
...getAuthHeaders(),
|
|
493
|
-
},
|
|
494
|
-
body: JSON.stringify(retryBody),
|
|
495
|
-
...(composedSignal ? { signal: composedSignal } : {}),
|
|
496
|
-
});
|
|
497
|
-
if (!res.ok) {
|
|
498
|
-
throw await buildAPIError(url, retryBody, res);
|
|
499
|
-
}
|
|
500
|
-
}
|
|
501
|
-
// Body read stays INSIDE the timeout window: it previously ran
|
|
502
|
-
// after cleanup(), so a response whose headers arrived but whose
|
|
503
|
-
// body stalled mid-transfer was bounded by nothing but the caller's
|
|
504
|
-
// outer wall-clock.
|
|
505
|
-
json = (await res.json());
|
|
506
|
-
}
|
|
507
|
-
finally {
|
|
508
|
-
timeoutController?.cleanup();
|
|
509
|
-
disposeComposedSignal();
|
|
510
|
-
}
|
|
511
|
-
const choice = json.choices?.[0];
|
|
512
|
-
const text = (typeof choice?.message?.content === "string"
|
|
513
|
-
? choice.message.content
|
|
514
|
-
: "") ?? "";
|
|
515
|
-
const content = [];
|
|
516
|
-
// Reasoner-model output (DeepSeek `reasoning_content`, gateway
|
|
517
|
-
// `reasoning`) becomes a V3 reasoning part ahead of the text part —
|
|
518
|
-
// GenerationHandler joins reasoning parts into `result.reasoning`.
|
|
519
|
-
// `||` so an empty-string reasoning_content falls through to a
|
|
520
|
-
// non-empty `reasoning` field instead of shadowing it.
|
|
521
|
-
const reasoningText = choice?.message?.reasoning_content || choice?.message?.reasoning;
|
|
522
|
-
if (typeof reasoningText === "string" && reasoningText.length > 0) {
|
|
523
|
-
content.push({ type: "reasoning", text: reasoningText });
|
|
524
|
-
}
|
|
525
|
-
if (text.length > 0) {
|
|
526
|
-
content.push({ type: "text", text });
|
|
527
|
-
}
|
|
528
|
-
for (const tc of choice?.message?.tool_calls ?? []) {
|
|
529
|
-
content.push({
|
|
530
|
-
type: "tool-call",
|
|
531
|
-
toolCallId: tc.id,
|
|
532
|
-
// Reverse-map wire names so tool lookup/execution and results
|
|
533
|
-
// reported to the caller use the registered names.
|
|
534
|
-
toolName: wireNameMaps?.fromWire.get(tc.function.name) ?? tc.function.name,
|
|
535
|
-
input: tc.function.arguments ?? "",
|
|
536
|
-
});
|
|
537
|
-
}
|
|
538
|
-
const rawFinish = choice?.finish_reason;
|
|
539
|
-
const unified = rawFinish === "length"
|
|
540
|
-
? "length"
|
|
541
|
-
: rawFinish === "tool_calls" || rawFinish === "function_call"
|
|
542
|
-
? "tool-calls"
|
|
543
|
-
: rawFinish === "content_filter"
|
|
544
|
-
? "content-filter"
|
|
545
|
-
: "stop";
|
|
546
|
-
return {
|
|
547
|
-
content,
|
|
548
|
-
finishReason: { unified, raw: rawFinish ?? "stop" },
|
|
549
|
-
usage: {
|
|
550
|
-
inputTokens: {
|
|
551
|
-
total: json.usage?.prompt_tokens,
|
|
552
|
-
// cached_tokens is OVERLAPPING (a subset of prompt_tokens), so
|
|
553
|
-
// noCache is the remainder and cacheRead is clamped to the
|
|
554
|
-
// prompt total — some gateways report inconsistent usage where
|
|
555
|
-
// cached_tokens exceeds prompt_tokens (mirrors the
|
|
556
|
-
// reasoning_tokens clamp on the output side below).
|
|
557
|
-
noCache: json.usage?.prompt_tokens !== undefined &&
|
|
558
|
-
json.usage?.prompt_tokens_details?.cached_tokens !== undefined
|
|
559
|
-
? Math.max(0, json.usage.prompt_tokens -
|
|
560
|
-
json.usage.prompt_tokens_details.cached_tokens)
|
|
561
|
-
: json.usage?.prompt_tokens,
|
|
562
|
-
cacheRead: json.usage?.prompt_tokens !== undefined &&
|
|
563
|
-
json.usage?.prompt_tokens_details?.cached_tokens !== undefined
|
|
564
|
-
? Math.min(json.usage.prompt_tokens_details.cached_tokens, json.usage.prompt_tokens)
|
|
565
|
-
: json.usage?.prompt_tokens_details?.cached_tokens,
|
|
566
|
-
// OpenAI-style APIs do not report cache writes.
|
|
567
|
-
cacheWrite: undefined,
|
|
568
|
-
},
|
|
569
|
-
outputTokens: {
|
|
570
|
-
total: json.usage?.completion_tokens,
|
|
571
|
-
// Clamped at 0 — some gateways report inconsistent usage where
|
|
572
|
-
// reasoning_tokens exceeds completion_tokens.
|
|
573
|
-
text: json.usage?.completion_tokens !== undefined &&
|
|
574
|
-
json.usage?.completion_tokens_details?.reasoning_tokens !==
|
|
575
|
-
undefined
|
|
576
|
-
? Math.max(0, json.usage.completion_tokens -
|
|
577
|
-
json.usage.completion_tokens_details.reasoning_tokens)
|
|
578
|
-
: json.usage?.completion_tokens,
|
|
579
|
-
reasoning: json.usage?.completion_tokens_details?.reasoning_tokens,
|
|
580
|
-
},
|
|
581
|
-
},
|
|
582
|
-
warnings: [],
|
|
583
|
-
request: { body },
|
|
584
|
-
response: {
|
|
585
|
-
...(json.id ? { id: json.id } : {}),
|
|
586
|
-
...(json.model ? { modelId: json.model } : {}),
|
|
587
|
-
headers: {},
|
|
588
|
-
body: json,
|
|
589
|
-
},
|
|
590
|
-
};
|
|
591
|
-
},
|
|
592
|
-
doStream: () => {
|
|
593
|
-
throw new Error(`${providerName}: doStream is not implemented on the delegating model — the streaming path uses executeStream directly.`);
|
|
594
|
-
},
|
|
595
|
-
};
|
|
596
|
-
}
|
|
597
|
-
/**
|
|
598
|
-
* Streaming path — drives the chat-completions endpoint directly. No
|
|
599
|
-
* streamText, no AI SDK orchestrator. Tool calls, multi-step loops,
|
|
600
|
-
* telemetry, abort handling all inline.
|
|
601
|
-
*/
|
|
602
|
-
async executeStream(options, _analysisSchema) {
|
|
603
|
-
this.validateStreamOptions(options);
|
|
604
|
-
const startTime = Date.now();
|
|
605
|
-
const timeout = this.getTimeout(options);
|
|
606
|
-
const timeoutController = createTimeoutController(timeout, this.providerName, "stream");
|
|
607
|
-
// Consumer-driven abort: fires when the async iterator is closed early
|
|
608
|
-
// (caller breaks out of `for await`). Without this the background
|
|
609
|
-
// `loopPromise` keeps reading SSE and running tools indefinitely.
|
|
610
|
-
const consumerAbortController = new AbortController();
|
|
611
|
-
const abortSignal = mergeAbortSignals([
|
|
612
|
-
options.abortSignal,
|
|
613
|
-
timeoutController?.controller.signal,
|
|
614
|
-
consumerAbortController.signal,
|
|
615
|
-
]).signal;
|
|
616
|
-
let modelId;
|
|
617
|
-
let toolsRecord;
|
|
618
|
-
let wireNameMaps;
|
|
619
|
-
let openAITools;
|
|
620
|
-
let openAIToolChoice;
|
|
621
|
-
let conversation;
|
|
622
|
-
try {
|
|
623
|
-
modelId = await this.resolveModelName();
|
|
624
|
-
const shouldUseTools = !options.disableTools && this.supportsTools();
|
|
625
|
-
toolsRecord = shouldUseTools
|
|
626
|
-
? options.tools || (await this.getAllTools())
|
|
627
|
-
: {};
|
|
628
|
-
// Wire-name mapping: only materializes when a registered tool name is
|
|
629
|
-
// outside the OpenAI-compatible alphabet (see buildWireToolNameMaps).
|
|
630
|
-
wireNameMaps = shouldUseTools
|
|
631
|
-
? buildWireToolNameMaps(Object.keys(toolsRecord))
|
|
632
|
-
: undefined;
|
|
633
|
-
openAITools = shouldUseTools
|
|
634
|
-
? buildToolsForOpenAI(toolsRecord, wireNameMaps?.toWire)
|
|
635
|
-
: undefined;
|
|
636
|
-
openAIToolChoice = mapNeuroLinkToolChoice(resolveToolChoice(options, toolsRecord, shouldUseTools), wireNameMaps?.toWire);
|
|
637
|
-
const initialMessages = await this.buildMessagesForStream(options);
|
|
638
|
-
conversation = messageBuilderToOpenAI(initialMessages, wireNameMaps?.toWire);
|
|
639
|
-
}
|
|
640
|
-
catch (setupErr) {
|
|
641
|
-
timeoutController?.cleanup();
|
|
642
|
-
throw setupErr;
|
|
643
|
-
}
|
|
644
|
-
const url = this.getChatCompletionsURL(modelId);
|
|
645
|
-
const fetchImpl = createProxyFetch();
|
|
646
|
-
const maxSteps = options.maxSteps || DEFAULT_MAX_STEPS;
|
|
647
|
-
const emitter = this.neurolink?.getEventEmitter();
|
|
648
|
-
const toolsUsed = [];
|
|
649
|
-
const toolExecutionSummaries = [];
|
|
650
|
-
const { usagePromise, finishPromise, resolveUsage, resolveFinish } = createDeferredAnalytics();
|
|
651
|
-
const channel = createStreamChannel();
|
|
652
|
-
// Per-provider lifecycle hook (e.g. OTel span wrap for LiteLLM).
|
|
653
|
-
const lifecycle = this.onStreamStart(modelId);
|
|
654
|
-
const loopPromise = this.runStreamLoop({
|
|
655
|
-
maxSteps,
|
|
656
|
-
modelId,
|
|
657
|
-
url,
|
|
658
|
-
fetchImpl,
|
|
659
|
-
abortSignal,
|
|
660
|
-
options,
|
|
661
|
-
conversation,
|
|
662
|
-
openAITools,
|
|
663
|
-
openAIToolChoice,
|
|
664
|
-
toolsRecord,
|
|
665
|
-
toolNameFromWire: wireNameMaps?.fromWire,
|
|
666
|
-
emitter,
|
|
667
|
-
toolsUsed,
|
|
668
|
-
toolExecutionSummaries,
|
|
669
|
-
pushChunk: channel.push,
|
|
670
|
-
closeChannel: channel.close,
|
|
671
|
-
resolveUsage,
|
|
672
|
-
resolveFinish,
|
|
673
|
-
});
|
|
674
|
-
// Closure-scoped capture: the runStreamLoop's catch block stashes the
|
|
675
|
-
// underlying provider error here so we can pass it through to
|
|
676
|
-
// buildNoOutputSentinel for richer telemetry (matches the pattern in
|
|
677
|
-
// openAI.ts / litellm.ts where onError preserves the upstream cause).
|
|
678
|
-
let capturedProviderError;
|
|
679
|
-
// Parameter named `error` so the compiled `capturedProviderError = error`
|
|
680
|
-
// assignment matches the regression-grep in test:context 6.14.
|
|
681
|
-
const captureProviderError = (error) => {
|
|
682
|
-
capturedProviderError = error;
|
|
683
|
-
};
|
|
684
|
-
if (lifecycle?.onUsage) {
|
|
685
|
-
usagePromise.then(lifecycle.onUsage).catch(() => {
|
|
686
|
-
// usage may never resolve if the stream is aborted before completion
|
|
687
|
-
});
|
|
688
|
-
}
|
|
689
|
-
if (lifecycle?.onFinish) {
|
|
690
|
-
finishPromise
|
|
691
|
-
.then((reason) => lifecycle.onFinish?.(reason, capturedProviderError))
|
|
692
|
-
.catch(() => {
|
|
693
|
-
/* swallowed by design — see above */
|
|
694
|
-
});
|
|
695
|
-
}
|
|
696
|
-
const providerName = this.providerName;
|
|
697
|
-
const transformedStream = async function* () {
|
|
698
|
-
let contentYielded = 0;
|
|
699
|
-
try {
|
|
700
|
-
for await (const chunk of channel.iterable) {
|
|
701
|
-
if ("content" in chunk &&
|
|
702
|
-
typeof chunk.content === "string" &&
|
|
703
|
-
chunk.content.length > 0) {
|
|
704
|
-
contentYielded++;
|
|
705
|
-
}
|
|
706
|
-
yield chunk;
|
|
707
|
-
}
|
|
708
|
-
// Surface any error that the loop threw after we drained the channel.
|
|
709
|
-
await loopPromise;
|
|
710
|
-
// No-output path: stream completed normally but yielded zero text.
|
|
711
|
-
// Build an enriched sentinel + stamp the active OTel span so
|
|
712
|
-
// Pipeline B (ContextEnricher) surfaces a WARNING-level Langfuse
|
|
713
|
-
// observation instead of silently succeeding.
|
|
714
|
-
if (contentYielded === 0 && toolsUsed.length === 0) {
|
|
715
|
-
logger.warn(`${providerName}: Stream produced no output — emitting enriched sentinel`);
|
|
716
|
-
const fauxNoOutput = new NoOutputGeneratedError({
|
|
717
|
-
message: "Stream produced no output",
|
|
718
|
-
});
|
|
719
|
-
const sentinel = await buildNoOutputSentinel(fauxNoOutput, undefined, capturedProviderError);
|
|
720
|
-
stampNoOutputSpan(sentinel);
|
|
721
|
-
yield sentinel;
|
|
722
|
-
}
|
|
723
|
-
}
|
|
724
|
-
catch (streamError) {
|
|
725
|
-
if (NoOutputGeneratedError.isInstance(streamError)) {
|
|
726
|
-
const sentinel = await buildNoOutputSentinel(streamError, undefined, capturedProviderError);
|
|
727
|
-
stampNoOutputSpan(sentinel);
|
|
728
|
-
yield sentinel;
|
|
729
|
-
return;
|
|
730
|
-
}
|
|
731
|
-
const sentinel = await buildNoOutputSentinel(streamError, undefined, capturedProviderError);
|
|
732
|
-
stampNoOutputSpan(sentinel);
|
|
733
|
-
yield sentinel;
|
|
734
|
-
throw streamError;
|
|
735
|
-
}
|
|
736
|
-
finally {
|
|
737
|
-
if (!consumerAbortController.signal.aborted) {
|
|
738
|
-
consumerAbortController.abort();
|
|
739
|
-
}
|
|
740
|
-
}
|
|
741
|
-
};
|
|
742
|
-
const result = {
|
|
743
|
-
stream: transformedStream(),
|
|
744
|
-
provider: this.providerName,
|
|
745
|
-
model: modelId,
|
|
746
|
-
analytics: streamAnalyticsCollector.createAnalytics(this.providerName, modelId, {
|
|
747
|
-
textStream: (async function* () { })(),
|
|
748
|
-
usage: usagePromise,
|
|
749
|
-
finishReason: finishPromise,
|
|
750
|
-
}, Date.now() - startTime, {
|
|
751
|
-
requestId: options.requestId ??
|
|
752
|
-
`${this.providerName}-stream-${Date.now()}`,
|
|
753
|
-
streamingMode: true,
|
|
754
|
-
}),
|
|
755
|
-
toolsUsed,
|
|
756
|
-
metadata: {
|
|
757
|
-
startTime,
|
|
758
|
-
streamId: `${this.providerName}-${Date.now()}`,
|
|
759
|
-
},
|
|
760
|
-
};
|
|
761
|
-
// Lazy getter: every read transforms the live `toolExecutionSummaries`
|
|
762
|
-
// through the canonical `transformToolExecutions()` so consumers see
|
|
763
|
-
// `{name, input, output, duration}[]` (codebase convention), while still
|
|
764
|
-
// reflecting tools appended during streaming.
|
|
765
|
-
Object.defineProperty(result, "toolExecutions", {
|
|
766
|
-
enumerable: true,
|
|
767
|
-
configurable: true,
|
|
768
|
-
get: () => transformToolExecutions(toolExecutionSummaries.map((s) => ({
|
|
769
|
-
toolName: s.toolName,
|
|
770
|
-
input: s.input,
|
|
771
|
-
output: s.output,
|
|
772
|
-
duration: s.endTime.getTime() - s.startTime.getTime(),
|
|
773
|
-
}))),
|
|
774
|
-
});
|
|
775
|
-
loopPromise
|
|
776
|
-
.finally(() => timeoutController?.cleanup())
|
|
777
|
-
.catch((error) => {
|
|
778
|
-
captureProviderError(error);
|
|
779
|
-
});
|
|
780
|
-
return result;
|
|
781
|
-
}
|
|
782
|
-
async runStreamLoop(args) {
|
|
783
|
-
const { maxSteps, modelId, url, fetchImpl, abortSignal, options, conversation, openAITools, openAIToolChoice, toolsRecord, toolNameFromWire, emitter, toolsUsed, toolExecutionSummaries, pushChunk, closeChannel, resolveUsage, resolveFinish, } = args;
|
|
784
|
-
// Hoisted above the try so the catch can resolve the usage accumulated
|
|
785
|
-
// by steps that completed BEFORE the failure — those steps were billed.
|
|
786
|
-
let stepFinish = null;
|
|
787
|
-
let stepUsage;
|
|
788
|
-
// Aggregated DeferredUsage from whatever accumulated in stepUsage.
|
|
789
|
-
// prompt_tokens is OVERLAPPING with cached_tokens (a subset), so the
|
|
790
|
-
// uncached remainder goes in promptTokens and the cached part in
|
|
791
|
-
// cacheReadTokens — the non-overlapping convention extractTokenUsage
|
|
792
|
-
// and calculateCost expect. reasoning_tokens stays a subset of
|
|
793
|
-
// completionTokens (informational).
|
|
794
|
-
const toDeferredUsage = () => {
|
|
795
|
-
const promptTokens = stepUsage?.prompt_tokens ?? 0;
|
|
796
|
-
const completionTokens = stepUsage?.completion_tokens ?? 0;
|
|
797
|
-
const cachedTokens = Math.min(stepUsage?.prompt_tokens_details?.cached_tokens ?? 0, promptTokens);
|
|
798
|
-
// Clamped like cached_tokens above: reasoning is a SUBSET of
|
|
799
|
-
// completion_tokens, but some gateways report inconsistent values.
|
|
800
|
-
const reasoningTokens = Math.min(Math.max(0, stepUsage?.completion_tokens_details?.reasoning_tokens ?? 0), completionTokens);
|
|
801
|
-
return {
|
|
802
|
-
promptTokens: promptTokens - cachedTokens,
|
|
803
|
-
completionTokens,
|
|
804
|
-
// Gateways that omit total_tokens must not collapse to 0.
|
|
805
|
-
totalTokens: stepUsage?.total_tokens || promptTokens + completionTokens,
|
|
806
|
-
...(cachedTokens > 0 ? { cacheReadTokens: cachedTokens } : {}),
|
|
807
|
-
...(reasoningTokens > 0 ? { reasoningTokens } : {}),
|
|
808
|
-
};
|
|
809
|
-
};
|
|
810
|
-
try {
|
|
811
|
-
// May grow mid-turn: hydrated tools with wire-unsafe names need
|
|
812
|
-
// reverse-mapping even when the initial name set required none.
|
|
813
|
-
let effectiveToolNameFromWire = toolNameFromWire;
|
|
814
|
-
// The provider's REAL prompt-token count for the previous step, used to
|
|
815
|
-
// calibrate the guard's char-based estimate for free, paired with the
|
|
816
|
-
// guard's own estimate for that same request — a ratio between counts of
|
|
817
|
-
// two different payloads would be meaningless.
|
|
818
|
-
let lastObservedPromptTokens;
|
|
819
|
-
let lastSentEstimate;
|
|
820
|
-
for (let step = 0; step < maxSteps; step++) {
|
|
821
|
-
// Mid-turn discovery sync: search_tools (tools.discovery) hydrates
|
|
822
|
-
// new tools into toolsRecord between steps. Dispatch already re-reads
|
|
823
|
-
// the record — this block makes the request DECLARE them so the model
|
|
824
|
-
// can call them, keeping the wire-name round-trip intact.
|
|
825
|
-
if (openAITools) {
|
|
826
|
-
const declared = new Set(openAITools.map((t) => effectiveToolNameFromWire?.get(t.function.name) ??
|
|
827
|
-
t.function.name));
|
|
828
|
-
const hydrated = Object.fromEntries(Object.entries(toolsRecord).filter(([name]) => !declared.has(name)));
|
|
829
|
-
if (Object.keys(hydrated).length > 0) {
|
|
830
|
-
// Seed with the wire names already declared this turn — mapping
|
|
831
|
-
// only the hydrated subset could otherwise re-issue a wire name
|
|
832
|
-
// an earlier tool claimed (sanitized or literal), making the
|
|
833
|
-
// reverse mapping ambiguous.
|
|
834
|
-
const extraMaps = buildWireToolNameMaps(Object.keys(hydrated), new Set(openAITools.map((t) => t.function.name)));
|
|
835
|
-
if (extraMaps) {
|
|
836
|
-
effectiveToolNameFromWire ??= new Map();
|
|
837
|
-
for (const [wireName, registryName] of extraMaps.fromWire) {
|
|
838
|
-
effectiveToolNameFromWire.set(wireName, registryName);
|
|
839
|
-
}
|
|
840
|
-
}
|
|
841
|
-
openAITools.push(...(buildToolsForOpenAI(hydrated, extraMaps?.toWire) ?? []));
|
|
842
|
-
logger.info(`${this.providerName}: ${Object.keys(hydrated).length} tool(s) hydrated mid-turn via discovery: ${Object.keys(hydrated).join(", ")}`);
|
|
843
|
-
}
|
|
844
|
-
}
|
|
845
|
-
// In-turn context guard. This loop appends an assistant tool-call
|
|
846
|
-
// message plus one tool message per result on every step — growth the
|
|
847
|
-
// pre-dispatch budget check never sees. Without this, a long agentic
|
|
848
|
-
// run walks into a provider "context length exceeded" and loses every
|
|
849
|
-
// completed step. Shares its reclaim policy with the other provider
|
|
850
|
-
// loops via loopGuardCore; returns undefined (leaving `conversation`
|
|
851
|
-
// byte-identical) whenever the request still fits, so a loop that fits
|
|
852
|
-
// never pays a prompt-cache invalidation.
|
|
853
|
-
const guarded = guardOpenAICompatConversation({
|
|
854
|
-
conversation,
|
|
855
|
-
availableInputTokens: getAvailableInputTokens(this.providerName, modelId, options.maxTokens ?? undefined),
|
|
856
|
-
// Tool definitions ride outside the message array. Passing an empty
|
|
857
|
-
// message list yields the tools-only overhead, and reuses the same
|
|
858
|
-
// estimator the wire path already trusts.
|
|
859
|
-
fixedOverheadTokens: estimateWireTokens([], openAITools, this.providerName),
|
|
860
|
-
provider: this.providerName,
|
|
861
|
-
observedPromptTokens: lastObservedPromptTokens,
|
|
862
|
-
// Both halves of the calibration ratio must describe the same
|
|
863
|
-
// request: the tokens the provider reported, and this guard's own
|
|
864
|
-
// estimate for what was sent to earn them.
|
|
865
|
-
previousSentEstimate: lastSentEstimate,
|
|
866
|
-
onSentEstimate: (tokens) => {
|
|
867
|
-
lastSentEstimate = tokens;
|
|
868
|
-
},
|
|
869
|
-
});
|
|
870
|
-
if (guarded) {
|
|
871
|
-
conversation.length = 0;
|
|
872
|
-
conversation.push(...guarded);
|
|
873
|
-
}
|
|
874
|
-
const stepResult = await this.streamOneStep({
|
|
875
|
-
modelId,
|
|
876
|
-
url,
|
|
877
|
-
fetchImpl,
|
|
878
|
-
abortSignal,
|
|
879
|
-
options,
|
|
880
|
-
conversation,
|
|
881
|
-
openAITools,
|
|
882
|
-
openAIToolChoice,
|
|
883
|
-
pushChunk,
|
|
884
|
-
});
|
|
885
|
-
lastObservedPromptTokens = stepResult.usage?.prompt_tokens;
|
|
886
|
-
stepFinish = stepResult.finishReason;
|
|
887
|
-
if (stepResult.usage) {
|
|
888
|
-
stepUsage = mergeUsage(stepUsage, stepResult.usage);
|
|
889
|
-
}
|
|
890
|
-
if (stepResult.toolCalls.size === 0) {
|
|
891
|
-
break;
|
|
892
|
-
}
|
|
893
|
-
await this.executeToolBatch({
|
|
894
|
-
stepResult,
|
|
895
|
-
conversation,
|
|
896
|
-
toolsRecord,
|
|
897
|
-
toolNameFromWire: effectiveToolNameFromWire,
|
|
898
|
-
emitter,
|
|
899
|
-
toolsUsed,
|
|
900
|
-
toolExecutionSummaries,
|
|
901
|
-
options,
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
|
-
resolveUsage(toDeferredUsage());
|
|
905
|
-
resolveFinish(stepFinish ?? "stop");
|
|
906
|
-
closeChannel();
|
|
907
|
-
return {
|
|
908
|
-
finishReason: stepFinish ?? "stop",
|
|
909
|
-
usage: stepUsage,
|
|
910
|
-
};
|
|
911
|
-
}
|
|
912
|
-
catch (err) {
|
|
913
|
-
logger.error(`${this.providerName}: Stream error`, {
|
|
914
|
-
error: err instanceof Error ? err.message : String(err),
|
|
915
|
-
});
|
|
916
|
-
// Steps that completed before the failure were billed — report them
|
|
917
|
-
// instead of zeroing the whole turn.
|
|
918
|
-
resolveUsage(toDeferredUsage());
|
|
919
|
-
resolveFinish("error");
|
|
920
|
-
closeChannel();
|
|
921
|
-
throw err;
|
|
922
|
-
}
|
|
923
|
-
}
|
|
924
|
-
async streamOneStep(args) {
|
|
925
|
-
// Per-step max_tokens fit: the conversation grows every step of the
|
|
926
|
-
// tool loop, so the window fit is recomputed per request (no-op when
|
|
927
|
-
// nothing was runtime-discovered).
|
|
928
|
-
const wireMaxTokens = this.resolveWireMaxTokens(args.modelId, args.options.maxTokens ?? undefined, args.conversation, args.openAITools);
|
|
929
|
-
const stepOptions = wireMaxTokens !== args.options.maxTokens
|
|
930
|
-
? { ...args.options, maxTokens: wireMaxTokens }
|
|
931
|
-
: args.options;
|
|
932
|
-
const body = ensureJsonWordInBody(this.adjustRequestBody(buildBody({
|
|
933
|
-
modelId: args.modelId,
|
|
934
|
-
messages: args.conversation,
|
|
935
|
-
options: this.adjustBuildBodyOptions(args.modelId, stepOptions),
|
|
936
|
-
tools: args.openAITools,
|
|
937
|
-
...(args.openAIToolChoice !== undefined
|
|
938
|
-
? { toolChoice: args.openAIToolChoice }
|
|
939
|
-
: {}),
|
|
940
|
-
streaming: true,
|
|
941
|
-
}), args.modelId));
|
|
942
|
-
// The initial fetch gets 429/5xx retry-with-backoff via the same
|
|
943
|
-
// primitive the non-streaming path already uses (withProviderRetry).
|
|
944
|
-
// `doFetch` throws the classified APIError (buildAPIError attaches
|
|
945
|
-
// .statusCode + .responseHeaders, which withProviderRetry's duck-typing
|
|
946
|
-
// reads directly) so a non-ok response is what drives the retry
|
|
947
|
-
// decision, not a return value.
|
|
948
|
-
const doFetch = async () => {
|
|
949
|
-
const attemptRes = await args.fetchImpl(args.url, {
|
|
950
|
-
method: "POST",
|
|
951
|
-
headers: {
|
|
952
|
-
"Content-Type": "application/json",
|
|
953
|
-
...this.getAuthHeaders(),
|
|
954
|
-
},
|
|
955
|
-
body: JSON.stringify(body),
|
|
956
|
-
...(args.abortSignal ? { signal: args.abortSignal } : {}),
|
|
957
|
-
});
|
|
958
|
-
if (!attemptRes.ok) {
|
|
959
|
-
throw await buildAPIError(args.url, body, attemptRes);
|
|
960
|
-
}
|
|
961
|
-
return attemptRes;
|
|
962
|
-
};
|
|
963
|
-
let res;
|
|
964
|
-
try {
|
|
965
|
-
res = await withProviderRetry(doFetch, trace.getActiveSpan() ?? undefined, `${this.providerName} stream`);
|
|
966
|
-
}
|
|
967
|
-
catch (err) {
|
|
968
|
-
// The one-shot 400 context-overflow fallback lives outside
|
|
969
|
-
// withProviderRetry (400 isn't retryable there anyway — see
|
|
970
|
-
// isRetryableProviderError), so it fires on the classified error's
|
|
971
|
-
// .statusCode. The raw Response is no longer in scope here: it was
|
|
972
|
-
// consumed inside doFetch's closure, either returned on success or
|
|
973
|
-
// discarded after buildAPIError read its body on failure.
|
|
974
|
-
const apiErr = err;
|
|
975
|
-
// Overflow corrector first (re-fits max_tokens from the provider's own
|
|
976
|
-
// numbers + self-heals the window registry); its output then feeds the
|
|
977
|
-
// subclass hook (e.g. NIM strips chat_template / reasoning_budget when
|
|
978
|
-
// a model rejects them), so a body needing BOTH fixes gets both — a
|
|
979
|
-
// plain `??` between the two would let whichever ran first silently
|
|
980
|
-
// win and drop the other's fix.
|
|
981
|
-
const retryBody = apiErr.statusCode === 400
|
|
982
|
-
? (() => {
|
|
983
|
-
const overflowCorrected = this.correctBodyAfterContextOverflow(body, apiErr);
|
|
984
|
-
return (this.adjustBodyAfter400(overflowCorrected ?? body, apiErr) ??
|
|
985
|
-
overflowCorrected);
|
|
986
|
-
})()
|
|
987
|
-
: undefined;
|
|
988
|
-
if (!retryBody) {
|
|
989
|
-
throw apiErr;
|
|
990
|
-
}
|
|
991
|
-
res = await args.fetchImpl(args.url, {
|
|
992
|
-
method: "POST",
|
|
993
|
-
headers: {
|
|
994
|
-
"Content-Type": "application/json",
|
|
995
|
-
...this.getAuthHeaders(),
|
|
996
|
-
},
|
|
997
|
-
body: JSON.stringify(retryBody),
|
|
998
|
-
...(args.abortSignal ? { signal: args.abortSignal } : {}),
|
|
999
|
-
});
|
|
1000
|
-
if (!res.ok) {
|
|
1001
|
-
throw await buildAPIError(args.url, retryBody, res);
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
if (!res.body) {
|
|
1005
|
-
throw new Error(`${this.providerName}: stream response had no body`);
|
|
1006
|
-
}
|
|
1007
|
-
return parseSSEStream(res.body, (delta) => {
|
|
1008
|
-
args.pushChunk({ content: delta });
|
|
1009
|
-
}, (reasoningDelta) => {
|
|
1010
|
-
// Reasoning rides alongside an empty `content` so plain-text
|
|
1011
|
-
// consumers (which only read chunk.content) are unaffected.
|
|
1012
|
-
args.pushChunk({ content: "", reasoning: reasoningDelta });
|
|
1013
|
-
});
|
|
1014
|
-
}
|
|
1015
|
-
async executeToolBatch(args) {
|
|
1016
|
-
const { stepResult, conversation, toolsRecord, toolNameFromWire, emitter, toolsUsed, toolExecutionSummaries, options, } = args;
|
|
1017
|
-
const toolCallsForMessage = [];
|
|
1018
|
-
for (const [, t] of stepResult.toolCalls) {
|
|
1019
|
-
toolCallsForMessage.push({
|
|
1020
|
-
id: t.id,
|
|
1021
|
-
type: "function",
|
|
1022
|
-
function: { name: t.name, arguments: t.argsBuffered },
|
|
1023
|
-
});
|
|
1024
|
-
}
|
|
1025
|
-
conversation.push({
|
|
1026
|
-
role: "assistant",
|
|
1027
|
-
content: stepResult.text.length > 0 ? stepResult.text : null,
|
|
1028
|
-
tool_calls: toolCallsForMessage,
|
|
1029
|
-
});
|
|
1030
|
-
for (const [, t] of stepResult.toolCalls) {
|
|
1031
|
-
const startedAt = new Date();
|
|
1032
|
-
let input;
|
|
1033
|
-
try {
|
|
1034
|
-
input = JSON.parse(t.argsBuffered || "{}");
|
|
1035
|
-
}
|
|
1036
|
-
catch {
|
|
1037
|
-
input = t.argsBuffered;
|
|
1038
|
-
}
|
|
1039
|
-
let output;
|
|
1040
|
-
let errorMsg;
|
|
1041
|
-
// The model calls tools by their WIRE names; execution, events, and
|
|
1042
|
-
// reporting use the registered names (reverse-mapped when a wire-name
|
|
1043
|
-
// map is in effect — see buildWireToolNameMaps).
|
|
1044
|
-
const registryName = toolNameFromWire?.get(t.name) ?? t.name;
|
|
1045
|
-
// Live record lookup, then deferred-catalog auto-hydration: with
|
|
1046
|
-
// tools.discovery on, the model may call a cataloged tool it never
|
|
1047
|
-
// loaded via search_tools — that's a real tool, not a hallucination.
|
|
1048
|
-
const toolDef = toolsRecord[registryName] ??
|
|
1049
|
-
resolveDeferredTool(toolsRecord, registryName);
|
|
1050
|
-
emitter?.emit("tool:start", {
|
|
1051
|
-
toolName: registryName,
|
|
1052
|
-
toolCallId: t.id,
|
|
1053
|
-
input,
|
|
1054
|
-
});
|
|
1055
|
-
if (!toolDef || typeof toolDef.execute !== "function") {
|
|
1056
|
-
errorMsg = `Tool '${registryName}' is not registered.`;
|
|
1057
|
-
output = { error: errorMsg };
|
|
1058
|
-
}
|
|
1059
|
-
else {
|
|
1060
|
-
try {
|
|
1061
|
-
output = await toolDef.execute(input, {});
|
|
1062
|
-
}
|
|
1063
|
-
catch (err) {
|
|
1064
|
-
errorMsg = err instanceof Error ? err.message : String(err);
|
|
1065
|
-
output = { error: errorMsg };
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
const endedAt = new Date();
|
|
1069
|
-
toolsUsed.push(registryName);
|
|
1070
|
-
toolExecutionSummaries.push({
|
|
1071
|
-
toolCallId: t.id,
|
|
1072
|
-
toolName: registryName,
|
|
1073
|
-
input,
|
|
1074
|
-
output,
|
|
1075
|
-
...(errorMsg ? { error: errorMsg } : {}),
|
|
1076
|
-
startTime: startedAt,
|
|
1077
|
-
endTime: endedAt,
|
|
1078
|
-
});
|
|
1079
|
-
conversation.push({
|
|
1080
|
-
role: "tool",
|
|
1081
|
-
tool_call_id: t.id,
|
|
1082
|
-
content: stringifyToolOutput(output),
|
|
1083
|
-
});
|
|
1084
|
-
}
|
|
1085
|
-
const justExecuted = toolExecutionSummaries.slice(-stepResult.toolCalls.size);
|
|
1086
|
-
emitToolEndFromStepFinish(emitter, justExecuted.map((s) => ({
|
|
1087
|
-
toolName: s.toolName,
|
|
1088
|
-
output: s.output,
|
|
1089
|
-
...(s.error ? { error: s.error } : {}),
|
|
1090
|
-
})));
|
|
1091
|
-
try {
|
|
1092
|
-
await this.handleToolExecutionStorage(justExecuted.map((s) => ({
|
|
1093
|
-
toolCallId: s.toolCallId,
|
|
1094
|
-
toolName: s.toolName,
|
|
1095
|
-
input: s.input,
|
|
1096
|
-
output: s.output,
|
|
1097
|
-
})), justExecuted.map((s) => ({
|
|
1098
|
-
toolCallId: s.toolCallId,
|
|
1099
|
-
toolName: s.toolName,
|
|
1100
|
-
output: s.output,
|
|
1101
|
-
})), options, new Date());
|
|
1102
|
-
}
|
|
1103
|
-
catch (err) {
|
|
1104
|
-
logger.warn(`[${this.constructor.name}] Failed to store tool executions`, {
|
|
1105
|
-
provider: this.providerName,
|
|
1106
|
-
error: err instanceof Error ? err.message : String(err),
|
|
1107
|
-
});
|
|
1108
|
-
}
|
|
1109
|
-
}
|
|
1110
|
-
/**
|
|
1111
|
-
* Default implementation hits `${baseURL}/models`. Subclasses with a
|
|
1112
|
-
* different endpoint path, caching, or fallback strategy should override.
|
|
1113
|
-
*/
|
|
1114
|
-
async getAvailableModels() {
|
|
1115
|
-
try {
|
|
1116
|
-
const modelsUrl = `${stripTrailingSlash(this.config.baseURL)}/models`;
|
|
1117
|
-
logger.debug(`Fetching available models from: ${modelsUrl}`);
|
|
1118
|
-
const proxyFetch = createProxyFetch();
|
|
1119
|
-
const controller = new AbortController();
|
|
1120
|
-
const t = setTimeout(() => controller.abort(), 5000);
|
|
1121
|
-
const response = await proxyFetch(modelsUrl, {
|
|
1122
|
-
headers: {
|
|
1123
|
-
...this.getAuthHeaders(),
|
|
1124
|
-
"Content-Type": "application/json",
|
|
1125
|
-
},
|
|
1126
|
-
signal: controller.signal,
|
|
1127
|
-
});
|
|
1128
|
-
clearTimeout(t);
|
|
1129
|
-
if (!response.ok) {
|
|
1130
|
-
logger.warn(`Models endpoint returned ${response.status}: ${response.statusText}`);
|
|
1131
|
-
return this.getFallbackModels();
|
|
1132
|
-
}
|
|
1133
|
-
const data = await response.json();
|
|
1134
|
-
if (!data.data || !Array.isArray(data.data)) {
|
|
1135
|
-
logger.warn("Invalid models response format");
|
|
1136
|
-
return this.getFallbackModels();
|
|
1137
|
-
}
|
|
1138
|
-
const models = data.data.map((model) => model.id).filter(Boolean);
|
|
1139
|
-
if (logger.shouldLog("debug")) {
|
|
1140
|
-
logger.debug(`Discovered ${models.length} models:`, models);
|
|
1141
|
-
}
|
|
1142
|
-
return models.length > 0 ? models : this.getFallbackModels();
|
|
1143
|
-
}
|
|
1144
|
-
catch (error) {
|
|
1145
|
-
logger.warn(`[${this.constructor.name}] Failed to fetch models from endpoint:`, error);
|
|
1146
|
-
return this.getFallbackModels();
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
async getFirstAvailableModel() {
|
|
1150
|
-
const models = await this.getAvailableModels();
|
|
1151
|
-
return models[0] || this.getFallbackModelName();
|
|
1152
|
-
}
|
|
1153
|
-
}
|
|
1154
|
-
//# sourceMappingURL=openaiChatCompletionsBase.js.map
|