@roarkanalytics/sdk 3.5.0 → 3.7.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 (67) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +7 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/call.d.mts +199 -1
  12. package/resources/call.d.mts.map +1 -1
  13. package/resources/call.d.ts +199 -1
  14. package/resources/call.d.ts.map +1 -1
  15. package/resources/call.js +30 -0
  16. package/resources/call.js.map +1 -1
  17. package/resources/call.mjs +30 -0
  18. package/resources/call.mjs.map +1 -1
  19. package/resources/config.d.mts +1 -1
  20. package/resources/config.d.mts.map +1 -1
  21. package/resources/config.d.ts +1 -1
  22. package/resources/config.d.ts.map +1 -1
  23. package/resources/customer-flow.d.mts +17 -2
  24. package/resources/customer-flow.d.mts.map +1 -1
  25. package/resources/customer-flow.d.ts +17 -2
  26. package/resources/customer-flow.d.ts.map +1 -1
  27. package/resources/index.d.mts +3 -2
  28. package/resources/index.d.mts.map +1 -1
  29. package/resources/index.d.ts +3 -2
  30. package/resources/index.d.ts.map +1 -1
  31. package/resources/index.js +3 -1
  32. package/resources/index.js.map +1 -1
  33. package/resources/index.mjs +1 -0
  34. package/resources/index.mjs.map +1 -1
  35. package/resources/metric-variant.d.mts +357 -0
  36. package/resources/metric-variant.d.mts.map +1 -0
  37. package/resources/metric-variant.d.ts +357 -0
  38. package/resources/metric-variant.d.ts.map +1 -0
  39. package/resources/metric-variant.js +112 -0
  40. package/resources/metric-variant.js.map +1 -0
  41. package/resources/metric-variant.mjs +108 -0
  42. package/resources/metric-variant.mjs.map +1 -0
  43. package/resources/metric.d.mts +696 -1
  44. package/resources/metric.d.mts.map +1 -1
  45. package/resources/metric.d.ts +696 -1
  46. package/resources/metric.d.ts.map +1 -1
  47. package/resources/metric.js +22 -0
  48. package/resources/metric.js.map +1 -1
  49. package/resources/metric.mjs +22 -0
  50. package/resources/metric.mjs.map +1 -1
  51. package/resources/simulation-job.d.mts +90 -0
  52. package/resources/simulation-job.d.mts.map +1 -1
  53. package/resources/simulation-job.d.ts +90 -0
  54. package/resources/simulation-job.d.ts.map +1 -1
  55. package/src/client.ts +35 -0
  56. package/src/resources/call.ts +236 -0
  57. package/src/resources/config.ts +1 -0
  58. package/src/resources/customer-flow.ts +24 -2
  59. package/src/resources/index.ts +16 -0
  60. package/src/resources/metric-variant.ts +458 -0
  61. package/src/resources/metric.ts +1008 -124
  62. package/src/resources/simulation-job.ts +104 -0
  63. package/src/version.ts +1 -1
  64. package/version.d.mts +1 -1
  65. package/version.d.ts +1 -1
  66. package/version.js +1 -1
  67. package/version.mjs +1 -1
