@thinkai/tai-api-contract 2.70.0 → 2.71.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.
@@ -356,7 +356,7 @@ export interface paths {
356
356
  put?: never;
357
357
  /**
358
358
  * Invite member to workspace
359
- * @description Workspace admin only. Upserts `tai_users` by email and adds or reactivates `tai_workspace_members`. Idempotent when the email is already an active member: returns **201** with the existing row and **does not change** their role if the request body role differs. Does not send email; optional `tai_workspace_invitations` row may be recorded (no accept/link flow yet).
359
+ * @description Workspace admin only. Creates or refreshes a **pending** `tai_workspace_invitations` row and emails an accept link; it does **not** create `tai_workspace_members`. Membership is granted only by `POST /invitations/{token}/accept`. Applies to new and existing platform users alike. Idempotent when the email is already an active member: returns **201** with `outcome: "already_member"` and the existing row, **does not change** their role if the request body role differs, and sends no email. Re-inviting a pending email refreshes the token and 7-day expiry (the previous link stops working). When SMTP is not configured the invitation is still created and a warning is logged.
360
360
  */
361
361
  post: operations["inviteTenantMember"];
362
362
  delete?: never;
@@ -389,6 +389,86 @@ export interface paths {
389
389
  patch: operations["updateTenantMemberRole"];
390
390
  trace?: never;
391
391
  };
392
+ "/workspaces/{workspaceId}/invitations": {
393
+ parameters: {
394
+ query?: never;
395
+ header?: never;
396
+ path?: never;
397
+ cookie?: never;
398
+ };
399
+ /**
400
+ * List pending workspace invitations
401
+ * @description Workspace admin only. Returns invitations still awaiting a decision so the team settings page can show "pending" alongside active members. Rows whose `expiresAt` has passed are flipped to `expired` on read and omitted.
402
+ */
403
+ get: operations["listWorkspaceInvitations"];
404
+ put?: never;
405
+ post?: never;
406
+ delete?: never;
407
+ options?: never;
408
+ head?: never;
409
+ patch?: never;
410
+ trace?: never;
411
+ };
412
+ "/invitations/{token}": {
413
+ parameters: {
414
+ query?: never;
415
+ header?: never;
416
+ path?: never;
417
+ cookie?: never;
418
+ };
419
+ /**
420
+ * Preview a workspace invitation (public)
421
+ * @description **Unauthenticated.** Lets the SPA render the invite landing page before the invitee has signed in. The invited email is **masked** (`j••••e@example.com`) so a leaked link does not disclose an address. Returns `404` with a generic message for unknown, revoked, or rejected tokens; a past-due `pending` invitation is flipped to `expired` and returned with that status so the SPA can show a stable message.
422
+ */
423
+ get: operations["getWorkspaceInvitationPreview"];
424
+ put?: never;
425
+ post?: never;
426
+ delete?: never;
427
+ options?: never;
428
+ head?: never;
429
+ patch?: never;
430
+ trace?: never;
431
+ };
432
+ "/invitations/{token}/accept": {
433
+ parameters: {
434
+ query?: never;
435
+ header?: never;
436
+ path?: never;
437
+ cookie?: never;
438
+ };
439
+ get?: never;
440
+ put?: never;
441
+ /**
442
+ * Accept a workspace invitation
443
+ * @description Requires a Supabase JWT whose email matches the invited email. Creates the `tai_workspace_members` row with the invited role and closes the invitation as `accepted`. This is the **only** path that grants workspace membership — signing up alone never does. Idempotent: re-accepting your own accepted invitation returns `200` unchanged.
444
+ */
445
+ post: operations["acceptWorkspaceInvitation"];
446
+ delete?: never;
447
+ options?: never;
448
+ head?: never;
449
+ patch?: never;
450
+ trace?: never;
451
+ };
452
+ "/invitations/{token}/reject": {
453
+ parameters: {
454
+ query?: never;
455
+ header?: never;
456
+ path?: never;
457
+ cookie?: never;
458
+ };
459
+ get?: never;
460
+ put?: never;
461
+ /**
462
+ * Decline a workspace invitation
463
+ * @description Requires a Supabase JWT whose email matches the invited email — anonymous decline with only the token is not allowed. Closes the invitation as `rejected` and creates no member row. Idempotent for an already-rejected invitation.
464
+ */
465
+ post: operations["rejectWorkspaceInvitation"];
466
+ delete?: never;
467
+ options?: never;
468
+ head?: never;
469
+ patch?: never;
470
+ trace?: never;
471
+ };
392
472
  "/workspaces/{workspaceId}/org-chart/status": {
393
473
  parameters: {
394
474
  query?: never;
@@ -3099,6 +3179,54 @@ export interface components {
3099
3179
  /** @enum {string} */
3100
3180
  role: "admin" | "editor" | "viewer";
3101
3181
  };
3182
+ /**
3183
+ * @description `revoked` is an admin cancelling the invitation; `rejected` is the invitee declining it. Both leave the invitee outside the workspace.
3184
+ * @enum {string}
3185
+ */
3186
+ WorkspaceInvitationStatusDto: "pending" | "accepted" | "expired" | "revoked" | "rejected";
3187
+ /** @description Workspace invitation as seen by an authenticated admin or invitee. */
3188
+ WorkspaceInvitationDto: {
3189
+ /** Format: uuid */
3190
+ id: string;
3191
+ /** Format: uuid */
3192
+ workspaceId: string;
3193
+ workspaceName: string;
3194
+ /** @description Invited email address. */
3195
+ email: string;
3196
+ /** @enum {string} */
3197
+ role: "admin" | "editor" | "viewer";
3198
+ status: components["schemas"]["WorkspaceInvitationStatusDto"];
3199
+ invitedByName?: string | null;
3200
+ invitedByEmail?: string | null;
3201
+ /** Format: date-time */
3202
+ expiresAt: string;
3203
+ /** Format: date-time */
3204
+ createdAt: string;
3205
+ /** Format: date-time */
3206
+ acceptedAt?: string | null;
3207
+ };
3208
+ /** @description Unauthenticated invitation preview. `maskedEmail` is the only view of the invited address; compare it to the signed-in account client-side before calling accept. */
3209
+ WorkspaceInvitationPreviewDto: {
3210
+ workspaceName: string;
3211
+ /** @enum {string} */
3212
+ role: "admin" | "editor" | "viewer";
3213
+ status: components["schemas"]["WorkspaceInvitationStatusDto"];
3214
+ /** @example j••••e@example.com */
3215
+ maskedEmail: string;
3216
+ invitedByName?: string | null;
3217
+ /** Format: date-time */
3218
+ expiresAt: string;
3219
+ };
3220
+ WorkspaceInvitationListDto: {
3221
+ invitations: components["schemas"]["WorkspaceInvitationDto"][];
3222
+ };
3223
+ /** @description Discriminated on `outcome`. `invited` carries the new pending invitation; `already_member` carries the existing membership row unchanged. */
3224
+ InviteTeamMemberResultDto: {
3225
+ /** @enum {string} */
3226
+ outcome: "invited" | "already_member";
3227
+ invitation?: components["schemas"]["WorkspaceInvitationDto"];
3228
+ member?: components["schemas"]["TeamMemberDto"];
3229
+ };
3102
3230
  /** @description Granular person erasure categories. All default to true when omitted. */
3103
3231
  EraseInsightsPersonBodyDto: {
3104
3232
  /** @description Remove the person node from `tai_workspace_config.org_chart`. */
@@ -6216,7 +6344,7 @@ export interface components {
6216
6344
  * @description Type of workspace lifecycle event.
6217
6345
  * @enum {string}
6218
6346
  */
6219
- 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.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" | "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";
6347
+ 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" | "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";
6220
6348
  ActivityLogActorDto: {
6221
6349
  /** Format: uuid */
6222
6350
  userId: string;
@@ -6771,6 +6899,8 @@ export interface components {
6771
6899
  NotificationId: string;
6772
6900
  /** @description Workspace member user id (`tai_users.id`). */
6773
6901
  WorkspaceMemberId: string;
6902
+ /** @description Opaque workspace invitation token from the emailed accept link. Only its SHA-256 hash is stored server-side; the plaintext is shown exactly once, in the email. */
6903
+ WorkspaceInvitationToken: string;
6774
6904
  /** @description Privacy request id (`tai_privacy_requests.id`). */
6775
6905
  PrivacyRequestId: string;
6776
6906
  FixId: string;
@@ -6836,6 +6966,11 @@ export type TeamMemberDto = components['schemas']['TeamMemberDto'];
6836
6966
  export type TeamMemberListDto = components['schemas']['TeamMemberListDto'];
6837
6967
  export type InviteTeamMemberBodyDto = components['schemas']['InviteTeamMemberBodyDto'];
6838
6968
  export type UpdateTeamMemberRoleBodyDto = components['schemas']['UpdateTeamMemberRoleBodyDto'];
6969
+ export type WorkspaceInvitationStatusDto = components['schemas']['WorkspaceInvitationStatusDto'];
6970
+ export type WorkspaceInvitationDto = components['schemas']['WorkspaceInvitationDto'];
6971
+ export type WorkspaceInvitationPreviewDto = components['schemas']['WorkspaceInvitationPreviewDto'];
6972
+ export type WorkspaceInvitationListDto = components['schemas']['WorkspaceInvitationListDto'];
6973
+ export type InviteTeamMemberResultDto = components['schemas']['InviteTeamMemberResultDto'];
6839
6974
  export type EraseInsightsPersonBodyDto = components['schemas']['EraseInsightsPersonBodyDto'];
6840
6975
  export type EraseInsightsPersonResultDto = components['schemas']['EraseInsightsPersonResultDto'];
6841
6976
  export type OrgChartNodeDto = components['schemas']['OrgChartNodeDto'];
@@ -7182,6 +7317,7 @@ export type ParameterProviderSlug = components['parameters']['ProviderSlug'];
7182
7317
  export type ParameterProjectId = components['parameters']['ProjectId'];
7183
7318
  export type ParameterNotificationId = components['parameters']['NotificationId'];
7184
7319
  export type ParameterWorkspaceMemberId = components['parameters']['WorkspaceMemberId'];
7320
+ export type ParameterWorkspaceInvitationToken = components['parameters']['WorkspaceInvitationToken'];
7185
7321
  export type ParameterPrivacyRequestId = components['parameters']['PrivacyRequestId'];
7186
7322
  export type ParameterFixId = components['parameters']['FixId'];
7187
7323
  export type ParameterInsightsProductivityRangeId = components['parameters']['InsightsProductivityRangeId'];
@@ -8225,13 +8361,13 @@ export interface operations {
8225
8361
  };
8226
8362
  };
8227
8363
  responses: {
8228
- /** @description Invited member row */
8364
+ /** @description Pending invitation, or the existing member row when already a member */
8229
8365
  201: {
8230
8366
  headers: {
8231
8367
  [name: string]: unknown;
8232
8368
  };
8233
8369
  content: {
8234
- "application/json": components["schemas"]["TeamMemberDto"];
8370
+ "application/json": components["schemas"]["InviteTeamMemberResultDto"];
8235
8371
  };
8236
8372
  };
8237
8373
  /** @description Invalid email or role */
@@ -8360,6 +8496,191 @@ export interface operations {
8360
8496
  };
8361
8497
  };
8362
8498
  };
8499
+ listWorkspaceInvitations: {
8500
+ parameters: {
8501
+ query?: never;
8502
+ header?: never;
8503
+ path: {
8504
+ workspaceId: components["parameters"]["WorkspaceId"];
8505
+ };
8506
+ cookie?: never;
8507
+ };
8508
+ requestBody?: never;
8509
+ responses: {
8510
+ /** @description Pending invitations */
8511
+ 200: {
8512
+ headers: {
8513
+ [name: string]: unknown;
8514
+ };
8515
+ content: {
8516
+ "application/json": components["schemas"]["WorkspaceInvitationListDto"];
8517
+ };
8518
+ };
8519
+ 401: components["responses"]["Unauthorized"];
8520
+ 403: components["responses"]["Forbidden"];
8521
+ /** @description Workspace does not exist or malformed workspaceId */
8522
+ 404: {
8523
+ headers: {
8524
+ [name: string]: unknown;
8525
+ };
8526
+ content: {
8527
+ "application/json": components["schemas"]["ErrorMessageDto"];
8528
+ };
8529
+ };
8530
+ };
8531
+ };
8532
+ getWorkspaceInvitationPreview: {
8533
+ parameters: {
8534
+ query?: never;
8535
+ header?: never;
8536
+ path: {
8537
+ /** @description Opaque workspace invitation token from the emailed accept link. Only its SHA-256 hash is stored server-side; the plaintext is shown exactly once, in the email. */
8538
+ token: components["parameters"]["WorkspaceInvitationToken"];
8539
+ };
8540
+ cookie?: never;
8541
+ };
8542
+ requestBody?: never;
8543
+ responses: {
8544
+ /** @description Invitation preview */
8545
+ 200: {
8546
+ headers: {
8547
+ [name: string]: unknown;
8548
+ };
8549
+ content: {
8550
+ "application/json": components["schemas"]["WorkspaceInvitationPreviewDto"];
8551
+ };
8552
+ };
8553
+ /** @description Unknown or no longer available invitation */
8554
+ 404: {
8555
+ headers: {
8556
+ [name: string]: unknown;
8557
+ };
8558
+ content: {
8559
+ "application/json": components["schemas"]["ErrorMessageDto"];
8560
+ };
8561
+ };
8562
+ };
8563
+ };
8564
+ acceptWorkspaceInvitation: {
8565
+ parameters: {
8566
+ query?: never;
8567
+ header?: never;
8568
+ path: {
8569
+ /** @description Opaque workspace invitation token from the emailed accept link. Only its SHA-256 hash is stored server-side; the plaintext is shown exactly once, in the email. */
8570
+ token: components["parameters"]["WorkspaceInvitationToken"];
8571
+ };
8572
+ cookie?: never;
8573
+ };
8574
+ requestBody?: never;
8575
+ responses: {
8576
+ /** @description Invitation accepted; caller is now a workspace member */
8577
+ 200: {
8578
+ headers: {
8579
+ [name: string]: unknown;
8580
+ };
8581
+ content: {
8582
+ "application/json": components["schemas"]["WorkspaceInvitationDto"];
8583
+ };
8584
+ };
8585
+ 401: components["responses"]["Unauthorized"];
8586
+ /** @description Signed-in email does not match the invited email */
8587
+ 403: {
8588
+ headers: {
8589
+ [name: string]: unknown;
8590
+ };
8591
+ content: {
8592
+ "application/json": components["schemas"]["ErrorMessageDto"];
8593
+ };
8594
+ };
8595
+ /** @description Unknown invitation token */
8596
+ 404: {
8597
+ headers: {
8598
+ [name: string]: unknown;
8599
+ };
8600
+ content: {
8601
+ "application/json": components["schemas"]["ErrorMessageDto"];
8602
+ };
8603
+ };
8604
+ /** @description Invitation is no longer actionable */
8605
+ 409: {
8606
+ headers: {
8607
+ [name: string]: unknown;
8608
+ };
8609
+ content: {
8610
+ "application/json": components["schemas"]["ErrorMessageDto"];
8611
+ };
8612
+ };
8613
+ /** @description Invitation expired */
8614
+ 410: {
8615
+ headers: {
8616
+ [name: string]: unknown;
8617
+ };
8618
+ content: {
8619
+ "application/json": components["schemas"]["ErrorMessageDto"];
8620
+ };
8621
+ };
8622
+ };
8623
+ };
8624
+ rejectWorkspaceInvitation: {
8625
+ parameters: {
8626
+ query?: never;
8627
+ header?: never;
8628
+ path: {
8629
+ /** @description Opaque workspace invitation token from the emailed accept link. Only its SHA-256 hash is stored server-side; the plaintext is shown exactly once, in the email. */
8630
+ token: components["parameters"]["WorkspaceInvitationToken"];
8631
+ };
8632
+ cookie?: never;
8633
+ };
8634
+ requestBody?: never;
8635
+ responses: {
8636
+ /** @description Invitation declined */
8637
+ 200: {
8638
+ headers: {
8639
+ [name: string]: unknown;
8640
+ };
8641
+ content: {
8642
+ "application/json": components["schemas"]["WorkspaceInvitationDto"];
8643
+ };
8644
+ };
8645
+ 401: components["responses"]["Unauthorized"];
8646
+ /** @description Signed-in email does not match the invited email */
8647
+ 403: {
8648
+ headers: {
8649
+ [name: string]: unknown;
8650
+ };
8651
+ content: {
8652
+ "application/json": components["schemas"]["ErrorMessageDto"];
8653
+ };
8654
+ };
8655
+ /** @description Unknown invitation token */
8656
+ 404: {
8657
+ headers: {
8658
+ [name: string]: unknown;
8659
+ };
8660
+ content: {
8661
+ "application/json": components["schemas"]["ErrorMessageDto"];
8662
+ };
8663
+ };
8664
+ /** @description Invitation was already accepted */
8665
+ 409: {
8666
+ headers: {
8667
+ [name: string]: unknown;
8668
+ };
8669
+ content: {
8670
+ "application/json": components["schemas"]["ErrorMessageDto"];
8671
+ };
8672
+ };
8673
+ /** @description Invitation expired */
8674
+ 410: {
8675
+ headers: {
8676
+ [name: string]: unknown;
8677
+ };
8678
+ content: {
8679
+ "application/json": components["schemas"]["ErrorMessageDto"];
8680
+ };
8681
+ };
8682
+ };
8683
+ };
8363
8684
  getWorkspaceOrgChartStatus: {
8364
8685
  parameters: {
8365
8686
  query?: never;