@thinkai/tai-api-contract 2.4.1 → 2.4.4

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,13 +1,13 @@
1
1
  openapi: 3.0.3
2
2
  info:
3
3
  title: ThinkAI API
4
- version: 2.4.1
4
+ version: 2.4.4
5
5
  description: >
6
6
  Contract surface for the AI Driven SDLC backend used by ThinkAI.
7
7
  Workspace-scoped routes use `/workspaces/{workspaceId}/...`.
8
8
  Legacy tenant-scoped routes (`/tenants/{tenantId}/...`, `/me/tenants`) were removed from runtime.
9
9
  Legacy HTTP routes that exist on the server but are not listed here (for example
10
- `PUT /workspaces/{workspaceId}/dashboard-settings`) remain supported for existing PIP clients;
10
+ `PUT /workspaces/{workspaceId}/dashboard-settings`) remain supported for existing API clients;
11
11
  prefer OpenAPI-documented equivalents where available. Removal will be coordinated with ThinkAI releases.
12
12
 
13
13
  **Acceptance intent:** Per-operation behavior (happy paths, validation, and representative errors)
@@ -235,18 +235,17 @@ paths:
235
235
  operationId: getTenantOrgChart
236
236
  parameters:
237
237
  - $ref: "#/components/parameters/WorkspaceId"
238
- - name: withScores
239
- in: query
240
- schema: { type: boolean }
241
238
  responses:
242
239
  "200":
243
- description: Org chart (optionally with per-node scores)
240
+ description: SPA org structure chart (`spa_org_chart`; per-node scores not included — use GET /config for scoring tree)
244
241
  content:
245
242
  application/json:
246
243
  schema:
247
244
  $ref: "#/components/schemas/OrgChartDto"
248
245
  "401":
249
246
  $ref: "#/components/responses/Unauthorized"
247
+ "403":
248
+ $ref: "#/components/responses/Forbidden"
250
249
  "404":
251
250
  description: Workspace not found
252
251
  post:
@@ -267,13 +266,17 @@ paths:
267
266
  content:
268
267
  application/json:
269
268
  schema:
270
- type: object
271
- required: [ok, workspaceId]
272
- properties:
273
- ok: { type: boolean }
274
- workspaceId: { type: string }
269
+ $ref: "#/components/schemas/OrgChartSaveResultDto"
270
+ "400":
271
+ description: Invalid request body or chart limits exceeded
272
+ content:
273
+ application/json:
274
+ schema:
275
+ $ref: "#/components/schemas/ErrorMessageDto"
275
276
  "401":
276
277
  $ref: "#/components/responses/Unauthorized"
278
+ "403":
279
+ $ref: "#/components/responses/Forbidden"
277
280
 
278
281
  /workspaces/{workspaceId}/config:
279
282
  get:
@@ -1514,6 +1517,8 @@ paths:
1514
1517
  defaultBranch: main
1515
1518
  externalId: null
1516
1519
  hostBaseUrl: null
1520
+ analysisStatus: idle
1521
+ activeRunId: null
1517
1522
  "401":
1518
1523
  $ref: "#/components/responses/Unauthorized"
1519
1524
  "403":
@@ -1755,6 +1760,9 @@ paths:
1755
1760
  get:
1756
1761
  tags: [RepositoryReadiness]
1757
1762
  summary: Readiness dimensions catalog
1763
+ description: >
1764
+ Returns static rubric metadata (id, name, description, maxScore) aligned with the readiness
1765
+ scanner dimensions. Does not run scoring on the request path.
1758
1766
  operationId: listReadinessDimensions
1759
1767
  parameters:
1760
1768
  - $ref: "#/components/parameters/WorkspaceId"
@@ -1769,11 +1777,21 @@ paths:
1769
1777
  $ref: "#/components/schemas/ReadinessDimensionDto"
1770
1778
  "401":
1771
1779
  $ref: "#/components/responses/Unauthorized"
