import type { ProviderId } from "@opengeni/subscriptions"; import { type Database, type SessionActivityDatabase } from "../database.js"; /** * Delete the shared subscription core's waiters for one provider of turns * whose wait a human or control transition ended (Steer, Cancel), inside * that transition. A core waiter exists only while its turn waits, so unlike * the legacy waiter there is no `superseded` status to keep; its pending * wake deliveries cascade. Runs under the caller's workspace RLS. */ export declare function deleteSubscriptionCoreWaitersForTurns(db: Database | SessionActivityDatabase, provider: ProviderId | null, input: { workspaceId: string; turnIds: readonly string[]; sessionId?: string; }): Promise; /** A capacity change of one provider's pool that its waiting turns may need. */ export type SubscriptionCoreCapacityWake = { accountId: string; /** A bounded identifier recorded on each woken waiter. */ reason: string; /** Only these workspaces; every workspace of the organization when absent. */ workspaceIds?: readonly string[]; /** * Only these sessions' waiters (for example a session pin, which changes * nothing another session can place on). Requires exactly one workspace in * `workspaceIds`. */ sessionIds?: readonly string[]; /** * Only waiters of sessions owned by this organization membership (for * example a person's own preference change, which can make only their own * sessions placeable). Composes with `workspaceIds` and `sessionIds`. */ ownerMembershipId?: string; }; /** One workspace whose core waiters were woken; deliver its outbox after commit. */ export type SubscriptionCoreWakeScope = { accountId: string; workspaceId: string; }; /** * Records the generic durable session workflow wake in the caller's * transaction (the session workflow wake outbox producer). */ export type SubscriptionCoreSessionWorkflowWake = (tx: Database, input: { accountId: string; workspaceId: string; sessionId: string; temporalWorkflowId: string; reason: string; }) => Promise; /** * Capacity changed for one provider's pool of the account (a quota * exhaustion ended, a quarantine cleared, a plan changed, a binding or * assignment changed): advance the wake revision of every waiting core * waiter of that provider, record the typed wake in the provider-neutral * outbox and the generic session workflow wake in the same transaction. * Wakes only request re-evaluation; each waiter re-places under its own * accepted turn. Runs in the trusted empty-subject worker scope per * workspace (the outbox's own policy), never through legacy active pointers. * Returns * the workspaces whose outbox the caller should drain after commit. */ export declare function wakeSubscriptionCoreCapacityWaiters(db: Database, provider: ProviderId, input: SubscriptionCoreCapacityWake, enqueueSessionWorkflowWake: SubscriptionCoreSessionWorkflowWake): Promise;