@thinkai/tai-api-contract 2.110.0 → 2.112.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.110.0
4
+ version: 2.112.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}/...`.
@@ -7202,6 +7202,37 @@ paths:
7202
7202
  "403":
7203
7203
  $ref: "#/components/responses/Forbidden"
7204
7204
 
7205
+ /workspaces/{workspaceId}/code-intelligence/token-usage/summary:
7206
+ get:
7207
+ tags: [CodeChat]
7208
+ summary: ECG token usage rollup for this workspace
7209
+ description: >
7210
+ Member-readable totals and per-operation breakdown from
7211
+ `tai_workspace_code_intelligence_token_usage` (Ask, wiki enrich, PRD, workspace KB,
7212
+ wiki.json outline). Default window is 30 days (max 90).
7213
+ operationId: getCodeIntelligenceTokenUsageSummary
7214
+ parameters:
7215
+ - $ref: "#/components/parameters/WorkspaceId"
7216
+ - name: days
7217
+ in: query
7218
+ required: false
7219
+ schema:
7220
+ type: integer
7221
+ minimum: 1
7222
+ maximum: 90
7223
+ default: 30
7224
+ responses:
7225
+ "200":
7226
+ description: Token usage summary
7227
+ content:
7228
+ application/json:
7229
+ schema:
7230
+ $ref: "#/components/schemas/CodeIntelligenceTokenUsageSummaryDto"
7231
+ "401":
7232
+ $ref: "#/components/responses/Unauthorized"
7233
+ "403":
7234
+ $ref: "#/components/responses/Forbidden"
7235
+
7205
7236
  /workspaces/{workspaceId}/repo-eligibility:
7206
7237
  get:
7207
7238
  tags: [RepositoryReadiness]
@@ -7713,6 +7744,187 @@ paths:
7713
7744
  "404":
7714
7745
  description: Not found
7715
7746
 
7747
+ /workspaces/{workspaceId}/code-chat/indexes/{indexId}/wiki-config:
7748
+ get:
7749
+ tags: [CodeChat]
7750
+ summary: Effective wiki.json for an index (server + repo + workspace)
7751
+ operationId: getCodeChatEffectiveWikiConfig
7752
+ parameters:
7753
+ - $ref: "#/components/parameters/WorkspaceId"
7754
+ - name: indexId
7755
+ in: path
7756
+ required: true
7757
+ schema: { type: string, format: uuid }
7758
+ responses:
7759
+ "200":
7760
+ description: Effective wiki config
7761
+ content:
7762
+ application/json:
7763
+ schema:
7764
+ $ref: "#/components/schemas/EffectiveWikiConfigDto"
7765
+ "401":
7766
+ $ref: "#/components/responses/Unauthorized"
7767
+ "404":
7768
+ description: Graph not ready
7769
+
7770
+ /workspaces/{workspaceId}/knowledge-pages:
7771
+ get:
7772
+ tags: [CodeChat]
7773
+ summary: List workspace knowledge base pages (no repo pick)
7774
+ operationId: listWorkspaceKnowledgePages
7775
+ parameters:
7776
+ - $ref: "#/components/parameters/WorkspaceId"
7777
+ responses:
7778
+ "200":
7779
+ description: Workspace knowledge pages
7780
+ content:
7781
+ application/json:
7782
+ schema:
7783
+ $ref: "#/components/schemas/WorkspaceKnowledgePageListDto"
7784
+ "401":
7785
+ $ref: "#/components/responses/Unauthorized"
7786
+
7787
+ /workspaces/{workspaceId}/knowledge-pages/generate:
7788
+ post:
7789
+ tags: [CodeChat]
7790
+ summary: Generate the cross-repo workspace knowledge base
7791
+ description: >-
7792
+ Synthesizes workspace-level pages from the repository wikis that already exist.
7793
+ Does not clone or re-index. Replaces the whole workspace knowledge base.
7794
+ operationId: generateWorkspaceKnowledgePages
7795
+ parameters:
7796
+ - $ref: "#/components/parameters/WorkspaceId"
7797
+ requestBody:
7798
+ required: false
7799
+ content:
7800
+ application/json:
7801
+ schema:
7802
+ $ref: "#/components/schemas/GenerateWorkspaceKnowledgePagesBodyDto"
7803
+ responses:
7804
+ "200":
7805
+ description: Generated workspace knowledge pages
7806
+ content:
7807
+ application/json:
7808
+ schema:
7809
+ $ref: "#/components/schemas/GenerateWorkspaceKnowledgePagesResultDto"
7810
+ "401":
7811
+ $ref: "#/components/responses/Unauthorized"
7812
+ "403":
7813
+ description: Code Intelligence is disabled for this workspace
7814
+ "409":
7815
+ description: No ready repository index in scope
7816
+
7817
+ /workspaces/{workspaceId}/knowledge-pages/prd/generate:
7818
+ post:
7819
+ tags: [CodeChat]
7820
+ summary: Generate a workspace-scoped PRD draft
7821
+ description: >-
7822
+ Builds a PRD draft from ready repository wikis, code graphs, and platform evidence
7823
+ (readiness, quality, delivery, AI adoption, monitoring). Upserts one workspace
7824
+ knowledge page (`prd-<slug>` / `prd-draft`) without replacing the whole knowledge base.
7825
+ operationId: generatePrdDraft
7826
+ parameters:
7827
+ - $ref: "#/components/parameters/WorkspaceId"
7828
+ requestBody:
7829
+ required: true
7830
+ content:
7831
+ application/json:
7832
+ schema:
7833
+ $ref: "#/components/schemas/GeneratePrdDraftBodyDto"
7834
+ responses:
7835
+ "200":
7836
+ description: Generated PRD draft page
7837
+ content:
7838
+ application/json:
7839
+ schema:
7840
+ $ref: "#/components/schemas/GeneratePrdDraftResultDto"
7841
+ "400":
7842
+ description: Missing or invalid featureIntent
7843
+ "401":
7844
+ $ref: "#/components/responses/Unauthorized"
7845
+ "403":
7846
+ description: Code Intelligence is disabled for this workspace
7847
+ "409":
7848
+ description: No ready repository index in scope
7849
+
7850
+ /workspaces/{workspaceId}/code-intelligence/repo-wiki-json:
7851
+ get:
7852
+ tags: [CodeChat]
7853
+ summary: List repositories with an admin wiki.json override (admin only)
7854
+ operationId: listRepoWikiJsonSummaries
7855
+ parameters:
7856
+ - $ref: "#/components/parameters/WorkspaceId"
7857
+ responses:
7858
+ "200":
7859
+ description: Override summaries
7860
+ content:
7861
+ application/json:
7862
+ schema:
7863
+ $ref: "#/components/schemas/RepoWikiJsonSummaryListDto"
7864
+ "401":
7865
+ $ref: "#/components/responses/Unauthorized"
7866
+ "403":
7867
+ description: Workspace admin required
7868
+
7869
+ /workspaces/{workspaceId}/code-intelligence/repos/{repoId}/wiki-json:
7870
+ get:
7871
+ tags: [CodeChat]
7872
+ summary: Get the admin wiki.json override for a repository (admin only)
7873
+ operationId: getRepoWikiJson
7874
+ parameters:
7875
+ - $ref: "#/components/parameters/WorkspaceId"
7876
+ - name: repoId
7877
+ in: path
7878
+ required: true
7879
+ schema: { type: string, format: uuid }
7880
+ responses:
7881
+ "200":
7882
+ description: Stored override (document is null when unset)
7883
+ content:
7884
+ application/json:
7885
+ schema:
7886
+ $ref: "#/components/schemas/RepoWikiJsonDto"
7887
+ "401":
7888
+ $ref: "#/components/responses/Unauthorized"
7889
+ "403":
7890
+ description: Workspace admin required
7891
+ "404":
7892
+ description: Repository not found
7893
+ put:
7894
+ tags: [CodeChat]
7895
+ summary: Write or clear the admin wiki.json override for a repository (admin only)
7896
+ description: >-
7897
+ Sits between workspace guidance and the in-repo `.aidrivensdlc/wiki.json`, so a
7898
+ file committed to the repository still wins.
7899
+ operationId: putRepoWikiJson
7900
+ parameters:
7901
+ - $ref: "#/components/parameters/WorkspaceId"
7902
+ - name: repoId
7903
+ in: path
7904
+ required: true
7905
+ schema: { type: string, format: uuid }
7906
+ requestBody:
7907
+ required: true
7908
+ content:
7909
+ application/json:
7910
+ schema:
7911
+ $ref: "#/components/schemas/PutRepoWikiJsonDto"
7912
+ responses:
7913
+ "200":
7914
+ description: Stored override
7915
+ content:
7916
+ application/json:
7917
+ schema:
7918
+ $ref: "#/components/schemas/RepoWikiJsonDto"
7919
+ "400":
7920
+ description: Invalid document
7921
+ "401":
7922
+ $ref: "#/components/responses/Unauthorized"
7923
+ "403":
7924
+ description: Workspace admin required
7925
+ "404":
7926
+ description: Repository not found
7927
+
7716
7928
  /workspaces/{workspaceId}/code-chat/indexes/{indexId}/wiki/export:
7717
7929
  get:
7718
7930
  tags: [CodeChat]
@@ -10728,6 +10940,47 @@ components:
10728
10940
  type: string
10729
10941
  nullable: true
10730
10942
  minLength: 1
10943
+ wikiGuidance:
10944
+ allOf:
10945
+ - $ref: "#/components/schemas/CodeWikiGuidanceDto"
10946
+ nullable: true
10947
+ description: >
10948
+ Deep Wiki documentation focus for this workspace. Steers topic planning when
10949
+ generating Engineering Context wiki pages. Optional in-repo `.aidrivensdlc/wiki.json`
10950
+ still overrides the topic outline when present.
10951
+
10952
+ CodeWikiGuidanceTopicDto:
10953
+ type: object
10954
+ required: [title, purpose]
10955
+ properties:
10956
+ title:
10957
+ type: string
10958
+ minLength: 1
10959
+ maxLength: 120
10960
+ purpose:
10961
+ type: string
10962
+ minLength: 1
10963
+ maxLength: 800
10964
+ parentTitle:
10965
+ type: string
10966
+ nullable: true
10967
+ maxLength: 120
10968
+ description: Title of the parent topic for hierarchy (must match another topic title).
10969
+
10970
+ CodeWikiGuidanceDto:
10971
+ type: object
10972
+ properties:
10973
+ guidance:
10974
+ type: string
10975
+ maxLength: 10000
10976
+ description: Free-form notes describing what the wiki should emphasize.
10977
+ default: ""
10978
+ topics:
10979
+ type: array
10980
+ maxItems: 30
10981
+ items:
10982
+ $ref: "#/components/schemas/CodeWikiGuidanceTopicDto"
10983
+ description: Preferred topic outline for Deep Wiki pages.
10731
10984
 
10732
10985
  WorkspaceConfigDto:
10733
10986
  type: object
@@ -10806,6 +11059,12 @@ components:
10806
11059
  Federated-readiness delivery topology: which connected repos hold terraform /
10807
11060
  gitops / ci_templates / api_contracts truth for this workspace. Null when not
10808
11061
  configured. Change via `PUT /workspaces/{workspaceId}/delivery-topology`.
11062
+ codeWikiGuidance:
11063
+ allOf:
11064
+ - $ref: "#/components/schemas/CodeWikiGuidanceDto"
11065
+ description: >
11066
+ Deep Wiki documentation focus for this workspace (guidance notes + optional topic outline).
11067
+ Saved via `PUT /workspaces/{workspaceId}/code-intelligence` (`wikiGuidance`).
10809
11068
 
10810
11069
  DeliveryRoleConfigDto:
10811
11070
  type: object
@@ -18064,10 +18323,16 @@ components:
18064
18323
 
18065
18324
  InsightsRecommendationsCostPerPr:
18066
18325
  type: object
18067
- required: [orgAvgCostUsd, orgAvgPrevUsd, teams]
18326
+ required: [orgAvgCostUsd, orgAvgPrevUsd, orgSpendUsd, orgMergedPrs, teams]
18068
18327
  properties:
18069
18328
  orgAvgCostUsd: { type: number }
18070
18329
  orgAvgPrevUsd: { type: number }
18330
+ orgSpendUsd:
18331
+ type: number
18332
+ description: Total scoped AI spend (USD) underlying orgAvgCostUsd.
18333
+ orgMergedPrs:
18334
+ type: number
18335
+ description: Total scoped merged PRs underlying orgAvgCostUsd.
18071
18336
  teams:
18072
18337
  type: array
18073
18338
  items:
@@ -18300,6 +18565,13 @@ components:
18300
18565
  description: >
18301
18566
  Human-readable indexing stage while a job is running (queued, clone, graph,
18302
18567
  save, wiki). Cleared when the index is ready or failed.
18568
+ knowledgeJob:
18569
+ allOf:
18570
+ - $ref: "#/components/schemas/CodeKnowledgeJobDto"
18571
+ nullable: true
18572
+ description: >
18573
+ Active knowledge job for this repo when status is queued/running — phase, tracks,
18574
+ and token/cost rollups for SPA transparency (Wave 1).
18303
18575
  indexedAt: { type: string, format: date-time, nullable: true }
18304
18576
  createdAt: { type: string, format: date-time }
18305
18577
  updatedAt: { type: string, format: date-time }
@@ -18307,6 +18579,60 @@ components:
18307
18579
  type: boolean
18308
18580
  description: True when the indexed graph stores durable code excerpts (required for useful chat answers).
18309
18581
 
18582
+ CodeKnowledgeJobDto:
18583
+ type: object
18584
+ required:
18585
+ - id
18586
+ - workspaceId
18587
+ - repoId
18588
+ - status
18589
+ - inputTokensTotal
18590
+ - outputTokensTotal
18591
+ - estimatedCostUsdTotal
18592
+ - llmInvocationCount
18593
+ - createdAt
18594
+ - updatedAt
18595
+ properties:
18596
+ id: { type: string, format: uuid }
18597
+ workspaceId: { type: string, format: uuid }
18598
+ repoId: { type: string, format: uuid }
18599
+ indexId: { type: string, format: uuid, nullable: true }
18600
+ status:
18601
+ type: string
18602
+ enum: [queued, running, completed, failed]
18603
+ phase:
18604
+ type: string
18605
+ nullable: true
18606
+ enum: [cloning, indexing, track_a, track_b, completing]
18607
+ description: Coarse UX phase while status=running.
18608
+ phaseDetail:
18609
+ type: string
18610
+ nullable: true
18611
+ description: Human-readable detail (e.g. enriching · page 3/8 · how-it-works).
18612
+ phaseUpdatedAt: { type: string, format: date-time, nullable: true }
18613
+ trackAStatus:
18614
+ $ref: "#/components/schemas/CodeKnowledgeTrackStatus"
18615
+ trackBStatus:
18616
+ $ref: "#/components/schemas/CodeKnowledgeTrackStatus"
18617
+ graphStatus:
18618
+ $ref: "#/components/schemas/CodeKnowledgeTrackStatus"
18619
+ inputTokensTotal: { type: integer, minimum: 0 }
18620
+ outputTokensTotal: { type: integer, minimum: 0 }
18621
+ estimatedCostUsdTotal: { type: number, minimum: 0 }
18622
+ llmInvocationCount: { type: integer, minimum: 0 }
18623
+ lastProvider: { type: string, nullable: true }
18624
+ lastModel: { type: string, nullable: true }
18625
+ lastKeySource: { type: string, nullable: true }
18626
+ errorMessage: { type: string, nullable: true }
18627
+ createdAt: { type: string, format: date-time }
18628
+ updatedAt: { type: string, format: date-time }
18629
+
18630
+ CodeKnowledgeTrackStatus:
18631
+ type: string
18632
+ nullable: true
18633
+ enum: [pending, running, completed, skipped, failed]
18634
+ description: Per-track status for dual-track Deep Wiki (Track A skeleton, Track B enrich, graph index).
18635
+
18310
18636
  CodeChatIndexListDto:
18311
18637
  type: object
18312
18638
  required: [items]
@@ -18439,6 +18765,10 @@ components:
18439
18765
  required: [content]
18440
18766
  properties:
18441
18767
  content: { type: string, minLength: 1, maxLength: 8000 }
18768
+ persona:
18769
+ type: string
18770
+ enum: [engineer, lead, pm]
18771
+ description: Optional Ask tone preference (FE localStorage / request — not a DB role)
18442
18772
 
18443
18773
  CodeChatMessageReplyDto:
18444
18774
  allOf:
@@ -18463,6 +18793,25 @@ components:
18463
18793
  type: array
18464
18794
  items: { type: string }
18465
18795
  description: Repository names whose wiki pages grounded the answer
18796
+ groundedInPlatform:
18797
+ type: boolean
18798
+ description: True when platform evidence tools P–U contributed facts
18799
+ platformToolIds:
18800
+ type: array
18801
+ items: { type: string }
18802
+ description: Tool ids that returned data (e.g. readiness_summary)
18803
+ intent:
18804
+ type: string
18805
+ enum:
18806
+ - inventory_apis
18807
+ - inventory_modules
18808
+ - explain
18809
+ - platform_ops
18810
+ - feature_impact
18811
+ - prd_request
18812
+ description: Classified Ask intent for the turn
18813
+ usage:
18814
+ $ref: "#/components/schemas/CodeIntelligenceUsageDto"
18466
18815
 
18467
18816
  CodeChatApiRouteRowDto:
18468
18817
  type: object
@@ -18533,8 +18882,297 @@ components:
18533
18882
  type: array
18534
18883
  items: { type: string }
18535
18884
  diagramMermaid: { type: string, nullable: true }
18885
+ enrichmentStatus:
18886
+ type: string
18887
+ enum: [skeleton, enriched, shallow, needs_review]
18888
+ description: Deep Wiki page quality chip (D6 / D12).
18889
+ createdAt: { type: string, format: date-time }
18890
+ updatedAt: { type: string, format: date-time }
18891
+
18892
+ EffectiveWikiConfigDto:
18893
+ type: object
18894
+ required: [sources, document]
18895
+ properties:
18896
+ sources:
18897
+ type: array
18898
+ description: >-
18899
+ Layers that contributed, in applied order. Later layers win:
18900
+ server_default → workspace_guidance → admin_repo → repo_override.
18901
+ items:
18902
+ type: string
18903
+ enum: [server_default, workspace_guidance, admin_repo, repo_override]
18904
+ repoOverridePath: { type: string, nullable: true }
18905
+ document:
18906
+ type: object
18907
+ additionalProperties: true
18908
+ description: Effective wiki.json document (version, pages, slugAllowlist, diagramPolicies).
18909
+
18910
+ RepoWikiJsonDto:
18911
+ type: object
18912
+ description: Admin-authored wiki.json override stored for a single repository.
18913
+ required: [repoId, repoName, providerSlug, document, hasOverride, updatedAt, updatedBy]
18914
+ properties:
18915
+ repoId: { type: string, format: uuid }
18916
+ repoName: { type: string }
18917
+ providerSlug: { type: string }
18918
+ document:
18919
+ type: object
18920
+ nullable: true
18921
+ additionalProperties: true
18922
+ description: Stored wiki.json document, or null when no override is set.
18923
+ hasOverride: { type: boolean }
18924
+ updatedAt: { type: string, format: date-time, nullable: true }
18925
+ updatedBy: { type: string, format: uuid, nullable: true }
18926
+
18927
+ PutRepoWikiJsonDto:
18928
+ type: object
18929
+ description: >-
18930
+ Wiki.json override to store. Send `document: null`, or a document with no usable
18931
+ pages, notes, allowlist, or diagram policies, to clear the override.
18932
+ properties:
18933
+ document:
18934
+ type: object
18935
+ nullable: true
18936
+ additionalProperties: true
18937
+
18938
+ RepoWikiJsonSummaryDto:
18939
+ type: object
18940
+ required: [repoId, repoName, providerSlug, hasOverride, updatedAt, updatedBy]
18941
+ properties:
18942
+ repoId: { type: string, format: uuid }
18943
+ repoName: { type: string }
18944
+ providerSlug: { type: string }
18945
+ hasOverride: { type: boolean }
18946
+ updatedAt: { type: string, format: date-time, nullable: true }
18947
+ updatedBy: { type: string, format: uuid, nullable: true }
18948
+
18949
+ RepoWikiJsonSummaryListDto:
18950
+ type: object
18951
+ required: [items]
18952
+ properties:
18953
+ items:
18954
+ type: array
18955
+ items: { $ref: "#/components/schemas/RepoWikiJsonSummaryDto" }
18956
+
18957
+ GenerateWorkspaceKnowledgePagesBodyDto:
18958
+ type: object
18959
+ properties:
18960
+ repoIds:
18961
+ type: array
18962
+ description: Ready repository indexes to synthesize from. Omit or send empty for all ready indexes.
18963
+ items: { type: string, format: uuid }
18964
+
18965
+ GenerateWorkspaceKnowledgePagesResultDto:
18966
+ type: object
18967
+ required: [items, mode, repoIds]
18968
+ properties:
18969
+ items:
18970
+ type: array
18971
+ items: { $ref: "#/components/schemas/WorkspaceKnowledgePageDto" }
18972
+ mode:
18973
+ type: string
18974
+ enum: [deterministic, llm]
18975
+ description: llm when a model produced page bodies; deterministic when synthesized from wiki text alone.
18976
+ repoIds:
18977
+ type: array
18978
+ items: { type: string, format: uuid }
18979
+ platformToolIds:
18980
+ type: array
18981
+ items: { type: string }
18982
+ description: Platform evidence tool ids that contributed facts (P–U)
18983
+ usage:
18984
+ $ref: "#/components/schemas/CodeIntelligenceUsageDto"
18985
+
18986
+ GeneratePrdDraftBodyDto:
18987
+ type: object
18988
+ required: [featureIntent]
18989
+ properties:
18990
+ featureIntent:
18991
+ type: string
18992
+ minLength: 1
18993
+ maxLength: 4000
18994
+ description: Feature or change the PRD should describe
18995
+ repoIds:
18996
+ type: array
18997
+ description: Ready repository indexes to analyze. Omit or send empty for all ready indexes.
18998
+ items: { type: string, format: uuid }
18999
+ persona:
19000
+ type: string
19001
+ enum: [engineer, lead, pm]
19002
+ description: Draft voice preference (FE localStorage / request)
19003
+
19004
+ GeneratePrdDraftResultDto:
19005
+ type: object
19006
+ required: [item, mode, repoIds, slug]
19007
+ properties:
19008
+ item: { $ref: "#/components/schemas/WorkspaceKnowledgePageDto" }
19009
+ mode:
19010
+ type: string
19011
+ enum: [deterministic, llm]
19012
+ repoIds:
19013
+ type: array
19014
+ items: { type: string, format: uuid }
19015
+ slug:
19016
+ type: string
19017
+ description: Persisted workspace knowledge page slug (prd-draft or prd-<safe-slug>)
19018
+ usage:
19019
+ $ref: "#/components/schemas/CodeIntelligenceUsageDto"
19020
+
19021
+ WorkspaceKnowledgePageDto:
19022
+ type: object
19023
+ required:
19024
+ [
19025
+ id,
19026
+ workspaceId,
19027
+ slug,
19028
+ title,
19029
+ bodyMd,
19030
+ sortOrder,
19031
+ sourceRepoIds,
19032
+ status,
19033
+ createdAt,
19034
+ updatedAt,
19035
+ ]
19036
+ properties:
19037
+ id: { type: string, format: uuid }
19038
+ workspaceId: { type: string, format: uuid }
19039
+ slug: { type: string }
19040
+ title: { type: string }
19041
+ bodyMd: { type: string }
19042
+ sortOrder: { type: integer }
19043
+ sourceRepoIds:
19044
+ type: array
19045
+ items: { type: string, format: uuid }
19046
+ status:
19047
+ type: string
19048
+ enum: [draft, published, needs_review]
18536
19049
  createdAt: { type: string, format: date-time }
18537
19050
  updatedAt: { type: string, format: date-time }
19051
+ excerpt:
19052
+ type: string
19053
+ description: First readable prose sentence for list previews
19054
+ sourceRepoNames:
19055
+ type: array
19056
+ items: { type: string }
19057
+ description: Display names for sourceRepoIds when resolvable
19058
+
19059
+ WorkspaceKnowledgeSystemContextDto:
19060
+ type: object
19061
+ required: [indexes, platformToolIds, platformMissingToolIds]
19062
+ properties:
19063
+ indexes:
19064
+ type: array
19065
+ items:
19066
+ type: object
19067
+ required: [repoId, repoName, indexId, nodeCount, edgeCount]
19068
+ properties:
19069
+ repoId: { type: string, format: uuid }
19070
+ repoName: { type: string }
19071
+ indexId: { type: string, format: uuid }
19072
+ nodeCount: { type: integer }
19073
+ edgeCount: { type: integer }
19074
+ commitSha: { type: string, nullable: true }
19075
+ indexer: { type: string, nullable: true }
19076
+ knowledgeJobPhase: { type: string, nullable: true }
19077
+ knowledgeJobStatus: { type: string, nullable: true }
19078
+ platformToolIds:
19079
+ type: array
19080
+ items: { type: string }
19081
+ platformMissingToolIds:
19082
+ type: array
19083
+ items: { type: string }
19084
+ platformSnippet:
19085
+ type: string
19086
+ description: Bounded markdown summary of platform evidence for the system panel
19087
+
19088
+ WorkspaceKnowledgePageListDto:
19089
+ type: object
19090
+ required: [items]
19091
+ properties:
19092
+ items:
19093
+ type: array
19094
+ items: { $ref: "#/components/schemas/WorkspaceKnowledgePageDto" }
19095
+ systemContext:
19096
+ $ref: "#/components/schemas/WorkspaceKnowledgeSystemContextDto"
19097
+
19098
+ CodeIntelligenceUsageDto:
19099
+ type: object
19100
+ required: [operation, provider, inputTokens, outputTokens]
19101
+ properties:
19102
+ operation:
19103
+ type: string
19104
+ description: Ledger operation key (code_chat, prd_generate, workspace_kb, wiki_json_outline, wiki_enrich, …)
19105
+ provider: { type: string }
19106
+ model: { type: string, nullable: true }
19107
+ inputTokens: { type: integer, minimum: 0 }
19108
+ outputTokens: { type: integer, minimum: 0 }
19109
+ estimatedCostUsd: { type: number, nullable: true }
19110
+ estimated: { type: boolean }
19111
+
19112
+ CodeIntelligenceTokenUsageByOperationDto:
19113
+ type: object
19114
+ required: [operation, inputTokens, outputTokens, estimatedCostUsd, invocationCount]
19115
+ properties:
19116
+ operation: { type: string }
19117
+ inputTokens: { type: integer, minimum: 0 }
19118
+ outputTokens: { type: integer, minimum: 0 }
19119
+ estimatedCostUsd: { type: number }
19120
+ invocationCount: { type: integer, minimum: 0 }
19121
+
19122
+ CodeIntelligenceTokenUsageByRepoDto:
19123
+ type: object
19124
+ required:
19125
+ - repoId
19126
+ - inputTokens
19127
+ - outputTokens
19128
+ - estimatedCostUsd
19129
+ - invocationCount
19130
+ - byOperation
19131
+ properties:
19132
+ repoId: { type: string, format: uuid }
19133
+ repoName: { type: string, nullable: true }
19134
+ inputTokens: { type: integer, minimum: 0 }
19135
+ outputTokens: { type: integer, minimum: 0 }
19136
+ estimatedCostUsd: { type: number }
19137
+ invocationCount: { type: integer, minimum: 0 }
19138
+ byOperation:
19139
+ type: array
19140
+ items: { $ref: "#/components/schemas/CodeIntelligenceTokenUsageByOperationDto" }
19141
+
19142
+ CodeIntelligenceTokenUsageSummaryDto:
19143
+ type: object
19144
+ required:
19145
+ - days
19146
+ - inputTokensTotal
19147
+ - outputTokensTotal
19148
+ - estimatedCostUsdTotal
19149
+ - invocationCountTotal
19150
+ - byOperation
19151
+ - byRepo
19152
+ properties:
19153
+ days: { type: integer, minimum: 1, maximum: 90 }
19154
+ inputTokensTotal: { type: integer, minimum: 0 }
19155
+ outputTokensTotal: { type: integer, minimum: 0 }
19156
+ estimatedCostUsdTotal: { type: number }
19157
+ invocationCountTotal: { type: integer, minimum: 0 }
19158
+ costEstimated:
19159
+ type: boolean
19160
+ description: >-
19161
+ True when any cost was derived from published model rates because the provider
19162
+ reported tokens without a price (for example the Cursor agent CLI).
19163
+ costBasis:
19164
+ type: string
19165
+ nullable: true
19166
+ description: Rate basis used for the derived cost, for display in tooltips.
19167
+ byOperation:
19168
+ type: array
19169
+ items: { $ref: "#/components/schemas/CodeIntelligenceTokenUsageByOperationDto" }
19170
+ byRepo:
19171
+ type: array
19172
+ description: >-
19173
+ Per-repository split (wiki generation, conversations, outline). Only rows with
19174
+ repository attribution appear here; workspace-wide operations stay in totals.
19175
+ items: { $ref: "#/components/schemas/CodeIntelligenceTokenUsageByRepoDto" }
18538
19176
 
18539
19177
  CodeChatWikiPageListDto:
18540
19178
  type: object
@@ -18735,7 +19373,26 @@ components:
18735
19373
  properties:
18736
19374
  kind:
18737
19375
  type: string
18738
- enum: [auto, dependency, module, focus, impact, blast, atlas]
19376
+ enum:
19377
+ [
19378
+ auto,
19379
+ dependency,
19380
+ module,
19381
+ focus,
19382
+ impact,
19383
+ blast,
19384
+ atlas,
19385
+ call_graph,
19386
+ cfg_lite,
19387
+ dataflow,
19388
+ ssa,
19389
+ terraform_deps,
19390
+ layers,
19391
+ domain,
19392
+ runtime,
19393
+ communication,
19394
+ delivery,
19395
+ ]
18739
19396
  description: >-
18740
19397
  Omit or send `auto` to let the server pick the most informative view for the
18741
19398
  repository. `blast` traces `query` as a symbol and falls back to a focused
@@ -18774,7 +19431,24 @@ components:
18774
19431
  deterministic reading of hubs and areas from the graph.
18775
19432
  kind:
18776
19433
  type: string
18777
- enum: [dependency, module, focus, impact, blast]
19434
+ enum:
19435
+ [
19436
+ dependency,
19437
+ module,
19438
+ focus,
19439
+ impact,
19440
+ blast,
19441
+ call_graph,
19442
+ cfg_lite,
19443
+ dataflow,
19444
+ ssa,
19445
+ terraform_deps,
19446
+ layers,
19447
+ domain,
19448
+ runtime,
19449
+ communication,
19450
+ delivery,
19451
+ ]
18778
19452
  description: >-
18779
19453
  Which reading of the repository this diagram is. `module` rolls files up
18780
19454
  into source groups when too few file dependencies resolved for a file map,
@@ -18784,6 +19458,69 @@ components:
18784
19458
  type: array
18785
19459
  description: Measured facts about the graph — hubs, dependency coverage, test share, route count.
18786
19460
  items: { type: string }
19461
+ structurePanel:
19462
+ type: object
19463
+ description: >-
19464
+ Deterministic reading beside the canvas for layers, domains, dataflow, and SSA.
19465
+ Coverage, heatmaps, and ledgers are derived from the indexed graph — no LLM.
19466
+ required: [kind]
19467
+ properties:
19468
+ kind:
19469
+ type: string
19470
+ enum: [layers, domain, dataflow, ssa]
19471
+ coverage:
19472
+ type: object
19473
+ required:
19474
+ [totalFiles, connectedFiles, dependencyEdges, connectedShare, rollupEdges]
19475
+ properties:
19476
+ totalFiles: { type: integer }
19477
+ connectedFiles: { type: integer }
19478
+ dependencyEdges: { type: integer }
19479
+ connectedShare: { type: number }
19480
+ rollupEdges:
19481
+ type: integer
19482
+ description: Cross-bucket edges in this roll-up, or relation edges shown for dataflow/SSA.
19483
+ axes:
19484
+ type: array
19485
+ description: Ordered axis labels for the heatmap.
19486
+ items: { type: string }
19487
+ matrix:
19488
+ type: array
19489
+ items:
19490
+ type: object
19491
+ required: [from, to, weight]
19492
+ properties:
19493
+ from: { type: string }
19494
+ to: { type: string }
19495
+ weight: { type: integer }
19496
+ focusBuckets:
19497
+ type: array
19498
+ description: >-
19499
+ Layers or domains that own the selected node / query, so roll-up views
19500
+ still answer a selection instead of silently ignoring it.
19501
+ items: { type: string }
19502
+ violations:
19503
+ type: array
19504
+ description: Layer-stack edges that climb the usual API → Service → Data → UI order.
19505
+ items:
19506
+ type: object
19507
+ required: [from, to, weight, reason]
19508
+ properties:
19509
+ from: { type: string }
19510
+ to: { type: string }
19511
+ weight: { type: integer }
19512
+ reason: { type: string }
19513
+ ledger:
19514
+ type: array
19515
+ description: Top dataflow / SSA flows with relation and certainty.
19516
+ items:
19517
+ type: object
19518
+ required: [from, to]
19519
+ properties:
19520
+ from: { type: string }
19521
+ to: { type: string }
19522
+ relation: { type: string }
19523
+ certainty: { type: string }
18787
19524
  focus:
18788
19525
  type: object
18789
19526
  description: Present when free text drove the view.