@volley/recognition-client-sdk 0.1.799 → 0.1.803
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 +15 -0
- package/dist/index.bundled.d.ts +139 -93
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +96 -11
- package/dist/index.js.map +2 -2
- package/dist/recognition-client.types.d.ts +15 -0
- package/dist/recognition-client.types.d.ts.map +1 -1
- package/dist/simplified-vgf-recognition-client.d.ts +15 -94
- package/dist/simplified-vgf-recognition-client.d.ts.map +1 -1
- package/dist/vgf-recognition-mapper.d.ts +9 -17
- package/dist/vgf-recognition-mapper.d.ts.map +1 -1
- package/dist/vgf-recognition-state.d.ts +110 -0
- package/dist/vgf-recognition-state.d.ts.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +1 -0
- package/src/recognition-client.types.ts +16 -0
- package/src/simplified-vgf-recognition-client.spec.ts +0 -27
- package/src/simplified-vgf-recognition-client.ts +84 -133
- package/src/vgf-recognition-mapper.spec.ts +143 -0
- package/src/vgf-recognition-mapper.ts +35 -45
- package/src/vgf-recognition-state.ts +44 -1
|
@@ -170,6 +170,11 @@ export interface IRecognitionClientConfig {
|
|
|
170
170
|
*
|
|
171
171
|
* Main interface for real-time speech recognition clients.
|
|
172
172
|
* Provides methods for connection management, audio streaming, and session control.
|
|
173
|
+
*
|
|
174
|
+
* NOTE for maintainers: `ISimplifiedVGFRecognitionClient` extends this interface,
|
|
175
|
+
* so any method added here must also be implemented (typically as a delegate) by
|
|
176
|
+
* `SimplifiedVGFRecognitionClient`. TypeScript will flag missing delegates at
|
|
177
|
+
* compile time — do not work around the error, add the delegate.
|
|
173
178
|
*/
|
|
174
179
|
export interface IRecognitionClient {
|
|
175
180
|
/**
|
|
@@ -201,6 +206,16 @@ export interface IRecognitionClient {
|
|
|
201
206
|
* @param sourceSampleRate - Source sample rate in Hz (e.g. 44100, 48000).
|
|
202
207
|
*/
|
|
203
208
|
sendAudioWithSampleRate(audioData: ArrayBuffer | ArrayBufferView | Blob, sourceSampleRate: number): void;
|
|
209
|
+
/**
|
|
210
|
+
* Send prefix audio (e.g. a TTS prompt) that primes the provider's language
|
|
211
|
+
* model before user audio is streamed. Chunks accepted — the server buffers
|
|
212
|
+
* until the session is READY and flushes. Must be sent BEFORE the first
|
|
213
|
+
* `sendAudio()` to take effect. Only meaningful when
|
|
214
|
+
* `asrRequestConfig.prefixMode === PrefixMode.CLIENT`.
|
|
215
|
+
*
|
|
216
|
+
* @param audioData - PCM audio data as ArrayBuffer, typed array view, or Blob
|
|
217
|
+
*/
|
|
218
|
+
sendPrefixAudio(audioData: ArrayBuffer | ArrayBufferView | Blob): void;
|
|
204
219
|
/**
|
|
205
220
|
* Stop recording and wait for final transcript
|
|
206
221
|
* The server will close the connection after sending the final transcript.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recognition-client.types.d.ts","sourceRoot":"","sources":["../src/recognition-client.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,KAAK,EACN,MAAM,qBAAqB,CAAC;AAE7B;;;GAGG;AACH,oBAAY,WAAW;IACrB,+CAA+C;IAC/C,OAAO,YAAY;IAEnB,iDAAiD;IACjD,UAAU,eAAe;IAEzB,8DAA8D;IAC9D,SAAS,cAAc;IAEvB,mCAAmC;IACnC,KAAK,UAAU;IAEf,qDAAqD;IACrD,QAAQ,aAAa;IAErB,4CAA4C;IAC5C,OAAO,YAAY;IAEnB,6CAA6C;IAC7C,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,gCAAgC;IAChC,GAAG,EAAE,MAAM,CAAC;IAEZ,yFAAyF;IACzF,YAAY,CAAC,EAAE,KAAK,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cAAc,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAEzD,oFAAoF;IACpF,mBAAmB,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,KAAK,IAAI,CAAC;IAE5D,iCAAiC;IACjC,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAEzC,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IAEzB;;;;OAIG;IACH,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAExD,uDAAuD;IACvD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,wDAAwD;IACxD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,uEAAuE;IACvE,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;;;;;;;;;;;;;;;;OAiBG;IACH,eAAe,CAAC,EAAE;QAChB,yEAAyE;QACzE,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,oEAAoE;QACpE,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC;IAEF;;;;;;OAMG;IAEH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,KAAK,IAAI,CAAC;CAC5F;AAED
|
|
1
|
+
{"version":3,"file":"recognition-client.types.d.ts","sourceRoot":"","sources":["../src/recognition-client.types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB,aAAa,EACb,KAAK,EACN,MAAM,qBAAqB,CAAC;AAE7B;;;GA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EG;AACH,MAAM,WAAW,uBAAuB;IACtC,uCAAuC;IACvC,cAAc,EAAE,MAAM,CAAC;IAEvB,wCAAwC;IACxC,eAAe,EAAE,MAAM,CAAC;IAExB,4CAA4C;IAC5C,mBAAmB,EAAE,MAAM,CAAC;IAE5B,iDAAiD;IACjD,mBAAmB,EAAE,MAAM,CAAC;IAE5B,yCAAyC;IACzC,qBAAqB,EAAE,MAAM,CAAC;IAE9B,iEAAiE;IACjE,UAAU,EAAE,OAAO,CAAC;CACrB;AAED;;;;GAIG;AAEH,MAAM,WAAW,8CAA+C,SAAQ,wBAAwB;CAG/F"}
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* All functionality is delegated to the underlying client.
|
|
9
9
|
*/
|
|
10
10
|
import { RecognitionState } from './vgf-recognition-state.js';
|
|
11
|
-
import { IRecognitionClientConfig, ClientState } from './recognition-client.types.js';
|
|
12
|
-
import type
|
|
11
|
+
import { IRecognitionClient, IRecognitionClientConfig, IRecognitionClientStats, ClientState } from './recognition-client.types.js';
|
|
12
|
+
import { type GameContextV1 } from '@recog/shared-types';
|
|
13
13
|
/**
|
|
14
14
|
* Configuration for SimplifiedVGFRecognitionClient
|
|
15
15
|
*/
|
|
@@ -28,102 +28,22 @@ export interface SimplifiedVGFClientConfig extends IRecognitionClientConfig {
|
|
|
28
28
|
/**
|
|
29
29
|
* Interface for SimplifiedVGFRecognitionClient
|
|
30
30
|
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
31
|
+
* Inherits the full IRecognitionClient surface (connect, sendAudio,
|
|
32
|
+
* sendAudioWithSampleRate, sendPrefixAudio, stopRecording, stopAbnormally,
|
|
33
|
+
* status checks, sendGameContext, getStats, getUrl, getState, getAudioUtteranceId)
|
|
34
|
+
* — see recognition-client.types.ts for those. Adds VGF-specific state access.
|
|
35
|
+
*
|
|
36
|
+
* Extending IRecognitionClient (rather than redeclaring methods) means
|
|
37
|
+
* TypeScript catches any base-client method that's not delegated by the
|
|
38
|
+
* VGF wrapper at compile time — keeps the two surfaces in sync.
|
|
33
39
|
*/
|
|
34
|
-
export interface ISimplifiedVGFRecognitionClient {
|
|
35
|
-
/**
|
|
36
|
-
* Connect to the recognition service WebSocket
|
|
37
|
-
* @returns Promise that resolves when connected and ready
|
|
38
|
-
*/
|
|
39
|
-
connect(): Promise<void>;
|
|
40
|
-
/**
|
|
41
|
-
* Send audio data for transcription
|
|
42
|
-
* @param audioData - PCM audio data as ArrayBuffer, typed array, or Blob
|
|
43
|
-
*/
|
|
44
|
-
sendAudio(audioData: ArrayBuffer | ArrayBufferView | Blob): void;
|
|
45
|
-
/**
|
|
46
|
-
* Send PCM16 mono audio captured at `sourceSampleRate`; the SDK
|
|
47
|
-
* downsamples to the session's target rate before transmitting. Use
|
|
48
|
-
* when capture is at the system's native rate (browser AudioContext is
|
|
49
|
-
* typically 44.1 kHz or 48 kHz). Audio must be signed 16-bit
|
|
50
|
-
* little-endian PCM, mono.
|
|
51
|
-
*/
|
|
52
|
-
sendAudioWithSampleRate(audioData: ArrayBuffer | ArrayBufferView | Blob, sourceSampleRate: number): void;
|
|
40
|
+
export interface ISimplifiedVGFRecognitionClient extends IRecognitionClient {
|
|
53
41
|
/**
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
stopRecording(): Promise<void>;
|
|
58
|
-
/**
|
|
59
|
-
* Force stop and immediately close connection without waiting for server
|
|
60
|
-
*
|
|
61
|
-
* WARNING: This is an abnormal shutdown that bypasses the graceful stop flow:
|
|
62
|
-
* - Does NOT wait for server to process remaining audio
|
|
63
|
-
* - Does NOT receive final transcript from server (VGF state set to empty)
|
|
64
|
-
* - Immediately closes WebSocket connection
|
|
65
|
-
* - Cleans up resources (buffers, listeners)
|
|
66
|
-
*
|
|
67
|
-
* Use Cases:
|
|
68
|
-
* - User explicitly cancels/abandons the session
|
|
69
|
-
* - Timeout scenarios where waiting is not acceptable
|
|
70
|
-
* - Need immediate cleanup and can't wait for server
|
|
71
|
-
*
|
|
72
|
-
* RECOMMENDED: Use stopRecording() for normal shutdown.
|
|
73
|
-
* Only use this when immediate disconnection is required.
|
|
74
|
-
*/
|
|
75
|
-
stopAbnormally(): void;
|
|
76
|
-
/**
|
|
77
|
-
* Get the current VGF recognition state
|
|
42
|
+
* Get the current VGF recognition state — the single shared store
|
|
43
|
+
* of inputs and outputs for this utterance.
|
|
78
44
|
* @returns Current RecognitionState with all transcription data
|
|
79
45
|
*/
|
|
80
46
|
getVGFState(): RecognitionState;
|
|
81
|
-
/**
|
|
82
|
-
* Check if connected to the WebSocket
|
|
83
|
-
*/
|
|
84
|
-
isConnected(): boolean;
|
|
85
|
-
/**
|
|
86
|
-
* Check if currently connecting
|
|
87
|
-
*/
|
|
88
|
-
isConnecting(): boolean;
|
|
89
|
-
/**
|
|
90
|
-
* Check if currently stopping
|
|
91
|
-
*/
|
|
92
|
-
isStopping(): boolean;
|
|
93
|
-
/**
|
|
94
|
-
* Check if transcription has finished
|
|
95
|
-
*/
|
|
96
|
-
isTranscriptionFinished(): boolean;
|
|
97
|
-
/**
|
|
98
|
-
* Check if the audio buffer has overflowed
|
|
99
|
-
*/
|
|
100
|
-
isBufferOverflowing(): boolean;
|
|
101
|
-
/**
|
|
102
|
-
* Send game context after connection is established (for preconnect flow).
|
|
103
|
-
*
|
|
104
|
-
* Preconnect flow: Create client with asrRequestConfig (useContext: true) but
|
|
105
|
-
* WITHOUT gameContext → call connect() → later call sendGameContext() with slotMap.
|
|
106
|
-
*
|
|
107
|
-
* @param context - Game context including slotMap for keyword boosting
|
|
108
|
-
*/
|
|
109
|
-
sendGameContext(context: GameContextV1): void;
|
|
110
|
-
/**
|
|
111
|
-
* Check if server has sent READY signal (provider connected, ready for audio).
|
|
112
|
-
* In preconnect flow, this becomes true after sendGameContext() triggers provider attachment.
|
|
113
|
-
*/
|
|
114
|
-
isServerReady(): boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Get the audio utterance ID for this session
|
|
117
|
-
*/
|
|
118
|
-
getAudioUtteranceId(): string;
|
|
119
|
-
/**
|
|
120
|
-
* Get the WebSocket URL being used
|
|
121
|
-
*/
|
|
122
|
-
getUrl(): string;
|
|
123
|
-
/**
|
|
124
|
-
* Get the underlying client state (for advanced usage)
|
|
125
|
-
*/
|
|
126
|
-
getState(): ClientState;
|
|
127
47
|
}
|
|
128
48
|
/**
|
|
129
49
|
* This wrapper ONLY maintains VGF state as a sink.
|
|
@@ -141,6 +61,8 @@ export declare class SimplifiedVGFRecognitionClient implements ISimplifiedVGFRec
|
|
|
141
61
|
connect(): Promise<void>;
|
|
142
62
|
sendAudio(audioData: ArrayBuffer | ArrayBufferView | Blob): void;
|
|
143
63
|
sendAudioWithSampleRate(audioData: ArrayBuffer | ArrayBufferView | Blob, sourceSampleRate: number): void;
|
|
64
|
+
sendPrefixAudio(audioData: ArrayBuffer | ArrayBufferView | Blob): void;
|
|
65
|
+
getStats(): IRecognitionClientStats;
|
|
144
66
|
/**
|
|
145
67
|
* Set VGF recording status to RECORDING on the first audio chunk.
|
|
146
68
|
* Idempotent — subsequent calls are no-ops until disconnect/stop resets
|
|
@@ -160,7 +82,6 @@ export declare class SimplifiedVGFRecognitionClient implements ISimplifiedVGFRec
|
|
|
160
82
|
sendGameContext(context: GameContextV1): void;
|
|
161
83
|
isServerReady(): boolean;
|
|
162
84
|
getVGFState(): RecognitionState;
|
|
163
|
-
private isTerminalStatus;
|
|
164
85
|
private notifyStateChange;
|
|
165
86
|
}
|
|
166
87
|
/**
|
|
@@ -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,
|
|
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,gBAA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IAiCtB,mBAAmB,IAAI,MAAM;IAI7B,MAAM,IAAI,MAAM;IAIhB,QAAQ,IAAI,WAAW;IAIvB,WAAW,IAAI,OAAO;IAItB,YAAY,IAAI,OAAO;IAIvB,UAAU,IAAI,OAAO;IAIrB,uBAAuB,IAAI,OAAO;IAIlC,mBAAmB,IAAI,OAAO;IAI9B,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI;IAI7C,aAAa,IAAI,OAAO;IAMxB,WAAW,IAAI,gBAAgB;IAI/B,OAAO,CAAC,iBAAiB;CA8B5B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,yBAAyB,GAAG,+BAA+B,CAE5G"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { RecognitionState } from './vgf-recognition-state.js';
|
|
8
8
|
import { ClientState, IRecognitionClientConfig } from './recognition-client.types.js';
|
|
9
|
-
import { TranscriptionResultV1,
|
|
9
|
+
import { TranscriptionResultV1, SessionConfiguredV1 } from '@recog/shared-types';
|
|
10
10
|
/**
|
|
11
11
|
* Maps ClientState to RecordingStatus for VGF state
|
|
12
12
|
*/
|
|
@@ -15,10 +15,17 @@ export declare function mapClientStateToRecordingStatus(clientState: ClientState
|
|
|
15
15
|
* Creates a VGF state from transcription result
|
|
16
16
|
*/
|
|
17
17
|
export declare function mapTranscriptionResultToState(currentState: RecognitionState, result: TranscriptionResultV1, isRecording: boolean): RecognitionState;
|
|
18
|
+
/**
|
|
19
|
+
* Mirrors the SessionConfiguredV1 message onto the VGF state.
|
|
20
|
+
* Carries the resolved provider/model/sampleRate/encoding/apiType/isFallback
|
|
21
|
+
* that the server actually chose (after circuit-breaker/fallback). Fires once
|
|
22
|
+
* per session, before audio streaming begins.
|
|
23
|
+
*/
|
|
24
|
+
export declare function mapSessionConfiguredToState(currentState: RecognitionState, sessionConfigured: SessionConfiguredV1): RecognitionState;
|
|
18
25
|
/**
|
|
19
26
|
* Maps error to state
|
|
20
27
|
*/
|
|
21
|
-
export declare function mapErrorToState(currentState: RecognitionState
|
|
28
|
+
export declare function mapErrorToState(currentState: RecognitionState): RecognitionState;
|
|
22
29
|
/**
|
|
23
30
|
* Creates initial VGF state from client config
|
|
24
31
|
*/
|
|
@@ -48,19 +55,4 @@ export declare function resetRecognitionVGFState(currentState: RecognitionState)
|
|
|
48
55
|
* Updates state when client becomes ready
|
|
49
56
|
*/
|
|
50
57
|
export declare function updateStateOnReady(currentState: RecognitionState): RecognitionState;
|
|
51
|
-
/**
|
|
52
|
-
* Parses function call from transcript (STEP 3 support)
|
|
53
|
-
* This is a placeholder - actual implementation would use NLP/LLM
|
|
54
|
-
*/
|
|
55
|
-
export declare function extractFunctionCallFromTranscript(transcript: string, gameContext?: any): {
|
|
56
|
-
metadata?: string;
|
|
57
|
-
confidence?: number;
|
|
58
|
-
} | null;
|
|
59
|
-
/**
|
|
60
|
-
* Updates state with function call results (STEP 3)
|
|
61
|
-
*/
|
|
62
|
-
export declare function updateStateWithFunctionCall(currentState: RecognitionState, functionCall: {
|
|
63
|
-
metadata?: string;
|
|
64
|
-
confidence?: number;
|
|
65
|
-
}): RecognitionState;
|
|
66
58
|
//# sourceMappingURL=vgf-recognition-mapper.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vgf-recognition-mapper.d.ts","sourceRoot":"","sources":["../src/vgf-recognition-mapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACH,gBAAgB,EAKnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACH,WAAW,EACX,wBAAwB,EAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"vgf-recognition-mapper.d.ts","sourceRoot":"","sources":["../src/vgf-recognition-mapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACH,gBAAgB,EAKnB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACH,WAAW,EACX,wBAAwB,EAC3B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACH,qBAAqB,EACrB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAE7B;;GAEG;AACH,wBAAgB,+BAA+B,CAAC,WAAW,EAAE,WAAW,GAAG,MAAM,CAmBhF;AAED;;GAEG;AACH,wBAAgB,6BAA6B,CACzC,YAAY,EAAE,gBAAgB,EAC9B,MAAM,EAAE,qBAAqB,EAC7B,WAAW,EAAE,OAAO,GACrB,gBAAgB,CA6ElB;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACvC,YAAY,EAAE,gBAAgB,EAC9B,iBAAiB,EAAE,mBAAmB,GACvC,gBAAgB,CAKlB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC3B,YAAY,EAAE,gBAAgB,GAC/B,gBAAgB,CAOlB;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,wBAAwB,GAAG,gBAAgB,CAU3F;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,gBAAgB,GAAG,gBAAgB,CAMlF;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,YAAY,EAAE,gBAAgB,GAAG,gBAAgB,CAczF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,gBAAgB,GAAG,gBAAgB,CAKnF"}
|
|
@@ -20,7 +20,42 @@ export declare const RecognitionVGFStateSchema: z.ZodObject<{
|
|
|
20
20
|
finalConfidence: z.ZodOptional<z.ZodNumber>;
|
|
21
21
|
voiceEnd: z.ZodOptional<z.ZodNumber>;
|
|
22
22
|
lastNonSilence: z.ZodOptional<z.ZodNumber>;
|
|
23
|
+
accumulatedAudioTimeMs: z.ZodOptional<z.ZodNumber>;
|
|
23
24
|
asrConfig: z.ZodOptional<z.ZodString>;
|
|
25
|
+
sessionConfigured: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
type: z.ZodLiteral<import("@recog/shared-types").RecognitionResultTypeV1.SESSION_CONFIGURED>;
|
|
27
|
+
audioUtteranceId: z.ZodString;
|
|
28
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
29
|
+
model: z.ZodOptional<z.ZodString>;
|
|
30
|
+
sampleRate: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
encoding: z.ZodOptional<z.ZodString>;
|
|
32
|
+
apiType: z.ZodOptional<z.ZodNativeEnum<typeof import("@recog/shared-types").ASRApiType>>;
|
|
33
|
+
isFallback: z.ZodOptional<z.ZodBoolean>;
|
|
34
|
+
asrRequest: z.ZodOptional<z.ZodString>;
|
|
35
|
+
providerConfig: z.ZodOptional<z.ZodString>;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
type: import("@recog/shared-types").RecognitionResultTypeV1.SESSION_CONFIGURED;
|
|
38
|
+
audioUtteranceId: string;
|
|
39
|
+
provider?: string | undefined;
|
|
40
|
+
model?: string | undefined;
|
|
41
|
+
sampleRate?: number | undefined;
|
|
42
|
+
encoding?: string | undefined;
|
|
43
|
+
apiType?: import("@recog/shared-types").ASRApiType | undefined;
|
|
44
|
+
isFallback?: boolean | undefined;
|
|
45
|
+
asrRequest?: string | undefined;
|
|
46
|
+
providerConfig?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
type: import("@recog/shared-types").RecognitionResultTypeV1.SESSION_CONFIGURED;
|
|
49
|
+
audioUtteranceId: string;
|
|
50
|
+
provider?: string | undefined;
|
|
51
|
+
model?: string | undefined;
|
|
52
|
+
sampleRate?: number | undefined;
|
|
53
|
+
encoding?: string | undefined;
|
|
54
|
+
apiType?: import("@recog/shared-types").ASRApiType | undefined;
|
|
55
|
+
isFallback?: boolean | undefined;
|
|
56
|
+
asrRequest?: string | undefined;
|
|
57
|
+
providerConfig?: string | undefined;
|
|
58
|
+
}>>;
|
|
24
59
|
startRecordingTimestamp: z.ZodOptional<z.ZodString>;
|
|
25
60
|
finalRecordingTimestamp: z.ZodOptional<z.ZodString>;
|
|
26
61
|
finalTranscriptionTimestamp: z.ZodOptional<z.ZodString>;
|
|
@@ -29,7 +64,31 @@ export declare const RecognitionVGFStateSchema: z.ZodObject<{
|
|
|
29
64
|
functionCallMetadata: z.ZodOptional<z.ZodString>;
|
|
30
65
|
functionCallConfidence: z.ZodOptional<z.ZodNumber>;
|
|
31
66
|
finalFunctionCallTimestamp: z.ZodOptional<z.ZodString>;
|
|
67
|
+
gameId: z.ZodOptional<z.ZodString>;
|
|
68
|
+
gamePhase: z.ZodOptional<z.ZodString>;
|
|
32
69
|
promptSlotMap: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString, "many">>>;
|
|
70
|
+
promptSTT: z.ZodOptional<z.ZodString>;
|
|
71
|
+
promptSTF: z.ZodOptional<z.ZodString>;
|
|
72
|
+
promptTTF: z.ZodOptional<z.ZodString>;
|
|
73
|
+
detections: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
74
|
+
type: z.ZodNativeEnum<typeof import("@recog/shared-types").DetectionTypeV1>;
|
|
75
|
+
query: z.ZodString;
|
|
76
|
+
score: z.ZodNumber;
|
|
77
|
+
startMs: z.ZodOptional<z.ZodNumber>;
|
|
78
|
+
endMs: z.ZodOptional<z.ZodNumber>;
|
|
79
|
+
}, "strip", z.ZodTypeAny, {
|
|
80
|
+
type: import("@recog/shared-types").DetectionTypeV1;
|
|
81
|
+
query: string;
|
|
82
|
+
score: number;
|
|
83
|
+
startMs?: number | undefined;
|
|
84
|
+
endMs?: number | undefined;
|
|
85
|
+
}, {
|
|
86
|
+
type: import("@recog/shared-types").DetectionTypeV1;
|
|
87
|
+
query: string;
|
|
88
|
+
score: number;
|
|
89
|
+
startMs?: number | undefined;
|
|
90
|
+
endMs?: number | undefined;
|
|
91
|
+
}>, "many">>;
|
|
33
92
|
recognitionActionProcessingState: z.ZodOptional<z.ZodString>;
|
|
34
93
|
}, "strip", z.ZodTypeAny, {
|
|
35
94
|
audioUtteranceId: string;
|
|
@@ -40,7 +99,20 @@ export declare const RecognitionVGFStateSchema: z.ZodObject<{
|
|
|
40
99
|
finalConfidence?: number | undefined;
|
|
41
100
|
voiceEnd?: number | undefined;
|
|
42
101
|
lastNonSilence?: number | undefined;
|
|
102
|
+
accumulatedAudioTimeMs?: number | undefined;
|
|
43
103
|
asrConfig?: string | undefined;
|
|
104
|
+
sessionConfigured?: {
|
|
105
|
+
type: import("@recog/shared-types").RecognitionResultTypeV1.SESSION_CONFIGURED;
|
|
106
|
+
audioUtteranceId: string;
|
|
107
|
+
provider?: string | undefined;
|
|
108
|
+
model?: string | undefined;
|
|
109
|
+
sampleRate?: number | undefined;
|
|
110
|
+
encoding?: string | undefined;
|
|
111
|
+
apiType?: import("@recog/shared-types").ASRApiType | undefined;
|
|
112
|
+
isFallback?: boolean | undefined;
|
|
113
|
+
asrRequest?: string | undefined;
|
|
114
|
+
providerConfig?: string | undefined;
|
|
115
|
+
} | undefined;
|
|
44
116
|
startRecordingTimestamp?: string | undefined;
|
|
45
117
|
finalRecordingTimestamp?: string | undefined;
|
|
46
118
|
finalTranscriptionTimestamp?: string | undefined;
|
|
@@ -48,7 +120,19 @@ export declare const RecognitionVGFStateSchema: z.ZodObject<{
|
|
|
48
120
|
functionCallMetadata?: string | undefined;
|
|
49
121
|
functionCallConfidence?: number | undefined;
|
|
50
122
|
finalFunctionCallTimestamp?: string | undefined;
|
|
123
|
+
gameId?: string | undefined;
|
|
124
|
+
gamePhase?: string | undefined;
|
|
51
125
|
promptSlotMap?: Record<string, string[]> | undefined;
|
|
126
|
+
promptSTT?: string | undefined;
|
|
127
|
+
promptSTF?: string | undefined;
|
|
128
|
+
promptTTF?: string | undefined;
|
|
129
|
+
detections?: {
|
|
130
|
+
type: import("@recog/shared-types").DetectionTypeV1;
|
|
131
|
+
query: string;
|
|
132
|
+
score: number;
|
|
133
|
+
startMs?: number | undefined;
|
|
134
|
+
endMs?: number | undefined;
|
|
135
|
+
}[] | undefined;
|
|
52
136
|
recognitionActionProcessingState?: string | undefined;
|
|
53
137
|
}, {
|
|
54
138
|
audioUtteranceId: string;
|
|
@@ -58,7 +142,20 @@ export declare const RecognitionVGFStateSchema: z.ZodObject<{
|
|
|
58
142
|
finalConfidence?: number | undefined;
|
|
59
143
|
voiceEnd?: number | undefined;
|
|
60
144
|
lastNonSilence?: number | undefined;
|
|
145
|
+
accumulatedAudioTimeMs?: number | undefined;
|
|
61
146
|
asrConfig?: string | undefined;
|
|
147
|
+
sessionConfigured?: {
|
|
148
|
+
type: import("@recog/shared-types").RecognitionResultTypeV1.SESSION_CONFIGURED;
|
|
149
|
+
audioUtteranceId: string;
|
|
150
|
+
provider?: string | undefined;
|
|
151
|
+
model?: string | undefined;
|
|
152
|
+
sampleRate?: number | undefined;
|
|
153
|
+
encoding?: string | undefined;
|
|
154
|
+
apiType?: import("@recog/shared-types").ASRApiType | undefined;
|
|
155
|
+
isFallback?: boolean | undefined;
|
|
156
|
+
asrRequest?: string | undefined;
|
|
157
|
+
providerConfig?: string | undefined;
|
|
158
|
+
} | undefined;
|
|
62
159
|
startRecordingTimestamp?: string | undefined;
|
|
63
160
|
finalRecordingTimestamp?: string | undefined;
|
|
64
161
|
finalTranscriptionTimestamp?: string | undefined;
|
|
@@ -67,7 +164,19 @@ export declare const RecognitionVGFStateSchema: z.ZodObject<{
|
|
|
67
164
|
functionCallMetadata?: string | undefined;
|
|
68
165
|
functionCallConfidence?: number | undefined;
|
|
69
166
|
finalFunctionCallTimestamp?: string | undefined;
|
|
167
|
+
gameId?: string | undefined;
|
|
168
|
+
gamePhase?: string | undefined;
|
|
70
169
|
promptSlotMap?: Record<string, string[]> | undefined;
|
|
170
|
+
promptSTT?: string | undefined;
|
|
171
|
+
promptSTF?: string | undefined;
|
|
172
|
+
promptTTF?: string | undefined;
|
|
173
|
+
detections?: {
|
|
174
|
+
type: import("@recog/shared-types").DetectionTypeV1;
|
|
175
|
+
query: string;
|
|
176
|
+
score: number;
|
|
177
|
+
startMs?: number | undefined;
|
|
178
|
+
endMs?: number | undefined;
|
|
179
|
+
}[] | undefined;
|
|
71
180
|
recognitionActionProcessingState?: string | undefined;
|
|
72
181
|
}>;
|
|
73
182
|
export type RecognitionState = z.infer<typeof RecognitionVGFStateSchema>;
|
|
@@ -93,5 +202,6 @@ export declare const RecognitionActionProcessingState: {
|
|
|
93
202
|
};
|
|
94
203
|
export type RecognitionActionProcessingStateType = typeof RecognitionActionProcessingState[keyof typeof RecognitionActionProcessingState];
|
|
95
204
|
export declare function createInitialRecognitionState(audioUtteranceId: string): RecognitionState;
|
|
205
|
+
export declare function isTerminal(state: Pick<RecognitionState, "transcriptionStatus">): boolean;
|
|
96
206
|
export declare function isValidRecordingStatusTransition(from: string | undefined, to: string): boolean;
|
|
97
207
|
//# sourceMappingURL=vgf-recognition-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vgf-recognition-state.d.ts","sourceRoot":"","sources":["../src/vgf-recognition-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"vgf-recognition-state.d.ts","sourceRoot":"","sources":["../src/vgf-recognition-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2DpC,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,yBAAyB,CAAC,CAAA;AAGxE,eAAO,MAAM,eAAe;;;;;CAKlB,CAAA;AAEV,MAAM,MAAM,mBAAmB,GAAG,OAAO,eAAe,CAAC,MAAM,OAAO,eAAe,CAAC,CAAA;AAEtF,eAAO,MAAM,mBAAmB;;;;;;CAMtB,CAAA;AAEV,MAAM,MAAM,uBAAuB,GAAG,OAAO,mBAAmB,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAA;AAElG,eAAO,MAAM,gCAAgC;;;;CAInC,CAAA;AAEV,MAAM,MAAM,oCAAoC,GAAG,OAAO,gCAAgC,CAAC,MAAM,OAAO,gCAAgC,CAAC,CAAA;AAGzI,wBAAgB,6BAA6B,CAAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB,CAQxF;AAUD,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,qBAAqB,CAAC,GAAG,OAAO,CAMxF;AAGD,wBAAgB,gCAAgC,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAa9F"}
|
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.803",
|
|
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.2.5",
|
|
56
56
|
"typescript": "5.1.6",
|
|
57
|
-
"@recog/shared-config": "1.0.0",
|
|
58
57
|
"@recog/shared-utils": "1.0.0",
|
|
59
|
-
"@recog/
|
|
60
|
-
"@recog/shared-
|
|
58
|
+
"@recog/shared-types": "1.0.0",
|
|
59
|
+
"@recog/shared-config": "1.0.0",
|
|
60
|
+
"@recog/websocket": "1.0.0"
|
|
61
61
|
},
|
|
62
62
|
"keywords": [
|
|
63
63
|
"recognition",
|
package/src/index.ts
CHANGED
|
@@ -223,6 +223,11 @@ export interface IRecognitionClientConfig {
|
|
|
223
223
|
*
|
|
224
224
|
* Main interface for real-time speech recognition clients.
|
|
225
225
|
* Provides methods for connection management, audio streaming, and session control.
|
|
226
|
+
*
|
|
227
|
+
* NOTE for maintainers: `ISimplifiedVGFRecognitionClient` extends this interface,
|
|
228
|
+
* so any method added here must also be implemented (typically as a delegate) by
|
|
229
|
+
* `SimplifiedVGFRecognitionClient`. TypeScript will flag missing delegates at
|
|
230
|
+
* compile time — do not work around the error, add the delegate.
|
|
226
231
|
*/
|
|
227
232
|
export interface IRecognitionClient {
|
|
228
233
|
/**
|
|
@@ -260,6 +265,17 @@ export interface IRecognitionClient {
|
|
|
260
265
|
sourceSampleRate: number
|
|
261
266
|
): void;
|
|
262
267
|
|
|
268
|
+
/**
|
|
269
|
+
* Send prefix audio (e.g. a TTS prompt) that primes the provider's language
|
|
270
|
+
* model before user audio is streamed. Chunks accepted — the server buffers
|
|
271
|
+
* until the session is READY and flushes. Must be sent BEFORE the first
|
|
272
|
+
* `sendAudio()` to take effect. Only meaningful when
|
|
273
|
+
* `asrRequestConfig.prefixMode === PrefixMode.CLIENT`.
|
|
274
|
+
*
|
|
275
|
+
* @param audioData - PCM audio data as ArrayBuffer, typed array view, or Blob
|
|
276
|
+
*/
|
|
277
|
+
sendPrefixAudio(audioData: ArrayBuffer | ArrayBufferView | Blob): void;
|
|
278
|
+
|
|
263
279
|
/**
|
|
264
280
|
* Stop recording and wait for final transcript
|
|
265
281
|
* The server will close the connection after sending the final transcript.
|
|
@@ -766,33 +766,6 @@ describe('SimplifiedVGFRecognitionClient', () => {
|
|
|
766
766
|
});
|
|
767
767
|
});
|
|
768
768
|
|
|
769
|
-
it('should warn if promptSlotMap exists but no gameContext provided', () => {
|
|
770
|
-
const logger = jest.fn();
|
|
771
|
-
const initialState: RecognitionState = {
|
|
772
|
-
audioUtteranceId: 'test-123',
|
|
773
|
-
pendingTranscript: '', // Required field
|
|
774
|
-
promptSlotMap: {
|
|
775
|
-
'entity1': ['value1']
|
|
776
|
-
}
|
|
777
|
-
};
|
|
778
|
-
|
|
779
|
-
simplifiedClient = new SimplifiedVGFRecognitionClient({
|
|
780
|
-
asrRequestConfig: {
|
|
781
|
-
provider: 'deepgram',
|
|
782
|
-
language: 'en',
|
|
783
|
-
sampleRate: 16000,
|
|
784
|
-
encoding: AudioEncoding.LINEAR16
|
|
785
|
-
},
|
|
786
|
-
initialState,
|
|
787
|
-
logger
|
|
788
|
-
});
|
|
789
|
-
|
|
790
|
-
expect(logger).toHaveBeenCalledWith(
|
|
791
|
-
'warn',
|
|
792
|
-
'[VGF] promptSlotMap found but no gameContext provided. SlotMap will not be sent.'
|
|
793
|
-
);
|
|
794
|
-
});
|
|
795
|
-
|
|
796
769
|
it('should preserve promptSlotMap throughout state changes', () => {
|
|
797
770
|
const initialState: RecognitionState = {
|
|
798
771
|
audioUtteranceId: 'test-123',
|