@office-ai/aioncli-core 0.18.6 → 0.24.0-preview.1
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/CONTRIBUTING.md +546 -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/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 +592 -0
- package/dist/docs/changelogs/latest.md +225 -0
- package/dist/docs/changelogs/preview.md +129 -0
- package/dist/docs/changelogs/releases.md +896 -0
- package/dist/docs/cli/authentication.md +3 -0
- package/dist/docs/cli/checkpointing.md +94 -0
- package/dist/docs/cli/commands.md +354 -0
- package/dist/docs/cli/configuration.md +780 -0
- package/dist/docs/cli/custom-commands.md +315 -0
- package/dist/docs/cli/enterprise.md +565 -0
- package/dist/docs/cli/gemini-ignore.md +71 -0
- package/dist/docs/cli/gemini-md.md +108 -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 +143 -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 +114 -0
- package/dist/docs/cli/skills.md +156 -0
- package/dist/docs/cli/system-prompt.md +93 -0
- package/dist/docs/cli/telemetry.md +791 -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 +244 -0
- package/dist/docs/core/policy-engine.md +267 -0
- package/dist/docs/core/tools-api.md +131 -0
- package/dist/docs/examples/proxy-script.md +83 -0
- package/dist/docs/extension.md +160 -0
- package/dist/docs/extensions/extension-releasing.md +183 -0
- package/dist/docs/extensions/getting-started-extensions.md +245 -0
- package/dist/docs/extensions/index.md +293 -0
- package/dist/docs/faq.md +154 -0
- package/dist/docs/get-started/authentication.md +321 -0
- package/dist/docs/get-started/configuration-v1.md +888 -0
- package/dist/docs/get-started/configuration.md +1536 -0
- package/dist/docs/get-started/deployment.md +143 -0
- package/dist/docs/get-started/examples.md +219 -0
- package/dist/docs/get-started/gemini-3.md +116 -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 +687 -0
- package/dist/docs/hooks/reference.md +168 -0
- package/dist/docs/hooks/writing-hooks.md +1026 -0
- package/dist/docs/ide-integration/ide-companion-spec.md +267 -0
- package/dist/docs/ide-integration/index.md +202 -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/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 +1044 -0
- package/dist/docs/tools/memory.md +54 -0
- package/dist/docs/tools/shell.md +260 -0
- package/dist/docs/tools/todos.md +57 -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 +158 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/agents/a2a-client-manager.d.ts +78 -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.d.ts +6 -0
- package/dist/src/agents/a2a-client-manager.test.js +237 -0
- package/dist/src/agents/a2a-client-manager.test.js.map +1 -0
- package/dist/src/agents/a2aUtils.d.ts +28 -0
- package/dist/src/agents/a2aUtils.js +111 -0
- package/dist/src/agents/a2aUtils.js.map +1 -0
- package/dist/src/agents/a2aUtils.test.d.ts +6 -0
- package/dist/src/agents/a2aUtils.test.js +147 -0
- package/dist/src/agents/a2aUtils.test.js.map +1 -0
- package/dist/src/agents/codebase-investigator.d.ts +2 -2
- package/dist/src/agents/codebase-investigator.js +5 -4
- package/dist/src/agents/codebase-investigator.js.map +1 -1
- package/dist/src/agents/delegate-to-agent-tool.d.ts +19 -0
- package/dist/src/agents/delegate-to-agent-tool.js +115 -0
- package/dist/src/agents/delegate-to-agent-tool.js.map +1 -0
- package/dist/src/agents/delegate-to-agent-tool.test.d.ts +6 -0
- package/dist/src/agents/delegate-to-agent-tool.test.js +165 -0
- package/dist/src/agents/delegate-to-agent-tool.test.js.map +1 -0
- package/dist/src/agents/introspection-agent.d.ts +23 -0
- package/dist/src/agents/introspection-agent.js +72 -0
- package/dist/src/agents/introspection-agent.js.map +1 -0
- package/dist/src/agents/introspection-agent.test.d.ts +6 -0
- package/dist/src/agents/introspection-agent.test.js +47 -0
- package/dist/src/agents/introspection-agent.test.js.map +1 -0
- package/dist/src/agents/local-executor.d.ts +108 -0
- package/dist/src/agents/local-executor.js +801 -0
- 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/local-executor.test.js +1380 -0
- package/dist/src/agents/local-executor.test.js.map +1 -0
- package/dist/src/agents/local-invocation.d.ts +45 -0
- package/dist/src/agents/local-invocation.js +101 -0
- 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/local-invocation.test.js +218 -0
- package/dist/src/agents/local-invocation.test.js.map +1 -0
- package/dist/src/agents/registry.d.ts +25 -1
- package/dist/src/agents/registry.js +149 -5
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/registry.test.js +247 -25
- 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 +129 -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 +25 -17
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
- package/dist/src/agents/toml-loader.d.ts +74 -0
- package/dist/src/agents/toml-loader.js +248 -0
- package/dist/src/agents/toml-loader.js.map +1 -0
- package/dist/src/agents/toml-loader.test.d.ts +6 -0
- package/dist/src/agents/toml-loader.test.js +309 -0
- package/dist/src/agents/toml-loader.test.js.map +1 -0
- package/dist/src/agents/types.d.ts +18 -4
- package/dist/src/availability/errorClassification.d.ts +7 -0
- package/dist/src/availability/errorClassification.js +20 -0
- package/dist/src/availability/errorClassification.js.map +1 -0
- package/dist/src/availability/modelAvailabilityService.d.ts +36 -0
- package/dist/src/availability/modelAvailabilityService.js +87 -0
- package/dist/src/availability/modelAvailabilityService.js.map +1 -0
- package/dist/src/availability/modelAvailabilityService.test.d.ts +6 -0
- package/dist/src/availability/modelAvailabilityService.test.js +140 -0
- package/dist/src/availability/modelAvailabilityService.test.js.map +1 -0
- package/dist/src/availability/modelPolicy.d.ts +49 -0
- package/dist/src/availability/modelPolicy.js +7 -0
- package/dist/src/availability/modelPolicy.js.map +1 -0
- package/dist/src/availability/policyCatalog.d.ts +23 -0
- package/dist/src/availability/policyCatalog.js +82 -0
- package/dist/src/availability/policyCatalog.js.map +1 -0
- package/dist/src/availability/policyCatalog.test.d.ts +6 -0
- package/dist/src/availability/policyCatalog.test.js +70 -0
- package/dist/src/availability/policyCatalog.test.js.map +1 -0
- package/dist/src/availability/policyHelpers.d.ts +52 -0
- package/dist/src/availability/policyHelpers.js +136 -0
- package/dist/src/availability/policyHelpers.js.map +1 -0
- package/dist/src/availability/policyHelpers.test.d.ts +6 -0
- package/dist/src/availability/policyHelpers.test.js +182 -0
- package/dist/src/availability/policyHelpers.test.js.map +1 -0
- package/dist/src/availability/testUtils.d.ts +10 -0
- package/dist/src/availability/testUtils.js +22 -0
- package/dist/src/availability/testUtils.js.map +1 -0
- package/dist/src/code_assist/experiments/client_metadata.js +3 -2
- package/dist/src/code_assist/experiments/client_metadata.js.map +1 -1
- package/dist/src/code_assist/experiments/client_metadata.test.js +7 -10
- package/dist/src/code_assist/experiments/client_metadata.test.js.map +1 -1
- package/dist/src/code_assist/experiments/experiments.js +2 -2
- package/dist/src/code_assist/experiments/experiments.js.map +1 -1
- package/dist/src/code_assist/oauth2.d.ts +2 -0
- package/dist/src/code_assist/oauth2.js +73 -17
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +195 -18
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +10 -1
- package/dist/src/code_assist/server.js +81 -15
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +221 -25
- 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 +156 -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 +300 -0
- package/dist/src/code_assist/telemetry.test.js.map +1 -0
- package/dist/src/code_assist/types.d.ts +84 -1
- package/dist/src/code_assist/types.js +21 -0
- package/dist/src/code_assist/types.js.map +1 -1
- package/dist/src/commands/init.d.ts +7 -0
- package/dist/src/commands/init.js +53 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/init.test.d.ts +6 -0
- package/dist/src/commands/init.test.js +25 -0
- package/dist/src/commands/init.test.js.map +1 -0
- package/dist/src/commands/restore.d.ts +9 -0
- package/dist/src/commands/restore.js +46 -0
- package/dist/src/commands/restore.js.map +1 -0
- package/dist/src/commands/restore.test.d.ts +6 -0
- package/dist/src/commands/restore.test.js +137 -0
- package/dist/src/commands/restore.test.js.map +1 -0
- package/dist/src/commands/types.d.ts +41 -0
- package/dist/src/commands/types.js +7 -0
- package/dist/src/commands/types.js.map +1 -0
- package/dist/src/config/config.d.ts +120 -23
- package/dist/src/config/config.js +336 -116
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +373 -95
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/defaultModelConfigs.js +46 -0
- package/dist/src/config/defaultModelConfigs.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 +29 -15
- package/dist/src/config/models.js +78 -28
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/models.test.js +91 -77
- package/dist/src/config/models.test.js.map +1 -1
- package/dist/src/config/storage.d.ts +4 -0
- package/dist/src/config/storage.js +12 -0
- 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.d.ts +6 -0
- package/dist/src/confirmation-bus/message-bus.js +66 -3
- package/dist/src/confirmation-bus/message-bus.js.map +1 -1
- package/dist/src/confirmation-bus/types.d.ts +29 -2
- package/dist/src/confirmation-bus/types.js +3 -0
- package/dist/src/confirmation-bus/types.js.map +1 -1
- package/dist/src/core/baseLlmClient.d.ts +30 -2
- package/dist/src/core/baseLlmClient.js +107 -49
- package/dist/src/core/baseLlmClient.js.map +1 -1
- package/dist/src/core/baseLlmClient.test.js +271 -13
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/client.d.ts +5 -1
- package/dist/src/core/client.js +241 -63
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +462 -72
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/clientHookTriggers.d.ts +36 -0
- package/dist/src/core/clientHookTriggers.js +76 -0
- package/dist/src/core/clientHookTriggers.js.map +1 -0
- package/dist/src/core/contentGenerator.js +17 -4
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +132 -3
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolHookTriggers.d.ts +55 -0
- package/dist/src/core/coreToolHookTriggers.js +304 -0
- package/dist/src/core/coreToolHookTriggers.js.map +1 -0
- 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 +6 -85
- package/dist/src/core/coreToolScheduler.js +69 -267
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +161 -346
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.js +132 -76
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +240 -257
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/geminiChatHookTriggers.d.ts +64 -0
- package/dist/src/core/geminiChatHookTriggers.js +136 -0
- package/dist/src/core/geminiChatHookTriggers.js.map +1 -0
- package/dist/src/core/geminiChat_network_retry.test.d.ts +6 -0
- package/dist/src/core/geminiChat_network_retry.test.js +196 -0
- package/dist/src/core/geminiChat_network_retry.test.js.map +1 -0
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.js +23 -6
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +13 -8
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/openaiContentGenerator.d.ts +25 -0
- package/dist/src/core/openaiContentGenerator.js +243 -14
- package/dist/src/core/openaiContentGenerator.js.map +1 -1
- package/dist/src/core/prompts.js +82 -26
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +102 -3
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/sessionHookTriggers.d.ts +29 -0
- package/dist/src/core/sessionHookTriggers.js +75 -0
- package/dist/src/core/sessionHookTriggers.js.map +1 -0
- package/dist/src/core/turn.d.ts +34 -21
- package/dist/src/core/turn.js +33 -13
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +0 -5
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/fallback/handler.js +101 -93
- package/dist/src/fallback/handler.js.map +1 -1
- package/dist/src/fallback/handler.test.js +186 -173
- package/dist/src/fallback/handler.test.js.map +1 -1
- package/dist/src/fallback/types.d.ts +8 -0
- package/dist/src/generated/git-commit.d.ts +3 -3
- package/dist/src/generated/git-commit.js +3 -3
- package/dist/src/generated/git-commit.js.map +1 -1
- package/dist/src/hooks/hookAggregator.js +7 -0
- package/dist/src/hooks/hookAggregator.js.map +1 -1
- package/dist/src/hooks/hookEventHandler.d.ts +113 -0
- package/dist/src/hooks/hookEventHandler.js +571 -0
- package/dist/src/hooks/hookEventHandler.js.map +1 -0
- package/dist/src/hooks/hookEventHandler.test.d.ts +6 -0
- package/dist/src/hooks/hookEventHandler.test.js +461 -0
- package/dist/src/hooks/hookEventHandler.test.js.map +1 -0
- 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 -18
- package/dist/src/hooks/hookRegistry.js +49 -35
- package/dist/src/hooks/hookRegistry.js.map +1 -1
- package/dist/src/hooks/hookRegistry.test.js +167 -8
- 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 +74 -18
- package/dist/src/hooks/hookRunner.js.map +1 -1
- package/dist/src/hooks/hookRunner.test.js +174 -36
- package/dist/src/hooks/hookRunner.test.js.map +1 -1
- package/dist/src/hooks/hookSystem.d.ts +40 -0
- package/dist/src/hooks/hookSystem.js +65 -0
- package/dist/src/hooks/hookSystem.js.map +1 -0
- package/dist/src/hooks/hookSystem.test.d.ts +6 -0
- package/dist/src/hooks/hookSystem.test.js +319 -0
- package/dist/src/hooks/hookSystem.test.js.map +1 -0
- package/dist/src/hooks/index.d.ts +17 -0
- package/dist/src/hooks/index.js +18 -0
- package/dist/src/hooks/index.js.map +1 -0
- 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 +21 -11
- package/dist/src/hooks/types.js +31 -27
- package/dist/src/hooks/types.js.map +1 -1
- package/dist/src/hooks/types.test.js +5 -24
- package/dist/src/hooks/types.test.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +32 -1
- package/dist/src/ide/detect-ide.test.js.map +1 -1
- package/dist/src/ide/ide-client.js +9 -4
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/ide/ide-client.test.js +17 -0
- package/dist/src/ide/ide-client.test.js.map +1 -1
- package/dist/src/ide/ide-installer.test.js +1 -1
- package/dist/src/ide/ide-installer.test.js.map +1 -1
- package/dist/src/ide/types.d.ts +4 -4
- package/dist/src/index.d.ts +17 -1
- package/dist/src/index.js +18 -2
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/auth-provider.d.ts +16 -0
- package/dist/src/mcp/auth-provider.js +7 -0
- package/dist/src/mcp/auth-provider.js.map +1 -0
- package/dist/src/mcp/google-auth-provider.d.ts +10 -2
- package/dist/src/mcp/google-auth-provider.js +28 -0
- package/dist/src/mcp/google-auth-provider.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.test.js +45 -0
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-provider.js +6 -2
- 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/sa-impersonation-provider.d.ts +2 -2
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -1
- package/dist/src/mcp/token-storage/hybrid-token-storage.js +1 -1
- package/dist/src/mcp/token-storage/hybrid-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/output/json-formatter.d.ts +2 -2
- package/dist/src/output/json-formatter.js +6 -3
- package/dist/src/output/json-formatter.js.map +1 -1
- package/dist/src/output/json-formatter.test.js +37 -9
- package/dist/src/output/json-formatter.test.js.map +1 -1
- package/dist/src/output/stream-json-formatter.js +6 -0
- package/dist/src/output/stream-json-formatter.js.map +1 -1
- package/dist/src/output/stream-json-formatter.test.js +98 -100
- package/dist/src/output/stream-json-formatter.test.js.map +1 -1
- package/dist/src/output/types.d.ts +3 -0
- package/dist/src/output/types.js.map +1 -1
- package/dist/src/policy/config.js +140 -15
- package/dist/src/policy/config.js.map +1 -1
- package/dist/src/policy/config.test.js +21 -0
- package/dist/src/policy/config.test.js.map +1 -1
- package/dist/src/policy/persistence.test.d.ts +6 -0
- package/dist/src/policy/persistence.test.js +154 -0
- package/dist/src/policy/persistence.test.js.map +1 -0
- package/dist/src/policy/policies/agent.toml +31 -0
- package/dist/src/policy/policies/read-only.toml +5 -0
- 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 +30 -1
- package/dist/src/policy/policy-engine.js +192 -5
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/policy-engine.test.js +520 -3
- package/dist/src/policy/policy-engine.test.js.map +1 -1
- package/dist/src/policy/policy-updater.test.d.ts +6 -0
- package/dist/src/policy/policy-updater.test.js +116 -0
- package/dist/src/policy/policy-updater.test.js.map +1 -0
- package/dist/src/policy/shell-safety.test.d.ts +6 -0
- package/dist/src/policy/shell-safety.test.js +75 -0
- package/dist/src/policy/shell-safety.test.js.map +1 -0
- package/dist/src/policy/toml-loader.d.ts +3 -5
- package/dist/src/policy/toml-loader.js +12 -60
- package/dist/src/policy/toml-loader.js.map +1 -1
- package/dist/src/policy/toml-loader.test.js +38 -7
- package/dist/src/policy/toml-loader.test.js.map +1 -1
- package/dist/src/policy/types.d.ts +72 -1
- package/dist/src/policy/types.js +21 -0
- package/dist/src/policy/types.js.map +1 -1
- package/dist/src/policy/utils.d.ts +21 -0
- package/dist/src/policy/utils.js +42 -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 +64 -0
- package/dist/src/policy/utils.test.js.map +1 -0
- package/dist/src/resources/resource-registry.d.ts +30 -0
- package/dist/src/resources/resource-registry.js +57 -0
- package/dist/src/resources/resource-registry.js.map +1 -0
- package/dist/src/resources/resource-registry.test.d.ts +6 -0
- package/dist/src/resources/resource-registry.test.js +54 -0
- package/dist/src/resources/resource-registry.test.js.map +1 -0
- package/dist/src/routing/modelRouterService.js +0 -15
- package/dist/src/routing/modelRouterService.js.map +1 -1
- package/dist/src/routing/modelRouterService.test.js +0 -62
- package/dist/src/routing/modelRouterService.test.js.map +1 -1
- package/dist/src/routing/strategies/classifierStrategy.js +10 -21
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -1
- package/dist/src/routing/strategies/classifierStrategy.test.js +2 -1
- 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.js +20 -12
- package/dist/src/routing/strategies/fallbackStrategy.js.map +1 -1
- package/dist/src/routing/strategies/fallbackStrategy.test.js +63 -39
- package/dist/src/routing/strategies/fallbackStrategy.test.js.map +1 -1
- package/dist/src/routing/strategies/overrideStrategy.js +3 -2
- package/dist/src/routing/strategies/overrideStrategy.js.map +1 -1
- package/dist/src/safety/checker-runner.js +17 -6
- package/dist/src/safety/checker-runner.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/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.d.ts +1 -0
- package/dist/src/services/chatCompressionService.js +38 -8
- package/dist/src/services/chatCompressionService.js.map +1 -1
- package/dist/src/services/chatCompressionService.test.js +35 -31
- package/dist/src/services/chatCompressionService.test.js.map +1 -1
- package/dist/src/services/chatRecordingService.d.ts +14 -0
- package/dist/src/services/chatRecordingService.js +37 -0
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/contextManager.d.ts +29 -0
- package/dist/src/services/contextManager.js +71 -0
- package/dist/src/services/contextManager.js.map +1 -0
- package/dist/src/services/contextManager.test.d.ts +6 -0
- package/dist/src/services/contextManager.test.js +104 -0
- package/dist/src/services/contextManager.test.js.map +1 -0
- package/dist/src/services/environmentSanitization.d.ts +15 -0
- package/dist/src/services/environmentSanitization.js +141 -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/fileSystemService.d.ts +0 -9
- package/dist/src/services/fileSystemService.js +0 -11
- package/dist/src/services/fileSystemService.js.map +1 -1
- package/dist/src/services/gitService.js +18 -2
- package/dist/src/services/gitService.js.map +1 -1
- package/dist/src/services/gitService.test.js +56 -0
- package/dist/src/services/gitService.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.js +5 -4
- 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.golden.test.js +32 -0
- package/dist/src/services/modelConfig.golden.test.js.map +1 -1
- package/dist/src/services/modelConfig.integration.test.js +1 -1
- package/dist/src/services/modelConfig.integration.test.js.map +1 -1
- package/dist/src/services/modelConfigService.d.ts +4 -0
- package/dist/src/services/modelConfigService.js +8 -3
- package/dist/src/services/modelConfigService.js.map +1 -1
- package/dist/src/services/modelConfigService.test.js +221 -0
- package/dist/src/services/modelConfigService.test.js.map +1 -1
- package/dist/src/services/modelConfigServiceTestUtils.d.ts +10 -0
- package/dist/src/services/modelConfigServiceTestUtils.js +17 -0
- package/dist/src/services/modelConfigServiceTestUtils.js.map +1 -0
- package/dist/src/services/sessionSummaryService.d.ts +28 -0
- package/dist/src/services/sessionSummaryService.js +131 -0
- package/dist/src/services/sessionSummaryService.js.map +1 -0
- package/dist/src/services/sessionSummaryService.test.d.ts +6 -0
- package/dist/src/services/sessionSummaryService.test.js +785 -0
- package/dist/src/services/sessionSummaryService.test.js.map +1 -0
- package/dist/src/services/sessionSummaryUtils.d.ts +16 -0
- package/dist/src/services/sessionSummaryUtils.js +129 -0
- package/dist/src/services/sessionSummaryUtils.js.map +1 -0
- package/dist/src/services/sessionSummaryUtils.test.d.ts +6 -0
- package/dist/src/services/sessionSummaryUtils.test.js +137 -0
- package/dist/src/services/sessionSummaryUtils.test.js.map +1 -0
- package/dist/src/services/shellExecutionService.d.ts +4 -0
- package/dist/src/services/shellExecutionService.js +45 -27
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +240 -8
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/services/test-data/resolved-aliases-retry.golden.json +238 -0
- package/dist/src/services/test-data/resolved-aliases.golden.json +36 -0
- package/dist/src/skills/skillLoader.d.ts +28 -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 +1 -0
- package/dist/src/skills/skillLoader.test.js +2 -0
- package/dist/src/skills/skillLoader.test.js.map +1 -0
- package/dist/src/skills/skillManager.d.ts +51 -0
- package/dist/src/skills/skillManager.js +89 -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 +128 -0
- package/dist/src/skills/skillManager.test.js.map +1 -0
- package/dist/src/telemetry/activity-detector.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +11 -7
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +127 -47
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +105 -18
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +9 -3
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +20 -5
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/config.js +2 -0
- package/dist/src/telemetry/config.js.map +1 -1
- package/dist/src/telemetry/config.test.js +25 -0
- package/dist/src/telemetry/config.test.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.d.ts +4 -3
- package/dist/src/telemetry/gcp-exporters.js +8 -4
- package/dist/src/telemetry/gcp-exporters.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +2 -1
- package/dist/src/telemetry/index.js +2 -1
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +5 -3
- package/dist/src/telemetry/loggers.js +353 -334
- 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 +238 -31
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +22 -0
- package/dist/src/telemetry/metrics.js +32 -0
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +64 -0
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/sanitize.d.ts +25 -0
- package/dist/src/telemetry/sanitize.js +48 -0
- package/dist/src/telemetry/sanitize.js.map +1 -0
- package/dist/src/telemetry/sanitize.test.d.ts +6 -0
- package/dist/src/telemetry/sanitize.test.js +279 -0
- package/dist/src/telemetry/sanitize.test.js.map +1 -0
- package/dist/src/telemetry/sdk.d.ts +9 -2
- package/dist/src/telemetry/sdk.js +142 -17
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/sdk.test.js +130 -28
- package/dist/src/telemetry/sdk.test.js.map +1 -1
- package/dist/src/telemetry/semantic.js +1 -1
- package/dist/src/telemetry/semantic.js.map +1 -1
- package/dist/src/telemetry/startupProfiler.d.ts +51 -0
- package/dist/src/telemetry/startupProfiler.js +170 -0
- package/dist/src/telemetry/startupProfiler.js.map +1 -0
- package/dist/src/telemetry/startupProfiler.test.d.ts +6 -0
- package/dist/src/telemetry/startupProfiler.test.js +285 -0
- package/dist/src/telemetry/startupProfiler.test.js.map +1 -0
- package/dist/src/telemetry/telemetry.test.js +10 -3
- package/dist/src/telemetry/telemetry.test.js.map +1 -1
- package/dist/src/telemetry/trace.js +2 -2
- package/dist/src/telemetry/trace.js.map +1 -1
- package/dist/src/telemetry/types.d.ts +62 -16
- package/dist/src/telemetry/types.js +157 -27
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +1 -0
- package/dist/src/telemetry/uiTelemetry.js +2 -0
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +4 -0
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/mock-message-bus.d.ts +61 -0
- package/dist/src/test-utils/mock-message-bus.js +160 -0
- package/dist/src/test-utils/mock-message-bus.js.map +1 -0
- package/dist/src/test-utils/mock-tool.d.ts +5 -3
- package/dist/src/test-utils/mock-tool.js +12 -11
- 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 +120 -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 +95 -0
- package/dist/src/tools/activate-skill.test.js.map +1 -0
- package/dist/src/tools/confirmation-policy.test.d.ts +6 -0
- package/dist/src/tools/confirmation-policy.test.js +142 -0
- package/dist/src/tools/confirmation-policy.test.js.map +1 -0
- package/dist/src/tools/edit.d.ts +27 -5
- package/dist/src/tools/edit.js +449 -137
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +258 -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 +129 -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.d.ts +3 -1
- package/dist/src/tools/mcp-client-manager.js +42 -9
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +66 -10
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +44 -6
- package/dist/src/tools/mcp-client.js +476 -176
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +633 -36
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +2 -2
- package/dist/src/tools/mcp-tool.js +20 -7
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +35 -5
- 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 +3 -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/modifiable-tool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.test.js +22 -13
- package/dist/src/tools/modifiable-tool.test.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +2 -2
- package/dist/src/tools/read-file.js +2 -2
- 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 +7 -6
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +4 -3
- 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 +5 -7
- package/dist/src/tools/shell.js +77 -51
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +59 -63
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/tool-error.d.ts +2 -1
- package/dist/src/tools/tool-error.js +2 -0
- package/dist/src/tools/tool-error.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +17 -0
- package/dist/src/tools/tool-names.js +59 -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 +25 -6
- package/dist/src/tools/tools.js +44 -25
- 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 +22 -9
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +18 -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 +10 -4
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +4 -1
- 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/bfsFileSearch.d.ts +8 -0
- package/dist/src/utils/bfsFileSearch.js +63 -23
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.test.js +65 -1
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
- package/dist/src/utils/checkpointUtils.d.ts +82 -0
- package/dist/src/utils/checkpointUtils.js +117 -0
- package/dist/src/utils/checkpointUtils.js.map +1 -0
- package/dist/src/utils/checkpointUtils.test.d.ts +6 -0
- package/dist/src/utils/checkpointUtils.test.js +229 -0
- package/dist/src/utils/checkpointUtils.test.js.map +1 -0
- package/dist/src/utils/customHeaderUtils.d.ts +9 -0
- package/dist/src/utils/customHeaderUtils.js +34 -0
- package/dist/src/utils/customHeaderUtils.js.map +1 -0
- package/dist/src/utils/customHeaderUtils.test.d.ts +6 -0
- package/dist/src/utils/customHeaderUtils.test.js +77 -0
- package/dist/src/utils/customHeaderUtils.test.js.map +1 -0
- package/dist/src/utils/debugLogger.d.ts +3 -0
- package/dist/src/utils/debugLogger.js +28 -0
- package/dist/src/utils/debugLogger.js.map +1 -1
- package/dist/src/utils/editCorrector.js +6 -5
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +7 -3
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/editor.d.ts +9 -1
- package/dist/src/utils/editor.js +23 -14
- package/dist/src/utils/editor.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/errors.d.ts +8 -0
- package/dist/src/utils/errors.js +39 -2
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/errors.test.d.ts +6 -0
- package/dist/src/utils/errors.test.js +155 -0
- package/dist/src/utils/errors.test.js.map +1 -0
- package/dist/src/utils/events.d.ts +49 -19
- package/dist/src/utils/events.js +21 -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/exitCodes.d.ts +12 -0
- package/dist/src/utils/exitCodes.js +13 -0
- package/dist/src/utils/exitCodes.js.map +1 -0
- package/dist/src/utils/extensionLoader.d.ts +2 -2
- package/dist/src/utils/extensionLoader.js +5 -6
- package/dist/src/utils/extensionLoader.js.map +1 -1
- package/dist/src/utils/extensionLoader.test.js +11 -0
- package/dist/src/utils/extensionLoader.test.js.map +1 -1
- package/dist/src/utils/fetch.d.ts +1 -1
- package/dist/src/utils/fetch.js +3 -3
- package/dist/src/utils/fetch.js.map +1 -1
- 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 +127 -1
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/filesearch/crawlCache.js.map +1 -1
- package/dist/src/utils/filesearch/fileSearch.js.map +1 -1
- package/dist/src/utils/flashFallback.test.js +1 -1
- package/dist/src/utils/flashFallback.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/googleErrors.js +31 -18
- package/dist/src/utils/googleErrors.js.map +1 -1
- package/dist/src/utils/googleErrors.test.js +10 -2
- package/dist/src/utils/googleErrors.test.js.map +1 -1
- package/dist/src/utils/googleQuotaErrors.d.ts +3 -3
- package/dist/src/utils/googleQuotaErrors.js +32 -6
- package/dist/src/utils/googleQuotaErrors.js.map +1 -1
- package/dist/src/utils/googleQuotaErrors.test.js +94 -2
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.d.ts +5 -0
- package/dist/src/utils/memoryDiscovery.js +9 -5
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +31 -1
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.test.js +4 -0
- package/dist/src/utils/nextSpeakerChecker.test.js.map +1 -1
- package/dist/src/utils/package.d.ts +14 -0
- package/dist/src/utils/package.js +15 -2
- package/dist/src/utils/package.js.map +1 -1
- package/dist/src/utils/pathCorrector.js +12 -2
- package/dist/src/utils/pathCorrector.js.map +1 -1
- package/dist/src/utils/pathCorrector.test.js +6 -2
- package/dist/src/utils/pathCorrector.test.js.map +1 -1
- package/dist/src/utils/retry.d.ts +11 -0
- package/dist/src/utils/retry.js +62 -21
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +170 -10
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/schemaValidator.d.ts +1 -1
- package/dist/src/utils/schemaValidator.js +1 -1
- package/dist/src/utils/shell-permissions.d.ts +52 -0
- package/dist/src/utils/shell-permissions.js +188 -0
- package/dist/src/utils/shell-permissions.js.map +1 -0
- package/dist/src/utils/shell-permissions.test.d.ts +6 -0
- package/dist/src/utils/shell-permissions.test.js +369 -0
- package/dist/src/utils/shell-permissions.test.js.map +1 -0
- package/dist/src/utils/shell-utils.d.ts +16 -47
- package/dist/src/utils/shell-utils.js +99 -195
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +99 -288
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/stdio.d.ts +2 -2
- package/dist/src/utils/stdio.js +2 -2
- package/dist/src/utils/stdio.js.map +1 -1
- package/dist/src/utils/stdio.test.js +5 -5
- package/dist/src/utils/stdio.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/terminalSerializer.test.js +17 -0
- package/dist/src/utils/terminalSerializer.test.js.map +1 -1
- package/dist/src/utils/tokenCalculation.d.ts +19 -0
- package/dist/src/utils/tokenCalculation.js +85 -0
- package/dist/src/utils/tokenCalculation.js.map +1 -0
- package/dist/src/utils/tokenCalculation.test.d.ts +6 -0
- package/dist/src/utils/tokenCalculation.test.js +87 -0
- package/dist/src/utils/tokenCalculation.test.js.map +1 -0
- 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/version.d.ts +6 -0
- package/dist/src/utils/version.js +15 -0
- package/dist/src/utils/version.js.map +1 -0
- package/dist/src/utils/version.test.d.ts +6 -0
- package/dist/src/utils/version.test.js +39 -0
- package/dist/src/utils/version.test.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +8 -7
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# Gemini CLI core
|
|
2
|
+
|
|
3
|
+
Gemini CLI's core package (`packages/core`) is the backend portion of Gemini
|
|
4
|
+
CLI, handling communication with the Gemini API, managing tools, and processing
|
|
5
|
+
requests sent from `packages/cli`. For a general overview of Gemini CLI, see the
|
|
6
|
+
[main documentation page](../index.md).
|
|
7
|
+
|
|
8
|
+
## Navigating this section
|
|
9
|
+
|
|
10
|
+
- **[Core tools API](./tools-api.md):** Information on how tools are defined,
|
|
11
|
+
registered, and used by the core.
|
|
12
|
+
- **[Memory Import Processor](./memport.md):** Documentation for the modular
|
|
13
|
+
GEMINI.md import feature using @file.md syntax.
|
|
14
|
+
- **[Policy Engine](./policy-engine.md):** Use the Policy Engine for
|
|
15
|
+
fine-grained control over tool execution.
|
|
16
|
+
|
|
17
|
+
## Role of the core
|
|
18
|
+
|
|
19
|
+
While the `packages/cli` portion of Gemini CLI provides the user interface,
|
|
20
|
+
`packages/core` is responsible for:
|
|
21
|
+
|
|
22
|
+
- **Gemini API interaction:** Securely communicating with the Google Gemini API,
|
|
23
|
+
sending user prompts, and receiving model responses.
|
|
24
|
+
- **Prompt engineering:** Constructing effective prompts for the Gemini model,
|
|
25
|
+
potentially incorporating conversation history, tool definitions, and
|
|
26
|
+
instructional context from `GEMINI.md` files.
|
|
27
|
+
- **Tool management & orchestration:**
|
|
28
|
+
- Registering available tools (e.g., file system tools, shell command
|
|
29
|
+
execution).
|
|
30
|
+
- Interpreting tool use requests from the Gemini model.
|
|
31
|
+
- Executing the requested tools with the provided arguments.
|
|
32
|
+
- Returning tool execution results to the Gemini model for further processing.
|
|
33
|
+
- **Session and state management:** Keeping track of the conversation state,
|
|
34
|
+
including history and any relevant context required for coherent interactions.
|
|
35
|
+
- **Configuration:** Managing core-specific configurations, such as API key
|
|
36
|
+
access, model selection, and tool settings.
|
|
37
|
+
|
|
38
|
+
## Security considerations
|
|
39
|
+
|
|
40
|
+
The core plays a vital role in security:
|
|
41
|
+
|
|
42
|
+
- **API key management:** It handles the `GEMINI_API_KEY` and ensures it's used
|
|
43
|
+
securely when communicating with the Gemini API.
|
|
44
|
+
- **Tool execution:** When tools interact with the local system (e.g.,
|
|
45
|
+
`run_shell_command`), the core (and its underlying tool implementations) must
|
|
46
|
+
do so with appropriate caution, often involving sandboxing mechanisms to
|
|
47
|
+
prevent unintended modifications.
|
|
48
|
+
|
|
49
|
+
## Chat history compression
|
|
50
|
+
|
|
51
|
+
To ensure that long conversations don't exceed the token limits of the Gemini
|
|
52
|
+
model, the core includes a chat history compression feature.
|
|
53
|
+
|
|
54
|
+
When a conversation approaches the token limit for the configured model, the
|
|
55
|
+
core automatically compresses the conversation history before sending it to the
|
|
56
|
+
model. This compression is designed to be lossless in terms of the information
|
|
57
|
+
conveyed, but it reduces the overall number of tokens used.
|
|
58
|
+
|
|
59
|
+
You can find the token limits for each model in the
|
|
60
|
+
[Google AI documentation](https://ai.google.dev/gemini-api/docs/models).
|
|
61
|
+
|
|
62
|
+
## Model fallback
|
|
63
|
+
|
|
64
|
+
Gemini CLI includes a model fallback mechanism to ensure that you can continue
|
|
65
|
+
to use the CLI even if the default "pro" model is rate-limited.
|
|
66
|
+
|
|
67
|
+
If you are using the default "pro" model and the CLI detects that you are being
|
|
68
|
+
rate-limited, it automatically switches to the "flash" model for the current
|
|
69
|
+
session. This allows you to continue working without interruption.
|
|
70
|
+
|
|
71
|
+
## File discovery service
|
|
72
|
+
|
|
73
|
+
The file discovery service is responsible for finding files in the project that
|
|
74
|
+
are relevant to the current context. It is used by the `@` command and other
|
|
75
|
+
tools that need to access files.
|
|
76
|
+
|
|
77
|
+
## Memory discovery service
|
|
78
|
+
|
|
79
|
+
The memory discovery service is responsible for finding and loading the
|
|
80
|
+
`GEMINI.md` files that provide context to the model. It searches for these files
|
|
81
|
+
in a hierarchical manner, starting from the current working directory and moving
|
|
82
|
+
up to the project root and the user's home directory. It also searches in
|
|
83
|
+
subdirectories.
|
|
84
|
+
|
|
85
|
+
This allows you to have global, project-level, and component-level context
|
|
86
|
+
files, which are all combined to provide the model with the most relevant
|
|
87
|
+
information.
|
|
88
|
+
|
|
89
|
+
You can use the [`/memory` command](../cli/commands.md) to `show`, `add`, and
|
|
90
|
+
`refresh` the content of loaded `GEMINI.md` files.
|
|
91
|
+
|
|
92
|
+
## Citations
|
|
93
|
+
|
|
94
|
+
When Gemini finds it is reciting text from a source it appends the citation to
|
|
95
|
+
the output. It is enabled by default but can be disabled with the
|
|
96
|
+
ui.showCitations setting.
|
|
97
|
+
|
|
98
|
+
- When proposing an edit the citations display before giving the user the option
|
|
99
|
+
to accept.
|
|
100
|
+
- Citations are always shown at the end of the model’s turn.
|
|
101
|
+
- We deduplicate citations and display them in alphabetical order.
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
# Memory Import Processor
|
|
2
|
+
|
|
3
|
+
The Memory Import Processor is a feature that allows you to modularize your
|
|
4
|
+
GEMINI.md files by importing content from other files using the `@file.md`
|
|
5
|
+
syntax.
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This feature enables you to break down large GEMINI.md files into smaller, more
|
|
10
|
+
manageable components that can be reused across different contexts. The import
|
|
11
|
+
processor supports both relative and absolute paths, with built-in safety
|
|
12
|
+
features to prevent circular imports and ensure file access security.
|
|
13
|
+
|
|
14
|
+
## Syntax
|
|
15
|
+
|
|
16
|
+
Use the `@` symbol followed by the path to the file you want to import:
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
# Main GEMINI.md file
|
|
20
|
+
|
|
21
|
+
This is the main content.
|
|
22
|
+
|
|
23
|
+
@./components/instructions.md
|
|
24
|
+
|
|
25
|
+
More content here.
|
|
26
|
+
|
|
27
|
+
@./shared/configuration.md
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Supported path formats
|
|
31
|
+
|
|
32
|
+
### Relative paths
|
|
33
|
+
|
|
34
|
+
- `@./file.md` - Import from the same directory
|
|
35
|
+
- `@../file.md` - Import from parent directory
|
|
36
|
+
- `@./components/file.md` - Import from subdirectory
|
|
37
|
+
|
|
38
|
+
### Absolute paths
|
|
39
|
+
|
|
40
|
+
- `@/absolute/path/to/file.md` - Import using absolute path
|
|
41
|
+
|
|
42
|
+
## Examples
|
|
43
|
+
|
|
44
|
+
### Basic import
|
|
45
|
+
|
|
46
|
+
```markdown
|
|
47
|
+
# My GEMINI.md
|
|
48
|
+
|
|
49
|
+
Welcome to my project!
|
|
50
|
+
|
|
51
|
+
@./get-started.md
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
@./features/overview.md
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Nested imports
|
|
59
|
+
|
|
60
|
+
The imported files can themselves contain imports, creating a nested structure:
|
|
61
|
+
|
|
62
|
+
```markdown
|
|
63
|
+
# main.md
|
|
64
|
+
|
|
65
|
+
@./header.md @./content.md @./footer.md
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```markdown
|
|
69
|
+
# header.md
|
|
70
|
+
|
|
71
|
+
# Project Header
|
|
72
|
+
|
|
73
|
+
@./shared/title.md
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Safety features
|
|
77
|
+
|
|
78
|
+
### Circular import detection
|
|
79
|
+
|
|
80
|
+
The processor automatically detects and prevents circular imports:
|
|
81
|
+
|
|
82
|
+
```markdown
|
|
83
|
+
# file-a.md
|
|
84
|
+
|
|
85
|
+
@./file-b.md
|
|
86
|
+
|
|
87
|
+
# file-b.md
|
|
88
|
+
|
|
89
|
+
@./file-a.md <!-- This will be detected and prevented -->
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### File access security
|
|
93
|
+
|
|
94
|
+
The `validateImportPath` function ensures that imports are only allowed from
|
|
95
|
+
specified directories, preventing access to sensitive files outside the allowed
|
|
96
|
+
scope.
|
|
97
|
+
|
|
98
|
+
### Maximum import depth
|
|
99
|
+
|
|
100
|
+
To prevent infinite recursion, there's a configurable maximum import depth
|
|
101
|
+
(default: 5 levels).
|
|
102
|
+
|
|
103
|
+
## Error handling
|
|
104
|
+
|
|
105
|
+
### Missing files
|
|
106
|
+
|
|
107
|
+
If a referenced file doesn't exist, the import will fail gracefully with an
|
|
108
|
+
error comment in the output.
|
|
109
|
+
|
|
110
|
+
### File access errors
|
|
111
|
+
|
|
112
|
+
Permission issues or other file system errors are handled gracefully with
|
|
113
|
+
appropriate error messages.
|
|
114
|
+
|
|
115
|
+
## Code region detection
|
|
116
|
+
|
|
117
|
+
The import processor uses the `marked` library to detect code blocks and inline
|
|
118
|
+
code spans, ensuring that `@` imports inside these regions are properly ignored.
|
|
119
|
+
This provides robust handling of nested code blocks and complex Markdown
|
|
120
|
+
structures.
|
|
121
|
+
|
|
122
|
+
## Import tree structure
|
|
123
|
+
|
|
124
|
+
The processor returns an import tree that shows the hierarchy of imported files,
|
|
125
|
+
similar to Claude's `/memory` feature. This helps users debug problems with
|
|
126
|
+
their GEMINI.md files by showing which files were read and their import
|
|
127
|
+
relationships.
|
|
128
|
+
|
|
129
|
+
Example tree structure:
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
Memory Files
|
|
133
|
+
L project: GEMINI.md
|
|
134
|
+
L a.md
|
|
135
|
+
L b.md
|
|
136
|
+
L c.md
|
|
137
|
+
L d.md
|
|
138
|
+
L e.md
|
|
139
|
+
L f.md
|
|
140
|
+
L included.md
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The tree preserves the order that files were imported and shows the complete
|
|
144
|
+
import chain for debugging purposes.
|
|
145
|
+
|
|
146
|
+
## Comparison to Claude Code's `/memory` (`claude.md`) approach
|
|
147
|
+
|
|
148
|
+
Claude Code's `/memory` feature (as seen in `claude.md`) produces a flat, linear
|
|
149
|
+
document by concatenating all included files, always marking file boundaries
|
|
150
|
+
with clear comments and path names. It does not explicitly present the import
|
|
151
|
+
hierarchy, but the LLM receives all file contents and paths, which is sufficient
|
|
152
|
+
for reconstructing the hierarchy if needed.
|
|
153
|
+
|
|
154
|
+
> [!NOTE] The import tree is mainly for clarity during development and has
|
|
155
|
+
> limited relevance to LLM consumption.
|
|
156
|
+
|
|
157
|
+
## API reference
|
|
158
|
+
|
|
159
|
+
### `processImports(content, basePath, debugMode?, importState?)`
|
|
160
|
+
|
|
161
|
+
Processes import statements in GEMINI.md content.
|
|
162
|
+
|
|
163
|
+
**Parameters:**
|
|
164
|
+
|
|
165
|
+
- `content` (string): The content to process for imports
|
|
166
|
+
- `basePath` (string): The directory path where the current file is located
|
|
167
|
+
- `debugMode` (boolean, optional): Whether to enable debug logging (default:
|
|
168
|
+
false)
|
|
169
|
+
- `importState` (ImportState, optional): State tracking for circular import
|
|
170
|
+
prevention
|
|
171
|
+
|
|
172
|
+
**Returns:** Promise<ProcessImportsResult> - Object containing processed
|
|
173
|
+
content and import tree
|
|
174
|
+
|
|
175
|
+
### `ProcessImportsResult`
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
interface ProcessImportsResult {
|
|
179
|
+
content: string; // The processed content with imports resolved
|
|
180
|
+
importTree: MemoryFile; // Tree structure showing the import hierarchy
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### `MemoryFile`
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
interface MemoryFile {
|
|
188
|
+
path: string; // The file path
|
|
189
|
+
imports?: MemoryFile[]; // Direct imports, in the order they were imported
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### `validateImportPath(importPath, basePath, allowedDirectories)`
|
|
194
|
+
|
|
195
|
+
Validates import paths to ensure they are safe and within allowed directories.
|
|
196
|
+
|
|
197
|
+
**Parameters:**
|
|
198
|
+
|
|
199
|
+
- `importPath` (string): The import path to validate
|
|
200
|
+
- `basePath` (string): The base directory for resolving relative paths
|
|
201
|
+
- `allowedDirectories` (string[]): Array of allowed directory paths
|
|
202
|
+
|
|
203
|
+
**Returns:** boolean - Whether the import path is valid
|
|
204
|
+
|
|
205
|
+
### `findProjectRoot(startDir)`
|
|
206
|
+
|
|
207
|
+
Finds the project root by searching for a `.git` directory upwards from the
|
|
208
|
+
given start directory. Implemented as an **async** function using non-blocking
|
|
209
|
+
file system APIs to avoid blocking the Node.js event loop.
|
|
210
|
+
|
|
211
|
+
**Parameters:**
|
|
212
|
+
|
|
213
|
+
- `startDir` (string): The directory to start searching from
|
|
214
|
+
|
|
215
|
+
**Returns:** Promise<string> - The project root directory (or the start
|
|
216
|
+
directory if no `.git` is found)
|
|
217
|
+
|
|
218
|
+
## Best Practices
|
|
219
|
+
|
|
220
|
+
1. **Use descriptive file names** for imported components
|
|
221
|
+
2. **Keep imports shallow** - avoid deeply nested import chains
|
|
222
|
+
3. **Document your structure** - maintain a clear hierarchy of imported files
|
|
223
|
+
4. **Test your imports** - ensure all referenced files exist and are accessible
|
|
224
|
+
5. **Use relative paths** when possible for better portability
|
|
225
|
+
|
|
226
|
+
## Troubleshooting
|
|
227
|
+
|
|
228
|
+
### Common issues
|
|
229
|
+
|
|
230
|
+
1. **Import not working**: Check that the file exists and the path is correct
|
|
231
|
+
2. **Circular import warnings**: Review your import structure for circular
|
|
232
|
+
references
|
|
233
|
+
3. **Permission errors**: Ensure the files are readable and within allowed
|
|
234
|
+
directories
|
|
235
|
+
4. **Path resolution issues**: Use absolute paths if relative paths aren't
|
|
236
|
+
resolving correctly
|
|
237
|
+
|
|
238
|
+
### Debug mode
|
|
239
|
+
|
|
240
|
+
Enable debug mode to see detailed logging of the import process:
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
const result = await processImports(content, basePath, true);
|
|
244
|
+
```
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
# Policy engine
|
|
2
|
+
|
|
3
|
+
The Gemini CLI includes a powerful policy engine that provides fine-grained
|
|
4
|
+
control over tool execution. It allows users and administrators to define rules
|
|
5
|
+
that determine whether a tool call should be allowed, denied, or require user
|
|
6
|
+
confirmation.
|
|
7
|
+
|
|
8
|
+
## Quick start
|
|
9
|
+
|
|
10
|
+
To create your first policy:
|
|
11
|
+
|
|
12
|
+
1. **Create the policy directory** if it doesn't exist:
|
|
13
|
+
```bash
|
|
14
|
+
mkdir -p ~/.gemini/policies
|
|
15
|
+
```
|
|
16
|
+
2. **Create a new policy file** (e.g., `~/.gemini/policies/my-rules.toml`). You
|
|
17
|
+
can use any filename ending in `.toml`; all such files in this directory
|
|
18
|
+
will be loaded and combined:
|
|
19
|
+
```toml
|
|
20
|
+
[[rule]]
|
|
21
|
+
toolName = "run_shell_command"
|
|
22
|
+
commandPrefix = "git status"
|
|
23
|
+
decision = "allow"
|
|
24
|
+
priority = 100
|
|
25
|
+
```
|
|
26
|
+
3. **Run a command** that triggers the policy (e.g., ask Gemini CLI to
|
|
27
|
+
`git status`). The tool will now execute automatically without prompting for
|
|
28
|
+
confirmation.
|
|
29
|
+
|
|
30
|
+
## Core concepts
|
|
31
|
+
|
|
32
|
+
The policy engine operates on a set of rules. Each rule is a combination of
|
|
33
|
+
conditions and a resulting decision. When a large language model wants to
|
|
34
|
+
execute a tool, the policy engine evaluates all rules to find the
|
|
35
|
+
highest-priority rule that matches the tool call.
|
|
36
|
+
|
|
37
|
+
A rule consists of the following main components:
|
|
38
|
+
|
|
39
|
+
- **Conditions**: Criteria that a tool call must meet for the rule to apply.
|
|
40
|
+
This can include the tool's name, the arguments provided to it, or the current
|
|
41
|
+
approval mode.
|
|
42
|
+
- **Decision**: The action to take if the rule matches (`allow`, `deny`, or
|
|
43
|
+
`ask_user`).
|
|
44
|
+
- **Priority**: A number that determines the rule's precedence. Higher numbers
|
|
45
|
+
win.
|
|
46
|
+
|
|
47
|
+
For example, this rule will ask for user confirmation before executing any `git`
|
|
48
|
+
command.
|
|
49
|
+
|
|
50
|
+
```toml
|
|
51
|
+
[[rule]]
|
|
52
|
+
toolName = "run_shell_command"
|
|
53
|
+
commandPrefix = "git "
|
|
54
|
+
decision = "ask_user"
|
|
55
|
+
priority = 100
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Conditions
|
|
59
|
+
|
|
60
|
+
Conditions are the criteria that a tool call must meet for a rule to apply. The
|
|
61
|
+
primary conditions are the tool's name and its arguments.
|
|
62
|
+
|
|
63
|
+
#### Tool Name
|
|
64
|
+
|
|
65
|
+
The `toolName` in the rule must match the name of the tool being called.
|
|
66
|
+
|
|
67
|
+
- **Wildcards**: For Model-hosting-protocol (MCP) servers, you can use a
|
|
68
|
+
wildcard. A `toolName` of `my-server__*` will match any tool from the
|
|
69
|
+
`my-server` MCP.
|
|
70
|
+
|
|
71
|
+
#### Arguments pattern
|
|
72
|
+
|
|
73
|
+
If `argsPattern` is specified, the tool's arguments are converted to a stable
|
|
74
|
+
JSON string, which is then tested against the provided regular expression. If
|
|
75
|
+
the arguments don't match the pattern, the rule does not apply.
|
|
76
|
+
|
|
77
|
+
### Decisions
|
|
78
|
+
|
|
79
|
+
There are three possible decisions a rule can enforce:
|
|
80
|
+
|
|
81
|
+
- `allow`: The tool call is executed automatically without user interaction.
|
|
82
|
+
- `deny`: The tool call is blocked and is not executed.
|
|
83
|
+
- `ask_user`: The user is prompted to approve or deny the tool call. (In
|
|
84
|
+
non-interactive mode, this is treated as `deny`.)
|
|
85
|
+
|
|
86
|
+
### Priority system and tiers
|
|
87
|
+
|
|
88
|
+
The policy engine uses a sophisticated priority system to resolve conflicts when
|
|
89
|
+
multiple rules match a single tool call. The core principle is simple: **the
|
|
90
|
+
rule with the highest priority wins**.
|
|
91
|
+
|
|
92
|
+
To provide a clear hierarchy, policies are organized into three tiers. Each tier
|
|
93
|
+
has a designated number that forms the base of the final priority calculation.
|
|
94
|
+
|
|
95
|
+
| Tier | Base | Description |
|
|
96
|
+
| :------ | :--- | :------------------------------------------------------------------------- |
|
|
97
|
+
| Default | 1 | Built-in policies that ship with the Gemini CLI. |
|
|
98
|
+
| User | 2 | Custom policies defined by the user. |
|
|
99
|
+
| Admin | 3 | Policies managed by an administrator (e.g., in an enterprise environment). |
|
|
100
|
+
|
|
101
|
+
Within a TOML policy file, you assign a priority value from **0 to 999**. The
|
|
102
|
+
engine transforms this into a final priority using the following formula:
|
|
103
|
+
|
|
104
|
+
`final_priority = tier_base + (toml_priority / 1000)`
|
|
105
|
+
|
|
106
|
+
This system guarantees that:
|
|
107
|
+
|
|
108
|
+
- Admin policies always override User and Default policies.
|
|
109
|
+
- User policies always override Default policies.
|
|
110
|
+
- You can still order rules within a single tier with fine-grained control.
|
|
111
|
+
|
|
112
|
+
For example:
|
|
113
|
+
|
|
114
|
+
- A `priority: 50` rule in a Default policy file becomes `1.050`.
|
|
115
|
+
- A `priority: 100` rule in a User policy file becomes `2.100`.
|
|
116
|
+
- A `priority: 20` rule in an Admin policy file becomes `3.020`.
|
|
117
|
+
|
|
118
|
+
### Approval modes
|
|
119
|
+
|
|
120
|
+
Approval modes allow the policy engine to apply different sets of rules based on
|
|
121
|
+
the CLI's operational mode. A rule can be associated with one or more modes
|
|
122
|
+
(e.g., `yolo`, `autoEdit`). The rule will only be active if the CLI is running
|
|
123
|
+
in one of its specified modes. If a rule has no modes specified, it is always
|
|
124
|
+
active.
|
|
125
|
+
|
|
126
|
+
## Rule matching
|
|
127
|
+
|
|
128
|
+
When a tool call is made, the engine checks it against all active rules,
|
|
129
|
+
starting from the highest priority. The first rule that matches determines the
|
|
130
|
+
outcome.
|
|
131
|
+
|
|
132
|
+
A rule matches a tool call if all of its conditions are met:
|
|
133
|
+
|
|
134
|
+
1. **Tool name**: The `toolName` in the rule must match the name of the tool
|
|
135
|
+
being called.
|
|
136
|
+
- **Wildcards**: For Model-hosting-protocol (MCP) servers, you can use a
|
|
137
|
+
wildcard. A `toolName` of `my-server__*` will match any tool from the
|
|
138
|
+
`my-server` MCP.
|
|
139
|
+
2. **Arguments pattern**: If `argsPattern` is specified, the tool's arguments
|
|
140
|
+
are converted to a stable JSON string, which is then tested against the
|
|
141
|
+
provided regular expression. If the arguments don't match the pattern, the
|
|
142
|
+
rule does not apply.
|
|
143
|
+
|
|
144
|
+
## Configuration
|
|
145
|
+
|
|
146
|
+
Policies are defined in `.toml` files. The CLI loads these files from Default,
|
|
147
|
+
User, and (if configured) Admin directories.
|
|
148
|
+
|
|
149
|
+
### TOML rule schema
|
|
150
|
+
|
|
151
|
+
Here is a breakdown of the fields available in a TOML policy rule:
|
|
152
|
+
|
|
153
|
+
```toml
|
|
154
|
+
[[rule]]
|
|
155
|
+
# A unique name for the tool, or an array of names.
|
|
156
|
+
toolName = "run_shell_command"
|
|
157
|
+
|
|
158
|
+
# (Optional) The name of an MCP server. Can be combined with toolName
|
|
159
|
+
# to form a composite name like "mcpName__toolName".
|
|
160
|
+
mcpName = "my-custom-server"
|
|
161
|
+
|
|
162
|
+
# (Optional) A regex to match against the tool's arguments.
|
|
163
|
+
argsPattern = '"command":"(git|npm)'
|
|
164
|
+
|
|
165
|
+
# (Optional) A string or array of strings that a shell command must start with.
|
|
166
|
+
# This is syntactic sugar for `toolName = "run_shell_command"` and an `argsPattern`.
|
|
167
|
+
commandPrefix = "git "
|
|
168
|
+
|
|
169
|
+
# (Optional) A regex to match against the entire shell command.
|
|
170
|
+
# This is also syntactic sugar for `toolName = "run_shell_command"`.
|
|
171
|
+
# Note: This pattern is tested against the JSON representation of the arguments (e.g., `{"command":"<your_command>"}`), so anchors like `^` or `$` will apply to the full JSON string, not just the command text.
|
|
172
|
+
# You cannot use commandPrefix and commandRegex in the same rule.
|
|
173
|
+
commandRegex = "^git (commit|push)"
|
|
174
|
+
|
|
175
|
+
# The decision to take. Must be "allow", "deny", or "ask_user".
|
|
176
|
+
decision = "ask_user"
|
|
177
|
+
|
|
178
|
+
# The priority of the rule, from 0 to 999.
|
|
179
|
+
priority = 10
|
|
180
|
+
|
|
181
|
+
# (Optional) An array of approval modes where this rule is active.
|
|
182
|
+
modes = ["autoEdit"]
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Using arrays (lists)
|
|
186
|
+
|
|
187
|
+
To apply the same rule to multiple tools or command prefixes, you can provide an
|
|
188
|
+
array of strings for the `toolName` and `commandPrefix` fields.
|
|
189
|
+
|
|
190
|
+
**Example:**
|
|
191
|
+
|
|
192
|
+
This single rule will apply to both the `write_file` and `replace` tools.
|
|
193
|
+
|
|
194
|
+
```toml
|
|
195
|
+
[[rule]]
|
|
196
|
+
toolName = ["write_file", "replace"]
|
|
197
|
+
decision = "ask_user"
|
|
198
|
+
priority = 10
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Special syntax for `run_shell_command`
|
|
202
|
+
|
|
203
|
+
To simplify writing policies for `run_shell_command`, you can use
|
|
204
|
+
`commandPrefix` or `commandRegex` instead of the more complex `argsPattern`.
|
|
205
|
+
|
|
206
|
+
- `commandPrefix`: Matches if the `command` argument starts with the given
|
|
207
|
+
string.
|
|
208
|
+
- `commandRegex`: Matches if the `command` argument matches the given regular
|
|
209
|
+
expression.
|
|
210
|
+
|
|
211
|
+
**Example:**
|
|
212
|
+
|
|
213
|
+
This rule will ask for user confirmation before executing any `git` command.
|
|
214
|
+
|
|
215
|
+
```toml
|
|
216
|
+
[[rule]]
|
|
217
|
+
toolName = "run_shell_command"
|
|
218
|
+
commandPrefix = "git "
|
|
219
|
+
decision = "ask_user"
|
|
220
|
+
priority = 100
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Special syntax for MCP tools
|
|
224
|
+
|
|
225
|
+
You can create rules that target tools from Model-hosting-protocol (MCP) servers
|
|
226
|
+
using the `mcpName` field or a wildcard pattern.
|
|
227
|
+
|
|
228
|
+
**1. Using `mcpName`**
|
|
229
|
+
|
|
230
|
+
To target a specific tool from a specific server, combine `mcpName` and
|
|
231
|
+
`toolName`.
|
|
232
|
+
|
|
233
|
+
```toml
|
|
234
|
+
# Allows the `search` tool on the `my-jira-server` MCP
|
|
235
|
+
[[rule]]
|
|
236
|
+
mcpName = "my-jira-server"
|
|
237
|
+
toolName = "search"
|
|
238
|
+
decision = "allow"
|
|
239
|
+
priority = 200
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**2. Using a wildcard**
|
|
243
|
+
|
|
244
|
+
To create a rule that applies to _all_ tools on a specific MCP server, specify
|
|
245
|
+
only the `mcpName`.
|
|
246
|
+
|
|
247
|
+
```toml
|
|
248
|
+
# Denies all tools from the `untrusted-server` MCP
|
|
249
|
+
[[rule]]
|
|
250
|
+
mcpName = "untrusted-server"
|
|
251
|
+
decision = "deny"
|
|
252
|
+
priority = 500
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
## Default policies
|
|
256
|
+
|
|
257
|
+
The Gemini CLI ships with a set of default policies to provide a safe
|
|
258
|
+
out-of-the-box experience.
|
|
259
|
+
|
|
260
|
+
- **Read-only tools** (like `read_file`, `glob`) are generally **allowed**.
|
|
261
|
+
- **Agent delegation** (like `delegate_to_agent`) is **allowed** (sub-agent
|
|
262
|
+
actions are checked individually).
|
|
263
|
+
- **Write tools** (like `write_file`, `run_shell_command`) default to
|
|
264
|
+
**`ask_user`**.
|
|
265
|
+
- In **`yolo`** mode, a high-priority rule allows all tools.
|
|
266
|
+
- In **`autoEdit`** mode, rules allow certain write operations to happen without
|
|
267
|
+
prompting.
|