UNPKG

@code-yeongyu/senpi

Version:

Coding agent CLI with read, bash, edit, write tools and session management

28 lines • 1.7 kB
/** * The limit windows a subscription reports with its responses, read into one shape: which window * (5-hour, weekly, ...), how much of it is used, and when it resets. ChatGPT subscriptions (Codex) send * `x-codex-primary-*`/`x-codex-secondary-*` headers (percent used, window minutes, reset epoch seconds), * one family per metered limit; Claude subscriptions send * `anthropic-ratelimit-unified-{5h,7d}-*` headers (utilization as a 0-1 fraction, reset epoch seconds), and * the Claude SDK a `rate_limit_event`. A window nothing reported is absent, never 0%. */ export interface LimitWindow { /** Stable key within an account: `<limit>:<window>` (`codex:primary`, `claude:5h`). */ readonly id: string; /** What the window is, as a person reads it: `5h`, `7d`, `7d opus`. */ readonly label: string; readonly windowMinutes?: number; /** 0-100. */ readonly usedPercent: number; /** ISO timestamp. */ readonly resetsAt?: string; } /** `300` -> `5h`, `10080` -> `7d`, otherwise minutes. */ export declare function windowLabel(minutes: number | undefined, fallback: string): string; /** Every Codex limit family the response headers carry. */ export declare function codexWindowsFromHeaders(raw: Readonly<Record<string, string>>): LimitWindow[]; /** Claude's unified rate-limit headers (utilization is a 0-1 fraction). */ export declare function claudeWindowsFromHeaders(raw: Readonly<Record<string, string>>): LimitWindow[]; /** The Claude SDK's `rate_limit_event` (`rate_limit_info`: type, 0-1 utilization, reset epoch seconds). */ export declare function claudeWindowsFromSdkEvent(data: unknown): LimitWindow[]; //# sourceMappingURL=limit-windows.d.ts.map