@hibanacloud/core 0.3.15
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/dist/.last_build +0 -0
- package/dist/index.d.ts +19 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/src/__mocks__/fs/promises.d.ts +11 -0
- package/dist/src/__mocks__/fs/promises.js +17 -0
- package/dist/src/__mocks__/fs/promises.js.map +1 -0
- package/dist/src/code_assist/codeAssist.d.ts +12 -0
- package/dist/src/code_assist/codeAssist.js +31 -0
- package/dist/src/code_assist/codeAssist.js.map +1 -0
- package/dist/src/code_assist/converter.d.ts +74 -0
- package/dist/src/code_assist/converter.js +160 -0
- package/dist/src/code_assist/converter.js.map +1 -0
- package/dist/src/code_assist/converter.test.d.ts +6 -0
- package/dist/src/code_assist/converter.test.js +372 -0
- package/dist/src/code_assist/converter.test.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.d.ts +25 -0
- package/dist/src/code_assist/oauth-credential-storage.js +109 -0
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.test.d.ts +6 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js +136 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -0
- package/dist/src/code_assist/oauth2.d.ts +22 -0
- package/dist/src/code_assist/oauth2.js +431 -0
- package/dist/src/code_assist/oauth2.js.map +1 -0
- package/dist/src/code_assist/oauth2.test.d.ts +6 -0
- package/dist/src/code_assist/oauth2.test.js +818 -0
- package/dist/src/code_assist/oauth2.test.js.map +1 -0
- package/dist/src/code_assist/server.d.ts +37 -0
- package/dist/src/code_assist/server.js +148 -0
- package/dist/src/code_assist/server.js.map +1 -0
- package/dist/src/code_assist/server.test.d.ts +6 -0
- package/dist/src/code_assist/server.test.js +159 -0
- package/dist/src/code_assist/server.test.js.map +1 -0
- package/dist/src/code_assist/setup.d.ts +20 -0
- package/dist/src/code_assist/setup.js +101 -0
- package/dist/src/code_assist/setup.js.map +1 -0
- package/dist/src/code_assist/setup.test.d.ts +6 -0
- package/dist/src/code_assist/setup.test.js +171 -0
- package/dist/src/code_assist/setup.test.js.map +1 -0
- package/dist/src/code_assist/types.d.ts +163 -0
- package/dist/src/code_assist/types.js +46 -0
- package/dist/src/code_assist/types.js.map +1 -0
- package/dist/src/config/config.d.ts +431 -0
- package/dist/src/config/config.js +869 -0
- package/dist/src/config/config.js.map +1 -0
- package/dist/src/config/config.test.d.ts +6 -0
- package/dist/src/config/config.test.js +896 -0
- package/dist/src/config/config.test.js.map +1 -0
- package/dist/src/config/constants.d.ts +11 -0
- package/dist/src/config/constants.js +16 -0
- package/dist/src/config/constants.js.map +1 -0
- package/dist/src/config/flashFallback.test.d.ts +6 -0
- package/dist/src/config/flashFallback.test.js +87 -0
- package/dist/src/config/flashFallback.test.js.map +1 -0
- package/dist/src/config/models.d.ts +28 -0
- package/dist/src/config/models.js +42 -0
- package/dist/src/config/models.js.map +1 -0
- package/dist/src/config/models.test.d.ts +6 -0
- package/dist/src/config/models.test.js +55 -0
- package/dist/src/config/models.test.js.map +1 -0
- package/dist/src/config/storage.d.ts +34 -0
- package/dist/src/config/storage.js +95 -0
- package/dist/src/config/storage.js.map +1 -0
- package/dist/src/config/storage.test.d.ts +6 -0
- package/dist/src/config/storage.test.js +43 -0
- package/dist/src/config/storage.test.js.map +1 -0
- package/dist/src/core/__tests__/openaiTimeoutHandling.test.d.ts +6 -0
- package/dist/src/core/__tests__/openaiTimeoutHandling.test.js +295 -0
- package/dist/src/core/__tests__/openaiTimeoutHandling.test.js.map +1 -0
- package/dist/src/core/__tests__/orphanedToolCallsTest.d.ts +64 -0
- package/dist/src/core/__tests__/orphanedToolCallsTest.js +122 -0
- package/dist/src/core/__tests__/orphanedToolCallsTest.js.map +1 -0
- package/dist/src/core/baseLlmClient.d.ts +49 -0
- package/dist/src/core/baseLlmClient.js +104 -0
- package/dist/src/core/baseLlmClient.js.map +1 -0
- package/dist/src/core/baseLlmClient.test.d.ts +6 -0
- package/dist/src/core/baseLlmClient.test.js +323 -0
- package/dist/src/core/baseLlmClient.test.js.map +1 -0
- package/dist/src/core/client.d.ts +56 -0
- package/dist/src/core/client.js +522 -0
- package/dist/src/core/client.js.map +1 -0
- package/dist/src/core/client.test.d.ts +6 -0
- package/dist/src/core/client.test.js +1829 -0
- package/dist/src/core/client.test.js.map +1 -0
- package/dist/src/core/contentGenerator.d.ts +52 -0
- package/dist/src/core/contentGenerator.js +106 -0
- package/dist/src/core/contentGenerator.js.map +1 -0
- package/dist/src/core/contentGenerator.test.d.ts +6 -0
- package/dist/src/core/contentGenerator.test.js +77 -0
- package/dist/src/core/contentGenerator.test.js.map +1 -0
- package/dist/src/core/coreToolScheduler.d.ts +134 -0
- package/dist/src/core/coreToolScheduler.js +774 -0
- package/dist/src/core/coreToolScheduler.js.map +1 -0
- package/dist/src/core/coreToolScheduler.test.d.ts +6 -0
- package/dist/src/core/coreToolScheduler.test.js +1802 -0
- package/dist/src/core/coreToolScheduler.test.js.map +1 -0
- package/dist/src/core/geminiChat.d.ts +124 -0
- package/dist/src/core/geminiChat.js +518 -0
- package/dist/src/core/geminiChat.js.map +1 -0
- package/dist/src/core/geminiChat.test.d.ts +6 -0
- package/dist/src/core/geminiChat.test.js +1149 -0
- package/dist/src/core/geminiChat.test.js.map +1 -0
- package/dist/src/core/geminiRequest.d.ts +13 -0
- package/dist/src/core/geminiRequest.js +11 -0
- package/dist/src/core/geminiRequest.js.map +1 -0
- package/dist/src/core/geminiRequest.test.d.ts +6 -0
- package/dist/src/core/geminiRequest.test.js +73 -0
- package/dist/src/core/geminiRequest.test.js.map +1 -0
- package/dist/src/core/logger.d.ts +67 -0
- package/dist/src/core/logger.js +361 -0
- package/dist/src/core/logger.js.map +1 -0
- package/dist/src/core/logger.test.d.ts +6 -0
- package/dist/src/core/logger.test.js +534 -0
- package/dist/src/core/logger.test.js.map +1 -0
- package/dist/src/core/loggingContentGenerator.d.ts +25 -0
- package/dist/src/core/loggingContentGenerator.js +94 -0
- package/dist/src/core/loggingContentGenerator.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +16 -0
- package/dist/src/core/nonInteractiveToolExecutor.js +29 -0
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.d.ts +6 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.js +294 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/constants.d.ts +7 -0
- package/dist/src/core/openaiContentGenerator/constants.js +8 -0
- package/dist/src/core/openaiContentGenerator/constants.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/converter.d.ts +108 -0
- package/dist/src/core/openaiContentGenerator/converter.js +851 -0
- package/dist/src/core/openaiContentGenerator/converter.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/converter.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/converter.test.js +108 -0
- package/dist/src/core/openaiContentGenerator/converter.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.d.ts +20 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.js +82 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.test.js +287 -0
- package/dist/src/core/openaiContentGenerator/errorHandler.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/index.d.ts +22 -0
- package/dist/src/core/openaiContentGenerator/index.js +49 -0
- package/dist/src/core/openaiContentGenerator/index.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.d.ts +21 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.js +105 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.test.js +230 -0
- package/dist/src/core/openaiContentGenerator/openaiContentGenerator.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/pipeline.d.ts +66 -0
- package/dist/src/core/openaiContentGenerator/pipeline.js +265 -0
- package/dist/src/core/openaiContentGenerator/pipeline.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/pipeline.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/pipeline.test.js +1028 -0
- package/dist/src/core/openaiContentGenerator/pipeline.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/README.md +61 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.d.ts +14 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.js +28 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.test.d.ts +1 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.test.js +138 -0
- package/dist/src/core/openaiContentGenerator/provider/anthropic.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.d.ts +63 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.js +241 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.test.js +707 -0
- package/dist/src/core/openaiContentGenerator/provider/dashscope.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.d.ts +14 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.js +70 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.test.js +151 -0
- package/dist/src/core/openaiContentGenerator/provider/deepseek.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/default.d.ts +15 -0
- package/dist/src/core/openaiContentGenerator/provider/default.js +48 -0
- package/dist/src/core/openaiContentGenerator/provider/default.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/default.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/default.test.js +176 -0
- package/dist/src/core/openaiContentGenerator/provider/default.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/index.d.ts +7 -0
- package/dist/src/core/openaiContentGenerator/provider/index.js +7 -0
- package/dist/src/core/openaiContentGenerator/provider/index.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.d.ts +17 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.js +25 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.test.js +66 -0
- package/dist/src/core/openaiContentGenerator/provider/modelscope.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.d.ts +10 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.js +33 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.test.js +175 -0
- package/dist/src/core/openaiContentGenerator/provider/openrouter.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/provider/types.d.ts +23 -0
- package/dist/src/core/openaiContentGenerator/provider/types.js +2 -0
- package/dist/src/core/openaiContentGenerator/provider/types.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.d.ts +145 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.js +381 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.test.js +537 -0
- package/dist/src/core/openaiContentGenerator/streamingToolCallParser.test.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.d.ts +36 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.js +150 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.js.map +1 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.test.d.ts +6 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.test.js +978 -0
- package/dist/src/core/openaiContentGenerator/telemetryService.test.js.map +1 -0
- package/dist/src/core/prompts.d.ts +73 -0
- package/dist/src/core/prompts.js +813 -0
- package/dist/src/core/prompts.js.map +1 -0
- package/dist/src/core/prompts.test.d.ts +6 -0
- package/dist/src/core/prompts.test.js +488 -0
- package/dist/src/core/prompts.test.js.map +1 -0
- package/dist/src/core/tokenLimits.d.ts +25 -0
- package/dist/src/core/tokenLimits.js +194 -0
- package/dist/src/core/tokenLimits.js.map +1 -0
- package/dist/src/core/tokenLimits.test.d.ts +1 -0
- package/dist/src/core/tokenLimits.test.js +304 -0
- package/dist/src/core/tokenLimits.test.js.map +1 -0
- package/dist/src/core/turn.d.ts +152 -0
- package/dist/src/core/turn.js +187 -0
- package/dist/src/core/turn.js.map +1 -0
- package/dist/src/core/turn.test.d.ts +6 -0
- package/dist/src/core/turn.test.js +628 -0
- package/dist/src/core/turn.test.js.map +1 -0
- package/dist/src/fallback/handler.d.ts +7 -0
- package/dist/src/fallback/handler.js +97 -0
- package/dist/src/fallback/handler.js.map +1 -0
- package/dist/src/fallback/handler.test.d.ts +6 -0
- package/dist/src/fallback/handler.test.js +130 -0
- package/dist/src/fallback/handler.test.js.map +1 -0
- package/dist/src/fallback/types.d.ts +14 -0
- package/dist/src/fallback/types.js +7 -0
- package/dist/src/fallback/types.js.map +1 -0
- package/dist/src/generated/git-commit.d.ts +7 -0
- package/dist/src/generated/git-commit.js +10 -0
- package/dist/src/generated/git-commit.js.map +1 -0
- package/dist/src/ide/constants.d.ts +9 -0
- package/dist/src/ide/constants.js +10 -0
- package/dist/src/ide/constants.js.map +1 -0
- package/dist/src/ide/detect-ide.d.ts +56 -0
- package/dist/src/ide/detect-ide.js +68 -0
- package/dist/src/ide/detect-ide.js.map +1 -0
- package/dist/src/ide/detect-ide.test.d.ts +6 -0
- package/dist/src/ide/detect-ide.test.js +113 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -0
- package/dist/src/ide/ide-client.d.ts +110 -0
- package/dist/src/ide/ide-client.js +651 -0
- package/dist/src/ide/ide-client.js.map +1 -0
- package/dist/src/ide/ide-client.test.d.ts +6 -0
- package/dist/src/ide/ide-client.test.js +390 -0
- package/dist/src/ide/ide-client.test.js.map +1 -0
- package/dist/src/ide/ide-installer.d.ts +14 -0
- package/dist/src/ide/ide-installer.js +112 -0
- package/dist/src/ide/ide-installer.js.map +1 -0
- package/dist/src/ide/ide-installer.test.d.ts +6 -0
- package/dist/src/ide/ide-installer.test.js +134 -0
- package/dist/src/ide/ide-installer.test.js.map +1 -0
- package/dist/src/ide/ideContext.d.ts +44 -0
- package/dist/src/ide/ideContext.js +101 -0
- package/dist/src/ide/ideContext.js.map +1 -0
- package/dist/src/ide/ideContext.test.d.ts +6 -0
- package/dist/src/ide/ideContext.test.js +393 -0
- package/dist/src/ide/ideContext.test.js.map +1 -0
- package/dist/src/ide/process-utils.d.ts +21 -0
- package/dist/src/ide/process-utils.js +171 -0
- package/dist/src/ide/process-utils.js.map +1 -0
- package/dist/src/ide/process-utils.test.d.ts +6 -0
- package/dist/src/ide/process-utils.test.js +158 -0
- package/dist/src/ide/process-utils.test.js.map +1 -0
- package/dist/src/ide/types.d.ts +486 -0
- package/dist/src/ide/types.js +138 -0
- package/dist/src/ide/types.js.map +1 -0
- package/dist/src/index.d.ts +99 -0
- package/dist/src/index.js +112 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/index.test.d.ts +6 -0
- package/dist/src/index.test.js +12 -0
- package/dist/src/index.test.js.map +1 -0
- package/dist/src/mcp/google-auth-provider.d.ts +23 -0
- package/dist/src/mcp/google-auth-provider.js +72 -0
- package/dist/src/mcp/google-auth-provider.js.map +1 -0
- package/dist/src/mcp/google-auth-provider.test.d.ts +6 -0
- package/dist/src/mcp/google-auth-provider.test.js +89 -0
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -0
- package/dist/src/mcp/oauth-provider.d.ts +150 -0
- package/dist/src/mcp/oauth-provider.js +613 -0
- package/dist/src/mcp/oauth-provider.js.map +1 -0
- package/dist/src/mcp/oauth-provider.test.d.ts +6 -0
- package/dist/src/mcp/oauth-provider.test.js +847 -0
- package/dist/src/mcp/oauth-provider.test.js.map +1 -0
- package/dist/src/mcp/oauth-token-storage.d.ts +65 -0
- package/dist/src/mcp/oauth-token-storage.js +180 -0
- package/dist/src/mcp/oauth-token-storage.js.map +1 -0
- package/dist/src/mcp/oauth-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/oauth-token-storage.test.js +299 -0
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -0
- package/dist/src/mcp/oauth-utils.d.ts +119 -0
- package/dist/src/mcp/oauth-utils.js +236 -0
- package/dist/src/mcp/oauth-utils.js.map +1 -0
- package/dist/src/mcp/oauth-utils.test.d.ts +6 -0
- package/dist/src/mcp/oauth-utils.test.js +199 -0
- package/dist/src/mcp/oauth-utils.test.js.map +1 -0
- package/dist/src/mcp/sa-impersonation-provider.d.ts +33 -0
- package/dist/src/mcp/sa-impersonation-provider.js +130 -0
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -0
- package/dist/src/mcp/sa-impersonation-provider.test.d.ts +6 -0
- package/dist/src/mcp/sa-impersonation-provider.test.js +117 -0
- package/dist/src/mcp/sa-impersonation-provider.test.js.map +1 -0
- package/dist/src/mcp/token-storage/base-token-storage.d.ts +19 -0
- package/dist/src/mcp/token-storage/base-token-storage.js +36 -0
- package/dist/src/mcp/token-storage/base-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.js +160 -0
- package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/file-token-storage.d.ts +24 -0
- package/dist/src/mcp/token-storage/file-token-storage.js +144 -0
- package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.js +235 -0
- package/dist/src/mcp/token-storage/file-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.d.ts +23 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.js +78 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js +193 -0
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/index.d.ts +11 -0
- package/dist/src/mcp/token-storage/index.js +12 -0
- package/dist/src/mcp/token-storage/index.js.map +1 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +31 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js +190 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.d.ts +6 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +254 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/types.d.ts +38 -0
- package/dist/src/mcp/token-storage/types.js +11 -0
- package/dist/src/mcp/token-storage/types.js.map +1 -0
- package/dist/src/mocks/msw.d.ts +6 -0
- package/dist/src/mocks/msw.js +8 -0
- package/dist/src/mocks/msw.js.map +1 -0
- package/dist/src/oauth/callbackServer.d.ts +15 -0
- package/dist/src/oauth/callbackServer.js +89 -0
- package/dist/src/oauth/callbackServer.js.map +1 -0
- package/dist/src/oauth/oauthClient.d.ts +57 -0
- package/dist/src/oauth/oauthClient.js +233 -0
- package/dist/src/oauth/oauthClient.js.map +1 -0
- package/dist/src/oauth/pkce.d.ts +25 -0
- package/dist/src/oauth/pkce.js +45 -0
- package/dist/src/oauth/pkce.js.map +1 -0
- package/dist/src/oauth/tokenManager.d.ts +37 -0
- package/dist/src/oauth/tokenManager.js +110 -0
- package/dist/src/oauth/tokenManager.js.map +1 -0
- package/dist/src/output/json-formatter.d.ts +11 -0
- package/dist/src/output/json-formatter.js +30 -0
- package/dist/src/output/json-formatter.js.map +1 -0
- package/dist/src/output/json-formatter.test.d.ts +6 -0
- package/dist/src/output/json-formatter.test.js +266 -0
- package/dist/src/output/json-formatter.test.js.map +1 -0
- package/dist/src/output/types.d.ts +25 -0
- package/dist/src/output/types.js +17 -0
- package/dist/src/output/types.js.map +1 -0
- package/dist/src/prompts/mcp-prompts.d.ts +8 -0
- package/dist/src/prompts/mcp-prompts.js +13 -0
- package/dist/src/prompts/mcp-prompts.js.map +1 -0
- package/dist/src/prompts/prompt-registry.d.ts +34 -0
- package/dist/src/prompts/prompt-registry.js +63 -0
- package/dist/src/prompts/prompt-registry.js.map +1 -0
- package/dist/src/qwen/qwenContentGenerator.d.ts +70 -0
- package/dist/src/qwen/qwenContentGenerator.js +180 -0
- package/dist/src/qwen/qwenContentGenerator.js.map +1 -0
- package/dist/src/qwen/qwenContentGenerator.test.d.ts +6 -0
- package/dist/src/qwen/qwenContentGenerator.test.js +1178 -0
- package/dist/src/qwen/qwenContentGenerator.test.js.map +1 -0
- package/dist/src/qwen/qwenOAuth2.d.ts +194 -0
- package/dist/src/qwen/qwenOAuth2.js +594 -0
- package/dist/src/qwen/qwenOAuth2.js.map +1 -0
- package/dist/src/qwen/qwenOAuth2.test.d.ts +6 -0
- package/dist/src/qwen/qwenOAuth2.test.js +1724 -0
- package/dist/src/qwen/qwenOAuth2.test.js.map +1 -0
- package/dist/src/qwen/sharedTokenManager.d.ts +196 -0
- package/dist/src/qwen/sharedTokenManager.js +647 -0
- package/dist/src/qwen/sharedTokenManager.js.map +1 -0
- package/dist/src/qwen/sharedTokenManager.test.d.ts +7 -0
- package/dist/src/qwen/sharedTokenManager.test.js +662 -0
- package/dist/src/qwen/sharedTokenManager.test.js.map +1 -0
- package/dist/src/services/chatCompressionService.d.ts +32 -0
- package/dist/src/services/chatCompressionService.js +180 -0
- package/dist/src/services/chatCompressionService.js.map +1 -0
- package/dist/src/services/chatCompressionService.test.d.ts +6 -0
- package/dist/src/services/chatCompressionService.test.js +292 -0
- package/dist/src/services/chatCompressionService.test.js.map +1 -0
- package/dist/src/services/chatRecordingService.d.ts +144 -0
- package/dist/src/services/chatRecordingService.js +330 -0
- package/dist/src/services/chatRecordingService.js.map +1 -0
- package/dist/src/services/chatRecordingService.test.d.ts +6 -0
- package/dist/src/services/chatRecordingService.test.js +332 -0
- package/dist/src/services/chatRecordingService.test.js.map +1 -0
- package/dist/src/services/fileDiscoveryService.d.ts +45 -0
- package/dist/src/services/fileDiscoveryService.js +104 -0
- package/dist/src/services/fileDiscoveryService.js.map +1 -0
- package/dist/src/services/fileDiscoveryService.test.d.ts +6 -0
- package/dist/src/services/fileDiscoveryService.test.js +143 -0
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -0
- package/dist/src/services/fileSystemService.d.ts +40 -0
- package/dist/src/services/fileSystemService.js +29 -0
- package/dist/src/services/fileSystemService.js.map +1 -0
- package/dist/src/services/fileSystemService.test.d.ts +6 -0
- package/dist/src/services/fileSystemService.test.js +41 -0
- package/dist/src/services/fileSystemService.test.js.map +1 -0
- package/dist/src/services/gitService.d.ts +22 -0
- package/dist/src/services/gitService.js +98 -0
- package/dist/src/services/gitService.js.map +1 -0
- package/dist/src/services/gitService.test.d.ts +6 -0
- package/dist/src/services/gitService.test.js +187 -0
- package/dist/src/services/gitService.test.js.map +1 -0
- package/dist/src/services/loopDetectionService.d.ts +103 -0
- package/dist/src/services/loopDetectionService.js +379 -0
- package/dist/src/services/loopDetectionService.js.map +1 -0
- package/dist/src/services/loopDetectionService.test.d.ts +6 -0
- package/dist/src/services/loopDetectionService.test.js +588 -0
- package/dist/src/services/loopDetectionService.test.js.map +1 -0
- package/dist/src/services/shellExecutionService.d.ts +102 -0
- package/dist/src/services/shellExecutionService.js +522 -0
- package/dist/src/services/shellExecutionService.js.map +1 -0
- package/dist/src/services/shellExecutionService.test.d.ts +6 -0
- package/dist/src/services/shellExecutionService.test.js +655 -0
- package/dist/src/services/shellExecutionService.test.js.map +1 -0
- package/dist/src/subagents/builtin-agents.d.ts +35 -0
- package/dist/src/subagents/builtin-agents.js +85 -0
- package/dist/src/subagents/builtin-agents.js.map +1 -0
- package/dist/src/subagents/builtin-agents.test.d.ts +6 -0
- package/dist/src/subagents/builtin-agents.test.js +78 -0
- package/dist/src/subagents/builtin-agents.test.js.map +1 -0
- package/dist/src/subagents/index.d.ts +29 -0
- package/dist/src/subagents/index.js +15 -0
- package/dist/src/subagents/index.js.map +1 -0
- package/dist/src/subagents/subagent-events.d.ts +95 -0
- package/dist/src/subagents/subagent-events.js +31 -0
- package/dist/src/subagents/subagent-events.js.map +1 -0
- package/dist/src/subagents/subagent-hooks.d.ts +29 -0
- package/dist/src/subagents/subagent-hooks.js +7 -0
- package/dist/src/subagents/subagent-hooks.js.map +1 -0
- package/dist/src/subagents/subagent-manager.d.ts +170 -0
- package/dist/src/subagents/subagent-manager.js +596 -0
- package/dist/src/subagents/subagent-manager.js.map +1 -0
- package/dist/src/subagents/subagent-manager.test.d.ts +6 -0
- package/dist/src/subagents/subagent-manager.test.js +822 -0
- package/dist/src/subagents/subagent-manager.test.js.map +1 -0
- package/dist/src/subagents/subagent-statistics.d.ts +46 -0
- package/dist/src/subagents/subagent-statistics.js +193 -0
- package/dist/src/subagents/subagent-statistics.js.map +1 -0
- package/dist/src/subagents/subagent-statistics.test.d.ts +6 -0
- package/dist/src/subagents/subagent-statistics.test.js +231 -0
- package/dist/src/subagents/subagent-statistics.test.js.map +1 -0
- package/dist/src/subagents/subagent.d.ts +162 -0
- package/dist/src/subagents/subagent.js +677 -0
- package/dist/src/subagents/subagent.js.map +1 -0
- package/dist/src/subagents/subagent.test.d.ts +6 -0
- package/dist/src/subagents/subagent.test.js +477 -0
- package/dist/src/subagents/subagent.test.js.map +1 -0
- package/dist/src/subagents/types.d.ts +218 -0
- package/dist/src/subagents/types.js +58 -0
- package/dist/src/subagents/types.js.map +1 -0
- package/dist/src/subagents/types.test.d.ts +6 -0
- package/dist/src/subagents/types.test.js +31 -0
- package/dist/src/subagents/types.test.js.map +1 -0
- package/dist/src/subagents/validation.d.ts +63 -0
- package/dist/src/subagents/validation.js +293 -0
- package/dist/src/subagents/validation.js.map +1 -0
- package/dist/src/subagents/validation.test.d.ts +6 -0
- package/dist/src/subagents/validation.test.js +330 -0
- package/dist/src/subagents/validation.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +137 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +915 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +18 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +594 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +115 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +291 -0
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -0
- package/dist/src/telemetry/config.d.ts +31 -0
- package/dist/src/telemetry/config.js +76 -0
- package/dist/src/telemetry/config.js.map +1 -0
- package/dist/src/telemetry/config.test.d.ts +6 -0
- package/dist/src/telemetry/config.test.js +124 -0
- package/dist/src/telemetry/config.test.js.map +1 -0
- package/dist/src/telemetry/constants.d.ts +36 -0
- package/dist/src/telemetry/constants.js +38 -0
- package/dist/src/telemetry/constants.js.map +1 -0
- package/dist/src/telemetry/file-exporters.d.ts +29 -0
- package/dist/src/telemetry/file-exporters.js +62 -0
- package/dist/src/telemetry/file-exporters.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +25 -0
- package/dist/src/telemetry/index.js +31 -0
- package/dist/src/telemetry/index.js.map +1 -0
- package/dist/src/telemetry/integration.test.circular.d.ts +6 -0
- package/dist/src/telemetry/integration.test.circular.js +95 -0
- package/dist/src/telemetry/integration.test.circular.js.map +1 -0
- package/dist/src/telemetry/loggers.d.ts +37 -0
- package/dist/src/telemetry/loggers.js +651 -0
- package/dist/src/telemetry/loggers.js.map +1 -0
- package/dist/src/telemetry/loggers.test.circular.d.ts +6 -0
- package/dist/src/telemetry/loggers.test.circular.js +107 -0
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -0
- package/dist/src/telemetry/loggers.test.d.ts +6 -0
- package/dist/src/telemetry/loggers.test.js +978 -0
- package/dist/src/telemetry/loggers.test.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +320 -0
- package/dist/src/telemetry/metrics.js +532 -0
- package/dist/src/telemetry/metrics.js.map +1 -0
- package/dist/src/telemetry/metrics.test.d.ts +6 -0
- package/dist/src/telemetry/metrics.test.js +744 -0
- package/dist/src/telemetry/metrics.test.js.map +1 -0
- package/dist/src/telemetry/qwen-logger/event-types.d.ts +88 -0
- package/dist/src/telemetry/qwen-logger/event-types.js +2 -0
- package/dist/src/telemetry/qwen-logger/event-types.js.map +1 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.d.ts +91 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.js +685 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.js.map +1 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.test.d.ts +6 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.test.js +317 -0
- package/dist/src/telemetry/qwen-logger/qwen-logger.test.js.map +1 -0
- package/dist/src/telemetry/sdk.d.ts +9 -0
- package/dist/src/telemetry/sdk.js +164 -0
- package/dist/src/telemetry/sdk.js.map +1 -0
- package/dist/src/telemetry/sdk.test.d.ts +6 -0
- package/dist/src/telemetry/sdk.test.js +116 -0
- package/dist/src/telemetry/sdk.test.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.d.ts +6 -0
- package/dist/src/telemetry/telemetry-utils.js +14 -0
- package/dist/src/telemetry/telemetry-utils.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.test.d.ts +6 -0
- package/dist/src/telemetry/telemetry-utils.test.js +40 -0
- package/dist/src/telemetry/telemetry-utils.test.js.map +1 -0
- package/dist/src/telemetry/telemetry.test.d.ts +6 -0
- package/dist/src/telemetry/telemetry.test.js +50 -0
- package/dist/src/telemetry/telemetry.test.js.map +1 -0
- package/dist/src/telemetry/tool-call-decision.d.ts +13 -0
- package/dist/src/telemetry/tool-call-decision.js +29 -0
- package/dist/src/telemetry/tool-call-decision.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +327 -0
- package/dist/src/telemetry/types.js +558 -0
- package/dist/src/telemetry/types.js.map +1 -0
- package/dist/src/telemetry/uiTelemetry.d.ts +75 -0
- package/dist/src/telemetry/uiTelemetry.js +152 -0
- package/dist/src/telemetry/uiTelemetry.js.map +1 -0
- package/dist/src/telemetry/uiTelemetry.test.d.ts +6 -0
- package/dist/src/telemetry/uiTelemetry.test.js +625 -0
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -0
- package/dist/src/test-utils/config.d.ts +17 -0
- package/dist/src/test-utils/config.js +32 -0
- package/dist/src/test-utils/config.js.map +1 -0
- package/dist/src/test-utils/index.d.ts +6 -0
- package/dist/src/test-utils/index.js +7 -0
- package/dist/src/test-utils/index.js.map +1 -0
- package/dist/src/test-utils/mock-tool.d.ts +66 -0
- package/dist/src/test-utils/mock-tool.js +121 -0
- package/dist/src/test-utils/mock-tool.js.map +1 -0
- package/dist/src/test-utils/mockWorkspaceContext.d.ts +13 -0
- package/dist/src/test-utils/mockWorkspaceContext.js +24 -0
- package/dist/src/test-utils/mockWorkspaceContext.js.map +1 -0
- package/dist/src/tools/diffOptions.d.ts +9 -0
- package/dist/src/tools/diffOptions.js +46 -0
- package/dist/src/tools/diffOptions.js.map +1 -0
- package/dist/src/tools/diffOptions.test.d.ts +6 -0
- package/dist/src/tools/diffOptions.test.js +155 -0
- package/dist/src/tools/diffOptions.test.js.map +1 -0
- package/dist/src/tools/edit.d.ts +55 -0
- package/dist/src/tools/edit.js +421 -0
- package/dist/src/tools/edit.js.map +1 -0
- package/dist/src/tools/edit.test.d.ts +6 -0
- package/dist/src/tools/edit.test.js +684 -0
- package/dist/src/tools/edit.test.js.map +1 -0
- package/dist/src/tools/exitPlanMode.d.ts +28 -0
- package/dist/src/tools/exitPlanMode.js +132 -0
- package/dist/src/tools/exitPlanMode.js.map +1 -0
- package/dist/src/tools/exitPlanMode.test.d.ts +6 -0
- package/dist/src/tools/exitPlanMode.test.js +178 -0
- package/dist/src/tools/exitPlanMode.test.js.map +1 -0
- package/dist/src/tools/glob.d.ts +44 -0
- package/dist/src/tools/glob.js +190 -0
- package/dist/src/tools/glob.js.map +1 -0
- package/dist/src/tools/glob.test.d.ts +6 -0
- package/dist/src/tools/glob.test.js +442 -0
- package/dist/src/tools/glob.test.js.map +1 -0
- package/dist/src/tools/grep.d.ts +44 -0
- package/dist/src/tools/grep.js +425 -0
- package/dist/src/tools/grep.js.map +1 -0
- package/dist/src/tools/grep.test.d.ts +6 -0
- package/dist/src/tools/grep.test.js +360 -0
- package/dist/src/tools/grep.test.js.map +1 -0
- package/dist/src/tools/ls.d.ts +68 -0
- package/dist/src/tools/ls.js +215 -0
- package/dist/src/tools/ls.js.map +1 -0
- package/dist/src/tools/ls.test.d.ts +6 -0
- package/dist/src/tools/ls.test.js +249 -0
- package/dist/src/tools/ls.test.js.map +1 -0
- package/dist/src/tools/mcp-client-manager.d.ts +40 -0
- package/dist/src/tools/mcp-client-manager.js +83 -0
- package/dist/src/tools/mcp-client-manager.js.map +1 -0
- package/dist/src/tools/mcp-client-manager.test.d.ts +6 -0
- package/dist/src/tools/mcp-client-manager.test.js +58 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -0
- package/dist/src/tools/mcp-client.d.ts +189 -0
- package/dist/src/tools/mcp-client.js +957 -0
- package/dist/src/tools/mcp-client.js.map +1 -0
- package/dist/src/tools/mcp-client.test.d.ts +6 -0
- package/dist/src/tools/mcp-client.test.js +309 -0
- package/dist/src/tools/mcp-client.test.js.map +1 -0
- package/dist/src/tools/mcp-tool.d.ts +24 -0
- package/dist/src/tools/mcp-tool.js +268 -0
- package/dist/src/tools/mcp-tool.js.map +1 -0
- package/dist/src/tools/mcp-tool.test.d.ts +6 -0
- package/dist/src/tools/mcp-tool.test.js +714 -0
- package/dist/src/tools/mcp-tool.test.js.map +1 -0
- package/dist/src/tools/memoryTool.d.ts +41 -0
- package/dist/src/tools/memoryTool.js +396 -0
- package/dist/src/tools/memoryTool.js.map +1 -0
- package/dist/src/tools/memoryTool.test.d.ts +6 -0
- package/dist/src/tools/memoryTool.test.js +419 -0
- package/dist/src/tools/memoryTool.test.js.map +1 -0
- package/dist/src/tools/modifiable-tool.d.ts +32 -0
- package/dist/src/tools/modifiable-tool.js +88 -0
- package/dist/src/tools/modifiable-tool.js.map +1 -0
- package/dist/src/tools/modifiable-tool.test.d.ts +6 -0
- package/dist/src/tools/modifiable-tool.test.js +193 -0
- package/dist/src/tools/modifiable-tool.test.js.map +1 -0
- package/dist/src/tools/read-file.d.ts +35 -0
- package/dist/src/tools/read-file.js +124 -0
- package/dist/src/tools/read-file.js.map +1 -0
- package/dist/src/tools/read-file.test.d.ts +6 -0
- package/dist/src/tools/read-file.test.js +339 -0
- package/dist/src/tools/read-file.test.js.map +1 -0
- package/dist/src/tools/read-many-files.d.ts +60 -0
- package/dist/src/tools/read-many-files.js +391 -0
- package/dist/src/tools/read-many-files.js.map +1 -0
- package/dist/src/tools/read-many-files.test.d.ts +6 -0
- package/dist/src/tools/read-many-files.test.js +566 -0
- package/dist/src/tools/read-many-files.test.js.map +1 -0
- package/dist/src/tools/ripGrep.d.ts +44 -0
- package/dist/src/tools/ripGrep.js +233 -0
- package/dist/src/tools/ripGrep.js.map +1 -0
- package/dist/src/tools/ripGrep.test.d.ts +6 -0
- package/dist/src/tools/ripGrep.test.js +529 -0
- package/dist/src/tools/ripGrep.test.js.map +1 -0
- package/dist/src/tools/shell.d.ts +33 -0
- package/dist/src/tools/shell.js +388 -0
- package/dist/src/tools/shell.js.map +1 -0
- package/dist/src/tools/shell.test.d.ts +6 -0
- package/dist/src/tools/shell.test.js +566 -0
- package/dist/src/tools/shell.test.js.map +1 -0
- package/dist/src/tools/smart-edit.d.ts +91 -0
- package/dist/src/tools/smart-edit.js +703 -0
- package/dist/src/tools/smart-edit.js.map +1 -0
- package/dist/src/tools/smart-edit.test.d.ts +6 -0
- package/dist/src/tools/smart-edit.test.js +542 -0
- package/dist/src/tools/smart-edit.test.js.map +1 -0
- package/dist/src/tools/task.d.ts +59 -0
- package/dist/src/tools/task.js +412 -0
- package/dist/src/tools/task.js.map +1 -0
- package/dist/src/tools/task.test.d.ts +6 -0
- package/dist/src/tools/task.test.js +369 -0
- package/dist/src/tools/task.test.js.map +1 -0
- package/dist/src/tools/todoWrite.d.ts +42 -0
- package/dist/src/tools/todoWrite.js +407 -0
- package/dist/src/tools/todoWrite.js.map +1 -0
- package/dist/src/tools/todoWrite.test.d.ts +6 -0
- package/dist/src/tools/todoWrite.test.js +234 -0
- package/dist/src/tools/todoWrite.test.js.map +1 -0
- package/dist/src/tools/tool-error.d.ts +45 -0
- package/dist/src/tools/tool-error.js +61 -0
- package/dist/src/tools/tool-error.js.map +1 -0
- package/dist/src/tools/tool-names.d.ts +56 -0
- package/dist/src/tools/tool-names.js +62 -0
- package/dist/src/tools/tool-names.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +87 -0
- package/dist/src/tools/tool-registry.js +370 -0
- package/dist/src/tools/tool-registry.js.map +1 -0
- package/dist/src/tools/tool-registry.test.d.ts +6 -0
- package/dist/src/tools/tool-registry.test.js +332 -0
- package/dist/src/tools/tool-registry.test.js.map +1 -0
- package/dist/src/tools/tools.d.ts +327 -0
- package/dist/src/tools/tools.js +258 -0
- package/dist/src/tools/tools.js.map +1 -0
- package/dist/src/tools/tools.test.d.ts +6 -0
- package/dist/src/tools/tools.test.js +205 -0
- package/dist/src/tools/tools.test.js.map +1 -0
- package/dist/src/tools/web-fetch.d.ts +31 -0
- package/dist/src/tools/web-fetch.js +163 -0
- package/dist/src/tools/web-fetch.js.map +1 -0
- package/dist/src/tools/web-fetch.test.d.ts +6 -0
- package/dist/src/tools/web-fetch.test.js +133 -0
- package/dist/src/tools/web-fetch.test.js.map +1 -0
- package/dist/src/tools/web-search/base-provider.d.ts +31 -0
- package/dist/src/tools/web-search/base-provider.js +34 -0
- package/dist/src/tools/web-search/base-provider.js.map +1 -0
- package/dist/src/tools/web-search/index.d.ts +24 -0
- package/dist/src/tools/web-search/index.js +245 -0
- package/dist/src/tools/web-search/index.js.map +1 -0
- package/dist/src/tools/web-search/index.test.d.ts +6 -0
- package/dist/src/tools/web-search/index.test.js +237 -0
- package/dist/src/tools/web-search/index.test.js.map +1 -0
- package/dist/src/tools/web-search/providers/dashscope-provider.d.ts +23 -0
- package/dist/src/tools/web-search/providers/dashscope-provider.js +120 -0
- package/dist/src/tools/web-search/providers/dashscope-provider.js.map +1 -0
- package/dist/src/tools/web-search/providers/google-provider.d.ts +17 -0
- package/dist/src/tools/web-search/providers/google-provider.js +55 -0
- package/dist/src/tools/web-search/providers/google-provider.js.map +1 -0
- package/dist/src/tools/web-search/providers/tavily-provider.d.ts +17 -0
- package/dist/src/tools/web-search/providers/tavily-provider.js +54 -0
- package/dist/src/tools/web-search/providers/tavily-provider.js.map +1 -0
- package/dist/src/tools/web-search/types.d.ts +138 -0
- package/dist/src/tools/web-search/types.js +7 -0
- package/dist/src/tools/web-search/types.js.map +1 -0
- package/dist/src/tools/web-search/utils.d.ts +28 -0
- package/dist/src/tools/web-search/utils.js +35 -0
- package/dist/src/tools/web-search/utils.js.map +1 -0
- package/dist/src/tools/write-file.d.ts +52 -0
- package/dist/src/tools/write-file.js +293 -0
- package/dist/src/tools/write-file.js.map +1 -0
- package/dist/src/tools/write-file.test.d.ts +6 -0
- package/dist/src/tools/write-file.test.js +516 -0
- package/dist/src/tools/write-file.test.js.map +1 -0
- package/dist/src/utils/LruCache.d.ts +13 -0
- package/dist/src/utils/LruCache.js +38 -0
- package/dist/src/utils/LruCache.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.d.ts +24 -0
- package/dist/src/utils/bfsFileSearch.js +95 -0
- package/dist/src/utils/bfsFileSearch.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.test.d.ts +6 -0
- package/dist/src/utils/bfsFileSearch.test.js +163 -0
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -0
- package/dist/src/utils/browser.d.ts +13 -0
- package/dist/src/utils/browser.js +50 -0
- package/dist/src/utils/browser.js.map +1 -0
- package/dist/src/utils/editHelper.d.ts +53 -0
- package/dist/src/utils/editHelper.js +359 -0
- package/dist/src/utils/editHelper.js.map +1 -0
- package/dist/src/utils/editHelper.test.d.ts +6 -0
- package/dist/src/utils/editHelper.test.js +93 -0
- package/dist/src/utils/editHelper.test.js.map +1 -0
- package/dist/src/utils/editor.d.ts +28 -0
- package/dist/src/utils/editor.js +177 -0
- package/dist/src/utils/editor.js.map +1 -0
- package/dist/src/utils/editor.test.d.ts +6 -0
- package/dist/src/utils/editor.test.js +437 -0
- package/dist/src/utils/editor.test.js.map +1 -0
- package/dist/src/utils/environmentContext.d.ts +22 -0
- package/dist/src/utils/environmentContext.js +108 -0
- package/dist/src/utils/environmentContext.js.map +1 -0
- package/dist/src/utils/environmentContext.test.d.ts +6 -0
- package/dist/src/utils/environmentContext.test.js +219 -0
- package/dist/src/utils/environmentContext.test.js.map +1 -0
- package/dist/src/utils/errorParsing.d.ts +8 -0
- package/dist/src/utils/errorParsing.js +93 -0
- package/dist/src/utils/errorParsing.js.map +1 -0
- package/dist/src/utils/errorParsing.test.d.ts +6 -0
- package/dist/src/utils/errorParsing.test.js +172 -0
- package/dist/src/utils/errorParsing.test.js.map +1 -0
- package/dist/src/utils/errorReporting.d.ts +14 -0
- package/dist/src/utils/errorReporting.js +88 -0
- package/dist/src/utils/errorReporting.js.map +1 -0
- package/dist/src/utils/errorReporting.test.d.ts +6 -0
- package/dist/src/utils/errorReporting.test.js +130 -0
- package/dist/src/utils/errorReporting.test.js.map +1 -0
- package/dist/src/utils/errors.d.ts +39 -0
- package/dist/src/utils/errors.js +96 -0
- package/dist/src/utils/errors.js.map +1 -0
- package/dist/src/utils/fetch.d.ts +11 -0
- package/dist/src/utils/fetch.js +51 -0
- package/dist/src/utils/fetch.js.map +1 -0
- package/dist/src/utils/fileUtils.d.ts +69 -0
- package/dist/src/utils/fileUtils.js +426 -0
- package/dist/src/utils/fileUtils.js.map +1 -0
- package/dist/src/utils/fileUtils.test.d.ts +6 -0
- package/dist/src/utils/fileUtils.test.js +685 -0
- package/dist/src/utils/fileUtils.test.js.map +1 -0
- package/dist/src/utils/filesearch/crawlCache.d.ts +25 -0
- package/dist/src/utils/filesearch/crawlCache.js +57 -0
- package/dist/src/utils/filesearch/crawlCache.js.map +1 -0
- package/dist/src/utils/filesearch/crawlCache.test.d.ts +6 -0
- package/dist/src/utils/filesearch/crawlCache.test.js +103 -0
- package/dist/src/utils/filesearch/crawlCache.test.js.map +1 -0
- package/dist/src/utils/filesearch/crawler.d.ts +15 -0
- package/dist/src/utils/filesearch/crawler.js +50 -0
- package/dist/src/utils/filesearch/crawler.js.map +1 -0
- package/dist/src/utils/filesearch/crawler.test.d.ts +6 -0
- package/dist/src/utils/filesearch/crawler.test.js +468 -0
- package/dist/src/utils/filesearch/crawler.test.js.map +1 -0
- package/dist/src/utils/filesearch/fileSearch.d.ts +38 -0
- package/dist/src/utils/filesearch/fileSearch.js +191 -0
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -0
- package/dist/src/utils/filesearch/fileSearch.test.d.ts +6 -0
- package/dist/src/utils/filesearch/fileSearch.test.js +642 -0
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -0
- package/dist/src/utils/filesearch/ignore.d.ts +42 -0
- package/dist/src/utils/filesearch/ignore.js +106 -0
- package/dist/src/utils/filesearch/ignore.js.map +1 -0
- package/dist/src/utils/filesearch/ignore.test.d.ts +6 -0
- package/dist/src/utils/filesearch/ignore.test.js +144 -0
- package/dist/src/utils/filesearch/ignore.test.js.map +1 -0
- package/dist/src/utils/filesearch/result-cache.d.ts +33 -0
- package/dist/src/utils/filesearch/result-cache.js +59 -0
- package/dist/src/utils/filesearch/result-cache.js.map +1 -0
- package/dist/src/utils/filesearch/result-cache.test.d.ts +6 -0
- package/dist/src/utils/filesearch/result-cache.test.js +46 -0
- package/dist/src/utils/filesearch/result-cache.test.js.map +1 -0
- package/dist/src/utils/flashFallback.test.d.ts +6 -0
- package/dist/src/utils/flashFallback.test.js +122 -0
- package/dist/src/utils/flashFallback.test.js.map +1 -0
- package/dist/src/utils/formatters.d.ts +6 -0
- package/dist/src/utils/formatters.js +16 -0
- package/dist/src/utils/formatters.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.d.ts +13 -0
- package/dist/src/utils/generateContentResponseUtilities.js +80 -0
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.test.d.ts +6 -0
- package/dist/src/utils/generateContentResponseUtilities.test.js +235 -0
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -0
- package/dist/src/utils/getFolderStructure.d.ts +31 -0
- package/dist/src/utils/getFolderStructure.js +246 -0
- package/dist/src/utils/getFolderStructure.js.map +1 -0
- package/dist/src/utils/getFolderStructure.test.d.ts +6 -0
- package/dist/src/utils/getFolderStructure.test.js +282 -0
- package/dist/src/utils/getFolderStructure.test.js.map +1 -0
- package/dist/src/utils/getPty.d.ts +19 -0
- package/dist/src/utils/getPty.js +23 -0
- package/dist/src/utils/getPty.js.map +1 -0
- package/dist/src/utils/gitIgnoreParser.d.ts +16 -0
- package/dist/src/utils/gitIgnoreParser.js +152 -0
- package/dist/src/utils/gitIgnoreParser.js.map +1 -0
- package/dist/src/utils/gitIgnoreParser.test.d.ts +6 -0
- package/dist/src/utils/gitIgnoreParser.test.js +185 -0
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -0
- package/dist/src/utils/gitUtils.d.ts +17 -0
- package/dist/src/utils/gitUtils.js +61 -0
- package/dist/src/utils/gitUtils.js.map +1 -0
- package/dist/src/utils/ignorePatterns.d.ts +103 -0
- package/dist/src/utils/ignorePatterns.js +220 -0
- package/dist/src/utils/ignorePatterns.js.map +1 -0
- package/dist/src/utils/ignorePatterns.test.d.ts +6 -0
- package/dist/src/utils/ignorePatterns.test.js +250 -0
- package/dist/src/utils/ignorePatterns.test.js.map +1 -0
- package/dist/src/utils/installationManager.d.ts +16 -0
- package/dist/src/utils/installationManager.js +50 -0
- package/dist/src/utils/installationManager.js.map +1 -0
- package/dist/src/utils/installationManager.test.d.ts +6 -0
- package/dist/src/utils/installationManager.test.js +83 -0
- package/dist/src/utils/installationManager.test.js.map +1 -0
- package/dist/src/utils/language-detection.d.ts +6 -0
- package/dist/src/utils/language-detection.js +101 -0
- package/dist/src/utils/language-detection.js.map +1 -0
- package/dist/src/utils/llm-edit-fixer.d.ts +26 -0
- package/dist/src/utils/llm-edit-fixer.js +131 -0
- package/dist/src/utils/llm-edit-fixer.js.map +1 -0
- package/dist/src/utils/llm-edit-fixer.test.d.ts +6 -0
- package/dist/src/utils/llm-edit-fixer.test.js +186 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +16 -0
- package/dist/src/utils/memoryDiscovery.js +272 -0
- package/dist/src/utils/memoryDiscovery.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.test.d.ts +6 -0
- package/dist/src/utils/memoryDiscovery.test.js +244 -0
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -0
- package/dist/src/utils/memoryImportProcessor.d.ts +42 -0
- package/dist/src/utils/memoryImportProcessor.js +284 -0
- package/dist/src/utils/memoryImportProcessor.js.map +1 -0
- package/dist/src/utils/memoryImportProcessor.test.d.ts +6 -0
- package/dist/src/utils/memoryImportProcessor.test.js +587 -0
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -0
- package/dist/src/utils/messageInspectors.d.ts +8 -0
- package/dist/src/utils/messageInspectors.js +16 -0
- package/dist/src/utils/messageInspectors.js.map +1 -0
- package/dist/src/utils/nextSpeakerChecker.d.ts +12 -0
- package/dist/src/utils/nextSpeakerChecker.js +97 -0
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -0
- package/dist/src/utils/nextSpeakerChecker.test.d.ts +6 -0
- package/dist/src/utils/nextSpeakerChecker.test.js +181 -0
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -0
- package/dist/src/utils/openaiLogger.d.ts +42 -0
- package/dist/src/utils/openaiLogger.js +138 -0
- package/dist/src/utils/openaiLogger.js.map +1 -0
- package/dist/src/utils/openaiLogger.test.d.ts +6 -0
- package/dist/src/utils/openaiLogger.test.js +304 -0
- package/dist/src/utils/openaiLogger.test.js.map +1 -0
- package/dist/src/utils/partUtils.d.ts +35 -0
- package/dist/src/utils/partUtils.js +133 -0
- package/dist/src/utils/partUtils.js.map +1 -0
- package/dist/src/utils/partUtils.test.d.ts +6 -0
- package/dist/src/utils/partUtils.test.js +241 -0
- package/dist/src/utils/partUtils.test.js.map +1 -0
- package/dist/src/utils/pathReader.d.ts +17 -0
- package/dist/src/utils/pathReader.js +92 -0
- package/dist/src/utils/pathReader.js.map +1 -0
- package/dist/src/utils/pathReader.test.d.ts +6 -0
- package/dist/src/utils/pathReader.test.js +365 -0
- package/dist/src/utils/pathReader.test.js.map +1 -0
- package/dist/src/utils/paths.d.ts +93 -0
- package/dist/src/utils/paths.js +229 -0
- package/dist/src/utils/paths.js.map +1 -0
- package/dist/src/utils/paths.test.d.ts +6 -0
- package/dist/src/utils/paths.test.js +438 -0
- package/dist/src/utils/paths.test.js.map +1 -0
- package/dist/src/utils/projectSummary.d.ts +22 -0
- package/dist/src/utils/projectSummary.js +86 -0
- package/dist/src/utils/projectSummary.js.map +1 -0
- package/dist/src/utils/promptIdContext.d.ts +7 -0
- package/dist/src/utils/promptIdContext.js +8 -0
- package/dist/src/utils/promptIdContext.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.d.ts +20 -0
- package/dist/src/utils/quotaErrorDetection.js +114 -0
- package/dist/src/utils/quotaErrorDetection.js.map +1 -0
- package/dist/src/utils/quotaErrorDetection.test.d.ts +6 -0
- package/dist/src/utils/quotaErrorDetection.test.js +153 -0
- package/dist/src/utils/quotaErrorDetection.test.js.map +1 -0
- package/dist/src/utils/qwenIgnoreParser.d.ts +18 -0
- package/dist/src/utils/qwenIgnoreParser.js +69 -0
- package/dist/src/utils/qwenIgnoreParser.js.map +1 -0
- package/dist/src/utils/qwenIgnoreParser.test.d.ts +6 -0
- package/dist/src/utils/qwenIgnoreParser.test.js +50 -0
- package/dist/src/utils/qwenIgnoreParser.test.js.map +1 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.d.ts +112 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.js +401 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.js.map +1 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.test.d.ts +6 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.test.js +114 -0
- package/dist/src/utils/request-tokenizer/imageTokenizer.test.js.map +1 -0
- package/dist/src/utils/request-tokenizer/index.d.ts +18 -0
- package/dist/src/utils/request-tokenizer/index.js +30 -0
- package/dist/src/utils/request-tokenizer/index.js.map +1 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.d.ts +56 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.js +263 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.js.map +1 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.test.d.ts +6 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.test.js +245 -0
- package/dist/src/utils/request-tokenizer/requestTokenizer.test.js.map +1 -0
- package/dist/src/utils/request-tokenizer/supportedImageFormats.d.ts +30 -0
- package/dist/src/utils/request-tokenizer/supportedImageFormats.js +41 -0
- package/dist/src/utils/request-tokenizer/supportedImageFormats.js.map +1 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.d.ts +29 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.js +88 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.js.map +1 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.test.d.ts +6 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.test.js +253 -0
- package/dist/src/utils/request-tokenizer/textTokenizer.test.js.map +1 -0
- package/dist/src/utils/request-tokenizer/types.d.ts +55 -0
- package/dist/src/utils/request-tokenizer/types.js +7 -0
- package/dist/src/utils/request-tokenizer/types.js.map +1 -0
- package/dist/src/utils/retry.d.ts +32 -0
- package/dist/src/utils/retry.js +303 -0
- package/dist/src/utils/retry.js.map +1 -0
- package/dist/src/utils/retry.test.d.ts +6 -0
- package/dist/src/utils/retry.test.js +474 -0
- package/dist/src/utils/retry.test.js.map +1 -0
- package/dist/src/utils/ripgrepUtils.d.ts +61 -0
- package/dist/src/utils/ripgrepUtils.js +230 -0
- package/dist/src/utils/ripgrepUtils.js.map +1 -0
- package/dist/src/utils/ripgrepUtils.test.d.ts +6 -0
- package/dist/src/utils/ripgrepUtils.test.js +101 -0
- package/dist/src/utils/ripgrepUtils.test.js.map +1 -0
- package/dist/src/utils/safeJsonParse.d.ts +15 -0
- package/dist/src/utils/safeJsonParse.js +41 -0
- package/dist/src/utils/safeJsonParse.js.map +1 -0
- package/dist/src/utils/safeJsonParse.test.d.ts +6 -0
- package/dist/src/utils/safeJsonParse.test.js +112 -0
- package/dist/src/utils/safeJsonParse.test.js.map +1 -0
- package/dist/src/utils/safeJsonStringify.d.ts +13 -0
- package/dist/src/utils/safeJsonStringify.js +25 -0
- package/dist/src/utils/safeJsonStringify.js.map +1 -0
- package/dist/src/utils/safeJsonStringify.test.d.ts +6 -0
- package/dist/src/utils/safeJsonStringify.test.js +61 -0
- package/dist/src/utils/safeJsonStringify.test.js.map +1 -0
- package/dist/src/utils/schemaValidator.d.ts +15 -0
- package/dist/src/utils/schemaValidator.js +67 -0
- package/dist/src/utils/schemaValidator.js.map +1 -0
- package/dist/src/utils/schemaValidator.test.d.ts +6 -0
- package/dist/src/utils/schemaValidator.test.js +113 -0
- package/dist/src/utils/schemaValidator.test.js.map +1 -0
- package/dist/src/utils/secure-browser-launcher.d.ts +23 -0
- package/dist/src/utils/secure-browser-launcher.js +165 -0
- package/dist/src/utils/secure-browser-launcher.js.map +1 -0
- package/dist/src/utils/secure-browser-launcher.test.d.ts +6 -0
- package/dist/src/utils/secure-browser-launcher.test.js +149 -0
- package/dist/src/utils/secure-browser-launcher.test.js.map +1 -0
- package/dist/src/utils/session.d.ts +6 -0
- package/dist/src/utils/session.js +8 -0
- package/dist/src/utils/session.js.map +1 -0
- package/dist/src/utils/shell-utils.d.ts +152 -0
- package/dist/src/utils/shell-utils.js +467 -0
- package/dist/src/utils/shell-utils.js.map +1 -0
- package/dist/src/utils/shell-utils.test.d.ts +6 -0
- package/dist/src/utils/shell-utils.test.js +351 -0
- package/dist/src/utils/shell-utils.test.js.map +1 -0
- package/dist/src/utils/shellReadOnlyChecker.d.ts +6 -0
- package/dist/src/utils/shellReadOnlyChecker.js +247 -0
- package/dist/src/utils/shellReadOnlyChecker.js.map +1 -0
- package/dist/src/utils/shellReadOnlyChecker.test.d.ts +6 -0
- package/dist/src/utils/shellReadOnlyChecker.test.js +47 -0
- package/dist/src/utils/shellReadOnlyChecker.test.js.map +1 -0
- package/dist/src/utils/subagentGenerator.d.ts +20 -0
- package/dist/src/utils/subagentGenerator.js +120 -0
- package/dist/src/utils/subagentGenerator.js.map +1 -0
- package/dist/src/utils/subagentGenerator.test.d.ts +6 -0
- package/dist/src/utils/subagentGenerator.test.js +135 -0
- package/dist/src/utils/subagentGenerator.test.js.map +1 -0
- package/dist/src/utils/summarizer.d.ts +25 -0
- package/dist/src/utils/summarizer.js +51 -0
- package/dist/src/utils/summarizer.js.map +1 -0
- package/dist/src/utils/summarizer.test.d.ts +6 -0
- package/dist/src/utils/summarizer.test.js +131 -0
- package/dist/src/utils/summarizer.test.js.map +1 -0
- package/dist/src/utils/systemEncoding.d.ts +40 -0
- package/dist/src/utils/systemEncoding.js +149 -0
- package/dist/src/utils/systemEncoding.js.map +1 -0
- package/dist/src/utils/systemEncoding.test.d.ts +6 -0
- package/dist/src/utils/systemEncoding.test.js +368 -0
- package/dist/src/utils/systemEncoding.test.js.map +1 -0
- package/dist/src/utils/terminalSerializer.d.ts +25 -0
- package/dist/src/utils/terminalSerializer.js +432 -0
- package/dist/src/utils/terminalSerializer.js.map +1 -0
- package/dist/src/utils/terminalSerializer.test.d.ts +6 -0
- package/dist/src/utils/terminalSerializer.test.js +176 -0
- package/dist/src/utils/terminalSerializer.test.js.map +1 -0
- package/dist/src/utils/testUtils.d.ts +29 -0
- package/dist/src/utils/testUtils.js +70 -0
- package/dist/src/utils/testUtils.js.map +1 -0
- package/dist/src/utils/textUtils.d.ts +18 -0
- package/dist/src/utils/textUtils.js +42 -0
- package/dist/src/utils/textUtils.js.map +1 -0
- package/dist/src/utils/textUtils.test.d.ts +6 -0
- package/dist/src/utils/textUtils.test.js +59 -0
- package/dist/src/utils/textUtils.test.js.map +1 -0
- package/dist/src/utils/thoughtUtils.d.ts +21 -0
- package/dist/src/utils/thoughtUtils.js +39 -0
- package/dist/src/utils/thoughtUtils.js.map +1 -0
- package/dist/src/utils/thoughtUtils.test.d.ts +6 -0
- package/dist/src/utils/thoughtUtils.test.js +78 -0
- package/dist/src/utils/thoughtUtils.test.js.map +1 -0
- package/dist/src/utils/tool-utils.d.ts +22 -0
- package/dist/src/utils/tool-utils.js +121 -0
- package/dist/src/utils/tool-utils.js.map +1 -0
- package/dist/src/utils/tool-utils.test.d.ts +6 -0
- package/dist/src/utils/tool-utils.test.js +100 -0
- package/dist/src/utils/tool-utils.test.js.map +1 -0
- package/dist/src/utils/userAccountManager.d.ts +20 -0
- package/dist/src/utils/userAccountManager.js +114 -0
- package/dist/src/utils/userAccountManager.js.map +1 -0
- package/dist/src/utils/userAccountManager.test.d.ts +6 -0
- package/dist/src/utils/userAccountManager.test.js +223 -0
- package/dist/src/utils/userAccountManager.test.js.map +1 -0
- package/dist/src/utils/workspaceContext.d.ts +66 -0
- package/dist/src/utils/workspaceContext.js +171 -0
- package/dist/src/utils/workspaceContext.js.map +1 -0
- package/dist/src/utils/workspaceContext.test.d.ts +6 -0
- package/dist/src/utils/workspaceContext.test.js +318 -0
- package/dist/src/utils/workspaceContext.test.js.map +1 -0
- package/dist/src/utils/yaml-parser.d.ts +29 -0
- package/dist/src/utils/yaml-parser.js +172 -0
- package/dist/src/utils/yaml-parser.js.map +1 -0
- package/dist/src/utils/yaml-parser.test.d.ts +6 -0
- package/dist/src/utils/yaml-parser.test.js +170 -0
- package/dist/src/utils/yaml-parser.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +106 -0
- package/scripts/postinstall.js +100 -0
- package/vendor/ripgrep/COPYING +3 -0
- package/vendor/ripgrep/arm64-darwin/rg +0 -0
- package/vendor/ripgrep/arm64-linux/rg +0 -0
- package/vendor/ripgrep/x64-darwin/rg +0 -0
- package/vendor/ripgrep/x64-linux/rg +0 -0
- package/vendor/ripgrep/x64-win32/rg.exe +0 -0
|
@@ -0,0 +1,774 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ToolConfirmationOutcome, ApprovalMode, logToolCall, ReadFileTool, ToolErrorType, ToolCallEvent, ShellTool, logToolOutputTruncated, ToolOutputTruncatedEvent, } from '../index.js';
|
|
7
|
+
import { getResponseTextFromParts } from '../utils/generateContentResponseUtilities.js';
|
|
8
|
+
import { isModifiableDeclarativeTool, modifyWithEditor, } from '../tools/modifiable-tool.js';
|
|
9
|
+
import * as Diff from 'diff';
|
|
10
|
+
import * as fs from 'node:fs/promises';
|
|
11
|
+
import * as path from 'node:path';
|
|
12
|
+
import { doesToolInvocationMatch } from '../utils/tool-utils.js';
|
|
13
|
+
import levenshtein from 'fast-levenshtein';
|
|
14
|
+
import { getPlanModeSystemReminder } from './prompts.js';
|
|
15
|
+
import { ShellToolInvocation } from '../tools/shell.js';
|
|
16
|
+
/**
|
|
17
|
+
* Formats tool output for a Gemini FunctionResponse.
|
|
18
|
+
*/
|
|
19
|
+
function createFunctionResponsePart(callId, toolName, output) {
|
|
20
|
+
return {
|
|
21
|
+
functionResponse: {
|
|
22
|
+
id: callId,
|
|
23
|
+
name: toolName,
|
|
24
|
+
response: { output },
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function convertToFunctionResponse(toolName, callId, llmContent) {
|
|
29
|
+
const contentToProcess = Array.isArray(llmContent) && llmContent.length === 1
|
|
30
|
+
? llmContent[0]
|
|
31
|
+
: llmContent;
|
|
32
|
+
if (typeof contentToProcess === 'string') {
|
|
33
|
+
return [createFunctionResponsePart(callId, toolName, contentToProcess)];
|
|
34
|
+
}
|
|
35
|
+
if (Array.isArray(contentToProcess)) {
|
|
36
|
+
const functionResponse = createFunctionResponsePart(callId, toolName, 'Tool execution succeeded.');
|
|
37
|
+
return [functionResponse, ...toParts(contentToProcess)];
|
|
38
|
+
}
|
|
39
|
+
// After this point, contentToProcess is a single Part object.
|
|
40
|
+
if (contentToProcess.functionResponse) {
|
|
41
|
+
if (contentToProcess.functionResponse.response?.['content']) {
|
|
42
|
+
const stringifiedOutput = getResponseTextFromParts(contentToProcess.functionResponse.response['content']) || '';
|
|
43
|
+
return [createFunctionResponsePart(callId, toolName, stringifiedOutput)];
|
|
44
|
+
}
|
|
45
|
+
// It's a functionResponse that we should pass through as is.
|
|
46
|
+
return [contentToProcess];
|
|
47
|
+
}
|
|
48
|
+
if (contentToProcess.inlineData || contentToProcess.fileData) {
|
|
49
|
+
const mimeType = contentToProcess.inlineData?.mimeType ||
|
|
50
|
+
contentToProcess.fileData?.mimeType ||
|
|
51
|
+
'unknown';
|
|
52
|
+
const functionResponse = createFunctionResponsePart(callId, toolName, `Binary content of type ${mimeType} was processed.`);
|
|
53
|
+
return [functionResponse, contentToProcess];
|
|
54
|
+
}
|
|
55
|
+
if (contentToProcess.text !== undefined) {
|
|
56
|
+
return [
|
|
57
|
+
createFunctionResponsePart(callId, toolName, contentToProcess.text),
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
// Default case for other kinds of parts.
|
|
61
|
+
return [
|
|
62
|
+
createFunctionResponsePart(callId, toolName, 'Tool execution succeeded.'),
|
|
63
|
+
];
|
|
64
|
+
}
|
|
65
|
+
function toParts(input) {
|
|
66
|
+
const parts = [];
|
|
67
|
+
for (const part of Array.isArray(input) ? input : [input]) {
|
|
68
|
+
if (typeof part === 'string') {
|
|
69
|
+
parts.push({ text: part });
|
|
70
|
+
}
|
|
71
|
+
else if (part) {
|
|
72
|
+
parts.push(part);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return parts;
|
|
76
|
+
}
|
|
77
|
+
const createErrorResponse = (request, error, errorType) => ({
|
|
78
|
+
callId: request.callId,
|
|
79
|
+
error,
|
|
80
|
+
responseParts: [
|
|
81
|
+
{
|
|
82
|
+
functionResponse: {
|
|
83
|
+
id: request.callId,
|
|
84
|
+
name: request.name,
|
|
85
|
+
response: { error: error.message },
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
],
|
|
89
|
+
resultDisplay: error.message,
|
|
90
|
+
errorType,
|
|
91
|
+
contentLength: error.message.length,
|
|
92
|
+
});
|
|
93
|
+
export async function truncateAndSaveToFile(content, callId, projectTempDir, threshold, truncateLines) {
|
|
94
|
+
if (content.length <= threshold) {
|
|
95
|
+
return { content };
|
|
96
|
+
}
|
|
97
|
+
let lines = content.split('\n');
|
|
98
|
+
let fileContent = content;
|
|
99
|
+
// If the content is long but has few lines, wrap it to enable line-based truncation.
|
|
100
|
+
if (lines.length <= truncateLines) {
|
|
101
|
+
const wrapWidth = 120; // A reasonable width for wrapping.
|
|
102
|
+
const wrappedLines = [];
|
|
103
|
+
for (const line of lines) {
|
|
104
|
+
if (line.length > wrapWidth) {
|
|
105
|
+
for (let i = 0; i < line.length; i += wrapWidth) {
|
|
106
|
+
wrappedLines.push(line.substring(i, i + wrapWidth));
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
else {
|
|
110
|
+
wrappedLines.push(line);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
lines = wrappedLines;
|
|
114
|
+
fileContent = lines.join('\n');
|
|
115
|
+
}
|
|
116
|
+
const head = Math.floor(truncateLines / 5);
|
|
117
|
+
const beginning = lines.slice(0, head);
|
|
118
|
+
const end = lines.slice(-(truncateLines - head));
|
|
119
|
+
const truncatedContent = beginning.join('\n') + '\n... [CONTENT TRUNCATED] ...\n' + end.join('\n');
|
|
120
|
+
// Sanitize callId to prevent path traversal.
|
|
121
|
+
const safeFileName = `${path.basename(callId)}.output`;
|
|
122
|
+
const outputFile = path.join(projectTempDir, safeFileName);
|
|
123
|
+
try {
|
|
124
|
+
await fs.writeFile(outputFile, fileContent);
|
|
125
|
+
return {
|
|
126
|
+
content: `Tool output was too large and has been truncated.
|
|
127
|
+
The full output has been saved to: ${outputFile}
|
|
128
|
+
To read the complete output, use the ${ReadFileTool.Name} tool with the absolute file path above.
|
|
129
|
+
The truncated output below shows the beginning and end of the content. The marker '... [CONTENT TRUNCATED] ...' indicates where content was removed.
|
|
130
|
+
This allows you to efficiently examine different parts of the output without loading the entire file.
|
|
131
|
+
Truncated part of the output:
|
|
132
|
+
${truncatedContent}`,
|
|
133
|
+
outputFile,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
catch (_error) {
|
|
137
|
+
return {
|
|
138
|
+
content: truncatedContent + `\n[Note: Could not save full output to file]`,
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
export class CoreToolScheduler {
|
|
143
|
+
toolRegistry;
|
|
144
|
+
toolCalls = [];
|
|
145
|
+
outputUpdateHandler;
|
|
146
|
+
onAllToolCallsComplete;
|
|
147
|
+
onToolCallsUpdate;
|
|
148
|
+
getPreferredEditor;
|
|
149
|
+
config;
|
|
150
|
+
onEditorClose;
|
|
151
|
+
isFinalizingToolCalls = false;
|
|
152
|
+
isScheduling = false;
|
|
153
|
+
requestQueue = [];
|
|
154
|
+
constructor(options) {
|
|
155
|
+
this.config = options.config;
|
|
156
|
+
this.toolRegistry = options.config.getToolRegistry();
|
|
157
|
+
this.outputUpdateHandler = options.outputUpdateHandler;
|
|
158
|
+
this.onAllToolCallsComplete = options.onAllToolCallsComplete;
|
|
159
|
+
this.onToolCallsUpdate = options.onToolCallsUpdate;
|
|
160
|
+
this.getPreferredEditor = options.getPreferredEditor;
|
|
161
|
+
this.onEditorClose = options.onEditorClose;
|
|
162
|
+
}
|
|
163
|
+
setStatusInternal(targetCallId, newStatus, auxiliaryData) {
|
|
164
|
+
this.toolCalls = this.toolCalls.map((currentCall) => {
|
|
165
|
+
if (currentCall.request.callId !== targetCallId ||
|
|
166
|
+
currentCall.status === 'success' ||
|
|
167
|
+
currentCall.status === 'error' ||
|
|
168
|
+
currentCall.status === 'cancelled') {
|
|
169
|
+
return currentCall;
|
|
170
|
+
}
|
|
171
|
+
// currentCall is a non-terminal state here and should have startTime and tool.
|
|
172
|
+
const existingStartTime = currentCall.startTime;
|
|
173
|
+
const toolInstance = currentCall.tool;
|
|
174
|
+
const invocation = currentCall.invocation;
|
|
175
|
+
const outcome = currentCall.outcome;
|
|
176
|
+
switch (newStatus) {
|
|
177
|
+
case 'success': {
|
|
178
|
+
const durationMs = existingStartTime
|
|
179
|
+
? Date.now() - existingStartTime
|
|
180
|
+
: undefined;
|
|
181
|
+
return {
|
|
182
|
+
request: currentCall.request,
|
|
183
|
+
tool: toolInstance,
|
|
184
|
+
invocation,
|
|
185
|
+
status: 'success',
|
|
186
|
+
response: auxiliaryData,
|
|
187
|
+
durationMs,
|
|
188
|
+
outcome,
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
case 'error': {
|
|
192
|
+
const durationMs = existingStartTime
|
|
193
|
+
? Date.now() - existingStartTime
|
|
194
|
+
: undefined;
|
|
195
|
+
return {
|
|
196
|
+
request: currentCall.request,
|
|
197
|
+
status: 'error',
|
|
198
|
+
tool: toolInstance,
|
|
199
|
+
response: auxiliaryData,
|
|
200
|
+
durationMs,
|
|
201
|
+
outcome,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
case 'awaiting_approval':
|
|
205
|
+
return {
|
|
206
|
+
request: currentCall.request,
|
|
207
|
+
tool: toolInstance,
|
|
208
|
+
status: 'awaiting_approval',
|
|
209
|
+
confirmationDetails: auxiliaryData,
|
|
210
|
+
startTime: existingStartTime,
|
|
211
|
+
outcome,
|
|
212
|
+
invocation,
|
|
213
|
+
};
|
|
214
|
+
case 'scheduled':
|
|
215
|
+
return {
|
|
216
|
+
request: currentCall.request,
|
|
217
|
+
tool: toolInstance,
|
|
218
|
+
status: 'scheduled',
|
|
219
|
+
startTime: existingStartTime,
|
|
220
|
+
outcome,
|
|
221
|
+
invocation,
|
|
222
|
+
};
|
|
223
|
+
case 'cancelled': {
|
|
224
|
+
const durationMs = existingStartTime
|
|
225
|
+
? Date.now() - existingStartTime
|
|
226
|
+
: undefined;
|
|
227
|
+
// Preserve diff for cancelled edit operations
|
|
228
|
+
let resultDisplay = undefined;
|
|
229
|
+
if (currentCall.status === 'awaiting_approval') {
|
|
230
|
+
const waitingCall = currentCall;
|
|
231
|
+
if (waitingCall.confirmationDetails.type === 'edit') {
|
|
232
|
+
resultDisplay = {
|
|
233
|
+
fileDiff: waitingCall.confirmationDetails.fileDiff,
|
|
234
|
+
fileName: waitingCall.confirmationDetails.fileName,
|
|
235
|
+
originalContent: waitingCall.confirmationDetails.originalContent,
|
|
236
|
+
newContent: waitingCall.confirmationDetails.newContent,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
else if (currentCall.status === 'executing') {
|
|
241
|
+
// If the tool was streaming live output, preserve the latest
|
|
242
|
+
// output so the UI can continue to show it after cancellation.
|
|
243
|
+
const executingCall = currentCall;
|
|
244
|
+
if (executingCall.liveOutput !== undefined) {
|
|
245
|
+
resultDisplay = executingCall.liveOutput;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
const errorMessage = `[Operation Cancelled] Reason: ${auxiliaryData}`;
|
|
249
|
+
return {
|
|
250
|
+
request: currentCall.request,
|
|
251
|
+
tool: toolInstance,
|
|
252
|
+
invocation,
|
|
253
|
+
status: 'cancelled',
|
|
254
|
+
response: {
|
|
255
|
+
callId: currentCall.request.callId,
|
|
256
|
+
responseParts: [
|
|
257
|
+
{
|
|
258
|
+
functionResponse: {
|
|
259
|
+
id: currentCall.request.callId,
|
|
260
|
+
name: currentCall.request.name,
|
|
261
|
+
response: {
|
|
262
|
+
error: errorMessage,
|
|
263
|
+
},
|
|
264
|
+
},
|
|
265
|
+
},
|
|
266
|
+
],
|
|
267
|
+
resultDisplay,
|
|
268
|
+
error: undefined,
|
|
269
|
+
errorType: undefined,
|
|
270
|
+
contentLength: errorMessage.length,
|
|
271
|
+
},
|
|
272
|
+
durationMs,
|
|
273
|
+
outcome,
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
case 'validating':
|
|
277
|
+
return {
|
|
278
|
+
request: currentCall.request,
|
|
279
|
+
tool: toolInstance,
|
|
280
|
+
status: 'validating',
|
|
281
|
+
startTime: existingStartTime,
|
|
282
|
+
outcome,
|
|
283
|
+
invocation,
|
|
284
|
+
};
|
|
285
|
+
case 'executing':
|
|
286
|
+
return {
|
|
287
|
+
request: currentCall.request,
|
|
288
|
+
tool: toolInstance,
|
|
289
|
+
status: 'executing',
|
|
290
|
+
startTime: existingStartTime,
|
|
291
|
+
outcome,
|
|
292
|
+
invocation,
|
|
293
|
+
};
|
|
294
|
+
default: {
|
|
295
|
+
const exhaustiveCheck = newStatus;
|
|
296
|
+
return exhaustiveCheck;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
this.notifyToolCallsUpdate();
|
|
301
|
+
this.checkAndNotifyCompletion();
|
|
302
|
+
}
|
|
303
|
+
setArgsInternal(targetCallId, args) {
|
|
304
|
+
this.toolCalls = this.toolCalls.map((call) => {
|
|
305
|
+
// We should never be asked to set args on an ErroredToolCall, but
|
|
306
|
+
// we guard for the case anyways.
|
|
307
|
+
if (call.request.callId !== targetCallId || call.status === 'error') {
|
|
308
|
+
return call;
|
|
309
|
+
}
|
|
310
|
+
const invocationOrError = this.buildInvocation(call.tool, args);
|
|
311
|
+
if (invocationOrError instanceof Error) {
|
|
312
|
+
const response = createErrorResponse(call.request, invocationOrError, ToolErrorType.INVALID_TOOL_PARAMS);
|
|
313
|
+
return {
|
|
314
|
+
request: { ...call.request, args: args },
|
|
315
|
+
status: 'error',
|
|
316
|
+
tool: call.tool,
|
|
317
|
+
response,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
...call,
|
|
322
|
+
request: { ...call.request, args: args },
|
|
323
|
+
invocation: invocationOrError,
|
|
324
|
+
};
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
isRunning() {
|
|
328
|
+
return (this.isFinalizingToolCalls ||
|
|
329
|
+
this.toolCalls.some((call) => call.status === 'executing' || call.status === 'awaiting_approval'));
|
|
330
|
+
}
|
|
331
|
+
buildInvocation(tool, args) {
|
|
332
|
+
try {
|
|
333
|
+
return tool.build(args);
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
if (e instanceof Error) {
|
|
337
|
+
return e;
|
|
338
|
+
}
|
|
339
|
+
return new Error(String(e));
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Generates a suggestion string for a tool name that was not found in the registry.
|
|
344
|
+
* Uses Levenshtein distance to suggest similar tool names for hallucinated or misspelled tools.
|
|
345
|
+
* Note: Excluded tools are handled separately before calling this method, so this only
|
|
346
|
+
* handles the case where a tool is truly not found (hallucinated or typo).
|
|
347
|
+
* @param unknownToolName The tool name that was not found.
|
|
348
|
+
* @param topN The number of suggestions to return. Defaults to 3.
|
|
349
|
+
* @returns A suggestion string like " Did you mean 'tool'?" or " Did you mean one of: 'tool1', 'tool2'?",
|
|
350
|
+
* or an empty string if no suggestions are found.
|
|
351
|
+
*/
|
|
352
|
+
getToolSuggestion(unknownToolName, topN = 3) {
|
|
353
|
+
// Use Levenshtein distance to find similar tool names from the registry.
|
|
354
|
+
const allToolNames = this.toolRegistry.getAllToolNames();
|
|
355
|
+
const matches = allToolNames.map((toolName) => ({
|
|
356
|
+
name: toolName,
|
|
357
|
+
distance: levenshtein.get(unknownToolName, toolName),
|
|
358
|
+
}));
|
|
359
|
+
matches.sort((a, b) => a.distance - b.distance);
|
|
360
|
+
const topNResults = matches.slice(0, topN);
|
|
361
|
+
if (topNResults.length === 0) {
|
|
362
|
+
return '';
|
|
363
|
+
}
|
|
364
|
+
const suggestedNames = topNResults
|
|
365
|
+
.map((match) => `"${match.name}"`)
|
|
366
|
+
.join(', ');
|
|
367
|
+
if (topNResults.length > 1) {
|
|
368
|
+
return ` Did you mean one of: ${suggestedNames}?`;
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
return ` Did you mean ${suggestedNames}?`;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
schedule(request, signal) {
|
|
375
|
+
if (this.isRunning() || this.isScheduling) {
|
|
376
|
+
return new Promise((resolve, reject) => {
|
|
377
|
+
const abortHandler = () => {
|
|
378
|
+
// Find and remove the request from the queue
|
|
379
|
+
const index = this.requestQueue.findIndex((item) => item.request === request);
|
|
380
|
+
if (index > -1) {
|
|
381
|
+
this.requestQueue.splice(index, 1);
|
|
382
|
+
reject(new Error('Tool call cancelled while in queue.'));
|
|
383
|
+
}
|
|
384
|
+
};
|
|
385
|
+
signal.addEventListener('abort', abortHandler, { once: true });
|
|
386
|
+
this.requestQueue.push({
|
|
387
|
+
request,
|
|
388
|
+
signal,
|
|
389
|
+
resolve: () => {
|
|
390
|
+
signal.removeEventListener('abort', abortHandler);
|
|
391
|
+
resolve();
|
|
392
|
+
},
|
|
393
|
+
reject: (reason) => {
|
|
394
|
+
signal.removeEventListener('abort', abortHandler);
|
|
395
|
+
reject(reason);
|
|
396
|
+
},
|
|
397
|
+
});
|
|
398
|
+
});
|
|
399
|
+
}
|
|
400
|
+
return this._schedule(request, signal);
|
|
401
|
+
}
|
|
402
|
+
async _schedule(request, signal) {
|
|
403
|
+
this.isScheduling = true;
|
|
404
|
+
try {
|
|
405
|
+
if (this.isRunning()) {
|
|
406
|
+
throw new Error('Cannot schedule new tool calls while other tool calls are actively running (executing or awaiting approval).');
|
|
407
|
+
}
|
|
408
|
+
const requestsToProcess = Array.isArray(request) ? request : [request];
|
|
409
|
+
const newToolCalls = requestsToProcess.map((reqInfo) => {
|
|
410
|
+
// Check if the tool is excluded due to permissions/environment restrictions
|
|
411
|
+
// This check should happen before registry lookup to provide a clear permission error
|
|
412
|
+
const excludeTools = this.config.getExcludeTools?.() ?? undefined;
|
|
413
|
+
if (excludeTools && excludeTools.length > 0) {
|
|
414
|
+
const normalizedToolName = reqInfo.name.toLowerCase().trim();
|
|
415
|
+
const excludedMatch = excludeTools.find((excludedTool) => excludedTool.toLowerCase().trim() === normalizedToolName);
|
|
416
|
+
if (excludedMatch) {
|
|
417
|
+
// The tool exists but is excluded - return permission error directly
|
|
418
|
+
const permissionErrorMessage = `Qwen Code requires permission to use ${excludedMatch}, but that permission was declined.`;
|
|
419
|
+
return {
|
|
420
|
+
status: 'error',
|
|
421
|
+
request: reqInfo,
|
|
422
|
+
response: createErrorResponse(reqInfo, new Error(permissionErrorMessage), ToolErrorType.EXECUTION_DENIED),
|
|
423
|
+
durationMs: 0,
|
|
424
|
+
};
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
const toolInstance = this.toolRegistry.getTool(reqInfo.name);
|
|
428
|
+
if (!toolInstance) {
|
|
429
|
+
// Tool is not in registry and not excluded - likely hallucinated or typo
|
|
430
|
+
const suggestion = this.getToolSuggestion(reqInfo.name);
|
|
431
|
+
const errorMessage = `Tool "${reqInfo.name}" not found in registry. Tools must use the exact names that are registered.${suggestion}`;
|
|
432
|
+
return {
|
|
433
|
+
status: 'error',
|
|
434
|
+
request: reqInfo,
|
|
435
|
+
response: createErrorResponse(reqInfo, new Error(errorMessage), ToolErrorType.TOOL_NOT_REGISTERED),
|
|
436
|
+
durationMs: 0,
|
|
437
|
+
};
|
|
438
|
+
}
|
|
439
|
+
const invocationOrError = this.buildInvocation(toolInstance, reqInfo.args);
|
|
440
|
+
if (invocationOrError instanceof Error) {
|
|
441
|
+
return {
|
|
442
|
+
status: 'error',
|
|
443
|
+
request: reqInfo,
|
|
444
|
+
tool: toolInstance,
|
|
445
|
+
response: createErrorResponse(reqInfo, invocationOrError, ToolErrorType.INVALID_TOOL_PARAMS),
|
|
446
|
+
durationMs: 0,
|
|
447
|
+
};
|
|
448
|
+
}
|
|
449
|
+
return {
|
|
450
|
+
status: 'validating',
|
|
451
|
+
request: reqInfo,
|
|
452
|
+
tool: toolInstance,
|
|
453
|
+
invocation: invocationOrError,
|
|
454
|
+
startTime: Date.now(),
|
|
455
|
+
};
|
|
456
|
+
});
|
|
457
|
+
this.toolCalls = this.toolCalls.concat(newToolCalls);
|
|
458
|
+
this.notifyToolCallsUpdate();
|
|
459
|
+
for (const toolCall of newToolCalls) {
|
|
460
|
+
if (toolCall.status !== 'validating') {
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
const { request: reqInfo, invocation } = toolCall;
|
|
464
|
+
try {
|
|
465
|
+
if (signal.aborted) {
|
|
466
|
+
this.setStatusInternal(reqInfo.callId, 'cancelled', 'Tool call cancelled by user.');
|
|
467
|
+
continue;
|
|
468
|
+
}
|
|
469
|
+
const confirmationDetails = await invocation.shouldConfirmExecute(signal);
|
|
470
|
+
if (!confirmationDetails) {
|
|
471
|
+
this.setToolCallOutcome(reqInfo.callId, ToolConfirmationOutcome.ProceedAlways);
|
|
472
|
+
this.setStatusInternal(reqInfo.callId, 'scheduled');
|
|
473
|
+
continue;
|
|
474
|
+
}
|
|
475
|
+
const allowedTools = this.config.getAllowedTools() || [];
|
|
476
|
+
const isPlanMode = this.config.getApprovalMode() === ApprovalMode.PLAN;
|
|
477
|
+
const isExitPlanModeTool = reqInfo.name === 'exit_plan_mode';
|
|
478
|
+
if (isPlanMode && !isExitPlanModeTool) {
|
|
479
|
+
if (confirmationDetails) {
|
|
480
|
+
this.setStatusInternal(reqInfo.callId, 'error', {
|
|
481
|
+
callId: reqInfo.callId,
|
|
482
|
+
responseParts: convertToFunctionResponse(reqInfo.name, reqInfo.callId, getPlanModeSystemReminder()),
|
|
483
|
+
resultDisplay: 'Plan mode blocked a non-read-only tool call.',
|
|
484
|
+
error: undefined,
|
|
485
|
+
errorType: undefined,
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
else {
|
|
489
|
+
this.setStatusInternal(reqInfo.callId, 'scheduled');
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
else if (this.config.getApprovalMode() === ApprovalMode.YOLO ||
|
|
493
|
+
doesToolInvocationMatch(toolCall.tool, invocation, allowedTools)) {
|
|
494
|
+
this.setToolCallOutcome(reqInfo.callId, ToolConfirmationOutcome.ProceedAlways);
|
|
495
|
+
this.setStatusInternal(reqInfo.callId, 'scheduled');
|
|
496
|
+
}
|
|
497
|
+
else {
|
|
498
|
+
/**
|
|
499
|
+
* In non-interactive mode where no user will respond to approval prompts,
|
|
500
|
+
* and not running as IDE companion or Zed integration, automatically deny approval.
|
|
501
|
+
* This is intended to create an explicit denial of the tool call,
|
|
502
|
+
* rather than silently waiting for approval and hanging forever.
|
|
503
|
+
*/
|
|
504
|
+
const shouldAutoDeny = !this.config.isInteractive() &&
|
|
505
|
+
!this.config.getIdeMode() &&
|
|
506
|
+
!this.config.getExperimentalZedIntegration();
|
|
507
|
+
if (shouldAutoDeny) {
|
|
508
|
+
// Treat as execution denied error, similar to excluded tools
|
|
509
|
+
const errorMessage = `Qwen Code requires permission to use "${reqInfo.name}", but that permission was declined.`;
|
|
510
|
+
this.setStatusInternal(reqInfo.callId, 'error', createErrorResponse(reqInfo, new Error(errorMessage), ToolErrorType.EXECUTION_DENIED));
|
|
511
|
+
continue;
|
|
512
|
+
}
|
|
513
|
+
// Allow IDE to resolve confirmation
|
|
514
|
+
if (confirmationDetails.type === 'edit' &&
|
|
515
|
+
confirmationDetails.ideConfirmation) {
|
|
516
|
+
confirmationDetails.ideConfirmation.then((resolution) => {
|
|
517
|
+
if (resolution.status === 'accepted') {
|
|
518
|
+
this.handleConfirmationResponse(reqInfo.callId, confirmationDetails.onConfirm, ToolConfirmationOutcome.ProceedOnce, signal);
|
|
519
|
+
}
|
|
520
|
+
else {
|
|
521
|
+
this.handleConfirmationResponse(reqInfo.callId, confirmationDetails.onConfirm, ToolConfirmationOutcome.Cancel, signal);
|
|
522
|
+
}
|
|
523
|
+
});
|
|
524
|
+
}
|
|
525
|
+
const originalOnConfirm = confirmationDetails.onConfirm;
|
|
526
|
+
const wrappedConfirmationDetails = {
|
|
527
|
+
...confirmationDetails,
|
|
528
|
+
onConfirm: (outcome, payload) => this.handleConfirmationResponse(reqInfo.callId, originalOnConfirm, outcome, signal, payload),
|
|
529
|
+
};
|
|
530
|
+
this.setStatusInternal(reqInfo.callId, 'awaiting_approval', wrappedConfirmationDetails);
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
catch (error) {
|
|
534
|
+
if (signal.aborted) {
|
|
535
|
+
this.setStatusInternal(reqInfo.callId, 'cancelled', 'Tool call cancelled by user.');
|
|
536
|
+
continue;
|
|
537
|
+
}
|
|
538
|
+
this.setStatusInternal(reqInfo.callId, 'error', createErrorResponse(reqInfo, error instanceof Error ? error : new Error(String(error)), ToolErrorType.UNHANDLED_EXCEPTION));
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
await this.attemptExecutionOfScheduledCalls(signal);
|
|
542
|
+
void this.checkAndNotifyCompletion();
|
|
543
|
+
}
|
|
544
|
+
finally {
|
|
545
|
+
this.isScheduling = false;
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
async handleConfirmationResponse(callId, originalOnConfirm, outcome, signal, payload) {
|
|
549
|
+
const toolCall = this.toolCalls.find((c) => c.request.callId === callId && c.status === 'awaiting_approval');
|
|
550
|
+
if (toolCall && toolCall.status === 'awaiting_approval') {
|
|
551
|
+
await originalOnConfirm(outcome);
|
|
552
|
+
}
|
|
553
|
+
if (outcome === ToolConfirmationOutcome.ProceedAlways) {
|
|
554
|
+
await this.autoApproveCompatiblePendingTools(signal, callId);
|
|
555
|
+
}
|
|
556
|
+
this.setToolCallOutcome(callId, outcome);
|
|
557
|
+
if (outcome === ToolConfirmationOutcome.Cancel || signal.aborted) {
|
|
558
|
+
this.setStatusInternal(callId, 'cancelled', 'User did not allow tool call');
|
|
559
|
+
}
|
|
560
|
+
else if (outcome === ToolConfirmationOutcome.ModifyWithEditor) {
|
|
561
|
+
const waitingToolCall = toolCall;
|
|
562
|
+
if (isModifiableDeclarativeTool(waitingToolCall.tool)) {
|
|
563
|
+
const modifyContext = waitingToolCall.tool.getModifyContext(signal);
|
|
564
|
+
const editorType = this.getPreferredEditor();
|
|
565
|
+
if (!editorType) {
|
|
566
|
+
return;
|
|
567
|
+
}
|
|
568
|
+
this.setStatusInternal(callId, 'awaiting_approval', {
|
|
569
|
+
...waitingToolCall.confirmationDetails,
|
|
570
|
+
isModifying: true,
|
|
571
|
+
});
|
|
572
|
+
const { updatedParams, updatedDiff } = await modifyWithEditor(waitingToolCall.request.args, modifyContext, editorType, signal, this.onEditorClose);
|
|
573
|
+
this.setArgsInternal(callId, updatedParams);
|
|
574
|
+
this.setStatusInternal(callId, 'awaiting_approval', {
|
|
575
|
+
...waitingToolCall.confirmationDetails,
|
|
576
|
+
fileDiff: updatedDiff,
|
|
577
|
+
isModifying: false,
|
|
578
|
+
});
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
else {
|
|
582
|
+
// If the client provided new content, apply it before scheduling.
|
|
583
|
+
if (payload?.newContent && toolCall) {
|
|
584
|
+
await this._applyInlineModify(toolCall, payload, signal);
|
|
585
|
+
}
|
|
586
|
+
this.setStatusInternal(callId, 'scheduled');
|
|
587
|
+
}
|
|
588
|
+
await this.attemptExecutionOfScheduledCalls(signal);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Applies user-provided content changes to a tool call that is awaiting confirmation.
|
|
592
|
+
* This method updates the tool's arguments and refreshes the confirmation prompt with a new diff
|
|
593
|
+
* before the tool is scheduled for execution.
|
|
594
|
+
* @private
|
|
595
|
+
*/
|
|
596
|
+
async _applyInlineModify(toolCall, payload, signal) {
|
|
597
|
+
if (toolCall.confirmationDetails.type !== 'edit' ||
|
|
598
|
+
!isModifiableDeclarativeTool(toolCall.tool)) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const modifyContext = toolCall.tool.getModifyContext(signal);
|
|
602
|
+
const currentContent = await modifyContext.getCurrentContent(toolCall.request.args);
|
|
603
|
+
const updatedParams = modifyContext.createUpdatedParams(currentContent, payload.newContent, toolCall.request.args);
|
|
604
|
+
const updatedDiff = Diff.createPatch(modifyContext.getFilePath(toolCall.request.args), currentContent, payload.newContent, 'Current', 'Proposed');
|
|
605
|
+
this.setArgsInternal(toolCall.request.callId, updatedParams);
|
|
606
|
+
this.setStatusInternal(toolCall.request.callId, 'awaiting_approval', {
|
|
607
|
+
...toolCall.confirmationDetails,
|
|
608
|
+
fileDiff: updatedDiff,
|
|
609
|
+
});
|
|
610
|
+
}
|
|
611
|
+
async attemptExecutionOfScheduledCalls(signal) {
|
|
612
|
+
const allCallsFinalOrScheduled = this.toolCalls.every((call) => call.status === 'scheduled' ||
|
|
613
|
+
call.status === 'cancelled' ||
|
|
614
|
+
call.status === 'success' ||
|
|
615
|
+
call.status === 'error');
|
|
616
|
+
if (allCallsFinalOrScheduled) {
|
|
617
|
+
const callsToExecute = this.toolCalls.filter((call) => call.status === 'scheduled');
|
|
618
|
+
for (const toolCall of callsToExecute) {
|
|
619
|
+
if (toolCall.status !== 'scheduled')
|
|
620
|
+
continue;
|
|
621
|
+
const scheduledCall = toolCall;
|
|
622
|
+
const { callId, name: toolName } = scheduledCall.request;
|
|
623
|
+
const invocation = scheduledCall.invocation;
|
|
624
|
+
this.setStatusInternal(callId, 'executing');
|
|
625
|
+
const liveOutputCallback = scheduledCall.tool.canUpdateOutput
|
|
626
|
+
? (outputChunk) => {
|
|
627
|
+
if (this.outputUpdateHandler) {
|
|
628
|
+
this.outputUpdateHandler(callId, outputChunk);
|
|
629
|
+
}
|
|
630
|
+
this.toolCalls = this.toolCalls.map((tc) => tc.request.callId === callId && tc.status === 'executing'
|
|
631
|
+
? { ...tc, liveOutput: outputChunk }
|
|
632
|
+
: tc);
|
|
633
|
+
this.notifyToolCallsUpdate();
|
|
634
|
+
}
|
|
635
|
+
: undefined;
|
|
636
|
+
const shellExecutionConfig = this.config.getShellExecutionConfig();
|
|
637
|
+
// TODO: Refactor to remove special casing for ShellToolInvocation.
|
|
638
|
+
// Introduce a generic callbacks object for the execute method to handle
|
|
639
|
+
// things like `onPid` and `onLiveOutput`. This will make the scheduler
|
|
640
|
+
// agnostic to the invocation type.
|
|
641
|
+
let promise;
|
|
642
|
+
if (invocation instanceof ShellToolInvocation) {
|
|
643
|
+
const setPidCallback = (pid) => {
|
|
644
|
+
this.toolCalls = this.toolCalls.map((tc) => tc.request.callId === callId && tc.status === 'executing'
|
|
645
|
+
? { ...tc, pid }
|
|
646
|
+
: tc);
|
|
647
|
+
this.notifyToolCallsUpdate();
|
|
648
|
+
};
|
|
649
|
+
promise = invocation.execute(signal, liveOutputCallback, shellExecutionConfig, setPidCallback);
|
|
650
|
+
}
|
|
651
|
+
else {
|
|
652
|
+
promise = invocation.execute(signal, liveOutputCallback, shellExecutionConfig);
|
|
653
|
+
}
|
|
654
|
+
try {
|
|
655
|
+
const toolResult = await promise;
|
|
656
|
+
if (signal.aborted) {
|
|
657
|
+
this.setStatusInternal(callId, 'cancelled', 'User cancelled tool execution.');
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
if (toolResult.error === undefined) {
|
|
661
|
+
let content = toolResult.llmContent;
|
|
662
|
+
let outputFile = undefined;
|
|
663
|
+
const contentLength = typeof content === 'string' ? content.length : undefined;
|
|
664
|
+
if (typeof content === 'string' &&
|
|
665
|
+
toolName === ShellTool.Name &&
|
|
666
|
+
this.config.getEnableToolOutputTruncation() &&
|
|
667
|
+
this.config.getTruncateToolOutputThreshold() > 0 &&
|
|
668
|
+
this.config.getTruncateToolOutputLines() > 0) {
|
|
669
|
+
const originalContentLength = content.length;
|
|
670
|
+
const threshold = this.config.getTruncateToolOutputThreshold();
|
|
671
|
+
const lines = this.config.getTruncateToolOutputLines();
|
|
672
|
+
const truncatedResult = await truncateAndSaveToFile(content, callId, this.config.storage.getProjectTempDir(), threshold, lines);
|
|
673
|
+
content = truncatedResult.content;
|
|
674
|
+
outputFile = truncatedResult.outputFile;
|
|
675
|
+
if (outputFile) {
|
|
676
|
+
logToolOutputTruncated(this.config, new ToolOutputTruncatedEvent(scheduledCall.request.prompt_id, {
|
|
677
|
+
toolName,
|
|
678
|
+
originalContentLength,
|
|
679
|
+
truncatedContentLength: content.length,
|
|
680
|
+
threshold,
|
|
681
|
+
lines,
|
|
682
|
+
}));
|
|
683
|
+
}
|
|
684
|
+
}
|
|
685
|
+
const response = convertToFunctionResponse(toolName, callId, content);
|
|
686
|
+
const successResponse = {
|
|
687
|
+
callId,
|
|
688
|
+
responseParts: response,
|
|
689
|
+
resultDisplay: toolResult.returnDisplay,
|
|
690
|
+
error: undefined,
|
|
691
|
+
errorType: undefined,
|
|
692
|
+
outputFile,
|
|
693
|
+
contentLength,
|
|
694
|
+
};
|
|
695
|
+
this.setStatusInternal(callId, 'success', successResponse);
|
|
696
|
+
}
|
|
697
|
+
else {
|
|
698
|
+
// It is a failure
|
|
699
|
+
const error = new Error(toolResult.error.message);
|
|
700
|
+
const errorResponse = createErrorResponse(scheduledCall.request, error, toolResult.error.type);
|
|
701
|
+
this.setStatusInternal(callId, 'error', errorResponse);
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
catch (executionError) {
|
|
705
|
+
if (signal.aborted) {
|
|
706
|
+
this.setStatusInternal(callId, 'cancelled', 'User cancelled tool execution.');
|
|
707
|
+
}
|
|
708
|
+
else {
|
|
709
|
+
this.setStatusInternal(callId, 'error', createErrorResponse(scheduledCall.request, executionError instanceof Error
|
|
710
|
+
? executionError
|
|
711
|
+
: new Error(String(executionError)), ToolErrorType.UNHANDLED_EXCEPTION));
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
async checkAndNotifyCompletion() {
|
|
718
|
+
const allCallsAreTerminal = this.toolCalls.every((call) => call.status === 'success' ||
|
|
719
|
+
call.status === 'error' ||
|
|
720
|
+
call.status === 'cancelled');
|
|
721
|
+
if (this.toolCalls.length > 0 && allCallsAreTerminal) {
|
|
722
|
+
const completedCalls = [...this.toolCalls];
|
|
723
|
+
this.toolCalls = [];
|
|
724
|
+
for (const call of completedCalls) {
|
|
725
|
+
logToolCall(this.config, new ToolCallEvent(call));
|
|
726
|
+
}
|
|
727
|
+
if (this.onAllToolCallsComplete) {
|
|
728
|
+
this.isFinalizingToolCalls = true;
|
|
729
|
+
await this.onAllToolCallsComplete(completedCalls);
|
|
730
|
+
this.isFinalizingToolCalls = false;
|
|
731
|
+
}
|
|
732
|
+
this.notifyToolCallsUpdate();
|
|
733
|
+
// After completion, process the next item in the queue.
|
|
734
|
+
if (this.requestQueue.length > 0) {
|
|
735
|
+
const next = this.requestQueue.shift();
|
|
736
|
+
this._schedule(next.request, next.signal)
|
|
737
|
+
.then(next.resolve)
|
|
738
|
+
.catch(next.reject);
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}
|
|
742
|
+
notifyToolCallsUpdate() {
|
|
743
|
+
if (this.onToolCallsUpdate) {
|
|
744
|
+
this.onToolCallsUpdate([...this.toolCalls]);
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
setToolCallOutcome(callId, outcome) {
|
|
748
|
+
this.toolCalls = this.toolCalls.map((call) => {
|
|
749
|
+
if (call.request.callId !== callId)
|
|
750
|
+
return call;
|
|
751
|
+
return {
|
|
752
|
+
...call,
|
|
753
|
+
outcome,
|
|
754
|
+
};
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
async autoApproveCompatiblePendingTools(signal, triggeringCallId) {
|
|
758
|
+
const pendingTools = this.toolCalls.filter((call) => call.status === 'awaiting_approval' &&
|
|
759
|
+
call.request.callId !== triggeringCallId);
|
|
760
|
+
for (const pendingTool of pendingTools) {
|
|
761
|
+
try {
|
|
762
|
+
const stillNeedsConfirmation = await pendingTool.invocation.shouldConfirmExecute(signal);
|
|
763
|
+
if (!stillNeedsConfirmation) {
|
|
764
|
+
this.setToolCallOutcome(pendingTool.request.callId, ToolConfirmationOutcome.ProceedAlways);
|
|
765
|
+
this.setStatusInternal(pendingTool.request.callId, 'scheduled');
|
|
766
|
+
}
|
|
767
|
+
}
|
|
768
|
+
catch (error) {
|
|
769
|
+
console.error(`Error checking confirmation for tool ${pendingTool.request.callId}:`, error);
|
|
770
|
+
}
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
//# sourceMappingURL=coreToolScheduler.js.map
|