@juspay/neurolink 11.15.7 → 11.15.8

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.
@@ -136,7 +136,19 @@ export function runAgenticLoop(adapter, initialConversation, options) {
136
136
  hadToolCallsAtCap = true;
137
137
  }
138
138
  const toolResults = [];
139
+ let abortedMidBatch = false;
139
140
  for (const call of stepResult.toolCalls) {
141
+ // Honour an abort BETWEEN tool executions. A step can carry several
142
+ // calls, and each one costs up to a full tool timeout, so without
143
+ // this a wide batch keeps running long past the moment the turn was
144
+ // cancelled — the step-top check above only fires once the whole
145
+ // batch has drained. Passing the signal into execute() is not
146
+ // enough on its own: a tool that ignores it still runs to
147
+ // completion, and every remaining call still gets STARTED.
148
+ if (internalAbort.signal.aborted) {
149
+ abortedMidBatch = true;
150
+ break;
151
+ }
140
152
  allToolCalls.push(call);
141
153
  const breaker = adapter.toolFailureBreaker;
142
154
  const failInfo = breaker ? failedTools.get(call.name) : undefined;
@@ -229,6 +241,15 @@ export function runAgenticLoop(adapter, initialConversation, options) {
229
241
  });
230
242
  }
231
243
  }
244
+ // A batch cut short leaves some calls without results, and the
245
+ // tool-result turn is appended as one message: writing it here would
246
+ // put an unanswered tool call into history. Anthropic rejects exactly
247
+ // that on the next request, and Gemini carries a dangling call
248
+ // forward. Break instead, leaving history ending on the model turn —
249
+ // which is a valid place to stop.
250
+ if (abortedMidBatch) {
251
+ break;
252
+ }
232
253
  conversation = adapter.buildToolResultMessages(conversation, stepResult, toolResults);
233
254
  }
234
255
  const finishReason = adapter.mapFinishReason(rawStopReason, hadToolCallsAtCap);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "11.15.7",
3
+ "version": "11.15.8",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "description": "TypeScript AI SDK with 24+ LLM providers behind one consistent API. MCP-native (connect any MCP server), voice TTS/STT/realtime, RAG, agents, memory, context compaction. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · DeepSeek · NVIDIA NIM and more.",
6
6
  "author": {