@juspay/neurolink
Version:
The pipe layer of an AI nervous system: one interface connecting provider neurons to your application, across three inference types — generate, stream and decide. `decide` returns typed, calibrated judgements from a non-generative model (~400ms, ~$0.00002
30 lines (29 loc) • 1.41 kB
TypeScript
/**
* Generic provider-name → handler registry shared by every media-generation
* ecosystem (TTS, STT, Realtime, Video, Music, Avatar). Each ecosystem's own
* processor class composes one instance of this class instead of hand-rolling
* its own `Map<string, THandler>` plus register/supports/get/list methods.
*
* Centralizes only the behavior that was byte-identical across all six
* hand-rolled registries: input validation, name normalization (lowercase),
* the overwrite-warning log line, and the four lookup/list/clear operations.
* Registration-outcome debug logging (whose exact phrasing differs per
* ecosystem — e.g. "Registered TTS handler..." vs "Registered video
* handler...") and any ecosystem-specific extra logging (e.g. TTS/STT's
* `supports()` diagnostics) stay in the owning processor's own wrapper
* methods; this class does not attempt to unify those.
*/
export declare class HandlerRegistry<THandler> {
private readonly scopeName;
private readonly handlers;
/**
* @param scopeName Log-line prefix, e.g. "TTSProcessor" — matches the
* `[ClassName]` prefix each processor already uses in its own logs.
*/
constructor(scopeName: string);
register(providerName: string, handler: THandler): void;
supports(providerName: string): boolean;
get(providerName: string): THandler | undefined;
list(): string[];
clear(): void;
}