@onereach/step-voice 7.0.24 → 7.0.25-VOIC1709useridledetection.0

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.
@@ -16,6 +16,11 @@ interface INPUT {
16
16
  developer_messages: string[];
17
17
  greeting_message: string;
18
18
  prevent_greeting_interruption: boolean;
19
+ idle_detection_enabled: boolean;
20
+ idle_timeout_secs: number | string;
21
+ idle_max_retries: number | string;
22
+ idle_prompts: string[];
23
+ idle_goodbye_message: string;
19
24
  custom_config_enabled: boolean;
20
25
  agent_url_overwritten: boolean;
21
26
  agent_url: string;
@@ -34,7 +34,7 @@ class VoiceAgent extends voice_1.default {
34
34
  }
35
35
  });
36
36
  this.triggers.otherwise(async () => {
37
- const { handlers = [], system_instruction = '', developer_messages = [], greeting_message = '', prevent_greeting_interruption = false, custom_config_enabled = false, agent_url_overwritten = false, agent_url = '', mode = '', stt = {}, llm = {}, tts = {}, realtime = {} } = this.data;
37
+ const { handlers = [], system_instruction = '', developer_messages = [], greeting_message = '', prevent_greeting_interruption = false, idle_detection_enabled = false, idle_timeout_secs = 8, idle_max_retries = 3, idle_prompts = [], idle_goodbye_message = '', custom_config_enabled = false, agent_url_overwritten = false, agent_url = '', mode = '', stt = {}, llm = {}, tts = {}, realtime = {} } = this.data;
38
38
  if (lodash_1.default.isEmpty(system_instruction)) {
39
39
  this.throwError(new Error('Voice Agent: system instruction is required'));
40
40
  }
@@ -57,6 +57,18 @@ class VoiceAgent extends voice_1.default {
57
57
  prevent_greeting_interruption,
58
58
  tools
59
59
  };
60
+ if (idle_detection_enabled) {
61
+ const timeoutSecs = Number(idle_timeout_secs);
62
+ const maxRetries = Number(idle_max_retries);
63
+ const prompts = idle_prompts.filter(prompt => !lodash_1.default.isEmpty(lodash_1.default.trim(String(prompt))));
64
+ config.idle_detection = {
65
+ enabled: true,
66
+ timeout_secs: timeoutSecs,
67
+ max_retries: maxRetries,
68
+ prompts,
69
+ goodbye_message: lodash_1.default.isEmpty(lodash_1.default.trim(idle_goodbye_message)) ? undefined : idle_goodbye_message
70
+ };
71
+ }
60
72
  let agentCustomUrl = '';
61
73
  if (custom_config_enabled) {
62
74
  config.mode = mode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.24",
3
+ "version": "7.0.25-VOIC1709useridledetection.0",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",