@thinkai/tai-api-contract 2.7.3 → 2.8.1

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.
@@ -194,7 +194,7 @@ export interface paths {
194
194
  * @description Replace the workspace's `sources` array. Cursor entries are validated strictly (`token` 1-256 chars, no whitespace, no `env:` prefix; optional deprecated `baseUrl` is accepted for backwards compatibility and ignored at runtime; verification and future refresh use the fixed Cursor Admin API host. Other types pass through with only a non-empty `type` requirement so existing jira / sonarqube / bitbucket callers are not regressed. **`type: github` is rejected** with HTTP 400 and `code: github_sources_deprecated`; use the GitHub App integration (`POST /workspaces/{workspaceId}/integrations/github/install-url` and callback) instead.
195
195
  * Every secret-keyed top-level string field (`token`, `password`, `api_key`, `secret`, `private_key`, `client_secret`) is encrypted at rest with AES-256-GCM under `SOURCES_TOKEN_ENC_KEY` before persistence; `env:`-prefixed values pass through unchanged. `GET /workspaces/{workspaceId}/config` continues to redact every secret-keyed field to `***` regardless of whether the stored value is encrypted, plaintext, or `env:` ref.
196
196
  * Requires editor or admin workspace role.
197
- * **Typical outcomes:** Valid typed sources → `200` with `{ ok: true, workspaceId }`. Missing required fields for a given `type` → `400` with `error` text. Unknown `type` strings (non-cursor, non-github) currently pass through to storage (lenient compatibility); only `cursor` entries get strict field validation. Cursor sources enforce strict token shape (no whitespace, no `env:` prefix).
197
+ * **Typical outcomes:** Valid typed sources → `200` with `{ ok: true, workspaceId }`. Missing required fields for a given `type` → `400` with `error` text. Unknown `type` strings (non-AI-tool, non-github) currently pass through to storage (lenient compatibility). Registered AI tools (`cursor`, `claude`) get strict field validation (no whitespace, no `env:` prefix on tokens).
198
198
  */
199
199
  put: operations["putTenantSources"];
200
200
  post?: never;
@@ -216,8 +216,8 @@ export interface paths {
216
216
  /**
217
217
  * Test one source connection (does not persist)
218
218
  * @description Verify a source's credentials without persisting them. Always returns 200 — upstream auth, rate-limit, and network failures surface as `{ success: false, error }` so the SPA can render an inline error.
219
- * Currently only `type: cursor` is verified end-to-end (Cursor Admin API, HTTP Basic against `https://api.cursor.com`; optional `baseUrl` in the body is deprecated and ignored). Other types report `{ success: false, error: "unsupported_type" }`. Documented `error` codes for cursor: `invalid_token`, `rate_limited`, `network_error`.
220
- * **Typical outcomes:** Malformed body, missing `type`, invalid `type`, or missing required fields for the declared type → `400` with `{ error: "..." }`. Well-formed body with bad credentials or unreachable service → `200` with `{ success: false, error: "..." }` (Cursor verifier and non-cursor paths as documented above).
219
+ * Registered AI tools are verified end-to-end: `cursor` (Cursor Admin API at `https://api.cursor.com`, HTTP Basic; optional `baseUrl` is deprecated and ignored) and `claude` (Anthropic Admin API at `https://api.anthropic.com`, `X-Api-Key` with an organization Admin API key `sk-ant-admin...`). Other types report `{ success: false, error: "unsupported_type" }`. Documented `error` codes for AI tool verifiers: `invalid_token`, `rate_limited`, `network_error`.
220
+ * **Typical outcomes:** Malformed body, missing `type`, invalid `type`, or missing required fields for the declared type → `400` with `{ error: "..." }`. Well-formed body with bad credentials or unreachable service → `200` with `{ success: false, error: "..." }`.
221
221
  */
222
222
  post: operations["postTenantSourceTest"];
223
223
  delete?: never;
@@ -914,6 +914,46 @@ export interface paths {
914
914
  patch?: never;
915
915
  trace?: never;
916
916
  };
917
+ "/workspaces/{workspaceId}/readiness/repos/{repoId}/runs": {
918
+ parameters: {
919
+ query?: never;
920
+ header?: never;
921
+ path?: never;
922
+ cookie?: never;
923
+ };
924
+ /**
925
+ * Paginated readiness run history for one repository
926
+ * @description Append-only scan history for charts on repo detail. Ordered by scan finish time (or `createdAt` when still in progress). Use `cursor` from the previous response for the next page. Failed and `partial_failed` runs are included with nullable `overallScore`.
927
+ */
928
+ get: operations["listReadinessRepoRuns"];
929
+ put?: never;
930
+ post?: never;
931
+ delete?: never;
932
+ options?: never;
933
+ head?: never;
934
+ patch?: never;
935
+ trace?: never;
936
+ };
937
+ "/workspaces/{workspaceId}/readiness/score-history": {
938
+ parameters: {
939
+ query?: never;
940
+ header?: never;
941
+ path?: never;
942
+ cookie?: never;
943
+ };
944
+ /**
945
+ * Workspace score time-series for all repositories
946
+ * @description Returns succeeded runs with stored `overallScore` per repo in one call (avoids N+1). Points are ordered ascending by `finishedAt` within each repo. Omit failed and `partial_failed` runs. Use `since` to bound the window; `limitPerRepo` caps points per repo (most recent first, then returned oldest-to-newest within the cap).
947
+ */
948
+ get: operations["getReadinessScoreHistory"];
949
+ put?: never;
950
+ post?: never;
951
+ delete?: never;
952
+ options?: never;
953
+ head?: never;
954
+ patch?: never;
955
+ trace?: never;
956
+ };
917
957
  "/workspaces/{workspaceId}/agentic-foundation/dashboard": {
918
958
  parameters: {
919
959
  query?: never;
@@ -1605,6 +1645,13 @@ export interface components {
1605
1645
  */
1606
1646
  baseUrl: string;
1607
1647
  };
1648
+ /** @description Claude (Anthropic) source entry for `PUT /workspaces/{workspaceId}/sources` and `POST /workspaces/{workspaceId}/sources/test`. The `token` field carries a literal Organization Admin API key on writes (`sk-ant-admin...`); reads from `GET /workspaces/{workspaceId}/config` redact it to `***`. Runtime calls use the Anthropic Admin API at `https://api.anthropic.com`. Provision keys in Claude Console → Organization settings (admin role required). */
1649
+ ClaudeSourceDto: {
1650
+ /** @enum {string} */
1651
+ type: "claude";
1652
+ /** @description Anthropic Organization Admin API key (literal, must start with sk-ant-admin). Standard API keys (sk-ant-api...) are rejected. Whitespace and `env:` prefix are rejected. */
1653
+ token: string;
1654
+ };
1608
1655
  WorkspaceConfigDto: {
1609
1656
  sources: components["schemas"]["TenantSourceEntryDto"][];
1610
1657
  orgChart?: components["schemas"]["ScoringOrgChartDto"] | null;
@@ -2374,6 +2421,46 @@ export interface components {
2374
2421
  criteriaSummary?: components["schemas"]["ReadinessCriteriaSummaryDto"] | null;
2375
2422
  issues: components["schemas"]["ReadinessIssueDto"][];
2376
2423
  };
2424
+ ReadinessRepoRunHistoryItemDto: {
2425
+ /** Format: uuid */
2426
+ runId: string;
2427
+ status: components["schemas"]["ReadinessRunStatusDto"];
2428
+ /** @description Present for succeeded runs after migration 050; null otherwise. */
2429
+ overallScore: number | null;
2430
+ /** Format: date-time */
2431
+ createdAt: string;
2432
+ /** Format: date-time */
2433
+ finishedAt: string | null;
2434
+ };
2435
+ ReadinessRepoRunListDto: {
2436
+ items: components["schemas"]["ReadinessRepoRunHistoryItemDto"][];
2437
+ limit: number;
2438
+ /** @description Pass as `cursor` query param to fetch the next page; null when no more rows. */
2439
+ nextCursor: string | null;
2440
+ };
2441
+ ReadinessScoreHistoryPointDto: {
2442
+ /** Format: date-time */
2443
+ finishedAt: string;
2444
+ overallScore: number;
2445
+ };
2446
+ ReadinessRepoScoreHistoryDto: {
2447
+ /** Format: uuid */
2448
+ repoId: string;
2449
+ repoName: string;
2450
+ /**
2451
+ * Format: date-time
2452
+ * @description When the repository was first materialized in the workspace (GitHub connect).
2453
+ */
2454
+ connectedAt: string;
2455
+ points: components["schemas"]["ReadinessScoreHistoryPointDto"][];
2456
+ };
2457
+ WorkspaceReadinessScoreHistoryDto: {
2458
+ /** Format: uuid */
2459
+ workspaceId: string;
2460
+ /** Format: date-time */
2461
+ generatedAt: string;
2462
+ repos: components["schemas"]["ReadinessRepoScoreHistoryDto"][];
2463
+ };
2377
2464
  RepoReadinessScoreDto: {
2378
2465
  /** Format: uuid */
2379
2466
  repoId: string;
@@ -2384,6 +2471,11 @@ export interface components {
2384
2471
  dimensions: components["schemas"]["DimensionScoreDto"][];
2385
2472
  /** Format: date-time */
2386
2473
  lastAnalyzed: string;
2474
+ /**
2475
+ * Format: date-time
2476
+ * @description First time this repository was materialized in the workspace (GitHub connect).
2477
+ */
2478
+ connectedAt: string;
2387
2479
  /** Format: uuid */
2388
2480
  teamId?: string | null;
2389
2481
  provider: components["schemas"]["RepoProviderDto"];
@@ -2839,6 +2931,7 @@ export type OrgChartImportResultDto = components['schemas']['OrgChartImportResul
2839
2931
  export type OrgChartSaveResultDto = components['schemas']['OrgChartSaveResultDto'];
2840
2932
  export type TenantSourceEntryDto = components['schemas']['TenantSourceEntryDto'];
2841
2933
  export type CursorSourceDto = components['schemas']['CursorSourceDto'];
2934
+ export type ClaudeSourceDto = components['schemas']['ClaudeSourceDto'];
2842
2935
  export type WorkspaceConfigDto = components['schemas']['WorkspaceConfigDto'];
2843
2936
  export type TestConnectionResponseDto = components['schemas']['TestConnectionResponseDto'];
2844
2937
  export type AiToolSeatDto = components['schemas']['AiToolSeatDto'];
@@ -2920,6 +3013,11 @@ export type ReadinessRunSummaryDto = components['schemas']['ReadinessRunSummaryD
2920
3013
  export type ReadinessCriteriaSummaryDto = components['schemas']['ReadinessCriteriaSummaryDto'];
2921
3014
  export type ReadinessIssueDto = components['schemas']['ReadinessIssueDto'];
2922
3015
  export type DimensionScoreDto = components['schemas']['DimensionScoreDto'];
3016
+ export type ReadinessRepoRunHistoryItemDto = components['schemas']['ReadinessRepoRunHistoryItemDto'];
3017
+ export type ReadinessRepoRunListDto = components['schemas']['ReadinessRepoRunListDto'];
3018
+ export type ReadinessScoreHistoryPointDto = components['schemas']['ReadinessScoreHistoryPointDto'];
3019
+ export type ReadinessRepoScoreHistoryDto = components['schemas']['ReadinessRepoScoreHistoryDto'];
3020
+ export type WorkspaceReadinessScoreHistoryDto = components['schemas']['WorkspaceReadinessScoreHistoryDto'];
2923
3021
  export type RepoReadinessScoreDto = components['schemas']['RepoReadinessScoreDto'];
2924
3022
  export type AgenticFoundationDashboardSummaryDto = components['schemas']['AgenticFoundationDashboardSummaryDto'];
2925
3023
  export type PageMetaDto = components['schemas']['PageMetaDto'];
@@ -3486,7 +3584,7 @@ export interface operations {
3486
3584
  requestBody: {
3487
3585
  content: {
3488
3586
  "application/json": {
3489
- sources: (components["schemas"]["CursorSourceDto"] | components["schemas"]["TenantSourceEntryDto"])[];
3587
+ sources: (components["schemas"]["CursorSourceDto"] | components["schemas"]["ClaudeSourceDto"] | components["schemas"]["TenantSourceEntryDto"])[];
3490
3588
  };
3491
3589
  };
3492
3590
  };
@@ -3540,7 +3638,7 @@ export interface operations {
3540
3638
  };
3541
3639
  requestBody: {
3542
3640
  content: {
3543
- "application/json": components["schemas"]["CursorSourceDto"] | components["schemas"]["TenantSourceEntryDto"];
3641
+ "application/json": components["schemas"]["CursorSourceDto"] | components["schemas"]["ClaudeSourceDto"] | components["schemas"]["TenantSourceEntryDto"];
3544
3642
  };
3545
3643
  };
3546
3644
  responses: {
@@ -4566,7 +4664,7 @@ export interface operations {
4566
4664
  header?: never;
4567
4665
  path: {
4568
4666
  workspaceId: components["parameters"]["WorkspaceId"];
4569
- provider: "cursor";
4667
+ provider: "cursor" | "claude";
4570
4668
  };
4571
4669
  cookie?: never;
4572
4670
  };
@@ -4621,7 +4719,7 @@ export interface operations {
4621
4719
  header?: never;
4622
4720
  path: {
4623
4721
  workspaceId: components["parameters"]["WorkspaceId"];
4624
- provider: "cursor";
4722
+ provider: "cursor" | "claude";
4625
4723
  };
4626
4724
  cookie?: never;
4627
4725
  };
@@ -4652,7 +4750,7 @@ export interface operations {
4652
4750
  header?: never;
4653
4751
  path: {
4654
4752
  workspaceId: components["parameters"]["WorkspaceId"];
4655
- provider: "cursor";
4753
+ provider: "cursor" | "claude";
4656
4754
  };
4657
4755
  cookie?: never;
4658
4756
  };
@@ -4681,7 +4779,7 @@ export interface operations {
4681
4779
  header?: never;
4682
4780
  path: {
4683
4781
  workspaceId: components["parameters"]["WorkspaceId"];
4684
- provider: "cursor";
4782
+ provider: "cursor" | "claude";
4685
4783
  };
4686
4784
  cookie?: never;
4687
4785
  };
@@ -4708,7 +4806,7 @@ export interface operations {
4708
4806
  header?: never;
4709
4807
  path: {
4710
4808
  workspaceId: components["parameters"]["WorkspaceId"];
4711
- provider: "cursor";
4809
+ provider: "cursor" | "claude";
4712
4810
  };
4713
4811
  cookie?: never;
4714
4812
  };
@@ -5297,6 +5395,100 @@ export interface operations {
5297
5395
  };
5298
5396
  };
5299
5397
  };
5398
+ listReadinessRepoRuns: {
5399
+ parameters: {
5400
+ query?: {
5401
+ limit?: number;
5402
+ order?: "asc" | "desc";
5403
+ /** @description Opaque cursor from a prior response `nextCursor` field. */
5404
+ cursor?: string;
5405
+ };
5406
+ header?: never;
5407
+ path: {
5408
+ workspaceId: components["parameters"]["WorkspaceId"];
5409
+ repoId: components["parameters"]["RepoId"];
5410
+ };
5411
+ cookie?: never;
5412
+ };
5413
+ requestBody?: never;
5414
+ responses: {
5415
+ /** @description Run history page */
5416
+ 200: {
5417
+ headers: {
5418
+ [name: string]: unknown;
5419
+ };
5420
+ content: {
5421
+ "application/json": components["schemas"]["ReadinessRepoRunListDto"];
5422
+ };
5423
+ };
5424
+ /** @description Invalid pagination query */
5425
+ 400: {
5426
+ headers: {
5427
+ [name: string]: unknown;
5428
+ };
5429
+ content: {
5430
+ "application/json": components["schemas"]["ErrorMessageDto"];
5431
+ };
5432
+ };
5433
+ 401: components["responses"]["Unauthorized"];
5434
+ 403: components["responses"]["Forbidden"];
5435
+ /** @description Workspace or repository not found */
5436
+ 404: {
5437
+ headers: {
5438
+ [name: string]: unknown;
5439
+ };
5440
+ content: {
5441
+ "application/json": components["schemas"]["ErrorMessageDto"];
5442
+ };
5443
+ };
5444
+ };
5445
+ };
5446
+ getReadinessScoreHistory: {
5447
+ parameters: {
5448
+ query?: {
5449
+ /** @description ISO-8601 lower bound on `finishedAt` (inclusive). */
5450
+ since?: string;
5451
+ limitPerRepo?: number;
5452
+ };
5453
+ header?: never;
5454
+ path: {
5455
+ workspaceId: components["parameters"]["WorkspaceId"];
5456
+ };
5457
+ cookie?: never;
5458
+ };
5459
+ requestBody?: never;
5460
+ responses: {
5461
+ /** @description Score history grouped by repository */
5462
+ 200: {
5463
+ headers: {
5464
+ [name: string]: unknown;
5465
+ };
5466
+ content: {
5467
+ "application/json": components["schemas"]["WorkspaceReadinessScoreHistoryDto"];
5468
+ };
5469
+ };
5470
+ /** @description Invalid query */
5471
+ 400: {
5472
+ headers: {
5473
+ [name: string]: unknown;
5474
+ };
5475
+ content: {
5476
+ "application/json": components["schemas"]["ErrorMessageDto"];
5477
+ };
5478
+ };
5479
+ 401: components["responses"]["Unauthorized"];
5480
+ 403: components["responses"]["Forbidden"];
5481
+ /** @description Workspace does not exist */
5482
+ 404: {
5483
+ headers: {
5484
+ [name: string]: unknown;
5485
+ };
5486
+ content: {
5487
+ "application/json": components["schemas"]["ErrorMessageDto"];
5488
+ };
5489
+ };
5490
+ };
5491
+ };
5300
5492
  getAgenticFoundationDashboard: {
5301
5493
  parameters: {
5302
5494
  query?: never;