@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
|
@@ -4,27 +4,40 @@
|
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
6
|
import { describe, it, expect, beforeEach, afterEach, vi, } from 'vitest';
|
|
7
|
-
import { getCorrectedFileContent, WriteFileTool
|
|
7
|
+
import { getCorrectedFileContent, WriteFileTool } from './write-file.js';
|
|
8
8
|
import { ToolErrorType } from './tool-error.js';
|
|
9
|
-
import { ToolConfirmationOutcome
|
|
10
|
-
import {
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
9
|
+
import { ToolConfirmationOutcome } from './tools.js';
|
|
10
|
+
import {} from './edit.js';
|
|
11
|
+
import { ApprovalMode } from '../policy/types.js';
|
|
12
|
+
import path from 'node:path';
|
|
13
|
+
import fs from 'node:fs';
|
|
14
|
+
import os from 'node:os';
|
|
14
15
|
import { GeminiClient } from '../core/client.js';
|
|
15
16
|
import { ensureCorrectEdit, ensureCorrectFileContent, } from '../utils/editCorrector.js';
|
|
16
|
-
import { createMockWorkspaceContext } from '../test-utils/mockWorkspaceContext.js';
|
|
17
17
|
import { StandardFileSystemService } from '../services/fileSystemService.js';
|
|
18
|
+
import { IdeClient } from '../ide/ide-client.js';
|
|
19
|
+
import { WorkspaceContext } from '../utils/workspaceContext.js';
|
|
18
20
|
const rootDir = path.resolve(os.tmpdir(), 'gemini-cli-test-root');
|
|
19
21
|
// --- MOCKS ---
|
|
20
22
|
vi.mock('../core/client.js');
|
|
21
23
|
vi.mock('../utils/editCorrector.js');
|
|
24
|
+
vi.mock('../ide/ide-client.js', () => ({
|
|
25
|
+
IdeClient: {
|
|
26
|
+
getInstance: vi.fn(),
|
|
27
|
+
},
|
|
28
|
+
}));
|
|
22
29
|
let mockGeminiClientInstance;
|
|
30
|
+
let mockBaseLlmClientInstance;
|
|
23
31
|
const mockEnsureCorrectEdit = vi.fn();
|
|
24
32
|
const mockEnsureCorrectFileContent = vi.fn();
|
|
33
|
+
const mockIdeClient = {
|
|
34
|
+
openDiff: vi.fn(),
|
|
35
|
+
isDiffingEnabled: vi.fn(),
|
|
36
|
+
};
|
|
25
37
|
// Wire up the mocked functions to be used by the actual module imports
|
|
26
38
|
vi.mocked(ensureCorrectEdit).mockImplementation(mockEnsureCorrectEdit);
|
|
27
39
|
vi.mocked(ensureCorrectFileContent).mockImplementation(mockEnsureCorrectFileContent);
|
|
40
|
+
vi.mocked(IdeClient.getInstance).mockResolvedValue(mockIdeClient);
|
|
28
41
|
// Mock Config
|
|
29
42
|
const fsService = new StandardFileSystemService();
|
|
30
43
|
const mockConfigInternal = {
|
|
@@ -32,16 +45,15 @@ const mockConfigInternal = {
|
|
|
32
45
|
getApprovalMode: vi.fn(() => ApprovalMode.DEFAULT),
|
|
33
46
|
setApprovalMode: vi.fn(),
|
|
34
47
|
getGeminiClient: vi.fn(), // Initialize as a plain mock function
|
|
48
|
+
getBaseLlmClient: vi.fn(), // Initialize as a plain mock function
|
|
35
49
|
getFileSystemService: () => fsService,
|
|
36
|
-
getIdeClient: vi.fn(),
|
|
37
50
|
getIdeMode: vi.fn(() => false),
|
|
38
|
-
getWorkspaceContext: () =>
|
|
51
|
+
getWorkspaceContext: () => new WorkspaceContext(rootDir),
|
|
39
52
|
getApiKey: () => 'test-key',
|
|
40
53
|
getModel: () => 'test-model',
|
|
41
54
|
getSandbox: () => false,
|
|
42
55
|
getDebugMode: () => false,
|
|
43
56
|
getQuestion: () => undefined,
|
|
44
|
-
getFullContext: () => false,
|
|
45
57
|
getToolDiscoveryCommand: () => undefined,
|
|
46
58
|
getToolCallCommand: () => undefined,
|
|
47
59
|
getMcpServerCommand: () => undefined,
|
|
@@ -55,8 +67,12 @@ const mockConfigInternal = {
|
|
|
55
67
|
registerTool: vi.fn(),
|
|
56
68
|
discoverTools: vi.fn(),
|
|
57
69
|
}),
|
|
70
|
+
isInteractive: () => false,
|
|
58
71
|
};
|
|
59
72
|
const mockConfig = mockConfigInternal;
|
|
73
|
+
vi.mock('../telemetry/loggers.js', () => ({
|
|
74
|
+
logFileOperation: vi.fn(),
|
|
75
|
+
}));
|
|
60
76
|
// --- END MOCKS ---
|
|
61
77
|
describe('WriteFileTool', () => {
|
|
62
78
|
let tool;
|
|
@@ -72,18 +88,15 @@ describe('WriteFileTool', () => {
|
|
|
72
88
|
// Setup GeminiClient mock
|
|
73
89
|
mockGeminiClientInstance = new (vi.mocked(GeminiClient))(mockConfig);
|
|
74
90
|
vi.mocked(GeminiClient).mockImplementation(() => mockGeminiClientInstance);
|
|
91
|
+
// Setup BaseLlmClient mock
|
|
92
|
+
mockBaseLlmClientInstance = {
|
|
93
|
+
generateJson: vi.fn(),
|
|
94
|
+
};
|
|
75
95
|
vi.mocked(ensureCorrectEdit).mockImplementation(mockEnsureCorrectEdit);
|
|
76
96
|
vi.mocked(ensureCorrectFileContent).mockImplementation(mockEnsureCorrectFileContent);
|
|
77
|
-
// Now that
|
|
97
|
+
// Now that mock instances are initialized, set the mock implementations for config getters
|
|
78
98
|
mockConfigInternal.getGeminiClient.mockReturnValue(mockGeminiClientInstance);
|
|
79
|
-
mockConfigInternal.
|
|
80
|
-
openDiff: vi.fn(),
|
|
81
|
-
closeDiff: vi.fn(),
|
|
82
|
-
getIdeContext: vi.fn(),
|
|
83
|
-
subscribeToIdeContext: vi.fn(),
|
|
84
|
-
isCodeTrackerEnabled: vi.fn(),
|
|
85
|
-
getTrackedCode: vi.fn(),
|
|
86
|
-
});
|
|
99
|
+
mockConfigInternal.getBaseLlmClient.mockReturnValue(mockBaseLlmClientInstance);
|
|
87
100
|
tool = new WriteFileTool(mockConfig);
|
|
88
101
|
// Reset mocks before each test
|
|
89
102
|
mockConfigInternal.getApprovalMode.mockReturnValue(ApprovalMode.DEFAULT);
|
|
@@ -91,7 +104,7 @@ describe('WriteFileTool', () => {
|
|
|
91
104
|
mockEnsureCorrectEdit.mockReset();
|
|
92
105
|
mockEnsureCorrectFileContent.mockReset();
|
|
93
106
|
// Default mock implementations that return valid structures
|
|
94
|
-
mockEnsureCorrectEdit.mockImplementation(async (filePath, _currentContent, params, _client, signal) => {
|
|
107
|
+
mockEnsureCorrectEdit.mockImplementation(async (filePath, _currentContent, params, _client, _baseClient, signal) => {
|
|
95
108
|
if (signal?.aborted) {
|
|
96
109
|
return Promise.reject(new Error('Aborted'));
|
|
97
110
|
}
|
|
@@ -100,8 +113,7 @@ describe('WriteFileTool', () => {
|
|
|
100
113
|
occurrences: 1,
|
|
101
114
|
});
|
|
102
115
|
});
|
|
103
|
-
mockEnsureCorrectFileContent.mockImplementation(async (content,
|
|
104
|
-
// Make AbortSignal optional
|
|
116
|
+
mockEnsureCorrectFileContent.mockImplementation(async (content, _baseClient, signal) => {
|
|
105
117
|
if (signal?.aborted) {
|
|
106
118
|
return Promise.reject(new Error('Aborted'));
|
|
107
119
|
}
|
|
@@ -128,9 +140,14 @@ describe('WriteFileTool', () => {
|
|
|
128
140
|
expect(invocation).toBeDefined();
|
|
129
141
|
expect(invocation.params).toEqual(params);
|
|
130
142
|
});
|
|
131
|
-
it('should
|
|
132
|
-
const params = {
|
|
133
|
-
|
|
143
|
+
it('should return an invocation for a valid relative path within root', () => {
|
|
144
|
+
const params = {
|
|
145
|
+
file_path: 'test.txt',
|
|
146
|
+
content: 'hello',
|
|
147
|
+
};
|
|
148
|
+
const invocation = tool.build(params);
|
|
149
|
+
expect(invocation).toBeDefined();
|
|
150
|
+
expect(invocation.params).toEqual(params);
|
|
134
151
|
});
|
|
135
152
|
it('should throw an error for a path outside root', () => {
|
|
136
153
|
const outsidePath = path.resolve(tempDir, 'outside-root.txt');
|
|
@@ -177,7 +194,7 @@ describe('WriteFileTool', () => {
|
|
|
177
194
|
// Ensure the mock is set for this specific test case if needed, or rely on beforeEach
|
|
178
195
|
mockEnsureCorrectFileContent.mockResolvedValue(correctedContent);
|
|
179
196
|
const result = await getCorrectedFileContent(mockConfig, filePath, proposedContent, abortSignal);
|
|
180
|
-
expect(mockEnsureCorrectFileContent).toHaveBeenCalledWith(proposedContent,
|
|
197
|
+
expect(mockEnsureCorrectFileContent).toHaveBeenCalledWith(proposedContent, mockBaseLlmClientInstance, abortSignal);
|
|
181
198
|
expect(mockEnsureCorrectEdit).not.toHaveBeenCalled();
|
|
182
199
|
expect(result.correctedContent).toBe(correctedContent);
|
|
183
200
|
expect(result.originalContent).toBe('');
|
|
@@ -205,7 +222,7 @@ describe('WriteFileTool', () => {
|
|
|
205
222
|
old_string: originalContent,
|
|
206
223
|
new_string: proposedContent,
|
|
207
224
|
file_path: filePath,
|
|
208
|
-
}, mockGeminiClientInstance, abortSignal);
|
|
225
|
+
}, mockGeminiClientInstance, mockBaseLlmClientInstance, abortSignal);
|
|
209
226
|
expect(mockEnsureCorrectFileContent).not.toHaveBeenCalled();
|
|
210
227
|
expect(result.correctedContent).toBe(correctedProposedContent);
|
|
211
228
|
expect(result.originalContent).toBe(originalContent);
|
|
@@ -254,7 +271,7 @@ describe('WriteFileTool', () => {
|
|
|
254
271
|
const params = { file_path: filePath, content: proposedContent };
|
|
255
272
|
const invocation = tool.build(params);
|
|
256
273
|
const confirmation = (await invocation.shouldConfirmExecute(abortSignal));
|
|
257
|
-
expect(mockEnsureCorrectFileContent).toHaveBeenCalledWith(proposedContent,
|
|
274
|
+
expect(mockEnsureCorrectFileContent).toHaveBeenCalledWith(proposedContent, mockBaseLlmClientInstance, abortSignal);
|
|
258
275
|
expect(confirmation).toEqual(expect.objectContaining({
|
|
259
276
|
title: `Confirm Write: ${path.basename(filePath)}`,
|
|
260
277
|
fileName: 'confirm_new_file.txt',
|
|
@@ -284,7 +301,7 @@ describe('WriteFileTool', () => {
|
|
|
284
301
|
old_string: originalContent,
|
|
285
302
|
new_string: proposedContent,
|
|
286
303
|
file_path: filePath,
|
|
287
|
-
}, mockGeminiClientInstance, abortSignal);
|
|
304
|
+
}, mockGeminiClientInstance, mockBaseLlmClientInstance, abortSignal);
|
|
288
305
|
expect(confirmation).toEqual(expect.objectContaining({
|
|
289
306
|
title: `Confirm Write: ${path.basename(filePath)}`,
|
|
290
307
|
fileName: 'confirm_existing_file.txt',
|
|
@@ -292,9 +309,103 @@ describe('WriteFileTool', () => {
|
|
|
292
309
|
}));
|
|
293
310
|
expect(confirmation.fileDiff).toMatch(originalContent.replace(/[.*+?^${}()|[\\]\\]/g, '\\$&'));
|
|
294
311
|
});
|
|
312
|
+
describe('with IDE integration', () => {
|
|
313
|
+
beforeEach(() => {
|
|
314
|
+
// Enable IDE mode and set connection status for these tests
|
|
315
|
+
mockConfigInternal.getIdeMode.mockReturnValue(true);
|
|
316
|
+
mockIdeClient.isDiffingEnabled.mockReturnValue(true);
|
|
317
|
+
mockIdeClient.openDiff.mockResolvedValue({
|
|
318
|
+
status: 'accepted',
|
|
319
|
+
content: 'ide-modified-content',
|
|
320
|
+
});
|
|
321
|
+
});
|
|
322
|
+
it('should call openDiff and await it when in IDE mode and connected', async () => {
|
|
323
|
+
const filePath = path.join(rootDir, 'ide_confirm_file.txt');
|
|
324
|
+
const params = { file_path: filePath, content: 'test' };
|
|
325
|
+
const invocation = tool.build(params);
|
|
326
|
+
const confirmation = (await invocation.shouldConfirmExecute(abortSignal));
|
|
327
|
+
expect(mockIdeClient.openDiff).toHaveBeenCalledWith(filePath, 'test');
|
|
328
|
+
// Ensure the promise is awaited by checking the result
|
|
329
|
+
expect(confirmation.ideConfirmation).toBeDefined();
|
|
330
|
+
await confirmation.ideConfirmation; // Should resolve
|
|
331
|
+
});
|
|
332
|
+
it('should not call openDiff if not in IDE mode', async () => {
|
|
333
|
+
mockConfigInternal.getIdeMode.mockReturnValue(false);
|
|
334
|
+
const filePath = path.join(rootDir, 'ide_disabled_file.txt');
|
|
335
|
+
const params = { file_path: filePath, content: 'test' };
|
|
336
|
+
const invocation = tool.build(params);
|
|
337
|
+
await invocation.shouldConfirmExecute(abortSignal);
|
|
338
|
+
expect(mockIdeClient.openDiff).not.toHaveBeenCalled();
|
|
339
|
+
});
|
|
340
|
+
it('should not call openDiff if IDE is not connected', async () => {
|
|
341
|
+
mockIdeClient.isDiffingEnabled.mockReturnValue(false);
|
|
342
|
+
const filePath = path.join(rootDir, 'ide_disconnected_file.txt');
|
|
343
|
+
const params = { file_path: filePath, content: 'test' };
|
|
344
|
+
const invocation = tool.build(params);
|
|
345
|
+
await invocation.shouldConfirmExecute(abortSignal);
|
|
346
|
+
expect(mockIdeClient.openDiff).not.toHaveBeenCalled();
|
|
347
|
+
});
|
|
348
|
+
it('should update params.content with IDE content when onConfirm is called', async () => {
|
|
349
|
+
const filePath = path.join(rootDir, 'ide_onconfirm_file.txt');
|
|
350
|
+
const params = { file_path: filePath, content: 'original-content' };
|
|
351
|
+
const invocation = tool.build(params);
|
|
352
|
+
// This is the key part: get the confirmation details
|
|
353
|
+
const confirmation = (await invocation.shouldConfirmExecute(abortSignal));
|
|
354
|
+
// The `onConfirm` function should exist on the details object
|
|
355
|
+
expect(confirmation.onConfirm).toBeDefined();
|
|
356
|
+
// Call `onConfirm` to trigger the logic that updates the content
|
|
357
|
+
await confirmation.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
358
|
+
// Now, check if the original `params` object (captured by the invocation) was modified
|
|
359
|
+
expect(invocation.params.content).toBe('ide-modified-content');
|
|
360
|
+
});
|
|
361
|
+
it('should not await ideConfirmation promise', async () => {
|
|
362
|
+
const IDE_DIFF_DELAY_MS = 50;
|
|
363
|
+
const filePath = path.join(rootDir, 'ide_no_await_file.txt');
|
|
364
|
+
const params = { file_path: filePath, content: 'test' };
|
|
365
|
+
const invocation = tool.build(params);
|
|
366
|
+
let diffPromiseResolved = false;
|
|
367
|
+
const diffPromise = new Promise((resolve) => {
|
|
368
|
+
setTimeout(() => {
|
|
369
|
+
diffPromiseResolved = true;
|
|
370
|
+
resolve({ status: 'accepted', content: 'ide-modified-content' });
|
|
371
|
+
}, IDE_DIFF_DELAY_MS);
|
|
372
|
+
});
|
|
373
|
+
mockIdeClient.openDiff.mockReturnValue(diffPromise);
|
|
374
|
+
const confirmation = (await invocation.shouldConfirmExecute(abortSignal));
|
|
375
|
+
// This is the key check: the confirmation details should be returned
|
|
376
|
+
// *before* the diffPromise is resolved.
|
|
377
|
+
expect(diffPromiseResolved).toBe(false);
|
|
378
|
+
expect(confirmation).toBeDefined();
|
|
379
|
+
expect(confirmation.ideConfirmation).toBe(diffPromise);
|
|
380
|
+
// Now, we can await the promise to let the test finish cleanly.
|
|
381
|
+
await diffPromise;
|
|
382
|
+
expect(diffPromiseResolved).toBe(true);
|
|
383
|
+
});
|
|
384
|
+
});
|
|
295
385
|
});
|
|
296
386
|
describe('execute', () => {
|
|
297
387
|
const abortSignal = new AbortController().signal;
|
|
388
|
+
async function confirmExecution(invocation, signal = abortSignal) {
|
|
389
|
+
const confirmDetails = await invocation.shouldConfirmExecute(signal);
|
|
390
|
+
if (typeof confirmDetails === 'object' &&
|
|
391
|
+
'onConfirm' in confirmDetails &&
|
|
392
|
+
confirmDetails.onConfirm) {
|
|
393
|
+
await confirmDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
it('should write a new file with a relative path', async () => {
|
|
397
|
+
const relativePath = 'execute_relative_new_file.txt';
|
|
398
|
+
const filePath = path.join(rootDir, relativePath);
|
|
399
|
+
const content = 'Content for relative path file.';
|
|
400
|
+
mockEnsureCorrectFileContent.mockResolvedValue(content);
|
|
401
|
+
const params = { file_path: relativePath, content };
|
|
402
|
+
const invocation = tool.build(params);
|
|
403
|
+
const result = await invocation.execute(abortSignal);
|
|
404
|
+
expect(result.llmContent).toMatch(/Successfully created and wrote to new file/);
|
|
405
|
+
expect(fs.existsSync(filePath)).toBe(true);
|
|
406
|
+
const writtenContent = await fsService.readTextFile(filePath);
|
|
407
|
+
expect(writtenContent).toBe(content);
|
|
408
|
+
});
|
|
298
409
|
it('should return error if _getCorrectedFileContent returns an error during execute', async () => {
|
|
299
410
|
const filePath = path.join(rootDir, 'execute_error_file.txt');
|
|
300
411
|
const params = { file_path: filePath, content: 'test content' };
|
|
@@ -320,14 +431,9 @@ describe('WriteFileTool', () => {
|
|
|
320
431
|
mockEnsureCorrectFileContent.mockResolvedValue(correctedContent);
|
|
321
432
|
const params = { file_path: filePath, content: proposedContent };
|
|
322
433
|
const invocation = tool.build(params);
|
|
323
|
-
|
|
324
|
-
if (typeof confirmDetails === 'object' &&
|
|
325
|
-
'onConfirm' in confirmDetails &&
|
|
326
|
-
confirmDetails.onConfirm) {
|
|
327
|
-
await confirmDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
328
|
-
}
|
|
434
|
+
await confirmExecution(invocation);
|
|
329
435
|
const result = await invocation.execute(abortSignal);
|
|
330
|
-
expect(mockEnsureCorrectFileContent).toHaveBeenCalledWith(proposedContent,
|
|
436
|
+
expect(mockEnsureCorrectFileContent).toHaveBeenCalledWith(proposedContent, mockBaseLlmClientInstance, abortSignal);
|
|
331
437
|
expect(result.llmContent).toMatch(/Successfully created and wrote to new file/);
|
|
332
438
|
expect(fs.existsSync(filePath)).toBe(true);
|
|
333
439
|
const writtenContent = await fsService.readTextFile(filePath);
|
|
@@ -354,18 +460,13 @@ describe('WriteFileTool', () => {
|
|
|
354
460
|
});
|
|
355
461
|
const params = { file_path: filePath, content: proposedContent };
|
|
356
462
|
const invocation = tool.build(params);
|
|
357
|
-
|
|
358
|
-
if (typeof confirmDetails === 'object' &&
|
|
359
|
-
'onConfirm' in confirmDetails &&
|
|
360
|
-
confirmDetails.onConfirm) {
|
|
361
|
-
await confirmDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
362
|
-
}
|
|
463
|
+
await confirmExecution(invocation);
|
|
363
464
|
const result = await invocation.execute(abortSignal);
|
|
364
465
|
expect(mockEnsureCorrectEdit).toHaveBeenCalledWith(filePath, initialContent, {
|
|
365
466
|
old_string: initialContent,
|
|
366
467
|
new_string: proposedContent,
|
|
367
468
|
file_path: filePath,
|
|
368
|
-
}, mockGeminiClientInstance, abortSignal);
|
|
469
|
+
}, mockGeminiClientInstance, mockBaseLlmClientInstance, abortSignal);
|
|
369
470
|
expect(result.llmContent).toMatch(/Successfully overwrote file/);
|
|
370
471
|
const writtenContent = await fsService.readTextFile(filePath);
|
|
371
472
|
expect(writtenContent).toBe(correctedProposedContent);
|
|
@@ -381,56 +482,46 @@ describe('WriteFileTool', () => {
|
|
|
381
482
|
mockEnsureCorrectFileContent.mockResolvedValue(content); // Ensure this mock is active
|
|
382
483
|
const params = { file_path: filePath, content };
|
|
383
484
|
const invocation = tool.build(params);
|
|
384
|
-
|
|
385
|
-
const confirmDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
386
|
-
if (typeof confirmDetails === 'object' &&
|
|
387
|
-
'onConfirm' in confirmDetails &&
|
|
388
|
-
confirmDetails.onConfirm) {
|
|
389
|
-
await confirmDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
390
|
-
}
|
|
485
|
+
await confirmExecution(invocation);
|
|
391
486
|
await invocation.execute(abortSignal);
|
|
392
487
|
expect(fs.existsSync(dirPath)).toBe(true);
|
|
393
488
|
expect(fs.statSync(dirPath).isDirectory()).toBe(true);
|
|
394
489
|
expect(fs.existsSync(filePath)).toBe(true);
|
|
395
490
|
expect(fs.readFileSync(filePath, 'utf8')).toBe(content);
|
|
396
491
|
});
|
|
397
|
-
it(
|
|
398
|
-
|
|
399
|
-
const content = 'New file content modified by user';
|
|
400
|
-
mockEnsureCorrectFileContent.mockResolvedValue(content);
|
|
401
|
-
const params = {
|
|
402
|
-
file_path: filePath,
|
|
403
|
-
content,
|
|
492
|
+
it.each([
|
|
493
|
+
{
|
|
404
494
|
modified_by_user: true,
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
});
|
|
410
|
-
it('should not include modification message when proposed content is not modified', async () => {
|
|
411
|
-
const filePath = path.join(rootDir, 'new_file_unmodified.txt');
|
|
412
|
-
const content = 'New file content not modified';
|
|
413
|
-
mockEnsureCorrectFileContent.mockResolvedValue(content);
|
|
414
|
-
const params = {
|
|
415
|
-
file_path: filePath,
|
|
416
|
-
content,
|
|
495
|
+
shouldIncludeMessage: true,
|
|
496
|
+
testCase: 'when modified_by_user is true',
|
|
497
|
+
},
|
|
498
|
+
{
|
|
417
499
|
modified_by_user: false,
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
500
|
+
shouldIncludeMessage: false,
|
|
501
|
+
testCase: 'when modified_by_user is false',
|
|
502
|
+
},
|
|
503
|
+
{
|
|
504
|
+
modified_by_user: undefined,
|
|
505
|
+
shouldIncludeMessage: false,
|
|
506
|
+
testCase: 'when modified_by_user is not provided',
|
|
507
|
+
},
|
|
508
|
+
])('should $testCase include modification message', async ({ modified_by_user, shouldIncludeMessage }) => {
|
|
509
|
+
const filePath = path.join(rootDir, `new_file_${modified_by_user}.txt`);
|
|
510
|
+
const content = 'New file content';
|
|
426
511
|
mockEnsureCorrectFileContent.mockResolvedValue(content);
|
|
427
512
|
const params = {
|
|
428
513
|
file_path: filePath,
|
|
429
514
|
content,
|
|
515
|
+
...(modified_by_user !== undefined && { modified_by_user }),
|
|
430
516
|
};
|
|
431
517
|
const invocation = tool.build(params);
|
|
432
518
|
const result = await invocation.execute(abortSignal);
|
|
433
|
-
|
|
519
|
+
if (shouldIncludeMessage) {
|
|
520
|
+
expect(result.llmContent).toMatch(/User modified the `content`/);
|
|
521
|
+
}
|
|
522
|
+
else {
|
|
523
|
+
expect(result.llmContent).not.toMatch(/User modified the `content`/);
|
|
524
|
+
}
|
|
434
525
|
});
|
|
435
526
|
});
|
|
436
527
|
describe('workspace boundary validation', () => {
|
|
@@ -451,76 +542,76 @@ describe('WriteFileTool', () => {
|
|
|
451
542
|
});
|
|
452
543
|
describe('specific error types for write failures', () => {
|
|
453
544
|
const abortSignal = new AbortController().signal;
|
|
454
|
-
it(
|
|
455
|
-
|
|
545
|
+
it.each([
|
|
546
|
+
{
|
|
547
|
+
errorCode: 'EACCES',
|
|
548
|
+
errorType: ToolErrorType.PERMISSION_DENIED,
|
|
549
|
+
errorMessage: 'Permission denied',
|
|
550
|
+
expectedMessagePrefix: 'Permission denied writing to file',
|
|
551
|
+
mockFsExistsSync: false,
|
|
552
|
+
restoreAllMocks: false,
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
errorCode: 'ENOSPC',
|
|
556
|
+
errorType: ToolErrorType.NO_SPACE_LEFT,
|
|
557
|
+
errorMessage: 'No space left on device',
|
|
558
|
+
expectedMessagePrefix: 'No space left on device',
|
|
559
|
+
mockFsExistsSync: false,
|
|
560
|
+
restoreAllMocks: false,
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
errorCode: 'EISDIR',
|
|
564
|
+
errorType: ToolErrorType.TARGET_IS_DIRECTORY,
|
|
565
|
+
errorMessage: 'Is a directory',
|
|
566
|
+
expectedMessagePrefix: 'Target is a directory, not a file',
|
|
567
|
+
mockFsExistsSync: true,
|
|
568
|
+
restoreAllMocks: false,
|
|
569
|
+
},
|
|
570
|
+
{
|
|
571
|
+
errorCode: undefined,
|
|
572
|
+
errorType: ToolErrorType.FILE_WRITE_FAILURE,
|
|
573
|
+
errorMessage: 'Generic write error',
|
|
574
|
+
expectedMessagePrefix: 'Error writing to file',
|
|
575
|
+
mockFsExistsSync: false,
|
|
576
|
+
restoreAllMocks: true,
|
|
577
|
+
},
|
|
578
|
+
])('should return $errorType error when write fails with $errorCode', async ({ errorCode, errorType, errorMessage, expectedMessagePrefix, mockFsExistsSync, restoreAllMocks, }) => {
|
|
579
|
+
const filePath = path.join(rootDir, `${errorType}_file.txt`);
|
|
456
580
|
const content = 'test content';
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
expect(result.returnDisplay).toContain(`Permission denied writing to file: ${filePath} (EACCES)`);
|
|
469
|
-
});
|
|
470
|
-
it('should return NO_SPACE_LEFT error when write fails with ENOSPC', async () => {
|
|
471
|
-
const filePath = path.join(rootDir, 'no_space_file.txt');
|
|
472
|
-
const content = 'test content';
|
|
473
|
-
// Mock FileSystemService writeTextFile to throw ENOSPC error
|
|
474
|
-
vi.spyOn(fsService, 'writeTextFile').mockImplementationOnce(() => {
|
|
475
|
-
const error = new Error('No space left on device');
|
|
476
|
-
error.code = 'ENOSPC';
|
|
477
|
-
return Promise.reject(error);
|
|
478
|
-
});
|
|
479
|
-
const params = { file_path: filePath, content };
|
|
480
|
-
const invocation = tool.build(params);
|
|
481
|
-
const result = await invocation.execute(abortSignal);
|
|
482
|
-
expect(result.error?.type).toBe(ToolErrorType.NO_SPACE_LEFT);
|
|
483
|
-
expect(result.llmContent).toContain(`No space left on device: ${filePath} (ENOSPC)`);
|
|
484
|
-
expect(result.returnDisplay).toContain(`No space left on device: ${filePath} (ENOSPC)`);
|
|
485
|
-
});
|
|
486
|
-
it('should return TARGET_IS_DIRECTORY error when write fails with EISDIR', async () => {
|
|
487
|
-
const dirPath = path.join(rootDir, 'test_directory');
|
|
488
|
-
const content = 'test content';
|
|
489
|
-
// Mock fs.existsSync to return false to bypass validation
|
|
490
|
-
const originalExistsSync = fs.existsSync;
|
|
491
|
-
vi.spyOn(fs, 'existsSync').mockImplementation((path) => {
|
|
492
|
-
if (path === dirPath) {
|
|
493
|
-
return false; // Pretend directory doesn't exist to bypass validation
|
|
581
|
+
if (restoreAllMocks) {
|
|
582
|
+
vi.restoreAllMocks();
|
|
583
|
+
}
|
|
584
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
585
|
+
let existsSyncSpy;
|
|
586
|
+
try {
|
|
587
|
+
if (mockFsExistsSync) {
|
|
588
|
+
const originalExistsSync = fs.existsSync;
|
|
589
|
+
existsSyncSpy = vi
|
|
590
|
+
.spyOn(fs, 'existsSync')
|
|
591
|
+
.mockImplementation((path) => path === filePath ? false : originalExistsSync(path));
|
|
494
592
|
}
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
vi.spyOn(fsService, 'writeTextFile').mockImplementationOnce(() => Promise.reject(new Error('Generic write error')));
|
|
518
|
-
const params = { file_path: filePath, content };
|
|
519
|
-
const invocation = tool.build(params);
|
|
520
|
-
const result = await invocation.execute(abortSignal);
|
|
521
|
-
expect(result.error?.type).toBe(ToolErrorType.FILE_WRITE_FAILURE);
|
|
522
|
-
expect(result.llmContent).toContain('Error writing to file: Generic write error');
|
|
523
|
-
expect(result.returnDisplay).toContain('Error writing to file: Generic write error');
|
|
593
|
+
vi.spyOn(fsService, 'writeTextFile').mockImplementationOnce(() => {
|
|
594
|
+
const error = new Error(errorMessage);
|
|
595
|
+
if (errorCode)
|
|
596
|
+
error.code = errorCode;
|
|
597
|
+
return Promise.reject(error);
|
|
598
|
+
});
|
|
599
|
+
const params = { file_path: filePath, content };
|
|
600
|
+
const invocation = tool.build(params);
|
|
601
|
+
const result = await invocation.execute(abortSignal);
|
|
602
|
+
expect(result.error?.type).toBe(errorType);
|
|
603
|
+
const errorSuffix = errorCode ? ` (${errorCode})` : '';
|
|
604
|
+
const expectedMessage = errorCode
|
|
605
|
+
? `${expectedMessagePrefix}: ${filePath}${errorSuffix}`
|
|
606
|
+
: `${expectedMessagePrefix}: ${errorMessage}`;
|
|
607
|
+
expect(result.llmContent).toContain(expectedMessage);
|
|
608
|
+
expect(result.returnDisplay).toContain(expectedMessage);
|
|
609
|
+
}
|
|
610
|
+
finally {
|
|
611
|
+
if (existsSyncSpy) {
|
|
612
|
+
existsSyncSpy.mockRestore();
|
|
613
|
+
}
|
|
614
|
+
}
|
|
524
615
|
});
|
|
525
616
|
});
|
|
526
617
|
});
|