@thinkai/tai-api-contract 2.131.0 → 2.133.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.
@@ -1544,7 +1544,7 @@ export interface paths {
1544
1544
  };
1545
1545
  /**
1546
1546
  * GitHub App installation status for workspace
1547
- * @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`.
1547
+ * @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.
1548
1548
  */
1549
1549
  get: operations["getWorkspaceGithubInstallationStatus"];
1550
1550
  put?: never;
@@ -4124,7 +4124,7 @@ export interface paths {
4124
4124
  };
4125
4125
  /**
4126
4126
  * Ingest / backfill data coverage
4127
- * @description Read-only snapshot of historical ingest coverage for connected pipelines (productivity GitHub, AI usage/spend per provider, SDLC components, monitoring, HRIS). Aggregates existing watermarks and stored day/week evidence — does not trigger ingest or refresh. Requires workspace membership. Disconnected sources are omitted.
4127
+ * @description Read-only snapshot of historical ingest coverage for connected pipelines (productivity GitHub, AI usage/spend per provider, SDLC components, monitoring, HRIS). Aggregates existing watermarks and stored day/week evidence — does not trigger ingest or refresh. Productivity detail may include `selfHeal` (latest depth scan and week reconcile) read from stored activity rows; this GET does not run a scan. `selfHeal` is null when neither event exists. Requires workspace membership. Disconnected sources are omitted.
4128
4128
  */
4129
4129
  get: operations["getWorkspaceIngestCoverage"];
4130
4130
  put?: never;
@@ -4135,6 +4135,26 @@ export interface paths {
4135
4135
  patch?: never;
4136
4136
  trace?: never;
4137
4137
  };
