feat: add option to disable streaming in CLI

This commit is contained in:
Hadi Minooei
2026-04-20 12:24:04 -07:00
parent 1c963345a4
commit d6a1864961
4 changed files with 31 additions and 1 deletions
+7
View File
@@ -626,6 +626,7 @@ export interface ConfigParameters {
bugCommand?: BugCommandSettings;
model: string;
disableLoopDetection?: boolean;
disableStreaming?: boolean;
maxSessionTurns?: number;
acpMode?: boolean;
listSessions?: boolean;
@@ -962,6 +963,7 @@ export class Config implements McpContext, AgentLoopContext {
private approvedPlanPath: string | undefined;
private readonly simulateUser: boolean;
private readonly knowledgeSource?: string;
private readonly disableStreaming: boolean;
constructor(params: ConfigParameters) {
this._sessionId = params.sessionId;
@@ -1284,6 +1286,7 @@ export class Config implements McpContext, AgentLoopContext {
this.enableConseca = params.enableConseca ?? false;
this.simulateUser = params.simulateUser ?? false;
this.knowledgeSource = params.knowledgeSource;
this.disableStreaming = params.disableStreaming ?? false;
// Initialize Safety Infrastructure
const contextBuilder = new ContextBuilder(this);
@@ -2880,6 +2883,10 @@ export class Config implements McpContext, AgentLoopContext {
return this.simulateUser;
}
getDisableStreaming(): boolean {
return this.disableStreaming;
}
getKnowledgeSource(): string | undefined {
return this.knowledgeSource;
}
+17
View File
@@ -656,6 +656,23 @@ export class GeminiChat {
lastConfig = config;
lastContentsToUse = contentsToUse;
if (this.context.config.getDisableStreaming()) {
const response = await this.context.config
.getContentGenerator()
.generateContent(
{
model: modelToUse,
contents: contentsToUse,
config,
},
prompt_id,
role,
);
return (async function* () {
yield response;
})();
}
return this.context.config.getContentGenerator().generateContentStream(
{
model: modelToUse,