@thinkai/tai-api-contract 2.236.0 → 2.238.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.236.0
4
+ version: 2.238.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}/...`.
@@ -88,6 +88,11 @@ tags:
88
88
  Standalone Code Chat for indexed GitHub repositories from the readiness repo list.
89
89
  Indexes via Graphify when available, otherwise a builtin file/symbol graph; answers via graph
90
90
  retrieval plus the workspace agent execution key (Claude or Cursor).
91
+ - name: Mcp
92
+ description: >
93
+ Hosted read-only MCP endpoint per workspace. Sign-in is OAuth 2.1 with PKCE; a personal token
94
+ is the fallback for scripts. Member routes (token management, consent approval) use the
95
+ Supabase JWT; the OAuth and MCP routes are public or use an MCP bearer token.
91
96
  - name: Platform
92
97
  description: Platform-wide banner surfaces (global outage/maintenance banner, issue #284).
93
98
  - name: CodeInsights
@@ -12443,6 +12448,496 @@ paths:
12443
12448
  "401":
12444
12449
  $ref: "#/components/responses/Unauthorized"
12445
12450
 
12451
+ /workspaces/{workspaceId}/code-chat/deep-wiki/generate:
12452
+ post:
12453
+ tags: [CodeChat]
12454
+ summary: Start writing the workspace wiki (Deep Wiki)
12455
+ description: >-
12456
+ Starts a background run that writes the cross-repository workspace wiki from stored
12457
+ architecture documents (`.arch.md`). It does not clone or re-index. Member auth, and
12458
+ Code Intelligence must be on for the workspace. Returns `202` at once; poll
12459
+ `GET …/code-chat/deep-wiki/generate/status` until `status` is `done` or `failed`.
12460
+
12461
+ One run per workspace. Run state is stored durably, so it survives a restart and is the
12462
+ same on every replica. A run that is still going after 12 minutes is stopped and reads
12463
+ `failed`; pages saved before then (the outline) are kept and the next run replaces them.
12464
+ Draft pages (PRD / RFC / ADR) are left in place.
12465
+ operationId: generateWorkspaceDeepWiki
12466
+ parameters:
12467
+ - $ref: "#/components/parameters/WorkspaceId"
12468
+ requestBody:
12469
+ required: false
12470
+ content:
12471
+ application/json:
12472
+ schema:
12473
+ $ref: "#/components/schemas/GenerateWorkspaceDeepWikiBodyDto"
12474
+ responses:
12475
+ "202":
12476
+ description: Run started. `reposInEvidence` is how many repositories' architecture documents feed the run.
12477
+ content:
12478
+ application/json:
12479
+ schema:
12480
+ $ref: "#/components/schemas/WorkspaceDeepWikiRunDto"
12481
+ "401":
12482
+ $ref: "#/components/responses/Unauthorized"
12483
+ "403":
12484
+ description: Not a workspace member, or Code Intelligence is off (`code_intelligence_disabled`)
12485
+ content:
12486
+ application/json:
12487
+ schema:
12488
+ $ref: "#/components/schemas/ErrorMessageDto"
12489
+ "404":
12490
+ description: Workspace not found
12491
+ content:
12492
+ application/json:
12493
+ schema:
12494
+ $ref: "#/components/schemas/ErrorMessageDto"
12495
+ "409":
12496
+ description: >-
12497
+ No architecture documents yet (`arch_docs_missing`), or a run is already going
12498
+ (`generation_in_progress`).
12499
+ content:
12500
+ application/json:
12501
+ schema:
12502
+ $ref: "#/components/schemas/ErrorMessageDto"
12503
+ example:
12504
+ error: A workspace wiki is already being written. Wait for it to finish.
12505
+ code: generation_in_progress
12506
+
12507
+ /workspaces/{workspaceId}/code-chat/deep-wiki/generate/status:
12508
+ get:
12509
+ tags: [CodeChat]
12510
+ summary: Get the workspace wiki run status
12511
+ description: >-
12512
+ Current or most recent Deep Wiki run for the workspace, read from durable storage. `idle`
12513
+ with null fields means no run has been started. A `running` row older than the run limit
12514
+ (12 minutes) reads `failed`, so a crashed replica cannot hold the lock forever.
12515
+ operationId: getWorkspaceDeepWikiStatus
12516
+ parameters:
12517
+ - $ref: "#/components/parameters/WorkspaceId"
12518
+ responses:
12519
+ "200":
12520
+ description: Run state
12521
+ content:
12522
+ application/json:
12523
+ schema:
12524
+ $ref: "#/components/schemas/WorkspaceDeepWikiRunDto"
12525
+ "401":
12526
+ $ref: "#/components/responses/Unauthorized"
12527
+ "403":
12528
+ $ref: "#/components/responses/Forbidden"
12529
+ "404":
12530
+ description: Workspace not found
12531
+ content:
12532
+ application/json:
12533
+ schema:
12534
+ $ref: "#/components/schemas/ErrorMessageDto"
12535
+
12536
+ /workspaces/{workspaceId}/mcp/oauth/approve:
12537
+ post:
12538
+ tags: [Mcp]
12539
+ summary: Approve an MCP client sign-in
12540
+ description: >-
12541
+ Called by the app's consent page after a member agrees to let an MCP client read this
12542
+ workspace. Issues a single-use authorization code and returns the client's redirect URL
12543
+ with `code` (and `state` when sent). The client then exchanges the code at
12544
+ `POST /mcp/oauth/token`. `clientId` and `redirectUri` must match a client registered at
12545
+ `POST /mcp/oauth/register`.
12546
+ operationId: approveMcpOauth
12547
+ parameters:
12548
+ - $ref: "#/components/parameters/WorkspaceId"
12549
+ requestBody:
12550
+ required: true
12551
+ content:
12552
+ application/json:
12553
+ schema:
12554
+ $ref: "#/components/schemas/McpOauthApproveBodyDto"
12555
+ responses:
12556
+ "200":
12557
+ description: Code issued
12558
+ content:
12559
+ application/json:
12560
+ schema:
12561
+ $ref: "#/components/schemas/McpOauthApproveResultDto"
12562
+ "400":
12563
+ description: >-
12564
+ Invalid redirect URI (`mcp_redirect_uri_invalid`), unknown client, redirect not
12565
+ registered for the client, or missing `codeChallenge`.
12566
+ content:
12567
+ application/json:
12568
+ schema:
12569
+ $ref: "#/components/schemas/ErrorMessageDto"
12570
+ "401":
12571
+ $ref: "#/components/responses/Unauthorized"
12572
+ "403":
12573
+ $ref: "#/components/responses/Forbidden"
12574
+ "404":
12575
+ description: Workspace not found
12576
+ content:
12577
+ application/json:
12578
+ schema:
12579
+ $ref: "#/components/schemas/ErrorMessageDto"
12580
+
12581
+ /workspaces/{workspaceId}/mcp/tokens:
12582
+ get:
12583
+ tags: [Mcp]
12584
+ summary: List personal MCP tokens
12585
+ description: >-
12586
+ Personal tokens, newest first, at most 50. Workspace admins see every member's tokens;
12587
+ other members see only their own. Includes revoked and expired rows. The secret is never
12588
+ returned here; only `tokenPrefix`.
12589
+ operationId: listMcpTokens
12590
+ parameters:
12591
+ - $ref: "#/components/parameters/WorkspaceId"
12592
+ responses:
12593
+ "200":
12594
+ description: Token list
12595
+ content:
12596
+ application/json:
12597
+ schema:
12598
+ $ref: "#/components/schemas/McpTokenListDto"
12599
+ "401":
12600
+ $ref: "#/components/responses/Unauthorized"
12601
+ "403":
12602
+ $ref: "#/components/responses/Forbidden"
12603
+ "404":
12604
+ description: Workspace not found
12605
+ content:
12606
+ application/json:
12607
+ schema:
12608
+ $ref: "#/components/schemas/ErrorMessageDto"
12609
+ post:
12610
+ tags: [Mcp]
12611
+ summary: Create a personal MCP token
12612
+ description: >-
12613
+ Creates a read-only token for scripts that cannot use OAuth. Valid for 90 days. The
12614
+ full `token` is returned once, in this response only. Use it as
12615
+ `Authorization: Bearer <token>` on `POST /workspaces/{workspaceId}/mcp`.
12616
+ operationId: createMcpToken
12617
+ parameters:
12618
+ - $ref: "#/components/parameters/WorkspaceId"
12619
+ requestBody:
12620
+ required: true
12621
+ content:
12622
+ application/json:
12623
+ schema:
12624
+ $ref: "#/components/schemas/McpTokenCreateBodyDto"
12625
+ responses:
12626
+ "201":
12627
+ description: Token created
12628
+ content:
12629
+ application/json:
12630
+ schema:
12631
+ $ref: "#/components/schemas/McpTokenCreatedDto"
12632
+ "400":
12633
+ description: "`name` missing or empty"
12634
+ content:
12635
+ application/json:
12636
+ schema:
12637
+ $ref: "#/components/schemas/ErrorMessageDto"
12638
+ "401":
12639
+ $ref: "#/components/responses/Unauthorized"
12640
+ "403":
12641
+ $ref: "#/components/responses/Forbidden"
12642
+ "404":
12643
+ description: Workspace not found
12644
+ content:
12645
+ application/json:
12646
+ schema:
12647
+ $ref: "#/components/schemas/ErrorMessageDto"
12648
+
12649
+ /workspaces/{workspaceId}/mcp/tokens/{tokenId}:
12650
+ delete:
12651
+ tags: [Mcp]
12652
+ summary: Revoke a personal MCP token
12653
+ description: >-
12654
+ Revokes one token. The owner can revoke their own token; a workspace admin can revoke
12655
+ any token in the workspace.
12656
+ operationId: revokeMcpToken
12657
+ parameters:
12658
+ - $ref: "#/components/parameters/WorkspaceId"
12659
+ - name: tokenId
12660
+ in: path
12661
+ required: true
12662
+ schema: { type: string, format: uuid }
12663
+ responses:
12664
+ "204":
12665
+ description: Token revoked
12666
+ "401":
12667
+ $ref: "#/components/responses/Unauthorized"
12668
+ "403":
12669
+ description: The token belongs to someone else and the caller is not a workspace admin
12670
+ content:
12671
+ application/json:
12672
+ schema:
12673
+ $ref: "#/components/schemas/ErrorMessageDto"
12674
+ "404":
12675
+ description: Workspace or token not found, token already revoked, or `tokenId` is not a UUID
12676
+ content:
12677
+ application/json:
12678
+ schema:
12679
+ $ref: "#/components/schemas/ErrorMessageDto"
12680
+
12681
+ /.well-known/oauth-authorization-server:
12682
+ get:
12683
+ tags: [Mcp]
12684
+ summary: OAuth authorization server metadata for MCP clients
12685
+ description: >-
12686
+ Public. Discovery document for the MCP sign-in: authorization code with PKCE (`S256`),
12687
+ public clients, scope `read`. URLs are built from the configured public API origin, not
12688
+ from request headers. Rate limited per client IP.
12689
+ operationId: getMcpOauthAuthorizationServerMetadata
12690
+ security: []
12691
+ responses:
12692
+ "200":
12693
+ description: Server metadata
12694
+ content:
12695
+ application/json:
12696
+ schema:
12697
+ $ref: "#/components/schemas/McpOauthServerMetadataDto"
12698
+ "429":
12699
+ $ref: "#/components/responses/McpRateLimited"
12700
+ "503":
12701
+ description: Public API origin is not configured (`mcp_api_origin_missing`)
12702
+ content:
12703
+ application/json:
12704
+ schema:
12705
+ $ref: "#/components/schemas/ErrorMessageDto"
12706
+
12707
+ /.well-known/oauth-protected-resource/workspaces/{workspaceId}/mcp:
12708
+ get:
12709
+ tags: [Mcp]
12710
+ summary: OAuth protected resource metadata for one workspace MCP endpoint
12711
+ description: >-
12712
+ Public. Tells an MCP client which authorization server protects the workspace MCP
12713
+ endpoint. Linked from the `WWW-Authenticate` header of a `401` on
12714
+ `POST /workspaces/{workspaceId}/mcp`.
12715
+ operationId: getMcpOauthProtectedResourceMetadata
12716
+ security: []
12717
+ parameters:
12718
+ - $ref: "#/components/parameters/WorkspaceId"
12719
+ responses:
12720
+ "200":
12721
+ description: Resource metadata
12722
+ content:
12723
+ application/json:
12724
+ schema:
12725
+ $ref: "#/components/schemas/McpOauthProtectedResourceDto"
12726
+ "404":
12727
+ description: "`workspaceId` is not a UUID"
12728
+ content:
12729
+ application/json:
12730
+ schema:
12731
+ $ref: "#/components/schemas/ErrorMessageDto"
12732
+ "429":
12733
+ $ref: "#/components/responses/McpRateLimited"
12734
+ "503":
12735
+ description: Public API origin is not configured (`mcp_api_origin_missing`)
12736
+ content:
12737
+ application/json:
12738
+ schema:
12739
+ $ref: "#/components/schemas/ErrorMessageDto"
12740
+
12741
+ /mcp/oauth/register:
12742
+ post:
12743
+ tags: [Mcp]
12744
+ summary: Register an MCP OAuth client (dynamic registration)
12745
+ description: >-
12746
+ Public. Registers a public client (no secret) and returns its `client_id`. Up to 10
12747
+ `redirect_uris`; each must be `https`, or `http` on `localhost`, `127.0.0.1`, or `::1`,
12748
+ with no fragment (`400` `mcp_redirect_uri_invalid` otherwise).
12749
+ operationId: registerMcpOauthClient
12750
+ security: []
12751
+ requestBody:
12752
+ required: true
12753
+ content:
12754
+ application/json:
12755
+ schema:
12756
+ $ref: "#/components/schemas/McpOauthRegisterBodyDto"
12757
+ responses:
12758
+ "201":
12759
+ description: Client registered
12760
+ content:
12761
+ application/json:
12762
+ schema:
12763
+ $ref: "#/components/schemas/McpOauthRegisterResultDto"
12764
+ "400":
12765
+ description: "`redirect_uris` missing, or one is not allowed (`mcp_redirect_uri_invalid`)"
12766
+ content:
12767
+ application/json:
12768
+ schema:
12769
+ $ref: "#/components/schemas/ErrorMessageDto"
12770
+ "429":
12771
+ $ref: "#/components/responses/McpRateLimited"
12772
+
12773
+ /mcp/oauth/authorize:
12774
+ get:
12775
+ tags: [Mcp]
12776
+ summary: Start an MCP OAuth sign-in
12777
+ description: >-
12778
+ Public. Browser entry point of the authorization code flow. After checking the client,
12779
+ redirect URI, and PKCE challenge, it redirects (`302`) to the app's `/mcp/consent` page
12780
+ where a signed-in member approves. `resource` must be the workspace MCP URL
12781
+ (`…/workspaces/{workspaceId}/mcp`). Only `response_type=code` and
12782
+ `code_challenge_method=S256` are accepted.
12783
+ operationId: authorizeMcpOauth
12784
+ security: []
12785
+ parameters:
12786
+ - name: response_type
12787
+ in: query
12788
+ required: false
12789
+ schema: { type: string, enum: [code], default: code }
12790
+ - name: client_id
12791
+ in: query
12792
+ required: true
12793
+ schema: { type: string }
12794
+ - name: redirect_uri
12795
+ in: query
12796
+ required: true
12797
+ schema: { type: string }
12798
+ - name: code_challenge
12799
+ in: query
12800
+ required: true
12801
+ schema: { type: string }
12802
+ - name: code_challenge_method
12803
+ in: query
12804
+ required: false
12805
+ schema: { type: string, enum: [S256], default: S256 }
12806
+ - name: resource
12807
+ in: query
12808
+ required: true
12809
+ description: Workspace MCP URL, for example `https://api.example.com/workspaces/{workspaceId}/mcp`
12810
+ schema: { type: string }
12811
+ - name: state
12812
+ in: query
12813
+ required: false
12814
+ schema: { type: string }
12815
+ responses:
12816
+ "302":
12817
+ description: Redirect to the app consent page
12818
+ headers:
12819
+ Location:
12820
+ schema: { type: string }
12821
+ "400":
12822
+ description: Missing or invalid parameter, or `redirect_uri` is not registered for the client
12823
+ content:
12824
+ application/json:
12825
+ schema:
12826
+ $ref: "#/components/schemas/ErrorMessageDto"
12827
+ "429":
12828
+ $ref: "#/components/responses/McpRateLimited"
12829
+ "503":
12830
+ description: App URL is not configured (`mcp_app_url_missing`)
12831
+ content:
12832
+ application/json:
12833
+ schema:
12834
+ $ref: "#/components/schemas/ErrorMessageDto"
12835
+
12836
+ /mcp/oauth/token:
12837
+ post:
12838
+ tags: [Mcp]
12839
+ summary: Exchange an MCP authorization code for an access token
12840
+ description: >-
12841
+ Public. Accepts `application/x-www-form-urlencoded` (standard) or JSON. Only
12842
+ `grant_type=authorization_code` is supported. `code_verifier` is 43 to 128 characters and
12843
+ must match the challenge sent at authorize. A code is single use. The response is never
12844
+ cached (`Cache-Control: no-store`). The access token is read-only and lasts 8 hours.
12845
+ Errors follow OAuth: the body carries `error` (`unsupported_grant_type`, `invalid_grant`).
12846
+ operationId: exchangeMcpOauthToken
12847
+ security: []
12848
+ requestBody:
12849
+ required: true
12850
+ content:
12851
+ application/x-www-form-urlencoded:
12852
+ schema:
12853
+ $ref: "#/components/schemas/McpOauthTokenBodyDto"
12854
+ application/json:
12855
+ schema:
12856
+ $ref: "#/components/schemas/McpOauthTokenBodyDto"
12857
+ responses:
12858
+ "200":
12859
+ description: Access token
12860
+ content:
12861
+ application/json:
12862
+ schema:
12863
+ $ref: "#/components/schemas/McpOauthTokenResultDto"
12864
+ "400":
12865
+ description: "`unsupported_grant_type` or `invalid_grant` (bad, used, or expired code, verifier, or redirect)"
12866
+ content:
12867
+ application/json:
12868
+ schema:
12869
+ $ref: "#/components/schemas/ErrorMessageDto"
12870
+ example:
12871
+ error: invalid_grant
12872
+ "429":
12873
+ $ref: "#/components/responses/McpRateLimited"
12874
+
12875
+ /workspaces/{workspaceId}/mcp:
12876
+ post:
12877
+ tags: [Mcp]
12878
+ summary: Workspace MCP endpoint (Streamable HTTP, JSON-RPC)
12879
+ description: >-
12880
+ Hosted, read-only MCP server for one workspace. Authenticate with an MCP bearer token (an
12881
+ OAuth access token or a personal token), not a Supabase JWT. Each call carries one
12882
+ JSON-RPC 2.0 message and gets one JSON response. A message without `id` (a notification)
12883
+ gets `202` with no body. Supported methods: `initialize`, `tools/list`, `tools/call`;
12884
+ any other method returns JSON-RPC error `-32601`. A tool failure returns `200` with
12885
+ `result.isError: true`.
12886
+
12887
+ Tools: the Code Chat tools (including `ask`), `read_wiki_structure` and
12888
+ `read_wiki_contents` (one repository, pass `repoId`), and `read_workspace_wiki_structure`
12889
+ and `read_workspace_wiki_contents` (the workspace wiki, pass `slug`; stale pages are
12890
+ marked). Code Intelligence must be on for the workspace. Rate limited per client IP.
12891
+ operationId: callWorkspaceMcp
12892
+ security:
12893
+ - mcpBearerAuth: []
12894
+ parameters:
12895
+ - $ref: "#/components/parameters/WorkspaceId"
12896
+ requestBody:
12897
+ required: true
12898
+ content:
12899
+ application/json:
12900
+ schema:
12901
+ $ref: "#/components/schemas/McpJsonRpcRequestDto"
12902
+ example:
12903
+ jsonrpc: "2.0"
12904
+ id: 1
12905
+ method: tools/list
12906
+ responses:
12907
+ "200":
12908
+ description: JSON-RPC response (result or error)
12909
+ content:
12910
+ application/json:
12911
+ schema:
12912
+ $ref: "#/components/schemas/McpJsonRpcResponseDto"
12913
+ "202":
12914
+ description: Notification accepted (no `id`); no body
12915
+ "401":
12916
+ description: >-
12917
+ Missing, invalid, expired, or wrong-workspace token (`mcp_unauthorized`). The
12918
+ `WWW-Authenticate` header points to the protected resource metadata.
12919
+ headers:
12920
+ WWW-Authenticate:
12921
+ schema: { type: string }
12922
+ content:
12923
+ application/json:
12924
+ schema:
12925
+ $ref: "#/components/schemas/ErrorMessageDto"
12926
+ "403":
12927
+ description: Code Intelligence is off for the workspace (`code_intelligence_disabled`)
12928
+ content:
12929
+ application/json:
12930
+ schema:
12931
+ $ref: "#/components/schemas/ErrorMessageDto"
12932
+ "404":
12933
+ description: "`workspaceId` is not a UUID"
12934
+ content:
12935
+ application/json:
12936
+ schema:
12937
+ $ref: "#/components/schemas/ErrorMessageDto"
12938
+ "429":
12939
+ $ref: "#/components/responses/McpRateLimited"
12940
+
12446
12941
  /workspaces/{workspaceId}/knowledge-pages/prd/generate:
