@lokutor/sdk 1.1.41 → 1.1.43

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
@@ -389,6 +389,10 @@ declare class VoiceAgentClient {
389
389
  * Update tool definitions mid-conversation
390
390
  */
391
391
  updateTools(tools: ToolDefinition[]): void;
392
+ /**
393
+ * Submit a tool execution result back to the agent
394
+ */
395
+ submitToolResult(callID: string, result: string | object): void;
392
396
  /**
393
397
  * Get full conversation transcript
394
398
  */
@@ -658,7 +662,7 @@ interface ConversationalPanelConfig {
658
662
  tools?: any[];
659
663
  /** Maximum conversation duration in seconds (default 300) */
660
664
  maxDuration?: number;
661
- /** Seconds of silence before auto-close (default 30) */
665
+ /** Seconds of silence before auto-close (default 60) */
662
666
  silenceTimeout?: number;
663
667
  }
664
668
  declare class ConversationalPanel {
package/dist/index.d.ts CHANGED
@@ -389,6 +389,10 @@ declare class VoiceAgentClient {
389
389
  * Update tool definitions mid-conversation
390
390
  */
391
391
  updateTools(tools: ToolDefinition[]): void;
392
+ /**
393
+ * Submit a tool execution result back to the agent
394
+ */
395
+ submitToolResult(callID: string, result: string | object): void;
392
396
  /**
393
397
  * Get full conversation transcript
394
398
  */
@@ -658,7 +662,7 @@ interface ConversationalPanelConfig {
658
662
  tools?: any[];
659
663
  /** Maximum conversation duration in seconds (default 300) */
660
664
  maxDuration?: number;
661
- /** Seconds of silence before auto-close (default 30) */
665
+ /** Seconds of silence before auto-close (default 60) */
662
666
  silenceTimeout?: number;
663
667
  }
664
668
  declare class ConversationalPanel {
package/dist/index.js CHANGED
@@ -1222,6 +1222,24 @@ var VoiceAgentClient = class {
1222
1222
  console.log(`\u2699\uFE0F Updated ${tools.length} tool(s)`);
1223
1223
  }
1224
1224
  }
1225
+ /**
1226
+ * Submit a tool execution result back to the agent
1227
+ */
1228
+ submitToolResult(callID, result) {
1229
+ const resultStr = typeof result === "string" ? result : JSON.stringify(result);
1230
+ if (this.ws && this.ws.readyState === WebSocket.OPEN && this.isConnected) {
1231
+ this.ws.send(JSON.stringify({
1232
+ type: "tool_result",
1233
+ data: {
1234
+ call_id: callID,
1235
+ result: resultStr
1236
+ }
1237
+ }));
1238
+ console.log(`\u2713 Submitted tool result for call ${callID}`);
1239
+ } else {
1240
+ console.warn("Not connected - cannot submit tool result");
1241
+ }
1242
+ }
1225
1243
  /**
1226
1244
  * Get full conversation transcript
1227
1245
  */
@@ -1809,6 +1827,7 @@ var ConversationalPanel = class {
1809
1827
  else if (status === "thinking") this.el.classList.add("cv-is-thinking");
1810
1828
  },
1811
1829
  onTranscription: (text) => {
1830
+ this._lastSpeechTime = Date.now();
1812
1831
  this.onTranscription?.(text);
1813
1832
  },
1814
1833
  onResponse: (text) => {
@@ -1968,7 +1987,7 @@ var ConversationalPanel = class {
1968
1987
  startTimer() {
1969
1988
  let elapsed = 0;
1970
1989
  const maxDur = this.cfg.maxDuration || 300;
1971
- const silentMax = this.cfg.silenceTimeout || 30;
1990
+ const silentMax = this.cfg.silenceTimeout || 60;
1972
1991
  this._lastSpeechTime = Date.now();
1973
1992
  this.timerEl.textContent = this.fmt(maxDur);
1974
1993
  this.timerTicker = window.setInterval(() => {
package/dist/index.mjs CHANGED
@@ -1175,6 +1175,24 @@ var VoiceAgentClient = class {
1175
1175
  console.log(`\u2699\uFE0F Updated ${tools.length} tool(s)`);
1176
1176
  }
1177
1177
  }
1178
+ /**
1179
+ * Submit a tool execution result back to the agent
1180
+ */
1181
+ submitToolResult(callID, result) {
1182
+ const resultStr = typeof result === "string" ? result : JSON.stringify(result);
1183
+ if (this.ws && this.ws.readyState === WebSocket.OPEN && this.isConnected) {
1184
+ this.ws.send(JSON.stringify({
1185
+ type: "tool_result",
1186
+ data: {
1187
+ call_id: callID,
1188
+ result: resultStr
1189
+ }
1190
+ }));
1191
+ console.log(`\u2713 Submitted tool result for call ${callID}`);
1192
+ } else {
1193
+ console.warn("Not connected - cannot submit tool result");
1194
+ }
1195
+ }
1178
1196
  /**
1179
1197
  * Get full conversation transcript
1180
1198
  */
@@ -1762,6 +1780,7 @@ var ConversationalPanel = class {
1762
1780
  else if (status === "thinking") this.el.classList.add("cv-is-thinking");
1763
1781
  },
1764
1782
  onTranscription: (text) => {
1783
+ this._lastSpeechTime = Date.now();
1765
1784
  this.onTranscription?.(text);
1766
1785
  },
1767
1786
  onResponse: (text) => {
@@ -1921,7 +1940,7 @@ var ConversationalPanel = class {
1921
1940
  startTimer() {
1922
1941
  let elapsed = 0;
1923
1942
  const maxDur = this.cfg.maxDuration || 300;
1924
- const silentMax = this.cfg.silenceTimeout || 30;
1943
+ const silentMax = this.cfg.silenceTimeout || 60;
1925
1944
  this._lastSpeechTime = Date.now();
1926
1945
  this.timerEl.textContent = this.fmt(maxDur);
1927
1946
  this.timerTicker = window.setInterval(() => {
package/package.json CHANGED
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "name": "@lokutor/sdk",
3
-
4
- "version": "1.1.41",
3
+ "version": "1.1.43",
5
4
  "description": "JavaScript/TypeScript SDK for Lokutor Real-time Voice AI",
6
5
  "main": "./dist/index.js",
7
6
  "module": "./dist/index.mjs",
package/src/client.ts CHANGED
@@ -778,6 +778,25 @@ export class VoiceAgentClient {
778
778
  }
779
779
  }
780
780
 
781
+ /**
782
+ * Submit a tool execution result back to the agent
783
+ */
784
+ public submitToolResult(callID: string, result: string | object) {
785
+ const resultStr = typeof result === 'string' ? result : JSON.stringify(result);
786
+ if (this.ws && this.ws.readyState === WebSocket.OPEN && this.isConnected) {
787
+ this.ws.send(JSON.stringify({
788
+ type: 'tool_result',
789
+ data: {
790
+ call_id: callID,
791
+ result: resultStr
792
+ }
793
+ }));
794
+ console.log(`✓ Submitted tool result for call ${callID}`);
795
+ } else {
796
+ console.warn('Not connected - cannot submit tool result');
797
+ }
798
+ }
799
+
781
800
  /**
782
801
  * Get full conversation transcript
783
802
  */
@@ -321,7 +321,7 @@ export interface ConversationalPanelConfig {
321
321
  tools?: any[];
322
322
  /** Maximum conversation duration in seconds (default 300) */
323
323
  maxDuration?: number;
324
- /** Seconds of silence before auto-close (default 30) */
324
+ /** Seconds of silence before auto-close (default 60) */
325
325
  silenceTimeout?: number;
326
326
  }
327
327
 
@@ -501,6 +501,7 @@ export class ConversationalPanel {
501
501
  else if (status === 'thinking') this.el.classList.add('cv-is-thinking');
502
502
  },
503
503
  onTranscription: (text: string) => {
504
+ this._lastSpeechTime = Date.now();
504
505
  this.onTranscription?.(text);
505
506
  },
506
507
  onResponse: (text: string) => {
@@ -674,7 +675,7 @@ export class ConversationalPanel {
674
675
  private startTimer() {
675
676
  let elapsed = 0;
676
677
  const maxDur = this.cfg.maxDuration || 300;
677
- const silentMax = this.cfg.silenceTimeout || 30;
678
+ const silentMax = this.cfg.silenceTimeout || 60;
678
679
  this._lastSpeechTime = Date.now();
679
680
  this.timerEl.textContent = this.fmt(maxDur);
680
681
  this.timerTicker = window.setInterval(() => {