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
2 changes: 1 addition & 1 deletion packages/types/npm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@roo-code/types",
"version": "1.28.0",
"version": "1.29.0",
"description": "TypeScript type definitions for Roo Code.",
"publishConfig": {
"access": "public",
Expand Down
20 changes: 17 additions & 3 deletions packages/types/src/telemetry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,25 @@ export const taskPropertiesSchema = z.object({
isSubtask: z.boolean().optional(),
})

export const gitPropertiesSchema = z.object({
repositoryUrl: z.string().optional(),
repositoryName: z.string().optional(),
defaultBranch: z.string().optional(),
})

export const telemetryPropertiesSchema = z.object({
...appPropertiesSchema.shape,
...taskPropertiesSchema.shape,
...gitPropertiesSchema.shape,
})

export const cloudTelemetryPropertiesSchema = z.object({
...telemetryPropertiesSchema.shape,
})

export type TelemetryProperties = z.infer<typeof telemetryPropertiesSchema>
export type CloudTelemetryProperties = z.infer<typeof cloudTelemetryPropertiesSchema>
export type GitProperties = z.infer<typeof gitPropertiesSchema>

/**
* TelemetryEvent
Expand Down Expand Up @@ -127,20 +140,20 @@ export const rooCodeTelemetryEventSchema = z.discriminatedUnion("type", [
TelemetryEventName.MODE_SETTINGS_CHANGED,
TelemetryEventName.CUSTOM_MODE_CREATED,
]),
properties: telemetryPropertiesSchema,
properties: cloudTelemetryPropertiesSchema,
}),
z.object({
type: z.literal(TelemetryEventName.TASK_MESSAGE),
properties: z.object({
...telemetryPropertiesSchema.shape,
...cloudTelemetryPropertiesSchema.shape,
taskId: z.string(),
message: clineMessageSchema,
}),
}),
z.object({
type: z.literal(TelemetryEventName.LLM_COMPLETION),
properties: z.object({
...telemetryPropertiesSchema.shape,
...cloudTelemetryPropertiesSchema.shape,
inputTokens: z.number(),
outputTokens: z.number(),
cacheReadTokens: z.number().optional(),
Expand All @@ -166,6 +179,7 @@ export type TelemetryEventSubscription =

export interface TelemetryPropertiesProvider {
getTelemetryProperties(): Promise<TelemetryProperties>
getCloudTelemetryProperties?(): Promise<CloudTelemetryProperties>
}

/**
Expand Down
Loading