@cubos/agent-sdk 0.0.1154888 → 0.0.1154905
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/admin/index.d.ts +3 -1
- package/dist/admin/users.d.ts +100 -0
- package/dist/errors.d.ts +38 -1
- package/dist/generated/schema.d.ts +512 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +30 -1
- package/dist/index.js.map +5 -5
- package/dist/sse.js +13 -1
- package/dist/sse.js.map +3 -3
- package/package.json +1 -1
|
@@ -7615,6 +7615,188 @@ export interface paths {
|
|
|
7615
7615
|
patch?: never;
|
|
7616
7616
|
trace?: never;
|
|
7617
7617
|
};
|
|
7618
|
+
"/api/v1/tenants/{tenantSlug}/cost-limits": {
|
|
7619
|
+
parameters: {
|
|
7620
|
+
query?: never;
|
|
7621
|
+
header?: never;
|
|
7622
|
+
path?: never;
|
|
7623
|
+
cookie?: never;
|
|
7624
|
+
};
|
|
7625
|
+
/**
|
|
7626
|
+
* Tenant-default spend ceilings
|
|
7627
|
+
* @description The ceilings that apply to every user of this tenant who has no override of their own. An empty list means no default ceiling — the shipped state. Requires `users:read`.
|
|
7628
|
+
*/
|
|
7629
|
+
get: {
|
|
7630
|
+
parameters: {
|
|
7631
|
+
query?: never;
|
|
7632
|
+
header?: never;
|
|
7633
|
+
path: {
|
|
7634
|
+
/** @description Tenant slug (kebab-case). */
|
|
7635
|
+
tenantSlug: string;
|
|
7636
|
+
};
|
|
7637
|
+
cookie?: never;
|
|
7638
|
+
};
|
|
7639
|
+
requestBody?: never;
|
|
7640
|
+
responses: {
|
|
7641
|
+
200: {
|
|
7642
|
+
headers: {
|
|
7643
|
+
[name: string]: unknown;
|
|
7644
|
+
};
|
|
7645
|
+
content: {
|
|
7646
|
+
"application/json": components["schemas"]["CostLimits"];
|
|
7647
|
+
};
|
|
7648
|
+
};
|
|
7649
|
+
401: {
|
|
7650
|
+
headers: {
|
|
7651
|
+
[name: string]: unknown;
|
|
7652
|
+
};
|
|
7653
|
+
content?: never;
|
|
7654
|
+
};
|
|
7655
|
+
403: {
|
|
7656
|
+
headers: {
|
|
7657
|
+
[name: string]: unknown;
|
|
7658
|
+
};
|
|
7659
|
+
content?: never;
|
|
7660
|
+
};
|
|
7661
|
+
404: {
|
|
7662
|
+
headers: {
|
|
7663
|
+
[name: string]: unknown;
|
|
7664
|
+
};
|
|
7665
|
+
content?: never;
|
|
7666
|
+
};
|
|
7667
|
+
};
|
|
7668
|
+
};
|
|
7669
|
+
/**
|
|
7670
|
+
* Replace the tenant-default spend ceilings
|
|
7671
|
+
* @description Declarative: the body is the complete set, and any period left out is removed. Clears every budget hold in the tenant, so a scheduled run frozen under the old ceilings is reconsidered on the next poll. Requires `users:write`.
|
|
7672
|
+
*/
|
|
7673
|
+
put: {
|
|
7674
|
+
parameters: {
|
|
7675
|
+
query?: never;
|
|
7676
|
+
header?: never;
|
|
7677
|
+
path: {
|
|
7678
|
+
/** @description Tenant slug (kebab-case). */
|
|
7679
|
+
tenantSlug: string;
|
|
7680
|
+
};
|
|
7681
|
+
cookie?: never;
|
|
7682
|
+
};
|
|
7683
|
+
requestBody: {
|
|
7684
|
+
content: {
|
|
7685
|
+
"application/json": components["schemas"]["PutCostLimits"];
|
|
7686
|
+
};
|
|
7687
|
+
};
|
|
7688
|
+
responses: {
|
|
7689
|
+
200: {
|
|
7690
|
+
headers: {
|
|
7691
|
+
[name: string]: unknown;
|
|
7692
|
+
};
|
|
7693
|
+
content: {
|
|
7694
|
+
"application/json": components["schemas"]["CostLimits"];
|
|
7695
|
+
};
|
|
7696
|
+
};
|
|
7697
|
+
/** @description A period appears twice, or a ceiling is negative or not finite. */
|
|
7698
|
+
400: {
|
|
7699
|
+
headers: {
|
|
7700
|
+
[name: string]: unknown;
|
|
7701
|
+
};
|
|
7702
|
+
content?: never;
|
|
7703
|
+
};
|
|
7704
|
+
401: {
|
|
7705
|
+
headers: {
|
|
7706
|
+
[name: string]: unknown;
|
|
7707
|
+
};
|
|
7708
|
+
content?: never;
|
|
7709
|
+
};
|
|
7710
|
+
403: {
|
|
7711
|
+
headers: {
|
|
7712
|
+
[name: string]: unknown;
|
|
7713
|
+
};
|
|
7714
|
+
content?: never;
|
|
7715
|
+
};
|
|
7716
|
+
404: {
|
|
7717
|
+
headers: {
|
|
7718
|
+
[name: string]: unknown;
|
|
7719
|
+
};
|
|
7720
|
+
content?: never;
|
|
7721
|
+
};
|
|
7722
|
+
/** @description The message has a `{word}` that is not a placeholder: `error` is `unknown_placeholder` and `placeholder` names it. */
|
|
7723
|
+
422: {
|
|
7724
|
+
headers: {
|
|
7725
|
+
[name: string]: unknown;
|
|
7726
|
+
};
|
|
7727
|
+
content?: never;
|
|
7728
|
+
};
|
|
7729
|
+
};
|
|
7730
|
+
};
|
|
7731
|
+
post?: never;
|
|
7732
|
+
delete?: never;
|
|
7733
|
+
options?: never;
|
|
7734
|
+
head?: never;
|
|
7735
|
+
patch?: never;
|
|
7736
|
+
trace?: never;
|
|
7737
|
+
};
|
|
7738
|
+
"/api/v1/tenants/{tenantSlug}/cost/over-limit": {
|
|
7739
|
+
parameters: {
|
|
7740
|
+
query?: never;
|
|
7741
|
+
header?: never;
|
|
7742
|
+
path?: never;
|
|
7743
|
+
cookie?: never;
|
|
7744
|
+
};
|
|
7745
|
+
/**
|
|
7746
|
+
* Users currently blocked by a ceiling
|
|
7747
|
+
* @description Everyone sitting at or past one of their ceilings right now, shortest breached window first. Computed at read time — nothing stores "is over", because a ceiling lifts by the clock passing an instant and a stored flag would be stale between the window turning over and whatever refreshed it. Requires `users:read`.
|
|
7748
|
+
*/
|
|
7749
|
+
get: {
|
|
7750
|
+
parameters: {
|
|
7751
|
+
query?: {
|
|
7752
|
+
/** @description Rows to return, 1–500 (default 100). */
|
|
7753
|
+
limit?: number;
|
|
7754
|
+
};
|
|
7755
|
+
header?: never;
|
|
7756
|
+
path: {
|
|
7757
|
+
/** @description Tenant slug (kebab-case). */
|
|
7758
|
+
tenantSlug: string;
|
|
7759
|
+
};
|
|
7760
|
+
cookie?: never;
|
|
7761
|
+
};
|
|
7762
|
+
requestBody?: never;
|
|
7763
|
+
responses: {
|
|
7764
|
+
200: {
|
|
7765
|
+
headers: {
|
|
7766
|
+
[name: string]: unknown;
|
|
7767
|
+
};
|
|
7768
|
+
content: {
|
|
7769
|
+
"application/json": components["schemas"]["OverLimitList"];
|
|
7770
|
+
};
|
|
7771
|
+
};
|
|
7772
|
+
401: {
|
|
7773
|
+
headers: {
|
|
7774
|
+
[name: string]: unknown;
|
|
7775
|
+
};
|
|
7776
|
+
content?: never;
|
|
7777
|
+
};
|
|
7778
|
+
403: {
|
|
7779
|
+
headers: {
|
|
7780
|
+
[name: string]: unknown;
|
|
7781
|
+
};
|
|
7782
|
+
content?: never;
|
|
7783
|
+
};
|
|
7784
|
+
404: {
|
|
7785
|
+
headers: {
|
|
7786
|
+
[name: string]: unknown;
|
|
7787
|
+
};
|
|
7788
|
+
content?: never;
|
|
7789
|
+
};
|
|
7790
|
+
};
|
|
7791
|
+
};
|
|
7792
|
+
put?: never;
|
|
7793
|
+
post?: never;
|
|
7794
|
+
delete?: never;
|
|
7795
|
+
options?: never;
|
|
7796
|
+
head?: never;
|
|
7797
|
+
patch?: never;
|
|
7798
|
+
trace?: never;
|
|
7799
|
+
};
|
|
7618
7800
|
"/api/v1/tenants/{tenantSlug}/knowledge-bases": {
|
|
7619
7801
|
parameters: {
|
|
7620
7802
|
query?: never;
|
|
@@ -11270,6 +11452,184 @@ export interface paths {
|
|
|
11270
11452
|
patch?: never;
|
|
11271
11453
|
trace?: never;
|
|
11272
11454
|
};
|
|
11455
|
+
"/api/v1/tenants/{tenantSlug}/users/{id}/cost-limits": {
|
|
11456
|
+
parameters: {
|
|
11457
|
+
query?: never;
|
|
11458
|
+
header?: never;
|
|
11459
|
+
path?: never;
|
|
11460
|
+
cookie?: never;
|
|
11461
|
+
};
|
|
11462
|
+
/**
|
|
11463
|
+
* One user's spend-ceiling overrides
|
|
11464
|
+
* @description Only this user's own overrides — an empty list means they inherit the tenant defaults, not that they are unlimited. `…/cost/status` is what reports the ceilings actually in force. Requires `users:read`.
|
|
11465
|
+
*/
|
|
11466
|
+
get: {
|
|
11467
|
+
parameters: {
|
|
11468
|
+
query?: never;
|
|
11469
|
+
header?: never;
|
|
11470
|
+
path: {
|
|
11471
|
+
/** @description User id. */
|
|
11472
|
+
id: string;
|
|
11473
|
+
/** @description Tenant slug (kebab-case). */
|
|
11474
|
+
tenantSlug: string;
|
|
11475
|
+
};
|
|
11476
|
+
cookie?: never;
|
|
11477
|
+
};
|
|
11478
|
+
requestBody?: never;
|
|
11479
|
+
responses: {
|
|
11480
|
+
200: {
|
|
11481
|
+
headers: {
|
|
11482
|
+
[name: string]: unknown;
|
|
11483
|
+
};
|
|
11484
|
+
content: {
|
|
11485
|
+
"application/json": components["schemas"]["CostLimits"];
|
|
11486
|
+
};
|
|
11487
|
+
};
|
|
11488
|
+
401: {
|
|
11489
|
+
headers: {
|
|
11490
|
+
[name: string]: unknown;
|
|
11491
|
+
};
|
|
11492
|
+
content?: never;
|
|
11493
|
+
};
|
|
11494
|
+
403: {
|
|
11495
|
+
headers: {
|
|
11496
|
+
[name: string]: unknown;
|
|
11497
|
+
};
|
|
11498
|
+
content?: never;
|
|
11499
|
+
};
|
|
11500
|
+
404: {
|
|
11501
|
+
headers: {
|
|
11502
|
+
[name: string]: unknown;
|
|
11503
|
+
};
|
|
11504
|
+
content?: never;
|
|
11505
|
+
};
|
|
11506
|
+
};
|
|
11507
|
+
};
|
|
11508
|
+
/**
|
|
11509
|
+
* Replace one user's spend-ceiling overrides
|
|
11510
|
+
* @description Declarative: the body is the complete set of overrides, and an empty list drops them all so the user falls back to the tenant defaults. Clears this user's budget holds. Requires `users:write`.
|
|
11511
|
+
*/
|
|
11512
|
+
put: {
|
|
11513
|
+
parameters: {
|
|
11514
|
+
query?: never;
|
|
11515
|
+
header?: never;
|
|
11516
|
+
path: {
|
|
11517
|
+
/** @description User id. */
|
|
11518
|
+
id: string;
|
|
11519
|
+
/** @description Tenant slug (kebab-case). */
|
|
11520
|
+
tenantSlug: string;
|
|
11521
|
+
};
|
|
11522
|
+
cookie?: never;
|
|
11523
|
+
};
|
|
11524
|
+
requestBody: {
|
|
11525
|
+
content: {
|
|
11526
|
+
"application/json": components["schemas"]["PutCostLimits"];
|
|
11527
|
+
};
|
|
11528
|
+
};
|
|
11529
|
+
responses: {
|
|
11530
|
+
200: {
|
|
11531
|
+
headers: {
|
|
11532
|
+
[name: string]: unknown;
|
|
11533
|
+
};
|
|
11534
|
+
content: {
|
|
11535
|
+
"application/json": components["schemas"]["CostLimits"];
|
|
11536
|
+
};
|
|
11537
|
+
};
|
|
11538
|
+
/** @description A period appears twice, or a ceiling is negative or not finite. */
|
|
11539
|
+
400: {
|
|
11540
|
+
headers: {
|
|
11541
|
+
[name: string]: unknown;
|
|
11542
|
+
};
|
|
11543
|
+
content?: never;
|
|
11544
|
+
};
|
|
11545
|
+
401: {
|
|
11546
|
+
headers: {
|
|
11547
|
+
[name: string]: unknown;
|
|
11548
|
+
};
|
|
11549
|
+
content?: never;
|
|
11550
|
+
};
|
|
11551
|
+
403: {
|
|
11552
|
+
headers: {
|
|
11553
|
+
[name: string]: unknown;
|
|
11554
|
+
};
|
|
11555
|
+
content?: never;
|
|
11556
|
+
};
|
|
11557
|
+
404: {
|
|
11558
|
+
headers: {
|
|
11559
|
+
[name: string]: unknown;
|
|
11560
|
+
};
|
|
11561
|
+
content?: never;
|
|
11562
|
+
};
|
|
11563
|
+
};
|
|
11564
|
+
};
|
|
11565
|
+
post?: never;
|
|
11566
|
+
delete?: never;
|
|
11567
|
+
options?: never;
|
|
11568
|
+
head?: never;
|
|
11569
|
+
patch?: never;
|
|
11570
|
+
trace?: never;
|
|
11571
|
+
};
|
|
11572
|
+
"/api/v1/tenants/{tenantSlug}/users/{id}/cost/status": {
|
|
11573
|
+
parameters: {
|
|
11574
|
+
query?: never;
|
|
11575
|
+
header?: never;
|
|
11576
|
+
path?: never;
|
|
11577
|
+
cookie?: never;
|
|
11578
|
+
};
|
|
11579
|
+
/**
|
|
11580
|
+
* Spend against the ceilings in force
|
|
11581
|
+
* @description Spent-versus-limit for each window that applies to this user, with overrides already resolved against the tenant defaults. The cheap read the dashboard needs to draw "3.20 of 10.00 this month" — `…/cost` is the series and the per-model breakdown. Requires `users:read`.
|
|
11582
|
+
*/
|
|
11583
|
+
get: {
|
|
11584
|
+
parameters: {
|
|
11585
|
+
query?: never;
|
|
11586
|
+
header?: never;
|
|
11587
|
+
path: {
|
|
11588
|
+
/** @description User id. */
|
|
11589
|
+
id: string;
|
|
11590
|
+
/** @description Tenant slug (kebab-case). */
|
|
11591
|
+
tenantSlug: string;
|
|
11592
|
+
};
|
|
11593
|
+
cookie?: never;
|
|
11594
|
+
};
|
|
11595
|
+
requestBody?: never;
|
|
11596
|
+
responses: {
|
|
11597
|
+
200: {
|
|
11598
|
+
headers: {
|
|
11599
|
+
[name: string]: unknown;
|
|
11600
|
+
};
|
|
11601
|
+
content: {
|
|
11602
|
+
"application/json": components["schemas"]["CostStatus"];
|
|
11603
|
+
};
|
|
11604
|
+
};
|
|
11605
|
+
401: {
|
|
11606
|
+
headers: {
|
|
11607
|
+
[name: string]: unknown;
|
|
11608
|
+
};
|
|
11609
|
+
content?: never;
|
|
11610
|
+
};
|
|
11611
|
+
403: {
|
|
11612
|
+
headers: {
|
|
11613
|
+
[name: string]: unknown;
|
|
11614
|
+
};
|
|
11615
|
+
content?: never;
|
|
11616
|
+
};
|
|
11617
|
+
404: {
|
|
11618
|
+
headers: {
|
|
11619
|
+
[name: string]: unknown;
|
|
11620
|
+
};
|
|
11621
|
+
content?: never;
|
|
11622
|
+
};
|
|
11623
|
+
};
|
|
11624
|
+
};
|
|
11625
|
+
put?: never;
|
|
11626
|
+
post?: never;
|
|
11627
|
+
delete?: never;
|
|
11628
|
+
options?: never;
|
|
11629
|
+
head?: never;
|
|
11630
|
+
patch?: never;
|
|
11631
|
+
trace?: never;
|
|
11632
|
+
};
|
|
11273
11633
|
"/api/v1/tenants/{tenantSlug}/users/{id}/identities": {
|
|
11274
11634
|
parameters: {
|
|
11275
11635
|
query?: never;
|
|
@@ -13150,6 +13510,98 @@ export interface components {
|
|
|
13150
13510
|
conversations: number;
|
|
13151
13511
|
tag: string;
|
|
13152
13512
|
};
|
|
13513
|
+
/**
|
|
13514
|
+
* @description The language a refusal's placeholders are written in, and of its default
|
|
13515
|
+
* wording — the tenant's choice, stored beside its wording
|
|
13516
|
+
* (`tenants.cost_limit_locale`, beside `cost_limit_message`). A closed set
|
|
13517
|
+
* because each value is a translation shipped here.
|
|
13518
|
+
* @enum {string}
|
|
13519
|
+
*/
|
|
13520
|
+
CostLimitLocale: "pt-BR" | "en" | "es";
|
|
13521
|
+
CostLimitRule: {
|
|
13522
|
+
/**
|
|
13523
|
+
* Format: double
|
|
13524
|
+
* @description Ceiling in USD. `0` stops the user outright — the comparison is
|
|
13525
|
+
* `spent >= limit` — which together with "no rule means no ceiling" gives
|
|
13526
|
+
* two distinct states: absent is unlimited, zero is off.
|
|
13527
|
+
*/
|
|
13528
|
+
limit_usd: number;
|
|
13529
|
+
/**
|
|
13530
|
+
* @description Window the ceiling applies over: `hour`, `day`, `week` or `month`.
|
|
13531
|
+
* Windows are calendar-aligned and cut in the user's own timezone.
|
|
13532
|
+
*/
|
|
13533
|
+
period: components["schemas"]["Period"];
|
|
13534
|
+
/**
|
|
13535
|
+
* Format: int32
|
|
13536
|
+
* @description `month` only: the day of the month (1–31) it turns over on; a month
|
|
13537
|
+
* without that day turns over on its last. Default 1.
|
|
13538
|
+
*/
|
|
13539
|
+
reset_day?: number | null;
|
|
13540
|
+
/**
|
|
13541
|
+
* Format: int32
|
|
13542
|
+
* @description `day`, `week` and `month`: the hour (0–23, on the user's clock) the
|
|
13543
|
+
* window turns over at. Default 0. Whole hours only: the spend is read
|
|
13544
|
+
* from a rollup kept per hour. Refused on `hour`.
|
|
13545
|
+
*/
|
|
13546
|
+
reset_hour?: number | null;
|
|
13547
|
+
reset_weekday?: components["schemas"]["ResetWeekday"] | null;
|
|
13548
|
+
};
|
|
13549
|
+
CostLimits: {
|
|
13550
|
+
/**
|
|
13551
|
+
* @description Tenant scope only: the default wording in every locale, so an editor
|
|
13552
|
+
* can show what "unset" resolves to without a copy of its own.
|
|
13553
|
+
*/
|
|
13554
|
+
default_messages: {
|
|
13555
|
+
[key: string]: string;
|
|
13556
|
+
} | null;
|
|
13557
|
+
locale: components["schemas"]["CostLimitLocale"] | null;
|
|
13558
|
+
/**
|
|
13559
|
+
* @description Tenant scope only: the wording a refused user is shown, as typed, or
|
|
13560
|
+
* null when the tenant has authored none and the locale's default
|
|
13561
|
+
* applies. Absent on the per-user route — the message is a tenant
|
|
13562
|
+
* setting, because the same person hitting the same ceiling must not be
|
|
13563
|
+
* told two different things depending on which agent they reached.
|
|
13564
|
+
*/
|
|
13565
|
+
message: string | null;
|
|
13566
|
+
/**
|
|
13567
|
+
* @description Tenant scope only: what each placeholder renders as, in every locale,
|
|
13568
|
+
* for an example instant (tomorrow at 00:00 UTC) — written by the same
|
|
13569
|
+
* code as a real refusal, so an editor can preview the text without a
|
|
13570
|
+
* copy of the formats. Its keys are the placeholders there are.
|
|
13571
|
+
*/
|
|
13572
|
+
placeholder_examples: {
|
|
13573
|
+
[key: string]: {
|
|
13574
|
+
[key: string]: string;
|
|
13575
|
+
};
|
|
13576
|
+
} | null;
|
|
13577
|
+
/**
|
|
13578
|
+
* @description The rules for this scope, shortest window first. Empty means no
|
|
13579
|
+
* ceiling is configured here.
|
|
13580
|
+
*/
|
|
13581
|
+
rules: components["schemas"]["CostLimitRule"][];
|
|
13582
|
+
};
|
|
13583
|
+
CostStatus: {
|
|
13584
|
+
blocked_by: components["schemas"]["Period"] | null;
|
|
13585
|
+
/**
|
|
13586
|
+
* @description Every ceiling in force for this user, tenant defaults and overrides
|
|
13587
|
+
* already resolved, shortest window first.
|
|
13588
|
+
*/
|
|
13589
|
+
windows: components["schemas"]["CostStatusWindow"][];
|
|
13590
|
+
};
|
|
13591
|
+
CostStatusWindow: {
|
|
13592
|
+
/** @description True once `spent_usd >= limit_usd`. */
|
|
13593
|
+
exceeded: boolean;
|
|
13594
|
+
/** Format: double */
|
|
13595
|
+
limit_usd: number;
|
|
13596
|
+
period: components["schemas"]["Period"];
|
|
13597
|
+
/**
|
|
13598
|
+
* Format: date-time
|
|
13599
|
+
* @description Start of the next window — when this one frees up.
|
|
13600
|
+
*/
|
|
13601
|
+
resets_at: string;
|
|
13602
|
+
/** Format: double */
|
|
13603
|
+
spent_usd: number;
|
|
13604
|
+
};
|
|
13153
13605
|
CountTokensResponse: {
|
|
13154
13606
|
breakdown: components["schemas"]["Breakdown"] | null;
|
|
13155
13607
|
/**
|
|
@@ -14589,6 +15041,38 @@ export interface components {
|
|
|
14589
15041
|
*/
|
|
14590
15042
|
retrying: number;
|
|
14591
15043
|
};
|
|
15044
|
+
OverLimitList: {
|
|
15045
|
+
/**
|
|
15046
|
+
* @description True when the tenant has more blocked users than were returned. A
|
|
15047
|
+
* truncated list that did not say so would be the worst possible answer
|
|
15048
|
+
* here: the reader would conclude the ones they cannot see are fine.
|
|
15049
|
+
*/
|
|
15050
|
+
truncated: boolean;
|
|
15051
|
+
users: components["schemas"]["OverLimitUser"][];
|
|
15052
|
+
};
|
|
15053
|
+
OverLimitUser: {
|
|
15054
|
+
display_name: string | null;
|
|
15055
|
+
/** Format: double */
|
|
15056
|
+
limit_usd: number;
|
|
15057
|
+
/**
|
|
15058
|
+
* @description The breached window. Shortest first across the list, so whoever frees
|
|
15059
|
+
* up soonest is at the top.
|
|
15060
|
+
*/
|
|
15061
|
+
period: components["schemas"]["Period"];
|
|
15062
|
+
primary_identifier: string | null;
|
|
15063
|
+
/** Format: date-time */
|
|
15064
|
+
resets_at: string;
|
|
15065
|
+
/** Format: double */
|
|
15066
|
+
spent_usd: number;
|
|
15067
|
+
/**
|
|
15068
|
+
* @description The user's own timezone, which is where the window was cut — the
|
|
15069
|
+
* `resets_at` above is an instant, and a client showing it should render
|
|
15070
|
+
* it here rather than in the operator's zone.
|
|
15071
|
+
*/
|
|
15072
|
+
timezone: string;
|
|
15073
|
+
/** Format: uuid */
|
|
15074
|
+
user_id: string;
|
|
15075
|
+
};
|
|
14592
15076
|
/**
|
|
14593
15077
|
* @description One citation note, already parsed.
|
|
14594
15078
|
*
|
|
@@ -14615,6 +15099,15 @@ export interface components {
|
|
|
14615
15099
|
source_id: string;
|
|
14616
15100
|
source_title: string;
|
|
14617
15101
|
};
|
|
15102
|
+
/**
|
|
15103
|
+
* @description The four windows a ceiling can be set over.
|
|
15104
|
+
*
|
|
15105
|
+
* Ordered shortest-first, which is also the order a breach is reported in:
|
|
15106
|
+
* the shortest breached window is the one that frees up soonest, so it is the
|
|
15107
|
+
* one whose `resets_at` is worth telling the user about.
|
|
15108
|
+
* @enum {string}
|
|
15109
|
+
*/
|
|
15110
|
+
Period: "hour" | "day" | "week" | "month";
|
|
14618
15111
|
PersonalMemoryObservation: {
|
|
14619
15112
|
content: string;
|
|
14620
15113
|
/** Format: uuid */
|
|
@@ -14704,6 +15197,19 @@ export interface components {
|
|
|
14704
15197
|
PutAutoCallToolsInput: {
|
|
14705
15198
|
tools: components["schemas"]["AutoCallToolRef"][];
|
|
14706
15199
|
};
|
|
15200
|
+
PutCostLimits: {
|
|
15201
|
+
locale?: components["schemas"]["CostLimitLocale"] | null;
|
|
15202
|
+
/**
|
|
15203
|
+
* @description Tenant scope only. Sent as typed, but for its placeholders — `{date}`,
|
|
15204
|
+
* `{time}` and `{weekday}`, filled in with when access returns, on the
|
|
15205
|
+
* user's clock and in the locale's format. Any other `{word}` is refused
|
|
15206
|
+
* (422). Omit to leave the current wording alone; send an empty string to
|
|
15207
|
+
* clear it back to the locale's default. Ignored by the per-user route.
|
|
15208
|
+
*/
|
|
15209
|
+
message?: string | null;
|
|
15210
|
+
/** @description The complete set for this scope. Omitted periods are removed. */
|
|
15211
|
+
rules: components["schemas"]["CostLimitRule"][];
|
|
15212
|
+
};
|
|
14707
15213
|
/**
|
|
14708
15214
|
* @description The reasoning a model produced for the assistant turn it sits in. Carries the
|
|
14709
15215
|
* human-readable chain-of-thought and/or an opaque continuity blob — a turn may
|
|
@@ -14770,6 +15276,12 @@ export interface components {
|
|
|
14770
15276
|
ReplaceClientToolsInput: {
|
|
14771
15277
|
tools: components["schemas"]["NamedClientToolInput"][];
|
|
14772
15278
|
};
|
|
15279
|
+
/**
|
|
15280
|
+
* @description A day of the week, as the API spells it. Kept apart from
|
|
15281
|
+
* `chrono::Weekday` so the wire format is ours.
|
|
15282
|
+
* @enum {string}
|
|
15283
|
+
*/
|
|
15284
|
+
ResetWeekday: "monday" | "tuesday" | "wednesday" | "thursday" | "friday" | "saturday" | "sunday";
|
|
14773
15285
|
/**
|
|
14774
15286
|
* @description The query as it was answered: defaults filled in and the interval rounded
|
|
14775
15287
|
* to whole hours.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export type { AdminClient, AdminClientOptions, TenantScope } from "./admin/index.js";
|
|
2
2
|
export { createAdminClient } from "./admin/index.js";
|
|
3
3
|
export type { Dimension, DimensionValues, DimensionValuesQuery, EntityLabel, Granularity, MetricId, MetricIdOf, MetricInfo, MetricSpec, MetricsCatalog, MetricsCompleteness, MetricsFilter, MetricsFilters, MetricsInclude, MetricsOrderBy, MetricsQuery, MetricsResult, MetricsRow, } from "./admin/metrics.js";
|
|
4
|
+
export type { CostPeriod } from "./admin/users.js";
|
|
4
5
|
export type { CachedConversation, ConversationCache, MemoryConversationCacheOptions, } from "./cache.js";
|
|
5
6
|
export { MemoryConversationCache } from "./cache.js";
|
|
6
7
|
export type { ClientOptions, ClientOptions as UserClientOptions, ConversationHandlers, ConversationSubscription, HistoryStart, ListHandlers, UserCredential, } from "./client.js";
|
|
7
8
|
export { AgentClient, createUserClient } from "./client.js";
|
|
8
9
|
export type { ClientTool, ClientToolContext, ClientToolsSession, ServeClientToolsOptions, } from "./client-tools.js";
|
|
9
10
|
export { serveClientTools } from "./client-tools.js";
|
|
11
|
+
export type { OverBudget } from "./errors.js";
|
|
10
12
|
export { AgentApiError, AgentConfigError, AgentError, AgentNetworkError } from "./errors.js";
|
|
11
13
|
export type { Auth, TokenSource, Transport } from "./http.js";
|
|
12
14
|
export { DEFAULT_MAX_RETRIES, DEFAULT_TIMEOUT_MS } from "./http.js";
|
package/dist/index.js
CHANGED
|
@@ -36,6 +36,18 @@ class AgentApiError extends AgentError {
|
|
|
36
36
|
get isRetryable() {
|
|
37
37
|
return this.status === 429 || this.status >= 500;
|
|
38
38
|
}
|
|
39
|
+
get overBudget() {
|
|
40
|
+
if (this.status !== 402)
|
|
41
|
+
return null;
|
|
42
|
+
const b = this.json();
|
|
43
|
+
if (b?.error !== "over_budget" || !b.period || !b.resets_at)
|
|
44
|
+
return null;
|
|
45
|
+
return {
|
|
46
|
+
period: b.period,
|
|
47
|
+
resetsAt: b.resets_at,
|
|
48
|
+
message: b.message ?? "Spending limit reached."
|
|
49
|
+
};
|
|
50
|
+
}
|
|
39
51
|
}
|
|
40
52
|
|
|
41
53
|
class AgentConfigError extends AgentError {
|
|
@@ -1096,6 +1108,11 @@ function usersApi(t, tenantSlug) {
|
|
|
1096
1108
|
return {
|
|
1097
1109
|
list: (query = {}, signal) => t.request("GET", base, { query, signal }),
|
|
1098
1110
|
get: (id, signal) => t.request("GET", user(id), { signal }),
|
|
1111
|
+
costStatus: (id, signal) => t.request("GET", `${user(id)}/cost/status`, { signal }),
|
|
1112
|
+
costLimits: {
|
|
1113
|
+
get: (id, signal) => t.request("GET", `${user(id)}/cost-limits`, { signal }),
|
|
1114
|
+
put: (id, input) => t.request("PUT", `${user(id)}/cost-limits`, { body: input })
|
|
1115
|
+
},
|
|
1099
1116
|
create: (input) => t.request("POST", base, { body: input }),
|
|
1100
1117
|
update: (id, input) => t.request("PATCH", user(id), { body: input }),
|
|
1101
1118
|
delete: (id) => t.request("DELETE", user(id), { raw: true }),
|
|
@@ -1138,6 +1155,17 @@ function userRolesApi(t, tenantSlug) {
|
|
|
1138
1155
|
delete: (slug) => t.request("DELETE", role(slug), { raw: true })
|
|
1139
1156
|
};
|
|
1140
1157
|
}
|
|
1158
|
+
function costLimitsApi(t, tenantSlug) {
|
|
1159
|
+
const base = `${tenantPath(tenantSlug)}/cost-limits`;
|
|
1160
|
+
return {
|
|
1161
|
+
get: (signal) => t.request("GET", base, { signal }),
|
|
1162
|
+
put: (input) => t.request("PUT", base, { body: input }),
|
|
1163
|
+
overLimit: (query = {}, signal) => t.request("GET", `${tenantPath(tenantSlug)}/cost/over-limit`, {
|
|
1164
|
+
query,
|
|
1165
|
+
signal
|
|
1166
|
+
})
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1141
1169
|
function userTokensApi(t, tenantSlug) {
|
|
1142
1170
|
return {
|
|
1143
1171
|
create: (input) => t.request("POST", `${tenantPath(tenantSlug)}/user-tokens`, {
|
|
@@ -1159,6 +1187,7 @@ function tenantScope(t, slug) {
|
|
|
1159
1187
|
users: usersApi(t, slug),
|
|
1160
1188
|
userRoles: userRolesApi(t, slug),
|
|
1161
1189
|
userTokens: userTokensApi(t, slug),
|
|
1190
|
+
costLimits: costLimitsApi(t, slug),
|
|
1162
1191
|
knowledgeBases: knowledgeBasesApi(t, slug),
|
|
1163
1192
|
taskTemplates: taskTemplatesApi(t, slug),
|
|
1164
1193
|
scheduledRuns: scheduledRunsApi(t, slug),
|
|
@@ -2071,5 +2100,5 @@ export {
|
|
|
2071
2100
|
serveClientTools
|
|
2072
2101
|
};
|
|
2073
2102
|
|
|
2074
|
-
//# debugId=
|
|
2103
|
+
//# debugId=F7769B86B91CDAD264756E2164756E21
|
|
2075
2104
|
//# sourceMappingURL=index.js.map
|