@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.
- package/dist/generated/openapi.d.ts +483 -0
- package/dist/generated/openapi.d.ts.map +1 -1
- package/openapi/openapi.yaml +444 -1
- package/package.json +1 -1
- package/src/generated/openapi.ts +483 -0
package/openapi/openapi.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
openapi: 3.0.3
|
|
2
2
|
info:
|
|
3
3
|
title: ThinkAI API
|
|
4
|
-
version: 2.
|
|
4
|
+
version: 2.186.0
|
|
5
5
|
description: >
|
|
6
6
|
Contract surface for the AI Driven SDLC backend used by ThinkAI.
|
|
7
7
|
Workspace-scoped routes use `/workspaces/{workspaceId}/...`.
|
|
@@ -1069,6 +1069,269 @@ paths:
|
|
|
1069
1069
|
error: Forbidden
|
|
1070
1070
|
code: forbidden
|
|
1071
1071
|
|
|
1072
|
+
/admin/automation-cost/summary:
|
|
1073
|
+
get:
|
|
1074
|
+
tags: [PlatformAdmin]
|
|
1075
|
+
summary: Estimated Agent automation spend by workspace and operation
|
|
1076
|
+
operationId: adminGetAutomationCostSummary
|
|
1077
|
+
description: >
|
|
1078
|
+
Rolls up `tai_readiness_token_usage` for the given UTC range (defaults to the current
|
|
1079
|
+
UTC calendar month when `from`/`to` are omitted). Each row is one
|
|
1080
|
+
`(workspaceId, operation)` with token totals, invocation count, and
|
|
1081
|
+
`estimatedSpendCents` from `workers.automationCost.pricing` (Cursor Auto pool list-rate
|
|
1082
|
+
defaults when keys are missing). Portfolio `totals` are sums of the returned rows.
|
|
1083
|
+
|
|
1084
|
+
**Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`.
|
|
1085
|
+
Separate from customer Insights AI Usage & Spend / `ai_cost_budget`.
|
|
1086
|
+
parameters:
|
|
1087
|
+
- name: workspaceId
|
|
1088
|
+
in: query
|
|
1089
|
+
required: false
|
|
1090
|
+
schema:
|
|
1091
|
+
type: string
|
|
1092
|
+
format: uuid
|
|
1093
|
+
description: Filter by workspace UUID.
|
|
1094
|
+
- name: from
|
|
1095
|
+
in: query
|
|
1096
|
+
required: false
|
|
1097
|
+
schema:
|
|
1098
|
+
type: string
|
|
1099
|
+
format: date-time
|
|
1100
|
+
description: Inclusive start (ISO-8601). Defaults to start of current UTC month.
|
|
1101
|
+
- name: to
|
|
1102
|
+
in: query
|
|
1103
|
+
required: false
|
|
1104
|
+
schema:
|
|
1105
|
+
type: string
|
|
1106
|
+
format: date-time
|
|
1107
|
+
description: Inclusive end (ISO-8601). Defaults to end of current UTC month.
|
|
1108
|
+
responses:
|
|
1109
|
+
"200":
|
|
1110
|
+
description: Summary rows and portfolio totals (empty rows / zero totals when no usage).
|
|
1111
|
+
content:
|
|
1112
|
+
application/json:
|
|
1113
|
+
schema:
|
|
1114
|
+
$ref: "#/components/schemas/AutomationCostSummaryDto"
|
|
1115
|
+
"401":
|
|
1116
|
+
description: Missing or invalid JWT.
|
|
1117
|
+
content:
|
|
1118
|
+
application/json:
|
|
1119
|
+
schema:
|
|
1120
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1121
|
+
"403":
|
|
1122
|
+
description: Caller is not a platform admin.
|
|
1123
|
+
content:
|
|
1124
|
+
application/json:
|
|
1125
|
+
schema:
|
|
1126
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1127
|
+
example:
|
|
1128
|
+
error: Forbidden
|
|
1129
|
+
code: forbidden
|
|
1130
|
+
|
|
1131
|
+
/admin/workspaces/{workspaceId}/automation-cost/budget:
|
|
1132
|
+
get:
|
|
1133
|
+
tags: [PlatformAdmin]
|
|
1134
|
+
summary: Get automation-cost budget and month status for a workspace
|
|
1135
|
+
operationId: adminGetAutomationCostBudget
|
|
1136
|
+
description: >
|
|
1137
|
+
Returns budget rows for `readiness_analysis` and/or `readiness_fix` with
|
|
1138
|
+
`monthSpendCents` (estimated from token rows in the current UTC month) and
|
|
1139
|
+
`status` (`ok` | `warn` | `hard_stopped` | `paused`). When no budget is configured,
|
|
1140
|
+
`monthlyBudgetCents` is null and status is `ok` (unlimited) unless paused.
|
|
1141
|
+
|
|
1142
|
+
**Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
|
|
1143
|
+
parameters:
|
|
1144
|
+
- $ref: "#/components/parameters/WorkspaceId"
|
|
1145
|
+
- name: operation
|
|
1146
|
+
in: query
|
|
1147
|
+
required: false
|
|
1148
|
+
schema:
|
|
1149
|
+
type: string
|
|
1150
|
+
enum: [readiness_analysis, readiness_fix]
|
|
1151
|
+
description: Limit to one operation; omit for both.
|
|
1152
|
+
responses:
|
|
1153
|
+
"200":
|
|
1154
|
+
description: Budget views for the requested operations.
|
|
1155
|
+
content:
|
|
1156
|
+
application/json:
|
|
1157
|
+
schema:
|
|
1158
|
+
$ref: "#/components/schemas/AutomationCostBudgetListDto"
|
|
1159
|
+
"401":
|
|
1160
|
+
description: Missing or invalid JWT.
|
|
1161
|
+
content:
|
|
1162
|
+
application/json:
|
|
1163
|
+
schema:
|
|
1164
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1165
|
+
"403":
|
|
1166
|
+
description: Caller is not a platform admin.
|
|
1167
|
+
content:
|
|
1168
|
+
application/json:
|
|
1169
|
+
schema:
|
|
1170
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1171
|
+
example:
|
|
1172
|
+
error: Forbidden
|
|
1173
|
+
code: forbidden
|
|
1174
|
+
"404":
|
|
1175
|
+
description: Workspace not found.
|
|
1176
|
+
content:
|
|
1177
|
+
application/json:
|
|
1178
|
+
schema:
|
|
1179
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1180
|
+
example:
|
|
1181
|
+
error: Workspace not found
|
|
1182
|
+
code: workspace_not_found
|
|
1183
|
+
put:
|
|
1184
|
+
tags: [PlatformAdmin]
|
|
1185
|
+
summary: Upsert automation-cost budget for one operation
|
|
1186
|
+
operationId: adminPutAutomationCostBudget
|
|
1187
|
+
description: >
|
|
1188
|
+
Upserts `{ operation, monthlyBudgetCents, warnThresholdPct, hardEnabled }` into
|
|
1189
|
+
workspace `automation_cost_budget` (not `ai_cost_budget`). Default `warnThresholdPct`
|
|
1190
|
+
is 80. `monthlyBudgetCents: 0` with `hardEnabled: true` is an immediate hard stop.
|
|
1191
|
+
Returns the refreshed budget view for that operation.
|
|
1192
|
+
|
|
1193
|
+
**Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
|
|
1194
|
+
parameters:
|
|
1195
|
+
- $ref: "#/components/parameters/WorkspaceId"
|
|
1196
|
+
requestBody:
|
|
1197
|
+
required: true
|
|
1198
|
+
content:
|
|
1199
|
+
application/json:
|
|
1200
|
+
schema:
|
|
1201
|
+
$ref: "#/components/schemas/AutomationCostBudgetUpsertDto"
|
|
1202
|
+
responses:
|
|
1203
|
+
"200":
|
|
1204
|
+
description: Updated budget view(s).
|
|
1205
|
+
content:
|
|
1206
|
+
application/json:
|
|
1207
|
+
schema:
|
|
1208
|
+
$ref: "#/components/schemas/AutomationCostBudgetListDto"
|
|
1209
|
+
"400":
|
|
1210
|
+
description: Invalid body.
|
|
1211
|
+
content:
|
|
1212
|
+
application/json:
|
|
1213
|
+
schema:
|
|
1214
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1215
|
+
"401":
|
|
1216
|
+
description: Missing or invalid JWT.
|
|
1217
|
+
content:
|
|
1218
|
+
application/json:
|
|
1219
|
+
schema:
|
|
1220
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1221
|
+
"403":
|
|
1222
|
+
description: Caller is not a platform admin.
|
|
1223
|
+
content:
|
|
1224
|
+
application/json:
|
|
1225
|
+
schema:
|
|
1226
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1227
|
+
example:
|
|
1228
|
+
error: Forbidden
|
|
1229
|
+
code: forbidden
|
|
1230
|
+
"404":
|
|
1231
|
+
description: Workspace not found.
|
|
1232
|
+
content:
|
|
1233
|
+
application/json:
|
|
1234
|
+
schema:
|
|
1235
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1236
|
+
example:
|
|
1237
|
+
error: Workspace not found
|
|
1238
|
+
code: workspace_not_found
|
|
1239
|
+
|
|
1240
|
+
/admin/workspaces/{workspaceId}/automation-cost/pause:
|
|
1241
|
+
post:
|
|
1242
|
+
tags: [PlatformAdmin]
|
|
1243
|
+
summary: Pause Agent automation for selected operations
|
|
1244
|
+
operationId: adminPostAutomationCostPause
|
|
1245
|
+
description: >
|
|
1246
|
+
Sets a per-workspace pause kill-switch for the listed operations. Workers honor pause
|
|
1247
|
+
the same as a hard budget stop (enforcement is a follow-up slice). Empty `operations`
|
|
1248
|
+
→ `400`.
|
|
1249
|
+
|
|
1250
|
+
**Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
|
|
1251
|
+
parameters:
|
|
1252
|
+
- $ref: "#/components/parameters/WorkspaceId"
|
|
1253
|
+
requestBody:
|
|
1254
|
+
required: true
|
|
1255
|
+
content:
|
|
1256
|
+
application/json:
|
|
1257
|
+
schema:
|
|
1258
|
+
$ref: "#/components/schemas/AutomationCostPauseBodyDto"
|
|
1259
|
+
responses:
|
|
1260
|
+
"200":
|
|
1261
|
+
description: Pause state stored.
|
|
1262
|
+
content:
|
|
1263
|
+
application/json:
|
|
1264
|
+
schema:
|
|
1265
|
+
$ref: "#/components/schemas/AutomationCostPauseResponseDto"
|
|
1266
|
+
"400":
|
|
1267
|
+
description: Empty or invalid operations list.
|
|
1268
|
+
content:
|
|
1269
|
+
application/json:
|
|
1270
|
+
schema:
|
|
1271
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1272
|
+
"401":
|
|
1273
|
+
description: Missing or invalid JWT.
|
|
1274
|
+
content:
|
|
1275
|
+
application/json:
|
|
1276
|
+
schema:
|
|
1277
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1278
|
+
"403":
|
|
1279
|
+
description: Caller is not a platform admin.
|
|
1280
|
+
content:
|
|
1281
|
+
application/json:
|
|
1282
|
+
schema:
|
|
1283
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1284
|
+
example:
|
|
1285
|
+
error: Forbidden
|
|
1286
|
+
code: forbidden
|
|
1287
|
+
"404":
|
|
1288
|
+
description: Workspace not found.
|
|
1289
|
+
content:
|
|
1290
|
+
application/json:
|
|
1291
|
+
schema:
|
|
1292
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1293
|
+
example:
|
|
1294
|
+
error: Workspace not found
|
|
1295
|
+
code: workspace_not_found
|
|
1296
|
+
delete:
|
|
1297
|
+
tags: [PlatformAdmin]
|
|
1298
|
+
summary: Clear automation-cost pause for a workspace
|
|
1299
|
+
operationId: adminDeleteAutomationCostPause
|
|
1300
|
+
description: >
|
|
1301
|
+
Clears `automation_cost_pause` for the workspace so workers may resume when under hard
|
|
1302
|
+
cap.
|
|
1303
|
+
|
|
1304
|
+
**Authorization:** Bearer JWT + `PLATFORM_ADMIN_EMAILS`.
|
|
1305
|
+
parameters:
|
|
1306
|
+
- $ref: "#/components/parameters/WorkspaceId"
|
|
1307
|
+
responses:
|
|
1308
|
+
"204":
|
|
1309
|
+
description: Pause cleared.
|
|
1310
|
+
"401":
|
|
1311
|
+
description: Missing or invalid JWT.
|
|
1312
|
+
content:
|
|
1313
|
+
application/json:
|
|
1314
|
+
schema:
|
|
1315
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1316
|
+
"403":
|
|
1317
|
+
description: Caller is not a platform admin.
|
|
1318
|
+
content:
|
|
1319
|
+
application/json:
|
|
1320
|
+
schema:
|
|
1321
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1322
|
+
example:
|
|
1323
|
+
error: Forbidden
|
|
1324
|
+
code: forbidden
|
|
1325
|
+
"404":
|
|
1326
|
+
description: Workspace not found.
|
|
1327
|
+
content:
|
|
1328
|
+
application/json:
|
|
1329
|
+
schema:
|
|
1330
|
+
$ref: "#/components/schemas/ErrorMessageDto"
|
|
1331
|
+
example:
|
|
1332
|
+
error: Workspace not found
|
|
1333
|
+
code: workspace_not_found
|
|
1334
|
+
|
|
1072
1335
|
/privacy-requests:
|
|
1073
1336
|
post:
|
|
1074
1337
|
tags: [PrivacyRequests]
|
|
@@ -25400,6 +25663,186 @@ components:
|
|
|
25400
25663
|
items:
|
|
25401
25664
|
$ref: "#/components/schemas/ActivityLogEntryDto"
|
|
25402
25665
|
|
|
25666
|
+
AutomationCostOperationDto:
|
|
25667
|
+
type: string
|
|
25668
|
+
enum: [readiness_analysis, readiness_fix]
|
|
25669
|
+
description: Platform Agent job type in the readiness token ledger.
|
|
25670
|
+
|
|
25671
|
+
AutomationCostSummaryRowDto:
|
|
25672
|
+
type: object
|
|
25673
|
+
required:
|
|
25674
|
+
- workspaceId
|
|
25675
|
+
- operation
|
|
25676
|
+
- inputTokens
|
|
25677
|
+
- outputTokens
|
|
25678
|
+
- cacheReadTokens
|
|
25679
|
+
- cacheWriteTokens
|
|
25680
|
+
- estimatedSpendCents
|
|
25681
|
+
- invocationCount
|
|
25682
|
+
properties:
|
|
25683
|
+
workspaceId:
|
|
25684
|
+
type: string
|
|
25685
|
+
format: uuid
|
|
25686
|
+
operation:
|
|
25687
|
+
$ref: "#/components/schemas/AutomationCostOperationDto"
|
|
25688
|
+
inputTokens:
|
|
25689
|
+
type: integer
|
|
25690
|
+
format: int64
|
|
25691
|
+
outputTokens:
|
|
25692
|
+
type: integer
|
|
25693
|
+
format: int64
|
|
25694
|
+
cacheReadTokens:
|
|
25695
|
+
type: integer
|
|
25696
|
+
format: int64
|
|
25697
|
+
cacheWriteTokens:
|
|
25698
|
+
type: integer
|
|
25699
|
+
format: int64
|
|
25700
|
+
estimatedSpendCents:
|
|
25701
|
+
type: integer
|
|
25702
|
+
description: Ops estimate from token totals × runtime-config pricing (integer cents).
|
|
25703
|
+
invocationCount:
|
|
25704
|
+
type: integer
|
|
25705
|
+
|
|
25706
|
+
AutomationCostSummaryTotalsDto:
|
|
25707
|
+
type: object
|
|
25708
|
+
required:
|
|
25709
|
+
- inputTokens
|
|
25710
|
+
- outputTokens
|
|
25711
|
+
- cacheReadTokens
|
|
25712
|
+
- cacheWriteTokens
|
|
25713
|
+
- estimatedSpendCents
|
|
25714
|
+
- invocationCount
|
|
25715
|
+
properties:
|
|
25716
|
+
inputTokens:
|
|
25717
|
+
type: integer
|
|
25718
|
+
format: int64
|
|
25719
|
+
outputTokens:
|
|
25720
|
+
type: integer
|
|
25721
|
+
format: int64
|
|
25722
|
+
cacheReadTokens:
|
|
25723
|
+
type: integer
|
|
25724
|
+
format: int64
|
|
25725
|
+
cacheWriteTokens:
|
|
25726
|
+
type: integer
|
|
25727
|
+
format: int64
|
|
25728
|
+
estimatedSpendCents:
|
|
25729
|
+
type: integer
|
|
25730
|
+
invocationCount:
|
|
25731
|
+
type: integer
|
|
25732
|
+
|
|
25733
|
+
AutomationCostSummaryDto:
|
|
25734
|
+
type: object
|
|
25735
|
+
required: [rows, totals]
|
|
25736
|
+
properties:
|
|
25737
|
+
rows:
|
|
25738
|
+
type: array
|
|
25739
|
+
items:
|
|
25740
|
+
$ref: "#/components/schemas/AutomationCostSummaryRowDto"
|
|
25741
|
+
totals:
|
|
25742
|
+
$ref: "#/components/schemas/AutomationCostSummaryTotalsDto"
|
|
25743
|
+
|
|
25744
|
+
AutomationCostBudgetStatusDto:
|
|
25745
|
+
type: string
|
|
25746
|
+
enum: [ok, warn, hard_stopped, paused]
|
|
25747
|
+
|
|
25748
|
+
AutomationCostBudgetViewDto:
|
|
25749
|
+
type: object
|
|
25750
|
+
required:
|
|
25751
|
+
- operation
|
|
25752
|
+
- monthlyBudgetCents
|
|
25753
|
+
- warnThresholdPct
|
|
25754
|
+
- hardEnabled
|
|
25755
|
+
- monthSpendCents
|
|
25756
|
+
- status
|
|
25757
|
+
- paused
|
|
25758
|
+
properties:
|
|
25759
|
+
operation:
|
|
25760
|
+
$ref: "#/components/schemas/AutomationCostOperationDto"
|
|
25761
|
+
monthlyBudgetCents:
|
|
25762
|
+
type: integer
|
|
25763
|
+
nullable: true
|
|
25764
|
+
description: Null when no budget is configured (unlimited).
|
|
25765
|
+
warnThresholdPct:
|
|
25766
|
+
type: integer
|
|
25767
|
+
minimum: 0
|
|
25768
|
+
maximum: 100
|
|
25769
|
+
hardEnabled:
|
|
25770
|
+
type: boolean
|
|
25771
|
+
monthSpendCents:
|
|
25772
|
+
type: integer
|
|
25773
|
+
description: Estimated spend for this operation in the current UTC calendar month.
|
|
25774
|
+
status:
|
|
25775
|
+
$ref: "#/components/schemas/AutomationCostBudgetStatusDto"
|
|
25776
|
+
paused:
|
|
25777
|
+
type: boolean
|
|
25778
|
+
pauseReason:
|
|
25779
|
+
type: string
|
|
25780
|
+
nullable: true
|
|
25781
|
+
|
|
25782
|
+
AutomationCostBudgetListDto:
|
|
25783
|
+
type: object
|
|
25784
|
+
required: [budgets]
|
|
25785
|
+
properties:
|
|
25786
|
+
budgets:
|
|
25787
|
+
type: array
|
|
25788
|
+
items:
|
|
25789
|
+
$ref: "#/components/schemas/AutomationCostBudgetViewDto"
|
|
25790
|
+
|
|
25791
|
+
AutomationCostBudgetUpsertDto:
|
|
25792
|
+
type: object
|
|
25793
|
+
required: [operation, monthlyBudgetCents]
|
|
25794
|
+
properties:
|
|
25795
|
+
operation:
|
|
25796
|
+
$ref: "#/components/schemas/AutomationCostOperationDto"
|
|
25797
|
+
monthlyBudgetCents:
|
|
25798
|
+
type: integer
|
|
25799
|
+
minimum: 0
|
|
25800
|
+
warnThresholdPct:
|
|
25801
|
+
type: integer
|
|
25802
|
+
minimum: 0
|
|
25803
|
+
maximum: 100
|
|
25804
|
+
default: 80
|
|
25805
|
+
hardEnabled:
|
|
25806
|
+
type: boolean
|
|
25807
|
+
default: false
|
|
25808
|
+
|
|
25809
|
+
AutomationCostPauseBodyDto:
|
|
25810
|
+
type: object
|
|
25811
|
+
required: [operations, reason]
|
|
25812
|
+
properties:
|
|
25813
|
+
operations:
|
|
25814
|
+
type: array
|
|
25815
|
+
minItems: 1
|
|
25816
|
+
items:
|
|
25817
|
+
$ref: "#/components/schemas/AutomationCostOperationDto"
|
|
25818
|
+
reason:
|
|
25819
|
+
type: string
|
|
25820
|
+
|
|
25821
|
+
AutomationCostPauseStateDto:
|
|
25822
|
+
type: object
|
|
25823
|
+
required: [operations, reason, pausedAt]
|
|
25824
|
+
properties:
|
|
25825
|
+
operations:
|
|
25826
|
+
type: array
|
|
25827
|
+
items:
|
|
25828
|
+
$ref: "#/components/schemas/AutomationCostOperationDto"
|
|
25829
|
+
reason:
|
|
25830
|
+
type: string
|
|
25831
|
+
pausedAt:
|
|
25832
|
+
type: string
|
|
25833
|
+
format: date-time
|
|
25834
|
+
pausedBy:
|
|
25835
|
+
type: string
|
|
25836
|
+
nullable: true
|
|
25837
|
+
description: Platform admin email that set the pause, when known.
|
|
25838
|
+
|
|
25839
|
+
AutomationCostPauseResponseDto:
|
|
25840
|
+
type: object
|
|
25841
|
+
required: [pause]
|
|
25842
|
+
properties:
|
|
25843
|
+
pause:
|
|
25844
|
+
$ref: "#/components/schemas/AutomationCostPauseStateDto"
|
|
25845
|
+
|
|
25403
25846
|
ReadinessTokenUsageRowDto:
|
|
25404
25847
|
type: object
|
|
25405
25848
|
required:
|