@lokutor/sdk 1.1.20 → 1.1.22
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 +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +10 -0
- package/dist/index.mjs +10 -0
- package/package.json +1 -1
- package/src/client.ts +1 -0
- package/src/conversational-panel.ts +12 -0
package/dist/index.d.mts
CHANGED
|
@@ -611,6 +611,8 @@ interface ConversationalPanelConfig {
|
|
|
611
611
|
connectingSoundSrc?: string;
|
|
612
612
|
/** Background image for the curtain, e.g. '/background_gradient.jpeg' */
|
|
613
613
|
curtainBgSrc?: string;
|
|
614
|
+
/** Tool definitions for LLM function calling */
|
|
615
|
+
tools?: any[];
|
|
614
616
|
}
|
|
615
617
|
declare class ConversationalPanel {
|
|
616
618
|
private cfg;
|
|
@@ -638,6 +640,7 @@ declare class ConversationalPanel {
|
|
|
638
640
|
onStart?: () => void;
|
|
639
641
|
onStop?: () => void;
|
|
640
642
|
onError?: (err: any) => void;
|
|
643
|
+
onToolCall?: (tool: any) => void;
|
|
641
644
|
constructor(cfg: ConversationalPanelConfig);
|
|
642
645
|
private buildDOM;
|
|
643
646
|
private esc;
|
|
@@ -653,6 +656,8 @@ declare class ConversationalPanel {
|
|
|
653
656
|
setDescription(desc: string): void;
|
|
654
657
|
/** Update prompt (only takes effect on next start()) */
|
|
655
658
|
setPrompt(prompt: string): void;
|
|
659
|
+
/** Update tool definitions (only takes effect on next start()) */
|
|
660
|
+
setTools(tools: any[]): void;
|
|
656
661
|
/** Show an error message */
|
|
657
662
|
showError(text: string): void;
|
|
658
663
|
/** Destroy the component, removing all DOM and stopping any active session */
|
package/dist/index.d.ts
CHANGED
|
@@ -611,6 +611,8 @@ interface ConversationalPanelConfig {
|
|
|
611
611
|
connectingSoundSrc?: string;
|
|
612
612
|
/** Background image for the curtain, e.g. '/background_gradient.jpeg' */
|
|
613
613
|
curtainBgSrc?: string;
|
|
614
|
+
/** Tool definitions for LLM function calling */
|
|
615
|
+
tools?: any[];
|
|
614
616
|
}
|
|
615
617
|
declare class ConversationalPanel {
|
|
616
618
|
private cfg;
|
|
@@ -638,6 +640,7 @@ declare class ConversationalPanel {
|
|
|
638
640
|
onStart?: () => void;
|
|
639
641
|
onStop?: () => void;
|
|
640
642
|
onError?: (err: any) => void;
|
|
643
|
+
onToolCall?: (tool: any) => void;
|
|
641
644
|
constructor(cfg: ConversationalPanelConfig);
|
|
642
645
|
private buildDOM;
|
|
643
646
|
private esc;
|
|
@@ -653,6 +656,8 @@ declare class ConversationalPanel {
|
|
|
653
656
|
setDescription(desc: string): void;
|
|
654
657
|
/** Update prompt (only takes effect on next start()) */
|
|
655
658
|
setPrompt(prompt: string): void;
|
|
659
|
+
/** Update tool definitions (only takes effect on next start()) */
|
|
660
|
+
setTools(tools: any[]): void;
|
|
656
661
|
/** Show an error message */
|
|
657
662
|
showError(text: string): void;
|
|
658
663
|
/** Destroy the component, removing all DOM and stopping any active session */
|
package/dist/index.js
CHANGED
|
@@ -950,6 +950,7 @@ var VoiceAgentClient = class {
|
|
|
950
950
|
}
|
|
951
951
|
case "tool_call":
|
|
952
952
|
console.log(`\u{1F6E0}\uFE0F Tool Call: ${msg.name}(${msg.arguments})`);
|
|
953
|
+
this.emit("tool_call", msg);
|
|
953
954
|
break;
|
|
954
955
|
}
|
|
955
956
|
} catch (e) {
|
|
@@ -1511,6 +1512,7 @@ var ConversationalPanel = class {
|
|
|
1511
1512
|
onStart;
|
|
1512
1513
|
onStop;
|
|
1513
1514
|
onError;
|
|
1515
|
+
onToolCall;
|
|
1514
1516
|
constructor(cfg) {
|
|
1515
1517
|
this.cfg = cfg;
|
|
1516
1518
|
this.container = cfg.container;
|
|
@@ -1617,6 +1619,7 @@ var ConversationalPanel = class {
|
|
|
1617
1619
|
}
|
|
1618
1620
|
const agentHandle = new ConvoAgent({
|
|
1619
1621
|
apiKey: this.cfg.apiKey,
|
|
1622
|
+
tools: this.cfg.tools,
|
|
1620
1623
|
prompt: this.cfg.prompt,
|
|
1621
1624
|
voice: this.cfg.voice || "M1",
|
|
1622
1625
|
language: this.cfg.language || "en",
|
|
@@ -1631,6 +1634,9 @@ var ConversationalPanel = class {
|
|
|
1631
1634
|
onResponse: (text) => {
|
|
1632
1635
|
this.onResponse?.(text);
|
|
1633
1636
|
},
|
|
1637
|
+
onToolCall: (tool) => {
|
|
1638
|
+
this.onToolCall?.(tool);
|
|
1639
|
+
},
|
|
1634
1640
|
onError: (err) => {
|
|
1635
1641
|
if (!this.isRunning) return;
|
|
1636
1642
|
this.onError?.(err);
|
|
@@ -1732,6 +1738,10 @@ var ConversationalPanel = class {
|
|
|
1732
1738
|
setPrompt(prompt) {
|
|
1733
1739
|
this.cfg.prompt = prompt;
|
|
1734
1740
|
}
|
|
1741
|
+
/** Update tool definitions (only takes effect on next start()) */
|
|
1742
|
+
setTools(tools) {
|
|
1743
|
+
this.cfg.tools = tools;
|
|
1744
|
+
}
|
|
1735
1745
|
/** Show an error message */
|
|
1736
1746
|
showError(text) {
|
|
1737
1747
|
this.errorText.textContent = text;
|
package/dist/index.mjs
CHANGED
|
@@ -903,6 +903,7 @@ var VoiceAgentClient = class {
|
|
|
903
903
|
}
|
|
904
904
|
case "tool_call":
|
|
905
905
|
console.log(`\u{1F6E0}\uFE0F Tool Call: ${msg.name}(${msg.arguments})`);
|
|
906
|
+
this.emit("tool_call", msg);
|
|
906
907
|
break;
|
|
907
908
|
}
|
|
908
909
|
} catch (e) {
|
|
@@ -1464,6 +1465,7 @@ var ConversationalPanel = class {
|
|
|
1464
1465
|
onStart;
|
|
1465
1466
|
onStop;
|
|
1466
1467
|
onError;
|
|
1468
|
+
onToolCall;
|
|
1467
1469
|
constructor(cfg) {
|
|
1468
1470
|
this.cfg = cfg;
|
|
1469
1471
|
this.container = cfg.container;
|
|
@@ -1570,6 +1572,7 @@ var ConversationalPanel = class {
|
|
|
1570
1572
|
}
|
|
1571
1573
|
const agentHandle = new ConvoAgent({
|
|
1572
1574
|
apiKey: this.cfg.apiKey,
|
|
1575
|
+
tools: this.cfg.tools,
|
|
1573
1576
|
prompt: this.cfg.prompt,
|
|
1574
1577
|
voice: this.cfg.voice || "M1",
|
|
1575
1578
|
language: this.cfg.language || "en",
|
|
@@ -1584,6 +1587,9 @@ var ConversationalPanel = class {
|
|
|
1584
1587
|
onResponse: (text) => {
|
|
1585
1588
|
this.onResponse?.(text);
|
|
1586
1589
|
},
|
|
1590
|
+
onToolCall: (tool) => {
|
|
1591
|
+
this.onToolCall?.(tool);
|
|
1592
|
+
},
|
|
1587
1593
|
onError: (err) => {
|
|
1588
1594
|
if (!this.isRunning) return;
|
|
1589
1595
|
this.onError?.(err);
|
|
@@ -1685,6 +1691,10 @@ var ConversationalPanel = class {
|
|
|
1685
1691
|
setPrompt(prompt) {
|
|
1686
1692
|
this.cfg.prompt = prompt;
|
|
1687
1693
|
}
|
|
1694
|
+
/** Update tool definitions (only takes effect on next start()) */
|
|
1695
|
+
setTools(tools) {
|
|
1696
|
+
this.cfg.tools = tools;
|
|
1697
|
+
}
|
|
1688
1698
|
/** Show an error message */
|
|
1689
1699
|
showError(text) {
|
|
1690
1700
|
this.errorText.textContent = text;
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -247,6 +247,8 @@ export interface ConversationalPanelConfig {
|
|
|
247
247
|
connectingSoundSrc?: string;
|
|
248
248
|
/** Background image for the curtain, e.g. '/background_gradient.jpeg' */
|
|
249
249
|
curtainBgSrc?: string;
|
|
250
|
+
/** Tool definitions for LLM function calling */
|
|
251
|
+
tools?: any[];
|
|
250
252
|
}
|
|
251
253
|
|
|
252
254
|
export class ConversationalPanel {
|
|
@@ -279,6 +281,7 @@ export class ConversationalPanel {
|
|
|
279
281
|
onStart?: () => void;
|
|
280
282
|
onStop?: () => void;
|
|
281
283
|
onError?: (err: any) => void;
|
|
284
|
+
onToolCall?: (tool: any) => void;
|
|
282
285
|
|
|
283
286
|
constructor(cfg: ConversationalPanelConfig) {
|
|
284
287
|
this.cfg = cfg;
|
|
@@ -401,6 +404,7 @@ export class ConversationalPanel {
|
|
|
401
404
|
|
|
402
405
|
const agentHandle = new ConvoAgent({
|
|
403
406
|
apiKey: this.cfg.apiKey,
|
|
407
|
+
tools: this.cfg.tools,
|
|
404
408
|
prompt: this.cfg.prompt,
|
|
405
409
|
voice: this.cfg.voice || 'M1',
|
|
406
410
|
language: this.cfg.language || 'en',
|
|
@@ -415,6 +419,9 @@ export class ConversationalPanel {
|
|
|
415
419
|
onResponse: (text: string) => {
|
|
416
420
|
this.onResponse?.(text);
|
|
417
421
|
},
|
|
422
|
+
onToolCall: (tool: any) => {
|
|
423
|
+
this.onToolCall?.(tool);
|
|
424
|
+
},
|
|
418
425
|
onError: (err: any) => {
|
|
419
426
|
if (!this.isRunning) return;
|
|
420
427
|
this.onError?.(err);
|
|
@@ -517,6 +524,11 @@ export class ConversationalPanel {
|
|
|
517
524
|
this.cfg.prompt = prompt;
|
|
518
525
|
}
|
|
519
526
|
|
|
527
|
+
/** Update tool definitions (only takes effect on next start()) */
|
|
528
|
+
setTools(tools: any[]) {
|
|
529
|
+
this.cfg.tools = tools;
|
|
530
|
+
}
|
|
531
|
+
|
|
520
532
|
/** Show an error message */
|
|
521
533
|
showError(text: string) {
|
|
522
534
|
this.errorText.textContent = text;
|