@naturali/sdk 0.269.0 → 0.270.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.mjs CHANGED
@@ -838,7 +838,7 @@ var Channels = class {
838
838
  /**
839
839
  * Create a route
840
840
  *
841
- * `action` is required; `agent_id` is required when it is `agent`, `text` when it is `message`; `repeat` is only valid alongside `action: message`. `surface`, when present, must be one this channel's kind serves (`GET /v1/channel-kinds`) — otherwise `400 unknown_surface`. `match` keys must be predicates that kind's registry declares — otherwise `400 unknown_predicate`. Writing a route for a surface whose transport mode is off (e.g. a Discord `guild_thread` route before `mention_threads` is enabled) still succeeds, with `unreachable_surface` in the response `warnings`.
841
+ * `action` is required; `agent_id` is required when it is `agent`, `text` when it is `message`; `repeat` is only valid alongside `action: message`. `surface`, when present, must be one this channel's kind serves (`GET /v1/channel-kinds`) — otherwise `400 UNKNOWN_SURFACE`. `match` keys must be predicates that kind's registry declares — otherwise `400 UNKNOWN_PREDICATE`. Writing a route for a surface whose transport mode is off (e.g. a Discord `guild_thread` route before `mention_threads` is enabled) still succeeds, with `unreachable_surface` in the response `warnings`.
842
842
  *
843
843
  */
844
844
  static createChannelRoute(options) {
@@ -878,7 +878,7 @@ var Channels = class {
878
878
  /**
879
879
  * Replace a route
880
880
  *
881
- * Full replace, the same validation as create: an omitted field takes its create default. Where that default would widen a value the route sets, omission is `400 replace_omits_fields`, naming the fields in `details.fields`, and nothing is written: a set `surface` (the default is any surface), a non-empty `match` (every message), a non-empty `config` (it carries the Discord allowlist), and `status` on a `disabled` route (the default re-activates it). Send the value to keep it, or `"surface": null`, `"match": {}`, `"config": null`, `"status": "active"` to clear it.
881
+ * Full replace, the same validation as create: an omitted field takes its create default. Where that default would widen a value the route sets, omission is `400 REPLACE_OMITS_FIELDS`, naming the fields in `meta.fields`, and nothing is written: a set `surface` (the default is any surface), a non-empty `match` (every message), a non-empty `config` (it carries the Discord allowlist), and `status` on a `disabled` route (the default re-activates it). Send the value to keep it, or `"surface": null`, `"match": {}`, `"config": null`, `"status": "active"` to clear it.
882
882
  *
883
883
  */
884
884
  static replaceChannelRoute(options) {
@@ -918,17 +918,17 @@ var Channels = class {
918
918
  * Connect a channel
919
919
  *
920
920
  * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
921
- * **Discord** (`channel: discord`) — supply `application_id` and `bot_token`, plus the `modes` selecting which Gateway flows to serve (direct messages, and/or @mention-opens-a-thread). The token is checked with Discord first: `400 invalid_bot_token` when Discord rejects it, `400 application_mismatch` when it belongs to another application, `502 discord_unavailable` when Discord cannot be read. Returns `501` when this deployment does not enable Discord channels.
922
- * **X** (`channel: x`) — supply the bot's `bot_token` (X developer portal, Chat bots) and the `consumer_key` and `consumer_secret` of the app that issued it. naturali then registers its own webhook on that app, subscribes it to the bot's incoming direct messages and registers the bot's chat encryption key, keeping the private key sealed: replies are end-to-end encrypted, and the project never handles keys, webhooks or ciphertext. Pass `chat_private_keys` and `chat_key_version` instead to keep a key the bot already registered. `400 invalid_bot_token` or `400 invalid_consumer_credentials` when X rejects a credential, `409 bot_in_use` when another channel holds the bot, `502 x_provisioning_failed` when X refuses the webhook or the subscription (an app holds a limited number of webhooks), `429 x_key_registration_limited` when the bot used its few daily key registrations, `502 x_unavailable` when X cannot be reached. Returns `501` when this deployment does not enable X channels.
921
+ * **Discord** (`channel: discord`) — supply `application_id` and `bot_token`, plus the `modes` selecting which Gateway flows to serve (direct messages, and/or @mention-opens-a-thread). The token is checked with Discord first: `400 INVALID_BOT_TOKEN` when Discord rejects it, `400 APPLICATION_MISMATCH` when it belongs to another application, `502 DISCORD_UNAVAILABLE` when Discord cannot be read. Returns `501` when this deployment does not enable Discord channels.
922
+ * **X** (`channel: x`) — supply the bot's `bot_token` (X developer portal, Chat bots) and the `consumer_key` and `consumer_secret` of the app that issued it. naturali then registers its own webhook on that app, subscribes it to the bot's incoming direct messages and registers the bot's chat encryption key, keeping the private key sealed: replies are end-to-end encrypted, and the project never handles keys, webhooks or ciphertext. Pass `chat_private_keys` and `chat_key_version` instead to keep a key the bot already registered. `400 INVALID_BOT_TOKEN` or `400 INVALID_CONSUMER_CREDENTIALS` when X rejects a credential, `409 BOT_IN_USE` when another channel holds the bot, `502 X_PROVISIONING_FAILED` when X refuses the webhook or the subscription (an app holds a limited number of webhooks), `429 X_KEY_REGISTRATION_LIMITED` when the bot used its few daily key registrations, `502 X_UNAVAILABLE` when X cannot be reached. Returns `501` when this deployment does not enable X channels.
923
923
  * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
924
924
  * * **BYOT** (`credential_source: byot`, default) — supply
925
925
  * `phone_number_id` and `access_token` from your own Meta app. The
926
- * number is read with the token first: `400 invalid_access_token` when
927
- * Meta rejects the token, `400 phone_number_not_accessible` when it
928
- * cannot reach that number, `502 meta_unavailable` when Meta fails.
926
+ * number is read with the token first: `400 INVALID_ACCESS_TOKEN` when
927
+ * Meta rejects the token, `400 PHONE_NUMBER_NOT_ACCESSIBLE` when it
928
+ * cannot reach that number, `502 META_UNAVAILABLE` when Meta fails.
929
929
  * The token's app is then subscribed to the WABA Meta reports as the
930
930
  * number's owner, which is the `waba_id` stored:
931
- * `400 waba_not_manageable` when the token cannot subscribe to it.
931
+ * `400 WABA_NOT_MANAGEABLE` when the token cannot subscribe to it.
932
932
  *
933
933
  * * **Embedded signup** (`credential_source: embedded_signup`) — supply
934
934
  * `code` and `waba_id` from the Meta popup; naturali exchanges the
@@ -938,7 +938,7 @@ var Channels = class {
938
938
  * are not configured.
939
939
  *
940
940
  *
941
- * The project's plan limits how many channels it may hold. At the limit this responds `403` with `plan_limit_reached`, whose `details` carry the `plan` and the `limit`, before any credential is acquired. Only `active` channels count, so disabling one frees allowance without deleting it.
941
+ * The project's plan limits how many channels it may hold. At the limit this responds `403` with `PLAN_LIMIT_REACHED`, whose `meta` carries the `plan` and the `limit`, before any credential is acquired. Only `active` channels count, so disabling one frees allowance without deleting it.
942
942
  *
943
943
  */
944
944
  static createChannel(options) {
@@ -970,7 +970,7 @@ var Channels = class {
970
970
  /**
971
971
  * Complete a WhatsApp signup
972
972
  *
973
- * Finish a signup link: the app's result page receives `pending` and the numbers Meta granted, and sends back the one to connect. The caller must be a member of the project the link was created for (`404` otherwise), so a link opened by anyone else connects nothing. `pending` expires 10 minutes after the dialog returns (`400 link_expired`).
973
+ * Finish a signup link: the app's result page receives `pending` and the numbers Meta granted, and sends back the one to connect. The caller must be a member of the project the link was created for (`404` otherwise), so a link opened by anyone else connects nothing. `pending` expires 10 minutes after the dialog returns (`400 LINK_EXPIRED`).
974
974
  *
975
975
  */
976
976
  static completeWhatsappSignup(options) {
@@ -1010,7 +1010,7 @@ var Channels = class {
1010
1010
  /**
1011
1011
  * Update a channel
1012
1012
  *
1013
- * Rotate the credential, update the kind's config (`waba_id` / `credential_source` for WhatsApp, `modes` for Discord), or flip the naturali-side status. At least one field is required. Rotating a WhatsApp token first reads the number with it, as connect does (`400 invalid_access_token`, `400 phone_number_not_accessible`, `502 meta_unavailable`, keeping the old token), then stores a new write-only secret, repoints the send tool and deletes the old secret; rotating a Discord bot token reseals it and the gateway worker reconnects with it.
1013
+ * Rotate the credential, update the kind's config (`waba_id` / `credential_source` for WhatsApp, `modes` for Discord), or flip the naturali-side status. At least one field is required. Rotating a WhatsApp token first reads the number with it, as connect does (`400 INVALID_ACCESS_TOKEN`, `400 PHONE_NUMBER_NOT_ACCESSIBLE`, `502 META_UNAVAILABLE`, keeping the old token), then stores a new write-only secret, repoints the send tool and deletes the old secret; rotating a Discord bot token reseals it and the gateway worker reconnects with it.
1014
1014
  *
1015
1015
  */
1016
1016
  static updateChannel(options) {
@@ -5189,7 +5189,7 @@ var Projects = class {
5189
5189
  *
5190
5190
  * Creates a project (one per client or per environment).
5191
5191
  *
5192
- * Your plan limits how many projects you may own. At the limit this responds `403` with `plan_limit_reached`, whose `details` carry the `plan` and the `limit`. An archived project still counts — archiving keeps every resource, so it frees nothing; deleting a project does.
5192
+ * Your plan limits how many projects you may own. At the limit this responds `403` with `PLAN_LIMIT_REACHED`, whose `meta` carries the `plan` and the `limit`. An archived project still counts — archiving keeps every resource, so it frees nothing; deleting a project does.
5193
5193
  *
5194
5194
  * A new project starts at the content-retention window your plan sets (`trace_content_retention_days`); `PATCH` it to anything shorter.
5195
5195
  *
@@ -5237,11 +5237,11 @@ var Projects = class {
5237
5237
  * Rename or archive a project, and/or change its content-retention settings (`trace_content_retention_days`, `trace_content_mode`), its execution ceilings (`max_concurrent_runs`, `max_chain_generations`, `max_orchestration_run_depth`), its priced-model gate (`require_priced_model`), its project-scope guardrails (`guardrail_ids`), the policies capping every agent turn in it (`agent_policy_ids`), the tag keys a change of agent-readable text removes (`content_bound_tag_keys`) and managed conversion (`managed_conversion`). Archiving is reversible; resources are retained.
5238
5238
  * Requires the `admin` role in the project (an `owner` has it too). These are the terms every member works under, which is why setting them sits above the role that works under them.
5239
5239
  * The ceilings and the priced-model gate are uncapped by plan: each one only ever narrows what the project may spend, so setting one takes on a restriction rather than claiming an entitlement. On the three ceilings `null` clears the project's own bound and omission leaves it alone — they are different instructions.
5240
- * `guardrail_ids` is the floor under every tool call by every agent in the project, including tools added later. The list is replaced wholesale, so send the ids you want to keep; `[]` detaches every one. An id naming no guardrail in the project responds `400` with `guardrail_not_found`, whose `details.missing` lists the ids. It is uncapped by plan, like the ceilings: a guardrail can only tighten what runs.
5240
+ * `guardrail_ids` is the floor under every tool call by every agent in the project, including tools added later. The list is replaced wholesale, so send the ids you want to keep; `[]` detaches every one. An id naming no guardrail in the project responds `400` with `GUARDRAIL_NOT_FOUND`, whose `meta.missing` lists the ids. It is uncapped by plan, like the ceilings: a guardrail can only tighten what runs.
5241
5241
  * `agent_policy_ids` caps every turn of every agent the project owns: an action they deny is refused even where the agent's own `policy_ids` allow it, and the refusal's `meta.denied_by` is `{ type: project, id: <project_id> }`. `null` or `[]` removes the cap. The credential must hold every grant the policies carry, else `403` with `POLICY_GRANT_NOT_HELD`; an id naming no policy responds `400` with `POLICY_NOT_FOUND`, and a policy of another project `400` with `POLICY_OUTSIDE_PROJECT`.
5242
5242
  * The two retention controls answer different questions. The window bounds how long content *stays* — a daily sweep purges anything past it, leaving auditable skeletons behind. `trace_content_mode: none` means content is never *written*, which is the stronger guarantee: it cannot be missed by a sweep or survive in a backup.
5243
5243
  *
5244
- * Your plan sets the longest window you may keep content for. A wider one — `null` included, which keeps content indefinitely — responds `403` with `plan_limit_reached`, whose `details` carry the `plan` and the `limit` in days. Anything shorter is always allowed. Moving to a plan with a shorter window takes effect at the end of the billing cycle, and content already stored is then purged by age like everything else.
5244
+ * Your plan sets the longest window you may keep content for. A wider one — `null` included, which keeps content indefinitely — responds `403` with `PLAN_LIMIT_REACHED`, whose `meta` carries the `plan` and the `limit` in days. Anything shorter is always allowed. Moving to a plan with a shorter window takes effect at the end of the billing cycle, and content already stored is then purged by age like everything else.
5245
5245
  *
5246
5246
  */
5247
5247
  static updateProject(options) {
@@ -5407,7 +5407,7 @@ var Projects = class {
5407
5407
  *
5408
5408
  * Makes the caller — the member the transfer names — the project's owner.
5409
5409
  *
5410
- * Usage up to this moment is settled on the previous owner's credit; from here on the project's usage is billed to the caller, and its runs count against the caller's allowance. The project counts toward the caller's plan limits at once: its active channels and triggers, and on Free the project itself. A transfer the caller's plan cannot hold is refused with `403 plan_limit_reached`, and the project's retention window is brought within the caller's plan.
5410
+ * Usage up to this moment is settled on the previous owner's credit; from here on the project's usage is billed to the caller, and its runs count against the caller's allowance. The project counts toward the caller's plan limits at once: its active channels and triggers, and on Free the project itself. A transfer the caller's plan cannot hold is refused with `403 PLAN_LIMIT_REACHED`, and the project's retention window is brought within the caller's plan.
5411
5411
  *
5412
5412
  * The previous owner stays in the project as an `admin`. Stops recorded against the project's spend move to the caller. Refused to a connected app.
5413
5413
  *
@@ -6364,7 +6364,7 @@ var Users = class {
6364
6364
  *
6365
6365
  * The plan the account is on, how long its projects may keep content, how much indexed storage it is holding, and the credit it has left — the figures the platform already enforces against, readable by the account they are enforced against.
6366
6366
  *
6367
- * A managed-model generation is refused with `402 insufficient_credit` while `credit_balance_usd` is negative, and a feature or a resource count outside the plan is refused with `403`, as is a retention window wider than `retention_days` or an ingest past `storage.limit`. Every refusal names what is missing; this is where the numbers behind them are read.
6367
+ * A managed-model generation is refused with `402 INSUFFICIENT_CREDIT` while `credit_balance_usd` is negative, and a feature or a resource count outside the plan is refused with `403`, as is a retention window wider than `retention_days` or an ingest past `storage.limit`. Every refusal names what is missing; this is where the numbers behind them are read.
6368
6368
  *
6369
6369
  * Every figure here is a local read, which is what keeps this route cheap enough to poll — unlike `GET /v1/users/me/usage`, which asks the meter once per project.
6370
6370
  *
@@ -6386,7 +6386,7 @@ var Users = class {
6386
6386
  *
6387
6387
  * Counted across the projects this account is the billing owner of, over the current UTC calendar month, from the meter itself. Archived projects are included: the runs they already made were made.
6388
6388
  *
6389
- * **On the `free` plan the allowance is enforced.** An account that has used it is refused `403 plan_limit_reached` with `resource: "runs"` on everything that starts a generation and on a direct tool call — on its own provider credential as much as on a managed model, because a run is a run — until the billing month turns or it upgrades. On `pro` and `business` nothing is refused: runs past the allowance are billed at the overage rate those plans are sold with. A contract plan is not counted.
6389
+ * **On the `free` plan the allowance is enforced.** An account that has used it is refused `403 PLAN_LIMIT_REACHED` with `resource: "runs"` on everything that starts a generation and on a direct tool call — on its own provider credential as much as on a managed model, because a run is a run — until the billing month turns or it upgrades. On `pro` and `business` nothing is refused: runs past the allowance are billed at the overage rate those plans are sold with. A contract plan is not counted.
6390
6390
  *
6391
6391
  * The other thing that stops a managed-model generation is a negative credit balance, which is `GET /v1/users/me/billing`, and it never applies to your own credential.
6392
6392
  *
@@ -6434,7 +6434,7 @@ var Users = class {
6434
6434
  *
6435
6435
  * Turns one stopped item back on — re-enables the schedule trigger, or resumes the orchestration run or workflow task — and stops listing it. An item that is no longer stopped (resumed already, finished or deleted) is marked restored too.
6436
6436
  *
6437
- * Refused with `409 stop_ceiling_closed` while a ceiling is still closed, naming it in `details.blocked_by`, and with `409 stop_not_restorable` for a cancelled eval run, which can only be dismissed.
6437
+ * Refused with `409 STOP_CEILING_CLOSED` while a ceiling is still closed, naming it in `meta.blocked_by`, and with `409 STOP_NOT_RESTORABLE` for a cancelled eval run, which can only be dismissed.
6438
6438
  *
6439
6439
  */
6440
6440
  static restoreCurrentUserStop(options) {
@@ -6627,7 +6627,7 @@ var Webhooks = class {
6627
6627
  *
6628
6628
  * Register an endpoint and subscribe it to one or more event types.
6629
6629
  * The response carries `secret` — the signing key, in plaintext. **This is the only time it is returned.** Store it where your receiver can read it; if you lose it, rotate rather than re-create, so the endpoint keeps its delivery history. Send `secret` yourself to sign with a key your receiver already holds; the response then returns that one.
6630
- * A project holds at most 20 webhooks, inactive ones included; the 21st is refused with `409 webhook_limit_reached`.
6630
+ * A project holds at most 20 webhooks, inactive ones included; the 21st is refused with `409 WEBHOOK_LIMIT_REACHED`.
6631
6631
  * Returns `501` on a deployment with no credential-sealing key configured, since the secret could not then be stored safely.
6632
6632
  *
6633
6633
  */
@@ -6726,7 +6726,7 @@ var Webhooks = class {
6726
6726
  *
6727
6727
  * Queue the same event at the same endpoint again — the recovery path for a delivery that failed, or one your receiver dropped. This is the `…:redeliver` action; the path segment is `{delivery_id}:redeliver`.
6728
6728
  * A **new** delivery is created and returned; the original record is left untouched, because its attempt history is the evidence you redelivered on. The event's `id` is carried over unchanged, so a receiver deduping on the event sees the same event twice while one deduping on `X-Naturali-Delivery` sees a distinct delivery.
6729
- * An inactive webhook is refused with `409 webhook_inactive`.
6729
+ * An inactive webhook is refused with `409 WEBHOOK_INACTIVE`.
6730
6730
  *
6731
6731
  */
6732
6732
  static redeliverWebhookDelivery(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.269.0",
3
+ "version": "0.270.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "keywords": [
6
6
  "naturali",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@hey-api/openapi-ts": "^0.99.0",
41
- "@naturali/api": "0.269.0",
41
+ "@naturali/api": "0.270.0",
42
42
  "@ttoss/openapi-codegen": "^0.10.1",
43
43
  "@types/node": "^26.5.1",
44
44
  "tsdown": "^0.23.0",