12447
12942
  post:
12448
12943
  tags: [CodeChat]
@@ -12451,7 +12946,9 @@ paths:
12451
12946
  Builds a PRD draft from ready indexes (required) plus optional wiki pages and
12452
12947
  platform evidence (readiness, quality, delivery, AI adoption, monitoring). Wiki is
12453
12948
  optional — scan at least one repository first. Upserts one workspace knowledge page
12454
- (`prd-<slug>` / `prd-draft`) without replacing the whole knowledge base.
12949
+ (`prd-<slug>` / `prd-draft`) without replacing the whole knowledge base. When no model
12950
+ is configured the saved page is a labeled skeleton (`mode: deterministic`); when models
12951
+ are configured and the draft fails or times out, nothing is saved (`502` / `504`).
12455
12952
  operationId: generatePrdDraft
12456
12953
  parameters:
12457
12954
  - $ref: "#/components/parameters/WorkspaceId"
@@ -12476,6 +12973,21 @@ paths:
12476
12973
  description: Code Intelligence is disabled for this workspace
12477
12974
  "409":
12478
12975
  description: No ready index in scope
12976
+ "502":
12977
+ description: >-
12978
+ Models are configured but none returned a usable draft after a retry
12979
+ (`artifact_polish_failed`). Nothing was saved.
12980
+ content:
12981
+ application/json:
12982
+ schema:
12983
+ $ref: "#/components/schemas/ErrorMessageDto"
12984
+ "504":
12985
+ description: >-
12986
+ The draft took longer than the time limit (`artifact_timed_out`). Nothing was saved.
12987
+ content:
12988
+ application/json:
12989
+ schema:
12990
+ $ref: "#/components/schemas/ErrorMessageDto"
12479
12991
 
