obi-sdk 0.12.0 → 0.12.1

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.
@@ -0,0 +1,6 @@
1
+ import { O } from "./obi-widget-b64f0c73.js";
2
+ import "./types-e0297e7b.js";
3
+ export {
4
+ O as ObiWidget
5
+ };
6
+ //# sourceMappingURL=index-74e2d1b3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-74e2d1b3.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
@@ -629,19 +629,21 @@ class ObiClient {
629
629
  }
630
630
  const DEFAULT_API_BASE_URL = "https://app.coragents.ai/api";
631
631
  class ObiSession {
632
- constructor({ sessionId, apiBaseUrl }) {
632
+ constructor({ sessionId, apiBaseUrl, user }) {
633
633
  this.currentState = SDKState.READY;
634
634
  this.livekitState = "speaking";
635
635
  this.assistantAudioContext = null;
636
636
  this.userAudioContext = null;
637
637
  this._assistantAudioTimer = null;
638
638
  this._userAudioTimer = null;
639
+ this.user = void 0;
639
640
  this.sessionId = sessionId;
640
641
  this.apiBaseUrl = apiBaseUrl || DEFAULT_API_BASE_URL;
641
642
  this.client = new ObiClient({
642
643
  baseUrl: this.apiBaseUrl
643
644
  });
644
645
  this.emitter = new EventEmitter();
646
+ this.user = user;
645
647
  }
646
648
  emit(event, data) {
647
649
  this.emitter.emit(event, data);
@@ -768,7 +770,10 @@ class ObiSession {
768
770
  dynacast: true
769
771
  });
770
772
  this.setupRoomEventListeners();
771
- const joinToken = await this.client.getJoinToken(this.sessionId, { skipIntro: true });
773
+ const joinToken = await this.client.getJoinToken(this.sessionId, {
774
+ skipIntro: true,
775
+ ...this.user && { user: JSON.stringify(this.user) }
776
+ });
772
777
  await this.room.connect(joinToken.data.url, joinToken.data.token);
773
778
  if (this.microphoneStream) {
774
779
  const micTrack = this.microphoneStream.getAudioTracks()[0];
@@ -18967,4 +18972,4 @@ export {
18967
18972
  withSentryAsyncHandler as w,
18968
18973
  x
18969
18974
  };
18970
- //# sourceMappingURL=obi-widget-6b2916f1.js.map
18975
+ //# sourceMappingURL=obi-widget-b64f0c73.js.map