@roarkanalytics/sdk 2.30.0 → 2.33.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.
Files changed (245) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/api-promise.d.mts +1 -0
  3. package/api-promise.d.mts.map +1 -1
  4. package/api-promise.d.ts +1 -0
  5. package/api-promise.d.ts.map +1 -1
  6. package/api-promise.mjs +1 -0
  7. package/api-promise.mjs.map +1 -1
  8. package/client.d.mts +17 -5
  9. package/client.d.mts.map +1 -1
  10. package/client.d.ts +17 -5
  11. package/client.d.ts.map +1 -1
  12. package/client.js +35 -4
  13. package/client.js.map +1 -1
  14. package/client.mjs +35 -4
  15. package/client.mjs.map +1 -1
  16. package/core/api-promise.d.mts.map +1 -1
  17. package/core/api-promise.d.ts.map +1 -1
  18. package/core/api-promise.mjs.map +1 -1
  19. package/core/error.mjs.map +1 -1
  20. package/core/resource.d.mts.map +1 -1
  21. package/core/resource.d.ts.map +1 -1
  22. package/core/uploads.d.mts.map +1 -1
  23. package/core/uploads.d.ts.map +1 -1
  24. package/core/uploads.mjs.map +1 -1
  25. package/error.d.mts +1 -0
  26. package/error.d.mts.map +1 -1
  27. package/error.d.ts +1 -0
  28. package/error.d.ts.map +1 -1
  29. package/error.mjs +1 -0
  30. package/error.mjs.map +1 -1
  31. package/index.d.mts.map +1 -1
  32. package/index.d.ts.map +1 -1
  33. package/index.mjs.map +1 -1
  34. package/internal/detect-platform.mjs.map +1 -1
  35. package/internal/headers.mjs.map +1 -1
  36. package/internal/parse.d.mts.map +1 -1
  37. package/internal/parse.d.ts.map +1 -1
  38. package/internal/parse.mjs.map +1 -1
  39. package/internal/qs/formats.d.mts.map +1 -1
  40. package/internal/qs/formats.d.ts.map +1 -1
  41. package/internal/qs/index.d.mts +2 -2
  42. package/internal/qs/index.d.mts.map +1 -1
  43. package/internal/qs/index.d.ts +2 -2
  44. package/internal/qs/index.d.ts.map +1 -1
  45. package/internal/qs/index.mjs.map +1 -1
  46. package/internal/qs/stringify.d.mts.map +1 -1
  47. package/internal/qs/stringify.d.ts.map +1 -1
  48. package/internal/qs/stringify.mjs.map +1 -1
  49. package/internal/qs/utils.d.mts.map +1 -1
  50. package/internal/qs/utils.d.ts.map +1 -1
  51. package/internal/qs/utils.mjs.map +1 -1
  52. package/internal/request-options.d.mts.map +1 -1
  53. package/internal/request-options.d.ts.map +1 -1
  54. package/internal/shims.d.mts +6 -0
  55. package/internal/shims.d.mts.map +1 -1
  56. package/internal/shims.d.ts +6 -0
  57. package/internal/shims.d.ts.map +1 -1
  58. package/internal/to-file.d.mts.map +1 -1
  59. package/internal/to-file.d.ts.map +1 -1
  60. package/internal/to-file.mjs.map +1 -1
  61. package/internal/types.d.mts +10 -10
  62. package/internal/types.d.mts.map +1 -1
  63. package/internal/types.d.ts +10 -10
  64. package/internal/types.d.ts.map +1 -1
  65. package/internal/uploads.d.mts.map +1 -1
  66. package/internal/uploads.d.ts.map +1 -1
  67. package/internal/uploads.mjs.map +1 -1
  68. package/internal/utils/base64.mjs.map +1 -1
  69. package/internal/utils/log.d.mts.map +1 -1
  70. package/internal/utils/log.d.ts.map +1 -1
  71. package/internal/utils/log.js +2 -0
  72. package/internal/utils/log.js.map +1 -1
  73. package/internal/utils/log.mjs +2 -0
  74. package/internal/utils/log.mjs.map +1 -1
  75. package/internal/utils/path.mjs.map +1 -1
  76. package/internal/utils/query.mjs.map +1 -1
  77. package/internal/utils/values.mjs.map +1 -1
  78. package/internal/utils.d.mts.map +1 -1
  79. package/internal/utils.d.ts.map +1 -1
  80. package/internal/utils.mjs.map +1 -1
  81. package/package.json +1 -1
  82. package/resource.d.mts +1 -0
  83. package/resource.d.mts.map +1 -1
  84. package/resource.d.ts +1 -0
  85. package/resource.d.ts.map +1 -1
  86. package/resource.mjs +1 -0
  87. package/resource.mjs.map +1 -1
  88. package/resources/agent-endpoint.d.mts +4 -4
  89. package/resources/agent-endpoint.d.mts.map +1 -1
  90. package/resources/agent-endpoint.d.ts +4 -4
  91. package/resources/agent-endpoint.d.ts.map +1 -1
  92. package/resources/agent-endpoint.mjs.map +1 -1
  93. package/resources/agent.d.mts.map +1 -1
  94. package/resources/agent.d.ts.map +1 -1
  95. package/resources/agent.mjs.map +1 -1
  96. package/resources/call.d.mts +310 -162
  97. package/resources/call.d.mts.map +1 -1
  98. package/resources/call.d.ts +310 -162
  99. package/resources/call.d.ts.map +1 -1
  100. package/resources/call.js +6 -7
  101. package/resources/call.js.map +1 -1
  102. package/resources/call.mjs +6 -7
  103. package/resources/call.mjs.map +1 -1
  104. package/resources/config.d.mts +535 -0
  105. package/resources/config.d.mts.map +1 -0
  106. package/resources/config.d.ts +535 -0
  107. package/resources/config.d.ts.map +1 -0
  108. package/resources/config.js +28 -0
  109. package/resources/config.js.map +1 -0
  110. package/resources/config.mjs +24 -0
  111. package/resources/config.mjs.map +1 -0
  112. package/resources/customer-flow-edge-case.d.mts +1742 -0
  113. package/resources/customer-flow-edge-case.d.mts.map +1 -0
  114. package/resources/customer-flow-edge-case.d.ts +1742 -0
  115. package/resources/customer-flow-edge-case.d.ts.map +1 -0
  116. package/resources/customer-flow-edge-case.js +50 -0
  117. package/resources/customer-flow-edge-case.js.map +1 -0
  118. package/resources/customer-flow-edge-case.mjs +46 -0
  119. package/resources/customer-flow-edge-case.mjs.map +1 -0
  120. package/resources/customer-flow.d.mts +7163 -0
  121. package/resources/customer-flow.d.mts.map +1 -0
  122. package/resources/customer-flow.d.ts +7163 -0
  123. package/resources/customer-flow.d.ts.map +1 -0
  124. package/resources/customer-flow.js +87 -0
  125. package/resources/customer-flow.js.map +1 -0
  126. package/resources/customer-flow.mjs +83 -0
  127. package/resources/customer-flow.mjs.map +1 -0
  128. package/resources/health.d.mts.map +1 -1
  129. package/resources/health.d.ts.map +1 -1
  130. package/resources/health.mjs.map +1 -1
  131. package/resources/http-request-definition.d.mts.map +1 -1
  132. package/resources/http-request-definition.d.ts.map +1 -1
  133. package/resources/http-request-definition.mjs.map +1 -1
  134. package/resources/index.d.mts +6 -2
  135. package/resources/index.d.mts.map +1 -1
  136. package/resources/index.d.ts +6 -2
  137. package/resources/index.d.ts.map +1 -1
  138. package/resources/index.js +11 -3
  139. package/resources/index.js.map +1 -1
  140. package/resources/index.mjs +5 -1
  141. package/resources/index.mjs.map +1 -1
  142. package/resources/metric-collection-job.d.mts +5 -3
  143. package/resources/metric-collection-job.d.mts.map +1 -1
  144. package/resources/metric-collection-job.d.ts +5 -3
  145. package/resources/metric-collection-job.d.ts.map +1 -1
  146. package/resources/metric-collection-job.mjs.map +1 -1
  147. package/resources/metric-policy.d.mts.map +1 -1
  148. package/resources/metric-policy.d.ts.map +1 -1
  149. package/resources/metric-policy.mjs.map +1 -1
  150. package/resources/metric.d.mts +804 -109
  151. package/resources/metric.d.mts.map +1 -1
  152. package/resources/metric.d.ts +804 -109
  153. package/resources/metric.d.ts.map +1 -1
  154. package/resources/metric.js +6 -7
  155. package/resources/metric.js.map +1 -1
  156. package/resources/metric.mjs +6 -7
  157. package/resources/metric.mjs.map +1 -1
  158. package/resources/simulation-environment.d.mts +95 -0
  159. package/resources/simulation-environment.d.mts.map +1 -0
  160. package/resources/simulation-environment.d.ts +95 -0
  161. package/resources/simulation-environment.d.ts.map +1 -0
  162. package/resources/simulation-environment.js +24 -0
  163. package/resources/simulation-environment.js.map +1 -0
  164. package/resources/simulation-environment.mjs +20 -0
  165. package/resources/simulation-environment.mjs.map +1 -0
  166. package/resources/simulation-job.d.mts +58 -10
  167. package/resources/simulation-job.d.mts.map +1 -1
  168. package/resources/simulation-job.d.ts +58 -10
  169. package/resources/simulation-job.d.ts.map +1 -1
  170. package/resources/simulation-job.mjs.map +1 -1
  171. package/resources/simulation-persona.d.mts +60 -24
  172. package/resources/simulation-persona.d.mts.map +1 -1
  173. package/resources/simulation-persona.d.ts +60 -24
  174. package/resources/simulation-persona.d.ts.map +1 -1
  175. package/resources/simulation-persona.mjs.map +1 -1
  176. package/resources/simulation-run-plan-job.d.mts +73 -32
  177. package/resources/simulation-run-plan-job.d.mts.map +1 -1
  178. package/resources/simulation-run-plan-job.d.ts +73 -32
  179. package/resources/simulation-run-plan-job.d.ts.map +1 -1
  180. package/resources/simulation-run-plan-job.js +7 -8
  181. package/resources/simulation-run-plan-job.js.map +1 -1
  182. package/resources/simulation-run-plan-job.mjs +7 -8
  183. package/resources/simulation-run-plan-job.mjs.map +1 -1
  184. package/resources/simulation-run-plan.d.mts +408 -39
  185. package/resources/simulation-run-plan.d.mts.map +1 -1
  186. package/resources/simulation-run-plan.d.ts +408 -39
  187. package/resources/simulation-run-plan.d.ts.map +1 -1
  188. package/resources/simulation-run-plan.js +6 -11
  189. package/resources/simulation-run-plan.js.map +1 -1
  190. package/resources/simulation-run-plan.mjs +6 -11
  191. package/resources/simulation-run-plan.mjs.map +1 -1
  192. package/resources/simulation.d.mts +379 -0
  193. package/resources/simulation.d.mts.map +1 -0
  194. package/resources/simulation.d.ts +379 -0
  195. package/resources/simulation.d.ts.map +1 -0
  196. package/resources/simulation.js +33 -0
  197. package/resources/simulation.js.map +1 -0
  198. package/resources/simulation.mjs +29 -0
  199. package/resources/simulation.mjs.map +1 -0
  200. package/resources/webhook.d.mts +4 -4
  201. package/resources/webhook.d.mts.map +1 -1
  202. package/resources/webhook.d.ts +4 -4
  203. package/resources/webhook.d.ts.map +1 -1
  204. package/resources/webhook.mjs.map +1 -1
  205. package/resources.d.mts.map +1 -1
  206. package/resources.d.ts.map +1 -1
  207. package/resources.mjs.map +1 -1
  208. package/src/client.ts +124 -28
  209. package/src/internal/types.ts +6 -8
  210. package/src/internal/utils/log.ts +2 -0
  211. package/src/resources/agent-endpoint.ts +36 -4
  212. package/src/resources/call.ts +333 -176
  213. package/src/resources/config.ts +1162 -0
  214. package/src/resources/customer-flow-edge-case.ts +2884 -0
  215. package/src/resources/customer-flow.ts +11713 -0
  216. package/src/resources/index.ts +42 -12
  217. package/src/resources/metric-collection-job.ts +5 -3
  218. package/src/resources/metric.ts +1057 -115
  219. package/src/resources/simulation-environment.ts +147 -0
  220. package/src/resources/simulation-job.ts +122 -10
  221. package/src/resources/simulation-persona.ts +192 -24
  222. package/src/resources/simulation-run-plan-job.ts +109 -27
  223. package/src/resources/simulation-run-plan.ts +445 -40
  224. package/src/resources/simulation.ts +444 -0
  225. package/src/resources/webhook.ts +8 -0
  226. package/src/version.ts +1 -1
  227. package/uploads.d.mts +1 -0
  228. package/uploads.d.mts.map +1 -1
  229. package/uploads.d.ts +1 -0
  230. package/uploads.d.ts.map +1 -1
  231. package/uploads.mjs +1 -0
  232. package/uploads.mjs.map +1 -1
  233. package/version.d.mts +1 -1
  234. package/version.d.ts +1 -1
  235. package/version.js +1 -1
  236. package/version.mjs +1 -1
  237. package/resources/simulation-scenario.d.mts +0 -424
  238. package/resources/simulation-scenario.d.mts.map +0 -1
  239. package/resources/simulation-scenario.d.ts +0 -424
  240. package/resources/simulation-scenario.d.ts.map +0 -1
  241. package/resources/simulation-scenario.js +0 -40
  242. package/resources/simulation-scenario.js.map +0 -1
  243. package/resources/simulation-scenario.mjs +0 -36
  244. package/resources/simulation-scenario.mjs.map +0 -1
  245. package/src/resources/simulation-scenario.ts +0 -602
