@volley/recognition-client-sdk 0.1.670 → 0.1.689
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 +46 -1
- package/dist/config-builder.d.ts +9 -1
- package/dist/config-builder.d.ts.map +1 -1
- package/dist/index.bundled.d.ts +54 -1
- package/dist/index.js +46 -4
- package/dist/index.js.map +2 -2
- package/dist/recog-client-sdk.browser.js +32 -4
- package/dist/recog-client-sdk.browser.js.map +2 -2
- package/dist/recognition-client.d.ts.map +1 -1
- package/dist/recognition-client.types.d.ts +5 -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 +2 -0
- package/dist/utils/url-builder.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/config-builder.ts +17 -0
- package/src/recognition-client.ts +6 -1
- package/src/recognition-client.types.ts +7 -0
- package/src/utils/message-handler.ts +7 -1
- package/src/utils/url-builder.ts +7 -0
|
@@ -3827,6 +3827,7 @@ var RecognitionResultTypeV1;
|
|
|
3827
3827
|
RecognitionResultTypeV12["ERROR"] = "Error";
|
|
3828
3828
|
RecognitionResultTypeV12["CLIENT_CONTROL_MESSAGE"] = "ClientControlMessage";
|
|
3829
3829
|
RecognitionResultTypeV12["AUDIO_METRICS"] = "AudioMetrics";
|
|
3830
|
+
RecognitionResultTypeV12["SESSION_CONFIGURED"] = "SessionConfigured";
|
|
3830
3831
|
})(RecognitionResultTypeV1 || (RecognitionResultTypeV1 = {}));
|
|
3831
3832
|
var TranscriptionResultSchemaV1 = z.object({
|
|
3832
3833
|
type: z.literal(RecognitionResultTypeV1.TRANSCRIPTION),
|
|
@@ -3948,6 +3949,22 @@ var ClientControlMessageSchemaV1 = z.object({
|
|
|
3948
3949
|
action: ClientControlActionsV1
|
|
3949
3950
|
// The control action to perform
|
|
3950
3951
|
});
|
|
3952
|
+
var SessionConfiguredSchemaV1 = z.object({
|
|
3953
|
+
type: z.literal(RecognitionResultTypeV1.SESSION_CONFIGURED),
|
|
3954
|
+
audioUtteranceId: z.string(),
|
|
3955
|
+
// Provider identification
|
|
3956
|
+
provider: z.string().optional(),
|
|
3957
|
+
model: z.string().optional(),
|
|
3958
|
+
sampleRate: z.number().optional(),
|
|
3959
|
+
encoding: z.string().optional(),
|
|
3960
|
+
apiType: z.nativeEnum(ASRApiType).optional(),
|
|
3961
|
+
isFallback: z.boolean().optional(),
|
|
3962
|
+
// Original ASR request as JSON string (includes prefixMode, prefixId, etc.)
|
|
3963
|
+
asrRequest: z.string().optional(),
|
|
3964
|
+
// Provider-specific config as JSON string (raw config sent to provider API, e.g. Deepgram's punctuate/endpointing)
|
|
3965
|
+
providerConfig: z.string().optional()
|
|
3966
|
+
// Stringified JSON of provider-specific config
|
|
3967
|
+
});
|
|
3951
3968
|
var AudioMetricsResultSchemaV1 = z.object({
|
|
3952
3969
|
type: z.literal(RecognitionResultTypeV1.AUDIO_METRICS),
|
|
3953
3970
|
valid: z.boolean(),
|
|
@@ -3971,7 +3988,8 @@ var RecognitionResultSchemaV1 = z.discriminatedUnion("type", [
|
|
|
3971
3988
|
ErrorResultSchemaV1,
|
|
3972
3989
|
// P1 - P2
|
|
3973
3990
|
FunctionCallResultSchemaV1,
|
|
3974
|
-
ClientControlMessageSchemaV1
|
|
3991
|
+
ClientControlMessageSchemaV1,
|
|
3992
|
+
SessionConfiguredSchemaV1
|
|
3975
3993
|
]);
|
|
3976
3994
|
|
|
3977
3995
|
// ../../libs/types/dist/provider-transcription.types.js
|
|
@@ -4414,8 +4432,9 @@ var RecognitionGameInfoSchema = z.object({
|
|
|
4414
4432
|
questionAskedId: z.string().optional(),
|
|
4415
4433
|
/** @deprecated Use questionAskedId instead. Kept for backward compatibility during migration. */
|
|
4416
4434
|
questionAnswerId: z.string().optional(),
|
|
4417
|
-
platform: z.string().optional()
|
|
4418
|
-
|
|
4435
|
+
platform: z.string().optional(),
|
|
4436
|
+
experimentCohort: z.enum(["treatment", "control"]).optional()
|
|
4437
|
+
// Experiment cohort, defaults to 'control' if not provided
|
|
4419
4438
|
});
|
|
4420
4439
|
var RecognitionQueryMetadataSchema = z.object({
|
|
4421
4440
|
audioUtteranceId: z.string(),
|
|
@@ -5042,6 +5061,9 @@ function buildWebSocketUrl(config) {
|
|
|
5042
5061
|
if (config.gameContext?.gamePhase) {
|
|
5043
5062
|
url.searchParams.set("gamePhase", config.gameContext.gamePhase);
|
|
5044
5063
|
}
|
|
5064
|
+
if (config.experimentCohort) {
|
|
5065
|
+
url.searchParams.set("experimentCohort", config.experimentCohort);
|
|
5066
|
+
}
|
|
5045
5067
|
return url.toString();
|
|
5046
5068
|
}
|
|
5047
5069
|
|
|
@@ -5224,6 +5246,9 @@ var MessageHandler = class {
|
|
|
5224
5246
|
case RecognitionResultTypeV1.CLIENT_CONTROL_MESSAGE:
|
|
5225
5247
|
this.callbacks.onControlMessage(msgData);
|
|
5226
5248
|
break;
|
|
5249
|
+
case RecognitionResultTypeV1.SESSION_CONFIGURED:
|
|
5250
|
+
this.callbacks.onSessionConfigured?.(msgData);
|
|
5251
|
+
break;
|
|
5227
5252
|
default:
|
|
5228
5253
|
if (this.callbacks.logger) {
|
|
5229
5254
|
this.callbacks.logger("debug", "[RecogSDK] Unknown message type", { type: msgType });
|
|
@@ -5309,7 +5334,8 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
|
|
|
5309
5334
|
...config.questionAnswerId && { questionAnswerId: config.questionAnswerId },
|
|
5310
5335
|
...config.platform && { platform: config.platform },
|
|
5311
5336
|
...config.gameContext && { gameContext: config.gameContext },
|
|
5312
|
-
...config.gameId && { gameId: config.gameId }
|
|
5337
|
+
...config.gameId && { gameId: config.gameId },
|
|
5338
|
+
...config.experimentCohort && { experimentCohort: config.experimentCohort }
|
|
5313
5339
|
});
|
|
5314
5340
|
super({
|
|
5315
5341
|
url,
|
|
@@ -5342,6 +5368,7 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
|
|
|
5342
5368
|
}),
|
|
5343
5369
|
onMetadata: config.onMetadata || (() => {
|
|
5344
5370
|
}),
|
|
5371
|
+
onSessionConfigured: config.onSessionConfigured,
|
|
5345
5372
|
onError: config.onError || (() => {
|
|
5346
5373
|
}),
|
|
5347
5374
|
onConnected: config.onConnected || (() => {
|
|
@@ -5369,6 +5396,7 @@ var RealTimeTwoWayWebSocketRecognitionClient = class _RealTimeTwoWayWebSocketRec
|
|
|
5369
5396
|
onMetadata: this.config.onMetadata,
|
|
5370
5397
|
onError: this.config.onError,
|
|
5371
5398
|
onControlMessage: this.handleControlMessage.bind(this),
|
|
5399
|
+
onSessionConfigured: this.config.onSessionConfigured,
|
|
5372
5400
|
...this.config.logger && { logger: this.config.logger }
|
|
5373
5401
|
});
|
|
5374
5402
|
}
|