@juspay/neurolink 9.80.4 → 9.81.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/dist/browser/neurolink.min.js +351 -351
- package/dist/cli/loop/optionsSchema.js +16 -0
- package/dist/core/analytics.js +22 -0
- package/dist/core/constants.d.ts +13 -0
- package/dist/core/constants.js +13 -0
- package/dist/lib/core/analytics.js +22 -0
- package/dist/lib/core/constants.d.ts +13 -0
- package/dist/lib/core/constants.js +13 -0
- package/dist/lib/neurolink.js +30 -3
- package/dist/lib/providers/googleNativeGemini3.d.ts +92 -4
- package/dist/lib/providers/googleNativeGemini3.js +186 -4
- package/dist/lib/providers/googleVertex.d.ts +15 -0
- package/dist/lib/providers/googleVertex.js +603 -120
- package/dist/lib/types/analytics.d.ts +10 -0
- package/dist/lib/types/generate.d.ts +75 -0
- package/dist/lib/types/stream.d.ts +21 -1
- package/dist/neurolink.js +30 -3
- package/dist/providers/googleNativeGemini3.d.ts +92 -4
- package/dist/providers/googleNativeGemini3.js +186 -4
- package/dist/providers/googleVertex.d.ts +15 -0
- package/dist/providers/googleVertex.js +603 -120
- package/dist/types/analytics.d.ts +10 -0
- package/dist/types/generate.d.ts +75 -0
- package/dist/types/stream.d.ts +21 -1
- package/package.json +1 -1
|
@@ -35,6 +35,16 @@ export type AnalyticsData = {
|
|
|
35
35
|
timestamp: string;
|
|
36
36
|
cost?: number;
|
|
37
37
|
context?: JsonValue;
|
|
38
|
+
/** Number of agentic steps (model calls) the turn used. */
|
|
39
|
+
stepsUsed?: number;
|
|
40
|
+
/** Number of external tool calls the turn made (final_result excluded). */
|
|
41
|
+
toolCallCount?: number;
|
|
42
|
+
/** Why the turn ended — see GenerateStopReason. */
|
|
43
|
+
stopReason?: string;
|
|
44
|
+
/** Wall-clock duration of the turn in milliseconds. */
|
|
45
|
+
elapsedMs?: number;
|
|
46
|
+
/** Verbatim provider finish/stop reason for the terminal model call. */
|
|
47
|
+
rawFinishReason?: string;
|
|
38
48
|
};
|
|
39
49
|
/**
|
|
40
50
|
* Stream Analytics Data - Enhanced for performance tracking
|
package/dist/types/generate.d.ts
CHANGED
|
@@ -310,6 +310,38 @@ export type GenerateOptions = {
|
|
|
310
310
|
* provider+model with the same doomed budget.
|
|
311
311
|
*/
|
|
312
312
|
timeout?: number | string;
|
|
313
|
+
/**
|
|
314
|
+
* Hard wall-clock cap for the WHOLE agentic turn (all model calls + tool
|
|
315
|
+
* executions), in milliseconds. When the deadline passes the turn ends
|
|
316
|
+
* gracefully with `stopReason: "time-limit"` and an honest time message —
|
|
317
|
+
* never the step-cap text. Unset = no turn-level deadline (the library
|
|
318
|
+
* imposes no product policy).
|
|
319
|
+
*
|
|
320
|
+
* Enforced by the native Vertex loops (Gemini + Claude); AI-SDK-driven
|
|
321
|
+
* providers currently ignore it.
|
|
322
|
+
*/
|
|
323
|
+
turnTimeoutMs?: number;
|
|
324
|
+
/**
|
|
325
|
+
* Maximum time with NO progress — no stream chunk received, no tool
|
|
326
|
+
* execution started or finished, no step started — before the turn ends
|
|
327
|
+
* with `stopReason: "stalled"`. Catches wedged tools and hung model calls
|
|
328
|
+
* that a whole-turn deadline would let run to the bitter end.
|
|
329
|
+
* Unset = disabled.
|
|
330
|
+
*/
|
|
331
|
+
stallTimeoutMs?: number;
|
|
332
|
+
/**
|
|
333
|
+
* When the remaining turn time drops below this, a wrap-up nudge rides the
|
|
334
|
+
* next tool-result turn telling the model to consolidate what it has and
|
|
335
|
+
* produce its final answer. Defaults to 120_000 when `turnTimeoutMs` is
|
|
336
|
+
* set; ignored when it is not.
|
|
337
|
+
*/
|
|
338
|
+
wrapupTimeLeadMs?: number;
|
|
339
|
+
/**
|
|
340
|
+
* Per-tool-execution timeout in milliseconds (default 300_000). A tool
|
|
341
|
+
* that exceeds it fails with an error tool_result and costs one step —
|
|
342
|
+
* the turn continues instead of hanging on a wedged tool.
|
|
343
|
+
*/
|
|
344
|
+
toolTimeoutMs?: number;
|
|
313
345
|
/** AbortSignal for external cancellation of the AI call */
|
|
314
346
|
abortSignal?: AbortSignal;
|
|
315
347
|
/**
|
|
@@ -562,6 +594,21 @@ export type AdditionalMemoryUser = {
|
|
|
562
594
|
/** Max words for this user's condensed memory. Overrides the default maxWords. */
|
|
563
595
|
maxWords?: number;
|
|
564
596
|
};
|
|
597
|
+
/**
|
|
598
|
+
* Why an agentic turn ended — the discriminator consumers should branch on
|
|
599
|
+
* instead of sniffing the provider-shaped `finishReason` (whose values are
|
|
600
|
+
* overloaded: e.g. "tool-calls" historically covered both step-cap exits and
|
|
601
|
+
* Gemini MALFORMED_FUNCTION_CALL provider errors).
|
|
602
|
+
*
|
|
603
|
+
* - `completed` — the model finished on its own (text answer or final_result)
|
|
604
|
+
* - `step-cap` — the `maxSteps` budget ran out while the model still wanted tools
|
|
605
|
+
* - `time-limit` — the `turnTimeoutMs` wall-clock deadline passed
|
|
606
|
+
* - `stalled` — no progress (no chunk, no tool start/finish) for `stallTimeoutMs`
|
|
607
|
+
* - `aborted` — the caller's `abortSignal` ended the turn
|
|
608
|
+
* - `provider-error` — the provider/model failed the turn (e.g. persistent
|
|
609
|
+
* MALFORMED_FUNCTION_CALL after retry); usually worth a caller-side retry
|
|
610
|
+
*/
|
|
611
|
+
export type GenerateStopReason = "completed" | "step-cap" | "time-limit" | "stalled" | "aborted" | "provider-error";
|
|
565
612
|
/**
|
|
566
613
|
* Generate function result type - Primary output format
|
|
567
614
|
* Future-ready for multi-modal outputs while maintaining text focus
|
|
@@ -662,6 +709,20 @@ export type GenerateResult = {
|
|
|
662
709
|
provider?: string;
|
|
663
710
|
model?: string;
|
|
664
711
|
finishReason?: string;
|
|
712
|
+
/**
|
|
713
|
+
* Why the agentic turn ended, independent of the provider-shaped
|
|
714
|
+
* `finishReason`. Populated by the native Vertex loops (Gemini + Claude);
|
|
715
|
+
* undefined on providers that don't run a native loop — fall back to
|
|
716
|
+
* `finishReason` heuristics there.
|
|
717
|
+
*/
|
|
718
|
+
stopReason?: GenerateStopReason;
|
|
719
|
+
/**
|
|
720
|
+
* Verbatim provider finish/stop reason for the turn's terminal model call
|
|
721
|
+
* (e.g. "MALFORMED_FUNCTION_CALL", "MAX_TOKENS", "max_tokens", "tool_use").
|
|
722
|
+
*/
|
|
723
|
+
rawFinishReason?: string;
|
|
724
|
+
/** Number of agentic steps (model calls) the turn used. */
|
|
725
|
+
stepsUsed?: number;
|
|
665
726
|
/**
|
|
666
727
|
* True when the schema JSON in `content`/`structuredData` was repaired from
|
|
667
728
|
* malformed model text (jsonrepair ran). The result is still valid JSON.
|
|
@@ -882,6 +943,14 @@ export type TextGenerationOptions = {
|
|
|
882
943
|
*/
|
|
883
944
|
enabledToolNames?: string[];
|
|
884
945
|
timeout?: number | string;
|
|
946
|
+
/** Wall-clock cap for the whole agentic turn (ms). See GenerateOptions.turnTimeoutMs. */
|
|
947
|
+
turnTimeoutMs?: number;
|
|
948
|
+
/** Max time with no progress before the turn ends as "stalled" (ms). See GenerateOptions.stallTimeoutMs. */
|
|
949
|
+
stallTimeoutMs?: number;
|
|
950
|
+
/** Remaining-time threshold that triggers the wrap-up nudge (ms). See GenerateOptions.wrapupTimeLeadMs. */
|
|
951
|
+
wrapupTimeLeadMs?: number;
|
|
952
|
+
/** Per-tool-execution timeout (ms, default 300_000). See GenerateOptions.toolTimeoutMs. */
|
|
953
|
+
toolTimeoutMs?: number;
|
|
885
954
|
/** AbortSignal for external cancellation of the AI call */
|
|
886
955
|
abortSignal?: AbortSignal;
|
|
887
956
|
disableTools?: boolean;
|
|
@@ -1128,6 +1197,12 @@ export type TextGenerationResult = {
|
|
|
1128
1197
|
/** Parsed structured object when a `schema` was requested (see GenerateResult.structuredData). */
|
|
1129
1198
|
structuredData?: unknown;
|
|
1130
1199
|
finishReason?: string;
|
|
1200
|
+
/** Turn-exit discriminator from native agentic loops (see GenerateStopReason). */
|
|
1201
|
+
stopReason?: GenerateStopReason;
|
|
1202
|
+
/** Verbatim provider finish/stop reason for the turn's terminal model call. */
|
|
1203
|
+
rawFinishReason?: string;
|
|
1204
|
+
/** Number of agentic steps (model calls) the turn used. */
|
|
1205
|
+
stepsUsed?: number;
|
|
1131
1206
|
/** True when the schema JSON was repaired from malformed model text. */
|
|
1132
1207
|
jsonRepaired?: boolean;
|
|
1133
1208
|
/** True when the schema JSON appears truncated (output hit the token cap). */
|
package/dist/types/stream.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import type { JsonValue, UnknownRecord } from "./common.js";
|
|
|
8
8
|
import type { Content, ImageWithAltText } from "./content.js";
|
|
9
9
|
import type { ChatMessage } from "./conversation.js";
|
|
10
10
|
import type { StreamNoOutputSentinel } from "./noOutputSentinel.js";
|
|
11
|
-
import type { AdditionalMemoryUser } from "./generate.js";
|
|
11
|
+
import type { AdditionalMemoryUser, GenerateStopReason } from "./generate.js";
|
|
12
12
|
import type { AIModelProviderConfig, NeurolinkCredentials } from "./providers.js";
|
|
13
13
|
import type { TTSChunk, TTSOptions, TTSResult } from "./tts.js";
|
|
14
14
|
import type { STTOptions, STTResult } from "./stt.js";
|
|
@@ -326,6 +326,14 @@ export type StreamOptions = {
|
|
|
326
326
|
schema?: ValidationSchema;
|
|
327
327
|
tools?: Record<string, Tool>;
|
|
328
328
|
timeout?: number | string;
|
|
329
|
+
/** Wall-clock cap for the whole agentic turn (ms). See GenerateOptions.turnTimeoutMs. */
|
|
330
|
+
turnTimeoutMs?: number;
|
|
331
|
+
/** Max time with no progress before the turn ends as "stalled" (ms). See GenerateOptions.stallTimeoutMs. */
|
|
332
|
+
stallTimeoutMs?: number;
|
|
333
|
+
/** Remaining-time threshold that triggers the wrap-up nudge (ms). See GenerateOptions.wrapupTimeLeadMs. */
|
|
334
|
+
wrapupTimeLeadMs?: number;
|
|
335
|
+
/** Per-tool-execution timeout (ms, default 300_000). See GenerateOptions.toolTimeoutMs. */
|
|
336
|
+
toolTimeoutMs?: number;
|
|
329
337
|
/** AbortSignal for external cancellation of the AI call */
|
|
330
338
|
abortSignal?: AbortSignal;
|
|
331
339
|
disableTools?: boolean;
|
|
@@ -518,6 +526,15 @@ export type StreamResult = {
|
|
|
518
526
|
model?: string;
|
|
519
527
|
usage?: TokenUsage;
|
|
520
528
|
finishReason?: string;
|
|
529
|
+
/**
|
|
530
|
+
* Why the agentic turn ended (see GenerateStopReason). For background-loop
|
|
531
|
+
* streams (native Vertex paths) prefer `metadata.stopReason` after draining
|
|
532
|
+
* the stream — this top-level field may be a getter that resolves late, and
|
|
533
|
+
* wrapper spreads can snapshot it before the loop finishes.
|
|
534
|
+
*/
|
|
535
|
+
stopReason?: GenerateStopReason;
|
|
536
|
+
/** Verbatim provider finish/stop reason for the turn's terminal model call. */
|
|
537
|
+
rawFinishReason?: string;
|
|
521
538
|
toolCalls?: StreamToolCall[];
|
|
522
539
|
toolResults?: StreamToolResult[];
|
|
523
540
|
toolEvents?: AsyncIterable<ToolExecutionEvent>;
|
|
@@ -537,6 +554,9 @@ export type StreamResult = {
|
|
|
537
554
|
guardrailsBlocked?: boolean;
|
|
538
555
|
error?: string;
|
|
539
556
|
finishReason?: string;
|
|
557
|
+
stopReason?: GenerateStopReason;
|
|
558
|
+
rawFinishReason?: string;
|
|
559
|
+
stepsUsed?: number;
|
|
540
560
|
thoughtSignature?: string;
|
|
541
561
|
thoughts?: Array<{
|
|
542
562
|
id?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.81.1",
|
|
4
4
|
"packageManager": "pnpm@10.15.1",
|
|
5
5
|
"description": "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 applications with 21+ providers: OpenAI, Anthropic, Google AI Studio, Google Vertex, AWS Bedrock, Azure OpenAI, Mistral, LiteLLM, SageMaker, Hugging Face, Ollama, OpenAI-compatible, OpenRouter, DeepSeek, NVIDIA NIM, LM Studio, llama.cpp, plus voice (OpenAI TTS, ElevenLabs, Deepgram, Azure Speech).",
|
|
6
6
|
"author": {
|