@rapidaai/react 1.1.54 → 1.1.55

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.mjs CHANGED
@@ -89,6 +89,8 @@ import {
89
89
  UpdateWebhook,
90
90
  VoiceAgent,
91
91
  WEB_API,
92
+ WebRTCGrpcTransport,
93
+ WebTalk,
92
94
  WithAuthContext,
93
95
  WithClientContext,
94
96
  WithPlatform,
@@ -97,6 +99,7 @@ import {
97
99
  observeAgentConnectionState,
98
100
  observeAgentInputChannel,
99
101
  observeAgentMessageEvents,
102
+ observeAgentMuteState,
100
103
  require_assistant_analysis_pb,
101
104
  require_assistant_api_pb,
102
105
  require_assistant_deployment_pb,
@@ -106,12 +109,14 @@ import {
106
109
  require_assistant_webhook_pb,
107
110
  require_common_pb,
108
111
  require_talk_api_pb,
112
+ require_webrtc_pb,
113
+ supportsWebRTCGrpcTransport,
109
114
  useObservableState,
110
115
  useSelectInputDeviceAgent
111
- } from "./chunk-U2JQCXY3.mjs";
116
+ } from "./chunk-WIQDM3QW.mjs";
112
117
  import {
113
118
  MultibandAudioVisualizerComponent
114
- } from "./chunk-CVATR327.mjs";
119
+ } from "./chunk-KF5HQO5J.mjs";
115
120
  import {
116
121
  __commonJS,
117
122
  __require,
@@ -136,8 +141,8 @@ var require_talk_api_pb_service = __commonJS({
136
141
  service: TalkService2,
137
142
  requestStream: true,
138
143
  responseStream: true,
139
- requestType: talk_api_pb.AssistantTalkInput,
140
- responseType: talk_api_pb.AssistantTalkOutput
144
+ requestType: talk_api_pb.AssistantTalkRequest,
145
+ responseType: talk_api_pb.AssistantTalkResponse
141
146
  };
142
147
  TalkService2.GetAllAssistantConversation = {
143
148
  methodName: "GetAllAssistantConversation",
@@ -417,70 +422,6 @@ var require_talk_api_pb_service = __commonJS({
417
422
  };
418
423
  };
419
424
  exports.TalkServiceClient = TalkServiceClient3;
420
- var AgentKit = function() {
421
- function AgentKit2() {
422
- }
423
- AgentKit2.serviceName = "talk_api.AgentKit";
424
- return AgentKit2;
425
- }();
426
- AgentKit.Talk = {
427
- methodName: "Talk",
428
- service: AgentKit,
429
- requestStream: true,
430
- responseStream: true,
431
- requestType: talk_api_pb.TalkInput,
432
- responseType: talk_api_pb.TalkOutput
433
- };
434
- exports.AgentKit = AgentKit;
435
- function AgentKitClient(serviceHost, options) {
436
- this.serviceHost = serviceHost;
437
- this.options = options || {};
438
- }
439
- AgentKitClient.prototype.talk = function talk(metadata) {
440
- var listeners = {
441
- data: [],
442
- end: [],
443
- status: []
444
- };
445
- var client = grpc2.client(AgentKit.Talk, {
446
- host: this.serviceHost,
447
- metadata,
448
- transport: this.options.transport
449
- });
450
- client.onEnd(function(status, statusMessage, trailers) {
451
- listeners.status.forEach(function(handler) {
452
- handler({ code: status, details: statusMessage, metadata: trailers });
453
- });
454
- listeners.end.forEach(function(handler) {
455
- handler({ code: status, details: statusMessage, metadata: trailers });
456
- });
457
- listeners = null;
458
- });
459
- client.onMessage(function(message) {
460
- listeners.data.forEach(function(handler) {
461
- handler(message);
462
- });
463
- });
464
- client.start(metadata);
465
- return {
466
- on: function(type, handler) {
467
- listeners[type].push(handler);
468
- return this;
469
- },
470
- write: function(requestMessage) {
471
- client.send(requestMessage);
472
- return this;
473
- },
474
- end: function() {
475
- client.finishSend();
476
- },
477
- cancel: function() {
478
- listeners = null;
479
- client.close();
480
- }
481
- };
482
- };
483
- exports.AgentKitClient = AgentKitClient;
484
425
  }
485
426
  });
486
427
 
@@ -27950,6 +27891,79 @@ var require_notification_api_pb_service = __commonJS({
27950
27891
  }
27951
27892
  });
27952
27893
 
27894
+ // src/clients/protos/webrtc_pb_service.js
27895
+ var require_webrtc_pb_service = __commonJS({
27896
+ "src/clients/protos/webrtc_pb_service.js"(exports) {
27897
+ "use strict";
27898
+ var webrtc_pb = require_webrtc_pb();
27899
+ var grpc2 = __require("@improbable-eng/grpc-web").grpc;
27900
+ var WebRTC = function() {
27901
+ function WebRTC2() {
27902
+ }
27903
+ WebRTC2.serviceName = "talk_api.WebRTC";
27904
+ return WebRTC2;
27905
+ }();
27906
+ WebRTC.WebTalk = {
27907
+ methodName: "WebTalk",
27908
+ service: WebRTC,
27909
+ requestStream: true,
27910
+ responseStream: true,
27911
+ requestType: webrtc_pb.WebTalkRequest,
27912
+ responseType: webrtc_pb.WebTalkResponse
27913
+ };
27914
+ exports.WebRTC = WebRTC;
27915
+ function WebRTCClient2(serviceHost, options) {
27916
+ this.serviceHost = serviceHost;
27917
+ this.options = options || {};
27918
+ }
27919
+ WebRTCClient2.prototype.webTalk = function webTalk(metadata) {
27920
+ var listeners = {
27921
+ data: [],
27922
+ end: [],
27923
+ status: []
27924
+ };
27925
+ var client = grpc2.client(WebRTC.WebTalk, {
27926
+ host: this.serviceHost,
27927
+ metadata,
27928
+ transport: this.options.transport
27929
+ });
27930
+ client.onEnd(function(status, statusMessage, trailers) {
27931
+ listeners.status.forEach(function(handler) {
27932
+ handler({ code: status, details: statusMessage, metadata: trailers });
27933
+ });
27934
+ listeners.end.forEach(function(handler) {
27935
+ handler({ code: status, details: statusMessage, metadata: trailers });
27936
+ });
27937
+ listeners = null;
27938
+ });
27939
+ client.onMessage(function(message) {
27940
+ listeners.data.forEach(function(handler) {
27941
+ handler(message);
27942
+ });
27943
+ });
27944
+ client.start(metadata);
27945
+ return {
27946
+ on: function(type, handler) {
27947
+ listeners[type].push(handler);
27948
+ return this;
27949
+ },
27950
+ write: function(requestMessage) {
27951
+ client.send(requestMessage);
27952
+ return this;
27953
+ },
27954
+ end: function() {
27955
+ client.finishSend();
27956
+ },
27957
+ cancel: function() {
27958
+ listeners = null;
27959
+ client.close();
27960
+ }
27961
+ };
27962
+ };
27963
+ exports.WebRTCClient = WebRTCClient2;
27964
+ }
27965
+ });
27966
+
27953
27967
  // src/clients/protos/integration-api_pb.js
