/** * Config schema and resolution for `dsh-budget`. Every tunable is a validated * {@link Config} field changeable from cordis.yml; `resolveConfig` re-judges * every default and bound so programmatic construction that bypasses * Schemastery normalization still fails loud (the explicit-resolve contract). * * @module dsh-budget/config */ import z from '@deepseek-ai/schemastery'; /** Display currency: code, units per USD, and decimal places. */ export interface CurrencyConfig { code?: string; rate?: number; decimals?: number; } /** Carbon footprint estimation. */ export interface CarbonConfig { enabled?: boolean; region?: 'global' | 'us' | 'eu' | 'china' | 'india' | 'uk' | 'france' | 'iceland'; pue?: number; energyKwhPerToken?: number; } /** Per-model latency statistics. */ export interface LatencyConfig { enabled?: boolean; windowSize?: number; } /** Budget caps per scope; undefined = unlimited. */ export interface BudgetsConfig { session?: number; daily?: number; monthly?: number; } /** Durable persistence of the daily/monthly buckets across restarts. */ export interface PersistenceConfig { /** Persist day/month usage to the storage domain (default true). */ enabled?: boolean; /** Milliseconds between persistence snapshots (default 10000). */ intervalMs?: number; } /** Raw plugin config — every field optional; {@link resolveConfig} supplies the defaults. */ export interface Config { /** Per-model USD prices per 1M tokens, merged over the built-in table. */ prices?: Record; /** Fallback price for models absent from both tables. */ defaultPrice?: { input: number; output: number; cacheRead?: number; cacheWrite?: number; priced?: boolean; }; /** Budget caps in USD per scope; omit a scope for unlimited. */ budgets?: BudgetsConfig; /** Alert once usage reaches this fraction of a cap (0..1). */ warnRatio?: number; /** Behavior after a cap is crossed: alert | block | degrade. */ overLimit?: 'alert' | 'block' | 'degrade'; /** Degradation map: model id -> cheaper model id of the SAME provider. */ degradation?: Record; /** Optional webhook URL for threshold alerts (POST JSON). */ webhookUrl?: string; /** Webhook request timeout in milliseconds. */ webhookTimeoutMs?: number; /** Master switch for threshold alerts. */ alertsEnabled?: boolean; /** Minimum milliseconds between two alerts of the same scope. */ alertCooldownMs?: number; /** Browser desktop notifications for new alerts. */ desktopNotifications?: boolean; /** Settings budget tab polling interval in milliseconds. */ refreshIntervalMs?: number; /** Carbon footprint estimation. */ carbon?: CarbonConfig; /** Per-model latency statistics. */ latency?: LatencyConfig; /** Display currency. */ currency?: CurrencyConfig; /** /budget command output language: en | zh. */ outputLanguage?: 'en' | 'zh'; /** Days of per-day usage history kept in the panel snapshot. */ historyDays?: number; /** Durable daily/monthly persistence across restarts. */ persistence?: PersistenceConfig; } /** Fully resolved config. */ export interface ResolvedConfig { readonly prices: Record; readonly defaultPrice: { input: number; output: number; cacheRead?: number; cacheWrite?: number; priced: boolean; }; readonly budgets: BudgetsConfig; readonly warnRatio: number; readonly overLimit: 'alert' | 'block' | 'degrade'; readonly degradation: Record; readonly webhookUrl: string | undefined; readonly webhookTimeoutMs: number; readonly alertsEnabled: boolean; readonly alertCooldownMs: number; readonly desktopNotifications: boolean; readonly refreshIntervalMs: number; readonly carbon: { enabled: boolean; region: string; pue: number; energyKwhPerToken: number; }; readonly latency: { enabled: boolean; windowSize: number; }; readonly currency: { code: string; rate: number; decimals: number; }; readonly outputLanguage: 'en' | 'zh'; readonly historyDays: number; readonly persistence: { enabled: boolean; intervalMs: number; }; } /** Schemastery schema: the loader validates and fills defaults before `apply`. */ export declare const Config: z; /** * Resolve raw config to the runtime policy, re-validating defaults and bounds. * * @param config - raw loader config; `undefined` for a bare row. * @returns the frozen resolved config. */ export declare function resolveConfig(config: Config | undefined): ResolvedConfig; //# sourceMappingURL=config.d.ts.map