mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-29 06:25:16 -07:00
Revamp KeypressContext (#12746)
This commit is contained in:
committed by
GitHub
parent
f649948713
commit
9e4ae214a8
@@ -18,7 +18,6 @@ import type {
|
||||
MalformedJsonResponseEvent,
|
||||
IdeConnectionEvent,
|
||||
ConversationFinishedEvent,
|
||||
KittySequenceOverflowEvent,
|
||||
ChatCompressionEvent,
|
||||
FileOperationEvent,
|
||||
InvalidChunkEvent,
|
||||
@@ -847,20 +846,6 @@ export class ClearcutLogger {
|
||||
this.flushIfNeeded();
|
||||
}
|
||||
|
||||
logKittySequenceOverflowEvent(event: KittySequenceOverflowEvent): void {
|
||||
const data: EventValue[] = [
|
||||
{
|
||||
gemini_cli_key: EventMetadataKey.GEMINI_CLI_KITTY_SEQUENCE_LENGTH,
|
||||
value: event.sequence_length.toString(),
|
||||
},
|
||||
];
|
||||
|
||||
this.enqueueLogEvent(
|
||||
this.createLogEvent(EventNames.KITTY_SEQUENCE_OVERFLOW, data),
|
||||
);
|
||||
this.flushIfNeeded();
|
||||
}
|
||||
|
||||
logEndSessionEvent(): void {
|
||||
// Flush immediately on session end.
|
||||
this.enqueueLogEvent(this.createLogEvent(EventNames.END_SESSION, []));
|
||||
|
||||
@@ -38,7 +38,6 @@ export {
|
||||
logFlashFallback,
|
||||
logSlashCommand,
|
||||
logConversationFinishedEvent,
|
||||
logKittySequenceOverflow,
|
||||
logChatCompression,
|
||||
logToolOutputTruncated,
|
||||
logExtensionEnable,
|
||||
@@ -59,7 +58,6 @@ export {
|
||||
StartSessionEvent,
|
||||
ToolCallEvent,
|
||||
ConversationFinishedEvent,
|
||||
KittySequenceOverflowEvent,
|
||||
ToolOutputTruncatedEvent,
|
||||
WebFetchFallbackAttemptEvent,
|
||||
ToolCallDecision,
|
||||
|
||||
@@ -28,7 +28,6 @@ import type {
|
||||
LoopDetectionDisabledEvent,
|
||||
SlashCommandEvent,
|
||||
ConversationFinishedEvent,
|
||||
KittySequenceOverflowEvent,
|
||||
ChatCompressionEvent,
|
||||
MalformedJsonResponseEvent,
|
||||
InvalidChunkEvent,
|
||||
@@ -398,20 +397,6 @@ export function logChatCompression(
|
||||
});
|
||||
}
|
||||
|
||||
export function logKittySequenceOverflow(
|
||||
config: Config,
|
||||
event: KittySequenceOverflowEvent,
|
||||
): void {
|
||||
ClearcutLogger.getInstance(config)?.logKittySequenceOverflowEvent(event);
|
||||
if (!isTelemetrySdkInitialized()) return;
|
||||
const logger = logs.getLogger(SERVICE_NAME);
|
||||
const logRecord: LogRecord = {
|
||||
body: event.toLogBody(),
|
||||
attributes: event.toOpenTelemetryAttributes(config),
|
||||
};
|
||||
logger.emit(logRecord);
|
||||
}
|
||||
|
||||
export function logMalformedJsonResponse(
|
||||
config: Config,
|
||||
event: MalformedJsonResponseEvent,
|
||||
|
||||
@@ -949,34 +949,6 @@ export class ConversationFinishedEvent {
|
||||
}
|
||||
}
|
||||
|
||||
export class KittySequenceOverflowEvent {
|
||||
'event.name': 'kitty_sequence_overflow';
|
||||
'event.timestamp': string; // ISO 8601
|
||||
sequence_length: number;
|
||||
truncated_sequence: string;
|
||||
constructor(sequence_length: number, truncated_sequence: string) {
|
||||
this['event.name'] = 'kitty_sequence_overflow';
|
||||
this['event.timestamp'] = new Date().toISOString();
|
||||
this.sequence_length = sequence_length;
|
||||
// Truncate to first 20 chars for logging (avoid logging sensitive data)
|
||||
this.truncated_sequence = truncated_sequence.substring(0, 20);
|
||||
}
|
||||
|
||||
toOpenTelemetryAttributes(config: Config): LogAttributes {
|
||||
return {
|
||||
...getCommonAttributes(config),
|
||||
'event.name': this['event.name'],
|
||||
'event.timestamp': this['event.timestamp'],
|
||||
sequence_length: this.sequence_length,
|
||||
truncated_sequence: this.truncated_sequence,
|
||||
};
|
||||
}
|
||||
|
||||
toLogBody(): string {
|
||||
return `Kitty sequence buffer overflow: ${this.sequence_length} bytes`;
|
||||
}
|
||||
}
|
||||
|
||||
export const EVENT_FILE_OPERATION = 'gemini_cli.file_operation';
|
||||
export class FileOperationEvent implements BaseTelemetryEvent {
|
||||
'event.name': 'file_operation';
|
||||
@@ -1444,7 +1416,6 @@ export type TelemetryEvent =
|
||||
| LoopDetectedEvent
|
||||
| LoopDetectionDisabledEvent
|
||||
| NextSpeakerCheckEvent
|
||||
| KittySequenceOverflowEvent
|
||||
| MalformedJsonResponseEvent
|
||||
| IdeConnectionEvent
|
||||
| ConversationFinishedEvent
|
||||
|
||||
Reference in New Issue
Block a user