@fonoster/common 0.8.36 → 0.8.40
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/dist/assistants/assistantSchema.d.ts +17 -12
- package/dist/assistants/conversationSettingsSchema.d.ts +11 -8
- package/dist/assistants/conversationSettingsSchema.js +26 -8
- package/dist/assistants/languageModelConfigSchema.d.ts +4 -4
- package/dist/assistants/languageModelConfigSchema.js +5 -3
- package/dist/constants.d.ts +2 -0
- package/dist/constants.js +3 -1
- package/package.json +3 -3
|
@@ -6,11 +6,12 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
6
6
|
goodbyeMessage: z.ZodString;
|
|
7
7
|
systemErrorMessage: z.ZodString;
|
|
8
8
|
initialDtmf: z.ZodOptional<z.ZodString>;
|
|
9
|
-
|
|
9
|
+
maxSessionDuration: z.ZodDefault<z.ZodNumber>;
|
|
10
|
+
maxSpeechWaitTimeout: z.ZodDefault<z.ZodNumber>;
|
|
10
11
|
transferOptions: z.ZodOptional<z.ZodObject<{
|
|
11
12
|
phoneNumber: z.ZodString;
|
|
12
13
|
message: z.ZodString;
|
|
13
|
-
timeout: z.
|
|
14
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
14
15
|
}, "strip", z.ZodTypeAny, {
|
|
15
16
|
message?: string;
|
|
16
17
|
phoneNumber?: string;
|
|
@@ -20,10 +21,10 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
20
21
|
phoneNumber?: string;
|
|
21
22
|
timeout?: number;
|
|
22
23
|
}>>;
|
|
23
|
-
idleOptions: z.
|
|
24
|
+
idleOptions: z.ZodObject<{
|
|
24
25
|
message: z.ZodString;
|
|
25
|
-
timeout: z.ZodNumber
|
|
26
|
-
maxTimeoutCount: z.ZodNumber
|
|
26
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
27
|
+
maxTimeoutCount: z.ZodDefault<z.ZodNumber>;
|
|
27
28
|
}, "strip", z.ZodTypeAny, {
|
|
28
29
|
message?: string;
|
|
29
30
|
timeout?: number;
|
|
@@ -32,8 +33,8 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
32
33
|
message?: string;
|
|
33
34
|
timeout?: number;
|
|
34
35
|
maxTimeoutCount?: number;
|
|
35
|
-
}
|
|
36
|
-
vad: z.ZodObject<{
|
|
36
|
+
}>;
|
|
37
|
+
vad: z.ZodDefault<z.ZodObject<{
|
|
37
38
|
pathToModel: z.ZodOptional<z.ZodString>;
|
|
38
39
|
activationThreshold: z.ZodNumber;
|
|
39
40
|
deactivationThreshold: z.ZodNumber;
|
|
@@ -48,13 +49,14 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
48
49
|
activationThreshold?: number;
|
|
49
50
|
deactivationThreshold?: number;
|
|
50
51
|
debounceFrames?: number;
|
|
51
|
-
}
|
|
52
|
+
}>>;
|
|
52
53
|
}, "strip", z.ZodTypeAny, {
|
|
53
54
|
firstMessage?: string;
|
|
54
55
|
systemTemplate?: string;
|
|
55
56
|
goodbyeMessage?: string;
|
|
56
57
|
systemErrorMessage?: string;
|
|
57
58
|
initialDtmf?: string;
|
|
59
|
+
maxSessionDuration?: number;
|
|
58
60
|
maxSpeechWaitTimeout?: number;
|
|
59
61
|
transferOptions?: {
|
|
60
62
|
message?: string;
|
|
@@ -78,6 +80,7 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
78
80
|
goodbyeMessage?: string;
|
|
79
81
|
systemErrorMessage?: string;
|
|
80
82
|
initialDtmf?: string;
|
|
83
|
+
maxSessionDuration?: number;
|
|
81
84
|
maxSpeechWaitTimeout?: number;
|
|
82
85
|
transferOptions?: {
|
|
83
86
|
message?: string;
|
|
@@ -103,7 +106,7 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
103
106
|
temperature: z.ZodNumber;
|
|
104
107
|
maxTokens: z.ZodNumber;
|
|
105
108
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
106
|
-
knowledgeBase: z.ZodArray<z.ZodObject<{
|
|
109
|
+
knowledgeBase: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
107
110
|
type: z.ZodEnum<["s3"]>;
|
|
108
111
|
title: z.ZodString;
|
|
109
112
|
document: z.ZodString;
|
|
@@ -115,8 +118,8 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
115
118
|
type?: "s3";
|
|
116
119
|
title?: string;
|
|
117
120
|
document?: string;
|
|
118
|
-
}>, "many"
|
|
119
|
-
tools: z.ZodArray<z.ZodObject<{
|
|
121
|
+
}>, "many">>;
|
|
122
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
120
123
|
name: z.ZodString;
|
|
121
124
|
description: z.ZodString;
|
|
122
125
|
parameters: z.ZodObject<{
|
|
@@ -225,7 +228,7 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
225
228
|
waitForResponse?: boolean;
|
|
226
229
|
headers?: Record<string, string>;
|
|
227
230
|
};
|
|
228
|
-
}>, "many"
|
|
231
|
+
}>, "many">>;
|
|
229
232
|
}, "strip", z.ZodTypeAny, {
|
|
230
233
|
provider?: import("./LanguageModelProvider").LanguageModelProvider;
|
|
231
234
|
apiKey?: string;
|
|
@@ -298,6 +301,7 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
298
301
|
goodbyeMessage?: string;
|
|
299
302
|
systemErrorMessage?: string;
|
|
300
303
|
initialDtmf?: string;
|
|
304
|
+
maxSessionDuration?: number;
|
|
301
305
|
maxSpeechWaitTimeout?: number;
|
|
302
306
|
transferOptions?: {
|
|
303
307
|
message?: string;
|
|
@@ -356,6 +360,7 @@ declare const assistantSchema: z.ZodObject<{
|
|
|
356
360
|
goodbyeMessage?: string;
|
|
357
361
|
systemErrorMessage?: string;
|
|
358
362
|
initialDtmf?: string;
|
|
363
|
+
maxSessionDuration?: number;
|
|
359
364
|
maxSpeechWaitTimeout?: number;
|
|
360
365
|
transferOptions?: {
|
|
361
366
|
message?: string;
|
|
@@ -5,11 +5,12 @@ declare const conversationSettingsSchema: z.ZodObject<{
|
|
|
5
5
|
goodbyeMessage: z.ZodString;
|
|
6
6
|
systemErrorMessage: z.ZodString;
|
|
7
7
|
initialDtmf: z.ZodOptional<z.ZodString>;
|
|
8
|
-
|
|
8
|
+
maxSessionDuration: z.ZodDefault<z.ZodNumber>;
|
|
9
|
+
maxSpeechWaitTimeout: z.ZodDefault<z.ZodNumber>;
|
|
9
10
|
transferOptions: z.ZodOptional<z.ZodObject<{
|
|
10
11
|
phoneNumber: z.ZodString;
|
|
11
12
|
message: z.ZodString;
|
|
12
|
-
timeout: z.
|
|
13
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
13
14
|
}, "strip", z.ZodTypeAny, {
|
|
14
15
|
message?: string;
|
|
15
16
|
phoneNumber?: string;
|
|
@@ -19,10 +20,10 @@ declare const conversationSettingsSchema: z.ZodObject<{
|
|
|
19
20
|
phoneNumber?: string;
|
|
20
21
|
timeout?: number;
|
|
21
22
|
}>>;
|
|
22
|
-
idleOptions: z.
|
|
23
|
+
idleOptions: z.ZodObject<{
|
|
23
24
|
message: z.ZodString;
|
|
24
|
-
timeout: z.ZodNumber
|
|
25
|
-
maxTimeoutCount: z.ZodNumber
|
|
25
|
+
timeout: z.ZodDefault<z.ZodNumber>;
|
|
26
|
+
maxTimeoutCount: z.ZodDefault<z.ZodNumber>;
|
|
26
27
|
}, "strip", z.ZodTypeAny, {
|
|
27
28
|
message?: string;
|
|
28
29
|
timeout?: number;
|
|
@@ -31,8 +32,8 @@ declare const conversationSettingsSchema: z.ZodObject<{
|
|
|
31
32
|
message?: string;
|
|
32
33
|
timeout?: number;
|
|
33
34
|
maxTimeoutCount?: number;
|
|
34
|
-
}
|
|
35
|
-
vad: z.ZodObject<{
|
|
35
|
+
}>;
|
|
36
|
+
vad: z.ZodDefault<z.ZodObject<{
|
|
36
37
|
pathToModel: z.ZodOptional<z.ZodString>;
|
|
37
38
|
activationThreshold: z.ZodNumber;
|
|
38
39
|
deactivationThreshold: z.ZodNumber;
|
|
@@ -47,13 +48,14 @@ declare const conversationSettingsSchema: z.ZodObject<{
|
|
|
47
48
|
activationThreshold?: number;
|
|
48
49
|
deactivationThreshold?: number;
|
|
49
50
|
debounceFrames?: number;
|
|
50
|
-
}
|
|
51
|
+
}>>;
|
|
51
52
|
}, "strip", z.ZodTypeAny, {
|
|
52
53
|
firstMessage?: string;
|
|
53
54
|
systemTemplate?: string;
|
|
54
55
|
goodbyeMessage?: string;
|
|
55
56
|
systemErrorMessage?: string;
|
|
56
57
|
initialDtmf?: string;
|
|
58
|
+
maxSessionDuration?: number;
|
|
57
59
|
maxSpeechWaitTimeout?: number;
|
|
58
60
|
transferOptions?: {
|
|
59
61
|
message?: string;
|
|
@@ -77,6 +79,7 @@ declare const conversationSettingsSchema: z.ZodObject<{
|
|
|
77
79
|
goodbyeMessage?: string;
|
|
78
80
|
systemErrorMessage?: string;
|
|
79
81
|
initialDtmf?: string;
|
|
82
|
+
maxSessionDuration?: number;
|
|
80
83
|
maxSpeechWaitTimeout?: number;
|
|
81
84
|
transferOptions?: {
|
|
82
85
|
message?: string;
|
|
@@ -55,6 +55,12 @@ exports.conversationSettingsSchema = void 0;
|
|
|
55
55
|
const zod_1 = require("zod");
|
|
56
56
|
const Messages = __importStar(require("../messages"));
|
|
57
57
|
const NUMBER_BETWEEN_0_AND_1 = "Must be a number between 0 and 1";
|
|
58
|
+
const MAX_SPEECH_WAIT_TIMEOUT = 5000;
|
|
59
|
+
const IDLE_OPTIONS_TIMEOUT = 10000;
|
|
60
|
+
const IDLE_OPTIONS_MAX_TIMEOUT_COUNT = 3;
|
|
61
|
+
const VAD_ACTIVATION_THRESHOLD = 0.3;
|
|
62
|
+
const VAD_DEACTIVATION_THRESHOLD = 0.25;
|
|
63
|
+
const VAD_DEBOUNCE_FRAMES = 3;
|
|
58
64
|
const conversationSettingsSchema = zod_1.z.object({
|
|
59
65
|
firstMessage: zod_1.z.string().optional(),
|
|
60
66
|
systemTemplate: zod_1.z.string(),
|
|
@@ -64,10 +70,16 @@ const conversationSettingsSchema = zod_1.z.object({
|
|
|
64
70
|
.string()
|
|
65
71
|
.regex(/^[0-9*#]+$/, { message: Messages.VALID_DTMF })
|
|
66
72
|
.optional(),
|
|
73
|
+
maxSessionDuration: zod_1.z
|
|
74
|
+
.number()
|
|
75
|
+
.int()
|
|
76
|
+
.positive()
|
|
77
|
+
.default(30 * 60 * 1000), // 30 minutes
|
|
67
78
|
maxSpeechWaitTimeout: zod_1.z
|
|
68
79
|
.number()
|
|
69
80
|
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
70
|
-
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
81
|
+
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
82
|
+
.default(MAX_SPEECH_WAIT_TIMEOUT),
|
|
71
83
|
transferOptions: zod_1.z
|
|
72
84
|
.object({
|
|
73
85
|
phoneNumber: zod_1.z.string(),
|
|
@@ -76,23 +88,24 @@ const conversationSettingsSchema = zod_1.z.object({
|
|
|
76
88
|
.number()
|
|
77
89
|
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
78
90
|
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
79
|
-
.
|
|
91
|
+
.default(30000)
|
|
80
92
|
})
|
|
81
93
|
.optional(),
|
|
82
|
-
idleOptions: zod_1.z
|
|
83
|
-
.object({
|
|
94
|
+
idleOptions: zod_1.z.object({
|
|
84
95
|
message: zod_1.z.string(),
|
|
85
96
|
timeout: zod_1.z
|
|
86
97
|
.number()
|
|
87
98
|
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
88
|
-
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
99
|
+
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
100
|
+
.default(IDLE_OPTIONS_TIMEOUT),
|
|
89
101
|
maxTimeoutCount: zod_1.z
|
|
90
102
|
.number()
|
|
91
103
|
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
92
104
|
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
vad: zod_1.z
|
|
105
|
+
.default(IDLE_OPTIONS_MAX_TIMEOUT_COUNT)
|
|
106
|
+
}),
|
|
107
|
+
vad: zod_1.z
|
|
108
|
+
.object({
|
|
96
109
|
pathToModel: zod_1.z.string().optional(),
|
|
97
110
|
activationThreshold: zod_1.z
|
|
98
111
|
.number()
|
|
@@ -109,5 +122,10 @@ const conversationSettingsSchema = zod_1.z.object({
|
|
|
109
122
|
.int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
110
123
|
.positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
|
|
111
124
|
})
|
|
125
|
+
.default({
|
|
126
|
+
activationThreshold: VAD_ACTIVATION_THRESHOLD,
|
|
127
|
+
deactivationThreshold: VAD_DEACTIVATION_THRESHOLD,
|
|
128
|
+
debounceFrames: VAD_DEBOUNCE_FRAMES
|
|
129
|
+
})
|
|
112
130
|
});
|
|
113
131
|
exports.conversationSettingsSchema = conversationSettingsSchema;
|
|
@@ -7,7 +7,7 @@ declare const languageModelConfigSchema: z.ZodObject<{
|
|
|
7
7
|
temperature: z.ZodNumber;
|
|
8
8
|
maxTokens: z.ZodNumber;
|
|
9
9
|
baseUrl: z.ZodOptional<z.ZodString>;
|
|
10
|
-
knowledgeBase: z.ZodArray<z.ZodObject<{
|
|
10
|
+
knowledgeBase: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
11
11
|
type: z.ZodEnum<["s3"]>;
|
|
12
12
|
title: z.ZodString;
|
|
13
13
|
document: z.ZodString;
|
|
@@ -19,8 +19,8 @@ declare const languageModelConfigSchema: z.ZodObject<{
|
|
|
19
19
|
type?: "s3";
|
|
20
20
|
title?: string;
|
|
21
21
|
document?: string;
|
|
22
|
-
}>, "many"
|
|
23
|
-
tools: z.ZodArray<z.ZodObject<{
|
|
22
|
+
}>, "many">>;
|
|
23
|
+
tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
24
24
|
name: z.ZodString;
|
|
25
25
|
description: z.ZodString;
|
|
26
26
|
parameters: z.ZodObject<{
|
|
@@ -129,7 +129,7 @@ declare const languageModelConfigSchema: z.ZodObject<{
|
|
|
129
129
|
waitForResponse?: boolean;
|
|
130
130
|
headers?: Record<string, string>;
|
|
131
131
|
};
|
|
132
|
-
}>, "many"
|
|
132
|
+
}>, "many">>;
|
|
133
133
|
}, "strip", z.ZodTypeAny, {
|
|
134
134
|
provider?: LanguageModelProvider;
|
|
135
135
|
apiKey?: string;
|
|
@@ -77,13 +77,15 @@ const languageModelConfigSchema = zod_1.z.object({
|
|
|
77
77
|
message: Messages.VALID_URL
|
|
78
78
|
})
|
|
79
79
|
.optional(),
|
|
80
|
-
knowledgeBase: zod_1.z
|
|
80
|
+
knowledgeBase: zod_1.z
|
|
81
|
+
.array(zod_1.z.object({
|
|
81
82
|
type: zod_1.z.enum(["s3"]),
|
|
82
83
|
title: zod_1.z.string(),
|
|
83
84
|
document: zod_1.z.string().regex(/\.pdf$/, {
|
|
84
85
|
message: "Document must be a pdf file"
|
|
85
86
|
})
|
|
86
|
-
}))
|
|
87
|
-
|
|
87
|
+
}))
|
|
88
|
+
.default([]),
|
|
89
|
+
tools: zod_1.z.array(tools_1.toolSchema).default([])
|
|
88
90
|
});
|
|
89
91
|
exports.languageModelConfigSchema = languageModelConfigSchema;
|
package/dist/constants.d.ts
CHANGED
|
@@ -4,3 +4,5 @@ export declare const GRPC_SERVING_STATUS: ServingStatus;
|
|
|
4
4
|
export declare const STASIS_APP_NAME = "mediacontroller";
|
|
5
5
|
export declare const CALL_DETAIL_RECORD_MEASUREMENT = "cdr";
|
|
6
6
|
export declare const INFLUXDB_CALLS_BUCKET = "calls";
|
|
7
|
+
export declare const APP_REF_HEADER = "x-app-ref";
|
|
8
|
+
export declare const ROUTR_DEFAULT_PEER_AOR = "sip:voice@default";
|
package/dist/constants.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.INFLUXDB_CALLS_BUCKET = exports.CALL_DETAIL_RECORD_MEASUREMENT = exports.STASIS_APP_NAME = exports.GRPC_SERVING_STATUS = exports.GRPC_NOT_SERVING_STATUS = void 0;
|
|
3
|
+
exports.ROUTR_DEFAULT_PEER_AOR = exports.APP_REF_HEADER = exports.INFLUXDB_CALLS_BUCKET = exports.CALL_DETAIL_RECORD_MEASUREMENT = exports.STASIS_APP_NAME = exports.GRPC_SERVING_STATUS = exports.GRPC_NOT_SERVING_STATUS = void 0;
|
|
4
4
|
exports.GRPC_NOT_SERVING_STATUS = "NOT_SERVING";
|
|
5
5
|
exports.GRPC_SERVING_STATUS = "SERVING";
|
|
6
6
|
exports.STASIS_APP_NAME = "mediacontroller";
|
|
7
7
|
exports.CALL_DETAIL_RECORD_MEASUREMENT = "cdr";
|
|
8
8
|
exports.INFLUXDB_CALLS_BUCKET = "calls";
|
|
9
|
+
exports.APP_REF_HEADER = "x-app-ref";
|
|
10
|
+
exports.ROUTR_DEFAULT_PEER_AOR = "sip:voice@default";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fonoster/common",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.40",
|
|
4
4
|
"description": "Common library for Fonoster projects",
|
|
5
5
|
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
6
|
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@fonoster/logger": "^0.8.
|
|
21
|
+
"@fonoster/logger": "^0.8.40",
|
|
22
22
|
"@grpc/grpc-js": "~1.10.6",
|
|
23
23
|
"@grpc/proto-loader": "^0.7.12",
|
|
24
24
|
"@influxdata/influxdb-client": "^1.35.0",
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@types/nodemailer": "^6.4.14"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "2bbf3dadb6e1e178c4eefdeb4291a2e05eef0f2b"
|
|
52
52
|
}
|