import type { BackendType } from '../adapters/backend/types.js';
import type { Locale } from '../i18n/index.js';
import { type AttemptTerminalSidecar } from './attempt-terminal.js';
import { type WorkerProcessFactory } from './daemon-spawn.js';
export declare const ATTEMPT_RESUME_SCHEMA_VERSION = 1;
export declare const ATTEMPT_RESUME_IDLE_MS: number;
export declare const ATTEMPT_RESUME_GRACE_MS = 5000;
export declare const RESUME_REQUIRES_CLI_SESSION_ID: Set<string>;
export declare const RESUME_USES_SESSION_ID: Set<string>;
export type AttemptResumeStatus = 'starting' | 'live' | 'closed';
export type AttemptResumeSidecar = {
    schemaVersion: typeof ATTEMPT_RESUME_SCHEMA_VERSION;
    resumeId: string;
    runId: string;
    activityId: string;
    attemptId: string;
    sessionId: string;
    originalSessionId: string;
    cliSessionId?: string;
    webPort?: number;
    writeToken?: string;
    status: AttemptResumeStatus;
    larkAppId: string;
    botName?: string;
    cliId: string;
    workingDir: string;
    logPath: string;
    startedAt: number;
    updatedAt: number;
    closedAt?: number;
    closeReason?: string;
};
export type AttemptResumeBot = {
    larkAppId: string;
    larkAppSecret: string;
    cliId: string;
    cliPathOverride?: string;
    backendType?: BackendType;
    botName?: string;
    botOpenId?: string;
    locale?: Locale;
};
export type AttemptResumeStartResult = {
    ok: true;
    resumeId: string;
    runId: string;
    activityId: string;
    attemptId: string;
    sessionId: string;
    originalSessionId: string;
    cliSessionId?: string;
    webPort: number;
    writeToken: string;
    url: string;
    alreadyRunning: boolean;
    startedAt: number;
    logPath: string;
    sidecarPath: string;
} | {
    ok: false;
    error: string;
    hint?: string;
    message?: string;
};
export type AttemptResumeEndResult = {
    ok: true;
    resumeId: string;
    status: 'closed';
    closeReason: string;
    closedAt: number;
} | {
    ok: false;
    error: string;
    hint?: string;
    message?: string;
};
export type AttemptResumeManagerDeps = {
    runsDir: string;
    externalHost: string;
    workerPath?: string;
    factory?: WorkerProcessFactory;
    idleMs?: number;
    graceMs?: number;
    resolveBot(larkAppId: string, terminal: AttemptTerminalSidecar): AttemptResumeBot | undefined;
    now?: () => number;
};
export declare class AttemptResumeManager {
    private readonly deps;
    private entries;
    private readonly factory;
    private readonly workerPath;
    private readonly idleMs;
    private readonly graceMs;
    private readonly now;
    constructor(deps: AttemptResumeManagerDeps);
    start(input: {
        runId: string;
        activityId: string;
        attemptId: string;
    }): Promise<AttemptResumeStartResult>;
    end(input: {
        runId: string;
        activityId: string;
        attemptId: string;
        reason?: string;
    }): Promise<AttemptResumeEndResult>;
    private attachWorker;
    private bumpIdle;
    private closeEntry;
    private writeSidecar;
    private resumeUrl;
}
export declare function isResumeCapableCli(cliId: string | undefined): boolean;
export declare function cliRequiresNativeSessionId(cliId: string | undefined): boolean;
//# sourceMappingURL=attempt-resume.d.ts.map