@roarkanalytics/sdk 5.16.0 → 5.18.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 (59) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +3 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -0
  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/agent.d.mts +22 -1
  12. package/resources/agent.d.mts.map +1 -1
  13. package/resources/agent.d.ts +22 -1
  14. package/resources/agent.d.ts.map +1 -1
  15. package/resources/call.d.mts +2 -2
  16. package/resources/call.d.mts.map +1 -1
  17. package/resources/call.d.ts +2 -2
  18. package/resources/call.d.ts.map +1 -1
  19. package/resources/index.d.mts +1 -0
  20. package/resources/index.d.mts.map +1 -1
  21. package/resources/index.d.ts +1 -0
  22. package/resources/index.d.ts.map +1 -1
  23. package/resources/index.js +3 -1
  24. package/resources/index.js.map +1 -1
  25. package/resources/index.mjs +1 -0
  26. package/resources/index.mjs.map +1 -1
  27. package/resources/metric.d.mts +638 -52
  28. package/resources/metric.d.mts.map +1 -1
  29. package/resources/metric.d.ts +638 -52
  30. package/resources/metric.d.ts.map +1 -1
  31. package/resources/phone-number.d.mts +367 -0
  32. package/resources/phone-number.d.mts.map +1 -0
  33. package/resources/phone-number.d.ts +367 -0
  34. package/resources/phone-number.d.ts.map +1 -0
  35. package/resources/phone-number.js +88 -0
  36. package/resources/phone-number.js.map +1 -0
  37. package/resources/phone-number.mjs +84 -0
  38. package/resources/phone-number.mjs.map +1 -0
  39. package/resources/simulation-run-plan-job.d.mts +2 -2
  40. package/resources/simulation-run-plan-job.d.mts.map +1 -1
  41. package/resources/simulation-run-plan-job.d.ts +2 -2
  42. package/resources/simulation-run-plan-job.d.ts.map +1 -1
  43. package/resources/usage.d.mts +1 -1
  44. package/resources/usage.d.mts.map +1 -1
  45. package/resources/usage.d.ts +1 -1
  46. package/resources/usage.d.ts.map +1 -1
  47. package/src/client.ts +29 -0
  48. package/src/resources/agent.ts +25 -1
  49. package/src/resources/call.ts +4 -2
  50. package/src/resources/index.ts +13 -0
  51. package/src/resources/metric.ts +742 -64
  52. package/src/resources/phone-number.ts +472 -0
  53. package/src/resources/simulation-run-plan-job.ts +4 -2
  54. package/src/resources/usage.ts +2 -1
  55. package/src/version.ts +1 -1
  56. package/version.d.mts +1 -1
  57. package/version.d.ts +1 -1
  58. package/version.js +1 -1
  59. package/version.mjs +1 -1
@@ -80,7 +80,8 @@ export interface MetricCreateDefinitionResponse {
80
80
  data:
81
81
  | MetricCreateDefinitionResponse.LlmJudgeMetricResponse
82
82
  | MetricCreateDefinitionResponse.FormulaMetricResponse
83
- | MetricCreateDefinitionResponse.PatternMetricResponse;
83
+ | MetricCreateDefinitionResponse.PatternMetricResponse
84
+ | MetricCreateDefinitionResponse.HTTPRequestMetricResponse;
84
85
  }
85
86
 
