import type { InflightDispatchMeta, RetryScheduler } from './dispatch-preflight.js'; export declare const SESSION_LIMIT_REASON = "session_limit"; export declare const DEFAULT_SESSION_DEFER_MS: number; export declare const MAX_SESSION_DEFER_MS: number; export interface HarnessResetParse { resetLabel: string; resetAtMs: number; } export declare function parseHarnessResetTime(text: string | null | undefined, nowMs: number): HarnessResetParse | null; export declare function resolveDeferUntil(nowMs: number, parsedResetAtMs: number | null | undefined): number; export interface HarnessSessionLimitDetection { reason: string; resetLabel: string; deferUntilMs: number; } export declare function detectHarnessSessionLimit(tail: string | null | undefined, code: number | null, nowMs: number): HarnessSessionLimitDetection | null; export type SessionDeferIntentKind = 'trigger' | 'mention'; export type SessionDeferIntentStatus = 'pending' | 'dispatching'; export interface SessionDeferIntent { key: string; raw: string; ticketId: string; role: string; agentId: string; firstAtMs: number; kind: SessionDeferIntentKind; status: SessionDeferIntentStatus; spawnedPid?: number | null; } export interface SessionDeferState { deferred: boolean; deferUntilMs?: number; reason?: string; resetLabel?: string; } export type SessionDeferResumeResult = { pid?: number | null; } | void; export type SessionDeferResumeHandler = (intent: SessionDeferIntent, onSpawned: (pid: number | null | undefined) => void) => Promise | SessionDeferResumeResult; export type SessionDeferReapPid = (pid: number) => boolean; export interface SessionLimitDeferStoreOptions { persistPath?: string | null; now?: () => number; scheduler?: RetryScheduler; reapPid?: SessionDeferReapPid; log?: (msg: string) => void; } export declare class SessionLimitDeferStore { #private; constructor(opts?: SessionLimitDeferStoreOptions); setResumeHandler(fn: SessionDeferResumeHandler): void; load(): void; recordSessionLimit(agentId: string, args: { deferUntilMs: number; reason?: string; resetLabel?: string; nowMs?: number; }): { opened: boolean; }; deferState(agentId: string | undefined, nowMs?: number): SessionDeferState; addPendingIntent(agentId: string | undefined, meta: InflightDispatchMeta, raw: string, opts?: { kind?: SessionDeferIntentKind; nowMs?: number; }): { created: boolean; }; cancelByTicket(ticketId: string | undefined, reason?: string): number; clear(agentId: string | undefined): void; isDeferred(agentId: string | undefined, nowMs?: number): boolean; deferUntil(agentId: string | undefined): number | null; pendingIntentCount(agentId?: string): number; deferredAgentIds(): string[]; }