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
4 changes: 4 additions & 0 deletions src/core/webview/webviewMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1020,6 +1020,10 @@ export const webviewMessageHandler = async (provider: ClineProvider, message: We
),
)

// Capture telemetry for prompt enhancement
const currentCline = provider.getCurrentCline()
telemetryService.capturePromptEnhanced(currentCline?.taskId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider wrapping the telemetry call in a try/catch to ensure any telemetry failure doesn’t impact the user flow, even though it’s fire-and-forget.


await provider.postMessageToWebview({
type: "enhancedPrompt",
text: enhancedPrompt,
Expand Down
7 changes: 7 additions & 0 deletions src/services/telemetry/TelemetryService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class PostHogClient {
CHECKPOINT_RESTORED: "Checkpoint Restored",
CHECKPOINT_DIFFED: "Checkpoint Diffed",
CODE_ACTION_USED: "Code Action Used",
PROMPT_ENHANCED: "Prompt Enhanced",
},
ERRORS: {
SCHEMA_VALIDATION_ERROR: "Schema Validation Error",
Expand Down Expand Up @@ -275,6 +276,12 @@ class TelemetryService {
})
}

public capturePromptEnhanced(taskId?: string): void {
this.captureEvent(PostHogClient.EVENTS.TASK.PROMPT_ENHANCED, {
...(taskId && { taskId }),
})
}

public captureSchemaValidationError({ schemaName, error }: { schemaName: string; error: ZodError }): void {
this.captureEvent(PostHogClient.EVENTS.ERRORS.SCHEMA_VALIDATION_ERROR, {
schemaName,
Expand Down