@thinkai/tai-api-contract 2.2.9 → 2.3.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.
- package/dist/generated/openapi.d.ts +328 -7
- package/dist/generated/openapi.d.ts.map +1 -1
- package/openapi/openapi.yaml +325 -12
- package/package.json +1 -1
- package/src/generated/openapi.ts +328 -7
|
@@ -158,10 +158,10 @@ export interface paths {
|
|
|
158
158
|
get?: never;
|
|
159
159
|
/**
|
|
160
160
|
* Replace workspace data sources
|
|
161
|
-
* @description Replace the workspace's `sources` array. Cursor entries are validated strictly (`token` 1-256 chars, no whitespace, no `env:` prefix; optional deprecated `baseUrl` is accepted for backwards compatibility and ignored at runtime; verification and future refresh use the fixed Cursor Admin API host. Other types pass through with only a non-empty `type` requirement so existing
|
|
161
|
+
* @description Replace the workspace's `sources` array. Cursor entries are validated strictly (`token` 1-256 chars, no whitespace, no `env:` prefix; optional deprecated `baseUrl` is accepted for backwards compatibility and ignored at runtime; verification and future refresh use the fixed Cursor Admin API host. Other types pass through with only a non-empty `type` requirement so existing jira / sonarqube / bitbucket callers are not regressed. **`type: github` is rejected** with HTTP 400 and `code: github_sources_deprecated`; use the GitHub App integration (`POST /workspaces/{workspaceId}/integrations/github/install-url` and callback) instead.
|
|
162
162
|
* Every secret-keyed top-level string field (`token`, `password`, `api_key`, `secret`, `private_key`, `client_secret`) is encrypted at rest with AES-256-GCM under `SOURCES_TOKEN_ENC_KEY` before persistence; `env:`-prefixed values pass through unchanged. `GET /workspaces/{workspaceId}/config` continues to redact every secret-keyed field to `***` regardless of whether the stored value is encrypted, plaintext, or `env:` ref.
|
|
163
163
|
* Requires editor or admin workspace role.
|
|
164
|
-
* **Typical outcomes:** Valid typed sources → `200` with `{ ok: true, workspaceId }`. Missing required fields for a given `type`
|
|
164
|
+
* **Typical outcomes:** Valid typed sources → `200` with `{ ok: true, workspaceId }`. Missing required fields for a given `type` → `400` with `error` text. Unknown `type` strings (non-cursor, non-github) currently pass through to storage (lenient compatibility); only `cursor` entries get strict field validation. Cursor sources enforce strict token shape (no whitespace, no `env:` prefix).
|
|
165
165
|
*/
|
|
166
166
|
put: operations["putTenantSources"];
|
|
167
167
|
post?: never;
|
|
@@ -292,6 +292,94 @@ export interface paths {
|
|
|
292
292
|
patch?: never;
|
|
293
293
|
trace?: never;
|
|
294
294
|
};
|
|
295
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/refresh": {
|
|
296
|
+
parameters: {
|
|
297
|
+
query?: never;
|
|
298
|
+
header?: never;
|
|
299
|
+
path?: never;
|
|
300
|
+
cookie?: never;
|
|
301
|
+
};
|
|
302
|
+
get?: never;
|
|
303
|
+
put?: never;
|
|
304
|
+
/**
|
|
305
|
+
* Refresh AI tool integration snapshots
|
|
306
|
+
* @description Provider-agnostic refresh. Returns 409 when an advisory-lock refresh is already in progress. On upstream auth/rate/network failures, returns `200` with `{ ok:false, error }` so the SPA can render inline error.
|
|
307
|
+
*/
|
|
308
|
+
post: operations["refreshWorkspaceAiTool"];
|
|
309
|
+
delete?: never;
|
|
310
|
+
options?: never;
|
|
311
|
+
head?: never;
|
|
312
|
+
patch?: never;
|
|
313
|
+
trace?: never;
|
|
314
|
+
};
|
|
315
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/seats": {
|
|
316
|
+
parameters: {
|
|
317
|
+
query?: never;
|
|
318
|
+
header?: never;
|
|
319
|
+
path?: never;
|
|
320
|
+
cookie?: never;
|
|
321
|
+
};
|
|
322
|
+
/** List latest AI-tool seats */
|
|
323
|
+
get: operations["getWorkspaceAiToolSeats"];
|
|
324
|
+
put?: never;
|
|
325
|
+
post?: never;
|
|
326
|
+
delete?: never;
|
|
327
|
+
options?: never;
|
|
328
|
+
head?: never;
|
|
329
|
+
patch?: never;
|
|
330
|
+
trace?: never;
|
|
331
|
+
};
|
|
332
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/daily-usage": {
|
|
333
|
+
parameters: {
|
|
334
|
+
query?: never;
|
|
335
|
+
header?: never;
|
|
336
|
+
path?: never;
|
|
337
|
+
cookie?: never;
|
|
338
|
+
};
|
|
339
|
+
/** List AI-tool daily usage */
|
|
340
|
+
get: operations["getWorkspaceAiToolDailyUsage"];
|
|
341
|
+
put?: never;
|
|
342
|
+
post?: never;
|
|
343
|
+
delete?: never;
|
|
344
|
+
options?: never;
|
|
345
|
+
head?: never;
|
|
346
|
+
patch?: never;
|
|
347
|
+
trace?: never;
|
|
348
|
+
};
|
|
349
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/spend": {
|
|
350
|
+
parameters: {
|
|
351
|
+
query?: never;
|
|
352
|
+
header?: never;
|
|
353
|
+
path?: never;
|
|
354
|
+
cookie?: never;
|
|
355
|
+
};
|
|
356
|
+
/** List AI-tool spend */
|
|
357
|
+
get: operations["getWorkspaceAiToolSpend"];
|
|
358
|
+
put?: never;
|
|
359
|
+
post?: never;
|
|
360
|
+
delete?: never;
|
|
361
|
+
options?: never;
|
|
362
|
+
head?: never;
|
|
363
|
+
patch?: never;
|
|
364
|
+
trace?: never;
|
|
365
|
+
};
|
|
366
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/status": {
|
|
367
|
+
parameters: {
|
|
368
|
+
query?: never;
|
|
369
|
+
header?: never;
|
|
370
|
+
path?: never;
|
|
371
|
+
cookie?: never;
|
|
372
|
+
};
|
|
373
|
+
/** Get last refresh status */
|
|
374
|
+
get: operations["getWorkspaceAiToolRefreshStatus"];
|
|
375
|
+
put?: never;
|
|
376
|
+
post?: never;
|
|
377
|
+
delete?: never;
|
|
378
|
+
options?: never;
|
|
379
|
+
head?: never;
|
|
380
|
+
patch?: never;
|
|
381
|
+
trace?: never;
|
|
382
|
+
};
|
|
295
383
|
"/integrations/github/callback": {
|
|
296
384
|
parameters: {
|
|
297
385
|
query?: never;
|
|
@@ -772,6 +860,55 @@ export interface components {
|
|
|
772
860
|
success: boolean;
|
|
773
861
|
error?: string;
|
|
774
862
|
};
|
|
863
|
+
AiToolSeatDto: {
|
|
864
|
+
externalId: string;
|
|
865
|
+
email: string;
|
|
866
|
+
displayName?: string | null;
|
|
867
|
+
role?: string | null;
|
|
868
|
+
isRemoved: boolean;
|
|
869
|
+
payload?: {
|
|
870
|
+
[key: string]: unknown;
|
|
871
|
+
};
|
|
872
|
+
};
|
|
873
|
+
AiToolDailyUsageRowDto: {
|
|
874
|
+
/** Format: date */
|
|
875
|
+
day: string;
|
|
876
|
+
externalId: string;
|
|
877
|
+
email?: string | null;
|
|
878
|
+
isActive: boolean;
|
|
879
|
+
mostUsedModel?: string | null;
|
|
880
|
+
payload?: {
|
|
881
|
+
[key: string]: unknown;
|
|
882
|
+
};
|
|
883
|
+
};
|
|
884
|
+
AiToolSpendRowDto: {
|
|
885
|
+
/** Format: int64 */
|
|
886
|
+
billingCycleStartMs: number;
|
|
887
|
+
externalId: string;
|
|
888
|
+
email?: string | null;
|
|
889
|
+
/** Format: int64 */
|
|
890
|
+
spendCents: number;
|
|
891
|
+
payload?: {
|
|
892
|
+
[key: string]: unknown;
|
|
893
|
+
};
|
|
894
|
+
};
|
|
895
|
+
AiToolRefreshStatusDto: {
|
|
896
|
+
/** Format: date-time */
|
|
897
|
+
lastAttemptAt: string;
|
|
898
|
+
/** Format: date-time */
|
|
899
|
+
lastSuccessAt?: string | null;
|
|
900
|
+
lastErrorKind?: string | null;
|
|
901
|
+
lastErrorMessage?: string | null;
|
|
902
|
+
/** Format: int64 */
|
|
903
|
+
durationMs?: number | null;
|
|
904
|
+
counts: {
|
|
905
|
+
[key: string]: unknown;
|
|
906
|
+
};
|
|
907
|
+
};
|
|
908
|
+
AiToolRefreshResponseDto: {
|
|
909
|
+
ok: boolean;
|
|
910
|
+
error?: string | null;
|
|
911
|
+
};
|
|
775
912
|
/** @description Nested metric groups; see TypeScript `DashboardProductivityMetricsDto` in @thinkai/tai-api-contract. */
|
|
776
913
|
DashboardProductivityMetricsDto: {
|
|
777
914
|
[key: string]: unknown;
|
|
@@ -1244,6 +1381,11 @@ export type TenantSourceEntryDto = components['schemas']['TenantSourceEntryDto']
|
|
|
1244
1381
|
export type CursorSourceDto = components['schemas']['CursorSourceDto'];
|
|
1245
1382
|
export type WorkspaceConfigDto = components['schemas']['WorkspaceConfigDto'];
|
|
1246
1383
|
export type TestConnectionResponseDto = components['schemas']['TestConnectionResponseDto'];
|
|
1384
|
+
export type AiToolSeatDto = components['schemas']['AiToolSeatDto'];
|
|
1385
|
+
export type AiToolDailyUsageRowDto = components['schemas']['AiToolDailyUsageRowDto'];
|
|
1386
|
+
export type AiToolSpendRowDto = components['schemas']['AiToolSpendRowDto'];
|
|
1387
|
+
export type AiToolRefreshStatusDto = components['schemas']['AiToolRefreshStatusDto'];
|
|
1388
|
+
export type AiToolRefreshResponseDto = components['schemas']['AiToolRefreshResponseDto'];
|
|
1247
1389
|
export type DashboardProductivityMetricsDto = components['schemas']['DashboardProductivityMetricsDto'];
|
|
1248
1390
|
export type DashboardProductivityDto = components['schemas']['DashboardProductivityDto'];
|
|
1249
1391
|
export type DashboardProductivityHistoryDto = components['schemas']['DashboardProductivityHistoryDto'];
|
|
@@ -1672,11 +1814,6 @@ export interface operations {
|
|
|
1672
1814
|
[name: string]: unknown;
|
|
1673
1815
|
};
|
|
1674
1816
|
content: {
|
|
1675
|
-
/**
|
|
1676
|
-
* @example {
|
|
1677
|
-
* "error": "repo is required"
|
|
1678
|
-
* }
|
|
1679
|
-
*/
|
|
1680
1817
|
"application/json": components["schemas"]["ErrorMessageDto"];
|
|
1681
1818
|
};
|
|
1682
1819
|
};
|
|
@@ -2026,6 +2163,190 @@ export interface operations {
|
|
|
2026
2163
|
};
|
|
2027
2164
|
};
|
|
2028
2165
|
};
|
|
2166
|
+
refreshWorkspaceAiTool: {
|
|
2167
|
+
parameters: {
|
|
2168
|
+
query?: never;
|
|
2169
|
+
header?: never;
|
|
2170
|
+
path: {
|
|
2171
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2172
|
+
provider: "cursor";
|
|
2173
|
+
};
|
|
2174
|
+
cookie?: never;
|
|
2175
|
+
};
|
|
2176
|
+
requestBody?: never;
|
|
2177
|
+
responses: {
|
|
2178
|
+
/** @description Refresh result */
|
|
2179
|
+
200: {
|
|
2180
|
+
headers: {
|
|
2181
|
+
[name: string]: unknown;
|
|
2182
|
+
};
|
|
2183
|
+
content: {
|
|
2184
|
+
"application/json": components["schemas"]["AiToolRefreshResponseDto"];
|
|
2185
|
+
};
|
|
2186
|
+
};
|
|
2187
|
+
401: components["responses"]["Unauthorized"];
|
|
2188
|
+
403: components["responses"]["Forbidden"];
|
|
2189
|
+
/** @description Provider source missing for this workspace */
|
|
2190
|
+
404: {
|
|
2191
|
+
headers: {
|
|
2192
|
+
[name: string]: unknown;
|
|
2193
|
+
};
|
|
2194
|
+
content: {
|
|
2195
|
+
/**
|
|
2196
|
+
* @example {
|
|
2197
|
+
* "ok": false,
|
|
2198
|
+
* "error": "no_source"
|
|
2199
|
+
* }
|
|
2200
|
+
*/
|
|
2201
|
+
"application/json": components["schemas"]["AiToolRefreshResponseDto"];
|
|
2202
|
+
};
|
|
2203
|
+
};
|
|
2204
|
+
/** @description Refresh already in progress */
|
|
2205
|
+
409: {
|
|
2206
|
+
headers: {
|
|
2207
|
+
[name: string]: unknown;
|
|
2208
|
+
};
|
|
2209
|
+
content: {
|
|
2210
|
+
/**
|
|
2211
|
+
* @example {
|
|
2212
|
+
* "ok": false,
|
|
2213
|
+
* "error": "already_in_progress"
|
|
2214
|
+
* }
|
|
2215
|
+
*/
|
|
2216
|
+
"application/json": components["schemas"]["AiToolRefreshResponseDto"];
|
|
2217
|
+
};
|
|
2218
|
+
};
|
|
2219
|
+
};
|
|
2220
|
+
};
|
|
2221
|
+
getWorkspaceAiToolSeats: {
|
|
2222
|
+
parameters: {
|
|
2223
|
+
query?: never;
|
|
2224
|
+
header?: never;
|
|
2225
|
+
path: {
|
|
2226
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2227
|
+
provider: "cursor";
|
|
2228
|
+
};
|
|
2229
|
+
cookie?: never;
|
|
2230
|
+
};
|
|
2231
|
+
requestBody?: never;
|
|
2232
|
+
responses: {
|
|
2233
|
+
/** @description Seats */
|
|
2234
|
+
200: {
|
|
2235
|
+
headers: {
|
|
2236
|
+
[name: string]: unknown;
|
|
2237
|
+
};
|
|
2238
|
+
content: {
|
|
2239
|
+
"application/json": {
|
|
2240
|
+
seats: components["schemas"]["AiToolSeatDto"][];
|
|
2241
|
+
};
|
|
2242
|
+
};
|
|
2243
|
+
};
|
|
2244
|
+
401: components["responses"]["Unauthorized"];
|
|
2245
|
+
403: components["responses"]["Forbidden"];
|
|
2246
|
+
};
|
|
2247
|
+
};
|
|
2248
|
+
getWorkspaceAiToolDailyUsage: {
|
|
2249
|
+
parameters: {
|
|
2250
|
+
query?: {
|
|
2251
|
+
from?: string;
|
|
2252
|
+
to?: string;
|
|
2253
|
+
externalId?: string;
|
|
2254
|
+
};
|
|
2255
|
+
header?: never;
|
|
2256
|
+
path: {
|
|
2257
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2258
|
+
provider: "cursor";
|
|
2259
|
+
};
|
|
2260
|
+
cookie?: never;
|
|
2261
|
+
};
|
|
2262
|
+
requestBody?: never;
|
|
2263
|
+
responses: {
|
|
2264
|
+
/** @description Usage rows */
|
|
2265
|
+
200: {
|
|
2266
|
+
headers: {
|
|
2267
|
+
[name: string]: unknown;
|
|
2268
|
+
};
|
|
2269
|
+
content: {
|
|
2270
|
+
"application/json": {
|
|
2271
|
+
rows: components["schemas"]["AiToolDailyUsageRowDto"][];
|
|
2272
|
+
};
|
|
2273
|
+
};
|
|
2274
|
+
};
|
|
2275
|
+
401: components["responses"]["Unauthorized"];
|
|
2276
|
+
403: components["responses"]["Forbidden"];
|
|
2277
|
+
};
|
|
2278
|
+
};
|
|
2279
|
+
getWorkspaceAiToolSpend: {
|
|
2280
|
+
parameters: {
|
|
2281
|
+
query?: {
|
|
2282
|
+
cycleStartMs?: number;
|
|
2283
|
+
};
|
|
2284
|
+
header?: never;
|
|
2285
|
+
path: {
|
|
2286
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2287
|
+
provider: "cursor";
|
|
2288
|
+
};
|
|
2289
|
+
cookie?: never;
|
|
2290
|
+
};
|
|
2291
|
+
requestBody?: never;
|
|
2292
|
+
responses: {
|
|
2293
|
+
/** @description Spend rows */
|
|
2294
|
+
200: {
|
|
2295
|
+
headers: {
|
|
2296
|
+
[name: string]: unknown;
|
|
2297
|
+
};
|
|
2298
|
+
content: {
|
|
2299
|
+
"application/json": {
|
|
2300
|
+
rows: components["schemas"]["AiToolSpendRowDto"][];
|
|
2301
|
+
};
|
|
2302
|
+
};
|
|
2303
|
+
};
|
|
2304
|
+
401: components["responses"]["Unauthorized"];
|
|
2305
|
+
403: components["responses"]["Forbidden"];
|
|
2306
|
+
};
|
|
2307
|
+
};
|
|
2308
|
+
getWorkspaceAiToolRefreshStatus: {
|
|
2309
|
+
parameters: {
|
|
2310
|
+
query?: never;
|
|
2311
|
+
header?: never;
|
|
2312
|
+
path: {
|
|
2313
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2314
|
+
provider: "cursor";
|
|
2315
|
+
};
|
|
2316
|
+
cookie?: never;
|
|
2317
|
+
};
|
|
2318
|
+
requestBody?: never;
|
|
2319
|
+
responses: {
|
|
2320
|
+
/** @description Refresh status */
|
|
2321
|
+
200: {
|
|
2322
|
+
headers: {
|
|
2323
|
+
[name: string]: unknown;
|
|
2324
|
+
};
|
|
2325
|
+
content: {
|
|
2326
|
+
"application/json": {
|
|
2327
|
+
status: components["schemas"]["AiToolRefreshStatusDto"];
|
|
2328
|
+
};
|
|
2329
|
+
};
|
|
2330
|
+
};
|
|
2331
|
+
401: components["responses"]["Unauthorized"];
|
|
2332
|
+
403: components["responses"]["Forbidden"];
|
|
2333
|
+
/** @description No refresh status yet (or provider source missing) */
|
|
2334
|
+
404: {
|
|
2335
|
+
headers: {
|
|
2336
|
+
[name: string]: unknown;
|
|
2337
|
+
};
|
|
2338
|
+
content: {
|
|
2339
|
+
/**
|
|
2340
|
+
* @example {
|
|
2341
|
+
* "ok": false,
|
|
2342
|
+
* "error": "no_source"
|
|
2343
|
+
* }
|
|
2344
|
+
*/
|
|
2345
|
+
"application/json": components["schemas"]["AiToolRefreshResponseDto"];
|
|
2346
|
+
};
|
|
2347
|
+
};
|
|
2348
|
+
};
|
|
2349
|
+
};
|
|
2029
2350
|
getGithubInstallCallback: {
|
|
2030
2351
|
parameters: {
|
|
2031
2352
|
query: {
|