@thinkai/tai-api-contract 2.109.0 → 2.111.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.109.0
4
+ version: 2.111.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
@@ -16569,7 +16828,8 @@ components:
16569
16828
  PreferencesDto:
16570
16829
  type: object
16571
16830
  additionalProperties: false
16572
- required: [theme, sidebarCollapsed, timezone, dataRefreshInterval, notifications]
16831
+ required:
16832
+ [theme, sidebarCollapsed, timezone, dataRefreshInterval, notifications, buddyEnabled]
16573
16833
  properties:
16574
16834
  theme:
16575
16835
  $ref: "#/components/schemas/ThemePreference"
@@ -16582,6 +16842,12 @@ components:
16582
16842
  $ref: "#/components/schemas/DataRefreshInterval"
16583
16843
  notifications:
16584
16844
  $ref: "#/components/schemas/NotificationPreferencesDto"
16845
+ buddyEnabled:
16846
+ type: boolean
16847
+ default: false
16848
+ description: >
16849
+ When true, show the ThinkAI Buddy mascot. Default and missing stored
16850
+ values are false (opt-in only).
16585
16851
 
16586
16852
  ValidationIssueDto:
16587
16853
  type: object
@@ -18293,6 +18559,13 @@ components:
18293
18559
  description: >
18294
18560
  Human-readable indexing stage while a job is running (queued, clone, graph,
18295
18561
  save, wiki). Cleared when the index is ready or failed.
18562
+ knowledgeJob:
18563
+ allOf:
18564
+ - $ref: "#/components/schemas/CodeKnowledgeJobDto"
18565
+ nullable: true
18566
+ description: >
18567
+ Active knowledge job for this repo when status is queued/running — phase, tracks,
18568
+ and token/cost rollups for SPA transparency (Wave 1).
18296
18569
  indexedAt: { type: string, format: date-time, nullable: true }
18297
18570
  createdAt: { type: string, format: date-time }
18298
18571
  updatedAt: { type: string, format: date-time }
@@ -18300,6 +18573,60 @@ components:
18300
18573
  type: boolean
18301
18574
  description: True when the indexed graph stores durable code excerpts (required for useful chat answers).
18302
18575
 
18576
+ CodeKnowledgeJobDto:
18577
+ type: object
18578
+ required:
18579
+ - id
18580
+ - workspaceId
18581
+ - repoId
18582
+ - status
18583
+ - inputTokensTotal
18584
+ - outputTokensTotal
18585
+ - estimatedCostUsdTotal
18586
+ - llmInvocationCount
18587
+ - createdAt
18588
+ - updatedAt
18589
+ properties:
18590
+ id: { type: string, format: uuid }
18591
+ workspaceId: { type: string, format: uuid }
18592
+ repoId: { type: string, format: uuid }
18593
+ indexId: { type: string, format: uuid, nullable: true }
18594
+ status:
18595
+ type: string
18596
+ enum: [queued, running, completed, failed]
18597
+ phase:
18598
+ type: string
18599
+ nullable: true
18600
+ enum: [cloning, indexing, track_a, track_b, completing]
18601
+ description: Coarse UX phase while status=running.
18602
+ phaseDetail:
18603
+ type: string
18604
+ nullable: true
18605
+ description: Human-readable detail (e.g. enriching · page 3/8 · how-it-works).
18606
+ phaseUpdatedAt: { type: string, format: date-time, nullable: true }
18607
+ trackAStatus:
18608
+ $ref: "#/components/schemas/CodeKnowledgeTrackStatus"
18609
+ trackBStatus:
18610
+ $ref: "#/components/schemas/CodeKnowledgeTrackStatus"
18611
+ graphStatus:
18612
+ $ref: "#/components/schemas/CodeKnowledgeTrackStatus"
18613
+ inputTokensTotal: { type: integer, minimum: 0 }
18614
+ outputTokensTotal: { type: integer, minimum: 0 }
18615
+ estimatedCostUsdTotal: { type: number, minimum: 0 }
18616
+ llmInvocationCount: { type: integer, minimum: 0 }
18617
+ lastProvider: { type: string, nullable: true }
18618
+ lastModel: { type: string, nullable: true }
18619
+ lastKeySource: { type: string, nullable: true }
18620
+ errorMessage: { type: string, nullable: true }
18621
+ createdAt: { type: string, format: date-time }
18622
+ updatedAt: { type: string, format: date-time }
18623
+
18624
+ CodeKnowledgeTrackStatus:
18625
+ type: string
18626
+ nullable: true
18627
+ enum: [pending, running, completed, skipped, failed]
18628
+ description: Per-track status for dual-track Deep Wiki (Track A skeleton, Track B enrich, graph index).
18629
+
18303
18630
  CodeChatIndexListDto:
