@juspay/neurolink
Version:
Universal AI Development Platform with working MCP integration, multi-provider support, voice (TTS/STT/realtime), and professional CLI. 58+ external MCP servers discoverable, multimodal file processing, RAG pipelines. Build, test, and deploy AI applicatio
30 lines (29 loc) • 1.23 kB
TypeScript
/**
* Shared logging-fetch wrapper.
*
* Wraps `createProxyFetch()` and logs every non-2xx upstream response with:
* - provider label
* - HTTP status code
* - URL with embedded credentials / signed query params masked
* (via `maskProxyUrl`)
* - request body size (string-body only — multipart/streamed bodies
* report 0)
*
* Response bodies are NOT logged by default (they can echo prompt fragments,
* tool payloads, or echoed auth tokens). Set `NEUROLINK_DEBUG_HTTP=1` to opt
* into body logging — and even then bodies are run through `sanitizeForLog`
* to redact `Bearer …`, `sk-…`, `Token …`, and the other 11 token formats
* covered by `logSanitize.SECRET_PATTERN`.
*
* Previously this same function was hand-rolled in 11 provider files
* (cohere, xai, groq, togetherAi, fireworks, perplexity, cloudflare,
* llamaCpp, lmStudio, nvidiaNim, deepseek) with subtly different bodies.
* Extracting it kills the drift risk and gives a single place to harden.
*
* @module utils/loggingFetch
*/
/**
* Construct a fetch-compatible function that logs upstream non-OK responses
* under the given provider label.
*/
export declare function createLoggingFetch(provider: string): typeof fetch;