@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,1661 +0,0 @@
|
|
|
1
|
-
import { ErrorCategory, ErrorSeverity, GoogleAIModels, } from "../../constants/enums.js";
|
|
2
|
-
import { BaseProvider } from "../../core/baseProvider.js";
|
|
3
|
-
import { IMAGE_GENERATION_MODELS, TOOL_STORAGE_TIMEOUT_MS, } from "../../core/constants.js";
|
|
4
|
-
import { mergeMediaFileAliases, normalizeVisionImageFormats, processUnifiedFilesArray, } from "../../utils/messageBuilder.js";
|
|
5
|
-
import { ATTR, tracers, withClientSpan, withClientStreamSpan, withSpan, } from "../../telemetry/index.js";
|
|
6
|
-
import { AuthenticationError, InvalidModelError, NetworkError, ProviderError, RateLimitError, } from "../../types/index.js";
|
|
7
|
-
import { ERROR_CODES, NeuroLinkError } from "../../utils/errorHandling.js";
|
|
8
|
-
import { logger } from "../../utils/logger.js";
|
|
9
|
-
import { createGeminiLoopAdapter } from "../../core/geminiLoopAdapter.js";
|
|
10
|
-
import { runAgenticLoop } from "../../core/loopEngine.js";
|
|
11
|
-
import { DEFAULT_TOOL_MAX_RETRIES } from "../../core/constants.js";
|
|
12
|
-
import { isToolsSchemaExclusionInForce } from "../../core/modules/structuredOutputPolicy.js";
|
|
13
|
-
import { GEMINI_ELISION_NOTE, planGeminiLoopReclaim, previewGeminiToolResponseText, } from "../../context/geminiLoopGuard.js";
|
|
14
|
-
import { getAvailableInputTokens, getContextWindowSize, } from "../../constants/contextWindows.js";
|
|
15
|
-
import { composeAbortSignals, createTimeoutController, TimeoutError, } from "../../utils/timeout.js";
|
|
16
|
-
import { withTimeout } from "../../utils/async/index.js";
|
|
17
|
-
import { estimateTokens } from "../../utils/tokenEstimation.js";
|
|
18
|
-
import { transformToolExecutions } from "../../utils/transformationUtils.js";
|
|
19
|
-
import { resolveToolExecutionRecords } from "../../core/toolExecutionRecorder.js";
|
|
20
|
-
import { buildGeminiResponseSchema, buildNativeConfig, computeMaxSteps, createContextGuard, buildUserPartsWithMultimodal, extractThoughtSignature, handleMaxStepsTermination, prependConversationMessages, } from "../googleNativeGemini3/index.js";
|
|
21
|
-
import { createStreamChannel } from "../../core/streamChannel.js";
|
|
22
|
-
import { toNativeToolDeclarations } from "../../core/nativeToolFormat.js";
|
|
23
|
-
import { warnGoogleSdkIgnoresProxy } from "../../proxy/proxyFetch.js";
|
|
24
|
-
// Google AI Live API types now imported from ../types/providerSpecific.js
|
|
25
|
-
// Import proper types for multimodal message handling
|
|
26
|
-
// Create Google GenAI client
|
|
27
|
-
async function createGoogleGenAIClient(apiKey, baseURL) {
|
|
28
|
-
const mod = await import("@google/genai");
|
|
29
|
-
const ctor = mod.GoogleGenAI;
|
|
30
|
-
if (!ctor) {
|
|
31
|
-
throw new NeuroLinkError({
|
|
32
|
-
code: ERROR_CODES.INVALID_CONFIGURATION,
|
|
33
|
-
message: "@google/genai does not export GoogleGenAI",
|
|
34
|
-
category: ErrorCategory.CONFIGURATION,
|
|
35
|
-
severity: ErrorSeverity.CRITICAL,
|
|
36
|
-
retriable: false,
|
|
37
|
-
context: { module: "@google/genai", expectedExport: "GoogleGenAI" },
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
const Ctor = ctor;
|
|
41
|
-
// httpOptions carries the endpoint override and nothing else. It used to
|
|
42
|
-
// also pass a proxy fetch, which the SDK silently ignored — see
|
|
43
|
-
// warnGoogleSdkIgnoresProxy for why that is not fixable here.
|
|
44
|
-
//
|
|
45
|
-
// baseUrl is only included when resolved — verified against
|
|
46
|
-
// @google/genai's ApiClient (dist/node/index.cjs) that it falls back to
|
|
47
|
-
// its own default whenever httpOptions.baseUrl is undefined, so omitting
|
|
48
|
-
// the key and passing `baseUrl: undefined` behave identically; the key is
|
|
49
|
-
// still omitted outright for a cleaner outbound config object.
|
|
50
|
-
warnGoogleSdkIgnoresProxy("GoogleAIStudio");
|
|
51
|
-
return new Ctor({
|
|
52
|
-
apiKey,
|
|
53
|
-
httpOptions: {
|
|
54
|
-
...(baseURL ? { baseUrl: baseURL } : {}),
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Google AI Studio provider implementation using BaseProvider
|
|
60
|
-
* Migrated from original GoogleAIStudio class to new factory pattern
|
|
61
|
-
*
|
|
62
|
-
* @important Structured Output Limitation
|
|
63
|
-
* Google Gemini models cannot combine function calling (tools) with structured
|
|
64
|
-
* output (JSON schema). When using schemas with output.format: "json", you MUST
|
|
65
|
-
* set disableTools: true.
|
|
66
|
-
*
|
|
67
|
-
* Error without disableTools:
|
|
68
|
-
* "Function calling with a response mime type: 'application/json' is unsupported"
|
|
69
|
-
*
|
|
70
|
-
* This is a Google API limitation documented at:
|
|
71
|
-
* https://ai.google.dev/gemini-api/docs/function-calling
|
|
72
|
-
*
|
|
73
|
-
* @example
|
|
74
|
-
* ```typescript
|
|
75
|
-
* // ✅ Correct usage with schemas
|
|
76
|
-
* const provider = new GoogleAIStudioProvider("gemini-2.5-flash");
|
|
77
|
-
* const result = await provider.generate({
|
|
78
|
-
* input: { text: "Analyze data" },
|
|
79
|
-
* schema: MySchema,
|
|
80
|
-
* output: { format: "json" },
|
|
81
|
-
* disableTools: true // Required
|
|
82
|
-
* });
|
|
83
|
-
* ```
|
|
84
|
-
*
|
|
85
|
-
* @note Gemini 3 Pro Preview (November 2025) will support combining tools + schemas
|
|
86
|
-
* @note "Too many states for serving" errors can occur with complex schemas + tools.
|
|
87
|
-
* Solution: Simplify schema or use disableTools: true
|
|
88
|
-
*/
|
|
89
|
-
/**
|
|
90
|
-
* Reclaim context from an AI Studio loop history IN PLACE.
|
|
91
|
-
*
|
|
92
|
-
* This loop had NO in-turn guard at all — it appended a model turn plus a tool
|
|
93
|
-
* turn every step with nothing bounding growth, so a long agentic run walked
|
|
94
|
-
* into a provider "context length exceeded" and lost every completed step.
|
|
95
|
-
* Shares its reclaim policy with the other provider loops via loopGuardCore.
|
|
96
|
-
*
|
|
97
|
-
* Returns true when something was reclaimed.
|
|
98
|
-
*/
|
|
99
|
-
function reclaimAiStudioContext(contents, modelName, observedPromptTokens) {
|
|
100
|
-
const plan = planGeminiLoopReclaim({
|
|
101
|
-
contents,
|
|
102
|
-
availableInputTokens: getAvailableInputTokens("googleAiStudio", modelName),
|
|
103
|
-
provider: "googleAiStudio",
|
|
104
|
-
...(observedPromptTokens ? { observedPromptTokens } : {}),
|
|
105
|
-
});
|
|
106
|
-
if (!plan) {
|
|
107
|
-
return false;
|
|
108
|
-
}
|
|
109
|
-
const dropSet = new Set(plan.drop);
|
|
110
|
-
const truncateSet = new Set(plan.truncate);
|
|
111
|
-
const rebuilt = [];
|
|
112
|
-
for (let i = 0; i < contents.length; i++) {
|
|
113
|
-
if (dropSet.has(i)) {
|
|
114
|
-
continue;
|
|
115
|
-
}
|
|
116
|
-
const content = contents[i];
|
|
117
|
-
if (truncateSet.has(i) && Array.isArray(content.parts)) {
|
|
118
|
-
rebuilt.push({
|
|
119
|
-
...content,
|
|
120
|
-
parts: content.parts.map((part) => {
|
|
121
|
-
const record = part;
|
|
122
|
-
if (!record.functionResponse) {
|
|
123
|
-
return part;
|
|
124
|
-
}
|
|
125
|
-
const text = JSON.stringify(record.functionResponse.response) ?? "";
|
|
126
|
-
if (text.length <= 2048) {
|
|
127
|
-
return part;
|
|
128
|
-
}
|
|
129
|
-
return {
|
|
130
|
-
functionResponse: {
|
|
131
|
-
name: record.functionResponse.name,
|
|
132
|
-
response: { result: previewGeminiToolResponseText(text) },
|
|
133
|
-
},
|
|
134
|
-
};
|
|
135
|
-
}),
|
|
136
|
-
});
|
|
137
|
-
continue;
|
|
138
|
-
}
|
|
139
|
-
rebuilt.push(content);
|
|
140
|
-
}
|
|
141
|
-
if (dropSet.size > 0) {
|
|
142
|
-
let noteIndex = rebuilt.findIndex((c) => Array.isArray(c.parts) &&
|
|
143
|
-
c.parts.some((part) => !!part.functionCall ||
|
|
144
|
-
!!part.functionResponse));
|
|
145
|
-
if (noteIndex < 0) {
|
|
146
|
-
noteIndex = Math.min(1, rebuilt.length);
|
|
147
|
-
}
|
|
148
|
-
rebuilt.splice(noteIndex, 0, {
|
|
149
|
-
role: "user",
|
|
150
|
-
parts: [{ text: GEMINI_ELISION_NOTE }],
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
contents.length = 0;
|
|
154
|
-
contents.push(...rebuilt);
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
export class GoogleAIStudioProvider extends BaseProvider {
|
|
158
|
-
credentials;
|
|
159
|
-
constructor(modelName, sdk, credentials) {
|
|
160
|
-
super(modelName, "google-ai", sdk);
|
|
161
|
-
this.credentials = credentials;
|
|
162
|
-
logger.debug("GoogleAIStudioProvider initialized", {
|
|
163
|
-
model: this.modelName,
|
|
164
|
-
provider: this.providerName,
|
|
165
|
-
sdkProvided: !!sdk,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
// ===================
|
|
169
|
-
// ABSTRACT METHOD IMPLEMENTATIONS
|
|
170
|
-
// ===================
|
|
171
|
-
getProviderName() {
|
|
172
|
-
return "google-ai";
|
|
173
|
-
}
|
|
174
|
-
getDefaultModel() {
|
|
175
|
-
return process.env.GOOGLE_AI_MODEL || GoogleAIModels.GEMINI_2_5_FLASH;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* AI SDK model instance — no longer used.
|
|
179
|
-
* All models are routed through native @google/genai SDK directly.
|
|
180
|
-
*/
|
|
181
|
-
getAISDKModel() {
|
|
182
|
-
throw new NeuroLinkError({
|
|
183
|
-
code: ERROR_CODES.INVALID_CONFIGURATION,
|
|
184
|
-
message: "GoogleAIStudioProvider no longer uses @ai-sdk/google. All models use native @google/genai SDK.",
|
|
185
|
-
category: ErrorCategory.CONFIGURATION,
|
|
186
|
-
severity: ErrorSeverity.CRITICAL,
|
|
187
|
-
retriable: false,
|
|
188
|
-
context: { provider: this.providerName, model: this.modelName },
|
|
189
|
-
});
|
|
190
|
-
}
|
|
191
|
-
formatProviderError(error) {
|
|
192
|
-
if (error instanceof TimeoutError) {
|
|
193
|
-
return new NetworkError(error.message, this.providerName);
|
|
194
|
-
}
|
|
195
|
-
const errorRecord = error;
|
|
196
|
-
const message = typeof errorRecord?.message === "string"
|
|
197
|
-
? errorRecord.message
|
|
198
|
-
: "Unknown error";
|
|
199
|
-
const statusCode = typeof errorRecord?.status === "number"
|
|
200
|
-
? errorRecord.status
|
|
201
|
-
: typeof errorRecord?.statusCode === "number"
|
|
202
|
-
? errorRecord.statusCode
|
|
203
|
-
: undefined;
|
|
204
|
-
// Authentication errors
|
|
205
|
-
if (message.includes("API_KEY_INVALID") ||
|
|
206
|
-
message.includes("Invalid API key") ||
|
|
207
|
-
statusCode === 401) {
|
|
208
|
-
return new AuthenticationError("Invalid Google AI API key. Please check your GOOGLE_AI_API_KEY environment variable.", this.providerName);
|
|
209
|
-
}
|
|
210
|
-
// Rate limit errors
|
|
211
|
-
if (message.includes("RATE_LIMIT_EXCEEDED") ||
|
|
212
|
-
message.includes("rate limit") ||
|
|
213
|
-
message.includes("429") ||
|
|
214
|
-
statusCode === 429) {
|
|
215
|
-
return new RateLimitError("Google AI rate limit exceeded. Please try again later.", this.providerName);
|
|
216
|
-
}
|
|
217
|
-
// Model not found errors — gate on a 404 status when available; fall
|
|
218
|
-
// back to literal phrase matching only when we have no status code at
|
|
219
|
-
// all. Avoids misclassifying permission/validation errors that happen
|
|
220
|
-
// to mention model resource paths (e.g. "...models/foo permission...").
|
|
221
|
-
if (statusCode === 404 ||
|
|
222
|
-
(statusCode === undefined &&
|
|
223
|
-
(message.includes("model not found") ||
|
|
224
|
-
message.includes("Model not found")))) {
|
|
225
|
-
return new InvalidModelError(`Model '${this.modelName}' not found. Please check the model name and ensure it is available.`, this.providerName);
|
|
226
|
-
}
|
|
227
|
-
// Network connectivity errors
|
|
228
|
-
if (message.includes("ECONNRESET") ||
|
|
229
|
-
message.includes("ENOTFOUND") ||
|
|
230
|
-
message.includes("ETIMEDOUT") ||
|
|
231
|
-
message.includes("ECONNREFUSED") ||
|
|
232
|
-
message.includes("network") ||
|
|
233
|
-
message.includes("connection")) {
|
|
234
|
-
return new NetworkError(`Connection error: ${message}`, this.providerName);
|
|
235
|
-
}
|
|
236
|
-
// Server errors (5xx)
|
|
237
|
-
if (message.includes("500") ||
|
|
238
|
-
message.includes("502") ||
|
|
239
|
-
message.includes("503") ||
|
|
240
|
-
message.includes("504") ||
|
|
241
|
-
message.includes("server error") ||
|
|
242
|
-
message.includes("Internal Server Error") ||
|
|
243
|
-
(statusCode && statusCode >= 500 && statusCode < 600)) {
|
|
244
|
-
return new ProviderError(`Google AI server error: ${message}. Please try again later.`, this.providerName);
|
|
245
|
-
}
|
|
246
|
-
return new ProviderError(`Google AI error: ${message}`, this.providerName);
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Overrides the BaseProvider's image generation method to implement it for Google AI.
|
|
250
|
-
* This method calls the Google AI API to generate an image from a prompt.
|
|
251
|
-
* @param options The generation options containing the prompt.
|
|
252
|
-
* @returns A promise that resolves to the generation result, including the image data.
|
|
253
|
-
*/
|
|
254
|
-
async executeImageGeneration(options) {
|
|
255
|
-
// Image-to-image generation takes reference images through the same
|
|
256
|
-
// `input.images` array, and generate() routes here BEFORE reaching its own
|
|
257
|
-
// normalization call — so a reference photo in HEIC/BMP/AVIF would arrive
|
|
258
|
-
// at the API untranscoded. Normalizing at the top of this method covers
|
|
259
|
-
// every route in, rather than relying on each caller to remember.
|
|
260
|
-
// Idempotent, so a request that was already normalized pays nothing.
|
|
261
|
-
await normalizeVisionImageFormats(options.input);
|
|
262
|
-
const prompt = options.prompt || options.input?.text || "";
|
|
263
|
-
const imageModelName = options.model || this.modelName;
|
|
264
|
-
const startTime = Date.now();
|
|
265
|
-
const apiKey = this.getApiKey();
|
|
266
|
-
logger.info("🎨 Starting Google AI Studio image generation", {
|
|
267
|
-
model: imageModelName,
|
|
268
|
-
prompt: prompt.substring(0, 100),
|
|
269
|
-
provider: this.providerName,
|
|
270
|
-
});
|
|
271
|
-
// Use the @google/genai client for image generation
|
|
272
|
-
let client;
|
|
273
|
-
try {
|
|
274
|
-
client = await createGoogleGenAIClient(apiKey, this.getBaseURL());
|
|
275
|
-
}
|
|
276
|
-
catch {
|
|
277
|
-
throw new AuthenticationError("Missing '@google/genai'. Install with: npm install @google/genai", this.providerName);
|
|
278
|
-
}
|
|
279
|
-
try {
|
|
280
|
-
// Build content array with multimodal support
|
|
281
|
-
const imageParts = await Promise.all((options.input?.images || []).map(async (image) => {
|
|
282
|
-
// Handle ImageWithAltText objects
|
|
283
|
-
if (typeof image === "object" && "url" in image) {
|
|
284
|
-
const imageUrl = image.url;
|
|
285
|
-
if (imageUrl.startsWith("http")) {
|
|
286
|
-
const response = await fetch(imageUrl);
|
|
287
|
-
if (!response.ok) {
|
|
288
|
-
throw new Error(`Failed to fetch image from ${imageUrl}: ${response.status} ${response.statusText}`);
|
|
289
|
-
}
|
|
290
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
291
|
-
const buffer = Buffer.from(arrayBuffer);
|
|
292
|
-
const mimeType = this.detectImageType(buffer);
|
|
293
|
-
logger.debug(`Downloaded and detected image MIME type: ${mimeType}`);
|
|
294
|
-
return {
|
|
295
|
-
inlineData: {
|
|
296
|
-
mimeType,
|
|
297
|
-
data: buffer.toString("base64"),
|
|
298
|
-
},
|
|
299
|
-
};
|
|
300
|
-
}
|
|
301
|
-
// Base64 URL in ImageWithAltText
|
|
302
|
-
const buffer = Buffer.from(imageUrl, "base64");
|
|
303
|
-
const mimeType = this.detectImageType(buffer);
|
|
304
|
-
return {
|
|
305
|
-
inlineData: {
|
|
306
|
-
mimeType,
|
|
307
|
-
data: buffer.toString("base64"),
|
|
308
|
-
},
|
|
309
|
-
};
|
|
310
|
-
}
|
|
311
|
-
// Handle string URLs
|
|
312
|
-
if (typeof image === "string" && image.startsWith("http")) {
|
|
313
|
-
const response = await fetch(image);
|
|
314
|
-
if (!response.ok) {
|
|
315
|
-
throw new Error(`Failed to fetch image from ${image}: ${response.status} ${response.statusText}`);
|
|
316
|
-
}
|
|
317
|
-
const arrayBuffer = await response.arrayBuffer();
|
|
318
|
-
const buffer = Buffer.from(arrayBuffer);
|
|
319
|
-
const mimeType = this.detectImageType(buffer);
|
|
320
|
-
logger.debug(`Downloaded and detected image MIME type: ${mimeType}`);
|
|
321
|
-
return {
|
|
322
|
-
inlineData: {
|
|
323
|
-
mimeType,
|
|
324
|
-
data: buffer.toString("base64"),
|
|
325
|
-
},
|
|
326
|
-
};
|
|
327
|
-
}
|
|
328
|
-
// Handle Buffer or base64 string
|
|
329
|
-
const buffer = Buffer.isBuffer(image)
|
|
330
|
-
? image
|
|
331
|
-
: typeof image === "string"
|
|
332
|
-
? Buffer.from(image, "base64")
|
|
333
|
-
: Buffer.from(""); // Fallback for unexpected types
|
|
334
|
-
const mimeType = this.detectImageType(buffer);
|
|
335
|
-
logger.debug(`Detected image MIME type: ${mimeType}`);
|
|
336
|
-
return {
|
|
337
|
-
inlineData: {
|
|
338
|
-
mimeType,
|
|
339
|
-
data: buffer.toString("base64"),
|
|
340
|
-
},
|
|
341
|
-
};
|
|
342
|
-
}));
|
|
343
|
-
const contents = [
|
|
344
|
-
{
|
|
345
|
-
role: "user",
|
|
346
|
-
parts: [{ text: prompt }, ...imageParts],
|
|
347
|
-
},
|
|
348
|
-
];
|
|
349
|
-
// Configure for image generation
|
|
350
|
-
const generateConfig = {
|
|
351
|
-
responseModalities: ["IMAGE", "TEXT"], // This is the key setting for image generation
|
|
352
|
-
};
|
|
353
|
-
logger.debug("Starting image generation request", {
|
|
354
|
-
model: imageModelName,
|
|
355
|
-
contentParts: contents[0].parts.length,
|
|
356
|
-
responseModalities: generateConfig.responseModalities,
|
|
357
|
-
});
|
|
358
|
-
// Try streaming approach first
|
|
359
|
-
let imageData = null;
|
|
360
|
-
let textContent = "";
|
|
361
|
-
try {
|
|
362
|
-
// Await the Promise to get the AsyncIterable
|
|
363
|
-
const stream = await client.models.generateContentStream({
|
|
364
|
-
model: imageModelName,
|
|
365
|
-
contents: contents,
|
|
366
|
-
config: generateConfig,
|
|
367
|
-
});
|
|
368
|
-
// Process the stream
|
|
369
|
-
for await (const chunk of stream) {
|
|
370
|
-
logger.debug("Received chunk", {
|
|
371
|
-
hasCandidate: !!chunk.candidates?.[0],
|
|
372
|
-
hasContent: !!chunk.candidates?.[0]?.content,
|
|
373
|
-
hasParts: !!chunk.candidates?.[0]?.content?.parts,
|
|
374
|
-
});
|
|
375
|
-
const candidate = chunk.candidates?.[0];
|
|
376
|
-
if (candidate?.content?.parts) {
|
|
377
|
-
for (const part of candidate.content.parts) {
|
|
378
|
-
// Check for image data
|
|
379
|
-
if ("inlineData" in part && part.inlineData?.data) {
|
|
380
|
-
const foundImageData = part.inlineData.data;
|
|
381
|
-
imageData = foundImageData;
|
|
382
|
-
const mimeType = part.inlineData.mimeType || "image/png";
|
|
383
|
-
logger.info("Image generation successful", {
|
|
384
|
-
model: imageModelName,
|
|
385
|
-
mimeType,
|
|
386
|
-
dataLength: foundImageData.length,
|
|
387
|
-
responseTime: Date.now() - startTime,
|
|
388
|
-
});
|
|
389
|
-
const result = {
|
|
390
|
-
content: `Generated image using ${imageModelName} (${mimeType})`,
|
|
391
|
-
imageOutput: {
|
|
392
|
-
base64: foundImageData,
|
|
393
|
-
},
|
|
394
|
-
provider: this.providerName,
|
|
395
|
-
model: imageModelName,
|
|
396
|
-
usage: {
|
|
397
|
-
input: this.estimateTokenCount(prompt),
|
|
398
|
-
output: 0,
|
|
399
|
-
total: this.estimateTokenCount(prompt),
|
|
400
|
-
},
|
|
401
|
-
};
|
|
402
|
-
return await this.enhanceResult(result, options, startTime);
|
|
403
|
-
}
|
|
404
|
-
// Check for text content
|
|
405
|
-
if ("text" in part && part.text) {
|
|
406
|
-
textContent += part.text;
|
|
407
|
-
logger.debug("Received text content", {
|
|
408
|
-
text: part.text.substring(0, 100),
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
catch (streamError) {
|
|
416
|
-
logger.debug("Streaming failed, trying non-streaming approach", {
|
|
417
|
-
error: streamError instanceof Error
|
|
418
|
-
? streamError.message
|
|
419
|
-
: String(streamError),
|
|
420
|
-
});
|
|
421
|
-
}
|
|
422
|
-
// If no image was found, try non-streaming approach
|
|
423
|
-
if (!imageData) {
|
|
424
|
-
logger.debug("Trying non-streaming approach");
|
|
425
|
-
const response = await client.models.generateContent({
|
|
426
|
-
model: imageModelName,
|
|
427
|
-
contents: contents,
|
|
428
|
-
config: generateConfig,
|
|
429
|
-
});
|
|
430
|
-
const candidate = response.candidates?.[0];
|
|
431
|
-
if (candidate?.content?.parts) {
|
|
432
|
-
for (const part of candidate.content.parts) {
|
|
433
|
-
if ("inlineData" in part && part.inlineData?.data) {
|
|
434
|
-
const foundImageData = part.inlineData.data;
|
|
435
|
-
imageData = foundImageData;
|
|
436
|
-
const mimeType = part.inlineData.mimeType || "image/png";
|
|
437
|
-
logger.info("Image generation successful (non-streaming)", {
|
|
438
|
-
model: imageModelName,
|
|
439
|
-
mimeType,
|
|
440
|
-
dataLength: foundImageData.length,
|
|
441
|
-
responseTime: Date.now() - startTime,
|
|
442
|
-
});
|
|
443
|
-
const result = {
|
|
444
|
-
content: `Generated image using ${imageModelName} (${mimeType})`,
|
|
445
|
-
imageOutput: {
|
|
446
|
-
base64: foundImageData,
|
|
447
|
-
},
|
|
448
|
-
provider: this.providerName,
|
|
449
|
-
model: imageModelName,
|
|
450
|
-
usage: {
|
|
451
|
-
input: this.estimateTokenCount(prompt),
|
|
452
|
-
output: 0,
|
|
453
|
-
total: this.estimateTokenCount(prompt),
|
|
454
|
-
},
|
|
455
|
-
};
|
|
456
|
-
return await this.enhanceResult(result, options, startTime);
|
|
457
|
-
}
|
|
458
|
-
if ("text" in part && part.text) {
|
|
459
|
-
textContent += part.text;
|
|
460
|
-
}
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
}
|
|
464
|
-
// If we reach here, no image was generated
|
|
465
|
-
logger.warn("No image data found in response", {
|
|
466
|
-
model: imageModelName,
|
|
467
|
-
prompt: prompt.substring(0, 100),
|
|
468
|
-
hasTextContent: !!textContent,
|
|
469
|
-
textContent: textContent.substring(0, 200),
|
|
470
|
-
});
|
|
471
|
-
throw new ProviderError(textContent ||
|
|
472
|
-
`Image generation completed but no image data was returned. This may indicate an issue with the model "${imageModelName}" or the prompt: "${prompt}". Please try again or use a different model.`, this.providerName);
|
|
473
|
-
}
|
|
474
|
-
catch (error) {
|
|
475
|
-
logger.error("Image generation failed", {
|
|
476
|
-
error: error instanceof Error ? error.message : String(error),
|
|
477
|
-
model: imageModelName,
|
|
478
|
-
prompt: prompt.substring(0, 100),
|
|
479
|
-
});
|
|
480
|
-
throw this.handleProviderError(error);
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
/**
|
|
484
|
-
* Detect image MIME type from buffer
|
|
485
|
-
*/
|
|
486
|
-
detectImageType(buffer) {
|
|
487
|
-
// Check PNG signature
|
|
488
|
-
if (buffer.length >= 8 &&
|
|
489
|
-
buffer[0] === 0x89 &&
|
|
490
|
-
buffer[1] === 0x50 &&
|
|
491
|
-
buffer[2] === 0x4e &&
|
|
492
|
-
buffer[3] === 0x47) {
|
|
493
|
-
return "image/png";
|
|
494
|
-
}
|
|
495
|
-
// Check JPEG signature
|
|
496
|
-
if (buffer.length >= 3 &&
|
|
497
|
-
buffer[0] === 0xff &&
|
|
498
|
-
buffer[1] === 0xd8 &&
|
|
499
|
-
buffer[2] === 0xff) {
|
|
500
|
-
return "image/jpeg";
|
|
501
|
-
}
|
|
502
|
-
// Check WebP signature
|
|
503
|
-
if (buffer.length >= 12 &&
|
|
504
|
-
buffer[0] === 0x52 &&
|
|
505
|
-
buffer[1] === 0x49 &&
|
|
506
|
-
buffer[2] === 0x46 &&
|
|
507
|
-
buffer[3] === 0x46 &&
|
|
508
|
-
buffer[8] === 0x57 &&
|
|
509
|
-
buffer[9] === 0x45 &&
|
|
510
|
-
buffer[10] === 0x42 &&
|
|
511
|
-
buffer[11] === 0x50) {
|
|
512
|
-
return "image/webp";
|
|
513
|
-
}
|
|
514
|
-
// Check GIF signature
|
|
515
|
-
if (buffer.length >= 6 &&
|
|
516
|
-
buffer[0] === 0x47 &&
|
|
517
|
-
buffer[1] === 0x49 &&
|
|
518
|
-
buffer[2] === 0x46) {
|
|
519
|
-
return "image/gif";
|
|
520
|
-
}
|
|
521
|
-
// Default to PNG if unknown
|
|
522
|
-
return "image/png";
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Estimate token count from text using centralized estimation with provider multipliers
|
|
526
|
-
*/
|
|
527
|
-
estimateTokenCount(text) {
|
|
528
|
-
return estimateTokens(text, "google-ai");
|
|
529
|
-
}
|
|
530
|
-
// executeGenerate removed - BaseProvider handles all generation with tools
|
|
531
|
-
/**
|
|
532
|
-
* Run the file preprocessing this provider's native paths depend on.
|
|
533
|
-
*
|
|
534
|
-
* AI Studio overrides both `generate()` and `executeStream()` and routes
|
|
535
|
-
* straight to the native SDK, so neither reaches
|
|
536
|
-
* `buildMultimodalMessagesArray` — the place that turns `input.files` into
|
|
537
|
-
* text, images, PDFs and `nativeAudioFiles`. `BaseProvider.stream()` does
|
|
538
|
-
* build messages, but onto a throwaway clone whose result is discarded, so
|
|
539
|
-
* the real `options.input` came through untouched.
|
|
540
|
-
*
|
|
541
|
-
* The consequence was asymmetric and easy to miss: `generate()` did this
|
|
542
|
-
* inline and worked, while `stream()` silently dropped every attached file —
|
|
543
|
-
* not just audio, but the metadata summary too. Vertex hit the identical bug
|
|
544
|
-
* (#1258) and solved it with exactly this shape, called from both entry
|
|
545
|
-
* points.
|
|
546
|
-
*/
|
|
547
|
-
async preprocessNativeFileInput(options) {
|
|
548
|
-
// The user-facing aliases (`input.audioFiles`, `input.videoFiles`) are
|
|
549
|
-
// folded into `input.files` here, exactly as the Vertex client does. Only
|
|
550
|
-
// `files` is processed below, so without this a caller who used the
|
|
551
|
-
// documented `audioFiles` field had it silently ignored on both of this
|
|
552
|
-
// provider's paths.
|
|
553
|
-
if (options.input) {
|
|
554
|
-
mergeMediaFileAliases(options.input);
|
|
555
|
-
}
|
|
556
|
-
if (options.input?.files && options.input.files.length > 0) {
|
|
557
|
-
try {
|
|
558
|
-
// Mutates options.input.text / .images / .pdfFiles / .nativeAudioFiles
|
|
559
|
-
// in place.
|
|
560
|
-
await processUnifiedFilesArray(options, 100 * 1024 * 1024, this.providerName);
|
|
561
|
-
}
|
|
562
|
-
catch (fileError) {
|
|
563
|
-
logger.warn(`[GoogleAIStudio] processUnifiedFilesArray threw, continuing without file content: ${fileError instanceof Error ? fileError.message : String(fileError)}`);
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
// Runs even without input.files: a caller can populate input.images
|
|
567
|
-
// directly, and this native path never reaches the shared multimodal
|
|
568
|
-
// builder that would otherwise normalize the formats.
|
|
569
|
-
await normalizeVisionImageFormats(options.input);
|
|
570
|
-
}
|
|
571
|
-
async executeStream(options, analysisSchema) {
|
|
572
|
-
const modelName = options.model || this.modelName;
|
|
573
|
-
// Phase 1: if audio input present, bridge to Gemini Live (Studio) using @google/genai
|
|
574
|
-
if (options.input?.audio) {
|
|
575
|
-
return await this.executeAudioStreamViaGeminiLive(options);
|
|
576
|
-
}
|
|
577
|
-
// #1258, for this provider: stream() must run the same file preprocessing
|
|
578
|
-
// generate() does, or attached files are dropped on this path alone.
|
|
579
|
-
await this.preprocessNativeFileInput(options);
|
|
580
|
-
// Structured output (analysisSchema, JSON format, or schema) is incompatible with tools on Gemini.
|
|
581
|
-
const wantsStructuredOutput = Boolean(analysisSchema || options.output?.format === "json" || options.schema);
|
|
582
|
-
// Tool filter (a0269210): trust options.tools — caller (BaseProvider.stream)
|
|
583
|
-
// already merged MCP/built-in tools with user tools and applied any
|
|
584
|
-
// enabledToolNames filter. Re-attaching getAllTools() here would clobber
|
|
585
|
-
// that filter and re-introduce filtered-out tools.
|
|
586
|
-
const shouldUseTools = !options.disableTools && this.supportsTools() && !wantsStructuredOutput;
|
|
587
|
-
const optionTools = options.tools || {};
|
|
588
|
-
// Merge into options for native SDK path
|
|
589
|
-
let mergedOptions = {
|
|
590
|
-
...options,
|
|
591
|
-
tools: optionTools,
|
|
592
|
-
};
|
|
593
|
-
// Tools + JSON conflict (Gemini), via the shared predicate.
|
|
594
|
-
const wantsJsonOutput = options.output?.format === "json" || options.schema;
|
|
595
|
-
const exclusionInForce = isToolsSchemaExclusionInForce(this.providerName, modelName, !mergedOptions.disableTools, Object.keys(mergedOptions.tools ?? {}).length);
|
|
596
|
-
if (wantsJsonOutput && exclusionInForce) {
|
|
597
|
-
logger.warn("[GoogleAIStudio] Gemini does not support tools and JSON schema output simultaneously. Disabling tools for this request.");
|
|
598
|
-
mergedOptions = { ...mergedOptions, disableTools: true, tools: {} };
|
|
599
|
-
}
|
|
600
|
-
const hasActiveTools = shouldUseTools &&
|
|
601
|
-
!mergedOptions.disableTools &&
|
|
602
|
-
mergedOptions.tools &&
|
|
603
|
-
Object.keys(mergedOptions.tools).length > 0;
|
|
604
|
-
if (hasActiveTools) {
|
|
605
|
-
logger.info("[GoogleAIStudio] Routing to native @google/genai SDK for tool calling", {
|
|
606
|
-
model: modelName,
|
|
607
|
-
totalToolCount: Object.keys(mergedOptions.tools ?? {}).length,
|
|
608
|
-
});
|
|
609
|
-
}
|
|
610
|
-
// Route ALL models through native @google/genai SDK (no more @ai-sdk/google dependency)
|
|
611
|
-
return this.executeNativeGemini3Stream(mergedOptions);
|
|
612
|
-
}
|
|
613
|
-
/**
|
|
614
|
-
* Execute stream using native @google/genai SDK
|
|
615
|
-
* Uses @google/genai directly for all Gemini models (2.0, 2.5, 3.x)
|
|
616
|
-
*/
|
|
617
|
-
async executeNativeGemini3Stream(options) {
|
|
618
|
-
const modelName = options.model || this.modelName;
|
|
619
|
-
return withClientStreamSpan({
|
|
620
|
-
name: "neurolink.provider.stream",
|
|
621
|
-
tracer: tracers.provider,
|
|
622
|
-
attributes: {
|
|
623
|
-
[ATTR.GEN_AI_SYSTEM]: "google-ai",
|
|
624
|
-
[ATTR.GEN_AI_MODEL]: modelName,
|
|
625
|
-
[ATTR.GEN_AI_OPERATION]: "stream",
|
|
626
|
-
[ATTR.NL_PROVIDER]: this.providerName,
|
|
627
|
-
},
|
|
628
|
-
}, async (span) => {
|
|
629
|
-
const startTime = Date.now();
|
|
630
|
-
const timeout = this.getTimeout(options);
|
|
631
|
-
const timeoutController = createTimeoutController(timeout, this.providerName, "stream");
|
|
632
|
-
try {
|
|
633
|
-
const apiKey = this.getApiKey();
|
|
634
|
-
const client = await createGoogleGenAIClient(apiKey, this.getBaseURL());
|
|
635
|
-
logger.debug("[GoogleAIStudio] Using native @google/genai for Gemini 3", {
|
|
636
|
-
model: modelName,
|
|
637
|
-
hasTools: !!options.tools && Object.keys(options.tools).length > 0,
|
|
638
|
-
});
|
|
639
|
-
// Build contents from input. Prepend prior conversation turns so
|
|
640
|
-
// multi-turn callers (memory, loop REPL, agent flows) actually
|
|
641
|
-
// carry context — the previous build started fresh from the
|
|
642
|
-
// current user input only, which silently dropped history.
|
|
643
|
-
//
|
|
644
|
-
// `buildUserPartsWithMultimodal` is the shared helper that also
|
|
645
|
-
// attaches `input.images` and `input.pdfFiles` as `inlineData`
|
|
646
|
-
// parts. The previous AI Studio path pushed only `{ text }` and
|
|
647
|
-
// silently dropped both, which is why the model legitimately
|
|
648
|
-
// reported "no image attached" on multimodal calls.
|
|
649
|
-
const currentContents = [];
|
|
650
|
-
prependConversationMessages(currentContents, options.conversationMessages);
|
|
651
|
-
const userParts = await buildUserPartsWithMultimodal(options.input, options.input.text, "[GoogleAIStudio:stream]");
|
|
652
|
-
currentContents.push({
|
|
653
|
-
role: "user",
|
|
654
|
-
parts: userParts,
|
|
655
|
-
});
|
|
656
|
-
// Convert tools
|
|
657
|
-
let toolsConfig;
|
|
658
|
-
let declarationsResult;
|
|
659
|
-
if (options.tools &&
|
|
660
|
-
Object.keys(options.tools).length > 0 &&
|
|
661
|
-
!options.disableTools) {
|
|
662
|
-
const result = toNativeToolDeclarations(options.tools, "functionDeclarations");
|
|
663
|
-
declarationsResult = result;
|
|
664
|
-
toolsConfig = result.toolsConfig;
|
|
665
|
-
logger.debug("[GoogleAIStudio] Converted tools for native SDK", {
|
|
666
|
-
toolCount: toolsConfig[0].functionDeclarations.length,
|
|
667
|
-
toolNames: toolsConfig[0].functionDeclarations.map((t) => t.name),
|
|
668
|
-
});
|
|
669
|
-
}
|
|
670
|
-
// Native JSON / schema enforcement: when no tools are being sent
|
|
671
|
-
// (the AI Studio orchestrator above already force-disables tools
|
|
672
|
-
// whenever JSON/schema output is requested), enforce the response
|
|
673
|
-
// shape natively via responseMimeType / responseSchema. Without
|
|
674
|
-
// this, JSON output was best-effort prompting only.
|
|
675
|
-
const wantsNativeJson = !toolsConfig &&
|
|
676
|
-
(options.output?.format === "json" || !!options.schema);
|
|
677
|
-
const nativeResponseSchema = wantsNativeJson && options.schema
|
|
678
|
-
? buildGeminiResponseSchema(options.schema)
|
|
679
|
-
: undefined;
|
|
680
|
-
const config = buildNativeConfig({
|
|
681
|
-
...options,
|
|
682
|
-
// Effective model (falls back to the instance default) so the
|
|
683
|
-
// registry sampling-support check sees the model actually used.
|
|
684
|
-
model: modelName,
|
|
685
|
-
wantsJsonOutput: wantsNativeJson,
|
|
686
|
-
responseSchema: nativeResponseSchema,
|
|
687
|
-
}, toolsConfig);
|
|
688
|
-
const maxSteps = computeMaxSteps(options.maxSteps);
|
|
689
|
-
// Compose abort signal from user signal + timeout
|
|
690
|
-
const composedSignal = composeAbortSignals(options.abortSignal, timeoutController?.controller.signal);
|
|
691
|
-
// Create a push-based text channel so the caller receives tokens as
|
|
692
|
-
// they arrive from the network rather than after full buffering.
|
|
693
|
-
const channel = createStreamChannel();
|
|
694
|
-
// Shared mutable state updated by the background agentic loop.
|
|
695
|
-
const allToolCalls = [];
|
|
696
|
-
// Mirror the Vertex Gemini stream path: track tool executions so
|
|
697
|
-
// the storage hook can persist real outputs and StreamResult can
|
|
698
|
-
// surface toolsUsed/toolExecutions for tool-bearing turns.
|
|
699
|
-
const toolExecutions = [];
|
|
700
|
-
// analyticsResolvers lets the background loop settle the analytics
|
|
701
|
-
// promise once token counts are known (after the loop completes).
|
|
702
|
-
let analyticsResolve;
|
|
703
|
-
let analyticsReject;
|
|
704
|
-
const analyticsPromise = new Promise((res, rej) => {
|
|
705
|
-
analyticsResolve = res;
|
|
706
|
-
analyticsReject = rej;
|
|
707
|
-
});
|
|
708
|
-
// Shared metadata object mutated by the background loop so the
|
|
709
|
-
// returned object reflects the final values after stream completion.
|
|
710
|
-
const metadata = {
|
|
711
|
-
streamId: `native-${Date.now()}`,
|
|
712
|
-
startTime,
|
|
713
|
-
responseTime: 0,
|
|
714
|
-
totalToolExecutions: 0,
|
|
715
|
-
};
|
|
716
|
-
// Run the agentic loop in the background without awaiting it here,
|
|
717
|
-
// so we can return the StreamResult (with channel.iterable) immediately.
|
|
718
|
-
const loopPromise = (async () => {
|
|
719
|
-
let lastStepText = "";
|
|
720
|
-
let totalInputTokens = 0;
|
|
721
|
-
let totalOutputTokens = 0;
|
|
722
|
-
let totalCacheReadTokens = 0;
|
|
723
|
-
let totalReasoningTokens = 0;
|
|
724
|
-
let step = 0;
|
|
725
|
-
// Cheap trigger for the in-turn reclaim, mirroring the Vertex twin.
|
|
726
|
-
// Planning serializes the WHOLE accumulated history to estimate it,
|
|
727
|
-
// so running it unconditionally charges that once per step for the
|
|
728
|
-
// life of the turn; the guard tracks real prompt counts plus
|
|
729
|
-
// measured growth instead, and it supplies the observed count that
|
|
730
|
-
// calibrates the planner's char estimate.
|
|
731
|
-
const contextGuard = createContextGuard(getContextWindowSize("googleAiStudio", modelName));
|
|
732
|
-
try {
|
|
733
|
-
// Agentic loop for tool calling
|
|
734
|
-
// The turn itself now runs on the shared engine: the step cap,
|
|
735
|
-
// tool dispatch, the failure breaker and usage accumulation are
|
|
736
|
-
// engine-owned. Everything below is the provider half — building
|
|
737
|
-
// one request, and the per-step side effects the old loop
|
|
738
|
-
// performed inline.
|
|
739
|
-
const baseAdapter = createGeminiLoopAdapter({
|
|
740
|
-
providerLabel: "GoogleAIStudio",
|
|
741
|
-
maxSteps,
|
|
742
|
-
// Same threshold the hand-rolled dispatcher used, which is
|
|
743
|
-
// what makes an always-failing tool dispatch exactly twice.
|
|
744
|
-
toolFailureBreaker: { maxRetries: DEFAULT_TOOL_MAX_RETRIES },
|
|
745
|
-
liveTools: options.tools ?? {},
|
|
746
|
-
...(declarationsResult
|
|
747
|
-
? { declarations: declarationsResult }
|
|
748
|
-
: {}),
|
|
749
|
-
buildRequest: (contents) => ({
|
|
750
|
-
model: modelName,
|
|
751
|
-
contents,
|
|
752
|
-
config,
|
|
753
|
-
...(composedSignal
|
|
754
|
-
? { httpOptions: { signal: composedSignal } }
|
|
755
|
-
: {}),
|
|
756
|
-
}),
|
|
757
|
-
sendStep: async (request) => client.models.generateContentStream(request),
|
|
758
|
-
noteUsage: (inputTokens, outputTokens) => {
|
|
759
|
-
contextGuard.noteUsage(inputTokens, outputTokens);
|
|
760
|
-
},
|
|
761
|
-
// Pure: the engine assigns what this returns. The old loop
|
|
762
|
-
// reclaimed in place because it owned `currentContents`.
|
|
763
|
-
planReclaim: (contents, stepIndex) => {
|
|
764
|
-
if (stepIndex !== 0 && !contextGuard.shouldStop()) {
|
|
765
|
-
return undefined;
|
|
766
|
-
}
|
|
767
|
-
const working = [...contents];
|
|
768
|
-
if (!reclaimAiStudioContext(working, modelName, contextGuard.projectedNextPromptTokens)) {
|
|
769
|
-
return undefined;
|
|
770
|
-
}
|
|
771
|
-
contextGuard.resetAfterReclaim();
|
|
772
|
-
return working;
|
|
773
|
-
},
|
|
774
|
-
});
|
|
775
|
-
// Wrapped because these fire once PER STEP in the loop this
|
|
776
|
-
// replaces, and buildToolResultMessages is the only hook that
|
|
777
|
-
// runs per step with exactly that step's results. Reading them
|
|
778
|
-
// off the turn's final result would batch every step into one
|
|
779
|
-
// late write and lose the per-step thought signature.
|
|
780
|
-
const adapter = {
|
|
781
|
-
...baseAdapter,
|
|
782
|
-
buildToolResultMessages: (contents, stepResult, toolResults) => {
|
|
783
|
-
step++;
|
|
784
|
-
for (const call of stepResult.toolCalls) {
|
|
785
|
-
span.addEvent("gen_ai.tool_call", {
|
|
786
|
-
"tool.name": call.name,
|
|
787
|
-
"tool.step": step,
|
|
788
|
-
});
|
|
789
|
-
}
|
|
790
|
-
lastStepText = stepResult.text || lastStepText;
|
|
791
|
-
for (const call of stepResult.toolCalls) {
|
|
792
|
-
allToolCalls.push({
|
|
793
|
-
toolName: call.name,
|
|
794
|
-
args: call.args,
|
|
795
|
-
});
|
|
796
|
-
}
|
|
797
|
-
for (const result of toolResults) {
|
|
798
|
-
toolExecutions.push({
|
|
799
|
-
name: result.name,
|
|
800
|
-
input: result.args,
|
|
801
|
-
output: result.output,
|
|
802
|
-
});
|
|
803
|
-
}
|
|
804
|
-
if (toolResults.length > 0) {
|
|
805
|
-
const stepThoughtSig = extractThoughtSignature(stepResult.raw.rawResponseParts);
|
|
806
|
-
withTimeout(this.handleToolExecutionStorage(stepResult.toolCalls.map((call, i) => ({
|
|
807
|
-
toolName: call.name,
|
|
808
|
-
args: call.args,
|
|
809
|
-
...(i === 0 && stepThoughtSig
|
|
810
|
-
? { thoughtSignature: stepThoughtSig }
|
|
811
|
-
: {}),
|
|
812
|
-
stepIndex: step,
|
|
813
|
-
})), toolResults.map((result) => ({
|
|
814
|
-
toolName: result.name,
|
|
815
|
-
output: result.output,
|
|
816
|
-
stepIndex: step,
|
|
817
|
-
})), options, new Date()), TOOL_STORAGE_TIMEOUT_MS, "tool storage write timed out").catch((error) => {
|
|
818
|
-
logger.warn("[GoogleAIStudio] Failed to store native tool executions", {
|
|
819
|
-
error: error instanceof Error
|
|
820
|
-
? error.message
|
|
821
|
-
: String(error),
|
|
822
|
-
});
|
|
823
|
-
});
|
|
824
|
-
}
|
|
825
|
-
const next = baseAdapter.buildToolResultMessages(contents, stepResult, toolResults);
|
|
826
|
-
// Project this step's growth: the appended tool results ride
|
|
827
|
-
// the next prompt, which the provider has not reported on yet.
|
|
828
|
-
try {
|
|
829
|
-
const appended = next[next.length - 1];
|
|
830
|
-
contextGuard.noteAppendedChars(JSON.stringify(appended?.parts ?? []).length);
|
|
831
|
-
}
|
|
832
|
-
catch {
|
|
833
|
-
/* estimation is best-effort — never break the loop */
|
|
834
|
-
}
|
|
835
|
-
return next;
|
|
836
|
-
},
|
|
837
|
-
};
|
|
838
|
-
const engineTools = {};
|
|
839
|
-
for (const [name, tool] of Object.entries(options.tools ?? {})) {
|
|
840
|
-
const execute = tool?.execute;
|
|
841
|
-
if (!execute) {
|
|
842
|
-
continue;
|
|
843
|
-
}
|
|
844
|
-
engineTools[name] = {
|
|
845
|
-
execute: async (args, opts) => execute(args, opts),
|
|
846
|
-
};
|
|
847
|
-
}
|
|
848
|
-
const { stream: engineStream, resultPromise } = runAgenticLoop(adapter, currentContents, {
|
|
849
|
-
tools: engineTools,
|
|
850
|
-
...(composedSignal ? { abortSignal: composedSignal } : {}),
|
|
851
|
-
});
|
|
852
|
-
const pump = (async () => {
|
|
853
|
-
for await (const chunk of engineStream) {
|
|
854
|
-
channel.push(chunk);
|
|
855
|
-
}
|
|
856
|
-
})();
|
|
857
|
-
let engineResult;
|
|
858
|
-
try {
|
|
859
|
-
engineResult = await resultPromise;
|
|
860
|
-
}
|
|
861
|
-
catch (error) {
|
|
862
|
-
await pump.catch(() => { });
|
|
863
|
-
logger.error("[GoogleAIStudio] Native SDK error", error);
|
|
864
|
-
throw this.handleProviderError(error);
|
|
865
|
-
}
|
|
866
|
-
await pump;
|
|
867
|
-
totalInputTokens += engineResult.usage.inputTokens;
|
|
868
|
-
totalOutputTokens += engineResult.usage.outputTokens;
|
|
869
|
-
totalCacheReadTokens += engineResult.usage.cacheReadTokens ?? 0;
|
|
870
|
-
totalReasoningTokens += engineResult.usage.reasoningTokens ?? 0;
|
|
871
|
-
// The turn produced a final answer when the model stopped
|
|
872
|
-
// calling tools of its own accord, rather than being cut off at
|
|
873
|
-
// the cap.
|
|
874
|
-
const completedWithFinalAnswer = engineResult.toolCalls.length === 0 ||
|
|
875
|
-
engineResult.finishReason !== "tool-calls";
|
|
876
|
-
// Handle max-steps termination: if the model was still calling
|
|
877
|
-
// tools when we hit the limit, push a synthetic final message.
|
|
878
|
-
const hitStepLimitWithoutFinalAnswer = step >= maxSteps && !completedWithFinalAnswer;
|
|
879
|
-
if (hitStepLimitWithoutFinalAnswer) {
|
|
880
|
-
const fallback = handleMaxStepsTermination("[GoogleAIStudio]", step, maxSteps, "", // finalText is empty — model didn't stop on its own
|
|
881
|
-
lastStepText);
|
|
882
|
-
if (fallback) {
|
|
883
|
-
channel.push({ content: fallback });
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
const responseTime = Date.now() - startTime;
|
|
887
|
-
// Update shared metadata so the returned object reflects final values.
|
|
888
|
-
metadata.responseTime = responseTime;
|
|
889
|
-
metadata.totalToolExecutions = allToolCalls.length;
|
|
890
|
-
// Set token usage and finish reason on the span
|
|
891
|
-
span.setAttribute(ATTR.GEN_AI_INPUT_TOKENS, totalInputTokens);
|
|
892
|
-
span.setAttribute(ATTR.GEN_AI_OUTPUT_TOKENS, totalOutputTokens);
|
|
893
|
-
span.setAttribute(ATTR.GEN_AI_FINISH_REASON, hitStepLimitWithoutFinalAnswer ? "max_steps" : "stop");
|
|
894
|
-
// Gemini promptTokenCount is OVERLAPPING: it already includes
|
|
895
|
-
// cachedContentTokenCount. Subtract once here so calculateCost
|
|
896
|
-
// bills the cached portion at the cheaper cacheRead rate without
|
|
897
|
-
// double-counting. Total billable tokens are conserved.
|
|
898
|
-
const adjustedInputTokens = Math.max(0, totalInputTokens - totalCacheReadTokens);
|
|
899
|
-
analyticsResolve({
|
|
900
|
-
provider: this.providerName,
|
|
901
|
-
model: modelName,
|
|
902
|
-
tokenUsage: {
|
|
903
|
-
input: adjustedInputTokens,
|
|
904
|
-
// Thinking tokens are billed at the output rate but Gemini
|
|
905
|
-
// does NOT include them in candidatesTokenCount, so they
|
|
906
|
-
// are folded into `output` — what calculateCost bills at
|
|
907
|
-
// the output rate — with `reasoning` as the subset.
|
|
908
|
-
output: totalOutputTokens + totalReasoningTokens,
|
|
909
|
-
total: adjustedInputTokens +
|
|
910
|
-
totalCacheReadTokens +
|
|
911
|
-
totalOutputTokens +
|
|
912
|
-
totalReasoningTokens,
|
|
913
|
-
...(totalCacheReadTokens > 0
|
|
914
|
-
? { cacheReadTokens: totalCacheReadTokens }
|
|
915
|
-
: {}),
|
|
916
|
-
...(totalReasoningTokens > 0
|
|
917
|
-
? { reasoning: totalReasoningTokens }
|
|
918
|
-
: {}),
|
|
919
|
-
},
|
|
920
|
-
requestDuration: responseTime,
|
|
921
|
-
timestamp: new Date().toISOString(),
|
|
922
|
-
});
|
|
923
|
-
channel.close();
|
|
924
|
-
}
|
|
925
|
-
catch (err) {
|
|
926
|
-
channel.error(err);
|
|
927
|
-
analyticsReject(err);
|
|
928
|
-
}
|
|
929
|
-
finally {
|
|
930
|
-
timeoutController?.cleanup();
|
|
931
|
-
}
|
|
932
|
-
})();
|
|
933
|
-
// Suppress unhandled-rejection warnings on loopPromise — errors are
|
|
934
|
-
// forwarded to the channel and will surface when the caller iterates.
|
|
935
|
-
loopPromise.catch(() => undefined);
|
|
936
|
-
const result = {
|
|
937
|
-
stream: channel.iterable,
|
|
938
|
-
provider: this.providerName,
|
|
939
|
-
model: modelName,
|
|
940
|
-
toolCalls: allToolCalls,
|
|
941
|
-
analytics: analyticsPromise,
|
|
942
|
-
metadata,
|
|
943
|
-
};
|
|
944
|
-
// Surface tools-used + executions via getters so they resolve at
|
|
945
|
-
// access time, after the background loop has populated the live
|
|
946
|
-
// arrays. Same lazy pattern used for `structuredOutput` elsewhere.
|
|
947
|
-
Object.defineProperty(result, "toolsUsed", {
|
|
948
|
-
enumerable: true,
|
|
949
|
-
configurable: true,
|
|
950
|
-
get: () => allToolCalls.map((tc) => tc.toolName),
|
|
951
|
-
});
|
|
952
|
-
Object.defineProperty(result, "toolExecutions", {
|
|
953
|
-
enumerable: true,
|
|
954
|
-
configurable: true,
|
|
955
|
-
get: () => transformToolExecutions(toolExecutions),
|
|
956
|
-
});
|
|
957
|
-
return result;
|
|
958
|
-
}
|
|
959
|
-
finally {
|
|
960
|
-
// Timeout controller cleanup is managed inside the background loop
|
|
961
|
-
}
|
|
962
|
-
}, (r) => r.stream, (r, wrapped) => ({ ...r, stream: wrapped }));
|
|
963
|
-
}
|
|
964
|
-
/**
|
|
965
|
-
* Execute generate using native @google/genai SDK for Gemini 3 models
|
|
966
|
-
* This bypasses @ai-sdk/google to properly handle thought_signature
|
|
967
|
-
*/
|
|
968
|
-
async executeNativeGemini3Generate(options) {
|
|
969
|
-
const modelName = options.model || this.modelName;
|
|
970
|
-
return withClientSpan({
|
|
971
|
-
name: "neurolink.provider.generate",
|
|
972
|
-
tracer: tracers.provider,
|
|
973
|
-
attributes: {
|
|
974
|
-
[ATTR.GEN_AI_SYSTEM]: "google-ai",
|
|
975
|
-
[ATTR.GEN_AI_MODEL]: modelName,
|
|
976
|
-
[ATTR.GEN_AI_OPERATION]: "generate",
|
|
977
|
-
[ATTR.NL_PROVIDER]: this.providerName,
|
|
978
|
-
},
|
|
979
|
-
}, async (span) => {
|
|
980
|
-
const startTime = Date.now();
|
|
981
|
-
const timeout = this.getTimeout(options);
|
|
982
|
-
const timeoutController = createTimeoutController(timeout, this.providerName, "generate");
|
|
983
|
-
try {
|
|
984
|
-
const apiKey = this.getApiKey();
|
|
985
|
-
const client = await createGoogleGenAIClient(apiKey, this.getBaseURL());
|
|
986
|
-
logger.debug("[GoogleAIStudio] Using native @google/genai for Gemini 3 generate", {
|
|
987
|
-
model: modelName,
|
|
988
|
-
hasTools: !!options.tools && Object.keys(options.tools).length > 0,
|
|
989
|
-
});
|
|
990
|
-
// Build contents from input
|
|
991
|
-
// Prefer input.text over prompt — processCSVFilesForNativeSDK enriches
|
|
992
|
-
// input.text with inlined CSV data, so using prompt first would discard it.
|
|
993
|
-
const promptText = options.input?.text || options.prompt || "";
|
|
994
|
-
// Prepend prior conversation turns so multi-turn generate calls
|
|
995
|
-
// see history; otherwise the native generate path silently drops
|
|
996
|
-
// every turn before the current prompt.
|
|
997
|
-
//
|
|
998
|
-
// `buildUserPartsWithMultimodal` also attaches inline image / PDF
|
|
999
|
-
// parts. Without it the request body was text-only and the model
|
|
1000
|
-
// legitimately reported "no image / PDF attached".
|
|
1001
|
-
const currentContents = [];
|
|
1002
|
-
prependConversationMessages(currentContents, options.conversationMessages);
|
|
1003
|
-
const userParts = await buildUserPartsWithMultimodal(options.input, promptText, "[GoogleAIStudio:generate]");
|
|
1004
|
-
currentContents.push({
|
|
1005
|
-
role: "user",
|
|
1006
|
-
parts: userParts,
|
|
1007
|
-
});
|
|
1008
|
-
// Convert tools (a0269210: trust options.tools — already merged + filtered upstream)
|
|
1009
|
-
let toolsConfig;
|
|
1010
|
-
let declarationsResult;
|
|
1011
|
-
const shouldUseTools = !options.disableTools;
|
|
1012
|
-
// Structured output (JSON format or schema) is incompatible with
|
|
1013
|
-
// tools on Gemini — routed through the shared predicate so this
|
|
1014
|
-
// decision matches stream()'s orchestrator (previously this path
|
|
1015
|
-
// had no proactive check and silently dropped the schema instead).
|
|
1016
|
-
const wantsNativeJsonRequested = Boolean(options.output?.format === "json" || options.schema);
|
|
1017
|
-
const exclusionInForce = isToolsSchemaExclusionInForce(this.providerName, modelName, shouldUseTools, Object.keys(options.tools || {}).length);
|
|
1018
|
-
if (wantsNativeJsonRequested && exclusionInForce) {
|
|
1019
|
-
logger.warn("[GoogleAIStudio] Gemini does not support tools and JSON schema output simultaneously. Disabling tools for this request (generate()).");
|
|
1020
|
-
}
|
|
1021
|
-
// Both conjuncts, matching the warning directly above and the
|
|
1022
|
-
// stream path's gate. `isToolsSchemaExclusionInForce` answers "does
|
|
1023
|
-
// the tools/schema exclusion APPLY to this provider and model", and
|
|
1024
|
-
// is true for any Gemini request that has tools at all — it is not
|
|
1025
|
-
// "the exclusion is triggered". Testing `!exclusionInForce` alone
|
|
1026
|
-
// therefore made this branch reachable only when there were NO
|
|
1027
|
-
// tools, so every caller-supplied tool was dropped on the generate
|
|
1028
|
-
// path whether or not structured output was ever requested.
|
|
1029
|
-
if (shouldUseTools &&
|
|
1030
|
-
!(wantsNativeJsonRequested && exclusionInForce)) {
|
|
1031
|
-
const tools = options.tools || {};
|
|
1032
|
-
if (Object.keys(tools).length > 0) {
|
|
1033
|
-
const result = toNativeToolDeclarations(tools, "functionDeclarations");
|
|
1034
|
-
declarationsResult = result;
|
|
1035
|
-
toolsConfig = result.toolsConfig;
|
|
1036
|
-
logger.debug("[GoogleAIStudio] Converted tools for native SDK generate", {
|
|
1037
|
-
toolCount: toolsConfig[0].functionDeclarations.length,
|
|
1038
|
-
toolNames: toolsConfig[0].functionDeclarations.map((t) => t.name),
|
|
1039
|
-
});
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
// Native JSON / schema enforcement (generate path). Mirrors the
|
|
1043
|
-
// stream block above; only set when no tools are being sent
|
|
1044
|
-
// because Gemini cannot combine function calling with JSON mime.
|
|
1045
|
-
const wantsNativeJson = !toolsConfig && wantsNativeJsonRequested;
|
|
1046
|
-
const nativeResponseSchema = wantsNativeJson && options.schema
|
|
1047
|
-
? buildGeminiResponseSchema(options.schema)
|
|
1048
|
-
: undefined;
|
|
1049
|
-
const config = buildNativeConfig({
|
|
1050
|
-
...options,
|
|
1051
|
-
// Effective model (falls back to the instance default) so the
|
|
1052
|
-
// registry sampling-support check sees the model actually used.
|
|
1053
|
-
model: modelName,
|
|
1054
|
-
wantsJsonOutput: wantsNativeJson,
|
|
1055
|
-
responseSchema: nativeResponseSchema,
|
|
1056
|
-
}, toolsConfig);
|
|
1057
|
-
const composedSignal = composeAbortSignals(options.abortSignal, timeoutController?.controller.signal);
|
|
1058
|
-
const maxSteps = computeMaxSteps(options.maxSteps);
|
|
1059
|
-
let finalText = "";
|
|
1060
|
-
let lastStepText = "";
|
|
1061
|
-
let totalInputTokens = 0;
|
|
1062
|
-
let totalOutputTokens = 0;
|
|
1063
|
-
let totalCacheReadTokens = 0;
|
|
1064
|
-
let totalReasoningTokens = 0;
|
|
1065
|
-
const allToolCalls = [];
|
|
1066
|
-
const toolExecutions = [];
|
|
1067
|
-
let step = 0;
|
|
1068
|
-
// Cheap reclaim trigger — see the stream twin.
|
|
1069
|
-
const contextGuard = createContextGuard(getContextWindowSize("googleAiStudio", modelName));
|
|
1070
|
-
// Agentic loop for tool calling
|
|
1071
|
-
// Same shared engine as the streaming twin. This path has no
|
|
1072
|
-
// consumer channel — generate() returns one result rather than
|
|
1073
|
-
// streaming — so the engine's stream is drained and discarded, and
|
|
1074
|
-
// the turn's text comes from the result.
|
|
1075
|
-
const baseAdapter = createGeminiLoopAdapter({
|
|
1076
|
-
providerLabel: "GoogleAIStudio",
|
|
1077
|
-
maxSteps,
|
|
1078
|
-
toolFailureBreaker: { maxRetries: DEFAULT_TOOL_MAX_RETRIES },
|
|
1079
|
-
liveTools: options.tools ?? {},
|
|
1080
|
-
...(declarationsResult ? { declarations: declarationsResult } : {}),
|
|
1081
|
-
buildRequest: (contents) => ({
|
|
1082
|
-
model: modelName,
|
|
1083
|
-
contents,
|
|
1084
|
-
config,
|
|
1085
|
-
...(composedSignal
|
|
1086
|
-
? { httpOptions: { signal: composedSignal } }
|
|
1087
|
-
: {}),
|
|
1088
|
-
}),
|
|
1089
|
-
sendStep: async (request) => client.models.generateContentStream(request),
|
|
1090
|
-
noteUsage: (inputTokens, outputTokens) => {
|
|
1091
|
-
contextGuard.noteUsage(inputTokens, outputTokens);
|
|
1092
|
-
},
|
|
1093
|
-
planReclaim: (contents, stepIndex) => {
|
|
1094
|
-
if (stepIndex !== 0 && !contextGuard.shouldStop()) {
|
|
1095
|
-
return undefined;
|
|
1096
|
-
}
|
|
1097
|
-
const working = [...contents];
|
|
1098
|
-
if (!reclaimAiStudioContext(working, modelName, contextGuard.projectedNextPromptTokens)) {
|
|
1099
|
-
return undefined;
|
|
1100
|
-
}
|
|
1101
|
-
contextGuard.resetAfterReclaim();
|
|
1102
|
-
return working;
|
|
1103
|
-
},
|
|
1104
|
-
});
|
|
1105
|
-
const adapter = {
|
|
1106
|
-
...baseAdapter,
|
|
1107
|
-
buildToolResultMessages: (contents, stepResult, toolResults) => {
|
|
1108
|
-
step++;
|
|
1109
|
-
for (const call of stepResult.toolCalls) {
|
|
1110
|
-
span.addEvent("gen_ai.tool_call", {
|
|
1111
|
-
"tool.name": call.name,
|
|
1112
|
-
"tool.step": step,
|
|
1113
|
-
});
|
|
1114
|
-
allToolCalls.push({ toolName: call.name, args: call.args });
|
|
1115
|
-
}
|
|
1116
|
-
lastStepText = stepResult.text || lastStepText;
|
|
1117
|
-
for (const result of toolResults) {
|
|
1118
|
-
toolExecutions.push({
|
|
1119
|
-
name: result.name,
|
|
1120
|
-
input: result.args,
|
|
1121
|
-
output: result.output,
|
|
1122
|
-
});
|
|
1123
|
-
}
|
|
1124
|
-
if (toolResults.length > 0) {
|
|
1125
|
-
const stepThoughtSig = extractThoughtSignature(stepResult.raw.rawResponseParts);
|
|
1126
|
-
withTimeout(this.handleToolExecutionStorage(stepResult.toolCalls.map((call, i) => ({
|
|
1127
|
-
toolName: call.name,
|
|
1128
|
-
args: call.args,
|
|
1129
|
-
...(i === 0 && stepThoughtSig
|
|
1130
|
-
? { thoughtSignature: stepThoughtSig }
|
|
1131
|
-
: {}),
|
|
1132
|
-
stepIndex: step,
|
|
1133
|
-
})), toolResults.map((result) => ({
|
|
1134
|
-
toolName: result.name,
|
|
1135
|
-
output: result.output,
|
|
1136
|
-
stepIndex: step,
|
|
1137
|
-
})), options, new Date()), TOOL_STORAGE_TIMEOUT_MS, "tool storage write timed out").catch((error) => {
|
|
1138
|
-
logger.warn("[GoogleAIStudio] Failed to store native tool executions", {
|
|
1139
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1140
|
-
});
|
|
1141
|
-
});
|
|
1142
|
-
}
|
|
1143
|
-
const next = baseAdapter.buildToolResultMessages(contents, stepResult, toolResults);
|
|
1144
|
-
try {
|
|
1145
|
-
const appended = next[next.length - 1];
|
|
1146
|
-
contextGuard.noteAppendedChars(JSON.stringify(appended?.parts ?? []).length);
|
|
1147
|
-
}
|
|
1148
|
-
catch {
|
|
1149
|
-
/* estimation is best-effort — never break the loop */
|
|
1150
|
-
}
|
|
1151
|
-
return next;
|
|
1152
|
-
},
|
|
1153
|
-
};
|
|
1154
|
-
const engineTools = {};
|
|
1155
|
-
for (const [name, tool] of Object.entries(options.tools ?? {})) {
|
|
1156
|
-
const execute = tool?.execute;
|
|
1157
|
-
if (!execute) {
|
|
1158
|
-
continue;
|
|
1159
|
-
}
|
|
1160
|
-
engineTools[name] = {
|
|
1161
|
-
execute: async (args, opts) => execute(args, opts),
|
|
1162
|
-
};
|
|
1163
|
-
}
|
|
1164
|
-
const { stream: engineStream, resultPromise } = runAgenticLoop(adapter, currentContents, {
|
|
1165
|
-
tools: engineTools,
|
|
1166
|
-
...(composedSignal ? { abortSignal: composedSignal } : {}),
|
|
1167
|
-
});
|
|
1168
|
-
// Drained, not consumed: nothing streams out of generate(), but an
|
|
1169
|
-
// undrained channel would stall the engine mid-turn.
|
|
1170
|
-
const drain = (async () => {
|
|
1171
|
-
for await (const chunk of engineStream) {
|
|
1172
|
-
void chunk;
|
|
1173
|
-
}
|
|
1174
|
-
})();
|
|
1175
|
-
let engineResult;
|
|
1176
|
-
try {
|
|
1177
|
-
engineResult = await resultPromise;
|
|
1178
|
-
}
|
|
1179
|
-
catch (error) {
|
|
1180
|
-
await drain.catch(() => { });
|
|
1181
|
-
logger.error("[GoogleAIStudio] Native SDK generate error", error);
|
|
1182
|
-
throw this.handleProviderError(error);
|
|
1183
|
-
}
|
|
1184
|
-
await drain;
|
|
1185
|
-
totalInputTokens += engineResult.usage.inputTokens;
|
|
1186
|
-
totalOutputTokens += engineResult.usage.outputTokens;
|
|
1187
|
-
totalCacheReadTokens += engineResult.usage.cacheReadTokens ?? 0;
|
|
1188
|
-
totalReasoningTokens += engineResult.usage.reasoningTokens ?? 0;
|
|
1189
|
-
finalText = engineResult.text;
|
|
1190
|
-
finalText = handleMaxStepsTermination("[GoogleAIStudio]", step, maxSteps, finalText, lastStepText);
|
|
1191
|
-
const responseTime = Date.now() - startTime;
|
|
1192
|
-
// Set token usage and finish reason on the span
|
|
1193
|
-
span.setAttribute(ATTR.GEN_AI_INPUT_TOKENS, totalInputTokens);
|
|
1194
|
-
span.setAttribute(ATTR.GEN_AI_OUTPUT_TOKENS, totalOutputTokens);
|
|
1195
|
-
span.setAttribute(ATTR.GEN_AI_FINISH_REASON, step >= maxSteps ? "max_steps" : "stop");
|
|
1196
|
-
// Build EnhancedGenerateResult and route through enhanceResult so
|
|
1197
|
-
// analytics / evaluation / tracing stay attached. The native AI
|
|
1198
|
-
// Studio generate path bypasses BaseProvider.generate(), so
|
|
1199
|
-
// skipping enhanceResult would silently drop those features.
|
|
1200
|
-
// Gemini promptTokenCount is OVERLAPPING (already includes
|
|
1201
|
-
// cachedContentTokenCount). Subtract once so the cached portion is
|
|
1202
|
-
// billed at the cheaper cacheRead rate without double-counting.
|
|
1203
|
-
const adjustedInputTokens = Math.max(0, totalInputTokens - totalCacheReadTokens);
|
|
1204
|
-
const baseResult = {
|
|
1205
|
-
content: finalText,
|
|
1206
|
-
provider: this.providerName,
|
|
1207
|
-
model: modelName,
|
|
1208
|
-
usage: {
|
|
1209
|
-
input: adjustedInputTokens,
|
|
1210
|
-
// Thinking tokens are billed at the output rate but Gemini
|
|
1211
|
-
// does NOT include them in candidatesTokenCount, so they are
|
|
1212
|
-
// folded into `output` — what calculateCost bills at the
|
|
1213
|
-
// output rate — with `reasoning` as the subset.
|
|
1214
|
-
output: totalOutputTokens + totalReasoningTokens,
|
|
1215
|
-
total: adjustedInputTokens +
|
|
1216
|
-
totalCacheReadTokens +
|
|
1217
|
-
totalOutputTokens +
|
|
1218
|
-
totalReasoningTokens,
|
|
1219
|
-
...(totalCacheReadTokens > 0
|
|
1220
|
-
? { cacheReadTokens: totalCacheReadTokens }
|
|
1221
|
-
: {}),
|
|
1222
|
-
...(totalReasoningTokens > 0
|
|
1223
|
-
? { reasoning: totalReasoningTokens }
|
|
1224
|
-
: {}),
|
|
1225
|
-
},
|
|
1226
|
-
...(totalReasoningTokens > 0 && {
|
|
1227
|
-
reasoningTokens: totalReasoningTokens,
|
|
1228
|
-
}),
|
|
1229
|
-
responseTime,
|
|
1230
|
-
toolsUsed: allToolCalls.map((tc) => tc.toolName),
|
|
1231
|
-
toolExecutions: resolveToolExecutionRecords(options, toolExecutions),
|
|
1232
|
-
enhancedWithTools: allToolCalls.length > 0,
|
|
1233
|
-
};
|
|
1234
|
-
return this.enhanceResult(baseResult, options, startTime);
|
|
1235
|
-
}
|
|
1236
|
-
finally {
|
|
1237
|
-
timeoutController?.cleanup();
|
|
1238
|
-
}
|
|
1239
|
-
});
|
|
1240
|
-
}
|
|
1241
|
-
/**
|
|
1242
|
-
* Override generate to route Gemini 3 models with tools to native SDK
|
|
1243
|
-
*/
|
|
1244
|
-
async generate(optionsOrPrompt) {
|
|
1245
|
-
// Normalize options
|
|
1246
|
-
const options = typeof optionsOrPrompt === "string"
|
|
1247
|
-
? { prompt: optionsOrPrompt }
|
|
1248
|
-
: optionsOrPrompt;
|
|
1249
|
-
const modelName = options.model || this.modelName;
|
|
1250
|
-
// Image-generation models reject function-calling. Route them to
|
|
1251
|
-
// executeImageGeneration without merging tools. This must happen
|
|
1252
|
-
// BEFORE getToolsForStream to avoid leaking registered (MCP / built-in)
|
|
1253
|
-
// tools into the image API request, which trips
|
|
1254
|
-
// "Function calling is not enabled for this model".
|
|
1255
|
-
// startsWith (not includes) so a hypothetical text model whose ID
|
|
1256
|
-
// contains an image-model string as a substring isn't silently routed
|
|
1257
|
-
// to executeImageGeneration and stripped of tool support.
|
|
1258
|
-
const isImageModel = IMAGE_GENERATION_MODELS.some((m) => modelName.toLowerCase().startsWith(m.toLowerCase()));
|
|
1259
|
-
if (isImageModel) {
|
|
1260
|
-
logger.info("[GoogleAIStudio] Routing image generation model to executeImageGeneration", { model: modelName });
|
|
1261
|
-
return this.executeImageGeneration(options);
|
|
1262
|
-
}
|
|
1263
|
-
// TTS direct-synthesis mode: synthesise the input text directly (no LLM
|
|
1264
|
-
// call). BaseProvider.runGenerateInActiveContext does the same dispatch
|
|
1265
|
-
// — replicated here because AI Studio's override bypasses that path.
|
|
1266
|
-
if (options.tts?.enabled && !options.tts?.useAiResponse) {
|
|
1267
|
-
logger.info("[GoogleAIStudio] Routing TTS direct-synthesis to handleDirectTTSSynthesis", { model: modelName });
|
|
1268
|
-
return this.handleDirectTTSSynthesis(options, Date.now());
|
|
1269
|
-
}
|
|
1270
|
-
await this.preprocessNativeFileInput(options);
|
|
1271
|
-
// Merge registered (built-in / MCP) tools with caller-supplied tools.
|
|
1272
|
-
// AI Studio's generate() bypasses BaseProvider.generate(), so the
|
|
1273
|
-
// ToolsManager-driven merge that normally injects sdk.registerTool()
|
|
1274
|
-
// entries never runs here. Without this call, registered tools never
|
|
1275
|
-
// reach the native function-calling path.
|
|
1276
|
-
const baseTools = !options.disableTools
|
|
1277
|
-
? await this.getToolsForStream(options)
|
|
1278
|
-
: {};
|
|
1279
|
-
let mergedOptions = {
|
|
1280
|
-
...options,
|
|
1281
|
-
tools: baseTools,
|
|
1282
|
-
};
|
|
1283
|
-
// Check for tools + JSON schema conflict (Gemini limitation)
|
|
1284
|
-
const wantsJsonOutput = options.output?.format === "json" || options.schema;
|
|
1285
|
-
if (wantsJsonOutput &&
|
|
1286
|
-
mergedOptions.tools &&
|
|
1287
|
-
Object.keys(mergedOptions.tools).length > 0 &&
|
|
1288
|
-
!mergedOptions.disableTools) {
|
|
1289
|
-
logger.warn("[GoogleAIStudio] Gemini does not support tools and JSON schema output simultaneously. Disabling tools for this request.");
|
|
1290
|
-
mergedOptions = { ...mergedOptions, disableTools: true, tools: {} };
|
|
1291
|
-
}
|
|
1292
|
-
const hasActiveTools = !mergedOptions.disableTools &&
|
|
1293
|
-
mergedOptions.tools &&
|
|
1294
|
-
Object.keys(mergedOptions.tools).length > 0;
|
|
1295
|
-
if (hasActiveTools) {
|
|
1296
|
-
logger.info("[GoogleAIStudio] Routing generate to native @google/genai SDK for tool calling", {
|
|
1297
|
-
model: modelName,
|
|
1298
|
-
totalToolCount: Object.keys(mergedOptions.tools ?? {}).length,
|
|
1299
|
-
});
|
|
1300
|
-
}
|
|
1301
|
-
// Route ALL models through native @google/genai SDK (no more @ai-sdk/google dependency).
|
|
1302
|
-
// Emit Pipeline B `generation:end` so the observability listener
|
|
1303
|
-
// creates a `model.generation` span — AI Studio's native path bypasses
|
|
1304
|
-
// the AI SDK + experimental_telemetry plumbing the same way Vertex's
|
|
1305
|
-
// does, so the event has to be emitted manually.
|
|
1306
|
-
const generateStartTime = Date.now();
|
|
1307
|
-
const inputPrompt = mergedOptions.input?.text ||
|
|
1308
|
-
mergedOptions.prompt ||
|
|
1309
|
-
"";
|
|
1310
|
-
try {
|
|
1311
|
-
// Wrap in `neurolink.executeGeneration` so the observability span
|
|
1312
|
-
// chain (Test: Generate Span Chain) sees a third inner span on the
|
|
1313
|
-
// native @google/genai path — Pipeline A providers get this from
|
|
1314
|
-
// GenerationHandler.executeGeneration; the native path bypasses
|
|
1315
|
-
// GenerationHandler so we add the span here.
|
|
1316
|
-
let result = await withSpan({
|
|
1317
|
-
name: "neurolink.executeGeneration",
|
|
1318
|
-
tracer: tracers.provider,
|
|
1319
|
-
attributes: {
|
|
1320
|
-
[ATTR.GEN_AI_SYSTEM]: this.providerName,
|
|
1321
|
-
[ATTR.GEN_AI_MODEL]: modelName,
|
|
1322
|
-
"neurolink.path": "native.google-genai",
|
|
1323
|
-
},
|
|
1324
|
-
}, async () => this.executeNativeGemini3Generate(mergedOptions));
|
|
1325
|
-
// Pipe through TTS-of-AI-response when caller asks for it. No-op when
|
|
1326
|
-
// tts is disabled or useAiResponse is false.
|
|
1327
|
-
result = await this.synthesizeAIResponseIfNeeded(result, options);
|
|
1328
|
-
this.emitPipelineBGenerationEvent(modelName, result, generateStartTime, true, undefined, inputPrompt);
|
|
1329
|
-
return result;
|
|
1330
|
-
}
|
|
1331
|
-
catch (error) {
|
|
1332
|
-
this.emitPipelineBGenerationEvent(modelName, null, generateStartTime, false, error, inputPrompt);
|
|
1333
|
-
throw error;
|
|
1334
|
-
}
|
|
1335
|
-
}
|
|
1336
|
-
/**
|
|
1337
|
-
* Emit `generation:end` so the Pipeline B observability listener creates
|
|
1338
|
-
* a `model.generation` span for native Google AI Studio generate calls.
|
|
1339
|
-
* Without this hand-off the native path silently disappears from
|
|
1340
|
-
* Pipeline B exporters (Langfuse, custom OTEL collectors).
|
|
1341
|
-
*/
|
|
1342
|
-
emitPipelineBGenerationEvent(modelName, result, startTime, success, error, prompt) {
|
|
1343
|
-
const emitter = this.neurolink?.getEventEmitter();
|
|
1344
|
-
if (!emitter) {
|
|
1345
|
-
return;
|
|
1346
|
-
}
|
|
1347
|
-
const usage = result?.usage && typeof result.usage === "object"
|
|
1348
|
-
? result.usage
|
|
1349
|
-
: { input: 0, output: 0, total: 0 };
|
|
1350
|
-
// Mark on the result so the SDK-level runStandardGenerateRequest knows
|
|
1351
|
-
// this provider already emitted `generation:end` itself and skips its
|
|
1352
|
-
// own duplicate emission. Without this flag the public event listener
|
|
1353
|
-
// (and the observability test) would see two events per generate call.
|
|
1354
|
-
if (result && typeof result === "object") {
|
|
1355
|
-
result._generationEndEmitted =
|
|
1356
|
-
true;
|
|
1357
|
-
}
|
|
1358
|
-
emitter.emit("generation:end", {
|
|
1359
|
-
provider: this.providerName,
|
|
1360
|
-
responseTime: Date.now() - startTime,
|
|
1361
|
-
timestamp: Date.now(),
|
|
1362
|
-
// The Pipeline B listener reads `data.prompt` to populate the
|
|
1363
|
-
// `input` span attribute. Without this, the Observability Spans
|
|
1364
|
-
// test fails with "input capture not working".
|
|
1365
|
-
prompt: prompt || "",
|
|
1366
|
-
result: {
|
|
1367
|
-
content: result?.content || "",
|
|
1368
|
-
usage,
|
|
1369
|
-
model: modelName,
|
|
1370
|
-
provider: this.providerName,
|
|
1371
|
-
finishReason: success ? "stop" : "error",
|
|
1372
|
-
},
|
|
1373
|
-
success,
|
|
1374
|
-
...(error
|
|
1375
|
-
? { error: error instanceof Error ? error.message : String(error) }
|
|
1376
|
-
: {}),
|
|
1377
|
-
});
|
|
1378
|
-
}
|
|
1379
|
-
// ===================
|
|
1380
|
-
// HELPER METHODS
|
|
1381
|
-
// ===================
|
|
1382
|
-
async executeAudioStreamViaGeminiLive(options) {
|
|
1383
|
-
const startTime = Date.now();
|
|
1384
|
-
const apiKey = this.getApiKey();
|
|
1385
|
-
// Dynamic import to avoid hard dependency unless audio streaming is used
|
|
1386
|
-
let client;
|
|
1387
|
-
try {
|
|
1388
|
-
client = await createGoogleGenAIClient(apiKey, this.getBaseURL());
|
|
1389
|
-
}
|
|
1390
|
-
catch {
|
|
1391
|
-
throw new AuthenticationError("Missing '@google/genai'. Install with: pnpm add @google/genai", this.providerName);
|
|
1392
|
-
}
|
|
1393
|
-
const model = this.modelName ||
|
|
1394
|
-
process.env.GOOGLE_VOICE_AI_MODEL ||
|
|
1395
|
-
"gemini-2.5-flash-preview-native-audio-dialog";
|
|
1396
|
-
// Simple async queue for yielding audio events to the outer AsyncIterable
|
|
1397
|
-
const queue = [];
|
|
1398
|
-
let resolveNext = null;
|
|
1399
|
-
let done = false;
|
|
1400
|
-
const push = (item) => {
|
|
1401
|
-
if (done) {
|
|
1402
|
-
return;
|
|
1403
|
-
}
|
|
1404
|
-
if (item.type === "audio") {
|
|
1405
|
-
if (resolveNext) {
|
|
1406
|
-
const fn = resolveNext;
|
|
1407
|
-
resolveNext = null;
|
|
1408
|
-
fn({ value: { type: "audio", audio: item.audio }, done: false });
|
|
1409
|
-
return;
|
|
1410
|
-
}
|
|
1411
|
-
}
|
|
1412
|
-
queue.push(item);
|
|
1413
|
-
};
|
|
1414
|
-
const session = await client.live.connect({
|
|
1415
|
-
model,
|
|
1416
|
-
callbacks: {
|
|
1417
|
-
onopen: () => {
|
|
1418
|
-
// no-op
|
|
1419
|
-
},
|
|
1420
|
-
onmessage: async (message) => {
|
|
1421
|
-
try {
|
|
1422
|
-
const audio = message?.serverContent?.modelTurn?.parts?.[0]?.inlineData;
|
|
1423
|
-
if (audio?.data) {
|
|
1424
|
-
const buf = Buffer.from(String(audio.data), "base64");
|
|
1425
|
-
const chunk = {
|
|
1426
|
-
data: buf,
|
|
1427
|
-
sampleRateHz: 24000,
|
|
1428
|
-
channels: 1,
|
|
1429
|
-
encoding: "PCM16LE",
|
|
1430
|
-
};
|
|
1431
|
-
push({ type: "audio", audio: chunk });
|
|
1432
|
-
}
|
|
1433
|
-
if (message?.serverContent?.interrupted) {
|
|
1434
|
-
// allow consumer to handle; no special action required here
|
|
1435
|
-
}
|
|
1436
|
-
}
|
|
1437
|
-
catch (e) {
|
|
1438
|
-
push({ type: "error", error: e });
|
|
1439
|
-
}
|
|
1440
|
-
},
|
|
1441
|
-
onerror: (e) => {
|
|
1442
|
-
push({ type: "error", error: e });
|
|
1443
|
-
},
|
|
1444
|
-
onclose: (_e) => {
|
|
1445
|
-
push({ type: "end" });
|
|
1446
|
-
},
|
|
1447
|
-
},
|
|
1448
|
-
config: {
|
|
1449
|
-
responseModalities: ["AUDIO"],
|
|
1450
|
-
speechConfig: {
|
|
1451
|
-
voiceConfig: { prebuiltVoiceConfig: { voiceName: "Orus" } },
|
|
1452
|
-
},
|
|
1453
|
-
},
|
|
1454
|
-
});
|
|
1455
|
-
// Feed upstream audio frames concurrently
|
|
1456
|
-
(async () => {
|
|
1457
|
-
try {
|
|
1458
|
-
const spec = options.input?.audio;
|
|
1459
|
-
if (!spec) {
|
|
1460
|
-
logger.debug("[GeminiLive] No audio spec found on input; skipping upstream send");
|
|
1461
|
-
return;
|
|
1462
|
-
}
|
|
1463
|
-
for await (const frame of spec.frames) {
|
|
1464
|
-
// Zero-length frame acts as a 'flush' control signal
|
|
1465
|
-
if (!frame || frame.byteLength === 0) {
|
|
1466
|
-
try {
|
|
1467
|
-
if (session.sendInput) {
|
|
1468
|
-
await session.sendInput({ event: "flush" });
|
|
1469
|
-
}
|
|
1470
|
-
else if (session.sendRealtimeInput) {
|
|
1471
|
-
await session.sendRealtimeInput({ event: "flush" });
|
|
1472
|
-
}
|
|
1473
|
-
}
|
|
1474
|
-
catch (err) {
|
|
1475
|
-
logger.debug("[GeminiLive] flush control failed (non-fatal)", {
|
|
1476
|
-
error: err instanceof Error ? err.message : String(err),
|
|
1477
|
-
});
|
|
1478
|
-
}
|
|
1479
|
-
continue;
|
|
1480
|
-
}
|
|
1481
|
-
// Convert PCM16LE buffer to base64 and wrap in genai Blob-like object
|
|
1482
|
-
const base64 = frame.toString("base64");
|
|
1483
|
-
const mimeType = `audio/pcm;rate=${spec.sampleRateHz || 16000}`;
|
|
1484
|
-
await session.sendRealtimeInput?.({
|
|
1485
|
-
media: { data: base64, mimeType },
|
|
1486
|
-
});
|
|
1487
|
-
}
|
|
1488
|
-
// Best-effort flush signal if supported
|
|
1489
|
-
try {
|
|
1490
|
-
if (session.sendInput) {
|
|
1491
|
-
await session.sendInput({ event: "flush" });
|
|
1492
|
-
}
|
|
1493
|
-
else if (session.sendRealtimeInput) {
|
|
1494
|
-
await session.sendRealtimeInput({ event: "flush" });
|
|
1495
|
-
}
|
|
1496
|
-
}
|
|
1497
|
-
catch (err) {
|
|
1498
|
-
logger.debug("[GeminiLive] final flush failed (non-fatal)", {
|
|
1499
|
-
error: err instanceof Error ? err.message : String(err),
|
|
1500
|
-
});
|
|
1501
|
-
}
|
|
1502
|
-
}
|
|
1503
|
-
catch (e) {
|
|
1504
|
-
push({ type: "error", error: e });
|
|
1505
|
-
}
|
|
1506
|
-
})().catch(() => {
|
|
1507
|
-
// ignore
|
|
1508
|
-
});
|
|
1509
|
-
// AsyncIterable for stream events
|
|
1510
|
-
const asyncIterable = {
|
|
1511
|
-
[Symbol.asyncIterator]() {
|
|
1512
|
-
return {
|
|
1513
|
-
async next() {
|
|
1514
|
-
if (queue.length > 0) {
|
|
1515
|
-
const item = queue.shift();
|
|
1516
|
-
if (!item) {
|
|
1517
|
-
// `done: true` selects the IteratorReturnResult arm, whose
|
|
1518
|
-
// value type accepts undefined.
|
|
1519
|
-
return { value: undefined, done: true };
|
|
1520
|
-
}
|
|
1521
|
-
if (item.type === "audio") {
|
|
1522
|
-
return {
|
|
1523
|
-
value: { type: "audio", audio: item.audio },
|
|
1524
|
-
done: false,
|
|
1525
|
-
};
|
|
1526
|
-
}
|
|
1527
|
-
if (item.type === "end") {
|
|
1528
|
-
done = true;
|
|
1529
|
-
return { value: undefined, done: true };
|
|
1530
|
-
}
|
|
1531
|
-
if (item.type === "error") {
|
|
1532
|
-
done = true;
|
|
1533
|
-
throw item.error instanceof Error
|
|
1534
|
-
? item.error
|
|
1535
|
-
: new Error(String(item.error));
|
|
1536
|
-
}
|
|
1537
|
-
}
|
|
1538
|
-
if (done) {
|
|
1539
|
-
return { value: undefined, done: true };
|
|
1540
|
-
}
|
|
1541
|
-
return await new Promise((resolve) => {
|
|
1542
|
-
resolveNext = resolve;
|
|
1543
|
-
});
|
|
1544
|
-
},
|
|
1545
|
-
};
|
|
1546
|
-
},
|
|
1547
|
-
};
|
|
1548
|
-
return {
|
|
1549
|
-
stream: asyncIterable,
|
|
1550
|
-
provider: this.providerName,
|
|
1551
|
-
model: model,
|
|
1552
|
-
metadata: {
|
|
1553
|
-
startTime,
|
|
1554
|
-
streamId: `google-ai-audio-${Date.now()}`,
|
|
1555
|
-
},
|
|
1556
|
-
};
|
|
1557
|
-
}
|
|
1558
|
-
getDefaultEmbeddingModel() {
|
|
1559
|
-
return (process.env.GOOGLE_AI_EMBEDDING_MODEL ||
|
|
1560
|
-
process.env.GOOGLE_EMBEDDING_MODEL ||
|
|
1561
|
-
"gemini-embedding-001");
|
|
1562
|
-
}
|
|
1563
|
-
/**
|
|
1564
|
-
* Generate embeddings for text using Google AI Studio embedding models
|
|
1565
|
-
* @param text - The text to embed
|
|
1566
|
-
* @param modelName - The embedding model to use (default: gemini-embedding-001)
|
|
1567
|
-
* @returns Promise resolving to the embedding vector
|
|
1568
|
-
*/
|
|
1569
|
-
async embed(text, modelName) {
|
|
1570
|
-
const embeddingModelName = modelName || this.getDefaultEmbeddingModel() || "gemini-embedding-001";
|
|
1571
|
-
logger.debug("Generating embedding", {
|
|
1572
|
-
provider: this.providerName,
|
|
1573
|
-
model: embeddingModelName,
|
|
1574
|
-
textLength: text.length,
|
|
1575
|
-
});
|
|
1576
|
-
try {
|
|
1577
|
-
const apiKey = this.getApiKey();
|
|
1578
|
-
const client = await createGoogleGenAIClient(apiKey, this.getBaseURL());
|
|
1579
|
-
const result = await client.models.embedContent({
|
|
1580
|
-
model: embeddingModelName,
|
|
1581
|
-
contents: [text],
|
|
1582
|
-
});
|
|
1583
|
-
const embedding = result.embeddings?.[0]?.values;
|
|
1584
|
-
if (!embedding) {
|
|
1585
|
-
throw new ProviderError("No embedding returned from Google AI", this.providerName);
|
|
1586
|
-
}
|
|
1587
|
-
logger.debug("Embedding generated successfully", {
|
|
1588
|
-
provider: this.providerName,
|
|
1589
|
-
model: embeddingModelName,
|
|
1590
|
-
embeddingDimension: embedding.length,
|
|
1591
|
-
});
|
|
1592
|
-
return embedding;
|
|
1593
|
-
}
|
|
1594
|
-
catch (error) {
|
|
1595
|
-
logger.error("Embedding generation failed", {
|
|
1596
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1597
|
-
model: embeddingModelName,
|
|
1598
|
-
textLength: text.length,
|
|
1599
|
-
});
|
|
1600
|
-
throw this.handleProviderError(error);
|
|
1601
|
-
}
|
|
1602
|
-
}
|
|
1603
|
-
/**
|
|
1604
|
-
* Generate embeddings for multiple texts in a single batch
|
|
1605
|
-
* @param texts - The texts to embed
|
|
1606
|
-
* @param modelName - The embedding model to use (default: gemini-embedding-001)
|
|
1607
|
-
* @returns Promise resolving to an array of embedding vectors
|
|
1608
|
-
*/
|
|
1609
|
-
async embedMany(texts, modelName) {
|
|
1610
|
-
const embeddingModelName = modelName || this.getDefaultEmbeddingModel() || "gemini-embedding-001";
|
|
1611
|
-
logger.debug("Generating batch embeddings", {
|
|
1612
|
-
provider: this.providerName,
|
|
1613
|
-
model: embeddingModelName,
|
|
1614
|
-
count: texts.length,
|
|
1615
|
-
});
|
|
1616
|
-
try {
|
|
1617
|
-
const apiKey = this.getApiKey();
|
|
1618
|
-
const client = await createGoogleGenAIClient(apiKey, this.getBaseURL());
|
|
1619
|
-
const result = await client.models.embedContent({
|
|
1620
|
-
model: embeddingModelName,
|
|
1621
|
-
contents: texts,
|
|
1622
|
-
});
|
|
1623
|
-
const embeddings = (result.embeddings || []).map((e) => e.values || []);
|
|
1624
|
-
logger.debug("Batch embeddings generated successfully", {
|
|
1625
|
-
provider: this.providerName,
|
|
1626
|
-
model: embeddingModelName,
|
|
1627
|
-
count: embeddings.length,
|
|
1628
|
-
embeddingDimension: embeddings[0]?.length,
|
|
1629
|
-
});
|
|
1630
|
-
return embeddings;
|
|
1631
|
-
}
|
|
1632
|
-
catch (error) {
|
|
1633
|
-
logger.error("Batch embedding generation failed", {
|
|
1634
|
-
error: error instanceof Error ? error.message : String(error),
|
|
1635
|
-
model: embeddingModelName,
|
|
1636
|
-
count: texts.length,
|
|
1637
|
-
});
|
|
1638
|
-
throw this.handleProviderError(error);
|
|
1639
|
-
}
|
|
1640
|
-
}
|
|
1641
|
-
getApiKey() {
|
|
1642
|
-
const apiKey = this.credentials?.apiKey ||
|
|
1643
|
-
process.env.GOOGLE_AI_API_KEY ||
|
|
1644
|
-
process.env.GOOGLE_GENERATIVE_AI_API_KEY;
|
|
1645
|
-
if (!apiKey) {
|
|
1646
|
-
throw new AuthenticationError("GOOGLE_AI_API_KEY or GOOGLE_GENERATIVE_AI_API_KEY environment variable is not set", this.providerName);
|
|
1647
|
-
}
|
|
1648
|
-
return apiKey;
|
|
1649
|
-
}
|
|
1650
|
-
// Mirrors mistral.ts's baseURL precedence (credentials override, then env,
|
|
1651
|
-
// then unset — the SDK's own default applies when unset). Blank/whitespace
|
|
1652
|
-
// values are treated as unset so an empty override can't accidentally
|
|
1653
|
-
// clobber the default.
|
|
1654
|
-
getBaseURL() {
|
|
1655
|
-
const baseURL = this.credentials?.baseURL?.trim() ||
|
|
1656
|
-
process.env.GOOGLE_AI_BASE_URL?.trim();
|
|
1657
|
-
return baseURL && baseURL.length > 0 ? baseURL : undefined;
|
|
1658
|
-
}
|
|
1659
|
-
}
|
|
1660
|
-
export default GoogleAIStudioProvider;
|
|
1661
|
-
//# sourceMappingURL=client.js.map
|