/// /// import { Config } from './config'; import { RunnerClassifyResponseSuccess, ModelInformation } from "../library/classifier/linux-impulse-runner-types"; import { EventEmitter } from 'tsee'; import { MgmtInterfaceImpulseRecordRawData, MgmtInterfaceInferenceSummary } from '../shared/MgmtInterfaceTypes'; export declare const DEFAULT_MONITOR_SUMMARY_INTERVAL_MS = 60000; /** * Helper to check if the model has visual AD capabilities based on its parameters. */ export declare function hasVisualAd(model: ModelInformation): boolean; export type ImpulseRecord = { impulseRecord: RunnerClassifyResponseSuccess; timestamp: number; index: number; rawData: MgmtInterfaceImpulseRecordRawData; }; export type ImpulseRecordError = { index: number; error: string; }; export type StorageStatus = { firstIndex: number; firstTimestamp: number; lastIndex: number; lastTimestamp: number; }; export type MetricsWindowBoundary = { index: number; timestamp: number; }; export type InferenceMetrics = MgmtInterfaceInferenceSummary['inferenceSummary']; /** * Represents a model monitor that emits events related to impulse records and inference summaries. */ export declare class ModelMonitor extends EventEmitter<{ 'impulse-record': (ev: ImpulseRecord) => void; 'impulse-records-response': (ev: ImpulseRecord | ImpulseRecordError) => void; 'inference-summary': (ev: InferenceMetrics) => void; }> { private _storageManager; private _metricsCalculator; private _streamState; private _streamPrevState; private constructor(); /** * Creates a new instance of ModelMonitor with the provided configuration and model information. * @param config The configuration object. * @param model The model information object. * @returns A promise that resolves to a ModelMonitor instance. */ static getModelMonitor(config: Config, model: ModelInformation): Promise; flushMetrics(): Promise; get impulseDebug(): boolean; /** * Enable the Model Debugging mode. * When enabled, the model monitor will emit impulse records as they are processed. * When disabled, the model monitor will not emit impulse records. * In the 'records-request' state, setting impulseDebug to true will abort the records-request state. * In the 'records-request' state, setting impulseDebug to false has no effect. */ set impulseDebug(enabled: boolean); getStorageStatus(): Promise; abortImpulseRecordsRequest(): void; /** * Retrieves impulse records based on the provided request. * @param impulseRequest The request object specifying the index, range, or list of indices to retrieve. * One of the following properties must be provided: * - index: The index of the single impulse record to retrieve. * - range: An object with first and last properties specifying the range of impulse records to retrieve. * - list: An array of indices of impulse records to retrieve (in any order) * @throws Error if the request is invalid or the first index is greater than the last index. */ getImpulseRecords(impulseRequest: { index?: number; range?: { first: number; last: number; }; list?: number[]; }): void; processResult(result: RunnerClassifyResponseSuccess, rawData: { type: 'wav' | 'jpg'; buffer: Buffer; }): Promise; }