@office-ai/aioncli-core 0.2.3 → 0.18.4
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/index.d.ts +16 -3
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/src/agents/codebase-investigator.d.ts +46 -0
- package/dist/src/agents/codebase-investigator.js +132 -0
- package/dist/src/agents/codebase-investigator.js.map +1 -0
- package/dist/src/agents/codebase-investigator.test.js +35 -0
- package/dist/src/agents/codebase-investigator.test.js.map +1 -0
- package/dist/src/agents/executor.d.ts +114 -0
- package/dist/src/agents/executor.js +779 -0
- package/dist/src/agents/executor.js.map +1 -0
- package/dist/src/agents/executor.test.js +1362 -0
- package/dist/src/agents/executor.test.js.map +1 -0
- package/dist/src/agents/invocation.d.ts +46 -0
- package/dist/src/agents/invocation.js +102 -0
- package/dist/src/agents/invocation.js.map +1 -0
- package/dist/src/agents/invocation.test.js +215 -0
- package/dist/src/agents/invocation.test.js.map +1 -0
- package/dist/src/agents/registry.d.ts +40 -0
- package/dist/src/agents/registry.js +105 -0
- package/dist/src/agents/registry.js.map +1 -0
- package/dist/src/agents/registry.test.d.ts +6 -0
- package/dist/src/agents/registry.test.js +160 -0
- package/dist/src/agents/registry.test.js.map +1 -0
- package/dist/src/agents/schema-utils.d.ts +39 -0
- package/dist/src/agents/schema-utils.js +57 -0
- package/dist/src/agents/schema-utils.js.map +1 -0
- package/dist/src/agents/schema-utils.test.d.ts +6 -0
- package/dist/src/agents/schema-utils.test.js +144 -0
- package/dist/src/agents/schema-utils.test.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.d.ts +38 -0
- package/dist/src/agents/subagent-tool-wrapper.js +48 -0
- package/dist/src/agents/subagent-tool-wrapper.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.test.d.ts +6 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js +110 -0
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -0
- package/dist/src/agents/types.d.ts +146 -0
- package/dist/src/agents/types.js +19 -0
- package/dist/src/agents/types.js.map +1 -0
- package/dist/src/agents/utils.d.ts +15 -0
- package/dist/src/agents/utils.js +29 -0
- package/dist/src/agents/utils.js.map +1 -0
- package/dist/src/agents/utils.test.d.ts +6 -0
- package/dist/src/agents/utils.test.js +87 -0
- package/dist/src/agents/utils.test.js.map +1 -0
- package/dist/src/code_assist/codeAssist.d.ts +6 -3
- package/dist/src/code_assist/codeAssist.js +13 -1
- package/dist/src/code_assist/codeAssist.js.map +1 -1
- package/dist/src/code_assist/codeAssist.test.d.ts +6 -0
- package/dist/src/code_assist/codeAssist.test.js +99 -0
- package/dist/src/code_assist/codeAssist.test.js.map +1 -0
- package/dist/src/code_assist/converter.d.ts +5 -1
- package/dist/src/code_assist/converter.js +39 -5
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js +112 -0
- package/dist/src/code_assist/converter.test.js.map +1 -1
- package/dist/src/code_assist/experiments/client_metadata.d.ts +12 -0
- package/dist/src/code_assist/experiments/client_metadata.js +50 -0
- package/dist/src/code_assist/experiments/client_metadata.js.map +1 -0
- package/dist/src/code_assist/experiments/client_metadata.test.d.ts +6 -0
- package/dist/src/code_assist/experiments/client_metadata.test.js +99 -0
- package/dist/src/code_assist/experiments/client_metadata.test.js.map +1 -0
- package/dist/src/code_assist/experiments/experiments.d.ts +17 -0
- package/dist/src/code_assist/experiments/experiments.js +36 -0
- package/dist/src/code_assist/experiments/experiments.js.map +1 -0
- package/dist/src/code_assist/experiments/experiments.test.d.ts +6 -0
- package/dist/src/code_assist/experiments/experiments.test.js +92 -0
- package/dist/src/code_assist/experiments/experiments.test.js.map +1 -0
- package/dist/src/code_assist/experiments/flagNames.d.ts +13 -0
- package/dist/src/code_assist/experiments/flagNames.js +13 -0
- package/dist/src/code_assist/experiments/flagNames.js.map +1 -0
- package/dist/src/code_assist/experiments/types.d.ts +35 -0
- package/dist/src/code_assist/experiments/types.js +7 -0
- package/dist/src/code_assist/experiments/types.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 +110 -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 +198 -0
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -0
- package/dist/src/code_assist/oauth2.d.ts +3 -3
- package/dist/src/code_assist/oauth2.js +252 -125
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +788 -350
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +8 -6
- package/dist/src/code_assist/server.js +41 -10
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +151 -28
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.d.ts +2 -2
- package/dist/src/code_assist/setup.js +5 -3
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/setup.test.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +18 -3
- package/dist/src/code_assist/types.js.map +1 -1
- package/dist/src/commands/extensions.d.ts +7 -0
- package/dist/src/commands/extensions.js +9 -0
- package/dist/src/commands/extensions.js.map +1 -0
- package/dist/src/commands/extensions.test.d.ts +6 -0
- package/dist/src/commands/extensions.test.js +19 -0
- package/dist/src/commands/extensions.test.js.map +1 -0
- package/dist/src/config/config.d.ts +282 -60
- package/dist/src/config/config.js +677 -129
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +1020 -146
- package/dist/src/config/config.test.js.map +1 -1
- 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/defaultModelConfigs.d.ts +7 -0
- package/dist/src/config/defaultModelConfigs.js +185 -0
- package/dist/src/config/defaultModelConfigs.js.map +1 -0
- package/dist/src/config/models.d.ts +37 -0
- package/dist/src/config/models.js +72 -0
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/models.test.d.ts +6 -0
- package/dist/src/config/models.test.js +116 -0
- package/dist/src/config/models.test.js.map +1 -0
- package/dist/src/config/storage.d.ts +36 -0
- package/dist/src/config/storage.js +115 -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 +48 -0
- package/dist/src/config/storage.test.js.map +1 -0
- package/dist/src/confirmation-bus/index.d.ts +7 -0
- package/dist/src/confirmation-bus/index.js +8 -0
- package/dist/src/confirmation-bus/index.js.map +1 -0
- package/dist/src/confirmation-bus/message-bus.d.ts +18 -0
- package/dist/src/confirmation-bus/message-bus.js +87 -0
- package/dist/src/confirmation-bus/message-bus.js.map +1 -0
- package/dist/src/confirmation-bus/message-bus.test.d.ts +6 -0
- package/dist/src/confirmation-bus/message-bus.test.js +170 -0
- package/dist/src/confirmation-bus/message-bus.test.js.map +1 -0
- package/dist/src/confirmation-bus/types.d.ts +49 -0
- package/dist/src/confirmation-bus/types.js +16 -0
- package/dist/src/confirmation-bus/types.js.map +1 -0
- package/dist/src/core/apiKeyCredentialStorage.d.ts +17 -0
- package/dist/src/core/apiKeyCredentialStorage.js +64 -0
- package/dist/src/core/apiKeyCredentialStorage.js.map +1 -0
- package/dist/src/core/apiKeyCredentialStorage.test.d.ts +6 -0
- package/dist/src/core/apiKeyCredentialStorage.test.js +71 -0
- package/dist/src/core/apiKeyCredentialStorage.test.js.map +1 -0
- package/dist/src/core/baseLlmClient.d.ts +50 -0
- package/dist/src/core/baseLlmClient.js +185 -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 +311 -0
- package/dist/src/core/baseLlmClient.test.js.map +1 -0
- package/dist/src/core/client.d.ts +30 -42
- package/dist/src/core/client.js +178 -477
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +739 -617
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +7 -6
- package/dist/src/core/contentGenerator.js +59 -45
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +50 -4
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +28 -11
- package/dist/src/core/coreToolScheduler.js +493 -161
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +995 -163
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/fakeContentGenerator.d.ts +33 -0
- package/dist/src/core/fakeContentGenerator.js +58 -0
- package/dist/src/core/fakeContentGenerator.js.map +1 -0
- package/dist/src/core/fakeContentGenerator.test.d.ts +6 -0
- package/dist/src/core/fakeContentGenerator.test.js +127 -0
- package/dist/src/core/fakeContentGenerator.test.js.map +1 -0
- package/dist/src/core/geminiChat.d.ts +61 -55
- package/dist/src/core/geminiChat.js +388 -366
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +1600 -355
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiRequest.js +1 -0
- package/dist/src/core/geminiRequest.js.map +1 -1
- package/dist/src/core/logger.d.ts +11 -4
- package/dist/src/core/logger.js +39 -30
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/logger.test.js +62 -45
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +4 -3
- package/dist/src/core/loggingContentGenerator.js +116 -37
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.test.d.ts +6 -0
- package/dist/src/core/loggingContentGenerator.test.js +180 -0
- package/dist/src/core/loggingContentGenerator.test.js.map +1 -0
- package/dist/src/core/nonInteractiveToolExecutor.d.ts +4 -5
- package/dist/src/core/nonInteractiveToolExecutor.js +17 -120
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +168 -84
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.d.ts +4 -3
- package/dist/src/core/openaiContentGenerator.js +49 -19
- package/dist/src/core/openaiContentGenerator.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.test.js +1 -0
- package/dist/src/core/openaiContentGenerator.test.js.map +1 -1
- package/dist/src/core/prompts.d.ts +7 -1
- package/dist/src/core/prompts.js +198 -195
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +172 -104
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/recordingContentGenerator.d.ts +18 -0
- package/dist/src/core/recordingContentGenerator.js +77 -0
- package/dist/src/core/recordingContentGenerator.js.map +1 -0
- package/dist/src/core/recordingContentGenerator.test.d.ts +6 -0
- package/dist/src/core/recordingContentGenerator.test.js +101 -0
- package/dist/src/core/recordingContentGenerator.test.js.map +1 -0
- package/dist/src/core/subagent.d.ts +24 -18
- package/dist/src/core/subagent.js +125 -90
- package/dist/src/core/subagent.js.map +1 -1
- package/dist/src/core/subagent.test.js +59 -44
- package/dist/src/core/subagent.test.js.map +1 -1
- package/dist/src/core/tokenLimits.test.d.ts +6 -0
- package/dist/src/core/tokenLimits.test.js +26 -0
- package/dist/src/core/tokenLimits.test.js.map +1 -0
- package/dist/src/core/turn.d.ts +57 -13
- package/dist/src/core/turn.js +79 -35
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +373 -120
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/fallback/handler.d.ts +7 -0
- package/dist/src/fallback/handler.js +181 -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 +245 -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 +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/hooks/hookAggregator.d.ts +68 -0
- package/dist/src/hooks/hookAggregator.js +262 -0
- package/dist/src/hooks/hookAggregator.js.map +1 -0
- package/dist/src/hooks/hookAggregator.test.d.ts +6 -0
- package/dist/src/hooks/hookAggregator.test.js +387 -0
- package/dist/src/hooks/hookAggregator.test.js.map +1 -0
- package/dist/src/hooks/hookPlanner.d.ts +46 -0
- package/dist/src/hooks/hookPlanner.js +108 -0
- package/dist/src/hooks/hookPlanner.js.map +1 -0
- package/dist/src/hooks/hookPlanner.test.d.ts +6 -0
- package/dist/src/hooks/hookPlanner.test.js +255 -0
- package/dist/src/hooks/hookPlanner.test.js.map +1 -0
- package/dist/src/hooks/hookRegistry.d.ts +87 -0
- package/dist/src/hooks/hookRegistry.js +198 -0
- package/dist/src/hooks/hookRegistry.js.map +1 -0
- package/dist/src/hooks/hookRegistry.test.d.ts +6 -0
- package/dist/src/hooks/hookRegistry.test.js +341 -0
- package/dist/src/hooks/hookRegistry.test.js.map +1 -0
- package/dist/src/hooks/hookRunner.d.ts +42 -0
- package/dist/src/hooks/hookRunner.js +272 -0
- package/dist/src/hooks/hookRunner.js.map +1 -0
- package/dist/src/hooks/hookRunner.test.d.ts +6 -0
- package/dist/src/hooks/hookRunner.test.js +468 -0
- package/dist/src/hooks/hookRunner.test.js.map +1 -0
- package/dist/src/hooks/hookTranslator.d.ts +113 -0
- package/dist/src/hooks/hookTranslator.js +232 -0
- package/dist/src/hooks/hookTranslator.js.map +1 -0
- package/dist/src/hooks/hookTranslator.test.d.ts +6 -0
- package/dist/src/hooks/hookTranslator.test.js +192 -0
- package/dist/src/hooks/hookTranslator.test.js.map +1 -0
- package/dist/src/hooks/types.d.ts +384 -0
- package/dist/src/hooks/types.js +284 -0
- package/dist/src/hooks/types.js.map +1 -0
- package/dist/src/hooks/types.test.d.ts +6 -0
- package/dist/src/hooks/types.test.js +313 -0
- package/dist/src/hooks/types.test.js.map +1 -0
- package/dist/src/ide/constants.d.ts +3 -0
- package/dist/src/ide/constants.js +3 -0
- package/dist/src/ide/constants.js.map +1 -1
- package/dist/src/ide/detect-ide.d.ts +52 -12
- package/dist/src/ide/detect-ide.js +51 -65
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +95 -52
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.d.ts +72 -24
- package/dist/src/ide/ide-client.js +380 -84
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +539 -35
- package/dist/src/ide/ide-client.test.js.map +1 -1
- package/dist/src/ide/ide-installer.d.ts +2 -2
- package/dist/src/ide/ide-installer.js +93 -35
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +157 -26
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/ide/ideContext.d.ts +35 -365
- package/dist/src/ide/ideContext.js +60 -106
- package/dist/src/ide/ideContext.js.map +1 -1
- package/dist/src/ide/ideContext.test.js +152 -24
- package/dist/src/ide/ideContext.test.js.map +1 -1
- package/dist/src/ide/process-utils.d.ts +7 -5
- package/dist/src/ide/process-utils.js +108 -67
- package/dist/src/ide/process-utils.js.map +1 -1
- package/dist/src/ide/process-utils.test.d.ts +6 -0
- package/dist/src/ide/process-utils.test.js +151 -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 +41 -2
- package/dist/src/index.js +44 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.d.ts +5 -3
- package/dist/src/mcp/google-auth-provider.js +21 -3
- package/dist/src/mcp/google-auth-provider.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.test.js +42 -9
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-provider.d.ts +25 -18
- package/dist/src/mcp/oauth-provider.js +194 -97
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +581 -39
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.d.ts +14 -32
- package/dist/src/mcp/oauth-token-storage.js +58 -28
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.test.js +262 -162
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +16 -1
- package/dist/src/mcp/oauth-utils.js +68 -33
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +86 -3
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.d.ts +27 -0
- package/dist/src/mcp/sa-impersonation-provider.js +113 -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 +151 -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 +145 -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 +238 -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 +35 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.js +246 -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 +305 -0
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -0
- package/dist/src/mcp/token-storage/types.d.ts +44 -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/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/stream-json-formatter.d.ts +32 -0
- package/dist/src/output/stream-json-formatter.js +52 -0
- package/dist/src/output/stream-json-formatter.js.map +1 -0
- package/dist/src/output/stream-json-formatter.test.d.ts +6 -0
- package/dist/src/output/stream-json-formatter.test.js +479 -0
- package/dist/src/output/stream-json-formatter.test.js.map +1 -0
- package/dist/src/output/types.d.ts +82 -0
- package/dist/src/output/types.js +22 -0
- package/dist/src/output/types.js.map +1 -0
- package/dist/src/policy/config.d.ts +31 -0
- package/dist/src/policy/config.js +199 -0
- package/dist/src/policy/config.js.map +1 -0
- package/dist/src/policy/config.test.d.ts +6 -0
- package/dist/src/policy/config.test.js +538 -0
- package/dist/src/policy/config.test.js.map +1 -0
- package/dist/src/policy/index.d.ts +9 -0
- package/dist/src/policy/index.js +10 -0
- package/dist/src/policy/index.js.map +1 -0
- package/dist/src/policy/policies/discovered.toml +8 -0
- package/dist/src/policy/policies/read-only.toml +56 -0
- package/dist/src/policy/policies/write.toml +73 -0
- package/dist/src/policy/policies/yolo.toml +31 -0
- package/dist/src/policy/policy-engine.d.ts +39 -0
- package/dist/src/policy/policy-engine.js +158 -0
- package/dist/src/policy/policy-engine.js.map +1 -0
- package/dist/src/policy/policy-engine.test.d.ts +6 -0
- package/dist/src/policy/policy-engine.test.js +899 -0
- package/dist/src/policy/policy-engine.test.js.map +1 -0
- package/dist/src/policy/stable-stringify.d.ts +58 -0
- package/dist/src/policy/stable-stringify.js +122 -0
- package/dist/src/policy/stable-stringify.js.map +1 -0
- package/dist/src/policy/toml-loader.d.ts +47 -0
- package/dist/src/policy/toml-loader.js +411 -0
- package/dist/src/policy/toml-loader.js.map +1 -0
- package/dist/src/policy/toml-loader.test.d.ts +6 -0
- package/dist/src/policy/toml-loader.test.js +376 -0
- package/dist/src/policy/toml-loader.test.js.map +1 -0
- package/dist/src/policy/types.d.ts +130 -0
- package/dist/src/policy/types.js +22 -0
- package/dist/src/policy/types.js.map +1 -0
- package/dist/src/prompts/mcp-prompts.d.ts +2 -2
- package/dist/src/prompts/mcp-prompts.test.d.ts +6 -0
- package/dist/src/prompts/mcp-prompts.test.js +39 -0
- package/dist/src/prompts/mcp-prompts.test.js.map +1 -0
- package/dist/src/prompts/prompt-registry.d.ts +1 -1
- package/dist/src/prompts/prompt-registry.js +2 -1
- package/dist/src/prompts/prompt-registry.js.map +1 -1
- package/dist/src/prompts/prompt-registry.test.d.ts +6 -0
- package/dist/src/prompts/prompt-registry.test.js +96 -0
- package/dist/src/prompts/prompt-registry.test.js.map +1 -0
- package/dist/src/routing/modelRouterService.d.ts +23 -0
- package/dist/src/routing/modelRouterService.js +85 -0
- package/dist/src/routing/modelRouterService.js.map +1 -0
- package/dist/src/routing/modelRouterService.test.d.ts +6 -0
- package/dist/src/routing/modelRouterService.test.js +160 -0
- package/dist/src/routing/modelRouterService.test.js.map +1 -0
- package/dist/src/routing/routingStrategy.d.ts +62 -0
- package/dist/src/routing/routingStrategy.js +7 -0
- package/dist/src/routing/routingStrategy.js.map +1 -0
- package/dist/src/routing/strategies/classifierStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/classifierStrategy.js +166 -0
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -0
- package/dist/src/routing/strategies/classifierStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/classifierStrategy.test.js +196 -0
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/compositeStrategy.d.ts +26 -0
- package/dist/src/routing/strategies/compositeStrategy.js +68 -0
- package/dist/src/routing/strategies/compositeStrategy.js.map +1 -0
- package/dist/src/routing/strategies/compositeStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/compositeStrategy.test.js +123 -0
- package/dist/src/routing/strategies/compositeStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/defaultStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/defaultStrategy.js +20 -0
- package/dist/src/routing/strategies/defaultStrategy.js.map +1 -0
- package/dist/src/routing/strategies/defaultStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/defaultStrategy.test.js +26 -0
- package/dist/src/routing/strategies/defaultStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/fallbackStrategy.d.ts +12 -0
- package/dist/src/routing/strategies/fallbackStrategy.js +25 -0
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.js +59 -0
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -0
- package/dist/src/routing/strategies/overrideStrategy.d.ts +15 -0
- package/dist/src/routing/strategies/overrideStrategy.js +28 -0
- package/dist/src/routing/strategies/overrideStrategy.js.map +1 -0
- package/dist/src/routing/strategies/overrideStrategy.test.d.ts +6 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js +45 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -0
- package/dist/src/safety/built-in.d.ts +21 -0
- package/dist/src/safety/built-in.js +106 -0
- package/dist/src/safety/built-in.js.map +1 -0
- package/dist/src/safety/built-in.test.d.ts +6 -0
- package/dist/src/safety/built-in.test.js +199 -0
- package/dist/src/safety/built-in.test.js.map +1 -0
- package/dist/src/safety/checker-runner.d.ts +48 -0
- package/dist/src/safety/checker-runner.js +208 -0
- package/dist/src/safety/checker-runner.js.map +1 -0
- package/dist/src/safety/checker-runner.test.d.ts +6 -0
- package/dist/src/safety/checker-runner.test.js +238 -0
- package/dist/src/safety/checker-runner.test.js.map +1 -0
- package/dist/src/safety/context-builder.d.ts +23 -0
- package/dist/src/safety/context-builder.js +47 -0
- package/dist/src/safety/context-builder.js.map +1 -0
- package/dist/src/safety/context-builder.test.d.ts +6 -0
- package/dist/src/safety/context-builder.test.js +49 -0
- package/dist/src/safety/context-builder.test.js.map +1 -0
- package/dist/src/safety/protocol.d.ts +88 -0
- package/dist/src/safety/protocol.js +15 -0
- package/dist/src/safety/protocol.js.map +1 -0
- package/dist/src/safety/registry.d.ts +26 -0
- package/dist/src/safety/registry.js +65 -0
- package/dist/src/safety/registry.js.map +1 -0
- package/dist/src/safety/registry.test.d.ts +6 -0
- package/dist/src/safety/registry.test.js +31 -0
- package/dist/src/safety/registry.test.js.map +1 -0
- package/dist/src/services/chatCompressionService.d.ts +32 -0
- package/dist/src/services/chatCompressionService.js +162 -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 +210 -0
- package/dist/src/services/chatCompressionService.test.js.map +1 -0
- package/dist/src/services/chatRecordingService.d.ts +10 -15
- package/dist/src/services/chatRecordingService.js +43 -29
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/chatRecordingService.test.js +69 -25
- package/dist/src/services/chatRecordingService.test.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.d.ts +8 -10
- package/dist/src/services/fileDiscoveryService.js +31 -53
- package/dist/src/services/fileDiscoveryService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.test.js +94 -14
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
- package/dist/src/services/fileSystemService.d.ts +9 -0
- package/dist/src/services/fileSystemService.js +12 -1
- package/dist/src/services/fileSystemService.js.map +1 -1
- package/dist/src/services/fileSystemService.test.js +1 -1
- package/dist/src/services/fileSystemService.test.js.map +1 -1
- package/dist/src/services/gitService.d.ts +3 -1
- package/dist/src/services/gitService.js +30 -24
- package/dist/src/services/gitService.js.map +1 -1
- package/dist/src/services/gitService.test.js +30 -37
- package/dist/src/services/gitService.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.d.ts +12 -3
- package/dist/src/services/loopDetectionService.js +148 -55
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +280 -21
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/modelConfig.golden.test.d.ts +6 -0
- package/dist/src/services/modelConfig.golden.test.js +42 -0
- package/dist/src/services/modelConfig.golden.test.js.map +1 -0
- package/dist/src/services/modelConfig.integration.test.d.ts +6 -0
- package/dist/src/services/modelConfig.integration.test.js +247 -0
- package/dist/src/services/modelConfig.integration.test.js.map +1 -0
- package/dist/src/services/modelConfigService.d.ts +48 -0
- package/dist/src/services/modelConfigService.js +151 -0
- package/dist/src/services/modelConfigService.js.map +1 -0
- package/dist/src/services/modelConfigService.test.d.ts +6 -0
- package/dist/src/services/modelConfigService.test.js +531 -0
- package/dist/src/services/modelConfigService.test.js.map +1 -0
- package/dist/src/services/shellExecutionService.d.ts +37 -2
- package/dist/src/services/shellExecutionService.js +361 -67
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +333 -71
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/services/test-data/resolved-aliases.golden.json +202 -0
- package/dist/src/telemetry/activity-detector.d.ts +41 -0
- package/dist/src/telemetry/activity-detector.js +61 -0
- package/dist/src/telemetry/activity-detector.js.map +1 -0
- package/dist/src/telemetry/activity-detector.test.d.ts +6 -0
- package/dist/src/telemetry/activity-detector.test.js +136 -0
- package/dist/src/telemetry/activity-detector.test.js.map +1 -0
- package/dist/src/telemetry/activity-monitor.d.ts +116 -0
- package/dist/src/telemetry/activity-monitor.js +209 -0
- package/dist/src/telemetry/activity-monitor.js.map +1 -0
- package/dist/src/telemetry/activity-monitor.test.d.ts +6 -0
- package/dist/src/telemetry/activity-monitor.test.js +251 -0
- package/dist/src/telemetry/activity-monitor.test.js.map +1 -0
- package/dist/src/telemetry/activity-types.d.ts +19 -0
- package/dist/src/telemetry/activity-types.js +21 -0
- package/dist/src/telemetry/activity-types.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +53 -5
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +581 -56
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.d.ts +2 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +467 -31
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +75 -4
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +182 -6
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- 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 +0 -18
- package/dist/src/telemetry/constants.js +0 -18
- package/dist/src/telemetry/constants.js.map +1 -1
- package/dist/src/telemetry/file-exporters.d.ts +5 -4
- package/dist/src/telemetry/file-exporters.js +1 -1
- package/dist/src/telemetry/file-exporters.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.d.ts +34 -0
- package/dist/src/telemetry/gcp-exporters.js +116 -0
- package/dist/src/telemetry/gcp-exporters.js.map +1 -0
- package/dist/src/telemetry/gcp-exporters.test.d.ts +6 -0
- package/dist/src/telemetry/gcp-exporters.test.js +318 -0
- package/dist/src/telemetry/gcp-exporters.test.js.map +1 -0
- package/dist/src/telemetry/high-water-mark-tracker.d.ts +43 -0
- package/dist/src/telemetry/high-water-mark-tracker.js +88 -0
- package/dist/src/telemetry/high-water-mark-tracker.js.map +1 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.d.ts +6 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.js +152 -0
- package/dist/src/telemetry/high-water-mark-tracker.test.js.map +1 -0
- package/dist/src/telemetry/index.d.ts +16 -2
- package/dist/src/telemetry/index.js +25 -2
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +25 -3
- package/dist/src/telemetry/loggers.js +333 -154
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +3 -4
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +868 -63
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/memory-monitor.d.ts +149 -0
- package/dist/src/telemetry/memory-monitor.js +335 -0
- package/dist/src/telemetry/memory-monitor.js.map +1 -0
- package/dist/src/telemetry/memory-monitor.test.d.ts +6 -0
- package/dist/src/telemetry/memory-monitor.test.js +472 -0
- package/dist/src/telemetry/memory-monitor.test.js.map +1 -0
- package/dist/src/telemetry/metrics.d.ts +498 -11
- package/dist/src/telemetry/metrics.js +729 -84
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +964 -101
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/rate-limiter.d.ts +48 -0
- package/dist/src/telemetry/rate-limiter.js +100 -0
- package/dist/src/telemetry/rate-limiter.js.map +1 -0
- package/dist/src/telemetry/rate-limiter.test.d.ts +6 -0
- package/dist/src/telemetry/rate-limiter.test.js +207 -0
- package/dist/src/telemetry/rate-limiter.test.js.map +1 -0
- package/dist/src/telemetry/sdk.d.ts +1 -1
- package/dist/src/telemetry/sdk.js +23 -4
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/sdk.test.js +108 -0
- package/dist/src/telemetry/sdk.test.js.map +1 -1
- package/dist/src/telemetry/semantic.d.ts +82 -0
- package/dist/src/telemetry/semantic.js +269 -0
- package/dist/src/telemetry/semantic.js.map +1 -0
- package/dist/src/telemetry/semantic.test.d.ts +6 -0
- package/dist/src/telemetry/semantic.test.js +387 -0
- package/dist/src/telemetry/semantic.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 +41 -0
- package/dist/src/telemetry/telemetry-utils.test.js.map +1 -0
- package/dist/src/telemetry/telemetryAttributes.d.ts +8 -0
- package/dist/src/telemetry/telemetryAttributes.js +19 -0
- package/dist/src/telemetry/telemetryAttributes.js.map +1 -0
- package/dist/src/telemetry/trace.d.ts +46 -0
- package/dist/src/telemetry/trace.js +121 -0
- package/dist/src/telemetry/trace.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +351 -25
- package/dist/src/telemetry/types.js +1071 -63
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +4 -4
- package/dist/src/telemetry/uiTelemetry.js +14 -15
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +122 -96
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/config.d.ts +3 -2
- package/dist/src/test-utils/config.js +1 -1
- package/dist/src/test-utils/config.js.map +1 -1
- 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/{tools.js → mock-tool.js} +45 -29
- package/dist/src/test-utils/mock-tool.js.map +1 -0
- package/dist/src/test-utils/mockWorkspaceContext.d.ts +1 -1
- package/dist/src/tools/base-tool-invocation.test.d.ts +6 -0
- package/dist/src/tools/base-tool-invocation.test.js +85 -0
- package/dist/src/tools/base-tool-invocation.test.js.map +1 -0
- package/dist/src/tools/diffOptions.d.ts +1 -1
- package/dist/src/tools/diffOptions.js +21 -13
- package/dist/src/tools/diffOptions.js.map +1 -1
- package/dist/src/tools/diffOptions.test.js +58 -22
- package/dist/src/tools/diffOptions.test.js.map +1 -1
- package/dist/src/tools/edit.d.ts +10 -8
- package/dist/src/tools/edit.js +100 -79
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +429 -163
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.d.ts +11 -5
- package/dist/src/tools/glob.js +58 -42
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +249 -166
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.d.ts +7 -5
- package/dist/src/tools/grep.js +66 -40
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +41 -15
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/ls.d.ts +7 -5
- package/dist/src/tools/ls.js +54 -68
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +150 -293
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +52 -12
- package/dist/src/tools/mcp-client-manager.js +196 -27
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +139 -13
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +28 -24
- package/dist/src/tools/mcp-client.js +338 -351
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +380 -193
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +11 -5
- package/dist/src/tools/mcp-tool.js +66 -17
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +278 -211
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +10 -7
- package/dist/src/tools/memoryTool.js +28 -49
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +26 -13
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/message-bus-integration.test.d.ts +6 -0
- package/dist/src/tools/message-bus-integration.test.js +196 -0
- package/dist/src/tools/message-bus-integration.test.js.map +1 -0
- package/dist/src/tools/modifiable-tool.d.ts +7 -3
- package/dist/src/tools/modifiable-tool.js +41 -19
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.test.js +70 -35
- package/dist/src/tools/modifiable-tool.test.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +9 -7
- package/dist/src/tools/read-file.js +39 -60
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +103 -36
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +9 -14
- package/dist/src/tools/read-many-files.js +71 -155
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +98 -44
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/ripGrep.d.ts +73 -0
- package/dist/src/tools/ripGrep.js +395 -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 +1305 -0
- package/dist/src/tools/ripGrep.test.js.map +1 -0
- package/dist/src/tools/shell.d.ts +19 -6
- package/dist/src/tools/shell.js +92 -56
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +176 -103
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +78 -0
- package/dist/src/tools/smart-edit.js +717 -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 +592 -0
- package/dist/src/tools/smart-edit.test.js.map +1 -0
- package/dist/src/tools/tool-error.d.ts +39 -1
- package/dist/src/tools/tool-error.js +54 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +17 -0
- package/dist/src/tools/tool-names.js +21 -0
- package/dist/src/tools/tool-names.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +38 -20
- package/dist/src/tools/tool-registry.js +134 -77
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +218 -58
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +49 -17
- package/dist/src/tools/tools.js +150 -8
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/tools.test.js +1 -2
- package/dist/src/tools/tools.test.js.map +1 -1
- package/dist/src/tools/web-fetch.d.ts +14 -5
- package/dist/src/tools/web-fetch.js +90 -44
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +388 -20
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.d.ts +8 -6
- package/dist/src/tools/web-search.js +40 -15
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/web-search.test.js +75 -1
- package/dist/src/tools/web-search.test.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +7 -5
- package/dist/src/tools/write-file.js +54 -54
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +237 -146
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +50 -0
- package/dist/src/tools/write-todos.js +193 -0
- package/dist/src/tools/write-todos.js.map +1 -0
- package/dist/src/tools/write-todos.test.d.ts +6 -0
- package/dist/src/tools/write-todos.test.js +89 -0
- package/dist/src/tools/write-todos.test.js.map +1 -0
- package/dist/src/utils/bfsFileSearch.d.ts +2 -2
- package/dist/src/utils/bfsFileSearch.js +16 -9
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.test.js +3 -3
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
- package/dist/src/utils/channel.d.ts +19 -0
- package/dist/src/utils/channel.js +49 -0
- package/dist/src/utils/channel.js.map +1 -0
- package/dist/src/utils/channel.test.d.ts +6 -0
- package/dist/src/utils/channel.test.js +170 -0
- package/dist/src/utils/channel.test.js.map +1 -0
- package/dist/src/utils/debugLogger.d.ts +25 -0
- package/dist/src/utils/debugLogger.js +33 -0
- package/dist/src/utils/debugLogger.js.map +1 -0
- package/dist/src/utils/debugLogger.test.d.ts +6 -0
- package/dist/src/utils/debugLogger.test.js +69 -0
- package/dist/src/utils/debugLogger.test.js.map +1 -0
- package/dist/src/utils/delay.d.ts +16 -0
- package/dist/src/utils/delay.js +43 -0
- package/dist/src/utils/delay.js.map +1 -0
- package/dist/src/utils/delay.test.d.ts +6 -0
- package/dist/src/utils/delay.test.js +88 -0
- package/dist/src/utils/delay.test.js.map +1 -0
- package/dist/src/utils/editCorrector.d.ts +9 -8
- package/dist/src/utils/editCorrector.js +62 -34
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +52 -87
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/editor.d.ts +4 -2
- package/dist/src/utils/editor.js +56 -55
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +47 -88
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +3 -2
- package/dist/src/utils/environmentContext.js +20 -33
- package/dist/src/utils/environmentContext.js.map +1 -1
- package/dist/src/utils/environmentContext.test.js +6 -34
- package/dist/src/utils/environmentContext.test.js.map +1 -1
- package/dist/src/utils/errorParsing.d.ts +1 -1
- package/dist/src/utils/errorParsing.js +5 -33
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +0 -88
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/errorReporting.d.ts +1 -1
- package/dist/src/utils/errors.d.ts +28 -0
- package/dist/src/utils/errors.js +48 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/events.d.ts +121 -0
- package/dist/src/utils/events.js +84 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/events.test.d.ts +6 -0
- package/dist/src/utils/events.test.js +212 -0
- package/dist/src/utils/events.test.js.map +1 -0
- package/dist/src/utils/extensionLoader.d.ts +86 -0
- package/dist/src/utils/extensionLoader.js +208 -0
- package/dist/src/utils/extensionLoader.js.map +1 -0
- package/dist/src/utils/extensionLoader.test.d.ts +6 -0
- package/dist/src/utils/extensionLoader.test.js +154 -0
- package/dist/src/utils/extensionLoader.test.js.map +1 -0
- package/dist/src/utils/fetch.d.ts +1 -0
- package/dist/src/utils/fetch.js +5 -1
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/fileUtils.d.ts +28 -12
- package/dist/src/utils/fileUtils.js +204 -81
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +426 -82
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/filesearch/crawler.d.ts +1 -1
- package/dist/src/utils/filesearch/crawler.test.js +2 -2
- package/dist/src/utils/filesearch/crawler.test.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.d.ts +1 -0
- package/dist/src/utils/filesearch/fileSearch.js +14 -9
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.test.js +90 -0
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -1
- package/dist/src/utils/flashFallback.test.d.ts +6 -0
- package/dist/src/utils/flashFallback.test.js +103 -0
- package/dist/src/utils/flashFallback.test.js.map +1 -0
- package/dist/src/utils/formatters.d.ts +1 -0
- package/dist/src/utils/formatters.js +2 -1
- package/dist/src/utils/formatters.js.map +1 -1
- package/dist/src/utils/formatters.test.d.ts +6 -0
- package/dist/src/utils/formatters.test.js +26 -0
- package/dist/src/utils/formatters.test.js.map +1 -0
- package/dist/src/utils/geminiIgnoreParser.d.ts +18 -0
- package/dist/src/utils/geminiIgnoreParser.js +61 -0
- package/dist/src/utils/geminiIgnoreParser.js.map +1 -0
- package/dist/src/utils/geminiIgnoreParser.test.d.ts +6 -0
- package/dist/src/utils/geminiIgnoreParser.test.js +50 -0
- package/dist/src/utils/geminiIgnoreParser.test.js.map +1 -0
- package/dist/src/utils/generateContentResponseUtilities.d.ts +1 -2
- package/dist/src/utils/generateContentResponseUtilities.js +1 -13
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -1
- package/dist/src/utils/generateContentResponseUtilities.test.js +2 -40
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -1
- package/dist/src/utils/getFolderStructure.d.ts +2 -2
- package/dist/src/utils/getFolderStructure.js +12 -20
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/getFolderStructure.test.js +11 -10
- package/dist/src/utils/getFolderStructure.test.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.d.ts +7 -8
- package/dist/src/utils/gitIgnoreParser.js +145 -36
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.test.js +127 -38
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
- package/dist/src/utils/gitUtils.js +2 -2
- package/dist/src/utils/gitUtils.js.map +1 -1
- package/dist/src/utils/googleErrors.d.ts +104 -0
- package/dist/src/utils/googleErrors.js +152 -0
- package/dist/src/utils/googleErrors.js.map +1 -0
- package/dist/src/utils/googleErrors.test.d.ts +6 -0
- package/dist/src/utils/googleErrors.test.js +301 -0
- package/dist/src/utils/googleErrors.test.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.d.ts +37 -0
- package/dist/src/utils/googleQuotaErrors.js +157 -0
- package/dist/src/utils/googleQuotaErrors.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
- package/dist/src/utils/googleQuotaErrors.test.js +311 -0
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
- package/dist/src/utils/httpErrors.d.ts +18 -0
- package/dist/src/utils/httpErrors.js +36 -0
- package/dist/src/utils/httpErrors.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 +246 -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 +51 -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 +85 -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 +155 -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 +223 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +26 -6
- package/dist/src/utils/memoryDiscovery.js +239 -40
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +365 -44
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +19 -25
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.test.js +24 -155
- package/dist/src/utils/memoryImportProcessor.test.js.map +1 -1
- package/dist/src/utils/messageInspectors.d.ts +1 -1
- package/dist/src/utils/nextSpeakerChecker.d.ts +3 -3
- package/dist/src/utils/nextSpeakerChecker.js +10 -4
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.test.js +85 -66
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -1
- package/dist/src/utils/package.d.ts +12 -0
- package/dist/src/utils/package.js +15 -0
- package/dist/src/utils/package.js.map +1 -0
- package/dist/src/utils/partUtils.d.ts +22 -1
- package/dist/src/utils/partUtils.js +68 -0
- package/dist/src/utils/partUtils.js.map +1 -1
- package/dist/src/utils/partUtils.test.js +112 -1
- package/dist/src/utils/partUtils.test.js.map +1 -1
- package/dist/src/utils/pathCorrector.d.ts +25 -0
- package/dist/src/utils/pathCorrector.js +33 -0
- package/dist/src/utils/pathCorrector.js.map +1 -0
- package/dist/src/utils/pathCorrector.test.d.ts +6 -0
- package/dist/src/utils/pathCorrector.test.js +83 -0
- package/dist/src/utils/pathCorrector.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 +406 -0
- package/dist/src/utils/pathReader.test.js.map +1 -0
- package/dist/src/utils/paths.d.ts +1 -18
- package/dist/src/utils/paths.js +133 -57
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/paths.test.js +200 -68
- package/dist/src/utils/paths.test.js.map +1 -1
- 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 +1 -3
- package/dist/src/utils/quotaErrorDetection.js +0 -46
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.d.ts +5 -10
- package/dist/src/utils/retry.js +114 -197
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +196 -130
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/safeJsonStringify.d.ts +4 -4
- package/dist/src/utils/safeJsonStringify.js +31 -7
- package/dist/src/utils/safeJsonStringify.js.map +1 -1
- package/dist/src/utils/schemaValidator.js +15 -1
- package/dist/src/utils/schemaValidator.js.map +1 -1
- 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/session.js +1 -1
- package/dist/src/utils/session.js.map +1 -1
- package/dist/src/utils/shell-utils.d.ts +21 -3
- package/dist/src/utils/shell-utils.js +427 -159
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +250 -59
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/stdio.d.ts +32 -0
- package/dist/src/utils/stdio.js +85 -0
- package/dist/src/utils/stdio.js.map +1 -0
- package/dist/src/utils/stdio.test.d.ts +6 -0
- package/dist/src/utils/stdio.test.js +47 -0
- package/dist/src/utils/stdio.test.js.map +1 -0
- package/dist/src/utils/summarizer.d.ts +6 -4
- package/dist/src/utils/summarizer.js +8 -9
- package/dist/src/utils/summarizer.js.map +1 -1
- package/dist/src/utils/summarizer.test.js +32 -12
- package/dist/src/utils/summarizer.test.js.map +1 -1
- package/dist/src/utils/systemEncoding.js +7 -6
- package/dist/src/utils/systemEncoding.js.map +1 -1
- package/dist/src/utils/systemEncoding.test.js +4 -3
- package/dist/src/utils/systemEncoding.test.js.map +1 -1
- package/dist/src/utils/terminal.d.ts +14 -0
- package/dist/src/utils/terminal.js +38 -0
- package/dist/src/utils/terminal.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/textUtils.d.ts +5 -0
- package/dist/src/utils/textUtils.js +14 -0
- package/dist/src/utils/textUtils.js.map +1 -1
- 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 +19 -0
- package/dist/src/utils/tool-utils.js +67 -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 +69 -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 +115 -0
- package/dist/src/utils/userAccountManager.js.map +1 -0
- package/dist/src/utils/userAccountManager.test.d.ts +6 -0
- package/dist/src/utils/{user_account.test.js → userAccountManager.test.js} +41 -36
- package/dist/src/utils/userAccountManager.test.js.map +1 -0
- package/dist/src/utils/workspaceContext.d.ts +4 -3
- package/dist/src/utils/workspaceContext.js +23 -17
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/dist/src/utils/workspaceContext.test.js +45 -19
- package/dist/src/utils/workspaceContext.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -10
- package/dist/src/core/modelCheck.d.ts +0 -14
- package/dist/src/core/modelCheck.js +0 -62
- package/dist/src/core/modelCheck.js.map +0 -1
- package/dist/src/test-utils/tools.d.ts +0 -44
- package/dist/src/test-utils/tools.js.map +0 -1
- package/dist/src/utils/flashFallback.integration.test.js +0 -118
- package/dist/src/utils/flashFallback.integration.test.js.map +0 -1
- package/dist/src/utils/user_account.d.ts +0 -9
- package/dist/src/utils/user_account.js +0 -109
- package/dist/src/utils/user_account.js.map +0 -1
- package/dist/src/utils/user_account.test.js.map +0 -1
- package/dist/src/utils/user_id.d.ts +0 -11
- package/dist/src/utils/user_id.js +0 -49
- package/dist/src/utils/user_id.js.map +0 -1
- package/dist/src/utils/user_id.test.js +0 -21
- package/dist/src/utils/user_id.test.js.map +0 -1
- /package/dist/src/{utils/flashFallback.integration.test.d.ts → agents/codebase-investigator.test.d.ts} +0 -0
- /package/dist/src/{utils/user_account.test.d.ts → agents/executor.test.d.ts} +0 -0
- /package/dist/src/{utils/user_id.test.d.ts → agents/invocation.test.d.ts} +0 -0
|
@@ -7,7 +7,12 @@
|
|
|
7
7
|
const mockEnsureCorrectEdit = vi.hoisted(() => vi.fn());
|
|
8
8
|
const mockGenerateJson = vi.hoisted(() => vi.fn());
|
|
9
9
|
const mockOpenDiff = vi.hoisted(() => vi.fn());
|
|
10
|
-
import {
|
|
10
|
+
import { IdeClient } from '../ide/ide-client.js';
|
|
11
|
+
vi.mock('../ide/ide-client.js', () => ({
|
|
12
|
+
IdeClient: {
|
|
13
|
+
getInstance: vi.fn(),
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
11
16
|
vi.mock('../utils/editCorrector.js', () => ({
|
|
12
17
|
ensureCorrectEdit: mockEnsureCorrectEdit,
|
|
13
18
|
}));
|
|
@@ -19,22 +24,26 @@ vi.mock('../core/client.js', () => ({
|
|
|
19
24
|
vi.mock('../utils/editor.js', () => ({
|
|
20
25
|
openDiff: mockOpenDiff,
|
|
21
26
|
}));
|
|
27
|
+
vi.mock('../telemetry/loggers.js', () => ({
|
|
28
|
+
logFileOperation: vi.fn(),
|
|
29
|
+
}));
|
|
22
30
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
23
31
|
import { applyReplacement, EditTool } from './edit.js';
|
|
24
32
|
import { ToolConfirmationOutcome } from './tools.js';
|
|
25
33
|
import { ToolErrorType } from './tool-error.js';
|
|
26
|
-
import path from 'path';
|
|
27
|
-
import fs from 'fs';
|
|
28
|
-
import os from 'os';
|
|
29
|
-
import { ApprovalMode } from '../
|
|
30
|
-
import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js';
|
|
34
|
+
import path from 'node:path';
|
|
35
|
+
import fs from 'node:fs';
|
|
36
|
+
import os from 'node:os';
|
|
37
|
+
import { ApprovalMode } from '../policy/types.js';
|
|
31
38
|
import { StandardFileSystemService } from '../services/fileSystemService.js';
|
|
39
|
+
import { WorkspaceContext } from '../utils/workspaceContext.js';
|
|
32
40
|
describe('EditTool', () => {
|
|
33
41
|
let tool;
|
|
34
42
|
let tempDir;
|
|
35
43
|
let rootDir;
|
|
36
44
|
let mockConfig;
|
|
37
45
|
let geminiClient;
|
|
46
|
+
let baseLlmClient;
|
|
38
47
|
beforeEach(() => {
|
|
39
48
|
vi.restoreAllMocks();
|
|
40
49
|
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'edit-tool-test-'));
|
|
@@ -43,14 +52,17 @@ describe('EditTool', () => {
|
|
|
43
52
|
geminiClient = {
|
|
44
53
|
generateJson: mockGenerateJson, // mockGenerateJson is already defined and hoisted
|
|
45
54
|
};
|
|
55
|
+
baseLlmClient = {
|
|
56
|
+
generateJson: vi.fn(),
|
|
57
|
+
};
|
|
46
58
|
mockConfig = {
|
|
47
59
|
getGeminiClient: vi.fn().mockReturnValue(geminiClient),
|
|
60
|
+
getBaseLlmClient: vi.fn().mockReturnValue(baseLlmClient),
|
|
48
61
|
getTargetDir: () => rootDir,
|
|
49
62
|
getApprovalMode: vi.fn(),
|
|
50
63
|
setApprovalMode: vi.fn(),
|
|
51
|
-
getWorkspaceContext: () =>
|
|
64
|
+
getWorkspaceContext: () => new WorkspaceContext(rootDir),
|
|
52
65
|
getFileSystemService: () => new StandardFileSystemService(),
|
|
53
|
-
getIdeClient: () => undefined,
|
|
54
66
|
getIdeMode: () => false,
|
|
55
67
|
// getGeminiConfig: () => ({ apiKey: 'test-api-key' }), // This was not a real Config method
|
|
56
68
|
// Add other properties/methods of Config if EditTool uses them
|
|
@@ -60,7 +72,6 @@ describe('EditTool', () => {
|
|
|
60
72
|
getSandbox: () => false,
|
|
61
73
|
getDebugMode: () => false,
|
|
62
74
|
getQuestion: () => undefined,
|
|
63
|
-
getFullContext: () => false,
|
|
64
75
|
getToolDiscoveryCommand: () => undefined,
|
|
65
76
|
getToolCallCommand: () => undefined,
|
|
66
77
|
getMcpServerCommand: () => undefined,
|
|
@@ -71,6 +82,7 @@ describe('EditTool', () => {
|
|
|
71
82
|
getGeminiMdFileCount: () => 0,
|
|
72
83
|
setGeminiMdFileCount: vi.fn(),
|
|
73
84
|
getToolRegistry: () => ({}), // Minimal mock for ToolRegistry
|
|
85
|
+
isInteractive: () => false,
|
|
74
86
|
};
|
|
75
87
|
// Reset mocks before each test
|
|
76
88
|
mockConfig.getApprovalMode.mockClear();
|
|
@@ -145,6 +157,81 @@ describe('EditTool', () => {
|
|
|
145
157
|
it('should return currentContent if oldString is empty and not a new file', () => {
|
|
146
158
|
expect(applyReplacement('hello world', '', 'new', false)).toBe('hello world');
|
|
147
159
|
});
|
|
160
|
+
it.each([
|
|
161
|
+
{
|
|
162
|
+
name: '$ literal',
|
|
163
|
+
current: "price is $100 and pattern end is ' '",
|
|
164
|
+
oldStr: 'price is $100',
|
|
165
|
+
newStr: 'price is $200',
|
|
166
|
+
expected: "price is $200 and pattern end is ' '",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
name: "$' literal",
|
|
170
|
+
current: 'foo',
|
|
171
|
+
oldStr: 'foo',
|
|
172
|
+
newStr: "bar$'baz",
|
|
173
|
+
expected: "bar$'baz",
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
name: '$& literal',
|
|
177
|
+
current: 'hello world',
|
|
178
|
+
oldStr: 'hello',
|
|
179
|
+
newStr: '$&-replacement',
|
|
180
|
+
expected: '$&-replacement world',
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
name: '$` literal',
|
|
184
|
+
current: 'prefix-middle-suffix',
|
|
185
|
+
oldStr: 'middle',
|
|
186
|
+
newStr: 'new$`content',
|
|
187
|
+
expected: 'prefix-new$`content-suffix',
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
name: '$1, $2 capture groups literal',
|
|
191
|
+
current: 'test string',
|
|
192
|
+
oldStr: 'test',
|
|
193
|
+
newStr: '$1$2replacement',
|
|
194
|
+
expected: '$1$2replacement string',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
name: 'normal strings without problematic $',
|
|
198
|
+
current: 'normal text replacement',
|
|
199
|
+
oldStr: 'text',
|
|
200
|
+
newStr: 'string',
|
|
201
|
+
expected: 'normal string replacement',
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
name: 'multiple occurrences with $ sequences',
|
|
205
|
+
current: 'foo bar foo baz',
|
|
206
|
+
oldStr: 'foo',
|
|
207
|
+
newStr: "test$'end",
|
|
208
|
+
expected: "test$'end bar test$'end baz",
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
name: 'complex regex patterns with $ at end',
|
|
212
|
+
current: "| select('match', '^[sv]d[a-z]$')",
|
|
213
|
+
oldStr: "'^[sv]d[a-z]$'",
|
|
214
|
+
newStr: "'^[sv]d[a-z]$' # updated",
|
|
215
|
+
expected: "| select('match', '^[sv]d[a-z]$' # updated)",
|
|
216
|
+
},
|
|
217
|
+
{
|
|
218
|
+
name: 'empty replacement with problematic $',
|
|
219
|
+
current: 'test content',
|
|
220
|
+
oldStr: 'nothing',
|
|
221
|
+
newStr: "replacement$'text",
|
|
222
|
+
expected: 'test content',
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: '$$ (escaped dollar)',
|
|
226
|
+
current: 'price value',
|
|
227
|
+
oldStr: 'value',
|
|
228
|
+
newStr: '$$100',
|
|
229
|
+
expected: 'price $$100',
|
|
230
|
+
},
|
|
231
|
+
])('should handle $name', ({ current, oldStr, newStr, expected }) => {
|
|
232
|
+
const result = applyReplacement(current, oldStr, newStr, false);
|
|
233
|
+
expect(result).toBe(expected);
|
|
234
|
+
});
|
|
148
235
|
});
|
|
149
236
|
describe('validateToolParams', () => {
|
|
150
237
|
it('should return null for valid params', () => {
|
|
@@ -155,14 +242,6 @@ describe('EditTool', () => {
|
|
|
155
242
|
};
|
|
156
243
|
expect(tool.validateToolParams(params)).toBeNull();
|
|
157
244
|
});
|
|
158
|
-
it('should return error for relative path', () => {
|
|
159
|
-
const params = {
|
|
160
|
-
file_path: 'test.txt',
|
|
161
|
-
old_string: 'old',
|
|
162
|
-
new_string: 'new',
|
|
163
|
-
};
|
|
164
|
-
expect(tool.validateToolParams(params)).toMatch(/File path must be absolute/);
|
|
165
|
-
});
|
|
166
245
|
it('should return error for path outside root', () => {
|
|
167
246
|
const params = {
|
|
168
247
|
file_path: path.join(tempDir, 'outside-root.txt'),
|
|
@@ -179,13 +258,25 @@ describe('EditTool', () => {
|
|
|
179
258
|
beforeEach(() => {
|
|
180
259
|
filePath = path.join(rootDir, testFile);
|
|
181
260
|
});
|
|
182
|
-
it('should
|
|
261
|
+
it('should resolve relative path and request confirmation', async () => {
|
|
262
|
+
fs.writeFileSync(filePath, 'some old content here');
|
|
183
263
|
const params = {
|
|
184
|
-
file_path:
|
|
264
|
+
file_path: testFile, // relative path
|
|
185
265
|
old_string: 'old',
|
|
186
266
|
new_string: 'new',
|
|
187
267
|
};
|
|
188
|
-
|
|
268
|
+
// ensureCorrectEdit will be called by shouldConfirmExecute
|
|
269
|
+
mockEnsureCorrectEdit.mockResolvedValueOnce({
|
|
270
|
+
params: { ...params, file_path: filePath },
|
|
271
|
+
occurrences: 1,
|
|
272
|
+
});
|
|
273
|
+
const invocation = tool.build(params);
|
|
274
|
+
const confirmation = await invocation.shouldConfirmExecute(new AbortController().signal);
|
|
275
|
+
expect(confirmation).toEqual(expect.objectContaining({
|
|
276
|
+
title: `Confirm Edit: ${testFile}`,
|
|
277
|
+
fileName: testFile,
|
|
278
|
+
fileDiff: expect.any(String),
|
|
279
|
+
}));
|
|
189
280
|
});
|
|
190
281
|
it('should request confirmation for valid edit', async () => {
|
|
191
282
|
fs.writeFileSync(filePath, 'some old content here');
|
|
@@ -264,11 +355,12 @@ describe('EditTool', () => {
|
|
|
264
355
|
// The main beforeEach already calls mockEnsureCorrectEdit.mockReset()
|
|
265
356
|
// Set a specific mock for this test case
|
|
266
357
|
let mockCalled = false;
|
|
267
|
-
mockEnsureCorrectEdit.mockImplementationOnce(async (_, content, p, client) => {
|
|
358
|
+
mockEnsureCorrectEdit.mockImplementationOnce(async (_, content, p, client, baseClient) => {
|
|
268
359
|
mockCalled = true;
|
|
269
360
|
expect(content).toBe(originalContent);
|
|
270
361
|
expect(p).toBe(params);
|
|
271
362
|
expect(client).toBe(geminiClient);
|
|
363
|
+
expect(baseClient).toBe(baseLlmClient);
|
|
272
364
|
return {
|
|
273
365
|
params: {
|
|
274
366
|
file_path: filePath,
|
|
@@ -295,6 +387,27 @@ describe('EditTool', () => {
|
|
|
295
387
|
correctedNewString);
|
|
296
388
|
expect(patchedContent).toBe(expectedFinalContent);
|
|
297
389
|
});
|
|
390
|
+
it('should rethrow calculateEdit errors when the abort signal is triggered', async () => {
|
|
391
|
+
const filePath = path.join(rootDir, 'abort-confirmation.txt');
|
|
392
|
+
const params = {
|
|
393
|
+
file_path: filePath,
|
|
394
|
+
old_string: 'old',
|
|
395
|
+
new_string: 'new',
|
|
396
|
+
};
|
|
397
|
+
const invocation = tool.build(params);
|
|
398
|
+
const abortController = new AbortController();
|
|
399
|
+
const abortError = new Error('Abort requested');
|
|
400
|
+
const calculateSpy = vi
|
|
401
|
+
.spyOn(invocation, 'calculateEdit')
|
|
402
|
+
.mockImplementation(async () => {
|
|
403
|
+
if (!abortController.signal.aborted) {
|
|
404
|
+
abortController.abort();
|
|
405
|
+
}
|
|
406
|
+
throw abortError;
|
|
407
|
+
});
|
|
408
|
+
await expect(invocation.shouldConfirmExecute(abortController.signal)).rejects.toBe(abortError);
|
|
409
|
+
calculateSpy.mockRestore();
|
|
410
|
+
});
|
|
298
411
|
});
|
|
299
412
|
describe('execute', () => {
|
|
300
413
|
const testFile = 'execute_me.txt';
|
|
@@ -317,13 +430,19 @@ describe('EditTool', () => {
|
|
|
317
430
|
return { params, occurrences };
|
|
318
431
|
});
|
|
319
432
|
});
|
|
320
|
-
it('should
|
|
433
|
+
it('should resolve relative path and execute successfully', async () => {
|
|
434
|
+
const initialContent = 'This is some old text.';
|
|
435
|
+
const newContent = 'This is some new text.';
|
|
436
|
+
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
321
437
|
const params = {
|
|
322
|
-
file_path:
|
|
438
|
+
file_path: testFile, // relative path
|
|
323
439
|
old_string: 'old',
|
|
324
440
|
new_string: 'new',
|
|
325
441
|
};
|
|
326
|
-
|
|
442
|
+
const invocation = tool.build(params);
|
|
443
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
444
|
+
expect(result.llmContent).toMatch(/Successfully modified file/);
|
|
445
|
+
expect(fs.readFileSync(filePath, 'utf8')).toBe(newContent);
|
|
327
446
|
});
|
|
328
447
|
it('should throw error if file path is empty', async () => {
|
|
329
448
|
const params = {
|
|
@@ -333,6 +452,26 @@ describe('EditTool', () => {
|
|
|
333
452
|
};
|
|
334
453
|
expect(() => tool.build(params)).toThrow(/The 'file_path' parameter must be non-empty./);
|
|
335
454
|
});
|
|
455
|
+
it('should reject when calculateEdit fails after an abort signal', async () => {
|
|
456
|
+
const params = {
|
|
457
|
+
file_path: path.join(rootDir, 'abort-execute.txt'),
|
|
458
|
+
old_string: 'old',
|
|
459
|
+
new_string: 'new',
|
|
460
|
+
};
|
|
461
|
+
const invocation = tool.build(params);
|
|
462
|
+
const abortController = new AbortController();
|
|
463
|
+
const abortError = new Error('Abort requested during execute');
|
|
464
|
+
const calculateSpy = vi
|
|
465
|
+
.spyOn(invocation, 'calculateEdit')
|
|
466
|
+
.mockImplementation(async () => {
|
|
467
|
+
if (!abortController.signal.aborted) {
|
|
468
|
+
abortController.abort();
|
|
469
|
+
}
|
|
470
|
+
throw abortError;
|
|
471
|
+
});
|
|
472
|
+
await expect(invocation.execute(abortController.signal)).rejects.toBe(abortError);
|
|
473
|
+
calculateSpy.mockRestore();
|
|
474
|
+
});
|
|
336
475
|
it('should edit an existing file and return diff with fileName', async () => {
|
|
337
476
|
const initialContent = 'This is some old text.';
|
|
338
477
|
const newContent = 'This is some new text.'; // old -> new
|
|
@@ -369,7 +508,19 @@ describe('EditTool', () => {
|
|
|
369
508
|
expect(result.llmContent).toMatch(/Created new file/);
|
|
370
509
|
expect(fs.existsSync(newFilePath)).toBe(true);
|
|
371
510
|
expect(fs.readFileSync(newFilePath, 'utf8')).toBe(fileContent);
|
|
372
|
-
|
|
511
|
+
const display = result.returnDisplay;
|
|
512
|
+
expect(display.fileDiff).toMatch(/\+Content for the new file\./);
|
|
513
|
+
expect(display.fileName).toBe(newFileName);
|
|
514
|
+
expect(result.returnDisplay.diffStat).toStrictEqual({
|
|
515
|
+
model_added_lines: 1,
|
|
516
|
+
model_removed_lines: 0,
|
|
517
|
+
model_added_chars: 25,
|
|
518
|
+
model_removed_chars: 0,
|
|
519
|
+
user_added_lines: 0,
|
|
520
|
+
user_removed_lines: 0,
|
|
521
|
+
user_added_chars: 0,
|
|
522
|
+
user_removed_chars: 0,
|
|
523
|
+
});
|
|
373
524
|
});
|
|
374
525
|
it('should return error if old_string is not found in file', async () => {
|
|
375
526
|
fs.writeFileSync(filePath, 'Some content.', 'utf8');
|
|
@@ -398,7 +549,7 @@ describe('EditTool', () => {
|
|
|
398
549
|
expect(result.returnDisplay).toMatch(/Failed to edit, expected 1 occurrence but found 2/);
|
|
399
550
|
});
|
|
400
551
|
it('should successfully replace multiple occurrences when expected_replacements specified', async () => {
|
|
401
|
-
fs.writeFileSync(filePath, 'old text
|
|
552
|
+
fs.writeFileSync(filePath, 'old text\nold text\nold text', 'utf8');
|
|
402
553
|
const params = {
|
|
403
554
|
file_path: filePath,
|
|
404
555
|
old_string: 'old',
|
|
@@ -408,11 +559,21 @@ describe('EditTool', () => {
|
|
|
408
559
|
const invocation = tool.build(params);
|
|
409
560
|
const result = await invocation.execute(new AbortController().signal);
|
|
410
561
|
expect(result.llmContent).toMatch(/Successfully modified file/);
|
|
411
|
-
expect(fs.readFileSync(filePath, 'utf8')).toBe('new text
|
|
562
|
+
expect(fs.readFileSync(filePath, 'utf8')).toBe('new text\nnew text\nnew text');
|
|
412
563
|
const display = result.returnDisplay;
|
|
413
|
-
expect(display.fileDiff).toMatch(
|
|
414
|
-
expect(display.fileDiff).toMatch(
|
|
564
|
+
expect(display.fileDiff).toMatch(/-old text\n-old text\n-old text/);
|
|
565
|
+
expect(display.fileDiff).toMatch(/\+new text\n\+new text\n\+new text/);
|
|
415
566
|
expect(display.fileName).toBe(testFile);
|
|
567
|
+
expect(result.returnDisplay.diffStat).toStrictEqual({
|
|
568
|
+
model_added_lines: 3,
|
|
569
|
+
model_removed_lines: 3,
|
|
570
|
+
model_added_chars: 24,
|
|
571
|
+
model_removed_chars: 24,
|
|
572
|
+
user_added_lines: 0,
|
|
573
|
+
user_removed_lines: 0,
|
|
574
|
+
user_added_chars: 0,
|
|
575
|
+
user_removed_chars: 0,
|
|
576
|
+
});
|
|
416
577
|
});
|
|
417
578
|
it('should return error if expected_replacements does not match actual occurrences', async () => {
|
|
418
579
|
fs.writeFileSync(filePath, 'old text old text', 'utf8');
|
|
@@ -440,40 +601,49 @@ describe('EditTool', () => {
|
|
|
440
601
|
expect(result.returnDisplay).toMatch(/Attempted to create a file that already exists/);
|
|
441
602
|
});
|
|
442
603
|
it('should include modification message when proposed content is modified', async () => {
|
|
443
|
-
const initialContent = '
|
|
604
|
+
const initialContent = 'Line 1\nold line\nLine 3\nLine 4\nLine 5\n';
|
|
444
605
|
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
445
606
|
const params = {
|
|
446
607
|
file_path: filePath,
|
|
447
608
|
old_string: 'old',
|
|
448
609
|
new_string: 'new',
|
|
449
610
|
modified_by_user: true,
|
|
611
|
+
ai_proposed_content: 'Line 1\nAI line\nLine 3\nLine 4\nLine 5\n',
|
|
450
612
|
};
|
|
451
613
|
mockConfig.getApprovalMode.mockReturnValueOnce(ApprovalMode.AUTO_EDIT);
|
|
452
614
|
const invocation = tool.build(params);
|
|
453
615
|
const result = await invocation.execute(new AbortController().signal);
|
|
454
616
|
expect(result.llmContent).toMatch(/User modified the `new_string` content/);
|
|
617
|
+
expect(result.returnDisplay.diffStat).toStrictEqual({
|
|
618
|
+
model_added_lines: 1,
|
|
619
|
+
model_removed_lines: 1,
|
|
620
|
+
model_added_chars: 7,
|
|
621
|
+
model_removed_chars: 8,
|
|
622
|
+
user_added_lines: 1,
|
|
623
|
+
user_removed_lines: 1,
|
|
624
|
+
user_added_chars: 8,
|
|
625
|
+
user_removed_chars: 7,
|
|
626
|
+
});
|
|
455
627
|
});
|
|
456
|
-
it(
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
const invocation = tool.build(params);
|
|
467
|
-
const result = await invocation.execute(new AbortController().signal);
|
|
468
|
-
expect(result.llmContent).not.toMatch(/User modified the `new_string` content/);
|
|
469
|
-
});
|
|
470
|
-
it('should not include modification message when modified_by_user is not provided', async () => {
|
|
628
|
+
it.each([
|
|
629
|
+
{
|
|
630
|
+
name: 'modified_by_user is false',
|
|
631
|
+
modifiedByUser: false,
|
|
632
|
+
},
|
|
633
|
+
{
|
|
634
|
+
name: 'modified_by_user is not provided',
|
|
635
|
+
modifiedByUser: undefined,
|
|
636
|
+
},
|
|
637
|
+
])('should not include modification message when $name', async ({ modifiedByUser }) => {
|
|
471
638
|
const initialContent = 'This is some old text.';
|
|
472
639
|
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
473
640
|
const params = {
|
|
474
641
|
file_path: filePath,
|
|
475
642
|
old_string: 'old',
|
|
476
643
|
new_string: 'new',
|
|
644
|
+
...(modifiedByUser !== undefined && {
|
|
645
|
+
modified_by_user: modifiedByUser,
|
|
646
|
+
}),
|
|
477
647
|
};
|
|
478
648
|
mockConfig.getApprovalMode.mockReturnValueOnce(ApprovalMode.AUTO_EDIT);
|
|
479
649
|
const invocation = tool.build(params);
|
|
@@ -493,133 +663,154 @@ describe('EditTool', () => {
|
|
|
493
663
|
expect(result.llmContent).toMatch(/No changes to apply/);
|
|
494
664
|
expect(result.returnDisplay).toMatch(/No changes to apply/);
|
|
495
665
|
});
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
filePath = path.join(rootDir, testFile);
|
|
502
|
-
});
|
|
503
|
-
it('should return FILE_NOT_FOUND error', async () => {
|
|
504
|
-
const params = {
|
|
505
|
-
file_path: filePath,
|
|
506
|
-
old_string: 'any',
|
|
507
|
-
new_string: 'new',
|
|
508
|
-
};
|
|
509
|
-
const invocation = tool.build(params);
|
|
510
|
-
const result = await invocation.execute(new AbortController().signal);
|
|
511
|
-
expect(result.error?.type).toBe(ToolErrorType.FILE_NOT_FOUND);
|
|
512
|
-
});
|
|
513
|
-
it('should return ATTEMPT_TO_CREATE_EXISTING_FILE error', async () => {
|
|
514
|
-
fs.writeFileSync(filePath, 'existing content', 'utf8');
|
|
515
|
-
const params = {
|
|
516
|
-
file_path: filePath,
|
|
517
|
-
old_string: '',
|
|
518
|
-
new_string: 'new content',
|
|
519
|
-
};
|
|
520
|
-
const invocation = tool.build(params);
|
|
521
|
-
const result = await invocation.execute(new AbortController().signal);
|
|
522
|
-
expect(result.error?.type).toBe(ToolErrorType.ATTEMPT_TO_CREATE_EXISTING_FILE);
|
|
523
|
-
});
|
|
524
|
-
it('should return NO_OCCURRENCE_FOUND error', async () => {
|
|
525
|
-
fs.writeFileSync(filePath, 'content', 'utf8');
|
|
526
|
-
const params = {
|
|
527
|
-
file_path: filePath,
|
|
528
|
-
old_string: 'not-found',
|
|
529
|
-
new_string: 'new',
|
|
530
|
-
};
|
|
531
|
-
const invocation = tool.build(params);
|
|
532
|
-
const result = await invocation.execute(new AbortController().signal);
|
|
533
|
-
expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_OCCURRENCE_FOUND);
|
|
534
|
-
});
|
|
535
|
-
it('should return EXPECTED_OCCURRENCE_MISMATCH error', async () => {
|
|
536
|
-
fs.writeFileSync(filePath, 'one one two', 'utf8');
|
|
537
|
-
const params = {
|
|
538
|
-
file_path: filePath,
|
|
539
|
-
old_string: 'one',
|
|
540
|
-
new_string: 'new',
|
|
541
|
-
expected_replacements: 3,
|
|
542
|
-
};
|
|
543
|
-
const invocation = tool.build(params);
|
|
544
|
-
const result = await invocation.execute(new AbortController().signal);
|
|
545
|
-
expect(result.error?.type).toBe(ToolErrorType.EDIT_EXPECTED_OCCURRENCE_MISMATCH);
|
|
546
|
-
});
|
|
547
|
-
it('should return NO_CHANGE error', async () => {
|
|
548
|
-
fs.writeFileSync(filePath, 'content', 'utf8');
|
|
666
|
+
it('should return EDIT_NO_CHANGE error if replacement results in identical content', async () => {
|
|
667
|
+
// This can happen if ensureCorrectEdit finds a fuzzy match, but the literal
|
|
668
|
+
// string replacement with `replaceAll` results in no change.
|
|
669
|
+
const initialContent = 'line 1\nline 2\nline 3'; // Note the double space
|
|
670
|
+
fs.writeFileSync(filePath, initialContent, 'utf8');
|
|
549
671
|
const params = {
|
|
550
672
|
file_path: filePath,
|
|
551
|
-
old_string
|
|
552
|
-
|
|
673
|
+
// old_string has a single space, so it won't be found by replaceAll
|
|
674
|
+
old_string: 'line 1\nline 2\nline 3',
|
|
675
|
+
new_string: 'line 1\nnew line 2\nline 3',
|
|
553
676
|
};
|
|
677
|
+
// Mock ensureCorrectEdit to simulate it finding a match (e.g., via fuzzy matching)
|
|
678
|
+
// but it doesn't correct the old_string to the literal content.
|
|
679
|
+
mockEnsureCorrectEdit.mockResolvedValueOnce({ params, occurrences: 1 });
|
|
554
680
|
const invocation = tool.build(params);
|
|
555
681
|
const result = await invocation.execute(new AbortController().signal);
|
|
556
682
|
expect(result.error?.type).toBe(ToolErrorType.EDIT_NO_CHANGE);
|
|
683
|
+
expect(result.returnDisplay).toMatch(/No changes to apply. The new content is identical to the current content./);
|
|
684
|
+
// Ensure the file was not actually changed
|
|
685
|
+
expect(fs.readFileSync(filePath, 'utf8')).toBe(initialContent);
|
|
557
686
|
});
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
expect(() => tool.build(params)).toThrow();
|
|
687
|
+
});
|
|
688
|
+
describe('Error Scenarios', () => {
|
|
689
|
+
const testFile = 'error_test.txt';
|
|
690
|
+
let filePath;
|
|
691
|
+
beforeEach(() => {
|
|
692
|
+
filePath = path.join(rootDir, testFile);
|
|
565
693
|
});
|
|
566
|
-
it(
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
694
|
+
it.each([
|
|
695
|
+
{
|
|
696
|
+
name: 'FILE_NOT_FOUND error',
|
|
697
|
+
setup: () => { },
|
|
698
|
+
params: { file_path: '', old_string: 'any', new_string: 'new' },
|
|
699
|
+
expectedError: ToolErrorType.FILE_NOT_FOUND,
|
|
700
|
+
isAsyncTest: true,
|
|
701
|
+
},
|
|
702
|
+
{
|
|
703
|
+
name: 'ATTEMPT_TO_CREATE_EXISTING_FILE error',
|
|
704
|
+
setup: (fp) => fs.writeFileSync(fp, 'existing content', 'utf8'),
|
|
705
|
+
params: { file_path: '', old_string: '', new_string: 'new content' },
|
|
706
|
+
expectedError: ToolErrorType.ATTEMPT_TO_CREATE_EXISTING_FILE,
|
|
707
|
+
isAsyncTest: true,
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
name: 'NO_OCCURRENCE_FOUND error',
|
|
711
|
+
setup: (fp) => fs.writeFileSync(fp, 'content', 'utf8'),
|
|
712
|
+
params: { file_path: '', old_string: 'not-found', new_string: 'new' },
|
|
713
|
+
expectedError: ToolErrorType.EDIT_NO_OCCURRENCE_FOUND,
|
|
714
|
+
isAsyncTest: true,
|
|
715
|
+
},
|
|
716
|
+
{
|
|
717
|
+
name: 'EXPECTED_OCCURRENCE_MISMATCH error',
|
|
718
|
+
setup: (fp) => fs.writeFileSync(fp, 'one one two', 'utf8'),
|
|
719
|
+
params: {
|
|
720
|
+
file_path: '',
|
|
721
|
+
old_string: 'one',
|
|
722
|
+
new_string: 'new',
|
|
723
|
+
expected_replacements: 3,
|
|
724
|
+
},
|
|
725
|
+
expectedError: ToolErrorType.EDIT_EXPECTED_OCCURRENCE_MISMATCH,
|
|
726
|
+
isAsyncTest: true,
|
|
727
|
+
},
|
|
728
|
+
{
|
|
729
|
+
name: 'NO_CHANGE error',
|
|
730
|
+
setup: (fp) => fs.writeFileSync(fp, 'content', 'utf8'),
|
|
731
|
+
params: { file_path: '', old_string: 'content', new_string: 'content' },
|
|
732
|
+
expectedError: ToolErrorType.EDIT_NO_CHANGE,
|
|
733
|
+
isAsyncTest: true,
|
|
734
|
+
},
|
|
735
|
+
{
|
|
736
|
+
name: 'relative path (should not throw)',
|
|
737
|
+
setup: () => { },
|
|
738
|
+
params: {
|
|
739
|
+
file_path: 'relative/path.txt',
|
|
740
|
+
old_string: 'a',
|
|
741
|
+
new_string: 'b',
|
|
742
|
+
},
|
|
743
|
+
expectedError: null,
|
|
744
|
+
isAsyncTest: false,
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
name: 'FILE_WRITE_FAILURE on write error',
|
|
748
|
+
setup: (fp) => {
|
|
749
|
+
fs.writeFileSync(fp, 'content', 'utf8');
|
|
750
|
+
fs.chmodSync(fp, '444');
|
|
751
|
+
},
|
|
752
|
+
params: {
|
|
753
|
+
file_path: '',
|
|
754
|
+
old_string: 'content',
|
|
755
|
+
new_string: 'new content',
|
|
756
|
+
},
|
|
757
|
+
expectedError: ToolErrorType.FILE_WRITE_FAILURE,
|
|
758
|
+
isAsyncTest: true,
|
|
759
|
+
},
|
|
760
|
+
])('should return $name', async ({ setup, params, expectedError, isAsyncTest }) => {
|
|
761
|
+
const testParams = {
|
|
762
|
+
...params,
|
|
763
|
+
file_path: params.file_path || filePath,
|
|
764
|
+
};
|
|
765
|
+
setup(filePath);
|
|
766
|
+
if (!isAsyncTest) {
|
|
767
|
+
expect(() => tool.build(testParams)).not.toThrow();
|
|
768
|
+
}
|
|
769
|
+
else {
|
|
770
|
+
const invocation = tool.build(testParams);
|
|
771
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
772
|
+
expect(result.error?.type).toBe(expectedError);
|
|
773
|
+
}
|
|
578
774
|
});
|
|
579
775
|
});
|
|
580
776
|
describe('getDescription', () => {
|
|
581
|
-
it(
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
777
|
+
it.each([
|
|
778
|
+
{
|
|
779
|
+
name: 'identical strings (no change)',
|
|
780
|
+
fileName: 'test.txt',
|
|
781
|
+
oldStr: 'identical_string',
|
|
782
|
+
newStr: 'identical_string',
|
|
783
|
+
expected: 'No file changes to test.txt',
|
|
784
|
+
},
|
|
785
|
+
{
|
|
786
|
+
name: 'different strings (full)',
|
|
787
|
+
fileName: 'test.txt',
|
|
788
|
+
oldStr: 'this is the old string value',
|
|
789
|
+
newStr: 'this is the new string value',
|
|
790
|
+
expected: 'test.txt: this is the old string value => this is the new string value',
|
|
791
|
+
},
|
|
792
|
+
{
|
|
793
|
+
name: 'very short strings',
|
|
794
|
+
fileName: 'short.txt',
|
|
795
|
+
oldStr: 'old',
|
|
796
|
+
newStr: 'new',
|
|
797
|
+
expected: 'short.txt: old => new',
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
name: 'long strings (truncated)',
|
|
801
|
+
fileName: 'long.txt',
|
|
802
|
+
oldStr: 'this is a very long old string that will definitely be truncated',
|
|
803
|
+
newStr: 'this is a very long new string that will also be truncated',
|
|
804
|
+
expected: 'long.txt: this is a very long old string... => this is a very long new string...',
|
|
805
|
+
},
|
|
806
|
+
])('should handle $name', ({ fileName, oldStr, newStr, expected }) => {
|
|
807
|
+
const params = {
|
|
808
|
+
file_path: path.join(rootDir, fileName),
|
|
809
|
+
old_string: oldStr,
|
|
810
|
+
new_string: newStr,
|
|
610
811
|
};
|
|
611
812
|
const invocation = tool.build(params);
|
|
612
|
-
expect(invocation.getDescription()).toBe(
|
|
613
|
-
});
|
|
614
|
-
it('should truncate long strings in the description', () => {
|
|
615
|
-
const testFileName = 'long.txt';
|
|
616
|
-
const params = {
|
|
617
|
-
file_path: path.join(rootDir, testFileName),
|
|
618
|
-
old_string: 'this is a very long old string that will definitely be truncated',
|
|
619
|
-
new_string: 'this is a very long new string that will also be truncated',
|
|
620
|
-
};
|
|
621
|
-
const invocation = tool.build(params);
|
|
622
|
-
expect(invocation.getDescription()).toBe(`${testFileName}: this is a very long old string... => this is a very long new string...`);
|
|
813
|
+
expect(invocation.getDescription()).toBe(expected);
|
|
623
814
|
});
|
|
624
815
|
});
|
|
625
816
|
describe('workspace boundary validation', () => {
|
|
@@ -642,6 +833,25 @@ describe('EditTool', () => {
|
|
|
642
833
|
expect(error).toContain(rootDir);
|
|
643
834
|
});
|
|
644
835
|
});
|
|
836
|
+
describe('constructor', () => {
|
|
837
|
+
afterEach(() => {
|
|
838
|
+
vi.restoreAllMocks();
|
|
839
|
+
});
|
|
840
|
+
it('should use windows-style path examples on windows', () => {
|
|
841
|
+
vi.spyOn(process, 'platform', 'get').mockReturnValue('win32');
|
|
842
|
+
const tool = new EditTool({});
|
|
843
|
+
const schema = tool.schema;
|
|
844
|
+
expect(schema.parametersJsonSchema.properties
|
|
845
|
+
.file_path.description).toBe('The path to the file to modify.');
|
|
846
|
+
});
|
|
847
|
+
it('should use unix-style path examples on non-windows platforms', () => {
|
|
848
|
+
vi.spyOn(process, 'platform', 'get').mockReturnValue('linux');
|
|
849
|
+
const tool = new EditTool({});
|
|
850
|
+
const schema = tool.schema;
|
|
851
|
+
expect(schema.parametersJsonSchema.properties
|
|
852
|
+
.file_path.description).toBe('The path to the file to modify.');
|
|
853
|
+
});
|
|
854
|
+
});
|
|
645
855
|
describe('IDE mode', () => {
|
|
646
856
|
const testFile = 'edit_me.txt';
|
|
647
857
|
let filePath;
|
|
@@ -650,12 +860,10 @@ describe('EditTool', () => {
|
|
|
650
860
|
filePath = path.join(rootDir, testFile);
|
|
651
861
|
ideClient = {
|
|
652
862
|
openDiff: vi.fn(),
|
|
653
|
-
|
|
654
|
-
status: IDEConnectionStatus.Connected,
|
|
655
|
-
}),
|
|
863
|
+
isDiffingEnabled: vi.fn().mockReturnValue(true),
|
|
656
864
|
};
|
|
865
|
+
vi.mocked(IdeClient.getInstance).mockResolvedValue(ideClient);
|
|
657
866
|
mockConfig.getIdeMode = () => true;
|
|
658
|
-
mockConfig.getIdeClient = () => ideClient;
|
|
659
867
|
});
|
|
660
868
|
it('should call ideClient.openDiff and update params on confirmation', async () => {
|
|
661
869
|
const initialContent = 'some old content here';
|
|
@@ -685,5 +893,63 @@ describe('EditTool', () => {
|
|
|
685
893
|
expect(params.new_string).toBe(modifiedContent);
|
|
686
894
|
});
|
|
687
895
|
});
|
|
896
|
+
describe('multiple file edits', () => {
|
|
897
|
+
it('should perform multiple removals and report correct diff stats', async () => {
|
|
898
|
+
const numFiles = 10;
|
|
899
|
+
const files = [];
|
|
900
|
+
const expectedLinesRemoved = [];
|
|
901
|
+
const actualLinesRemoved = [];
|
|
902
|
+
// 1. Create 10 files with 5-10 lines each
|
|
903
|
+
for (let i = 0; i < numFiles; i++) {
|
|
904
|
+
const fileName = `test-file-${i}.txt`;
|
|
905
|
+
const filePath = path.join(rootDir, fileName);
|
|
906
|
+
const numLines = Math.floor(Math.random() * 6) + 5; // 5 to 10 lines
|
|
907
|
+
const lines = Array.from({ length: numLines }, (_, j) => `File ${i}, Line ${j + 1}`);
|
|
908
|
+
const content = lines.join('\n') + '\n';
|
|
909
|
+
// Determine which lines to remove (2 or 3 lines)
|
|
910
|
+
const numLinesToRemove = Math.floor(Math.random() * 2) + 2; // 2 or 3
|
|
911
|
+
expectedLinesRemoved.push(numLinesToRemove);
|
|
912
|
+
const startLineToRemove = 1; // Start removing from the second line
|
|
913
|
+
const linesToRemove = lines.slice(startLineToRemove, startLineToRemove + numLinesToRemove);
|
|
914
|
+
const toRemove = linesToRemove.join('\n') + '\n';
|
|
915
|
+
fs.writeFileSync(filePath, content, 'utf8');
|
|
916
|
+
files.push({
|
|
917
|
+
path: filePath,
|
|
918
|
+
initialContent: content,
|
|
919
|
+
toRemove,
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
// 2. Create and execute 10 tool calls for removal
|
|
923
|
+
for (const file of files) {
|
|
924
|
+
const params = {
|
|
925
|
+
file_path: file.path,
|
|
926
|
+
old_string: file.toRemove,
|
|
927
|
+
new_string: '', // Removing the content
|
|
928
|
+
};
|
|
929
|
+
const invocation = tool.build(params);
|
|
930
|
+
const result = await invocation.execute(new AbortController().signal);
|
|
931
|
+
if (result.returnDisplay &&
|
|
932
|
+
typeof result.returnDisplay === 'object' &&
|
|
933
|
+
'diffStat' in result.returnDisplay &&
|
|
934
|
+
result.returnDisplay.diffStat) {
|
|
935
|
+
actualLinesRemoved.push(result.returnDisplay.diffStat?.model_removed_lines);
|
|
936
|
+
}
|
|
937
|
+
else if (result.error) {
|
|
938
|
+
console.error(`Edit failed for ${file.path}:`, result.error);
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
// 3. Assert that the content was removed from each file
|
|
942
|
+
for (const file of files) {
|
|
943
|
+
const finalContent = fs.readFileSync(file.path, 'utf8');
|
|
944
|
+
const expectedContent = file.initialContent.replace(file.toRemove, '');
|
|
945
|
+
expect(finalContent).toBe(expectedContent);
|
|
946
|
+
expect(finalContent).not.toContain(file.toRemove);
|
|
947
|
+
}
|
|
948
|
+
// 4. Assert that the total number of removed lines matches the diffStat total
|
|
949
|
+
const totalExpectedRemoved = expectedLinesRemoved.reduce((sum, current) => sum + current, 0);
|
|
950
|
+
const totalActualRemoved = actualLinesRemoved.reduce((sum, current) => sum + current, 0);
|
|
951
|
+
expect(totalActualRemoved).toBe(totalExpectedRemoved);
|
|
952
|
+
});
|
|
953
|
+
});
|
|
688
954
|
});
|
|
689
955
|
//# sourceMappingURL=edit.test.js.map
|