@@ -30,6 +30,25 @@ export declare class Metric extends APIResource {
30
30
  * ```
31
31
  */
32
32
  listDefinitions(query?: MetricListDefinitionsParams | null | undefined, options?: RequestOptions): APIPromise<MetricListDefinitionsResponse>;
33
+ /**
34
+ * Update the editable subset of a custom metric definition, addressed by its UUID
35
+ * or its stable `slug`. Only the supplied fields are changed; omitted fields are
36
+ * left unchanged. Every update creates a new immutable version; the response
37
+ * carries the advanced `versionId`. Immutable fields (scope, outputType, calcType,
38
+ * …) are rejected, and which fields are editable depends on the metric (e.g.
39
+ * derived metrics only allow `name`). Roark's own metrics are rejected here: this
40
+ * endpoint edits the shared definition, which every workspace sees. To change one
41
+ * for your workspace alone, edit its variant with PUT
42
+ * /v1/metric/definitions/{idOrSlug}/variants/{variantId}, which forks it for you
43
+ * and leaves every other workspace on the original.
44
+ *
45
+ * @example
46
+ * ```ts
47
+ * const response =
48
+ * await client.metric.updateDefinition('idOrSlug');
49
+ * ```
50
+ */
51
+ updateDefinition(idOrSlug: string, body?: MetricUpdateDefinitionParams | null | undefined, options?: RequestOptions): APIPromise<MetricUpdateDefinitionResponse>;
33
52
  }
34
53
  export interface MetricCreateDefinitionResponse {
35
54
  /**
@@ -43,6 +62,16 @@ export declare namespace MetricCreateDefinitionResponse {
43
62
  * Unique identifier for the metric definition
44
63
  */
45
64
  id: string;
65
+ /**
66
+ * For a BOOLEAN metric, what a `false` value means. Also given to the judge as its
67
+ * polarity rule.
68
+ */
69
+ booleanFalseLabel: string | null;
70
+ /**
71
+ * For a BOOLEAN metric, what a `true` value means. Also given to the judge as its
72
+ * polarity rule.
73
+ */
74
+ booleanTrueLabel: string | null;
46
75
  /**
47
76
  * Metric evaluated by an LLM against a prompt.
48
77
  */
@@ -51,6 +80,11 @@ export declare namespace MetricCreateDefinitionResponse {
51
80
  * Description of what the metric measures
52
81
  */
53
82
  description: string;
83
+ /**
84
+ * The rubric this judge applies, as stored. Read it back to confirm which criteria
85
+ * are live after a create or update.
86
+ */
87
+ llmPrompt: string | null;
54
88
  /**
55
89
  * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
56
90
  */
@@ -59,6 +93,14 @@ export declare namespace MetricCreateDefinitionResponse {
59
93
  * Name of the metric
60
94
  */
61
95
  name: string;
96
+ /**
97
+ * True when this metric can only be scored from a live recording
98
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
99
+ * simulation run forces live enrichment: the run waits for your recording and, if
100
+ * none arrives, the metric produces no value. Check this before a run rather than
101
+ * discovering the wait afterwards.
102
+ */
103
+ requiresLiveConversation: boolean;
62
104
  /**
63
105
  * Whether metric is global or per-participant
64
106
  */
@@ -71,6 +113,12 @@ export declare namespace MetricCreateDefinitionResponse {
71
113
  * Which levels this metric can produce values at
72
114
  */
73
115
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
116
+ /**
117
+ * Which kinds of conversation this metric can be scored on. `null` means both.
118
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
119
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
120
+ */
121
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
74
122
  /**
75
123
  * Type of value this metric produces
76
124
  */
@@ -131,6 +179,14 @@ export declare namespace MetricCreateDefinitionResponse {
131
179
  * Name of the metric
132
180
  */
133
181
  name: string;
182
+ /**
183
+ * True when this metric can only be scored from a live recording
184
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
185
+ * simulation run forces live enrichment: the run waits for your recording and, if
186
+ * none arrives, the metric produces no value. Check this before a run rather than
187
+ * discovering the wait afterwards.
188
+ */
189
+ requiresLiveConversation: boolean;
134
190
  /**
135
191
  * Whether metric is global or per-participant
136
192
  */
@@ -143,6 +199,12 @@ export declare namespace MetricCreateDefinitionResponse {
143
199
  * Which levels this metric can produce values at
144
200
  */
145
201
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
202
+ /**
203
+ * Which kinds of conversation this metric can be scored on. `null` means both.
204
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
205
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
206
+ */
207
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
146
208
  /**
147
209
  * Type of value this metric produces
148
210
  */
@@ -216,6 +278,14 @@ export declare namespace MetricCreateDefinitionResponse {
216
278
  * Pattern configuration.
217
279
  */
218
280
  pattern: PatternMetricResponse.Pattern;
281
+ /**
282
+ * True when this metric can only be scored from a live recording
283
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
284
+ * simulation run forces live enrichment: the run waits for your recording and, if
285
+ * none arrives, the metric produces no value. Check this before a run rather than
286
+ * discovering the wait afterwards.
287
+ */
288
+ requiresLiveConversation: boolean;
219
289
  /**
220
290
  * Whether metric is global or per-participant
221
291
  */
@@ -228,6 +298,12 @@ export declare namespace MetricCreateDefinitionResponse {
228
298
  * Which levels this metric can produce values at
229
299
  */
230
300
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
301
+ /**
302
+ * Which kinds of conversation this metric can be scored on. `null` means both.
303
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
304
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
305
+ */
306
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
231
307
  /**
232
308
  * Type of value this metric produces
233
309
  */
@@ -305,6 +381,16 @@ export declare namespace MetricListDefinitionsResponse {
305
381
  * Unique identifier for the metric definition
306
382
  */
307
383
  id: string;
384
+ /**
385
+ * For a BOOLEAN metric, what a `false` value means. Also given to the judge as its
386
+ * polarity rule.
387
+ */
388
+ booleanFalseLabel: string | null;
389
+ /**
390
+ * For a BOOLEAN metric, what a `true` value means. Also given to the judge as its
391
+ * polarity rule.
392
+ */
393
+ booleanTrueLabel: string | null;
308
394
  /**
309
395
  * Metric evaluated by an LLM against a prompt.
310
396
  */
@@ -313,6 +399,11 @@ export declare namespace MetricListDefinitionsResponse {
313
399
  * Description of what the metric measures
314
400
  */
315
401
  description: string;
402
+ /**
403
+ * The rubric this judge applies, as stored. Read it back to confirm which criteria
404
+ * are live after a create or update.
405
+ */
406
+ llmPrompt: string | null;
316
407
  /**
317
408
  * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
318
409
  */
@@ -321,6 +412,14 @@ export declare namespace MetricListDefinitionsResponse {
321
412
  * Name of the metric
322
413
  */
323
414
  name: string;
415
+ /**
416
+ * True when this metric can only be scored from a live recording
417
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
418
+ * simulation run forces live enrichment: the run waits for your recording and, if
419
+ * none arrives, the metric produces no value. Check this before a run rather than
420
+ * discovering the wait afterwards.
421
+ */
422
+ requiresLiveConversation: boolean;
324
423
  /**
325
424
  * Whether metric is global or per-participant
326
425
  */
@@ -333,6 +432,12 @@ export declare namespace MetricListDefinitionsResponse {
333
432
  * Which levels this metric can produce values at
334
433
  */
335
434
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
435
+ /**
436
+ * Which kinds of conversation this metric can be scored on. `null` means both.
437
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
438
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
439
+ */
440
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
336
441
  /**
337
442
  * Type of value this metric produces
338
443
  */
@@ -389,6 +494,14 @@ export declare namespace MetricListDefinitionsResponse {
389
494
  * Name of the metric
390
495
  */
391
496
  name: string;
497
+ /**
498
+ * True when this metric can only be scored from a live recording
499
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
500
+ * simulation run forces live enrichment: the run waits for your recording and, if
501
+ * none arrives, the metric produces no value. Check this before a run rather than
502
+ * discovering the wait afterwards.
503
+ */
504
+ requiresLiveConversation: boolean;
392
505
  /**
393
506
  * Whether metric is global or per-participant
394
507
  */
@@ -401,6 +514,12 @@ export declare namespace MetricListDefinitionsResponse {
401
514
  * Which levels this metric can produce values at
402
515
  */
403
516
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
517
+ /**
518
+ * Which kinds of conversation this metric can be scored on. `null` means both.
519
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
520
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
521
+ */
522
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
404
523
  /**
405
524
  * Type of value this metric produces
406
525
  */
@@ -457,6 +576,14 @@ export declare namespace MetricListDefinitionsResponse {
457
576
  * Name of the metric
458
577
  */
459
578
  name: string;
579
+ /**
580
+ * True when this metric can only be scored from a live recording
581
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
582
+ * simulation run forces live enrichment: the run waits for your recording and, if
583
+ * none arrives, the metric produces no value. Check this before a run rather than
584
+ * discovering the wait afterwards.
585
+ */
586
+ requiresLiveConversation: boolean;
460
587
  /**
461
588
  * Whether metric is global or per-participant
462
589
  */
@@ -469,6 +596,12 @@ export declare namespace MetricListDefinitionsResponse {
469
596
  * Which levels this metric can produce values at
470
597
  */
471
598
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
599
+ /**
600
+ * Which kinds of conversation this metric can be scored on. `null` means both.
601
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
602
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
603
+ */
604
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
472
605
  /**
473
606
  * Type of value this metric produces
474
607
  */
@@ -545,6 +678,14 @@ export declare namespace MetricListDefinitionsResponse {
545
678
  * Name of the metric
546
679
  */
547
680
  name: string;
681
+ /**
682
+ * True when this metric can only be scored from a live recording
683
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
684
+ * simulation run forces live enrichment: the run waits for your recording and, if
685
+ * none arrives, the metric produces no value. Check this before a run rather than
686
+ * discovering the wait afterwards.
687
+ */
688
+ requiresLiveConversation: boolean;
548
689
  /**
549
690
  * Whether metric is global or per-participant
550
691
  */
@@ -557,6 +698,12 @@ export declare namespace MetricListDefinitionsResponse {
557
698
  * Which levels this metric can produce values at
558
699
  */
559
700
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
701
+ /**
702
+ * Which kinds of conversation this metric can be scored on. `null` means both.
703
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
704
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
705
+ */
706
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
560
707
  /**
561
708
  * Type of value this metric produces
562
709
  */
@@ -630,6 +777,14 @@ export declare namespace MetricListDefinitionsResponse {
630
777
  * Pattern configuration.
631
778
  */
632
779
  pattern: PatternMetricResponse.Pattern;
780
+ /**
781
+ * True when this metric can only be scored from a live recording
782
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
783
+ * simulation run forces live enrichment: the run waits for your recording and, if
784
+ * none arrives, the metric produces no value. Check this before a run rather than
785
+ * discovering the wait afterwards.
786
+ */
787
+ requiresLiveConversation: boolean;
633
788
  /**
634
789
  * Whether metric is global or per-participant
635
790
  */
@@ -642,6 +797,12 @@ export declare namespace MetricListDefinitionsResponse {
642
797
  * Which levels this metric can produce values at
643
798
  */
644
799
  supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
800
+ /**
801
+ * Which kinds of conversation this metric can be scored on. `null` means both.
802
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
803
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
804
+ */
805
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
645
806
  /**
646
807
  * Type of value this metric produces
647
808
  */
@@ -711,6 +872,422 @@ export declare namespace MetricListDefinitionsResponse {
711
872
  nextCursor: string | null;
712
873
  }
713
874
  }
875
+ export interface MetricUpdateDefinitionResponse {
876
+ /**
877
+ * The updated metric definition. The variant is selected by `calculationType`.
878
+ */
879
+ data: MetricUpdateDefinitionResponse.LlmJudgeMetricResponse | MetricUpdateDefinitionResponse.FormulaMetricResponse | MetricUpdateDefinitionResponse.PatternMetricResponse | MetricUpdateDefinitionResponse.ThresholdMetricResponse;
880
+ }
881
+ export declare namespace MetricUpdateDefinitionResponse {
882
+ interface LlmJudgeMetricResponse {
883
+ /**
884
+ * Unique identifier for the metric definition
885
+ */
886
+ id: string;
887
+ /**
888
+ * For a BOOLEAN metric, what a `false` value means. Also given to the judge as its
889
+ * polarity rule.
890
+ */
891
+ booleanFalseLabel: string | null;
892
+ /**
893
+ * For a BOOLEAN metric, what a `true` value means. Also given to the judge as its
894
+ * polarity rule.
895
+ */
896
+ booleanTrueLabel: string | null;
897
+ /**
898
+ * Metric evaluated by an LLM against a prompt.
899
+ */
900
+ calculationType: 'LLM_JUDGE';
901
+ /**
902
+ * Description of what the metric measures
903
+ */
904
+ description: string;
905
+ /**
906
+ * The rubric this judge applies, as stored. Read it back to confirm which criteria
907
+ * are live after a create or update.
908
+ */
909
+ llmPrompt: string | null;
910
+ /**
911
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
912
+ */
913
+ metricId: string;
914
+ /**
915
+ * Name of the metric
916
+ */
917
+ name: string;
918
+ /**
919
+ * True when this metric can only be scored from a live recording
920
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
921
+ * simulation run forces live enrichment: the run waits for your recording and, if
922
+ * none arrives, the metric produces no value. Check this before a run rather than
923
+ * discovering the wait afterwards.
924
+ */
925
+ requiresLiveConversation: boolean;
926
+ /**
927
+ * Whether metric is global or per-participant
928
+ */
929
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
930
+ /**
931
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
932
+ */
933
+ slug: string;
934
+ /**
935
+ * Which levels this metric can produce values at
936
+ */
937
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
938
+ /**
939
+ * Which kinds of conversation this metric can be scored on. `null` means both.
940
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
941
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
942
+ */
943
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
944
+ /**
945
+ * Type of value this metric produces
946
+ */
947
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
948
+ /**
949
+ * The resolved variant this response reflects (org-scoped Default if the org has
950
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
951
+ * building a derived metric off this one to pin the exact config.
952
+ */
953
+ variantId: string;
954
+ /**
955
+ * The variant's current version. Immutable snapshot of the config — editing the
956
+ * metric produces a new versionId. Use it to detect config changes.
957
+ */
958
+ versionId: string;
959
+ /**
960
+ * Unit information if applicable
961
+ */
962
+ unit?: LlmJudgeMetricResponse.Unit;
963
+ }
964
+ namespace LlmJudgeMetricResponse {
965
+ /**
966
+ * Unit information if applicable
967
+ */
968
+ interface Unit {
969
+ /**
970
+ * Name of the unit
971
+ */
972
+ name: string;
973
+ /**
974
+ * Symbol for the unit
975
+ */
976
+ symbol: string | null;
977
+ }
978
+ }
979
+ interface FormulaMetricResponse {
980
+ /**
981
+ * Unique identifier for the metric definition
982
+ */
983
+ id: string;
984
+ /**
985
+ * Metric computed by evaluating an expression over other metrics.
986
+ */
987
+ calculationType: 'FORMULA';
988
+ /**
989
+ * Description of what the metric measures
990
+ */
991
+ description: string;
992
+ /**
993
+ * Formula configuration.
994
+ */
995
+ formula: FormulaMetricResponse.Formula;
996
+ /**
997
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
998
+ */
999
+ metricId: string;
1000
+ /**
1001
+ * Name of the metric
1002
+ */
1003
+ name: string;
1004
+ /**
1005
+ * True when this metric can only be scored from a live recording
1006
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
1007
+ * simulation run forces live enrichment: the run waits for your recording and, if
1008
+ * none arrives, the metric produces no value. Check this before a run rather than
1009
+ * discovering the wait afterwards.
1010
+ */
1011
+ requiresLiveConversation: boolean;
1012
+ /**
1013
+ * Whether metric is global or per-participant
1014
+ */
1015
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
1016
+ /**
1017
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
1018
+ */
1019
+ slug: string;
1020
+ /**
1021
+ * Which levels this metric can produce values at
1022
+ */
1023
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1024
+ /**
1025
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1026
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1027
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1028
+ */
1029
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1030
+ /**
1031
+ * Type of value this metric produces
1032
+ */
1033
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1034
+ /**
1035
+ * The resolved variant this response reflects (org-scoped Default if the org has
1036
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
1037
+ * building a derived metric off this one to pin the exact config.
1038
+ */
1039
+ variantId: string;
1040
+ /**
1041
+ * The variant's current version. Immutable snapshot of the config — editing the
1042
+ * metric produces a new versionId. Use it to detect config changes.
1043
+ */
1044
+ versionId: string;
1045
+ /**
1046
+ * Unit information if applicable
1047
+ */
1048
+ unit?: FormulaMetricResponse.Unit;
1049
+ }
1050
+ namespace FormulaMetricResponse {
1051
+ /**
1052
+ * Formula configuration.
1053
+ */
1054
+ interface Formula {
1055
+ expression: string;
1056
+ sources: Array<Formula.Source>;
1057
+ }
1058
+ namespace Formula {
1059
+ interface Source {
1060
+ sourceMetricDefinitionId: string;
1061
+ sourceVariantId: string | null;
1062
+ }
1063
+ }
1064
+ /**
1065
+ * Unit information if applicable
1066
+ */
1067
+ interface Unit {
1068
+ /**
1069
+ * Name of the unit
1070
+ */
1071
+ name: string;
1072
+ /**
1073
+ * Symbol for the unit
1074
+ */
1075
+ symbol: string | null;
1076
+ }
1077
+ }
1078
+ interface PatternMetricResponse {
1079
+ /**
1080
+ * Unique identifier for the metric definition
1081
+ */
1082
+ id: string;
1083
+ /**
1084
+ * Metric detecting a trigger condition followed by an outcome within a window.
1085
+ */
1086
+ calculationType: 'PATTERN';
1087
+ /**
1088
+ * Description of what the metric measures
1089
+ */
1090
+ description: string;
1091
+ /**
1092
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
1093
+ */
1094
+ metricId: string;
1095
+ /**
1096
+ * Name of the metric
1097
+ */
1098
+ name: string;
1099
+ /**
1100
+ * Pattern configuration.
1101
+ */
1102
+ pattern: PatternMetricResponse.Pattern;
1103
+ /**
1104
+ * True when this metric can only be scored from a live recording
1105
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
1106
+ * simulation run forces live enrichment: the run waits for your recording and, if
1107
+ * none arrives, the metric produces no value. Check this before a run rather than
1108
+ * discovering the wait afterwards.
1109
+ */
1110
+ requiresLiveConversation: boolean;
1111
+ /**
1112
+ * Whether metric is global or per-participant
1113
+ */
1114
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
1115
+ /**
1116
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
1117
+ */
1118
+ slug: string;
1119
+ /**
1120
+ * Which levels this metric can produce values at
1121
+ */
1122
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1123
+ /**
1124
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1125
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1126
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1127
+ */
1128
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1129
+ /**
1130
+ * Type of value this metric produces
1131
+ */
1132
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1133
+ /**
1134
+ * The resolved variant this response reflects (org-scoped Default if the org has
1135
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
1136
+ * building a derived metric off this one to pin the exact config.
1137
+ */
1138
+ variantId: string;
1139
+ /**
1140
+ * The variant's current version. Immutable snapshot of the config — editing the
1141
+ * metric produces a new versionId. Use it to detect config changes.
1142
+ */
1143
+ versionId: string;
1144
+ /**
1145
+ * Unit information if applicable
1146
+ */
1147
+ unit?: PatternMetricResponse.Unit;
1148
+ }
1149
+ namespace PatternMetricResponse {
1150
+ /**
1151
+ * Pattern configuration.
1152
+ */
1153
+ interface Pattern {
1154
+ operation: 'PATTERN_EXISTS' | 'PATTERN_COUNT' | 'OUTCOME_AGGREGATE';
1155
+ outcome: Pattern.Outcome | null;
1156
+ triggerCombinator: 'AND' | 'OR' | null;
1157
+ triggers: Array<Pattern.Trigger>;
1158
+ windowMode: string | null;
1159
+ }
1160
+ namespace Pattern {
1161
+ interface Outcome {
1162
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
1163
+ sourceMetricDefinitionId: string;
1164
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
1165
+ sourceVariantId: string | null;
1166
+ thresholdValue: string;
1167
+ windowAfter: number | null;
1168
+ windowBefore: number | null;
1169
+ }
1170
+ interface Trigger {
1171
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
1172
+ sourceMetricDefinitionId: string;
1173
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
1174
+ sourceVariantId: string | null;
1175
+ thresholdValue: string;
1176
+ }
1177
+ }
1178
+ /**
1179
+ * Unit information if applicable
1180
+ */
1181
+ interface Unit {
1182
+ /**
1183
+ * Name of the unit
1184
+ */
1185
+ name: string;
1186
+ /**
1187
+ * Symbol for the unit
1188
+ */
1189
+ symbol: string | null;
1190
+ }
1191
+ }
1192
+ interface ThresholdMetricResponse {
1193
+ /**
1194
+ * Unique identifier for the metric definition
1195
+ */
1196
+ id: string;
1197
+ /**
1198
+ * Boolean metric derived by comparing a source metric against a threshold.
1199
+ */
1200
+ calculationType: 'THRESHOLD';
1201
+ /**
1202
+ * Description of what the metric measures
1203
+ */
1204
+ description: string;
1205
+ /**
1206
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
1207
+ */
1208
+ metricId: string;
1209
+ /**
1210
+ * Name of the metric
1211
+ */
1212
+ name: string;
1213
+ /**
1214
+ * True when this metric can only be scored from a live recording
1215
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
1216
+ * simulation run forces live enrichment: the run waits for your recording and, if
1217
+ * none arrives, the metric produces no value. Check this before a run rather than
1218
+ * discovering the wait afterwards.
1219
+ */
1220
+ requiresLiveConversation: boolean;
1221
+ /**
1222
+ * Whether metric is global or per-participant
1223
+ */
1224
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
1225
+ /**
1226
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
1227
+ */
1228
+ slug: string;
1229
+ /**
1230
+ * Which levels this metric can produce values at
1231
+ */
1232
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1233
+ /**
1234
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1235
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1236
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1237
+ */
1238
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1239
+ /**
1240
+ * Type of value this metric produces
1241
+ */
1242
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1243
+ /**
1244
+ * The resolved variant this response reflects (org-scoped Default if the org has
1245
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
1246
+ * building a derived metric off this one to pin the exact config.
1247
+ */
1248
+ variantId: string;
1249
+ /**
1250
+ * The variant's current version. Immutable snapshot of the config — editing the
1251
+ * metric produces a new versionId. Use it to detect config changes.
1252
+ */
1253
+ versionId: string;
1254
+ /**
1255
+ * Threshold configuration.
1256
+ */
1257
+ threshold?: ThresholdMetricResponse.Threshold;
1258
+ /**
1259
+ * Unit information if applicable
1260
+ */
1261
+ unit?: ThresholdMetricResponse.Unit;
1262
+ }
1263
+ namespace ThresholdMetricResponse {
1264
+ /**
1265
+ * Threshold configuration.
1266
+ */
1267
+ interface Threshold {
1268
+ aggregationMode: 'EACH' | 'COUNT' | 'AVERAGE' | 'MIN' | 'MAX' | 'MEDIAN' | 'P95' | 'P99' | 'SUM';
1269
+ countThreshold: number | null;
1270
+ operator: 'GREATER_THAN' | 'GREATER_THAN_OR_EQUALS' | 'LESS_THAN' | 'LESS_THAN_OR_EQUALS' | 'EQUALS' | 'NOT_EQUALS';
1271
+ sourceMetricDefinitionId: string;
1272
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
1273
+ sourceVariantId: string | null;
1274
+ thresholdValue: string;
1275
+ }
1276
+ /**
1277
+ * Unit information if applicable
1278
+ */
1279
+ interface Unit {
1280
+ /**
1281
+ * Name of the unit
1282
+ */
1283
+ name: string;
1284
+ /**
1285
+ * Symbol for the unit
1286
+ */
1287
+ symbol: string | null;
1288
+ }
1289
+ }
1290
+ }
714
1291
  export type MetricCreateDefinitionParams = MetricCreateDefinitionParams.PromptMetricInput | MetricCreateDefinitionParams.FormulaMetricInput | MetricCreateDefinitionParams.PatternMetricInput;
715
1292
  export declare namespace MetricCreateDefinitionParams {
716
1293
  interface PromptMetricInput {
@@ -963,7 +1540,125 @@ export interface MetricListDefinitionsParams {
963
1540
  after?: string;
964
1541
  limit?: number;
965
1542
  }
1543
+ export interface MetricUpdateDefinitionParams {
1544
+ analysisPackageId?: unknown;
1545
+ /**
1546
+ * New label for the false case (BOOLEAN output only)
1547
+ */
1548
+ booleanFalseLabel?: string;
1549
+ /**
1550
+ * New label for the true case (BOOLEAN output only)
1551
+ */
1552
+ booleanTrueLabel?: string;
1553
+ calcType?: unknown;
1554
+ /**
1555
+ * Optional free-text audit note recorded on the new version.
1556
+ */
1557
+ changeReason?: string;
1558
+ /**
1559
+ * Replacement set of classification options (CLASSIFICATION output only)
1560
+ */
1561
+ classificationOptions?: Array<MetricUpdateDefinitionParams.ClassificationOption>;
1562
+ /**
1563
+ * New formula expression (FORMULA only). Pass `sources` alongside if the
1564
+ * referenced metrics change.
1565
+ */
1566
+ formula?: string;
1567
+ /**
1568
+ * New LLM prompt (only for LLM_JUDGE metrics whose prompt is editable)
1569
+ */
1570
+ llmPrompt?: string;
1571
+ /**
1572
+ * New maximum number of classifications (CLASSIFICATION output only)
1573
+ */
1574
+ maxClassifications?: number;
1575
+ metricId?: unknown;
1576
+ /**
1577
+ * New name (only for metrics whose name is editable)
1578
+ */
1579
+ name?: string;
1580
+ organizationId?: unknown;
1581
+ outputType?: unknown;
1582
+ participantRole?: unknown;
1583
+ projectId?: unknown;
1584
+ /**
1585
+ * Replacement set of scale-range labels (SCALE output only)
1586
+ */
1587
+ scaleLabels?: Array<MetricUpdateDefinitionParams.ScaleLabel>;
1588
+ /**
1589
+ * New scale maximum (SCALE output only)
1590
+ */
1591
+ scaleMax?: number;
1592
+ /**
1593
+ * New scale minimum (SCALE output only)
1594
+ */
1595
+ scaleMin?: number;
1596
+ scope?: unknown;
1597
+ slug?: unknown;
1598
+ source?: unknown;
1599
+ /**
1600
+ * Replacement formula sources, required when `formula` changes the referenced
1601
+ * metrics (FORMULA only).
1602
+ */
1603
+ sources?: Array<MetricUpdateDefinitionParams.Source>;
1604
+ /**
1605
+ * Replacement set of supported contexts. Omit to leave unchanged.
1606
+ */
1607
+ supportedContexts?: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1608
+ supportsMultipleVariants?: unknown;
1609
+ /**
1610
+ * Replacement set of scoped tool-definition ids (only for metrics whose tool
1611
+ * scoping is editable)
1612
+ */
1613
+ toolDefinitionIds?: Array<string>;
1614
+ }
1615
+ export declare namespace MetricUpdateDefinitionParams {
1616
+ /**
1617
+ * Option for classification metrics.
1618
+ */
1619
+ interface ClassificationOption {
1620
+ description: string;
1621
+ displayOrder: number;
1622
+ label: string;
1623
+ }
1624
+ interface ScaleLabel {
1625
+ /**
1626
+ * Display order of this label
1627
+ */
1628
+ displayOrder: number;
1629
+ /**
1630
+ * Label for this range
1631
+ */
1632
+ label: string;
1633
+ /**
1634
+ * Maximum value for this label range
1635
+ */
1636
+ rangeMax: number;
1637
+ /**
1638
+ * Minimum value for this label range
1639
+ */
1640
+ rangeMin: number;
1641
+ /**
1642
+ * Hex color code for this label (e.g. "#FF0000")
1643
+ */
1644
+ colorHex?: string;
1645
+ /**
1646
+ * Description of what this range means
1647
+ */
1648
+ description?: string;
1649
+ }
1650
+ interface Source {
1651
+ /**
1652
+ * ID of a metric referenced in the formula
1653
+ */
1654
+ sourceMetricDefinitionId: string;
1655
+ /**
1656
+ * Variant of the source metric to use
1657
+ */
1658
+ sourceVariantId?: string;
1659
+ }
1660
+ }
966
1661
  export declare namespace Metric {
967
- export { type MetricCreateDefinitionResponse as MetricCreateDefinitionResponse, type MetricListDefinitionsResponse as MetricListDefinitionsResponse, type MetricCreateDefinitionParams as MetricCreateDefinitionParams, type MetricListDefinitionsParams as MetricListDefinitionsParams, };
1662
+ export { type MetricCreateDefinitionResponse as MetricCreateDefinitionResponse, type MetricListDefinitionsResponse as MetricListDefinitionsResponse, type MetricUpdateDefinitionResponse as MetricUpdateDefinitionResponse, type MetricCreateDefinitionParams as MetricCreateDefinitionParams, type MetricListDefinitionsParams as MetricListDefinitionsParams, type MetricUpdateDefinitionParams as MetricUpdateDefinitionParams, };
968
1663
  }
969
1664
  //# sourceMappingURL=metric.d.ts.map