/** * Derive the counters a tool call is metered against. Mirrors the Python SDK's * `grantex.caps._limits`. * * - The **manifest** (`caps` on the tool) declares tenant-wide counters per tool. * - The **grant** (`caps` in its `urn:grantex:tools:v1` entry) declares counters * for that grant only: per tool (`{"verify_business": {"per_hour": 50}}`) * and a connector cost-unit budget (`{"cost_units": {"per_day": 5000}}`). * * Every declared cap is its own counter and all of them must hold. A call's * cost is the sum of the manifest `cost_units` for the components it incurs * (all declared components unless the caller names them). */ import type { ToolSpec } from '../manifest.js'; import { type CapLimit, type CapWindow } from './meter.js'; export declare const CASE_REQUIRED = "case_required"; export declare const INVALID_CASE_ID = "invalid_case_id"; export declare const INVALID_COST_COMPONENT = "invalid_cost_component"; export declare const MALFORMED_GRANT_CAPS = "malformed_grant_caps"; /** Unambiguous counter identity; identical to the Python SDK's `counter_id`. */ export declare function counterId(...parts: string[]): string; /** Validate a grant entry's `caps`; `cost_units` is the connector budget. */ export declare function parseGrantCaps(caps: unknown): Map>>; export interface BuildCapLimitsOptions { connector: string; tool: string; spec: ToolSpec; grantId: string; grantCaps?: unknown; caseId?: string; costComponents?: readonly string[]; } /** * The limits for one call of `tool`. * * @throws {CapsConfigurationError} with `subReason` `case_required`, * `invalid_case_id`, `invalid_cost_component` or `malformed_grant_caps`. */ export declare function buildCapLimits(options: BuildCapLimitsOptions): CapLimit[]; //# sourceMappingURL=limits.d.ts.map