import { type TokenProvider } from "@anysphere/analytics-client";
/**
 * Drains buffered SDK analytics events for every apiKey that has emitted
 * anything in this process. Called from `agent[Symbol.asyncDispose]()`.
 *
 * `timeoutMs` bounds the wait; if the RPC hangs, flush aborts via the
 * internal AbortController and returns. Never throws.
 */
export declare function flushSdkAnalytics(timeoutMs?: number): Promise<void>;
export declare function __resetAnalyticsForTests(): void;
/**
 * Four dispatch targets, flattened into one field so a single
 * `WHERE runtime = 'X'` or `WHERE runtime != 'local'` query covers both
 * "which execution environment?" and "is this local?" questions without
 * awkwardly repeating "cloud" at two nesting levels.
 */
export type SdkRuntime = "local" | "cloud" | "pool" | "machine";
/**
 * Base props auto-merged into every SDK event by the analytics wrapper.
 * Callers never pass these. Kept as an interface (not derived) so the DBT
 * generator at `scripts/generate-dbt-from-analytics-types.ts` can resolve
 * them — its AST walker only looks at interface declarations in the same
 * source file.
 */
export interface SdkAnalyticsBaseProps {
    /** Runtime surface emitting telemetry. Always "sdk" for this package. */
    surface: "sdk";
    /** Version of @cursor/sdk that emitted the event. */
    sdk_version: string;
    /** Node process.platform (e.g., "darwin", "linux", "win32"). */
    os_platform: string;
    /** Node process.arch (e.g., "x64", "arm64"). */
    os_arch: string;
}
export interface SdkRunCreatedProps {
    agent_id: string;
    run_id: string;
    /** Backend request id used for the SDK turn, when the runtime exposes it. */
    request_id?: string;
    runtime: SdkRuntime;
    model: string;
    /**
     * JSON-encoded `ModelSelection.params` (`[{ id, value }, ...]`) when the
     * caller supplied any. Omitted when no params were set.
     */
    model_params?: string;
    prompt_length: number;
    has_images: boolean;
    is_resume: boolean;
    mcp_server_count: number;
    cloud_repo_count?: number;
    cloud_auto_create_pr?: boolean;
}
export interface SdkRunCompletedProps {
    agent_id: string;
    run_id: string;
    /** Backend request id used for the SDK turn, when the runtime exposes it. */
    request_id?: string;
    runtime: SdkRuntime;
    end_reason: "success" | "error" | "abort";
}
export interface SdkRunSendLatencyProps {
    agent_id: string;
    run_id: string;
    /** Backend request id used for the SDK turn, when the runtime exposes it. */
    request_id?: string;
    runtime: SdkRuntime;
    is_resume: boolean;
    is_first_send_after_resume: boolean;
    cold_executor: boolean;
    executor_acquire_ms: number;
    load_latest_ms: number;
    get_blob_store_ms: number;
    pre_send_ms: number;
    time_to_first_message_ms?: number;
    terminated_reason: "success" | "error" | "abort" | "hang_timeout";
    turn_count: number;
}
export interface SdkExecutorStartupProps {
    runtime: SdkRuntime;
    ensure_ghost_mode_ms: number;
    bootstrap_statsig_ms: number;
    create_workspace_runtime_ms: number;
    load_sandbox_policy_ms: number;
    total_ms: number;
}
/**
 * Schema consumed by the DBT generator. The runtime emit path in this file
 * auto-merges SdkAnalyticsBaseProps into every event, so this intersection
 * mirrors the actual wire shape and generates the right SQL columns.
 *
 * Do not reference this from runtime code — it exists purely for dbt.
 */
export type SdkAnalyticsEventSchema = {
    "sdk.run.created": SdkAnalyticsBaseProps & SdkRunCreatedProps;
    "sdk.run.completed": SdkAnalyticsBaseProps & SdkRunCompletedProps;
    "sdk.run.send_latency": SdkAnalyticsBaseProps & SdkRunSendLatencyProps;
    "sdk.executor.startup": SdkAnalyticsBaseProps & SdkExecutorStartupProps;
};
export declare function trackSdkRunCreated(apiKey: string | undefined, props: SdkRunCreatedProps): void;
export declare function trackSdkRunCompleted(apiKey: string | undefined, props: SdkRunCompletedProps): void;
export declare function trackSdkRunSendLatency(apiKey: string | undefined, props: SdkRunSendLatencyProps): void;
export type { TokenProvider };
//# sourceMappingURL=analytics.d.ts.map