@thinkai/tai-api-contract 2.185.0 → 2.186.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -221,6 +221,79 @@ export interface paths {
221
221
  patch?: never;
222
222
  trace?: never;
223
223
  };
224
+ "/admin/automation-cost/summary": {
225
+ parameters: {
226
+ query?: never;
227
+ header?: never;
228
+ path?: never;
229
+ cookie?: never;
230
+ };
231
+ /**
232
+ * Estimated Agent automation spend by workspace and operation
233
+ * @description Rolls up `tai_readiness_token_usage` for the given UTC range (defaults to the current UTC calendar month when `from`/`to` are omitted). Each row is one `(workspaceId, operation)` with token totals, invocation count, and `estimatedSpendCents` from `workers.automationCost.pricing` (Cursor Auto pool list-rate defaults when keys are missing). Portfolio `totals` are sums of the returned rows.
234
+ * **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`. Separate from customer Insights AI Usage & Spend / `ai_cost_budget`.
235
+ */
236
+ get: operations["adminGetAutomationCostSummary"];
237
+ put?: never;
238
+ post?: never;
239
+ delete?: never;
240
+ options?: never;
241
+ head?: never;
242
+ patch?: never;
243
+ trace?: never;
244
+ };
245
+ "/admin/workspaces/{workspaceId}/automation-cost/budget": {
246
+ parameters: {
247
+ query?: never;
248
+ header?: never;
249
+ path?: never;
250
+ cookie?: never;
251
+ };
252
+ /**
253
+ * Get automation-cost budget and month status for a workspace
254
+ * @description Returns budget rows for `readiness_analysis` and/or `readiness_fix` with `monthSpendCents` (estimated from token rows in the current UTC month) and `status` (`ok` | `warn` | `hard_stopped` | `paused`). When no budget is configured, `monthlyBudgetCents` is null and status is `ok` (unlimited) unless paused.
255
+ * **Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
256
+ */
257
+ get: operations["adminGetAutomationCostBudget"];
258
+ /**
259
+ * Upsert automation-cost budget for one operation
260
+ * @description Upserts `{ operation, monthlyBudgetCents, warnThresholdPct, hardEnabled }` into workspace `automation_cost_budget` (not `ai_cost_budget`). Default `warnThresholdPct` is 80. `monthlyBudgetCents: 0` with `hardEnabled: true` is an immediate hard stop. Returns the refreshed budget view for that operation.
261
+ * **Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
262
+ */
263
+ put: operations["adminPutAutomationCostBudget"];
264
+ post?: never;
265
+ delete?: never;
266
+ options?: never;
267
+ head?: never;
268
+ patch?: never;
269
+ trace?: never;
270
+ };
271
+ "/admin/workspaces/{workspaceId}/automation-cost/pause": {
272
+ parameters: {
273
+ query?: never;
274
+ header?: never;
275
+ path?: never;
276
+ cookie?: never;
277
+ };
278
+ get?: never;
279
+ put?: never;
280
+ /**
281
+ * Pause Agent automation for selected operations
282
+ * @description Sets a per-workspace pause kill-switch for the listed operations. Workers honor pause the same as a hard budget stop (enforcement is a follow-up slice). Empty `operations` → `400`.
283
+ * **Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
284
+ */
285
+ post: operations["adminPostAutomationCostPause"];
286
+ /**
287
+ * Clear automation-cost pause for a workspace
288
+ * @description Clears `automation_cost_pause` for the workspace so workers may resume when under hard cap.
289
+ * **Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
290
+ */
291
+ delete: operations["adminDeleteAutomationCostPause"];
292
+ options?: never;
293
+ head?: never;
294
+ patch?: never;
295
+ trace?: never;
296
+ };
224
297
  "/privacy-requests": {
225
298
  parameters: {
226
299
  query?: never;
@@ -10540,6 +10613,83 @@ export interface components {
10540
10613
  ActivityLogPageDto: components["schemas"]["PageMetaDto"] & {
10541
10614
  items: components["schemas"]["ActivityLogEntryDto"][];
10542
10615
  };
10616
+ /**
10617
+ * @description Platform Agent job type in the readiness token ledger.
10618
+ * @enum {string}
10619
+ */
10620
+ AutomationCostOperationDto: "readiness_analysis" | "readiness_fix";
10621
+ AutomationCostSummaryRowDto: {
10622
+ /** Format: uuid */
10623
+ workspaceId: string;
10624
+ operation: components["schemas"]["AutomationCostOperationDto"];
10625
+ /** Format: int64 */
10626
+ inputTokens: number;
10627
+ /** Format: int64 */
10628
+ outputTokens: number;
10629
+ /** Format: int64 */
10630
+ cacheReadTokens: number;
10631
+ /** Format: int64 */
10632
+ cacheWriteTokens: number;
10633
+ /** @description Ops estimate from token totals × runtime-config pricing (integer cents). */
10634
+ estimatedSpendCents: number;
10635
+ invocationCount: number;
10636
+ };
10637
+ AutomationCostSummaryTotalsDto: {
10638
+ /** Format: int64 */
10639
+ inputTokens: number;
10640
+ /** Format: int64 */
10641
+ outputTokens: number;
10642
+ /** Format: int64 */
10643
+ cacheReadTokens: number;
10644
+ /** Format: int64 */
10645
+ cacheWriteTokens: number;
10646
+ estimatedSpendCents: number;
10647
+ invocationCount: number;
10648
+ };
10649
+ AutomationCostSummaryDto: {
10650
+ rows: components["schemas"]["AutomationCostSummaryRowDto"][];
10651
+ totals: components["schemas"]["AutomationCostSummaryTotalsDto"];
10652
+ };
10653
+ /** @enum {string} */
10654
+ AutomationCostBudgetStatusDto: "ok" | "warn" | "hard_stopped" | "paused";
10655
+ AutomationCostBudgetViewDto: {
10656
+ operation: components["schemas"]["AutomationCostOperationDto"];
10657
+ /** @description Null when no budget is configured (unlimited). */
10658
+ monthlyBudgetCents: number | null;
10659
+ warnThresholdPct: number;
10660
+ hardEnabled: boolean;
10661
+ /** @description Estimated spend for this operation in the current UTC calendar month. */
10662
+ monthSpendCents: number;
10663
+ status: components["schemas"]["AutomationCostBudgetStatusDto"];
10664
+ paused: boolean;
10665
+ pauseReason?: string | null;
10666
+ };
10667
+ AutomationCostBudgetListDto: {
10668
+ budgets: components["schemas"]["AutomationCostBudgetViewDto"][];
10669
+ };
10670
+ AutomationCostBudgetUpsertDto: {
10671
+ operation: components["schemas"]["AutomationCostOperationDto"];
10672
+ monthlyBudgetCents: number;
10673
+ /** @default 80 */
10674
+ warnThresholdPct: number;
10675
+ /** @default false */
10676
+ hardEnabled: boolean;
10677
+ };
10678
+ AutomationCostPauseBodyDto: {
10679
+ operations: components["schemas"]["AutomationCostOperationDto"][];
10680
+ reason: string;
10681
+ };
10682
+ AutomationCostPauseStateDto: {
10683
+ operations: components["schemas"]["AutomationCostOperationDto"][];
10684
+ reason: string;
10685
+ /** Format: date-time */
10686
+ pausedAt: string;
10687
+ /** @description Platform admin email that set the pause, when known. */
10688
+ pausedBy?: string | null;
10689
+ };
10690
+ AutomationCostPauseResponseDto: {
10691
+ pause: components["schemas"]["AutomationCostPauseStateDto"];
10692
+ };
10543
10693
  ReadinessTokenUsageRowDto: {
10544
10694
  /**
10545
10695
  * Format: uuid
@@ -13073,6 +13223,17 @@ export type ZenHrBranchSelectionResultDto = components['schemas']['ZenHrBranchSe
13073
13223
  export type HrisTriggerSyncResultDto = components['schemas']['HrisTriggerSyncResultDto'];
13074
13224
  export type HrisProviderSyncResultDto = components['schemas']['HrisProviderSyncResultDto'];
13075
13225
  export type ActivityLogPageDto = components['schemas']['ActivityLogPageDto'];
13226
+ export type AutomationCostOperationDto = components['schemas']['AutomationCostOperationDto'];
13227
+ export type AutomationCostSummaryRowDto = components['schemas']['AutomationCostSummaryRowDto'];
13228
+ export type AutomationCostSummaryTotalsDto = components['schemas']['AutomationCostSummaryTotalsDto'];
13229
+ export type AutomationCostSummaryDto = components['schemas']['AutomationCostSummaryDto'];
13230
+ export type AutomationCostBudgetStatusDto = components['schemas']['AutomationCostBudgetStatusDto'];
13231
+ export type AutomationCostBudgetViewDto = components['schemas']['AutomationCostBudgetViewDto'];
13232
+ export type AutomationCostBudgetListDto = components['schemas']['AutomationCostBudgetListDto'];
13233
+ export type AutomationCostBudgetUpsertDto = components['schemas']['AutomationCostBudgetUpsertDto'];
13234
+ export type AutomationCostPauseBodyDto = components['schemas']['AutomationCostPauseBodyDto'];
13235
+ export type AutomationCostPauseStateDto = components['schemas']['AutomationCostPauseStateDto'];
13236
+ export type AutomationCostPauseResponseDto = components['schemas']['AutomationCostPauseResponseDto'];
13076
13237
  export type ReadinessTokenUsageRowDto = components['schemas']['ReadinessTokenUsageRowDto'];
13077
13238
  export type ReadinessTokenUsageByDimensionRowDto = components['schemas']['ReadinessTokenUsageByDimensionRowDto'];
13078
13239
  export type SdlcModuleId = components['schemas']['SdlcModuleId'];
@@ -14106,6 +14267,328 @@ export interface operations {
14106
14267
  };
14107
14268
  };
14108
14269
  };
14270
+ adminGetAutomationCostSummary: {
14271
+ parameters: {
14272
+ query?: {
14273
+ /** @description Filter by workspace UUID. */
14274
+ workspaceId?: string;
14275
+ /** @description Inclusive start (ISO-8601). Defaults to start of current UTC month. */
14276
+ from?: string;
14277
+ /** @description Inclusive end (ISO-8601). Defaults to end of current UTC month. */
14278
+ to?: string;
14279
+ };
14280
+ header?: never;
14281
+ path?: never;
14282
+ cookie?: never;
14283
+ };
14284
+ requestBody?: never;
14285
+ responses: {
14286
+ /** @description Summary rows and portfolio totals (empty rows / zero totals when no usage). */
14287
+ 200: {
14288
+ headers: {
14289
+ [name: string]: unknown;
14290
+ };
14291
+ content: {
14292
+ "application/json": components["schemas"]["AutomationCostSummaryDto"];
14293
+ };
14294
+ };
14295
+ /** @description Missing or invalid JWT. */
14296
+ 401: {
14297
+ headers: {
14298
+ [name: string]: unknown;
14299
+ };
14300
+ content: {
14301
+ "application/json": components["schemas"]["ErrorMessageDto"];
14302
+ };
14303
+ };
14304
+ /** @description Caller is not a platform admin. */
14305
+ 403: {
14306
+ headers: {
14307
+ [name: string]: unknown;
14308
+ };
14309
+ content: {
14310
+ /**
14311
+ * @example {
14312
+ * "error": "Forbidden",
14313
+ * "code": "forbidden"
14314
+ * }
14315
+ */
14316
+ "application/json": components["schemas"]["ErrorMessageDto"];
14317
+ };
14318
+ };
14319
+ };
14320
+ };
14321
+ adminGetAutomationCostBudget: {
14322
+ parameters: {
14323
+ query?: {
14324
+ /** @description Limit to one operation; omit for both. */
14325
+ operation?: "readiness_analysis" | "readiness_fix";
14326
+ };
14327
+ header?: never;
14328
+ path: {
14329
+ workspaceId: components["parameters"]["WorkspaceId"];
14330
+ };
14331
+ cookie?: never;
14332
+ };
14333
+ requestBody?: never;
14334
+ responses: {
14335
+ /** @description Budget views for the requested operations. */
14336
+ 200: {
14337
+ headers: {
14338
+ [name: string]: unknown;
14339
+ };
14340
+ content: {
14341
+ "application/json": components["schemas"]["AutomationCostBudgetListDto"];
14342
+ };
14343
+ };
14344
+ /** @description Missing or invalid JWT. */
14345
+ 401: {
14346
+ headers: {
14347
+ [name: string]: unknown;
14348
+ };
14349
+ content: {
14350
+ "application/json": components["schemas"]["ErrorMessageDto"];
14351
+ };
14352
+ };
14353
+ /** @description Caller is not a platform admin. */
14354
+ 403: {
14355
+ headers: {
14356
+ [name: string]: unknown;
14357
+ };
14358
+ content: {
14359
+ /**
14360
+ * @example {
14361
+ * "error": "Forbidden",
14362
+ * "code": "forbidden"
14363
+ * }
14364
+ */
14365
+ "application/json": components["schemas"]["ErrorMessageDto"];
14366
+ };
14367
+ };
14368
+ /** @description Workspace not found. */
14369
+ 404: {
14370
+ headers: {
14371
+ [name: string]: unknown;
14372
+ };
14373
+ content: {
14374
+ /**
14375
+ * @example {
14376
+ * "error": "Workspace not found",
14377
+ * "code": "workspace_not_found"
14378
+ * }
14379
+ */
14380
+ "application/json": components["schemas"]["ErrorMessageDto"];
14381
+ };
14382
+ };
14383
+ };
14384
+ };
14385
+ adminPutAutomationCostBudget: {
14386
+ parameters: {
14387
+ query?: never;
14388
+ header?: never;
14389
+ path: {
14390
+ workspaceId: components["parameters"]["WorkspaceId"];
14391
+ };
14392
+ cookie?: never;
14393
+ };
14394
+ requestBody: {
14395
+ content: {
14396
+ "application/json": components["schemas"]["AutomationCostBudgetUpsertDto"];
14397
+ };
14398
+ };
14399
+ responses: {
14400
+ /** @description Updated budget view(s). */
14401
+ 200: {
14402
+ headers: {
14403
+ [name: string]: unknown;
14404
+ };
14405
+ content: {
14406
+ "application/json": components["schemas"]["AutomationCostBudgetListDto"];
14407
+ };
14408
+ };
14409
+ /** @description Invalid body. */
14410
+ 400: {
14411
+ headers: {
14412
+ [name: string]: unknown;
14413
+ };
14414
+ content: {
14415
+ "application/json": components["schemas"]["ErrorMessageDto"];
14416
+ };
14417
+ };
14418
+ /** @description Missing or invalid JWT. */
14419
+ 401: {
14420
+ headers: {
14421
+ [name: string]: unknown;
14422
+ };
14423
+ content: {
14424
+ "application/json": components["schemas"]["ErrorMessageDto"];
14425
+ };
14426
+ };
14427
+ /** @description Caller is not a platform admin. */
14428
+ 403: {
14429
+ headers: {
14430
+ [name: string]: unknown;
14431
+ };
14432
+ content: {
14433
+ /**
14434
+ * @example {
14435
+ * "error": "Forbidden",
14436
+ * "code": "forbidden"
14437
+ * }
14438
+ */
14439
+ "application/json": components["schemas"]["ErrorMessageDto"];
14440
+ };
14441
+ };
14442
+ /** @description Workspace not found. */
14443
+ 404: {
14444
+ headers: {
14445
+ [name: string]: unknown;
14446
+ };
14447
+ content: {
14448
+ /**
14449
+ * @example {
14450
+ * "error": "Workspace not found",
14451
+ * "code": "workspace_not_found"
14452
+ * }
14453
+ */
14454
+ "application/json": components["schemas"]["ErrorMessageDto"];
14455
+ };
14456
+ };
14457
+ };
14458
+ };
14459
+ adminPostAutomationCostPause: {
14460
+ parameters: {
14461
+ query?: never;
14462
+ header?: never;
14463
+ path: {
14464
+ workspaceId: components["parameters"]["WorkspaceId"];
14465
+ };
14466
+ cookie?: never;
14467
+ };
14468
+ requestBody: {
14469
+ content: {
14470
+ "application/json": components["schemas"]["AutomationCostPauseBodyDto"];
14471
+ };
14472
+ };
14473
+ responses: {
14474
+ /** @description Pause state stored. */
14475
+ 200: {
14476
+ headers: {
14477
+ [name: string]: unknown;
14478
+ };
14479
+ content: {
14480
+ "application/json": components["schemas"]["AutomationCostPauseResponseDto"];
14481
+ };
14482
+ };
14483
+ /** @description Empty or invalid operations list. */
14484
+ 400: {
14485
+ headers: {
14486
+ [name: string]: unknown;
14487
+ };
14488
+ content: {
14489
+ "application/json": components["schemas"]["ErrorMessageDto"];
14490
+ };
14491
+ };
14492
+ /** @description Missing or invalid JWT. */
14493
+ 401: {
14494
+ headers: {
14495
+ [name: string]: unknown;
14496
+ };
14497
+ content: {
14498
+ "application/json": components["schemas"]["ErrorMessageDto"];
14499
+ };
14500
+ };
14501
+ /** @description Caller is not a platform admin. */
14502
+ 403: {
14503
+ headers: {
14504
+ [name: string]: unknown;
14505
+ };
14506
+ content: {
14507
+ /**
14508
+ * @example {
14509
+ * "error": "Forbidden",
14510
+ * "code": "forbidden"
14511
+ * }
14512
+ */
14513
+ "application/json": components["schemas"]["ErrorMessageDto"];
14514
+ };
14515
+ };
14516
+ /** @description Workspace not found. */
14517
+ 404: {
14518
+ headers: {
14519
+ [name: string]: unknown;
14520
+ };
14521
+ content: {
14522
+ /**
14523
+ * @example {
14524
+ * "error": "Workspace not found",
14525
+ * "code": "workspace_not_found"
14526
+ * }
14527
+ */
14528
+ "application/json": components["schemas"]["ErrorMessageDto"];
14529
+ };
14530
+ };
14531
+ };
14532
+ };
14533
+ adminDeleteAutomationCostPause: {
14534
+ parameters: {
14535
+ query?: never;
14536
+ header?: never;
14537
+ path: {
14538
+ workspaceId: components["parameters"]["WorkspaceId"];
14539
+ };
14540
+ cookie?: never;
14541
+ };
14542
+ requestBody?: never;
14543
+ responses: {
14544
+ /** @description Pause cleared. */
14545
+ 204: {
14546
+ headers: {
14547
+ [name: string]: unknown;
14548
+ };
14549
+ content?: never;
14550
+ };
14551
+ /** @description Missing or invalid JWT. */
14552
+ 401: {
14553
+ headers: {
14554
+ [name: string]: unknown;
14555
+ };
14556
+ content: {
14557
+ "application/json": components["schemas"]["ErrorMessageDto"];
14558
+ };
14559
+ };
14560
+ /** @description Caller is not a platform admin. */
14561
+ 403: {
14562
+ headers: {
14563
+ [name: string]: unknown;
14564
+ };
14565
+ content: {
14566
+ /**
14567
+ * @example {
14568
+ * "error": "Forbidden",
14569
+ * "code": "forbidden"
14570
+ * }
14571
+ */
14572
+ "application/json": components["schemas"]["ErrorMessageDto"];
14573
+ };
14574
+ };
14575
+ /** @description Workspace not found. */
14576
+ 404: {
14577
+ headers: {
14578
+ [name: string]: unknown;
14579
+ };
14580
+ content: {
14581
+ /**
14582
+ * @example {
14583
+ * "error": "Workspace not found",
14584
+ * "code": "workspace_not_found"
14585
+ * }
14586
+ */
14587
+ "application/json": components["schemas"]["ErrorMessageDto"];
14588
+ };
14589
+ };
14590
+ };
14591
+ };
14109
14592
  submitPublicPrivacyRequest: {
14110
14593
  parameters: {
14111
14594
  query?: never;