@thinkai/tai-api-contract 2.24.0 → 2.26.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.
@@ -615,7 +615,7 @@ export interface paths {
615
615
  };
616
616
  /**
617
617
  * GitHub App installation status for workspace
618
- * @description Returns whether a GitHub App installation is linked and cached repo metadata. When no installation exists, returns 200 with `installed: false` (never 404 for missing install). Use `refresh=true` to bypass cache and re-list repositories from GitHub.
618
+ * @description Returns whether a GitHub App installation is linked and cached repo metadata. When no installation exists, returns 200 with `installed: false` (never 404 for missing install). Use `refresh=true` to bypass cache and re-list repositories from GitHub, and to run inline productivity ingest (`on_demand`) for the current UTC week when backfill phase is `complete`.
619
619
  */
620
620
  get: operations["getWorkspaceGithubInstallationStatus"];
621
621
  put?: never;
@@ -1465,6 +1465,26 @@ export interface paths {
1465
1465
  patch?: never;
1466
1466
  trace?: never;
1467
1467
  };
1468
+ "/workspaces/{workspaceId}/agent-execution-provider": {
1469
+ parameters: {
1470
+ query?: never;
1471
+ header?: never;
1472
+ path?: never;
1473
+ cookie?: never;
1474
+ };
1475
+ get?: never;
1476
+ /**
1477
+ * Select the agent execution account for this workspace
1478
+ * @description Sets the single active agent execution account (`thinkai_platform_cursor`, `cursor_user_api_key`, or `claude_api_key`) used by this workspace's readiness scanner and fix processor. Defaults to `cursor_user_api_key`. `thinkai_platform_cursor` is never the default and implies consent to platform-key billing. Requires workspace editor or admin role.
1479
+ */
1480
+ put: operations["putAgentExecutionProvider"];
1481
+ post?: never;
1482
+ delete?: never;
1483
+ options?: never;
1484
+ head?: never;
1485
+ patch?: never;
1486
+ trace?: never;
1487
+ };
1468
1488
  "/workspaces/{workspaceId}/readiness/cursor-key-usage": {
1469
1489
  parameters: {
1470
1490
  query?: never;
@@ -2001,20 +2021,53 @@ export interface components {
2001
2021
  /** @description Whether the execution key is stored. If false and `cursorPlatformKeyEnabled` is true in `WorkspaceConfigDto`, the platform key will be used for readiness runs (additional cost applies). */
2002
2022
  hasExecutionToken: boolean;
2003
2023
  };
2004
- /** @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). */
2024
+ /** @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...`); the optional `executionToken` carries a standard API key (`sk-ant-api...`) that powers the Claude Code agent (readiness scanner + fix processor). Reads from `GET /workspaces/{workspaceId}/config` redact secrets to `hasToken` / `hasExecutionToken` booleans. Provision keys in Claude Console. */
2005
2025
  ClaudeSourceDto: {
2006
2026
  /** @enum {string} */
2007
2027
  type: "claude";
2008
2028
  /** @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. */
2009
2029
  token: string;
2030
+ /** @description Claude Code execution key (literal standard Anthropic API key, sk-ant-api...). Used by the readiness scanner and fix processor when this workspace selects the `claude` agent. NOT the Admin API key. Omit to use the ThinkAI platform key (requires `claudePlatformKeyEnabled` on the workspace). Whitespace and `env:` prefix are rejected. */
2031
+ executionToken?: string;
2010
2032
  };
2033
+ /** @description Partial Claude source for `PUT /workspaces/{workspaceId}/sources` and `POST /workspaces/{workspaceId}/sources/test`. Admin API key (`token`) powers insights sync; execution key (`executionToken`) powers the Claude Code agent. At least one of `token` or `executionToken` must be present. */
2034
+ ClaudeSourcePatchDto: {
2035
+ /** @enum {string} */
2036
+ type: "claude";
2037
+ /** @description Anthropic Organization Admin API key (literal, must start with sk-ant-admin). Whitespace and `env:` prefix are rejected. */
2038
+ token?: string;
2039
+ /** @description Claude Code execution key (literal standard Anthropic API key, sk-ant-api...) — NOT the Admin API key. Whitespace and `env:` prefix are rejected. */
2040
+ executionToken?: string;
2041
+ };
2042
+ /** @description Redacted Claude source returned by `GET /workspaces/{workspaceId}/config`. `hasToken` and `hasExecutionToken` indicate which keys are stored. Raw values are never returned. */
2043
+ ClaudeSourceConfigDto: {
2044
+ /** @enum {string} */
2045
+ type: "claude";
2046
+ /** @description Whether the Admin API key (`token`) is stored for this workspace. */
2047
+ hasToken: boolean;
2048
+ /** @description Whether the Claude Code execution key is stored. If false and `claudePlatformKeyEnabled` is true in `WorkspaceConfigDto`, the platform key will be used for readiness runs (additional cost applies). */
2049
+ hasExecutionToken: boolean;
2050
+ };
2051
+ /**
2052
+ * @description The agent execution account used for Agentic Foundation runs (readiness scanner + fix queue). Exactly one is active per workspace.
2053
+ * - `thinkai_platform_cursor`: ThinkAI platform Cursor key (Cursor Agent CLI) — opt-in, never default.
2054
+ * - `cursor_user_api_key`: the workspace's own Cursor user API key (Cursor Agent CLI).
2055
+ * - `claude_api_key`: the workspace's own Anthropic API key (Claude Code CLI).
2056
+ * @enum {string}
2057
+ */
2058
+ AgentExecutionProviderDto: "thinkai_platform_cursor" | "cursor_user_api_key" | "claude_api_key";
2011
2059
  WorkspaceConfigDto: {
2012
- sources: (components["schemas"]["CursorSourceConfigDto"] | components["schemas"]["TenantSourceEntryDto"])[];
2060
+ sources: (components["schemas"]["CursorSourceConfigDto"] | components["schemas"]["ClaudeSourceConfigDto"] | components["schemas"]["TenantSourceEntryDto"])[];
2013
2061
  orgChart?: components["schemas"]["ScoringOrgChartDto"] | null;
2014
2062
  /** @enum {string|null} */
2015
2063
  region?: "us" | "eu" | "me" | null;
2016
- /** @description When true, readiness runs may use the ThinkAI platform Cursor key if this workspace has no `executionToken` configured. Additional cost applies. Requires explicit opt-in via `PUT /workspaces/{workspaceId}/cursor/platform-key-consent`. */
2064
+ /**
2065
+ * @deprecated
2066
+ * @description Deprecated: superseded by `agentExecutionProvider = thinkai_platform_cursor`. When true, readiness runs may use the ThinkAI platform Cursor key. Kept for one release; new clients should read/write `agentExecutionProvider`.
2067
+ */
2017
2068
  cursorPlatformKeyEnabled?: boolean;
2069
+ /** @description The single active agent execution account for this workspace's readiness scanner and fix processor. Defaults to `cursor_user_api_key`. Change via `PUT /workspaces/{workspaceId}/agent-execution-provider`. */
2070
+ agentExecutionProvider?: components["schemas"]["AgentExecutionProviderDto"];
2018
2071
  };
2019
2072
  TestConnectionResponseDto: {
2020
2073
  success: boolean;
@@ -2220,8 +2273,6 @@ export interface components {
2220
2273
  subtitle?: string;
2221
2274
  /** @description Average weekly merged PR count over the selected range. */
2222
2275
  periodAvgMergedPrs: number;
2223
- /** @description Percent change of the latest week vs the period average. */
2224
- deltaVsPeriodAvgPercent: number;
2225
2276
  /** @description Average change failure rate over the range when available. */
2226
2277
  avgFailRatePercent?: number;
2227
2278
  };
@@ -2334,8 +2385,6 @@ export interface components {
2334
2385
  subtitle?: string;
2335
2386
  /** @description Mean weekly merged PR count across the selected range. */
2336
2387
  periodAvgMergedPrs: number;
2337
- /** @description Percent change of the latest week vs the period mean. */
2338
- deltaVsPeriodAvgPercent: number;
2339
2388
  /** @description Mean weekly change-failure rate when available. */
2340
2389
  avgFailRatePercent?: number;
2341
2390
  };
@@ -2675,6 +2724,18 @@ export interface components {
2675
2724
  manageUrl?: string | null;
2676
2725
  /** Format: date-time */
2677
2726
  lastSyncedAt?: string | null;
2727
+ /**
2728
+ * @description Staged productivity backfill phase for GitHub metrics ingest.
2729
+ * @enum {string|null}
2730
+ */
2731
+ productivityBackfillPhase?: "recent" | "historical" | "complete" | null;
2732
+ /**
2733
+ * Format: date-time
2734
+ * @description Last successful productivity ingest for this workspace.
2735
+ */
2736
+ productivityLastIngestAt?: string | null;
2737
+ /** @description True while another session holds the workspace productivity ingest advisory lock. */
2738
+ productivityRefreshInProgress?: boolean;
2678
2739
  };
2679
2740
  GithubInstallUrlRequestDto: {
2680
2741
  returnPath?: string;
@@ -3508,7 +3569,7 @@ export interface components {
3508
3569
  * @description Type of workspace lifecycle event.
3509
3570
  * @enum {string}
3510
3571
  */
3511
- ActivityLogEventTypeDto: "repo.added" | "repo.removed" | "repo.readded" | "integration.github.added" | "integration.github.updated" | "integration.github.removed" | "integration.github.permissions_changed" | "integration.github.repo_added" | "integration.github.repo_removed" | "fix.requested" | "fix.generating" | "fix.pr_created" | "fix.merged" | "fix.failed" | "readiness.scan_started" | "readiness.scan_completed" | "readiness.scan_failed" | "readiness.scan_partial" | "config.cursor.added" | "config.cursor.updated" | "config.cursor.removed" | "config.cursor.platform_key_enabled" | "config.cursor.platform_key_disabled" | "config.claude.added" | "config.claude.updated" | "config.claude.removed" | "member.invited" | "member.role_changed" | "member.removed";
3572
+ ActivityLogEventTypeDto: "repo.added" | "repo.removed" | "repo.readded" | "integration.github.added" | "integration.github.updated" | "integration.github.removed" | "integration.github.permissions_changed" | "integration.github.repo_added" | "integration.github.repo_removed" | "fix.requested" | "fix.generating" | "fix.pr_created" | "fix.merged" | "fix.failed" | "readiness.scan_started" | "readiness.scan_completed" | "readiness.scan_failed" | "readiness.scan_partial" | "config.cursor.added" | "config.cursor.updated" | "config.cursor.removed" | "config.cursor.platform_key_enabled" | "config.cursor.platform_key_disabled" | "config.claude.added" | "config.claude.updated" | "config.claude.removed" | "config.agent_execution.provider_changed" | "member.invited" | "member.role_changed" | "member.removed";
3512
3573
  ActivityLogActorDto: {
3513
3574
  /** Format: uuid */
3514
3575
  userId: string;
@@ -3805,6 +3866,9 @@ export type CursorSourceDto = components['schemas']['CursorSourceDto'];
3805
3866
  export type CursorSourcePatchDto = components['schemas']['CursorSourcePatchDto'];
3806
3867
  export type CursorSourceConfigDto = components['schemas']['CursorSourceConfigDto'];
3807
3868
  export type ClaudeSourceDto = components['schemas']['ClaudeSourceDto'];
3869
+ export type ClaudeSourcePatchDto = components['schemas']['ClaudeSourcePatchDto'];
3870
+ export type ClaudeSourceConfigDto = components['schemas']['ClaudeSourceConfigDto'];
3871
+ export type AgentExecutionProviderDto = components['schemas']['AgentExecutionProviderDto'];
3808
3872
  export type WorkspaceConfigDto = components['schemas']['WorkspaceConfigDto'];
3809
3873
  export type TestConnectionResponseDto = components['schemas']['TestConnectionResponseDto'];
3810
3874
  export type CursorKeyUsageDto = components['schemas']['CursorKeyUsageDto'];
@@ -4615,7 +4679,7 @@ export interface operations {
4615
4679
  requestBody: {
4616
4680
  content: {
4617
4681
  "application/json": {
4618
- sources: (components["schemas"]["CursorSourcePatchDto"] | components["schemas"]["CursorSourceDto"] | components["schemas"]["ClaudeSourceDto"] | components["schemas"]["TenantSourceEntryDto"])[];
4682
+ sources: (components["schemas"]["CursorSourcePatchDto"] | components["schemas"]["CursorSourceDto"] | components["schemas"]["ClaudeSourcePatchDto"] | components["schemas"]["ClaudeSourceDto"] | components["schemas"]["TenantSourceEntryDto"])[];
4619
4683
  };
4620
4684
  };
4621
4685
  };
@@ -4669,7 +4733,7 @@ export interface operations {
4669
4733
  };
4670
4734
  requestBody: {
4671
4735
  content: {
4672
- "application/json": components["schemas"]["CursorSourcePatchDto"] | components["schemas"]["CursorSourceDto"] | components["schemas"]["ClaudeSourceDto"] | components["schemas"]["TenantSourceEntryDto"];
4736
+ "application/json": components["schemas"]["CursorSourcePatchDto"] | components["schemas"]["CursorSourceDto"] | components["schemas"]["ClaudeSourcePatchDto"] | components["schemas"]["ClaudeSourceDto"] | components["schemas"]["TenantSourceEntryDto"];
4673
4737
  };
4674
4738
  };
4675
4739
  responses: {
@@ -5625,7 +5689,7 @@ export interface operations {
5625
5689
  getWorkspaceGithubInstallationStatus: {
5626
5690
  parameters: {
5627
5691
  query?: {
5628
- /** @description When true, bypass `tai_workspace_vcs_repos_cache` and re-fetch from GitHub. */
5692
+ /** @description When true, bypass `tai_workspace_vcs_repos_cache` and re-fetch from GitHub. When productivity backfill phase is `complete`, also triggers inline `on_demand` ingest for the current UTC week (gap-fill only when metrics are missing). Response includes `productivityRefreshInProgress` while the workspace advisory lock is held. */
5629
5693
  refresh?: boolean;
5630
5694
  /** @description When true, re-fetch GitHub App and installation permission metadata (used by the login permission gate after the user approves on GitHub). */
5631
5695
  permissionsRefresh?: boolean;
@@ -7786,6 +7850,47 @@ export interface operations {
7786
7850
  403: components["responses"]["Forbidden"];
7787
7851
  };
7788
7852
  };
7853
+ putAgentExecutionProvider: {
7854
+ parameters: {
7855
+ query?: never;
7856
+ header?: never;
7857
+ path: {
7858
+ workspaceId: components["parameters"]["WorkspaceId"];
7859
+ };
7860
+ cookie?: never;
7861
+ };
7862
+ requestBody: {
7863
+ content: {
7864
+ "application/json": {
7865
+ provider: components["schemas"]["AgentExecutionProviderDto"];
7866
+ };
7867
+ };
7868
+ };
7869
+ responses: {
7870
+ /** @description Provider updated */
7871
+ 200: {
7872
+ headers: {
7873
+ [name: string]: unknown;
7874
+ };
7875
+ content: {
7876
+ "application/json": {
7877
+ ok: boolean;
7878
+ };
7879
+ };
7880
+ };
7881
+ /** @description Invalid request body */
7882
+ 400: {
7883
+ headers: {
7884
+ [name: string]: unknown;
7885
+ };
7886
+ content: {
7887
+ "application/json": components["schemas"]["ErrorMessageDto"];
7888
+ };
7889
+ };
7890
+ 401: components["responses"]["Unauthorized"];
7891
+ 403: components["responses"]["Forbidden"];
7892
+ };
7893
+ };
7789
7894
  getCursorKeyUsage: {
7790
7895
  parameters: {
7791
7896
  query?: never;