4138
+ "/workspaces/{workspaceId}/ingest-runs": {
4139
+ parameters: {
4140
+ query?: never;
4141
+ header?: never;
4142
+ path?: never;
4143
+ cookie?: never;
4144
+ };
4145
+ /**
4146
+ * List durable ingest runs
4147
+ * @description Newest-first history of ingest worker ticks that polled. Quiet skips (lock held, rate-limit deferral, and other non-poll skips) are omitted. This wave writes `productivity_github` only; other kinds return an empty list. Requires workspace membership. Does not include run history on ingest-coverage.
4148
+ */
4149
+ get: operations["getWorkspaceIngestRuns"];
4150
+ put?: never;
4151
+ post?: never;
4152
+ delete?: never;
4153
+ options?: never;
4154
+ head?: never;
4155
+ patch?: never;
4156
+ trace?: never;
4157
+ };
4138
4158
  "/workspaces/{workspaceId}/hris/status": {
4139
4159
  parameters: {
4140
4160
  query?: never;
@@ -8060,6 +8080,26 @@ export interface components {
8060
8080
  gaps?: components["schemas"]["IngestCoverageGapDto"][];
8061
8081
  lastErrorKind?: string | null;
8062
8082
  };
8083
+ /** @description Latest depth scan read from stored activity. `capturePercent` is the minimum existing capture ratio over that scan's repo checks with a GitHub merge count, or null when none qualify. */
8084
+ IngestCoverageProductivityDepthScanDto: {
8085
+ /** Format: date-time */
8086
+ completedAt: string | null;
8087
+ reposScanned: number;
8088
+ /** @description Metadata underIngestedCount from the completed depth-scan event. */
8089
+ gapCount: number;
8090
+ capturePercent: number | null;
8091
+ weeksQueued: number;
8092
+ };
8093
+ IngestCoverageProductivityWeekReconcileDto: {
8094
+ /** Format: date-time */
8095
+ completedAt: string | null;
8096
+ weeksChecked: number;
8097
+ weeksQueued: number;
8098
+ };
8099
+ IngestCoverageProductivitySelfHealDto: {
8100
+ depthScan: components["schemas"]["IngestCoverageProductivityDepthScanDto"];
8101
+ weekReconcile: components["schemas"]["IngestCoverageProductivityWeekReconcileDto"];
8102
+ };
8063
8103
  IngestCoverageProductivityDetailDto: {
8064
8104
  /** @enum {string|null} */
8065
8105
  phase?: "recent" | "historical" | "complete" | null;
@@ -8069,6 +8109,8 @@ export interface components {
8069
8109
  failedRepoCount?: number;
8070
8110
  coveragePercent?: number | null;
8071
8111
  repos?: components["schemas"]["IngestCoverageProductivityRepoDto"][];
8112
+ /** @description Latest depth-scan and week-reconcile summary from stored activity rows. Null when neither event exists. The coverage GET does not run a scan. */
8113
+ selfHeal?: components["schemas"]["IngestCoverageProductivitySelfHealDto"] | null;
8072
8114
  };
8073
8115
  IngestCoverageFactFamilyDto: {
8074
8116
  /** @enum {string} */
@@ -8144,6 +8186,27 @@ export interface components {
8144
8186
  /** Format: date-time */
8145
8187
  generatedAt?: string;
8146
8188
  };
8189
+ IngestRunDto: {
8190
+ /** Format: uuid */
8191
+ runId: string;
8192
+ /** @enum {string} */
8193
+ kind: "productivity_github" | "ai_usage" | "sdlc_github" | "monitoring" | "hris";
8194
+ /** Format: date-time */
8195
+ startedAt: string;
8196
+ /** Format: date-time */
8197
+ completedAt: string | null;
8198
+ /** @enum {string} */
8199
+ outcome: "in_progress" | "ok" | "partial" | "failed" | "cancelled";
8200
+ reposPolled: number | null;
8201
+ reposOk: number | null;
8202
+ reposFailed: number | null;
8203
+ errorSummary: string | null;
8204
+ /** @description ISO lastIngestAt after the cursor moved; null when it did not. */
8205
+ watermark: string | null;
8206
+ };
8207
+ IngestRunListDto: {
8208
+ runs: components["schemas"]["IngestRunDto"][];
8209
+ };
8147
8210
  HrisSyncStatusDto: {
8148
8211
  /** @description Provider identifier (e.g. 'personio', 'zenhr'). */
8149
8212
  provider: string;
@@ -10317,6 +10380,9 @@ export type WorkspaceAbsenceListDto = components['schemas']['WorkspaceAbsenceLis
10317
10380
  export type IngestCoverageGapDto = components['schemas']['IngestCoverageGapDto'];
10318
10381
  export type IngestCoverageLastRunDto = components['schemas']['IngestCoverageLastRunDto'];
10319
10382
  export type IngestCoverageProductivityRepoDto = components['schemas']['IngestCoverageProductivityRepoDto'];
10383
+ export type IngestCoverageProductivityDepthScanDto = components['schemas']['IngestCoverageProductivityDepthScanDto'];
10384
+ export type IngestCoverageProductivityWeekReconcileDto = components['schemas']['IngestCoverageProductivityWeekReconcileDto'];
10385
+ export type IngestCoverageProductivitySelfHealDto = components['schemas']['IngestCoverageProductivitySelfHealDto'];
10320
10386
  export type IngestCoverageProductivityDetailDto = components['schemas']['IngestCoverageProductivityDetailDto'];
10321
10387
  export type IngestCoverageFactFamilyDto = components['schemas']['IngestCoverageFactFamilyDto'];
10322
10388
  export type IngestCoverageAiDetailDto = components['schemas']['IngestCoverageAiDetailDto'];
@@ -10325,6 +10391,8 @@ export type IngestCoverageSdlcDetailDto = components['schemas']['IngestCoverageS
10325
10391
  export type IngestCoverageSyncDetailDto = components['schemas']['IngestCoverageSyncDetailDto'];
10326
10392
  export type IngestCoveragePipelineDto = components['schemas']['IngestCoveragePipelineDto'];
10327
10393
  export type IngestCoverageDto = components['schemas']['IngestCoverageDto'];
10394
+ export type IngestRunDto = components['schemas']['IngestRunDto'];
10395
+ export type IngestRunListDto = components['schemas']['IngestRunListDto'];
10328
10396
  export type HrisSyncStatusDto = components['schemas']['HrisSyncStatusDto'];
10329
10397
  export type HrisSyncStatusListDto = components['schemas']['HrisSyncStatusListDto'];
10330
10398
  export type ZenHrReconnectResultDto = components['schemas']['ZenHrReconnectResultDto'];
@@ -14829,7 +14897,7 @@ export interface operations {
14829
14897
  getWorkspaceGithubInstallationStatus: {
14830
14898
  parameters: {
14831
14899
  query?: {
14832
- /** @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. */
14900
+ /** @description When true, bypass `tai_workspace_vcs_repos_cache` and re-fetch from GitHub, then poll and merge productivity metrics for the current UTC week even while historical backfill is active or metrics already exist. Response includes `productivityRefreshInProgress` while the workspace advisory lock is held. */
14833
14901
  refresh?: boolean;
14834
14902
  /** @description When true, re-fetch GitHub App and installation permission metadata (used by the login permission gate after the user approves on GitHub). Clears App-permission and product-settings caches so the next `productSettingsRefresh` re-probes. Does not itself call alert-list APIs; use `productSettingsRefresh` for that. */
14835
14903
  permissionsRefresh?: boolean;
@@ -20943,6 +21011,55 @@ export interface operations {
20943
21011
  403: components["responses"]["Forbidden"];
20944
21012
  };
20945
21013
  };
21014
+ getWorkspaceIngestRuns: {
21015
+ parameters: {
21016
+ query?: {
21017
+ /** @description Coverage pipeline kind. Omit to list every kind stored for the workspace. */
21018
+ kind?: "productivity_github" | "ai_usage" | "sdlc_github" | "monitoring" | "hris";
21019
+ /** @description Page size. Default 20. Values above 100 are rejected. */
21020
+ limit?: number;
21021
+ };
21022
+ header?: never;
21023
+ path: {
21024
+ workspaceId: components["parameters"]["WorkspaceId"];
21025
+ };
21026
+ cookie?: never;
21027
+ };
21028
+ requestBody?: never;
21029
+ responses: {
21030
+ /** @description Ingest runs, newest startedAt first */
21031
+ 200: {
21032
+ headers: {
21033
+ [name: string]: unknown;
21034
+ };
21035
+ content: {
21036
+ /**
21037
+ * @example {
21038
+ * "runs": []
21039
+ * }
21040
+ */
21041
+ "application/json": components["schemas"]["IngestRunListDto"];
21042
+ };
21043
+ };
21044
+ /** @description Invalid kind or limit */
21045
+ 400: {
21046
+ headers: {
21047
+ [name: string]: unknown;
21048
+ };
21049
+ content: {
21050
+ /**
21051
+ * @example {
21052
+ * "error": "Invalid ingest-runs query",
21053
+ * "code": "invalid_query"
21054
+ * }
21055
+ */
21056
+ "application/json": components["schemas"]["ErrorMessageDto"];
21057
+ };
21058
+ };
21059
+ 401: components["responses"]["Unauthorized"];
21060
+ 403: components["responses"]["Forbidden"];
21061
+ };
21062
+ };
20946
21063
  getHrisSyncStatus: {
20947
21064
  parameters: {
20948
21065
  query?: never;
package/src/index.ts CHANGED
@@ -1315,6 +1315,34 @@ export interface IngestCoverageProductivityRepoDto {
1315
1315
  lastErrorKind?: string | null;
1316
1316
  }
1317
1317
 
1318
+ /** Latest depth-scan summary read from activity rows. Does not start a scan. */
1319
+ export interface IngestCoverageProductivityDepthScanDto {
1320
+ /** Newest `productivity.ingest.depth_scan_completed` time, or null when none. */
1321
+ completedAt: string | null;
1322
+ reposScanned: number;
1323
+ /** Metadata `underIngestedCount` on that completed event (0 when the scan found none). */
1324
+ gapCount: number;
1325
+ /**
1326
+ * Minimum `capturePercent(platformPrs, githubMerged180d)` over that scan's repo checks
1327
+ * with `githubMerged180d` > 0. Null when no such row.
1328
+ */
1329
+ capturePercent: number | null;
1330
+ weeksQueued: number;
1331
+ }
1332
+
1333
+ /** Latest week-reconcile summary read from activity rows. */
1334
+ export interface IngestCoverageProductivityWeekReconcileDto {
1335
+ /** Newest `productivity.ingest.week_reconcile` time, or null when none. */
1336
+ completedAt: string | null;
1337
+ weeksChecked: number;
1338
+ weeksQueued: number;
1339
+ }
1340
+
1341
+ export interface IngestCoverageProductivitySelfHealDto {
1342
+ depthScan: IngestCoverageProductivityDepthScanDto;
1343
+ weekReconcile: IngestCoverageProductivityWeekReconcileDto;
1344
+ }
1345
+
1318
1346
  export interface IngestCoverageProductivityDetailDto {
1319
1347
  phase?: "recent" | "historical" | "complete" | null;
1320
1348
  historicalWeekStart?: string | null;
@@ -1323,6 +1351,11 @@ export interface IngestCoverageProductivityDetailDto {
1323
1351
  failedRepoCount?: number;
1324
1352
  coveragePercent?: number | null;
1325
1353
  repos?: IngestCoverageProductivityRepoDto[];
1354
+ /**
1355
+ * Null when the pipeline exists but no depth-scan completed event and no week-reconcile
1356
+ * event are stored. Absent from pipelines that are omitted.
1357
+ */
1358
+ selfHeal?: IngestCoverageProductivitySelfHealDto | null;
1326
1359
  }
1327
1360
 
1328
1361
  export interface IngestCoverageFactFamilyDto {
@@ -1410,6 +1443,30 @@ export interface IngestCoverageDto {
1410
1443
  generatedAt?: string;
1411
1444
  }
1412
1445
 
1446
+ export type IngestRunKind = IngestCoveragePipelineKind;
1447
+
1448
+ /** Finish state for one durable ingest tick. `cancelled` is legal and unused this wave. */
1449
+ export type IngestRunOutcome = "in_progress" | "ok" | "partial" | "failed" | "cancelled";
1450
+
1451
+ /** One persisted ingest tick from GET /workspaces/:id/ingest-runs. */
1452
+ export interface IngestRunDto {
1453
+ runId: string;
1454
+ kind: IngestRunKind;
1455
+ startedAt: string;
1456
+ completedAt: string | null;
1457
+ outcome: IngestRunOutcome;
1458
+ reposPolled: number | null;
1459
+ reposOk: number | null;
1460
+ reposFailed: number | null;
1461
+ errorSummary: string | null;
1462
+ watermark: string | null;
1463
+ }
1464
+
1465
+ /** Response body for GET /workspaces/:id/ingest-runs. */
1466
+ export interface IngestRunListDto {
1467
+ runs: IngestRunDto[];
1468
+ }
1469
+
1413
1470
  /** Sync status for a single HRIS provider connected to a workspace. */
1414
1471
  export interface HrisSyncStatusDto {
1415
1472
  /** Provider identifier ('personio', 'zenhr', …). */