@machina.ai/cell-cli-core 1.36.0-rc1 → 1.38.1-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 +3 -10
- package/dist/docs/assets/theme-tokyonight-dark.png +0 -0
- package/dist/docs/changelogs/index.md +49 -0
- package/dist/docs/changelogs/latest.md +355 -458
- package/dist/docs/changelogs/preview.md +402 -363
- package/dist/docs/cli/acp-mode.md +126 -0
- package/dist/docs/cli/cli-reference.md +1 -1
- package/dist/docs/cli/notifications.md +5 -5
- package/dist/docs/cli/plan-mode.md +26 -10
- package/dist/docs/cli/sandbox.md +53 -1
- package/dist/docs/cli/settings.md +52 -48
- package/dist/docs/cli/themes.md +5 -0
- package/dist/docs/core/index.md +2 -2
- package/dist/docs/core/remote-agents.md +14 -18
- package/dist/docs/core/subagents.md +194 -47
- package/dist/docs/get-started/authentication.md +2 -2
- package/dist/docs/get-started/gemini-3.md +1 -1
- package/dist/docs/get-started/index.md +127 -1
- package/dist/docs/get-started/installation.md +7 -0
- package/dist/docs/hooks/index.md +6 -6
- package/dist/docs/ide-integration/index.md +99 -24
- package/dist/docs/index.md +0 -2
- package/dist/docs/redirects.json +1 -0
- package/dist/docs/reference/commands.md +1 -3
- package/dist/docs/reference/configuration.md +220 -99
- package/dist/docs/reference/keyboard-shortcuts.md +21 -8
- package/dist/docs/reference/policy-engine.md +36 -31
- package/dist/docs/reference/tools.md +56 -23
- package/dist/docs/release-confidence.md +0 -6
- package/dist/docs/releases.md +4 -0
- package/dist/docs/resources/quota-and-pricing.md +23 -9
- package/dist/docs/sidebar.json +11 -4
- package/dist/docs/tools/mcp-server.md +3 -3
- package/dist/docs/tools/planning.md +6 -4
- package/dist/docs/tools/web-fetch.md +3 -0
- package/dist/package.json +2 -1
- package/dist/src/agent/agent-session.test.js +14 -6
- package/dist/src/agent/agent-session.test.js.map +1 -1
- package/dist/src/agent/event-translator.js +2 -1
- package/dist/src/agent/event-translator.js.map +1 -1
- package/dist/src/agent/event-translator.test.js +1 -0
- package/dist/src/agent/event-translator.test.js.map +1 -1
- package/dist/src/agent/legacy-agent-session.d.ts +47 -4
- package/dist/src/agent/legacy-agent-session.js +38 -15
- package/dist/src/agent/legacy-agent-session.js.map +1 -1
- package/dist/src/agent/legacy-agent-session.test.js +60 -73
- package/dist/src/agent/legacy-agent-session.test.js.map +1 -1
- package/dist/src/agent/mock.js +7 -1
- package/dist/src/agent/mock.js.map +1 -1
- package/dist/src/agent/mock.test.js +1 -1
- package/dist/src/agent/mock.test.js.map +1 -1
- package/dist/src/agent/types.d.ts +34 -1
- package/dist/src/agents/a2a-client-manager.js +3 -3
- package/dist/src/agents/a2a-client-manager.js.map +1 -1
- package/dist/src/agents/agent-scheduler.js +6 -1
- package/dist/src/agents/agent-scheduler.js.map +1 -1
- package/dist/src/agents/agent-scheduler.test.js +38 -0
- package/dist/src/agents/agent-scheduler.test.js.map +1 -1
- package/dist/src/agents/agentLoader.d.ts +12 -12
- package/dist/src/agents/agentLoader.js +1 -0
- package/dist/src/agents/agentLoader.js.map +1 -1
- package/dist/src/agents/auth-provider/api-key-provider.test.js +18 -2
- package/dist/src/agents/auth-provider/api-key-provider.test.js.map +1 -1
- package/dist/src/agents/auth-provider/value-resolver.test.js +30 -0
- package/dist/src/agents/auth-provider/value-resolver.test.js.map +1 -1
- package/dist/src/agents/browser/analyzeScreenshot.js +36 -6
- package/dist/src/agents/browser/analyzeScreenshot.js.map +1 -1
- package/dist/src/agents/browser/analyzeScreenshot.test.js +35 -3
- package/dist/src/agents/browser/analyzeScreenshot.test.js.map +1 -1
- package/dist/src/agents/browser/automationOverlay.js +2 -10
- package/dist/src/agents/browser/automationOverlay.js.map +1 -1
- package/dist/src/agents/browser/browserAgentDefinition.js +10 -3
- package/dist/src/agents/browser/browserAgentDefinition.js.map +1 -1
- package/dist/src/agents/browser/browserAgentFactory.d.ts +11 -3
- package/dist/src/agents/browser/browserAgentFactory.js +171 -129
- package/dist/src/agents/browser/browserAgentFactory.js.map +1 -1
- package/dist/src/agents/browser/browserAgentFactory.test.js +99 -13
- package/dist/src/agents/browser/browserAgentFactory.test.js.map +1 -1
- package/dist/src/agents/browser/browserAgentInvocation.d.ts +1 -0
- package/dist/src/agents/browser/browserAgentInvocation.js +87 -27
- package/dist/src/agents/browser/browserAgentInvocation.js.map +1 -1
- package/dist/src/agents/browser/browserAgentInvocation.test.js +107 -7
- package/dist/src/agents/browser/browserAgentInvocation.test.js.map +1 -1
- package/dist/src/agents/browser/browserManager.d.ts +89 -8
- package/dist/src/agents/browser/browserManager.js +357 -74
- package/dist/src/agents/browser/browserManager.js.map +1 -1
- package/dist/src/agents/browser/browserManager.test.js +540 -19
- package/dist/src/agents/browser/browserManager.test.js.map +1 -1
- package/dist/src/agents/browser/inputBlocker.d.ts +4 -4
- package/dist/src/agents/browser/inputBlocker.js +8 -18
- package/dist/src/agents/browser/inputBlocker.js.map +1 -1
- package/dist/src/agents/browser/inputBlocker.test.js +31 -3
- package/dist/src/agents/browser/inputBlocker.test.js.map +1 -1
- package/dist/src/agents/browser/mcpToolWrapper.d.ts +1 -1
- package/dist/src/agents/browser/mcpToolWrapper.js +9 -6
- package/dist/src/agents/browser/mcpToolWrapper.js.map +1 -1
- package/dist/src/agents/browser/mcpToolWrapper.test.js +2 -2
- package/dist/src/agents/browser/mcpToolWrapper.test.js.map +1 -1
- package/dist/src/agents/browser/modelAvailability.d.ts +5 -0
- package/dist/src/agents/browser/modelAvailability.js +12 -0
- package/dist/src/agents/browser/modelAvailability.js.map +1 -1
- package/dist/src/agents/browser/snapshotSuperseder.d.ts +31 -0
- package/dist/src/agents/browser/snapshotSuperseder.js +101 -0
- package/dist/src/agents/browser/snapshotSuperseder.js.map +1 -0
- package/dist/src/agents/browser/snapshotSuperseder.test.js +158 -0
- package/dist/src/agents/browser/snapshotSuperseder.test.js.map +1 -0
- package/dist/src/agents/local-executor.d.ts +9 -0
- package/dist/src/agents/local-executor.js +144 -200
- package/dist/src/agents/local-executor.js.map +1 -1
- package/dist/src/agents/local-executor.test.js +500 -115
- package/dist/src/agents/local-executor.test.js.map +1 -1
- package/dist/src/agents/local-invocation.d.ts +1 -0
- package/dist/src/agents/local-invocation.js +19 -9
- package/dist/src/agents/local-invocation.js.map +1 -1
- package/dist/src/agents/local-invocation.test.js +24 -0
- package/dist/src/agents/local-invocation.test.js.map +1 -1
- package/dist/src/agents/memory-manager-agent.js +1 -0
- package/dist/src/agents/memory-manager-agent.js.map +1 -1
- package/dist/src/agents/memory-manager-agent.test.js +6 -0
- package/dist/src/agents/memory-manager-agent.test.js.map +1 -1
- package/dist/src/agents/registry.js +19 -11
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/registry.test.js +67 -0
- package/dist/src/agents/registry.test.js.map +1 -1
- package/dist/src/agents/skill-extraction-agent.d.ts +24 -0
- package/dist/src/agents/skill-extraction-agent.js +269 -0
- package/dist/src/agents/skill-extraction-agent.js.map +1 -0
- package/dist/src/agents/types.d.ts +20 -0
- package/dist/src/agents/types.js.map +1 -1
- package/dist/src/availability/policyCatalog.d.ts +2 -1
- package/dist/src/availability/policyCatalog.js +1 -1
- package/dist/src/availability/policyCatalog.js.map +1 -1
- package/dist/src/availability/policyHelpers.js +43 -32
- package/dist/src/availability/policyHelpers.js.map +1 -1
- package/dist/src/availability/policyHelpers.test.js +12 -1
- package/dist/src/availability/policyHelpers.test.js.map +1 -1
- package/dist/src/code_assist/admin/admin_controls.js +1 -1
- package/dist/src/code_assist/admin/admin_controls.js.map +1 -1
- package/dist/src/code_assist/experiments/flagNames.d.ts +1 -0
- package/dist/src/code_assist/experiments/flagNames.js +1 -0
- package/dist/src/code_assist/experiments/flagNames.js.map +1 -1
- package/dist/src/code_assist/oauth2.js +8 -3
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +57 -0
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.js +1 -1
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/setup.js +5 -2
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/setup.test.js +27 -1
- package/dist/src/code_assist/setup.test.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +80 -80
- package/dist/src/commands/memory.js +1 -1
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/config/agent-loop-context.d.ts +2 -0
- package/dist/src/config/config.d.ts +91 -23
- package/dist/src/config/config.js +238 -79
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +189 -15
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/defaultModelConfigs.js +9 -0
- package/dist/src/config/defaultModelConfigs.js.map +1 -1
- package/dist/src/config/extensions/integrity.js +1 -1
- package/dist/src/config/extensions/integrity.js.map +1 -1
- package/dist/src/config/memory.d.ts +1 -0
- package/dist/src/config/memory.js +6 -0
- package/dist/src/config/memory.js.map +1 -1
- package/dist/src/config/projectRegistry.js +5 -3
- package/dist/src/config/projectRegistry.js.map +1 -1
- package/dist/src/config/scoped-config.d.ts +30 -0
- package/dist/src/config/scoped-config.js +69 -0
- package/dist/src/config/scoped-config.js.map +1 -0
- package/dist/src/config/scoped-config.test.d.ts +6 -0
- package/dist/src/config/scoped-config.test.js +161 -0
- package/dist/src/config/scoped-config.test.js.map +1 -0
- package/dist/src/config/storage.d.ts +3 -0
- package/dist/src/config/storage.js +9 -0
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/config/storage.test.js +10 -5
- package/dist/src/config/storage.test.js.map +1 -1
- package/dist/src/config/topicState.d.ts +21 -0
- package/dist/src/config/topicState.js +41 -0
- package/dist/src/config/topicState.js.map +1 -0
- package/dist/src/confirmation-bus/types.d.ts +13 -4
- package/dist/src/confirmation-bus/types.js +2 -0
- package/dist/src/confirmation-bus/types.js.map +1 -1
- package/dist/src/context/agentHistoryProvider.d.ts +45 -0
- package/dist/src/context/agentHistoryProvider.js +294 -0
- package/dist/src/context/agentHistoryProvider.js.map +1 -0
- package/dist/src/context/agentHistoryProvider.test.d.ts +6 -0
- package/dist/src/context/agentHistoryProvider.test.js +357 -0
- package/dist/src/context/agentHistoryProvider.test.js.map +1 -0
- package/dist/src/context/chatCompressionService.js.map +1 -0
- package/dist/src/context/chatCompressionService.test.js.map +1 -0
- package/dist/src/context/contextCompressionService.d.ts +30 -0
- package/dist/src/context/contextCompressionService.js +405 -0
- package/dist/src/context/contextCompressionService.js.map +1 -0
- package/dist/src/context/contextCompressionService.test.js +253 -0
- package/dist/src/context/contextCompressionService.test.js.map +1 -0
- package/dist/src/{services/contextManager.d.ts → context/memoryContextManager.d.ts} +3 -1
- package/dist/src/{services/contextManager.js → context/memoryContextManager.js} +20 -11
- package/dist/src/context/memoryContextManager.js.map +1 -0
- package/dist/src/{services/contextManager.test.js → context/memoryContextManager.test.js} +42 -33
- package/dist/src/context/memoryContextManager.test.js.map +1 -0
- package/dist/src/context/profiles.d.ts +7 -0
- package/dist/src/context/profiles.js +21 -0
- package/dist/src/context/profiles.js.map +1 -0
- package/dist/src/context/toolDistillationService.d.ts +38 -0
- package/dist/src/context/toolDistillationService.js +170 -0
- package/dist/src/context/toolDistillationService.js.map +1 -0
- package/dist/src/context/toolDistillationService.test.d.ts +6 -0
- package/dist/src/context/toolDistillationService.test.js +86 -0
- package/dist/src/context/toolDistillationService.test.js.map +1 -0
- package/dist/src/{services → context}/toolOutputMaskingService.d.ts +2 -2
- package/dist/src/{services → context}/toolOutputMaskingService.js +7 -7
- package/dist/src/context/toolOutputMaskingService.js.map +1 -0
- package/dist/src/context/toolOutputMaskingService.test.d.ts +6 -0
- package/dist/src/{services → context}/toolOutputMaskingService.test.js +4 -5
- package/dist/src/context/toolOutputMaskingService.test.js.map +1 -0
- package/dist/src/context/truncation.d.ts +26 -0
- package/dist/src/context/truncation.js +102 -0
- package/dist/src/context/truncation.js.map +1 -0
- package/dist/src/context/types.d.ts +36 -0
- package/dist/src/context/types.js +7 -0
- package/dist/src/context/types.js.map +1 -0
- package/dist/src/core/AuthenticatedContentGenerator.js +9 -1
- package/dist/src/core/AuthenticatedContentGenerator.js.map +1 -1
- package/dist/src/core/baseLlmClient.js +1 -1
- package/dist/src/core/baseLlmClient.js.map +1 -1
- package/dist/src/core/baseLlmClient.test.js +1 -0
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/client.d.ts +3 -1
- package/dist/src/core/client.js +24 -14
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +36 -40
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.d.ts +0 -1
- package/dist/src/core/contentGenerator.js +2 -28
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +1 -101
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/geminiChat.js +12 -5
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +72 -18
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiChat_network_retry.test.js +1 -0
- package/dist/src/core/geminiChat_network_retry.test.js.map +1 -1
- package/dist/src/core/logger.js +4 -4
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/logger.test.js +1 -1
- package/dist/src/core/logger.test.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.js +1 -1
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/prompts-substitution.test.js +5 -0
- package/dist/src/core/prompts-substitution.test.js.map +1 -1
- package/dist/src/core/prompts.test.js +3 -0
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/hooks/hookEventHandler.js +8 -0
- package/dist/src/hooks/hookEventHandler.js.map +1 -1
- package/dist/src/hooks/hookRunner.js +9 -5
- package/dist/src/hooks/hookRunner.js.map +1 -1
- package/dist/src/hooks/hookRunner.test.js +20 -3
- package/dist/src/hooks/hookRunner.test.js.map +1 -1
- package/dist/src/hooks/hookSystem.d.ts +2 -0
- package/dist/src/hooks/hookSystem.js +1 -0
- package/dist/src/hooks/hookSystem.js.map +1 -1
- package/dist/src/hooks/hookTranslator.js +20 -13
- package/dist/src/hooks/hookTranslator.js.map +1 -1
- package/dist/src/hooks/hookTranslator.test.js +36 -0
- package/dist/src/hooks/hookTranslator.test.js.map +1 -1
- package/dist/src/hooks/types.d.ts +2 -0
- package/dist/src/ide/ide-client.js +3 -3
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-connection-utils.js +1 -1
- package/dist/src/ide/ide-connection-utils.js.map +1 -1
- package/dist/src/ide/ide-installer.js +5 -4
- package/dist/src/ide/ide-installer.js.map +1 -1
- package/dist/src/ide/process-utils.js +3 -3
- package/dist/src/ide/process-utils.js.map +1 -1
- package/dist/src/index.d.ts +10 -3
- package/dist/src/index.js +13 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/mcpLauncher.js +1 -1
- package/dist/src/output/json-formatter.js +2 -1
- package/dist/src/output/json-formatter.js.map +1 -1
- package/dist/src/policy/config.d.ts +1 -1
- package/dist/src/policy/config.js +61 -24
- package/dist/src/policy/config.js.map +1 -1
- package/dist/src/policy/config.test.js +21 -20
- package/dist/src/policy/config.test.js.map +1 -1
- package/dist/src/policy/persistence.test.js +42 -0
- package/dist/src/policy/persistence.test.js.map +1 -1
- package/dist/src/policy/policies/discovered.toml +7 -0
- package/dist/src/policy/policies/memory-manager.toml +11 -1
- package/dist/src/policy/policies/non-interactive.toml +7 -0
- package/dist/src/policy/policies/plan.toml +36 -2
- package/dist/src/policy/policies/read-only.toml +12 -0
- package/dist/src/policy/policies/sandbox-default.toml +4 -4
- package/dist/src/policy/policies/write.toml +21 -0
- package/dist/src/policy/policies/yolo.toml +1 -1
- package/dist/src/policy/policy-engine.d.ts +2 -4
- package/dist/src/policy/policy-engine.js +47 -37
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/policy-engine.test.js +236 -30
- package/dist/src/policy/policy-engine.test.js.map +1 -1
- package/dist/src/policy/sandboxPolicyManager.d.ts +26 -1
- package/dist/src/policy/sandboxPolicyManager.js +41 -12
- package/dist/src/policy/sandboxPolicyManager.js.map +1 -1
- package/dist/src/policy/sandboxPolicyManager.test.d.ts +6 -0
- package/dist/src/policy/sandboxPolicyManager.test.js +61 -0
- package/dist/src/policy/sandboxPolicyManager.test.js.map +1 -0
- package/dist/src/policy/topic-policy.test.d.ts +6 -0
- package/dist/src/policy/topic-policy.test.js +48 -0
- package/dist/src/policy/topic-policy.test.js.map +1 -0
- package/dist/src/policy/types.d.ts +9 -6
- package/dist/src/policy/types.js +11 -0
- package/dist/src/policy/types.js.map +1 -1
- package/dist/src/policy/workspace-policy.test.js +18 -15
- package/dist/src/policy/workspace-policy.test.js.map +1 -1
- package/dist/src/prompts/promptProvider.js +20 -4
- package/dist/src/prompts/promptProvider.js.map +1 -1
- package/dist/src/prompts/promptProvider.test.js +84 -1
- package/dist/src/prompts/promptProvider.test.js.map +1 -1
- package/dist/src/prompts/snippets-memory-manager.test.js +1 -1
- package/dist/src/prompts/snippets-memory-manager.test.js.map +1 -1
- package/dist/src/prompts/snippets.d.ts +3 -4
- package/dist/src/prompts/snippets.js +37 -52
- package/dist/src/prompts/snippets.js.map +1 -1
- package/dist/src/prompts/snippets.legacy.d.ts +6 -4
- package/dist/src/prompts/snippets.legacy.js +36 -7
- package/dist/src/prompts/snippets.legacy.js.map +1 -1
- package/dist/src/prompts/utils.test.js +7 -5
- package/dist/src/prompts/utils.test.js.map +1 -1
- package/dist/src/safety/built-in.js +1 -1
- package/dist/src/safety/built-in.js.map +1 -1
- package/dist/src/sandbox/linux/LinuxSandboxManager.d.ts +11 -1
- package/dist/src/sandbox/linux/LinuxSandboxManager.js +131 -41
- package/dist/src/sandbox/linux/LinuxSandboxManager.js.map +1 -1
- package/dist/src/sandbox/linux/LinuxSandboxManager.test.js +82 -139
- package/dist/src/sandbox/linux/LinuxSandboxManager.test.js.map +1 -1
- package/dist/src/sandbox/linux/bwrapArgsBuilder.d.ts +24 -0
- package/dist/src/sandbox/linux/bwrapArgsBuilder.js +200 -0
- package/dist/src/sandbox/linux/bwrapArgsBuilder.js.map +1 -0
- package/dist/src/sandbox/linux/bwrapArgsBuilder.test.d.ts +6 -0
- package/dist/src/sandbox/linux/bwrapArgsBuilder.test.js +247 -0
- package/dist/src/sandbox/linux/bwrapArgsBuilder.test.js.map +1 -0
- package/dist/src/sandbox/macos/MacOsSandboxManager.d.ts +10 -22
- package/dist/src/sandbox/macos/MacOsSandboxManager.js +67 -59
- package/dist/src/sandbox/macos/MacOsSandboxManager.js.map +1 -1
- package/dist/src/sandbox/macos/MacOsSandboxManager.test.js +168 -103
- package/dist/src/sandbox/macos/MacOsSandboxManager.test.js.map +1 -1
- package/dist/src/sandbox/macos/baseProfile.d.ts +1 -1
- package/dist/src/sandbox/macos/baseProfile.js +26 -8
- package/dist/src/sandbox/macos/baseProfile.js.map +1 -1
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.d.ts +10 -10
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.js +81 -93
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.js.map +1 -1
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.test.js +136 -99
- package/dist/src/sandbox/macos/seatbeltArgsBuilder.test.js.map +1 -1
- package/dist/src/sandbox/{macos → utils}/commandSafety.d.ts +11 -0
- package/dist/src/sandbox/{macos → utils}/commandSafety.js +47 -14
- package/dist/src/sandbox/utils/commandSafety.js.map +1 -0
- package/dist/src/sandbox/utils/commandUtils.d.ts +9 -0
- package/dist/src/sandbox/utils/commandUtils.js +57 -0
- package/dist/src/sandbox/utils/commandUtils.js.map +1 -0
- package/dist/src/sandbox/utils/fsUtils.d.ts +11 -0
- package/dist/src/sandbox/utils/fsUtils.js +84 -0
- package/dist/src/sandbox/utils/fsUtils.js.map +1 -0
- package/dist/src/sandbox/utils/fsUtils.test.d.ts +6 -0
- package/dist/src/sandbox/utils/fsUtils.test.js +43 -0
- package/dist/src/sandbox/utils/fsUtils.test.js.map +1 -0
- package/dist/src/sandbox/utils/proactivePermissions.d.ts +19 -0
- package/dist/src/sandbox/utils/proactivePermissions.js +163 -0
- package/dist/src/sandbox/utils/proactivePermissions.js.map +1 -0
- package/dist/src/sandbox/utils/proactivePermissions.test.d.ts +6 -0
- package/dist/src/sandbox/utils/proactivePermissions.test.js +145 -0
- package/dist/src/sandbox/utils/proactivePermissions.test.js.map +1 -0
- package/dist/src/sandbox/utils/sandboxDenialUtils.d.ts +27 -0
- package/dist/src/sandbox/utils/sandboxDenialUtils.js +142 -0
- package/dist/src/sandbox/utils/sandboxDenialUtils.js.map +1 -0
- package/dist/src/sandbox/utils/sandboxDenialUtils.test.d.ts +6 -0
- package/dist/src/sandbox/utils/sandboxDenialUtils.test.js +188 -0
- package/dist/src/sandbox/utils/sandboxDenialUtils.test.js.map +1 -0
- package/dist/src/sandbox/utils/sandboxReadWriteUtils.d.ts +5 -0
- package/dist/src/sandbox/utils/sandboxReadWriteUtils.js +64 -0
- package/dist/src/sandbox/utils/sandboxReadWriteUtils.js.map +1 -0
- package/dist/src/sandbox/windows/GeminiSandbox.cs +312 -223
- package/dist/src/sandbox/windows/WindowsSandboxManager.d.ts +16 -2
- package/dist/src/sandbox/windows/WindowsSandboxManager.js +261 -44
- package/dist/src/sandbox/windows/WindowsSandboxManager.js.map +1 -1
- package/dist/src/sandbox/windows/WindowsSandboxManager.test.js +379 -17
- package/dist/src/sandbox/windows/WindowsSandboxManager.test.js.map +1 -1
- package/dist/src/sandbox/windows/commandSafety.d.ts +19 -0
- package/dist/src/sandbox/windows/commandSafety.js +128 -0
- package/dist/src/sandbox/windows/commandSafety.js.map +1 -0
- package/dist/src/sandbox/windows/commandSafety.test.d.ts +6 -0
- package/dist/src/sandbox/windows/commandSafety.test.js +42 -0
- package/dist/src/sandbox/windows/commandSafety.test.js.map +1 -0
- package/dist/src/sandbox/windows/windowsSandboxDenialUtils.d.ts +13 -0
- package/dist/src/sandbox/windows/windowsSandboxDenialUtils.js +69 -0
- package/dist/src/sandbox/windows/windowsSandboxDenialUtils.js.map +1 -0
- package/dist/src/sandbox/windows/windowsSandboxDenialUtils.test.d.ts +6 -0
- package/dist/src/sandbox/windows/windowsSandboxDenialUtils.test.js +68 -0
- package/dist/src/sandbox/windows/windowsSandboxDenialUtils.test.js.map +1 -0
- package/dist/src/scheduler/policy.js +20 -5
- package/dist/src/scheduler/policy.js.map +1 -1
- package/dist/src/scheduler/policy.test.js +80 -0
- package/dist/src/scheduler/policy.test.js.map +1 -1
- package/dist/src/scheduler/scheduler.js +13 -3
- package/dist/src/scheduler/scheduler.js.map +1 -1
- package/dist/src/scheduler/scheduler.test.js +52 -0
- package/dist/src/scheduler/scheduler.test.js.map +1 -1
- package/dist/src/scheduler/scheduler_hooks.test.js +1 -0
- package/dist/src/scheduler/scheduler_hooks.test.js.map +1 -1
- package/dist/src/scheduler/state-manager.js +1 -1
- package/dist/src/scheduler/state-manager.js.map +1 -1
- package/dist/src/scheduler/state-manager.test.js +10 -0
- package/dist/src/scheduler/state-manager.test.js.map +1 -1
- package/dist/src/scheduler/tool-executor.js +7 -2
- package/dist/src/scheduler/tool-executor.js.map +1 -1
- package/dist/src/scheduler/tool-executor.test.js +38 -0
- package/dist/src/scheduler/tool-executor.test.js.map +1 -1
- package/dist/src/scheduler/types.d.ts +4 -2
- package/dist/src/services/chatRecordingService.d.ts +1 -13
- package/dist/src/services/chatRecordingService.js +45 -46
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/chatRecordingService.test.js +79 -10
- package/dist/src/services/chatRecordingService.test.js.map +1 -1
- package/dist/src/services/executionLifecycleService.d.ts +44 -6
- package/dist/src/services/executionLifecycleService.js +52 -12
- package/dist/src/services/executionLifecycleService.js.map +1 -1
- package/dist/src/services/executionLifecycleService.test.js +157 -3
- package/dist/src/services/executionLifecycleService.test.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.d.ts +17 -2
- package/dist/src/services/fileDiscoveryService.js +84 -20
- package/dist/src/services/fileDiscoveryService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.test.js +67 -1
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
- package/dist/src/services/gitService.js +1 -1
- package/dist/src/services/gitService.js.map +1 -1
- package/dist/src/services/memoryService.d.ts +65 -0
- package/dist/src/services/memoryService.js +511 -0
- package/dist/src/services/memoryService.js.map +1 -0
- package/dist/src/services/memoryService.test.d.ts +6 -0
- package/dist/src/services/memoryService.test.js +563 -0
- package/dist/src/services/memoryService.test.js.map +1 -0
- package/dist/src/services/modelConfigService.d.ts +11 -0
- package/dist/src/services/modelConfigService.js +67 -0
- package/dist/src/services/modelConfigService.js.map +1 -1
- package/dist/src/services/modelConfigService.test.js +30 -0
- package/dist/src/services/modelConfigService.test.js.map +1 -1
- package/dist/src/services/sandboxManager.d.ts +107 -8
- package/dist/src/services/sandboxManager.integration.test.d.ts +1 -0
- package/dist/src/services/sandboxManager.integration.test.js +445 -0
- package/dist/src/services/sandboxManager.integration.test.js.map +1 -0
- package/dist/src/services/sandboxManager.js +176 -13
- package/dist/src/services/sandboxManager.js.map +1 -1
- package/dist/src/services/sandboxManager.test.js +401 -117
- package/dist/src/services/sandboxManager.test.js.map +1 -1
- package/dist/src/services/sandboxManagerFactory.d.ts +2 -3
- package/dist/src/services/sandboxManagerFactory.js +12 -22
- package/dist/src/services/sandboxManagerFactory.js.map +1 -1
- package/dist/src/services/sandboxedFileSystemService.d.ts +1 -0
- package/dist/src/services/sandboxedFileSystemService.js +43 -3
- package/dist/src/services/sandboxedFileSystemService.js.map +1 -1
- package/dist/src/services/sandboxedFileSystemService.test.js +97 -11
- package/dist/src/services/sandboxedFileSystemService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.d.ts +18 -1
- package/dist/src/services/shellExecutionService.js +115 -26
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +70 -8
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/services/test-data/resolved-aliases-retry.golden.json +4 -0
- package/dist/src/services/test-data/resolved-aliases.golden.json +4 -0
- package/dist/src/services/worktreeService.test.js +7 -7
- package/dist/src/services/worktreeService.test.js.map +1 -1
- package/dist/src/skills/skillLoader.d.ts +8 -0
- package/dist/src/skills/skillLoader.js +1 -1
- package/dist/src/skills/skillLoader.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +29 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +107 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +172 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +10 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +22 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +22 -0
- package/dist/src/telemetry/loggers.js +41 -2
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +8 -3
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +118 -1
- package/dist/src/telemetry/metrics.js +196 -4
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +298 -0
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/types.d.ts +3 -3
- package/dist/src/telemetry/types.js +9 -4
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/test-utils/mock-message-bus.d.ts +1 -1
- package/dist/src/test-utils/mock-message-bus.js +1 -1
- package/dist/src/test-utils/mock-message-bus.js.map +1 -1
- package/dist/src/tools/complete-task.d.ts +29 -0
- package/dist/src/tools/complete-task.js +123 -0
- package/dist/src/tools/complete-task.js.map +1 -0
- package/dist/src/tools/complete-task.test.d.ts +6 -0
- package/dist/src/tools/complete-task.test.js +114 -0
- package/dist/src/tools/complete-task.test.js.map +1 -0
- package/dist/src/tools/definitions/base-declarations.d.ts +8 -0
- package/dist/src/tools/definitions/base-declarations.js +10 -0
- package/dist/src/tools/definitions/base-declarations.js.map +1 -1
- package/dist/src/tools/definitions/coreTools.d.ts +2 -1
- package/dist/src/tools/definitions/coreTools.js +9 -3
- package/dist/src/tools/definitions/coreTools.js.map +1 -1
- package/dist/src/tools/definitions/dynamic-declaration-helpers.d.ts +4 -0
- package/dist/src/tools/definitions/dynamic-declaration-helpers.js +33 -2
- package/dist/src/tools/definitions/dynamic-declaration-helpers.js.map +1 -1
- package/dist/src/tools/definitions/model-family-sets/default-legacy.js +14 -9
- package/dist/src/tools/definitions/model-family-sets/default-legacy.js.map +1 -1
- package/dist/src/tools/definitions/model-family-sets/gemini-3.js +13 -7
- package/dist/src/tools/definitions/model-family-sets/gemini-3.js.map +1 -1
- package/dist/src/tools/definitions/trackerTools.js +3 -3
- package/dist/src/tools/definitions/trackerTools.js.map +1 -1
- package/dist/src/tools/definitions/types.d.ts +1 -0
- package/dist/src/tools/enter-plan-mode.js +15 -0
- package/dist/src/tools/enter-plan-mode.js.map +1 -1
- package/dist/src/tools/enter-plan-mode.test.js +25 -0
- package/dist/src/tools/enter-plan-mode.test.js.map +1 -1
- package/dist/src/tools/grep-utils.d.ts +2 -1
- package/dist/src/tools/grep-utils.js +22 -3
- package/dist/src/tools/grep-utils.js.map +1 -1
- package/dist/src/tools/grep.js +16 -3
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/grep.test.js +36 -8
- package/dist/src/tools/grep.test.js.map +1 -1
- package/dist/src/tools/jit-context.js +3 -3
- package/dist/src/tools/jit-context.js.map +1 -1
- package/dist/src/tools/jit-context.test.js +15 -13
- package/dist/src/tools/jit-context.test.js.map +1 -1
- package/dist/src/tools/ls.js +6 -4
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +22 -7
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.js +6 -3
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +35 -0
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.js +1 -1
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +1 -1
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +9 -2
- package/dist/src/tools/memoryTool.js +39 -15
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/memoryTool.test.js +61 -2
- package/dist/src/tools/memoryTool.test.js.map +1 -1
- package/dist/src/tools/read-many-files.js +12 -4
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +17 -17
- package/dist/src/tools/read-many-files.test.js.map +1 -1
- package/dist/src/tools/ripGrep.js +14 -1
- package/dist/src/tools/ripGrep.js.map +1 -1
- package/dist/src/tools/ripGrep.test.js +10 -10
- package/dist/src/tools/ripGrep.test.js.map +1 -1
- package/dist/src/tools/shell.d.ts +17 -4
- package/dist/src/tools/shell.js +342 -151
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +204 -11
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/shellBackgroundTools.d.ts +38 -0
- package/dist/src/tools/shellBackgroundTools.integration.test.d.ts +6 -0
- package/dist/src/tools/shellBackgroundTools.integration.test.js +86 -0
- package/dist/src/tools/shellBackgroundTools.integration.test.js.map +1 -0
- package/dist/src/tools/shellBackgroundTools.js +186 -0
- package/dist/src/tools/shellBackgroundTools.js.map +1 -0
- package/dist/src/tools/shellBackgroundTools.test.d.ts +6 -0
- package/dist/src/tools/shellBackgroundTools.test.js +230 -0
- package/dist/src/tools/shellBackgroundTools.test.js.map +1 -0
- package/dist/src/tools/shell_proactive.test.d.ts +6 -0
- package/dist/src/tools/shell_proactive.test.js +122 -0
- package/dist/src/tools/shell_proactive.test.js.map +1 -0
- package/dist/src/tools/tool-names.d.ts +4 -4
- package/dist/src/tools/tool-names.js +6 -3
- package/dist/src/tools/tool-names.js.map +1 -1
- package/dist/src/tools/tool-registry.js +11 -1
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +43 -1
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +12 -1
- package/dist/src/tools/tools.js +16 -1
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/tools.test.js +42 -1
- package/dist/src/tools/tools.test.js.map +1 -1
- package/dist/src/tools/topicTool.d.ts +29 -0
- package/dist/src/tools/topicTool.js +72 -0
- package/dist/src/tools/topicTool.js.map +1 -0
- package/dist/src/tools/topicTool.test.d.ts +6 -0
- package/dist/src/tools/topicTool.test.js +105 -0
- package/dist/src/tools/topicTool.test.js.map +1 -0
- package/dist/src/tools/web-fetch.js +40 -22
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +28 -0
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/xcode-mcp-fix-transport.js +1 -1
- package/dist/src/tools/xcode-mcp-fix-transport.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.js +3 -6
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/checkpointUtils.d.ts +4 -4
- package/dist/src/utils/checkpointUtils.js +11 -8
- package/dist/src/utils/checkpointUtils.js.map +1 -1
- package/dist/src/utils/compatibility.js +0 -7
- package/dist/src/utils/compatibility.js.map +1 -1
- package/dist/src/utils/compatibility.test.js +0 -9
- package/dist/src/utils/compatibility.test.js.map +1 -1
- package/dist/src/utils/editor.js +3 -0
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/errorParsing.js +2 -2
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errors.d.ts +3 -0
- package/dist/src/utils/errors.js +28 -6
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/errors.test.js +23 -0
- package/dist/src/utils/errors.test.js.map +1 -1
- package/dist/src/utils/events.d.ts +12 -0
- package/dist/src/utils/events.js +7 -0
- package/dist/src/utils/events.js.map +1 -1
- package/dist/src/utils/fetch.d.ts +1 -0
- package/dist/src/utils/fetch.js +22 -6
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/fetch.test.js +26 -1
- package/dist/src/utils/fetch.test.js.map +1 -1
- package/dist/src/utils/fileUtils.js +1 -1
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/filesearch/crawler.js +1 -1
- package/dist/src/utils/filesearch/crawler.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.test.js +7 -2
- package/dist/src/utils/filesearch/fileSearch.test.js.map +1 -1
- package/dist/src/utils/getFolderStructure.js +1 -1
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/getPty.js +2 -2
- package/dist/src/utils/getPty.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.d.ts +2 -2
- package/dist/src/utils/gitIgnoreParser.js +30 -52
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.test.js +51 -185
- 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.js +5 -5
- package/dist/src/utils/googleErrors.js.map +1 -1
- package/dist/src/utils/ignoreFileParser.d.ts +2 -2
- package/dist/src/utils/ignoreFileParser.js +7 -18
- package/dist/src/utils/ignoreFileParser.js.map +1 -1
- package/dist/src/utils/ignoreFileParser.test.js +40 -132
- package/dist/src/utils/ignoreFileParser.test.js.map +1 -1
- package/dist/src/utils/ignorePathUtils.d.ts +11 -0
- package/dist/src/utils/ignorePathUtils.js +39 -0
- package/dist/src/utils/ignorePathUtils.js.map +1 -0
- package/dist/src/utils/ignorePathUtils.test.d.ts +6 -0
- package/dist/src/utils/ignorePathUtils.test.js +70 -0
- package/dist/src/utils/ignorePathUtils.test.js.map +1 -0
- package/dist/src/utils/memoryDiscovery.d.ts +6 -4
- package/dist/src/utils/memoryDiscovery.js +69 -48
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +40 -0
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.d.ts +1 -1
- package/dist/src/utils/memoryImportProcessor.js +24 -15
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/paths.d.ts +8 -0
- package/dist/src/utils/paths.js +37 -6
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/paths.test.js +61 -3
- package/dist/src/utils/paths.test.js.map +1 -1
- package/dist/src/utils/process-utils.js +2 -2
- package/dist/src/utils/process-utils.js.map +1 -1
- package/dist/src/utils/retry.js +7 -0
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +41 -0
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/secure-browser-launcher.js +1 -1
- package/dist/src/utils/secure-browser-launcher.js.map +1 -1
- package/dist/src/utils/sessionOperations.d.ts +19 -0
- package/dist/src/utils/sessionOperations.js +101 -0
- package/dist/src/utils/sessionOperations.js.map +1 -0
- package/dist/src/utils/sessionOperations.test.d.ts +6 -0
- package/dist/src/utils/sessionOperations.test.js +92 -0
- package/dist/src/utils/sessionOperations.test.js.map +1 -0
- package/dist/src/utils/shell-utils.d.ts +24 -0
- package/dist/src/utils/shell-utils.integration.test.js +1 -1
- package/dist/src/utils/shell-utils.integration.test.js.map +1 -1
- package/dist/src/utils/shell-utils.js +86 -6
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +13 -1
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/systemEncoding.js +1 -1
- package/dist/src/utils/systemEncoding.js.map +1 -1
- package/dist/src/utils/terminalSerializer.d.ts +1 -0
- package/dist/src/utils/terminalSerializer.js +31 -8
- package/dist/src/utils/terminalSerializer.js.map +1 -1
- package/dist/src/utils/terminalSerializer.test.js +3 -2
- package/dist/src/utils/terminalSerializer.test.js.map +1 -1
- package/dist/src/utils/textUtils.d.ts +8 -0
- package/dist/src/utils/textUtils.js +16 -0
- package/dist/src/utils/textUtils.js.map +1 -1
- package/dist/src/utils/tokenCalculation.d.ts +2 -0
- package/dist/src/utils/tokenCalculation.js +2 -2
- package/dist/src/utils/tokenCalculation.js.map +1 -1
- package/dist/src/utils/workspaceContext.js +2 -2
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/dist/docs/CONTRIBUTING.md +0 -566
- package/dist/docs/get-started/examples.md +0 -141
- package/dist/src/sandbox/macos/MacOsSandboxManager.integration.test.js +0 -164
- package/dist/src/sandbox/macos/MacOsSandboxManager.integration.test.js.map +0 -1
- package/dist/src/sandbox/macos/commandSafety.js.map +0 -1
- package/dist/src/services/chatCompressionService.js.map +0 -1
- package/dist/src/services/chatCompressionService.test.js.map +0 -1
- package/dist/src/services/contextManager.js.map +0 -1
- package/dist/src/services/contextManager.test.js.map +0 -1
- package/dist/src/services/toolOutputMaskingService.js.map +0 -1
- package/dist/src/services/toolOutputMaskingService.test.js.map +0 -1
- /package/dist/src/{services/toolOutputMaskingService.test.d.ts → agents/browser/snapshotSuperseder.test.d.ts} +0 -0
- /package/dist/src/{services → context}/chatCompressionService.d.ts +0 -0
- /package/dist/src/{services → context}/chatCompressionService.js +0 -0
- /package/dist/src/{services → context}/chatCompressionService.test.d.ts +0 -0
- /package/dist/src/{services → context}/chatCompressionService.test.js +0 -0
- /package/dist/src/{sandbox/macos/MacOsSandboxManager.integration.test.d.ts → context/contextCompressionService.test.d.ts} +0 -0
- /package/dist/src/{services/contextManager.test.d.ts → context/memoryContextManager.test.d.ts} +0 -0
package/dist/src/tools/shell.js
CHANGED
|
@@ -9,26 +9,52 @@ import path from 'node:path';
|
|
|
9
9
|
import os from 'node:os';
|
|
10
10
|
import crypto from 'node:crypto';
|
|
11
11
|
import { debugLogger } from '../index.js';
|
|
12
|
+
import { getPathIdentity, } from '../services/sandboxManager.js';
|
|
12
13
|
import { ToolErrorType } from './tool-error.js';
|
|
13
14
|
import { BaseDeclarativeTool, BaseToolInvocation, ToolConfirmationOutcome, Kind, } from './tools.js';
|
|
14
15
|
import { getErrorMessage } from '../utils/errors.js';
|
|
15
16
|
import { summarizeToolOutput } from '../utils/summarizer.js';
|
|
16
17
|
import { ShellExecutionService, } from '../services/shellExecutionService.js';
|
|
17
18
|
import { formatBytes } from '../utils/formatters.js';
|
|
18
|
-
import { getCommandRoots, initializeShellParsers, stripShellWrapper, parseCommandDetails, hasRedirection, } from '../utils/shell-utils.js';
|
|
19
|
+
import { getCommandRoots, initializeShellParsers, stripShellWrapper, parseCommandDetails, hasRedirection, normalizeCommand, } from '../utils/shell-utils.js';
|
|
19
20
|
import { SHELL_TOOL_NAME } from './tool-names.js';
|
|
20
21
|
import { PARAM_ADDITIONAL_PERMISSIONS } from './definitions/base-declarations.js';
|
|
21
22
|
import { getShellDefinition } from './definitions/coreTools.js';
|
|
22
23
|
import { resolveToolDeclaration } from './definitions/resolver.js';
|
|
24
|
+
import { isSubpath, resolveToRealPath } from '../utils/paths.js';
|
|
25
|
+
import { getProactiveToolSuggestions, isNetworkReliantCommand, } from '../sandbox/utils/proactivePermissions.js';
|
|
23
26
|
export const OUTPUT_UPDATE_INTERVAL_MS = 1000;
|
|
24
27
|
// Delay so user does not see the output of the process before the process is moved to the background.
|
|
25
28
|
const BACKGROUND_DELAY_MS = 200;
|
|
26
29
|
export class ShellToolInvocation extends BaseToolInvocation {
|
|
27
30
|
context;
|
|
31
|
+
proactivePermissionsConfirmed;
|
|
28
32
|
constructor(context, params, messageBus, _toolName, _toolDisplayName) {
|
|
29
33
|
super(params, messageBus, _toolName, _toolDisplayName);
|
|
30
34
|
this.context = context;
|
|
31
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Wraps a command in a subshell `()` to capture background process IDs (PIDs) using pgrep.
|
|
38
|
+
* Uses newlines to prevent breaking heredocs or trailing comments.
|
|
39
|
+
*
|
|
40
|
+
* @param command The raw command string to execute.
|
|
41
|
+
* @param tempFilePath Path to the temporary file where PIDs will be written.
|
|
42
|
+
* @param isWindows Whether the current platform is Windows (if true, the command is returned as-is).
|
|
43
|
+
* @returns The wrapped command string.
|
|
44
|
+
*/
|
|
45
|
+
wrapCommandForPgrep(command, tempFilePath, isWindows) {
|
|
46
|
+
if (isWindows) {
|
|
47
|
+
return command;
|
|
48
|
+
}
|
|
49
|
+
let trimmed = command.trim();
|
|
50
|
+
if (!trimmed) {
|
|
51
|
+
return '';
|
|
52
|
+
}
|
|
53
|
+
if (trimmed.endsWith('\\')) {
|
|
54
|
+
trimmed += ' ';
|
|
55
|
+
}
|
|
56
|
+
return `(\n${trimmed}\n); __code=$?; pgrep -g 0 >${tempFilePath} 2>&1; exit $__code;`;
|
|
57
|
+
}
|
|
32
58
|
getContextualDetails() {
|
|
33
59
|
let details = '';
|
|
34
60
|
// append optional [in directory]
|
|
@@ -49,7 +75,79 @@ export class ShellToolInvocation extends BaseToolInvocation {
|
|
|
49
75
|
return details;
|
|
50
76
|
}
|
|
51
77
|
getDescription() {
|
|
52
|
-
return
|
|
78
|
+
return this.params.description?.trim()
|
|
79
|
+
? this.params.description
|
|
80
|
+
: this.params.command;
|
|
81
|
+
}
|
|
82
|
+
simplifyPaths(paths) {
|
|
83
|
+
if (paths.size === 0)
|
|
84
|
+
return [];
|
|
85
|
+
const rawPaths = Array.from(paths);
|
|
86
|
+
// 1. Remove redundant paths (subpaths of already included paths)
|
|
87
|
+
const sorted = rawPaths.sort((a, b) => a.length - b.length);
|
|
88
|
+
const nonRedundant = [];
|
|
89
|
+
for (const p of sorted) {
|
|
90
|
+
if (!nonRedundant.some((s) => isSubpath(s, p))) {
|
|
91
|
+
nonRedundant.push(p);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
// 2. Consolidate clusters: if >= 3 paths share the same immediate parent, use the parent
|
|
95
|
+
const parentCounts = new Map();
|
|
96
|
+
for (const p of nonRedundant) {
|
|
97
|
+
const parent = path.dirname(p);
|
|
98
|
+
if (!parentCounts.has(parent)) {
|
|
99
|
+
parentCounts.set(parent, []);
|
|
100
|
+
}
|
|
101
|
+
parentCounts.get(parent).push(p);
|
|
102
|
+
}
|
|
103
|
+
const finalPaths = new Set();
|
|
104
|
+
const sensitiveDirs = new Set([
|
|
105
|
+
os.homedir(),
|
|
106
|
+
path.dirname(os.homedir()),
|
|
107
|
+
path.sep,
|
|
108
|
+
path.join(path.sep, 'etc'),
|
|
109
|
+
path.join(path.sep, 'usr'),
|
|
110
|
+
path.join(path.sep, 'var'),
|
|
111
|
+
path.join(path.sep, 'bin'),
|
|
112
|
+
path.join(path.sep, 'sbin'),
|
|
113
|
+
path.join(path.sep, 'lib'),
|
|
114
|
+
path.join(path.sep, 'root'),
|
|
115
|
+
path.join(path.sep, 'home'),
|
|
116
|
+
path.join(path.sep, 'Users'),
|
|
117
|
+
]);
|
|
118
|
+
if (os.platform() === 'win32') {
|
|
119
|
+
const systemRoot = process.env['SystemRoot'];
|
|
120
|
+
if (systemRoot) {
|
|
121
|
+
sensitiveDirs.add(systemRoot);
|
|
122
|
+
sensitiveDirs.add(path.join(systemRoot, 'System32'));
|
|
123
|
+
}
|
|
124
|
+
const programFiles = process.env['ProgramFiles'];
|
|
125
|
+
if (programFiles)
|
|
126
|
+
sensitiveDirs.add(programFiles);
|
|
127
|
+
const programFilesX86 = process.env['ProgramFiles(x86)'];
|
|
128
|
+
if (programFilesX86)
|
|
129
|
+
sensitiveDirs.add(programFilesX86);
|
|
130
|
+
}
|
|
131
|
+
for (const [parent, children] of parentCounts.entries()) {
|
|
132
|
+
const isSensitive = sensitiveDirs.has(parent);
|
|
133
|
+
if (children.length >= 3 && parent.length > 1 && !isSensitive) {
|
|
134
|
+
finalPaths.add(parent);
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
for (const child of children) {
|
|
138
|
+
finalPaths.add(child);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
// 3. Final redundancy check after consolidation
|
|
143
|
+
const finalSorted = Array.from(finalPaths).sort((a, b) => a.length - b.length);
|
|
144
|
+
const result = [];
|
|
145
|
+
for (const p of finalSorted) {
|
|
146
|
+
if (!result.some((s) => isSubpath(s, p))) {
|
|
147
|
+
result.push(p);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
return result;
|
|
53
151
|
}
|
|
54
152
|
getDisplayTitle() {
|
|
55
153
|
return this.params.command;
|
|
@@ -70,13 +168,81 @@ export class ShellToolInvocation extends BaseToolInvocation {
|
|
|
70
168
|
}
|
|
71
169
|
return undefined;
|
|
72
170
|
}
|
|
73
|
-
async shouldConfirmExecute(abortSignal) {
|
|
171
|
+
async shouldConfirmExecute(abortSignal, forcedDecision) {
|
|
74
172
|
if (this.params[PARAM_ADDITIONAL_PERMISSIONS]) {
|
|
75
173
|
return this.getConfirmationDetails(abortSignal);
|
|
76
174
|
}
|
|
77
|
-
|
|
175
|
+
if (this.context.config.getSandboxEnabled()) {
|
|
176
|
+
const command = stripShellWrapper(this.params.command);
|
|
177
|
+
const rootCommands = getCommandRoots(command);
|
|
178
|
+
const rawRootCommand = rootCommands[0];
|
|
179
|
+
if (rawRootCommand) {
|
|
180
|
+
const rootCommand = normalizeCommand(rawRootCommand);
|
|
181
|
+
const proactive = await getProactiveToolSuggestions(rootCommand);
|
|
182
|
+
if (proactive) {
|
|
183
|
+
const mode = this.context.config.getApprovalMode();
|
|
184
|
+
const modeConfig = this.context.config.sandboxPolicyManager.getModeConfig(mode);
|
|
185
|
+
const approved = this.context.config.sandboxPolicyManager.getCommandPermissions(rootCommand);
|
|
186
|
+
const hasNetwork = modeConfig.network || approved.network;
|
|
187
|
+
const missingNetwork = !!proactive.network && !hasNetwork;
|
|
188
|
+
// Detect commands or sub-commands that definitely need network
|
|
189
|
+
const parsed = parseCommandDetails(command);
|
|
190
|
+
const subCommand = parsed?.details[0]?.args?.[0];
|
|
191
|
+
const needsNetwork = isNetworkReliantCommand(rootCommand, subCommand);
|
|
192
|
+
if (needsNetwork) {
|
|
193
|
+
// Add write permission to the current directory if we are in readonly mode
|
|
194
|
+
const isReadonlyMode = modeConfig.readonly ?? false;
|
|
195
|
+
if (isReadonlyMode) {
|
|
196
|
+
const cwd = this.params.dir_path || this.context.config.getTargetDir();
|
|
197
|
+
proactive.fileSystem = proactive.fileSystem || {
|
|
198
|
+
read: [],
|
|
199
|
+
write: [],
|
|
200
|
+
};
|
|
201
|
+
proactive.fileSystem.write = proactive.fileSystem.write || [];
|
|
202
|
+
if (!proactive.fileSystem.write.includes(cwd)) {
|
|
203
|
+
proactive.fileSystem.write.push(cwd);
|
|
204
|
+
proactive.fileSystem.read = proactive.fileSystem.read || [];
|
|
205
|
+
if (!proactive.fileSystem.read.includes(cwd)) {
|
|
206
|
+
proactive.fileSystem.read.push(cwd);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
const isApproved = (requestedPath, approvedPaths) => {
|
|
211
|
+
if (!approvedPaths || approvedPaths.length === 0)
|
|
212
|
+
return false;
|
|
213
|
+
const requestedRealIdentity = getPathIdentity(resolveToRealPath(requestedPath));
|
|
214
|
+
// Identity check is fast, subpath check is slower
|
|
215
|
+
return approvedPaths.some((p) => {
|
|
216
|
+
const approvedRealIdentity = getPathIdentity(resolveToRealPath(p));
|
|
217
|
+
return (requestedRealIdentity === approvedRealIdentity ||
|
|
218
|
+
isSubpath(approvedRealIdentity, requestedRealIdentity));
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
const missingRead = (proactive.fileSystem?.read || []).filter((p) => !isApproved(p, approved.fileSystem?.read));
|
|
222
|
+
const missingWrite = (proactive.fileSystem?.write || []).filter((p) => !isApproved(p, approved.fileSystem?.write));
|
|
223
|
+
const needsExpansion = missingRead.length > 0 ||
|
|
224
|
+
missingWrite.length > 0 ||
|
|
225
|
+
missingNetwork;
|
|
226
|
+
if (needsExpansion) {
|
|
227
|
+
const details = await this.getConfirmationDetails(abortSignal, proactive);
|
|
228
|
+
if (details && details.type === 'sandbox_expansion') {
|
|
229
|
+
const originalOnConfirm = details.onConfirm;
|
|
230
|
+
details.onConfirm = async (outcome) => {
|
|
231
|
+
await originalOnConfirm(outcome);
|
|
232
|
+
if (outcome !== ToolConfirmationOutcome.Cancel) {
|
|
233
|
+
this.proactivePermissionsConfirmed = proactive;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
return details;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
return super.shouldConfirmExecute(abortSignal, forcedDecision);
|
|
78
244
|
}
|
|
79
|
-
async getConfirmationDetails(_abortSignal) {
|
|
245
|
+
async getConfirmationDetails(_abortSignal, proactivePermissions) {
|
|
80
246
|
const command = stripShellWrapper(this.params.command);
|
|
81
247
|
const parsed = parseCommandDetails(command);
|
|
82
248
|
let rootCommandDisplay = '';
|
|
@@ -94,25 +260,29 @@ export class ShellToolInvocation extends BaseToolInvocation {
|
|
|
94
260
|
.join(', ');
|
|
95
261
|
}
|
|
96
262
|
const rootCommands = [...new Set(getCommandRoots(command))];
|
|
263
|
+
const rootCommand = rootCommands[0] || 'shell';
|
|
264
|
+
// Proactively suggest expansion for known network-heavy tools (npm install, etc.)
|
|
265
|
+
// to avoid hangs when network is restricted by default.
|
|
266
|
+
const effectiveAdditionalPermissions = this.params[PARAM_ADDITIONAL_PERMISSIONS] || proactivePermissions;
|
|
97
267
|
// Rely entirely on PolicyEngine for interactive confirmation.
|
|
98
268
|
// If we are here, it means PolicyEngine returned ASK_USER (or no message bus),
|
|
99
269
|
// so we must provide confirmation details.
|
|
100
270
|
// If additional_permissions are provided, it's an expansion request
|
|
101
|
-
if (
|
|
271
|
+
if (effectiveAdditionalPermissions) {
|
|
102
272
|
return {
|
|
103
273
|
type: 'sandbox_expansion',
|
|
104
|
-
title:
|
|
274
|
+
title: proactivePermissions
|
|
275
|
+
? 'Sandbox Expansion Request (Recommended)'
|
|
276
|
+
: 'Sandbox Expansion Request',
|
|
105
277
|
command: this.params.command,
|
|
106
278
|
rootCommand: rootCommandDisplay,
|
|
107
|
-
additionalPermissions:
|
|
279
|
+
additionalPermissions: effectiveAdditionalPermissions,
|
|
108
280
|
onConfirm: async (outcome) => {
|
|
109
281
|
if (outcome === ToolConfirmationOutcome.ProceedAlwaysAndSave) {
|
|
110
|
-
|
|
111
|
-
this.context.config.sandboxPolicyManager.addPersistentApproval(commandName, this.params[PARAM_ADDITIONAL_PERMISSIONS]);
|
|
282
|
+
this.context.config.sandboxPolicyManager.addPersistentApproval(rootCommand, effectiveAdditionalPermissions);
|
|
112
283
|
}
|
|
113
284
|
else if (outcome === ToolConfirmationOutcome.ProceedAlways) {
|
|
114
|
-
|
|
115
|
-
this.context.config.sandboxPolicyManager.addSessionApproval(commandName, this.params[PARAM_ADDITIONAL_PERMISSIONS]);
|
|
285
|
+
this.context.config.sandboxPolicyManager.addSessionApproval(rootCommand, effectiveAdditionalPermissions);
|
|
116
286
|
}
|
|
117
287
|
},
|
|
118
288
|
};
|
|
@@ -151,15 +321,7 @@ export class ShellToolInvocation extends BaseToolInvocation {
|
|
|
151
321
|
const onAbort = () => combinedController.abort();
|
|
152
322
|
try {
|
|
153
323
|
// pgrep is not available on Windows, so we can't get background PIDs
|
|
154
|
-
const commandToExecute = isWindows
|
|
155
|
-
? strippedCommand
|
|
156
|
-
: (() => {
|
|
157
|
-
// wrap command to append subprocess pids (via pgrep) to temporary file
|
|
158
|
-
let command = strippedCommand.trim();
|
|
159
|
-
if (!command.endsWith('&'))
|
|
160
|
-
command += ';';
|
|
161
|
-
return `{ ${command} }; __code=$?; pgrep -g 0 >${tempFilePath} 2>&1; exit $__code;`;
|
|
162
|
-
})();
|
|
324
|
+
const commandToExecute = this.wrapCommandForPgrep(strippedCommand, tempFilePath, isWindows);
|
|
163
325
|
const cwd = this.params.dir_path
|
|
164
326
|
? path.resolve(this.context.config.getTargetDir(), this.params.dir_path)
|
|
165
327
|
: this.context.config.getTargetDir();
|
|
@@ -231,21 +393,60 @@ export class ShellToolInvocation extends BaseToolInvocation {
|
|
|
231
393
|
}
|
|
232
394
|
}, combinedController.signal, this.context.config.getEnableInteractiveShell(), {
|
|
233
395
|
...shellExecutionConfig,
|
|
396
|
+
sessionId: this.context.config?.getSessionId?.() ?? 'default',
|
|
234
397
|
pager: 'cat',
|
|
235
398
|
sanitizationConfig: shellExecutionConfig?.sanitizationConfig ??
|
|
236
399
|
this.context.config.sanitizationConfig,
|
|
237
400
|
sandboxManager: this.context.config.sandboxManager,
|
|
238
|
-
additionalPermissions:
|
|
401
|
+
additionalPermissions: {
|
|
402
|
+
network: this.params[PARAM_ADDITIONAL_PERMISSIONS]?.network ||
|
|
403
|
+
this.proactivePermissionsConfirmed?.network,
|
|
404
|
+
fileSystem: {
|
|
405
|
+
read: [
|
|
406
|
+
...(this.params[PARAM_ADDITIONAL_PERMISSIONS]?.fileSystem
|
|
407
|
+
?.read || []),
|
|
408
|
+
...(this.proactivePermissionsConfirmed?.fileSystem?.read ||
|
|
409
|
+
[]),
|
|
410
|
+
],
|
|
411
|
+
write: [
|
|
412
|
+
...(this.params[PARAM_ADDITIONAL_PERMISSIONS]?.fileSystem
|
|
413
|
+
?.write || []),
|
|
414
|
+
...(this.proactivePermissionsConfirmed?.fileSystem?.write ||
|
|
415
|
+
[]),
|
|
416
|
+
],
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
backgroundCompletionBehavior: this.context.config.getShellBackgroundCompletionBehavior(),
|
|
420
|
+
originalCommand: strippedCommand,
|
|
239
421
|
});
|
|
240
422
|
if (pid) {
|
|
241
423
|
if (setExecutionIdCallback) {
|
|
242
424
|
setExecutionIdCallback(pid);
|
|
243
425
|
}
|
|
244
426
|
// If the model requested to run in the background, do so after a short delay.
|
|
427
|
+
let completed = false;
|
|
245
428
|
if (this.params.is_background) {
|
|
429
|
+
resultPromise
|
|
430
|
+
.then(() => {
|
|
431
|
+
completed = true;
|
|
432
|
+
})
|
|
433
|
+
.catch(() => {
|
|
434
|
+
completed = true; // Also mark completed if it failed
|
|
435
|
+
});
|
|
436
|
+
const sessionId = this.context.config?.getSessionId?.() ?? 'default';
|
|
437
|
+
const delay = this.params.delay_ms ?? BACKGROUND_DELAY_MS;
|
|
246
438
|
setTimeout(() => {
|
|
247
|
-
ShellExecutionService.background(pid);
|
|
248
|
-
},
|
|
439
|
+
ShellExecutionService.background(pid, sessionId, strippedCommand);
|
|
440
|
+
}, delay);
|
|
441
|
+
// Wait for the delay amount to see if command returns quickly
|
|
442
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
443
|
+
if (!completed) {
|
|
444
|
+
// Return early with initial output if still running
|
|
445
|
+
return {
|
|
446
|
+
llmContent: `Command is running in background. PID: ${pid}. Initial output:\n${cumulativeOutput}`,
|
|
447
|
+
returnDisplay: `Background process started with PID ${pid}.`,
|
|
448
|
+
};
|
|
449
|
+
}
|
|
249
450
|
}
|
|
250
451
|
}
|
|
251
452
|
const result = await resultPromise;
|
|
@@ -336,164 +537,154 @@ export class ShellToolInvocation extends BaseToolInvocation {
|
|
|
336
537
|
}
|
|
337
538
|
llmContent = llmContentParts.join('\n');
|
|
338
539
|
}
|
|
339
|
-
let
|
|
540
|
+
let returnDisplay = '';
|
|
340
541
|
if (this.context.config.getDebugMode()) {
|
|
341
|
-
|
|
542
|
+
returnDisplay = llmContent;
|
|
342
543
|
}
|
|
343
544
|
else {
|
|
344
545
|
if (this.params.is_background || result.backgrounded) {
|
|
345
|
-
|
|
546
|
+
returnDisplay = `Command moved to background (PID: ${result.pid}). Output hidden. Press Ctrl+B to view.`;
|
|
346
547
|
}
|
|
347
548
|
else if (result.aborted) {
|
|
348
549
|
const cancelMsg = timeoutMessage || 'Command cancelled by user.';
|
|
349
550
|
if (result.output.trim()) {
|
|
350
|
-
|
|
551
|
+
returnDisplay = `${cancelMsg}\n\nOutput before cancellation:\n${result.output}`;
|
|
351
552
|
}
|
|
352
553
|
else {
|
|
353
|
-
|
|
554
|
+
returnDisplay = cancelMsg;
|
|
354
555
|
}
|
|
355
556
|
}
|
|
356
|
-
else if (result.output.trim()) {
|
|
357
|
-
|
|
557
|
+
else if (result.output.trim() || result.ansiOutput) {
|
|
558
|
+
returnDisplay =
|
|
559
|
+
result.ansiOutput && result.ansiOutput.length > 0
|
|
560
|
+
? result.ansiOutput
|
|
561
|
+
: result.output;
|
|
358
562
|
}
|
|
359
563
|
else {
|
|
360
564
|
if (result.signal) {
|
|
361
|
-
|
|
565
|
+
returnDisplay = `Command terminated by signal: ${result.signal}`;
|
|
362
566
|
}
|
|
363
567
|
else if (result.error) {
|
|
364
|
-
|
|
568
|
+
returnDisplay = `Command failed: ${getErrorMessage(result.error)}`;
|
|
365
569
|
}
|
|
366
570
|
else if (result.exitCode !== null && result.exitCode !== 0) {
|
|
367
|
-
|
|
571
|
+
returnDisplay = `Command exited with code: ${result.exitCode}`;
|
|
368
572
|
}
|
|
369
573
|
// If output is empty and command succeeded (code 0, no error/signal/abort),
|
|
370
|
-
//
|
|
574
|
+
// returnDisplay will remain empty, which is fine.
|
|
371
575
|
}
|
|
372
576
|
}
|
|
373
577
|
// Heuristic Sandbox Denial Detection
|
|
374
|
-
|
|
375
|
-
' ' +
|
|
376
|
-
(result.error?.message || '')).toLowerCase();
|
|
377
|
-
const isFileDenial = [
|
|
378
|
-
'operation not permitted',
|
|
379
|
-
'vim:e303',
|
|
380
|
-
'should be read/write',
|
|
381
|
-
'sandbox_apply',
|
|
382
|
-
'sandbox: ',
|
|
383
|
-
].some((keyword) => lowerOutput.includes(keyword));
|
|
384
|
-
const isNetworkDenial = [
|
|
385
|
-
'error connecting to',
|
|
386
|
-
'network is unreachable',
|
|
387
|
-
'could not resolve host',
|
|
388
|
-
'connection refused',
|
|
389
|
-
'no address associated with hostname',
|
|
390
|
-
].some((keyword) => lowerOutput.includes(keyword));
|
|
391
|
-
// Only trigger heuristic if the command actually failed (exit code != 0 or aborted)
|
|
392
|
-
const failed = !!result.error ||
|
|
578
|
+
if (!!result.error ||
|
|
393
579
|
!!result.signal ||
|
|
394
580
|
(result.exitCode !== undefined && result.exitCode !== 0) ||
|
|
395
|
-
result.aborted
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
}
|
|
421
|
-
while ((m = fallbackRegex.exec(result.error?.message || '')) !== null) {
|
|
422
|
-
const p = m[1];
|
|
423
|
-
if (p && !p.startsWith('/bin/') && !p.startsWith('/usr/bin/')) {
|
|
424
|
-
deniedPaths.add(p);
|
|
581
|
+
result.aborted) {
|
|
582
|
+
const sandboxDenial = this.context.config.sandboxManager.parseDenials(result);
|
|
583
|
+
if (sandboxDenial) {
|
|
584
|
+
const strippedCommand = stripShellWrapper(this.params.command);
|
|
585
|
+
const rootCommands = getCommandRoots(strippedCommand).filter((r) => r !== 'shopt');
|
|
586
|
+
const rootCommandDisplay = rootCommands.length > 0 ? rootCommands[0] : 'shell';
|
|
587
|
+
const readPaths = new Set(this.params[PARAM_ADDITIONAL_PERMISSIONS]?.fileSystem?.read || []);
|
|
588
|
+
const writePaths = new Set(this.params[PARAM_ADDITIONAL_PERMISSIONS]?.fileSystem?.write || []);
|
|
589
|
+
// Proactive permission suggestions for Node ecosystem tools
|
|
590
|
+
if (this.context.config.getSandboxEnabled()) {
|
|
591
|
+
const proactive = await getProactiveToolSuggestions(rootCommandDisplay);
|
|
592
|
+
if (proactive) {
|
|
593
|
+
if (proactive.network) {
|
|
594
|
+
sandboxDenial.network = true;
|
|
595
|
+
}
|
|
596
|
+
if (proactive.fileSystem?.read) {
|
|
597
|
+
for (const p of proactive.fileSystem.read) {
|
|
598
|
+
readPaths.add(p);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
if (proactive.fileSystem?.write) {
|
|
602
|
+
for (const p of proactive.fileSystem.write) {
|
|
603
|
+
writePaths.add(p);
|
|
604
|
+
}
|
|
605
|
+
}
|
|
425
606
|
}
|
|
426
607
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
608
|
+
if (sandboxDenial.filePaths) {
|
|
609
|
+
for (const p of sandboxDenial.filePaths) {
|
|
610
|
+
try {
|
|
611
|
+
// Find an existing parent directory to add instead of a non-existent file
|
|
612
|
+
let currentPath = p;
|
|
613
|
+
if (currentPath.startsWith('~')) {
|
|
614
|
+
currentPath = path.join(os.homedir(), currentPath.slice(1));
|
|
615
|
+
}
|
|
616
|
+
try {
|
|
617
|
+
if (fs.existsSync(currentPath) &&
|
|
618
|
+
fs.statSync(currentPath).isFile()) {
|
|
619
|
+
currentPath = path.dirname(currentPath);
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
catch {
|
|
623
|
+
/* ignore */
|
|
624
|
+
}
|
|
625
|
+
while (currentPath.length > 1) {
|
|
626
|
+
if (fs.existsSync(currentPath)) {
|
|
627
|
+
const mode = this.context.config.getApprovalMode();
|
|
628
|
+
const isReadonlyMode = this.context.config.sandboxPolicyManager.getModeConfig(mode)?.readonly ?? false;
|
|
629
|
+
const isAllowed = this.context.config.isPathAllowed(currentPath);
|
|
630
|
+
if (!isAllowed || isReadonlyMode) {
|
|
631
|
+
writePaths.add(currentPath);
|
|
632
|
+
readPaths.add(currentPath);
|
|
633
|
+
}
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
currentPath = path.dirname(currentPath);
|
|
637
|
+
}
|
|
438
638
|
}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
/* ignore */
|
|
442
|
-
}
|
|
443
|
-
while (currentPath.length > 1) {
|
|
444
|
-
if (fs.existsSync(currentPath)) {
|
|
445
|
-
writePaths.add(currentPath);
|
|
446
|
-
readPaths.add(currentPath);
|
|
447
|
-
break;
|
|
639
|
+
catch {
|
|
640
|
+
// ignore
|
|
448
641
|
}
|
|
449
|
-
currentPath = path.dirname(currentPath);
|
|
450
642
|
}
|
|
451
643
|
}
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
}
|
|
465
|
-
: undefined,
|
|
466
|
-
};
|
|
467
|
-
const originalReadSize = this.params[PARAM_ADDITIONAL_PERMISSIONS]?.fileSystem?.read?.length ||
|
|
468
|
-
0;
|
|
469
|
-
const originalWriteSize = this.params[PARAM_ADDITIONAL_PERMISSIONS]?.fileSystem?.write
|
|
470
|
-
?.length || 0;
|
|
471
|
-
const originalNetwork = !!this.params[PARAM_ADDITIONAL_PERMISSIONS]?.network;
|
|
472
|
-
const newReadSize = additionalPermissions.fileSystem?.read?.length || 0;
|
|
473
|
-
const newWriteSize = additionalPermissions.fileSystem?.write?.length || 0;
|
|
474
|
-
const newNetwork = !!additionalPermissions.network;
|
|
475
|
-
const hasNewPermissions = newReadSize > originalReadSize ||
|
|
476
|
-
newWriteSize > originalWriteSize ||
|
|
477
|
-
(!originalNetwork && newNetwork);
|
|
478
|
-
if (hasNewPermissions) {
|
|
479
|
-
const confirmationDetails = {
|
|
480
|
-
type: 'sandbox_expansion',
|
|
481
|
-
title: 'Sandbox Expansion Request',
|
|
482
|
-
command: this.params.command,
|
|
483
|
-
rootCommand: rootCommandDisplay,
|
|
484
|
-
additionalPermissions,
|
|
485
|
-
};
|
|
486
|
-
return {
|
|
487
|
-
llmContent: 'Sandbox expansion required',
|
|
488
|
-
returnDisplay: returnDisplayMessage,
|
|
489
|
-
error: {
|
|
490
|
-
type: ToolErrorType.SANDBOX_EXPANSION_REQUIRED,
|
|
491
|
-
message: JSON.stringify(confirmationDetails),
|
|
492
|
-
},
|
|
644
|
+
const simplifiedRead = this.simplifyPaths(readPaths);
|
|
645
|
+
const simplifiedWrite = this.simplifyPaths(writePaths);
|
|
646
|
+
const additionalPermissions = {
|
|
647
|
+
network: sandboxDenial.network ||
|
|
648
|
+
this.params[PARAM_ADDITIONAL_PERMISSIONS]?.network ||
|
|
649
|
+
undefined,
|
|
650
|
+
fileSystem: simplifiedRead.length > 0 || simplifiedWrite.length > 0
|
|
651
|
+
? {
|
|
652
|
+
read: simplifiedRead,
|
|
653
|
+
write: simplifiedWrite,
|
|
654
|
+
}
|
|
655
|
+
: undefined,
|
|
493
656
|
};
|
|
657
|
+
const originalReadSize = this.params[PARAM_ADDITIONAL_PERMISSIONS]?.fileSystem?.read
|
|
658
|
+
?.length || 0;
|
|
659
|
+
const originalWriteSize = this.params[PARAM_ADDITIONAL_PERMISSIONS]?.fileSystem?.write
|
|
660
|
+
?.length || 0;
|
|
661
|
+
const originalNetwork = !!this.params[PARAM_ADDITIONAL_PERMISSIONS]?.network;
|
|
662
|
+
const newReadSize = additionalPermissions.fileSystem?.read?.length || 0;
|
|
663
|
+
const newWriteSize = additionalPermissions.fileSystem?.write?.length || 0;
|
|
664
|
+
const newNetwork = !!additionalPermissions.network;
|
|
665
|
+
const hasNewPermissions = newReadSize > originalReadSize ||
|
|
666
|
+
newWriteSize > originalWriteSize ||
|
|
667
|
+
(!originalNetwork && newNetwork);
|
|
668
|
+
if (hasNewPermissions) {
|
|
669
|
+
const confirmationDetails = {
|
|
670
|
+
type: 'sandbox_expansion',
|
|
671
|
+
title: 'Sandbox Expansion Request',
|
|
672
|
+
command: this.params.command,
|
|
673
|
+
rootCommand: rootCommandDisplay,
|
|
674
|
+
additionalPermissions,
|
|
675
|
+
};
|
|
676
|
+
return {
|
|
677
|
+
llmContent: 'Sandbox expansion required',
|
|
678
|
+
returnDisplay,
|
|
679
|
+
error: {
|
|
680
|
+
type: ToolErrorType.SANDBOX_EXPANSION_REQUIRED,
|
|
681
|
+
message: JSON.stringify(confirmationDetails),
|
|
682
|
+
},
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
// If no new permissions were found by heuristic, do not intercept.
|
|
686
|
+
// Just return the normal execution error so the LLM can try providing explicit paths itself.
|
|
494
687
|
}
|
|
495
|
-
// If no new permissions were found by heuristic, do not intercept.
|
|
496
|
-
// Just return the normal execution error so the LLM can try providing explicit paths itself.
|
|
497
688
|
}
|
|
498
689
|
const summarizeConfig = this.context.config.getSummarizeToolOutputConfig();
|
|
499
690
|
const executionError = result.error
|
|
@@ -508,13 +699,13 @@ export class ShellToolInvocation extends BaseToolInvocation {
|
|
|
508
699
|
const summary = await summarizeToolOutput(this.context.config, { model: 'summarizer-shell' }, llmContent, this.context.geminiClient, signal);
|
|
509
700
|
return {
|
|
510
701
|
llmContent: summary,
|
|
511
|
-
returnDisplay
|
|
702
|
+
returnDisplay,
|
|
512
703
|
...executionError,
|
|
513
704
|
};
|
|
514
705
|
}
|
|
515
706
|
return {
|
|
516
707
|
llmContent,
|
|
517
|
-
returnDisplay
|
|
708
|
+
returnDisplay,
|
|
518
709
|
data,
|
|
519
710
|
...executionError,
|
|
520
711
|
};
|
|
@@ -556,7 +747,7 @@ export class ShellTool extends BaseDeclarativeTool {
|
|
|
556
747
|
return null;
|
|
557
748
|
}
|
|
558
749
|
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
559
|
-
return new ShellToolInvocation(this.context
|
|
750
|
+
return new ShellToolInvocation(this.context, params, messageBus, _toolName, _toolDisplayName);
|
|
560
751
|
}
|
|
561
752
|
getSchema(modelId) {
|
|
562
753
|
const definition = getShellDefinition(this.context.config.getEnableInteractiveShell(), this.context.config.getEnableShellOutputEfficiency(), this.context.config.getSandboxEnabled());
|