@thinkai/tai-api-contract 2.2.8 → 2.3.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.2.8
4
+ version: 2.3.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}/...`.
@@ -307,7 +307,9 @@ paths:
307
307
  description: >
308
308
  Replace the workspace's `sources` array. Cursor entries are validated
309
309
  strictly (`token` 1-256 chars, no whitespace, no `env:` prefix;
310
- optional `https:` `baseUrl`); other types pass through with only a
310
+ optional deprecated `baseUrl` is accepted for backwards compatibility and
311
+ ignored at runtime; verification and future refresh use the fixed Cursor Admin API host.
312
+ Other types pass through with only a
311
313
  non-empty `type` requirement so existing
312
314
  github / jira / sonarqube / bitbucket callers are not regressed.
313
315
 
@@ -405,8 +407,9 @@ paths:
405
407
  200 — upstream auth, rate-limit, and network failures surface as
406
408
  `{ success: false, error }` so the SPA can render an inline error.
407
409
 
408
- Currently only `type: cursor` is verified end-to-end (calls
409
- `GET ${baseUrl}/v0/me`); other types report
410
+ Currently only `type: cursor` is verified end-to-end (Cursor Admin API,
411
+ HTTP Basic against `https://api.cursor.com`; optional `baseUrl` in the body is deprecated and ignored).
412
+ Other types report
410
413
  `{ success: false, error: "unsupported_type" }`. Documented `error`
411
414
  codes for cursor: `invalid_token`, `rate_limited`, `network_error`.
412
415
 
@@ -749,6 +752,211 @@ paths:
749
752
  schema:
750
753
  $ref: "#/components/schemas/ErrorMessageDto"
751
754
 
