@roarkanalytics/sdk 2.13.0 → 2.14.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 (53) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/LICENSE +1 -1
  3. package/index.d.mts +10 -10
  4. package/index.d.ts +10 -10
  5. package/index.d.ts.map +1 -1
  6. package/index.js.map +1 -1
  7. package/index.mjs.map +1 -1
  8. package/package.json +1 -1
  9. package/resources/call.d.ts +729 -16
  10. package/resources/call.d.ts.map +1 -1
  11. package/resources/call.js +16 -4
  12. package/resources/call.js.map +1 -1
  13. package/resources/call.mjs +16 -4
  14. package/resources/call.mjs.map +1 -1
  15. package/resources/evaluation.d.ts +85 -81
  16. package/resources/evaluation.d.ts.map +1 -1
  17. package/resources/evaluation.js +8 -8
  18. package/resources/evaluation.js.map +1 -1
  19. package/resources/evaluation.mjs +8 -8
  20. package/resources/evaluation.mjs.map +1 -1
  21. package/resources/index.d.ts +5 -5
  22. package/resources/index.d.ts.map +1 -1
  23. package/resources/index.js.map +1 -1
  24. package/resources/index.mjs.map +1 -1
  25. package/resources/metric.d.ts +5 -5
  26. package/resources/metric.d.ts.map +1 -1
  27. package/resources/metric.js +1 -1
  28. package/resources/metric.js.map +1 -1
  29. package/resources/metric.mjs +1 -1
  30. package/resources/metric.mjs.map +1 -1
  31. package/resources/persona.d.ts +21 -21
  32. package/resources/persona.d.ts.map +1 -1
  33. package/resources/persona.js +2 -2
  34. package/resources/persona.js.map +1 -1
  35. package/resources/persona.mjs +2 -2
  36. package/resources/persona.mjs.map +1 -1
  37. package/resources/simulation.d.ts +273 -28
  38. package/resources/simulation.d.ts.map +1 -1
  39. package/resources/simulation.js +37 -8
  40. package/resources/simulation.js.map +1 -1
  41. package/resources/simulation.mjs +37 -8
  42. package/resources/simulation.mjs.map +1 -1
  43. package/src/index.ts +40 -28
  44. package/src/resources/call.ts +954 -27
  45. package/src/resources/evaluation.ts +113 -108
  46. package/src/resources/index.ts +20 -14
  47. package/src/resources/metric.ts +5 -5
  48. package/src/resources/persona.ts +110 -29
  49. package/src/resources/simulation.ts +390 -34
  50. package/src/version.ts +1 -1
  51. package/version.d.ts +1 -1
  52. package/version.js +1 -1
  53. package/version.mjs +1 -1
@@ -5,6 +5,28 @@ import { isRequestOptions } from '../core';
5
5
  import * as Core from '../core';
6
6
 
