@cubos/agent-sdk 0.0.1152175 → 0.0.1152796

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,7 +793,7 @@ export interface paths {
793
793
  patch?: never;
794
794
  trace?: never;
795
795
  };
796
- "/api/v1/cost-metrics": {
796
+ "/api/v1/health": {
797
797
  parameters: {
798
798
  query?: never;
799
799
  header?: never;
@@ -801,59 +801,111 @@ export interface paths {
801
801
  cookie?: never;
802
802
  };
803
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.
804
+ * Health check
805
+ * @description Public, unauthenticated liveness probe reporting that the process is up, along with the running server version. Returns a static response without touching Postgres or any provider, so it is cheap to poll from load balancers.
806
806
  */
807
807
  get: {
808
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;
809
+ query?: never;
810
+ header?: never;
811
+ path?: never;
812
+ cookie?: never;
813
+ };
814
+ requestBody?: never;
815
+ responses: {
816
+ /** @description Server is alive. */
817
+ 200: {
818
+ headers: {
819
+ [name: string]: unknown;
820
+ };
821
+ content: {
822
+ "application/json": components["schemas"]["Health"];
823
+ };
835
824
  };
825
+ };
826
+ };
827
+ put?: never;
828
+ post?: never;
829
+ delete?: never;
830
+ options?: never;
831
+ head?: never;
832
+ patch?: never;
833
+ trace?: never;
834
+ };
835
+ "/api/v1/me": {
836
+ parameters: {
837
+ query?: never;
838
+ header?: never;
839
+ path?: never;
840
+ cookie?: never;
841
+ };
842
+ /**
843
+ * Whoami
844
+ * @description Returns the identity behind the bearer token: display name, key prefix (absent for the root caller), root flag, and the tenants the caller has a grant on, ordered by slug. Root resolves to every tenant; regular keys resolve to the union of their grants.
845
+ */
846
+ get: {
847
+ parameters: {
848
+ query?: never;
836
849
  header?: never;
837
850
  path?: never;
838
851
  cookie?: never;
839
852
  };
840
853
  requestBody?: never;
841
854
  responses: {
855
+ /** @description Resolved identity. */
842
856
  200: {
843
857
  headers: {
844
858
  [name: string]: unknown;
845
859
  };
846
860
  content: {
847
- "application/json": components["schemas"]["CostMetrics"];
861
+ "application/json": components["schemas"]["WhoAmI"];
848
862
  };
849
863
  };
850
- /** @description Invalid parameter, or a series of more than 2000 buckets. */
851
- 400: {
864
+ /** @description Missing or invalid credentials. */
865
+ 401: {
852
866
  headers: {
853
867
  [name: string]: unknown;
854
868
  };
855
869
  content?: never;
856
870
  };
871
+ };
872
+ };
873
+ put?: never;
874
+ post?: never;
875
+ delete?: never;
876
+ options?: never;
877
+ head?: never;
878
+ patch?: never;
879
+ trace?: never;
880
+ };
881
+ "/api/v1/metrics": {
882
+ parameters: {
883
+ query?: never;
884
+ header?: never;
885
+ path?: never;
886
+ cookie?: never;
887
+ };
888
+ /**
889
+ * Metric catalog, whole instance
890
+ * @description Every metric the instance keeps, with its unit, how it aggregates, the dimensions it can be grouped and filtered by, the finest granularity it is kept at, and whether its history is complete. Root only.
891
+ */
892
+ get: {
893
+ parameters: {
894
+ query?: never;
895
+ header?: never;
896
+ path?: never;
897
+ cookie?: never;
898
+ };
899
+ requestBody?: never;
900
+ responses: {
901
+ 200: {
902
+ headers: {
903
+ [name: string]: unknown;
904
+ };
905
+ content: {
906
+ "application/json": components["schemas"]["MetricsCatalog"];
907
+ };
908
+ };
857
909
  401: {
858
910
  headers: {
859
911
  [name: string]: unknown;
@@ -864,7 +916,9 @@ export interface paths {
864
916
  headers: {
865
917
  [name: string]: unknown;
866
918
  };
867
- content?: never;
919
+ content: {
920
+ "application/json": components["schemas"]["MetricsError"];
921
+ };
868
922
  };
869
923
  };
870
924
  };
@@ -876,85 +930,131 @@ export interface paths {
876
930
  patch?: never;
877
931
  trace?: never;
878
932
  };
879
- "/api/v1/health": {
933
+ "/api/v1/metrics/dimensions/{dimension}/values": {
880
934
  parameters: {
881
935
  query?: never;
882
936
  header?: never;
883
937
  path?: never;
884
938
  cookie?: never;
885
939
  };
940
+ get?: never;
941
+ put?: never;
886
942
  /**
887
- * Health check
888
- * @description Public, unauthenticated liveness probe reporting that the process is up, along with the running server version. Returns a static response without touching Postgres or any provider, so it is cheap to poll from load balancers.
943
+ * Values of a dimension, whole instance
944
+ * @description The values a dimension takes in a slice, ranked by a metric — what a filter can offer given the page's other filters (its own is ignored). Root only.
889
945
  */
890
- get: {
946
+ post: {
891
947
  parameters: {
892
948
  query?: never;
893
949
  header?: never;
894
- path?: never;
950
+ path: {
951
+ /** @description The dimension. */
952
+ dimension: components["schemas"]["Dimension"];
953
+ };
895
954
  cookie?: never;
896
955
  };
897
- requestBody?: never;
956
+ requestBody: {
957
+ content: {
958
+ "application/json": components["schemas"]["DimensionValuesQuery"];
959
+ };
960
+ };
898
961
  responses: {
899
- /** @description Server is alive. */
900
962
  200: {
901
963
  headers: {
902
964
  [name: string]: unknown;
903
965
  };
904
966
  content: {
905
- "application/json": components["schemas"]["Health"];
967
+ "application/json": components["schemas"]["DimensionValues"];
968
+ };
969
+ };
970
+ 400: {
971
+ headers: {
972
+ [name: string]: unknown;
973
+ };
974
+ content: {
975
+ "application/json": components["schemas"]["MetricsError"];
976
+ };
977
+ };
978
+ 401: {
979
+ headers: {
980
+ [name: string]: unknown;
981
+ };
982
+ content?: never;
983
+ };
984
+ 403: {
985
+ headers: {
986
+ [name: string]: unknown;
987
+ };
988
+ content: {
989
+ "application/json": components["schemas"]["MetricsError"];
906
990
  };
907
991
  };
908
992
  };
909
993
  };
910
- put?: never;
911
- post?: never;
912
994
  delete?: never;
913
995
  options?: never;
914
996
  head?: never;
915
997
  patch?: never;
916
998
  trace?: never;
917
999
  };
918
- "/api/v1/me": {
1000
+ "/api/v1/metrics/query": {
919
1001
  parameters: {
920
1002
  query?: never;
921
1003
  header?: never;
922
1004
  path?: never;
923
1005
  cookie?: never;
924
1006
  };
1007
+ get?: never;
1008
+ put?: never;
925
1009
  /**
926
- * Whoami
927
- * @description Returns the identity behind the bearer token: display name, key prefix (absent for the root caller), root flag, and the tenants the caller has a grant on, ordered by slug. Root resolves to every tenant; regular keys resolve to the union of their grants.
1010
+ * Query metrics, whole instance
1011
+ * @description Reads one or more metrics over an interval, optionally bucketed by time and grouped and filtered by dimensions. Values come as a map keyed by metric. With neither `granularity` nor `group_by`, the answer is exactly one row. Root only.
928
1012
  */
929
- get: {
1013
+ post: {
930
1014
  parameters: {
931
1015
  query?: never;
932
1016
  header?: never;
933
1017
  path?: never;
934
1018
  cookie?: never;
935
1019
  };
936
- requestBody?: never;
1020
+ requestBody: {
1021
+ content: {
1022
+ "application/json": components["schemas"]["MetricsQuery"];
1023
+ };
1024
+ };
937
1025
  responses: {
938
- /** @description Resolved identity. */
939
1026
  200: {
940
1027
  headers: {
941
1028
  [name: string]: unknown;
942
1029
  };
943
1030
  content: {
944
- "application/json": components["schemas"]["WhoAmI"];
1031
+ "application/json": components["schemas"]["MetricsResult"];
1032
+ };
1033
+ };
1034
+ 400: {
1035
+ headers: {
1036
+ [name: string]: unknown;
1037
+ };
1038
+ content: {
1039
+ "application/json": components["schemas"]["MetricsError"];
945
1040
  };
946
1041
  };
947
- /** @description Missing or invalid credentials. */
948
1042
  401: {
949
1043
  headers: {
950
1044
  [name: string]: unknown;
951
1045
  };
952
1046
  content?: never;
953
1047
  };
1048
+ 403: {
1049
+ headers: {
1050
+ [name: string]: unknown;
1051
+ };
1052
+ content: {
1053
+ "application/json": components["schemas"]["MetricsError"];
1054
+ };
1055
+ };
954
1056
  };
955
1057
  };
956
- put?: never;
957
- post?: never;
958
1058
  delete?: never;
959
1059
  options?: never;
960
1060
  head?: never;
@@ -7423,98 +7523,6 @@ export interface paths {
7423
7523
  patch?: never;
7424
7524
  trace?: never;
7425
7525
  };
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
- };
7518
7526
  "/api/v1/tenants/{tenantSlug}/knowledge-bases": {
7519
7527
  parameters: {
7520
7528
  query?: never;
@@ -9122,7 +9130,7 @@ export interface paths {
9122
9130
  };
9123
9131
  trace?: never;
9124
9132
  };
9125
- "/api/v1/tenants/{tenantSlug}/scheduled-runs": {
9133
+ "/api/v1/tenants/{tenantSlug}/metrics": {
9126
9134
  parameters: {
9127
9135
  query?: never;
9128
9136
  header?: never;
@@ -9130,22 +9138,15 @@ export interface paths {
9130
9138
  cookie?: never;
9131
9139
  };
9132
9140
  /**
9133
- * List scheduled runs
9134
- * @description Lists the tenant's scheduled runs ordered enabled-first then by soonest firing, optionally filtered by source task template slug, owning user, or enabled flag. Requires `background_tasks:read`.
9141
+ * Metric catalog, one tenant
9142
+ * @description The metrics this credential may read on the tenant, in the same shape as `GET /metrics`. Spend metrics need `conversations:read`, which already exposes the cost of every event.
9135
9143
  */
9136
9144
  get: {
9137
9145
  parameters: {
9138
- query?: {
9139
- /** @description Enabled flag to filter runs by; omit for both enabled and disabled. */
9140
- enabled?: boolean;
9141
- /** @description Slug of the source task template to filter runs by; omit for all task templates. */
9142
- task_template?: string;
9143
- /** @description Owning user id to filter runs by; omit for all users. */
9144
- user_id?: string;
9145
- };
9146
+ query?: never;
9146
9147
  header?: never;
9147
9148
  path: {
9148
- /** @description Tenant slug identifying the tenant. */
9149
+ /** @description Tenant slug (kebab-case). */
9149
9150
  tenantSlug: string;
9150
9151
  };
9151
9152
  cookie?: never;
@@ -9157,15 +9158,9 @@ export interface paths {
9157
9158
  [name: string]: unknown;
9158
9159
  };
9159
9160
  content: {
9160
- "application/json": components["schemas"]["ScheduledRun"][];
9161
+ "application/json": components["schemas"]["MetricsCatalog"];
9161
9162
  };
9162
9163
  };
9163
- 400: {
9164
- headers: {
9165
- [name: string]: unknown;
9166
- };
9167
- content?: never;
9168
- };
9169
9164
  401: {
9170
9165
  headers: {
9171
9166
  [name: string]: unknown;
@@ -9176,13 +9171,17 @@ export interface paths {
9176
9171
  headers: {
9177
9172
  [name: string]: unknown;
9178
9173
  };
9179
- content?: never;
9174
+ content: {
9175
+ "application/json": components["schemas"]["MetricsError"];
9176
+ };
9180
9177
  };
9181
9178
  404: {
9182
9179
  headers: {
9183
9180
  [name: string]: unknown;
9184
9181
  };
9185
- content?: never;
9182
+ content: {
9183
+ "application/json": components["schemas"]["MetricsError"];
9184
+ };
9186
9185
  };
9187
9186
  };
9188
9187
  };
@@ -9194,30 +9193,254 @@ export interface paths {
9194
9193
  patch?: never;
9195
9194
  trace?: never;
9196
9195
  };
9197
- "/api/v1/tenants/{tenantSlug}/scheduled-runs/{id}": {
9196
+ "/api/v1/tenants/{tenantSlug}/metrics/dimensions/{dimension}/values": {
9198
9197
  parameters: {
9199
9198
  query?: never;
9200
9199
  header?: never;
9201
9200
  path?: never;
9202
9201
  cookie?: never;
9203
9202
  };
9203
+ get?: never;
9204
+ put?: never;
9204
9205
  /**
9205
- * Get scheduled run
9206
- * @description Returns one scheduled run with its bound parameters, the trigger prompt template and the prompt rendered from those parameters, and the background tasks it has spawned newest-first. Requires `background_tasks:read`.
9206
+ * Values of a dimension, one tenant
9207
+ * @description Same as `POST /metrics/dimensions/{dimension}/values`, scoped to the tenant.
9207
9208
  */
9208
- get: {
9209
+ post: {
9209
9210
  parameters: {
9210
9211
  query?: never;
9211
9212
  header?: never;
9212
9213
  path: {
9213
- /** @description Id of the scheduled run to fetch. */
9214
- id: string;
9215
- /** @description Tenant slug identifying the tenant. */
9214
+ /** @description The dimension. */
9215
+ dimension: components["schemas"]["Dimension"];
9216
+ /** @description Tenant slug (kebab-case). */
9216
9217
  tenantSlug: string;
9217
9218
  };
9218
9219
  cookie?: never;
9219
9220
  };
9220
- requestBody?: never;
9221
+ requestBody: {
9222
+ content: {
9223
+ "application/json": components["schemas"]["DimensionValuesQuery"];
9224
+ };
9225
+ };
9226
+ responses: {
9227
+ 200: {
9228
+ headers: {
9229
+ [name: string]: unknown;
9230
+ };
9231
+ content: {
9232
+ "application/json": components["schemas"]["DimensionValues"];
9233
+ };
9234
+ };
9235
+ 400: {
9236
+ headers: {
9237
+ [name: string]: unknown;
9238
+ };
9239
+ content: {
9240
+ "application/json": components["schemas"]["MetricsError"];
9241
+ };
9242
+ };
9243
+ 401: {
9244
+ headers: {
9245
+ [name: string]: unknown;
9246
+ };
9247
+ content?: never;
9248
+ };
9249
+ 403: {
9250
+ headers: {
9251
+ [name: string]: unknown;
9252
+ };
9253
+ content: {
9254
+ "application/json": components["schemas"]["MetricsError"];
9255
+ };
9256
+ };
9257
+ 404: {
9258
+ headers: {
9259
+ [name: string]: unknown;
9260
+ };
9261
+ content: {
9262
+ "application/json": components["schemas"]["MetricsError"];
9263
+ };
9264
+ };
9265
+ };
9266
+ };
9267
+ delete?: never;
9268
+ options?: never;
9269
+ head?: never;
9270
+ patch?: never;
9271
+ trace?: never;
9272
+ };
9273
+ "/api/v1/tenants/{tenantSlug}/metrics/query": {
9274
+ parameters: {
9275
+ query?: never;
9276
+ header?: never;
9277
+ path?: never;
9278
+ cookie?: never;
9279
+ };
9280
+ get?: never;
9281
+ put?: never;
9282
+ /**
9283
+ * Query metrics, one tenant
9284
+ * @description The tenant's metrics, in the same shape as `POST /metrics/query`; the `tenant` dimension does not exist here.
9285
+ */
9286
+ post: {
9287
+ parameters: {
9288
+ query?: never;
9289
+ header?: never;
9290
+ path: {
9291
+ /** @description Tenant slug (kebab-case). */
9292
+ tenantSlug: string;
9293
+ };
9294
+ cookie?: never;
9295
+ };
9296
+ requestBody: {
9297
+ content: {
9298
+ "application/json": components["schemas"]["MetricsQuery"];
9299
+ };
9300
+ };
9301
+ responses: {
9302
+ 200: {
9303
+ headers: {
9304
+ [name: string]: unknown;
9305
+ };
9306
+ content: {
9307
+ "application/json": components["schemas"]["MetricsResult"];
9308
+ };
9309
+ };
9310
+ 400: {
9311
+ headers: {
9312
+ [name: string]: unknown;
9313
+ };
9314
+ content: {
9315
+ "application/json": components["schemas"]["MetricsError"];
9316
+ };
9317
+ };
9318
+ 401: {
9319
+ headers: {
9320
+ [name: string]: unknown;
9321
+ };
9322
+ content?: never;
9323
+ };
9324
+ 403: {
9325
+ headers: {
9326
+ [name: string]: unknown;
9327
+ };
9328
+ content: {
9329
+ "application/json": components["schemas"]["MetricsError"];
9330
+ };
9331
+ };
9332
+ 404: {
9333
+ headers: {
9334
+ [name: string]: unknown;
9335
+ };
9336
+ content: {
9337
+ "application/json": components["schemas"]["MetricsError"];
9338
+ };
9339
+ };
9340
+ };
9341
+ };
9342
+ delete?: never;
9343
+ options?: never;
9344
+ head?: never;
9345
+ patch?: never;
9346
+ trace?: never;
9347
+ };
9348
+ "/api/v1/tenants/{tenantSlug}/scheduled-runs": {
9349
+ parameters: {
9350
+ query?: never;
9351
+ header?: never;
9352
+ path?: never;
9353
+ cookie?: never;
9354
+ };
9355
+ /**
9356
+ * List scheduled runs
9357
+ * @description Lists the tenant's scheduled runs ordered enabled-first then by soonest firing, optionally filtered by source task template slug, owning user, or enabled flag. Requires `background_tasks:read`.
9358
+ */
9359
+ get: {
9360
+ parameters: {
9361
+ query?: {
9362
+ /** @description Enabled flag to filter runs by; omit for both enabled and disabled. */
9363
+ enabled?: boolean;
9364
+ /** @description Slug of the source task template to filter runs by; omit for all task templates. */
9365
+ task_template?: string;
9366
+ /** @description Owning user id to filter runs by; omit for all users. */
9367
+ user_id?: string;
9368
+ };
9369
+ header?: never;
9370
+ path: {
9371
+ /** @description Tenant slug identifying the tenant. */
9372
+ tenantSlug: string;
9373
+ };
9374
+ cookie?: never;
9375
+ };
9376
+ requestBody?: never;
9377
+ responses: {
9378
+ 200: {
9379
+ headers: {
9380
+ [name: string]: unknown;
9381
+ };
9382
+ content: {
9383
+ "application/json": components["schemas"]["ScheduledRun"][];
9384
+ };
9385
+ };
9386
+ 400: {
9387
+ headers: {
9388
+ [name: string]: unknown;
9389
+ };
9390
+ content?: never;
9391
+ };
9392
+ 401: {
9393
+ headers: {
9394
+ [name: string]: unknown;
9395
+ };
9396
+ content?: never;
9397
+ };
9398
+ 403: {
9399
+ headers: {
9400
+ [name: string]: unknown;
9401
+ };
9402
+ content?: never;
9403
+ };
9404
+ 404: {
9405
+ headers: {
9406
+ [name: string]: unknown;
9407
+ };
9408
+ content?: never;
9409
+ };
9410
+ };
9411
+ };
9412
+ put?: never;
9413
+ post?: never;
9414
+ delete?: never;
9415
+ options?: never;
9416
+ head?: never;
9417
+ patch?: never;
9418
+ trace?: never;
9419
+ };
9420
+ "/api/v1/tenants/{tenantSlug}/scheduled-runs/{id}": {
9421
+ parameters: {
9422
+ query?: never;
9423
+ header?: never;
9424
+ path?: never;
9425
+ cookie?: never;
9426
+ };
9427
+ /**
9428
+ * Get scheduled run
9429
+ * @description Returns one scheduled run with its bound parameters, the trigger prompt template and the prompt rendered from those parameters, and the background tasks it has spawned newest-first. Requires `background_tasks:read`.
9430
+ */
9431
+ get: {
9432
+ parameters: {
9433
+ query?: never;
9434
+ header?: never;
9435
+ path: {
9436
+ /** @description Id of the scheduled run to fetch. */
9437
+ id: string;
9438
+ /** @description Tenant slug identifying the tenant. */
9439
+ tenantSlug: string;
9440
+ };
9441
+ cookie?: never;
9442
+ };
9443
+ requestBody?: never;
9221
9444
  responses: {
9222
9445
  200: {
9223
9446
  headers: {
@@ -12028,6 +12251,13 @@ export interface components {
12028
12251
  role_slugs: string[];
12029
12252
  task_template: components["schemas"]["TaskTemplateRef"];
12030
12253
  };
12254
+ /**
12255
+ * @description How a metric combines across rows. Only `sum` exists today; the others are
12256
+ * reserved so a consumer can be written against them now. For anything but
12257
+ * `sum`, adding up rows gives a wrong number — use `totals`.
12258
+ * @enum {string}
12259
+ */
12260
+ Aggregation: "sum" | "ratio" | "quantile" | "distinct" | "gauge";
12031
12261
  AiProvider: {
12032
12262
  /**
12033
12263
  * @deprecated
@@ -12429,6 +12659,23 @@ export interface components {
12429
12659
  /** Format: uuid */
12430
12660
  tool_call_id: string;
12431
12661
  };
12662
+ Column: {
12663
+ kind: components["schemas"]["ColumnKind"];
12664
+ name: string;
12665
+ unit: components["schemas"]["Unit"] | null;
12666
+ };
12667
+ /** @enum {string} */
12668
+ ColumnKind: "bucket" | "dimension" | "metric";
12669
+ /** @description Whether the history is all there yet. */
12670
+ Completeness: {
12671
+ /**
12672
+ * Format: date-time
12673
+ * @description Before this instant the history is still being attributed in the
12674
+ * background, so a slice reaching back past it reads low. Absent once it
12675
+ * is all there.
12676
+ */
12677
+ pending_before: string | null;
12678
+ };
12432
12679
  ComponentInput: {
12433
12680
  description?: string;
12434
12681
  example_mdx?: string;
@@ -12767,177 +13014,6 @@ export interface components {
12767
13014
  output_tokens: number | null;
12768
13015
  summary_text: string;
12769
13016
  };
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
- };
12941
13017
  CountTokensResponse: {
12942
13018
  breakdown: components["schemas"]["Breakdown"] | null;
12943
13019
  /**
@@ -13449,6 +13525,54 @@ export interface components {
13449
13525
  /** @description `conversation` (tied to a thread) or `outbound` (proactive send). */
13450
13526
  source: string;
13451
13527
  };
13528
+ /**
13529
+ * @description What a metric can be grouped and filtered by. One vocabulary for every
13530
+ * metric, so a dimension always means the same id wherever it appears.
13531
+ * @enum {string}
13532
+ */
13533
+ Dimension: "tenant" | "user" | "agent" | "provider" | "model" | "kind";
13534
+ DimensionInfo: {
13535
+ description: string;
13536
+ id: components["schemas"]["Dimension"];
13537
+ /** @description Its values are ids the query can name with `include: ["labels"]`. */
13538
+ labeled: boolean;
13539
+ };
13540
+ DimensionValue: {
13541
+ label: components["schemas"]["EntityLabel"] | null;
13542
+ metric_value: components["schemas"]["MetricValue"];
13543
+ /** @description The value to filter on; `null` for the rows with none. */
13544
+ value: string | null;
13545
+ };
13546
+ DimensionValues: {
13547
+ next_cursor: string | null;
13548
+ values: components["schemas"]["DimensionValue"][];
13549
+ };
13550
+ DimensionValuesQuery: {
13551
+ cursor?: string | null;
13552
+ /**
13553
+ * @description The other filters of the page; this dimension's own is ignored, so the
13554
+ * list always offers every value the rest of the page allows.
13555
+ */
13556
+ filters?: {
13557
+ [key: string]: components["schemas"]["FilterSpec"];
13558
+ };
13559
+ /** Format: date-time */
13560
+ from?: string | null;
13561
+ /**
13562
+ * Format: int32
13563
+ * @description 1 to 1 000. Default 100.
13564
+ */
13565
+ limit?: number | null;
13566
+ /** @description The metric that ranks the values (and that they are counted in). */
13567
+ metric: components["schemas"]["Metric"];
13568
+ /** @description Keep values whose id or name contains this, case-insensitively. */
13569
+ search?: string | null;
13570
+ timezone?: string | null;
13571
+ /** Format: date-time */
13572
+ to?: string | null;
13573
+ };
13574
+ /** @enum {string} */
13575
+ Direction: "asc" | "desc";
13452
13576
  DraftAgentConfig: {
13453
13577
  agents_md?: string | null;
13454
13578
  /**
@@ -13515,6 +13639,18 @@ export interface components {
13515
13639
  */
13516
13640
  tags: string[];
13517
13641
  };
13642
+ /** @description A name for an id. Which fields are set depends on the dimension. */
13643
+ EntityLabel: {
13644
+ display_name: string | null;
13645
+ /**
13646
+ * @description A user's first channel identity (a phone, a handle): display names are
13647
+ * neither unique nor always set.
13648
+ */
13649
+ primary_identifier: string | null;
13650
+ /** @description A provider's type (`openai`, `anthropic`, …). */
13651
+ provider_type: string | null;
13652
+ slug: string | null;
13653
+ };
13518
13654
  /** @enum {string} */
13519
13655
  EventType: "user_message" | "task_prompt" | "agent_directive" | "agent_message" | "agent_file" | "llm_call" | "tool_result" | "turn_done" | "todo_update" | "memory_lookup" | "media_transcription" | "sub_conversation_started" | "sub_conversation_finished" | "eval_subcall_request" | "eval_subcall_result" | "compaction_done" | "filesystem_root" | "harness_error" | "guardrail_verdict" | "client_tool_call" | "title_generated" | "context_update";
13520
13656
  ExternalChannel: {
@@ -13583,6 +13719,19 @@ export interface components {
13583
13719
  */
13584
13720
  root_event_id: string | null;
13585
13721
  };
13722
+ /**
13723
+ * @description The values a dimension is restricted to. A filter selects exactly what it
13724
+ * lists, so one that lists nothing is refused rather than read as "all".
13725
+ */
13726
+ FilterSpec: {
13727
+ /** @description Ids (or, for `model` and `kind`, the values themselves) to keep. */
13728
+ in?: string[];
13729
+ /**
13730
+ * @description Also keep the rows where the dimension has no value — spend with no
13731
+ * user, a call recorded with no provider.
13732
+ */
13733
+ none?: boolean;
13734
+ };
13586
13735
  /**
13587
13736
  * @description Abnormal stop reason. Absent on the happy path; callers distinguish text vs tool calls by
13588
13737
  * inspecting `messages`.
@@ -13605,10 +13754,14 @@ export interface components {
13605
13754
  permission: string;
13606
13755
  tenant_slug: string;
13607
13756
  };
13757
+ /** @enum {string} */
13758
+ Granularity: "hour" | "day" | "week" | "month";
13608
13759
  Health: {
13609
13760
  status: string;
13610
13761
  version: string;
13611
13762
  };
13763
+ /** @enum {string} */
13764
+ Include: "totals" | "labels";
13612
13765
  KnowledgeBase: {
13613
13766
  accepts_conversation_sources: boolean;
13614
13767
  /** Format: date-time */
@@ -14003,6 +14156,127 @@ export interface components {
14003
14156
  /** @enum {string} */
14004
14157
  type: "tool_result";
14005
14158
  };
14159
+ /** @enum {string} */
14160
+ Metric: "cost_usd" | "calls" | "input_tokens" | "cached_input_tokens" | "cache_write_tokens" | "output_tokens" | "reasoning_tokens" | "unclassified_tokens";
14161
+ MetricInfo: {
14162
+ aggregation: components["schemas"]["Aggregation"];
14163
+ completeness: components["schemas"]["Completeness"];
14164
+ description: string;
14165
+ /** @description What it can be grouped and filtered by. */
14166
+ dimensions: components["schemas"]["Dimension"][];
14167
+ id: components["schemas"]["Metric"];
14168
+ /** @description The finest granularity a series of it can be cut at. */
14169
+ min_granularity: components["schemas"]["Granularity"];
14170
+ unit: components["schemas"]["Unit"];
14171
+ };
14172
+ MetricsCatalog: {
14173
+ /** @description Every dimension a metric here accepts. */
14174
+ dimensions: components["schemas"]["DimensionInfo"][];
14175
+ /** @description The metrics the credential may read in this scope. */
14176
+ metrics: components["schemas"]["MetricInfo"][];
14177
+ };
14178
+ /**
14179
+ * @description A refused request: a stable code, a sentence, and where in the request the
14180
+ * problem is — so a consumer can point at the field rather than parse prose.
14181
+ */
14182
+ MetricsError: {
14183
+ error: string;
14184
+ /** @description Path into the request body (`metrics[1]`, `filters.user.in[0]`). */
14185
+ field: string | null;
14186
+ message: string;
14187
+ };
14188
+ /**
14189
+ * @description A metric as asked for: its id, or an object naming it plus parameters.
14190
+ * No metric takes parameters yet; the object form is accepted now so a
14191
+ * parameterised one (a quantile, say) is not a new request shape.
14192
+ */
14193
+ MetricSpec: components["schemas"]["Metric"] | (Record<string, unknown> & {
14194
+ id: components["schemas"]["Metric"];
14195
+ });
14196
+ MetricsQuery: {
14197
+ /** @description `next_cursor` of the previous page, sent with the same query. */
14198
+ cursor?: string | null;
14199
+ /** @description Per dimension, the values to keep. */
14200
+ filters?: {
14201
+ [key: string]: components["schemas"]["FilterSpec"];
14202
+ };
14203
+ /**
14204
+ * Format: date-time
14205
+ * @description Start of the slice, inclusive. Rounded down to the hour, since metrics
14206
+ * are kept per hour. Default: 30 days before `to`.
14207
+ */
14208
+ from?: string | null;
14209
+ granularity?: components["schemas"]["Granularity"] | null;
14210
+ group_by?: components["schemas"]["Dimension"][];
14211
+ include?: components["schemas"]["Include"][];
14212
+ /**
14213
+ * Format: int32
14214
+ * @description Rows per page, 1 to 10 000. Default 1 000.
14215
+ */
14216
+ limit?: number | null;
14217
+ /** @description One or more metrics, by id or as `{ "id": … }`. */
14218
+ metrics: components["schemas"]["MetricSpec"][];
14219
+ /**
14220
+ * @description Order within a bucket — rows always go bucket by bucket, oldest first.
14221
+ * Default: the first metric, descending.
14222
+ */
14223
+ order_by?: components["schemas"]["OrderBy"][];
14224
+ /** @description IANA zone buckets are cut in. Default `UTC`. */
14225
+ timezone?: string | null;
14226
+ /**
14227
+ * Format: date-time
14228
+ * @description End of the slice, exclusive. Rounded up to the hour. Default: the end of
14229
+ * the current hour.
14230
+ */
14231
+ to?: string | null;
14232
+ };
14233
+ MetricsResult: {
14234
+ /**
14235
+ * @description Every bucket of the slice, empty ones included, in order — present
14236
+ * exactly when the query has a granularity. Rows with no value at all are
14237
+ * omitted, so this is what a chart fills its gaps from.
14238
+ */
14239
+ buckets: string[] | null;
14240
+ columns: components["schemas"]["Column"][];
14241
+ completeness: components["schemas"]["Completeness"];
14242
+ /**
14243
+ * @description Present with `include: ["labels"]`: per labeled dimension, id → name.
14244
+ * An id with no entry points at a row that was deleted.
14245
+ */
14246
+ labels: {
14247
+ [key: string]: {
14248
+ [key: string]: components["schemas"]["EntityLabel"];
14249
+ };
14250
+ } | null;
14251
+ /** @description Send it back as `cursor`, with the same query, for the next page. */
14252
+ next_cursor: string | null;
14253
+ query: components["schemas"]["ResolvedQuery"];
14254
+ rows: components["schemas"]["MetricsRow"][];
14255
+ totals: components["schemas"]["MetricsTotals"] | null;
14256
+ };
14257
+ MetricsRow: {
14258
+ /**
14259
+ * Format: date-time
14260
+ * @description Start of the bucket, in the request's zone. Present exactly when the
14261
+ * query has a granularity.
14262
+ */
14263
+ bucket: string | null;
14264
+ /** @description Every grouped dimension; `null` for the rows where it has no value. */
14265
+ dimensions: {
14266
+ [key: string]: string | null;
14267
+ };
14268
+ /** @description Every requested metric. */
14269
+ values: {
14270
+ [key: string]: components["schemas"]["MetricValue"];
14271
+ };
14272
+ };
14273
+ MetricsTotals: {
14274
+ values: {
14275
+ [key: string]: components["schemas"]["MetricValue"];
14276
+ };
14277
+ };
14278
+ /** @description One value. Integral units come back as integers, money as a float. */
14279
+ MetricValue: number;
14006
14280
  /**
14007
14281
  * @description `None` ≠ `Some(false)`: the provider didn't expose this signal or our probe was inconclusive.
14008
14282
  *
@@ -14049,6 +14323,12 @@ export interface components {
14049
14323
  NamedClientToolInput: components["schemas"]["ClientToolInput"] & {
14050
14324
  name: string;
14051
14325
  };
14326
+ /** @description Order by a requested metric or a grouped dimension. Exactly one of the two. */
14327
+ OrderBy: {
14328
+ dimension?: components["schemas"]["Dimension"] | null;
14329
+ direction?: components["schemas"]["Direction"];
14330
+ metric?: components["schemas"]["Metric"] | null;
14331
+ };
14052
14332
  /**
14053
14333
  * @description Whether anything is trying to send this channel's queue right now.
14054
14334
  * @enum {string}
@@ -14321,6 +14601,22 @@ export interface components {
14321
14601
  ReplaceClientToolsInput: {
14322
14602
  tools: components["schemas"]["NamedClientToolInput"][];
14323
14603
  };
14604
+ /**
14605
+ * @description The query as it was answered: defaults filled in and the interval rounded
14606
+ * to whole hours.
14607
+ */
14608
+ ResolvedQuery: {
14609
+ /** Format: date-time */
14610
+ from: string;
14611
+ granularity: components["schemas"]["Granularity"] | null;
14612
+ group_by: components["schemas"]["Dimension"][];
14613
+ /** Format: int32 */
14614
+ limit: number;
14615
+ metrics: components["schemas"]["Metric"][];
14616
+ timezone: string;
14617
+ /** Format: date-time */
14618
+ to: string;
14619
+ };
14324
14620
  RotatedSecret: {
14325
14621
  connection_secret: string;
14326
14622
  };
@@ -14766,6 +15062,8 @@ export interface components {
14766
15062
  has_pending_turn: boolean;
14767
15063
  is_processing: boolean;
14768
15064
  };
15065
+ /** @enum {string} */
15066
+ Unit: "usd" | "count" | "tokens";
14769
15067
  UpdateAgentInput: {
14770
15068
  agents_md?: string | null;
14771
15069
  /**