@arbol-ai/sdk 5.24.0 → 5.26.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.
@@ -31,7 +31,8 @@ export interface RaizChange {
31
31
  * What changed: `contact`, `contact_point`, `contact_identifier`, `agent`,
32
32
  * `agent_tool` (its id is the Agent's), `channel`, `definition`,
33
33
  * `knowledge_document`, `campaign`, `suppression`, `bulletin`,
34
- * `provider_account`, `fact`, `task` (a person cancelled or retried it).
34
+ * `conversation_view`, `provider_account`, `fact`, `task` (a person cancelled
35
+ * or retried it).
35
36
  */
36
37
  resourceType: string;
37
38
  sourceId: string | null;
@@ -1,6 +1,6 @@
1
1
  import { type BaseClientOptions, type RequestOptions, Transport } from "../../_/index.js";
2
- import { type RaizCount, type RaizResponseMetadata, type RaizTask } from "../models.js";
3
- import { type RaizContact, type RaizContactIdentifierInput, type RaizContactPage, type RaizContactPointInput, type RaizPostalAddress } from "./models.js";
2
+ import { type RaizResponseMetadata, type RaizTask } from "../models.js";
3
+ import { type RaizContact, type RaizContactIdentifierInput, type RaizContactPage, type RaizContactPointInput, type RaizCount, type RaizPostalAddress } from "./models.js";
4
4
  export interface ClientOptions extends BaseClientOptions {
5
5
  /**
6
6
  * The URL the paths of the API are relative to.
@@ -2,4 +2,4 @@ export { ApiError } from "../../_/index.js";
2
2
  export type { RequestOptions } from "../../_/index.js";
3
3
  export { createClient } from "./client.js";
4
4
  export type { Client, ClientOptions, CountRequest, CountResponse, CreateRequest, CreateResponse, GetRequest, GetResponse, ImportRequest, ImportResponse, ListRequest, ListResponse, UpdateRequest, UpdateResponse, } from "./client.js";
5
- export type { RaizContact, RaizContactIdentifierInput, RaizContactLastConversation, RaizContactPage, RaizContactPointInput, RaizContactTimelinePage, RaizPostalAddress, } from "./models.js";
5
+ export type { RaizContact, RaizContactIdentifierInput, RaizContactLastConversation, RaizContactPage, RaizContactPointInput, RaizContactTimelinePage, RaizCount, RaizPostalAddress, } from "./models.js";
@@ -153,6 +153,16 @@ export interface RaizContactTimelinePage {
153
153
  */
154
154
  pageInfo: PageInfo;
155
155
  }
156
+ export interface RaizCount {
157
+ /**
158
+ * True when the count reached 10000: at least that many match.
159
+ */
160
+ capped: boolean;
161
+ /**
162
+ * How many match the filters, counted up to 10000.
163
+ */
164
+ count: number;
165
+ }
156
166
  export interface RaizPostalAddress {
157
167
  city?: string;
158
168
  /**
@@ -1,7 +1,7 @@
1
1
  import { type BaseClientOptions, type RequestOptions, Transport } from "../../_/index.js";
2
2
  import type { DeletedObject } from "../../models.js";
3
- import type { RaizCount, RaizResponseMetadata } from "../models.js";
4
- import { type RaizConversation, type RaizConversationPage } from "./models.js";
3
+ import type { RaizResponseMetadata } from "../models.js";
4
+ import { type RaizConversation, type RaizConversationCount, type RaizConversationPage } from "./models.js";
5
5
  export interface ClientOptions extends BaseClientOptions {
6
6
  /**
7
7
  * The URL the paths of the API are relative to.
@@ -27,9 +27,14 @@ export interface Client {
27
27
  *
28
28
  * Count the conversations `list_conversations` returns for the same filters
29
29
  * (every filter it takes, without `sort`), up to 10,000: `capped` then says
30
- * at least that many match. Use it to answer how many conversations match
31
- * instead of paging through the list; for volumes per day, Agent or outcome
32
- * use `get_report`.
30
+ * at least that many match. `averageMessageCount` and
31
+ * `averageDurationSeconds` are their average length. `groupBy` also divides
32
+ * them, largest group first, each with its outcomes: by `outcome`, `status`,
33
+ * `channel`, `agent`, `sentiment`, `tool` (which Agent tools they used, and
34
+ * in how many a tool failed), `toolError` (why calls of `toolName` failed) or
35
+ * `fact:<definition key>` (such as the reason for contact). Use it to answer
36
+ * how many conversations match, or how they divide, instead of paging through
37
+ * the list; for volumes per day use `get_report`.
33
38
  */
34
39
  count(request?: CountRequest, options?: RequestOptions): Promise<CountResponse>;
35
40
  /**
@@ -60,19 +65,24 @@ export interface Client {
60
65
  *
61
66
  * Find calls, WhatsApp chats and web chats. Filter by `contactId` (as
62
67
  * counterpart or subject), `agentId`, `channelId`, `channelType`, `status`,
63
- * `conversationDirection`, `origin`, `outcome`, `handling` (`ai` or `team`:
64
- * whether the AI takes part; `escalated`: handed to the team by the AI),
65
- * `worker` (`ai` or `team`: who answers it now), `campaignId`, `profileId`,
66
- * `requestedBy` and start time (`startedAfter`, `startedBefore`); `q`
67
- * searches participant identities (names, profile names, usernames, phones,
68
- * emails and documents), visible messages, titles, summaries and exact
69
- * conversation references; `count_conversations` counts every match. Each
70
- * item already carries its title, summary, outcome, sentiment and workers,
71
- * often enough to answer. `sort`: `started` (newest first), `last_message`
72
- * (latest activity first) or `changed`, the feed of status, outcome and
73
- * analysis changes, oldest first, that systems poll from a saved
74
- * `pageInfo.nextCursor` (a deleted conversation appears once with
75
- * `deletedAt`). Next: `get_conversation` for a transcript.
68
+ * `conversationDirection`, `origin`, `outcome`, `sentiment`, `handling` (`ai`
69
+ * or `team`: whether the AI takes part; `escalated`: handed to the team by
70
+ * the AI), `worker` (`ai` or `team`: who answers it now), the Agent's tools
71
+ * (`toolName`, `toolStatus`: which tool it called and how the call ended), a
72
+ * captured fact (`factDefinition`, `factValue`), `assessment` (`failed` or
73
+ * `passed`), `toReview` (what needs a person's look: not resolved, or handed
74
+ * to the team), length (`messagesMin`, `messagesMax`, `durationMin`,
75
+ * `durationMax`), `campaignId`, `profileId`, `requestedBy` and start time
76
+ * (`startedAfter`, `startedBefore`); `q` searches participant identities
77
+ * (names, profile names, usernames, phones, emails and documents), visible
78
+ * messages, titles, summaries and exact conversation references;
79
+ * `count_conversations` counts every match. Each item already carries its
80
+ * title, summary, outcome, sentiment, workers and tool calls (how many, how
81
+ * many failed, the latest failure), often enough to answer. `sort`: `started`
82
+ * (newest first), `last_message` (latest activity first) or `changed`, the
83
+ * feed of status, outcome and analysis changes, oldest first, that systems
84
+ * poll from a saved `pageInfo.nextCursor` (a deleted conversation appears
85
+ * once with `deletedAt`). Next: `get_conversation` for a transcript.
76
86
  */
77
87
  list(request?: ListRequest, options?: RequestOptions): Promise<ListResponse>;
78
88
  /**
@@ -201,9 +211,75 @@ export interface CountRequest {
201
211
  */
202
212
  startedBefore?: Temporal.Instant;
203
213
  status?: "open" | "closed";
214
+ /**
215
+ * Started today or in the last 7, 30, 90 or 365 days including today,
216
+ * counting days in the organization's time zone as `get_report` does. A saved
217
+ * view keeps its period this way, so it moves with the calendar.
218
+ */
219
+ period?: "today" | "7d" | "30d" | "90d" | "365d";
220
+ /**
221
+ * Comma-separated sentiments of the analysis.
222
+ */
223
+ sentiment?: string;
224
+ /**
225
+ * Conversations where the Agent called this tool: its exact name, as the
226
+ * transcript's tool parts show it (`toolName`). `count_conversations` with
227
+ * `groupBy=tool` lists the names with how many conversations used each.
228
+ */
229
+ toolName?: string;
230
+ /**
231
+ * With `toolName`, a call of that tool ended this way; alone, a call of any
232
+ * tool did (`failed`: conversations where a tool failed).
233
+ */
234
+ toolStatus?: "completed" | "failed" | "denied";
235
+ /**
236
+ * Conversations whose current fact of this definition (its `key`) is known:
237
+ * about the conversation, or about its contact for a contact definition. With
238
+ * `factValue`, equal to that value.
239
+ */
240
+ factDefinition?: string;
241
+ /**
242
+ * With `factDefinition`: an option's key or label, a text (ignoring case), a
243
+ * number, a date (YYYY-MM-DD) or `true`/`false`.
244
+ */
245
+ factValue?: string;
246
+ /**
247
+ * The conversation's yes/no assessments: `failed`, at least one answered no;
248
+ * `passed`, at least one answered and every answered one yes.
249
+ */
250
+ assessment?: "failed" | "passed";
251
+ /**
252
+ * `true`: conversations to review, as `get_report` counts them in
253
+ * `toReviewCount`: the analysis says the request was not resolved, or the AI
254
+ * handed the conversation to the team. `false`: the others.
255
+ */
256
+ toReview?: boolean;
257
+ /**
258
+ * At least this many messages.
259
+ */
260
+ messagesMin?: number;
261
+ /**
262
+ * At most this many messages.
263
+ */
264
+ messagesMax?: number;
265
+ /**
266
+ * Calls of at least this many seconds.
267
+ */
268
+ durationMin?: number;
269
+ /**
270
+ * Calls of at most this many seconds.
271
+ */
272
+ durationMax?: number;
273
+ /**
274
+ * `outcome`, `status`, `channel` (type), `agent`, `sentiment`, `tool` (each
275
+ * Agent tool and the conversations that used it), `toolError` (failed calls,
276
+ * of `toolName` when given, by error) or `fact:<definition key>` (the current
277
+ * value of that definition, such as the reason for contact).
278
+ */
279
+ groupBy?: string;
204
280
  }
205
281
  export interface CountResponse {
206
- data: RaizCount;
282
+ data: RaizConversationCount;
207
283
  error: null;
208
284
  metadata: RaizResponseMetadata;
209
285
  success: true;
@@ -356,6 +432,65 @@ export interface ListRequest {
356
432
  */
357
433
  startedBefore?: Temporal.Instant;
358
434
  status?: "open" | "closed";
435
+ /**
436
+ * Started today or in the last 7, 30, 90 or 365 days including today,
437
+ * counting days in the organization's time zone as `get_report` does. A saved
438
+ * view keeps its period this way, so it moves with the calendar.
439
+ */
440
+ period?: "today" | "7d" | "30d" | "90d" | "365d";
441
+ /**
442
+ * Comma-separated sentiments of the analysis.
443
+ */
444
+ sentiment?: string;
445
+ /**
446
+ * Conversations where the Agent called this tool: its exact name, as the
447
+ * transcript's tool parts show it (`toolName`). `count_conversations` with
448
+ * `groupBy=tool` lists the names with how many conversations used each.
449
+ */
450
+ toolName?: string;
451
+ /**
452
+ * With `toolName`, a call of that tool ended this way; alone, a call of any
453
+ * tool did (`failed`: conversations where a tool failed).
454
+ */
455
+ toolStatus?: "completed" | "failed" | "denied";
456
+ /**
457
+ * Conversations whose current fact of this definition (its `key`) is known:
458
+ * about the conversation, or about its contact for a contact definition. With
459
+ * `factValue`, equal to that value.
460
+ */
461
+ factDefinition?: string;
462
+ /**
463
+ * With `factDefinition`: an option's key or label, a text (ignoring case), a
464
+ * number, a date (YYYY-MM-DD) or `true`/`false`.
465
+ */
466
+ factValue?: string;
467
+ /**
468
+ * The conversation's yes/no assessments: `failed`, at least one answered no;
469
+ * `passed`, at least one answered and every answered one yes.
470
+ */
471
+ assessment?: "failed" | "passed";
472
+ /**
473
+ * `true`: conversations to review, as `get_report` counts them in
474
+ * `toReviewCount`: the analysis says the request was not resolved, or the AI
475
+ * handed the conversation to the team. `false`: the others.
476
+ */
477
+ toReview?: boolean;
478
+ /**
479
+ * At least this many messages.
480
+ */
481
+ messagesMin?: number;
482
+ /**
483
+ * At most this many messages.
484
+ */
485
+ messagesMax?: number;
486
+ /**
487
+ * Calls of at least this many seconds.
488
+ */
489
+ durationMin?: number;
490
+ /**
491
+ * Calls of at most this many seconds.
492
+ */
493
+ durationMax?: number;
359
494
  /**
360
495
  * `started` (newest first), `last_message` (most recent activity first) or
361
496
  * `changed`: the changed feed, oldest change first, with deleted
@@ -25,7 +25,7 @@ const ContinueOperation = {
25
25
  const CountOperation = {
26
26
  method: "GET",
27
27
  route: "/v1/raiz/conversations/count",
28
- query: { agentId: "agentId", campaignId: "campaignId", channelId: "channelId", channelType: "channelType", contactId: "contactId", conversationDirection: "conversationDirection", handling: "handling", worker: "worker", origin: "origin", outcome: "outcome", metadataReference: "metadataReference", profileId: "profileId", q: "q", requestedBy: "requestedBy", startedAfter: "startedAfter", startedBefore: "startedBefore", status: "status" },
28
+ query: { agentId: "agentId", campaignId: "campaignId", channelId: "channelId", channelType: "channelType", contactId: "contactId", conversationDirection: "conversationDirection", handling: "handling", worker: "worker", origin: "origin", outcome: "outcome", metadataReference: "metadataReference", profileId: "profileId", q: "q", requestedBy: "requestedBy", startedAfter: "startedAfter", startedBefore: "startedBefore", status: "status", period: "period", sentiment: "sentiment", toolName: "toolName", toolStatus: "toolStatus", factDefinition: "factDefinition", factValue: "factValue", assessment: "assessment", toReview: "toReview", messagesMin: "messagesMin", messagesMax: "messagesMax", durationMin: "durationMin", durationMax: "durationMax", groupBy: "groupBy" },
29
29
  response: null,
30
30
  errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
31
31
  };
@@ -46,7 +46,7 @@ const GetOperation = {
46
46
  const ListOperation = {
47
47
  method: "GET",
48
48
  route: "/v1/raiz/conversations",
49
- query: { cursor: "cursor", direction: "direction", limit: "limit", agentId: "agentId", campaignId: "campaignId", channelId: "channelId", channelType: "channelType", contactId: "contactId", conversationDirection: "conversationDirection", handling: "handling", worker: "worker", origin: "origin", outcome: "outcome", metadataReference: "metadataReference", profileId: "profileId", q: "q", requestedBy: "requestedBy", startedAfter: "startedAfter", startedBefore: "startedBefore", status: "status", sort: "sort" },
49
+ query: { cursor: "cursor", direction: "direction", limit: "limit", agentId: "agentId", campaignId: "campaignId", channelId: "channelId", channelType: "channelType", contactId: "contactId", conversationDirection: "conversationDirection", handling: "handling", worker: "worker", origin: "origin", outcome: "outcome", metadataReference: "metadataReference", profileId: "profileId", q: "q", requestedBy: "requestedBy", startedAfter: "startedAfter", startedBefore: "startedBefore", status: "status", period: "period", sentiment: "sentiment", toolName: "toolName", toolStatus: "toolStatus", factDefinition: "factDefinition", factValue: "factValue", assessment: "assessment", toReview: "toReview", messagesMin: "messagesMin", messagesMax: "messagesMax", durationMin: "durationMin", durationMax: "durationMax", sort: "sort" },
50
50
  response: object([["data", null, () => RaizConversationPageCodec]]),
51
51
  errors: { "400": true, "401": true, "403": true, "404": true, "405": true, "413": true, "415": true, "429": true, "500": true, "502": true, "503": true, "504": true },
52
52
  };
@@ -2,4 +2,4 @@ export { ApiError } from "../../_/index.js";
2
2
  export type { RequestOptions } from "../../_/index.js";
3
3
  export { createClient } from "./client.js";
4
4
  export type { Client, ClientOptions, ContinueRequest, ContinueResponse, CountRequest, CountResponse, DeleteRequest, DeleteResponse, GetRequest, GetResponse, ListRequest, ListResponse, UpdateRequest, UpdateResponse, } from "./client.js";
5
- export type { RaizConversation, RaizConversationDiagnostics, RaizConversationPage, RaizConversationWorker, RaizMessage, RaizMessagePage, RaizSignedUrl, } from "./models.js";
5
+ export type { RaizConversation, RaizConversationCount, RaizConversationDiagnostics, RaizConversationGroup, RaizConversationOutcomeCounts, RaizConversationPage, RaizConversationToolCalls, RaizConversationToolFailure, RaizConversationWorker, RaizMessage, RaizMessagePage, RaizSignedUrl, } from "./models.js";
@@ -100,6 +100,7 @@ export interface RaizConversation {
100
100
  summaryAuthor: "person" | "ai" | "system" | "import" | "provider" | null;
101
101
  title: string | null;
102
102
  titleAuthor: "person" | "ai" | "system" | "import" | "provider" | null;
103
+ toolCalls: RaizConversationToolCalls;
103
104
  /**
104
105
  * An instant in RFC 3339 format, in UTC.
105
106
  */
@@ -114,6 +115,19 @@ export interface RaizConversation {
114
115
  */
115
116
  workers: RaizConversationWorker[];
116
117
  }
118
+ export interface RaizConversationCount {
119
+ averageDurationSeconds: number | null;
120
+ averageMessageCount: number | null;
121
+ /**
122
+ * True when the count reached 10000: at least that many match.
123
+ */
124
+ capped: boolean;
125
+ /**
126
+ * How many match the filters, counted up to 10000.
127
+ */
128
+ count: number;
129
+ groups: RaizConversationGroup[] | null;
130
+ }
117
131
  export interface RaizConversationDiagnostics {
118
132
  errorCode: string | null;
119
133
  providerErrorCode: number | null;
@@ -129,6 +143,27 @@ export interface RaizConversationDiagnostics {
129
143
  status: "available" | "unavailable" | "not_recorded" | "not_applicable";
130
144
  terminationReasonPresent: boolean;
131
145
  }
146
+ export interface RaizConversationGroup {
147
+ averageDurationSeconds: number | null;
148
+ averageMessageCount: number | null;
149
+ /**
150
+ * Conversations in the group.
151
+ */
152
+ count: number;
153
+ failed: number | null;
154
+ key: string | null;
155
+ label: string | null;
156
+ outcomes: RaizConversationOutcomeCounts;
157
+ }
158
+ export interface RaizConversationOutcomeCounts {
159
+ failure: number;
160
+ /**
161
+ * Not analyzed yet.
162
+ */
163
+ pending: number;
164
+ success: number;
165
+ unknown: number;
166
+ }
132
167
  export interface RaizConversationPage {
133
168
  /**
134
169
  * Items admitted by this resource contract within the verified organization.
@@ -143,6 +178,22 @@ export interface RaizConversationPage {
143
178
  */
144
179
  pageInfo: PageInfo;
145
180
  }
181
+ export interface RaizConversationToolCalls {
182
+ /**
183
+ * The Agent's tool calls in the conversation.
184
+ */
185
+ count: number;
186
+ /**
187
+ * How many of them failed.
188
+ */
189
+ failed: number;
190
+ lastFailure: RaizConversationToolFailure | null;
191
+ }
192
+ export interface RaizConversationToolFailure {
193
+ errorCode: string | null;
194
+ errorMessage: string | null;
195
+ toolName: string;
196
+ }
146
197
  export type RaizConversationWorker = {
147
198
  agentId: string;
148
199
  answering: boolean;
@@ -2,4 +2,4 @@ export { ApiError } from "../_/index.js";
2
2
  export type { RequestOptions } from "../_/index.js";
3
3
  export { createClient } from "./client.js";
4
4
  export type { Client, ClientOptions, } from "./client.js";
5
- export type { RaizAgentIntegrationProcedureInput, RaizAgentProcedureInput, RaizBusinessHours, RaizBusinessHoursWindow, RaizContactHoursWindow, RaizCount, RaizEmailAddress, RaizFact, RaizFailureResponse, RaizHttpsUrl, RaizOutsideHoursTemplate, RaizPhoneNumber, RaizResponseMetadata, RaizTask, } from "./models.js";
5
+ export type { RaizAgentIntegrationProcedureInput, RaizAgentProcedureInput, RaizBusinessHours, RaizBusinessHoursWindow, RaizContactHoursWindow, RaizEmailAddress, RaizFact, RaizFailureResponse, RaizHttpsUrl, RaizOutsideHoursTemplate, RaizPhoneNumber, RaizResponseMetadata, RaizTask, } from "./models.js";
@@ -245,16 +245,6 @@ export interface RaizContactHoursWindow {
245
245
  */
246
246
  to: string;
247
247
  }
248
- export interface RaizCount {
249
- /**
250
- * True when the count reached 10000: at least that many match.
251
- */
252
- capped: boolean;
253
- /**
254
- * How many match the filters, counted up to 10000.
255
- */
256
- count: number;
257
- }
258
248
  export type RaizEmailAddress = string;
259
249
  export interface RaizFact {
260
250
  /**
@@ -271,6 +261,7 @@ export interface RaizFact {
271
261
  definition: {
272
262
  id: string;
273
263
  key: string;
264
+ kind: "attribute" | "assessment" | "category" | "metric";
274
265
  name: string;
275
266
  valueType: "text" | "number" | "boolean" | "date" | "option";
276
267
  };
@@ -622,6 +613,27 @@ export interface RaizFailureResponse {
622
613
  };
623
614
  message: "This operation or field does not apply to this channel's type.";
624
615
  retryable: false;
616
+ } | {
617
+ code: "CONVERSATION_VIEW_AUTHOR_ONLY";
618
+ data: {
619
+ [key: string]: unknown;
620
+ };
621
+ message: "Only the person who saved this view can make it private; it would disappear for the rest of the team.";
622
+ retryable: false;
623
+ } | {
624
+ code: "CONVERSATION_VIEW_LIMIT_REACHED";
625
+ data: {
626
+ [key: string]: unknown;
627
+ };
628
+ message: "The organization already has 200 saved views. Delete one before saving another.";
629
+ retryable: false;
630
+ } | {
631
+ code: "CONVERSATION_VIEW_NAME_TAKEN";
632
+ data: {
633
+ [key: string]: unknown;
634
+ };
635
+ message: "Another saved view already has this name. Choose a different name.";
636
+ retryable: false;
625
637
  } | {
626
638
  code: "TEMPLATE_HEADER_MISMATCH";
627
639
  data: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arbol-ai/sdk",
3
- "version": "5.24.0",
3
+ "version": "5.26.0",
4
4
  "description": "The Arbol API for TypeScript and JavaScript, generated by Cloudflare Forge from the platform's public OpenAPI.",
5
5
  "keywords": [
6
6
  "arbol",
@@ -57,8 +57,8 @@
57
57
  "packageManager": "bun@1.4.3",
58
58
  "arbol": {
59
59
  "openapi": {
60
- "release": "1.20261101.50133",
61
- "sha256": "b5391b5c8b2e6b4cb27f0005a1fdb1b50531d5f455fb868b039f51e7587e03da"
60
+ "release": "1.20261101.92027",
61
+ "sha256": "e9be828ee9b2d19b0f340ec445d812a85a2a24ab2ccb9577e74bdfc058336af2"
62
62
  }
63
63
  }
64
64
  }