@naturali/sdk 0.133.1 → 0.133.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.d.cts CHANGED
@@ -763,7 +763,25 @@ type Agent = {
763
763
  * Key-value pairs a result's own `tags` must all contain (exact match). Scopes documents and memories alike.
764
764
  */
765
765
  tags?: TagBag;
766
+ /**
767
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked, the floor the search endpoint spells `min_similarity`. No default: omitted means no floor at all, and every one of the `limit` nearest chunks is injected however weak it is.
768
+ *
769
+ */
766
770
  min_score?: number;
771
+ /**
772
+ * The `k` in the fusion term `1 / (k + rank)`, the same knob knowledge search takes. Smaller weights the top of each ranking more heavily. Omitted, the deployment's `KNOWLEDGE_RRF_K` applies.
773
+ *
774
+ */
775
+ rrf_k?: number;
776
+ /**
777
+ * Half-life in days of the decay applied to **memory** results after fusion, the same knob knowledge search takes. `0` disables it. Omitted, the deployment's `KNOWLEDGE_RECENCY_HALF_LIFE_DAYS` applies.
778
+ *
779
+ */
780
+ recency_half_life_days?: number;
781
+ /**
782
+ * Maximum number of results to inject. Omitted, 10 are injected.
783
+ *
784
+ */
767
785
  limit?: number;
768
786
  /**
769
787
  * Public ID of the memory store the agent can write to during generation. When set, a write_memory tool is automatically available to the agent.
@@ -955,7 +973,25 @@ type CreateAgentRequest = {
955
973
  * Key-value pairs a result's own `tags` must all contain (exact match). Scopes documents and memories alike.
956
974
  */
957
975
  tags?: TagBag;
976
+ /**
977
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked, the floor the search endpoint spells `min_similarity`. No default: omitted means no floor at all, and every one of the `limit` nearest chunks is injected however weak it is.
978
+ *
979
+ */
958
980
  min_score?: number;
981
+ /**
982
+ * The `k` in the fusion term `1 / (k + rank)`, the same knob knowledge search takes. Smaller weights the top of each ranking more heavily. Omitted, the deployment's `KNOWLEDGE_RRF_K` applies.
983
+ *
984
+ */
985
+ rrf_k?: number;
986
+ /**
987
+ * Half-life in days of the decay applied to **memory** results after fusion, the same knob knowledge search takes. `0` disables it. Omitted, the deployment's `KNOWLEDGE_RECENCY_HALF_LIFE_DAYS` applies.
988
+ *
989
+ */
990
+ recency_half_life_days?: number;
991
+ /**
992
+ * Maximum number of results to inject. Omitted, 10 are injected.
993
+ *
994
+ */
959
995
  limit?: number;
960
996
  /**
961
997
  * Public ID of the memory store the agent can write to during generation. When set, a write_memory tool is automatically available to the agent.
@@ -1045,7 +1081,25 @@ type UpdateAgentRequest = {
1045
1081
  * Key-value pairs a result's own `tags` must all contain (exact match). Scopes documents and memories alike.
1046
1082
  */
1047
1083
  tags?: TagBag;
1084
+ /**
1085
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked, the floor the search endpoint spells `min_similarity`. No default: omitted means no floor at all, and every one of the `limit` nearest chunks is injected however weak it is.
1086
+ *
1087
+ */
1048
1088
  min_score?: number;
1089
+ /**
1090
+ * The `k` in the fusion term `1 / (k + rank)`, the same knob knowledge search takes. Smaller weights the top of each ranking more heavily. Omitted, the deployment's `KNOWLEDGE_RRF_K` applies.
1091
+ *
1092
+ */
1093
+ rrf_k?: number;
1094
+ /**
1095
+ * Half-life in days of the decay applied to **memory** results after fusion, the same knob knowledge search takes. `0` disables it. Omitted, the deployment's `KNOWLEDGE_RECENCY_HALF_LIFE_DAYS` applies.
1096
+ *
1097
+ */
1098
+ recency_half_life_days?: number;
1099
+ /**
1100
+ * Maximum number of results to inject. Omitted, 10 are injected.
1101
+ *
1102
+ */
1049
1103
  limit?: number;
1050
1104
  /**
1051
1105
  * Public ID of the memory store the agent can write to during generation. When set, a write_memory tool is automatically available to the agent.
@@ -1136,7 +1190,7 @@ type CreateAgentGenerationRequest = {
1136
1190
  [key: string]: unknown;
1137
1191
  } | null;
1138
1192
  /**
1139
- * Per-generation knowledge retrieval override. Array filters (memory_store_ids, document_ids, document_paths) are unioned with the agent's stored knowledge_config; `tags` pairs are merged with the override winning per key; scalar fields (min_score, limit) use the per-generation value when present.
1193
+ * Per-generation knowledge retrieval override. Array filters (memory_store_ids, document_ids, document_paths) are unioned with the agent's stored knowledge_config; `tags` pairs are merged with the override winning per key; scalar fields (min_score, rrf_k, recency_half_life_days, limit) use the per-generation value when present.
1140
1194
  */
1141
1195
  knowledge_config?: {
1142
1196
  memory_store_ids?: Array<string>;
@@ -1146,7 +1200,25 @@ type CreateAgentGenerationRequest = {
1146
1200
  * Key-value pairs a result's own `tags` must all contain (exact match). Scopes documents and memories alike.
1147
1201
  */
1148
1202
  tags?: TagBag;
1203
+ /**
1204
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked, the floor the search endpoint spells `min_similarity`. No default: omitted means no floor at all, and every one of the `limit` nearest chunks is injected however weak it is.
1205
+ *
1206
+ */
1149
1207
  min_score?: number;
1208
+ /**
1209
+ * The `k` in the fusion term `1 / (k + rank)`, the same knob knowledge search takes. Smaller weights the top of each ranking more heavily. Omitted, the deployment's `KNOWLEDGE_RRF_K` applies.
1210
+ *
1211
+ */
1212
+ rrf_k?: number;
1213
+ /**
1214
+ * Half-life in days of the decay applied to **memory** results after fusion, the same knob knowledge search takes. `0` disables it. Omitted, the deployment's `KNOWLEDGE_RECENCY_HALF_LIFE_DAYS` applies.
1215
+ *
1216
+ */
1217
+ recency_half_life_days?: number;
1218
+ /**
1219
+ * Maximum number of results to inject. Omitted, 10 are injected.
1220
+ *
1221
+ */
1150
1222
  limit?: number;
1151
1223
  } | null;
1152
1224
  };
@@ -3130,9 +3202,17 @@ type AgentResourceProperties = {
3130
3202
  */
3131
3203
  tags?: TagBag;
3132
3204
  /**
3133
- * Minimum similarity score (0–1) for retrieved chunks
3205
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked. Omitted, there is no floor.
3134
3206
  */
3135
3207
  min_score?: number;
3208
+ /**
3209
+ * The `k` in the fusion term `1 / (k + rank)`; smaller weights the top of each ranking more heavily
3210
+ */
3211
+ rrf_k?: number;
3212
+ /**
3213
+ * Half-life in days of the decay applied to memory results after fusion; `0` disables it
3214
+ */
3215
+ recency_half_life_days?: number;
3136
3216
  /**
3137
3217
  * Maximum number of chunks to inject
3138
3218
  */
@@ -3585,6 +3665,12 @@ type TriggerResourceProperties = {
3585
3665
  input?: {
3586
3666
  [key: string]: unknown;
3587
3667
  } | null;
3668
+ /**
3669
+ * Caller context every firing forwards to the run it starts, so an agent whose tools authorize through `{{context:<key>}}` can be scheduled. Write-only. A value may be a `{{secret:...}}` reference, which is what a template should carry — the credential stays in the secret store and only its name is checked in
3670
+ */
3671
+ tool_context?: {
3672
+ [key: string]: string;
3673
+ } | null;
3588
3674
  /**
3589
3675
  * 5-field cron expression (UTC). Required when type is schedule
3590
3676
  */
@@ -5232,14 +5318,15 @@ type OrchestrationNode = {
5232
5318
  [key: string]: unknown;
5233
5319
  };
5234
5320
  /**
5235
- * Maps state write paths to values. Each key is a `state.<path>` destination (the `state.` prefix is optional); each value is JSON Logic (https://jsonlogic.com) evaluated against `{ "output": <node artifact>, "state": <run state> }` — e.g. `{ "summary": {"var": "output.content"} }` writes the artifact's `content` field to `state.summary`. The same evaluator as input_mapping/transform/condition; only the context differs.
5321
+ * Maps state write paths to values. Each key is a `state.<path>` destination (the `state.` prefix is optional); each value is JSON Logic (https://jsonlogic.com) evaluated against `{ "output": <node artifact>, "state": <run state> }` — e.g. `{ "summary": {"var": "output.content"} }` writes the artifact's `content` field to `state.summary`. The same evaluator as input_mapping/transform/condition; only the context differs. An `agent` node's artifact always carries both `content` (the text response) and `object` (the parsed value when a schema applied, `null` otherwise), so `output.content` reads the same whether or not the node declares an `output_schema`.
5236
5322
  *
5237
5323
  */
5238
5324
  state_mapping?: {
5239
5325
  [key: string]: unknown;
5240
5326
  };
5241
5327
  /**
5242
- * For agent nodes — JSON Schema for structured output parsing.
5328
+ * For agent nodes — JSON Schema the model's answer is parsed into, reaching the artifact as `object`. Declaring it here is only needed for an agent that carries no `output_schema` of its own: the agent's schema already produces the artifact's `object` wherever that agent generates.
5329
+ *
5243
5330
  */
5244
5331
  output_schema?: {
5245
5332
  [key: string]: unknown;
@@ -5523,12 +5610,6 @@ type OrchestrationRun = {
5523
5610
  input?: {
5524
5611
  [key: string]: unknown;
5525
5612
  } | null;
5526
- /**
5527
- * The `tool_context` supplied at run creation, forwarded as `X-Naturali-Context-<key>` headers on every tool call the run's agent nodes make. Null when the run was started without one.
5528
- */
5529
- tool_context?: {
5530
- [key: string]: string;
5531
- } | null;
5532
5613
  /**
5533
5614
  * The caller-owned key/value metadata supplied at run creation, returned verbatim. Null when the run was started without any. The server writes nothing here and no key is reserved; the bag is never merged into `state`, so nothing in it reaches the graph.
5534
5615
  */
@@ -5604,6 +5685,11 @@ type NodeExecution = {
5604
5685
  *
5605
5686
  */
5606
5687
  attempt: number;
5688
+ /**
5689
+ * How many times this attempt was dispatched, including the first. A worker that stops mid-node leaves its task to be redelivered, and the redelivery re-runs the node under this same record — so a count above 1 is work the run issued, and was billed for, more than once.
5690
+ *
5691
+ */
5692
+ dispatches: number;
5607
5693
  /**
5608
5694
  * Node execution status. `running` marks an execution record whose node is still in flight. Open set — new statuses may be added in minor releases; clients must tolerate unknown values.
5609
5695
  */
@@ -5698,7 +5784,7 @@ type StartOrchestrationRunRequest = {
5698
5784
  /**
5699
5785
  * Key-value pairs forwarded as `X-Naturali-Context-<key>` headers on every `http` and `mcp` tool call made by an agent node of this run — including the agents of any child run a `loop` or `sub_orchestration` node starts. The header name is `X-Naturali-Context-` plus the key verbatim; no character is re-cased.
5700
5786
  *
5701
- * The bag is stored on the run and re-read on every step, so it survives an `awaiting_input` pause, a `sleeping` wait, a background worker drive and a crash redrive. A key that is not a valid HTTP header name, or two keys that map to the same header, are rejected with `400 INVALID_TOOL_CONTEXT_KEY` and no run is created.
5787
+ * The bag is stored on the run and re-read on every step, so it survives an `awaiting_input` pause, a `sleeping` wait, a background worker drive and a crash redrive. It is **write-only**: a run is a record every principal who may read runs can read, and a credential in it is not theirs to see, so it is never returned on one. A key that is not a valid HTTP header name, or two keys that map to the same header, are rejected with `400 INVALID_TOOL_CONTEXT_KEY` and no run is created.
5702
5788
  *
5703
5789
  * The reserved identity keys (`session_id`, `actor_id`, `actor_external_id`) are stripped at generation time — a caller cannot address them from here.
5704
5790
  */
@@ -6999,6 +7085,17 @@ type CreateTriggerRequest = {
6999
7085
  input?: {
7000
7086
  [key: string]: unknown;
7001
7087
  };
7088
+ /**
7089
+ * Caller context every firing forwards to the run it starts, so an agent whose tools authorize through `{{context:<key>}}` can be put on a schedule — a firing has no request to carry one. Each key is forwarded as one `X-Naturali-Context-<key>` header.
7090
+ *
7091
+ * **Write-only.** It is accepted here and never returned on a read, so the record cannot be used to recover a value.
7092
+ *
7093
+ * A value may be a `{{secret:...}}` reference, which keeps the credential in the [secret](/docs/modules/secrets) store and leaves only its name on the trigger; it is resolved at fire time, so rotating the secret changes the next firing without touching the trigger. A reference naming a secret that does not exist in this project is refused here rather than at fire time.
7094
+ *
7095
+ */
7096
+ tool_context?: {
7097
+ [key: string]: string;
7098
+ };
7002
7099
  /**
7003
7100
  * 5-field cron expression (UTC). Required when type is schedule
7004
7101
  */
@@ -7019,6 +7116,13 @@ type UpdateTriggerRequest = {
7019
7116
  input?: {
7020
7117
  [key: string]: unknown;
7021
7118
  } | null;
7119
+ /**
7120
+ * Replaces the stored bag; `null` clears it. Write-only and resolved at fire time — see `CreateTriggerRequest.tool_context`.
7121
+ *
7122
+ */
7123
+ tool_context?: {
7124
+ [key: string]: string;
7125
+ } | null;
7022
7126
  cron?: string | null;
7023
7127
  event_pattern?: string | null;
7024
7128
  active?: boolean;
@@ -7031,6 +7135,15 @@ type FireTriggerRequest = {
7031
7135
  input?: {
7032
7136
  [key: string]: unknown;
7033
7137
  };
7138
+ /**
7139
+ * Fire-time caller context, shallow-merged per key over the trigger's stored `tool_context`. A manual fire has a caller, so this is the one path that can supply a value without storing it.
7140
+ *
7141
+ * Forwarded exactly as written: a `{{secret:...}}` reference is resolved only in the trigger's stored bag, never in one supplied here.
7142
+ *
7143
+ */
7144
+ tool_context?: {
7145
+ [key: string]: string;
7146
+ };
7034
7147
  };
7035
7148
  type TriggerSecretResponse = {
7036
7149
  secret?: string;
package/dist/index.d.mts CHANGED
@@ -763,7 +763,25 @@ type Agent = {
763
763
  * Key-value pairs a result's own `tags` must all contain (exact match). Scopes documents and memories alike.
764
764
  */
765
765
  tags?: TagBag;
766
+ /**
767
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked, the floor the search endpoint spells `min_similarity`. No default: omitted means no floor at all, and every one of the `limit` nearest chunks is injected however weak it is.
768
+ *
769
+ */
766
770
  min_score?: number;
771
+ /**
772
+ * The `k` in the fusion term `1 / (k + rank)`, the same knob knowledge search takes. Smaller weights the top of each ranking more heavily. Omitted, the deployment's `KNOWLEDGE_RRF_K` applies.
773
+ *
774
+ */
775
+ rrf_k?: number;
776
+ /**
777
+ * Half-life in days of the decay applied to **memory** results after fusion, the same knob knowledge search takes. `0` disables it. Omitted, the deployment's `KNOWLEDGE_RECENCY_HALF_LIFE_DAYS` applies.
778
+ *
779
+ */
780
+ recency_half_life_days?: number;
781
+ /**
782
+ * Maximum number of results to inject. Omitted, 10 are injected.
783
+ *
784
+ */
767
785
  limit?: number;
768
786
  /**
769
787
  * Public ID of the memory store the agent can write to during generation. When set, a write_memory tool is automatically available to the agent.
@@ -955,7 +973,25 @@ type CreateAgentRequest = {
955
973
  * Key-value pairs a result's own `tags` must all contain (exact match). Scopes documents and memories alike.
956
974
  */
957
975
  tags?: TagBag;
976
+ /**
977
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked, the floor the search endpoint spells `min_similarity`. No default: omitted means no floor at all, and every one of the `limit` nearest chunks is injected however weak it is.
978
+ *
979
+ */
958
980
  min_score?: number;
981
+ /**
982
+ * The `k` in the fusion term `1 / (k + rank)`, the same knob knowledge search takes. Smaller weights the top of each ranking more heavily. Omitted, the deployment's `KNOWLEDGE_RRF_K` applies.
983
+ *
984
+ */
985
+ rrf_k?: number;
986
+ /**
987
+ * Half-life in days of the decay applied to **memory** results after fusion, the same knob knowledge search takes. `0` disables it. Omitted, the deployment's `KNOWLEDGE_RECENCY_HALF_LIFE_DAYS` applies.
988
+ *
989
+ */
990
+ recency_half_life_days?: number;
991
+ /**
992
+ * Maximum number of results to inject. Omitted, 10 are injected.
993
+ *
994
+ */
959
995
  limit?: number;
960
996
  /**
961
997
  * Public ID of the memory store the agent can write to during generation. When set, a write_memory tool is automatically available to the agent.
@@ -1045,7 +1081,25 @@ type UpdateAgentRequest = {
1045
1081
  * Key-value pairs a result's own `tags` must all contain (exact match). Scopes documents and memories alike.
1046
1082
  */
1047
1083
  tags?: TagBag;
1084
+ /**
1085
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked, the floor the search endpoint spells `min_similarity`. No default: omitted means no floor at all, and every one of the `limit` nearest chunks is injected however weak it is.
1086
+ *
1087
+ */
1048
1088
  min_score?: number;
1089
+ /**
1090
+ * The `k` in the fusion term `1 / (k + rank)`, the same knob knowledge search takes. Smaller weights the top of each ranking more heavily. Omitted, the deployment's `KNOWLEDGE_RRF_K` applies.
1091
+ *
1092
+ */
1093
+ rrf_k?: number;
1094
+ /**
1095
+ * Half-life in days of the decay applied to **memory** results after fusion, the same knob knowledge search takes. `0` disables it. Omitted, the deployment's `KNOWLEDGE_RECENCY_HALF_LIFE_DAYS` applies.
1096
+ *
1097
+ */
1098
+ recency_half_life_days?: number;
1099
+ /**
1100
+ * Maximum number of results to inject. Omitted, 10 are injected.
1101
+ *
1102
+ */
1049
1103
  limit?: number;
1050
1104
  /**
1051
1105
  * Public ID of the memory store the agent can write to during generation. When set, a write_memory tool is automatically available to the agent.
@@ -1136,7 +1190,7 @@ type CreateAgentGenerationRequest = {
1136
1190
  [key: string]: unknown;
1137
1191
  } | null;
1138
1192
  /**
1139
- * Per-generation knowledge retrieval override. Array filters (memory_store_ids, document_ids, document_paths) are unioned with the agent's stored knowledge_config; `tags` pairs are merged with the override winning per key; scalar fields (min_score, limit) use the per-generation value when present.
1193
+ * Per-generation knowledge retrieval override. Array filters (memory_store_ids, document_ids, document_paths) are unioned with the agent's stored knowledge_config; `tags` pairs are merged with the override winning per key; scalar fields (min_score, rrf_k, recency_half_life_days, limit) use the per-generation value when present.
1140
1194
  */
1141
1195
  knowledge_config?: {
1142
1196
  memory_store_ids?: Array<string>;
@@ -1146,7 +1200,25 @@ type CreateAgentGenerationRequest = {
1146
1200
  * Key-value pairs a result's own `tags` must all contain (exact match). Scopes documents and memories alike.
1147
1201
  */
1148
1202
  tags?: TagBag;
1203
+ /**
1204
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked, the floor the search endpoint spells `min_similarity`. No default: omitted means no floor at all, and every one of the `limit` nearest chunks is injected however weak it is.
1205
+ *
1206
+ */
1149
1207
  min_score?: number;
1208
+ /**
1209
+ * The `k` in the fusion term `1 / (k + rank)`, the same knob knowledge search takes. Smaller weights the top of each ranking more heavily. Omitted, the deployment's `KNOWLEDGE_RRF_K` applies.
1210
+ *
1211
+ */
1212
+ rrf_k?: number;
1213
+ /**
1214
+ * Half-life in days of the decay applied to **memory** results after fusion, the same knob knowledge search takes. `0` disables it. Omitted, the deployment's `KNOWLEDGE_RECENCY_HALF_LIFE_DAYS` applies.
1215
+ *
1216
+ */
1217
+ recency_half_life_days?: number;
1218
+ /**
1219
+ * Maximum number of results to inject. Omitted, 10 are injected.
1220
+ *
1221
+ */
1150
1222
  limit?: number;
1151
1223
  } | null;
1152
1224
  };
@@ -3130,9 +3202,17 @@ type AgentResourceProperties = {
3130
3202
  */
3131
3203
  tags?: TagBag;
3132
3204
  /**
3133
- * Minimum similarity score (0–1) for retrieved chunks
3205
+ * Minimum raw cosine similarity (0–1) a vector candidate must reach to be ranked. Omitted, there is no floor.
3134
3206
  */
3135
3207
  min_score?: number;
3208
+ /**
3209
+ * The `k` in the fusion term `1 / (k + rank)`; smaller weights the top of each ranking more heavily
3210
+ */
3211
+ rrf_k?: number;
3212
+ /**
3213
+ * Half-life in days of the decay applied to memory results after fusion; `0` disables it
3214
+ */
3215
+ recency_half_life_days?: number;
3136
3216
  /**
3137
3217
  * Maximum number of chunks to inject
3138
3218
  */
@@ -3585,6 +3665,12 @@ type TriggerResourceProperties = {
3585
3665
  input?: {
3586
3666
  [key: string]: unknown;
3587
3667
  } | null;
3668
+ /**
3669
+ * Caller context every firing forwards to the run it starts, so an agent whose tools authorize through `{{context:<key>}}` can be scheduled. Write-only. A value may be a `{{secret:...}}` reference, which is what a template should carry — the credential stays in the secret store and only its name is checked in
3670
+ */
3671
+ tool_context?: {
3672
+ [key: string]: string;
3673
+ } | null;
3588
3674
  /**
3589
3675
  * 5-field cron expression (UTC). Required when type is schedule
3590
3676
  */
@@ -5232,14 +5318,15 @@ type OrchestrationNode = {
5232
5318
  [key: string]: unknown;
5233
5319
  };
5234
5320
  /**
5235
- * Maps state write paths to values. Each key is a `state.<path>` destination (the `state.` prefix is optional); each value is JSON Logic (https://jsonlogic.com) evaluated against `{ "output": <node artifact>, "state": <run state> }` — e.g. `{ "summary": {"var": "output.content"} }` writes the artifact's `content` field to `state.summary`. The same evaluator as input_mapping/transform/condition; only the context differs.
5321
+ * Maps state write paths to values. Each key is a `state.<path>` destination (the `state.` prefix is optional); each value is JSON Logic (https://jsonlogic.com) evaluated against `{ "output": <node artifact>, "state": <run state> }` — e.g. `{ "summary": {"var": "output.content"} }` writes the artifact's `content` field to `state.summary`. The same evaluator as input_mapping/transform/condition; only the context differs. An `agent` node's artifact always carries both `content` (the text response) and `object` (the parsed value when a schema applied, `null` otherwise), so `output.content` reads the same whether or not the node declares an `output_schema`.
5236
5322
  *
5237
5323
  */
5238
5324
  state_mapping?: {
5239
5325
  [key: string]: unknown;
5240
5326
  };
5241
5327
  /**
5242
- * For agent nodes — JSON Schema for structured output parsing.
5328
+ * For agent nodes — JSON Schema the model's answer is parsed into, reaching the artifact as `object`. Declaring it here is only needed for an agent that carries no `output_schema` of its own: the agent's schema already produces the artifact's `object` wherever that agent generates.
5329
+ *
5243
5330
  */
5244
5331
  output_schema?: {
5245
5332
  [key: string]: unknown;
@@ -5523,12 +5610,6 @@ type OrchestrationRun = {
5523
5610
  input?: {
5524
5611
  [key: string]: unknown;
5525
5612
  } | null;
5526
- /**
5527
- * The `tool_context` supplied at run creation, forwarded as `X-Naturali-Context-<key>` headers on every tool call the run's agent nodes make. Null when the run was started without one.
5528
- */
5529
- tool_context?: {
5530
- [key: string]: string;
5531
- } | null;
5532
5613
  /**
5533
5614
  * The caller-owned key/value metadata supplied at run creation, returned verbatim. Null when the run was started without any. The server writes nothing here and no key is reserved; the bag is never merged into `state`, so nothing in it reaches the graph.
5534
5615
  */
@@ -5604,6 +5685,11 @@ type NodeExecution = {
5604
5685
  *
5605
5686
  */
5606
5687
  attempt: number;
5688
+ /**
5689
+ * How many times this attempt was dispatched, including the first. A worker that stops mid-node leaves its task to be redelivered, and the redelivery re-runs the node under this same record — so a count above 1 is work the run issued, and was billed for, more than once.
5690
+ *
5691
+ */
5692
+ dispatches: number;
5607
5693
  /**
5608
5694
  * Node execution status. `running` marks an execution record whose node is still in flight. Open set — new statuses may be added in minor releases; clients must tolerate unknown values.
5609
5695
  */
@@ -5698,7 +5784,7 @@ type StartOrchestrationRunRequest = {
5698
5784
  /**
5699
5785
  * Key-value pairs forwarded as `X-Naturali-Context-<key>` headers on every `http` and `mcp` tool call made by an agent node of this run — including the agents of any child run a `loop` or `sub_orchestration` node starts. The header name is `X-Naturali-Context-` plus the key verbatim; no character is re-cased.
5700
5786
  *
5701
- * The bag is stored on the run and re-read on every step, so it survives an `awaiting_input` pause, a `sleeping` wait, a background worker drive and a crash redrive. A key that is not a valid HTTP header name, or two keys that map to the same header, are rejected with `400 INVALID_TOOL_CONTEXT_KEY` and no run is created.
5787
+ * The bag is stored on the run and re-read on every step, so it survives an `awaiting_input` pause, a `sleeping` wait, a background worker drive and a crash redrive. It is **write-only**: a run is a record every principal who may read runs can read, and a credential in it is not theirs to see, so it is never returned on one. A key that is not a valid HTTP header name, or two keys that map to the same header, are rejected with `400 INVALID_TOOL_CONTEXT_KEY` and no run is created.
5702
5788
  *
5703
5789
  * The reserved identity keys (`session_id`, `actor_id`, `actor_external_id`) are stripped at generation time — a caller cannot address them from here.
5704
5790
  */
@@ -6999,6 +7085,17 @@ type CreateTriggerRequest = {
6999
7085
  input?: {
7000
7086
  [key: string]: unknown;
7001
7087
  };
7088
+ /**
7089
+ * Caller context every firing forwards to the run it starts, so an agent whose tools authorize through `{{context:<key>}}` can be put on a schedule — a firing has no request to carry one. Each key is forwarded as one `X-Naturali-Context-<key>` header.
7090
+ *
7091
+ * **Write-only.** It is accepted here and never returned on a read, so the record cannot be used to recover a value.
7092
+ *
7093
+ * A value may be a `{{secret:...}}` reference, which keeps the credential in the [secret](/docs/modules/secrets) store and leaves only its name on the trigger; it is resolved at fire time, so rotating the secret changes the next firing without touching the trigger. A reference naming a secret that does not exist in this project is refused here rather than at fire time.
7094
+ *
7095
+ */
7096
+ tool_context?: {
7097
+ [key: string]: string;
7098
+ };
7002
7099
  /**
7003
7100
  * 5-field cron expression (UTC). Required when type is schedule
7004
7101
  */
@@ -7019,6 +7116,13 @@ type UpdateTriggerRequest = {
7019
7116
  input?: {
7020
7117
  [key: string]: unknown;
7021
7118
  } | null;
7119
+ /**
7120
+ * Replaces the stored bag; `null` clears it. Write-only and resolved at fire time — see `CreateTriggerRequest.tool_context`.
7121
+ *
7122
+ */
7123
+ tool_context?: {
7124
+ [key: string]: string;
7125
+ } | null;
7022
7126
  cron?: string | null;
7023
7127
  event_pattern?: string | null;
7024
7128
  active?: boolean;
@@ -7031,6 +7135,15 @@ type FireTriggerRequest = {
7031
7135
  input?: {
7032
7136
  [key: string]: unknown;
7033
7137
  };
7138
+ /**
7139
+ * Fire-time caller context, shallow-merged per key over the trigger's stored `tool_context`. A manual fire has a caller, so this is the one path that can supply a value without storing it.
7140
+ *
7141
+ * Forwarded exactly as written: a `{{secret:...}}` reference is resolved only in the trigger's stored bag, never in one supplied here.
7142
+ *
7143
+ */
7144
+ tool_context?: {
7145
+ [key: string]: string;
7146
+ };
7034
7147
  };
7035
7148
  type TriggerSecretResponse = {
7036
7149
  secret?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.133.1",
3
+ "version": "0.133.3",
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.133.1",
34
+ "@naturali/api": "0.133.3",
35
35
  "@ttoss/openapi-codegen": "^0.3.1",
36
36
  "@types/node": "^26.5.1",
37
37
  "tsdown": "^0.23.0",