import type { SessionRow } from "./cms.js"; import type { PilotSwarmSessionStatus, SessionResponsePayload, SessionStatusSignal } from "./types.js"; type TerminalSessionLike = { parentSessionId?: string | null; isSystem?: boolean; rowState?: string | null; status?: string | null; orchestrationStatus?: string | null; cronActive?: boolean; cronInterval?: number; turnResultType?: string | null; latestResponseType?: SessionResponsePayload["type"] | null; }; export declare function isCompletedTerminalSession(input: TerminalSessionLike): boolean; export declare function deriveSessionStatus(input: TerminalSessionLike): PilotSwarmSessionStatus; export declare function shouldSyncCompletedStatus(input: TerminalSessionLike): boolean; export declare function shouldSyncFailedStatus(input: TerminalSessionLike): boolean; export declare function deriveStatusFromCmsAndRuntime(opts: { row?: SessionRow | null; customStatus?: SessionStatusSignal | any; latestResponse?: SessionResponsePayload | null; orchestrationStatus?: string | null; }): PilotSwarmSessionStatus; /** * A row parked on error/failed while the orchestration is still Running is * usually stale: the worker died mid-turn and the runtime re-dispatched. * Returns the state to write back, or null when the row must be left alone. * * Null when the runtime ITSELF says error/failed. The worker just wrote that * row (a turn ended in error, retries pending) and the detail read reports * the same error to the caller. Rewriting the row to "running" here made the * list (row-based) and the detail (runtime-based) disagree, and the portal * flipped the Warning card off and on with every poll. */ export declare function resolveStaleRunningRowRecovery(input: { rowState?: string | null; status?: string | null; orchestrationStatus?: string | null; }): string | null; /** A previous response stays in KV during the next turn; it is not live input. */ export declare function resolvePendingQuestion(status: string, customStatus: any, latestResponse: any): { question: string; choices?: string[]; allowFreeform?: boolean; iteration?: number; } | undefined; export {}; //# sourceMappingURL=session-status.d.ts.map