@proteos/sdk 0.57.1 → 0.59.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.
@@ -83,6 +83,8 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
83
83
  { slug: 'glossary-terms', name: 'Glossary Terms' },
84
84
  // Mistranscribed terms proposed by the post-transcription review pass.
85
85
  { slug: 'mistranscribed-terms', name: 'Mistranscribed Terms' },
86
+ // Live speech-to-text (the dictation stream) — `read` opens a stream.
87
+ { slug: 'voice', name: 'Voice' },
86
88
  // The person-level identity layer (contacts + addresses + merges + consent +
87
89
  // erasure) — one grant governs the whole aggregate.
88
90
  { slug: 'contacts', name: 'Contacts' },
@@ -105,6 +107,12 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
105
107
  { slug: 'channel-events', name: 'Channel Events' },
106
108
  // Conversation briefs: guidance prepared ahead of a conversation (call, meeting) with a contact.
107
109
  { slug: 'conversation-briefs', name: 'Conversation Briefs' },
110
+ // Conversation intelligence: the typed questions asked of conversations
111
+ // (definitions), where/when they are evaluated (sets), and the observations
112
+ // they produce incl. their evaluation history (tags).
113
+ { slug: 'conversation-tag-definitions', name: 'Conversation Tag Definitions' },
114
+ { slug: 'conversation-tag-sets', name: 'Conversation Tag Sets' },
115
+ { slug: 'conversation-tags', name: 'Conversation Tags' },
108
116
  // Connectors (connector-service). `connections` above is shared; this is the
109
117
  // manifest catalog.
110
118
  { slug: 'connectors', name: 'Connectors' },
