@naturali/sdk 0.115.1 → 0.117.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
@@ -3359,7 +3359,7 @@ var Orchestrations = class {
3359
3359
  /**
3360
3360
  * List orchestration runs
3361
3361
  *
3362
- * Returns orchestration runs the caller can access, optionally filtered by orchestration, by parent run, or by whether the run has a parent at all.
3362
+ * Returns orchestration runs the caller can access, optionally filtered by orchestration, by parent run, by status, or by whether the run has a parent at all.
3363
3363
  *
3364
3364
  * Note when aggregating: a run's `usage` covers its whole subtree, so summing it over a list that contains both a parent and its children counts the children more than once. Pass `nested=false` to sum over runs a caller started.
3365
3365
  */
@@ -3396,6 +3396,24 @@ var Orchestrations = class {
3396
3396
  });
3397
3397
  }
3398
3398
  /**
3399
+ * Pause an orchestration run
3400
+ *
3401
+ * Parks a run in flight as `awaiting_input` at its next checkpoint, with a `required_action` of type `paused` naming the pause as operator-initiated rather than a node's. Unlike cancel, the run keeps its last checkpoint and resume-orchestration-run re-drives it from there — so work already done is deferred rather than discarded.
3402
+ * A `queued` or `sleeping` run is parked immediately (a sleeping run keeps the wake it was due, and resuming hands it back to the scheduler at that instant). A `running` run keeps running until the round in flight reaches its checkpoint, so the response may still read `running` while `pause_requested_at` is set. A run already parked on a human, webhook or approval node keeps that node's `required_action`; the pause is still recorded, which is what makes submit-human-input refuse until the run is resumed.
3403
+ * The pause fans out to the run's `loop` / `sub_orchestration` descendants — each parks at its own next checkpoint — because otherwise a parent's pause would bound nothing. Resuming does not fan out: each parked descendant is resumed by its own id.
3404
+ * Idempotent: pausing an already-paused run answers with it unchanged.
3405
+ */
3406
+ static pauseOrchestrationRun(options) {
3407
+ return (options.client ?? client).post({
3408
+ url: "/v1/projects/{project_id}/orchestration-runs/{orchestration_run_id}/pause",
3409
+ ...options,
3410
+ headers: {
3411
+ "Content-Type": "application/json",
3412
+ ...options.headers
3413
+ }
3414
+ });
3415
+ }
3416
+ /**
3399
3417
  * Submit human input
3400
3418
  *
3401
3419
  * Provides human input to a run that is awaiting_input at a human node.
@@ -3414,6 +3432,7 @@ var Orchestrations = class {
3414
3432
  * Resume an orchestration run
3415
3433
  *
3416
3434
  * Re-drives an awaiting_input orchestration run from its last checkpoint. This does not satisfy the pause itself — it carries no node_id or payload, so a run parked on a human or webhook-receive node re-parks on the same node. Use submit-human-input to supply the awaited payload and advance the run.
3435
+ * It is also the only thing that lifts an operator pause (pause-orchestration-run): a run parked with `required_action.type` of `paused` re-drives the frontier that had not run yet, and one paused mid-timer goes back to `sleeping` for the wake it was already due.
3417
3436
  */
3418
3437
  static resumeOrchestrationRun(options) {
3419
3438
  return (options.client ?? client).post({
@@ -3555,7 +3574,7 @@ var Quotas = class {
3555
3574
  /**
3556
3575
  * Create a quota
3557
3576
  *
3558
- * Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor`. Any other scope/metric pair is rejected with 400 (no attribution exists to enforce it). An `actor` quota caps one end user's spend, matched from the generation's session; a null `scope_ref` means one budget *per* actor rather than a pooled project total. A duplicate quota (same project, scope, scope_ref, metric, window) is rejected with 409.
3577
+ * Creates a project-scoped quota. `requests` is valid for `scope: project`/`api_key`; `tokens` and `cost_usd` are valid for `scope: project`/`agent`/`actor`. Any other scope/metric pair is rejected with 400 (no attribution exists to enforce it). An `actor` quota caps one end user's spend, matched from the generation's session; a null `scope_ref` means one budget *per* actor rather than a pooled project total. A `cost_usd` quota may name one `meter_type` to cap; omitting it caps every priced meter. A duplicate quota (same project, scope, scope_ref, metric, window, meter_type) is rejected with 409.
3559
3578
  */
3560
3579
  static createQuota(options) {
3561
3580
  return (options.client ?? client).post({
@@ -3862,7 +3881,7 @@ var Tasks = class {
3862
3881
  /**
3863
3882
  * List tasks
3864
3883
  *
3865
- * Lists tasks (the board query). Filter by workflow, state, status, or assignee — `GET /tasks?workflow_id=...&state=...` is one board column.
3884
+ * Lists tasks (the board query). Filter by workflow, state, status, automation status, or assignee — `GET /tasks?workflow_id=...&state=...` is one board column.
3866
3885
  */
3867
3886
  static listTasks(options) {
3868
3887
  return (options.client ?? client).get({
@@ -3938,6 +3957,36 @@ var Tasks = class {
3938
3957
  });
3939
3958
  }
3940
3959
  /**
3960
+ * Pause a task
3961
+ *
3962
+ * Pauses a task's automation. While a pause is in force no state's `on_enter` dispatches and no retry chain continues — an agent generation, a tool call and a sub-orchestration alike — so the task stops spending without losing its place.
3963
+ * A workflow has no run object, so this is the workflow half of pause-orchestration-run: the pause lands on the instance, which is the task. Transitions are deliberately still allowed — a move costs nothing while every dispatch it would start is suppressed — so a board stays usable under a pause. Entering a state whose dispatch is suppressed records `automation_status: paused`, which resume-task reads to know that state still owes its work.
3964
+ * A dispatch already in flight is left to finish, and its outcome still routes; only what would start after it is suppressed.
3965
+ * Idempotent: pausing an already-paused task answers with it unchanged.
3966
+ */
3967
+ static pauseTask(options) {
3968
+ return (options.client ?? client).post({
3969
+ url: "/v1/projects/{project_id}/tasks/{task_id}/pause",
3970
+ ...options,
3971
+ headers: {
3972
+ "Content-Type": "application/json",
3973
+ ...options.headers
3974
+ }
3975
+ });
3976
+ }
3977
+ /**
3978
+ * Resume a task
3979
+ *
3980
+ * Lifts a task's pause. When the pause suppressed the current state's `on_enter` — `automation_status: paused` — that dispatch is started now, as the caller resuming rather than as whoever last moved the task. A state whose dispatch had already completed, or that declares none, is left alone, so a resume never re-spends work the pause did not stop.
3981
+ * This is the only way a pause is lifted; a task that is merely idle is advanced by firing a transition instead.
3982
+ */
3983
+ static resumeTask(options) {
3984
+ return (options.client ?? client).post({
3985
+ url: "/v1/projects/{project_id}/tasks/{task_id}/resume",
3986
+ ...options
3987
+ });
3988
+ }
3989
+ /**
3941
3990
  * Get task history
3942
3991
  *
3943
3992
  * Returns the append-only transition history of a task.