@onereach/step-voice 7.0.26-agenttimeout.4 → 7.0.26-agenttimeout.6

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.
@@ -43,7 +43,6 @@ class VoiceAgent extends voice_1.default {
43
43
  });
44
44
  this.triggers.otherwise(async () => {
45
45
  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, tool_feedback, soft_timeout, agent_url = '', mode = '', stt = {}, llm = {}, tts = {}, realtime = {} } = this.data;
46
- this.log.warn('this.data updated', this.data);
47
46
  if (lodash_1.default.isEmpty(system_instruction)) {
48
47
  this.throwError(new Error('Voice Agent: system instruction is required'));
49
48
  }
@@ -112,7 +111,7 @@ class VoiceAgent extends voice_1.default {
112
111
  this.throwError(new Error(`Voice Agent: unknown mode "${mode}"`));
113
112
  }
114
113
  }
115
- if (this.isStepFlagEnabled(tool_feedback?.enabled)) {
114
+ if (this.isStepFlagEnabled(tool_feedback?.enabled) && tools.length > 0) {
116
115
  const validatedFeedback = this.validateToolFeedback(tool_feedback);
117
116
  if (validatedFeedback) {
118
117
  config.tool_feedback = validatedFeedback;
@@ -143,48 +142,50 @@ class VoiceAgent extends voice_1.default {
143
142
  }
144
143
  validateToolFeedback(config) {
145
144
  if (config == null || typeof config !== 'object')
146
- return undefined;
145
+ return null;
147
146
  const cfg = config;
148
147
  // If enabled is not boolean true, silently return undefined (disabled case)
149
148
  if (typeof cfg.enabled !== 'boolean' || cfg.enabled !== true)
150
- return undefined;
149
+ return null;
151
150
  // Validate pre_tool_speech
152
151
  const validPreToolSpeech = ['auto', 'static', 'off'];
153
152
  if (!validPreToolSpeech.includes(cfg.pre_tool_speech)) {
154
153
  this.log.warn('Voice Agent: invalid tool_feedback.pre_tool_speech — feedback config excluded');
155
- return undefined;
154
+ return null;
156
155
  }
157
156
  // Validate tool_call_sound
158
157
  const validToolCallSound = ['typing', 'none'];
159
158
  if (!validToolCallSound.includes(cfg.tool_call_sound)) {
160
159
  this.log.warn('Voice Agent: invalid tool_feedback.tool_call_sound — feedback config excluded');
161
- return undefined;
160
+ return null;
162
161
  }
163
162
  // Validate tool_call_sound_behavior
164
163
  const validToolCallSoundBehavior = ['always', 'with_pre_speech'];
165
164
  if (!validToolCallSoundBehavior.includes(cfg.tool_call_sound_behavior)) {
166
165
  this.log.warn('Voice Agent: invalid tool_feedback.tool_call_sound_behavior — feedback config excluded');
167
- return undefined;
166
+ return null;
168
167
  }
169
168
  // Validate delay_seconds
170
- const delay = cfg.delay_seconds;
171
- if (typeof delay !== 'number' || !Number.isFinite(delay) || delay <= 0 || delay > 30) {
169
+ const delay = Number(cfg.delay_seconds);
170
+ if (delay <= 0 || delay > 30) {
172
171
  this.log.warn('Voice Agent: invalid tool_feedback.delay_seconds — feedback config excluded');
173
- return undefined;
172
+ return null;
174
173
  }
175
- // Validate pre_tool_speech_phrases
174
+ // Validate pre_tool_speech_phrases (only required when mode is 'static')
176
175
  const phrases = cfg.pre_tool_speech_phrases;
177
- if (!Array.isArray(phrases) ||
178
- phrases.length < 1 ||
179
- phrases.length > 20 ||
180
- !phrases.every((p) => typeof p === 'string' && p.trim().length > 0)) {
181
- this.log.warn('Voice Agent: invalid tool_feedback.pre_tool_speech_phrases feedback config excluded');
182
- return undefined;
176
+ if (cfg.pre_tool_speech === 'static') {
177
+ if (!Array.isArray(phrases) ||
178
+ phrases.length < 1 ||
179
+ phrases.length > 20 ||
180
+ !phrases.every((p) => typeof p === 'string' && p.trim().length > 0)) {
181
+ this.log.warn('Voice Agent: invalid tool_feedback.pre_tool_speech_phrases — feedback config excluded');
182
+ return null;
183
+ }
183
184
  }
184
185
  return {
185
186
  enabled: true,
186
187
  pre_tool_speech: cfg.pre_tool_speech,
187
- pre_tool_speech_phrases: phrases,
188
+ pre_tool_speech_phrases: (Array.isArray(phrases) ? phrases : []),
188
189
  tool_call_sound: cfg.tool_call_sound,
189
190
  tool_call_sound_behavior: cfg.tool_call_sound_behavior,
190
191
  delay_seconds: delay
@@ -217,7 +218,7 @@ class VoiceAgent extends voice_1.default {
217
218
  const result = {};
218
219
  if ('delay_seconds' in raw && raw.delay_seconds != null) {
219
220
  const delay = Number(raw.delay_seconds);
220
- if (!Number.isFinite(delay) || delay <= 0 || delay > 30) {
221
+ if (delay <= 0 || delay > 30) {
221
222
  this.log.warn(`Voice Agent: invalid feedback.delay_seconds for tool "${toolName}" — per-tool feedback excluded`);
222
223
  return null;
223
224
  }
@@ -253,8 +254,8 @@ class VoiceAgent extends voice_1.default {
253
254
  if (config == null || typeof config !== 'object' || Array.isArray(config))
254
255
  return null;
255
256
  const cfg = config;
256
- const timeoutSeconds = cfg.timeout_seconds;
257
- if (typeof timeoutSeconds !== 'number' || !Number.isFinite(timeoutSeconds) || timeoutSeconds <= 0 || timeoutSeconds > 30) {
257
+ const timeoutSeconds = Number(cfg.timeout_seconds);
258
+ if (timeoutSeconds <= 0 || timeoutSeconds > 30) {
258
259
  this.log.warn('Voice Agent: invalid soft_timeout.timeout_seconds — soft timeout config excluded');
259
260
  return null;
260
261
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onereach/step-voice",
3
- "version": "7.0.26-agenttimeout.4",
3
+ "version": "7.0.26-agenttimeout.6",
4
4
  "author": "Roman Zolotarov <roman.zolotarov@onereach.com>",
5
5
  "contributors": [
6
6
  "Roman Zolotarov",