755
+ /workspaces/{workspaceId}/integrations/ai-tool/{provider}/refresh:
756
+ post:
757
+ tags: [Integrations]
758
+ summary: Refresh AI tool integration snapshots
759
+ operationId: refreshWorkspaceAiTool
760
+ description: >
761
+ Provider-agnostic refresh. Returns 409 when an advisory-lock refresh is already in progress.
762
+ On upstream auth/rate/network failures, returns `200` with `{ ok:false, error }` so the SPA can render inline error.
763
+ parameters:
764
+ - $ref: "#/components/parameters/WorkspaceId"
765
+ - name: provider
766
+ in: path
767
+ required: true
768
+ schema:
769
+ type: string
770
+ enum: [cursor]
771
+ responses:
772
+ "200":
773
+ description: Refresh result
774
+ content:
775
+ application/json:
776
+ schema:
777
+ $ref: "#/components/schemas/AiToolRefreshResponseDto"
778
+ examples:
779
+ ok:
780
+ value: { ok: true }
781
+ invalid_token:
782
+ value: { ok: false, error: invalid_token }
783
+ "401":
784
+ $ref: "#/components/responses/Unauthorized"
785
+ "403":
786
+ $ref: "#/components/responses/Forbidden"
787
+ "404":
788
+ description: Provider source missing for this workspace
789
+ content:
790
+ application/json:
791
+ schema:
792
+ $ref: "#/components/schemas/AiToolRefreshResponseDto"
793
+ example:
794
+ ok: false
795
+ error: no_source
796
+ "409":
797
+ description: Refresh already in progress
798
+ content:
799
+ application/json:
800
+ schema:
801
+ $ref: "#/components/schemas/AiToolRefreshResponseDto"
802
+ example:
803
+ ok: false
804
+ error: already_in_progress
805
+
806
+ /workspaces/{workspaceId}/integrations/ai-tool/{provider}/seats:
807
+ get:
808
+ tags: [Integrations]
809
+ summary: List latest AI-tool seats
810
+ operationId: getWorkspaceAiToolSeats
811
+ parameters:
812
+ - $ref: "#/components/parameters/WorkspaceId"
813
+ - name: provider
814
+ in: path
815
+ required: true
816
+ schema:
817
+ type: string
818
+ enum: [cursor]
819
+ responses:
820
+ "200":
821
+ description: Seats
822
+ content:
823
+ application/json:
824
+ schema:
825
+ type: object
826
+ required: [seats]
827
+ properties:
828
+ seats:
829
+ type: array
830
+ items:
831
+ $ref: "#/components/schemas/AiToolSeatDto"
832
+ "401":
833
+ $ref: "#/components/responses/Unauthorized"
834
+ "403":
835
+ $ref: "#/components/responses/Forbidden"
836
+
837
+ /workspaces/{workspaceId}/integrations/ai-tool/{provider}/daily-usage:
838
+ get:
839
+ tags: [Integrations]
840
+ summary: List AI-tool daily usage
841
+ operationId: getWorkspaceAiToolDailyUsage
842
+ parameters:
843
+ - $ref: "#/components/parameters/WorkspaceId"
844
+ - name: provider
845
+ in: path
846
+ required: true
847
+ schema:
848
+ type: string
849
+ enum: [cursor]
850
+ - name: from
851
+ in: query
852
+ required: false
853
+ schema:
854
+ type: string
855
+ format: date
856
+ - name: to
857
+ in: query
858
+ required: false
859
+ schema:
860
+ type: string
861
+ format: date
862
+ - name: externalId
863
+ in: query
864
+ required: false
865
+ schema:
866
+ type: string
867
+ responses:
868
+ "200":
869
+ description: Usage rows
870
+ content:
871
+ application/json:
872
+ schema:
873
+ type: object
874
+ required: [rows]
875
+ properties:
876
+ rows:
877
+ type: array
878
+ items:
879
+ $ref: "#/components/schemas/AiToolDailyUsageRowDto"
880
+ "401":
881
+ $ref: "#/components/responses/Unauthorized"
882
+ "403":
883
+ $ref: "#/components/responses/Forbidden"
884
+
885
+ /workspaces/{workspaceId}/integrations/ai-tool/{provider}/spend:
886
+ get:
887
+ tags: [Integrations]
888
+ summary: List AI-tool spend
889
+ operationId: getWorkspaceAiToolSpend
890
+ parameters:
891
+ - $ref: "#/components/parameters/WorkspaceId"
892
+ - name: provider
893
+ in: path
894
+ required: true
895
+ schema:
896
+ type: string
897
+ enum: [cursor]
898
+ - name: cycleStartMs
899
+ in: query
900
+ required: false
901
+ schema:
902
+ type: integer
903
+ format: int64
904
+ responses:
905
+ "200":
906
+ description: Spend rows
907
+ content:
908
+ application/json:
909
+ schema:
910
+ type: object
911
+ required: [rows]
912
+ properties:
913
+ rows:
914
+ type: array
915
+ items:
916
+ $ref: "#/components/schemas/AiToolSpendRowDto"
917
+ "401":
918
+ $ref: "#/components/responses/Unauthorized"
919
+ "403":
920
+ $ref: "#/components/responses/Forbidden"
921
+
922
+ /workspaces/{workspaceId}/integrations/ai-tool/{provider}/status:
923
+ get:
924
+ tags: [Integrations]
925
+ summary: Get last refresh status
926
+ operationId: getWorkspaceAiToolRefreshStatus
927
+ parameters:
928
+ - $ref: "#/components/parameters/WorkspaceId"
929
+ - name: provider
930
+ in: path
931
+ required: true
932
+ schema:
933
+ type: string
934
+ enum: [cursor]
935
+ responses:
936
+ "200":
937
+ description: Refresh status
938
+ content:
939
+ application/json:
940
+ schema:
941
+ type: object
942
+ required: [status]
943
+ properties:
944
+ status:
945
+ $ref: "#/components/schemas/AiToolRefreshStatusDto"
946
+ "401":
947
+ $ref: "#/components/responses/Unauthorized"
948
+ "403":
949
+ $ref: "#/components/responses/Forbidden"
950
+ "404":
951
+ description: No refresh status yet (or provider source missing)
952
+ content:
953
+ application/json:
954
+ schema:
955
+ $ref: "#/components/schemas/AiToolRefreshResponseDto"
956
+ example:
957
+ ok: false
958
+ error: no_source
959
+
752
960
  /integrations/github/callback:
753
961
  get:
754
962
  tags: [Integrations]
