refactor(core): agent session protocol changes (#26661)

This commit is contained in:
Adam Weidman
2026-05-08 13:12:54 -04:00
committed by GitHub
parent 43dda31549
commit 12c8469b34
4 changed files with 15 additions and 1 deletions
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, expect, it } from 'vitest';
import { describe, expect, it, vi } from 'vitest';
import {
geminiPartsToContentParts,
contentPartsToGeminiParts,
@@ -12,6 +12,7 @@ import {
} from './content-utils.js';
import type { Part } from '@google/genai';
import type { ContentPart } from './types.js';
import { debugLogger } from '../utils/debugLogger.js';
describe('geminiPartsToContentParts', () => {
it('converts text parts', () => {
@@ -191,11 +192,17 @@ describe('contentPartsToGeminiParts', () => {
const content = [
{ type: 'custom_widget', payload: 123 },
] as unknown as ContentPart[];
const warnSpy = vi.spyOn(debugLogger, 'warn');
const result = contentPartsToGeminiParts(content);
expect(warnSpy).toHaveBeenCalled();
expect(result).toHaveLength(1);
expect(result[0]).toEqual({
text: JSON.stringify({ type: 'custom_widget', payload: 123 }),
});
warnSpy.mockRestore();
});
});