import { spawn as spawnChildProcess } from "node:child_process";
import type { IAgentRuntime } from "@elizaos/core";
import type { PreflightResult } from "coding-agent-adapters";
import type { SupportedTaskAgentAdapter } from "./task-agent-frameworks.ts";
export type TaskAgentAuthStatusValue = "authenticated" | "unauthenticated" | "unknown";
export interface TaskAgentAuthStatus {
    status: TaskAgentAuthStatusValue;
    method?: string;
    detail?: string;
    loginHint?: string;
}
export interface TaskAgentAuthLaunchResult {
    launched: boolean;
    url?: string;
    deviceCode?: string;
    instructions?: string;
    browserOpened?: boolean;
    browserClicked?: boolean;
    browserDetail?: string;
    recoveryTarget?: "same_session" | "replacement_session";
    replacementSessionId?: string;
    replacementFramework?: string;
}
export interface TaskAgentAuthFlowHandle {
    agentType: SupportedTaskAgentAdapter;
    startedAt: number;
    completion: Promise<{
        code: number | null;
        signal: NodeJS.Signals | null;
    }>;
    snapshot: () => TaskAgentAuthLaunchResult;
    stop: () => void;
}
type ExecFileFn = (file: string, args: string[], options?: {
    encoding?: BufferEncoding;
    env?: NodeJS.ProcessEnv;
    timeout?: number;
}) => Promise<{
    stdout: string;
    stderr: string;
}>;
type SpawnFn = typeof spawnChildProcess;
type FetchFn = typeof fetch;
interface TaskAgentAuthDeps {
    execFile: ExecFileFn;
    fetch: FetchFn;
    spawn: SpawnFn;
}
interface TaskAgentAuthOptions {
    deps?: Partial<TaskAgentAuthDeps>;
    env?: NodeJS.ProcessEnv;
    runtime?: IAgentRuntime;
}
export declare function normalizeTaskAgentAdapterId(value: string | undefined): SupportedTaskAgentAdapter | null;
export declare function getTaskAgentLoginHint(agentType: SupportedTaskAgentAdapter): string | undefined;
export declare function probeTaskAgentAuth(agentType: SupportedTaskAgentAdapter, options?: TaskAgentAuthOptions): Promise<TaskAgentAuthStatus>;
export declare function launchTaskAgentAuthFlow(agentType: SupportedTaskAgentAdapter, options?: TaskAgentAuthOptions): Promise<{
    handle: TaskAgentAuthFlowHandle | null;
    result: TaskAgentAuthLaunchResult;
}>;
export declare function assistTaskAgentBrowserLogin(agentType: SupportedTaskAgentAdapter, rawUrl: string, options?: TaskAgentAuthOptions): Promise<{
    opened: boolean;
    clicked: boolean;
    detail?: string;
}>;
export declare function augmentTaskAgentPreflightResults(results: PreflightResult[], options?: TaskAgentAuthOptions): Promise<PreflightResult[]>;
export {};
//# sourceMappingURL=task-agent-auth.d.ts.map