@proteos/sdk 0.60.0 → 0.75.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 (40) hide show
  1. package/dist/{chunk-OOOTPEJK.js → chunk-3VQQEJV6.js} +71 -11
  2. package/dist/chunk-3VQQEJV6.js.map +1 -0
  3. package/dist/{chunk-25PD6TYH.cjs → chunk-C4CH6CEY.cjs} +75 -10
  4. package/dist/chunk-C4CH6CEY.cjs.map +1 -0
  5. package/dist/index.cjs +379 -130
  6. package/dist/index.cjs.map +1 -1
  7. package/dist/index.d.cts +813 -81
  8. package/dist/index.d.ts +813 -81
  9. package/dist/index.js +250 -13
  10. package/dist/index.js.map +1 -1
  11. package/dist/meta/index.cjs +109 -89
  12. package/dist/meta/index.d.cts +1 -1
  13. package/dist/meta/index.d.ts +1 -1
  14. package/dist/meta/index.js +1 -1
  15. package/dist/{types-DQmqR_G8.d.cts → types-Dp-AB2QZ.d.cts} +561 -48
  16. package/dist/{types-DQmqR_G8.d.ts → types-Dp-AB2QZ.d.ts} +561 -48
  17. package/package.json +1 -1
  18. package/src/agent/session-types.ts +8 -1
  19. package/src/agent/sessions.ts +6 -4
  20. package/src/agent/types.ts +9 -0
  21. package/src/auth/platform-entities.ts +6 -0
  22. package/src/client.ts +28 -4
  23. package/src/conversation/index.ts +327 -15
  24. package/src/conversation/types.ts +594 -5
  25. package/src/data/entity-indexes.ts +54 -0
  26. package/src/data/index.ts +12 -0
  27. package/src/data/types.ts +66 -0
  28. package/src/errors.ts +5 -0
  29. package/src/index.ts +57 -0
  30. package/src/meta/components.ts +23 -3
  31. package/src/meta/index.ts +8 -0
  32. package/src/meta/layout/common-props.ts +9 -0
  33. package/src/meta/layout/elements.ts +57 -0
  34. package/src/meta/layout/index.ts +5 -0
  35. package/src/meta/layout/page-layout.ts +15 -3
  36. package/src/meta/types.ts +206 -21
  37. package/src/scheduling/types.ts +5 -1
  38. package/src/workflow/types.ts +10 -2
  39. package/dist/chunk-25PD6TYH.cjs.map +0 -1
  40. 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,19 @@ 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 next steps — the live call's quick actions and the wrap-up's
957
+ * "Next steps". Same contract as `Page.actions`; each button's
958
+ * `visible_when` reads the conversation scope (`conversation.status` for
959
+ * the stage, `conversation.outcome_key`, `records_by_entity.<slug>`,
960
+ * `tags_by_definition.<key>`, …); no rule = offered throughout. Ordered;
961
+ * empty = none.
962
+ */
963
+ actions: PageAction[]
836
964
  /** Module that deployed the type; absent when not module-owned. */
837
965
  module_slug?: string
838
966
  created_at: string
@@ -847,6 +975,12 @@ export interface CreateConversationTypeRequest {
847
975
  name?: string
848
976
  definition: string
849
977
  config?: ConversationTypeConfig
978
+ /** Replaces the list wholesale; omit = none. */
979
+ outcomes?: ConversationOutcome[]
980
+ /** Replaces the list wholesale; omit = none. */
981
+ phases?: ConversationPhase[]
982
+ /** Replaces the list wholesale; omit = none. */
983
+ actions?: PageAction[]
850
984
  module_slug?: string
851
985
  }
852
986
 
