@thinkai/tai-api-contract 2.97.0 → 2.99.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;
@@ -4642,13 +4646,17 @@ export interface components {
4642
4646
  failures: string[];
4643
4647
  /** @description Failed GitHub Actions workflow runs for this UTC day when CI ingest is enabled. */
4644
4648
  failureItems?: components["schemas"]["ProductivityInsightsContributorFailureItemDto"][];
4645
- /** @description Optional PR rows with GitHub links when ingest stored URLs. */
4649
+ /** @description Optional merged PR rows for day drilldown (label, optional GitHub URL, optional ship-weight score / pending flag). Includes label-only rows so unscored or URL-less merges still surface ship-weight state. */
4646
4650
  mergedPrItems?: components["schemas"]["ProductivityInsightsContributorMergedPrItemDto"][];
4647
4651
  };
4648
4652
  ProductivityInsightsContributorMergedPrItemDto: {
4649
4653
  label: string;
4650
4654
  /** Format: uri */
4651
4655
  url?: string;
4656
+ /** @description v13 ship-weight score for this PR when scored (typically 0–10). */
4657
+ shipWeight?: number;
4658
+ /** @description True when this GitHub PR is still awaiting ship-weight scoring. */
4659
+ shipWeightPending?: boolean;
4652
4660
  };
4653
4661
  ProductivityInsightsContributorFailureItemDto: {
4654
4662
  label: string;
@@ -7124,7 +7132,7 @@ export interface components {
7124
7132
  * @description Type of workspace lifecycle event.
7125
7133
  * @enum {string}
7126
7134
  */
7127
- 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";
7128
7136
  ActivityLogActorDto: {
7129
7137
  /** Format: uuid */
7130
7138
  userId: string;
@@ -7527,6 +7535,8 @@ export interface components {
7527
7535
  /** Format: date */
7528
7536
  weekStartIso: string;
7529
7537
  mergedPrs: number;
7538
+ /** @description Sum of ship-weight scores for merged PRs in this week bucket. */
7539
+ shipWeightSum?: number;
7530
7540
  ciFailRatePct: number;
7531
7541
  /** @description False when CI metrics were not available for this week bucket. */
7532
7542
  hasCiMetrics?: boolean;
@@ -7535,6 +7545,8 @@ export interface components {
7535
7545
  weeks: components["schemas"]["InsightsVelocityQualityWeek"][];
7536
7546
  targetFailRatePct: number;
7537
7547
  volumeGrowthPct: number;
7548
+ /** @description Ship-weight volume growth vs the prior equal-length window. */
7549
+ shipWeightVolumeGrowthPct?: number;
7538
7550
  };
7539
7551
  InsightsRecommendationsVelocityQualityResponse: components["schemas"]["InsightsRecommendationsVelocityQuality"] & {
7540
7552
  _meta: components["schemas"]["InsightsResponseMeta"];
@@ -8196,8 +8208,27 @@ export interface components {
8196
8208
  /** @description Null when the repo is pending its first metrics scan. */
8197
8209
  metrics: components["schemas"]["CodeInsightsMetricsDto"] | null;
8198
8210
  hotspots: components["schemas"]["CodeInsightsHotspotDto"][];
8199
- /** @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. */
8200
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;
8201
8232
  };
8202
8233
  CodeInsightsOrgHotspotDto: components["schemas"]["CodeInsightsHotspotDto"] & {
8203
8234
  /** Format: uuid */
@@ -8758,6 +8789,8 @@ export type CodeInsightsFindingsBySeverityDto = components['schemas']['CodeInsig
8758
8789
  export type CodeInsightsRepoListItemDto = components['schemas']['CodeInsightsRepoListItemDto'];
8759
8790
  export type CodeInsightsRepoListDto = components['schemas']['CodeInsightsRepoListDto'];
8760
8791
  export type CodeInsightsRepoDetailDto = components['schemas']['CodeInsightsRepoDetailDto'];
8792
+ export type CodeInsightsDesignAnalysisDto = components['schemas']['CodeInsightsDesignAnalysisDto'];
8793
+ export type CodeInsightsDesignAnalyzeResponseDto = components['schemas']['CodeInsightsDesignAnalyzeResponseDto'];
8761
8794
  export type CodeInsightsOrgHotspotDto = components['schemas']['CodeInsightsOrgHotspotDto'];
8762
8795
  export type CodeInsightsSonarDto = components['schemas']['CodeInsightsSonarDto'];
8763
8796
  export type CodeInsightsSummaryDto = components['schemas']['CodeInsightsSummaryDto'];
@@ -12404,6 +12437,59 @@ export interface operations {
12404
12437
  };
12405
12438
  };
12406
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
+ };
12407
12493
  getAiToolMembers: {
12408
12494
  parameters: {
12409
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>;
@@ -686,6 +686,10 @@ export interface ProductivityInsightsContributorProfileDto {
686
686
  export interface ProductivityInsightsContributorMergedPrItemDto {
687
687
  label: string;
688
688
  url?: string;
689
+ /** v13 ship-weight score for this PR when scored. */
690
+ shipWeight?: number;
691
+ /** True when this PR is still awaiting ship-weight scoring. */
692
+ shipWeightPending?: boolean;
689
693
  }
690
694
 
691
695
  /** One failed GitHub Actions workflow run on a contributor activity day. */
@@ -888,11 +892,7 @@ export type AiAssistedCodeDataQuality = "estimated" | "measured";
888
892
 
889
893
  /** How AI-assisted code % was derived when not measured from productivity ingest. */
890
894
  export type AiAssistedCodeEstimationSource =
891
- | "ingest"
892
- | "token_volume"
893
- | "spend_proxy"
894
- | "adoption"
895
- | "unavailable";
895
+ "ingest" | "token_volume" | "spend_proxy" | "adoption" | "unavailable";
896
896
 
897
897
  /** One weekly bucket in the AI-assisted code percentage series. */
898
898
  export interface AiUsageSpendAiAssistedCodeWeekDto {
@@ -1617,6 +1617,8 @@ export interface InsightsRecommendationsRoiQuadrant {
1617
1617
  export interface InsightsVelocityQualityWeek {
1618
1618
  weekStartIso: string;
1619
1619
  mergedPrs: number;
1620
+ /** Sum of ship-weight scores for merged PRs in this week bucket. */
1621
+ shipWeightSum?: number;
1620
1622
  ciFailRatePct: number;
1621
1623
  /** False when CI metrics were not available for this week bucket. */
1622
1624
  hasCiMetrics?: boolean;
@@ -1626,6 +1628,8 @@ export interface InsightsRecommendationsVelocityQuality {
1626
1628
  weeks: InsightsVelocityQualityWeek[];
1627
1629
  targetFailRatePct: number;
1628
1630
  volumeGrowthPct: number;
1631
+ /** Ship-weight volume growth vs prior equal-length window. */
1632
+ shipWeightVolumeGrowthPct?: number;
1629
1633
  }
1630
1634
 
1631
1635
  export const INSIGHTS_REVIEW_STAGE_IDS = [
@@ -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