@proteos/sdk 0.57.1 → 0.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-2EB3P4AR.cjs → chunk-25PD6TYH.cjs} +4 -3
- package/dist/chunk-25PD6TYH.cjs.map +1 -0
- package/dist/{chunk-U3FT5KAH.js → chunk-OOOTPEJK.js} +4 -3
- package/dist/chunk-OOOTPEJK.js.map +1 -0
- package/dist/index.cjs +279 -119
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +615 -3
- package/dist/index.d.ts +615 -3
- package/dist/index.js +162 -2
- package/dist/index.js.map +1 -1
- package/dist/meta/index.cjs +89 -89
- package/dist/meta/index.d.cts +1 -1
- package/dist/meta/index.d.ts +1 -1
- package/dist/meta/index.js +1 -1
- package/dist/{types-mC4i_Wk3.d.cts → types-DQmqR_G8.d.cts} +8 -0
- package/dist/{types-mC4i_Wk3.d.ts → types-DQmqR_G8.d.ts} +8 -0
- package/package.json +1 -1
- package/src/auth/platform-entities.ts +6 -0
- package/src/conversation/index.ts +286 -0
- package/src/conversation/types.ts +580 -0
- package/src/index.ts +36 -0
- package/src/meta/types.ts +6 -0
- package/dist/chunk-2EB3P4AR.cjs.map +0 -1
- package/dist/chunk-U3FT5KAH.js.map +0 -1
|
@@ -862,6 +862,579 @@ export interface ListConversationTypesQuery extends PaginationQuery {
|
|
|
862
862
|
module_slug?: string
|
|
863
863
|
}
|
|
864
864
|
|
|
865
|
+
// ---------------------------------------------------------------------------
|
|
866
|
+
// Conversation intelligence — tag definitions, tag sets, tags, evaluations.
|
|
867
|
+
// Hand-maintained mirror of conversation-tag-*.go + api/conversation-tag-*.go.
|
|
868
|
+
// ---------------------------------------------------------------------------
|
|
869
|
+
|
|
870
|
+
/**
|
|
871
|
+
* Discriminates a tag definition's question (1:1 with the agent-service
|
|
872
|
+
* decision question types): boolean ("is this present?"), choice ("which
|
|
873
|
+
* one?"), score ("where on this ordered scale?").
|
|
874
|
+
*/
|
|
875
|
+
export type ConversationTagQuestionType = 'boolean' | 'choice' | 'score'
|
|
876
|
+
|
|
877
|
+
/**
|
|
878
|
+
* What a tag anchors to: the whole conversation (one value per conversation),
|
|
879
|
+
* one message (a verdict per message), or a span (character ranges inside a
|
|
880
|
+
* message, or message-to-message ranges). `span` REQUIRES evaluator kind
|
|
881
|
+
* `reason` — only a reasoning generation can localise verbatim quotes.
|
|
882
|
+
*/
|
|
883
|
+
export type ConversationTagScope = 'conversation' | 'message' | 'span'
|
|
884
|
+
|
|
885
|
+
/**
|
|
886
|
+
* The model path a definition is judged by: `decide` (agent-service's
|
|
887
|
+
* calibrated typed decision — probabilities, no prose, no localisation) or
|
|
888
|
+
* `reason` (a schema-constrained generation that returns rationale + verbatim
|
|
889
|
+
* anchors; required for span scope).
|
|
890
|
+
*/
|
|
891
|
+
export type ConversationTagEvaluatorKind = 'decide' | 'reason'
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* WHY an evaluation ran: `realtime` (the debounced window after new messages),
|
|
895
|
+
* `completion` (the conversation completed — final transcript + summary for
|
|
896
|
+
* spoken media, End for the rest) or `manual` (`conversationTags.evaluate`).
|
|
897
|
+
* A tag set's `evaluate_on` lists the automatic ones it subscribes to; manual
|
|
898
|
+
* ignores it.
|
|
899
|
+
*/
|
|
900
|
+
export type ConversationTagTrigger = 'realtime' | 'completion' | 'manual'
|
|
901
|
+
|
|
902
|
+
/** Who produced a tag: the evaluator (`model`) or a person (`user`). */
|
|
903
|
+
export type ConversationTagSource = 'model' | 'user'
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* `pending` = a provisional realtime observation on a spoken-medium
|
|
907
|
+
* conversation that is still live (a completion evaluation will replace it);
|
|
908
|
+
* `active` = current; `dismissed` = a person rejected it — kept as feedback
|
|
909
|
+
* and never re-created by a later evaluation.
|
|
910
|
+
*/
|
|
911
|
+
export type ConversationTagStatus = 'pending' | 'active' | 'dismissed'
|
|
912
|
+
|
|
913
|
+
/**
|
|
914
|
+
* One evaluation's lifecycle: `pending` (a manual evaluation was accepted and
|
|
915
|
+
* not yet started), `running`, `done`, `failed`.
|
|
916
|
+
*/
|
|
917
|
+
export type ConversationTagEvaluationStatus = 'pending' | 'running' | 'done' | 'failed'
|
|
918
|
+
|
|
919
|
+
/**
|
|
920
|
+
* Spells out what makes a boolean question hold (`true`) or not (`false`)
|
|
921
|
+
* when the boundary is subtle.
|
|
922
|
+
*/
|
|
923
|
+
export interface BooleanTagCriteria {
|
|
924
|
+
true: string
|
|
925
|
+
false: string
|
|
926
|
+
}
|
|
927
|
+
|
|
928
|
+
/**
|
|
929
|
+
* Populated per question type: boolean → `boolean` (optional, both
|
|
930
|
+
* descriptions or neither), choice → `choice` (option key → description,
|
|
931
|
+
* ≥ 2), score → `score` (ordered level descriptions, ≥ 2; the tag value is
|
|
932
|
+
* the 0-based level index). Descriptions are handed to the evaluator
|
|
933
|
+
* verbatim, so they should describe the observable content, not internal
|
|
934
|
+
* process.
|
|
935
|
+
*/
|
|
936
|
+
export interface ConversationTagCriteria {
|
|
937
|
+
boolean?: BooleanTagCriteria
|
|
938
|
+
choice?: Record<string, string>
|
|
939
|
+
score?: string[]
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
/**
|
|
943
|
+
* The decide-shaped question a definition asks over a conversation — the
|
|
944
|
+
* same three types as the agent-service decision question, with criteria in
|
|
945
|
+
* an explicit struct so manifests and SDKs need no tagged-union decoder.
|
|
946
|
+
* `type` is immutable after create: tag values are typed by it.
|
|
947
|
+
*/
|
|
948
|
+
export interface ConversationTagQuestion {
|
|
949
|
+
type: ConversationTagQuestionType
|
|
950
|
+
instructions: string
|
|
951
|
+
/** Always on the wire; pass `{}` for a boolean question without descriptions. */
|
|
952
|
+
criteria: ConversationTagCriteria
|
|
953
|
+
}
|
|
954
|
+
|
|
955
|
+
/**
|
|
956
|
+
* Makes a `reason` definition ask the cheap decide model first whether it
|
|
957
|
+
* applies anywhere in the judged window (its own boolean question, one answer
|
|
958
|
+
* per window); only a definition that passes (probability ≥ `min_probability`)
|
|
959
|
+
* reaches the reasoning call, which is skipped entirely when nothing passes. A
|
|
960
|
+
* screened-out definition's stale tags are still replaced. Boolean questions
|
|
961
|
+
* only — choice and score always have an answer. Omitted = screening on with
|
|
962
|
+
* the service default threshold (0.3, `CONVERSATION_TAG_SCREENING_MIN_PROBABILITY`);
|
|
963
|
+
* `{ is_enabled: false }` turns it off. The service rejects `screening` on a
|
|
964
|
+
* `decide` evaluator or on a choice/score question, and a `min_probability`
|
|
965
|
+
* outside 0..1.
|
|
966
|
+
*/
|
|
967
|
+
export interface ConversationTagScreening {
|
|
968
|
+
is_enabled: boolean
|
|
969
|
+
/** Pass threshold in 0..1; absent = the service default. */
|
|
970
|
+
min_probability?: number
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
/**
|
|
974
|
+
* Selects the model path. `model_id` is only meaningful for `reason` (absent =
|
|
975
|
+
* the service default); `decide` always uses the service-wide decision model.
|
|
976
|
+
* `screening` is only meaningful for `reason` with a boolean question; absent =
|
|
977
|
+
* screening on with the service default threshold.
|
|
978
|
+
*/
|
|
979
|
+
export interface ConversationTagEvaluator {
|
|
980
|
+
kind: ConversationTagEvaluatorKind
|
|
981
|
+
model_id?: string
|
|
982
|
+
screening?: ConversationTagScreening
|
|
983
|
+
}
|
|
984
|
+
|
|
985
|
+
/**
|
|
986
|
+
* Describes WHAT to look for in a conversation: one typed question plus where
|
|
987
|
+
* its answers anchor (`scope`) and which model path answers it (`evaluator`).
|
|
988
|
+
* WHERE and WHEN a definition is evaluated is a ConversationTagSet's business
|
|
989
|
+
* — a definition that no enabled set references is never evaluated. Keyed
|
|
990
|
+
* (org_id, key) and module-deployable (conversation-tag-definitions/<key>.json),
|
|
991
|
+
* like conversation types.
|
|
992
|
+
*/
|
|
993
|
+
export interface ConversationTagDefinition {
|
|
994
|
+
org_id: string
|
|
995
|
+
/** Immutable identity within the org — the value every tag carries as `definition_key`. */
|
|
996
|
+
key: string
|
|
997
|
+
name: string
|
|
998
|
+
/** Free grouping for UIs ("content", "sentiment", "signal"). */
|
|
999
|
+
group?: string
|
|
1000
|
+
question: ConversationTagQuestion
|
|
1001
|
+
/** `span` requires `evaluator.kind = 'reason'`. */
|
|
1002
|
+
scope: ConversationTagScope
|
|
1003
|
+
evaluator: ConversationTagEvaluator
|
|
1004
|
+
/**
|
|
1005
|
+
* Narrows message/span-scope judging to messages of these directions (e.g.
|
|
1006
|
+
* inbound only for customer sentiment); empty = all. Ignored for
|
|
1007
|
+
* conversation scope.
|
|
1008
|
+
*/
|
|
1009
|
+
directions: MessageDirection[]
|
|
1010
|
+
/**
|
|
1011
|
+
* Observations below it are dropped, for every question type — an absent
|
|
1012
|
+
* tag means "not determined", not "false".
|
|
1013
|
+
*/
|
|
1014
|
+
min_confidence: number
|
|
1015
|
+
/** Optional UI hint (any CSS color token the client accepts). */
|
|
1016
|
+
color?: string
|
|
1017
|
+
is_enabled: boolean
|
|
1018
|
+
/** Module that deployed the definition; absent when not module-owned. */
|
|
1019
|
+
module_slug?: string
|
|
1020
|
+
created_at: string
|
|
1021
|
+
created_by: UserRef
|
|
1022
|
+
updated_at: string
|
|
1023
|
+
updated_by: UserRef
|
|
1024
|
+
}
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* Describes WHERE and WHEN a group of tag definitions is evaluated. A
|
|
1028
|
+
* conversation matches a set when every NON-EMPTY selector contains it:
|
|
1029
|
+
* `channels`, `connection_ids`, `type_keys` (an empty conversation `type_key`
|
|
1030
|
+
* never matches a type-scoped set, so type-scoped sets only apply once a
|
|
1031
|
+
* conversation has been classified). At least one of those three must be
|
|
1032
|
+
* non-empty — tagging is opt-in, never org-wide by accident. `directions` is
|
|
1033
|
+
* a message-level filter on top (which messages arm / are judged), not a
|
|
1034
|
+
* conversation selector. Matched sets union their definition keys; timing
|
|
1035
|
+
* takes the minimum quiet window and max wait over the matched sets that
|
|
1036
|
+
* evaluate in realtime. Keyed (org_id, key) and module-deployable
|
|
1037
|
+
* (conversation-tag-sets/<key>.json).
|
|
1038
|
+
*/
|
|
1039
|
+
export interface ConversationTagSet {
|
|
1040
|
+
org_id: string
|
|
1041
|
+
key: string
|
|
1042
|
+
name: string
|
|
1043
|
+
/**
|
|
1044
|
+
* The definitions this set evaluates (≥ 1; each must exist in the org at
|
|
1045
|
+
* write time — a definition deleted later is skipped).
|
|
1046
|
+
*/
|
|
1047
|
+
definition_keys: string[]
|
|
1048
|
+
channels: Channel[]
|
|
1049
|
+
connection_ids: string[]
|
|
1050
|
+
type_keys: string[]
|
|
1051
|
+
/**
|
|
1052
|
+
* Narrows which NEW messages arm a realtime evaluation (and which messages a
|
|
1053
|
+
* completion evaluation judges for message/span scope): inbound only,
|
|
1054
|
+
* outbound only, or both when empty. A definition's own `directions`
|
|
1055
|
+
* narrows further.
|
|
1056
|
+
*/
|
|
1057
|
+
directions: MessageDirection[]
|
|
1058
|
+
/**
|
|
1059
|
+
* A non-empty subset of [realtime, completion]: realtime = the debounced
|
|
1060
|
+
* window after new messages arrive; completion = once the conversation
|
|
1061
|
+
* completed (final transcript + summary for spoken media, End for the
|
|
1062
|
+
* rest). Manual evaluations ignore it.
|
|
1063
|
+
*/
|
|
1064
|
+
evaluate_on: ConversationTagTrigger[]
|
|
1065
|
+
/** A realtime evaluation fires this long after the LAST new message (default 90, min 5). */
|
|
1066
|
+
quiet_window_seconds: number
|
|
1067
|
+
/**
|
|
1068
|
+
* Bounds the wait since the FIRST unjudged message (default 600, ≥ quiet
|
|
1069
|
+
* window) so a busy stream is still tagged periodically.
|
|
1070
|
+
*/
|
|
1071
|
+
max_wait_seconds: number
|
|
1072
|
+
is_enabled: boolean
|
|
1073
|
+
/** Module that deployed the set; absent when not module-owned. */
|
|
1074
|
+
module_slug?: string
|
|
1075
|
+
created_at: string
|
|
1076
|
+
created_by: UserRef
|
|
1077
|
+
updated_at: string
|
|
1078
|
+
updated_by: UserRef
|
|
1079
|
+
}
|
|
1080
|
+
|
|
1081
|
+
/**
|
|
1082
|
+
* One observation a definition made on a conversation.
|
|
1083
|
+
*
|
|
1084
|
+
* Anchors encode the definition's scope: conversation scope = every anchor
|
|
1085
|
+
* field absent; message scope = `start_message_id === end_message_id` with no
|
|
1086
|
+
* offsets; span = offsets set (a span may cross messages, then start/end
|
|
1087
|
+
* message ids differ). Offsets are UNICODE CODE POINT indexes into the
|
|
1088
|
+
* message's first text content block, end exclusive — JS strings are UTF-16,
|
|
1089
|
+
* so convert (e.g. via `Array.from(text)` / code-point iteration) before
|
|
1090
|
+
* slicing. `quote` (and `end_quote` for a span that continues into a later
|
|
1091
|
+
* message) is the verbatim text at the anchor: the reason evaluator emits
|
|
1092
|
+
* quotes because a model cannot count characters, the service resolves them
|
|
1093
|
+
* to offsets, and afterwards the quote is the evidence that survives a message
|
|
1094
|
+
* row change (the final transcript swaps realtime message ids; a term
|
|
1095
|
+
* correction edits text) — a tag whose anchors no longer resolve still shows
|
|
1096
|
+
* its quote and can be re-anchored by search.
|
|
1097
|
+
*
|
|
1098
|
+
* `value` is normalized per question type: `"true"` for a boolean (false is
|
|
1099
|
+
* never stored), the option key for a choice, the 0-based level index AS A
|
|
1100
|
+
* STRING for a score. Status `pending` marks a provisional realtime
|
|
1101
|
+
* observation on a live spoken-medium conversation; a completion evaluation
|
|
1102
|
+
* replaces it. Dismissed tags are feedback: a later evaluation never
|
|
1103
|
+
* re-creates a tag matching a dismissed one on (definition_key, value,
|
|
1104
|
+
* start/end message).
|
|
1105
|
+
*/
|
|
1106
|
+
export interface ConversationTag {
|
|
1107
|
+
id: string
|
|
1108
|
+
org_id: string
|
|
1109
|
+
conversation_id: string
|
|
1110
|
+
/**
|
|
1111
|
+
* Denormalized from the conversation so org-wide lists and counts group by
|
|
1112
|
+
* channel without a join.
|
|
1113
|
+
*/
|
|
1114
|
+
channel: Channel
|
|
1115
|
+
definition_key: string
|
|
1116
|
+
/** `"true"` | choice option key | score level index as a string. */
|
|
1117
|
+
value: string
|
|
1118
|
+
confidence: number
|
|
1119
|
+
/**
|
|
1120
|
+
* The raw decide distribution (`{"true":p,"false":1-p}`, option → p, or
|
|
1121
|
+
* `{"levels":[…],"mean":x}`); a screened reason tag carries
|
|
1122
|
+
* `{"screening":p}` instead; absent for unscreened reason and user tags.
|
|
1123
|
+
*/
|
|
1124
|
+
probabilities?: Record<string, unknown>
|
|
1125
|
+
/** The reason evaluator's one-line rationale; absent for decide. */
|
|
1126
|
+
why?: string
|
|
1127
|
+
source: ConversationTagSource
|
|
1128
|
+
status: ConversationTagStatus
|
|
1129
|
+
/** Links a model tag to the evaluation that produced it. */
|
|
1130
|
+
evaluation_id?: string
|
|
1131
|
+
start_message_id?: string
|
|
1132
|
+
/** Unicode code-point index, inclusive. */
|
|
1133
|
+
start_offset?: number
|
|
1134
|
+
end_message_id?: string
|
|
1135
|
+
/** Unicode code-point index, exclusive. */
|
|
1136
|
+
end_offset?: number
|
|
1137
|
+
start_occurred_at?: string
|
|
1138
|
+
end_occurred_at?: string
|
|
1139
|
+
quote?: string
|
|
1140
|
+
end_quote?: string
|
|
1141
|
+
/**
|
|
1142
|
+
* When the observed thing happened (the end message's `occurred_at`, else
|
|
1143
|
+
* the last message's) — the time-series axis.
|
|
1144
|
+
*/
|
|
1145
|
+
observed_at: string
|
|
1146
|
+
created_at: string
|
|
1147
|
+
created_by: UserRef
|
|
1148
|
+
updated_at: string
|
|
1149
|
+
updated_by: UserRef
|
|
1150
|
+
}
|
|
1151
|
+
|
|
1152
|
+
/**
|
|
1153
|
+
* One row of `conversationTags.counts`: the grouped columns that were
|
|
1154
|
+
* requested plus the count.
|
|
1155
|
+
*/
|
|
1156
|
+
export interface ConversationTagCount {
|
|
1157
|
+
definition_key?: string
|
|
1158
|
+
value?: string
|
|
1159
|
+
channel?: Channel
|
|
1160
|
+
count: number
|
|
1161
|
+
}
|
|
1162
|
+
|
|
1163
|
+
/**
|
|
1164
|
+
* The model spend of one evaluation, summed over its decide and generate
|
|
1165
|
+
* calls.
|
|
1166
|
+
*/
|
|
1167
|
+
export interface ConversationTagUsage {
|
|
1168
|
+
input_tokens: number
|
|
1169
|
+
output_tokens: number
|
|
1170
|
+
request_count: number
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
/**
|
|
1174
|
+
* One screening verdict of an evaluation: the decide probability that the
|
|
1175
|
+
* definition applies in the judged window and whether that passed the
|
|
1176
|
+
* threshold. `probability` is absent (and `error` set) when the screening
|
|
1177
|
+
* could not be asked — it then passes, fail-open.
|
|
1178
|
+
*/
|
|
1179
|
+
export interface ConversationTagScreeningResult {
|
|
1180
|
+
definition_key: string
|
|
1181
|
+
probability?: number
|
|
1182
|
+
is_passed: boolean
|
|
1183
|
+
error?: string
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
/**
|
|
1187
|
+
* Records one time the tagger ran on a conversation: why (`trigger`), what it
|
|
1188
|
+
* judged (`definition_keys`, the message window), with which models, what it
|
|
1189
|
+
* cost, and how it ended. Model tags reference it through `evaluation_id`
|
|
1190
|
+
* (provenance), the UI polls it after a manual evaluate (202), and the latest
|
|
1191
|
+
* done realtime/completion evaluation's `window_end_occurred_at` is the
|
|
1192
|
+
* watermark the next realtime window starts after.
|
|
1193
|
+
*
|
|
1194
|
+
* Window = the messages JUDGED by this evaluation. realtime: everything after
|
|
1195
|
+
* the previous watermark (older messages ride along as context only);
|
|
1196
|
+
* completion/manual: all messages. Lifecycle: manual creates `pending` on the
|
|
1197
|
+
* 202 then flips to `running`; realtime/completion create `running` directly;
|
|
1198
|
+
* ends `done` or `failed`.
|
|
1199
|
+
*/
|
|
1200
|
+
export interface ConversationTagEvaluation {
|
|
1201
|
+
id: string
|
|
1202
|
+
org_id: string
|
|
1203
|
+
conversation_id: string
|
|
1204
|
+
trigger: ConversationTagTrigger
|
|
1205
|
+
status: ConversationTagEvaluationStatus
|
|
1206
|
+
definition_keys: string[]
|
|
1207
|
+
model_ids: string[]
|
|
1208
|
+
usage: ConversationTagUsage
|
|
1209
|
+
/**
|
|
1210
|
+
* The rendered state exceeded the cap and older context (or, for a huge
|
|
1211
|
+
* window, the newest window messages — deferred to the next evaluation) was
|
|
1212
|
+
* dropped.
|
|
1213
|
+
*/
|
|
1214
|
+
is_truncated: boolean
|
|
1215
|
+
window_start_occurred_at?: string
|
|
1216
|
+
window_end_occurred_at?: string
|
|
1217
|
+
window_message_ids: string[]
|
|
1218
|
+
/**
|
|
1219
|
+
* Every screened reason definition's verdict, so "why was nothing tagged"
|
|
1220
|
+
* is answerable and thresholds can be tuned. Empty when no definition was
|
|
1221
|
+
* screened.
|
|
1222
|
+
*/
|
|
1223
|
+
screenings: ConversationTagScreeningResult[]
|
|
1224
|
+
error?: string
|
|
1225
|
+
started_at: string
|
|
1226
|
+
finished_at?: string
|
|
1227
|
+
created_at: string
|
|
1228
|
+
created_by: UserRef
|
|
1229
|
+
updated_at: string
|
|
1230
|
+
updated_by: UserRef
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
/**
|
|
1234
|
+
* The `conversation.tagged` event payload: the conversation, the evaluation
|
|
1235
|
+
* that landed, and every tag it produced (status pending or active — the
|
|
1236
|
+
* event header carries the status so a consumer can filter provisional
|
|
1237
|
+
* realtime observations without decoding).
|
|
1238
|
+
*/
|
|
1239
|
+
export interface ConversationTaggedEvent {
|
|
1240
|
+
conversation: Conversation
|
|
1241
|
+
evaluation: ConversationTagEvaluation
|
|
1242
|
+
tags: ConversationTag[]
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
/**
|
|
1246
|
+
* Creates one tag definition. `key` is the immutable identity (kebab/snake,
|
|
1247
|
+
* like every platform key); `question` is the decide-shaped question the
|
|
1248
|
+
* evaluator answers; `scope` and `evaluator` say where answers anchor and
|
|
1249
|
+
* which model path answers (`span` requires `evaluator.kind = 'reason'`).
|
|
1250
|
+
* `is_enabled` omitted ⇒ true (manifests may omit it). `module_slug` is
|
|
1251
|
+
* stamped by `pro module deploy` — interactive callers leave it empty.
|
|
1252
|
+
*/
|
|
1253
|
+
export interface CreateConversationTagDefinitionRequest {
|
|
1254
|
+
key: string
|
|
1255
|
+
name?: string
|
|
1256
|
+
group?: string
|
|
1257
|
+
question: ConversationTagQuestion
|
|
1258
|
+
scope: ConversationTagScope
|
|
1259
|
+
evaluator: ConversationTagEvaluator
|
|
1260
|
+
directions?: MessageDirection[]
|
|
1261
|
+
/** 0..1 */
|
|
1262
|
+
min_confidence?: number
|
|
1263
|
+
color?: string
|
|
1264
|
+
is_enabled?: boolean
|
|
1265
|
+
module_slug?: string
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/**
|
|
1269
|
+
* Partial update — an omitted field leaves the stored value untouched.
|
|
1270
|
+
* `question`, when present, replaces the stored question wholesale but must
|
|
1271
|
+
* keep its `type` (400 `conversation_tag_question_type_immutable` otherwise).
|
|
1272
|
+
* `directions` replaces wholesale. `key` is immutable.
|
|
1273
|
+
*/
|
|
1274
|
+
export interface UpdateConversationTagDefinitionRequest {
|
|
1275
|
+
name?: string
|
|
1276
|
+
group?: string
|
|
1277
|
+
question?: ConversationTagQuestion
|
|
1278
|
+
scope?: ConversationTagScope
|
|
1279
|
+
evaluator?: ConversationTagEvaluator
|
|
1280
|
+
directions?: MessageDirection[]
|
|
1281
|
+
/** 0..1 */
|
|
1282
|
+
min_confidence?: number
|
|
1283
|
+
color?: string
|
|
1284
|
+
is_enabled?: boolean
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
export interface ListConversationTagDefinitionsQuery extends PaginationQuery {
|
|
1288
|
+
/** Definitions deployed by one module — the `pro module` remote-state discovery door. */
|
|
1289
|
+
module_slug?: string
|
|
1290
|
+
/** Exact filter. */
|
|
1291
|
+
group?: string
|
|
1292
|
+
/** Exact filter. */
|
|
1293
|
+
scope?: string
|
|
1294
|
+
is_enabled?: boolean
|
|
1295
|
+
/** Case-insensitive substring match on key or name. */
|
|
1296
|
+
search?: string
|
|
1297
|
+
}
|
|
1298
|
+
|
|
1299
|
+
/**
|
|
1300
|
+
* Creates one tag set: which definitions to evaluate (`definition_keys`, ≥ 1,
|
|
1301
|
+
* each must exist), for which conversations (at least one of `channels` /
|
|
1302
|
+
* `connection_ids` / `type_keys` non-empty; `directions` additionally limits
|
|
1303
|
+
* which messages arm/are judged — empty = both), when (`evaluate_on` ⊆
|
|
1304
|
+
* [realtime, completion], ≥ 1) and the realtime timing (omitted ⇒ defaults:
|
|
1305
|
+
* quiet 90s, max wait 600s). `is_enabled` omitted ⇒ true. `module_slug` is
|
|
1306
|
+
* stamped by `pro module deploy`.
|
|
1307
|
+
*/
|
|
1308
|
+
export interface CreateConversationTagSetRequest {
|
|
1309
|
+
key: string
|
|
1310
|
+
name?: string
|
|
1311
|
+
definition_keys: string[]
|
|
1312
|
+
channels?: Channel[]
|
|
1313
|
+
connection_ids?: string[]
|
|
1314
|
+
type_keys?: string[]
|
|
1315
|
+
directions?: MessageDirection[]
|
|
1316
|
+
evaluate_on: ConversationTagTrigger[]
|
|
1317
|
+
quiet_window_seconds?: number
|
|
1318
|
+
max_wait_seconds?: number
|
|
1319
|
+
is_enabled?: boolean
|
|
1320
|
+
module_slug?: string
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
/**
|
|
1324
|
+
* Partial update — an omitted field leaves the stored value untouched; arrays
|
|
1325
|
+
* replace wholesale. `key` is immutable.
|
|
1326
|
+
*/
|
|
1327
|
+
export interface UpdateConversationTagSetRequest {
|
|
1328
|
+
name?: string
|
|
1329
|
+
definition_keys?: string[]
|
|
1330
|
+
channels?: Channel[]
|
|
1331
|
+
connection_ids?: string[]
|
|
1332
|
+
type_keys?: string[]
|
|
1333
|
+
directions?: MessageDirection[]
|
|
1334
|
+
evaluate_on?: ConversationTagTrigger[]
|
|
1335
|
+
quiet_window_seconds?: number
|
|
1336
|
+
max_wait_seconds?: number
|
|
1337
|
+
is_enabled?: boolean
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
export interface ListConversationTagSetsQuery extends PaginationQuery {
|
|
1341
|
+
/** Sets deployed by one module. */
|
|
1342
|
+
module_slug?: string
|
|
1343
|
+
/** Sets that reference the definition. */
|
|
1344
|
+
definition_key?: string
|
|
1345
|
+
is_enabled?: boolean
|
|
1346
|
+
/** Case-insensitive substring match on key or name. */
|
|
1347
|
+
search?: string
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* The manual door (`conversationTags.create`): a person tags a conversation,
|
|
1352
|
+
* a message or a span. Anchors follow the definition's scope (conversation:
|
|
1353
|
+
* none; message: start == end message, no offsets; span: UNICODE CODE POINT
|
|
1354
|
+
* offsets into the message's first text block, end exclusive — convert from
|
|
1355
|
+
* UTF-16 indexes before sending). The service stamps `source = 'user'`,
|
|
1356
|
+
* confidence 1, and fills `quote` from the anchored text.
|
|
1357
|
+
*/
|
|
1358
|
+
export interface CreateConversationTagRequest {
|
|
1359
|
+
definition_key: string
|
|
1360
|
+
/** `"true"` | choice option key | score level index as a string. */
|
|
1361
|
+
value: string
|
|
1362
|
+
why?: string
|
|
1363
|
+
start_message_id?: string
|
|
1364
|
+
/** Unicode code-point index, inclusive. */
|
|
1365
|
+
start_offset?: number
|
|
1366
|
+
end_message_id?: string
|
|
1367
|
+
/** Unicode code-point index, exclusive. */
|
|
1368
|
+
end_offset?: number
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* Flips a tag between `active` and `dismissed` (the feedback loop) and lets a
|
|
1373
|
+
* person annotate why.
|
|
1374
|
+
*/
|
|
1375
|
+
export interface UpdateConversationTagRequest {
|
|
1376
|
+
status?: ConversationTagStatus
|
|
1377
|
+
why?: string
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
/**
|
|
1381
|
+
* Starts a manual evaluation (`conversationTags.evaluate`, 202). Omitted or
|
|
1382
|
+
* empty `definition_keys` = every definition the currently matching sets
|
|
1383
|
+
* reference (and every model tag on the conversation is replaced); a list
|
|
1384
|
+
* narrows both the questions and the replacement to those keys.
|
|
1385
|
+
*/
|
|
1386
|
+
export interface EvaluateConversationTagsRequest {
|
|
1387
|
+
definition_keys?: string[]
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/**
|
|
1391
|
+
* Serves both `conversationTags.listByConversation` (the service forces
|
|
1392
|
+
* `conversation_id` from the path) and the org-wide `conversationTags.list`.
|
|
1393
|
+
*/
|
|
1394
|
+
export interface ListConversationTagsQuery extends PaginationQuery {
|
|
1395
|
+
conversation_id?: string
|
|
1396
|
+
definition_key?: string
|
|
1397
|
+
value?: string
|
|
1398
|
+
channel?: string
|
|
1399
|
+
source?: string
|
|
1400
|
+
status?: string
|
|
1401
|
+
/** Tags anchored on the message at either end. */
|
|
1402
|
+
message_id?: string
|
|
1403
|
+
/** Tags on conversations whose roster contains the contact. */
|
|
1404
|
+
contact_id?: string
|
|
1405
|
+
/** Lower bound on `observed_at` (inclusive), RFC 3339. */
|
|
1406
|
+
since?: string
|
|
1407
|
+
/** Upper bound on `observed_at` (exclusive), RFC 3339. */
|
|
1408
|
+
until?: string
|
|
1409
|
+
}
|
|
1410
|
+
|
|
1411
|
+
/**
|
|
1412
|
+
* Groups active tags for dashboards. `group_by` is a COMMA-JOINED string
|
|
1413
|
+
* (`'definition_key,value'`) — not an array, because the query serializer
|
|
1414
|
+
* repeats array keys — whitelisted to definition_key, value, channel (order
|
|
1415
|
+
* kept).
|
|
1416
|
+
*/
|
|
1417
|
+
export interface CountConversationTagsQuery {
|
|
1418
|
+
group_by?: string
|
|
1419
|
+
definition_key?: string
|
|
1420
|
+
channel?: string
|
|
1421
|
+
source?: string
|
|
1422
|
+
status?: string
|
|
1423
|
+
/** Lower bound on `observed_at` (inclusive), RFC 3339. */
|
|
1424
|
+
since?: string
|
|
1425
|
+
/** Upper bound on `observed_at` (exclusive), RFC 3339. */
|
|
1426
|
+
until?: string
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
export interface CountConversationTagsResponse {
|
|
1430
|
+
data: ConversationTagCount[]
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
export interface ListConversationTagEvaluationsQuery extends PaginationQuery {
|
|
1434
|
+
trigger?: string
|
|
1435
|
+
status?: string
|
|
1436
|
+
}
|
|
1437
|
+
|
|
865
1438
|
/** Who assigned a contact's group membership. */
|
|
866
1439
|
export type ContactGroupSource = 'manual' | 'model'
|
|
867
1440
|
|
|
@@ -1079,6 +1652,13 @@ export interface ListConversationsQuery extends PaginationQuery {
|
|
|
1079
1652
|
sender_address_id?: string
|
|
1080
1653
|
/** Opt into the root/latest message projection on each row. */
|
|
1081
1654
|
include?: 'messages_summary'
|
|
1655
|
+
/**
|
|
1656
|
+
* Conversations carrying an ACTIVE conversation tag of this definition —
|
|
1657
|
+
* the "which conversations talk about billing" stream.
|
|
1658
|
+
*/
|
|
1659
|
+
tag_key?: string
|
|
1660
|
+
/** With `tag_key`: only conversations whose tag has this value. */
|
|
1661
|
+
tag_value?: string
|
|
1082
1662
|
}
|
|
1083
1663
|
|
|
1084
1664
|
/**
|
package/src/index.ts
CHANGED
|
@@ -261,6 +261,7 @@ export type {
|
|
|
261
261
|
AutomatedFilterConfig,
|
|
262
262
|
AutomatedSignal,
|
|
263
263
|
BlockContactRequest,
|
|
264
|
+
BooleanTagCriteria,
|
|
264
265
|
BounceClassification,
|
|
265
266
|
BounceKind,
|
|
266
267
|
CallStatus,
|
|
@@ -320,9 +321,33 @@ export type {
|
|
|
320
321
|
ConversationService,
|
|
321
322
|
ConversationStatus,
|
|
322
323
|
ConversationSummaryStatus,
|
|
324
|
+
ConversationTag,
|
|
325
|
+
ConversationTagCount,
|
|
326
|
+
ConversationTagCriteria,
|
|
327
|
+
ConversationTagDefinition,
|
|
328
|
+
ConversationTagDefinitionService,
|
|
329
|
+
ConversationTagEvaluation,
|
|
330
|
+
ConversationTagEvaluationStatus,
|
|
331
|
+
ConversationTagEvaluator,
|
|
332
|
+
ConversationTagEvaluatorKind,
|
|
333
|
+
ConversationTaggedEvent,
|
|
334
|
+
ConversationTagQuestion,
|
|
335
|
+
ConversationTagQuestionType,
|
|
336
|
+
ConversationTagScope,
|
|
337
|
+
ConversationTagScreening,
|
|
338
|
+
ConversationTagScreeningResult,
|
|
339
|
+
ConversationTagService,
|
|
340
|
+
ConversationTagSet,
|
|
341
|
+
ConversationTagSetService,
|
|
342
|
+
ConversationTagSource,
|
|
343
|
+
ConversationTagStatus,
|
|
344
|
+
ConversationTagTrigger,
|
|
345
|
+
ConversationTagUsage,
|
|
323
346
|
ConversationType,
|
|
324
347
|
ConversationTypeConfig,
|
|
325
348
|
ConversationTypeService,
|
|
349
|
+
CountConversationTagsQuery,
|
|
350
|
+
CountConversationTagsResponse,
|
|
326
351
|
CreateAgentListenerRequest,
|
|
327
352
|
CreateConnectionRequest,
|
|
328
353
|
CreateContactGroupRequest,
|
|
@@ -330,6 +355,9 @@ export type {
|
|
|
330
355
|
CreateContactRequest,
|
|
331
356
|
CreateConversationBriefRequest,
|
|
332
357
|
CreateConversationFilterRequest,
|
|
358
|
+
CreateConversationTagDefinitionRequest,
|
|
359
|
+
CreateConversationTagRequest,
|
|
360
|
+
CreateConversationTagSetRequest,
|
|
333
361
|
CreateConversationTypeRequest,
|
|
334
362
|
CreateGlossaryTermRequest,
|
|
335
363
|
CreateSendingRuleRequest,
|
|
@@ -351,6 +379,7 @@ export type {
|
|
|
351
379
|
EmailSuppressionCounts,
|
|
352
380
|
EmailSuppressionKind,
|
|
353
381
|
ErasureRequestStatus,
|
|
382
|
+
EvaluateConversationTagsRequest,
|
|
354
383
|
FilterMatchOn,
|
|
355
384
|
FrequencyCapRuleConfig,
|
|
356
385
|
GetConnectionHealthQuery,
|
|
@@ -374,6 +403,10 @@ export type {
|
|
|
374
403
|
ListConversationFilterEventsQuery,
|
|
375
404
|
ListConversationFiltersQuery,
|
|
376
405
|
ListConversationsQuery,
|
|
406
|
+
ListConversationTagDefinitionsQuery,
|
|
407
|
+
ListConversationTagEvaluationsQuery,
|
|
408
|
+
ListConversationTagSetsQuery,
|
|
409
|
+
ListConversationTagsQuery,
|
|
377
410
|
ListConversationTypesQuery,
|
|
378
411
|
ListGlossaryTermsQuery,
|
|
379
412
|
ListMessagesQuery,
|
|
@@ -452,6 +485,9 @@ export type {
|
|
|
452
485
|
UpdateContactRequest,
|
|
453
486
|
UpdateConversationBriefRequest,
|
|
454
487
|
UpdateConversationFilterRequest,
|
|
488
|
+
UpdateConversationTagDefinitionRequest,
|
|
489
|
+
UpdateConversationTagRequest,
|
|
490
|
+
UpdateConversationTagSetRequest,
|
|
455
491
|
UpdateConversationTypeRequest,
|
|
456
492
|
UpdateDraftRequest,
|
|
457
493
|
UpdateGlossaryTermRequest,
|
package/src/meta/types.ts
CHANGED
|
@@ -1857,6 +1857,9 @@ export interface AppConfiguration extends AuditFields {
|
|
|
1857
1857
|
agent_keys?: string[]
|
|
1858
1858
|
/** entity_slug → record page slug opened from this app. */
|
|
1859
1859
|
record_pages?: Record<string, string>
|
|
1860
|
+
/** Entity slugs the command palette searches (by record title) inside
|
|
1861
|
+
* this app; empty = no record search. */
|
|
1862
|
+
searchable_entities?: string[]
|
|
1860
1863
|
}
|
|
1861
1864
|
|
|
1862
1865
|
export const AppConfigurationSchema = AuditFieldsSchema.extend({
|
|
@@ -1870,6 +1873,7 @@ export const AppConfigurationSchema = AuditFieldsSchema.extend({
|
|
|
1870
1873
|
default_agent_key: z.string().optional(),
|
|
1871
1874
|
agent_keys: z.array(z.string()).optional(),
|
|
1872
1875
|
record_pages: z.record(z.string()).optional(),
|
|
1876
|
+
searchable_entities: z.array(z.string()).optional(),
|
|
1873
1877
|
})
|
|
1874
1878
|
|
|
1875
1879
|
export interface ListAppConfigurationsOptions extends MetaListOptions {
|
|
@@ -1894,6 +1898,7 @@ export interface CreateAppConfigurationRequest {
|
|
|
1894
1898
|
default_agent_key?: string
|
|
1895
1899
|
agent_keys?: string[]
|
|
1896
1900
|
record_pages?: Record<string, string>
|
|
1901
|
+
searchable_entities?: string[]
|
|
1897
1902
|
}
|
|
1898
1903
|
|
|
1899
1904
|
/**
|
|
@@ -1907,6 +1912,7 @@ export interface UpdateAppConfigurationRequest {
|
|
|
1907
1912
|
default_agent_key?: string
|
|
1908
1913
|
agent_keys?: string[]
|
|
1909
1914
|
record_pages?: Record<string, string>
|
|
1915
|
+
searchable_entities?: string[]
|
|
1910
1916
|
}
|
|
1911
1917
|
|
|
1912
1918
|
// ============================================================================
|