/** * The MCP usage fold (DES-MCP-TOOLS-001 §7 Usage, §8 `GET /mcp/usage`; slice S7). * * A pure function over call records (`calls.ndjson`, written by the broker, S3): counts, the * decision split (allow / ask / deny / guard_error), the error rate and nearest-rank p50/p95/p99 * over the calls that ran, a per-tool table, per-server totals, the tool × seat × run drill-down, * the common tool chains and one row per UTC day. Nothing is cached and no poller runs: every * `GET /mcp/usage` folds the records as they are on disk. */ import type { McpCallDecision, McpCallRecord, McpUsageChain, McpUsageResponse } from '../core/types.js'; export declare const MCP_USAGE_MAX_DAYS = 30; export declare const MCP_USAGE_DEFAULT_DAYS = 7; export declare const MCP_USAGE_DECISIONS: readonly McpCallDecision[]; export declare const MCP_USAGE_MAX_RUNS = 200; export declare const MCP_USAGE_MAX_CHAINS = 20; export interface McpUsageQuery { days?: number; subject?: string; seat?: string; decision?: McpCallDecision; } /** Nearest-rank percentile of ascending `sorted`: the value at position `ceil(q * n)`. */ export declare function nearestRank(sorted: readonly number[], q: number): number | null; /** The tool chains of `records`: consecutive calls of one unit attempt, with different subjects. */ export declare function foldChains(records: readonly McpCallRecord[], subject?: string): McpUsageChain[]; /** * Fold `records` into the usage view for the last `days` × 24 h before `now`. `skipped` passes * through the count of lines the reader could not parse. */ export declare function foldMcpUsage(records: readonly McpCallRecord[], query: McpUsageQuery, now: number, skipped?: number): McpUsageResponse; //# sourceMappingURL=usage.d.ts.map