@thinkai/tai-api-contract 2.237.0 → 2.239.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.237.0
4
+ version: 2.239.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:
@@ -30362,9 +30922,11 @@ components:
30362
30922
  kind:
30363
30923
  type: string
30364
30924
  description: >
30365
- `linear` (v2.210.0+) is the last Linear poll from the productivity worker: `failed`
30366
- with `lastErrorKind` `invalid_token` when the key was revoked, `incremental` after a
30367
- successful poll, `sync.eventCount` for tickets read. Listed only while Linear is connected.
30925
+ PM delivery kinds (`linear` v2.210.0+, `jira`, `github_issues`, `azure_boards`) are the
30926
+ last poll from the delivery lane (`productivity.delivery`, ADR 005): `failed` with
30927
+ `lastErrorKind` `invalid_token` when the key was revoked, `incremental` after a
30928
+ successful poll, `sync.eventCount` for tickets read. Each is listed only while that
30929
+ provider is connected.
30368
30930
  enum:
30369
30931
  [
30370
30932
  productivity_github,
@@ -30376,6 +30938,8 @@ components:
30376
30938
  jira,
30377
30939
  pagerduty,
30378
30940
  linear,
30941
+ github_issues,
30942
+ azure_boards,
30379
30943
  ]
30380
30944
  provider:
30381
30945
  type: string
@@ -32375,7 +32939,7 @@ components:
32375
32939
  updatedAt: { type: string, format: date-time, nullable: true }
32376
32940
  stale:
32377
32941
  type: boolean
32378
- description: The document was written for an earlier commit than the index now holds.
32942
+ 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.
32379
32943
  markdown:
32380
32944
  type: string
32381
32945
  nullable: true
@@ -32981,6 +33545,279 @@ components:
32981
33545
  groupCount: { type: integer }
32982
33546
  standaloneCount: { type: integer }
32983
33547
 
