@machina.ai/cell-cli-core 1.22.5-rc1 → 1.25.0-rc2
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/docs/AFTER_MERGE_PROMPT.md +26 -0
- package/dist/docs/CHANGES.md +124 -0
- package/dist/docs/api-proxy.md +27 -0
- package/dist/docs/architecture.md +80 -0
- package/dist/docs/assets/connected_devtools.png +0 -0
- package/dist/docs/assets/gemini-screenshot.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-logs.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-metrics.png +0 -0
- package/dist/docs/assets/monitoring-dashboard-overview.png +0 -0
- package/dist/docs/assets/release_patch.png +0 -0
- package/dist/docs/assets/theme-ansi-light.png +0 -0
- package/dist/docs/assets/theme-ansi.png +0 -0
- package/dist/docs/assets/theme-atom-one.png +0 -0
- package/dist/docs/assets/theme-ayu-light.png +0 -0
- package/dist/docs/assets/theme-ayu.png +0 -0
- package/dist/docs/assets/theme-custom.png +0 -0
- package/dist/docs/assets/theme-default-light.png +0 -0
- package/dist/docs/assets/theme-default.png +0 -0
- package/dist/docs/assets/theme-dracula.png +0 -0
- package/dist/docs/assets/theme-github-light.png +0 -0
- package/dist/docs/assets/theme-github.png +0 -0
- package/dist/docs/assets/theme-google-light.png +0 -0
- package/dist/docs/assets/theme-xcode-light.png +0 -0
- package/dist/docs/changelogs/index.md +612 -0
- package/dist/docs/changelogs/latest.md +153 -0
- package/dist/docs/changelogs/preview.md +131 -0
- package/dist/docs/changelogs/releases.md +1162 -0
- package/dist/docs/cli/authentication.md +3 -0
- package/dist/docs/cli/checkpointing.md +94 -0
- package/dist/docs/cli/commands.md +357 -0
- package/dist/docs/cli/custom-commands.md +315 -0
- package/dist/docs/cli/enterprise.md +564 -0
- package/dist/docs/cli/gemini-ignore.md +71 -0
- package/dist/docs/cli/gemini-md.md +109 -0
- package/dist/docs/cli/generation-settings.md +210 -0
- package/dist/docs/cli/headless.md +388 -0
- package/dist/docs/cli/index.md +63 -0
- package/dist/docs/cli/keyboard-shortcuts.md +136 -0
- package/dist/docs/cli/model-routing.md +37 -0
- package/dist/docs/cli/model.md +62 -0
- package/dist/docs/cli/sandbox.md +171 -0
- package/dist/docs/cli/session-management.md +158 -0
- package/dist/docs/cli/settings.md +148 -0
- package/dist/docs/cli/skills.md +188 -0
- package/dist/docs/cli/system-prompt.md +94 -0
- package/dist/docs/cli/telemetry.md +813 -0
- package/dist/docs/cli/themes.md +237 -0
- package/dist/docs/cli/token-caching.md +20 -0
- package/dist/docs/cli/trusted-folders.md +95 -0
- package/dist/docs/cli/tutorials/skills-getting-started.md +124 -0
- package/dist/docs/cli/tutorials.md +87 -0
- package/dist/docs/cli/uninstall.md +47 -0
- package/dist/docs/core/index.md +101 -0
- package/dist/docs/core/memport.md +246 -0
- package/dist/docs/core/policy-engine.md +268 -0
- package/dist/docs/core/tools-api.md +131 -0
- package/dist/docs/examples/proxy-script.md +83 -0
- package/dist/docs/extensions/extension-releasing.md +183 -0
- package/dist/docs/extensions/getting-started-extensions.md +244 -0
- package/dist/docs/extensions/index.md +343 -0
- package/dist/docs/faq.md +153 -0
- package/dist/docs/get-started/authentication.md +321 -0
- package/dist/docs/get-started/configuration-v1.md +890 -0
- package/dist/docs/get-started/configuration.md +1643 -0
- package/dist/docs/get-started/examples.md +218 -0
- package/dist/docs/get-started/gemini-3.md +101 -0
- package/dist/docs/get-started/index.md +71 -0
- package/dist/docs/get-started/installation.md +141 -0
- package/dist/docs/hooks/best-practices.md +856 -0
- package/dist/docs/hooks/index.md +723 -0
- package/dist/docs/hooks/reference.md +178 -0
- package/dist/docs/hooks/writing-hooks.md +1044 -0
- package/dist/docs/ide-integration/ide-companion-spec.md +267 -0
- package/dist/docs/ide-integration/index.md +201 -0
- package/dist/docs/index.md +147 -0
- package/dist/docs/integration-tests.md +211 -0
- package/dist/docs/issue-and-pr-automation.md +134 -0
- package/dist/docs/local-development.md +128 -0
- package/dist/docs/mcp_integration.md +160 -0
- package/dist/docs/mermaid/context.mmd +103 -0
- package/dist/docs/mermaid/render-path.mmd +64 -0
- package/dist/docs/npm.md +62 -0
- package/dist/docs/quota-and-pricing.md +158 -0
- package/dist/docs/release-confidence.md +164 -0
- package/dist/docs/releases.md +540 -0
- package/dist/docs/sidebar.json +301 -0
- package/dist/docs/tools/file-system.md +217 -0
- package/dist/docs/tools/index.md +95 -0
- package/dist/docs/tools/mcp-server.md +1045 -0
- package/dist/docs/tools/memory.md +54 -0
- package/dist/docs/tools/shell.md +260 -0
- package/dist/docs/tools/todos.md +56 -0
- package/dist/docs/tools/web-fetch.md +59 -0
- package/dist/docs/tools/web-search.md +42 -0
- package/dist/docs/tos-privacy.md +96 -0
- package/dist/docs/troubleshooting.md +162 -0
- package/dist/package.json +7 -4
- package/dist/src/agents/a2a-client-manager.d.ts +82 -0
- package/dist/src/agents/a2a-client-manager.js +295 -0
- package/dist/src/agents/a2a-client-manager.js.map +1 -0
- package/dist/src/agents/a2a-client-manager.test.js +281 -0
- package/dist/src/agents/a2a-client-manager.test.js.map +1 -0
- package/dist/src/agents/a2aUtils.d.ts +29 -0
- package/dist/src/agents/a2aUtils.js +113 -0
- package/dist/src/agents/a2aUtils.js.map +1 -0
- package/dist/src/agents/a2aUtils.test.js +147 -0
- package/dist/src/agents/a2aUtils.test.js.map +1 -0
- package/dist/src/agents/agentLoader.d.ts +68 -0
- package/dist/src/agents/agentLoader.js +255 -0
- package/dist/src/agents/agentLoader.js.map +1 -0
- package/dist/src/agents/agentLoader.test.js +307 -0
- package/dist/src/agents/agentLoader.test.js.map +1 -0
- package/dist/src/agents/cli-help-agent.d.ts +24 -0
- package/dist/src/agents/cli-help-agent.js +85 -0
- package/dist/src/agents/cli-help-agent.js.map +1 -0
- package/dist/src/agents/cli-help-agent.test.js +65 -0
- package/dist/src/agents/cli-help-agent.test.js.map +1 -0
- package/dist/src/agents/codebase-investigator.d.ts +2 -2
- package/dist/src/agents/codebase-investigator.js +14 -8
- package/dist/src/agents/codebase-investigator.js.map +1 -1
- package/dist/src/agents/delegate-to-agent-tool.d.ts +2 -2
- package/dist/src/agents/delegate-to-agent-tool.js +25 -14
- package/dist/src/agents/delegate-to-agent-tool.js.map +1 -1
- package/dist/src/agents/delegate-to-agent-tool.test.js +101 -21
- package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -1
- package/dist/src/agents/{executor.d.ts → local-executor.d.ts} +5 -11
- package/dist/src/agents/{executor.js → local-executor.js} +123 -62
- package/dist/src/agents/local-executor.js.map +1 -0
- package/dist/src/agents/local-executor.test.d.ts +6 -0
- package/dist/src/agents/{executor.test.js → local-executor.test.js} +136 -58
- package/dist/src/agents/local-executor.test.js.map +1 -0
- package/dist/src/agents/{invocation.d.ts → local-invocation.d.ts} +6 -7
- package/dist/src/agents/{invocation.js → local-invocation.js} +9 -10
- package/dist/src/agents/local-invocation.js.map +1 -0
- package/dist/src/agents/local-invocation.test.d.ts +6 -0
- package/dist/src/agents/{invocation.test.js → local-invocation.test.js} +29 -20
- package/dist/src/agents/local-invocation.test.js.map +1 -0
- package/dist/src/agents/registry.d.ts +22 -1
- package/dist/src/agents/registry.js +192 -35
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/registry.test.js +407 -33
- package/dist/src/agents/registry.test.js.map +1 -1
- package/dist/src/agents/remote-invocation.d.ts +35 -0
- package/dist/src/agents/remote-invocation.js +126 -0
- package/dist/src/agents/remote-invocation.js.map +1 -0
- package/dist/src/agents/remote-invocation.test.d.ts +6 -0
- package/dist/src/agents/remote-invocation.test.js +201 -0
- package/dist/src/agents/remote-invocation.test.js.map +1 -0
- package/dist/src/agents/subagent-tool-wrapper.d.ts +2 -2
- package/dist/src/agents/subagent-tool-wrapper.js +11 -6
- package/dist/src/agents/subagent-tool-wrapper.js.map +1 -1
- package/dist/src/agents/subagent-tool-wrapper.test.js +33 -19
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
- package/dist/src/agents/types.d.ts +21 -15
- package/dist/src/agents/types.js.map +1 -1
- package/dist/src/availability/fallbackIntegration.test.d.ts +6 -0
- package/dist/src/availability/fallbackIntegration.test.js +58 -0
- package/dist/src/availability/fallbackIntegration.test.js.map +1 -0
- package/dist/src/availability/modelAvailabilityService.d.ts +2 -1
- package/dist/src/availability/policyHelpers.d.ts +4 -3
- package/dist/src/availability/policyHelpers.js +13 -22
- package/dist/src/availability/policyHelpers.js.map +1 -1
- package/dist/src/availability/policyHelpers.test.js +28 -18
- package/dist/src/availability/policyHelpers.test.js.map +1 -1
- package/dist/src/code_assist/experiments/experiments.d.ts +1 -1
- package/dist/src/code_assist/experiments/experiments.js +21 -0
- package/dist/src/code_assist/experiments/experiments.js.map +1 -1
- package/dist/src/code_assist/experiments/experiments_local.test.d.ts +6 -0
- package/dist/src/code_assist/experiments/experiments_local.test.js +110 -0
- package/dist/src/code_assist/experiments/experiments_local.test.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.js +3 -4
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -1
- package/dist/src/code_assist/oauth2.js +32 -2
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +111 -16
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +9 -1
- package/dist/src/code_assist/server.js +74 -11
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +199 -27
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.js +6 -4
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/setup.test.js +63 -0
- package/dist/src/code_assist/setup.test.js.map +1 -1
- package/dist/src/code_assist/telemetry.d.ts +14 -0
- package/dist/src/code_assist/telemetry.js +157 -0
- package/dist/src/code_assist/telemetry.js.map +1 -0
- package/dist/src/code_assist/telemetry.test.d.ts +6 -0
- package/dist/src/code_assist/telemetry.test.js +301 -0
- package/dist/src/code_assist/telemetry.test.js.map +1 -0
- package/dist/src/code_assist/types.d.ts +77 -1
- package/dist/src/code_assist/types.js +28 -0
- package/dist/src/code_assist/types.js.map +1 -1
- package/dist/src/commands/memory.d.ts +11 -0
- package/dist/src/commands/memory.js +80 -0
- package/dist/src/commands/memory.js.map +1 -0
- package/dist/src/commands/memory.test.d.ts +6 -0
- package/dist/src/commands/memory.test.js +155 -0
- package/dist/src/commands/memory.test.js.map +1 -0
- package/dist/src/config/config.d.ts +120 -26
- package/dist/src/config/config.js +241 -120
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +215 -43
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/flashFallback.test.js +11 -35
- package/dist/src/config/flashFallback.test.js.map +1 -1
- package/dist/src/config/models.d.ts +8 -9
- package/dist/src/config/models.js +18 -15
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/models.test.js +52 -16
- package/dist/src/config/models.test.js.map +1 -1
- package/dist/src/config/storage.d.ts +5 -0
- package/dist/src/config/storage.js +17 -2
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/config/storage.test.js +16 -0
- package/dist/src/config/storage.test.js.map +1 -1
- package/dist/src/confirmation-bus/message-bus.js +2 -1
- package/dist/src/confirmation-bus/message-bus.js.map +1 -1
- package/dist/src/core/baseLlmClient.js +44 -43
- package/dist/src/core/baseLlmClient.js.map +1 -1
- package/dist/src/core/baseLlmClient.test.js +12 -19
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/client.d.ts +7 -1
- package/dist/src/core/client.js +245 -114
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +277 -74
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/clientHookTriggers.js +2 -2
- package/dist/src/core/clientHookTriggers.js.map +1 -1
- package/dist/src/core/contentGenerator.js +3 -3
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +1 -7
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.d.ts +9 -5
- package/dist/src/core/coreToolHookTriggers.js +119 -21
- package/dist/src/core/coreToolHookTriggers.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.test.d.ts +6 -0
- package/dist/src/core/coreToolHookTriggers.test.js +191 -0
- package/dist/src/core/coreToolHookTriggers.test.js.map +1 -0
- package/dist/src/core/coreToolScheduler.d.ts +7 -93
- package/dist/src/core/coreToolScheduler.js +133 -369
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +252 -394
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.d.ts +26 -1
- package/dist/src/core/geminiChat.js +112 -79
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +125 -92
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiChatHookTriggers.d.ts +8 -4
- package/dist/src/core/geminiChatHookTriggers.js +34 -12
- package/dist/src/core/geminiChatHookTriggers.js.map +1 -1
- package/dist/src/core/geminiChatHookTriggers.test.d.ts +6 -0
- package/dist/src/core/geminiChatHookTriggers.test.js +153 -0
- package/dist/src/core/geminiChatHookTriggers.test.js.map +1 -0
- package/dist/src/core/geminiChat_network_retry.test.js +4 -6
- package/dist/src/core/geminiChat_network_retry.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.js +19 -2
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.test.js +30 -0
- package/dist/src/core/loggingContentGenerator.test.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +4 -4
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/prompts.js +37 -13
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +47 -3
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/tokenLimits.js +6 -12
- package/dist/src/core/tokenLimits.js.map +1 -1
- package/dist/src/core/tokenLimits.test.js +8 -4
- package/dist/src/core/tokenLimits.test.js.map +1 -1
- package/dist/src/core/turn.d.ts +21 -22
- package/dist/src/core/turn.js +31 -21
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +79 -5
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/fallback/handler.js +1 -7
- package/dist/src/fallback/handler.js.map +1 -1
- package/dist/src/fallback/handler.test.js +10 -29
- package/dist/src/fallback/handler.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +3 -3
- package/dist/src/generated/git-commit.js +3 -3
- package/dist/src/hooks/hookAggregator.js +7 -0
- package/dist/src/hooks/hookAggregator.js.map +1 -1
- package/dist/src/hooks/hookEventHandler.d.ts +9 -5
- package/dist/src/hooks/hookEventHandler.js +61 -15
- package/dist/src/hooks/hookEventHandler.js.map +1 -1
- package/dist/src/hooks/hookEventHandler.test.js +223 -8
- package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
- package/dist/src/hooks/hookPlanner.d.ts +1 -5
- package/dist/src/hooks/hookPlanner.js +2 -7
- package/dist/src/hooks/hookPlanner.js.map +1 -1
- package/dist/src/hooks/hookPlanner.test.js +62 -2
- package/dist/src/hooks/hookPlanner.test.js.map +1 -1
- package/dist/src/hooks/hookRegistry.d.ts +6 -11
- package/dist/src/hooks/hookRegistry.js +41 -14
- package/dist/src/hooks/hookRegistry.js.map +1 -1
- package/dist/src/hooks/hookRegistry.test.js +166 -2
- package/dist/src/hooks/hookRegistry.test.js.map +1 -1
- package/dist/src/hooks/hookRunner.d.ts +5 -3
- package/dist/src/hooks/hookRunner.js +57 -17
- package/dist/src/hooks/hookRunner.js.map +1 -1
- package/dist/src/hooks/hookRunner.test.js +172 -35
- package/dist/src/hooks/hookRunner.test.js.map +1 -1
- package/dist/src/hooks/hookSystem.d.ts +12 -0
- package/dist/src/hooks/hookSystem.js +39 -1
- package/dist/src/hooks/hookSystem.js.map +1 -1
- package/dist/src/hooks/hookTranslator.js +2 -1
- package/dist/src/hooks/hookTranslator.js.map +1 -1
- package/dist/src/hooks/index.d.ts +1 -2
- package/dist/src/hooks/index.js +1 -3
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/trustedHooks.d.ts +28 -0
- package/dist/src/hooks/trustedHooks.js +90 -0
- package/dist/src/hooks/trustedHooks.js.map +1 -0
- package/dist/src/hooks/trustedHooks.test.d.ts +6 -0
- package/dist/src/hooks/trustedHooks.test.js +154 -0
- package/dist/src/hooks/trustedHooks.test.js.map +1 -0
- package/dist/src/hooks/types.d.ts +41 -9
- package/dist/src/hooks/types.js +31 -41
- package/dist/src/hooks/types.js.map +1 -1
- package/dist/src/hooks/types.test.js +9 -52
- package/dist/src/hooks/types.test.js.map +1 -1
- package/dist/src/ide/detect-ide.d.ts +4 -0
- package/dist/src/ide/detect-ide.js +7 -2
- package/dist/src/ide/detect-ide.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +10 -0
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.js +4 -1
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-installer.js +2 -2
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +11 -2
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/index.d.ts +16 -2
- package/dist/src/index.js +18 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/oauth-provider.js +7 -3
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +4 -1
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +8 -1
- package/dist/src/mcp/oauth-utils.js +31 -2
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +42 -0
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.js +2 -2
- package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.js +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -1
- package/dist/src/policy/config.js +62 -23
- package/dist/src/policy/config.js.map +1 -1
- package/dist/src/policy/config.test.js +24 -2
- package/dist/src/policy/config.test.js.map +1 -1
- package/dist/src/policy/persistence.test.js +1 -1
- package/dist/src/policy/persistence.test.js.map +1 -1
- package/dist/src/policy/policies/agent.toml +1 -1
- package/dist/src/policy/policies/write.toml +5 -0
- package/dist/src/policy/policies/yolo.toml +1 -0
- package/dist/src/policy/policy-engine.d.ts +4 -0
- package/dist/src/policy/policy-engine.js +137 -53
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/policy-engine.test.js +289 -1
- package/dist/src/policy/policy-engine.test.js.map +1 -1
- package/dist/src/policy/policy-updater.test.js +5 -5
- package/dist/src/policy/policy-updater.test.js.map +1 -1
- package/dist/src/policy/shell-safety.test.js +371 -8
- package/dist/src/policy/shell-safety.test.js.map +1 -1
- package/dist/src/policy/toml-loader.d.ts +0 -8
- package/dist/src/policy/toml-loader.js +13 -45
- package/dist/src/policy/toml-loader.js.map +1 -1
- package/dist/src/policy/toml-loader.test.js +13 -0
- package/dist/src/policy/toml-loader.test.js.map +1 -1
- package/dist/src/policy/types.d.ts +10 -0
- package/dist/src/policy/utils.d.ts +21 -0
- package/dist/src/policy/utils.js +45 -0
- package/dist/src/policy/utils.js.map +1 -0
- package/dist/src/policy/utils.test.d.ts +6 -0
- package/dist/src/policy/utils.test.js +92 -0
- package/dist/src/policy/utils.test.js.map +1 -0
- package/dist/src/routing/routingStrategy.d.ts +2 -0
- package/dist/src/routing/strategies/classifierStrategy.js +1 -1
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -1
- package/dist/src/routing/strategies/classifierStrategy.test.js +16 -0
- package/dist/src/routing/strategies/classifierStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/compositeStrategy.js +4 -2
- package/dist/src/routing/strategies/compositeStrategy.js.map +1 -1
- package/dist/src/routing/strategies/compositeStrategy.test.js +11 -10
- package/dist/src/routing/strategies/compositeStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.d.ts +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.js +2 -5
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.test.js +13 -6
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/overrideStrategy.d.ts +1 -1
- package/dist/src/routing/strategies/overrideStrategy.js +6 -6
- package/dist/src/routing/strategies/overrideStrategy.js.map +1 -1
- package/dist/src/routing/strategies/overrideStrategy.test.js +14 -0
- package/dist/src/routing/strategies/overrideStrategy.test.js.map +1 -1
- package/dist/src/scheduler/tool-executor.d.ts +22 -0
- package/dist/src/scheduler/tool-executor.js +198 -0
- package/dist/src/scheduler/tool-executor.js.map +1 -0
- package/dist/src/scheduler/tool-executor.test.d.ts +6 -0
- package/dist/src/scheduler/tool-executor.test.js +231 -0
- package/dist/src/scheduler/tool-executor.test.js.map +1 -0
- package/dist/src/scheduler/tool-modifier.d.ts +23 -0
- package/dist/src/scheduler/tool-modifier.js +50 -0
- package/dist/src/scheduler/tool-modifier.js.map +1 -0
- package/dist/src/scheduler/tool-modifier.test.d.ts +6 -0
- package/dist/src/scheduler/tool-modifier.test.js +159 -0
- package/dist/src/scheduler/tool-modifier.test.js.map +1 -0
- package/dist/src/scheduler/types.d.ts +95 -0
- package/dist/src/scheduler/types.js +7 -0
- package/dist/src/scheduler/types.js.map +1 -0
- package/dist/src/services/chatCompressionService.js +3 -10
- package/dist/src/services/chatCompressionService.js.map +1 -1
- package/dist/src/services/chatCompressionService.test.js +1 -0
- package/dist/src/services/chatCompressionService.test.js.map +1 -1
- package/dist/src/services/chatRecordingService.d.ts +7 -1
- package/dist/src/services/chatRecordingService.js +20 -2
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/chatRecordingService.test.js +43 -0
- package/dist/src/services/chatRecordingService.test.js.map +1 -1
- package/dist/src/services/contextManager.d.ts +5 -11
- package/dist/src/services/contextManager.js +20 -17
- package/dist/src/services/contextManager.js.map +1 -1
- package/dist/src/services/contextManager.test.js +40 -41
- package/dist/src/services/contextManager.test.js.map +1 -1
- package/dist/src/services/environmentSanitization.d.ts +15 -0
- package/dist/src/services/environmentSanitization.js +142 -0
- package/dist/src/services/environmentSanitization.js.map +1 -0
- package/dist/src/services/environmentSanitization.test.d.ts +6 -0
- package/dist/src/services/environmentSanitization.test.js +284 -0
- package/dist/src/services/environmentSanitization.test.js.map +1 -0
- package/dist/src/services/gitService.js +10 -1
- package/dist/src/services/gitService.js.map +1 -1
- package/dist/src/services/gitService.test.js +28 -2
- package/dist/src/services/gitService.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.js +2 -1
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +14 -8
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/modelConfig.integration.test.js +3 -3
- package/dist/src/services/modelConfig.integration.test.js.map +1 -1
- package/dist/src/services/modelConfigService.d.ts +38 -4
- package/dist/src/services/modelConfigService.js +135 -76
- package/dist/src/services/modelConfigService.js.map +1 -1
- package/dist/src/services/modelConfigService.test.js +116 -0
- package/dist/src/services/modelConfigService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +2 -0
- package/dist/src/services/shellExecutionService.js +6 -50
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +68 -4
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/skills/skillLoader.d.ts +31 -0
- package/dist/src/skills/skillLoader.js +77 -0
- package/dist/src/skills/skillLoader.js.map +1 -0
- package/dist/src/skills/skillLoader.test.d.ts +6 -0
- package/dist/src/skills/skillLoader.test.js +75 -0
- package/dist/src/skills/skillLoader.test.js.map +1 -0
- package/dist/src/skills/skillManager.d.ts +69 -0
- package/dist/src/skills/skillManager.js +127 -0
- package/dist/src/skills/skillManager.js.map +1 -0
- package/dist/src/skills/skillManager.test.d.ts +6 -0
- package/dist/src/skills/skillManager.test.js +210 -0
- package/dist/src/skills/skillManager.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +18 -9
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +234 -160
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +162 -32
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +11 -3
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +24 -5
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +3 -3
- package/dist/src/telemetry/loggers.js +6 -5
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.circular.js +1 -0
- package/dist/src/telemetry/loggers.test.circular.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +51 -10
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/sdk.js +5 -6
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/types.d.ts +7 -7
- package/dist/src/telemetry/types.js +14 -12
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/test-utils/mock-message-bus.d.ts +1 -0
- package/dist/src/test-utils/mock-message-bus.js +29 -0
- package/dist/src/test-utils/mock-message-bus.js.map +1 -1
- package/dist/src/test-utils/mock-tool.d.ts +5 -3
- package/dist/src/test-utils/mock-tool.js +11 -10
- package/dist/src/test-utils/mock-tool.js.map +1 -1
- package/dist/src/tools/activate-skill.d.ts +27 -0
- package/dist/src/tools/activate-skill.js +133 -0
- package/dist/src/tools/activate-skill.js.map +1 -0
- package/dist/src/tools/activate-skill.test.d.ts +6 -0
- package/dist/src/tools/activate-skill.test.js +113 -0
- package/dist/src/tools/activate-skill.test.js.map +1 -0
- package/dist/src/tools/confirmation-policy.test.js +3 -12
- package/dist/src/tools/confirmation-policy.test.js.map +1 -1
- package/dist/src/tools/edit.d.ts +27 -5
- package/dist/src/tools/edit.js +455 -136
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +292 -526
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/get-internal-docs.d.ts +27 -0
- package/dist/src/tools/get-internal-docs.js +122 -0
- package/dist/src/tools/get-internal-docs.js.map +1 -0
- package/dist/src/tools/get-internal-docs.test.d.ts +6 -0
- package/dist/src/tools/get-internal-docs.test.js +57 -0
- package/dist/src/tools/get-internal-docs.test.js.map +1 -0
- package/dist/src/tools/glob.d.ts +2 -2
- package/dist/src/tools/glob.js +1 -1
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +2 -1
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.d.ts +2 -2
- package/dist/src/tools/grep.js +1 -1
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +5 -4
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/ls.d.ts +2 -2
- package/dist/src/tools/ls.js +2 -2
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +2 -1
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.js +14 -7
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +28 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +5 -4
- package/dist/src/tools/mcp-client.js +10 -8
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +47 -42
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +20 -5
- package/dist/src/tools/mcp-tool.js +8 -8
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +11 -6
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +3 -3
- package/dist/src/tools/memoryTool.js +2 -4
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +5 -2
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/message-bus-integration.test.js +10 -37
- package/dist/src/tools/message-bus-integration.test.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +2 -2
- package/dist/src/tools/read-file.js +1 -1
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +3 -2
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +2 -2
- package/dist/src/tools/read-many-files.js +2 -3
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +3 -2
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/ripGrep.d.ts +3 -2
- package/dist/src/tools/ripGrep.js +18 -7
- package/dist/src/tools/ripGrep.js.map +1 -1
- package/dist/src/tools/ripGrep.test.js +60 -4
- package/dist/src/tools/ripGrep.test.js.map +1 -1
- package/dist/src/tools/shell.d.ts +3 -6
- package/dist/src/tools/shell.js +21 -49
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +35 -59
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +6 -1
- package/dist/src/tools/tool-error.js +6 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +15 -0
- package/dist/src/tools/tool-names.js +57 -0
- package/dist/src/tools/tool-names.js.map +1 -1
- package/dist/src/tools/tool-names.test.d.ts +6 -0
- package/dist/src/tools/tool-names.test.js +43 -0
- package/dist/src/tools/tool-names.test.js.map +1 -0
- package/dist/src/tools/tool-registry.d.ts +11 -7
- package/dist/src/tools/tool-registry.js +15 -10
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +16 -11
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +8 -6
- package/dist/src/tools/tools.js +16 -18
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/tools.test.js +3 -1
- package/dist/src/tools/tools.test.js.map +1 -1
- package/dist/src/tools/web-fetch.d.ts +2 -2
- package/dist/src/tools/web-fetch.js +4 -4
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +17 -19
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.d.ts +2 -2
- package/dist/src/tools/web-search.js +5 -5
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/web-search.test.js +2 -1
- package/dist/src/tools/web-search.test.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +2 -2
- package/dist/src/tools/write-file.js +9 -6
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +49 -7
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +2 -2
- package/dist/src/tools/write-todos.js +5 -4
- package/dist/src/tools/write-todos.js.map +1 -1
- package/dist/src/tools/write-todos.test.js +2 -1
- package/dist/src/tools/write-todos.test.js.map +1 -1
- package/dist/src/utils/apiConversionUtils.d.ts +12 -0
- package/dist/src/utils/apiConversionUtils.js +46 -0
- package/dist/src/utils/apiConversionUtils.js.map +1 -0
- package/dist/src/utils/apiConversionUtils.test.d.ts +6 -0
- package/dist/src/utils/apiConversionUtils.test.js +150 -0
- package/dist/src/utils/apiConversionUtils.test.js.map +1 -0
- package/dist/src/utils/checkpointUtils.d.ts +1 -1
- package/dist/src/utils/checkpointUtils.js +1 -1
- package/dist/src/utils/checkpointUtils.js.map +1 -1
- package/dist/src/utils/checkpointUtils.test.js +1 -1
- package/dist/src/utils/checkpointUtils.test.js.map +1 -1
- package/dist/src/utils/debugLogger.js +1 -0
- package/dist/src/utils/debugLogger.js.map +1 -1
- package/dist/src/utils/editCorrector.d.ts +3 -3
- package/dist/src/utils/editCorrector.js +27 -10
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +23 -23
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/editor.d.ts +3 -2
- package/dist/src/utils/editor.js +26 -6
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/editor.test.js +27 -4
- package/dist/src/utils/editor.test.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +1 -0
- package/dist/src/utils/environmentContext.js +4 -0
- package/dist/src/utils/environmentContext.js.map +1 -1
- package/dist/src/utils/environmentContext.test.js +2 -0
- package/dist/src/utils/environmentContext.test.js.map +1 -1
- package/dist/src/utils/errorReporting.d.ts +1 -1
- package/dist/src/utils/errorReporting.js +13 -12
- package/dist/src/utils/errorReporting.js.map +1 -1
- package/dist/src/utils/errorReporting.test.js +17 -14
- package/dist/src/utils/errorReporting.test.js.map +1 -1
- package/dist/src/utils/events.d.ts +71 -19
- package/dist/src/utils/events.js +35 -9
- package/dist/src/utils/events.js.map +1 -1
- package/dist/src/utils/events.test.js +25 -0
- package/dist/src/utils/events.test.js.map +1 -1
- package/dist/src/utils/fileDiffUtils.d.ts +18 -0
- package/dist/src/utils/fileDiffUtils.js +37 -0
- package/dist/src/utils/fileDiffUtils.js.map +1 -0
- package/dist/src/utils/fileDiffUtils.test.d.ts +6 -0
- package/dist/src/utils/fileDiffUtils.test.js +84 -0
- package/dist/src/utils/fileDiffUtils.test.js.map +1 -0
- package/dist/src/utils/fileUtils.d.ts +4 -0
- package/dist/src/utils/fileUtils.js +53 -0
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +112 -1
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/geminiIgnoreParser.d.ts +11 -0
- package/dist/src/utils/geminiIgnoreParser.js +20 -0
- package/dist/src/utils/geminiIgnoreParser.js.map +1 -1
- package/dist/src/utils/geminiIgnoreParser.test.js +48 -0
- package/dist/src/utils/geminiIgnoreParser.test.js.map +1 -1
- package/dist/src/utils/generateContentResponseUtilities.d.ts +3 -1
- package/dist/src/utils/generateContentResponseUtilities.js +106 -0
- package/dist/src/utils/generateContentResponseUtilities.js.map +1 -1
- package/dist/src/utils/generateContentResponseUtilities.test.js +279 -2
- package/dist/src/utils/generateContentResponseUtilities.test.js.map +1 -1
- package/dist/src/utils/getFolderStructure.js +7 -2
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.js +9 -10
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/installationManager.test.js +11 -3
- package/dist/src/utils/installationManager.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.js +3 -4
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +12 -1
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/partUtils.js +1 -1
- package/dist/src/utils/partUtils.js.map +1 -1
- package/dist/src/utils/paths.d.ts +10 -0
- package/dist/src/utils/paths.js +20 -1
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/retry.d.ts +1 -0
- package/dist/src/utils/retry.js +17 -5
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +11 -11
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/shell-utils.d.ts +6 -0
- package/dist/src/utils/shell-utils.js +97 -12
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +99 -1
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/summarizer.test.js +3 -2
- package/dist/src/utils/summarizer.test.js.map +1 -1
- package/dist/src/utils/terminal.d.ts +4 -0
- package/dist/src/utils/terminal.js +12 -0
- package/dist/src/utils/terminal.js.map +1 -1
- package/dist/src/utils/tokenCalculation.js +20 -5
- package/dist/src/utils/tokenCalculation.js.map +1 -1
- package/dist/src/utils/tokenCalculation.test.js +11 -2
- package/dist/src/utils/tokenCalculation.test.js.map +1 -1
- package/dist/src/utils/tool-utils.d.ts +9 -0
- package/dist/src/utils/tool-utils.js +29 -0
- package/dist/src/utils/tool-utils.js.map +1 -1
- package/dist/src/utils/tool-utils.test.js +17 -2
- package/dist/src/utils/tool-utils.test.js.map +1 -1
- package/dist/src/utils/userAccountManager.test.js +5 -5
- package/dist/src/utils/userAccountManager.test.js.map +1 -1
- package/dist/src/utils/workspaceContext.test.js +1 -1
- package/dist/src/utils/workspaceContext.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -6
- package/dist/src/agents/executor.js.map +0 -1
- package/dist/src/agents/executor.test.js.map +0 -1
- package/dist/src/agents/invocation.js.map +0 -1
- package/dist/src/agents/invocation.test.js.map +0 -1
- package/dist/src/core/sessionHookTriggers.d.ts +0 -28
- package/dist/src/core/sessionHookTriggers.js +0 -68
- package/dist/src/core/sessionHookTriggers.js.map +0 -1
- package/dist/src/tools/smart-edit.d.ts +0 -78
- package/dist/src/tools/smart-edit.js +0 -722
- package/dist/src/tools/smart-edit.js.map +0 -1
- package/dist/src/tools/smart-edit.test.js +0 -592
- package/dist/src/tools/smart-edit.test.js.map +0 -1
- package/dist/src/utils/shell-permissions.d.ts +0 -52
- package/dist/src/utils/shell-permissions.js +0 -188
- package/dist/src/utils/shell-permissions.js.map +0 -1
- package/dist/src/utils/shell-permissions.test.js +0 -347
- package/dist/src/utils/shell-permissions.test.js.map +0 -1
- /package/dist/src/agents/{executor.test.d.ts → a2a-client-manager.test.d.ts} +0 -0
- /package/dist/src/agents/{invocation.test.d.ts → a2aUtils.test.d.ts} +0 -0
- /package/dist/src/{tools/smart-edit.test.d.ts → agents/agentLoader.test.d.ts} +0 -0
- /package/dist/src/{utils/shell-permissions.test.d.ts → agents/cli-help-agent.test.d.ts} +0 -0
|
@@ -3,38 +3,36 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { describe, it, expect, vi
|
|
7
|
-
import { CoreToolScheduler
|
|
8
|
-
import { DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES, DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD, BaseDeclarativeTool, BaseToolInvocation, ToolConfirmationOutcome, Kind, ApprovalMode, HookSystem, } from '../index.js';
|
|
6
|
+
import { describe, it, expect, vi } from 'vitest';
|
|
7
|
+
import { CoreToolScheduler } from './coreToolScheduler.js';
|
|
8
|
+
import { DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES, DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD, BaseDeclarativeTool, BaseToolInvocation, ToolConfirmationOutcome, Kind, ApprovalMode, HookSystem, PolicyDecision, } from '../index.js';
|
|
9
9
|
import { createMockMessageBus } from '../test-utils/mock-message-bus.js';
|
|
10
10
|
import { MockModifiableTool, MockTool, MOCK_TOOL_SHOULD_CONFIRM_EXECUTE, } from '../test-utils/mock-tool.js';
|
|
11
11
|
import * as modifiableToolModule from '../tools/modifiable-tool.js';
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import { isShellInvocationAllowlisted } from '../utils/shell-permissions.js';
|
|
15
|
-
import { DEFAULT_GEMINI_MODEL, PREVIEW_GEMINI_MODEL, } from '../config/models.js';
|
|
12
|
+
import { DEFAULT_GEMINI_MODEL } from '../config/models.js';
|
|
13
|
+
import { DiscoveredMCPTool } from '../tools/mcp-tool.js';
|
|
16
14
|
vi.mock('fs/promises', () => ({
|
|
17
15
|
writeFile: vi.fn(),
|
|
18
16
|
}));
|
|
19
17
|
class TestApprovalTool extends BaseDeclarativeTool {
|
|
20
18
|
config;
|
|
21
19
|
static Name = 'testApprovalTool';
|
|
22
|
-
constructor(config) {
|
|
20
|
+
constructor(config, messageBus) {
|
|
23
21
|
super(TestApprovalTool.Name, 'TestApprovalTool', 'A tool for testing approval logic', Kind.Edit, {
|
|
24
22
|
properties: { id: { type: 'string' } },
|
|
25
23
|
required: ['id'],
|
|
26
24
|
type: 'object',
|
|
27
|
-
});
|
|
25
|
+
}, messageBus);
|
|
28
26
|
this.config = config;
|
|
29
27
|
}
|
|
30
|
-
createInvocation(params) {
|
|
31
|
-
return new TestApprovalInvocation(this.config, params);
|
|
28
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
29
|
+
return new TestApprovalInvocation(this.config, params, messageBus);
|
|
32
30
|
}
|
|
33
31
|
}
|
|
34
32
|
class TestApprovalInvocation extends BaseToolInvocation {
|
|
35
33
|
config;
|
|
36
|
-
constructor(config, params) {
|
|
37
|
-
super(params);
|
|
34
|
+
constructor(config, params, messageBus) {
|
|
35
|
+
super(params, messageBus);
|
|
38
36
|
this.config = config;
|
|
39
37
|
}
|
|
40
38
|
getDescription() {
|
|
@@ -70,8 +68,8 @@ class TestApprovalInvocation extends BaseToolInvocation {
|
|
|
70
68
|
class AbortDuringConfirmationInvocation extends BaseToolInvocation {
|
|
71
69
|
abortController;
|
|
72
70
|
abortError;
|
|
73
|
-
constructor(abortController, abortError, params) {
|
|
74
|
-
super(params);
|
|
71
|
+
constructor(abortController, abortError, params, messageBus) {
|
|
72
|
+
super(params, messageBus);
|
|
75
73
|
this.abortController = abortController;
|
|
76
74
|
this.abortError = abortError;
|
|
77
75
|
}
|
|
@@ -89,16 +87,16 @@ class AbortDuringConfirmationInvocation extends BaseToolInvocation {
|
|
|
89
87
|
class AbortDuringConfirmationTool extends BaseDeclarativeTool {
|
|
90
88
|
abortController;
|
|
91
89
|
abortError;
|
|
92
|
-
constructor(abortController, abortError) {
|
|
90
|
+
constructor(abortController, abortError, messageBus) {
|
|
93
91
|
super('abortDuringConfirmationTool', 'Abort During Confirmation Tool', 'A tool that aborts while confirming execution.', Kind.Other, {
|
|
94
92
|
type: 'object',
|
|
95
93
|
properties: {},
|
|
96
|
-
});
|
|
94
|
+
}, messageBus);
|
|
97
95
|
this.abortController = abortController;
|
|
98
96
|
this.abortError = abortError;
|
|
99
97
|
}
|
|
100
|
-
createInvocation(params) {
|
|
101
|
-
return new AbortDuringConfirmationInvocation(this.abortController, this.abortError, params);
|
|
98
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
99
|
+
return new AbortDuringConfirmationInvocation(this.abortController, this.abortError, params, messageBus);
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
async function waitForStatus(onToolCallsUpdate, status, timeout = 5000) {
|
|
@@ -155,6 +153,11 @@ function createMockConfig(overrides = {}) {
|
|
|
155
153
|
getShellExecutionConfig: () => ({
|
|
156
154
|
terminalWidth: 90,
|
|
157
155
|
terminalHeight: 30,
|
|
156
|
+
sanitizationConfig: {
|
|
157
|
+
enableEnvironmentVariableRedaction: true,
|
|
158
|
+
allowedEnvironmentVariables: [],
|
|
159
|
+
blockedEnvironmentVariables: [],
|
|
160
|
+
},
|
|
158
161
|
}),
|
|
159
162
|
storage: {
|
|
160
163
|
getProjectTempDir: () => '/tmp',
|
|
@@ -163,15 +166,32 @@ function createMockConfig(overrides = {}) {
|
|
|
163
166
|
getTruncateToolOutputLines: () => DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES,
|
|
164
167
|
getToolRegistry: () => defaultToolRegistry,
|
|
165
168
|
getActiveModel: () => DEFAULT_GEMINI_MODEL,
|
|
166
|
-
getUseSmartEdit: () => false,
|
|
167
169
|
getGeminiClient: () => null,
|
|
168
|
-
|
|
169
|
-
getMessageBus: () => null,
|
|
170
|
+
getMessageBus: () => createMockMessageBus(),
|
|
170
171
|
getEnableHooks: () => false,
|
|
171
|
-
getPolicyEngine: () => null,
|
|
172
172
|
getExperiments: () => { },
|
|
173
173
|
};
|
|
174
|
-
|
|
174
|
+
const finalConfig = { ...baseConfig, ...overrides };
|
|
175
|
+
// Patch the policy engine to use the final config if not overridden
|
|
176
|
+
if (!overrides.getPolicyEngine) {
|
|
177
|
+
finalConfig.getPolicyEngine = () => ({
|
|
178
|
+
check: async (toolCall, _serverName) => {
|
|
179
|
+
// Mock simple policy logic for tests
|
|
180
|
+
const mode = finalConfig.getApprovalMode();
|
|
181
|
+
if (mode === ApprovalMode.YOLO) {
|
|
182
|
+
return { decision: PolicyDecision.ALLOW };
|
|
183
|
+
}
|
|
184
|
+
const allowed = finalConfig.getAllowedTools();
|
|
185
|
+
if (allowed &&
|
|
186
|
+
(allowed.includes(toolCall.name) ||
|
|
187
|
+
allowed.some((p) => toolCall.name.startsWith(p)))) {
|
|
188
|
+
return { decision: PolicyDecision.ALLOW };
|
|
189
|
+
}
|
|
190
|
+
return { decision: PolicyDecision.ASK_USER };
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
}
|
|
194
|
+
return finalConfig;
|
|
175
195
|
}
|
|
176
196
|
describe('CoreToolScheduler', () => {
|
|
177
197
|
it('should cancel a tool call if the signal is aborted before confirmation', async () => {
|
|
@@ -401,7 +421,7 @@ describe('CoreToolScheduler', () => {
|
|
|
401
421
|
it('should mark tool call as cancelled when abort happens during confirmation error', async () => {
|
|
402
422
|
const abortController = new AbortController();
|
|
403
423
|
const abortError = new Error('Abort requested during confirmation');
|
|
404
|
-
const declarativeTool = new AbortDuringConfirmationTool(abortController, abortError);
|
|
424
|
+
const declarativeTool = new AbortDuringConfirmationTool(abortController, abortError, createMockMessageBus());
|
|
405
425
|
const mockToolRegistry = {
|
|
406
426
|
getTool: () => declarativeTool,
|
|
407
427
|
getFunctionDeclarations: () => [],
|
|
@@ -419,7 +439,7 @@ describe('CoreToolScheduler', () => {
|
|
|
419
439
|
const onToolCallsUpdate = vi.fn();
|
|
420
440
|
const mockConfig = createMockConfig({
|
|
421
441
|
getToolRegistry: () => mockToolRegistry,
|
|
422
|
-
isInteractive: () =>
|
|
442
|
+
isInteractive: () => true,
|
|
423
443
|
});
|
|
424
444
|
const scheduler = new CoreToolScheduler({
|
|
425
445
|
config: mockConfig,
|
|
@@ -493,35 +513,6 @@ describe('CoreToolScheduler', () => {
|
|
|
493
513
|
const errorMessage = errorParts[0].functionResponse.response.error;
|
|
494
514
|
expect(errorMessage).toContain('Tool execution for "mockTool" requires user confirmation, which is not supported in non-interactive mode.');
|
|
495
515
|
});
|
|
496
|
-
describe('getToolSuggestion', () => {
|
|
497
|
-
it('should suggest the top N closest tool names for a typo', () => {
|
|
498
|
-
// Create mocked tool registry
|
|
499
|
-
const mockToolRegistry = {
|
|
500
|
-
getAllToolNames: () => ['list_files', 'read_file', 'write_file'],
|
|
501
|
-
};
|
|
502
|
-
const mockConfig = createMockConfig({
|
|
503
|
-
getToolRegistry: () => mockToolRegistry,
|
|
504
|
-
isInteractive: () => false,
|
|
505
|
-
});
|
|
506
|
-
// Create scheduler
|
|
507
|
-
const scheduler = new CoreToolScheduler({
|
|
508
|
-
config: mockConfig,
|
|
509
|
-
getPreferredEditor: () => 'vscode',
|
|
510
|
-
});
|
|
511
|
-
// Test that the right tool is selected, with only 1 result, for typos
|
|
512
|
-
// @ts-expect-error accessing private method
|
|
513
|
-
const misspelledTool = scheduler.getToolSuggestion('list_fils', 1);
|
|
514
|
-
expect(misspelledTool).toBe(' Did you mean "list_files"?');
|
|
515
|
-
// Test that the right tool is selected, with only 1 result, for prefixes
|
|
516
|
-
// @ts-expect-error accessing private method
|
|
517
|
-
const prefixedTool = scheduler.getToolSuggestion('github.list_files', 1);
|
|
518
|
-
expect(prefixedTool).toBe(' Did you mean "list_files"?');
|
|
519
|
-
// Test that the right tool is first
|
|
520
|
-
// @ts-expect-error accessing private method
|
|
521
|
-
const suggestionMultiple = scheduler.getToolSuggestion('list_fils');
|
|
522
|
-
expect(suggestionMultiple).toBe(' Did you mean one of: "list_files", "read_file", "write_file"?');
|
|
523
|
-
});
|
|
524
|
-
});
|
|
525
516
|
});
|
|
526
517
|
describe('CoreToolScheduler with payload', () => {
|
|
527
518
|
it('should update args and diff and execute tool when payload is provided', async () => {
|
|
@@ -573,6 +564,10 @@ describe('CoreToolScheduler with payload', () => {
|
|
|
573
564
|
const payload = { newContent: 'final version' };
|
|
574
565
|
await confirmationDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce, payload);
|
|
575
566
|
}
|
|
567
|
+
// After internal update, the tool should be awaiting approval again with the NEW content.
|
|
568
|
+
const updatedAwaitingCall = (await waitForStatus(onToolCallsUpdate, 'awaiting_approval'));
|
|
569
|
+
// Now confirm for real to execute.
|
|
570
|
+
await updatedAwaitingCall.confirmationDetails.onConfirm(ToolConfirmationOutcome.ProceedOnce);
|
|
576
571
|
// Wait for the tool execution to complete
|
|
577
572
|
await vi.waitFor(() => {
|
|
578
573
|
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
@@ -585,226 +580,9 @@ describe('CoreToolScheduler with payload', () => {
|
|
|
585
580
|
});
|
|
586
581
|
});
|
|
587
582
|
});
|
|
588
|
-
describe('convertToFunctionResponse', () => {
|
|
589
|
-
const toolName = 'testTool';
|
|
590
|
-
const callId = 'call1';
|
|
591
|
-
it('should handle simple string llmContent', () => {
|
|
592
|
-
const llmContent = 'Simple text output';
|
|
593
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, DEFAULT_GEMINI_MODEL);
|
|
594
|
-
expect(result).toEqual([
|
|
595
|
-
{
|
|
596
|
-
functionResponse: {
|
|
597
|
-
name: toolName,
|
|
598
|
-
id: callId,
|
|
599
|
-
response: { output: 'Simple text output' },
|
|
600
|
-
},
|
|
601
|
-
},
|
|
602
|
-
]);
|
|
603
|
-
});
|
|
604
|
-
it('should handle llmContent as a single Part with text', () => {
|
|
605
|
-
const llmContent = { text: 'Text from Part object' };
|
|
606
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, DEFAULT_GEMINI_MODEL);
|
|
607
|
-
expect(result).toEqual([
|
|
608
|
-
{
|
|
609
|
-
functionResponse: {
|
|
610
|
-
name: toolName,
|
|
611
|
-
id: callId,
|
|
612
|
-
response: { output: 'Text from Part object' },
|
|
613
|
-
},
|
|
614
|
-
},
|
|
615
|
-
]);
|
|
616
|
-
});
|
|
617
|
-
it('should handle llmContent as a PartListUnion array with a single text Part', () => {
|
|
618
|
-
const llmContent = [{ text: 'Text from array' }];
|
|
619
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, DEFAULT_GEMINI_MODEL);
|
|
620
|
-
expect(result).toEqual([
|
|
621
|
-
{
|
|
622
|
-
functionResponse: {
|
|
623
|
-
name: toolName,
|
|
624
|
-
id: callId,
|
|
625
|
-
response: { output: 'Text from array' },
|
|
626
|
-
},
|
|
627
|
-
},
|
|
628
|
-
]);
|
|
629
|
-
});
|
|
630
|
-
it('should handle llmContent as a PartListUnion array with multiple Parts', () => {
|
|
631
|
-
const llmContent = [{ text: 'part1' }, { text: 'part2' }];
|
|
632
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, DEFAULT_GEMINI_MODEL);
|
|
633
|
-
expect(result).toEqual([
|
|
634
|
-
{
|
|
635
|
-
functionResponse: {
|
|
636
|
-
name: toolName,
|
|
637
|
-
id: callId,
|
|
638
|
-
response: { output: 'part1\npart2' },
|
|
639
|
-
},
|
|
640
|
-
},
|
|
641
|
-
]);
|
|
642
|
-
});
|
|
643
|
-
it('should handle llmContent with fileData for Gemini 3 model (should be siblings)', () => {
|
|
644
|
-
const llmContent = {
|
|
645
|
-
fileData: { mimeType: 'application/pdf', fileUri: 'gs://...' },
|
|
646
|
-
};
|
|
647
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, PREVIEW_GEMINI_MODEL);
|
|
648
|
-
expect(result).toEqual([
|
|
649
|
-
{
|
|
650
|
-
functionResponse: {
|
|
651
|
-
name: toolName,
|
|
652
|
-
id: callId,
|
|
653
|
-
response: { output: 'Binary content provided (1 item(s)).' },
|
|
654
|
-
},
|
|
655
|
-
},
|
|
656
|
-
llmContent,
|
|
657
|
-
]);
|
|
658
|
-
});
|
|
659
|
-
it('should handle llmContent with inlineData for Gemini 3 model (should be nested)', () => {
|
|
660
|
-
const llmContent = {
|
|
661
|
-
inlineData: { mimeType: 'image/png', data: 'base64...' },
|
|
662
|
-
};
|
|
663
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, PREVIEW_GEMINI_MODEL);
|
|
664
|
-
expect(result).toEqual([
|
|
665
|
-
{
|
|
666
|
-
functionResponse: {
|
|
667
|
-
name: toolName,
|
|
668
|
-
id: callId,
|
|
669
|
-
response: { output: 'Binary content provided (1 item(s)).' },
|
|
670
|
-
parts: [llmContent],
|
|
671
|
-
},
|
|
672
|
-
},
|
|
673
|
-
]);
|
|
674
|
-
});
|
|
675
|
-
it('should handle llmContent with fileData for non-Gemini 3 models', () => {
|
|
676
|
-
const llmContent = {
|
|
677
|
-
fileData: { mimeType: 'application/pdf', fileUri: 'gs://...' },
|
|
678
|
-
};
|
|
679
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, DEFAULT_GEMINI_MODEL);
|
|
680
|
-
expect(result).toEqual([
|
|
681
|
-
{
|
|
682
|
-
functionResponse: {
|
|
683
|
-
name: toolName,
|
|
684
|
-
id: callId,
|
|
685
|
-
response: { output: 'Binary content provided (1 item(s)).' },
|
|
686
|
-
},
|
|
687
|
-
},
|
|
688
|
-
llmContent,
|
|
689
|
-
]);
|
|
690
|
-
});
|
|
691
|
-
it('should preserve existing functionResponse metadata', () => {
|
|
692
|
-
const innerId = 'inner-call-id';
|
|
693
|
-
const innerName = 'inner-tool-name';
|
|
694
|
-
const responseMetadata = {
|
|
695
|
-
flags: ['flag1'],
|
|
696
|
-
isError: false,
|
|
697
|
-
customData: { key: 'value' },
|
|
698
|
-
};
|
|
699
|
-
const input = {
|
|
700
|
-
functionResponse: {
|
|
701
|
-
id: innerId,
|
|
702
|
-
name: innerName,
|
|
703
|
-
response: responseMetadata,
|
|
704
|
-
},
|
|
705
|
-
};
|
|
706
|
-
const result = convertToFunctionResponse(toolName, callId, input, DEFAULT_GEMINI_MODEL);
|
|
707
|
-
expect(result).toHaveLength(1);
|
|
708
|
-
expect(result[0].functionResponse).toEqual({
|
|
709
|
-
id: callId,
|
|
710
|
-
name: toolName,
|
|
711
|
-
response: responseMetadata,
|
|
712
|
-
});
|
|
713
|
-
});
|
|
714
|
-
it('should handle llmContent as an array of multiple Parts (text and inlineData)', () => {
|
|
715
|
-
const llmContent = [
|
|
716
|
-
{ text: 'Some textual description' },
|
|
717
|
-
{ inlineData: { mimeType: 'image/jpeg', data: 'base64data...' } },
|
|
718
|
-
{ text: 'Another text part' },
|
|
719
|
-
];
|
|
720
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, PREVIEW_GEMINI_MODEL);
|
|
721
|
-
expect(result).toEqual([
|
|
722
|
-
{
|
|
723
|
-
functionResponse: {
|
|
724
|
-
name: toolName,
|
|
725
|
-
id: callId,
|
|
726
|
-
response: {
|
|
727
|
-
output: 'Some textual description\nAnother text part',
|
|
728
|
-
},
|
|
729
|
-
parts: [
|
|
730
|
-
{ inlineData: { mimeType: 'image/jpeg', data: 'base64data...' } },
|
|
731
|
-
],
|
|
732
|
-
},
|
|
733
|
-
},
|
|
734
|
-
]);
|
|
735
|
-
});
|
|
736
|
-
it('should handle llmContent as an array with a single inlineData Part', () => {
|
|
737
|
-
const llmContent = [
|
|
738
|
-
{ inlineData: { mimeType: 'image/gif', data: 'gifdata...' } },
|
|
739
|
-
];
|
|
740
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, PREVIEW_GEMINI_MODEL);
|
|
741
|
-
expect(result).toEqual([
|
|
742
|
-
{
|
|
743
|
-
functionResponse: {
|
|
744
|
-
name: toolName,
|
|
745
|
-
id: callId,
|
|
746
|
-
response: { output: 'Binary content provided (1 item(s)).' },
|
|
747
|
-
parts: llmContent,
|
|
748
|
-
},
|
|
749
|
-
},
|
|
750
|
-
]);
|
|
751
|
-
});
|
|
752
|
-
it('should handle llmContent as a generic Part (not text, inlineData, or fileData)', () => {
|
|
753
|
-
const llmContent = { functionCall: { name: 'test', args: {} } };
|
|
754
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, PREVIEW_GEMINI_MODEL);
|
|
755
|
-
expect(result).toEqual([
|
|
756
|
-
{
|
|
757
|
-
functionResponse: {
|
|
758
|
-
name: toolName,
|
|
759
|
-
id: callId,
|
|
760
|
-
response: {},
|
|
761
|
-
},
|
|
762
|
-
},
|
|
763
|
-
]);
|
|
764
|
-
});
|
|
765
|
-
it('should handle empty string llmContent', () => {
|
|
766
|
-
const llmContent = '';
|
|
767
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, PREVIEW_GEMINI_MODEL);
|
|
768
|
-
expect(result).toEqual([
|
|
769
|
-
{
|
|
770
|
-
functionResponse: {
|
|
771
|
-
name: toolName,
|
|
772
|
-
id: callId,
|
|
773
|
-
response: { output: '' },
|
|
774
|
-
},
|
|
775
|
-
},
|
|
776
|
-
]);
|
|
777
|
-
});
|
|
778
|
-
it('should handle llmContent as an empty array', () => {
|
|
779
|
-
const llmContent = [];
|
|
780
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, PREVIEW_GEMINI_MODEL);
|
|
781
|
-
expect(result).toEqual([
|
|
782
|
-
{
|
|
783
|
-
functionResponse: {
|
|
784
|
-
name: toolName,
|
|
785
|
-
id: callId,
|
|
786
|
-
response: {},
|
|
787
|
-
},
|
|
788
|
-
},
|
|
789
|
-
]);
|
|
790
|
-
});
|
|
791
|
-
it('should handle llmContent as a Part with undefined inlineData/fileData/text', () => {
|
|
792
|
-
const llmContent = {}; // An empty part object
|
|
793
|
-
const result = convertToFunctionResponse(toolName, callId, llmContent, PREVIEW_GEMINI_MODEL);
|
|
794
|
-
expect(result).toEqual([
|
|
795
|
-
{
|
|
796
|
-
functionResponse: {
|
|
797
|
-
name: toolName,
|
|
798
|
-
id: callId,
|
|
799
|
-
response: {},
|
|
800
|
-
},
|
|
801
|
-
},
|
|
802
|
-
]);
|
|
803
|
-
});
|
|
804
|
-
});
|
|
805
583
|
class MockEditToolInvocation extends BaseToolInvocation {
|
|
806
|
-
constructor(params) {
|
|
807
|
-
super(params);
|
|
584
|
+
constructor(params, messageBus) {
|
|
585
|
+
super(params, messageBus);
|
|
808
586
|
}
|
|
809
587
|
getDescription() {
|
|
810
588
|
return 'A mock edit tool invocation';
|
|
@@ -829,16 +607,16 @@ class MockEditToolInvocation extends BaseToolInvocation {
|
|
|
829
607
|
}
|
|
830
608
|
}
|
|
831
609
|
class MockEditTool extends BaseDeclarativeTool {
|
|
832
|
-
constructor() {
|
|
833
|
-
super('mockEditTool', 'mockEditTool', 'A mock edit tool', Kind.Edit, {});
|
|
610
|
+
constructor(messageBus) {
|
|
611
|
+
super('mockEditTool', 'mockEditTool', 'A mock edit tool', Kind.Edit, {}, messageBus);
|
|
834
612
|
}
|
|
835
|
-
createInvocation(params) {
|
|
836
|
-
return new MockEditToolInvocation(params);
|
|
613
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
614
|
+
return new MockEditToolInvocation(params, messageBus);
|
|
837
615
|
}
|
|
838
616
|
}
|
|
839
617
|
describe('CoreToolScheduler edit cancellation', () => {
|
|
840
618
|
it('should preserve diff when an edit is cancelled', async () => {
|
|
841
|
-
const mockEditTool = new MockEditTool();
|
|
619
|
+
const mockEditTool = new MockEditTool(createMockMessageBus());
|
|
842
620
|
const mockToolRegistry = {
|
|
843
621
|
getTool: () => mockEditTool,
|
|
844
622
|
getFunctionDeclarations: () => [],
|
|
@@ -1109,6 +887,11 @@ describe('CoreToolScheduler request queueing', () => {
|
|
|
1109
887
|
getShellExecutionConfig: () => ({
|
|
1110
888
|
terminalWidth: 80,
|
|
1111
889
|
terminalHeight: 24,
|
|
890
|
+
sanitizationConfig: {
|
|
891
|
+
enableEnvironmentVariableRedaction: true,
|
|
892
|
+
allowedEnvironmentVariables: [],
|
|
893
|
+
blockedEnvironmentVariables: [],
|
|
894
|
+
},
|
|
1112
895
|
}),
|
|
1113
896
|
isInteractive: () => false,
|
|
1114
897
|
});
|
|
@@ -1164,9 +947,6 @@ describe('CoreToolScheduler request queueing', () => {
|
|
|
1164
947
|
}
|
|
1165
948
|
});
|
|
1166
949
|
it('should require approval for a chained shell command even when prefix is allowlisted', async () => {
|
|
1167
|
-
expect(isShellInvocationAllowlisted({
|
|
1168
|
-
params: { command: 'git status && rm -rf /tmp/should-not-run' },
|
|
1169
|
-
}, ['run_shell_command(git)'])).toBe(false);
|
|
1170
950
|
const executeFn = vi.fn().mockResolvedValue({
|
|
1171
951
|
llmContent: 'Shell command executed',
|
|
1172
952
|
returnDisplay: 'Shell command executed',
|
|
@@ -1202,9 +982,17 @@ describe('CoreToolScheduler request queueing', () => {
|
|
|
1202
982
|
getShellExecutionConfig: () => ({
|
|
1203
983
|
terminalWidth: 80,
|
|
1204
984
|
terminalHeight: 24,
|
|
985
|
+
sanitizationConfig: {
|
|
986
|
+
enableEnvironmentVariableRedaction: true,
|
|
987
|
+
allowedEnvironmentVariables: [],
|
|
988
|
+
blockedEnvironmentVariables: [],
|
|
989
|
+
},
|
|
1205
990
|
}),
|
|
1206
991
|
getToolRegistry: () => toolRegistry,
|
|
1207
992
|
getHookSystem: () => undefined,
|
|
993
|
+
getPolicyEngine: () => ({
|
|
994
|
+
check: async () => ({ decision: PolicyDecision.ASK_USER }),
|
|
995
|
+
}),
|
|
1208
996
|
});
|
|
1209
997
|
const scheduler = new CoreToolScheduler({
|
|
1210
998
|
config: mockConfig,
|
|
@@ -1307,7 +1095,7 @@ describe('CoreToolScheduler request queueing', () => {
|
|
|
1307
1095
|
mockConfig.getHookSystem = vi
|
|
1308
1096
|
.fn()
|
|
1309
1097
|
.mockReturnValue(new HookSystem(mockConfig));
|
|
1310
|
-
const testTool = new TestApprovalTool(mockConfig);
|
|
1098
|
+
const testTool = new TestApprovalTool(mockConfig, mockMessageBus);
|
|
1311
1099
|
const toolRegistry = {
|
|
1312
1100
|
getTool: () => testTool,
|
|
1313
1101
|
getFunctionDeclarations: () => [],
|
|
@@ -1662,119 +1450,189 @@ describe('CoreToolScheduler Sequential Execution', () => {
|
|
|
1662
1450
|
});
|
|
1663
1451
|
modifyWithEditorSpy.mockRestore();
|
|
1664
1452
|
});
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
const
|
|
1687
|
-
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
|
|
1700
|
-
|
|
1701
|
-
const
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
}
|
|
1711
|
-
const expectedFileContent = wrappedLines.join('\n');
|
|
1712
|
-
const result = await truncateAndSaveToFile(content, callId, projectTempDir, THRESHOLD, TRUNCATE_LINES);
|
|
1713
|
-
expect(result.outputFile).toBe(path.join(projectTempDir, `${callId}.output`));
|
|
1714
|
-
// Check that the file was written with the wrapped content
|
|
1715
|
-
expect(mockWriteFile).toHaveBeenCalledWith(path.join(projectTempDir, `${callId}.output`), expectedFileContent);
|
|
1716
|
-
// Should contain the first and last lines with 1/5 head and 4/5 tail of the wrapped content
|
|
1717
|
-
const head = Math.floor(TRUNCATE_LINES / 5);
|
|
1718
|
-
const beginning = wrappedLines.slice(0, head);
|
|
1719
|
-
const end = wrappedLines.slice(-(TRUNCATE_LINES - head));
|
|
1720
|
-
const expectedTruncated = beginning.join('\n') + '\n... [CONTENT TRUNCATED] ...\n' + end.join('\n');
|
|
1721
|
-
expect(result.content).toContain('Tool output was too large and has been truncated');
|
|
1722
|
-
expect(result.content).toContain('Truncated part of the output:');
|
|
1723
|
-
expect(result.content).toContain(expectedTruncated);
|
|
1724
|
-
});
|
|
1725
|
-
it('should handle file write errors gracefully', async () => {
|
|
1726
|
-
const content = 'a'.repeat(2_000_000);
|
|
1727
|
-
const callId = 'test-call-id';
|
|
1728
|
-
const projectTempDir = '/tmp';
|
|
1729
|
-
mockWriteFile.mockRejectedValue(new Error('File write failed'));
|
|
1730
|
-
const result = await truncateAndSaveToFile(content, callId, projectTempDir, THRESHOLD, TRUNCATE_LINES);
|
|
1731
|
-
expect(result.outputFile).toBeUndefined();
|
|
1732
|
-
expect(result.content).toContain('[Note: Could not save full output to file]');
|
|
1733
|
-
expect(mockWriteFile).toHaveBeenCalled();
|
|
1734
|
-
});
|
|
1735
|
-
it('should save to correct file path with call ID', async () => {
|
|
1736
|
-
const content = 'a'.repeat(200_000);
|
|
1737
|
-
const callId = 'unique-call-123';
|
|
1738
|
-
const projectTempDir = '/custom/temp/dir';
|
|
1739
|
-
const wrapWidth = 120;
|
|
1740
|
-
mockWriteFile.mockResolvedValue(undefined);
|
|
1741
|
-
// Manually wrap the content to generate the expected file content
|
|
1742
|
-
const wrappedLines = [];
|
|
1743
|
-
for (let i = 0; i < content.length; i += wrapWidth) {
|
|
1744
|
-
wrappedLines.push(content.substring(i, i + wrapWidth));
|
|
1745
|
-
}
|
|
1746
|
-
const expectedFileContent = wrappedLines.join('\n');
|
|
1747
|
-
const result = await truncateAndSaveToFile(content, callId, projectTempDir, THRESHOLD, TRUNCATE_LINES);
|
|
1748
|
-
const expectedPath = path.join(projectTempDir, `${callId}.output`);
|
|
1749
|
-
expect(result.outputFile).toBe(expectedPath);
|
|
1750
|
-
expect(mockWriteFile).toHaveBeenCalledWith(expectedPath, expectedFileContent);
|
|
1453
|
+
it('should pass serverName to policy engine for DiscoveredMCPTool', async () => {
|
|
1454
|
+
const mockMcpTool = {
|
|
1455
|
+
tool: async () => ({ functionDeclarations: [] }),
|
|
1456
|
+
callTool: async () => [],
|
|
1457
|
+
};
|
|
1458
|
+
const serverName = 'test-server';
|
|
1459
|
+
const toolName = 'test-tool';
|
|
1460
|
+
const mcpTool = new DiscoveredMCPTool(mockMcpTool, serverName, toolName, 'description', { type: 'object', properties: {} }, createMockMessageBus());
|
|
1461
|
+
const mockToolRegistry = {
|
|
1462
|
+
getTool: () => mcpTool,
|
|
1463
|
+
getFunctionDeclarations: () => [],
|
|
1464
|
+
tools: new Map(),
|
|
1465
|
+
discovery: {},
|
|
1466
|
+
registerTool: () => { },
|
|
1467
|
+
getToolByName: () => mcpTool,
|
|
1468
|
+
getToolByDisplayName: () => mcpTool,
|
|
1469
|
+
getTools: () => [],
|
|
1470
|
+
discoverTools: async () => { },
|
|
1471
|
+
getAllTools: () => [],
|
|
1472
|
+
getToolsByServer: () => [],
|
|
1473
|
+
};
|
|
1474
|
+
const mockPolicyEngineCheck = vi.fn().mockResolvedValue({
|
|
1475
|
+
decision: PolicyDecision.ALLOW,
|
|
1476
|
+
});
|
|
1477
|
+
const mockConfig = createMockConfig({
|
|
1478
|
+
getToolRegistry: () => mockToolRegistry,
|
|
1479
|
+
getPolicyEngine: () => ({
|
|
1480
|
+
check: mockPolicyEngineCheck,
|
|
1481
|
+
}),
|
|
1482
|
+
isInteractive: () => false,
|
|
1483
|
+
});
|
|
1484
|
+
const scheduler = new CoreToolScheduler({
|
|
1485
|
+
config: mockConfig,
|
|
1486
|
+
getPreferredEditor: () => 'vscode',
|
|
1487
|
+
});
|
|
1488
|
+
const abortController = new AbortController();
|
|
1489
|
+
const request = {
|
|
1490
|
+
callId: '1',
|
|
1491
|
+
name: toolName,
|
|
1492
|
+
args: {},
|
|
1493
|
+
isClientInitiated: false,
|
|
1494
|
+
prompt_id: 'prompt-id-1',
|
|
1495
|
+
};
|
|
1496
|
+
await scheduler.schedule(request, abortController.signal);
|
|
1497
|
+
expect(mockPolicyEngineCheck).toHaveBeenCalledWith(expect.objectContaining({ name: toolName }), serverName);
|
|
1751
1498
|
});
|
|
1752
|
-
it('should
|
|
1753
|
-
|
|
1754
|
-
const
|
|
1755
|
-
const
|
|
1756
|
-
|
|
1757
|
-
const
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1499
|
+
it('should not double-report completed tools when concurrent completions occur', async () => {
|
|
1500
|
+
// Arrange
|
|
1501
|
+
const executeFn = vi.fn().mockResolvedValue({ llmContent: 'success' });
|
|
1502
|
+
const mockTool = new MockTool({ name: 'mockTool', execute: executeFn });
|
|
1503
|
+
const declarativeTool = mockTool;
|
|
1504
|
+
const mockToolRegistry = {
|
|
1505
|
+
getTool: () => declarativeTool,
|
|
1506
|
+
getToolByName: () => declarativeTool,
|
|
1507
|
+
getFunctionDeclarations: () => [],
|
|
1508
|
+
tools: new Map(),
|
|
1509
|
+
discovery: {},
|
|
1510
|
+
registerTool: () => { },
|
|
1511
|
+
getToolByDisplayName: () => declarativeTool,
|
|
1512
|
+
getTools: () => [],
|
|
1513
|
+
discoverTools: async () => { },
|
|
1514
|
+
getAllTools: () => [],
|
|
1515
|
+
getToolsByServer: () => [],
|
|
1516
|
+
};
|
|
1517
|
+
let completionCallCount = 0;
|
|
1518
|
+
const onAllToolCallsComplete = vi.fn().mockImplementation(async () => {
|
|
1519
|
+
completionCallCount++;
|
|
1520
|
+
// Simulate slow reporting (e.g. Gemini API call)
|
|
1521
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
1522
|
+
});
|
|
1523
|
+
const mockConfig = createMockConfig({
|
|
1524
|
+
getToolRegistry: () => mockToolRegistry,
|
|
1525
|
+
getApprovalMode: () => ApprovalMode.YOLO,
|
|
1526
|
+
isInteractive: () => false,
|
|
1527
|
+
});
|
|
1528
|
+
const mockMessageBus = createMockMessageBus();
|
|
1529
|
+
mockConfig.getMessageBus = vi.fn().mockReturnValue(mockMessageBus);
|
|
1530
|
+
mockConfig.getEnableHooks = vi.fn().mockReturnValue(false);
|
|
1531
|
+
mockConfig.getHookSystem = vi
|
|
1532
|
+
.fn()
|
|
1533
|
+
.mockReturnValue(new HookSystem(mockConfig));
|
|
1534
|
+
const scheduler = new CoreToolScheduler({
|
|
1535
|
+
config: mockConfig,
|
|
1536
|
+
onAllToolCallsComplete,
|
|
1537
|
+
getPreferredEditor: () => 'vscode',
|
|
1538
|
+
});
|
|
1539
|
+
const abortController = new AbortController();
|
|
1540
|
+
const request = {
|
|
1541
|
+
callId: '1',
|
|
1542
|
+
name: 'mockTool',
|
|
1543
|
+
args: {},
|
|
1544
|
+
isClientInitiated: false,
|
|
1545
|
+
prompt_id: 'prompt-1',
|
|
1546
|
+
};
|
|
1547
|
+
// Act
|
|
1548
|
+
// 1. Start execution
|
|
1549
|
+
const schedulePromise = scheduler.schedule([request], abortController.signal);
|
|
1550
|
+
// 2. Wait just enough for it to finish and enter checkAndNotifyCompletion
|
|
1551
|
+
// (awaiting our slow mock)
|
|
1552
|
+
await vi.waitFor(() => {
|
|
1553
|
+
expect(completionCallCount).toBe(1);
|
|
1554
|
+
});
|
|
1555
|
+
// 3. Trigger a concurrent completion event (e.g. via cancelAll)
|
|
1556
|
+
scheduler.cancelAll(abortController.signal);
|
|
1557
|
+
await schedulePromise;
|
|
1558
|
+
// Assert
|
|
1559
|
+
// Even though cancelAll was called while the first completion was in progress,
|
|
1560
|
+
// it should not have triggered a SECOND completion call because the first one
|
|
1561
|
+
// was still 'finalizing' and will drain any new tools.
|
|
1562
|
+
expect(onAllToolCallsComplete).toHaveBeenCalledTimes(1);
|
|
1762
1563
|
});
|
|
1763
|
-
it('should
|
|
1764
|
-
|
|
1765
|
-
const
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
const
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
|
|
1564
|
+
it('should complete reporting all tools even mid-callback during abort', async () => {
|
|
1565
|
+
// Arrange
|
|
1566
|
+
const onAllToolCallsComplete = vi.fn().mockImplementation(async () => {
|
|
1567
|
+
// Simulate slow reporting
|
|
1568
|
+
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
1569
|
+
});
|
|
1570
|
+
const mockTool = new MockTool({ name: 'mockTool' });
|
|
1571
|
+
const mockToolRegistry = {
|
|
1572
|
+
getTool: () => mockTool,
|
|
1573
|
+
getToolByName: () => mockTool,
|
|
1574
|
+
getFunctionDeclarations: () => [],
|
|
1575
|
+
tools: new Map(),
|
|
1576
|
+
discovery: {},
|
|
1577
|
+
registerTool: () => { },
|
|
1578
|
+
getToolByDisplayName: () => mockTool,
|
|
1579
|
+
getTools: () => [],
|
|
1580
|
+
discoverTools: async () => { },
|
|
1581
|
+
getAllTools: () => [],
|
|
1582
|
+
getToolsByServer: () => [],
|
|
1583
|
+
};
|
|
1584
|
+
const mockConfig = createMockConfig({
|
|
1585
|
+
getToolRegistry: () => mockToolRegistry,
|
|
1586
|
+
getApprovalMode: () => ApprovalMode.YOLO,
|
|
1587
|
+
isInteractive: () => false,
|
|
1588
|
+
});
|
|
1589
|
+
const scheduler = new CoreToolScheduler({
|
|
1590
|
+
config: mockConfig,
|
|
1591
|
+
onAllToolCallsComplete,
|
|
1592
|
+
getPreferredEditor: () => 'vscode',
|
|
1593
|
+
});
|
|
1594
|
+
const abortController = new AbortController();
|
|
1595
|
+
const signal = abortController.signal;
|
|
1596
|
+
// Act
|
|
1597
|
+
// 1. Start execution of two tools
|
|
1598
|
+
const schedulePromise = scheduler.schedule([
|
|
1599
|
+
{
|
|
1600
|
+
callId: '1',
|
|
1601
|
+
name: 'mockTool',
|
|
1602
|
+
args: {},
|
|
1603
|
+
isClientInitiated: false,
|
|
1604
|
+
prompt_id: 'prompt-1',
|
|
1605
|
+
},
|
|
1606
|
+
{
|
|
1607
|
+
callId: '2',
|
|
1608
|
+
name: 'mockTool',
|
|
1609
|
+
args: {},
|
|
1610
|
+
isClientInitiated: false,
|
|
1611
|
+
prompt_id: 'prompt-1',
|
|
1612
|
+
},
|
|
1613
|
+
], signal);
|
|
1614
|
+
// 2. Wait for reporting to start
|
|
1615
|
+
await vi.waitFor(() => {
|
|
1616
|
+
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
1617
|
+
});
|
|
1618
|
+
// 3. Abort the signal while reporting is in progress
|
|
1619
|
+
abortController.abort();
|
|
1620
|
+
await schedulePromise;
|
|
1621
|
+
// Assert
|
|
1622
|
+
// Verify that onAllToolCallsComplete was called and processed the tools,
|
|
1623
|
+
// and that the scheduler didn't just drop them because of the abort.
|
|
1624
|
+
expect(onAllToolCallsComplete).toHaveBeenCalled();
|
|
1625
|
+
const reportedTools = onAllToolCallsComplete.mock.calls.flatMap((call) =>
|
|
1626
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1627
|
+
call[0].map((t) => t.request.callId));
|
|
1628
|
+
// Both tools should have been reported exactly once with success status
|
|
1629
|
+
expect(reportedTools).toContain('1');
|
|
1630
|
+
expect(reportedTools).toContain('2');
|
|
1631
|
+
const allStatuses = onAllToolCallsComplete.mock.calls.flatMap((call) =>
|
|
1632
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
1633
|
+
call[0].map((t) => t.status));
|
|
1634
|
+
expect(allStatuses).toEqual(['success', 'success']);
|
|
1635
|
+
expect(onAllToolCallsComplete).toHaveBeenCalledTimes(1);
|
|
1778
1636
|
});
|
|
1779
1637
|
});
|
|
1780
1638
|
//# sourceMappingURL=coreToolScheduler.test.js.map
|