@roarkanalytics/sdk 5.16.0 → 5.17.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 (54) hide show
  1. package/CHANGELOG.md +12 -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/call.d.mts +2 -2
  12. package/resources/call.d.mts.map +1 -1
  13. package/resources/call.d.ts +2 -2
  14. package/resources/call.d.ts.map +1 -1
  15. package/resources/index.d.mts +1 -0
  16. package/resources/index.d.mts.map +1 -1
  17. package/resources/index.d.ts +1 -0
  18. package/resources/index.d.ts.map +1 -1
  19. package/resources/index.js +3 -1
  20. package/resources/index.js.map +1 -1
  21. package/resources/index.mjs +1 -0
  22. package/resources/index.mjs.map +1 -1
  23. package/resources/metric.d.mts +638 -52
  24. package/resources/metric.d.mts.map +1 -1
  25. package/resources/metric.d.ts +638 -52
  26. package/resources/metric.d.ts.map +1 -1
  27. package/resources/phone-number.d.mts +367 -0
  28. package/resources/phone-number.d.mts.map +1 -0
  29. package/resources/phone-number.d.ts +367 -0
  30. package/resources/phone-number.d.ts.map +1 -0
  31. package/resources/phone-number.js +88 -0
  32. package/resources/phone-number.js.map +1 -0
  33. package/resources/phone-number.mjs +84 -0
  34. package/resources/phone-number.mjs.map +1 -0
  35. package/resources/simulation-run-plan-job.d.mts +2 -2
  36. package/resources/simulation-run-plan-job.d.mts.map +1 -1
  37. package/resources/simulation-run-plan-job.d.ts +2 -2
  38. package/resources/simulation-run-plan-job.d.ts.map +1 -1
  39. package/resources/usage.d.mts +1 -1
  40. package/resources/usage.d.mts.map +1 -1
  41. package/resources/usage.d.ts +1 -1
  42. package/resources/usage.d.ts.map +1 -1
  43. package/src/client.ts +29 -0
  44. package/src/resources/call.ts +4 -2
  45. package/src/resources/index.ts +13 -0
  46. package/src/resources/metric.ts +742 -64
  47. package/src/resources/phone-number.ts +472 -0
  48. package/src/resources/simulation-run-plan-job.ts +4 -2
  49. package/src/resources/usage.ts +2 -1
  50. package/src/version.ts +1 -1
  51. package/version.d.mts +1 -1
  52. package/version.d.ts +1 -1
  53. package/version.js +1 -1
  54. package/version.mjs +1 -1
@@ -54,7 +54,7 @@ export interface MetricCreateDefinitionResponse {
54
54
  /**
55
55
  * The created metric definition. The variant is selected by `calculationType`.
56
56
  */
57
- data: MetricCreateDefinitionResponse.LlmJudgeMetricResponse | MetricCreateDefinitionResponse.FormulaMetricResponse | MetricCreateDefinitionResponse.PatternMetricResponse;
57
+ data: MetricCreateDefinitionResponse.LlmJudgeMetricResponse | MetricCreateDefinitionResponse.FormulaMetricResponse | MetricCreateDefinitionResponse.PatternMetricResponse | MetricCreateDefinitionResponse.HTTPRequestMetricResponse;
58
58
  }
