@onereach/step-voice 7.0.30-VOIC1729functionstotools.0 → 7.0.30

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.
@@ -3,7 +3,7 @@ interface INPUT {
3
3
  result: string;
4
4
  stopAgent: boolean;
5
5
  }
6
- export default class VoiceAgentToolResult extends VoiceStep<INPUT> {
6
+ export default class VoiceAgentFunctionResult extends VoiceStep<INPUT> {
7
7
  runStep(): Promise<void>;
8
8
  }
9
9
  export {};
@@ -2,18 +2,18 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  const voice_1 = tslib_1.__importDefault(require("./voice"));
5
- class VoiceAgentToolResult extends voice_1.default {
5
+ class VoiceAgentFunctionResult extends voice_1.default {
6
6
  async runStep() {
7
7
  const { result, stopAgent } = this.data;
8
8
  const ctx = await this.thread.get(`__voiceAgentContext_${this.thread.id}`);
9
9
  if (!ctx?.callId) {
10
- throw new Error('Voice Agent Tool Result: missing call context (must be placed on a Voice Agent tool exit)');
10
+ throw new Error('Voice Agent Function Result: missing call context (must be placed on a Voice Agent function exit)');
11
11
  }
12
- const { callId, callCallback, name: toolName, toolCallId } = ctx;
13
- this.log.info('Voice Agent Tool Result', { toolCallId, callId, threadId: this.thread.id });
12
+ const { callId, callCallback, name: functionName, functionId } = ctx;
13
+ this.log.info("Voice Agent Function Result", { functionId, callId, threadId: this.thread.id });
14
14
  const params = {
15
- toolName,
16
- toolCallId,
15
+ functionName,
16
+ functionId,
17
17
  result,
18
18
  options: { stop: stopAgent }
19
19
  };
@@ -22,7 +22,7 @@ class VoiceAgentToolResult extends voice_1.default {
22
22
  name: 'out/voice/voicer',
23
23
  params: {
24
24
  id: callId,
25
- commands: [{ name: 'agentToolResult', params }]
25
+ commands: [{ name: 'agentFunctionResult', params }]
26
26
  }
27
27
  }, {
28
28
  target: callCallback,
@@ -32,4 +32,4 @@ class VoiceAgentToolResult extends voice_1.default {
32
32
  this.exitStep('next');
33
33
  }
34
34
  }
35
- exports.default = VoiceAgentToolResult;
35
+ exports.default = VoiceAgentFunctionResult;
@@ -8,19 +8,19 @@ class VoiceAgent extends voice_1.default {
8
8
  const call = await this.fetchData();
9
9
  this.triggers.local(`in/voice/${call.id}`, async (event) => {
10
10
  switch (event.params.type) {
11
- case 'tool_call': {
12
- if (event.params.type !== 'tool_call')
11
+ case 'function_call': {
12
+ if (event.params.type !== 'function_call')
13
13
  return;
14
14
  const cb = this.thread.takeCallback();
15
- const name = event.params.name ?? 'tool_call';
15
+ const name = event.params.name ?? 'function_call';
16
16
  const params = event.params.arguments ?? {};
17
- const toolCallId = event.params.toolCallId ?? '';
18
- const exitId = this.findExitByLabel(name) ?? this.getExitStepId('tool_call');
17
+ const functionId = event.params.functionId ?? '';
18
+ const exitId = this.findExitByLabel(name) ?? this.getExitStepId('function_call');
19
19
  if (exitId) {
20
20
  this.exitStep(exitId, {
21
21
  [name]: params,
22
22
  name,
23
- toolCallId,
23
+ functionId,
24
24
  __voicecb: cb,
25
25
  callId: call.id,
26
26
  callType: call.type,
@@ -28,7 +28,7 @@ class VoiceAgent extends voice_1.default {
28
28
  }, true);
29
29
  }
30
30
  else {
31
- this.log.warn('no exit for tool_call', { name });
31
+ this.log.warn('no exit for function_call', { name });
32
32
  }
33
33
  return;
34
34
  }
@@ -297,7 +297,13 @@ class VoiceAgent extends voice_1.default {
297
297
  if (!Array.isArray(systemTools)) {
298
298
  this.throwError(new Error('Voice Agent: system_tools must be an array'));
299
299
  }
300
- return systemTools.filter(entry => entry != null && typeof entry === 'object');
300
+ return systemTools
301
+ .filter(entry => entry != null && typeof entry === 'object')
302
+ .filter((entry) => !lodash_1.default.isEmpty(entry.name))
303
+ .map((entry) => ({
304
+ ...entry,
305
+ description: lodash_1.default.isEmpty(entry.description) ? undefined : entry.description
306
+ }));
301
307
  }
302
308
  parseAgentServiceOptions(label, options) {
303
309
  if (options == null || options === '')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.30-VOIC1729functionstotools.0",
3
+ "version": "7.0.30",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",