@google/gemini-cli 0.1.14 → 0.1.15
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/google-gemini-cli-0.1.13.tgz +0 -0
- package/dist/package.json +2 -2
- package/dist/src/config/settings.d.ts +1 -0
- package/dist/src/config/settings.js.map +1 -1
- package/dist/src/gemini.d.ts +1 -0
- package/dist/src/gemini.js +21 -14
- package/dist/src/gemini.js.map +1 -1
- package/dist/src/generated/git-commit.d.ts +1 -1
- package/dist/src/generated/git-commit.js +1 -1
- package/dist/src/services/BuiltinCommandLoader.js +3 -1
- package/dist/src/services/BuiltinCommandLoader.js.map +1 -1
- package/dist/src/services/FileCommandLoader.js +31 -8
- package/dist/src/services/FileCommandLoader.js.map +1 -1
- package/dist/src/services/McpPromptLoader.d.ts +25 -0
- package/dist/src/services/McpPromptLoader.js +192 -0
- package/dist/src/services/McpPromptLoader.js.map +1 -0
- package/dist/src/services/prompt-processors/shellProcessor.d.ts +32 -0
- package/dist/src/services/prompt-processors/shellProcessor.js +77 -0
- package/dist/src/services/prompt-processors/shellProcessor.js.map +1 -0
- package/dist/src/services/prompt-processors/types.d.ts +4 -0
- package/dist/src/services/prompt-processors/types.js +4 -0
- package/dist/src/services/prompt-processors/types.js.map +1 -1
- package/dist/src/ui/App.js +70 -35
- package/dist/src/ui/App.js.map +1 -1
- package/dist/src/ui/commands/mcpCommand.js +53 -8
- package/dist/src/ui/commands/mcpCommand.js.map +1 -1
- package/dist/src/ui/commands/types.d.ts +19 -2
- package/dist/src/ui/commands/types.js +1 -0
- package/dist/src/ui/commands/types.js.map +1 -1
- package/dist/src/ui/commands/vimCommand.d.ts +7 -0
- package/dist/src/ui/commands/vimCommand.js +23 -0
- package/dist/src/ui/commands/vimCommand.js.map +1 -0
- package/dist/src/ui/components/Footer.d.ts +1 -0
- package/dist/src/ui/components/Footer.js +2 -2
- package/dist/src/ui/components/Footer.js.map +1 -1
- package/dist/src/ui/components/Header.js +1 -1
- package/dist/src/ui/components/Header.js.map +1 -1
- package/dist/src/ui/components/InputPrompt.d.ts +2 -0
- package/dist/src/ui/components/InputPrompt.js +5 -1
- package/dist/src/ui/components/InputPrompt.js.map +1 -1
- package/dist/src/ui/components/ShellConfirmationDialog.d.ts +15 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js +44 -0
- package/dist/src/ui/components/ShellConfirmationDialog.js.map +1 -0
- package/dist/src/ui/components/Tips.js +1 -1
- package/dist/src/ui/components/Tips.js.map +1 -1
- package/dist/src/ui/components/shared/text-buffer.d.ts +270 -2
- package/dist/src/ui/components/shared/text-buffer.js +415 -70
- package/dist/src/ui/components/shared/text-buffer.js.map +1 -1
- package/dist/src/ui/components/shared/vim-buffer-actions.d.ts +72 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js +565 -0
- package/dist/src/ui/components/shared/vim-buffer-actions.js.map +1 -0
- package/dist/src/ui/contexts/VimModeContext.d.ts +19 -0
- package/dist/src/ui/contexts/VimModeContext.js +48 -0
- package/dist/src/ui/contexts/VimModeContext.js.map +1 -0
- package/dist/src/ui/hooks/shellCommandProcessor.d.ts +1 -0
- package/dist/src/ui/hooks/shellCommandProcessor.js +139 -200
- package/dist/src/ui/hooks/shellCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/slashCommandProcessor.d.ts +7 -3
- package/dist/src/ui/hooks/slashCommandProcessor.js +187 -126
- package/dist/src/ui/hooks/slashCommandProcessor.js.map +1 -1
- package/dist/src/ui/hooks/useCompletion.js +7 -2
- package/dist/src/ui/hooks/useCompletion.js.map +1 -1
- package/dist/src/ui/hooks/useConsoleMessages.js +53 -37
- package/dist/src/ui/hooks/useConsoleMessages.js.map +1 -1
- package/dist/src/ui/hooks/useKeypress.js +5 -2
- package/dist/src/ui/hooks/useKeypress.js.map +1 -1
- package/dist/src/ui/hooks/vim.d.ts +28 -0
- package/dist/src/ui/hooks/vim.js +630 -0
- package/dist/src/ui/hooks/vim.js.map +1 -0
- package/dist/src/ui/themes/theme-manager.js +10 -1
- package/dist/src/ui/themes/theme-manager.js.map +1 -1
- package/dist/src/ui/themes/theme.d.ts +1 -0
- package/dist/src/ui/themes/theme.js +19 -4
- package/dist/src/ui/themes/theme.js.map +1 -1
- package/dist/src/ui/utils/textUtils.d.ts +0 -8
- package/dist/src/ui/utils/textUtils.js +0 -22
- package/dist/src/ui/utils/textUtils.js.map +1 -1
- package/dist/src/utils/events.d.ts +11 -0
- package/dist/src/utils/events.js +13 -0
- package/dist/src/utils/events.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VimModeContext.js","sourceRoot":"","sources":["../../../../src/ui/contexts/VimModeContext.tsx"],"names":[],"mappings":";AAAA;;;;GAIG;AAEH,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,SAAS,EACT,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAkB,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAWxE,MAAM,cAAc,GAAG,aAAa,CAAiC,SAAS,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAC9B,QAAQ,EACR,QAAQ,GAIT,EAAE,EAAE;IACH,MAAM,iBAAiB,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;IAC3D,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,iBAAiB,CAAC,CAAC;IAChE,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CACpC,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,QAAQ,CACxC,CAAC;IAEF,SAAS,CAAC,GAAG,EAAE;QACb,+CAA+C;QAC/C,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,IAAI,KAAK,CAAC;QACjD,aAAa,CAAC,OAAO,CAAC,CAAC;QACvB,wDAAwD;QACxD,IAAI,OAAO,EAAE,CAAC;YACZ,UAAU,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC;IACH,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC;IAE9B,MAAM,gBAAgB,GAAG,WAAW,CAAC,KAAK,IAAI,EAAE;QAC9C,MAAM,QAAQ,GAAG,CAAC,UAAU,CAAC;QAC7B,aAAa,CAAC,QAAQ,CAAC,CAAC;QACxB,+CAA+C;QAC/C,IAAI,QAAQ,EAAE,CAAC;YACb,UAAU,CAAC,QAAQ,CAAC,CAAC;QACvB,CAAC;QACD,MAAM,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QAChE,OAAO,QAAQ,CAAC;IAClB,CAAC,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,CAAC;IAE3B,MAAM,KAAK,GAAG;QACZ,UAAU;QACV,OAAO;QACP,gBAAgB;QAChB,UAAU;KACX,CAAC;IAEF,OAAO,CACL,KAAC,cAAc,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAA2B,CAC5E,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG,GAAG,EAAE;IAC7B,MAAM,OAAO,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;IAC3C,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC"}
|
|
@@ -7,6 +7,7 @@ import { HistoryItemWithoutId } from '../types.js';
|
|
|
7
7
|
import { Config, GeminiClient } from '@google/gemini-cli-core';
|
|
8
8
|
import { type PartListUnion } from '@google/genai';
|
|
9
9
|
import { UseHistoryManagerReturn } from './useHistoryManager.js';
|
|
10
|
+
export declare const OUTPUT_UPDATE_INTERVAL_MS = 1000;
|
|
10
11
|
/**
|
|
11
12
|
* Hook to process shell commands.
|
|
12
13
|
* Orchestrates command execution and updates history and agent context.
|
|
@@ -3,148 +3,17 @@
|
|
|
3
3
|
* Copyright 2025 Google LLC
|
|
4
4
|
* SPDX-License-Identifier: Apache-2.0
|
|
5
5
|
*/
|
|
6
|
-
import { spawn } from 'child_process';
|
|
7
|
-
import { TextDecoder } from 'util';
|
|
8
6
|
import { ToolCallStatus, } from '../types.js';
|
|
9
7
|
import { useCallback } from 'react';
|
|
10
|
-
import {
|
|
11
|
-
import { formatMemoryUsage } from '../utils/formatters.js';
|
|
12
|
-
import { isBinary } from '../utils/textUtils.js';
|
|
8
|
+
import { isBinary, ShellExecutionService, } from '@google/gemini-cli-core';
|
|
13
9
|
import { SHELL_COMMAND_NAME } from '../constants.js';
|
|
10
|
+
import { formatMemoryUsage } from '../utils/formatters.js';
|
|
14
11
|
import crypto from 'crypto';
|
|
15
12
|
import path from 'path';
|
|
16
13
|
import os from 'os';
|
|
17
14
|
import fs from 'fs';
|
|
18
|
-
|
|
19
|
-
const OUTPUT_UPDATE_INTERVAL_MS = 1000;
|
|
15
|
+
export const OUTPUT_UPDATE_INTERVAL_MS = 1000;
|
|
20
16
|
const MAX_OUTPUT_LENGTH = 10000;
|
|
21
|
-
/**
|
|
22
|
-
* Executes a shell command using `spawn`, capturing all output and lifecycle events.
|
|
23
|
-
* This is the single, unified implementation for shell execution.
|
|
24
|
-
*
|
|
25
|
-
* @param commandToExecute The exact command string to run.
|
|
26
|
-
* @param cwd The working directory to execute the command in.
|
|
27
|
-
* @param abortSignal An AbortSignal to terminate the process.
|
|
28
|
-
* @param onOutputChunk A callback for streaming real-time output.
|
|
29
|
-
* @param onDebugMessage A callback for logging debug information.
|
|
30
|
-
* @returns A promise that resolves with the complete execution result.
|
|
31
|
-
*/
|
|
32
|
-
function executeShellCommand(commandToExecute, cwd, abortSignal, onOutputChunk, onDebugMessage) {
|
|
33
|
-
return new Promise((resolve) => {
|
|
34
|
-
const isWindows = os.platform() === 'win32';
|
|
35
|
-
const shell = isWindows ? 'cmd.exe' : 'bash';
|
|
36
|
-
const shellArgs = isWindows
|
|
37
|
-
? ['/c', commandToExecute]
|
|
38
|
-
: ['-c', commandToExecute];
|
|
39
|
-
const child = spawn(shell, shellArgs, {
|
|
40
|
-
cwd,
|
|
41
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
42
|
-
detached: !isWindows, // Use process groups on non-Windows for robust killing
|
|
43
|
-
env: {
|
|
44
|
-
...process.env,
|
|
45
|
-
GEMINI_CLI: '1',
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
// Use decoders to handle multi-byte characters safely (for streaming output).
|
|
49
|
-
let stdoutDecoder = null;
|
|
50
|
-
let stderrDecoder = null;
|
|
51
|
-
let stdout = '';
|
|
52
|
-
let stderr = '';
|
|
53
|
-
const outputChunks = [];
|
|
54
|
-
let error = null;
|
|
55
|
-
let exited = false;
|
|
56
|
-
let streamToUi = true;
|
|
57
|
-
const MAX_SNIFF_SIZE = 4096;
|
|
58
|
-
let sniffedBytes = 0;
|
|
59
|
-
const handleOutput = (data, stream) => {
|
|
60
|
-
if (!stdoutDecoder || !stderrDecoder) {
|
|
61
|
-
const encoding = getCachedEncodingForBuffer(data);
|
|
62
|
-
stdoutDecoder = new TextDecoder(encoding);
|
|
63
|
-
stderrDecoder = new TextDecoder(encoding);
|
|
64
|
-
}
|
|
65
|
-
outputChunks.push(data);
|
|
66
|
-
if (streamToUi && sniffedBytes < MAX_SNIFF_SIZE) {
|
|
67
|
-
// Use a limited-size buffer for the check to avoid performance issues.
|
|
68
|
-
const sniffBuffer = Buffer.concat(outputChunks.slice(0, 20));
|
|
69
|
-
sniffedBytes = sniffBuffer.length;
|
|
70
|
-
if (isBinary(sniffBuffer)) {
|
|
71
|
-
streamToUi = false;
|
|
72
|
-
// Overwrite any garbled text that may have streamed with a clear message.
|
|
73
|
-
onOutputChunk('[Binary output detected. Halting stream...]');
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
const decodedChunk = stream === 'stdout'
|
|
77
|
-
? stdoutDecoder.decode(data, { stream: true })
|
|
78
|
-
: stderrDecoder.decode(data, { stream: true });
|
|
79
|
-
if (stream === 'stdout') {
|
|
80
|
-
stdout += stripAnsi(decodedChunk);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
stderr += stripAnsi(decodedChunk);
|
|
84
|
-
}
|
|
85
|
-
if (!exited && streamToUi) {
|
|
86
|
-
// Send only the new chunk to avoid re-rendering the whole output.
|
|
87
|
-
const combinedOutput = stdout + (stderr ? `\n${stderr}` : '');
|
|
88
|
-
onOutputChunk(combinedOutput);
|
|
89
|
-
}
|
|
90
|
-
else if (!exited && !streamToUi) {
|
|
91
|
-
// Send progress updates for the binary stream
|
|
92
|
-
const totalBytes = outputChunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
93
|
-
onOutputChunk(`[Receiving binary output... ${formatMemoryUsage(totalBytes)} received]`);
|
|
94
|
-
}
|
|
95
|
-
};
|
|
96
|
-
child.stdout.on('data', (data) => handleOutput(data, 'stdout'));
|
|
97
|
-
child.stderr.on('data', (data) => handleOutput(data, 'stderr'));
|
|
98
|
-
child.on('error', (err) => {
|
|
99
|
-
error = err;
|
|
100
|
-
});
|
|
101
|
-
const abortHandler = async () => {
|
|
102
|
-
if (child.pid && !exited) {
|
|
103
|
-
onDebugMessage(`Aborting shell command (PID: ${child.pid})`);
|
|
104
|
-
if (isWindows) {
|
|
105
|
-
spawn('taskkill', ['/pid', child.pid.toString(), '/f', '/t']);
|
|
106
|
-
}
|
|
107
|
-
else {
|
|
108
|
-
try {
|
|
109
|
-
// Kill the entire process group (negative PID).
|
|
110
|
-
// SIGTERM first, then SIGKILL if it doesn't die.
|
|
111
|
-
process.kill(-child.pid, 'SIGTERM');
|
|
112
|
-
await new Promise((res) => setTimeout(res, 200));
|
|
113
|
-
if (!exited) {
|
|
114
|
-
process.kill(-child.pid, 'SIGKILL');
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
catch (_e) {
|
|
118
|
-
// Fall back to killing just the main process if group kill fails.
|
|
119
|
-
if (!exited)
|
|
120
|
-
child.kill('SIGKILL');
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
abortSignal.addEventListener('abort', abortHandler, { once: true });
|
|
126
|
-
child.on('exit', (code, signal) => {
|
|
127
|
-
exited = true;
|
|
128
|
-
abortSignal.removeEventListener('abort', abortHandler);
|
|
129
|
-
// Handle any final bytes lingering in the decoders
|
|
130
|
-
if (stdoutDecoder) {
|
|
131
|
-
stdout += stdoutDecoder.decode();
|
|
132
|
-
}
|
|
133
|
-
if (stderrDecoder) {
|
|
134
|
-
stderr += stderrDecoder.decode();
|
|
135
|
-
}
|
|
136
|
-
const finalBuffer = Buffer.concat(outputChunks);
|
|
137
|
-
resolve({
|
|
138
|
-
rawOutput: finalBuffer,
|
|
139
|
-
output: stdout + (stderr ? `\n${stderr}` : ''),
|
|
140
|
-
exitCode: code,
|
|
141
|
-
signal,
|
|
142
|
-
error,
|
|
143
|
-
aborted: abortSignal.aborted,
|
|
144
|
-
});
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
17
|
function addShellCommandToGeminiHistory(geminiClient, rawQuery, resultText) {
|
|
149
18
|
const modelContent = resultText.length > MAX_OUTPUT_LENGTH
|
|
150
19
|
? resultText.substring(0, MAX_OUTPUT_LENGTH) + '\n... (truncated)'
|
|
@@ -194,7 +63,11 @@ export const useShellCommandProcessor = (addItemToHistory, setPendingHistoryItem
|
|
|
194
63
|
commandToExecute = `{ ${command} }; __code=$?; pwd > "${pwdFilePath}"; exit $__code`;
|
|
195
64
|
}
|
|
196
65
|
const execPromise = new Promise((resolve) => {
|
|
197
|
-
let lastUpdateTime =
|
|
66
|
+
let lastUpdateTime = Date.now();
|
|
67
|
+
let cumulativeStdout = '';
|
|
68
|
+
let cumulativeStderr = '';
|
|
69
|
+
let isBinaryStream = false;
|
|
70
|
+
let binaryBytesReceived = 0;
|
|
198
71
|
const initialToolDisplay = {
|
|
199
72
|
callId,
|
|
200
73
|
name: SHELL_COMMAND_NAME,
|
|
@@ -207,85 +80,151 @@ export const useShellCommandProcessor = (addItemToHistory, setPendingHistoryItem
|
|
|
207
80
|
type: 'tool_group',
|
|
208
81
|
tools: [initialToolDisplay],
|
|
209
82
|
});
|
|
83
|
+
let executionPid;
|
|
84
|
+
const abortHandler = () => {
|
|
85
|
+
onDebugMessage(`Aborting shell command (PID: ${executionPid ?? 'unknown'})`);
|
|
86
|
+
};
|
|
87
|
+
abortSignal.addEventListener('abort', abortHandler, { once: true });
|
|
210
88
|
onDebugMessage(`Executing in ${targetDir}: ${commandToExecute}`);
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
89
|
+
try {
|
|
90
|
+
const { pid, result } = ShellExecutionService.execute(commandToExecute, targetDir, (event) => {
|
|
91
|
+
switch (event.type) {
|
|
92
|
+
case 'data':
|
|
93
|
+
// Do not process text data if we've already switched to binary mode.
|
|
94
|
+
if (isBinaryStream)
|
|
95
|
+
break;
|
|
96
|
+
if (event.stream === 'stdout') {
|
|
97
|
+
cumulativeStdout += event.chunk;
|
|
98
|
+
}
|
|
99
|
+
else {
|
|
100
|
+
cumulativeStderr += event.chunk;
|
|
101
|
+
}
|
|
102
|
+
break;
|
|
103
|
+
case 'binary_detected':
|
|
104
|
+
isBinaryStream = true;
|
|
105
|
+
break;
|
|
106
|
+
case 'binary_progress':
|
|
107
|
+
isBinaryStream = true;
|
|
108
|
+
binaryBytesReceived = event.bytesReceived;
|
|
109
|
+
break;
|
|
110
|
+
default: {
|
|
111
|
+
throw new Error('An unhandled ShellOutputEvent was found.');
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
// Compute the display string based on the *current* state.
|
|
115
|
+
let currentDisplayOutput;
|
|
116
|
+
if (isBinaryStream) {
|
|
117
|
+
if (binaryBytesReceived > 0) {
|
|
118
|
+
currentDisplayOutput = `[Receiving binary output... ${formatMemoryUsage(binaryBytesReceived)} received]`;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
currentDisplayOutput =
|
|
122
|
+
'[Binary output detected. Halting stream...]';
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
else {
|
|
126
|
+
currentDisplayOutput =
|
|
127
|
+
cumulativeStdout +
|
|
128
|
+
(cumulativeStderr ? `\n${cumulativeStderr}` : '');
|
|
129
|
+
}
|
|
130
|
+
// Throttle pending UI updates to avoid excessive re-renders.
|
|
131
|
+
if (Date.now() - lastUpdateTime > OUTPUT_UPDATE_INTERVAL_MS) {
|
|
132
|
+
setPendingHistoryItem({
|
|
133
|
+
type: 'tool_group',
|
|
134
|
+
tools: [
|
|
135
|
+
{
|
|
136
|
+
...initialToolDisplay,
|
|
137
|
+
resultDisplay: currentDisplayOutput,
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
});
|
|
141
|
+
lastUpdateTime = Date.now();
|
|
142
|
+
}
|
|
143
|
+
}, abortSignal);
|
|
144
|
+
executionPid = pid;
|
|
145
|
+
result
|
|
146
|
+
.then((result) => {
|
|
147
|
+
setPendingHistoryItem(null);
|
|
148
|
+
let mainContent;
|
|
149
|
+
if (isBinary(result.rawOutput)) {
|
|
150
|
+
mainContent =
|
|
151
|
+
'[Command produced binary output, which is not shown.]';
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
mainContent =
|
|
155
|
+
result.output.trim() || '(Command produced no output)';
|
|
156
|
+
}
|
|
157
|
+
let finalOutput = mainContent;
|
|
158
|
+
let finalStatus = ToolCallStatus.Success;
|
|
159
|
+
if (result.error) {
|
|
160
|
+
finalStatus = ToolCallStatus.Error;
|
|
161
|
+
finalOutput = `${result.error.message}\n${finalOutput}`;
|
|
162
|
+
}
|
|
163
|
+
else if (result.aborted) {
|
|
164
|
+
finalStatus = ToolCallStatus.Canceled;
|
|
165
|
+
finalOutput = `Command was cancelled.\n${finalOutput}`;
|
|
166
|
+
}
|
|
167
|
+
else if (result.signal) {
|
|
168
|
+
finalStatus = ToolCallStatus.Error;
|
|
169
|
+
finalOutput = `Command terminated by signal: ${result.signal}.\n${finalOutput}`;
|
|
170
|
+
}
|
|
171
|
+
else if (result.exitCode !== 0) {
|
|
172
|
+
finalStatus = ToolCallStatus.Error;
|
|
173
|
+
finalOutput = `Command exited with code ${result.exitCode}.\n${finalOutput}`;
|
|
174
|
+
}
|
|
175
|
+
if (pwdFilePath && fs.existsSync(pwdFilePath)) {
|
|
176
|
+
const finalPwd = fs.readFileSync(pwdFilePath, 'utf8').trim();
|
|
177
|
+
if (finalPwd && finalPwd !== targetDir) {
|
|
178
|
+
const warning = `WARNING: shell mode is stateless; the directory change to '${finalPwd}' will not persist.`;
|
|
179
|
+
finalOutput = `${warning}\n\n${finalOutput}`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
const finalToolDisplay = {
|
|
183
|
+
...initialToolDisplay,
|
|
184
|
+
status: finalStatus,
|
|
185
|
+
resultDisplay: finalOutput,
|
|
186
|
+
};
|
|
187
|
+
// Add the complete, contextual result to the local UI history.
|
|
188
|
+
addItemToHistory({
|
|
215
189
|
type: 'tool_group',
|
|
216
|
-
tools: [
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
let finalOutput = mainContent;
|
|
235
|
-
let finalStatus = ToolCallStatus.Success;
|
|
236
|
-
if (result.error) {
|
|
237
|
-
finalStatus = ToolCallStatus.Error;
|
|
238
|
-
finalOutput = `${result.error.message}\n${finalOutput}`;
|
|
239
|
-
}
|
|
240
|
-
else if (result.aborted) {
|
|
241
|
-
finalStatus = ToolCallStatus.Canceled;
|
|
242
|
-
finalOutput = `Command was cancelled.\n${finalOutput}`;
|
|
243
|
-
}
|
|
244
|
-
else if (result.signal) {
|
|
245
|
-
finalStatus = ToolCallStatus.Error;
|
|
246
|
-
finalOutput = `Command terminated by signal: ${result.signal}.\n${finalOutput}`;
|
|
247
|
-
}
|
|
248
|
-
else if (result.exitCode !== 0) {
|
|
249
|
-
finalStatus = ToolCallStatus.Error;
|
|
250
|
-
finalOutput = `Command exited with code ${result.exitCode}.\n${finalOutput}`;
|
|
251
|
-
}
|
|
252
|
-
if (pwdFilePath && fs.existsSync(pwdFilePath)) {
|
|
253
|
-
const finalPwd = fs.readFileSync(pwdFilePath, 'utf8').trim();
|
|
254
|
-
if (finalPwd && finalPwd !== targetDir) {
|
|
255
|
-
const warning = `WARNING: shell mode is stateless; the directory change to '${finalPwd}' will not persist.`;
|
|
256
|
-
finalOutput = `${warning}\n\n${finalOutput}`;
|
|
190
|
+
tools: [finalToolDisplay],
|
|
191
|
+
}, userMessageTimestamp);
|
|
192
|
+
// Add the same complete, contextual result to the LLM's history.
|
|
193
|
+
addShellCommandToGeminiHistory(geminiClient, rawQuery, finalOutput);
|
|
194
|
+
})
|
|
195
|
+
.catch((err) => {
|
|
196
|
+
setPendingHistoryItem(null);
|
|
197
|
+
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
198
|
+
addItemToHistory({
|
|
199
|
+
type: 'error',
|
|
200
|
+
text: `An unexpected error occurred: ${errorMessage}`,
|
|
201
|
+
}, userMessageTimestamp);
|
|
202
|
+
})
|
|
203
|
+
.finally(() => {
|
|
204
|
+
abortSignal.removeEventListener('abort', abortHandler);
|
|
205
|
+
if (pwdFilePath && fs.existsSync(pwdFilePath)) {
|
|
206
|
+
fs.unlinkSync(pwdFilePath);
|
|
257
207
|
}
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
};
|
|
264
|
-
// Add the complete, contextual result to the local UI history.
|
|
265
|
-
addItemToHistory({
|
|
266
|
-
type: 'tool_group',
|
|
267
|
-
tools: [finalToolDisplay],
|
|
268
|
-
}, userMessageTimestamp);
|
|
269
|
-
// Add the same complete, contextual result to the LLM's history.
|
|
270
|
-
addShellCommandToGeminiHistory(geminiClient, rawQuery, finalOutput);
|
|
271
|
-
})
|
|
272
|
-
.catch((err) => {
|
|
208
|
+
resolve();
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
catch (err) {
|
|
212
|
+
// This block handles synchronous errors from `execute`
|
|
273
213
|
setPendingHistoryItem(null);
|
|
274
214
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
275
215
|
addItemToHistory({
|
|
276
216
|
type: 'error',
|
|
277
217
|
text: `An unexpected error occurred: ${errorMessage}`,
|
|
278
218
|
}, userMessageTimestamp);
|
|
279
|
-
|
|
280
|
-
.finally(() => {
|
|
219
|
+
// Perform cleanup here as well
|
|
281
220
|
if (pwdFilePath && fs.existsSync(pwdFilePath)) {
|
|
282
221
|
fs.unlinkSync(pwdFilePath);
|
|
283
222
|
}
|
|
284
|
-
resolve();
|
|
285
|
-
}
|
|
223
|
+
resolve(); // Resolve the promise to unblock `onExec`
|
|
224
|
+
}
|
|
286
225
|
});
|
|
287
226
|
onExec(execPromise);
|
|
288
|
-
return true;
|
|
227
|
+
return true;
|
|
289
228
|
}, [
|
|
290
229
|
config,
|
|
291
230
|
onDebugMessage,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shellCommandProcessor.js","sourceRoot":"","sources":["../../../../src/ui/hooks/shellCommandProcessor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"shellCommandProcessor.js","sourceRoot":"","sources":["../../../../src/ui/hooks/shellCommandProcessor.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAGL,cAAc,GACf,MAAM,aAAa,CAAC;AACrB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+B;gBAC/B,IAAI,WAAW,IAAI,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;oBAC9C,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;gBAC7B,CAAC;gBAED,OAAO,EAAE,CAAC,CAAC,0CAA0C;YACvD,CAAC;QACH,CAAC,CAAC,CAAC;QAEH,MAAM,CAAC,WAAW,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC,EACD;QACE,MAAM;QACN,cAAc;QACd,gBAAgB;QAChB,qBAAqB;QACrB,MAAM;QACN,YAAY;KACb,CACF,CAAC;IAEF,OAAO,EAAE,kBAAkB,EAAE,CAAC;AAChC,CAAC,CAAC"}
|
|
@@ -5,16 +5,20 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { type PartListUnion } from '@google/genai';
|
|
7
7
|
import { UseHistoryManagerReturn } from './useHistoryManager.js';
|
|
8
|
-
import { Config } from '@google/gemini-cli-core';
|
|
8
|
+
import { Config, ToolConfirmationOutcome } from '@google/gemini-cli-core';
|
|
9
9
|
import { HistoryItemWithoutId, HistoryItem, SlashCommandProcessorResult } from '../types.js';
|
|
10
10
|
import { LoadedSettings } from '../../config/settings.js';
|
|
11
11
|
import { type CommandContext, type SlashCommand } from '../commands/types.js';
|
|
12
12
|
/**
|
|
13
13
|
* Hook to define and process slash commands (e.g., /help, /clear).
|
|
14
14
|
*/
|
|
15
|
-
export declare const useSlashCommandProcessor: (config: Config | null, settings: LoadedSettings, addItem: UseHistoryManagerReturn["addItem"], clearItems: UseHistoryManagerReturn["clearItems"], loadHistory: UseHistoryManagerReturn["loadHistory"], refreshStatic: () => void, setShowHelp: React.Dispatch<React.SetStateAction<boolean>>, onDebugMessage: (message: string) => void, openThemeDialog: () => void, openAuthDialog: () => void, openEditorDialog: () => void, toggleCorgiMode: () => void, setQuittingMessages: (message: HistoryItem[]) => void, openPrivacyNotice: () => void) => {
|
|
16
|
-
handleSlashCommand: (rawQuery: PartListUnion) => Promise<SlashCommandProcessorResult | false>;
|
|
15
|
+
export declare const useSlashCommandProcessor: (config: Config | null, settings: LoadedSettings, addItem: UseHistoryManagerReturn["addItem"], clearItems: UseHistoryManagerReturn["clearItems"], loadHistory: UseHistoryManagerReturn["loadHistory"], refreshStatic: () => void, setShowHelp: React.Dispatch<React.SetStateAction<boolean>>, onDebugMessage: (message: string) => void, openThemeDialog: () => void, openAuthDialog: () => void, openEditorDialog: () => void, toggleCorgiMode: () => void, setQuittingMessages: (message: HistoryItem[]) => void, openPrivacyNotice: () => void, toggleVimEnabled: () => Promise<boolean>, setIsProcessing: (isProcessing: boolean) => void) => {
|
|
16
|
+
handleSlashCommand: (rawQuery: PartListUnion, oneTimeShellAllowlist?: Set<string>) => Promise<SlashCommandProcessorResult | false>;
|
|
17
17
|
slashCommands: readonly SlashCommand[];
|
|
18
18
|
pendingHistoryItems: HistoryItemWithoutId[];
|
|
19
19
|
commandContext: CommandContext;
|
|
20
|
+
shellConfirmationRequest: {
|
|
21
|
+
commands: string[];
|
|
22
|
+
onConfirm: (outcome: ToolConfirmationOutcome, approvedCommands?: string[]) => void;
|
|
23
|
+
} | null;
|
|
20
24
|
};
|