@juspay/neurolink 12.14.14 → 12.14.15

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.
@@ -1317,7 +1317,19 @@ export class AnthropicProvider extends BaseProvider {
1317
1317
  // stop_reason "tool_use", but no tool call is surfaced, so
1318
1318
  // reporting "tool-calls" would misread as a step-capped turn.
1319
1319
  // `raw` still carries the provider's verbatim stop_reason.
1320
- unified: finalResultText !== undefined
1320
+ //
1321
+ // Only "tool-calls" is substituted, never every reason. The turn
1322
+ // can also end at stop_reason "max_tokens" — the model was still
1323
+ // writing the final_result arguments when the output ceiling hit,
1324
+ // so the structured payload is cut mid-JSON. Reporting that as
1325
+ // "stop" told the caller the response was complete: neurolink.ts's
1326
+ // `finishReason === "length"` check never fired, so `jsonTruncated`
1327
+ // stayed unset and no truncation warning was logged, leaving a
1328
+ // partial object indistinguishable from a whole one. This mirrors
1329
+ // the streaming path, which already narrows the same substitution
1330
+ // to a "tool-calls" reason.
1331
+ unified: finalResultText !== undefined &&
1332
+ mapAnthropicStopReason(response.stop_reason) === "tool-calls"
1321
1333
  ? "stop"
1322
1334
  : mapAnthropicStopReason(response.stop_reason),
1323
1335
  raw: response.stop_reason ?? "stop",