@naturali/sdk 0.120.2 → 0.120.3

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
@@ -3271,7 +3271,8 @@ var Orchestrations = class {
3271
3271
  /**
3272
3272
  * Get orchestration queue stats
3273
3273
  *
3274
- * Returns a point-in-time snapshot of the orchestration run queue: how many tasks are waiting to be claimed (`queue_depth`), how many are currently claimed with a valid lease (`claimed_tasks`), the age of the oldest waiting task, recent claim-latency percentiles over a rolling in-process window, and a per-project breakdown. Intended for admin/operator policies; guarded by `orchestrations:GetQueueStats`. A project-scoped caller sees only their own projects under `per_project`.
3274
+ * Returns a point-in-time snapshot of the orchestration run queue: how many tasks are waiting to be claimed (`queue_depth`), how many are currently claimed with a valid lease (`claimed_tasks`), the age of the oldest waiting task, recent claim-latency percentiles over a rolling in-process window, and a per-project breakdown. Intended for admin/operator policies; guarded by `orchestrations:GetQueueStats`.
3275
+ * Every figure is scoped to what the caller may see. A project-scoped caller gets `per_project` for their own projects only, `queue_depth` and `claimed_tasks` summed over those same projects, and `null` for `oldest_queued_age_seconds` and the `claim_latency_ms` percentiles — both describe the whole deployment and cannot be narrowed, so they are withheld rather than approximated. An unrestricted caller (the action granted on every project) gets the deployment-wide figures.
3275
3276
  *
3276
3277
  */
3277
3278
  static getQueueStats(options) {
@@ -4077,6 +4078,7 @@ var Tools = class {
4077
4078
  * Directly invokes a tool and returns its output. Supported for `http`, `mcp`, and `pipeline` tools. `client` tools cannot be invoked server-side and will return 422. A `pipeline` tool runs its declared steps in order and returns the mapped `output` (or the last step's output); `action` is ignored and `input` is the pipeline input.
4078
4079
  * For `mcp` tools the `action` field is required and identifies which tool name to invoke. For `http` tools `action` is ignored. When an `mcp` tool declares an `actions` allowlist, an action outside it is rejected with `400 VALIDATION_FAILED` ("not available on this tool") before any outbound request is made.
4079
4080
  * `preset_parameters` stored on the tool are pinned over the caller-supplied `input` before execution: a key the tool presets keeps its preset value even when `input` sets it. Keys the presets do not name are taken from `input` as sent.
4081
+ * Guardrails attached to the tool or to its project adjudicate the call before dispatch, composing project + tool scope. A call this route cannot await a decision on — class C (human sign-off), class D, or a class-B tripwire — is refused with `422 TOOL_DISPATCH_FAILED`, whose `meta` carries the `tool_id` and the `outcome`. A `pipeline` tool is adjudicated before its first step runs, and every step is adjudicated as the call of that tool it is.
4080
4082
  *
4081
4083
  */
4082
4084
  static callTool(options) {
@@ -4194,7 +4196,8 @@ var Triggers = class {
4194
4196
  /**
4195
4197
  * Update a trigger
4196
4198
  *
4197
- * Updates an existing trigger's configuration. The type is immutable.
4199
+ * Updates an existing trigger's configuration. The type is immutable. Changing `target_type` or `target_id` re-checks the target-start action (`orchestrations:StartRun`, `agents:CreateAgentGeneration` or `tools:CallTool`) against the resulting target, because a firing runs with the trigger creator's authority rather than the updater's. A caller who could not start the new target is answered `403` and the trigger keeps the target it had.
4200
+ *
4198
4201
  */
4199
4202
  static updateTrigger(options) {
4200
4203
  return (options.client ?? client).patch({
package/dist/index.d.cts CHANGED
@@ -340,7 +340,7 @@ type ActivityEntry = {
340
340
  /**
341
341
  * How the entry was produced
342
342
  */
343
- kind?: 'action_executed' | 'approval_resolved' | 'exception_created' | 'schedule_fired';
343
+ kind?: 'action_executed' | 'approval_created' | 'approval_resolved' | 'exception_created' | 'schedule_fired';
344
344
  severity?: 'info' | 'warning' | 'critical';
345
345
  /**
346
346
  * One-line, human-readable description
@@ -1291,6 +1291,8 @@ type CreateToolRequest = {
1291
1291
  *
1292
1292
  * Credential fields accept `{{secret:...}}` references and should use them — a tool is readable by anyone who can `GET /tools`, and the stored reference is what is echoed back, never the resolved value.
1293
1293
  *
1294
+ * A credential written as a **literal** is stored and still sent on every call, but it is masked on every read: `secret_access_key`, `session_token` and `credentials` under `auth`, and any credential-named `headers` value (`Authorization`, `Cookie`, or a name containing `api-key`/`token`/`secret`/`password`), come back as `{"no_echo": true}`. The mask is an object rather than a string so a read-edit-write round trip fails the schema check instead of writing the placeholder in as the credential. A value carrying a `{{secret:...}}` reference is the wiring, not the credential, and stays readable.
1295
+ *
1294
1296
  * `headers` values additionally accept `{{context:<key>}}` references, resolved per call from the caller's `tool_context`, so a per-user credential can be placed in the real header the target expects (`Authorization: Bearer {{context:ocaToken}}`) instead of only in an `X-Naturali-Context-<key>` header. Valid **only** inside `headers` — a context value is caller-supplied, so it may not steer the `url` — and a key missing from the `tool_context` at call time fails the tool call with `MISSING_TOOL_CONTEXT_KEY` rather than sending an empty credential. See the Tool Context reference.
1295
1297
  *
1296
1298
  */
@@ -1298,7 +1300,7 @@ type CreateToolRequest = {
1298
1300
  [key: string]: unknown;
1299
1301
  };
1300
1302
  /**
1301
- * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only.
1303
+ * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only. A literal credential in `headers` is masked on read, exactly as in `execute`.
1302
1304
  */
1303
1305
  mcp?: {
1304
1306
  [key: string]: unknown;
@@ -2785,7 +2787,7 @@ type FormationTemplate = {
2785
2787
  [key: string]: ResourceDeclaration;
2786
2788
  };
2787
2789
  /**
2788
- * Map of output names to values. Values may use `{ "ref": "logicalId" }` to reference physical IDs of created resources, or `{ "param": "ParamName" }` and `{ "sub": "text ${ParamName}" }` to embed parameter values.
2790
+ * Map of output names to values. Values may use `{ "ref": "logicalId" }` to reference physical IDs of created resources, or `{ "param": "ParamName" }` and `{ "sub": "text ${ParamName}" }` to embed parameter values. `{ "ref_attr": "LogicalId.attribute" }` resolves a named attribute of a created resource, except one carrying credential material — a trigger's or webhook's `secret` is refused with 400 VALIDATION_FAILED, since a formation is readable by anyone holding `formations:GetFormation`. Read those from the resource's own secret route instead.
2789
2791
  *
2790
2792
  */
2791
2793
  outputs?: {
@@ -3745,9 +3747,14 @@ type Formation = {
3745
3747
  * Human-readable formation name
3746
3748
  */
3747
3749
  name?: string;
3750
+ /**
3751
+ * The template as deployed. Credential-bearing properties — a `secret` resource's `value`, and any property a custom resource type declares `write_only` — read back as `{ "no_echo": true }` rather than the value that was supplied.
3752
+ *
3753
+ */
3748
3754
  template?: FormationTemplate;
3749
3755
  /**
3750
- * Resolved output values after stack deployment
3756
+ * Resolved output values after stack deployment. An output that resolved a credential attribute on a formation deployed before those were refused is omitted.
3757
+ *
3751
3758
  */
3752
3759
  outputs?: {
3753
3760
  [key: string]: string;
@@ -4681,19 +4688,19 @@ type QueueStats = {
4681
4688
  */
4682
4689
  driver?: 'postgres' | 'sqs';
4683
4690
  /**
4684
- * Tasks waiting to be claimed now (unclaimed and past their `available_at`). Backoff-delayed tasks are excluded.
4691
+ * Tasks waiting to be claimed now (unclaimed and past their `available_at`). Backoff-delayed tasks are excluded. Summed over the caller's own projects when the caller is project-scoped.
4685
4692
  */
4686
4693
  queue_depth?: number;
4687
4694
  /**
4688
- * Tasks currently claimed with a valid (unexpired) lease.
4695
+ * Tasks currently claimed with a valid (unexpired) lease. Summed over the caller's own projects when the caller is project-scoped.
4689
4696
  */
4690
4697
  claimed_tasks?: number;
4691
4698
  /**
4692
- * Age in seconds of the oldest claimable-now task, or `null` when none are waiting.
4699
+ * Age in seconds of the oldest claimable-now task, or `null` when none are waiting. Also `null` for a project-scoped caller: the figure is deployment-wide.
4693
4700
  */
4694
4701
  oldest_queued_age_seconds?: number | null;
4695
4702
  /**
4696
- * Claim-latency percentiles (time from a task becoming available to being claimed) over a rolling in-process window. `p50`/`p95` are `null` when no claim happened in the window.
4703
+ * Claim-latency percentiles (time from a task becoming available to being claimed) over a rolling in-process window. `p50`/`p95` are `null` when no claim happened in the window, and for a project-scoped caller: the window is deployment-wide.
4697
4704
  */
4698
4705
  claim_latency_ms?: {
4699
4706
  p50?: number | null;
@@ -5981,6 +5988,8 @@ type Tool = {
5981
5988
  *
5982
5989
  * Credential fields accept `{{secret:...}}` references and should use them — a tool is readable by anyone who can `GET /tools`, and the stored reference is what is echoed back, never the resolved value.
5983
5990
  *
5991
+ * A credential written as a **literal** is stored and still sent on every call, but it is masked on every read: `secret_access_key`, `session_token` and `credentials` under `auth`, and any credential-named `headers` value (`Authorization`, `Cookie`, or a name containing `api-key`/`token`/`secret`/`password`), come back as `{"no_echo": true}`. The mask is an object rather than a string so a read-edit-write round trip fails the schema check instead of writing the placeholder in as the credential. A value carrying a `{{secret:...}}` reference is the wiring, not the credential, and stays readable.
5992
+ *
5984
5993
  * `headers` values additionally accept `{{context:<key>}}` references, resolved per call from the caller's `tool_context`, so a per-user credential can be placed in the real header the target expects (`Authorization: Bearer {{context:ocaToken}}`) instead of only in a prefixed context header. Valid **only** inside `headers` — a context value is caller-supplied, so it may not steer the `url` — and a key missing from the `tool_context` at call time fails the tool call with `MISSING_TOOL_CONTEXT_KEY` rather than sending an empty credential. See the Tool Context reference.
5985
5994
  *
5986
5995
  */
@@ -5988,7 +5997,7 @@ type Tool = {
5988
5997
  [key: string]: unknown;
5989
5998
  } | null;
5990
5999
  /**
5991
- * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only.
6000
+ * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only. A literal credential in `headers` is masked on read, exactly as in `execute`.
5992
6001
  */
5993
6002
  mcp?: {
5994
6003
  [key: string]: unknown;
@@ -6049,6 +6058,8 @@ type UpdateToolRequest = {
6049
6058
  *
6050
6059
  * Credential fields accept `{{secret:...}}` references and should use them — a tool is readable by anyone who can `GET /tools`, and the stored reference is what is echoed back, never the resolved value.
6051
6060
  *
6061
+ * A credential written as a **literal** is stored and still sent on every call, but it is masked on every read: `secret_access_key`, `session_token` and `credentials` under `auth`, and any credential-named `headers` value (`Authorization`, `Cookie`, or a name containing `api-key`/`token`/`secret`/`password`), come back as `{"no_echo": true}`. The mask is an object rather than a string so a read-edit-write round trip fails the schema check instead of writing the placeholder in as the credential. A value carrying a `{{secret:...}}` reference is the wiring, not the credential, and stays readable.
6062
+ *
6052
6063
  * `headers` values additionally accept `{{context:<key>}}` references, resolved per call from the caller's `tool_context`, so a per-user credential can be placed in the real header the target expects (`Authorization: Bearer {{context:ocaToken}}`) instead of only in an `X-Naturali-Context-<key>` header. Valid **only** inside `headers` — a context value is caller-supplied, so it may not steer the `url` — and a key missing from the `tool_context` at call time fails the tool call with `MISSING_TOOL_CONTEXT_KEY` rather than sending an empty credential. See the Tool Context reference.
6053
6064
  *
6054
6065
  */
@@ -6056,7 +6067,7 @@ type UpdateToolRequest = {
6056
6067
  [key: string]: unknown;
6057
6068
  } | null;
6058
6069
  /**
6059
- * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only.
6070
+ * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only. A literal credential in `headers` is masked on read, exactly as in `execute`.
6060
6071
  */
6061
6072
  mcp?: {
6062
6073
  [key: string]: unknown;
@@ -6816,7 +6827,7 @@ type ListActivityData = {
6816
6827
  /**
6817
6828
  * Filter by activity kind
6818
6829
  */
6819
- kind?: 'action_executed' | 'approval_resolved' | 'exception_created' | 'schedule_fired';
6830
+ kind?: 'action_executed' | 'approval_created' | 'approval_resolved' | 'exception_created' | 'schedule_fired';
6820
6831
  /**
6821
6832
  * Filter by severity
6822
6833
  */
@@ -9026,7 +9037,7 @@ type GetApprovalResponse = GetApprovalResponses[keyof GetApprovalResponses];
9026
9037
  type ApproveApprovalData = {
9027
9038
  body?: {
9028
9039
  /**
9029
- * Edited arguments to execute instead of the proposed ones
9040
+ * Edited arguments to execute instead of the proposed ones. Editing composes a new call, so it additionally requires permission to make that call: `tools:CallTool` on the tool, and for a `builtin` proposal the action's own IAM action.
9030
9041
  */
9031
9042
  arguments?: {
9032
9043
  [key: string]: unknown;
@@ -9047,7 +9058,7 @@ type ApproveApprovalData = {
9047
9058
  };
9048
9059
  type ApproveApprovalErrors = {
9049
9060
  /**
9050
- * Edited arguments are not a JSON object
9061
+ * Edited arguments are not a JSON object, or do not satisfy the tool's parameters schema
9051
9062
  */
9052
9063
  400: unknown;
9053
9064
  /**
@@ -9055,7 +9066,7 @@ type ApproveApprovalErrors = {
9055
9066
  */
9056
9067
  401: unknown;
9057
9068
  /**
9058
- * Forbidden
9069
+ * Forbidden — including an edit by a caller who may resolve the item but not make the call it proposes
9059
9070
  */
9060
9071
  403: unknown;
9061
9072
  /**
@@ -11445,7 +11456,7 @@ type CreateEmbeddingsData = {
11445
11456
  */
11446
11457
  input?: string;
11447
11458
  /**
11448
- * Batch of texts to embed.
11459
+ * Batch of texts to embed. At most 256 per request — each input is one call to the embedding model, so a larger batch is refused (`VALIDATION_FAILED`) rather than queued. Split it across requests.
11449
11460
  */
11450
11461
  inputs?: Array<string>;
11451
11462
  };
@@ -12764,6 +12775,10 @@ type UploadFileErrors = {
12764
12775
  * The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
12765
12776
  */
12766
12777
  409: ErrorResponse;
12778
+ /**
12779
+ * The upload is over this deployment's byte ceiling (`UPLOAD_TOO_LARGE`; `FILE_UPLOAD_MAX_BYTES`, 25 MB by default). The request is refused while the body is still streaming, so nothing was stored.
12780
+ */
12781
+ 413: ErrorResponse;
12767
12782
  };
12768
12783
  type UploadFileError = UploadFileErrors[keyof UploadFileErrors];
12769
12784
  type UploadFileResponses = {
@@ -14128,7 +14143,7 @@ type ListIngestionRulesResponse = ListIngestionRulesResponses[keyof ListIngestio
14128
14143
  type CreateIngestionRuleData = {
14129
14144
  body: {
14130
14145
  /**
14131
- * MIME type glob matched against a file's content_type
14146
+ * MIME type glob matched against a file's content_type. At most 4 wildcards and 255 characters — a MIME glob needs one on each side of the slash at most.
14132
14147
  */
14133
14148
  content_type_glob: string;
14134
14149
  /**
@@ -14288,6 +14303,9 @@ type GetIngestionRuleResponses = {
14288
14303
  type GetIngestionRuleResponse = GetIngestionRuleResponses[keyof GetIngestionRuleResponses];
14289
14304
  type UpdateIngestionRuleData = {
14290
14305
  body: {
14306
+ /**
14307
+ * MIME type glob matched against a file's content_type. At most 4 wildcards and 255 characters.
14308
+ */
14291
14309
  content_type_glob?: string;
14292
14310
  tool_id?: string | null;
14293
14311
  agent_id?: string | null;
@@ -14360,7 +14378,7 @@ type SearchKnowledgeData = {
14360
14378
  */
14361
14379
  min_score?: number;
14362
14380
  /**
14363
- * Maximum number of results to return (default 10)
14381
+ * Maximum number of results to return (default 10). A value above 100 is clamped to 100 — the ceiling bounds the vector scan this one request performs, so a larger `limit` returns everything there is up to that many rows rather than being refused.
14364
14382
  */
14365
14383
  limit?: number;
14366
14384
  /**
@@ -20433,7 +20451,8 @@ declare class Orchestrations {
20433
20451
  /**
20434
20452
  * Get orchestration queue stats
20435
20453
  *
20436
- * Returns a point-in-time snapshot of the orchestration run queue: how many tasks are waiting to be claimed (`queue_depth`), how many are currently claimed with a valid lease (`claimed_tasks`), the age of the oldest waiting task, recent claim-latency percentiles over a rolling in-process window, and a per-project breakdown. Intended for admin/operator policies; guarded by `orchestrations:GetQueueStats`. A project-scoped caller sees only their own projects under `per_project`.
20454
+ * Returns a point-in-time snapshot of the orchestration run queue: how many tasks are waiting to be claimed (`queue_depth`), how many are currently claimed with a valid lease (`claimed_tasks`), the age of the oldest waiting task, recent claim-latency percentiles over a rolling in-process window, and a per-project breakdown. Intended for admin/operator policies; guarded by `orchestrations:GetQueueStats`.
20455
+ * Every figure is scoped to what the caller may see. A project-scoped caller gets `per_project` for their own projects only, `queue_depth` and `claimed_tasks` summed over those same projects, and `null` for `oldest_queued_age_seconds` and the `claim_latency_ms` percentiles — both describe the whole deployment and cannot be narrowed, so they are withheld rather than approximated. An unrestricted caller (the action granted on every project) gets the deployment-wide figures.
20437
20456
  *
20438
20457
  */
20439
20458
  static getQueueStats<ThrowOnError extends boolean = false>(options: Options<GetQueueStatsData, ThrowOnError>): RequestResult<GetQueueStatsResponses, GetQueueStatsErrors, ThrowOnError>;
@@ -20845,6 +20864,7 @@ declare class Tools {
20845
20864
  * Directly invokes a tool and returns its output. Supported for `http`, `mcp`, and `pipeline` tools. `client` tools cannot be invoked server-side and will return 422. A `pipeline` tool runs its declared steps in order and returns the mapped `output` (or the last step's output); `action` is ignored and `input` is the pipeline input.
20846
20865
  * For `mcp` tools the `action` field is required and identifies which tool name to invoke. For `http` tools `action` is ignored. When an `mcp` tool declares an `actions` allowlist, an action outside it is rejected with `400 VALIDATION_FAILED` ("not available on this tool") before any outbound request is made.
20847
20866
  * `preset_parameters` stored on the tool are pinned over the caller-supplied `input` before execution: a key the tool presets keeps its preset value even when `input` sets it. Keys the presets do not name are taken from `input` as sent.
20867
+ * Guardrails attached to the tool or to its project adjudicate the call before dispatch, composing project + tool scope. A call this route cannot await a decision on — class C (human sign-off), class D, or a class-B tripwire — is refused with `422 TOOL_DISPATCH_FAILED`, whose `meta` carries the `tool_id` and the `outcome`. A `pipeline` tool is adjudicated before its first step runs, and every step is adjudicated as the call of that tool it is.
20848
20868
  *
20849
20869
  */
20850
20870
  static callTool<ThrowOnError extends boolean = false>(options: Options<CallToolData, ThrowOnError>): RequestResult<CallToolResponses, CallToolErrors, ThrowOnError>;
@@ -20909,7 +20929,8 @@ declare class Triggers {
20909
20929
  /**
20910
20930
  * Update a trigger
20911
20931
  *
20912
- * Updates an existing trigger's configuration. The type is immutable.
20932
+ * Updates an existing trigger's configuration. The type is immutable. Changing `target_type` or `target_id` re-checks the target-start action (`orchestrations:StartRun`, `agents:CreateAgentGeneration` or `tools:CallTool`) against the resulting target, because a firing runs with the trigger creator's authority rather than the updater's. A caller who could not start the new target is answered `403` and the trigger keeps the target it had.
20933
+ *
20913
20934
  */
20914
20935
  static updateTrigger<ThrowOnError extends boolean = false>(options: Options<UpdateTriggerData, ThrowOnError>): RequestResult<UpdateTriggerResponses, UpdateTriggerErrors, ThrowOnError>;
20915
20936
  /**
package/dist/index.d.mts CHANGED
@@ -340,7 +340,7 @@ type ActivityEntry = {
340
340
  /**
341
341
  * How the entry was produced
342
342
  */
343
- kind?: 'action_executed' | 'approval_resolved' | 'exception_created' | 'schedule_fired';
343
+ kind?: 'action_executed' | 'approval_created' | 'approval_resolved' | 'exception_created' | 'schedule_fired';
344
344
  severity?: 'info' | 'warning' | 'critical';
345
345
  /**
346
346
  * One-line, human-readable description
@@ -1291,6 +1291,8 @@ type CreateToolRequest = {
1291
1291
  *
1292
1292
  * Credential fields accept `{{secret:...}}` references and should use them — a tool is readable by anyone who can `GET /tools`, and the stored reference is what is echoed back, never the resolved value.
1293
1293
  *
1294
+ * A credential written as a **literal** is stored and still sent on every call, but it is masked on every read: `secret_access_key`, `session_token` and `credentials` under `auth`, and any credential-named `headers` value (`Authorization`, `Cookie`, or a name containing `api-key`/`token`/`secret`/`password`), come back as `{"no_echo": true}`. The mask is an object rather than a string so a read-edit-write round trip fails the schema check instead of writing the placeholder in as the credential. A value carrying a `{{secret:...}}` reference is the wiring, not the credential, and stays readable.
1295
+ *
1294
1296
  * `headers` values additionally accept `{{context:<key>}}` references, resolved per call from the caller's `tool_context`, so a per-user credential can be placed in the real header the target expects (`Authorization: Bearer {{context:ocaToken}}`) instead of only in an `X-Naturali-Context-<key>` header. Valid **only** inside `headers` — a context value is caller-supplied, so it may not steer the `url` — and a key missing from the `tool_context` at call time fails the tool call with `MISSING_TOOL_CONTEXT_KEY` rather than sending an empty credential. See the Tool Context reference.
1295
1297
  *
1296
1298
  */
@@ -1298,7 +1300,7 @@ type CreateToolRequest = {
1298
1300
  [key: string]: unknown;
1299
1301
  };
1300
1302
  /**
1301
- * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only.
1303
+ * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only. A literal credential in `headers` is masked on read, exactly as in `execute`.
1302
1304
  */
1303
1305
  mcp?: {
1304
1306
  [key: string]: unknown;
@@ -2785,7 +2787,7 @@ type FormationTemplate = {
2785
2787
  [key: string]: ResourceDeclaration;
2786
2788
  };
2787
2789
  /**
2788
- * Map of output names to values. Values may use `{ "ref": "logicalId" }` to reference physical IDs of created resources, or `{ "param": "ParamName" }` and `{ "sub": "text ${ParamName}" }` to embed parameter values.
2790
+ * Map of output names to values. Values may use `{ "ref": "logicalId" }` to reference physical IDs of created resources, or `{ "param": "ParamName" }` and `{ "sub": "text ${ParamName}" }` to embed parameter values. `{ "ref_attr": "LogicalId.attribute" }` resolves a named attribute of a created resource, except one carrying credential material — a trigger's or webhook's `secret` is refused with 400 VALIDATION_FAILED, since a formation is readable by anyone holding `formations:GetFormation`. Read those from the resource's own secret route instead.
2789
2791
  *
2790
2792
  */
2791
2793
  outputs?: {
@@ -3745,9 +3747,14 @@ type Formation = {
3745
3747
  * Human-readable formation name
3746
3748
  */
3747
3749
  name?: string;
3750
+ /**
3751
+ * The template as deployed. Credential-bearing properties — a `secret` resource's `value`, and any property a custom resource type declares `write_only` — read back as `{ "no_echo": true }` rather than the value that was supplied.
3752
+ *
3753
+ */
3748
3754
  template?: FormationTemplate;
3749
3755
  /**
3750
- * Resolved output values after stack deployment
3756
+ * Resolved output values after stack deployment. An output that resolved a credential attribute on a formation deployed before those were refused is omitted.
3757
+ *
3751
3758
  */
3752
3759
  outputs?: {
3753
3760
  [key: string]: string;
@@ -4681,19 +4688,19 @@ type QueueStats = {
4681
4688
  */
4682
4689
  driver?: 'postgres' | 'sqs';
4683
4690
  /**
4684
- * Tasks waiting to be claimed now (unclaimed and past their `available_at`). Backoff-delayed tasks are excluded.
4691
+ * Tasks waiting to be claimed now (unclaimed and past their `available_at`). Backoff-delayed tasks are excluded. Summed over the caller's own projects when the caller is project-scoped.
4685
4692
  */
4686
4693
  queue_depth?: number;
4687
4694
  /**
4688
- * Tasks currently claimed with a valid (unexpired) lease.
4695
+ * Tasks currently claimed with a valid (unexpired) lease. Summed over the caller's own projects when the caller is project-scoped.
4689
4696
  */
4690
4697
  claimed_tasks?: number;
4691
4698
  /**
4692
- * Age in seconds of the oldest claimable-now task, or `null` when none are waiting.
4699
+ * Age in seconds of the oldest claimable-now task, or `null` when none are waiting. Also `null` for a project-scoped caller: the figure is deployment-wide.
4693
4700
  */
4694
4701
  oldest_queued_age_seconds?: number | null;
4695
4702
  /**
4696
- * Claim-latency percentiles (time from a task becoming available to being claimed) over a rolling in-process window. `p50`/`p95` are `null` when no claim happened in the window.
4703
+ * Claim-latency percentiles (time from a task becoming available to being claimed) over a rolling in-process window. `p50`/`p95` are `null` when no claim happened in the window, and for a project-scoped caller: the window is deployment-wide.
4697
4704
  */
4698
4705
  claim_latency_ms?: {
4699
4706
  p50?: number | null;
@@ -5981,6 +5988,8 @@ type Tool = {
5981
5988
  *
5982
5989
  * Credential fields accept `{{secret:...}}` references and should use them — a tool is readable by anyone who can `GET /tools`, and the stored reference is what is echoed back, never the resolved value.
5983
5990
  *
5991
+ * A credential written as a **literal** is stored and still sent on every call, but it is masked on every read: `secret_access_key`, `session_token` and `credentials` under `auth`, and any credential-named `headers` value (`Authorization`, `Cookie`, or a name containing `api-key`/`token`/`secret`/`password`), come back as `{"no_echo": true}`. The mask is an object rather than a string so a read-edit-write round trip fails the schema check instead of writing the placeholder in as the credential. A value carrying a `{{secret:...}}` reference is the wiring, not the credential, and stays readable.
5992
+ *
5984
5993
  * `headers` values additionally accept `{{context:<key>}}` references, resolved per call from the caller's `tool_context`, so a per-user credential can be placed in the real header the target expects (`Authorization: Bearer {{context:ocaToken}}`) instead of only in a prefixed context header. Valid **only** inside `headers` — a context value is caller-supplied, so it may not steer the `url` — and a key missing from the `tool_context` at call time fails the tool call with `MISSING_TOOL_CONTEXT_KEY` rather than sending an empty credential. See the Tool Context reference.
5985
5994
  *
5986
5995
  */
@@ -5988,7 +5997,7 @@ type Tool = {
5988
5997
  [key: string]: unknown;
5989
5998
  } | null;
5990
5999
  /**
5991
- * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only.
6000
+ * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only. A literal credential in `headers` is masked on read, exactly as in `execute`.
5992
6001
  */
5993
6002
  mcp?: {
5994
6003
  [key: string]: unknown;
@@ -6049,6 +6058,8 @@ type UpdateToolRequest = {
6049
6058
  *
6050
6059
  * Credential fields accept `{{secret:...}}` references and should use them — a tool is readable by anyone who can `GET /tools`, and the stored reference is what is echoed back, never the resolved value.
6051
6060
  *
6061
+ * A credential written as a **literal** is stored and still sent on every call, but it is masked on every read: `secret_access_key`, `session_token` and `credentials` under `auth`, and any credential-named `headers` value (`Authorization`, `Cookie`, or a name containing `api-key`/`token`/`secret`/`password`), come back as `{"no_echo": true}`. The mask is an object rather than a string so a read-edit-write round trip fails the schema check instead of writing the placeholder in as the credential. A value carrying a `{{secret:...}}` reference is the wiring, not the credential, and stays readable.
6062
+ *
6052
6063
  * `headers` values additionally accept `{{context:<key>}}` references, resolved per call from the caller's `tool_context`, so a per-user credential can be placed in the real header the target expects (`Authorization: Bearer {{context:ocaToken}}`) instead of only in an `X-Naturali-Context-<key>` header. Valid **only** inside `headers` — a context value is caller-supplied, so it may not steer the `url` — and a key missing from the `tool_context` at call time fails the tool call with `MISSING_TOOL_CONTEXT_KEY` rather than sending an empty credential. See the Tool Context reference.
6053
6064
  *
6054
6065
  */
@@ -6056,7 +6067,7 @@ type UpdateToolRequest = {
6056
6067
  [key: string]: unknown;
6057
6068
  } | null;
6058
6069
  /**
6059
- * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only.
6070
+ * MCP server config (`url`, `headers`). `headers` values accept `{{secret:...}}` and `{{context:<key>}}` references, resolved right before the outbound MCP request; `url` accepts `{{secret:...}}` only. A literal credential in `headers` is masked on read, exactly as in `execute`.
6060
6071
  */
6061
6072
  mcp?: {
6062
6073
  [key: string]: unknown;
@@ -6816,7 +6827,7 @@ type ListActivityData = {
6816
6827
  /**
6817
6828
  * Filter by activity kind
6818
6829
  */
6819
- kind?: 'action_executed' | 'approval_resolved' | 'exception_created' | 'schedule_fired';
6830
+ kind?: 'action_executed' | 'approval_created' | 'approval_resolved' | 'exception_created' | 'schedule_fired';
6820
6831
  /**
6821
6832
  * Filter by severity
6822
6833
  */
@@ -9026,7 +9037,7 @@ type GetApprovalResponse = GetApprovalResponses[keyof GetApprovalResponses];
9026
9037
  type ApproveApprovalData = {
9027
9038
  body?: {
9028
9039
  /**
9029
- * Edited arguments to execute instead of the proposed ones
9040
+ * Edited arguments to execute instead of the proposed ones. Editing composes a new call, so it additionally requires permission to make that call: `tools:CallTool` on the tool, and for a `builtin` proposal the action's own IAM action.
9030
9041
  */
9031
9042
  arguments?: {
9032
9043
  [key: string]: unknown;
@@ -9047,7 +9058,7 @@ type ApproveApprovalData = {
9047
9058
  };
9048
9059
  type ApproveApprovalErrors = {
9049
9060
  /**
9050
- * Edited arguments are not a JSON object
9061
+ * Edited arguments are not a JSON object, or do not satisfy the tool's parameters schema
9051
9062
  */
9052
9063
  400: unknown;
9053
9064
  /**
@@ -9055,7 +9066,7 @@ type ApproveApprovalErrors = {
9055
9066
  */
9056
9067
  401: unknown;
9057
9068
  /**
9058
- * Forbidden
9069
+ * Forbidden — including an edit by a caller who may resolve the item but not make the call it proposes
9059
9070
  */
9060
9071
  403: unknown;
9061
9072
  /**
@@ -11445,7 +11456,7 @@ type CreateEmbeddingsData = {
11445
11456
  */
11446
11457
  input?: string;
11447
11458
  /**
11448
- * Batch of texts to embed.
11459
+ * Batch of texts to embed. At most 256 per request — each input is one call to the embedding model, so a larger batch is refused (`VALIDATION_FAILED`) rather than queued. Split it across requests.
11449
11460
  */
11450
11461
  inputs?: Array<string>;
11451
11462
  };
@@ -12764,6 +12775,10 @@ type UploadFileErrors = {
12764
12775
  * The project's `storage_bytes` quota is exceeded (`QUOTA_STORAGE_EXCEEDED`). Delete stored content, or raise the quota — no window reset clears a stored total, so no `Retry-After` is sent.
12765
12776
  */
12766
12777
  409: ErrorResponse;
12778
+ /**
12779
+ * The upload is over this deployment's byte ceiling (`UPLOAD_TOO_LARGE`; `FILE_UPLOAD_MAX_BYTES`, 25 MB by default). The request is refused while the body is still streaming, so nothing was stored.
12780
+ */
12781
+ 413: ErrorResponse;
12767
12782
  };
12768
12783
  type UploadFileError = UploadFileErrors[keyof UploadFileErrors];
12769
12784
  type UploadFileResponses = {
@@ -14128,7 +14143,7 @@ type ListIngestionRulesResponse = ListIngestionRulesResponses[keyof ListIngestio
14128
14143
  type CreateIngestionRuleData = {
14129
14144
  body: {
14130
14145
  /**
14131
- * MIME type glob matched against a file's content_type
14146
+ * MIME type glob matched against a file's content_type. At most 4 wildcards and 255 characters — a MIME glob needs one on each side of the slash at most.
14132
14147
  */
14133
14148
  content_type_glob: string;
14134
14149
  /**
@@ -14288,6 +14303,9 @@ type GetIngestionRuleResponses = {
14288
14303
  type GetIngestionRuleResponse = GetIngestionRuleResponses[keyof GetIngestionRuleResponses];
14289
14304
  type UpdateIngestionRuleData = {
14290
14305
  body: {
14306
+ /**
14307
+ * MIME type glob matched against a file's content_type. At most 4 wildcards and 255 characters.
14308
+ */
14291
14309
  content_type_glob?: string;
14292
14310
  tool_id?: string | null;
14293
14311
  agent_id?: string | null;
@@ -14360,7 +14378,7 @@ type SearchKnowledgeData = {
14360
14378
  */
14361
14379
  min_score?: number;
14362
14380
  /**
14363
- * Maximum number of results to return (default 10)
14381
+ * Maximum number of results to return (default 10). A value above 100 is clamped to 100 — the ceiling bounds the vector scan this one request performs, so a larger `limit` returns everything there is up to that many rows rather than being refused.
14364
14382
  */
14365
14383
  limit?: number;
14366
14384
  /**
@@ -20433,7 +20451,8 @@ declare class Orchestrations {
20433
20451
  /**
20434
20452
  * Get orchestration queue stats
20435
20453
  *
20436
- * Returns a point-in-time snapshot of the orchestration run queue: how many tasks are waiting to be claimed (`queue_depth`), how many are currently claimed with a valid lease (`claimed_tasks`), the age of the oldest waiting task, recent claim-latency percentiles over a rolling in-process window, and a per-project breakdown. Intended for admin/operator policies; guarded by `orchestrations:GetQueueStats`. A project-scoped caller sees only their own projects under `per_project`.
20454
+ * Returns a point-in-time snapshot of the orchestration run queue: how many tasks are waiting to be claimed (`queue_depth`), how many are currently claimed with a valid lease (`claimed_tasks`), the age of the oldest waiting task, recent claim-latency percentiles over a rolling in-process window, and a per-project breakdown. Intended for admin/operator policies; guarded by `orchestrations:GetQueueStats`.
20455
+ * Every figure is scoped to what the caller may see. A project-scoped caller gets `per_project` for their own projects only, `queue_depth` and `claimed_tasks` summed over those same projects, and `null` for `oldest_queued_age_seconds` and the `claim_latency_ms` percentiles — both describe the whole deployment and cannot be narrowed, so they are withheld rather than approximated. An unrestricted caller (the action granted on every project) gets the deployment-wide figures.
20437
20456
  *
20438
20457
  */
20439
20458
  static getQueueStats<ThrowOnError extends boolean = false>(options: Options<GetQueueStatsData, ThrowOnError>): RequestResult<GetQueueStatsResponses, GetQueueStatsErrors, ThrowOnError>;
@@ -20845,6 +20864,7 @@ declare class Tools {
20845
20864
  * Directly invokes a tool and returns its output. Supported for `http`, `mcp`, and `pipeline` tools. `client` tools cannot be invoked server-side and will return 422. A `pipeline` tool runs its declared steps in order and returns the mapped `output` (or the last step's output); `action` is ignored and `input` is the pipeline input.
20846
20865
  * For `mcp` tools the `action` field is required and identifies which tool name to invoke. For `http` tools `action` is ignored. When an `mcp` tool declares an `actions` allowlist, an action outside it is rejected with `400 VALIDATION_FAILED` ("not available on this tool") before any outbound request is made.
20847
20866
  * `preset_parameters` stored on the tool are pinned over the caller-supplied `input` before execution: a key the tool presets keeps its preset value even when `input` sets it. Keys the presets do not name are taken from `input` as sent.
20867
+ * Guardrails attached to the tool or to its project adjudicate the call before dispatch, composing project + tool scope. A call this route cannot await a decision on — class C (human sign-off), class D, or a class-B tripwire — is refused with `422 TOOL_DISPATCH_FAILED`, whose `meta` carries the `tool_id` and the `outcome`. A `pipeline` tool is adjudicated before its first step runs, and every step is adjudicated as the call of that tool it is.
20848
20868
  *
20849
20869
  */
20850
20870
  static callTool<ThrowOnError extends boolean = false>(options: Options<CallToolData, ThrowOnError>): RequestResult<CallToolResponses, CallToolErrors, ThrowOnError>;
@@ -20909,7 +20929,8 @@ declare class Triggers {
20909
20929
  /**
20910
20930
  * Update a trigger
20911
20931
  *
20912
- * Updates an existing trigger's configuration. The type is immutable.
20932
+ * Updates an existing trigger's configuration. The type is immutable. Changing `target_type` or `target_id` re-checks the target-start action (`orchestrations:StartRun`, `agents:CreateAgentGeneration` or `tools:CallTool`) against the resulting target, because a firing runs with the trigger creator's authority rather than the updater's. A caller who could not start the new target is answered `403` and the trigger keeps the target it had.
20933
+ *
20913
20934
  */
20914
20935
  static updateTrigger<ThrowOnError extends boolean = false>(options: Options<UpdateTriggerData, ThrowOnError>): RequestResult<UpdateTriggerResponses, UpdateTriggerErrors, ThrowOnError>;
20915
20936
  /**
package/dist/index.mjs CHANGED
@@ -3270,7 +3270,8 @@ var Orchestrations = class {
3270
3270
  /**
3271
3271
  * Get orchestration queue stats
3272
3272
  *
3273
- * Returns a point-in-time snapshot of the orchestration run queue: how many tasks are waiting to be claimed (`queue_depth`), how many are currently claimed with a valid lease (`claimed_tasks`), the age of the oldest waiting task, recent claim-latency percentiles over a rolling in-process window, and a per-project breakdown. Intended for admin/operator policies; guarded by `orchestrations:GetQueueStats`. A project-scoped caller sees only their own projects under `per_project`.
3273
+ * Returns a point-in-time snapshot of the orchestration run queue: how many tasks are waiting to be claimed (`queue_depth`), how many are currently claimed with a valid lease (`claimed_tasks`), the age of the oldest waiting task, recent claim-latency percentiles over a rolling in-process window, and a per-project breakdown. Intended for admin/operator policies; guarded by `orchestrations:GetQueueStats`.
3274
+ * Every figure is scoped to what the caller may see. A project-scoped caller gets `per_project` for their own projects only, `queue_depth` and `claimed_tasks` summed over those same projects, and `null` for `oldest_queued_age_seconds` and the `claim_latency_ms` percentiles — both describe the whole deployment and cannot be narrowed, so they are withheld rather than approximated. An unrestricted caller (the action granted on every project) gets the deployment-wide figures.
3274
3275
  *
3275
3276
  */
3276
3277
  static getQueueStats(options) {
@@ -4076,6 +4077,7 @@ var Tools = class {
4076
4077
  * Directly invokes a tool and returns its output. Supported for `http`, `mcp`, and `pipeline` tools. `client` tools cannot be invoked server-side and will return 422. A `pipeline` tool runs its declared steps in order and returns the mapped `output` (or the last step's output); `action` is ignored and `input` is the pipeline input.
4077
4078
  * For `mcp` tools the `action` field is required and identifies which tool name to invoke. For `http` tools `action` is ignored. When an `mcp` tool declares an `actions` allowlist, an action outside it is rejected with `400 VALIDATION_FAILED` ("not available on this tool") before any outbound request is made.
4078
4079
  * `preset_parameters` stored on the tool are pinned over the caller-supplied `input` before execution: a key the tool presets keeps its preset value even when `input` sets it. Keys the presets do not name are taken from `input` as sent.
4080
+ * Guardrails attached to the tool or to its project adjudicate the call before dispatch, composing project + tool scope. A call this route cannot await a decision on — class C (human sign-off), class D, or a class-B tripwire — is refused with `422 TOOL_DISPATCH_FAILED`, whose `meta` carries the `tool_id` and the `outcome`. A `pipeline` tool is adjudicated before its first step runs, and every step is adjudicated as the call of that tool it is.
4079
4081
  *
4080
4082
  */
4081
4083
  static callTool(options) {
@@ -4193,7 +4195,8 @@ var Triggers = class {
4193
4195
  /**
4194
4196
  * Update a trigger
4195
4197
  *
4196
- * Updates an existing trigger's configuration. The type is immutable.
4198
+ * Updates an existing trigger's configuration. The type is immutable. Changing `target_type` or `target_id` re-checks the target-start action (`orchestrations:StartRun`, `agents:CreateAgentGeneration` or `tools:CallTool`) against the resulting target, because a firing runs with the trigger creator's authority rather than the updater's. A caller who could not start the new target is answered `403` and the trigger keeps the target it had.
4199
+ *
4197
4200
  */
4198
4201
  static updateTrigger(options) {
4199
4202
  return (options.client ?? client).patch({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.120.2",
3
+ "version": "0.120.3",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -37,7 +37,7 @@
37
37
  "tsx": "^4.23.1",
38
38
  "typescript": "~6.0.3",
39
39
  "vitest": "^4.1.10",
40
- "@naturali/api": "0.120.2"
40
+ "@naturali/api": "0.120.3"
41
41
  },
42
42
  "scripts": {
43
43
  "generate": "tsx scripts/generate.ts",