@soat/sdk 0.60.0 → 0.61.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
@@ -2669,7 +2669,7 @@ var Guardrails = class {
2669
2669
  /**
2670
2670
  * Dry-run evaluate a guardrail
2671
2671
  *
2672
- * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `runtime.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `runtime.tool.*`.
2672
+ * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `runtime.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `runtime.tools.*`.
2673
2673
  *
2674
2674
  */
2675
2675
  static evaluateGuardrail(options) {
@@ -4354,7 +4354,7 @@ var Usage = class {
4354
4354
  /**
4355
4355
  * List usage events
4356
4356
  *
4357
- * Returns the raw usage events the caller can access, most recent first, narrowed by any combination of the same filters the aggregate takes — agent, generation, trace, actor, session, AI provider, orchestration run, orchestration, trigger, action, meter type, model or `source` — so a rollup and the events behind it are addressed the same way. Each event is the per-generation token usage as reported by the provider, for audit and reconciliation.
4357
+ * Returns the raw usage events the caller can access, most recent first, narrowed by any combination of the same filters the aggregate takes — agent, generation, trace, actor, session, AI provider, orchestration run, orchestration, tool, trigger, action, outcome, meter type, model or `source` — so a rollup and the events behind it are addressed the same way. Each event is the per-generation token usage as reported by the provider, for audit and reconciliation.
4358
4358
  *
4359
4359
  * An id naming nothing in scope yields an empty page rather than dropping the filter, so a mistyped narrowing can never widen the list past what was asked for.
4360
4360
  *
@@ -4368,9 +4368,9 @@ var Usage = class {
4368
4368
  /**
4369
4369
  * Get aggregated usage for a project
4370
4370
  *
4371
- * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of thirteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, meter type, model, source, trigger and action. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
4371
+ * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of fifteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, tool, meter type, model, source, trigger, action and outcome. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
4372
4372
  *
4373
- * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all thirteen are echoed back under `filters`. The eight naming a resource are resolved against the project, and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other five are matched against the value the event recorded.
4373
+ * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all fifteen are echoed back under `filters`. The nine naming a resource are resolved against the project, and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other six are matched against the value the event recorded.
4374
4374
  *
4375
4375
  * `groups` is paginated. Its `total` is the number of distinct buckets in the window — bucket cardinality, including a null bucket for the events the dimension does not apply to, and never a count of entities. To count entities, send `include=distinct` and read `totals.distinct`. `totals` always describes the whole window — never the page above it, and never the bucketing: omit `group_by` and `totals` is unchanged while `groups` is empty.
4376
4376
  *
package/dist/index.d.cts CHANGED
@@ -3466,7 +3466,7 @@ type QuotaResourceProperties = {
3466
3466
  /**
3467
3467
  * Only for metric cost_usd. The meter this cap answers for; omit it and the cap sums every priced meter. See the quotas REST contract.
3468
3468
  */
3469
- meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage';
3469
+ meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage' | 'tool_execution';
3470
3470
  };
3471
3471
  /**
3472
3472
  * Creates a guardrail — an action-class document (`class`/`guard`) that gates tool-call autonomy. Attach it to a tool or agent via that resource's `guardrail_ids` (a `{ "ref": … }` to this resource in the same template resolves to its physical id at deploy time). Mirrors the guardrails REST contract; `class`/`default_class`/`guard`/`escalate` are flattened here from the REST API's single `document` object.
@@ -5616,7 +5616,7 @@ type Quota = {
5616
5616
  /**
5617
5617
  * The meter a cost_usd cap answers for. Null is every priced meter, which is what a quota created without one carries.
5618
5618
  */
5619
- meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage' | null;
5619
+ meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage' | 'tool_execution' | null;
5620
5620
  /**
5621
5621
  * Pricing posture of a cost_usd quota over an unpriced blackout — block refuses generations, allow lets them through (the quota_unpriced exception is filed either way, and for a partly priced window, which no posture refuses). Null for metrics with no pricing dependency.
5622
5622
  */
@@ -6764,12 +6764,22 @@ type UsageEvent = {
6764
6764
  */
6765
6765
  action_id?: string | null;
6766
6766
  /**
6767
- * What the event measures: `llm_tokens`, `compute_execution`, `api_request`, or `storage`.
6767
+ * Public ID of the tool a `tool_execution` event metered. Null on every other meter, for an inline tool definition, and once the tool is deleted.
6768
+ *
6769
+ */
6770
+ tool_id?: string | null;
6771
+ /**
6772
+ * How a `tool_execution` call that went out ended, whatever the target answered: `ok`, `error` (including a non-2xx answer), or `timeout`. Null on every other meter.
6773
+ *
6774
+ */
6775
+ outcome?: string | null;
6776
+ /**
6777
+ * What the event measures: `llm_tokens`, `compute_execution`, `api_request`, `storage`, or `tool_execution` — one outbound tool call, a single `tool_call` component of quantity 1, unpriced.
6768
6778
  *
6769
6779
  */
6770
6780
  meter_type?: string;
6771
6781
  /**
6772
- * What the spend was incurred for. `eval` is an eval run's item generations and `eval_judge` an `llm_judge` scorer's own completion, so verification spend is `source` in (`eval`, `eval_judge`) and the two are distinct so running a suite can be priced apart from grading it. `embedding` is any embedding call — the endpoint, document ingestion, a memory store write, or a search's query vector. Null for ordinary agent traffic.
6782
+ * What the spend was incurred for. `eval` is an eval run's item generations and `eval_judge` an `llm_judge` scorer's own completion, and `eval_scorer` a `tool` scorer's call, so verification spend is `source` in (`eval`, `eval_judge`, `eval_scorer`) and they are distinct so running a suite can be priced apart from grading it. `embedding` is any embedding call — the endpoint, document ingestion, a memory store write, or a search's query vector. Null for ordinary agent traffic.
6773
6783
  *
6774
6784
  */
6775
6785
  source?: string | null;
@@ -6791,10 +6801,10 @@ type UsageEvent = {
6791
6801
  created_at?: Date;
6792
6802
  };
6793
6803
  /**
6794
- * The dimension an aggregate buckets on. `orchestration_run` buckets on the orchestration run; work that runs no orchestration collapses into the single `null` bucket.
6804
+ * The dimension an aggregate buckets on. `orchestration_run` buckets on the orchestration run; work that runs no orchestration collapses into the single `null` bucket. `tool` buckets `tool_execution` events on the tool they metered; every other meter is the `null` bucket.
6795
6805
  *
6796
6806
  */
6797
- type UsageGroupBy = 'model' | 'ai_provider' | 'agent' | 'orchestration_run' | 'day' | 'meter_type' | 'actor' | 'session' | 'source';
6807
+ type UsageGroupBy = 'model' | 'ai_provider' | 'agent' | 'orchestration_run' | 'day' | 'meter_type' | 'actor' | 'session' | 'source' | 'tool';
6798
6808
  /**
6799
6809
  * How many distinct entities of each kind the window touched — the counters a "how many generations / runs / actors this cycle" question reads. Present on `totals` exactly when `include=distinct` was sent, and never on a group — filling it per bucket would mean a `COUNT(DISTINCT)` per bucket on the page query.
6800
6810
  *
@@ -6811,6 +6821,7 @@ type UsageDistinct = {
6811
6821
  actors?: number;
6812
6822
  sessions?: number;
6813
6823
  ai_providers?: number;
6824
+ tools?: number;
6814
6825
  };
6815
6826
  /**
6816
6827
  * One measured dimension of a bucket, summed across its events. This is what makes the rollup uniform over meter types: the token fields only describe `llm_tokens`, so an infra meter's amount is read here.
@@ -6854,7 +6865,7 @@ type UsageAggregateTotals = UsageAggregateBucket & {
6854
6865
  distinct?: UsageDistinct;
6855
6866
  };
6856
6867
  /**
6857
- * Every narrowing the rollup applied, echoed back exactly as the caller sent it and null when unset. Echoed because a rollup of zeros is otherwise indistinguishable from a project that spent nothing, and always complete so a caller reading one key can tell "not filtered" from "this endpoint does not know that filter". The eight naming a resource are resolved against the project and empty the rollup when they name nothing in it; the other five are matched against the value the event recorded.
6868
+ * Every narrowing the rollup applied, echoed back exactly as the caller sent it and null when unset. Echoed because a rollup of zeros is otherwise indistinguishable from a project that spent nothing, and always complete so a caller reading one key can tell "not filtered" from "this endpoint does not know that filter". The nine naming a resource are resolved against the project and empty the rollup when they name nothing in it; the other six are matched against the value the event recorded.
6858
6869
  *
6859
6870
  */
6860
6871
  type UsageAggregateFilters = {
@@ -6871,6 +6882,8 @@ type UsageAggregateFilters = {
6871
6882
  orchestration_id?: string | null;
6872
6883
  generation_id?: string | null;
6873
6884
  trace_id?: string | null;
6885
+ tool_id?: string | null;
6886
+ outcome?: string | null;
6874
6887
  };
6875
6888
  type UsageAggregate = {
6876
6889
  project_id?: string;
@@ -6906,7 +6919,7 @@ type UsageAggregate = {
6906
6919
  };
6907
6920
  type UsageAggregateGroup = {
6908
6921
  /**
6909
- * The bucket's value in the chosen dimension (a model id, meter type, AI provider / agent / orchestration 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, and under `orchestration_run` the one holding every generation that ran no orchestration.
6922
+ * The bucket's value in the chosen dimension (a model id, meter type, AI provider / agent / orchestration run / actor / session / tool 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, and under `orchestration_run` the one holding every generation that ran no orchestration.
6910
6923
  *
6911
6924
  */
6912
6925
  key?: string | null;
@@ -13557,7 +13570,7 @@ type EvaluateGuardrailData = {
13557
13570
  [key: string]: unknown;
13558
13571
  };
13559
13572
  /**
13560
- * Optional tool to resolve `runtime.tool.*` against.
13573
+ * Optional tool to resolve `runtime.tools.*` against.
13561
13574
  */
13562
13575
  tool_id?: string;
13563
13576
  };
@@ -16744,7 +16757,7 @@ type CreateQuotaData = {
16744
16757
  /**
16745
16758
  * Only for metric cost_usd (400 on any other metric). The meter this cap answers for. Omit it and the cap sums every priced meter, which is the existing behaviour; name one and only that meter's cost counts, so an AI spend cap is not consumed by platform meters the operator prices (and vice versa). Part of the quota's identity, so two meter scopes can share a scope/metric/window and neither conflicts with an unscoped cap. Immutable after creation — replace the quota to change it.
16746
16759
  */
16747
- meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage';
16760
+ meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage' | 'tool_execution';
16748
16761
  };
16749
16762
  path?: never;
16750
16763
  query?: never;
@@ -18648,12 +18661,22 @@ type ListUsageEventsData = {
18648
18661
  */
18649
18662
  action_id?: string;
18650
18663
  /**
18651
- * Filter by meter type (e.g. `llm_tokens`, `compute_execution`, `api_request`, `storage`)
18664
+ * Filter by the tool a `tool_execution` event metered. A tool that does not exist in scope yields an empty page.
18665
+ *
18666
+ */
18667
+ tool_id?: string;
18668
+ /**
18669
+ * Filter by how a `tool_execution` call ended: `ok`, `error` or `timeout`. Every other meter carries no outcome and is matched by none of them.
18670
+ *
18671
+ */
18672
+ outcome?: string;
18673
+ /**
18674
+ * Filter by meter type (e.g. `llm_tokens`, `compute_execution`, `api_request`, `storage`, `tool_execution`)
18652
18675
  *
18653
18676
  */
18654
18677
  meter_type?: string;
18655
18678
  /**
18656
- * Filter by what the spend was incurred for. `eval` is an eval run's item generations and `eval_judge` an `llm_judge` scorer's own completion, so verification spend is `source` in (`eval`, `eval_judge`); `embedding` is any embedding call. Ordinary agent traffic carries no source and is matched by none of them.
18679
+ * Filter by what the spend was incurred for. `eval` is an eval run's item generations, `eval_judge` an `llm_judge` scorer's own completion and `eval_scorer` a `tool` scorer's call, so verification spend is `source` in (`eval`, `eval_judge`, `eval_scorer`); `embedding` is any embedding call. Ordinary agent traffic carries no source and is matched by none of them.
18657
18680
  *
18658
18681
  */
18659
18682
  source?: string;
@@ -18718,7 +18741,7 @@ type GetUsageAggregateData = {
18718
18741
  */
18719
18742
  to?: Date;
18720
18743
  /**
18721
- * Narrow the rollup to one meter type (e.g. `llm_tokens`, `compute_execution`, `api_request`, `storage`). Omit to include every meter. An unknown type yields an empty rollup, not an error.
18744
+ * Narrow the rollup to one meter type (e.g. `llm_tokens`, `compute_execution`, `api_request`, `storage`, `tool_execution`). Omit to include every meter. An unknown type yields an empty rollup, not an error.
18722
18745
  *
18723
18746
  */
18724
18747
  meter_type?: string;
@@ -18780,6 +18803,16 @@ type GetUsageAggregateData = {
18780
18803
  *
18781
18804
  */
18782
18805
  action_id?: string;
18806
+ /**
18807
+ * Narrow to the executions of one tool. An id naming no tool in this project yields an empty rollup.
18808
+ *
18809
+ */
18810
+ tool_id?: string;
18811
+ /**
18812
+ * Narrow `tool_execution` events by how the call ended — `ok`, `error` or `timeout` — matched as recorded. `outcome=error` is a tool's failures without a second meter.
18813
+ *
18814
+ */
18815
+ outcome?: string;
18783
18816
  /**
18784
18817
  * Maximum number of `groups` entries to return. Clamped to 100. Does not affect `totals` or `groups.total`, which describe the whole window.
18785
18818
  *
@@ -20934,7 +20967,7 @@ export declare class Guardrails {
20934
20967
  /**
20935
20968
  * Dry-run evaluate a guardrail
20936
20969
  *
20937
- * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `runtime.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `runtime.tool.*`.
20970
+ * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `runtime.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `runtime.tools.*`.
20938
20971
  *
20939
20972
  */
20940
20973
  static evaluateGuardrail<ThrowOnError extends boolean = false>(options: Options<EvaluateGuardrailData, ThrowOnError>): RequestResult<EvaluateGuardrailResponses, EvaluateGuardrailErrors, ThrowOnError>;
@@ -21775,7 +21808,7 @@ export declare class Usage {
21775
21808
  /**
21776
21809
  * List usage events
21777
21810
  *
21778
- * Returns the raw usage events the caller can access, most recent first, narrowed by any combination of the same filters the aggregate takes — agent, generation, trace, actor, session, AI provider, orchestration run, orchestration, trigger, action, meter type, model or `source` — so a rollup and the events behind it are addressed the same way. Each event is the per-generation token usage as reported by the provider, for audit and reconciliation.
21811
+ * Returns the raw usage events the caller can access, most recent first, narrowed by any combination of the same filters the aggregate takes — agent, generation, trace, actor, session, AI provider, orchestration run, orchestration, tool, trigger, action, outcome, meter type, model or `source` — so a rollup and the events behind it are addressed the same way. Each event is the per-generation token usage as reported by the provider, for audit and reconciliation.
21779
21812
  *
21780
21813
  * An id naming nothing in scope yields an empty page rather than dropping the filter, so a mistyped narrowing can never widen the list past what was asked for.
21781
21814
  *
@@ -21784,9 +21817,9 @@ export declare class Usage {
21784
21817
  /**
21785
21818
  * Get aggregated usage for a project
21786
21819
  *
21787
- * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of thirteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, meter type, model, source, trigger and action. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
21820
+ * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of fifteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, tool, meter type, model, source, trigger, action and outcome. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
21788
21821
  *
21789
- * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all thirteen are echoed back under `filters`. The eight naming a resource are resolved against the project, and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other five are matched against the value the event recorded.
21822
+ * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all fifteen are echoed back under `filters`. The nine naming a resource are resolved against the project, and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other six are matched against the value the event recorded.
21790
21823
  *
21791
21824
  * `groups` is paginated. Its `total` is the number of distinct buckets in the window — bucket cardinality, including a null bucket for the events the dimension does not apply to, and never a count of entities. To count entities, send `include=distinct` and read `totals.distinct`. `totals` always describes the whole window — never the page above it, and never the bucketing: omit `group_by` and `totals` is unchanged while `groups` is empty.
21792
21825
  *
package/dist/index.d.mts CHANGED
@@ -3466,7 +3466,7 @@ type QuotaResourceProperties = {
3466
3466
  /**
3467
3467
  * Only for metric cost_usd. The meter this cap answers for; omit it and the cap sums every priced meter. See the quotas REST contract.
3468
3468
  */
3469
- meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage';
3469
+ meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage' | 'tool_execution';
3470
3470
  };
3471
3471
  /**
3472
3472
  * Creates a guardrail — an action-class document (`class`/`guard`) that gates tool-call autonomy. Attach it to a tool or agent via that resource's `guardrail_ids` (a `{ "ref": … }` to this resource in the same template resolves to its physical id at deploy time). Mirrors the guardrails REST contract; `class`/`default_class`/`guard`/`escalate` are flattened here from the REST API's single `document` object.
@@ -5616,7 +5616,7 @@ type Quota = {
5616
5616
  /**
5617
5617
  * The meter a cost_usd cap answers for. Null is every priced meter, which is what a quota created without one carries.
5618
5618
  */
5619
- meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage' | null;
5619
+ meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage' | 'tool_execution' | null;
5620
5620
  /**
5621
5621
  * Pricing posture of a cost_usd quota over an unpriced blackout — block refuses generations, allow lets them through (the quota_unpriced exception is filed either way, and for a partly priced window, which no posture refuses). Null for metrics with no pricing dependency.
5622
5622
  */
@@ -6764,12 +6764,22 @@ type UsageEvent = {
6764
6764
  */
6765
6765
  action_id?: string | null;
6766
6766
  /**
6767
- * What the event measures: `llm_tokens`, `compute_execution`, `api_request`, or `storage`.
6767
+ * Public ID of the tool a `tool_execution` event metered. Null on every other meter, for an inline tool definition, and once the tool is deleted.
6768
+ *
6769
+ */
6770
+ tool_id?: string | null;
6771
+ /**
6772
+ * How a `tool_execution` call that went out ended, whatever the target answered: `ok`, `error` (including a non-2xx answer), or `timeout`. Null on every other meter.
6773
+ *
6774
+ */
6775
+ outcome?: string | null;
6776
+ /**
6777
+ * What the event measures: `llm_tokens`, `compute_execution`, `api_request`, `storage`, or `tool_execution` — one outbound tool call, a single `tool_call` component of quantity 1, unpriced.
6768
6778
  *
6769
6779
  */
6770
6780
  meter_type?: string;
6771
6781
  /**
6772
- * What the spend was incurred for. `eval` is an eval run's item generations and `eval_judge` an `llm_judge` scorer's own completion, so verification spend is `source` in (`eval`, `eval_judge`) and the two are distinct so running a suite can be priced apart from grading it. `embedding` is any embedding call — the endpoint, document ingestion, a memory store write, or a search's query vector. Null for ordinary agent traffic.
6782
+ * What the spend was incurred for. `eval` is an eval run's item generations and `eval_judge` an `llm_judge` scorer's own completion, and `eval_scorer` a `tool` scorer's call, so verification spend is `source` in (`eval`, `eval_judge`, `eval_scorer`) and they are distinct so running a suite can be priced apart from grading it. `embedding` is any embedding call — the endpoint, document ingestion, a memory store write, or a search's query vector. Null for ordinary agent traffic.
6773
6783
  *
6774
6784
  */
6775
6785
  source?: string | null;
@@ -6791,10 +6801,10 @@ type UsageEvent = {
6791
6801
  created_at?: Date;
6792
6802
  };
6793
6803
  /**
6794
- * The dimension an aggregate buckets on. `orchestration_run` buckets on the orchestration run; work that runs no orchestration collapses into the single `null` bucket.
6804
+ * The dimension an aggregate buckets on. `orchestration_run` buckets on the orchestration run; work that runs no orchestration collapses into the single `null` bucket. `tool` buckets `tool_execution` events on the tool they metered; every other meter is the `null` bucket.
6795
6805
  *
6796
6806
  */
6797
- type UsageGroupBy = 'model' | 'ai_provider' | 'agent' | 'orchestration_run' | 'day' | 'meter_type' | 'actor' | 'session' | 'source';
6807
+ type UsageGroupBy = 'model' | 'ai_provider' | 'agent' | 'orchestration_run' | 'day' | 'meter_type' | 'actor' | 'session' | 'source' | 'tool';
6798
6808
  /**
6799
6809
  * How many distinct entities of each kind the window touched — the counters a "how many generations / runs / actors this cycle" question reads. Present on `totals` exactly when `include=distinct` was sent, and never on a group — filling it per bucket would mean a `COUNT(DISTINCT)` per bucket on the page query.
6800
6810
  *
@@ -6811,6 +6821,7 @@ type UsageDistinct = {
6811
6821
  actors?: number;
6812
6822
  sessions?: number;
6813
6823
  ai_providers?: number;
6824
+ tools?: number;
6814
6825
  };
6815
6826
  /**
6816
6827
  * One measured dimension of a bucket, summed across its events. This is what makes the rollup uniform over meter types: the token fields only describe `llm_tokens`, so an infra meter's amount is read here.
@@ -6854,7 +6865,7 @@ type UsageAggregateTotals = UsageAggregateBucket & {
6854
6865
  distinct?: UsageDistinct;
6855
6866
  };
6856
6867
  /**
6857
- * Every narrowing the rollup applied, echoed back exactly as the caller sent it and null when unset. Echoed because a rollup of zeros is otherwise indistinguishable from a project that spent nothing, and always complete so a caller reading one key can tell "not filtered" from "this endpoint does not know that filter". The eight naming a resource are resolved against the project and empty the rollup when they name nothing in it; the other five are matched against the value the event recorded.
6868
+ * Every narrowing the rollup applied, echoed back exactly as the caller sent it and null when unset. Echoed because a rollup of zeros is otherwise indistinguishable from a project that spent nothing, and always complete so a caller reading one key can tell "not filtered" from "this endpoint does not know that filter". The nine naming a resource are resolved against the project and empty the rollup when they name nothing in it; the other six are matched against the value the event recorded.
6858
6869
  *
6859
6870
  */
6860
6871
  type UsageAggregateFilters = {
@@ -6871,6 +6882,8 @@ type UsageAggregateFilters = {
6871
6882
  orchestration_id?: string | null;
6872
6883
  generation_id?: string | null;
6873
6884
  trace_id?: string | null;
6885
+ tool_id?: string | null;
6886
+ outcome?: string | null;
6874
6887
  };
6875
6888
  type UsageAggregate = {
6876
6889
  project_id?: string;
@@ -6906,7 +6919,7 @@ type UsageAggregate = {
6906
6919
  };
6907
6920
  type UsageAggregateGroup = {
6908
6921
  /**
6909
- * The bucket's value in the chosen dimension (a model id, meter type, AI provider / agent / orchestration 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, and under `orchestration_run` the one holding every generation that ran no orchestration.
6922
+ * The bucket's value in the chosen dimension (a model id, meter type, AI provider / agent / orchestration run / actor / session / tool 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, and under `orchestration_run` the one holding every generation that ran no orchestration.
6910
6923
  *
6911
6924
  */
6912
6925
  key?: string | null;
@@ -13557,7 +13570,7 @@ type EvaluateGuardrailData = {
13557
13570
  [key: string]: unknown;
13558
13571
  };
13559
13572
  /**
13560
- * Optional tool to resolve `runtime.tool.*` against.
13573
+ * Optional tool to resolve `runtime.tools.*` against.
13561
13574
  */
13562
13575
  tool_id?: string;
13563
13576
  };
@@ -16744,7 +16757,7 @@ type CreateQuotaData = {
16744
16757
  /**
16745
16758
  * Only for metric cost_usd (400 on any other metric). The meter this cap answers for. Omit it and the cap sums every priced meter, which is the existing behaviour; name one and only that meter's cost counts, so an AI spend cap is not consumed by platform meters the operator prices (and vice versa). Part of the quota's identity, so two meter scopes can share a scope/metric/window and neither conflicts with an unscoped cap. Immutable after creation — replace the quota to change it.
16746
16759
  */
16747
- meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage';
16760
+ meter_type?: 'llm_tokens' | 'compute_execution' | 'api_request' | 'storage' | 'tool_execution';
16748
16761
  };
16749
16762
  path?: never;
16750
16763
  query?: never;
@@ -18648,12 +18661,22 @@ type ListUsageEventsData = {
18648
18661
  */
18649
18662
  action_id?: string;
18650
18663
  /**
18651
- * Filter by meter type (e.g. `llm_tokens`, `compute_execution`, `api_request`, `storage`)
18664
+ * Filter by the tool a `tool_execution` event metered. A tool that does not exist in scope yields an empty page.
18665
+ *
18666
+ */
18667
+ tool_id?: string;
18668
+ /**
18669
+ * Filter by how a `tool_execution` call ended: `ok`, `error` or `timeout`. Every other meter carries no outcome and is matched by none of them.
18670
+ *
18671
+ */
18672
+ outcome?: string;
18673
+ /**
18674
+ * Filter by meter type (e.g. `llm_tokens`, `compute_execution`, `api_request`, `storage`, `tool_execution`)
18652
18675
  *
18653
18676
  */
18654
18677
  meter_type?: string;
18655
18678
  /**
18656
- * Filter by what the spend was incurred for. `eval` is an eval run's item generations and `eval_judge` an `llm_judge` scorer's own completion, so verification spend is `source` in (`eval`, `eval_judge`); `embedding` is any embedding call. Ordinary agent traffic carries no source and is matched by none of them.
18679
+ * Filter by what the spend was incurred for. `eval` is an eval run's item generations, `eval_judge` an `llm_judge` scorer's own completion and `eval_scorer` a `tool` scorer's call, so verification spend is `source` in (`eval`, `eval_judge`, `eval_scorer`); `embedding` is any embedding call. Ordinary agent traffic carries no source and is matched by none of them.
18657
18680
  *
18658
18681
  */
18659
18682
  source?: string;
@@ -18718,7 +18741,7 @@ type GetUsageAggregateData = {
18718
18741
  */
18719
18742
  to?: Date;
18720
18743
  /**
18721
- * Narrow the rollup to one meter type (e.g. `llm_tokens`, `compute_execution`, `api_request`, `storage`). Omit to include every meter. An unknown type yields an empty rollup, not an error.
18744
+ * Narrow the rollup to one meter type (e.g. `llm_tokens`, `compute_execution`, `api_request`, `storage`, `tool_execution`). Omit to include every meter. An unknown type yields an empty rollup, not an error.
18722
18745
  *
18723
18746
  */
18724
18747
  meter_type?: string;
@@ -18780,6 +18803,16 @@ type GetUsageAggregateData = {
18780
18803
  *
18781
18804
  */
18782
18805
  action_id?: string;
18806
+ /**
18807
+ * Narrow to the executions of one tool. An id naming no tool in this project yields an empty rollup.
18808
+ *
18809
+ */
18810
+ tool_id?: string;
18811
+ /**
18812
+ * Narrow `tool_execution` events by how the call ended — `ok`, `error` or `timeout` — matched as recorded. `outcome=error` is a tool's failures without a second meter.
18813
+ *
18814
+ */
18815
+ outcome?: string;
18783
18816
  /**
18784
18817
  * Maximum number of `groups` entries to return. Clamped to 100. Does not affect `totals` or `groups.total`, which describe the whole window.
18785
18818
  *
@@ -20934,7 +20967,7 @@ export declare class Guardrails {
20934
20967
  /**
20935
20968
  * Dry-run evaluate a guardrail
20936
20969
  *
20937
- * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `runtime.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `runtime.tool.*`.
20970
+ * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `runtime.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `runtime.tools.*`.
20938
20971
  *
20939
20972
  */
20940
20973
  static evaluateGuardrail<ThrowOnError extends boolean = false>(options: Options<EvaluateGuardrailData, ThrowOnError>): RequestResult<EvaluateGuardrailResponses, EvaluateGuardrailErrors, ThrowOnError>;
@@ -21775,7 +21808,7 @@ export declare class Usage {
21775
21808
  /**
21776
21809
  * List usage events
21777
21810
  *
21778
- * Returns the raw usage events the caller can access, most recent first, narrowed by any combination of the same filters the aggregate takes — agent, generation, trace, actor, session, AI provider, orchestration run, orchestration, trigger, action, meter type, model or `source` — so a rollup and the events behind it are addressed the same way. Each event is the per-generation token usage as reported by the provider, for audit and reconciliation.
21811
+ * Returns the raw usage events the caller can access, most recent first, narrowed by any combination of the same filters the aggregate takes — agent, generation, trace, actor, session, AI provider, orchestration run, orchestration, tool, trigger, action, outcome, meter type, model or `source` — so a rollup and the events behind it are addressed the same way. Each event is the per-generation token usage as reported by the provider, for audit and reconciliation.
21779
21812
  *
21780
21813
  * An id naming nothing in scope yields an empty page rather than dropping the filter, so a mistyped narrowing can never widen the list past what was asked for.
21781
21814
  *
@@ -21784,9 +21817,9 @@ export declare class Usage {
21784
21817
  /**
21785
21818
  * Get aggregated usage for a project
21786
21819
  *
21787
- * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of thirteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, meter type, model, source, trigger and action. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
21820
+ * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of fifteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, tool, meter type, model, source, trigger, action and outcome. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
21788
21821
  *
21789
- * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all thirteen are echoed back under `filters`. The eight naming a resource are resolved against the project, and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other five are matched against the value the event recorded.
21822
+ * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all fifteen are echoed back under `filters`. The nine naming a resource are resolved against the project, and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other six are matched against the value the event recorded.
21790
21823
  *
21791
21824
  * `groups` is paginated. Its `total` is the number of distinct buckets in the window — bucket cardinality, including a null bucket for the events the dimension does not apply to, and never a count of entities. To count entities, send `include=distinct` and read `totals.distinct`. `totals` always describes the whole window — never the page above it, and never the bucketing: omit `group_by` and `totals` is unchanged while `groups` is empty.
21792
21825
  *
package/dist/index.mjs CHANGED
@@ -2668,7 +2668,7 @@ var Guardrails = class {
2668
2668
  /**
2669
2669
  * Dry-run evaluate a guardrail
2670
2670
  *
2671
- * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `runtime.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `runtime.tool.*`.
2671
+ * Runs the full evaluation pipeline — the `class` expression, the guard, the context tool per `context_mode`, live `runtime.*` resolution — against caller-supplied `args` and `guardrail_context`, and returns the exact `guardrail_evaluation` record a real call would produce. Nothing executes, no approval item is filed, and no activity entry is written. This is the adoption path: preview a document's decisions against production-shaped calls before attaching it — or before editing a widely-attached one. Pass an optional `tool_id` to resolve `runtime.tools.*`.
2672
2672
  *
2673
2673
  */
2674
2674
  static evaluateGuardrail(options) {
@@ -4353,7 +4353,7 @@ var Usage = class {
4353
4353
  /**
4354
4354
  * List usage events
4355
4355
  *
4356
- * Returns the raw usage events the caller can access, most recent first, narrowed by any combination of the same filters the aggregate takes — agent, generation, trace, actor, session, AI provider, orchestration run, orchestration, trigger, action, meter type, model or `source` — so a rollup and the events behind it are addressed the same way. Each event is the per-generation token usage as reported by the provider, for audit and reconciliation.
4356
+ * Returns the raw usage events the caller can access, most recent first, narrowed by any combination of the same filters the aggregate takes — agent, generation, trace, actor, session, AI provider, orchestration run, orchestration, tool, trigger, action, outcome, meter type, model or `source` — so a rollup and the events behind it are addressed the same way. Each event is the per-generation token usage as reported by the provider, for audit and reconciliation.
4357
4357
  *
4358
4358
  * An id naming nothing in scope yields an empty page rather than dropping the filter, so a mistyped narrowing can never widen the list past what was asked for.
4359
4359
  *
@@ -4367,9 +4367,9 @@ var Usage = class {
4367
4367
  /**
4368
4368
  * Get aggregated usage for a project
4369
4369
  *
4370
- * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of thirteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, meter type, model, source, trigger and action. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
4370
+ * Returns a project's usage rolled up over an optional `[from, to]` time window, optionally bucketed by a single dimension and narrowed by any combination of fifteen filters — session, actor, agent, AI provider, orchestration run, orchestration, generation, trace, tool, meter type, model, source, trigger, action and outcome. That is how "what did this conversation cost", "what has this end user cost" and "what did this agent cost" are answered. Each group and the grand total carry an `event_count`, summed token counts, a measured `quantity` per component (so infra meters report their real amount, not zeros), and `cost_usd` (null when no event in the bucket was priced). This is the per-project cost-by-range/by-category query — a monthly figure without scanning raw usage events client-side.
4371
4371
  *
4372
- * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all thirteen are echoed back under `filters`. The eight naming a resource are resolved against the project, and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other five are matched against the value the event recorded.
4372
+ * Narrowings intersect and apply to the whole rollup — every bucket, `totals` and `totals.distinct` alike — so each composes with any `group_by`, and all fifteen are echoed back under `filters`. The nine naming a resource are resolved against the project, and one naming nothing there empties the rollup rather than being dropped: a mistyped id must never read back as the project's whole spend. The other six are matched against the value the event recorded.
4373
4373
  *
4374
4374
  * `groups` is paginated. Its `total` is the number of distinct buckets in the window — bucket cardinality, including a null bucket for the events the dimension does not apply to, and never a count of entities. To count entities, send `include=distinct` and read `totals.distinct`. `totals` always describes the whole window — never the page above it, and never the bucketing: omit `group_by` and `totals` is unchanged while `groups` is empty.
4375
4375
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soat/sdk",
3
- "version": "0.60.0",
3
+ "version": "0.61.0",
4
4
  "description": "TypeScript SDK for SOAT — open-source infrastructure for production-ready AI agents.",
5
5
  "keywords": [
6
6
  "ai-agents",