@@ -130,7 +138,25 @@ export const PLATFORM_ENTITY_SLUGS: readonly string[] = PLATFORM_ENTITIES.map(
130
138
  * by it — so permission UIs only offer the scoped column for these. Extend as
131
139
  * services adopt scoped enforcement.
132
140
  */
133
- export const SCOPED_PLATFORM_ENTITY_SLUGS: readonly string[] = ['knowledge-nodes']
141
+ export const SCOPED_PLATFORM_ENTITY_SLUGS: readonly string[] = [
142
+ 'knowledge-nodes',
143
+ // agent-service: sessions are owned by their starter; the six config
144
+ // resources by their creator. Scoped lists + /agents/v1/shares.
145
+ 'agent-sessions',
146
+ 'agents',
147
+ 'prompts',
148
+ 'skills',
149
+ 'tools',
150
+ 'toolsets',
151
+ 'mcp-servers',
152
+ // conversation-service: a connection is owned by its owner (user-scoped) or
153
+ // open to the org through its org share (org-scoped); a conversation's rows
154
+ // are stamped once at creation from its connection / parent and extended by
155
+ // shares; messages inherit their conversation. /conversations/v1/shares.
156
+ 'connections',
157
+ 'conversations',
158
+ 'messages',
159
+ ]
134
160
 
135
161
  /** True when `slug` belongs to a platform entity (reserved; can't be user-created). */
136
162
  export function isPlatformEntity(slug: string): boolean {
@@ -27,6 +27,7 @@ const PLATFORM_ENTITY_SERVICE: Readonly<Record<string, string>> = {
27
27
  tools: '/agents',
28
28
  toolsets: '/agents',
29
29
  'mcp-servers': '/agents',
30
+ 'agent-sessions': '/agents',
30
31
  // Knowledge (knowledge-service)
31
32
  'knowledge-spaces': '/knowledge',
32
33
  'knowledge-nodes': '/knowledge',
@@ -38,11 +39,11 @@ const PLATFORM_ENTITY_SERVICE: Readonly<Record<string, string>> = {
38
39
  /**
39
40
  * The services that actually serve `/v1/shares` today.
40
41
  *
41
- * Deliberately separate from the map above: the other services get the endpoint
42
- * in later phases, and until then a share must fail with a clear message rather
43
- * than a bare 404 that reads like the record does not exist.
42
+ * Deliberately separate from the map above: a service that has not adopted
43
+ * the endpoint yet must fail with a clear message rather than a bare 404 that
44
+ * reads like the record does not exist.
44
45
  */
45
- const SERVICES_WITH_SHARING: ReadonlySet<string> = new Set(['/data', '/knowledge'])
46
+ const SERVICES_WITH_SHARING: ReadonlySet<string> = new Set(['/data', '/knowledge', '/agents', '/conversations'])
46
47
 
47
48
  /** Records live in data-service; user-defined entities are the unlisted majority. */
48
49
  const DEFAULT_SERVICE = '/data'
@@ -21,7 +21,13 @@ import type {
21
21
  ConversationBrief,
22
22
  ConversationFilter,
23
23
  ConversationFilterEvent,
24
+ ConversationTag,
25
+ ConversationTagDefinition,
26
+ ConversationTagEvaluation,
27
+ ConversationTagSet,
24
28
  ConversationType,
29
+ CountConversationTagsQuery,
30
+ CountConversationTagsResponse,
25
31
  CreateAgentListenerRequest,
26
32
  CreateConnectionRequest,
27
33
  CreateContactGroupRequest,
@@ -29,6 +35,9 @@ import type {
29
35
  CreateContactRequest,
30
36
  CreateConversationBriefRequest,
31
37
  CreateConversationFilterRequest,
38
+ CreateConversationTagDefinitionRequest,
39
+ CreateConversationTagRequest,
40
+ CreateConversationTagSetRequest,
32
41
  CreateConversationTypeRequest,
33
42
  CreateGlossaryTermRequest,
34
43
  CreateSendingRuleRequest,
@@ -42,6 +51,7 @@ import type {
42
51
  EmailSender,
43
52
  EmailSuppression,
44
53
  EmailSuppressionKind,
54
+ EvaluateConversationTagsRequest,
45
55
  GetConnectionHealthQuery,
46
56
  GlossaryTerm,
47
57
  InstallConnectionRequest,
@@ -59,6 +69,10 @@ import type {
59
69
  ListConversationFilterEventsQuery,
60
70
  ListConversationFiltersQuery,
61
71
  ListConversationsQuery,
72
+ ListConversationTagDefinitionsQuery,
73
+ ListConversationTagEvaluationsQuery,
74
+ ListConversationTagSetsQuery,
75
+ ListConversationTagsQuery,
62
76
  ListConversationTypesQuery,
63
77
  ListGlossaryTermsQuery,
64
78
  ListMessagesQuery,
@@ -101,6 +115,9 @@ import type {
101
115
  UpdateConversationBriefRequest,
102
116
  UpdateConversationFilterRequest,
103
117
  UpdateConversationRequest,
118
+ UpdateConversationTagDefinitionRequest,
119
+ UpdateConversationTagRequest,
120
+ UpdateConversationTagSetRequest,
104
121
  UpdateConversationTypeRequest,
105
122
  UpdateDraftRequest,
106
123
  UpdateGlossaryTermRequest,
@@ -144,6 +161,12 @@ export class ConversationClient {
144
161
  readonly glossaryTerms: GlossaryTermService
145
162
  /** Conversation taxonomy: the types the pre-summary classifier assigns. */
146
163
  readonly conversationTypes: ConversationTypeService
164
+ /** Conversation intelligence: WHAT to look for — typed questions asked of conversations. */
165
+ readonly conversationTagDefinitions: ConversationTagDefinitionService
166
+ /** Conversation intelligence: WHERE and WHEN definitions are evaluated. */
167
+ readonly conversationTagSets: ConversationTagSetService
168
+ /** Conversation intelligence: the observations produced + their evaluation history. */
169
+ readonly conversationTags: ConversationTagService
147
170
  /** Generic audience taxonomy; membership lives on the contact. */
148
171
  readonly contactGroups: ContactGroupService
149
172
  /** Tone-of-voice synthesis: per-user setups + the generated profiles. */
@@ -171,6 +194,9 @@ export class ConversationClient {
171
194
  this.channelEvents = new ChannelEventServiceImpl(client)
172
195
  this.glossaryTerms = new GlossaryTermServiceImpl(client)
173
196
  this.conversationTypes = new ConversationTypeServiceImpl(client)
197
+ this.conversationTagDefinitions = new ConversationTagDefinitionServiceImpl(client)
198
+ this.conversationTagSets = new ConversationTagSetServiceImpl(client)
199
+ this.conversationTags = new ConversationTagServiceImpl(client)
174
200
  this.contactGroups = new ContactGroupServiceImpl(client)
175
201
  this.toneProfiles = new ToneProfileServiceImpl(client)
176
202
  this.transcriptions = new TranscriptionServiceImpl(client)
@@ -1044,6 +1070,266 @@ class ConversationTypeServiceImpl implements ConversationTypeService {
1044
1070
  }
1045
1071
  }
1046
1072
 
1073
+ /**
1074
+ * Conversation tag definitions: WHAT to look for in a conversation — one
1075
+ * typed question (boolean / choice / score) plus where its answers anchor
1076
+ * (`scope`) and which model path answers (`evaluator`). A definition is only
1077
+ * evaluated through the tag sets that reference it. Keyed by `key` (not id);
1078
+ * `upsert` is the idempotent module-deploy door.
1079
+ */
1080
+ export interface ConversationTagDefinitionService {
1081
+ list(
1082
+ query?: ListConversationTagDefinitionsQuery,
1083
+ ): Promise<ListResponse<ConversationTagDefinition>>
1084
+ get(key: string): Promise<ConversationTagDefinition>
1085
+ create(request: CreateConversationTagDefinitionRequest): Promise<ConversationTagDefinition>
1086
+ update(
1087
+ key: string,
1088
+ request: UpdateConversationTagDefinitionRequest,
1089
+ ): Promise<ConversationTagDefinition>
1090
+ /** Idempotent create-or-update by key (PUT) — what `pro module deploy` calls. */
1091
+ upsert(
1092
+ key: string,
1093
+ request: CreateConversationTagDefinitionRequest,
1094
+ ): Promise<ConversationTagDefinition>
1095
+ delete(key: string): Promise<void>
1096
+ }
1097
+
1098
+ class ConversationTagDefinitionServiceImpl implements ConversationTagDefinitionService {
1099
+ constructor(private readonly client: ProteosClient) {}
1100
+
1101
+ list(
1102
+ query: ListConversationTagDefinitionsQuery = {},
1103
+ ): Promise<ListResponse<ConversationTagDefinition>> {
1104
+ return this.client.requestWithQuery(
1105
+ 'GET',
1106
+ `${CONVERSATION_BASE_PATH}/conversation-tag-definitions`,
1107
+ query,
1108
+ )
1109
+ }
1110
+
1111
+ get(key: string): Promise<ConversationTagDefinition> {
1112
+ return this.client.request(
1113
+ 'GET',
1114
+ `${CONVERSATION_BASE_PATH}/conversation-tag-definitions/${encodeURIComponent(key)}`,
1115
+ )
1116
+ }
1117
+
1118
+ create(request: CreateConversationTagDefinitionRequest): Promise<ConversationTagDefinition> {
1119
+ return this.client.request(
1120
+ 'POST',
1121
+ `${CONVERSATION_BASE_PATH}/conversation-tag-definitions`,
1122
+ request,
1123
+ )
1124
+ }
1125
+
1126
+ update(
1127
+ key: string,
1128
+ request: UpdateConversationTagDefinitionRequest,
1129
+ ): Promise<ConversationTagDefinition> {
1130
+ return this.client.request(
1131
+ 'PATCH',
1132
+ `${CONVERSATION_BASE_PATH}/conversation-tag-definitions/${encodeURIComponent(key)}`,
1133
+ request,
1134
+ )
1135
+ }
1136
+
1137
+ upsert(
1138
+ key: string,
1139
+ request: CreateConversationTagDefinitionRequest,
1140
+ ): Promise<ConversationTagDefinition> {
1141
+ return this.client.request(
1142
+ 'PUT',
1143
+ `${CONVERSATION_BASE_PATH}/conversation-tag-definitions/${encodeURIComponent(key)}`,
1144
+ { ...request, key },
1145
+ )
1146
+ }
1147
+
1148
+ async delete(key: string): Promise<void> {
1149
+ await this.client.request(
1150
+ 'DELETE',
1151
+ `${CONVERSATION_BASE_PATH}/conversation-tag-definitions/${encodeURIComponent(key)}`,
1152
+ )
1153
+ }
1154
+ }
1155
+
1156
+ /**
1157
+ * Conversation tag sets: WHERE and WHEN a group of definitions is evaluated.
1158
+ * A set needs at least one conversation selector (`channels`,
1159
+ * `connection_ids`, `type_keys`) — tagging is opt-in, never org-wide by
1160
+ * accident — and `evaluate_on` is a non-empty subset of realtime|completion.
1161
+ * Keyed by `key` (not id); `upsert` is the idempotent module-deploy door.
1162
+ */
1163
+ export interface ConversationTagSetService {
1164
+ list(query?: ListConversationTagSetsQuery): Promise<ListResponse<ConversationTagSet>>
1165
+ get(key: string): Promise<ConversationTagSet>
1166
+ create(request: CreateConversationTagSetRequest): Promise<ConversationTagSet>
1167
+ update(key: string, request: UpdateConversationTagSetRequest): Promise<ConversationTagSet>
1168
+ /** Idempotent create-or-update by key (PUT) — what `pro module deploy` calls. */
1169
+ upsert(key: string, request: CreateConversationTagSetRequest): Promise<ConversationTagSet>
1170
+ delete(key: string): Promise<void>
1171
+ }
1172
+
1173
+ class ConversationTagSetServiceImpl implements ConversationTagSetService {
1174
+ constructor(private readonly client: ProteosClient) {}
1175
+
1176
+ list(query: ListConversationTagSetsQuery = {}): Promise<ListResponse<ConversationTagSet>> {
1177
+ return this.client.requestWithQuery(
1178
+ 'GET',
1179
+ `${CONVERSATION_BASE_PATH}/conversation-tag-sets`,
1180
+ query,
1181
+ )
1182
+ }
1183
+
1184
+ get(key: string): Promise<ConversationTagSet> {
1185
+ return this.client.request(
1186
+ 'GET',
1187
+ `${CONVERSATION_BASE_PATH}/conversation-tag-sets/${encodeURIComponent(key)}`,
1188
+ )
1189
+ }
1190
+
1191
+ create(request: CreateConversationTagSetRequest): Promise<ConversationTagSet> {
1192
+ return this.client.request('POST', `${CONVERSATION_BASE_PATH}/conversation-tag-sets`, request)
1193
+ }
1194
+
1195
+ update(key: string, request: UpdateConversationTagSetRequest): Promise<ConversationTagSet> {
1196
+ return this.client.request(
1197
+ 'PATCH',
1198
+ `${CONVERSATION_BASE_PATH}/conversation-tag-sets/${encodeURIComponent(key)}`,
1199
+ request,
1200
+ )
1201
+ }
1202
+
1203
+ upsert(key: string, request: CreateConversationTagSetRequest): Promise<ConversationTagSet> {
1204
+ return this.client.request(
1205
+ 'PUT',
1206
+ `${CONVERSATION_BASE_PATH}/conversation-tag-sets/${encodeURIComponent(key)}`,
1207
+ { ...request, key },
1208
+ )
1209
+ }
1210
+
1211
+ async delete(key: string): Promise<void> {
1212
+ await this.client.request(
1213
+ 'DELETE',
1214
+ `${CONVERSATION_BASE_PATH}/conversation-tag-sets/${encodeURIComponent(key)}`,
1215
+ )
1216
+ }
1217
+ }
1218
+
1219
+ /**
1220
+ * Conversation tags: the observations definitions make on conversations,
1221
+ * plus the evaluations that produced them. Per-conversation reads/writes
1222
+ * hang off the conversation; `update`/`delete` address a tag by id; `list`
1223
+ * and `counts` are the org-wide streams. Span offsets are UNICODE CODE POINT
1224
+ * indexes (end exclusive) — convert to/from UTF-16 before slicing JS strings.
1225
+ */
1226
+ export interface ConversationTagService {
1227
+ /** Tags on one conversation (pending, active and dismissed unless `status` filters). */
1228
+ listByConversation(
1229
+ conversationId: string,
1230
+ query?: ListConversationTagsQuery,
1231
+ ): Promise<ListResponse<ConversationTag>>
1232
+ /** A person tags a conversation, a message or a span (source = user, confidence 1). */
1233
+ create(conversationId: string, request: CreateConversationTagRequest): Promise<ConversationTag>
1234
+ /**
1235
+ * Start a manual evaluation (202). Resolves with the PENDING evaluation as
1236
+ * soon as it is accepted — the tagger runs server-side beyond this request.
1237
+ * Poll `listEvaluations(conversationId)` until that evaluation's status is
1238
+ * `done` | `failed`, then re-read the tags. 409
1239
+ * `conversation_tag_set_not_matched` when no enabled set matches the
1240
+ * conversation; 409 `conversation_tag_evaluation_in_progress` while another
1241
+ * evaluation is still running.
1242
+ */
1243
+ evaluate(
1244
+ conversationId: string,
1245
+ request?: EvaluateConversationTagsRequest,
1246
+ ): Promise<ConversationTagEvaluation>
1247
+ /** The evaluation history of one conversation (newest first by default). */
1248
+ listEvaluations(
1249
+ conversationId: string,
1250
+ query?: ListConversationTagEvaluationsQuery,
1251
+ ): Promise<ListResponse<ConversationTagEvaluation>>
1252
+ /** Flip a tag between active and dismissed (the feedback loop) and/or annotate why. */
1253
+ update(id: string, request: UpdateConversationTagRequest): Promise<ConversationTag>
1254
+ delete(id: string): Promise<void>
1255
+ /** Org-wide tag stream (filter by definition, value, channel, contact, time window). */
1256
+ list(query?: ListConversationTagsQuery): Promise<ListResponse<ConversationTag>>
1257
+ /** Grouped counts for dashboards — `group_by` is a comma-joined string. */
1258
+ counts(query?: CountConversationTagsQuery): Promise<CountConversationTagsResponse>
1259
+ }
1260
+
1261
+ class ConversationTagServiceImpl implements ConversationTagService {
1262
+ constructor(private readonly client: ProteosClient) {}
1263
+
1264
+ listByConversation(
1265
+ conversationId: string,
1266
+ query: ListConversationTagsQuery = {},
1267
+ ): Promise<ListResponse<ConversationTag>> {
1268
+ return this.client.requestWithQuery(
1269
+ 'GET',
1270
+ `${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(conversationId)}/tags`,
1271
+ query,
1272
+ )
1273
+ }
1274
+
1275
+ create(conversationId: string, request: CreateConversationTagRequest): Promise<ConversationTag> {
1276
+ return this.client.request(
1277
+ 'POST',
1278
+ `${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(conversationId)}/tags`,
1279
+ request,
1280
+ )
1281
+ }
1282
+
1283
+ evaluate(
1284
+ conversationId: string,
1285
+ request: EvaluateConversationTagsRequest = {},
1286
+ ): Promise<ConversationTagEvaluation> {
1287
+ return this.client.request(
1288
+ 'POST',
1289
+ `${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(conversationId)}/tags/evaluate`,
1290
+ request,
1291
+ )
1292
+ }
1293
+
1294
+ listEvaluations(
1295
+ conversationId: string,
1296
+ query: ListConversationTagEvaluationsQuery = {},
1297
+ ): Promise<ListResponse<ConversationTagEvaluation>> {
1298
+ return this.client.requestWithQuery(
1299
+ 'GET',
1300
+ `${CONVERSATION_BASE_PATH}/conversations/${encodeURIComponent(conversationId)}/tag-evaluations`,
1301
+ query,
1302
+ )
1303
+ }
1304
+
1305
+ update(id: string, request: UpdateConversationTagRequest): Promise<ConversationTag> {
1306
+ return this.client.request(
1307
+ 'PATCH',
1308
+ `${CONVERSATION_BASE_PATH}/conversation-tags/${encodeURIComponent(id)}`,
1309
+ request,
1310
+ )
1311
+ }
1312
+
1313
+ async delete(id: string): Promise<void> {
1314
+ await this.client.request(
1315
+ 'DELETE',
1316
+ `${CONVERSATION_BASE_PATH}/conversation-tags/${encodeURIComponent(id)}`,
1317
+ )
1318
+ }
1319
+
1320
+ list(query: ListConversationTagsQuery = {}): Promise<ListResponse<ConversationTag>> {
1321
+ return this.client.requestWithQuery('GET', `${CONVERSATION_BASE_PATH}/conversation-tags`, query)
1322
+ }
1323
+
1324
+ counts(query: CountConversationTagsQuery = {}): Promise<CountConversationTagsResponse> {
1325
+ return this.client.requestWithQuery(
1326
+ 'GET',
1327
+ `${CONVERSATION_BASE_PATH}/conversation-tags/counts`,
1328
+ query,
1329
+ )
1330
+ }
1331
+ }
1332
+
1047
1333
  /**
1048
1334
  * Contact groups: the generic org-shared audience taxonomy. Membership lives
1049
1335
  * on the contact (`Contact.group_key`, one group per contact — assign via