feat(shell): enable interactive commands with virtual terminal (#6694)

This commit is contained in:
Gal Zahavi
2025-09-11 13:27:27 -07:00
committed by GitHub
parent 8969a232ec
commit 181898cb5d
43 changed files with 2345 additions and 324 deletions
+13 -3
View File
@@ -25,6 +25,7 @@ import type {
ToolCallConfirmationDetails,
Config,
UserTierId,
AnsiOutput,
} from '@google/gemini-cli-core';
import type { RequestContext } from '@a2a-js/sdk/server';
import { type ExecutionEventBus } from '@a2a-js/sdk/server';
@@ -284,20 +285,29 @@ export class Task {
private _schedulerOutputUpdate(
toolCallId: string,
outputChunk: string,
outputChunk: string | AnsiOutput,
): void {
let outputAsText: string;
if (typeof outputChunk === 'string') {
outputAsText = outputChunk;
} else {
outputAsText = outputChunk
.map((line) => line.map((token) => token.text).join(''))
.join('\n');
}
logger.info(
'[Task] Scheduler output update for tool call ' +
toolCallId +
': ' +
outputChunk,
outputAsText,
);
const artifact: Artifact = {
artifactId: `tool-${toolCallId}-output`,
parts: [
{
kind: 'text',
text: outputChunk,
text: outputAsText,
} as Part,
],
};
+2
View File
@@ -64,6 +64,7 @@ vi.mock('../utils/logger.js', () => ({
let config: Config;
const getToolRegistrySpy = vi.fn().mockReturnValue(ApprovalMode.DEFAULT);
const getApprovalModeSpy = vi.fn();
const getShellExecutionConfigSpy = vi.fn();
vi.mock('../config/config.js', async () => {
const actual = await vi.importActual('../config/config.js');
return {
@@ -72,6 +73,7 @@ vi.mock('../config/config.js', async () => {
const mockConfig = createMockConfig({
getToolRegistry: getToolRegistrySpy,
getApprovalMode: getApprovalModeSpy,
getShellExecutionConfig: getShellExecutionConfigSpy,
});
config = mockConfig as Config;
return config;