@naturali/sdk 0.320.0 → 0.321.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -5215,7 +5215,7 @@ var Playbooks = class {
5215
5215
  *
5216
5216
  * Creates a playbook at version 1. The definition is refused with `400 PLAYBOOK_VALIDATION_FAILED` when it holds a duplicate node or input, an input reading a missing node or field, an `execute` node without an executor or another kind with one, transformations on a non-final node, or a cycle; `meta.problems` lists every one. A duplicate `name` in the project is `409 NAME_CONFLICT`.
5217
5217
  *
5218
- * The version's executors run under `policy_ids`, required and non-empty (`400 VALIDATION_FAILED`). The caller must hold every grant of each policy it names (`403 POLICY_GRANT_NOT_HELD`) and be allowed to start every executor the definition names (`403 ACTION_NOT_HELD`), and each must exist in the project, or be an agent or tool shared with it (`400 PLAYBOOK_VALIDATION_FAILED`, an `EXECUTOR_NOT_FOUND` problem). A `tool` executor on an `mcp` tool must name in `operation_id` an action the tool's binding allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`). An executor cannot be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), nor a transformation's tool a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`).
5218
+ * The version's executors run under `policy_ids`, required and non-empty (`400 VALIDATION_FAILED`). The caller must hold every grant of each policy it names (`403 POLICY_GRANT_NOT_HELD`) and be allowed to start every executor the definition names (`403 ACTION_NOT_HELD`), and each must exist in the project, or be an agent or tool shared with it (`400 PLAYBOOK_VALIDATION_FAILED`, an `EXECUTOR_NOT_FOUND` problem). A `tool` executor on an `mcp` tool must name in `operation_id` an action the tool's binding allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`). An executor cannot be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), nor a transformation's tool a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). `policy_ids` must allow starting each executor and transformation tool, or every run of its node would fail (`EXECUTOR_NOT_GRANTED`).
5219
5219
  */
5220
5220
  static createPlaybook(options) {
5221
5221
  return (options.client ?? client).post({
@@ -5232,7 +5232,7 @@ var Playbooks = class {
5232
5232
  *
5233
5233
  * Answers what a create or update would be told about a definition, without writing: `valid`, and every graph problem it holds. A definition whose shape cannot be read is `400 VALIDATION_FAILED`, as on a write.
5234
5234
  *
5235
- * With a project (`project_id`, or the one a project-bound credential names), the references are checked too, as a write there would check them: the upstreams against that project's playbooks, and each executor the caller may start must exist (`EXECUTOR_NOT_FOUND`) and name an action its `mcp` tool allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`) and not be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), and each transformation's tool must not be a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). The caller needs both `playbooks:ValidatePlaybook` and `playbooks:ListPlaybooks` on the project. Without it, only the definition's own graph is checked.
5235
+ * With a project (`project_id`, or the one a project-bound credential names), the references are checked too, as a write there would check them: the upstreams against that project's playbooks, and each executor the caller may start must exist (`EXECUTOR_NOT_FOUND`) and name an action its `mcp` tool allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`) and not be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), and each transformation's tool must not be a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). With `policy_ids`, or the `playbook_id` whose own they are, each start they do not allow is `EXECUTOR_NOT_GRANTED`. The caller needs both `playbooks:ValidatePlaybook` and `playbooks:ListPlaybooks` on the project. Without it, only the definition's own graph is checked.
5236
5236
  */
