import type { DrainContext } from 'evlog'; import type { DrainPipelineOptions } from 'evlog/pipeline'; import type { CliLogger } from './logger.js'; export declare const TelemetryEventName: { readonly AUTH_LOGIN_FAILED: 'auth.login.failed'; readonly AUTH_LOGIN_STARTED: 'auth.login.started'; readonly AUTH_LOGIN_SUCCEEDED: 'auth.login.succeeded'; readonly AUTH_LOGOUT: 'auth.logout'; readonly CLI_COMPLETED: 'cli.completed'; readonly CLI_ENVIRONMENT_DETECTED: 'cli.environment_detected'; readonly CLI_EXITED: 'cli.exited'; readonly CLI_INVOKED: 'cli.invoked'; readonly CLI_STATE_CANCELLED: 'cli.state.cancelled'; readonly CLI_STATE_COMPLETE: 'cli.state.complete'; readonly CLI_STATE_ERROR: 'cli.state.error'; readonly CLI_STATE_TRANSITION: 'cli.state.transition'; readonly COMMAND_EXECUTED: 'command.executed'; readonly COMMAND_FAILED: 'command.failed'; readonly COMMAND_SUCCEEDED: 'command.succeeded'; readonly COMMAND_UNKNOWN: 'command.unknown'; readonly CONFIG_ERROR: 'config.error'; readonly CONFIG_LOADED: 'config.loaded'; readonly CONFIG_UPDATED: 'config.updated'; readonly ERROR_OCCURRED: 'error.occurred'; readonly GENERATE_COMPLETED: 'generate.completed'; readonly GENERATE_FAILED: 'generate.failed'; readonly GENERATE_STARTED: 'generate.started'; readonly HELP_DISPLAYED: 'help.displayed'; readonly INTERACTIVE_MENU_EXITED: 'ui.menu.exited'; readonly INTERACTIVE_MENU_OPENED: 'ui.menu.opened'; readonly MIGRATION_COMPLETED: 'migration.completed'; readonly MIGRATION_EXECUTED: 'migration.executed'; readonly MIGRATION_FAILED: 'migration.failed'; readonly MIGRATION_PLANNED: 'migration.planned'; readonly MIGRATION_STARTED: 'migration.started'; readonly ONBOARDING_C15T_MODE_CONFIGURED: 'onboarding.c15t_mode_configured'; readonly ONBOARDING_COMPLETED: 'onboarding.completed'; readonly ONBOARDING_CUSTOM_MODE_CONFIGURED: 'onboarding.custom_mode_configured'; readonly ONBOARDING_DEPENDENCIES_CHOICE: 'onboarding.dependencies_choice'; readonly ONBOARDING_DEPENDENCIES_INSTALLED: 'onboarding.dependencies_installed'; readonly ONBOARDING_EXITED: 'onboarding.exited'; readonly ONBOARDING_GITHUB_STAR: 'onboarding.github_star'; readonly ONBOARDING_OFFLINE_MODE_CONFIGURED: 'onboarding.offline_mode_configured'; readonly ONBOARDING_SELF_HOSTED_CONFIGURED: 'onboarding.self_hosted_configured'; readonly ONBOARDING_STAGE: 'onboarding.stage'; readonly ONBOARDING_STARTED: 'onboarding.started'; readonly ONBOARDING_STORAGE_MODE_SELECTED: 'onboarding.storage_mode_selected'; readonly PROJECT_CREATED: 'project.created'; readonly PROJECT_SELECTED: 'project.selected'; readonly PROJECTS_LISTED: 'projects.listed'; readonly SELF_HOST_COMPLETED: 'self-host.completed'; readonly SELF_HOST_FAILED: 'self-host.failed'; readonly SELF_HOST_STARTED: 'self-host.started'; readonly VERSION_DISPLAYED: 'version.displayed'; }; export type TelemetryEventNameType = (typeof TelemetryEventName)[keyof typeof TelemetryEventName]; type EventLike = Record; export interface TelemetryOptions { disabled?: boolean; debug?: boolean; defaultProperties?: EventLike; logger?: CliLogger; endpoint?: string; headers?: Record; fetch?: typeof fetch; storageDir?: string; drainOptions?: DrainPipelineOptions; } export declare class Telemetry { private readonly endpoint; private readonly fetchImpl; private readonly queuePath; private readonly statePath; private readonly headers; private readonly defaultProperties; private readonly sessionId; private readonly installId; private readonly isFirstRun; private readonly drain; private readonly storageDir; private logger; private disabled; private debug; private sequence; private activeCommandName?; private activeCommandRunId?; private flushPromise; private queueReplayPromise; private queueWritePromise; constructor(options?: TelemetryOptions); trackEvent(eventName: TelemetryEventNameType | string, properties?: EventLike): void; trackCommand(command: string, args?: string[], flags?: Record): void; trackError(error: Error, command?: string): void; flushSync(): void; shutdown(): Promise; isDisabled(): boolean; disable(): void; enable(): void; setLogger(logger: CliLogger): void; private applyLoggerConfig; private buildBaseContext; private buildHeaders; private flushAll; private sendBatch; private persistDroppedEvents; private flushQueuedEvents; private readQueuedEvents; private writeQueuedEvents; private loadOrCreateInstallIdentity; private buildErrorMetadata; private sanitizeError; private sanitizeProperties; private sanitizeValue; private sanitizePrimitive; private getEnvironmentName; private isCi; private readString; private logDebug; } export declare const createTelemetry: (options?: TelemetryOptions) => Telemetry; export {};