@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,1527 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CSV Processing Utility
|
|
3
|
-
* Converts CSV files to LLM-friendly text formats
|
|
4
|
-
* Uses streaming for memory efficiency with large files
|
|
5
|
-
*/
|
|
6
|
-
import csvParser from "csv-parser";
|
|
7
|
-
import iconv from "iconv-lite";
|
|
8
|
-
import { Readable, Transform } from "stream";
|
|
9
|
-
import { extname } from "path";
|
|
10
|
-
import { logger } from "./logger.js";
|
|
11
|
-
import { splitCSVFields, detectDelimiter as detectDelimiterUtil, CANDIDATE_DELIMITERS, } from "./csvUtils.js";
|
|
12
|
-
import { isObject } from "./typeUtils.js";
|
|
13
|
-
import { decodeBuffer } from "./textEncoding.js";
|
|
14
|
-
import { ErrorFactory } from "./errorHandling.js";
|
|
15
|
-
import { withTimeout, TimeoutError } from "./async/withTimeout.js";
|
|
16
|
-
// ============================================================================
|
|
17
|
-
// Parse Safety Limits (#371 / #379)
|
|
18
|
-
// ============================================================================
|
|
19
|
-
/**
|
|
20
|
-
* Upper bound on a single CSV row's byte size (#371). csv-parser defaults to an
|
|
21
|
-
* effectively-unbounded `maxRowBytes`; a pathological unbroken row would grow
|
|
22
|
-
* memory without limit and never fire the parser's own error path. 10 MB/row is
|
|
23
|
-
* generous for legitimate data (e.g. a large JSON blob in one cell) while
|
|
24
|
-
* bounding a single allocation and making the parser-error cleanup path
|
|
25
|
-
* reachable/testable.
|
|
26
|
-
*/
|
|
27
|
-
const CSV_MAX_ROW_BYTES = 10 * 1024 * 1024;
|
|
28
|
-
/** Default wall-clock cap for `parseCSVString` (#379). */
|
|
29
|
-
const DEFAULT_CSV_STRING_PARSE_TIMEOUT_MS = 30_000;
|
|
30
|
-
/** Default wall-clock cap for `parseCSVFile` (#379). */
|
|
31
|
-
const DEFAULT_CSV_FILE_PARSE_TIMEOUT_MS = 300_000;
|
|
32
|
-
// ============================================================================
|
|
33
|
-
// Data Type Detection Patterns
|
|
34
|
-
// ============================================================================
|
|
35
|
-
const DATE_PATTERNS = [
|
|
36
|
-
{ regex: /^\d{4}-\d{2}-\d{2}$/, format: "YYYY-MM-DD" },
|
|
37
|
-
{ regex: /^\d{2}\/\d{2}\/\d{4}$/, format: "MM/DD/YYYY" },
|
|
38
|
-
{ regex: /^\d{2}-\d{2}-\d{4}$/, format: "DD-MM-YYYY" },
|
|
39
|
-
{ regex: /^\d{2}\.\d{2}\.\d{4}$/, format: "DD.MM.YYYY" },
|
|
40
|
-
{ regex: /^\d{4}\/\d{2}\/\d{2}$/, format: "YYYY/MM/DD" },
|
|
41
|
-
];
|
|
42
|
-
const DATETIME_PATTERNS = [
|
|
43
|
-
{ regex: /^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}/, format: "ISO8601" },
|
|
44
|
-
{ regex: /^\d{2}\/\d{2}\/\d{4} \d{2}:\d{2}/, format: "MM/DD/YYYY HH:mm" },
|
|
45
|
-
];
|
|
46
|
-
const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
|
|
47
|
-
const URL_REGEX = /^(https?:\/\/|www\.)[^\s]+$/i;
|
|
48
|
-
const INTEGER_REGEX = /^-?\d+$/;
|
|
49
|
-
const FLOAT_REGEX = /^-?\d+\.\d+$/;
|
|
50
|
-
const BOOLEAN_VALUES = new Set([
|
|
51
|
-
"true",
|
|
52
|
-
"false",
|
|
53
|
-
"yes",
|
|
54
|
-
"no",
|
|
55
|
-
"1",
|
|
56
|
-
"0",
|
|
57
|
-
"t",
|
|
58
|
-
"f",
|
|
59
|
-
"y",
|
|
60
|
-
"n",
|
|
61
|
-
]);
|
|
62
|
-
// ============================================================================
|
|
63
|
-
// Column Name Validation
|
|
64
|
-
// ============================================================================
|
|
65
|
-
/**
|
|
66
|
-
* Validate column name and return issues
|
|
67
|
-
*/
|
|
68
|
-
function validateColumnName(name) {
|
|
69
|
-
const issues = [];
|
|
70
|
-
if (!name || name.trim() === "") {
|
|
71
|
-
issues.push("Empty or blank column name");
|
|
72
|
-
return issues;
|
|
73
|
-
}
|
|
74
|
-
if (name !== name.trim()) {
|
|
75
|
-
issues.push("Leading or trailing whitespace");
|
|
76
|
-
}
|
|
77
|
-
if (/^\d/.test(name)) {
|
|
78
|
-
issues.push("Starts with a number");
|
|
79
|
-
}
|
|
80
|
-
if (/[^a-zA-Z0-9_\- ]/.test(name)) {
|
|
81
|
-
issues.push("Contains special characters");
|
|
82
|
-
}
|
|
83
|
-
if (name.length > 64) {
|
|
84
|
-
issues.push("Name exceeds 64 characters");
|
|
85
|
-
}
|
|
86
|
-
if (/\s{2,}/.test(name)) {
|
|
87
|
-
issues.push("Contains multiple consecutive spaces");
|
|
88
|
-
}
|
|
89
|
-
return issues;
|
|
90
|
-
}
|
|
91
|
-
// ============================================================================
|
|
92
|
-
// Column Name Sanitization (#378)
|
|
93
|
-
// ============================================================================
|
|
94
|
-
/**
|
|
95
|
-
* Rewrite a raw header into a valid identifier. Trims, replaces non-identifier
|
|
96
|
-
* runs with `_`, prefixes a `col_` when it starts with a digit or is empty,
|
|
97
|
-
* then applies the requested case style. Never returns an empty string.
|
|
98
|
-
*/
|
|
99
|
-
export function sanitizeColumnName(name, style = "snake_case", index = 0) {
|
|
100
|
-
const trimmed = (name ?? "").trim();
|
|
101
|
-
// Split on runs of non-alphanumeric characters. Using split (linear) instead
|
|
102
|
-
// of a `^_+|_+$` trim regex avoids the polynomial-backtracking ReDoS CodeQL
|
|
103
|
-
// flags on long underscore/separator runs, and drops leading/trailing/empty
|
|
104
|
-
// segments naturally.
|
|
105
|
-
let parts = trimmed.split(/[^A-Za-z0-9]+/).filter((p) => p.length > 0);
|
|
106
|
-
let base = parts.join("_");
|
|
107
|
-
if (base === "") {
|
|
108
|
-
base = `col_${index + 1}`;
|
|
109
|
-
parts = [base];
|
|
110
|
-
}
|
|
111
|
-
else if (/^[0-9]/.test(base)) {
|
|
112
|
-
base = `col_${base}`;
|
|
113
|
-
parts = base.split("_").filter((p) => p.length > 0);
|
|
114
|
-
}
|
|
115
|
-
if (style === "camelCase") {
|
|
116
|
-
return parts
|
|
117
|
-
.map((p, i) => i === 0
|
|
118
|
-
? p.charAt(0).toLowerCase() + p.slice(1)
|
|
119
|
-
: p.charAt(0).toUpperCase() + p.slice(1))
|
|
120
|
-
.join("");
|
|
121
|
-
}
|
|
122
|
-
return parts.map((p) => p.toLowerCase()).join("_");
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Deduplicate a list of (already sanitized) names by suffixing `_2`, `_3`, … on
|
|
126
|
-
* collisions, preserving order. The suffixed candidate is bumped until it does
|
|
127
|
-
* not collide with ANY already-emitted name — so an existing `name_2` can't be
|
|
128
|
-
* silently overwritten by a generated `name_2` (which the naive counter did for
|
|
129
|
-
* `["name","name","name_2"]`).
|
|
130
|
-
*/
|
|
131
|
-
export function dedupeColumnNames(names) {
|
|
132
|
-
const used = new Set();
|
|
133
|
-
return names.map((name) => {
|
|
134
|
-
if (!used.has(name)) {
|
|
135
|
-
used.add(name);
|
|
136
|
-
return name;
|
|
137
|
-
}
|
|
138
|
-
let n = 2;
|
|
139
|
-
let candidate = `${name}_${n}`;
|
|
140
|
-
while (used.has(candidate)) {
|
|
141
|
-
n++;
|
|
142
|
-
candidate = `${name}_${n}`;
|
|
143
|
-
}
|
|
144
|
-
used.add(candidate);
|
|
145
|
-
return candidate;
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Compute sanitized (and deduped) column names plus the original→sanitized
|
|
150
|
-
* mapping for the names that actually changed.
|
|
151
|
-
*/
|
|
152
|
-
function buildColumnNameMapping(headers, style) {
|
|
153
|
-
const sanitized = dedupeColumnNames(headers.map((h, i) => sanitizeColumnName(h, style, i)));
|
|
154
|
-
const mapping = headers
|
|
155
|
-
.map((original, i) => ({ original, sanitized: sanitized[i] }))
|
|
156
|
-
.filter((m) => m.original !== m.sanitized);
|
|
157
|
-
return { sanitized, mapping };
|
|
158
|
-
}
|
|
159
|
-
// ============================================================================
|
|
160
|
-
// Row Validation (#384)
|
|
161
|
-
// ============================================================================
|
|
162
|
-
/**
|
|
163
|
-
* Predicate form of the row-shape invariant: a non-null, non-array object whose
|
|
164
|
-
* every value is a string or undefined. csv-parser's default output always
|
|
165
|
-
* satisfies this; the guard is defense-in-depth at the parse boundary.
|
|
166
|
-
*/
|
|
167
|
-
export function isValidCsvRow(row) {
|
|
168
|
-
if (!isObject(row) || Array.isArray(row)) {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
return Object.values(row).every((v) => typeof v === "string" || v === undefined);
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Assertion form used inside the streaming `data` handlers. Throws a
|
|
175
|
-
* `[CSVProcessor]`-prefixed error (so existing `includes("CSV")` catches still
|
|
176
|
-
* match) when a row violates the invariant.
|
|
177
|
-
*/
|
|
178
|
-
export function assertValidCsvRow(row, rowNumber) {
|
|
179
|
-
if (!isValidCsvRow(row)) {
|
|
180
|
-
throw ErrorFactory.csvRowInvalid(`[CSVProcessor] Invalid CSV row ${rowNumber}: expected a string-keyed object with string values, got ${Array.isArray(row) ? "array" : typeof row}`, rowNumber);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* True when a parsed CSV row is blank: no keys, or every value is empty /
|
|
185
|
-
* whitespace-only (#373). Shared by the structured post-filter and by
|
|
186
|
-
* `streamParse` so blank rows do not consume `maxRows`.
|
|
187
|
-
*/
|
|
188
|
-
export function isBlankCsvDataRow(row) {
|
|
189
|
-
const keys = Object.keys(row);
|
|
190
|
-
if (keys.length === 0) {
|
|
191
|
-
return true;
|
|
192
|
-
}
|
|
193
|
-
return Object.values(row).every((val) => val === "" || (typeof val === "string" && val.trim() === ""));
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Raw-line counterpart of {@link isBlankCsvDataRow} (#373): a fully blank /
|
|
197
|
-
* whitespace line, or a delimiter-only line such as `,,` / ` , ` whose
|
|
198
|
-
* fields are all empty after a CSV-aware split.
|
|
199
|
-
*/
|
|
200
|
-
export function isBlankCsvRawLine(line, delimiter) {
|
|
201
|
-
if (line.trim() === "") {
|
|
202
|
-
return true;
|
|
203
|
-
}
|
|
204
|
-
const fields = splitCSVFields(line, delimiter);
|
|
205
|
-
if (fields.length === 0) {
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
const row = Object.create(null);
|
|
209
|
-
for (let i = 0; i < fields.length; i++) {
|
|
210
|
-
row[`c${i}`] = fields[i];
|
|
211
|
-
}
|
|
212
|
-
return isBlankCsvDataRow(row);
|
|
213
|
-
}
|
|
214
|
-
// ============================================================================
|
|
215
|
-
// Parse Error Context (#375)
|
|
216
|
-
// ============================================================================
|
|
217
|
-
/**
|
|
218
|
-
* Build an enriched, consistent parse-failure message shared by all four
|
|
219
|
-
* source/parser reject sites so they can't re-diverge.
|
|
220
|
-
*
|
|
221
|
-
* Deliberately structural-only: `headerCount` and `lastRowColumnCount` report
|
|
222
|
-
* how many columns the header/last row had — counts, never the actual header
|
|
223
|
-
* or cell string values. Parsed header text is user-controlled CSV data (and,
|
|
224
|
-
* for headerless input, may literally be first-row cell values), so it must
|
|
225
|
-
* never be embedded in a thrown/logged message (#1199).
|
|
226
|
-
*/
|
|
227
|
-
function buildCsvParseErrorMessage(info) {
|
|
228
|
-
const parts = [
|
|
229
|
-
`[CSVProcessor] CSV ${info.stage === "read" ? "file read" : "parsing"} failed after ${info.count} row(s)`,
|
|
230
|
-
];
|
|
231
|
-
if (info.location) {
|
|
232
|
-
parts.push(`(${info.location})`);
|
|
233
|
-
}
|
|
234
|
-
parts.push(`: ${info.cause}`);
|
|
235
|
-
parts.push(typeof info.headerCount === "number"
|
|
236
|
-
? `| headerCount: ${info.headerCount}`
|
|
237
|
-
: "| headerCount: unknown (failed before headers were parsed)");
|
|
238
|
-
if (typeof info.bytesRead === "number") {
|
|
239
|
-
parts.push(`| bytesRead: ${info.bytesRead}`);
|
|
240
|
-
}
|
|
241
|
-
if (typeof info.lastRowColumnCount === "number") {
|
|
242
|
-
parts.push(`| lastRow columns: ${info.lastRowColumnCount}`);
|
|
243
|
-
}
|
|
244
|
-
parts.push("| Expected RFC 4180 CSV (comma-separated, double-quote escaped)");
|
|
245
|
-
return parts.join(" ");
|
|
246
|
-
}
|
|
247
|
-
// ============================================================================
|
|
248
|
-
// Data Type Detection
|
|
249
|
-
// ============================================================================
|
|
250
|
-
/**
|
|
251
|
-
* Detect the data type of a single value
|
|
252
|
-
*/
|
|
253
|
-
function detectValueType(value) {
|
|
254
|
-
if (value === "" || value === null || value === undefined) {
|
|
255
|
-
return "empty";
|
|
256
|
-
}
|
|
257
|
-
const trimmed = value.trim();
|
|
258
|
-
if (trimmed === "") {
|
|
259
|
-
return "empty";
|
|
260
|
-
}
|
|
261
|
-
// Check boolean first (before numbers since "1" and "0" could be both)
|
|
262
|
-
if (BOOLEAN_VALUES.has(trimmed.toLowerCase())) {
|
|
263
|
-
return "boolean";
|
|
264
|
-
}
|
|
265
|
-
// Check integer
|
|
266
|
-
if (INTEGER_REGEX.test(trimmed)) {
|
|
267
|
-
return "integer";
|
|
268
|
-
}
|
|
269
|
-
// Check float
|
|
270
|
-
if (FLOAT_REGEX.test(trimmed)) {
|
|
271
|
-
return "float";
|
|
272
|
-
}
|
|
273
|
-
// Check email
|
|
274
|
-
if (EMAIL_REGEX.test(trimmed)) {
|
|
275
|
-
return "email";
|
|
276
|
-
}
|
|
277
|
-
// Check URL
|
|
278
|
-
if (URL_REGEX.test(trimmed)) {
|
|
279
|
-
return "url";
|
|
280
|
-
}
|
|
281
|
-
// Check datetime (before date since datetime is more specific)
|
|
282
|
-
for (const pattern of DATETIME_PATTERNS) {
|
|
283
|
-
if (pattern.regex.test(trimmed)) {
|
|
284
|
-
return "datetime";
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
// Check date
|
|
288
|
-
for (const pattern of DATE_PATTERNS) {
|
|
289
|
-
if (pattern.regex.test(trimmed)) {
|
|
290
|
-
return "date";
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
return "string";
|
|
294
|
-
}
|
|
295
|
-
/**
|
|
296
|
-
* Detect date format from value
|
|
297
|
-
*/
|
|
298
|
-
function detectDateFormat(value) {
|
|
299
|
-
const trimmed = value.trim();
|
|
300
|
-
for (const pattern of DATETIME_PATTERNS) {
|
|
301
|
-
if (pattern.regex.test(trimmed)) {
|
|
302
|
-
return pattern.format;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
for (const pattern of DATE_PATTERNS) {
|
|
306
|
-
if (pattern.regex.test(trimmed)) {
|
|
307
|
-
return pattern.format;
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
return undefined;
|
|
311
|
-
}
|
|
312
|
-
/**
|
|
313
|
-
* Determine the predominant type for a column based on sampled values
|
|
314
|
-
*/
|
|
315
|
-
function determineColumnType(types) {
|
|
316
|
-
const nonEmpty = types.filter((t) => t !== "empty");
|
|
317
|
-
if (nonEmpty.length === 0) {
|
|
318
|
-
return { type: "empty", confidence: 100 };
|
|
319
|
-
}
|
|
320
|
-
// Count occurrences of each type
|
|
321
|
-
const typeCounts = new Map();
|
|
322
|
-
for (const t of nonEmpty) {
|
|
323
|
-
typeCounts.set(t, (typeCounts.get(t) || 0) + 1);
|
|
324
|
-
}
|
|
325
|
-
// Find the most common type
|
|
326
|
-
let maxType = "string";
|
|
327
|
-
let maxCount = 0;
|
|
328
|
-
for (const [type, count] of typeCounts) {
|
|
329
|
-
if (count > maxCount) {
|
|
330
|
-
maxCount = count;
|
|
331
|
-
maxType = type;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
// Calculate confidence
|
|
335
|
-
const confidence = Math.round((maxCount / nonEmpty.length) * 100);
|
|
336
|
-
// Consolidate integer and float into number if the column contains only numeric types
|
|
337
|
-
// This check must happen before the mixed-type check to avoid classifying numeric-only columns as mixed
|
|
338
|
-
if (typeCounts.has("integer") && typeCounts.has("float")) {
|
|
339
|
-
// Check if these are the only two types (purely numeric column)
|
|
340
|
-
if (typeCounts.size === 2) {
|
|
341
|
-
const totalNumeric = (typeCounts.get("integer") || 0) + (typeCounts.get("float") || 0);
|
|
342
|
-
const numericConfidence = Math.round((totalNumeric / nonEmpty.length) * 100);
|
|
343
|
-
return { type: "number", confidence: numericConfidence };
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
// If confidence is low and multiple types exist, mark as mixed
|
|
347
|
-
if (confidence < 70 && typeCounts.size > 1) {
|
|
348
|
-
return { type: "mixed", confidence };
|
|
349
|
-
}
|
|
350
|
-
return { type: maxType, confidence };
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* Analyze a single column and return rich metadata
|
|
354
|
-
*/
|
|
355
|
-
function analyzeColumn(columnName, columnIndex, values) {
|
|
356
|
-
const types = [];
|
|
357
|
-
const uniqueValues = new Set();
|
|
358
|
-
const numericValues = [];
|
|
359
|
-
let nullCount = 0;
|
|
360
|
-
let dateFormat;
|
|
361
|
-
for (const value of values) {
|
|
362
|
-
const trimmed = value?.trim() ?? "";
|
|
363
|
-
if (trimmed === "") {
|
|
364
|
-
nullCount++;
|
|
365
|
-
types.push("empty");
|
|
366
|
-
continue;
|
|
367
|
-
}
|
|
368
|
-
uniqueValues.add(trimmed);
|
|
369
|
-
const type = detectValueType(trimmed);
|
|
370
|
-
types.push(type);
|
|
371
|
-
// Collect numeric values for statistics
|
|
372
|
-
if (type === "integer" || type === "float") {
|
|
373
|
-
const num = parseFloat(trimmed);
|
|
374
|
-
if (!isNaN(num)) {
|
|
375
|
-
numericValues.push(num);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
// Detect date format
|
|
379
|
-
if ((type === "date" || type === "datetime") && !dateFormat) {
|
|
380
|
-
dateFormat = detectDateFormat(trimmed);
|
|
381
|
-
}
|
|
382
|
-
}
|
|
383
|
-
const { type: detectedType, confidence } = determineColumnType(types);
|
|
384
|
-
// Get sample values (up to 5 unique non-empty)
|
|
385
|
-
const sampleValues = Array.from(uniqueValues).slice(0, 5);
|
|
386
|
-
// Calculate numeric statistics
|
|
387
|
-
let minValue;
|
|
388
|
-
let maxValue;
|
|
389
|
-
let avgValue;
|
|
390
|
-
if (numericValues.length > 0) {
|
|
391
|
-
minValue = Math.min(...numericValues);
|
|
392
|
-
maxValue = Math.max(...numericValues);
|
|
393
|
-
avgValue =
|
|
394
|
-
Math.round((numericValues.reduce((a, b) => a + b, 0) / numericValues.length) * 100) / 100;
|
|
395
|
-
}
|
|
396
|
-
// Validate column name
|
|
397
|
-
const nameIssues = validateColumnName(columnName);
|
|
398
|
-
const metadata = {
|
|
399
|
-
name: columnName,
|
|
400
|
-
index: columnIndex,
|
|
401
|
-
detectedType,
|
|
402
|
-
typeConfidence: confidence,
|
|
403
|
-
nullCount,
|
|
404
|
-
uniqueCount: uniqueValues.size,
|
|
405
|
-
sampleValues,
|
|
406
|
-
};
|
|
407
|
-
if (minValue !== undefined) {
|
|
408
|
-
metadata.minValue = minValue;
|
|
409
|
-
}
|
|
410
|
-
if (maxValue !== undefined) {
|
|
411
|
-
metadata.maxValue = maxValue;
|
|
412
|
-
}
|
|
413
|
-
if (avgValue !== undefined) {
|
|
414
|
-
metadata.avgValue = avgValue;
|
|
415
|
-
}
|
|
416
|
-
if (dateFormat) {
|
|
417
|
-
metadata.dateFormat = dateFormat;
|
|
418
|
-
}
|
|
419
|
-
if (nameIssues.length > 0) {
|
|
420
|
-
metadata.nameIssues = nameIssues;
|
|
421
|
-
}
|
|
422
|
-
return metadata;
|
|
423
|
-
}
|
|
424
|
-
/**
|
|
425
|
-
* Generate data quality warnings based on column analysis
|
|
426
|
-
*/
|
|
427
|
-
function generateDataQualityWarnings(columns, totalRows) {
|
|
428
|
-
const warnings = [];
|
|
429
|
-
for (const col of columns) {
|
|
430
|
-
// Check for high null rate (>20%)
|
|
431
|
-
const nullRate = totalRows > 0 ? col.nullCount / totalRows : 0;
|
|
432
|
-
if (nullRate > 0.2) {
|
|
433
|
-
warnings.push({
|
|
434
|
-
column: col.name,
|
|
435
|
-
type: "high_null_rate",
|
|
436
|
-
message: `Column has ${Math.round(nullRate * 100)}% empty/null values (${col.nullCount} of ${totalRows} rows)`,
|
|
437
|
-
severity: nullRate > 0.5 ? "warning" : "info",
|
|
438
|
-
affectedRows: col.nullCount,
|
|
439
|
-
});
|
|
440
|
-
}
|
|
441
|
-
// Check for invalid column names
|
|
442
|
-
if (col.nameIssues && col.nameIssues.length > 0) {
|
|
443
|
-
warnings.push({
|
|
444
|
-
column: col.name,
|
|
445
|
-
type: "invalid_name",
|
|
446
|
-
message: `Column name issues: ${col.nameIssues.join(", ")}`,
|
|
447
|
-
severity: col.name.trim() === "" ? "error" : "warning",
|
|
448
|
-
});
|
|
449
|
-
}
|
|
450
|
-
// Check for mixed types (low confidence)
|
|
451
|
-
if (col.detectedType === "mixed" || col.typeConfidence < 70) {
|
|
452
|
-
warnings.push({
|
|
453
|
-
column: col.name,
|
|
454
|
-
type: "mixed_types",
|
|
455
|
-
message: `Column has inconsistent data types (${col.typeConfidence}% confidence for ${col.detectedType})`,
|
|
456
|
-
severity: "warning",
|
|
457
|
-
});
|
|
458
|
-
}
|
|
459
|
-
// Check for potential duplicates (very low unique count)
|
|
460
|
-
if (totalRows > 10 && col.uniqueCount === 1 && col.nullCount === 0) {
|
|
461
|
-
warnings.push({
|
|
462
|
-
column: col.name,
|
|
463
|
-
type: "duplicates",
|
|
464
|
-
message: `All ${totalRows} rows have the same value`,
|
|
465
|
-
severity: "info",
|
|
466
|
-
affectedRows: totalRows,
|
|
467
|
-
});
|
|
468
|
-
}
|
|
469
|
-
// Check for all empty column
|
|
470
|
-
if (col.detectedType === "empty") {
|
|
471
|
-
warnings.push({
|
|
472
|
-
column: col.name,
|
|
473
|
-
type: "empty_values",
|
|
474
|
-
message: "Column is entirely empty",
|
|
475
|
-
severity: "warning",
|
|
476
|
-
affectedRows: totalRows,
|
|
477
|
-
});
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
return warnings;
|
|
481
|
-
}
|
|
482
|
-
/**
|
|
483
|
-
* Calculate overall data quality score
|
|
484
|
-
*/
|
|
485
|
-
function calculateDataQualityScore(columns, warnings, totalRows) {
|
|
486
|
-
if (columns.length === 0 || totalRows === 0) {
|
|
487
|
-
return 0;
|
|
488
|
-
}
|
|
489
|
-
let score = 100;
|
|
490
|
-
// Deduct for warnings
|
|
491
|
-
for (const warning of warnings) {
|
|
492
|
-
switch (warning.severity) {
|
|
493
|
-
case "error":
|
|
494
|
-
score -= 15;
|
|
495
|
-
break;
|
|
496
|
-
case "warning":
|
|
497
|
-
score -= 8;
|
|
498
|
-
break;
|
|
499
|
-
case "info":
|
|
500
|
-
score -= 3;
|
|
501
|
-
break;
|
|
502
|
-
}
|
|
503
|
-
}
|
|
504
|
-
// Deduct for overall null rate
|
|
505
|
-
const totalNulls = columns.reduce((sum, col) => sum + col.nullCount, 0);
|
|
506
|
-
const totalCells = columns.length * totalRows;
|
|
507
|
-
const overallNullRate = totalCells > 0 ? totalNulls / totalCells : 0;
|
|
508
|
-
score -= Math.round(overallNullRate * 30);
|
|
509
|
-
// Deduct for low type confidence
|
|
510
|
-
const avgConfidence = columns.reduce((sum, col) => sum + col.typeConfidence, 0) / columns.length;
|
|
511
|
-
if (avgConfidence < 80) {
|
|
512
|
-
score -= Math.round((80 - avgConfidence) / 2);
|
|
513
|
-
}
|
|
514
|
-
return Math.max(0, Math.min(100, score));
|
|
515
|
-
}
|
|
516
|
-
/**
|
|
517
|
-
* Analyze all columns in parsed CSV data
|
|
518
|
-
*/
|
|
519
|
-
/**
|
|
520
|
-
* Confidence for a CSV processing result, weighted by data quality.
|
|
521
|
-
*
|
|
522
|
-
* The result used to report a static `confidence: 100` regardless of how clean
|
|
523
|
-
* the data was. This ties confidence to `dataQualityScore` so it actually
|
|
524
|
-
* varies with quality factors (ragged rows, high null rate, type
|
|
525
|
-
* inconsistency): a cleanly-parsed CSV stays at 100, a messy one is pulled
|
|
526
|
-
* halfway toward its quality score. It never drops below 50 for a CSV that
|
|
527
|
-
* parsed — the *format* is certain, only the *data* is imperfect.
|
|
528
|
-
*/
|
|
529
|
-
function csvResultConfidence(dataQualityScore) {
|
|
530
|
-
const clamped = Math.max(0, Math.min(100, dataQualityScore));
|
|
531
|
-
return Math.round((100 + clamped) / 2);
|
|
532
|
-
}
|
|
533
|
-
function analyzeColumns(rows) {
|
|
534
|
-
if (rows.length === 0) {
|
|
535
|
-
return {
|
|
536
|
-
columnMetadata: [],
|
|
537
|
-
dataQualityWarnings: [],
|
|
538
|
-
dataQualityScore: 0,
|
|
539
|
-
};
|
|
540
|
-
}
|
|
541
|
-
const columnNames = Object.keys(rows[0]);
|
|
542
|
-
const columnMetadata = [];
|
|
543
|
-
for (let i = 0; i < columnNames.length; i++) {
|
|
544
|
-
const colName = columnNames[i];
|
|
545
|
-
const values = rows.map((row) => String(row[colName] ?? ""));
|
|
546
|
-
columnMetadata.push(analyzeColumn(colName, i, values));
|
|
547
|
-
}
|
|
548
|
-
const dataQualityWarnings = generateDataQualityWarnings(columnMetadata, rows.length);
|
|
549
|
-
const dataQualityScore = calculateDataQualityScore(columnMetadata, dataQualityWarnings, rows.length);
|
|
550
|
-
return {
|
|
551
|
-
columnMetadata,
|
|
552
|
-
dataQualityWarnings,
|
|
553
|
-
dataQualityScore,
|
|
554
|
-
};
|
|
555
|
-
}
|
|
556
|
-
/**
|
|
557
|
-
* Detect if the first row appears to be a header row
|
|
558
|
-
*
|
|
559
|
-
* Heuristics used:
|
|
560
|
-
* 1. Header values should be text/string type (not numbers, dates, emails, etc.)
|
|
561
|
-
* 2. Header values should be unique (no duplicate column names)
|
|
562
|
-
* 3. If data rows exist, headers should have different type profile than data
|
|
563
|
-
*
|
|
564
|
-
* @param headerValues - The values from the first row (potential headers)
|
|
565
|
-
* @param dataRows - Sample of data rows for comparison (optional)
|
|
566
|
-
* @returns true if the first row appears to be headers
|
|
567
|
-
*/
|
|
568
|
-
function detectHasHeaders(headerValues, dataRows) {
|
|
569
|
-
if (headerValues.length === 0) {
|
|
570
|
-
return false;
|
|
571
|
-
}
|
|
572
|
-
// Check 1: All header values should look like text labels, not data values
|
|
573
|
-
let textLikeCount = 0;
|
|
574
|
-
for (const value of headerValues) {
|
|
575
|
-
const trimmed = value?.trim() ?? "";
|
|
576
|
-
if (trimmed === "") {
|
|
577
|
-
continue; // Empty headers are allowed but don't count toward text-like
|
|
578
|
-
}
|
|
579
|
-
const type = detectValueType(trimmed);
|
|
580
|
-
// Headers are typically strings - not numbers, dates, emails, URLs, or booleans
|
|
581
|
-
if (type === "string") {
|
|
582
|
-
textLikeCount++;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
// If most header values are text-like (not numeric/date/etc.), likely headers
|
|
586
|
-
const nonEmptyHeaders = headerValues.filter((v) => v?.trim()).length;
|
|
587
|
-
if (nonEmptyHeaders === 0) {
|
|
588
|
-
return false;
|
|
589
|
-
}
|
|
590
|
-
const textRatio = textLikeCount / nonEmptyHeaders;
|
|
591
|
-
// Check 2: Headers should be unique
|
|
592
|
-
const uniqueHeaders = new Set(headerValues.map((v) => v?.trim().toLowerCase()));
|
|
593
|
-
const hasUniqueHeaders = uniqueHeaders.size === headerValues.length;
|
|
594
|
-
// Check 3: Compare with data rows if available
|
|
595
|
-
if (dataRows && dataRows.length > 0) {
|
|
596
|
-
// If first data row has different type profile than headers, likely has headers
|
|
597
|
-
const firstDataRow = Object.values(dataRows[0] || {}).map((v) => String(v ?? ""));
|
|
598
|
-
let dataTextCount = 0;
|
|
599
|
-
for (const value of firstDataRow) {
|
|
600
|
-
const type = detectValueType(value?.trim() ?? "");
|
|
601
|
-
if (type === "string") {
|
|
602
|
-
dataTextCount++;
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
const dataTextRatio = firstDataRow.length > 0 ? dataTextCount / firstDataRow.length : 0;
|
|
606
|
-
// If headers are mostly text but data has more varied types, likely has headers
|
|
607
|
-
if (textRatio > 0.7 && dataTextRatio < textRatio - 0.2) {
|
|
608
|
-
return true;
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
// Default: if >70% of header values are text-like and unique, assume headers
|
|
612
|
-
return textRatio >= 0.7 && hasUniqueHeaders;
|
|
613
|
-
}
|
|
614
|
-
/**
|
|
615
|
-
* Detect if first line is CSV metadata (not actual data/headers)
|
|
616
|
-
* Common patterns:
|
|
617
|
-
* - Excel separator line: "SEP=,"
|
|
618
|
-
* - Lines with significantly different delimiter count than line 2
|
|
619
|
-
* - Lines that don't match CSV structure of subsequent lines
|
|
620
|
-
*/
|
|
621
|
-
/**
|
|
622
|
-
* Strip a leading UTF-8 BOM (U+FEFF) if present. Exported so every entry
|
|
623
|
-
* point that sniffs raw text (including the RAG CSVLoader) normalizes BOMs
|
|
624
|
-
* the same way before metadata/delimiter detection.
|
|
625
|
-
*/
|
|
626
|
-
export function stripBom(text) {
|
|
627
|
-
return text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;
|
|
628
|
-
}
|
|
629
|
-
/**
|
|
630
|
-
* Count commas that fall OUTSIDE double-quoted fields (RFC 4180, escaped-quote
|
|
631
|
-
* aware). A quoted comma is field content, not a column separator, so counting
|
|
632
|
-
* naively would misclassify a quoted-comma header line.
|
|
633
|
-
*/
|
|
634
|
-
function countUnquotedCommas(line) {
|
|
635
|
-
let count = 0;
|
|
636
|
-
let inQuotes = false;
|
|
637
|
-
for (let i = 0; i < line.length; i++) {
|
|
638
|
-
const ch = line[i];
|
|
639
|
-
if (ch === '"') {
|
|
640
|
-
if (inQuotes && line[i + 1] === '"') {
|
|
641
|
-
i++;
|
|
642
|
-
continue;
|
|
643
|
-
}
|
|
644
|
-
inQuotes = !inQuotes;
|
|
645
|
-
}
|
|
646
|
-
else if (ch === "," && !inQuotes) {
|
|
647
|
-
count++;
|
|
648
|
-
}
|
|
649
|
-
}
|
|
650
|
-
return count;
|
|
651
|
-
}
|
|
652
|
-
function isMetadataLine(lines) {
|
|
653
|
-
if (!lines[0] || lines.length < 2) {
|
|
654
|
-
return false;
|
|
655
|
-
}
|
|
656
|
-
const firstLine = lines[0].trim();
|
|
657
|
-
const secondLine = lines[1].trim();
|
|
658
|
-
// Excel's explicit-delimiter preamble is metadata regardless of what follows.
|
|
659
|
-
if (firstLine.match(/^sep=/i)) {
|
|
660
|
-
return true;
|
|
661
|
-
}
|
|
662
|
-
// #373: this check has to come BEFORE the comma-count heuristics, not after.
|
|
663
|
-
// Both of them read a higher comma count on line 2 as "line 1 was a preamble"
|
|
664
|
-
// — but a delimiter-only row (`,,`) is a blank DATA row, and its commas are
|
|
665
|
-
// structure, not fields. Ordered the other way, a legitimate single-column
|
|
666
|
-
// header followed by a blank row (`name` / `,,`) tripped the zero-vs-nonzero
|
|
667
|
-
// rule and stripMetadataLine() deleted the real header, leaving unnamed
|
|
668
|
-
// columns. Verified against `name\n,,\nalice\nbob`.
|
|
669
|
-
if (isDelimiterOnlyOrBlankLine(secondLine)) {
|
|
670
|
-
return false;
|
|
671
|
-
}
|
|
672
|
-
const firstCommaCount = countUnquotedCommas(firstLine);
|
|
673
|
-
const secondCommaCount = countUnquotedCommas(secondLine);
|
|
674
|
-
// A title/preamble line carries no delimiters while the header below it does.
|
|
675
|
-
if (firstCommaCount === 0 && secondCommaCount > 0) {
|
|
676
|
-
return true;
|
|
677
|
-
}
|
|
678
|
-
// Differing field counts mean line 1 is not part of the same table as line 2.
|
|
679
|
-
return secondCommaCount > 0 && firstCommaCount !== secondCommaCount;
|
|
680
|
-
}
|
|
681
|
-
/**
|
|
682
|
-
* True when `line` is empty/whitespace or contains only common CSV
|
|
683
|
-
* delimiters (comma / tab / semicolon / pipe) and whitespace — i.e. a
|
|
684
|
-
* delimiter-only blank row like `,,` or ` ; ; `. Used before the
|
|
685
|
-
* delimiter is known (metadata detection).
|
|
686
|
-
*/
|
|
687
|
-
function isDelimiterOnlyOrBlankLine(line) {
|
|
688
|
-
const trimmed = line.trim();
|
|
689
|
-
if (trimmed === "") {
|
|
690
|
-
return true;
|
|
691
|
-
}
|
|
692
|
-
return /^[\s,;\t|]+$/.test(trimmed) && /[,;\t|]/.test(trimmed);
|
|
693
|
-
}
|
|
694
|
-
/**
|
|
695
|
-
* Strip a leading metadata line (e.g. Excel's `sep=;` preamble) from
|
|
696
|
-
* already-split lines, and read the delimiter it explicitly declares.
|
|
697
|
-
* Excel semantics: an explicit `sep=<char>` always wins over frequency-based
|
|
698
|
-
* detection; a metadata line without a recognized delimiter character is
|
|
699
|
-
* simply dropped from the sample without forcing a delimiter. This is the
|
|
700
|
-
* single place process(), detectDelimiter(), parseCSVFile(), and
|
|
701
|
-
* parseCSVString() all go through, so none of them detect a delimiter over
|
|
702
|
-
* the raw, un-stripped lines (which lets the preamble skew detection).
|
|
703
|
-
* Exported so non-CSVProcessor callers (the RAG CSVLoader) share it too.
|
|
704
|
-
*/
|
|
705
|
-
export function stripMetadataLine(lines) {
|
|
706
|
-
if (!isMetadataLine(lines)) {
|
|
707
|
-
return { dataLines: lines, hasMetadataLine: false };
|
|
708
|
-
}
|
|
709
|
-
const sepChar = lines[0]?.trim().match(/^sep=(.)/i)?.[1];
|
|
710
|
-
const explicitDelimiter = sepChar && CANDIDATE_DELIMITERS.includes(sepChar)
|
|
711
|
-
? sepChar
|
|
712
|
-
: undefined;
|
|
713
|
-
return {
|
|
714
|
-
dataLines: lines.slice(1),
|
|
715
|
-
hasMetadataLine: true,
|
|
716
|
-
explicitDelimiter,
|
|
717
|
-
};
|
|
718
|
-
}
|
|
719
|
-
/**
|
|
720
|
-
* Split CSV text into logical rows for metadata detection and raw row limiting.
|
|
721
|
-
*
|
|
722
|
-
* Supports Unix (LF), Windows (CRLF), and classic Mac (CR) line endings, and is
|
|
723
|
-
* quote-aware: a line ending that appears *inside* a quoted field (RFC 4180) is
|
|
724
|
-
* kept as part of that field rather than treated as a row boundary. A doubled
|
|
725
|
-
* `""` inside quotes is the RFC-4180 escaped quote and does not toggle the quote
|
|
726
|
-
* state. For unquoted input this yields exactly the same result as a plain
|
|
727
|
-
* `split(/\r\n|\n|\r/)`.
|
|
728
|
-
*
|
|
729
|
-
* Exported so non-CSVProcessor callers (the RAG CSVLoader) get the same
|
|
730
|
-
* quote-aware row boundaries instead of a physical `content.split("\n")`,
|
|
731
|
-
* which would break rows on a newline embedded in a quoted field.
|
|
732
|
-
*/
|
|
733
|
-
export function splitCsvLines(csvString) {
|
|
734
|
-
const rows = [];
|
|
735
|
-
let current = "";
|
|
736
|
-
let inQuotes = false;
|
|
737
|
-
for (let i = 0; i < csvString.length; i++) {
|
|
738
|
-
const ch = csvString[i];
|
|
739
|
-
if (ch === '"') {
|
|
740
|
-
if (inQuotes && csvString[i + 1] === '"') {
|
|
741
|
-
// Escaped quote ("") — stays inside the field, quote state unchanged.
|
|
742
|
-
current += '""';
|
|
743
|
-
i++;
|
|
744
|
-
continue;
|
|
745
|
-
}
|
|
746
|
-
inQuotes = !inQuotes;
|
|
747
|
-
current += ch;
|
|
748
|
-
}
|
|
749
|
-
else if (!inQuotes && (ch === "\n" || ch === "\r")) {
|
|
750
|
-
// Row boundary outside quotes; collapse CRLF into a single boundary.
|
|
751
|
-
if (ch === "\r" && csvString[i + 1] === "\n") {
|
|
752
|
-
i++;
|
|
753
|
-
}
|
|
754
|
-
rows.push(current);
|
|
755
|
-
current = "";
|
|
756
|
-
}
|
|
757
|
-
else {
|
|
758
|
-
current += ch;
|
|
759
|
-
}
|
|
760
|
-
}
|
|
761
|
-
rows.push(current);
|
|
762
|
-
return rows;
|
|
763
|
-
}
|
|
764
|
-
/**
|
|
765
|
-
* CSV processor for converting CSV data to LLM-optimized formats
|
|
766
|
-
*
|
|
767
|
-
* Supports three output formats:
|
|
768
|
-
* - raw: Original CSV format with proper escaping (RECOMMENDED for best LLM performance)
|
|
769
|
-
* - json: JSON array format (best for structured data processing)
|
|
770
|
-
* - markdown: Markdown table format (best for small datasets <100 rows)
|
|
771
|
-
*
|
|
772
|
-
* All formats use csv-parser for reliable parsing, then convert to the target format.
|
|
773
|
-
*
|
|
774
|
-
* @example
|
|
775
|
-
* ```typescript
|
|
776
|
-
* const csvBuffer = Buffer.from('name,age\nAlice,30\nBob,25');
|
|
777
|
-
* const result = await CSVProcessor.process(csvBuffer, {
|
|
778
|
-
* maxRows: 1000,
|
|
779
|
-
* formatStyle: 'raw'
|
|
780
|
-
* });
|
|
781
|
-
* console.log(result.content); // CSV string with proper escaping
|
|
782
|
-
* ```
|
|
783
|
-
*/
|
|
784
|
-
export class CSVProcessor {
|
|
785
|
-
/**
|
|
786
|
-
* Process CSV Buffer to LLM-friendly format
|
|
787
|
-
* Content already loaded by FileDetector
|
|
788
|
-
*
|
|
789
|
-
* @param content - CSV file as Buffer
|
|
790
|
-
* @param options - Processing options
|
|
791
|
-
* @returns Formatted CSV data ready for LLM (JSON or Markdown)
|
|
792
|
-
*/
|
|
793
|
-
static async process(content, options) {
|
|
794
|
-
const { maxRows: rawMaxRows = 1000, formatStyle = "raw", includeHeaders = true, sampleDataFormat = "json", extension = null, encoding, sanitizeColumnNames = false, columnNameCase = "snake_case", parseTimeoutMs = DEFAULT_CSV_STRING_PARSE_TIMEOUT_MS, skipEmptyLines = true, } = options || {};
|
|
795
|
-
const maxRows = Math.max(1, Math.min(10000, rawMaxRows));
|
|
796
|
-
logger.debug("[CSVProcessor] Starting CSV processing", {
|
|
797
|
-
contentSize: content.length,
|
|
798
|
-
formatStyle,
|
|
799
|
-
maxRows,
|
|
800
|
-
includeHeaders,
|
|
801
|
-
skipEmptyLines,
|
|
802
|
-
});
|
|
803
|
-
// #362: detect the encoding (BOM → chardet → UTF-8 fallback) or honor the
|
|
804
|
-
// caller's override, instead of the previous hard-coded UTF-8 decode.
|
|
805
|
-
const { text: csvString, encoding: detectedEncoding, confidence: encodingConfidence, } = decodeBuffer(content, encoding);
|
|
806
|
-
// #361: split once and strip a leading Excel `sep=` metadata line before
|
|
807
|
-
// detecting the delimiter (comma/tab/semicolon/pipe), so the preamble
|
|
808
|
-
// can't skew detection — then reuse dataLines below instead of
|
|
809
|
-
// re-splitting csvString for the raw-format row handling.
|
|
810
|
-
const lines = splitCsvLines(csvString);
|
|
811
|
-
const { dataLines, hasMetadataLine, explicitDelimiter } = stripMetadataLine(lines);
|
|
812
|
-
const delimiter = explicitDelimiter ??
|
|
813
|
-
detectDelimiterUtil(dataLines, extension ?? undefined);
|
|
814
|
-
// For raw format, return CSV text with row limit (no parsing needed)
|
|
815
|
-
// This preserves the CSV shape while normalizing line endings for row handling.
|
|
816
|
-
if (formatStyle === "raw") {
|
|
817
|
-
if (hasMetadataLine) {
|
|
818
|
-
logger.debug("[CSVProcessor] Detected metadata line, skipping first line");
|
|
819
|
-
}
|
|
820
|
-
// dataLines already has the metadata line (if any) stripped.
|
|
821
|
-
const csvLines = dataLines;
|
|
822
|
-
const headerLine = csvLines[0] ?? "";
|
|
823
|
-
const rawDataLines = csvLines.slice(1);
|
|
824
|
-
// #373: drop blank AND delimiter-only data lines (e.g. `,,`) so raw
|
|
825
|
-
// content matches structured `isBlankCsvDataRow` semantics.
|
|
826
|
-
const effectiveDataLines = skipEmptyLines
|
|
827
|
-
? rawDataLines.filter((line) => !isBlankCsvRawLine(line, delimiter))
|
|
828
|
-
: rawDataLines;
|
|
829
|
-
const limitedDataLines = effectiveDataLines.slice(0, maxRows);
|
|
830
|
-
const limitedLines = csvLines.length === 0 ? [] : [headerLine, ...limitedDataLines];
|
|
831
|
-
// #378: opt-in — rewrite the literal header line with sanitized,
|
|
832
|
-
// deduped identifiers so the raw CSV text shown to the LLM has clean
|
|
833
|
-
// column names too. (Splits on commas to match the existing raw-branch
|
|
834
|
-
// columnCount logic.)
|
|
835
|
-
let rawColumnNameMapping;
|
|
836
|
-
if (sanitizeColumnNames && limitedLines.length > 0) {
|
|
837
|
-
const headerCols = splitCSVFields(limitedLines[0] || "", delimiter);
|
|
838
|
-
const { sanitized, mapping } = buildColumnNameMapping(headerCols, columnNameCase);
|
|
839
|
-
limitedLines[0] = sanitized.join(delimiter);
|
|
840
|
-
rawColumnNameMapping = mapping.length > 0 ? mapping : undefined;
|
|
841
|
-
}
|
|
842
|
-
const limitedCSV = limitedLines.join("\n");
|
|
843
|
-
// #1199: quote-aware, delimiter-aware split (matches the
|
|
844
|
-
// sanitizeColumnNames branch above and #1192's detected delimiter).
|
|
845
|
-
const headerFields = splitCSVFields(limitedLines[0] || "", delimiter);
|
|
846
|
-
// When preserving empties, blank lines count as rows; when skipping,
|
|
847
|
-
// only non-empty data lines do.
|
|
848
|
-
const rowCount = limitedDataLines.length;
|
|
849
|
-
const originalRowCount = effectiveDataLines.length;
|
|
850
|
-
const wasTruncated = rowCount < originalRowCount;
|
|
851
|
-
if (wasTruncated) {
|
|
852
|
-
logger.warn(`[CSVProcessor] CSV data truncated: showing ${rowCount} of ${originalRowCount} rows (limit: ${maxRows})`);
|
|
853
|
-
}
|
|
854
|
-
logger.debug(`[CSVProcessor] raw format: ${rowCount} rows (original: ${originalRowCount}) → ${limitedCSV.length} chars`, {
|
|
855
|
-
formatStyle: "raw",
|
|
856
|
-
originalSize: csvString.length,
|
|
857
|
-
limitedSize: limitedCSV.length,
|
|
858
|
-
});
|
|
859
|
-
logger.info("[CSVProcessor] ✅ Processed CSV file", {
|
|
860
|
-
formatStyle: "raw",
|
|
861
|
-
rowCount,
|
|
862
|
-
columnCount: headerFields.length,
|
|
863
|
-
truncated: wasTruncated,
|
|
864
|
-
});
|
|
865
|
-
// Parse a sample for enhanced metadata analysis (raw format still
|
|
866
|
-
// benefits from column analysis). Feed the already-filtered limited
|
|
867
|
-
// lines and honor skipEmptyRows so blank/delimiter-only rows do not
|
|
868
|
-
// consume the sample limit (#373).
|
|
869
|
-
const sampleRows = Math.min(rowCount, 500);
|
|
870
|
-
const { rows: sampleForAnalysis, timedOut: rawTimedOut } = await this.streamParse(Readable.from([limitedLines.join("\n")]), undefined, {
|
|
871
|
-
maxRows: sampleRows,
|
|
872
|
-
skipLines: 0,
|
|
873
|
-
timeoutMs: parseTimeoutMs,
|
|
874
|
-
delimiter,
|
|
875
|
-
skipEmptyRows: skipEmptyLines,
|
|
876
|
-
});
|
|
877
|
-
const { columnMetadata, dataQualityWarnings, dataQualityScore } = analyzeColumns(sampleForAnalysis);
|
|
878
|
-
// Log data quality summary
|
|
879
|
-
if (dataQualityWarnings.length > 0) {
|
|
880
|
-
logger.debug("[CSVProcessor] Data quality warnings detected", {
|
|
881
|
-
warningCount: dataQualityWarnings.length,
|
|
882
|
-
score: dataQualityScore,
|
|
883
|
-
});
|
|
884
|
-
}
|
|
885
|
-
return {
|
|
886
|
-
type: "csv",
|
|
887
|
-
content: limitedCSV,
|
|
888
|
-
mimeType: "text/csv",
|
|
889
|
-
metadata: {
|
|
890
|
-
confidence: csvResultConfidence(dataQualityScore),
|
|
891
|
-
size: content.length,
|
|
892
|
-
rowCount,
|
|
893
|
-
totalLines: limitedLines.length,
|
|
894
|
-
columnCount: headerFields.length,
|
|
895
|
-
extension,
|
|
896
|
-
columnMetadata,
|
|
897
|
-
dataQualityWarnings,
|
|
898
|
-
dataQualityScore,
|
|
899
|
-
hasHeaders: detectHasHeaders(headerFields, undefined),
|
|
900
|
-
detectedDelimiter: delimiter,
|
|
901
|
-
detectedEncoding,
|
|
902
|
-
encodingConfidence,
|
|
903
|
-
...(rawColumnNameMapping
|
|
904
|
-
? { columnNameMapping: rawColumnNameMapping }
|
|
905
|
-
: {}),
|
|
906
|
-
...(rawTimedOut ? { parseTimedOut: true } : {}),
|
|
907
|
-
},
|
|
908
|
-
};
|
|
909
|
-
}
|
|
910
|
-
// Parse CSV for JSON and Markdown formats only
|
|
911
|
-
logger.debug("[CSVProcessor] Parsing CSV for structured format conversion", {
|
|
912
|
-
formatStyle,
|
|
913
|
-
maxRows,
|
|
914
|
-
});
|
|
915
|
-
// dataLines was already split and metadata-stripped above (alongside
|
|
916
|
-
// `delimiter`) — reuse both via the shared streamParse() core instead of
|
|
917
|
-
// routing csvString back through parseCSVStringWithMeta(), which would
|
|
918
|
-
// re-split it and re-run metadata/delimiter detection a second time.
|
|
919
|
-
const { rows, timedOut: structuredTimedOut, headers: parsedHeaders, } = await this.streamParse(Readable.from([dataLines.join("\n")]), undefined, {
|
|
920
|
-
maxRows,
|
|
921
|
-
skipLines: 0,
|
|
922
|
-
timeoutMs: parseTimeoutMs,
|
|
923
|
-
delimiter,
|
|
924
|
-
// Count only non-blank rows toward maxRows when skipping empties
|
|
925
|
-
// (#373), so maxRows: 2 still yields two real data rows if blanks
|
|
926
|
-
// appear first.
|
|
927
|
-
skipEmptyRows: skipEmptyLines,
|
|
928
|
-
});
|
|
929
|
-
// Filter out empty rows (empty objects or rows with only whitespace values
|
|
930
|
-
// from blank lines). #373: `skipEmptyLines` (default true) controls this;
|
|
931
|
-
// set false to preserve blank-line rows in structured output.
|
|
932
|
-
const filteredRows = rows.filter((row) => {
|
|
933
|
-
if (!row || typeof row !== "object") {
|
|
934
|
-
return false;
|
|
935
|
-
}
|
|
936
|
-
if (!skipEmptyLines) {
|
|
937
|
-
return true;
|
|
938
|
-
}
|
|
939
|
-
return !isBlankCsvDataRow(row);
|
|
940
|
-
});
|
|
941
|
-
// Schema must come from parser headers or the first non-blank data row,
|
|
942
|
-
// never from a preserved leading blank row (#373 review).
|
|
943
|
-
const schemaRow = filteredRows.find((row) => row && typeof row === "object" && !isBlankCsvDataRow(row));
|
|
944
|
-
const schemaHeaders = (parsedHeaders && parsedHeaders.length > 0
|
|
945
|
-
? [...parsedHeaders]
|
|
946
|
-
: undefined) ??
|
|
947
|
-
(schemaRow ? Object.keys(schemaRow) : undefined) ??
|
|
948
|
-
(filteredRows[0] ? Object.keys(filteredRows[0]) : []) ??
|
|
949
|
-
[];
|
|
950
|
-
// #378: opt-in — remap each row's keys from original → sanitized identifiers.
|
|
951
|
-
// Always project onto schemaHeaders first so preserved blank rows still
|
|
952
|
-
// carry the real column keys for Markdown/JSON (#373 review).
|
|
953
|
-
let structuredColumnNameMapping;
|
|
954
|
-
const sanitizedToOriginal = new Map();
|
|
955
|
-
let columnNames = schemaHeaders;
|
|
956
|
-
let nonEmptyRows = schemaHeaders.length === 0
|
|
957
|
-
? filteredRows
|
|
958
|
-
: filteredRows.map((row) => {
|
|
959
|
-
const out = Object.create(null);
|
|
960
|
-
for (const h of schemaHeaders) {
|
|
961
|
-
out[h] = typeof row[h] === "string" ? row[h] : "";
|
|
962
|
-
}
|
|
963
|
-
return out;
|
|
964
|
-
});
|
|
965
|
-
if (sanitizeColumnNames && schemaHeaders.length > 0) {
|
|
966
|
-
const origHeaders = schemaHeaders;
|
|
967
|
-
const { sanitized, mapping } = buildColumnNameMapping(origHeaders, columnNameCase);
|
|
968
|
-
origHeaders.forEach((original, i) => {
|
|
969
|
-
if (original !== sanitized[i]) {
|
|
970
|
-
sanitizedToOriginal.set(sanitized[i], original);
|
|
971
|
-
}
|
|
972
|
-
});
|
|
973
|
-
nonEmptyRows = nonEmptyRows.map((row) => {
|
|
974
|
-
// Defense-in-depth: a null-prototype target means an attacker-chosen
|
|
975
|
-
// header literally named "__proto__"/"constructor"/"prototype" can
|
|
976
|
-
// only ever create a harmless own property, never touch
|
|
977
|
-
// Object.prototype (#1199).
|
|
978
|
-
const out = Object.create(null);
|
|
979
|
-
origHeaders.forEach((h, i) => {
|
|
980
|
-
out[sanitized[i]] = row[h] ?? "";
|
|
981
|
-
});
|
|
982
|
-
return out;
|
|
983
|
-
});
|
|
984
|
-
structuredColumnNameMapping = mapping.length > 0 ? mapping : undefined;
|
|
985
|
-
columnNames = sanitized;
|
|
986
|
-
}
|
|
987
|
-
// Extract metadata from parsed results
|
|
988
|
-
const rowCount = nonEmptyRows.length;
|
|
989
|
-
const columnCount = columnNames.length;
|
|
990
|
-
const hasEmptyColumns = columnNames.some((col) => !col || col.trim() === "");
|
|
991
|
-
// Sample / analysis should prefer non-blank rows so a preserved leading
|
|
992
|
-
// blank does not poison type detection or formatSampleData.
|
|
993
|
-
const rowsForAnalysis = nonEmptyRows.filter((row) => !isBlankCsvDataRow(row));
|
|
994
|
-
const sampleRows = (rowsForAnalysis.length > 0 ? rowsForAnalysis : nonEmptyRows).slice(0, 3);
|
|
995
|
-
const sampleData = this.formatSampleData(sampleRows, sampleDataFormat, includeHeaders, columnNames);
|
|
996
|
-
if (hasEmptyColumns) {
|
|
997
|
-
logger.warn("[CSVProcessor] CSV contains empty or blank column headers", {
|
|
998
|
-
columnNames,
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
if (rowCount === 0) {
|
|
1002
|
-
logger.warn("[CSVProcessor] CSV file contains no data rows");
|
|
1003
|
-
}
|
|
1004
|
-
// Perform enhanced column analysis on non-blank rows so preserved
|
|
1005
|
-
// leading blanks do not yield an empty schema (#373 review).
|
|
1006
|
-
const { columnMetadata, dataQualityWarnings, dataQualityScore } = analyzeColumns(rowsForAnalysis.length > 0 ? rowsForAnalysis : nonEmptyRows);
|
|
1007
|
-
// #378: carry the pre-sanitization header on each renamed column.
|
|
1008
|
-
if (sanitizedToOriginal.size > 0) {
|
|
1009
|
-
for (const col of columnMetadata) {
|
|
1010
|
-
const original = sanitizedToOriginal.get(col.name);
|
|
1011
|
-
if (original) {
|
|
1012
|
-
col.originalName = original;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
}
|
|
1016
|
-
// Log data quality summary
|
|
1017
|
-
if (dataQualityWarnings.length > 0) {
|
|
1018
|
-
logger.debug("[CSVProcessor] Data quality warnings detected", {
|
|
1019
|
-
warningCount: dataQualityWarnings.length,
|
|
1020
|
-
score: dataQualityScore,
|
|
1021
|
-
});
|
|
1022
|
-
}
|
|
1023
|
-
// Format parsed data
|
|
1024
|
-
logger.debug(`[CSVProcessor] Converting ${rowCount} rows to ${formatStyle} format`);
|
|
1025
|
-
const formatted = this.formatForLLM(nonEmptyRows, formatStyle, includeHeaders, columnNames);
|
|
1026
|
-
logger.info("[CSVProcessor] ✅ Processed CSV file", {
|
|
1027
|
-
formatStyle,
|
|
1028
|
-
rowCount,
|
|
1029
|
-
columnCount,
|
|
1030
|
-
outputLength: formatted.length,
|
|
1031
|
-
hasEmptyColumns,
|
|
1032
|
-
dataQualityScore,
|
|
1033
|
-
});
|
|
1034
|
-
return {
|
|
1035
|
-
type: "csv",
|
|
1036
|
-
content: formatted,
|
|
1037
|
-
mimeType: "text/csv",
|
|
1038
|
-
metadata: {
|
|
1039
|
-
confidence: csvResultConfidence(dataQualityScore),
|
|
1040
|
-
size: content.length,
|
|
1041
|
-
rowCount,
|
|
1042
|
-
columnCount,
|
|
1043
|
-
columnNames,
|
|
1044
|
-
sampleData,
|
|
1045
|
-
hasEmptyColumns,
|
|
1046
|
-
extension,
|
|
1047
|
-
columnMetadata,
|
|
1048
|
-
dataQualityWarnings,
|
|
1049
|
-
dataQualityScore,
|
|
1050
|
-
hasHeaders: detectHasHeaders(columnNames, rowsForAnalysis.length > 0 ? rowsForAnalysis : nonEmptyRows),
|
|
1051
|
-
detectedDelimiter: delimiter,
|
|
1052
|
-
detectedEncoding,
|
|
1053
|
-
encodingConfidence,
|
|
1054
|
-
...(structuredColumnNameMapping
|
|
1055
|
-
? { columnNameMapping: structuredColumnNameMapping }
|
|
1056
|
-
: {}),
|
|
1057
|
-
...(structuredTimedOut ? { parseTimedOut: true } : {}),
|
|
1058
|
-
},
|
|
1059
|
-
};
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* Detect the delimiter of DSV content (comma/tab/semicolon/pipe), respecting
|
|
1063
|
-
* RFC-4180 quoting. An optional extension hint (`tsv` → tab, `psv` → pipe)
|
|
1064
|
-
* breaks ambiguity. Used by callers (e.g. the RAG CSV loader) that parse
|
|
1065
|
-
* DSV content themselves and need the same detection (#361). A leading
|
|
1066
|
-
* Excel `sep=` metadata line is stripped before sampling so it can't skew
|
|
1067
|
-
* detection, and an explicit `sep=<char>` value wins outright.
|
|
1068
|
-
*/
|
|
1069
|
-
static detectDelimiter(csvString, extensionHint) {
|
|
1070
|
-
const { dataLines, explicitDelimiter } = stripMetadataLine(splitCsvLines(stripBom(csvString)));
|
|
1071
|
-
return explicitDelimiter ?? detectDelimiterUtil(dataLines, extensionHint);
|
|
1072
|
-
}
|
|
1073
|
-
/**
|
|
1074
|
-
* Parse CSV file from disk using streaming (memory efficient)
|
|
1075
|
-
*
|
|
1076
|
-
* @param filePath - Path to CSV file
|
|
1077
|
-
* @param maxRows - Maximum rows to parse (default: 1000)
|
|
1078
|
-
* @returns Array of row objects
|
|
1079
|
-
*/
|
|
1080
|
-
static async parseCSVFile(filePath, maxRows = 1000, timeoutMs = DEFAULT_CSV_FILE_PARSE_TIMEOUT_MS) {
|
|
1081
|
-
const { rows } = await this.parseCSVFileWithMeta(filePath, maxRows, timeoutMs);
|
|
1082
|
-
return rows;
|
|
1083
|
-
}
|
|
1084
|
-
/**
|
|
1085
|
-
* File-parse variant that also reports whether the parse timed out, used by
|
|
1086
|
-
* `process()` to surface `metadata.parseTimedOut`.
|
|
1087
|
-
*/
|
|
1088
|
-
static async parseCSVFileWithMeta(filePath, maxRows = 1000, timeoutMs = DEFAULT_CSV_FILE_PARSE_TIMEOUT_MS, encoding) {
|
|
1089
|
-
if (typeof filePath !== "string" || filePath.trim().length === 0) {
|
|
1090
|
-
throw ErrorFactory.csvInvalidInput("CSVProcessor.parseCSVFile: filePath must be a non-empty string");
|
|
1091
|
-
}
|
|
1092
|
-
const clampedMaxRows = Math.max(1, Math.min(10000, maxRows));
|
|
1093
|
-
const fs = await import("fs");
|
|
1094
|
-
// #1199: a single wall-clock deadline covers access() + prepareFileSource()
|
|
1095
|
-
// + streamParse() together, not just the streamParse phase — otherwise a
|
|
1096
|
-
// stalled disk/network filesystem during the open/peek steps defeats the
|
|
1097
|
-
// #379 timeout guard entirely.
|
|
1098
|
-
const startTime = Date.now();
|
|
1099
|
-
const remaining = () => Math.max(0, timeoutMs - (Date.now() - startTime));
|
|
1100
|
-
logger.debug("[CSVProcessor] Starting file parsing", {
|
|
1101
|
-
filePath,
|
|
1102
|
-
maxRows: clampedMaxRows,
|
|
1103
|
-
});
|
|
1104
|
-
// #375: a bad path (ENOENT/EACCES) should fail fast with clear context
|
|
1105
|
-
// instead of a raw Node error surfacing from the stream. access() is a
|
|
1106
|
-
// permission check, not a content read, so #368's single-read contract
|
|
1107
|
-
// (one createReadStream, no second full pass) is preserved. Metadata-line
|
|
1108
|
-
// and delimiter (#361) detection happen inside prepareFileSource() below,
|
|
1109
|
-
// from the same peeked bytes used for encoding detection — not a second
|
|
1110
|
-
// read of the file.
|
|
1111
|
-
try {
|
|
1112
|
-
await fs.promises.access(filePath, fs.constants.R_OK);
|
|
1113
|
-
}
|
|
1114
|
-
catch (error) {
|
|
1115
|
-
throw ErrorFactory.csvFileAccessFailed(`[CSVProcessor] Failed to open CSV file (${filePath}): ${error instanceof Error ? error.message : String(error)}`, filePath, error instanceof Error ? error : undefined);
|
|
1116
|
-
}
|
|
1117
|
-
// #368: a SINGLE createReadStream. We peek its leading bytes to sniff the
|
|
1118
|
-
// encoding (#362) and detect a metadata line + delimiter (#361), then
|
|
1119
|
-
// replay those bytes back onto the same stream — no second disk read.
|
|
1120
|
-
const rawSource = fs.createReadStream(filePath);
|
|
1121
|
-
let prepared;
|
|
1122
|
-
try {
|
|
1123
|
-
prepared = await withTimeout(this.prepareFileSource(rawSource, encoding, extname(filePath)), remaining(), "[CSVProcessor] Timed out preparing CSV file source");
|
|
1124
|
-
}
|
|
1125
|
-
catch (error) {
|
|
1126
|
-
rawSource.destroy();
|
|
1127
|
-
if (error instanceof TimeoutError) {
|
|
1128
|
-
// Same contract as streamParse's own timeout path (#379): report a
|
|
1129
|
-
// clean partial result instead of throwing, so the whole call never
|
|
1130
|
-
// hangs OR surfaces a timeout as an exception.
|
|
1131
|
-
logger.warn(`[CSVProcessor] Prepare phase exceeded the ${timeoutMs}ms parse budget for ${filePath}; returning an empty partial result`);
|
|
1132
|
-
return { rows: [], timedOut: true };
|
|
1133
|
-
}
|
|
1134
|
-
throw ErrorFactory.csvParseFailed(buildCsvParseErrorMessage({
|
|
1135
|
-
stage: "read",
|
|
1136
|
-
count: 0,
|
|
1137
|
-
location: filePath,
|
|
1138
|
-
cause: error instanceof Error ? error.message : String(error),
|
|
1139
|
-
}), { filePath }, error instanceof Error ? error : undefined);
|
|
1140
|
-
}
|
|
1141
|
-
return this.streamParse(prepared.source, rawSource, {
|
|
1142
|
-
maxRows: clampedMaxRows,
|
|
1143
|
-
skipLines: prepared.skipLines,
|
|
1144
|
-
timeoutMs: remaining(),
|
|
1145
|
-
location: filePath,
|
|
1146
|
-
delimiter: prepared.delimiter,
|
|
1147
|
-
});
|
|
1148
|
-
}
|
|
1149
|
-
/**
|
|
1150
|
-
* Peek the head of a raw file stream to resolve encoding, metadata-line
|
|
1151
|
-
* skipping, and the delimiter (#361), then return a decoded text stream
|
|
1152
|
-
* that still delivers the whole file from byte 0 (via `unshift`) — a
|
|
1153
|
-
* single disk read (#368/#362).
|
|
1154
|
-
*/
|
|
1155
|
-
static prepareFileSource(rawSource, encodingOverride, extensionHint) {
|
|
1156
|
-
return new Promise((resolve, reject) => {
|
|
1157
|
-
const PEEK_LIMIT = 64 * 1024;
|
|
1158
|
-
const chunks = [];
|
|
1159
|
-
let total = 0;
|
|
1160
|
-
let settled = false;
|
|
1161
|
-
const cleanup = () => {
|
|
1162
|
-
rawSource.removeListener("data", onData);
|
|
1163
|
-
rawSource.removeListener("end", onEnd);
|
|
1164
|
-
rawSource.removeListener("error", onError);
|
|
1165
|
-
};
|
|
1166
|
-
// #361: resolve the metadata-line skip count and the delimiter
|
|
1167
|
-
// together from the same peeked/decoded text — an explicit `sep=`
|
|
1168
|
-
// line wins outright, otherwise fall back to frequency-based
|
|
1169
|
-
// detection (+ the file extension as a tie-breaker) over the
|
|
1170
|
-
// post-metadata lines.
|
|
1171
|
-
const resolveMeta = (text) => {
|
|
1172
|
-
const { dataLines, hasMetadataLine, explicitDelimiter } = stripMetadataLine(splitCsvLines(text));
|
|
1173
|
-
const delimiter = explicitDelimiter ?? detectDelimiterUtil(dataLines, extensionHint);
|
|
1174
|
-
return { hasMetadataLine, dataLines, delimiter };
|
|
1175
|
-
};
|
|
1176
|
-
const onData = (chunk) => {
|
|
1177
|
-
chunks.push(chunk);
|
|
1178
|
-
total += chunk.length;
|
|
1179
|
-
const head = Buffer.concat(chunks);
|
|
1180
|
-
// isCompleteBuffer=false: `head` is only a peek, not necessarily the
|
|
1181
|
-
// whole file (#1199) — see the confidence note on decodeBuffer.
|
|
1182
|
-
const { text, encoding } = decodeBuffer(head, encodingOverride, false);
|
|
1183
|
-
if (splitCsvLines(text).length >= 2 || total >= PEEK_LIMIT) {
|
|
1184
|
-
if (settled) {
|
|
1185
|
-
return;
|
|
1186
|
-
}
|
|
1187
|
-
settled = true;
|
|
1188
|
-
cleanup();
|
|
1189
|
-
const { hasMetadataLine, delimiter } = resolveMeta(text);
|
|
1190
|
-
// Replay the consumed head bytes, then decode the full raw stream.
|
|
1191
|
-
// NOTE (#1282): the encoding is committed from the peeked head to keep
|
|
1192
|
-
// the parse streaming (which the parse-timeout guard #379 relies on).
|
|
1193
|
-
// A file whose head is pure ASCII but which switches to a legacy
|
|
1194
|
-
// encoding only later would be read as UTF-8; pass `encoding`
|
|
1195
|
-
// explicitly for such files.
|
|
1196
|
-
rawSource.pause();
|
|
1197
|
-
rawSource.unshift(head);
|
|
1198
|
-
const decodeStream = iconv.decodeStream(encoding);
|
|
1199
|
-
rawSource.on("error", (e) => decodeStream.destroy(e));
|
|
1200
|
-
resolve({
|
|
1201
|
-
source: rawSource.pipe(decodeStream),
|
|
1202
|
-
skipLines: hasMetadataLine ? 1 : 0,
|
|
1203
|
-
delimiter,
|
|
1204
|
-
});
|
|
1205
|
-
}
|
|
1206
|
-
};
|
|
1207
|
-
const onEnd = () => {
|
|
1208
|
-
if (settled) {
|
|
1209
|
-
return;
|
|
1210
|
-
}
|
|
1211
|
-
settled = true;
|
|
1212
|
-
cleanup();
|
|
1213
|
-
// Whole (small) file already buffered — decode it directly. unshift on
|
|
1214
|
-
// an ended stream throws, so replay via an in-memory Readable instead.
|
|
1215
|
-
const head = Buffer.concat(chunks);
|
|
1216
|
-
const { text } = decodeBuffer(head, encodingOverride);
|
|
1217
|
-
const { hasMetadataLine, dataLines, delimiter } = resolveMeta(text);
|
|
1218
|
-
const data = hasMetadataLine ? dataLines.join("\n") : text;
|
|
1219
|
-
resolve({ source: Readable.from([data]), skipLines: 0, delimiter });
|
|
1220
|
-
};
|
|
1221
|
-
const onError = (error) => {
|
|
1222
|
-
if (settled) {
|
|
1223
|
-
return;
|
|
1224
|
-
}
|
|
1225
|
-
settled = true;
|
|
1226
|
-
cleanup();
|
|
1227
|
-
reject(error);
|
|
1228
|
-
};
|
|
1229
|
-
rawSource.on("data", onData);
|
|
1230
|
-
rawSource.on("end", onEnd);
|
|
1231
|
-
rawSource.on("error", onError);
|
|
1232
|
-
});
|
|
1233
|
-
}
|
|
1234
|
-
/**
|
|
1235
|
-
* Parse CSV string to array of row objects
|
|
1236
|
-
* Exposed for use by tools that need direct CSV parsing
|
|
1237
|
-
*
|
|
1238
|
-
* @param csvString - CSV data as string
|
|
1239
|
-
* @param maxRows - Maximum rows to parse (default: 1000)
|
|
1240
|
-
* @param timeoutMs - Wall-clock parse cap; returns partial rows on timeout
|
|
1241
|
-
* @returns Array of row objects
|
|
1242
|
-
*/
|
|
1243
|
-
static async parseCSVString(csvString, maxRows = 1000, timeoutMs = DEFAULT_CSV_STRING_PARSE_TIMEOUT_MS) {
|
|
1244
|
-
const { rows } = await this.parseCSVStringWithMeta(csvString, maxRows, timeoutMs);
|
|
1245
|
-
return rows;
|
|
1246
|
-
}
|
|
1247
|
-
/**
|
|
1248
|
-
* String-parse variant that also reports whether the parse timed out, used by
|
|
1249
|
-
* `process()` to surface `metadata.parseTimedOut`.
|
|
1250
|
-
*/
|
|
1251
|
-
static async parseCSVStringWithMeta(csvString, maxRows = 1000, timeoutMs = DEFAULT_CSV_STRING_PARSE_TIMEOUT_MS) {
|
|
1252
|
-
if (typeof csvString !== "string" || csvString.trim().length === 0) {
|
|
1253
|
-
throw ErrorFactory.csvInvalidInput("CSVProcessor.parseCSVString: csvString must be a non-empty string");
|
|
1254
|
-
}
|
|
1255
|
-
// Strip a leading UTF-8 BOM (common in Excel exports) so it does not glue
|
|
1256
|
-
// onto the first column name and break downstream key lookups.
|
|
1257
|
-
const normalized = stripBom(csvString);
|
|
1258
|
-
const clampedMaxRows = Math.max(1, Math.min(10000, maxRows));
|
|
1259
|
-
logger.debug("[CSVProcessor] Starting string parsing", {
|
|
1260
|
-
inputLength: normalized.length,
|
|
1261
|
-
maxRows: clampedMaxRows,
|
|
1262
|
-
});
|
|
1263
|
-
// Detect and skip a leading metadata line before detecting the
|
|
1264
|
-
// delimiter, so a `sep=` preamble can't skew detection (#361). No
|
|
1265
|
-
// caller currently needs to override the delimiter here (#1192's own
|
|
1266
|
-
// tests rely on self-detection), so it's always auto-detected.
|
|
1267
|
-
const lines = splitCsvLines(normalized);
|
|
1268
|
-
const { dataLines, hasMetadataLine, explicitDelimiter } = stripMetadataLine(lines);
|
|
1269
|
-
const effectiveDelimiter = explicitDelimiter ?? detectDelimiterUtil(dataLines);
|
|
1270
|
-
if (hasMetadataLine) {
|
|
1271
|
-
logger.debug("[CSVProcessor] Detected metadata line in string, skipping");
|
|
1272
|
-
}
|
|
1273
|
-
const csvData = dataLines.join("\n");
|
|
1274
|
-
if (csvData.trim().length === 0) {
|
|
1275
|
-
throw ErrorFactory.csvInvalidInput("CSVProcessor.parseCSVString: csvString must be a non-empty string");
|
|
1276
|
-
}
|
|
1277
|
-
return this.streamParse(Readable.from([csvData]), undefined, {
|
|
1278
|
-
maxRows: clampedMaxRows,
|
|
1279
|
-
skipLines: 0,
|
|
1280
|
-
timeoutMs,
|
|
1281
|
-
delimiter: effectiveDelimiter,
|
|
1282
|
-
});
|
|
1283
|
-
}
|
|
1284
|
-
/**
|
|
1285
|
-
* Shared streaming consumer for both parse methods. Guarantees:
|
|
1286
|
-
* - source, rawSource, and parser are all destroyed on ANY settle path
|
|
1287
|
-
* (#371) — `rawSource` matters for the file-parse path, where `source`
|
|
1288
|
-
* is a decode Transform piped FROM `rawSource`; `.pipe()` does not
|
|
1289
|
-
* propagate `.destroy()` upstream, so without this the underlying
|
|
1290
|
-
* `fs.createReadStream` fd would leak on abort/timeout/error,
|
|
1291
|
-
* - a wall-clock timeout returns partial rows instead of hanging (#379),
|
|
1292
|
-
* - every row is validated at the boundary (#384),
|
|
1293
|
-
* - reject messages carry columns/last-row-shape/format context (#375),
|
|
1294
|
-
* - the delimiter (#361, comma/tab/semicolon/pipe) detected by the caller
|
|
1295
|
-
* is honored, instead of csv-parser's hard-coded comma default.
|
|
1296
|
-
*
|
|
1297
|
-
* @param rawSource - The original file stream `source` was piped from, when
|
|
1298
|
-
* applicable (file-parse path only; `undefined` for string parsing).
|
|
1299
|
-
*/
|
|
1300
|
-
static streamParse(source, rawSource, opts) {
|
|
1301
|
-
return new Promise((resolve, reject) => {
|
|
1302
|
-
const rows = [];
|
|
1303
|
-
let count = 0;
|
|
1304
|
-
let settled = false;
|
|
1305
|
-
let capturedHeaders;
|
|
1306
|
-
let lastRowColumnCount;
|
|
1307
|
-
const startTime = Date.now();
|
|
1308
|
-
// maxRowBytes bounds a single-row allocation (#371) — without it a
|
|
1309
|
-
// pathological unbroken row grows memory unbounded and never errors.
|
|
1310
|
-
// skipLines drops any pre-header metadata line (e.g. Excel's `sep=,`)
|
|
1311
|
-
// BEFORE csv-parser reads the header, so the real header is used.
|
|
1312
|
-
// separator (#361) defaults to comma when the caller has no better
|
|
1313
|
-
// signal, matching csv-parser's own default.
|
|
1314
|
-
const parser = csvParser({
|
|
1315
|
-
separator: opts.delimiter ?? ",",
|
|
1316
|
-
maxRowBytes: CSV_MAX_ROW_BYTES,
|
|
1317
|
-
...(opts.skipLines > 0 ? { skipLines: opts.skipLines } : {}),
|
|
1318
|
-
});
|
|
1319
|
-
const abort = () => {
|
|
1320
|
-
source.destroy();
|
|
1321
|
-
rawSource?.destroy();
|
|
1322
|
-
parser.destroy();
|
|
1323
|
-
};
|
|
1324
|
-
const finish = (fn) => {
|
|
1325
|
-
if (settled) {
|
|
1326
|
-
return;
|
|
1327
|
-
}
|
|
1328
|
-
settled = true;
|
|
1329
|
-
clearTimeout(timer);
|
|
1330
|
-
fn();
|
|
1331
|
-
};
|
|
1332
|
-
const timer = setTimeout(() => {
|
|
1333
|
-
finish(() => {
|
|
1334
|
-
logger.warn(`[CSVProcessor] Parse timed out after ${Date.now() - startTime}ms with ${rows.length} partial row(s)`);
|
|
1335
|
-
abort();
|
|
1336
|
-
resolve({ rows, timedOut: true, headers: capturedHeaders });
|
|
1337
|
-
});
|
|
1338
|
-
}, opts.timeoutMs);
|
|
1339
|
-
if (typeof timer.unref === "function") {
|
|
1340
|
-
timer.unref();
|
|
1341
|
-
}
|
|
1342
|
-
parser.on("headers", (h) => {
|
|
1343
|
-
capturedHeaders = h;
|
|
1344
|
-
});
|
|
1345
|
-
// .pipe() does not forward source errors (disk/permission failures) to
|
|
1346
|
-
// the destination, so listen on the source directly or it throws.
|
|
1347
|
-
source.on("error", (error) => {
|
|
1348
|
-
finish(() => {
|
|
1349
|
-
abort();
|
|
1350
|
-
reject(ErrorFactory.csvParseFailed(buildCsvParseErrorMessage({
|
|
1351
|
-
stage: "read",
|
|
1352
|
-
count,
|
|
1353
|
-
headerCount: capturedHeaders?.length,
|
|
1354
|
-
lastRowColumnCount,
|
|
1355
|
-
location: opts.location,
|
|
1356
|
-
cause: error.message,
|
|
1357
|
-
}), { location: opts.location, rowCount: count }, error));
|
|
1358
|
-
});
|
|
1359
|
-
});
|
|
1360
|
-
source
|
|
1361
|
-
.pipe(parser)
|
|
1362
|
-
.on("data", (row) => {
|
|
1363
|
-
try {
|
|
1364
|
-
assertValidCsvRow(row, count + 1);
|
|
1365
|
-
}
|
|
1366
|
-
catch (err) {
|
|
1367
|
-
finish(() => {
|
|
1368
|
-
abort();
|
|
1369
|
-
reject(err);
|
|
1370
|
-
});
|
|
1371
|
-
return;
|
|
1372
|
-
}
|
|
1373
|
-
// #373: blank rows must not consume maxRows when skipping empties.
|
|
1374
|
-
if (opts.skipEmptyRows && isBlankCsvDataRow(row)) {
|
|
1375
|
-
return;
|
|
1376
|
-
}
|
|
1377
|
-
lastRowColumnCount = Object.keys(row).length;
|
|
1378
|
-
rows.push(row);
|
|
1379
|
-
count++;
|
|
1380
|
-
if (count >= opts.maxRows) {
|
|
1381
|
-
logger.debug(`[CSVProcessor] Reached row limit ${opts.maxRows}, stopping parse`);
|
|
1382
|
-
finish(() => {
|
|
1383
|
-
abort();
|
|
1384
|
-
resolve({ rows, timedOut: false, headers: capturedHeaders });
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
})
|
|
1388
|
-
.on("end", () => {
|
|
1389
|
-
finish(() => {
|
|
1390
|
-
logger.debug(`[CSVProcessor] Parsing complete: ${rows.length} rows parsed`);
|
|
1391
|
-
resolve({ rows, timedOut: false, headers: capturedHeaders });
|
|
1392
|
-
});
|
|
1393
|
-
})
|
|
1394
|
-
.on("error", (error) => {
|
|
1395
|
-
// #371: destroy the source too — .pipe() does NOT auto-destroy the
|
|
1396
|
-
// upstream when the parser Transform errors, leaking the fd/stream.
|
|
1397
|
-
finish(() => {
|
|
1398
|
-
abort();
|
|
1399
|
-
logger.error("[CSVProcessor] Parsing failed:", error);
|
|
1400
|
-
reject(ErrorFactory.csvParseFailed(buildCsvParseErrorMessage({
|
|
1401
|
-
stage: "parse",
|
|
1402
|
-
count,
|
|
1403
|
-
headerCount: capturedHeaders?.length,
|
|
1404
|
-
lastRowColumnCount,
|
|
1405
|
-
location: opts.location,
|
|
1406
|
-
cause: error.message,
|
|
1407
|
-
}), { location: opts.location, rowCount: count }, error));
|
|
1408
|
-
});
|
|
1409
|
-
});
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1412
|
-
/**
|
|
1413
|
-
* Format parsed CSV data for LLM consumption
|
|
1414
|
-
* Only used for JSON and Markdown formats (raw format handled separately)
|
|
1415
|
-
*
|
|
1416
|
-
* @param columnNames - Optional schema headers (#373). When preserved blank
|
|
1417
|
-
* rows lead `rows`, Markdown must still use the real column names.
|
|
1418
|
-
*/
|
|
1419
|
-
static formatForLLM(rows, formatStyle, includeHeaders, columnNames) {
|
|
1420
|
-
if (rows.length === 0) {
|
|
1421
|
-
return "CSV file is empty or contains no data.";
|
|
1422
|
-
}
|
|
1423
|
-
if (formatStyle === "json") {
|
|
1424
|
-
return JSON.stringify(rows, null, 2);
|
|
1425
|
-
}
|
|
1426
|
-
return this.toMarkdownTable(rows, includeHeaders, columnNames);
|
|
1427
|
-
}
|
|
1428
|
-
/**
|
|
1429
|
-
* Format as markdown table
|
|
1430
|
-
* Best for small datasets (<100 rows)
|
|
1431
|
-
*
|
|
1432
|
-
* @param columnNames - Optional explicit headers (#373). Falls back to
|
|
1433
|
-
* `Object.keys(rows[0])` when omitted.
|
|
1434
|
-
*/
|
|
1435
|
-
static toMarkdownTable(rows, includeHeaders, columnNames) {
|
|
1436
|
-
if (rows.length === 0) {
|
|
1437
|
-
return "CSV file is empty or contains no data.";
|
|
1438
|
-
}
|
|
1439
|
-
const headers = columnNames && columnNames.length > 0
|
|
1440
|
-
? columnNames
|
|
1441
|
-
: Object.keys(rows[0] ?? {});
|
|
1442
|
-
if (headers.length === 0) {
|
|
1443
|
-
return "CSV file is empty or contains no data.";
|
|
1444
|
-
}
|
|
1445
|
-
// Escape backslashes, pipes, and sanitize newlines to keep rows intact
|
|
1446
|
-
const escapePipe = (str) => str
|
|
1447
|
-
.replace(/\\/g, "\\\\")
|
|
1448
|
-
.replace(/\|/g, "\\|")
|
|
1449
|
-
.replace(/\r\n|\n|\r/g, " ");
|
|
1450
|
-
let markdown = "";
|
|
1451
|
-
if (includeHeaders) {
|
|
1452
|
-
markdown = "| " + headers.map(escapePipe).join(" | ") + " |\n";
|
|
1453
|
-
markdown += "|" + headers.map(() => " --- ").join("|") + "|\n";
|
|
1454
|
-
}
|
|
1455
|
-
rows.forEach((row) => {
|
|
1456
|
-
markdown +=
|
|
1457
|
-
"| " +
|
|
1458
|
-
headers.map((h) => escapePipe(String(row[h] || ""))).join(" | ") +
|
|
1459
|
-
" |\n";
|
|
1460
|
-
});
|
|
1461
|
-
return markdown;
|
|
1462
|
-
}
|
|
1463
|
-
/**
|
|
1464
|
-
* Format sample data according to the specified format
|
|
1465
|
-
*
|
|
1466
|
-
* @param sampleRows - Array of sample row objects
|
|
1467
|
-
* @param format - Output format for sample data
|
|
1468
|
-
* @param includeHeaders - Whether to include headers in CSV/markdown formats
|
|
1469
|
-
* @param columnNames - Optional schema headers for csv/markdown (#373)
|
|
1470
|
-
* @returns Formatted sample data as string or array
|
|
1471
|
-
*/
|
|
1472
|
-
static formatSampleData(sampleRows, format, includeHeaders, columnNames) {
|
|
1473
|
-
if (sampleRows.length === 0) {
|
|
1474
|
-
return format === "object" ? [] : "No data rows";
|
|
1475
|
-
}
|
|
1476
|
-
switch (format) {
|
|
1477
|
-
case "object":
|
|
1478
|
-
return sampleRows;
|
|
1479
|
-
case "json":
|
|
1480
|
-
return JSON.stringify(sampleRows, null, 2);
|
|
1481
|
-
case "csv":
|
|
1482
|
-
return this.toCSVString(sampleRows, includeHeaders, columnNames);
|
|
1483
|
-
case "markdown":
|
|
1484
|
-
return this.toMarkdownTable(sampleRows, includeHeaders, columnNames);
|
|
1485
|
-
default:
|
|
1486
|
-
return sampleRows;
|
|
1487
|
-
}
|
|
1488
|
-
}
|
|
1489
|
-
/**
|
|
1490
|
-
* Convert row objects to CSV string format
|
|
1491
|
-
*
|
|
1492
|
-
* @param rows - Array of row objects
|
|
1493
|
-
* @param includeHeaders - Whether to include header row
|
|
1494
|
-
* @param columnNames - Optional explicit headers (#373)
|
|
1495
|
-
* @returns CSV formatted string
|
|
1496
|
-
*/
|
|
1497
|
-
static toCSVString(rows, includeHeaders, columnNames) {
|
|
1498
|
-
if (rows.length === 0) {
|
|
1499
|
-
return "";
|
|
1500
|
-
}
|
|
1501
|
-
const headers = columnNames && columnNames.length > 0
|
|
1502
|
-
? columnNames
|
|
1503
|
-
: Object.keys(rows[0] ?? {});
|
|
1504
|
-
if (headers.length === 0) {
|
|
1505
|
-
return "";
|
|
1506
|
-
}
|
|
1507
|
-
// Escape CSV values (wrap in quotes if contains comma, quote, or newline)
|
|
1508
|
-
const escapeCSV = (value) => {
|
|
1509
|
-
if (value.includes(",") ||
|
|
1510
|
-
value.includes('"') ||
|
|
1511
|
-
/\r\n|\n|\r/.test(value)) {
|
|
1512
|
-
return `"${value.replace(/"/g, '""')}"`;
|
|
1513
|
-
}
|
|
1514
|
-
return value;
|
|
1515
|
-
};
|
|
1516
|
-
const lines = [];
|
|
1517
|
-
if (includeHeaders) {
|
|
1518
|
-
lines.push(headers.map(escapeCSV).join(","));
|
|
1519
|
-
}
|
|
1520
|
-
rows.forEach((row) => {
|
|
1521
|
-
const values = headers.map((h) => escapeCSV(String(row[h] ?? "")));
|
|
1522
|
-
lines.push(values.join(","));
|
|
1523
|
-
});
|
|
1524
|
-
return lines.join("\n");
|
|
1525
|
-
}
|
|
1526
|
-
}
|
|
1527
|
-
//# sourceMappingURL=csvProcessor.js.map
|