@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
59 lines (58 loc) • 2.77 kB
TypeScript
import { type Span, type Tracer } from "@opentelemetry/api";
import type { GenerationOperation } from "../types/index.js";
/**
* @description Reads which public API call the active span belongs to, following the span's ancestry up to a `generate`, `stream`, `provider.generate` or `provider.stream` span.
* @returns {GenerationOperation | undefined} The enclosing operation, or `undefined` when no such span is active.
*/
export declare function activeOperation(): GenerationOperation | undefined;
/**
* @description Reports whether a `generate` or `stream` span started inside another operation's span tree.
* @param span {Span} - Span returned by a scrubbed tracer.
* @returns {boolean} `true` when the span is nested in an enclosing operation, `false` for a trace root.
*/
export declare function isNestedOperation(span: Span): boolean;
/**
* @description Resolves a tracer whose spans record exceptions as type and message only, without stack traces or product-name references that would reach trace backends as event metadata.
* @param name {string} - Instrumentation scope name.
* @returns {Tracer} A tracer delegating to the globally registered provider.
*/
export declare function scrubbedTracer(name: string): Tracer;
/**
* Pre-resolved tracers cached at module load.
*
* Module-load timing is intentional and safe: `trace.getTracer(name)` from
* `@opentelemetry/api` always returns a proxy that defers to whatever
* `TracerProvider` is registered globally at the moment a span is created.
* If the OTel SDK initializes *after* this module is imported (the common
* case — telemetry setup typically runs once at app boot, after lazy
* imports have already pulled this file), the tracer reference is still
* valid; spans created via it correctly route to the SDK once registered.
*
* Pre-SDK calls produce a noop span — `span.end()` etc. are valid; nothing
* is exported. This is OTel's documented contract:
* https://opentelemetry.io/docs/specs/otel/trace/api/#tracerprovider
*
* If a future refactor moves to a non-proxy TracerProvider API (e.g. a
* custom provider where `getTracer` returns the live instance), revisit
* this file and switch to lazy accessors.
*/
export declare const tracers: {
readonly sdk: Tracer;
readonly provider: Tracer;
readonly generation: Tracer;
readonly decision: Tracer;
readonly stream: Tracer;
readonly http: Tracer;
readonly mcp: Tracer;
readonly memory: Tracer;
readonly redis: Tracer;
readonly factory: Tracer;
readonly rag: Tracer;
readonly context: Tracer;
readonly middleware: Tracer;
readonly processor: Tracer;
readonly file: Tracer;
readonly autoresearch: Tracer;
readonly auth: Tracer;
readonly workflow: Tracer;
};