mirror of
https://github.com/MoonshotAI/kimi-code.git
synced 2026-07-18 13:44:21 +00:00
20 lines
586 B
TypeScript
20 lines
586 B
TypeScript
import type { TelemetryClient, TelemetryProperties } from '#/index';
|
|
|
|
export interface TelemetryRecord {
|
|
readonly event: string;
|
|
readonly sessionId: string | null;
|
|
readonly properties?: TelemetryProperties;
|
|
}
|
|
|
|
export function recordingTelemetry(records: TelemetryRecord[]): TelemetryClient {
|
|
return {
|
|
track: (event, properties) => {
|
|
records.push({ event, sessionId: null, properties });
|
|
},
|
|
withContext: (patch) => ({
|
|
track: (event, properties) => {
|
|
records.push({ event, sessionId: patch.sessionId ?? null, properties });
|
|
},
|
|
}),
|
|
};
|
|
}
|