@company-semantics/contracts 0.118.0 → 0.119.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@company-semantics/contracts",
3
- "version": "0.118.0",
3
+ "version": "0.119.0",
4
4
  "private": false,
5
5
  "repository": {
6
6
  "type": "git",
@@ -56,13 +56,8 @@ export interface paths {
56
56
  };
57
57
  get?: never;
58
58
  put?: never;
59
- /**
60
- * Start passwordless auth flow
61
- * @description Initiates passwordless authentication by generating and sending an OTP to the provided email.
62
- * Rate limited per email (3/15min) and per IP (20/hour).
63
- * If the user's org requires SSO, returns SSO_REQUIRED error with redirect info.
64
- */
65
- post: operations["startAuth"];
59
+ /** Start passwordless auth flow */
60
+ post: operations["authStart"];
66
61
  delete?: never;
67
62
  options?: never;
68
63
  head?: never;
@@ -78,12 +73,7 @@ export interface paths {
78
73
  };
79
74
  get?: never;
80
75
  put?: never;
81
- /**
82
- * Verify OTP and create session
83
- * @description Verifies the OTP code and creates a session.
84
- * Sets an httpOnly session cookie on success.
85
- * Rate limited per email (5/10min) and per IP (20/hour).
86
- */
76
+ /** Verify OTP and create session */
87
77
  post: operations["verifyAuth"];
88
78
  delete?: never;
89
79
  options?: never;
@@ -100,12 +90,7 @@ export interface paths {
100
90
  };
101
91
  get?: never;
102
92
  put?: never;
103
- /**
104
- * Revoke session and clear cookie
105
- * @description Revokes the current session and clears the session cookie.
106
- * Safe to call without auth (clears cookie regardless).
107
- * Requires X-Requested-With header for CSRF protection.
108
- */
93
+ /** Revoke session and clear cookie */
109
94
  post: operations["logout"];
110
95
  delete?: never;
111
96
  options?: never;
@@ -120,11 +105,7 @@ export interface paths {
120
105
  path?: never;
121
106
  cookie?: never;
122
107
  };
123
- /**
124
- * Get current authenticated user
125
- * @description Returns the current user's authentication info.
126
- * Requires valid session cookie.
127
- */
108
+ /** Get current authenticated user */
128
109
  get: operations["getAuthMe"];
129
110
  put?: never;
130
111
  post?: never;
@@ -141,11 +122,7 @@ export interface paths {
141
122
  path?: never;
142
123
  cookie?: never;
143
124
  };
144
- /**
145
- * Initiate SSO flow for organization
146
- * @description Initiates SSO flow for an organization.
147
- * Validates org exists and has SSO configured, generates state token, and redirects to IdP.
148
- */
125
+ /** Initiate SSO flow for organization */
149
126
  get: operations["initiateSso"];
150
127
  put?: never;
151
128
  post?: never;
@@ -162,20 +139,10 @@ export interface paths {
162
139
  path?: never;
163
140
  cookie?: never;
164
141
  };
165
- /**
166
- * OIDC callback endpoint
167
- * @description Handles OIDC callback from identity providers.
168
- * Validates state, exchanges code for tokens, creates session.
169
- * Redirects to return URL or login page on error.
170
- */
142
+ /** OIDC callback endpoint */
171
143
  get: operations["handleOidcCallback"];
172
144
  put?: never;
173
- /**
174
- * SAML callback endpoint
175
- * @description Handles SAML callback from identity providers.
176
- * Validates RelayState, processes SAML assertion, creates session.
177
- * Redirects to return URL or login page on error.
178
- */
145
+ /** SAML callback endpoint */
179
146
  post: operations["handleSamlCallback"];
180
147
  delete?: never;
181
148
  options?: never;
@@ -190,11 +157,7 @@ export interface paths {
190
157
  path?: never;
191
158
  cookie?: never;
192
159
  };
193
- /**
194
- * Get current user and org context
195
- * @description Returns the current user's identity fields and organization context.
196
- * Identity is resolved via request context (DEV_ORG_ID in dev, session in production).
197
- */
160
+ /** Get current user and org context */
198
161
  get: operations["getCurrentUser"];
199
162
  put?: never;
200
163
  post?: never;
@@ -217,12 +180,7 @@ export interface paths {
217
180
  delete?: never;
218
181
  options?: never;
219
182
  head?: never;
220
- /**
221
- * Update current user's profile
222
- * @description Updates the current user's name fields.
223
- * At least one field must be provided.
224
- * displayName is computed at read time and cannot be set directly.
225
- */
183
+ /** Update current user profile */
226
184
  patch: operations["updateUserProfile"];
227
185
  trace?: never;
228
186
  };
@@ -317,11 +275,7 @@ export interface paths {
317
275
  };
318
276
  get?: never;
319
277
  put?: never;
320
- /**
321
- * Resync user avatar from Slack
322
- * @description Manually resync the current user's avatar from their Slack profile.
323
- * Requires user to have a linked Slack identity and the org to have an active Slack connection.
324
- */
278
+ /** Resync Slack avatar */
325
279
  post: operations["resyncSlackAvatar"];
326
280
  delete?: never;
327
281
  options?: never;
@@ -336,11 +290,7 @@ export interface paths {
336
290
  path?: never;
337
291
  cookie?: never;
338
292
  };
339
- /**
340
- * Initiate OAuth flow
341
- * @description Creates a pending connection and redirects to the OAuth provider's consent screen.
342
- * Replaces raw OAuth URLs with first-party redirect for trust and tracking.
343
- */
293
+ /** Initiate OAuth flow */
344
294
  get: operations["initiateOAuth"];
345
295
  put?: never;
346
296
  post?: never;
@@ -357,12 +307,7 @@ export interface paths {
357
307
  path?: never;
358
308
  cookie?: never;
359
309
  };
360
- /**
361
- * OAuth callback handler
362
- * @description Handles the OAuth callback from providers.
363
- * Verifies state, exchanges code for tokens, stores encrypted tokens.
364
- * Returns HTML success or error page.
365
- */
310
+ /** OAuth callback handler */
366
311
  get: operations["handleOAuthCallback"];
367
312
  put?: never;
368
313
  post?: never;
@@ -2352,46 +2297,45 @@ export interface components {
2352
2297
  MeResponse: {
2353
2298
  /** Format: uuid */
2354
2299
  userId: string;
2355
- /** Format: email */
2356
2300
  email: string;
2357
2301
  fullName: string;
2358
- preferredName?: string | null;
2359
- /** @description Computed at read time (preferredName ?? fullName) */
2302
+ preferredName: string | null;
2360
2303
  displayName: string;
2361
2304
  /** @enum {string} */
2362
2305
  nameSource: "self" | "sso";
2363
2306
  nameEditable: boolean;
2364
2307
  primaryDepartmentId: string | null;
2365
2308
  slackUserId: string | null;
2366
- avatar: components["schemas"]["ResolvedAvatar"];
2309
+ avatar: {
2310
+ /** @enum {string} */
2311
+ source: "slack" | "initials";
2312
+ url?: string;
2313
+ initials: string;
2314
+ };
2367
2315
  /** Format: uuid */
2368
2316
  orgId: string;
2369
2317
  orgName: string | null;
2370
2318
  orgSlug: string;
2371
- /** @enum {string} */
2372
- plan: "free" | "pro" | "enterprise";
2319
+ plan: string;
2373
2320
  hasMultipleOrgs: boolean;
2374
2321
  isInternalAdmin: boolean;
2375
2322
  };
2376
- /** @description At least one field must be provided */
2377
2323
  ProfileUpdateRequest: {
2378
- firstName?: string;
2379
- lastName?: string | null;
2380
2324
  fullName?: string;
2381
- /** @description Cannot contain control characters, newlines, or quotes */
2382
2325
  preferredName?: string | null;
2326
+ primaryDepartmentId?: string | null;
2383
2327
  };
2384
2328
  ProfileUpdateResponse: {
2385
2329
  /** @constant */
2386
2330
  success: true;
2387
2331
  user: {
2388
- /** Format: uuid */
2389
2332
  id: string;
2390
- firstName: string;
2391
- lastName?: string | null;
2392
2333
  fullName: string;
2393
- preferredName?: string | null;
2334
+ preferredName: string | null;
2394
2335
  displayName: string;
2336
+ /** @enum {string} */
2337
+ nameSource: "self" | "sso";
2338
+ primaryDepartmentId: string | null;
2395
2339
  };
2396
2340
  };
2397
2341
  ResyncSlackLogoResponse: {
@@ -2906,25 +2850,47 @@ export interface components {
2906
2850
  truncated: boolean;
2907
2851
  };
2908
2852
  AuthStartRequest: {
2909
- /**
2910
- * Format: email
2911
- * @description Email address for OTP delivery
2912
- */
2853
+ /** Format: email */
2913
2854
  email: string;
2914
2855
  };
2915
2856
  AuthStartResponse: {
2916
2857
  /** @constant */
2917
- ok: true;
2858
+ mode: "otp";
2859
+ devOtp?: string;
2860
+ } | {
2861
+ /** @constant */
2862
+ mode: "sso";
2863
+ providers: string[];
2864
+ redirectUrl: string;
2865
+ } | {
2866
+ /** @constant */
2867
+ mode: "hybrid";
2868
+ providers: string[];
2869
+ redirectUrl: string;
2870
+ /** @constant */
2871
+ otpAllowed: true;
2872
+ devOtp?: string;
2918
2873
  };
2919
2874
  AuthVerifyRequest: {
2920
2875
  /** Format: email */
2921
2876
  email: string;
2922
- /** @description 6-digit OTP code */
2923
2877
  code: string;
2878
+ inviteToken?: string;
2924
2879
  };
2925
2880
  AuthVerifyResponse: {
2881
+ /** @constant */
2882
+ success: true;
2926
2883
  /** @constant */
2927
2884
  ok: true;
2885
+ } | {
2886
+ /** @constant */
2887
+ success: true;
2888
+ /** @constant */
2889
+ ok: true;
2890
+ /** @constant */
2891
+ acceptedInvite: true;
2892
+ orgId: string;
2893
+ role: string;
2928
2894
  };
2929
2895
  OkResponse: {
2930
2896
  /** @constant */
@@ -2952,9 +2918,7 @@ export interface components {
2952
2918
  orgSlug: string;
2953
2919
  };
2954
2920
  SamlCallbackRequest: {
2955
- /** @description Base64-encoded SAML assertion */
2956
2921
  SAMLResponse: string;
2957
- /** @description State token for CSRF protection */
2958
2922
  RelayState: string;
2959
2923
  };
2960
2924
  InitiateTransferRequest: {
@@ -3409,6 +3373,12 @@ export interface components {
3409
3373
  /** @description Organization name (present when invite is valid) */
3410
3374
  orgName?: string;
3411
3375
  };
3376
+ LogoutResponse: {
3377
+ /** @constant */
3378
+ success: true;
3379
+ /** @constant */
3380
+ ok: true;
3381
+ };
3412
3382
  };
3413
3383
  responses: never;
3414
3384
  parameters: never;
@@ -3458,7 +3428,7 @@ export interface operations {
3458
3428
  };
3459
3429
  };
3460
3430
  };
3461
- startAuth: {
3431
+ authStart: {
3462
3432
  parameters: {
3463
3433
  query?: never;
3464
3434
  header?: never;
@@ -3471,7 +3441,7 @@ export interface operations {
3471
3441
  };
3472
3442
  };
3473
3443
  responses: {
3474
- /** @description OTP sent successfully */
3444
+ /** @description Auth mode resolved; OTP sent when applicable */
3475
3445
  200: {
3476
3446
  headers: {
3477
3447
  [name: string]: unknown;
@@ -3480,33 +3450,6 @@ export interface operations {
3480
3450
  "application/json": components["schemas"]["AuthStartResponse"];
3481
3451
  };
3482
3452
  };
3483
- /** @description Validation error (invalid email format) */
3484
- 400: {
3485
- headers: {
3486
- [name: string]: unknown;
3487
- };
3488
- content: {
3489
- "application/json": components["schemas"]["ErrorResponse"];
3490
- };
3491
- };
3492
- /** @description SSO required for this user's organization */
3493
- 409: {
3494
- headers: {
3495
- [name: string]: unknown;
3496
- };
3497
- content: {
3498
- "application/json": components["schemas"]["SSORequiredErrorResponse"];
3499
- };
3500
- };
3501
- /** @description Rate limit exceeded */
3502
- 429: {
3503
- headers: {
3504
- [name: string]: unknown;
3505
- };
3506
- content: {
3507
- "application/json": components["schemas"]["ErrorResponse"];
3508
- };
3509
- };
3510
3453
  };
3511
3454
  };
3512
3455
  verifyAuth: {
@@ -3522,7 +3465,7 @@ export interface operations {
3522
3465
  };
3523
3466
  };
3524
3467
  responses: {
3525
- /** @description Authentication successful, session cookie set */
3468
+ /** @description Session created; cookie set */
3526
3469
  200: {
3527
3470
  headers: {
3528
3471
  [name: string]: unknown;
@@ -3531,24 +3474,6 @@ export interface operations {
3531
3474
  "application/json": components["schemas"]["AuthVerifyResponse"];
3532
3475
  };
3533
3476
  };
3534
- /** @description Validation error or invalid/expired OTP */
3535
- 400: {
3536
- headers: {
3537
- [name: string]: unknown;
3538
- };
3539
- content: {
3540
- "application/json": components["schemas"]["OTPErrorResponse"];
3541
- };
3542
- };
3543
- /** @description Rate limit exceeded */
3544
- 429: {
3545
- headers: {
3546
- [name: string]: unknown;
3547
- };
3548
- content: {
3549
- "application/json": components["schemas"]["ErrorResponse"];
3550
- };
3551
- };
3552
3477
  };
3553
3478
  };
3554
3479
  logout: {
@@ -3560,22 +3485,13 @@ export interface operations {
3560
3485
  };
3561
3486
  requestBody?: never;
3562
3487
  responses: {
3563
- /** @description Session revoked successfully */
3488
+ /** @description Session revoked; cookie cleared */
3564
3489
  200: {
3565
3490
  headers: {
3566
3491
  [name: string]: unknown;
3567
3492
  };
3568
3493
  content: {
3569
- "application/json": components["schemas"]["OkResponse"];
3570
- };
3571
- };
3572
- /** @description Missing CSRF header */
3573
- 403: {
3574
- headers: {
3575
- [name: string]: unknown;
3576
- };
3577
- content: {
3578
- "application/json": components["schemas"]["ErrorResponse"];
3494
+ "application/json": components["schemas"]["LogoutResponse"];
3579
3495
  };
3580
3496
  };
3581
3497
  };
@@ -3594,32 +3510,17 @@ export interface operations {
3594
3510
  headers: {
3595
3511
  [name: string]: unknown;
3596
3512
  };
3597
- content: {
3598
- "application/json": components["schemas"]["AuthMeResponse"];
3599
- };
3600
- };
3601
- /** @description Not authenticated */
3602
- 401: {
3603
- headers: {
3604
- [name: string]: unknown;
3605
- };
3606
- content: {
3607
- "application/json": components["schemas"]["ErrorResponse"];
3608
- };
3513
+ content?: never;
3609
3514
  };
3610
3515
  };
3611
3516
  };
3612
3517
  initiateSso: {
3613
3518
  parameters: {
3614
3519
  query?: {
3615
- /** @description URL to redirect after successful auth (validated against allowlist) */
3616
3520
  return_to?: string;
3617
3521
  };
3618
3522
  header?: never;
3619
- path: {
3620
- /** @description Organization slug */
3621
- orgSlug: string;
3622
- };
3523
+ path?: never;
3623
3524
  cookie?: never;
3624
3525
  };
3625
3526
  requestBody?: never;
@@ -3627,42 +3528,18 @@ export interface operations {
3627
3528
  /** @description Redirect to identity provider */
3628
3529
  302: {
3629
3530
  headers: {
3630
- /** @description Identity provider authorization URL */
3631
- Location?: string;
3632
3531
  [name: string]: unknown;
3633
3532
  };
3634
3533
  content?: never;
3635
3534
  };
3636
- /** @description SSO not configured for organization */
3637
- 400: {
3638
- headers: {
3639
- [name: string]: unknown;
3640
- };
3641
- content: {
3642
- "application/json": components["schemas"]["ErrorResponse"];
3643
- };
3644
- };
3645
- /** @description Organization not found */
3646
- 404: {
3647
- headers: {
3648
- [name: string]: unknown;
3649
- };
3650
- content: {
3651
- "application/json": components["schemas"]["ErrorResponse"];
3652
- };
3653
- };
3654
3535
  };
3655
3536
  };
3656
3537
  handleOidcCallback: {
3657
3538
  parameters: {
3658
3539
  query?: {
3659
- /** @description Authorization code from IdP */
3660
3540
  code?: string;
3661
- /** @description State token for CSRF protection */
3662
3541
  state?: string;
3663
- /** @description Error code if auth failed at IdP */
3664
3542
  error?: string;
3665
- /** @description Human-readable error description */
3666
3543
  error_description?: string;
3667
3544
  };
3668
3545
  header?: never;
@@ -3674,20 +3551,10 @@ export interface operations {
3674
3551
  /** @description Redirect to return URL or login page */
3675
3552
  302: {
3676
3553
  headers: {
3677
- Location?: string;
3678
3554
  [name: string]: unknown;
3679
3555
  };
3680
3556
  content?: never;
3681
3557
  };
3682
- /** @description Invalid callback parameters */
3683
- 400: {
3684
- headers: {
3685
- [name: string]: unknown;
3686
- };
3687
- content: {
3688
- "application/json": components["schemas"]["ErrorResponse"];
3689
- };
3690
- };
3691
3558
  };
3692
3559
  };
3693
3560
  handleSamlCallback: {
@@ -3706,20 +3573,10 @@ export interface operations {
3706
3573
  /** @description Redirect to return URL or login page */
3707
3574
  302: {
3708
3575
  headers: {
3709
- Location?: string;
3710
3576
  [name: string]: unknown;
3711
3577
  };
3712
3578
  content?: never;
3713
3579
  };
3714
- /** @description Invalid callback parameters */
3715
- 400: {
3716
- headers: {
3717
- [name: string]: unknown;
3718
- };
3719
- content: {
3720
- "application/json": components["schemas"]["ErrorResponse"];
3721
- };
3722
- };
3723
3580
  };
3724
3581
  };
3725
3582
  getCurrentUser: {
@@ -3740,24 +3597,6 @@ export interface operations {
3740
3597
  "application/json": components["schemas"]["MeResponse"];
3741
3598
  };
3742
3599
  };
3743
- /** @description User or organization not found */
3744
- 404: {
3745
- headers: {
3746
- [name: string]: unknown;
3747
- };
3748
- content: {
3749
- "application/json": components["schemas"]["ErrorResponse"];
3750
- };
3751
- };
3752
- /** @description Configuration error (e.g., missing DEV_ORG_ID) */
3753
- 500: {
3754
- headers: {
3755
- [name: string]: unknown;
3756
- };
3757
- content: {
3758
- "application/json": components["schemas"]["ErrorResponse"];
3759
- };
3760
- };
3761
3600
  };
3762
3601
  };
3763
3602
  updateUserProfile: {
@@ -3782,24 +3621,6 @@ export interface operations {
3782
3621
  "application/json": components["schemas"]["ProfileUpdateResponse"];
3783
3622
  };
3784
3623
  };
3785
- /** @description Validation error */
3786
- 400: {
3787
- headers: {
3788
- [name: string]: unknown;
3789
- };
3790
- content: {
3791
- "application/json": components["schemas"]["ValidationErrorResponse"];
3792
- };
3793
- };
3794
- /** @description User not found */
3795
- 404: {
3796
- headers: {
3797
- [name: string]: unknown;
3798
- };
3799
- content: {
3800
- "application/json": components["schemas"]["ErrorResponse"];
3801
- };
3802
- };
3803
3624
  };
3804
3625
  };
