@fonoster/common 0.8.35 → 0.8.39

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.
@@ -6,11 +6,11 @@ declare const assistantSchema: z.ZodObject<{
6
6
  goodbyeMessage: z.ZodString;
7
7
  systemErrorMessage: z.ZodString;
8
8
  initialDtmf: z.ZodOptional<z.ZodString>;
9
- maxSpeechWaitTimeout: z.ZodNumber;
9
+ maxSpeechWaitTimeout: z.ZodDefault<z.ZodNumber>;
10
10
  transferOptions: z.ZodOptional<z.ZodObject<{
11
11
  phoneNumber: z.ZodString;
12
12
  message: z.ZodString;
13
- timeout: z.ZodOptional<z.ZodNumber>;
13
+ timeout: z.ZodDefault<z.ZodNumber>;
14
14
  }, "strip", z.ZodTypeAny, {
15
15
  message?: string;
16
16
  phoneNumber?: string;
@@ -20,10 +20,10 @@ declare const assistantSchema: z.ZodObject<{
20
20
  phoneNumber?: string;
21
21
  timeout?: number;
22
22
  }>>;
23
- idleOptions: z.ZodOptional<z.ZodObject<{
23
+ idleOptions: z.ZodObject<{
24
24
  message: z.ZodString;
25
- timeout: z.ZodNumber;
26
- maxTimeoutCount: z.ZodNumber;
25
+ timeout: z.ZodDefault<z.ZodNumber>;
26
+ maxTimeoutCount: z.ZodDefault<z.ZodNumber>;
27
27
  }, "strip", z.ZodTypeAny, {
28
28
  message?: string;
29
29
  timeout?: number;
@@ -32,8 +32,8 @@ declare const assistantSchema: z.ZodObject<{
32
32
  message?: string;
33
33
  timeout?: number;
34
34
  maxTimeoutCount?: number;
35
- }>>;
36
- vad: z.ZodObject<{
35
+ }>;
36
+ vad: z.ZodDefault<z.ZodObject<{
37
37
  pathToModel: z.ZodOptional<z.ZodString>;
38
38
  activationThreshold: z.ZodNumber;
39
39
  deactivationThreshold: z.ZodNumber;
@@ -48,7 +48,7 @@ declare const assistantSchema: z.ZodObject<{
48
48
  activationThreshold?: number;
49
49
  deactivationThreshold?: number;
50
50
  debounceFrames?: number;
51
- }>;
51
+ }>>;
52
52
  }, "strip", z.ZodTypeAny, {
53
53
  firstMessage?: string;
54
54
  systemTemplate?: string;
@@ -103,7 +103,7 @@ declare const assistantSchema: z.ZodObject<{
103
103
  temperature: z.ZodNumber;
104
104
  maxTokens: z.ZodNumber;
105
105
  baseUrl: z.ZodOptional<z.ZodString>;
106
- knowledgeBase: z.ZodArray<z.ZodObject<{
106
+ knowledgeBase: z.ZodDefault<z.ZodArray<z.ZodObject<{
107
107
  type: z.ZodEnum<["s3"]>;
108
108
  title: z.ZodString;
109
109
  document: z.ZodString;
@@ -115,8 +115,8 @@ declare const assistantSchema: z.ZodObject<{
115
115
  type?: "s3";
116
116
  title?: string;
117
117
  document?: string;
118
- }>, "many">;
119
- tools: z.ZodArray<z.ZodObject<{
118
+ }>, "many">>;
119
+ tools: z.ZodDefault<z.ZodArray<z.ZodObject<{
120
120
  name: z.ZodString;
121
121
  description: z.ZodString;
122
122
  parameters: z.ZodObject<{
@@ -225,7 +225,7 @@ declare const assistantSchema: z.ZodObject<{
225
225
  waitForResponse?: boolean;
226
226
  headers?: Record<string, string>;
227
227
  };
228
- }>, "many">;
228
+ }>, "many">>;
229
229
  }, "strip", z.ZodTypeAny, {
230
230
  provider?: import("./LanguageModelProvider").LanguageModelProvider;
231
231
  apiKey?: string;
@@ -5,11 +5,11 @@ declare const conversationSettingsSchema: z.ZodObject<{
5
5
  goodbyeMessage: z.ZodString;
6
6
  systemErrorMessage: z.ZodString;
7
7
  initialDtmf: z.ZodOptional<z.ZodString>;
8
- maxSpeechWaitTimeout: z.ZodNumber;
8
+ maxSpeechWaitTimeout: z.ZodDefault<z.ZodNumber>;
9
9
  transferOptions: z.ZodOptional<z.ZodObject<{
10
10
  phoneNumber: z.ZodString;
11
11
  message: z.ZodString;
12
- timeout: z.ZodOptional<z.ZodNumber>;
12
+ timeout: z.ZodDefault<z.ZodNumber>;
13
13
  }, "strip", z.ZodTypeAny, {
14
14
  message?: string;
15
15
  phoneNumber?: string;
@@ -19,10 +19,10 @@ declare const conversationSettingsSchema: z.ZodObject<{
19
19
  phoneNumber?: string;
20
20
  timeout?: number;
21
21
  }>>;
22
- idleOptions: z.ZodOptional<z.ZodObject<{
22
+ idleOptions: z.ZodObject<{
23
23
  message: z.ZodString;
24
- timeout: z.ZodNumber;
25
- maxTimeoutCount: z.ZodNumber;
24
+ timeout: z.ZodDefault<z.ZodNumber>;
25
+ maxTimeoutCount: z.ZodDefault<z.ZodNumber>;
26
26
  }, "strip", z.ZodTypeAny, {
27
27
  message?: string;
28
28
  timeout?: number;
@@ -31,8 +31,8 @@ declare const conversationSettingsSchema: z.ZodObject<{
31
31
  message?: string;
32
32
  timeout?: number;
33
33
  maxTimeoutCount?: number;
34
- }>>;
35
- vad: z.ZodObject<{
34
+ }>;
35
+ vad: z.ZodDefault<z.ZodObject<{
36
36
  pathToModel: z.ZodOptional<z.ZodString>;
37
37
  activationThreshold: z.ZodNumber;
38
38
  deactivationThreshold: z.ZodNumber;
@@ -47,7 +47,7 @@ declare const conversationSettingsSchema: z.ZodObject<{
47
47
  activationThreshold?: number;
48
48
  deactivationThreshold?: number;
49
49
  debounceFrames?: number;
50
- }>;
50
+ }>>;
51
51
  }, "strip", z.ZodTypeAny, {
52
52
  firstMessage?: string;
53
53
  systemTemplate?: 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 = 10000;
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.15;
63
+ const VAD_DEBOUNCE_FRAMES = 1;
58
64
  const conversationSettingsSchema = zod_1.z.object({
59
65
  firstMessage: zod_1.z.string().optional(),
60
66
  systemTemplate: zod_1.z.string(),
@@ -67,7 +73,8 @@ const conversationSettingsSchema = zod_1.z.object({
67
73
  maxSpeechWaitTimeout: zod_1.z
68
74
  .number()
69
75
  .int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
70
- .positive({ message: Messages.POSITIVE_INTEGER_MESSAGE }),
76
+ .positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
77
+ .default(MAX_SPEECH_WAIT_TIMEOUT),
71
78
  transferOptions: zod_1.z
72
79
  .object({
73
80
  phoneNumber: zod_1.z.string(),
@@ -76,23 +83,24 @@ const conversationSettingsSchema = zod_1.z.object({
76
83
  .number()
77
84
  .int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
78
85
  .positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
79
- .optional()
86
+ .default(30000)
80
87
  })
81
88
  .optional(),
82
- idleOptions: zod_1.z
83
- .object({
89
+ idleOptions: zod_1.z.object({
84
90
  message: zod_1.z.string(),
85
91
  timeout: zod_1.z
86
92
  .number()
87
93
  .int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
88
- .positive({ message: Messages.POSITIVE_INTEGER_MESSAGE }),
94
+ .positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
95
+ .default(IDLE_OPTIONS_TIMEOUT),
89
96
  maxTimeoutCount: zod_1.z
90
97
  .number()
91
98
  .int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
92
99
  .positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
93
- })
94
- .optional(),
95
- vad: zod_1.z.object({
100
+ .default(IDLE_OPTIONS_MAX_TIMEOUT_COUNT)
101
+ }),
102
+ vad: zod_1.z
103
+ .object({
96
104
  pathToModel: zod_1.z.string().optional(),
97
105
  activationThreshold: zod_1.z
98
106
  .number()
@@ -109,5 +117,10 @@ const conversationSettingsSchema = zod_1.z.object({
109
117
  .int({ message: Messages.POSITIVE_INTEGER_MESSAGE })
110
118
  .positive({ message: Messages.POSITIVE_INTEGER_MESSAGE })
111
119
  })
120
+ .default({
121
+ activationThreshold: VAD_ACTIVATION_THRESHOLD,
122
+ deactivationThreshold: VAD_DEACTIVATION_THRESHOLD,
123
+ debounceFrames: VAD_DEBOUNCE_FRAMES
124
+ })
112
125
  });
113
126
  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.array(zod_1.z.object({
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
- tools: zod_1.z.array(tools_1.toolSchema)
87
+ }))
88
+ .default([]),
89
+ tools: zod_1.z.array(tools_1.toolSchema).default([])
88
90
  });
89
91
  exports.languageModelConfigSchema = languageModelConfigSchema;
@@ -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.35",
3
+ "version": "0.8.39",
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.35",
21
+ "@fonoster/logger": "^0.8.39",
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": "b5a5d5ec17d46817140f0ccb4ba29eac63ad9780"
51
+ "gitHead": "3ba2a5330d268f5be03fd9d5bbd22aeeb264fa61"
52
52
  }