@lokutor/sdk 1.1.29 → 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 +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +13 -2
- package/dist/index.mjs +13 -2
- package/package.json +2 -1
- package/src/client.ts +5 -0
- package/src/conversational-panel.ts +10 -3
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;
|
|
@@ -1616,8 +1621,9 @@ var ConversationalPanel = class {
|
|
|
1616
1621
|
this.startBtn.disabled = true;
|
|
1617
1622
|
this.errorEl.classList.remove("is-visible");
|
|
1618
1623
|
this.playConnectingSound();
|
|
1619
|
-
const rect = this.
|
|
1620
|
-
this.
|
|
1624
|
+
const rect = this.container.getBoundingClientRect();
|
|
1625
|
+
this.container.style.width = rect.width + "px";
|
|
1626
|
+
this.container.style.height = rect.height + "px";
|
|
1621
1627
|
try {
|
|
1622
1628
|
const ConvoAgent = this.cfg.ConvoAgent;
|
|
1623
1629
|
const SphereVisualizer = this.cfg.SphereVisualizer;
|
|
@@ -1738,6 +1744,11 @@ var ConversationalPanel = class {
|
|
|
1738
1744
|
this.visualizer.setAccentColor(r, g, b);
|
|
1739
1745
|
}
|
|
1740
1746
|
}
|
|
1747
|
+
/** Update background color dynamically */
|
|
1748
|
+
setBackgroundColor(color) {
|
|
1749
|
+
this.cfg.backgroundColor = color;
|
|
1750
|
+
this.container.style.setProperty("--cv-bg", color);
|
|
1751
|
+
}
|
|
1741
1752
|
/** Update title text */
|
|
1742
1753
|
setTitle(title) {
|
|
1743
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;
|
|
@@ -1569,8 +1574,9 @@ var ConversationalPanel = class {
|
|
|
1569
1574
|
this.startBtn.disabled = true;
|
|
1570
1575
|
this.errorEl.classList.remove("is-visible");
|
|
1571
1576
|
this.playConnectingSound();
|
|
1572
|
-
const rect = this.
|
|
1573
|
-
this.
|
|
1577
|
+
const rect = this.container.getBoundingClientRect();
|
|
1578
|
+
this.container.style.width = rect.width + "px";
|
|
1579
|
+
this.container.style.height = rect.height + "px";
|
|
1574
1580
|
try {
|
|
1575
1581
|
const ConvoAgent = this.cfg.ConvoAgent;
|
|
1576
1582
|
const SphereVisualizer = this.cfg.SphereVisualizer;
|
|
@@ -1691,6 +1697,11 @@ var ConversationalPanel = class {
|
|
|
1691
1697
|
this.visualizer.setAccentColor(r, g, b);
|
|
1692
1698
|
}
|
|
1693
1699
|
}
|
|
1700
|
+
/** Update background color dynamically */
|
|
1701
|
+
setBackgroundColor(color) {
|
|
1702
|
+
this.cfg.backgroundColor = color;
|
|
1703
|
+
this.container.style.setProperty("--cv-bg", color);
|
|
1704
|
+
}
|
|
1694
1705
|
/** Update title text */
|
|
1695
1706
|
setTitle(title) {
|
|
1696
1707
|
this.cfg.title = title;
|
package/package.json
CHANGED
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;
|
|
@@ -401,9 +401,10 @@ export class ConversationalPanel {
|
|
|
401
401
|
this.errorEl.classList.remove('is-visible');
|
|
402
402
|
this.playConnectingSound();
|
|
403
403
|
|
|
404
|
-
//
|
|
405
|
-
const rect = this.
|
|
406
|
-
this.
|
|
404
|
+
// Freeze panel dimensions so content changes can't shift layout
|
|
405
|
+
const rect = this.container.getBoundingClientRect();
|
|
406
|
+
this.container.style.width = rect.width + 'px';
|
|
407
|
+
this.container.style.height = rect.height + 'px';
|
|
407
408
|
|
|
408
409
|
try {
|
|
409
410
|
const ConvoAgent = this.cfg.ConvoAgent;
|
|
@@ -527,6 +528,12 @@ export class ConversationalPanel {
|
|
|
527
528
|
}
|
|
528
529
|
}
|
|
529
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
|
+
|
|
530
537
|
/** Update title text */
|
|
531
538
|
setTitle(title: string) {
|
|
532
539
|
this.cfg.title = title;
|