@cubos/agent-sdk 0.0.1151293 → 0.0.1152175

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.
@@ -793,6 +793,89 @@ export interface paths {
793
793
  patch?: never;
794
794
  trace?: never;
795
795
  };
796
+ "/api/v1/cost-metrics": {
797
+ parameters: {
798
+ query?: never;
799
+ header?: never;
800
+ path?: never;
801
+ cookie?: never;
802
+ };
803
+ /**
804
+ * Spend over time, whole instance
805
+ * @description Aggregates the spend of every tenant from the hourly cost rollup: totals, one row per group, a time series of the ten most expensive groups (plus one series summing the rest), and the values each filter can take given the others. Root only.
806
+ */
807
+ get: {
808
+ parameters: {
809
+ query?: {
810
+ /** @description Comma-separated agent ids; `__none__` selects spend with no agent. */
811
+ agent?: string;
812
+ /** @description Start of the interval (RFC 3339), inclusive. Default: 30 days before `to`. */
813
+ from?: string;
814
+ /** @description `hour`, `day` (default), `week` or `month`. */
815
+ granularity?: string;
816
+ /**
817
+ * @description Comma-separated dimensions to group by: `tenant`, `user`, `agent`,
818
+ * `provider`, `model`, `kind`. Empty: one group, the total.
819
+ */
820
+ group_by?: string;
821
+ /** @description Comma-separated event types (`llm_call`, `media_transcription`, …). */
822
+ kind?: string;
823
+ /** @description Comma-separated model ids; `__none__` selects spend with no model. */
824
+ model?: string;
825
+ /** @description Comma-separated provider ids; `__none__` selects spend with no provider. */
826
+ provider?: string;
827
+ /** @description Comma-separated tenant ids. Whole-instance route only. */
828
+ tenant?: string;
829
+ /** @description IANA zone the buckets are cut in. Default `UTC`. */
830
+ timezone?: string;
831
+ /** @description End of the interval (RFC 3339), exclusive. Default: now. */
832
+ to?: string;
833
+ /** @description Comma-separated user ids; `__none__` selects spend with no user. */
834
+ user?: string;
835
+ };
836
+ header?: never;
837
+ path?: never;
838
+ cookie?: never;
839
+ };
840
+ requestBody?: never;
841
+ responses: {
842
+ 200: {
843
+ headers: {
844
+ [name: string]: unknown;
845
+ };
846
+ content: {
847
+ "application/json": components["schemas"]["CostMetrics"];
848
+ };
849
+ };
850
+ /** @description Invalid parameter, or a series of more than 2000 buckets. */
851
+ 400: {
852
+ headers: {
853
+ [name: string]: unknown;
854
+ };
855
+ content?: never;
856
+ };
857
+ 401: {
858
+ headers: {
859
+ [name: string]: unknown;
860
+ };
861
+ content?: never;
862
+ };
863
+ 403: {
864
+ headers: {
865
+ [name: string]: unknown;
866
+ };
867
+ content?: never;
868
+ };
869
+ };
870
+ };
871
+ put?: never;
872
+ post?: never;
873
+ delete?: never;
874
+ options?: never;
875
+ head?: never;
876
+ patch?: never;
877
+ trace?: never;
878
+ };
796
879
  "/api/v1/health": {
797
880
  parameters: {
798
881
  query?: never;
@@ -3338,6 +3421,68 @@ export interface paths {
3338
3421
  patch?: never;
3339
3422
  trace?: never;
3340
3423
  };
3424
+ "/api/v1/tenants/{tenantSlug}/channel-outbox": {
3425
+ parameters: {
3426
+ query?: never;
3427
+ header?: never;
3428
+ path?: never;
3429
+ cookie?: never;
3430
+ };
3431
+ /**
3432
+ * Channel outbox report
3433
+ * @description One summary per channel of what it has not sent: pending messages (how many, since when, how many are retrying), whether anything is trying to send them (`delivery` — `delivering`, or why not: `disabled`, `runner_disconnected`, `not_paired`, `no_worker`), and what the channel gave up on in the last `days` days with the most recent error. A channel retries a transient failure until the message is `retry_window_seconds` old; a channel that is not delivering makes no attempts, so its queue only waits.
3434
+ */
3435
+ get: {
3436
+ parameters: {
3437
+ query?: {
3438
+ /** @description How many days of given-up messages to count; clamped to 1..=90, default 7. */
3439
+ days?: number;
3440
+ };
3441
+ header?: never;
3442
+ path: {
3443
+ /** @description Slug of the tenant that owns the channels. */
3444
+ tenantSlug: string;
3445
+ };
3446
+ cookie?: never;
3447
+ };
3448
+ requestBody?: never;
3449
+ responses: {
3450
+ 200: {
3451
+ headers: {
3452
+ [name: string]: unknown;
3453
+ };
3454
+ content: {
3455
+ "application/json": components["schemas"]["ChannelOutboxReport"];
3456
+ };
3457
+ };
3458
+ 401: {
3459
+ headers: {
3460
+ [name: string]: unknown;
3461
+ };
3462
+ content?: never;
3463
+ };
3464
+ 403: {
3465
+ headers: {
3466
+ [name: string]: unknown;
3467
+ };
3468
+ content?: never;
3469
+ };
3470
+ 404: {
3471
+ headers: {
3472
+ [name: string]: unknown;
3473
+ };
3474
+ content?: never;
3475
+ };
3476
+ };
3477
+ };
3478
+ put?: never;
3479
+ post?: never;
3480
+ delete?: never;
3481
+ options?: never;
3482
+ head?: never;
3483
+ patch?: never;
3484
+ trace?: never;
3485
+ };
3341
3486
  "/api/v1/tenants/{tenantSlug}/channels": {
3342
3487
  parameters: {
3343
3488
  query?: never;
@@ -3816,6 +3961,83 @@ export interface paths {
3816
3961
  patch?: never;
3817
3962
  trace?: never;
3818
3963
  };
3964
+ "/api/v1/tenants/{tenantSlug}/channels/{slug}/outbox": {
3965
+ parameters: {
3966
+ query?: never;
3967
+ header?: never;
3968
+ path?: never;
3969
+ cookie?: never;
3970
+ };
3971
+ /**
3972
+ * List a channel's unsent messages
3973
+ * @description The channel's outbox summary (as in `GET /channel-outbox`) plus a page of the messages it has not sent, newest first: still pending, or given up on in the last `days` days. Each carries its conversation, a preview of the text (or the file's name, type and size), the attempts so far, the last error, and when the next attempt is due or when the channel gave up.
3974
+ */
3975
+ get: {
3976
+ parameters: {
3977
+ query?: {
3978
+ /** @description Cursor `<rfc3339>|<uuid>` from a previous page's `next_before`; omit for the first page. */
3979
+ before?: string;
3980
+ /** @description How many days of given-up messages to include; clamped to 1..=90, default 7. */
3981
+ days?: number;
3982
+ /** @description Page size; clamped to 1..=200, default 50. */
3983
+ limit?: number;
3984
+ /** @description `pending`, `failed` or `all` (default). Anything else is 400. */
3985
+ status?: string;
3986
+ };
3987
+ header?: never;
3988
+ path: {
3989
+ /** @description Slug of the channel, unique within the tenant. */
3990
+ slug: string;
3991
+ /** @description Slug of the tenant that owns the channel. */
3992
+ tenantSlug: string;
3993
+ };
3994
+ cookie?: never;
3995
+ };
3996
+ requestBody?: never;
3997
+ responses: {
3998
+ 200: {
3999
+ headers: {
4000
+ [name: string]: unknown;
4001
+ };
4002
+ content: {
4003
+ "application/json": components["schemas"]["ChannelOutbox"];
4004
+ };
4005
+ };
4006
+ /** @description Unknown `status` or malformed `before`. */
4007
+ 400: {
4008
+ headers: {
4009
+ [name: string]: unknown;
4010
+ };
4011
+ content?: never;
4012
+ };
4013
+ 401: {
4014
+ headers: {
4015
+ [name: string]: unknown;
4016
+ };
4017
+ content?: never;
4018
+ };
4019
+ 403: {
4020
+ headers: {
4021
+ [name: string]: unknown;
4022
+ };
4023
+ content?: never;
4024
+ };
4025
+ 404: {
4026
+ headers: {
4027
+ [name: string]: unknown;
4028
+ };
4029
+ content?: never;
4030
+ };
4031
+ };
4032
+ };
4033
+ put?: never;
4034
+ post?: never;
4035
+ delete?: never;
4036
+ options?: never;
4037
+ head?: never;
4038
+ patch?: never;
4039
+ trace?: never;
4040
+ };
3819
4041
  "/api/v1/tenants/{tenantSlug}/channels/{slug}/rotate-secret": {
3820
4042
  parameters: {
3821
4043
  query?: never;
@@ -7201,6 +7423,98 @@ export interface paths {
7201
7423
  patch?: never;
7202
7424
  trace?: never;
7203
7425
  };
7426
+ "/api/v1/tenants/{tenantSlug}/cost-metrics": {
7427
+ parameters: {
7428
+ query?: never;
7429
+ header?: never;
7430
+ path?: never;
7431
+ cookie?: never;
7432
+ };
7433
+ /**
7434
+ * Spend over time, one tenant
7435
+ * @description The tenant's spend from the hourly cost rollup, in the same shape as `GET /cost-metrics`. Needs `conversations:read`, which already exposes the cost of every event.
7436
+ */
7437
+ get: {
7438
+ parameters: {
7439
+ query?: {
7440
+ /** @description Comma-separated agent ids; `__none__` selects spend with no agent. */
7441
+ agent?: string;
7442
+ /** @description Start of the interval (RFC 3339), inclusive. Default: 30 days before `to`. */
7443
+ from?: string;
7444
+ /** @description `hour`, `day` (default), `week` or `month`. */
7445
+ granularity?: string;
7446
+ /**
7447
+ * @description Comma-separated dimensions to group by: `tenant`, `user`, `agent`,
7448
+ * `provider`, `model`, `kind`. Empty: one group, the total.
7449
+ */
7450
+ group_by?: string;
7451
+ /** @description Comma-separated event types (`llm_call`, `media_transcription`, …). */
7452
+ kind?: string;
7453
+ /** @description Comma-separated model ids; `__none__` selects spend with no model. */
7454
+ model?: string;
7455
+ /** @description Comma-separated provider ids; `__none__` selects spend with no provider. */
7456
+ provider?: string;
7457
+ /** @description Comma-separated tenant ids. Whole-instance route only. */
7458
+ tenant?: string;
7459
+ /** @description IANA zone the buckets are cut in. Default `UTC`. */
7460
+ timezone?: string;
7461
+ /** @description End of the interval (RFC 3339), exclusive. Default: now. */
7462
+ to?: string;
7463
+ /** @description Comma-separated user ids; `__none__` selects spend with no user. */
7464
+ user?: string;
7465
+ };
7466
+ header?: never;
7467
+ path: {
7468
+ /** @description Tenant slug (kebab-case). */
7469
+ tenantSlug: string;
7470
+ };
7471
+ cookie?: never;
7472
+ };
7473
+ requestBody?: never;
7474
+ responses: {
7475
+ 200: {
7476
+ headers: {
7477
+ [name: string]: unknown;
7478
+ };
7479
+ content: {
7480
+ "application/json": components["schemas"]["CostMetrics"];
7481
+ };
7482
+ };
7483
+ /** @description Invalid parameter, or a series of more than 2000 buckets. */
7484
+ 400: {
7485
+ headers: {
7486
+ [name: string]: unknown;
7487
+ };
7488
+ content?: never;
7489
+ };
7490
+ 401: {
7491
+ headers: {
7492
+ [name: string]: unknown;
7493
+ };
7494
+ content?: never;
7495
+ };
7496
+ 403: {
7497
+ headers: {
7498
+ [name: string]: unknown;
7499
+ };
7500
+ content?: never;
7501
+ };
7502
+ 404: {
7503
+ headers: {
7504
+ [name: string]: unknown;
7505
+ };
7506
+ content?: never;
7507
+ };
7508
+ };
7509
+ };
7510
+ put?: never;
7511
+ post?: never;
7512
+ delete?: never;
7513
+ options?: never;
7514
+ head?: never;
7515
+ patch?: never;
7516
+ trace?: never;
7517
+ };
7204
7518
  "/api/v1/tenants/{tenantSlug}/knowledge-bases": {
7205
7519
  parameters: {
7206
7520
  query?: never;
@@ -11752,12 +12066,13 @@ export interface components {
11752
12066
  shared: boolean;
11753
12067
  slug: string;
11754
12068
  /**
11755
- * @description This provider type's token SKU ids → input/output/other. Lets the chat
11756
- * transcript split a call's `token_usage` into ↑ input / ↓ output by
11757
- * `provider_slug` without a per-model fetch. `Other` SKUs are omitted.
12069
+ * @description This provider type's token SKU ids → class. Lets the chat transcript
12070
+ * split a call's `token_usage` into prompt (cached or not) and completion
12071
+ * (reasoning or not) for a call recorded before calls carried their own
12072
+ * `tokens`. `Other` SKUs are omitted.
11758
12073
  */
11759
- token_sku_directions: {
11760
- [key: string]: components["schemas"]["SkuDirection"];
12074
+ token_sku_classes: {
12075
+ [key: string]: components["schemas"]["SkuClass"];
11761
12076
  };
11762
12077
  /** @description One of the types `GET /ai-provider-types` lists, as declared by `plugin`. */
11763
12078
  type: string;
@@ -11985,6 +12300,40 @@ export interface components {
11985
12300
  /** @enum {string} */
11986
12301
  type: "external";
11987
12302
  });
12303
+ ChannelOutbox: {
12304
+ /** Format: int32 */
12305
+ failed_window_days: number;
12306
+ /** @description Newest first. */
12307
+ items: components["schemas"]["OutboxItem"][];
12308
+ /** @description Cursor for the next page (`before`); `null` on the last one. */
12309
+ next_before: string | null;
12310
+ /** Format: int64 */
12311
+ retry_window_seconds: number;
12312
+ summary: components["schemas"]["ChannelOutboxSummary"];
12313
+ };
12314
+ ChannelOutboxReport: {
12315
+ /** @description One entry per channel of the tenant, ordered by slug. */
12316
+ channels: components["schemas"]["ChannelOutboxSummary"][];
12317
+ /**
12318
+ * Format: int32
12319
+ * @description The `days` the `failed` counts cover.
12320
+ */
12321
+ failed_window_days: number;
12322
+ /**
12323
+ * Format: int64
12324
+ * @description How long a channel keeps retrying a message that fails transiently,
12325
+ * counted from when the message was written. Past it, the next failure
12326
+ * gives up on the message.
12327
+ */
12328
+ retry_window_seconds: number;
12329
+ };
12330
+ ChannelOutboxSummary: {
12331
+ channel: components["schemas"]["ChannelRef"];
12332
+ delivery: components["schemas"]["OutboxDelivery"];
12333
+ failed: components["schemas"]["OutboxFailedSummary"];
12334
+ pending: components["schemas"]["OutboxPendingSummary"];
12335
+ type: components["schemas"]["ChannelType"];
12336
+ };
11988
12337
  /**
11989
12338
  * @description Reduced channel reference embedded into other resources' responses (e.g. a conversation's
11990
12339
  * originating channel) in place of a bare `channel_id`.
@@ -12280,7 +12629,10 @@ export interface components {
12280
12629
  * The dashboard surfaces it per-item in the event detail view.
12281
12630
  */
12282
12631
  cost_usd: number;
12283
- /** Format: date-time */
12632
+ /**
12633
+ * Format: date-time
12634
+ * @description When the row was written: when the core learned of the event.
12635
+ */
12284
12636
  created_at: string;
12285
12637
  /**
12286
12638
  * Format: date-time
@@ -12334,6 +12686,14 @@ export interface components {
12334
12686
  */
12335
12687
  read_at: string | null;
12336
12688
  result?: unknown;
12689
+ /**
12690
+ * Format: date-time
12691
+ * @description When the sender sent it, for a `user_message` that came through a
12692
+ * channel carrying a timestamp (WhatsApp). Usually the same minute as
12693
+ * `created_at`; hours earlier for a message recovered after a channel
12694
+ * outage. NULL when the channel carries none — show `created_at` then.
12695
+ */
12696
+ sent_at: string | null;
12337
12697
  /**
12338
12698
  * Format: int64
12339
12699
  * @description Per-conversation log order (1, 2, 3, …). Stable; not the SSE
@@ -12407,6 +12767,177 @@ export interface components {
12407
12767
  output_tokens: number | null;
12408
12768
  summary_text: string;
12409
12769
  };
12770
+ CostAgentLabel: {
12771
+ display_name: string;
12772
+ /** Format: uuid */
12773
+ id: string;
12774
+ slug: string;
12775
+ };
12776
+ /**
12777
+ * @description A dimension spend can be grouped or filtered by.
12778
+ * @enum {string}
12779
+ */
12780
+ CostDimension: "tenant" | "user" | "agent" | "provider" | "model" | "kind";
12781
+ CostFacets: {
12782
+ agent: components["schemas"]["CostFacetValue"][];
12783
+ kind: components["schemas"]["CostFacetValue"][];
12784
+ model: components["schemas"]["CostFacetValue"][];
12785
+ provider: components["schemas"]["CostFacetValue"][];
12786
+ tenant: components["schemas"]["CostFacetValue"][];
12787
+ user: components["schemas"]["CostFacetValue"][];
12788
+ };
12789
+ /** @description One value a filter can take, with the spend it would select. */
12790
+ CostFacetValue: {
12791
+ /** Format: double */
12792
+ cost_usd: number;
12793
+ /**
12794
+ * @description The value to filter on; absent for "none" (the rows where the
12795
+ * dimension is NULL), which is filtered on as `none`.
12796
+ */
12797
+ value: string | null;
12798
+ };
12799
+ /**
12800
+ * @description Time bucket of a series. The rollup is hourly in UTC; anything coarser is
12801
+ * cut in the request's time zone.
12802
+ * @enum {string}
12803
+ */
12804
+ CostGranularity: "hour" | "day" | "week" | "month";
12805
+ CostGroup: components["schemas"]["CostMeasures"] & {
12806
+ key: components["schemas"]["CostKey"];
12807
+ };
12808
+ /**
12809
+ * @description The value of every grouped dimension for one slice. A dimension outside
12810
+ * `group_by` is always absent; a grouped one is absent when the slice is the
12811
+ * rows where it is NULL.
12812
+ */
12813
+ CostKey: {
12814
+ /** Format: uuid */
12815
+ agent_id: string | null;
12816
+ kind: string | null;
12817
+ model: string | null;
12818
+ /** Format: uuid */
12819
+ provider_id: string | null;
12820
+ /** Format: uuid */
12821
+ tenant_id: string | null;
12822
+ /** Format: uuid */
12823
+ user_id: string | null;
12824
+ };
12825
+ /**
12826
+ * @description Names for every id the response mentions. An id with no entry here points
12827
+ * at a row that no longer exists — spend outlives what produced it.
12828
+ */
12829
+ CostLabels: {
12830
+ agents: components["schemas"]["CostAgentLabel"][];
12831
+ providers: components["schemas"]["CostProviderLabel"][];
12832
+ tenants: components["schemas"]["CostTenantLabel"][];
12833
+ users: components["schemas"]["CostUserLabel"][];
12834
+ };
12835
+ CostMeasures: {
12836
+ /**
12837
+ * Format: int64
12838
+ * @description The part of `input_tokens` written into the provider's cache.
12839
+ */
12840
+ cache_write_tokens: number;
12841
+ /**
12842
+ * Format: int64
12843
+ * @description The part of `input_tokens` served from the provider's cache.
12844
+ */
12845
+ cached_input_tokens: number;
12846
+ /**
12847
+ * Format: int64
12848
+ * @description Paid calls: one per event that carried a cost.
12849
+ */
12850
+ calls: number;
12851
+ /** Format: double */
12852
+ cost_usd: number;
12853
+ /**
12854
+ * Format: int64
12855
+ * @description The whole prompt: read at full rate, served from cache and written to
12856
+ * it.
12857
+ */
12858
+ input_tokens: number;
12859
+ /**
12860
+ * Format: int64
12861
+ * @description The whole completion, reasoning included.
12862
+ */
12863
+ output_tokens: number;
12864
+ /**
12865
+ * Format: int64
12866
+ * @description The part of `output_tokens` spent thinking.
12867
+ */
12868
+ reasoning_tokens: number;
12869
+ };
12870
+ CostMetrics: {
12871
+ /** Format: date-time */
12872
+ backfill_cutover: string | null;
12873
+ /**
12874
+ * @description While the history recorded before the rollup existed is still being
12875
+ * attributed, totals that reach back past `backfill_cutover` are low.
12876
+ */
12877
+ backfill_pending: boolean;
12878
+ /**
12879
+ * @description Start of every bucket in the interval, in order, empty ones included —
12880
+ * cut in the request's time zone, so a day is a local day across DST.
12881
+ */
12882
+ buckets: string[];
12883
+ facets: components["schemas"]["CostFacets"];
12884
+ /** Format: date-time */
12885
+ from: string;
12886
+ granularity: components["schemas"]["CostGranularity"];
12887
+ group_by: components["schemas"]["CostDimension"][];
12888
+ /** @description One row per group, most expensive first, capped at 1000. */
12889
+ groups: components["schemas"]["CostGroup"][];
12890
+ groups_truncated: boolean;
12891
+ labels: components["schemas"]["CostLabels"];
12892
+ /**
12893
+ * @description Per bucket and group, for the first eight groups by cost, plus one
12894
+ * "other" series (no `key`) summing the rest. Buckets with no spend are
12895
+ * omitted; `buckets` lists them all.
12896
+ */
12897
+ series: components["schemas"]["CostSeriesPoint"][];
12898
+ timezone: string;
12899
+ /** Format: date-time */
12900
+ to: string;
12901
+ /** @description Everything the filters select, over the whole interval. */
12902
+ totals: components["schemas"]["CostMeasures"];
12903
+ /**
12904
+ * Format: int64
12905
+ * @description Tokens of calls recorded before calls carried their own split, under a
12906
+ * SKU no provider plugin has ever declared a class for — counted in none
12907
+ * of the token measures.
12908
+ */
12909
+ unclassified_tokens: number;
12910
+ };
12911
+ CostProviderLabel: {
12912
+ /** Format: uuid */
12913
+ id: string;
12914
+ provider_type: string;
12915
+ slug: string;
12916
+ };
12917
+ CostSeriesPoint: components["schemas"]["CostMeasures"] & {
12918
+ /**
12919
+ * Format: date-time
12920
+ * @description Start of the bucket, cut in the request's time zone.
12921
+ */
12922
+ bucket: string;
12923
+ key?: components["schemas"]["CostKey"] | null;
12924
+ };
12925
+ CostTenantLabel: {
12926
+ display_name: string;
12927
+ /** Format: uuid */
12928
+ id: string;
12929
+ slug: string;
12930
+ };
12931
+ CostUserLabel: {
12932
+ display_name: string | null;
12933
+ /** Format: uuid */
12934
+ id: string;
12935
+ /**
12936
+ * @description The user's first channel identity (a phone, a handle) — display names
12937
+ * are neither unique nor always set.
12938
+ */
12939
+ primary_identifier: string | null;
12940
+ };
12410
12941
  CountTokensResponse: {
12411
12942
  breakdown: components["schemas"]["Breakdown"] | null;
12412
12943
  /**
@@ -13259,6 +13790,12 @@ export interface components {
13259
13790
  token_usage: {
13260
13791
  [key: string]: number;
13261
13792
  };
13793
+ /**
13794
+ * @description `token_usage` summed by class when the call returned. All zero on
13795
+ * snapshots written before classes existed; their `token_usage` is
13796
+ * still there to classify.
13797
+ */
13798
+ tokens?: components["schemas"]["TokenCounts"];
13262
13799
  };
13263
13800
  Mcp: {
13264
13801
  /** Format: date-time */
@@ -13512,6 +14049,109 @@ export interface components {
13512
14049
  NamedClientToolInput: components["schemas"]["ClientToolInput"] & {
13513
14050
  name: string;
13514
14051
  };
14052
+ /**
14053
+ * @description Whether anything is trying to send this channel's queue right now.
14054
+ * @enum {string}
14055
+ */
14056
+ OutboxDelivery: "delivering" | "disabled" | "runner_disconnected" | "not_paired" | "no_worker";
14057
+ OutboxFailedSummary: {
14058
+ /**
14059
+ * Format: int64
14060
+ * @description Messages the channel gave up on since `since`: refused outright by the
14061
+ * channel, or still failing past the retry window.
14062
+ */
14063
+ count: number;
14064
+ /** @description The error recorded on the most recent of them. */
14065
+ last_error: string | null;
14066
+ /**
14067
+ * Format: date-time
14068
+ * @description When the most recent of them was given up on.
14069
+ */
14070
+ last_failed_at: string | null;
14071
+ /**
14072
+ * Format: date-time
14073
+ * @description Start of the counted window (`days` before the request).
14074
+ */
14075
+ since: string;
14076
+ };
14077
+ OutboxFile: {
14078
+ filename: string;
14079
+ mime_type: string;
14080
+ /** Format: int64 */
14081
+ size_bytes: number;
14082
+ };
14083
+ OutboxItem: {
14084
+ /**
14085
+ * Format: int32
14086
+ * @description Attempts that failed so far.
14087
+ */
14088
+ attempts: number;
14089
+ /**
14090
+ * Format: uuid
14091
+ * @description Conversation the message belongs to; `null` for a proactive send.
14092
+ */
14093
+ conversation_id: string | null;
14094
+ /**
14095
+ * Format: date-time
14096
+ * @description When the message was written.
14097
+ */
14098
+ created_at: string;
14099
+ /**
14100
+ * Format: date-time
14101
+ * @description Failed only: when the channel gave up on it.
14102
+ */
14103
+ failed_at: string | null;
14104
+ file: components["schemas"]["OutboxFile"] | null;
14105
+ /**
14106
+ * Format: uuid
14107
+ * @description The event id (`conversation`) or the proactive send's id (`outbound`).
14108
+ */
14109
+ id: string;
14110
+ /** @description Error of the latest failed attempt. */
14111
+ last_error: string | null;
14112
+ /**
14113
+ * Format: date-time
14114
+ * @description Pending only: when the next attempt is due. `null` means as soon as the
14115
+ * channel gets to it.
14116
+ */
14117
+ next_attempt_at: string | null;
14118
+ /** @description First 200 characters of the text, or a file's caption. */
14119
+ preview: string | null;
14120
+ /** @description Channel-native recipient (chat id, phone, runner identifier). */
14121
+ recipient: string | null;
14122
+ source: components["schemas"]["OutboxItemSource"];
14123
+ status: components["schemas"]["OutboxItemStatus"];
14124
+ /** @description Display name of the user the message was for, when known. */
14125
+ user_display_name: string | null;
14126
+ };
14127
+ /** @enum {string} */
14128
+ OutboxItemSource: "conversation" | "outbound";
14129
+ /** @enum {string} */
14130
+ OutboxItemStatus: "pending" | "failed";
14131
+ OutboxPendingSummary: {
14132
+ /**
14133
+ * Format: int64
14134
+ * @description Messages waiting to be sent (conversation messages and files, plus
14135
+ * proactive sends such as the approval notice).
14136
+ */
14137
+ count: number;
14138
+ /**
14139
+ * Format: date-time
14140
+ * @description The soonest scheduled retry, if any is scheduled.
14141
+ */
14142
+ next_attempt_at: string | null;
14143
+ /**
14144
+ * Format: date-time
14145
+ * @description When the oldest of them was written. `null` when nothing is pending.
14146
+ */
14147
+ oldest_at: string | null;
14148
+ /**
14149
+ * Format: int64
14150
+ * @description How many of them already failed at least once and are waiting out a
14151
+ * backoff.
14152
+ */
14153
+ retrying: number;
14154
+ };
13515
14155
  /**
13516
14156
  * @description One citation note, already parsed.
13517
14157
  *
@@ -13851,24 +14491,19 @@ export interface components {
13851
14491
  slug: string;
13852
14492
  };
13853
14493
  /**
13854
- * @description Display metadata for one SKU. `scale` is the multiplier the UI applies
13855
- * when showing/editing the price — internal storage is always USD per
13856
- * raw unit (per token, per query), but operators read invoices in "per
13857
- * million tokens" or "per thousand queries". The dashboard multiplies
13858
- * `pricing[id] * scale` on display and divides the edited value back
13859
- * down before persisting. Returned in `Vec` form so providers can
13860
- * declare a stable display order independent of `HashMap` hashing.
13861
- * Which side of a call a SKU charges for. Lets the dashboard split a recorded
13862
- * `token_usage` map into input (↑) and output (↓) totals without hardcoding
13863
- * SKU ids. SKUs partition the tokens — `input` and `cached_input` are disjoint
13864
- * slices of the prompt — so summing all `Input` SKUs gives the true input
13865
- * count with no double-counting.
14494
+ * @description What kind of token a SKU counts, as the plugin serving its type declares
14495
+ * it. SKUs partition a call's tokens — `input` and `cached_input` are disjoint
14496
+ * slices of the prompt — so a class's total is the sum of its SKUs, with no
14497
+ * double counting.
13866
14498
  * @enum {string}
13867
14499
  */
13868
- SkuDirection: "input" | "output" | "other";
14500
+ SkuClass: "input" | "cached_input" | "cache_write" | "output" | "reasoning" | "other";
13869
14501
  SkuDisplayDto: {
13870
- /** @description Whether this SKU charges for input (↑), output (↓), or neither. */
13871
- direction: components["schemas"]["SkuDirection"];
14502
+ /**
14503
+ * @description What kind of token this SKU counts, or `other` for a charge that is not
14504
+ * a token.
14505
+ */
14506
+ class: components["schemas"]["SkuClass"];
13872
14507
  id: string;
13873
14508
  /**
13874
14509
  * @description Human-readable label including the implicit unit
@@ -14059,6 +14694,40 @@ export interface components {
14059
14694
  permissions: string[];
14060
14695
  slug: string;
14061
14696
  };
14697
+ /**
14698
+ * @description A call's tokens by class: its `token_usage`, summed per [`SkuClass`] by the
14699
+ * core when the call returns — the one moment the plugin that declared the
14700
+ * classes is certainly running, so a record never depends on that plugin
14701
+ * being up when someone reads it. The fields are disjoint: the prompt is
14702
+ * `input + cached_input + cache_write`, the completion `output + reasoning`.
14703
+ */
14704
+ TokenCounts: {
14705
+ /**
14706
+ * Format: int64
14707
+ * @default 0
14708
+ */
14709
+ cache_write: number;
14710
+ /**
14711
+ * Format: int64
14712
+ * @default 0
14713
+ */
14714
+ cached_input: number;
14715
+ /**
14716
+ * Format: int64
14717
+ * @default 0
14718
+ */
14719
+ input: number;
14720
+ /**
14721
+ * Format: int64
14722
+ * @default 0
14723
+ */
14724
+ output: number;
14725
+ /**
14726
+ * Format: int64
14727
+ * @default 0
14728
+ */
14729
+ reasoning: number;
14730
+ };
14062
14731
  /** @enum {string} */
14063
14732
  ToolChoice: "auto" | "required" | "none";
14064
14733
  /**