/** * Automatic activity cost: prefer a valid cost already present on the record (response / tiers), * otherwise derive USD via {@link @x12i/ai-tools} when usage + model are available. */ import { CostCalculator, type AiCostResult, type CostCalculatorOptions, type ExtractUsageInputOptions } from '@x12i/ai-tools/cost'; import type { ActivixCostShape } from '@x12i/activix-contracts'; export interface ActivixAutoCostOptions { /** * When `false`, skips automatic cost handling. Default `true` when `autoCost` is set on Activix. */ enabled?: boolean; /** * Use only bundled catalog data (no network). Default `true` for predictable tests and offline runs. */ bundledOnly?: boolean; /** Passed to {@link CostCalculator} (e.g. `throwOnUnknownModel`). */ calculatorOptions?: CostCalculatorOptions; /** Options for {@link extractUsageInput} / {@link CostCalculator.calculateFromRecord}. */ extractOptions?: ExtractUsageInputOptions; /** * Replace an existing `outer.cost` even when it already has a valid `usd`. * Default `false` — integrator-provided `outer.cost` wins. */ overwriteOuterCost?: boolean; } export interface ActivixCostDiscovery { cost: ActivixCostShape; /** Where the cost object was found (for `details.sourcePath`). */ sourcePath: string; } export interface ApplyActivixAutoCostOptions extends ActivixAutoCostOptions { calculator?: CostCalculator; } export { isValidActivixCost, normalizeToActivixCostShape, } from '@x12i/activix-contracts'; /** * Find the first valid cost on the record (explicit tiers first, then a bounded deep scan). */ export declare function findValidActivixCostInRecord(record: Record): ActivixCostDiscovery | undefined; /** * Whether {@link applyActivixAutoCost} would invoke ai-tools (no valid cost yet, but usage is present). */ export declare function needsActivixCostCalculation(record: Record): boolean; export declare function activixCostFromAiResult(result: AiCostResult): ActivixCostShape; export declare function createActivixCostCalculator(options?: Pick): CostCalculator; /** * Resolve cost: existing valid cost on the row, else catalog calculation. Returns `undefined` when * nothing can be resolved. */ export declare function resolveActivixCostForRecord(record: Record, options?: ApplyActivixAutoCostOptions): Promise; /** * Ensures `outer.cost` is set when a valid cost exists on the row or can be calculated. * Mutates `record` in place. No-op when `enabled` is false. */ export declare function applyActivixAutoCost(record: Record, options?: ApplyActivixAutoCostOptions): Promise; //# sourceMappingURL=activityCost.d.ts.map