@naturali/sdk 0.34.2 → 0.35.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
@@ -825,6 +825,76 @@ var Auth = class {
825
825
  });
826
826
  }
827
827
  };
828
+ var Boards = class {
829
+ /**
830
+ * List boards
831
+ *
832
+ * Lists the boards defined in the project, newest first.
833
+ */
834
+ static listBoards(options) {
835
+ return (options.client ?? client).get({
836
+ url: "/v1/projects/{project_id}/boards",
837
+ ...options
838
+ });
839
+ }
840
+ /**
841
+ * Create a board
842
+ *
843
+ * Define a board's columns and moves. Exactly one column must be `initial: true`; any number may be `terminal: true` (a card closes when it enters one). Every agent or tool a column dispatches must belong to this project, and every move a column routes to must be declared in `transitions`.
844
+ *
845
+ */
846
+ static createBoard(options) {
847
+ return (options.client ?? client).post({
848
+ url: "/v1/projects/{project_id}/boards",
849
+ ...options,
850
+ headers: {
851
+ "Content-Type": "application/json",
852
+ ...options.headers
853
+ }
854
+ });
855
+ }
856
+ /**
857
+ * Delete a board
858
+ *
859
+ * Refused while the board still has open cards (409 `board_has_open_tasks`) — close or delete them first. Deleting a board whose cards are all closed removes those cards and their transition history along with it.
860
+ *
861
+ */
862
+ static deleteBoard(options) {
863
+ return (options.client ?? client).delete({
864
+ url: "/v1/projects/{project_id}/boards/{board_id}",
865
+ ...options
866
+ });
867
+ }
868
+ /**
869
+ * Get a board
870
+ *
871
+ * The board's current definition — the source of truth for which columns exist and which moves are legal from each, so a UI renders its columns and its buttons from this response.
872
+ *
873
+ */
874
+ static getBoard(options) {
875
+ return (options.client ?? client).get({
876
+ url: "/v1/projects/{project_id}/boards/{board_id}",
877
+ ...options
878
+ });
879
+ }
880
+ /**
881
+ * Update a board
882
+ *
883
+ * Change the name, description, `payload_schema`, or the definition itself. `states` and `transitions` are edited together or not at all — a column routes to a move and a move names columns, so validating one against a stale copy of the other would accept a definition that cannot route. At least one field is required.
884
+ * Cards already on the board are not moved. A card sitting in a column the new definition drops stays where it is and can only leave through a move the new definition declares: the definition is the sole authority at the moment a move is fired.
885
+ *
886
+ */
887
+ static updateBoard(options) {
888
+ return (options.client ?? client).patch({
889
+ url: "/v1/projects/{project_id}/boards/{board_id}",
890
+ ...options,
891
+ headers: {
892
+ "Content-Type": "application/json",
893
+ ...options.headers
894
+ }
895
+ });
896
+ }
897
+ };
828
898
  var Channels = class {
829
899
  /**
830
900
  * List channels
@@ -1532,6 +1602,106 @@ var Sessions = class {
1532
1602
  });
1533
1603
  }
1534
1604
  };
1605
+ var Tasks = class {
1606
+ /**
1607
+ * List tasks
1608
+ *
1609
+ * The board query. Filter by `board_id` for one board, add `state` for one column, or use `status` / `assignee` across boards.
1610
+ *
1611
+ */
1612
+ static listTasks(options) {
1613
+ return (options.client ?? client).get({
1614
+ url: "/v1/projects/{project_id}/tasks",
1615
+ ...options
1616
+ });
1617
+ }
1618
+ /**
1619
+ * Create a task
1620
+ *
1621
+ * Put a card on a board. It lands in the board's initial column and that column's automation fires — so a board whose first column dispatches an agent starts working on this call and keeps going, unattended, until a column needs a person.
1622
+ *
1623
+ */
1624
+ static createTask(options) {
1625
+ return (options.client ?? client).post({
1626
+ url: "/v1/projects/{project_id}/tasks",
1627
+ ...options,
1628
+ headers: {
1629
+ "Content-Type": "application/json",
1630
+ ...options.headers
1631
+ }
1632
+ });
1633
+ }
1634
+ /**
1635
+ * Delete a task
1636
+ *
1637
+ * Removes the card and its transition history. Distinct from closing it: a card that reaches a terminal column closes and keeps its audit trail.
1638
+ *
1639
+ */
1640
+ static deleteTask(options) {
1641
+ return (options.client ?? client).delete({
1642
+ url: "/v1/projects/{project_id}/tasks/{task_id}",
1643
+ ...options
1644
+ });
1645
+ }
1646
+ /**
1647
+ * Get a task
1648
+ *
1649
+ * One card, including its automation status and in-flight dispatch.
1650
+ */
1651
+ static getTask(options) {
1652
+ return (options.client ?? client).get({
1653
+ url: "/v1/projects/{project_id}/tasks/{task_id}",
1654
+ ...options
1655
+ });
1656
+ }
1657
+ /**
1658
+ * Update a task
1659
+ *
1660
+ * Edit the card's `title`, `assignee` or `payload`. At least one is required.
1661
+ * `payload` is **shallow-merged** over what is there: keys the request omits are preserved, so setting one field never discards what a column's automation wrote (`payload.last_result`). The merged result is validated against the board's `payload_schema`.
1662
+ * `state` and `board_id` are rejected — a card moves only through `:transition`, and it never changes boards.
1663
+ *
1664
+ */
1665
+ static updateTask(options) {
1666
+ return (options.client ?? client).patch({
1667
+ url: "/v1/projects/{project_id}/tasks/{task_id}",
1668
+ ...options,
1669
+ headers: {
1670
+ "Content-Type": "application/json",
1671
+ ...options.headers
1672
+ }
1673
+ });
1674
+ }
1675
+ /**
1676
+ * Move a task
1677
+ *
1678
+ * Fire a named move on the card — the single path every state change takes. The move must be declared on the board and valid from the card's current column; the board's definition is what a UI renders its buttons from.
1679
+ * Naming a move that does not exist, one that is not legal from this column, or any move at all on a closed card all answer 409 `task_transition_conflict`: it is a conflict with the card's state rather than a malformed request — the same body succeeds one column earlier.
1680
+ *
1681
+ */
1682
+ static transitionTask(options) {
1683
+ return (options.client ?? client).post({
1684
+ url: "/v1/projects/{project_id}/tasks/{task_id}:transition",
1685
+ ...options,
1686
+ headers: {
1687
+ "Content-Type": "application/json",
1688
+ ...options.headers
1689
+ }
1690
+ });
1691
+ }
1692
+ /**
1693
+ * List the task's moves
1694
+ *
1695
+ * The card's append-only history, oldest first: every move it made, what kind of actor made it, and what caused it. Returned whole — `next_cursor` is always null.
1696
+ *
1697
+ */
1698
+ static listTaskTransitions(options) {
1699
+ return (options.client ?? client).get({
1700
+ url: "/v1/projects/{project_id}/tasks/{task_id}/transitions",
1701
+ ...options
1702
+ });
1703
+ }
1704
+ };
1535
1705
  var Tools = class {
1536
1706
  /**
1537
1707
  * List tools
@@ -1698,6 +1868,7 @@ var NaturaliClient = class {
1698
1868
  agents;
1699
1869
  apiKeys;
1700
1870
  auth;
1871
+ boards;
1701
1872
  channels;
1702
1873
  contacts;
1703
1874
  generations;
@@ -1706,6 +1877,7 @@ var NaturaliClient = class {
1706
1877
  projects;
1707
1878
  providers;
1708
1879
  sessions;
1880
+ tasks;
1709
1881
  tools;
1710
1882
  traces;
1711
1883
  /** The underlying HTTP client, for interceptors or one-off requests. */
@@ -1721,6 +1893,7 @@ var NaturaliClient = class {
1721
1893
  this.agents = bindResource(Agents, this.http);
1722
1894
  this.apiKeys = bindResource(ApiKeys, this.http);
1723
1895
  this.auth = bindResource(Auth, this.http);
1896
+ this.boards = bindResource(Boards, this.http);
1724
1897
  this.channels = bindResource(Channels, this.http);
1725
1898
  this.contacts = bindResource(Contacts, this.http);
1726
1899
  this.generations = bindResource(Generations, this.http);
@@ -1729,6 +1902,7 @@ var NaturaliClient = class {
1729
1902
  this.projects = bindResource(Projects, this.http);
1730
1903
  this.providers = bindResource(Providers, this.http);
1731
1904
  this.sessions = bindResource(Sessions, this.http);
1905
+ this.tasks = bindResource(Tasks, this.http);
1732
1906
  this.tools = bindResource(Tools, this.http);
1733
1907
  this.traces = bindResource(Traces, this.http);
1734
1908
  }
@@ -1737,6 +1911,7 @@ var NaturaliClient = class {
1737
1911
  exports.Agents = Agents;
1738
1912
  exports.ApiKeys = ApiKeys;
1739
1913
  exports.Auth = Auth;
1914
+ exports.Boards = Boards;
1740
1915
  exports.Channels = Channels;
1741
1916
  exports.Contacts = Contacts;
1742
1917
  exports.Generations = Generations;
@@ -1746,6 +1921,7 @@ exports.NaturaliClient = NaturaliClient;
1746
1921
  exports.Projects = Projects;
1747
1922
  exports.Providers = Providers;
1748
1923
  exports.Sessions = Sessions;
1924
+ exports.Tasks = Tasks;
1749
1925
  exports.Tools = Tools;
1750
1926
  exports.Traces = Traces;
1751
1927
  exports.createClient = createClient;