@@ -3,13 +3,17 @@ import { APIPromise } from "../core/api-promise.js";
3
3
  import { RequestOptions } from "../internal/request-options.js";
4
4
  export declare class Metric extends APIResource {
5
5
  /**
6
- * Create a new custom metric definition. The metric will be added to the specified
7
- * analysis package and can be used for evaluating calls.
6
+ * Create a new metric definition. The `calculationType` field selects the variant:
7
+ * LLM_JUDGE (LLM-evaluated), FORMULA (computed from a math expression over other
8
+ * metrics), or PATTERN (detects a trigger→outcome pattern within a window). To
9
+ * create a threshold on top of an existing metric, use
10
+ * `POST /metric/definitions/{idOrSlug}/thresholds` instead.
8
11
  *
9
12
  * @example
10
13
  * ```ts
11
14
  * const response = await client.metric.createDefinition({
12
15
  * analysisPackageId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
16
+ * calculationType: 'LLM_JUDGE',
13
17
  * name: 'Customer Satisfaction',
14
18
  * outputType: 'BOOLEAN',
15
19
  * });
@@ -19,35 +23,31 @@ export declare class Metric extends APIResource {
19
23
  /**
20
24
  * Fetch all metric definitions available in the project, including both
21
25
  * system-generated and custom metrics.
22
- *
23
- * @example
24
- * ```ts
25
- * const response = await client.metric.listDefinitions();
26
- * ```
27
26
  */
28
27
  listDefinitions(options?: RequestOptions): APIPromise<MetricListDefinitionsResponse>;
29
28
  }
