fix: properly use systemMessage for hooks in UI (#16250)

This commit is contained in:
Jack Wotherspoon
2026-01-09 15:47:14 -05:00
committed by GitHub
parent 9d187e041c
commit c7d17dda49
6 changed files with 88 additions and 19 deletions
+6 -2
View File
@@ -68,11 +68,11 @@ const MAX_TURNS = 100;
type BeforeAgentHookReturn =
| {
type: GeminiEventType.AgentExecutionStopped;
value: { reason: string };
value: { reason: string; systemMessage?: string };
}
| {
type: GeminiEventType.AgentExecutionBlocked;
value: { reason: string };
value: { reason: string; systemMessage?: string };
}
| { additionalContext: string | undefined }
| undefined;
@@ -146,6 +146,7 @@ export class GeminiClient {
type: GeminiEventType.AgentExecutionStopped,
value: {
reason: hookOutput.getEffectiveReason(),
systemMessage: hookOutput.systemMessage,
},
};
}
@@ -155,6 +156,7 @@ export class GeminiClient {
type: GeminiEventType.AgentExecutionBlocked,
value: {
reason: hookOutput.getEffectiveReason(),
systemMessage: hookOutput.systemMessage,
},
};
}
@@ -811,6 +813,7 @@ export class GeminiClient {
type: GeminiEventType.AgentExecutionStopped,
value: {
reason: hookOutput.getEffectiveReason(),
systemMessage: hookOutput.systemMessage,
},
};
return turn;
@@ -822,6 +825,7 @@ export class GeminiClient {
type: GeminiEventType.AgentExecutionBlocked,
value: {
reason: continueReason,
systemMessage: hookOutput.systemMessage,
},
};
const continueRequest = [{ text: continueReason }];
+2
View File
@@ -78,6 +78,7 @@ export type ServerGeminiAgentExecutionStoppedEvent = {
type: GeminiEventType.AgentExecutionStopped;
value: {
reason: string;
systemMessage?: string;
};
};
@@ -85,6 +86,7 @@ export type ServerGeminiAgentExecutionBlockedEvent = {
type: GeminiEventType.AgentExecutionBlocked;
value: {
reason: string;
systemMessage?: string;
};
};