import { type SubscriptionReconnectAccount } from "@opengeni/contracts/subscription-capacity-wait"; /** The same wait guidance for worker events, parent notices and the inbox. */ export declare function subscriptionCapacityWaitReasonText(reason: string, name: string, account?: SubscriptionReconnectAccount): string | null; export declare function subscriptionCapacityWaitNeedsAction(reason: string): boolean; /** * When a subscription capacity wait needs a person's (or a parent agent's) * attention, and the notices that tell them. * * A short wait (capacity returns within minutes) resumes by itself and stays * quiet. A long one, whose reset is far away, unknown, or that only a person * can fix, is announced once when it is armed: a worker's parent gets a * `child_waiting_capacity` notice, and a top-level chat's person gets an inbox * notification. Both carry the reset time and say how to continue sooner * (switch the chat's model, which releases the waiting turn onto it). * The person's notification never keeps promising a time that no longer * holds: when a later check finds the reset later than it said (its time * passed without capacity, or a longer limit binds) or unknown, the same * notification is updated in place (`capacityWaitNoticeNeedsRestating`). */ export declare const CAPACITY_WAIT_ATTENTION_AFTER_MS: number; /** Turn metadata recording the person's open capacity-wait notification. */ export declare const CAPACITY_WAIT_NOTICE_KEY = "capacityWaitNoticeV1"; /** * Turn metadata recording the reset a worker's parent was last told in a * `child_waiting_capacity` notice (the same marker shape, keyed by the * notice's dedupe key). Nothing is withdrawn for it when the wait ends. */ export declare const CAPACITY_WAIT_PARENT_NOTICE_KEY = "capacityWaitParentNoticeV1"; export type CapacityWaitAttention = { /** When capacity is expected back, when anything says so. */ resetsAt: Date | null; }; /** Null when the wait is short and resumes by itself. */ export declare function capacityWaitAttention(input: { waitReason: string; earliestResetAt: Date | null; healthRetryAt: Date | null; now: Date; }): CapacityWaitAttention | null; export declare function capacityWaitProviderName(provider: string): string; /** `2026-11-09 06:54 UTC`: the reset time as people read it. */ export declare function capacityWaitResetText(resetsAt: Date | string | null): string | null; export declare function capacityWaitNotificationKey(turnId: string): string; /** * The person's inbox notification for a top-level chat's long capacity wait. * A busy pool says plainly that the message will be answered as soon as an * account has room, and names a time only when placement knows the earliest * reset of an account that can serve the turn. Any other reason keeps its * own explanation. */ export declare function capacityWaitNotificationPayload(input: { turnId: string; provider: string; resetsAt: Date | null; waitReason?: string; reconnectAccount?: SubscriptionReconnectAccount; }): { key: string; title: string; body: string; urgency: "normal"; replaced: boolean; }; /** * The open notification of a waiting turn: its key, and the reset it told * the person (ISO, or null for "no reset time is known"). `resetsAt` is * undefined for a marker written before the notice recorded it. */ export type CapacityWaitNoticeMarker = { key: string; resetsAt?: string | null; explanation?: string; }; export declare function readCapacityWaitNotice(metadata: Record | null | undefined, metadataKey?: string): CapacityWaitNoticeMarker | null; /** The turn metadata marker of a notification that told the person `resetsAt`. */ export declare function capacityWaitNoticeMarker(key: string, resetsAt: Date | null, explanation?: string): { key: string; resetsAt: string | null; explanation?: string; }; /** * Whether the person's open notification, which told them `stated`, must be * updated for a wait now expected to end at `next`. It must when the wait * now ends later than it said (to the minute it shows), including after its * time passed without capacity, when the reset became unknown or known, and * when the marker does not record what it said. An earlier reset keeps it: * the turn then continues before the time it named. */ export declare function capacityWaitNoticeNeedsRestating(stated: CapacityWaitNoticeMarker, next: Date | null): boolean; export declare function withoutCapacityWaitNotice(metadata: Record): Record; /** The event row (without sequence) withdrawing an open notice, if any. */ export declare function capacityWaitNoticeWithdrawal(metadata: Record | null | undefined): { type: "session.notification.withdrawn"; payload: { key: string; }; } | null;