30
29
  export interface MetricCreateDefinitionResponse {
31
30
  /**
32
- * Metric definition data
31
+ * The created metric definition. The variant is selected by `calculationType`.
33
32
  */
34
- data: MetricCreateDefinitionResponse.Data;
33
+ data: MetricCreateDefinitionResponse.LlmJudgeMetricResponse | MetricCreateDefinitionResponse.FormulaMetricResponse | MetricCreateDefinitionResponse.PatternMetricResponse;
35
34
  }
36
35
  export declare namespace MetricCreateDefinitionResponse {
37
- /**
38
- * Metric definition data
39
- */
40
- interface Data {
36
+ interface LlmJudgeMetricResponse {
41
37
  /**
42
38
  * Unique identifier for the metric definition
43
39
  */
44
40
  id: string;
41
+ /**
42
+ * Metric evaluated by an LLM against a prompt.
43
+ */
44
+ calculationType: 'LLM_JUDGE';
45
45
  /**
46
46
  * Description of what the metric measures
47
47
  */
48
48
  description: string;
49
49
  /**
50
- * Stable metric identifier (e.g. "call_reason", "customer_satisfaction")
50
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
51
51
  */
52
52
  metricId: string;
53
53
  /**
@@ -58,6 +58,10 @@ export declare namespace MetricCreateDefinitionResponse {
58
58
  * Whether metric is global or per-participant
59
59
  */
60
60
  scope: 'GLOBAL' | 'PER_PARTICIPANT';
61
+ /**
62
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
63
+ */
64
+ slug: string;
61
65
  /**
62
66
  * Which levels this metric can produce values at
63
67
  */
@@ -66,12 +70,208 @@ export declare namespace MetricCreateDefinitionResponse {
66
70
  * Type of value this metric produces
67
71
  */
68
72
  type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
73
+ /**
74
+ * The resolved variant this response reflects (org-scoped Default if the org has
75
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
76
+ * building a derived metric off this one to pin the exact config.
77
+ */
78
+ variantId: string;
79
+ /**
80
+ * The variant's current version. Immutable snapshot of the config — editing the
81
+ * metric produces a new versionId. Use it to detect config changes.
82
+ */
83
+ versionId: string;
84
+ /**
85
+ * Unit information if applicable
86
+ */
87
+ unit?: LlmJudgeMetricResponse.Unit;
88
+ }
89
+ namespace LlmJudgeMetricResponse {
90
+ /**
91
+ * Unit information if applicable
92
+ */
93
+ interface Unit {
94
+ /**
95
+ * Name of the unit
96
+ */
97
+ name: string;
98
+ /**
99
+ * Symbol for the unit
100
+ */
101
+ symbol: string | null;
102
+ }
103
+ }
104
+ interface FormulaMetricResponse {
105
+ /**
106
+ * Unique identifier for the metric definition
107
+ */
108
+ id: string;
109
+ /**
110
+ * Metric computed by evaluating an expression over other metrics.
111
+ */
112
+ calculationType: 'FORMULA';
113
+ /**
114
+ * Description of what the metric measures
115
+ */
116
+ description: string;
117
+ /**
118
+ * Formula configuration.
119
+ */
120
+ formula: FormulaMetricResponse.Formula;
121
+ /**
122
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
123
+ */
124
+ metricId: string;
125
+ /**
126
+ * Name of the metric
127
+ */
128
+ name: string;
129
+ /**
130
+ * Whether metric is global or per-participant
131
+ */
132
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
133
+ /**
134
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
135
+ */
136
+ slug: string;
137
+ /**
138
+ * Which levels this metric can produce values at
139
+ */
140
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
141
+ /**
142
+ * Type of value this metric produces
143
+ */
144
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
145
+ /**
146
+ * The resolved variant this response reflects (org-scoped Default if the org has
147
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
148
+ * building a derived metric off this one to pin the exact config.
149
+ */
150
+ variantId: string;
151
+ /**
152
+ * The variant's current version. Immutable snapshot of the config — editing the
153
+ * metric produces a new versionId. Use it to detect config changes.
154
+ */
155
+ versionId: string;
156
+ /**
157
+ * Unit information if applicable
158
+ */
159
+ unit?: FormulaMetricResponse.Unit;
160
+ }
161
+ namespace FormulaMetricResponse {
162
+ /**
163
+ * Formula configuration.
164
+ */
165
+ interface Formula {
166
+ expression: string;
167
+ sources: Array<Formula.Source>;
168
+ }
169
+ namespace Formula {
170
+ interface Source {
171
+ sourceMetricDefinitionId: string;
172
+ sourceVariantId: string | null;
173
+ }
174
+ }
175
+ /**
176
+ * Unit information if applicable
177
+ */
178
+ interface Unit {
179
+ /**
180
+ * Name of the unit
181
+ */
182
+ name: string;
183
+ /**
184
+ * Symbol for the unit
185
+ */
186
+ symbol: string | null;
187
+ }
188
+ }
189
+ interface PatternMetricResponse {
190
+ /**
191
+ * Unique identifier for the metric definition
192
+ */
193
+ id: string;
194
+ /**
195
+ * Metric detecting a trigger condition followed by an outcome within a window.
196
+ */
197
+ calculationType: 'PATTERN';
198
+ /**
199
+ * Description of what the metric measures
200
+ */
201
+ description: string;
202
+ /**
203
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
204
+ */
205
+ metricId: string;
206
+ /**
207
+ * Name of the metric
208
+ */
209
+ name: string;
210
+ /**
211
+ * Pattern configuration.
212
+ */
213
+ pattern: PatternMetricResponse.Pattern;
214
+ /**
215
+ * Whether metric is global or per-participant
216
+ */
217
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
218
+ /**
219
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
220
+ */
221
+ slug: string;
222
+ /**
223
+ * Which levels this metric can produce values at
224
+ */
225
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
226
+ /**
227
+ * Type of value this metric produces
228
+ */
229
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
230
+ /**
231
+ * The resolved variant this response reflects (org-scoped Default if the org has
232
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
233
+ * building a derived metric off this one to pin the exact config.
234
+ */
235
+ variantId: string;
236
+ /**
237
+ * The variant's current version. Immutable snapshot of the config — editing the
238
+ * metric produces a new versionId. Use it to detect config changes.
239
+ */
240
+ versionId: string;
69
241
  /**
70
242
  * Unit information if applicable
71
243
  */
72
- unit?: Data.Unit;
244
+ unit?: PatternMetricResponse.Unit;
73
245
  }
74
- namespace Data {
246
+ namespace PatternMetricResponse {
247
+ /**
248
+ * Pattern configuration.
249
+ */
250
+ interface Pattern {
251
+ operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
252
+ outcome: Pattern.Outcome | null;
253
+ triggerCombinator: 'AND' | 'OR' | null;
254
+ triggers: Array<Pattern.Trigger>;
255
+ windowMode: string | null;
256
+ }
257
+ namespace Pattern {
258
+ interface Outcome {
259
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
260
+ sourceMetricDefinitionId: string;
261
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
262
+ sourceVariantId: string | null;
263
+ thresholdValue: string;
264
+ windowAfter: number | null;
265
+ windowBefore: number | null;
266
+ }
267
+ interface Trigger {
268
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
269
+ sourceMetricDefinitionId: string;
270
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
271
+ sourceVariantId: string | null;
272
+ thresholdValue: string;
273
+ }
274
+ }
75
275
  /**
76
276
  * Unit information if applicable
77
277
  */
@@ -91,23 +291,24 @@ export interface MetricListDefinitionsResponse {
91
291
  /**
92
292
  * Metrics response payload
93
293
  */
94
- data: Array<MetricListDefinitionsResponse.Data>;
294
+ data: Array<MetricListDefinitionsResponse.LlmJudgeMetricResponse | MetricListDefinitionsResponse.ProviderMetricResponse | MetricListDefinitionsResponse.ThresholdMetricResponse | MetricListDefinitionsResponse.FormulaMetricResponse | MetricListDefinitionsResponse.PatternMetricResponse>;
95
295
  }
96
296
  export declare namespace MetricListDefinitionsResponse {
97
- /**
98
- * Metric definition data
99
- */
100
- interface Data {
297
+ interface LlmJudgeMetricResponse {
101
298
  /**
102
299
  * Unique identifier for the metric definition
103
300
  */
104
301
  id: string;
302
+ /**
303
+ * Metric evaluated by an LLM against a prompt.
304
+ */
305
+ calculationType: 'LLM_JUDGE';
105
306
  /**
106
307
  * Description of what the metric measures
107
308
  */
108
309
  description: string;
109
310
  /**
110
- * Stable metric identifier (e.g. "call_reason", "customer_satisfaction")
311
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
111
312
  */
112
313
  metricId: string;
113
314
  /**
@@ -118,6 +319,10 @@ export declare namespace MetricListDefinitionsResponse {
118
319
  * Whether metric is global or per-participant
119
320
  */
120
321
  scope: 'GLOBAL' | 'PER_PARTICIPANT';
322
+ /**
323
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
324
+ */
325
+ slug: string;
121
326
  /**
122
327
  * Which levels this metric can produce values at
123
328
  */
@@ -126,12 +331,360 @@ export declare namespace MetricListDefinitionsResponse {
126
331
  * Type of value this metric produces
127
332
  */
128
333
  type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
334
+ /**
335
+ * The resolved variant this response reflects (org-scoped Default if the org has
336
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
337
+ * building a derived metric off this one to pin the exact config.
338
+ */
339
+ variantId: string;
340
+ /**
341
+ * The variant's current version. Immutable snapshot of the config — editing the
342
+ * metric produces a new versionId. Use it to detect config changes.
343
+ */
344
+ versionId: string;
129
345
  /**
130
346
  * Unit information if applicable
131
347
  */
132
- unit?: Data.Unit;
348
+ unit?: LlmJudgeMetricResponse.Unit;
133
349
  }
134
- namespace Data {
350
+ namespace LlmJudgeMetricResponse {
351
+ /**
352
+ * Unit information if applicable
353
+ */
354
+ interface Unit {
355
+ /**
356
+ * Name of the unit
357
+ */
358
+ name: string;
359
+ /**
360
+ * Symbol for the unit
361
+ */
362
+ symbol: string | null;
363
+ }
364
+ }
365
+ interface ProviderMetricResponse {
366
+ /**
367
+ * Unique identifier for the metric definition
368
+ */
369
+ id: string;
370
+ /**
371
+ * System-managed metric produced by an analysis provider.
372
+ */
373
+ calculationType: 'PROVIDER';
374
+ /**
375
+ * Description of what the metric measures
376
+ */
377
+ description: string;
378
+ /**
379
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
380
+ */
381
+ metricId: string;
382
+ /**
383
+ * Name of the metric
384
+ */
385
+ name: string;
386
+ /**
387
+ * Whether metric is global or per-participant
388
+ */
389
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
390
+ /**
391
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
392
+ */
393
+ slug: string;
394
+ /**
395
+ * Which levels this metric can produce values at
396
+ */
397
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
398
+ /**
399
+ * Type of value this metric produces
400
+ */
401
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
402
+ /**
403
+ * The resolved variant this response reflects (org-scoped Default if the org has
404
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
405
+ * building a derived metric off this one to pin the exact config.
406
+ */
407
+ variantId: string;
408
+ /**
409
+ * The variant's current version. Immutable snapshot of the config — editing the
410
+ * metric produces a new versionId. Use it to detect config changes.
411
+ */
412
+ versionId: string;
413
+ /**
414
+ * Unit information if applicable
415
+ */
416
+ unit?: ProviderMetricResponse.Unit;
417
+ }
418
+ namespace ProviderMetricResponse {
419
+ /**
420
+ * Unit information if applicable
421
+ */
422
+ interface Unit {
423
+ /**
424
+ * Name of the unit
425
+ */
426
+ name: string;
427
+ /**
428
+ * Symbol for the unit
429
+ */
430
+ symbol: string | null;
431
+ }
432
+ }
433
+ interface ThresholdMetricResponse {
434
+ /**
435
+ * Unique identifier for the metric definition
436
+ */
437
+ id: string;
438
+ /**
439
+ * Boolean metric derived by comparing a source metric against a threshold.
440
+ */
441
+ calculationType: 'THRESHOLD';
442
+ /**
443
+ * Description of what the metric measures
444
+ */
445
+ description: string;
446
+ /**
447
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
448
+ */
449
+ metricId: string;
450
+ /**
451
+ * Name of the metric
452
+ */
453
+ name: string;
454
+ /**
455
+ * Whether metric is global or per-participant
456
+ */
457
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
458
+ /**
459
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
460
+ */
461
+ slug: string;
462
+ /**
463
+ * Which levels this metric can produce values at
464
+ */
465
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
466
+ /**
467
+ * Type of value this metric produces
468
+ */
469
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
470
+ /**
471
+ * The resolved variant this response reflects (org-scoped Default if the org has
472
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
473
+ * building a derived metric off this one to pin the exact config.
474
+ */
475
+ variantId: string;
476
+ /**
477
+ * The variant's current version. Immutable snapshot of the config — editing the
478
+ * metric produces a new versionId. Use it to detect config changes.
479
+ */
480
+ versionId: string;
481
+ /**
482
+ * Threshold configuration.
483
+ */
484
+ threshold?: ThresholdMetricResponse.Threshold;
485
+ /**
486
+ * Unit information if applicable
487
+ */
488
+ unit?: ThresholdMetricResponse.Unit;
489
+ }
490
+ namespace ThresholdMetricResponse {
491
+ /**
492
+ * Threshold configuration.
493
+ */
494
+ interface Threshold {
495
+ aggregationMode: 'EACH' | 'COUNT' | 'AVERAGE' | 'MIN' | 'MAX' | 'MEDIAN' | 'P95' | 'P99' | 'SUM';
496
+ countThreshold: number | null;
497
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
498
+ sourceMetricDefinitionId: string;
499
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
500
+ sourceVariantId: string | null;
501
+ thresholdValue: string;
502
+ }
503
+ /**
504
+ * Unit information if applicable
505
+ */
506
+ interface Unit {
507
+ /**
508
+ * Name of the unit
509
+ */
510
+ name: string;
511
+ /**
512
+ * Symbol for the unit
513
+ */
514
+ symbol: string | null;
515
+ }
516
+ }
517
+ interface FormulaMetricResponse {
518
+ /**
519
+ * Unique identifier for the metric definition
520
+ */
521
+ id: string;
522
+ /**
523
+ * Metric computed by evaluating an expression over other metrics.
524
+ */
525
+ calculationType: 'FORMULA';
526
+ /**
527
+ * Description of what the metric measures
528
+ */
529
+ description: string;
530
+ /**
531
+ * Formula configuration.
532
+ */
533
+ formula: FormulaMetricResponse.Formula;
534
+ /**
535
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
536
+ */
537
+ metricId: string;
538
+ /**
539
+ * Name of the metric
540
+ */
541
+ name: string;
542
+ /**
543
+ * Whether metric is global or per-participant
544
+ */
545
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
546
+ /**
547
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
548
+ */
549
+ slug: string;
550
+ /**
551
+ * Which levels this metric can produce values at
552
+ */
553
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
554
+ /**
555
+ * Type of value this metric produces
556
+ */
557
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
558
+ /**
559
+ * The resolved variant this response reflects (org-scoped Default if the org has
560
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
561
+ * building a derived metric off this one to pin the exact config.
562
+ */
563
+ variantId: string;
564
+ /**
565
+ * The variant's current version. Immutable snapshot of the config — editing the
566
+ * metric produces a new versionId. Use it to detect config changes.
567
+ */
568
+ versionId: string;
569
+ /**
570
+ * Unit information if applicable
571
+ */
572
+ unit?: FormulaMetricResponse.Unit;
573
+ }
574
+ namespace FormulaMetricResponse {
575
+ /**
576
+ * Formula configuration.
577
+ */
578
+ interface Formula {
579
+ expression: string;
580
+ sources: Array<Formula.Source>;
581
+ }
582
+ namespace Formula {
583
+ interface Source {
584
+ sourceMetricDefinitionId: string;
585
+ sourceVariantId: string | null;
586
+ }
587
+ }
588
+ /**
589
+ * Unit information if applicable
590
+ */
591
+ interface Unit {
592
+ /**
593
+ * Name of the unit
594
+ */
595
+ name: string;
596
+ /**
597
+ * Symbol for the unit
598
+ */
599
+ symbol: string | null;
600
+ }
601
+ }
602
+ interface PatternMetricResponse {
603
+ /**
604
+ * Unique identifier for the metric definition
605
+ */
606
+ id: string;
607
+ /**
608
+ * Metric detecting a trigger condition followed by an outcome within a window.
609
+ */
610
+ calculationType: 'PATTERN';
611
+ /**
612
+ * Description of what the metric measures
613
+ */
614
+ description: string;
615
+ /**
616
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
617
+ */
618
+ metricId: string;
619
+ /**
620
+ * Name of the metric
621
+ */
622
+ name: string;
623
+ /**
624
+ * Pattern configuration.
625
+ */
626
+ pattern: PatternMetricResponse.Pattern;
627
+ /**
628
+ * Whether metric is global or per-participant
629
+ */
630
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
631
+ /**
632
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
633
+ */
634
+ slug: string;
635
+ /**
636
+ * Which levels this metric can produce values at
637
+ */
638
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
639
+ /**
640
+ * Type of value this metric produces
641
+ */
642
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
643
+ /**
644
+ * The resolved variant this response reflects (org-scoped Default if the org has
645
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
646
+ * building a derived metric off this one to pin the exact config.
647
+ */
648
+ variantId: string;
649
+ /**
650
+ * The variant's current version. Immutable snapshot of the config — editing the
651
+ * metric produces a new versionId. Use it to detect config changes.
652
+ */
653
+ versionId: string;
654
+ /**
655
+ * Unit information if applicable
656
+ */
657
+ unit?: PatternMetricResponse.Unit;
658
+ }
659
+ namespace PatternMetricResponse {
660
+ /**
661
+ * Pattern configuration.
662
+ */
663
+ interface Pattern {
664
+ operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
665
+ outcome: Pattern.Outcome | null;
666
+ triggerCombinator: 'AND' | 'OR' | null;
667
+ triggers: Array<Pattern.Trigger>;
668
+ windowMode: string | null;
669
+ }
670
+ namespace Pattern {
671
+ interface Outcome {
672
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
673
+ sourceMetricDefinitionId: string;
674
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
675
+ sourceVariantId: string | null;
676
+ thresholdValue: string;
677
+ windowAfter: number | null;
678
+ windowBefore: number | null;
679
+ }
680
+ interface Trigger {
681
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
682
+ sourceMetricDefinitionId: string;
683
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
684
+ sourceVariantId: string | null;
685
+ thresholdValue: string;
686
+ }
687
+ }
135
688
  /**
136
689
  * Unit information if applicable
137
690
  */
@@ -147,111 +700,253 @@ export declare namespace MetricListDefinitionsResponse {
147
700
  }
148
701
  }
149
702
  }
150
- export interface MetricCreateDefinitionParams {
151
- /**
152
- * ID of the analysis package to add this metric to
153
- */
154
- analysisPackageId: string;
155
- /**
156
- * Name of the metric
157
- */
158
- name: string;
159
- /**
160
- * Type of value this metric produces
161
- */
162
- outputType: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
163
- /**
164
- * Label for the false/negative case (only for BOOLEAN type)
165
- */
166
- booleanFalseLabel?: string;
167
- /**
168
- * Label for the true/positive case (only for BOOLEAN type)
169
- */
170
- booleanTrueLabel?: string;
171
- /**
172
- * Options for classification. Required for CLASSIFICATION type.
173
- */
174
- classificationOptions?: Array<MetricCreateDefinitionParams.ClassificationOption>;
175
- /**
176
- * LLM prompt/criteria for evaluating this metric. Used to instruct the model on
177
- * how to score. Required for BOOLEAN, NUMERIC, TEXT, and SCALE types.
178
- */
179
- llmPrompt?: string;
180
- /**
181
- * Maximum number of classifications that can be selected (only for CLASSIFICATION
182
- * type)
183
- */
184
- maxClassifications?: number;
185
- /**
186
- * Unique identifier for the metric (e.g. "customer_satisfaction"). Auto-generated
187
- * from name if not provided.
188
- */
189
- metricId?: string;
190
- /**
191
- * Participant role to evaluate. Required when scope is PER_PARTICIPANT.
192
- */
193
- participantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
194
- /**
195
- * Labels for scale ranges (only for SCALE type)
196
- */
197
- scaleLabels?: Array<MetricCreateDefinitionParams.ScaleLabel>;
198
- /**
199
- * Maximum value for scale. Required for SCALE type.
200
- */
201
- scaleMax?: number;
202
- /**
203
- * Minimum value for scale. Required for SCALE type.
204
- */
205
- scaleMin?: number;
206
- /**
207
- * Whether metric is global or per-participant (default: GLOBAL)
208
- */
209
- scope?: 'GLOBAL' | 'PER_PARTICIPANT';
210
- /**
211
- * Which levels this metric can produce values at (default: ["CALL"])
212
- */
213
- supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
214
- }
703
+ export type MetricCreateDefinitionParams = MetricCreateDefinitionParams.PromptMetricInput | MetricCreateDefinitionParams.FormulaMetricInput | MetricCreateDefinitionParams.PatternMetricInput;
215
704
  export declare namespace MetricCreateDefinitionParams {
216
- interface ClassificationOption {
705
+ interface PromptMetricInput {
217
706
  /**
218
- * Description of what this option means
707
+ * ID of the analysis package to add this metric to
219
708
  */
220
- description: string;
709
+ analysisPackageId: string;
221
710
  /**
222
- * Display order of this option
711
+ * LLM-evaluated metric.
223
712
  */
224
- displayOrder: number;
713
+ calculationType: 'LLM_JUDGE';
225
714
  /**
226
- * Label for this classification option
715
+ * Name of the metric
227
716
  */
228
- label: string;
717
+ name: string;
718
+ /**
719
+ * Type of value this metric produces
720
+ */
721
+ outputType: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
722
+ /**
723
+ * Label for the false case (only for BOOLEAN type)
724
+ */
725
+ booleanFalseLabel?: string;
726
+ /**
727
+ * Label for the true case (only for BOOLEAN type)
728
+ */
729
+ booleanTrueLabel?: string;
730
+ /**
731
+ * Options for classification. Required for CLASSIFICATION type.
732
+ */
733
+ classificationOptions?: Array<PromptMetricInput.ClassificationOption>;
734
+ /**
735
+ * LLM prompt/criteria for evaluating this metric. Required for BOOLEAN, NUMERIC,
736
+ * TEXT, and SCALE types.
737
+ */
738
+ llmPrompt?: string;
739
+ /**
740
+ * Maximum number of classifications that can be selected (only for CLASSIFICATION
741
+ * type)
742
+ */
743
+ maxClassifications?: number;
744
+ /**
745
+ * Alias of `slug` accepted for backwards compatibility. Use `slug` for new
746
+ * integrations.
747
+ */
748
+ metricId?: string;
749
+ /**
750
+ * Participant role to evaluate. Required when scope is PER_PARTICIPANT.
751
+ */
752
+ participantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
753
+ /**
754
+ * Labels for scale ranges (only for SCALE type)
755
+ */
756
+ scaleLabels?: Array<PromptMetricInput.ScaleLabel>;
757
+ /**
758
+ * Maximum value for scale. Required for SCALE type.
759
+ */
760
+ scaleMax?: number;
761
+ /**
762
+ * Minimum value for scale. Required for SCALE type.
763
+ */
764
+ scaleMin?: number;
765
+ /**
766
+ * Whether metric is global or per-participant (default: GLOBAL)
767
+ */
768
+ scope?: 'GLOBAL' | 'PER_PARTICIPANT';
769
+ /**
770
+ * Stable slug for the metric. Auto-generated from name if omitted.
771
+ */
772
+ slug?: string;
773
+ /**
774
+ * Which levels this metric can produce values at (default: ["CALL"])
775
+ */
776
+ supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
229
777
  }
230
- interface ScaleLabel {
778
+ namespace PromptMetricInput {
231
779
  /**
232
- * Display order of this label
780
+ * Option for classification metrics.
233
781
  */
234
- displayOrder: number;
782
+ interface ClassificationOption {
783
+ description: string;
784
+ displayOrder: number;
785
+ label: string;
786
+ }
787
+ interface ScaleLabel {
788
+ /**
789
+ * Display order of this label
790
+ */
791
+ displayOrder: number;
792
+ /**
793
+ * Label for this range
794
+ */
795
+ label: string;
796
+ /**
797
+ * Maximum value for this label range
798
+ */
799
+ rangeMax: number;
800
+ /**
801
+ * Minimum value for this label range
802
+ */
803
+ rangeMin: number;
804
+ /**
805
+ * Hex color code for this label (e.g. "#FF0000")
806
+ */
807
+ colorHex?: string;
808
+ /**
809
+ * Description of what this range means
810
+ */
811
+ description?: string;
812
+ }
813
+ }
814
+ interface FormulaMetricInput {
815
+ /**
816
+ * ID of the analysis package to add this metric to
817
+ */
818
+ analysisPackageId: string;
819
+ /**
820
+ * Metric computed by evaluating a mathematical expression over other metrics.
821
+ */
822
+ calculationType: 'FORMULA';
823
+ /**
824
+ * Formula expression using `{{id:<uuid>}}` references to source metrics. Operators
825
+ * depend on output type: +, -, \*, / for NUMERIC; ==, !=, >=, <=, >, < for
826
+ * BOOLEAN.
827
+ */
828
+ formula: string;
829
+ /**
830
+ * Name of the metric
831
+ */
832
+ name: string;
833
+ /**
834
+ * Output type of the formula. NUMERIC for arithmetic expressions, BOOLEAN for
835
+ * comparison expressions.
836
+ */
837
+ outputType: 'NUMERIC' | 'BOOLEAN';
838
+ /**
839
+ * Source metrics referenced by the formula. Minimum 2.
840
+ */
841
+ sources: Array<FormulaMetricInput.Source>;
842
+ /**
843
+ * Alias of `slug` accepted for backwards compatibility. Use `slug` for new
844
+ * integrations.
845
+ */
846
+ metricId?: string;
847
+ /**
848
+ * Stable slug for the metric. Auto-generated from name if omitted.
849
+ */
850
+ slug?: string;
851
+ }
852
+ namespace FormulaMetricInput {
853
+ interface Source {
854
+ /**
855
+ * ID of a metric referenced in the formula
856
+ */
857
+ sourceMetricDefinitionId: string;
858
+ /**
859
+ * Variant of the source metric to use
860
+ */
861
+ sourceVariantId?: string;
862
+ }
863
+ }
864
+ interface PatternMetricInput {
865
+ /**
866
+ * ID of the analysis package to add this metric to
867
+ */
868
+ analysisPackageId: string;
869
+ /**
870
+ * Metric detecting temporal patterns: a trigger condition followed by an outcome
871
+ * within a window.
872
+ */
873
+ calculationType: 'PATTERN';
874
+ /**
875
+ * Name of the metric
876
+ */
877
+ name: string;
878
+ /**
879
+ * Pattern operation. PATTERN_EXISTS produces a BOOLEAN; PATTERN_COUNT produces a
880
+ * NUMERIC count; OUTCOME_AGGREGATE aggregates a numeric outcome.
881
+ */
882
+ operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
235
883
  /**
236
- * Label for this range
884
+ * Outcome condition evaluated within the window relative to the trigger.
237
885
  */
238
- label: string;
886
+ outcome: PatternMetricInput.Outcome;
239
887
  /**
240
- * Maximum value for this label range
888
+ * Alias of `slug` accepted for backwards compatibility. Use `slug` for new
889
+ * integrations.
241
890
  */
242
- rangeMax: number;
891
+ metricId?: string;
243
892
  /**
244
- * Minimum value for this label range
893
+ * Stable slug for the metric. Auto-generated from name if omitted.
245
894
  */
246
- rangeMin: number;
895
+ slug?: string;
247
896
  /**
248
- * Hex color code for this label (e.g. "#FF0000")
897
+ * Single trigger condition. Use either trigger or triggers + triggerCombinator.
249
898
  */
250
- colorHex?: string;
899
+ trigger?: PatternMetricInput.Trigger;
251
900
  /**
252
- * Description of what this range means
901
+ * How to combine multiple triggers. Required when triggers has more than 1 entry.
253
902
  */
254
- description?: string;
903
+ triggerCombinator?: 'AND' | 'OR';
904
+ /**
905
+ * Multiple trigger conditions. Use with triggerCombinator.
906
+ */
907
+ triggers?: Array<PatternMetricInput.Trigger>;
908
+ /**
909
+ * Unit for trigger/outcome window values (default: seconds)
910
+ */
911
+ windowMode?: 'seconds' | 'segments';
912
+ }
913
+ namespace PatternMetricInput {
914
+ /**
915
+ * Outcome condition evaluated within the window relative to the trigger.
916
+ */
917
+ interface Outcome {
918
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
919
+ sourceMetricDefinitionId: string;
920
+ thresholdValue: string;
921
+ /**
922
+ * How far after the trigger to look for the outcome (in seconds or segments, see
923
+ * windowMode)
924
+ */
925
+ windowAfter: number;
926
+ sourceParticipantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
927
+ sourceVariantId?: string;
928
+ /**
929
+ * How far before the trigger to look for the outcome (default: 0)
930
+ */
931
+ windowBefore?: number;
932
+ }
933
+ /**
934
+ * Single trigger condition. Use either trigger or triggers + triggerCombinator.
935
+ */
936
+ interface Trigger {
937
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
938
+ sourceMetricDefinitionId: string;
939
+ thresholdValue: string;
940
+ sourceParticipantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
941
+ sourceVariantId?: string;
942
+ }
943
+ interface Trigger {
944
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
945
+ sourceMetricDefinitionId: string;
946
+ thresholdValue: string;
947
+ sourceParticipantRole?: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER';
948
+ sourceVariantId?: string;
949
+ }
255
950
  }
256
951
  }
257
952
  export declare namespace Metric {