@@ -8,19 +8,21 @@ import delay from "delay"
88import pWaitFor from "p-wait-for"
99import { serializeError } from "serialize-error"
1010
11- import type {
12- ProviderSettings ,
13- TokenUsage ,
14- ToolUsage ,
15- ToolName ,
16- ContextCondense ,
17- ClineAsk ,
18- ClineMessage ,
19- ClineSay ,
20- ToolProgressStatus ,
21- HistoryItem ,
11+ import {
12+ type ProviderSettings ,
13+ type TokenUsage ,
14+ type ToolUsage ,
15+ type ToolName ,
16+ type ContextCondense ,
17+ type ClineAsk ,
18+ type ClineMessage ,
19+ type ClineSay ,
20+ type ToolProgressStatus ,
21+ type HistoryItem ,
22+ TelemetryEventName ,
2223} from "@roo-code/types"
2324import { TelemetryService } from "@roo-code/telemetry"
25+ import { CloudService } from "@roo-code/cloud"
2426
2527// api
2628import { ApiHandler , ApiHandlerCreateMessageMetadata , buildApiHandler } from "../../api"
@@ -322,8 +324,13 @@ export class Task extends EventEmitter<ClineEvents> {
322324 this . emit ( "message" , { action : "created" , message } )
323325 await this . saveClineMessages ( )
324326
325- if ( message . partial !== true ) {
326- TelemetryService . instance . captureTaskMessage ( this . taskId , message )
327+ const shouldCaptureMessage = message . partial !== true && CloudService . isEnabled ( )
328+
329+ if ( shouldCaptureMessage ) {
330+ CloudService . instance . captureEvent ( {
331+ event : TelemetryEventName . TASK_MESSAGE ,
332+ properties : { taskId : this . taskId , message } ,
333+ } )
327334 }
328335 }
329336
@@ -336,8 +343,13 @@ export class Task extends EventEmitter<ClineEvents> {
336343 await this . providerRef . deref ( ) ?. postMessageToWebview ( { type : "partialMessage" , partialMessage } )
337344 this . emit ( "message" , { action : "updated" , message : partialMessage } )
338345
339- if ( partialMessage . partial !== true ) {
340- TelemetryService . instance . captureTaskMessage ( this . taskId , partialMessage )
346+ const shouldCaptureMessage = partialMessage . partial !== true && CloudService . isEnabled ( )
347+
348+ if ( shouldCaptureMessage ) {
349+ CloudService . instance . captureEvent ( {
350+ event : TelemetryEventName . TASK_MESSAGE ,
351+ properties : { taskId : this . taskId , message : partialMessage } ,
352+ } )
341353 }
342354 }
343355
0 commit comments