@thinkai/tai-api-contract 2.8.6 → 2.9.1

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.
@@ -656,6 +656,23 @@ export interface paths {
656
656
  patch?: never;
657
657
  trace?: never;
658
658
  };
659
+ "/workspaces/{workspaceId}/integrations/ai-tool/{provider}/spend-daily": {
660
+ parameters: {
661
+ query?: never;
662
+ header?: never;
663
+ path?: never;
664
+ cookie?: never;
665
+ };
666
+ /** List AI-tool daily spend (historic Cursor filtered-usage rollup) */
667
+ get: operations["getWorkspaceAiToolSpendDaily"];
668
+ put?: never;
669
+ post?: never;
670
+ delete?: never;
671
+ options?: never;
672
+ head?: never;
673
+ patch?: never;
674
+ trace?: never;
675
+ };
659
676
  "/workspaces/{workspaceId}/integrations/ai-tool/{provider}/status": {
660
677
  parameters: {
661
678
  query?: never;
@@ -1238,6 +1255,46 @@ export interface paths {
1238
1255
  patch?: never;
1239
1256
  trace?: never;
1240
1257
  };
1258
+ "/workspaces/{workspaceId}/cursor/platform-key-consent": {
1259
+ parameters: {
1260
+ query?: never;
1261
+ header?: never;
1262
+ path?: never;
1263
+ cookie?: never;
1264
+ };
1265
+ get?: never;
1266
+ /**
1267
+ * Enable or disable ThinkAI platform Cursor key opt-in
1268
+ * @description Explicitly enable or disable use of ThinkAI's platform Cursor execution key for readiness scans. When enabled and the workspace has no `executionToken` configured, the platform key is used and tracked for billing. Requires workspace editor or admin role.
1269
+ */
1270
+ put: operations["putCursorPlatformKeyConsent"];
1271
+ post?: never;
1272
+ delete?: never;
1273
+ options?: never;
1274
+ head?: never;
1275
+ patch?: never;
1276
+ trace?: never;
1277
+ };
1278
+ "/workspaces/{workspaceId}/readiness/cursor-key-usage": {
1279
+ parameters: {
1280
+ query?: never;
1281
+ header?: never;
1282
+ path?: never;
1283
+ cookie?: never;
1284
+ };
1285
+ /**
1286
+ * Get Cursor key usage stats for this workspace
1287
+ * @description Returns per-workspace counts of readiness runs that used the ThinkAI platform Cursor key vs. the workspace's own execution key. Member-level access.
1288
+ */
1289
+ get: operations["getCursorKeyUsage"];
1290
+ put?: never;
1291
+ post?: never;
1292
+ delete?: never;
1293
+ options?: never;
1294
+ head?: never;
1295
+ patch?: never;
1296
+ trace?: never;
1297
+ };
1241
1298
  "/workspaces/{workspaceId}/squad": {
1242
1299
  parameters: {
1243
1300
  query?: never;
@@ -1652,12 +1709,14 @@ export interface components {
1652
1709
  } & {
1653
1710
  [key: string]: unknown;
1654
1711
  };
1655
- /** @description Cursor (AI Tools) source entry for `PUT /workspaces/{workspaceId}/sources` and `POST /workspaces/{workspaceId}/sources/test`. The `token` field carries a literal Cursor API key on writes; reads from `GET /workspaces/{workspaceId}/config` redact it to `***`. Runtime calls use the Cursor Admin API at `https://api.cursor.com` (HTTP Basic); do not rely on `baseUrl`. */
1712
+ /** @description Cursor source entry for `PUT /workspaces/{workspaceId}/sources` and `POST /workspaces/{workspaceId}/sources/test`. Two distinct keys: Admin API key (`token`) for insights sync; Execution key (`executionToken`) for readiness scanner and Agent CLI. On writes both fields accept literal key values; reads from `GET /workspaces/{workspaceId}/config` return a `CursorSourceConfigDto` shape (`hasToken` / `hasExecutionToken` booleans) raw values are never returned. */
1656
1713
  CursorSourceDto: {
1657
1714
  /** @enum {string} */
1658
1715
  type: "cursor";
1659
- /** @description Cursor API key (literal). Whitespace and `env:` prefix are rejected. */
1716
+ /** @description Cursor Admin API key (literal). Used for seats/spend/usage insights sync only. Whitespace and `env:` prefix are rejected. */
1660
1717
  token: string;
1718
+ /** @description Cursor execution key (literal). Used for the readiness scanner and Agent CLI. This is a Cursor user API key or service account key — NOT the Admin API key. Omit if using the ThinkAI platform key (requires `cursorPlatformKeyEnabled` on the workspace). Whitespace and `env:` prefix are rejected. */
1719
+ executionToken?: string;
1661
1720
  /**
1662
1721
  * @deprecated
1663
1722
  * @description Deprecated. Historically suggested an API base URL; the server ignores this field and always uses the Cursor Admin API host. Kept so older clients can submit payloads unchanged.
@@ -1665,6 +1724,15 @@ export interface components {
1665
1724
  */
1666
1725
  baseUrl: string;
1667
1726
  };
1727
+ /** @description Redacted Cursor source returned by `GET /workspaces/{workspaceId}/config`. `hasToken` and `hasExecutionToken` indicate which keys are stored. Raw values are never returned. */
1728
+ CursorSourceConfigDto: {
1729
+ /** @enum {string} */
1730
+ type: "cursor";
1731
+ /** @description Whether the Admin API key (`token`) is stored for this workspace. */
1732
+ hasToken: boolean;
1733
+ /** @description Whether the execution key is stored. If false and `cursorPlatformKeyEnabled` is true in `WorkspaceConfigDto`, the platform key will be used for readiness runs (additional cost applies). */
1734
+ hasExecutionToken: boolean;
1735
+ };
1668
1736
  /** @description Claude (Anthropic) source entry for `PUT /workspaces/{workspaceId}/sources` and `POST /workspaces/{workspaceId}/sources/test`. The `token` field carries a literal Organization Admin API key on writes (`sk-ant-admin...`); reads from `GET /workspaces/{workspaceId}/config` redact it to `***`. Runtime calls use the Anthropic Admin API at `https://api.anthropic.com`. Provision keys in Claude Console → Organization settings (admin role required). */
1669
1737
  ClaudeSourceDto: {
1670
1738
  /** @enum {string} */
@@ -1677,10 +1745,24 @@ export interface components {
1677
1745
  orgChart?: components["schemas"]["ScoringOrgChartDto"] | null;
1678
1746
  /** @enum {string|null} */
1679
1747
  region?: "us" | "eu" | "me" | null;
1748
+ /** @description When true, readiness runs may use the ThinkAI platform Cursor key if this workspace has no `executionToken` configured. Additional cost applies. Requires explicit opt-in via `PUT /workspaces/{workspaceId}/cursor/platform-key-consent`. */
1749
+ cursorPlatformKeyEnabled?: boolean;
1680
1750
  };
1681
1751
  TestConnectionResponseDto: {
1682
1752
  success: boolean;
1683
1753
  error?: string;
1754
+ /** @description Present when `executionToken` was included in the test request. `true` = key passed save-time validation (format + not-admin-key check). `false` = key failed validation (see `executionKeyError` for detail). `null` = `executionToken` was not provided. */
1755
+ executionKeyValid?: boolean | null;
1756
+ /** @description Error detail when `executionKeyValid` is false. */
1757
+ executionKeyError?: string | null;
1758
+ };
1759
+ CursorKeyUsageDto: {
1760
+ /** @description Readiness runs this calendar month that used the ThinkAI platform Cursor key. */
1761
+ platformKeyRunsThisMonth: number;
1762
+ /** @description All-time readiness runs that used the ThinkAI platform Cursor key. */
1763
+ platformKeyRunsTotal: number;
1764
+ /** @description All-time readiness runs that used the workspace's own execution key. */
1765
+ workspaceKeyRunsTotal: number;
1684
1766
  };
1685
1767
  AiToolSeatDto: {
1686
1768
  externalId: string;
@@ -1714,6 +1796,18 @@ export interface components {
1714
1796
  [key: string]: unknown;
1715
1797
  };
1716
1798
  };
1799
+ AiToolSpendDailyRowDto: {
1800
+ /** Format: date */
1801
+ day: string;
1802
+ externalId: string;
1803
+ email?: string | null;
1804
+ /** Format: int64 */
1805
+ spendCents: number;
1806
+ eventCount: number;
1807
+ payload?: {
1808
+ [key: string]: unknown;
1809
+ };
1810
+ };
1717
1811
  AiToolRefreshStatusDto: {
1718
1812
  /** Format: date-time */
1719
1813
  lastAttemptAt: string;
@@ -1726,6 +1820,8 @@ export interface components {
1726
1820
  counts: {
1727
1821
  [key: string]: unknown;
1728
1822
  };
1823
+ /** @description True while a workspace/provider refresh holds the Postgres advisory lock. */
1824
+ refreshInProgress?: boolean;
1729
1825
  };
1730
1826
  AiToolRefreshResponseDto: {
1731
1827
  ok: boolean;
@@ -2448,6 +2544,11 @@ export interface components {
2448
2544
  createdAt: string;
2449
2545
  /** Format: date-time */
2450
2546
  finishedAt: string | null;
2547
+ /**
2548
+ * @description Which Cursor execution key was used for this run. `workspace_execution_token`: workspace provided its own execution key. `platform_env_key`: ThinkAI platform key was used (opt-in required; additional cost applies). `null`: run did not reach the Cursor agent stage.
2549
+ * @enum {string|null}
2550
+ */
2551
+ cursorKeySource?: "workspace_execution_token" | "platform_env_key" | null;
2451
2552
  };
2452
2553
  ReadinessCriteriaSummaryDto: {
2453
2554
  total: number;
@@ -3037,12 +3138,15 @@ export type OrgChartImportResultDto = components['schemas']['OrgChartImportResul
3037
3138
  export type OrgChartSaveResultDto = components['schemas']['OrgChartSaveResultDto'];
3038
3139
  export type TenantSourceEntryDto = components['schemas']['TenantSourceEntryDto'];
3039
3140
  export type CursorSourceDto = components['schemas']['CursorSourceDto'];
3141
+ export type CursorSourceConfigDto = components['schemas']['CursorSourceConfigDto'];
3040
3142
  export type ClaudeSourceDto = components['schemas']['ClaudeSourceDto'];
3041
3143
  export type WorkspaceConfigDto = components['schemas']['WorkspaceConfigDto'];
3042
3144
  export type TestConnectionResponseDto = components['schemas']['TestConnectionResponseDto'];
3145
+ export type CursorKeyUsageDto = components['schemas']['CursorKeyUsageDto'];
3043
3146
  export type AiToolSeatDto = components['schemas']['AiToolSeatDto'];
3044
3147
  export type AiToolDailyUsageRowDto = components['schemas']['AiToolDailyUsageRowDto'];
3045
3148
  export type AiToolSpendRowDto = components['schemas']['AiToolSpendRowDto'];
3149
+ export type AiToolSpendDailyRowDto = components['schemas']['AiToolSpendDailyRowDto'];
3046
3150
  export type AiToolRefreshStatusDto = components['schemas']['AiToolRefreshStatusDto'];
3047
3151
  export type AiToolRefreshResponseDto = components['schemas']['AiToolRefreshResponseDto'];
3048
3152
  export type DashboardProductivityMetricsDto = components['schemas']['DashboardProductivityMetricsDto'];
@@ -4918,6 +5022,37 @@ export interface operations {
4918
5022
  403: components["responses"]["Forbidden"];
4919
5023
  };
4920
5024
  };
5025
+ getWorkspaceAiToolSpendDaily: {
5026
+ parameters: {
5027
+ query?: {
5028
+ from?: string;
5029
+ to?: string;
5030
+ externalId?: string;
5031
+ };
5032
+ header?: never;
5033
+ path: {
5034
+ workspaceId: components["parameters"]["WorkspaceId"];
5035
+ provider: "cursor" | "claude";
5036
+ };
5037
+ cookie?: never;
5038
+ };
5039
+ requestBody?: never;
5040
+ responses: {
5041
+ /** @description Daily spend rows */
5042
+ 200: {
5043
+ headers: {
5044
+ [name: string]: unknown;
5045
+ };
5046
+ content: {
5047
+ "application/json": {
5048
+ rows: components["schemas"]["AiToolSpendDailyRowDto"][];
5049
+ };
5050
+ };
5051
+ };
5052
+ 401: components["responses"]["Unauthorized"];
5053
+ 403: components["responses"]["Forbidden"];
5054
+ };
5055
+ };
4921
5056
  getWorkspaceAiToolRefreshStatus: {
4922
5057
  parameters: {
4923
5058
  query?: never;
@@ -6369,6 +6504,72 @@ export interface operations {
6369
6504
  };
6370
6505
  };
6371
6506
  };
6507
+ putCursorPlatformKeyConsent: {
6508
+ parameters: {
6509
+ query?: never;
6510
+ header?: never;
6511
+ path: {
6512
+ workspaceId: components["parameters"]["WorkspaceId"];
6513
+ };
6514
+ cookie?: never;
6515
+ };
6516
+ requestBody: {
6517
+ content: {
6518
+ "application/json": {
6519
+ /** @description true to opt in to ThinkAI platform Cursor key (additional cost applies); false to opt out. */
6520
+ enabled: boolean;
6521
+ };
6522
+ };
6523
+ };
6524
+ responses: {
6525
+ /** @description Consent updated */
6526
+ 200: {
6527
+ headers: {
6528
+ [name: string]: unknown;
6529
+ };
6530
+ content: {
6531
+ "application/json": {
6532
+ ok: boolean;
6533
+ };
6534
+ };
6535
+ };
6536
+ /** @description Invalid request body */
6537
+ 400: {
6538
+ headers: {
6539
+ [name: string]: unknown;
6540
+ };
6541
+ content: {
6542
+ "application/json": components["schemas"]["ErrorMessageDto"];
6543
+ };
6544
+ };
6545
+ 401: components["responses"]["Unauthorized"];
6546
+ 403: components["responses"]["Forbidden"];
6547
+ };
6548
+ };
6549
+ getCursorKeyUsage: {
6550
+ parameters: {
6551
+ query?: never;
6552
+ header?: never;
6553
+ path: {
6554
+ workspaceId: components["parameters"]["WorkspaceId"];
6555
+ };
6556
+ cookie?: never;
6557
+ };
6558
+ requestBody?: never;
6559
+ responses: {
6560
+ /** @description Cursor key usage stats */
6561
+ 200: {
6562
+ headers: {
6563
+ [name: string]: unknown;
6564
+ };
6565
+ content: {
6566
+ "application/json": components["schemas"]["CursorKeyUsageDto"];
6567
+ };
6568
+ };
6569
+ 401: components["responses"]["Unauthorized"];
6570
+ 403: components["responses"]["Forbidden"];
6571
+ };
6572
+ };
6372
6573
  getSquad: {
6373
6574
  parameters: {
6374
6575
  query?: never;