@juspay/neurolink 11.24.0 → 11.24.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 +3 -3
- package/dist/browser/neurolink.min.js +132 -132
- package/dist/core/baseProvider.d.ts +11 -0
- package/dist/core/baseProvider.js +16 -3
- package/dist/neurolink.js +4 -0
- package/dist/types/generate.d.ts +16 -2
- package/package.json +1 -1
|
@@ -220,6 +220,17 @@ export declare abstract class BaseProvider implements AIProvider {
|
|
|
220
220
|
private handleVideoFrameGeneration;
|
|
221
221
|
private executeStandardGenerateFlow;
|
|
222
222
|
protected synthesizeAIResponseIfNeeded(enhancedResult: EnhancedGenerateResult, options: TextGenerationOptions): Promise<EnhancedGenerateResult>;
|
|
223
|
+
/**
|
|
224
|
+
* Build the public TTS failure detail.
|
|
225
|
+
*
|
|
226
|
+
* The message is redacted through the shared `sanitizeErrorCause` before it
|
|
227
|
+
* leaves this method. It used to be an internal value that only reached the
|
|
228
|
+
* logger; it is now carried on `result.ttsMetadata` and therefore reaches
|
|
229
|
+
* SDK callers, who may forward it to an end user. Provider errors quote the
|
|
230
|
+
* request URL often enough that a key in a query string is a real vector —
|
|
231
|
+
* `redactUrlsInText` strips exactly that while leaving a bare URL readable,
|
|
232
|
+
* so the diagnosis survives and the credential does not.
|
|
233
|
+
*/
|
|
223
234
|
private getTTSErrorDetails;
|
|
224
235
|
/**
|
|
225
236
|
* BACKWARD COMPATIBILITY: Legacy generateText method
|
|
@@ -5,6 +5,7 @@ import { MiddlewareFactory } from "../middleware/factory.js";
|
|
|
5
5
|
import { modelSupports } from "../models/modelRegistry.js";
|
|
6
6
|
import { ATTR, tracers } from "../telemetry/index.js";
|
|
7
7
|
import { ERROR_CODES, isAbortError, NeuroLinkError, } from "../utils/errorHandling.js";
|
|
8
|
+
import { sanitizeErrorCause } from "../utils/logSanitize.js";
|
|
8
9
|
import { createAnalytics as buildAnalytics } from "./analytics.js";
|
|
9
10
|
import { ErrorCategory, ErrorSeverity } from "../constants/enums.js";
|
|
10
11
|
import { duckTypedStatusCode, extractRetryAfterMsFromError, } from "../utils/providerRetry.js";
|
|
@@ -1224,24 +1225,36 @@ export class BaseProvider {
|
|
|
1224
1225
|
};
|
|
1225
1226
|
}
|
|
1226
1227
|
}
|
|
1228
|
+
/**
|
|
1229
|
+
* Build the public TTS failure detail.
|
|
1230
|
+
*
|
|
1231
|
+
* The message is redacted through the shared `sanitizeErrorCause` before it
|
|
1232
|
+
* leaves this method. It used to be an internal value that only reached the
|
|
1233
|
+
* logger; it is now carried on `result.ttsMetadata` and therefore reaches
|
|
1234
|
+
* SDK callers, who may forward it to an end user. Provider errors quote the
|
|
1235
|
+
* request URL often enough that a key in a query string is a real vector —
|
|
1236
|
+
* `redactUrlsInText` strips exactly that while leaving a bare URL readable,
|
|
1237
|
+
* so the diagnosis survives and the credential does not.
|
|
1238
|
+
*/
|
|
1227
1239
|
getTTSErrorDetails(error) {
|
|
1240
|
+
const safeMessage = sanitizeErrorCause(error).message;
|
|
1228
1241
|
if (error instanceof AsyncTimeoutError) {
|
|
1229
1242
|
return {
|
|
1230
1243
|
code: TTS_ERROR_CODES.SYNTHESIS_FAILED,
|
|
1231
|
-
message:
|
|
1244
|
+
message: safeMessage,
|
|
1232
1245
|
retriable: true,
|
|
1233
1246
|
};
|
|
1234
1247
|
}
|
|
1235
1248
|
if (error instanceof NeuroLinkError) {
|
|
1236
1249
|
return {
|
|
1237
1250
|
code: error.code,
|
|
1238
|
-
message:
|
|
1251
|
+
message: safeMessage,
|
|
1239
1252
|
retriable: error.retriable,
|
|
1240
1253
|
};
|
|
1241
1254
|
}
|
|
1242
1255
|
return {
|
|
1243
1256
|
code: TTS_ERROR_CODES.SYNTHESIS_FAILED,
|
|
1244
|
-
message:
|
|
1257
|
+
message: safeMessage,
|
|
1245
1258
|
};
|
|
1246
1259
|
}
|
|
1247
1260
|
/**
|
package/dist/neurolink.js
CHANGED
|
@@ -4237,6 +4237,7 @@ Current user's request: ${currentInput}`;
|
|
|
4237
4237
|
}
|
|
4238
4238
|
: undefined,
|
|
4239
4239
|
audio: textResult.audio,
|
|
4240
|
+
ttsMetadata: textResult.ttsMetadata,
|
|
4240
4241
|
transcription: textResult.transcription,
|
|
4241
4242
|
video: textResult.video,
|
|
4242
4243
|
avatar: textResult.avatar,
|
|
@@ -5719,6 +5720,7 @@ Current user's request: ${currentInput}`;
|
|
|
5719
5720
|
enhancedWithTools: Boolean(hasToolExecutions),
|
|
5720
5721
|
availableTools: transformToolsForMCP(transformToolsToExpectedFormat(availableTools)),
|
|
5721
5722
|
audio: result.audio,
|
|
5723
|
+
ttsMetadata: result.ttsMetadata,
|
|
5722
5724
|
video: result.video,
|
|
5723
5725
|
avatar: result.avatar,
|
|
5724
5726
|
music: result.music,
|
|
@@ -5867,6 +5869,7 @@ Current user's request: ${currentInput}`;
|
|
|
5867
5869
|
analytics: poolResult.analytics,
|
|
5868
5870
|
evaluation: poolResult.evaluation,
|
|
5869
5871
|
audio: poolResult.audio,
|
|
5872
|
+
ttsMetadata: poolResult.ttsMetadata,
|
|
5870
5873
|
video: poolResult.video,
|
|
5871
5874
|
avatar: poolResult.avatar,
|
|
5872
5875
|
music: poolResult.music,
|
|
@@ -6149,6 +6152,7 @@ Current user's request: ${currentInput}`;
|
|
|
6149
6152
|
analytics: result.analytics,
|
|
6150
6153
|
evaluation: result.evaluation,
|
|
6151
6154
|
audio: result.audio,
|
|
6155
|
+
ttsMetadata: result.ttsMetadata,
|
|
6152
6156
|
video: result.video,
|
|
6153
6157
|
avatar: result.avatar,
|
|
6154
6158
|
music: result.music,
|
package/dist/types/generate.d.ts
CHANGED
|
@@ -848,6 +848,20 @@ export type GenerateResult = {
|
|
|
848
848
|
* ```
|
|
849
849
|
*/
|
|
850
850
|
audio?: TTSResult;
|
|
851
|
+
/**
|
|
852
|
+
* What happened during TTS synthesis, including why it failed.
|
|
853
|
+
*
|
|
854
|
+
* `generate()` degrades gracefully when synthesis fails: it returns the text
|
|
855
|
+
* and omits `audio`. Without this field a caller cannot tell a request that
|
|
856
|
+
* never asked for audio from one whose provider rejected the credentials —
|
|
857
|
+
* an invalid key produces a silent, indistinguishable absence.
|
|
858
|
+
*
|
|
859
|
+
* BaseProvider has always recorded this on EnhancedGenerateResult; it was
|
|
860
|
+
* declared there but never forwarded by the result builders, so callers
|
|
861
|
+
* reading it got `undefined`. Same defect the `reasoning` comment in
|
|
862
|
+
* neurolink.ts describes, on a different field.
|
|
863
|
+
*/
|
|
864
|
+
ttsMetadata?: TTSMetadata;
|
|
851
865
|
/**
|
|
852
866
|
* Video generation result
|
|
853
867
|
*
|
|
@@ -1454,6 +1468,8 @@ export type TextGenerationResult = {
|
|
|
1454
1468
|
analytics?: AnalyticsData;
|
|
1455
1469
|
evaluation?: EvaluationData;
|
|
1456
1470
|
audio?: TTSResult;
|
|
1471
|
+
/** Outcome of TTS synthesis, including the failure reason. */
|
|
1472
|
+
ttsMetadata?: TTSMetadata;
|
|
1457
1473
|
/** STT transcription result (present when stt input was processed) */
|
|
1458
1474
|
transcription?: STTResult;
|
|
1459
1475
|
/** Video generation result */
|
|
@@ -1502,8 +1518,6 @@ export type TTSMetadata = {
|
|
|
1502
1518
|
export type EnhancedGenerateResult = GenerateResult & {
|
|
1503
1519
|
analytics?: AnalyticsData;
|
|
1504
1520
|
evaluation?: EvaluationData;
|
|
1505
|
-
/** Outcome metadata when TTS was enabled for this generation. */
|
|
1506
|
-
ttsMetadata?: TTSMetadata;
|
|
1507
1521
|
};
|
|
1508
1522
|
/**
|
|
1509
1523
|
* NL-004: Model alias/deprecation configuration.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juspay/neurolink",
|
|
3
|
-
"version": "11.24.
|
|
3
|
+
"version": "11.24.1",
|
|
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": {
|