@soat/sdk 0.16.1 → 0.16.3

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
@@ -2715,7 +2715,7 @@ var Quotas = class {
2715
2715
  /**
2716
2716
  * Create a quota
2717
2717
  *
2718
- * Creates a project-scoped quota. `scope: agent` with `metric: requests` and `scope: api_key` with `metric: tokens`/`cost_usd` are both rejected with 400 (no attribution exists to enforce them). A duplicate quota (same project, scope, scope_ref, metric, window) is rejected with 409.
2718
+ * 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.
2719
2719
  */
2720
2720
  static createQuota(options) {
2721
2721
  return (options.client ?? client).post({
@@ -3324,7 +3324,7 @@ var Usage = class {
3324
3324
  /**
3325
3325
  * List usage meters
3326
3326
  *
3327
- * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent and generation. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
3327
+ * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent, generation, trace, actor, or session. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
3328
3328
  *
3329
3329
  */
3330
3330
  static listUsageMeters(options) {
package/dist/index.d.cts CHANGED
@@ -2622,9 +2622,9 @@ type QuotaResourceProperties = {
2622
2622
  /**
2623
2623
  * The scope the quota applies to
2624
2624
  */
2625
- scope: 'project' | 'api_key' | 'agent';
2625
+ scope: 'project' | 'api_key' | 'agent' | 'actor';
2626
2626
  /**
2627
- * Public id of the api key / agent the quota applies to. NULL means all entities of that scope type in the project.
2627
+ * Public id of the api key / agent / actor the quota applies to. NULL means all entities of that scope type in the project — for `actor` scope that is one budget per actor, not a pooled total.
2628
2628
  */
2629
2629
  scope_ref?: string | null;
2630
2630
  /**
@@ -3260,9 +3260,9 @@ type MemoryEntryWriteResult = MemoryEntry & {
3260
3260
  */
3261
3261
  type QueueStats = {
3262
3262
  /**
3263
- * The active queue driver.
3263
+ * The active queue driver (`ORCHESTRATION_QUEUE_DRIVER`). Under `sqs`, `oldest_queued_age_seconds` is always `null` and `per_project` is always empty — SQS exposes neither.
3264
3264
  */
3265
- driver?: string;
3265
+ driver?: 'postgres' | 'sqs';
3266
3266
  /**
3267
3267
  * Tasks waiting to be claimed now (unclaimed and past their `available_at`). Backoff-delayed tasks are excluded.
3268
3268
  */
@@ -3847,7 +3847,7 @@ type UpsertProjectPricesRequest = {
3847
3847
  type Quota = {
3848
3848
  id?: string;
3849
3849
  project_id?: string;
3850
- scope?: 'project' | 'api_key' | 'agent';
3850
+ scope?: 'project' | 'api_key' | 'agent' | 'actor';
3851
3851
  scope_ref?: string | null;
3852
3852
  metric?: 'requests' | 'tokens' | 'cost_usd';
3853
3853
  window?: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month';
@@ -4634,6 +4634,16 @@ type UsageEvent = {
4634
4634
  * Public ID of the trace this usage belongs to
4635
4635
  */
4636
4636
  trace_id?: string | null;
4637
+ /**
4638
+ * Public ID of the actor (end user) the metered occurrence was produced for, frozen at write time. Null when no end user is behind the work — orchestration runs, triggers, direct API generations.
4639
+ *
4640
+ */
4641
+ actor_id?: string | null;
4642
+ /**
4643
+ * Public ID of the session the metered occurrence ran in, frozen at write time. Null for work not dispatched through a session.
4644
+ *
4645
+ */
4646
+ session_id?: string | null;
4637
4647
  /**
4638
4648
  * Public ID of the AI provider instance billed. Null if the provider was later deleted; the `provider`/`model` snapshot still records what was billed.
4639
4649
  *
@@ -4697,13 +4707,13 @@ type UsageAggregate = {
4697
4707
  * Upper bound applied, echoed back; null when unbounded
4698
4708
  */
4699
4709
  to?: Date | null;
4700
- group_by?: 'model' | 'agent' | 'run' | 'day' | 'meter_type';
4710
+ group_by?: 'model' | 'agent' | 'run' | 'day' | 'meter_type' | 'actor' | 'session';
4701
4711
  /**
4702
4712
  * One entry per distinct value in the chosen dimension.
4703
4713
  */
4704
4714
  groups?: Array<{
4705
4715
  /**
4706
- * The bucket's value in the chosen dimension (a model id, meter type, agent/run public id, or `YYYY-MM-DD` UTC day). Null when the dimension does not apply to an event.
4716
+ * The bucket's value in the chosen dimension (a model id, meter type, agent/run/actor/session public id, or `YYYY-MM-DD` UTC day). Null when the dimension does not apply to an event — under `actor`/`session` this is the bucket holding everything with no end user behind it.
4707
4717
  *
4708
4718
  */
4709
4719
  key?: string | null;
@@ -11289,7 +11299,7 @@ type CreateQuotaData = {
11289
11299
  /**
11290
11300
  * The scope the quota applies to
11291
11301
  */
11292
- scope: 'project' | 'api_key' | 'agent';
11302
+ scope: 'project' | 'api_key' | 'agent' | 'actor';
11293
11303
  /**
11294
11304
  * Public id of the api key / agent the quota applies to. NULL means all entities of that scope type in the project.
11295
11305
  */
@@ -12984,6 +12994,16 @@ type ListUsageMetersData = {
12984
12994
  * Filter by trace public ID
12985
12995
  */
12986
12996
  trace_id?: string;
12997
+ /**
12998
+ * Filter by the actor (end user) the usage is attributed to. An actor that does not exist in scope yields an empty page.
12999
+ *
13000
+ */
13001
+ actor_id?: string;
13002
+ /**
13003
+ * Filter by the session the usage was produced in. A session that does not exist in scope yields an empty page.
13004
+ *
13005
+ */
13006
+ session_id?: string;
12987
13007
  /**
12988
13008
  * Filter by the trigger that initiated the generation
12989
13009
  */
@@ -13037,7 +13057,7 @@ type GetUsageData = {
13037
13057
  * Dimension to bucket by. `day` buckets on the event's UTC calendar day; the others bucket on the matching column.
13038
13058
  *
13039
13059
  */
13040
- group_by: 'model' | 'agent' | 'run' | 'day' | 'meter_type';
13060
+ group_by: 'model' | 'agent' | 'run' | 'day' | 'meter_type' | 'actor' | 'session';
13041
13061
  /**
13042
13062
  * Inclusive lower bound (ISO-8601 timestamp) on the event created_at. Omit for no lower bound.
13043
13063
  *
@@ -14985,7 +15005,7 @@ declare class Quotas {
14985
15005
  /**
14986
15006
  * Create a quota
14987
15007
  *
14988
- * Creates a project-scoped quota. `scope: agent` with `metric: requests` and `scope: api_key` with `metric: tokens`/`cost_usd` are both rejected with 400 (no attribution exists to enforce them). A duplicate quota (same project, scope, scope_ref, metric, window) is rejected with 409.
15008
+ * 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.
14989
15009
  */
14990
15010
  static createQuota<ThrowOnError extends boolean = false>(options: Options<CreateQuotaData, ThrowOnError>): RequestResult<CreateQuotaResponses, CreateQuotaErrors, ThrowOnError>;
14991
15011
  /**
@@ -15284,7 +15304,7 @@ declare class Usage {
15284
15304
  /**
15285
15305
  * List usage meters
15286
15306
  *
15287
- * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent and generation. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
15307
+ * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent, generation, trace, actor, or session. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
15288
15308
  *
15289
15309
  */
15290
15310
  static listUsageMeters<ThrowOnError extends boolean = false>(options?: Options<ListUsageMetersData, ThrowOnError>): RequestResult<ListUsageMetersResponses, ListUsageMetersErrors, ThrowOnError>;
package/dist/index.d.mts CHANGED
@@ -2622,9 +2622,9 @@ type QuotaResourceProperties = {
2622
2622
  /**
2623
2623
  * The scope the quota applies to
2624
2624
  */
2625
- scope: 'project' | 'api_key' | 'agent';
2625
+ scope: 'project' | 'api_key' | 'agent' | 'actor';
2626
2626
  /**
2627
- * Public id of the api key / agent the quota applies to. NULL means all entities of that scope type in the project.
2627
+ * Public id of the api key / agent / actor the quota applies to. NULL means all entities of that scope type in the project — for `actor` scope that is one budget per actor, not a pooled total.
2628
2628
  */
2629
2629
  scope_ref?: string | null;
2630
2630
  /**
@@ -3260,9 +3260,9 @@ type MemoryEntryWriteResult = MemoryEntry & {
3260
3260
  */
3261
3261
  type QueueStats = {
3262
3262
  /**
3263
- * The active queue driver.
3263
+ * The active queue driver (`ORCHESTRATION_QUEUE_DRIVER`). Under `sqs`, `oldest_queued_age_seconds` is always `null` and `per_project` is always empty — SQS exposes neither.
3264
3264
  */
3265
- driver?: string;
3265
+ driver?: 'postgres' | 'sqs';
3266
3266
  /**
3267
3267
  * Tasks waiting to be claimed now (unclaimed and past their `available_at`). Backoff-delayed tasks are excluded.
3268
3268
  */
@@ -3847,7 +3847,7 @@ type UpsertProjectPricesRequest = {
3847
3847
  type Quota = {
3848
3848
  id?: string;
3849
3849
  project_id?: string;
3850
- scope?: 'project' | 'api_key' | 'agent';
3850
+ scope?: 'project' | 'api_key' | 'agent' | 'actor';
3851
3851
  scope_ref?: string | null;
3852
3852
  metric?: 'requests' | 'tokens' | 'cost_usd';
3853
3853
  window?: 'rolling_1m' | 'rolling_1h' | 'rolling_24h' | 'calendar_month';
@@ -4634,6 +4634,16 @@ type UsageEvent = {
4634
4634
  * Public ID of the trace this usage belongs to
4635
4635
  */
4636
4636
  trace_id?: string | null;
4637
+ /**
4638
+ * Public ID of the actor (end user) the metered occurrence was produced for, frozen at write time. Null when no end user is behind the work — orchestration runs, triggers, direct API generations.
4639
+ *
4640
+ */
4641
+ actor_id?: string | null;
4642
+ /**
4643
+ * Public ID of the session the metered occurrence ran in, frozen at write time. Null for work not dispatched through a session.
4644
+ *
4645
+ */
4646
+ session_id?: string | null;
4637
4647
  /**
4638
4648
  * Public ID of the AI provider instance billed. Null if the provider was later deleted; the `provider`/`model` snapshot still records what was billed.
4639
4649
  *
@@ -4697,13 +4707,13 @@ type UsageAggregate = {
4697
4707
  * Upper bound applied, echoed back; null when unbounded
4698
4708
  */
4699
4709
  to?: Date | null;
4700
- group_by?: 'model' | 'agent' | 'run' | 'day' | 'meter_type';
4710
+ group_by?: 'model' | 'agent' | 'run' | 'day' | 'meter_type' | 'actor' | 'session';
4701
4711
  /**
4702
4712
  * One entry per distinct value in the chosen dimension.
4703
4713
  */
4704
4714
  groups?: Array<{
4705
4715
  /**
4706
- * The bucket's value in the chosen dimension (a model id, meter type, agent/run public id, or `YYYY-MM-DD` UTC day). Null when the dimension does not apply to an event.
4716
+ * The bucket's value in the chosen dimension (a model id, meter type, agent/run/actor/session public id, or `YYYY-MM-DD` UTC day). Null when the dimension does not apply to an event — under `actor`/`session` this is the bucket holding everything with no end user behind it.
4707
4717
  *
4708
4718
  */
4709
4719
  key?: string | null;
@@ -11289,7 +11299,7 @@ type CreateQuotaData = {
11289
11299
  /**
11290
11300
  * The scope the quota applies to
11291
11301
  */
11292
- scope: 'project' | 'api_key' | 'agent';
11302
+ scope: 'project' | 'api_key' | 'agent' | 'actor';
11293
11303
  /**
11294
11304
  * Public id of the api key / agent the quota applies to. NULL means all entities of that scope type in the project.
11295
11305
  */
@@ -12984,6 +12994,16 @@ type ListUsageMetersData = {
12984
12994
  * Filter by trace public ID
12985
12995
  */
12986
12996
  trace_id?: string;
12997
+ /**
12998
+ * Filter by the actor (end user) the usage is attributed to. An actor that does not exist in scope yields an empty page.
12999
+ *
13000
+ */
13001
+ actor_id?: string;
13002
+ /**
13003
+ * Filter by the session the usage was produced in. A session that does not exist in scope yields an empty page.
13004
+ *
13005
+ */
13006
+ session_id?: string;
12987
13007
  /**
12988
13008
  * Filter by the trigger that initiated the generation
12989
13009
  */
@@ -13037,7 +13057,7 @@ type GetUsageData = {
13037
13057
  * Dimension to bucket by. `day` buckets on the event's UTC calendar day; the others bucket on the matching column.
13038
13058
  *
13039
13059
  */
13040
- group_by: 'model' | 'agent' | 'run' | 'day' | 'meter_type';
13060
+ group_by: 'model' | 'agent' | 'run' | 'day' | 'meter_type' | 'actor' | 'session';
13041
13061
  /**
13042
13062
  * Inclusive lower bound (ISO-8601 timestamp) on the event created_at. Omit for no lower bound.
13043
13063
  *
@@ -14985,7 +15005,7 @@ declare class Quotas {
14985
15005
  /**
14986
15006
  * Create a quota
14987
15007
  *
14988
- * Creates a project-scoped quota. `scope: agent` with `metric: requests` and `scope: api_key` with `metric: tokens`/`cost_usd` are both rejected with 400 (no attribution exists to enforce them). A duplicate quota (same project, scope, scope_ref, metric, window) is rejected with 409.
15008
+ * 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.
14989
15009
  */
14990
15010
  static createQuota<ThrowOnError extends boolean = false>(options: Options<CreateQuotaData, ThrowOnError>): RequestResult<CreateQuotaResponses, CreateQuotaErrors, ThrowOnError>;
14991
15011
  /**
@@ -15284,7 +15304,7 @@ declare class Usage {
15284
15304
  /**
15285
15305
  * List usage meters
15286
15306
  *
15287
- * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent and generation. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
15307
+ * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent, generation, trace, actor, or session. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
15288
15308
  *
15289
15309
  */
15290
15310
  static listUsageMeters<ThrowOnError extends boolean = false>(options?: Options<ListUsageMetersData, ThrowOnError>): RequestResult<ListUsageMetersResponses, ListUsageMetersErrors, ThrowOnError>;
package/dist/index.mjs CHANGED
@@ -2714,7 +2714,7 @@ var Quotas = class {
2714
2714
  /**
2715
2715
  * Create a quota
2716
2716
  *
2717
- * Creates a project-scoped quota. `scope: agent` with `metric: requests` and `scope: api_key` with `metric: tokens`/`cost_usd` are both rejected with 400 (no attribution exists to enforce them). A duplicate quota (same project, scope, scope_ref, metric, window) is rejected with 409.
2717
+ * 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.
2718
2718
  */
2719
2719
  static createQuota(options) {
2720
2720
  return (options.client ?? client).post({
@@ -3323,7 +3323,7 @@ var Usage = class {
3323
3323
  /**
3324
3324
  * List usage meters
3325
3325
  *
3326
- * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent and generation. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
3326
+ * Returns the raw usage-meter rows the caller can access, most recent first, optionally filtered by agent, generation, trace, actor, or session. Each row is the per-generation token usage as reported by the provider, for audit and reconciliation.
3327
3327
  *
3328
3328
  */
3329
3329
  static listUsageMeters(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soat/sdk",
3
- "version": "0.16.1",
3
+ "version": "0.16.3",
4
4
  "description": "TypeScript SDK for the SOAT API",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",