@thinkai/tai-api-contract 2.166.0 → 2.167.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.
@@ -1,7 +1,7 @@
1
1
  openapi: 3.0.3
2
2
  info:
3
3
  title: ThinkAI API
4
- version: 2.166.0
4
+ version: 2.167.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}/...`.
@@ -153,6 +153,88 @@ paths:
153
153
  error: User not found
154
154
  code: user_not_found
155
155
 
156
+ /admin/users/{userId}/assessment-order:
157
+ put:
158
+ tags: [PlatformAdmin]
159
+ summary: Authorize one extra assessment workspace
160
+ operationId: adminSetAssessmentOrder
161
+ description: >
162
+ Sets `tai_users.assessment_order_authorized`. When true, that account may
163
+ create one workspace beyond the default single-workspace limit. The flag
164
+ stays set until an operator clears it. Buyers cannot set it on
165
+ `POST /workspaces`.
166
+
167
+ **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`.
168
+ All other callers receive `403 Forbidden`.
169
+ parameters:
170
+ - name: userId
171
+ in: path
172
+ required: true
173
+ schema:
174
+ type: string
175
+ format: uuid
176
+ description: "`tai_users.id` of the account to authorize."
177
+ requestBody:
178
+ required: true
179
+ content:
180
+ application/json:
181
+ schema:
182
+ type: object
183
+ required: [authorized]
184
+ properties:
185
+ authorized:
186
+ type: boolean
187
+ responses:
188
+ "204":
189
+ description: Authorization flag stored.
190
+ "400":
191
+ description: Invalid UUID or `authorized` is not a boolean.
192
+ content:
193
+ application/json:
194
+ schema:
195
+ $ref: "#/components/schemas/ErrorMessageDto"
196
+ examples:
197
+ invalid_user_id:
198
+ value:
199
+ error: Invalid user ID format
200
+ code: invalid_user_id
201
+ invalid_body:
202
+ value:
203
+ error: authorized must be boolean
204
+ code: invalid_body
205
+ "401":
206
+ description: Missing or invalid JWT.
207
+ content:
208
+ application/json:
209
+ schema:
210
+ $ref: "#/components/schemas/ErrorMessageDto"
211
+ "403":
212
+ description: Caller is not a platform admin.
213
+ content:
214
+ application/json:
215
+ schema:
216
+ $ref: "#/components/schemas/ErrorMessageDto"
217
+ example:
218
+ error: Forbidden
219
+ code: forbidden
220
+ "404":
221
+ description: User not found.
222
+ content:
223
+ application/json:
224
+ schema:
225
+ $ref: "#/components/schemas/ErrorMessageDto"
226
+ example:
227
+ error: User not found
228
+ code: user_not_found
229
+ "503":
230
+ description: Workspace store cannot persist the flag.
231
+ content:
232
+ application/json:
233
+ schema:
234
+ $ref: "#/components/schemas/ErrorMessageDto"
235
+ example:
236
+ error: Service unavailable
237
+
156
238
  /admin/readiness/token-usage:
157
239
  get:
158
240
  tags: [PlatformAdmin]
@@ -953,7 +1035,12 @@ paths:
953
1035
  schema:
954
1036
  $ref: "#/components/schemas/ErrorMessageDto"
955
1037
  "409":
956
- description: Conflict creating workspace (verified-email identity conflict or duplicate workspace name/slug)
1038
+ description: >
1039
+ Conflict creating workspace. Stable cases: verified-email identity conflict,
1040
+ duplicate workspace name/slug, or `workspace_limit_reached` when the caller
1041
+ already has a workspace. An operator-authorized account (`PUT /admin/users/{userId}/assessment-order`)
1042
+ may create exactly one extra workspace; a third workspace still returns
1043
+ `workspace_limit_reached`. A buyer body field cannot grant that exception.
957
1044
  content:
958
1045
  application/json:
959
1046
  schema:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.166.0",
3
+ "version": "2.167.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -25,6 +25,27 @@ export interface paths {
25
25
  patch?: never;
26
26
  trace?: never;
27
27
  };
