/** * ONE pending-approvals poller per client. * * Every surface that shows the attention count reads the same asks: the * launcher badge, the center's "Needs you" rail, the toast feed. Each of those used to hold its OWN `useResource`, so a host mounting * both the overlay and the center ran three or four independent `GET /approvals` * intervals forever — 36 requests a minute with nothing waiting. * * This is the same shape as the run-activity store: a module singleton per * client, N subscribers, one request. The cadence is the FASTEST any subscriber * asked for (a surface that wants 5s still gets 5s), polling pauses while the * document is hidden, and the last unsubscribe stops it entirely. */ import type { ApprovalRequest } from "../../core/index.js"; import type { VendoClient } from "../client.js"; import { type IdentityState } from "./identity-state.js"; export interface ApprovalsSnapshot { data: ApprovalRequest[]; error: Error | undefined; isLoading: boolean; } /** Stable first-render / SSR snapshot (useSyncExternalStore compares identity). */ export declare const APPROVALS_LOADING: ApprovalsSnapshot; declare class ApprovalsFeed { private readonly list; /** The per-client forbidden latch (H2-E / #1372): a signed-out visitor's * feed goes quiet after the first refusal instead of retrying forever, * and wakes on the page's identity signal like every other poller. */ private readonly identity; private snapshot; /** Subscriber → the cadence it asked for (0 = read-only, no polling). */ private readonly cadences; private timer; private generation; private stopIdentity; constructor(list: () => Promise, /** The per-client forbidden latch (H2-E / #1372): a signed-out visitor's * feed goes quiet after the first refusal instead of retrying forever, * and wakes on the page's identity signal like every other poller. */ identity: IdentityState); read: () => ApprovalsSnapshot; subscribe: (listener: () => void, pollMs: number) => (() => void); refresh: () => Promise; private publish; private arm; private stop; /** The fastest cadence anybody asked for; undefined = nobody polls. */ private cadence; private onVisibility; } export declare function approvalsFeed(client: VendoClient): ApprovalsFeed; export type { ApprovalsFeed };