@@ -1613,6 +1821,7 @@ components:
1613
1821
  and `POST /workspaces/{workspaceId}/sources/test`. The `token` field
1614
1822
  carries a literal Cursor API key on writes; reads from
1615
1823
  `GET /workspaces/{workspaceId}/config` redact it to `***`.
1824
+ Runtime calls use the Cursor Admin API at `https://api.cursor.com` (HTTP Basic); do not rely on `baseUrl`.
1616
1825
  required: [type, token]
1617
1826
  additionalProperties: false
1618
1827
  properties:
@@ -1626,8 +1835,10 @@ components:
1626
1835
  description: Cursor API key (literal). Whitespace and `env:` prefix are rejected.
1627
1836
  baseUrl:
1628
1837
  type: string
1629
- format: uri
1630
- description: Override Cursor API base URL. Must use `https:`.
1838
+ deprecated: true
1839
+ description: >
1840
+ Deprecated. Historically suggested an API base URL; the server ignores this field
1841
+ and always uses the Cursor Admin API host. Kept so older clients can submit payloads unchanged.
1631
1842
  default: "https://api.cursor.com"
1632
1843
 
1633
1844
  WorkspaceConfigDto:
@@ -1656,6 +1867,101 @@ components:
1656
1867
  error:
1657
1868
  type: string
1658
1869
 
1870
+ AiToolSeatDto:
1871
+ type: object
1872
+ required: [externalId, email, isRemoved]
1873
+ properties:
1874
+ externalId:
1875
+ type: string
1876
+ email:
1877
+ type: string
1878
+ displayName:
1879
+ type: string
1880
+ nullable: true
1881
+ role:
1882
+ type: string
1883
+ nullable: true
1884
+ isRemoved:
1885
+ type: boolean
1886
+ payload:
1887
+ type: object
1888
+ additionalProperties: true
1889
+
1890
+ AiToolDailyUsageRowDto:
1891
+ type: object
1892
+ required: [day, externalId, isActive]
1893
+ properties:
1894
+ day:
1895
+ type: string
1896
+ format: date
1897
+ externalId:
1898
+ type: string
1899
+ email:
1900
+ type: string
1901
+ nullable: true
1902
+ isActive:
1903
+ type: boolean
1904
+ mostUsedModel:
1905
+ type: string
1906
+ nullable: true
1907
+ payload:
1908
+ type: object
1909
+ additionalProperties: true
1910
+
1911
+ AiToolSpendRowDto:
1912
+ type: object
1913
+ required: [billingCycleStartMs, externalId, spendCents]
1914
+ properties:
1915
+ billingCycleStartMs:
1916
+ type: integer
1917
+ format: int64
1918
+ externalId:
1919
+ type: string
1920
+ email:
1921
+ type: string
1922
+ nullable: true
1923
+ spendCents:
1924
+ type: integer
1925
+ format: int64
1926
+ payload:
1927
+ type: object
1928
+ additionalProperties: true
1929
+
1930
+ AiToolRefreshStatusDto:
1931
+ type: object
1932
+ required: [lastAttemptAt, counts]
1933
+ properties:
1934
+ lastAttemptAt:
1935
+ type: string
1936
+ format: date-time
1937
+ lastSuccessAt:
1938
+ type: string
1939
+ format: date-time
1940
+ nullable: true
1941
+ lastErrorKind:
1942
+ type: string
1943
+ nullable: true
1944
+ lastErrorMessage:
1945
+ type: string
1946
+ nullable: true
1947
+ durationMs:
1948
+ type: integer
1949
+ format: int64
1950
+ nullable: true
1951
+ counts:
1952
+ type: object
1953
+ additionalProperties: true
1954
+
1955
+ AiToolRefreshResponseDto:
1956
+ type: object
1957
+ required: [ok]
1958
+ properties:
1959
+ ok:
1960
+ type: boolean
1961
+ error:
1962
+ type: string
1963
+ nullable: true
1964
+
1659
1965
  DashboardProductivityMetricsDto:
1660
1966
  type: object
1661
1967
  description: Nested metric groups; see TypeScript `DashboardProductivityMetricsDto` in @thinkai/tai-api-contract.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.2.8",
3
+ "version": "2.3.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",