@thinkai/tai-api-contract 2.12.0 → 2.14.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.12.0
4
+ version: 2.14.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}/...`.
@@ -1703,6 +1703,153 @@ paths:
1703
1703
  schema:
1704
1704
  $ref: "#/components/schemas/ErrorMessageDto"
1705
1705
 
1706
+ /workspaces/{workspaceId}/integrations/github/user-authorize-url:
1707
+ post:
1708
+ tags: [Integrations]
1709
+ summary: Create GitHub user OAuth authorize URL
1710
+ operationId: postGithubUserAuthorizeUrl
1711
+ description: >
1712
+ Starts GitHub user OAuth for org/account picker. Workspace admin only.
1713
+ After callback, SPA opens account picker with `?gh=account_picker&session=…`.
1714
+ security:
1715
+ - bearerAuth: []
1716
+ parameters:
1717
+ - $ref: "#/components/parameters/WorkspaceId"
1718
+ requestBody:
1719
+ required: false
1720
+ content:
1721
+ application/json:
1722
+ schema:
1723
+ $ref: "#/components/schemas/GithubUserAuthorizeUrlRequestDto"
1724
+ responses:
1725
+ "200":
1726
+ description: User OAuth authorize URL + signed state
1727
+ content:
1728
+ application/json:
1729
+ schema:
1730
+ $ref: "#/components/schemas/GithubUserAuthorizeUrlResponseDto"
1731
+ "400":
1732
+ description: Request validation failed
1733
+ content:
1734
+ application/json:
1735
+ schema:
1736
+ $ref: "#/components/schemas/ErrorMessageDto"
1737
+ "401":
1738
+ $ref: "#/components/responses/Unauthorized"
1739
+ "403":
1740
+ $ref: "#/components/responses/Forbidden"
1741
+ "404":
1742
+ description: Workspace does not exist or malformed workspaceId
1743
+ content:
1744
+ application/json:
1745
+ schema:
1746
+ $ref: "#/components/schemas/ErrorMessageDto"
1747
+ "500":
1748
+ description: GitHub user OAuth not configured
1749
+ content:
1750
+ application/json:
1751
+ schema:
1752
+ $ref: "#/components/schemas/ErrorMessageDto"
1753
+
1754
+ /workspaces/{workspaceId}/integrations/github/connectable-accounts:
1755
+ get:
1756
+ tags: [Integrations]
1757
+ summary: List connectable GitHub accounts from user OAuth session
1758
+ operationId: getGithubConnectableAccounts
1759
+ description: >
1760
+ Returns org/user accounts from a completed user OAuth picker session.
1761
+ Session must belong to the caller and workspace.
1762
+ security:
1763
+ - bearerAuth: []
1764
+ parameters:
1765
+ - $ref: "#/components/parameters/WorkspaceId"
1766
+ - name: session
1767
+ in: query
1768
+ required: true
1769
+ schema:
1770
+ type: string
1771
+ minLength: 16
1772
+ maxLength: 128
1773
+ responses:
1774
+ "200":
1775
+ description: Connectable accounts snapshot
1776
+ content:
1777
+ application/json:
1778
+ schema:
1779
+ $ref: "#/components/schemas/GithubConnectableAccountsResponseDto"
1780
+ "400":
1781
+ description: Missing or invalid session
1782
+ content:
1783
+ application/json:
1784
+ schema:
1785
+ $ref: "#/components/schemas/ErrorMessageDto"
1786
+ "401":
1787
+ $ref: "#/components/responses/Unauthorized"
1788
+ "403":
1789
+ $ref: "#/components/responses/Forbidden"
1790
+ "404":
1791
+ description: Workspace or session not found
1792
+ content:
1793
+ application/json:
1794
+ schema:
1795
+ $ref: "#/components/schemas/ErrorMessageDto"
1796
+
1797
+ /workspaces/{workspaceId}/integrations/github/connect-by-org:
1798
+ post:
1799
+ tags: [Integrations]
1800
+ summary: Link GitHub App installation by org or user account
1801
+ operationId: postGithubConnectByOrg
1802
+ description: >
1803
+ Server-side link when the ThinkAI GitHub App is already installed on the selected account.
1804
+ Returns `needs_oauth` when install redirect is required. Workspace admin only.
1805
+ security:
1806
+ - bearerAuth: []
1807
+ parameters:
1808
+ - $ref: "#/components/parameters/WorkspaceId"
1809
+ requestBody:
1810
+ required: true
1811
+ content:
1812
+ application/json:
1813
+ schema:
1814
+ $ref: "#/components/schemas/GithubConnectByOrgRequestDto"
1815
+ responses:
1816
+ "200":
1817
+ description: Connect result
1818
+ content:
1819
+ application/json:
1820
+ schema:
1821
+ $ref: "#/components/schemas/GithubConnectByOrgResponseDto"
1822
+ "400":
1823
+ description: Invalid session or account
1824
+ content:
1825
+ application/json:
1826
+ schema:
1827
+ $ref: "#/components/schemas/ErrorMessageDto"
1828
+ "401":
1829
+ $ref: "#/components/responses/Unauthorized"
1830
+ "403":
1831
+ $ref: "#/components/responses/Forbidden"
1832
+ "404":
1833
+ description: Workspace or session not found
1834
+ content:
1835
+ application/json:
1836
+ schema:
1837
+ $ref: "#/components/schemas/ErrorMessageDto"
1838
+ "409":
1839
+ description: GitHub installation already linked to another workspace
1840
+ content:
1841
+ application/json:
1842
+ schema:
1843
+ $ref: "#/components/schemas/ErrorMessageDto"
1844
+ example:
1845
+ error: installation_already_linked
1846
+ "503":
1847
+ description: GitHub API error
1848
+ content:
1849
+ application/json:
1850
+ schema:
1851
+ $ref: "#/components/schemas/ErrorMessageDto"
1852
+
1706
1853
  /workspaces/{workspaceId}/integrations/ai-tool/{provider}/refresh:
1707
1854
  post:
1708
1855
  tags: [Integrations]
@@ -2007,6 +2154,52 @@ paths:
2007
2154
  schema:
2008
2155
  $ref: "#/components/schemas/ErrorMessageDto"
2009
2156
 
2157
+ /integrations/github/user-oauth/callback:
2158
+ get:
2159
+ tags: [Integrations]
2160
+ summary: GitHub user OAuth callback
2161
+ operationId: getGithubUserOauthCallback
2162
+ description: >
2163
+ Public callback for GitHub user OAuth (org/account picker flow).
2164
+ Exchanges code, builds connectable-accounts snapshot, redirects SPA with
2165
+ `?gh=account_picker&session=…`.
2166
+ parameters:
2167
+ - name: state
2168
+ in: query
2169
+ required: true
2170
+ schema:
2171
+ type: string
2172
+ - name: code
2173
+ in: query
2174
+ required: false
2175
+ schema:
2176
+ type: string
2177
+ - name: error
2178
+ in: query
2179
+ required: false
2180
+ schema:
2181
+ type: string
2182
+ - name: error_description
2183
+ in: query
2184
+ required: false
2185
+ schema:
2186
+ type: string
2187
+ responses:
2188
+ "302":
2189
+ description: Redirect to ThinkAI SPA with account picker session or error
2190
+ "501":
2191
+ description: Workspace store not configured
2192
+ content:
2193
+ application/json:
2194
+ schema:
2195
+ $ref: "#/components/schemas/ErrorMessageDto"
2196
+ "503":
2197
+ description: SPA origin or GitHub OAuth configuration missing
2198
+ content:
2199
+ application/json:
2200
+ schema:
2201
+ $ref: "#/components/schemas/ErrorMessageDto"
2202
+
2010
2203
  /integrations/github/webhook:
2011
2204
  post:
2012
2205
  tags: [Integrations]
@@ -4038,6 +4231,123 @@ paths:
4038
4231
  schema:
4039
4232
  $ref: "#/components/schemas/ErrorMessageDto"
4040
4233
 
4234
+ /workspaces/{workspaceId}/absences:
4235
+ get:
4236
+ tags: [HRIS]
4237
+ summary: List absence records
4238
+ operationId: listWorkspaceAbsences
4239
+ description: >
4240
+ Returns time-off/absence records sourced from connected HRIS providers (e.g. Personio)
4241
+ for the given date window. Requires workspace membership.
4242
+ parameters:
4243
+ - $ref: "#/components/parameters/WorkspaceId"
4244
+ - name: from
4245
+ in: query
4246
+ description: Start of date window (ISO YYYY-MM-DD). Defaults to today.
4247
+ schema: { type: string, format: date }
4248
+ - name: to
4249
+ in: query
4250
+ description: End of date window (ISO YYYY-MM-DD). Defaults to 90 days from today.
4251
+ schema: { type: string, format: date }
4252
+ responses:
4253
+ "200":
4254
+ description: Absence list with last sync timestamp
4255
+ content:
4256
+ application/json:
4257
+ schema:
4258
+ $ref: "#/components/schemas/WorkspaceAbsenceListDto"
4259
+ example:
4260
+ absences:
4261
+ - source: personio
4262
+ employeeEmail: alice@example.com
4263
+ absenceType: Vacation
4264
+ startDate: "2025-07-01"
4265
+ endDate: "2025-07-05"
4266
+ halfDayStart: false
4267
+ halfDayEnd: false
4268
+ status: approved
4269
+ syncedAt: "2025-06-30T08:00:00.000Z"
4270
+ "401":
4271
+ $ref: "#/components/responses/Unauthorized"
4272
+ "403":
4273
+ $ref: "#/components/responses/Forbidden"
4274
+
4275
+ /workspaces/{workspaceId}/hris/status:
4276
+ get:
4277
+ tags: [HRIS]
4278
+ summary: HRIS sync status
4279
+ operationId: getHrisSyncStatus
4280
+ description: >
4281
+ Returns the last sync status for every HRIS provider connected to the workspace.
4282
+ Returns an empty `statuses` array when no HRIS source has been synced yet.
4283
+ Requires workspace membership.
4284
+ parameters:
4285
+ - $ref: "#/components/parameters/WorkspaceId"
4286
+ responses:
4287
+ "200":
4288
+ description: Sync status list
4289
+ content:
4290
+ application/json:
4291
+ schema:
4292
+ $ref: "#/components/schemas/HrisSyncStatusListDto"
4293
+ example:
4294
+ statuses:
4295
+ - provider: personio
4296
+ lastSyncAt: "2025-06-30T08:00:00.000Z"
4297
+ status: ok
4298
+ "401":
4299
+ $ref: "#/components/responses/Unauthorized"
4300
+ "403":
4301
+ $ref: "#/components/responses/Forbidden"
4302
+
4303
+ /workspaces/{workspaceId}/hris/sync:
4304
+ post:
4305
+ tags: [HRIS]
4306
+ summary: Trigger manual HRIS sync
4307
+ operationId: triggerHrisSync
4308
+ description: >
4309
+ Manually triggers an HRIS sync for the workspace. Runs synchronously and returns
4310
+ the result. Requires editor role (same permission level as org-chart writes).
4311
+ Returns 422 when no HRIS source is configured.
4312
+ parameters:
4313
+ - $ref: "#/components/parameters/WorkspaceId"
4314
+ responses:
4315
+ "200":
4316
+ description: Sync completed successfully
4317
+ content:
4318
+ application/json:
4319
+ schema:
4320
+ $ref: "#/components/schemas/HrisTriggerSyncResultDto"
4321
+ example:
4322
+ status: ok
4323
+ employeeCount: 42
4324
+ absenceCount: 7
4325
+ durationMs: 1234
4326
+ "422":
4327
+ description: No HRIS source configured for this workspace
4328
+ content:
4329
+ application/json:
4330
+ schema:
4331
+ $ref: "#/components/schemas/HrisTriggerSyncResultDto"
4332
+ example:
4333
+ status: skipped
4334
+ code: no_personio_source
4335
+ reason: no_personio_source
4336
+ "500":
4337
+ description: Sync failed (Personio API error, decryption failure, etc.)
4338
+ content:
4339
+ application/json:
4340
+ schema:
4341
+ $ref: "#/components/schemas/HrisTriggerSyncResultDto"
4342
+ example:
4343
+ status: error
4344
+ code: hris_sync_failed
4345
+ error: "Personio employees API 401"
4346
+ "401":
4347
+ $ref: "#/components/responses/Unauthorized"
4348
+ "403":
4349
+ $ref: "#/components/responses/Forbidden"
4350
+
4041
4351
  components:
4042
4352
  securitySchemes:
4043
4353
  bearerAuth:
@@ -5985,6 +6295,104 @@ components:
5985
6295
  minLength: 16
5986
6296
  maxLength: 128
5987
6297
 
6298
+ GithubUserAuthorizeUrlRequestDto:
6299
+ type: object
6300
+ additionalProperties: false
6301
+ properties:
6302
+ returnPath:
6303
+ type: string
6304
+ pattern: '^/[A-Za-z0-9/_\-\?\=&]*$'
6305
+ maxLength: 256
6306
+
6307
+ GithubUserAuthorizeUrlResponseDto:
6308
+ type: object
6309
+ additionalProperties: false
6310
+ required: [url, state]
6311
+ properties:
6312
+ url:
6313
+ type: string
6314
+ format: uri
6315
+ maxLength: 2048
6316
+ state:
6317
+ type: string
6318
+ minLength: 16
6319
+ maxLength: 128
6320
+
6321
+ GithubConnectableAccountDto:
6322
+ type: object
6323
+ additionalProperties: false
6324
+ required: [login, type, appInstalled]
6325
+ properties:
6326
+ login:
6327
+ type: string
6328
+ type:
6329
+ type: string
6330
+ enum: [Organization, User]
6331
+ avatarUrl:
6332
+ type: string
6333
+ format: uri
6334
+ nullable: true
6335
+ appInstalled:
6336
+ type: boolean
6337
+ description: Whether the ThinkAI GitHub App is already installed on this account.
6338
+
6339
+ GithubConnectableAccountsResponseDto:
6340
+ type: object
6341
+ additionalProperties: false
6342
+ required: [accounts]
6343
+ properties:
6344
+ accounts:
6345
+ type: array
6346
+ items:
6347
+ $ref: "#/components/schemas/GithubConnectableAccountDto"
6348
+
6349
+ GithubConnectByOrgRequestDto:
6350
+ type: object
6351
+ additionalProperties: false
6352
+ required: [accountLogin, accountType, session]
6353
+ properties:
6354
+ accountLogin:
6355
+ type: string
6356
+ minLength: 1
6357
+ maxLength: 39
6358
+ accountType:
6359
+ type: string
6360
+ enum: [Organization, User]
6361
+ session:
6362
+ type: string
6363
+ minLength: 16
6364
+ maxLength: 128
6365
+
6366
+ GithubConnectByOrgConnectedDto:
6367
+ type: object
6368
+ additionalProperties: false
6369
+ required: [outcome, status]
6370
+ properties:
6371
+ outcome:
6372
+ type: string
6373
+ enum: [connected]
6374
+ status:
6375
+ $ref: "#/components/schemas/GithubInstallationStatusDto"
6376
+
6377
+ GithubConnectByOrgNeedsOAuthDto:
6378
+ type: object
6379
+ additionalProperties: false
6380
+ required: [outcome]
6381
+ properties:
6382
+ outcome:
6383
+ type: string
6384
+ enum: [needs_oauth]
6385
+
6386
+ GithubConnectByOrgResponseDto:
6387
+ oneOf:
6388
+ - $ref: "#/components/schemas/GithubConnectByOrgConnectedDto"
6389
+ - $ref: "#/components/schemas/GithubConnectByOrgNeedsOAuthDto"
6390
+ discriminator:
6391
+ propertyName: outcome
6392
+ mapping:
6393
+ connected: "#/components/schemas/GithubConnectByOrgConnectedDto"
6394
+ needs_oauth: "#/components/schemas/GithubConnectByOrgNeedsOAuthDto"
6395
+
5988
6396
  AIReadinessDto:
5989
6397
  type: object
5990
6398
  required:
@@ -7639,6 +8047,99 @@ components:
7639
8047
  nullable: true
7640
8048
  description: Event-specific supplementary data (before/after state, installation IDs, etc.).
7641
8049
 
8050
+ WorkspaceAbsenceDto:
8051
+ type: object
8052
+ required: [source, employeeEmail, absenceType, startDate, endDate, halfDayStart, halfDayEnd, status]
8053
+ properties:
8054
+ source:
8055
+ type: string
8056
+ description: HRIS provider that sourced this record (e.g. 'personio', 'zenhr').
8057
+ employeeEmail:
8058
+ type: string
8059
+ format: email
8060
+ absenceType:
8061
+ type: string
8062
+ startDate:
8063
+ type: string
8064
+ format: date
8065
+ endDate:
8066
+ type: string
8067
+ format: date
8068
+ halfDayStart:
8069
+ type: boolean
8070
+ halfDayEnd:
8071
+ type: boolean
8072
+ status:
8073
+ type: string
8074
+ enum: [approved, pending, rejected]
8075
+
8076
+ WorkspaceAbsenceListDto:
8077
+ type: object
8078
+ required: [absences, syncedAt]
8079
+ properties:
8080
+ absences:
8081
+ type: array
8082
+ items:
8083
+ $ref: "#/components/schemas/WorkspaceAbsenceDto"
8084
+ syncedAt:
8085
+ type: string
8086
+ format: date-time
8087
+ nullable: true
8088
+ description: ISO timestamp of the most recent successful HRIS sync, or null if never synced.
8089
+
8090
+ HrisSyncStatusDto:
8091
+ type: object
8092
+ required: [provider, lastSyncAt, status]
8093
+ properties:
8094
+ provider:
8095
+ type: string
8096
+ description: Provider identifier (e.g. 'personio', 'zenhr').
8097
+ lastSyncAt:
8098
+ type: string
8099
+ format: date-time
8100
+ nullable: true
8101
+ status:
8102
+ type: string
8103
+ enum: [ok, error, never]
8104
+ lastError:
8105
+ type: string
8106
+ nullable: true
8107
+
8108
+ HrisSyncStatusListDto:
8109
+ type: object
8110
+ required: [statuses]
8111
+ properties:
8112
+ statuses:
8113
+ type: array
8114
+ items:
8115
+ $ref: "#/components/schemas/HrisSyncStatusDto"
8116
+
8117
+ HrisTriggerSyncResultDto:
8118
+ type: object
8119
+ required: [status]
8120
+ properties:
8121
+ status:
8122
+ type: string
8123
+ enum: [ok, skipped, error]
8124
+ code:
8125
+ type: string
8126
+ description: Stable machine-readable code (e.g. 'no_personio_source', 'hris_sync_failed').
8127
+ employeeCount:
8128
+ type: integer
8129
+ description: Number of employees synced (present when status = 'ok').
8130
+ absenceCount:
8131
+ type: integer
8132
+ description: Number of absence records synced (present when status = 'ok').
8133
+ durationMs:
8134
+ type: integer
8135
+ description: Wall-clock duration of the sync in milliseconds (present when status = 'ok').
8136
+ reason:
8137
+ type: string
8138
+ description: Machine-readable reason for a skipped sync (e.g. 'no_personio_source').
8139
+ error:
8140
+ type: string
8141
+ description: Error message when status = 'error'.
8142
+
7642
8143
  ActivityLogPageDto:
7643
8144
  allOf:
7644
8145
  - $ref: "#/components/schemas/PageMetaDto"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.12.0",
3
+ "version": "2.14.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",