12480
12992
  /workspaces/{workspaceId}/knowledge-pages/rfc/generate:
12481
12993
  post:
@@ -12508,6 +13020,21 @@ paths:
12508
13020
  description: Code Intelligence is disabled for this workspace
12509
13021
  "409":
12510
13022
  description: No ready index in scope
13023
+ "502":
13024
+ description: >-
13025
+ Models are configured but none returned a usable draft after a retry
13026
+ (`artifact_polish_failed`). Nothing was saved.
13027
+ content:
13028
+ application/json:
13029
+ schema:
13030
+ $ref: "#/components/schemas/ErrorMessageDto"
13031
+ "504":
13032
+ description: >-
13033
+ The draft took longer than the time limit (`artifact_timed_out`). Nothing was saved.
13034
+ content:
13035
+ application/json:
13036
+ schema:
13037
+ $ref: "#/components/schemas/ErrorMessageDto"
12511
13038
 
12512
13039
  /workspaces/{workspaceId}/knowledge-pages/adr/generate:
12513
13040
  post:
@@ -12540,6 +13067,21 @@ paths:
12540
13067
  description: Code Intelligence is disabled for this workspace
12541
13068
  "409":
12542
13069
  description: No ready index in scope
13070
+ "502":
13071
+ description: >-
13072
+ Models are configured but none returned a usable draft after a retry
13073
+ (`artifact_polish_failed`). Nothing was saved.
13074
+ content:
13075
+ application/json:
13076
+ schema:
13077
+ $ref: "#/components/schemas/ErrorMessageDto"
13078
+ "504":
13079
+ description: >-
13080
+ The draft took longer than the time limit (`artifact_timed_out`). Nothing was saved.
13081
+ content:
13082
+ application/json:
13083
+ schema:
13084
+ $ref: "#/components/schemas/ErrorMessageDto"
12543
13085
 
