/** * `bitmagic usage` — where this account's sparks went. * * The server does the aggregating (GET /api/cli/v1/sparks/usage), and the plan * page on the web renders the SAME payload, so the two surfaces cannot disagree * about what a category means or which window is which. * * Rendering is a pure function over the response, following the bake-progress * convention: formatting is testable without a network, and printing is one * call. Plain aligned text and no colour — an agent tool is usually what reads * this, and render/inline-image.ts is documented as the only place in the * package that writes escape sequences. */ interface UsageWindow { limit: number; used: number; remaining: number; /** Epoch ms, or null when the window is closed and reopens on next use. */ resetsAt: number | null; } interface UsageAllowance { total: number; long: UsageWindow; short: UsageWindow; } export interface UsageResponse { success: boolean; userId: string; period: { days: number; fromMs: number; toMs: number; }; totalSparks: number; fromAllowance: number; fromPurchased: number; byCategory: Array<{ category: string; label: string; sparks: number; }>; byDay: Array<{ day: string; sparks: number; }>; allowance: UsageAllowance | null; /** * Whether purchased sparks are allowed to fund work once the allowance runs * out. Optional because an older api-server does not send it, and a report is * not the place to fail over a missing field — an absent value is rendered as * nothing rather than guessed at. */ spillAllowed?: boolean; } /** "2h 10m" / "40m" / "4d" — coarse on purpose; this is a report, not a countdown. */ export declare function formatResetIn(resetsAt: number | null, now: number): string; /** * PURE. The whole report as text. * * `now` is a parameter rather than a `Date.now()` call so reset times are * testable, and so every line of one report agrees on a single instant. */ export declare function formatUsageReport(report: UsageResponse, now?: number): string; export interface UsageOptions { days?: number; env?: string; } export declare function runUsage(options?: UsageOptions): Promise; export declare const usageCommand: import("citty").CommandDef<{ readonly days: { readonly type: "string"; readonly description: "How many days to report on (default 30, max 90)."; }; readonly env: { readonly type: "string"; readonly description: "Environment to query (dev, prod, local)."; }; readonly json: { readonly type: "boolean"; readonly description: "Print the result as JSON on stdout; all progress goes to stderr."; }; }>; export {};