Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/types/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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 })
}
5 changes: 5 additions & 0 deletions src/core/assistant-message/presentAssistantMessage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
Expand All @@ -357,6 +360,7 @@ export async function presentAssistantMessage(cline: Task) {
pushToolResult(formatResponse.toolDenied())
}
cline.didRejectTool = true
captureAskApproval(block.name, false) // kilocode_change
return false
}

Expand All @@ -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
}

Expand Down
32 changes: 31 additions & 1 deletion src/core/webview/ClineProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3128,7 +3128,8 @@ ${prompt}

public async getTelemetryProperties(): Promise<TelemetryProperties> {
// 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() {
Expand Down Expand Up @@ -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 {
Expand All @@ -3197,6 +3226,7 @@ ${prompt}
...getMemory(),
...getFastApply(),
...getOpenRouter(),
...getAutoApproveSettings(),
// kilocode_change end
...(await this.getTaskProperties()),
...(await this.getGitProperties()),
Expand Down