@naturali/sdk 0.50.0 → 0.51.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
@@ -1736,6 +1736,76 @@ var Providers = class {
1736
1736
  });
1737
1737
  }
1738
1738
  };
1739
+ var Runs = class {
1740
+ /**
1741
+ * List runs
1742
+ *
1743
+ * Runs of one orchestration, most recent first. `orchestration_id` is required — a project-wide run feed is not offered, since the upstream runtime's own list has no project filter (see the file description).
1744
+ *
1745
+ */
1746
+ static listRuns(options) {
1747
+ return (options.client ?? client).get({
1748
+ url: "/v1/projects/{project_id}/runs",
1749
+ ...options
1750
+ });
1751
+ }
1752
+ /**
1753
+ * Start a run
1754
+ *
1755
+ * Creates a new run of the orchestration named by `orchestration_id`. By default the run executes durably in the background and this call returns immediately with status `queued`; poll `GET …/runs/{run_id}` to observe progress. Pass `wait: true` to block until the run reaches a terminal or `awaiting_input` state instead.
1756
+ *
1757
+ */
1758
+ static startRun(options) {
1759
+ return (options.client ?? client).post({
1760
+ url: "/v1/projects/{project_id}/runs",
1761
+ ...options,
1762
+ headers: {
1763
+ "Content-Type": "application/json",
1764
+ ...options.headers
1765
+ }
1766
+ });
1767
+ }
1768
+ /**
1769
+ * Get a run
1770
+ *
1771
+ * One run's status, accumulated state, per-node artifacts and execution trace.
1772
+ *
1773
+ */
1774
+ static getRun(options) {
1775
+ return (options.client ?? client).get({
1776
+ url: "/v1/projects/{project_id}/runs/{run_id}",
1777
+ ...options
1778
+ });
1779
+ }
1780
+ /**
1781
+ * Cancel a run
1782
+ *
1783
+ * Stops a run that has not yet reached a terminal state.
1784
+ */
1785
+ static cancelRun(options) {
1786
+ return (options.client ?? client).post({
1787
+ url: "/v1/projects/{project_id}/runs/{run_id}:cancel",
1788
+ ...options
1789
+ });
1790
+ }
1791
+ /**
1792
+ * Resume a run
1793
+ *
1794
+ * Moves a run parked at `awaiting_input` forward — the single door for every resume, whatever the run is parked on. Send `output` to answer a human-node pause and advance past it; omit it to re-drive a run without answering anything, which re-parks a human or webhook-receive pause on the same node (useful for a delay/poll wait, or to nudge a run after an external side effect completed out of band).
1795
+ * Only valid on a run whose status is `awaiting_input`; any other status answers 409.
1796
+ *
1797
+ */
1798
+ static resumeRun(options) {
1799
+ return (options.client ?? client).post({
1800
+ url: "/v1/projects/{project_id}/runs/{run_id}:resume",
1801
+ ...options,
1802
+ headers: {
1803
+ "Content-Type": "application/json",
1804
+ ...options.headers
1805
+ }
1806
+ });
1807
+ }
1808
+ };
1739
1809
  var Sessions = class {
1740
1810
  /**
1741
1811
  * Open a session
@@ -2039,6 +2109,108 @@ var Traces = class {
2039
2109
  });
2040
2110
  }
2041
2111
  };
2112
+ var Triggers = class {
2113
+ /**
2114
+ * List triggers
2115
+ *
2116
+ * The project's schedule triggers.
2117
+ */
2118
+ static listTriggers(options) {
2119
+ return (options.client ?? client).get({
2120
+ url: "/v1/projects/{project_id}/triggers",
2121
+ ...options
2122
+ });
2123
+ }
2124
+ /**
2125
+ * Create a trigger
2126
+ *
2127
+ * Schedules `target_id` (an agent in this project) to run on `cron`, a 5-field cron expression evaluated in UTC.
2128
+ *
2129
+ */
2130
+ static createTrigger(options) {
2131
+ return (options.client ?? client).post({
2132
+ url: "/v1/projects/{project_id}/triggers",
2133
+ ...options,
2134
+ headers: {
2135
+ "Content-Type": "application/json",
2136
+ ...options.headers
2137
+ }
2138
+ });
2139
+ }
2140
+ /**
2141
+ * Delete a trigger
2142
+ *
2143
+ * Removes the trigger. Its firing history is kept.
2144
+ */
2145
+ static deleteTrigger(options) {
2146
+ return (options.client ?? client).delete({
2147
+ url: "/v1/projects/{project_id}/triggers/{trigger_id}",
2148
+ ...options
2149
+ });
2150
+ }
2151
+ /**
2152
+ * Get a trigger
2153
+ */
2154
+ static getTrigger(options) {
2155
+ return (options.client ?? client).get({
2156
+ url: "/v1/projects/{project_id}/triggers/{trigger_id}",
2157
+ ...options
2158
+ });
2159
+ }
2160
+ /**
2161
+ * Update a trigger
2162
+ *
2163
+ * Retune the schedule, its target, or whether it fires at all. At least one field is required. `type` and `target_type` are immutable.
2164
+ *
2165
+ */
2166
+ static updateTrigger(options) {
2167
+ return (options.client ?? client).patch({
2168
+ url: "/v1/projects/{project_id}/triggers/{trigger_id}",
2169
+ ...options,
2170
+ headers: {
2171
+ "Content-Type": "application/json",
2172
+ ...options.headers
2173
+ }
2174
+ });
2175
+ }
2176
+ /**
2177
+ * Fire a trigger manually
2178
+ *
2179
+ * Runs the trigger's target right now, outside its schedule, and waits for the run to finish. This is the `…:fire` action; the path segment is `{trigger_id}:fire`.
2180
+ * `input` is shallow-merged over the trigger's own stored `input` for this run only — the trigger's configuration is unchanged.
2181
+ *
2182
+ */
2183
+ static fireTrigger(options) {
2184
+ return (options.client ?? client).post({
2185
+ url: "/v1/projects/{project_id}/triggers/{trigger_id}:fire",
2186
+ ...options,
2187
+ headers: {
2188
+ "Content-Type": "application/json",
2189
+ ...options.headers
2190
+ }
2191
+ });
2192
+ }
2193
+ /**
2194
+ * List a trigger's firings
2195
+ *
2196
+ * Every time this trigger ran, newest first — scheduled and manual alike.
2197
+ */
2198
+ static listTriggerFirings(options) {
2199
+ return (options.client ?? client).get({
2200
+ url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings",
2201
+ ...options
2202
+ });
2203
+ }
2204
+ /**
2205
+ * Get a trigger firing
2206
+ */
2207
+ static getTriggerFiring(options) {
2208
+ return (options.client ?? client).get({
2209
+ url: "/v1/projects/{project_id}/triggers/{trigger_id}/firings/{firing_id}",
2210
+ ...options
2211
+ });
2212
+ }
2213
+ };
2042
2214
  var Webhooks = class {
2043
2215
  /**
2044
2216
  * List webhooks
@@ -2266,10 +2438,12 @@ exports.Models = Models;
2266
2438
  exports.NaturaliClient = NaturaliClient;
2267
2439
  exports.Projects = Projects;
2268
2440
  exports.Providers = Providers;
2441
+ exports.Runs = Runs;
2269
2442
  exports.Sessions = Sessions;
2270
2443
  exports.Tasks = Tasks;
2271
2444
  exports.Tools = Tools;
2272
2445
  exports.Traces = Traces;
2446
+ exports.Triggers = Triggers;
2273
2447
  exports.Webhooks = Webhooks;
2274
2448
  exports.createClient = createClient;
2275
2449
  exports.createConfig = createConfig;