/** * Rolling median tokens_per_second meter — SP-163, #84 part 1. * * Tracks local inference throughput samples and exposes a rolling median * estimate for hardware viability gating (wired in SP-164). * * Pure module with injectable sample store for testability. * * SP-275 (#143 partial): the throughput viability contracts are domain-owned * (`domain/ports/hardware-probe-port.ts`); this module provides the factory, * default config, and sample stores, and re-exports the contracts for * import-path stability. */ import type { LocalViabilityPolicy, ThroughputMeter, ThroughputSamplePhase } from '../../domain/ports/hardware-probe-port.js'; export type { LocalViabilityPolicy, ThroughputBreakdown, ThroughputMeter, ThroughputSamplePhase, } from '../../domain/ports/hardware-probe-port.js'; export interface ThroughputMeterConfig { readonly windowSize: number; readonly thresholdTps: number; } export interface ThroughputSample { readonly tokensPerSecond: number; readonly phase: ThroughputSamplePhase; } export declare const DEFAULT_LOCAL_VIABILITY_POLICY: Readonly; /** Port for dependency injection in tests. */ export interface ThroughputSampleStore { push(tokensPerSecond: number): void; values(): readonly number[]; clear(): void; } /** * Optional tagged-store port. Stores implementing it retain the cold/warm * phase per sample; untagged stores are treated as all-warm. */ export interface TaggedThroughputSampleStore extends ThroughputSampleStore { pushSample(tokensPerSecond: number, phase: ThroughputSamplePhase): void; entries(): readonly ThroughputSample[]; } /** Human-usable local viability threshold (~25 tok/s per routing-roadmap.md §3). */ export declare const DEFAULT_THROUGHPUT_THRESHOLD_TPS = 25; /** Rolling window over last N local inference samples (research default: 50). */ export declare const DEFAULT_THROUGHPUT_WINDOW_SIZE = 50; export declare const DEFAULT_THROUGHPUT_METER_CONFIG: Readonly; export declare class RollingThroughputSampleStore implements TaggedThroughputSampleStore { private readonly maxSize; private readonly samples; constructor(maxSize: number); push(tokensPerSecond: number): void; pushSample(tokensPerSecond: number, phase: ThroughputSamplePhase): void; values(): readonly number[]; entries(): readonly ThroughputSample[]; clear(): void; } export declare function computeTokensPerSecond(tokens: number, durationMs: number): number | null; export declare function median(values: readonly number[]): number | null; export declare function createThroughputMeter(config?: ThroughputMeterConfig, store?: ThroughputSampleStore): ThroughputMeter; //# sourceMappingURL=throughput-meter.d.ts.map