fix: add privacy settings hook and tests (#6360)

This commit is contained in:
Arya Gummadi
2025-08-18 23:57:10 -07:00
committed by GitHub
parent 8f8082fe3d
commit ec0d9f4ff7
4 changed files with 261 additions and 11 deletions

View File

@@ -27,20 +27,12 @@ import {
} from '../telemetry/loggers.js';
import { ContentGenerator } from './contentGenerator.js';
import { toContents } from '../code_assist/converter.js';
import { isStructuredError } from '../utils/quotaErrorDetection.js';
interface StructuredError {
status: number;
}
export function isStructuredError(error: unknown): error is StructuredError {
return (
typeof error === 'object' &&
error !== null &&
'status' in error &&
typeof (error as StructuredError).status === 'number'
);
}
/**
* A decorator that wraps a ContentGenerator to add logging to API calls.
*/
@@ -50,6 +42,10 @@ export class LoggingContentGenerator implements ContentGenerator {
private readonly config: Config,
) {}
getWrapped(): ContentGenerator {
return this.wrapped;
}
private logApiRequest(
contents: Content[],
model: string,

View File

@@ -10,6 +10,7 @@ export * from './config/config.js';
// Export Core Logic
export * from './core/client.js';
export * from './core/contentGenerator.js';
export * from './core/loggingContentGenerator.js';
export * from './core/geminiChat.js';
export * from './core/logger.js';
export * from './core/prompts.js';