@thinkai/tai-api-contract 2.148.0 → 2.150.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.148.0
4
+ version: 2.150.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}/...`.
@@ -9200,6 +9200,295 @@ paths:
9200
9200
  "409":
9201
9201
  description: Corpus not ready
9202
9202
 
9203
+ /notifications/email/unsubscribe:
9204
+ get:
9205
+ tags: [Notifications]
9206
+ summary: Confirm a Message Center email unsubscribe (public)
9207
+ description: >
9208
+ **Unauthenticated.** Mail scanners prefetch GET, so this page does not change
9209
+ preferences. Status email cannot be turned off; the page says so. Other categories
9210
+ show a button that POSTs the same token. An unknown or expired token is `400` HTML.
9211
+ operationId: getNotificationEmailUnsubscribe
9212
+ security: []
9213
+ parameters:
9214
+ - name: token
9215
+ in: query
9216
+ required: true
9217
+ description: Opaque unsubscribe token from the email. Only its SHA-256 hash is stored.
9218
+ schema:
9219
+ type: string
9220
+ responses:
9221
+ "200":
9222
+ description: Confirm page. Preferences are unchanged.
9223
+ content:
9224
+ text/html:
9225
+ schema:
9226
+ type: string
9227
+ "400":
9228
+ description: Unknown or expired token
9229
+ content:
9230
+ text/html:
9231
+ schema:
9232
+ type: string
9233
+ post:
9234
+ tags: [Notifications]
9235
+ summary: Apply a Message Center email unsubscribe (public)
9236
+ description: >
9237
+ **Unauthenticated.** Sets that category's email cell to `off` when the category
9238
+ allows off. A status token leaves status email unchanged. Redirects `303` to
9239
+ `{spa}/settings?tab=preferences`. An unknown or expired token is `400` HTML and
9240
+ does not change preferences.
9241
+ operationId: postNotificationEmailUnsubscribe
9242
+ security: []
9243
+ parameters:
9244
+ - name: token
9245
+ in: query
9246
+ required: true
9247
+ description: Opaque unsubscribe token from the email. Only its SHA-256 hash is stored.
9248
+ schema:
9249
+ type: string
9250
+ responses:
9251
+ "303":
9252
+ description: Preference updated, or left unchanged for status email.
9253
+ headers:
9254
+ Location:
9255
+ description: "`{spa}/settings?tab=preferences`"
9256
+ schema:
9257
+ type: string
9258
+ "400":
9259
+ description: Unknown or expired token
9260
+ content:
9261
+ text/html:
9262
+ schema:
9263
+ type: string
9264
+ "200":
9265
+ description: Preference updated when no SPA origin is configured.
9266
+ content:
9267
+ text/html:
9268
+ schema:
9269
+ type: string
9270
+
9271
+ /workspaces/{workspaceId}/integrations/slack/install-url:
9272
+ get:
9273
+ tags: [Integrations]
9274
+ summary: Slack install URL for Message Center
9275
+ operationId: getSlackInstallUrl
9276
+ description: >
9277
+ Workspace admin only. Returns the Slack OAuth authorize URL. State is stored
9278
+ server-side and names this workspace and the signed-in admin. Editor or viewer
9279
+ is `403` with `code` `workspace_admin_required`. Missing Slack app settings are
9280
+ `503` with `code` `slack_not_configured`.
9281
+ security:
9282
+ - bearerAuth: []
9283
+ parameters:
9284
+ - $ref: "#/components/parameters/WorkspaceId"
9285
+ responses:
9286
+ "200":
9287
+ description: Slack authorize URL
9288
+ content:
9289
+ application/json:
9290
+ schema:
9291
+ $ref: "#/components/schemas/SlackInstallUrlDto"
9292
+ "401":
9293
+ $ref: "#/components/responses/Unauthorized"
9294
+ "403":
9295
+ description: Caller is not a workspace admin
9296
+ content:
9297
+ application/json:
9298
+ schema:
9299
+ $ref: "#/components/schemas/ErrorMessageDto"
9300
+ example:
9301
+ error: Forbidden
9302
+ code: workspace_admin_required
9303
+ "404":
9304
+ description: Workspace does not exist or malformed workspaceId
9305
+ content:
9306
+ application/json:
9307
+ schema:
9308
+ $ref: "#/components/schemas/ErrorMessageDto"
9309
+ "503":
9310
+ description: Slack app client id, secret, API origin, or SPA origin is unset
9311
+ content:
9312
+ application/json:
9313
+ schema:
9314
+ $ref: "#/components/schemas/ErrorMessageDto"
9315
+ example:
9316
+ error: Slack is not configured
9317
+ code: slack_not_configured
9318
+
9319
+ /integrations/slack/callback:
9320
+ get:
9321
+ tags: [Integrations]
9322
+ summary: Slack OAuth callback
9323
+ operationId: getSlackOauthCallback
9324
+ description: >
9325
+ Browser return from Slack. The provider redirect does not include the API
9326
+ bearer token. `state` was issued by `getSlackInstallUrl` to a signed-in admin
9327
+ and is single-use. The bot token is stored encrypted only when that user is
9328
+ still a workspace admin. Success redirects to
9329
+ `{spa}/settings?tab=preferences&chat=slack`. Failures redirect to the same
9330
+ page with `slack=error`. The token is never in the redirect.
9331
+ parameters:
9332
+ - name: code
9333
+ in: query
9334
+ schema:
9335
+ type: string
9336
+ - name: state
9337
+ in: query
9338
+ required: true
9339
+ schema:
9340
+ type: string
9341
+ - name: error
9342
+ in: query
9343
+ schema:
9344
+ type: string
9345
+ responses:
9346
+ "302":
9347
+ description: Redirect to Settings → Preferences
9348
+ headers:
9349
+ Location:
9350
+ schema:
9351
+ type: string
9352
+ "503":
9353
+ description: Slack app settings are unset and no SPA origin is available
9354
+ content:
9355
+ application/json:
9356
+ schema:
9357
+ $ref: "#/components/schemas/ErrorMessageDto"
9358
+
9359
+ /workspaces/{workspaceId}/integrations/slack:
9360
+ get:
9361
+ tags: [Integrations]
9362
+ summary: Slack connection status
9363
+ operationId: getSlackIntegration
9364
+ description: >
9365
+ Any workspace member. `{ connected, channelName }`. `channelName` is null
9366
+ until an admin saves a channel. The bot token is never returned.
9367
+ security:
9368
+ - bearerAuth: []
9369
+ parameters:
9370
+ - $ref: "#/components/parameters/WorkspaceId"
9371
+ responses:
9372
+ "200":
9373
+ description: Slack connection status
9374
+ content:
9375
+ application/json:
9376
+ schema:
9377
+ $ref: "#/components/schemas/SlackIntegrationStatusDto"
9378
+ "401":
9379
+ $ref: "#/components/responses/Unauthorized"
9380
+ "403":
9381
+ $ref: "#/components/responses/Forbidden"
9382
+ "404":
9383
+ description: Workspace does not exist or malformed workspaceId
9384
+ content:
9385
+ application/json:
9386
+ schema:
9387
+ $ref: "#/components/schemas/ErrorMessageDto"
9388
+ delete:
9389
+ tags: [Integrations]
9390
+ summary: Disconnect Slack
9391
+ operationId: deleteSlackIntegration
9392
+ description: >
9393
+ Workspace admin only. Removes the bot token and saved channel. Later
9394
+ Message Center delivery does not post to Slack.
9395
+ security:
9396
+ - bearerAuth: []
9397
+ parameters:
9398
+ - $ref: "#/components/parameters/WorkspaceId"
9399
+ responses:
9400
+ "204":
9401
+ description: Slack disconnected
9402
+ "401":
9403
+ $ref: "#/components/responses/Unauthorized"
9404
+ "403":
9405
+ description: Caller is not a workspace admin
9406
+ content:
9407
+ application/json:
9408
+ schema:
9409
+ $ref: "#/components/schemas/ErrorMessageDto"
9410
+ example:
9411
+ error: Forbidden
9412
+ code: workspace_admin_required
9413
+ "404":
9414
+ description: Workspace does not exist or malformed workspaceId
9415
+ content:
9416
+ application/json:
9417
+ schema:
9418
+ $ref: "#/components/schemas/ErrorMessageDto"
9419
+
9420
+ /workspaces/{workspaceId}/integrations/slack/channel:
9421
+ put:
9422
+ tags: [Integrations]
9423
+ summary: Save the Slack channel for Message Center
9424
+ operationId: putSlackChannel
9425
+ description: >
9426
+ Workspace admin only. Body `{ channelId }`. Slack must already be connected.
9427
+ The response is the same status object as `getSlackIntegration`, with the
9428
+ channel name Slack returned. Unknown or malformed `channelId` is `400`
9429
+ `invalid_slack_channel`. Not connected is `409` `slack_not_connected`.
9430
+ security:
9431
+ - bearerAuth: []
9432
+ parameters:
9433
+ - $ref: "#/components/parameters/WorkspaceId"
9434
+ requestBody:
9435
+ required: true
9436
+ content:
9437
+ application/json:
9438
+ schema:
9439
+ $ref: "#/components/schemas/SlackChannelBodyDto"
9440
+ responses:
9441
+ "200":
9442
+ description: Channel saved
9443
+ content:
9444
+ application/json:
9445
+ schema:
9446
+ $ref: "#/components/schemas/SlackIntegrationStatusDto"
9447
+ "400":
9448
+ description: channelId is missing, malformed, or unknown to Slack
9449
+ content:
9450
+ application/json:
9451
+ schema:
9452
+ $ref: "#/components/schemas/ErrorMessageDto"
9453
+ example:
9454
+ error: Slack channel was not found
9455
+ code: invalid_slack_channel
9456
+ "401":
9457
+ $ref: "#/components/responses/Unauthorized"
9458
+ "403":
9459
+ description: Caller is not a workspace admin
9460
+ content:
9461
+ application/json:
9462
+ schema:
9463
+ $ref: "#/components/schemas/ErrorMessageDto"
9464
+ example:
9465
+ error: Forbidden
9466
+ code: workspace_admin_required
9467
+ "404":
9468
+ description: Workspace does not exist or malformed workspaceId
9469
+ content:
9470
+ application/json:
9471
+ schema:
9472
+ $ref: "#/components/schemas/ErrorMessageDto"
9473
+ "409":
9474
+ description: Slack is not connected
9475
+ content:
9476
+ application/json:
9477
+ schema:
9478
+ $ref: "#/components/schemas/ErrorMessageDto"
9479
+ example:
9480
+ error: Slack is not connected
9481
+ code: slack_not_connected
9482
+ "502":
9483
+ description: Slack rejected the lookup
9484
+ content:
9485
+ application/json:
9486
+ schema:
9487
+ $ref: "#/components/schemas/ErrorMessageDto"
9488
+ example:
9489
+ error: Slack did not accept the channel
9490
+ code: slack_request_failed
9491
+
9203
9492
  /workspaces/{workspaceId}/notifications:
9204
9493
  get:
9205
9494
  tags: [Notifications]
@@ -9400,6 +9689,9 @@ paths:
9400
9689
  get:
9401
9690
  tags: [Preferences]
9402
9691
  summary: Get preferences for current user
9692
+ description: >
9693
+ Returns saved preferences, including `notificationChannels`. An empty or missing
9694
+ profile returns defaults (`email.status` is `digest`; every other channel cell is `off`).
9403
9695
  operationId: getMyPreferences
9404
9696
  responses:
9405
9697
  "200":
@@ -9413,13 +9705,20 @@ paths:
9413
9705
  put:
9414
9706
  tags: [Preferences]
9415
9707
  summary: Upsert preferences
9708
+ description: >
9709
+ Replaces the saved preferences object. Omitting `notificationChannels` keeps the
9710
+ stored cells, or the defaults when none are stored. A body that includes
9711
+ `notificationChannels` replaces those cells; any missing key inside it uses the
9712
+ default (`email.status` = `digest`, every other cell = `off`). Setting
9713
+ `email.status` to `off` returns 400 `notification_channel_required`. In-app
9714
+ `notifications` booleans are independent of these cells.
9416
9715
  operationId: putMyPreferences
9417
9716
  requestBody:
9418
9717
  required: true
9419
9718
  content:
9420
9719
  application/json:
9421
9720
  schema:
9422
- $ref: "#/components/schemas/PreferencesDto"
9721
+ $ref: "#/components/schemas/PutPreferencesBodyDto"
9423
9722
  responses:
9424
9723
  "200":
9425
9724
  description: Saved preferences
@@ -9428,11 +9727,15 @@ paths:
9428
9727
  schema:
9429
9728
  $ref: "#/components/schemas/PreferencesDto"
9430
9729
  "400":
9431
- description: Validation failed
9730
+ description: >
9731
+ Validation failed, or Status email was set to off
9732
+ (`code` `notification_channel_required`).
9432
9733
  content:
9433
9734
  application/json:
9434
9735
  schema:
9435
- $ref: "#/components/schemas/PreferencesValidationErrorDto"
9736
+ oneOf:
9737
+ - $ref: "#/components/schemas/PreferencesValidationErrorDto"
9738
+ - $ref: "#/components/schemas/NotificationChannelRequiredErrorDto"
9436
9739
  "401":
9437
9740
  $ref: "#/components/responses/Unauthorized"
9438
9741
 
@@ -9487,7 +9790,8 @@ paths:
9487
9790
  tags: [Me]
9488
9791
  summary: App chrome bootstrap payload
9489
9792
  description: >
9490
- Returns the authenticated user's profile, workspace list, and preferences in one response.
9793
+ Returns the authenticated user's profile, workspace list, and preferences
9794
+ (including `notificationChannels`) in one response.
9491
9795
  When `workspaceId` is provided and resolves to a workspace the caller belongs to, also
9492
9796
  returns platform banner, unread notification count (`count` and `hasUnreadCritical`), journey progress, and connectors
9493
9797
  snapshot. Invalid, unknown, or non-member `workspaceId` values do not produce 403/404 —
@@ -18753,9 +19057,187 @@ components:
18753
19057
  type: boolean
18754
19058
  description: System / platform announcements.
18755
19059
 
19060
+ NotificationEmailStatusMode:
19061
+ type: string
19062
+ description: >
19063
+ Status email delivery. `digest` (default) is the weekly mail. `immediate`
19064
+ sends as events arrive. `off` is not allowed.
19065
+ enum: [immediate, digest]
19066
+
19067
+ NotificationEmailDeliveryMode:
19068
+ type: string
19069
+ description: >
19070
+ Email delivery for comment, activity, or system. Default `off`.
19071
+ `immediate` sends as events arrive. `digest` is the weekly mail.
19072
+ enum: [off, immediate, digest]
19073
+
19074
+ NotificationChatDeliveryMode:
19075
+ type: string
19076
+ description: >
19077
+ Slack or Teams delivery for one category. Default `off` until that member
19078
+ changes the cell. `dm` is a direct message. `channel` posts to the workspace
19079
+ channel an admin saved. Connecting chat does not turn cells on.
19080
+ enum: [off, dm, channel]
19081
+
19082
+ NotificationEmailChannelsDto:
19083
+ type: object
19084
+ additionalProperties: false
19085
+ required: [status, comment, activity, system]
19086
+ properties:
19087
+ status:
19088
+ $ref: "#/components/schemas/NotificationEmailStatusMode"
19089
+ comment:
19090
+ $ref: "#/components/schemas/NotificationEmailDeliveryMode"
19091
+ activity:
19092
+ $ref: "#/components/schemas/NotificationEmailDeliveryMode"
19093
+ system:
19094
+ $ref: "#/components/schemas/NotificationEmailDeliveryMode"
19095
+
19096
+ NotificationChatChannelsDto:
19097
+ type: object
19098
+ additionalProperties: false
19099
+ required: [status, comment, activity, system]
19100
+ properties:
19101
+ status:
19102
+ $ref: "#/components/schemas/NotificationChatDeliveryMode"
19103
+ comment:
19104
+ $ref: "#/components/schemas/NotificationChatDeliveryMode"
19105
+ activity:
19106
+ $ref: "#/components/schemas/NotificationChatDeliveryMode"
19107
+ system:
19108
+ $ref: "#/components/schemas/NotificationChatDeliveryMode"
19109
+
19110
+ NotificationChannelsDto:
19111
+ type: object
19112
+ additionalProperties: false
19113
+ required: [email, slack, teams]
19114
+ description: >
19115
+ Delivery cells beside the in-app Message Center switches. Defaults:
19116
+ `email.status` is `digest`; every other cell is `off`. Inbox rows whose
19117
+ type is `integration` use the `status` cell.
19118
+ properties:
19119
+ email:
19120
+ $ref: "#/components/schemas/NotificationEmailChannelsDto"
19121
+ slack:
19122
+ $ref: "#/components/schemas/NotificationChatChannelsDto"
19123
+ teams:
19124
+ $ref: "#/components/schemas/NotificationChatChannelsDto"
19125
+
19126
+ SlackInstallUrlDto:
19127
+ type: object
19128
+ additionalProperties: false
19129
+ required: [url]
19130
+ properties:
19131
+ url:
19132
+ type: string
19133
+ description: Slack OAuth authorize URL. The bot token is not included.
19134
+
19135
+ SlackIntegrationStatusDto:
19136
+ type: object
19137
+ additionalProperties: false
19138
+ required: [connected, channelName]
19139
+ properties:
19140
+ connected:
19141
+ type: boolean
19142
+ channelName:
19143
+ type: string
19144
+ nullable: true
19145
+ description: Saved channel name. Null until an admin saves a channel, and when disconnected.
19146
+
19147
+ SlackChannelBodyDto:
19148
+ type: object
19149
+ additionalProperties: false
19150
+ required: [channelId]
19151
+ properties:
19152
+ channelId:
19153
+ type: string
19154
+ minLength: 1
19155
+ maxLength: 32
19156
+
19157
+ PutNotificationEmailChannelsDto:
19158
+ type: object
19159
+ additionalProperties: false
19160
+ description: >
19161
+ Partial email cells. Omitted keys are filled with defaults on save
19162
+ (`status` = `digest`, other keys = `off`).
19163
+ properties:
19164
+ status:
19165
+ $ref: "#/components/schemas/NotificationEmailStatusMode"
19166
+ comment:
19167
+ $ref: "#/components/schemas/NotificationEmailDeliveryMode"
19168
+ activity:
19169
+ $ref: "#/components/schemas/NotificationEmailDeliveryMode"
19170
+ system:
19171
+ $ref: "#/components/schemas/NotificationEmailDeliveryMode"
19172
+
19173
+ PutNotificationChatChannelsDto:
19174
+ type: object
19175
+ additionalProperties: false
19176
+ description: Partial chat cells. Omitted keys default to `off` on save.
19177
+ properties:
19178
+ status:
19179
+ $ref: "#/components/schemas/NotificationChatDeliveryMode"
19180
+ comment:
19181
+ $ref: "#/components/schemas/NotificationChatDeliveryMode"
19182
+ activity:
19183
+ $ref: "#/components/schemas/NotificationChatDeliveryMode"
19184
+ system:
19185
+ $ref: "#/components/schemas/NotificationChatDeliveryMode"
19186
+
19187
+ PutNotificationChannelsDto:
19188
+ type: object
19189
+ additionalProperties: false
19190
+ description: >
19191
+ Replaces stored channel cells when present on `PUT /me/preferences`.
19192
+ Omitted `email`, `slack`, or `teams` objects are filled with defaults.
19193
+ properties:
19194
+ email:
19195
+ $ref: "#/components/schemas/PutNotificationEmailChannelsDto"
19196
+ slack:
19197
+ $ref: "#/components/schemas/PutNotificationChatChannelsDto"
19198
+ teams:
19199
+ $ref: "#/components/schemas/PutNotificationChatChannelsDto"
19200
+
18756
19201
  PreferencesDto:
18757
19202
  type: object
18758
19203
  additionalProperties: false
19204
+ required:
19205
+ [
19206
+ theme,
19207
+ sidebarCollapsed,
19208
+ timezone,
19209
+ dataRefreshInterval,
19210
+ notifications,
19211
+ buddyEnabled,
19212
+ notificationChannels,
19213
+ ]
19214
+ properties:
19215
+ theme:
19216
+ $ref: "#/components/schemas/ThemePreference"
19217
+ sidebarCollapsed:
19218
+ type: boolean
19219
+ timezone:
19220
+ type: string
19221
+ description: IANA timezone name
19222
+ dataRefreshInterval:
19223
+ $ref: "#/components/schemas/DataRefreshInterval"
19224
+ notifications:
19225
+ $ref: "#/components/schemas/NotificationPreferencesDto"
19226
+ buddyEnabled:
19227
+ type: boolean
19228
+ default: false
19229
+ description: >
19230
+ When true, show the ThinkAI Buddy mascot. Default and missing stored
19231
+ values are false (opt-in only).
19232
+ notificationChannels:
19233
+ $ref: "#/components/schemas/NotificationChannelsDto"
19234
+
19235
+ PutPreferencesBodyDto:
19236
+ type: object
19237
+ additionalProperties: false
19238
+ description: >
19239
+ Body for `PUT /me/preferences`. `notificationChannels` may be omitted to keep
19240
+ stored cells.
18759
19241
  required:
18760
19242
  [theme, sidebarCollapsed, timezone, dataRefreshInterval, notifications, buddyEnabled]
18761
19243
  properties:
@@ -18776,6 +19258,20 @@ components:
18776
19258
  description: >
18777
19259
  When true, show the ThinkAI Buddy mascot. Default and missing stored
18778
19260
  values are false (opt-in only).
19261
+ notificationChannels:
19262
+ $ref: "#/components/schemas/PutNotificationChannelsDto"
19263
+
19264
+ NotificationChannelRequiredErrorDto:
19265
+ type: object
19266
+ additionalProperties: false
19267
+ required: [error, code]
19268
+ properties:
19269
+ error:
19270
+ type: string
19271
+ description: Status email cannot be turned off.
19272
+ code:
19273
+ type: string
19274
+ enum: [notification_channel_required]
18779
19275
 
18780
19276
  ValidationIssueDto:
18781
19277
  type: object
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.148.0",
3
+ "version": "2.150.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",