@naturali/sdk 0.173.2 → 0.173.4

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 CHANGED
@@ -915,7 +915,7 @@ var Channels = class {
915
915
  * Connect a channel
916
916
  *
917
917
  * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
918
- * **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). Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
918
+ * **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. Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
919
919
  * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
920
920
  * * **BYOT** (`credential_source: byot`, default) — supply
921
921
  * `phone_number_id` and `access_token` from your own Meta app.
package/dist/index.d.cts CHANGED
@@ -2481,6 +2481,22 @@ type Channel = {
2481
2481
  * Whether an access token is on file (its value is never returned).
2482
2482
  */
2483
2483
  has_credential: boolean;
2484
+ /**
2485
+ * Why Discord refused this channel's gateway connection, when it did: the worker stops retrying, so the channel stays silent until a `PATCH` changes `bot_token`, `modes` or `status`, which clears it. Null when there is none, and for non-Discord channels.
2486
+ *
2487
+ */
2488
+ gateway_error: {
2489
+ /**
2490
+ * `invalid_bot_token` — the token was reset or revoked. `disallowed_intents` — `mention_threads` needs the privileged Message Content intent enabled on the Discord application.
2491
+ *
2492
+ */
2493
+ code: 'invalid_bot_token' | 'disallowed_intents' | 'gateway_rejected';
2494
+ /**
2495
+ * The gateway close code Discord sent.
2496
+ */
2497
+ close_code: number;
2498
+ at: Date;
2499
+ } | null;
2484
2500
  created_at: Date;
2485
2501
  updated_at: Date;
2486
2502
  };
@@ -2545,7 +2561,7 @@ type ChannelCreate = {
2545
2561
  modes?: DiscordModes;
2546
2562
  };
2547
2563
  /**
2548
- * At least one field is required. For WhatsApp, `access_token` rotates the write-only credential; for Discord, `bot_token` rotates the sealed bot token and `modes` turns the gateway flows on or off. `default` replaces the channel's default action whole when present. The worker picks either change up on its next poll and reconnects.
2564
+ * At least one field is required. For WhatsApp, `access_token` rotates the write-only credential; for Discord, `bot_token` rotates the sealed bot token (checked with Discord as on connect) and `modes` turns the gateway flows on or off. `default` replaces the channel's default action whole when present. The worker picks either change up on its next poll and reconnects.
2549
2565
  *
2550
2566
  */
