@proteos/sdk 0.61.0 → 0.76.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.
- package/dist/{chunk-OOOTPEJK.js → chunk-C5642XOH.js} +79 -11
- package/dist/chunk-C5642XOH.js.map +1 -0
- package/dist/{chunk-25PD6TYH.cjs → chunk-Z773P4RO.cjs} +85 -10
- package/dist/chunk-Z773P4RO.cjs.map +1 -0
- package/dist/index.cjs +387 -130
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +815 -81
- package/dist/index.d.ts +815 -81
- package/dist/index.js +250 -13
- package/dist/index.js.map +1 -1
- package/dist/meta/index.cjs +117 -89
- package/dist/meta/index.d.cts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/meta/index.js +1 -1
- package/dist/{types-DQmqR_G8.d.cts → types-Bn5y5wHZ.d.cts} +744 -48
- package/dist/{types-DQmqR_G8.d.ts → types-Bn5y5wHZ.d.ts} +744 -48
- package/package.json +1 -1
- package/src/agent/session-types.ts +8 -1
- package/src/agent/sessions.ts +6 -4
- package/src/agent/types.ts +9 -0
- package/src/auth/platform-entities.ts +6 -0
- package/src/client.ts +28 -4
- package/src/conversation/index.ts +327 -15
- package/src/conversation/types.ts +596 -5
- package/src/data/entity-indexes.ts +54 -0
- package/src/data/index.ts +12 -0
- package/src/data/types.ts +66 -0
- package/src/errors.ts +5 -0
- package/src/index.ts +60 -0
- package/src/meta/components.ts +23 -3
- package/src/meta/index.ts +11 -0
- package/src/meta/layout/common-props.ts +9 -0
- package/src/meta/layout/elements.ts +57 -0
- package/src/meta/layout/index.ts +5 -0
- package/src/meta/layout/page-layout.ts +15 -3
- package/src/meta/types.ts +253 -21
- package/src/scheduling/types.ts +5 -1
- package/src/workflow/types.ts +10 -2
- package/dist/chunk-25PD6TYH.cjs.map +0 -1
- package/dist/chunk-OOOTPEJK.js.map +0 -1
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* mirror of packages/go/model/conversation (snake_case, Is-prefixed booleans).
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import type { PrincipalRef } from '../meta/types.js'
|
|
6
|
+
import type { PageAction, PrincipalRef } from '../meta/types.js'
|
|
7
7
|
import type { FileRef } from '../types/common.js'
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -74,6 +74,16 @@ export interface MintCallTokenRequest {
|
|
|
74
74
|
connection_id: string
|
|
75
75
|
}
|
|
76
76
|
|
|
77
|
+
/**
|
|
78
|
+
* PUT /conversations/:id/recording — the in-call recording control on a live
|
|
79
|
+
* phone conversation: true starts (or resumes) the recording, false pauses
|
|
80
|
+
* it. A recording that did not run from answer to hangup is marked
|
|
81
|
+
* `has_partial_recording` on the conversation's metadata.
|
|
82
|
+
*/
|
|
83
|
+
export interface SetCallRecordingRequest {
|
|
84
|
+
is_recording_enabled: boolean
|
|
85
|
+
}
|
|
86
|
+
|
|
77
87
|
/**
|
|
78
88
|
* Which system answers a provider phone number: connected to this platform,
|
|
79
89
|
* in use by another integration (connecting takes it over, disconnecting
|
|
@@ -114,6 +124,69 @@ export interface UpdatePhoneNumberRequest {
|
|
|
114
124
|
routing?: PhoneNumberRouting
|
|
115
125
|
}
|
|
116
126
|
|
|
127
|
+
/**
|
|
128
|
+
* twilio-phone `connection.settings.voicemail` — what a caller hears when no
|
|
129
|
+
* agent takes the ring. The greeting is spoken by the provider's text-to-speech
|
|
130
|
+
* in `language`; absent or blank fields fall back to platform defaults.
|
|
131
|
+
*/
|
|
132
|
+
export interface TwilioPhoneVoicemailSettings {
|
|
133
|
+
is_enabled: boolean
|
|
134
|
+
/** Empty = the platform's default English text. At most 1000 characters. */
|
|
135
|
+
greeting?: string
|
|
136
|
+
/** BCP-47, one of the supported TTS languages; default en-US. */
|
|
137
|
+
language?: string
|
|
138
|
+
/** 10..300, default 120. */
|
|
139
|
+
max_duration_seconds?: number
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* The typed slice of a twilio-phone `connection.settings` the softphone reads
|
|
144
|
+
* (`Connection.settings` stays an open map on the wire).
|
|
145
|
+
*/
|
|
146
|
+
export interface TwilioPhoneSettings {
|
|
147
|
+
is_softphone_enabled?: boolean
|
|
148
|
+
is_recording_enabled?: boolean
|
|
149
|
+
is_realtime_transcription_enabled?: boolean
|
|
150
|
+
/** How long the parallel ring waits before the call counts as missed; 5..60, default 25. */
|
|
151
|
+
ring_timeout_seconds?: number
|
|
152
|
+
voicemail?: TwilioPhoneVoicemailSettings
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/** Why an inbound ring ended without one of our people on the line. */
|
|
156
|
+
export type CallDialStatus =
|
|
157
|
+
| 'no_answer'
|
|
158
|
+
| 'busy'
|
|
159
|
+
| 'failed'
|
|
160
|
+
| 'canceled'
|
|
161
|
+
/** Nobody was routed to the number. */
|
|
162
|
+
| 'unrouted'
|
|
163
|
+
/** The caller left while it rang. */
|
|
164
|
+
| 'caller_hung_up'
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* The call facts a phone conversation carries in `metadata` (mirrors the
|
|
168
|
+
* backend's logic/call-status.go + call-voicemail.go). Every key is optional
|
|
169
|
+
* on the wire; read defensively.
|
|
170
|
+
*/
|
|
171
|
+
export interface CallMetadata {
|
|
172
|
+
call_direction?: 'inbound' | 'outbound'
|
|
173
|
+
call_status?: CallStatus
|
|
174
|
+
from_number?: string
|
|
175
|
+
to_number?: string
|
|
176
|
+
/** Provider talk time; on a missed call it includes greeting + voicemail. */
|
|
177
|
+
duration_seconds?: number
|
|
178
|
+
recording_external_id?: string
|
|
179
|
+
recording_file_id?: string
|
|
180
|
+
is_recording_enabled?: boolean
|
|
181
|
+
has_partial_recording?: boolean
|
|
182
|
+
/** No agent took the inbound call. */
|
|
183
|
+
is_missed?: boolean
|
|
184
|
+
dial_status?: CallDialStatus
|
|
185
|
+
/** `offered` once the greeting played, `recorded` once the message landed. */
|
|
186
|
+
voicemail_status?: 'offered' | 'recorded'
|
|
187
|
+
voicemail_duration_seconds?: number
|
|
188
|
+
}
|
|
189
|
+
|
|
117
190
|
/** The minted grant the Voice JS SDK consumes (`new Device(token, { edge })`). */
|
|
118
191
|
export interface CallTokenResponse {
|
|
119
192
|
token: string
|
|
@@ -339,6 +412,14 @@ export interface Conversation {
|
|
|
339
412
|
* classified or no type matched.
|
|
340
413
|
*/
|
|
341
414
|
type_key?: string
|
|
415
|
+
/** How the conversation ended — one of its type's outcome keys; absent = none yet. */
|
|
416
|
+
outcome_key?: string
|
|
417
|
+
/** Who set the outcome: `user` (never overridden by the model) or `model`. */
|
|
418
|
+
outcome_source?: ConversationOutcomeSource
|
|
419
|
+
outcome_set_by?: UserRef
|
|
420
|
+
outcome_set_at?: string
|
|
421
|
+
/** The conversation currently holds objective rows (maintained by the objective sync). */
|
|
422
|
+
has_objectives: boolean
|
|
342
423
|
status: ConversationStatus
|
|
343
424
|
/**
|
|
344
425
|
* Room directory row a room-borne thread (Slack channel conversation) lives
|
|
@@ -351,6 +432,13 @@ export interface Conversation {
|
|
|
351
432
|
* absent for main/DM/email/meeting/adhoc.
|
|
352
433
|
*/
|
|
353
434
|
parent_conversation_id?: string
|
|
435
|
+
/**
|
|
436
|
+
* iCalendar UID of the calendar meeting this conversation was born from
|
|
437
|
+
* (stamped when the meeting bot starts); absent for everything else. With
|
|
438
|
+
* `started_at` it names the meeting INSTANCE on every invitee's calendar —
|
|
439
|
+
* Google's UID names a series, Microsoft's one occurrence.
|
|
440
|
+
*/
|
|
441
|
+
calendar_event_ical_uid?: string
|
|
354
442
|
/**
|
|
355
443
|
* Message id of the child conversation's root message, which lives in the
|
|
356
444
|
* parent conversation; absent when the root is unknown (predates ingest).
|
|
@@ -825,6 +913,33 @@ export interface ConversationTypeConfig {
|
|
|
825
913
|
* `Conversation.type_key` and `config.summary_prompt_key` may swap the summary
|
|
826
914
|
* system prompt. Module-deployable (conversation-types/<key>.json).
|
|
827
915
|
*/
|
|
916
|
+
/**
|
|
917
|
+
* One way a conversation of a type can end — "booked", "not_interested",
|
|
918
|
+
* "callback". The type's list is the vocabulary a person picks from (the
|
|
919
|
+
* softphone after a call, the conversation header) and the choice a
|
|
920
|
+
* `role: 'outcome'` tag definition detects among. `description` is what the
|
|
921
|
+
* model reads to tell outcomes apart (the name when empty).
|
|
922
|
+
*/
|
|
923
|
+
export interface ConversationOutcome {
|
|
924
|
+
/** Platform key — the value stored on `Conversation.outcome_key`. */
|
|
925
|
+
key: string
|
|
926
|
+
name: string
|
|
927
|
+
description?: string
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
/**
|
|
931
|
+
* One stage a conversation of a type moves through — "intro", "discovery",
|
|
932
|
+
* "close". The type's list is ordered; progress through it is DERIVED from
|
|
933
|
+
* the objectives pinned to each phase (every measured objective of a phase
|
|
934
|
+
* achieved ⇒ the phase is done), never detected on its own. `description`
|
|
935
|
+
* is for humans (the checklist, the summary prompt).
|
|
936
|
+
*/
|
|
937
|
+
export interface ConversationPhase {
|
|
938
|
+
key: string
|
|
939
|
+
name: string
|
|
940
|
+
description?: string
|
|
941
|
+
}
|
|
942
|
+
|
|
828
943
|
export interface ConversationType {
|
|
829
944
|
org_id: string
|
|
830
945
|
/** Immutable identity within the org — what the classifier answers with. */
|
|
@@ -833,6 +948,21 @@ export interface ConversationType {
|
|
|
833
948
|
/** When a conversation IS this type — injected verbatim into the classifier prompt. */
|
|
834
949
|
definition: string
|
|
835
950
|
config: ConversationTypeConfig
|
|
951
|
+
/** Ordered; empty = the type tracks no outcome. */
|
|
952
|
+
outcomes: ConversationOutcome[]
|
|
953
|
+
/** Ordered; empty = the type tracks no phases. */
|
|
954
|
+
phases: ConversationPhase[]
|
|
955
|
+
/**
|
|
956
|
+
* The type's action buttons — one strip in the footer of the call or
|
|
957
|
+
* meeting surface, the same place during the conversation and in its
|
|
958
|
+
* wrap-up. Same contract as `Page.actions`; each button's `visible_when`
|
|
959
|
+
* reads the conversation scope (`conversation.status` for the stage,
|
|
960
|
+
* `conversation.outcome_key`, `records_by_entity.<slug>`,
|
|
961
|
+
* `tags_by_definition.<key>`, …); no rule = offered throughout. The rule
|
|
962
|
+
* decides when a button appears; once pressed it stays for the rest of
|
|
963
|
+
* the conversation. Ordered; empty = none.
|
|
964
|
+
*/
|
|
965
|
+
actions: PageAction[]
|
|
836
966
|
/** Module that deployed the type; absent when not module-owned. */
|
|
837
967
|
module_slug?: string
|
|
838
968
|
created_at: string
|
|
@@ -847,6 +977,12 @@ export interface CreateConversationTypeRequest {
|
|
|
847
977
|
name?: string
|
|
848
978
|
definition: string
|
|
849
979
|
config?: ConversationTypeConfig
|
|
980
|
+
/** Replaces the list wholesale; omit = none. */
|
|
981
|
+
outcomes?: ConversationOutcome[]
|
|
982
|
+
/** Replaces the list wholesale; omit = none. */
|
|
983
|
+
phases?: ConversationPhase[]
|
|
984
|
+
/** Replaces the list wholesale; omit = none. */
|
|
985
|
+
actions?: PageAction[]
|
|
850
986
|
module_slug?: string
|
|
851
987
|
}
|
|
852
988
|
|
|
@@ -855,6 +991,12 @@ export interface UpdateConversationTypeRequest {
|
|
|
855
991
|
definition?: string
|
|
856
992
|
/** Replaces the stored config wholesale; send `{}` to clear the prompt link. */
|
|
857
993
|
config?: ConversationTypeConfig
|
|
994
|
+
/** Replaces the list wholesale; `[]` clears it. */
|
|
995
|
+
outcomes?: ConversationOutcome[]
|
|
996
|
+
/** Replaces the list wholesale; `[]` clears it. */
|
|
997
|
+
phases?: ConversationPhase[]
|
|
998
|
+
/** Replaces the list wholesale; `[]` clears it. */
|
|
999
|
+
actions?: PageAction[]
|
|
858
1000
|
}
|
|
859
1001
|
|
|
860
1002
|
export interface ListConversationTypesQuery extends PaginationQuery {
|
|
@@ -891,6 +1033,45 @@ export type ConversationTagScope = 'conversation' | 'message' | 'span'
|
|
|
891
1033
|
*/
|
|
892
1034
|
export type ConversationTagEvaluatorKind = 'decide' | 'reason'
|
|
893
1035
|
|
|
1036
|
+
/**
|
|
1037
|
+
* What a definition is judged over: `conversation` (its messages, windowed per
|
|
1038
|
+
* trigger — the default) or `summary` (the conversation's final summary plus
|
|
1039
|
+
* the humans' notes; conversation scope only; planned only once the
|
|
1040
|
+
* conversation has a summary, so never by a realtime evaluation).
|
|
1041
|
+
*/
|
|
1042
|
+
export type ConversationTagBasis = 'conversation' | 'summary'
|
|
1043
|
+
|
|
1044
|
+
/**
|
|
1045
|
+
* Who set a conversation's outcome: a person (never overridden), the model
|
|
1046
|
+
* (a `role: 'outcome'` tag) or the service itself from a channel fact (a call
|
|
1047
|
+
* nobody answered, a meeting nobody joined).
|
|
1048
|
+
*/
|
|
1049
|
+
export type ConversationOutcomeSource = 'user' | 'model' | 'system'
|
|
1050
|
+
|
|
1051
|
+
/**
|
|
1052
|
+
* One outcome a conversation may take, as `conversations.listOutcomes`
|
|
1053
|
+
* lists them: the type's outcomes (`source: 'type'`) followed by the
|
|
1054
|
+
* channel's system outcomes (`source: 'system'` — phone: not_reached /
|
|
1055
|
+
* voicemail / wrong_number; meetings: no_show / cancelled; email: no_reply /
|
|
1056
|
+
* bounced / declined; chat: no_reply / declined). The service sets the ones
|
|
1057
|
+
* it can tell by itself; a person may pick any.
|
|
1058
|
+
*/
|
|
1059
|
+
export interface ConversationOutcomeOption {
|
|
1060
|
+
key: string
|
|
1061
|
+
name: string
|
|
1062
|
+
description?: string
|
|
1063
|
+
source: 'type' | 'system'
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* The special part a definition plays beyond being an observation. `outcome`
|
|
1068
|
+
* = THE result of the conversation: a choice question at conversation scope,
|
|
1069
|
+
* one value per conversation, the human's choice beats the model's (an
|
|
1070
|
+
* evaluation never asks the model an outcome a user already set), surfaced in
|
|
1071
|
+
* the softphone and the conversation header. `phase` is reserved.
|
|
1072
|
+
*/
|
|
1073
|
+
export type ConversationTagRole = 'outcome'
|
|
1074
|
+
|
|
894
1075
|
/**
|
|
895
1076
|
* WHY an evaluation ran: `realtime` (the debounced window after new messages),
|
|
896
1077
|
* `completion` (the conversation completed — final transcript + summary for
|
|
@@ -1002,6 +1183,10 @@ export interface ConversationTagDefinition {
|
|
|
1002
1183
|
/** `span` requires `evaluator.kind = 'reason'`. */
|
|
1003
1184
|
scope: ConversationTagScope
|
|
1004
1185
|
evaluator: ConversationTagEvaluator
|
|
1186
|
+
/** `summary` requires conversation scope. */
|
|
1187
|
+
basis: ConversationTagBasis
|
|
1188
|
+
/** Absent = a plain observation. `outcome` requires a choice question at conversation scope. */
|
|
1189
|
+
role?: ConversationTagRole
|
|
1005
1190
|
/**
|
|
1006
1191
|
* Narrows message/span-scope judging to messages of these directions (e.g.
|
|
1007
1192
|
* inbound only for customer sentiment); empty = all. Ignored for
|
|
@@ -1258,6 +1443,10 @@ export interface CreateConversationTagDefinitionRequest {
|
|
|
1258
1443
|
question: ConversationTagQuestion
|
|
1259
1444
|
scope: ConversationTagScope
|
|
1260
1445
|
evaluator: ConversationTagEvaluator
|
|
1446
|
+
/** Omitted ⇒ `conversation`. */
|
|
1447
|
+
basis?: ConversationTagBasis
|
|
1448
|
+
/** Omitted ⇒ none. */
|
|
1449
|
+
role?: ConversationTagRole | ''
|
|
1261
1450
|
directions?: MessageDirection[]
|
|
1262
1451
|
/** 0..1 */
|
|
1263
1452
|
min_confidence?: number
|
|
@@ -1278,6 +1467,9 @@ export interface UpdateConversationTagDefinitionRequest {
|
|
|
1278
1467
|
question?: ConversationTagQuestion
|
|
1279
1468
|
scope?: ConversationTagScope
|
|
1280
1469
|
evaluator?: ConversationTagEvaluator
|
|
1470
|
+
basis?: ConversationTagBasis
|
|
1471
|
+
/** Empty string clears the role. */
|
|
1472
|
+
role?: ConversationTagRole | ''
|
|
1281
1473
|
directions?: MessageDirection[]
|
|
1282
1474
|
/** 0..1 */
|
|
1283
1475
|
min_confidence?: number
|
|
@@ -1292,6 +1484,8 @@ export interface ListConversationTagDefinitionsQuery extends PaginationQuery {
|
|
|
1292
1484
|
group?: string
|
|
1293
1485
|
/** Exact filter. */
|
|
1294
1486
|
scope?: string
|
|
1487
|
+
/** Exact filter — `outcome` lists the outcome definitions. */
|
|
1488
|
+
role?: string
|
|
1295
1489
|
is_enabled?: boolean
|
|
1296
1490
|
/** Case-insensitive substring match on key or name. */
|
|
1297
1491
|
search?: string
|
|
@@ -1348,6 +1542,265 @@ export interface ListConversationTagSetsQuery extends PaginationQuery {
|
|
|
1348
1542
|
search?: string
|
|
1349
1543
|
}
|
|
1350
1544
|
|
|
1545
|
+
// ── Conversation objectives ──────────────────────────────────────────────
|
|
1546
|
+
|
|
1547
|
+
/**
|
|
1548
|
+
* How an objective definition's achievement is told: `tag` (a tag on a tag
|
|
1549
|
+
* definition meets a value condition) or `outcome` (the conversation's
|
|
1550
|
+
* outcome is one of a set).
|
|
1551
|
+
*/
|
|
1552
|
+
export type ConversationObjectiveMeasureKind = 'tag' | 'outcome'
|
|
1553
|
+
|
|
1554
|
+
/**
|
|
1555
|
+
* The value condition — exactly one field set, matched to the question type
|
|
1556
|
+
* of the measured tag definition (boolean / choice / score) or, for kind
|
|
1557
|
+
* `outcome`, `choice_in` over outcome keys. `score_min` is the 0-based level
|
|
1558
|
+
* index a score tag must reach (tag values store the level index).
|
|
1559
|
+
*/
|
|
1560
|
+
export interface ConversationObjectiveAchievedWhen {
|
|
1561
|
+
boolean?: boolean
|
|
1562
|
+
choice_in?: string[]
|
|
1563
|
+
score_min?: number
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1566
|
+
/**
|
|
1567
|
+
* How an objective's achievement is told:
|
|
1568
|
+
*
|
|
1569
|
+
* - kind `tag`: a non-dismissed tag on `tag_definition_key` whose value meets
|
|
1570
|
+
* `achieved_when` (a pending tag ⇒ achieved, provisional). The tag
|
|
1571
|
+
* definition must be conversation-scoped and role-less — a person ticks the
|
|
1572
|
+
* objective by creating a user tag on it, unticks by deleting that tag.
|
|
1573
|
+
* - kind `outcome`: the conversation's `outcome_key` is one of
|
|
1574
|
+
* `achieved_when.choice_in` (the type's outcomes and the channel's system
|
|
1575
|
+
* outcomes) — ticked through the outcome picker.
|
|
1576
|
+
*/
|
|
1577
|
+
export interface ConversationObjectiveMeasure {
|
|
1578
|
+
kind: ConversationObjectiveMeasureKind
|
|
1579
|
+
/** Required for kind `tag`; absent for kind `outcome`. */
|
|
1580
|
+
tag_definition_key?: string
|
|
1581
|
+
achieved_when: ConversationObjectiveAchievedWhen
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
/**
|
|
1585
|
+
* One thing a conversation should achieve — "confirm the budget", "agree a
|
|
1586
|
+
* next step", "book the demo". Applies to every conversation (`type_key`
|
|
1587
|
+
* absent) or to conversations of one type, may be pinned to one of that
|
|
1588
|
+
* type's phases (the checklist groups by phase, and a phase counts as done
|
|
1589
|
+
* once every measured objective in it is achieved), and may be MEASURED so
|
|
1590
|
+
* the platform tells whether it was achieved (no `measure` = guidance only,
|
|
1591
|
+
* a line on the checklist). Its instance on a conversation is a
|
|
1592
|
+
* ConversationObjective — the same definition → instance split as
|
|
1593
|
+
* ConversationTagDefinition → ConversationTag. Keyed by `key`;
|
|
1594
|
+
* module-deployable (conversation-objective-definitions/<key>.json).
|
|
1595
|
+
*/
|
|
1596
|
+
export interface ConversationObjectiveDefinition {
|
|
1597
|
+
org_id: string
|
|
1598
|
+
key: string
|
|
1599
|
+
name: string
|
|
1600
|
+
description?: string
|
|
1601
|
+
/** Restricts the objective to one conversation type; absent = every conversation. */
|
|
1602
|
+
type_key?: string
|
|
1603
|
+
/** Pins the objective to one of the type's phases (requires `type_key`); absent = ungrouped. */
|
|
1604
|
+
phase_key?: string
|
|
1605
|
+
/** How achievement is told; absent = guidance only. */
|
|
1606
|
+
measure?: ConversationObjectiveMeasure
|
|
1607
|
+
is_enabled: boolean
|
|
1608
|
+
/** Module that deployed the definition; absent when not module-owned. */
|
|
1609
|
+
module_slug?: string
|
|
1610
|
+
created_at: string
|
|
1611
|
+
created_by: UserRef
|
|
1612
|
+
updated_at: string
|
|
1613
|
+
updated_by: UserRef
|
|
1614
|
+
}
|
|
1615
|
+
|
|
1616
|
+
/**
|
|
1617
|
+
* Creates one objective definition. `phase_key` requires `type_key` and must
|
|
1618
|
+
* be one of that type's phases. A `tag` measure names a CONVERSATION-scoped,
|
|
1619
|
+
* role-less tag definition and its `achieved_when` must match the question
|
|
1620
|
+
* type (boolean ⇒ `{boolean: true}`; choice ⇒ `{choice_in ⊆ options}`; score
|
|
1621
|
+
* ⇒ `{score_min: level index}`); an `outcome` measure takes `{choice_in}` over
|
|
1622
|
+
* outcome keys (the type's outcomes ∪ the channel system outcomes when
|
|
1623
|
+
* typed). `is_enabled` omitted ⇒ true. `module_slug` is stamped by
|
|
1624
|
+
* `pro module deploy`.
|
|
1625
|
+
*/
|
|
1626
|
+
export interface CreateConversationObjectiveDefinitionRequest {
|
|
1627
|
+
key: string
|
|
1628
|
+
name: string
|
|
1629
|
+
description?: string
|
|
1630
|
+
type_key?: string
|
|
1631
|
+
phase_key?: string
|
|
1632
|
+
measure?: ConversationObjectiveMeasure
|
|
1633
|
+
is_enabled?: boolean
|
|
1634
|
+
module_slug?: string
|
|
1635
|
+
}
|
|
1636
|
+
|
|
1637
|
+
/**
|
|
1638
|
+
* Partial update — an omitted field leaves the stored value untouched.
|
|
1639
|
+
* `measure` is tri-state: omitted keeps it, `null` clears it (guidance only),
|
|
1640
|
+
* a value replaces it wholesale. `key` is immutable.
|
|
1641
|
+
*/
|
|
1642
|
+
export interface UpdateConversationObjectiveDefinitionRequest {
|
|
1643
|
+
name?: string
|
|
1644
|
+
description?: string
|
|
1645
|
+
type_key?: string
|
|
1646
|
+
phase_key?: string
|
|
1647
|
+
measure?: ConversationObjectiveMeasure | null
|
|
1648
|
+
is_enabled?: boolean
|
|
1649
|
+
}
|
|
1650
|
+
|
|
1651
|
+
export interface GetManyConversationObjectiveDefinitionsQuery extends PaginationQuery {
|
|
1652
|
+
/** Definitions deployed by one module. */
|
|
1653
|
+
module_slug?: string
|
|
1654
|
+
type_key?: string
|
|
1655
|
+
phase_key?: string
|
|
1656
|
+
is_enabled?: boolean
|
|
1657
|
+
/** Case-insensitive substring match on key or name. */
|
|
1658
|
+
search?: string
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
/**
|
|
1662
|
+
* An objective's standing on a conversation: open (not yet, or no longer,
|
|
1663
|
+
* achieved) or achieved. Whether an achieved standing is still provisional is
|
|
1664
|
+
* the separate `is_provisional` flag, never a third status.
|
|
1665
|
+
*/
|
|
1666
|
+
export type ConversationObjectiveStatus = 'open' | 'achieved'
|
|
1667
|
+
|
|
1668
|
+
/**
|
|
1669
|
+
* Who achieved an objective: a person (a user tag or a hand-picked outcome),
|
|
1670
|
+
* the model (a detected tag or outcome) or the system (a channel-level
|
|
1671
|
+
* outcome the service set by itself).
|
|
1672
|
+
*/
|
|
1673
|
+
export type ConversationObjectiveSource = 'user' | 'model' | 'system'
|
|
1674
|
+
|
|
1675
|
+
/** Where a conversation stands in one of its type's phases. */
|
|
1676
|
+
export type ConversationPhaseStatus = 'done' | 'current' | 'upcoming' | 'untracked'
|
|
1677
|
+
|
|
1678
|
+
/**
|
|
1679
|
+
* One objective definition's standing on one conversation: open or achieved,
|
|
1680
|
+
* by whom, when, and on which tag. Resolved live for the per-conversation
|
|
1681
|
+
* read (ConversationObjectiveProgress) AND persisted as the ledger row of
|
|
1682
|
+
* the same shape — one row per APPLICABLE definition, open rows included,
|
|
1683
|
+
* rewritten at every change point. Never user-written.
|
|
1684
|
+
*/
|
|
1685
|
+
export interface ConversationObjective {
|
|
1686
|
+
org_id: string
|
|
1687
|
+
conversation_id: string
|
|
1688
|
+
definition_key: string
|
|
1689
|
+
/** The conversation's channel, denormalized at resolution time. */
|
|
1690
|
+
channel: Channel
|
|
1691
|
+
/** The conversation's type, denormalized at resolution time. */
|
|
1692
|
+
type_key?: string
|
|
1693
|
+
/** The definition's phase, denormalized at resolution time. */
|
|
1694
|
+
phase_key?: string
|
|
1695
|
+
status: ConversationObjectiveStatus
|
|
1696
|
+
/** Who achieved it; absent while open. */
|
|
1697
|
+
source?: ConversationObjectiveSource
|
|
1698
|
+
/**
|
|
1699
|
+
* The backing tag is still `pending` — a realtime detection on a live
|
|
1700
|
+
* spoken conversation the completion pass has not confirmed. Never true for
|
|
1701
|
+
* a user or system source.
|
|
1702
|
+
*/
|
|
1703
|
+
is_provisional: boolean
|
|
1704
|
+
achieved_at?: string
|
|
1705
|
+
/**
|
|
1706
|
+
* The tag that achieved a tag-measured objective (the one to delete to
|
|
1707
|
+
* untick when `source` is user); absent for outcome measures.
|
|
1708
|
+
*/
|
|
1709
|
+
tag_id?: string
|
|
1710
|
+
/** The conversation's status at resolution time — an open objective on an ended conversation was missed. */
|
|
1711
|
+
is_conversation_ended: boolean
|
|
1712
|
+
/** When this standing was resolved (the ledger write). */
|
|
1713
|
+
recorded_at: string
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
/**
|
|
1717
|
+
* One row of `conversationObjectives.counts`: the grouped columns that were
|
|
1718
|
+
* requested plus the count.
|
|
1719
|
+
*/
|
|
1720
|
+
export interface ConversationObjectiveCount {
|
|
1721
|
+
definition_key?: string
|
|
1722
|
+
status?: ConversationObjectiveStatus
|
|
1723
|
+
source?: ConversationObjectiveSource
|
|
1724
|
+
is_provisional?: boolean
|
|
1725
|
+
type_key?: string
|
|
1726
|
+
phase_key?: string
|
|
1727
|
+
channel?: Channel
|
|
1728
|
+
count: number
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
/**
|
|
1732
|
+
* One of the type's phases as the conversation stands in it, derived from
|
|
1733
|
+
* the objectives pinned to the phase: `done` = every measured objective
|
|
1734
|
+
* achieved (≥ 1 measured; provisional counts); `current` = the first phase
|
|
1735
|
+
* in type order that is not done and has a measured objective; `upcoming` =
|
|
1736
|
+
* after the current one; `untracked` = no measured objective, so progress
|
|
1737
|
+
* cannot be told (dim, never current). `completed_at` is the latest
|
|
1738
|
+
* `achieved_at` among the phase's measured objectives once done.
|
|
1739
|
+
*/
|
|
1740
|
+
export interface ConversationPhaseProgress extends ConversationPhase {
|
|
1741
|
+
status: ConversationPhaseStatus
|
|
1742
|
+
completed_at?: string
|
|
1743
|
+
}
|
|
1744
|
+
|
|
1745
|
+
/**
|
|
1746
|
+
* `conversations.getObjectiveProgress`: where the conversation stands — the
|
|
1747
|
+
* current phase key (`''` when the type has no phases or every tracked phase
|
|
1748
|
+
* is done), every phase with its status, every applicable objective with its
|
|
1749
|
+
* standing, and the applicable definitions the objectives reference by
|
|
1750
|
+
* `definition_key` (join `objectives[].definition_key` → `definitions[].key`
|
|
1751
|
+
* for name / description / measure). Objectives are ordered: ungrouped first,
|
|
1752
|
+
* then by the type's phase order, then name.
|
|
1753
|
+
*/
|
|
1754
|
+
export interface ConversationObjectiveProgress {
|
|
1755
|
+
phase_key: string
|
|
1756
|
+
phases: ConversationPhaseProgress[]
|
|
1757
|
+
objectives: ConversationObjective[]
|
|
1758
|
+
definitions: ConversationObjectiveDefinition[]
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
/** The org-wide ledger read (`conversationObjectives.list`); `since`/`until` bound `recorded_at`. */
|
|
1762
|
+
export interface GetManyConversationObjectivesQuery extends PaginationQuery {
|
|
1763
|
+
conversation_id?: string
|
|
1764
|
+
definition_key?: string
|
|
1765
|
+
type_key?: string
|
|
1766
|
+
phase_key?: string
|
|
1767
|
+
channel?: string
|
|
1768
|
+
status?: string
|
|
1769
|
+
source?: string
|
|
1770
|
+
is_provisional?: boolean
|
|
1771
|
+
is_conversation_ended?: boolean
|
|
1772
|
+
/** Lower bound on `recorded_at` (inclusive), RFC 3339. */
|
|
1773
|
+
since?: string
|
|
1774
|
+
/** Upper bound on `recorded_at` (exclusive), RFC 3339. */
|
|
1775
|
+
until?: string
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
/**
|
|
1779
|
+
* Groups the ledger for dashboards. `group_by` is a COMMA-JOINED string (not
|
|
1780
|
+
* an array — the query serializer repeats array keys) whitelisted to
|
|
1781
|
+
* definition_key, status, source, is_provisional, type_key, phase_key,
|
|
1782
|
+
* channel (order kept; default `definition_key,status`).
|
|
1783
|
+
*/
|
|
1784
|
+
export interface CountConversationObjectivesQuery {
|
|
1785
|
+
group_by?: string
|
|
1786
|
+
definition_key?: string
|
|
1787
|
+
type_key?: string
|
|
1788
|
+
phase_key?: string
|
|
1789
|
+
channel?: string
|
|
1790
|
+
status?: string
|
|
1791
|
+
source?: string
|
|
1792
|
+
is_provisional?: boolean
|
|
1793
|
+
is_conversation_ended?: boolean
|
|
1794
|
+
/** Lower bound on `recorded_at` (inclusive), RFC 3339. */
|
|
1795
|
+
since?: string
|
|
1796
|
+
/** Upper bound on `recorded_at` (exclusive), RFC 3339. */
|
|
1797
|
+
until?: string
|
|
1798
|
+
}
|
|
1799
|
+
|
|
1800
|
+
export interface CountConversationObjectivesResponse {
|
|
1801
|
+
data: ConversationObjectiveCount[]
|
|
1802
|
+
}
|
|
1803
|
+
|
|
1351
1804
|
/**
|
|
1352
1805
|
* The manual door (`conversationTags.create`): a person tags a conversation,
|
|
1353
1806
|
* a message or a span. Anchors follow the definition's scope (conversation:
|
|
@@ -1649,6 +2102,11 @@ export interface ListConversationsQuery extends PaginationQuery {
|
|
|
1649
2102
|
channel?: string
|
|
1650
2103
|
status?: string
|
|
1651
2104
|
connection_id?: string
|
|
2105
|
+
type_key?: string
|
|
2106
|
+
/** The meeting conversations born from one calendar event UID. */
|
|
2107
|
+
calendar_event_ical_uid?: string
|
|
2108
|
+
/** How conversations ended (one of a type's outcome keys). */
|
|
2109
|
+
outcome_key?: string
|
|
1652
2110
|
/**
|
|
1653
2111
|
* Conversations of one room (Slack channel) — the room stream. A
|
|
1654
2112
|
* present-but-EMPTY string is meaningful: it filters to the room-LESS
|
|
@@ -1691,6 +2149,15 @@ export interface UpdateConversationRequest {
|
|
|
1691
2149
|
summary?: string
|
|
1692
2150
|
status?: ConversationStatus
|
|
1693
2151
|
metadata?: Record<string, unknown>
|
|
2152
|
+
/** Set the type by hand (must exist; `''` clears). Leaves the outcome alone. */
|
|
2153
|
+
type_key?: string
|
|
2154
|
+
/**
|
|
2155
|
+
* How the conversation ended — one of `conversations.listOutcomes(id)`
|
|
2156
|
+
* (its type's outcomes or its channel's system outcomes; `''` clears). The
|
|
2157
|
+
* person's choice: never overridden by the model or the service. 400
|
|
2158
|
+
* `conversation_outcome_unknown` when the key is in neither list.
|
|
2159
|
+
*/
|
|
2160
|
+
outcome_key?: string
|
|
1694
2161
|
}
|
|
1695
2162
|
|
|
1696
2163
|
export interface ListMessagesQuery extends PaginationQuery {
|
|
@@ -2417,6 +2884,68 @@ export interface DispatchMeetingBotRequest {
|
|
|
2417
2884
|
* transcription provider is deepgram_streaming.
|
|
2418
2885
|
*/
|
|
2419
2886
|
language?: string
|
|
2887
|
+
/**
|
|
2888
|
+
* The calendar meeting instance the bot is sent for — `calendar_event_ical_uid`
|
|
2889
|
+
* with `start_at` (the instance start, ISO) link the meeting conversation and
|
|
2890
|
+
* its bot to the calendar so the event's surface can follow them.
|
|
2891
|
+
*/
|
|
2892
|
+
calendar_event_ical_uid?: string
|
|
2893
|
+
start_at?: string
|
|
2894
|
+
}
|
|
2895
|
+
|
|
2896
|
+
/**
|
|
2897
|
+
* Lifecycle of an Ava bot: `scheduled` (sent, not yet in the call) → `joining`
|
|
2898
|
+
* → `recording` → `ended` | `failed`, or `removed` (a person withdrew Ava —
|
|
2899
|
+
* terminal; a removed meeting is not scheduled again).
|
|
2900
|
+
*/
|
|
2901
|
+
export type MeetingBotStatus =
|
|
2902
|
+
| 'scheduled'
|
|
2903
|
+
| 'joining'
|
|
2904
|
+
| 'recording'
|
|
2905
|
+
| 'ended'
|
|
2906
|
+
| 'failed'
|
|
2907
|
+
| 'removed'
|
|
2908
|
+
|
|
2909
|
+
/**
|
|
2910
|
+
* The platform's memory of one Ava bot — "Ava joins this meeting", whoever's
|
|
2911
|
+
* calendar scheduled her. One bot per meeting instance per org when bot
|
|
2912
|
+
* deduplication is on; several rows can share an instance when it is off.
|
|
2913
|
+
*/
|
|
2914
|
+
export interface MeetingBot {
|
|
2915
|
+
id: string
|
|
2916
|
+
org_id: string
|
|
2917
|
+
/** The connection (calendar / adhoc) that scheduled the bot. */
|
|
2918
|
+
connection_id: string
|
|
2919
|
+
/** The provider's bot id; the meeting conversation's external id once begun. */
|
|
2920
|
+
external_bot_id: string
|
|
2921
|
+
/** The provider calendar-event id the bot was scheduled on; absent for adhoc. */
|
|
2922
|
+
provider_event_id?: string
|
|
2923
|
+
calendar_event_ical_uid?: string
|
|
2924
|
+
start_at?: string
|
|
2925
|
+
meeting_url?: string
|
|
2926
|
+
title?: string
|
|
2927
|
+
status: MeetingBotStatus
|
|
2928
|
+
/**
|
|
2929
|
+
* Platform users among the invitees: they see the bot — and may withdraw
|
|
2930
|
+
* Ava from their meeting — without owning the connection that scheduled her.
|
|
2931
|
+
*/
|
|
2932
|
+
invitee_user_ids: string[]
|
|
2933
|
+
/** The meeting conversation; absent until the bot starts the meeting. */
|
|
2934
|
+
conversation_id?: string
|
|
2935
|
+
created_at: string
|
|
2936
|
+
created_by: UserRef
|
|
2937
|
+
updated_at: string
|
|
2938
|
+
updated_by: UserRef
|
|
2939
|
+
}
|
|
2940
|
+
|
|
2941
|
+
export interface ListMeetingBotsQuery extends PaginationQuery {
|
|
2942
|
+
/** Meetings starting at/after this ISO instant. */
|
|
2943
|
+
start_after?: string
|
|
2944
|
+
/** Meetings starting before this ISO instant. */
|
|
2945
|
+
start_before?: string
|
|
2946
|
+
/** One calendar meeting (pair with the window to name an instance). */
|
|
2947
|
+
calendar_event_ical_uid?: string
|
|
2948
|
+
status?: MeetingBotStatus
|
|
2420
2949
|
}
|
|
2421
2950
|
|
|
2422
2951
|
// ── Sending rules ─────────────────────────────────────────────────────────────
|
|
@@ -2527,13 +3056,28 @@ export interface ConversationBrief {
|
|
|
2527
3056
|
org_id: string
|
|
2528
3057
|
/** Human label ("Renewal call with Dana"); may be empty. */
|
|
2529
3058
|
subject: string
|
|
2530
|
-
/** The people the conversation is with (
|
|
3059
|
+
/** The people the conversation is with (deduplicated, sorted; may be empty — a phone brief has ≥ 1). */
|
|
2531
3060
|
contact_ids: string[]
|
|
2532
3061
|
/** How the conversation should happen (phone opens the softphone); absent = unspecified. */
|
|
2533
3062
|
channel?: Channel
|
|
2534
3063
|
/** ConversationType key the conversation is meant to be; stamped on attach. */
|
|
2535
3064
|
type_key?: string
|
|
2536
|
-
/**
|
|
3065
|
+
/**
|
|
3066
|
+
* The calendar event (one person's copy) the brief prepares; attached to
|
|
3067
|
+
* the meeting's conversation when the meeting bot starts. Absent = no meeting.
|
|
3068
|
+
*/
|
|
3069
|
+
calendar_event_id?: string
|
|
3070
|
+
/** The brief is every invitee's, not only the event owner's. */
|
|
3071
|
+
is_shared_with_participants: boolean
|
|
3072
|
+
/** The meeting instance the event belongs to (resolved from the event; read-only). */
|
|
3073
|
+
calendar_event_ical_uid?: string
|
|
3074
|
+
calendar_event_start_at?: string
|
|
3075
|
+
/**
|
|
3076
|
+
* The platform users the brief is for (the event owner; every resolved
|
|
3077
|
+
* invitee when shared) — they read it next to its creator. Read-only.
|
|
3078
|
+
*/
|
|
3079
|
+
invitee_user_ids: string[]
|
|
3080
|
+
/** The conversation the brief was used on; absent until used. A conversation may carry several briefs. */
|
|
2537
3081
|
conversation_id?: string
|
|
2538
3082
|
status: ConversationBriefStatus
|
|
2539
3083
|
/** Guidance text (markdown allowed). */
|
|
@@ -2547,13 +3091,17 @@ export interface ConversationBrief {
|
|
|
2547
3091
|
|
|
2548
3092
|
export interface CreateConversationBriefRequest {
|
|
2549
3093
|
subject?: string
|
|
2550
|
-
/** The people the conversation is with (
|
|
2551
|
-
contact_ids
|
|
3094
|
+
/** The people the conversation is with (may be empty). */
|
|
3095
|
+
contact_ids?: string[]
|
|
2552
3096
|
/** Must be a known channel when set. */
|
|
2553
3097
|
channel?: Channel
|
|
2554
3098
|
/** Must name an existing conversation type when set. */
|
|
2555
3099
|
type_key?: string
|
|
2556
3100
|
content: string
|
|
3101
|
+
/** The caller's view of a calendar event the brief prepares (the caller must be able to read it). */
|
|
3102
|
+
calendar_event_id?: string
|
|
3103
|
+
/** Every invitee's brief instead of only the event owner's (requires calendar_event_id). */
|
|
3104
|
+
is_shared_with_participants?: boolean
|
|
2557
3105
|
}
|
|
2558
3106
|
|
|
2559
3107
|
/** PATCH semantics — absent fields keep their value. Only open briefs. */
|
|
@@ -2565,6 +3113,9 @@ export interface UpdateConversationBriefRequest {
|
|
|
2565
3113
|
channel?: Channel | ''
|
|
2566
3114
|
content?: string
|
|
2567
3115
|
type_key?: string
|
|
3116
|
+
/** Re-ties the brief; empty string unties it (and drops the sharing). */
|
|
3117
|
+
calendar_event_id?: string
|
|
3118
|
+
is_shared_with_participants?: boolean
|
|
2568
3119
|
}
|
|
2569
3120
|
|
|
2570
3121
|
/** Binds an open brief to a conversation explicitly. */
|
|
@@ -2576,6 +3127,14 @@ export interface ListConversationBriefsQuery extends PaginationQuery {
|
|
|
2576
3127
|
/** Briefs naming this person. */
|
|
2577
3128
|
contact_id?: string
|
|
2578
3129
|
conversation_id?: string
|
|
3130
|
+
/** The briefs for one person's copy of a calendar event. */
|
|
3131
|
+
calendar_event_id?: string
|
|
3132
|
+
/** Every visible brief of a meeting, across invitees' copies (+ start to pin one instance). */
|
|
3133
|
+
calendar_event_ical_uid?: string
|
|
3134
|
+
calendar_event_start_at?: string
|
|
3135
|
+
/** The briefs of the meetings starting in [after, before) — a calendar's visible range. */
|
|
3136
|
+
calendar_event_start_after?: string
|
|
3137
|
+
calendar_event_start_before?: string
|
|
2579
3138
|
channel?: Channel
|
|
2580
3139
|
type_key?: string
|
|
2581
3140
|
status?: ConversationBriefStatus
|
|
@@ -3059,3 +3618,35 @@ export interface ListChannelActionsQuery extends PaginationQuery {
|
|
|
3059
3618
|
status?: ChannelActionStatus
|
|
3060
3619
|
contact_id?: string
|
|
3061
3620
|
}
|
|
3621
|
+
|
|
3622
|
+
/**
|
|
3623
|
+
* What a PERSON recorded about a conversation — during a call, after a
|
|
3624
|
+
* meeting, while reading a thread. An append log, author-stamped, never
|
|
3625
|
+
* merged. Notes feed the summary (what the human found important) and the
|
|
3626
|
+
* summary-basis tag evaluations. As visible as the conversation; only the
|
|
3627
|
+
* author edits or deletes.
|
|
3628
|
+
*/
|
|
3629
|
+
export interface ConversationNote {
|
|
3630
|
+
id: string
|
|
3631
|
+
org_id: string
|
|
3632
|
+
conversation_id: string
|
|
3633
|
+
/** Markdown allowed. */
|
|
3634
|
+
content: string
|
|
3635
|
+
created_at: string
|
|
3636
|
+
created_by: UserRef
|
|
3637
|
+
updated_at: string
|
|
3638
|
+
updated_by: UserRef
|
|
3639
|
+
}
|
|
3640
|
+
|
|
3641
|
+
export interface CreateConversationNoteRequest {
|
|
3642
|
+
content: string
|
|
3643
|
+
}
|
|
3644
|
+
|
|
3645
|
+
export interface UpdateConversationNoteRequest {
|
|
3646
|
+
content: string
|
|
3647
|
+
}
|
|
3648
|
+
|
|
3649
|
+
export interface ListConversationNotesQuery extends PaginationQuery {
|
|
3650
|
+
sort_by?: string
|
|
3651
|
+
sort?: 'asc' | 'desc'
|
|
3652
|
+
}
|