3805
3626
  listUserOrgs: {
@@ -3969,124 +3790,55 @@ export interface operations {
3969
3790
  headers: {
3970
3791
  [name: string]: unknown;
3971
3792
  };
3972
- content: {
3973
- "application/json": components["schemas"]["ResyncSlackAvatarResponse"];
3974
- };
3975
- };
3976
- /** @description Not authenticated */
3977
- 401: {
3978
- headers: {
3979
- [name: string]: unknown;
3980
- };
3981
- content: {
3982
- "application/json": components["schemas"]["ErrorResponse"];
3983
- };
3984
- };
3985
- /** @description User not found */
3986
- 404: {
3987
- headers: {
3988
- [name: string]: unknown;
3989
- };
3990
- content: {
3991
- "application/json": components["schemas"]["ErrorResponse"];
3992
- };
3993
- };
3994
- /** @description Rate limit exceeded */
3995
- 429: {
3996
- headers: {
3997
- [name: string]: unknown;
3998
- };
3999
- content: {
4000
- "application/json": components["schemas"]["ErrorResponse"];
4001
- };
3793
+ content?: never;
4002
3794
  };
4003
3795
  };
4004
3796
  };
4005
3797
  initiateOAuth: {
4006
3798
  parameters: {
4007
- query?: {
4008
- /**
4009
- * @deprecated
4010
- * @description DEPRECATED: Organization ID derived from session.
4011
- * Query parameter accepted only in dev mode for backwards compatibility.
4012
- * Production: orgId is always derived from authenticated session.
4013
- */
4014
- orgId?: string;
4015
- };
3799
+ query?: never;
4016
3800
  header?: never;
4017
- path: {
4018
- provider: components["schemas"]["OAuthProvider"];
4019
- };
3801
+ path?: never;
4020
3802
  cookie?: never;
4021
3803
  };
4022
3804
  requestBody?: never;
4023
3805
  responses: {
4024
- /** @description Redirect to OAuth provider */
3806
+ /** @description Redirect to OAuth provider consent screen */
4025
3807
  302: {
4026
3808
  headers: {
4027
- /** @description OAuth provider authorization URL */
4028
- Location?: string;
4029
3809
  [name: string]: unknown;
4030
3810
  };
4031
3811
  content?: never;
4032
3812
  };
4033
- /** @description Invalid provider or missing/invalid orgId */
4034
- 400: {
4035
- headers: {
4036
- [name: string]: unknown;
4037
- };
4038
- content: {
4039
- "application/json": components["schemas"]["ErrorResponse"];
4040
- };
4041
- };
4042
- /** @description OAuth initialization failed */
4043
- 500: {
4044
- headers: {
4045
- [name: string]: unknown;
4046
- };
4047
- content: {
4048
- "application/json": components["schemas"]["ErrorResponse"];
4049
- };
4050
- };
4051
3813
  };
4052
3814
  };
