import { TelemetryEvent, TelemetryEventName } from "./payload"; export { TELEMETRY_SCHEMA_VERSION, bucket, durationBucket, errorClass, buildEvent, sanitize } from "./payload"; export type { TelemetryEvent, TelemetryEventName, TelemetryValue } from "./payload"; export { configPath, readConfig, writeConfig } from "./identity"; export type { TelemetryConfig } from "./identity"; export { readProjectPolicy } from "./project"; export type { ProjectTelemetryPolicy } from "./project"; /** * Where events go. Overridable so a fork can point at its own collector, and so * the tests never touch the network. */ export declare const DEFAULT_TELEMETRY_ENDPOINT = "https://app.rebase.pro/api/functions/telemetry"; export declare function endpoint(): string; /** Why nothing would be sent right now, or `null` when it would. */ export type SuppressionReason = "not_asked" | "declined" | "do_not_track" | "rebase_telemetry_disabled" | "ci" | "project_opt_out"; /** * The one function that decides whether anything leaves the machine. * * Every path is a refusal except the last, which is the point: consent is * opt-in, so the default answer at every branch — never asked, unreadable * config, a set env var, a CI runner — is no. * * `DO_NOT_TRACK` is honoured because it is the cross-tool convention * (consoledonottrack.com); a user who has set it globally has already answered * this question and should not be asked again by us. * * `CI` is refused for a different reason: a build runner is not a person, and * counting one is both useless and misleading. A single pipeline re-running on * every push would otherwise outweigh every real developer in the data. * * A project's own `"telemetry": false` is checked *before* the machine setting, * because it has to beat an individual opt-in to be worth anything — see * project.ts on why the reverse is refused. */ export declare function suppressionReason(env?: NodeJS.ProcessEnv, cwd?: string): SuppressionReason | null; export declare function isEnabled(env?: NodeJS.ProcessEnv, cwd?: string): boolean; /** * Record the user's answer. `false` is final — nothing prompts again. * * Returns whether the choice could actually be persisted. A read-only or full * home directory makes `writeConfig` throw, and the direction of that failure * matters enormously: someone turning sharing **off** who sees a stack trace, * or worse sees nothing, is left sharing. The caller is expected to say so and * point at `REBASE_TELEMETRY_DISABLED`, which needs no disk. */ export declare function setConsent(enabled: boolean): boolean; /** * Build the event that *would* be sent, without sending it. * * This is what `rebase telemetry show` prints, and it is deliberately the same * function the sender uses — a preview assembled by separate code is a promise * that drifts. Returns `null` when nothing would be sent, so the command can * say why instead of showing a payload that is never going anywhere. */ export declare function previewEvent(event: TelemetryEventName, properties?: Record, projectRoot?: string): TelemetryEvent | null; /** * Send one event, or quietly do nothing. * * Three properties this must hold, in order of importance: * * 1. **It never throws.** Telemetry failing is not a reason for `rebase dev` * to fail. Every error is swallowed. * 2. **It never blocks meaningfully.** A two-second ceiling, after which the * command carries on regardless — a collector having a bad day must not * become the CLI hanging. * 3. **It never sends without consent.** Enforced here rather than at the call * sites, so a new call site cannot get it wrong. */ export declare function recordEvent(event: TelemetryEventName, properties?: Record, options?: { projectRoot?: string; timeoutMs?: number; }): Promise;