@juspay/neurolink 12.34.1 → 12.34.2

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.
@@ -1812,6 +1812,20 @@ export class OpenAIChatCompletionsProvider extends BaseProvider {
1812
1812
  // `loopPromise` is undefined when a middleware blocked the request
1813
1813
  // before `doStream` ran, in which case there is no loop to surface.
1814
1814
  await loopPromise;
1815
+ // Record the terminal finish reason on the metadata object this
1816
+ // provider returns by reference (`result.metadata`). A rejected
1817
+ // `loopPromise` throws out of this `await` straight into the `catch`
1818
+ // below, so reaching this line means `runStreamLoop` returned
1819
+ // normally and already called `resolveFinish` with the wire value —
1820
+ // `finishPromise` is settled, not pending.
1821
+ //
1822
+ // `rawFinishReason` is the verbatim vendor value (e.g. "stop",
1823
+ // "length", "tool_calls", "content_filter") and is accurate the
1824
+ // moment the wire stream itself finished, independent of whatever
1825
+ // post-stream work follows. The graded `finishReason` is set later,
1826
+ // once that post-stream work (the structured-output re-ask below)
1827
+ // has actually succeeded — see the assignment after that block.
1828
+ streamMetadata.rawFinishReason = await finishPromise;
1815
1829
  // Structured output for a `stream({ schema })` turn. Runs HERE —
1816
1830
  // after the stream is fully drained — so a tool-free re-ask (when the
1817
1831
  // streamed answer isn't already schema-valid) never reaches
@@ -1853,6 +1867,12 @@ export class OpenAIChatCompletionsProvider extends BaseProvider {
1853
1867
  });
1854
1868
  }
1855
1869
  }
1870
+ // Only reached once the structured-output re-ask above (when there
1871
+ // was one) has resolved without throwing. A caller abort during that
1872
+ // re-ask rejects `resolveStreamStructuredData` and skips this line
1873
+ // entirely, so `metadata.finishReason` never claims "stop" for a
1874
+ // turn that actually failed after the wire stream itself finished.
1875
+ streamMetadata.finishReason = "stop";
1856
1876
  // No-output path: stream completed normally but yielded zero text.
1857
1877
  // Build an enriched sentinel + stamp the active OTel span so
1858
1878
  // Pipeline B (ContextEnricher) surfaces a WARNING-level Langfuse
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juspay/neurolink",
3
- "version": "12.34.1",
3
+ "version": "12.34.2",
4
4
  "packageManager": "pnpm@10.15.1",
5
5
  "description": "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/call) for routing, tool selection and context budgeting. MCP-native (4 transports), voice TTS/STT/realtime, RAG, agents, memory, compaction, 9 observability exporters. OpenAI · Anthropic · Gemini · Bedrock · Azure · Ollama · TypeSafe Jev and more.",
6
6
  "author": {