@volley/recognition-client-sdk 0.1.420 → 0.1.422
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/index.js +0 -12
- package/dist/index.js.map +2 -2
- package/dist/simplified-vgf-recognition-client.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/simplified-vgf-recognition-client.integration.spec.ts +10 -8
- package/src/simplified-vgf-recognition-client.spec.ts +10 -5
- package/src/simplified-vgf-recognition-client.ts +1 -17
- package/src/utils/message-handler.spec.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simplified-vgf-recognition-client.d.ts","sourceRoot":"","sources":["../src/simplified-vgf-recognition-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACH,gBAAgB,EAInB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEH,wBAAwB,EACxB,WAAW,EACd,MAAM,+BAA+B,CAAC;AAWvC;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;IACvE;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAElD;;;OAGG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED;;;;;GAKG;AACH,MAAM,WAAW,+BAA+B;IAE5C;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,WAAW,GAAG,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;IAEjE;;;OAGG;IACH,aAAa,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAE/B;;;;;;;;;;;;;;;;OAgBG;IACH,cAAc,IAAI,IAAI,CAAC;IAGvB;;;OAGG;IACH,WAAW,IAAI,gBAAgB,CAAC;IAGhC;;OAEG;IACH,WAAW,IAAI,OAAO,CAAC;IAEvB;;OAEG;IACH,YAAY,IAAI,OAAO,CAAC;IAExB;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC;IAEtB;;OAEG;IACH,uBAAuB,IAAI,OAAO,CAAC;IAEnC;;OAEG;IACH,mBAAmB,IAAI,OAAO,CAAC;IAG/B;;OAEG;IACH,mBAAmB,IAAI,MAAM,CAAC;IAE9B;;OAEG;IACH,MAAM,IAAI,MAAM,CAAC;IAEjB;;OAEG;IACH,QAAQ,IAAI,WAAW,CAAC;CAE3B;AAED;;;GAGG;AACH,qBAAa,8BAA+B,YAAW,+BAA+B;IAClF,OAAO,CAAC,MAAM,CAAqB;IACnC,OAAO,CAAC,KAAK,CAAmB;IAChC,OAAO,CAAC,gBAAgB,CAAkB;IAC1C,OAAO,CAAC,mBAAmB,CAAkD;IAC7E,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,MAAM,CAAqC;IACnD,OAAO,CAAC,oBAAoB,CAAuB;gBAEvC,MAAM,EAAE,yBAAyB;
|
|
1
|
+
{"version":3,"file":"simplified-vgf-recognition-client.d.ts","sourceRoot":"","sources":["../src/simplified-vgf-recognition-client.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACH,gBAAgB,EAInB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEH,wBAAwB,EACxB,WAAW,EACd,MAAM,+BAA+B,CAAC;AAWvC;;GAEG;AACH,MAAM,WAAW,yBAA0B,SAAQ,wBAAwB;IACvE;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAElD;;;OAGG;IACH,YAAY,CAAC,EAAE,gBAAgB,CAAC;CACnC;AAED;;;;;GAKG;AACH,MAAM,WAAW,+BAA+B;IAE5C;;;OAGG;IACH,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzB;;;OAGG;IACH,SAAS,CAAC,SAAS,EAAE,WAAW,GAAG,eAAe,GAAG,IAAI,GAAG,IAAI,CAAC;IAEj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AM9B,WAAW,IAAI,gBAAgB;IAI/B,OAAO,CAAC,gBAAgB;IAMxB,OAAO,CAAC,iBAAiB;CAuB5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,yBAAyB,GAAG,+BAA+B,CAE5G"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@volley/recognition-client-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.422",
|
|
4
4
|
"description": "Recognition Service TypeScript/Node.js Client SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"semantic-release": "25.0.1",
|
|
55
55
|
"ts-jest": "29.4.5",
|
|
56
56
|
"typescript": "5.1.6",
|
|
57
|
-
"@recog/shared-config": "1.0.0",
|
|
58
|
-
"@recog/websocket": "1.0.0",
|
|
59
57
|
"@recog/shared-types": "1.0.0",
|
|
60
|
-
"@recog/shared-utils": "1.0.0"
|
|
58
|
+
"@recog/shared-utils": "1.0.0",
|
|
59
|
+
"@recog/websocket": "1.0.0",
|
|
60
|
+
"@recog/shared-config": "1.0.0"
|
|
61
61
|
},
|
|
62
62
|
"keywords": [
|
|
63
63
|
"recognition",
|
|
@@ -354,9 +354,9 @@ describe('SimplifiedVGFRecognitionClient Integration - State Transitions', () =>
|
|
|
354
354
|
expect(stateChangeCounter).toBe(3);
|
|
355
355
|
expect(trackingCallback).toHaveBeenCalledTimes(3);
|
|
356
356
|
|
|
357
|
-
//
|
|
357
|
+
// Local state IS updated with late transcript, but callback was not called
|
|
358
358
|
const finalState = client.getVGFState();
|
|
359
|
-
expect(finalState.finalTranscript).toBe('');
|
|
359
|
+
expect(finalState.finalTranscript).toBe('late server response');
|
|
360
360
|
|
|
361
361
|
// Log should indicate suppression
|
|
362
362
|
const suppressionLog = loggerCalls.find(log =>
|
|
@@ -441,9 +441,10 @@ describe('SimplifiedVGFRecognitionClient Integration - State Transitions', () =>
|
|
|
441
441
|
expect(stateChangeCounter).toBe(3);
|
|
442
442
|
expect(trackingCallback).toHaveBeenCalledTimes(3);
|
|
443
443
|
|
|
444
|
-
//
|
|
444
|
+
// Local state IS updated (late transcript overwrites ABORTED), but callback was not called
|
|
445
445
|
const finalState = client.getVGFState();
|
|
446
|
-
expect(finalState.transcriptionStatus).toBe(TranscriptionStatus.
|
|
446
|
+
expect(finalState.transcriptionStatus).toBe(TranscriptionStatus.FINALIZED);
|
|
447
|
+
expect(finalState.finalTranscript).toBe('late server response');
|
|
447
448
|
|
|
448
449
|
// Log should indicate suppression
|
|
449
450
|
const suppressionLog = loggerCalls.find(log =>
|
|
@@ -549,9 +550,10 @@ describe('SimplifiedVGFRecognitionClient Integration - State Transitions', () =>
|
|
|
549
550
|
expect(stateChangeCounter).toBe(3);
|
|
550
551
|
expect(trackingCallback).toHaveBeenCalledTimes(3);
|
|
551
552
|
|
|
552
|
-
//
|
|
553
|
+
// Local state IS updated (late transcript overwrites), but callback was not called
|
|
553
554
|
const finalState = client.getVGFState();
|
|
554
|
-
expect(finalState.transcriptionStatus).toBe(TranscriptionStatus.
|
|
555
|
+
expect(finalState.transcriptionStatus).toBe(TranscriptionStatus.FINALIZED);
|
|
556
|
+
expect(finalState.finalTranscript).toBe('late server response');
|
|
555
557
|
|
|
556
558
|
// Log should indicate suppression for the late transcript
|
|
557
559
|
const suppressionLog = loggerCalls.find(log =>
|
|
@@ -643,9 +645,9 @@ describe('SimplifiedVGFRecognitionClient Integration - State Transitions', () =>
|
|
|
643
645
|
);
|
|
644
646
|
expect(suppressionLog).toBeDefined();
|
|
645
647
|
|
|
646
|
-
//
|
|
648
|
+
// Local state IS updated with new transcript, but callback was not called
|
|
647
649
|
const finalState = client.getVGFState();
|
|
648
|
-
expect(finalState.finalTranscript).toBe('
|
|
650
|
+
expect(finalState.finalTranscript).toBe('different transcript');
|
|
649
651
|
});
|
|
650
652
|
|
|
651
653
|
it('should reset terminal status flag when new UUID is generated', () => {
|
|
@@ -1492,7 +1492,7 @@ describe('SimplifiedVGFRecognitionClient', () => {
|
|
|
1492
1492
|
expect(stateChangeCallback).not.toHaveBeenCalled();
|
|
1493
1493
|
});
|
|
1494
1494
|
|
|
1495
|
-
it('should
|
|
1495
|
+
it('should update local state but block callback for duplicate terminal', () => {
|
|
1496
1496
|
// First terminal with specific transcript
|
|
1497
1497
|
onTranscriptCallback({
|
|
1498
1498
|
type: 'Transcription',
|
|
@@ -1502,7 +1502,9 @@ describe('SimplifiedVGFRecognitionClient', () => {
|
|
|
1502
1502
|
is_finished: true
|
|
1503
1503
|
});
|
|
1504
1504
|
|
|
1505
|
-
|
|
1505
|
+
stateChangeCallback.mockClear();
|
|
1506
|
+
|
|
1507
|
+
// Second terminal with different transcript
|
|
1506
1508
|
onTranscriptCallback({
|
|
1507
1509
|
type: 'Transcription',
|
|
1508
1510
|
audioUtteranceId: clientUuid,
|
|
@@ -1511,10 +1513,13 @@ describe('SimplifiedVGFRecognitionClient', () => {
|
|
|
1511
1513
|
is_finished: true
|
|
1512
1514
|
});
|
|
1513
1515
|
|
|
1514
|
-
//
|
|
1516
|
+
// Local state should be updated with new values
|
|
1515
1517
|
const state = simplifiedClient.getVGFState();
|
|
1516
|
-
expect(state.finalTranscript).toBe('
|
|
1517
|
-
expect(state.finalConfidence).toBe(0.
|
|
1518
|
+
expect(state.finalTranscript).toBe('different');
|
|
1519
|
+
expect(state.finalConfidence).toBe(0.99);
|
|
1520
|
+
|
|
1521
|
+
// But callback should NOT have been called for the duplicate
|
|
1522
|
+
expect(stateChangeCallback).not.toHaveBeenCalled();
|
|
1518
1523
|
});
|
|
1519
1524
|
});
|
|
1520
1525
|
});
|
|
@@ -246,18 +246,7 @@ export class SimplifiedVGFRecognitionClient implements ISimplifiedVGFRecognition
|
|
|
246
246
|
return;
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
//
|
|
250
|
-
// (If lastSentTerminalUuid exists but doesn't match expectedUuid, treat as new session)
|
|
251
|
-
if (this.lastSentTerminalUuid === this.expectedUuid) {
|
|
252
|
-
if (this.logger) {
|
|
253
|
-
this.logger('info',
|
|
254
|
-
`[RecogSDK:VGF] Duplicate terminal status suppressed (lastSentTerminalUuid: ${this.lastSentTerminalUuid})`
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
// Update VGF state based on transcript
|
|
249
|
+
// Update VGF state based on transcript (always update local state)
|
|
261
250
|
this.state = mapTranscriptionResultToState(this.state, result, this.isRecordingAudio);
|
|
262
251
|
this.notifyStateChange();
|
|
263
252
|
|
|
@@ -301,11 +290,6 @@ export class SimplifiedVGFRecognitionClient implements ISimplifiedVGFRecognition
|
|
|
301
290
|
return;
|
|
302
291
|
}
|
|
303
292
|
|
|
304
|
-
// Skip if terminal status already sent for THIS session
|
|
305
|
-
if (this.lastSentTerminalUuid === this.expectedUuid) {
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
|
|
309
293
|
this.isRecordingAudio = false; // Reset on error
|
|
310
294
|
this.state = mapErrorToState(this.state, error);
|
|
311
295
|
this.notifyStateChange();
|
|
@@ -111,7 +111,7 @@ describe('MessageHandler', () => {
|
|
|
111
111
|
handler.handleMessage(msg);
|
|
112
112
|
expect(mockLogger).toHaveBeenCalledWith(
|
|
113
113
|
'debug',
|
|
114
|
-
'Unknown message type',
|
|
114
|
+
'[RecogSDK] Unknown message type',
|
|
115
115
|
expect.objectContaining({ type: 'unknown' })
|
|
116
116
|
);
|
|
117
117
|
});
|
|
@@ -129,7 +129,7 @@ describe('MessageHandler', () => {
|
|
|
129
129
|
handler.handleMessage(msg);
|
|
130
130
|
expect(mockLogger).toHaveBeenCalledWith(
|
|
131
131
|
'debug',
|
|
132
|
-
'Received WebSocket message',
|
|
132
|
+
'[RecogSDK] Received WebSocket message',
|
|
133
133
|
expect.objectContaining({
|
|
134
134
|
msgType: 'recognition_result',
|
|
135
135
|
msgDataType: RecognitionResultTypeV1.TRANSCRIPTION
|
|
@@ -147,7 +147,7 @@ describe('MessageHandler', () => {
|
|
|
147
147
|
handler.handleMessage(msg);
|
|
148
148
|
expect(mockLogger).toHaveBeenCalledWith(
|
|
149
149
|
'error',
|
|
150
|
-
'Received primitive msg.data from server',
|
|
150
|
+
'[RecogSDK] Received primitive msg.data from server',
|
|
151
151
|
expect.objectContaining({
|
|
152
152
|
dataType: 'string',
|
|
153
153
|
data: 'primitive string'
|
|
@@ -253,7 +253,7 @@ describe('MessageHandler', () => {
|
|
|
253
253
|
|
|
254
254
|
expect(mockLogger).toHaveBeenCalledWith(
|
|
255
255
|
'debug',
|
|
256
|
-
'First transcript received',
|
|
256
|
+
'[RecogSDK] First transcript received',
|
|
257
257
|
expect.objectContaining({
|
|
258
258
|
timeToFirstTranscriptMs: expect.any(Number)
|
|
259
259
|
})
|