@machina.ai/cell-cli-core 1.10.0-rc1 → 1.13.0-rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +5 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/package.json +13 -5
- package/dist/src/agents/codebase-investigator.js +2 -5
- package/dist/src/agents/codebase-investigator.js.map +1 -1
- package/dist/src/agents/executor.d.ts +19 -0
- package/dist/src/agents/executor.js +234 -46
- package/dist/src/agents/executor.js.map +1 -1
- package/dist/src/agents/executor.test.js +371 -40
- package/dist/src/agents/executor.test.js.map +1 -1
- package/dist/src/agents/registry.js +4 -3
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/subagent-tool-wrapper.test.js +2 -4
- package/dist/src/agents/subagent-tool-wrapper.test.js.map +1 -1
- package/dist/src/agents/types.d.ts +2 -1
- package/dist/src/agents/types.js +1 -0
- package/dist/src/agents/types.js.map +1 -1
- package/dist/src/code_assist/converter.d.ts +1 -0
- package/dist/src/code_assist/converter.js +1 -0
- package/dist/src/code_assist/converter.js.map +1 -1
- package/dist/src/code_assist/converter.test.js +19 -0
- package/dist/src/code_assist/converter.test.js.map +1 -1
- package/dist/src/code_assist/experiments/client_metadata.d.ts +12 -0
- package/dist/src/code_assist/experiments/client_metadata.js +49 -0
- package/dist/src/code_assist/experiments/client_metadata.js.map +1 -0
- package/dist/src/code_assist/experiments/experiments.d.ts +17 -0
- package/dist/src/code_assist/experiments/experiments.js +36 -0
- package/dist/src/code_assist/experiments/experiments.js.map +1 -0
- package/dist/src/code_assist/experiments/types.d.ts +35 -0
- package/dist/src/code_assist/experiments/types.js +7 -0
- package/dist/src/code_assist/experiments/types.js.map +1 -0
- package/dist/src/code_assist/oauth-credential-storage.js +5 -4
- package/dist/src/code_assist/oauth-credential-storage.js.map +1 -1
- package/dist/src/code_assist/oauth-credential-storage.test.js +15 -3
- package/dist/src/code_assist/oauth-credential-storage.test.js.map +1 -1
- package/dist/src/code_assist/oauth2.d.ts +2 -2
- package/dist/src/code_assist/oauth2.js +64 -51
- package/dist/src/code_assist/oauth2.js.map +1 -1
- package/dist/src/code_assist/oauth2.test.js +65 -33
- package/dist/src/code_assist/oauth2.test.js.map +1 -1
- package/dist/src/code_assist/server.d.ts +6 -4
- package/dist/src/code_assist/server.js +11 -0
- package/dist/src/code_assist/server.js.map +1 -1
- package/dist/src/code_assist/server.test.js +17 -0
- package/dist/src/code_assist/server.test.js.map +1 -1
- package/dist/src/code_assist/setup.d.ts +2 -2
- package/dist/src/code_assist/setup.js.map +1 -1
- package/dist/src/code_assist/types.d.ts +1 -1
- package/dist/src/code_assist/types.js.map +1 -1
- package/dist/src/commands/extensions.d.ts +7 -0
- package/dist/src/commands/extensions.js +9 -0
- package/dist/src/commands/extensions.js.map +1 -0
- package/dist/src/commands/extensions.test.js +19 -0
- package/dist/src/commands/extensions.test.js.map +1 -0
- package/dist/src/config/config.d.ts +81 -32
- package/dist/src/config/config.js +193 -66
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +115 -36
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/models.d.ts +1 -1
- package/dist/src/config/models.js +2 -2
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/storage.d.ts +3 -0
- package/dist/src/config/storage.js +20 -0
- package/dist/src/config/storage.js.map +1 -1
- package/dist/src/confirmation-bus/message-bus.d.ts +2 -1
- package/dist/src/confirmation-bus/message-bus.js +7 -1
- package/dist/src/confirmation-bus/message-bus.js.map +1 -1
- package/dist/src/confirmation-bus/types.d.ts +12 -2
- package/dist/src/confirmation-bus/types.js +1 -0
- package/dist/src/confirmation-bus/types.js.map +1 -1
- package/dist/src/core/apiKeyCredentialStorage.d.ts +17 -0
- package/dist/src/core/apiKeyCredentialStorage.js +64 -0
- package/dist/src/core/apiKeyCredentialStorage.js.map +1 -0
- package/dist/src/core/apiKeyCredentialStorage.test.d.ts +6 -0
- package/dist/src/core/apiKeyCredentialStorage.test.js +71 -0
- package/dist/src/core/apiKeyCredentialStorage.test.js.map +1 -0
- package/dist/src/core/client.d.ts +2 -11
- package/dist/src/core/client.js +31 -170
- package/dist/src/core/client.js.map +1 -1
- package/dist/src/core/client.test.js +107 -429
- package/dist/src/core/client.test.js.map +1 -1
- package/dist/src/core/contentGenerator.js +64 -59
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +38 -4
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +8 -2
- package/dist/src/core/coreToolScheduler.js +337 -172
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +363 -12
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/fakeContentGenerator.d.ts +33 -0
- package/dist/src/core/fakeContentGenerator.js +58 -0
- package/dist/src/core/fakeContentGenerator.js.map +1 -0
- package/dist/src/core/fakeContentGenerator.test.d.ts +6 -0
- package/dist/src/core/fakeContentGenerator.test.js +127 -0
- package/dist/src/core/fakeContentGenerator.test.js.map +1 -0
- package/dist/src/core/geminiChat.d.ts +2 -0
- package/dist/src/core/geminiChat.js +7 -2
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js +15 -3
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/logger.js +21 -19
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/loggingContentGenerator.d.ts +1 -0
- package/dist/src/core/loggingContentGenerator.js +113 -33
- package/dist/src/core/loggingContentGenerator.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.js +5 -4
- package/dist/src/core/nonInteractiveToolExecutor.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +3 -0
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/prompts.js +115 -72
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +30 -108
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/recordingContentGenerator.d.ts +18 -0
- package/dist/src/core/recordingContentGenerator.js +77 -0
- package/dist/src/core/recordingContentGenerator.js.map +1 -0
- package/dist/src/core/recordingContentGenerator.test.d.ts +6 -0
- package/dist/src/core/recordingContentGenerator.test.js +101 -0
- package/dist/src/core/recordingContentGenerator.test.js.map +1 -0
- package/dist/src/core/turn.d.ts +2 -0
- package/dist/src/core/turn.js +3 -1
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/core/turn.test.js +48 -0
- package/dist/src/core/turn.test.js.map +1 -1
- package/dist/src/fallback/handler.js +2 -0
- package/dist/src/fallback/handler.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/hookPlanner.d.ts +46 -0
- package/dist/src/hooks/hookPlanner.js +108 -0
- package/dist/src/hooks/hookPlanner.js.map +1 -0
- package/dist/src/hooks/hookPlanner.test.d.ts +6 -0
- package/dist/src/hooks/hookPlanner.test.js +255 -0
- package/dist/src/hooks/hookPlanner.test.js.map +1 -0
- package/dist/src/hooks/hookRegistry.d.ts +87 -0
- package/dist/src/hooks/hookRegistry.js +198 -0
- package/dist/src/hooks/hookRegistry.js.map +1 -0
- package/dist/src/hooks/hookRegistry.test.d.ts +6 -0
- package/dist/src/hooks/hookRegistry.test.js +341 -0
- package/dist/src/hooks/hookRegistry.test.js.map +1 -0
- package/dist/src/hooks/hookTranslator.d.ts +113 -0
- package/dist/src/hooks/hookTranslator.js +232 -0
- package/dist/src/hooks/hookTranslator.js.map +1 -0
- package/dist/src/hooks/hookTranslator.test.d.ts +6 -0
- package/dist/src/hooks/hookTranslator.test.js +192 -0
- package/dist/src/hooks/hookTranslator.test.js.map +1 -0
- package/dist/src/hooks/types.d.ts +384 -0
- package/dist/src/hooks/types.js +284 -0
- package/dist/src/hooks/types.js.map +1 -0
- package/dist/src/hooks/types.test.d.ts +6 -0
- package/dist/src/hooks/types.test.js +35 -0
- package/dist/src/hooks/types.test.js.map +1 -0
- package/dist/src/ide/ide-client.js +2 -1
- package/dist/src/ide/ide-client.js.map +1 -1
- package/dist/src/index.d.ts +15 -0
- package/dist/src/index.js +18 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.d.ts +2 -0
- package/dist/src/mcp/google-auth-provider.js +21 -3
- package/dist/src/mcp/google-auth-provider.js.map +1 -1
- package/dist/src/mcp/google-auth-provider.test.js +42 -9
- package/dist/src/mcp/google-auth-provider.test.js.map +1 -1
- package/dist/src/mcp/mcpLauncher.d.ts +26 -0
- package/dist/src/mcp/mcpLauncher.js +238 -0
- package/dist/src/mcp/mcpLauncher.js.map +1 -0
- package/dist/src/mcp/oauth-provider.d.ts +8 -5
- package/dist/src/mcp/oauth-provider.js +140 -55
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/mcp/oauth-provider.test.js +191 -2
- package/dist/src/mcp/oauth-provider.test.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.js +5 -4
- package/dist/src/mcp/oauth-token-storage.js.map +1 -1
- package/dist/src/mcp/oauth-token-storage.test.js +17 -11
- package/dist/src/mcp/oauth-token-storage.test.js.map +1 -1
- package/dist/src/mcp/oauth-utils.d.ts +7 -0
- package/dist/src/mcp/oauth-utils.js +28 -8
- package/dist/src/mcp/oauth-utils.js.map +1 -1
- package/dist/src/mcp/oauth-utils.test.js +45 -2
- package/dist/src/mcp/oauth-utils.test.js.map +1 -1
- package/dist/src/mcp/sa-impersonation-provider.d.ts +0 -6
- package/dist/src/mcp/sa-impersonation-provider.js +6 -23
- package/dist/src/mcp/sa-impersonation-provider.js.map +1 -1
- package/dist/src/mcp/token-storage/base-token-storage.test.js +75 -84
- package/dist/src/mcp/token-storage/base-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.js +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/file-token-storage.test.js +7 -5
- package/dist/src/mcp/token-storage/file-token-storage.test.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/hybrid-token-storage.test.js +2 -2
- package/dist/src/mcp/token-storage/hybrid-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.d.ts +6 -2
- package/dist/src/mcp/token-storage/keychain-token-storage.js +63 -7
- package/dist/src/mcp/token-storage/keychain-token-storage.js.map +1 -1
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js +54 -3
- package/dist/src/mcp/token-storage/keychain-token-storage.test.js.map +1 -1
- package/dist/src/mcp/token-storage/types.d.ts +6 -0
- package/dist/src/mcp/token-storage/types.js.map +1 -1
- package/dist/src/output/stream-json-formatter.d.ts +32 -0
- package/dist/src/output/stream-json-formatter.js +52 -0
- package/dist/src/output/stream-json-formatter.js.map +1 -0
- package/dist/src/output/stream-json-formatter.test.d.ts +6 -0
- package/dist/src/output/stream-json-formatter.test.js +479 -0
- package/dist/src/output/stream-json-formatter.test.js.map +1 -0
- package/dist/src/output/types.d.ts +63 -1
- package/dist/src/output/types.js +11 -0
- package/dist/src/output/types.js.map +1 -1
- package/dist/src/policy/config.d.ts +31 -0
- package/dist/src/policy/config.js +197 -0
- package/dist/src/policy/config.js.map +1 -0
- package/dist/src/policy/config.test.d.ts +6 -0
- package/dist/src/policy/config.test.js +404 -0
- package/dist/src/policy/config.test.js.map +1 -0
- package/dist/src/policy/index.d.ts +2 -0
- package/dist/src/policy/index.js +2 -0
- package/dist/src/policy/index.js.map +1 -1
- package/dist/src/policy/policies/read-only.toml +56 -0
- package/dist/src/policy/policies/write.toml +63 -0
- package/dist/src/policy/policies/yolo.toml +31 -0
- package/dist/src/policy/policy-engine.js +4 -0
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/toml-loader.d.ts +46 -0
- package/dist/src/policy/toml-loader.js +314 -0
- package/dist/src/policy/toml-loader.js.map +1 -0
- package/dist/src/policy/toml-loader.test.d.ts +6 -0
- package/dist/src/policy/toml-loader.test.js +522 -0
- package/dist/src/policy/toml-loader.test.js.map +1 -0
- package/dist/src/policy/types.d.ts +18 -0
- package/dist/src/policy/types.js +6 -0
- package/dist/src/policy/types.js.map +1 -1
- package/dist/src/prompts/prompt-registry.js +2 -1
- package/dist/src/prompts/prompt-registry.js.map +1 -1
- package/dist/src/routing/strategies/classifierStrategy.js +3 -2
- package/dist/src/routing/strategies/classifierStrategy.js.map +1 -1
- package/dist/src/services/chatCompressionService.d.ts +32 -0
- package/dist/src/services/chatCompressionService.js +162 -0
- package/dist/src/services/chatCompressionService.js.map +1 -0
- package/dist/src/services/chatCompressionService.test.d.ts +6 -0
- package/dist/src/services/chatCompressionService.test.js +209 -0
- package/dist/src/services/chatCompressionService.test.js.map +1 -0
- package/dist/src/services/chatRecordingService.js +9 -8
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.d.ts +2 -14
- package/dist/src/services/fileDiscoveryService.js +19 -55
- package/dist/src/services/fileDiscoveryService.js.map +1 -1
- package/dist/src/services/fileDiscoveryService.test.js +91 -11
- package/dist/src/services/fileDiscoveryService.test.js.map +1 -1
- package/dist/src/services/loopDetectionService.d.ts +1 -1
- package/dist/src/services/loopDetectionService.js +27 -13
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/loopDetectionService.test.js +119 -11
- package/dist/src/services/loopDetectionService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.js +50 -23
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +82 -15
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/activity-monitor.d.ts +116 -0
- package/dist/src/telemetry/activity-monitor.js +209 -0
- package/dist/src/telemetry/activity-monitor.js.map +1 -0
- package/dist/src/telemetry/activity-monitor.test.d.ts +6 -0
- package/dist/src/telemetry/activity-monitor.test.js +248 -0
- package/dist/src/telemetry/activity-monitor.test.js.map +1 -0
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.d.ts +5 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +135 -57
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +43 -75
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.d.ts +7 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js +13 -1
- package/dist/src/telemetry/clearcut-logger/event-metadata-key.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.js +0 -1
- package/dist/src/telemetry/gcp-exporters.js.map +1 -1
- package/dist/src/telemetry/gcp-exporters.test.js +1 -1
- package/dist/src/telemetry/gcp-exporters.test.js.map +1 -1
- package/dist/src/telemetry/index.d.ts +4 -2
- package/dist/src/telemetry/index.js +5 -3
- package/dist/src/telemetry/index.js.map +1 -1
- package/dist/src/telemetry/loggers.d.ts +2 -1
- package/dist/src/telemetry/loggers.js +37 -26
- package/dist/src/telemetry/loggers.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +215 -56
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.d.ts +55 -6
- package/dist/src/telemetry/metrics.js +89 -1
- package/dist/src/telemetry/metrics.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js +172 -213
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/sdk.js +3 -2
- package/dist/src/telemetry/sdk.js.map +1 -1
- package/dist/src/telemetry/semantic.d.ts +82 -0
- package/dist/src/telemetry/semantic.js +269 -0
- package/dist/src/telemetry/semantic.js.map +1 -0
- package/dist/src/telemetry/semantic.test.d.ts +6 -0
- package/dist/src/telemetry/semantic.test.js +387 -0
- package/dist/src/telemetry/semantic.test.js.map +1 -0
- package/dist/src/telemetry/telemetry-utils.test.js +29 -28
- package/dist/src/telemetry/telemetry-utils.test.js.map +1 -1
- package/dist/src/telemetry/trace.d.ts +46 -0
- package/dist/src/telemetry/trace.js +121 -0
- package/dist/src/telemetry/trace.js.map +1 -0
- package/dist/src/telemetry/types.d.ts +79 -34
- package/dist/src/telemetry/types.js +191 -61
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.js +6 -6
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +88 -66
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/tools/edit.d.ts +3 -2
- package/dist/src/tools/edit.js +24 -19
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js +78 -2
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/glob.d.ts +3 -2
- package/dist/src/tools/glob.js +15 -19
- package/dist/src/tools/glob.js.map +1 -1
- package/dist/src/tools/glob.test.js +203 -199
- package/dist/src/tools/glob.test.js.map +1 -1
- package/dist/src/tools/grep.d.ts +3 -2
- package/dist/src/tools/grep.js +22 -16
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/ls.d.ts +3 -2
- package/dist/src/tools/ls.js +15 -20
- package/dist/src/tools/ls.js.map +1 -1
- package/dist/src/tools/ls.test.js +2 -9
- package/dist/src/tools/ls.test.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.d.ts +49 -11
- package/dist/src/tools/mcp-client-manager.js +209 -31
- package/dist/src/tools/mcp-client-manager.js.map +1 -1
- package/dist/src/tools/mcp-client-manager.test.js +132 -25
- package/dist/src/tools/mcp-client-manager.test.js.map +1 -1
- package/dist/src/tools/mcp-client.d.ts +5 -1
- package/dist/src/tools/mcp-client.js +85 -104
- package/dist/src/tools/mcp-client.js.map +1 -1
- package/dist/src/tools/mcp-client.test.js +65 -6
- package/dist/src/tools/mcp-client.test.js.map +1 -1
- package/dist/src/tools/mcp-tool.d.ts +5 -2
- package/dist/src/tools/mcp-tool.js +16 -8
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/memoryTool.d.ts +6 -4
- package/dist/src/tools/memoryTool.js +13 -10
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/message-bus-integration.test.js +14 -1
- package/dist/src/tools/message-bus-integration.test.js.map +1 -1
- package/dist/src/tools/modifiable-tool.js +3 -2
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/read-file.d.ts +4 -3
- package/dist/src/tools/read-file.js +16 -11
- package/dist/src/tools/read-file.js.map +1 -1
- package/dist/src/tools/read-file.test.js +25 -2
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/read-many-files.d.ts +4 -3
- package/dist/src/tools/read-many-files.js +19 -37
- package/dist/src/tools/read-many-files.js.map +1 -1
- package/dist/src/tools/read-many-files.test.js +0 -1
- 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 +47 -17
- package/dist/src/tools/ripGrep.js.map +1 -1
- package/dist/src/tools/ripGrep.test.js +106 -60
- package/dist/src/tools/ripGrep.test.js.map +1 -1
- package/dist/src/tools/shell.d.ts +7 -5
- package/dist/src/tools/shell.js +39 -68
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +69 -9
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.d.ts +3 -2
- package/dist/src/tools/smart-edit.js +30 -18
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/smart-edit.test.js +62 -2
- package/dist/src/tools/smart-edit.test.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +8 -0
- package/dist/src/tools/tool-names.js +8 -5
- package/dist/src/tools/tool-names.js.map +1 -1
- package/dist/src/tools/tool-registry.d.ts +6 -19
- package/dist/src/tools/tool-registry.js +14 -49
- package/dist/src/tools/tool-registry.js.map +1 -1
- package/dist/src/tools/tool-registry.test.js +2 -24
- package/dist/src/tools/tool-registry.test.js.map +1 -1
- package/dist/src/tools/tools.d.ts +22 -8
- package/dist/src/tools/tools.js +65 -36
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/web-fetch.d.ts +4 -3
- package/dist/src/tools/web-fetch.js +37 -25
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/web-fetch.test.js +262 -1
- package/dist/src/tools/web-fetch.test.js.map +1 -1
- package/dist/src/tools/web-search.d.ts +4 -3
- package/dist/src/tools/web-search.js +8 -6
- package/dist/src/tools/web-search.js.map +1 -1
- package/dist/src/tools/write-file.d.ts +3 -2
- package/dist/src/tools/write-file.js +8 -8
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js +1 -2
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/tools/write-todos.d.ts +4 -8
- package/dist/src/tools/write-todos.js +15 -6
- package/dist/src/tools/write-todos.js.map +1 -1
- package/dist/src/tools/write-todos.test.js +2 -2
- package/dist/src/tools/write-todos.test.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.js +3 -2
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/channel.d.ts +19 -0
- package/dist/src/utils/channel.js +49 -0
- package/dist/src/utils/channel.js.map +1 -0
- package/dist/src/utils/channel.test.d.ts +6 -0
- package/dist/src/utils/channel.test.js +170 -0
- package/dist/src/utils/channel.test.js.map +1 -0
- package/dist/src/utils/debugLogger.d.ts +25 -0
- package/dist/src/utils/debugLogger.js +33 -0
- package/dist/src/utils/debugLogger.js.map +1 -0
- package/dist/src/utils/debugLogger.test.d.ts +6 -0
- package/dist/src/utils/debugLogger.test.js +67 -0
- package/dist/src/utils/debugLogger.test.js.map +1 -0
- package/dist/src/utils/delay.d.ts +16 -0
- package/dist/src/utils/delay.js +43 -0
- package/dist/src/utils/delay.js.map +1 -0
- package/dist/src/utils/delay.test.d.ts +6 -0
- package/dist/src/utils/delay.test.js +88 -0
- package/dist/src/utils/delay.test.js.map +1 -0
- package/dist/src/utils/editCorrector.js +5 -9
- package/dist/src/utils/editCorrector.js.map +1 -1
- package/dist/src/utils/editCorrector.test.js +3 -5
- package/dist/src/utils/editCorrector.test.js.map +1 -1
- package/dist/src/utils/editor.js +33 -38
- package/dist/src/utils/editor.js.map +1 -1
- package/dist/src/utils/environmentContext.d.ts +2 -1
- package/dist/src/utils/environmentContext.js +18 -33
- package/dist/src/utils/environmentContext.js.map +1 -1
- package/dist/src/utils/environmentContext.test.js +0 -34
- package/dist/src/utils/environmentContext.test.js.map +1 -1
- package/dist/src/utils/errorParsing.d.ts +1 -1
- package/dist/src/utils/errorParsing.js +5 -33
- package/dist/src/utils/errorParsing.js.map +1 -1
- package/dist/src/utils/errorParsing.test.js +0 -88
- package/dist/src/utils/errorParsing.test.js.map +1 -1
- package/dist/src/utils/errors.d.ts +3 -0
- package/dist/src/utils/errors.js +6 -0
- package/dist/src/utils/errors.js.map +1 -1
- package/dist/src/utils/events.d.ts +88 -0
- package/dist/src/utils/events.js +77 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/src/utils/events.test.d.ts +6 -0
- package/dist/src/utils/events.test.js +131 -0
- package/dist/src/utils/events.test.js.map +1 -0
- package/dist/src/utils/extensionLoader.d.ts +78 -0
- package/dist/src/utils/extensionLoader.js +162 -0
- package/dist/src/utils/extensionLoader.js.map +1 -0
- package/dist/src/utils/extensionLoader.test.d.ts +6 -0
- package/dist/src/utils/extensionLoader.test.js +90 -0
- package/dist/src/utils/extensionLoader.test.js.map +1 -0
- package/dist/src/utils/fetch.d.ts +1 -0
- package/dist/src/utils/fetch.js +4 -0
- package/dist/src/utils/fetch.js.map +1 -1
- package/dist/src/utils/fileUtils.d.ts +4 -0
- package/dist/src/utils/fileUtils.js +34 -2
- package/dist/src/utils/fileUtils.js.map +1 -1
- package/dist/src/utils/fileUtils.test.js +12 -1
- package/dist/src/utils/fileUtils.test.js.map +1 -1
- package/dist/src/utils/flashFallback.test.js +26 -45
- package/dist/src/utils/flashFallback.test.js.map +1 -1
- package/dist/src/utils/getFolderStructure.js +9 -17
- package/dist/src/utils/getFolderStructure.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.d.ts +4 -1
- package/dist/src/utils/gitIgnoreParser.js +28 -10
- package/dist/src/utils/gitIgnoreParser.js.map +1 -1
- package/dist/src/utils/gitIgnoreParser.test.js +58 -0
- package/dist/src/utils/gitIgnoreParser.test.js.map +1 -1
- package/dist/src/utils/googleErrors.d.ts +104 -0
- package/dist/src/utils/googleErrors.js +152 -0
- package/dist/src/utils/googleErrors.js.map +1 -0
- package/dist/src/utils/googleErrors.test.d.ts +6 -0
- package/dist/src/utils/googleErrors.test.js +301 -0
- package/dist/src/utils/googleErrors.test.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.d.ts +36 -0
- package/dist/src/utils/googleQuotaErrors.js +149 -0
- package/dist/src/utils/googleQuotaErrors.js.map +1 -0
- package/dist/src/utils/googleQuotaErrors.test.d.ts +6 -0
- package/dist/src/utils/googleQuotaErrors.test.js +311 -0
- package/dist/src/utils/googleQuotaErrors.test.js.map +1 -0
- package/dist/src/utils/ignorePatterns.test.js +26 -30
- package/dist/src/utils/ignorePatterns.test.js.map +1 -1
- package/dist/src/utils/installationManager.js +2 -1
- package/dist/src/utils/installationManager.js.map +1 -1
- package/dist/src/utils/installationManager.test.js +3 -3
- package/dist/src/utils/installationManager.test.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.d.ts +1 -1
- package/dist/src/utils/llm-edit-fixer.js +29 -4
- package/dist/src/utils/llm-edit-fixer.js.map +1 -1
- package/dist/src/utils/llm-edit-fixer.test.js +21 -0
- package/dist/src/utils/llm-edit-fixer.test.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.d.ts +11 -1
- package/dist/src/utils/memoryDiscovery.js +150 -11
- package/dist/src/utils/memoryDiscovery.js.map +1 -1
- package/dist/src/utils/memoryDiscovery.test.js +157 -19
- package/dist/src/utils/memoryDiscovery.test.js.map +1 -1
- package/dist/src/utils/memoryImportProcessor.js +3 -2
- package/dist/src/utils/memoryImportProcessor.js.map +1 -1
- package/dist/src/utils/nextSpeakerChecker.js +2 -1
- package/dist/src/utils/nextSpeakerChecker.js.map +1 -1
- package/dist/src/utils/package.d.ts +12 -0
- package/dist/src/utils/package.js +15 -0
- package/dist/src/utils/package.js.map +1 -0
- package/dist/src/utils/paths.js +126 -26
- package/dist/src/utils/paths.js.map +1 -1
- package/dist/src/utils/paths.test.js +200 -68
- package/dist/src/utils/paths.test.js.map +1 -1
- package/dist/src/utils/quotaErrorDetection.d.ts +0 -2
- package/dist/src/utils/quotaErrorDetection.js +0 -46
- package/dist/src/utils/quotaErrorDetection.js.map +1 -1
- package/dist/src/utils/retry.d.ts +1 -0
- package/dist/src/utils/retry.js +57 -158
- package/dist/src/utils/retry.js.map +1 -1
- package/dist/src/utils/retry.test.js +48 -109
- package/dist/src/utils/retry.test.js.map +1 -1
- package/dist/src/utils/safeJsonStringify.d.ts +4 -4
- package/dist/src/utils/safeJsonStringify.js +31 -7
- package/dist/src/utils/safeJsonStringify.js.map +1 -1
- package/dist/src/utils/shell-utils.d.ts +14 -2
- package/dist/src/utils/shell-utils.js +381 -136
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +242 -60
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/summarizer.js +2 -1
- package/dist/src/utils/summarizer.js.map +1 -1
- package/dist/src/utils/summarizer.test.js +0 -1
- package/dist/src/utils/summarizer.test.js.map +1 -1
- package/dist/src/utils/systemEncoding.js +5 -4
- package/dist/src/utils/systemEncoding.js.map +1 -1
- package/dist/src/utils/tool-utils.d.ts +2 -2
- package/dist/src/utils/tool-utils.js +14 -5
- package/dist/src/utils/tool-utils.js.map +1 -1
- package/dist/src/utils/userAccountManager.js +5 -4
- package/dist/src/utils/userAccountManager.js.map +1 -1
- package/dist/src/utils/workspaceContext.js +3 -2
- package/dist/src/utils/workspaceContext.js.map +1 -1
- package/dist/src/utils/workspaceContext.test.js +2 -2
- package/dist/src/utils/workspaceContext.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +13 -5
- package/dist/src/core/subagent.d.ts +0 -236
- package/dist/src/core/subagent.js +0 -482
- package/dist/src/core/subagent.js.map +0 -1
- package/dist/src/core/subagent.test.js +0 -556
- package/dist/src/core/subagent.test.js.map +0 -1
- /package/dist/src/{core/subagent.test.d.ts → commands/extensions.test.d.ts} +0 -0
|
@@ -5,8 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { ApiRequestEvent, ApiResponseEvent, ApiErrorEvent, } from '../telemetry/types.js';
|
|
7
7
|
import { logApiError, logApiRequest, logApiResponse, } from '../telemetry/loggers.js';
|
|
8
|
+
import { CodeAssistServer } from '../code_assist/server.js';
|
|
8
9
|
import { toContents } from '../code_assist/converter.js';
|
|
9
10
|
import { isStructuredError } from '../utils/quotaErrorDetection.js';
|
|
11
|
+
import { runInDevTraceSpan } from '../telemetry/trace.js';
|
|
10
12
|
/**
|
|
11
13
|
* A decorator that wraps a ContentGenerator to add logging to API calls.
|
|
12
14
|
*/
|
|
@@ -24,48 +26,108 @@ export class LoggingContentGenerator {
|
|
|
24
26
|
const requestText = JSON.stringify(contents);
|
|
25
27
|
logApiRequest(this.config, new ApiRequestEvent(model, promptId, requestText));
|
|
26
28
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
+
_getEndpointUrl(req, method) {
|
|
30
|
+
// Case 1: Authenticated with a Google account (`gcloud auth login`).
|
|
31
|
+
// Requests are routed through the internal CodeAssistServer.
|
|
32
|
+
if (this.wrapped instanceof CodeAssistServer) {
|
|
33
|
+
const url = new URL(this.wrapped.getMethodUrl(method));
|
|
34
|
+
const port = url.port
|
|
35
|
+
? parseInt(url.port, 10)
|
|
36
|
+
: url.protocol === 'https:'
|
|
37
|
+
? 443
|
|
38
|
+
: 80;
|
|
39
|
+
return { address: url.hostname, port };
|
|
40
|
+
}
|
|
41
|
+
const genConfig = this.config.getContentGeneratorConfig();
|
|
42
|
+
// Case 2: Using an API key for Vertex AI.
|
|
43
|
+
if (genConfig?.vertexai) {
|
|
44
|
+
const location = process.env['GOOGLE_CLOUD_LOCATION'];
|
|
45
|
+
if (location) {
|
|
46
|
+
return { address: `${location}-aiplatform.googleapis.com`, port: 443 };
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
return { address: 'unknown', port: 0 };
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Case 3: Default to the public Gemini API endpoint.
|
|
53
|
+
// This is used when an API key is provided but not for Vertex AI.
|
|
54
|
+
return { address: `generativelanguage.googleapis.com`, port: 443 };
|
|
55
|
+
}
|
|
56
|
+
_logApiResponse(requestContents, durationMs, model, prompt_id, responseId, responseCandidates, usageMetadata, responseText, generationConfig, serverDetails) {
|
|
57
|
+
logApiResponse(this.config, new ApiResponseEvent(model, durationMs, {
|
|
58
|
+
prompt_id,
|
|
59
|
+
contents: requestContents,
|
|
60
|
+
generate_content_config: generationConfig,
|
|
61
|
+
server: serverDetails,
|
|
62
|
+
}, {
|
|
63
|
+
candidates: responseCandidates,
|
|
64
|
+
response_id: responseId,
|
|
65
|
+
}, this.config.getContentGeneratorConfig()?.authType, usageMetadata, responseText));
|
|
29
66
|
}
|
|
30
|
-
_logApiError(durationMs, error, model, prompt_id) {
|
|
67
|
+
_logApiError(durationMs, error, model, prompt_id, requestContents, generationConfig, serverDetails) {
|
|
31
68
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
32
69
|
const errorType = error instanceof Error ? error.name : 'unknown';
|
|
33
|
-
logApiError(this.config, new ApiErrorEvent(model, errorMessage, durationMs,
|
|
70
|
+
logApiError(this.config, new ApiErrorEvent(model, errorMessage, durationMs, {
|
|
71
|
+
prompt_id,
|
|
72
|
+
contents: requestContents,
|
|
73
|
+
generate_content_config: generationConfig,
|
|
74
|
+
server: serverDetails,
|
|
75
|
+
}, this.config.getContentGeneratorConfig()?.authType, errorType, isStructuredError(error)
|
|
34
76
|
? error.status
|
|
35
77
|
: undefined));
|
|
36
78
|
}
|
|
37
79
|
async generateContent(req, userPromptId) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
80
|
+
return runInDevTraceSpan({
|
|
81
|
+
name: 'generateContent',
|
|
82
|
+
}, async ({ metadata: spanMetadata }) => {
|
|
83
|
+
spanMetadata.input = { request: req, userPromptId, model: req.model };
|
|
84
|
+
const startTime = Date.now();
|
|
85
|
+
const contents = toContents(req.contents);
|
|
86
|
+
this.logApiRequest(toContents(req.contents), req.model, userPromptId);
|
|
87
|
+
const serverDetails = this._getEndpointUrl(req, 'generateContent');
|
|
88
|
+
try {
|
|
89
|
+
const response = await this.wrapped.generateContent(req, userPromptId);
|
|
90
|
+
spanMetadata.output = {
|
|
91
|
+
response,
|
|
92
|
+
usageMetadata: response.usageMetadata,
|
|
93
|
+
};
|
|
94
|
+
const durationMs = Date.now() - startTime;
|
|
95
|
+
this._logApiResponse(contents, durationMs, response.modelVersion || req.model, userPromptId, response.responseId, response.candidates, response.usageMetadata, JSON.stringify(response), req.config, serverDetails);
|
|
96
|
+
return response;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
const durationMs = Date.now() - startTime;
|
|
100
|
+
this._logApiError(durationMs, error, req.model, userPromptId, contents, req.config, serverDetails);
|
|
101
|
+
throw error;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
51
104
|
}
|
|
52
105
|
async generateContentStream(req, userPromptId) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
106
|
+
return runInDevTraceSpan({
|
|
107
|
+
name: 'generateContentStream',
|
|
108
|
+
noAutoEnd: true,
|
|
109
|
+
}, async ({ metadata: spanMetadata, endSpan }) => {
|
|
110
|
+
spanMetadata.input = { request: req, userPromptId, model: req.model };
|
|
111
|
+
const startTime = Date.now();
|
|
112
|
+
this.logApiRequest(toContents(req.contents), req.model, userPromptId);
|
|
113
|
+
const serverDetails = this._getEndpointUrl(req, 'generateContentStream');
|
|
114
|
+
let stream;
|
|
115
|
+
try {
|
|
116
|
+
stream = await this.wrapped.generateContentStream(req, userPromptId);
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
const durationMs = Date.now() - startTime;
|
|
120
|
+
this._logApiError(durationMs, error, req.model, userPromptId, toContents(req.contents), req.config, serverDetails);
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
return this.loggingStreamWrapper(req, stream, startTime, userPromptId, spanMetadata, endSpan);
|
|
124
|
+
});
|
|
65
125
|
}
|
|
66
|
-
async *loggingStreamWrapper(stream, startTime, userPromptId,
|
|
126
|
+
async *loggingStreamWrapper(req, stream, startTime, userPromptId, spanMetadata, endSpan) {
|
|
67
127
|
const responses = [];
|
|
68
128
|
let lastUsageMetadata;
|
|
129
|
+
const serverDetails = this._getEndpointUrl(req, 'generateContentStream');
|
|
130
|
+
const requestContents = toContents(req.contents);
|
|
69
131
|
try {
|
|
70
132
|
for await (const response of stream) {
|
|
71
133
|
responses.push(response);
|
|
@@ -76,19 +138,37 @@ export class LoggingContentGenerator {
|
|
|
76
138
|
}
|
|
77
139
|
// Only log successful API response if no error occurred
|
|
78
140
|
const durationMs = Date.now() - startTime;
|
|
79
|
-
this._logApiResponse(durationMs, responses[0]?.modelVersion || model, userPromptId, lastUsageMetadata, JSON.stringify(responses));
|
|
141
|
+
this._logApiResponse(requestContents, durationMs, responses[0]?.modelVersion || req.model, userPromptId, responses[0]?.responseId, responses.flatMap((response) => response.candidates || []), lastUsageMetadata, JSON.stringify(responses), req.config, serverDetails);
|
|
142
|
+
spanMetadata.output = {
|
|
143
|
+
streamChunks: responses.map((r) => ({
|
|
144
|
+
content: r.candidates?.[0]?.content ?? null,
|
|
145
|
+
})),
|
|
146
|
+
usageMetadata: lastUsageMetadata,
|
|
147
|
+
durationMs,
|
|
148
|
+
};
|
|
80
149
|
}
|
|
81
150
|
catch (error) {
|
|
151
|
+
spanMetadata.error = error;
|
|
82
152
|
const durationMs = Date.now() - startTime;
|
|
83
|
-
this._logApiError(durationMs, error, responses[0]?.modelVersion || model, userPromptId);
|
|
153
|
+
this._logApiError(durationMs, error, responses[0]?.modelVersion || req.model, userPromptId, requestContents, req.config, serverDetails);
|
|
84
154
|
throw error;
|
|
85
155
|
}
|
|
156
|
+
finally {
|
|
157
|
+
endSpan();
|
|
158
|
+
}
|
|
86
159
|
}
|
|
87
160
|
async countTokens(req) {
|
|
88
161
|
return this.wrapped.countTokens(req);
|
|
89
162
|
}
|
|
90
163
|
async embedContent(req) {
|
|
91
|
-
return
|
|
164
|
+
return runInDevTraceSpan({
|
|
165
|
+
name: 'embedContent',
|
|
166
|
+
}, async ({ metadata: spanMetadata }) => {
|
|
167
|
+
spanMetadata.input = { request: req };
|
|
168
|
+
const output = await this.wrapped.embedContent(req);
|
|
169
|
+
spanMetadata.output = output;
|
|
170
|
+
return output;
|
|
171
|
+
});
|
|
92
172
|
}
|
|
93
173
|
}
|
|
94
174
|
//# sourceMappingURL=loggingContentGenerator.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loggingContentGenerator.js","sourceRoot":"","sources":["../../../src/core/loggingContentGenerator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"loggingContentGenerator.js","sourceRoot":"","sources":["../../../src/core/loggingContentGenerator.ts"],"names":[],"m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Ae,EACf,GAAG,CAAC,MAAM,EACV,aAAa,CACd,CAAC;YACF,MAAM,KAAK,CAAC;QACd,CAAC;gBAAS,CAAC;YACT,OAAO,EAAE,CAAC;QACZ,CAAC;IACH,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,GAA0B;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACvC,CAAC;IAED,KAAK,CAAC,YAAY,CAChB,GAA2B;QAE3B,OAAO,iBAAiB,CACtB;YACE,IAAI,EAAE,cAAc;SACrB,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE,EAAE,EAAE;YACnC,YAAY,CAAC,KAAK,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;YACtC,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;YACpD,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC;YAC7B,OAAO,MAAM,CAAC;QAChB,CAAC,CACF,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -9,16 +9,17 @@ import { CoreToolScheduler, } from './coreToolScheduler.js';
|
|
|
9
9
|
*/
|
|
10
10
|
export async function executeToolCall(config, toolCallRequest, abortSignal) {
|
|
11
11
|
return new Promise((resolve, reject) => {
|
|
12
|
-
new CoreToolScheduler({
|
|
12
|
+
const scheduler = new CoreToolScheduler({
|
|
13
13
|
config,
|
|
14
14
|
getPreferredEditor: () => undefined,
|
|
15
15
|
onEditorClose: () => { },
|
|
16
16
|
onAllToolCallsComplete: async (completedToolCalls) => {
|
|
17
17
|
resolve(completedToolCalls[0]);
|
|
18
18
|
},
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
});
|
|
20
|
+
scheduler.schedule(toolCallRequest, abortSignal).catch((error) => {
|
|
21
|
+
reject(error);
|
|
22
|
+
});
|
|
22
23
|
});
|
|
23
24
|
}
|
|
24
25
|
//# sourceMappingURL=nonInteractiveToolExecutor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nonInteractiveToolExecutor.js","sourceRoot":"","sources":["../../../src/core/nonInteractiveToolExecutor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAc,EACd,eAAoC,EACpC,WAAwB;IAExB,OAAO,IAAI,OAAO,CAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxD,IAAI,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"nonInteractiveToolExecutor.js","sourceRoot":"","sources":["../../../src/core/nonInteractiveToolExecutor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EACL,iBAAiB,GAElB,MAAM,wBAAwB,CAAC;AAEhC;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAc,EACd,eAAoC,EACpC,WAAwB;IAExB,OAAO,IAAI,OAAO,CAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACxD,MAAM,SAAS,GAAG,IAAI,iBAAiB,CAAC;YACtC,MAAM;YACN,kBAAkB,EAAE,GAAG,EAAE,CAAC,SAAS;YACnC,aAAa,EAAE,GAAG,EAAE,GAAE,CAAC;YACvB,sBAAsB,EAAE,KAAK,EAAE,kBAAkB,EAAE,EAAE;gBACnD,OAAO,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAAC;YACjC,CAAC;SACF,CAAC,CAAC;QAEH,SAAS,CAAC,QAAQ,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/D,MAAM,CAAC,KAAK,CAAC,CAAC;QAChB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -43,6 +43,9 @@ describe('executeToolCall', () => {
|
|
|
43
43
|
getUseSmartEdit: () => false,
|
|
44
44
|
getUseModelRouter: () => false,
|
|
45
45
|
getGeminiClient: () => null, // No client needed for these tests
|
|
46
|
+
getEnableMessageBusIntegration: () => false,
|
|
47
|
+
getMessageBus: () => null,
|
|
48
|
+
getPolicyEngine: () => null,
|
|
46
49
|
};
|
|
47
50
|
abortController = new AbortController();
|
|
48
51
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nonInteractiveToolExecutor.test.js","sourceRoot":"","sources":["../../../src/core/nonInteractiveToolExecutor.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAOlE,OAAO,EACL,kCAAkC,EAClC,sCAAsC,EACtC,aAAa,EACb,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,QAAQ,CAAC,iBAAiB,EAAE,GAAG,EAAE;IAC/B,IAAI,gBAA8B,CAAC;IACnC,IAAI,QAAkB,CAAC;IACvB,IAAI,SAAe,CAAC;IACpB,IAAI,eAAgC,CAAC;IACrC,IAAI,UAAkB,CAAC;IAEvB,UAAU,CAAC,GAAG,EAAE;QACd,SAAS,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;QACpB,QAAQ,GAAG,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;QAElE,gBAAgB,GAAG;YACjB,OAAO,EAAE,EAAE,CAAC,EAAE,EAAE;YAChB,eAAe,EAAE,EAAE,CAAC,EAAE,EAAE;SACE,CAAC;QAE7B,UAAU,GAAG;YACX,eAAe,EAAE,GAAG,EAAE,CAAC,gBAAgB;YACvC,eAAe,EAA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AE,KAAK,IAAI,EAAE;QAC7F,MAAM,OAAO,GAAwB;YACnC,MAAM,EAAE,OAAO;YACf,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,EAAE;YACR,iBAAiB,EAAE,KAAK;YACxB,SAAS,EAAE,aAAa;SACzB,CAAC;QACF,MAAM,UAAU,GAAe;YAC7B,UAAU,EAAE,CAAC,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,CAAC;YACzE,aAAa,EAAE,qBAAqB;SACrC,CAAC;QACF,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC;QAC9D,SAAS,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC;QAExC,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,eAAe,CACxC,UAAU,EACV,OAAO,EACP,eAAe,CAAC,MAAM,CACvB,CAAC;QAEF,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,CAAC;IACjD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/dist/src/core/prompts.js
CHANGED
|
@@ -6,18 +6,13 @@
|
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import os from 'node:os';
|
|
9
|
-
import {
|
|
10
|
-
import { GlobTool } from '../tools/glob.js';
|
|
11
|
-
import { GrepTool } from '../tools/grep.js';
|
|
12
|
-
import { ReadFileTool } from '../tools/read-file.js';
|
|
13
|
-
import { ReadManyFilesTool } from '../tools/read-many-files.js';
|
|
14
|
-
import { ShellTool } from '../tools/shell.js';
|
|
15
|
-
import { WRITE_FILE_TOOL_NAME } from '../tools/tool-names.js';
|
|
9
|
+
import { EDIT_TOOL_NAME, GLOB_TOOL_NAME, GREP_TOOL_NAME, MEMORY_TOOL_NAME, READ_FILE_TOOL_NAME, READ_MANY_FILES_TOOL_NAME, SHELL_TOOL_NAME, WRITE_FILE_TOOL_NAME, WRITE_TODOS_TOOL_NAME, } from '../tools/tool-names.js';
|
|
16
10
|
import process from 'node:process';
|
|
17
11
|
import { isGitRepository } from '../utils/gitUtils.js';
|
|
18
|
-
import { MemoryTool } from '../tools/memoryTool.js';
|
|
19
12
|
import { CodebaseInvestigatorAgent } from '../agents/codebase-investigator.js';
|
|
20
13
|
import { CELL_DIR } from '../utils/paths.js';
|
|
14
|
+
import { debugLogger } from '../utils/debugLogger.js';
|
|
15
|
+
import { WriteTodosTool } from '../tools/write-todos.js';
|
|
21
16
|
export function resolvePathFromEnv(envVar) {
|
|
22
17
|
// Handle the case where the environment variable is not set, empty, or just whitespace.
|
|
23
18
|
const trimmedEnvVar = envVar?.trim();
|
|
@@ -46,7 +41,7 @@ export function resolvePathFromEnv(envVar) {
|
|
|
46
41
|
}
|
|
47
42
|
catch (error) {
|
|
48
43
|
// If os.homedir() fails, we catch the error instead of crashing.
|
|
49
|
-
|
|
44
|
+
debugLogger.warn(`Could not resolve home directory for path: ${trimmedEnvVar}`, error);
|
|
50
45
|
// Return null to indicate the path resolution failed.
|
|
51
46
|
return { isSwitch: false, value: null, isDisabled: false };
|
|
52
47
|
}
|
|
@@ -81,10 +76,18 @@ export function getCoreSystemPrompt(config, userMemory) {
|
|
|
81
76
|
.getToolRegistry()
|
|
82
77
|
.getAllToolNames()
|
|
83
78
|
.includes(CodebaseInvestigatorAgent.name);
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
79
|
+
const enableWriteTodosTool = config
|
|
80
|
+
.getToolRegistry()
|
|
81
|
+
.getAllToolNames()
|
|
82
|
+
.includes(WriteTodosTool.Name);
|
|
83
|
+
let basePrompt;
|
|
84
|
+
if (systemMdEnabled) {
|
|
85
|
+
basePrompt = fs.readFileSync(systemMdPath, 'utf8');
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
const promptConfig = {
|
|
89
|
+
preamble: `You are an interactive CLI agent specializing in software engineering tasks. Your primary goal is to help users safely and efficiently, adhering strictly to the following instructions and utilizing your available tools.`,
|
|
90
|
+
coreMandates: `
|
|
88
91
|
# Core Mandates
|
|
89
92
|
|
|
90
93
|
- **Conventions:** Rigorously adhere to existing project conventions when reading or modifying code. Analyze surrounding code, tests, and configuration first.
|
|
@@ -95,32 +98,46 @@ export function getCoreSystemPrompt(config, userMemory) {
|
|
|
95
98
|
- **Proactiveness:** Fulfill the user's request thoroughly. When adding features or fixing bugs, this includes adding tests to ensure quality. Consider all created files, especially tests, to be permanent artifacts unless the user says otherwise.
|
|
96
99
|
- **Confirm Ambiguity/Expansion:** Do not take significant actions beyond the clear scope of the request without confirming with the user. If asked *how* to do something, explain first, don't just do it.
|
|
97
100
|
- **Explaining Changes:** After completing a code modification or file operation *do not* provide summaries unless asked.
|
|
98
|
-
- **Path Construction:** Before using any file system tool (e.g., ${
|
|
99
|
-
- **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes
|
|
101
|
+
- **Path Construction:** Before using any file system tool (e.g., ${READ_FILE_TOOL_NAME} or '${WRITE_FILE_TOOL_NAME}'), you must construct the full absolute path for the file_path argument. Always combine the absolute path of the project's root directory with the file's path relative to the root. For example, if the project root is /path/to/project/ and the file is foo/bar/baz.txt, the final path you must use is /path/to/project/foo/bar/baz.txt. If the user provides a relative path, you must resolve it against the root directory to create an absolute path.
|
|
102
|
+
- **Do Not revert changes:** Do not revert changes to the codebase unless asked to do so by the user. Only revert changes made by you if they have resulted in an error or if the user has explicitly asked you to revert the changes.`,
|
|
103
|
+
primaryWorkflows_prefix: `
|
|
104
|
+
# Primary Workflows
|
|
105
|
+
|
|
106
|
+
## Software Engineering Tasks
|
|
107
|
+
When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
|
|
108
|
+
1. **Understand:** Think about the user's request and the relevant codebase context. Use '${GREP_TOOL_NAME}' and '${GLOB_TOOL_NAME}' search tools extensively (in parallel if independent) to understand file structures, existing code patterns, and conventions.
|
|
109
|
+
Use '${READ_FILE_TOOL_NAME}' and '${READ_MANY_FILES_TOOL_NAME}' to understand context and validate any assumptions you may have.
|
|
110
|
+
2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`,
|
|
111
|
+
primaryWorkflows_prefix_ci: `
|
|
112
|
+
# Primary Workflows
|
|
100
113
|
|
|
114
|
+
## Software Engineering Tasks
|
|
115
|
+
When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
|
|
116
|
+
1. **Understand & Strategize:** Think about the user's request and the relevant codebase context. When the task involves **complex refactoring, codebase exploration or system-wide analysis**, your **first and primary tool** must be '${CodebaseInvestigatorAgent.name}'. Use it to build a comprehensive understanding of the code, its structure, and dependencies. For **simple, targeted searches** (like finding a specific function name, file path, or variable declaration), you should use '${GREP_TOOL_NAME}' or '${GLOB_TOOL_NAME}' directly.
|
|
117
|
+
2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. If '${CodebaseInvestigatorAgent.name}' was used, do not ignore the output of '${CodebaseInvestigatorAgent.name}', you must use it as the foundation of your plan. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`,
|
|
118
|
+
primaryWorkflows_prefix_ci_todo: `
|
|
119
|
+
# Primary Workflows
|
|
101
120
|
|
|
121
|
+
## Software Engineering Tasks
|
|
122
|
+
When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
|
|
123
|
+
1. **Understand & Strategize:** Think about the user's request and the relevant codebase context. When the task involves **complex refactoring, codebase exploration or system-wide analysis**, your **first and primary tool** must be '${CodebaseInvestigatorAgent.name}'. Use it to build a comprehensive understanding of the code, its structure, and dependencies. For **simple, targeted searches** (like finding a specific function name, file path, or variable declaration), you should use '${GREP_TOOL_NAME}' or '${GLOB_TOOL_NAME}' directly.
|
|
124
|
+
2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. If '${CodebaseInvestigatorAgent.name}' was used, do not ignore the output of '${CodebaseInvestigatorAgent.name}', you must use it as the foundation of your plan. For complex tasks, break them down into smaller, manageable subtasks and use the \`${WRITE_TODOS_TOOL_NAME}\` tool to track your progress. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`,
|
|
125
|
+
primaryWorkflows_todo: `
|
|
102
126
|
# Primary Workflows
|
|
103
127
|
|
|
104
128
|
## Software Engineering Tasks
|
|
105
129
|
When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
|
|
106
|
-
${(
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. If '${CodebaseInvestigatorAgent.name}' was used, do not ignore the output of '${CodebaseInvestigatorAgent.name}', you must use it as the foundation of your plan. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`;
|
|
111
|
-
}
|
|
112
|
-
return `
|
|
113
|
-
1. **Understand:** Think about the user's request and the relevant codebase context. Use '${GrepTool.Name}' and '${GlobTool.Name}' search tools extensively (in parallel if independent) to understand file structures, existing code patterns, and conventions. Use '${ReadFileTool.Name}' and '${ReadManyFilesTool.Name}' to understand context and validate any assumptions you may have.
|
|
114
|
-
2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`;
|
|
115
|
-
})()}
|
|
116
|
-
3. **Implement:** Use the available tools (e.g., '${EditTool.Name}', '${WRITE_FILE_TOOL_NAME}' '${ShellTool.Name}' ...) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core Mandates').
|
|
130
|
+
1. **Understand:** Think about the user's request and the relevant codebase context. Use '${GREP_TOOL_NAME}' and '${GLOB_TOOL_NAME}' search tools extensively (in parallel if independent) to understand file structures, existing code patterns, and conventions. Use '${READ_FILE_TOOL_NAME}' and '${READ_MANY_FILES_TOOL_NAME}' to understand context and validate any assumptions you may have.
|
|
131
|
+
2. **Plan:** Build a coherent and grounded (based on the understanding in step 1) plan for how you intend to resolve the user's task. For complex tasks, break them down into smaller, manageable subtasks and use the \`${WRITE_TODOS_TOOL_NAME}\` tool to track your progress. Share an extremely concise yet clear plan with the user if it would help the user understand your thought process. As part of the plan, you should use an iterative development process that includes writing unit tests to verify your changes. Use output logs or debug statements as part of this process to arrive at a solution.`,
|
|
132
|
+
primaryWorkflows_suffix: `3. **Implement:** Use the available tools (e.g., '${EDIT_TOOL_NAME}', '${WRITE_FILE_TOOL_NAME}' '${SHELL_TOOL_NAME}' ...) to act on the plan, strictly adhering to the project's established conventions (detailed under 'Core
|
|
133
|
+
Mandates').
|
|
117
134
|
4. **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands.
|
|
118
135
|
5. **Verify (Standards):** VERY IMPORTANT: After making code changes, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards. If unsure about these commands, you can ask the user if they'd like you to run them and if so how to.
|
|
119
136
|
6. **Finalize:** After all verification passes, consider the task complete. Do not remove or revert any changes or created files (like tests). Await the user's next instruction.
|
|
120
137
|
|
|
121
138
|
## New Applications
|
|
122
139
|
|
|
123
|
-
**Goal:** Autonomously implement and deliver a visually appealing, substantially complete, and functional prototype. Utilize all tools at your disposal to implement the application. Some tools you may especially find useful are '${WRITE_FILE_TOOL_NAME}', '${
|
|
140
|
+
**Goal:** Autonomously implement and deliver a visually appealing, substantially complete, and functional prototype. Utilize all tools at your disposal to implement the application. Some tools you may especially find useful are '${WRITE_FILE_TOOL_NAME}', '${EDIT_TOOL_NAME}' and '${SHELL_TOOL_NAME}'.
|
|
124
141
|
|
|
125
142
|
1. **Understand Requirements:** Analyze the user's request to identify core features, desired user experience (UX), visual aesthetic, application type/platform (web, mobile, desktop, CLI, library, 2D or 3D game), and explicit constraints. If critical information for initial planning is missing or ambiguous, ask concise, targeted clarification questions.
|
|
126
143
|
2. **Propose Plan:** Formulate an internal development plan. Present a clear, concise, high-level summary to the user. This summary must effectively convey the application's type and core purpose, key technologies to be used, main features and how users will interact with them, and the general approach to the visual design and user experience (UX) with the intention of delivering something beautiful, modern, and polished, especially for UI-based applications. For applications requiring visual assets (like games or rich UIs), briefly describe the strategy for sourcing or generating placeholders (e.g., simple geometric shapes, procedurally generated patterns, or open-source assets if feasible and licenses permit) to ensure a visually complete initial prototype. Ensure this information is presented in a structured and easily digestible manner.
|
|
@@ -133,29 +150,29 @@ ${(function () {
|
|
|
133
150
|
- **3d Games:** HTML/CSS/JavaScript with Three.js.
|
|
134
151
|
- **2d Games:** HTML/CSS/JavaScript.
|
|
135
152
|
3. **User Approval:** Obtain user approval for the proposed plan.
|
|
136
|
-
4. **Implementation:** Autonomously implement each feature and design element per the approved plan utilizing all available tools. When starting ensure you scaffold the application using '${
|
|
153
|
+
4. **Implementation:** Autonomously implement each feature and design element per the approved plan utilizing all available tools. When starting ensure you scaffold the application using '${SHELL_TOOL_NAME}' for commands like 'npm init', 'npx create-react-app'. Aim for full scope completion. Proactively create or source necessary placeholder assets (e.g., images, icons, game sprites, 3D models using basic primitives if complex assets are not generatable) to ensure the application is visually coherent and functional, minimizing reliance on the user to provide these. If the model can generate simple assets (e.g., a uniformly colored square sprite, a simple 3D cube), it should do so. Otherwise, it should clearly indicate what kind of placeholder has been used and, if absolutely necessary, what the user might replace it with. Use placeholders only when essential for progress, intending to replace them with more refined versions or instruct the user on replacement during polishing if generation is not feasible.
|
|
137
154
|
5. **Verify:** Review work against the original request, the approved plan. Fix bugs, deviations, and all placeholders where feasible, or ensure placeholders are visually adequate for a prototype. Ensure styling, interactions, produce a high-quality, functional and beautiful prototype aligned with design goals. Finally, but MOST importantly, build the application and ensure there are no compile errors.
|
|
138
|
-
6. **Solicit Feedback:** If still applicable, provide instructions on how to start the application and request user feedback on the prototype
|
|
139
|
-
|
|
155
|
+
6. **Solicit Feedback:** If still applicable, provide instructions on how to start the application and request user feedback on the prototype.`,
|
|
156
|
+
operationalGuidelines: `
|
|
140
157
|
# Operational Guidelines
|
|
141
158
|
${(function () {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
159
|
+
if (config.getEnableShellOutputEfficiency()) {
|
|
160
|
+
const tempDir = config.storage.getProjectTempDir();
|
|
161
|
+
return `
|
|
145
162
|
## Shell tool output token efficiency:
|
|
146
163
|
|
|
147
164
|
IT IS CRITICAL TO FOLLOW THESE GUIDELINES TO AVOID EXCESSIVE TOKEN CONSUMPTION.
|
|
148
165
|
|
|
149
|
-
- Always prefer command flags that reduce output verbosity when using '${
|
|
166
|
+
- Always prefer command flags that reduce output verbosity when using '${SHELL_TOOL_NAME}'.
|
|
150
167
|
- Aim to minimize tool output tokens while still capturing necessary information.
|
|
151
168
|
- If a command is expected to produce a lot of output, use quiet or silent flags where available and appropriate.
|
|
152
169
|
- Always consider the trade-off between output verbosity and the need for information. If a command's full output is essential for understanding the result, avoid overly aggressive quieting that might obscure important details.
|
|
153
170
|
- If a command does not have quiet/silent flags or for commands with potentially long output that may not be useful, redirect stdout and stderr to temp files in the project's temporary directory: ${tempDir}. For example: 'command > ${path.posix.join(tempDir, 'out.log')} 2> ${path.posix.join(tempDir, 'err.log')}'.
|
|
154
171
|
- After the command runs, inspect the temp files (e.g. '${path.posix.join(tempDir, 'out.log')}' and '${path.posix.join(tempDir, 'err.log')}') using commands like 'grep', 'tail', 'head', ... (or platform equivalents). Remove the temp files when done.
|
|
155
172
|
`;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
173
|
+
}
|
|
174
|
+
return '';
|
|
175
|
+
})()}
|
|
159
176
|
|
|
160
177
|
## Tone and Style (CLI Interaction)
|
|
161
178
|
- **Concise & Direct:** Adopt a professional, direct, and concise tone suitable for a CLI environment.
|
|
@@ -168,56 +185,56 @@ IT IS CRITICAL TO FOLLOW THESE GUIDELINES TO AVOID EXCESSIVE TOKEN CONSUMPTION.
|
|
|
168
185
|
- **Quality:** Always deliver production quality code, based on the spacific languaje best practices, SOLID and KISS principles.
|
|
169
186
|
|
|
170
187
|
## Security and Safety Rules
|
|
171
|
-
- **Explain Critical Commands:** Before executing commands with '${
|
|
188
|
+
- **Explain Critical Commands:** Before executing commands with '${SHELL_TOOL_NAME}' that modify the file system, codebase, or system state, you *must* provide a brief explanation of the command's purpose and potential impact. Prioritize user understanding and safety. You should not ask permission to use the tool; the user will be presented with a confirmation dialogue upon use (you do not need to tell them this).
|
|
172
189
|
- **Security First:** Always apply security best practices. Never introduce code that exposes, logs, or commits secrets, API keys, or other sensitive information.
|
|
173
190
|
|
|
174
191
|
## Tool Usage
|
|
175
|
-
- **File Paths:** Always use absolute paths when referring to files with tools like '${
|
|
192
|
+
- **File Paths:** Always use absolute paths when referring to files with tools like '${READ_FILE_TOOL_NAME}' or '${WRITE_FILE_TOOL_NAME}'. Relative paths are not supported. You must provide an absolute path.
|
|
176
193
|
- **Parallelism:** Execute multiple independent tool calls in parallel when feasible (i.e. searching the codebase).
|
|
177
|
-
- **Command Execution:** Use the '${
|
|
194
|
+
- **Command Execution:** Use the '${SHELL_TOOL_NAME}' tool for running shell commands, remembering the safety rule to explain modifying commands first.
|
|
178
195
|
- **Background Processes:** Use background processes (via \`&\`) for commands that are unlikely to stop on their own, e.g. \`node server.js &\`. If unsure, ask the user.
|
|
179
196
|
${(function () {
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
- **Remembering Facts:** Use the '${
|
|
197
|
+
if (!config.isInteractiveShellEnabled()) {
|
|
198
|
+
return `- **Interactive Commands:** Some commands are interactive, meaning they can accept user input during their execution (e.g. ssh, vim). Only execute non-interactive commands. Use non-interactive versions of commands (e.g. \`npm init -y\` instead of \`npm init\`) when available. Interactive shell commands are not supported and may cause hangs until canceled by the user.`;
|
|
199
|
+
}
|
|
200
|
+
else {
|
|
201
|
+
return `- **Interactive Commands:** Prefer non-interactive commands when it makes sense; however, some commands are only interactive and expect user input during their execution (e.g. ssh, vim). If you choose to execute an interactive command consider letting the user know they can press \`ctrl + f\` to focus into the shell to provide input.`;
|
|
202
|
+
}
|
|
203
|
+
})()}
|
|
204
|
+
- **Remembering Facts:** Use the '${MEMORY_TOOL_NAME}' tool to remember specific, *user-related* facts or preferences when the user explicitly asks, or when they state a clear, concise piece of information that would help personalize or streamline *your future interactions with them* (e.g., preferred coding style, common project paths they use, personal tool aliases). This tool is for user-specific information that should persist across sessions. Do *not* use it for general project context or information. If unsure whether to save something, you can ask the user, "Should I remember that for you?"
|
|
188
205
|
- **Respect User Confirmations:** Most tool calls (also denoted as 'function calls') will first require confirmation from the user, where they will either approve or cancel the function call. If a user cancels a function call, respect their choice and do _not_ try to make the function call again. It is okay to request the tool call again _only_ if the user requests that same tool call on a subsequent prompt. When a user cancels a function call, assume best intentions from the user and consider inquiring if they prefer any alternative paths forward.
|
|
189
206
|
|
|
190
207
|
## Interaction Details
|
|
191
208
|
- **Help Command:** The user can use '/help' to display help information.
|
|
192
|
-
- **Feedback:** To report a bug or provide feedback, please use the /bug command
|
|
193
|
-
|
|
209
|
+
- **Feedback:** To report a bug or provide feedback, please use the /bug command.`,
|
|
210
|
+
sandbox: `
|
|
194
211
|
${(function () {
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
212
|
+
// Determine sandbox status based on environment variables
|
|
213
|
+
const isSandboxExec = process.env['SANDBOX'] === 'sandbox-exec';
|
|
214
|
+
const isGenericSandbox = !!process.env['SANDBOX']; // Check if SANDBOX is set to any non-empty value
|
|
215
|
+
if (isSandboxExec) {
|
|
216
|
+
return `
|
|
200
217
|
# macOS Seatbelt
|
|
201
218
|
You are running under macos seatbelt with limited access to files outside the project directory or system temp directory, and with limited access to host system resources such as ports. If you encounter failures that could be due to macOS Seatbelt (e.g. if a command fails with 'Operation not permitted' or similar error), as you report the error to the user, also explain why you think it could be due to macOS Seatbelt, and how the user may need to adjust their Seatbelt profile.
|
|
202
219
|
`;
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
220
|
+
}
|
|
221
|
+
else if (isGenericSandbox) {
|
|
222
|
+
return `
|
|
206
223
|
# Sandbox
|
|
207
224
|
You are running in a sandbox container with limited access to files outside the project directory or system temp directory, and with limited access to host system resources such as ports. If you encounter failures that could be due to sandboxing (e.g. if a command fails with 'Operation not permitted' or similar error), when you report the error to the user, also explain why you think it could be due to sandboxing, and how the user may need to adjust their sandbox configuration.
|
|
208
225
|
`;
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
return `
|
|
212
229
|
# Outside of Sandbox
|
|
213
230
|
You are running outside of a sandbox container, directly on the user's system. For critical commands that are particularly likely to modify the user's system outside of the project directory or system temp directory, as you explain the command to the user (per the Explain Critical Commands rule above), also remind the user to consider enabling sandboxing.
|
|
214
231
|
`;
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
232
|
+
}
|
|
233
|
+
})()}`,
|
|
234
|
+
git: `
|
|
218
235
|
${(function () {
|
|
219
|
-
|
|
220
|
-
|
|
236
|
+
if (isGitRepository(process.cwd())) {
|
|
237
|
+
return `
|
|
221
238
|
# Git Repository
|
|
222
239
|
- The current working (project) directory is being managed by a git repository.
|
|
223
240
|
- When asked to commit changes or prepare a commit, always start by gathering information using shell commands:
|
|
@@ -233,13 +250,39 @@ ${(function () {
|
|
|
233
250
|
- If a commit fails, never attempt to work around the issues without being asked to do so.
|
|
234
251
|
- Never push changes to a remote repository without being asked explicitly by the user.
|
|
235
252
|
`;
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
253
|
+
}
|
|
254
|
+
return '';
|
|
255
|
+
})()}`,
|
|
256
|
+
finalReminder: `
|
|
240
257
|
# Final Reminder
|
|
241
|
-
Your core function is efficient and safe assistance. Balance extreme conciseness with the crucial need for clarity, especially regarding safety and potential system modifications. Always prioritize user control and project conventions. Never make assumptions about the contents of files; instead use '${
|
|
242
|
-
|
|
258
|
+
Your core function is efficient and safe assistance. Balance extreme conciseness with the crucial need for clarity, especially regarding safety and potential system modifications. Always prioritize user control and project conventions. Never make assumptions about the contents of files; instead use '${READ_FILE_TOOL_NAME}' or '${READ_MANY_FILES_TOOL_NAME}' to ensure you aren't making broad assumptions. Finally, you are an agent - please keep going until the user's query is completely resolved.`,
|
|
259
|
+
};
|
|
260
|
+
const orderedPrompts = [
|
|
261
|
+
'preamble',
|
|
262
|
+
'coreMandates',
|
|
263
|
+
];
|
|
264
|
+
if (enableCodebaseInvestigator && enableWriteTodosTool) {
|
|
265
|
+
orderedPrompts.push('primaryWorkflows_prefix_ci_todo');
|
|
266
|
+
}
|
|
267
|
+
else if (enableCodebaseInvestigator) {
|
|
268
|
+
orderedPrompts.push('primaryWorkflows_prefix_ci');
|
|
269
|
+
}
|
|
270
|
+
else if (enableWriteTodosTool) {
|
|
271
|
+
orderedPrompts.push('primaryWorkflows_todo');
|
|
272
|
+
}
|
|
273
|
+
else {
|
|
274
|
+
orderedPrompts.push('primaryWorkflows_prefix');
|
|
275
|
+
}
|
|
276
|
+
orderedPrompts.push('primaryWorkflows_suffix', 'operationalGuidelines', 'sandbox', 'git', 'finalReminder');
|
|
277
|
+
// By default, all prompts are enabled. A prompt is disabled if its corresponding
|
|
278
|
+
// GEMINI_PROMPT_<NAME> environment variable is set to "0" or "false".
|
|
279
|
+
const enabledPrompts = orderedPrompts.filter((key) => {
|
|
280
|
+
const envVar = process.env[`GEMINI_PROMPT_${key.toUpperCase()}`];
|
|
281
|
+
const lowerEnvVar = envVar?.trim().toLowerCase();
|
|
282
|
+
return lowerEnvVar !== '0' && lowerEnvVar !== 'false';
|
|
283
|
+
});
|
|
284
|
+
basePrompt = enabledPrompts.map((key) => promptConfig[key]).join('\n');
|
|
285
|
+
}
|
|
243
286
|
// if CELL_WRITE_SYSTEM_MD is set (and not 0|false), write base system prompt to file
|
|
244
287
|
const writeSystemMdResolution = resolvePathFromEnv(process.env['CELL_WRITE_SYSTEM_MD']);
|
|
245
288
|
// Check if the feature is enabled. This proceeds only if the environment
|