28
+ "/admin/users/{userId}/assessment-order": {
29
+ parameters: {
30
+ query?: never;
31
+ header?: never;
32
+ path?: never;
33
+ cookie?: never;
34
+ };
35
+ get?: never;
36
+ /**
37
+ * Authorize one extra assessment workspace
38
+ * @description Sets `tai_users.assessment_order_authorized`. When true, that account may create one workspace beyond the default single-workspace limit. The flag stays set until an operator clears it. Buyers cannot set it on `POST /workspaces`.
39
+ * **Authorization:** Bearer JWT required. Caller email must appear in `PLATFORM_ADMIN_EMAILS`. All other callers receive `403 Forbidden`.
40
+ */
41
+ put: operations["adminSetAssessmentOrder"];
42
+ post?: never;
43
+ delete?: never;
44
+ options?: never;
45
+ head?: never;
46
+ patch?: never;
47
+ trace?: never;
48
+ };
28
49
  "/admin/readiness/token-usage": {
29
50
  parameters: {
30
51
  query?: never;
@@ -11723,6 +11744,95 @@ export interface operations {
11723
11744
  };
11724
11745
  };
11725
11746
  };
11747
+ adminSetAssessmentOrder: {
11748
+ parameters: {
11749
+ query?: never;
11750
+ header?: never;
11751
+ path: {
11752
+ /** @description `tai_users.id` of the account to authorize. */
11753
+ userId: string;
11754
+ };
11755
+ cookie?: never;
11756
+ };
11757
+ requestBody: {
11758
+ content: {
11759
+ "application/json": {
11760
+ authorized: boolean;
11761
+ };
11762
+ };
11763
+ };
11764
+ responses: {
11765
+ /** @description Authorization flag stored. */
11766
+ 204: {
11767
+ headers: {
11768
+ [name: string]: unknown;
11769
+ };
11770
+ content?: never;
11771
+ };
11772
+ /** @description Invalid UUID or `authorized` is not a boolean. */
11773
+ 400: {
11774
+ headers: {
11775
+ [name: string]: unknown;
11776
+ };
11777
+ content: {
11778
+ "application/json": components["schemas"]["ErrorMessageDto"];
11779
+ };
11780
+ };
11781
+ /** @description Missing or invalid JWT. */
11782
+ 401: {
11783
+ headers: {
11784
+ [name: string]: unknown;
11785
+ };
11786
+ content: {
11787
+ "application/json": components["schemas"]["ErrorMessageDto"];
11788
+ };
11789
+ };
11790
+ /** @description Caller is not a platform admin. */
11791
+ 403: {
11792
+ headers: {
11793
+ [name: string]: unknown;
11794
+ };
11795
+ content: {
11796
+ /**
11797
+ * @example {
11798
+ * "error": "Forbidden",
11799
+ * "code": "forbidden"
11800
+ * }
11801
+ */
11802
+ "application/json": components["schemas"]["ErrorMessageDto"];
11803
+ };
11804
+ };
11805
+ /** @description User not found. */
11806
+ 404: {
11807
+ headers: {
11808
+ [name: string]: unknown;
11809
+ };
11810
+ content: {
11811
+ /**
11812
+ * @example {
11813
+ * "error": "User not found",
11814
+ * "code": "user_not_found"
11815
+ * }
11816
+ */
11817
+ "application/json": components["schemas"]["ErrorMessageDto"];
11818
+ };
11819
+ };
11820
+ /** @description Workspace store cannot persist the flag. */
11821
+ 503: {
11822
+ headers: {
11823
+ [name: string]: unknown;
11824
+ };
11825
+ content: {
11826
+ /**
11827
+ * @example {
11828
+ * "error": "Service unavailable"
11829
+ * }
11830
+ */
11831
+ "application/json": components["schemas"]["ErrorMessageDto"];
11832
+ };
11833
+ };
11834
+ };
11835
+ };
11726
11836
  adminListReadinessTokenUsage: {
11727
11837
  parameters: {
11728
11838
  query?: {
@@ -12587,7 +12697,7 @@ export interface operations {
12587
12697
  };
12588
12698
  };
12589
12699
  401: components["responses"]["Unauthorized"];
12590
- /** @description Conflict creating workspace (verified-email identity conflict or duplicate workspace name/slug) */
12700
+ /** @description Conflict creating workspace. Stable cases: verified-email identity conflict, duplicate workspace name/slug, or `workspace_limit_reached` when the caller already has a workspace. An operator-authorized account (`PUT /admin/users/{userId}/assessment-order`) may create exactly one extra workspace; a third workspace still returns `workspace_limit_reached`. A buyer body field cannot grant that exception. */
12591
12701
  409: {
12592
12702
  headers: {
12593
12703
  [name: string]: unknown;