@thinkai/tai-api-contract 2.2.9 → 2.3.1
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.
- package/dist/generated/openapi.d.ts +328 -7
- package/dist/generated/openapi.d.ts.map +1 -1
- package/openapi/openapi.yaml +325 -12
- package/package.json +1 -1
- package/src/generated/openapi.ts +328 -7
package/openapi/openapi.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
openapi: 3.0.3
|
|
2
2
|
info:
|
|
3
3
|
title: ThinkAI API
|
|
4
|
-
version: 2.
|
|
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}/...`.
|
|
@@ -311,7 +311,9 @@ paths:
|
|
|
311
311
|
ignored at runtime; verification and future refresh use the fixed Cursor Admin API host.
|
|
312
312
|
Other types pass through with only a
|
|
313
313
|
non-empty `type` requirement so existing
|
|
314
|
-
|
|
314
|
+
jira / sonarqube / bitbucket callers are not regressed.
|
|
315
|
+
**`type: github` is rejected** with HTTP 400 and `code: github_sources_deprecated`; use the
|
|
316
|
+
GitHub App integration (`POST /workspaces/{workspaceId}/integrations/github/install-url` and callback) instead.
|
|
315
317
|
|
|
316
318
|
Every secret-keyed top-level string field
|
|
317
319
|
(`token`, `password`, `api_key`, `secret`, `private_key`,
|
|
@@ -324,8 +326,8 @@ paths:
|
|
|
324
326
|
Requires editor or admin workspace role.
|
|
325
327
|
|
|
326
328
|
**Typical outcomes:** Valid typed sources → `200` with `{ ok: true, workspaceId }`. Missing required
|
|
327
|
-
fields for a given `type`
|
|
328
|
-
Unknown `type` strings (non-cursor) currently pass through to storage (lenient compatibility); only `cursor`
|
|
329
|
+
fields for a given `type` → `400` with `error` text.
|
|
330
|
+
Unknown `type` strings (non-cursor, non-github) currently pass through to storage (lenient compatibility); only `cursor`
|
|
329
331
|
entries get strict field validation. Cursor sources enforce strict token shape (no whitespace, no `env:` prefix).
|
|
330
332
|
operationId: putTenantSources
|
|
331
333
|
parameters:
|
|
@@ -345,14 +347,17 @@ paths:
|
|
|
345
347
|
- $ref: "#/components/schemas/CursorSourceDto"
|
|
346
348
|
- $ref: "#/components/schemas/TenantSourceEntryDto"
|
|
347
349
|
examples:
|
|
348
|
-
|
|
349
|
-
summary: GitHub
|
|
350
|
+
cursorAndJira:
|
|
351
|
+
summary: Cursor plus Jira (GitHub uses App integration, not sources)
|
|
350
352
|
value:
|
|
351
353
|
sources:
|
|
352
|
-
- type:
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
354
|
+
- type: cursor
|
|
355
|
+
token: cursor_api_key_example
|
|
356
|
+
baseUrl: https://api.cursor.com
|
|
357
|
+
- type: jira
|
|
358
|
+
baseUrl: https://jira.example.com
|
|
359
|
+
email: u@example.com
|
|
360
|
+
apiToken: token
|
|
356
361
|
jiraValid:
|
|
357
362
|
summary: Jira Cloud source
|
|
358
363
|
value:
|
|
@@ -389,8 +394,16 @@ paths:
|
|
|
389
394
|
application/json:
|
|
390
395
|
schema:
|
|
391
396
|
$ref: "#/components/schemas/ErrorMessageDto"
|
|
392
|
-
|
|
393
|
-
|
|
397
|
+
examples:
|
|
398
|
+
generic:
|
|
399
|
+
summary: Generic validation error
|
|
400
|
+
value:
|
|
401
|
+
error: repo is required
|
|
402
|
+
githubDeprecated:
|
|
403
|
+
summary: Legacy GitHub PAT in sources (use GitHub App)
|
|
404
|
+
value:
|
|
405
|
+
error: 'sources[0]: type "github" is no longer supported in workspace sources; use the GitHub App integration (POST .../integrations/github/install-url).'
|
|
406
|
+
code: github_sources_deprecated
|
|
394
407
|
"401":
|
|
395
408
|
$ref: "#/components/responses/Unauthorized"
|
|
396
409
|
"403":
|
|
@@ -752,6 +765,211 @@ paths:
|
|
|
752
765
|
schema:
|
|
753
766
|
$ref: "#/components/schemas/ErrorMessageDto"
|
|
754
767
|
|
|
768
|
+
/workspaces/{workspaceId}/integrations/ai-tool/{provider}/refresh:
|
|
769
|
+
post:
|
|
770
|
+
tags: [Integrations]
|
|
771
|
+
summary: Refresh AI tool integration snapshots
|
|
772
|
+
operationId: refreshWorkspaceAiTool
|
|
773
|
+
description: >
|
|
774
|
+
Provider-agnostic refresh. Returns 409 when an advisory-lock refresh is already in progress.
|
|
775
|
+
On upstream auth/rate/network failures, returns `200` with `{ ok:false, error }` so the SPA can render inline error.
|
|
776
|
+
parameters:
|
|
777
|
+
- $ref: "#/components/parameters/WorkspaceId"
|
|
778
|
+
- name: provider
|
|
779
|
+
in: path
|
|
780
|
+
required: true
|
|
781
|
+
schema:
|
|
782
|
+
type: string
|
|
783
|
+
enum: [cursor]
|
|
784
|
+
responses:
|
|
785
|
+
"200":
|
|
786
|
+
description: Refresh result
|
|
787
|
+
content:
|
|
788
|
+
application/json:
|
|
789
|
+
schema:
|
|
790
|
+
$ref: "#/components/schemas/AiToolRefreshResponseDto"
|
|
791
|
+
examples:
|
|
792
|
+
ok:
|
|
793
|
+
value: { ok: true }
|
|
794
|
+
invalid_token:
|
|
795
|
+
value: { ok: false, error: invalid_token }
|
|
796
|
+
"401":
|
|
797
|
+
$ref: "#/components/responses/Unauthorized"
|
|
798
|
+
"403":
|
|
799
|
+
$ref: "#/components/responses/Forbidden"
|
|
800
|
+
"404":
|
|
801
|
+
description: Provider source missing for this workspace
|
|
802
|
+
content:
|
|
803
|
+
application/json:
|
|
804
|
+
schema:
|
|
805
|
+
$ref: "#/components/schemas/AiToolRefreshResponseDto"
|
|
806
|
+
example:
|
|
807
|
+
ok: false
|
|
808
|
+
error: no_source
|
|
809
|
+
"409":
|
|
810
|
+
description: Refresh already in progress
|
|
811
|
+
content:
|
|
812
|
+
application/json:
|
|
813
|
+
schema:
|
|
814
|
+
$ref: "#/components/schemas/AiToolRefreshResponseDto"
|
|
815
|
+
example:
|
|
816
|
+
ok: false
|
|
817
|
+
error: already_in_progress
|
|
818
|
+
|
|
819
|
+
/workspaces/{workspaceId}/integrations/ai-tool/{provider}/seats:
|
|
820
|
+
get:
|
|
821
|
+
tags: [Integrations]
|
|
822
|
+
summary: List latest AI-tool seats
|
|
823
|
+
operationId: getWorkspaceAiToolSeats
|
|
824
|
+
parameters:
|
|
825
|
+
- $ref: "#/components/parameters/WorkspaceId"
|
|
826
|
+
- name: provider
|
|
827
|
+
in: path
|
|
828
|
+
required: true
|
|
829
|
+
schema:
|
|
830
|
+
type: string
|
|
831
|
+
enum: [cursor]
|
|
832
|
+
responses:
|
|
833
|
+
"200":
|
|
834
|
+
description: Seats
|
|
835
|
+
content:
|
|
836
|
+
application/json:
|
|
837
|
+
schema:
|
|
838
|
+
type: object
|
|
839
|
+
required: [seats]
|
|
840
|
+
properties:
|
|
841
|
+
seats:
|
|
842
|
+
type: array
|
|
843
|
+
items:
|
|
844
|
+
$ref: "#/components/schemas/AiToolSeatDto"
|
|
845
|
+
"401":
|
|
846
|
+
$ref: "#/components/responses/Unauthorized"
|
|
847
|
+
"403":
|
|
848
|
+
$ref: "#/components/responses/Forbidden"
|
|
849
|
+
|
|
850
|
+
/workspaces/{workspaceId}/integrations/ai-tool/{provider}/daily-usage:
|
|
851
|
+
get:
|
|
852
|
+
tags: [Integrations]
|
|
853
|
+
summary: List AI-tool daily usage
|
|
854
|
+
operationId: getWorkspaceAiToolDailyUsage
|
|
855
|
+
parameters:
|
|
856
|
+
- $ref: "#/components/parameters/WorkspaceId"
|
|
857
|
+
- name: provider
|
|
858
|
+
in: path
|
|
859
|
+
required: true
|
|
860
|
+
schema:
|
|
861
|
+
type: string
|
|
862
|
+
enum: [cursor]
|
|
863
|
+
- name: from
|
|
864
|
+
in: query
|
|
865
|
+
required: false
|
|
866
|
+
schema:
|
|
867
|
+
type: string
|
|
868
|
+
format: date
|
|
869
|
+
- name: to
|
|
870
|
+
in: query
|
|
871
|
+
required: false
|
|
872
|
+
schema:
|
|
873
|
+
type: string
|
|
874
|
+
format: date
|
|
875
|
+
- name: externalId
|
|
876
|
+
in: query
|
|
877
|
+
required: false
|
|
878
|
+
schema:
|
|
879
|
+
type: string
|
|
880
|
+
responses:
|
|
881
|
+
"200":
|
|
882
|
+
description: Usage rows
|
|
883
|
+
content:
|
|
884
|
+
application/json:
|
|
885
|
+
schema:
|
|
886
|
+
type: object
|
|
887
|
+
required: [rows]
|
|
888
|
+
properties:
|
|
889
|
+
rows:
|
|
890
|
+
type: array
|
|
891
|
+
items:
|
|
892
|
+
$ref: "#/components/schemas/AiToolDailyUsageRowDto"
|
|
893
|
+
"401":
|
|
894
|
+
$ref: "#/components/responses/Unauthorized"
|
|
895
|
+
"403":
|
|
896
|
+
$ref: "#/components/responses/Forbidden"
|
|
897
|
+
|
|
898
|
+
/workspaces/{workspaceId}/integrations/ai-tool/{provider}/spend:
|
|
899
|
+
get:
|
|
900
|
+
tags: [Integrations]
|
|
901
|
+
summary: List AI-tool spend
|
|
902
|
+
operationId: getWorkspaceAiToolSpend
|
|
903
|
+
parameters:
|
|
904
|
+
- $ref: "#/components/parameters/WorkspaceId"
|
|
905
|
+
- name: provider
|
|
906
|
+
in: path
|
|
907
|
+
required: true
|
|
908
|
+
schema:
|
|
909
|
+
type: string
|
|
910
|
+
enum: [cursor]
|
|
911
|
+
- name: cycleStartMs
|
|
912
|
+
in: query
|
|
913
|
+
required: false
|
|
914
|
+
schema:
|
|
915
|
+
type: integer
|
|
916
|
+
format: int64
|
|
917
|
+
responses:
|
|
918
|
+
"200":
|
|
919
|
+
description: Spend rows
|
|
920
|
+
content:
|
|
921
|
+
application/json:
|
|
922
|
+
schema:
|
|
923
|
+
type: object
|
|
924
|
+
required: [rows]
|
|
925
|
+
properties:
|
|
926
|
+
rows:
|
|
927
|
+
type: array
|
|
928
|
+
items:
|
|
929
|
+
$ref: "#/components/schemas/AiToolSpendRowDto"
|
|
930
|
+
"401":
|
|
931
|
+
$ref: "#/components/responses/Unauthorized"
|
|
932
|
+
"403":
|
|
933
|
+
$ref: "#/components/responses/Forbidden"
|
|
934
|
+
|
|
935
|
+
/workspaces/{workspaceId}/integrations/ai-tool/{provider}/status:
|
|
936
|
+
get:
|
|
937
|
+
tags: [Integrations]
|
|
938
|
+
summary: Get last refresh status
|
|
939
|
+
operationId: getWorkspaceAiToolRefreshStatus
|
|
940
|
+
parameters:
|
|
941
|
+
- $ref: "#/components/parameters/WorkspaceId"
|
|
942
|
+
- name: provider
|
|
943
|
+
in: path
|
|
944
|
+
required: true
|
|
945
|
+
schema:
|
|
946
|
+
type: string
|
|
947
|
+
enum: [cursor]
|
|
948
|
+
responses:
|
|
949
|
+
"200":
|
|
950
|
+
description: Refresh status
|
|
951
|
+
content:
|
|
952
|
+
application/json:
|
|
953
|
+
schema:
|
|
954
|
+
type: object
|
|
955
|
+
required: [status]
|
|
956
|
+
properties:
|
|
957
|
+
status:
|
|
958
|
+
$ref: "#/components/schemas/AiToolRefreshStatusDto"
|
|
959
|
+
"401":
|
|
960
|
+
$ref: "#/components/responses/Unauthorized"
|
|
961
|
+
"403":
|
|
962
|
+
$ref: "#/components/responses/Forbidden"
|
|
963
|
+
"404":
|
|
964
|
+
description: No refresh status yet (or provider source missing)
|
|
965
|
+
content:
|
|
966
|
+
application/json:
|
|
967
|
+
schema:
|
|
968
|
+
$ref: "#/components/schemas/AiToolRefreshResponseDto"
|
|
969
|
+
example:
|
|
970
|
+
ok: false
|
|
971
|
+
error: no_source
|
|
972
|
+
|
|
755
973
|
/integrations/github/callback:
|
|
756
974
|
get:
|
|
757
975
|
tags: [Integrations]
|
|
@@ -1662,6 +1880,101 @@ components:
|
|
|
1662
1880
|
error:
|
|
1663
1881
|
type: string
|
|
1664
1882
|
|
|
1883
|
+
AiToolSeatDto:
|
|
1884
|
+
type: object
|
|
1885
|
+
required: [externalId, email, isRemoved]
|
|
1886
|
+
properties:
|
|
1887
|
+
externalId:
|
|
1888
|
+
type: string
|
|
1889
|
+
email:
|
|
1890
|
+
type: string
|
|
1891
|
+
displayName:
|
|
1892
|
+
type: string
|
|
1893
|
+
nullable: true
|
|
1894
|
+
role:
|
|
1895
|
+
type: string
|
|
1896
|
+
nullable: true
|
|
1897
|
+
isRemoved:
|
|
1898
|
+
type: boolean
|
|
1899
|
+
payload:
|
|
1900
|
+
type: object
|
|
1901
|
+
additionalProperties: true
|
|
1902
|
+
|
|
1903
|
+
AiToolDailyUsageRowDto:
|
|
1904
|
+
type: object
|
|
1905
|
+
required: [day, externalId, isActive]
|
|
1906
|
+
properties:
|
|
1907
|
+
day:
|
|
1908
|
+
type: string
|
|
1909
|
+
format: date
|
|
1910
|
+
externalId:
|
|
1911
|
+
type: string
|
|
1912
|
+
email:
|
|
1913
|
+
type: string
|
|
1914
|
+
nullable: true
|
|
1915
|
+
isActive:
|
|
1916
|
+
type: boolean
|
|
1917
|
+
mostUsedModel:
|
|
1918
|
+
type: string
|
|
1919
|
+
nullable: true
|
|
1920
|
+
payload:
|
|
1921
|
+
type: object
|
|
1922
|
+
additionalProperties: true
|
|
1923
|
+
|
|
1924
|
+
AiToolSpendRowDto:
|
|
1925
|
+
type: object
|
|
1926
|
+
required: [billingCycleStartMs, externalId, spendCents]
|
|
1927
|
+
properties:
|
|
1928
|
+
billingCycleStartMs:
|
|
1929
|
+
type: integer
|
|
1930
|
+
format: int64
|
|
1931
|
+
externalId:
|
|
1932
|
+
type: string
|
|
1933
|
+
email:
|
|
1934
|
+
type: string
|
|
1935
|
+
nullable: true
|
|
1936
|
+
spendCents:
|
|
1937
|
+
type: integer
|
|
1938
|
+
format: int64
|
|
1939
|
+
payload:
|
|
1940
|
+
type: object
|
|
1941
|
+
additionalProperties: true
|
|
1942
|
+
|
|
1943
|
+
AiToolRefreshStatusDto:
|
|
1944
|
+
type: object
|
|
1945
|
+
required: [lastAttemptAt, counts]
|
|
1946
|
+
properties:
|
|
1947
|
+
lastAttemptAt:
|
|
1948
|
+
type: string
|
|
1949
|
+
format: date-time
|
|
1950
|
+
lastSuccessAt:
|
|
1951
|
+
type: string
|
|
1952
|
+
format: date-time
|
|
1953
|
+
nullable: true
|
|
1954
|
+
lastErrorKind:
|
|
1955
|
+
type: string
|
|
1956
|
+
nullable: true
|
|
1957
|
+
lastErrorMessage:
|
|
1958
|
+
type: string
|
|
1959
|
+
nullable: true
|
|
1960
|
+
durationMs:
|
|
1961
|
+
type: integer
|
|
1962
|
+
format: int64
|
|
1963
|
+
nullable: true
|
|
1964
|
+
counts:
|
|
1965
|
+
type: object
|
|
1966
|
+
additionalProperties: true
|
|
1967
|
+
|
|
1968
|
+
AiToolRefreshResponseDto:
|
|
1969
|
+
type: object
|
|
1970
|
+
required: [ok]
|
|
1971
|
+
properties:
|
|
1972
|
+
ok:
|
|
1973
|
+
type: boolean
|
|
1974
|
+
error:
|
|
1975
|
+
type: string
|
|
1976
|
+
nullable: true
|
|
1977
|
+
|
|
1665
1978
|
DashboardProductivityMetricsDto:
|
|
1666
1979
|
type: object
|
|
1667
1980
|
description: Nested metric groups; see TypeScript `DashboardProductivityMetricsDto` in @thinkai/tai-api-contract.
|