18304
18631
  type: object
18305
18632
  required: [items]
@@ -18432,6 +18759,10 @@ components:
18432
18759
  required: [content]
18433
18760
  properties:
18434
18761
  content: { type: string, minLength: 1, maxLength: 8000 }
18762
+ persona:
18763
+ type: string
18764
+ enum: [engineer, lead, pm]
18765
+ description: Optional Ask tone preference (FE localStorage / request — not a DB role)
18435
18766
 
18436
18767
  CodeChatMessageReplyDto:
18437
18768
  allOf:
@@ -18456,6 +18787,25 @@ components:
18456
18787
  type: array
18457
18788
  items: { type: string }
18458
18789
  description: Repository names whose wiki pages grounded the answer
18790
+ groundedInPlatform:
18791
+ type: boolean
18792
+ description: True when platform evidence tools P–U contributed facts
18793
+ platformToolIds:
18794
+ type: array
18795
+ items: { type: string }
18796
+ description: Tool ids that returned data (e.g. readiness_summary)
18797
+ intent:
18798
+ type: string
18799
+ enum:
18800
+ - inventory_apis
18801
+ - inventory_modules
18802
+ - explain
18803
+ - platform_ops
18804
+ - feature_impact
18805
+ - prd_request
18806
+ description: Classified Ask intent for the turn
18807
+ usage:
18808
+ $ref: "#/components/schemas/CodeIntelligenceUsageDto"
18459
18809
 
18460
18810
  CodeChatApiRouteRowDto:
18461
18811
  type: object
@@ -18526,9 +18876,298 @@ components:
18526
18876
  type: array
18527
18877
  items: { type: string }
18528
18878
  diagramMermaid: { type: string, nullable: true }
18879
+ enrichmentStatus:
18880
+ type: string
18881
+ enum: [skeleton, enriched, shallow, needs_review]
18882
+ description: Deep Wiki page quality chip (D6 / D12).
18529
18883
  createdAt: { type: string, format: date-time }
18530
18884
  updatedAt: { type: string, format: date-time }
18531
18885
 
