@naturali/sdk 0.57.0 → 0.58.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -2143,6 +2143,16 @@ type StartRunRequest = {
2143
2143
  input?: {
2144
2144
  [key: string]: unknown;
2145
2145
  };
2146
+ /**
2147
+ * Write-only. Per-run context forwarded to the run's tool calls: every entry is sent as an `X-Naturali-Context-<key>` request header on each `http`/`mcp` tool call the run's agent nodes make, including those of a `loop` or `sub_orchestration` child run. This is how a per-user credential reaches a tool endpoint without being written into the prompt — the endpoint reads it from a header it can trust rather than from model output.
2148
+ *
2149
+ * The bag is stored on the run, so it survives an `awaiting_input` pause, a durable wait and a restart. It is never returned on a read: any principal on the project can read the project's runs.
2150
+ *
2151
+ * A key becomes an HTTP header name verbatim — no character is re-cased, so `ocaToken` and `oca_token` are two different keys — and must contain only letters, digits and `!#$%&'*+-.^_`|~`; two keys that differ only in case are rejected, since HTTP folds them into one. To land a value in a header the target already expects (usually `Authorization`), have the tool declare it with a `{{context:<key>}}` reference in its own `headers`, and set the tool's `context_keys` so the value reaches that tool alone.
2152
+ */
2153
+ tool_context?: {
2154
+ [key: string]: string;
2155
+ };
2146
2156
  /**
2147
2157
  * When true, block until the run reaches a terminal or `awaiting_input` state and return the settled run. When false (default), return immediately with `status: "queued"`.
2148
2158
  */
@@ -2559,7 +2569,9 @@ type SessionGeneration = {
2559
2569
  } | null;
2560
2570
  };
2561
2571
  /**
2562
- * Key-value string headers injected into every tool call made during the session or generation.
2572
+ * Context forwarded to every `http`/`mcp` tool call made during the session or generation: each entry is sent as an `X-Naturali-Context-<key>` request header, so a per-user credential can reach a tool endpoint without being written into the prompt.
2573
+ *
2574
+ * A key becomes an HTTP header name verbatim — no character is re-cased, so `ocaToken` and `oca_token` are two different keys — and must contain only letters, digits and `!#$%&'*+-.^_`|~`; two keys that differ only in case are rejected, since HTTP folds them into one. To land a value in a header the target already expects (usually `Authorization`), have the tool declare it with a `{{context:<key>}}` reference in its own `headers`, and set the tool's `context_keys` so the value reaches that tool alone.
2563
2575
  *
2564
2576
  */
