import type { OpenGeniClient } from "@opengeni/sdk"; import { type UsageAllowancePeriod, type WorkspaceUsageResponse } from "@opengeni/sdk/usage-allowances"; import { type UsageSummary } from "../usage/summary.js"; /** * Anything that can read the signed-in member's own usage: the root SDK client * pointed at your session proxy (`getMyUsage`), or any client exposing * `requestJson` (for example the narrower browser client). */ export type UsageClientLike = Pick | Pick; export type UseUsageOptions = { /** Defaults to the `` client. */ client?: UsageClientLike | undefined; /** Defaults to the `` workspace. */ workspaceId?: string | undefined; /** `"current"` (default) or a `YYYY-MM` allowance period. */ period?: UsageAllowancePeriod | undefined; /** Re-read on an interval. Off by default; usage changes only when work settles. */ pollIntervalMs?: number | undefined; enabled?: boolean | undefined; /** * Re-read whenever this value changes, keeping the current reading while it * loads. Pass something that changes when work settles (a turn count, the * session status) so the meter follows real usage without polling. */ refreshKey?: unknown; }; export type UseUsageResult = { /** The raw `/usage/me` response: the workspace pool and your own row. */ usage: WorkspaceUsageResponse | null; /** What to tell this member; null until loaded. */ summary: UsageSummary | null; loading: boolean; error: Error | null; refresh: () => Promise; }; /** * The signed-in member's own usage in one workspace, read through `/usage/me` * (the session proxy serves exactly this route). Never reads another member. */ export declare function useUsage(options?: UseUsageOptions): UseUsageResult;