@lokutor/sdk 1.1.30 → 1.1.31

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.d.mts CHANGED
@@ -657,6 +657,8 @@ declare class ConversationalPanel {
657
657
  stop(): void;
658
658
  /** Update accent color dynamically */
659
659
  setColor(color: string): void;
660
+ /** Update background color dynamically */
661
+ setBackgroundColor(color: string): void;
660
662
  /** Update title text */
661
663
  setTitle(title: string): void;
662
664
  /** Update description text */
package/dist/index.d.ts CHANGED
@@ -657,6 +657,8 @@ declare class ConversationalPanel {
657
657
  stop(): void;
658
658
  /** Update accent color dynamically */
659
659
  setColor(color: string): void;
660
+ /** Update background color dynamically */
661
+ setBackgroundColor(color: string): void;
660
662
  /** Update title text */
661
663
  setTitle(title: string): void;
662
664
  /** Update description text */
package/dist/index.js CHANGED
@@ -889,9 +889,11 @@ var VoiceAgentClient = class {
889
889
  });
890
890
  if (msg.role === "user") {
891
891
  if (this.onTranscription) this.onTranscription(msg.data);
892
+ this.emit("transcription", msg.data);
892
893
  console.log(`\u{1F4AC} You: ${msg.data}`);
893
894
  } else {
894
895
  if (this.onResponse) this.onResponse(msg.data);
896
+ this.emit("response", msg.data);
895
897
  console.log(`\u{1F916} Agent: ${msg.data}`);
896
898
  }
897
899
  break;
@@ -908,6 +910,7 @@ var VoiceAgentClient = class {
908
910
  this.audioManager.stopPlayback();
909
911
  }
910
912
  if (this.onStatus) this.onStatus(msg.data);
913
+ this.emit("status", msg.data);
911
914
  const icons = {
912
915
  "interrupted": "\u26A1",
913
916
  "thinking": "\u{1F9E0}",
@@ -945,10 +948,12 @@ var VoiceAgentClient = class {
945
948
  retryable: backendRetryable
946
949
  });
947
950
  if (this.onError) this.onError(error);
951
+ this.emit("error", error);
948
952
  console.error(`\u274C Server error: [${error.code}] ${error.message}`);
949
953
  break;
950
954
  }
951
955
  case "tool_call":
956
+ this.emit("tool_call", { name: msg.name, arguments: msg.arguments });
952
957
  console.log(`\u{1F6E0}\uFE0F Tool Call: ${msg.name}(${msg.arguments})`);
953
958
  this.emit("tool_call", msg);
954
959
  break;
@@ -1739,6 +1744,11 @@ var ConversationalPanel = class {
1739
1744
  this.visualizer.setAccentColor(r, g, b);
1740
1745
  }
1741
1746
  }
1747
+ /** Update background color dynamically */
1748
+ setBackgroundColor(color) {
1749
+ this.cfg.backgroundColor = color;
1750
+ this.container.style.setProperty("--cv-bg", color);
1751
+ }
1742
1752
  /** Update title text */
1743
1753
  setTitle(title) {
1744
1754
  this.cfg.title = title;
package/dist/index.mjs CHANGED
@@ -842,9 +842,11 @@ var VoiceAgentClient = class {
842
842
  });
843
843
  if (msg.role === "user") {
844
844
  if (this.onTranscription) this.onTranscription(msg.data);
845
+ this.emit("transcription", msg.data);
845
846
  console.log(`\u{1F4AC} You: ${msg.data}`);
846
847
  } else {
847
848
  if (this.onResponse) this.onResponse(msg.data);
849
+ this.emit("response", msg.data);
848
850
  console.log(`\u{1F916} Agent: ${msg.data}`);
849
851
  }
850
852
  break;
@@ -861,6 +863,7 @@ var VoiceAgentClient = class {
861
863
  this.audioManager.stopPlayback();
862
864
  }
863
865
  if (this.onStatus) this.onStatus(msg.data);
866
+ this.emit("status", msg.data);
864
867
  const icons = {
865
868
  "interrupted": "\u26A1",
866
869
  "thinking": "\u{1F9E0}",
@@ -898,10 +901,12 @@ var VoiceAgentClient = class {
898
901
  retryable: backendRetryable
899
902
  });
900
903
  if (this.onError) this.onError(error);
904
+ this.emit("error", error);
901
905
  console.error(`\u274C Server error: [${error.code}] ${error.message}`);
902
906
  break;
903
907
  }
904
908
  case "tool_call":
909
+ this.emit("tool_call", { name: msg.name, arguments: msg.arguments });
905
910
  console.log(`\u{1F6E0}\uFE0F Tool Call: ${msg.name}(${msg.arguments})`);
906
911
  this.emit("tool_call", msg);
907
912
  break;
@@ -1692,6 +1697,11 @@ var ConversationalPanel = class {
1692
1697
  this.visualizer.setAccentColor(r, g, b);
1693
1698
  }
1694
1699
  }
1700
+ /** Update background color dynamically */
1701
+ setBackgroundColor(color) {
1702
+ this.cfg.backgroundColor = color;
1703
+ this.container.style.setProperty("--cv-bg", color);
1704
+ }
1695
1705
  /** Update title text */
1696
1706
  setTitle(title) {
1697
1707
  this.cfg.title = title;
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@lokutor/sdk",
3
- "version": "1.1.30",
3
+
4
+ "version": "1.1.31",
4
5
  "description": "JavaScript/TypeScript SDK for Lokutor Real-time Voice AI",
5
6
  "main": "./dist/index.js",
6
7
  "module": "./dist/index.mjs",
package/src/client.ts CHANGED
@@ -456,9 +456,11 @@ export class VoiceAgentClient {
456
456
 
457
457
  if (msg.role === 'user') {
458
458
  if (this.onTranscription) this.onTranscription(msg.data);
459
+ this.emit('transcription', msg.data);
459
460
  console.log(`💬 You: ${msg.data}`);
460
461
  } else {
461
462
  if (this.onResponse) this.onResponse(msg.data);
463
+ this.emit('response', msg.data);
462
464
  console.log(`🤖 Agent: ${msg.data}`);
463
465
  }
464
466
  break;
@@ -475,6 +477,7 @@ export class VoiceAgentClient {
475
477
  this.audioManager.stopPlayback();
476
478
  }
477
479
  if (this.onStatus) this.onStatus(msg.data);
480
+ this.emit('status', msg.data);
478
481
  const icons: Record<string, string> = {
479
482
  'interrupted': '⚡',
480
483
  'thinking': '🧠',
@@ -512,10 +515,12 @@ export class VoiceAgentClient {
512
515
  retryable: backendRetryable,
513
516
  });
514
517
  if (this.onError) this.onError(error);
518
+ this.emit('error', error);
515
519
  console.error(`❌ Server error: [${error.code}] ${error.message}`);
516
520
  break;
517
521
  }
518
522
  case 'tool_call':
523
+ this.emit('tool_call', { name: msg.name, arguments: msg.arguments });
519
524
  console.log(`🛠️ Tool Call: ${msg.name}(${msg.arguments})`);
520
525
  this.emit('tool_call', msg);
521
526
  break;
@@ -528,6 +528,12 @@ export class ConversationalPanel {
528
528
  }
529
529
  }
530
530
 
531
+ /** Update background color dynamically */
532
+ setBackgroundColor(color: string) {
533
+ this.cfg.backgroundColor = color;
534
+ this.container.style.setProperty('--cv-bg', color);
535
+ }
536
+
531
537
  /** Update title text */
532
538
  setTitle(title: string) {
533
539
  this.cfg.title = title;