obi-sdk 0.11.1 → 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":";;"}
@@ -550,6 +550,34 @@ class ObiClient {
550
550
  body: data
551
551
  });
552
552
  }
553
+ async listRevisionKnowledgeBlocks(revisionId) {
554
+ return await this.client.GET("/revisions/{id}/knowledge-blocks", {
555
+ params: { path: { id: revisionId } }
556
+ });
557
+ }
558
+ async replaceRevisionKnowledgeBlocks(revisionId, data) {
559
+ return await this.client.PUT("/revisions/{id}/knowledge-blocks", {
560
+ params: { path: { id: revisionId } },
561
+ body: data
562
+ });
563
+ }
564
+ async createRevisionKnowledgeBlock(revisionId, data) {
565
+ return await this.client.POST("/revisions/{id}/knowledge-blocks", {
566
+ params: { path: { id: revisionId } },
567
+ body: data
568
+ });
569
+ }
570
+ async updateRevisionKnowledgeBlock(revisionId, blockId, data) {
571
+ return await this.client.PUT("/revisions/{id}/knowledge-blocks/{blockId}", {
572
+ params: { path: { id: revisionId, blockId } },
573
+ body: data
574
+ });
575
+ }
576
+ async deleteRevisionKnowledgeBlock(revisionId, blockId) {
577
+ return await this.client.DELETE("/revisions/{id}/knowledge-blocks/{blockId}", {
578
+ params: { path: { id: revisionId, blockId } }
579
+ });
580
+ }
553
581
  // Sessions
554
582
  async listSessions(token) {
555
583
  return await this.client.GET("/sessions", {
@@ -581,12 +609,13 @@ class ObiClient {
581
609
  params: { path: { id } }
582
610
  });
583
611
  }
584
- async getJoinToken(token, { skipIntro } = {}) {
612
+ async getJoinToken(token, { skipIntro, user } = {}) {
585
613
  return await this.client.GET("/join-token", {
586
614
  params: {
587
615
  query: {
588
616
  token,
589
- ...skipIntro && { skip_intro: "true" }
617
+ ...skipIntro && { skip_intro: "true" },
618
+ ...user && { user: encodeURIComponent(user) }
590
619
  }
591
620
  }
592
621
  });
@@ -600,19 +629,21 @@ class ObiClient {
600
629
  }
601
630
  const DEFAULT_API_BASE_URL = "https://app.coragents.ai/api";
602
631
  class ObiSession {
603
- constructor({ sessionId, apiBaseUrl }) {
632
+ constructor({ sessionId, apiBaseUrl, user }) {
604
633
  this.currentState = SDKState.READY;
605
634
  this.livekitState = "speaking";
606
635
  this.assistantAudioContext = null;
607
636
  this.userAudioContext = null;
608
637
  this._assistantAudioTimer = null;
609
638
  this._userAudioTimer = null;
639
+ this.user = void 0;
610
640
  this.sessionId = sessionId;
611
641
  this.apiBaseUrl = apiBaseUrl || DEFAULT_API_BASE_URL;
612
642
  this.client = new ObiClient({
613
643
  baseUrl: this.apiBaseUrl
614
644
  });
615
645
  this.emitter = new EventEmitter();
646
+ this.user = user;
616
647
  }
617
648
  emit(event, data) {
618
649
  this.emitter.emit(event, data);
@@ -739,7 +770,10 @@ class ObiSession {
739
770
  dynacast: true
740
771
  });
741
772
  this.setupRoomEventListeners();
742
- 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
+ });
743
777
  await this.room.connect(joinToken.data.url, joinToken.data.token);
744
778
  if (this.microphoneStream) {
745
779
  const micTrack = this.microphoneStream.getAudioTracks()[0];
@@ -17764,13 +17798,6 @@ SessionStartModal.styles = i$4`
17764
17798
  aspect-ratio: 1/1;
17765
17799
  border-radius: 8px;
17766
17800
  background: var(--obi-primary, #a10fff);
17767
- box-shadow:
17768
- 0px 0px 8px 0px rgba(168, 85, 247, 0.12),
17769
- 0px 0px 8px 0px rgba(192, 132, 252, 0.24),
17770
- 0px 0px 4px 0px rgba(192, 132, 252, 0.24),
17771
- 0px 0px 4px 0px rgba(192, 132, 252, 0.24),
17772
- 0px 0px 2px 0px rgba(192, 132, 252, 0.12),
17773
- 0px 0px 1px 0px rgba(168, 85, 247, 0.24);
17774
17801
  }
17775
17802
 
17776
17803
  .logo img {
@@ -18345,7 +18372,8 @@ class ObiWidget extends i$1 {
18345
18372
  try {
18346
18373
  const session = new ObiSession({
18347
18374
  sessionId: sessionToken,
18348
- apiBaseUrl: API_BASE_URL
18375
+ apiBaseUrl: API_BASE_URL,
18376
+ ...this.user && { user: this.user }
18349
18377
  });
18350
18378
  if (!session) {
18351
18379
  console.error("Failed to create session");
@@ -18944,4 +18972,4 @@ export {
18944
18972
  withSentryAsyncHandler as w,
18945
18973
  x
18946
18974
  };
18947
- //# sourceMappingURL=obi-widget-00df4624.js.map
18975
+ //# sourceMappingURL=obi-widget-b64f0c73.js.map