/**
 * agent-ops — Pure business logic for agent-mode verbs.
 *
 * These functions power `amplitude-wizard detect | status | auth token | auth status`.
 * They return serializable data so thin CLI wrappers can emit JSON (for agents)
 * or format for humans with the same underlying source of truth.
 *
 * No UI, no process.exit, no console.log — keeps the logic testable and reusable
 * from both the CLI and the future external MCP server.
 */
import { type AmplitudeDetectionResult } from './detect-amplitude';
import { type ApiKeySource } from '../utils/api-key-store';
import { type StoredUser } from '../utils/ampli-settings';
import { Integration } from './constants';
import { type WizardPlan, type LoadPlanResult } from './agent-plans.js';
export interface DetectResult {
    integration: Integration | null;
    frameworkName: string | null;
    confidence: 'detected' | 'none';
    signals: Array<{
        integration: Integration;
        detected: boolean;
        durationMs: number;
        timedOut: boolean;
        error?: string;
    }>;
}
export declare function runDetect(installDir: string): Promise<DetectResult>;
export interface StatusResult {
    installDir: string;
    framework: {
        integration: Integration | null;
        name: string | null;
    };
    amplitudeInstalled: AmplitudeDetectionResult;
    apiKey: {
        configured: boolean;
        source: ApiKeySource | null;
    };
    auth: {
        loggedIn: boolean;
        email: string | null;
        zone: string | null;
    };
}
export declare function runStatus(installDir: string): Promise<StatusResult>;
export interface AuthTokenResult {
    token: string | null;
    expiresAt: string | null;
    zone: string | null;
}
export declare function getAuthToken(): AuthTokenResult;
export interface AuthStatusResult {
    loggedIn: boolean;
    user: Pick<StoredUser, 'email' | 'firstName' | 'lastName' | 'zone'> | null;
    tokenExpiresAt: string | null;
}
export interface PlanResult {
    plan: WizardPlan;
    /** True when a framework was detected; false on Generic fallback. */
    detected: boolean;
}
/**
 * Run the planning phase of the wizard: detect framework, surface any
 * pre-existing event hints from `<installDir>/.amplitude/events.json` (or
 * legacy `.amplitude-events.json`) — the record written by `confirm_event_plan`
 * and preserved across cancel/error since PR #274 — persist a `WizardPlan` to disk,
 * and return it for the caller to emit as NDJSON.
 *
 * Pre-existing events make `wizard plan` resumable: a user who confirmed
 * an event plan, hit Ctrl+C, and re-ran `wizard plan` gets their previous
 * selections reflected in the new plan emission. `readLocalEventPlan` shares
 * the same parsing path as the TUI Event Plan viewer, so casing variants
 * the agent emits in the wild (`name`/`event`/`eventName`/`event_name`)
 * all hydrate. Malformed or missing files quietly degrade to `events: []`
 * — they are diagnostic noise, not a reason to fail the plan.
 *
 * No agent run, no file writes outside the plans directory. Outer agents
 * inspect the returned plan and decide whether to call `apply`.
 */
export declare function runPlan(installDir: string): Promise<PlanResult>;
/** Resolve a plan by ID with structured error reporting for the CLI layer. */
export declare function resolvePlan(planId: string): Promise<LoadPlanResult>;
export interface VerifyResult {
    installDir: string;
    framework: {
        integration: Integration | null;
        name: string | null;
    };
    amplitudeInstalled: AmplitudeDetectionResult;
    apiKeyConfigured: boolean;
    /**
     * Summary of the verification outcome. `pass` when SDK is installed AND
     * an API key is configured; otherwise `fail` with structured reasons.
     */
    outcome: 'pass' | 'fail';
    failures: string[];
}
/**
 * Lightweight verification step. Mirrors the checks the wizard runs at the
 * end of an `apply` to confirm the install landed: SDK package present,
 * API key configured, framework still detected.
 *
 * Real ingestion verification (events flowing into the project) requires
 * an authenticated MCP call and is gated by the existing `pollForDataIngestion`
 * helper in `agent-runner.ts`. This op is the cheap, no-network version
 * outer agents can call between `apply` and ingestion polling.
 */
export declare function runVerify(installDir: string): Promise<VerifyResult>;
export interface ProjectChoice {
    /** Numeric Amplitude app ID — the canonical selector. */
    appId: string;
    /** Pre-built one-line label for picker rendering. */
    label: string;
    /** Breadcrumb description: "Org > Workspace > Env". */
    description: string;
    orgId: string;
    orgName: string;
    workspaceId: string;
    workspaceName: string;
    envName: string;
    rank: number;
    /** Per-choice resume flags: `['--app-id', appId]`. */
    resumeFlags: string[];
}
export interface ProjectsListResult {
    /** All choices matching the query (pre-pagination). */
    total: number;
    /** Choices included in this response (after query + pagination). */
    returned: number;
    /** Choice page. */
    choices: ProjectChoice[];
    /** Original query string, echoed back for pagination cursor reasoning. */
    query: string | null;
    /**
     * When set, the call was non-fatally limited (e.g. user not logged in).
     * Callers should surface as a `log` event, not an error.
     */
    warning?: string;
}
export interface ProjectsListInput {
    /** Optional case-insensitive substring match across label fields. */
    query?: string;
    /** Page size. Defaults to 25, capped at 200. */
    limit?: number;
    /** Page offset. Defaults to 0. */
    offset?: number;
}
/**
 * List the authenticated user's accessible Amplitude projects/environments,
 * one row per (org, workspace, env) tuple that has an API key. Powers the
 * `projects list --agent --query <q>` command, which the
 * `environment_selection` `needs_input` event references via
 * `pagination.nextCommand` so outer agents can hand a search box to humans
 * without dumping 500-row lists into context.
 *
 * Reads the cached OAuth token + zone from `~/.ampli.json`; returns a
 * warning instead of throwing when the user is logged out so the CLI can
 * still emit a useful NDJSON envelope.
 */
export declare function runProjectsList(input?: ProjectsListInput): Promise<ProjectsListResult>;
export declare function getAuthStatus(): AuthStatusResult;