@@ -855,6 +989,12 @@ export interface UpdateConversationTypeRequest {
855
989
  definition?: string
856
990
  /** Replaces the stored config wholesale; send `{}` to clear the prompt link. */
857
991
  config?: ConversationTypeConfig
992
+ /** Replaces the list wholesale; `[]` clears it. */
993
+ outcomes?: ConversationOutcome[]
994
+ /** Replaces the list wholesale; `[]` clears it. */
995
+ phases?: ConversationPhase[]
996
+ /** Replaces the list wholesale; `[]` clears it. */
997
+ actions?: PageAction[]
858
998
  }
859
999
 
860
1000
  export interface ListConversationTypesQuery extends PaginationQuery {
@@ -891,6 +1031,45 @@ export type ConversationTagScope = 'conversation' | 'message' | 'span'
891
1031
  */
892
1032
  export type ConversationTagEvaluatorKind = 'decide' | 'reason'
893
1033
 
1034
+ /**
1035
+ * What a definition is judged over: `conversation` (its messages, windowed per
1036
+ * trigger — the default) or `summary` (the conversation's final summary plus
1037
+ * the humans' notes; conversation scope only; planned only once the
1038
+ * conversation has a summary, so never by a realtime evaluation).
1039
+ */
1040
+ export type ConversationTagBasis = 'conversation' | 'summary'
1041
+
1042
+ /**
1043
+ * Who set a conversation's outcome: a person (never overridden), the model
1044
+ * (a `role: 'outcome'` tag) or the service itself from a channel fact (a call
1045
+ * nobody answered, a meeting nobody joined).
1046
+ */
1047
+ export type ConversationOutcomeSource = 'user' | 'model' | 'system'
1048
+
1049
+ /**
1050
+ * One outcome a conversation may take, as `conversations.listOutcomes`
1051
+ * lists them: the type's outcomes (`source: 'type'`) followed by the
1052
+ * channel's system outcomes (`source: 'system'` — phone: not_reached /
1053
+ * voicemail / wrong_number; meetings: no_show / cancelled; email: no_reply /
1054
+ * bounced / declined; chat: no_reply / declined). The service sets the ones
1055
+ * it can tell by itself; a person may pick any.
1056
+ */
1057
+ export interface ConversationOutcomeOption {
1058
+ key: string
1059
+ name: string
1060
+ description?: string
1061
+ source: 'type' | 'system'
1062
+ }
1063
+
1064
+ /**
1065
+ * The special part a definition plays beyond being an observation. `outcome`
1066
+ * = THE result of the conversation: a choice question at conversation scope,
1067
+ * one value per conversation, the human's choice beats the model's (an
1068
+ * evaluation never asks the model an outcome a user already set), surfaced in
1069
+ * the softphone and the conversation header. `phase` is reserved.
1070
+ */
1071
+ export type ConversationTagRole = 'outcome'
1072
+
894
1073
  /**
895
1074
  * WHY an evaluation ran: `realtime` (the debounced window after new messages),
896
1075
  * `completion` (the conversation completed — final transcript + summary for
@@ -1002,6 +1181,10 @@ export interface ConversationTagDefinition {
1002
1181
  /** `span` requires `evaluator.kind = 'reason'`. */
1003
1182
  scope: ConversationTagScope
1004
1183
  evaluator: ConversationTagEvaluator
1184
+ /** `summary` requires conversation scope. */
1185
+ basis: ConversationTagBasis
1186
+ /** Absent = a plain observation. `outcome` requires a choice question at conversation scope. */
1187
+ role?: ConversationTagRole
1005
1188
  /**
1006
1189
  * Narrows message/span-scope judging to messages of these directions (e.g.
1007
1190
  * inbound only for customer sentiment); empty = all. Ignored for
@@ -1258,6 +1441,10 @@ export interface CreateConversationTagDefinitionRequest {
1258
1441
  question: ConversationTagQuestion
1259
1442
  scope: ConversationTagScope
1260
1443
  evaluator: ConversationTagEvaluator
1444
+ /** Omitted ⇒ `conversation`. */
1445
+ basis?: ConversationTagBasis
1446
+ /** Omitted ⇒ none. */
1447
+ role?: ConversationTagRole | ''
1261
1448
  directions?: MessageDirection[]
1262
1449
  /** 0..1 */
1263
1450
  min_confidence?: number
@@ -1278,6 +1465,9 @@ export interface UpdateConversationTagDefinitionRequest {
1278
1465
  question?: ConversationTagQuestion
1279
1466
  scope?: ConversationTagScope
1280
1467
  evaluator?: ConversationTagEvaluator
1468
+ basis?: ConversationTagBasis
1469
+ /** Empty string clears the role. */
1470
+ role?: ConversationTagRole | ''
1281
1471
  directions?: MessageDirection[]
1282
1472
  /** 0..1 */
1283
1473
  min_confidence?: number
@@ -1292,6 +1482,8 @@ export interface ListConversationTagDefinitionsQuery extends PaginationQuery {
1292
1482
  group?: string
1293
1483
  /** Exact filter. */
1294
1484
  scope?: string
1485
+ /** Exact filter — `outcome` lists the outcome definitions. */
1486
+ role?: string
1295
1487
  is_enabled?: boolean
1296
1488
  /** Case-insensitive substring match on key or name. */
1297
1489
  search?: string
@@ -1348,6 +1540,265 @@ export interface ListConversationTagSetsQuery extends PaginationQuery {
1348
1540
  search?: string
1349
1541
  }
1350
1542
 
1543
+ // ── Conversation objectives ──────────────────────────────────────────────
1544
+
1545
+ /**
1546
+ * How an objective definition's achievement is told: `tag` (a tag on a tag
1547
+ * definition meets a value condition) or `outcome` (the conversation's
1548
+ * outcome is one of a set).
1549
+ */
1550
+ export type ConversationObjectiveMeasureKind = 'tag' | 'outcome'
1551
+
1552
+ /**
1553
+ * The value condition — exactly one field set, matched to the question type
1554
+ * of the measured tag definition (boolean / choice / score) or, for kind
1555
+ * `outcome`, `choice_in` over outcome keys. `score_min` is the 0-based level
1556
+ * index a score tag must reach (tag values store the level index).
1557
+ */
1558
+ export interface ConversationObjectiveAchievedWhen {
1559
+ boolean?: boolean
1560
+ choice_in?: string[]
1561
+ score_min?: number
1562
+ }
1563
+
1564
+ /**
1565
+ * How an objective's achievement is told:
1566
+ *
1567
+ * - kind `tag`: a non-dismissed tag on `tag_definition_key` whose value meets
1568
+ * `achieved_when` (a pending tag ⇒ achieved, provisional). The tag
1569
+ * definition must be conversation-scoped and role-less — a person ticks the
1570
+ * objective by creating a user tag on it, unticks by deleting that tag.
1571
+ * - kind `outcome`: the conversation's `outcome_key` is one of
1572
+ * `achieved_when.choice_in` (the type's outcomes and the channel's system
1573
+ * outcomes) — ticked through the outcome picker.
1574
+ */
1575
+ export interface ConversationObjectiveMeasure {
1576
+ kind: ConversationObjectiveMeasureKind
1577
+ /** Required for kind `tag`; absent for kind `outcome`. */
1578
+ tag_definition_key?: string
1579
+ achieved_when: ConversationObjectiveAchievedWhen
1580
+ }
1581
+
1582
+ /**
1583
+ * One thing a conversation should achieve — "confirm the budget", "agree a
1584
+ * next step", "book the demo". Applies to every conversation (`type_key`
1585
+ * absent) or to conversations of one type, may be pinned to one of that
1586
+ * type's phases (the checklist groups by phase, and a phase counts as done
1587
+ * once every measured objective in it is achieved), and may be MEASURED so
1588
+ * the platform tells whether it was achieved (no `measure` = guidance only,
1589
+ * a line on the checklist). Its instance on a conversation is a
1590
+ * ConversationObjective — the same definition → instance split as
1591
+ * ConversationTagDefinition → ConversationTag. Keyed by `key`;
1592
+ * module-deployable (conversation-objective-definitions/<key>.json).
1593
+ */
1594
+ export interface ConversationObjectiveDefinition {
1595
+ org_id: string
1596
+ key: string
1597
+ name: string
1598
+ description?: string
1599
+ /** Restricts the objective to one conversation type; absent = every conversation. */
1600
+ type_key?: string
1601
+ /** Pins the objective to one of the type's phases (requires `type_key`); absent = ungrouped. */
1602
+ phase_key?: string
1603
+ /** How achievement is told; absent = guidance only. */
1604
+ measure?: ConversationObjectiveMeasure
1605
+ is_enabled: boolean
1606
+ /** Module that deployed the definition; absent when not module-owned. */
1607
+ module_slug?: string
1608
+ created_at: string
1609
+ created_by: UserRef
1610
+ updated_at: string
1611
+ updated_by: UserRef
1612
+ }
1613
+
1614
+ /**
1615
+ * Creates one objective definition. `phase_key` requires `type_key` and must
1616
+ * be one of that type's phases. A `tag` measure names a CONVERSATION-scoped,
1617
+ * role-less tag definition and its `achieved_when` must match the question
1618
+ * type (boolean ⇒ `{boolean: true}`; choice ⇒ `{choice_in ⊆ options}`; score
1619
+ * ⇒ `{score_min: level index}`); an `outcome` measure takes `{choice_in}` over
1620
+ * outcome keys (the type's outcomes ∪ the channel system outcomes when
1621
+ * typed). `is_enabled` omitted ⇒ true. `module_slug` is stamped by
1622
+ * `pro module deploy`.
1623
+ */
1624
+ export interface CreateConversationObjectiveDefinitionRequest {
1625
+ key: string
1626
+ name: string
1627
+ description?: string
1628
+ type_key?: string
1629
+ phase_key?: string
1630
+ measure?: ConversationObjectiveMeasure
1631
+ is_enabled?: boolean
1632
+ module_slug?: string
1633
+ }
1634
+
1635
+ /**
1636
+ * Partial update — an omitted field leaves the stored value untouched.
1637
+ * `measure` is tri-state: omitted keeps it, `null` clears it (guidance only),
1638
+ * a value replaces it wholesale. `key` is immutable.
1639
+ */
1640
+ export interface UpdateConversationObjectiveDefinitionRequest {
1641
+ name?: string
1642
+ description?: string
1643
+ type_key?: string
1644
+ phase_key?: string
1645
+ measure?: ConversationObjectiveMeasure | null
1646
+ is_enabled?: boolean
1647
+ }
1648
+
1649
+ export interface GetManyConversationObjectiveDefinitionsQuery extends PaginationQuery {
1650
+ /** Definitions deployed by one module. */
1651
+ module_slug?: string
1652
+ type_key?: string
1653
+ phase_key?: string
1654
+ is_enabled?: boolean
1655
+ /** Case-insensitive substring match on key or name. */
1656
+ search?: string
1657
+ }
1658
+
1659
+ /**
1660
+ * An objective's standing on a conversation: open (not yet, or no longer,
1661
+ * achieved) or achieved. Whether an achieved standing is still provisional is
1662
+ * the separate `is_provisional` flag, never a third status.
1663
+ */
1664
+ export type ConversationObjectiveStatus = 'open' | 'achieved'
1665
+
1666
+ /**
1667
+ * Who achieved an objective: a person (a user tag or a hand-picked outcome),
1668
+ * the model (a detected tag or outcome) or the system (a channel-level
1669
+ * outcome the service set by itself).
1670
+ */
1671
+ export type ConversationObjectiveSource = 'user' | 'model' | 'system'
1672
+
1673
+ /** Where a conversation stands in one of its type's phases. */
1674
+ export type ConversationPhaseStatus = 'done' | 'current' | 'upcoming' | 'untracked'
1675
+
1676
+ /**
1677
+ * One objective definition's standing on one conversation: open or achieved,
1678
+ * by whom, when, and on which tag. Resolved live for the per-conversation
1679
+ * read (ConversationObjectiveProgress) AND persisted as the ledger row of
1680
+ * the same shape — one row per APPLICABLE definition, open rows included,
1681
+ * rewritten at every change point. Never user-written.
1682
+ */
1683
+ export interface ConversationObjective {
1684
+ org_id: string
1685
+ conversation_id: string
1686
+ definition_key: string
1687
+ /** The conversation's channel, denormalized at resolution time. */
1688
+ channel: Channel
1689
+ /** The conversation's type, denormalized at resolution time. */
1690
+ type_key?: string
1691
+ /** The definition's phase, denormalized at resolution time. */
1692
+ phase_key?: string
1693
+ status: ConversationObjectiveStatus
1694
+ /** Who achieved it; absent while open. */
1695
+ source?: ConversationObjectiveSource
1696
+ /**
1697
+ * The backing tag is still `pending` — a realtime detection on a live
1698
+ * spoken conversation the completion pass has not confirmed. Never true for
1699
+ * a user or system source.
1700
+ */
1701
+ is_provisional: boolean
1702
+ achieved_at?: string
1703
+ /**
1704
+ * The tag that achieved a tag-measured objective (the one to delete to
1705
+ * untick when `source` is user); absent for outcome measures.
1706
+ */
1707
+ tag_id?: string
1708
+ /** The conversation's status at resolution time — an open objective on an ended conversation was missed. */
1709
+ is_conversation_ended: boolean
1710
+ /** When this standing was resolved (the ledger write). */
1711
+ recorded_at: string
1712
+ }
1713
+
1714
+ /**
1715
+ * One row of `conversationObjectives.counts`: the grouped columns that were
1716
+ * requested plus the count.
1717
+ */
1718
+ export interface ConversationObjectiveCount {
1719
+ definition_key?: string
1720
+ status?: ConversationObjectiveStatus
1721
+ source?: ConversationObjectiveSource
1722
+ is_provisional?: boolean
1723
+ type_key?: string
1724
+ phase_key?: string
1725
+ channel?: Channel
1726
+ count: number
1727
+ }
1728
+
1729
+ /**
1730
+ * One of the type's phases as the conversation stands in it, derived from
1731
+ * the objectives pinned to the phase: `done` = every measured objective
1732
+ * achieved (≥ 1 measured; provisional counts); `current` = the first phase
1733
+ * in type order that is not done and has a measured objective; `upcoming` =
1734
+ * after the current one; `untracked` = no measured objective, so progress
1735
+ * cannot be told (dim, never current). `completed_at` is the latest
1736
+ * `achieved_at` among the phase's measured objectives once done.
1737
+ */
1738
+ export interface ConversationPhaseProgress extends ConversationPhase {
1739
+ status: ConversationPhaseStatus
1740
+ completed_at?: string
1741
+ }
1742
+
1743
+ /**
1744
+ * `conversations.getObjectiveProgress`: where the conversation stands — the
1745
+ * current phase key (`''` when the type has no phases or every tracked phase
1746
+ * is done), every phase with its status, every applicable objective with its
1747
+ * standing, and the applicable definitions the objectives reference by
1748
+ * `definition_key` (join `objectives[].definition_key` → `definitions[].key`
1749
+ * for name / description / measure). Objectives are ordered: ungrouped first,
1750
+ * then by the type's phase order, then name.
1751
+ */
1752
+ export interface ConversationObjectiveProgress {
1753
+ phase_key: string
1754
+ phases: ConversationPhaseProgress[]
1755
+ objectives: ConversationObjective[]
1756
+ definitions: ConversationObjectiveDefinition[]
1757
+ }
1758
+
1759
+ /** The org-wide ledger read (`conversationObjectives.list`); `since`/`until` bound `recorded_at`. */
1760
+ export interface GetManyConversationObjectivesQuery extends PaginationQuery {
1761
+ conversation_id?: string
1762
+ definition_key?: string
1763
+ type_key?: string
1764
+ phase_key?: string
1765
+ channel?: string
1766
+ status?: string
1767
+ source?: string
1768
+ is_provisional?: boolean
1769
+ is_conversation_ended?: boolean
1770
+ /** Lower bound on `recorded_at` (inclusive), RFC 3339. */
1771
+ since?: string
1772
+ /** Upper bound on `recorded_at` (exclusive), RFC 3339. */
1773
+ until?: string
1774
+ }
1775
+
1776
+ /**
1777
+ * Groups the ledger for dashboards. `group_by` is a COMMA-JOINED string (not
1778
+ * an array — the query serializer repeats array keys) whitelisted to
1779
+ * definition_key, status, source, is_provisional, type_key, phase_key,
1780
+ * channel (order kept; default `definition_key,status`).
1781
+ */
1782
+ export interface CountConversationObjectivesQuery {
1783
+ group_by?: string
1784
+ definition_key?: string
1785
+ type_key?: string
1786
+ phase_key?: string
1787
+ channel?: string
1788
+ status?: string
1789
+ source?: string
1790
+ is_provisional?: boolean
1791
+ is_conversation_ended?: boolean
1792
+ /** Lower bound on `recorded_at` (inclusive), RFC 3339. */
1793
+ since?: string
1794
+ /** Upper bound on `recorded_at` (exclusive), RFC 3339. */
1795
+ until?: string
1796
+ }
1797
+
1798
+ export interface CountConversationObjectivesResponse {
1799
+ data: ConversationObjectiveCount[]
1800
+ }
1801
+
1351
1802
  /**
1352
1803
  * The manual door (`conversationTags.create`): a person tags a conversation,
1353
1804
  * a message or a span. Anchors follow the definition's scope (conversation:
@@ -1649,6 +2100,11 @@ export interface ListConversationsQuery extends PaginationQuery {
1649
2100
  channel?: string
1650
2101
  status?: string
1651
2102
  connection_id?: string
2103
+ type_key?: string
2104
+ /** The meeting conversations born from one calendar event UID. */
2105
+ calendar_event_ical_uid?: string
2106
+ /** How conversations ended (one of a type's outcome keys). */
2107
+ outcome_key?: string
1652
2108
  /**
1653
2109
  * Conversations of one room (Slack channel) — the room stream. A
1654
2110
  * present-but-EMPTY string is meaningful: it filters to the room-LESS
@@ -1691,6 +2147,15 @@ export interface UpdateConversationRequest {
1691
2147
  summary?: string
1692
2148
  status?: ConversationStatus
1693
2149
  metadata?: Record<string, unknown>
2150
+ /** Set the type by hand (must exist; `''` clears). Leaves the outcome alone. */
2151
+ type_key?: string
2152
+ /**
2153
+ * How the conversation ended — one of `conversations.listOutcomes(id)`
2154
+ * (its type's outcomes or its channel's system outcomes; `''` clears). The
2155
+ * person's choice: never overridden by the model or the service. 400
2156
+ * `conversation_outcome_unknown` when the key is in neither list.
2157
+ */
2158
+ outcome_key?: string
1694
2159
  }
1695
2160
 
1696
2161
  export interface ListMessagesQuery extends PaginationQuery {
@@ -2417,6 +2882,68 @@ export interface DispatchMeetingBotRequest {
2417
2882
  * transcription provider is deepgram_streaming.
2418
2883
  */
2419
2884
  language?: string
2885
+ /**
2886
+ * The calendar meeting instance the bot is sent for — `calendar_event_ical_uid`
2887
+ * with `start_at` (the instance start, ISO) link the meeting conversation and
2888
+ * its bot to the calendar so the event's surface can follow them.
2889
+ */
2890
+ calendar_event_ical_uid?: string
2891
+ start_at?: string
2892
+ }
2893
+
2894
+ /**
2895
+ * Lifecycle of an Ava bot: `scheduled` (sent, not yet in the call) → `joining`
2896
+ * → `recording` → `ended` | `failed`, or `removed` (a person withdrew Ava —
2897
+ * terminal; a removed meeting is not scheduled again).
2898
+ */
2899
+ export type MeetingBotStatus =
2900
+ | 'scheduled'
2901
+ | 'joining'
2902
+ | 'recording'
2903
+ | 'ended'
2904
+ | 'failed'
2905
+ | 'removed'
2906
+
2907
+ /**
2908
+ * The platform's memory of one Ava bot — "Ava joins this meeting", whoever's
2909
+ * calendar scheduled her. One bot per meeting instance per org when bot
2910
+ * deduplication is on; several rows can share an instance when it is off.
2911
+ */
2912
+ export interface MeetingBot {
2913
+ id: string
2914
+ org_id: string
2915
+ /** The connection (calendar / adhoc) that scheduled the bot. */
2916
+ connection_id: string
2917
+ /** The provider's bot id; the meeting conversation's external id once begun. */
2918
+ external_bot_id: string
2919
+ /** The provider calendar-event id the bot was scheduled on; absent for adhoc. */
2920
+ provider_event_id?: string
2921
+ calendar_event_ical_uid?: string
2922
+ start_at?: string
2923
+ meeting_url?: string
2924
+ title?: string
2925
+ status: MeetingBotStatus
2926
+ /**
2927
+ * Platform users among the invitees: they see the bot — and may withdraw
2928
+ * Ava from their meeting — without owning the connection that scheduled her.
2929
+ */
2930
+ invitee_user_ids: string[]
2931
+ /** The meeting conversation; absent until the bot starts the meeting. */
2932
+ conversation_id?: string
2933
+ created_at: string
2934
+ created_by: UserRef
2935
+ updated_at: string
2936
+ updated_by: UserRef
2937
+ }
2938
+
2939
+ export interface ListMeetingBotsQuery extends PaginationQuery {
2940
+ /** Meetings starting at/after this ISO instant. */
2941
+ start_after?: string
2942
+ /** Meetings starting before this ISO instant. */
2943
+ start_before?: string
2944
+ /** One calendar meeting (pair with the window to name an instance). */
2945
+ calendar_event_ical_uid?: string
2946
+ status?: MeetingBotStatus
2420
2947
  }
2421
2948
 
2422
2949
  // ── Sending rules ─────────────────────────────────────────────────────────────
@@ -2527,13 +3054,28 @@ export interface ConversationBrief {
2527
3054
  org_id: string
2528
3055
  /** Human label ("Renewal call with Dana"); may be empty. */
2529
3056
  subject: string
2530
- /** The people the conversation is with (≥ 1, deduplicated, sorted). */
3057
+ /** The people the conversation is with (deduplicated, sorted; may be empty — a phone brief has ≥ 1). */
2531
3058
  contact_ids: string[]
2532
3059
  /** How the conversation should happen (phone opens the softphone); absent = unspecified. */
2533
3060
  channel?: Channel
2534
3061
  /** ConversationType key the conversation is meant to be; stamped on attach. */
2535
3062
  type_key?: string
2536
- /** The conversation the brief was used on; absent until used. */
3063
+ /**
3064
+ * The calendar event (one person's copy) the brief prepares; attached to
3065
+ * the meeting's conversation when the meeting bot starts. Absent = no meeting.
3066
+ */
3067
+ calendar_event_id?: string
3068
+ /** The brief is every invitee's, not only the event owner's. */
3069
+ is_shared_with_participants: boolean
3070
+ /** The meeting instance the event belongs to (resolved from the event; read-only). */
3071
+ calendar_event_ical_uid?: string
3072
+ calendar_event_start_at?: string
3073
+ /**
3074
+ * The platform users the brief is for (the event owner; every resolved
3075
+ * invitee when shared) — they read it next to its creator. Read-only.
3076
+ */
3077
+ invitee_user_ids: string[]
3078
+ /** The conversation the brief was used on; absent until used. A conversation may carry several briefs. */
2537
3079
  conversation_id?: string
2538
3080
  status: ConversationBriefStatus
2539
3081
  /** Guidance text (markdown allowed). */
@@ -2547,13 +3089,17 @@ export interface ConversationBrief {
2547
3089
 
2548
3090
  export interface CreateConversationBriefRequest {
2549
3091
  subject?: string
2550
- /** The people the conversation is with (≥ 1). */
2551
- contact_ids: string[]
3092
+ /** The people the conversation is with (may be empty). */
3093
+ contact_ids?: string[]
2552
3094
  /** Must be a known channel when set. */
2553
3095
  channel?: Channel
2554
3096
  /** Must name an existing conversation type when set. */
2555
3097
  type_key?: string
2556
3098
  content: string
3099
+ /** The caller's view of a calendar event the brief prepares (the caller must be able to read it). */
3100
+ calendar_event_id?: string
3101
+ /** Every invitee's brief instead of only the event owner's (requires calendar_event_id). */
3102
+ is_shared_with_participants?: boolean
2557
3103
  }
2558
3104
 
2559
3105
  /** PATCH semantics — absent fields keep their value. Only open briefs. */
@@ -2565,6 +3111,9 @@ export interface UpdateConversationBriefRequest {
2565
3111
  channel?: Channel | ''
2566
3112
  content?: string
2567
3113
  type_key?: string
3114
+ /** Re-ties the brief; empty string unties it (and drops the sharing). */
3115
+ calendar_event_id?: string
3116
+ is_shared_with_participants?: boolean
2568
3117
  }
2569
3118
 
2570
3119
  /** Binds an open brief to a conversation explicitly. */
@@ -2576,6 +3125,14 @@ export interface ListConversationBriefsQuery extends PaginationQuery {
2576
3125
  /** Briefs naming this person. */
2577
3126
  contact_id?: string
2578
3127
  conversation_id?: string
3128
+ /** The briefs for one person's copy of a calendar event. */
3129
+ calendar_event_id?: string
3130
+ /** Every visible brief of a meeting, across invitees' copies (+ start to pin one instance). */
3131
+ calendar_event_ical_uid?: string
3132
+ calendar_event_start_at?: string
3133
+ /** The briefs of the meetings starting in [after, before) — a calendar's visible range. */
3134
+ calendar_event_start_after?: string
3135
+ calendar_event_start_before?: string
2579
3136
  channel?: Channel
2580
3137
  type_key?: string
2581
3138
  status?: ConversationBriefStatus
@@ -3059,3 +3616,35 @@ export interface ListChannelActionsQuery extends PaginationQuery {
3059
3616
  status?: ChannelActionStatus
3060
3617
  contact_id?: string
3061
3618
  }
3619
+
3620
+ /**
3621
+ * What a PERSON recorded about a conversation — during a call, after a
3622
+ * meeting, while reading a thread. An append log, author-stamped, never
3623
+ * merged. Notes feed the summary (what the human found important) and the
3624
+ * summary-basis tag evaluations. As visible as the conversation; only the
3625
+ * author edits or deletes.
3626
+ */
3627
+ export interface ConversationNote {
3628
+ id: string
3629
+ org_id: string
3630
+ conversation_id: string
3631
+ /** Markdown allowed. */
3632
+ content: string
3633
+ created_at: string
3634
+ created_by: UserRef
3635
+ updated_at: string
3636
+ updated_by: UserRef
3637
+ }
3638
+
3639
+ export interface CreateConversationNoteRequest {
3640
+ content: string
3641
+ }
3642
+
3643
+ export interface UpdateConversationNoteRequest {
3644
+ content: string
3645
+ }
3646
+
3647
+ export interface ListConversationNotesQuery extends PaginationQuery {
3648
+ sort_by?: string
3649
+ sort?: 'asc' | 'desc'
3650
+ }