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

79 lines (78 loc) • 3.45 kB
import type { LoggerProvider as LoggerProviderType } from "@opentelemetry/sdk-logs"; import type { ProxyBodyChunkEmitter, ProxyBodyDeliveryResult } from "../types/index.js"; /** Explicit opt-in; configuration never silently falls back to file logging. */ export declare function isProxyOtelOnly(): boolean; /** * Publish bounded captures concurrently into a shared batch queue. Transport * callbacks settle each chunk once; a flush is a process fence, not a per-body * network round trip. Metadata has a separate queue and transport. */ export declare function publishProxyOtelBody(captureId: string, body: string, emit: ProxyBodyChunkEmitter): Promise<ProxyBodyDeliveryResult>; /** Initialize a log-only provider in every proxy process, including the supervisor. */ export declare function initializeProxyOtelLogs(role?: string): LoggerProviderType | undefined; /** Structured evidence without final-request dashboard fields on auxiliary events. */ export declare function emitProxyOtelEvent(kind: string, record: Record<string, unknown>): void; /** Capture application console diagnostics only inside proxy service processes. */ export declare function routeProxyConsoleToOtel(): void; /** Counters acknowledge collector transport only, never backend persistence. */ export declare function getProxyOtelLogSnapshot(): { mode: string; initialized: boolean; deliveryGuarantee: string; invalidRecords: number; bodyDelivery: { attempted: number; transportAcknowledged: number; exportUnconfirmed: number; rejected: number; partial: number; pending: number; pendingBytes: number; highWaterPending: number; highWaterBytes: number; maxPending: number; maxPendingBytes: number; }; queues: { recentFailures: { records: { eventId: string; kind?: string; requestId?: string; captureId?: string; }[]; id: string; at: string; reason: "export_unconfirmed" | "queue_full"; error?: string; }[]; attempted: number; submitted: number; transportAcknowledged: number; exportUnconfirmed: number; dropped: number; outstanding: number; outstandingBytes: number; highWaterBytes: number; byteLimitDrops: number; retryingRecords: number; retriedBatches: number; retentionExpired: number; lastTransientFailureAt: string | undefined; lastAcknowledgedAt: string | undefined; lastFailureAt: string | undefined; highWaterOutstanding: number; failureHistoryEvicted: number; kind: "metadata" | "bodies" | "indexes" | "diagnostics"; capacity: number; byteCapacity: number; retentionMs: number; oldestOutstandingAgeMs: number; }[]; }; /** Bounded provider flush belongs after final request and lifecycle publication. */ export declare function flushProxyOtelLogs(): Promise<void>; /** Release this process's exporter and restore console ownership. */ export declare function shutdownProxyOtelLogs(): Promise<void>; /** Flush short-lived proxy command diagnostics on every normal return or exception. */ export declare function withProxyOtelLogShutdown<TArg>(handler: (arg: TArg) => Promise<void>): (arg: TArg) => Promise<void>;