86
87
  export namespace MetricCreateDefinitionResponse {
@@ -171,10 +172,12 @@ export namespace MetricCreateDefinitionResponse {
171
172
  /**
172
173
  * Whether you can create a variant of this metric with POST
173
174
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
174
- * configuration comes from the metric they derive from), for provider-computed
175
- * metrics whose calculation lives in the collector rather than an editable prompt,
176
- * and for metrics in a package that manages its own variants. Most of Roark’s own
177
- * metrics are false, so read this rather than discovering it from a 403.
175
+ * configuration comes from the metric they derive from), for HTTP request metrics
176
+ * (their configuration is the request, edited on the metric), for
177
+ * provider-computed metrics whose calculation lives in the collector rather than
178
+ * an editable prompt, and for metrics in a package that manages its own variants.
179
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
180
+ * from a 403.
178
181
  */
179
182
  supportsVariants: boolean;
180
183
 
@@ -314,10 +317,12 @@ export namespace MetricCreateDefinitionResponse {
314
317
  /**
315
318
  * Whether you can create a variant of this metric with POST
316
319
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
317
- * configuration comes from the metric they derive from), for provider-computed
318
- * metrics whose calculation lives in the collector rather than an editable prompt,
319
- * and for metrics in a package that manages its own variants. Most of Roark’s own
320
- * metrics are false, so read this rather than discovering it from a 403.
320
+ * configuration comes from the metric they derive from), for HTTP request metrics
321
+ * (their configuration is the request, edited on the metric), for
322
+ * provider-computed metrics whose calculation lives in the collector rather than
323
+ * an editable prompt, and for metrics in a package that manages its own variants.
324
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
325
+ * from a 403.
321
326
  */
322
327
  supportsVariants: boolean;
323
328
 
@@ -474,10 +479,12 @@ export namespace MetricCreateDefinitionResponse {
474
479
  /**
475
480
  * Whether you can create a variant of this metric with POST
476
481
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
477
- * configuration comes from the metric they derive from), for provider-computed
478
- * metrics whose calculation lives in the collector rather than an editable prompt,
479
- * and for metrics in a package that manages its own variants. Most of Roark’s own
480
- * metrics are false, so read this rather than discovering it from a 403.
482
+ * configuration comes from the metric they derive from), for HTTP request metrics
483
+ * (their configuration is the request, edited on the metric), for
484
+ * provider-computed metrics whose calculation lives in the collector rather than
485
+ * an editable prompt, and for metrics in a package that manages its own variants.
486
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
487
+ * from a 403.
481
488
  */
482
489
  supportsVariants: boolean;
483
490
 
@@ -599,6 +606,184 @@ export namespace MetricCreateDefinitionResponse {
599
606
  symbol: string | null;
600
607
  }
601
608
  }
609
+
610
+ export interface HTTPRequestMetricResponse {
611
+ /**
612
+ * Unique identifier for the metric definition
613
+ */
614
+ id: string;
615
+
616
+ /**
617
+ * What a failed check is called
618
+ */
619
+ booleanFalseLabel: string | null;
620
+
621
+ /**
622
+ * What a passed check is called
623
+ */
624
+ booleanTrueLabel: string | null;
625
+
626
+ /**
627
+ * BOOLEAN metric answered by your own endpoint: Roark sends a request about each
628
+ * call and records the {"passed", "reason"} it answers with.
629
+ */
630
+ calculationType: 'HTTP_REQUEST';
631
+
632
+ /**
633
+ * Description of what the metric measures
634
+ */
635
+ description: string;
636
+
637
+ /**
638
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
639
+ * (for example `incorrect_barge_in_yield_count` over
640
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
641
+ * live. The count value itself carries neither. `null` for a metric that is its
642
+ * own evidence.
643
+ */
644
+ evidenceSource: HTTPRequestMetricResponse.EvidenceSource | null;
645
+
646
+ /**
647
+ * The request this metric sends.
648
+ */
649
+ httpRequest: HTTPRequestMetricResponse.HTTPRequest | null;
650
+
651
+ /**
652
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
653
+ */
654
+ metricId: string;
655
+
656
+ /**
657
+ * Name of the metric
658
+ */
659
+ name: string;
660
+
661
+ /**
662
+ * True when this metric can only be scored from a live recording
663
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
664
+ * simulation run forces live enrichment: the run waits for your recording and, if
665
+ * none arrives, the metric produces no value. Check this before a run rather than
666
+ * discovering the wait afterwards.
667
+ */
668
+ requiresLiveConversation: boolean;
669
+
670
+ /**
671
+ * Whether metric is global or per-participant
672
+ */
673
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
674
+
675
+ /**
676
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
677
+ */
678
+ slug: string;
679
+
680
+ /**
681
+ * Which levels this metric can produce values at
682
+ */
683
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
684
+
685
+ /**
686
+ * Which kinds of conversation this metric can be scored on. `null` means both.
687
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
688
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
689
+ */
690
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
691
+
692
+ /**
693
+ * Whether you can create a variant of this metric with POST
694
+ * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
695
+ * configuration comes from the metric they derive from), for HTTP request metrics
696
+ * (their configuration is the request, edited on the metric), for
697
+ * provider-computed metrics whose calculation lives in the collector rather than
698
+ * an editable prompt, and for metrics in a package that manages its own variants.
699
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
700
+ * from a 403.
701
+ */
702
+ supportsVariants: boolean;
703
+
704
+ /**
705
+ * Type of value this metric produces
706
+ */
707
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
708
+
709
+ /**
710
+ * The resolved variant this response reflects (org-scoped Default if the org has
711
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
712
+ * building a derived metric off this one to pin the exact config.
713
+ */
714
+ variantId: string;
715
+
716
+ /**
717
+ * The variant's current version. Immutable snapshot of the config — editing the
718
+ * metric produces a new versionId. Use it to detect config changes.
719
+ */
720
+ versionId: string;
721
+
722
+ /**
723
+ * Unit information if applicable
724
+ */
725
+ unit?: HTTPRequestMetricResponse.Unit;
726
+ }
727
+
728
+ export namespace HTTPRequestMetricResponse {
729
+ /**
730
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
731
+ * (for example `incorrect_barge_in_yield_count` over
732
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
733
+ * live. The count value itself carries neither. `null` for a metric that is its
734
+ * own evidence.
735
+ */
736
+ export interface EvidenceSource {
737
+ /**
738
+ * The per-turn value this metric tallies. `false` for an "incorrect" count over an
739
+ * appropriateness metric, `true` for a count of a boolean event.
740
+ */
741
+ countsWhen: boolean;
742
+
743
+ /**
744
+ * Slug of the metric whose per-turn values are the evidence behind this count or
745
+ * rate
746
+ */
747
+ metricId: string;
748
+ }
749
+
750
+ /**
751
+ * The request this metric sends.
752
+ */
753
+ export interface HTTPRequest {
754
+ /**
755
+ * The JSON body template, or null when the default payload is sent
756
+ */
757
+ body: string | null;
758
+
759
+ /**
760
+ * Request headers as key-value pairs
761
+ */
762
+ headers: { [key: string]: string };
763
+
764
+ method: 'GET' | 'POST';
765
+
766
+ /**
767
+ * The URL the request is sent to, placeholders included
768
+ */
769
+ url: string;
770
+ }
771
+
772
+ /**
773
+ * Unit information if applicable
774
+ */
775
+ export interface Unit {
776
+ /**
777
+ * Name of the unit
778
+ */
779
+ name: string;
780
+
781
+ /**
782
+ * Symbol for the unit
783
+ */
784
+ symbol: string | null;
785
+ }
786
+ }
602
787
  }
603
788
 
604
789
  /**
@@ -611,6 +796,7 @@ export interface MetricListDefinitionsResponse {
611
796
  | MetricListDefinitionsResponse.ThresholdMetricResponse
612
797
  | MetricListDefinitionsResponse.FormulaMetricResponse
613
798
  | MetricListDefinitionsResponse.PatternMetricResponse
799
+ | MetricListDefinitionsResponse.HTTPRequestMetricResponse
614
800
  >;
615
801
 
616
802
  pagination: MetricListDefinitionsResponse.Pagination;
@@ -704,10 +890,12 @@ export namespace MetricListDefinitionsResponse {
704
890
  /**
705
891
  * Whether you can create a variant of this metric with POST
706
892
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
707
- * configuration comes from the metric they derive from), for provider-computed
708
- * metrics whose calculation lives in the collector rather than an editable prompt,
709
- * and for metrics in a package that manages its own variants. Most of Roark’s own
710
- * metrics are false, so read this rather than discovering it from a 403.
893
+ * configuration comes from the metric they derive from), for HTTP request metrics
894
+ * (their configuration is the request, edited on the metric), for
895
+ * provider-computed metrics whose calculation lives in the collector rather than
896
+ * an editable prompt, and for metrics in a package that manages its own variants.
897
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
898
+ * from a 403.
711
899
  */
712
900
  supportsVariants: boolean;
713
901
 
@@ -842,10 +1030,12 @@ export namespace MetricListDefinitionsResponse {
842
1030
  /**
843
1031
  * Whether you can create a variant of this metric with POST
844
1032
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
845
- * configuration comes from the metric they derive from), for provider-computed
846
- * metrics whose calculation lives in the collector rather than an editable prompt,
847
- * and for metrics in a package that manages its own variants. Most of Roark’s own
848
- * metrics are false, so read this rather than discovering it from a 403.
1033
+ * configuration comes from the metric they derive from), for HTTP request metrics
1034
+ * (their configuration is the request, edited on the metric), for
1035
+ * provider-computed metrics whose calculation lives in the collector rather than
1036
+ * an editable prompt, and for metrics in a package that manages its own variants.
1037
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1038
+ * from a 403.
849
1039
  */
850
1040
  supportsVariants: boolean;
851
1041
 
@@ -980,10 +1170,12 @@ export namespace MetricListDefinitionsResponse {
980
1170
  /**
981
1171
  * Whether you can create a variant of this metric with POST
982
1172
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
983
- * configuration comes from the metric they derive from), for provider-computed
984
- * metrics whose calculation lives in the collector rather than an editable prompt,
985
- * and for metrics in a package that manages its own variants. Most of Roark’s own
986
- * metrics are false, so read this rather than discovering it from a 403.
1173
+ * configuration comes from the metric they derive from), for HTTP request metrics
1174
+ * (their configuration is the request, edited on the metric), for
1175
+ * provider-computed metrics whose calculation lives in the collector rather than
1176
+ * an editable prompt, and for metrics in a package that manages its own variants.
1177
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1178
+ * from a 403.
987
1179
  */
988
1180
  supportsVariants: boolean;
989
1181
 
@@ -1153,10 +1345,12 @@ export namespace MetricListDefinitionsResponse {
1153
1345
  /**
1154
1346
  * Whether you can create a variant of this metric with POST
1155
1347
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1156
- * configuration comes from the metric they derive from), for provider-computed
1157
- * metrics whose calculation lives in the collector rather than an editable prompt,
1158
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1159
- * metrics are false, so read this rather than discovering it from a 403.
1348
+ * configuration comes from the metric they derive from), for HTTP request metrics
1349
+ * (their configuration is the request, edited on the metric), for
1350
+ * provider-computed metrics whose calculation lives in the collector rather than
1351
+ * an editable prompt, and for metrics in a package that manages its own variants.
1352
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1353
+ * from a 403.
1160
1354
  */
1161
1355
  supportsVariants: boolean;
1162
1356
 
@@ -1313,10 +1507,12 @@ export namespace MetricListDefinitionsResponse {
1313
1507
  /**
1314
1508
  * Whether you can create a variant of this metric with POST
1315
1509
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1316
- * configuration comes from the metric they derive from), for provider-computed
1317
- * metrics whose calculation lives in the collector rather than an editable prompt,
1318
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1319
- * metrics are false, so read this rather than discovering it from a 403.
1510
+ * configuration comes from the metric they derive from), for HTTP request metrics
1511
+ * (their configuration is the request, edited on the metric), for
1512
+ * provider-computed metrics whose calculation lives in the collector rather than
1513
+ * an editable prompt, and for metrics in a package that manages its own variants.
1514
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1515
+ * from a 403.
1320
1516
  */
1321
1517
  supportsVariants: boolean;
1322
1518
 
@@ -1404,23 +1600,201 @@ export namespace MetricListDefinitionsResponse {
1404
1600
  windowBefore: number | null;
1405
1601
  }
1406
1602
 
1407
- export interface Trigger {
1408
- operator:
1409
- | 'GREATER_THAN'
1410
- | 'GREATER_THAN_OR_EQUALS'
1411
- | 'LESS_THAN'
1412
- | 'LESS_THAN_OR_EQUALS'
1413
- | 'EQUALS'
1414
- | 'NOT_EQUALS';
1603
+ export interface Trigger {
1604
+ operator:
1605
+ | 'GREATER_THAN'
1606
+ | 'GREATER_THAN_OR_EQUALS'
1607
+ | 'LESS_THAN'
1608
+ | 'LESS_THAN_OR_EQUALS'
1609
+ | 'EQUALS'
1610
+ | 'NOT_EQUALS';
1611
+
1612
+ sourceMetricDefinitionId: string;
1613
+
1614
+ sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
1615
+
1616
+ sourceVariantId: string | null;
1617
+
1618
+ thresholdValue: string;
1619
+ }
1620
+ }
1621
+
1622
+ /**
1623
+ * Unit information if applicable
1624
+ */
1625
+ export interface Unit {
1626
+ /**
1627
+ * Name of the unit
1628
+ */
1629
+ name: string;
1630
+
1631
+ /**
1632
+ * Symbol for the unit
1633
+ */
1634
+ symbol: string | null;
1635
+ }
1636
+ }
1637
+
1638
+ export interface HTTPRequestMetricResponse {
1639
+ /**
1640
+ * Unique identifier for the metric definition
1641
+ */
1642
+ id: string;
1643
+
1644
+ /**
1645
+ * What a failed check is called
1646
+ */
1647
+ booleanFalseLabel: string | null;
1648
+
1649
+ /**
1650
+ * What a passed check is called
1651
+ */
1652
+ booleanTrueLabel: string | null;
1653
+
1654
+ /**
1655
+ * BOOLEAN metric answered by your own endpoint: Roark sends a request about each
1656
+ * call and records the {"passed", "reason"} it answers with.
1657
+ */
1658
+ calculationType: 'HTTP_REQUEST';
1659
+
1660
+ /**
1661
+ * Description of what the metric measures
1662
+ */
1663
+ description: string;
1664
+
1665
+ /**
1666
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
1667
+ * (for example `incorrect_barge_in_yield_count` over
1668
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
1669
+ * live. The count value itself carries neither. `null` for a metric that is its
1670
+ * own evidence.
1671
+ */
1672
+ evidenceSource: HTTPRequestMetricResponse.EvidenceSource | null;
1673
+
1674
+ /**
1675
+ * The request this metric sends.
1676
+ */
1677
+ httpRequest: HTTPRequestMetricResponse.HTTPRequest | null;
1678
+
1679
+ /**
1680
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
1681
+ */
1682
+ metricId: string;
1683
+
1684
+ /**
1685
+ * Name of the metric
1686
+ */
1687
+ name: string;
1688
+
1689
+ /**
1690
+ * True when this metric can only be scored from a live recording
1691
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
1692
+ * simulation run forces live enrichment: the run waits for your recording and, if
1693
+ * none arrives, the metric produces no value. Check this before a run rather than
1694
+ * discovering the wait afterwards.
1695
+ */
1696
+ requiresLiveConversation: boolean;
1697
+
1698
+ /**
1699
+ * Whether metric is global or per-participant
1700
+ */
1701
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
1702
+
1703
+ /**
1704
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
1705
+ */
1706
+ slug: string;
1707
+
1708
+ /**
1709
+ * Which levels this metric can produce values at
1710
+ */
1711
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1712
+
1713
+ /**
1714
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1715
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1716
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1717
+ */
1718
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1719
+
1720
+ /**
1721
+ * Whether you can create a variant of this metric with POST
1722
+ * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1723
+ * configuration comes from the metric they derive from), for HTTP request metrics
1724
+ * (their configuration is the request, edited on the metric), for
1725
+ * provider-computed metrics whose calculation lives in the collector rather than
1726
+ * an editable prompt, and for metrics in a package that manages its own variants.
1727
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1728
+ * from a 403.
1729
+ */
1730
+ supportsVariants: boolean;
1731
+
1732
+ /**
1733
+ * Type of value this metric produces
1734
+ */
1735
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1736
+
1737
+ /**
1738
+ * The resolved variant this response reflects (org-scoped Default if the org has
1739
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
1740
+ * building a derived metric off this one to pin the exact config.
1741
+ */
1742
+ variantId: string;
1743
+
1744
+ /**
1745
+ * The variant's current version. Immutable snapshot of the config — editing the
1746
+ * metric produces a new versionId. Use it to detect config changes.
1747
+ */
1748
+ versionId: string;
1749
+
1750
+ /**
1751
+ * Unit information if applicable
1752
+ */
1753
+ unit?: HTTPRequestMetricResponse.Unit;
1754
+ }
1755
+
1756
+ export namespace HTTPRequestMetricResponse {
1757
+ /**
1758
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
1759
+ * (for example `incorrect_barge_in_yield_count` over
1760
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
1761
+ * live. The count value itself carries neither. `null` for a metric that is its
1762
+ * own evidence.
1763
+ */
1764
+ export interface EvidenceSource {
1765
+ /**
1766
+ * The per-turn value this metric tallies. `false` for an "incorrect" count over an
1767
+ * appropriateness metric, `true` for a count of a boolean event.
1768
+ */
1769
+ countsWhen: boolean;
1770
+
1771
+ /**
1772
+ * Slug of the metric whose per-turn values are the evidence behind this count or
1773
+ * rate
1774
+ */
1775
+ metricId: string;
1776
+ }
1415
1777
 
1416
- sourceMetricDefinitionId: string;
1778
+ /**
1779
+ * The request this metric sends.
1780
+ */
1781
+ export interface HTTPRequest {
1782
+ /**
1783
+ * The JSON body template, or null when the default payload is sent
1784
+ */
1785
+ body: string | null;
1417
1786
 
1418
- sourceParticipantRole: 'AGENT' | 'CUSTOMER' | 'SIMULATED_CUSTOMER' | 'BACKGROUND_SPEAKER' | null;
1787
+ /**
1788
+ * Request headers as key-value pairs
1789
+ */
1790
+ headers: { [key: string]: string };
1419
1791
 
1420
- sourceVariantId: string | null;
1792
+ method: 'GET' | 'POST';
1421
1793
 
1422
- thresholdValue: string;
1423
- }
1794
+ /**
1795
+ * The URL the request is sent to, placeholders included
1796
+ */
1797
+ url: string;
1424
1798
  }
1425
1799
 
1426
1800
  /**
@@ -1456,7 +1830,8 @@ export interface MetricUpdateDefinitionResponse {
1456
1830
  | MetricUpdateDefinitionResponse.LlmJudgeMetricResponse
1457
1831
  | MetricUpdateDefinitionResponse.FormulaMetricResponse
1458
1832
  | MetricUpdateDefinitionResponse.PatternMetricResponse
1459
- | MetricUpdateDefinitionResponse.ThresholdMetricResponse;
1833
+ | MetricUpdateDefinitionResponse.ThresholdMetricResponse
1834
+ | MetricUpdateDefinitionResponse.HTTPRequestMetricResponse;
1460
1835
  }
1461
1836
 
1462
1837
  export namespace MetricUpdateDefinitionResponse {
@@ -1547,10 +1922,12 @@ export namespace MetricUpdateDefinitionResponse {
1547
1922
  /**
1548
1923
  * Whether you can create a variant of this metric with POST
1549
1924
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1550
- * configuration comes from the metric they derive from), for provider-computed
1551
- * metrics whose calculation lives in the collector rather than an editable prompt,
1552
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1553
- * metrics are false, so read this rather than discovering it from a 403.
1925
+ * configuration comes from the metric they derive from), for HTTP request metrics
1926
+ * (their configuration is the request, edited on the metric), for
1927
+ * provider-computed metrics whose calculation lives in the collector rather than
1928
+ * an editable prompt, and for metrics in a package that manages its own variants.
1929
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1930
+ * from a 403.
1554
1931
  */
1555
1932
  supportsVariants: boolean;
1556
1933
 
@@ -1690,10 +2067,12 @@ export namespace MetricUpdateDefinitionResponse {
1690
2067
  /**
1691
2068
  * Whether you can create a variant of this metric with POST
1692
2069
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1693
- * configuration comes from the metric they derive from), for provider-computed
1694
- * metrics whose calculation lives in the collector rather than an editable prompt,
1695
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1696
- * metrics are false, so read this rather than discovering it from a 403.
2070
+ * configuration comes from the metric they derive from), for HTTP request metrics
2071
+ * (their configuration is the request, edited on the metric), for
2072
+ * provider-computed metrics whose calculation lives in the collector rather than
2073
+ * an editable prompt, and for metrics in a package that manages its own variants.
2074
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
2075
+ * from a 403.
1697
2076
  */
1698
2077
  supportsVariants: boolean;
1699
2078
 
@@ -1850,10 +2229,12 @@ export namespace MetricUpdateDefinitionResponse {
1850
2229
  /**
1851
2230
  * Whether you can create a variant of this metric with POST
1852
2231
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1853
- * configuration comes from the metric they derive from), for provider-computed
1854
- * metrics whose calculation lives in the collector rather than an editable prompt,
1855
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1856
- * metrics are false, so read this rather than discovering it from a 403.
2232
+ * configuration comes from the metric they derive from), for HTTP request metrics
2233
+ * (their configuration is the request, edited on the metric), for
2234
+ * provider-computed metrics whose calculation lives in the collector rather than
2235
+ * an editable prompt, and for metrics in a package that manages its own variants.
2236
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
2237
+ * from a 403.
1857
2238
  */
1858
2239
  supportsVariants: boolean;
1859
2240
 
@@ -2045,10 +2426,12 @@ export namespace MetricUpdateDefinitionResponse {
2045
2426
  /**
2046
2427
  * Whether you can create a variant of this metric with POST
2047
2428
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
2048
- * configuration comes from the metric they derive from), for provider-computed
2049
- * metrics whose calculation lives in the collector rather than an editable prompt,
2050
- * and for metrics in a package that manages its own variants. Most of Roark’s own
2051
- * metrics are false, so read this rather than discovering it from a 403.
2429
+ * configuration comes from the metric they derive from), for HTTP request metrics
2430
+ * (their configuration is the request, edited on the metric), for
2431
+ * provider-computed metrics whose calculation lives in the collector rather than
2432
+ * an editable prompt, and for metrics in a package that manages its own variants.
2433
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
2434
+ * from a 403.
2052
2435
  */
2053
2436
  supportsVariants: boolean;
2054
2437
 
@@ -2143,12 +2526,191 @@ export namespace MetricUpdateDefinitionResponse {
2143
2526
  symbol: string | null;
2144
2527
  }
2145
2528
  }
2529
+
2530
+ export interface HTTPRequestMetricResponse {
2531
+ /**
2532
+ * Unique identifier for the metric definition
2533
+ */
2534
+ id: string;
2535
+
2536
+ /**
2537
+ * What a failed check is called
2538
+ */
2539
+ booleanFalseLabel: string | null;
2540
+
2541
+ /**
2542
+ * What a passed check is called
2543
+ */
2544
+ booleanTrueLabel: string | null;
2545
+
2546
+ /**
2547
+ * BOOLEAN metric answered by your own endpoint: Roark sends a request about each
2548
+ * call and records the {"passed", "reason"} it answers with.
2549
+ */
2550
+ calculationType: 'HTTP_REQUEST';
2551
+
2552
+ /**
2553
+ * Description of what the metric measures
2554
+ */
2555
+ description: string;
2556
+
2557
+ /**
2558
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
2559
+ * (for example `incorrect_barge_in_yield_count` over
2560
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
2561
+ * live. The count value itself carries neither. `null` for a metric that is its
2562
+ * own evidence.
2563
+ */
2564
+ evidenceSource: HTTPRequestMetricResponse.EvidenceSource | null;
2565
+
2566
+ /**
2567
+ * The request this metric sends.
2568
+ */
2569
+ httpRequest: HTTPRequestMetricResponse.HTTPRequest | null;
2570
+
2571
+ /**
2572
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
2573
+ */
2574
+ metricId: string;
2575
+
2576
+ /**
2577
+ * Name of the metric
2578
+ */
2579
+ name: string;
2580
+
2581
+ /**
2582
+ * True when this metric can only be scored from a live recording
2583
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
2584
+ * simulation run forces live enrichment: the run waits for your recording and, if
2585
+ * none arrives, the metric produces no value. Check this before a run rather than
2586
+ * discovering the wait afterwards.
2587
+ */
2588
+ requiresLiveConversation: boolean;
2589
+
2590
+ /**
2591
+ * Whether metric is global or per-participant
2592
+ */
2593
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
2594
+
2595
+ /**
2596
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
2597
+ */
2598
+ slug: string;
2599
+
2600
+ /**
2601
+ * Which levels this metric can produce values at
2602
+ */
2603
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
2604
+
2605
+ /**
2606
+ * Which kinds of conversation this metric can be scored on. `null` means both.
2607
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
2608
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
2609
+ */
2610
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
2611
+
2612
+ /**
2613
+ * Whether you can create a variant of this metric with POST
2614
+ * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
2615
+ * configuration comes from the metric they derive from), for HTTP request metrics
2616
+ * (their configuration is the request, edited on the metric), for
2617
+ * provider-computed metrics whose calculation lives in the collector rather than
2618
+ * an editable prompt, and for metrics in a package that manages its own variants.
2619
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
2620
+ * from a 403.
2621
+ */
2622
+ supportsVariants: boolean;
2623
+
2624
+ /**
2625
+ * Type of value this metric produces
2626
+ */
2627
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
2628
+
2629
+ /**
2630
+ * The resolved variant this response reflects (org-scoped Default if the org has
2631
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
2632
+ * building a derived metric off this one to pin the exact config.
2633
+ */
2634
+ variantId: string;
2635
+
2636
+ /**
2637
+ * The variant's current version. Immutable snapshot of the config — editing the
2638
+ * metric produces a new versionId. Use it to detect config changes.
2639
+ */
2640
+ versionId: string;
2641
+
2642
+ /**
2643
+ * Unit information if applicable
2644
+ */
2645
+ unit?: HTTPRequestMetricResponse.Unit;
2646
+ }
2647
+
2648
+ export namespace HTTPRequestMetricResponse {
2649
+ /**
2650
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
2651
+ * (for example `incorrect_barge_in_yield_count` over
2652
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
2653
+ * live. The count value itself carries neither. `null` for a metric that is its
2654
+ * own evidence.
2655
+ */
2656
+ export interface EvidenceSource {
2657
+ /**
2658
+ * The per-turn value this metric tallies. `false` for an "incorrect" count over an
2659
+ * appropriateness metric, `true` for a count of a boolean event.
2660
+ */
2661
+ countsWhen: boolean;
2662
+
2663
+ /**
2664
+ * Slug of the metric whose per-turn values are the evidence behind this count or
2665
+ * rate
2666
+ */
2667
+ metricId: string;
2668
+ }
2669
+
2670
+ /**
2671
+ * The request this metric sends.
2672
+ */
2673
+ export interface HTTPRequest {
2674
+ /**
2675
+ * The JSON body template, or null when the default payload is sent
2676
+ */
2677
+ body: string | null;
2678
+
2679
+ /**
2680
+ * Request headers as key-value pairs
2681
+ */
2682
+ headers: { [key: string]: string };
2683
+
2684
+ method: 'GET' | 'POST';
2685
+
2686
+ /**
2687
+ * The URL the request is sent to, placeholders included
2688
+ */
2689
+ url: string;
2690
+ }
2691
+
2692
+ /**
2693
+ * Unit information if applicable
2694
+ */
2695
+ export interface Unit {
2696
+ /**
2697
+ * Name of the unit
2698
+ */
2699
+ name: string;
2700
+
2701
+ /**
2702
+ * Symbol for the unit
2703
+ */
2704
+ symbol: string | null;
2705
+ }
2706
+ }
2146
2707
  }
2147
2708
 
2148
2709
  export type MetricCreateDefinitionParams =
2149
2710
  | MetricCreateDefinitionParams.PromptMetricInput
2150
2711
  | MetricCreateDefinitionParams.FormulaMetricInput
2151
- | MetricCreateDefinitionParams.PatternMetricInput;
2712
+ | MetricCreateDefinitionParams.PatternMetricInput
2713
+ | MetricCreateDefinitionParams.HTTPRequestMetricInput;
2152
2714
 
2153
2715
  export declare namespace MetricCreateDefinitionParams {
2154
2716
  export interface PromptMetricInput {
@@ -2471,6 +3033,86 @@ export declare namespace MetricCreateDefinitionParams {
2471
3033
  sourceVariantId?: string;
2472
3034
  }
2473
3035
  }
3036
+
3037
+ export interface HTTPRequestMetricInput {
3038
+ /**
3039
+ * BOOLEAN metric answered by your own endpoint. Roark sends a request about each
3040
+ * call, live or simulated, and your endpoint answers {"passed": true | false,
3041
+ * "reason": "..."}.
3042
+ */
3043
+ calculationType: 'HTTP_REQUEST';
3044
+
3045
+ /**
3046
+ * The request to send. With no body, Roark POSTs the default payload: { version,
3047
+ * requestId, metric, call, simulation }.
3048
+ */
3049
+ httpRequest: HTTPRequestMetricInput.HTTPRequest;
3050
+
3051
+ /**
3052
+ * Name of the metric
3053
+ */
3054
+ name: string;
3055
+
3056
+ /**
3057
+ * ID of the analysis package to add this metric to. Optional: when omitted, the
3058
+ * metric is added to a default "Custom Metrics" package for your project (created
3059
+ * automatically the first time).
3060
+ */
3061
+ analysisPackageId?: string;
3062
+
3063
+ /**
3064
+ * What a failed check is called (default: Fail)
3065
+ */
3066
+ booleanFalseLabel?: string;
3067
+
3068
+ /**
3069
+ * What a passed check is called (default: Pass)
3070
+ */
3071
+ booleanTrueLabel?: string;
3072
+
3073
+ /**
3074
+ * Alias of `slug` accepted for backwards compatibility. Use `slug` for new
3075
+ * integrations.
3076
+ */
3077
+ metricId?: string;
3078
+
3079
+ /**
3080
+ * Stable slug for the metric. Auto-generated from name if omitted.
3081
+ */
3082
+ slug?: string;
3083
+ }
3084
+
3085
+ export namespace HTTPRequestMetricInput {
3086
+ /**
3087
+ * The request to send. With no body, Roark POSTs the default payload: { version,
3088
+ * requestId, metric, call, simulation }.
3089
+ */
3090
+ export interface HTTPRequest {
3091
+ /**
3092
+ * Public http(s) URL. May contain {{path}} placeholders into the request payload,
3093
+ * which are URL-encoded.
3094
+ */
3095
+ url: string;
3096
+
3097
+ /**
3098
+ * A JSON template with {{path}} placeholders into the request payload, such as
3099
+ * {"cardId": "{{call.properties.cardId}}"}. Omit or pass null to send the default
3100
+ * payload.
3101
+ */
3102
+ body?: string | null;
3103
+
3104
+ /**
3105
+ * Request headers, for example your own Authorization header. Values may contain
3106
+ * placeholders.
3107
+ */
3108
+ headers?: { [key: string]: string };
3109
+
3110
+ /**
3111
+ * GET or POST (default POST). A GET request has no body.
3112
+ */
3113
+ method?: 'GET' | 'POST';
3114
+ }
3115
+ }
2474
3116
  }
2475
3117
 
2476
3118
  export interface MetricListDefinitionsParams {
@@ -2510,6 +3152,12 @@ export interface MetricUpdateDefinitionParams {
2510
3152
  */
2511
3153
  formula?: string;
2512
3154
 
3155
+ /**
3156
+ * Replacement request (HTTP_REQUEST only). Send the whole request; omitted headers
3157
+ * are removed.
3158
+ */
3159
+ httpRequest?: MetricUpdateDefinitionParams.HTTPRequest;
3160
+
2513
3161
  /**
2514
3162
  * New LLM prompt (only for LLM_JUDGE metrics whose prompt is editable)
2515
3163
  */
@@ -2590,6 +3238,36 @@ export namespace MetricUpdateDefinitionParams {
2590
3238
  label: string;
2591
3239
  }
2592
3240
 
3241
+ /**
3242
+ * Replacement request (HTTP_REQUEST only). Send the whole request; omitted headers
3243
+ * are removed.
3244
+ */
3245
+ export interface HTTPRequest {
3246
+ /**
3247
+ * Public http(s) URL. May contain {{path}} placeholders into the request payload,
3248
+ * which are URL-encoded.
3249
+ */
3250
+ url: string;
3251
+
3252
+ /**
3253
+ * A JSON template with {{path}} placeholders into the request payload, such as
3254
+ * {"cardId": "{{call.properties.cardId}}"}. Omit or pass null to send the default
3255
+ * payload.
3256
+ */
3257
+ body?: string | null;
3258
+
3259
+ /**
3260
+ * Request headers, for example your own Authorization header. Values may contain
3261
+ * placeholders.
3262
+ */
3263
+ headers?: { [key: string]: string };
3264
+
3265
+ /**
3266
+ * GET or POST (default POST). A GET request has no body.
3267
+ */
3268
+ method?: 'GET' | 'POST';
3269
+ }
3270
+
2593
3271
  export interface ScaleLabel {
2594
3272
  /**
2595
3273
  * Display order of this label