mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-16 23:02:51 -07:00
fix(cli): address CI build and lint failures by using stable geminiClient reference
This commit is contained in:
@@ -77,7 +77,9 @@ export const compressCommand: SlashCommand = {
|
||||
beforePercentage,
|
||||
afterPercentage,
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
compressionStatus: Number(compressed.compressionStatus) as unknown as CompressionStatus,
|
||||
compressionStatus: Number(
|
||||
compressed.compressionStatus,
|
||||
) as unknown as CompressionStatus,
|
||||
isManual: true,
|
||||
thresholdPercentage: Math.round(threshold * 100),
|
||||
},
|
||||
|
||||
@@ -1521,9 +1521,11 @@ describe('useGeminiStream', () => {
|
||||
it('should disable loop detection and show message when user selects "disable"', async () => {
|
||||
const client = new MockedGeminiClientClass(mockConfig);
|
||||
const disableForSessionSpy = vi.fn();
|
||||
(client as unknown as any).getLoopDetectionService = vi.fn().mockReturnValue({
|
||||
disableForSession: disableForSessionSpy,
|
||||
});
|
||||
(client as unknown as any).getLoopDetectionService = vi
|
||||
.fn()
|
||||
.mockReturnValue({
|
||||
disableForSession: disableForSessionSpy,
|
||||
});
|
||||
|
||||
const { result } = await renderTestHook([], client);
|
||||
|
||||
@@ -1744,7 +1746,9 @@ describe('useGeminiStream', () => {
|
||||
expect(mockAddItem).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: MessageType.INFO,
|
||||
text: expect.stringContaining('Agent execution stopped: Task completed'),
|
||||
text: expect.stringContaining(
|
||||
'Agent execution stopped: Task completed',
|
||||
),
|
||||
}),
|
||||
expect.any(Number),
|
||||
);
|
||||
@@ -1769,7 +1773,9 @@ describe('useGeminiStream', () => {
|
||||
expect(mockAddItem).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: MessageType.INFO,
|
||||
text: expect.stringContaining('Agent execution stopped: INTERNAL_ERROR'),
|
||||
text: expect.stringContaining(
|
||||
'Agent execution stopped: INTERNAL_ERROR',
|
||||
),
|
||||
}),
|
||||
expect.any(Number),
|
||||
);
|
||||
@@ -1794,7 +1800,9 @@ describe('useGeminiStream', () => {
|
||||
expect(mockAddItem).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: MessageType.WARNING,
|
||||
text: expect.stringContaining('Agent execution blocked: Policy violation'),
|
||||
text: expect.stringContaining(
|
||||
'Agent execution blocked: Policy violation',
|
||||
),
|
||||
}),
|
||||
expect.any(Number),
|
||||
);
|
||||
@@ -1819,7 +1827,9 @@ describe('useGeminiStream', () => {
|
||||
expect(mockAddItem).toHaveBeenCalledWith(
|
||||
expect.objectContaining({
|
||||
type: MessageType.WARNING,
|
||||
text: expect.stringContaining('Agent execution blocked: ACCESS_DENIED'),
|
||||
text: expect.stringContaining(
|
||||
'Agent execution blocked: ACCESS_DENIED',
|
||||
),
|
||||
}),
|
||||
expect.any(Number),
|
||||
);
|
||||
|
||||
@@ -308,10 +308,8 @@ export const useGeminiStream = (
|
||||
// Record tool calls with full metadata before sending responses.
|
||||
try {
|
||||
const currentModel =
|
||||
config.getGeminiClient().getCurrentSequenceModel() ??
|
||||
config.getModel();
|
||||
config
|
||||
.getGeminiClient()
|
||||
geminiClient.getCurrentSequenceModel() ?? config.getModel();
|
||||
geminiClient
|
||||
.getChat()
|
||||
.recordCompletedToolCalls(
|
||||
currentModel,
|
||||
@@ -1560,8 +1558,7 @@ export const useGeminiStream = (
|
||||
setLoopDetectionConfirmationRequest(null);
|
||||
|
||||
if (result.userSelection === 'disable') {
|
||||
config
|
||||
.getGeminiClient()
|
||||
geminiClient
|
||||
.getLoopDetectionService()
|
||||
.disableForSession();
|
||||
addItem({
|
||||
|
||||
Reference in New Issue
Block a user