@qcobro/common 1.24.0 → 1.27.0
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/config.d.ts +2 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +12 -2
- package/dist/config.js.map +1 -1
- package/dist/schemas/agentEvaluations.d.ts +619 -0
- package/dist/schemas/agentEvaluations.d.ts.map +1 -0
- package/dist/schemas/agentEvaluations.js +124 -0
- package/dist/schemas/agentEvaluations.js.map +1 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +2 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/phone.d.ts +7 -0
- package/dist/schemas/phone.d.ts.map +1 -0
- package/dist/schemas/phone.js +6 -0
- package/dist/schemas/phone.js.map +1 -0
- package/dist/types/agentEvaluations.d.ts +93 -0
- package/dist/types/agentEvaluations.d.ts.map +1 -0
- package/dist/types/agentEvaluations.js +2 -0
- package/dist/types/agentEvaluations.js.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +1 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/voiceApplication.d.ts +65 -0
- package/dist/types/voiceApplication.d.ts.map +1 -1
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +1 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/validatePhone.d.ts +15 -0
- package/dist/utils/validatePhone.d.ts.map +1 -0
- package/dist/utils/validatePhone.js +34 -0
- package/dist/utils/validatePhone.js.map +1 -0
- package/package.json +1 -1
package/dist/config.d.ts
CHANGED
|
@@ -49,6 +49,7 @@ export declare const fonosterConfigSchema: z.ZodOptional<z.ZodObject<{
|
|
|
49
49
|
llmModel: z.ZodDefault<z.ZodString>;
|
|
50
50
|
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
51
51
|
temperature: z.ZodDefault<z.ZodNumber>;
|
|
52
|
+
evalsModel: z.ZodDefault<z.ZodString>;
|
|
52
53
|
}, z.core.$strip>>;
|
|
53
54
|
voices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
54
55
|
id: z.ZodString;
|
|
@@ -310,6 +311,7 @@ export declare const qcobroConfigSchema: z.ZodObject<{
|
|
|
310
311
|
llmModel: z.ZodDefault<z.ZodString>;
|
|
311
312
|
maxTokens: z.ZodDefault<z.ZodNumber>;
|
|
312
313
|
temperature: z.ZodDefault<z.ZodNumber>;
|
|
314
|
+
evalsModel: z.ZodDefault<z.ZodString>;
|
|
313
315
|
}, z.core.$strip>>;
|
|
314
316
|
voices: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
315
317
|
id: z.ZodString;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB;;;iBAK/B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;iBAMlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAExE;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;GAUG;AACH,eAAO,MAAM,oBAAoB;;;iBAK/B,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;iBAMlC,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB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AC;AAEpE;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;kBAcxB,CAAC;AAEd,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAE1E;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAO5B,CAAC;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE5D;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAkCnB,CAAC;AACd,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4F7B,CAAC;AAEH,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -53,7 +53,16 @@ export const fonosterConfigSchema = z
|
|
|
53
53
|
llmProvider: z.string().default("google"),
|
|
54
54
|
llmModel: z.string().default("gemini-2.0-flash"),
|
|
55
55
|
maxTokens: z.number().default(300),
|
|
56
|
-
temperature: z.number().default(0)
|
|
56
|
+
temperature: z.number().default(0),
|
|
57
|
+
/**
|
|
58
|
+
* Model for Fonoster's `evaluateIntelligence` judge (`testCases.evalsLanguageModel`) —
|
|
59
|
+
* a required field on every VOICE_AI eval request, always `provider: "openai"` (the only
|
|
60
|
+
* provider Fonoster's evals grader supports, independent of the agent's own
|
|
61
|
+
* `llmProvider`/`llmModel` above). Confirmed against the live service that Fonoster
|
|
62
|
+
* supplies its own default OpenAI key when none is given, so no apiKey field is exposed
|
|
63
|
+
* here yet — add one if a deployment ever needs its own quota.
|
|
64
|
+
*/
|
|
65
|
+
evalsModel: z.string().default("gpt-4o-mini")
|
|
57
66
|
})
|
|
58
67
|
.default({
|
|
59
68
|
sttProductRef: "stt.deepgram",
|
|
@@ -62,7 +71,8 @@ export const fonosterConfigSchema = z
|
|
|
62
71
|
llmProvider: "google",
|
|
63
72
|
llmModel: "gemini-2.0-flash",
|
|
64
73
|
maxTokens: 300,
|
|
65
|
-
temperature: 0
|
|
74
|
+
temperature: 0,
|
|
75
|
+
evalsModel: "gpt-4o-mini"
|
|
66
76
|
}),
|
|
67
77
|
/**
|
|
68
78
|
* Selectable voice catalog for voice agent templates (Voz IA + pre-recorded).
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEjD;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC3C,gFAAgF;IAChF,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,iBAAiB,CAAC;IAC/C,oEAAoE;IACpE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,uBAAuB,CAAC;CAC3D,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,EAAE,EAAE,CAAC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,OAAO;QACnB,oBAAoB,EAAE,EAAE;QACxB,iBAAiB,EAAE,CAAC;KACrB,CAAC;IACJ;;;;;OAKG;IACH,MAAM,EAAE,CAAC;SACN,MAAM,CAAC;QACN,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;QACnC,oCAAoC;QACpC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;QACpD;;;;WAIG;QACH,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;QAC/D;;;;;WAKG;QACH,oCAAoC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC;KAC9E,CAAC;SACD,QAAQ,CAAC,EAAE,CAAC;CAChB,CAAC,CAAC"}
|
|
@@ -0,0 +1,619 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* The account context an eval scenario runs against — author-facing fields only
|
|
4
|
+
* (no id/portfolioId/timestamps). The apiserver fills those bookkeeping fields with
|
|
5
|
+
* synthetic values before calling {@link buildOutreachContext}, so eval scenarios reuse
|
|
6
|
+
* the exact same render/context-building logic as a real dispatch, not a re-implementation.
|
|
7
|
+
*/
|
|
8
|
+
export declare const evalAccountSchema: z.ZodObject<{
|
|
9
|
+
fullName: z.ZodString;
|
|
10
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
11
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
12
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
13
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
14
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
15
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
17
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
18
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
19
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
20
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
21
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
22
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
23
|
+
}, z.core.$strip>;
|
|
24
|
+
export type EvalAccountInput = z.infer<typeof evalAccountSchema>;
|
|
25
|
+
/** VOICE_AI's text-match assertion, mirroring Fonoster's `EXACT`/`SIMILAR` expectation. */
|
|
26
|
+
export declare const evalExpectedTextSchema: z.ZodObject<{
|
|
27
|
+
type: z.ZodEnum<{
|
|
28
|
+
EXACT: "EXACT";
|
|
29
|
+
SIMILAR: "SIMILAR";
|
|
30
|
+
}>;
|
|
31
|
+
response: z.ZodString;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
/** VOICE_AI's expected-tool-call assertion (e.g. `hangup`), mirroring Fonoster's report shape. */
|
|
34
|
+
export declare const evalExpectedToolSchema: z.ZodObject<{
|
|
35
|
+
tool: z.ZodString;
|
|
36
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
/**
|
|
39
|
+
* A single turn's optional expectation. `text`/`tools` are graded for `VOICE_AI` (relayed
|
|
40
|
+
* from Fonoster); `action`/`outcome` are graded for `EMAIL`/`WHATSAPP` (the behavioral analog
|
|
41
|
+
* of an expected tool call — see design.md). A turn with no `expected` still runs and streams
|
|
42
|
+
* a result, it just has nothing to grade — **except for VOICE_AI**: Fonoster's
|
|
43
|
+
* `evaluateIntelligence` requires `expected.text` on every conversation turn (confirmed
|
|
44
|
+
* against the live service, correcting an earlier assumption in design.md), so
|
|
45
|
+
* `resolveEvalTarget` rejects a VOICE_AI scenario with any turn missing it before ever
|
|
46
|
+
* calling Fonoster. This schema stays permissive (shared across all three channel types);
|
|
47
|
+
* the VOICE_AI-specific requirement is enforced at resolution time, not here.
|
|
48
|
+
*/
|
|
49
|
+
export declare const evalExpectedSchema: z.ZodObject<{
|
|
50
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
51
|
+
type: z.ZodEnum<{
|
|
52
|
+
EXACT: "EXACT";
|
|
53
|
+
SIMILAR: "SIMILAR";
|
|
54
|
+
}>;
|
|
55
|
+
response: z.ZodString;
|
|
56
|
+
}, z.core.$strip>>;
|
|
57
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
58
|
+
tool: z.ZodString;
|
|
59
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
|
+
}, z.core.$strip>>>;
|
|
61
|
+
action: z.ZodOptional<z.ZodEnum<{
|
|
62
|
+
reply: "reply";
|
|
63
|
+
ignore: "ignore";
|
|
64
|
+
resolve: "resolve";
|
|
65
|
+
escalate: "escalate";
|
|
66
|
+
}>>;
|
|
67
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
DELIVERED: "DELIVERED";
|
|
69
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
70
|
+
NO_ANSWER: "NO_ANSWER";
|
|
71
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
72
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
73
|
+
NEW_TERMS: "NEW_TERMS";
|
|
74
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
75
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
76
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
77
|
+
RESOLVED: "RESOLVED";
|
|
78
|
+
PAID: "PAID";
|
|
79
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
80
|
+
OPT_OUT: "OPT_OUT";
|
|
81
|
+
REFUSED: "REFUSED";
|
|
82
|
+
OTHER: "OTHER";
|
|
83
|
+
}>>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
export declare const evalTurnSchema: z.ZodObject<{
|
|
86
|
+
input: z.ZodString;
|
|
87
|
+
expected: z.ZodOptional<z.ZodObject<{
|
|
88
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
89
|
+
type: z.ZodEnum<{
|
|
90
|
+
EXACT: "EXACT";
|
|
91
|
+
SIMILAR: "SIMILAR";
|
|
92
|
+
}>;
|
|
93
|
+
response: z.ZodString;
|
|
94
|
+
}, z.core.$strip>>;
|
|
95
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
96
|
+
tool: z.ZodString;
|
|
97
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
98
|
+
}, z.core.$strip>>>;
|
|
99
|
+
action: z.ZodOptional<z.ZodEnum<{
|
|
100
|
+
reply: "reply";
|
|
101
|
+
ignore: "ignore";
|
|
102
|
+
resolve: "resolve";
|
|
103
|
+
escalate: "escalate";
|
|
104
|
+
}>>;
|
|
105
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
106
|
+
DELIVERED: "DELIVERED";
|
|
107
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
108
|
+
NO_ANSWER: "NO_ANSWER";
|
|
109
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
110
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
111
|
+
NEW_TERMS: "NEW_TERMS";
|
|
112
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
113
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
114
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
115
|
+
RESOLVED: "RESOLVED";
|
|
116
|
+
PAID: "PAID";
|
|
117
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
118
|
+
OPT_OUT: "OPT_OUT";
|
|
119
|
+
REFUSED: "REFUSED";
|
|
120
|
+
OTHER: "OTHER";
|
|
121
|
+
}>>;
|
|
122
|
+
}, z.core.$strip>>;
|
|
123
|
+
}, z.core.$strip>;
|
|
124
|
+
export declare const evalScenarioSchema: z.ZodObject<{
|
|
125
|
+
ref: z.ZodString;
|
|
126
|
+
description: z.ZodOptional<z.ZodString>;
|
|
127
|
+
account: z.ZodObject<{
|
|
128
|
+
fullName: z.ZodString;
|
|
129
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
130
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
131
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
132
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
133
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
134
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
135
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
136
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
137
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
138
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
139
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
140
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
141
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
142
|
+
}, z.core.$strip>;
|
|
143
|
+
turns: z.ZodArray<z.ZodObject<{
|
|
144
|
+
input: z.ZodString;
|
|
145
|
+
expected: z.ZodOptional<z.ZodObject<{
|
|
146
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
147
|
+
type: z.ZodEnum<{
|
|
148
|
+
EXACT: "EXACT";
|
|
149
|
+
SIMILAR: "SIMILAR";
|
|
150
|
+
}>;
|
|
151
|
+
response: z.ZodString;
|
|
152
|
+
}, z.core.$strip>>;
|
|
153
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
154
|
+
tool: z.ZodString;
|
|
155
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
156
|
+
}, z.core.$strip>>>;
|
|
157
|
+
action: z.ZodOptional<z.ZodEnum<{
|
|
158
|
+
reply: "reply";
|
|
159
|
+
ignore: "ignore";
|
|
160
|
+
resolve: "resolve";
|
|
161
|
+
escalate: "escalate";
|
|
162
|
+
}>>;
|
|
163
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
164
|
+
DELIVERED: "DELIVERED";
|
|
165
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
166
|
+
NO_ANSWER: "NO_ANSWER";
|
|
167
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
168
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
169
|
+
NEW_TERMS: "NEW_TERMS";
|
|
170
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
171
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
172
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
173
|
+
RESOLVED: "RESOLVED";
|
|
174
|
+
PAID: "PAID";
|
|
175
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
176
|
+
OPT_OUT: "OPT_OUT";
|
|
177
|
+
REFUSED: "REFUSED";
|
|
178
|
+
OTHER: "OTHER";
|
|
179
|
+
}>>;
|
|
180
|
+
}, z.core.$strip>>;
|
|
181
|
+
}, z.core.$strip>>;
|
|
182
|
+
}, z.core.$strip>;
|
|
183
|
+
export type EvalScenario = z.infer<typeof evalScenarioSchema>;
|
|
184
|
+
export type EvalTurn = z.infer<typeof evalTurnSchema>;
|
|
185
|
+
/**
|
|
186
|
+
* An eval template: the same fields `createAgentTemplateSchema` validates for
|
|
187
|
+
* `agentTemplates.create`, plus a `scenarios` array — one document is both the agent
|
|
188
|
+
* definition and its tests (see design.md). Restricted to the three conversational
|
|
189
|
+
* channel types; `SMS`/`VOICE_PRERECORDED` have no scenarios to run (see
|
|
190
|
+
* `previewYamlAgentSchema` instead).
|
|
191
|
+
*/
|
|
192
|
+
export declare const evalTemplateSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
193
|
+
type: z.ZodLiteral<"VOICE_AI">;
|
|
194
|
+
voice: z.ZodString;
|
|
195
|
+
systemPrompt: z.ZodString;
|
|
196
|
+
firstMessage: z.ZodOptional<z.ZodString>;
|
|
197
|
+
language: z.ZodString;
|
|
198
|
+
fonosterAppName: z.ZodOptional<z.ZodString>;
|
|
199
|
+
name: z.ZodString;
|
|
200
|
+
scenarios: z.ZodArray<z.ZodObject<{
|
|
201
|
+
ref: z.ZodString;
|
|
202
|
+
description: z.ZodOptional<z.ZodString>;
|
|
203
|
+
account: z.ZodObject<{
|
|
204
|
+
fullName: z.ZodString;
|
|
205
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
206
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
207
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
208
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
209
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
210
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
211
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
212
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
213
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
214
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
215
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
216
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
217
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
218
|
+
}, z.core.$strip>;
|
|
219
|
+
turns: z.ZodArray<z.ZodObject<{
|
|
220
|
+
input: z.ZodString;
|
|
221
|
+
expected: z.ZodOptional<z.ZodObject<{
|
|
222
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
223
|
+
type: z.ZodEnum<{
|
|
224
|
+
EXACT: "EXACT";
|
|
225
|
+
SIMILAR: "SIMILAR";
|
|
226
|
+
}>;
|
|
227
|
+
response: z.ZodString;
|
|
228
|
+
}, z.core.$strip>>;
|
|
229
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
230
|
+
tool: z.ZodString;
|
|
231
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
232
|
+
}, z.core.$strip>>>;
|
|
233
|
+
action: z.ZodOptional<z.ZodEnum<{
|
|
234
|
+
reply: "reply";
|
|
235
|
+
ignore: "ignore";
|
|
236
|
+
resolve: "resolve";
|
|
237
|
+
escalate: "escalate";
|
|
238
|
+
}>>;
|
|
239
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
240
|
+
DELIVERED: "DELIVERED";
|
|
241
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
242
|
+
NO_ANSWER: "NO_ANSWER";
|
|
243
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
244
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
245
|
+
NEW_TERMS: "NEW_TERMS";
|
|
246
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
247
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
248
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
249
|
+
RESOLVED: "RESOLVED";
|
|
250
|
+
PAID: "PAID";
|
|
251
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
252
|
+
OPT_OUT: "OPT_OUT";
|
|
253
|
+
REFUSED: "REFUSED";
|
|
254
|
+
OTHER: "OTHER";
|
|
255
|
+
}>>;
|
|
256
|
+
}, z.core.$strip>>;
|
|
257
|
+
}, z.core.$strip>>;
|
|
258
|
+
}, z.core.$strip>>;
|
|
259
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
260
|
+
type: z.ZodLiteral<"EMAIL">;
|
|
261
|
+
subject: z.ZodString;
|
|
262
|
+
messageBody: z.ZodString;
|
|
263
|
+
systemPrompt: z.ZodString;
|
|
264
|
+
maxReplies: z.ZodOptional<z.ZodNumber>;
|
|
265
|
+
name: z.ZodString;
|
|
266
|
+
scenarios: z.ZodArray<z.ZodObject<{
|
|
267
|
+
ref: z.ZodString;
|
|
268
|
+
description: z.ZodOptional<z.ZodString>;
|
|
269
|
+
account: z.ZodObject<{
|
|
270
|
+
fullName: z.ZodString;
|
|
271
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
272
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
273
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
274
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
275
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
276
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
277
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
278
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
279
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
280
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
281
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
282
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
283
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
284
|
+
}, z.core.$strip>;
|
|
285
|
+
turns: z.ZodArray<z.ZodObject<{
|
|
286
|
+
input: z.ZodString;
|
|
287
|
+
expected: z.ZodOptional<z.ZodObject<{
|
|
288
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
289
|
+
type: z.ZodEnum<{
|
|
290
|
+
EXACT: "EXACT";
|
|
291
|
+
SIMILAR: "SIMILAR";
|
|
292
|
+
}>;
|
|
293
|
+
response: z.ZodString;
|
|
294
|
+
}, z.core.$strip>>;
|
|
295
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
296
|
+
tool: z.ZodString;
|
|
297
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
298
|
+
}, z.core.$strip>>>;
|
|
299
|
+
action: z.ZodOptional<z.ZodEnum<{
|
|
300
|
+
reply: "reply";
|
|
301
|
+
ignore: "ignore";
|
|
302
|
+
resolve: "resolve";
|
|
303
|
+
escalate: "escalate";
|
|
304
|
+
}>>;
|
|
305
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
306
|
+
DELIVERED: "DELIVERED";
|
|
307
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
308
|
+
NO_ANSWER: "NO_ANSWER";
|
|
309
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
310
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
311
|
+
NEW_TERMS: "NEW_TERMS";
|
|
312
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
313
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
314
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
315
|
+
RESOLVED: "RESOLVED";
|
|
316
|
+
PAID: "PAID";
|
|
317
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
318
|
+
OPT_OUT: "OPT_OUT";
|
|
319
|
+
REFUSED: "REFUSED";
|
|
320
|
+
OTHER: "OTHER";
|
|
321
|
+
}>>;
|
|
322
|
+
}, z.core.$strip>>;
|
|
323
|
+
}, z.core.$strip>>;
|
|
324
|
+
}, z.core.$strip>>;
|
|
325
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
326
|
+
type: z.ZodLiteral<"WHATSAPP">;
|
|
327
|
+
templateName: z.ZodString;
|
|
328
|
+
messageBody: z.ZodString;
|
|
329
|
+
systemPrompt: z.ZodString;
|
|
330
|
+
maxReplies: z.ZodOptional<z.ZodNumber>;
|
|
331
|
+
name: z.ZodString;
|
|
332
|
+
scenarios: z.ZodArray<z.ZodObject<{
|
|
333
|
+
ref: z.ZodString;
|
|
334
|
+
description: z.ZodOptional<z.ZodString>;
|
|
335
|
+
account: z.ZodObject<{
|
|
336
|
+
fullName: z.ZodString;
|
|
337
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
338
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
339
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
340
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
341
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
342
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
343
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
344
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
345
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
346
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
347
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
348
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
349
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
350
|
+
}, z.core.$strip>;
|
|
351
|
+
turns: z.ZodArray<z.ZodObject<{
|
|
352
|
+
input: z.ZodString;
|
|
353
|
+
expected: z.ZodOptional<z.ZodObject<{
|
|
354
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
355
|
+
type: z.ZodEnum<{
|
|
356
|
+
EXACT: "EXACT";
|
|
357
|
+
SIMILAR: "SIMILAR";
|
|
358
|
+
}>;
|
|
359
|
+
response: z.ZodString;
|
|
360
|
+
}, z.core.$strip>>;
|
|
361
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
362
|
+
tool: z.ZodString;
|
|
363
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
364
|
+
}, z.core.$strip>>>;
|
|
365
|
+
action: z.ZodOptional<z.ZodEnum<{
|
|
366
|
+
reply: "reply";
|
|
367
|
+
ignore: "ignore";
|
|
368
|
+
resolve: "resolve";
|
|
369
|
+
escalate: "escalate";
|
|
370
|
+
}>>;
|
|
371
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
372
|
+
DELIVERED: "DELIVERED";
|
|
373
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
374
|
+
NO_ANSWER: "NO_ANSWER";
|
|
375
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
376
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
377
|
+
NEW_TERMS: "NEW_TERMS";
|
|
378
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
379
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
380
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
381
|
+
RESOLVED: "RESOLVED";
|
|
382
|
+
PAID: "PAID";
|
|
383
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
384
|
+
OPT_OUT: "OPT_OUT";
|
|
385
|
+
REFUSED: "REFUSED";
|
|
386
|
+
OTHER: "OTHER";
|
|
387
|
+
}>>;
|
|
388
|
+
}, z.core.$strip>>;
|
|
389
|
+
}, z.core.$strip>>;
|
|
390
|
+
}, z.core.$strip>>;
|
|
391
|
+
}, z.core.$strip>], "type">;
|
|
392
|
+
export type EvalTemplateInput = z.infer<typeof evalTemplateSchema>;
|
|
393
|
+
/** Evaluate an existing template: caller supplies scenarios, since a stored `AgentTemplate`
|
|
394
|
+
* row carries no test fixtures of its own. */
|
|
395
|
+
export declare const evaluateExistingTargetSchema: z.ZodObject<{
|
|
396
|
+
agentTemplateId: z.ZodString;
|
|
397
|
+
scenarios: z.ZodArray<z.ZodObject<{
|
|
398
|
+
ref: z.ZodString;
|
|
399
|
+
description: z.ZodOptional<z.ZodString>;
|
|
400
|
+
account: z.ZodObject<{
|
|
401
|
+
fullName: z.ZodString;
|
|
402
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
403
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
404
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
405
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
406
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
407
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
408
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
409
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
410
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
411
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
412
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
413
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
414
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
415
|
+
}, z.core.$strip>;
|
|
416
|
+
turns: z.ZodArray<z.ZodObject<{
|
|
417
|
+
input: z.ZodString;
|
|
418
|
+
expected: z.ZodOptional<z.ZodObject<{
|
|
419
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
420
|
+
type: z.ZodEnum<{
|
|
421
|
+
EXACT: "EXACT";
|
|
422
|
+
SIMILAR: "SIMILAR";
|
|
423
|
+
}>;
|
|
424
|
+
response: z.ZodString;
|
|
425
|
+
}, z.core.$strip>>;
|
|
426
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
427
|
+
tool: z.ZodString;
|
|
428
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
429
|
+
}, z.core.$strip>>>;
|
|
430
|
+
action: z.ZodOptional<z.ZodEnum<{
|
|
431
|
+
reply: "reply";
|
|
432
|
+
ignore: "ignore";
|
|
433
|
+
resolve: "resolve";
|
|
434
|
+
escalate: "escalate";
|
|
435
|
+
}>>;
|
|
436
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
437
|
+
DELIVERED: "DELIVERED";
|
|
438
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
439
|
+
NO_ANSWER: "NO_ANSWER";
|
|
440
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
441
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
442
|
+
NEW_TERMS: "NEW_TERMS";
|
|
443
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
444
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
445
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
446
|
+
RESOLVED: "RESOLVED";
|
|
447
|
+
PAID: "PAID";
|
|
448
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
449
|
+
OPT_OUT: "OPT_OUT";
|
|
450
|
+
REFUSED: "REFUSED";
|
|
451
|
+
OTHER: "OTHER";
|
|
452
|
+
}>>;
|
|
453
|
+
}, z.core.$strip>>;
|
|
454
|
+
}, z.core.$strip>>;
|
|
455
|
+
}, z.core.$strip>>;
|
|
456
|
+
}, z.core.$strip>;
|
|
457
|
+
/** Evaluate a not-yet-created agent: the YAML embeds both the agent fields and its scenarios. */
|
|
458
|
+
export declare const evaluateYamlTargetSchema: z.ZodObject<{
|
|
459
|
+
yaml: z.ZodString;
|
|
460
|
+
}, z.core.$strip>;
|
|
461
|
+
export declare const evaluateInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
462
|
+
agentTemplateId: z.ZodString;
|
|
463
|
+
scenarios: z.ZodArray<z.ZodObject<{
|
|
464
|
+
ref: z.ZodString;
|
|
465
|
+
description: z.ZodOptional<z.ZodString>;
|
|
466
|
+
account: z.ZodObject<{
|
|
467
|
+
fullName: z.ZodString;
|
|
468
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
469
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
470
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
471
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
472
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
473
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
474
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
475
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
476
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
477
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
478
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
479
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
480
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
481
|
+
}, z.core.$strip>;
|
|
482
|
+
turns: z.ZodArray<z.ZodObject<{
|
|
483
|
+
input: z.ZodString;
|
|
484
|
+
expected: z.ZodOptional<z.ZodObject<{
|
|
485
|
+
text: z.ZodOptional<z.ZodObject<{
|
|
486
|
+
type: z.ZodEnum<{
|
|
487
|
+
EXACT: "EXACT";
|
|
488
|
+
SIMILAR: "SIMILAR";
|
|
489
|
+
}>;
|
|
490
|
+
response: z.ZodString;
|
|
491
|
+
}, z.core.$strip>>;
|
|
492
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
493
|
+
tool: z.ZodString;
|
|
494
|
+
parameters: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
495
|
+
}, z.core.$strip>>>;
|
|
496
|
+
action: z.ZodOptional<z.ZodEnum<{
|
|
497
|
+
reply: "reply";
|
|
498
|
+
ignore: "ignore";
|
|
499
|
+
resolve: "resolve";
|
|
500
|
+
escalate: "escalate";
|
|
501
|
+
}>>;
|
|
502
|
+
outcome: z.ZodOptional<z.ZodEnum<{
|
|
503
|
+
DELIVERED: "DELIVERED";
|
|
504
|
+
NOT_DELIVERED: "NOT_DELIVERED";
|
|
505
|
+
NO_ANSWER: "NO_ANSWER";
|
|
506
|
+
PAYMENT_PROMISE: "PAYMENT_PROMISE";
|
|
507
|
+
PARTIAL_PAYMENT_AGREED: "PARTIAL_PAYMENT_AGREED";
|
|
508
|
+
NEW_TERMS: "NEW_TERMS";
|
|
509
|
+
CALLBACK_REQUESTED: "CALLBACK_REQUESTED";
|
|
510
|
+
DISPUTE_RAISED: "DISPUTE_RAISED";
|
|
511
|
+
INFORMATION_REQUEST: "INFORMATION_REQUEST";
|
|
512
|
+
RESOLVED: "RESOLVED";
|
|
513
|
+
PAID: "PAID";
|
|
514
|
+
WRONG_NUMBER: "WRONG_NUMBER";
|
|
515
|
+
OPT_OUT: "OPT_OUT";
|
|
516
|
+
REFUSED: "REFUSED";
|
|
517
|
+
OTHER: "OTHER";
|
|
518
|
+
}>>;
|
|
519
|
+
}, z.core.$strip>>;
|
|
520
|
+
}, z.core.$strip>>;
|
|
521
|
+
}, z.core.$strip>>;
|
|
522
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
523
|
+
yaml: z.ZodString;
|
|
524
|
+
}, z.core.$strip>]>;
|
|
525
|
+
export type EvaluateExistingInput = z.infer<typeof evaluateExistingTargetSchema>;
|
|
526
|
+
export type EvaluateYamlInput = z.infer<typeof evaluateYamlTargetSchema>;
|
|
527
|
+
export type EvaluateInput = z.infer<typeof evaluateInputSchema>;
|
|
528
|
+
/** A static (no-conversation) agent definition for `agentTemplates.preview`'s YAML target —
|
|
529
|
+
* `createAgentTemplateSchema`'s `SMS`/`VOICE_PRERECORDED` fields, no `scenarios`. */
|
|
530
|
+
export declare const previewYamlAgentSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
531
|
+
type: z.ZodLiteral<"SMS">;
|
|
532
|
+
messageBody: z.ZodString;
|
|
533
|
+
senderId: z.ZodOptional<z.ZodString>;
|
|
534
|
+
name: z.ZodString;
|
|
535
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
536
|
+
type: z.ZodLiteral<"VOICE_PRERECORDED">;
|
|
537
|
+
voice: z.ZodString;
|
|
538
|
+
script: z.ZodString;
|
|
539
|
+
language: z.ZodString;
|
|
540
|
+
fonosterAppName: z.ZodOptional<z.ZodString>;
|
|
541
|
+
name: z.ZodString;
|
|
542
|
+
}, z.core.$strip>], "type">;
|
|
543
|
+
export declare const previewExistingTargetSchema: z.ZodObject<{
|
|
544
|
+
agentTemplateId: z.ZodString;
|
|
545
|
+
account: z.ZodObject<{
|
|
546
|
+
fullName: z.ZodString;
|
|
547
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
548
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
549
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
550
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
551
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
552
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
553
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
554
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
555
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
556
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
557
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
558
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
559
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
560
|
+
}, z.core.$strip>;
|
|
561
|
+
}, z.core.$strip>;
|
|
562
|
+
export declare const previewYamlTargetSchema: z.ZodObject<{
|
|
563
|
+
yaml: z.ZodString;
|
|
564
|
+
account: z.ZodObject<{
|
|
565
|
+
fullName: z.ZodString;
|
|
566
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
567
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
568
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
569
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
570
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
571
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
572
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
573
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
574
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
575
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
576
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
577
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
578
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
579
|
+
}, z.core.$strip>;
|
|
580
|
+
}, z.core.$strip>;
|
|
581
|
+
export declare const previewInputSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
582
|
+
agentTemplateId: z.ZodString;
|
|
583
|
+
account: z.ZodObject<{
|
|
584
|
+
fullName: z.ZodString;
|
|
585
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
586
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
587
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
588
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
589
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
590
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
591
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
592
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
593
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
594
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
595
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
596
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
597
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
598
|
+
}, z.core.$strip>;
|
|
599
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
600
|
+
yaml: z.ZodString;
|
|
601
|
+
account: z.ZodObject<{
|
|
602
|
+
fullName: z.ZodString;
|
|
603
|
+
principalAmount: z.ZodDefault<z.ZodNumber>;
|
|
604
|
+
outstandingBalance: z.ZodDefault<z.ZodNumber>;
|
|
605
|
+
daysPastDue: z.ZodDefault<z.ZodNumber>;
|
|
606
|
+
termsAmount: z.ZodDefault<z.ZodNumber>;
|
|
607
|
+
termsFrequency: z.ZodOptional<z.ZodString>;
|
|
608
|
+
termsLength: z.ZodDefault<z.ZodNumber>;
|
|
609
|
+
missedInstallments: z.ZodDefault<z.ZodNumber>;
|
|
610
|
+
lastPaymentDate: z.ZodOptional<z.ZodString>;
|
|
611
|
+
lastPaymentAmount: z.ZodOptional<z.ZodNumber>;
|
|
612
|
+
preferredLanguage: z.ZodOptional<z.ZodString>;
|
|
613
|
+
customerSegment: z.ZodOptional<z.ZodString>;
|
|
614
|
+
bestTimeToCall: z.ZodOptional<z.ZodString>;
|
|
615
|
+
currency: z.ZodDefault<z.ZodString>;
|
|
616
|
+
}, z.core.$strip>;
|
|
617
|
+
}, z.core.$strip>]>;
|
|
618
|
+
export type PreviewInput = z.infer<typeof previewInputSchema>;
|
|
619
|
+
//# sourceMappingURL=agentEvaluations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentEvaluations.d.ts","sourceRoot":"","sources":["../../src/schemas/agentEvaluations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;iBAe5B,CAAC;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEjE,2FAA2F;AAC3F,eAAO,MAAM,sBAAsB;;;;;;iBAGjC,CAAC;AAEH,kGAAkG;AAClG,eAAO,MAAM,sBAAsB;;;iBAGjC,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MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AACzE,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE;qFACqF;AACrF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;2BAGjC,CAAC;AAEH,eAAO,MAAM,2BAA2B;;;;;;;;;;;;;;;;;;iBAGtC,CAAC;AAEH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;iBAGlC,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAAkE,CAAC;AAClG,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { createAgentTemplateSchema } from "./agentTemplates.js";
|
|
3
|
+
import { contactOutcomeSchema } from "./contactLog.js";
|
|
4
|
+
/**
|
|
5
|
+
* The account context an eval scenario runs against — author-facing fields only
|
|
6
|
+
* (no id/portfolioId/timestamps). The apiserver fills those bookkeeping fields with
|
|
7
|
+
* synthetic values before calling {@link buildOutreachContext}, so eval scenarios reuse
|
|
8
|
+
* the exact same render/context-building logic as a real dispatch, not a re-implementation.
|
|
9
|
+
*/
|
|
10
|
+
export const evalAccountSchema = z.object({
|
|
11
|
+
fullName: z.string().min(1),
|
|
12
|
+
principalAmount: z.number().default(0),
|
|
13
|
+
outstandingBalance: z.number().default(0),
|
|
14
|
+
daysPastDue: z.number().int().default(0),
|
|
15
|
+
termsAmount: z.number().default(0),
|
|
16
|
+
termsFrequency: z.string().optional(),
|
|
17
|
+
termsLength: z.number().int().default(0),
|
|
18
|
+
missedInstallments: z.number().int().default(0),
|
|
19
|
+
lastPaymentDate: z.string().datetime().optional(),
|
|
20
|
+
lastPaymentAmount: z.number().optional(),
|
|
21
|
+
preferredLanguage: z.string().optional(),
|
|
22
|
+
customerSegment: z.string().optional(),
|
|
23
|
+
bestTimeToCall: z.string().optional(),
|
|
24
|
+
currency: z.string().default("USD")
|
|
25
|
+
});
|
|
26
|
+
/** VOICE_AI's text-match assertion, mirroring Fonoster's `EXACT`/`SIMILAR` expectation. */
|
|
27
|
+
export const evalExpectedTextSchema = z.object({
|
|
28
|
+
type: z.enum(["EXACT", "SIMILAR"]),
|
|
29
|
+
response: z.string().min(1)
|
|
30
|
+
});
|
|
31
|
+
/** VOICE_AI's expected-tool-call assertion (e.g. `hangup`), mirroring Fonoster's report shape. */
|
|
32
|
+
export const evalExpectedToolSchema = z.object({
|
|
33
|
+
tool: z.string().min(1),
|
|
34
|
+
parameters: z.record(z.string(), z.unknown()).optional()
|
|
35
|
+
});
|
|
36
|
+
/**
|
|
37
|
+
* A single turn's optional expectation. `text`/`tools` are graded for `VOICE_AI` (relayed
|
|
38
|
+
* from Fonoster); `action`/`outcome` are graded for `EMAIL`/`WHATSAPP` (the behavioral analog
|
|
39
|
+
* of an expected tool call — see design.md). A turn with no `expected` still runs and streams
|
|
40
|
+
* a result, it just has nothing to grade — **except for VOICE_AI**: Fonoster's
|
|
41
|
+
* `evaluateIntelligence` requires `expected.text` on every conversation turn (confirmed
|
|
42
|
+
* against the live service, correcting an earlier assumption in design.md), so
|
|
43
|
+
* `resolveEvalTarget` rejects a VOICE_AI scenario with any turn missing it before ever
|
|
44
|
+
* calling Fonoster. This schema stays permissive (shared across all three channel types);
|
|
45
|
+
* the VOICE_AI-specific requirement is enforced at resolution time, not here.
|
|
46
|
+
*/
|
|
47
|
+
export const evalExpectedSchema = z.object({
|
|
48
|
+
text: evalExpectedTextSchema.optional(),
|
|
49
|
+
tools: z.array(evalExpectedToolSchema).optional(),
|
|
50
|
+
action: z.enum(["reply", "ignore", "resolve", "escalate"]).optional(),
|
|
51
|
+
outcome: contactOutcomeSchema.optional()
|
|
52
|
+
});
|
|
53
|
+
export const evalTurnSchema = z.object({
|
|
54
|
+
input: z.string().min(1),
|
|
55
|
+
expected: evalExpectedSchema.optional()
|
|
56
|
+
});
|
|
57
|
+
export const evalScenarioSchema = z.object({
|
|
58
|
+
ref: z.string().min(1),
|
|
59
|
+
/** Free-text label forwarded as-is to Fonoster's required `scenarios[].description` for
|
|
60
|
+
* VOICE_AI (defaults to `ref` there when omitted); unused by EMAIL/WHATSAPP. */
|
|
61
|
+
description: z.string().optional(),
|
|
62
|
+
account: evalAccountSchema,
|
|
63
|
+
turns: z.array(evalTurnSchema).min(1)
|
|
64
|
+
});
|
|
65
|
+
// `createAgentTemplateSchema.options` is a tuple in the declaration order
|
|
66
|
+
// [VOICE_AI, VOICE_PRERECORDED, SMS, EMAIL, WHATSAPP] — destructured by position (not looked
|
|
67
|
+
// up by `.find()`) so TypeScript keeps each member's specific field types instead of widening
|
|
68
|
+
// to the full 5-way union. The runtime assertions below catch silent breakage if that
|
|
69
|
+
// declaration order ever changes.
|
|
70
|
+
const [voiceAiMember, voicePrerecordedMember, smsMember, emailMember, whatsAppMember] = createAgentTemplateSchema.options;
|
|
71
|
+
function assertMemberType(member, expected) {
|
|
72
|
+
if (member.shape.type.value !== expected) {
|
|
73
|
+
throw new Error(`createAgentTemplateSchema member order changed: expected "${expected}" here, got ` +
|
|
74
|
+
`"${member.shape.type.value}". Update the positional destructure in agentEvaluations.ts.`);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
assertMemberType(voiceAiMember, "VOICE_AI");
|
|
78
|
+
assertMemberType(voicePrerecordedMember, "VOICE_PRERECORDED");
|
|
79
|
+
assertMemberType(smsMember, "SMS");
|
|
80
|
+
assertMemberType(emailMember, "EMAIL");
|
|
81
|
+
assertMemberType(whatsAppMember, "WHATSAPP");
|
|
82
|
+
const evalScenarios = { scenarios: z.array(evalScenarioSchema).min(1) };
|
|
83
|
+
/**
|
|
84
|
+
* An eval template: the same fields `createAgentTemplateSchema` validates for
|
|
85
|
+
* `agentTemplates.create`, plus a `scenarios` array — one document is both the agent
|
|
86
|
+
* definition and its tests (see design.md). Restricted to the three conversational
|
|
87
|
+
* channel types; `SMS`/`VOICE_PRERECORDED` have no scenarios to run (see
|
|
88
|
+
* `previewYamlAgentSchema` instead).
|
|
89
|
+
*/
|
|
90
|
+
export const evalTemplateSchema = z.discriminatedUnion("type", [
|
|
91
|
+
voiceAiMember.extend(evalScenarios),
|
|
92
|
+
emailMember.extend(evalScenarios),
|
|
93
|
+
whatsAppMember.extend(evalScenarios)
|
|
94
|
+
]);
|
|
95
|
+
/** Evaluate an existing template: caller supplies scenarios, since a stored `AgentTemplate`
|
|
96
|
+
* row carries no test fixtures of its own. */
|
|
97
|
+
export const evaluateExistingTargetSchema = z.object({
|
|
98
|
+
agentTemplateId: z.string().min(1),
|
|
99
|
+
scenarios: z.array(evalScenarioSchema).min(1)
|
|
100
|
+
});
|
|
101
|
+
/** Evaluate a not-yet-created agent: the YAML embeds both the agent fields and its scenarios. */
|
|
102
|
+
export const evaluateYamlTargetSchema = z.object({
|
|
103
|
+
yaml: z.string().min(1)
|
|
104
|
+
});
|
|
105
|
+
export const evaluateInputSchema = z.union([
|
|
106
|
+
evaluateExistingTargetSchema,
|
|
107
|
+
evaluateYamlTargetSchema
|
|
108
|
+
]);
|
|
109
|
+
/** A static (no-conversation) agent definition for `agentTemplates.preview`'s YAML target —
|
|
110
|
+
* `createAgentTemplateSchema`'s `SMS`/`VOICE_PRERECORDED` fields, no `scenarios`. */
|
|
111
|
+
export const previewYamlAgentSchema = z.discriminatedUnion("type", [
|
|
112
|
+
smsMember,
|
|
113
|
+
voicePrerecordedMember
|
|
114
|
+
]);
|
|
115
|
+
export const previewExistingTargetSchema = z.object({
|
|
116
|
+
agentTemplateId: z.string().min(1),
|
|
117
|
+
account: evalAccountSchema
|
|
118
|
+
});
|
|
119
|
+
export const previewYamlTargetSchema = z.object({
|
|
120
|
+
yaml: z.string().min(1),
|
|
121
|
+
account: evalAccountSchema
|
|
122
|
+
});
|
|
123
|
+
export const previewInputSchema = z.union([previewExistingTargetSchema, previewYamlTargetSchema]);
|
|
124
|
+
//# sourceMappingURL=agentEvaluations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentEvaluations.js","sourceRoot":"","sources":["../../src/schemas/agentEvaluations.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAEvD;;;;;GAKG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3B,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACtC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACzC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACxC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAClC,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACrC,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IACxC,kBAAkB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC;IAC/C,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE;IACjD,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACxC,iBAAiB,EAAE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,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACvB,OAAO,EAAE,iBAAiB;CAC3B,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,2BAA2B,EAAE,uBAAuB,CAAC,CAAC,CAAC"}
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./userSettings.js";
|
|
|
8
8
|
export * from "./agentTemplates.js";
|
|
9
9
|
export * from "./campaigns.js";
|
|
10
10
|
export * from "./contactLog.js";
|
|
11
|
+
export * from "./agentEvaluations.js";
|
|
11
12
|
export * from "./dispatch.js";
|
|
12
13
|
export * from "./email.js";
|
|
13
14
|
export * from "./whatsApp.js";
|
|
@@ -15,4 +16,5 @@ export * from "./voiceEvent.js";
|
|
|
15
16
|
export * from "./insight.js";
|
|
16
17
|
export * from "./engineEvents.js";
|
|
17
18
|
export * from "./billing.js";
|
|
19
|
+
export * from "./phone.js";
|
|
18
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
package/dist/schemas/index.js
CHANGED
|
@@ -8,6 +8,7 @@ export * from "./userSettings.js";
|
|
|
8
8
|
export * from "./agentTemplates.js";
|
|
9
9
|
export * from "./campaigns.js";
|
|
10
10
|
export * from "./contactLog.js";
|
|
11
|
+
export * from "./agentEvaluations.js";
|
|
11
12
|
export * from "./dispatch.js";
|
|
12
13
|
export * from "./email.js";
|
|
13
14
|
export * from "./whatsApp.js";
|
|
@@ -15,4 +16,5 @@ export * from "./voiceEvent.js";
|
|
|
15
16
|
export * from "./insight.js";
|
|
16
17
|
export * from "./engineEvents.js";
|
|
17
18
|
export * from "./billing.js";
|
|
19
|
+
export * from "./phone.js";
|
|
18
20
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schemas/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,cAAc,CAAC;AAC7B,cAAc,YAAY,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/** Input for the strict E.164 phone validator (see `utils/validatePhone.ts`). */
|
|
3
|
+
export declare const phoneNumberSchema: z.ZodObject<{
|
|
4
|
+
phone: z.ZodString;
|
|
5
|
+
}, z.core.$strip>;
|
|
6
|
+
export type ValidatePhoneInput = z.infer<typeof phoneNumberSchema>;
|
|
7
|
+
//# sourceMappingURL=phone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone.d.ts","sourceRoot":"","sources":["../../src/schemas/phone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;AACjF,eAAO,MAAM,iBAAiB;;iBAE5B,CAAC;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phone.js","sourceRoot":"","sources":["../../src/schemas/phone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,iFAAiF;AACjF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC;IACxC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,mBAAmB,CAAC;CAC9C,CAAC,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import type { AgentType } from "../schemas/agentTemplates.js";
|
|
2
|
+
import type { EmailAutopilotAction } from "./email.js";
|
|
3
|
+
/**
|
|
4
|
+
* One turn's graded result, streamed as it happens. `passed` is present only when the
|
|
5
|
+
* turn's `expected` was set (see `evalExpectedSchema`) — a turn with no expectation still
|
|
6
|
+
* streams a result, it just has nothing to grade.
|
|
7
|
+
*/
|
|
8
|
+
export interface EvalStepResult {
|
|
9
|
+
turnIndex: number;
|
|
10
|
+
input: string;
|
|
11
|
+
passed?: boolean;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
/** VOICE_AI (relayed from Fonoster's `stepResult`). */
|
|
14
|
+
aiResponse?: string;
|
|
15
|
+
expectedResponse?: string;
|
|
16
|
+
evaluationType?: "EXACT" | "SIMILAR";
|
|
17
|
+
toolEvaluations?: {
|
|
18
|
+
expectedTool: string;
|
|
19
|
+
actualTool?: string;
|
|
20
|
+
passed: boolean;
|
|
21
|
+
}[];
|
|
22
|
+
/** EMAIL/WHATSAPP (the autopilot decision actually taken). */
|
|
23
|
+
action?: EmailAutopilotAction;
|
|
24
|
+
outcome?: string | null;
|
|
25
|
+
}
|
|
26
|
+
export interface EvalScenarioSummary {
|
|
27
|
+
ref: string;
|
|
28
|
+
overallPassed: boolean;
|
|
29
|
+
}
|
|
30
|
+
/** One event in the `agentEvaluations.evaluate` stream (see the `agent-evaluations` spec). */
|
|
31
|
+
export type EvalEvent = {
|
|
32
|
+
type: "turn";
|
|
33
|
+
scenarioRef: string;
|
|
34
|
+
result: EvalStepResult;
|
|
35
|
+
} | {
|
|
36
|
+
type: "scenarioSummary";
|
|
37
|
+
scenarioRef: string;
|
|
38
|
+
overallPassed: boolean;
|
|
39
|
+
} | {
|
|
40
|
+
type: "summary";
|
|
41
|
+
verdict: "pass" | "fail";
|
|
42
|
+
scenarios: EvalScenarioSummary[];
|
|
43
|
+
} | {
|
|
44
|
+
type: "error";
|
|
45
|
+
message: string;
|
|
46
|
+
};
|
|
47
|
+
/** The row shape `resolveEvalTarget` needs for an existing agent template — base fields
|
|
48
|
+
* plus every channel's child config (only one is ever non-null per row). */
|
|
49
|
+
export interface EvalAgentTemplateRow {
|
|
50
|
+
id: string;
|
|
51
|
+
type: AgentType;
|
|
52
|
+
voiceAiConfig: {
|
|
53
|
+
systemPrompt: string;
|
|
54
|
+
firstMessage: string | null;
|
|
55
|
+
language: string;
|
|
56
|
+
} | null;
|
|
57
|
+
voicePrerecordedConfig: {
|
|
58
|
+
script: string;
|
|
59
|
+
language: string;
|
|
60
|
+
} | null;
|
|
61
|
+
smsConfig: {
|
|
62
|
+
messageBody: string;
|
|
63
|
+
} | null;
|
|
64
|
+
emailConfig: {
|
|
65
|
+
systemPrompt: string;
|
|
66
|
+
messageBody: string;
|
|
67
|
+
maxReplies: number | null;
|
|
68
|
+
} | null;
|
|
69
|
+
whatsAppConfig: {
|
|
70
|
+
systemPrompt: string;
|
|
71
|
+
messageBody: string;
|
|
72
|
+
maxReplies: number | null;
|
|
73
|
+
} | null;
|
|
74
|
+
}
|
|
75
|
+
/** The narrow read port `resolveEvalTarget`/`resolvePreviewTarget` need from Prisma. */
|
|
76
|
+
export interface EvalAgentTemplateClient {
|
|
77
|
+
agentTemplate: {
|
|
78
|
+
findFirstOrThrow(args: {
|
|
79
|
+
where: {
|
|
80
|
+
id: string;
|
|
81
|
+
workspaceRef: string;
|
|
82
|
+
};
|
|
83
|
+
include: {
|
|
84
|
+
voiceAiConfig: true;
|
|
85
|
+
voicePrerecordedConfig: true;
|
|
86
|
+
smsConfig: true;
|
|
87
|
+
emailConfig: true;
|
|
88
|
+
whatsAppConfig: true;
|
|
89
|
+
};
|
|
90
|
+
}): Promise<EvalAgentTemplateRow>;
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=agentEvaluations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentEvaluations.d.ts","sourceRoot":"","sources":["../../src/types/agentEvaluations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAEvD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACrC,eAAe,CAAC,EAAE;QAChB,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,OAAO,CAAC;KACjB,EAAE,CAAC;IACJ,8DAA8D;IAC9D,MAAM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,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,GAAG,IAAI,CAAC;CACjG;AAED,wFAAwF;AACxF,MAAM,WAAW,uBAAuB;IACtC,aAAa,EAAE;QACb,gBAAgB,CAAC,IAAI,EAAE;YACrB,KAAK,EAAE;gBAAE,EAAE,EAAE,MAAM,CAAC;gBAAC,YAAY,EAAE,MAAM,CAAA;aAAE,CAAC;YAC5C,OAAO,EAAE;gBACP,aAAa,EAAE,IAAI,CAAC;gBACpB,sBAAsB,EAAE,IAAI,CAAC;gBAC7B,SAAS,EAAE,IAAI,CAAC;gBAChB,WAAW,EAAE,IAAI,CAAC;gBAClB,cAAc,EAAE,IAAI,CAAC;aACtB,CAAC;SACH,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;KACnC,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentEvaluations.js","sourceRoot":"","sources":["../../src/types/agentEvaluations.ts"],"names":[],"mappings":""}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./userSettings.js";
|
|
|
4
4
|
export * from "./agentTemplates.js";
|
|
5
5
|
export * from "./campaigns.js";
|
|
6
6
|
export * from "./voiceApplication.js";
|
|
7
|
+
export * from "./agentEvaluations.js";
|
|
7
8
|
export * from "./dispatch.js";
|
|
8
9
|
export * from "./email.js";
|
|
9
10
|
export * from "./whatsApp.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
package/dist/types/index.js
CHANGED
|
@@ -4,6 +4,7 @@ export * from "./userSettings.js";
|
|
|
4
4
|
export * from "./agentTemplates.js";
|
|
5
5
|
export * from "./campaigns.js";
|
|
6
6
|
export * from "./voiceApplication.js";
|
|
7
|
+
export * from "./agentEvaluations.js";
|
|
7
8
|
export * from "./dispatch.js";
|
|
8
9
|
export * from "./email.js";
|
|
9
10
|
export * from "./whatsApp.js";
|
package/dist/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,uBAAuB,CAAC;AACtC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
|
|
@@ -17,6 +17,68 @@ export interface VoiceApplicationInput {
|
|
|
17
17
|
/** Language code (e.g. `es`, `en`). */
|
|
18
18
|
language: string;
|
|
19
19
|
}
|
|
20
|
+
/** One scripted turn within a VOICE_AI eval scenario, translated into Fonoster's
|
|
21
|
+
* `conversation[].userInput`/`expected` shape by the client implementation. */
|
|
22
|
+
export interface VoiceApplicationEvalTurn {
|
|
23
|
+
input: string;
|
|
24
|
+
expected?: {
|
|
25
|
+
text?: {
|
|
26
|
+
type: "EXACT" | "SIMILAR";
|
|
27
|
+
response: string;
|
|
28
|
+
};
|
|
29
|
+
tools?: {
|
|
30
|
+
tool: string;
|
|
31
|
+
parameters?: Record<string, unknown>;
|
|
32
|
+
}[];
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
/** One scenario within a VOICE_AI eval run. `account` is the rendered outreach context
|
|
36
|
+
* (see `buildOutreachContext`); the client implementation maps it onto whatever ad-hoc
|
|
37
|
+
* metadata bag the provider expects (Fonoster's `telephonyContext.metadata`). */
|
|
38
|
+
export interface VoiceApplicationEvalScenario {
|
|
39
|
+
ref: string;
|
|
40
|
+
/** Forwarded to Fonoster's required `scenarios[].description`; defaults to `ref` when unset. */
|
|
41
|
+
description?: string;
|
|
42
|
+
account: Record<string, unknown>;
|
|
43
|
+
turns: VoiceApplicationEvalTurn[];
|
|
44
|
+
}
|
|
45
|
+
/** Input to evaluate a `VOICE_AI` agent's conversation logic. No application ref is
|
|
46
|
+
* required — evaluation is inherently ephemeral (see design.md). */
|
|
47
|
+
export interface VoiceApplicationEvalInput {
|
|
48
|
+
systemPrompt: string;
|
|
49
|
+
firstMessage?: string;
|
|
50
|
+
language: string;
|
|
51
|
+
scenarios: VoiceApplicationEvalScenario[];
|
|
52
|
+
}
|
|
53
|
+
/** Mirrors Fonoster's `EvaluateIntelligenceEvent` (`@fonoster/types`), so the apiserver
|
|
54
|
+
* relays it without inventing a parallel shape. */
|
|
55
|
+
export type VoiceApplicationEvalEvent = {
|
|
56
|
+
type: "stepResult";
|
|
57
|
+
scenarioRef: string;
|
|
58
|
+
stepResult: {
|
|
59
|
+
humanInput: string;
|
|
60
|
+
expectedResponse: string;
|
|
61
|
+
aiResponse: string;
|
|
62
|
+
evaluationType: "EXACT" | "SIMILAR";
|
|
63
|
+
passed: boolean;
|
|
64
|
+
errorMessage?: string;
|
|
65
|
+
toolEvaluations?: {
|
|
66
|
+
expectedTool: string;
|
|
67
|
+
actualTool: string;
|
|
68
|
+
passed: boolean;
|
|
69
|
+
expectedParameters?: Record<string, unknown>;
|
|
70
|
+
actualParameters?: Record<string, unknown>;
|
|
71
|
+
errorMessage?: string;
|
|
72
|
+
}[];
|
|
73
|
+
};
|
|
74
|
+
} | {
|
|
75
|
+
type: "scenarioSummary";
|
|
76
|
+
scenarioRef: string;
|
|
77
|
+
overallPassed: boolean;
|
|
78
|
+
} | {
|
|
79
|
+
type: "evalError";
|
|
80
|
+
message: string;
|
|
81
|
+
};
|
|
20
82
|
export interface VoiceApplicationClient {
|
|
21
83
|
/** Create the remote application; resolves with its provider ref. */
|
|
22
84
|
createApplication(input: VoiceApplicationInput): Promise<{
|
|
@@ -28,5 +90,8 @@ export interface VoiceApplicationClient {
|
|
|
28
90
|
}>;
|
|
29
91
|
/** Delete the remote application by ref (best-effort cleanup). */
|
|
30
92
|
deleteApplication(ref: string): Promise<void>;
|
|
93
|
+
/** Evaluate a `VOICE_AI` agent's conversation logic — existing or ephemeral, no
|
|
94
|
+
* application ref required. Streams Fonoster's per-turn/per-scenario events unchanged. */
|
|
95
|
+
evaluate(input: VoiceApplicationEvalInput): AsyncGenerator<VoiceApplicationEvalEvent>;
|
|
31
96
|
}
|
|
32
97
|
//# sourceMappingURL=voiceApplication.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"voiceApplication.d.ts","sourceRoot":"","sources":["../../src/types/voiceApplication.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,KAAK,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,YAAY,EAAE,MAAM,CAAC;IACrB;mFAC+E;IAC/E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,uCAAuC;IACvC,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E,oDAAoD;IACpD,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvF,kEAAkE;IAClE,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"voiceApplication.d.ts","sourceRoot":"","sources":["../../src/types/voiceApplication.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,6EAA6E;AAC7E,MAAM,WAAW,qBAAqB;IACpC,gEAAgE;IAChE,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACv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,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,eAAe,CAAC,EAAE;YAChB,YAAY,EAAE,MAAM,CAAC;YACrB,UAAU,EAAE,MAAM,CAAC;YACnB,MAAM,EAAE,OAAO,CAAC;YAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC7C,gBAAgB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;SACvB,EAAE,CAAC;KACL,CAAC;CACH,GACD;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,OAAO,CAAA;CAAE,GACxE;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3C,MAAM,WAAW,sBAAsB;IACrC,qEAAqE;IACrE,iBAAiB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC1E,oDAAoD;IACpD,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IACvF,kEAAkE;IAClE,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9C;8FAC0F;IAC1F,QAAQ,CAAC,KAAK,EAAE,yBAAyB,GAAG,cAAc,CAAC,yBAAyB,CAAC,CAAC;CACvF"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -3,4 +3,5 @@ export { renderTemplate, extractTemplateTokens, buildOutreachContext, buildAutop
|
|
|
3
3
|
export { localParts, localDateString, isSameLocalDay, localWeekdayISO, localTimeHHMM, isWithinScheduleWindow, type ScheduleWindow } from "./time.js";
|
|
4
4
|
export { bucketOf, perTickCapacity, type PacingBucket } from "./pacing.js";
|
|
5
5
|
export { normalizePhoneE164 } from "./normalizePhone.js";
|
|
6
|
+
export { createValidatePhoneE164 } from "./validatePhone.js";
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,sBAAsB,EACtB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,sBAAsB,EACtB,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -3,4 +3,5 @@ export { renderTemplate, extractTemplateTokens, buildOutreachContext, buildAutop
|
|
|
3
3
|
export { localParts, localDateString, isSameLocalDay, localWeekdayISO, localTimeHHMM, isWithinScheduleWindow } from "./time.js";
|
|
4
4
|
export { bucketOf, perTickCapacity } from "./pacing.js";
|
|
5
5
|
export { normalizePhoneE164 } from "./normalizePhone.js";
|
|
6
|
+
export { createValidatePhoneE164 } from "./validatePhone.js";
|
|
6
7
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,sBAAsB,EAEvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAqB,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EACL,cAAc,EACd,qBAAqB,EACrB,oBAAoB,EACpB,0BAA0B,EAC1B,gBAAgB,EAChB,YAAY,EACZ,sBAAsB,EACvB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,UAAU,EACV,eAAe,EACf,cAAc,EACd,eAAe,EACf,aAAa,EACb,sBAAsB,EAEvB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAqB,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Strict, throwing E.164 phone validator for input boundaries — account/CSV import today,
|
|
3
|
+
* any future write path that persists a phone number tomorrow. A fresh implementation for
|
|
4
|
+
* this repo (not ported from mikro, a separate repo), layered on top of the lenient,
|
|
5
|
+
* non-throwing `normalizePhoneE164` (PR #62), which stays as-is for best-effort
|
|
6
|
+
* inbound-webhook matching where "doesn't parse" must mean "no match," not a crash.
|
|
7
|
+
*
|
|
8
|
+
* Built as a validated function (factory + Zod schema + `withErrorHandlingAndValidation`)
|
|
9
|
+
* per this repo's convention for input-validating operations — even with no injected
|
|
10
|
+
* dependencies, this keeps the thrown error a structured `ValidationError` (the same shape
|
|
11
|
+
* every other write-boundary in this codebase throws), so callers don't need a special case
|
|
12
|
+
* for phone numbers specifically.
|
|
13
|
+
*/
|
|
14
|
+
export declare function createValidatePhoneE164(): (params: unknown) => Promise<string>;
|
|
15
|
+
//# sourceMappingURL=validatePhone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatePhone.d.ts","sourceRoot":"","sources":["../../src/utils/validatePhone.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,yCAiBtC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ValidationError } from "../errors/ValidationError.js";
|
|
3
|
+
import { phoneNumberSchema } from "../schemas/phone.js";
|
|
4
|
+
import { withErrorHandlingAndValidation } from "./withErrorHandlingAndValidation.js";
|
|
5
|
+
import { normalizePhoneE164 } from "./normalizePhone.js";
|
|
6
|
+
/**
|
|
7
|
+
* Strict, throwing E.164 phone validator for input boundaries — account/CSV import today,
|
|
8
|
+
* any future write path that persists a phone number tomorrow. A fresh implementation for
|
|
9
|
+
* this repo (not ported from mikro, a separate repo), layered on top of the lenient,
|
|
10
|
+
* non-throwing `normalizePhoneE164` (PR #62), which stays as-is for best-effort
|
|
11
|
+
* inbound-webhook matching where "doesn't parse" must mean "no match," not a crash.
|
|
12
|
+
*
|
|
13
|
+
* Built as a validated function (factory + Zod schema + `withErrorHandlingAndValidation`)
|
|
14
|
+
* per this repo's convention for input-validating operations — even with no injected
|
|
15
|
+
* dependencies, this keeps the thrown error a structured `ValidationError` (the same shape
|
|
16
|
+
* every other write-boundary in this codebase throws), so callers don't need a special case
|
|
17
|
+
* for phone numbers specifically.
|
|
18
|
+
*/
|
|
19
|
+
export function createValidatePhoneE164() {
|
|
20
|
+
const fn = async ({ phone }) => {
|
|
21
|
+
const normalized = normalizePhoneE164(phone);
|
|
22
|
+
if (normalized)
|
|
23
|
+
return normalized;
|
|
24
|
+
throw new ValidationError(new z.ZodError([
|
|
25
|
+
{
|
|
26
|
+
code: z.ZodIssueCode.custom,
|
|
27
|
+
message: `"${phone}" is not a valid phone number`,
|
|
28
|
+
path: ["phone"]
|
|
29
|
+
}
|
|
30
|
+
]));
|
|
31
|
+
};
|
|
32
|
+
return withErrorHandlingAndValidation(fn, phoneNumberSchema);
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=validatePhone.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validatePhone.js","sourceRoot":"","sources":["../../src/utils/validatePhone.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAA2B,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AACrF,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,uBAAuB;IACrC,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,EAAsB,EAAmB,EAAE;QAClE,MAAM,UAAU,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;QAC7C,IAAI,UAAU;YAAE,OAAO,UAAU,CAAC;QAElC,MAAM,IAAI,eAAe,CACvB,IAAI,CAAC,CAAC,QAAQ,CAAC;YACb;gBACE,IAAI,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM;gBAC3B,OAAO,EAAE,IAAI,KAAK,+BAA+B;gBACjD,IAAI,EAAE,CAAC,OAAO,CAAC;aAChB;SACF,CAAC,CACH,CAAC;IACJ,CAAC,CAAC;IAEF,OAAO,8BAA8B,CAAC,EAAE,EAAE,iBAAiB,CAAC,CAAC;AAC/D,CAAC"}
|