/** * The budget host service: assembles the `BudgetStatus` snapshot and serves * it under the `budget` Typert Remote namespace (`budget/status`), plus the * two runtime actions — `setSettings` (session-scoped runtime caps and alert * switches, never a config-file write) and `unblock` (lift one blocked scope * after user confirmation). All data comes from the runtime aggregator; the * service performs no I/O of its own. * * @module dsh-budget/service */ import type { Context } from '@deepseek-ai/cordis'; import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol'; import type { ResolvedConfig } from './config.js'; import { BudgetAggregator } from './aggregate/usage.js'; import type { BudgetScope } from './wire.js'; import { type BudgetStatus } from './wire.js'; declare module '@deepseek-ai/cordis' { interface Context { /** Budget snapshot + runtime actions service (this package). */ budget: BudgetService; } } /** Runtime-editable settings (session-scoped; a reload restores cordis.yml). */ export interface RuntimeSettings { sessionCapUsd: number | null; dailyCapUsd: number | null; monthlyCapUsd: number | null; alertsEnabled: boolean; desktopNotifications: boolean; } /** Effective cap lookup: runtime override first, then the config. */ export declare function effectiveCap(settings: RuntimeSettings, config: ResolvedConfig, scope: BudgetScope): number | null; /** * The `budget` Typert Remote service. Constructed by `src/index.ts` with the * shared aggregator, the resolved config, and the runtime settings object; * mounted through `ctx.plugin`. */ export declare class BudgetService extends TypertRemoteService { private readonly bindings; /** No service dependencies: pure status surface over injected bindings. */ static inject: never[]; /** * @param ctx - the mounting context. * @param bindings - aggregator, resolved config, runtime settings, and the degraded-model probe. */ constructor(ctx: Context, bindings: { aggregator: BudgetAggregator; config: ResolvedConfig; settings: RuntimeSettings; /** Current session id the panel/command attribute usage to. */ sessionId: () => string; /** Degradation pair in force (when a cap blocked under degrade). */ degradation: () => { from: string; to: string; } | undefined; /** Audit hook called after a block is lifted. */ onUnblock?: (scope: BudgetScope) => void; }); /** Assemble the wire snapshot for one session. */ status(sessionId?: string): BudgetStatus; /** Apply the panel's runtime settings and return the refreshed snapshot. */ setSettings(settingsJson: string): BudgetStatus; /** Lift one blocked scope and return the refreshed snapshot. */ unblock(scope: BudgetScope): BudgetStatus; } //# sourceMappingURL=service.d.ts.map