@juspay/neurolink 12.14.12 → 12.14.13

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.
@@ -4,6 +4,8 @@ import { createAnalytics } from "../../core/analytics.js";
4
4
  import { BaseProvider } from "../../core/baseProvider.js";
5
5
  import { DEFAULT_MAX_STEPS } from "../../core/constants.js";
6
6
  import { runAgenticLoop } from "../../core/loopEngine.js";
7
+ import { resolveToolExecutionRecords } from "../../core/toolExecutionRecorder.js";
8
+ import { transformToolExecutions } from "../../utils/transformationUtils.js";
7
9
  import { createBedrockLoopAdapter } from "./loopAdapter.js";
8
10
  import { AuthenticationError, ProviderError, RateLimitError, } from "../../types/index.js";
9
11
  import { classifyProviderError } from "../../utils/errorClassifier.js";
@@ -205,8 +207,9 @@ export class AmazonBedrockProvider extends BaseProvider {
205
207
  let usage;
206
208
  let finishReason;
207
209
  let rawFinishReason;
210
+ let toolExecutions;
208
211
  try {
209
- ({ text, usage, finishReason, rawFinishReason } =
212
+ ({ text, usage, finishReason, rawFinishReason, toolExecutions } =
210
213
  await this.conversationLoop(options));
211
214
  }
212
215
  catch (error) {
@@ -249,6 +252,11 @@ export class AmazonBedrockProvider extends BaseProvider {
249
252
  success: true,
250
253
  });
251
254
  }
255
+ // Tool telemetry, mirroring the other `runAgenticLoop` consumers
256
+ // (anthropic, vertex, google-ai). Bedrock forwarded none of it, so
257
+ // `baseProvider` fell back to `result.toolsUsed || []` and every turn
258
+ // reported zero tools while running them correctly — leaving analytics,
259
+ // cost attribution and audit blind on this path.
252
260
  return {
253
261
  content: text, // CLI expects 'content' not 'text'
254
262
  usage,
@@ -256,6 +264,14 @@ export class AmazonBedrockProvider extends BaseProvider {
256
264
  provider: this.getProviderName(),
257
265
  ...(finishReason !== undefined && { finishReason }),
258
266
  ...(rawFinishReason !== undefined && { rawFinishReason }),
267
+ toolsUsed: toolExecutions.map((execution) => execution.name),
268
+ toolCalls: toolExecutions.map((execution) => ({
269
+ toolCallId: execution.id,
270
+ toolName: execution.name,
271
+ args: execution.input,
272
+ })),
273
+ toolExecutions: resolveToolExecutionRecords(options, transformToolExecutions(toolExecutions)),
274
+ enhancedWithTools: toolExecutions.length > 0,
259
275
  };
260
276
  }
261
277
  async conversationLoop(options) {
@@ -326,6 +342,7 @@ export class AmazonBedrockProvider extends BaseProvider {
326
342
  // kept alongside rather than dropped.
327
343
  finishReason: result.finishReason,
328
344
  rawFinishReason: result.rawStopReason,
345
+ toolExecutions: result.toolExecutions,
329
346
  };
330
347
  }
331
348
  catch (error) {
@@ -960,7 +977,14 @@ export class AmazonBedrockProvider extends BaseProvider {
960
977
  // body — and its finally block — never runs. Resolving twice is
961
978
  // harmless; the first call wins.
962
979
  void settled.then((outcome) => {
963
- resolveAnalytics(createAnalytics(this.providerName, this.modelName || this.getDefaultModel(), { usage: usageFromOutcome(outcome.result?.usage) }, Date.now() - startTime, {
980
+ resolveAnalytics(createAnalytics(this.providerName, this.modelName || this.getDefaultModel(), {
981
+ usage: usageFromOutcome(outcome.result?.usage),
982
+ // createAnalytics derives toolCallCount from these. Passing usage
983
+ // alone left every streamed Bedrock turn reporting no tool calls,
984
+ // however many it made.
985
+ toolExecutions: outcome.result?.toolExecutions ?? [],
986
+ toolsUsed: (outcome.result?.toolExecutions ?? []).map((execution) => execution.name),
987
+ }, Date.now() - startTime, {
964
988
  requestId: `bedrock-stream-${Date.now()}`,
965
989
  streamingMode: true,
966
990
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "12.14.12",
3
+ "version": "12.14.13",
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": {