@thinkai/tai-api-contract 2.254.1 → 2.257.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.254.1
4
+ version: 2.257.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}/...`.
@@ -12726,8 +12726,9 @@ paths:
12726
12726
  $ref: "#/components/schemas/ErrorMessageDto"
12727
12727
  "409":
12728
12728
  description: >
12729
- Chat not ready, no ready corpus in thread scope, or `continueAsk` expired /
12730
- mismatched (`continue_expired`).
12729
+ Chat not ready, no ready corpus in thread scope, `continueAsk` expired /
12730
+ mismatched (`continue_expired`), or this thread is still answering its last
12731
+ question (`ask_turn_in_progress`).
12731
12732
  content:
12732
12733
  application/json:
12733
12734
  schema:
@@ -12738,6 +12739,193 @@ paths:
12738
12739
  application/json:
12739
12740
  schema:
12740
12741
  $ref: "#/components/schemas/ErrorMessageDto"
12742
+ "429":
12743
+ description: >
12744
+ Too many questions. `ask_rate_limited` (per minute) or `ask_busy` (too many running
12745
+ at once), per user or per workspace. Nothing was spent. `Retry-After` and
12746
+ `retryAfterSec` say when to ask again.
12747
+ headers:
12748
+ Retry-After:
12749
+ schema: { type: integer }
12750
+ content:
12751
+ application/json:
12752
+ schema:
12753
+ $ref: "#/components/schemas/ErrorMessageDto"
12754
+
12755
+ /workspaces/{workspaceId}/code-chat/threads/{threadId}/turn/stream:
12756
+ get:
12757
+ tags: [CodeChat]
12758
+ summary: Reattach to the Ask that is running on a thread
12759
+ description: >
12760
+ For a page that reloaded while an Ask was running. Replays the stages and answer text so
12761
+ far, then follows the turn live. Closing this stream does not stop the turn; use the
12762
+ cancel route. A few pages can follow one turn; past that the oldest is dropped. Runs on one replica: when the turn is not running there, the reply is JSON
12763
+ `{ running: false }` and the page reads the saved thread instead.
12764
+ operationId: streamCodeChatTurn
12765
+ x-test-coverage-skip: in-memory registry covered by ask-turn-registry.test
12766
+ parameters:
12767
+ - $ref: "#/components/parameters/WorkspaceId"
12768
+ - name: threadId
12769
+ in: path
12770
+ required: true
12771
+ schema: { type: string, format: uuid }
12772
+ responses:
12773
+ "200":
12774
+ description: >
12775
+ `text/event-stream` with `event: turn` (`{ startedAt }`), then `event: stage`
12776
+ (`{ stage, detail? }`), `event: token` (`{ text }`, the text so far, then new text),
12777
+ `event: reset` (`{}`), `event: error` (`{ error, code }`), and `event: done`
12778
+ (CodeChatMessageReplyDto). The stream ends after `done` or `error`, or without either
12779
+ when the turn was stopped or dropped this page; read the thread then.
12780
+ content:
12781
+ application/json:
12782
+ schema:
12783
+ type: object
12784
+ required: [running]
12785
+ properties:
12786
+ running: { type: boolean }
12787
+ text/event-stream:
12788
+ schema:
12789
+ type: string
12790
+ "401":
12791
+ $ref: "#/components/responses/Unauthorized"
12792
+ "404":
12793
+ description: Not found
12794
+ content:
12795
+ application/json:
12796
+ schema:
12797
+ $ref: "#/components/schemas/ErrorMessageDto"
12798
+
12799
+ /workspaces/{workspaceId}/code-chat/threads/{threadId}/cancel:
12800
+ post:
12801
+ tags: [CodeChat]
12802
+ summary: Stop the Ask that is running on a thread
12803
+ description: >
12804
+ An Ask keeps running when the reader's page closes or reloads. This is the Stop button.
12805
+ Runs on one replica; `cancelled` is false when no turn was running there, and the turn
12806
+ then ends at its time limit.
12807
+ operationId: cancelCodeChatTurn
12808
+ x-test-coverage-skip: in-memory registry covered by ask-turn-registry.test
12809
+ parameters:
12810
+ - $ref: "#/components/parameters/WorkspaceId"
12811
+ - name: threadId
12812
+ in: path
12813
+ required: true
12814
+ schema: { type: string, format: uuid }
12815
+ responses:
12816
+ "200":
12817
+ description: Stop was requested (or nothing was running)
12818
+ content:
12819
+ application/json:
12820
+ schema:
12821
+ type: object
12822
+ required: [cancelled]
12823
+ properties:
12824
+ cancelled: { type: boolean }
12825
+ "401":
12826
+ $ref: "#/components/responses/Unauthorized"
12827
+ "404":
12828
+ description: Not found
12829
+ content:
12830
+ application/json:
12831
+ schema:
12832
+ $ref: "#/components/schemas/ErrorMessageDto"
12833
+
12834
+ /workspaces/{workspaceId}/code-chat/threads/{threadId}/messages/{messageId}/feedback:
12835
+ post:
12836
+ tags: [CodeChat]
12837
+ summary: Rate an assistant answer (thumbs up or down, with a reason)
12838
+ operationId: postCodeChatMessageFeedback
12839
+ x-test-coverage-skip: body rules covered by ask-feedback.test; store is RLS-scoped to the caller
12840
+ parameters:
12841
+ - $ref: "#/components/parameters/WorkspaceId"
12842
+ - name: threadId
12843
+ in: path
12844
+ required: true
12845
+ schema: { type: string, format: uuid }
12846
+ - name: messageId
12847
+ in: path
12848
+ required: true
12849
+ schema: { type: string, format: uuid }
12850
+ requestBody:
12851
+ required: true
12852
+ content:
12853
+ application/json:
12854
+ schema:
12855
+ $ref: "#/components/schemas/CodeChatAskFeedbackBodyDto"
12856
+ responses:
12857
+ "200":
12858
+ description: The caller's feedback after the change (null when cleared)
12859
+ content:
12860
+ application/json:
12861
+ schema:
12862
+ $ref: "#/components/schemas/CodeChatAskFeedbackResultDto"
12863
+ "400":
12864
+ description: Invalid rating or reason (`invalid_input`)
12865
+ content:
12866
+ application/json:
12867
+ schema:
12868
+ $ref: "#/components/schemas/ErrorMessageDto"
12869
+ "401":
12870
+ $ref: "#/components/responses/Unauthorized"
12871
+ "404":
12872
+ description: Thread or assistant message not found for the caller (`message_not_found`)
12873
+ content:
12874
+ application/json:
12875
+ schema:
12876
+ $ref: "#/components/schemas/ErrorMessageDto"
12877
+
12878
+ /workspaces/{workspaceId}/code-chat/feedback-settings:
12879
+ get:
12880
+ tags: [CodeChat]
12881
+ summary: Whether thumbs-down keeps the question for eval
12882
+ operationId: getCodeChatFeedbackSettings
12883
+ x-test-coverage-skip: single boolean read; covered by store tests
12884
+ parameters:
12885
+ - $ref: "#/components/parameters/WorkspaceId"
12886
+ responses:
12887
+ "200":
12888
+ description: Settings
12889
+ content:
12890
+ application/json:
12891
+ schema:
12892
+ $ref: "#/components/schemas/CodeChatFeedbackSettingsDto"
12893
+ "401":
12894
+ $ref: "#/components/responses/Unauthorized"
12895
+ put:
12896
+ tags: [CodeChat]
12897
+ summary: Turn question capture on or off (workspace admin)
12898
+ operationId: putCodeChatFeedbackSettings
12899
+ x-test-coverage-skip: single boolean write behind the admin check
12900
+ parameters:
12901
+ - $ref: "#/components/parameters/WorkspaceId"
12902
+ requestBody:
12903
+ required: true
12904
+ content:
12905
+ application/json:
12906
+ schema:
12907
+ $ref: "#/components/schemas/CodeChatFeedbackSettingsDto"
12908
+ responses:
12909
+ "200":
12910
+ description: Settings after the change
12911
+ content:
12912
+ application/json:
12913
+ schema:
12914
+ $ref: "#/components/schemas/CodeChatFeedbackSettingsDto"
12915
+ "400":
12916
+ description: captureQuestions must be a boolean (`invalid_input`)
12917
+ content:
12918
+ application/json:
12919
+ schema:
12920
+ $ref: "#/components/schemas/ErrorMessageDto"
12921
+ "401":
12922
+ $ref: "#/components/responses/Unauthorized"
12923
+ "403":
12924
+ description: Workspace admin required
12925
+ content:
12926
+ application/json:
12927
+ schema:
12928
+ $ref: "#/components/schemas/ErrorMessageDto"
12741
12929
 
12742
12930
  /workspaces/{workspaceId}/code-chat/indexes/{indexId}/wiki:
12743
12931
  get:
@@ -33919,6 +34107,30 @@ components:
33919
34107
  description: >
33920
34108
  How the architecture document step ended on the last scan. Null when no document
33921
34109
  step has reported for this index (documents off, or scanned by an older worker).
34110
+ scanCounts:
34111
+ allOf:
34112
+ - $ref: "#/components/schemas/CodeChatIndexScanCountsDto"
34113
+ nullable: true
34114
+ description: >
34115
+ Secret and low-signal counts from the last scan. Null until a scan writes them.
34116
+ All zeros means the scan ran and found nothing to report.
34117
+
34118
+ CodeChatIndexScanCountsDto:
34119
+ type: object
34120
+ required: [secretsRedacted, secretFilesSkipped, lowSignalFilesSkipped]
34121
+ properties:
34122
+ secretsRedacted:
34123
+ type: integer
34124
+ minimum: 0
34125
+ description: Secret values replaced in excerpts on the last scan.
34126
+ secretFilesSkipped:
34127
+ type: integer
34128
+ minimum: 0
34129
+ description: Files left unread because their name says they hold secrets.
34130
+ lowSignalFilesSkipped:
34131
+ type: integer
34132
+ minimum: 0
34133
+ description: Lockfiles, bundles, source maps and generated files skipped on the last scan.
33922
34134
 
33923
34135
  CodeChatIndexRuleCardsDto:
33924
34136
  type: object
@@ -34237,6 +34449,68 @@ components:
34237
34449
  description: >
34238
34450
  Hydrated from `tai_workspace_code_intelligence_token_usage` on GET thread
34239
34451
  detail (assistant turns). Omitted when no ledger rows exist for the message.
34452
+ verdict:
34453
+ type: string
34454
+ enum: [answered, caveat, clarifying, unconfirmed, retrieval_only, failed, timed_out]
34455
+ description: >
34456
+ Structured outcome of an assistant turn, so a client does not parse the answer text.
34457
+ `unconfirmed` means no quoted line from the code backed the answer. Present on
34458
+ assistant turns only.
34459
+ abstainReason:
34460
+ type: string
34461
+ nullable: true
34462
+ description: >
34463
+ Short code behind a `caveat` or `clarifying` turn (for example `ask-first`,
34464
+ `open-decisions`, `plan-only`). Null otherwise.
34465
+ feedback:
34466
+ allOf:
34467
+ - $ref: "#/components/schemas/CodeChatAskFeedbackDto"
34468
+ description: The caller's own thumbs on this answer. Omitted when none.
34469
+
34470
+ CodeChatAskFeedbackDto:
34471
+ type: object
34472
+ required: [rating, reason]
34473
+ properties:
34474
+ rating: { type: string, enum: [up, down] }
34475
+ reason:
34476
+ type: string
34477
+ nullable: true
34478
+ enum: [wrong, incomplete, not_grounded, too_slow, unclear, other, null]
34479
+ description: Why, for a thumbs-down. Null for a thumbs-up or when none was given.
34480
+
34481
+ CodeChatAskFeedbackBodyDto:
34482
+ type: object
34483
+ required: [rating]
34484
+ properties:
34485
+ rating:
34486
+ type: string
34487
+ nullable: true
34488
+ enum: [up, down, null]
34489
+ description: "`null` clears the caller's feedback on this answer."
34490
+ reason:
34491
+ type: string
34492
+ nullable: true
34493
+ enum: [wrong, incomplete, not_grounded, too_slow, unclear, other, null]
34494
+ description: Used for a thumbs-down only; dropped for a thumbs-up.
34495
+
34496
+ CodeChatAskFeedbackResultDto:
34497
+ type: object
34498
+ required: [feedback]
34499
+ properties:
34500
+ feedback:
34501
+ nullable: true
34502
+ allOf:
34503
+ - $ref: "#/components/schemas/CodeChatAskFeedbackDto"
34504
+
34505
+ CodeChatFeedbackSettingsDto:
34506
+ type: object
34507
+ required: [captureQuestions]
34508
+ properties:
34509
+ captureQuestions:
34510
+ type: boolean
34511
+ description: >
34512
+ When true, a thumbs-down also keeps the secret-scrubbed question for 30 days so the
34513
+ turn can become an eval case. Default false.
34240
34514
 
34241
34515
  CodeChatThreadDetailDto:
34242
34516
  allOf:
@@ -1201,6 +1201,16 @@
1201
1201
  "method": "POST",
1202
1202
  "path": "/workspaces/{workspaceId}/code-chat/threads/{threadId}/messages"
1203
1203
  },
1204
+ "streamCodeChatTurn": {
1205
+ "status": "implemented",
1206
+ "method": "GET",
1207
+ "path": "/workspaces/{workspaceId}/code-chat/threads/{threadId}/turn/stream"
1208
+ },
1209
+ "cancelCodeChatTurn": {
1210
+ "status": "implemented",
1211
+ "method": "POST",
1212
+ "path": "/workspaces/{workspaceId}/code-chat/threads/{threadId}/cancel"
1213
+ },
1204
1214
  "listCodeChatWikiPages": {
1205
1215
  "status": "implemented",
1206
1216
  "method": "GET",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.254.1",
3
+ "version": "2.257.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",