@shardflux/sdk 0.9.0 → 0.10.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.
@@ -1536,6 +1536,30 @@ export interface paths {
1536
1536
  patch?: never;
1537
1537
  trace?: never;
1538
1538
  };
1539
+ "/v1/workspaces/{workspace_id}/suspend-when-idle": {
1540
+ parameters: {
1541
+ query?: never;
1542
+ header?: never;
1543
+ path?: never;
1544
+ cookie?: never;
1545
+ };
1546
+ get?: never;
1547
+ put?: never;
1548
+ /**
1549
+ * Suspend the workspace if it stays idle for after_seconds from now (e.g. at the end of an agent turn)
1550
+ * @description Records a deferred suspend for the cell’s idle loop: once the workspace has been idle for after_seconds (30..3600), it is suspended (within a few seconds of activity flush grace), at `not_before` (= now + after_seconds) at the earliest. A tool call after the request (the next turn) or a resume cancels it for good. Other work only defers it: a command still running, an attached exec/PTY stream or a keepalive postpones the suspend until after_seconds after it ends. It applies under every idle policy (`never` included) and only ever shortens the policy’s wait; a policy that suspends sooner still does. Repeating replaces the pending request (the new `requested_at` counts); DELETE cancels it; `idle.suspend_request` on the workspace shows it. 202 {workspace, operation: null, suspend_request}; when a suspend is already in progress, 202 {workspace, operation: that suspend, suspend_request: null} and nothing is recorded. The suspend, when it happens, is a system `suspend` operation with input.reason requested_after_idle (input.requested_at, input.after_seconds). Errors: 409 session_lifetime, workspace_deleted, operation_in_progress (another lifecycle operation is active), not_running, not_supported_for_mode (file-first, contracts §29). Supports Idempotency-Key.
1551
+ */
1552
+ post: operations["postV1WorkspacesWorkspaceIdSuspendWhenIdle"];
1553
+ /**
1554
+ * Cancel a pending suspend-when-idle request
1555
+ * @description Idempotent: 200 with the workspace whether or not a request was pending, in any workspace state (idle.suspend_request is null afterwards). A suspend the request already started is not undone: it shows as the workspace’s active_operation; resume or open the workspace instead.
1556
+ */
1557
+ delete: operations["deleteV1WorkspacesWorkspaceIdSuspendWhenIdle"];
1558
+ options?: never;
1559
+ head?: never;
1560
+ patch?: never;
1561
+ trace?: never;
1562
+ };
1539
1563
  "/v1/workspaces/{workspace_id}/fork": {
1540
1564
  parameters: {
1541
1565
  query?: never;
@@ -1888,6 +1912,30 @@ export interface paths {
1888
1912
  patch?: never;
1889
1913
  trace?: never;
1890
1914
  };
1915
+ "/api/v1/workspaces/{workspace_id}/suspend-when-idle": {
1916
+ parameters: {
1917
+ query?: never;
1918
+ header?: never;
1919
+ path?: never;
1920
+ cookie?: never;
1921
+ };
1922
+ get?: never;
1923
+ put?: never;
1924
+ /**
1925
+ * Suspend the workspace if it stays idle for after_seconds from now (e.g. at the end of an agent turn)
1926
+ * @description Records a deferred suspend for the cell’s idle loop: once the workspace has been idle for after_seconds (30..3600), it is suspended (within a few seconds of activity flush grace), at `not_before` (= now + after_seconds) at the earliest. A tool call after the request (the next turn) or a resume cancels it for good. Other work only defers it: a command still running, an attached exec/PTY stream or a keepalive postpones the suspend until after_seconds after it ends. It applies under every idle policy (`never` included) and only ever shortens the policy’s wait; a policy that suspends sooner still does. Repeating replaces the pending request (the new `requested_at` counts); DELETE cancels it; `idle.suspend_request` on the workspace shows it. 202 {workspace, operation: null, suspend_request}; when a suspend is already in progress, 202 {workspace, operation: that suspend, suspend_request: null} and nothing is recorded. The suspend, when it happens, is a system `suspend` operation with input.reason requested_after_idle (input.requested_at, input.after_seconds). Errors: 409 session_lifetime, workspace_deleted, operation_in_progress (another lifecycle operation is active), not_running, not_supported_for_mode (file-first, contracts §29). Supports Idempotency-Key.
1927
+ */
1928
+ post: operations["postApiV1WorkspacesWorkspaceIdSuspendWhenIdle"];
1929
+ /**
1930
+ * Cancel a pending suspend-when-idle request
1931
+ * @description Idempotent: 200 with the workspace whether or not a request was pending, in any workspace state (idle.suspend_request is null afterwards). A suspend the request already started is not undone: it shows as the workspace’s active_operation; resume or open the workspace instead.
1932
+ */
1933
+ delete: operations["deleteApiV1WorkspacesWorkspaceIdSuspendWhenIdle"];
1934
+ options?: never;
1935
+ head?: never;
1936
+ patch?: never;
1937
+ trace?: never;
1938
+ };
1891
1939
  "/api/v1/workspaces/{workspace_id}/fork": {
1892
1940
  parameters: {
1893
1941
  query?: never;
@@ -3971,7 +4019,7 @@ export interface paths {
3971
4019
  };
3972
4020
  /**
3973
4021
  * Current-period usage, included allowances and cap state of an organization
3974
- * @description Totals come from the usage ledger (hourly, finalized after the lateness window); `measurement.measured_through` says how far usage is complete. Billable units are whole units (floor per workspace-hour); allowance usage counts billable units. `allowance_exhausted` true means new opens/resumes answer 402 `allowance_exhausted`.
4022
+ * @description Totals come from the usage ledger (hourly, finalized after the lateness window); `measurement.measured_through` says how far usage is complete. Billable units are whole units (floor per workspace-hour); allowance usage counts billable units. `allowance_exhausted` true means new opens/resumes answer 402 `allowance_exhausted` with `exhausted_reason` as details.reason. `spend_cap` is opt-in overage this period: while it is on, a CPU-hours or RAM GiB-hours allowance past `included` is in cap state `overage` (starts admitted, usage past it charged) until the spend cap is reached.
3975
4023
  */
3976
4024
  get: operations["getV1OrganizationsOrganizationIdUsageSummary"];
3977
4025
  put?: never;
@@ -4080,11 +4128,22 @@ export interface paths {
4080
4128
  path?: never;
4081
4129
  cookie?: never;
4082
4130
  };
4083
- /** Usage alert thresholds */
4131
+ /**
4132
+ * Usage alert thresholds and opt-in overage with its spend cap
4133
+ * @description Alert thresholds, and whether overage is available, on, off or paused, with the spend cap, its bounds and the rates. Overage is off by default; owners and billing members change it with the PUT (the console on /api/v1, or a CLI session on /v1; project API keys are refused).
4134
+ */
4084
4135
  get: operations["getV1OrganizationsOrganizationIdSpendPolicy"];
4085
4136
  /**
4086
- * Set usage alert thresholds (owner/billing)
4087
- * @description Thresholds are percentages of each allowance (1-100, at most 5). Overage cannot be enabled: this catalog has no metered prices.
4137
+ * Set usage alert thresholds, turn overage on or off, set the spend cap (owner/billing)
4138
+ * @description Every field is optional; send at least one. Thresholds are percentages of each allowance (1-100, at most 5).
4139
+ *
4140
+ * Overage (off by default) needs a plan with opt-in overage and a spend cap: at least spend_cap_min_minor, at most the plan price (spend_cap_max_minor), and not below what overage already charged this period. Turning overage off is always allowed; what it charged stays on the next invoice.
4141
+ *
4142
+ * The change takes effect at once: usage up to now is charged under the previous policy, the rest under the new one, and budget leases are re-sized in the same transaction (turning overage off or lowering the cap to the charges pauses running workspaces past the allowance). Every owner and billing member gets an email when overage is turned on or off or the cap changes.
4143
+ *
4144
+ * If-Match (optional): the `version` you read; a different current version answers 409 conflict with details {reason: version_mismatch, current_version, if_match}.
4145
+ *
4146
+ * 422 validation_failed details {field, reason}: overage_unavailable, spend_cap_required, spend_cap_below_minimum (+ min_minor), spend_cap_above_plan_price (+ max_minor), spend_cap_below_charges (+ charges_minor).
4088
4147
  */
4089
4148
  put: operations["putV1OrganizationsOrganizationIdSpendPolicy"];
4090
4149
  post?: never;
@@ -4103,7 +4162,7 @@ export interface paths {
4103
4162
  };
4104
4163
  /**
4105
4164
  * Current-period usage, included allowances and cap state of an organization
4106
- * @description Totals come from the usage ledger (hourly, finalized after the lateness window); `measurement.measured_through` says how far usage is complete. Billable units are whole units (floor per workspace-hour); allowance usage counts billable units. `allowance_exhausted` true means new opens/resumes answer 402 `allowance_exhausted`.
4165
+ * @description Totals come from the usage ledger (hourly, finalized after the lateness window); `measurement.measured_through` says how far usage is complete. Billable units are whole units (floor per workspace-hour); allowance usage counts billable units. `allowance_exhausted` true means new opens/resumes answer 402 `allowance_exhausted` with `exhausted_reason` as details.reason. `spend_cap` is opt-in overage this period: while it is on, a CPU-hours or RAM GiB-hours allowance past `included` is in cap state `overage` (starts admitted, usage past it charged) until the spend cap is reached.
4107
4166
  */
4108
4167
  get: operations["getApiV1OrganizationsOrganizationIdUsageSummary"];
4109
4168
  put?: never;
@@ -4212,11 +4271,22 @@ export interface paths {
4212
4271
  path?: never;
4213
4272
  cookie?: never;
4214
4273
  };
4215
- /** Usage alert thresholds */
4274
+ /**
4275
+ * Usage alert thresholds and opt-in overage with its spend cap
4276
+ * @description Alert thresholds, and whether overage is available, on, off or paused, with the spend cap, its bounds and the rates. Overage is off by default; owners and billing members change it with the PUT (the console on /api/v1, or a CLI session on /v1; project API keys are refused).
4277
+ */
4216
4278
  get: operations["getApiV1OrganizationsOrganizationIdSpendPolicy"];
4217
4279
  /**
4218
- * Set usage alert thresholds (owner/billing)
4219
- * @description Thresholds are percentages of each allowance (1-100, at most 5). Overage cannot be enabled: this catalog has no metered prices.
4280
+ * Set usage alert thresholds, turn overage on or off, set the spend cap (owner/billing)
4281
+ * @description Every field is optional; send at least one. Thresholds are percentages of each allowance (1-100, at most 5).
4282
+ *
4283
+ * Overage (off by default) needs a plan with opt-in overage and a spend cap: at least spend_cap_min_minor, at most the plan price (spend_cap_max_minor), and not below what overage already charged this period. Turning overage off is always allowed; what it charged stays on the next invoice.
4284
+ *
4285
+ * The change takes effect at once: usage up to now is charged under the previous policy, the rest under the new one, and budget leases are re-sized in the same transaction (turning overage off or lowering the cap to the charges pauses running workspaces past the allowance). Every owner and billing member gets an email when overage is turned on or off or the cap changes.
4286
+ *
4287
+ * If-Match (optional): the `version` you read; a different current version answers 409 conflict with details {reason: version_mismatch, current_version, if_match}.
4288
+ *
4289
+ * 422 validation_failed details {field, reason}: overage_unavailable, spend_cap_required, spend_cap_below_minimum (+ min_minor), spend_cap_above_plan_price (+ max_minor), spend_cap_below_charges (+ charges_minor).
4220
4290
  */
4221
4291
  put: operations["putApiV1OrganizationsOrganizationIdSpendPolicy"];
4222
4292
  post?: never;
@@ -6424,6 +6494,20 @@ export interface components {
6424
6494
  */
6425
6495
  project_id?: string;
6426
6496
  };
6497
+ /** @description A pending suspend-when-idle request (contracts §20.6): once the workspace has been idle for after_seconds, it is suspended. A tool call after requested_at (the next turn) or a resume cancels it; other work only defers it. */
6498
+ SuspendRequest: {
6499
+ /**
6500
+ * Format: date-time
6501
+ * @description When the request was made; a newer request replaces it.
6502
+ */
6503
+ requested_at: string;
6504
+ after_seconds: number;
6505
+ /**
6506
+ * Format: date-time
6507
+ * @description requested_at + after_seconds: the earliest suspend (within a few seconds of activity flush grace after it). A running command, an attached stream or a keepalive still active then defers the suspend until after_seconds after it ends.
6508
+ */
6509
+ not_before: string;
6510
+ };
6427
6511
  Workspace: {
6428
6512
  /**
6429
6513
  * Format: uuid
@@ -6519,6 +6603,8 @@ export interface components {
6519
6603
  basis: string | null;
6520
6604
  /** @description When the workspace becomes eligible for automatic suspend if nothing happens before (work signals always win). */
6521
6605
  next_eligible_at: string | null;
6606
+ /** @description The pending suspend-when-idle request (POST …/suspend-when-idle) while the workspace runs and no tool call or resume has happened since the request, else null. It applies under every idle policy, never included. */
6607
+ suspend_request: components["schemas"]["SuspendRequest"] | null;
6522
6608
  } | null;
6523
6609
  origin: components["schemas"]["WorkspaceOrigin"] | null;
6524
6610
  ended_reason: ("closed" | "idle_timeout" | "draft_discarded") | null;
@@ -6737,6 +6823,50 @@ export interface components {
6737
6823
  detach_requested_at: string | null;
6738
6824
  detached_at: string | null;
6739
6825
  };
6826
+ /** @description Opt-in overage with a spend cap. Off by default. While it is on, workspaces open and run past the plan’s CPU-hours and RAM GiB-hours allowances, and the usage past them is charged at the rates below, up to the effective cap per billing period. At the cap, and while a plan invoice is past due, a used-up allowance refuses new starts (402 allowance_exhausted) and running workspaces are paused. Nothing is deleted. */
6827
+ SpendCap: {
6828
+ /** @description unavailable: the plan has no opt-in overage or the organization has no paid subscription. off: available, not turned on. paused: on, but a plan invoice is past due, so overage behaves as off until it is paid. within_allowance: on, no usage past the allowances yet. accruing: on, usage past an allowance is being charged. warning: charges are 80 % of the effective cap or more. reached: less than one cent of the cap is left, so starts are refused (402 allowance_exhausted, reason spend_cap_reached) and running workspaces are paused. */
6829
+ state: "unavailable" | "off" | "paused" | "within_allowance" | "accruing" | "warning" | "reached";
6830
+ /** @description The plan offers opt-in overage (catalog overage `opt_in`) and the organization pays for the plan with a subscription. */
6831
+ available: boolean;
6832
+ /** @description An owner or billing member turned overage on (spend-policy overage_enabled). */
6833
+ enabled: boolean;
6834
+ /** @description A plan invoice is past due (payment grace or restriction): overage behaves as off until it is paid. */
6835
+ paused: boolean;
6836
+ cap_minor: number | null;
6837
+ /** @description The cap that applies: min(cap_minor, max_cap_minor), or max_cap_minor when no cap is set. 0 when overage is unavailable. */
6838
+ effective_cap_minor: number;
6839
+ max_cap_minor: number | null;
6840
+ /** @description Overage charged this period so far, whole minor units (floor). It is billed on the next invoice and never exceeds the effective cap. Accrued charges stay when overage is turned off or paused. */
6841
+ charges_minor: number;
6842
+ /** @description What is left under the effective cap, whole minor units (floor). */
6843
+ remaining_minor: number;
6844
+ percent_of_cap: number | null;
6845
+ /** @description ISO 4217 code, lower case (the plan price currency). */
6846
+ currency: string;
6847
+ /**
6848
+ * Format: date-time
6849
+ * @description When the billing period ends: charges and the cap start again from zero.
6850
+ */
6851
+ resets_at: string;
6852
+ /** @description One line per dimension, RAM first (the invoice lines of the period). Empty when the plan has no overage rates. */
6853
+ lines: {
6854
+ /** @description The allowances overage covers. Storage and transfer never accrue overage. */
6855
+ allowance: "ram_gib_hours" | "cpu_hours";
6856
+ /** @description gib_hours for ram_gib_hours, hours (CPU-hours) for cpu_hours. */
6857
+ unit: "gib_hours" | "hours";
6858
+ /** @description Usage past the allowance this period, in unit-hours (charged or not: usage before overage was turned on, while paused or past the cap is never charged). */
6859
+ units_over: number;
6860
+ /** @description The part of it charged this period, in unit-hours. */
6861
+ billed_units: number;
6862
+ /** @description Minor units per unit-hour past the allowance (4 = $0.04 per RAM GiB-hour; 12 = $0.12 per CPU-hour). */
6863
+ rate_minor: number;
6864
+ /** @description billed_units × rate_minor, whole minor units (floor). Lines are floored one by one, so they may add up to one minor unit less than charges_minor. */
6865
+ amount_minor: number;
6866
+ }[];
6867
+ /** @description When the charges reach the effective cap at the average burn of this period so far. Null when not accruing or when it would fall after resets_at. */
6868
+ projected_reached_at: string | null;
6869
+ };
6740
6870
  };
6741
6871
  responses: never;
6742
6872
  parameters: never;
@@ -11752,6 +11882,99 @@ export interface operations {
11752
11882
  };
11753
11883
  };
11754
11884
  };
11885
+ postV1WorkspacesWorkspaceIdSuspendWhenIdle: {
11886
+ parameters: {
11887
+ query?: never;
11888
+ header?: never;
11889
+ path: {
11890
+ /** @description UUIDv7, lowercase canonical form. */
11891
+ workspace_id: string;
11892
+ };
11893
+ cookie?: never;
11894
+ };
11895
+ requestBody: {
11896
+ content: {
11897
+ "application/json": {
11898
+ /** @description Seconds from now the workspace must stay idle before it is suspended (30..3600). */
11899
+ after_seconds: number;
11900
+ };
11901
+ };
11902
+ };
11903
+ responses: {
11904
+ /** @description suspend_request: the recorded request. operation: set (and suspend_request null) only when a suspend was already in progress. */
11905
+ 202: {
11906
+ headers: {
11907
+ [name: string]: unknown;
11908
+ };
11909
+ content: {
11910
+ "application/json": {
11911
+ workspace: components["schemas"]["Workspace"];
11912
+ operation: components["schemas"]["Operation"] | null;
11913
+ suspend_request: components["schemas"]["SuspendRequest"] | null;
11914
+ };
11915
+ };
11916
+ };
11917
+ /** @description Default Response */
11918
+ "4XX": {
11919
+ headers: {
11920
+ [name: string]: unknown;
11921
+ };
11922
+ content: {
11923
+ "application/json": components["schemas"]["ErrorBody"];
11924
+ };
11925
+ };
11926
+ /** @description Default Response */
11927
+ "5XX": {
11928
+ headers: {
11929
+ [name: string]: unknown;
11930
+ };
11931
+ content: {
11932
+ "application/json": components["schemas"]["ErrorBody"];
11933
+ };
11934
+ };
11935
+ };
11936
+ };
11937
+ deleteV1WorkspacesWorkspaceIdSuspendWhenIdle: {
11938
+ parameters: {
11939
+ query?: never;
11940
+ header?: never;
11941
+ path: {
11942
+ /** @description UUIDv7, lowercase canonical form. */
11943
+ workspace_id: string;
11944
+ };
11945
+ cookie?: never;
11946
+ };
11947
+ requestBody?: never;
11948
+ responses: {
11949
+ /** @description Default Response */
11950
+ 200: {
11951
+ headers: {
11952
+ [name: string]: unknown;
11953
+ };
11954
+ content: {
11955
+ "application/json": components["schemas"]["Workspace"];
11956
+ };
11957
+ };
11958
+ /** @description Default Response */
11959
+ "4XX": {
11960
+ headers: {
11961
+ [name: string]: unknown;
11962
+ };
11963
+ content: {
11964
+ "application/json": components["schemas"]["ErrorBody"];
11965
+ };
11966
+ };
11967
+ /** @description Default Response */
11968
+ "5XX": {
11969
+ headers: {
11970
+ [name: string]: unknown;
11971
+ };
11972
+ content: {
11973
+ "application/json": components["schemas"]["ErrorBody"];
11974
+ };
11975
+ };
11976
+ };
11977
+ };
11755
11978
  postV1WorkspacesWorkspaceIdFork: {
11756
11979
  parameters: {
11757
11980
  query?: never;
@@ -12785,6 +13008,99 @@ export interface operations {
12785
13008
  };
12786
13009
  };
12787
13010
  };
13011
+ postApiV1WorkspacesWorkspaceIdSuspendWhenIdle: {
13012
+ parameters: {
13013
+ query?: never;
13014
+ header?: never;
13015
+ path: {
13016
+ /** @description UUIDv7, lowercase canonical form. */
13017
+ workspace_id: string;
13018
+ };
13019
+ cookie?: never;
13020
+ };
13021
+ requestBody: {
13022
+ content: {
13023
+ "application/json": {
13024
+ /** @description Seconds from now the workspace must stay idle before it is suspended (30..3600). */
13025
+ after_seconds: number;
13026
+ };
13027
+ };
13028
+ };
13029
+ responses: {
13030
+ /** @description suspend_request: the recorded request. operation: set (and suspend_request null) only when a suspend was already in progress. */
13031
+ 202: {
13032
+ headers: {
13033
+ [name: string]: unknown;
13034
+ };
13035
+ content: {
13036
+ "application/json": {
13037
+ workspace: components["schemas"]["Workspace"];
13038
+ operation: components["schemas"]["Operation"] | null;
13039
+ suspend_request: components["schemas"]["SuspendRequest"] | null;
13040
+ };
13041
+ };
13042
+ };
13043
+ /** @description Default Response */
13044
+ "4XX": {
13045
+ headers: {
13046
+ [name: string]: unknown;
13047
+ };
13048
+ content: {
13049
+ "application/json": components["schemas"]["ErrorBody"];
13050
+ };
13051
+ };
13052
+ /** @description Default Response */
13053
+ "5XX": {
13054
+ headers: {
13055
+ [name: string]: unknown;
13056
+ };
13057
+ content: {
13058
+ "application/json": components["schemas"]["ErrorBody"];
13059
+ };
13060
+ };
13061
+ };
13062
+ };
13063
+ deleteApiV1WorkspacesWorkspaceIdSuspendWhenIdle: {
13064
+ parameters: {
13065
+ query?: never;
13066
+ header?: never;
13067
+ path: {
13068
+ /** @description UUIDv7, lowercase canonical form. */
13069
+ workspace_id: string;
13070
+ };
13071
+ cookie?: never;
13072
+ };
13073
+ requestBody?: never;
13074
+ responses: {
13075
+ /** @description Default Response */
13076
+ 200: {
13077
+ headers: {
13078
+ [name: string]: unknown;
13079
+ };
13080
+ content: {
13081
+ "application/json": components["schemas"]["Workspace"];
13082
+ };
13083
+ };
13084
+ /** @description Default Response */
13085
+ "4XX": {
13086
+ headers: {
13087
+ [name: string]: unknown;
13088
+ };
13089
+ content: {
13090
+ "application/json": components["schemas"]["ErrorBody"];
13091
+ };
13092
+ };
13093
+ /** @description Default Response */
13094
+ "5XX": {
13095
+ headers: {
13096
+ [name: string]: unknown;
13097
+ };
13098
+ content: {
13099
+ "application/json": components["schemas"]["ErrorBody"];
13100
+ };
13101
+ };
13102
+ };
13103
+ };
12788
13104
  postApiV1WorkspacesWorkspaceIdFork: {
12789
13105
  parameters: {
12790
13106
  query?: never;
@@ -27033,6 +27349,7 @@ export interface operations {
27033
27349
  included: number | null;
27034
27350
  unit: string;
27035
27351
  }[];
27352
+ exhausted_reason: ("allowance_used" | "overage_paused" | "spend_cap_reached") | null;
27036
27353
  egress_override: {
27037
27354
  /** @enum {string} */
27038
27355
  mode: "deny_all";
@@ -27064,7 +27381,8 @@ export interface operations {
27064
27381
  included_meter_units: number | null;
27065
27382
  used_meter_units: number | null;
27066
27383
  remaining_meter_units: number | null;
27067
- cap_state: "ok" | "warning" | "exhausted" | "over_allowance" | "egress_blocked" | "uncapped" | "not_included";
27384
+ /** @description ok: below 80 %. warning: 80 % or more of the allowance. exhausted: a hard cap is used up and starts are refused (402 allowance_exhausted; see exhausted_reason). overage: a CPU-hours or RAM GiB-hours allowance is used up while opt-in overage is on and below its spend cap, so starts are admitted and the usage past it is charged (spend_cap). over_allowance: a reported allowance is exceeded (never refused). egress_blocked: the outbound transfer allowance is used up and outbound traffic is blocked. uncapped: runs on spare capacity. not_included: the plan does not define it. */
27385
+ cap_state: "ok" | "warning" | "exhausted" | "overage" | "over_allowance" | "egress_blocked" | "uncapped" | "not_included";
27068
27386
  }[];
27069
27387
  meters: {
27070
27388
  /** @enum {string} */
@@ -27078,6 +27396,7 @@ export interface operations {
27078
27396
  stripe_event_name: string | null;
27079
27397
  }[];
27080
27398
  alert_thresholds: number[];
27399
+ spend_cap: components["schemas"]["SpendCap"];
27081
27400
  template_storage: components["schemas"]["OrgTemplateStorage"];
27082
27401
  };
27083
27402
  };
@@ -27411,11 +27730,12 @@ export interface operations {
27411
27730
  currency: string;
27412
27731
  interval: string;
27413
27732
  } | null;
27414
- /** @description Usage above the included allowances billed this period (0 while overage is disabled). */
27733
+ /** @description Overage charged this period so far, whole minor units (floor; spend_cap.charges_minor). 0 while overage is off or unavailable and nothing was charged this period. */
27415
27734
  usage_charges_minor: number;
27416
27735
  estimated_total_minor: number | null;
27417
27736
  overage: string | null;
27418
- /** @description Period-to-date usage per meter at the catalog price (included in usage_charges_minor). */
27737
+ spend_cap: components["schemas"]["SpendCap"];
27738
+ /** @description Period-to-date usage per meter with its overage price and charge (included in usage_charges_minor). */
27419
27739
  usage_lines: {
27420
27740
  /** @enum {string} */
27421
27741
  meter: "cpu_seconds" | "memory_gib_seconds" | "storage_gib_seconds" | "egress_bytes" | "ingress_bytes" | "volume_storage_gib_seconds";
@@ -27425,7 +27745,7 @@ export interface operations {
27425
27745
  billable_quantity: number;
27426
27746
  allowance: string | null;
27427
27747
  unit_price_minor: number | null;
27428
- /** @description billable_quantity x unit_price_minor above any allowance (0 without a price). */
27748
+ /** @description Overage charged on this meter this period, whole minor units (floor; the matching spend_cap line). 0 for meters overage never covers and when nothing was charged. */
27429
27749
  amount_minor: number;
27430
27750
  }[];
27431
27751
  projections: {
@@ -27735,12 +28055,16 @@ export interface operations {
27735
28055
  overage: string | null;
27736
28056
  alert_thresholds: number[];
27737
28057
  subscription_fee_minor: number | null;
28058
+ /** @description Overage charged this period so far, whole minor units (floor; spend_cap.charges_minor). */
27738
28059
  usage_charges_minor: number;
27739
28060
  estimated_period_total_minor: number | null;
27740
- /** @description Worst state over hard-cap allowances. */
27741
- cap_state: "ok" | "warning" | "exhausted";
28061
+ /** @description Worst state over hard-cap allowances: exhausted (starts refused, see exhausted_reason) > overage (past an allowance, charged under the spend cap) > warning (80 % or more) > ok. */
28062
+ cap_state: "ok" | "warning" | "overage" | "exhausted";
27742
28063
  exhausted: string[];
28064
+ exhausted_reason: ("allowance_used" | "overage_paused" | "spend_cap_reached") | null;
28065
+ spend_cap: components["schemas"]["SpendCap"];
27743
28066
  enforcement: {
28067
+ /** @description refused while any hard-cap allowance is exhausted (402 allowance_exhausted with exhausted_reason as details.reason). */
27744
28068
  new_starts: "allowed" | "refused";
27745
28069
  running_workspaces: number;
27746
28070
  /** @description How running workspaces are stopped when a hard cap is reached. */
@@ -27856,9 +28180,32 @@ export interface operations {
27856
28180
  * @description UUIDv7, lowercase canonical form.
27857
28181
  */
27858
28182
  organization_id: string;
28183
+ /** @description Percentages of each allowance that send a usage email to owners and billing members. */
27859
28184
  alert_thresholds: number[];
27860
28185
  overage: string | null;
28186
+ /** @description The plan offers opt-in overage and the organization pays for it with a subscription, so overage can be turned on. */
28187
+ overage_available: boolean;
28188
+ /** @description Overage is turned on (off by default). */
28189
+ overage_enabled: boolean;
28190
+ /** @description unavailable: overage_available is false. off: available, not turned on. on: in effect up to the spend cap. paused: turned on, but a plan invoice is past due, so it behaves as off until the invoice is paid. */
28191
+ overage_state: "unavailable" | "off" | "on" | "paused";
28192
+ spend_cap_minor: number | null;
28193
+ spend_cap_max_minor: number | null;
28194
+ /** @description The smallest cap that can be set (100 = $1). */
28195
+ spend_cap_min_minor: number;
28196
+ /** @description Overage rates of the organization's plan grant. Empty when the plan has none. */
28197
+ rates: {
28198
+ /** @description The allowances overage covers. Storage and transfer never accrue overage. */
28199
+ allowance: "ram_gib_hours" | "cpu_hours";
28200
+ /** @description gib_hours for ram_gib_hours, hours (CPU-hours) for cpu_hours. */
28201
+ unit: "gib_hours" | "hours";
28202
+ /** @description Minor units per unit-hour past the allowance (4 = $0.04 per RAM GiB-hour, 12 = $0.12 per CPU-hour). */
28203
+ amount_minor_per_unit: number;
28204
+ }[];
28205
+ /** @description ISO 4217 code, lower case, of the cap and the rates. */
28206
+ currency: string;
27861
28207
  updated_at: string | null;
28208
+ /** @description Send it as If-Match on PUT to detect a concurrent change (409 conflict, reason version_mismatch). */
27862
28209
  version: number;
27863
28210
  };
27864
28211
  };
@@ -27886,7 +28233,10 @@ export interface operations {
27886
28233
  putV1OrganizationsOrganizationIdSpendPolicy: {
27887
28234
  parameters: {
27888
28235
  query?: never;
27889
- header?: never;
28236
+ header?: {
28237
+ /** @description The spend policy version you read ("3", or "*" for any). */
28238
+ "if-match"?: string;
28239
+ };
27890
28240
  path: {
27891
28241
  /** @description UUIDv7, lowercase canonical form. */
27892
28242
  organization_id: string;
@@ -27896,7 +28246,12 @@ export interface operations {
27896
28246
  requestBody: {
27897
28247
  content: {
27898
28248
  "application/json": {
27899
- alert_thresholds_percent: number[];
28249
+ /** @description Percentages of each allowance (1-100, at most 5). */
28250
+ alert_thresholds_percent?: number[];
28251
+ /** @description Turn overage on (needs a spend cap, given here or set before) or off. Turning it off is always allowed. */
28252
+ overage_enabled?: boolean;
28253
+ /** @description Spend cap per billing period in minor units: at least spend_cap_min_minor, at most spend_cap_max_minor (the plan price), and not below what overage already charged this period. */
28254
+ spend_cap_minor?: number;
27900
28255
  };
27901
28256
  };
27902
28257
  };
@@ -27913,9 +28268,32 @@ export interface operations {
27913
28268
  * @description UUIDv7, lowercase canonical form.
27914
28269
  */
27915
28270
  organization_id: string;
28271
+ /** @description Percentages of each allowance that send a usage email to owners and billing members. */
27916
28272
  alert_thresholds: number[];
27917
28273
  overage: string | null;
28274
+ /** @description The plan offers opt-in overage and the organization pays for it with a subscription, so overage can be turned on. */
28275
+ overage_available: boolean;
28276
+ /** @description Overage is turned on (off by default). */
28277
+ overage_enabled: boolean;
28278
+ /** @description unavailable: overage_available is false. off: available, not turned on. on: in effect up to the spend cap. paused: turned on, but a plan invoice is past due, so it behaves as off until the invoice is paid. */
28279
+ overage_state: "unavailable" | "off" | "on" | "paused";
28280
+ spend_cap_minor: number | null;
28281
+ spend_cap_max_minor: number | null;
28282
+ /** @description The smallest cap that can be set (100 = $1). */
28283
+ spend_cap_min_minor: number;
28284
+ /** @description Overage rates of the organization's plan grant. Empty when the plan has none. */
28285
+ rates: {
28286
+ /** @description The allowances overage covers. Storage and transfer never accrue overage. */
28287
+ allowance: "ram_gib_hours" | "cpu_hours";
28288
+ /** @description gib_hours for ram_gib_hours, hours (CPU-hours) for cpu_hours. */
28289
+ unit: "gib_hours" | "hours";
28290
+ /** @description Minor units per unit-hour past the allowance (4 = $0.04 per RAM GiB-hour, 12 = $0.12 per CPU-hour). */
28291
+ amount_minor_per_unit: number;
28292
+ }[];
28293
+ /** @description ISO 4217 code, lower case, of the cap and the rates. */
28294
+ currency: string;
27918
28295
  updated_at: string | null;
28296
+ /** @description Send it as If-Match on PUT to detect a concurrent change (409 conflict, reason version_mismatch). */
27919
28297
  version: number;
27920
28298
  };
27921
28299
  };
@@ -28026,6 +28404,7 @@ export interface operations {
28026
28404
  included: number | null;
28027
28405
  unit: string;
28028
28406
  }[];
28407
+ exhausted_reason: ("allowance_used" | "overage_paused" | "spend_cap_reached") | null;
28029
28408
  egress_override: {
28030
28409
  /** @enum {string} */
28031
28410
  mode: "deny_all";
@@ -28057,7 +28436,8 @@ export interface operations {
28057
28436
  included_meter_units: number | null;
28058
28437
  used_meter_units: number | null;
28059
28438
  remaining_meter_units: number | null;
28060
- cap_state: "ok" | "warning" | "exhausted" | "over_allowance" | "egress_blocked" | "uncapped" | "not_included";
28439
+ /** @description ok: below 80 %. warning: 80 % or more of the allowance. exhausted: a hard cap is used up and starts are refused (402 allowance_exhausted; see exhausted_reason). overage: a CPU-hours or RAM GiB-hours allowance is used up while opt-in overage is on and below its spend cap, so starts are admitted and the usage past it is charged (spend_cap). over_allowance: a reported allowance is exceeded (never refused). egress_blocked: the outbound transfer allowance is used up and outbound traffic is blocked. uncapped: runs on spare capacity. not_included: the plan does not define it. */
28440
+ cap_state: "ok" | "warning" | "exhausted" | "overage" | "over_allowance" | "egress_blocked" | "uncapped" | "not_included";
28061
28441
  }[];
28062
28442
  meters: {
28063
28443
  /** @enum {string} */
@@ -28071,6 +28451,7 @@ export interface operations {
28071
28451
  stripe_event_name: string | null;
28072
28452
  }[];
28073
28453
  alert_thresholds: number[];
28454
+ spend_cap: components["schemas"]["SpendCap"];
28074
28455
  template_storage: components["schemas"]["OrgTemplateStorage"];
28075
28456
  };
28076
28457
  };
@@ -28404,11 +28785,12 @@ export interface operations {
28404
28785
  currency: string;
28405
28786
  interval: string;
28406
28787
  } | null;
28407
- /** @description Usage above the included allowances billed this period (0 while overage is disabled). */
28788
+ /** @description Overage charged this period so far, whole minor units (floor; spend_cap.charges_minor). 0 while overage is off or unavailable and nothing was charged this period. */
28408
28789
  usage_charges_minor: number;
28409
28790
  estimated_total_minor: number | null;
28410
28791
  overage: string | null;
28411
- /** @description Period-to-date usage per meter at the catalog price (included in usage_charges_minor). */
28792
+ spend_cap: components["schemas"]["SpendCap"];
28793
+ /** @description Period-to-date usage per meter with its overage price and charge (included in usage_charges_minor). */
28412
28794
  usage_lines: {
28413
28795
  /** @enum {string} */
28414
28796
  meter: "cpu_seconds" | "memory_gib_seconds" | "storage_gib_seconds" | "egress_bytes" | "ingress_bytes" | "volume_storage_gib_seconds";
@@ -28418,7 +28800,7 @@ export interface operations {
28418
28800
  billable_quantity: number;
28419
28801
  allowance: string | null;
28420
28802
  unit_price_minor: number | null;
28421
- /** @description billable_quantity x unit_price_minor above any allowance (0 without a price). */
28803
+ /** @description Overage charged on this meter this period, whole minor units (floor; the matching spend_cap line). 0 for meters overage never covers and when nothing was charged. */
28422
28804
  amount_minor: number;
28423
28805
  }[];
28424
28806
  projections: {
@@ -28728,12 +29110,16 @@ export interface operations {
28728
29110
  overage: string | null;
28729
29111
  alert_thresholds: number[];
28730
29112
  subscription_fee_minor: number | null;
29113
+ /** @description Overage charged this period so far, whole minor units (floor; spend_cap.charges_minor). */
28731
29114
  usage_charges_minor: number;
28732
29115
  estimated_period_total_minor: number | null;
28733
- /** @description Worst state over hard-cap allowances. */
28734
- cap_state: "ok" | "warning" | "exhausted";
29116
+ /** @description Worst state over hard-cap allowances: exhausted (starts refused, see exhausted_reason) > overage (past an allowance, charged under the spend cap) > warning (80 % or more) > ok. */
29117
+ cap_state: "ok" | "warning" | "overage" | "exhausted";
28735
29118
  exhausted: string[];
29119
+ exhausted_reason: ("allowance_used" | "overage_paused" | "spend_cap_reached") | null;
29120
+ spend_cap: components["schemas"]["SpendCap"];
28736
29121
  enforcement: {
29122
+ /** @description refused while any hard-cap allowance is exhausted (402 allowance_exhausted with exhausted_reason as details.reason). */
28737
29123
  new_starts: "allowed" | "refused";
28738
29124
  running_workspaces: number;
28739
29125
  /** @description How running workspaces are stopped when a hard cap is reached. */
@@ -28849,9 +29235,32 @@ export interface operations {
28849
29235
  * @description UUIDv7, lowercase canonical form.
28850
29236
  */
28851
29237
  organization_id: string;
29238
+ /** @description Percentages of each allowance that send a usage email to owners and billing members. */
28852
29239
  alert_thresholds: number[];
28853
29240
  overage: string | null;
29241
+ /** @description The plan offers opt-in overage and the organization pays for it with a subscription, so overage can be turned on. */
29242
+ overage_available: boolean;
29243
+ /** @description Overage is turned on (off by default). */
29244
+ overage_enabled: boolean;
29245
+ /** @description unavailable: overage_available is false. off: available, not turned on. on: in effect up to the spend cap. paused: turned on, but a plan invoice is past due, so it behaves as off until the invoice is paid. */
29246
+ overage_state: "unavailable" | "off" | "on" | "paused";
29247
+ spend_cap_minor: number | null;
29248
+ spend_cap_max_minor: number | null;
29249
+ /** @description The smallest cap that can be set (100 = $1). */
29250
+ spend_cap_min_minor: number;
29251
+ /** @description Overage rates of the organization's plan grant. Empty when the plan has none. */
29252
+ rates: {
29253
+ /** @description The allowances overage covers. Storage and transfer never accrue overage. */
29254
+ allowance: "ram_gib_hours" | "cpu_hours";
29255
+ /** @description gib_hours for ram_gib_hours, hours (CPU-hours) for cpu_hours. */
29256
+ unit: "gib_hours" | "hours";
29257
+ /** @description Minor units per unit-hour past the allowance (4 = $0.04 per RAM GiB-hour, 12 = $0.12 per CPU-hour). */
29258
+ amount_minor_per_unit: number;
29259
+ }[];
29260
+ /** @description ISO 4217 code, lower case, of the cap and the rates. */
29261
+ currency: string;
28854
29262
  updated_at: string | null;
29263
+ /** @description Send it as If-Match on PUT to detect a concurrent change (409 conflict, reason version_mismatch). */
28855
29264
  version: number;
28856
29265
  };
28857
29266
  };
@@ -28879,7 +29288,10 @@ export interface operations {
28879
29288
  putApiV1OrganizationsOrganizationIdSpendPolicy: {
28880
29289
  parameters: {
28881
29290
  query?: never;
28882
- header?: never;
29291
+ header?: {
29292
+ /** @description The spend policy version you read ("3", or "*" for any). */
29293
+ "if-match"?: string;
29294
+ };
28883
29295
  path: {
28884
29296
  /** @description UUIDv7, lowercase canonical form. */
28885
29297
  organization_id: string;
@@ -28889,7 +29301,12 @@ export interface operations {
28889
29301
  requestBody: {
28890
29302
  content: {
28891
29303
  "application/json": {
28892
- alert_thresholds_percent: number[];
29304
+ /** @description Percentages of each allowance (1-100, at most 5). */
29305
+ alert_thresholds_percent?: number[];
29306
+ /** @description Turn overage on (needs a spend cap, given here or set before) or off. Turning it off is always allowed. */
29307
+ overage_enabled?: boolean;
29308
+ /** @description Spend cap per billing period in minor units: at least spend_cap_min_minor, at most spend_cap_max_minor (the plan price), and not below what overage already charged this period. */
29309
+ spend_cap_minor?: number;
28893
29310
  };
28894
29311
  };
28895
29312
  };
@@ -28906,9 +29323,32 @@ export interface operations {
28906
29323
  * @description UUIDv7, lowercase canonical form.
28907
29324
  */
28908
29325
  organization_id: string;
29326
+ /** @description Percentages of each allowance that send a usage email to owners and billing members. */
28909
29327
  alert_thresholds: number[];
28910
29328
  overage: string | null;
29329
+ /** @description The plan offers opt-in overage and the organization pays for it with a subscription, so overage can be turned on. */
29330
+ overage_available: boolean;
29331
+ /** @description Overage is turned on (off by default). */
29332
+ overage_enabled: boolean;
29333
+ /** @description unavailable: overage_available is false. off: available, not turned on. on: in effect up to the spend cap. paused: turned on, but a plan invoice is past due, so it behaves as off until the invoice is paid. */
29334
+ overage_state: "unavailable" | "off" | "on" | "paused";
29335
+ spend_cap_minor: number | null;
29336
+ spend_cap_max_minor: number | null;
29337
+ /** @description The smallest cap that can be set (100 = $1). */
29338
+ spend_cap_min_minor: number;
29339
+ /** @description Overage rates of the organization's plan grant. Empty when the plan has none. */
29340
+ rates: {
29341
+ /** @description The allowances overage covers. Storage and transfer never accrue overage. */
29342
+ allowance: "ram_gib_hours" | "cpu_hours";
29343
+ /** @description gib_hours for ram_gib_hours, hours (CPU-hours) for cpu_hours. */
29344
+ unit: "gib_hours" | "hours";
29345
+ /** @description Minor units per unit-hour past the allowance (4 = $0.04 per RAM GiB-hour, 12 = $0.12 per CPU-hour). */
29346
+ amount_minor_per_unit: number;
29347
+ }[];
29348
+ /** @description ISO 4217 code, lower case, of the cap and the rates. */
29349
+ currency: string;
28911
29350
  updated_at: string | null;
29351
+ /** @description Send it as If-Match on PUT to detect a concurrent change (409 conflict, reason version_mismatch). */
28912
29352
  version: number;
28913
29353
  };
28914
29354
  };