UNPKG

@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

36 lines (35 loc) • 2.6 kB
import type { ProxyActivitySnapshot, ProxyResponseTrackingObserver, RequestLogEntry, RequestAttemptLogEntry } from "../types/index.js"; export declare function getProxyBridgeResult(requestId: string): RequestLogEntry | undefined; export declare function registerInternalProxyRequest(parentRequestId: string): { token: `${string}-${string}-${string}-${string}-${string}`; requestId: `${string}-${string}-${string}-${string}-${string}`; dispose(): void; }; export declare function consumeInternalProxyRequest(token: string | null): { parentRequestId: string; requestId: string; } | undefined; export declare function getProxyRequestAccounting(requestId: string): { parentRequestId?: string; accountingScope?: "client" | "internal"; usageOwnerRequestId?: string; } | undefined; export declare function releaseProxyRequestAccounting(requestId: string): void; /** Deferred native callbacks retain this owner even after transport cleanup. */ export declare function withProxyFinalLogOwnership<T>(requestId: string, run: () => T): T; /** Join route accounting to the HTTP lifecycle without relying on write order. */ export declare function observeProxyFinalLog(requestId: string, observer: (entry: RequestLogEntry) => void, attemptObserver?: (entry: RequestAttemptLogEntry) => void): () => void; /** Check without claiming: aggregate accounting must not revive a cancelled request. */ export declare function isProxyRequestFinalized(requestId: string): boolean; export declare function notifyProxyFinalLog(entry: RequestLogEntry): boolean; /** Retain only the last attempt for a currently observed HTTP request. */ export declare function notifyProxyAttemptLog(entry: RequestAttemptLogEntry): void; export declare function registerProxyResponseObserver(metadata: object, observer: ProxyResponseTrackingObserver): void; export declare function takeProxyResponseObservers(metadata: object): ProxyResponseTrackingObserver[]; /** Track one client-facing proxy request until its response body settles. */ export declare function beginProxyRequest(): () => void; export declare function getProxyActivitySnapshot(): ProxyActivitySnapshot; export declare function isProxyActivityQuiet(snapshot: ProxyActivitySnapshot, quietThresholdMs: number, nowMs?: number): boolean; /** Keep activity open until the response body completes, errors, or is cancelled. */ export declare function trackProxyResponse(response: Response, finishRequest: () => void, observer?: ProxyResponseTrackingObserver, abortSignal?: AbortSignal): Response; export declare function resetProxyActivityForTests(): void;