@thinkai/tai-api-contract 2.91.0 → 2.93.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.91.0
4
+ version: 2.93.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}/...`.
@@ -1544,6 +1544,7 @@ paths:
1544
1544
  - $ref: "#/components/schemas/CursorSourceDto"
1545
1545
  - $ref: "#/components/schemas/ClaudeSourcePatchDto"
1546
1546
  - $ref: "#/components/schemas/ClaudeSourceDto"
1547
+ - $ref: "#/components/schemas/CodeIntelligenceSourcePatchDto"
1547
1548
  - $ref: "#/components/schemas/NewRelicSourceDto"
1548
1549
  - $ref: "#/components/schemas/PrometheusSourceDto"
1549
1550
  - $ref: "#/components/schemas/GrafanaSourceDto"
@@ -1661,6 +1662,7 @@ paths:
1661
1662
  - $ref: "#/components/schemas/CursorSourceDto"
1662
1663
  - $ref: "#/components/schemas/ClaudeSourcePatchDto"
1663
1664
  - $ref: "#/components/schemas/ClaudeSourceDto"
1665
+ - $ref: "#/components/schemas/CodeIntelligenceSourcePatchDto"
1664
1666
  - $ref: "#/components/schemas/NewRelicSourceDto"
1665
1667
  - $ref: "#/components/schemas/PrometheusSourceDto"
1666
1668
  - $ref: "#/components/schemas/GrafanaSourceDto"
@@ -6805,7 +6807,54 @@ paths:
6805
6807
  content:
6806
6808
  application/json:
6807
6809
  schema:
6808
- $ref: "#/components/schemas/ErrorMessageDto"
6810
+ type: object
6811
+ required: [error]
6812
+ properties:
6813
+ error: { type: string, example: invalid_body }
6814
+ "401":
6815
+ $ref: "#/components/responses/Unauthorized"
6816
+ "403":
6817
+ $ref: "#/components/responses/Forbidden"
6818
+
6819
+ /workspaces/{workspaceId}/code-intelligence:
6820
+ put:
6821
+ tags: [CodeChat]
6822
+ summary: Update Code Intelligence workspace settings
6823
+ description: >
6824
+ Admin-only. Enables/disables Code Intelligence for the workspace, chooses whether to reuse
6825
+ the Agent Execution key or a dedicated `code_intelligence` source credential, and optional
6826
+ Cursor/Claude model overrides. Does not store secrets — use `PUT .../sources` with
6827
+ `type: code_intelligence` and `executionToken` when key mode is `dedicated` (except
6828
+ `thinkai_platform_cursor`, which uses the platform key). Preview UI remains behind `?code_kn=true`.
6829
+ operationId: putCodeIntelligenceSettings
6830
+ parameters:
6831
+ - $ref: "#/components/parameters/WorkspaceId"
6832
+ requestBody:
6833
+ required: true
6834
+ content:
6835
+ application/json:
6836
+ schema:
6837
+ $ref: "#/components/schemas/PutCodeIntelligenceSettingsDto"
6838
+ responses:
6839
+ "200":
6840
+ description: Settings updated
6841
+ content:
6842
+ application/json:
6843
+ schema:
6844
+ type: object
6845
+ required: [ok]
6846
+ properties:
6847
+ ok:
6848
+ type: boolean
6849
+ "400":
6850
+ description: Invalid request body
6851
+ content:
6852
+ application/json:
6853
+ schema:
6854
+ type: object
6855
+ required: [error]
6856
+ properties:
6857
+ error: { type: string, example: invalid_body }
6809
6858
  "401":
6810
6859
  $ref: "#/components/responses/Unauthorized"
6811
6860
  "403":
@@ -9694,6 +9743,43 @@ components:
9694
9743
  Masked preview of the stored insights key (prefix + last four characters). Never
9695
9744
  includes the full secret.
9696
9745
 
9746
+ CodeIntelligenceSourcePatchDto:
9747
+ type: object
9748
+ description: >
9749
+ Dedicated Engineering Context Graph execution credential for
9750
+ `PUT /workspaces/{workspaceId}/sources` when `codeIntelligenceKeyMode` is `dedicated`.
9751
+ Provide `executionToken` (Cursor user/service key or Anthropic `sk-ant-api…`). Admin keys
9752
+ are rejected. Reads from `GET /workspaces/{workspaceId}/config` redact the secret to
9753
+ `hasExecutionToken` via `CodeIntelligenceSourceConfigDto`.
9754
+ required: [type]
9755
+ additionalProperties: false
9756
+ properties:
9757
+ type:
9758
+ type: string
9759
+ enum: [code_intelligence]
9760
+ executionToken:
9761
+ type: string
9762
+ minLength: 1
9763
+ maxLength: 256
9764
+ description: >
9765
+ Execution key for wiki/chat LLM calls in dedicated key mode. Whitespace and `env:`
9766
+ prefix are rejected.
9767
+
9768
+ CodeIntelligenceSourceConfigDto:
9769
+ type: object
9770
+ description: >
9771
+ Redacted Engineering Context Graph source returned by `GET /workspaces/{workspaceId}/config`.
9772
+ Raw `executionToken` values are never returned.
9773
+ required: [type, hasExecutionToken]
9774
+ additionalProperties: false
9775
+ properties:
9776
+ type:
9777
+ type: string
9778
+ enum: [code_intelligence]
9779
+ hasExecutionToken:
9780
+ type: boolean
9781
+ description: Whether a dedicated ECG execution token is stored for this workspace.
9782
+
9697
9783
  NewRelicSourceDto:
9698
9784
  type: object
9699
9785
  description: >
@@ -9968,6 +10054,28 @@ components:
9968
10054
  - cursor_user_api_key
9969
10055
  - claude_api_key
9970
10056
 
10057
+ PutCodeIntelligenceSettingsDto:
10058
+ type: object
10059
+ description: Partial update for Code Intelligence workspace settings (admin-only).
10060
+ properties:
10061
+ enabled:
10062
+ type: boolean
10063
+ keyMode:
10064
+ type: string
10065
+ enum: [reuse_agent_execution, dedicated]
10066
+ provider:
10067
+ nullable: true
10068
+ allOf:
10069
+ - $ref: "#/components/schemas/AgentExecutionProviderDto"
10070
+ cursorModel:
10071
+ type: string
10072
+ nullable: true
10073
+ minLength: 1
10074
+ claudeModel:
10075
+ type: string
10076
+ nullable: true
10077
+ minLength: 1
10078
+
9971
10079
  WorkspaceConfigDto:
9972
10080
  type: object
9973
10081
  required: [sources]
@@ -9978,6 +10086,7 @@ components:
9978
10086
  oneOf:
9979
10087
  - $ref: "#/components/schemas/CursorSourceConfigDto"
9980
10088
  - $ref: "#/components/schemas/ClaudeSourceConfigDto"
10089
+ - $ref: "#/components/schemas/CodeIntelligenceSourceConfigDto"
9981
10090
  - $ref: "#/components/schemas/NewRelicSourceConfigDto"
9982
10091
  - $ref: "#/components/schemas/PrometheusSourceConfigDto"
9983
10092
  - $ref: "#/components/schemas/GrafanaSourceConfigDto"
@@ -10006,6 +10115,34 @@ components:
10006
10115
  The single active agent execution account for this workspace's readiness scanner and
10007
10116
  fix processor. Defaults to `cursor_user_api_key`. Change via
10008
10117
  `PUT /workspaces/{workspaceId}/agent-execution-provider`.
10118
+ codeIntelligenceEnabled:
10119
+ type: boolean
10120
+ description: >
10121
+ When false (default), Code Intelligence write APIs (`/code-chat/*` index/sync/wiki/messages)
10122
+ return 403. Preview UI still requires `?code_kn=true`. Change via
10123
+ `PUT /workspaces/{workspaceId}/code-intelligence`.
10124
+ codeIntelligenceKeyMode:
10125
+ type: string
10126
+ enum: [reuse_agent_execution, dedicated]
10127
+ description: >
10128
+ `reuse_agent_execution` uses the workspace Agent Execution key. `dedicated` uses the
10129
+ `code_intelligence` source token (or platform Cursor when provider is `thinkai_platform_cursor`).
10130
+ codeIntelligenceProvider:
10131
+ nullable: true
10132
+ allOf:
10133
+ - $ref: "#/components/schemas/AgentExecutionProviderDto"
10134
+ description: Active when `codeIntelligenceKeyMode` is `dedicated`. Null when reusing Agent Execution.
10135
+ codeIntelligenceCursorModel:
10136
+ type: string
10137
+ nullable: true
10138
+ description: Optional Cursor model override for Code Intelligence (null/empty → env default).
10139
+ codeIntelligenceClaudeModel:
10140
+ type: string
10141
+ nullable: true
10142
+ description: Optional Claude model override for Code Intelligence (null/empty → env default).
10143
+ hasCodeIntelligenceExecutionToken:
10144
+ type: boolean
10145
+ description: True when a dedicated `code_intelligence` source has a stored executionToken.
10009
10146
 
10010
10147
  TestConnectionResponseDto:
10011
10148
  type: object
@@ -10275,6 +10412,14 @@ components:
10275
10412
  mergedPrCount:
10276
10413
  type: number
10277
10414
  minimum: 0
10415
+ shipWeightSum:
10416
+ type: number
10417
+ minimum: 0
10418
+ description: Sum of ship-weight scores for PRs merged on this day.
10419
+ shipWeightPendingCount:
10420
+ type: integer
10421
+ minimum: 1
10422
+ description: GitHub merged PRs on this day still awaiting ship-weight scoring.
10278
10423
  ciFailuresCount:
10279
10424
  type: integer
10280
10425
  minimum: 0
@@ -10310,6 +10455,14 @@ components:
10310
10455
  description: Short label for the week column (MM/DD), aligned with Measure charts.
10311
10456
  mergedPrCount:
10312
10457
  type: number
10458
+ shipWeightSum:
10459
+ type: number
10460
+ minimum: 0
10461
+ description: Sum of ship-weight scores for PRs merged in this week bucket.
10462
+ shipWeightPendingCount:
10463
+ type: integer
10464
+ minimum: 1
10465
+ description: GitHub merged PRs in this week bucket still awaiting ship-weight scoring.
10313
10466
  failRatePercent:
10314
10467
  type: number
10315
10468
  description: DORA change failure rate (deployments/incidents), not CI build failures.
@@ -10420,6 +10573,14 @@ components:
10420
10573
  description: Short label for the week column (MM/DD), aligned with Measure charts.
10421
10574
  mergedPrCount:
10422
10575
  type: number
10576
+ shipWeightSum:
10577
+ type: number
10578
+ minimum: 0
10579
+ description: Sum of ship-weight scores for PRs merged in this week bucket.
10580
+ shipWeightPendingCount:
10581
+ type: integer
10582
+ minimum: 1
10583
+ description: GitHub merged PRs in this week bucket still awaiting ship-weight scoring.
10423
10584
 
10424
10585
  ProductivityInsightsMergedPrContributorRowDto:
10425
10586
  type: object
@@ -10516,6 +10677,10 @@ components:
10516
10677
  periodAvgMergedPrs:
10517
10678
  type: number
10518
10679
  description: Average weekly merged PR count over the selected range.
10680
+ periodAvgShipWeight:
10681
+ type: number
10682
+ minimum: 0
10683
+ description: Average weekly ship-weight sum over the selected range.
10519
10684
  avgFailRatePercent:
10520
10685
  type: number
10521
10686
  description: Average change failure rate over the range when available.
@@ -10530,8 +10695,19 @@ components:
10530
10695
  properties:
10531
10696
  totalMergedPrs:
10532
10697
  type: number
10698
+ totalShipWeight:
10699
+ type: number
10700
+ minimum: 0
10701
+ description: Sum of ship-weight scores for merged PRs over the selected range.
10702
+ shipWeightBackfillPending:
10703
+ type: boolean
10704
+ description: True when merged GitHub PRs in scope still lack ship-weight scores (ingest backfill in progress).
10533
10705
  avgMergedPrsPerWeek:
10534
10706
  type: number
10707
+ avgShipWeightPerWeek:
10708
+ type: number
10709
+ minimum: 0
10710
+ description: Mean weekly ship-weight sum over the selected range.
10535
10711
  avgFailRatePercent:
10536
10712
  type: number
10537
10713
  description: Average DORA change failure rate over the range when available.
@@ -10676,6 +10852,14 @@ components:
10676
10852
  mergedPrCount:
10677
10853
  type: integer
10678
10854
  minimum: 0
10855
+ shipWeightSum:
10856
+ type: number
10857
+ minimum: 0
10858
+ description: Sum of ship-weight scores for PRs merged on this day.
10859
+ shipWeightPendingCount:
10860
+ type: integer
10861
+ minimum: 1
10862
+ description: GitHub merged PRs on this day still awaiting ship-weight scoring.
10679
10863
  mergedPrs:
10680
10864
  type: array
10681
10865
  items:
@@ -10767,8 +10951,19 @@ components:
10767
10951
  totalMergedPrs:
10768
10952
  type: integer
10769
10953
  minimum: 0
10954
+ totalShipWeight:
10955
+ type: number
10956
+ minimum: 0
10957
+ description: Sum of ship-weight scores for merged PRs over the selected range.
10958
+ shipWeightBackfillPending:
10959
+ type: boolean
10960
+ description: True when merged GitHub PRs in scope still lack ship-weight scores (ingest backfill in progress).
10770
10961
  avgMergedPrsPerWeek:
10771
10962
  type: number
10963
+ avgShipWeightPerWeek:
10964
+ type: number
10965
+ minimum: 0
10966
+ description: Mean weekly ship-weight sum over the selected range.
10772
10967
  totalAbsenceDays:
10773
10968
  type: integer
10774
10969
  minimum: 0
@@ -10780,8 +10975,14 @@ components:
10780
10975
  description: Average GitHub Actions CI build failure rate over the range when CI ingest is enabled.
10781
10976
  mergedPrDelta:
10782
10977
  type: number
10978
+ shipWeightDelta:
10979
+ type: number
10980
+ description: Change in total ship-weight sum vs the prior comparison window.
10783
10981
  avgMergedPrsPerWeekDelta:
10784
10982
  type: number
10983
+ avgShipWeightPerWeekDelta:
10984
+ type: number
10985
+ description: Change in mean weekly ship-weight sum vs the prior comparison window.
10785
10986
  totalAbsenceDaysDelta:
10786
10987
  type: number
10787
10988
  avgFailRateDelta:
@@ -10872,6 +11073,10 @@ components:
10872
11073
  periodAvgMergedPrs:
10873
11074
  type: number
10874
11075
  description: Mean weekly merged PR count across the selected range.
11076
+ periodAvgShipWeight:
11077
+ type: number
11078
+ minimum: 0
11079
+ description: Mean weekly ship-weight sum across the selected range.
10875
11080
  avgFailRatePercent:
10876
11081
  type: number
10877
11082
  description: Mean weekly change-failure rate when available.
@@ -11576,6 +11781,14 @@ components:
11576
11781
  mergedPrCount:
11577
11782
  type: integer
11578
11783
  minimum: 0
11784
+ shipWeightSum:
11785
+ type: number
11786
+ minimum: 0
11787
+ description: Sum of ship-weight scores for PRs merged on this day.
11788
+ shipWeightPendingCount:
11789
+ type: integer
11790
+ minimum: 1
11791
+ description: GitHub merged PRs on this day still awaiting ship-weight scoring.
11579
11792
  tokenCount:
11580
11793
  type: integer
11581
11794
  minimum: 0
@@ -11597,6 +11810,14 @@ components:
11597
11810
  type: integer
11598
11811
  minimum: 0
11599
11812
  description: Estimated merged PR count in the bucket from dashboard velocity metrics.
11813
+ shipWeightSum:
11814
+ type: number
11815
+ minimum: 0
11816
+ description: Sum of ship-weight scores for PRs merged in this week bucket.
11817
+ shipWeightPendingCount:
11818
+ type: integer
11819
+ minimum: 1
11820
+ description: GitHub merged PRs in this week bucket still awaiting ship-weight scoring.
11600
11821
  tokenCount:
11601
11822
  type: integer
11602
11823
  minimum: 0
@@ -11641,6 +11862,10 @@ components:
11641
11862
  totalMergedPrs:
11642
11863
  type: integer
11643
11864
  minimum: 0
11865
+ totalShipWeight:
11866
+ type: number
11867
+ minimum: 0
11868
+ description: Sum of ship-weight scores for merged PRs over the selected range.
11644
11869
  totalSpendCents:
11645
11870
  type: integer
11646
11871
  minimum: 0
@@ -15710,6 +15935,14 @@ components:
15710
15935
  type: string
15711
15936
  mergedPrCount:
15712
15937
  type: integer
15938
+ shipWeightSum:
15939
+ type: number
15940
+ minimum: 0
15941
+ description: Sum of ship-weight scores for PRs merged in this week bucket.
15942
+ shipWeightPendingCount:
15943
+ type: integer
15944
+ minimum: 1
15945
+ description: GitHub merged PRs in this week bucket still awaiting ship-weight scoring.
15713
15946
  tokenCount:
15714
15947
  type: integer
15715
15948
 
@@ -15923,6 +16156,11 @@ components:
15923
16156
  - integrations.claude.analytics_key.added
15924
16157
  - integrations.claude.analytics_key.updated
15925
16158
  - integrations.claude.analytics_key.removed
16159
+ - integrations.code_intelligence.settings_changed
16160
+ - integrations.code_intelligence.execution_key.added
16161
+ - integrations.code_intelligence.execution_key.updated
16162
+ - integrations.code_intelligence.execution_key.removed
16163
+ - integrations.code_intelligence.execution_key.check_failed
15926
16164
  - readiness.scan_precheck_failed
15927
16165
  - productivity.ingest.completed
15928
16166
  - productivity.ingest.failed
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.91.0",
3
+ "version": "2.93.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",