Add terminal setup command for Shift+Enter and Ctrl+Enter support (#3289)

Co-authored-by: jacob314 <jacob314@gmail.com>
This commit is contained in:
Deepankar Sharma
2025-08-13 13:32:54 -04:00
committed by GitHub
parent 74a13fb535
commit 9c7fb870c1
19 changed files with 989 additions and 18 deletions

View File

@@ -19,6 +19,7 @@ import {
SlashCommandEvent,
MalformedJsonResponseEvent,
IdeConnectionEvent,
KittySequenceOverflowEvent,
} from '../types.js';
import { EventMetadataKey } from './event-metadata-key.js';
import { Config } from '../../config/config.js';
@@ -43,6 +44,7 @@ const next_speaker_check_event_name = 'next_speaker_check';
const slash_command_event_name = 'slash_command';
const malformed_json_response_event_name = 'malformed_json_response';
const ide_connection_event_name = 'ide_connection';
const kitty_sequence_overflow_event_name = 'kitty_sequence_overflow';
export interface LogResponse {
nextRequestWaitMs?: number;
@@ -675,6 +677,24 @@ 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(),
},
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_KITTY_TRUNCATED_SEQUENCE,
value: event.truncated_sequence,
},
];
this.enqueueLogEvent(
this.createLogEvent(kitty_sequence_overflow_event_name, data),
);
this.flushIfNeeded();
}
logEndSessionEvent(event: EndSessionEvent): void {
const data: EventValue[] = [
{

View File

@@ -212,6 +212,16 @@ export enum EventMetadataKey {
// Logs user removed lines in edit/write tool response.
GEMINI_CLI_USER_REMOVED_LINES = 50,
// ==========================================================================
// Kitty Sequence Overflow Event Keys
// ===========================================================================
// Logs the length of the kitty sequence that overflowed.
GEMINI_CLI_KITTY_SEQUENCE_LENGTH = 53,
// Logs the truncated kitty sequence.
GEMINI_CLI_KITTY_TRUNCATED_SEQUENCE = 52,
}
export function getEventMetadataKey(

View File

@@ -27,6 +27,7 @@ export {
logApiResponse,
logFlashFallback,
logSlashCommand,
logKittySequenceOverflow,
} from './loggers.js';
export {
StartSessionEvent,
@@ -39,6 +40,7 @@ export {
TelemetryEvent,
FlashFallbackEvent,
SlashCommandEvent,
KittySequenceOverflowEvent,
makeSlashCommandEvent,
SlashCommandStatus,
} from './types.js';

View File

@@ -32,6 +32,7 @@ import {
NextSpeakerCheckEvent,
LoopDetectedEvent,
SlashCommandEvent,
KittySequenceOverflowEvent,
} from './types.js';
import {
recordApiErrorMetrics,
@@ -378,3 +379,21 @@ export function logIdeConnection(
};
logger.emit(logRecord);
}
export function logKittySequenceOverflow(
config: Config,
event: KittySequenceOverflowEvent,
): void {
ClearcutLogger.getInstance(config)?.logKittySequenceOverflowEvent(event);
if (!isTelemetrySdkInitialized()) return;
const attributes: LogAttributes = {
...getCommonAttributes(config),
...event,
};
const logger = logs.getLogger(SERVICE_NAME);
const logRecord: LogRecord = {
body: `Kitty sequence buffer overflow: ${event.sequence_length} bytes`,
attributes,
};
logger.emit(logRecord);
}

View File

@@ -346,6 +346,20 @@ export class IdeConnectionEvent {
}
}
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);
}
}
export type TelemetryEvent =
| StartSessionEvent
| EndSessionEvent
@@ -360,4 +374,4 @@ export type TelemetryEvent =
| SlashCommandEvent
| MalformedJsonResponseEvent
| IdeConnectionEvent
| SlashCommandEvent;
| KittySequenceOverflowEvent;