/** * Org sections spec 6.9 and 13.2 (piece P4.5): the per-section budget report. Derived at any moment from * spend the runtime already keeps, never persisted (no checkpoint field, no migration): * - live: each role's `metrics.costUsd` (its live incarnation, restored from the checkpoint on resume) plus its * slot's `retiredUsage.costUsd` (replaced incarnations), as one entry per role. The live POLICY usage is not * used: a replacement's policy is seeded with the retired spend (role-respawn.ts), so adding the two would * count a replaced incarnation twice. * - offline (`org report`): the spend of each role summed from the run's usage events, which already include * every incarnation of the role, so nothing is retired separately. * Reporting only: a section over its allocation is `closed` in the table and nothing is closed (P4.6). */ import type { RunningOrg } from '../daemon-types.js'; import type { BudgetDef } from './section-budget.js'; import { type AllocationStatus, type ClosureState, type SpendSnapshot } from './section-budget-status.js'; /** True when the report has something to say: the surface is on and a section budget or an org budget is set. */ export declare function sectionBudgetReportApplies(def: BudgetDef): boolean; /** The live spend snapshot: one entry per role of the definition. A role with no live runtime has spent 0 now. */ export declare function liveSpendSnapshot(running: Pick): SpendSnapshot; /** The status of a running org, or undefined when section budgets do not apply to it. */ export declare function liveSectionBudgetStatus(running: RunningOrg): AllocationStatus | undefined; /** One row of the section budget table, as `org report` prints it and as the `sections` array of the JSON of * `org status`, `org costs` and `org report --format json` carries it (`kind` section, root reserve or org). A * key is omitted when the text table omits it: `budget` and `percent_used` without an allocation, * `retired_usd` at zero. Units are the table's: USD, `percent_used` a whole percent. */ export interface SectionBudgetRow { name: string; kind: 'section' | 'reserve' | 'org'; spend_usd: number; budget?: number; percent_used?: number; state: ClosureState; role_caps_usd: number; retired_usd?: number; } /** The rows of the table: one per allocated section, the root reserve when allocated, and the org. */ export declare function sectionBudgetRows(status: AllocationStatus): SectionBudgetRow[]; /** The table `org report` prints: one line per row of `sectionBudgetRows`. Every limit is an individual soft * stop (spec 6.9): nothing here stops a role by itself. */ export declare function sectionBudgetLines(status: AllocationStatus): string[]; /** The lines for a run summary. */ export declare function sectionBudgetReportLines(def: BudgetDef, roles: Record): string[]; /** The `sections` rows of a run's JSON: the same status as the lines, [] when section budgets do not apply. */ export declare function sectionBudgetReportRows(def: BudgetDef, roles: Record): SectionBudgetRow[]; //# sourceMappingURL=section-budget-report.d.ts.map