5237
5237
  static validatePlaybook(options) {
5238
5238
  return (options.client ?? client).post({
@@ -5271,7 +5271,7 @@ var Playbooks = class {
5271
5271
  *
5272
5272
  * Updates any of `name`, `description`, `definition` and `policy_ids`. Only a change to `definition` or `policy_ids` archives a new version; a rename or a rewrite the playbook already holds leaves `version` where it is. A case keeps the version it was created on.
5273
5273
  *
5274
- * Every write is checked as on create against the playbook as it stands after it: `400 VALIDATION_FAILED` for one left without `policy_ids`, `403 POLICY_GRANT_NOT_HELD` for a policy whose grants the caller does not hold, `403 ACTION_NOT_HELD` for an executor it may not start, an `EXECUTOR_NOT_FOUND` problem for one that does not exist, `EXECUTOR_ACTION_REQUIRED` or `EXECUTOR_ACTION_UNAVAILABLE` for an `mcp` tool action a run could not call, `EXECUTOR_TOOL_UNSUPPORTED` for a `client` tool executor, `TRANSFORMATION_TOOL_UNSUPPORTED` for a `client` or `mcp` transformation tool.
5274
+ * Every write is checked as on create against the playbook as it stands after it: `400 VALIDATION_FAILED` for one left without `policy_ids`, `403 POLICY_GRANT_NOT_HELD` for a policy whose grants the caller does not hold, `403 ACTION_NOT_HELD` for an executor it may not start, an `EXECUTOR_NOT_FOUND` problem for one that does not exist, `EXECUTOR_ACTION_REQUIRED` or `EXECUTOR_ACTION_UNAVAILABLE` for an `mcp` tool action a run could not call, `EXECUTOR_TOOL_UNSUPPORTED` for a `client` tool executor, `TRANSFORMATION_TOOL_UNSUPPORTED` for a `client` or `mcp` transformation tool, `EXECUTOR_NOT_GRANTED` for a start `policy_ids` do not allow.
5275
5275
  */
5276
5276
  static updatePlaybook(options) {
5277
5277
  return (options.client ?? client).patch({
@@ -5323,7 +5323,7 @@ var Playbooks = class {
5323
5323
  /**
5324
5324
  * Create a case
5325
5325
  *
5326
- * Creates a case for one subject on the playbook's current version. The case stays on that version however the playbook changes later. A playbook that declares `upstreams` needs each bound to a case of the declared playbook, in the same project, of the same `actor_id`, that the caller may read (`playbooks:GetPlaybookCase`); anything else is `400 PLAYBOOK_CASE_UPSTREAM_INVALID`. The binding is fixed for the life of the case. A request serving an actor (a session turn of the actor, an `On-Behalf-Of` assertion naming it) creates only that actor's cases: an `actor_id` absent or naming another actor is `400 PLAYBOOK_CASE_ACTOR_MISMATCH`.
5326
+ * Creates a case for one subject on the playbook's current version. The case stays on that version however the playbook changes later. A playbook that declares `upstreams` needs each bound to a case of the declared playbook, in the same project, of the same `actor_id`, that the caller may read (`playbooks:GetPlaybookCase`); anything else is `400 PLAYBOOK_CASE_UPSTREAM_INVALID`. The binding is fixed for the life of the case. A request serving an actor (a session turn of the actor, an `On-Behalf-Of` assertion naming it) creates only that actor's cases: an `actor_id` absent or naming another actor is `400 PLAYBOOK_CASE_ACTOR_MISMATCH`. With `reuse_existing`, the actor's oldest case on the playbook with the same `subject` is returned with `200` and left unchanged; only when none exists is one created, with `201`. Concurrent requests for the same actor and subject create one case.
5327
5327
  */
5328
5328
  static createPlaybookCase(options) {
5329
5329
  return (options.client ?? client).post({
package/dist/index.d.cts CHANGED
@@ -7478,7 +7478,7 @@ type GenerationTranscript = {
7478
7478
  */
7479
7479
  step_count?: number;
7480
7480
  /**
7481
- * The messages the turn was asked, as recorded. Message content is caller-owned and passed through verbatim. Null when the content was never stored or has been purged.
7481
+ * What the model was asked: the system prompt exactly as it received it (the agent's rendered instructions and what the turn adds to them), as `system` messages, then the caller's messages. Message content is passed through verbatim. Null when the content was never stored or has been purged.
7482
7482
  *
7483
7483
  */
7484
7484
  input?: Array<{
@@ -9083,6 +9083,10 @@ type ValidatePlaybookRequest = {
9083
9083
  * The playbook the definition would update, so an upstream reading it back is `UPSTREAM_CYCLE`. Requires a project.
9084
9084
  */
9085
9085
  playbook_id?: string;
9086
+ /**
9087
+ * The policies the version would run under, checked to allow starting each executor and transformation tool (`EXECUTOR_NOT_GRANTED`); the `playbook_id`'s own when absent. Requires a project.
9088
+ */
9089
+ policy_ids?: AttachedPolicyIds;
9086
9090
  /**
9087
9091
  * The definition to check
9088
9092
  */
@@ -9091,7 +9095,7 @@ type ValidatePlaybookRequest = {
9091
9095
  type PlaybookValidationResult = {
9092
9096
  valid: boolean;
9093
9097
  /**
9094
- * Every reason the definition cannot be stored: `DUPLICATE_NODE`, `DUPLICATE_INPUT`, `MISSING_NODE`, `UNKNOWN_FIELD`, `EXECUTOR_REQUIRED`, `EXECUTOR_FORBIDDEN`, `TRANSFORMATIONS_NOT_FINAL`, `DUPLICATE_TRANSFORMATION`, `CYCLE`, and, with `project_id`, `UNKNOWN_UPSTREAM`, `UPSTREAM_CYCLE`, `EXECUTOR_NOT_FOUND`, `EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`, `EXECUTOR_TOOL_UNSUPPORTED` or `TRANSFORMATION_TOOL_UNSUPPORTED`. The same items a refused write lists under `meta.problems`.
9098
+ * Every reason the definition cannot be stored: `DUPLICATE_NODE`, `DUPLICATE_INPUT`, `MISSING_NODE`, `UNKNOWN_FIELD`, `EXECUTOR_REQUIRED`, `EXECUTOR_FORBIDDEN`, `TRANSFORMATIONS_NOT_FINAL`, `DUPLICATE_TRANSFORMATION`, `CYCLE`, and, with `project_id`, `UNKNOWN_UPSTREAM`, `UPSTREAM_CYCLE`, `EXECUTOR_NOT_FOUND`, `EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`, `EXECUTOR_TOOL_UNSUPPORTED`, `TRANSFORMATION_TOOL_UNSUPPORTED` or `EXECUTOR_NOT_GRANTED`. The same items a refused write lists under `meta.problems`.
9095
9099
  */
9096
9100
  problems: Array<ValidationProblem>;
9097
9101
  };
@@ -9144,6 +9148,10 @@ type CreatePlaybookCaseRequest = {
9144
9148
  */
9145
9149
  actor_id?: string;
9146
9150
  upstreams?: PlaybookCaseUpstreams;
9151
+ /**
9152
+ * Return the actor's existing case on this playbook and `subject` (`200`) instead of creating another; a case is created (`201`) only when none exists. Requires `actor_id`. An existing case is returned as it is: `upstreams` is not applied to it.
9153
+ */
9154
+ reuse_existing?: boolean;
9147
9155
  };
9148
9156
  /**
9149
9157
  * `blocked` while a required input is unset or reads a node that is not `done`, or, on an `upstream` node, while the node it pulls is not `done`; `ready` when it can run; `running` while its execution is queued or runs its executor; `waiting` while it waits on the workflow task or orchestration run it started, named by `run`; `done` when its output is current; `stale` when an input changed after its output was produced; `failed` when its execution failed on its current inputs; `rejected` when a person rejected its current inputs.
@@ -32425,7 +32433,7 @@ type CreatePlaybookCaseData = {
32425
32433
  };
32426
32434
  type CreatePlaybookCaseErrors = {
32427
32435
  /**
32428
- * Bad request — subject is missing, or an upstream is unbound or bound to a case it may not be
32436
+ * Bad request — subject is missing, `reuse_existing` names no actor, or an upstream is unbound or bound to a case it may not be
32429
32437
  */
32430
32438
  400: ErrorResponse;
32431
32439
  /**
@@ -32463,6 +32471,10 @@ type CreatePlaybookCaseErrors = {
32463
32471
  };
32464
32472
  type CreatePlaybookCaseError = CreatePlaybookCaseErrors[keyof CreatePlaybookCaseErrors];
32465
32473
  type CreatePlaybookCaseResponses = {
32474
+ /**
32475
+ * The actor's existing case, returned for `reuse_existing`
32476
+ */
32477
+ 200: PlaybookCase;
32466
32478
  /**
32467
32479
  * Case created
32468
32480
  */
@@ -43234,7 +43246,7 @@ export declare class Playbooks {
43234
43246
  *
43235
43247
  * Creates a playbook at version 1. The definition is refused with `400 PLAYBOOK_VALIDATION_FAILED` when it holds a duplicate node or input, an input reading a missing node or field, an `execute` node without an executor or another kind with one, transformations on a non-final node, or a cycle; `meta.problems` lists every one. A duplicate `name` in the project is `409 NAME_CONFLICT`.
43236
43248
  *
43237
- * The version's executors run under `policy_ids`, required and non-empty (`400 VALIDATION_FAILED`). The caller must hold every grant of each policy it names (`403 POLICY_GRANT_NOT_HELD`) and be allowed to start every executor the definition names (`403 ACTION_NOT_HELD`), and each must exist in the project, or be an agent or tool shared with it (`400 PLAYBOOK_VALIDATION_FAILED`, an `EXECUTOR_NOT_FOUND` problem). A `tool` executor on an `mcp` tool must name in `operation_id` an action the tool's binding allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`). An executor cannot be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), nor a transformation's tool a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`).
43249
+ * The version's executors run under `policy_ids`, required and non-empty (`400 VALIDATION_FAILED`). The caller must hold every grant of each policy it names (`403 POLICY_GRANT_NOT_HELD`) and be allowed to start every executor the definition names (`403 ACTION_NOT_HELD`), and each must exist in the project, or be an agent or tool shared with it (`400 PLAYBOOK_VALIDATION_FAILED`, an `EXECUTOR_NOT_FOUND` problem). A `tool` executor on an `mcp` tool must name in `operation_id` an action the tool's binding allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`). An executor cannot be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), nor a transformation's tool a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). `policy_ids` must allow starting each executor and transformation tool, or every run of its node would fail (`EXECUTOR_NOT_GRANTED`).
43238
43250
  */
43239
43251
  static createPlaybook<ThrowOnError extends boolean = false>(options: Options<CreatePlaybookData, ThrowOnError>): RequestResult<CreatePlaybookResponses, CreatePlaybookErrors, ThrowOnError>;
43240
43252
  /**
@@ -43242,7 +43254,7 @@ export declare class Playbooks {
43242
43254
  *
43243
43255
  * Answers what a create or update would be told about a definition, without writing: `valid`, and every graph problem it holds. A definition whose shape cannot be read is `400 VALIDATION_FAILED`, as on a write.
43244
43256
  *
43245
- * With a project (`project_id`, or the one a project-bound credential names), the references are checked too, as a write there would check them: the upstreams against that project's playbooks, and each executor the caller may start must exist (`EXECUTOR_NOT_FOUND`) and name an action its `mcp` tool allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`) and not be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), and each transformation's tool must not be a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). The caller needs both `playbooks:ValidatePlaybook` and `playbooks:ListPlaybooks` on the project. Without it, only the definition's own graph is checked.
43257
+ * With a project (`project_id`, or the one a project-bound credential names), the references are checked too, as a write there would check them: the upstreams against that project's playbooks, and each executor the caller may start must exist (`EXECUTOR_NOT_FOUND`) and name an action its `mcp` tool allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`) and not be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), and each transformation's tool must not be a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). With `policy_ids`, or the `playbook_id` whose own they are, each start they do not allow is `EXECUTOR_NOT_GRANTED`. The caller needs both `playbooks:ValidatePlaybook` and `playbooks:ListPlaybooks` on the project. Without it, only the definition's own graph is checked.
43246
43258
  */
43247
43259
  static validatePlaybook<ThrowOnError extends boolean = false>(options: Options<ValidatePlaybookData, ThrowOnError>): RequestResult<ValidatePlaybookResponses, ValidatePlaybookErrors, ThrowOnError>;
43248
43260
  /**
@@ -43262,7 +43274,7 @@ export declare class Playbooks {
43262
43274
  *
43263
43275
  * Updates any of `name`, `description`, `definition` and `policy_ids`. Only a change to `definition` or `policy_ids` archives a new version; a rename or a rewrite the playbook already holds leaves `version` where it is. A case keeps the version it was created on.
43264
43276
  *
43265
- * Every write is checked as on create against the playbook as it stands after it: `400 VALIDATION_FAILED` for one left without `policy_ids`, `403 POLICY_GRANT_NOT_HELD` for a policy whose grants the caller does not hold, `403 ACTION_NOT_HELD` for an executor it may not start, an `EXECUTOR_NOT_FOUND` problem for one that does not exist, `EXECUTOR_ACTION_REQUIRED` or `EXECUTOR_ACTION_UNAVAILABLE` for an `mcp` tool action a run could not call, `EXECUTOR_TOOL_UNSUPPORTED` for a `client` tool executor, `TRANSFORMATION_TOOL_UNSUPPORTED` for a `client` or `mcp` transformation tool.
43277
+ * Every write is checked as on create against the playbook as it stands after it: `400 VALIDATION_FAILED` for one left without `policy_ids`, `403 POLICY_GRANT_NOT_HELD` for a policy whose grants the caller does not hold, `403 ACTION_NOT_HELD` for an executor it may not start, an `EXECUTOR_NOT_FOUND` problem for one that does not exist, `EXECUTOR_ACTION_REQUIRED` or `EXECUTOR_ACTION_UNAVAILABLE` for an `mcp` tool action a run could not call, `EXECUTOR_TOOL_UNSUPPORTED` for a `client` tool executor, `TRANSFORMATION_TOOL_UNSUPPORTED` for a `client` or `mcp` transformation tool, `EXECUTOR_NOT_GRANTED` for a start `policy_ids` do not allow.
43266
43278
  */
43267
43279
  static updatePlaybook<ThrowOnError extends boolean = false>(options: Options<UpdatePlaybookData, ThrowOnError>): RequestResult<UpdatePlaybookResponses, UpdatePlaybookErrors, ThrowOnError>;
43268
43280
  /**
@@ -43286,7 +43298,7 @@ export declare class Playbooks {
43286
43298
  /**
43287
43299
  * Create a case
43288
43300
  *
43289
- * Creates a case for one subject on the playbook's current version. The case stays on that version however the playbook changes later. A playbook that declares `upstreams` needs each bound to a case of the declared playbook, in the same project, of the same `actor_id`, that the caller may read (`playbooks:GetPlaybookCase`); anything else is `400 PLAYBOOK_CASE_UPSTREAM_INVALID`. The binding is fixed for the life of the case. A request serving an actor (a session turn of the actor, an `On-Behalf-Of` assertion naming it) creates only that actor's cases: an `actor_id` absent or naming another actor is `400 PLAYBOOK_CASE_ACTOR_MISMATCH`.
43301
+ * Creates a case for one subject on the playbook's current version. The case stays on that version however the playbook changes later. A playbook that declares `upstreams` needs each bound to a case of the declared playbook, in the same project, of the same `actor_id`, that the caller may read (`playbooks:GetPlaybookCase`); anything else is `400 PLAYBOOK_CASE_UPSTREAM_INVALID`. The binding is fixed for the life of the case. A request serving an actor (a session turn of the actor, an `On-Behalf-Of` assertion naming it) creates only that actor's cases: an `actor_id` absent or naming another actor is `400 PLAYBOOK_CASE_ACTOR_MISMATCH`. With `reuse_existing`, the actor's oldest case on the playbook with the same `subject` is returned with `200` and left unchanged; only when none exists is one created, with `201`. Concurrent requests for the same actor and subject create one case.
43290
43302
  */
43291
43303
  static createPlaybookCase<ThrowOnError extends boolean = false>(options: Options<CreatePlaybookCaseData, ThrowOnError>): RequestResult<CreatePlaybookCaseResponses, CreatePlaybookCaseErrors, ThrowOnError>;
43292
43304
  /**
package/dist/index.d.mts CHANGED
@@ -7478,7 +7478,7 @@ type GenerationTranscript = {
7478
7478
  */
7479
7479
  step_count?: number;
7480
7480
  /**
7481
- * The messages the turn was asked, as recorded. Message content is caller-owned and passed through verbatim. Null when the content was never stored or has been purged.
7481
+ * What the model was asked: the system prompt exactly as it received it (the agent's rendered instructions and what the turn adds to them), as `system` messages, then the caller's messages. Message content is passed through verbatim. Null when the content was never stored or has been purged.
7482
7482
  *
7483
7483
  */
7484
7484
  input?: Array<{
@@ -9083,6 +9083,10 @@ type ValidatePlaybookRequest = {
9083
9083
  * The playbook the definition would update, so an upstream reading it back is `UPSTREAM_CYCLE`. Requires a project.
9084
9084
  */
9085
9085
  playbook_id?: string;
9086
+ /**
9087
+ * The policies the version would run under, checked to allow starting each executor and transformation tool (`EXECUTOR_NOT_GRANTED`); the `playbook_id`'s own when absent. Requires a project.
9088
+ */
9089
+ policy_ids?: AttachedPolicyIds;
9086
9090
  /**
9087
9091
  * The definition to check
9088
9092
  */
@@ -9091,7 +9095,7 @@ type ValidatePlaybookRequest = {
9091
9095
  type PlaybookValidationResult = {
9092
9096
  valid: boolean;
9093
9097
  /**
9094
- * Every reason the definition cannot be stored: `DUPLICATE_NODE`, `DUPLICATE_INPUT`, `MISSING_NODE`, `UNKNOWN_FIELD`, `EXECUTOR_REQUIRED`, `EXECUTOR_FORBIDDEN`, `TRANSFORMATIONS_NOT_FINAL`, `DUPLICATE_TRANSFORMATION`, `CYCLE`, and, with `project_id`, `UNKNOWN_UPSTREAM`, `UPSTREAM_CYCLE`, `EXECUTOR_NOT_FOUND`, `EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`, `EXECUTOR_TOOL_UNSUPPORTED` or `TRANSFORMATION_TOOL_UNSUPPORTED`. The same items a refused write lists under `meta.problems`.
9098
+ * Every reason the definition cannot be stored: `DUPLICATE_NODE`, `DUPLICATE_INPUT`, `MISSING_NODE`, `UNKNOWN_FIELD`, `EXECUTOR_REQUIRED`, `EXECUTOR_FORBIDDEN`, `TRANSFORMATIONS_NOT_FINAL`, `DUPLICATE_TRANSFORMATION`, `CYCLE`, and, with `project_id`, `UNKNOWN_UPSTREAM`, `UPSTREAM_CYCLE`, `EXECUTOR_NOT_FOUND`, `EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`, `EXECUTOR_TOOL_UNSUPPORTED`, `TRANSFORMATION_TOOL_UNSUPPORTED` or `EXECUTOR_NOT_GRANTED`. The same items a refused write lists under `meta.problems`.
9095
9099
  */
9096
9100
  problems: Array<ValidationProblem>;
9097
9101
  };
@@ -9144,6 +9148,10 @@ type CreatePlaybookCaseRequest = {
9144
9148
  */
9145
9149
  actor_id?: string;
9146
9150
  upstreams?: PlaybookCaseUpstreams;
9151
+ /**
9152
+ * Return the actor's existing case on this playbook and `subject` (`200`) instead of creating another; a case is created (`201`) only when none exists. Requires `actor_id`. An existing case is returned as it is: `upstreams` is not applied to it.
9153
+ */
9154
+ reuse_existing?: boolean;
9147
9155
  };
9148
9156
  /**
9149
9157
  * `blocked` while a required input is unset or reads a node that is not `done`, or, on an `upstream` node, while the node it pulls is not `done`; `ready` when it can run; `running` while its execution is queued or runs its executor; `waiting` while it waits on the workflow task or orchestration run it started, named by `run`; `done` when its output is current; `stale` when an input changed after its output was produced; `failed` when its execution failed on its current inputs; `rejected` when a person rejected its current inputs.
@@ -32425,7 +32433,7 @@ type CreatePlaybookCaseData = {
32425
32433
  };
32426
32434
  type CreatePlaybookCaseErrors = {
32427
32435
  /**
32428
- * Bad request — subject is missing, or an upstream is unbound or bound to a case it may not be
32436
+ * Bad request — subject is missing, `reuse_existing` names no actor, or an upstream is unbound or bound to a case it may not be
32429
32437
  */
32430
32438
  400: ErrorResponse;
32431
32439
  /**
@@ -32463,6 +32471,10 @@ type CreatePlaybookCaseErrors = {
32463
32471
  };
32464
32472
  type CreatePlaybookCaseError = CreatePlaybookCaseErrors[keyof CreatePlaybookCaseErrors];
32465
32473
  type CreatePlaybookCaseResponses = {
32474
+ /**
32475
+ * The actor's existing case, returned for `reuse_existing`
32476
+ */
32477
+ 200: PlaybookCase;
32466
32478
  /**
32467
32479
  * Case created
32468
32480
  */
@@ -43234,7 +43246,7 @@ export declare class Playbooks {
43234
43246
  *
43235
43247
  * Creates a playbook at version 1. The definition is refused with `400 PLAYBOOK_VALIDATION_FAILED` when it holds a duplicate node or input, an input reading a missing node or field, an `execute` node without an executor or another kind with one, transformations on a non-final node, or a cycle; `meta.problems` lists every one. A duplicate `name` in the project is `409 NAME_CONFLICT`.
43236
43248
  *
43237
- * The version's executors run under `policy_ids`, required and non-empty (`400 VALIDATION_FAILED`). The caller must hold every grant of each policy it names (`403 POLICY_GRANT_NOT_HELD`) and be allowed to start every executor the definition names (`403 ACTION_NOT_HELD`), and each must exist in the project, or be an agent or tool shared with it (`400 PLAYBOOK_VALIDATION_FAILED`, an `EXECUTOR_NOT_FOUND` problem). A `tool` executor on an `mcp` tool must name in `operation_id` an action the tool's binding allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`). An executor cannot be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), nor a transformation's tool a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`).
43249
+ * The version's executors run under `policy_ids`, required and non-empty (`400 VALIDATION_FAILED`). The caller must hold every grant of each policy it names (`403 POLICY_GRANT_NOT_HELD`) and be allowed to start every executor the definition names (`403 ACTION_NOT_HELD`), and each must exist in the project, or be an agent or tool shared with it (`400 PLAYBOOK_VALIDATION_FAILED`, an `EXECUTOR_NOT_FOUND` problem). A `tool` executor on an `mcp` tool must name in `operation_id` an action the tool's binding allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`). An executor cannot be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), nor a transformation's tool a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). `policy_ids` must allow starting each executor and transformation tool, or every run of its node would fail (`EXECUTOR_NOT_GRANTED`).
43238
43250
  */
43239
43251
  static createPlaybook<ThrowOnError extends boolean = false>(options: Options<CreatePlaybookData, ThrowOnError>): RequestResult<CreatePlaybookResponses, CreatePlaybookErrors, ThrowOnError>;
43240
43252
  /**
@@ -43242,7 +43254,7 @@ export declare class Playbooks {
43242
43254
  *
43243
43255
  * Answers what a create or update would be told about a definition, without writing: `valid`, and every graph problem it holds. A definition whose shape cannot be read is `400 VALIDATION_FAILED`, as on a write.
43244
43256
  *
43245
- * With a project (`project_id`, or the one a project-bound credential names), the references are checked too, as a write there would check them: the upstreams against that project's playbooks, and each executor the caller may start must exist (`EXECUTOR_NOT_FOUND`) and name an action its `mcp` tool allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`) and not be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), and each transformation's tool must not be a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). The caller needs both `playbooks:ValidatePlaybook` and `playbooks:ListPlaybooks` on the project. Without it, only the definition's own graph is checked.
43257
+ * With a project (`project_id`, or the one a project-bound credential names), the references are checked too, as a write there would check them: the upstreams against that project's playbooks, and each executor the caller may start must exist (`EXECUTOR_NOT_FOUND`) and name an action its `mcp` tool allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`) and not be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), and each transformation's tool must not be a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). With `policy_ids`, or the `playbook_id` whose own they are, each start they do not allow is `EXECUTOR_NOT_GRANTED`. The caller needs both `playbooks:ValidatePlaybook` and `playbooks:ListPlaybooks` on the project. Without it, only the definition's own graph is checked.
43246
43258
  */
43247
43259
  static validatePlaybook<ThrowOnError extends boolean = false>(options: Options<ValidatePlaybookData, ThrowOnError>): RequestResult<ValidatePlaybookResponses, ValidatePlaybookErrors, ThrowOnError>;
43248
43260
  /**
@@ -43262,7 +43274,7 @@ export declare class Playbooks {
43262
43274
  *
43263
43275
  * Updates any of `name`, `description`, `definition` and `policy_ids`. Only a change to `definition` or `policy_ids` archives a new version; a rename or a rewrite the playbook already holds leaves `version` where it is. A case keeps the version it was created on.
43264
43276
  *
43265
- * Every write is checked as on create against the playbook as it stands after it: `400 VALIDATION_FAILED` for one left without `policy_ids`, `403 POLICY_GRANT_NOT_HELD` for a policy whose grants the caller does not hold, `403 ACTION_NOT_HELD` for an executor it may not start, an `EXECUTOR_NOT_FOUND` problem for one that does not exist, `EXECUTOR_ACTION_REQUIRED` or `EXECUTOR_ACTION_UNAVAILABLE` for an `mcp` tool action a run could not call, `EXECUTOR_TOOL_UNSUPPORTED` for a `client` tool executor, `TRANSFORMATION_TOOL_UNSUPPORTED` for a `client` or `mcp` transformation tool.
43277
+ * Every write is checked as on create against the playbook as it stands after it: `400 VALIDATION_FAILED` for one left without `policy_ids`, `403 POLICY_GRANT_NOT_HELD` for a policy whose grants the caller does not hold, `403 ACTION_NOT_HELD` for an executor it may not start, an `EXECUTOR_NOT_FOUND` problem for one that does not exist, `EXECUTOR_ACTION_REQUIRED` or `EXECUTOR_ACTION_UNAVAILABLE` for an `mcp` tool action a run could not call, `EXECUTOR_TOOL_UNSUPPORTED` for a `client` tool executor, `TRANSFORMATION_TOOL_UNSUPPORTED` for a `client` or `mcp` transformation tool, `EXECUTOR_NOT_GRANTED` for a start `policy_ids` do not allow.
43266
43278
  */
43267
43279
  static updatePlaybook<ThrowOnError extends boolean = false>(options: Options<UpdatePlaybookData, ThrowOnError>): RequestResult<UpdatePlaybookResponses, UpdatePlaybookErrors, ThrowOnError>;
43268
43280
  /**
@@ -43286,7 +43298,7 @@ export declare class Playbooks {
43286
43298
  /**
43287
43299
  * Create a case
43288
43300
  *
43289
- * Creates a case for one subject on the playbook's current version. The case stays on that version however the playbook changes later. A playbook that declares `upstreams` needs each bound to a case of the declared playbook, in the same project, of the same `actor_id`, that the caller may read (`playbooks:GetPlaybookCase`); anything else is `400 PLAYBOOK_CASE_UPSTREAM_INVALID`. The binding is fixed for the life of the case. A request serving an actor (a session turn of the actor, an `On-Behalf-Of` assertion naming it) creates only that actor's cases: an `actor_id` absent or naming another actor is `400 PLAYBOOK_CASE_ACTOR_MISMATCH`.
43301
+ * Creates a case for one subject on the playbook's current version. The case stays on that version however the playbook changes later. A playbook that declares `upstreams` needs each bound to a case of the declared playbook, in the same project, of the same `actor_id`, that the caller may read (`playbooks:GetPlaybookCase`); anything else is `400 PLAYBOOK_CASE_UPSTREAM_INVALID`. The binding is fixed for the life of the case. A request serving an actor (a session turn of the actor, an `On-Behalf-Of` assertion naming it) creates only that actor's cases: an `actor_id` absent or naming another actor is `400 PLAYBOOK_CASE_ACTOR_MISMATCH`. With `reuse_existing`, the actor's oldest case on the playbook with the same `subject` is returned with `200` and left unchanged; only when none exists is one created, with `201`. Concurrent requests for the same actor and subject create one case.
43290
43302
  */
43291
43303
  static createPlaybookCase<ThrowOnError extends boolean = false>(options: Options<CreatePlaybookCaseData, ThrowOnError>): RequestResult<CreatePlaybookCaseResponses, CreatePlaybookCaseErrors, ThrowOnError>;
43292
43304
  /**
package/dist/index.mjs CHANGED
@@ -5214,7 +5214,7 @@ var Playbooks = class {
5214
5214
  *
5215
5215
  * Creates a playbook at version 1. The definition is refused with `400 PLAYBOOK_VALIDATION_FAILED` when it holds a duplicate node or input, an input reading a missing node or field, an `execute` node without an executor or another kind with one, transformations on a non-final node, or a cycle; `meta.problems` lists every one. A duplicate `name` in the project is `409 NAME_CONFLICT`.
5216
5216
  *
5217
- * The version's executors run under `policy_ids`, required and non-empty (`400 VALIDATION_FAILED`). The caller must hold every grant of each policy it names (`403 POLICY_GRANT_NOT_HELD`) and be allowed to start every executor the definition names (`403 ACTION_NOT_HELD`), and each must exist in the project, or be an agent or tool shared with it (`400 PLAYBOOK_VALIDATION_FAILED`, an `EXECUTOR_NOT_FOUND` problem). A `tool` executor on an `mcp` tool must name in `operation_id` an action the tool's binding allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`). An executor cannot be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), nor a transformation's tool a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`).
5217
+ * The version's executors run under `policy_ids`, required and non-empty (`400 VALIDATION_FAILED`). The caller must hold every grant of each policy it names (`403 POLICY_GRANT_NOT_HELD`) and be allowed to start every executor the definition names (`403 ACTION_NOT_HELD`), and each must exist in the project, or be an agent or tool shared with it (`400 PLAYBOOK_VALIDATION_FAILED`, an `EXECUTOR_NOT_FOUND` problem). A `tool` executor on an `mcp` tool must name in `operation_id` an action the tool's binding allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`). An executor cannot be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), nor a transformation's tool a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). `policy_ids` must allow starting each executor and transformation tool, or every run of its node would fail (`EXECUTOR_NOT_GRANTED`).
5218
5218
  */
5219
5219
  static createPlaybook(options) {
5220
5220
  return (options.client ?? client).post({
@@ -5231,7 +5231,7 @@ var Playbooks = class {
5231
5231
  *
5232
5232
  * Answers what a create or update would be told about a definition, without writing: `valid`, and every graph problem it holds. A definition whose shape cannot be read is `400 VALIDATION_FAILED`, as on a write.
5233
5233
  *
5234
- * With a project (`project_id`, or the one a project-bound credential names), the references are checked too, as a write there would check them: the upstreams against that project's playbooks, and each executor the caller may start must exist (`EXECUTOR_NOT_FOUND`) and name an action its `mcp` tool allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`) and not be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), and each transformation's tool must not be a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). The caller needs both `playbooks:ValidatePlaybook` and `playbooks:ListPlaybooks` on the project. Without it, only the definition's own graph is checked.
5234
+ * With a project (`project_id`, or the one a project-bound credential names), the references are checked too, as a write there would check them: the upstreams against that project's playbooks, and each executor the caller may start must exist (`EXECUTOR_NOT_FOUND`) and name an action its `mcp` tool allows (`EXECUTOR_ACTION_REQUIRED`, `EXECUTOR_ACTION_UNAVAILABLE`) and not be a `client` tool (`EXECUTOR_TOOL_UNSUPPORTED`), and each transformation's tool must not be a `client` or `mcp` tool (`TRANSFORMATION_TOOL_UNSUPPORTED`). With `policy_ids`, or the `playbook_id` whose own they are, each start they do not allow is `EXECUTOR_NOT_GRANTED`. The caller needs both `playbooks:ValidatePlaybook` and `playbooks:ListPlaybooks` on the project. Without it, only the definition's own graph is checked.
5235
5235
  */
5236
5236
  static validatePlaybook(options) {
5237
5237
  return (options.client ?? client).post({
@@ -5270,7 +5270,7 @@ var Playbooks = class {
5270
5270
  *
5271
5271
  * Updates any of `name`, `description`, `definition` and `policy_ids`. Only a change to `definition` or `policy_ids` archives a new version; a rename or a rewrite the playbook already holds leaves `version` where it is. A case keeps the version it was created on.
5272
5272
  *
5273
- * Every write is checked as on create against the playbook as it stands after it: `400 VALIDATION_FAILED` for one left without `policy_ids`, `403 POLICY_GRANT_NOT_HELD` for a policy whose grants the caller does not hold, `403 ACTION_NOT_HELD` for an executor it may not start, an `EXECUTOR_NOT_FOUND` problem for one that does not exist, `EXECUTOR_ACTION_REQUIRED` or `EXECUTOR_ACTION_UNAVAILABLE` for an `mcp` tool action a run could not call, `EXECUTOR_TOOL_UNSUPPORTED` for a `client` tool executor, `TRANSFORMATION_TOOL_UNSUPPORTED` for a `client` or `mcp` transformation tool.
5273
+ * Every write is checked as on create against the playbook as it stands after it: `400 VALIDATION_FAILED` for one left without `policy_ids`, `403 POLICY_GRANT_NOT_HELD` for a policy whose grants the caller does not hold, `403 ACTION_NOT_HELD` for an executor it may not start, an `EXECUTOR_NOT_FOUND` problem for one that does not exist, `EXECUTOR_ACTION_REQUIRED` or `EXECUTOR_ACTION_UNAVAILABLE` for an `mcp` tool action a run could not call, `EXECUTOR_TOOL_UNSUPPORTED` for a `client` tool executor, `TRANSFORMATION_TOOL_UNSUPPORTED` for a `client` or `mcp` transformation tool, `EXECUTOR_NOT_GRANTED` for a start `policy_ids` do not allow.
5274
5274
  */
5275
5275
  static updatePlaybook(options) {
5276
5276
  return (options.client ?? client).patch({
@@ -5322,7 +5322,7 @@ var Playbooks = class {
5322
5322
  /**
5323
5323
  * Create a case
5324
5324
  *
5325
- * Creates a case for one subject on the playbook's current version. The case stays on that version however the playbook changes later. A playbook that declares `upstreams` needs each bound to a case of the declared playbook, in the same project, of the same `actor_id`, that the caller may read (`playbooks:GetPlaybookCase`); anything else is `400 PLAYBOOK_CASE_UPSTREAM_INVALID`. The binding is fixed for the life of the case. A request serving an actor (a session turn of the actor, an `On-Behalf-Of` assertion naming it) creates only that actor's cases: an `actor_id` absent or naming another actor is `400 PLAYBOOK_CASE_ACTOR_MISMATCH`.
5325
+ * Creates a case for one subject on the playbook's current version. The case stays on that version however the playbook changes later. A playbook that declares `upstreams` needs each bound to a case of the declared playbook, in the same project, of the same `actor_id`, that the caller may read (`playbooks:GetPlaybookCase`); anything else is `400 PLAYBOOK_CASE_UPSTREAM_INVALID`. The binding is fixed for the life of the case. A request serving an actor (a session turn of the actor, an `On-Behalf-Of` assertion naming it) creates only that actor's cases: an `actor_id` absent or naming another actor is `400 PLAYBOOK_CASE_ACTOR_MISMATCH`. With `reuse_existing`, the actor's oldest case on the playbook with the same `subject` is returned with `200` and left unchanged; only when none exists is one created, with `201`. Concurrent requests for the same actor and subject create one case.
5326
5326
  */
5327
5327
  static createPlaybookCase(options) {
5328
5328
  return (options.client ?? client).post({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.320.0",
3
+ "version": "0.321.0",
4
4
  "description": "TypeScript SDK for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "keywords": [
6
6
  "naturali",
@@ -38,7 +38,7 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@hey-api/openapi-ts": "^0.99.0",
41
- "@naturali/api": "0.320.0",
41
+ "@naturali/api": "0.321.0",
42
42
  "@ttoss/openapi-codegen": "^0.10.1",
43
43
  "@types/node": "^26.5.1",
44
44
  "tsdown": "^0.23.0",