33548
+ GenerateWorkspaceDeepWikiBodyDto:
33549
+ type: object
33550
+ properties:
33551
+ repoIds:
33552
+ type: array
33553
+ description: Limit the run to these repositories' architecture documents. Omit or send empty for all (capped at 40).
33554
+ items: { type: string, format: uuid }
33555
+
33556
+ WorkspaceDeepWikiRunDto:
33557
+ type: object
33558
+ required: [status, startedAt, finishedAt, pageCount, error]
33559
+ properties:
33560
+ status:
33561
+ type: string
33562
+ enum: [idle, running, done, failed]
33563
+ phase:
33564
+ type: string
33565
+ nullable: true
33566
+ enum: [evidence, outline, skeleton, enrich, done]
33567
+ description: Current generate step while `status` is running; `done` when finished.
33568
+ startedAt:
33569
+ type: string
33570
+ format: date-time
33571
+ nullable: true
33572
+ finishedAt:
33573
+ type: string
33574
+ format: date-time
33575
+ nullable: true
33576
+ pageCount:
33577
+ type: integer
33578
+ nullable: true
33579
+ description: Pages saved by a finished run; null otherwise.
33580
+ error:
33581
+ type: string
33582
+ nullable: true
33583
+ description: Plain-words reason when `status` is `failed`; null otherwise.
33584
+ reposInEvidence:
33585
+ type: integer
33586
+ description: Repositories whose architecture documents feed the run. Sent only on the `202` start response.
33587
+
33588
+ McpOauthApproveBodyDto:
33589
+ type: object
33590
+ required: [clientId, redirectUri, codeChallenge]
33591
+ properties:
33592
+ clientId: { type: string }
33593
+ redirectUri: { type: string }
33594
+ codeChallenge:
33595
+ type: string
33596
+ description: PKCE `S256` challenge from the authorize request.
33597
+ state: { type: string }
33598
+
33599
+ McpOauthApproveResultDto:
33600
+ type: object
33601
+ required: [redirectTo]
33602
+ properties:
33603
+ redirectTo:
33604
+ type: string
33605
+ description: The client's redirect URI with `code` (and `state` when sent). Send the browser here.
33606
+
33607
+ McpTokenDto:
33608
+ type: object
33609
+ required: [id, name, tokenPrefix, tokenKind, expiresAt, revokedAt, createdAt, userId]
33610
+ properties:
33611
+ id: { type: string, format: uuid }
33612
+ name: { type: string }
33613
+ tokenPrefix:
33614
+ type: string
33615
+ description: First 16 characters of the token, to tell tokens apart. Not usable as a secret.
33616
+ tokenKind:
33617
+ type: string
33618
+ description: Always `personal` in this list.
33619
+ expiresAt: { type: string, format: date-time }
33620
+ revokedAt:
33621
+ type: string
33622
+ format: date-time
33623
+ nullable: true
33624
+ createdAt: { type: string, format: date-time }
33625
+ userId:
33626
+ type: string
33627
+ format: uuid
33628
+ description: Owner of the token.
33629
+
33630
+ McpTokenListDto:
33631
+ type: object
33632
+ required: [items]
33633
+ properties:
33634
+ items:
33635
+ type: array
33636
+ items:
33637
+ $ref: "#/components/schemas/McpTokenDto"
33638
+
33639
+ McpTokenCreateBodyDto:
33640
+ type: object
33641
+ required: [name]
33642
+ properties:
33643
+ name:
33644
+ type: string
33645
+ minLength: 1
33646
+ description: Label for the token. Trimmed and cut to 80 characters.
33647
+
33648
+ McpTokenCreatedDto:
33649
+ type: object
33650
+ required: [id, token, tokenPrefix, expiresAt]
33651
+ properties:
33652
+ id: { type: string, format: uuid }
33653
+ token:
33654
+ type: string
33655
+ description: Full secret (`tai_mcp_…`). Shown once; it cannot be read again.
33656
+ tokenPrefix: { type: string }
33657
+ expiresAt:
33658
+ type: string
33659
+ format: date-time
33660
+ description: 90 days after creation.
33661
+
33662
+ McpOauthServerMetadataDto:
33663
+ type: object
33664
+ required:
33665
+ - issuer
33666
+ - authorization_endpoint
33667
+ - token_endpoint
33668
+ - registration_endpoint
33669
+ - response_types_supported
33670
+ - grant_types_supported
33671
+ - code_challenge_methods_supported
33672
+ - scopes_supported
33673
+ - token_endpoint_auth_methods_supported
33674
+ properties:
33675
+ issuer: { type: string }
33676
+ authorization_endpoint: { type: string }
33677
+ token_endpoint: { type: string }
33678
+ registration_endpoint: { type: string }
33679
+ response_types_supported:
33680
+ type: array
33681
+ items: { type: string }
33682
+ grant_types_supported:
33683
+ type: array
33684
+ items: { type: string }
33685
+ code_challenge_methods_supported:
33686
+ type: array
33687
+ items: { type: string }
33688
+ scopes_supported:
33689
+ type: array
33690
+ items: { type: string }
33691
+ token_endpoint_auth_methods_supported:
33692
+ type: array
33693
+ items: { type: string }
33694
+
33695
+ McpOauthProtectedResourceDto:
33696
+ type: object
33697
+ required: [resource, authorization_servers, scopes_supported, bearer_methods_supported]
33698
+ properties:
33699
+ resource: { type: string }
33700
+ authorization_servers:
33701
+ type: array
33702
+ items: { type: string }
33703
+ scopes_supported:
33704
+ type: array
33705
+ items: { type: string }
33706
+ bearer_methods_supported:
33707
+ type: array
33708
+ items: { type: string }
33709
+
33710
+ McpOauthRegisterBodyDto:
33711
+ type: object
33712
+ required: [redirect_uris]
33713
+ properties:
33714
+ redirect_uris:
33715
+ type: array
33716
+ minItems: 1
33717
+ maxItems: 10
33718
+ items: { type: string }
33719
+ client_name:
33720
+ type: string
33721
+ maxLength: 120
33722
+ description: Defaults to `MCP client`.
33723
+
33724
+ McpOauthRegisterResultDto:
33725
+ type: object
33726
+ required:
33727
+ - client_id
33728
+ - client_name
33729
+ - redirect_uris
33730
+ - token_endpoint_auth_method
33731
+ - grant_types
33732
+ - response_types
33733
+ properties:
33734
+ client_id: { type: string }
33735
+ client_name: { type: string }
33736
+ redirect_uris:
33737
+ type: array
33738
+ items: { type: string }
33739
+ token_endpoint_auth_method:
33740
+ type: string
33741
+ enum: [none]
33742
+ grant_types:
33743
+ type: array
33744
+ items: { type: string }
33745
+ response_types:
33746
+ type: array
33747
+ items: { type: string }
33748
+
33749
+ McpOauthTokenBodyDto:
33750
+ type: object
33751
+ required: [grant_type, code, code_verifier, client_id]
33752
+ properties:
33753
+ grant_type:
33754
+ type: string
33755
+ enum: [authorization_code]
33756
+ code: { type: string }
33757
+ code_verifier:
33758
+ type: string
33759
+ minLength: 43
33760
+ maxLength: 128
33761
+ client_id: { type: string }
33762
+ redirect_uri:
33763
+ type: string
33764
+ description: Must match the redirect used at authorize.
33765
+
33766
+ McpOauthTokenResultDto:
33767
+ type: object
33768
+ required: [access_token, token_type, expires_in, scope]
33769
+ properties:
33770
+ access_token: { type: string }
33771
+ token_type:
33772
+ type: string
33773
+ enum: [Bearer]
33774
+ expires_in:
33775
+ type: integer
33776
+ description: Seconds (28800, 8 hours).
33777
+ scope:
33778
+ type: string
33779
+ enum: [read]
33780
+
33781
+ McpJsonRpcRequestDto:
33782
+ type: object
33783
+ required: [jsonrpc, method]
33784
+ properties:
33785
+ jsonrpc: { type: string, enum: ["2.0"] }
33786
+ id:
33787
+ description: Omit for a notification.
33788
+ oneOf:
33789
+ - type: string
33790
+ - type: integer
33791
+ method:
33792
+ type: string
33793
+ description: "`initialize`, `tools/list`, or `tools/call`"
33794
+ params:
33795
+ type: object
33796
+ additionalProperties: true
33797
+ description: For `tools/call`, `{ name, arguments }`.
33798
+
33799
+ McpJsonRpcResponseDto:
33800
+ type: object
33801
+ required: [jsonrpc, id]
33802
+ properties:
33803
+ jsonrpc: { type: string, enum: ["2.0"] }
33804
+ id:
33805
+ oneOf:
33806
+ - type: string
33807
+ - type: integer
33808
+ result:
33809
+ type: object
33810
+ additionalProperties: true
33811
+ description: >-
33812
+ For `tools/call`: `{ content: [{ type: "text", text }], isError }`, where `text` is
33813
+ JSON for a successful tool call or an error message when `isError` is true.
33814
+ error:
33815
+ type: object
33816
+ required: [code, message]
33817
+ properties:
33818
+ code: { type: integer }
33819
+ message: { type: string }
33820
+
32984
33821
  GeneratePrdDraftBodyDto:
32985
33822
  type: object
32986
33823
  required: [featureIntent]
@@ -33064,6 +33901,24 @@ components:
33064
33901
  type: array
33065
33902
  items: { type: string }
33066
33903
  description: Display names for sourceRepoIds when resolvable
33904
+ pageKind:
33905
+ type: string
33906
+ enum: [kb, wiki, draft]
33907
+ description: kb = legacy synthesis, wiki = workspace Deep Wiki, draft = PRD/RFC/ADR
33908
+ parentSlug:
33909
+ type: string
33910
+ nullable: true
33911
+ shallow:
33912
+ type: boolean
33913
+ description: True when the page is still a grounded skeleton (enrich not finished)
33914
+ staleAt:
33915
+ type: string
33916
+ format: date-time
33917
+ nullable: true
33918
+ description: Set when a cited architecture document changed; clear after Refresh
33919
+ diagramMermaid:
33920
+ type: string
33921
+ nullable: true
33067
33922
 
33068
33923
  WorkspaceKnowledgeSystemContextDto:
33069
33924
  type: object