18886
+ EffectiveWikiConfigDto:
18887
+ type: object
18888
+ required: [sources, document]
18889
+ properties:
18890
+ sources:
18891
+ type: array
18892
+ description: >-
18893
+ Layers that contributed, in applied order. Later layers win:
18894
+ server_default → workspace_guidance → admin_repo → repo_override.
18895
+ items:
18896
+ type: string
18897
+ enum: [server_default, workspace_guidance, admin_repo, repo_override]
18898
+ repoOverridePath: { type: string, nullable: true }
18899
+ document:
18900
+ type: object
18901
+ additionalProperties: true
18902
+ description: Effective wiki.json document (version, pages, slugAllowlist, diagramPolicies).
18903
+
18904
+ RepoWikiJsonDto:
18905
+ type: object
18906
+ description: Admin-authored wiki.json override stored for a single repository.
18907
+ required: [repoId, repoName, providerSlug, document, hasOverride, updatedAt, updatedBy]
18908
+ properties:
18909
+ repoId: { type: string, format: uuid }
18910
+ repoName: { type: string }
18911
+ providerSlug: { type: string }
18912
+ document:
18913
+ type: object
18914
+ nullable: true
18915
+ additionalProperties: true
18916
+ description: Stored wiki.json document, or null when no override is set.
18917
+ hasOverride: { type: boolean }
18918
+ updatedAt: { type: string, format: date-time, nullable: true }
18919
+ updatedBy: { type: string, format: uuid, nullable: true }
18920
+
18921
+ PutRepoWikiJsonDto:
18922
+ type: object
18923
+ description: >-
18924
+ Wiki.json override to store. Send `document: null`, or a document with no usable
18925
+ pages, notes, allowlist, or diagram policies, to clear the override.
18926
+ properties:
18927
+ document:
18928
+ type: object
18929
+ nullable: true
18930
+ additionalProperties: true
18931
+
18932
+ RepoWikiJsonSummaryDto:
18933
+ type: object
18934
+ required: [repoId, repoName, providerSlug, hasOverride, updatedAt, updatedBy]
18935
+ properties:
18936
+ repoId: { type: string, format: uuid }
18937
+ repoName: { type: string }
18938
+ providerSlug: { type: string }
18939
+ hasOverride: { type: boolean }
18940
+ updatedAt: { type: string, format: date-time, nullable: true }
18941
+ updatedBy: { type: string, format: uuid, nullable: true }
18942
+
18943
+ RepoWikiJsonSummaryListDto:
18944
+ type: object
18945
+ required: [items]
18946
+ properties:
18947
+ items:
18948
+ type: array
18949
+ items: { $ref: "#/components/schemas/RepoWikiJsonSummaryDto" }
18950
+
18951
+ GenerateWorkspaceKnowledgePagesBodyDto:
18952
+ type: object
18953
+ properties:
18954
+ repoIds:
18955
+ type: array
18956
+ description: Ready repository indexes to synthesize from. Omit or send empty for all ready indexes.
18957
+ items: { type: string, format: uuid }
18958
+
18959
+ GenerateWorkspaceKnowledgePagesResultDto:
18960
+ type: object
18961
+ required: [items, mode, repoIds]
18962
+ properties:
18963
+ items:
18964
+ type: array
18965
+ items: { $ref: "#/components/schemas/WorkspaceKnowledgePageDto" }
18966
+ mode:
18967
+ type: string
18968
+ enum: [deterministic, llm]
18969
+ description: llm when a model produced page bodies; deterministic when synthesized from wiki text alone.
18970
+ repoIds:
18971
+ type: array
18972
+ items: { type: string, format: uuid }
18973
+ platformToolIds:
18974
+ type: array
18975
+ items: { type: string }
18976
+ description: Platform evidence tool ids that contributed facts (P–U)
18977
+ usage:
18978
+ $ref: "#/components/schemas/CodeIntelligenceUsageDto"
18979
+
18980
+ GeneratePrdDraftBodyDto:
18981
+ type: object
18982
+ required: [featureIntent]
18983
+ properties:
18984
+ featureIntent:
18985
+ type: string
18986
+ minLength: 1
18987
+ maxLength: 4000
18988
+ description: Feature or change the PRD should describe
18989
+ repoIds:
18990
+ type: array
18991
+ description: Ready repository indexes to analyze. Omit or send empty for all ready indexes.
18992
+ items: { type: string, format: uuid }
18993
+ persona:
18994
+ type: string
18995
+ enum: [engineer, lead, pm]
18996
+ description: Draft voice preference (FE localStorage / request)
18997
+
18998
+ GeneratePrdDraftResultDto:
18999
+ type: object
19000
+ required: [item, mode, repoIds, slug]
19001
+ properties:
19002
+ item: { $ref: "#/components/schemas/WorkspaceKnowledgePageDto" }
19003
+ mode:
19004
+ type: string
19005
+ enum: [deterministic, llm]
19006
+ repoIds:
19007
+ type: array
19008
+ items: { type: string, format: uuid }
19009
+ slug:
19010
+ type: string
19011
+ description: Persisted workspace knowledge page slug (prd-draft or prd-<safe-slug>)
19012
+ usage:
19013
+ $ref: "#/components/schemas/CodeIntelligenceUsageDto"
19014
+
19015
+ WorkspaceKnowledgePageDto:
19016
+ type: object
19017
+ required:
19018
+ [
19019
+ id,
19020
+ workspaceId,
19021
+ slug,
19022
+ title,
19023
+ bodyMd,
19024
+ sortOrder,
19025
+ sourceRepoIds,
19026
+ status,
19027
+ createdAt,
19028
+ updatedAt,
19029
+ ]
19030
+ properties:
19031
+ id: { type: string, format: uuid }
19032
+ workspaceId: { type: string, format: uuid }
19033
+ slug: { type: string }
19034
+ title: { type: string }
19035
+ bodyMd: { type: string }
19036
+ sortOrder: { type: integer }
19037
+ sourceRepoIds:
19038
+ type: array
19039
+ items: { type: string, format: uuid }
19040
+ status:
19041
+ type: string
19042
+ enum: [draft, published, needs_review]
19043
+ createdAt: { type: string, format: date-time }
19044
+ updatedAt: { type: string, format: date-time }
19045
+ excerpt:
19046
+ type: string
19047
+ description: First readable prose sentence for list previews
19048
+ sourceRepoNames:
19049
+ type: array
19050
+ items: { type: string }
19051
+ description: Display names for sourceRepoIds when resolvable
19052
+
19053
+ WorkspaceKnowledgeSystemContextDto:
19054
+ type: object
19055
+ required: [indexes, platformToolIds, platformMissingToolIds]
19056
+ properties:
19057
+ indexes:
19058
+ type: array
19059
+ items:
19060
+ type: object
19061
+ required: [repoId, repoName, indexId, nodeCount, edgeCount]
19062
+ properties:
19063
+ repoId: { type: string, format: uuid }
19064
+ repoName: { type: string }
19065
+ indexId: { type: string, format: uuid }
19066
+ nodeCount: { type: integer }
19067
+ edgeCount: { type: integer }
19068
+ commitSha: { type: string, nullable: true }
19069
+ indexer: { type: string, nullable: true }
19070
+ knowledgeJobPhase: { type: string, nullable: true }
19071
+ knowledgeJobStatus: { type: string, nullable: true }
19072
+ platformToolIds:
19073
+ type: array
19074
+ items: { type: string }
19075
+ platformMissingToolIds:
19076
+ type: array
19077
+ items: { type: string }
19078
+ platformSnippet:
19079
+ type: string
19080
+ description: Bounded markdown summary of platform evidence for the system panel
19081
+
19082
+ WorkspaceKnowledgePageListDto:
19083
+ type: object
19084
+ required: [items]
19085
+ properties:
19086
+ items:
19087
+ type: array
19088
+ items: { $ref: "#/components/schemas/WorkspaceKnowledgePageDto" }
19089
+ systemContext:
19090
+ $ref: "#/components/schemas/WorkspaceKnowledgeSystemContextDto"
19091
+
19092
+ CodeIntelligenceUsageDto:
19093
+ type: object
19094
+ required: [operation, provider, inputTokens, outputTokens]
19095
+ properties:
19096
+ operation:
19097
+ type: string
19098
+ description: Ledger operation key (code_chat, prd_generate, workspace_kb, wiki_json_outline, wiki_enrich, …)
19099
+ provider: { type: string }
19100
+ model: { type: string, nullable: true }
19101
+ inputTokens: { type: integer, minimum: 0 }
19102
+ outputTokens: { type: integer, minimum: 0 }
19103
+ estimatedCostUsd: { type: number, nullable: true }
19104
+ estimated: { type: boolean }
19105
+
19106
+ CodeIntelligenceTokenUsageByOperationDto:
19107
+ type: object
19108
+ required: [operation, inputTokens, outputTokens, estimatedCostUsd, invocationCount]
19109
+ properties:
19110
+ operation: { type: string }
19111
+ inputTokens: { type: integer, minimum: 0 }
19112
+ outputTokens: { type: integer, minimum: 0 }
19113
+ estimatedCostUsd: { type: number }
19114
+ invocationCount: { type: integer, minimum: 0 }
19115
+
19116
+ CodeIntelligenceTokenUsageByRepoDto:
19117
+ type: object
19118
+ required:
19119
+ - repoId
19120
+ - inputTokens
19121
+ - outputTokens
19122
+ - estimatedCostUsd
19123
+ - invocationCount
19124
+ - byOperation
19125
+ properties:
19126
+ repoId: { type: string, format: uuid }
19127
+ repoName: { type: string, nullable: true }
19128
+ inputTokens: { type: integer, minimum: 0 }
19129
+ outputTokens: { type: integer, minimum: 0 }
19130
+ estimatedCostUsd: { type: number }
19131
+ invocationCount: { type: integer, minimum: 0 }
19132
+ byOperation:
19133
+ type: array
19134
+ items: { $ref: "#/components/schemas/CodeIntelligenceTokenUsageByOperationDto" }
19135
+
19136
+ CodeIntelligenceTokenUsageSummaryDto:
19137
+ type: object
19138
+ required:
19139
+ - days
19140
+ - inputTokensTotal
19141
+ - outputTokensTotal
19142
+ - estimatedCostUsdTotal
19143
+ - invocationCountTotal
19144
+ - byOperation
19145
+ - byRepo
19146
+ properties:
19147
+ days: { type: integer, minimum: 1, maximum: 90 }
19148
+ inputTokensTotal: { type: integer, minimum: 0 }
19149
+ outputTokensTotal: { type: integer, minimum: 0 }
19150
+ estimatedCostUsdTotal: { type: number }
19151
+ invocationCountTotal: { type: integer, minimum: 0 }
19152
+ costEstimated:
19153
+ type: boolean
19154
+ description: >-
19155
+ True when any cost was derived from published model rates because the provider
19156
+ reported tokens without a price (for example the Cursor agent CLI).
19157
+ costBasis:
19158
+ type: string
19159
+ nullable: true
19160
+ description: Rate basis used for the derived cost, for display in tooltips.
19161
+ byOperation:
19162
+ type: array
19163
+ items: { $ref: "#/components/schemas/CodeIntelligenceTokenUsageByOperationDto" }
19164
+ byRepo:
19165
+ type: array
19166
+ description: >-
19167
+ Per-repository split (wiki generation, conversations, outline). Only rows with
19168
+ repository attribution appear here; workspace-wide operations stay in totals.
19169
+ items: { $ref: "#/components/schemas/CodeIntelligenceTokenUsageByRepoDto" }
19170
+
18532
19171
  CodeChatWikiPageListDto:
18533
19172
  type: object
18534
19173
  required: [items]
@@ -18728,7 +19367,26 @@ components:
18728
19367
  properties:
18729
19368
  kind:
18730
19369
  type: string
18731
- enum: [auto, dependency, module, focus, impact, blast, atlas]
19370
+ enum:
19371
+ [
19372
+ auto,
19373
+ dependency,
19374
+ module,
19375
+ focus,
19376
+ impact,
19377
+ blast,
19378
+ atlas,
19379
+ call_graph,
19380
+ cfg_lite,
19381
+ dataflow,
19382
+ ssa,
19383
+ terraform_deps,
19384
+ layers,
19385
+ domain,
19386
+ runtime,
19387
+ communication,
19388
+ delivery,
19389
+ ]
18732
19390
  description: >-
18733
19391
  Omit or send `auto` to let the server pick the most informative view for the
18734
19392
  repository. `blast` traces `query` as a symbol and falls back to a focused
@@ -18767,7 +19425,24 @@ components:
18767
19425
  deterministic reading of hubs and areas from the graph.
18768
19426
  kind:
18769
19427
  type: string
18770
- enum: [dependency, module, focus, impact, blast]
19428
+ enum:
19429
+ [
19430
+ dependency,
19431
+ module,
19432
+ focus,
19433
+ impact,
19434
+ blast,
19435
+ call_graph,
19436
+ cfg_lite,
19437
+ dataflow,
19438
+ ssa,
19439
+ terraform_deps,
19440
+ layers,
19441
+ domain,
19442
+ runtime,
19443
+ communication,
19444
+ delivery,
19445
+ ]
18771
19446
  description: >-
