/** * `dsh-budget` — cost governance for DeepSeek Harness. Aggregated * token/cost/carbon metering per model, session and day; session/daily/monthly * budget caps with threshold alerts (webhook + desktop notification flag) and * alert/block/degrade over-limit policies; per-model latency statistics; the * `budget` Typert Remote (`budget/status`, `budget/setSettings`, * `budget/unblock`) that the browser half's Settings tab consumes; the * `/budget` command; and `budget/alert` + `budget/block` session audit events * (suppressed on hosts whose fail-closed event vocabulary rejects them). * * Function plugin — no default export (the Loader unwraps * `exports.default ?? exports`). * * Seam notes (verified against 0.1.1-rc.2 and the local checkout): * - Usage arrives as `assistant/message` events (`usage?: TokenUsage`); * provider/model attribution comes from the latest `request/header` * (`header.config.provider` / `header.config.model`). * - Blocking happens on the `llm/stream` waterfall: when a scope is blocked * the listener short-circuits (no `next()`) and yields a text block plus an * error finish that names the budget breach — loop-built requests are * deep-frozen and may NOT be rewritten, so `degrade` manifests the same way * with corrective text naming the degraded model (plus the alert). A * waterfall listener short-circuit is a deliberate claim, not a passthrough * bug: pass-through paths always call `next()`. * - Session audit appends use the two-argument `Session.append` form (the * pinned rc.2 peers have no append-envelope option). * * @module dsh-budget */ import type { Context } from '@deepseek-ai/cordis'; import { Config } from './config.js'; export declare const name = "dsh-budget"; /** Hard services: the session store every aggregation keys off. */ export declare const inject: string[]; export { Config, resolveConfig } from './config.js'; export type { ResolvedConfig } from './config.js'; export { BudgetAggregator } from './aggregate/usage.js'; export type { PersistedBudgetState, PersistedBucket, PersistedModelUsage } from './aggregate/usage.js'; export { checkBudgets, degradationFor } from './governance.js'; export { BudgetService, effectiveCap } from './service.js'; export { budgetCommand, parseBudgetArgs, renderBudgetModels, renderBudgetOverview } from './command.js'; export { ALERT_EVENT, auditAppendsAllowed, BLOCK_EVENT } from './events.js'; export { budgetDomainSpec, budgetStateSchema } from './store.js'; /** * Mount the plugin: resolve config, build the aggregator, restore any durable * day/month buckets, wire the session event feed, the budget checks, the * `llm/stream` blocker, the webhook alerts, the `budget` Remote service, and * the `/budget` command. Persistence is optional and degrades to in-memory * when the storage domain is absent. * * @param ctx - the plugin context (host). * @param config - raw plugin config. */ export declare function apply(ctx: Context, config: Config): Promise; //# sourceMappingURL=index.d.ts.map