@volley/recognition-client-sdk 0.1.670 → 0.1.707
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 +59 -2
- package/dist/config-builder.d.ts +14 -1
- package/dist/config-builder.d.ts.map +1 -1
- package/dist/index.bundled.d.ts +118 -48
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +66 -4
- package/dist/index.js.map +3 -3
- package/dist/recog-client-sdk.browser.js +43 -4
- package/dist/recog-client-sdk.browser.js.map +3 -3
- package/dist/recognition-client.d.ts.map +1 -1
- package/dist/recognition-client.types.d.ts +7 -1
- package/dist/recognition-client.types.d.ts.map +1 -1
- package/dist/utils/message-handler.d.ts +2 -1
- package/dist/utils/message-handler.d.ts.map +1 -1
- package/dist/utils/url-builder.d.ts +4 -0
- package/dist/utils/url-builder.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/config-builder.ts +26 -0
- package/src/index.ts +1 -0
- package/src/recognition-client.ts +7 -1
- package/src/recognition-client.types.ts +10 -0
- package/src/utils/message-handler.ts +7 -1
- package/src/utils/url-builder.ts +14 -0
package/dist/index.js
CHANGED
|
@@ -3746,6 +3746,7 @@ var RecognitionProvider;
|
|
|
3746
3746
|
RecognitionProvider2["MISTRAL_VOXTRAL"] = "mistral-voxtral";
|
|
3747
3747
|
RecognitionProvider2["CARTESIA"] = "cartesia";
|
|
3748
3748
|
RecognitionProvider2["DASHSCOPE"] = "dashscope";
|
|
3749
|
+
RecognitionProvider2["BEDROCK"] = "bedrock";
|
|
3749
3750
|
RecognitionProvider2["TEST_ASR_PROVIDER_QUOTA"] = "test-asr-provider-quota";
|
|
3750
3751
|
RecognitionProvider2["TEST_ASR_STREAMING"] = "test-asr-streaming";
|
|
3751
3752
|
})(RecognitionProvider || (RecognitionProvider = {}));
|
|
@@ -3813,6 +3814,11 @@ var DashScopeModel;
|
|
|
3813
3814
|
DashScopeModel2["QWEN3_ASR_FLASH_REALTIME_2602"] = "qwen3-asr-flash-realtime-2026-02-10";
|
|
3814
3815
|
DashScopeModel2["QWEN3_ASR_FLASH_REALTIME"] = "qwen3-asr-flash-realtime";
|
|
3815
3816
|
})(DashScopeModel || (DashScopeModel = {}));
|
|
3817
|
+
var BedrockModel;
|
|
3818
|
+
(function(BedrockModel2) {
|
|
3819
|
+
BedrockModel2["VOXTRAL_MINI_3B_2507"] = "mistral.voxtral-mini-3b-2507";
|
|
3820
|
+
BedrockModel2["VOXTRAL_SMALL_24B_2507"] = "mistral.voxtral-small-24b-2507";
|
|
3821
|
+
})(BedrockModel || (BedrockModel = {}));
|
|
3816
3822
|
var SelfServeVllmModel;
|
|
3817
3823
|
(function(SelfServeVllmModel2) {
|
|
3818
3824
|
SelfServeVllmModel2["QWEN3_ASR_1_7B"] = "qwen3-asr-1.7b";
|
|
@@ -3827,6 +3833,7 @@ var RecognitionResultTypeV1;
|
|
|
3827
3833
|
RecognitionResultTypeV12["ERROR"] = "Error";
|
|
3828
3834
|
RecognitionResultTypeV12["CLIENT_CONTROL_MESSAGE"] = "ClientControlMessage";
|
|
3829
3835
|
RecognitionResultTypeV12["AUDIO_METRICS"] = "AudioMetrics";
|
|
3836
|
+
RecognitionResultTypeV12["SESSION_CONFIGURED"] = "SessionConfigured";
|
|
3830
3837
|
})(RecognitionResultTypeV1 || (RecognitionResultTypeV1 = {}));
|
|
3831
3838
|
var TranscriptionResultSchemaV1 = z.object({
|
|
3832
3839
|
type: z.literal(RecognitionResultTypeV1.TRANSCRIPTION),
|
|
@@ -3948,6 +3955,22 @@ var ClientControlMessageSchemaV1 = z.object({
|
|
|
3948
3955
|
action: ClientControlActionsV1
|
|
3949
3956
|
// The control action to perform
|
|
3950
3957
|
});
|
|
3958
|
+
var SessionConfiguredSchemaV1 = z.object({
|
|
3959
|
+
type: z.literal(RecognitionResultTypeV1.SESSION_CONFIGURED),
|
|
3960
|
+
audioUtteranceId: z.string(),
|
|
3961
|
+
// Provider identification
|
|
3962
|
+
provider: z.string().optional(),
|
|
3963
|
+
model: z.string().optional(),
|
|
3964
|
+
sampleRate: z.number().optional(),
|
|
3965
|
+
encoding: z.string().optional(),
|
|
3966
|
+
apiType: z.nativeEnum(ASRApiType).optional(),
|
|
3967
|
+
isFallback: z.boolean().optional(),
|
|
3968
|
+
// Original ASR request as JSON string (includes prefixMode, prefixId, etc.)
|
|
3969
|
+
asrRequest: z.string().optional(),
|
|
3970
|
+
// Provider-specific config as JSON string (raw config sent to provider API, e.g. Deepgram's punctuate/endpointing)
|
|
3971
|
+
providerConfig: z.string().optional()
|
|
3972
|
+
// Stringified JSON of provider-specific config
|
|
3973
|
+
});
|
|
3951
3974
|
var AudioMetricsResultSchemaV1 = z.object({
|
|
3952
3975
|
type: z.literal(RecognitionResultTypeV1.AUDIO_METRICS),
|
|
3953
3976
|
valid: z.boolean(),
|
|
@@ -3971,7 +3994,8 @@ var RecognitionResultSchemaV1 = z.discriminatedUnion("type", [
|
|
|
3971
3994
|
ErrorResultSchemaV1,
|
|
3972
3995
|
// P1 - P2
|
|
3973
3996
|
FunctionCallResultSchemaV1,
|
|
3974
|
-
ClientControlMessageSchemaV1
|
|
3997
|
+
ClientControlMessageSchemaV1,
|
|
3998
|
+
SessionConfiguredSchemaV1
|
|
3975
3999
|
]);
|
|
3976
4000
|
|
|
3977
4001
|
// ../../libs/types/dist/provider-transcription.types.js
|
|
@@ -4437,8 +4461,10 @@ var RecognitionGameInfoSchema = z.object({
|
|
|
4437
4461
|
questionAskedId: z.string().optional(),
|
|
4438
4462
|
/** @deprecated Use questionAskedId instead. Kept for backward compatibility during migration. */
|
|
4439
4463
|
questionAnswerId: z.string().optional(),
|
|
4440
|
-
platform: z.string().optional()
|
|
4441
|
-
|
|
4464
|
+
platform: z.string().optional(),
|
|
4465
|
+
experimentCohort: z.enum(["treatment", "control"]).optional(),
|
|
4466
|
+
experimentMajorVersion: z.number().int().optional()
|
|
4467
|
+
// Explicit major version for ASR config selection (e.g. 1, 3)
|
|
4442
4468
|
});
|
|
4443
4469
|
var RecognitionQueryMetadataSchema = z.object({
|
|
4444
4470
|
audioUtteranceId: z.string(),
|
|
@@ -5110,6 +5136,12 @@ function buildWebSocketUrl(config) {
|
|
|
5110
5136
|
if (config.gameContext?.gamePhase) {
|
|
5111
5137
|
url.searchParams.set("gamePhase", config.gameContext.gamePhase);
|
|
5112
5138
|
}
|
|
5139
|
+
if (config.experimentCohort) {
|
|
5140
|
+
url.searchParams.set("experimentCohort", config.experimentCohort);
|
|
5141
|
+
}
|
|
5142
|
+
if (config.experimentMajorVersion !== void 0) {
|
|
5143
|
+
url.searchParams.set("experimentMajorVersion", String(config.experimentMajorVersion));
|
|
5144
|
+
}
|
|
5113
5145
|
return url.toString();
|
|
5114
5146
|
}
|
|
5115
5147
|
|
|
@@ -5292,6 +5324,9 @@ var MessageHandler = class {
|
|
|
5292
5324
|
case RecognitionResultTypeV1.CLIENT_CONTROL_MESSAGE:
|
|
5293
5325
|
this.callbacks.onControlMessage(msgData);
|
|
5294
5326
|
break;
|
|
5327
|
+
case RecognitionResultTypeV1.SESSION_CONFIGURED:
|
|
5328
|
+
this.callbacks.onSessionConfigured?.(msgData);
|
|
5329
|
+
break;
|
|
5295
5330
|
default:
|
|
5296
5331
|
if (this.callbacks.logger) {
|
|
5297
5332
|
this.callbacks.logger("debug", "[RecogSDK] Unknown message type", { type: msgType });
|
|
@@ -5403,7 +5438,9 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
|
|
|
5403
5438
|
...config.questionAnswerId && { questionAnswerId: config.questionAnswerId },
|
|
5404
5439
|
...config.platform && { platform: config.platform },
|
|
5405
5440
|
...config.gameContext && { gameContext: config.gameContext },
|
|
5406
|
-
...config.gameId && { gameId: config.gameId }
|
|
5441
|
+
...config.gameId && { gameId: config.gameId },
|
|
5442
|
+
...config.experimentCohort && { experimentCohort: config.experimentCohort },
|
|
5443
|
+
...config.experimentMajorVersion !== void 0 && { experimentMajorVersion: config.experimentMajorVersion }
|
|
5407
5444
|
});
|
|
5408
5445
|
super({
|
|
5409
5446
|
url,
|
|
@@ -5436,6 +5473,7 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
|
|
|
5436
5473
|
}),
|
|
5437
5474
|
onMetadata: config.onMetadata || (() => {
|
|
5438
5475
|
}),
|
|
5476
|
+
onSessionConfigured: config.onSessionConfigured,
|
|
5439
5477
|
onError: config.onError || (() => {
|
|
5440
5478
|
}),
|
|
5441
5479
|
onConnected: config.onConnected || (() => {
|
|
@@ -5463,6 +5501,7 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
|
|
|
5463
5501
|
onMetadata: this.config.onMetadata,
|
|
5464
5502
|
onError: this.config.onError,
|
|
5465
5503
|
onControlMessage: this.handleControlMessage.bind(this),
|
|
5504
|
+
onSessionConfigured: this.config.onSessionConfigured,
|
|
5466
5505
|
...this.config.logger && { logger: this.config.logger }
|
|
5467
5506
|
});
|
|
5468
5507
|
}
|
|
@@ -6106,6 +6145,21 @@ var ConfigBuilder = class {
|
|
|
6106
6145
|
this.config.platform = platform;
|
|
6107
6146
|
return this;
|
|
6108
6147
|
}
|
|
6148
|
+
/**
|
|
6149
|
+
* Set experiment cohort (optional, defaults to 'control')
|
|
6150
|
+
*/
|
|
6151
|
+
experimentCohort(cohort) {
|
|
6152
|
+
this.config.experimentCohort = cohort;
|
|
6153
|
+
return this;
|
|
6154
|
+
}
|
|
6155
|
+
/**
|
|
6156
|
+
* Set explicit major version for ASR config selection.
|
|
6157
|
+
* Takes precedence over experimentCohort-based version resolution.
|
|
6158
|
+
*/
|
|
6159
|
+
experimentMajorVersion(version) {
|
|
6160
|
+
this.config.experimentMajorVersion = version;
|
|
6161
|
+
return this;
|
|
6162
|
+
}
|
|
6109
6163
|
/**
|
|
6110
6164
|
* Set transcript callback
|
|
6111
6165
|
*/
|
|
@@ -6120,6 +6174,13 @@ var ConfigBuilder = class {
|
|
|
6120
6174
|
this.config.onMetadata = callback;
|
|
6121
6175
|
return this;
|
|
6122
6176
|
}
|
|
6177
|
+
/**
|
|
6178
|
+
* Set session configured callback (optional)
|
|
6179
|
+
*/
|
|
6180
|
+
onSessionConfigured(callback) {
|
|
6181
|
+
this.config.onSessionConfigured = callback;
|
|
6182
|
+
return this;
|
|
6183
|
+
}
|
|
6123
6184
|
/**
|
|
6124
6185
|
* Set error callback
|
|
6125
6186
|
*/
|
|
@@ -6609,6 +6670,7 @@ function createSimplifiedVGFClient(config) {
|
|
|
6609
6670
|
}
|
|
6610
6671
|
export {
|
|
6611
6672
|
AudioEncoding,
|
|
6673
|
+
BedrockModel,
|
|
6612
6674
|
CartesiaModel,
|
|
6613
6675
|
ClientControlActionV1,
|
|
6614
6676
|
ClientState,
|