tarlatan
    Preparing search index...

    Function currentPeriod

    • The current period of provider's window, or Option.none() when there is no reading of it. Window names are shared across providers, so the fold keeps only the readings of the named provider and window; a Codex reading never touches a Claude period. It folds readings in the order given and does not sort them; the caller passes them in ledger seq order.

      Parameters

      • readings: readonly {
            observedAt: number;
            observedMono: Option<{ bootId: string & Brand<"BootId">; micros: number }>;
            provider: "claude" | "codex";
            resetsAt: Option<number>;
            seq: number & Brand<"LedgerSeq">;
            source:
                | "claudeRateLimitEvent"
                | "claudeStatusline"
                | "claudeUsagePrompt"
                | "codexAppServer";
            usedPercent: number;
            window: "fiveHour"
            | "weekly";
        }[]
      • provider: "claude" | "codex"
      • window: "fiveHour" | "weekly"
      • policy: {
            dropTolerancePoints: number;
            freshnessMillis: number;
            initialEstimate: number;
            minEstimatePoints: number;
            providers: {
                claude: {
                    windows: readonly {
                        reservePercent: number;
                        window: "fiveHour" | "weekly";
                    }[];
                };
                codex: {
                    windows: readonly {
                        reservePercent: number;
                        window: "fiveHour"
                        | "weekly";
                    }[];
                };
            };
            resetToleranceMillis: number;
        }

      Returns Option<WindowPeriod>