@thinkai/tai-api-contract 2.98.0 → 2.100.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.
@@ -1315,7 +1315,11 @@ export interface paths {
1315
1315
  */
1316
1316
  get: operations["getCodeInsightsRepoDetail"];
1317
1317
  put?: never;
1318
- post?: never;
1318
+ /**
1319
+ * Code Insights — enqueue Design risks analysis
1320
+ * @description Enqueues an on-demand Design risks run (`run_kind=code_insights_design`) for the repository. Reuses the readiness worker queue but never grades the readiness rubric. Editor/admin only. Returns `409` when a design run is already queued or running for the same provider slug (independent of readiness runs).
1321
+ */
1322
+ post: operations["postCodeInsightsDesignAnalyze"];
1319
1323
  delete?: never;
1320
1324
  options?: never;
1321
1325
  head?: never;
@@ -7128,7 +7132,7 @@ export interface components {
7128
7132
  * @description Type of workspace lifecycle event.
7129
7133
  * @enum {string}
7130
7134
  */
7131
- 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" | "integrations.agent_execution.provider_changed" | "integrations.repo_eligibility.overrides_changed" | "integrations.repo_eligibility.languages_refresh_requested" | "integrations.cursor.platform_key_enabled" | "integrations.cursor.platform_key_disabled" | "member.invited" | "member.invite_accepted" | "member.invite_rejected" | "member.role_changed" | "member.removed" | "hris.personio.sync_started" | "hris.personio.sync_completed" | "hris.personio.sync_failed" | "hris.zenhr.sync_started" | "hris.zenhr.sync_completed" | "hris.zenhr.sync_failed" | "hris.zelt.sync_started" | "hris.zelt.sync_completed" | "hris.zelt.sync_failed" | "hris.sync_started" | "hris.sync_completed" | "hris.sync_failed" | "repo.sync_skipped" | "integrations.cursor.execution_key.added" | "integrations.cursor.execution_key.updated" | "integrations.cursor.execution_key.removed" | "integrations.cursor.execution_key.check_failed" | "integrations.cursor.admin_key.added" | "integrations.cursor.admin_key.updated" | "integrations.cursor.admin_key.removed" | "integrations.claude.execution_key.added" | "integrations.claude.execution_key.updated" | "integrations.claude.execution_key.removed" | "integrations.claude.execution_key.check_failed" | "integrations.claude.admin_key.added" | "integrations.claude.admin_key.updated" | "integrations.claude.admin_key.removed" | "integrations.claude.analytics_key.added" | "integrations.claude.analytics_key.updated" | "integrations.claude.analytics_key.removed" | "integrations.code_intelligence.settings_changed" | "integrations.code_intelligence.execution_key.added" | "integrations.code_intelligence.execution_key.updated" | "integrations.code_intelligence.execution_key.removed" | "integrations.code_intelligence.execution_key.check_failed" | "readiness.scan_precheck_failed" | "productivity.ingest.completed" | "productivity.ingest.failed" | "productivity.ingest.skipped" | "productivity.ingest.repo_skipped" | "productivity.ingest.coverage_gap_detected" | "integrations.newrelic.added" | "integrations.newrelic.removed" | "integrations.newrelic.sync_completed" | "integrations.newrelic.sync_failed" | "integrations.prometheus.added" | "integrations.prometheus.removed" | "integrations.prometheus.sync_completed" | "integrations.prometheus.sync_failed" | "integrations.grafana.added" | "integrations.grafana.removed" | "integrations.grafana.sync_completed" | "integrations.grafana.sync_failed" | "integrations.zelt.added" | "integrations.zelt.removed";
7135
+ 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" | "code_insights.design_run_started" | "integrations.agent_execution.provider_changed" | "integrations.repo_eligibility.overrides_changed" | "integrations.repo_eligibility.languages_refresh_requested" | "integrations.cursor.platform_key_enabled" | "integrations.cursor.platform_key_disabled" | "member.invited" | "member.invite_accepted" | "member.invite_rejected" | "member.role_changed" | "member.removed" | "hris.personio.sync_started" | "hris.personio.sync_completed" | "hris.personio.sync_failed" | "hris.zenhr.sync_started" | "hris.zenhr.sync_completed" | "hris.zenhr.sync_failed" | "hris.zelt.sync_started" | "hris.zelt.sync_completed" | "hris.zelt.sync_failed" | "hris.sync_started" | "hris.sync_completed" | "hris.sync_failed" | "repo.sync_skipped" | "integrations.cursor.execution_key.added" | "integrations.cursor.execution_key.updated" | "integrations.cursor.execution_key.removed" | "integrations.cursor.execution_key.check_failed" | "integrations.cursor.admin_key.added" | "integrations.cursor.admin_key.updated" | "integrations.cursor.admin_key.removed" | "integrations.claude.execution_key.added" | "integrations.claude.execution_key.updated" | "integrations.claude.execution_key.removed" | "integrations.claude.execution_key.check_failed" | "integrations.claude.admin_key.added" | "integrations.claude.admin_key.updated" | "integrations.claude.admin_key.removed" | "integrations.claude.analytics_key.added" | "integrations.claude.analytics_key.updated" | "integrations.claude.analytics_key.removed" | "integrations.code_intelligence.settings_changed" | "integrations.code_intelligence.execution_key.added" | "integrations.code_intelligence.execution_key.updated" | "integrations.code_intelligence.execution_key.removed" | "integrations.code_intelligence.execution_key.check_failed" | "readiness.scan_precheck_failed" | "productivity.ingest.completed" | "productivity.ingest.failed" | "productivity.ingest.skipped" | "productivity.ingest.repo_skipped" | "productivity.ingest.coverage_gap_detected" | "integrations.newrelic.added" | "integrations.newrelic.removed" | "integrations.newrelic.sync_completed" | "integrations.newrelic.sync_failed" | "integrations.prometheus.added" | "integrations.prometheus.removed" | "integrations.prometheus.sync_completed" | "integrations.prometheus.sync_failed" | "integrations.grafana.added" | "integrations.grafana.removed" | "integrations.grafana.sync_completed" | "integrations.grafana.sync_failed" | "integrations.zelt.added" | "integrations.zelt.removed";
7132
7136
  ActivityLogActorDto: {
7133
7137
  /** Format: uuid */
7134
7138
  userId: string;
@@ -8082,10 +8086,10 @@ export interface components {
8082
8086
  /** @enum {string} */
8083
8087
  CodeInsightsFindingSeverity: "critical" | "high" | "medium" | "low";
8084
8088
  /**
8085
- * @description Deterministic categories (`duplication`, `complexity`, `proliferation`, `coverage`) plus LLM semantic detectors (`anemic_domain`, `context_leak`, `tx_boundary`, `error_handling`, `config_cohesion`, `resilience_patterns`).
8089
+ * @description Deterministic categories (`duplication`, `complexity`, `proliferation`, `coverage`, `circular_deps`, `fan_in_hotspot`) plus LLM semantic detectors (`anemic_domain`, `context_leak`, `tx_boundary`, `error_handling`, `config_cohesion`, `resilience_patterns`). Coupling categories are written only by Design risks runs (`source=deterministic` on the design run id).
8086
8090
  * @enum {string}
8087
8091
  */
8088
- CodeInsightsFindingCategory: "duplication" | "complexity" | "proliferation" | "coverage" | "anemic_domain" | "context_leak" | "tx_boundary" | "error_handling" | "config_cohesion" | "resilience_patterns";
8092
+ CodeInsightsFindingCategory: "duplication" | "complexity" | "proliferation" | "coverage" | "anemic_domain" | "context_leak" | "tx_boundary" | "error_handling" | "config_cohesion" | "resilience_patterns" | "circular_deps" | "fan_in_hotspot";
8089
8093
  /**
8090
8094
  * @description `deterministic` = measured Code Insights rules; `llm` = AI-detected semantic findings (separate agent pass; never blended in scoring).
8091
8095
  * @enum {string}
@@ -8204,8 +8208,27 @@ export interface components {
8204
8208
  /** @description Null when the repo is pending its first metrics scan. */
8205
8209
  metrics: components["schemas"]["CodeInsightsMetricsDto"] | null;
8206
8210
  hotspots: components["schemas"]["CodeInsightsHotspotDto"][];
8207
- /** @description Findings from the latest scan only (history is retention-bounded). */
8211
+ /** @description Deterministic findings from the latest metrics scan plus LLM findings from the latest **succeeded** Design risks run only. Stale LLM rows from older design runs are not returned. */
8208
8212
  findings: components["schemas"]["CodeInsightsFindingDto"][];
8213
+ /** @description Latest Design risks run of any status (for UI polling). Null when Design risks has never been enqueued for this repo. */
8214
+ designAnalysis: components["schemas"]["CodeInsightsDesignAnalysisDto"] | null;
8215
+ };
8216
+ CodeInsightsDesignAnalysisDto: {
8217
+ /** Format: uuid */
8218
+ runId: string;
8219
+ /** @enum {string} */
8220
+ status: "queued" | "running" | "succeeded" | "failed" | "partial_failed";
8221
+ /** Format: date-time */
8222
+ finishedAt: string | null;
8223
+ errorCode: string | null;
8224
+ errorDetail: string | null;
8225
+ };
8226
+ CodeInsightsDesignAnalyzeResponseDto: {
8227
+ /**
8228
+ * Format: uuid
8229
+ * @description Enqueued Design risks run id (`tai_workspace_readiness_runs.id`).
8230
+ */
8231
+ runId: string;
8209
8232
  };
8210
8233
  CodeInsightsOrgHotspotDto: components["schemas"]["CodeInsightsHotspotDto"] & {
8211
8234
  /** Format: uuid */
@@ -8766,6 +8789,8 @@ export type CodeInsightsFindingsBySeverityDto = components['schemas']['CodeInsig
8766
8789
  export type CodeInsightsRepoListItemDto = components['schemas']['CodeInsightsRepoListItemDto'];
8767
8790
  export type CodeInsightsRepoListDto = components['schemas']['CodeInsightsRepoListDto'];
8768
8791
  export type CodeInsightsRepoDetailDto = components['schemas']['CodeInsightsRepoDetailDto'];
8792
+ export type CodeInsightsDesignAnalysisDto = components['schemas']['CodeInsightsDesignAnalysisDto'];
8793
+ export type CodeInsightsDesignAnalyzeResponseDto = components['schemas']['CodeInsightsDesignAnalyzeResponseDto'];
8769
8794
  export type CodeInsightsOrgHotspotDto = components['schemas']['CodeInsightsOrgHotspotDto'];
8770
8795
  export type CodeInsightsSonarDto = components['schemas']['CodeInsightsSonarDto'];
8771
8796
  export type CodeInsightsSummaryDto = components['schemas']['CodeInsightsSummaryDto'];
@@ -12412,6 +12437,59 @@ export interface operations {
12412
12437
  };
12413
12438
  };
12414
12439
  };
12440
+ postCodeInsightsDesignAnalyze: {
12441
+ parameters: {
12442
+ query?: never;
12443
+ header?: never;
12444
+ path: {
12445
+ workspaceId: components["parameters"]["WorkspaceId"];
12446
+ /** @description Internal repo UUID (`tai_workspace_repos.id`). */
12447
+ repoId: string;
12448
+ };
12449
+ cookie?: never;
12450
+ };
12451
+ requestBody?: never;
12452
+ responses: {
12453
+ /** @description Design risks analysis enqueued */
12454
+ 202: {
12455
+ headers: {
12456
+ [name: string]: unknown;
12457
+ };
12458
+ content: {
12459
+ "application/json": components["schemas"]["CodeInsightsDesignAnalyzeResponseDto"];
12460
+ };
12461
+ };
12462
+ /** @description Malformed repoId, unsupported provider, or GitHub not connected */
12463
+ 400: {
12464
+ headers: {
12465
+ [name: string]: unknown;
12466
+ };
12467
+ content: {
12468
+ "application/json": components["schemas"]["ErrorMessageDto"];
12469
+ };
12470
+ };
12471
+ 401: components["responses"]["Unauthorized"];
12472
+ 403: components["responses"]["Forbidden"];
12473
+ /** @description Workspace or repo does not exist */
12474
+ 404: {
12475
+ headers: {
12476
+ [name: string]: unknown;
12477
+ };
12478
+ content: {
12479
+ "application/json": components["schemas"]["ErrorMessageDto"];
12480
+ };
12481
+ };
12482
+ /** @description An active Design risks run already exists for this repo slug */
12483
+ 409: {
12484
+ headers: {
12485
+ [name: string]: unknown;
12486
+ };
12487
+ content: {
12488
+ "application/json": components["schemas"]["ErrorMessageDto"];
12489
+ };
12490
+ };
12491
+ };
12492
+ };
12415
12493
  getAiToolMembers: {
12416
12494
  parameters: {
12417
12495
  query?: {
package/src/index.ts CHANGED
@@ -31,7 +31,7 @@ export interface ScoreDto {
31
31
  createdAt?: string;
32
32
  tenantId?: string;
33
33
  personId?: string;
34
- /** Optional fingerprint of sources config used when this score was computed. */
34
+ /** Optional fingerprint of sources config used when this score was computed. */
35
35
  sourcesVersion?: string;
36
36
  metrics: Record<string, number>;
37
37
  dimensionScores: Record<string, number>;
@@ -892,11 +892,7 @@ export type AiAssistedCodeDataQuality = "estimated" | "measured";
892
892
 
893
893
  /** How AI-assisted code % was derived when not measured from productivity ingest. */
894
894
  export type AiAssistedCodeEstimationSource =
895
- | "ingest"
896
- | "token_volume"
897
- | "spend_proxy"
898
- | "adoption"
899
- | "unavailable";
895
+ "ingest" | "token_volume" | "spend_proxy" | "adoption" | "unavailable";
900
896
 
901
897
  /** One weekly bucket in the AI-assisted code percentage series. */
902
898
  export interface AiUsageSpendAiAssistedCodeWeekDto {
@@ -36,7 +36,10 @@ if (droppedUnknown.unknown?.length !== 1 || droppedUnknown.unknown[0] !== "/stal
36
36
  }
37
37
 
38
38
  const rejectUnknown = parseJourneyStepInputs(["/stale/route"], { rejectUnknown: true });
39
- if (rejectUnknown.error !== "Unknown journey step" || rejectUnknown.unknown?.[0] !== "/stale/route") {
39
+ if (
40
+ rejectUnknown.error !== "Unknown journey step" ||
41
+ rejectUnknown.unknown?.[0] !== "/stale/route"
42
+ ) {
40
43
  throw new Error(`rejectUnknown failed: ${JSON.stringify(rejectUnknown)}`);
41
44
  }
42
45