@onereach/step-voice 7.0.30 → 7.0.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.
@@ -3,7 +3,7 @@ interface INPUT {
3
3
  result: string;
4
4
  stopAgent: boolean;
5
5
  }
6
- export default class VoiceAgentFunctionResult extends VoiceStep<INPUT> {
6
+ export default class VoiceAgentToolResult 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 VoiceAgentFunctionResult extends voice_1.default {
5
+ class VoiceAgentToolResult 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 Function Result: missing call context (must be placed on a Voice Agent function exit)');
10
+ throw new Error('Voice Agent Tool Result: missing call context (must be placed on a Voice Agent tool exit)');
11
11
  }
12
- const { callId, callCallback, name: functionName, functionId } = ctx;
13
- this.log.info("Voice Agent Function Result", { functionId, callId, threadId: this.thread.id });
12
+ const { callId, callCallback, name: toolName, toolCallId } = ctx;
13
+ this.log.info('Voice Agent Tool Result', { toolCallId, callId, threadId: this.thread.id });
14
14
  const params = {
15
- functionName,
16
- functionId,
15
+ toolName,
16
+ toolCallId,
17
17
  result,
18
18
  options: { stop: stopAgent }
19
19
  };
@@ -22,7 +22,7 @@ class VoiceAgentFunctionResult extends voice_1.default {
22
22
  name: 'out/voice/voicer',
23
23
  params: {
24
24
  id: callId,
25
- commands: [{ name: 'agentFunctionResult', params }]
25
+ commands: [{ name: 'agentToolResult', params }]
26
26
  }
27
27
  }, {
28
28
  target: callCallback,
@@ -32,4 +32,4 @@ class VoiceAgentFunctionResult extends voice_1.default {
32
32
  this.exitStep('next');
33
33
  }
34
34
  }
35
- exports.default = VoiceAgentFunctionResult;
35
+ exports.default = VoiceAgentToolResult;
@@ -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 'function_call': {
12
- if (event.params.type !== 'function_call')
11
+ case 'tool_call': {
12
+ if (event.params.type !== 'tool_call')
13
13
  return;
14
14
  const cb = this.thread.takeCallback();
15
- const name = event.params.name ?? 'function_call';
15
+ const name = event.params.name ?? 'tool_call';
16
16
  const params = event.params.arguments ?? {};
17
- const functionId = event.params.functionId ?? '';
18
- const exitId = this.findExitByLabel(name) ?? this.getExitStepId('function_call');
17
+ const toolCallId = event.params.toolCallId ?? '';
18
+ const exitId = this.findExitByLabel(name) ?? this.getExitStepId('tool_call');
19
19
  if (exitId) {
20
20
  this.exitStep(exitId, {
21
21
  [name]: params,
22
22
  name,
23
- functionId,
23
+ toolCallId,
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 function_call', { name });
31
+ this.log.warn('no exit for tool_call', { name });
32
32
  }
33
33
  return;
34
34
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.30",
3
+ "version": "7.0.31",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",