12544
13086
  /workspaces/{workspaceId}/knowledge-graph:
12545
13087
  get:
@@ -16121,6 +16663,12 @@ components:
16121
16663
  scheme: bearer
16122
16664
  bearerFormat: JWT
16123
16665
  description: Supabase access token (`Authorization` header).
16666
+ mcpBearerAuth:
16667
+ type: http
16668
+ scheme: bearer
16669
+ description: >-
16670
+ MCP access token for one workspace: an OAuth access token from `POST /mcp/oauth/token`
16671
+ or a personal token from `POST /workspaces/{workspaceId}/mcp/tokens`. Not a Supabase JWT.
16124
16672
 
16125
16673
  parameters:
16126
16674
  WorkspaceId:
@@ -16544,6 +17092,18 @@ components:
16544
17092
  application/json:
16545
17093
  schema:
16546
17094
  $ref: "#/components/schemas/ErrorMessageDto"
17095
+ McpRateLimited:
17096
+ description: Too many requests from this client IP; wait `Retry-After` seconds
17097
+ headers:
17098
+ Retry-After:
17099
+ schema: { type: integer }
17100
+ content:
17101
+ application/json:
17102
+ schema:
17103
+ $ref: "#/components/schemas/ErrorMessageDto"
17104
+ example:
17105
+ error: Too many requests
17106
+ code: too_many_requests
16547
17107
  ZenHrSyncInProgress:
