/** * Quota command — Provider-neutral quota dashboard (P4-03, ADR-0001). * * The command is presentation-only: it receives a dashboard builder * through injected dependencies and wraps the resulting * {@link QuotaDashboard} as base data with a TTY presentation override. * Provider resolution, capability invocation, settled collection, and * failure redaction live in {@link buildQuotaDashboard} so the command * never imports a Provider monitor client or maps a Provider response. * * The DEFAULT is multi-Provider (every configured Provider with a quota * Capability). Single-Provider mode is selected only when a Provider is * explicitly pinned (--provider or SCOUTLINE_PROVIDER); --all-providers * forces the multi-Provider default even under a pin. * * Single-Provider mode propagates quota failures through the ordinary * error path (thrown → invokeCommand). Multi-Provider mode uses settled * collection, emits successful and failed entries, and yields exit 1 * when any configured Provider fails. */ import type { CommandResult } from "../command-invocation.js"; import type { QuotaDashboard } from "../capabilities/quota.js"; import type { ProviderDescriptor, ProviderId } from "../providers/types.js"; import { type QuotaState, type QuotaStore } from "../lib/quota-store.js"; export interface QuotaDashboardDependencies { readonly allProviders: boolean; readonly effectiveProvider: ProviderId; readonly descriptors: readonly ProviderDescriptor[]; readonly env: NodeJS.ProcessEnv; readonly sleep: (ms: number) => Promise; readonly random: () => number; /** * Optional quota snapshot (PB-T5 — Plan B). When supplied, the * dashboard reads each configured descriptor's snapshot entry first * and labels the row's source/freshness via {@link QuotaSourceLabel}; * a stale or missing entry falls back to a live probe (the fallback's * refresh is awaited-write-through when `quotaStore` is supplied). * When omitted, every configured descriptor is live-probed * byte-for-byte (pre-PB-T5 behavior) and no `quotaSource` field is * attached. */ readonly quotaSnapshot?: QuotaState; /** * Optional store for live-probe write-through (PB-T5). When supplied * alongside `quotaSnapshot`, a successful live-probe fallback is * persisted via `writeObserved(providerId, { observedAt, categories })` * before the dashboard returns. When omitted (tests), the live-probe * result is returned but NOT persisted. Never consulted when * `quotaSnapshot` is absent. */ readonly quotaStore?: QuotaStore; /** * Optional clock for freshness evaluation. Defaults to `Date.now`. * Used only when `quotaSnapshot` is supplied. */ readonly now?: () => number; /** * Optional staleness threshold in milliseconds. Defaults to * {@link DEFAULT_QUOTA_STALE_THRESHOLD_MS} (10 min — Tavily's * 10/10min key limit is the floor). */ readonly thresholdMs?: number; } /** * Build a {@link QuotaDashboard} for the selected mode. The effective * Provider is resolved by the dispatcher (`index.ts`) and passed in as * metadata; config validation happens here. */ export declare function buildQuotaDashboard(deps: QuotaDashboardDependencies): Promise; export interface QuotaOptions { allProviders?: boolean; } /** * Injectable dependencies for the quota command. `buildDashboard` * resolves the effective/all-provider dashboard; the command only wraps * it for presentation and exit-code selection. * * `writeStderr` is an OPTIONAL generic stderr sink. When provided, the * command collects every `warnings` entry from successful dashboard * entries and writes each as a prominent notice — provider-neutral * (iterates warnings, never branches on provider name). A Provider that * needs to flag a caveat about its quota numbers (e.g. Brave reports a * rate-limit window, not spend) populates `warnings`; the command * renders it here so the caveat text stays out of the neutral command. */ export interface QuotaCommandDependencies { readonly buildDashboard: () => Promise; readonly writeStderr?: (value: string) => void; /** * Configured credential values used to redact `warnings` text before * it reaches stderr. The `warnings` channel is provider-authored, so a * future Provider could put value-derived text there; running each * warning through `redactCredentialString` keeps the stderr seam under * the same redaction as the dashboard data. Optional — when omitted, * only the key/regex-based redaction applies. */ readonly secrets?: string[]; } /** * Run the quota command. Returns the dashboard as base data with a TTY * presentation override. Exit code is 1 when any dashboard entry failed * (all-provider mode); otherwise 0. * * Before returning, any `warnings` attached to successful entries are * rendered to `writeStderr` (when provided) as prominent notices. This * is the provider-neutral caveat channel: it does not branch on * provider identity. */ export declare function quota(deps: QuotaCommandDependencies): Promise>; export declare const QUOTA_HELP: string; //# sourceMappingURL=quota.d.ts.map