@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.
@@ -29,8 +29,8 @@ export declare function aiProvidersApi(t: Transport, tenantSlug: string): {
29
29
  plugin: string;
30
30
  shared: boolean;
31
31
  slug: string;
32
- token_sku_directions: {
33
- [key: string]: import("../generated/schema.js").components["schemas"]["SkuDirection"];
32
+ token_sku_classes: {
33
+ [key: string]: import("../generated/schema.js").components["schemas"]["SkuClass"];
34
34
  };
35
35
  type: string;
36
36
  }[]>;
@@ -49,8 +49,8 @@ export declare function aiProvidersApi(t: Transport, tenantSlug: string): {
49
49
  plugin: string;
50
50
  shared: boolean;
51
51
  slug: string;
52
- token_sku_directions: {
53
- [key: string]: import("../generated/schema.js").components["schemas"]["SkuDirection"];
52
+ token_sku_classes: {
53
+ [key: string]: import("../generated/schema.js").components["schemas"]["SkuClass"];
54
54
  };
55
55
  type: string;
56
56
  }>;
@@ -69,8 +69,8 @@ export declare function aiProvidersApi(t: Transport, tenantSlug: string): {
69
69
  plugin: string;
70
70
  shared: boolean;
71
71
  slug: string;
72
- token_sku_directions: {
73
- [key: string]: import("../generated/schema.js").components["schemas"]["SkuDirection"];
72
+ token_sku_classes: {
73
+ [key: string]: import("../generated/schema.js").components["schemas"]["SkuClass"];
74
74
  };
75
75
  type: string;
76
76
  }>;
@@ -89,8 +89,8 @@ export declare function aiProvidersApi(t: Transport, tenantSlug: string): {
89
89
  plugin: string;
90
90
  shared: boolean;
91
91
  slug: string;
92
- token_sku_directions: {
93
- [key: string]: import("../generated/schema.js").components["schemas"]["SkuDirection"];
92
+ token_sku_classes: {
93
+ [key: string]: import("../generated/schema.js").components["schemas"]["SkuClass"];
94
94
  };
95
95
  type: string;
96
96
  }>;
@@ -249,6 +249,30 @@ export declare function channelsApi(t: Transport, tenantSlug: string): {
249
249
  preview: string | null;
250
250
  source: string;
251
251
  }[]>;
252
+ /** One summary per channel of what it has not sent: pending messages,
253
+ * whether anything is trying to send them, and what it gave up on in the
254
+ * last `days` days (default 7). */
255
+ outboxReport: (query?: {
256
+ days?: number;
257
+ }, signal?: AbortSignal) => Promise<{
258
+ channels: import("../generated/schema.js").components["schemas"]["ChannelOutboxSummary"][];
259
+ failed_window_days: number;
260
+ retry_window_seconds: number;
261
+ }>;
262
+ /** The channel's outbox summary plus a page of its unsent messages, newest
263
+ * first. Pass the previous page's `next_before` as `before`. */
264
+ outbox: (slug: string, query?: {
265
+ status?: "pending" | "failed" | "all";
266
+ days?: number;
267
+ before?: string;
268
+ limit?: number;
269
+ }, signal?: AbortSignal) => Promise<{
270
+ failed_window_days: number;
271
+ items: import("../generated/schema.js").components["schemas"]["OutboxItem"][];
272
+ next_before: string | null;
273
+ retry_window_seconds: number;
274
+ summary: import("../generated/schema.js").components["schemas"]["ChannelOutboxSummary"];
275
+ }>;
252
276
  pairWhatsapp: (slug: string, input: Schemas["WhatsappPairInput"]) => Promise<{
253
277
  pair_code: string | null;
254
278
  pair_code_expires_at: string | null;
@@ -183,6 +183,7 @@ export declare function conversationsAdminApi(t: Transport, tenantSlug: string):
183
183
  provider: import("../generated/schema.js").components["schemas"]["ProviderRef"] | null;
184
184
  read_at: string | null;
185
185
  result?: unknown;
186
+ sent_at: string | null;
186
187
  seq: number;
187
188
  sub_conversation_id: string | null;
188
189
  tentative: boolean;
@@ -214,6 +215,7 @@ export declare function conversationsAdminApi(t: Transport, tenantSlug: string):
214
215
  provider: import("../generated/schema.js").components["schemas"]["ProviderRef"] | null;
215
216
  read_at: string | null;
216
217
  result?: unknown;
218
+ sent_at: string | null;
217
219
  seq: number;
218
220
  sub_conversation_id: string | null;
219
221
  tentative: boolean;
@@ -244,6 +246,7 @@ export declare function conversationsAdminApi(t: Transport, tenantSlug: string):
244
246
  provider: import("../generated/schema.js").components["schemas"]["ProviderRef"] | null;
245
247
  read_at: string | null;
246
248
  result?: unknown;
249
+ sent_at: string | null;
247
250
  seq: number;
248
251
  sub_conversation_id: string | null;
249
252
  tentative: boolean;
@@ -279,6 +282,7 @@ export declare function conversationsAdminApi(t: Transport, tenantSlug: string):
279
282
  provider: import("../generated/schema.js").components["schemas"]["ProviderRef"] | null;
280
283
  read_at: string | null;
281
284
  result?: unknown;
285
+ sent_at: string | null;
282
286
  seq: number;
283
287
  sub_conversation_id: string | null;
284
288
  tentative: boolean;
@@ -316,6 +320,7 @@ export declare function conversationsAdminApi(t: Transport, tenantSlug: string):
316
320
  provider: import("../generated/schema.js").components["schemas"]["ProviderRef"] | null;
317
321
  read_at: string | null;
318
322
  result?: unknown;
323
+ sent_at: string | null;
319
324
  seq: number;
320
325
  sub_conversation_id: string | null;
321
326
  tentative: boolean;
@@ -345,6 +350,7 @@ export declare function conversationsAdminApi(t: Transport, tenantSlug: string):
345
350
  provider: import("../generated/schema.js").components["schemas"]["ProviderRef"] | null;
346
351
  read_at: string | null;
347
352
  result?: unknown;
353
+ sent_at: string | null;
348
354
  seq: number;
349
355
  sub_conversation_id: string | null;
350
356
  tentative: boolean;
@@ -0,0 +1,61 @@
1
+ import type { Transport } from "../http.js";
2
+ import type { Schemas } from "../schemas.js";
3
+ export type CostMetrics = Schemas["CostMetrics"];
4
+ export type CostDimension = Schemas["CostDimension"];
5
+ export type CostGranularity = Schemas["CostGranularity"];
6
+ /** Filter value selecting the spend where a dimension is empty — no user, no
7
+ * agent, no provider. Pass `null` in a filter list and it is sent as this. */
8
+ export declare const COST_NONE = "__none__";
9
+ export interface CostMetricsQuery {
10
+ /** Inclusive start. Defaults to 30 days before `to`. */
11
+ from?: Date | string;
12
+ /** Exclusive end. Defaults to now. */
13
+ to?: Date | string;
14
+ granularity?: CostGranularity;
15
+ /** IANA zone the buckets are cut in. Defaults to UTC. */
16
+ timezone?: string;
17
+ groupBy?: CostDimension[];
18
+ /** Per dimension, the values to keep; `null` keeps the spend with none.
19
+ * `tenant` only applies to the whole-instance route. */
20
+ filters?: Partial<Record<CostDimension, (string | null)[]>>;
21
+ }
22
+ /** Spend over time across the whole instance. Root only. */
23
+ export declare function instanceCostMetricsApi(t: Transport): {
24
+ get: (query?: CostMetricsQuery, signal?: AbortSignal) => Promise<{
25
+ backfill_cutover: string | null;
26
+ backfill_pending: boolean;
27
+ buckets: string[];
28
+ facets: import("../generated/schema.js").components["schemas"]["CostFacets"];
29
+ from: string;
30
+ granularity: import("../generated/schema.js").components["schemas"]["CostGranularity"];
31
+ group_by: import("../generated/schema.js").components["schemas"]["CostDimension"][];
32
+ groups: import("../generated/schema.js").components["schemas"]["CostGroup"][];
33
+ groups_truncated: boolean;
34
+ labels: import("../generated/schema.js").components["schemas"]["CostLabels"];
35
+ series: import("../generated/schema.js").components["schemas"]["CostSeriesPoint"][];
36
+ timezone: string;
37
+ to: string;
38
+ totals: import("../generated/schema.js").components["schemas"]["CostMeasures"];
39
+ unclassified_tokens: number;
40
+ }>;
41
+ };
42
+ /** One tenant's spend over time. Needs `conversations:read`. */
43
+ export declare function costMetricsApi(t: Transport, tenantSlug: string): {
44
+ get: (query?: CostMetricsQuery, signal?: AbortSignal) => Promise<{
45
+ backfill_cutover: string | null;
46
+ backfill_pending: boolean;
47
+ buckets: string[];
48
+ facets: import("../generated/schema.js").components["schemas"]["CostFacets"];
49
+ from: string;
50
+ granularity: import("../generated/schema.js").components["schemas"]["CostGranularity"];
51
+ group_by: import("../generated/schema.js").components["schemas"]["CostDimension"][];
52
+ groups: import("../generated/schema.js").components["schemas"]["CostGroup"][];
53
+ groups_truncated: boolean;
54
+ labels: import("../generated/schema.js").components["schemas"]["CostLabels"];
55
+ series: import("../generated/schema.js").components["schemas"]["CostSeriesPoint"][];
56
+ timezone: string;
57
+ to: string;
58
+ totals: import("../generated/schema.js").components["schemas"]["CostMeasures"];
59
+ unclassified_tokens: number;
60
+ }>;
61
+ };
@@ -90,8 +90,8 @@ export declare function sharedProvidersApi(t: Transport): {
90
90
  plugin: string;
91
91
  shared: boolean;
92
92
  slug: string;
93
- token_sku_directions: {
94
- [key: string]: import("../generated/schema.js").components["schemas"]["SkuDirection"];
93
+ token_sku_classes: {
94
+ [key: string]: import("../generated/schema.js").components["schemas"]["SkuClass"];
95
95
  };
96
96
  type: string;
97
97
  }>;
@@ -110,8 +110,8 @@ export declare function sharedProvidersApi(t: Transport): {
110
110
  plugin: string;
111
111
  shared: boolean;
112
112
  slug: string;
113
- token_sku_directions: {
114
- [key: string]: import("../generated/schema.js").components["schemas"]["SkuDirection"];
113
+ token_sku_classes: {
114
+ [key: string]: import("../generated/schema.js").components["schemas"]["SkuClass"];
115
115
  };
116
116
  type: string;
117
117
  }>;
@@ -7,6 +7,7 @@ import { channelsApi } from "./channels.js";
7
7
  import { clientToolsApi } from "./client-tools.js";
8
8
  import { componentLibrariesApi } from "./component-libraries.js";
9
9
  import { conversationsAdminApi } from "./conversations.js";
10
+ import { costMetricsApi, instanceCostMetricsApi } from "./cost-metrics.js";
10
11
  import { apiKeysApi, pluginsApi, sharedProvidersApi, tenantsApi } from "./global.js";
11
12
  import { knowledgeBasesApi } from "./knowledge-bases.js";
12
13
  import { mcpsApi } from "./mcps.js";
@@ -45,6 +46,7 @@ export interface TenantScope {
45
46
  backgroundTasks: ReturnType<typeof backgroundTasksApi>;
46
47
  conversations: ReturnType<typeof conversationsAdminApi>;
47
48
  clientTools: ReturnType<typeof clientToolsApi>;
49
+ costMetrics: ReturnType<typeof costMetricsApi>;
48
50
  }
49
51
  export interface AdminClient {
50
52
  health(signal?: AbortSignal): Promise<Schemas["Health"]>;
@@ -53,6 +55,7 @@ export interface AdminClient {
53
55
  apiKeys: ReturnType<typeof apiKeysApi>;
54
56
  sharedProviders: ReturnType<typeof sharedProvidersApi>;
55
57
  plugins: ReturnType<typeof pluginsApi>;
58
+ costMetrics: ReturnType<typeof instanceCostMetricsApi>;
56
59
  tenant(slug: string): TenantScope;
57
60
  /** Escape hatch for a route the SDK hasn't wrapped yet. Paths are absolute
58
61
  * (`/api/v1/…`) and auth is applied for you. */