7
7
  export class Call extends APIResource {
8
+ /**
9
+ * Create a new call with recording, transcript, agents, and customers
10
+ */
11
+ create(body: CallCreateParams, options?: Core.RequestOptions): Core.APIPromise<CallCreateResponse> {
12
+ return this._client.post('/v1/call', { body, ...options });
13
+ }
14
+
15
+ /**
16
+ * Returns a paginated list of calls for the authenticated project.
17
+ */
18
+ list(query?: CallListParams, options?: Core.RequestOptions): Core.APIPromise<CallListResponse>;
19
+ list(options?: Core.RequestOptions): Core.APIPromise<CallListResponse>;
20
+ list(
21
+ query: CallListParams | Core.RequestOptions = {},
22
+ options?: Core.RequestOptions,
23
+ ): Core.APIPromise<CallListResponse> {
24
+ if (isRequestOptions(query)) {
25
+ return this.list({}, query);
26
+ }
27
+ return this._client.get('/v1/call', { query, ...options });
28
+ }
29
+
8
30
  /**
9
31
  * Retrieve an existing call by its unique identifier
10
32
  */
@@ -15,10 +37,10 @@ export class Call extends APIResource {
15
37
  /**
16
38
  * Fetch all evaluation run results for a specific call.
17
39
  */
18
- getEvaluationRuns(
40
+ listEvaluationRuns(
19
41
  callId: string,
20
42
  options?: Core.RequestOptions,
21
- ): Core.APIPromise<CallGetEvaluationRunsResponse> {
43
+ ): Core.APIPromise<CallListEvaluationRunsResponse> {
22
44
  return this._client.get(`/v1/call/${callId}/evaluation-run`, options);
23
45
  }
24
46
 
@@ -26,19 +48,19 @@ export class Call extends APIResource {
26
48
  * Fetch all call-level metrics for a specific call, including both
27
49
  * system-generated and custom metrics. Only returns successfully computed metrics.
28
50
  */
29
- getMetrics(
51
+ listMetrics(
30
52
  callId: string,
31
- query?: CallGetMetricsParams,
53
+ query?: CallListMetricsParams,
32
54
  options?: Core.RequestOptions,
33
- ): Core.APIPromise<CallGetMetricsResponse>;
34
- getMetrics(callId: string, options?: Core.RequestOptions): Core.APIPromise<CallGetMetricsResponse>;
35
- getMetrics(
55
+ ): Core.APIPromise<CallListMetricsResponse>;
56
+ listMetrics(callId: string, options?: Core.RequestOptions): Core.APIPromise<CallListMetricsResponse>;
57
+ listMetrics(
36
58
  callId: string,
37
- query: CallGetMetricsParams | Core.RequestOptions = {},
59
+ query: CallListMetricsParams | Core.RequestOptions = {},
38
60
  options?: Core.RequestOptions,
39
- ): Core.APIPromise<CallGetMetricsResponse> {
61
+ ): Core.APIPromise<CallListMetricsResponse> {
40
62
  if (isRequestOptions(query)) {
41
- return this.getMetrics(callId, {}, query);
63
+ return this.listMetrics(callId, {}, query);
42
64
  }
43
65
  return this._client.get(`/v1/call/${callId}/metrics`, { query, ...options });
44
66
  }
@@ -47,14 +69,239 @@ export class Call extends APIResource {
47
69
  * Fetch detailed sentiment analysis results for a specific call, including
48
70
  * emotional tone, key phrases, and sentiment scores.
49
71
  */
50
- getSentimentRuns(
72
+ listSentimentRuns(
51
73
  callId: string,
52
74
  options?: Core.RequestOptions,
53
- ): Core.APIPromise<CallGetSentimentRunsResponse> {
75
+ ): Core.APIPromise<CallListSentimentRunsResponse> {
54
76
  return this._client.get(`/v1/call/${callId}/sentiment-run`, options);
55
77
  }
56
78
  }
57
79
 
80
+ export interface CallCreateResponse {
81
+ /**
82
+ * Response after creating a call
83
+ */
84
+ data: CallCreateResponse.Data;
85
+ }
86
+
87
+ export namespace CallCreateResponse {
88
+ /**
89
+ * Response after creating a call
90
+ */
91
+ export interface Data {
92
+ /**
93
+ * Unique identifier for the call
94
+ */
95
+ id: string;
96
+
97
+ agents: Array<Data.Agent> | null;
98
+
99
+ /**
100
+ * Direction of the call (inbound or outbound)
101
+ */
102
+ callDirection: 'INBOUND' | 'OUTBOUND';
103
+
104
+ createdAt: string | null;
105
+
106
+ customers: Array<Data.Customer> | null;
107
+
108
+ /**
109
+ * ID of the project this call belongs to
110
+ */
111
+ projectId: string;
112
+
113
+ /**
114
+ * Timestamp when the call started
115
+ */
116
+ startedAt: string;
117
+
118
+ status: 'RINGING' | 'IN_PROGRESS' | 'ENDED' | null;
119
+ }
120
+
121
+ export namespace Data {
122
+ export interface Agent {
123
+ id: string;
124
+
125
+ endpoint?: Agent.Endpoint | null;
126
+ }
127
+
128
+ export namespace Agent {
129
+ export interface Endpoint {
130
+ id: string;
131
+
132
+ environment: string;
133
+
134
+ phoneNumberE164?: string | null;
135
+ }
136
+ }
137
+
138
+ export interface Customer {
139
+ label?: string | null;
140
+
141
+ phoneNumberE164?: string | null;
142
+ }
143
+ }
144
+ }
145
+
146
+ export interface CallListResponse {
147
+ data: Array<CallListResponse.Data>;
148
+
149
+ pagination: CallListResponse.Pagination;
150
+ }
151
+
152
+ export namespace CallListResponse {
153
+ /**
154
+ * Response containing call information
155
+ */
156
+ export interface Data {
157
+ /**
158
+ * Unique identifier for the call
159
+ */
160
+ id: string;
161
+
162
+ /**
163
+ * Direction of the call (inbound or outbound)
164
+ */
165
+ callDirection: 'INBOUND' | 'OUTBOUND';
166
+
167
+ /**
168
+ * ID of the project this call belongs to
169
+ */
170
+ projectId: string;
171
+
172
+ /**
173
+ * Timestamp when the call started
174
+ */
175
+ startedAt: string;
176
+
177
+ /**
178
+ * Agent information
179
+ */
180
+ agents?: Array<Data.Agent> | null;
181
+
182
+ /**
183
+ * Timestamp when the call record was created
184
+ */
185
+ createdAt?: string | null;
186
+
187
+ /**
188
+ * Customer information
189
+ */
190
+ customers?: Array<Data.Customer> | null;
191
+
192
+ /**
193
+ * Duration of the call in milliseconds
194
+ */
195
+ durationMs?: number | null;
196
+
197
+ /**
198
+ * Timestamp when the call ended
199
+ */
200
+ endedAt?: string | null;
201
+
202
+ /**
203
+ * Status indicating how the call ended
204
+ */
205
+ endedStatus?:
206
+ | 'PARTICIPANTS_DID_NOT_SPEAK'
207
+ | 'AGENT_DID_NOT_ANSWER'
208
+ | 'AGENT_DID_NOT_SPEAK'
209
+ | 'AGENT_STOPPED_SPEAKING'
210
+ | 'AGENT_ENDED_CALL'
211
+ | 'AGENT_TRANSFERRED_CALL'
212
+ | 'AGENT_BUSY'
213
+ | 'AGENT_ERROR'
214
+ | 'CUSTOMER_ENDED_CALL'
215
+ | 'VOICE_MAIL_REACHED'
216
+ | 'SILENCE_TIME_OUT'
217
+ | 'PHONE_CALL_PROVIDER_CONNECTION_ERROR'
218
+ | 'CUSTOMER_DID_NOT_ANSWER'
219
+ | 'CUSTOMER_DID_NOT_SPEAK'
220
+ | 'CUSTOMER_STOPPED_SPEAKING'
221
+ | 'CUSTOMER_BUSY'
222
+ | 'DIAL_ERROR'
223
+ | 'MAX_DURATION_REACHED'
224
+ | 'UNKNOWN'
225
+ | null;
226
+
227
+ /**
228
+ * Pre-signed URL to the call recording (expires in 1 hour)
229
+ */
230
+ recordingUrl?: string | null;
231
+
232
+ /**
233
+ * ID of the simulation job if this call was generated by a simulation
234
+ */
235
+ simulationJobId?: string | null;
236
+
237
+ /**
238
+ * Current status of the call
239
+ */
240
+ status?: 'RINGING' | 'IN_PROGRESS' | 'ENDED' | null;
241
+
242
+ /**
243
+ * Auto-generated summary of the call conversation
244
+ */
245
+ summary?: string | null;
246
+
247
+ /**
248
+ * ID of the call that superseded this one (if applicable)
249
+ */
250
+ supersededByCallId?: string | null;
251
+
252
+ /**
253
+ * Auto-generated title for the call based on content
254
+ */
255
+ title?: string | null;
256
+
257
+ /**
258
+ * Timestamp when the call record was last updated
259
+ */
260
+ updatedAt?: string | null;
261
+ }
262
+
263
+ export namespace Data {
264
+ export interface Agent {
265
+ id: string;
266
+
267
+ endpoint?: Agent.Endpoint | null;
268
+ }
269
+
270
+ export namespace Agent {
271
+ export interface Endpoint {
272
+ id: string;
273
+
274
+ environment: string;
275
+
276
+ phoneNumberE164?: string | null;
277
+ }
278
+ }
279
+
280
+ export interface Customer {
281
+ label?: string | null;
282
+
283
+ phoneNumberE164?: string | null;
284
+ }
285
+ }
286
+
287
+ export interface Pagination {
288
+ /**
289
+ * Whether there are more items to fetch
290
+ */
291
+ hasMore: boolean;
292
+
293
+ /**
294
+ * Cursor for the next page of items
295
+ */
296
+ nextCursor: string | null;
297
+
298
+ /**
299
+ * Total number of items
300
+ */
301
+ total: number;
302
+ }
303
+ }
304
+
58
305
  export interface CallGetByIDResponse {
59
306
  /**
60
307
  * Response containing call information
@@ -177,7 +424,7 @@ export namespace CallGetByIDResponse {
177
424
  export interface Agent {
178
425
  id: string;
179
426
 
180
- endpoint: Agent.Endpoint;
427
+ endpoint?: Agent.Endpoint | null;
181
428
  }
182
429
 
183
430
  export namespace Agent {
@@ -191,19 +438,21 @@ export namespace CallGetByIDResponse {
191
438
  }
192
439
 
193
440
  export interface Customer {
441
+ label?: string | null;
442
+
194
443
  phoneNumberE164?: string | null;
195
444
  }
196
445
  }
197
446
  }
198
447
 
199
- export interface CallGetEvaluationRunsResponse {
448
+ export interface CallListEvaluationRunsResponse {
200
449
  /**
201
450
  * Evaluation run response payload
202
451
  */
203
- data: Array<CallGetEvaluationRunsResponse.Data>;
452
+ data: Array<CallListEvaluationRunsResponse.Data>;
204
453
  }
205
454
 
206
- export namespace CallGetEvaluationRunsResponse {
455
+ export namespace CallListEvaluationRunsResponse {
207
456
  export interface Data {
208
457
  /**
209
458
  * All block runs for this evaluator, including skipped ones
@@ -384,14 +633,14 @@ export namespace CallGetEvaluationRunsResponse {
384
633
  }
385
634
  }
386
635
 
387
- export interface CallGetMetricsResponse {
636
+ export interface CallListMetricsResponse {
388
637
  /**
389
638
  * Call metrics response payload grouped by metric definition
390
639
  */
391
- data: Array<CallGetMetricsResponse.Data>;
640
+ data: Array<CallListMetricsResponse.Data>;
392
641
  }
393
642
 
394
- export namespace CallGetMetricsResponse {
643
+ export namespace CallListMetricsResponse {
395
644
  /**
396
645
  * Call metric data grouped by metric definition
397
646
  */
@@ -582,14 +831,14 @@ export namespace CallGetMetricsResponse {
582
831
  }
583
832
  }
584
833
 
585
- export interface CallGetSentimentRunsResponse {
834
+ export interface CallListSentimentRunsResponse {
586
835
  /**
587
836
  * Sentiment run response payload
588
837
  */
589
- data: CallGetSentimentRunsResponse.Data;
838
+ data: CallListSentimentRunsResponse.Data;
590
839
  }
591
840
 
592
- export namespace CallGetSentimentRunsResponse {
841
+ export namespace CallListSentimentRunsResponse {
593
842
  /**
594
843
  * Sentiment run response payload
595
844
  */
@@ -616,7 +865,681 @@ export namespace CallGetSentimentRunsResponse {
616
865
  }
617
866
  }
618
867
 
619
- export interface CallGetMetricsParams {
868
+ export interface CallCreateParams {
869
+ /**
870
+ * Direction of the call (INBOUND or OUTBOUND)
871
+ */
872
+ callDirection: 'INBOUND' | 'OUTBOUND';
873
+
874
+ /**
875
+ * Interface type of the call (PHONE or WEB)
876
+ */
877
+ interfaceType: 'PHONE' | 'WEB';
878
+
879
+ /**
880
+ * URL of source recording (must be an accessible WAV, MP3, or MP4 file). Can be a
881
+ * signed URL.
882
+ */
883
+ recordingUrl: string;
884
+
885
+ /**
886
+ * When the call started (ISO 8601 format)
887
+ */
888
+ startedAt: string;
889
+
890
+ /**
891
+ * Single agent participating in the call. Use this for simpler API when you have
892
+ * only one agent.
893
+ */
894
+ agent?:
895
+ | CallCreateParams.AgentIdentificationByRoarkID
896
+ | CallCreateParams.AgentIdentificationByName
897
+ | CallCreateParams.AgentIdentificationByCustomID;
898
+
899
+ /**
900
+ * Agents participating in the call. Each agent requires identification and prompt
901
+ * information.
902
+ */
903
+ agents?: Array<
904
+ | CallCreateParams.AgentIdentificationByRoarkID
905
+ | CallCreateParams.AgentIdentificationByName
906
+ | CallCreateParams.AgentIdentificationByCustomID
907
+ >;
908
+
909
+ /**
910
+ * Single customer participating in the call. Use this for simpler API when you
911
+ * have only one customer.
912
+ */
913
+ customer?: CallCreateParams.Customer;
914
+
915
+ /**
916
+ * Customers participating in the call.
917
+ */
918
+ customers?: Array<CallCreateParams.Customer>;
919
+
920
+ /**
921
+ * High-level call end status, indicating how the call terminated
922
+ */
923
+ endedStatus?:
924
+ | 'PARTICIPANTS_DID_NOT_SPEAK'
925
+ | 'AGENT_DID_NOT_ANSWER'
926
+ | 'AGENT_DID_NOT_SPEAK'
927
+ | 'AGENT_STOPPED_SPEAKING'
928
+ | 'AGENT_ENDED_CALL'
929
+ | 'AGENT_TRANSFERRED_CALL'
930
+ | 'AGENT_BUSY'
931
+ | 'AGENT_ERROR'
932
+ | 'CUSTOMER_ENDED_CALL'
933
+ | 'VOICE_MAIL_REACHED'
934
+ | 'SILENCE_TIME_OUT'
935
+ | 'PHONE_CALL_PROVIDER_CONNECTION_ERROR'
936
+ | 'CUSTOMER_DID_NOT_ANSWER'
937
+ | 'CUSTOMER_DID_NOT_SPEAK'
938
+ | 'CUSTOMER_STOPPED_SPEAKING'
939
+ | 'CUSTOMER_BUSY'
940
+ | 'DIAL_ERROR'
941
+ | 'MAX_DURATION_REACHED'
942
+ | 'UNKNOWN';
943
+
944
+ /**
945
+ * Custom properties to include with the call. These can be used for filtering and
946
+ * will show in the call details page
947
+ */
948
+ properties?: { [key: string]: unknown };
949
+
950
+ /**
951
+ * URL of source stereo recording. Must be accessible. Can be a signed URL.
952
+ * Supported formats: WAV, MP3, MP4.
953
+ */
954
+ stereoRecordingUrl?: string;
955
+
956
+ /**
957
+ * List of tool invocations made during the call
958
+ */
959
+ toolInvocations?: Array<CallCreateParams.ToolInvocation>;
960
+
961
+ /**
962
+ * List of transcript entries made during the call
963
+ */
964
+ transcript?: Array<CallCreateParams.TranscriptEntryAgent | CallCreateParams.TranscriptEntryCustomer>;
965
+ }
966
+
967
+ export namespace CallCreateParams {
968
+ export interface AgentIdentificationByRoarkID {
969
+ /**
970
+ * Existing Roark agent ID
971
+ */
972
+ roarkId: string;
973
+
974
+ /**
975
+ * Endpoint configuration for this agent (optional)
976
+ */
977
+ endpoint?:
978
+ | AgentIdentificationByRoarkID.AgentEndpointByID
979
+ | AgentIdentificationByRoarkID.AgentEndpointByValue;
980
+
981
+ /**
982
+ * Agent's prompt configuration (optional)
983
+ */
984
+ prompt?: AgentIdentificationByRoarkID.Prompt;
985
+ }
986
+
987
+ export namespace AgentIdentificationByRoarkID {
988
+ export interface AgentEndpointByID {
989
+ /**
990
+ * Existing Roark endpoint ID
991
+ */
992
+ id: string;
993
+ }
994
+
995
+ /**
996
+ * Lookup or create endpoint if one with these values does not exist
997
+ */
998
+ export interface AgentEndpointByValue {
999
+ /**
1000
+ * Type of endpoint (phone or websocket)
1001
+ */
1002
+ type: string;
1003
+
1004
+ /**
1005
+ * Endpoint value (phone number in E.164 format or websocket URL)
1006
+ */
1007
+ value: string;
1008
+
1009
+ /**
1010
+ * Call direction for this endpoint
1011
+ */
1012
+ direction?: string;
1013
+ }
1014
+
1015
+ /**
1016
+ * Agent's prompt configuration (optional)
1017
+ */
1018
+ export interface Prompt {
1019
+ /**
1020
+ * The agent's system prompt used during this call
1021
+ */
1022
+ resolvedPrompt: string;
1023
+ }
1024
+ }
1025
+
1026
+ /**
1027
+ * Create a new agent or find existing by customId if provided
1028
+ */
1029
+ export interface AgentIdentificationByName {
1030
+ /**
1031
+ * Agent name
1032
+ */
1033
+ name: string;
1034
+
1035
+ /**
1036
+ * Agent custom ID
1037
+ */
1038
+ customId?: string;
1039
+
1040
+ /**
1041
+ * Agent description
1042
+ */
1043
+ description?: string;
1044
+
1045
+ /**
1046
+ * Endpoint configuration for this agent (optional)
1047
+ */
1048
+ endpoint?: AgentIdentificationByName.AgentEndpointByID | AgentIdentificationByName.AgentEndpointByValue;
1049
+
1050
+ /**
1051
+ * Agent's prompt configuration (optional)
1052
+ */
1053
+ prompt?: AgentIdentificationByName.Prompt;
1054
+ }
1055
+
1056
+ export namespace AgentIdentificationByName {
1057
+ export interface AgentEndpointByID {
1058
+ /**
1059
+ * Existing Roark endpoint ID
1060
+ */
1061
+ id: string;
1062
+ }
1063
+
1064
+ /**
1065
+ * Lookup or create endpoint if one with these values does not exist
1066
+ */
1067
+ export interface AgentEndpointByValue {
1068
+ /**
1069
+ * Type of endpoint (phone or websocket)
1070
+ */
1071
+ type: string;
1072
+
1073
+ /**
1074
+ * Endpoint value (phone number in E.164 format or websocket URL)
1075
+ */
1076
+ value: string;
1077
+
1078
+ /**
1079
+ * Call direction for this endpoint
1080
+ */
1081
+ direction?: string;
1082
+ }
1083
+
1084
+ /**
1085
+ * Agent's prompt configuration (optional)
1086
+ */
1087
+ export interface Prompt {
1088
+ /**
1089
+ * The agent's system prompt used during this call
1090
+ */
1091
+ resolvedPrompt: string;
1092
+ }
1093
+ }
1094
+
1095
+ export interface AgentIdentificationByCustomID {
1096
+ /**
1097
+ * Existing custom ID for a Roark agent
1098
+ */
1099
+ customId: string;
1100
+
1101
+ /**
1102
+ * Endpoint configuration for this agent (optional)
1103
+ */
1104
+ endpoint?:
1105
+ | AgentIdentificationByCustomID.AgentEndpointByID
1106
+ | AgentIdentificationByCustomID.AgentEndpointByValue;
1107
+
1108
+ /**
1109
+ * Agent's prompt configuration (optional)
1110
+ */
1111
+ prompt?: AgentIdentificationByCustomID.Prompt;
1112
+ }
1113
+
1114
+ export namespace AgentIdentificationByCustomID {
1115
+ export interface AgentEndpointByID {
1116
+ /**
1117
+ * Existing Roark endpoint ID
1118
+ */
1119
+ id: string;
1120
+ }
1121
+
1122
+ /**
1123
+ * Lookup or create endpoint if one with these values does not exist
1124
+ */
1125
+ export interface AgentEndpointByValue {
1126
+ /**
1127
+ * Type of endpoint (phone or websocket)
1128
+ */
1129
+ type: string;
1130
+
1131
+ /**
1132
+ * Endpoint value (phone number in E.164 format or websocket URL)
1133
+ */
1134
+ value: string;
1135
+
1136
+ /**
1137
+ * Call direction for this endpoint
1138
+ */
1139
+ direction?: string;
1140
+ }
1141
+
1142
+ /**
1143
+ * Agent's prompt configuration (optional)
1144
+ */
1145
+ export interface Prompt {
1146
+ /**
1147
+ * The agent's system prompt used during this call
1148
+ */
1149
+ resolvedPrompt: string;
1150
+ }
1151
+ }
1152
+
1153
+ export interface AgentIdentificationByRoarkID {
1154
+ /**
1155
+ * Existing Roark agent ID
1156
+ */
1157
+ roarkId: string;
1158
+
1159
+ /**
1160
+ * Endpoint configuration for this agent (optional)
1161
+ */
1162
+ endpoint?:
1163
+ | AgentIdentificationByRoarkID.AgentEndpointByID
1164
+ | AgentIdentificationByRoarkID.AgentEndpointByValue;
1165
+
1166
+ /**
1167
+ * Agent's prompt configuration (optional)
1168
+ */
1169
+ prompt?: AgentIdentificationByRoarkID.Prompt;
1170
+ }
1171
+
1172
+ export namespace AgentIdentificationByRoarkID {
1173
+ export interface AgentEndpointByID {
1174
+ /**
1175
+ * Existing Roark endpoint ID
1176
+ */
1177
+ id: string;
1178
+ }
1179
+
1180
+ /**
1181
+ * Lookup or create endpoint if one with these values does not exist
1182
+ */
1183
+ export interface AgentEndpointByValue {
1184
+ /**
1185
+ * Type of endpoint (phone or websocket)
1186
+ */
1187
+ type: string;
1188
+
1189
+ /**
1190
+ * Endpoint value (phone number in E.164 format or websocket URL)
1191
+ */
1192
+ value: string;
1193
+
1194
+ /**
1195
+ * Call direction for this endpoint
1196
+ */
1197
+ direction?: string;
1198
+ }
1199
+
1200
+ /**
1201
+ * Agent's prompt configuration (optional)
1202
+ */
1203
+ export interface Prompt {
1204
+ /**
1205
+ * The agent's system prompt used during this call
1206
+ */
1207
+ resolvedPrompt: string;
1208
+ }
1209
+ }
1210
+
1211
+ /**
1212
+ * Create a new agent or find existing by customId if provided
1213
+ */
1214
+ export interface AgentIdentificationByName {
1215
+ /**
1216
+ * Agent name
1217
+ */
1218
+ name: string;
1219
+
1220
+ /**
1221
+ * Agent custom ID
1222
+ */
1223
+ customId?: string;
1224
+
1225
+ /**
1226
+ * Agent description
1227
+ */
1228
+ description?: string;
1229
+
1230
+ /**
1231
+ * Endpoint configuration for this agent (optional)
1232
+ */
1233
+ endpoint?: AgentIdentificationByName.AgentEndpointByID | AgentIdentificationByName.AgentEndpointByValue;
1234
+
1235
+ /**
1236
+ * Agent's prompt configuration (optional)
1237
+ */
1238
+ prompt?: AgentIdentificationByName.Prompt;
1239
+ }
1240
+
1241
+ export namespace AgentIdentificationByName {
1242
+ export interface AgentEndpointByID {
1243
+ /**
1244
+ * Existing Roark endpoint ID
1245
+ */
1246
+ id: string;
1247
+ }
1248
+
1249
+ /**
1250
+ * Lookup or create endpoint if one with these values does not exist
1251
+ */
1252
+ export interface AgentEndpointByValue {
1253
+ /**
1254
+ * Type of endpoint (phone or websocket)
1255
+ */
1256
+ type: string;
1257
+
1258
+ /**
1259
+ * Endpoint value (phone number in E.164 format or websocket URL)
1260
+ */
1261
+ value: string;
1262
+
1263
+ /**
1264
+ * Call direction for this endpoint
1265
+ */
1266
+ direction?: string;
1267
+ }
1268
+
1269
+ /**
1270
+ * Agent's prompt configuration (optional)
1271
+ */
1272
+ export interface Prompt {
1273
+ /**
1274
+ * The agent's system prompt used during this call
1275
+ */
1276
+ resolvedPrompt: string;
1277
+ }
1278
+ }
1279
+
1280
+ export interface AgentIdentificationByCustomID {
1281
+ /**
1282
+ * Existing custom ID for a Roark agent
1283
+ */
1284
+ customId: string;
1285
+
1286
+ /**
1287
+ * Endpoint configuration for this agent (optional)
1288
+ */
1289
+ endpoint?:
1290
+ | AgentIdentificationByCustomID.AgentEndpointByID
1291
+ | AgentIdentificationByCustomID.AgentEndpointByValue;
1292
+
1293
+ /**
1294
+ * Agent's prompt configuration (optional)
1295
+ */
1296
+ prompt?: AgentIdentificationByCustomID.Prompt;
1297
+ }
1298
+
1299
+ export namespace AgentIdentificationByCustomID {
1300
+ export interface AgentEndpointByID {
1301
+ /**
1302
+ * Existing Roark endpoint ID
1303
+ */
1304
+ id: string;
1305
+ }
1306
+
1307
+ /**
1308
+ * Lookup or create endpoint if one with these values does not exist
1309
+ */
1310
+ export interface AgentEndpointByValue {
1311
+ /**
1312
+ * Type of endpoint (phone or websocket)
1313
+ */
1314
+ type: string;
1315
+
1316
+ /**
1317
+ * Endpoint value (phone number in E.164 format or websocket URL)
1318
+ */
1319
+ value: string;
1320
+
1321
+ /**
1322
+ * Call direction for this endpoint
1323
+ */
1324
+ direction?: string;
1325
+ }
1326
+
1327
+ /**
1328
+ * Agent's prompt configuration (optional)
1329
+ */
1330
+ export interface Prompt {
1331
+ /**
1332
+ * The agent's system prompt used during this call
1333
+ */
1334
+ resolvedPrompt: string;
1335
+ }
1336
+ }
1337
+
1338
+ /**
1339
+ * Single customer participating in the call. Use this for simpler API when you
1340
+ * have only one customer.
1341
+ */
1342
+ export interface Customer {
1343
+ /**
1344
+ * Customer phone number in E.164 format (e.g., +14155551234)
1345
+ */
1346
+ phoneNumberE164: string | null;
1347
+
1348
+ /**
1349
+ * Label to identify this customer in the transcript (e.g., "speaker-01",
1350
+ * "speaker-02")
1351
+ */
1352
+ label?: string | null;
1353
+ }
1354
+
1355
+ /**
1356
+ * Customer participating in the call
1357
+ */
1358
+ export interface Customer {
1359
+ /**
1360
+ * Customer phone number in E.164 format (e.g., +14155551234)
1361
+ */
1362
+ phoneNumberE164: string | null;
1363
+
1364
+ /**
1365
+ * Label to identify this customer in the transcript (e.g., "speaker-01",
1366
+ * "speaker-02")
1367
+ */
1368
+ label?: string | null;
1369
+ }
1370
+
1371
+ export interface ToolInvocation {
1372
+ /**
1373
+ * Name of the tool that was invoked
1374
+ */
1375
+ name: string;
1376
+
1377
+ /**
1378
+ * Parameters provided to the tool during invocation
1379
+ */
1380
+ parameters: { [key: string]: ToolInvocation.UnionMember0 | unknown };
1381
+
1382
+ /**
1383
+ * Result returned by the tool after execution. Can be a string or a JSON object
1384
+ */
1385
+ result: string | { [key: string]: unknown };
1386
+
1387
+ /**
1388
+ * Offset in milliseconds from the start of the call when the tool was invoked
1389
+ */
1390
+ startOffsetMs: number;
1391
+
1392
+ /**
1393
+ * Metadata about the agent that invoked this tool - used to match which agent from
1394
+ * the agents array this tool invocation belongs to
1395
+ */
1396
+ agent?: ToolInvocation.Agent;
1397
+
1398
+ /**
1399
+ * Description of when the tool should be invoked
1400
+ */
1401
+ description?: string;
1402
+
1403
+ /**
1404
+ * Offset in milliseconds from the start of the call when the tool execution
1405
+ * completed. Used to calculate duration of the tool execution
1406
+ */
1407
+ endOffsetMs?: number;
1408
+ }
1409
+
1410
+ export namespace ToolInvocation {
1411
+ export interface UnionMember0 {
1412
+ description?: string;
1413
+
1414
+ type?: 'string' | 'number' | 'boolean';
1415
+
1416
+ value?: unknown;
1417
+ }
1418
+
1419
+ /**
1420
+ * Metadata about the agent that invoked this tool - used to match which agent from
1421
+ * the agents array this tool invocation belongs to
1422
+ */
1423
+ export interface Agent {
1424
+ /**
1425
+ * The custom ID set on the agent
1426
+ */
1427
+ customId?: string;
1428
+
1429
+ /**
1430
+ * The Roark ID of the agent
1431
+ */
1432
+ roarkId?: string;
1433
+ }
1434
+ }
1435
+
1436
+ export interface TranscriptEntryAgent {
1437
+ endOffsetMs: number;
1438
+
1439
+ role: 'AGENT';
1440
+
1441
+ startOffsetMs: number;
1442
+
1443
+ text: string;
1444
+
1445
+ /**
1446
+ * Metadata about the agent that spoke this turn - used to match which agent from
1447
+ * the `agents` array this transcript entry belongs to
1448
+ */
1449
+ agent?: TranscriptEntryAgent.Agent;
1450
+
1451
+ languageCode?: string;
1452
+ }
1453
+
1454
+ export namespace TranscriptEntryAgent {
1455
+ /**
1456
+ * Metadata about the agent that spoke this turn - used to match which agent from
1457
+ * the `agents` array this transcript entry belongs to
1458
+ */
1459
+ export interface Agent {
1460
+ /**
1461
+ * The custom ID set on the agent
1462
+ */
1463
+ customId?: string;
1464
+
1465
+ /**
1466
+ * The Roark ID of the agent
1467
+ */
1468
+ roarkId?: string;
1469
+ }
1470
+ }
1471
+
1472
+ export interface TranscriptEntryCustomer {
1473
+ endOffsetMs: number;
1474
+
1475
+ role: 'CUSTOMER';
1476
+
1477
+ startOffsetMs: number;
1478
+
1479
+ text: string;
1480
+
1481
+ /**
1482
+ * Metadata about the customer that spoke this turn - used to match which customer
1483
+ * from the `customers` array this transcript entry belongs to
1484
+ */
1485
+ customer?: TranscriptEntryCustomer.Customer;
1486
+
1487
+ languageCode?: string;
1488
+ }
1489
+
1490
+ export namespace TranscriptEntryCustomer {
1491
+ /**
1492
+ * Metadata about the customer that spoke this turn - used to match which customer
1493
+ * from the `customers` array this transcript entry belongs to
1494
+ */
1495
+ export interface Customer {
1496
+ /**
1497
+ * Label matching the `label` field on the `customers` array when creating the call
1498
+ */
1499
+ label?: string;
1500
+
1501
+ /**
1502
+ * The phone number of the customer in E.164 format, matching the `phoneNumberE164`
1503
+ * field on the `customers` array when creating the call
1504
+ */
1505
+ phoneNumberE164?: string;
1506
+ }
1507
+ }
1508
+ }
1509
+
1510
+ export interface CallListParams {
1511
+ /**
1512
+ * Cursor for pagination - call ID to start after
1513
+ */
1514
+ after?: string;
1515
+
1516
+ /**
1517
+ * Maximum number of calls to return (default: 20, max: 100)
1518
+ */
1519
+ limit?: number;
1520
+
1521
+ /**
1522
+ * Search text to filter calls by title, summary, or transcript
1523
+ */
1524
+ searchText?: string;
1525
+
1526
+ /**
1527
+ * Field to sort by (default: createdAt)
1528
+ */
1529
+ sortBy?: 'createdAt' | 'startedAt' | 'endedAt' | 'duration' | 'title' | 'status';
1530
+
1531
+ /**
1532
+ * Sort direction (default: desc)
1533
+ */
1534
+ sortDirection?: 'asc' | 'desc';
1535
+
1536
+ /**
1537
+ * Filter by call status
1538
+ */
1539
+ status?: 'RINGING' | 'IN_PROGRESS' | 'ENDED';
1540
+ }
1541
+
1542
+ export interface CallListMetricsParams {
620
1543
  /**
621
1544
  * Whether to return a flat list instead of grouped by metric definition (default:
622
1545
  * false)
@@ -626,10 +1549,14 @@ export interface CallGetMetricsParams {
626
1549
 
627
1550
  export declare namespace Call {
628
1551
  export {
1552
+ type CallCreateResponse as CallCreateResponse,
1553
+ type CallListResponse as CallListResponse,
629
1554
  type CallGetByIDResponse as CallGetByIDResponse,
630
- type CallGetEvaluationRunsResponse as CallGetEvaluationRunsResponse,
631
- type CallGetMetricsResponse as CallGetMetricsResponse,
632
- type CallGetSentimentRunsResponse as CallGetSentimentRunsResponse,
633
- type CallGetMetricsParams as CallGetMetricsParams,
1555
+ type CallListEvaluationRunsResponse as CallListEvaluationRunsResponse,
1556
+ type CallListMetricsResponse as CallListMetricsResponse,
1557
+ type CallListSentimentRunsResponse as CallListSentimentRunsResponse,
1558
+ type CallCreateParams as CallCreateParams,
1559
+ type CallListParams as CallListParams,
1560
+ type CallListMetricsParams as CallListMetricsParams,
634
1561
  };
635
1562
  }