16548
17108
  description: HRIS sync or ZenHR OAuth refresh already in progress for this workspace
16549
17109
  content:
@@ -27275,15 +27835,47 @@ components:
27275
27835
  type: string
27276
27836
  format: date-time
27277
27837
  description: When set, the banner is hidden after this instant (UTC).
27838
+ actions:
27839
+ type: array
27840
+ description: >
27841
+ Optional calls to action rendered next to the notice (for example
27842
+ "Add execution key"). Clients that do not know an action simply omit it.
27843
+ items:
27844
+ $ref: "#/components/schemas/PlatformBannerActionDto"
27845
+ details:
27846
+ type: string
27847
+ description: Optional longer explanation shown when the notice is expanded.
27848
+
27849
+ PlatformBannerActionDto:
27850
+ type: object
27851
+ required: [label, href]
27852
+ properties:
27853
+ label:
27854
+ type: string
27855
+ href:
27856
+ type: string
27857
+ description: In-app path (starts with `/`) or an absolute https URL.
27858
+ external:
27859
+ type: boolean
27860
+ description: True when `href` leaves the app and should open in a new tab.
27278
27861
 
27279
27862
  PlatformBannerViewDto:
27280
27863
  type: object
27281
- required: [banner]
27864
+ required: [banner, banners]
27282
27865
  properties:
