@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
160 lines (159 loc) • 5.6 kB
TypeScript
/**
* Central configuration constants for NeuroLink
* Single source of truth for all default values
*/
export declare const IMAGE_GENERATION_MODELS: string[];
/**
* Boundary-aware test for whether `modelName` represents an image-generation
* model.
*
* Matches when the model name **equals** an entry in
* {@link IMAGE_GENERATION_MODELS} or contains the entry as a prefix followed
* by a separator (`-`, `_`, `:`, `/`, `.`) or end-of-string. This avoids
* accidental matches such as a custom fine-tune named `"my-V_1"` matching
* `"V_1"` via plain substring inclusion.
*/
export declare function isImageGenerationModel(modelName: string | undefined): boolean;
export declare const PDF_IMAGE_GENERATION_MODELS: string[];
export declare const GLOBAL_LOCATION_MODELS: string[];
export declare const DEFAULT_MAX_TOKENS: undefined;
export declare const DEFAULT_TEMPERATURE = 0.7;
export declare const DEFAULT_TIMEOUT = 60000;
export declare const DEFAULT_MAX_STEPS = 200;
export declare const DEFAULT_TOOL_MAX_RETRIES = 2;
/** Defensive wall-clock ceiling for a native Gemini-3 agentic turn (generate + stream). */
export declare const DEFAULT_GEMINI_STREAM_TIMEOUT_MS = 300000;
/**
* Default per-tool-execution timeout for native agentic loops. A tool that
* exceeds it fails with an error tool_result and costs one step — the turn
* continues instead of hanging on a wedged tool. Override per call with
* `toolTimeoutMs`, or remove the bound entirely with `toolTimeoutMs: null`.
*/
export declare const DEFAULT_TOOL_EXECUTION_TIMEOUT_MS = 300000;
/**
* Resolve a caller's `toolTimeoutMs` into the bound a loop should actually
* apply: a number of milliseconds, or `null` for no bound at all.
*
* The three-way distinction is the whole point, and `??` cannot express it:
* `undefined` means "no opinion, take the default", while `null` is a stated
* choice to run tools unbounded — the pre-existing behaviour of the loops that
* never had a per-tool timer, and the only way to say it, since a finite
* number is always a ceiling and `Infinity` silently desugars to `setTimeout`'s
* ~24.9-day cap. Every loop resolves it through here so `null` cannot come to
* mean "the default" on one provider and "unbounded" on another.
*/
export declare function resolveToolTimeoutMs(toolTimeoutMs: number | null | undefined): number | null;
/**
* Default wrap-up lead applied when `turnTimeoutMs` is set but
* `wrapupTimeLeadMs` is not: with less than this much turn time remaining,
* a wrap-up nudge rides the next tool-result turn.
*/
export declare const DEFAULT_WRAPUP_TIME_LEAD_MS = 120000;
/**
* In-loop context guard threshold for native agentic loops: when the last
* model call's actual prompt size (provider-reported usage) plus the
* estimated growth from this step's tool results crosses this fraction of
* the model's context window, the loop stops calling tools and synthesizes a
* final answer instead of stepping into a provider 400 ("prompt is too
* long") that would destroy the whole turn's work.
*/
export declare const DEFAULT_CONTEXT_GUARD_RATIO = 0.85;
/**
* Floor for the turn budget handed to the post-overflow recovery retry.
* The retry inherits the REMAINING `turnTimeoutMs` (whole-turn semantics —
* one generate() must not stack two full budgets), but never less than this,
* so a compacted retry still gets a workable window.
*/
export declare const MIN_RECOVERY_TURN_BUDGET_MS = 30000;
export declare const TOOL_STORAGE_TIMEOUT_MS = 5000;
export declare const STEP_LIMITS: {
min: number;
max: number;
default: number;
};
export declare const DEFAULT_EVALUATION_MAX_TOKENS = 500;
export declare const DEFAULT_ANALYSIS_MAX_TOKENS = 800;
export declare const DEFAULT_DOCUMENTATION_MAX_TOKENS = 12000;
export declare const PROVIDER_CONFIG: {
evaluation: {
maxTokens: number;
model: string;
temperature: number;
};
analysis: {
maxTokens: number;
temperature: number;
};
documentation: {
maxTokens: number;
temperature: number;
};
};
export declare const PROVIDER_MAX_TOKENS: {
anthropic: {
default: number;
};
openai: {
default: number;
};
"google-ai": {
default: number;
};
vertex: {
default: number;
};
bedrock: {
default: number;
};
azure: {
default: number;
};
mistral: {
default: number;
};
ollama: {
default: number;
};
litellm: {
default: number;
};
default: number;
};
export declare const CLI_LIMITS: {
maxTokens: {
min: number;
max: number;
default: undefined;
};
temperature: {
min: number;
max: number;
default: number;
};
};
export declare const PDF_LIMITS: {
MAX_SIZE_MB: number;
DEFAULT_MAX_PAGES: number;
MAX_SCALE: number;
MIN_SCALE: number;
DEFAULT_SCALE: number;
PAGE_COUNT_TIMEOUT_MS: number;
DEFAULT_MAX_CANVAS_PIXELS: number;
MIN_EFFECTIVE_SCALE: number;
};
export declare const SYSTEM_LIMITS: {
MAX_PROMPT_LENGTH: number;
HIGH_MEMORY_THRESHOLD: number;
LONG_TIMEOUT_WARNING: number;
DEFAULT_CONCURRENCY_LIMIT: number;
MAX_CONCURRENCY_LIMIT: number;
DEFAULT_RETRY_ATTEMPTS: number;
DEFAULT_INITIAL_DELAY: number;
DEFAULT_MAX_DELAY: number;
DEFAULT_BACKOFF_MULTIPLIER: number;
};
export declare const DEFAULT_TOOL_ROUTING_TIMEOUT_MS = 15000;
export declare const ENV_DEFAULTS: {
maxTokens: number | undefined;
temperature: number;
};