@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,2789 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Proxy type definitions for NeuroLink
|
|
3
|
-
*
|
|
4
|
-
* Consolidates all proxy-related types from:
|
|
5
|
-
* - src/lib/proxy/claudeFormat.ts (Claude API types, SSE types, internal result)
|
|
6
|
-
* - src/lib/proxy/cloaking/types.ts (cloaking pipeline types)
|
|
7
|
-
* - src/lib/proxy/cloaking/plugins/ (plugin option types)
|
|
8
|
-
* - src/lib/proxy/modelRouter.ts (routing types)
|
|
9
|
-
* - src/lib/proxy/proxyConfig.ts (config file types)
|
|
10
|
-
* - src/lib/proxy/requestLogger.ts (log entry type)
|
|
11
|
-
* - src/lib/proxy/usageStats.ts (stats types)
|
|
12
|
-
* - src/lib/proxy/tokenRefresh.ts (refresh types)
|
|
13
|
-
* - src/lib/proxy/accountQuota.ts (quota type)
|
|
14
|
-
* - src/lib/server/routes/claudeProxyRoutes.ts (runtime state, deps)
|
|
15
|
-
*/
|
|
16
|
-
import type { Counter, Histogram, Span } from "@opentelemetry/api";
|
|
17
|
-
import type { Hono } from "hono";
|
|
18
|
-
import type { Ora } from "ora";
|
|
19
|
-
import type { MCPToolRegistry } from "../mcp/toolRegistry.js";
|
|
20
|
-
import type { ProxyTracer } from "../proxy/proxyTracer.js";
|
|
21
|
-
import type { ACCOUNT_COOLING_REASONS, PROXY_ACCOUNT_TYPES, PROXY_ACCOUNT_ROUTING_MODES, PROXY_ACCOUNT_ROUTING_REASONS, PROXY_ACCOUNT_ROUTING_STRATEGIES } from "../proxy/routingEvidence.js";
|
|
22
|
-
import type { FallbackEntry, ModelMapping, ProxyRoutingConfig, CloakingConfig } from "./subscription.js";
|
|
23
|
-
import type { RouteDeprecation } from "./server.js";
|
|
24
|
-
/**
|
|
25
|
-
* Type describing the ModelRouter contract.
|
|
26
|
-
* Defined here to avoid a circular dependency between types and implementation.
|
|
27
|
-
*/
|
|
28
|
-
export type ModelRouterInterface = {
|
|
29
|
-
resolve(requestedModel: string): RouteResult;
|
|
30
|
-
isClaudeTarget(requestedModel: string): boolean;
|
|
31
|
-
getFallbackChain(): FallbackEntry[];
|
|
32
|
-
isAutoFallbackEnabled?(): boolean;
|
|
33
|
-
getMaxInflightPerAccount?(): number | undefined;
|
|
34
|
-
getModelMappings?: () => ModelMapping[];
|
|
35
|
-
getPassthroughModels?: () => string[];
|
|
36
|
-
};
|
|
37
|
-
/** A single text block in a Claude content array. */
|
|
38
|
-
export type ClaudeTextBlock = {
|
|
39
|
-
type: "text";
|
|
40
|
-
text: string;
|
|
41
|
-
};
|
|
42
|
-
/** A single image block in a Claude content array. */
|
|
43
|
-
export type ClaudeImageBlock = {
|
|
44
|
-
type: "image";
|
|
45
|
-
source: {
|
|
46
|
-
type: "base64" | "url";
|
|
47
|
-
media_type?: string;
|
|
48
|
-
data?: string;
|
|
49
|
-
url?: string;
|
|
50
|
-
};
|
|
51
|
-
};
|
|
52
|
-
/** Tool-use block returned by Claude in assistant messages. */
|
|
53
|
-
export type ClaudeToolUseBlock = {
|
|
54
|
-
type: "tool_use";
|
|
55
|
-
id: string;
|
|
56
|
-
name: string;
|
|
57
|
-
input: Record<string, unknown>;
|
|
58
|
-
};
|
|
59
|
-
/** Tool-result block sent back by the caller. */
|
|
60
|
-
export type ClaudeToolResultBlock = {
|
|
61
|
-
type: "tool_result";
|
|
62
|
-
tool_use_id: string;
|
|
63
|
-
content: string | ClaudeContentBlock[];
|
|
64
|
-
};
|
|
65
|
-
/** A thinking/reasoning block in a Claude content array. */
|
|
66
|
-
export type ClaudeThinkingBlock = {
|
|
67
|
-
type: "thinking";
|
|
68
|
-
thinking: string;
|
|
69
|
-
};
|
|
70
|
-
export type ClaudeContentBlock = ClaudeTextBlock | ClaudeImageBlock | ClaudeToolUseBlock | ClaudeToolResultBlock | ClaudeThinkingBlock;
|
|
71
|
-
/** A single message in a Claude conversation. */
|
|
72
|
-
export type ClaudeMessage = {
|
|
73
|
-
role: "user" | "assistant";
|
|
74
|
-
content: string | ClaudeContentBlock[];
|
|
75
|
-
};
|
|
76
|
-
/** Tool definition in the Claude Messages API format. */
|
|
77
|
-
export type ClaudeTool = {
|
|
78
|
-
name: string;
|
|
79
|
-
description?: string;
|
|
80
|
-
input_schema: Record<string, unknown>;
|
|
81
|
-
};
|
|
82
|
-
/** Metadata attached to a Claude Messages API request. */
|
|
83
|
-
export type ClaudeMetadata = {
|
|
84
|
-
user_id?: string;
|
|
85
|
-
};
|
|
86
|
-
/**
|
|
87
|
-
* Inbound Claude Messages API request body.
|
|
88
|
-
* Matches POST /v1/messages.
|
|
89
|
-
*/
|
|
90
|
-
export type ClaudeRequest = {
|
|
91
|
-
model: string;
|
|
92
|
-
messages: ClaudeMessage[];
|
|
93
|
-
max_tokens: number;
|
|
94
|
-
system?: string | Array<{
|
|
95
|
-
type: "text";
|
|
96
|
-
text: string;
|
|
97
|
-
}>;
|
|
98
|
-
temperature?: number;
|
|
99
|
-
top_p?: number;
|
|
100
|
-
top_k?: number;
|
|
101
|
-
stop_sequences?: string[];
|
|
102
|
-
stream?: boolean;
|
|
103
|
-
tools?: ClaudeTool[];
|
|
104
|
-
tool_choice?: {
|
|
105
|
-
type: "auto" | "any" | "none";
|
|
106
|
-
} | {
|
|
107
|
-
type: "tool";
|
|
108
|
-
name: string;
|
|
109
|
-
};
|
|
110
|
-
thinking?: {
|
|
111
|
-
type: string;
|
|
112
|
-
budget_tokens?: number;
|
|
113
|
-
};
|
|
114
|
-
metadata?: ClaudeMetadata;
|
|
115
|
-
};
|
|
116
|
-
/** Usage counters returned in a Claude response. */
|
|
117
|
-
export type ClaudeUsage = {
|
|
118
|
-
input_tokens: number;
|
|
119
|
-
output_tokens: number;
|
|
120
|
-
cache_creation_input_tokens?: number;
|
|
121
|
-
cache_read_input_tokens?: number;
|
|
122
|
-
};
|
|
123
|
-
/** Non-streaming response matching the Claude Messages API. */
|
|
124
|
-
export type ClaudeResponse = {
|
|
125
|
-
id: string;
|
|
126
|
-
type: "message";
|
|
127
|
-
role: "assistant";
|
|
128
|
-
content: ClaudeContentBlock[];
|
|
129
|
-
model: string;
|
|
130
|
-
stop_reason: string | null;
|
|
131
|
-
stop_sequence: string | null;
|
|
132
|
-
usage: ClaudeUsage;
|
|
133
|
-
};
|
|
134
|
-
/** Claude API error envelope. */
|
|
135
|
-
export type ClaudeErrorResponse = {
|
|
136
|
-
type: "error";
|
|
137
|
-
error: {
|
|
138
|
-
type: string;
|
|
139
|
-
message: string;
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
/** Content block descriptor for content_block_start events. */
|
|
143
|
-
export type SSEContentBlockDescriptor = {
|
|
144
|
-
type: "text";
|
|
145
|
-
text: "";
|
|
146
|
-
} | {
|
|
147
|
-
type: "thinking";
|
|
148
|
-
thinking: "";
|
|
149
|
-
} | {
|
|
150
|
-
type: "tool_use";
|
|
151
|
-
id: string;
|
|
152
|
-
name: string;
|
|
153
|
-
input: "";
|
|
154
|
-
};
|
|
155
|
-
/** Delta descriptor for content_block_delta events. */
|
|
156
|
-
export type SSEDeltaDescriptor = {
|
|
157
|
-
type: "text_delta";
|
|
158
|
-
text: string;
|
|
159
|
-
} | {
|
|
160
|
-
type: "thinking_delta";
|
|
161
|
-
thinking: string;
|
|
162
|
-
} | {
|
|
163
|
-
type: "input_json_delta";
|
|
164
|
-
partial_json: string;
|
|
165
|
-
};
|
|
166
|
-
export type SSEMessageStart = {
|
|
167
|
-
type: "message_start";
|
|
168
|
-
message: Omit<ClaudeResponse, "content"> & {
|
|
169
|
-
content: [];
|
|
170
|
-
};
|
|
171
|
-
};
|
|
172
|
-
export type SSEContentBlockStart = {
|
|
173
|
-
type: "content_block_start";
|
|
174
|
-
index: number;
|
|
175
|
-
content_block: SSEContentBlockDescriptor;
|
|
176
|
-
};
|
|
177
|
-
export type SSEContentBlockDelta = {
|
|
178
|
-
type: "content_block_delta";
|
|
179
|
-
index: number;
|
|
180
|
-
delta: SSEDeltaDescriptor;
|
|
181
|
-
};
|
|
182
|
-
export type SSEContentBlockStop = {
|
|
183
|
-
type: "content_block_stop";
|
|
184
|
-
index: number;
|
|
185
|
-
};
|
|
186
|
-
export type SSEMessageDelta = {
|
|
187
|
-
type: "message_delta";
|
|
188
|
-
delta: {
|
|
189
|
-
stop_reason: string | null;
|
|
190
|
-
stop_sequence: string | null;
|
|
191
|
-
};
|
|
192
|
-
usage: {
|
|
193
|
-
output_tokens: number;
|
|
194
|
-
};
|
|
195
|
-
};
|
|
196
|
-
export type SSEMessageStop = {
|
|
197
|
-
type: "message_stop";
|
|
198
|
-
};
|
|
199
|
-
export type SSEPing = {
|
|
200
|
-
type: "ping";
|
|
201
|
-
};
|
|
202
|
-
export type SSEEvent = SSEMessageStart | SSEContentBlockStart | SSEContentBlockDelta | SSEContentBlockStop | SSEMessageDelta | SSEMessageStop | SSEPing;
|
|
203
|
-
/**
|
|
204
|
-
* Minimal subset of NeuroLink's GenerateResult that the proxy layer consumes.
|
|
205
|
-
* Kept intentionally narrow so the proxy layer does not depend on every
|
|
206
|
-
* field of the full type.
|
|
207
|
-
*/
|
|
208
|
-
export type InternalResult = {
|
|
209
|
-
content: string;
|
|
210
|
-
model?: string;
|
|
211
|
-
finishReason?: string;
|
|
212
|
-
/** Thinking/reasoning text from provider (Anthropic thinking blocks, Gemini thought parts) */
|
|
213
|
-
reasoning?: string;
|
|
214
|
-
usage?: {
|
|
215
|
-
input: number;
|
|
216
|
-
output: number;
|
|
217
|
-
total: number;
|
|
218
|
-
cacheCreationTokens?: number;
|
|
219
|
-
cacheReadTokens?: number;
|
|
220
|
-
};
|
|
221
|
-
toolCalls?: Array<{
|
|
222
|
-
toolCallId: string;
|
|
223
|
-
toolName: string;
|
|
224
|
-
args: Record<string, unknown>;
|
|
225
|
-
}>;
|
|
226
|
-
};
|
|
227
|
-
/**
|
|
228
|
-
* Parsed representation of a Claude request, ready for NeuroLink's
|
|
229
|
-
* generate() / stream() pipeline.
|
|
230
|
-
*/
|
|
231
|
-
export type ParsedClaudeRequest = {
|
|
232
|
-
model: string;
|
|
233
|
-
maxTokens: number;
|
|
234
|
-
temperature?: number;
|
|
235
|
-
topP?: number;
|
|
236
|
-
topK?: number;
|
|
237
|
-
systemPrompt?: string | Array<{
|
|
238
|
-
type: string;
|
|
239
|
-
text: string;
|
|
240
|
-
}>;
|
|
241
|
-
stream: boolean;
|
|
242
|
-
/** Flat prompt string derived from the last user message. */
|
|
243
|
-
prompt: string;
|
|
244
|
-
/** Images extracted from content blocks (base64 data URIs or URLs). */
|
|
245
|
-
images: string[];
|
|
246
|
-
/**
|
|
247
|
-
* Full conversation history converted to NeuroLink's ChatMessage shape.
|
|
248
|
-
* Includes all messages, not just the last one.
|
|
249
|
-
*/
|
|
250
|
-
conversationMessages: Array<{
|
|
251
|
-
role: string;
|
|
252
|
-
content: string;
|
|
253
|
-
}>;
|
|
254
|
-
/** Tools translated to AI SDK-compatible shape for provider fallback. */
|
|
255
|
-
tools: Record<string, {
|
|
256
|
-
description?: string;
|
|
257
|
-
inputSchema: unknown;
|
|
258
|
-
execute?: (...args: unknown[]) => unknown;
|
|
259
|
-
}>;
|
|
260
|
-
/**
|
|
261
|
-
* Tool choice mapping from Claude format.
|
|
262
|
-
* - "auto" -> let the model decide
|
|
263
|
-
* - "required" -> force tool use (any tool)
|
|
264
|
-
* - "none" -> no tool use
|
|
265
|
-
*/
|
|
266
|
-
toolChoice?: "auto" | "required" | "none";
|
|
267
|
-
/** When toolChoice came from `{type: "tool", name: "..."}`, the tool name. */
|
|
268
|
-
toolChoiceName?: string;
|
|
269
|
-
/** Thinking configuration parsed from the request. */
|
|
270
|
-
thinkingConfig?: {
|
|
271
|
-
enabled: boolean;
|
|
272
|
-
budgetTokens?: number;
|
|
273
|
-
thinkingLevel?: "minimal" | "low" | "medium" | "high";
|
|
274
|
-
};
|
|
275
|
-
/** Original request metadata (if any). */
|
|
276
|
-
metadata?: ClaudeMetadata;
|
|
277
|
-
/** Stop sequences from the original request. */
|
|
278
|
-
stopSequences?: string[];
|
|
279
|
-
};
|
|
280
|
-
/** Lifecycle state for the SSE serializer. */
|
|
281
|
-
export type StreamLifecycleState = "idle" | "streaming" | "done" | "error";
|
|
282
|
-
/** The type of content block currently being streamed. */
|
|
283
|
-
export type ContentBlockType = "text" | "thinking" | "tool_use" | null;
|
|
284
|
-
/** Minimal account shape needed by the cloaking pipeline. */
|
|
285
|
-
export type CloakingAccount = {
|
|
286
|
-
id: string;
|
|
287
|
-
type: "api_key" | "oauth";
|
|
288
|
-
status: "healthy" | "quota_exceeded" | "error";
|
|
289
|
-
consecutiveFailures: number;
|
|
290
|
-
requestCount: number;
|
|
291
|
-
lastUsed: number;
|
|
292
|
-
apiKey?: string;
|
|
293
|
-
};
|
|
294
|
-
/** Request envelope for cloaking pipeline. */
|
|
295
|
-
export type CloakingRequest = {
|
|
296
|
-
headers: Record<string, string | undefined>;
|
|
297
|
-
body: {
|
|
298
|
-
messages: Array<{
|
|
299
|
-
role: string;
|
|
300
|
-
content: string | Array<Record<string, unknown>>;
|
|
301
|
-
}>;
|
|
302
|
-
system?: string | Array<{
|
|
303
|
-
type: string;
|
|
304
|
-
text: string;
|
|
305
|
-
}>;
|
|
306
|
-
metadata?: Record<string, unknown>;
|
|
307
|
-
[key: string]: unknown;
|
|
308
|
-
};
|
|
309
|
-
url: string;
|
|
310
|
-
};
|
|
311
|
-
/** Response envelope for cloaking pipeline. */
|
|
312
|
-
export type CloakingResponse = {
|
|
313
|
-
headers: Record<string, string | undefined>;
|
|
314
|
-
body: Record<string, unknown>;
|
|
315
|
-
status: number;
|
|
316
|
-
};
|
|
317
|
-
/** Cloaking mode configuration. */
|
|
318
|
-
export type CloakingMode = "auto" | "always" | "never";
|
|
319
|
-
/** Context passed through the cloaking pipeline. */
|
|
320
|
-
export type CloakingContext = {
|
|
321
|
-
request: CloakingRequest;
|
|
322
|
-
account: CloakingAccount;
|
|
323
|
-
config: {
|
|
324
|
-
mode: CloakingMode;
|
|
325
|
-
plugins: Record<string, unknown>;
|
|
326
|
-
};
|
|
327
|
-
response?: {
|
|
328
|
-
headers: Record<string, string>;
|
|
329
|
-
body: unknown;
|
|
330
|
-
};
|
|
331
|
-
};
|
|
332
|
-
/** Plugin interface for cloaking pipeline. */
|
|
333
|
-
export type CloakingPlugin = {
|
|
334
|
-
/** Human-readable name for logging / debugging. */
|
|
335
|
-
name: string;
|
|
336
|
-
/** Execution order -- lower numbers run first in processRequest. */
|
|
337
|
-
order: number;
|
|
338
|
-
/** Whether this plugin is active. Disabled plugins are skipped. */
|
|
339
|
-
enabled: boolean;
|
|
340
|
-
/**
|
|
341
|
-
* Transform the outgoing request before it reaches the upstream API.
|
|
342
|
-
* Must return a (possibly mutated) context.
|
|
343
|
-
*/
|
|
344
|
-
transformRequest: (ctx: CloakingContext) => Promise<CloakingContext>;
|
|
345
|
-
/**
|
|
346
|
-
* Transform the incoming response before it reaches the client.
|
|
347
|
-
* Optional -- plugins that only touch requests can skip this.
|
|
348
|
-
*/
|
|
349
|
-
transformResponse?: (ctx: CloakingContext) => Promise<CloakingContext>;
|
|
350
|
-
};
|
|
351
|
-
/** Options for the HeaderScrubber cloaking plugin. */
|
|
352
|
-
export type HeaderScrubberOptions = {
|
|
353
|
-
/** Additional header names (lower-cased) to strip. */
|
|
354
|
-
extraHeaders?: string[];
|
|
355
|
-
};
|
|
356
|
-
/** Options for the SystemPromptInjector cloaking plugin. */
|
|
357
|
-
export type SystemPromptInjectorOptions = {
|
|
358
|
-
/** IDE name to inject (default: "vscode"). */
|
|
359
|
-
ide?: string;
|
|
360
|
-
/** IDE version (default: "1.96.2"). */
|
|
361
|
-
ideVersion?: string;
|
|
362
|
-
/** Platform string (default: "darwin"). */
|
|
363
|
-
platform?: string;
|
|
364
|
-
/** Working directory to inject (default: "/home/user/project"). */
|
|
365
|
-
cwd?: string;
|
|
366
|
-
/** Extra preamble to prepend. */
|
|
367
|
-
preamble?: string;
|
|
368
|
-
};
|
|
369
|
-
/** Options for the TlsFingerprint cloaking plugin. */
|
|
370
|
-
export type TlsFingerprintOptions = {
|
|
371
|
-
/** Target fingerprint profile (e.g. "chrome-131", "node-22", "claude-code"). */
|
|
372
|
-
profile?: string;
|
|
373
|
-
/** Whether the stub should log a warning that it is a no-op. */
|
|
374
|
-
warnOnUse?: boolean;
|
|
375
|
-
};
|
|
376
|
-
/**
|
|
377
|
-
* Proxy operating mode:
|
|
378
|
-
* - "full" — managed accounts, retry, rotation, polyfill (default)
|
|
379
|
-
* - "passthrough" — no polyfill/retry/rotation, but body is still parsed and re-serialized
|
|
380
|
-
* - "transparent" — zero-mutation byte relay: raw body forwarded as-is, minimal header filtering,
|
|
381
|
-
* SSE interceptor for cache metrics only (bytes pass through unmodified)
|
|
382
|
-
*/
|
|
383
|
-
export type ProxyMode = "full" | "passthrough" | "transparent";
|
|
384
|
-
export type RouteResult = {
|
|
385
|
-
provider: string | null;
|
|
386
|
-
model: string;
|
|
387
|
-
};
|
|
388
|
-
/** Individual account configuration within a proxy config file. */
|
|
389
|
-
export type ProxyAccountConfig = {
|
|
390
|
-
/** Human-readable name for the account */
|
|
391
|
-
name: string;
|
|
392
|
-
/** API key or token (may contain env var references) */
|
|
393
|
-
apiKey: string;
|
|
394
|
-
/** Base URL override for the provider endpoint */
|
|
395
|
-
baseUrl?: string;
|
|
396
|
-
/** Organization ID (e.g., OpenAI orgs) */
|
|
397
|
-
orgId?: string;
|
|
398
|
-
/** Weight for weighted round-robin selection (default: 1) */
|
|
399
|
-
weight?: number;
|
|
400
|
-
/** Whether this account is currently enabled (default: true) */
|
|
401
|
-
enabled?: boolean;
|
|
402
|
-
/** Maximum requests per minute for this account */
|
|
403
|
-
rateLimit?: number;
|
|
404
|
-
/** Arbitrary metadata attached to the account */
|
|
405
|
-
metadata?: Record<string, unknown>;
|
|
406
|
-
};
|
|
407
|
-
/** Top-level proxy configuration structure. */
|
|
408
|
-
export type ProxyConfigFile = {
|
|
409
|
-
/** Configuration schema version */
|
|
410
|
-
version?: number;
|
|
411
|
-
/** Default provider name to apply when not specified per-account */
|
|
412
|
-
defaultProvider?: string;
|
|
413
|
-
/** Default base URL applied to accounts that omit baseUrl */
|
|
414
|
-
defaultBaseUrl?: string;
|
|
415
|
-
/** Map of provider names to their account lists */
|
|
416
|
-
accounts: Record<string, ProxyAccountConfig[]>;
|
|
417
|
-
/** Routing configuration (strategy, model mappings, fallback chain) */
|
|
418
|
-
routing?: Partial<ProxyRoutingConfig>;
|
|
419
|
-
/** Cloaking plugin configuration */
|
|
420
|
-
cloaking?: CloakingConfig;
|
|
421
|
-
};
|
|
422
|
-
/** Options for loadProxyConfig. */
|
|
423
|
-
export type LoadProxyConfigOptions = {
|
|
424
|
-
/** Resolve environment variables in string values (default: true) */
|
|
425
|
-
resolveEnv?: boolean;
|
|
426
|
-
/** Custom environment object (defaults to process.env) */
|
|
427
|
-
env?: Record<string, string | undefined>;
|
|
428
|
-
};
|
|
429
|
-
export type ProxyAccountRoutingStrategy = (typeof PROXY_ACCOUNT_ROUTING_STRATEGIES)[number];
|
|
430
|
-
export type ProxyAccountRoutingMode = (typeof PROXY_ACCOUNT_ROUTING_MODES)[number];
|
|
431
|
-
export type ProxyAccountRoutingReason = (typeof PROXY_ACCOUNT_ROUTING_REASONS)[number];
|
|
432
|
-
export type ProxyAccountType = (typeof PROXY_ACCOUNT_TYPES)[number];
|
|
433
|
-
export type ProxyQuotaFreshness = "unknown" | "fresh" | "stale_known" | "refresh_due";
|
|
434
|
-
export type ProxyQuotaRefreshReason = "startup_unknown" | "handoff_prewarm" | "ambiguous_snapshot" | "manual";
|
|
435
|
-
export type ProxyQuotaSaturationKind = "none" | "soft" | "hard";
|
|
436
|
-
export type ProxyTransportScope = "shared_provider_transport" | "connection_transport" | "account_specific";
|
|
437
|
-
export type ProxyNetworkTransportScope = Exclude<ProxyTransportScope, "account_specific">;
|
|
438
|
-
export type ProxyProviderTransportProbeOutcome = "recovered" | "failed" | "abandoned";
|
|
439
|
-
export type ProxyProviderTransportPermit = {
|
|
440
|
-
allowed: true;
|
|
441
|
-
probe: boolean;
|
|
442
|
-
generation: number;
|
|
443
|
-
} | {
|
|
444
|
-
allowed: false;
|
|
445
|
-
errorCode: string | null;
|
|
446
|
-
transportScope: ProxyNetworkTransportScope;
|
|
447
|
-
};
|
|
448
|
-
export type ProxyAccountRoutingCandidate = {
|
|
449
|
-
account: string;
|
|
450
|
-
accountType: ProxyAccountType;
|
|
451
|
-
sourceIndex: number;
|
|
452
|
-
rank: number;
|
|
453
|
-
configuredPrimary: boolean;
|
|
454
|
-
usable: boolean;
|
|
455
|
-
saturated: boolean;
|
|
456
|
-
quotaObserved: boolean;
|
|
457
|
-
quotaStale: boolean;
|
|
458
|
-
quotaFreshness?: ProxyQuotaFreshness;
|
|
459
|
-
refreshNeeded?: boolean;
|
|
460
|
-
refreshReason?: ProxyQuotaRefreshReason | null;
|
|
461
|
-
refreshInFlight?: boolean;
|
|
462
|
-
lastRefreshAttemptAt?: number | null;
|
|
463
|
-
lastRefreshSuccessAt?: number | null;
|
|
464
|
-
nextRefreshEligibleAt?: number | null;
|
|
465
|
-
saturationKind?: ProxyQuotaSaturationKind;
|
|
466
|
-
softLimitOverrideReason?: "overage" | "weekly_expiry" | null;
|
|
467
|
-
quotaLastUpdated: number | null;
|
|
468
|
-
quotaAgeMs: number | null;
|
|
469
|
-
coolingActive: boolean;
|
|
470
|
-
coolingReason: AccountCoolingReason | null;
|
|
471
|
-
coolingUntil: number | null;
|
|
472
|
-
unifiedStatus: string | null;
|
|
473
|
-
fallbackStatus?: string | null;
|
|
474
|
-
upgradePaths?: string | null;
|
|
475
|
-
overageEligible?: boolean;
|
|
476
|
-
overageStatus: string | null;
|
|
477
|
-
sessionStatus: string | null;
|
|
478
|
-
sessionUsed: number | null;
|
|
479
|
-
sessionResetAt: number | null;
|
|
480
|
-
sessionResetBucket: number | null;
|
|
481
|
-
weeklyStatus: string | null;
|
|
482
|
-
weeklyUsed: number | null;
|
|
483
|
-
weeklyResetAt: number | null;
|
|
484
|
-
/** Display name of the model-scoped window that matched the requested model
|
|
485
|
-
* (e.g. "Fable"), or null when the account reports no scoped cap for it.
|
|
486
|
-
* Optional so schema-v1 readers of older records stay valid. */
|
|
487
|
-
scopedModel?: string | null;
|
|
488
|
-
scopedStatus?: string | null;
|
|
489
|
-
scopedUsed?: number | null;
|
|
490
|
-
scopedResetAt?: number | null;
|
|
491
|
-
};
|
|
492
|
-
export type ProxyAccountRoutingDecision = {
|
|
493
|
-
schemaVersion: 1;
|
|
494
|
-
evaluatedAt: string;
|
|
495
|
-
strategy: ProxyAccountRoutingStrategy;
|
|
496
|
-
mode: ProxyAccountRoutingMode;
|
|
497
|
-
selectionReason: ProxyAccountRoutingReason;
|
|
498
|
-
quotaRoutingEnabled: boolean;
|
|
499
|
-
quotaInputsUsed: boolean;
|
|
500
|
-
sessionSoftLimit: number;
|
|
501
|
-
sessionResetToleranceMs: number;
|
|
502
|
-
configuredPrimaryAccount: string | null;
|
|
503
|
-
configuredPrimaryMatched: boolean;
|
|
504
|
-
rotationOffset: number;
|
|
505
|
-
initialAccount: string;
|
|
506
|
-
candidates: ProxyAccountRoutingCandidate[];
|
|
507
|
-
};
|
|
508
|
-
export type ProxyAccountSortMetrics = {
|
|
509
|
-
usable: boolean;
|
|
510
|
-
saturated: boolean;
|
|
511
|
-
hasQuota: boolean;
|
|
512
|
-
quotaEvidenceRank: number;
|
|
513
|
-
quotaStale: boolean;
|
|
514
|
-
quotaFreshness: ProxyQuotaFreshness;
|
|
515
|
-
refreshNeeded: boolean;
|
|
516
|
-
refreshReason: ProxyQuotaRefreshReason | null;
|
|
517
|
-
refreshInFlight: boolean;
|
|
518
|
-
lastRefreshAttemptAt: number | null;
|
|
519
|
-
lastRefreshSuccessAt: number | null;
|
|
520
|
-
nextRefreshEligibleAt: number | null;
|
|
521
|
-
saturationKind: ProxyQuotaSaturationKind;
|
|
522
|
-
softLimitOverrideReason: "overage" | "weekly_expiry" | null;
|
|
523
|
-
quotaLastUpdated: number | null;
|
|
524
|
-
quotaAgeMs: number | null;
|
|
525
|
-
coolingActive: boolean;
|
|
526
|
-
coolingReason: AccountCoolingReason | null;
|
|
527
|
-
coolingUntil: number;
|
|
528
|
-
unifiedStatus: string | null;
|
|
529
|
-
fallbackStatus?: string | null;
|
|
530
|
-
upgradePaths?: string | null;
|
|
531
|
-
overageEligible?: boolean;
|
|
532
|
-
overageStatus: string | null;
|
|
533
|
-
sessionStatus: string | null;
|
|
534
|
-
sessionUsed: number | null;
|
|
535
|
-
sessionResetBucket: number;
|
|
536
|
-
sessionReset: number;
|
|
537
|
-
weeklyStatus: string | null;
|
|
538
|
-
weeklyReset: number;
|
|
539
|
-
weeklyUsed: number | null;
|
|
540
|
-
weeklyUsedForSort: number;
|
|
541
|
-
/** Model-scoped weekly window matching the requested model. All null/false
|
|
542
|
-
* when the account reports no scoped cap for it (the common case), which
|
|
543
|
-
* makes every scoped comparator rung a no-op for unscoped traffic. */
|
|
544
|
-
scopedModel: string | null;
|
|
545
|
-
scopedStatus: string | null;
|
|
546
|
-
scopedUsed: number | null;
|
|
547
|
-
scopedReset: number;
|
|
548
|
-
scopedUsedForSort: number;
|
|
549
|
-
scopedSaturated: boolean;
|
|
550
|
-
};
|
|
551
|
-
export type RequestLogEntry = {
|
|
552
|
-
timestamp: string;
|
|
553
|
-
requestId: string;
|
|
554
|
-
method: string;
|
|
555
|
-
path: string;
|
|
556
|
-
model: string;
|
|
557
|
-
stream: boolean;
|
|
558
|
-
toolCount: number;
|
|
559
|
-
account: string;
|
|
560
|
-
accountType: string;
|
|
561
|
-
responseStatus: number;
|
|
562
|
-
responseTimeMs: number;
|
|
563
|
-
errorType?: string;
|
|
564
|
-
errorMessage?: string;
|
|
565
|
-
/** Low-level transport code such as ETIMEDOUT or EADDRNOTAVAIL. */
|
|
566
|
-
errorCode?: string;
|
|
567
|
-
/** Whether changing credentials can affect this transport failure. */
|
|
568
|
-
transportScope?: ProxyTransportScope;
|
|
569
|
-
inputTokens?: number;
|
|
570
|
-
outputTokens?: number;
|
|
571
|
-
cacheCreationTokens?: number;
|
|
572
|
-
cacheReadTokens?: number;
|
|
573
|
-
/**
|
|
574
|
-
* Provider that actually served the request, for costing. Absent on records
|
|
575
|
-
* written before this field existed; `proxyAnalysis` then falls back to a
|
|
576
|
-
* cross-provider model lookup rather than assuming Anthropic.
|
|
577
|
-
*/
|
|
578
|
-
provider?: string;
|
|
579
|
-
/** OTel trace ID for correlation with distributed traces */
|
|
580
|
-
traceId?: string;
|
|
581
|
-
/** OTel span ID for correlation with distributed traces */
|
|
582
|
-
spanId?: string;
|
|
583
|
-
/** Exact secret-free inputs and result of initial account selection. */
|
|
584
|
-
routingDecision?: ProxyAccountRoutingDecision;
|
|
585
|
-
};
|
|
586
|
-
export type RequestAttemptLogEntry = {
|
|
587
|
-
timestamp: string;
|
|
588
|
-
requestId: string;
|
|
589
|
-
attempt: number;
|
|
590
|
-
method: string;
|
|
591
|
-
path: string;
|
|
592
|
-
model: string;
|
|
593
|
-
stream: boolean;
|
|
594
|
-
toolCount: number;
|
|
595
|
-
account: string;
|
|
596
|
-
accountType: string;
|
|
597
|
-
responseStatus: number;
|
|
598
|
-
/** End-to-end request age when this attempt completed. */
|
|
599
|
-
responseTimeMs: number;
|
|
600
|
-
/** Time spent in this specific account attempt. */
|
|
601
|
-
attemptDurationMs?: number;
|
|
602
|
-
errorType?: string;
|
|
603
|
-
errorMessage?: string;
|
|
604
|
-
/** Low-level transport code such as ETIMEDOUT or EADDRNOTAVAIL. */
|
|
605
|
-
errorCode?: string;
|
|
606
|
-
/** Whether changing credentials can affect this transport failure. */
|
|
607
|
-
transportScope?: ProxyTransportScope;
|
|
608
|
-
/** Whether this failed attempt may be retried without changing the request. */
|
|
609
|
-
retryable?: boolean;
|
|
610
|
-
/** Distinguishes short-lived admission throttles from exhausted quota windows. */
|
|
611
|
-
rateLimitKind?: "transient" | "quota";
|
|
612
|
-
/** Reset-aware cooldown reason selected for a rate-limited attempt. */
|
|
613
|
-
cooldownReason?: "transient" | "session" | "weekly" | "unified";
|
|
614
|
-
inputTokens?: number;
|
|
615
|
-
outputTokens?: number;
|
|
616
|
-
cacheCreationTokens?: number;
|
|
617
|
-
cacheReadTokens?: number;
|
|
618
|
-
/** OTel trace ID for correlation with distributed traces */
|
|
619
|
-
traceId?: string;
|
|
620
|
-
/** OTel span ID for correlation with distributed traces */
|
|
621
|
-
spanId?: string;
|
|
622
|
-
};
|
|
623
|
-
export type ProxyBodyCaptureInput = {
|
|
624
|
-
phase: string;
|
|
625
|
-
headers?: Record<string, string>;
|
|
626
|
-
body?: unknown;
|
|
627
|
-
bodySize?: number;
|
|
628
|
-
contentType?: string;
|
|
629
|
-
responseStatus?: number;
|
|
630
|
-
durationMs?: number;
|
|
631
|
-
account?: string;
|
|
632
|
-
accountType?: string;
|
|
633
|
-
attempt?: number;
|
|
634
|
-
metadata?: Record<string, unknown>;
|
|
635
|
-
};
|
|
636
|
-
export type ProxyBodyCaptureLogger = (capture: ProxyBodyCaptureInput) => void;
|
|
637
|
-
export type ClaudeFinalRequestLogger = (status: number, accountLabel: string, accountType: string, errorType?: string, errorMessage?: string, extra?: {
|
|
638
|
-
inputTokens?: number;
|
|
639
|
-
outputTokens?: number;
|
|
640
|
-
cacheCreationTokens?: number;
|
|
641
|
-
cacheReadTokens?: number;
|
|
642
|
-
errorCode?: string;
|
|
643
|
-
transportScope?: ProxyTransportScope;
|
|
644
|
-
}) => void;
|
|
645
|
-
export type ClaudeLoggedErrorBuilder = (status: number, message: string, errorType?: string, extra?: {
|
|
646
|
-
account?: string;
|
|
647
|
-
accountType?: string;
|
|
648
|
-
attempt?: number;
|
|
649
|
-
errorCode?: string;
|
|
650
|
-
transportScope?: ProxyTransportScope;
|
|
651
|
-
}) => ClaudeErrorResponse;
|
|
652
|
-
export type ClaudeRequestRuntimeContext = {
|
|
653
|
-
tracer?: ProxyTracer;
|
|
654
|
-
requestStartTime: number;
|
|
655
|
-
logProxyBody: ProxyBodyCaptureLogger;
|
|
656
|
-
logFinalRequest: ClaudeFinalRequestLogger;
|
|
657
|
-
buildLoggedClaudeError: ClaudeLoggedErrorBuilder;
|
|
658
|
-
};
|
|
659
|
-
export type RoutedClaudeRequestRuntimeContext = ClaudeRequestRuntimeContext & {
|
|
660
|
-
setRoutingDecision: (decision: ProxyAccountRoutingDecision) => void;
|
|
661
|
-
};
|
|
662
|
-
export type AnthropicAttemptLogger = (status: number, errorType?: string, errorMessage?: string, extra?: {
|
|
663
|
-
inputTokens?: number;
|
|
664
|
-
outputTokens?: number;
|
|
665
|
-
cacheCreationTokens?: number;
|
|
666
|
-
cacheReadTokens?: number;
|
|
667
|
-
retryable?: boolean;
|
|
668
|
-
/** Low-level transport code such as ETIMEDOUT or EADDRNOTAVAIL. */
|
|
669
|
-
errorCode?: string;
|
|
670
|
-
transportScope?: ProxyTransportScope;
|
|
671
|
-
rateLimitKind?: "transient" | "quota";
|
|
672
|
-
cooldownReason?: "transient" | "session" | "weekly" | "unified";
|
|
673
|
-
/** Override for nested retries whose attempt starts after this logger. */
|
|
674
|
-
attemptDurationMs?: number;
|
|
675
|
-
/** Override used when one account selection performs an OAuth retry fetch. */
|
|
676
|
-
attempt?: number;
|
|
677
|
-
}) => void;
|
|
678
|
-
export type AnthropicLoopState = {
|
|
679
|
-
lastError: unknown;
|
|
680
|
-
sawRateLimit: boolean;
|
|
681
|
-
sawNetworkError: boolean;
|
|
682
|
-
sawTransientFailure: boolean;
|
|
683
|
-
invalidRequestFailure: {
|
|
684
|
-
status: number;
|
|
685
|
-
body: string;
|
|
686
|
-
contentType?: string;
|
|
687
|
-
} | null;
|
|
688
|
-
authFailureMessage: string | null;
|
|
689
|
-
authCooldownMessage: string | null;
|
|
690
|
-
entitlementFailure: AnthropicEntitlementFailure | null;
|
|
691
|
-
scopedExhaustion: AnthropicScopedExhaustion | null;
|
|
692
|
-
fallbackFailureMessage?: string;
|
|
693
|
-
attemptNumber: number;
|
|
694
|
-
lastTransportErrorCode?: string;
|
|
695
|
-
lastTransportScope?: ProxyNetworkTransportScope;
|
|
696
|
-
};
|
|
697
|
-
export type AnthropicUpstreamBody = {
|
|
698
|
-
bodyStr: string;
|
|
699
|
-
sessionId?: string;
|
|
700
|
-
};
|
|
701
|
-
export type AnthropicUpstreamBodyBuilder = (token: string) => AnthropicUpstreamBody;
|
|
702
|
-
export type LoadedClaudeAccountContext = {
|
|
703
|
-
accounts: ProxyPassthroughAccount[];
|
|
704
|
-
enabledAccounts: ProxyPassthroughAccount[];
|
|
705
|
-
orderedAccounts: ProxyPassthroughAccount[];
|
|
706
|
-
bodyStr: string;
|
|
707
|
-
requestStart: number;
|
|
708
|
-
toolCount: number;
|
|
709
|
-
url: string;
|
|
710
|
-
clientHeaders: Record<string, string | undefined>;
|
|
711
|
-
isClaudeClientRequest: boolean;
|
|
712
|
-
};
|
|
713
|
-
export type AnthropicSuccessResult = {
|
|
714
|
-
retryNextAccount: true;
|
|
715
|
-
failure?: {
|
|
716
|
-
message: string;
|
|
717
|
-
rateLimit: boolean;
|
|
718
|
-
retryDelayMs?: number;
|
|
719
|
-
};
|
|
720
|
-
} | {
|
|
721
|
-
response: Response | unknown;
|
|
722
|
-
holdsAccountAdmission?: boolean;
|
|
723
|
-
};
|
|
724
|
-
/** A release handle for one in-flight request admitted to an OAuth account. */
|
|
725
|
-
export type AccountAdmissionLease = {
|
|
726
|
-
release(): void;
|
|
727
|
-
};
|
|
728
|
-
/** A cancellable queued request for per-account admission capacity. */
|
|
729
|
-
export type QueuedAccountAdmission = {
|
|
730
|
-
accountKey: string;
|
|
731
|
-
promise: Promise<AccountAdmissionLease>;
|
|
732
|
-
cancel(): void;
|
|
733
|
-
};
|
|
734
|
-
/** One queued request waiting for per-account admission capacity. */
|
|
735
|
-
export type AccountAdmissionWaiter = {
|
|
736
|
-
capacity: number;
|
|
737
|
-
resolve: (lease: AccountAdmissionLease) => void;
|
|
738
|
-
};
|
|
739
|
-
/** In-process request admission state for an OAuth account. */
|
|
740
|
-
export type AccountAdmissionState = {
|
|
741
|
-
active: number;
|
|
742
|
-
waiters: AccountAdmissionWaiter[];
|
|
743
|
-
};
|
|
744
|
-
/** Result of buffering only enough upstream SSE to make a retry-safe decision. */
|
|
745
|
-
export type AnthropicStreamPreflightResult = {
|
|
746
|
-
kind: "ready";
|
|
747
|
-
chunks: Uint8Array[];
|
|
748
|
-
} | {
|
|
749
|
-
kind: "empty";
|
|
750
|
-
chunks: Uint8Array[];
|
|
751
|
-
} | {
|
|
752
|
-
kind: "transport_error";
|
|
753
|
-
chunks: Uint8Array[];
|
|
754
|
-
error: unknown;
|
|
755
|
-
} | {
|
|
756
|
-
kind: "sse_error";
|
|
757
|
-
chunks: Uint8Array[];
|
|
758
|
-
errorType: string;
|
|
759
|
-
message: string;
|
|
760
|
-
};
|
|
761
|
-
/** One complete Server-Sent Event extracted from an incremental buffer. */
|
|
762
|
-
export type ParsedSSEEvent = {
|
|
763
|
-
event: string;
|
|
764
|
-
data: string;
|
|
765
|
-
};
|
|
766
|
-
/** Complete SSE events plus the trailing partial frame. */
|
|
767
|
-
export type ParsedSSEBuffer = {
|
|
768
|
-
events: ParsedSSEEvent[];
|
|
769
|
-
remainder: string;
|
|
770
|
-
};
|
|
771
|
-
export type AnthropicAuthRetryResult = {
|
|
772
|
-
response?: Response | unknown;
|
|
773
|
-
holdsAccountAdmission?: boolean;
|
|
774
|
-
continueLoop: boolean;
|
|
775
|
-
/** Failure-path pacing before rotating after provider-wide overload. */
|
|
776
|
-
retryDelayMs?: number;
|
|
777
|
-
lastError: unknown;
|
|
778
|
-
authFailureMessage: string | null;
|
|
779
|
-
entitlementFailure: AnthropicEntitlementFailure | null;
|
|
780
|
-
sawRateLimit: boolean;
|
|
781
|
-
sawTransientFailure: boolean;
|
|
782
|
-
sawNetworkError: boolean;
|
|
783
|
-
upstreamSpan?: Span;
|
|
784
|
-
};
|
|
785
|
-
export type AnthropicNonOkResult = {
|
|
786
|
-
response?: Response | unknown;
|
|
787
|
-
continueLoop: boolean;
|
|
788
|
-
retrySameAccount?: boolean;
|
|
789
|
-
/** Failure-path pacing before rotating after provider-wide overload. */
|
|
790
|
-
retryDelayMs?: number;
|
|
791
|
-
lastError: unknown;
|
|
792
|
-
authFailureMessage: string | null;
|
|
793
|
-
sawTransientFailure: boolean;
|
|
794
|
-
invalidRequestFailure: {
|
|
795
|
-
status: number;
|
|
796
|
-
body: string;
|
|
797
|
-
contentType?: string;
|
|
798
|
-
} | null;
|
|
799
|
-
entitlementFailure: AnthropicEntitlementFailure | null;
|
|
800
|
-
upstreamSpan?: Span;
|
|
801
|
-
};
|
|
802
|
-
export type PreparedAnthropicAccountAttempt = {
|
|
803
|
-
continueLoop: boolean;
|
|
804
|
-
lastError: unknown;
|
|
805
|
-
authFailureMessage: string | null;
|
|
806
|
-
headers?: Record<string, string>;
|
|
807
|
-
buildUpstreamBody?: AnthropicUpstreamBodyBuilder;
|
|
808
|
-
finalBodyStr?: string;
|
|
809
|
-
fetchStartMs?: number;
|
|
810
|
-
upstreamSpan?: Span;
|
|
811
|
-
};
|
|
812
|
-
/** How to cool an account after a genuine (non-anti-abuse) 429, derived from
|
|
813
|
-
* the response's quota headers + retry-after. */
|
|
814
|
-
export type RateLimitCoolingReason = Exclude<AccountCoolingReason, "auth">;
|
|
815
|
-
export type AccountCooldownPlan = {
|
|
816
|
-
reason: RateLimitCoolingReason;
|
|
817
|
-
/** Epoch-ms until which the account should not be used. */
|
|
818
|
-
coolingUntil: number;
|
|
819
|
-
/** When true (unified/5h/7d rejected), rotate immediately — retrying the
|
|
820
|
-
* same account is futile until its window resets. When false (transient
|
|
821
|
-
* burst), a small number of jittered same-account retries is allowed first. */
|
|
822
|
-
rotateImmediately: boolean;
|
|
823
|
-
};
|
|
824
|
-
export type ProxyQuotaCooldownUpdate = {
|
|
825
|
-
kind: "cooled";
|
|
826
|
-
coolingUntil: number;
|
|
827
|
-
coolingReason: AccountCoolingReason;
|
|
828
|
-
} | {
|
|
829
|
-
kind: "cleared";
|
|
830
|
-
coolingUntil: number;
|
|
831
|
-
} | null;
|
|
832
|
-
export type TransientRateLimitRetryBudget = {
|
|
833
|
-
coolingUntil: number;
|
|
834
|
-
retriesClaimed: number;
|
|
835
|
-
};
|
|
836
|
-
export type AnthropicUpstreamFetchResult = {
|
|
837
|
-
continueLoop: boolean;
|
|
838
|
-
retrySameAccount?: boolean;
|
|
839
|
-
transportScope?: ProxyNetworkTransportScope;
|
|
840
|
-
errorCode?: string;
|
|
841
|
-
/** When set, the caller should wait this many ms before retrying (from upstream retry-after). */
|
|
842
|
-
retryAfterMs?: number;
|
|
843
|
-
/** Set on a genuine 429: how long / why to cool this account before rotating. */
|
|
844
|
-
cooldownPlan?: AccountCooldownPlan;
|
|
845
|
-
/** Quota snapshot parsed from the response headers (429 or success), if present. */
|
|
846
|
-
quota?: AccountQuota;
|
|
847
|
-
/** A terminal upstream rejection already captured and classified by the
|
|
848
|
-
* fetch layer. The route must finalize it directly instead of feeding it
|
|
849
|
-
* through the generic non-OK handler a second time. */
|
|
850
|
-
terminalError?: {
|
|
851
|
-
status: number;
|
|
852
|
-
body: string;
|
|
853
|
-
headers: Record<string, string>;
|
|
854
|
-
errorType: "construction_rejection";
|
|
855
|
-
};
|
|
856
|
-
response?: Response;
|
|
857
|
-
lastError: unknown;
|
|
858
|
-
sawRateLimit: boolean;
|
|
859
|
-
sawNetworkError: boolean;
|
|
860
|
-
upstreamSpan?: Span;
|
|
861
|
-
};
|
|
862
|
-
export type ProxyTerminalErrorCategory = "authentication" | "client_cancelled" | "fallback_exhausted" | "invalid_request" | "proxy_error" | "rate_limit" | "stream_error" | "unclassified" | "upstream_error" | "other";
|
|
863
|
-
/** Compact, redacted terminal failure retained independently of body logs. */
|
|
864
|
-
export type ProxyTerminalErrorSummary = {
|
|
865
|
-
id: string;
|
|
866
|
-
at: number;
|
|
867
|
-
status: number;
|
|
868
|
-
category: ProxyTerminalErrorCategory;
|
|
869
|
-
requestId?: string;
|
|
870
|
-
account?: string;
|
|
871
|
-
accountType?: string;
|
|
872
|
-
errorType?: string;
|
|
873
|
-
errorCode?: string;
|
|
874
|
-
terminalOutcome?: string;
|
|
875
|
-
message?: string;
|
|
876
|
-
};
|
|
877
|
-
/** Optional terminal context supplied when a final request error is recorded. */
|
|
878
|
-
export type ProxyTerminalErrorDetails = {
|
|
879
|
-
requestId?: string;
|
|
880
|
-
errorType?: string;
|
|
881
|
-
errorCode?: string;
|
|
882
|
-
terminalOutcome?: string;
|
|
883
|
-
message?: string;
|
|
884
|
-
};
|
|
885
|
-
export type AccountStats = {
|
|
886
|
-
label: string;
|
|
887
|
-
type: string;
|
|
888
|
-
attemptCount: number;
|
|
889
|
-
/** Failed upstream attempts, including retries that later recovered. */
|
|
890
|
-
attemptErrorCount: number;
|
|
891
|
-
/** Final requests successfully completed by this account. */
|
|
892
|
-
successCount: number;
|
|
893
|
-
/** Final requests that terminated as errors on this account. */
|
|
894
|
-
errorCount: number;
|
|
895
|
-
/** All upstream attempts that returned 429. */
|
|
896
|
-
rateLimitCount: number;
|
|
897
|
-
transientRateLimitCount: number;
|
|
898
|
-
quotaRateLimitCount: number;
|
|
899
|
-
lastAttemptAt: number;
|
|
900
|
-
lastErrorAt?: number;
|
|
901
|
-
};
|
|
902
|
-
export type ProxyStats = {
|
|
903
|
-
startedAt: number;
|
|
904
|
-
totalAttempts: number;
|
|
905
|
-
totalAttemptErrors: number;
|
|
906
|
-
totalRequests: number;
|
|
907
|
-
totalSuccess: number;
|
|
908
|
-
totalErrors: number;
|
|
909
|
-
totalRateLimits: number;
|
|
910
|
-
totalTransientRateLimits: number;
|
|
911
|
-
totalQuotaRateLimits: number;
|
|
912
|
-
accounts: Record<string, AccountStats>;
|
|
913
|
-
};
|
|
914
|
-
/** Bounded terminal-error state stored separately from counters and body logs. */
|
|
915
|
-
export type ProxyTerminalErrorJournal = {
|
|
916
|
-
startedAt: number;
|
|
917
|
-
totalErrors: number;
|
|
918
|
-
counts: Record<ProxyTerminalErrorCategory, number>;
|
|
919
|
-
recent: ProxyTerminalErrorSummary[];
|
|
920
|
-
};
|
|
921
|
-
export type ProxyUsageStatsSnapshot = {
|
|
922
|
-
stats: ProxyStats;
|
|
923
|
-
statsVersion: number;
|
|
924
|
-
terminalErrors: ProxyTerminalErrorJournal;
|
|
925
|
-
terminalErrorsVersion: number;
|
|
926
|
-
};
|
|
927
|
-
/** Durability and reconciliation state for the proxy usage counters. */
|
|
928
|
-
export type ProxyStatsPersistenceStatus = {
|
|
929
|
-
enabled: boolean;
|
|
930
|
-
filePath: string | null;
|
|
931
|
-
revision: number;
|
|
932
|
-
pendingMutations: number;
|
|
933
|
-
inFlightMutations: number;
|
|
934
|
-
unpersistedMutations: number;
|
|
935
|
-
lastFlushedAt: number | null;
|
|
936
|
-
lastReconciledAt: number | null;
|
|
937
|
-
lastRecoveryAt: number | null;
|
|
938
|
-
lastError: string | null;
|
|
939
|
-
terminalErrorsFilePath?: string | null;
|
|
940
|
-
terminalErrorsRevision?: number;
|
|
941
|
-
terminalErrorsPending?: number;
|
|
942
|
-
terminalErrorsInFlight?: number;
|
|
943
|
-
terminalErrorsUnpersisted?: number;
|
|
944
|
-
terminalErrorsLastFlushedAt?: number | null;
|
|
945
|
-
terminalErrorsLastRecoveryAt?: number | null;
|
|
946
|
-
terminalErrorsLastError?: string | null;
|
|
947
|
-
};
|
|
948
|
-
/** Versioned on-disk snapshot shared by overlapping proxy workers. */
|
|
949
|
-
export type PersistedProxyStatsSnapshot = {
|
|
950
|
-
schemaVersion: 1;
|
|
951
|
-
revision: number;
|
|
952
|
-
updatedAt: number;
|
|
953
|
-
stats: ProxyStats;
|
|
954
|
-
};
|
|
955
|
-
/** Versioned terminal-error snapshot isolated from rolling-worker counter writes. */
|
|
956
|
-
export type PersistedProxyTerminalErrorSnapshot = {
|
|
957
|
-
schemaVersion: 1;
|
|
958
|
-
revision: number;
|
|
959
|
-
updatedAt: number;
|
|
960
|
-
journal: ProxyTerminalErrorJournal;
|
|
961
|
-
};
|
|
962
|
-
/** Ownership metadata for the proxy statistics cross-process lock. */
|
|
963
|
-
export type ProxyStatsLockOwner = {
|
|
964
|
-
token: string;
|
|
965
|
-
pid: number;
|
|
966
|
-
acquiredAt: number;
|
|
967
|
-
};
|
|
968
|
-
/** Construction options for an isolated proxy statistics store. */
|
|
969
|
-
export type ProxyUsageStatsStoreOptions = {
|
|
970
|
-
filePath?: string;
|
|
971
|
-
terminalErrorsFilePath?: string;
|
|
972
|
-
flushIntervalMs?: number;
|
|
973
|
-
lockTimeoutMs?: number;
|
|
974
|
-
staleLockMs?: number;
|
|
975
|
-
now?: () => number;
|
|
976
|
-
};
|
|
977
|
-
export type RefreshableAccount = {
|
|
978
|
-
token: string;
|
|
979
|
-
refreshToken?: string;
|
|
980
|
-
expiresAt?: number;
|
|
981
|
-
label: string;
|
|
982
|
-
};
|
|
983
|
-
export type RefreshResult = {
|
|
984
|
-
success: boolean;
|
|
985
|
-
error?: string;
|
|
986
|
-
status?: number;
|
|
987
|
-
};
|
|
988
|
-
/** Result shared by callers waiting on the same rotating refresh token. */
|
|
989
|
-
export type SharedRefreshResult = {
|
|
990
|
-
result: RefreshResult;
|
|
991
|
-
token: string;
|
|
992
|
-
refreshToken?: string;
|
|
993
|
-
expiresAt?: number;
|
|
994
|
-
};
|
|
995
|
-
export type TokenPersistTarget = string | {
|
|
996
|
-
credPath: string;
|
|
997
|
-
} | {
|
|
998
|
-
providerKey: string;
|
|
999
|
-
};
|
|
1000
|
-
export type AccountQuota = {
|
|
1001
|
-
/** Top-level unified status. A rejected value can be authoritative even
|
|
1002
|
-
* while both 5h and 7d sub-window statuses still report allowed. */
|
|
1003
|
-
unifiedStatus?: string;
|
|
1004
|
-
/** 0.0-1.0 (from unified-5h-utilization) */
|
|
1005
|
-
sessionUsed: number;
|
|
1006
|
-
/** "allowed" | "throttled" | "rejected" */
|
|
1007
|
-
sessionStatus: string;
|
|
1008
|
-
/** Unix timestamp (seconds) when the 5h window resets */
|
|
1009
|
-
sessionResetAt: number;
|
|
1010
|
-
/** 0.0-1.0 (from unified-7d-utilization) */
|
|
1011
|
-
weeklyUsed: number;
|
|
1012
|
-
/** "allowed" | "throttled" | "rejected" */
|
|
1013
|
-
weeklyStatus: string;
|
|
1014
|
-
/** Unix timestamp (seconds) when the 7d window resets */
|
|
1015
|
-
weeklyResetAt: number;
|
|
1016
|
-
/** 0.0-1.0 (from fallback-percentage) */
|
|
1017
|
-
fallbackPercentage: number;
|
|
1018
|
-
/** Provider fallback availability, for example "available". */
|
|
1019
|
-
fallbackStatus?: string;
|
|
1020
|
-
/** Comma-separated provider upgrade paths, for example "overage". */
|
|
1021
|
-
upgradePaths?: string;
|
|
1022
|
-
/** "allowed" | "rejected" */
|
|
1023
|
-
overageStatus: string;
|
|
1024
|
-
/** Whether Anthropic reports that paid overage is actively serving traffic. */
|
|
1025
|
-
overageInUse?: boolean;
|
|
1026
|
-
/** Why overage is unavailable, verbatim from
|
|
1027
|
-
* anthropic-ratelimit-unified-overage-disabled-reason (e.g.
|
|
1028
|
-
* "org_level_disabled"). Present only when the provider states one. */
|
|
1029
|
-
overageDisabledReason?: string;
|
|
1030
|
-
/** Authoritative extra-usage switch from the usage API's
|
|
1031
|
-
* `extra_usage.is_enabled`. Unlike the header trio this is reported even for
|
|
1032
|
-
* an account that has never served a request. */
|
|
1033
|
-
overageEnabled?: boolean;
|
|
1034
|
-
/** Which window Anthropic considers binding right now, verbatim from
|
|
1035
|
-
* anthropic-ratelimit-unified-representative-claim (e.g. "five_hour"). */
|
|
1036
|
-
representativeClaim?: string;
|
|
1037
|
-
/** Epoch ms when we last captured this data */
|
|
1038
|
-
lastUpdated: number;
|
|
1039
|
-
/** Dynamic per-plan limit buckets from the usage API `limits[]` array
|
|
1040
|
-
* (session / weekly_all / model-scoped weeklies such as Fable / future
|
|
1041
|
-
* kinds). Absent on purely header-sourced snapshots. */
|
|
1042
|
-
windows?: AccountQuotaWindow[];
|
|
1043
|
-
/** Epoch ms when `windows` was last refreshed from the usage API. */
|
|
1044
|
-
windowsUpdatedAt?: number;
|
|
1045
|
-
/** Provenance of this snapshot's numbers. */
|
|
1046
|
-
source?: AccountQuotaSource;
|
|
1047
|
-
};
|
|
1048
|
-
/** Where an AccountQuota snapshot came from.
|
|
1049
|
-
* - "headers" : passive capture of anthropic-ratelimit-unified-* response
|
|
1050
|
-
* headers on a routed request (the automatic path).
|
|
1051
|
-
* - "usage-api" : an explicit refresh against Anthropic's OAuth usage
|
|
1052
|
-
* endpoint (manual refetch path). */
|
|
1053
|
-
export type AccountQuotaSource = "headers" | "usage-api";
|
|
1054
|
-
/** One dynamic limit bucket from the usage API. Provider vocabulary (`kind`,
|
|
1055
|
-
* `group`, `severity`) is preserved verbatim so buckets Anthropic adds later
|
|
1056
|
-
* survive storage and display without a code change. */
|
|
1057
|
-
export type AccountQuotaWindow = {
|
|
1058
|
-
/** Provider kind, verbatim ("session", "weekly_all", "weekly_scoped", ...). */
|
|
1059
|
-
kind: string;
|
|
1060
|
-
/** Provider group, verbatim ("session" | "weekly" | future values). */
|
|
1061
|
-
group?: string;
|
|
1062
|
-
/** 0.0-1.0 utilization (provider percent / 100). */
|
|
1063
|
-
used: number;
|
|
1064
|
-
/** Provider severity, verbatim ("normal", ...). */
|
|
1065
|
-
severity?: string;
|
|
1066
|
-
/** Derived "allowed" | "rejected" (see usageToQuota status mapping). */
|
|
1067
|
-
status: string;
|
|
1068
|
-
/** Unix timestamp (seconds) when this window resets; 0 when unparseable. */
|
|
1069
|
-
resetsAt: number;
|
|
1070
|
-
isActive?: boolean;
|
|
1071
|
-
/** Model display name for model-scoped windows (e.g. "Fable"). */
|
|
1072
|
-
scopeModel?: string;
|
|
1073
|
-
/** Wire model id for the scope when the provider reports one
|
|
1074
|
-
* (`scope.model.id`), which matches a request's `model` exactly and so beats
|
|
1075
|
-
* display-name matching. Often null in practice. */
|
|
1076
|
-
scopeModelId?: string;
|
|
1077
|
-
/** Surface scope when the provider reports one. */
|
|
1078
|
-
scopeSurface?: string;
|
|
1079
|
-
/** Epoch ms this individual window was observed. Lets a header-derived window
|
|
1080
|
-
* and a usage-API window on the same account age independently — the flat
|
|
1081
|
-
* `lastUpdated` refreshes on every response and would otherwise make a
|
|
1082
|
-
* days-old scoped window look current. */
|
|
1083
|
-
updatedAt?: number;
|
|
1084
|
-
/** Provenance of this window, mirroring AccountQuotaSource. */
|
|
1085
|
-
source?: AccountQuotaSource;
|
|
1086
|
-
/** Raw unified header token for header-derived windows, e.g. "7d_oi". */
|
|
1087
|
-
headerWindow?: string;
|
|
1088
|
-
};
|
|
1089
|
-
/** One utilization window from the OAuth usage endpoint (wire shape, loose). */
|
|
1090
|
-
export type AnthropicUsageWindow = {
|
|
1091
|
-
/** 0-100 percent (note: NOT the 0-1 fraction used by headers). */
|
|
1092
|
-
utilization?: number | null;
|
|
1093
|
-
/** ISO-8601 timestamp. */
|
|
1094
|
-
resets_at?: string | null;
|
|
1095
|
-
};
|
|
1096
|
-
/** One entry of the usage endpoint's generic `limits[]` array (wire shape). */
|
|
1097
|
-
export type AnthropicUsageLimit = {
|
|
1098
|
-
kind?: string;
|
|
1099
|
-
group?: string;
|
|
1100
|
-
/** 0-100 percent. */
|
|
1101
|
-
percent?: number | null;
|
|
1102
|
-
severity?: string | null;
|
|
1103
|
-
resets_at?: string | null;
|
|
1104
|
-
scope?: {
|
|
1105
|
-
model?: {
|
|
1106
|
-
id?: string | null;
|
|
1107
|
-
display_name?: string | null;
|
|
1108
|
-
} | null;
|
|
1109
|
-
surface?: string | null;
|
|
1110
|
-
} | null;
|
|
1111
|
-
is_active?: boolean | null;
|
|
1112
|
-
};
|
|
1113
|
-
/** Response body of GET https://api.anthropic.com/api/oauth/usage (loose —
|
|
1114
|
-
* unknown keys are ignored, known keys may be absent or null). */
|
|
1115
|
-
export type AnthropicUsageResponse = {
|
|
1116
|
-
five_hour?: AnthropicUsageWindow | null;
|
|
1117
|
-
seven_day?: AnthropicUsageWindow | null;
|
|
1118
|
-
limits?: AnthropicUsageLimit[] | null;
|
|
1119
|
-
extra_usage?: {
|
|
1120
|
-
is_enabled?: boolean | null;
|
|
1121
|
-
} | null;
|
|
1122
|
-
};
|
|
1123
|
-
/** Outcome of one account's usage-endpoint fetch. Return-not-throw. */
|
|
1124
|
-
export type AccountUsageFetchResult = {
|
|
1125
|
-
ok: true;
|
|
1126
|
-
usage: AnthropicUsageResponse;
|
|
1127
|
-
} | {
|
|
1128
|
-
ok: false;
|
|
1129
|
-
reason: "not_oauth" | "auth" | "http" | "network" | "parse";
|
|
1130
|
-
error: string;
|
|
1131
|
-
status?: number;
|
|
1132
|
-
};
|
|
1133
|
-
export type ProxyQuotaRefreshRuntimeState = {
|
|
1134
|
-
inFlight: boolean;
|
|
1135
|
-
lastAttemptAt?: number;
|
|
1136
|
-
lastSuccessAt?: number;
|
|
1137
|
-
nextEligibleAt?: number;
|
|
1138
|
-
consecutiveFailures: number;
|
|
1139
|
-
lastFailureReason?: string;
|
|
1140
|
-
lastCompletedTrigger?: string;
|
|
1141
|
-
coalesced: number;
|
|
1142
|
-
};
|
|
1143
|
-
export type ProxyQuotaRefreshMetrics = {
|
|
1144
|
-
attempted: number;
|
|
1145
|
-
succeeded: number;
|
|
1146
|
-
failed: number;
|
|
1147
|
-
coalesced: number;
|
|
1148
|
-
backoffSuppressed: number;
|
|
1149
|
-
triggerDeduplicated: number;
|
|
1150
|
-
};
|
|
1151
|
-
export type ProxyQuotaRefreshRunResult = {
|
|
1152
|
-
kind: "completed";
|
|
1153
|
-
result: AccountUsageFetchResult;
|
|
1154
|
-
/** Lower bound for the freshness of the returned usage snapshot. */
|
|
1155
|
-
startedAt: number;
|
|
1156
|
-
} | {
|
|
1157
|
-
kind: "backoff";
|
|
1158
|
-
nextEligibleAt: number;
|
|
1159
|
-
} | {
|
|
1160
|
-
kind: "not_due";
|
|
1161
|
-
};
|
|
1162
|
-
/** Per-account result inside a GET /limits response. */
|
|
1163
|
-
export type ProxyLimitsAccountResult = {
|
|
1164
|
-
/** Account label (quota-store key). */
|
|
1165
|
-
account: string;
|
|
1166
|
-
/** Token-store key ("anthropic:<label>"). */
|
|
1167
|
-
key: string;
|
|
1168
|
-
type: ProxyAccountType;
|
|
1169
|
-
status: "refreshed" | "throttled" | "skipped_api_key" | "snapshot" | "error";
|
|
1170
|
-
/** Fresh quota on "refreshed"; last known snapshot otherwise (may be null). */
|
|
1171
|
-
quota: AccountQuota | null;
|
|
1172
|
-
error?: string;
|
|
1173
|
-
coolingUntil?: number;
|
|
1174
|
-
coolingReason?: AccountCoolingReason;
|
|
1175
|
-
};
|
|
1176
|
-
/** Response body of the proxy's GET /limits endpoint. */
|
|
1177
|
-
export type ProxyLimitsRefreshResponse = {
|
|
1178
|
-
fetchedAt: number;
|
|
1179
|
-
/** True when served from stored state without contacting Anthropic. */
|
|
1180
|
-
snapshot: boolean;
|
|
1181
|
-
results: ProxyLimitsAccountResult[];
|
|
1182
|
-
/** Process-local refresh activity; contains no credentials or response body. */
|
|
1183
|
-
refreshMetrics?: ProxyQuotaRefreshMetrics;
|
|
1184
|
-
};
|
|
1185
|
-
/**
|
|
1186
|
-
* Provenance of the quota numbers attached to a single proxy response.
|
|
1187
|
-
* - "live" : parsed from THIS upstream response's headers.
|
|
1188
|
-
* - "snapshot" : the last known snapshot for the serving account; the upstream
|
|
1189
|
-
* response carried no quota headers.
|
|
1190
|
-
* - "none" : no Anthropic account served this request (fallback provider,
|
|
1191
|
-
* or a failure before any account was reached).
|
|
1192
|
-
*
|
|
1193
|
-
* Consumers must not treat "snapshot" as current. Without this distinction a
|
|
1194
|
-
* stale reading is indistinguishable from a fresh one.
|
|
1195
|
-
*/
|
|
1196
|
-
export type ProxyQuotaSource = "live" | "snapshot" | "none";
|
|
1197
|
-
/** Aggregate account-pool headroom at the moment a response was produced. */
|
|
1198
|
-
export type ProxyPoolHeadroom = {
|
|
1199
|
-
/** Accounts eligible to serve a request right now (not cooling/disabled). */
|
|
1200
|
-
available: number;
|
|
1201
|
-
/** Accounts currently in a cooldown window. */
|
|
1202
|
-
cooling: number;
|
|
1203
|
-
/** Best session headroom across available accounts, as a percentage 0-100.
|
|
1204
|
-
* Undefined when no available account has a quota snapshot. */
|
|
1205
|
-
bestSessionLeftPct?: number;
|
|
1206
|
-
};
|
|
1207
|
-
/**
|
|
1208
|
-
* Everything the proxy knows about limits and routing for one response.
|
|
1209
|
-
* Consumed by `buildQuotaResponseHeaders` — kept as data (not headers) so the
|
|
1210
|
-
* assembly stays pure and testable.
|
|
1211
|
-
*/
|
|
1212
|
-
export type ProxyQuotaHeaderContext = {
|
|
1213
|
-
quota: AccountQuota | null;
|
|
1214
|
-
source: ProxyQuotaSource;
|
|
1215
|
-
/** Account label that served the request; omitted for fallback/no-account. */
|
|
1216
|
-
accountLabel?: string;
|
|
1217
|
-
accountType?: string;
|
|
1218
|
-
/** Which upstream actually produced the response ("anthropic" or a fallback
|
|
1219
|
-
* provider name). Lets a consumer avoid attributing quota to the wrong one. */
|
|
1220
|
-
servedBy?: string;
|
|
1221
|
-
/** 1-based attempt index within the routing loop. */
|
|
1222
|
-
attempt?: number;
|
|
1223
|
-
/** Epoch ms until which the serving account is cooling, when applicable. */
|
|
1224
|
-
coolingUntil?: number;
|
|
1225
|
-
coolingReason?: AccountCoolingReason;
|
|
1226
|
-
pool?: ProxyPoolHeadroom;
|
|
1227
|
-
};
|
|
1228
|
-
/** Why an account is currently cooling. Drives cooldown duration and logging.
|
|
1229
|
-
* - "weekly" : 7d unified limit rejected — cool until the weekly reset.
|
|
1230
|
-
* - "session" : 5h unified limit rejected — cool until the session reset.
|
|
1231
|
-
* - "unified" : top-level unified limit rejected — cool for retry-after.
|
|
1232
|
-
* - "transient" : short per-minute/burst 429 — cool for retry-after only.
|
|
1233
|
-
* - "auth" : transient refresh failure with bounded backoff. */
|
|
1234
|
-
export type AccountCoolingReason = (typeof ACCOUNT_COOLING_REASONS)[number];
|
|
1235
|
-
/** Restart-safe cooldown snapshot for one account. */
|
|
1236
|
-
export type PersistedAccountCooldown = {
|
|
1237
|
-
coolingUntil: number;
|
|
1238
|
-
reason: AccountCoolingReason;
|
|
1239
|
-
updatedAt: number;
|
|
1240
|
-
};
|
|
1241
|
-
/** Normalized Anthropic account keys eligible for proxy routing. */
|
|
1242
|
-
export type AccountAllowlist = ReadonlySet<string>;
|
|
1243
|
-
/** Runtime state for a proxy account. */
|
|
1244
|
-
export type RuntimeAccountState = {
|
|
1245
|
-
consecutiveRefreshFailures: number;
|
|
1246
|
-
permanentlyDisabled: boolean;
|
|
1247
|
-
lastToken?: string;
|
|
1248
|
-
lastRefreshToken?: string;
|
|
1249
|
-
/** Epoch-ms timestamp until which the account should not be used for new
|
|
1250
|
-
* requests. Set from the actual Anthropic reset/retry window or from
|
|
1251
|
-
* bounded refresh backoff. Other requests arriving during this window skip
|
|
1252
|
-
* the account rather than hammering it. */
|
|
1253
|
-
coolingUntil?: number;
|
|
1254
|
-
/** Why the account is cooling (set alongside coolingUntil). */
|
|
1255
|
-
coolingReason?: AccountCoolingReason;
|
|
1256
|
-
/** Latest quota snapshot parsed from Anthropic `anthropic-ratelimit-unified-*`
|
|
1257
|
-
* headers on ANY response (success or 429). Drives proactive, reset-aware
|
|
1258
|
-
* selection so we don't have to eat a 429 to discover an account is spent. */
|
|
1259
|
-
quota?: AccountQuota;
|
|
1260
|
-
};
|
|
1261
|
-
/** A passthrough account used in the proxy route handler. */
|
|
1262
|
-
export type ProxyPassthroughAccount = {
|
|
1263
|
-
key: string;
|
|
1264
|
-
label: string;
|
|
1265
|
-
token: string;
|
|
1266
|
-
refreshToken?: string;
|
|
1267
|
-
expiresAt?: number;
|
|
1268
|
-
type: ProxyAccountType;
|
|
1269
|
-
persistTarget?: TokenPersistTarget;
|
|
1270
|
-
};
|
|
1271
|
-
/** Dependencies for creating Claude proxy routes. */
|
|
1272
|
-
export type ClaudeProxyDeps = {
|
|
1273
|
-
modelRouter?: ModelRouterInterface;
|
|
1274
|
-
};
|
|
1275
|
-
/** Rate limit store entry (Koa adapter). */
|
|
1276
|
-
export type KoaRateLimitEntry = {
|
|
1277
|
-
count: number;
|
|
1278
|
-
resetAt: number;
|
|
1279
|
-
};
|
|
1280
|
-
/** Rate limit context (Fastify adapter). */
|
|
1281
|
-
export type FastifyRateLimitContext = {
|
|
1282
|
-
ttl: number;
|
|
1283
|
-
ban?: boolean;
|
|
1284
|
-
};
|
|
1285
|
-
/** Rate limit store entry (Hono adapter). */
|
|
1286
|
-
export type HonoRateLimitEntry = {
|
|
1287
|
-
count: number;
|
|
1288
|
-
resetAt: number;
|
|
1289
|
-
};
|
|
1290
|
-
/** Information about a deprecated route. */
|
|
1291
|
-
export type DeprecatedRouteInfo = {
|
|
1292
|
-
method: string;
|
|
1293
|
-
path: string;
|
|
1294
|
-
deprecation: RouteDeprecation;
|
|
1295
|
-
};
|
|
1296
|
-
/** Cache entry for response caching middleware. */
|
|
1297
|
-
export type ResponseCacheEntry<T = unknown> = {
|
|
1298
|
-
value: T;
|
|
1299
|
-
expiresAt: number;
|
|
1300
|
-
};
|
|
1301
|
-
/** Close handler for data stream writers. */
|
|
1302
|
-
export type CloseHandler = () => void;
|
|
1303
|
-
/** Cached session entry with TTL for the SessionIdentity cloaking plugin. */
|
|
1304
|
-
export type CachedSession = {
|
|
1305
|
-
userId: string;
|
|
1306
|
-
expiresAt: number;
|
|
1307
|
-
};
|
|
1308
|
-
/** Model tier classification for proxy routing decisions. */
|
|
1309
|
-
export type ClaudeProxyModelTier = "opus" | "sonnet" | "haiku" | "other";
|
|
1310
|
-
/** A single provider attempt in the proxy translation plan. */
|
|
1311
|
-
export type ProxyTranslationAttempt = {
|
|
1312
|
-
provider?: string;
|
|
1313
|
-
model?: string;
|
|
1314
|
-
label: string;
|
|
1315
|
-
};
|
|
1316
|
-
/** Ordered plan of provider attempts for a proxy request. */
|
|
1317
|
-
export type ProxyTranslationPlan = {
|
|
1318
|
-
requestedModel: string;
|
|
1319
|
-
modelTier: ClaudeProxyModelTier;
|
|
1320
|
-
attempts: ProxyTranslationAttempt[];
|
|
1321
|
-
skipped: never[];
|
|
1322
|
-
};
|
|
1323
|
-
/** Mutable readiness state tracked by the proxy process. */
|
|
1324
|
-
export type ProxyReadinessState = {
|
|
1325
|
-
startTimeMs: number;
|
|
1326
|
-
acceptingConnections: boolean;
|
|
1327
|
-
ready: boolean;
|
|
1328
|
-
/** True only while the updater is draining inference traffic. */
|
|
1329
|
-
drainingForUpdate: boolean;
|
|
1330
|
-
readyAtMs?: number;
|
|
1331
|
-
};
|
|
1332
|
-
/** Structured response returned by the proxy /health endpoint. */
|
|
1333
|
-
export type ProxyHealthResponse = {
|
|
1334
|
-
status: "ok" | "starting";
|
|
1335
|
-
ready: boolean;
|
|
1336
|
-
acceptingConnections: boolean;
|
|
1337
|
-
drainingForUpdate: boolean;
|
|
1338
|
-
strategy: string;
|
|
1339
|
-
passthrough: boolean;
|
|
1340
|
-
version: string;
|
|
1341
|
-
startedAt: string;
|
|
1342
|
-
readyAt: string | null;
|
|
1343
|
-
uptime: number;
|
|
1344
|
-
healthPath: "/health";
|
|
1345
|
-
statusPath: "/status";
|
|
1346
|
-
};
|
|
1347
|
-
export type ProxyPaths = {
|
|
1348
|
-
/** Base directory for proxy state files */
|
|
1349
|
-
stateDir: string;
|
|
1350
|
-
/** logs/ — request/response logs */
|
|
1351
|
-
logsDir: string;
|
|
1352
|
-
/** account-quotas.json — per-account rate limit state */
|
|
1353
|
-
quotaFile: string;
|
|
1354
|
-
/** account-cooldowns.json — restart-safe account cooldown state */
|
|
1355
|
-
cooldownFile: string;
|
|
1356
|
-
/** proxy-usage-stats.json — restart- and handoff-safe usage counters */
|
|
1357
|
-
statsFile?: string;
|
|
1358
|
-
/** Whether this is a dev-mode isolated instance */
|
|
1359
|
-
isDev: boolean;
|
|
1360
|
-
};
|
|
1361
|
-
/** OTel metric instruments used by the proxy tracer. */
|
|
1362
|
-
export type ProxyMetrics = {
|
|
1363
|
-
requestsTotal: Counter;
|
|
1364
|
-
requestDuration: Histogram;
|
|
1365
|
-
tokensInput: Counter;
|
|
1366
|
-
tokensOutput: Counter;
|
|
1367
|
-
tokensCacheRead: Counter;
|
|
1368
|
-
tokensCacheCreation: Counter;
|
|
1369
|
-
tokensReasoning: Counter;
|
|
1370
|
-
costTotal: Counter;
|
|
1371
|
-
errorsTotal: Counter;
|
|
1372
|
-
retriesTotal: Counter;
|
|
1373
|
-
modelSubstitutionTotal: Counter;
|
|
1374
|
-
requestBodySize: Histogram;
|
|
1375
|
-
responseBodySize: Histogram;
|
|
1376
|
-
fallbackAttemptsTotal: Counter;
|
|
1377
|
-
fallbackSuccessTotal: Counter;
|
|
1378
|
-
fallbackFailureTotal: Counter;
|
|
1379
|
-
};
|
|
1380
|
-
/** Context for a proxy request at the root span level. */
|
|
1381
|
-
export type ProxyRequestContext = {
|
|
1382
|
-
requestId: string;
|
|
1383
|
-
method: string;
|
|
1384
|
-
path: string;
|
|
1385
|
-
model: string;
|
|
1386
|
-
stream: boolean;
|
|
1387
|
-
toolCount: number;
|
|
1388
|
-
/** Names of the tools advertised in the request (what the caller exposed). */
|
|
1389
|
-
toolNames?: string[];
|
|
1390
|
-
sessionId?: string;
|
|
1391
|
-
userAgent?: string;
|
|
1392
|
-
clientApp?: string;
|
|
1393
|
-
/**
|
|
1394
|
-
* Provider that will serve the request, used for costing. Defaults to
|
|
1395
|
-
* "anthropic" when omitted, which is correct for the /v1/messages engine;
|
|
1396
|
-
* the OpenAI-compatible engine must pass whatever ModelRouter resolved, or
|
|
1397
|
-
* every non-Anthropic model prices to $0.
|
|
1398
|
-
*/
|
|
1399
|
-
provider?: string;
|
|
1400
|
-
};
|
|
1401
|
-
/** Response-side details parsed from the upstream reply (model, finish, tools). */
|
|
1402
|
-
export type ResponseInfoContext = {
|
|
1403
|
-
responseModel?: string;
|
|
1404
|
-
finishReason?: string;
|
|
1405
|
-
stopSequence?: string;
|
|
1406
|
-
/** Names of the tools the model actually invoked (tool_use blocks). */
|
|
1407
|
-
toolCalls?: string[];
|
|
1408
|
-
};
|
|
1409
|
-
/** Context recorded when an account is selected for a proxy request. */
|
|
1410
|
-
export type AccountSelectionContext = {
|
|
1411
|
-
strategy: string;
|
|
1412
|
-
accountsTotal: number;
|
|
1413
|
-
accountsHealthy: number;
|
|
1414
|
-
selectedAccount: string;
|
|
1415
|
-
accountType: string;
|
|
1416
|
-
rateLimitBefore5h?: number;
|
|
1417
|
-
rateLimitBefore7d?: number;
|
|
1418
|
-
};
|
|
1419
|
-
/** Context for a single upstream attempt (one per retry). */
|
|
1420
|
-
export type UpstreamAttemptContext = {
|
|
1421
|
-
attempt: number;
|
|
1422
|
-
account: string;
|
|
1423
|
-
polyfillHeaders: boolean;
|
|
1424
|
-
polyfillBody: boolean;
|
|
1425
|
-
upstreamUrl: string;
|
|
1426
|
-
};
|
|
1427
|
-
/** Token usage and rate-limit utilisation recorded at end of request. */
|
|
1428
|
-
export type UsageContext = {
|
|
1429
|
-
inputTokens: number;
|
|
1430
|
-
outputTokens: number;
|
|
1431
|
-
cacheCreationTokens: number;
|
|
1432
|
-
cacheReadTokens: number;
|
|
1433
|
-
reasoningTokens?: number;
|
|
1434
|
-
rateLimitAfter5h?: number;
|
|
1435
|
-
rateLimitAfter7d?: number;
|
|
1436
|
-
};
|
|
1437
|
-
/** Where a proxy env file path was sourced from. */
|
|
1438
|
-
export type ProxyEnvSource = "cli" | "environment" | "default" | "none";
|
|
1439
|
-
/** Result of resolving which proxy env file to load. */
|
|
1440
|
-
export type ProxyEnvResolution = {
|
|
1441
|
-
path?: string;
|
|
1442
|
-
source: ProxyEnvSource;
|
|
1443
|
-
required: boolean;
|
|
1444
|
-
};
|
|
1445
|
-
/** Result of loading the proxy env file. */
|
|
1446
|
-
export type ProxyEnvLoadResult = {
|
|
1447
|
-
loaded: boolean;
|
|
1448
|
-
path?: string;
|
|
1449
|
-
source: ProxyEnvSource;
|
|
1450
|
-
};
|
|
1451
|
-
/** Options controlling proxy env file resolution. */
|
|
1452
|
-
export type ProxyEnvOptions = {
|
|
1453
|
-
explicitEnvFile?: string;
|
|
1454
|
-
env?: NodeJS.ProcessEnv;
|
|
1455
|
-
homeDir?: string;
|
|
1456
|
-
};
|
|
1457
|
-
/** Snapshot of proxy-related environment variables captured at startup. */
|
|
1458
|
-
export type ProxyEnvironmentSnapshot = {
|
|
1459
|
-
httpsProxy?: string;
|
|
1460
|
-
httpProxy?: string;
|
|
1461
|
-
allProxy?: string;
|
|
1462
|
-
socksProxy?: string;
|
|
1463
|
-
noProxy?: string;
|
|
1464
|
-
};
|
|
1465
|
-
/** Result of a traffic-quiet check. */
|
|
1466
|
-
export type QuietStatus = {
|
|
1467
|
-
isQuiet: boolean;
|
|
1468
|
-
lastActivityAt: Date | null;
|
|
1469
|
-
silenceDurationMs: number;
|
|
1470
|
-
};
|
|
1471
|
-
/** In-process proxy request activity used to protect streaming restarts. */
|
|
1472
|
-
export type ProxyActivitySnapshot = {
|
|
1473
|
-
activeRequests: number;
|
|
1474
|
-
lastActivityAt: Date | null;
|
|
1475
|
-
};
|
|
1476
|
-
/** Activity payload exposed by the running proxy status endpoint. */
|
|
1477
|
-
export type ProxyRuntimeActivity = {
|
|
1478
|
-
activeRequests: number;
|
|
1479
|
-
lastActivityAt: string | null;
|
|
1480
|
-
};
|
|
1481
|
-
/** Terminal state observed while the HTTP adapter relays a response body. */
|
|
1482
|
-
export type ProxyResponseTerminalOutcome = "completed" | "bodyless" | "client_cancelled" | "stream_error";
|
|
1483
|
-
/** Non-blocking callbacks for response lifecycle metadata. */
|
|
1484
|
-
export type ProxyResponseTrackingObserver = {
|
|
1485
|
-
onFirstChunk?: (details: {
|
|
1486
|
-
/** Decoded response-body bytes observed by the adapter. */
|
|
1487
|
-
observedBodyBytes: number;
|
|
1488
|
-
responseChunks: 1;
|
|
1489
|
-
}) => void;
|
|
1490
|
-
onTerminal?: (details: {
|
|
1491
|
-
outcome: ProxyResponseTerminalOutcome;
|
|
1492
|
-
/** Decoded response-body bytes observed by the adapter. */
|
|
1493
|
-
observedBodyBytes: number;
|
|
1494
|
-
responseChunks: number;
|
|
1495
|
-
}) => void;
|
|
1496
|
-
};
|
|
1497
|
-
/** Versioned lifecycle event names persisted by the proxy adapter. */
|
|
1498
|
-
export type ProxyLifecycleEventName = "request_accepted" | "response_headers" | "response_first_chunk" | "request_terminal";
|
|
1499
|
-
/** Client-facing terminal classifications recorded by lifecycle metadata. */
|
|
1500
|
-
export type ProxyLifecycleTerminalOutcome = ProxyResponseTerminalOutcome | "handler_error";
|
|
1501
|
-
/** Content-free lifecycle event accepted by the bounded metadata logger. */
|
|
1502
|
-
export type ProxyLifecycleEventInput = {
|
|
1503
|
-
event: ProxyLifecycleEventName;
|
|
1504
|
-
requestId: string;
|
|
1505
|
-
method: string;
|
|
1506
|
-
path: string;
|
|
1507
|
-
model?: string;
|
|
1508
|
-
stream?: boolean;
|
|
1509
|
-
toolCount?: number;
|
|
1510
|
-
sessionHash?: string;
|
|
1511
|
-
requestBytes?: number;
|
|
1512
|
-
responseStatus?: number;
|
|
1513
|
-
/** Decoded response-body bytes observed by the adapter. */
|
|
1514
|
-
observedBodyBytes?: number;
|
|
1515
|
-
responseChunks?: number;
|
|
1516
|
-
elapsedMs?: number;
|
|
1517
|
-
terminalOutcome?: ProxyLifecycleTerminalOutcome;
|
|
1518
|
-
errorType?: string;
|
|
1519
|
-
errorCode?: string;
|
|
1520
|
-
timestampMs?: number;
|
|
1521
|
-
monotonicMs?: number;
|
|
1522
|
-
};
|
|
1523
|
-
/** Data-quality counters for the bounded lifecycle metadata sink. */
|
|
1524
|
-
export type ProxyLifecycleLoggerSnapshot = {
|
|
1525
|
-
enabled: boolean;
|
|
1526
|
-
schemaVersion: number;
|
|
1527
|
-
processInstanceId: string;
|
|
1528
|
-
nextSequence: number;
|
|
1529
|
-
attempted: number;
|
|
1530
|
-
enqueued: number;
|
|
1531
|
-
written: number;
|
|
1532
|
-
dropped: number;
|
|
1533
|
-
queueDrops: number;
|
|
1534
|
-
invalidDrops: number;
|
|
1535
|
-
writeDrops: number;
|
|
1536
|
-
writeFailures: number;
|
|
1537
|
-
/** Events requeued after a transient lifecycle metadata write failure. */
|
|
1538
|
-
writeRetries: number;
|
|
1539
|
-
pending: number;
|
|
1540
|
-
inFlight: number;
|
|
1541
|
-
flushing: boolean;
|
|
1542
|
-
};
|
|
1543
|
-
/** Lifecycle logger configuration. Queue overrides are used by stress tests. */
|
|
1544
|
-
export type ProxyLifecycleLoggerOptions = {
|
|
1545
|
-
enabled: boolean;
|
|
1546
|
-
logDir?: string;
|
|
1547
|
-
queueCapacity?: number;
|
|
1548
|
-
batchSize?: number;
|
|
1549
|
-
flushIntervalMs?: number;
|
|
1550
|
-
/** Bounded retries for a metadata batch that cannot be appended immediately. */
|
|
1551
|
-
maxWriteRetries?: number;
|
|
1552
|
-
};
|
|
1553
|
-
/** Serialized lifecycle line awaiting a bounded batch write. */
|
|
1554
|
-
export type QueuedProxyLifecycleEvent = {
|
|
1555
|
-
logDir: string;
|
|
1556
|
-
date: string;
|
|
1557
|
-
record: Record<string, unknown>;
|
|
1558
|
-
writeRetries: number;
|
|
1559
|
-
};
|
|
1560
|
-
/** Percentile summary used by offline proxy log analysis. */
|
|
1561
|
-
export type ProxyLatencySummary = {
|
|
1562
|
-
count: number;
|
|
1563
|
-
p50: number | null;
|
|
1564
|
-
p95: number | null;
|
|
1565
|
-
p99: number | null;
|
|
1566
|
-
max: number | null;
|
|
1567
|
-
};
|
|
1568
|
-
/** Per-account request and rate-limit totals reconstructed from JSONL logs. */
|
|
1569
|
-
export type ProxyAnalysisAccount = {
|
|
1570
|
-
account: string;
|
|
1571
|
-
accountType: string;
|
|
1572
|
-
attempts: number;
|
|
1573
|
-
attemptErrors: number;
|
|
1574
|
-
finalRequests: number;
|
|
1575
|
-
finalErrors: number;
|
|
1576
|
-
transientRateLimits: number;
|
|
1577
|
-
quotaRateLimits: number;
|
|
1578
|
-
unclassifiedRateLimits: number;
|
|
1579
|
-
};
|
|
1580
|
-
/** Offline report generated from proxy request, attempt, and lifecycle logs. */
|
|
1581
|
-
export type ProxyAnalysisStreamName = "lifecycle" | "requests" | "attempts" | "debug";
|
|
1582
|
-
export type ProxyAnalysisReport = {
|
|
1583
|
-
generatedAt: string;
|
|
1584
|
-
since: string;
|
|
1585
|
-
until: string;
|
|
1586
|
-
logsDir: string;
|
|
1587
|
-
files: {
|
|
1588
|
-
lifecycle: number;
|
|
1589
|
-
requests: number;
|
|
1590
|
-
attempts: number;
|
|
1591
|
-
debug: number;
|
|
1592
|
-
};
|
|
1593
|
-
coverage: {
|
|
1594
|
-
lifecycle: boolean;
|
|
1595
|
-
finalRequests: boolean;
|
|
1596
|
-
attempts: boolean;
|
|
1597
|
-
attemptLatency: boolean;
|
|
1598
|
-
cacheUsage: boolean;
|
|
1599
|
-
routingDecisions: boolean;
|
|
1600
|
-
/** True only when every stream needed for cross-stream request/attempt
|
|
1601
|
-
* reconciliation begins at or before the requested analysis window. */
|
|
1602
|
-
comparableRequestAttempts: boolean;
|
|
1603
|
-
};
|
|
1604
|
-
dataQuality: {
|
|
1605
|
-
linesRead: number;
|
|
1606
|
-
malformedLines: number;
|
|
1607
|
-
unsupportedLifecycleLines: number;
|
|
1608
|
-
lifecycleSequenceGaps: number;
|
|
1609
|
-
lifecycleSequenceDuplicates: number;
|
|
1610
|
-
streams: Record<ProxyAnalysisStreamName, {
|
|
1611
|
-
observedFrom: string | null;
|
|
1612
|
-
observedTo: string | null;
|
|
1613
|
-
startsAtOrBeforeRequestedWindow: boolean;
|
|
1614
|
-
/** Whether this stream can support claims covering the full window. */
|
|
1615
|
-
completeWindow: boolean;
|
|
1616
|
-
}>;
|
|
1617
|
-
bodyArtifacts: {
|
|
1618
|
-
capturesIndexed: number;
|
|
1619
|
-
artifactsReferenced: number;
|
|
1620
|
-
artifactsPresent: number;
|
|
1621
|
-
artifactsMissing: number;
|
|
1622
|
-
invalidPaths: number;
|
|
1623
|
-
writeFailures: number;
|
|
1624
|
-
truncatedCaptures: number;
|
|
1625
|
-
};
|
|
1626
|
-
routingDecisions: {
|
|
1627
|
-
valid: number;
|
|
1628
|
-
invalid: number;
|
|
1629
|
-
absent: number;
|
|
1630
|
-
};
|
|
1631
|
-
};
|
|
1632
|
-
lifecycle: {
|
|
1633
|
-
accepted: number;
|
|
1634
|
-
headers: number;
|
|
1635
|
-
firstChunks: number;
|
|
1636
|
-
terminal: number;
|
|
1637
|
-
unsettled: number;
|
|
1638
|
-
terminalOutcomes: Record<string, number>;
|
|
1639
|
-
errorTypes: Record<string, number>;
|
|
1640
|
-
errorCodes: Record<string, number>;
|
|
1641
|
-
};
|
|
1642
|
-
requests: {
|
|
1643
|
-
completed: number;
|
|
1644
|
-
success: number;
|
|
1645
|
-
errors: number;
|
|
1646
|
-
finalRateLimits: number;
|
|
1647
|
-
recoveredAfterRetry: number;
|
|
1648
|
-
errorTypes: Record<string, number>;
|
|
1649
|
-
errorCodes: Record<string, number>;
|
|
1650
|
-
};
|
|
1651
|
-
attempts: {
|
|
1652
|
-
total: number;
|
|
1653
|
-
errors: number;
|
|
1654
|
-
errorTypes: Record<string, number>;
|
|
1655
|
-
errorCodes: Record<string, number>;
|
|
1656
|
-
transportScopes: Record<string, number>;
|
|
1657
|
-
};
|
|
1658
|
-
rateLimits: {
|
|
1659
|
-
attemptRateLimits: number;
|
|
1660
|
-
transient: number;
|
|
1661
|
-
quota: number;
|
|
1662
|
-
unclassified: number;
|
|
1663
|
-
};
|
|
1664
|
-
latencyMs: {
|
|
1665
|
-
headers: ProxyLatencySummary;
|
|
1666
|
-
firstChunk: ProxyLatencySummary;
|
|
1667
|
-
terminal: ProxyLatencySummary;
|
|
1668
|
-
finalRequest: ProxyLatencySummary;
|
|
1669
|
-
attempt: ProxyLatencySummary;
|
|
1670
|
-
singleAttemptDelta: ProxyLatencySummary;
|
|
1671
|
-
};
|
|
1672
|
-
cache: {
|
|
1673
|
-
requestsWithUsage: number;
|
|
1674
|
-
requestsWithCacheRead: number;
|
|
1675
|
-
cacheReadTokens: number;
|
|
1676
|
-
cacheCreationTokens: number;
|
|
1677
|
-
inputTokens: number;
|
|
1678
|
-
outputTokens: number;
|
|
1679
|
-
requestHitRate: number | null;
|
|
1680
|
-
/**
|
|
1681
|
-
* Summed per-request cost in USD. Records that carry no model, or whose
|
|
1682
|
-
* model matches no pricing table, contribute 0 — so this is a floor, not
|
|
1683
|
-
* an exact bill. `requestsPriced` says how many records actually priced.
|
|
1684
|
-
*/
|
|
1685
|
-
estimatedCostUsd: number;
|
|
1686
|
-
requestsPriced: number;
|
|
1687
|
-
/**
|
|
1688
|
-
* Requests whose cost came from a longest-prefix fallback rather than an
|
|
1689
|
-
* exact pricing row — the rate is inherited from a similarly-named model
|
|
1690
|
-
* and may be wrong. Adding the real row makes these exact.
|
|
1691
|
-
*/
|
|
1692
|
-
requestsPricedByPrefix: number;
|
|
1693
|
-
/** Distinct models priced by prefix fallback, for the operator to chase. */
|
|
1694
|
-
modelsPricedByPrefix: string[];
|
|
1695
|
-
/** Requests carrying usage whose model matched no pricing row at all. */
|
|
1696
|
-
requestsUnpriced: number;
|
|
1697
|
-
/** Distinct models with no pricing row at all. */
|
|
1698
|
-
unpricedModels: string[];
|
|
1699
|
-
};
|
|
1700
|
-
routing: {
|
|
1701
|
-
modes: Record<string, number>;
|
|
1702
|
-
selectionReasons: Record<string, number>;
|
|
1703
|
-
initialAccounts: Record<string, number>;
|
|
1704
|
-
finalAccountChanges: number;
|
|
1705
|
-
finalOutsideCandidateSet: number;
|
|
1706
|
-
/** Number of routing decisions aggregated before sampling records. */
|
|
1707
|
-
totalRecords: number;
|
|
1708
|
-
/** Most recent bounded sample retained for offline inspection. */
|
|
1709
|
-
records: ProxyAnalysisRoutingRecord[];
|
|
1710
|
-
};
|
|
1711
|
-
accounts: ProxyAnalysisAccount[];
|
|
1712
|
-
};
|
|
1713
|
-
/** Inputs for the offline proxy JSONL analyzer. */
|
|
1714
|
-
export type ProxyAnalysisOptions = {
|
|
1715
|
-
logsDir?: string;
|
|
1716
|
-
since?: string;
|
|
1717
|
-
until?: string;
|
|
1718
|
-
nowMs?: number;
|
|
1719
|
-
};
|
|
1720
|
-
/** Attempt timing retained while joining offline proxy log records. */
|
|
1721
|
-
export type ProxyAnalysisAttemptRecord = {
|
|
1722
|
-
count: number;
|
|
1723
|
-
hadError: boolean;
|
|
1724
|
-
totalDurationMs: number;
|
|
1725
|
-
durationCount: number;
|
|
1726
|
-
};
|
|
1727
|
-
/** Final request fields retained while joining offline proxy log records. */
|
|
1728
|
-
export type ProxyAnalysisFinalRequestRecord = {
|
|
1729
|
-
timestamp: string;
|
|
1730
|
-
status: number;
|
|
1731
|
-
durationMs: number | null;
|
|
1732
|
-
account: string;
|
|
1733
|
-
accountType: string;
|
|
1734
|
-
model: string | null;
|
|
1735
|
-
provider: string | null;
|
|
1736
|
-
inputTokens: number | null;
|
|
1737
|
-
outputTokens: number | null;
|
|
1738
|
-
cacheReadTokens: number | null;
|
|
1739
|
-
cacheCreationTokens: number | null;
|
|
1740
|
-
errorType: string | null;
|
|
1741
|
-
errorCode: string | null;
|
|
1742
|
-
routingDecision: ProxyAccountRoutingDecision | null;
|
|
1743
|
-
};
|
|
1744
|
-
/**
|
|
1745
|
-
* A stream transformer that also handles cancellation.
|
|
1746
|
-
*
|
|
1747
|
-
* The Streams standard gives `Transformer` a `cancel()` callback — invoked when
|
|
1748
|
-
* the stream is aborted rather than closed cleanly — and Node implements it,
|
|
1749
|
-
* but TypeScript's bundled lib does not declare it yet. Without it there is no
|
|
1750
|
-
* way to observe a client hanging up mid-response.
|
|
1751
|
-
*/
|
|
1752
|
-
export type ProxyCancellableTransformer<I, O> = Transformer<I, O> & {
|
|
1753
|
-
cancel?: (reason?: unknown) => void;
|
|
1754
|
-
};
|
|
1755
|
-
/**
|
|
1756
|
-
* Token usage scraped from a Codex (OpenAI Responses) SSE stream.
|
|
1757
|
-
*
|
|
1758
|
-
* Verified against real traffic: captured from a live `codex exec` run through
|
|
1759
|
-
* the proxy on 2026-08-21 (`test/fixtures/codex-response-usage.sse`). The
|
|
1760
|
-
* shape is `response.completed` → `response.usage`, carrying `input_tokens`,
|
|
1761
|
-
* `output_tokens`, and an `input_tokens_details` object with `cached_tokens`
|
|
1762
|
-
* and `cache_write_tokens`. The parser also accepts the common variants. Treat
|
|
1763
|
-
* a null result as "not observed", never as "zero tokens".
|
|
1764
|
-
*/
|
|
1765
|
-
export type CodexStreamUsage = {
|
|
1766
|
-
inputTokens: number;
|
|
1767
|
-
outputTokens: number;
|
|
1768
|
-
cacheReadTokens: number;
|
|
1769
|
-
/** Cache writes, which bill at a premium over both reads and plain input. */
|
|
1770
|
-
cacheCreationTokens: number;
|
|
1771
|
-
reasoningTokens: number;
|
|
1772
|
-
};
|
|
1773
|
-
/** Validated account-routing evidence joined to a final request log. */
|
|
1774
|
-
export type ProxyAnalysisRoutingRecord = {
|
|
1775
|
-
requestId: string;
|
|
1776
|
-
timestamp: string;
|
|
1777
|
-
responseStatus: number;
|
|
1778
|
-
finalAccount: string;
|
|
1779
|
-
finalAccountType: string;
|
|
1780
|
-
decision: ProxyAccountRoutingDecision;
|
|
1781
|
-
};
|
|
1782
|
-
/** Request metadata retained by the HTTP adapter for terminal error logging. */
|
|
1783
|
-
export type RuntimeRequestMetadata = {
|
|
1784
|
-
requestId: string;
|
|
1785
|
-
method: string;
|
|
1786
|
-
path: string;
|
|
1787
|
-
startedAt: number;
|
|
1788
|
-
model: string;
|
|
1789
|
-
stream: boolean;
|
|
1790
|
-
toolCount: number;
|
|
1791
|
-
/** Admission decision captured before an updater drain can race the route. */
|
|
1792
|
-
rejectForUpdate?: boolean;
|
|
1793
|
-
terminalErrorType?: string;
|
|
1794
|
-
terminalErrorCode?: string;
|
|
1795
|
-
};
|
|
1796
|
-
/** Accumulated upstream body capture from a raw stream. */
|
|
1797
|
-
export type RawStreamCapture = {
|
|
1798
|
-
totalBytes: number;
|
|
1799
|
-
text: string;
|
|
1800
|
-
truncated: boolean;
|
|
1801
|
-
};
|
|
1802
|
-
/** Transformed stream pair used to capture upstream bodies without buffering. */
|
|
1803
|
-
export type RawStreamCaptureResult = {
|
|
1804
|
-
stream: TransformStream<Uint8Array, Uint8Array>;
|
|
1805
|
-
capture: Promise<RawStreamCapture>;
|
|
1806
|
-
};
|
|
1807
|
-
/** Single captured body/headers entry written to disk by the proxy logger. */
|
|
1808
|
-
export type ProxyBodyCaptureEntry = {
|
|
1809
|
-
timestamp: string;
|
|
1810
|
-
requestId: string;
|
|
1811
|
-
phase: string;
|
|
1812
|
-
model: string;
|
|
1813
|
-
stream: boolean;
|
|
1814
|
-
headers?: Record<string, string>;
|
|
1815
|
-
body?: unknown;
|
|
1816
|
-
bodySize?: number;
|
|
1817
|
-
contentType?: string;
|
|
1818
|
-
responseStatus?: number;
|
|
1819
|
-
durationMs?: number;
|
|
1820
|
-
account?: string;
|
|
1821
|
-
accountType?: string;
|
|
1822
|
-
attempt?: number;
|
|
1823
|
-
traceId?: string;
|
|
1824
|
-
spanId?: string;
|
|
1825
|
-
metadata?: Record<string, unknown>;
|
|
1826
|
-
};
|
|
1827
|
-
/** JSON object retained in deterministic proxy replay artifacts. */
|
|
1828
|
-
export type ProxyReplayJsonRecord = Record<string, unknown>;
|
|
1829
|
-
/** One verified body-capture record in a proxy replay bundle. */
|
|
1830
|
-
export type ProxyReplayCapture = {
|
|
1831
|
-
timestamp: string;
|
|
1832
|
-
phase: string;
|
|
1833
|
-
attempt: number | null;
|
|
1834
|
-
model: string | null;
|
|
1835
|
-
stream: boolean | null;
|
|
1836
|
-
account: string | null;
|
|
1837
|
-
accountType: string | null;
|
|
1838
|
-
responseStatus: number | null;
|
|
1839
|
-
durationMs: number | null;
|
|
1840
|
-
contentType: string | null;
|
|
1841
|
-
headers: Record<string, string>;
|
|
1842
|
-
body: string | null;
|
|
1843
|
-
bodySha256: string | null;
|
|
1844
|
-
bodyTruncated: boolean;
|
|
1845
|
-
observedBodyBytes: number | null;
|
|
1846
|
-
metadata: ProxyReplayJsonRecord | null;
|
|
1847
|
-
source: {
|
|
1848
|
-
indexFile: string;
|
|
1849
|
-
indexLine: number;
|
|
1850
|
-
artifactPath: string | null;
|
|
1851
|
-
};
|
|
1852
|
-
issues: string[];
|
|
1853
|
-
};
|
|
1854
|
-
/** Deterministic, redacted reconstruction of one captured proxy request. */
|
|
1855
|
-
export type ProxyReplayBundle = {
|
|
1856
|
-
schemaVersion: 1;
|
|
1857
|
-
kind: "neurolink.proxy.replay-bundle";
|
|
1858
|
-
requestId: string;
|
|
1859
|
-
selectedAttempt: number;
|
|
1860
|
-
source: {
|
|
1861
|
-
logsDirectory: string;
|
|
1862
|
-
indexFiles: string[];
|
|
1863
|
-
};
|
|
1864
|
-
completeness: {
|
|
1865
|
-
captures: number;
|
|
1866
|
-
phasesPresent: string[];
|
|
1867
|
-
missingRequiredPhases: string[];
|
|
1868
|
-
truncatedCaptures: number;
|
|
1869
|
-
artifactsWithIssues: number;
|
|
1870
|
-
replayable: boolean;
|
|
1871
|
-
blockers: string[];
|
|
1872
|
-
};
|
|
1873
|
-
request: {
|
|
1874
|
-
method: string;
|
|
1875
|
-
url: string | null;
|
|
1876
|
-
headers: Record<string, string>;
|
|
1877
|
-
requiredHeaderInputs: string[];
|
|
1878
|
-
body: string | null;
|
|
1879
|
-
bodySha256: string | null;
|
|
1880
|
-
bodyTruncated: boolean;
|
|
1881
|
-
contentType: string | null;
|
|
1882
|
-
account: string | null;
|
|
1883
|
-
accountType: string | null;
|
|
1884
|
-
model: string | null;
|
|
1885
|
-
stream: boolean | null;
|
|
1886
|
-
};
|
|
1887
|
-
capturedResponse: ProxyReplayCapture | null;
|
|
1888
|
-
captures: ProxyReplayCapture[];
|
|
1889
|
-
};
|
|
1890
|
-
/** Redacted direct-upstream response and comparison with captured evidence. */
|
|
1891
|
-
export type ProxyReplayComparison = {
|
|
1892
|
-
schemaVersion: 1;
|
|
1893
|
-
kind: "neurolink.proxy.replay-comparison";
|
|
1894
|
-
requestId: string;
|
|
1895
|
-
selectedAttempt: number;
|
|
1896
|
-
endpoint: string;
|
|
1897
|
-
request: {
|
|
1898
|
-
method: string;
|
|
1899
|
-
headers: Record<string, string>;
|
|
1900
|
-
bodySha256: string;
|
|
1901
|
-
bodyBytes: number;
|
|
1902
|
-
usedBodyOverride: boolean;
|
|
1903
|
-
};
|
|
1904
|
-
captured: {
|
|
1905
|
-
status: number | null;
|
|
1906
|
-
contentType: string | null;
|
|
1907
|
-
bodySha256: string | null;
|
|
1908
|
-
bodyBytes: number | null;
|
|
1909
|
-
bodyTruncated: boolean;
|
|
1910
|
-
jsonShape: string[] | null;
|
|
1911
|
-
} | null;
|
|
1912
|
-
direct: {
|
|
1913
|
-
status: number;
|
|
1914
|
-
headers: Record<string, string>;
|
|
1915
|
-
contentType: string | null;
|
|
1916
|
-
body: string;
|
|
1917
|
-
bodySha256: string;
|
|
1918
|
-
observedBodyBytes: number;
|
|
1919
|
-
storedBodyBytes: number;
|
|
1920
|
-
bodyTruncated: boolean;
|
|
1921
|
-
timeToHeadersMs: number;
|
|
1922
|
-
totalMs: number;
|
|
1923
|
-
jsonShape: string[] | null;
|
|
1924
|
-
};
|
|
1925
|
-
comparison: {
|
|
1926
|
-
statusMatches: boolean | null;
|
|
1927
|
-
contentTypeMatches: boolean | null;
|
|
1928
|
-
bodyHashMatches: boolean | null;
|
|
1929
|
-
jsonShapeMatches: boolean | null;
|
|
1930
|
-
};
|
|
1931
|
-
};
|
|
1932
|
-
/** Inputs for deterministic proxy replay bundle export. */
|
|
1933
|
-
export type ExportProxyReplayOptions = {
|
|
1934
|
-
requestId: string;
|
|
1935
|
-
logsDir?: string;
|
|
1936
|
-
attempt?: number;
|
|
1937
|
-
};
|
|
1938
|
-
/** Inputs for an explicitly authorized direct-upstream comparison. */
|
|
1939
|
-
export type CompareProxyReplayOptions = {
|
|
1940
|
-
execute: boolean;
|
|
1941
|
-
headerValues?: Record<string, string>;
|
|
1942
|
-
bodyOverride?: string;
|
|
1943
|
-
urlOverride?: string;
|
|
1944
|
-
timeoutMs?: number;
|
|
1945
|
-
now?: () => number;
|
|
1946
|
-
fetchImpl?: typeof fetch;
|
|
1947
|
-
};
|
|
1948
|
-
/** Persisted artifact produced when a body is stored to disk. */
|
|
1949
|
-
export type StoredBodyArtifact = {
|
|
1950
|
-
bodyPath?: string;
|
|
1951
|
-
bodySha256?: string;
|
|
1952
|
-
redactedBodyBytes?: number;
|
|
1953
|
-
storedFileBytes?: number;
|
|
1954
|
-
redactedBody?: string;
|
|
1955
|
-
bodyTruncated?: boolean;
|
|
1956
|
-
bodyWriteFailed?: boolean;
|
|
1957
|
-
};
|
|
1958
|
-
/** File the proxy logger tracks for rotation and cleanup. */
|
|
1959
|
-
export type ManagedLogFile = {
|
|
1960
|
-
path: string;
|
|
1961
|
-
mtime: number;
|
|
1962
|
-
size: number;
|
|
1963
|
-
};
|
|
1964
|
-
/** Individual content block observed during an SSE stream. */
|
|
1965
|
-
export type SSEContentBlock = {
|
|
1966
|
-
index: number;
|
|
1967
|
-
type: "text" | "thinking" | "tool_use" | "tool_result";
|
|
1968
|
-
/** Accumulated text for text blocks. Capped at MAX_BLOCK_CONTENT_BYTES. */
|
|
1969
|
-
text?: string;
|
|
1970
|
-
/** Accumulated thinking content. Capped at MAX_BLOCK_CONTENT_BYTES. */
|
|
1971
|
-
thinking?: string;
|
|
1972
|
-
/** Tool name for tool_use blocks. */
|
|
1973
|
-
toolName?: string;
|
|
1974
|
-
/** Tool call id for tool_use blocks. */
|
|
1975
|
-
toolId?: string;
|
|
1976
|
-
/** Accumulated partial JSON input for tool_use blocks. Capped at MAX_BLOCK_CONTENT_BYTES. */
|
|
1977
|
-
toolInput?: string;
|
|
1978
|
-
};
|
|
1979
|
-
/** Aggregated telemetry resolved when an SSE stream completes. */
|
|
1980
|
-
export type SSETelemetry = {
|
|
1981
|
-
messageId: string;
|
|
1982
|
-
model: string;
|
|
1983
|
-
usage: {
|
|
1984
|
-
inputTokens: number;
|
|
1985
|
-
outputTokens: number;
|
|
1986
|
-
cacheCreationInputTokens: number;
|
|
1987
|
-
cacheReadInputTokens: number;
|
|
1988
|
-
totalTokens: number;
|
|
1989
|
-
};
|
|
1990
|
-
contentBlocks: SSEContentBlock[];
|
|
1991
|
-
stopReason: string | null;
|
|
1992
|
-
stopSequence: string | null;
|
|
1993
|
-
eventCount: number;
|
|
1994
|
-
streamDurationMs: number;
|
|
1995
|
-
totalBytesReceived: number;
|
|
1996
|
-
events: Array<{
|
|
1997
|
-
type: string;
|
|
1998
|
-
timestamp: number;
|
|
1999
|
-
data: string;
|
|
2000
|
-
}>;
|
|
2001
|
-
/** Error carried as a terminal SSE `event: error`, if one was observed. */
|
|
2002
|
-
streamErrorMessage?: string;
|
|
2003
|
-
rawText?: string;
|
|
2004
|
-
};
|
|
2005
|
-
/** Terminal outcome of a response body after the HTTP headers were sent. */
|
|
2006
|
-
export type StreamTerminalOutcome = {
|
|
2007
|
-
kind: "completed";
|
|
2008
|
-
} | {
|
|
2009
|
-
kind: "upstream_error";
|
|
2010
|
-
message: string;
|
|
2011
|
-
} | {
|
|
2012
|
-
kind: "client_cancelled";
|
|
2013
|
-
};
|
|
2014
|
-
/** First-writer-wins tracker for an upstream streaming response. */
|
|
2015
|
-
export type StreamTerminalOutcomeTracker = {
|
|
2016
|
-
outcome: Promise<StreamTerminalOutcome>;
|
|
2017
|
-
complete: () => void;
|
|
2018
|
-
fail: (message: string) => void;
|
|
2019
|
-
cancel: () => void;
|
|
2020
|
-
};
|
|
2021
|
-
/** Mutable accumulator the SSE interceptor uses internally. */
|
|
2022
|
-
export type TelemetryAccumulator = {
|
|
2023
|
-
messageId: string;
|
|
2024
|
-
model: string;
|
|
2025
|
-
inputTokens: number;
|
|
2026
|
-
outputTokens: number;
|
|
2027
|
-
cacheCreationInputTokens: number;
|
|
2028
|
-
cacheReadInputTokens: number;
|
|
2029
|
-
contentBlocks: SSEContentBlock[];
|
|
2030
|
-
blockByteCounts: Map<number, number>;
|
|
2031
|
-
stopReason: string | null;
|
|
2032
|
-
stopSequence: string | null;
|
|
2033
|
-
eventCount: number;
|
|
2034
|
-
startTime: number;
|
|
2035
|
-
totalBytesReceived: number;
|
|
2036
|
-
events: Array<{
|
|
2037
|
-
type: string;
|
|
2038
|
-
timestamp: number;
|
|
2039
|
-
data: string;
|
|
2040
|
-
}>;
|
|
2041
|
-
rawTextChunks?: string[];
|
|
2042
|
-
rawTextBytes: number;
|
|
2043
|
-
rawTextTruncated: boolean;
|
|
2044
|
-
eventLogTruncated: boolean;
|
|
2045
|
-
streamErrorMessage?: string;
|
|
2046
|
-
};
|
|
2047
|
-
/** Result of createSSEInterceptor: the pass-through stream and a telemetry promise. */
|
|
2048
|
-
export type SSEInterceptorResult = {
|
|
2049
|
-
stream: TransformStream<Uint8Array, Uint8Array>;
|
|
2050
|
-
telemetry: Promise<SSETelemetry>;
|
|
2051
|
-
};
|
|
2052
|
-
/** Options for createSSEInterceptor. */
|
|
2053
|
-
export type SSEInterceptorOptions = {
|
|
2054
|
-
captureRawText?: boolean;
|
|
2055
|
-
};
|
|
2056
|
-
/** Outcome of a proxy auto-update version check against npm. */
|
|
2057
|
-
export type UpdateCheckResult = {
|
|
2058
|
-
currentVersion: string;
|
|
2059
|
-
latestVersion: string;
|
|
2060
|
-
updateAvailable: boolean;
|
|
2061
|
-
};
|
|
2062
|
-
/** Result of one local proxy health probe by the updater or fail-open guard. */
|
|
2063
|
-
export type ProxyHealthProbe = {
|
|
2064
|
-
healthy: boolean;
|
|
2065
|
-
durationMs: number;
|
|
2066
|
-
failure: "http_status" | "network" | "timeout" | null;
|
|
2067
|
-
statusCode: number | null;
|
|
2068
|
-
errorCode: string | null;
|
|
2069
|
-
};
|
|
2070
|
-
/** Parsed major.minor.patch components of a semver string. */
|
|
2071
|
-
export type SemVer = {
|
|
2072
|
-
major: number;
|
|
2073
|
-
minor: number;
|
|
2074
|
-
patch: number;
|
|
2075
|
-
};
|
|
2076
|
-
/** Entry describing a version suppressed from auto-update. */
|
|
2077
|
-
export type SuppressedVersion = {
|
|
2078
|
-
suppressedAt: string;
|
|
2079
|
-
reason: string;
|
|
2080
|
-
};
|
|
2081
|
-
/** Persisted state for the proxy auto-update feature. */
|
|
2082
|
-
export type UpdateState = {
|
|
2083
|
-
lastCheckAt: string;
|
|
2084
|
-
lastCheckVersion: string;
|
|
2085
|
-
suppressedVersions: Record<string, SuppressedVersion>;
|
|
2086
|
-
/**
|
|
2087
|
-
* Last package version whose stable trampoline was successfully validated.
|
|
2088
|
-
*
|
|
2089
|
-
* Optional because `UpdateState` is part of the published type surface and a
|
|
2090
|
-
* required addition would break every downstream object literal — and because
|
|
2091
|
-
* state files written before this field existed legitimately omit it.
|
|
2092
|
-
* `loadUpdateState()` always materializes it, so runtime readers see a value.
|
|
2093
|
-
*/
|
|
2094
|
-
installedVersion?: string | null;
|
|
2095
|
-
lastUpdateAt: string | null;
|
|
2096
|
-
lastUpdateVersion: string | null;
|
|
2097
|
-
/** Installed by the updater but not yet confirmed as the running version. */
|
|
2098
|
-
pendingRestartVersion: string | null;
|
|
2099
|
-
/** Why an available update has not yet reached a safe install/restart boundary. */
|
|
2100
|
-
deferredUpdate: {
|
|
2101
|
-
version: string;
|
|
2102
|
-
since: string;
|
|
2103
|
-
updatedAt: string;
|
|
2104
|
-
reason: "waiting_for_quiet" | "draining" | "drain_timeout" | "drain_unavailable" | "activity_unavailable";
|
|
2105
|
-
activeRequests: number | null;
|
|
2106
|
-
} | null;
|
|
2107
|
-
/** Last updater failure, retained until a successful update or replacement. */
|
|
2108
|
-
lastFailure: {
|
|
2109
|
-
at: string;
|
|
2110
|
-
version: string;
|
|
2111
|
-
stage: "check" | "install" | "validation" | "restart" | "health";
|
|
2112
|
-
message: string;
|
|
2113
|
-
} | null;
|
|
2114
|
-
};
|
|
2115
|
-
/** Result from waiting for a non-disruptive updater execution window. */
|
|
2116
|
-
export type ProxyUpdateWindowResult = {
|
|
2117
|
-
ready: boolean;
|
|
2118
|
-
draining: boolean;
|
|
2119
|
-
reason?: "stopping" | "parent_stopped" | "drain_failed" | "drain_timeout";
|
|
2120
|
-
};
|
|
2121
|
-
/** Dependencies and timing controls for the updater's safe-window coordinator. */
|
|
2122
|
-
export type ProxyUpdateWindowOptions = {
|
|
2123
|
-
quietThresholdMs: number;
|
|
2124
|
-
quietWaitMs: number;
|
|
2125
|
-
drainWaitMs: number;
|
|
2126
|
-
pollIntervalMs: number;
|
|
2127
|
-
getActivity: () => Promise<ProxyRuntimeActivity | null>;
|
|
2128
|
-
setDraining: (draining: boolean) => Promise<boolean>;
|
|
2129
|
-
isStopping: () => boolean;
|
|
2130
|
-
isParentAlive: () => boolean;
|
|
2131
|
-
onPhase?: (phase: "waiting_for_quiet" | "draining" | "drain_timeout", activity: ProxyRuntimeActivity | null) => void;
|
|
2132
|
-
now?: () => number;
|
|
2133
|
-
sleep?: (ms: number) => Promise<void>;
|
|
2134
|
-
};
|
|
2135
|
-
/** Result of validating a newly installed CLI through the stable trampoline. */
|
|
2136
|
-
export type InstalledVersionValidation = {
|
|
2137
|
-
version?: string;
|
|
2138
|
-
attempts: number;
|
|
2139
|
-
failure?: string;
|
|
2140
|
-
};
|
|
2141
|
-
/** Supported global package managers for proxy self-updates. */
|
|
2142
|
-
export type GlobalInstallerKind = "npm" | "pnpm";
|
|
2143
|
-
/** Result of probing one global package-manager executable. */
|
|
2144
|
-
export type GlobalInstallerProbe = {
|
|
2145
|
-
kind: GlobalInstallerKind;
|
|
2146
|
-
bin: string;
|
|
2147
|
-
version?: string;
|
|
2148
|
-
globalRoot?: string;
|
|
2149
|
-
globalBinDir?: string;
|
|
2150
|
-
working: boolean;
|
|
2151
|
-
installable: boolean;
|
|
2152
|
-
matchesCurrentInstall: boolean;
|
|
2153
|
-
reason?: string;
|
|
2154
|
-
};
|
|
2155
|
-
/** Selected package manager plus all candidates considered. */
|
|
2156
|
-
export type GlobalInstallerResolution = {
|
|
2157
|
-
installer?: GlobalInstallerProbe;
|
|
2158
|
-
tried: GlobalInstallerProbe[];
|
|
2159
|
-
};
|
|
2160
|
-
/** Injectable command runner used by global-installer tests. */
|
|
2161
|
-
export type GlobalInstallerExecFile = typeof import("node:child_process").execFileSync;
|
|
2162
|
-
/** Overrides used while resolving the global package manager. */
|
|
2163
|
-
export type ResolveGlobalInstallerOptions = {
|
|
2164
|
-
entryScript?: string;
|
|
2165
|
-
env?: NodeJS.ProcessEnv;
|
|
2166
|
-
homeDir?: string;
|
|
2167
|
-
execFileSync?: GlobalInstallerExecFile;
|
|
2168
|
-
};
|
|
2169
|
-
/** Options for validating a newly installed CLI through its stable executable. */
|
|
2170
|
-
export type ValidateInstalledVersionOptions = {
|
|
2171
|
-
binPath: string;
|
|
2172
|
-
expectedVersion: string;
|
|
2173
|
-
maxAttempts?: number;
|
|
2174
|
-
delayMs?: number;
|
|
2175
|
-
timeoutMs?: number;
|
|
2176
|
-
execFileSync?: GlobalInstallerExecFile;
|
|
2177
|
-
sleep?: (ms: number) => Promise<void>;
|
|
2178
|
-
};
|
|
2179
|
-
/** Dependencies and callbacks used to supervise the updater worker process. */
|
|
2180
|
-
export type UpdaterWorkerSupervisorOptions = {
|
|
2181
|
-
spawnWorker: () => number | undefined;
|
|
2182
|
-
isProcessRunning: (pid: number) => boolean;
|
|
2183
|
-
stopWorker: (pid: number) => void;
|
|
2184
|
-
onPidChange?: (pid: number | undefined) => void;
|
|
2185
|
-
log?: (message: string) => void;
|
|
2186
|
-
intervalMs?: number;
|
|
2187
|
-
};
|
|
2188
|
-
/** Handle used by the proxy process to inspect and stop updater supervision. */
|
|
2189
|
-
export type UpdaterWorkerSupervisor = {
|
|
2190
|
-
currentPid: () => number | undefined;
|
|
2191
|
-
checkNow: () => number | undefined;
|
|
2192
|
-
stop: () => void;
|
|
2193
|
-
};
|
|
2194
|
-
export type ProxyWorkerControlMessage = {
|
|
2195
|
-
type: "proxy-worker:activate";
|
|
2196
|
-
generation: number;
|
|
2197
|
-
} | {
|
|
2198
|
-
type: "proxy-worker:drain";
|
|
2199
|
-
generation: number;
|
|
2200
|
-
} | {
|
|
2201
|
-
type: "proxy-worker:shutdown";
|
|
2202
|
-
generation: number;
|
|
2203
|
-
} | {
|
|
2204
|
-
type: "proxy-worker:socket-commit";
|
|
2205
|
-
generation: number;
|
|
2206
|
-
socketId: string;
|
|
2207
|
-
} | {
|
|
2208
|
-
type: "proxy-worker:socket-cancel";
|
|
2209
|
-
generation: number;
|
|
2210
|
-
socketId: string;
|
|
2211
|
-
};
|
|
2212
|
-
export type ProxyWorkerStatusMessage = {
|
|
2213
|
-
type: "proxy-worker:ready";
|
|
2214
|
-
generation: number;
|
|
2215
|
-
pid: number;
|
|
2216
|
-
version: string;
|
|
2217
|
-
} | {
|
|
2218
|
-
type: "proxy-worker:drained";
|
|
2219
|
-
generation: number;
|
|
2220
|
-
pid: number;
|
|
2221
|
-
} | {
|
|
2222
|
-
type: "proxy-worker:activated";
|
|
2223
|
-
generation: number;
|
|
2224
|
-
pid: number;
|
|
2225
|
-
} | {
|
|
2226
|
-
type: "proxy-worker:fatal";
|
|
2227
|
-
generation: number;
|
|
2228
|
-
pid: number;
|
|
2229
|
-
message: string;
|
|
2230
|
-
} | {
|
|
2231
|
-
type: "proxy-worker:socket-accepted";
|
|
2232
|
-
generation: number;
|
|
2233
|
-
pid: number;
|
|
2234
|
-
socketId: string;
|
|
2235
|
-
} | {
|
|
2236
|
-
type: "proxy-worker:replacement-requested";
|
|
2237
|
-
generation: number;
|
|
2238
|
-
pid: number;
|
|
2239
|
-
reason: "environment";
|
|
2240
|
-
};
|
|
2241
|
-
export type ProxyWorkerSocketMessage = {
|
|
2242
|
-
type: "proxy-worker:socket";
|
|
2243
|
-
generation: number;
|
|
2244
|
-
socketId: string;
|
|
2245
|
-
};
|
|
2246
|
-
export type ProxyWorkerIpcMessage = ProxyWorkerControlMessage | ProxyWorkerStatusMessage | ProxyWorkerSocketMessage;
|
|
2247
|
-
export type TransferableProxySocket = Pick<import("node:net").Socket, "destroy" | "end" | "pause" | "resume" | "once">;
|
|
2248
|
-
/** A transferred socket whose temporary handoff listeners can be detached. */
|
|
2249
|
-
export type DetachableTransferableProxySocket = TransferableProxySocket & Pick<import("node:net").Socket, "off">;
|
|
2250
|
-
export type RollingWorkerHandle = {
|
|
2251
|
-
pid: number;
|
|
2252
|
-
sendControl: (message: ProxyWorkerControlMessage) => void;
|
|
2253
|
-
sendSocket: (generation: number, socket: TransferableProxySocket, callback: (error?: Error | null) => void) => void;
|
|
2254
|
-
terminate: (signal?: NodeJS.Signals) => void;
|
|
2255
|
-
onMessage: (listener: (message: ProxyWorkerStatusMessage) => void) => () => void;
|
|
2256
|
-
onExit: (listener: (code: number | null, signal: string | null) => void) => () => void;
|
|
2257
|
-
};
|
|
2258
|
-
export type SpawnProxySocketWorkerOptions = {
|
|
2259
|
-
generation: number;
|
|
2260
|
-
expectedVersion: string;
|
|
2261
|
-
command: string;
|
|
2262
|
-
args: string[];
|
|
2263
|
-
env?: NodeJS.ProcessEnv;
|
|
2264
|
-
stdout?: "inherit" | "ignore";
|
|
2265
|
-
stderr?: "inherit" | "ignore";
|
|
2266
|
-
socketAckTimeoutMs?: number;
|
|
2267
|
-
};
|
|
2268
|
-
export type RollingWorkerFailureDetails = {
|
|
2269
|
-
workerPid?: number;
|
|
2270
|
-
workerExitCode?: number | null;
|
|
2271
|
-
workerExitSignal?: string | null;
|
|
2272
|
-
supervisorAction?: "none" | "sigkill_after_transfer_failure";
|
|
2273
|
-
};
|
|
2274
|
-
export type RollingWorkerSupervisorEvent = {
|
|
2275
|
-
at: string;
|
|
2276
|
-
type: "activated" | "failure" | "failed_transfer" | "rejected_socket";
|
|
2277
|
-
generation: number | null;
|
|
2278
|
-
version: string | null;
|
|
2279
|
-
phase?: "startup" | "activation" | "runtime" | "transfer";
|
|
2280
|
-
reason?: string;
|
|
2281
|
-
};
|
|
2282
|
-
export type RollingWorkerSupervisorSnapshot = {
|
|
2283
|
-
generation: number;
|
|
2284
|
-
active: {
|
|
2285
|
-
pid: number;
|
|
2286
|
-
version: string;
|
|
2287
|
-
generation: number;
|
|
2288
|
-
} | null;
|
|
2289
|
-
candidate: {
|
|
2290
|
-
pid: number;
|
|
2291
|
-
expectedVersion: string;
|
|
2292
|
-
generation: number;
|
|
2293
|
-
} | null;
|
|
2294
|
-
draining: Array<{
|
|
2295
|
-
pid: number;
|
|
2296
|
-
version: string;
|
|
2297
|
-
generation: number;
|
|
2298
|
-
}>;
|
|
2299
|
-
queuedSockets: number;
|
|
2300
|
-
rejectedSockets: number;
|
|
2301
|
-
failedTransfers: number;
|
|
2302
|
-
/** Bounded generation-scoped evidence for attributing lifetime counters. */
|
|
2303
|
-
recentEvents: RollingWorkerSupervisorEvent[];
|
|
2304
|
-
lastFailure: ({
|
|
2305
|
-
at: string;
|
|
2306
|
-
generation: number;
|
|
2307
|
-
version: string;
|
|
2308
|
-
phase: "startup" | "activation" | "runtime" | "transfer";
|
|
2309
|
-
message: string;
|
|
2310
|
-
} & RollingWorkerFailureDetails) | null;
|
|
2311
|
-
};
|
|
2312
|
-
export type RollingWorkerSupervisorOptions = {
|
|
2313
|
-
spawnWorker: (generation: number, expectedVersion: string) => RollingWorkerHandle;
|
|
2314
|
-
readyTimeoutMs?: number;
|
|
2315
|
-
socketQueueLimit?: number;
|
|
2316
|
-
socketQueueTimeoutMs?: number;
|
|
2317
|
-
shutdownTimeoutMs?: number;
|
|
2318
|
-
onStateChange?: (snapshot: RollingWorkerSupervisorSnapshot) => void;
|
|
2319
|
-
onReplacementRequested?: (request: {
|
|
2320
|
-
generation: number;
|
|
2321
|
-
pid: number;
|
|
2322
|
-
reason: "environment";
|
|
2323
|
-
}) => void;
|
|
2324
|
-
log?: (message: string) => void;
|
|
2325
|
-
};
|
|
2326
|
-
export type RollingProxyServerOptions = {
|
|
2327
|
-
host: string;
|
|
2328
|
-
port: number;
|
|
2329
|
-
initialVersion: string;
|
|
2330
|
-
spawnWorker: (generation: number, expectedVersion: string) => RollingWorkerHandle;
|
|
2331
|
-
readyTimeoutMs?: number;
|
|
2332
|
-
socketQueueLimit?: number;
|
|
2333
|
-
socketQueueTimeoutMs?: number;
|
|
2334
|
-
shutdownTimeoutMs?: number;
|
|
2335
|
-
recoveryDelayMs?: number;
|
|
2336
|
-
maxRecoveryDelayMs?: number;
|
|
2337
|
-
onStateChange?: (snapshot: RollingWorkerSupervisorSnapshot) => void;
|
|
2338
|
-
log?: (message: string) => void;
|
|
2339
|
-
};
|
|
2340
|
-
export type RollingProxyServer = {
|
|
2341
|
-
address: {
|
|
2342
|
-
host: string;
|
|
2343
|
-
port: number;
|
|
2344
|
-
};
|
|
2345
|
-
replace: (expectedVersion: string) => Promise<RollingWorkerSupervisorSnapshot>;
|
|
2346
|
-
snapshot: () => RollingWorkerSupervisorSnapshot;
|
|
2347
|
-
close: () => Promise<void>;
|
|
2348
|
-
};
|
|
2349
|
-
export type RollingManagedWorker = {
|
|
2350
|
-
handle: RollingWorkerHandle;
|
|
2351
|
-
generation: number;
|
|
2352
|
-
version: string;
|
|
2353
|
-
dispose: () => void;
|
|
2354
|
-
pendingTransfers: number;
|
|
2355
|
-
drainRequested: boolean;
|
|
2356
|
-
};
|
|
2357
|
-
export type RollingCandidateWorker = RollingManagedWorker & {
|
|
2358
|
-
expectedVersion: string;
|
|
2359
|
-
activationRequested: boolean;
|
|
2360
|
-
settle: (error?: Error) => void;
|
|
2361
|
-
};
|
|
2362
|
-
export type RollingQueuedSocket = {
|
|
2363
|
-
socket: TransferableProxySocket;
|
|
2364
|
-
timeout: NodeJS.Timeout;
|
|
2365
|
-
};
|
|
2366
|
-
export type SocketWorkerRuntime = {
|
|
2367
|
-
acceptSocket: (socket: TransferableProxySocket) => void;
|
|
2368
|
-
drain: () => void;
|
|
2369
|
-
close: () => void;
|
|
2370
|
-
snapshot: () => {
|
|
2371
|
-
draining: boolean;
|
|
2372
|
-
sockets: number;
|
|
2373
|
-
activeRequests: number;
|
|
2374
|
-
drained: boolean;
|
|
2375
|
-
};
|
|
2376
|
-
};
|
|
2377
|
-
export type SocketWorkerRuntimeOptions = {
|
|
2378
|
-
onDrained?: () => void;
|
|
2379
|
-
};
|
|
2380
|
-
/** Shape of the dynamically-imported js-yaml module. `dump` is optional —
|
|
2381
|
-
* read-only consumers (proxy config loader) only need `load`; writers
|
|
2382
|
-
* (CLI primary-account commands) check `dump` before calling. */
|
|
2383
|
-
export type YamlModule = {
|
|
2384
|
-
load(content: string): unknown;
|
|
2385
|
-
dump?: (obj: unknown, opts?: Record<string, unknown>) => string;
|
|
2386
|
-
default?: {
|
|
2387
|
-
load(content: string): unknown;
|
|
2388
|
-
dump?: (obj: unknown, opts?: Record<string, unknown>) => string;
|
|
2389
|
-
};
|
|
2390
|
-
};
|
|
2391
|
-
/** Snapshot of a parsed proxy config file used by CLI primary-account
|
|
2392
|
-
* read/edit/write helpers. Tracks the original format and whether comments
|
|
2393
|
-
* were present (so the CLI can warn that comments will not round-trip). */
|
|
2394
|
-
export type CliProxyConfigDoc = {
|
|
2395
|
-
data: Record<string, unknown>;
|
|
2396
|
-
format: "yaml" | "json";
|
|
2397
|
-
hadComments: boolean;
|
|
2398
|
-
};
|
|
2399
|
-
/** Primary-account info exposed by the proxy `/status` endpoint.
|
|
2400
|
-
* `source` is "configured" when the operator's `routing.primaryAccount` is
|
|
2401
|
-
* authenticated and enabled, otherwise "fallback" — either no primary set
|
|
2402
|
-
* or the configured one is missing/disabled. */
|
|
2403
|
-
export type ProxyStatusPrimaryAccount = {
|
|
2404
|
-
configured: string | null;
|
|
2405
|
-
key: string | null;
|
|
2406
|
-
label: string | null;
|
|
2407
|
-
source: "configured" | "fallback";
|
|
2408
|
-
};
|
|
2409
|
-
/** Parsed fields captured from a Claude Code client request body. */
|
|
2410
|
-
export type ClaudeSnapshotBody = {
|
|
2411
|
-
metadataUserId?: string;
|
|
2412
|
-
billingHeader?: string;
|
|
2413
|
-
agentBlock?: string;
|
|
2414
|
-
sessionId?: string;
|
|
2415
|
-
};
|
|
2416
|
-
/** Snapshot of headers and body from a Claude Code request, used for polyfill. */
|
|
2417
|
-
export type ClaudeSnapshot = {
|
|
2418
|
-
accountKey: string;
|
|
2419
|
-
capturedAt: string;
|
|
2420
|
-
source: "claude-code";
|
|
2421
|
-
headers: Record<string, string>;
|
|
2422
|
-
body?: ClaudeSnapshotBody;
|
|
2423
|
-
};
|
|
2424
|
-
/** Parsed shape of a Claude API error body. */
|
|
2425
|
-
export type ParsedClaudeError = {
|
|
2426
|
-
errorType?: string;
|
|
2427
|
-
message?: string;
|
|
2428
|
-
/** `error.details.error_code`, e.g. "oauth_not_allowed_for_organization".
|
|
2429
|
-
* Absent on payloads that carry no details object. */
|
|
2430
|
-
errorCode?: string;
|
|
2431
|
-
};
|
|
2432
|
-
/**
|
|
2433
|
-
* Accounts rejected by an organization/plan entitlement policy during a single
|
|
2434
|
-
* request. Anthropic answers such an account with a `permission_error` that no
|
|
2435
|
-
* amount of retrying or token refreshing can fix, but which a *different*
|
|
2436
|
-
* account may not hit at all — so it drives rotation, and is reported to the
|
|
2437
|
-
* client only once every account has been tried.
|
|
2438
|
-
*/
|
|
2439
|
-
export type AnthropicEntitlementFailure = {
|
|
2440
|
-
status: number;
|
|
2441
|
-
/** Labels of every account that rejected this request on entitlement. */
|
|
2442
|
-
accounts: string[];
|
|
2443
|
-
/** Upstream message from the first such rejection. */
|
|
2444
|
-
message: string;
|
|
2445
|
-
errorCode?: string;
|
|
2446
|
-
};
|
|
2447
|
-
/**
|
|
2448
|
-
* Every account's model-scoped window for the requested model is spent. Unlike
|
|
2449
|
-
* a cooldown this is per-model: the same accounts stay healthy for every other
|
|
2450
|
-
* model, so the client is told to switch model rather than to back off.
|
|
2451
|
-
*/
|
|
2452
|
-
export type AnthropicScopedExhaustion = {
|
|
2453
|
-
/** Wire model id from the request. */
|
|
2454
|
-
model: string;
|
|
2455
|
-
/** Display name of the exhausted window, e.g. "Fable". */
|
|
2456
|
-
scopeModel: string;
|
|
2457
|
-
/** Epoch ms of the soonest reset across the exhausted accounts. */
|
|
2458
|
-
earliestResetMs: number;
|
|
2459
|
-
accounts: string[];
|
|
2460
|
-
/** Provider reason overage is unavailable, e.g. "org_level_disabled". */
|
|
2461
|
-
overageDisabledReason?: string;
|
|
2462
|
-
};
|
|
2463
|
-
/** ora spinner instance held by proxy CLI commands, nullable when --quiet. */
|
|
2464
|
-
export type ProxySpinner = Ora | null;
|
|
2465
|
-
/** Load-balancing strategy used by the proxy across accounts. */
|
|
2466
|
-
export type ProxyStartStrategy = "round-robin" | "fill-first";
|
|
2467
|
-
/** Alias for the model router's constructor configuration. */
|
|
2468
|
-
export type ProxyModelRouterConfig = ProxyRoutingConfig;
|
|
2469
|
-
/** Partial proxy config consumed by the start command. */
|
|
2470
|
-
export type LoadedProxyConfig = {
|
|
2471
|
-
routing?: Partial<ProxyModelRouterConfig> & {
|
|
2472
|
-
strategy?: ProxyStartStrategy;
|
|
2473
|
-
};
|
|
2474
|
-
};
|
|
2475
|
-
/** Routing values captured once when a proxy request begins. */
|
|
2476
|
-
export type ProxyRequestRoutingSnapshot = {
|
|
2477
|
-
generation: number;
|
|
2478
|
-
strategy: ProxyStartStrategy;
|
|
2479
|
-
modelRouter?: ModelRouterInterface;
|
|
2480
|
-
passthrough: boolean;
|
|
2481
|
-
primaryAccountKey?: string;
|
|
2482
|
-
accountAllowlist?: ReadonlySet<string>;
|
|
2483
|
-
quotaRoutingEnabled: boolean;
|
|
2484
|
-
sessionSoftLimit: number;
|
|
2485
|
-
sessionResetToleranceMs: number;
|
|
2486
|
-
/** Operator policy on spending paid extra usage once a subscription window is
|
|
2487
|
-
* spent. Only "never" can override the provider's own signal. */
|
|
2488
|
-
useOverage: ProxyOveragePolicy;
|
|
2489
|
-
};
|
|
2490
|
-
/** Operator policy for paid extra usage. */
|
|
2491
|
-
export type ProxyOveragePolicy = "auto" | "always" | "never";
|
|
2492
|
-
/** Immutable last-known-good proxy configuration published at runtime. */
|
|
2493
|
-
export type ProxyRuntimeConfigSnapshot = ProxyRequestRoutingSnapshot & {
|
|
2494
|
-
loadedAt: string;
|
|
2495
|
-
configHash: string;
|
|
2496
|
-
proxyConfig: LoadedProxyConfig | null;
|
|
2497
|
-
};
|
|
2498
|
-
/** Source that requested a runtime configuration reload. */
|
|
2499
|
-
export type ProxyRuntimeConfigReloadSource = "startup" | "watch" | "sighup" | "manual";
|
|
2500
|
-
/** Result returned after a serialized runtime configuration reload attempt. */
|
|
2501
|
-
export type ProxyRuntimeConfigReloadResult = {
|
|
2502
|
-
applied: boolean;
|
|
2503
|
-
changed: boolean;
|
|
2504
|
-
generation: number;
|
|
2505
|
-
environmentChanged?: boolean;
|
|
2506
|
-
error?: string;
|
|
2507
|
-
};
|
|
2508
|
-
/** Safe runtime configuration diagnostics exposed through proxy status. */
|
|
2509
|
-
export type ProxyRuntimeConfigStatus = {
|
|
2510
|
-
configPath: string;
|
|
2511
|
-
envFilePath?: string;
|
|
2512
|
-
generation: number;
|
|
2513
|
-
loadedAt: string;
|
|
2514
|
-
configHash: string;
|
|
2515
|
-
watching: boolean;
|
|
2516
|
-
lastReloadAttemptAt?: string;
|
|
2517
|
-
lastReloadAt?: string;
|
|
2518
|
-
lastReloadSource?: ProxyRuntimeConfigReloadSource;
|
|
2519
|
-
lastReloadError?: string;
|
|
2520
|
-
consecutiveFailures: number;
|
|
2521
|
-
};
|
|
2522
|
-
/** Constructor options for the proxy runtime configuration store. */
|
|
2523
|
-
export type ProxyRuntimeConfigStoreOptions = {
|
|
2524
|
-
configPath: string;
|
|
2525
|
-
configRequired: boolean;
|
|
2526
|
-
envFilePath?: string;
|
|
2527
|
-
envFileRequired?: boolean;
|
|
2528
|
-
baseEnv: Record<string, string | undefined>;
|
|
2529
|
-
strategyOverride?: ProxyStartStrategy;
|
|
2530
|
-
passthrough: boolean;
|
|
2531
|
-
watchIntervalMs?: number;
|
|
2532
|
-
watchDebounceMs?: number;
|
|
2533
|
-
};
|
|
2534
|
-
/** Runtime configuration provider captured by route factories. */
|
|
2535
|
-
export type ProxyRuntimeConfigProvider = () => ProxyRequestRoutingSnapshot;
|
|
2536
|
-
/** Optional runtime configuration wiring for Claude proxy route factories. */
|
|
2537
|
-
export type ClaudeProxyRouteRuntimeOptions = {
|
|
2538
|
-
accountAllowlist?: AccountAllowlist;
|
|
2539
|
-
runtimeConfigProvider: ProxyRuntimeConfigProvider;
|
|
2540
|
-
};
|
|
2541
|
-
/** Listener invoked after a new configuration generation is published. */
|
|
2542
|
-
export type ProxyRuntimeConfigListener = (snapshot: ProxyRuntimeConfigSnapshot) => void;
|
|
2543
|
-
/** Listener invoked after every successful or rejected reload attempt. */
|
|
2544
|
-
export type ProxyRuntimeConfigReloadListener = (result: ProxyRuntimeConfigReloadResult, status: ProxyRuntimeConfigStatus) => void;
|
|
2545
|
-
/**
|
|
2546
|
-
* Handle for a NeuroLink runtime created by the proxy start command.
|
|
2547
|
-
* The `neurolink` field is typed structurally (only the method used by the
|
|
2548
|
-
* proxy layer is exposed) so types/proxy.ts does not depend on the full
|
|
2549
|
-
* NeuroLink class.
|
|
2550
|
-
*/
|
|
2551
|
-
export type ProxyNeurolinkRuntime = {
|
|
2552
|
-
neurolink: {
|
|
2553
|
-
getToolRegistry(): MCPToolRegistry;
|
|
2554
|
-
};
|
|
2555
|
-
logsDir: string;
|
|
2556
|
-
};
|
|
2557
|
-
/** Data passed to the isolated proxy log-retention worker. */
|
|
2558
|
-
export type ProxyLogCleanupWorkerData = {
|
|
2559
|
-
logsDir: string;
|
|
2560
|
-
maxAgeDays: number;
|
|
2561
|
-
maxSizeMb: number;
|
|
2562
|
-
};
|
|
2563
|
-
/** Lifecycle handle for non-blocking proxy log retention. */
|
|
2564
|
-
export type ProxyLogCleanupScheduler = {
|
|
2565
|
-
trigger: () => boolean;
|
|
2566
|
-
stop: () => Promise<void>;
|
|
2567
|
-
};
|
|
2568
|
-
/** Hono app + readiness state created by the proxy start command. */
|
|
2569
|
-
export type ProxyStartApp = {
|
|
2570
|
-
app: Hono;
|
|
2571
|
-
readiness: ProxyReadinessState;
|
|
2572
|
-
};
|
|
2573
|
-
/** Stats shape consumed by the proxy status printer. */
|
|
2574
|
-
export type StatusStats = {
|
|
2575
|
-
startedAt?: number;
|
|
2576
|
-
totalAttempts?: number;
|
|
2577
|
-
totalAttemptErrors?: number;
|
|
2578
|
-
totalRequests: number;
|
|
2579
|
-
totalSuccess: number;
|
|
2580
|
-
totalErrors: number;
|
|
2581
|
-
totalRateLimits: number;
|
|
2582
|
-
totalTransientRateLimits?: number;
|
|
2583
|
-
totalQuotaRateLimits?: number;
|
|
2584
|
-
terminalErrors?: ProxyTerminalErrorJournal;
|
|
2585
|
-
lastTerminalError?: ProxyTerminalErrorSummary | null;
|
|
2586
|
-
terminalErrorDetailsComparable?: boolean;
|
|
2587
|
-
terminalErrorDetailsMissing?: number;
|
|
2588
|
-
terminalErrorDetailsExcess?: number;
|
|
2589
|
-
/** Whether this status response reconciled shared state or used local memory. */
|
|
2590
|
-
snapshotSource?: "reconciled" | "memory";
|
|
2591
|
-
accounts?: {
|
|
2592
|
-
label: string;
|
|
2593
|
-
type: string;
|
|
2594
|
-
attempts?: number;
|
|
2595
|
-
requests?: number;
|
|
2596
|
-
success?: number;
|
|
2597
|
-
errors?: number;
|
|
2598
|
-
attemptErrors?: number;
|
|
2599
|
-
rateLimits?: number;
|
|
2600
|
-
transientRateLimits?: number;
|
|
2601
|
-
quotaRateLimits?: number;
|
|
2602
|
-
cooling: boolean;
|
|
2603
|
-
allowed?: boolean;
|
|
2604
|
-
expired?: boolean;
|
|
2605
|
-
status?: "active" | "cooling" | "disabled" | "expired" | "excluded" | "removed" | "internal" | "unattributed";
|
|
2606
|
-
}[];
|
|
2607
|
-
persistence?: ProxyStatsPersistenceStatus;
|
|
2608
|
-
};
|
|
2609
|
-
/** Sub-action of the `proxy telemetry` CLI command. */
|
|
2610
|
-
export type ProxyTelemetryAction = "setup" | "start" | "stop" | "status" | "logs" | "import-dashboard";
|
|
2611
|
-
/** Wire format a proxy request is using. */
|
|
2612
|
-
export type ProxyFormat = "claude" | "openai";
|
|
2613
|
-
/**
|
|
2614
|
-
* Common adapter interface that hides the differences between
|
|
2615
|
-
* Claude and OpenAI stream serializers from the unified translation engine.
|
|
2616
|
-
*/
|
|
2617
|
-
export type StreamSerializerAdapter = {
|
|
2618
|
-
start(): Iterable<string>;
|
|
2619
|
-
pushDelta(text: string): Iterable<string>;
|
|
2620
|
-
pushToolUse(id: string, name: string, input: unknown): Iterable<string>;
|
|
2621
|
-
finish(finishReason: string, usage: {
|
|
2622
|
-
input: number;
|
|
2623
|
-
output: number;
|
|
2624
|
-
total: number;
|
|
2625
|
-
}): Iterable<string>;
|
|
2626
|
-
emitError(message: string): Iterable<string>;
|
|
2627
|
-
};
|
|
2628
|
-
/** OpenAI content part in a user message. */
|
|
2629
|
-
export type OpenAIContentPartText = {
|
|
2630
|
-
type: "text";
|
|
2631
|
-
text: string;
|
|
2632
|
-
};
|
|
2633
|
-
export type OpenAIContentPartImage = {
|
|
2634
|
-
type: "image_url";
|
|
2635
|
-
image_url: {
|
|
2636
|
-
url: string;
|
|
2637
|
-
detail?: "auto" | "low" | "high";
|
|
2638
|
-
};
|
|
2639
|
-
};
|
|
2640
|
-
export type OpenAIContentPart = OpenAIContentPartText | OpenAIContentPartImage;
|
|
2641
|
-
/** OpenAI message types. */
|
|
2642
|
-
export type OpenAISystemMessage = {
|
|
2643
|
-
role: "system";
|
|
2644
|
-
content: string;
|
|
2645
|
-
};
|
|
2646
|
-
export type OpenAIUserMessage = {
|
|
2647
|
-
role: "user";
|
|
2648
|
-
content: string | OpenAIContentPart[];
|
|
2649
|
-
};
|
|
2650
|
-
export type OpenAIAssistantMessage = {
|
|
2651
|
-
role: "assistant";
|
|
2652
|
-
content?: string | null;
|
|
2653
|
-
tool_calls?: OpenAIToolCall[];
|
|
2654
|
-
};
|
|
2655
|
-
export type OpenAIToolMessage = {
|
|
2656
|
-
role: "tool";
|
|
2657
|
-
tool_call_id: string;
|
|
2658
|
-
content: string;
|
|
2659
|
-
};
|
|
2660
|
-
export type OpenAIMessage = OpenAISystemMessage | OpenAIUserMessage | OpenAIAssistantMessage | OpenAIToolMessage;
|
|
2661
|
-
/** OpenAI tool call (in assistant messages and responses). */
|
|
2662
|
-
export type OpenAIToolCall = {
|
|
2663
|
-
id: string;
|
|
2664
|
-
type: "function";
|
|
2665
|
-
function: {
|
|
2666
|
-
name: string;
|
|
2667
|
-
arguments: string;
|
|
2668
|
-
};
|
|
2669
|
-
};
|
|
2670
|
-
/** OpenAI tool definition. */
|
|
2671
|
-
export type OpenAIToolDef = {
|
|
2672
|
-
type: "function";
|
|
2673
|
-
function: {
|
|
2674
|
-
name: string;
|
|
2675
|
-
description?: string;
|
|
2676
|
-
parameters: Record<string, unknown>;
|
|
2677
|
-
};
|
|
2678
|
-
};
|
|
2679
|
-
/** OpenAI tool_choice options. */
|
|
2680
|
-
export type OpenAIToolChoice = "auto" | "required" | "none" | {
|
|
2681
|
-
type: "function";
|
|
2682
|
-
function: {
|
|
2683
|
-
name: string;
|
|
2684
|
-
};
|
|
2685
|
-
};
|
|
2686
|
-
/** OpenAI Chat Completions request body. */
|
|
2687
|
-
export type OpenAICompletionRequest = {
|
|
2688
|
-
model: string;
|
|
2689
|
-
messages: OpenAIMessage[];
|
|
2690
|
-
tools?: OpenAIToolDef[];
|
|
2691
|
-
tool_choice?: OpenAIToolChoice;
|
|
2692
|
-
stream?: boolean;
|
|
2693
|
-
temperature?: number;
|
|
2694
|
-
top_p?: number;
|
|
2695
|
-
max_tokens?: number;
|
|
2696
|
-
max_completion_tokens?: number;
|
|
2697
|
-
stop?: string | string[];
|
|
2698
|
-
n?: number;
|
|
2699
|
-
response_format?: {
|
|
2700
|
-
type: "text" | "json_object" | "json_schema";
|
|
2701
|
-
json_schema?: unknown;
|
|
2702
|
-
};
|
|
2703
|
-
stream_options?: {
|
|
2704
|
-
include_usage?: boolean;
|
|
2705
|
-
};
|
|
2706
|
-
};
|
|
2707
|
-
/** OpenAI usage counters. */
|
|
2708
|
-
export type OpenAIUsage = {
|
|
2709
|
-
prompt_tokens: number;
|
|
2710
|
-
completion_tokens: number;
|
|
2711
|
-
total_tokens: number;
|
|
2712
|
-
};
|
|
2713
|
-
/** OpenAI non-streaming response. */
|
|
2714
|
-
export type OpenAICompletionResponse = {
|
|
2715
|
-
id: string;
|
|
2716
|
-
object: "chat.completion";
|
|
2717
|
-
created: number;
|
|
2718
|
-
model: string;
|
|
2719
|
-
choices: Array<{
|
|
2720
|
-
index: number;
|
|
2721
|
-
message: {
|
|
2722
|
-
role: "assistant";
|
|
2723
|
-
content: string | null;
|
|
2724
|
-
tool_calls?: OpenAIToolCall[];
|
|
2725
|
-
};
|
|
2726
|
-
finish_reason: "stop" | "tool_calls" | "length" | "content_filter" | null;
|
|
2727
|
-
}>;
|
|
2728
|
-
usage: OpenAIUsage;
|
|
2729
|
-
};
|
|
2730
|
-
/** OpenAI streaming chunk. */
|
|
2731
|
-
export type OpenAIStreamChunk = {
|
|
2732
|
-
id: string;
|
|
2733
|
-
object: "chat.completion.chunk";
|
|
2734
|
-
created: number;
|
|
2735
|
-
model: string;
|
|
2736
|
-
choices: Array<{
|
|
2737
|
-
index: number;
|
|
2738
|
-
delta: {
|
|
2739
|
-
role?: "assistant";
|
|
2740
|
-
content?: string;
|
|
2741
|
-
tool_calls?: Array<{
|
|
2742
|
-
index: number;
|
|
2743
|
-
id?: string;
|
|
2744
|
-
type?: "function";
|
|
2745
|
-
function?: {
|
|
2746
|
-
name?: string;
|
|
2747
|
-
arguments?: string;
|
|
2748
|
-
};
|
|
2749
|
-
}>;
|
|
2750
|
-
};
|
|
2751
|
-
finish_reason: string | null;
|
|
2752
|
-
}>;
|
|
2753
|
-
usage?: OpenAIUsage;
|
|
2754
|
-
};
|
|
2755
|
-
/** OpenAI error response. */
|
|
2756
|
-
export type OpenAIErrorResponse = {
|
|
2757
|
-
error: {
|
|
2758
|
-
message: string;
|
|
2759
|
-
type: string;
|
|
2760
|
-
code: string | null;
|
|
2761
|
-
};
|
|
2762
|
-
};
|
|
2763
|
-
/** Parsed OpenAI request — intermediate form for NeuroLink pipeline. */
|
|
2764
|
-
export type ParsedOpenAIRequest = {
|
|
2765
|
-
model: string;
|
|
2766
|
-
maxTokens?: number;
|
|
2767
|
-
temperature?: number;
|
|
2768
|
-
topP?: number;
|
|
2769
|
-
systemPrompt?: string;
|
|
2770
|
-
stream: boolean;
|
|
2771
|
-
prompt: string;
|
|
2772
|
-
images: string[];
|
|
2773
|
-
conversationMessages: Array<{
|
|
2774
|
-
role: string;
|
|
2775
|
-
content: string;
|
|
2776
|
-
}>;
|
|
2777
|
-
tools: Record<string, {
|
|
2778
|
-
description?: string;
|
|
2779
|
-
inputSchema: unknown;
|
|
2780
|
-
execute?: (...args: unknown[]) => unknown;
|
|
2781
|
-
}>;
|
|
2782
|
-
toolChoice?: "auto" | "required" | "none";
|
|
2783
|
-
toolChoiceName?: string;
|
|
2784
|
-
stopSequences?: string[];
|
|
2785
|
-
responseFormat?: {
|
|
2786
|
-
type: string;
|
|
2787
|
-
jsonSchema?: unknown;
|
|
2788
|
-
};
|
|
2789
|
-
};
|