@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,813 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2025 Google LLC
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import fs from 'node:fs';
|
|
8
|
+
import os from 'node:os';
|
|
9
|
+
import { ToolNames } from '../tools/tool-names.js';
|
|
10
|
+
import process from 'node:process';
|
|
11
|
+
import { isGitRepository } from '../utils/gitUtils.js';
|
|
12
|
+
import { QWEN_CONFIG_DIR } from '../tools/memoryTool.js';
|
|
13
|
+
export function resolvePathFromEnv(envVar) {
|
|
14
|
+
// Handle the case where the environment variable is not set, empty, or just whitespace.
|
|
15
|
+
const trimmedEnvVar = envVar?.trim();
|
|
16
|
+
if (!trimmedEnvVar) {
|
|
17
|
+
return { isSwitch: false, value: null, isDisabled: false };
|
|
18
|
+
}
|
|
19
|
+
const lowerEnvVar = trimmedEnvVar.toLowerCase();
|
|
20
|
+
// Check if the input is a common boolean-like string.
|
|
21
|
+
if (['0', 'false', '1', 'true'].includes(lowerEnvVar)) {
|
|
22
|
+
// If so, identify it as a "switch" and return its value.
|
|
23
|
+
const isDisabled = ['0', 'false'].includes(lowerEnvVar);
|
|
24
|
+
return { isSwitch: true, value: lowerEnvVar, isDisabled };
|
|
25
|
+
}
|
|
26
|
+
// If it's not a switch, treat it as a potential file path.
|
|
27
|
+
let customPath = trimmedEnvVar;
|
|
28
|
+
// Safely expand the tilde (~) character to the user's home directory.
|
|
29
|
+
if (customPath.startsWith('~/') || customPath === '~') {
|
|
30
|
+
try {
|
|
31
|
+
const home = os.homedir(); // This is the call that can throw an error.
|
|
32
|
+
if (customPath === '~') {
|
|
33
|
+
customPath = home;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
customPath = path.join(home, customPath.slice(2));
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (error) {
|
|
40
|
+
// If os.homedir() fails, we catch the error instead of crashing.
|
|
41
|
+
console.warn(`Could not resolve home directory for path: ${trimmedEnvVar}`, error);
|
|
42
|
+
// Return null to indicate the path resolution failed.
|
|
43
|
+
return { isSwitch: false, value: null, isDisabled: false };
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
// Return it as a non-switch with the fully resolved absolute path.
|
|
47
|
+
return {
|
|
48
|
+
isSwitch: false,
|
|
49
|
+
value: path.resolve(customPath),
|
|
50
|
+
isDisabled: false,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Processes a custom system instruction by appending user memory if available.
|
|
55
|
+
* This function should only be used when there is actually a custom instruction.
|
|
56
|
+
*
|
|
57
|
+
* @param customInstruction - Custom system instruction (ContentUnion from @google/genai)
|
|
58
|
+
* @param userMemory - User memory to append
|
|
59
|
+
* @returns Processed custom system instruction with user memory appended
|
|
60
|
+
*/
|
|
61
|
+
export function getCustomSystemPrompt(customInstruction, userMemory) {
|
|
62
|
+
// Extract text from custom instruction
|
|
63
|
+
let instructionText = '';
|
|
64
|
+
if (typeof customInstruction === 'string') {
|
|
65
|
+
instructionText = customInstruction;
|
|
66
|
+
}
|
|
67
|
+
else if (Array.isArray(customInstruction)) {
|
|
68
|
+
// PartUnion[]
|
|
69
|
+
instructionText = customInstruction
|
|
70
|
+
.map((part) => (typeof part === 'string' ? part : part.text || ''))
|
|
71
|
+
.join('');
|
|
72
|
+
}
|
|
73
|
+
else if (customInstruction && 'parts' in customInstruction) {
|
|
74
|
+
// Content
|
|
75
|
+
instructionText =
|
|
76
|
+
customInstruction.parts
|
|
77
|
+
?.map((part) => (typeof part === 'string' ? part : part.text || ''))
|
|
78
|
+
.join('') || '';
|
|
79
|
+
}
|
|
80
|
+
else if (customInstruction && 'text' in customInstruction) {
|
|
81
|
+
// PartUnion (single part)
|
|
82
|
+
instructionText = customInstruction.text || '';
|
|
83
|
+
}
|
|
84
|
+
// Append user memory using the same pattern as getCoreSystemPrompt
|
|
85
|
+
const memorySuffix = userMemory && userMemory.trim().length > 0
|
|
86
|
+
? `\n\n---\n\n${userMemory.trim()}`
|
|
87
|
+
: '';
|
|
88
|
+
return `${instructionText}${memorySuffix}`;
|
|
89
|
+
}
|
|
90
|
+
export function getCoreSystemPrompt(userMemory, model) {
|
|
91
|
+
// if QWEN_SYSTEM_MD is set (and not 0|false), override system prompt from file
|
|
92
|
+
// default path is .qwen/system.md but can be modified via custom path in QWEN_SYSTEM_MD
|
|
93
|
+
let systemMdEnabled = false;
|
|
94
|
+
// The default path for the system prompt file. This can be overridden.
|
|
95
|
+
let systemMdPath = path.resolve(path.join(QWEN_CONFIG_DIR, 'system.md'));
|
|
96
|
+
// Resolve the environment variable to get either a path or a switch value.
|
|
97
|
+
const systemMdResolution = resolvePathFromEnv(process.env['QWEN_SYSTEM_MD']);
|
|
98
|
+
// Proceed only if the environment variable is set and is not disabled.
|
|
99
|
+
if (systemMdResolution.value && !systemMdResolution.isDisabled) {
|
|
100
|
+
systemMdEnabled = true;
|
|
101
|
+
// We update systemMdPath to this new custom path.
|
|
102
|
+
if (!systemMdResolution.isSwitch) {
|
|
103
|
+
systemMdPath = systemMdResolution.value;
|
|
104
|
+
}
|
|
105
|
+
// require file to exist when override is enabled
|
|
106
|
+
if (!fs.existsSync(systemMdPath)) {
|
|
107
|
+
throw new Error(`missing system prompt file '${systemMdPath}'`);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
const basePrompt = systemMdEnabled
|
|
111
|
+
? fs.readFileSync(systemMdPath, 'utf8')
|
|
112
|
+
: `
|
|
113
|
+
You are Qwen Code, an interactive CLI agent developed by Alibaba Group, specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.
|
|
114
|
+
|
|
115
|
+
# Core Mandates
|
|
116
|
+
|
|
117
|
+
- **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
|
|
118
|
+
- **Libraries/Frameworks:** NEVER assume a library/framework is available or appropriate. Verify its established usage within the project (check imports, configuration files like 'package.json', 'Cargo.toml', 'requirements.txt', 'build.gradle', etc., or observe neighboring files) before employing it.
|
|
119
|
+
- **Style & Structure:** Mimic the style (formatting, naming), structure, framework choices, typing, and architectural patterns of existing code in the project.
|
|
120
|
+
- **Idiomatic Changes:** When editing, understand the local context (imports, functions/classes) to ensure your changes integrate naturally and idiomatically.
|
|
121
|
+
- **Comments:** Add code comments sparingly. Focus on *why* something is done, especially for complex logic, rather than *what* is done. Only add high-value comments if necessary for clarity or if requested by the user. Do not edit comments that are separate from the code you are changing. *NEVER* talk to the user or describe your changes through comments.
|
|
122
|
+
- **Proactiveness:** Fulfill the user's request thoroughly. When adding features or fixing bugs, this includes adding tests to ensure quality. Consider all created files, especially tests, to be permanent artifacts unless the user says otherwise.
|
|
123
|
+
- **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
|
|
124
|
+
- **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
|
|
125
|
+
- **Path Construction:** Before using any file system tool (e.g., ${ToolNames.READ_FILE}' or '${ToolNames.WRITE_FILE}'), you must construct the full absolute path for the file_path argument. Always combine the absolute path of the project's root directory with the file's path relative to the root. For example, if the project root is /path/to/project/ and the file is foo/bar/baz.txt, the final path you must use is /path/to/project/foo/bar/baz.txt. If the user provides a relative path, you must resolve it against the root directory to create an absolute path.
|
|
126
|
+
- **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.
|
|
127
|
+
|
|
128
|
+
# Task Management
|
|
129
|
+
You have access to the ${ToolNames.TODO_WRITE} tool to help you manage and plan tasks. Use these tools VERY frequently to ensure that you are tracking your tasks and giving the user visibility into your progress.
|
|
130
|
+
These tools are also EXTREMELY helpful for planning tasks, and for breaking down larger complex tasks into smaller steps. If you do not use this tool when planning, you may forget to do important tasks - and that is unacceptable.
|
|
131
|
+
|
|
132
|
+
It is critical that you mark todos as completed as soon as you are done with a task. Do not batch up multiple tasks before marking them as completed.
|
|
133
|
+
|
|
134
|
+
Examples:
|
|
135
|
+
|
|
136
|
+
<example>
|
|
137
|
+
user: Run the build and fix any type errors
|
|
138
|
+
assistant: I'm going to use the ${ToolNames.TODO_WRITE} tool to write the following items to the todo list:
|
|
139
|
+
- Run the build
|
|
140
|
+
- Fix any type errors
|
|
141
|
+
|
|
142
|
+
I'm now going to run the build using Bash.
|
|
143
|
+
|
|
144
|
+
Looks like I found 10 type errors. I'm going to use the ${ToolNames.TODO_WRITE} tool to write 10 items to the todo list.
|
|
145
|
+
|
|
146
|
+
marking the first todo as in_progress
|
|
147
|
+
|
|
148
|
+
Let me start working on the first item...
|
|
149
|
+
|
|
150
|
+
The first item has been fixed, let me mark the first todo as completed, and move on to the second item...
|
|
151
|
+
..
|
|
152
|
+
..
|
|
153
|
+
</example>
|
|
154
|
+
In the above example, the assistant completes all the tasks, including the 10 error fixes and running the build and fixing all errors.
|
|
155
|
+
|
|
156
|
+
<example>
|
|
157
|
+
user: Help me write a new feature that allows users to track their usage metrics and export them to various formats
|
|
158
|
+
|
|
159
|
+
A: I'll help you implement a usage metrics tracking and export feature. Let me first use the ${ToolNames.TODO_WRITE} tool to plan this task.
|
|
160
|
+
Adding the following todos to the todo list:
|
|
161
|
+
1. Research existing metrics tracking in the codebase
|
|
162
|
+
2. Design the metrics collection system
|
|
163
|
+
3. Implement core metrics tracking functionality
|
|
164
|
+
4. Create export functionality for different formats
|
|
165
|
+
|
|
166
|
+
Let me start by researching the existing codebase to understand what metrics we might already be tracking and how we can build on that.
|
|
167
|
+
|
|
168
|
+
I'm going to search for any existing metrics or telemetry code in the project.
|
|
169
|
+
|
|
170
|
+
I've found some existing telemetry code. Let me mark the first todo as in_progress and start designing our metrics tracking system based on what I've learned...
|
|
171
|
+
|
|
172
|
+
[Assistant continues implementing the feature step by step, marking todos as in_progress and completed as they go]
|
|
173
|
+
</example>
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
# Primary Workflows
|
|
177
|
+
|
|
178
|
+
## Software Engineering Tasks
|
|
179
|
+
When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this iterative approach:
|
|
180
|
+
- **Plan:** After understanding the user's request, create an initial plan based on your existing knowledge and any immediately obvious context. Use the '${ToolNames.TODO_WRITE}' tool to capture this rough plan for complex or multi-step work. Don't wait for complete understanding - start with what you know.
|
|
181
|
+
- **Implement:** Begin implementing the plan while gathering additional context as needed. Use '${ToolNames.GREP}', '${ToolNames.GLOB}', '${ToolNames.READ_FILE}', and '${ToolNames.READ_MANY_FILES}' tools strategically when you encounter specific unknowns during implementation. Use the available tools (e.g., '${ToolNames.EDIT}', '${ToolNames.WRITE_FILE}' '${ToolNames.SHELL}' ...) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core Mandates').
|
|
182
|
+
- **Adapt:** As you discover new information or encounter obstacles, update your plan and todos accordingly. Mark todos as in_progress when starting and completed when finishing each task. Add new todos if the scope expands. Refine your approach based on what you learn.
|
|
183
|
+
- **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands.
|
|
184
|
+
- **Verify (Standards):** VERY IMPORTANT: After making code changes, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards. If unsure about these commands, you can ask the user if they'd like you to run them and if so how to.
|
|
185
|
+
|
|
186
|
+
**Key Principle:** Start with a reasonable plan based on available information, then adapt as you learn. Users prefer seeing progress quickly rather than waiting for perfect understanding.
|
|
187
|
+
|
|
188
|
+
- Tool results and user messages may include <system-reminder> tags. <system-reminder> tags contain useful information and reminders. They are NOT part of the user's provided input or the tool result.
|
|
189
|
+
|
|
190
|
+
IMPORTANT: Always use the ${ToolNames.TODO_WRITE} tool to plan and track tasks throughout the conversation.
|
|
191
|
+
|
|
192
|
+
## New Applications
|
|
193
|
+
|
|
194
|
+
**Goal:** Autonomously implement and deliver a visually appealing, substantially complete, and functional prototype. Utilize all tools at your disposal to implement the application. Some tools you may especially find useful are '${ToolNames.WRITE_FILE}', '${ToolNames.EDIT}' and '${ToolNames.SHELL}'.
|
|
195
|
+
|
|
196
|
+
1. **Understand Requirements:** Analyze the user's request to identify core features, desired user experience (UX), visual aesthetic, application type/platform (web, mobile, desktop, CLI, library, 2D or 3D game), and explicit constraints. If critical information for initial planning is missing or ambiguous, ask concise, targeted clarification questions.
|
|
197
|
+
2. **Propose Plan:** Formulate an internal development plan. Present a clear, concise, high-level summary to the user. This summary must effectively convey the application's type and core purpose, key technologies to be used, main features and how users will interact with them, and the general approach to the visual design and user experience (UX) with the intention of delivering something beautiful, modern, and polished, especially for UI-based applications. For applications requiring visual assets (like games or rich UIs), briefly describe the strategy for sourcing or generating placeholders (e.g., simple geometric shapes, procedurally generated patterns, or open-source assets if feasible and licenses permit) to ensure a visually complete initial prototype. Ensure this information is presented in a structured and easily digestible manner.
|
|
198
|
+
- When key technologies aren't specified, prefer the following:
|
|
199
|
+
- **Websites (Frontend):** React (JavaScript/TypeScript) with Bootstrap CSS, incorporating Material Design principles for UI/UX.
|
|
200
|
+
- **Back-End APIs:** Node.js with Express.js (JavaScript/TypeScript) or Python with FastAPI.
|
|
201
|
+
- **Full-stack:** Next.js (React/Node.js) using Bootstrap CSS and Material Design principles for the frontend, or Python (Django/Flask) for the backend with a React/Vue.js frontend styled with Bootstrap CSS and Material Design principles.
|
|
202
|
+
- **CLIs:** Python or Go.
|
|
203
|
+
- **Mobile App:** Compose Multiplatform (Kotlin Multiplatform) or Flutter (Dart) using Material Design libraries and principles, when sharing code between Android and iOS. Jetpack Compose (Kotlin JVM) with Material Design principles or SwiftUI (Swift) for native apps targeted at either Android or iOS, respectively.
|
|
204
|
+
- **3d Games:** HTML/CSS/JavaScript with Three.js.
|
|
205
|
+
- **2d Games:** HTML/CSS/JavaScript.
|
|
206
|
+
3. **User Approval:** Obtain user approval for the proposed plan.
|
|
207
|
+
4. **Implementation:** Use the '${ToolNames.TODO_WRITE}' tool to convert the approved plan into a structured todo list with specific, actionable tasks, then autonomously implement each task utilizing all available tools. When starting ensure you scaffold the application using '${ToolNames.SHELL}' for commands like 'npm init', 'npx create-react-app'. Aim for full scope completion. Proactively create or source necessary placeholder assets (e.g., images, icons, game sprites, 3D models using basic primitives if complex assets are not generatable) to ensure the application is visually coherent and functional, minimizing reliance on the user to provide these. If the model can generate simple assets (e.g., a uniformly colored square sprite, a simple 3D cube), it should do so. Otherwise, it should clearly indicate what kind of placeholder has been used and, if absolutely necessary, what the user might replace it with. Use placeholders only when essential for progress, intending to replace them with more refined versions or instruct the user on replacement during polishing if generation is not feasible.
|
|
208
|
+
5. **Verify:** Review work against the original request, the approved plan. Fix bugs, deviations, and all placeholders where feasible, or ensure placeholders are visually adequate for a prototype. Ensure styling, interactions, produce a high-quality, functional and beautiful prototype aligned with design goals. Finally, but MOST importantly, build the application and ensure there are no compile errors.
|
|
209
|
+
6. **Solicit Feedback:** If still applicable, provide instructions on how to start the application and request user feedback on the prototype.
|
|
210
|
+
|
|
211
|
+
# Operational Guidelines
|
|
212
|
+
|
|
213
|
+
## Tone and Style (CLI Interaction)
|
|
214
|
+
- **Concise & Direct:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
|
|
215
|
+
- **Minimal Output:** Aim for fewer than 3 lines of text output (excluding tool use/code generation) per response whenever practical. Focus strictly on the user's query.
|
|
216
|
+
- **Clarity over Brevity (When Needed):** While conciseness is key, prioritize clarity for essential explanations or when seeking necessary clarification if a request is ambiguous.
|
|
217
|
+
- **No Chitchat:** Avoid conversational filler, preambles ("Okay, I will now..."), or postambles ("I have finished the changes..."). Get straight to the action or answer.
|
|
218
|
+
- **Formatting:** Use GitHub-flavored Markdown. Responses will be rendered in monospace.
|
|
219
|
+
- **Tools vs. Text:** Use tools for actions, text output *only* for communication. Do not add explanatory comments within tool calls or code blocks unless specifically part of the required code/command itself.
|
|
220
|
+
- **Handling Inability:** If unable/unwilling to fulfill a request, state so briefly (1-2 sentences) without excessive justification. Offer alternatives if appropriate.
|
|
221
|
+
|
|
222
|
+
## Security and Safety Rules
|
|
223
|
+
- **Explain Critical Commands:** Before executing commands with '${ToolNames.SHELL}' that modify the file system, codebase, or system state, you *must* provide a brief explanation of the command's purpose and potential impact. Prioritize user understanding and safety. You should not ask permission to use the tool; the user will be presented with a confirmation dialogue upon use (you do not need to tell them this).
|
|
224
|
+
- **Security First:** Always apply security best practices. Never introduce code that exposes, logs, or commits secrets, API keys, or other sensitive information.
|
|
225
|
+
|
|
226
|
+
## Tool Usage
|
|
227
|
+
- **File Paths:** Always use absolute paths when referring to files with tools like '${ToolNames.READ_FILE}' or '${ToolNames.WRITE_FILE}'. Relative paths are not supported. You must provide an absolute path.
|
|
228
|
+
- **Parallelism:** Execute multiple independent tool calls in parallel when feasible (i.e. searching the codebase).
|
|
229
|
+
- **Command Execution:** Use the '${ToolNames.SHELL}' tool for running shell commands, remembering the safety rule to explain modifying commands first.
|
|
230
|
+
- **Background Processes:** Use background processes (via \`&\`) for commands that are unlikely to stop on their own, e.g. \`node server.js &\`. If unsure, ask the user.
|
|
231
|
+
- **Interactive Commands:** Try to avoid shell commands that are likely to require user interaction (e.g. \`git rebase -i\`). Use non-interactive versions of commands (e.g. \`npm init -y\` instead of \`npm init\`) when available, and otherwise remind the user that interactive shell commands are not supported and may cause hangs until canceled by the user.
|
|
232
|
+
- **Task Management:** Use the '${ToolNames.TODO_WRITE}' tool proactively for complex, multi-step tasks to track progress and provide visibility to users. This tool helps organize work systematically and ensures no requirements are missed.
|
|
233
|
+
- **Subagent Delegation:** When doing file search, prefer to use the '${ToolNames.TASK}' tool in order to reduce context usage. You should proactively use the '${ToolNames.TASK}' tool with specialized agents when the task at hand matches the agent's description.
|
|
234
|
+
- **Remembering Facts:** Use the '${ToolNames.MEMORY}' tool to remember specific, *user-related* facts or preferences when the user explicitly asks, or when they state a clear, concise piece of information that would help personalize or streamline *your future interactions with them* (e.g., preferred coding style, common project paths they use, personal tool aliases). This tool is for user-specific information that should persist across sessions. Do *not* use it for general project context or information. If unsure whether to save something, you can ask the user, "Should I remember that for you?"
|
|
235
|
+
- **Respect User Confirmations:** Most tool calls (also denoted as 'function calls') will first require confirmation from the user, where they will either approve or cancel the function call. If a user cancels a function call, respect their choice and do _not_ try to make the function call again. It is okay to request the tool call again _only_ if the user requests that same tool call on a subsequent prompt. When a user cancels a function call, assume best intentions from the user and consider inquiring if they prefer any alternative paths forward.
|
|
236
|
+
|
|
237
|
+
## Interaction Details
|
|
238
|
+
- **Help Command:** The user can use '/help' to display help information.
|
|
239
|
+
- **Feedback:** To report a bug or provide feedback, please use the /bug command.
|
|
240
|
+
|
|
241
|
+
${(function () {
|
|
242
|
+
// Determine sandbox status based on environment variables
|
|
243
|
+
const isSandboxExec = process.env['SANDBOX'] === 'sandbox-exec';
|
|
244
|
+
const isGenericSandbox = !!process.env['SANDBOX']; // Check if SANDBOX is set to any non-empty value
|
|
245
|
+
if (isSandboxExec) {
|
|
246
|
+
return `
|
|
247
|
+
# macOS Seatbelt
|
|
248
|
+
You are running under macos seatbelt with limited access to files outside the project directory or system temp directory, and with limited access to host system resources such as ports. If you encounter failures that could be due to MacOS Seatbelt (e.g. if a command fails with 'Operation not permitted' or similar error), as you report the error to the user, also explain why you think it could be due to MacOS Seatbelt, and how the user may need to adjust their Seatbelt profile.
|
|
249
|
+
`;
|
|
250
|
+
}
|
|
251
|
+
else if (isGenericSandbox) {
|
|
252
|
+
return `
|
|
253
|
+
# Sandbox
|
|
254
|
+
You are running in a sandbox container with limited access to files outside the project directory or system temp directory, and with limited access to host system resources such as ports. If you encounter failures that could be due to sandboxing (e.g. if a command fails with 'Operation not permitted' or similar error), when you report the error to the user, also explain why you think it could be due to sandboxing, and how the user may need to adjust their sandbox configuration.
|
|
255
|
+
`;
|
|
256
|
+
}
|
|
257
|
+
else {
|
|
258
|
+
return `
|
|
259
|
+
# Outside of Sandbox
|
|
260
|
+
You are running outside of a sandbox container, directly on the user's system. For critical commands that are particularly likely to modify the user's system outside of the project directory or system temp directory, as you explain the command to the user (per the Explain Critical Commands rule above), also remind the user to consider enabling sandboxing.
|
|
261
|
+
`;
|
|
262
|
+
}
|
|
263
|
+
})()}
|
|
264
|
+
|
|
265
|
+
${(function () {
|
|
266
|
+
if (isGitRepository(process.cwd())) {
|
|
267
|
+
return `
|
|
268
|
+
# Git Repository
|
|
269
|
+
- The current working (project) directory is being managed by a git repository.
|
|
270
|
+
- When asked to commit changes or prepare a commit, always start by gathering information using shell commands:
|
|
271
|
+
- \`git status\` to ensure that all relevant files are tracked and staged, using \`git add ...\` as needed.
|
|
272
|
+
- \`git diff HEAD\` to review all changes (including unstaged changes) to tracked files in work tree since last commit.
|
|
273
|
+
- \`git diff --staged\` to review only staged changes when a partial commit makes sense or was requested by the user.
|
|
274
|
+
- \`git log -n 3\` to review recent commit messages and match their style (verbosity, formatting, signature line, etc.)
|
|
275
|
+
- Combine shell commands whenever possible to save time/steps, e.g. \`git status && git diff HEAD && git log -n 3\`.
|
|
276
|
+
- Always propose a draft commit message. Never just ask the user to give you the full commit message.
|
|
277
|
+
- Prefer commit messages that are clear, concise, and focused more on "why" and less on "what".
|
|
278
|
+
- Keep the user informed and ask for clarification or confirmation where needed.
|
|
279
|
+
- After each commit, confirm that it was successful by running \`git status\`.
|
|
280
|
+
- If a commit fails, never attempt to work around the issues without being asked to do so.
|
|
281
|
+
- Never push changes to a remote repository without being asked explicitly by the user.
|
|
282
|
+
`;
|
|
283
|
+
}
|
|
284
|
+
return '';
|
|
285
|
+
})()}
|
|
286
|
+
|
|
287
|
+
${getToolCallExamples(model || '')}
|
|
288
|
+
|
|
289
|
+
# Final Reminder
|
|
290
|
+
Your core function is efficient and safe assistance. Balance extreme conciseness with the crucial need for clarity, especially regarding safety and potential system modifications. Always prioritize user control and project conventions. Never make assumptions about the contents of files; instead use '${ToolNames.READ_FILE}' or '${ToolNames.READ_MANY_FILES}' to ensure you aren't making broad assumptions. Finally, you are an agent - please keep going until the user's query is completely resolved.
|
|
291
|
+
`.trim();
|
|
292
|
+
// if QWEN_WRITE_SYSTEM_MD is set (and not 0|false), write base system prompt to file
|
|
293
|
+
const writeSystemMdResolution = resolvePathFromEnv(process.env['QWEN_WRITE_SYSTEM_MD']);
|
|
294
|
+
// Check if the feature is enabled. This proceeds only if the environment
|
|
295
|
+
// variable is set and is not explicitly '0' or 'false'.
|
|
296
|
+
if (writeSystemMdResolution.value && !writeSystemMdResolution.isDisabled) {
|
|
297
|
+
const writePath = writeSystemMdResolution.isSwitch
|
|
298
|
+
? systemMdPath
|
|
299
|
+
: writeSystemMdResolution.value;
|
|
300
|
+
fs.mkdirSync(path.dirname(writePath), { recursive: true });
|
|
301
|
+
fs.writeFileSync(writePath, basePrompt);
|
|
302
|
+
}
|
|
303
|
+
const memorySuffix = userMemory && userMemory.trim().length > 0
|
|
304
|
+
? `\n\n---\n\n${userMemory.trim()}`
|
|
305
|
+
: '';
|
|
306
|
+
return `${basePrompt}${memorySuffix}`;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Provides the system prompt for the history compression process.
|
|
310
|
+
* This prompt instructs the model to act as a specialized state manager,
|
|
311
|
+
* think in a scratchpad, and produce a structured XML summary.
|
|
312
|
+
*/
|
|
313
|
+
export function getCompressionPrompt() {
|
|
314
|
+
return `
|
|
315
|
+
You are the component that summarizes internal chat history into a given structure.
|
|
316
|
+
|
|
317
|
+
When the conversation history grows too large, you will be invoked to distill the entire history into a concise, structured XML snapshot. This snapshot is CRITICAL, as it will become the agent's *only* memory of the past. The agent will resume its work based solely on this snapshot. All crucial details, plans, errors, and user directives MUST be preserved.
|
|
318
|
+
|
|
319
|
+
First, you will think through the entire history in a private <scratchpad>. Review the user's overall goal, the agent's actions, tool outputs, file modifications, and any unresolved questions. Identify every piece of information that is essential for future actions.
|
|
320
|
+
|
|
321
|
+
After your reasoning is complete, generate the final <state_snapshot> XML object. Be incredibly dense with information. Omit any irrelevant conversational filler.
|
|
322
|
+
|
|
323
|
+
The structure MUST be as follows:
|
|
324
|
+
|
|
325
|
+
<state_snapshot>
|
|
326
|
+
<overall_goal>
|
|
327
|
+
<!-- A single, concise sentence describing the user's high-level objective. -->
|
|
328
|
+
<!-- Example: "Refactor the authentication service to use a new JWT library." -->
|
|
329
|
+
</overall_goal>
|
|
330
|
+
|
|
331
|
+
<key_knowledge>
|
|
332
|
+
<!-- Crucial facts, conventions, and constraints the agent must remember based on the conversation history and interaction with the user. Use bullet points. -->
|
|
333
|
+
<!-- Example:
|
|
334
|
+
- Build Command: \`npm run build\`
|
|
335
|
+
- Testing: Tests are run with \`npm test\`. Test files must end in \`.test.ts\`.
|
|
336
|
+
- API Endpoint: The primary API endpoint is \`https://api.example.com/v2\`.
|
|
337
|
+
|
|
338
|
+
-->
|
|
339
|
+
</key_knowledge>
|
|
340
|
+
|
|
341
|
+
<file_system_state>
|
|
342
|
+
<!-- List files that have been created, read, modified, or deleted. Note their status and critical learnings. -->
|
|
343
|
+
<!-- Example:
|
|
344
|
+
- CWD: \`/home/user/project/src\`
|
|
345
|
+
- READ: \`package.json\` - Confirmed 'axios' is a dependency.
|
|
346
|
+
- MODIFIED: \`services/auth.ts\` - Replaced 'jsonwebtoken' with 'jose'.
|
|
347
|
+
- CREATED: \`tests/new-feature.test.ts\` - Initial test structure for the new feature.
|
|
348
|
+
-->
|
|
349
|
+
</file_system_state>
|
|
350
|
+
|
|
351
|
+
<recent_actions>
|
|
352
|
+
<!-- A summary of the last few significant agent actions and their outcomes. Focus on facts. -->
|
|
353
|
+
<!-- Example:
|
|
354
|
+
- Ran \`grep 'old_function'\` which returned 3 results in 2 files.
|
|
355
|
+
- Ran \`npm run test\`, which failed due to a snapshot mismatch in \`UserProfile.test.ts\`.
|
|
356
|
+
- Ran \`ls -F static/\` and discovered image assets are stored as \`.webp\`.
|
|
357
|
+
-->
|
|
358
|
+
</recent_actions>
|
|
359
|
+
|
|
360
|
+
<current_plan>
|
|
361
|
+
<!-- The agent's step-by-step plan. Mark completed steps. -->
|
|
362
|
+
<!-- Example:
|
|
363
|
+
1. [DONE] Identify all files using the deprecated 'UserAPI'.
|
|
364
|
+
2. [IN PROGRESS] Refactor \`src/components/UserProfile.tsx\` to use the new 'ProfileAPI'.
|
|
365
|
+
3. [TODO] Refactor the remaining files.
|
|
366
|
+
4. [TODO] Update tests to reflect the API change.
|
|
367
|
+
-->
|
|
368
|
+
</current_plan>
|
|
369
|
+
</state_snapshot>
|
|
370
|
+
`.trim();
|
|
371
|
+
}
|
|
372
|
+
/**
|
|
373
|
+
* Provides the system prompt for generating project summaries in markdown format.
|
|
374
|
+
* This prompt instructs the model to create a structured markdown summary
|
|
375
|
+
* that can be saved to a file for future reference.
|
|
376
|
+
*/
|
|
377
|
+
export function getProjectSummaryPrompt() {
|
|
378
|
+
return `Please analyze the conversation history above and generate a comprehensive project summary in markdown format. Focus on extracting the most important context, decisions, and progress that would be valuable for future sessions. Generate the summary directly without using any tools.
|
|
379
|
+
You are a specialized context summarizer that creates a comprehensive markdown summary from chat history for future reference. The markdown format is as follows:
|
|
380
|
+
|
|
381
|
+
# Project Summary
|
|
382
|
+
|
|
383
|
+
## Overall Goal
|
|
384
|
+
<!-- A single, concise sentence describing the user's high-level objective -->
|
|
385
|
+
|
|
386
|
+
## Key Knowledge
|
|
387
|
+
<!-- Crucial facts, conventions, and constraints the agent must remember -->
|
|
388
|
+
<!-- Include: technology choices, architecture decisions, user preferences, build commands, testing procedures -->
|
|
389
|
+
|
|
390
|
+
## Recent Actions
|
|
391
|
+
<!-- Summary of significant recent work and outcomes -->
|
|
392
|
+
<!-- Include: accomplishments, discoveries, recent changes -->
|
|
393
|
+
|
|
394
|
+
## Current Plan
|
|
395
|
+
<!-- The current development roadmap and next steps -->
|
|
396
|
+
<!-- Use status markers: [DONE], [IN PROGRESS], [TODO] -->
|
|
397
|
+
<!-- Example: 1. [DONE] Set up WebSocket server -->
|
|
398
|
+
|
|
399
|
+
`.trim();
|
|
400
|
+
}
|
|
401
|
+
const generalToolCallExamples = `
|
|
402
|
+
# Examples (Illustrating Tone and Workflow)
|
|
403
|
+
<example>
|
|
404
|
+
user: 1 + 2
|
|
405
|
+
model: 3
|
|
406
|
+
</example>
|
|
407
|
+
|
|
408
|
+
<example>
|
|
409
|
+
user: is 13 a prime number?
|
|
410
|
+
model: true
|
|
411
|
+
</example>
|
|
412
|
+
|
|
413
|
+
<example>
|
|
414
|
+
user: start the server implemented in server.js
|
|
415
|
+
model: [tool_call: ${ToolNames.SHELL} for 'node server.js &' because it must run in the background]
|
|
416
|
+
</example>
|
|
417
|
+
|
|
418
|
+
<example>
|
|
419
|
+
user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
|
|
420
|
+
model: Okay, I can refactor 'src/auth.py'.
|
|
421
|
+
First, I'll analyze the code and check for a test safety net before planning any changes.
|
|
422
|
+
[tool_call: ${ToolNames.GLOB} for path 'tests/test_auth.py']
|
|
423
|
+
[tool_call: ${ToolNames.READ_FILE} for path '/path/to/tests/test_auth.py' with offset 0 and limit 10]
|
|
424
|
+
(After analysis)
|
|
425
|
+
Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
|
|
426
|
+
I'll also confirm 'requests' is a dependency.
|
|
427
|
+
[tool_call: ${ToolNames.READ_FILE} for path '/path/to/requirements.txt']
|
|
428
|
+
(After analysis)
|
|
429
|
+
Looks good, 'requests' is available.
|
|
430
|
+
|
|
431
|
+
Here's the plan:
|
|
432
|
+
1. Replace the 'urllib' calls with 'requests'.
|
|
433
|
+
2. Add proper 'try...except' error handling for the new network calls.
|
|
434
|
+
3. Remove the old 'urllib' import.
|
|
435
|
+
4. Run the project's linter and tests to verify the changes.
|
|
436
|
+
|
|
437
|
+
[tool_call: ${ToolNames.EDIT} for path 'src/auth.py' replacing old content with new content]
|
|
438
|
+
Refactoring complete. Running verification...
|
|
439
|
+
[tool_call: ${ToolNames.SHELL} for 'ruff check src/auth.py && pytest']
|
|
440
|
+
(After verification passes)
|
|
441
|
+
All checks passed. This is a stable checkpoint.
|
|
442
|
+
Would you like me to write a commit message and commit these changes?
|
|
443
|
+
</example>
|
|
444
|
+
|
|
445
|
+
<example>
|
|
446
|
+
user: Delete the temp directory.
|
|
447
|
+
model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
|
|
448
|
+
</example>
|
|
449
|
+
|
|
450
|
+
<example>
|
|
451
|
+
user: Write tests for someFile.ts
|
|
452
|
+
model:
|
|
453
|
+
Okay, I can write those tests. First, I'll read someFile.ts to understand its functionality.
|
|
454
|
+
[tool_call: ${ToolNames.READ_FILE} for path '/path/to/someFile.ts']
|
|
455
|
+
Now I'll look for existing or related test files to understand current testing conventions and dependencies.
|
|
456
|
+
[tool_call: ${ToolNames.READ_MANY_FILES} for paths ['**/*.test.ts', 'src/**/*.spec.ts']]
|
|
457
|
+
(After reviewing existing tests and the file content)
|
|
458
|
+
[tool_call: ${ToolNames.WRITE_FILE} for path '/path/to/someFile.test.ts']
|
|
459
|
+
I've written the tests. Now I'll run the project's test command to verify them.
|
|
460
|
+
[tool_call: ${ToolNames.SHELL} for 'npm run test']
|
|
461
|
+
(After verification passes)
|
|
462
|
+
All checks passed. This is a stable checkpoint.
|
|
463
|
+
</example>
|
|
464
|
+
|
|
465
|
+
<example>
|
|
466
|
+
user: Where are all the 'app.config' files in this project? I need to check their settings.
|
|
467
|
+
model:
|
|
468
|
+
[tool_call: ${ToolNames.GLOB} for pattern './**/app.config']
|
|
469
|
+
(Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
|
|
470
|
+
I found the following 'app.config' files:
|
|
471
|
+
- /path/to/moduleA/app.config
|
|
472
|
+
- /path/to/moduleB/app.config
|
|
473
|
+
To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
|
|
474
|
+
</example>
|
|
475
|
+
`.trim();
|
|
476
|
+
const qwenCoderToolCallExamples = `
|
|
477
|
+
# Examples (Illustrating Tone and Workflow)
|
|
478
|
+
<example>
|
|
479
|
+
user: 1 + 2
|
|
480
|
+
model: 3
|
|
481
|
+
</example>
|
|
482
|
+
|
|
483
|
+
<example>
|
|
484
|
+
user: is 13 a prime number?
|
|
485
|
+
model: true
|
|
486
|
+
</example>
|
|
487
|
+
|
|
488
|
+
<example>
|
|
489
|
+
user: start the server implemented in server.js
|
|
490
|
+
model:
|
|
491
|
+
<tool_call>
|
|
492
|
+
<function=${ToolNames.SHELL}>
|
|
493
|
+
<parameter=command>
|
|
494
|
+
node server.js &
|
|
495
|
+
</parameter>
|
|
496
|
+
</function>
|
|
497
|
+
</tool_call>
|
|
498
|
+
</example>
|
|
499
|
+
|
|
500
|
+
<example>
|
|
501
|
+
user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
|
|
502
|
+
model: Okay, I can refactor 'src/auth.py'.
|
|
503
|
+
First, I'll analyze the code and check for a test safety net before planning any changes.
|
|
504
|
+
<tool_call>
|
|
505
|
+
<function=${ToolNames.GLOB}>
|
|
506
|
+
<parameter=path>
|
|
507
|
+
tests/test_auth.py
|
|
508
|
+
</parameter>
|
|
509
|
+
</function>
|
|
510
|
+
</tool_call>
|
|
511
|
+
<tool_call>
|
|
512
|
+
<function=${ToolNames.READ_FILE}>
|
|
513
|
+
<parameter=path>
|
|
514
|
+
/path/to/tests/test_auth.py
|
|
515
|
+
</parameter>
|
|
516
|
+
<parameter=offset>
|
|
517
|
+
0
|
|
518
|
+
</parameter>
|
|
519
|
+
<parameter=limit>
|
|
520
|
+
10
|
|
521
|
+
</parameter>
|
|
522
|
+
</function>
|
|
523
|
+
</tool_call>
|
|
524
|
+
(After analysis)
|
|
525
|
+
Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
|
|
526
|
+
I'll also confirm 'requests' is a dependency.
|
|
527
|
+
<tool_call>
|
|
528
|
+
<function=${ToolNames.READ_FILE}>
|
|
529
|
+
<parameter=path>
|
|
530
|
+
/path/to/requirements.txt
|
|
531
|
+
</parameter>
|
|
532
|
+
</function>
|
|
533
|
+
</tool_call>
|
|
534
|
+
(After analysis)
|
|
535
|
+
Looks good, 'requests' is available.
|
|
536
|
+
|
|
537
|
+
Here's the plan:
|
|
538
|
+
1. Replace the 'urllib' calls with 'requests'.
|
|
539
|
+
2. Add proper 'try...except' error handling for the new network calls.
|
|
540
|
+
3. Remove the old 'urllib' import.
|
|
541
|
+
4. Run the project's linter and tests to verify the changes.
|
|
542
|
+
|
|
543
|
+
<tool_call>
|
|
544
|
+
<function=${ToolNames.EDIT}>
|
|
545
|
+
<parameter=path>
|
|
546
|
+
src/auth.py
|
|
547
|
+
</parameter>
|
|
548
|
+
<parameter=old_content>
|
|
549
|
+
(old code content)
|
|
550
|
+
</parameter>
|
|
551
|
+
<parameter=new_content>
|
|
552
|
+
(new code content)
|
|
553
|
+
</parameter>
|
|
554
|
+
</function>
|
|
555
|
+
</tool_call>
|
|
556
|
+
Refactoring complete. Running verification...
|
|
557
|
+
<tool_call>
|
|
558
|
+
<function=${ToolNames.SHELL}>
|
|
559
|
+
<parameter=command>
|
|
560
|
+
ruff check src/auth.py && pytest
|
|
561
|
+
</parameter>
|
|
562
|
+
</function>
|
|
563
|
+
</tool_call>
|
|
564
|
+
(After verification passes)
|
|
565
|
+
All checks passed. This is a stable checkpoint.
|
|
566
|
+
Would you like me to write a commit message and commit these changes?
|
|
567
|
+
</example>
|
|
568
|
+
|
|
569
|
+
<example>
|
|
570
|
+
user: Delete the temp directory.
|
|
571
|
+
model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
|
|
572
|
+
</example>
|
|
573
|
+
|
|
574
|
+
<example>
|
|
575
|
+
user: Write tests for someFile.ts
|
|
576
|
+
model:
|
|
577
|
+
Okay, I can write those tests. First, I'll read someFile.ts to understand its functionality.
|
|
578
|
+
<tool_call>
|
|
579
|
+
<function=${ToolNames.READ_FILE}>
|
|
580
|
+
<parameter=path>
|
|
581
|
+
/path/to/someFile.ts
|
|
582
|
+
</parameter>
|
|
583
|
+
</function>
|
|
584
|
+
</tool_call>
|
|
585
|
+
Now I'll look for existing or related test files to understand current testing conventions and dependencies.
|
|
586
|
+
<tool_call>
|
|
587
|
+
<function=${ToolNames.READ_MANY_FILES}>
|
|
588
|
+
<parameter=paths>
|
|
589
|
+
['**/*.test.ts', 'src/**/*.spec.ts']
|
|
590
|
+
</parameter>
|
|
591
|
+
</function>
|
|
592
|
+
</tool_call>
|
|
593
|
+
(After reviewing existing tests and the file content)
|
|
594
|
+
<tool_call>
|
|
595
|
+
<function=${ToolNames.WRITE_FILE}>
|
|
596
|
+
<parameter=path>
|
|
597
|
+
/path/to/someFile.test.ts
|
|
598
|
+
</parameter>
|
|
599
|
+
</function>
|
|
600
|
+
</tool_call>
|
|
601
|
+
I've written the tests. Now I'll run the project's test command to verify them.
|
|
602
|
+
<tool_call>
|
|
603
|
+
<function=${ToolNames.SHELL}>
|
|
604
|
+
<parameter=command>
|
|
605
|
+
npm run test
|
|
606
|
+
</parameter>
|
|
607
|
+
</function>
|
|
608
|
+
</tool_call>
|
|
609
|
+
(After verification passes)
|
|
610
|
+
All checks passed. This is a stable checkpoint.
|
|
611
|
+
</example>
|
|
612
|
+
|
|
613
|
+
<example>
|
|
614
|
+
user: Where are all the 'app.config' files in this project? I need to check their settings.
|
|
615
|
+
model:
|
|
616
|
+
<tool_call>
|
|
617
|
+
<function=${ToolNames.GLOB}>
|
|
618
|
+
<parameter=pattern>
|
|
619
|
+
./**/app.config
|
|
620
|
+
</parameter>
|
|
621
|
+
</function>
|
|
622
|
+
</tool_call>
|
|
623
|
+
(Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
|
|
624
|
+
I found the following 'app.config' files:
|
|
625
|
+
- /path/to/moduleA/app.config
|
|
626
|
+
- /path/to/moduleB/app.config
|
|
627
|
+
To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
|
|
628
|
+
</example>
|
|
629
|
+
`.trim();
|
|
630
|
+
const qwenVlToolCallExamples = `
|
|
631
|
+
# Examples (Illustrating Tone and Workflow)
|
|
632
|
+
<example>
|
|
633
|
+
user: 1 + 2
|
|
634
|
+
model: 3
|
|
635
|
+
</example>
|
|
636
|
+
|
|
637
|
+
<example>
|
|
638
|
+
user: is 13 a prime number?
|
|
639
|
+
model: true
|
|
640
|
+
</example>
|
|
641
|
+
|
|
642
|
+
<example>
|
|
643
|
+
user: start the server implemented in server.js
|
|
644
|
+
model:
|
|
645
|
+
<tool_call>
|
|
646
|
+
{"name": "${ToolNames.SHELL}", "arguments": {"command": "node server.js &"}}
|
|
647
|
+
</tool_call>
|
|
648
|
+
</example>
|
|
649
|
+
|
|
650
|
+
<example>
|
|
651
|
+
user: Refactor the auth logic in src/auth.py to use the requests library instead of urllib.
|
|
652
|
+
model: Okay, I can refactor 'src/auth.py'.
|
|
653
|
+
First, I'll analyze the code and check for a test safety net before planning any changes.
|
|
654
|
+
<tool_call>
|
|
655
|
+
{"name": "${ToolNames.GLOB}", "arguments": {"path": "tests/test_auth.py"}}
|
|
656
|
+
</tool_call>
|
|
657
|
+
<tool_call>
|
|
658
|
+
{"name": "${ToolNames.READ_FILE}", "arguments": {"path": "/path/to/tests/test_auth.py", "offset": 0, "limit": 10}}
|
|
659
|
+
</tool_call>
|
|
660
|
+
(After analysis)
|
|
661
|
+
Great, 'tests/test_auth.py' exists and covers the core authentication logic. With this safety net in place, I can safely plan the refactoring.
|
|
662
|
+
I'll also confirm 'requests' is a dependency.
|
|
663
|
+
<tool_call>
|
|
664
|
+
{"name": "${ToolNames.READ_FILE}", "arguments": {"path": "/path/to/requirements.txt"}}
|
|
665
|
+
</tool_call>
|
|
666
|
+
(After analysis)
|
|
667
|
+
Looks good, 'requests' is available.
|
|
668
|
+
|
|
669
|
+
Here's the plan:
|
|
670
|
+
1. Replace the 'urllib' calls with 'requests'.
|
|
671
|
+
2. Add proper 'try...except' error handling for the new network calls.
|
|
672
|
+
3. Remove the old 'urllib' import.
|
|
673
|
+
4. Run the project's linter and tests to verify the changes.
|
|
674
|
+
|
|
675
|
+
<tool_call>
|
|
676
|
+
{"name": "${ToolNames.EDIT}", "arguments": {"path": "src/auth.py", "old_content": "(old code content)", "new_content": "(new code content)"}}
|
|
677
|
+
</tool_call>
|
|
678
|
+
Refactoring complete. Running verification...
|
|
679
|
+
<tool_call>
|
|
680
|
+
{"name": "${ToolNames.SHELL}", "arguments": {"command": "ruff check src/auth.py && pytest"}}
|
|
681
|
+
</tool_call>
|
|
682
|
+
(After verification passes)
|
|
683
|
+
All checks passed. This is a stable checkpoint.
|
|
684
|
+
Would you like me to write a commit message and commit these changes?
|
|
685
|
+
</example>
|
|
686
|
+
|
|
687
|
+
<example>
|
|
688
|
+
user: Delete the temp directory.
|
|
689
|
+
model: I can run \`rm -rf /path/to/project/temp\`. This will permanently delete the directory and all its contents.
|
|
690
|
+
</example>
|
|
691
|
+
|
|
692
|
+
<example>
|
|
693
|
+
user: Write tests for someFile.ts
|
|
694
|
+
model:
|
|
695
|
+
Okay, I can write those tests. First, I'll read someFile.ts to understand its functionality.
|
|
696
|
+
<tool_call>
|
|
697
|
+
{"name": "${ToolNames.READ_FILE}", "arguments": {"path": "/path/to/someFile.ts"}}
|
|
698
|
+
</tool_call>
|
|
699
|
+
Now I'll look for existing or related test files to understand current testing conventions and dependencies.
|
|
700
|
+
<tool_call>
|
|
701
|
+
{"name": "${ToolNames.READ_MANY_FILES}", "arguments": {"paths": ["**/*.test.ts", "src/**/*.spec.ts"]}}
|
|
702
|
+
</tool_call>
|
|
703
|
+
(After reviewing existing tests and the file content)
|
|
704
|
+
<tool_call>
|
|
705
|
+
{"name": "${ToolNames.WRITE_FILE}", "arguments": {"path": "/path/to/someFile.test.ts"}}
|
|
706
|
+
</tool_call>
|
|
707
|
+
I've written the tests. Now I'll run the project's test command to verify them.
|
|
708
|
+
<tool_call>
|
|
709
|
+
{"name": "${ToolNames.SHELL}", "arguments": {"command": "npm run test"}}
|
|
710
|
+
</tool_call>
|
|
711
|
+
(After verification passes)
|
|
712
|
+
All checks passed. This is a stable checkpoint.
|
|
713
|
+
</example>
|
|
714
|
+
|
|
715
|
+
<example>
|
|
716
|
+
user: Where are all the 'app.config' files in this project? I need to check their settings.
|
|
717
|
+
model:
|
|
718
|
+
<tool_call>
|
|
719
|
+
{"name": "${ToolNames.GLOB}", "arguments": {"pattern": "./**/app.config"}}
|
|
720
|
+
</tool_call>
|
|
721
|
+
(Assuming GlobTool returns a list of paths like ['/path/to/moduleA/app.config', '/path/to/moduleB/app.config'])
|
|
722
|
+
I found the following 'app.config' files:
|
|
723
|
+
- /path/to/moduleA/app.config
|
|
724
|
+
- /path/to/moduleB/app.config
|
|
725
|
+
To help you check their settings, I can read their contents. Which one would you like to start with, or should I read all of them?
|
|
726
|
+
</example>
|
|
727
|
+
`.trim();
|
|
728
|
+
function getToolCallExamples(model) {
|
|
729
|
+
// Check for environment variable override first
|
|
730
|
+
const toolCallStyle = process.env['QWEN_CODE_TOOL_CALL_STYLE'];
|
|
731
|
+
if (toolCallStyle) {
|
|
732
|
+
switch (toolCallStyle.toLowerCase()) {
|
|
733
|
+
case 'qwen-coder':
|
|
734
|
+
return qwenCoderToolCallExamples;
|
|
735
|
+
case 'qwen-vl':
|
|
736
|
+
return qwenVlToolCallExamples;
|
|
737
|
+
case 'general':
|
|
738
|
+
return generalToolCallExamples;
|
|
739
|
+
default:
|
|
740
|
+
console.warn(`Unknown QWEN_CODE_TOOL_CALL_STYLE value: ${toolCallStyle}. Using model-based detection.`);
|
|
741
|
+
break;
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
// Enhanced regex-based model detection
|
|
745
|
+
if (model && model.length < 100) {
|
|
746
|
+
// Match qwen*-coder patterns (e.g., qwen3-coder, qwen2.5-coder, qwen-coder)
|
|
747
|
+
if (/qwen[^-]*-coder/i.test(model)) {
|
|
748
|
+
return qwenCoderToolCallExamples;
|
|
749
|
+
}
|
|
750
|
+
// Match qwen*-vl patterns (e.g., qwen-vl, qwen2-vl, qwen3-vl)
|
|
751
|
+
if (/qwen[^-]*-vl/i.test(model)) {
|
|
752
|
+
return qwenVlToolCallExamples;
|
|
753
|
+
}
|
|
754
|
+
// Match coder-model pattern (same as qwen3-coder)
|
|
755
|
+
if (/coder-model/i.test(model)) {
|
|
756
|
+
return qwenCoderToolCallExamples;
|
|
757
|
+
}
|
|
758
|
+
// Match vision-model pattern (same as qwen3-vl)
|
|
759
|
+
if (/vision-model/i.test(model)) {
|
|
760
|
+
return qwenVlToolCallExamples;
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
return generalToolCallExamples;
|
|
764
|
+
}
|
|
765
|
+
/**
|
|
766
|
+
* Generates a system reminder message about available subagents for the AI assistant.
|
|
767
|
+
*
|
|
768
|
+
* This function creates an internal system message that informs the AI about specialized
|
|
769
|
+
* agents it can delegate tasks to. The reminder encourages proactive use of the TASK tool
|
|
770
|
+
* when user requests match agent capabilities.
|
|
771
|
+
*
|
|
772
|
+
* @param agentTypes - Array of available agent type names (e.g., ['python', 'web', 'analysis'])
|
|
773
|
+
* @returns A formatted system reminder string wrapped in XML tags for internal AI processing
|
|
774
|
+
*
|
|
775
|
+
* @example
|
|
776
|
+
* ```typescript
|
|
777
|
+
* const reminder = getSubagentSystemReminder(['python', 'web']);
|
|
778
|
+
* // Returns: "<system-reminder>You have powerful specialized agents..."
|
|
779
|
+
* ```
|
|
780
|
+
*/
|
|
781
|
+
export function getSubagentSystemReminder(agentTypes) {
|
|
782
|
+
return `<system-reminder>You have powerful specialized agents at your disposal, available agent types are: ${agentTypes.join(', ')}. PROACTIVELY use the ${ToolNames.TASK} tool to delegate user's task to appropriate agent when user's task matches agent capabilities. Ignore this message if user's task is not relevant to any agent. This message is for internal use only. Do not mention this to user in your response.</system-reminder>`;
|
|
783
|
+
}
|
|
784
|
+
/**
|
|
785
|
+
* Generates a system reminder message for plan mode operation.
|
|
786
|
+
*
|
|
787
|
+
* This function creates an internal system message that enforces plan mode constraints,
|
|
788
|
+
* preventing the AI from making any modifications to the system until the user confirms
|
|
789
|
+
* the proposed plan. It overrides other instructions to ensure read-only behavior.
|
|
790
|
+
*
|
|
791
|
+
* @returns A formatted system reminder string that enforces plan mode restrictions
|
|
792
|
+
*
|
|
793
|
+
* @example
|
|
794
|
+
* ```typescript
|
|
795
|
+
* const reminder = getPlanModeSystemReminder();
|
|
796
|
+
* // Returns: "<system-reminder>Plan mode is active..."
|
|
797
|
+
* ```
|
|
798
|
+
*
|
|
799
|
+
* @remarks
|
|
800
|
+
* Plan mode ensures the AI will:
|
|
801
|
+
* - Only perform read-only operations (research, analysis)
|
|
802
|
+
* - Present a comprehensive plan via ExitPlanMode tool
|
|
803
|
+
* - Wait for user confirmation before making any changes
|
|
804
|
+
* - Override any other instructions that would modify system state
|
|
805
|
+
*/
|
|
806
|
+
export function getPlanModeSystemReminder() {
|
|
807
|
+
return `<system-reminder>
|
|
808
|
+
Plan mode is active. The user indicated that they do not want you to execute yet -- you MUST NOT make any edits, run any non-readonly tools (including changing configs or making commits), or otherwise make any changes to the system. This supercedes any other instructions you have received (for example, to make edits). Instead, you should:
|
|
809
|
+
1. Answer the user's query comprehensively
|
|
810
|
+
2. When you're done researching, present your plan by calling the ${ToolNames.EXIT_PLAN_MODE} tool, which will prompt the user to confirm the plan. Do NOT make any file changes or run any tools that modify the system state in any way until the user has confirmed the plan.
|
|
811
|
+
</system-reminder>`;
|
|
812
|
+
}
|
|
813
|
+
//# sourceMappingURL=prompts.js.map
|