@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,1662 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Archive Processor
|
|
3
|
-
*
|
|
4
|
-
* Handles downloading, validating, and processing archive files (ZIP, TAR, TAR.GZ, GZ).
|
|
5
|
-
* Extracts file listings with metadata for AI consumption without recursively
|
|
6
|
-
* processing individual entries through other processors (Phase 1).
|
|
7
|
-
*
|
|
8
|
-
* Key features:
|
|
9
|
-
* - ZIP support via adm-zip (dynamic import)
|
|
10
|
-
* - TAR / TAR.GZ support via tar-stream (dynamic import)
|
|
11
|
-
* - Plain GZ support via Node zlib
|
|
12
|
-
* - Comprehensive security validation (path traversal, zip bombs, symlinks, encryption)
|
|
13
|
-
* - In-memory extraction with configurable size limits
|
|
14
|
-
* - Structured text output for LLM consumption
|
|
15
|
-
*
|
|
16
|
-
* @module processors/archive/ArchiveProcessor
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* ```typescript
|
|
20
|
-
* import { archiveProcessor, processArchive, isArchiveFile } from "./ArchiveProcessor.js";
|
|
21
|
-
*
|
|
22
|
-
* // Check if a file is an archive
|
|
23
|
-
* if (isArchiveFile(fileInfo.mimetype, fileInfo.name)) {
|
|
24
|
-
* const result = await processArchive(fileInfo, {
|
|
25
|
-
* authHeaders: { Authorization: "Bearer token" },
|
|
26
|
-
* });
|
|
27
|
-
*
|
|
28
|
-
* if (result.success) {
|
|
29
|
-
* console.log(`Format: ${result.data.archiveMetadata.format}`);
|
|
30
|
-
* console.log(`Entries: ${result.data.archiveMetadata.totalEntries}`);
|
|
31
|
-
* for (const entry of result.data.entries) {
|
|
32
|
-
* console.log(` ${entry.name} (${entry.uncompressedSize} bytes)`);
|
|
33
|
-
* }
|
|
34
|
-
* }
|
|
35
|
-
* }
|
|
36
|
-
* ```
|
|
37
|
-
*/
|
|
38
|
-
import * as path from "path";
|
|
39
|
-
import { BaseFileProcessor } from "../base/BaseFileProcessor.js";
|
|
40
|
-
import { isDecompressionBoundExceeded, readZipEntryWithinLimit, } from "./zipEntryReader.js";
|
|
41
|
-
import { SIZE_LIMITS_MB } from "../config/index.js";
|
|
42
|
-
import { FileErrorCode } from "../errors/index.js";
|
|
43
|
-
// =============================================================================
|
|
44
|
-
// SECURITY CONFIGURATION
|
|
45
|
-
// =============================================================================
|
|
46
|
-
/**
|
|
47
|
-
* Security limits for archive processing.
|
|
48
|
-
* These values are intentionally conservative to prevent resource exhaustion
|
|
49
|
-
* and common archive-based attacks (zip bombs, path traversal, etc.).
|
|
50
|
-
*/
|
|
51
|
-
const ARCHIVE_SECURITY = {
|
|
52
|
-
/** Maximum number of entries allowed in a single archive */
|
|
53
|
-
MAX_ENTRIES: 1000,
|
|
54
|
-
/** Maximum total decompressed size allowed (100 MB) */
|
|
55
|
-
MAX_DECOMPRESSED_SIZE: 100 * 1024 * 1024,
|
|
56
|
-
/** Maximum size of any single file within the archive (20 MB) */
|
|
57
|
-
MAX_SINGLE_FILE_SIZE: 20 * 1024 * 1024,
|
|
58
|
-
/** Maximum compression ratio before flagging as potential zip bomb */
|
|
59
|
-
MAX_COMPRESSION_RATIO: 100,
|
|
60
|
-
/**
|
|
61
|
-
* Maximum archive nesting depth.
|
|
62
|
-
* Phase 1 only lists contents (no recursive extraction), so depth is 1.
|
|
63
|
-
*/
|
|
64
|
-
MAX_NESTING_DEPTH: 1,
|
|
65
|
-
/** Maximum path length for any entry name */
|
|
66
|
-
MAX_PATH_LENGTH: 255,
|
|
67
|
-
/** Whether to allow encrypted archive entries */
|
|
68
|
-
ALLOW_ENCRYPTED: false,
|
|
69
|
-
/** Whether to allow symbolic link entries */
|
|
70
|
-
ALLOW_SYMLINKS: false,
|
|
71
|
-
};
|
|
72
|
-
/**
|
|
73
|
-
* Archive processor configuration constants.
|
|
74
|
-
*/
|
|
75
|
-
const ARCHIVE_CONFIG = {
|
|
76
|
-
/** Maximum archive file size in MB (uses centralized constant from sizeLimits) */
|
|
77
|
-
MAX_SIZE_MB: SIZE_LIMITS_MB.ARCHIVE_MAX_MB,
|
|
78
|
-
/** Processing timeout in milliseconds (60 seconds) */
|
|
79
|
-
TIMEOUT_MS: 60_000,
|
|
80
|
-
/** Maximum number of entries to extract content from (Phase 2 sub-processing) */
|
|
81
|
-
MAX_EXTRACT_ENTRIES: 20,
|
|
82
|
-
/** Maximum size of a single entry to extract for content processing (1 MB) */
|
|
83
|
-
MAX_EXTRACT_ENTRY_SIZE: 1 * 1024 * 1024,
|
|
84
|
-
/** Maximum total extracted content size across all entries (5 MB) */
|
|
85
|
-
MAX_TOTAL_EXTRACT_SIZE: 5 * 1024 * 1024,
|
|
86
|
-
/** File extensions eligible for content extraction inside archives */
|
|
87
|
-
EXTRACTABLE_EXTENSIONS: new Set([
|
|
88
|
-
".ts",
|
|
89
|
-
".js",
|
|
90
|
-
".tsx",
|
|
91
|
-
".jsx",
|
|
92
|
-
".py",
|
|
93
|
-
".java",
|
|
94
|
-
".go",
|
|
95
|
-
".rs",
|
|
96
|
-
".rb",
|
|
97
|
-
".php",
|
|
98
|
-
".c",
|
|
99
|
-
".cpp",
|
|
100
|
-
".h",
|
|
101
|
-
".hpp",
|
|
102
|
-
".cs",
|
|
103
|
-
".swift",
|
|
104
|
-
".kt",
|
|
105
|
-
".scala",
|
|
106
|
-
".sh",
|
|
107
|
-
".bash",
|
|
108
|
-
".txt",
|
|
109
|
-
".md",
|
|
110
|
-
".json",
|
|
111
|
-
".yaml",
|
|
112
|
-
".yml",
|
|
113
|
-
".xml",
|
|
114
|
-
".html",
|
|
115
|
-
".css",
|
|
116
|
-
".sql",
|
|
117
|
-
".toml",
|
|
118
|
-
".ini",
|
|
119
|
-
".cfg",
|
|
120
|
-
".env",
|
|
121
|
-
".csv",
|
|
122
|
-
".log",
|
|
123
|
-
".conf",
|
|
124
|
-
".dockerfile",
|
|
125
|
-
".makefile",
|
|
126
|
-
".gitignore",
|
|
127
|
-
".editorconfig",
|
|
128
|
-
]),
|
|
129
|
-
};
|
|
130
|
-
// =============================================================================
|
|
131
|
-
// SUPPORTED FORMATS
|
|
132
|
-
// =============================================================================
|
|
133
|
-
/** MIME types recognized as archive formats */
|
|
134
|
-
const SUPPORTED_ARCHIVE_MIME_TYPES = [
|
|
135
|
-
"application/zip",
|
|
136
|
-
"application/x-zip-compressed",
|
|
137
|
-
"application/x-zip",
|
|
138
|
-
"application/x-tar",
|
|
139
|
-
"application/x-gtar",
|
|
140
|
-
"application/gzip",
|
|
141
|
-
"application/x-gzip",
|
|
142
|
-
"application/x-compressed-tar",
|
|
143
|
-
"application/x-bzip2",
|
|
144
|
-
// XZ and Zstandard, added alongside the extensions above: a caller that
|
|
145
|
-
// uploads bytes with a declared mimetype and no filename was rejected at the
|
|
146
|
-
// type gate for the two formats this change teaches the processor to read.
|
|
147
|
-
"application/x-xz",
|
|
148
|
-
"application/zstd",
|
|
149
|
-
"application/java-archive",
|
|
150
|
-
];
|
|
151
|
-
/**
|
|
152
|
-
* External decompressor per single-stream format.
|
|
153
|
-
*
|
|
154
|
-
* One map rather than a ternary repeated at each use: the decompressor and the
|
|
155
|
-
* error message that names it were derived separately, so they could disagree
|
|
156
|
-
* about which binary the user is being told to install.
|
|
157
|
-
*/
|
|
158
|
-
const SINGLE_STREAM_TOOLS = {
|
|
159
|
-
bz2: "bzip2",
|
|
160
|
-
xz: "xz",
|
|
161
|
-
zst: "zstd",
|
|
162
|
-
};
|
|
163
|
-
/** File extensions recognized as archive formats */
|
|
164
|
-
const SUPPORTED_ARCHIVE_EXTENSIONS = [".zip", ".tar", ".gz", ".tgz", ".bz2", ".tbz2", ".jar", ".xz", ".txz", ".zst", ".tzst"];
|
|
165
|
-
// =============================================================================
|
|
166
|
-
// MAGIC BYTE SIGNATURES
|
|
167
|
-
// =============================================================================
|
|
168
|
-
/**
|
|
169
|
-
* Magic byte signatures for archive format detection.
|
|
170
|
-
* Used alongside file extension for robust format identification.
|
|
171
|
-
*/
|
|
172
|
-
const MAGIC_BYTES = {
|
|
173
|
-
/** ZIP/JAR: PK\x03\x04 */
|
|
174
|
-
ZIP: [0x50, 0x4b, 0x03, 0x04],
|
|
175
|
-
/** ZIP empty archive: PK\x05\x06 */
|
|
176
|
-
ZIP_EMPTY: [0x50, 0x4b, 0x05, 0x06],
|
|
177
|
-
/** ZIP spanned: PK\x07\x08 */
|
|
178
|
-
ZIP_SPANNED: [0x50, 0x4b, 0x07, 0x08],
|
|
179
|
-
/** GZIP: \x1f\x8b */
|
|
180
|
-
GZIP: [0x1f, 0x8b],
|
|
181
|
-
/**
|
|
182
|
-
* BZIP2: `BZh` — all three bytes, not just `BZ`.
|
|
183
|
-
*
|
|
184
|
-
* Two bytes was harmless while every BZIP2 match was rejected outright as an
|
|
185
|
-
* unsupported format. Now that a match actually spawns `bzip2`, any buffer
|
|
186
|
-
* beginning with the ASCII letters "BZ" is handed to the decompressor and
|
|
187
|
-
* comes back reported as a corrupt BZ2 stream — a confident wrong answer
|
|
188
|
-
* about a file that was never bzip2 at all.
|
|
189
|
-
*/
|
|
190
|
-
BZIP2: [0x42, 0x5a, 0x68],
|
|
191
|
-
/** XZ: \xfd7zXZ\x00 */
|
|
192
|
-
XZ: [0xfd, 0x37, 0x7a, 0x58, 0x5a, 0x00],
|
|
193
|
-
/** Zstandard frame: \x28\xb5\x2f\xfd */
|
|
194
|
-
ZSTD: [0x28, 0xb5, 0x2f, 0xfd],
|
|
195
|
-
/** RAR: Rar!\x1a\x07 */
|
|
196
|
-
RAR: [0x52, 0x61, 0x72, 0x21, 0x1a, 0x07],
|
|
197
|
-
/** 7-Zip: 7z\xbc\xaf\x27\x1c */
|
|
198
|
-
SEVEN_ZIP: [0x37, 0x7a, 0xbc, 0xaf, 0x27, 0x1c],
|
|
199
|
-
};
|
|
200
|
-
// =============================================================================
|
|
201
|
-
// ARCHIVE PROCESSOR CLASS
|
|
202
|
-
// =============================================================================
|
|
203
|
-
/**
|
|
204
|
-
* Archive Processor - handles ZIP, TAR, TAR.GZ, and plain GZ files.
|
|
205
|
-
*
|
|
206
|
-
* Overrides the base `processFile()` to implement a custom pipeline:
|
|
207
|
-
* 1. Validate file type and size
|
|
208
|
-
* 2. Obtain the archive buffer (from provided buffer or URL download)
|
|
209
|
-
* 3. Detect the archive format via magic bytes and file extension
|
|
210
|
-
* 4. Run security validation (path traversal, zip bombs, encryption, symlinks)
|
|
211
|
-
* 5. Extract entry metadata (no recursive file processing in Phase 1)
|
|
212
|
-
* 6. Build LLM-friendly text content with file listing
|
|
213
|
-
*
|
|
214
|
-
* RAR and 7z formats are detected but not yet supported for extraction.
|
|
215
|
-
*
|
|
216
|
-
* @example
|
|
217
|
-
* ```typescript
|
|
218
|
-
* const processor = new ArchiveProcessor();
|
|
219
|
-
*
|
|
220
|
-
* const result = await processor.processFile(fileInfo, {
|
|
221
|
-
* authHeaders: { Authorization: "Bearer token" },
|
|
222
|
-
* });
|
|
223
|
-
*
|
|
224
|
-
* if (result.success) {
|
|
225
|
-
* console.log(`Format: ${result.data.archiveMetadata.format}`);
|
|
226
|
-
* console.log(`Entries: ${result.data.entries.length}`);
|
|
227
|
-
* console.log(result.data.textContent);
|
|
228
|
-
* }
|
|
229
|
-
* ```
|
|
230
|
-
*/
|
|
231
|
-
export class ArchiveProcessor extends BaseFileProcessor {
|
|
232
|
-
constructor() {
|
|
233
|
-
super({
|
|
234
|
-
maxSizeMB: ARCHIVE_CONFIG.MAX_SIZE_MB,
|
|
235
|
-
timeoutMs: ARCHIVE_CONFIG.TIMEOUT_MS,
|
|
236
|
-
supportedMimeTypes: [...SUPPORTED_ARCHIVE_MIME_TYPES],
|
|
237
|
-
supportedExtensions: [...SUPPORTED_ARCHIVE_EXTENSIONS],
|
|
238
|
-
fileTypeName: "archive",
|
|
239
|
-
defaultFilename: "archive.zip",
|
|
240
|
-
});
|
|
241
|
-
}
|
|
242
|
-
// ===========================================================================
|
|
243
|
-
// ABSTRACT METHOD IMPLEMENTATION
|
|
244
|
-
// ===========================================================================
|
|
245
|
-
/**
|
|
246
|
-
* Build a stub processed result.
|
|
247
|
-
* The actual work is done in the `processFile()` override; this method
|
|
248
|
-
* satisfies the abstract contract from `BaseFileProcessor`.
|
|
249
|
-
*
|
|
250
|
-
* @param buffer - Raw archive buffer
|
|
251
|
-
* @param fileInfo - Original file information
|
|
252
|
-
* @returns Empty ProcessedArchive scaffold
|
|
253
|
-
*/
|
|
254
|
-
buildProcessedResult(buffer, fileInfo) {
|
|
255
|
-
return {
|
|
256
|
-
buffer,
|
|
257
|
-
mimetype: fileInfo.mimetype || "application/octet-stream",
|
|
258
|
-
size: buffer.length,
|
|
259
|
-
filename: this.getFilename(fileInfo),
|
|
260
|
-
textContent: "",
|
|
261
|
-
archiveMetadata: {
|
|
262
|
-
format: "zip",
|
|
263
|
-
totalEntries: 0,
|
|
264
|
-
totalUncompressedSize: 0,
|
|
265
|
-
totalCompressedSize: 0,
|
|
266
|
-
},
|
|
267
|
-
entries: [],
|
|
268
|
-
securityWarnings: [],
|
|
269
|
-
};
|
|
270
|
-
}
|
|
271
|
-
// ===========================================================================
|
|
272
|
-
// MAIN PROCESSING PIPELINE (override)
|
|
273
|
-
// ===========================================================================
|
|
274
|
-
/**
|
|
275
|
-
* Process an archive file through the full extraction pipeline.
|
|
276
|
-
*
|
|
277
|
-
* @param fileInfo - File information (can include URL or buffer)
|
|
278
|
-
* @param options - Optional processing options (auth headers, timeout, etc.)
|
|
279
|
-
* @returns Processing result with archive metadata and entry listing, or error
|
|
280
|
-
*/
|
|
281
|
-
async processFile(fileInfo, options) {
|
|
282
|
-
try {
|
|
283
|
-
// Step 1: Validate file type and size
|
|
284
|
-
const validationResult = this.validateFileWithResult(fileInfo);
|
|
285
|
-
if (!validationResult.success) {
|
|
286
|
-
return { success: false, error: validationResult.error };
|
|
287
|
-
}
|
|
288
|
-
// Step 2: Get file buffer
|
|
289
|
-
let buffer;
|
|
290
|
-
if (fileInfo.buffer) {
|
|
291
|
-
buffer = fileInfo.buffer;
|
|
292
|
-
}
|
|
293
|
-
else if (fileInfo.url) {
|
|
294
|
-
const downloadResult = await this.downloadFileWithRetry(fileInfo, options);
|
|
295
|
-
if (!downloadResult.success) {
|
|
296
|
-
return { success: false, error: downloadResult.error };
|
|
297
|
-
}
|
|
298
|
-
if (!downloadResult.data) {
|
|
299
|
-
return {
|
|
300
|
-
success: false,
|
|
301
|
-
error: this.createError(FileErrorCode.DOWNLOAD_FAILED, {
|
|
302
|
-
reason: "Download succeeded but returned no data",
|
|
303
|
-
}),
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
buffer = downloadResult.data;
|
|
307
|
-
// Validate actual downloaded size against limit
|
|
308
|
-
if (!this.validateFileSize(buffer.length)) {
|
|
309
|
-
return {
|
|
310
|
-
success: false,
|
|
311
|
-
error: this.createError(FileErrorCode.FILE_TOO_LARGE, {
|
|
312
|
-
sizeMB: (buffer.length / (1024 * 1024)).toFixed(2),
|
|
313
|
-
maxMB: this.config.maxSizeMB,
|
|
314
|
-
type: this.config.fileTypeName,
|
|
315
|
-
}),
|
|
316
|
-
};
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
else {
|
|
320
|
-
return {
|
|
321
|
-
success: false,
|
|
322
|
-
error: this.createError(FileErrorCode.DOWNLOAD_FAILED, {
|
|
323
|
-
reason: "No buffer or URL provided for file",
|
|
324
|
-
}),
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
// Step 3: Detect archive format
|
|
328
|
-
const filename = this.getFilename(fileInfo);
|
|
329
|
-
const format = this.detectArchiveFormat(buffer, filename);
|
|
330
|
-
if (!format) {
|
|
331
|
-
return {
|
|
332
|
-
success: false,
|
|
333
|
-
error: this.createError(FileErrorCode.INVALID_FORMAT, {
|
|
334
|
-
reason: "Unable to detect archive format from magic bytes or file extension",
|
|
335
|
-
}),
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
// Step 4: Check for unsupported formats (RAR, 7z)
|
|
339
|
-
if (format === "rar" || format === "7z") {
|
|
340
|
-
return {
|
|
341
|
-
success: false,
|
|
342
|
-
error: this.createError(FileErrorCode.UNSUPPORTED_TYPE, {
|
|
343
|
-
format,
|
|
344
|
-
reason: `${format.toUpperCase()} archives are not yet supported. Please convert to ZIP or TAR format.`,
|
|
345
|
-
supportedFormats: "ZIP, TAR, TAR.GZ, TAR.BZ2, GZ, BZ2, XZ, ZST, JAR",
|
|
346
|
-
}),
|
|
347
|
-
};
|
|
348
|
-
}
|
|
349
|
-
// Step 5: Extract entries based on format
|
|
350
|
-
const extractionResult = await this.extractEntries(buffer, format);
|
|
351
|
-
if (!extractionResult.success) {
|
|
352
|
-
return {
|
|
353
|
-
success: false,
|
|
354
|
-
error: extractionResult.error,
|
|
355
|
-
};
|
|
356
|
-
}
|
|
357
|
-
const { entries, securityWarnings } = extractionResult;
|
|
358
|
-
// Step 6: Compute aggregate metadata
|
|
359
|
-
const totalUncompressedSize = entries.reduce((sum, e) => sum + e.uncompressedSize, 0);
|
|
360
|
-
const totalCompressedSize = entries.reduce((sum, e) => sum + e.compressedSize, 0);
|
|
361
|
-
// Step 7: Security check - overall compression ratio
|
|
362
|
-
if (buffer.length > 0 && totalUncompressedSize > 0) {
|
|
363
|
-
const overallRatio = totalUncompressedSize / buffer.length;
|
|
364
|
-
if (overallRatio > ARCHIVE_SECURITY.MAX_COMPRESSION_RATIO) {
|
|
365
|
-
return {
|
|
366
|
-
success: false,
|
|
367
|
-
error: this.createError(FileErrorCode.ZIP_BOMB_DETECTED, {
|
|
368
|
-
compressionRatio: overallRatio.toFixed(1),
|
|
369
|
-
maxRatio: ARCHIVE_SECURITY.MAX_COMPRESSION_RATIO,
|
|
370
|
-
}),
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
// Step 8: Security check - total decompressed size
|
|
375
|
-
if (totalUncompressedSize > ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE) {
|
|
376
|
-
return {
|
|
377
|
-
success: false,
|
|
378
|
-
error: this.createError(FileErrorCode.SECURITY_VALIDATION_FAILED, {
|
|
379
|
-
reason: `Total decompressed size (${this.formatSizeMB(totalUncompressedSize)} MB) exceeds limit (${this.formatSizeMB(ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE)} MB)`,
|
|
380
|
-
}),
|
|
381
|
-
};
|
|
382
|
-
}
|
|
383
|
-
// Step 9: Extract content from text-based entries (Phase 2 sub-processing)
|
|
384
|
-
// For ZIP archives, extract and include content from small text-based files.
|
|
385
|
-
// Skips nested archives and binary files for safety.
|
|
386
|
-
// ZIP re-parses to pull member text; every other format collects it while
|
|
387
|
-
// decompressing, because their bytes stream past exactly once.
|
|
388
|
-
let extractedContents = extractionResult.contents ?? new Map();
|
|
389
|
-
if (format === "zip") {
|
|
390
|
-
extractedContents = await this.extractEntryContents(buffer, entries);
|
|
391
|
-
}
|
|
392
|
-
// Step 10: Build text content for LLM
|
|
393
|
-
const archiveMetadata = {
|
|
394
|
-
format,
|
|
395
|
-
totalEntries: entries.length,
|
|
396
|
-
totalUncompressedSize,
|
|
397
|
-
totalCompressedSize,
|
|
398
|
-
};
|
|
399
|
-
const textContent = this.buildTextContent(filename, archiveMetadata, entries, securityWarnings, extractedContents);
|
|
400
|
-
// Step 10: Build final result
|
|
401
|
-
return {
|
|
402
|
-
success: true,
|
|
403
|
-
data: {
|
|
404
|
-
buffer,
|
|
405
|
-
mimetype: fileInfo.mimetype || "application/octet-stream",
|
|
406
|
-
size: buffer.length,
|
|
407
|
-
filename,
|
|
408
|
-
textContent,
|
|
409
|
-
archiveMetadata,
|
|
410
|
-
entries,
|
|
411
|
-
securityWarnings,
|
|
412
|
-
},
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
catch (error) {
|
|
416
|
-
return {
|
|
417
|
-
success: false,
|
|
418
|
-
error: this.createError(FileErrorCode.PROCESSING_FAILED, {
|
|
419
|
-
fileType: "archive",
|
|
420
|
-
error: error instanceof Error ? error.message : String(error),
|
|
421
|
-
}, error instanceof Error ? error : undefined),
|
|
422
|
-
};
|
|
423
|
-
}
|
|
424
|
-
}
|
|
425
|
-
// ===========================================================================
|
|
426
|
-
// FORMAT DETECTION
|
|
427
|
-
// ===========================================================================
|
|
428
|
-
/**
|
|
429
|
-
* Detect the archive format using magic bytes and file extension.
|
|
430
|
-
* Magic bytes take precedence over extension when available.
|
|
431
|
-
*
|
|
432
|
-
* @param buffer - Raw archive buffer
|
|
433
|
-
* @param filename - Original filename for extension-based fallback
|
|
434
|
-
* @returns Detected archive format, or null if unrecognized
|
|
435
|
-
*/
|
|
436
|
-
detectArchiveFormat(buffer, filename) {
|
|
437
|
-
// Try magic bytes first (most reliable)
|
|
438
|
-
const magicFormat = this.detectFormatFromMagicBytes(buffer);
|
|
439
|
-
if (magicFormat) {
|
|
440
|
-
// For GZIP, check if it wraps a TAR archive
|
|
441
|
-
if (magicFormat === "gz") {
|
|
442
|
-
const ext = filename.toLowerCase();
|
|
443
|
-
if (ext.endsWith(".tar.gz") || ext.endsWith(".tgz") || ext.endsWith(".tbz2")) {
|
|
444
|
-
return "tar.gz";
|
|
445
|
-
}
|
|
446
|
-
// Could still be a tar.gz without the extension - we'll detect during extraction
|
|
447
|
-
return "gz";
|
|
448
|
-
}
|
|
449
|
-
// Bzip2 wraps a tar just as often, and now that a BZIP2 magic match
|
|
450
|
-
// resolves to a real format rather than being rejected outright, the
|
|
451
|
-
// same filename check has to run here too. Without it every genuine
|
|
452
|
-
// `.tar.bz2` reported its format as "BZ2" to the model — extraction was
|
|
453
|
-
// right, the label was not — and the `.tar.bz2` extension mapping below
|
|
454
|
-
// became unreachable for any well-formed file.
|
|
455
|
-
if (magicFormat === "bz2") {
|
|
456
|
-
const ext = filename.toLowerCase();
|
|
457
|
-
return ext.endsWith(".tar.bz2") || ext.endsWith(".tbz2")
|
|
458
|
-
? "tar.bz2"
|
|
459
|
-
: "bz2";
|
|
460
|
-
}
|
|
461
|
-
return magicFormat;
|
|
462
|
-
}
|
|
463
|
-
// Fallback to extension-based detection
|
|
464
|
-
return this.detectFormatFromExtension(filename);
|
|
465
|
-
}
|
|
466
|
-
/**
|
|
467
|
-
* Detect archive format from magic bytes at the start of the buffer.
|
|
468
|
-
*
|
|
469
|
-
* @param buffer - Raw archive buffer
|
|
470
|
-
* @returns Detected format, or null if magic bytes don't match any known format
|
|
471
|
-
*/
|
|
472
|
-
detectFormatFromMagicBytes(buffer) {
|
|
473
|
-
if (buffer.length < 2) {
|
|
474
|
-
return null;
|
|
475
|
-
}
|
|
476
|
-
// Check for 7-Zip (6 bytes)
|
|
477
|
-
if (buffer.length >= 6 && this.matchesMagic(buffer, MAGIC_BYTES.SEVEN_ZIP)) {
|
|
478
|
-
return "7z";
|
|
479
|
-
}
|
|
480
|
-
// Check for RAR (6+ bytes)
|
|
481
|
-
if (buffer.length >= 6 && this.matchesMagic(buffer, MAGIC_BYTES.RAR)) {
|
|
482
|
-
return "rar";
|
|
483
|
-
}
|
|
484
|
-
// Check for ZIP/JAR (4 bytes)
|
|
485
|
-
if (buffer.length >= 4 &&
|
|
486
|
-
(this.matchesMagic(buffer, MAGIC_BYTES.ZIP) ||
|
|
487
|
-
this.matchesMagic(buffer, MAGIC_BYTES.ZIP_EMPTY) ||
|
|
488
|
-
this.matchesMagic(buffer, MAGIC_BYTES.ZIP_SPANNED))) {
|
|
489
|
-
return "zip";
|
|
490
|
-
}
|
|
491
|
-
// Check for GZIP (2 bytes)
|
|
492
|
-
if (this.matchesMagic(buffer, MAGIC_BYTES.GZIP)) {
|
|
493
|
-
return "gz";
|
|
494
|
-
}
|
|
495
|
-
// Check for BZIP2 (3 bytes: "BZh"). A bare .bz2 is a single compressed
|
|
496
|
-
// file; the caller decides whether the decompressed bytes turn out to be a
|
|
497
|
-
// tar.
|
|
498
|
-
if (this.matchesMagic(buffer, MAGIC_BYTES.BZIP2)) {
|
|
499
|
-
return "bz2";
|
|
500
|
-
}
|
|
501
|
-
// Check for XZ (6 bytes)
|
|
502
|
-
if (buffer.length >= 6 && this.matchesMagic(buffer, MAGIC_BYTES.XZ)) {
|
|
503
|
-
return "xz";
|
|
504
|
-
}
|
|
505
|
-
// Check for Zstandard (4 bytes)
|
|
506
|
-
if (buffer.length >= 4 && this.matchesMagic(buffer, MAGIC_BYTES.ZSTD)) {
|
|
507
|
-
return "zst";
|
|
508
|
-
}
|
|
509
|
-
return null;
|
|
510
|
-
}
|
|
511
|
-
/**
|
|
512
|
-
* Detect archive format from file extension.
|
|
513
|
-
*
|
|
514
|
-
* @param filename - Filename to extract extension from
|
|
515
|
-
* @returns Detected format, or null if extension is unrecognized
|
|
516
|
-
*/
|
|
517
|
-
detectFormatFromExtension(filename) {
|
|
518
|
-
const lowerFilename = filename.toLowerCase();
|
|
519
|
-
if (lowerFilename.endsWith(".tar.gz") || lowerFilename.endsWith(".tgz")) {
|
|
520
|
-
return "tar.gz";
|
|
521
|
-
}
|
|
522
|
-
if (lowerFilename.endsWith(".tar.bz2") || lowerFilename.endsWith(".tbz2")) {
|
|
523
|
-
return "tar.bz2";
|
|
524
|
-
}
|
|
525
|
-
if (lowerFilename.endsWith(".tar")) {
|
|
526
|
-
return "tar";
|
|
527
|
-
}
|
|
528
|
-
if (lowerFilename.endsWith(".gz")) {
|
|
529
|
-
return "gz";
|
|
530
|
-
}
|
|
531
|
-
if (lowerFilename.endsWith(".bz2")) {
|
|
532
|
-
// A bare `.bz2` is a single compressed file, not a tarball. Reporting it
|
|
533
|
-
// as "tar.bz2" sent it down a branch that refused the format outright.
|
|
534
|
-
return "bz2";
|
|
535
|
-
}
|
|
536
|
-
if (lowerFilename.endsWith(".tar.xz") || lowerFilename.endsWith(".txz")) {
|
|
537
|
-
return "xz";
|
|
538
|
-
}
|
|
539
|
-
if (lowerFilename.endsWith(".xz")) {
|
|
540
|
-
return "xz";
|
|
541
|
-
}
|
|
542
|
-
if (lowerFilename.endsWith(".tar.zst") || lowerFilename.endsWith(".tzst")) {
|
|
543
|
-
return "zst";
|
|
544
|
-
}
|
|
545
|
-
if (lowerFilename.endsWith(".zst")) {
|
|
546
|
-
return "zst";
|
|
547
|
-
}
|
|
548
|
-
if (lowerFilename.endsWith(".zip") || lowerFilename.endsWith(".jar")) {
|
|
549
|
-
return "zip";
|
|
550
|
-
}
|
|
551
|
-
if (lowerFilename.endsWith(".rar")) {
|
|
552
|
-
return "rar";
|
|
553
|
-
}
|
|
554
|
-
if (lowerFilename.endsWith(".7z")) {
|
|
555
|
-
return "7z";
|
|
556
|
-
}
|
|
557
|
-
return null;
|
|
558
|
-
}
|
|
559
|
-
/**
|
|
560
|
-
* Check if a buffer starts with the given magic byte sequence.
|
|
561
|
-
*
|
|
562
|
-
* @param buffer - Buffer to check
|
|
563
|
-
* @param magic - Expected byte sequence
|
|
564
|
-
* @returns true if the buffer starts with the magic bytes
|
|
565
|
-
*/
|
|
566
|
-
matchesMagic(buffer, magic) {
|
|
567
|
-
for (let i = 0; i < magic.length; i++) {
|
|
568
|
-
if (buffer[i] !== magic[i]) {
|
|
569
|
-
return false;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
return true;
|
|
573
|
-
}
|
|
574
|
-
// ===========================================================================
|
|
575
|
-
// ENTRY EXTRACTION
|
|
576
|
-
// ===========================================================================
|
|
577
|
-
/**
|
|
578
|
-
* Extract entry metadata from the archive.
|
|
579
|
-
* Delegates to format-specific extraction methods.
|
|
580
|
-
*
|
|
581
|
-
* @param buffer - Raw archive buffer
|
|
582
|
-
* @param format - Detected archive format
|
|
583
|
-
* @returns Extraction result with entries and security warnings, or error
|
|
584
|
-
*/
|
|
585
|
-
async extractEntries(buffer, format) {
|
|
586
|
-
switch (format) {
|
|
587
|
-
case "zip":
|
|
588
|
-
return this.extractZipEntries(buffer);
|
|
589
|
-
case "tar":
|
|
590
|
-
return this.extractTarEntries(buffer);
|
|
591
|
-
case "tar.gz":
|
|
592
|
-
return this.extractTarGzEntries(buffer);
|
|
593
|
-
case "tar.bz2":
|
|
594
|
-
case "bz2":
|
|
595
|
-
return this.extractSingleStreamEntries(buffer, "bz2");
|
|
596
|
-
case "xz":
|
|
597
|
-
return this.extractSingleStreamEntries(buffer, "xz");
|
|
598
|
-
case "zst":
|
|
599
|
-
return this.extractSingleStreamEntries(buffer, "zst");
|
|
600
|
-
case "gz":
|
|
601
|
-
return this.extractGzEntries(buffer);
|
|
602
|
-
default:
|
|
603
|
-
return {
|
|
604
|
-
success: false,
|
|
605
|
-
entries: [],
|
|
606
|
-
securityWarnings: [],
|
|
607
|
-
error: this.createError(FileErrorCode.UNSUPPORTED_TYPE, {
|
|
608
|
-
format,
|
|
609
|
-
reason: `${format} archives are not supported`,
|
|
610
|
-
supportedFormats: "ZIP, TAR, TAR.GZ, TAR.BZ2, GZ, BZ2, XZ, ZST, JAR",
|
|
611
|
-
}),
|
|
612
|
-
};
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
// ===========================================================================
|
|
616
|
-
// ZIP EXTRACTION
|
|
617
|
-
// ===========================================================================
|
|
618
|
-
/**
|
|
619
|
-
* Extract entry metadata from a ZIP archive.
|
|
620
|
-
* Validates each entry for path traversal, encryption, symlinks, and size limits.
|
|
621
|
-
*
|
|
622
|
-
* @param buffer - Raw ZIP buffer
|
|
623
|
-
* @returns Extraction result with entries, security warnings, or error
|
|
624
|
-
*/
|
|
625
|
-
async extractZipEntries(buffer) {
|
|
626
|
-
const entries = [];
|
|
627
|
-
const securityWarnings = [];
|
|
628
|
-
try {
|
|
629
|
-
const AdmZip = (await import("adm-zip")).default;
|
|
630
|
-
const zip = new AdmZip(buffer);
|
|
631
|
-
const zipEntries = zip.getEntries();
|
|
632
|
-
// Check entry count limit
|
|
633
|
-
if (zipEntries.length > ARCHIVE_SECURITY.MAX_ENTRIES) {
|
|
634
|
-
return {
|
|
635
|
-
success: false,
|
|
636
|
-
entries: [],
|
|
637
|
-
securityWarnings: [],
|
|
638
|
-
error: this.createError(FileErrorCode.SECURITY_VALIDATION_FAILED, {
|
|
639
|
-
reason: `Archive contains ${zipEntries.length} entries, exceeding the limit of ${ARCHIVE_SECURITY.MAX_ENTRIES}`,
|
|
640
|
-
}),
|
|
641
|
-
};
|
|
642
|
-
}
|
|
643
|
-
let cumulativeUncompressedSize = 0;
|
|
644
|
-
for (const entry of zipEntries) {
|
|
645
|
-
const entryName = entry.entryName;
|
|
646
|
-
// Security: path traversal check
|
|
647
|
-
if (this.hasPathTraversal(entryName)) {
|
|
648
|
-
securityWarnings.push(`Path traversal detected in entry: "${entryName}" - entry skipped`);
|
|
649
|
-
continue;
|
|
650
|
-
}
|
|
651
|
-
// Security: path length check
|
|
652
|
-
if (entryName.length > ARCHIVE_SECURITY.MAX_PATH_LENGTH) {
|
|
653
|
-
securityWarnings.push(`Entry name exceeds maximum path length (${ARCHIVE_SECURITY.MAX_PATH_LENGTH}): "${entryName.substring(0, 50)}..." - entry skipped`);
|
|
654
|
-
continue;
|
|
655
|
-
}
|
|
656
|
-
// Security: encrypted entry check
|
|
657
|
-
if (entry.header.flags & 0x01) {
|
|
658
|
-
if (!ARCHIVE_SECURITY.ALLOW_ENCRYPTED) {
|
|
659
|
-
securityWarnings.push(`Encrypted entry detected: "${entryName}" - entry skipped`);
|
|
660
|
-
continue;
|
|
661
|
-
}
|
|
662
|
-
}
|
|
663
|
-
// Security: symlink check (ZIP external attributes)
|
|
664
|
-
const externalAttr = entry.header.attr >>> 16;
|
|
665
|
-
const isSymlink = (externalAttr & 0xa000) === 0xa000;
|
|
666
|
-
if (isSymlink && !ARCHIVE_SECURITY.ALLOW_SYMLINKS) {
|
|
667
|
-
securityWarnings.push(`Symbolic link detected: "${entryName}" - entry skipped`);
|
|
668
|
-
continue;
|
|
669
|
-
}
|
|
670
|
-
const isDirectory = entry.isDirectory;
|
|
671
|
-
const uncompressedSize = entry.header.size;
|
|
672
|
-
const compressedSize = entry.header.compressedSize;
|
|
673
|
-
// Security: single file size check
|
|
674
|
-
if (!isDirectory && uncompressedSize > ARCHIVE_SECURITY.MAX_SINGLE_FILE_SIZE) {
|
|
675
|
-
securityWarnings.push(`Entry "${entryName}" exceeds single file size limit (${this.formatSizeMB(uncompressedSize)} MB > ${this.formatSizeMB(ARCHIVE_SECURITY.MAX_SINGLE_FILE_SIZE)} MB) - entry listed but flagged`);
|
|
676
|
-
}
|
|
677
|
-
// Security: per-entry compression ratio check
|
|
678
|
-
if (compressedSize > 0 && !isDirectory) {
|
|
679
|
-
const ratio = uncompressedSize / compressedSize;
|
|
680
|
-
if (ratio > ARCHIVE_SECURITY.MAX_COMPRESSION_RATIO) {
|
|
681
|
-
return {
|
|
682
|
-
success: false,
|
|
683
|
-
entries: [],
|
|
684
|
-
securityWarnings: [],
|
|
685
|
-
error: this.createError(FileErrorCode.ZIP_BOMB_DETECTED, {
|
|
686
|
-
entryName,
|
|
687
|
-
compressionRatio: ratio.toFixed(1),
|
|
688
|
-
maxRatio: ARCHIVE_SECURITY.MAX_COMPRESSION_RATIO,
|
|
689
|
-
}),
|
|
690
|
-
};
|
|
691
|
-
}
|
|
692
|
-
}
|
|
693
|
-
// Cumulative decompressed size check
|
|
694
|
-
cumulativeUncompressedSize += uncompressedSize;
|
|
695
|
-
if (cumulativeUncompressedSize > ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE) {
|
|
696
|
-
return {
|
|
697
|
-
success: false,
|
|
698
|
-
entries: [],
|
|
699
|
-
securityWarnings: [],
|
|
700
|
-
error: this.createError(FileErrorCode.SECURITY_VALIDATION_FAILED, {
|
|
701
|
-
reason: `Cumulative decompressed size exceeds limit of ${this.formatSizeMB(ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE)} MB`,
|
|
702
|
-
}),
|
|
703
|
-
};
|
|
704
|
-
}
|
|
705
|
-
entries.push({
|
|
706
|
-
name: entryName,
|
|
707
|
-
uncompressedSize,
|
|
708
|
-
compressedSize,
|
|
709
|
-
isDirectory,
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
return { success: true, entries, securityWarnings };
|
|
713
|
-
}
|
|
714
|
-
catch (error) {
|
|
715
|
-
return {
|
|
716
|
-
success: false,
|
|
717
|
-
entries: [],
|
|
718
|
-
securityWarnings: [],
|
|
719
|
-
error: this.createError(FileErrorCode.CORRUPTED_FILE, {
|
|
720
|
-
reason: `Failed to read ZIP archive: ${error instanceof Error ? error.message : String(error)}`,
|
|
721
|
-
}, error instanceof Error ? error : undefined),
|
|
722
|
-
};
|
|
723
|
-
}
|
|
724
|
-
}
|
|
725
|
-
// ===========================================================================
|
|
726
|
-
// TAR EXTRACTION
|
|
727
|
-
// ===========================================================================
|
|
728
|
-
/**
|
|
729
|
-
* Extract entry metadata from a plain TAR archive.
|
|
730
|
-
*
|
|
731
|
-
* @param buffer - Raw TAR buffer
|
|
732
|
-
* @returns Extraction result with entries and security warnings, or error
|
|
733
|
-
*/
|
|
734
|
-
async extractTarEntries(buffer) {
|
|
735
|
-
try {
|
|
736
|
-
const tarStream = await import("tar-stream");
|
|
737
|
-
return await this.parseTarStream(tarStream, buffer);
|
|
738
|
-
}
|
|
739
|
-
catch (error) {
|
|
740
|
-
return {
|
|
741
|
-
success: false,
|
|
742
|
-
entries: [],
|
|
743
|
-
securityWarnings: [],
|
|
744
|
-
error: this.createError(FileErrorCode.CORRUPTED_FILE, {
|
|
745
|
-
reason: `Failed to read TAR archive: ${error instanceof Error ? error.message : String(error)}`,
|
|
746
|
-
}, error instanceof Error ? error : undefined),
|
|
747
|
-
};
|
|
748
|
-
}
|
|
749
|
-
}
|
|
750
|
-
/**
|
|
751
|
-
* Extract entry metadata from a GZIP-compressed TAR archive.
|
|
752
|
-
* First decompresses with zlib, then parses as TAR.
|
|
753
|
-
*
|
|
754
|
-
* @param buffer - Raw TAR.GZ buffer
|
|
755
|
-
* @returns Extraction result with entries and security warnings, or error
|
|
756
|
-
*/
|
|
757
|
-
async extractTarGzEntries(buffer) {
|
|
758
|
-
try {
|
|
759
|
-
const zlib = await import("zlib");
|
|
760
|
-
const { promisify } = await import("util");
|
|
761
|
-
const gunzip = promisify(zlib.gunzip);
|
|
762
|
-
// Bounded at the decoder, matching the zstd path. Checking the length
|
|
763
|
-
// afterwards only reports a bomb once it has already been paid for: 40KB
|
|
764
|
-
// of gzip inflates to 40MB, and the allocation is the damage, not the
|
|
765
|
-
// number. `maxOutputLength` abandons the inflate at the cap instead, so
|
|
766
|
-
// the ceiling on memory is the limit rather than whatever the attacker
|
|
767
|
-
// chose. The overflow is classified in the catch below.
|
|
768
|
-
const decompressed = await gunzip(buffer, {
|
|
769
|
-
maxOutputLength: ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE,
|
|
770
|
-
});
|
|
771
|
-
const tarBuffer = Buffer.from(decompressed);
|
|
772
|
-
// Security: check compression ratio
|
|
773
|
-
if (buffer.length > 0) {
|
|
774
|
-
const ratio = tarBuffer.length / buffer.length;
|
|
775
|
-
if (ratio > ARCHIVE_SECURITY.MAX_COMPRESSION_RATIO) {
|
|
776
|
-
return {
|
|
777
|
-
success: false,
|
|
778
|
-
entries: [],
|
|
779
|
-
securityWarnings: [],
|
|
780
|
-
error: this.createError(FileErrorCode.ZIP_BOMB_DETECTED, {
|
|
781
|
-
compressionRatio: ratio.toFixed(1),
|
|
782
|
-
maxRatio: ARCHIVE_SECURITY.MAX_COMPRESSION_RATIO,
|
|
783
|
-
}),
|
|
784
|
-
};
|
|
785
|
-
}
|
|
786
|
-
}
|
|
787
|
-
const tarStream = await import("tar-stream");
|
|
788
|
-
return await this.parseTarStream(tarStream, tarBuffer);
|
|
789
|
-
}
|
|
790
|
-
catch (error) {
|
|
791
|
-
if (isDecompressionBoundExceeded(error)) {
|
|
792
|
-
return {
|
|
793
|
-
success: false,
|
|
794
|
-
entries: [],
|
|
795
|
-
securityWarnings: [],
|
|
796
|
-
error: this.createError(FileErrorCode.SECURITY_VALIDATION_FAILED, {
|
|
797
|
-
reason: `Decompressed TAR size exceeds limit (${this.formatSizeMB(ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE)} MB)`,
|
|
798
|
-
}),
|
|
799
|
-
};
|
|
800
|
-
}
|
|
801
|
-
// Check if the error is one we already created (security validation)
|
|
802
|
-
if (error &&
|
|
803
|
-
typeof error === "object" &&
|
|
804
|
-
"code" in error &&
|
|
805
|
-
typeof error.code === "string") {
|
|
806
|
-
// Re-throw our structured errors
|
|
807
|
-
return {
|
|
808
|
-
success: false,
|
|
809
|
-
entries: [],
|
|
810
|
-
securityWarnings: [],
|
|
811
|
-
error: this.createError(FileErrorCode.DECOMPRESSION_FAILED, {
|
|
812
|
-
reason: `Failed to decompress TAR.GZ archive: ${error instanceof Error ? error.message : String(error)}`,
|
|
813
|
-
}, error instanceof Error ? error : undefined),
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
return {
|
|
817
|
-
success: false,
|
|
818
|
-
entries: [],
|
|
819
|
-
securityWarnings: [],
|
|
820
|
-
error: this.createError(FileErrorCode.DECOMPRESSION_FAILED, {
|
|
821
|
-
reason: `Failed to decompress TAR.GZ archive: ${error instanceof Error ? error.message : String(error)}`,
|
|
822
|
-
}, error instanceof Error ? error : undefined),
|
|
823
|
-
};
|
|
824
|
-
}
|
|
825
|
-
}
|
|
826
|
-
/**
|
|
827
|
-
* Parse a TAR stream and extract entry metadata.
|
|
828
|
-
* Shared between plain TAR and decompressed TAR.GZ processing.
|
|
829
|
-
*
|
|
830
|
-
* @param tarStream - The imported tar-stream module
|
|
831
|
-
* @param buffer - Raw (decompressed) TAR buffer
|
|
832
|
-
* @returns Extraction result with entries and security warnings, or error
|
|
833
|
-
*/
|
|
834
|
-
async parseTarStream(tarStream, buffer) {
|
|
835
|
-
return new Promise((resolve) => {
|
|
836
|
-
const entries = [];
|
|
837
|
-
const securityWarnings = [];
|
|
838
|
-
const contents = new Map();
|
|
839
|
-
let entryCount = 0;
|
|
840
|
-
let cumulativeSize = 0;
|
|
841
|
-
let extractedBytes = 0;
|
|
842
|
-
let earlyError = null;
|
|
843
|
-
const extract = tarStream.extract();
|
|
844
|
-
extract.on("entry", (header, stream, next) => {
|
|
845
|
-
entryCount++;
|
|
846
|
-
// Security: entry count limit
|
|
847
|
-
if (entryCount > ARCHIVE_SECURITY.MAX_ENTRIES) {
|
|
848
|
-
earlyError = this.createError(FileErrorCode.SECURITY_VALIDATION_FAILED, {
|
|
849
|
-
reason: `Archive contains more than ${ARCHIVE_SECURITY.MAX_ENTRIES} entries`,
|
|
850
|
-
});
|
|
851
|
-
stream.resume();
|
|
852
|
-
extract.destroy();
|
|
853
|
-
return;
|
|
854
|
-
}
|
|
855
|
-
const entryName = header.name || "";
|
|
856
|
-
const entrySize = header.size || 0;
|
|
857
|
-
const entryType = header.type || "file";
|
|
858
|
-
// Security: path traversal
|
|
859
|
-
if (this.hasPathTraversal(entryName)) {
|
|
860
|
-
securityWarnings.push(`Path traversal detected in entry: "${entryName}" - entry skipped`);
|
|
861
|
-
stream.resume();
|
|
862
|
-
next();
|
|
863
|
-
return;
|
|
864
|
-
}
|
|
865
|
-
// Security: path length
|
|
866
|
-
if (entryName.length > ARCHIVE_SECURITY.MAX_PATH_LENGTH) {
|
|
867
|
-
securityWarnings.push(`Entry name exceeds maximum path length (${ARCHIVE_SECURITY.MAX_PATH_LENGTH}): "${entryName.substring(0, 50)}..." - entry skipped`);
|
|
868
|
-
stream.resume();
|
|
869
|
-
next();
|
|
870
|
-
return;
|
|
871
|
-
}
|
|
872
|
-
// Security: symlinks
|
|
873
|
-
if ((entryType === "symlink" || entryType === "link") && !ARCHIVE_SECURITY.ALLOW_SYMLINKS) {
|
|
874
|
-
securityWarnings.push(`Symbolic/hard link detected: "${entryName}" - entry skipped`);
|
|
875
|
-
stream.resume();
|
|
876
|
-
next();
|
|
877
|
-
return;
|
|
878
|
-
}
|
|
879
|
-
const isDirectory = entryType === "directory";
|
|
880
|
-
// Security: single file size
|
|
881
|
-
if (!isDirectory && entrySize > ARCHIVE_SECURITY.MAX_SINGLE_FILE_SIZE) {
|
|
882
|
-
securityWarnings.push(`Entry "${entryName}" exceeds single file size limit (${this.formatSizeMB(entrySize)} MB > ${this.formatSizeMB(ARCHIVE_SECURITY.MAX_SINGLE_FILE_SIZE)} MB) - entry listed but flagged`);
|
|
883
|
-
}
|
|
884
|
-
// Security: cumulative size
|
|
885
|
-
cumulativeSize += entrySize;
|
|
886
|
-
if (cumulativeSize > ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE) {
|
|
887
|
-
earlyError = this.createError(FileErrorCode.SECURITY_VALIDATION_FAILED, {
|
|
888
|
-
reason: `Cumulative entry size exceeds limit of ${this.formatSizeMB(ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE)} MB`,
|
|
889
|
-
});
|
|
890
|
-
stream.resume();
|
|
891
|
-
extract.destroy();
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
entries.push({
|
|
895
|
-
name: entryName,
|
|
896
|
-
uncompressedSize: entrySize,
|
|
897
|
-
compressedSize: 0, // TAR doesn't compress individual entries
|
|
898
|
-
isDirectory,
|
|
899
|
-
});
|
|
900
|
-
// Capture the text of eligible members as they go past.
|
|
901
|
-
//
|
|
902
|
-
// A listing alone is not an answer. Asked what a .tar contains, the
|
|
903
|
-
// model could previously only recite filenames and sizes — the same
|
|
904
|
-
// archive as a .zip returned its text, because only the ZIP path
|
|
905
|
-
// extracted anything. A tar entry's bytes are available exactly once,
|
|
906
|
-
// here, while the stream is open; re-reading later would mean parsing
|
|
907
|
-
// the whole archive a second time.
|
|
908
|
-
if (!isDirectory &&
|
|
909
|
-
this.isExtractableEntryName(entryName) &&
|
|
910
|
-
entrySize > 0 &&
|
|
911
|
-
entrySize <= ARCHIVE_CONFIG.MAX_EXTRACT_ENTRY_SIZE &&
|
|
912
|
-
contents.size < ARCHIVE_CONFIG.MAX_EXTRACT_ENTRIES &&
|
|
913
|
-
extractedBytes + entrySize <= ARCHIVE_CONFIG.MAX_TOTAL_EXTRACT_SIZE) {
|
|
914
|
-
const chunks = [];
|
|
915
|
-
stream.on("data", (chunk) => chunks.push(chunk));
|
|
916
|
-
stream.on("end", () => {
|
|
917
|
-
const text = this.decodeEntryText(Buffer.concat(chunks));
|
|
918
|
-
if (text !== null) {
|
|
919
|
-
contents.set(entryName, text);
|
|
920
|
-
extractedBytes += entrySize;
|
|
921
|
-
}
|
|
922
|
-
next();
|
|
923
|
-
});
|
|
924
|
-
stream.on("error", () => next());
|
|
925
|
-
return;
|
|
926
|
-
}
|
|
927
|
-
// Consume the stream without buffering (we only need metadata)
|
|
928
|
-
stream.resume();
|
|
929
|
-
next();
|
|
930
|
-
});
|
|
931
|
-
extract.on("finish", () => {
|
|
932
|
-
if (earlyError) {
|
|
933
|
-
resolve({
|
|
934
|
-
success: false,
|
|
935
|
-
entries: [],
|
|
936
|
-
securityWarnings: [],
|
|
937
|
-
error: earlyError,
|
|
938
|
-
});
|
|
939
|
-
}
|
|
940
|
-
else {
|
|
941
|
-
resolve({ success: true, entries, securityWarnings, contents });
|
|
942
|
-
}
|
|
943
|
-
});
|
|
944
|
-
extract.on("error", (err) => {
|
|
945
|
-
if (earlyError) {
|
|
946
|
-
resolve({
|
|
947
|
-
success: false,
|
|
948
|
-
entries: [],
|
|
949
|
-
securityWarnings: [],
|
|
950
|
-
error: earlyError,
|
|
951
|
-
});
|
|
952
|
-
}
|
|
953
|
-
else {
|
|
954
|
-
resolve({
|
|
955
|
-
success: false,
|
|
956
|
-
entries: [],
|
|
957
|
-
securityWarnings: [],
|
|
958
|
-
error: this.createError(FileErrorCode.CORRUPTED_FILE, {
|
|
959
|
-
reason: `Failed to parse TAR archive: ${err.message}`,
|
|
960
|
-
}, err),
|
|
961
|
-
});
|
|
962
|
-
}
|
|
963
|
-
});
|
|
964
|
-
// Feed the buffer into the extract stream
|
|
965
|
-
extract.end(buffer);
|
|
966
|
-
});
|
|
967
|
-
}
|
|
968
|
-
// ===========================================================================
|
|
969
|
-
// GZIP EXTRACTION (plain, non-TAR)
|
|
970
|
-
// ===========================================================================
|
|
971
|
-
/**
|
|
972
|
-
* Extract metadata from a plain GZIP file (single compressed file, not a TAR).
|
|
973
|
-
* Since plain GZ wraps a single file, we create a single entry using the
|
|
974
|
-
* original filename minus the .gz extension.
|
|
975
|
-
*
|
|
976
|
-
* @param buffer - Raw GZIP buffer
|
|
977
|
-
* @returns Extraction result with a single entry and security warnings, or error
|
|
978
|
-
*/
|
|
979
|
-
async extractGzEntries(buffer) {
|
|
980
|
-
try {
|
|
981
|
-
const zlib = await import("zlib");
|
|
982
|
-
const { promisify } = await import("util");
|
|
983
|
-
const gunzip = promisify(zlib.gunzip);
|
|
984
|
-
// Bounded at the decoder — see the matching call in extractTarGzEntries.
|
|
985
|
-
// The overflow is classified in the catch below.
|
|
986
|
-
const decompressed = await gunzip(buffer, {
|
|
987
|
-
maxOutputLength: ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE,
|
|
988
|
-
});
|
|
989
|
-
// Security: compression ratio
|
|
990
|
-
if (buffer.length > 0) {
|
|
991
|
-
const ratio = decompressed.length / buffer.length;
|
|
992
|
-
if (ratio > ARCHIVE_SECURITY.MAX_COMPRESSION_RATIO) {
|
|
993
|
-
return {
|
|
994
|
-
success: false,
|
|
995
|
-
entries: [],
|
|
996
|
-
securityWarnings: [],
|
|
997
|
-
error: this.createError(FileErrorCode.ZIP_BOMB_DETECTED, {
|
|
998
|
-
compressionRatio: ratio.toFixed(1),
|
|
999
|
-
maxRatio: ARCHIVE_SECURITY.MAX_COMPRESSION_RATIO,
|
|
1000
|
-
}),
|
|
1001
|
-
};
|
|
1002
|
-
}
|
|
1003
|
-
}
|
|
1004
|
-
// Check if the decompressed content is actually a TAR
|
|
1005
|
-
if (this.looksLikeTar(decompressed)) {
|
|
1006
|
-
// It's actually a tar.gz; re-route through TAR extraction
|
|
1007
|
-
const tarStream = await import("tar-stream");
|
|
1008
|
-
return await this.parseTarStream(tarStream, Buffer.from(decompressed));
|
|
1009
|
-
}
|
|
1010
|
-
// Plain GZ - single entry
|
|
1011
|
-
// Derive the inner filename by removing the .gz extension
|
|
1012
|
-
const innerFilename = "decompressed-content";
|
|
1013
|
-
const securityWarnings = [];
|
|
1014
|
-
const entries = [
|
|
1015
|
-
{
|
|
1016
|
-
name: innerFilename,
|
|
1017
|
-
uncompressedSize: decompressed.length,
|
|
1018
|
-
compressedSize: buffer.length,
|
|
1019
|
-
isDirectory: false,
|
|
1020
|
-
},
|
|
1021
|
-
];
|
|
1022
|
-
// The decompressed bytes ARE the content here; a listing that says
|
|
1023
|
-
// "decompressed-content (1.02 MB)" answers nothing about the file.
|
|
1024
|
-
const contents = new Map();
|
|
1025
|
-
const gzText = this.decodeEntryText(decompressed);
|
|
1026
|
-
if (gzText !== null) {
|
|
1027
|
-
contents.set(innerFilename, gzText.slice(0, ARCHIVE_CONFIG.MAX_EXTRACT_ENTRY_SIZE));
|
|
1028
|
-
}
|
|
1029
|
-
return { success: true, entries, securityWarnings, contents };
|
|
1030
|
-
}
|
|
1031
|
-
catch (error) {
|
|
1032
|
-
if (isDecompressionBoundExceeded(error)) {
|
|
1033
|
-
return {
|
|
1034
|
-
success: false,
|
|
1035
|
-
entries: [],
|
|
1036
|
-
securityWarnings: [],
|
|
1037
|
-
error: this.createError(FileErrorCode.SECURITY_VALIDATION_FAILED, {
|
|
1038
|
-
reason: `Decompressed size exceeds limit (${this.formatSizeMB(ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE)} MB)`,
|
|
1039
|
-
}),
|
|
1040
|
-
};
|
|
1041
|
-
}
|
|
1042
|
-
return {
|
|
1043
|
-
success: false,
|
|
1044
|
-
entries: [],
|
|
1045
|
-
securityWarnings: [],
|
|
1046
|
-
error: this.createError(FileErrorCode.DECOMPRESSION_FAILED, {
|
|
1047
|
-
reason: `Failed to decompress GZIP file: ${error instanceof Error ? error.message : String(error)}`,
|
|
1048
|
-
}, error instanceof Error ? error : undefined),
|
|
1049
|
-
};
|
|
1050
|
-
}
|
|
1051
|
-
}
|
|
1052
|
-
/**
|
|
1053
|
-
* Heuristic check to determine if a buffer looks like a TAR archive.
|
|
1054
|
-
* TAR archives have a "ustar" magic string at byte offset 257.
|
|
1055
|
-
*
|
|
1056
|
-
* @param buffer - Decompressed buffer to check
|
|
1057
|
-
* @returns true if the buffer appears to be a TAR archive
|
|
1058
|
-
*/
|
|
1059
|
-
looksLikeTar(buffer) {
|
|
1060
|
-
if (buffer.length < 263) {
|
|
1061
|
-
return false;
|
|
1062
|
-
}
|
|
1063
|
-
// "ustar" at offset 257
|
|
1064
|
-
const magic = Buffer.from(buffer.slice(257, 263)).toString("ascii");
|
|
1065
|
-
return magic.startsWith("ustar");
|
|
1066
|
-
}
|
|
1067
|
-
// ===========================================================================
|
|
1068
|
-
// SECURITY VALIDATION
|
|
1069
|
-
// ===========================================================================
|
|
1070
|
-
/**
|
|
1071
|
-
* Check if an entry name contains path traversal sequences.
|
|
1072
|
-
* Detects `../`, absolute paths, and other traversal vectors.
|
|
1073
|
-
*
|
|
1074
|
-
* @param entryName - Archive entry name/path to validate
|
|
1075
|
-
* @returns true if path traversal is detected
|
|
1076
|
-
*/
|
|
1077
|
-
hasPathTraversal(entryName) {
|
|
1078
|
-
// Normalize separators
|
|
1079
|
-
const normalized = entryName.replace(/\\/g, "/");
|
|
1080
|
-
// Check for parent directory traversal
|
|
1081
|
-
if (normalized.includes("../") || normalized.includes("/..")) {
|
|
1082
|
-
return true;
|
|
1083
|
-
}
|
|
1084
|
-
// Check for absolute paths
|
|
1085
|
-
if (normalized.startsWith("/") || /^[A-Za-z]:/.test(normalized)) {
|
|
1086
|
-
return true;
|
|
1087
|
-
}
|
|
1088
|
-
// Check resolved path doesn't escape root
|
|
1089
|
-
const resolved = path.posix.normalize(normalized);
|
|
1090
|
-
if (resolved.startsWith("../") || resolved === "..") {
|
|
1091
|
-
return true;
|
|
1092
|
-
}
|
|
1093
|
-
return false;
|
|
1094
|
-
}
|
|
1095
|
-
// ===========================================================================
|
|
1096
|
-
// CONTENT EXTRACTION (Phase 2 sub-processing)
|
|
1097
|
-
// ===========================================================================
|
|
1098
|
-
/**
|
|
1099
|
-
* Extract text content from eligible ZIP entries for LLM consumption.
|
|
1100
|
-
*
|
|
1101
|
-
* Selects small, text-based files from the archive and extracts their
|
|
1102
|
-
* content. Files are sorted by relevance (config files, source code, docs).
|
|
1103
|
-
* Binary files, nested archives, and files exceeding size limits are skipped.
|
|
1104
|
-
*
|
|
1105
|
-
* @param buffer - Raw ZIP archive buffer
|
|
1106
|
-
* @param entries - Previously extracted entry metadata
|
|
1107
|
-
* @returns Map of entry name to extracted text content
|
|
1108
|
-
*/
|
|
1109
|
-
/**
|
|
1110
|
-
* Whether an entry name looks like something worth inlining as text.
|
|
1111
|
-
*
|
|
1112
|
-
* Shared by the ZIP and TAR paths so the two cannot drift into disagreeing
|
|
1113
|
-
* about which members are worth reading — they did, because only ZIP had the
|
|
1114
|
-
* rule at all.
|
|
1115
|
-
*/
|
|
1116
|
-
isExtractableEntryName(name) {
|
|
1117
|
-
const ext = path.extname(name).toLowerCase();
|
|
1118
|
-
if (ARCHIVE_CONFIG.EXTRACTABLE_EXTENSIONS.has(ext)) {
|
|
1119
|
-
return true;
|
|
1120
|
-
}
|
|
1121
|
-
const base = path.basename(name).toLowerCase();
|
|
1122
|
-
return (base === "readme" ||
|
|
1123
|
-
base === "license" ||
|
|
1124
|
-
base === "makefile" ||
|
|
1125
|
-
base === "dockerfile");
|
|
1126
|
-
}
|
|
1127
|
-
/**
|
|
1128
|
-
* Decode bytes to text, or null when they are not text.
|
|
1129
|
-
*
|
|
1130
|
-
* A NUL byte in the first 512 bytes, or a high proportion of replacement
|
|
1131
|
-
* characters after decoding, means binary — inlining that would spend the
|
|
1132
|
-
* extraction budget on mojibake.
|
|
1133
|
-
*/
|
|
1134
|
-
decodeEntryText(data) {
|
|
1135
|
-
if (!data || data.length === 0) {
|
|
1136
|
-
return null;
|
|
1137
|
-
}
|
|
1138
|
-
if (data.subarray(0, Math.min(512, data.length)).includes(0)) {
|
|
1139
|
-
return null;
|
|
1140
|
-
}
|
|
1141
|
-
const text = data.toString("utf-8");
|
|
1142
|
-
const replacements = (text.match(/\ufffd/g) || []).length;
|
|
1143
|
-
return replacements > text.length * 0.05 ? null : text;
|
|
1144
|
-
}
|
|
1145
|
-
/**
|
|
1146
|
-
* Decompress a single-stream archive (.bz2, .xz, .zst).
|
|
1147
|
-
*
|
|
1148
|
-
* Node ships zstd from v22.15/23, so that one needs no help. bzip2 and xz
|
|
1149
|
-
* have no Node binding, and adding a native module for them would make an
|
|
1150
|
-
* optional format a build-time dependency for every consumer — so the system
|
|
1151
|
-
* tools are used when present, the same soft-dependency arrangement this
|
|
1152
|
-
* codebase already has with ffmpeg. Absent tooling returns null and the
|
|
1153
|
-
* caller reports the format as unsupported *on this machine* rather than
|
|
1154
|
-
* unsupported in principle.
|
|
1155
|
-
*/
|
|
1156
|
-
async decompressSingleStream(buffer, format) {
|
|
1157
|
-
if (format === "zst") {
|
|
1158
|
-
// Node gained zstd in v22.15/23. Older runtimes simply lack the export,
|
|
1159
|
-
// so it is probed at runtime rather than assumed from the typings —
|
|
1160
|
-
// which is also why this is a property check on an `unknown` module
|
|
1161
|
-
// instead of a cast asserting it exists.
|
|
1162
|
-
const zlibModule = await import("zlib");
|
|
1163
|
-
const candidate = typeof zlibModule === "object" && zlibModule !== null
|
|
1164
|
-
? zlibModule.zstdDecompress
|
|
1165
|
-
: undefined;
|
|
1166
|
-
if (typeof candidate === "function") {
|
|
1167
|
-
const zstdDecompress = candidate;
|
|
1168
|
-
return await new Promise((resolve) => {
|
|
1169
|
-
// Bounded at the decoder rather than after the fact. The size guard
|
|
1170
|
-
// downstream only runs once the whole buffer exists, which is too
|
|
1171
|
-
// late for a zip-bomb: a few KB of zstd expands to gigabytes and the
|
|
1172
|
-
// allocation is what hurts. `maxOutputLength` makes it fail fast.
|
|
1173
|
-
zstdDecompress(buffer, { maxOutputLength: ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE }, (err, res) => resolve(err
|
|
1174
|
-
? {
|
|
1175
|
-
status: err.code ===
|
|
1176
|
-
"ERR_BUFFER_TOO_LARGE"
|
|
1177
|
-
? "too-large"
|
|
1178
|
-
: "failed",
|
|
1179
|
-
}
|
|
1180
|
-
: { status: "ok", buffer: res }));
|
|
1181
|
-
});
|
|
1182
|
-
}
|
|
1183
|
-
}
|
|
1184
|
-
const tool = SINGLE_STREAM_TOOLS[format];
|
|
1185
|
-
try {
|
|
1186
|
-
const { execFile } = await import("node:child_process");
|
|
1187
|
-
return await new Promise((resolve) => {
|
|
1188
|
-
// ENOENT means the binary is absent; anything else means it ran and
|
|
1189
|
-
// could not do the job. Only the former justifies telling the caller to
|
|
1190
|
-
// install something.
|
|
1191
|
-
//
|
|
1192
|
-
// Read off the error itself rather than a flag set by the `error`
|
|
1193
|
-
// listener below, because execFile invokes this callback BEFORE that
|
|
1194
|
-
// listener runs — measured, not assumed:
|
|
1195
|
-
// callback(missing=false, code=ENOENT) → errorListener(code=ENOENT)
|
|
1196
|
-
// The promise is already settled by the time the listener could set the
|
|
1197
|
-
// flag, so a missing decompressor reported itself as a corrupt stream
|
|
1198
|
-
// and told the user to re-upload a perfectly good file.
|
|
1199
|
-
const isMissingTool = (error) => error?.code === "ENOENT";
|
|
1200
|
-
// Hitting `maxBuffer` is the zip-bomb guard firing, not a corrupt
|
|
1201
|
-
// stream: it will fail identically on every retry, so it must not be
|
|
1202
|
-
// reported as retryable the way a truncated upload is.
|
|
1203
|
-
const isTooLarge = (error) => error?.code ===
|
|
1204
|
-
"ERR_CHILD_PROCESS_STDIO_MAXBUFFER";
|
|
1205
|
-
const child = execFile(tool, ["-dc"], {
|
|
1206
|
-
encoding: "buffer",
|
|
1207
|
-
maxBuffer: ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE,
|
|
1208
|
-
// Without this a crafted or truncated stream that makes the tool
|
|
1209
|
-
// block forever never fires the callback, so the promise never
|
|
1210
|
-
// settles and the request that awaits it hangs indefinitely.
|
|
1211
|
-
timeout: ARCHIVE_CONFIG.TIMEOUT_MS,
|
|
1212
|
-
}, (error, stdout) => {
|
|
1213
|
-
// Only a non-zero exit means failure. Empty output does not:
|
|
1214
|
-
// compressing an empty file is legal and round-trips — a 32-byte
|
|
1215
|
-
// `empty.txt.xz` decompresses to nothing with exit 0 — so treating
|
|
1216
|
-
// zero length as an error reported a valid archive as corrupt. The
|
|
1217
|
-
// in-process zstd path above already keyed on the error alone, so
|
|
1218
|
-
// the two backends disagreed about the same input.
|
|
1219
|
-
if (error || !stdout) {
|
|
1220
|
-
resolve({
|
|
1221
|
-
status: isMissingTool(error)
|
|
1222
|
-
? "tool-unavailable"
|
|
1223
|
-
: isTooLarge(error)
|
|
1224
|
-
? "too-large"
|
|
1225
|
-
: "failed",
|
|
1226
|
-
});
|
|
1227
|
-
return;
|
|
1228
|
-
}
|
|
1229
|
-
resolve({ status: "ok", buffer: Buffer.from(stdout) });
|
|
1230
|
-
});
|
|
1231
|
-
// Kept as a backstop for spawn failures that never reach the
|
|
1232
|
-
// callback. Whichever settles first wins; both now classify the same
|
|
1233
|
-
// way, so the outcome no longer depends on the order.
|
|
1234
|
-
child.on("error", (error) => {
|
|
1235
|
-
resolve({
|
|
1236
|
-
status: isMissingTool(error) ? "tool-unavailable" : "failed",
|
|
1237
|
-
});
|
|
1238
|
-
});
|
|
1239
|
-
// Swallowed, deliberately not resolved from. A stdin write fails with
|
|
1240
|
-
// EPIPE precisely because the child already died — including when Node
|
|
1241
|
-
// killed it for exceeding `maxBuffer`, which is the zip-bomb guard.
|
|
1242
|
-
// Resolving here raced the exec callback and, when it won, downgraded a
|
|
1243
|
-
// "too-large" verdict to a retryable "failed", telling the caller to
|
|
1244
|
-
// retry a bomb. The callback is the authoritative signal: it always
|
|
1245
|
-
// fires once the process exits or fails to spawn, and the `timeout`
|
|
1246
|
-
// above bounds the wait. This listener exists only so an unhandled
|
|
1247
|
-
// 'error' event cannot take the process down.
|
|
1248
|
-
child.stdin?.on("error", () => undefined);
|
|
1249
|
-
child.stdin?.end(buffer);
|
|
1250
|
-
});
|
|
1251
|
-
}
|
|
1252
|
-
catch {
|
|
1253
|
-
return { status: "tool-unavailable" };
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
/**
|
|
1257
|
-
* Extract a single-stream archive: decompress, then treat the result as a
|
|
1258
|
-
* TAR when it is one and as a lone file otherwise.
|
|
1259
|
-
*
|
|
1260
|
-
* The tar check matters because `.tar.xz` and `.tar.zst` are how these
|
|
1261
|
-
* formats are usually met — reporting one opaque "decompressed-content" blob
|
|
1262
|
-
* for an archive of forty files would be technically true and useless.
|
|
1263
|
-
*/
|
|
1264
|
-
async extractSingleStreamEntries(buffer, format) {
|
|
1265
|
-
const result = await this.decompressSingleStream(buffer, format);
|
|
1266
|
-
if (result.status !== "ok") {
|
|
1267
|
-
const tool = SINGLE_STREAM_TOOLS[format];
|
|
1268
|
-
// Three distinct outcomes, and the codes carry contracts a caller acts
|
|
1269
|
-
// on. UNSUPPORTED_TYPE is `retryable: false` and advises converting the
|
|
1270
|
-
// file; DECOMPRESSION_FAILED is `retryable: true` and advises
|
|
1271
|
-
// re-uploading; SECURITY_VALIDATION_FAILED is how the GZIP and TAR.GZ
|
|
1272
|
-
// paths in this file already report a decompression bomb. `retryable` is
|
|
1273
|
-
// read downstream by `isRetryableErrorCode`, so a stream that tripped the
|
|
1274
|
-
// decoder's size cap must not be advertised as worth retrying — it will
|
|
1275
|
-
// fail identically every time — and a merely truncated upload must not be
|
|
1276
|
-
// reported as an unsupported format.
|
|
1277
|
-
const code = result.status === "tool-unavailable"
|
|
1278
|
-
? FileErrorCode.UNSUPPORTED_TYPE
|
|
1279
|
-
: result.status === "too-large"
|
|
1280
|
-
? FileErrorCode.SECURITY_VALIDATION_FAILED
|
|
1281
|
-
: FileErrorCode.DECOMPRESSION_FAILED;
|
|
1282
|
-
return {
|
|
1283
|
-
success: false,
|
|
1284
|
-
entries: [],
|
|
1285
|
-
securityWarnings: [],
|
|
1286
|
-
error: this.createError(code, {
|
|
1287
|
-
format,
|
|
1288
|
-
reason: result.status === "tool-unavailable"
|
|
1289
|
-
? `${format.toUpperCase()} could not be decompressed. Node has no built-in ` +
|
|
1290
|
-
`decoder for it and the "${tool}" command is unavailable on this machine.`
|
|
1291
|
-
: result.status === "too-large"
|
|
1292
|
-
? `${format.toUpperCase()} expands beyond the ` +
|
|
1293
|
-
`${this.formatSizeMB(ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE)} MB ` +
|
|
1294
|
-
`decompression limit and was refused before it could be read.`
|
|
1295
|
-
: `${format.toUpperCase()} could not be decompressed. The stream is ` +
|
|
1296
|
-
`corrupt or truncated.`,
|
|
1297
|
-
supportedFormats: "ZIP, TAR, TAR.GZ, TAR.BZ2, GZ, BZ2, XZ, ZST, JAR",
|
|
1298
|
-
}),
|
|
1299
|
-
};
|
|
1300
|
-
}
|
|
1301
|
-
const decompressed = result.buffer;
|
|
1302
|
-
if (decompressed.length > ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE) {
|
|
1303
|
-
return {
|
|
1304
|
-
success: false,
|
|
1305
|
-
entries: [],
|
|
1306
|
-
securityWarnings: [],
|
|
1307
|
-
error: this.createError(FileErrorCode.SECURITY_VALIDATION_FAILED, {
|
|
1308
|
-
reason: `Decompressed size (${this.formatSizeMB(decompressed.length)} MB) exceeds limit (${this.formatSizeMB(ARCHIVE_SECURITY.MAX_DECOMPRESSED_SIZE)} MB)`,
|
|
1309
|
-
}),
|
|
1310
|
-
};
|
|
1311
|
-
}
|
|
1312
|
-
if (this.looksLikeTar(decompressed)) {
|
|
1313
|
-
const tarStream = await import("tar-stream");
|
|
1314
|
-
return await this.parseTarStream(tarStream, decompressed);
|
|
1315
|
-
}
|
|
1316
|
-
const contents = new Map();
|
|
1317
|
-
const text = this.decodeEntryText(decompressed);
|
|
1318
|
-
if (text !== null) {
|
|
1319
|
-
contents.set("decompressed-content", text.slice(0, ARCHIVE_CONFIG.MAX_EXTRACT_ENTRY_SIZE));
|
|
1320
|
-
}
|
|
1321
|
-
return {
|
|
1322
|
-
success: true,
|
|
1323
|
-
entries: [
|
|
1324
|
-
{
|
|
1325
|
-
name: "decompressed-content",
|
|
1326
|
-
uncompressedSize: decompressed.length,
|
|
1327
|
-
compressedSize: buffer.length,
|
|
1328
|
-
isDirectory: false,
|
|
1329
|
-
},
|
|
1330
|
-
],
|
|
1331
|
-
securityWarnings: [],
|
|
1332
|
-
contents,
|
|
1333
|
-
};
|
|
1334
|
-
}
|
|
1335
|
-
async extractEntryContents(buffer, entries) {
|
|
1336
|
-
const contents = new Map();
|
|
1337
|
-
try {
|
|
1338
|
-
const AdmZip = (await import("adm-zip")).default;
|
|
1339
|
-
const zip = new AdmZip(buffer);
|
|
1340
|
-
// Filter to extractable text-based entries within size limits
|
|
1341
|
-
const candidates = entries
|
|
1342
|
-
.filter((e) => {
|
|
1343
|
-
if (e.isDirectory) {
|
|
1344
|
-
return false;
|
|
1345
|
-
}
|
|
1346
|
-
if (e.uncompressedSize > ARCHIVE_CONFIG.MAX_EXTRACT_ENTRY_SIZE) {
|
|
1347
|
-
return false;
|
|
1348
|
-
}
|
|
1349
|
-
if (e.uncompressedSize === 0) {
|
|
1350
|
-
return false;
|
|
1351
|
-
}
|
|
1352
|
-
return this.isExtractableEntryName(e.name);
|
|
1353
|
-
})
|
|
1354
|
-
// Sort: smaller files first (more likely to fit), then by name
|
|
1355
|
-
.sort((a, b) => a.uncompressedSize - b.uncompressedSize);
|
|
1356
|
-
let totalExtracted = 0;
|
|
1357
|
-
let extractCount = 0;
|
|
1358
|
-
const zlibModule = await import("zlib");
|
|
1359
|
-
for (const entry of candidates) {
|
|
1360
|
-
if (extractCount >= ARCHIVE_CONFIG.MAX_EXTRACT_ENTRIES) {
|
|
1361
|
-
break;
|
|
1362
|
-
}
|
|
1363
|
-
if (totalExtracted + entry.uncompressedSize > ARCHIVE_CONFIG.MAX_TOTAL_EXTRACT_SIZE) {
|
|
1364
|
-
break;
|
|
1365
|
-
}
|
|
1366
|
-
try {
|
|
1367
|
-
const zipEntry = zip.getEntry(entry.name);
|
|
1368
|
-
if (!zipEntry) {
|
|
1369
|
-
continue;
|
|
1370
|
-
}
|
|
1371
|
-
// This path was already bounded, but only by coincidence: entries
|
|
1372
|
-
// declaring 0 are dropped above, oversized declarations are dropped
|
|
1373
|
-
// above, and adm-zip caps everything else at the size it declares.
|
|
1374
|
-
// That leaves the ceiling resting on library internals we do not
|
|
1375
|
-
// trust anywhere else in this file, so it is spelled out here.
|
|
1376
|
-
const read = readZipEntryWithinLimit(zipEntry, Math.min(ARCHIVE_CONFIG.MAX_EXTRACT_ENTRY_SIZE, ARCHIVE_CONFIG.MAX_TOTAL_EXTRACT_SIZE - totalExtracted), zlibModule);
|
|
1377
|
-
if (read.status !== "ok") {
|
|
1378
|
-
continue;
|
|
1379
|
-
}
|
|
1380
|
-
const data = read.buffer;
|
|
1381
|
-
if (data.length === 0) {
|
|
1382
|
-
continue;
|
|
1383
|
-
}
|
|
1384
|
-
// Simple binary detection: check for null bytes in first 512 bytes
|
|
1385
|
-
const sample = data.slice(0, Math.min(512, data.length));
|
|
1386
|
-
if (sample.includes(0)) {
|
|
1387
|
-
continue;
|
|
1388
|
-
}
|
|
1389
|
-
const text = data.toString("utf-8");
|
|
1390
|
-
// Sanity check: skip if too many replacement characters (likely binary)
|
|
1391
|
-
const replacementCount = (text.match(/\ufffd/g) || []).length;
|
|
1392
|
-
if (replacementCount > text.length * 0.05) {
|
|
1393
|
-
continue;
|
|
1394
|
-
}
|
|
1395
|
-
contents.set(entry.name, text);
|
|
1396
|
-
totalExtracted += data.length;
|
|
1397
|
-
extractCount++;
|
|
1398
|
-
}
|
|
1399
|
-
catch {
|
|
1400
|
-
// Skip entries that fail to extract (binary, corrupt, etc.)
|
|
1401
|
-
}
|
|
1402
|
-
}
|
|
1403
|
-
}
|
|
1404
|
-
catch {
|
|
1405
|
-
// If ZIP re-parsing fails, return empty — listing is still available
|
|
1406
|
-
}
|
|
1407
|
-
return contents;
|
|
1408
|
-
}
|
|
1409
|
-
// ===========================================================================
|
|
1410
|
-
// TEXT CONTENT BUILDING
|
|
1411
|
-
// ===========================================================================
|
|
1412
|
-
/**
|
|
1413
|
-
* Build a structured text description of the archive for LLM consumption.
|
|
1414
|
-
* Includes archive metadata, file listing with sizes, and security warnings.
|
|
1415
|
-
*
|
|
1416
|
-
* @param filename - Original archive filename
|
|
1417
|
-
* @param metadata - Aggregate archive metadata
|
|
1418
|
-
* @param entries - Individual entry metadata
|
|
1419
|
-
* @param securityWarnings - Security warnings encountered during processing
|
|
1420
|
-
* @param extractedContents - Map of entry name to extracted text content (Phase 2)
|
|
1421
|
-
* @returns Formatted text content string
|
|
1422
|
-
*/
|
|
1423
|
-
buildTextContent(filename, metadata, entries, securityWarnings, extractedContents) {
|
|
1424
|
-
const lines = [];
|
|
1425
|
-
// Header
|
|
1426
|
-
lines.push(`## Archive: ${filename}`);
|
|
1427
|
-
lines.push("");
|
|
1428
|
-
// Metadata
|
|
1429
|
-
lines.push("### Metadata");
|
|
1430
|
-
lines.push(`- **Format:** ${metadata.format.toUpperCase()}`);
|
|
1431
|
-
lines.push(`- **Total entries:** ${metadata.totalEntries}`);
|
|
1432
|
-
lines.push(`- **Total uncompressed size:** ${this.formatHumanReadableSize(metadata.totalUncompressedSize)}`);
|
|
1433
|
-
if (metadata.totalCompressedSize > 0) {
|
|
1434
|
-
lines.push(`- **Total compressed size:** ${this.formatHumanReadableSize(metadata.totalCompressedSize)}`);
|
|
1435
|
-
}
|
|
1436
|
-
lines.push("");
|
|
1437
|
-
// Security warnings
|
|
1438
|
-
if (securityWarnings.length > 0) {
|
|
1439
|
-
lines.push("### Security Warnings");
|
|
1440
|
-
for (const warning of securityWarnings) {
|
|
1441
|
-
lines.push(`- ${warning}`);
|
|
1442
|
-
}
|
|
1443
|
-
lines.push("");
|
|
1444
|
-
}
|
|
1445
|
-
// File listing
|
|
1446
|
-
lines.push("### Contents");
|
|
1447
|
-
lines.push("");
|
|
1448
|
-
// Separate directories and files
|
|
1449
|
-
const directories = entries.filter((e) => e.isDirectory);
|
|
1450
|
-
const files = entries.filter((e) => !e.isDirectory);
|
|
1451
|
-
if (directories.length > 0) {
|
|
1452
|
-
lines.push(`**Directories (${directories.length}):**`);
|
|
1453
|
-
for (const dir of directories) {
|
|
1454
|
-
lines.push(` ${dir.name}`);
|
|
1455
|
-
}
|
|
1456
|
-
lines.push("");
|
|
1457
|
-
}
|
|
1458
|
-
if (files.length > 0) {
|
|
1459
|
-
lines.push(`**Files (${files.length}):**`);
|
|
1460
|
-
// Sort files by path for readability
|
|
1461
|
-
const sortedFiles = [...files].sort((a, b) => a.name.localeCompare(b.name));
|
|
1462
|
-
for (const file of sortedFiles) {
|
|
1463
|
-
const sizeStr = this.formatHumanReadableSize(file.uncompressedSize);
|
|
1464
|
-
lines.push(` ${file.name} (${sizeStr})`);
|
|
1465
|
-
}
|
|
1466
|
-
lines.push("");
|
|
1467
|
-
}
|
|
1468
|
-
if (entries.length === 0) {
|
|
1469
|
-
lines.push("*Archive is empty.*");
|
|
1470
|
-
lines.push("");
|
|
1471
|
-
}
|
|
1472
|
-
// Extracted file contents (Phase 2 sub-processing)
|
|
1473
|
-
if (extractedContents && extractedContents.size > 0) {
|
|
1474
|
-
lines.push("### Extracted File Contents");
|
|
1475
|
-
lines.push("");
|
|
1476
|
-
extractedContents.forEach((content, entryName) => {
|
|
1477
|
-
const ext = path.extname(entryName).replace(".", "");
|
|
1478
|
-
const langHint = ext || "";
|
|
1479
|
-
lines.push(`#### ${entryName}`);
|
|
1480
|
-
lines.push(`\`\`\`${langHint}`);
|
|
1481
|
-
// Truncate very long file contents to avoid excessive token usage
|
|
1482
|
-
if (content.length > 10000) {
|
|
1483
|
-
lines.push(content.slice(0, 8000));
|
|
1484
|
-
lines.push(`\n... [truncated ${content.length - 8000} characters] ...`);
|
|
1485
|
-
lines.push(content.slice(-1000));
|
|
1486
|
-
}
|
|
1487
|
-
else {
|
|
1488
|
-
lines.push(content);
|
|
1489
|
-
}
|
|
1490
|
-
lines.push("```");
|
|
1491
|
-
lines.push("");
|
|
1492
|
-
});
|
|
1493
|
-
}
|
|
1494
|
-
return lines.join("\n");
|
|
1495
|
-
}
|
|
1496
|
-
/**
|
|
1497
|
-
* Format a byte count as a human-readable size string.
|
|
1498
|
-
*
|
|
1499
|
-
* @param bytes - Size in bytes
|
|
1500
|
-
* @returns Formatted string (e.g., "1.5 MB", "256 KB", "128 B")
|
|
1501
|
-
*/
|
|
1502
|
-
formatHumanReadableSize(bytes) {
|
|
1503
|
-
if (bytes === 0) {
|
|
1504
|
-
return "0 B";
|
|
1505
|
-
}
|
|
1506
|
-
const units = ["B", "KB", "MB", "GB"];
|
|
1507
|
-
const k = 1024;
|
|
1508
|
-
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
1509
|
-
const idx = Math.min(i, units.length - 1);
|
|
1510
|
-
return `${parseFloat((bytes / k ** idx).toFixed(2))} ${units[idx]}`;
|
|
1511
|
-
}
|
|
1512
|
-
// ===========================================================================
|
|
1513
|
-
// TARGETED EXTRACTION API
|
|
1514
|
-
// ===========================================================================
|
|
1515
|
-
/**
|
|
1516
|
-
* Extract a specific file from a ZIP archive and return its text content.
|
|
1517
|
-
*
|
|
1518
|
-
* Called by the `extract_file_content` tool for targeted access to files
|
|
1519
|
-
* inside archives. Only supports ZIP archives (the most common format).
|
|
1520
|
-
* Applies security checks (path traversal, size limits).
|
|
1521
|
-
*
|
|
1522
|
-
* @param buffer - Archive file buffer
|
|
1523
|
-
* @param entryPath - Path of the entry within the archive (e.g., "src/index.ts")
|
|
1524
|
-
* @returns Text content of the extracted file, or error message
|
|
1525
|
-
*/
|
|
1526
|
-
async extractEntry(buffer, entryPath) {
|
|
1527
|
-
try {
|
|
1528
|
-
const AdmZip = (await import("adm-zip")).default;
|
|
1529
|
-
const zip = new AdmZip(buffer);
|
|
1530
|
-
const entries = zip.getEntries();
|
|
1531
|
-
// Security: check for path traversal
|
|
1532
|
-
if (this.hasPathTraversal(entryPath)) {
|
|
1533
|
-
return `Security error: entry path "${entryPath}" contains path traversal.`;
|
|
1534
|
-
}
|
|
1535
|
-
// Find the matching entry (case-insensitive fallback)
|
|
1536
|
-
let targetEntry = entries.find((e) => e.entryName === entryPath);
|
|
1537
|
-
if (!targetEntry) {
|
|
1538
|
-
targetEntry = entries.find((e) => e.entryName.toLowerCase() === entryPath.toLowerCase());
|
|
1539
|
-
}
|
|
1540
|
-
if (!targetEntry) {
|
|
1541
|
-
// List available entries to help the LLM
|
|
1542
|
-
const available = entries
|
|
1543
|
-
.filter((e) => !e.isDirectory)
|
|
1544
|
-
.slice(0, 20)
|
|
1545
|
-
.map((e) => ` - ${e.entryName} (${this.formatHumanReadableSize(e.header.size)})`)
|
|
1546
|
-
.join("\n");
|
|
1547
|
-
return `Entry "${entryPath}" not found in archive.\n\nAvailable entries (first 20):\n${available}`;
|
|
1548
|
-
}
|
|
1549
|
-
if (targetEntry.isDirectory) {
|
|
1550
|
-
return `"${entryPath}" is a directory, not a file.`;
|
|
1551
|
-
}
|
|
1552
|
-
// Security: size check.
|
|
1553
|
-
//
|
|
1554
|
-
// The declared size is a hint, not the bound — it is chosen by whoever
|
|
1555
|
-
// built the archive, and an entry claiming 0 passes this comparison while
|
|
1556
|
-
// switching off adm-zip's own cap (see readZipEntryWithinLimit). It is
|
|
1557
|
-
// still worth checking, because an honestly-declared oversized entry is
|
|
1558
|
-
// refused here without decompressing anything at all.
|
|
1559
|
-
const maxSize = 5 * 1024 * 1024; // 5 MB
|
|
1560
|
-
if (targetEntry.header.size > maxSize) {
|
|
1561
|
-
return `Entry "${entryPath}" is too large (${this.formatHumanReadableSize(targetEntry.header.size)}). Maximum extraction size is 5 MB.`;
|
|
1562
|
-
}
|
|
1563
|
-
const zlibModule = await import("zlib");
|
|
1564
|
-
const read = readZipEntryWithinLimit(targetEntry, maxSize, zlibModule);
|
|
1565
|
-
if (read.status === "too-large") {
|
|
1566
|
-
return `Entry "${entryPath}" is too large. Maximum extraction size is 5 MB.`;
|
|
1567
|
-
}
|
|
1568
|
-
if (read.status === "unsupported-method") {
|
|
1569
|
-
return `Entry "${entryPath}" uses an unsupported compression method.`;
|
|
1570
|
-
}
|
|
1571
|
-
if (read.status === "corrupt") {
|
|
1572
|
-
return `Entry "${entryPath}" could not be read — the archive entry is corrupt.`;
|
|
1573
|
-
}
|
|
1574
|
-
const data = read.buffer;
|
|
1575
|
-
// Check if it looks like text
|
|
1576
|
-
const sampleSize = Math.min(data.length, 512);
|
|
1577
|
-
let printable = 0;
|
|
1578
|
-
for (let i = 0; i < sampleSize; i++) {
|
|
1579
|
-
const b = data[i];
|
|
1580
|
-
if ((b >= 0x20 && b <= 0x7e) || b === 0x09 || b === 0x0a || b === 0x0d || b >= 0x80) {
|
|
1581
|
-
printable++;
|
|
1582
|
-
}
|
|
1583
|
-
}
|
|
1584
|
-
if (sampleSize > 0 && printable / sampleSize < 0.8) {
|
|
1585
|
-
return `Entry "${entryPath}" appears to be a binary file (${this.formatHumanReadableSize(data.length)}). Cannot display as text.`;
|
|
1586
|
-
}
|
|
1587
|
-
return data.toString("utf-8");
|
|
1588
|
-
}
|
|
1589
|
-
catch (err) {
|
|
1590
|
-
return `Failed to extract entry "${entryPath}": ${err instanceof Error ? err.message : String(err)}`;
|
|
1591
|
-
}
|
|
1592
|
-
}
|
|
1593
|
-
}
|
|
1594
|
-
// =============================================================================
|
|
1595
|
-
// SINGLETON INSTANCE
|
|
1596
|
-
// =============================================================================
|
|
1597
|
-
/**
|
|
1598
|
-
* Singleton Archive processor instance.
|
|
1599
|
-
* Use this for standard archive processing operations.
|
|
1600
|
-
*
|
|
1601
|
-
* @example
|
|
1602
|
-
* ```typescript
|
|
1603
|
-
* import { archiveProcessor } from "./ArchiveProcessor.js";
|
|
1604
|
-
*
|
|
1605
|
-
* const result = await archiveProcessor.processFile(fileInfo);
|
|
1606
|
-
* ```
|
|
1607
|
-
*/
|
|
1608
|
-
export const archiveProcessor = new ArchiveProcessor();
|
|
1609
|
-
// =============================================================================
|
|
1610
|
-
// HELPER FUNCTIONS
|
|
1611
|
-
// =============================================================================
|
|
1612
|
-
/**
|
|
1613
|
-
* Check if a file is an archive file.
|
|
1614
|
-
* Matches by MIME type or file extension.
|
|
1615
|
-
*
|
|
1616
|
-
* @param mimetype - MIME type of the file
|
|
1617
|
-
* @param filename - Filename (for extension-based detection)
|
|
1618
|
-
* @returns true if the file is a recognized archive format
|
|
1619
|
-
*
|
|
1620
|
-
* @example
|
|
1621
|
-
* ```typescript
|
|
1622
|
-
* if (isArchiveFile("application/zip", "backup.zip")) {
|
|
1623
|
-
* // Process as archive
|
|
1624
|
-
* }
|
|
1625
|
-
*
|
|
1626
|
-
* if (isArchiveFile("", "data.tar.gz")) {
|
|
1627
|
-
* // Also matches by extension
|
|
1628
|
-
* }
|
|
1629
|
-
* ```
|
|
1630
|
-
*/
|
|
1631
|
-
export function isArchiveFile(mimetype, filename) {
|
|
1632
|
-
return archiveProcessor.isFileSupported(mimetype, filename);
|
|
1633
|
-
}
|
|
1634
|
-
/**
|
|
1635
|
-
* Process a single archive file.
|
|
1636
|
-
* Convenience function that uses the singleton processor.
|
|
1637
|
-
*
|
|
1638
|
-
* @param fileInfo - File information (can include URL or buffer)
|
|
1639
|
-
* @param options - Optional processing options (auth headers, timeout, etc.)
|
|
1640
|
-
* @returns Processing result with archive metadata and entry listing, or error
|
|
1641
|
-
*
|
|
1642
|
-
* @example
|
|
1643
|
-
* ```typescript
|
|
1644
|
-
* import { processArchive } from "./ArchiveProcessor.js";
|
|
1645
|
-
*
|
|
1646
|
-
* const result = await processArchive(fileInfo, {
|
|
1647
|
-
* authHeaders: { Authorization: "Bearer token" },
|
|
1648
|
-
* });
|
|
1649
|
-
*
|
|
1650
|
-
* if (result.success) {
|
|
1651
|
-
* const { archiveMetadata, entries, textContent } = result.data;
|
|
1652
|
-
* console.log(`Found ${entries.length} entries in ${archiveMetadata.format} archive`);
|
|
1653
|
-
* console.log(textContent);
|
|
1654
|
-
* } else {
|
|
1655
|
-
* console.error(`Processing failed: ${result.error?.userMessage}`);
|
|
1656
|
-
* }
|
|
1657
|
-
* ```
|
|
1658
|
-
*/
|
|
1659
|
-
export async function processArchive(fileInfo, options) {
|
|
1660
|
-
return archiveProcessor.processFile(fileInfo, options);
|
|
1661
|
-
}
|
|
1662
|
-
//# sourceMappingURL=ArchiveProcessor.js.map
|