@naturali/sdk 0.46.1 → 0.47.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/index.cjs +1 -157
- package/dist/index.d.cts +11 -749
- package/dist/index.d.mts +11 -749
- package/dist/index.mjs +2 -157
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -1063,7 +1063,7 @@ var Channels = class {
|
|
|
1063
1063
|
/**
|
|
1064
1064
|
* List the channel's conversations
|
|
1065
1065
|
*
|
|
1066
|
-
* A cursor page of the channel's conversations, newest first. A conversation is one
|
|
1066
|
+
* A cursor page of the channel's conversations, newest first. A conversation is one address's dialogue on the channel — the continuity anchor that resumes the same runtime session instead of starting fresh per message — so this is the read path for who has talked to the channel and which actor/session their dialogue resolved to.
|
|
1067
1067
|
* Conversations are created by the inbound path (the WhatsApp webhook, the Discord gateway worker) when a real message arrives; there is no way to create one directly.
|
|
1068
1068
|
*
|
|
1069
1069
|
*/
|
|
@@ -1095,159 +1095,6 @@ var Channels = class {
|
|
|
1095
1095
|
});
|
|
1096
1096
|
}
|
|
1097
1097
|
};
|
|
1098
|
-
var Contacts = class {
|
|
1099
|
-
/**
|
|
1100
|
-
* List contacts
|
|
1101
|
-
*
|
|
1102
|
-
* A cursor page of the project's contacts, newest first.
|
|
1103
|
-
* `channel` + `identifier` (supplied together) is the identity lookup — "who is this phone number?" — and returns at most one contact, following the merge pointer to whoever holds the identifier today. `external_id` asks the same question from the customer's side of the mapping. Contacts merged away are omitted unless `include_merged` asks for them.
|
|
1104
|
-
*
|
|
1105
|
-
*/
|
|
1106
|
-
static listContacts(options) {
|
|
1107
|
-
return (options.client ?? client).get({
|
|
1108
|
-
url: "/v1/projects/{project_id}/contacts",
|
|
1109
|
-
...options
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1112
|
-
/**
|
|
1113
|
-
* Create a contact
|
|
1114
|
-
*
|
|
1115
|
-
* Record a contact the customer already knows about, optionally with the identifiers it is expected to arrive at.
|
|
1116
|
-
* Optional by design — the inbound path creates contacts on its own. This is for the embedder who has a user in their own system and wants naturali to agree about who that is before the first message, which is what makes `external_id` (and, through it, a session's `tool_context`) useful. No runtime actor is created here; the contact gets one on first need.
|
|
1117
|
-
*
|
|
1118
|
-
*/
|
|
1119
|
-
static createContact(options) {
|
|
1120
|
-
return (options.client ?? client).post({
|
|
1121
|
-
url: "/v1/projects/{project_id}/contacts",
|
|
1122
|
-
...options,
|
|
1123
|
-
headers: {
|
|
1124
|
-
"Content-Type": "application/json",
|
|
1125
|
-
...options.headers
|
|
1126
|
-
}
|
|
1127
|
-
});
|
|
1128
|
-
}
|
|
1129
|
-
/**
|
|
1130
|
-
* Erase a contact
|
|
1131
|
-
*
|
|
1132
|
-
* **Erasure (C4/LGPD).** Not a soft delete and not reversible: the contact's sessions — with their messages and media — its runtime actor, its memory container and every identifier it was reachable at are removed, along with the merge records that reference it.
|
|
1133
|
-
* The upstream deletes happen first, so a failure there aborts before the local pointers are dropped and a retry can still find what is left. A contact that was merged into another cannot be erased directly: its data lives with the survivor, so erase that one.
|
|
1134
|
-
*
|
|
1135
|
-
*/
|
|
1136
|
-
static deleteContact(options) {
|
|
1137
|
-
return (options.client ?? client).delete({
|
|
1138
|
-
url: "/v1/projects/{project_id}/contacts/{contact_id}",
|
|
1139
|
-
...options
|
|
1140
|
-
});
|
|
1141
|
-
}
|
|
1142
|
-
/**
|
|
1143
|
-
* Get a contact
|
|
1144
|
-
*/
|
|
1145
|
-
static getContact(options) {
|
|
1146
|
-
return (options.client ?? client).get({
|
|
1147
|
-
url: "/v1/projects/{project_id}/contacts/{contact_id}",
|
|
1148
|
-
...options
|
|
1149
|
-
});
|
|
1150
|
-
}
|
|
1151
|
-
/**
|
|
1152
|
-
* Update a contact
|
|
1153
|
-
*
|
|
1154
|
-
* Retune the customer-owned fields. At least one is required. Identities are attached and detached through their own sub-resource, because each one is a claim about reachability rather than a property of the record.
|
|
1155
|
-
*
|
|
1156
|
-
*/
|
|
1157
|
-
static updateContact(options) {
|
|
1158
|
-
return (options.client ?? client).patch({
|
|
1159
|
-
url: "/v1/projects/{project_id}/contacts/{contact_id}",
|
|
1160
|
-
...options,
|
|
1161
|
-
headers: {
|
|
1162
|
-
"Content-Type": "application/json",
|
|
1163
|
-
...options.headers
|
|
1164
|
-
}
|
|
1165
|
-
});
|
|
1166
|
-
}
|
|
1167
|
-
/**
|
|
1168
|
-
* Attach an identity
|
|
1169
|
-
*
|
|
1170
|
-
* Attach a `(channel, identifier)` pair — the manual half of what the inbound path does automatically, and the way a customer tells naturali that a number it has never seen belongs to a user it already knows. The identifier must be free (C3).
|
|
1171
|
-
*
|
|
1172
|
-
*/
|
|
1173
|
-
static createContactIdentity(options) {
|
|
1174
|
-
return (options.client ?? client).post({
|
|
1175
|
-
url: "/v1/projects/{project_id}/contacts/{contact_id}/identities",
|
|
1176
|
-
...options,
|
|
1177
|
-
headers: {
|
|
1178
|
-
"Content-Type": "application/json",
|
|
1179
|
-
...options.headers
|
|
1180
|
-
}
|
|
1181
|
-
});
|
|
1182
|
-
}
|
|
1183
|
-
/**
|
|
1184
|
-
* Detach an identity
|
|
1185
|
-
*
|
|
1186
|
-
* Detach an identifier attached in error. Refused with `identity_in_use` once a dialogue hangs off it: dropping an identifier with history is erasure wearing a smaller name, and erasure has its own route that actually removes the messages instead of orphaning them.
|
|
1187
|
-
*
|
|
1188
|
-
*/
|
|
1189
|
-
static deleteContactIdentity(options) {
|
|
1190
|
-
return (options.client ?? client).delete({
|
|
1191
|
-
url: "/v1/projects/{project_id}/contacts/{contact_id}/identities/{identity_id}",
|
|
1192
|
-
...options
|
|
1193
|
-
});
|
|
1194
|
-
}
|
|
1195
|
-
/**
|
|
1196
|
-
* List the contact's conversations
|
|
1197
|
-
*
|
|
1198
|
-
* Every dialogue the contact has, across channels, newest first. The channel-scoped list answers "who has talked to this number?"; this one answers "where has this human talked to us?" — the read that makes a merge visible, since both channels' rows then appear under one contact.
|
|
1199
|
-
*
|
|
1200
|
-
*/
|
|
1201
|
-
static listContactConversations(options) {
|
|
1202
|
-
return (options.client ?? client).get({
|
|
1203
|
-
url: "/v1/projects/{project_id}/contacts/{contact_id}/conversations",
|
|
1204
|
-
...options
|
|
1205
|
-
});
|
|
1206
|
-
}
|
|
1207
|
-
/**
|
|
1208
|
-
* Merge another contact into this one
|
|
1209
|
-
*
|
|
1210
|
-
* Fold `source_contact_id` into this contact — "same human, two identifiers" (C4).
|
|
1211
|
-
* What moves: every identity and every conversation, so the survivor's history is the union of both. What is *shared* rather than moved: agent memory — the runtime hangs it off the actor, so the source's actor is re-pointed at the survivor's memory container and both keep answering with one recollection. Existing sessions keep working, which is the point of not rewriting them.
|
|
1212
|
-
* The source is not deleted: it stays as a tombstone pointing at the survivor, and the returned merge record lists exactly what moved, so the merge can be audited and reverted.
|
|
1213
|
-
*
|
|
1214
|
-
*/
|
|
1215
|
-
static mergeContact(options) {
|
|
1216
|
-
return (options.client ?? client).post({
|
|
1217
|
-
url: "/v1/projects/{project_id}/contacts/{contact_id}:merge",
|
|
1218
|
-
...options,
|
|
1219
|
-
headers: {
|
|
1220
|
-
"Content-Type": "application/json",
|
|
1221
|
-
...options.headers
|
|
1222
|
-
}
|
|
1223
|
-
});
|
|
1224
|
-
}
|
|
1225
|
-
/**
|
|
1226
|
-
* List the contact's merges
|
|
1227
|
-
*
|
|
1228
|
-
* The contact's merge history, newest first, from both sides: the merges it absorbed and the one that absorbed it. The audit half of C4.
|
|
1229
|
-
*
|
|
1230
|
-
*/
|
|
1231
|
-
static listContactMerges(options) {
|
|
1232
|
-
return (options.client ?? client).get({
|
|
1233
|
-
url: "/v1/projects/{project_id}/contacts/{contact_id}/merges",
|
|
1234
|
-
...options
|
|
1235
|
-
});
|
|
1236
|
-
}
|
|
1237
|
-
/**
|
|
1238
|
-
* Revert a merge
|
|
1239
|
-
*
|
|
1240
|
-
* Undo a merge (C4). Replays the record backwards: the identities and conversations it lists go back to the source, the source's actor is re-pointed at the memory it had before, and the tombstone becomes a contact again. Anything that arrived *after* the merge stays with the survivor — it was never the source's.
|
|
1241
|
-
* Only the merge still in force can be reverted; a source that has since been merged somewhere else has to be unwound from the top (`merge_superseded`).
|
|
1242
|
-
*
|
|
1243
|
-
*/
|
|
1244
|
-
static revertContactMerge(options) {
|
|
1245
|
-
return (options.client ?? client).post({
|
|
1246
|
-
url: "/v1/projects/{project_id}/contacts/{contact_id}/merges/{merge_id}:revert",
|
|
1247
|
-
...options
|
|
1248
|
-
});
|
|
1249
|
-
}
|
|
1250
|
-
};
|
|
1251
1098
|
var Generations = class {
|
|
1252
1099
|
/**
|
|
1253
1100
|
* List an agent's generations
|
|
@@ -2171,7 +2018,6 @@ var NaturaliClient = class {
|
|
|
2171
2018
|
auth;
|
|
2172
2019
|
boards;
|
|
2173
2020
|
channels;
|
|
2174
|
-
contacts;
|
|
2175
2021
|
generations;
|
|
2176
2022
|
knowledge;
|
|
2177
2023
|
models;
|
|
@@ -2198,7 +2044,6 @@ var NaturaliClient = class {
|
|
|
2198
2044
|
this.auth = bindResource(Auth, this.http);
|
|
2199
2045
|
this.boards = bindResource(Boards, this.http);
|
|
2200
2046
|
this.channels = bindResource(Channels, this.http);
|
|
2201
|
-
this.contacts = bindResource(Contacts, this.http);
|
|
2202
2047
|
this.generations = bindResource(Generations, this.http);
|
|
2203
2048
|
this.knowledge = bindResource(Knowledge, this.http);
|
|
2204
2049
|
this.models = bindResource(Models, this.http);
|
|
@@ -2218,7 +2063,6 @@ exports.Assistant = Assistant;
|
|
|
2218
2063
|
exports.Auth = Auth;
|
|
2219
2064
|
exports.Boards = Boards;
|
|
2220
2065
|
exports.Channels = Channels;
|
|
2221
|
-
exports.Contacts = Contacts;
|
|
2222
2066
|
exports.Generations = Generations;
|
|
2223
2067
|
exports.Knowledge = Knowledge;
|
|
2224
2068
|
exports.Models = Models;
|