2565
2577
  type ToolContext = {
@@ -2746,6 +2758,8 @@ type HttpExecute = {
2746
2758
  /**
2747
2759
  * Write-only. Auth headers sent to the target (e.g. Authorization). Accepted on write, never returned — reads report only `has_headers`.
2748
2760
  *
2761
+ * A value may carry a `{{context:<key>}}` reference, resolved per call from the caller's `tool_context` (see the `tool_context` field on starting an orchestration run). That is how a per-user credential lands in the header the target already expects — `Authorization: "Bearer {{context:ocaToken}}"` — instead of only in the prefixed `X-Naturali-Context-<key>` header. A reference is legal in `headers` and nowhere else, `url` included: a context value comes from the caller, so it must not be able to steer the outbound request. A key missing from the `tool_context` at call time fails the tool call rather than sending an empty credential.
2762
+ *
2749
2763
  */
2750
2764
  headers?: {
2751
2765
  [key: string]: string;
@@ -2759,6 +2773,8 @@ type McpConfig = {
2759
2773
  /**
2760
2774
  * Write-only. Auth headers sent to the MCP server. Accepted on write, never returned — reads report only `has_headers`.
2761
2775
  *
2776
+ * As with an http tool's headers, a value may carry a `{{context:<key>}}` reference — `Authorization: "Bearer {{context:ocaToken}}"` — resolved per call from the caller's `tool_context`, so an MCP server can read a per-user credential from the standard bearer header it already expects.
2777
+ *
2762
2778
  */
2763
2779
  headers?: {
2764
2780
  [key: string]: string;
@@ -2816,6 +2832,10 @@ type Tool = {
2816
2832
  * mcp tools only — denylist of MCP tool names to hide.
2817
2833
  */
2818
2834
  denied_actions?: Array<string> | null;
2835
+ /**
2836
+ * Which `tool_context` keys may reach this tool as `X-Naturali-Context-<key>` headers. `null` forwards every key the caller supplied; a list forwards only those, and `[]` forwards none. Key *names* are returned — the values never are.
2837
+ */
2838
+ context_keys: Array<string> | null;
2819
2839
  /**
2820
2840
  * Whether auth headers are on file (their values are never returned).
2821
2841
  */
@@ -2863,6 +2883,10 @@ type ToolCreate = {
2863
2883
  * mcp only — denylist of MCP tool names to hide.
2864
2884
  */
2865
2885
  denied_actions?: Array<string>;
2886
+ /**
2887
+ * Allowlist of `tool_context` keys forwarded to this tool as `X-Naturali-Context-<key>` headers. Omit (or `null`) to forward every key the caller supplied; `[]` forwards none. Set it on the tools that need a given credential and the credential stops egressing to the rest of the agent's tool set — a key a tool consumes through a `{{context:<key>}}` reference in its own `headers` is substituted either way, since the tool declared that header itself.
2888
+ */
2889
+ context_keys?: Array<string> | null;
2866
2890
  };
2867
2891
  /**
2868
2892
  * At least one field must be present. The tool `type` is immutable.
@@ -2883,6 +2907,10 @@ type ToolUpdate = {
2883
2907
  mcp?: McpConfig;
2884
2908
  actions?: Array<string>;
2885
2909
  denied_actions?: Array<string>;
2910
+ /**
2911
+ * Replace the allowlist of `tool_context` keys forwarded to this tool. `null` clears it (every key is forwarded again) — unlike omitting the field, which leaves the current allowlist alone.
2912
+ */
2913
+ context_keys?: Array<string> | null;
2886
2914
  status?: 'active' | 'disabled';
2887
2915
  };
2888
2916
  type ToolList = {
package/dist/index.d.mts CHANGED
@@ -2143,6 +2143,16 @@ type StartRunRequest = {
2143
2143
  input?: {
2144
2144
  [key: string]: unknown;
2145
2145
  };
2146
+ /**
2147
+ * Write-only. Per-run context forwarded to the run's tool calls: every entry is sent as an `X-Naturali-Context-<key>` request header on each `http`/`mcp` tool call the run's agent nodes make, including those of a `loop` or `sub_orchestration` child run. This is how a per-user credential reaches a tool endpoint without being written into the prompt — the endpoint reads it from a header it can trust rather than from model output.
2148
+ *
2149
+ * The bag is stored on the run, so it survives an `awaiting_input` pause, a durable wait and a restart. It is never returned on a read: any principal on the project can read the project's runs.
2150
+ *
2151
+ * A key becomes an HTTP header name verbatim — no character is re-cased, so `ocaToken` and `oca_token` are two different keys — and must contain only letters, digits and `!#$%&'*+-.^_`|~`; two keys that differ only in case are rejected, since HTTP folds them into one. To land a value in a header the target already expects (usually `Authorization`), have the tool declare it with a `{{context:<key>}}` reference in its own `headers`, and set the tool's `context_keys` so the value reaches that tool alone.
2152
+ */
2153
+ tool_context?: {
2154
+ [key: string]: string;
2155
+ };
2146
2156
  /**
2147
2157
  * When true, block until the run reaches a terminal or `awaiting_input` state and return the settled run. When false (default), return immediately with `status: "queued"`.
2148
2158
  */
@@ -2559,7 +2569,9 @@ type SessionGeneration = {
2559
2569
  } | null;
2560
2570
  };
2561
2571
  /**
2562
- * Key-value string headers injected into every tool call made during the session or generation.
2572
+ * Context forwarded to every `http`/`mcp` tool call made during the session or generation: each entry is sent as an `X-Naturali-Context-<key>` request header, so a per-user credential can reach a tool endpoint without being written into the prompt.
2573
+ *
2574
+ * A key becomes an HTTP header name verbatim — no character is re-cased, so `ocaToken` and `oca_token` are two different keys — and must contain only letters, digits and `!#$%&'*+-.^_`|~`; two keys that differ only in case are rejected, since HTTP folds them into one. To land a value in a header the target already expects (usually `Authorization`), have the tool declare it with a `{{context:<key>}}` reference in its own `headers`, and set the tool's `context_keys` so the value reaches that tool alone.
2563
2575
  *
2564
2576
  */
2565
2577
  type ToolContext = {
@@ -2746,6 +2758,8 @@ type HttpExecute = {
2746
2758
  /**
2747
2759
  * Write-only. Auth headers sent to the target (e.g. Authorization). Accepted on write, never returned — reads report only `has_headers`.
2748
2760
  *
2761
+ * A value may carry a `{{context:<key>}}` reference, resolved per call from the caller's `tool_context` (see the `tool_context` field on starting an orchestration run). That is how a per-user credential lands in the header the target already expects — `Authorization: "Bearer {{context:ocaToken}}"` — instead of only in the prefixed `X-Naturali-Context-<key>` header. A reference is legal in `headers` and nowhere else, `url` included: a context value comes from the caller, so it must not be able to steer the outbound request. A key missing from the `tool_context` at call time fails the tool call rather than sending an empty credential.
2762
+ *
2749
2763
  */
2750
2764
  headers?: {
2751
2765
  [key: string]: string;
@@ -2759,6 +2773,8 @@ type McpConfig = {
2759
2773
  /**
2760
2774
  * Write-only. Auth headers sent to the MCP server. Accepted on write, never returned — reads report only `has_headers`.
2761
2775
  *
2776
+ * As with an http tool's headers, a value may carry a `{{context:<key>}}` reference — `Authorization: "Bearer {{context:ocaToken}}"` — resolved per call from the caller's `tool_context`, so an MCP server can read a per-user credential from the standard bearer header it already expects.
2777
+ *
2762
2778
  */
2763
2779
  headers?: {
2764
2780
  [key: string]: string;
@@ -2816,6 +2832,10 @@ type Tool = {
2816
2832
  * mcp tools only — denylist of MCP tool names to hide.
2817
2833
  */
2818
2834
  denied_actions?: Array<string> | null;
2835
+ /**
2836
+ * Which `tool_context` keys may reach this tool as `X-Naturali-Context-<key>` headers. `null` forwards every key the caller supplied; a list forwards only those, and `[]` forwards none. Key *names* are returned — the values never are.
2837
+ */
2838
+ context_keys: Array<string> | null;
2819
2839
  /**
2820
2840
  * Whether auth headers are on file (their values are never returned).
2821
2841
  */
@@ -2863,6 +2883,10 @@ type ToolCreate = {
2863
2883
  * mcp only — denylist of MCP tool names to hide.
2864
2884
  */
2865
2885
  denied_actions?: Array<string>;
2886
+ /**
2887
+ * Allowlist of `tool_context` keys forwarded to this tool as `X-Naturali-Context-<key>` headers. Omit (or `null`) to forward every key the caller supplied; `[]` forwards none. Set it on the tools that need a given credential and the credential stops egressing to the rest of the agent's tool set — a key a tool consumes through a `{{context:<key>}}` reference in its own `headers` is substituted either way, since the tool declared that header itself.
2888
+ */
2889
+ context_keys?: Array<string> | null;
2866
2890
  };
2867
2891
  /**
2868
2892
  * At least one field must be present. The tool `type` is immutable.
@@ -2883,6 +2907,10 @@ type ToolUpdate = {
2883
2907
  mcp?: McpConfig;
2884
2908
  actions?: Array<string>;
2885
2909
  denied_actions?: Array<string>;
2910
+ /**
2911
+ * Replace the allowlist of `tool_context` keys forwarded to this tool. `null` clears it (every key is forwarded again) — unlike omitting the field, which leaves the current allowlist alone.
2912
+ */
2913
+ context_keys?: Array<string> | null;
2886
2914
  status?: 'active' | 'disabled';
2887
2915
  };
2888
2916
  type ToolList = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.57.0",
3
+ "version": "0.58.1",
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.57.0"
40
+ "@naturali/api": "0.58.1"
41
41
  },
42
42
  "scripts": {
43
43
  "generate": "tsx scripts/generate.ts",