@naturali/sdk 0.39.0 → 0.40.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/dist/index.cjs +15 -15
- package/dist/index.d.cts +91 -91
- package/dist/index.d.mts +91 -91
- package/dist/index.mjs +15 -15
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -634,7 +634,7 @@ var Agents = class {
|
|
|
634
634
|
/**
|
|
635
635
|
* Delete an agent
|
|
636
636
|
*
|
|
637
|
-
* Deletes the backing
|
|
637
|
+
* Deletes the backing runtime agent. Returns 409 if the agent still has dependent generations or traces — pass `force=true` to delete those along with the agent (destructive and irreversible).
|
|
638
638
|
*
|
|
639
639
|
*/
|
|
640
640
|
static deleteAgent(options) {
|
|
@@ -1007,7 +1007,7 @@ var Channels = class {
|
|
|
1007
1007
|
/**
|
|
1008
1008
|
* List the channel's conversations
|
|
1009
1009
|
*
|
|
1010
|
-
* A cursor page of the channel's conversations, newest first. A conversation is one contact's dialogue on the channel — the continuity anchor that resumes the same
|
|
1010
|
+
* A cursor page of the channel's conversations, newest first. A conversation is one contact'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.
|
|
1011
1011
|
* 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.
|
|
1012
1012
|
*
|
|
1013
1013
|
*/
|
|
@@ -1029,7 +1029,7 @@ var Channels = class {
|
|
|
1029
1029
|
/**
|
|
1030
1030
|
* Read a conversation's transcript
|
|
1031
1031
|
*
|
|
1032
|
-
* The conversation's messages, oldest first. naturali stores no message bodies — the dialogue lives in the
|
|
1032
|
+
* The conversation's messages, oldest first. naturali stores no message bodies — the dialogue lives in the runtime session the conversation maps to, so this reads through to the runtime. Pagination is `limit`/`offset` rather than an opaque cursor because the upstream is offset-based over a stable `position` ordering.
|
|
1033
1033
|
*
|
|
1034
1034
|
*/
|
|
1035
1035
|
static listChannelConversationMessages(options) {
|
|
@@ -1057,7 +1057,7 @@ var Contacts = class {
|
|
|
1057
1057
|
* Create a contact
|
|
1058
1058
|
*
|
|
1059
1059
|
* Record a contact the customer already knows about, optionally with the identifiers it is expected to arrive at.
|
|
1060
|
-
* 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
|
|
1060
|
+
* 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.
|
|
1061
1061
|
*
|
|
1062
1062
|
*/
|
|
1063
1063
|
static createContact(options) {
|
|
@@ -1073,7 +1073,7 @@ var Contacts = class {
|
|
|
1073
1073
|
/**
|
|
1074
1074
|
* Erase a contact
|
|
1075
1075
|
*
|
|
1076
|
-
* **Erasure (C4/LGPD).** Not a soft delete and not reversible: the contact's sessions — with their messages and media — its
|
|
1076
|
+
* **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.
|
|
1077
1077
|
* 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.
|
|
1078
1078
|
*
|
|
1079
1079
|
*/
|
|
@@ -1152,7 +1152,7 @@ var Contacts = class {
|
|
|
1152
1152
|
* Merge another contact into this one
|
|
1153
1153
|
*
|
|
1154
1154
|
* Fold `source_contact_id` into this contact — "same human, two identifiers" (C4).
|
|
1155
|
-
* 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 —
|
|
1155
|
+
* 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.
|
|
1156
1156
|
* 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.
|
|
1157
1157
|
*
|
|
1158
1158
|
*/
|
|
@@ -1208,7 +1208,7 @@ var Generations = class {
|
|
|
1208
1208
|
/**
|
|
1209
1209
|
* Run an agent generation
|
|
1210
1210
|
*
|
|
1211
|
-
* Sends messages to the agent, resolves its tools, and runs the model loop. Returns the final text when `status` is `completed` (plus `object` when the agent has an output schema), or the pending `tool_calls` when `status` is `requires_action`. With `stream: true` the response is a Server-Sent Events stream (Content-Type text/event-stream) proxied from
|
|
1211
|
+
* Sends messages to the agent, resolves its tools, and runs the model loop. Returns the final text when `status` is `completed` (plus `object` when the agent has an output schema), or the pending `tool_calls` when `status` is `requires_action`. With `stream: true` the response is a Server-Sent Events stream (Content-Type text/event-stream) proxied from the runtime instead of a single JSON body.
|
|
1212
1212
|
*
|
|
1213
1213
|
*/
|
|
1214
1214
|
static createGeneration(options) {
|
|
@@ -1237,7 +1237,7 @@ var Generations = class {
|
|
|
1237
1237
|
/**
|
|
1238
1238
|
* Get a generation's cost
|
|
1239
1239
|
*
|
|
1240
|
-
* What this one generation cost, and the tokens it was charged on — the billing-grade receipt
|
|
1240
|
+
* What this one generation cost, and the tokens it was charged on — the billing-grade receipt the runtime froze at write time, per model line item.
|
|
1241
1241
|
* This is the per-generation grain that `GET /v1/projects/{project_id}/usage` cannot express: that meter buckets a whole project by model, agent, run, day or meter type, and a run can hold more than one generation. Use this to price a single turn, and the project meter to roll spend up.
|
|
1242
1242
|
* `cost_usd` is `null` when nothing was priced — never that the work was free. Only naturali-managed providers are priced; a BYOK generation runs on your own provider account, so it carries no LLM cost here (its tokens are still reported).
|
|
1243
1243
|
* A generation belonging to another project responds `404`, not `403`.
|
|
@@ -1443,7 +1443,7 @@ var Projects = class {
|
|
|
1443
1443
|
/**
|
|
1444
1444
|
* Delete a project
|
|
1445
1445
|
*
|
|
1446
|
-
* Permanently deletes the project and its backing
|
|
1446
|
+
* Permanently deletes the project and its backing runtime project. Fails with 409 if the runtime project still has dependent resources — remove them first, or pass `force=true` to delete the project and all its dependents (agents, providers, tools, sessions, generations, traces). Forcing is destructive and irreversible.
|
|
1447
1447
|
*
|
|
1448
1448
|
*/
|
|
1449
1449
|
static deleteProject(options) {
|
|
@@ -1479,7 +1479,7 @@ var Projects = class {
|
|
|
1479
1479
|
/**
|
|
1480
1480
|
* Get per-project usage
|
|
1481
1481
|
*
|
|
1482
|
-
* The per-project meter — the re-billing view (A11/C12/P3). Aggregates the project's usage over an optional [from, to] window, bucketed by a single dimension. Costs are the billing-grade cost_usd
|
|
1482
|
+
* The per-project meter — the re-billing view (A11/C12/P3). Aggregates the project's usage over an optional [from, to] window, bucketed by a single dimension. Costs are the billing-grade cost_usd the runtime freezes at write time; null means nothing in the bucket was priced (never that it was free). Only managed providers are priced (on the runtime), so cost reflects managed usage; BYOK usage carries no LLM cost.
|
|
1483
1483
|
*
|
|
1484
1484
|
*/
|
|
1485
1485
|
static getProjectUsage(options) {
|
|
@@ -1504,7 +1504,7 @@ var Providers = class {
|
|
|
1504
1504
|
/**
|
|
1505
1505
|
* Register a provider (managed or BYOK)
|
|
1506
1506
|
*
|
|
1507
|
-
* Register a managed provider (naturali-keyed, priced on
|
|
1507
|
+
* Register a managed provider (naturali-keyed, priced on the runtime) or a BYOK provider (your credentials, stored write-only and never priced). See ProviderCreate for the fields each mode takes.
|
|
1508
1508
|
*
|
|
1509
1509
|
*/
|
|
1510
1510
|
static createProvider(options) {
|
|
@@ -1520,7 +1520,7 @@ var Providers = class {
|
|
|
1520
1520
|
/**
|
|
1521
1521
|
* Delete a provider
|
|
1522
1522
|
*
|
|
1523
|
-
* Deletes the backing
|
|
1523
|
+
* Deletes the backing provider record on the runtime and its secret. Returns 409 if the provider is still referenced by live resources (agents) — detach those first. `force=true` clears only soft dependents (price overrides, usage history); live references always block deletion.
|
|
1524
1524
|
*
|
|
1525
1525
|
*/
|
|
1526
1526
|
static deleteProvider(options) {
|
|
@@ -1559,7 +1559,7 @@ var Sessions = class {
|
|
|
1559
1559
|
/**
|
|
1560
1560
|
* Open a session
|
|
1561
1561
|
*
|
|
1562
|
-
* Opens a durable session against the agent. The session accumulates messages and is resumable by id; its lifecycle (open / closed / expired) and configuration live in the backing
|
|
1562
|
+
* Opens a durable session against the agent. The session accumulates messages and is resumable by id; its lifecycle (open / closed / expired) and configuration live in the backing runtime session.
|
|
1563
1563
|
*
|
|
1564
1564
|
*/
|
|
1565
1565
|
static createSession(options) {
|
|
@@ -1575,7 +1575,7 @@ var Sessions = class {
|
|
|
1575
1575
|
/**
|
|
1576
1576
|
* Get a session
|
|
1577
1577
|
*
|
|
1578
|
-
* Returns the session's current state — status, activity timestamps and configuration — read live from the backing
|
|
1578
|
+
* Returns the session's current state — status, activity timestamps and configuration — read live from the backing runtime session, so a resumed session reflects everything that has happened since it was opened.
|
|
1579
1579
|
*
|
|
1580
1580
|
*/
|
|
1581
1581
|
static getSession(options) {
|
|
@@ -1748,7 +1748,7 @@ var Tools = class {
|
|
|
1748
1748
|
/**
|
|
1749
1749
|
* Delete a tool
|
|
1750
1750
|
*
|
|
1751
|
-
* Deletes the backing
|
|
1751
|
+
* Deletes the backing runtime tool. Returns 409 if the tool is still attached to an agent (detach it first).
|
|
1752
1752
|
*
|
|
1753
1753
|
*/
|
|
1754
1754
|
static deleteTool(options) {
|