59
59
  export declare namespace MetricCreateDefinitionResponse {
60
60
  interface LlmJudgeMetricResponse {
@@ -130,10 +130,12 @@ export declare namespace MetricCreateDefinitionResponse {
130
130
  /**
131
131
  * Whether you can create a variant of this metric with POST
132
132
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
133
- * configuration comes from the metric they derive from), for provider-computed
134
- * metrics whose calculation lives in the collector rather than an editable prompt,
135
- * and for metrics in a package that manages its own variants. Most of Roark’s own
136
- * metrics are false, so read this rather than discovering it from a 403.
133
+ * configuration comes from the metric they derive from), for HTTP request metrics
134
+ * (their configuration is the request, edited on the metric), for
135
+ * provider-computed metrics whose calculation lives in the collector rather than
136
+ * an editable prompt, and for metrics in a package that manages its own variants.
137
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
138
+ * from a 403.
137
139
  */
138
140
  supportsVariants: boolean;
139
141
  /**
@@ -252,10 +254,12 @@ export declare namespace MetricCreateDefinitionResponse {
252
254
  /**
253
255
  * Whether you can create a variant of this metric with POST
254
256
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
255
- * configuration comes from the metric they derive from), for provider-computed
256
- * metrics whose calculation lives in the collector rather than an editable prompt,
257
- * and for metrics in a package that manages its own variants. Most of Roark’s own
258
- * metrics are false, so read this rather than discovering it from a 403.
257
+ * configuration comes from the metric they derive from), for HTTP request metrics
258
+ * (their configuration is the request, edited on the metric), for
259
+ * provider-computed metrics whose calculation lives in the collector rather than
260
+ * an editable prompt, and for metrics in a package that manages its own variants.
261
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
262
+ * from a 403.
259
263
  */
260
264
  supportsVariants: boolean;
261
265
  /**
@@ -387,10 +391,12 @@ export declare namespace MetricCreateDefinitionResponse {
387
391
  /**
388
392
  * Whether you can create a variant of this metric with POST
389
393
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
390
- * configuration comes from the metric they derive from), for provider-computed
391
- * metrics whose calculation lives in the collector rather than an editable prompt,
392
- * and for metrics in a package that manages its own variants. Most of Roark’s own
393
- * metrics are false, so read this rather than discovering it from a 403.
394
+ * configuration comes from the metric they derive from), for HTTP request metrics
395
+ * (their configuration is the request, edited on the metric), for
396
+ * provider-computed metrics whose calculation lives in the collector rather than
397
+ * an editable prompt, and for metrics in a package that manages its own variants.
398
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
399
+ * from a 403.
394
400
  */
395
401
  supportsVariants: boolean;
396
402
  /**
@@ -475,12 +481,165 @@ export declare namespace MetricCreateDefinitionResponse {
475
481
  symbol: string | null;
476
482
  }
477
483
  }
484
+ interface HTTPRequestMetricResponse {
485
+ /**
486
+ * Unique identifier for the metric definition
487
+ */
488
+ id: string;
489
+ /**
490
+ * What a failed check is called
491
+ */
492
+ booleanFalseLabel: string | null;
493
+ /**
494
+ * What a passed check is called
495
+ */
496
+ booleanTrueLabel: string | null;
497
+ /**
498
+ * BOOLEAN metric answered by your own endpoint: Roark sends a request about each
499
+ * call and records the {"passed", "reason"} it answers with.
500
+ */
501
+ calculationType: 'HTTP_REQUEST';
502
+ /**
503
+ * Description of what the metric measures
504
+ */
505
+ description: string;
506
+ /**
507
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
508
+ * (for example `incorrect_barge_in_yield_count` over
509
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
510
+ * live. The count value itself carries neither. `null` for a metric that is its
511
+ * own evidence.
512
+ */
513
+ evidenceSource: HTTPRequestMetricResponse.EvidenceSource | null;
514
+ /**
515
+ * The request this metric sends.
516
+ */
517
+ httpRequest: HTTPRequestMetricResponse.HTTPRequest | null;
518
+ /**
519
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
520
+ */
521
+ metricId: string;
522
+ /**
523
+ * Name of the metric
524
+ */
525
+ name: string;
526
+ /**
527
+ * True when this metric can only be scored from a live recording
528
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
529
+ * simulation run forces live enrichment: the run waits for your recording and, if
530
+ * none arrives, the metric produces no value. Check this before a run rather than
531
+ * discovering the wait afterwards.
532
+ */
533
+ requiresLiveConversation: boolean;
534
+ /**
535
+ * Whether metric is global or per-participant
536
+ */
537
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
538
+ /**
539
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
540
+ */
541
+ slug: string;
542
+ /**
543
+ * Which levels this metric can produce values at
544
+ */
545
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
546
+ /**
547
+ * Which kinds of conversation this metric can be scored on. `null` means both.
548
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
549
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
550
+ */
551
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
552
+ /**
553
+ * Whether you can create a variant of this metric with POST
554
+ * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
555
+ * configuration comes from the metric they derive from), for HTTP request metrics
556
+ * (their configuration is the request, edited on the metric), for
557
+ * provider-computed metrics whose calculation lives in the collector rather than
558
+ * an editable prompt, and for metrics in a package that manages its own variants.
559
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
560
+ * from a 403.
561
+ */
562
+ supportsVariants: boolean;
563
+ /**
564
+ * Type of value this metric produces
565
+ */
566
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
567
+ /**
568
+ * The resolved variant this response reflects (org-scoped Default if the org has
569
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
570
+ * building a derived metric off this one to pin the exact config.
571
+ */
572
+ variantId: string;
573
+ /**
574
+ * The variant's current version. Immutable snapshot of the config — editing the
575
+ * metric produces a new versionId. Use it to detect config changes.
576
+ */
577
+ versionId: string;
578
+ /**
579
+ * Unit information if applicable
580
+ */
581
+ unit?: HTTPRequestMetricResponse.Unit;
582
+ }
583
+ namespace HTTPRequestMetricResponse {
584
+ /**
585
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
586
+ * (for example `incorrect_barge_in_yield_count` over
587
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
588
+ * live. The count value itself carries neither. `null` for a metric that is its
589
+ * own evidence.
590
+ */
591
+ interface EvidenceSource {
592
+ /**
593
+ * The per-turn value this metric tallies. `false` for an "incorrect" count over an
594
+ * appropriateness metric, `true` for a count of a boolean event.
595
+ */
596
+ countsWhen: boolean;
597
+ /**
598
+ * Slug of the metric whose per-turn values are the evidence behind this count or
599
+ * rate
600
+ */
601
+ metricId: string;
602
+ }
603
+ /**
604
+ * The request this metric sends.
605
+ */
606
+ interface HTTPRequest {
607
+ /**
608
+ * The JSON body template, or null when the default payload is sent
609
+ */
610
+ body: string | null;
611
+ /**
612
+ * Request headers as key-value pairs
613
+ */
614
+ headers: {
615
+ [key: string]: string;
616
+ };
617
+ method: 'GET' | 'POST';
618
+ /**
619
+ * The URL the request is sent to, placeholders included
620
+ */
621
+ url: string;
622
+ }
623
+ /**
624
+ * Unit information if applicable
625
+ */
626
+ interface Unit {
627
+ /**
628
+ * Name of the unit
629
+ */
630
+ name: string;
631
+ /**
632
+ * Symbol for the unit
633
+ */
634
+ symbol: string | null;
635
+ }
636
+ }
478
637
  }
479
638
  /**
480
639
  * Cursor-paginated metric definitions available in the project
481
640
  */
482
641
  export interface MetricListDefinitionsResponse {
483
- data: Array<MetricListDefinitionsResponse.LlmJudgeMetricResponse | MetricListDefinitionsResponse.ProviderMetricResponse | MetricListDefinitionsResponse.ThresholdMetricResponse | MetricListDefinitionsResponse.FormulaMetricResponse | MetricListDefinitionsResponse.PatternMetricResponse>;
642
+ data: Array<MetricListDefinitionsResponse.LlmJudgeMetricResponse | MetricListDefinitionsResponse.ProviderMetricResponse | MetricListDefinitionsResponse.ThresholdMetricResponse | MetricListDefinitionsResponse.FormulaMetricResponse | MetricListDefinitionsResponse.PatternMetricResponse | MetricListDefinitionsResponse.HTTPRequestMetricResponse>;
484
643
  pagination: MetricListDefinitionsResponse.Pagination;
485
644
  }
486
645
  export declare namespace MetricListDefinitionsResponse {
@@ -557,10 +716,12 @@ export declare namespace MetricListDefinitionsResponse {
557
716
  /**
558
717
  * Whether you can create a variant of this metric with POST
559
718
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
560
- * configuration comes from the metric they derive from), for provider-computed
561
- * metrics whose calculation lives in the collector rather than an editable prompt,
562
- * and for metrics in a package that manages its own variants. Most of Roark’s own
563
- * metrics are false, so read this rather than discovering it from a 403.
719
+ * configuration comes from the metric they derive from), for HTTP request metrics
720
+ * (their configuration is the request, edited on the metric), for
721
+ * provider-computed metrics whose calculation lives in the collector rather than
722
+ * an editable prompt, and for metrics in a package that manages its own variants.
723
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
724
+ * from a 403.
564
725
  */
565
726
  supportsVariants: boolean;
566
727
  /**
@@ -675,10 +836,12 @@ export declare namespace MetricListDefinitionsResponse {
675
836
  /**
676
837
  * Whether you can create a variant of this metric with POST
677
838
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
678
- * configuration comes from the metric they derive from), for provider-computed
679
- * metrics whose calculation lives in the collector rather than an editable prompt,
680
- * and for metrics in a package that manages its own variants. Most of Roark’s own
681
- * metrics are false, so read this rather than discovering it from a 403.
839
+ * configuration comes from the metric they derive from), for HTTP request metrics
840
+ * (their configuration is the request, edited on the metric), for
841
+ * provider-computed metrics whose calculation lives in the collector rather than
842
+ * an editable prompt, and for metrics in a package that manages its own variants.
843
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
844
+ * from a 403.
682
845
  */
683
846
  supportsVariants: boolean;
684
847
  /**
@@ -793,10 +956,12 @@ export declare namespace MetricListDefinitionsResponse {
793
956
  /**
794
957
  * Whether you can create a variant of this metric with POST
795
958
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
796
- * configuration comes from the metric they derive from), for provider-computed
797
- * metrics whose calculation lives in the collector rather than an editable prompt,
798
- * and for metrics in a package that manages its own variants. Most of Roark’s own
799
- * metrics are false, so read this rather than discovering it from a 403.
959
+ * configuration comes from the metric they derive from), for HTTP request metrics
960
+ * (their configuration is the request, edited on the metric), for
961
+ * provider-computed metrics whose calculation lives in the collector rather than
962
+ * an editable prompt, and for metrics in a package that manages its own variants.
963
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
964
+ * from a 403.
800
965
  */
801
966
  supportsVariants: boolean;
802
967
  /**
@@ -931,10 +1096,12 @@ export declare namespace MetricListDefinitionsResponse {
931
1096
  /**
932
1097
  * Whether you can create a variant of this metric with POST
933
1098
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
934
- * configuration comes from the metric they derive from), for provider-computed
935
- * metrics whose calculation lives in the collector rather than an editable prompt,
936
- * and for metrics in a package that manages its own variants. Most of Roark’s own
937
- * metrics are false, so read this rather than discovering it from a 403.
1099
+ * configuration comes from the metric they derive from), for HTTP request metrics
1100
+ * (their configuration is the request, edited on the metric), for
1101
+ * provider-computed metrics whose calculation lives in the collector rather than
1102
+ * an editable prompt, and for metrics in a package that manages its own variants.
1103
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1104
+ * from a 403.
938
1105
  */
939
1106
  supportsVariants: boolean;
940
1107
  /**
@@ -1066,10 +1233,12 @@ export declare namespace MetricListDefinitionsResponse {
1066
1233
  /**
1067
1234
  * Whether you can create a variant of this metric with POST
1068
1235
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1069
- * configuration comes from the metric they derive from), for provider-computed
1070
- * metrics whose calculation lives in the collector rather than an editable prompt,
1071
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1072
- * metrics are false, so read this rather than discovering it from a 403.
1236
+ * configuration comes from the metric they derive from), for HTTP request metrics
1237
+ * (their configuration is the request, edited on the metric), for
1238
+ * provider-computed metrics whose calculation lives in the collector rather than
1239
+ * an editable prompt, and for metrics in a package that manages its own variants.
1240
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1241
+ * from a 403.
1073
1242
  */
1074
1243
  supportsVariants: boolean;
1075
1244
  /**
@@ -1154,6 +1323,159 @@ export declare namespace MetricListDefinitionsResponse {
1154
1323
  symbol: string | null;
1155
1324
  }
1156
1325
  }
1326
+ interface HTTPRequestMetricResponse {
1327
+ /**
1328
+ * Unique identifier for the metric definition
1329
+ */
1330
+ id: string;
1331
+ /**
1332
+ * What a failed check is called
1333
+ */
1334
+ booleanFalseLabel: string | null;
1335
+ /**
1336
+ * What a passed check is called
1337
+ */
1338
+ booleanTrueLabel: string | null;
1339
+ /**
1340
+ * BOOLEAN metric answered by your own endpoint: Roark sends a request about each
1341
+ * call and records the {"passed", "reason"} it answers with.
1342
+ */
1343
+ calculationType: 'HTTP_REQUEST';
1344
+ /**
1345
+ * Description of what the metric measures
1346
+ */
1347
+ description: string;
1348
+ /**
1349
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
1350
+ * (for example `incorrect_barge_in_yield_count` over
1351
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
1352
+ * live. The count value itself carries neither. `null` for a metric that is its
1353
+ * own evidence.
1354
+ */
1355
+ evidenceSource: HTTPRequestMetricResponse.EvidenceSource | null;
1356
+ /**
1357
+ * The request this metric sends.
1358
+ */
1359
+ httpRequest: HTTPRequestMetricResponse.HTTPRequest | null;
1360
+ /**
1361
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
1362
+ */
1363
+ metricId: string;
1364
+ /**
1365
+ * Name of the metric
1366
+ */
1367
+ name: string;
1368
+ /**
1369
+ * True when this metric can only be scored from a live recording
1370
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
1371
+ * simulation run forces live enrichment: the run waits for your recording and, if
1372
+ * none arrives, the metric produces no value. Check this before a run rather than
1373
+ * discovering the wait afterwards.
1374
+ */
1375
+ requiresLiveConversation: boolean;
1376
+ /**
1377
+ * Whether metric is global or per-participant
1378
+ */
1379
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
1380
+ /**
1381
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
1382
+ */
1383
+ slug: string;
1384
+ /**
1385
+ * Which levels this metric can produce values at
1386
+ */
1387
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
1388
+ /**
1389
+ * Which kinds of conversation this metric can be scored on. `null` means both.
1390
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
1391
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
1392
+ */
1393
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
1394
+ /**
1395
+ * Whether you can create a variant of this metric with POST
1396
+ * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1397
+ * configuration comes from the metric they derive from), for HTTP request metrics
1398
+ * (their configuration is the request, edited on the metric), for
1399
+ * provider-computed metrics whose calculation lives in the collector rather than
1400
+ * an editable prompt, and for metrics in a package that manages its own variants.
1401
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1402
+ * from a 403.
1403
+ */
1404
+ supportsVariants: boolean;
1405
+ /**
1406
+ * Type of value this metric produces
1407
+ */
1408
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
1409
+ /**
1410
+ * The resolved variant this response reflects (org-scoped Default if the org has
1411
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
1412
+ * building a derived metric off this one to pin the exact config.
1413
+ */
1414
+ variantId: string;
1415
+ /**
1416
+ * The variant's current version. Immutable snapshot of the config — editing the
1417
+ * metric produces a new versionId. Use it to detect config changes.
1418
+ */
1419
+ versionId: string;
1420
+ /**
1421
+ * Unit information if applicable
1422
+ */
1423
+ unit?: HTTPRequestMetricResponse.Unit;
1424
+ }
1425
+ namespace HTTPRequestMetricResponse {
1426
+ /**
1427
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
1428
+ * (for example `incorrect_barge_in_yield_count` over
1429
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
1430
+ * live. The count value itself carries neither. `null` for a metric that is its
1431
+ * own evidence.
1432
+ */
1433
+ interface EvidenceSource {
1434
+ /**
1435
+ * The per-turn value this metric tallies. `false` for an "incorrect" count over an
1436
+ * appropriateness metric, `true` for a count of a boolean event.
1437
+ */
1438
+ countsWhen: boolean;
1439
+ /**
1440
+ * Slug of the metric whose per-turn values are the evidence behind this count or
1441
+ * rate
1442
+ */
1443
+ metricId: string;
1444
+ }
1445
+ /**
1446
+ * The request this metric sends.
1447
+ */
1448
+ interface HTTPRequest {
1449
+ /**
1450
+ * The JSON body template, or null when the default payload is sent
1451
+ */
1452
+ body: string | null;
1453
+ /**
1454
+ * Request headers as key-value pairs
1455
+ */
1456
+ headers: {
1457
+ [key: string]: string;
1458
+ };
1459
+ method: 'GET' | 'POST';
1460
+ /**
1461
+ * The URL the request is sent to, placeholders included
1462
+ */
1463
+ url: string;
1464
+ }
1465
+ /**
1466
+ * Unit information if applicable
1467
+ */
1468
+ interface Unit {
1469
+ /**
1470
+ * Name of the unit
1471
+ */
1472
+ name: string;
1473
+ /**
1474
+ * Symbol for the unit
1475
+ */
1476
+ symbol: string | null;
1477
+ }
1478
+ }
1157
1479
  interface Pagination {
1158
1480
  hasMore: boolean;
1159
1481
  limit: number;
@@ -1164,7 +1486,7 @@ export interface MetricUpdateDefinitionResponse {
1164
1486
  /**
1165
1487
  * The updated metric definition. The variant is selected by `calculationType`.
1166
1488
  */
1167
- data: MetricUpdateDefinitionResponse.LlmJudgeMetricResponse | MetricUpdateDefinitionResponse.FormulaMetricResponse | MetricUpdateDefinitionResponse.PatternMetricResponse | MetricUpdateDefinitionResponse.ThresholdMetricResponse;
1489
+ data: MetricUpdateDefinitionResponse.LlmJudgeMetricResponse | MetricUpdateDefinitionResponse.FormulaMetricResponse | MetricUpdateDefinitionResponse.PatternMetricResponse | MetricUpdateDefinitionResponse.ThresholdMetricResponse | MetricUpdateDefinitionResponse.HTTPRequestMetricResponse;
1168
1490
  }
1169
1491
  export declare namespace MetricUpdateDefinitionResponse {
1170
1492
  interface LlmJudgeMetricResponse {
@@ -1240,10 +1562,12 @@ export declare namespace MetricUpdateDefinitionResponse {
1240
1562
  /**
1241
1563
  * Whether you can create a variant of this metric with POST
1242
1564
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1243
- * configuration comes from the metric they derive from), for provider-computed
1244
- * metrics whose calculation lives in the collector rather than an editable prompt,
1245
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1246
- * metrics are false, so read this rather than discovering it from a 403.
1565
+ * configuration comes from the metric they derive from), for HTTP request metrics
1566
+ * (their configuration is the request, edited on the metric), for
1567
+ * provider-computed metrics whose calculation lives in the collector rather than
1568
+ * an editable prompt, and for metrics in a package that manages its own variants.
1569
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1570
+ * from a 403.
1247
1571
  */
1248
1572
  supportsVariants: boolean;
1249
1573
  /**
@@ -1362,10 +1686,12 @@ export declare namespace MetricUpdateDefinitionResponse {
1362
1686
  /**
1363
1687
  * Whether you can create a variant of this metric with POST
1364
1688
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1365
- * configuration comes from the metric they derive from), for provider-computed
1366
- * metrics whose calculation lives in the collector rather than an editable prompt,
1367
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1368
- * metrics are false, so read this rather than discovering it from a 403.
1689
+ * configuration comes from the metric they derive from), for HTTP request metrics
1690
+ * (their configuration is the request, edited on the metric), for
1691
+ * provider-computed metrics whose calculation lives in the collector rather than
1692
+ * an editable prompt, and for metrics in a package that manages its own variants.
1693
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1694
+ * from a 403.
1369
1695
  */
1370
1696
  supportsVariants: boolean;
1371
1697
  /**
@@ -1497,10 +1823,12 @@ export declare namespace MetricUpdateDefinitionResponse {
1497
1823
  /**
1498
1824
  * Whether you can create a variant of this metric with POST
1499
1825
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1500
- * configuration comes from the metric they derive from), for provider-computed
1501
- * metrics whose calculation lives in the collector rather than an editable prompt,
1502
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1503
- * metrics are false, so read this rather than discovering it from a 403.
1826
+ * configuration comes from the metric they derive from), for HTTP request metrics
1827
+ * (their configuration is the request, edited on the metric), for
1828
+ * provider-computed metrics whose calculation lives in the collector rather than
1829
+ * an editable prompt, and for metrics in a package that manages its own variants.
1830
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1831
+ * from a 403.
1504
1832
  */
1505
1833
  supportsVariants: boolean;
1506
1834
  /**
@@ -1643,10 +1971,12 @@ export declare namespace MetricUpdateDefinitionResponse {
1643
1971
  /**
1644
1972
  * Whether you can create a variant of this metric with POST
1645
1973
  * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
1646
- * configuration comes from the metric they derive from), for provider-computed
1647
- * metrics whose calculation lives in the collector rather than an editable prompt,
1648
- * and for metrics in a package that manages its own variants. Most of Roark’s own
1649
- * metrics are false, so read this rather than discovering it from a 403.
1974
+ * configuration comes from the metric they derive from), for HTTP request metrics
1975
+ * (their configuration is the request, edited on the metric), for
1976
+ * provider-computed metrics whose calculation lives in the collector rather than
1977
+ * an editable prompt, and for metrics in a package that manages its own variants.
1978
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
1979
+ * from a 403.
1650
1980
  */
1651
1981
  supportsVariants: boolean;
1652
1982
  /**
@@ -1719,8 +2049,161 @@ export declare namespace MetricUpdateDefinitionResponse {
1719
2049
  symbol: string | null;
1720
2050
  }
1721
2051
  }
2052
+ interface HTTPRequestMetricResponse {
2053
+ /**
2054
+ * Unique identifier for the metric definition
2055
+ */
2056
+ id: string;
2057
+ /**
2058
+ * What a failed check is called
2059
+ */
2060
+ booleanFalseLabel: string | null;
2061
+ /**
2062
+ * What a passed check is called
2063
+ */
2064
+ booleanTrueLabel: string | null;
2065
+ /**
2066
+ * BOOLEAN metric answered by your own endpoint: Roark sends a request about each
2067
+ * call and records the {"passed", "reason"} it answers with.
2068
+ */
2069
+ calculationType: 'HTTP_REQUEST';
2070
+ /**
2071
+ * Description of what the metric measures
2072
+ */
2073
+ description: string;
2074
+ /**
2075
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
2076
+ * (for example `incorrect_barge_in_yield_count` over
2077
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
2078
+ * live. The count value itself carries neither. `null` for a metric that is its
2079
+ * own evidence.
2080
+ */
2081
+ evidenceSource: HTTPRequestMetricResponse.EvidenceSource | null;
2082
+ /**
2083
+ * The request this metric sends.
2084
+ */
2085
+ httpRequest: HTTPRequestMetricResponse.HTTPRequest | null;
2086
+ /**
2087
+ * Alias of `slug` retained for backwards compatibility. Same value as `slug`.
2088
+ */
2089
+ metricId: string;
2090
+ /**
2091
+ * Name of the metric
2092
+ */
2093
+ name: string;
2094
+ /**
2095
+ * True when this metric can only be scored from a live recording
2096
+ * (`supportedConversationSources` is `["LIVE"]`). Selecting one of these on a
2097
+ * simulation run forces live enrichment: the run waits for your recording and, if
2098
+ * none arrives, the metric produces no value. Check this before a run rather than
2099
+ * discovering the wait afterwards.
2100
+ */
2101
+ requiresLiveConversation: boolean;
2102
+ /**
2103
+ * Whether metric is global or per-participant
2104
+ */
2105
+ scope: 'GLOBAL' | 'PER_PARTICIPANT';
2106
+ /**
2107
+ * Stable metric slug (e.g. "call_reason", "customer_satisfaction")
2108
+ */
2109
+ slug: string;
2110
+ /**
2111
+ * Which levels this metric can produce values at
2112
+ */
2113
+ supportedContexts: Array<'CALL' | 'SEGMENT' | 'TURN'>;
2114
+ /**
2115
+ * Which kinds of conversation this metric can be scored on. `null` means both.
2116
+ * `["LIVE"]` marks a metric that can only be scored from your own recording of a
2117
+ * real call, and `["SIMULATED"]` one that only applies to simulations.
2118
+ */
2119
+ supportedConversationSources: Array<'SIMULATED' | 'LIVE'> | null;
2120
+ /**
2121
+ * Whether you can create a variant of this metric with POST
2122
+ * /v1/metric/definitions/{idOrSlug}/variants. False for threshold metrics (their
2123
+ * configuration comes from the metric they derive from), for HTTP request metrics
2124
+ * (their configuration is the request, edited on the metric), for
2125
+ * provider-computed metrics whose calculation lives in the collector rather than
2126
+ * an editable prompt, and for metrics in a package that manages its own variants.
2127
+ * Most of Roark’s own metrics are false, so read this rather than discovering it
2128
+ * from a 403.
2129
+ */
2130
+ supportsVariants: boolean;
2131
+ /**
2132
+ * Type of value this metric produces
2133
+ */
2134
+ type: 'COUNT' | 'NUMERIC' | 'BOOLEAN' | 'SCALE' | 'TEXT' | 'CLASSIFICATION' | 'OFFSET';
2135
+ /**
2136
+ * The resolved variant this response reflects (org-scoped Default if the org has
2137
+ * customized it, otherwise the system Default). Pass this as sourceVariantId when
2138
+ * building a derived metric off this one to pin the exact config.
2139
+ */
2140
+ variantId: string;
2141
+ /**
2142
+ * The variant's current version. Immutable snapshot of the config — editing the
2143
+ * metric produces a new versionId. Use it to detect config changes.
2144
+ */
2145
+ versionId: string;
2146
+ /**
2147
+ * Unit information if applicable
2148
+ */
2149
+ unit?: HTTPRequestMetricResponse.Unit;
2150
+ }
2151
+ namespace HTTPRequestMetricResponse {
2152
+ /**
2153
+ * For a Roark count or rate summed from the per-turn verdicts of a sibling metric
2154
+ * (for example `incorrect_barge_in_yield_count` over
2155
+ * `barge_in_yield_appropriateness`): where the reasoning and transcript positions
2156
+ * live. The count value itself carries neither. `null` for a metric that is its
2157
+ * own evidence.
2158
+ */
2159
+ interface EvidenceSource {
2160
+ /**
2161
+ * The per-turn value this metric tallies. `false` for an "incorrect" count over an
2162
+ * appropriateness metric, `true` for a count of a boolean event.
2163
+ */
2164
+ countsWhen: boolean;
2165
+ /**
2166
+ * Slug of the metric whose per-turn values are the evidence behind this count or
2167
+ * rate
2168
+ */
2169
+ metricId: string;
2170
+ }
2171
+ /**
2172
+ * The request this metric sends.
2173
+ */
2174
+ interface HTTPRequest {
2175
+ /**
2176
+ * The JSON body template, or null when the default payload is sent
2177
+ */
2178
+ body: string | null;
2179
+ /**
2180
+ * Request headers as key-value pairs
2181
+ */
2182
+ headers: {
2183
+ [key: string]: string;
2184
+ };
2185
+ method: 'GET' | 'POST';
2186
+ /**
2187
+ * The URL the request is sent to, placeholders included
2188
+ */
2189
+ url: string;
2190
+ }
2191
+ /**
2192
+ * Unit information if applicable
2193
+ */
2194
+ interface Unit {
2195
+ /**
2196
+ * Name of the unit
2197
+ */
2198
+ name: string;
2199
+ /**
2200
+ * Symbol for the unit
2201
+ */
2202
+ symbol: string | null;
2203
+ }
2204
+ }
1722
2205
  }
1723
- export type MetricCreateDefinitionParams = MetricCreateDefinitionParams.PromptMetricInput | MetricCreateDefinitionParams.FormulaMetricInput | MetricCreateDefinitionParams.PatternMetricInput;
2206
+ export type MetricCreateDefinitionParams = MetricCreateDefinitionParams.PromptMetricInput | MetricCreateDefinitionParams.FormulaMetricInput | MetricCreateDefinitionParams.PatternMetricInput | MetricCreateDefinitionParams.HTTPRequestMetricInput;
1724
2207
  export declare namespace MetricCreateDefinitionParams {
1725
2208
  interface PromptMetricInput {
1726
2209
  /**
@@ -1972,6 +2455,76 @@ export declare namespace MetricCreateDefinitionParams {
1972
2455
  sourceVariantId?: string;
1973
2456
  }
1974
2457
  }
2458
+ interface HTTPRequestMetricInput {
2459
+ /**
2460
+ * BOOLEAN metric answered by your own endpoint. Roark sends a request about each
2461
+ * call, live or simulated, and your endpoint answers {"passed": true | false,
2462
+ * "reason": "..."}.
2463
+ */
2464
+ calculationType: 'HTTP_REQUEST';
2465
+ /**
2466
+ * The request to send. With no body, Roark POSTs the default payload: { version,
2467
+ * requestId, metric, call, simulation }.
2468
+ */
2469
+ httpRequest: HTTPRequestMetricInput.HTTPRequest;
2470
+ /**
2471
+ * Name of the metric
2472
+ */
2473
+ name: string;
2474
+ /**
2475
+ * ID of the analysis package to add this metric to. Optional: when omitted, the
2476
+ * metric is added to a default "Custom Metrics" package for your project (created
2477
+ * automatically the first time).
2478
+ */
2479
+ analysisPackageId?: string;
2480
+ /**
2481
+ * What a failed check is called (default: Fail)
2482
+ */
2483
+ booleanFalseLabel?: string;
2484
+ /**
2485
+ * What a passed check is called (default: Pass)
2486
+ */
2487
+ booleanTrueLabel?: string;
2488
+ /**
2489
+ * Alias of `slug` accepted for backwards compatibility. Use `slug` for new
2490
+ * integrations.
2491
+ */
2492
+ metricId?: string;
2493
+ /**
2494
+ * Stable slug for the metric. Auto-generated from name if omitted.
2495
+ */
2496
+ slug?: string;
2497
+ }
2498
+ namespace HTTPRequestMetricInput {
2499
+ /**
2500
+ * The request to send. With no body, Roark POSTs the default payload: { version,
2501
+ * requestId, metric, call, simulation }.
2502
+ */
2503
+ interface HTTPRequest {
2504
+ /**
2505
+ * Public http(s) URL. May contain {{path}} placeholders into the request payload,
2506
+ * which are URL-encoded.
2507
+ */
2508
+ url: string;
2509
+ /**
2510
+ * A JSON template with {{path}} placeholders into the request payload, such as
2511
+ * {"cardId": "{{call.properties.cardId}}"}. Omit or pass null to send the default
2512
+ * payload.
2513
+ */
2514
+ body?: string | null;
2515
+ /**
2516
+ * Request headers, for example your own Authorization header. Values may contain
2517
+ * placeholders.
2518
+ */
2519
+ headers?: {
2520
+ [key: string]: string;
2521
+ };
2522
+ /**
2523
+ * GET or POST (default POST). A GET request has no body.
2524
+ */
2525
+ method?: 'GET' | 'POST';
2526
+ }
2527
+ }
1975
2528
  }
1976
2529
  export interface MetricListDefinitionsParams {
1977
2530
  after?: string;
@@ -2001,6 +2554,11 @@ export interface MetricUpdateDefinitionParams {
2001
2554
  * referenced metrics change.
2002
2555
  */
2003
2556
  formula?: string;
2557
+ /**
2558
+ * Replacement request (HTTP_REQUEST only). Send the whole request; omitted headers
2559
+ * are removed.
2560
+ */
2561
+ httpRequest?: MetricUpdateDefinitionParams.HTTPRequest;
2004
2562
  /**
2005
2563
  * New LLM prompt (only for LLM_JUDGE metrics whose prompt is editable)
2006
2564
  */
@@ -2060,6 +2618,34 @@ export declare namespace MetricUpdateDefinitionParams {
2060
2618
  displayOrder: number;
2061
2619
  label: string;
2062
2620
  }
2621
+ /**
2622
+ * Replacement request (HTTP_REQUEST only). Send the whole request; omitted headers
2623
+ * are removed.
2624
+ */
2625
+ interface HTTPRequest {
2626
+ /**
2627
+ * Public http(s) URL. May contain {{path}} placeholders into the request payload,
2628
+ * which are URL-encoded.
2629
+ */
2630
+ url: string;
2631
+ /**
2632
+ * A JSON template with {{path}} placeholders into the request payload, such as
2633
+ * {"cardId": "{{call.properties.cardId}}"}. Omit or pass null to send the default
2634
+ * payload.
2635
+ */
2636
+ body?: string | null;
2637
+ /**
2638
+ * Request headers, for example your own Authorization header. Values may contain
2639
+ * placeholders.
2640
+ */
2641
+ headers?: {
2642
+ [key: string]: string;
2643
+ };
2644
+ /**
2645
+ * GET or POST (default POST). A GET request has no body.
2646
+ */
2647
+ method?: 'GET' | 'POST';
2648
+ }
2063
2649
  interface ScaleLabel {
2064
2650
  /**
2065
2651
  * Display order of this label