@soat/sdk 0.16.0 → 0.16.2

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
@@ -1576,7 +1576,7 @@ type ExceptionItem = {
1576
1576
  /**
1577
1577
  * How the exception was filed
1578
1578
  */
1579
- kind?: 'run_failed' | 'guardrail_tripwire' | 'approval_expired' | 'manual';
1579
+ kind?: 'run_failed' | 'guardrail_tripwire' | 'approval_expired' | 'quota_unpriced' | 'manual';
1580
1580
  /**
1581
1581
  * Human-readable one-line summary
1582
1582
  */
@@ -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
  /**
@@ -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;
@@ -6506,6 +6516,10 @@ type ListAuditEntriesData = {
6506
6516
  url: '/api/v1/audit-log';
6507
6517
  };
6508
6518
  type ListAuditEntriesErrors = {
6519
+ /**
6520
+ * `from` or `to` is present but not a valid ISO 8601 date
6521
+ */
6522
+ 400: unknown;
6509
6523
  /**
6510
6524
  * Unauthorized
6511
6525
  */
@@ -6568,7 +6582,7 @@ type ExportAuditEntriesData = {
6568
6582
  };
6569
6583
  type ExportAuditEntriesErrors = {
6570
6584
  /**
6571
- * project_id is required
6585
+ * `project_id` is required, or `from`/`to` is present but not a valid ISO 8601 date
6572
6586
  */
6573
6587
  400: unknown;
6574
6588
  /**
@@ -8251,7 +8265,7 @@ type ListExceptionsData = {
8251
8265
  /**
8252
8266
  * Filter by how the exception was filed
8253
8267
  */
8254
- kind?: 'run_failed' | 'guardrail_tripwire' | 'approval_expired' | 'manual';
8268
+ kind?: 'run_failed' | 'guardrail_tripwire' | 'approval_expired' | 'quota_unpriced' | 'manual';
8255
8269
  /**
8256
8270
  * Maximum number of results to return
8257
8271
  */
@@ -11285,7 +11299,7 @@ type CreateQuotaData = {
11285
11299
  /**
11286
11300
  * The scope the quota applies to
11287
11301
  */
11288
- scope: 'project' | 'api_key' | 'agent';
11302
+ scope: 'project' | 'api_key' | 'agent' | 'actor';
11289
11303
  /**
11290
11304
  * Public id of the api key / agent the quota applies to. NULL means all entities of that scope type in the project.
11291
11305
  */
@@ -11303,7 +11317,7 @@ type CreateQuotaData = {
11303
11317
  */
11304
11318
  limit: number;
11305
11319
  /**
11306
- * enforce blocks with 429 (requests at the middleware, tokens/cost_usd at the pre-generation check); monitor is a pass-through no-op until the webhook phase ships.
11320
+ * enforce blocks with 429 (requests at the middleware, tokens/cost_usd at the pre-generation check); monitor observes without blocking — a breach fires the quota.exceeded webhook and writes a quotas:MonitorBreach audit entry, but the request is let through.
11307
11321
  */
11308
11322
  mode?: 'enforce' | 'monitor';
11309
11323
  };
@@ -12980,6 +12994,16 @@ type ListUsageMetersData = {
12980
12994
  * Filter by trace public ID
12981
12995
  */
12982
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;
12983
13007
  /**
12984
13008
  * Filter by the trigger that initiated the generation
12985
13009
  */
@@ -13033,7 +13057,7 @@ type GetUsageData = {
13033
13057
  * Dimension to bucket by. `day` buckets on the event's UTC calendar day; the others bucket on the matching column.
13034
13058
  *
13035
13059
  */
13036
- group_by: 'model' | 'agent' | 'run' | 'day' | 'meter_type';
13060
+ group_by: 'model' | 'agent' | 'run' | 'day' | 'meter_type' | 'actor' | 'session';
13037
13061
  /**
13038
13062
  * Inclusive lower bound (ISO-8601 timestamp) on the event created_at. Omit for no lower bound.
13039
13063
  *
@@ -14981,7 +15005,7 @@ declare class Quotas {
14981
15005
  /**
14982
15006
  * Create a quota
14983
15007
  *
14984
- * 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.
14985
15009
  */
14986
15010
  static createQuota<ThrowOnError extends boolean = false>(options: Options<CreateQuotaData, ThrowOnError>): RequestResult<CreateQuotaResponses, CreateQuotaErrors, ThrowOnError>;
14987
15011
  /**
@@ -15280,7 +15304,7 @@ declare class Usage {
15280
15304
  /**
15281
15305
  * List usage meters
15282
15306
  *
15283
- * 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.
15284
15308
  *
15285
15309
  */
15286
15310
  static listUsageMeters<ThrowOnError extends boolean = false>(options?: Options<ListUsageMetersData, ThrowOnError>): RequestResult<ListUsageMetersResponses, ListUsageMetersErrors, ThrowOnError>;
package/dist/index.d.mts CHANGED
@@ -1576,7 +1576,7 @@ type ExceptionItem = {
1576
1576
  /**
1577
1577
  * How the exception was filed
1578
1578
  */
1579
- kind?: 'run_failed' | 'guardrail_tripwire' | 'approval_expired' | 'manual';
1579
+ kind?: 'run_failed' | 'guardrail_tripwire' | 'approval_expired' | 'quota_unpriced' | 'manual';
1580
1580
  /**
1581
1581
  * Human-readable one-line summary
1582
1582
  */
@@ -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
  /**
@@ -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;
@@ -6506,6 +6516,10 @@ type ListAuditEntriesData = {
6506
6516
  url: '/api/v1/audit-log';
6507
6517
  };
6508
6518
  type ListAuditEntriesErrors = {
6519
+ /**
6520
+ * `from` or `to` is present but not a valid ISO 8601 date
6521
+ */
6522
+ 400: unknown;
6509
6523
  /**
6510
6524
  * Unauthorized
6511
6525
  */
@@ -6568,7 +6582,7 @@ type ExportAuditEntriesData = {
6568
6582
  };
6569
6583
  type ExportAuditEntriesErrors = {
6570
6584
  /**
6571
- * project_id is required
6585
+ * `project_id` is required, or `from`/`to` is present but not a valid ISO 8601 date
6572
6586
  */
6573
6587
  400: unknown;
6574
6588
  /**
@@ -8251,7 +8265,7 @@ type ListExceptionsData = {
8251
8265
  /**
8252
8266
  * Filter by how the exception was filed
8253
8267
  */
8254
- kind?: 'run_failed' | 'guardrail_tripwire' | 'approval_expired' | 'manual';
8268
+ kind?: 'run_failed' | 'guardrail_tripwire' | 'approval_expired' | 'quota_unpriced' | 'manual';
8255
8269
  /**
8256
8270
  * Maximum number of results to return
8257
8271
  */
@@ -11285,7 +11299,7 @@ type CreateQuotaData = {
11285
11299
  /**
11286
11300
  * The scope the quota applies to
11287
11301
  */
11288
- scope: 'project' | 'api_key' | 'agent';
11302
+ scope: 'project' | 'api_key' | 'agent' | 'actor';
11289
11303
  /**
11290
11304
  * Public id of the api key / agent the quota applies to. NULL means all entities of that scope type in the project.
11291
11305
  */
@@ -11303,7 +11317,7 @@ type CreateQuotaData = {
11303
11317
  */
11304
11318
  limit: number;
11305
11319
  /**
11306
- * enforce blocks with 429 (requests at the middleware, tokens/cost_usd at the pre-generation check); monitor is a pass-through no-op until the webhook phase ships.
11320
+ * enforce blocks with 429 (requests at the middleware, tokens/cost_usd at the pre-generation check); monitor observes without blocking — a breach fires the quota.exceeded webhook and writes a quotas:MonitorBreach audit entry, but the request is let through.
11307
11321
  */
11308
11322
  mode?: 'enforce' | 'monitor';
11309
11323
  };
@@ -12980,6 +12994,16 @@ type ListUsageMetersData = {
12980
12994
  * Filter by trace public ID
12981
12995
  */
12982
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;
12983
13007
  /**
12984
13008
  * Filter by the trigger that initiated the generation
12985
13009
  */
@@ -13033,7 +13057,7 @@ type GetUsageData = {
13033
13057
  * Dimension to bucket by. `day` buckets on the event's UTC calendar day; the others bucket on the matching column.
13034
13058
  *
13035
13059
  */
13036
- group_by: 'model' | 'agent' | 'run' | 'day' | 'meter_type';
13060
+ group_by: 'model' | 'agent' | 'run' | 'day' | 'meter_type' | 'actor' | 'session';
13037
13061
  /**
13038
13062
  * Inclusive lower bound (ISO-8601 timestamp) on the event created_at. Omit for no lower bound.
13039
13063
  *
@@ -14981,7 +15005,7 @@ declare class Quotas {
14981
15005
  /**
14982
15006
  * Create a quota
14983
15007
  *
14984
- * 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.
14985
15009
  */
14986
15010
  static createQuota<ThrowOnError extends boolean = false>(options: Options<CreateQuotaData, ThrowOnError>): RequestResult<CreateQuotaResponses, CreateQuotaErrors, ThrowOnError>;
14987
15011
  /**
@@ -15280,7 +15304,7 @@ declare class Usage {
15280
15304
  /**
15281
15305
  * List usage meters
15282
15306
  *
15283
- * 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.
15284
15308
  *
15285
15309
  */
15286
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.0",
3
+ "version": "0.16.2",
4
4
  "description": "TypeScript SDK for the SOAT API",
5
5
  "type": "module",
6
6
  "main": "dist/index.mjs",