import { withSupabaseSource } from './supabase-perf';
type InvocationSource = 'cli' | 'mcp';
export declare function setInvocationSource(source: InvocationSource): void;
export declare function getInvocationSource(): InvocationSource;
export declare function isTelemetryDisabled(): boolean;
export interface GlobalAnalyticsProps {
    cli_version: string;
    node_version: string;
    os_platform: string;
    os_arch: string;
    is_ci: boolean;
    is_tty: boolean;
    invocation_source: InvocationSource;
    ci_provider?: string;
}
export declare function getGlobalAnalyticsProps(): GlobalAnalyticsProps;
export declare function flushAnalytics(timeoutMs?: number): Promise<void>;
export declare function resolveTrackingContext(apikey: string, signal?: AbortSignal): Promise<{
    appId?: string;
    orgId?: string;
}>;
export interface TrackEventInput {
    channel: string;
    event: string;
    icon?: string;
    /** Org id for actor-scoped attribution. Omitted => resolved best-effort. */
    orgId?: string;
    /** App id (also lets the backend verify org ownership). */
    appId?: string;
    /** Explicit key; falls back to the saved key. No key => no event. */
    apikey?: string;
    tags?: Record<string, string | number | boolean>;
}
/**
 * Generic v2 actor-scoped event. Never throws. Does nothing when telemetry is
 * disabled or no API key is resolvable (the accepted unauthenticated gap).
 * When the caller omits appId/orgId, both are resolved best-effort from the
 * local Capacitor config (app_id → owner_org) so local commands still get
 * user + org attribution when the user is logged in.
 */
export declare function trackEvent(input: TrackEventInput): Promise<void>;
export interface CommandContext {
    flags: string[];
    positional_arg_count: number;
}
interface CommanderLike {
    args: readonly string[];
    opts: () => Record<string, unknown>;
    getOptionValueSource: (key: string) => string | undefined;
}
/**
 * Pulls only privacy-safe context from a Commander command: the NAMES of
 * user-provided flags (never their values) and the positional arg count.
 */
export declare function extractCommandContext(command: CommanderLike): CommandContext;
export declare function trackCommandInvoked(commandPath: string, ctx: CommandContext): void;
export declare function trackCommandSucceeded(commandPath: string): void;
export declare function trackCommandFailed(commandPath: string, opts: {
    errorCategory: string;
    exitCode: number;
}): void;
type AnyAsyncFn = (...args: any[]) => Promise<any>;
/**
 * Wraps an MCP tool handler to emit a `MCP Tool Invoked` event with the tool
 * name, success flag, and duration. Re-throws so behavior is unchanged.
 */
export declare function withMcpToolTracking<H extends AnyAsyncFn>(toolName: string, handler: H): H;
export declare function trackMcpServerStarted(hasApikey: boolean): void;
export { withSupabaseSource };
export { enableSupabaseInstrumentation } from './supabase-perf';
