@thinkai/tai-api-contract 2.11.0 → 2.12.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.
@@ -1,7 +1,7 @@
1
1
  openapi: 3.0.3
2
2
  info:
3
3
  title: ThinkAI API
4
- version: 2.11.0
4
+ version: 2.12.0
5
5
  description: >
6
6
  Contract surface for the AI Driven SDLC backend used by ThinkAI.
7
7
  Workspace-scoped routes use `/workspaces/{workspaceId}/...`.
@@ -52,6 +52,8 @@ tags:
52
52
  description: Agentic Foundation pillars (epic #278); reads stored repository readiness snapshots
53
53
  - name: YourAiJourney
54
54
  description: Your AI Journey dashboard aggregators (epic #267); composes readiness, metrics, and AI-spend data for the /dashboard page
55
+ - name: WorkspaceActivity
56
+ description: Workspace-wide lifecycle activity log — repo add/remove/re-add and integration lifecycle events (issue #515).
55
57
  - name: PlatformAdmin
56
58
  description: Platform-admin operations restricted to PLATFORM_ADMIN_EMAILS. Callers must present a valid JWT from an email on that allowlist; all other callers receive 403.
57
59
 
@@ -2282,6 +2284,12 @@ paths:
2282
2284
  - $ref: "#/components/parameters/PaginationOrder"
2283
2285
  - $ref: "#/components/parameters/ReadinessRepoSearch"
2284
2286
  - $ref: "#/components/parameters/ReadinessRepoLanguage"
2287
+ - name: includeArchived
2288
+ in: query
2289
+ description: When `true`, includes Inactive (user-removed) repos alongside Active ones. Default is `false` (active only).
2290
+ schema:
2291
+ type: boolean
2292
+ default: false
2285
2293
  responses:
2286
2294
  "200":
2287
2295
  description: Paginated repositories analyzed
@@ -2306,6 +2314,43 @@ paths:
2306
2314
  schema:
2307
2315
  $ref: "#/components/schemas/ErrorMessageDto"
2308
2316
 
2317
+ /workspaces/{workspaceId}/readiness/initialize:
2318
+ post:
2319
+ tags: [RepositoryReadiness]
2320
+ summary: Trigger initial readiness scans for all workspace repos (idempotent)
2321
+ description: >
2322
+ Called automatically when a user first visits the Agentic Foundation dashboard.
2323
+ Enqueues readiness scans for every GitHub repo in the workspace that has not yet been
2324
+ scanned. Idempotent — if any readiness run has ever been queued for this workspace the
2325
+ request is a no-op and returns `already_triggered`. Safe to call on every page load;
2326
+ the backend enforces the once-per-workspace guarantee via the database.
2327
+ operationId: postReadinessInitialize
2328
+ parameters:
2329
+ - $ref: "#/components/parameters/WorkspaceId"
2330
+ responses:
2331
+ "200":
2332
+ description: Already triggered in a previous session — no new runs enqueued
2333
+ content:
2334
+ application/json:
2335
+ schema:
2336
+ $ref: "#/components/schemas/ReadinessInitializeResponseDto"
2337
+ "202":
2338
+ description: Scans enqueued for all repos (first-time trigger)
2339
+ content:
2340
+ application/json:
2341
+ schema:
2342
+ $ref: "#/components/schemas/ReadinessInitializeResponseDto"
2343
+ "401":
2344
+ $ref: "#/components/responses/Unauthorized"
2345
+ "403":
2346
+ $ref: "#/components/responses/Forbidden"
2347
+ "501":
2348
+ description: Feature not supported by this server build
2349
+ content:
2350
+ application/json:
2351
+ schema:
2352
+ $ref: "#/components/schemas/ErrorMessageDto"
2353
+
2309
2354
  /workspaces/{workspaceId}/readiness/analyze:
2310
2355
  post:
2311
2356
  tags: [RepositoryReadiness]
@@ -2425,6 +2470,62 @@ paths:
2425
2470
  application/json:
2426
2471
  schema:
2427
2472
  $ref: "#/components/schemas/ErrorMessageDto"
2473
+ patch:
2474
+ tags: [RepositoryReadiness]
2475
+ summary: Archive (remove) or restore (re-add) a repository
2476
+ description: >
2477
+ Set `archived: true` to soft-remove the repo (Inactive). Set `archived: false` to re-add a
2478
+ previously Inactive repo (Active). Re-add reuses the same `repo_id` row so historical scan
2479
+ foreign keys remain intact, and automatically enqueues a fresh readiness scan.
2480
+
2481
+ Returns `409` with `code: repo_scan_in_progress` if a scan is queued or running when archiving.
2482
+ Returns `409` with `code: repo_already_active` if re-adding a repo that is already Active.
2483
+ operationId: patchReadinessRepo
2484
+ parameters:
2485
+ - $ref: "#/components/parameters/WorkspaceId"
2486
+ - $ref: "#/components/parameters/RepoId"
2487
+ requestBody:
2488
+ required: true
2489
+ content:
2490
+ application/json:
2491
+ schema:
2492
+ $ref: "#/components/schemas/PatchRepoArchiveBodyDto"
2493
+ examples:
2494
+ archive:
2495
+ value:
2496
+ archived: true
2497
+ restore:
2498
+ value:
2499
+ archived: false
2500
+ responses:
2501
+ "200":
2502
+ description: Repo status updated
2503
+ content:
2504
+ application/json:
2505
+ schema:
2506
+ $ref: "#/components/schemas/PatchRepoArchiveResponseDto"
2507
+ "400":
2508
+ description: Malformed request body or repoId
2509
+ content:
2510
+ application/json:
2511
+ schema:
2512
+ $ref: "#/components/schemas/ErrorMessageDto"
2513
+ "401":
2514
+ $ref: "#/components/responses/Unauthorized"
2515
+ "403":
2516
+ $ref: "#/components/responses/Forbidden"
2517
+ "404":
2518
+ description: Workspace or repository not found
2519
+ content:
2520
+ application/json:
2521
+ schema:
2522
+ $ref: "#/components/schemas/ErrorMessageDto"
2523
+ "409":
2524
+ description: Conflict — scan in progress or repo already in the requested state
2525
+ content:
2526
+ application/json:
2527
+ schema:
2528
+ $ref: "#/components/schemas/ErrorMessageDto"
2428
2529
 
2429
2530
  /workspaces/{workspaceId}/readiness/repos/{repoId}/runs:
2430
2531
  get:
@@ -2566,6 +2667,83 @@ paths:
2566
2667
  schema:
2567
2668
  $ref: "#/components/schemas/ErrorMessageDto"
2568
2669
 
2670
+ /workspaces/{workspaceId}/activity:
2671
+ get:
2672
+ tags: [WorkspaceActivity]
2673
+ summary: Workspace activity log (paginated)
2674
+ operationId: listWorkspaceActivity
2675
+ description: >
2676
+ Paginated, chronological feed of workspace-scoped lifecycle events: repository add/remove/re-add
2677
+ and GitHub integration add/remove. Inactive repos remain visible in this log.
2678
+ Filter by `eventType`, `actorUserId`, or date range (`since`/`until`).
2679
+ parameters:
2680
+ - $ref: "#/components/parameters/WorkspaceId"
2681
+ - $ref: "#/components/parameters/PaginationLimit"
2682
+ - $ref: "#/components/parameters/PaginationOffset"
2683
+ - $ref: "#/components/parameters/PaginationOrder"
2684
+ - name: eventType
2685
+ in: query
2686
+ description: Filter to a specific event type.
2687
+ schema:
2688
+ $ref: "#/components/schemas/ActivityLogEventTypeDto"
2689
+ - name: actorUserId
2690
+ in: query
2691
+ description: Filter to events performed by a specific user (UUID).
2692
+ schema:
2693
+ type: string
2694
+ format: uuid
2695
+ - name: since
2696
+ in: query
2697
+ description: ISO-8601 lower bound on `occurredAt` (inclusive).
2698
+ schema:
2699
+ type: string
2700
+ format: date-time
2701
+ - name: until
2702
+ in: query
2703
+ description: ISO-8601 upper bound on `occurredAt` (inclusive).
2704
+ schema:
2705
+ type: string
2706
+ format: date-time
2707
+ - name: eventCategory
2708
+ in: query
2709
+ required: false
2710
+ description: >
2711
+ Filter by event namespace prefix (e.g. "fix", "repo", "integration", "readiness", "config", "member").
2712
+ schema:
2713
+ type: string
2714
+ - name: search
2715
+ in: query
2716
+ required: false
2717
+ description: >
2718
+ Case-insensitive substring filter applied across repo name,
2719
+ integration type, actor email, and actor display name.
2720
+ schema:
2721
+ type: string
2722
+ maxLength: 200
2723
+ responses:
2724
+ "200":
2725
+ description: Paginated activity log entries
2726
+ content:
2727
+ application/json:
2728
+ schema:
2729
+ $ref: "#/components/schemas/ActivityLogPageDto"
2730
+ "400":
2731
+ description: Invalid query parameters
2732
+ content:
2733
+ application/json:
2734
+ schema:
2735
+ $ref: "#/components/schemas/ErrorMessageDto"
2736
+ "401":
2737
+ $ref: "#/components/responses/Unauthorized"
2738
+ "403":
2739
+ $ref: "#/components/responses/Forbidden"
2740
+ "404":
2741
+ description: Workspace does not exist
2742
+ content:
2743
+ application/json:
2744
+ schema:
2745
+ $ref: "#/components/schemas/ErrorMessageDto"
2746
+
2569
2747
  /workspaces/{workspaceId}/readiness/score-history:
2570
2748
  get:
2571
2749
  tags: [RepositoryReadiness]
@@ -6080,6 +6258,22 @@ components:
6080
6258
  - required: [repoId]
6081
6259
  - required: [providerSlug]
6082
6260
 
6261
+ ReadinessInitializeResponseDto:
6262
+ type: object
6263
+ required: [kind]
6264
+ properties:
6265
+ kind:
6266
+ type: string
6267
+ enum: [triggered, already_triggered, no_repos, no_integration]
6268
+ description: >
6269
+ `triggered` — scans were enqueued for the first time (HTTP 202).
6270
+ `already_triggered` — a previous session already started scans; nothing new enqueued (HTTP 200).
6271
+ `no_repos` — workspace has no GitHub repos connected yet (HTTP 200).
6272
+ `no_integration` — workspace has no GitHub App installation linked yet (HTTP 200).
6273
+ count:
6274
+ type: integer
6275
+ description: Number of repos enqueued. Present only when `kind` is `triggered`.
6276
+
6083
6277
  ReadinessAnalyzeResponseDto:
6084
6278
  type: object
6085
6279
  required: [runId]
@@ -7310,3 +7504,148 @@ components:
7310
7504
  type: integer
7311
7505
  activeUsers:
7312
7506
  type: integer
7507
+
7508
+ PatchRepoArchiveBodyDto:
7509
+ type: object
7510
+ required: [archived]
7511
+ properties:
7512
+ archived:
7513
+ type: boolean
7514
+ description: >
7515
+ `true` to soft-remove (Inactive). `false` to restore a previously Inactive repo (Active),
7516
+ which also enqueues a fresh readiness scan.
7517
+
7518
+ PatchRepoArchiveResponseDto:
7519
+ type: object
7520
+ required: [repoId, status]
7521
+ properties:
7522
+ repoId:
7523
+ type: string
7524
+ format: uuid
7525
+ status:
7526
+ type: string
7527
+ enum: [Active, Inactive]
7528
+ description: Current lifecycle status of the repository after the operation.
7529
+ runId:
7530
+ type: string
7531
+ format: uuid
7532
+ nullable: true
7533
+ description: ID of the freshly enqueued readiness scan run (only present on re-add).
7534
+
7535
+ ActivityLogEventTypeDto:
7536
+ type: string
7537
+ description: Type of workspace lifecycle event.
7538
+ enum:
7539
+ - repo.added
7540
+ - repo.removed
7541
+ - repo.readded
7542
+ - integration.github.added
7543
+ - integration.github.updated
7544
+ - integration.github.removed
7545
+ - integration.github.permissions_changed
7546
+ - integration.github.repo_added
7547
+ - integration.github.repo_removed
7548
+ - fix.requested
7549
+ - fix.generating
7550
+ - fix.pr_created
7551
+ - fix.merged
7552
+ - fix.failed
7553
+ - readiness.scan_started
7554
+ - readiness.scan_completed
7555
+ - readiness.scan_failed
7556
+ - readiness.scan_partial
7557
+ - config.cursor.added
7558
+ - config.cursor.updated
7559
+ - config.cursor.removed
7560
+ - config.cursor.platform_key_enabled
7561
+ - config.cursor.platform_key_disabled
7562
+ - config.claude.added
7563
+ - config.claude.updated
7564
+ - config.claude.removed
7565
+ - member.invited
7566
+ - member.role_changed
7567
+ - member.removed
7568
+
7569
+ ActivityLogActorDto:
7570
+ type: object
7571
+ required: [userId]
7572
+ properties:
7573
+ userId:
7574
+ type: string
7575
+ format: uuid
7576
+ email:
7577
+ type: string
7578
+ format: email
7579
+ nullable: true
7580
+ name:
7581
+ type: string
7582
+ nullable: true
7583
+
7584
+ ActivityLogEntryDto:
7585
+ type: object
7586
+ required: [id, eventType, eventCategory, occurredAt, actorType]
7587
+ properties:
7588
+ id:
7589
+ type: string
7590
+ format: uuid
7591
+ eventType:
7592
+ $ref: "#/components/schemas/ActivityLogEventTypeDto"
7593
+ eventCategory:
7594
+ type: string
7595
+ description: Namespace prefix derived from event_type (e.g. "fix", "repo", "config").
7596
+ occurredAt:
7597
+ type: string
7598
+ format: date-time
7599
+ actorType:
7600
+ type: string
7601
+ enum: [user, system, webhook]
7602
+ description: Whether the event was triggered by a human user, a batch/system process, or a webhook.
7603
+ actor:
7604
+ nullable: true
7605
+ allOf:
7606
+ - $ref: "#/components/schemas/ActivityLogActorDto"
7607
+ repoId:
7608
+ type: string
7609
+ format: uuid
7610
+ nullable: true
7611
+ repoName:
7612
+ type: string
7613
+ nullable: true
7614
+ integrationId:
7615
+ type: string
7616
+ format: uuid
7617
+ nullable: true
7618
+ integrationType:
7619
+ type: string
7620
+ nullable: true
7621
+ fixRequestId:
7622
+ type: string
7623
+ format: uuid
7624
+ nullable: true
7625
+ description: ID of the related fix request (fix.* events).
7626
+ issueId:
7627
+ type: string
7628
+ format: uuid
7629
+ nullable: true
7630
+ description: ID of the related readiness issue (fix.* events).
7631
+ readinessRunId:
7632
+ type: string
7633
+ format: uuid
7634
+ nullable: true
7635
+ description: ID of the related readiness run (readiness.* events).
7636
+ metadata:
7637
+ type: object
7638
+ additionalProperties: true
7639
+ nullable: true
7640
+ description: Event-specific supplementary data (before/after state, installation IDs, etc.).
7641
+
7642
+ ActivityLogPageDto:
7643
+ allOf:
7644
+ - $ref: "#/components/schemas/PageMetaDto"
7645
+ - type: object
7646
+ required: [items]
7647
+ properties:
7648
+ items:
7649
+ type: array
7650
+ items:
7651
+ $ref: "#/components/schemas/ActivityLogEntryDto"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thinkai/tai-api-contract",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -21,6 +21,7 @@
21
21
  "dependencies": {},
22
22
  "devDependencies": {
23
23
  "@stoplight/spectral-cli": "^6.15.1",
24
+ "jsonpath-plus": "^10.3.0",
24
25
  "openapi-typescript": "^7.13.0",
25
26
  "typescript": "~5.3.0"
26
27
  },