27283
27866
  banner:
27284
27867
  allOf:
27285
27868
  - $ref: "#/components/schemas/PlatformBannerDto"
27286
27869
  nullable: true
27870
+ description: Most urgent active notice, equal to `banners[0]`. Kept for older clients.
27871
+ banners:
27872
+ type: array
27873
+ description: >
27874
+ Every notice active right now, most urgent first (global outage, global
27875
+ maintenance, workspace AI execution blocker, then other notices). A notice
27876
+ disappears from this list as soon as its condition ends.
27877
+ items:
27878
+ $ref: "#/components/schemas/PlatformBannerDto"
27287
27879
 
27288
27880
  PlatformBannerUpsertDto:
27289
27881
  type: object
@@ -32343,7 +32935,7 @@ components:
32343
32935
  updatedAt: { type: string, format: date-time, nullable: true }
32344
32936
  stale:
32345
32937
  type: boolean
32346
- description: The document was written for an earlier commit than the index now holds.
32938
+ description: The last scan did not confirm the document for the commit the index now holds. A newer commit that left the architecture unchanged is not stale.
32347
32939
  markdown:
32348
32940
  type: string
32349
32941
  nullable: true
@@ -32949,6 +33541,279 @@ components:
32949
33541
  groupCount: { type: integer }
32950
33542
  standaloneCount: { type: integer }
32951
33543
 
