@proteos/sdk 0.40.0 → 0.41.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteos/sdk",
3
- "version": "0.40.0",
3
+ "version": "0.41.1",
4
4
  "license": "Apache-2.0",
5
5
  "description": "TypeScript SDK for the Proteos platform",
6
6
  "repository": {
@@ -8,6 +8,7 @@ import type {
8
8
  Contact,
9
9
  ContactAddress,
10
10
  ContactErasureRequest,
11
+ ContactGroup,
11
12
  ContactMergeProposal,
12
13
  Conversation,
13
14
  ConversationFilter,
@@ -15,9 +16,11 @@ import type {
15
16
  ConversationType,
16
17
  CreateAgentListenerRequest,
17
18
  CreateConnectionRequest,
19
+ CreateContactGroupRequest,
18
20
  CreateConversationFilterRequest,
19
21
  CreateConversationTypeRequest,
20
22
  CreateGlossaryTermRequest,
23
+ CreateToneProfileSetupRequest,
21
24
  CreateTranscriptionRequest,
22
25
  DeleteConnectionQuery,
23
26
  DispatchMeetingBotRequest,
@@ -26,6 +29,7 @@ import type {
26
29
  ListAgentListenersQuery,
27
30
  ListConnectionsQuery,
28
31
  ListContactAddressesQuery,
32
+ ListContactGroupsQuery,
29
33
  ListContactMergeProposalsQuery,
30
34
  ListContactsQuery,
31
35
  ListConversationFilterEventsQuery,
@@ -38,6 +42,8 @@ import type {
38
42
  ListReactionsResponse,
39
43
  ListResponse,
40
44
  ListRoomsQuery,
45
+ ListToneProfileSetupsQuery,
46
+ ListToneProfilesQuery,
41
47
  ListTranscriptionsQuery,
42
48
  MaterializeTranscriptionRequest,
43
49
  MergeContactsRequest,
@@ -45,13 +51,17 @@ import type {
45
51
  MistranscribedTerm,
46
52
  Reaction,
47
53
  RecordPermissionEventRequest,
54
+ ResolveToneProfileQuery,
48
55
  Room,
49
56
  SendMessageRequest,
50
57
  SyncConnectionRequest,
58
+ ToneProfile,
59
+ ToneProfileSetup,
51
60
  Transcription,
52
61
  UnreadCounts,
53
62
  UpdateAgentListenerRequest,
54
63
  UpdateConnectionRequest,
64
+ UpdateContactGroupRequest,
55
65
  UpdateContactRequest,
56
66
  UpdateConversationFilterRequest,
57
67
  UpdateConversationRequest,
@@ -87,6 +97,10 @@ export class ConversationClient {
87
97
  readonly glossaryTerms: GlossaryTermService
88
98
  /** Conversation taxonomy: the types the pre-summary classifier assigns. */
89
99
  readonly conversationTypes: ConversationTypeService
100
+ /** Generic audience taxonomy; membership lives on the contact. */
101
+ readonly contactGroups: ContactGroupService
102
+ /** Tone-of-voice synthesis: per-user setups + the generated profiles. */
103
+ readonly toneProfiles: ToneProfileService
90
104
  readonly transcriptions: TranscriptionService
91
105
  /** Review-pass findings: likely misheard terms awaiting accept/reject. */
92
106
  readonly mistranscribedTerms: MistranscribedTermService
@@ -104,6 +118,8 @@ export class ConversationClient {
104
118
  this.conversationFilters = new ConversationFilterServiceImpl(client)
105
119
  this.glossaryTerms = new GlossaryTermServiceImpl(client)
106
120
  this.conversationTypes = new ConversationTypeServiceImpl(client)
121
+ this.contactGroups = new ContactGroupServiceImpl(client)
122
+ this.toneProfiles = new ToneProfileServiceImpl(client)
107
123
  this.transcriptions = new TranscriptionServiceImpl(client)
108
124
  this.mistranscribedTerms = new MistranscribedTermServiceImpl(client)
109
125
  this.meetings = new MeetingServiceImpl(client)
@@ -802,6 +818,136 @@ class ConversationTypeServiceImpl implements ConversationTypeService {
802
818
  }
803
819
  }
804
820
 
821
+ /**
822
+ * Contact groups: the generic org-shared audience taxonomy. Membership lives
823
+ * on the contact (`Contact.group_key`, one group per contact — assign via
824
+ * `contacts.update`); tone-of-voice synthesis reads the groups and
825
+ * auto-assigns ungrouped correspondents. Keyed by `key` (not id); `upsert` is
826
+ * the idempotent module-deploy door. Deleting a group clears its members'
827
+ * membership and purges its tone profile rows.
828
+ */
829
+ export interface ContactGroupService {
830
+ list(query?: ListContactGroupsQuery): Promise<ListResponse<ContactGroup>>
831
+ get(key: string): Promise<ContactGroup>
832
+ create(request: CreateContactGroupRequest): Promise<ContactGroup>
833
+ update(key: string, request: UpdateContactGroupRequest): Promise<ContactGroup>
834
+ /** Idempotent create-or-update by key (PUT) — what `pro module deploy` calls. */
835
+ upsert(key: string, request: CreateContactGroupRequest): Promise<ContactGroup>
836
+ delete(key: string): Promise<void>
837
+ }
838
+
839
+ class ContactGroupServiceImpl implements ContactGroupService {
840
+ constructor(private readonly client: ProteosClient) {}
841
+
842
+ list(query: ListContactGroupsQuery = {}): Promise<ListResponse<ContactGroup>> {
843
+ return this.client.requestWithQuery('GET', `${CONVERSATION_BASE_PATH}/contact-groups`, query)
844
+ }
845
+
846
+ get(key: string): Promise<ContactGroup> {
847
+ return this.client.request(
848
+ 'GET',
849
+ `${CONVERSATION_BASE_PATH}/contact-groups/${encodeURIComponent(key)}`,
850
+ )
851
+ }
852
+
853
+ create(request: CreateContactGroupRequest): Promise<ContactGroup> {
854
+ return this.client.request('POST', `${CONVERSATION_BASE_PATH}/contact-groups`, request)
855
+ }
856
+
857
+ update(key: string, request: UpdateContactGroupRequest): Promise<ContactGroup> {
858
+ return this.client.request(
859
+ 'PATCH',
860
+ `${CONVERSATION_BASE_PATH}/contact-groups/${encodeURIComponent(key)}`,
861
+ request,
862
+ )
863
+ }
864
+
865
+ upsert(key: string, request: CreateContactGroupRequest): Promise<ContactGroup> {
866
+ return this.client.request(
867
+ 'PUT',
868
+ `${CONVERSATION_BASE_PATH}/contact-groups/${encodeURIComponent(key)}`,
869
+ { ...request, key },
870
+ )
871
+ }
872
+
873
+ async delete(key: string): Promise<void> {
874
+ await this.client.request(
875
+ 'DELETE',
876
+ `${CONVERSATION_BASE_PATH}/contact-groups/${encodeURIComponent(key)}`,
877
+ )
878
+ }
879
+ }
880
+
881
+ /**
882
+ * Tone-of-voice synthesis. A setup opts one platform user in (only set-up
883
+ * users are swept); `synthesize` triggers a whole-user run immediately (202;
884
+ * 409 `synthesis_in_progress` while one is live). Generated profiles form a
885
+ * specificity hierarchy — fetch a user's rows with `listProfiles`, or let the
886
+ * server pick the single most-specific row for a drafting context with
887
+ * `resolve` (each row is self-contained; never concatenate tiers).
888
+ */
889
+ export interface ToneProfileService {
890
+ listSetups(query?: ListToneProfileSetupsQuery): Promise<ListResponse<ToneProfileSetup>>
891
+ createSetup(request: CreateToneProfileSetupRequest): Promise<ToneProfileSetup>
892
+ /** Removes the setup AND the user's generated profiles. */
893
+ deleteSetup(id: string): Promise<void>
894
+ /** Kicks a whole-user synthesis run off-request (bypasses cadence checks). */
895
+ synthesize(setupId: string): Promise<void>
896
+ listProfiles(query?: ListToneProfilesQuery): Promise<ListResponse<ToneProfile>>
897
+ getProfile(id: string): Promise<ToneProfile>
898
+ /** The single most-specific profile for a drafting context; 404 when none. */
899
+ resolve(query: ResolveToneProfileQuery): Promise<ToneProfile>
900
+ }
901
+
902
+ class ToneProfileServiceImpl implements ToneProfileService {
903
+ constructor(private readonly client: ProteosClient) {}
904
+
905
+ listSetups(query: ListToneProfileSetupsQuery = {}): Promise<ListResponse<ToneProfileSetup>> {
906
+ return this.client.requestWithQuery(
907
+ 'GET',
908
+ `${CONVERSATION_BASE_PATH}/tone-profile-setups`,
909
+ query,
910
+ )
911
+ }
912
+
913
+ createSetup(request: CreateToneProfileSetupRequest): Promise<ToneProfileSetup> {
914
+ return this.client.request('POST', `${CONVERSATION_BASE_PATH}/tone-profile-setups`, request)
915
+ }
916
+
917
+ async deleteSetup(id: string): Promise<void> {
918
+ await this.client.request(
919
+ 'DELETE',
920
+ `${CONVERSATION_BASE_PATH}/tone-profile-setups/${encodeURIComponent(id)}`,
921
+ )
922
+ }
923
+
924
+ async synthesize(setupId: string): Promise<void> {
925
+ await this.client.request(
926
+ 'POST',
927
+ `${CONVERSATION_BASE_PATH}/tone-profile-setups/${encodeURIComponent(setupId)}/synthesize`,
928
+ )
929
+ }
930
+
931
+ listProfiles(query: ListToneProfilesQuery = {}): Promise<ListResponse<ToneProfile>> {
932
+ return this.client.requestWithQuery('GET', `${CONVERSATION_BASE_PATH}/tone-profiles`, query)
933
+ }
934
+
935
+ getProfile(id: string): Promise<ToneProfile> {
936
+ return this.client.request(
937
+ 'GET',
938
+ `${CONVERSATION_BASE_PATH}/tone-profiles/${encodeURIComponent(id)}`,
939
+ )
940
+ }
941
+
942
+ resolve(query: ResolveToneProfileQuery): Promise<ToneProfile> {
943
+ return this.client.requestWithQuery(
944
+ 'GET',
945
+ `${CONVERSATION_BASE_PATH}/tone-profiles/resolve`,
946
+ query,
947
+ )
948
+ }
949
+ }
950
+
805
951
  /** Batch transcription of stored audio files + materialization. */
806
952
  export interface TranscriptionService {
807
953
  /**
@@ -716,6 +716,131 @@ export interface ListConversationTypesQuery extends PaginationQuery {
716
716
  module_slug?: string
717
717
  }
718
718
 
719
+ /** Who assigned a contact's group membership. */
720
+ export type ContactGroupSource = 'manual' | 'model'
721
+
722
+ /**
723
+ * A generic org-shared audience taxonomy entry ("external-client",
724
+ * "internal-colleague", …) — NOT tone-specific. Membership lives on the
725
+ * contact (`Contact.group_key`, one group per contact) and is assignable by
726
+ * any flow; tone-of-voice synthesis both reads and auto-assigns groups.
727
+ * Module-deployable (contact-groups/<key>.json).
728
+ */
729
+ export interface ContactGroup {
730
+ org_id: string
731
+ /** Immutable identity within the org — what models answer with. */
732
+ key: string
733
+ name: string
734
+ /** Who belongs in the group — injected verbatim into the synthesis prompt. */
735
+ description?: string
736
+ /** True when tone synthesis proposed the group. Server-owned. */
737
+ is_auto_created: boolean
738
+ /** Module that deployed the group; absent when not module-owned. */
739
+ module_slug?: string
740
+ created_at: string
741
+ created_by: UserRef
742
+ updated_at: string
743
+ updated_by: UserRef
744
+ }
745
+
746
+ export interface CreateContactGroupRequest {
747
+ /** Lowercase kebab/snake/camel handle — no spaces. */
748
+ key: string
749
+ name: string
750
+ description?: string
751
+ module_slug?: string
752
+ }
753
+
754
+ export interface UpdateContactGroupRequest {
755
+ name?: string
756
+ description?: string
757
+ }
758
+
759
+ export interface ListContactGroupsQuery extends PaginationQuery {
760
+ /** Case-insensitive substring match on key or name. */
761
+ search?: string
762
+ module_slug?: string
763
+ }
764
+
765
+ /** The whole-user synthesis lifecycle on a tone profile setup. */
766
+ export type ToneProfileSetupStatus = 'empty' | 'processing' | 'ready'
767
+
768
+ /** A tone profile row's tier — derived, most specific wins at read time. */
769
+ export type ToneProfileScope = 'user' | 'channel' | 'group' | 'contact'
770
+
771
+ /**
772
+ * The per-user opt-in for tone-of-voice synthesis: only set-up users are
773
+ * swept. Also carries the whole-user synthesis claim (status/started_at).
774
+ */
775
+ export interface ToneProfileSetup {
776
+ id: string
777
+ org_id: string
778
+ /** The profiled platform user. */
779
+ owned_by: UserRef
780
+ status: ToneProfileSetupStatus
781
+ started_at?: string
782
+ last_synthesized_at?: string
783
+ created_at: string
784
+ created_by: UserRef
785
+ updated_at: string
786
+ updated_by: UserRef
787
+ }
788
+
789
+ /**
790
+ * One generated tone-of-voice instruction row. Rows form a specificity
791
+ * hierarchy — user aggregate (the constant voice), per-channel base, per
792
+ * contact-group, per individual contact — and every row is SELF-CONTAINED: a
793
+ * drafting consumer injects exactly one row's `instructions` verbatim (use
794
+ * the resolve endpoint), never a concatenation of tiers.
795
+ */
796
+ export interface ToneProfile {
797
+ id: string
798
+ org_id: string
799
+ /** The profiled platform user. */
800
+ owned_by: UserRef
801
+ /** Absent = the cross-channel user aggregate (the voice proper). */
802
+ channel?: Channel
803
+ /** Scopes the row to one contact group; absent = the (user, channel) base. */
804
+ contact_group_key?: string
805
+ /** Scopes the row to one individual contact within the group. */
806
+ contact_id?: string
807
+ scope: ToneProfileScope
808
+ /** COMPLETE markdown instruction set, served verbatim to a drafting model. */
809
+ instructions: string
810
+ /** Short delta vs the tier above — what a human scans; empty on root tiers. */
811
+ differences?: string
812
+ sample_count: number
813
+ last_message_at?: string
814
+ last_synthesized_at?: string
815
+ created_at: string
816
+ created_by: UserRef
817
+ updated_at: string
818
+ updated_by: UserRef
819
+ }
820
+
821
+ export interface CreateToneProfileSetupRequest {
822
+ /** Bare platform user id; the service resolves the full ref. */
823
+ owned_by_id: string
824
+ }
825
+
826
+ export type ListToneProfileSetupsQuery = PaginationQuery
827
+
828
+ export interface ListToneProfilesQuery extends PaginationQuery {
829
+ owned_by_id?: string
830
+ channel?: Channel
831
+ scope?: ToneProfileScope
832
+ }
833
+
834
+ /**
835
+ * A drafting context to resolve the single most-specific profile for:
836
+ * contact → group → channel base → user aggregate.
837
+ */
838
+ export interface ResolveToneProfileQuery {
839
+ owned_by_id: string
840
+ channel?: Channel
841
+ contact_id?: string
842
+ }
843
+
719
844
  export interface PaginationQuery {
720
845
  page?: number
721
846
  page_size?: number
@@ -993,6 +1118,13 @@ export interface Contact {
993
1118
  /** Merge tombstone redirect (set when status is 'merged'). */
994
1119
  merged_into_contact_id?: string
995
1120
  source: ContactSource
1121
+ /** ContactGroup membership (one group per contact); absent = unassigned. */
1122
+ group_key?: string
1123
+ /**
1124
+ * Who assigned the group: 'manual' assignments are authoritative (tone
1125
+ * synthesis never overrides them), 'model' ones may be reassigned by a run.
1126
+ */
1127
+ group_source?: ContactGroupSource
996
1128
  has_manual_edits: boolean
997
1129
  /** The contact's reachable endpoints, embedded on reads. */
998
1130
  addresses?: ContactAddress[]
@@ -1105,12 +1237,19 @@ export interface ListContactsQuery extends PaginationQuery {
1105
1237
  /** Free-text needle matched against contact name + address values. */
1106
1238
  q?: string
1107
1239
  status?: ContactStatus
1240
+ /** Members of one contact group (drives group-member lists). */
1241
+ group_key?: string
1108
1242
  }
1109
1243
 
1110
1244
  export interface UpdateContactRequest {
1111
1245
  name?: string
1112
1246
  status?: 'active' | 'archived'
1113
1247
  has_legal_hold?: boolean
1248
+ /**
1249
+ * Assigns the contact to a contact group ('' clears). A PATCH assignment is
1250
+ * stamped group_source='manual' — tone synthesis never overrides it.
1251
+ */
1252
+ group_key?: string
1114
1253
  }
1115
1254
 
1116
1255
  export interface AttachContactAddressRequest {
package/src/index.ts CHANGED
@@ -221,6 +221,9 @@ export type {
221
221
  ContactAddressKind,
222
222
  ContactAddressSource,
223
223
  ContactErasureRequest,
224
+ ContactGroup,
225
+ ContactGroupService,
226
+ ContactGroupSource,
224
227
  ContactMergeProposal,
225
228
  ContactRef,
226
229
  ContactService,
@@ -244,9 +247,11 @@ export type {
244
247
  ConversationTypeService,
245
248
  CreateAgentListenerRequest,
246
249
  CreateConnectionRequest,
250
+ CreateContactGroupRequest,
247
251
  CreateConversationFilterRequest,
248
252
  CreateConversationTypeRequest,
249
253
  CreateGlossaryTermRequest,
254
+ CreateToneProfileSetupRequest,
250
255
  DispatchMeetingBotRequest,
251
256
  DomainFilterConfig,
252
257
  ErasureRequestStatus,
@@ -258,6 +263,7 @@ export type {
258
263
  ListAgentListenersQuery,
259
264
  ListConnectionsQuery,
260
265
  ListContactAddressesQuery,
266
+ ListContactGroupsQuery,
261
267
  ListContactMergeProposalsQuery,
262
268
  ListContactsQuery,
263
269
  ListConversationFilterEventsQuery,
@@ -271,6 +277,8 @@ export type {
271
277
  // PageIterator-based ListResult used by the other modules.
272
278
  ListResponse,
273
279
  ListRoomsQuery,
280
+ ListToneProfileSetupsQuery,
281
+ ListToneProfilesQuery,
274
282
  MeetingService,
275
283
  MergeContactsRequest,
276
284
  MergeProposalStatus,
@@ -293,11 +301,17 @@ export type {
293
301
  RecipientKind,
294
302
  RecipientRole,
295
303
  RecordPermissionEventRequest,
304
+ ResolveToneProfileQuery,
296
305
  RoleBasedFilterConfig,
297
306
  Room,
298
307
  SendMessageRequest,
299
308
  SendRecipient,
300
309
  SyncConnectionRequest,
310
+ ToneProfile,
311
+ ToneProfileScope,
312
+ ToneProfileService,
313
+ ToneProfileSetup,
314
+ ToneProfileSetupStatus,
301
315
  TranscribeStreamOptions,
302
316
  Transcription,
303
317
  TranscriptionReviewStatus,
@@ -307,6 +321,7 @@ export type {
307
321
  UnreadCounts,
308
322
  UpdateAgentListenerRequest,
309
323
  UpdateConnectionRequest,
324
+ UpdateContactGroupRequest,
310
325
  UpdateContactRequest,
311
326
  UpdateConversationFilterRequest,
312
327
  UpdateConversationTypeRequest,