@lokutor/sdk 1.1.41 → 1.1.42
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 +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +18 -0
- package/dist/index.mjs +18 -0
- package/package.json +1 -1
- package/src/client.ts +19 -0
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
|
*/
|
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
|
*/
|
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
|
*/
|
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
|
*/
|
package/package.json
CHANGED
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
|
*/
|