1780
+ "403":
1781
+ $ref: "#/components/responses/Forbidden"
1782
+ "404":
1783
+ description: Workspace does not exist
1784
+ content:
1785
+ application/json:
1786
+ schema:
1787
+ $ref: "#/components/schemas/ErrorMessageDto"
1772
1788
 
1773
1789
  /workspaces/{workspaceId}/readiness/fixes:
1774
1790
  get:
1775
1791
  tags: [RepositoryReadiness]
1776
1792
  summary: List fix requests
1793
+ description: >
1794
+ Returns persisted fix-queue rows for the workspace (newest first). Empty array when none exist.
1777
1795
  operationId: listReadinessFixes
1778
1796
  parameters:
1779
1797
  - $ref: "#/components/parameters/WorkspaceId"
@@ -1788,9 +1806,21 @@ paths:
1788
1806
  $ref: "#/components/schemas/FixRequestDto"
1789
1807
  "401":
1790
1808
  $ref: "#/components/responses/Unauthorized"
1809
+ "403":
1810
+ $ref: "#/components/responses/Forbidden"
1811
+ "404":
1812
+ description: Workspace does not exist
1813
+ content:
1814
+ application/json:
1815
+ schema:
1816
+ $ref: "#/components/schemas/ErrorMessageDto"
1791
1817
  post:
1792
1818
  tags: [RepositoryReadiness]
1793
1819
  summary: Enqueue fix for an issue
1820
+ description: >
1821
+ Creates a fix request with `status: queued` when `issueId` belongs to `repoId` in this workspace.
1822
+ Requires workspace editor or admin. Re-posting the same `issueId` and `repoId` returns the
1823
+ existing row (idempotent).
1794
1824
  operationId: postReadinessFix
1795
1825
  parameters:
1796
1826
  - $ref: "#/components/parameters/WorkspaceId"
@@ -1800,15 +1830,34 @@ paths:
1800
1830
  application/json:
1801
1831
  schema:
1802
1832
  $ref: "#/components/schemas/CreateFixRequestBodyDto"
1833
+ examples:
1834
+ enqueue:
1835
+ value:
1836
+ issueId: "22222222-2222-2222-2222-222222222222"
1837
+ repoId: "11111111-1111-4111-8111-111111111111"
1803
1838
  responses:
1804
1839
  "200":
1805
- description: Fix request created
1840
+ description: Fix request created or existing row returned
1806
1841
  content:
1807
1842
  application/json:
1808
1843
  schema:
1809
1844
  $ref: "#/components/schemas/FixRequestDto"
1845
+ "400":
1846
+ description: Invalid body or malformed `repoId` (not a UUID)
1847
+ content:
1848
+ application/json:
1849
+ schema:
1850
+ $ref: "#/components/schemas/ErrorMessageDto"
1810
1851
  "401":
1811
1852
  $ref: "#/components/responses/Unauthorized"
1853
+ "403":
1854
+ $ref: "#/components/responses/Forbidden"
1855
+ "404":
1856
+ description: Workspace not found, or issue/repo pair not in workspace
1857
+ content:
1858
+ application/json:
1859
+ schema:
1860
+ $ref: "#/components/schemas/ErrorMessageDto"
1812
1861
 
1813
1862
  /workspaces/{workspaceId}/squad:
1814
1863
  get:
@@ -2094,6 +2143,10 @@ paths:
2094
2143
  post:
2095
2144
  tags: [OrgChartImport]
2096
2145
  summary: Import org chart from Supabase storage path
2146
+ description: >
2147
+ Parse-only. Downloads the CSV at `storagePath` from the `org-charts` bucket and returns
2148
+ `persons` and `errors`. Does not persist to `spa_org_chart` or `org_chart`. The SPA
2149
+ derives teams client-side and saves the org structure via `POST /workspaces/{workspaceId}/org-chart`.
2097
2150
  operationId: postOrgChartImport
2098
2151
  parameters:
2099
2152
  - $ref: "#/components/parameters/WorkspaceId"
@@ -2105,14 +2158,39 @@ paths:
2105
2158
  $ref: "#/components/schemas/OrgChartImportBodyDto"
2106
2159
  responses:
2107
2160
  "200":
2108
- description: Parsed persons (shape TBD; align with backend)
2161
+ description: Parsed persons from uploaded CSV (not persisted server-side)
2109
2162
  content:
2110
2163
  application/json:
2111
2164
  schema:
2112
- type: object
2113
- additionalProperties: true
2165
+ $ref: "#/components/schemas/OrgChartImportResultDto"
2166
+ "400":
2167
+ description: Invalid body or storage path
2168
+ content:
2169
+ application/json:
2170
+ schema:
2171
+ $ref: "#/components/schemas/ErrorMessageDto"
2114
2172
  "401":
2115
2173
  $ref: "#/components/responses/Unauthorized"
2174
+ "403":
2175
+ $ref: "#/components/responses/Forbidden"
2176
+ "404":
2177
+ description: Storage object not found
2178
+ content:
2179
+ application/json:
2180
+ schema:
2181
+ $ref: "#/components/schemas/ErrorMessageDto"
2182
+ "502":
2183
+ description: Failed to download file from storage
2184
+ content:
2185
+ application/json:
2186
+ schema:
2187
+ $ref: "#/components/schemas/ErrorMessageDto"
2188
+ "503":
2189
+ description: Storage import not configured or service unavailable
2190
+ content:
2191
+ application/json:
2192
+ schema:
2193
+ $ref: "#/components/schemas/ErrorMessageDto"
2116
2194
 
2117
2195
  components:
2118
2196
  securitySchemes:
@@ -2212,6 +2290,26 @@ components:
2212
2290
  type: string
2213
2291
  enum: [admin, editor, viewer]
2214
2292
 
2293
+ OrgChartNodeDto:
2294
+ type: object
2295
+ additionalProperties: false
2296
+ required: [id, name, type]
2297
+ properties:
2298
+ id:
2299
+ type: string
2300
+ name:
2301
+ type: string
2302
+ type:
2303
+ type: string
2304
+ enum: [org, department, team, person]
2305
+ external_ids:
2306
+ type: object
2307
+ additionalProperties: { type: string }
2308
+ children:
2309
+ type: array
2310
+ items:
2311
+ $ref: "#/components/schemas/OrgChartNodeDto"
2312
+
2215
2313
  OrgChartTreeNodeDto:
2216
2314
  type: object
2217
2315
  required: [id]
@@ -2238,13 +2336,69 @@ components:
2238
2336
  items:
2239
2337
  $ref: "#/components/schemas/OrgChartTreeNodeDto"
2240
2338
 
2241
- OrgChartDto:
2339
+ ScoringOrgChartDto:
2242
2340
  type: object
2341
+ additionalProperties: false
2243
2342
  required: [root]
2244
2343
  properties:
2245
2344
  root:
2246
2345
  $ref: "#/components/schemas/OrgChartTreeNodeDto"
2247
2346
 
2347
+ OrgChartDto:
2348
+ type: object
2349
+ additionalProperties: false
2350
+ required: [root]
2351
+ properties:
2352
+ root:
2353
+ $ref: "#/components/schemas/OrgChartNodeDto"
2354
+
2355
+ OrgChartPersonDto:
2356
+ type: object
2357
+ additionalProperties: false
2358
+ required: [employeeId, name, email, title, department, team, managerId, location]
2359
+ properties:
2360
+ employeeId:
2361
+ type: string
2362
+ name:
2363
+ type: string
2364
+ email:
2365
+ type: string
2366
+ title:
2367
+ type: string
2368
+ department:
2369
+ type: string
2370
+ team:
2371
+ type: string
2372
+ managerId:
2373
+ type: string
2374
+ location:
2375
+ type: string
2376
+
2377
+ OrgChartImportResultDto:
2378
+ type: object
2379
+ additionalProperties: false
2380
+ required: [persons, errors]
2381
+ properties:
2382
+ persons:
2383
+ type: array
2384
+ items:
2385
+ $ref: "#/components/schemas/OrgChartPersonDto"
2386
+ errors:
2387
+ type: array
2388
+ items:
2389
+ type: string
2390
+
2391
+ OrgChartSaveResultDto:
2392
+ type: object
2393
+ additionalProperties: false
2394
+ required: [ok, tenantId]
2395
+ properties:
2396
+ ok:
2397
+ type: boolean
2398
+ tenantId:
2399
+ type: string
2400
+ format: uuid
2401
+
2248
2402
  TenantSourceEntryDto:
2249
2403
  type: object
2250
2404
  required: [type]
@@ -2291,7 +2445,7 @@ components:
2291
2445
  orgChart:
2292
2446
  nullable: true
2293
2447
  allOf:
2294
- - $ref: "#/components/schemas/OrgChartDto"
2448
+ - $ref: "#/components/schemas/ScoringOrgChartDto"
2295
2449
  region:
2296
2450
  type: string
2297
2451
  nullable: true
@@ -2939,6 +3093,13 @@ components:
2939
3093
  type: string
2940
3094
  enum: [queued, running, succeeded, failed, partial_failed]
2941
3095
 
3096
+ ReadinessRepoAnalysisStatusDto:
3097
+ type: string
3098
+ enum: [idle, queued, running]
3099
+ description: >
3100
+ Whether an AI readiness analysis run is queued or in progress for this repository slug.
3101
+ `idle` means no `queued`/`running` row exists in `tai_workspace_readiness_runs`.
3102
+
2942
3103
  ReadinessRunSummaryDto:
2943
3104
  type: object
2944
3105
  required: [runId, status, providerSlug, errorCode, errorDetail, repoId, createdAt, finishedAt]
@@ -3014,7 +3175,15 @@ components:
3014
3175
 
3015
3176
  RepoReadinessScoreDto:
3016
3177
  type: object
3017
- required: [repoId, repoName, language, overallScore, dimensions, lastAnalyzed, provider]
3178
+ required:
3179
+ - repoId
3180
+ - repoName
3181
+ - language
3182
+ - overallScore
3183
+ - dimensions
3184
+ - lastAnalyzed
3185
+ - provider
3186
+ - analysisStatus
3018
3187
  properties:
3019
3188
  repoId:
3020
3189
  type: string
@@ -3043,6 +3212,13 @@ components:
3043
3212
  nullable: true
3044
3213
  provider:
3045
3214
  $ref: "#/components/schemas/RepoProviderDto"
3215
+ analysisStatus:
3216
+ $ref: "#/components/schemas/ReadinessRepoAnalysisStatusDto"
3217
+ activeRunId:
3218
+ type: string
3219
+ format: uuid
3220
+ nullable: true
3221
+ description: Present when `analysisStatus` is `queued` or `running`; use with `GET .../readiness/runs/{runId}`.
3046
3222
 
3047
3223
  AgenticFoundationDashboardSummaryDto:
3048
3224
  type: object
@@ -3152,8 +3328,12 @@ components:
3152
3328
  properties:
3153
3329
  issueId:
3154
3330
  type: string
3331
+ format: uuid
3332
+ description: Readiness issue id from stored scorecard data
3155
3333
  repoId:
3156
3334
  type: string
3335
+ format: uuid
3336
+ description: Workspace repository id that owns the issue
3157
3337
 
3158
3338
  PhaseRoleDto:
3159
3339
  type: object
@@ -3492,6 +3672,7 @@ components:
3492
3672
 
3493
3673
  OrgChartImportBodyDto:
3494
3674
  type: object
3675
+ additionalProperties: false
3495
3676
  required: [storagePath]
3496
3677
  properties:
3497
3678
  storagePath:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.4.1",
3
+ "version": "2.4.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",