import type { ExtensionAPI, ExtensionContext } from "../../types.ts";
import { type GoalContinuationFireNowResult } from "./rpc-wait-surface.ts";
export { GOAL_MONITOR_BACKSTOP_DEFAULT_DELAY_MS, GOAL_MONITOR_CONTINUATION_FALLBACK_DELAY_MS, } from "./cache-warm.ts";
import type { AgentEndOptions, DelayedContinuationKind, ProviderRecoveryOptions, SystemAbortOptions } from "./monitor-continuation-types.ts";
import type { Goal } from "./types.ts";
import type { GoalWaitTicker } from "./wait-ticker.ts";
export declare const GOAL_CONTINUATION_SCHEDULED_EVENT = "goal_continuation_scheduled";
export declare const GOAL_CONTINUATION_RESUMED_EVENT = "goal_continuation_resumed";
export declare const GOAL_CONTINUATION_TIMER_STATE_EVENT = "goal_continuation_timer_state";
export declare const GOAL_MONITOR_STALL_EVENT = "goal_monitor_continuation_stall";
export declare class MonitorAwareGoalContinuation {
    #private;
    constructor(pi: ExtensionAPI, isContinuationPending?: () => boolean, markContinuationPending?: () => void, waitTicker?: GoalWaitTicker);
    start(ctx: ExtensionContext): void;
    afterAgentEnd(options: AgentEndOptions): Promise<Goal | null>;
    afterSystemAbort(options: SystemAbortOptions): Promise<Goal | null>;
    afterProviderFailure(options: ProviderRecoveryOptions): Promise<Goal | null>;
    afterAgentSettled(fallbackExhausted?: {
        resumeAt?: number;
    }): Promise<Goal | null | undefined>;
    syncGoal(goal: Goal | null): void;
    /** The continuation timer armed right now, if any (monitor backstop, user grace, provider retry). */
    scheduledContinuation(): DelayedContinuationKind | undefined;
    /** A system or provider recovery staged for `agent_settled`. */
    hasStagedRecovery(): boolean;
    /** Live resumption channels known to this generation (e.g. terminal snapshots replayed on reload). */
    hasActiveWakeSources(): boolean;
    /**
     * Re-arms the monitor-delayed backstop a reload tore down with the retired
     * generation, so a later wake-source drain can still deliver the goal
     * continuation. No-op unless the goal is active, a wake source is live, and
     * no continuation is already scheduled. A wait the branch still records as
     * parked is restored as-is (iteration, cache snapshot, original due time) so
     * a reload never appends a second card or pushes the wake past the cache TTL.
     */
    rearmMonitorBackstop(goal: Goal): void;
    /** Temporarily prevents a scheduled continuation from racing unresolved direct-input admission. */
    holdDirectInput(inputId: string): void;
    /** Resolves one admission hold without allowing overlapping inputs to consume each other. */
    resolveDirectInput(inputId: string, accepted: boolean): void;
    /** An accepted real user prompt starts a grace-governed user turn. */
    noteUserPrompt(): void;
    /** A hidden continuation or system recovery has started, so the next end is not user-initiated. */
    noteContinuationStarted(): void;
    dispose(): void;
    liveWakeSources(): string[];
    /**
     * Runs the armed continuation now, through the same eligibility checks as its timer (the
     * desktop's "Check now"). A held timer (the user is typing) stays held.
     */
    fireNow(): Promise<GoalContinuationFireNowResult>;
}
//# sourceMappingURL=monitor-continuation.d.ts.map