diff --git a/packages/types/src/telemetry.ts b/packages/types/src/telemetry.ts index cd6be8c5440..7fed0593c0d 100644 --- a/packages/types/src/telemetry.ts +++ b/packages/types/src/telemetry.ts @@ -40,6 +40,7 @@ export enum TelemetryEventName { AUTO_PURGE_FAILED = "Auto Purge Failed", MANUAL_PURGE_TRIGGERED = "Manual Purge Triggered", GHOST_SERVICE_DISABLED = "Ghost Service Disabled", + ASK_APPROVAL = "Ask Approval", // kilocode_change end TASK_CREATED = "Task Created", diff --git a/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts b/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts new file mode 100644 index 00000000000..de126a9e211 --- /dev/null +++ b/src/core/assistant-message/kilocode/captureAskApprovalEvent.ts @@ -0,0 +1,6 @@ +import { TelemetryEventName, ToolName } from "@roo-code/types" +import { TelemetryService } from "@roo-code/telemetry" + +export function captureAskApproval(tool: ToolName, isApproved: boolean) { + TelemetryService.instance.captureEvent(TelemetryEventName.ASK_APPROVAL, { tool, isApproved }) +} diff --git a/src/core/assistant-message/presentAssistantMessage.ts b/src/core/assistant-message/presentAssistantMessage.ts index 3279c9c4b94..e1ab2942cc8 100644 --- a/src/core/assistant-message/presentAssistantMessage.ts +++ b/src/core/assistant-message/presentAssistantMessage.ts @@ -44,6 +44,7 @@ import { experiments, EXPERIMENT_IDS } from "../../shared/experiments" import { applyDiffToolLegacy } from "../tools/applyDiffTool" import { yieldPromise } from "../kilocode" import Anthropic from "@anthropic-ai/sdk" // kilocode_change +import { captureAskApproval } from "./kilocode/captureAskApprovalEvent" /** * Processes and presents assistant message content to the user interface. @@ -334,8 +335,10 @@ export async function presentAssistantMessage(cline: Task) { // Gatekeeper denied the action pushToolResult(formatResponse.toolDenied()) cline.didRejectTool = true + captureAskApproval(block.name, false) return false } + captureAskApproval(block.name, true) return true } // kilocode_change end @@ -357,6 +360,7 @@ export async function presentAssistantMessage(cline: Task) { pushToolResult(formatResponse.toolDenied()) } cline.didRejectTool = true + captureAskApproval(block.name, false) // kilocode_change return false } @@ -366,6 +370,7 @@ export async function presentAssistantMessage(cline: Task) { pushToolResult(formatResponse.toolResult(formatResponse.toolApprovedWithFeedback(text), images)) } + captureAskApproval(block.name, true) // kilocode_change return true } diff --git a/src/core/webview/ClineProvider.ts b/src/core/webview/ClineProvider.ts index b874eaa58f3..4d95547879b 100644 --- a/src/core/webview/ClineProvider.ts +++ b/src/core/webview/ClineProvider.ts @@ -3128,7 +3128,8 @@ ${prompt} public async getTelemetryProperties(): Promise { // kilocode_change start - const { apiConfiguration, experiments } = await this.getState() + const state = await this.getState() + const { apiConfiguration, experiments } = state const task = this.getCurrentTask() async function getModelId() { @@ -3187,6 +3188,34 @@ ${prompt} } } } + + const getAutoApproveSettings = () => { + try { + return { + autoApprove: { + autoApprovalEnabled: !!state.autoApprovalEnabled, + alwaysAllowBrowser: !!state.alwaysAllowBrowser, + alwaysAllowExecute: !!state.alwaysAllowExecute, + alwaysAllowFollowupQuestions: !!state.alwaysAllowFollowupQuestions, + alwaysAllowMcp: !!state.alwaysAllowMcp, + alwaysAllowModeSwitch: !!state.alwaysAllowModeSwitch, + alwaysAllowReadOnly: !!state.alwaysAllowReadOnly, + alwaysAllowReadOnlyOutsideWorkspace: !!state.alwaysAllowReadOnlyOutsideWorkspace, + alwaysAllowSubtasks: !!state.alwaysAllowSubtasks, + alwaysAllowUpdateTodoList: !!state.alwaysAllowUpdateTodoList, + alwaysAllowWrite: !!state.alwaysAllowWrite, + alwaysAllowWriteOutsideWorkspace: !!state.alwaysAllowWriteOutsideWorkspace, + alwaysAllowWriteProtected: !!state.alwaysAllowWriteProtected, + alwaysApproveResubmit: !!state.alwaysApproveResubmit, + yoloModel: !!state.yoloMode, + }, + } + } catch (error) { + return { + autoApproveException: stringifyError(error), + } + } + } // kilocode_change end return { @@ -3197,6 +3226,7 @@ ${prompt} ...getMemory(), ...getFastApply(), ...getOpenRouter(), + ...getAutoApproveSettings(), // kilocode_change end ...(await this.getTaskProperties()), ...(await this.getGitProperties()),