chore: rename smart-edit to edit (#15923)

This commit is contained in:
Abhi
2026-01-05 15:25:54 -05:00
committed by GitHub
parent 3c92666ec2
commit b13c6b57ae
14 changed files with 79 additions and 87 deletions
@@ -31,8 +31,8 @@ import type {
ExtensionEnableEvent,
ModelSlashCommandEvent,
ExtensionDisableEvent,
SmartEditStrategyEvent,
SmartEditCorrectionEvent,
EditStrategyEvent,
EditCorrectionEvent,
AgentStartEvent,
AgentFinishEvent,
RecoveryAttemptEvent,
@@ -89,8 +89,8 @@ export enum EventNames {
TOOL_OUTPUT_TRUNCATED = 'tool_output_truncated',
MODEL_ROUTING = 'model_routing',
MODEL_SLASH_COMMAND = 'model_slash_command',
SMART_EDIT_STRATEGY = 'smart_edit_strategy',
SMART_EDIT_CORRECTION = 'smart_edit_correction',
EDIT_STRATEGY = 'edit_strategy',
EDIT_CORRECTION = 'edit_correction',
AGENT_START = 'agent_start',
AGENT_FINISH = 'agent_finish',
RECOVERY_ATTEMPT = 'recovery_attempt',
@@ -1235,31 +1235,27 @@ export class ClearcutLogger {
});
}
logSmartEditStrategyEvent(event: SmartEditStrategyEvent): void {
logEditStrategyEvent(event: EditStrategyEvent): void {
const data: EventValue[] = [
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_SMART_EDIT_STRATEGY,
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EDIT_STRATEGY,
value: event.strategy,
},
];
this.enqueueLogEvent(
this.createLogEvent(EventNames.SMART_EDIT_STRATEGY, data),
);
this.enqueueLogEvent(this.createLogEvent(EventNames.EDIT_STRATEGY, data));
this.flushIfNeeded();
}
logSmartEditCorrectionEvent(event: SmartEditCorrectionEvent): void {
logEditCorrectionEvent(event: EditCorrectionEvent): void {
const data: EventValue[] = [
{
gemini_cli_key: EventMetadataKey.GEMINI_CLI_SMART_EDIT_CORRECTION,
gemini_cli_key: EventMetadataKey.GEMINI_CLI_EDIT_CORRECTION,
value: event.correction,
},
];
this.enqueueLogEvent(
this.createLogEvent(EventNames.SMART_EDIT_CORRECTION, data),
);
this.enqueueLogEvent(this.createLogEvent(EventNames.EDIT_CORRECTION, data));
this.flushIfNeeded();
}
@@ -93,11 +93,11 @@ export enum EventMetadataKey {
// Replace Tool Call Event Keys
// ===========================================================================
// Logs a smart edit tool strategy choice.
GEMINI_CLI_SMART_EDIT_STRATEGY = 109,
// Logs a edit tool strategy choice.
GEMINI_CLI_EDIT_STRATEGY = 109,
// Logs a smart edit correction event.
GEMINI_CLI_SMART_EDIT_CORRECTION = 110,
// Logs a edit correction event.
GEMINI_CLI_EDIT_CORRECTION = 110,
// Logs the reason for web fetch fallback.
GEMINI_CLI_WEB_FETCH_FALLBACK_REASON = 116,
+4 -4
View File
@@ -12,7 +12,7 @@ import type {
} from '../index.js';
import {
AuthType,
SmartEditTool,
EditTool,
GeminiClient,
ToolConfirmationOutcome,
ToolErrorType,
@@ -1034,7 +1034,7 @@ describe('loggers', () => {
});
it('should log a tool call with all fields', () => {
const tool = new SmartEditTool(mockConfig, createMockMessageBus());
const tool = new EditTool(mockConfig, createMockMessageBus());
const call: CompletedToolCall = {
status: 'success',
request: {
@@ -1250,7 +1250,7 @@ describe('loggers', () => {
contentLength: 13,
},
outcome: ToolConfirmationOutcome.ModifyWithEditor,
tool: new SmartEditTool(mockConfig, createMockMessageBus()),
tool: new EditTool(mockConfig, createMockMessageBus()),
invocation: {} as AnyToolInvocation,
durationMs: 100,
};
@@ -1329,7 +1329,7 @@ describe('loggers', () => {
errorType: undefined,
contentLength: 13,
},
tool: new SmartEditTool(mockConfig, createMockMessageBus()),
tool: new EditTool(mockConfig, createMockMessageBus()),
invocation: {} as AnyToolInvocation,
durationMs: 100,
};
+8 -8
View File
@@ -41,8 +41,8 @@ import type {
ExtensionUninstallEvent,
ExtensionInstallEvent,
ModelSlashCommandEvent,
SmartEditStrategyEvent,
SmartEditCorrectionEvent,
EditStrategyEvent,
EditCorrectionEvent,
AgentStartEvent,
AgentFinishEvent,
RecoveryAttemptEvent,
@@ -568,11 +568,11 @@ export async function logExtensionDisable(
});
}
export function logSmartEditStrategy(
export function logEditStrategy(
config: Config,
event: SmartEditStrategyEvent,
event: EditStrategyEvent,
): void {
ClearcutLogger.getInstance(config)?.logSmartEditStrategyEvent(event);
ClearcutLogger.getInstance(config)?.logEditStrategyEvent(event);
bufferTelemetryEvent(() => {
const logger = logs.getLogger(SERVICE_NAME);
const logRecord: LogRecord = {
@@ -583,11 +583,11 @@ export function logSmartEditStrategy(
});
}
export function logSmartEditCorrectionEvent(
export function logEditCorrectionEvent(
config: Config,
event: SmartEditCorrectionEvent,
event: EditCorrectionEvent,
): void {
ClearcutLogger.getInstance(config)?.logSmartEditCorrectionEvent(event);
ClearcutLogger.getInstance(config)?.logEditCorrectionEvent(event);
bufferTelemetryEvent(() => {
const logger = logs.getLogger(SERVICE_NAME);
const logRecord: LogRecord = {
+15 -13
View File
@@ -1548,7 +1548,9 @@ export type TelemetryEvent =
| RecoveryAttemptEvent
| LlmLoopCheckEvent
| StartupStatsEvent
| WebFetchFallbackAttemptEvent;
| WebFetchFallbackAttemptEvent
| EditStrategyEvent
| EditCorrectionEvent;
export const EVENT_EXTENSION_DISABLE = 'gemini_cli.extension_disable';
export class ExtensionDisableEvent implements BaseTelemetryEvent {
@@ -1588,14 +1590,14 @@ export class ExtensionDisableEvent implements BaseTelemetryEvent {
}
}
export const EVENT_SMART_EDIT_STRATEGY = 'gemini_cli.smart_edit_strategy';
export class SmartEditStrategyEvent implements BaseTelemetryEvent {
'event.name': 'smart_edit_strategy';
export const EVENT_EDIT_STRATEGY = 'gemini_cli.edit_strategy';
export class EditStrategyEvent implements BaseTelemetryEvent {
'event.name': 'edit_strategy';
'event.timestamp': string;
strategy: string;
constructor(strategy: string) {
this['event.name'] = 'smart_edit_strategy';
this['event.name'] = 'edit_strategy';
this['event.timestamp'] = new Date().toISOString();
this.strategy = strategy;
}
@@ -1603,25 +1605,25 @@ export class SmartEditStrategyEvent implements BaseTelemetryEvent {
toOpenTelemetryAttributes(config: Config): LogAttributes {
return {
...getCommonAttributes(config),
'event.name': EVENT_SMART_EDIT_STRATEGY,
'event.name': EVENT_EDIT_STRATEGY,
'event.timestamp': this['event.timestamp'],
strategy: this.strategy,
};
}
toLogBody(): string {
return `Smart Edit Tool Strategy: ${this.strategy}`;
return `Edit Tool Strategy: ${this.strategy}`;
}
}
export const EVENT_SMART_EDIT_CORRECTION = 'gemini_cli.smart_edit_correction';
export class SmartEditCorrectionEvent implements BaseTelemetryEvent {
'event.name': 'smart_edit_correction';
export const EVENT_EDIT_CORRECTION = 'gemini_cli.edit_correction';
export class EditCorrectionEvent implements BaseTelemetryEvent {
'event.name': 'edit_correction';
'event.timestamp': string;
correction: 'success' | 'failure';
constructor(correction: 'success' | 'failure') {
this['event.name'] = 'smart_edit_correction';
this['event.name'] = 'edit_correction';
this['event.timestamp'] = new Date().toISOString();
this.correction = correction;
}
@@ -1629,14 +1631,14 @@ export class SmartEditCorrectionEvent implements BaseTelemetryEvent {
toOpenTelemetryAttributes(config: Config): LogAttributes {
return {
...getCommonAttributes(config),
'event.name': EVENT_SMART_EDIT_CORRECTION,
'event.name': EVENT_EDIT_CORRECTION,
'event.timestamp': this['event.timestamp'],
correction: this.correction,
};
}
toLogBody(): string {
return `Smart Edit Tool Correction: ${this.correction}`;
return `Edit Tool Correction: ${this.correction}`;
}
}