@proteos/sdk 0.34.0 → 0.35.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteos/sdk",
3
- "version": "0.34.0",
3
+ "version": "0.35.0",
4
4
  "license": "Apache-2.0",
5
5
  "description": "TypeScript SDK for the Proteos platform",
6
6
  "repository": {
@@ -67,6 +67,8 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
67
67
  { slug: 'agent-listeners', name: 'Agent Listeners' },
68
68
  { slug: 'transcriptions', name: 'Transcriptions' },
69
69
  { slug: 'glossary-terms', name: 'Glossary Terms' },
70
+ // Mistranscribed terms proposed by the post-transcription review pass.
71
+ { slug: 'mistranscribed-terms', name: 'Mistranscribed Terms' },
70
72
  // Connectors (connector-service). `connections` above is shared; this is the
71
73
  // manifest catalog.
72
74
  { slug: 'connectors', name: 'Connectors' },
@@ -1,5 +1,6 @@
1
1
  import type { ProteosClient } from '../client.js'
2
2
  import type {
3
+ AcceptMistranscribedTermRequest,
3
4
  AgentListener,
4
5
  AttachContactAddressRequest,
5
6
  BlockContactRequest,
@@ -11,9 +12,11 @@ import type {
11
12
  Conversation,
12
13
  ConversationFilter,
13
14
  ConversationFilterEvent,
15
+ ConversationType,
14
16
  CreateAgentListenerRequest,
15
17
  CreateConnectionRequest,
16
18
  CreateConversationFilterRequest,
19
+ CreateConversationTypeRequest,
17
20
  CreateGlossaryTermRequest,
18
21
  CreateTranscriptionRequest,
19
22
  DispatchMeetingBotRequest,
@@ -27,8 +30,10 @@ import type {
27
30
  ListConversationFilterEventsQuery,
28
31
  ListConversationFiltersQuery,
29
32
  ListConversationsQuery,
33
+ ListConversationTypesQuery,
30
34
  ListGlossaryTermsQuery,
31
35
  ListMessagesQuery,
36
+ ListMistranscribedTermsQuery,
32
37
  ListReactionsResponse,
33
38
  ListResponse,
34
39
  ListRoomsQuery,
@@ -36,6 +41,7 @@ import type {
36
41
  MaterializeTranscriptionRequest,
37
42
  MergeContactsRequest,
38
43
  Message,
44
+ MistranscribedTerm,
39
45
  Reaction,
40
46
  RecordPermissionEventRequest,
41
47
  Room,
@@ -48,8 +54,10 @@ import type {
48
54
  UpdateContactRequest,
49
55
  UpdateConversationFilterRequest,
50
56
  UpdateConversationRequest,
57
+ UpdateConversationTypeRequest,
51
58
  UpdateDraftRequest,
52
59
  UpdateGlossaryTermRequest,
60
+ UpdateTranscriptionRequest,
53
61
  } from './types.js'
54
62
  import { type VoiceService, VoiceServiceImpl } from './voice.js'
55
63
 
@@ -76,7 +84,11 @@ export class ConversationClient {
76
84
  readonly conversationFilters: ConversationFilterService
77
85
  /** Per-org glossary: custom vocabulary that boosts transcription accuracy. */
78
86
  readonly glossaryTerms: GlossaryTermService
87
+ /** Conversation taxonomy: the types the pre-summary classifier assigns. */
88
+ readonly conversationTypes: ConversationTypeService
79
89
  readonly transcriptions: TranscriptionService
90
+ /** Review-pass findings: likely misheard terms awaiting accept/reject. */
91
+ readonly mistranscribedTerms: MistranscribedTermService
80
92
  /** Meeting bots (Ava): dispatch into a meeting URL, remove from a meeting. */
81
93
  readonly meetings: MeetingService
82
94
  /** Realtime speech-to-text (dictation) — moved here from agent-service. */
@@ -90,7 +102,9 @@ export class ConversationClient {
90
102
  this.agentListeners = new AgentListenerServiceImpl(client)
91
103
  this.conversationFilters = new ConversationFilterServiceImpl(client)
92
104
  this.glossaryTerms = new GlossaryTermServiceImpl(client)
105
+ this.conversationTypes = new ConversationTypeServiceImpl(client)
93
106
  this.transcriptions = new TranscriptionServiceImpl(client)
107
+ this.mistranscribedTerms = new MistranscribedTermServiceImpl(client)
94
108
  this.meetings = new MeetingServiceImpl(client)
95
109
  this.voice = new VoiceServiceImpl(client)
96
110
  }
@@ -703,6 +717,70 @@ class GlossaryTermServiceImpl implements GlossaryTermService {
703
717
  }
704
718
  }
705
719
 
720
+ /**
721
+ * The org's conversation taxonomy. Before a meeting summary is generated, a
722
+ * cheap classifier reads the transcript head plus every type's `definition`
723
+ * and picks the matching `key` — the result lands on `Conversation.type_key`,
724
+ * and a type whose `config.summary_prompt_key` names an agent-service prompt
725
+ * swaps the summary system prompt for that prompt's current body. Keyed by
726
+ * `key` (not id); `upsert` is the idempotent module-deploy door.
727
+ */
728
+ export interface ConversationTypeService {
729
+ list(query?: ListConversationTypesQuery): Promise<ListResponse<ConversationType>>
730
+ get(key: string): Promise<ConversationType>
731
+ create(request: CreateConversationTypeRequest): Promise<ConversationType>
732
+ update(key: string, request: UpdateConversationTypeRequest): Promise<ConversationType>
733
+ /** Idempotent create-or-update by key (PUT) — what `pro module deploy` calls. */
734
+ upsert(key: string, request: CreateConversationTypeRequest): Promise<ConversationType>
735
+ delete(key: string): Promise<void>
736
+ }
737
+
738
+ class ConversationTypeServiceImpl implements ConversationTypeService {
739
+ constructor(private readonly client: ProteosClient) {}
740
+
741
+ list(query: ListConversationTypesQuery = {}): Promise<ListResponse<ConversationType>> {
742
+ return this.client.requestWithQuery(
743
+ 'GET',
744
+ `${CONVERSATION_BASE_PATH}/conversation-types`,
745
+ query,
746
+ )
747
+ }
748
+
749
+ get(key: string): Promise<ConversationType> {
750
+ return this.client.request(
751
+ 'GET',
752
+ `${CONVERSATION_BASE_PATH}/conversation-types/${encodeURIComponent(key)}`,
753
+ )
754
+ }
755
+
756
+ create(request: CreateConversationTypeRequest): Promise<ConversationType> {
757
+ return this.client.request('POST', `${CONVERSATION_BASE_PATH}/conversation-types`, request)
758
+ }
759
+
760
+ update(key: string, request: UpdateConversationTypeRequest): Promise<ConversationType> {
761
+ return this.client.request(
762
+ 'PATCH',
763
+ `${CONVERSATION_BASE_PATH}/conversation-types/${encodeURIComponent(key)}`,
764
+ request,
765
+ )
766
+ }
767
+
768
+ upsert(key: string, request: CreateConversationTypeRequest): Promise<ConversationType> {
769
+ return this.client.request(
770
+ 'PUT',
771
+ `${CONVERSATION_BASE_PATH}/conversation-types/${encodeURIComponent(key)}`,
772
+ { ...request, key },
773
+ )
774
+ }
775
+
776
+ async delete(key: string): Promise<void> {
777
+ await this.client.request(
778
+ 'DELETE',
779
+ `${CONVERSATION_BASE_PATH}/conversation-types/${encodeURIComponent(key)}`,
780
+ )
781
+ }
782
+ }
783
+
706
784
  /** Batch transcription of stored audio files + materialization. */
707
785
  export interface TranscriptionService {
708
786
  /**
@@ -713,6 +791,17 @@ export interface TranscriptionService {
713
791
  createFromFile(request: CreateTranscriptionRequest): Promise<Transcription>
714
792
  list(query?: ListTranscriptionsQuery): Promise<ListResponse<Transcription>>
715
793
  get(id: string): Promise<Transcription>
794
+ /**
795
+ * Edits a completed transcription (turn text, speaker labels, language).
796
+ * Does NOT retro-update messages of an already-materialized conversation.
797
+ */
798
+ update(id: string, request: UpdateTranscriptionRequest): Promise<Transcription>
799
+ /**
800
+ * Kicks off the mistranscription review pass (glossary-aware LLM hunt for
801
+ * misheard terms) — resolves immediately with review_status `processing`;
802
+ * poll `get(id)` until it flips to feedback_pending/completed/failed.
803
+ */
804
+ review(id: string): Promise<Transcription>
716
805
  /** Turns a completed transcription into an adhoc/meeting conversation. */
717
806
  materialize(id: string, request?: MaterializeTranscriptionRequest): Promise<Conversation>
718
807
  }
@@ -735,6 +824,22 @@ class TranscriptionServiceImpl implements TranscriptionService {
735
824
  )
736
825
  }
737
826
 
827
+ update(id: string, request: UpdateTranscriptionRequest): Promise<Transcription> {
828
+ return this.client.request(
829
+ 'PATCH',
830
+ `${CONVERSATION_BASE_PATH}/transcriptions/${encodeURIComponent(id)}`,
831
+ request,
832
+ )
833
+ }
834
+
835
+ review(id: string): Promise<Transcription> {
836
+ return this.client.request(
837
+ 'POST',
838
+ `${CONVERSATION_BASE_PATH}/transcriptions/${encodeURIComponent(id)}/review`,
839
+ {},
840
+ )
841
+ }
842
+
738
843
  materialize(id: string, request: MaterializeTranscriptionRequest = {}): Promise<Conversation> {
739
844
  return this.client.request(
740
845
  'POST',
@@ -744,6 +849,55 @@ class TranscriptionServiceImpl implements TranscriptionService {
744
849
  }
745
850
  }
746
851
 
852
+ /**
853
+ * Findings of the post-transcription review pass: terms likely misheard by the
854
+ * transcription provider, awaiting accept/reject. Accepting applies the
855
+ * replacement to the transcription's turns and (optionally) promotes it into
856
+ * the glossary; resolving the last open finding flips the transcription's
857
+ * review_status to completed.
858
+ */
859
+ export interface MistranscribedTermService {
860
+ list(query?: ListMistranscribedTermsQuery): Promise<ListResponse<MistranscribedTerm>>
861
+ get(id: string): Promise<MistranscribedTerm>
862
+ accept(id: string, request?: AcceptMistranscribedTermRequest): Promise<MistranscribedTerm>
863
+ reject(id: string): Promise<MistranscribedTerm>
864
+ }
865
+
866
+ class MistranscribedTermServiceImpl implements MistranscribedTermService {
867
+ constructor(private readonly client: ProteosClient) {}
868
+
869
+ list(query: ListMistranscribedTermsQuery = {}): Promise<ListResponse<MistranscribedTerm>> {
870
+ return this.client.requestWithQuery(
871
+ 'GET',
872
+ `${CONVERSATION_BASE_PATH}/mistranscribed-terms`,
873
+ query,
874
+ )
875
+ }
876
+
877
+ get(id: string): Promise<MistranscribedTerm> {
878
+ return this.client.request(
879
+ 'GET',
880
+ `${CONVERSATION_BASE_PATH}/mistranscribed-terms/${encodeURIComponent(id)}`,
881
+ )
882
+ }
883
+
884
+ accept(id: string, request: AcceptMistranscribedTermRequest = {}): Promise<MistranscribedTerm> {
885
+ return this.client.request(
886
+ 'POST',
887
+ `${CONVERSATION_BASE_PATH}/mistranscribed-terms/${encodeURIComponent(id)}/accept`,
888
+ request,
889
+ )
890
+ }
891
+
892
+ reject(id: string): Promise<MistranscribedTerm> {
893
+ return this.client.request(
894
+ 'POST',
895
+ `${CONVERSATION_BASE_PATH}/mistranscribed-terms/${encodeURIComponent(id)}/reject`,
896
+ {},
897
+ )
898
+ }
899
+ }
900
+
747
901
  export type * from './types.js'
748
902
  // Re-export voice types (the live dictation stream lives on this service now)
749
903
  export type {
@@ -246,6 +246,11 @@ export interface Conversation {
246
246
  * claim server-side and gives clients an elapsed time to show.
247
247
  */
248
248
  summary_started_at?: string
249
+ /**
250
+ * ConversationType key the pre-summary classifier assigned; absent when never
251
+ * classified or no type matched.
252
+ */
253
+ type_key?: string
249
254
  status: ConversationStatus
250
255
  /**
251
256
  * Room directory row a room-borne thread (Slack channel conversation) lives
@@ -578,6 +583,61 @@ export interface ListGlossaryTermsQuery extends PaginationQuery {
578
583
  search?: string
579
584
  }
580
585
 
586
+ /** Optional per-type behavior configuration. */
587
+ export interface ConversationTypeConfig {
588
+ /**
589
+ * Agent-service prompt key whose CURRENT version body replaces the built-in
590
+ * summary system prompt for conversations classified as this type. Absent ⇒
591
+ * built-in prompt.
592
+ */
593
+ summary_prompt_key?: string
594
+ }
595
+
596
+ /**
597
+ * A per-org conversation taxonomy entry. Before a meeting summary is
598
+ * generated, a cheap classifier reads the transcript head plus every type's
599
+ * `definition` and picks the matching `key` (or none); the result lands on
600
+ * `Conversation.type_key` and `config.summary_prompt_key` may swap the summary
601
+ * system prompt. Module-deployable (conversation-types/<key>.json).
602
+ */
603
+ export interface ConversationType {
604
+ org_id: string
605
+ /** Immutable identity within the org — what the classifier answers with. */
606
+ key: string
607
+ name?: string
608
+ /** When a conversation IS this type — injected verbatim into the classifier prompt. */
609
+ definition: string
610
+ config: ConversationTypeConfig
611
+ /** Module that deployed the type; absent when not module-owned. */
612
+ module_slug?: string
613
+ created_at: string
614
+ created_by: UserRef
615
+ updated_at: string
616
+ updated_by: UserRef
617
+ }
618
+
619
+ export interface CreateConversationTypeRequest {
620
+ /** Lowercase kebab/snake/camel handle — no spaces. */
621
+ key: string
622
+ name?: string
623
+ definition: string
624
+ config?: ConversationTypeConfig
625
+ module_slug?: string
626
+ }
627
+
628
+ export interface UpdateConversationTypeRequest {
629
+ name?: string
630
+ definition?: string
631
+ /** Replaces the stored config wholesale; send `{}` to clear the prompt link. */
632
+ config?: ConversationTypeConfig
633
+ }
634
+
635
+ export interface ListConversationTypesQuery extends PaginationQuery {
636
+ /** Case-insensitive substring match on key or name. */
637
+ search?: string
638
+ module_slug?: string
639
+ }
640
+
581
641
  export interface PaginationQuery {
582
642
  page?: number
583
643
  page_size?: number
@@ -993,6 +1053,18 @@ export interface ListResponse<T> {
993
1053
 
994
1054
  export type TranscriptionStatus = 'pending' | 'processing' | 'completed' | 'failed'
995
1055
 
1056
+ /**
1057
+ * Post-transcription review lifecycle — the glossary-aware LLM pass that hunts
1058
+ * mistranscribed terms. `feedback_pending` means proposed mistranscribed terms
1059
+ * await human resolution; resolving the last one flips it to `completed`.
1060
+ */
1061
+ export type TranscriptionReviewStatus =
1062
+ | 'open'
1063
+ | 'processing'
1064
+ | 'feedback_pending'
1065
+ | 'completed'
1066
+ | 'failed'
1067
+
996
1068
  export interface TranscriptTurn {
997
1069
  speaker: number
998
1070
  speaker_label: string
@@ -1009,6 +1081,8 @@ export interface Transcription {
1009
1081
  audio_file_id: string
1010
1082
  transcript_file_id: string
1011
1083
  status: TranscriptionStatus
1084
+ review_status: TranscriptionReviewStatus
1085
+ review_started_at?: string
1012
1086
  language: string
1013
1087
  duration_seconds: number
1014
1088
  model: string
@@ -1031,6 +1105,18 @@ export interface CreateTranscriptionRequest {
1031
1105
  is_diarized?: boolean
1032
1106
  }
1033
1107
 
1108
+ /**
1109
+ * Edits a COMPLETED transcription in place. `turns`, when present, replace the
1110
+ * diarized turns wholesale; `speaker_labels` maps diarized speaker indexes
1111
+ * ("0", "1", …) to display labels and is applied across all turns. Editing
1112
+ * does NOT retro-update messages of an already-materialized conversation.
1113
+ */
1114
+ export interface UpdateTranscriptionRequest {
1115
+ turns?: TranscriptTurn[]
1116
+ speaker_labels?: Record<string, string>
1117
+ language?: string
1118
+ }
1119
+
1034
1120
  /** Channel defaults to adhoc; meeting is the only other allowed target. */
1035
1121
  export interface MaterializeTranscriptionRequest {
1036
1122
  channel?: Channel
@@ -1047,6 +1133,63 @@ export interface ListTranscriptionsQuery extends PaginationQuery {
1047
1133
  provider_request_id?: string
1048
1134
  }
1049
1135
 
1136
+ export type MistranscribedTermStatus = 'auto_replaced' | 'proposed' | 'accepted' | 'rejected'
1137
+
1138
+ export type MistranscriptionSuggestionSource = 'glossary' | 'model'
1139
+
1140
+ /**
1141
+ * One term the post-transcription review pass judged likely misheard. High-
1142
+ * confidence findings are auto-replaced; the rest await accept/reject. An
1143
+ * accepted row referencing the glossary term it became (glossary_term_id) is a
1144
+ * known "misheard → term" mapping future passes replace deterministically.
1145
+ */
1146
+ export interface MistranscribedTerm {
1147
+ id: string
1148
+ org_id: string
1149
+ transcription_id: string
1150
+ conversation_id?: string
1151
+ /** The text as transcribed. */
1152
+ term: string
1153
+ context_snippet?: string
1154
+ /** Indexes into the transcription's turns where the term occurs. */
1155
+ turn_indexes: number[]
1156
+ suggested_replacement?: string
1157
+ suggestion_source?: MistranscriptionSuggestionSource
1158
+ glossary_term_id?: string
1159
+ /** Confidence (0..1) the term IS mistranscribed. */
1160
+ misheard_confidence: number
1161
+ /** Confidence (0..1) the suggested replacement fits. */
1162
+ replacement_confidence: number
1163
+ status: MistranscribedTermStatus
1164
+ /** The text actually written into the transcript, once applied. */
1165
+ applied_replacement?: string
1166
+ resolved_by?: UserRef
1167
+ resolved_at?: string
1168
+ created_at: string
1169
+ created_by: UserRef
1170
+ updated_at: string
1171
+ updated_by: UserRef
1172
+ }
1173
+
1174
+ /**
1175
+ * Accepts a proposed finding: `replacement` overrides the reviewer's
1176
+ * suggestion when set; `create_glossary_term` promotes the applied replacement
1177
+ * into the org glossary and links the finding to it.
1178
+ */
1179
+ export interface AcceptMistranscribedTermRequest {
1180
+ replacement?: string
1181
+ create_glossary_term?: {
1182
+ definition?: string
1183
+ priority?: number
1184
+ }
1185
+ }
1186
+
1187
+ export interface ListMistranscribedTermsQuery extends PaginationQuery {
1188
+ status?: MistranscribedTermStatus
1189
+ transcription_id?: string
1190
+ conversation_id?: string
1191
+ }
1192
+
1050
1193
  /**
1051
1194
  * Sends a meeting bot (Ava) into a meeting through an active meeting
1052
1195
  * connection (adhoc-meeting). join_at schedules the bot ahead of time (ISO
package/src/index.ts CHANGED
@@ -182,6 +182,7 @@ export type {
182
182
  export { ConnectorClient } from './connector/index.js'
183
183
  // Conversation types (conversation-service: connections, conversations, messages, listeners)
184
184
  export type {
185
+ AcceptMistranscribedTermRequest,
185
186
  AddressFilterConfig,
186
187
  AgentListener,
187
188
  AgentListenerService,
@@ -226,9 +227,13 @@ export type {
226
227
  ConversationService,
227
228
  ConversationStatus,
228
229
  ConversationSummaryStatus,
230
+ ConversationType,
231
+ ConversationTypeConfig,
232
+ ConversationTypeService,
229
233
  CreateAgentListenerRequest,
230
234
  CreateConnectionRequest,
231
235
  CreateConversationFilterRequest,
236
+ CreateConversationTypeRequest,
232
237
  CreateGlossaryTermRequest,
233
238
  DispatchMeetingBotRequest,
234
239
  DomainFilterConfig,
@@ -246,8 +251,10 @@ export type {
246
251
  ListConversationFilterEventsQuery,
247
252
  ListConversationFiltersQuery,
248
253
  ListConversationsQuery,
254
+ ListConversationTypesQuery,
249
255
  ListGlossaryTermsQuery,
250
256
  ListMessagesQuery,
257
+ ListMistranscribedTermsQuery,
251
258
  // Conversation-local page envelope ({meta, data}) — distinct from the
252
259
  // PageIterator-based ListResult used by the other modules.
253
260
  ListResponse,
@@ -261,6 +268,10 @@ export type {
261
268
  MessageRecipient,
262
269
  MessageService,
263
270
  MessageStatus,
271
+ MistranscribedTerm,
272
+ MistranscribedTermService,
273
+ MistranscribedTermStatus,
274
+ MistranscriptionSuggestionSource,
264
275
  PermissionEventSource,
265
276
  PermissionEventType,
266
277
  Reaction,
@@ -276,12 +287,17 @@ export type {
276
287
  SendRecipient,
277
288
  SyncConnectionRequest,
278
289
  TranscribeStreamOptions,
290
+ Transcription,
291
+ TranscriptionReviewStatus,
292
+ TranscriptionStatus,
279
293
  TranscriptResult,
294
+ TranscriptTurn,
280
295
  UnreadCounts,
281
296
  UpdateAgentListenerRequest,
282
297
  UpdateConnectionRequest,
283
298
  UpdateContactRequest,
284
299
  UpdateConversationFilterRequest,
300
+ UpdateConversationTypeRequest,
285
301
  UpdateDraftRequest,
286
302
  UpdateGlossaryTermRequest,
287
303
  VoiceService,