27954
27968
  var require_integration_api_pb = __commonJS({
27955
27969
  "src/clients/protos/integration-api_pb.js"(exports) {
@@ -29657,7 +29671,7 @@ var require_integration_api_pb = __commonJS({
29657
29671
  var f, obj = {
29658
29672
  code: jspb.Message.getFieldWithDefault(msg, 1, 0),
29659
29673
  success: jspb.Message.getBooleanFieldWithDefault(msg, 2, false),
29660
- requestid: jspb.Message.getFieldWithDefault(msg, 3, 0),
29674
+ requestid: jspb.Message.getFieldWithDefault(msg, 3, ""),
29661
29675
  data: (f = msg.getData()) && common_pb.Message.toObject(includeInstance, f),
29662
29676
  error: (f = msg.getError()) && common_pb.Error.toObject(includeInstance, f),
29663
29677
  metricsList: jspb.Message.toObjectList(
@@ -29701,8 +29715,8 @@ var require_integration_api_pb = __commonJS({
29701
29715
  break;
29702
29716
  case 3:
29703
29717
  var value = (
29704
- /** @type {number} */
29705
- reader.readUint64()
29718
+ /** @type {string} */
29719
+ reader.readString()
29706
29720
  );
29707
29721
  msg.setRequestid(value);
29708
29722
  break;
@@ -29757,8 +29771,8 @@ var require_integration_api_pb = __commonJS({
29757
29771
  );
29758
29772
  }
29759
29773
  f = message.getRequestid();
29760
- if (f !== 0) {
29761
- writer.writeUint64(
29774
+ if (f.length > 0) {
29775
+ writer.writeString(
29762
29776
  3,
29763
29777
  f
29764
29778
  );
@@ -29815,12 +29829,12 @@ var require_integration_api_pb = __commonJS({
29815
29829
  };
29816
29830
  proto.integration_api.ChatResponse.prototype.getRequestid = function() {
29817
29831
  return (
29818
- /** @type {number} */
29819
- jspb.Message.getFieldWithDefault(this, 3, 0)
29832
+ /** @type {string} */
29833
+ jspb.Message.getFieldWithDefault(this, 3, "")
29820
29834
  );
29821
29835
  };
29822
29836
  proto.integration_api.ChatResponse.prototype.setRequestid = function(value) {
29823
- return jspb.Message.setProto3IntField(this, 3, value);
29837
+ return jspb.Message.setProto3StringField(this, 3, value);
29824
29838
  };
29825
29839
  proto.integration_api.ChatResponse.prototype.getData = function() {
29826
29840
  return (
@@ -29884,6 +29898,7 @@ var require_integration_api_pb = __commonJS({
29884
29898
  proto.integration_api.ChatRequest.toObject = function(includeInstance, msg) {
29885
29899
  var f, obj = {
29886
29900
  credential: (f = msg.getCredential()) && proto.integration_api.Credential.toObject(includeInstance, f),
29901
+ requestid: jspb.Message.getFieldWithDefault(msg, 3, ""),
29887
29902
  conversationsList: jspb.Message.toObjectList(
29888
29903
  msg.getConversationsList(),
29889
29904
  common_pb.Message.toObject,
@@ -29920,6 +29935,13 @@ var require_integration_api_pb = __commonJS({
29920
29935
  reader.readMessage(value, proto.integration_api.Credential.deserializeBinaryFromReader);
29921
29936
  msg.setCredential(value);
29922
29937
  break;
29938
+ case 3:
29939
+ var value = (
29940
+ /** @type {string} */
29941
+ reader.readString()
29942
+ );
29943
+ msg.setRequestid(value);
29944
+ break;
29923
29945
  case 4:
29924
29946
  var value = new common_pb.Message();
29925
29947
  reader.readMessage(value, common_pb.Message.deserializeBinaryFromReader);
@@ -29964,6 +29986,13 @@ var require_integration_api_pb = __commonJS({
29964
29986
  proto.integration_api.Credential.serializeBinaryToWriter
29965
29987
  );
29966
29988
  }
29989
+ f = message.getRequestid();
29990
+ if (f.length > 0) {
29991
+ writer.writeString(
29992
+ 3,
29993
+ f
29994
+ );
29995
+ }
29967
29996
  f = message.getConversationsList();
29968
29997
  if (f.length > 0) {
29969
29998
  writer.writeRepeatedMessage(
@@ -30004,6 +30033,15 @@ var require_integration_api_pb = __commonJS({
30004
30033
  proto.integration_api.ChatRequest.prototype.hasCredential = function() {
30005
30034
  return jspb.Message.getField(this, 1) != null;
30006
30035
  };
30036
+ proto.integration_api.ChatRequest.prototype.getRequestid = function() {
30037
+ return (
30038
+ /** @type {string} */
30039
+ jspb.Message.getFieldWithDefault(this, 3, "")
30040
+ );
30041
+ };
30042
+ proto.integration_api.ChatRequest.prototype.setRequestid = function(value) {
30043
+ return jspb.Message.setProto3StringField(this, 3, value);
30044
+ };
30007
30045
  proto.integration_api.ChatRequest.prototype.getConversationsList = function() {
30008
30046
  return (
30009
30047
  /** @type{!Array<!proto.Message>} */
@@ -30950,7 +30988,7 @@ var require_integration_api_pb_service = __commonJS({
30950
30988
  OpenAiService2.StreamChat = {
30951
30989
  methodName: "StreamChat",
30952
30990
  service: OpenAiService2,
30953
- requestStream: false,
30991
+ requestStream: true,
30954
30992
  responseStream: true,
30955
30993
  requestType: integration_api_pb.ChatRequest,
30956
30994
  responseType: integration_api_pb.ChatResponse
@@ -31036,38 +31074,44 @@ var require_integration_api_pb_service = __commonJS({
31036
31074
  }
31037
31075
  };
31038
31076
  };
31039
- OpenAiServiceClient2.prototype.streamChat = function streamChat(requestMessage, metadata) {
31077
+ OpenAiServiceClient2.prototype.streamChat = function streamChat(metadata) {
31040
31078
  var listeners = {
31041
31079
  data: [],
31042
31080
  end: [],
31043
31081
  status: []
31044
31082
  };
31045
- var client = grpc2.invoke(OpenAiService2.StreamChat, {
31046
- request: requestMessage,
31083
+ var client = grpc2.client(OpenAiService2.StreamChat, {
31047
31084
  host: this.serviceHost,
31048
31085
  metadata,
31049
- transport: this.options.transport,
31050
- debug: this.options.debug,
31051
- onMessage: function(responseMessage) {
31052
- listeners.data.forEach(function(handler) {
31053
- handler(responseMessage);
31054
- });
31055
- },
31056
- onEnd: function(status, statusMessage, trailers) {
31057
- listeners.status.forEach(function(handler) {
31058
- handler({ code: status, details: statusMessage, metadata: trailers });
31059
- });
31060
- listeners.end.forEach(function(handler) {
31061
- handler({ code: status, details: statusMessage, metadata: trailers });
31062
- });
31063
- listeners = null;
31064
- }
31086
+ transport: this.options.transport
31065
31087
  });
31088
+ client.onEnd(function(status, statusMessage, trailers) {
31089
+ listeners.status.forEach(function(handler) {
31090
+ handler({ code: status, details: statusMessage, metadata: trailers });
31091
+ });
31092
+ listeners.end.forEach(function(handler) {
31093
+ handler({ code: status, details: statusMessage, metadata: trailers });
31094
+ });
31095
+ listeners = null;
31096
+ });
31097
+ client.onMessage(function(message) {
31098
+ listeners.data.forEach(function(handler) {
31099
+ handler(message);
31100
+ });
31101
+ });
31102
+ client.start(metadata);
31066
31103
  return {
31067
31104
  on: function(type, handler) {
31068
31105
  listeners[type].push(handler);
31069
31106
  return this;
31070
31107
  },
31108
+ write: function(requestMessage) {
31109
+ client.send(requestMessage);
31110
+ return this;
31111
+ },
31112
+ end: function() {
31113
+ client.finishSend();
31114
+ },
31071
31115
  cancel: function() {
31072
31116
  listeners = null;
31073
31117
  client.close();
@@ -31160,7 +31204,7 @@ var require_integration_api_pb_service = __commonJS({
31160
31204
  AzureService2.StreamChat = {
31161
31205
  methodName: "StreamChat",
31162
31206
  service: AzureService2,
31163
- requestStream: false,
31207
+ requestStream: true,
31164
31208
  responseStream: true,
31165
31209
  requestType: integration_api_pb.ChatRequest,
31166
31210
  responseType: integration_api_pb.ChatResponse
@@ -31246,38 +31290,44 @@ var require_integration_api_pb_service = __commonJS({
31246
31290
  }
31247
31291
  };
31248
31292
  };
31249
- AzureServiceClient2.prototype.streamChat = function streamChat(requestMessage, metadata) {
31293
+ AzureServiceClient2.prototype.streamChat = function streamChat(metadata) {
31250
31294
  var listeners = {
31251
31295
  data: [],
31252
31296
  end: [],
31253
31297
  status: []
31254
31298
  };
31255
- var client = grpc2.invoke(AzureService2.StreamChat, {
31256
- request: requestMessage,
31299
+ var client = grpc2.client(AzureService2.StreamChat, {
31257
31300
  host: this.serviceHost,
31258
31301
  metadata,
31259
- transport: this.options.transport,
31260
- debug: this.options.debug,
31261
- onMessage: function(responseMessage) {
31262
- listeners.data.forEach(function(handler) {
31263
- handler(responseMessage);
31264
- });
31265
- },
31266
- onEnd: function(status, statusMessage, trailers) {
31267
- listeners.status.forEach(function(handler) {
31268
- handler({ code: status, details: statusMessage, metadata: trailers });
31269
- });
31270
- listeners.end.forEach(function(handler) {
31271
- handler({ code: status, details: statusMessage, metadata: trailers });
31272
- });
31273
- listeners = null;
31274
- }
31302
+ transport: this.options.transport
31303
+ });
31304
+ client.onEnd(function(status, statusMessage, trailers) {
31305
+ listeners.status.forEach(function(handler) {
31306
+ handler({ code: status, details: statusMessage, metadata: trailers });
31307
+ });
31308
+ listeners.end.forEach(function(handler) {
31309
+ handler({ code: status, details: statusMessage, metadata: trailers });
31310
+ });
31311
+ listeners = null;
31312
+ });
31313
+ client.onMessage(function(message) {
31314
+ listeners.data.forEach(function(handler) {
31315
+ handler(message);
31316
+ });
31275
31317
  });
31318
+ client.start(metadata);
31276
31319
  return {
31277
31320
  on: function(type, handler) {
31278
31321
  listeners[type].push(handler);
31279
31322
  return this;
31280
31323
  },
31324
+ write: function(requestMessage) {
31325
+ client.send(requestMessage);
31326
+ return this;
31327
+ },
31328
+ end: function() {
31329
+ client.finishSend();
31330
+ },
31281
31331
  cancel: function() {
31282
31332
  listeners = null;
31283
31333
  client.close();
@@ -31370,7 +31420,7 @@ var require_integration_api_pb_service = __commonJS({
31370
31420
  GeminiService.StreamChat = {
31371
31421
  methodName: "StreamChat",
31372
31422
  service: GeminiService,
31373
- requestStream: false,
31423
+ requestStream: true,
31374
31424
  responseStream: true,
31375
31425
  requestType: integration_api_pb.ChatRequest,
31376
31426
  responseType: integration_api_pb.ChatResponse
@@ -31448,38 +31498,44 @@ var require_integration_api_pb_service = __commonJS({
31448
31498
  }
31449
31499
  };
31450
31500
  };
31451
- GeminiServiceClient.prototype.streamChat = function streamChat(requestMessage, metadata) {
31501
+ GeminiServiceClient.prototype.streamChat = function streamChat(metadata) {
31452
31502
  var listeners = {
31453
31503
  data: [],
31454
31504
  end: [],
31455
31505
  status: []
31456
31506
  };
31457
- var client = grpc2.invoke(GeminiService.StreamChat, {
31458
- request: requestMessage,
31507
+ var client = grpc2.client(GeminiService.StreamChat, {
31459
31508
  host: this.serviceHost,
31460
31509
  metadata,
31461
- transport: this.options.transport,
31462
- debug: this.options.debug,
31463
- onMessage: function(responseMessage) {
31464
- listeners.data.forEach(function(handler) {
31465
- handler(responseMessage);
31466
- });
31467
- },
31468
- onEnd: function(status, statusMessage, trailers) {
31469
- listeners.status.forEach(function(handler) {
31470
- handler({ code: status, details: statusMessage, metadata: trailers });
31471
- });
31472
- listeners.end.forEach(function(handler) {
31473
- handler({ code: status, details: statusMessage, metadata: trailers });
31474
- });
31475
- listeners = null;
31476
- }
31510
+ transport: this.options.transport
31477
31511
  });
31512
+ client.onEnd(function(status, statusMessage, trailers) {
31513
+ listeners.status.forEach(function(handler) {
31514
+ handler({ code: status, details: statusMessage, metadata: trailers });
31515
+ });
31516
+ listeners.end.forEach(function(handler) {
31517
+ handler({ code: status, details: statusMessage, metadata: trailers });
31518
+ });
31519
+ listeners = null;
31520
+ });
31521
+ client.onMessage(function(message) {
31522
+ listeners.data.forEach(function(handler) {
31523
+ handler(message);
31524
+ });
31525
+ });
31526
+ client.start(metadata);
31478
31527
  return {
31479
31528
  on: function(type, handler) {
31480
31529
  listeners[type].push(handler);
31481
31530
  return this;
31482
31531
  },
31532
+ write: function(requestMessage) {
31533
+ client.send(requestMessage);
31534
+ return this;
31535
+ },
31536
+ end: function() {
31537
+ client.finishSend();
31538
+ },
31483
31539
  cancel: function() {
31484
31540
  listeners = null;
31485
31541
  client.close();
@@ -31542,7 +31598,7 @@ var require_integration_api_pb_service = __commonJS({
31542
31598
  VertexAiService.StreamChat = {
31543
31599
  methodName: "StreamChat",
31544
31600
  service: VertexAiService,
31545
- requestStream: false,
31601
+ requestStream: true,
31546
31602
  responseStream: true,
31547
31603
  requestType: integration_api_pb.ChatRequest,
31548
31604
  responseType: integration_api_pb.ChatResponse
@@ -31620,38 +31676,44 @@ var require_integration_api_pb_service = __commonJS({
31620
31676
  }
31621
31677
  };
31622
31678
  };
31623
- VertexAiServiceClient.prototype.streamChat = function streamChat(requestMessage, metadata) {
31679
+ VertexAiServiceClient.prototype.streamChat = function streamChat(metadata) {
31624
31680
  var listeners = {
31625
31681
  data: [],
31626
31682
  end: [],
31627
31683
  status: []
31628
31684
  };
31629
- var client = grpc2.invoke(VertexAiService.StreamChat, {
31630
- request: requestMessage,
31685
+ var client = grpc2.client(VertexAiService.StreamChat, {
31631
31686
  host: this.serviceHost,
31632
31687
  metadata,
31633
- transport: this.options.transport,
31634
- debug: this.options.debug,
31635
- onMessage: function(responseMessage) {
31636
- listeners.data.forEach(function(handler) {
31637
- handler(responseMessage);
31638
- });
31639
- },
31640
- onEnd: function(status, statusMessage, trailers) {
31641
- listeners.status.forEach(function(handler) {
31642
- handler({ code: status, details: statusMessage, metadata: trailers });
31643
- });
31644
- listeners.end.forEach(function(handler) {
31645
- handler({ code: status, details: statusMessage, metadata: trailers });
31646
- });
31647
- listeners = null;
31648
- }
31688
+ transport: this.options.transport
31689
+ });
31690
+ client.onEnd(function(status, statusMessage, trailers) {
31691
+ listeners.status.forEach(function(handler) {
31692
+ handler({ code: status, details: statusMessage, metadata: trailers });
31693
+ });
31694
+ listeners.end.forEach(function(handler) {
31695
+ handler({ code: status, details: statusMessage, metadata: trailers });
31696
+ });
31697
+ listeners = null;
31698
+ });
31699
+ client.onMessage(function(message) {
31700
+ listeners.data.forEach(function(handler) {
31701
+ handler(message);
31702
+ });
31649
31703
  });
31704
+ client.start(metadata);
31650
31705
  return {
31651
31706
  on: function(type, handler) {
31652
31707
  listeners[type].push(handler);
31653
31708
  return this;
31654
31709
  },
31710
+ write: function(requestMessage) {
31711
+ client.send(requestMessage);
31712
+ return this;
31713
+ },
31714
+ end: function() {
31715
+ client.finishSend();
31716
+ },
31655
31717
  cancel: function() {
31656
31718
  listeners = null;
31657
31719
  client.close();
@@ -31706,7 +31768,7 @@ var require_integration_api_pb_service = __commonJS({
31706
31768
  ReplicateService2.StreamChat = {
31707
31769
  methodName: "StreamChat",
31708
31770
  service: ReplicateService2,
31709
- requestStream: false,
31771
+ requestStream: true,
31710
31772
  responseStream: true,
31711
31773
  requestType: integration_api_pb.ChatRequest,
31712
31774
  responseType: integration_api_pb.ChatResponse
@@ -31754,38 +31816,44 @@ var require_integration_api_pb_service = __commonJS({
31754
31816
  }
31755
31817
  };
31756
31818
  };
31757
- ReplicateServiceClient2.prototype.streamChat = function streamChat(requestMessage, metadata) {
31819
+ ReplicateServiceClient2.prototype.streamChat = function streamChat(metadata) {
31758
31820
  var listeners = {
31759
31821
  data: [],
31760
31822
  end: [],
31761
31823
  status: []
31762
31824
  };
31763
- var client = grpc2.invoke(ReplicateService2.StreamChat, {
31764
- request: requestMessage,
31825
+ var client = grpc2.client(ReplicateService2.StreamChat, {
31765
31826
  host: this.serviceHost,
31766
31827
  metadata,
31767
- transport: this.options.transport,
31768
- debug: this.options.debug,
31769
- onMessage: function(responseMessage) {
31770
- listeners.data.forEach(function(handler) {
31771
- handler(responseMessage);
31772
- });
31773
- },
31774
- onEnd: function(status, statusMessage, trailers) {
31775
- listeners.status.forEach(function(handler) {
31776
- handler({ code: status, details: statusMessage, metadata: trailers });
31777
- });
31778
- listeners.end.forEach(function(handler) {
31779
- handler({ code: status, details: statusMessage, metadata: trailers });
31780
- });
31781
- listeners = null;
31782
- }
31828
+ transport: this.options.transport
31829
+ });
31830
+ client.onEnd(function(status, statusMessage, trailers) {
31831
+ listeners.status.forEach(function(handler) {
31832
+ handler({ code: status, details: statusMessage, metadata: trailers });
31833
+ });
31834
+ listeners.end.forEach(function(handler) {
31835
+ handler({ code: status, details: statusMessage, metadata: trailers });
31836
+ });
31837
+ listeners = null;
31783
31838
  });
31839
+ client.onMessage(function(message) {
31840
+ listeners.data.forEach(function(handler) {
31841
+ handler(message);
31842
+ });
31843
+ });
31844
+ client.start(metadata);
31784
31845
  return {
31785
31846
  on: function(type, handler) {
31786
31847
  listeners[type].push(handler);
31787
31848
  return this;
31788
31849
  },
31850
+ write: function(requestMessage) {
31851
+ client.send(requestMessage);
31852
+ return this;
31853
+ },
31854
+ end: function() {
31855
+ client.finishSend();
31856
+ },
31789
31857
  cancel: function() {
31790
31858
  listeners = null;
31791
31859
  client.close();
@@ -31840,7 +31908,7 @@ var require_integration_api_pb_service = __commonJS({
31840
31908
  AnthropicService2.StreamChat = {
31841
31909
  methodName: "StreamChat",
31842
31910
  service: AnthropicService2,
31843
- requestStream: false,
31911
+ requestStream: true,
31844
31912
  responseStream: true,
31845
31913
  requestType: integration_api_pb.ChatRequest,
31846
31914
  responseType: integration_api_pb.ChatResponse
@@ -31888,38 +31956,44 @@ var require_integration_api_pb_service = __commonJS({
31888
31956
  }
31889
31957
  };
31890
31958
  };
31891
- AnthropicServiceClient2.prototype.streamChat = function streamChat(requestMessage, metadata) {
31959
+ AnthropicServiceClient2.prototype.streamChat = function streamChat(metadata) {
31892
31960
  var listeners = {
31893
31961
  data: [],
31894
31962
  end: [],
31895
31963
  status: []
31896
31964
  };
31897
- var client = grpc2.invoke(AnthropicService2.StreamChat, {
31898
- request: requestMessage,
31965
+ var client = grpc2.client(AnthropicService2.StreamChat, {
31899
31966
  host: this.serviceHost,
31900
31967
  metadata,
31901
- transport: this.options.transport,
31902
- debug: this.options.debug,
31903
- onMessage: function(responseMessage) {
31904
- listeners.data.forEach(function(handler) {
31905
- handler(responseMessage);
31906
- });
31907
- },
31908
- onEnd: function(status, statusMessage, trailers) {
31909
- listeners.status.forEach(function(handler) {
31910
- handler({ code: status, details: statusMessage, metadata: trailers });
31911
- });
31912
- listeners.end.forEach(function(handler) {
31913
- handler({ code: status, details: statusMessage, metadata: trailers });
31914
- });
31915
- listeners = null;
31916
- }
31968
+ transport: this.options.transport
31969
+ });
31970
+ client.onEnd(function(status, statusMessage, trailers) {
31971
+ listeners.status.forEach(function(handler) {
31972
+ handler({ code: status, details: statusMessage, metadata: trailers });
31973
+ });
31974
+ listeners.end.forEach(function(handler) {
31975
+ handler({ code: status, details: statusMessage, metadata: trailers });
31976
+ });
31977
+ listeners = null;
31978
+ });
31979
+ client.onMessage(function(message) {
31980
+ listeners.data.forEach(function(handler) {
31981
+ handler(message);
31982
+ });
31917
31983
  });
31984
+ client.start(metadata);
31918
31985
  return {
31919
31986
  on: function(type, handler) {
31920
31987
  listeners[type].push(handler);
31921
31988
  return this;
31922
31989
  },
31990
+ write: function(requestMessage) {
31991
+ client.send(requestMessage);
31992
+ return this;
31993
+ },
31994
+ end: function() {
31995
+ client.finishSend();
31996
+ },
31923
31997
  cancel: function() {
31924
31998
  listeners = null;
31925
31999
  client.close();
@@ -31990,7 +32064,7 @@ var require_integration_api_pb_service = __commonJS({
31990
32064
  CohereService2.StreamChat = {
31991
32065
  methodName: "StreamChat",
31992
32066
  service: CohereService2,
31993
- requestStream: false,
32067
+ requestStream: true,
31994
32068
  responseStream: true,
31995
32069
  requestType: integration_api_pb.ChatRequest,
31996
32070
  responseType: integration_api_pb.ChatResponse
@@ -32098,38 +32172,44 @@ var require_integration_api_pb_service = __commonJS({
32098
32172
  }
32099
32173
  };
32100
32174
  };
32101
- CohereServiceClient2.prototype.streamChat = function streamChat(requestMessage, metadata) {
32175
+ CohereServiceClient2.prototype.streamChat = function streamChat(metadata) {
32102
32176
  var listeners = {
32103
32177
  data: [],
32104
32178
  end: [],
32105
32179
  status: []
32106
32180
  };
32107
- var client = grpc2.invoke(CohereService2.StreamChat, {
32108
- request: requestMessage,
32181
+ var client = grpc2.client(CohereService2.StreamChat, {
32109
32182
  host: this.serviceHost,
32110
32183
  metadata,
32111
- transport: this.options.transport,
32112
- debug: this.options.debug,
32113
- onMessage: function(responseMessage) {
32114
- listeners.data.forEach(function(handler) {
32115
- handler(responseMessage);
32116
- });
32117
- },
32118
- onEnd: function(status, statusMessage, trailers) {
32119
- listeners.status.forEach(function(handler) {
32120
- handler({ code: status, details: statusMessage, metadata: trailers });
32121
- });
32122
- listeners.end.forEach(function(handler) {
32123
- handler({ code: status, details: statusMessage, metadata: trailers });
32124
- });
32125
- listeners = null;
32126
- }
32184
+ transport: this.options.transport
32127
32185
  });
32186
+ client.onEnd(function(status, statusMessage, trailers) {
32187
+ listeners.status.forEach(function(handler) {
32188
+ handler({ code: status, details: statusMessage, metadata: trailers });
32189
+ });
32190
+ listeners.end.forEach(function(handler) {
32191
+ handler({ code: status, details: statusMessage, metadata: trailers });
32192
+ });
32193
+ listeners = null;
32194
+ });
32195
+ client.onMessage(function(message) {
32196
+ listeners.data.forEach(function(handler) {
32197
+ handler(message);
32198
+ });
32199
+ });
32200
+ client.start(metadata);
32128
32201
  return {
32129
32202
  on: function(type, handler) {
32130
32203
  listeners[type].push(handler);
32131
32204
  return this;
32132
32205
  },
32206
+ write: function(requestMessage) {
32207
+ client.send(requestMessage);
32208
+ return this;
32209
+ },
32210
+ end: function() {
32211
+ client.finishSend();
32212
+ },
32133
32213
  cancel: function() {
32134
32214
  listeners = null;
32135
32215
  client.close();
@@ -32272,7 +32352,7 @@ var require_integration_api_pb_service = __commonJS({
32272
32352
  MistralService2.StreamChat = {
32273
32353
  methodName: "StreamChat",
32274
32354
  service: MistralService2,
32275
- requestStream: false,
32355
+ requestStream: true,
32276
32356
  responseStream: true,
32277
32357
  requestType: integration_api_pb.ChatRequest,
32278
32358
  responseType: integration_api_pb.ChatResponse
@@ -32320,38 +32400,44 @@ var require_integration_api_pb_service = __commonJS({
32320
32400
  }
32321
32401
  };
32322
32402
  };
32323
- MistralServiceClient2.prototype.streamChat = function streamChat(requestMessage, metadata) {
32403
+ MistralServiceClient2.prototype.streamChat = function streamChat(metadata) {
32324
32404
  var listeners = {
32325
32405
  data: [],
32326
32406
  end: [],
32327
32407
  status: []
32328
32408
  };
32329
- var client = grpc2.invoke(MistralService2.StreamChat, {
32330
- request: requestMessage,
32409
+ var client = grpc2.client(MistralService2.StreamChat, {
32331
32410
  host: this.serviceHost,
32332
32411
  metadata,
32333
- transport: this.options.transport,
32334
- debug: this.options.debug,
32335
- onMessage: function(responseMessage) {
32336
- listeners.data.forEach(function(handler) {
32337
- handler(responseMessage);
32338
- });
32339
- },
32340
- onEnd: function(status, statusMessage, trailers) {
32341
- listeners.status.forEach(function(handler) {
32342
- handler({ code: status, details: statusMessage, metadata: trailers });
32343
- });
32344
- listeners.end.forEach(function(handler) {
32345
- handler({ code: status, details: statusMessage, metadata: trailers });
32346
- });
32347
- listeners = null;
32348
- }
32412
+ transport: this.options.transport
32413
+ });
32414
+ client.onEnd(function(status, statusMessage, trailers) {
32415
+ listeners.status.forEach(function(handler) {
32416
+ handler({ code: status, details: statusMessage, metadata: trailers });
32417
+ });
32418
+ listeners.end.forEach(function(handler) {
32419
+ handler({ code: status, details: statusMessage, metadata: trailers });
32420
+ });
32421
+ listeners = null;
32422
+ });
32423
+ client.onMessage(function(message) {
32424
+ listeners.data.forEach(function(handler) {
32425
+ handler(message);
32426
+ });
32349
32427
  });
32428
+ client.start(metadata);
32350
32429
  return {
32351
32430
  on: function(type, handler) {
32352
32431
  listeners[type].push(handler);
32353
32432
  return this;
32354
32433
  },
32434
+ write: function(requestMessage) {
32435
+ client.send(requestMessage);
32436
+ return this;
32437
+ },
32438
+ end: function() {
32439
+ client.finishSend();
32440
+ },
32355
32441
  cancel: function() {
32356
32442
  listeners = null;
32357
32443
  client.close();
@@ -32793,11 +32879,12 @@ function useConnectAgent(agent) {
32793
32879
  [agent]
32794
32880
  // Update observable when agent changes
32795
32881
  );
32796
- const { isConnected } = useObservableState(observable, {
32797
- isConnected: agent?.isConnected ?? false
32882
+ const { isConnected, isConnecting } = useObservableState(observable, {
32883
+ isConnected: agent?.isConnected ?? false,
32798
32884
  // Default connection state
32885
+ isConnecting: agent?.state === "connecting" /* Connecting */
32799
32886
  });
32800
- return { handleConnectAgent, handleDisconnectAgent, isConnected };
32887
+ return { handleConnectAgent, handleDisconnectAgent, isConnected, isConnecting };
32801
32888
  }
32802
32889
 
32803
32890
  // src/hooks/use-input-mode-toggle-agent.ts
@@ -32812,10 +32899,7 @@ function useInputModeToggleAgent(agent) {
32812
32899
  },
32813
32900
  handleVoiceToggle: async () => {
32814
32901
  if (!agent) throw new Error("VoiceAgent instance not available");
32815
- if (agent.agentConfiguration.inputOptions.channel === "audio" /* Audio */) {
32816
- console.warn("Already in voice mode, ignoring toggle...");
32817
- return;
32818
- }
32902
+ if (agent.agentConfiguration.inputOptions.channel === "audio" /* Audio */) return;
32819
32903
  await agent.setInputChannel("audio" /* Audio */);
32820
32904
  }
32821
32905
  }),
@@ -32828,18 +32912,39 @@ function useInputModeToggleAgent(agent) {
32828
32912
  const { channel } = useObservableState(observable, {
32829
32913
  channel: agent.agentConfiguration.inputOptions.channel ?? "text" /* Text */
32830
32914
  });
32831
- React4.useEffect(() => {
32832
- if (observable && agent) {
32833
- const subscription = observable.subscribe((update) => {
32834
- console.log("Channel updated: ", update.channel);
32835
- });
32836
- return () => subscription.unsubscribe();
32837
- }
32838
- return void 0;
32839
- }, [observable, agent]);
32840
32915
  return { handleTextToggle, handleVoiceToggle, channel };
32841
32916
  }
32842
32917
 
32918
+ // src/hooks/use-mute-agent.ts
32919
+ import * as React5 from "react";
32920
+ function useMuteAgent(agent) {
32921
+ const { handleMute, handleUnmute, handleToggleMute } = React5.useMemo(
32922
+ () => ({
32923
+ handleMute: () => {
32924
+ if (!agent) throw new Error("VoiceAgent instance not available");
32925
+ agent.mute();
32926
+ },
32927
+ handleUnmute: () => {
32928
+ if (!agent) throw new Error("VoiceAgent instance not available");
32929
+ agent.unmute();
32930
+ },
32931
+ handleToggleMute: () => {
32932
+ if (!agent) throw new Error("VoiceAgent instance not available");
32933
+ return agent.toggleMute();
32934
+ }
32935
+ }),
32936
+ [agent]
32937
+ );
32938
+ const observable = React5.useMemo(
32939
+ () => agent ? observeAgentMuteState(agent) : void 0,
32940
+ [agent]
32941
+ );
32942
+ const { isMuted } = useObservableState(observable, {
32943
+ isMuted: agent?.isMuted ?? false
32944
+ });
32945
+ return { handleMute, handleUnmute, handleToggleMute, isMuted };
32946
+ }
32947
+
32843
32948
  // src/types/device-failure.ts
32844
32949
  var MediaDeviceFailure = /* @__PURE__ */ ((MediaDeviceFailure2) => {
32845
32950
  MediaDeviceFailure2["PermissionDenied"] = "PermissionDenied";
@@ -32851,7 +32956,6 @@ var MediaDeviceFailure = /* @__PURE__ */ ((MediaDeviceFailure2) => {
32851
32956
 
32852
32957
  // src/types/agent-config.ts
32853
32958
  var import_common_pb = __toESM(require_common_pb());
32854
- var import_talk_api_pb = __toESM(require_talk_api_pb());
32855
32959
 
32856
32960
  // src/utils/rapida_value.ts
32857
32961
  import { Any } from "google-protobuf/google/protobuf/any_pb";
@@ -32945,99 +33049,76 @@ function MapToObject(protoMap) {
32945
33049
  }
32946
33050
 
32947
33051
  // src/types/agent-config.ts
33052
+ var import_talk_api_pb = __toESM(require_talk_api_pb());
32948
33053
  var InputOptions = class {
32949
- /**
32950
- * enable channels
32951
- */
33054
+ /** Enabled channels for input */
32952
33055
  channels = ["audio" /* Audio */, "text" /* Text */];
32953
- /**
32954
- * sample rate for player
32955
- */
32956
- recorderOptions = {
32957
- format: "pcm",
32958
- sampleRate: 16e3
32959
- };
32960
- get recorderOption() {
32961
- return this.recorderOptions;
32962
- }
32963
- /**
32964
- * channel for providing output
32965
- */
33056
+ /** Default input channel */
32966
33057
  channel = "audio" /* Audio */;
32967
- get defaultChannel() {
32968
- return this.channel;
32969
- }
33058
+ /** Input device ID (microphone) */
33059
+ device;
33060
+ /** ICE servers for WebRTC (STUN/TURN) */
33061
+ iceServers;
32970
33062
  /**
32971
- * stream config
32972
- * define audio codacs and sample rate. these will be directly translated to stt
33063
+ * Returns a default stream configuration based on the currently selected
33064
+ * channel. This mirrors the protobuf `StreamConfig` type used by the
33065
+ * backend so consumers can easily build conversation initialization
33066
+ * payloads.
32973
33067
  */
32974
33068
  get defaultInputStreamOption() {
32975
- const inputStreamConfig = new import_talk_api_pb.StreamConfig();
32976
- if (this.channel == "audio" /* Audio */) {
32977
- const inputAudioConfig = new import_talk_api_pb.AudioConfig();
32978
- inputAudioConfig.setChannels(1);
32979
- inputAudioConfig.setAudioformat(import_talk_api_pb.AudioConfig.AudioFormat.LINEAR16);
32980
- inputAudioConfig.setSamplerate(this.recorderOptions.sampleRate);
32981
- inputStreamConfig.setAudio(inputAudioConfig);
32982
- }
32983
- return inputStreamConfig;
33069
+ const cfg = new import_talk_api_pb.StreamConfig();
33070
+ if (this.channel === "audio" /* Audio */) {
33071
+ const audio = new import_talk_api_pb.AudioConfig();
33072
+ cfg.setAudio(audio);
33073
+ } else if (this.channel === "text" /* Text */) {
33074
+ const text = new import_talk_api_pb.TextConfig();
33075
+ cfg.setText(text);
33076
+ }
33077
+ return cfg;
32984
33078
  }
32985
- /**
32986
- *
32987
- * @param channels
32988
- * @param channel
32989
- * @param deviceId
32990
- */
32991
- constructor(channels, channel, deviceId) {
33079
+ constructor(channels, channel, deviceId, iceServers) {
32992
33080
  this.channels = channels;
32993
33081
  if (channel) this.channel = channel;
32994
- if (deviceId) this.recorderOptions.device = deviceId;
33082
+ if (deviceId) this.device = deviceId;
33083
+ this.iceServers = iceServers;
32995
33084
  }
32996
33085
  };
32997
33086
  var OutputOptions = class {
32998
- /**
32999
- * enable channels
33000
- */
33087
+ /** Enabled channels for output */
33001
33088
  channels = ["audio" /* Audio */, "text" /* Text */];
33002
- /**
33003
- * sample rate for player
33004
- */
33005
- playerOptions = {
33006
- format: "pcm",
33007
- sampleRate: 16e3
33008
- };
33009
- get playerOption() {
33010
- return this.playerOptions;
33011
- }
33012
- /**
33013
- * channel for providing output
33014
- */
33089
+ /** Default output channel */
33015
33090
  channel = "audio" /* Audio */;
33091
+ /** Output device ID (speaker) */
33092
+ device;
33016
33093
  /**
33017
- *
33018
- * @param channels
33019
- * @param channel
33020
- * @param deviceId
33094
+ * Default stream configuration for output. Returns a protobuf-style
33095
+ * `StreamConfig` instance matching the current channel.
33021
33096
  */
33097
+ get defaultOutputStreamOption() {
33098
+ const cfg = new import_talk_api_pb.StreamConfig();
33099
+ if (this.channel === "audio" /* Audio */) {
33100
+ const audio = new import_talk_api_pb.AudioConfig();
33101
+ cfg.setAudio(audio);
33102
+ } else if (this.channel === "text" /* Text */) {
33103
+ const text = new import_talk_api_pb.TextConfig();
33104
+ cfg.setText(text);
33105
+ }
33106
+ return cfg;
33107
+ }
33022
33108
  constructor(channels, channel, deviceId) {
33023
33109
  this.channels = channels;
33024
33110
  if (channel) this.channel = channel;
33025
- if (deviceId) this.playerOption.device = deviceId;
33111
+ if (deviceId) this.device = deviceId;
33026
33112
  }
33027
- /**
33028
- * stream config
33029
- * define audio codacs and sample rate. these will be directly translated to tts
33030
- */
33031
- get defaultOutputStreamOption() {
33032
- const inputStreamConfig = new import_talk_api_pb.StreamConfig();
33033
- if (this.channel == "audio" /* Audio */) {
33034
- const inputAudioConfig = new import_talk_api_pb.AudioConfig();
33035
- inputAudioConfig.setChannels(1);
33036
- inputAudioConfig.setAudioformat(import_talk_api_pb.AudioConfig.AudioFormat.LINEAR16);
33037
- inputAudioConfig.setSamplerate(this.playerOption.sampleRate);
33038
- inputStreamConfig.setAudio(inputAudioConfig);
33039
- }
33040
- return inputStreamConfig;
33113
+ };
33114
+ var UserIdentifier = class {
33115
+ /** User identifier type */
33116
+ id;
33117
+ // name of user identifier
33118
+ name;
33119
+ constructor(id, name) {
33120
+ this.id = id;
33121
+ this.name = name;
33041
33122
  }
33042
33123
  };
33043
33124
  var AgentConfig = class {
@@ -33069,6 +33150,10 @@ var AgentConfig = class {
33069
33150
  *
33070
33151
  */
33071
33152
  outputOptions;
33153
+ /**
33154
+ * user identifier for conversation
33155
+ */
33156
+ userIdentifier;
33072
33157
  /**
33073
33158
  * Initializes a new instance of `AgentConfig`.
33074
33159
  *
@@ -33079,7 +33164,7 @@ var AgentConfig = class {
33079
33164
  constructor(id, inputOptions = new InputOptions([
33080
33165
  "audio" /* Audio */,
33081
33166
  "text" /* Text */
33082
- ], "text" /* Text */), outputOptions = new OutputOptions(["audio" /* Audio */, "text" /* Text */], "text" /* Text */), version, argument, options, metadata) {
33167
+ ], "text" /* Text */), outputOptions = new OutputOptions(["audio" /* Audio */, "text" /* Text */], "text" /* Text */), version, argument, options, metadata, userIdentifier) {
33083
33168
  this.id = id;
33084
33169
  this.version = version;
33085
33170
  this.arguments = argument;
@@ -33087,6 +33172,7 @@ var AgentConfig = class {
33087
33172
  this.metadata = metadata;
33088
33173
  this.inputOptions = inputOptions;
33089
33174
  this.outputOptions = outputOptions;
33175
+ this.userIdentifier = userIdentifier;
33090
33176
  }
33091
33177
  /**
33092
33178
  * Retrieves the assistant definition for this agent.
@@ -33144,63 +33230,93 @@ var AgentConfig = class {
33144
33230
  this.arguments?.set(k, StringToAny(value));
33145
33231
  return this;
33146
33232
  }
33233
+ /**
33234
+ * Set the user identifier for the conversation.
33235
+ * @param id - Unique user identifier
33236
+ * @param name - Optional display name
33237
+ * @returns this for chaining
33238
+ */
33239
+ setUserIdentifier(id, name) {
33240
+ this.userIdentifier = new UserIdentifier(id, name);
33241
+ return this;
33242
+ }
33147
33243
  };
33148
33244
 
33149
33245
  // src/hooks/use-multiband-track-volume.ts
33150
- import { useState, useEffect as useEffect2, useRef } from "react";
33246
+ import { useState, useEffect, useRef } from "react";
33151
33247
  var useMultibandMicrophoneTrackVolume = (agentContext, bands = 5, loPass = 0.1, hiPass = 1) => {
33152
33248
  const [frequencyBands, setFrequencyBands] = useState(
33153
33249
  Array(bands).fill([]).map(() => Array(32).fill(0))
33154
33250
  );
33155
- useEffect2(() => {
33156
- const updateVolume = () => {
33251
+ const prevBandsRef = useRef(
33252
+ Array(bands).fill([]).map(() => Array(32).fill(0))
33253
+ );
33254
+ useEffect(() => {
33255
+ let animationFrameId;
33256
+ let lastUpdateTime = 0;
33257
+ const updateInterval = 50;
33258
+ const updateVolume = (timestamp) => {
33259
+ if (timestamp - lastUpdateTime < updateInterval) {
33260
+ animationFrameId = requestAnimationFrame(updateVolume);
33261
+ return;
33262
+ }
33263
+ lastUpdateTime = timestamp;
33157
33264
  const frequencies = agentContext?.getInputByteFrequencyData();
33158
- if (!frequencies || frequencies.length === 0) return;
33159
- const startIndex = Math.floor(frequencies.length * loPass);
33160
- const endIndex = Math.floor(frequencies.length * hiPass);
33161
- const usableFrequencies = Array.from(
33162
- frequencies.slice(startIndex, endIndex)
33163
- );
33164
- const samplesPerBand = Math.floor(usableFrequencies.length / bands);
33265
+ if (!frequencies || frequencies.length === 0) {
33266
+ animationFrameId = requestAnimationFrame(updateVolume);
33267
+ return;
33268
+ }
33269
+ const totalBins = frequencies.length;
33165
33270
  const bandArrays = [];
33166
33271
  for (let bandIndex = 0; bandIndex < bands; bandIndex++) {
33167
- const bandStart = bandIndex * samplesPerBand;
33168
- const bandEnd = bandIndex === bands - 1 ? usableFrequencies.length : (bandIndex + 1) * samplesPerBand;
33169
- const bandFrequencies = usableFrequencies.slice(bandStart, bandEnd).map((amplitude) => {
33272
+ const bandStartRatio = Math.pow(bandIndex / bands, 1.5) * (hiPass - loPass) + loPass;
33273
+ const bandEndRatio = Math.pow((bandIndex + 1) / bands, 1.5) * (hiPass - loPass) + loPass;
33274
+ const bandStart = Math.floor(totalBins * bandStartRatio);
33275
+ const bandEnd = Math.min(Math.floor(totalBins * bandEndRatio), totalBins);
33276
+ const bandSlice = Array.from(frequencies.slice(bandStart, Math.max(bandEnd, bandStart + 1)));
33277
+ const bandFrequencies = bandSlice.map((amplitude) => {
33170
33278
  const numericAmplitude = Number(amplitude);
33171
- return Math.min(1, Math.max(0, numericAmplitude * 4));
33279
+ const normalized = numericAmplitude / 255;
33280
+ return Math.min(1, Math.max(0, Math.pow(normalized, 0.6) * 1.8));
33172
33281
  });
33173
33282
  const resampledBand = resampleArray(bandFrequencies, 32);
33174
33283
  bandArrays.push(resampledBand);
33175
33284
  }
33176
- setFrequencyBands((prevBands) => {
33177
- if (prevBands.length !== bands) return bandArrays;
33178
- return bandArrays.map((bandFrequencies, bandIndex) => {
33179
- if (!prevBands[bandIndex]) return bandFrequencies;
33180
- const smoothingFactor = 0.7;
33181
- return bandFrequencies.map((freq, i) => {
33182
- const prevValue = prevBands[bandIndex][i] || 0;
33183
- return freq * smoothingFactor + prevValue * (1 - smoothingFactor);
33184
- });
33285
+ const smoothedBands = bandArrays.map((bandFrequencies, bandIndex) => {
33286
+ const prevBand = prevBandsRef.current[bandIndex] || bandFrequencies;
33287
+ return bandFrequencies.map((freq, i) => {
33288
+ const prevValue = prevBand[i] || 0;
33289
+ const smoothingFactor = freq > prevValue ? 0.8 : 0.3;
33290
+ return freq * smoothingFactor + prevValue * (1 - smoothingFactor);
33185
33291
  });
33186
33292
  });
33293
+ prevBandsRef.current = smoothedBands;
33294
+ setFrequencyBands(smoothedBands);
33295
+ animationFrameId = requestAnimationFrame(updateVolume);
33187
33296
  };
33188
33297
  const resampleArray = (arr, newLength) => {
33298
+ if (arr.length === 0) return new Array(newLength).fill(0);
33189
33299
  const result = new Array(newLength);
33190
33300
  const stepSize = arr.length / newLength;
33191
33301
  for (let i = 0; i < newLength; i++) {
33192
33302
  const start = Math.floor(i * stepSize);
33193
- const end = Math.floor((i + 1) * stepSize);
33303
+ const end = Math.min(Math.floor((i + 1) * stepSize), arr.length);
33194
33304
  let sum = 0;
33305
+ let count = 0;
33195
33306
  for (let j = start; j < end; j++) {
33196
33307
  sum += arr[j] || 0;
33308
+ count++;
33197
33309
  }
33198
- result[i] = sum / (end - start);
33310
+ result[i] = count > 0 ? sum / count : 0;
33199
33311
  }
33200
33312
  return result;
33201
33313
  };
33202
- const interval = setInterval(updateVolume, 100);
33203
- return () => clearInterval(interval);
33314
+ animationFrameId = requestAnimationFrame(updateVolume);
33315
+ return () => {
33316
+ if (animationFrameId) {
33317
+ cancelAnimationFrame(animationFrameId);
33318
+ }
33319
+ };
33204
33320
  }, [agentContext, loPass, hiPass, bands]);
33205
33321
  return frequencyBands;
33206
33322
  };
@@ -33210,7 +33326,7 @@ var useMultiband3DSpeakerTrackVolume = (agentContext, bands = 5, loPass = 0.1, h
33210
33326
  );
33211
33327
  const [sphericalData, setSphericalData] = useState({ xNorm: 0, yNorm: 0, zNorm: 0, elapsedTimeSec: 0 });
33212
33328
  const startTime = useRef(Date.now());
33213
- useEffect2(() => {
33329
+ useEffect(() => {
33214
33330
  const updateVolume = () => {
33215
33331
  const frequencies = agentContext?.getOutputByteFrequencyData();
33216
33332
  if (!frequencies || frequencies.length === 0) return;
@@ -33294,6 +33410,7 @@ var DEBUGGER_SOURCE = "debugger";
33294
33410
  var SDK_SOURCE = "sdk";
33295
33411
  var PHONE_CALL_SOURCE = "phone-call";
33296
33412
  var WHATSAPP_SOURCE = "whatsapp";
33413
+ var WEBRTC_SOURCE = "webrtc";
33297
33414
  function getRapidaSourceValue(source) {
33298
33415
  return source;
33299
33416
  }
@@ -33309,9 +33426,11 @@ function fromStr(label) {
33309
33426
  return PHONE_CALL_SOURCE;
33310
33427
  case "whatsapp":
33311
33428
  return WHATSAPP_SOURCE;
33429
+ case "webrtc":
33430
+ return WEBRTC_SOURCE;
33312
33431
  default:
33313
33432
  console.warn(
33314
- "The source is not supported. Only 'web-plugin', 'debugger', 'sdk' are allowed."
33433
+ "The source is not supported. Only 'web-plugin', 'debugger', 'sdk', 'webrtc' are allowed."
33315
33434
  );
33316
33435
  return SDK_SOURCE;
33317
33436
  }
@@ -33319,6 +33438,7 @@ function fromStr(label) {
33319
33438
 
33320
33439
  // src/types/connection-config.ts
33321
33440
  var import_notification_api_pb_service = __toESM(require_notification_api_pb_service());
33441
+ var import_webrtc_pb_service = __toESM(require_webrtc_pb_service());
33322
33442
  var ConnectionConfig = class _ConnectionConfig {
33323
33443
  /**
33324
33444
  * an utils for debugger credentials
@@ -33492,6 +33612,12 @@ var ConnectionConfig = class _ConnectionConfig {
33492
33612
  transport: grpc.WebsocketTransport()
33493
33613
  });
33494
33614
  }
33615
+ get webrtcClient() {
33616
+ return new import_webrtc_pb_service.WebRTCClient(this.endpoint.assistant, {
33617
+ ...this.getClientOptions(),
33618
+ transport: grpc.WebsocketTransport()
33619
+ });
33620
+ }
33495
33621
  withLocal() {
33496
33622
  return this.withCustomEndpoint({
33497
33623
  assistant: LOCAL_ASSISTANT_API,
@@ -33610,9 +33736,9 @@ var GetDeployment = (assistant, source) => {
33610
33736
  };
33611
33737
 
33612
33738
  // src/hooks/use-agent-message.ts
33613
- import React5 from "react";
33739
+ import React6 from "react";
33614
33740
  function useAgentMessages(agent) {
33615
- const observable = React5.useMemo(
33741
+ const observable = React6.useMemo(
33616
33742
  () => observeAgentMessageEvents(agent),
33617
33743
  // Updated function name for consistency
33618
33744
  [agent]
@@ -34355,6 +34481,7 @@ var import_audit_logging_api_pb2 = __toESM(require_audit_logging_api_pb());
34355
34481
  var import_knowledge_api_pb_service2 = __toESM(require_knowledge_api_pb_service());
34356
34482
  var import_vault_api_pb2 = __toESM(require_vault_api_pb());
34357
34483
  var import_talk_api_pb2 = __toESM(require_talk_api_pb());
34484
+ var import_webrtc_pb = __toESM(require_webrtc_pb());
34358
34485
  var import_assistant_analysis_pb = __toESM(require_assistant_analysis_pb());
34359
34486
  var import_invoker_api_pb = __toESM(require_invoker_api_pb());
34360
34487
  var import_web_api_pb4 = __toESM(require_web_api_pb());
@@ -34477,8 +34604,8 @@ var export_AssistantProviderModel = import_assistant_provider_pb.AssistantProvid
34477
34604
  var export_AssistantProviderWebsocket = import_assistant_provider_pb.AssistantProviderWebsocket;
34478
34605
  var export_AssistantService = import_assistant_api_pb_service2.AssistantService;
34479
34606
  var export_AssistantServiceClient = import_assistant_api_pb_service2.AssistantServiceClient;
34480
- var export_AssistantTalkInput = import_talk_api_pb2.AssistantTalkInput;
34481
- var export_AssistantTalkOutput = import_talk_api_pb2.AssistantTalkOutput;
34607
+ var export_AssistantTalkRequest = import_talk_api_pb2.AssistantTalkRequest;
34608
+ var export_AssistantTalkResponse = import_talk_api_pb2.AssistantTalkResponse;
34482
34609
  var export_AssistantTool = import_assistant_tool_pb.AssistantTool;
34483
34610
  var export_AssistantToolLog = import_assistant_tool_pb.AssistantToolLog;
34484
34611
  var export_AssistantWebhook = import_assistant_webhook_pb.AssistantWebhook;
@@ -34782,6 +34909,8 @@ var export_VerifyTokenRequest = import_web_api_pb4.VerifyTokenRequest;
34782
34909
  var export_VerifyTokenResponse = import_web_api_pb4.VerifyTokenResponse;
34783
34910
  var export_VoyageAiService = import_integration_api_pb_service.VoyageAiService;
34784
34911
  var export_VoyageAiServiceClient = import_integration_api_pb_service.VoyageAiServiceClient;
34912
+ var export_WebTalkRequest = import_webrtc_pb.WebTalkRequest;
34913
+ var export_WebTalkResponse = import_webrtc_pb.WebTalkResponse;
34785
34914
  export {
34786
34915
  AddUsersToProject,
34787
34916
  export_AddUsersToProjectRequest as AddUsersToProjectRequest,
@@ -34819,8 +34948,8 @@ export {
34819
34948
  export_AssistantService as AssistantService,
34820
34949
  export_AssistantServiceClient as AssistantServiceClient,
34821
34950
  AssistantTalk,
34822
- export_AssistantTalkInput as AssistantTalkInput,
34823
- export_AssistantTalkOutput as AssistantTalkOutput,
34951
+ export_AssistantTalkRequest as AssistantTalkRequest,
34952
+ export_AssistantTalkResponse as AssistantTalkResponse,
34824
34953
  export_AssistantTool as AssistantTool,
34825
34954
  export_AssistantToolLog as AssistantToolLog,
34826
34955
  export_AssistantWebhook as AssistantWebhook,
@@ -35272,6 +35401,7 @@ export {
35272
35401
  export_UpdateUserResponse as UpdateUserResponse,
35273
35402
  UpdateWebhook,
35274
35403
  export_User as User,
35404
+ UserIdentifier,
35275
35405
  export_Variable as Variable,
35276
35406
  export_VaultCredential as VaultCredential,
35277
35407
  export_VaultService as VaultService,
@@ -35284,8 +35414,13 @@ export {
35284
35414
  VoiceAgent,
35285
35415
  export_VoyageAiService as VoyageAiService,
35286
35416
  export_VoyageAiServiceClient as VoyageAiServiceClient,
35417
+ WEBRTC_SOURCE,
35287
35418
  WEB_PLUGIN_SOURCE,
35288
35419
  WHATSAPP_SOURCE,
35420
+ WebRTCGrpcTransport,
35421
+ WebTalk,
35422
+ export_WebTalkRequest as WebTalkRequest,
35423
+ export_WebTalkResponse as WebTalkResponse,
35289
35424
  WithAuthContext,
35290
35425
  WithClientContext,
35291
35426
  WithPlatform,
@@ -35293,6 +35428,7 @@ export {
35293
35428
  fromStr,
35294
35429
  getClientInfo,
35295
35430
  getRapidaSourceValue,
35431
+ supportsWebRTCGrpcTransport,
35296
35432
  useAgentMessages,
35297
35433
  useConnectAgent,
35298
35434
  useConversationFeedback,
@@ -35300,6 +35436,7 @@ export {
35300
35436
  useMessageFeedback,
35301
35437
  useMultiband3DSpeakerTrackVolume,
35302
35438
  useMultibandMicrophoneTrackVolume,
35439
+ useMuteAgent,
35303
35440
  useSelectInputDeviceAgent
35304
35441
  };
35305
35442
  //# sourceMappingURL=index.mjs.map