@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
package/src/generated/openapi.ts
CHANGED
|
@@ -159,10 +159,10 @@ export interface paths {
|
|
|
159
159
|
get?: never;
|
|
160
160
|
/**
|
|
161
161
|
* Replace workspace data sources
|
|
162
|
-
* @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
|
|
162
|
+
* @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.
|
|
163
163
|
* 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.
|
|
164
164
|
* Requires editor or admin workspace role.
|
|
165
|
-
* **Typical outcomes:** Valid typed sources → `200` with `{ ok: true, workspaceId }`. Missing required fields for a given `type`
|
|
165
|
+
* **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).
|
|
166
166
|
*/
|
|
167
167
|
put: operations["putTenantSources"];
|
|
168
168
|
post?: never;
|
|
@@ -293,6 +293,94 @@ export interface paths {
|
|
|
293
293
|
patch?: never;
|
|
294
294
|
trace?: never;
|
|
295
295
|
};
|
|
296
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/refresh": {
|
|
297
|
+
parameters: {
|
|
298
|
+
query?: never;
|
|
299
|
+
header?: never;
|
|
300
|
+
path?: never;
|
|
301
|
+
cookie?: never;
|
|
302
|
+
};
|
|
303
|
+
get?: never;
|
|
304
|
+
put?: never;
|
|
305
|
+
/**
|
|
306
|
+
* Refresh AI tool integration snapshots
|
|
307
|
+
* @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.
|
|
308
|
+
*/
|
|
309
|
+
post: operations["refreshWorkspaceAiTool"];
|
|
310
|
+
delete?: never;
|
|
311
|
+
options?: never;
|
|
312
|
+
head?: never;
|
|
313
|
+
patch?: never;
|
|
314
|
+
trace?: never;
|
|
315
|
+
};
|
|
316
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/seats": {
|
|
317
|
+
parameters: {
|
|
318
|
+
query?: never;
|
|
319
|
+
header?: never;
|
|
320
|
+
path?: never;
|
|
321
|
+
cookie?: never;
|
|
322
|
+
};
|
|
323
|
+
/** List latest AI-tool seats */
|
|
324
|
+
get: operations["getWorkspaceAiToolSeats"];
|
|
325
|
+
put?: never;
|
|
326
|
+
post?: never;
|
|
327
|
+
delete?: never;
|
|
328
|
+
options?: never;
|
|
329
|
+
head?: never;
|
|
330
|
+
patch?: never;
|
|
331
|
+
trace?: never;
|
|
332
|
+
};
|
|
333
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/daily-usage": {
|
|
334
|
+
parameters: {
|
|
335
|
+
query?: never;
|
|
336
|
+
header?: never;
|
|
337
|
+
path?: never;
|
|
338
|
+
cookie?: never;
|
|
339
|
+
};
|
|
340
|
+
/** List AI-tool daily usage */
|
|
341
|
+
get: operations["getWorkspaceAiToolDailyUsage"];
|
|
342
|
+
put?: never;
|
|
343
|
+
post?: never;
|
|
344
|
+
delete?: never;
|
|
345
|
+
options?: never;
|
|
346
|
+
head?: never;
|
|
347
|
+
patch?: never;
|
|
348
|
+
trace?: never;
|
|
349
|
+
};
|
|
350
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/spend": {
|
|
351
|
+
parameters: {
|
|
352
|
+
query?: never;
|
|
353
|
+
header?: never;
|
|
354
|
+
path?: never;
|
|
355
|
+
cookie?: never;
|
|
356
|
+
};
|
|
357
|
+
/** List AI-tool spend */
|
|
358
|
+
get: operations["getWorkspaceAiToolSpend"];
|
|
359
|
+
put?: never;
|
|
360
|
+
post?: never;
|
|
361
|
+
delete?: never;
|
|
362
|
+
options?: never;
|
|
363
|
+
head?: never;
|
|
364
|
+
patch?: never;
|
|
365
|
+
trace?: never;
|
|
366
|
+
};
|
|
367
|
+
"/workspaces/{workspaceId}/integrations/ai-tool/{provider}/status": {
|
|
368
|
+
parameters: {
|
|
369
|
+
query?: never;
|
|
370
|
+
header?: never;
|
|
371
|
+
path?: never;
|
|
372
|
+
cookie?: never;
|
|
373
|
+
};
|
|
374
|
+
/** Get last refresh status */
|
|
375
|
+
get: operations["getWorkspaceAiToolRefreshStatus"];
|
|
376
|
+
put?: never;
|
|
377
|
+
post?: never;
|
|
378
|
+
delete?: never;
|
|
379
|
+
options?: never;
|
|
380
|
+
head?: never;
|
|
381
|
+
patch?: never;
|
|
382
|
+
trace?: never;
|
|
383
|
+
};
|
|
296
384
|
"/integrations/github/callback": {
|
|
297
385
|
parameters: {
|
|
298
386
|
query?: never;
|
|
@@ -773,6 +861,55 @@ export interface components {
|
|
|
773
861
|
success: boolean;
|
|
774
862
|
error?: string;
|
|
775
863
|
};
|
|
864
|
+
AiToolSeatDto: {
|
|
865
|
+
externalId: string;
|
|
866
|
+
email: string;
|
|
867
|
+
displayName?: string | null;
|
|
868
|
+
role?: string | null;
|
|
869
|
+
isRemoved: boolean;
|
|
870
|
+
payload?: {
|
|
871
|
+
[key: string]: unknown;
|
|
872
|
+
};
|
|
873
|
+
};
|
|
874
|
+
AiToolDailyUsageRowDto: {
|
|
875
|
+
/** Format: date */
|
|
876
|
+
day: string;
|
|
877
|
+
externalId: string;
|
|
878
|
+
email?: string | null;
|
|
879
|
+
isActive: boolean;
|
|
880
|
+
mostUsedModel?: string | null;
|
|
881
|
+
payload?: {
|
|
882
|
+
[key: string]: unknown;
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
AiToolSpendRowDto: {
|
|
886
|
+
/** Format: int64 */
|
|
887
|
+
billingCycleStartMs: number;
|
|
888
|
+
externalId: string;
|
|
889
|
+
email?: string | null;
|
|
890
|
+
/** Format: int64 */
|
|
891
|
+
spendCents: number;
|
|
892
|
+
payload?: {
|
|
893
|
+
[key: string]: unknown;
|
|
894
|
+
};
|
|
895
|
+
};
|
|
896
|
+
AiToolRefreshStatusDto: {
|
|
897
|
+
/** Format: date-time */
|
|
898
|
+
lastAttemptAt: string;
|
|
899
|
+
/** Format: date-time */
|
|
900
|
+
lastSuccessAt?: string | null;
|
|
901
|
+
lastErrorKind?: string | null;
|
|
902
|
+
lastErrorMessage?: string | null;
|
|
903
|
+
/** Format: int64 */
|
|
904
|
+
durationMs?: number | null;
|
|
905
|
+
counts: {
|
|
906
|
+
[key: string]: unknown;
|
|
907
|
+
};
|
|
908
|
+
};
|
|
909
|
+
AiToolRefreshResponseDto: {
|
|
910
|
+
ok: boolean;
|
|
911
|
+
error?: string | null;
|
|
912
|
+
};
|
|
776
913
|
/** @description Nested metric groups; see TypeScript `DashboardProductivityMetricsDto` in @thinkai/tai-api-contract. */
|
|
777
914
|
DashboardProductivityMetricsDto: {
|
|
778
915
|
[key: string]: unknown;
|
|
@@ -1245,6 +1382,11 @@ export type TenantSourceEntryDto = components['schemas']['TenantSourceEntryDto']
|
|
|
1245
1382
|
export type CursorSourceDto = components['schemas']['CursorSourceDto'];
|
|
1246
1383
|
export type WorkspaceConfigDto = components['schemas']['WorkspaceConfigDto'];
|
|
1247
1384
|
export type TestConnectionResponseDto = components['schemas']['TestConnectionResponseDto'];
|
|
1385
|
+
export type AiToolSeatDto = components['schemas']['AiToolSeatDto'];
|
|
1386
|
+
export type AiToolDailyUsageRowDto = components['schemas']['AiToolDailyUsageRowDto'];
|
|
1387
|
+
export type AiToolSpendRowDto = components['schemas']['AiToolSpendRowDto'];
|
|
1388
|
+
export type AiToolRefreshStatusDto = components['schemas']['AiToolRefreshStatusDto'];
|
|
1389
|
+
export type AiToolRefreshResponseDto = components['schemas']['AiToolRefreshResponseDto'];
|
|
1248
1390
|
export type DashboardProductivityMetricsDto = components['schemas']['DashboardProductivityMetricsDto'];
|
|
1249
1391
|
export type DashboardProductivityDto = components['schemas']['DashboardProductivityDto'];
|
|
1250
1392
|
export type DashboardProductivityHistoryDto = components['schemas']['DashboardProductivityHistoryDto'];
|
|
@@ -1673,11 +1815,6 @@ export interface operations {
|
|
|
1673
1815
|
[name: string]: unknown;
|
|
1674
1816
|
};
|
|
1675
1817
|
content: {
|
|
1676
|
-
/**
|
|
1677
|
-
* @example {
|
|
1678
|
-
* "error": "repo is required"
|
|
1679
|
-
* }
|
|
1680
|
-
*/
|
|
1681
1818
|
"application/json": components["schemas"]["ErrorMessageDto"];
|
|
1682
1819
|
};
|
|
1683
1820
|
};
|
|
@@ -2027,6 +2164,190 @@ export interface operations {
|
|
|
2027
2164
|
};
|
|
2028
2165
|
};
|
|
2029
2166
|
};
|
|
2167
|
+
refreshWorkspaceAiTool: {
|
|
2168
|
+
parameters: {
|
|
2169
|
+
query?: never;
|
|
2170
|
+
header?: never;
|
|
2171
|
+
path: {
|
|
2172
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2173
|
+
provider: "cursor";
|
|
2174
|
+
};
|
|
2175
|
+
cookie?: never;
|
|
2176
|
+
};
|
|
2177
|
+
requestBody?: never;
|
|
2178
|
+
responses: {
|
|
2179
|
+
/** @description Refresh result */
|
|
2180
|
+
200: {
|
|
2181
|
+
headers: {
|
|
2182
|
+
[name: string]: unknown;
|
|
2183
|
+
};
|
|
2184
|
+
content: {
|
|
2185
|
+
"application/json": components["schemas"]["AiToolRefreshResponseDto"];
|
|
2186
|
+
};
|
|
2187
|
+
};
|
|
2188
|
+
401: components["responses"]["Unauthorized"];
|
|
2189
|
+
403: components["responses"]["Forbidden"];
|
|
2190
|
+
/** @description Provider source missing for this workspace */
|
|
2191
|
+
404: {
|
|
2192
|
+
headers: {
|
|
2193
|
+
[name: string]: unknown;
|
|
2194
|
+
};
|
|
2195
|
+
content: {
|
|
2196
|
+
/**
|
|
2197
|
+
* @example {
|
|
2198
|
+
* "ok": false,
|
|
2199
|
+
* "error": "no_source"
|
|
2200
|
+
* }
|
|
2201
|
+
*/
|
|
2202
|
+
"application/json": components["schemas"]["AiToolRefreshResponseDto"];
|
|
2203
|
+
};
|
|
2204
|
+
};
|
|
2205
|
+
/** @description Refresh already in progress */
|
|
2206
|
+
409: {
|
|
2207
|
+
headers: {
|
|
2208
|
+
[name: string]: unknown;
|
|
2209
|
+
};
|
|
2210
|
+
content: {
|
|
2211
|
+
/**
|
|
2212
|
+
* @example {
|
|
2213
|
+
* "ok": false,
|
|
2214
|
+
* "error": "already_in_progress"
|
|
2215
|
+
* }
|
|
2216
|
+
*/
|
|
2217
|
+
"application/json": components["schemas"]["AiToolRefreshResponseDto"];
|
|
2218
|
+
};
|
|
2219
|
+
};
|
|
2220
|
+
};
|
|
2221
|
+
};
|
|
2222
|
+
getWorkspaceAiToolSeats: {
|
|
2223
|
+
parameters: {
|
|
2224
|
+
query?: never;
|
|
2225
|
+
header?: never;
|
|
2226
|
+
path: {
|
|
2227
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2228
|
+
provider: "cursor";
|
|
2229
|
+
};
|
|
2230
|
+
cookie?: never;
|
|
2231
|
+
};
|
|
2232
|
+
requestBody?: never;
|
|
2233
|
+
responses: {
|
|
2234
|
+
/** @description Seats */
|
|
2235
|
+
200: {
|
|
2236
|
+
headers: {
|
|
2237
|
+
[name: string]: unknown;
|
|
2238
|
+
};
|
|
2239
|
+
content: {
|
|
2240
|
+
"application/json": {
|
|
2241
|
+
seats: components["schemas"]["AiToolSeatDto"][];
|
|
2242
|
+
};
|
|
2243
|
+
};
|
|
2244
|
+
};
|
|
2245
|
+
401: components["responses"]["Unauthorized"];
|
|
2246
|
+
403: components["responses"]["Forbidden"];
|
|
2247
|
+
};
|
|
2248
|
+
};
|
|
2249
|
+
getWorkspaceAiToolDailyUsage: {
|
|
2250
|
+
parameters: {
|
|
2251
|
+
query?: {
|
|
2252
|
+
from?: string;
|
|
2253
|
+
to?: string;
|
|
2254
|
+
externalId?: string;
|
|
2255
|
+
};
|
|
2256
|
+
header?: never;
|
|
2257
|
+
path: {
|
|
2258
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2259
|
+
provider: "cursor";
|
|
2260
|
+
};
|
|
2261
|
+
cookie?: never;
|
|
2262
|
+
};
|
|
2263
|
+
requestBody?: never;
|
|
2264
|
+
responses: {
|
|
2265
|
+
/** @description Usage rows */
|
|
2266
|
+
200: {
|
|
2267
|
+
headers: {
|
|
2268
|
+
[name: string]: unknown;
|
|
2269
|
+
};
|
|
2270
|
+
content: {
|
|
2271
|
+
"application/json": {
|
|
2272
|
+
rows: components["schemas"]["AiToolDailyUsageRowDto"][];
|
|
2273
|
+
};
|
|
2274
|
+
};
|
|
2275
|
+
};
|
|
2276
|
+
401: components["responses"]["Unauthorized"];
|
|
2277
|
+
403: components["responses"]["Forbidden"];
|
|
2278
|
+
};
|
|
2279
|
+
};
|
|
2280
|
+
getWorkspaceAiToolSpend: {
|
|
2281
|
+
parameters: {
|
|
2282
|
+
query?: {
|
|
2283
|
+
cycleStartMs?: number;
|
|
2284
|
+
};
|
|
2285
|
+
header?: never;
|
|
2286
|
+
path: {
|
|
2287
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2288
|
+
provider: "cursor";
|
|
2289
|
+
};
|
|
2290
|
+
cookie?: never;
|
|
2291
|
+
};
|
|
2292
|
+
requestBody?: never;
|
|
2293
|
+
responses: {
|
|
2294
|
+
/** @description Spend rows */
|
|
2295
|
+
200: {
|
|
2296
|
+
headers: {
|
|
2297
|
+
[name: string]: unknown;
|
|
2298
|
+
};
|
|
2299
|
+
content: {
|
|
2300
|
+
"application/json": {
|
|
2301
|
+
rows: components["schemas"]["AiToolSpendRowDto"][];
|
|
2302
|
+
};
|
|
2303
|
+
};
|
|
2304
|
+
};
|
|
2305
|
+
401: components["responses"]["Unauthorized"];
|
|
2306
|
+
403: components["responses"]["Forbidden"];
|
|
2307
|
+
};
|
|
2308
|
+
};
|
|
2309
|
+
getWorkspaceAiToolRefreshStatus: {
|
|
2310
|
+
parameters: {
|
|
2311
|
+
query?: never;
|
|
2312
|
+
header?: never;
|
|
2313
|
+
path: {
|
|
2314
|
+
workspaceId: components["parameters"]["WorkspaceId"];
|
|
2315
|
+
provider: "cursor";
|
|
2316
|
+
};
|
|
2317
|
+
cookie?: never;
|
|
2318
|
+
};
|
|
2319
|
+
requestBody?: never;
|
|
2320
|
+
responses: {
|
|
2321
|
+
/** @description Refresh status */
|
|
2322
|
+
200: {
|
|
2323
|
+
headers: {
|
|
2324
|
+
[name: string]: unknown;
|
|
2325
|
+
};
|
|
2326
|
+
content: {
|
|
2327
|
+
"application/json": {
|
|
2328
|
+
status: components["schemas"]["AiToolRefreshStatusDto"];
|
|
2329
|
+
};
|
|
2330
|
+
};
|
|
2331
|
+
};
|
|
2332
|
+
401: components["responses"]["Unauthorized"];
|
|
2333
|
+
403: components["responses"]["Forbidden"];
|
|
2334
|
+
/** @description No refresh status yet (or provider source missing) */
|
|
2335
|
+
404: {
|
|
2336
|
+
headers: {
|
|
2337
|
+
[name: string]: unknown;
|
|
2338
|
+
};
|
|
2339
|
+
content: {
|
|
2340
|
+
/**
|
|
2341
|
+
* @example {
|
|
2342
|
+
* "ok": false,
|
|
2343
|
+
* "error": "no_source"
|
|
2344
|
+
* }
|
|
2345
|
+
*/
|
|
2346
|
+
"application/json": components["schemas"]["AiToolRefreshResponseDto"];
|
|
2347
|
+
};
|
|
2348
|
+
};
|
|
2349
|
+
};
|
|
2350
|
+
};
|
|
2030
2351
|
getGithubInstallCallback: {
|
|
2031
2352
|
parameters: {
|
|
2032
2353
|
query: {
|