@naturali/sdk 0.194.2 → 0.195.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.mjs CHANGED
@@ -4494,6 +4494,361 @@ var Orchestrations = class {
4494
4494
  });
4495
4495
  }
4496
4496
  };
4497
+ var Playbooks = class {
4498
+ /**
4499
+ * List playbooks
4500
+ *
4501
+ * Returns the playbooks defined in a project, newest first.
4502
+ */
4503
+ static listPlaybooks(options) {
4504
+ return (options.client ?? client).get({
4505
+ url: "/v1/projects/{project_id}/playbooks",
4506
+ ...options
4507
+ });
4508
+ }
4509
+ /**
4510
+ * Create a playbook
4511
+ *
4512
+ * 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`.
4513
+ *
4514
+ * The caller becomes the version's author, whom its executors run as, so it must be allowed to start every executor the definition names (`403 PLAYBOOK_EXECUTOR_FORBIDDEN`). A definition with executors written with a trigger or OAuth token is `409 PLAYBOOK_AUTHOR_UNAVAILABLE`: those carry their boundary in the token, so no run can act as them.
4515
+ */
4516
+ static createPlaybook(options) {
4517
+ return (options.client ?? client).post({
4518
+ url: "/v1/projects/{project_id}/playbooks",
4519
+ ...options,
4520
+ headers: {
4521
+ "Content-Type": "application/json",
4522
+ ...options.headers
4523
+ }
4524
+ });
4525
+ }
4526
+ /**
4527
+ * Validate a playbook definition
4528
+ *
4529
+ * 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.
4530
+ */
4531
+ static validatePlaybook(options) {
4532
+ return (options.client ?? client).post({
4533
+ url: "/v1/projects/{project_id}/playbooks/validate",
4534
+ ...options,
4535
+ headers: {
4536
+ "Content-Type": "application/json",
4537
+ ...options.headers
4538
+ }
4539
+ });
4540
+ }
4541
+ /**
4542
+ * Delete a playbook
4543
+ *
4544
+ * Deletes a playbook and its version archive. A playbook with cases is refused with `409 PLAYBOOK_HAS_CASES`.
4545
+ */
4546
+ static deletePlaybook(options) {
4547
+ return (options.client ?? client).delete({
4548
+ url: "/v1/projects/{project_id}/playbooks/{playbook_id}",
4549
+ ...options
4550
+ });
4551
+ }
4552
+ /**
4553
+ * Get a playbook
4554
+ *
4555
+ * Returns a playbook with its current definition and version.
4556
+ */
4557
+ static getPlaybook(options) {
4558
+ return (options.client ?? client).get({
4559
+ url: "/v1/projects/{project_id}/playbooks/{playbook_id}",
4560
+ ...options
4561
+ });
4562
+ }
4563
+ /**
4564
+ * Update a playbook
4565
+ *
4566
+ * Updates any of `name`, `description` and `definition`. Only a change to `definition` archives a new version; a rename or a rewrite of the definition the playbook already holds leaves `version` where it is. A case keeps the version it was created on.
4567
+ *
4568
+ * A new version is authored by the caller, checked as on create: `403 PLAYBOOK_EXECUTOR_FORBIDDEN` for an executor it may not start, `409 PLAYBOOK_AUTHOR_UNAVAILABLE` for a trigger or OAuth token.
4569
+ */
4570
+ static updatePlaybook(options) {
4571
+ return (options.client ?? client).patch({
4572
+ url: "/v1/projects/{project_id}/playbooks/{playbook_id}",
4573
+ ...options,
4574
+ headers: {
4575
+ "Content-Type": "application/json",
4576
+ ...options.headers
4577
+ }
4578
+ });
4579
+ }
4580
+ /**
4581
+ * List a playbook's versions
4582
+ *
4583
+ * Returns the playbook's archived definitions, newest first. A version is written on create and on every write that changes `definition`.
4584
+ */
4585
+ static listPlaybookVersions(options) {
4586
+ return (options.client ?? client).get({
4587
+ url: "/v1/projects/{project_id}/playbooks/{playbook_id}/versions",
4588
+ ...options
4589
+ });
4590
+ }
4591
+ /**
4592
+ * Fetch an archived playbook version
4593
+ *
4594
+ * Returns the definition a version held: what a case pinned to it is evaluated against.
4595
+ */
4596
+ static getPlaybookVersion(options) {
4597
+ return (options.client ?? client).get({
4598
+ url: "/v1/projects/{project_id}/playbooks/{playbook_id}/versions/{version}",
4599
+ ...options
4600
+ });
4601
+ }
4602
+ /**
4603
+ * Restore an archived playbook version
4604
+ *
4605
+ * Writes an archived definition back as the playbook's live one, which archives it again as a new version rather than rewinding the counter. Restoring the definition the playbook already holds is a no-op. The caller authors the new version, checked as on create.
4606
+ */
4607
+ static restorePlaybookVersion(options) {
4608
+ return (options.client ?? client).post({
4609
+ url: "/v1/projects/{project_id}/playbooks/{playbook_id}/versions/{version}/restore",
4610
+ ...options,
4611
+ headers: {
4612
+ "Content-Type": "application/json",
4613
+ ...options.headers
4614
+ }
4615
+ });
4616
+ }
4617
+ /**
4618
+ * Create a case
4619
+ *
4620
+ * Creates a case for one subject on the playbook's current version. The case stays on that version however the playbook changes later.
4621
+ */
4622
+ static createPlaybookCase(options) {
4623
+ return (options.client ?? client).post({
4624
+ url: "/v1/projects/{project_id}/playbooks/{playbook_id}/cases",
4625
+ ...options,
4626
+ headers: {
4627
+ "Content-Type": "application/json",
4628
+ ...options.headers
4629
+ }
4630
+ });
4631
+ }
4632
+ /**
4633
+ * List playbook cases
4634
+ *
4635
+ * Returns a project's cases, newest first, without node states; read one case for those.
4636
+ */
4637
+ static listPlaybookCases(options) {
4638
+ return (options.client ?? client).get({
4639
+ url: "/v1/projects/{project_id}/playbook-cases",
4640
+ ...options
4641
+ });
4642
+ }
4643
+ /**
4644
+ * Delete a case
4645
+ *
4646
+ * Deletes a case and every entry written to it.
4647
+ */
4648
+ static deletePlaybookCase(options) {
4649
+ return (options.client ?? client).delete({
4650
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}",
4651
+ ...options
4652
+ });
4653
+ }
4654
+ /**
4655
+ * Get a case
4656
+ *
4657
+ * Returns a case with every node's state, computed from its entries on each read and never stored.
4658
+ */
4659
+ static getPlaybookCase(options) {
4660
+ return (options.client ?? client).get({
4661
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}",
4662
+ ...options
4663
+ });
4664
+ }
4665
+ /**
4666
+ * Write a case's inputs
4667
+ *
4668
+ * Writes a batch of manual inputs, all or none. Each write names the revision it read in `expected_revision`, `null` for a field still unset; when any field has moved on the whole batch is refused with `409 PLAYBOOK_INPUT_CONFLICT` and `meta.conflicts` names each field. An input the case's version does not declare, one that reads another node, or a value its schema refuses is `400 PLAYBOOK_INPUT_INVALID`. A value equal to the field's current one writes no revision. Once written, every node the write makes runnable is queued to run, unless the case is paused. A write made with a credential the case's own work runs as — the case, one of its executions in flight, or the task or run one started — is `403 PLAYBOOK_SELF_WRITE`.
4669
+ */
4670
+ static writePlaybookCaseInputs(options) {
4671
+ return (options.client ?? client).post({
4672
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/inputs",
4673
+ ...options,
4674
+ headers: {
4675
+ "Content-Type": "application/json",
4676
+ ...options.headers
4677
+ }
4678
+ });
4679
+ }
4680
+ /**
4681
+ * List what a node still needs
4682
+ *
4683
+ * Returns the manual inputs still unset, or refused by their schema, before `node` can be reached, grouped in waves: nothing in a later wave can run before the earlier ones are filled.
4684
+ */
4685
+ static getPlaybookCaseMissing(options) {
4686
+ return (options.client ?? client).get({
4687
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/missing",
4688
+ ...options
4689
+ });
4690
+ }
4691
+ /**
4692
+ * List a case's entries
4693
+ *
4694
+ * Returns every value written to the case, newest first. Entries are never rewritten, so this is the case's full history.
4695
+ */
4696
+ static listPlaybookCaseEntries(options) {
4697
+ return (options.client ?? client).get({
4698
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/entries",
4699
+ ...options
4700
+ });
4701
+ }
4702
+ /**
4703
+ * Run a node of a case
4704
+ *
4705
+ * Runs one node now. The cascade already runs every node whose inputs are set once a write, a settle or a resume makes it runnable, and never reruns a `failed` one: this is how a failed node is retried. A `collect` node takes its own input values as its output, any other node starts its executor with the node's input values mapped through the executor's `input`. The executor runs as the author of the case's playbook version, whose permission to start it is checked again here (`403 PLAYBOOK_EXECUTOR_FORBIDDEN`); an author that no longer exists is `409 PLAYBOOK_AUTHOR_UNAVAILABLE`. Only a `ready`, `stale` or `failed` node with every required input set runs; anything else is `409 PLAYBOOK_NODE_NOT_RUNNABLE`. A paused case is `409 PLAYBOOK_CASE_PAUSED`.
4706
+ *
4707
+ * The output is written as an entry when the execution settles. A value equal to the node's current output writes no revision. If the node's inputs change while it runs, the execution settles as `superseded` and writes nothing.
4708
+ *
4709
+ * Without `wait` the execution answers `running` and settles in the background. With `wait: true` it answers once the executor settles, or once it parks: a workflow task still open, or an orchestration run waiting on a person or a timer, settles the node when it closes or ends.
4710
+ */
4711
+ static runPlaybookCaseNode(options) {
4712
+ return (options.client ?? client).post({
4713
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/nodes/{node}/run",
4714
+ ...options,
4715
+ headers: {
4716
+ "Content-Type": "application/json",
4717
+ ...options.headers
4718
+ }
4719
+ });
4720
+ }
4721
+ /**
4722
+ * List a case's executions
4723
+ *
4724
+ * Returns every run of the case's nodes, newest first.
4725
+ */
4726
+ static listPlaybookCaseExecutions(options) {
4727
+ return (options.client ?? client).get({
4728
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/executions",
4729
+ ...options
4730
+ });
4731
+ }
4732
+ /**
4733
+ * Get an execution
4734
+ *
4735
+ * Returns one run of a case's node.
4736
+ */
4737
+ static getPlaybookCaseExecution(options) {
4738
+ return (options.client ?? client).get({
4739
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/executions/{execution_id}",
4740
+ ...options
4741
+ });
4742
+ }
4743
+ /**
4744
+ * Export a final node
4745
+ *
4746
+ * Renders one revision of a final node as files, one export per transformation: each transformation's tool is called with the case's `case_id` and `subject`, the `node`, the `revision` and that revision's `output`, and must answer a file (`execute.response_mode: base64`) of its `format`'s content type. The file is kept in the project's files under `/.system/playbooks/`. An export never feeds a node.
4747
+ *
4748
+ * Without `revision` the node's current output is exported, which needs the node `done` (`409 PLAYBOOK_NODE_NOT_EXPORTABLE`); a `revision` names an earlier output or confirmation of the node. Each tool runs as the author of the case's playbook version, whose permission to call it is checked here (`403 PLAYBOOK_EXECUTOR_FORBIDDEN`). A paused case is `409 PLAYBOOK_CASE_PAUSED`.
4749
+ *
4750
+ * Without `wait` every export answers `running` and settles in the background; with `wait: true` it answers once each has its file or its error.
4751
+ */
4752
+ static exportPlaybookCaseNode(options) {
4753
+ return (options.client ?? client).post({
4754
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/nodes/{node}/exports",
4755
+ ...options,
4756
+ headers: {
4757
+ "Content-Type": "application/json",
4758
+ ...options.headers
4759
+ }
4760
+ });
4761
+ }
4762
+ /**
4763
+ * List a case's exports
4764
+ *
4765
+ * Returns every file rendered from the case's final nodes, newest first.
4766
+ */
4767
+ static listPlaybookCaseExports(options) {
4768
+ return (options.client ?? client).get({
4769
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/exports",
4770
+ ...options
4771
+ });
4772
+ }
4773
+ /**
4774
+ * Get an export
4775
+ *
4776
+ * Returns one file rendered from a case's final node.
4777
+ */
4778
+ static getPlaybookCaseExport(options) {
4779
+ return (options.client ?? client).get({
4780
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/exports/{export_id}",
4781
+ ...options
4782
+ });
4783
+ }
4784
+ /**
4785
+ * Upgrade a case
4786
+ *
4787
+ * Moves a case to another version of its playbook: the playbook's current version, or the `version` named, an earlier one included. Values carry over by node key, and every node's state is read against the new version: a node added is open, a node removed leaves the structure while its entries stay, a node whose input reads another field is `stale`, and a value its input's new schema refuses is missing again. The cascade then runs what became runnable. Each upgrade is recorded with what moved; the version the case is already on records nothing.
4788
+ *
4789
+ * An execution running is `409 PLAYBOOK_CASE_BUSY`; one queued but not started settles `superseded`. An upgrade made with a credential the case's own work runs as is `403 PLAYBOOK_SELF_WRITE`.
4790
+ */
4791
+ static upgradePlaybookCase(options) {
4792
+ return (options.client ?? client).post({
4793
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/upgrade",
4794
+ ...options,
4795
+ headers: {
4796
+ "Content-Type": "application/json",
4797
+ ...options.headers
4798
+ }
4799
+ });
4800
+ }
4801
+ /**
4802
+ * List a case's upgrades
4803
+ *
4804
+ * Returns every version change of the case, newest first.
4805
+ */
4806
+ static listPlaybookCaseUpgrades(options) {
4807
+ return (options.client ?? client).get({
4808
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/upgrades",
4809
+ ...options
4810
+ });
4811
+ }
4812
+ /**
4813
+ * Pause a case
4814
+ *
4815
+ * Stops the case starting anything: no node is queued and no queued execution starts until it is resumed. Executions already running settle. Input writes are still accepted. Pausing a paused case keeps the first pause.
4816
+ */
4817
+ static pausePlaybookCase(options) {
4818
+ return (options.client ?? client).post({
4819
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/pause",
4820
+ ...options
4821
+ });
4822
+ }
4823
+ /**
4824
+ * Resume a case
4825
+ *
4826
+ * Lifts the pause and starts what became runnable while the case was paused. A case that is not paused is `409 PLAYBOOK_CASE_NOT_PAUSED`.
4827
+ */
4828
+ static resumePlaybookCase(options) {
4829
+ return (options.client ?? client).post({
4830
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/resume",
4831
+ ...options
4832
+ });
4833
+ }
4834
+ /**
4835
+ * Confirm a node of a case
4836
+ *
4837
+ * Approves or rejects a `confirm` node on the inputs the confirmer read. `expected_revisions` names the revision of each of the node's inputs as read (`nodes[].inputs[].revision` on the case); an input that moved since is `409 PLAYBOOK_INPUT_CONFLICT`, `meta.conflicts` naming each, and nothing is written.
4838
+ *
4839
+ * An approval writes a `confirmation` entry whose value is the node's input values: it is the node's output, and the nodes reading it run next. A rejection writes a `rejection` entry with the `reason`: the node is `rejected`, and every node reading it is blocked, until its inputs change or it is approved. Another node, or a `confirm` node with a required input unset or reading a node that is not `done`, is `409 PLAYBOOK_NODE_NOT_CONFIRMABLE`. A confirmation made with a credential the case's own work runs as is `403 PLAYBOOK_SELF_WRITE`.
4840
+ */
4841
+ static confirmPlaybookCaseNode(options) {
4842
+ return (options.client ?? client).post({
4843
+ url: "/v1/projects/{project_id}/playbook-cases/{case_id}/nodes/{node}/confirmation",
4844
+ ...options,
4845
+ headers: {
4846
+ "Content-Type": "application/json",
4847
+ ...options.headers
4848
+ }
4849
+ });
4850
+ }
4851
+ };
4497
4852
  var Projects = class {
4498
4853
  /**
4499
4854
  * List projects
@@ -6129,6 +6484,7 @@ var NaturaliClient = class {
6129
6484
  quotas;
6130
6485
  models;
6131
6486
  orchestrations;
6487
+ playbooks;
6132
6488
  projects;
6133
6489
  secrets;
6134
6490
  sessions;
@@ -6184,6 +6540,7 @@ var NaturaliClient = class {
6184
6540
  this.quotas = bindResource(Quotas, this.http);
6185
6541
  this.models = bindResource(Models, this.http);
6186
6542
  this.orchestrations = bindResource(Orchestrations, this.http);
6543
+ this.playbooks = bindResource(Playbooks, this.http);
6187
6544
  this.projects = bindResource(Projects, this.http);
6188
6545
  this.secrets = bindResource(Secrets, this.http);
6189
6546
  this.sessions = bindResource(Sessions, this.http);
@@ -6197,4 +6554,4 @@ var NaturaliClient = class {
6197
6554
  }
6198
6555
  };
6199
6556
  //#endregion
6200
- export { Activity, Actors, Admin, AgentVersions, Agents, AiProviders, ApiKeys, Approvals, Assistant, AuditLog, Auth, Chains, Channels, Conversations, Deciders, Documents, Embeddings, Evaluations, Exceptions, Files, Formations, Generations, Guardrails, IngestionRules, Installs, Knowledge, Listings, Memories, MemoryRules, MemoryStores, MetadataSchemas, ModelRoutes, Models, NaturaliClient, Orchestrations, Projects, Quotas, Secrets, Sessions, Tasks, Tools, Traces, Triggers, Users, Webhooks, Workflows, createClient, createConfig };
6557
+ export { Activity, Actors, Admin, AgentVersions, Agents, AiProviders, ApiKeys, Approvals, Assistant, AuditLog, Auth, Chains, Channels, Conversations, Deciders, Documents, Embeddings, Evaluations, Exceptions, Files, Formations, Generations, Guardrails, IngestionRules, Installs, Knowledge, Listings, Memories, MemoryRules, MemoryStores, MetadataSchemas, ModelRoutes, Models, NaturaliClient, Orchestrations, Playbooks, Projects, Quotas, Secrets, Sessions, Tasks, Tools, Traces, Triggers, Users, Webhooks, Workflows, createClient, createConfig };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/sdk",
3
- "version": "0.194.2",
3
+ "version": "0.195.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.194.2",
41
+ "@naturali/api": "0.195.0",
42
42
  "@ttoss/openapi-codegen": "^0.5.0",
43
43
  "@types/node": "^26.5.1",
44
44
  "tsdown": "^0.23.0",