import type { CreatorData } from "./analytics-collector.js";
/** Stable, machine-checkable failure codes the collector boundary can emit.
 *  The first six mirror the Python collector's `error_exit(code, …)` envelope
 *  (collect.py / platforms/douyin.py); PARSE_ERROR is added by THIS boundary
 *  when the script's stdout is neither a valid success object nor a recognised
 *  error envelope (crash, traceback, truncated JSON, …). */
export type CollectorErrorCode = "NOT_LOGGED_IN" | "COOKIE_NOT_FOUND" | "API_ERROR" | "INVALID_URL" | "NO_URL" | "DEPENDENCY_ERROR" | "BROWSER_NOT_FOUND" | "PLATFORM_NOT_SUPPORTED" | "PARSE_ERROR";
export interface CollectorError {
    /** Discriminant so `CreatorData | CollectorError` is a checkable union. */
    kind: "collector_error";
    /** Machine code — drives the i18n key + the UI's branch (re-login vs fix-URL). */
    code: CollectorErrorCode;
    /** Human, already-actionable message straight from the collector (or this
     *  boundary). The Settings UI localizes off `code` but falls back to this. */
    message: string;
    /** True when the user can self-heal by logging into douyin.com again and
     *  closing the browser (auth / cookie failures). The UI shows a "重新登录"
     *  prompt only for these. */
    needsRelogin: boolean;
}
/** Narrowing helper so callers can branch on the union without poking `kind`. */
export declare function isCollectorError(v: CreatorData | CollectorError): v is CollectorError;
/**
 * Parse one collector run's raw output into a typed `CreatorData` or a
 * structured `CollectorError`. PURE — never spawns, never touches disk.
 *
 * Accepts either:
 *   * the already-parsed object the script printed, OR
 *   * the raw stdout string (we JSON.parse it; non-JSON → PARSE_ERROR).
 *
 * Recognises the Python collector's error envelope `{error, message, platform}`
 * and maps auth/cookie failures to `needsRelogin: true`. Anything that's
 * neither a valid success object nor a known error envelope → PARSE_ERROR.
 */
export declare function parseCollectorResult(raw: unknown): CreatorData | CollectorError;
//# sourceMappingURL=collector-parse.d.ts.map