@thinkai/tai-api-contract 2.60.0 → 2.61.0-pr.901.b553abc8

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.60.0
4
+ version: 2.61.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}/...`.
@@ -1469,6 +1469,10 @@ paths:
1469
1469
  value:
1470
1470
  success: false
1471
1471
  error: "invalid_token"
1472
+ zenhr_sync_in_progress:
1473
+ value:
1474
+ success: false
1475
+ error: zenhr_sync_in_progress
1472
1476
  "400":
1473
1477
  description: Invalid body or missing env for token refs
1474
1478
  content:
@@ -3004,6 +3008,9 @@ paths:
3004
3008
  operationId: postGithubInstallUrl
3005
3009
  description: >
3006
3010
  Creates a GitHub App installation URL scoped to the workspace and caller.
3011
+ Default intent `connect` installs ThinkAI Platform Insights (read).
3012
+ Intent `enable_fixes` installs ThinkAI Platform Automations (write) for the Insights
3013
+ installation identified by `installationId`.
3007
3014
  Body is optional; when omitted, defaults to `/onboarding/integrations` return path.
3008
3015
  Optional `pickerSession` (from user OAuth org picker) recovers `returnPath` from the server-side picker snapshot when the multi-hop authorize→install flow should return to the page where OAuth started.
3009
3016
  security:
@@ -3039,6 +3046,91 @@ paths:
3039
3046
  application/json:
3040
3047
  schema:
3041
3048
  $ref: "#/components/schemas/ErrorMessageDto"
3049
+ "503":
3050
+ description: Requested GitHub App is not configured
3051
+ content:
3052
+ application/json:
3053
+ schema:
3054
+ $ref: "#/components/schemas/ErrorMessageDto"
3055
+
3056
+ /workspaces/{workspaceId}/integrations/github/installations/{installationId}/automated-fixes/enable:
3057
+ post:
3058
+ tags: [Integrations]
3059
+ summary: Enable automated fixes for a GitHub installation
3060
+ operationId: postGithubAutomatedFixesEnable
3061
+ description: >
3062
+ Workspace-level enable for automated fixes on an Insights (read) installation.
3063
+ If an Automations (write) installation is already linked, flips `automatedFixesEnabled`
3064
+ without reinstalling. Otherwise returns `outcome: needs_install` so the client can
3065
+ call install-url with intent=enable_fixes.
3066
+ security:
3067
+ - bearerAuth: []
3068
+ parameters:
3069
+ - $ref: "#/components/parameters/WorkspaceId"
3070
+ - name: installationId
3071
+ in: path
3072
+ required: true
3073
+ schema:
3074
+ type: string
3075
+ minLength: 1
3076
+ maxLength: 64
3077
+ responses:
3078
+ "200":
3079
+ description: Enable result
3080
+ content:
3081
+ application/json:
3082
+ schema:
3083
+ $ref: "#/components/schemas/GithubAutomatedFixesEnableResponseDto"
3084
+ "401":
3085
+ $ref: "#/components/responses/Unauthorized"
3086
+ "403":
3087
+ $ref: "#/components/responses/Forbidden"
3088
+ "404":
3089
+ description: Workspace or installation not found
3090
+ content:
3091
+ application/json:
3092
+ schema:
3093
+ $ref: "#/components/schemas/ErrorMessageDto"
3094
+ "503":
3095
+ description: Automations GitHub App not configured
3096
+ content:
3097
+ application/json:
3098
+ schema:
3099
+ $ref: "#/components/schemas/ErrorMessageDto"
3100
+
3101
+ /workspaces/{workspaceId}/integrations/github/installations/{installationId}/automated-fixes:
3102
+ delete:
3103
+ tags: [Integrations]
3104
+ summary: Disable automated fixes for a GitHub installation
3105
+ operationId: deleteGithubAutomatedFixes
3106
+ description: >
3107
+ Workspace-level disable. Clears `automatedFixesEnabled` but keeps the linked Automations
3108
+ write installation id so re-enable does not require reinstall. Does not uninstall the
3109
+ Automations app from GitHub.
3110
+ security:
3111
+ - bearerAuth: []
3112
+ parameters:
3113
+ - $ref: "#/components/parameters/WorkspaceId"
3114
+ - name: installationId
3115
+ in: path
3116
+ required: true
3117
+ schema:
3118
+ type: string
3119
+ minLength: 1
3120
+ maxLength: 64
3121
+ responses:
3122
+ "204":
3123
+ description: Automated fixes disabled (or already disabled)
3124
+ "401":
3125
+ $ref: "#/components/responses/Unauthorized"
3126
+ "403":
3127
+ $ref: "#/components/responses/Forbidden"
3128
+ "404":
3129
+ description: Workspace or installation not found
3130
+ content:
3131
+ application/json:
3132
+ schema:
3133
+ $ref: "#/components/schemas/ErrorMessageDto"
3042
3134
 
3043
3135
  /workspaces/{workspaceId}/integrations/github/user-authorize-url:
3044
3136
  post:
@@ -5605,6 +5697,31 @@ paths:
5605
5697
  application/json:
5606
5698
  schema:
5607
5699
  $ref: "#/components/schemas/ErrorMessageDto"
5700
+ "422":
5701
+ description: GitHub installation lacks write permissions required for automated fix PRs
5702
+ content:
5703
+ application/json:
5704
+ schema:
5705
+ $ref: "#/components/schemas/GithubWritePermissionsRequiredErrorDto"
5706
+ examples:
5707
+ write_required:
5708
+ value:
5709
+ error: github_write_permissions_required
5710
+ missingPermissions:
5711
+ - name: contents
5712
+ required: write
5713
+ granted: read
5714
+ - name: pull_requests
5715
+ required: write
5716
+ granted: read
5717
+ manageUrl: https://github.com/settings/installations/12345
5718
+ writeUpgradeMessage: "Automated fixes need write access to your repositories: Contents (Read and write) and Pull requests (Read and write). Fixes open pull requests you review — nothing is merged automatically. Approve the update on GitHub to enable fix PRs."
5719
+ "503":
5720
+ description: GitHub installation permissions could not be verified
5721
+ content:
5722
+ application/json:
5723
+ schema:
5724
+ $ref: "#/components/schemas/GithubPermissionsCheckFailedErrorDto"
5608
5725
 
5609
5726
  /workspaces/{workspaceId}/readiness/fixes/{fixId}/retrigger:
5610
5727
  post:
@@ -5648,6 +5765,18 @@ paths:
5648
5765
  value:
5649
5766
  error: Fix is currently generating and cannot be superseded
5650
5767
  code: fix_generating
5768
+ "422":
5769
+ description: GitHub installation lacks write permissions required for automated fix PRs
5770
+ content:
5771
+ application/json:
5772
+ schema:
5773
+ $ref: "#/components/schemas/GithubWritePermissionsRequiredErrorDto"
5774
+ "503":
5775
+ description: GitHub installation permissions could not be verified
5776
+ content:
5777
+ application/json:
5778
+ schema:
5779
+ $ref: "#/components/schemas/GithubPermissionsCheckFailedErrorDto"
5651
5780
 
5652
5781
  /workspaces/{workspaceId}/cursor/platform-key-consent:
5653
5782
  put:
@@ -6604,7 +6733,8 @@ paths:
6604
6733
  Returns `{ ok: false, oauthRequired: true }` when stored credentials exist but refresh
6605
6734
  failed with an OAuth re-authorization error (e.g. `invalid_grant`); the SPA should
6606
6735
  start ZenHR OAuth next. Returns `502` for other upstream failures (same semantics as
6607
- `GET .../integrations/zenhr/branches`).
6736
+ `GET .../integrations/zenhr/branches`). Returns `503` with `zenhr_sync_in_progress` when
6737
+ an HRIS sync or OAuth refresh is already in progress for this workspace (retry shortly).
6608
6738
  parameters:
6609
6739
  - $ref: "#/components/parameters/WorkspaceId"
6610
6740
  responses:
@@ -6642,6 +6772,107 @@ paths:
6642
6772
  $ref: "#/components/schemas/ErrorMessageDto"
6643
6773
  example:
6644
6774
  error: zenhr_reconnect_failed
6775
+ "503":
6776
+ $ref: "#/components/responses/ZenHrSyncInProgress"
6777
+
6778
+ /workspaces/{workspaceId}/integrations/zenhr/branches:
6779
+ get:
6780
+ tags: [HRIS, Integrations]
6781
+ summary: List ZenHR branches
6782
+ operationId: listWorkspaceZenHrBranches
6783
+ description: >
6784
+ Lists ZenHR branches for the connected OAuth app so a workspace admin can pick one.
6785
+ Requires workspace admin role. Returns `503` with `zenhr_sync_in_progress` when an HRIS
6786
+ sync or OAuth refresh is already in progress (retry shortly).
6787
+ parameters:
6788
+ - $ref: "#/components/parameters/WorkspaceId"
6789
+ responses:
6790
+ "200":
6791
+ description: Branch list
6792
+ content:
6793
+ application/json:
6794
+ schema:
6795
+ $ref: "#/components/schemas/ZenHrBranchesListDto"
6796
+ "401":
6797
+ $ref: "#/components/responses/Unauthorized"
6798
+ "403":
6799
+ $ref: "#/components/responses/Forbidden"
6800
+ "404":
6801
+ description: ZenHR is not connected for this workspace
6802
+ content:
6803
+ application/json:
6804
+ schema:
6805
+ $ref: "#/components/schemas/ErrorMessageDto"
6806
+ example:
6807
+ error: zenhr_not_connected
6808
+ "502":
6809
+ description: ZenHR branch list unavailable
6810
+ content:
6811
+ application/json:
6812
+ schema:
6813
+ $ref: "#/components/schemas/ErrorMessageDto"
6814
+ example:
6815
+ error: zenhr_branches_unavailable
6816
+ "503":
6817
+ $ref: "#/components/responses/ZenHrSyncInProgress"
6818
+
6819
+ /workspaces/{workspaceId}/integrations/zenhr/branch:
6820
+ patch:
6821
+ tags: [HRIS, Integrations]
6822
+ summary: Save selected ZenHR branch
6823
+ operationId: patchWorkspaceZenHrBranch
6824
+ description: >
6825
+ Validates and persists the admin-selected ZenHR branch id on the workspace source.
6826
+ Requires workspace admin role. Returns `503` with `zenhr_sync_in_progress` when an HRIS
6827
+ sync or OAuth refresh is already in progress (retry shortly).
6828
+ parameters:
6829
+ - $ref: "#/components/parameters/WorkspaceId"
6830
+ requestBody:
6831
+ required: true
6832
+ content:
6833
+ application/json:
6834
+ schema:
6835
+ $ref: "#/components/schemas/ZenHrBranchSelectionDto"
6836
+ responses:
6837
+ "200":
6838
+ description: Branch saved
6839
+ content:
6840
+ application/json:
6841
+ schema:
6842
+ $ref: "#/components/schemas/ZenHrBranchSelectionResultDto"
6843
+ "400":
6844
+ description: Invalid body or unknown branch id
6845
+ content:
6846
+ application/json:
6847
+ schema:
6848
+ $ref: "#/components/schemas/ErrorMessageDto"
6849
+ examples:
6850
+ invalid_request:
6851
+ value: { error: invalid_request }
6852
+ invalid_branch_id:
6853
+ value: { error: invalid_branch_id }
6854
+ "401":
6855
+ $ref: "#/components/responses/Unauthorized"
6856
+ "403":
6857
+ $ref: "#/components/responses/Forbidden"
6858
+ "404":
6859
+ description: ZenHR is not connected for this workspace
6860
+ content:
6861
+ application/json:
6862
+ schema:
6863
+ $ref: "#/components/schemas/ErrorMessageDto"
6864
+ example:
6865
+ error: zenhr_not_connected
6866
+ "502":
6867
+ description: ZenHR branch validation unavailable
6868
+ content:
6869
+ application/json:
6870
+ schema:
6871
+ $ref: "#/components/schemas/ErrorMessageDto"
6872
+ example:
6873
+ error: zenhr_branches_unavailable
6874
+ "503":
6875
+ $ref: "#/components/responses/ZenHrSyncInProgress"
6645
6876
 
6646
6877
  /workspaces/{workspaceId}/hris/status:
6647
6878
  get:
@@ -6972,6 +7203,14 @@ components:
6972
7203
  application/json:
6973
7204
  schema:
6974
7205
  $ref: "#/components/schemas/ErrorMessageDto"
7206
+ ZenHrSyncInProgress:
7207
+ description: HRIS sync or ZenHR OAuth refresh already in progress for this workspace
7208
+ content:
7209
+ application/json:
7210
+ schema:
7211
+ $ref: "#/components/schemas/ErrorMessageDto"
7212
+ example:
7213
+ error: zenhr_sync_in_progress
6975
7214
 
6976
7215
  schemas:
6977
7216
  ErrorMessageDto:
@@ -7749,6 +7988,9 @@ components:
7749
7988
  type: boolean
7750
7989
  error:
7751
7990
  type: string
7991
+ description: >
7992
+ Machine-readable failure code when success=false (e.g. invalid_token,
7993
+ zenhr_sync_in_progress when ZenHR OAuth refresh is contended).
7752
7994
  executionKeyValid:
7753
7995
  type: boolean
7754
7996
  nullable: true
@@ -10606,9 +10848,50 @@ components:
10606
10848
  nullable: true
10607
10849
  description: Null when the installation has not granted this permission.
10608
10850
 
10851
+ GithubWritePermissionsRequiredErrorDto:
10852
+ type: object
10853
+ additionalProperties: false
10854
+ required: [error, missingPermissions]
10855
+ properties:
10856
+ error:
10857
+ type: string
10858
+ enum: [github_write_permissions_required]
10859
+ missingPermissions:
10860
+ type: array
10861
+ items:
10862
+ $ref: "#/components/schemas/GithubMissingPermissionDto"
10863
+ manageUrl:
10864
+ type: string
10865
+ nullable: true
10866
+ description: GitHub installation settings URL to approve write permissions.
10867
+ writeUpgradeMessage:
10868
+ type: string
10869
+ nullable: true
10870
+ description: Human-readable summary of the write permission upgrade.
10871
+
10872
+ GithubPermissionsCheckFailedErrorDto:
10873
+ type: object
10874
+ additionalProperties: false
10875
+ required: [error]
10876
+ properties:
10877
+ error:
10878
+ type: string
10879
+ enum: [github_permissions_check_failed]
10880
+ description: GitHub installation permissions could not be verified (transient upstream failure).
10881
+
10609
10882
  GithubInstallationSummaryDto:
10610
10883
  type: object
10611
- required: [installationId, account, repos, permissionsUpgradeRequired]
10884
+ required:
10885
+ - installationId
10886
+ - account
10887
+ - repos
10888
+ - permissionsUpgradeRequired
10889
+ - corePermissionsOk
10890
+ - writePermissionsOk
10891
+ - writePermissionsUpgradeRequired
10892
+ - automatedFixesEnabled
10893
+ - writeAppInstalled
10894
+ - canEnableAutomatedFixes
10612
10895
  properties:
10613
10896
  installationId:
10614
10897
  type: string
@@ -10630,16 +10913,61 @@ components:
10630
10913
  permissionsUpgradeRequired:
10631
10914
  type: boolean
10632
10915
  description: >
10633
- True when this installation's granted permissions are below what the ThinkAI GitHub App
10634
- currently requests.
10916
+ True when this installation lacks core read permissions required for connect and analysis.
10917
+ Alias for `!corePermissionsOk`.
10918
+ corePermissionsOk:
10919
+ type: boolean
10920
+ description: >
10921
+ True when installation grants read permissions for repository analysis (contents, metadata,
10922
+ pull requests, and members for org installs).
10923
+ writePermissionsOk:
10924
+ type: boolean
10925
+ description: >
10926
+ True when automated fixes are enabled and the linked Automations (write) installation
10927
+ grants write permissions required for fix PRs.
10928
+ writePermissionsUpgradeRequired:
10929
+ type: boolean
10930
+ description: Alias for `!writePermissionsOk`.
10635
10931
  missingPermissions:
10636
10932
  type: array
10637
10933
  items:
10638
10934
  $ref: "#/components/schemas/GithubMissingPermissionDto"
10935
+ description: Core read permissions still needed for connect and analysis.
10936
+ missingWritePermissions:
10937
+ type: array
10938
+ items:
10939
+ $ref: "#/components/schemas/GithubMissingPermissionDto"
10940
+ description: Write permissions still needed for automated fix PRs.
10639
10941
  upgradeMessage:
10640
10942
  type: string
10641
10943
  nullable: true
10642
- description: Human-readable summary for UI when permissionsUpgradeRequired is true.
10944
+ description: Human-readable summary for UI when core permissions are missing.
10945
+ writeUpgradeMessage:
10946
+ type: string
10947
+ nullable: true
10948
+ description: Human-readable summary for UI when write permissions are missing.
10949
+ automatedFixesEnabled:
10950
+ type: boolean
10951
+ description: >
10952
+ True when this workspace has enabled automated fixes for this Insights (read)
10953
+ installation and linked a ThinkAI Platform Automations (write) installation.
10954
+ writeAppInstalled:
10955
+ type: boolean
10956
+ description: True when an Automations (write) GitHub App installation is linked.
10957
+ writeInstallationId:
10958
+ type: string
10959
+ nullable: true
10960
+ description: GitHub installation id for the Automations (write) app, when linked.
10961
+ writeManageUrl:
10962
+ type: string
10963
+ format: uri
10964
+ nullable: true
10965
+ description: GitHub settings URL for the Automations (write) installation.
10966
+ canEnableAutomatedFixes:
10967
+ type: boolean
10968
+ description: >
10969
+ True when the Automations app is configured and automated fixes are not yet
10970
+ enabled for this installation (UI may show Enable automated fixes).
10643
10971
 
10644
10972
  GithubPendingApprovalDto:
10645
10973
  type: object
@@ -10924,7 +11252,13 @@ components:
10924
11252
 
10925
11253
  GithubInstallationStatusDto:
10926
11254
  type: object
10927
- required: [installed, installations, permissionsUpgradeRequired]
11255
+ required:
11256
+ - installed
11257
+ - installations
11258
+ - permissionsUpgradeRequired
11259
+ - corePermissionsOk
11260
+ - writePermissionsOk
11261
+ - writePermissionsUpgradeRequired
10928
11262
  properties:
10929
11263
  installed:
10930
11264
  type: boolean
@@ -10934,7 +11268,25 @@ components:
10934
11268
  $ref: "#/components/schemas/GithubInstallationSummaryDto"
10935
11269
  permissionsUpgradeRequired:
10936
11270
  type: boolean
10937
- description: True if any connected installation is under-permissioned.
11271
+ description: True if any connected installation lacks core read permissions. Alias for `!corePermissionsOk`.
11272
+ corePermissionsOk:
11273
+ type: boolean
11274
+ description: True when every connected installation grants core read permissions.
11275
+ writePermissionsOk:
11276
+ type: boolean
11277
+ description: True when every connected installation grants write permissions for automated fixes.
11278
+ writePermissionsUpgradeRequired:
11279
+ type: boolean
11280
+ description: True when any connected installation lacks write permissions for automated fixes.
11281
+ missingWritePermissions:
11282
+ type: array
11283
+ items:
11284
+ $ref: "#/components/schemas/GithubMissingPermissionDto"
11285
+ description: Aggregated write permissions missing on installations that lack write access.
11286
+ writeUpgradeMessage:
11287
+ type: string
11288
+ nullable: true
11289
+ description: Human-readable summary when write permissions are missing.
10938
11290
  pendingApproval:
10939
11291
  nullable: true
10940
11292
  allOf:
@@ -11010,6 +11362,17 @@ components:
11010
11362
  format: uri
11011
11363
  maxLength: 256
11012
11364
  description: SPA origin to redirect back to after OAuth; must match server spaOrigins allowlist.
11365
+ intent:
11366
+ type: string
11367
+ enum: [connect, enable_fixes]
11368
+ description: >
11369
+ connect installs ThinkAI Platform Insights (read). enable_fixes installs ThinkAI Platform
11370
+ Automations (write) for the Insights installation identified by installationId.
11371
+ installationId:
11372
+ type: string
11373
+ minLength: 1
11374
+ maxLength: 64
11375
+ description: Insights (read) installation id required when intent is enable_fixes.
11013
11376
 
11014
11377
  GithubInstallUrlResponseDto:
11015
11378
  type: object
@@ -11025,6 +11388,22 @@ components:
11025
11388
  minLength: 16
11026
11389
  maxLength: 128
11027
11390
 
11391
+ GithubAutomatedFixesEnableResponseDto:
11392
+ type: object
11393
+ additionalProperties: false
11394
+ required: [outcome]
11395
+ properties:
11396
+ outcome:
11397
+ type: string
11398
+ enum: [enabled, needs_install]
11399
+ description: >
11400
+ enabled — write app already linked and flag flipped; needs_install — client should
11401
+ call install-url with intent=enable_fixes.
11402
+ status:
11403
+ allOf:
11404
+ - $ref: "#/components/schemas/GithubInstallationStatusDto"
11405
+ description: Present when outcome is enabled.
11406
+
11028
11407
  GithubUserAuthorizeUrlRequestDto:
11029
11408
  type: object
11030
11409
  additionalProperties: false
@@ -13519,6 +13898,38 @@ components:
13519
13898
  enum: [zenhr_oauth_required]
13520
13899
  description: Machine-readable code when ok=false and oauthRequired=true.
13521
13900
 
13901
+ ZenHrBranchDto:
13902
+ type: object
13903
+ required: [id, name]
13904
+ properties:
13905
+ id:
13906
+ type: string
13907
+ name:
13908
+ type: string
13909
+
13910
+ ZenHrBranchesListDto:
13911
+ type: object
13912
+ required: [branches]
13913
+ properties:
13914
+ branches:
13915
+ type: array
13916
+ items:
13917
+ $ref: "#/components/schemas/ZenHrBranchDto"
13918
+
13919
+ ZenHrBranchSelectionDto:
13920
+ type: object
13921
+ required: [branchId]
13922
+ properties:
13923
+ branchId:
13924
+ type: string
13925
+
13926
+ ZenHrBranchSelectionResultDto:
13927
+ type: object
13928
+ required: [branchId]
13929
+ properties:
13930
+ branchId:
13931
+ type: string
13932
+
13522
13933
  HrisTriggerSyncResultDto:
13523
13934
  type: object
13524
13935
  required: [status]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.60.0",
3
+ "version": "2.61.0-pr.901.b553abc8",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",