@onereach/step-voice 7.0.41-tooltimeoutresponsemode.2 → 7.0.41
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/Update Voice Agent.d.ts +0 -5
- package/dst/Update Voice Agent.js +1 -30
- package/dst/Voice Agent.d.ts +0 -5
- package/dst/Voice Agent.js +12 -33
- package/package.json +1 -1
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import VoiceStep from './voice';
|
|
2
2
|
type SystemInstructionMode = 'append' | 'replace' | 'off';
|
|
3
|
-
type ToolResponseMode = 'sync' | 'async' | 'none';
|
|
4
3
|
interface Tool {
|
|
5
4
|
name: string;
|
|
6
5
|
description: string;
|
|
7
6
|
parameters: string | Record<string, unknown>;
|
|
8
7
|
exitId?: string;
|
|
9
|
-
timeout_seconds?: number | string | null;
|
|
10
|
-
response_mode?: ToolResponseMode | string | null;
|
|
11
8
|
}
|
|
12
9
|
interface AgentServiceConfig {
|
|
13
10
|
provider: string;
|
|
@@ -41,7 +38,5 @@ export default class UpdateVoiceAgent extends VoiceStep<Partial<INPUT>> {
|
|
|
41
38
|
private buildOptionalServiceOverride;
|
|
42
39
|
private parseAgentServiceOptions;
|
|
43
40
|
private isStepFlagEnabled;
|
|
44
|
-
private validateToolTimeout;
|
|
45
|
-
private validateToolResponseMode;
|
|
46
41
|
}
|
|
47
42
|
export {};
|
|
@@ -139,21 +139,12 @@ class UpdateVoiceAgent extends voice_1.default {
|
|
|
139
139
|
else if (t.parameters && typeof t.parameters === 'object') {
|
|
140
140
|
parameters = t.parameters;
|
|
141
141
|
}
|
|
142
|
-
|
|
142
|
+
return {
|
|
143
143
|
type: 'function',
|
|
144
144
|
name: lodash_1.default.trim(t.name),
|
|
145
145
|
description: t.description || '',
|
|
146
146
|
parameters,
|
|
147
147
|
};
|
|
148
|
-
const validatedTimeout = this.validateToolTimeout(t.timeout_seconds, t.name);
|
|
149
|
-
if (validatedTimeout != null) {
|
|
150
|
-
tool.timeout_seconds = validatedTimeout;
|
|
151
|
-
}
|
|
152
|
-
const validatedResponseMode = this.validateToolResponseMode(t.response_mode, t.name);
|
|
153
|
-
if (validatedResponseMode != null) {
|
|
154
|
-
tool.response_mode = validatedResponseMode;
|
|
155
|
-
}
|
|
156
|
-
return tool;
|
|
157
148
|
});
|
|
158
149
|
}
|
|
159
150
|
buildOptionalServiceOverride(label, service) {
|
|
@@ -191,25 +182,5 @@ class UpdateVoiceAgent extends voice_1.default {
|
|
|
191
182
|
isStepFlagEnabled(value) {
|
|
192
183
|
return value === true || value === 'true' || value === 1 || value === '1';
|
|
193
184
|
}
|
|
194
|
-
validateToolTimeout(value, toolName) {
|
|
195
|
-
if (value == null || value === '')
|
|
196
|
-
return null;
|
|
197
|
-
const timeout = Number(value);
|
|
198
|
-
if (!Number.isFinite(timeout) || timeout < 1 || timeout > 300) {
|
|
199
|
-
this.log.warn(`Update Voice Agent: invalid timeout_seconds for tool "${toolName}" (must be 1–300) — excluded`);
|
|
200
|
-
return null;
|
|
201
|
-
}
|
|
202
|
-
return timeout;
|
|
203
|
-
}
|
|
204
|
-
validateToolResponseMode(value, toolName) {
|
|
205
|
-
if (value == null || value === '')
|
|
206
|
-
return null;
|
|
207
|
-
const valid = ['sync', 'async', 'none'];
|
|
208
|
-
if (!valid.includes(value)) {
|
|
209
|
-
this.log.warn(`Update Voice Agent: invalid response_mode for tool "${toolName}" (must be sync/async/none) — excluded`);
|
|
210
|
-
return null;
|
|
211
|
-
}
|
|
212
|
-
return value;
|
|
213
|
-
}
|
|
214
185
|
}
|
|
215
186
|
exports.default = UpdateVoiceAgent;
|
package/dst/Voice Agent.d.ts
CHANGED
|
@@ -24,14 +24,11 @@ interface SoftTimeoutConfig {
|
|
|
24
24
|
phrases: string[];
|
|
25
25
|
mode: SoftTimeoutMode;
|
|
26
26
|
}
|
|
27
|
-
type ToolResponseMode = 'sync' | 'async' | 'none';
|
|
28
27
|
interface Handler {
|
|
29
28
|
name: string;
|
|
30
29
|
description: string;
|
|
31
30
|
parameters: string;
|
|
32
31
|
feedback?: PerToolConfig;
|
|
33
|
-
timeout_seconds?: number | string | null;
|
|
34
|
-
response_mode?: ToolResponseMode | string | null;
|
|
35
32
|
}
|
|
36
33
|
interface AgentSystemToolConfig {
|
|
37
34
|
name: string;
|
|
@@ -85,8 +82,6 @@ export default class VoiceAgent extends VoiceStep<Partial<INPUT>> {
|
|
|
85
82
|
private validateSoftTimeout;
|
|
86
83
|
private validateSystemTools;
|
|
87
84
|
private parseAgentServiceOptions;
|
|
88
|
-
private validateToolTimeout;
|
|
89
|
-
private validateToolResponseMode;
|
|
90
85
|
exitToThread(): Promise<void>;
|
|
91
86
|
}
|
|
92
87
|
export {};
|
package/dst/Voice Agent.js
CHANGED
|
@@ -78,14 +78,6 @@ class VoiceAgent extends voice_1.default {
|
|
|
78
78
|
tool.feedback = validatedFeedback;
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
const validatedTimeout = this.validateToolTimeout(h.timeout_seconds, h.name);
|
|
82
|
-
if (validatedTimeout != null) {
|
|
83
|
-
tool.timeout_seconds = validatedTimeout;
|
|
84
|
-
}
|
|
85
|
-
const validatedResponseMode = this.validateToolResponseMode(h.response_mode, h.name);
|
|
86
|
-
if (validatedResponseMode != null) {
|
|
87
|
-
tool.response_mode = validatedResponseMode;
|
|
88
|
-
}
|
|
89
81
|
return tool;
|
|
90
82
|
});
|
|
91
83
|
const config = {
|
|
@@ -292,11 +284,19 @@ class VoiceAgent extends voice_1.default {
|
|
|
292
284
|
return null;
|
|
293
285
|
}
|
|
294
286
|
const validModes = ['static', 'auto'];
|
|
295
|
-
|
|
287
|
+
const mode = cfg.mode;
|
|
288
|
+
const result = {
|
|
289
|
+
timeout_seconds: timeoutSeconds,
|
|
290
|
+
phrases: [],
|
|
291
|
+
mode
|
|
292
|
+
};
|
|
293
|
+
if (!validModes.includes(mode)) {
|
|
296
294
|
this.log.warn('Voice Agent: invalid soft_timeout.mode — soft timeout config excluded');
|
|
297
295
|
return null;
|
|
298
296
|
}
|
|
299
|
-
|
|
297
|
+
if (mode === 'auto') {
|
|
298
|
+
return result;
|
|
299
|
+
}
|
|
300
300
|
const phrases = cfg.phrases;
|
|
301
301
|
if (!Array.isArray(phrases) ||
|
|
302
302
|
phrases.length < 1 ||
|
|
@@ -306,9 +306,8 @@ class VoiceAgent extends voice_1.default {
|
|
|
306
306
|
return null;
|
|
307
307
|
}
|
|
308
308
|
return {
|
|
309
|
-
|
|
310
|
-
phrases: phrases
|
|
311
|
-
mode: cfg.mode
|
|
309
|
+
...result,
|
|
310
|
+
phrases: phrases
|
|
312
311
|
};
|
|
313
312
|
}
|
|
314
313
|
validateSystemTools(systemTools) {
|
|
@@ -339,26 +338,6 @@ class VoiceAgent extends voice_1.default {
|
|
|
339
338
|
}
|
|
340
339
|
return options;
|
|
341
340
|
}
|
|
342
|
-
validateToolTimeout(value, toolName) {
|
|
343
|
-
if (value == null || value === '')
|
|
344
|
-
return null;
|
|
345
|
-
const timeout = Number(value);
|
|
346
|
-
if (!Number.isFinite(timeout) || timeout < 1 || timeout > 300) {
|
|
347
|
-
this.log.warn(`Voice Agent: invalid timeout_seconds for tool "${toolName}" (must be 1–300) — excluded`);
|
|
348
|
-
return null;
|
|
349
|
-
}
|
|
350
|
-
return timeout;
|
|
351
|
-
}
|
|
352
|
-
validateToolResponseMode(value, toolName) {
|
|
353
|
-
if (value == null || value === '')
|
|
354
|
-
return null;
|
|
355
|
-
const valid = ['sync', 'async', 'none'];
|
|
356
|
-
if (!valid.includes(value)) {
|
|
357
|
-
this.log.warn(`Voice Agent: invalid response_mode for tool "${toolName}" (must be sync/async/none) — excluded`);
|
|
358
|
-
return null;
|
|
359
|
-
}
|
|
360
|
-
return value;
|
|
361
|
-
}
|
|
362
341
|
async exitToThread() {
|
|
363
342
|
const result = this.state.result;
|
|
364
343
|
await this.thread.set(`__voiceAgentContext_${this.thread.id}`, result);
|