4053
3815
  handleOAuthCallback: {
4054
3816
  parameters: {
4055
3817
  query?: {
4056
- /** @description Authorization code from provider */
4057
3818
  code?: string;
4058
- /** @description State token for CSRF protection */
4059
3819
  state?: string;
4060
- /** @description Error code from provider (if authorization denied) */
4061
3820
  error?: string;
4062
- /** @description Human-readable error description from provider */
4063
3821
  error_description?: string;
4064
3822
  };
4065
3823
  header?: never;
4066
- path: {
4067
- provider: components["schemas"]["OAuthProvider"];
4068
- };
3824
+ path?: never;
4069
3825
  cookie?: never;
4070
3826
  };
4071
3827
  requestBody?: never;
4072
3828
  responses: {
4073
- /** @description Authorization successful (HTML page) */
3829
+ /** @description HTML success or error page (for popup flows) */
4074
3830
  200: {
4075
3831
  headers: {
4076
3832
  [name: string]: unknown;
4077
3833
  };
4078
- content: {
4079
- "text/html": string;
4080
- };
3834
+ content?: never;
4081
3835
  };
4082
- /** @description Authorization failed or invalid request (HTML page) */
4083
- 400: {
3836
+ /** @description Redirect to return URL on success */
3837
+ 302: {
4084
3838
  headers: {
4085
3839
  [name: string]: unknown;
4086
3840
  };
4087
- content: {
4088
- "text/html": string;
4089
- };
3841
+ content?: never;
4090
3842
  };
4091
3843
  };
4092
3844
  };
package/src/chat/index.ts CHANGED
@@ -38,6 +38,14 @@ export type {
38
38
  ChatInvalidationEvent,
39
39
  // SSE event unions
40
40
  ChatSseEvent,
41
+ // HTTP response types
42
+ ChatSuccessResponse,
43
+ ChatByInteractionResponse,
44
+ ChatListResponse,
45
+ CreateChatResponse,
46
+ CreateShareResponse,
47
+ ListSharesResponse,
48
+ UpdateShareResponse,
41
49
  } from './types'
42
50
 
43
51
  // =============================================================================
@@ -65,6 +73,14 @@ export {
65
73
  ChatDomainEventSchema,
66
74
  ChatInvalidationEventSchema,
67
75
  ChatSseEventSchema,
76
+ // HTTP response schemas
77
+ ChatSuccessResponseSchema,
78
+ ChatByInteractionResponseSchema,
79
+ ChatListResponseSchema,
80
+ CreateChatResponseSchema,
81
+ CreateShareResponseSchema,
82
+ ListSharesResponseSchema,
83
+ UpdateShareResponseSchema,
68
84
  } from './schemas'
69
85
 
70
86
  // Runtime profile types and constants
@@ -152,3 +152,43 @@ export const ChatSseEventSchema = z.discriminatedUnion('type', [
152
152
  InvalidateChatEventSchema,
153
153
  InvalidateChatListEventSchema,
154
154
  ])
155
+
156
+ // =============================================================================
157
+ // HTTP Response Schemas
158
+ // =============================================================================
159
+
160
+ /** Generic success confirmation for mutations that return no entity data. */
161
+ export const ChatSuccessResponseSchema = z.object({
162
+ success: z.literal(true),
163
+ })
164
+
165
+ /** Response for GET /api/chats/by-interaction/:interactionId */
166
+ export const ChatByInteractionResponseSchema = z.object({
167
+ chatId: z.string(),
168
+ })
169
+
170
+ /** Response for GET /api/chats */
171
+ export const ChatListResponseSchema = z.object({
172
+ chats: z.array(ChatSummaryExtendedSchema),
173
+ })
174
+
175
+ /** Response for POST /api/chats */
176
+ export const CreateChatResponseSchema = z.object({
177
+ chat: ChatSummaryExtendedSchema,
178
+ })
179
+
180
+ /** Response for POST /api/chats/:chatId/shares */
181
+ export const CreateShareResponseSchema = z.object({
182
+ share: ChatShareInfoSchema,
183
+ shareUrl: z.string(),
184
+ })
185
+
186
+ /** Response for GET /api/chats/:chatId/shares */
187
+ export const ListSharesResponseSchema = z.object({
188
+ shares: z.array(ChatShareInfoSchema),
189
+ })
190
+
191
+ /** Response for PATCH /api/shares/:shareId */
192
+ export const UpdateShareResponseSchema = z.object({
193
+ share: ChatShareInfoSchema,
194
+ })
package/src/chat/types.ts CHANGED
@@ -27,6 +27,13 @@ import {
27
27
  ChatDomainEventSchema,
28
28
  ChatInvalidationEventSchema,
29
29
  ChatSseEventSchema,
30
+ ChatSuccessResponseSchema,
31
+ ChatByInteractionResponseSchema,
32
+ ChatListResponseSchema,
33
+ CreateChatResponseSchema,
34
+ CreateShareResponseSchema,
35
+ ListSharesResponseSchema,
36
+ UpdateShareResponseSchema,
30
37
  } from './schemas'
31
38
 
32
39
  // =============================================================================
@@ -227,3 +234,28 @@ export type ChatInvalidationEvent = z.infer<typeof ChatInvalidationEventSchema>
227
234
  * Client receives these via SSE and handles accordingly.
228
235
  */
229
236
  export type ChatSseEvent = z.infer<typeof ChatSseEventSchema>
237
+
238
+ // =============================================================================
239
+ // HTTP Response Types (derived from response schemas)
240
+ // =============================================================================
241
+
242
+ /** Generic mutation success confirmation. */
243
+ export type ChatSuccessResponse = z.infer<typeof ChatSuccessResponseSchema>
244
+
245
+ /** Response for GET /api/chats/by-interaction/:interactionId */
246
+ export type ChatByInteractionResponse = z.infer<typeof ChatByInteractionResponseSchema>
247
+
248
+ /** Response for GET /api/chats */
249
+ export type ChatListResponse = z.infer<typeof ChatListResponseSchema>
250
+
251
+ /** Response for POST /api/chats */
252
+ export type CreateChatResponse = z.infer<typeof CreateChatResponseSchema>
253
+
254
+ /** Response for POST /api/chats/:chatId/shares */
255
+ export type CreateShareResponse = z.infer<typeof CreateShareResponseSchema>
256
+
257
+ /** Response for GET /api/chats/:chatId/shares */
258
+ export type ListSharesResponse = z.infer<typeof ListSharesResponseSchema>
259
+
260
+ /** Response for PATCH /api/shares/:shareId */
261
+ export type UpdateShareResponse = z.infer<typeof UpdateShareResponseSchema>