@volley/recognition-client-sdk 0.1.621 → 0.1.622
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/dist/browser.bundled.d.ts +3 -0
- package/dist/index.bundled.d.ts +55 -46
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +26 -5
- package/dist/index.js.map +2 -2
- package/dist/recog-client-sdk.browser.js +5 -4
- package/dist/recog-client-sdk.browser.js.map +2 -2
- package/dist/vgf-recognition-mapper.d.ts.map +1 -1
- package/dist/vgf-recognition-state.d.ts +6 -0
- package/dist/vgf-recognition-state.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +1 -0
- package/src/recognition-client.ts +4 -4
- package/src/vgf-recognition-mapper.ts +19 -1
- package/src/vgf-recognition-state.ts +4 -0
package/dist/index.js
CHANGED
|
@@ -3826,6 +3826,7 @@ var TranscriptionResultSchemaV1 = z.object({
|
|
|
3826
3826
|
voiceStart: z.number().optional(),
|
|
3827
3827
|
voiceDuration: z.number().optional(),
|
|
3828
3828
|
voiceEnd: z.number().optional(),
|
|
3829
|
+
lastNonSilence: z.number().optional(),
|
|
3829
3830
|
startTimestamp: z.number().optional(),
|
|
3830
3831
|
endTimestamp: z.number().optional(),
|
|
3831
3832
|
receivedAtMs: z.number().optional(),
|
|
@@ -5529,7 +5530,7 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
|
|
|
5529
5530
|
const timeout = setTimeout(() => {
|
|
5530
5531
|
if (settled) return;
|
|
5531
5532
|
settled = true;
|
|
5532
|
-
this.log("warn",
|
|
5533
|
+
this.log("warn", `Connection timeout url=${this.config.url}`, { timeout: connectionTimeout, attempt });
|
|
5533
5534
|
this.state = "failed" /* FAILED */;
|
|
5534
5535
|
reject(new Error(`Connection timeout after ${connectionTimeout}ms`));
|
|
5535
5536
|
}, connectionTimeout);
|
|
@@ -5551,7 +5552,7 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
|
|
|
5551
5552
|
if (settled) return;
|
|
5552
5553
|
settled = true;
|
|
5553
5554
|
clearTimeout(timeout);
|
|
5554
|
-
this.log("warn",
|
|
5555
|
+
this.log("warn", `Connection error url=${this.config.url}`, { error, attempt });
|
|
5555
5556
|
this.state = "failed" /* FAILED */;
|
|
5556
5557
|
reject(error);
|
|
5557
5558
|
};
|
|
@@ -5566,14 +5567,14 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
|
|
|
5566
5567
|
lastError = error;
|
|
5567
5568
|
if (attempt < maxAttempts) {
|
|
5568
5569
|
const logLevel = attempt < 3 ? "info" : "warn";
|
|
5569
|
-
this.log(logLevel, `Connection attempt ${attempt} failed, retrying after ${delayMs}ms`, {
|
|
5570
|
+
this.log(logLevel, `Connection attempt ${attempt} failed, retrying after ${delayMs}ms url=${this.config.url}`, {
|
|
5570
5571
|
error: lastError.message,
|
|
5571
5572
|
nextAttempt: attempt + 1
|
|
5572
5573
|
});
|
|
5573
5574
|
this.state = "initial" /* INITIAL */;
|
|
5574
5575
|
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
5575
5576
|
} else {
|
|
5576
|
-
this.log("warn", `All ${maxAttempts} connection attempts failed`, {
|
|
5577
|
+
this.log("warn", `All ${maxAttempts} connection attempts failed url=${this.config.url}`, {
|
|
5577
5578
|
error: lastError.message
|
|
5578
5579
|
});
|
|
5579
5580
|
}
|
|
@@ -6187,6 +6188,11 @@ var RecognitionVGFStateSchema = z.object({
|
|
|
6187
6188
|
finalTranscript: z.string().optional(),
|
|
6188
6189
|
// Full finalized transcript for the utterance. Will not change.
|
|
6189
6190
|
finalConfidence: z.number().optional(),
|
|
6191
|
+
// Voice timing (ms from stream start, prefix-adjusted)
|
|
6192
|
+
voiceEnd: z.number().optional(),
|
|
6193
|
+
// voice end time identified by ASR
|
|
6194
|
+
lastNonSilence: z.number().optional(),
|
|
6195
|
+
// last non-silence sample time from PCM analysis
|
|
6190
6196
|
// Tracking-only metadata
|
|
6191
6197
|
asrConfig: z.string().optional(),
|
|
6192
6198
|
// Json format of the ASR config
|
|
@@ -6275,6 +6281,12 @@ function mapTranscriptionResultToState(currentState, result, isRecording) {
|
|
|
6275
6281
|
newState.finalConfidence = result.finalTranscriptConfidence;
|
|
6276
6282
|
}
|
|
6277
6283
|
}
|
|
6284
|
+
if (result.voiceEnd !== void 0) {
|
|
6285
|
+
newState.voiceEnd = result.voiceEnd;
|
|
6286
|
+
}
|
|
6287
|
+
if (result.lastNonSilence !== void 0) {
|
|
6288
|
+
newState.lastNonSilence = result.lastNonSilence;
|
|
6289
|
+
}
|
|
6278
6290
|
} else {
|
|
6279
6291
|
newState.transcriptionStatus = TranscriptionStatus.FINALIZED;
|
|
6280
6292
|
newState.finalTranscript = result.finalTranscript || "";
|
|
@@ -6282,6 +6294,12 @@ function mapTranscriptionResultToState(currentState, result, isRecording) {
|
|
|
6282
6294
|
newState.finalConfidence = result.finalTranscriptConfidence;
|
|
6283
6295
|
}
|
|
6284
6296
|
newState.finalTranscriptionTimestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
6297
|
+
if (result.voiceEnd !== void 0) {
|
|
6298
|
+
newState.voiceEnd = result.voiceEnd;
|
|
6299
|
+
}
|
|
6300
|
+
if (result.lastNonSilence !== void 0) {
|
|
6301
|
+
newState.lastNonSilence = result.lastNonSilence;
|
|
6302
|
+
}
|
|
6285
6303
|
newState.pendingTranscript = "";
|
|
6286
6304
|
newState.pendingConfidence = void 0;
|
|
6287
6305
|
}
|
|
@@ -6317,7 +6335,9 @@ function resetRecognitionVGFState(currentState) {
|
|
|
6317
6335
|
transcriptionStatus: TranscriptionStatus.NOT_STARTED,
|
|
6318
6336
|
startRecordingStatus: RecordingStatus.READY,
|
|
6319
6337
|
recognitionActionProcessingState: RecognitionActionProcessingState.NOT_STARTED,
|
|
6320
|
-
finalTranscript: void 0
|
|
6338
|
+
finalTranscript: void 0,
|
|
6339
|
+
voiceEnd: void 0,
|
|
6340
|
+
lastNonSilence: void 0
|
|
6321
6341
|
};
|
|
6322
6342
|
}
|
|
6323
6343
|
function generateUUID() {
|
|
@@ -6588,6 +6608,7 @@ export {
|
|
|
6588
6608
|
Language,
|
|
6589
6609
|
MistralVoxtralModel,
|
|
6590
6610
|
OpenAIModel,
|
|
6611
|
+
OpenAIRealtimeModel,
|
|
6591
6612
|
RECOGNITION_CONDUCTOR_BASES,
|
|
6592
6613
|
RECOGNITION_SERVICE_BASES,
|
|
6593
6614
|
RealTimeTwoWayWebSocketRecognitionClient,
|