@onereach/step-voice 7.0.26-agenttimeout.5 → 7.0.26-agenttimeout.7
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/dst/Voice Agent Function Result.js +5 -2
- package/dst/Voice Agent.js +16 -14
- package/package.json +1 -1
|
@@ -4,9 +4,12 @@ const tslib_1 = require("tslib");
|
|
|
4
4
|
const voice_1 = tslib_1.__importDefault(require("./voice"));
|
|
5
5
|
class VoiceAgentFunctionResult extends voice_1.default {
|
|
6
6
|
async runStep() {
|
|
7
|
-
const ctx = await this.thread.get('__voiceAgentContext') ?? {};
|
|
8
|
-
const { callId, callCallback, name: functionName, functionId } = ctx;
|
|
9
7
|
const { result, stopAgent } = this.data;
|
|
8
|
+
let ctx = await this.thread.get(`__voiceAgentContext_${this.thread.id}`);
|
|
9
|
+
if (!ctx) {
|
|
10
|
+
ctx = await this.thread.get('__voiceAgentContext') ?? {};
|
|
11
|
+
}
|
|
12
|
+
const { callId, callCallback, name: functionName, functionId } = ctx;
|
|
10
13
|
if (!callId) {
|
|
11
14
|
throw new Error('Voice Agent Function Result: missing call context (must be placed on a Voice Agent function exit)');
|
|
12
15
|
}
|
package/dst/Voice Agent.js
CHANGED
|
@@ -142,34 +142,34 @@ class VoiceAgent extends voice_1.default {
|
|
|
142
142
|
}
|
|
143
143
|
validateToolFeedback(config) {
|
|
144
144
|
if (config == null || typeof config !== 'object')
|
|
145
|
-
return
|
|
145
|
+
return null;
|
|
146
146
|
const cfg = config;
|
|
147
147
|
// If enabled is not boolean true, silently return undefined (disabled case)
|
|
148
148
|
if (typeof cfg.enabled !== 'boolean' || cfg.enabled !== true)
|
|
149
|
-
return
|
|
149
|
+
return null;
|
|
150
150
|
// Validate pre_tool_speech
|
|
151
151
|
const validPreToolSpeech = ['auto', 'static', 'off'];
|
|
152
152
|
if (!validPreToolSpeech.includes(cfg.pre_tool_speech)) {
|
|
153
153
|
this.log.warn('Voice Agent: invalid tool_feedback.pre_tool_speech — feedback config excluded');
|
|
154
|
-
return
|
|
154
|
+
return null;
|
|
155
155
|
}
|
|
156
156
|
// Validate tool_call_sound
|
|
157
157
|
const validToolCallSound = ['typing', 'none'];
|
|
158
158
|
if (!validToolCallSound.includes(cfg.tool_call_sound)) {
|
|
159
159
|
this.log.warn('Voice Agent: invalid tool_feedback.tool_call_sound — feedback config excluded');
|
|
160
|
-
return
|
|
160
|
+
return null;
|
|
161
161
|
}
|
|
162
162
|
// Validate tool_call_sound_behavior
|
|
163
163
|
const validToolCallSoundBehavior = ['always', 'with_pre_speech'];
|
|
164
164
|
if (!validToolCallSoundBehavior.includes(cfg.tool_call_sound_behavior)) {
|
|
165
165
|
this.log.warn('Voice Agent: invalid tool_feedback.tool_call_sound_behavior — feedback config excluded');
|
|
166
|
-
return
|
|
166
|
+
return null;
|
|
167
167
|
}
|
|
168
168
|
// Validate delay_seconds
|
|
169
|
-
const delay = cfg.delay_seconds;
|
|
170
|
-
if (
|
|
169
|
+
const delay = Number(cfg.delay_seconds);
|
|
170
|
+
if (delay <= 0 || delay > 30) {
|
|
171
171
|
this.log.warn('Voice Agent: invalid tool_feedback.delay_seconds — feedback config excluded');
|
|
172
|
-
return
|
|
172
|
+
return null;
|
|
173
173
|
}
|
|
174
174
|
// Validate pre_tool_speech_phrases (only required when mode is 'static')
|
|
175
175
|
const phrases = cfg.pre_tool_speech_phrases;
|
|
@@ -179,7 +179,7 @@ class VoiceAgent extends voice_1.default {
|
|
|
179
179
|
phrases.length > 20 ||
|
|
180
180
|
!phrases.every((p) => typeof p === 'string' && p.trim().length > 0)) {
|
|
181
181
|
this.log.warn('Voice Agent: invalid tool_feedback.pre_tool_speech_phrases — feedback config excluded');
|
|
182
|
-
return
|
|
182
|
+
return null;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
185
185
|
return {
|
|
@@ -218,7 +218,7 @@ class VoiceAgent extends voice_1.default {
|
|
|
218
218
|
const result = {};
|
|
219
219
|
if ('delay_seconds' in raw && raw.delay_seconds != null) {
|
|
220
220
|
const delay = Number(raw.delay_seconds);
|
|
221
|
-
if (
|
|
221
|
+
if (delay <= 0 || delay > 30) {
|
|
222
222
|
this.log.warn(`Voice Agent: invalid feedback.delay_seconds for tool "${toolName}" — per-tool feedback excluded`);
|
|
223
223
|
return null;
|
|
224
224
|
}
|
|
@@ -254,8 +254,8 @@ class VoiceAgent extends voice_1.default {
|
|
|
254
254
|
if (config == null || typeof config !== 'object' || Array.isArray(config))
|
|
255
255
|
return null;
|
|
256
256
|
const cfg = config;
|
|
257
|
-
const timeoutSeconds = cfg.timeout_seconds;
|
|
258
|
-
if (
|
|
257
|
+
const timeoutSeconds = Number(cfg.timeout_seconds);
|
|
258
|
+
if (timeoutSeconds <= 0 || timeoutSeconds > 30) {
|
|
259
259
|
this.log.warn('Voice Agent: invalid soft_timeout.timeout_seconds — soft timeout config excluded');
|
|
260
260
|
return null;
|
|
261
261
|
}
|
|
@@ -296,8 +296,10 @@ class VoiceAgent extends voice_1.default {
|
|
|
296
296
|
return options;
|
|
297
297
|
}
|
|
298
298
|
async exitToThread() {
|
|
299
|
-
|
|
300
|
-
this.thread.
|
|
299
|
+
const result = this.state.result;
|
|
300
|
+
await this.thread.set(`__voiceAgentContext_${this.thread.id}`, result);
|
|
301
|
+
await this.thread.set('__voiceAgentContext', result);
|
|
302
|
+
this.thread.exitStep(this.state.exitStep, result);
|
|
301
303
|
}
|
|
302
304
|
}
|
|
303
305
|
exports.default = VoiceAgent;
|