2551
2567
  type ChannelUpdate = {
@@ -5035,7 +5051,7 @@ type Generation = {
5035
5051
  */
5036
5052
  trace_id?: string;
5037
5053
  /**
5038
- * Public ID of the generation that triggered this one. Set for sub-agent invocations. Null for top-level generations.
5054
+ * Public ID of the generation that started this one: a sub-agent invocation, an approval continuation, a client-tool re-handoff or a memory-rule handler turn. Null for top-level generations.
5039
5055
  *
5040
5056
  */
5041
5057
  initiator_generation_id?: string | null;
@@ -6659,13 +6675,13 @@ type OrchestrationRun = {
6659
6675
  */
6660
6676
  node_executions?: Array<NodeExecution>;
6661
6677
  /**
6662
- * What the run cost: token counts and `cost_usd` summed across every metered generation it produced **and every run it started** through `loop` / `sub_orchestration` nodes, at any depth. Present on the single-run read; omitted from run list responses.
6678
+ * What the run cost: token counts and `cost_usd` summed across every metered generation it produced **and every run it started** through `loop` / `sub_orchestration` nodes, at any depth. Present only on the single-run read (`GET /v1/projects/{project_id}/orchestration-runs/{orchestration_run_id}`); omitted from run lists and from every write's response, including a start with `wait: true`.
6663
6679
  *
6664
6680
  * A nested child is a run record of its own, so this figure spans several of them. Two consequences: summing `usage` across a list that mixes parents and children double-counts (filter with `nested=false`), and the per-event receipt at `/v1/projects/{project_id}/usage/receipt` stays scoped to one run — its line items carry a `node_id` from one graph only.
6665
6681
  */
6666
6682
  usage?: UsageTotals;
6667
6683
  /**
6668
- * The same roll-up restricted to **this run's own nodes**, excluding every nested run it started. Equal to `usage` for a run with no children; below it for a run that delegates. Present on the single-run read; omitted from run list responses.
6684
+ * The same roll-up restricted to **this run's own nodes**, excluding every nested run it started. Equal to `usage` for a run with no children; below it for a run that delegates. Present only on the single-run read, like `usage`.
6669
6685
  *
6670
6686
  * This is the field to read to see where cost sits in a run tree — own versus subtree — without walking the children.
6671
6687
  */
@@ -10465,7 +10481,7 @@ type CreateAgentGenerationErrors = {
10465
10481
  */
10466
10482
  409: ErrorResponse;
10467
10483
  /**
10468
- * `SHARE_CAP_EXCEEDED`: the agent is another project's, reached through a share whose `cap` is spent for the window. Carries a `Retry-After` header and `error.meta.retry_after`.
10484
+ * `QUOTA_EXCEEDED`: an `enforce`-mode generation quota is exhausted; `error.meta` carries `quota_id`, `metric`, `limit`, `window` and `resets_at`. `SHARE_CAP_EXCEEDED`: the agent is another project's, reached through a share whose `cap` is spent for the window; `error.meta.retry_after` says when. Both carry a `Retry-After` header.
10469
10485
  */
10470
10486
  429: ErrorResponse;
10471
10487
  /**
@@ -10522,6 +10538,11 @@ type SubmitAgentToolOutputsErrors = {
10522
10538
  * Agent or generation not found
10523
10539
  */
10524
10540
  404: ErrorResponse;
10541
+ /**
10542
+ * The generation is not paused on client tool calls (GENERATION_NOT_AWAITING_TOOL_OUTPUTS): it never paused, or its outputs were already submitted. Each pause accepts outputs once.
10543
+ *
10544
+ */
10545
+ 409: ErrorResponse;
10525
10546
  /**
10526
10547
  * Upstream AI provider error (AI_PROVIDER_ERROR); model output that does not satisfy the agent's `output_schema` (OUTPUT_SCHEMA_VALIDATION_FAILED); or a model that wrote a tool invocation out as plain assistant text instead of calling the tool (TEXT_ENCODED_TOOL_CALL — `meta.tool_name` names the tool). The resumed generation is recorded `failed`.
10527
10548
  *
@@ -13350,6 +13371,10 @@ type GenerateConversationMessageErrors = {
13350
13371
  * Conversation or actor not found
13351
13372
  */
13352
13373
  404: ErrorResponse;
13374
+ /**
13375
+ * `QUOTA_EXCEEDED`: an `enforce`-mode generation quota is exhausted. `error.meta` carries `quota_id`, `metric`, `limit`, `window` and `resets_at`, with a `Retry-After` header. Only with `?wait=true`: a background call is answered `202` before the quota is read.
13376
+ */
13377
+ 429: ErrorResponse;
13353
13378
  /**
13354
13379
  * Streaming not implemented
13355
13380
  */
@@ -16974,7 +16999,7 @@ type ListGenerationsData = {
16974
16999
  */
16975
17000
  actor_id?: string;
16976
17001
  /**
16977
- * Filter by the public ID of the parent generation. Returns all generations triggered by that generation — sub-agent invocations. Null-initiated (top-level) generations are not returned.
17002
+ * Filter by the public ID of the parent generation. Returns every generation started by that generation: sub-agent invocations, approval continuations, client-tool re-handoffs and memory-rule handler turns. Top-level generations are not returned.
16978
17003
  *
16979
17004
  */
16980
17005
  initiator_generation_id?: string;
@@ -22495,6 +22520,10 @@ type AddSessionMessageErrors = {
22495
22520
  * The resource does not exist (existence is not leaked).
22496
22521
  */
22497
22522
  404: ErrorResponse;
22523
+ /**
22524
+ * `QUOTA_EXCEEDED`: the session auto-generates and an `enforce`-mode generation quota is exhausted. `error.meta` carries `quota_id`, `metric`, `limit`, `window` and `resets_at`, with a `Retry-After` header. The message is saved. A session with `message_delay_seconds` answers `201` before the quota is read.
22525
+ */
22526
+ 429: ErrorResponse;
22498
22527
  };
22499
22528
  type AddSessionMessageError = AddSessionMessageErrors[keyof AddSessionMessageErrors];
22500
22529
  type AddSessionMessageResponses = {
@@ -22549,6 +22578,10 @@ type GenerateSessionResponseErrors = {
22549
22578
  * Session has expired due to inactivity
22550
22579
  */
22551
22580
  410: ErrorResponse;
22581
+ /**
22582
+ * `QUOTA_EXCEEDED`: an `enforce`-mode generation quota is exhausted. `error.meta` carries `quota_id`, `metric`, `limit`, `window` and `resets_at`, with a `Retry-After` header. Only with `?wait=true`: a background call is answered `202` before the quota is read.
22583
+ */
22584
+ 429: ErrorResponse;
22552
22585
  /**
22553
22586
  * Upstream AI provider error (AI_PROVIDER_ERROR). The error `meta` includes the `generation_id` and `trace_id` of the failed generation for post-mortem debugging via GET /v1/projects/{project_id}/generations/{generation_id}.
22554
22587
  *
@@ -22598,6 +22631,11 @@ type SubmitSessionToolOutputsErrors = {
22598
22631
  * The resource does not exist (existence is not leaked).
22599
22632
  */
22600
22633
  404: ErrorResponse;
22634
+ /**
22635
+ * The generation is not paused on client tool calls (GENERATION_NOT_AWAITING_TOOL_OUTPUTS): it never paused, or its outputs were already submitted. Each pause accepts outputs once.
22636
+ *
22637
+ */
22638
+ 409: ErrorResponse;
22601
22639
  };
22602
22640
  type SubmitSessionToolOutputsError = SubmitSessionToolOutputsErrors[keyof SubmitSessionToolOutputsErrors];
22603
22641
  type SubmitSessionToolOutputsResponses = {
@@ -25226,7 +25264,7 @@ export declare class Channels {
25226
25264
  * Connect a channel
25227
25265
  *
25228
25266
  * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
25229
- * **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). Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
25267
+ * **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. Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
25230
25268
  * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
25231
25269
  * * **BYOT** (`credential_source: byot`, default) — supply
25232
25270
  * `phone_number_id` and `access_token` from your own Meta app.
package/dist/index.d.mts CHANGED
@@ -2481,6 +2481,22 @@ type Channel = {
2481
2481
  * Whether an access token is on file (its value is never returned).
2482
2482
  */
2483
2483
  has_credential: boolean;
2484
+ /**
2485
+ * Why Discord refused this channel's gateway connection, when it did: the worker stops retrying, so the channel stays silent until a `PATCH` changes `bot_token`, `modes` or `status`, which clears it. Null when there is none, and for non-Discord channels.
2486
+ *
2487
+ */
2488
+ gateway_error: {
2489
+ /**
2490
+ * `invalid_bot_token` — the token was reset or revoked. `disallowed_intents` — `mention_threads` needs the privileged Message Content intent enabled on the Discord application.
2491
+ *
2492
+ */
2493
+ code: 'invalid_bot_token' | 'disallowed_intents' | 'gateway_rejected';
2494
+ /**
2495
+ * The gateway close code Discord sent.
2496
+ */
2497
+ close_code: number;
2498
+ at: Date;
2499
+ } | null;
2484
2500
  created_at: Date;
2485
2501
  updated_at: Date;
2486
2502
  };
@@ -2545,7 +2561,7 @@ type ChannelCreate = {
2545
2561
  modes?: DiscordModes;
2546
2562
  };
2547
2563
  /**
2548
- * At least one field is required. For WhatsApp, `access_token` rotates the write-only credential; for Discord, `bot_token` rotates the sealed bot token and `modes` turns the gateway flows on or off. `default` replaces the channel's default action whole when present. The worker picks either change up on its next poll and reconnects.
2564
+ * At least one field is required. For WhatsApp, `access_token` rotates the write-only credential; for Discord, `bot_token` rotates the sealed bot token (checked with Discord as on connect) and `modes` turns the gateway flows on or off. `default` replaces the channel's default action whole when present. The worker picks either change up on its next poll and reconnects.
2549
2565
  *
2550
2566
  */
2551
2567
  type ChannelUpdate = {
@@ -5035,7 +5051,7 @@ type Generation = {
5035
5051
  */
5036
5052
  trace_id?: string;
5037
5053
  /**
5038
- * Public ID of the generation that triggered this one. Set for sub-agent invocations. Null for top-level generations.
5054
+ * Public ID of the generation that started this one: a sub-agent invocation, an approval continuation, a client-tool re-handoff or a memory-rule handler turn. Null for top-level generations.
5039
5055
  *
5040
5056
  */
5041
5057
  initiator_generation_id?: string | null;
@@ -6659,13 +6675,13 @@ type OrchestrationRun = {
6659
6675
  */
6660
6676
  node_executions?: Array<NodeExecution>;
6661
6677
  /**
6662
- * What the run cost: token counts and `cost_usd` summed across every metered generation it produced **and every run it started** through `loop` / `sub_orchestration` nodes, at any depth. Present on the single-run read; omitted from run list responses.
6678
+ * What the run cost: token counts and `cost_usd` summed across every metered generation it produced **and every run it started** through `loop` / `sub_orchestration` nodes, at any depth. Present only on the single-run read (`GET /v1/projects/{project_id}/orchestration-runs/{orchestration_run_id}`); omitted from run lists and from every write's response, including a start with `wait: true`.
6663
6679
  *
6664
6680
  * A nested child is a run record of its own, so this figure spans several of them. Two consequences: summing `usage` across a list that mixes parents and children double-counts (filter with `nested=false`), and the per-event receipt at `/v1/projects/{project_id}/usage/receipt` stays scoped to one run — its line items carry a `node_id` from one graph only.
6665
6681
  */
6666
6682
  usage?: UsageTotals;
6667
6683
  /**
6668
- * The same roll-up restricted to **this run's own nodes**, excluding every nested run it started. Equal to `usage` for a run with no children; below it for a run that delegates. Present on the single-run read; omitted from run list responses.
6684
+ * The same roll-up restricted to **this run's own nodes**, excluding every nested run it started. Equal to `usage` for a run with no children; below it for a run that delegates. Present only on the single-run read, like `usage`.
6669
6685
  *
6670
6686
  * This is the field to read to see where cost sits in a run tree — own versus subtree — without walking the children.
6671
6687
  */
@@ -10465,7 +10481,7 @@ type CreateAgentGenerationErrors = {
10465
10481
  */
10466
10482
  409: ErrorResponse;
10467
10483
  /**
10468
- * `SHARE_CAP_EXCEEDED`: the agent is another project's, reached through a share whose `cap` is spent for the window. Carries a `Retry-After` header and `error.meta.retry_after`.
10484
+ * `QUOTA_EXCEEDED`: an `enforce`-mode generation quota is exhausted; `error.meta` carries `quota_id`, `metric`, `limit`, `window` and `resets_at`. `SHARE_CAP_EXCEEDED`: the agent is another project's, reached through a share whose `cap` is spent for the window; `error.meta.retry_after` says when. Both carry a `Retry-After` header.
10469
10485
  */
10470
10486
  429: ErrorResponse;
10471
10487
  /**
@@ -10522,6 +10538,11 @@ type SubmitAgentToolOutputsErrors = {
10522
10538
  * Agent or generation not found
10523
10539
  */
10524
10540
  404: ErrorResponse;
10541
+ /**
10542
+ * The generation is not paused on client tool calls (GENERATION_NOT_AWAITING_TOOL_OUTPUTS): it never paused, or its outputs were already submitted. Each pause accepts outputs once.
10543
+ *
10544
+ */
10545
+ 409: ErrorResponse;
10525
10546
  /**
10526
10547
  * Upstream AI provider error (AI_PROVIDER_ERROR); model output that does not satisfy the agent's `output_schema` (OUTPUT_SCHEMA_VALIDATION_FAILED); or a model that wrote a tool invocation out as plain assistant text instead of calling the tool (TEXT_ENCODED_TOOL_CALL — `meta.tool_name` names the tool). The resumed generation is recorded `failed`.
10527
10548
  *
@@ -13350,6 +13371,10 @@ type GenerateConversationMessageErrors = {
13350
13371
  * Conversation or actor not found
13351
13372
  */
13352
13373
  404: ErrorResponse;
13374
+ /**
13375
+ * `QUOTA_EXCEEDED`: an `enforce`-mode generation quota is exhausted. `error.meta` carries `quota_id`, `metric`, `limit`, `window` and `resets_at`, with a `Retry-After` header. Only with `?wait=true`: a background call is answered `202` before the quota is read.
13376
+ */
13377
+ 429: ErrorResponse;
13353
13378
  /**
13354
13379
  * Streaming not implemented
13355
13380
  */
@@ -16974,7 +16999,7 @@ type ListGenerationsData = {
16974
16999
  */
16975
17000
  actor_id?: string;
16976
17001
  /**
16977
- * Filter by the public ID of the parent generation. Returns all generations triggered by that generation — sub-agent invocations. Null-initiated (top-level) generations are not returned.
17002
+ * Filter by the public ID of the parent generation. Returns every generation started by that generation: sub-agent invocations, approval continuations, client-tool re-handoffs and memory-rule handler turns. Top-level generations are not returned.
16978
17003
  *
16979
17004
  */
16980
17005
  initiator_generation_id?: string;
@@ -22495,6 +22520,10 @@ type AddSessionMessageErrors = {
22495
22520
  * The resource does not exist (existence is not leaked).
22496
22521
  */
22497
22522
  404: ErrorResponse;
22523
+ /**
22524
+ * `QUOTA_EXCEEDED`: the session auto-generates and an `enforce`-mode generation quota is exhausted. `error.meta` carries `quota_id`, `metric`, `limit`, `window` and `resets_at`, with a `Retry-After` header. The message is saved. A session with `message_delay_seconds` answers `201` before the quota is read.
22525
+ */
22526
+ 429: ErrorResponse;
22498
22527
  };
22499
22528
  type AddSessionMessageError = AddSessionMessageErrors[keyof AddSessionMessageErrors];
22500
22529
  type AddSessionMessageResponses = {
@@ -22549,6 +22578,10 @@ type GenerateSessionResponseErrors = {
22549
22578
  * Session has expired due to inactivity
22550
22579
  */
22551
22580
  410: ErrorResponse;
22581
+ /**
22582
+ * `QUOTA_EXCEEDED`: an `enforce`-mode generation quota is exhausted. `error.meta` carries `quota_id`, `metric`, `limit`, `window` and `resets_at`, with a `Retry-After` header. Only with `?wait=true`: a background call is answered `202` before the quota is read.
22583
+ */
22584
+ 429: ErrorResponse;
22552
22585
  /**
22553
22586
  * Upstream AI provider error (AI_PROVIDER_ERROR). The error `meta` includes the `generation_id` and `trace_id` of the failed generation for post-mortem debugging via GET /v1/projects/{project_id}/generations/{generation_id}.
22554
22587
  *
@@ -22598,6 +22631,11 @@ type SubmitSessionToolOutputsErrors = {
22598
22631
  * The resource does not exist (existence is not leaked).
22599
22632
  */
22600
22633
  404: ErrorResponse;
22634
+ /**
22635
+ * The generation is not paused on client tool calls (GENERATION_NOT_AWAITING_TOOL_OUTPUTS): it never paused, or its outputs were already submitted. Each pause accepts outputs once.
22636
+ *
22637
+ */
22638
+ 409: ErrorResponse;
22601
22639
  };
22602
22640
  type SubmitSessionToolOutputsError = SubmitSessionToolOutputsErrors[keyof SubmitSessionToolOutputsErrors];
22603
22641
  type SubmitSessionToolOutputsResponses = {
@@ -25226,7 +25264,7 @@ export declare class Channels {
25226
25264
  * Connect a channel
25227
25265
  *
25228
25266
  * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
25229
- * **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). Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
25267
+ * **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. Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
25230
25268
  * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
25231
25269
  * * **BYOT** (`credential_source: byot`, default) — supply
25232
25270
  * `phone_number_id` and `access_token` from your own Meta app.
package/dist/index.mjs CHANGED
@@ -914,7 +914,7 @@ var Channels = class {
914
914
  * Connect a channel
915
915
  *
916
916
  * Connect a channel. The required fields depend on `channel`; no credential is ever returned.
917
- * **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). Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
917
+ * **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. Returns `501` when the deployment has no `CHANNEL_TOKEN_KEY` configured.
918
918
  * **WhatsApp** (default) — one of two credential paths, both filling the same write-only secret:
919
919
  * * **BYOT** (`credential_source: byot`, default) — supply
920
920
  * `phone_number_id` and `access_token` from your own Meta app.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.173.2",
3
+ "version": "0.173.4",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "devDependencies": {
33
33
  "@hey-api/openapi-ts": "^0.99.0",
34
- "@naturali/api": "0.173.2",
34
+ "@naturali/api": "0.173.4",
35
35
  "@ttoss/openapi-codegen": "^0.5.0",
36
36
  "@types/node": "^26.5.1",
37
37
  "tsdown": "^0.23.0",