Download packages/node-sdk/src/telemetry.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 787 Bytes
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/node-sdk/src/telemetry.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/node-sdk/src/telemetry.ts
-
curl -L -o telemetry.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/node-sdk/src/telemetry.ts
787 Bytes
| export type TelemetryPropertyValue = boolean | number | string | undefined | null; | |
| export type TelemetryProperties = Readonly<Record<string, TelemetryPropertyValue>>; | |
| export interface TelemetryContextPatch { | |
| readonly sessionId?: string | null; | |
| } | |
| export interface TelemetryClient { | |
| track(event: string, properties?: TelemetryProperties): void; | |
| withContext?(patch: TelemetryContextPatch): TelemetryClient; | |
| setContext?(patch: TelemetryContextPatch): void; | |
| } | |
| export const noopTelemetryClient: TelemetryClient = { | |
| track: () => {}, | |
| withContext: () => noopTelemetryClient, | |
| setContext: () => {}, | |
| }; | |
| export function withTelemetryContext( | |
| telemetry: TelemetryClient, | |
| patch: TelemetryContextPatch, | |
| ): TelemetryClient { | |
| return telemetry.withContext?.(patch) ?? telemetry; | |
| } | |