18772
19447
  Which reading of the repository this diagram is. `module` rolls files up
18773
19448
  into source groups when too few file dependencies resolved for a file map,
@@ -18777,6 +19452,69 @@ components:
18777
19452
  type: array
18778
19453
  description: Measured facts about the graph — hubs, dependency coverage, test share, route count.
18779
19454
  items: { type: string }
19455
+ structurePanel:
19456
+ type: object
19457
+ description: >-
19458
+ Deterministic reading beside the canvas for layers, domains, dataflow, and SSA.
19459
+ Coverage, heatmaps, and ledgers are derived from the indexed graph — no LLM.
19460
+ required: [kind]
19461
+ properties:
19462
+ kind:
19463
+ type: string
19464
+ enum: [layers, domain, dataflow, ssa]
19465
+ coverage:
19466
+ type: object
19467
+ required:
19468
+ [totalFiles, connectedFiles, dependencyEdges, connectedShare, rollupEdges]
19469
+ properties:
19470
+ totalFiles: { type: integer }
19471
+ connectedFiles: { type: integer }
19472
+ dependencyEdges: { type: integer }
19473
+ connectedShare: { type: number }
19474
+ rollupEdges:
19475
+ type: integer
19476
+ description: Cross-bucket edges in this roll-up, or relation edges shown for dataflow/SSA.
19477
+ axes:
19478
+ type: array
19479
+ description: Ordered axis labels for the heatmap.
19480
+ items: { type: string }
19481
+ matrix:
19482
+ type: array
19483
+ items:
19484
+ type: object
19485
+ required: [from, to, weight]
19486
+ properties:
19487
+ from: { type: string }
19488
+ to: { type: string }
19489
+ weight: { type: integer }
19490
+ focusBuckets:
19491
+ type: array
19492
+ description: >-
19493
+ Layers or domains that own the selected node / query, so roll-up views
19494
+ still answer a selection instead of silently ignoring it.
19495
+ items: { type: string }
19496
+ violations:
19497
+ type: array
19498
+ description: Layer-stack edges that climb the usual API → Service → Data → UI order.
19499
+ items:
19500
+ type: object
19501
+ required: [from, to, weight, reason]
19502
+ properties:
19503
+ from: { type: string }
19504
+ to: { type: string }
19505
+ weight: { type: integer }
19506
+ reason: { type: string }
19507
+ ledger:
19508
+ type: array
19509
+ description: Top dataflow / SSA flows with relation and certainty.
19510
+ items:
19511
+ type: object
19512
+ required: [from, to]
19513
+ properties:
19514
+ from: { type: string }
19515
+ to: { type: string }
19516
+ relation: { type: string }
19517
+ certainty: { type: string }
18780
19518
  focus:
18781
19519
  type: object
18782
19520
  description: Present when free text drove the view.