33544
+ GenerateWorkspaceDeepWikiBodyDto:
33545
+ type: object
33546
+ properties:
33547
+ repoIds:
33548
+ type: array
33549
+ description: Limit the run to these repositories' architecture documents. Omit or send empty for all (capped at 40).
33550
+ items: { type: string, format: uuid }
33551
+
33552
+ WorkspaceDeepWikiRunDto:
33553
+ type: object
33554
+ required: [status, startedAt, finishedAt, pageCount, error]
33555
+ properties:
33556
+ status:
33557
+ type: string
33558
+ enum: [idle, running, done, failed]
33559
+ phase:
33560
+ type: string
33561
+ nullable: true
33562
+ enum: [evidence, outline, skeleton, enrich, done]
33563
+ description: Current generate step while `status` is running; `done` when finished.
33564
+ startedAt:
33565
+ type: string
33566
+ format: date-time
33567
+ nullable: true
33568
+ finishedAt:
33569
+ type: string
33570
+ format: date-time
33571
+ nullable: true
33572
+ pageCount:
33573
+ type: integer
33574
+ nullable: true
33575
+ description: Pages saved by a finished run; null otherwise.
33576
+ error:
33577
+ type: string
33578
+ nullable: true
33579
+ description: Plain-words reason when `status` is `failed`; null otherwise.
33580
+ reposInEvidence:
33581
+ type: integer
33582
+ description: Repositories whose architecture documents feed the run. Sent only on the `202` start response.
33583
+
33584
+ McpOauthApproveBodyDto:
33585
+ type: object
33586
+ required: [clientId, redirectUri, codeChallenge]
33587
+ properties:
33588
+ clientId: { type: string }
33589
+ redirectUri: { type: string }
33590
+ codeChallenge:
33591
+ type: string
33592
+ description: PKCE `S256` challenge from the authorize request.
33593
+ state: { type: string }
33594
+
33595
+ McpOauthApproveResultDto:
33596
+ type: object
33597
+ required: [redirectTo]
33598
+ properties:
33599
+ redirectTo:
33600
+ type: string
33601
+ description: The client's redirect URI with `code` (and `state` when sent). Send the browser here.
33602
+
33603
+ McpTokenDto:
33604
+ type: object
33605
+ required: [id, name, tokenPrefix, tokenKind, expiresAt, revokedAt, createdAt, userId]
33606
+ properties:
33607
+ id: { type: string, format: uuid }
33608
+ name: { type: string }
33609
+ tokenPrefix:
33610
+ type: string
33611
+ description: First 16 characters of the token, to tell tokens apart. Not usable as a secret.
33612
+ tokenKind:
33613
+ type: string
33614
+ description: Always `personal` in this list.
33615
+ expiresAt: { type: string, format: date-time }
33616
+ revokedAt:
33617
+ type: string
33618
+ format: date-time
33619
+ nullable: true
33620
+ createdAt: { type: string, format: date-time }
33621
+ userId:
33622
+ type: string
33623
+ format: uuid
33624
+ description: Owner of the token.
33625
+
33626
+ McpTokenListDto:
33627
+ type: object
33628
+ required: [items]
33629
+ properties:
33630
+ items:
33631
+ type: array
33632
+ items:
33633
+ $ref: "#/components/schemas/McpTokenDto"
33634
+
33635
+ McpTokenCreateBodyDto:
33636
+ type: object
33637
+ required: [name]
33638
+ properties:
33639
+ name:
33640
+ type: string
33641
+ minLength: 1
33642
+ description: Label for the token. Trimmed and cut to 80 characters.
33643
+
33644
+ McpTokenCreatedDto:
33645
+ type: object
33646
+ required: [id, token, tokenPrefix, expiresAt]
33647
+ properties:
33648
+ id: { type: string, format: uuid }
33649
+ token:
33650
+ type: string
33651
+ description: Full secret (`tai_mcp_…`). Shown once; it cannot be read again.
33652
+ tokenPrefix: { type: string }
33653
+ expiresAt:
33654
+ type: string
33655
+ format: date-time
33656
+ description: 90 days after creation.
33657
+
33658
+ McpOauthServerMetadataDto:
33659
+ type: object
33660
+ required:
33661
+ - issuer
33662
+ - authorization_endpoint
33663
+ - token_endpoint
33664
+ - registration_endpoint
33665
+ - response_types_supported
33666
+ - grant_types_supported
33667
+ - code_challenge_methods_supported
33668
+ - scopes_supported
33669
+ - token_endpoint_auth_methods_supported
33670
+ properties:
33671
+ issuer: { type: string }
33672
+ authorization_endpoint: { type: string }
33673
+ token_endpoint: { type: string }
33674
+ registration_endpoint: { type: string }
33675
+ response_types_supported:
33676
+ type: array
33677
+ items: { type: string }
33678
+ grant_types_supported:
33679
+ type: array
33680
+ items: { type: string }
33681
+ code_challenge_methods_supported:
33682
+ type: array
33683
+ items: { type: string }
33684
+ scopes_supported:
33685
+ type: array
33686
+ items: { type: string }
33687
+ token_endpoint_auth_methods_supported:
33688
+ type: array
33689
+ items: { type: string }
33690
+
33691
+ McpOauthProtectedResourceDto:
33692
+ type: object
33693
+ required: [resource, authorization_servers, scopes_supported, bearer_methods_supported]
33694
+ properties:
33695
+ resource: { type: string }
33696
+ authorization_servers:
33697
+ type: array
33698
+ items: { type: string }
33699
+ scopes_supported:
33700
+ type: array
33701
+ items: { type: string }
33702
+ bearer_methods_supported:
33703
+ type: array
33704
+ items: { type: string }
33705
+
33706
+ McpOauthRegisterBodyDto:
33707
+ type: object
33708
+ required: [redirect_uris]
33709
+ properties:
33710
+ redirect_uris:
33711
+ type: array
33712
+ minItems: 1
33713
+ maxItems: 10
33714
+ items: { type: string }
33715
+ client_name:
33716
+ type: string
33717
+ maxLength: 120
33718
+ description: Defaults to `MCP client`.
33719
+
33720
+ McpOauthRegisterResultDto:
33721
+ type: object
33722
+ required:
33723
+ - client_id
33724
+ - client_name
33725
+ - redirect_uris
33726
+ - token_endpoint_auth_method
33727
+ - grant_types
33728
+ - response_types
33729
+ properties:
33730
+ client_id: { type: string }
33731
+ client_name: { type: string }
33732
+ redirect_uris:
33733
+ type: array
33734
+ items: { type: string }
33735
+ token_endpoint_auth_method:
33736
+ type: string
33737
+ enum: [none]
33738
+ grant_types:
33739
+ type: array
33740
+ items: { type: string }
33741
+ response_types:
33742
+ type: array
33743
+ items: { type: string }
33744
+
33745
+ McpOauthTokenBodyDto:
33746
+ type: object
33747
+ required: [grant_type, code, code_verifier, client_id]
33748
+ properties:
33749
+ grant_type:
33750
+ type: string
33751
+ enum: [authorization_code]
33752
+ code: { type: string }
33753
+ code_verifier:
33754
+ type: string
33755
+ minLength: 43
33756
+ maxLength: 128
33757
+ client_id: { type: string }
33758
+ redirect_uri:
33759
+ type: string
33760
+ description: Must match the redirect used at authorize.
33761
+
33762
+ McpOauthTokenResultDto:
33763
+ type: object
33764
+ required: [access_token, token_type, expires_in, scope]
33765
+ properties:
33766
+ access_token: { type: string }
33767
+ token_type:
33768
+ type: string
33769
+ enum: [Bearer]
33770
+ expires_in:
33771
+ type: integer
33772
+ description: Seconds (28800, 8 hours).
33773
+ scope:
33774
+ type: string
33775
+ enum: [read]
33776
+
33777
+ McpJsonRpcRequestDto:
33778
+ type: object
33779
+ required: [jsonrpc, method]
33780
+ properties:
33781
+ jsonrpc: { type: string, enum: ["2.0"] }
33782
+ id:
33783
+ description: Omit for a notification.
33784
+ oneOf:
33785
+ - type: string
33786
+ - type: integer
33787
+ method:
33788
+ type: string
33789
+ description: "`initialize`, `tools/list`, or `tools/call`"
33790
+ params:
33791
+ type: object
33792
+ additionalProperties: true
33793
+ description: For `tools/call`, `{ name, arguments }`.
33794
+
33795
+ McpJsonRpcResponseDto:
33796
+ type: object
33797
+ required: [jsonrpc, id]
33798
+ properties:
33799
+ jsonrpc: { type: string, enum: ["2.0"] }
33800
+ id:
33801
+ oneOf:
33802
+ - type: string
33803
+ - type: integer
33804
+ result:
33805
+ type: object
33806
+ additionalProperties: true
33807
+ description: >-
33808
+ For `tools/call`: `{ content: [{ type: "text", text }], isError }`, where `text` is
33809
+ JSON for a successful tool call or an error message when `isError` is true.
33810
+ error:
33811
+ type: object
33812
+ required: [code, message]
33813
+ properties:
33814
+ code: { type: integer }
33815
+ message: { type: string }
33816
+
32952
33817
  GeneratePrdDraftBodyDto:
32953
33818
  type: object
32954
33819
  required: [featureIntent]
@@ -33032,6 +33897,24 @@ components:
33032
33897
  type: array
33033
33898
  items: { type: string }
33034
33899
  description: Display names for sourceRepoIds when resolvable
33900
+ pageKind:
33901
+ type: string
33902
+ enum: [kb, wiki, draft]
33903
+ description: kb = legacy synthesis, wiki = workspace Deep Wiki, draft = PRD/RFC/ADR
33904
+ parentSlug:
33905
+ type: string
33906
+ nullable: true
33907
+ shallow:
33908
+ type: boolean
33909
+ description: True when the page is still a grounded skeleton (enrich not finished)
33910
+ staleAt:
33911
+ type: string
33912
+ format: date-time
33913
+ nullable: true
33914
+ description: Set when a cited architecture document changed; clear after Refresh
33915
+ diagramMermaid:
33916
+ type: string
33917
+ nullable: true
33035
33918
 
33036
33919
  WorkspaceKnowledgeSystemContextDto:
33037
33920
  type: object