@google/gemini-cli-core 0.22.0 → 0.22.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/src/agents/executor.js +1 -1
- package/dist/src/agents/executor.js.map +1 -1
- package/dist/src/agents/executor.test.js.map +1 -1
- package/dist/src/agents/registry.d.ts +0 -15
- package/dist/src/agents/registry.js +0 -39
- package/dist/src/agents/registry.js.map +1 -1
- package/dist/src/agents/registry.test.js +0 -18
- package/dist/src/agents/registry.test.js.map +1 -1
- package/dist/src/availability/policyCatalog.test.js.map +1 -1
- package/dist/src/code_assist/experiments/client_metadata.js +1 -2
- package/dist/src/code_assist/experiments/client_metadata.js.map +1 -1
- package/dist/src/code_assist/experiments/client_metadata.test.js +10 -7
- package/dist/src/code_assist/experiments/client_metadata.test.js.map +1 -1
- package/dist/src/config/config.js +17 -25
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/config/config.test.js +8 -32
- package/dist/src/config/config.test.js.map +1 -1
- package/dist/src/config/defaultModelConfigs.js +0 -10
- package/dist/src/config/defaultModelConfigs.js.map +1 -1
- package/dist/src/config/models.d.ts +1 -9
- package/dist/src/config/models.js +1 -11
- package/dist/src/config/models.js.map +1 -1
- package/dist/src/config/models.test.js +1 -14
- package/dist/src/config/models.test.js.map +1 -1
- package/dist/src/confirmation-bus/message-bus.js.map +1 -1
- package/dist/src/confirmation-bus/types.d.ts +0 -4
- package/dist/src/core/baseLlmClient.test.js.map +1 -1
- package/dist/src/core/contentGenerator.js +3 -5
- package/dist/src/core/contentGenerator.js.map +1 -1
- package/dist/src/core/contentGenerator.test.js +2 -29
- package/dist/src/core/contentGenerator.test.js.map +1 -1
- package/dist/src/core/coreToolScheduler.d.ts +1 -1
- package/dist/src/core/coreToolScheduler.js +34 -72
- package/dist/src/core/coreToolScheduler.js.map +1 -1
- package/dist/src/core/coreToolScheduler.test.js +37 -134
- package/dist/src/core/coreToolScheduler.test.js.map +1 -1
- package/dist/src/core/geminiChat.js +3 -1
- package/dist/src/core/geminiChat.js.map +1 -1
- package/dist/src/core/geminiChat.test.js.map +1 -1
- package/dist/src/core/logger.js.map +1 -1
- package/dist/src/core/nonInteractiveToolExecutor.test.js +5 -4
- package/dist/src/core/nonInteractiveToolExecutor.test.js.map +1 -1
- package/dist/src/core/prompts.js +6 -8
- package/dist/src/core/prompts.js.map +1 -1
- package/dist/src/core/prompts.test.js +3 -9
- package/dist/src/core/prompts.test.js.map +1 -1
- package/dist/src/core/turn.js +1 -1
- package/dist/src/core/turn.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +2 -2
- package/dist/src/generated/git-commit.js +2 -2
- package/dist/src/hooks/hookEventHandler.js +1 -6
- package/dist/src/hooks/hookEventHandler.js.map +1 -1
- package/dist/src/hooks/hookEventHandler.test.js +1 -8
- package/dist/src/hooks/hookEventHandler.test.js.map +1 -1
- package/dist/src/hooks/hookRegistry.d.ts +7 -0
- package/dist/src/hooks/hookRegistry.js +20 -0
- package/dist/src/hooks/hookRegistry.js.map +1 -1
- package/dist/src/hooks/hookRegistry.test.js +7 -1
- package/dist/src/hooks/hookRegistry.test.js.map +1 -1
- package/dist/src/hooks/hookRunner.test.js +1 -1
- package/dist/src/hooks/hookRunner.test.js.map +1 -1
- package/dist/src/hooks/hookSystem.d.ts +8 -0
- package/dist/src/hooks/hookSystem.js +18 -0
- package/dist/src/hooks/hookSystem.js.map +1 -1
- package/dist/src/hooks/hookSystem.test.js +21 -2
- package/dist/src/hooks/hookSystem.test.js.map +1 -1
- package/dist/src/ide/detect-ide.test.js +1 -32
- package/dist/src/ide/detect-ide.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/index.d.ts +0 -3
- package/dist/src/index.js +0 -3
- package/dist/src/index.js.map +1 -1
- package/dist/src/mcp/oauth-provider.js.map +1 -1
- package/dist/src/output/json-formatter.test.js +0 -2
- package/dist/src/output/json-formatter.test.js.map +1 -1
- package/dist/src/output/stream-json-formatter.js +0 -6
- package/dist/src/output/stream-json-formatter.js.map +1 -1
- package/dist/src/output/stream-json-formatter.test.js +100 -98
- package/dist/src/output/stream-json-formatter.test.js.map +1 -1
- package/dist/src/output/types.d.ts +0 -2
- package/dist/src/policy/config.js +2 -71
- package/dist/src/policy/config.js.map +1 -1
- package/dist/src/policy/policy-engine.js +1 -55
- package/dist/src/policy/policy-engine.js.map +1 -1
- package/dist/src/policy/toml-loader.d.ts +0 -8
- package/dist/src/policy/toml-loader.js +3 -3
- package/dist/src/policy/toml-loader.js.map +1 -1
- package/dist/src/safety/checker-runner.js +6 -17
- package/dist/src/safety/checker-runner.js.map +1 -1
- package/dist/src/services/chatRecordingService.d.ts +0 -5
- package/dist/src/services/chatRecordingService.js +0 -7
- package/dist/src/services/chatRecordingService.js.map +1 -1
- package/dist/src/services/fileSystemService.d.ts +9 -0
- package/dist/src/services/fileSystemService.js +11 -0
- package/dist/src/services/fileSystemService.js.map +1 -1
- package/dist/src/services/loopDetectionService.js +2 -2
- package/dist/src/services/loopDetectionService.js.map +1 -1
- package/dist/src/services/modelConfig.golden.test.js +0 -32
- package/dist/src/services/modelConfig.golden.test.js.map +1 -1
- package/dist/src/services/modelConfigService.d.ts +0 -3
- package/dist/src/services/modelConfigService.js +2 -3
- package/dist/src/services/modelConfigService.js.map +1 -1
- package/dist/src/services/modelConfigService.test.js +0 -110
- package/dist/src/services/modelConfigService.test.js.map +1 -1
- package/dist/src/services/shellExecutionService.js +2 -1
- package/dist/src/services/shellExecutionService.js.map +1 -1
- package/dist/src/services/shellExecutionService.test.js +3 -6
- package/dist/src/services/shellExecutionService.test.js.map +1 -1
- package/dist/src/telemetry/activity-detector.test.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js +5 -5
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.js.map +1 -1
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js +1 -18
- package/dist/src/telemetry/clearcut-logger/clearcut-logger.test.js.map +1 -1
- package/dist/src/telemetry/config.js.map +1 -1
- package/dist/src/telemetry/loggers.test.js +5 -5
- package/dist/src/telemetry/loggers.test.js.map +1 -1
- package/dist/src/telemetry/metrics.test.js.map +1 -1
- package/dist/src/telemetry/startupProfiler.test.js +2 -1
- package/dist/src/telemetry/startupProfiler.test.js.map +1 -1
- package/dist/src/telemetry/trace.js.map +1 -1
- package/dist/src/telemetry/types.d.ts +5 -10
- package/dist/src/telemetry/types.js +8 -16
- package/dist/src/telemetry/types.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.d.ts +0 -1
- package/dist/src/telemetry/uiTelemetry.js +0 -2
- package/dist/src/telemetry/uiTelemetry.js.map +1 -1
- package/dist/src/telemetry/uiTelemetry.test.js +0 -4
- package/dist/src/telemetry/uiTelemetry.test.js.map +1 -1
- package/dist/src/test-utils/mock-message-bus.js.map +1 -1
- package/dist/src/tools/edit.js +0 -1
- package/dist/src/tools/edit.js.map +1 -1
- package/dist/src/tools/edit.test.js.map +1 -1
- package/dist/src/tools/grep.js.map +1 -1
- package/dist/src/tools/mcp-tool.js +0 -13
- package/dist/src/tools/mcp-tool.js.map +1 -1
- package/dist/src/tools/mcp-tool.test.js +0 -25
- package/dist/src/tools/mcp-tool.test.js.map +1 -1
- package/dist/src/tools/memoryTool.js +0 -1
- package/dist/src/tools/memoryTool.js.map +1 -1
- package/dist/src/tools/modifiable-tool.js.map +1 -1
- package/dist/src/tools/read-file.test.js.map +1 -1
- package/dist/src/tools/shell.d.ts +1 -2
- package/dist/src/tools/shell.js +1 -9
- package/dist/src/tools/shell.js.map +1 -1
- package/dist/src/tools/shell.test.js +1 -2
- package/dist/src/tools/shell.test.js.map +1 -1
- package/dist/src/tools/smart-edit.js +0 -1
- package/dist/src/tools/smart-edit.js.map +1 -1
- package/dist/src/tools/smart-edit.test.js.map +1 -1
- package/dist/src/tools/tool-names.d.ts +0 -1
- package/dist/src/tools/tool-names.js +0 -1
- package/dist/src/tools/tool-names.js.map +1 -1
- package/dist/src/tools/tools.d.ts +0 -19
- package/dist/src/tools/tools.js +9 -28
- package/dist/src/tools/tools.js.map +1 -1
- package/dist/src/tools/web-fetch.js +0 -1
- package/dist/src/tools/web-fetch.js.map +1 -1
- package/dist/src/tools/write-file.js +0 -1
- package/dist/src/tools/write-file.js.map +1 -1
- package/dist/src/tools/write-file.test.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.d.ts +0 -8
- package/dist/src/utils/bfsFileSearch.js +23 -63
- package/dist/src/utils/bfsFileSearch.js.map +1 -1
- package/dist/src/utils/bfsFileSearch.test.js +1 -65
- package/dist/src/utils/bfsFileSearch.test.js.map +1 -1
- package/dist/src/utils/checkpointUtils.js.map +1 -1
- package/dist/src/utils/extensionLoader.d.ts +2 -2
- package/dist/src/utils/extensionLoader.js +6 -5
- package/dist/src/utils/extensionLoader.js.map +1 -1
- package/dist/src/utils/extensionLoader.test.js +0 -11
- package/dist/src/utils/extensionLoader.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/pathCorrector.js +2 -12
- package/dist/src/utils/pathCorrector.js.map +1 -1
- package/dist/src/utils/pathCorrector.test.js +2 -6
- package/dist/src/utils/pathCorrector.test.js.map +1 -1
- package/dist/src/utils/shell-utils.d.ts +47 -10
- package/dist/src/utils/shell-utils.js +182 -1
- package/dist/src/utils/shell-utils.js.map +1 -1
- package/dist/src/utils/shell-utils.test.js +288 -1
- package/dist/src/utils/shell-utils.test.js.map +1 -1
- package/dist/src/utils/tool-utils.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -2
- package/dist/src/agents/delegate-to-agent-tool.d.ts +0 -19
- package/dist/src/agents/delegate-to-agent-tool.js +0 -111
- package/dist/src/agents/delegate-to-agent-tool.js.map +0 -1
- package/dist/src/agents/delegate-to-agent-tool.test.d.ts +0 -6
- package/dist/src/agents/delegate-to-agent-tool.test.js +0 -133
- package/dist/src/agents/delegate-to-agent-tool.test.js.map +0 -1
- package/dist/src/commands/init.d.ts +0 -7
- package/dist/src/commands/init.js +0 -53
- package/dist/src/commands/init.js.map +0 -1
- package/dist/src/commands/init.test.d.ts +0 -6
- package/dist/src/commands/init.test.js +0 -25
- package/dist/src/commands/init.test.js.map +0 -1
- package/dist/src/policy/persistence.test.d.ts +0 -6
- package/dist/src/policy/persistence.test.js +0 -149
- package/dist/src/policy/persistence.test.js.map +0 -1
- package/dist/src/policy/policies/agent.toml +0 -31
- package/dist/src/policy/shell-safety.test.d.ts +0 -6
- package/dist/src/policy/shell-safety.test.js +0 -74
- package/dist/src/policy/shell-safety.test.js.map +0 -1
- package/dist/src/services/test-data/resolved-aliases-retry.golden.json +0 -238
- package/dist/src/utils/shell-permissions.d.ts +0 -52
- package/dist/src/utils/shell-permissions.js +0 -188
- package/dist/src/utils/shell-permissions.js.map +0 -1
- package/dist/src/utils/shell-permissions.test.d.ts +0 -6
- package/dist/src/utils/shell-permissions.test.js +0 -342
- package/dist/src/utils/shell-permissions.test.js.map +0 -1
- package/dist/src/utils/version.d.ts +0 -6
- package/dist/src/utils/version.js +0 -15
- package/dist/src/utils/version.js.map +0 -1
- package/dist/src/utils/version.test.d.ts +0 -6
- package/dist/src/utils/version.test.js +0 -39
- package/dist/src/utils/version.test.js.map +0 -1
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { describe, it, expect, beforeEach } from 'vitest';
|
|
7
|
-
import { PolicyEngine } from './policy-engine.js';
|
|
8
|
-
import { PolicyDecision } from './types.js';
|
|
9
|
-
describe('Shell Safety Policy', () => {
|
|
10
|
-
let policyEngine;
|
|
11
|
-
beforeEach(() => {
|
|
12
|
-
policyEngine = new PolicyEngine({
|
|
13
|
-
rules: [
|
|
14
|
-
{
|
|
15
|
-
toolName: 'run_shell_command',
|
|
16
|
-
// Mimic the regex generated by toml-loader for commandPrefix = ["git log"]
|
|
17
|
-
// Regex: "command":"git log(?:[\s"]|$)
|
|
18
|
-
argsPattern: /"command":"git log(?:[\s"]|$)/,
|
|
19
|
-
decision: PolicyDecision.ALLOW,
|
|
20
|
-
priority: 1.01, // Higher priority than default
|
|
21
|
-
},
|
|
22
|
-
],
|
|
23
|
-
defaultDecision: PolicyDecision.ASK_USER,
|
|
24
|
-
});
|
|
25
|
-
});
|
|
26
|
-
it('SHOULD match "git log" exactly', async () => {
|
|
27
|
-
const toolCall = {
|
|
28
|
-
name: 'run_shell_command',
|
|
29
|
-
args: { command: 'git log' },
|
|
30
|
-
};
|
|
31
|
-
const result = await policyEngine.check(toolCall, undefined);
|
|
32
|
-
expect(result.decision).toBe(PolicyDecision.ALLOW);
|
|
33
|
-
});
|
|
34
|
-
it('SHOULD match "git log" with arguments', async () => {
|
|
35
|
-
const toolCall = {
|
|
36
|
-
name: 'run_shell_command',
|
|
37
|
-
args: { command: 'git log --oneline' },
|
|
38
|
-
};
|
|
39
|
-
const result = await policyEngine.check(toolCall, undefined);
|
|
40
|
-
expect(result.decision).toBe(PolicyDecision.ALLOW);
|
|
41
|
-
});
|
|
42
|
-
it('SHOULD NOT match "git logout" when prefix is "git log" (strict word boundary)', async () => {
|
|
43
|
-
const toolCall = {
|
|
44
|
-
name: 'run_shell_command',
|
|
45
|
-
args: { command: 'git logout' },
|
|
46
|
-
};
|
|
47
|
-
// Desired behavior: Should NOT match "git log" prefix.
|
|
48
|
-
// If it doesn't match, it should fall back to default decision (ASK_USER).
|
|
49
|
-
const result = await policyEngine.check(toolCall, undefined);
|
|
50
|
-
expect(result.decision).toBe(PolicyDecision.ASK_USER);
|
|
51
|
-
});
|
|
52
|
-
it('SHOULD NOT allow "git log && rm -rf /" completely when prefix is "git log" (compound command safety)', async () => {
|
|
53
|
-
const toolCall = {
|
|
54
|
-
name: 'run_shell_command',
|
|
55
|
-
args: { command: 'git log && rm -rf /' },
|
|
56
|
-
};
|
|
57
|
-
// Desired behavior: Should inspect all parts. "rm -rf /" is not allowed.
|
|
58
|
-
// The "git log" part is ALLOW, but "rm -rf /" is ASK_USER (default).
|
|
59
|
-
// Aggregate should be ASK_USER.
|
|
60
|
-
const result = await policyEngine.check(toolCall, undefined);
|
|
61
|
-
expect(result.decision).toBe(PolicyDecision.ASK_USER);
|
|
62
|
-
});
|
|
63
|
-
it('SHOULD NOT allow "git log &&& rm -rf /" when prefix is "git log" (parse failure)', async () => {
|
|
64
|
-
const toolCall = {
|
|
65
|
-
name: 'run_shell_command',
|
|
66
|
-
args: { command: 'git log &&& rm -rf /' },
|
|
67
|
-
};
|
|
68
|
-
// Desired behavior: Should fail safe (ASK_USER or DENY) because parsing failed.
|
|
69
|
-
// If we let it pass as "single command" that matches prefix, it's dangerous.
|
|
70
|
-
const result = await policyEngine.check(toolCall, undefined);
|
|
71
|
-
expect(result.decision).toBe(PolicyDecision.ASK_USER);
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
//# sourceMappingURL=shell-safety.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell-safety.test.js","sourceRoot":"","sources":["../../../src/policy/shell-safety.test.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;IACnC,IAAI,YAA0B,CAAC;IAE/B,UAAU,CAAC,GAAG,EAAE;QACd,YAAY,GAAG,IAAI,YAAY,CAAC;YAC9B,KAAK,EAAE;gBACL;oBACE,QAAQ,EAAE,mBAAmB;oBAC7B,2EAA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fig": {
|
|
13
|
-
"includeThoughts": true
|
|
14
|
-
},
|
|
15
|
-
"topK": 64
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"chat-base-2.5": {
|
|
19
|
-
"generateContentConfig": {
|
|
20
|
-
"temperature": 1,
|
|
21
|
-
"topP": 0.95,
|
|
22
|
-
"thinkingConfig": {
|
|
23
|
-
"includeThoughts": true,
|
|
24
|
-
"thinkingBudget": 8192
|
|
25
|
-
},
|
|
26
|
-
"topK": 64
|
|
27
|
-
}
|
|
28
|
-
},
|
|
29
|
-
"chat-base-3": {
|
|
30
|
-
"generateContentConfig": {
|
|
31
|
-
"temperature": 1,
|
|
32
|
-
"topP": 0.95,
|
|
33
|
-
"thinkingConfig": {
|
|
34
|
-
"includeThoughts": true,
|
|
35
|
-
"thinkingLevel": "HIGH"
|
|
36
|
-
},
|
|
37
|
-
"topK": 64
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
"gemini-3-pro-preview": {
|
|
41
|
-
"model": "gemini-3-pro-preview",
|
|
42
|
-
"generateContentConfig": {
|
|
43
|
-
"temperature": 1,
|
|
44
|
-
"topP": 0.95,
|
|
45
|
-
"thinkingConfig": {
|
|
46
|
-
"includeThoughts": true,
|
|
47
|
-
"thinkingLevel": "HIGH"
|
|
48
|
-
},
|
|
49
|
-
"topK": 64
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
"gemini-3-flash-preview": {
|
|
53
|
-
"model": "gemini-3-flash-preview",
|
|
54
|
-
"generateContentConfig": {
|
|
55
|
-
"temperature": 1,
|
|
56
|
-
"topP": 0.95,
|
|
57
|
-
"thinkingConfig": {
|
|
58
|
-
"includeThoughts": true,
|
|
59
|
-
"thinkingLevel": "HIGH"
|
|
60
|
-
},
|
|
61
|
-
"topK": 64
|
|
62
|
-
}
|
|
63
|
-
},
|
|
64
|
-
"gemini-2.5-pro": {
|
|
65
|
-
"model": "gemini-2.5-pro",
|
|
66
|
-
"generateContentConfig": {
|
|
67
|
-
"temperature": 1,
|
|
68
|
-
"topP": 0.95,
|
|
69
|
-
"thinkingConfig": {
|
|
70
|
-
"includeThoughts": true,
|
|
71
|
-
"thinkingBudget": 8192
|
|
72
|
-
},
|
|
73
|
-
"topK": 64
|
|
74
|
-
}
|
|
75
|
-
},
|
|
76
|
-
"gemini-2.5-flash": {
|
|
77
|
-
"model": "gemini-2.5-flash",
|
|
78
|
-
"generateContentConfig": {
|
|
79
|
-
"temperature": 1,
|
|
80
|
-
"topP": 0.95,
|
|
81
|
-
"thinkingConfig": {
|
|
82
|
-
"includeThoughts": true,
|
|
83
|
-
"thinkingBudget": 8192
|
|
84
|
-
},
|
|
85
|
-
"topK": 64
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"gemini-2.5-flash-lite": {
|
|
89
|
-
"model": "gemini-2.5-flash-lite",
|
|
90
|
-
"generateContentConfig": {
|
|
91
|
-
"temperature": 1,
|
|
92
|
-
"topP": 0.95,
|
|
93
|
-
"thinkingConfig": {
|
|
94
|
-
"includeThoughts": true,
|
|
95
|
-
"thinkingBudget": 8192
|
|
96
|
-
},
|
|
97
|
-
"topK": 64
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
|
-
"gemini-2.5-flash-base": {
|
|
101
|
-
"model": "gemini-2.5-flash",
|
|
102
|
-
"generateContentConfig": {
|
|
103
|
-
"temperature": 0,
|
|
104
|
-
"topP": 1
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
"classifier": {
|
|
108
|
-
"model": "gemini-2.5-flash-lite",
|
|
109
|
-
"generateContentConfig": {
|
|
110
|
-
"temperature": 0,
|
|
111
|
-
"topP": 1,
|
|
112
|
-
"maxOutputTokens": 1024,
|
|
113
|
-
"thinkingConfig": {
|
|
114
|
-
"thinkingBudget": 512
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"prompt-completion": {
|
|
119
|
-
"model": "gemini-2.5-flash-lite",
|
|
120
|
-
"generateContentConfig": {
|
|
121
|
-
"temperature": 0.3,
|
|
122
|
-
"topP": 1,
|
|
123
|
-
"maxOutputTokens": 16000,
|
|
124
|
-
"thinkingConfig": {
|
|
125
|
-
"thinkingBudget": 0
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
"edit-corrector": {
|
|
130
|
-
"model": "gemini-2.5-flash-lite",
|
|
131
|
-
"generateContentConfig": {
|
|
132
|
-
"temperature": 0,
|
|
133
|
-
"topP": 1,
|
|
134
|
-
"thinkingConfig": {
|
|
135
|
-
"thinkingBudget": 0
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
"summarizer-default": {
|
|
140
|
-
"model": "gemini-2.5-flash-lite",
|
|
141
|
-
"generateContentConfig": {
|
|
142
|
-
"temperature": 0,
|
|
143
|
-
"topP": 1,
|
|
144
|
-
"maxOutputTokens": 2000
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
"summarizer-shell": {
|
|
148
|
-
"model": "gemini-2.5-flash-lite",
|
|
149
|
-
"generateContentConfig": {
|
|
150
|
-
"temperature": 0,
|
|
151
|
-
"topP": 1,
|
|
152
|
-
"maxOutputTokens": 2000
|
|
153
|
-
}
|
|
154
|
-
},
|
|
155
|
-
"web-search": {
|
|
156
|
-
"model": "gemini-2.5-flash",
|
|
157
|
-
"generateContentConfig": {
|
|
158
|
-
"temperature": 0,
|
|
159
|
-
"topP": 1,
|
|
160
|
-
"tools": [
|
|
161
|
-
{
|
|
162
|
-
"googleSearch": {}
|
|
163
|
-
}
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
"web-fetch": {
|
|
168
|
-
"model": "gemini-2.5-flash",
|
|
169
|
-
"generateContentConfig": {
|
|
170
|
-
"temperature": 0,
|
|
171
|
-
"topP": 1,
|
|
172
|
-
"tools": [
|
|
173
|
-
{
|
|
174
|
-
"urlContext": {}
|
|
175
|
-
}
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
},
|
|
179
|
-
"web-fetch-fallback": {
|
|
180
|
-
"model": "gemini-2.5-flash",
|
|
181
|
-
"generateContentConfig": {
|
|
182
|
-
"temperature": 0,
|
|
183
|
-
"topP": 1
|
|
184
|
-
}
|
|
185
|
-
},
|
|
186
|
-
"loop-detection": {
|
|
187
|
-
"model": "gemini-2.5-flash",
|
|
188
|
-
"generateContentConfig": {
|
|
189
|
-
"temperature": 0,
|
|
190
|
-
"topP": 1
|
|
191
|
-
}
|
|
192
|
-
},
|
|
193
|
-
"loop-detection-double-check": {
|
|
194
|
-
"model": "gemini-2.5-pro",
|
|
195
|
-
"generateContentConfig": {
|
|
196
|
-
"temperature": 0,
|
|
197
|
-
"topP": 1
|
|
198
|
-
}
|
|
199
|
-
},
|
|
200
|
-
"llm-edit-fixer": {
|
|
201
|
-
"model": "gemini-2.5-flash",
|
|
202
|
-
"generateContentConfig": {
|
|
203
|
-
"temperature": 0,
|
|
204
|
-
"topP": 1
|
|
205
|
-
}
|
|
206
|
-
},
|
|
207
|
-
"next-speaker-checker": {
|
|
208
|
-
"model": "gemini-2.5-flash",
|
|
209
|
-
"generateContentConfig": {
|
|
210
|
-
"temperature": 0,
|
|
211
|
-
"topP": 1
|
|
212
|
-
}
|
|
213
|
-
},
|
|
214
|
-
"chat-compression-3-pro": {
|
|
215
|
-
"model": "gemini-3-pro-preview",
|
|
216
|
-
"generateContentConfig": {}
|
|
217
|
-
},
|
|
218
|
-
"chat-compression-3-flash": {
|
|
219
|
-
"model": "gemini-3-flash-preview",
|
|
220
|
-
"generateContentConfig": {}
|
|
221
|
-
},
|
|
222
|
-
"chat-compression-2.5-pro": {
|
|
223
|
-
"model": "gemini-2.5-pro",
|
|
224
|
-
"generateContentConfig": {}
|
|
225
|
-
},
|
|
226
|
-
"chat-compression-2.5-flash": {
|
|
227
|
-
"model": "gemini-2.5-flash",
|
|
228
|
-
"generateContentConfig": {}
|
|
229
|
-
},
|
|
230
|
-
"chat-compression-2.5-flash-lite": {
|
|
231
|
-
"model": "gemini-2.5-flash-lite",
|
|
232
|
-
"generateContentConfig": {}
|
|
233
|
-
},
|
|
234
|
-
"chat-compression-default": {
|
|
235
|
-
"model": "gemini-2.5-pro",
|
|
236
|
-
"generateContentConfig": {}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import type { AnyToolInvocation } from '../index.js';
|
|
7
|
-
import type { Config } from '../config/config.js';
|
|
8
|
-
/**
|
|
9
|
-
* Checks a shell command against security policies and allowlists.
|
|
10
|
-
*
|
|
11
|
-
* This function operates in one of two modes depending on the presence of
|
|
12
|
-
* the `sessionAllowlist` parameter:
|
|
13
|
-
*
|
|
14
|
-
* 1. **"Default Deny" Mode (sessionAllowlist is provided):** This is the
|
|
15
|
-
* strictest mode, used for user-defined scripts like custom commands.
|
|
16
|
-
* A command is only permitted if it is found on the global `coreTools`
|
|
17
|
-
* allowlist OR the provided `sessionAllowlist`. It must not be on the
|
|
18
|
-
* global `excludeTools` blocklist.
|
|
19
|
-
*
|
|
20
|
-
* 2. **"Default Allow" Mode (sessionAllowlist is NOT provided):** This mode
|
|
21
|
-
* is used for direct tool invocations (e.g., by the model). If a strict
|
|
22
|
-
* global `coreTools` allowlist exists, commands must be on it. Otherwise,
|
|
23
|
-
* any command is permitted as long as it is not on the `excludeTools`
|
|
24
|
-
* blocklist.
|
|
25
|
-
*
|
|
26
|
-
* @param command The shell command string to validate.
|
|
27
|
-
* @param config The application configuration.
|
|
28
|
-
* @param sessionAllowlist A session-level list of approved commands. Its
|
|
29
|
-
* presence activates "Default Deny" mode.
|
|
30
|
-
* @returns An object detailing which commands are not allowed.
|
|
31
|
-
*/
|
|
32
|
-
export declare function checkCommandPermissions(command: string, config: Config, sessionAllowlist?: Set<string>): {
|
|
33
|
-
allAllowed: boolean;
|
|
34
|
-
disallowedCommands: string[];
|
|
35
|
-
blockReason?: string;
|
|
36
|
-
isHardDenial?: boolean;
|
|
37
|
-
};
|
|
38
|
-
export declare function isCommandAllowed(command: string, config: Config): {
|
|
39
|
-
allowed: boolean;
|
|
40
|
-
reason?: string;
|
|
41
|
-
};
|
|
42
|
-
/**
|
|
43
|
-
* Determines whether a shell invocation should be auto-approved based on an allowlist.
|
|
44
|
-
*
|
|
45
|
-
* This reuses the same parsing logic as command-permission enforcement so that
|
|
46
|
-
* chained commands must be individually covered by the allowlist.
|
|
47
|
-
*
|
|
48
|
-
* @param invocation The shell tool invocation being evaluated.
|
|
49
|
-
* @param allowedPatterns The configured allowlist patterns (e.g. `run_shell_command(git)`).
|
|
50
|
-
* @returns True if every parsed command segment is allowed by the patterns; false otherwise.
|
|
51
|
-
*/
|
|
52
|
-
export declare function isShellInvocationAllowlisted(invocation: AnyToolInvocation, allowedPatterns: string[]): boolean;
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2025 Google LLC
|
|
4
|
-
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
*/
|
|
6
|
-
import { doesToolInvocationMatch } from './tool-utils.js';
|
|
7
|
-
import { parseCommandDetails, SHELL_TOOL_NAMES, } from './shell-utils.js';
|
|
8
|
-
/**
|
|
9
|
-
* Checks a shell command against security policies and allowlists.
|
|
10
|
-
*
|
|
11
|
-
* This function operates in one of two modes depending on the presence of
|
|
12
|
-
* the `sessionAllowlist` parameter:
|
|
13
|
-
*
|
|
14
|
-
* 1. **"Default Deny" Mode (sessionAllowlist is provided):** This is the
|
|
15
|
-
* strictest mode, used for user-defined scripts like custom commands.
|
|
16
|
-
* A command is only permitted if it is found on the global `coreTools`
|
|
17
|
-
* allowlist OR the provided `sessionAllowlist`. It must not be on the
|
|
18
|
-
* global `excludeTools` blocklist.
|
|
19
|
-
*
|
|
20
|
-
* 2. **"Default Allow" Mode (sessionAllowlist is NOT provided):** This mode
|
|
21
|
-
* is used for direct tool invocations (e.g., by the model). If a strict
|
|
22
|
-
* global `coreTools` allowlist exists, commands must be on it. Otherwise,
|
|
23
|
-
* any command is permitted as long as it is not on the `excludeTools`
|
|
24
|
-
* blocklist.
|
|
25
|
-
*
|
|
26
|
-
* @param command The shell command string to validate.
|
|
27
|
-
* @param config The application configuration.
|
|
28
|
-
* @param sessionAllowlist A session-level list of approved commands. Its
|
|
29
|
-
* presence activates "Default Deny" mode.
|
|
30
|
-
* @returns An object detailing which commands are not allowed.
|
|
31
|
-
*/
|
|
32
|
-
export function checkCommandPermissions(command, config, sessionAllowlist) {
|
|
33
|
-
const parseResult = parseCommandDetails(command);
|
|
34
|
-
if (!parseResult || parseResult.hasError) {
|
|
35
|
-
return {
|
|
36
|
-
allAllowed: false,
|
|
37
|
-
disallowedCommands: [command],
|
|
38
|
-
blockReason: 'Command rejected because it could not be parsed safely',
|
|
39
|
-
isHardDenial: true,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
const normalize = (cmd) => cmd.trim().replace(/\s+/g, ' ');
|
|
43
|
-
const commandsToValidate = parseResult.details
|
|
44
|
-
.map((detail) => normalize(detail.text))
|
|
45
|
-
.filter(Boolean);
|
|
46
|
-
const invocation = {
|
|
47
|
-
params: { command: '' },
|
|
48
|
-
};
|
|
49
|
-
// 1. Blocklist Check (Highest Priority)
|
|
50
|
-
const excludeTools = config.getExcludeTools() || new Set([]);
|
|
51
|
-
const isWildcardBlocked = SHELL_TOOL_NAMES.some((name) => excludeTools.has(name));
|
|
52
|
-
if (isWildcardBlocked) {
|
|
53
|
-
return {
|
|
54
|
-
allAllowed: false,
|
|
55
|
-
disallowedCommands: commandsToValidate,
|
|
56
|
-
blockReason: 'Shell tool is globally disabled in configuration',
|
|
57
|
-
isHardDenial: true,
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
for (const cmd of commandsToValidate) {
|
|
61
|
-
invocation.params['command'] = cmd;
|
|
62
|
-
if (doesToolInvocationMatch('run_shell_command', invocation, [
|
|
63
|
-
...excludeTools,
|
|
64
|
-
])) {
|
|
65
|
-
return {
|
|
66
|
-
allAllowed: false,
|
|
67
|
-
disallowedCommands: [cmd],
|
|
68
|
-
blockReason: `Command '${cmd}' is blocked by configuration`,
|
|
69
|
-
isHardDenial: true,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
const coreTools = config.getCoreTools() || [];
|
|
74
|
-
const isWildcardAllowed = SHELL_TOOL_NAMES.some((name) => coreTools.includes(name));
|
|
75
|
-
// If there's a global wildcard, all commands are allowed at this point
|
|
76
|
-
// because they have already passed the blocklist check.
|
|
77
|
-
if (isWildcardAllowed) {
|
|
78
|
-
return { allAllowed: true, disallowedCommands: [] };
|
|
79
|
-
}
|
|
80
|
-
const disallowedCommands = [];
|
|
81
|
-
if (sessionAllowlist) {
|
|
82
|
-
// "DEFAULT DENY" MODE: A session allowlist is provided.
|
|
83
|
-
// All commands must be in either the session or global allowlist.
|
|
84
|
-
const normalizedSessionAllowlist = new Set([...sessionAllowlist].flatMap((cmd) => SHELL_TOOL_NAMES.map((name) => `${name}(${cmd})`)));
|
|
85
|
-
for (const cmd of commandsToValidate) {
|
|
86
|
-
invocation.params['command'] = cmd;
|
|
87
|
-
const isSessionAllowed = doesToolInvocationMatch('run_shell_command', invocation, [...normalizedSessionAllowlist]);
|
|
88
|
-
if (isSessionAllowed)
|
|
89
|
-
continue;
|
|
90
|
-
const isGloballyAllowed = doesToolInvocationMatch('run_shell_command', invocation, coreTools);
|
|
91
|
-
if (isGloballyAllowed)
|
|
92
|
-
continue;
|
|
93
|
-
disallowedCommands.push(cmd);
|
|
94
|
-
}
|
|
95
|
-
if (disallowedCommands.length > 0) {
|
|
96
|
-
return {
|
|
97
|
-
allAllowed: false,
|
|
98
|
-
disallowedCommands,
|
|
99
|
-
blockReason: `Command(s) not on the global or session allowlist. Disallowed commands: ${disallowedCommands
|
|
100
|
-
.map((c) => JSON.stringify(c))
|
|
101
|
-
.join(', ')}`,
|
|
102
|
-
isHardDenial: false, // This is a soft denial; confirmation is possible.
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
// "DEFAULT ALLOW" MODE: No session allowlist.
|
|
108
|
-
const hasSpecificAllowedCommands = coreTools.filter((tool) => SHELL_TOOL_NAMES.some((name) => tool.startsWith(`${name}(`))).length > 0;
|
|
109
|
-
if (hasSpecificAllowedCommands) {
|
|
110
|
-
for (const cmd of commandsToValidate) {
|
|
111
|
-
invocation.params['command'] = cmd;
|
|
112
|
-
const isGloballyAllowed = doesToolInvocationMatch('run_shell_command', invocation, coreTools);
|
|
113
|
-
if (!isGloballyAllowed) {
|
|
114
|
-
disallowedCommands.push(cmd);
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (disallowedCommands.length > 0) {
|
|
118
|
-
return {
|
|
119
|
-
allAllowed: false,
|
|
120
|
-
disallowedCommands,
|
|
121
|
-
blockReason: `Command(s) not in the allowed commands list. Disallowed commands: ${disallowedCommands
|
|
122
|
-
.map((c) => JSON.stringify(c))
|
|
123
|
-
.join(', ')}`,
|
|
124
|
-
isHardDenial: false,
|
|
125
|
-
};
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
// If no specific global allowlist exists, and it passed the blocklist,
|
|
129
|
-
// the command is allowed by default.
|
|
130
|
-
}
|
|
131
|
-
// If all checks for the current mode pass, the command is allowed.
|
|
132
|
-
return { allAllowed: true, disallowedCommands: [] };
|
|
133
|
-
}
|
|
134
|
-
export function isCommandAllowed(command, config) {
|
|
135
|
-
// By not providing a sessionAllowlist, we invoke "default allow" behavior.
|
|
136
|
-
const { allAllowed, blockReason } = checkCommandPermissions(command, config);
|
|
137
|
-
if (allAllowed) {
|
|
138
|
-
return { allowed: true };
|
|
139
|
-
}
|
|
140
|
-
return { allowed: false, reason: blockReason };
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Determines whether a shell invocation should be auto-approved based on an allowlist.
|
|
144
|
-
*
|
|
145
|
-
* This reuses the same parsing logic as command-permission enforcement so that
|
|
146
|
-
* chained commands must be individually covered by the allowlist.
|
|
147
|
-
*
|
|
148
|
-
* @param invocation The shell tool invocation being evaluated.
|
|
149
|
-
* @param allowedPatterns The configured allowlist patterns (e.g. `run_shell_command(git)`).
|
|
150
|
-
* @returns True if every parsed command segment is allowed by the patterns; false otherwise.
|
|
151
|
-
*/
|
|
152
|
-
export function isShellInvocationAllowlisted(invocation, allowedPatterns) {
|
|
153
|
-
if (!allowedPatterns.length) {
|
|
154
|
-
return false;
|
|
155
|
-
}
|
|
156
|
-
const hasShellWildcard = allowedPatterns.some((pattern) => SHELL_TOOL_NAMES.includes(pattern));
|
|
157
|
-
const hasShellSpecificPattern = allowedPatterns.some((pattern) => SHELL_TOOL_NAMES.some((name) => pattern.startsWith(`${name}(`)));
|
|
158
|
-
if (!hasShellWildcard && !hasShellSpecificPattern) {
|
|
159
|
-
return false;
|
|
160
|
-
}
|
|
161
|
-
if (hasShellWildcard) {
|
|
162
|
-
return true;
|
|
163
|
-
}
|
|
164
|
-
if (!('params' in invocation) ||
|
|
165
|
-
typeof invocation.params !== 'object' ||
|
|
166
|
-
invocation.params === null ||
|
|
167
|
-
!('command' in invocation.params)) {
|
|
168
|
-
return false;
|
|
169
|
-
}
|
|
170
|
-
const commandValue = invocation.params.command;
|
|
171
|
-
if (typeof commandValue !== 'string' || !commandValue.trim()) {
|
|
172
|
-
return false;
|
|
173
|
-
}
|
|
174
|
-
const command = commandValue.trim();
|
|
175
|
-
const parseResult = parseCommandDetails(command);
|
|
176
|
-
if (!parseResult || parseResult.hasError) {
|
|
177
|
-
return false;
|
|
178
|
-
}
|
|
179
|
-
const normalize = (cmd) => cmd.trim().replace(/\s+/g, ' ');
|
|
180
|
-
const commandsToValidate = parseResult.details
|
|
181
|
-
.map((detail) => normalize(detail.text))
|
|
182
|
-
.filter(Boolean);
|
|
183
|
-
if (commandsToValidate.length === 0) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
return commandsToValidate.every((commandSegment) => doesToolInvocationMatch(SHELL_TOOL_NAMES[0], { params: { command: commandSegment } }, allowedPatterns));
|
|
187
|
-
}
|
|
188
|
-
//# sourceMappingURL=shell-permissions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"shell-permissions.js","sourceRoot":"","sources":["../../../src/utils/shell-permissions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAAE,uBAAuB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EACL,mBAAmB,EACnB,gBAAgB,GAEjB,MAAM,kBAAkB,CAAC;AAE1B;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,UAAU,uBAAuB,CACrC,OAAe,EACf,MAAc,EACd,gBAA8B;IAO9B,MAAM,WAAW,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IACjD,IAAI,CAAC,WAAW,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC;QACzC,OAAO;YACL,UAAU,EAAE,KAAK;YACjB,kBAAkB,EAAE,CAAC,OAAO,CAAC;YAC7B,WAAW,EAAE,wDAAwD;YACrE,YAAY,EAAE,IAAI;SACnB,CAAC;IACJ,CAAC;IAED,MAAM,SAAS,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC3E,MAAM,kBAAkB,GAAG,WAAW,CAAC,OAAO;SAC3C,GAAG,CAAC,CAAC,MAA2B,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SAC5D,MAAM,CAAC,OAAO,CAAC,CAAC;IACnB,MAAM,UAAU,GAAwD;QACtE,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE;KAC+B,CAAC;I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