@liveblocks/react 3.13.0-vincent3 → 3.13.1-hackathon

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.
@@ -2,7 +2,7 @@ import * as react from 'react';
2
2
  import { ComponentType, Context, PropsWithChildren, ReactNode } from 'react';
3
3
  import { BaseUserMeta, Client, JsonObject, LsonObject, LiveObject, User, Json, RoomSubscriptionSettings, Room, Status, BroadcastOptions, OthersEvent, LostConnectionEvent, History, BaseMetadata as BaseMetadata$1, ClientOptions, ThreadData as ThreadData$1, CommentData as CommentData$1 } from '@liveblocks/client';
4
4
  import * as _liveblocks_core from '@liveblocks/core';
5
- import { OpaqueClient, OpaqueRoom, AiKnowledgeSource, AiOpaqueToolDefinition, Relax, AiAssistantContentPart, BaseMetadata, QueryMetadata, AsyncResult, DRI, AsyncSuccess, DGI, GroupData, Resolve, CommentBody, CommentAttachment, PartialUnless, Patchable, InboxNotificationData, NotificationSettings, ToImmutable, MessageId, PartialNotificationSettings, AiChatsQuery, AsyncLoading, AsyncError, ThreadData, SearchCommentsResult, HistoryVersion, AiChat, UrlMetadata, Client as Client$1, LiveblocksError, SyncStatus, RoomEventMessage, CommentData, AiUserMessage, WithRequired, AiChatMessage, WithNavigation, MutableSignal, ThreadDataWithDeleteInfo, ThreadDeleteInfo, SubscriptionKey, SubscriptionData, DerivedSignal, DefaultMap, CommentUserReaction, InboxNotificationDeleteInfo, SubscriptionDeleteInfo, RoomSubscriptionSettings as RoomSubscriptionSettings$1, ISignal, Permission, BaseUserMeta as BaseUserMeta$1, DistributiveOmit, DU, DM, TextEditorType, IYjsProvider, MentionData, DP, DS, DE } from '@liveblocks/core';
5
+ import { OpaqueClient, OpaqueRoom, AiKnowledgeSource, AiOpaqueToolDefinition, Relax, AiAssistantContentPart, BaseMetadata, QueryMetadata, AsyncResult, DRI, AsyncSuccess, DGI, GroupData, Resolve, CommentBody, CommentAttachment, PartialUnless, Patchable, InboxNotificationData, NotificationSettings, ToImmutable, MessageId, PartialNotificationSettings, AiChatsQuery, AsyncLoading, AsyncError, ThreadData, SearchCommentsResult, AgentSession, AgentMessage, HistoryVersion, AiChat, UrlMetadata, Client as Client$1, LiveblocksError, SyncStatus, RoomEventMessage, CommentData, AiUserMessage, WithRequired, AiChatMessage, WithNavigation, MutableSignal, ThreadDataWithDeleteInfo, ThreadDeleteInfo, SubscriptionKey, SubscriptionData, DerivedSignal, DefaultMap, CommentUserReaction, InboxNotificationDeleteInfo, SubscriptionDeleteInfo, RoomSubscriptionSettings as RoomSubscriptionSettings$1, ISignal, Permission, BaseUserMeta as BaseUserMeta$1, DistributiveOmit, DU, DTM, DCM, TextEditorType, IYjsProvider, MentionData, DP, DS, DE } from '@liveblocks/core';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
7
7
 
8
8
  /**
@@ -125,7 +125,7 @@ type UseAiChatsOptions = {
125
125
  */
126
126
  query?: AiChatsQuery;
127
127
  };
128
- type ThreadsQuery<M extends BaseMetadata> = {
128
+ type ThreadsQuery<TM extends BaseMetadata> = {
129
129
  /**
130
130
  * Whether to only return threads marked as resolved or unresolved. If not provided,
131
131
  * all threads will be returned.
@@ -140,21 +140,21 @@ type ThreadsQuery<M extends BaseMetadata> = {
140
140
  * The metadata to filter the threads by. If provided, only threads with metadata that matches
141
141
  * the provided metadata will be returned. If not provided, all threads will be returned.
142
142
  */
143
- metadata?: Partial<QueryMetadata<M>>;
143
+ metadata?: Partial<QueryMetadata<TM>>;
144
144
  };
145
- type UseUserThreadsOptions<M extends BaseMetadata> = {
145
+ type UseUserThreadsOptions<TM extends BaseMetadata> = {
146
146
  /**
147
147
  * The query (including metadata) to filter the threads by. If provided, only threads
148
148
  * that match the query will be returned. If not provided, all threads will be returned.
149
149
  */
150
- query?: ThreadsQuery<M>;
150
+ query?: ThreadsQuery<TM>;
151
151
  };
152
- type UseThreadsOptions<M extends BaseMetadata> = {
152
+ type UseThreadsOptions<TM extends BaseMetadata> = {
153
153
  /**
154
154
  * The query (including metadata) to filter the threads by. If provided, only threads
155
155
  * that match the query will be returned. If not provided, all threads will be returned.
156
156
  */
157
- query?: ThreadsQuery<M>;
157
+ query?: ThreadsQuery<TM>;
158
158
  /**
159
159
  * Whether to scroll to a comment on load based on the URL hash. Defaults to `true`.
160
160
  *
@@ -164,11 +164,11 @@ type UseThreadsOptions<M extends BaseMetadata> = {
164
164
  */
165
165
  scrollOnLoad?: boolean;
166
166
  };
167
- type SearchCommentsQuery<M extends BaseMetadata> = {
167
+ type SearchCommentsQuery<TM extends BaseMetadata> = {
168
168
  /**
169
169
  * (Optional) Metadata to filter the threads by.
170
170
  */
171
- threadMetadata?: Partial<QueryMetadata<M>>;
171
+ threadMetadata?: Partial<QueryMetadata<TM>>;
172
172
  /**
173
173
  * (Optional) Whether to only return comments from threads marked as resolved or unresolved.
174
174
  */
@@ -186,8 +186,8 @@ type SearchCommentsQuery<M extends BaseMetadata> = {
186
186
  */
187
187
  text: string;
188
188
  };
189
- type UseSearchCommentsOptions<M extends BaseMetadata> = {
190
- query: SearchCommentsQuery<M>;
189
+ type UseSearchCommentsOptions<TM extends BaseMetadata> = {
190
+ query: SearchCommentsQuery<TM>;
191
191
  };
192
192
  type InboxNotificationsQuery = {
193
193
  /**
@@ -206,6 +206,26 @@ type UseInboxNotificationsOptions = {
206
206
  */
207
207
  query?: InboxNotificationsQuery;
208
208
  };
209
+ type UseAgentSessionsOptions = {
210
+ /**
211
+ * Optional timestamp filter. Only sessions created or updated after this timestamp will be returned.
212
+ */
213
+ since?: number;
214
+ /**
215
+ * Optional metadata filter. Only sessions with matching metadata will be returned.
216
+ */
217
+ metadata?: Record<string, string>;
218
+ };
219
+ type UseAgentSessionOptions = {
220
+ /**
221
+ * Optional cursor for pagination.
222
+ */
223
+ cursor?: string;
224
+ /**
225
+ * Optional limit for the number of messages to fetch.
226
+ */
227
+ limit?: number;
228
+ };
209
229
  type UserAsyncResult<T> = AsyncResult<T, "user">;
210
230
  type UserAsyncSuccess<T> = AsyncSuccess<T, "user">;
211
231
  type RoomInfoAsyncResult = AsyncResult<DRI, "info">;
@@ -215,26 +235,36 @@ type GroupInfoAsyncSuccess = AsyncSuccess<DGI, "info">;
215
235
  type AttachmentUrlAsyncResult = AsyncResult<string, "url">;
216
236
  type AttachmentUrlAsyncSuccess = AsyncSuccess<string, "url">;
217
237
  type GroupAsyncResult = AsyncResult<GroupData | undefined, "group">;
218
- type CreateThreadOptions<M extends BaseMetadata> = Resolve<{
238
+ type CreateThreadOptions<TM extends BaseMetadata, CM extends BaseMetadata> = Resolve<{
219
239
  body: CommentBody;
220
240
  attachments?: CommentAttachment[];
221
- } & PartialUnless<M, {
222
- metadata: M;
241
+ } & PartialUnless<TM, {
242
+ metadata: TM;
243
+ }> & PartialUnless<CM, {
244
+ commentMetadata: CM;
223
245
  }>>;
224
- type EditThreadMetadataOptions<M extends BaseMetadata> = {
246
+ type EditThreadMetadataOptions<TM extends BaseMetadata> = {
225
247
  threadId: string;
226
- metadata: Patchable<M>;
248
+ metadata: Patchable<TM>;
227
249
  };
228
- type CreateCommentOptions = {
250
+ type CreateCommentOptions<CM extends BaseMetadata> = {
229
251
  threadId: string;
230
252
  body: CommentBody;
231
253
  attachments?: CommentAttachment[];
232
- };
233
- type EditCommentOptions = {
254
+ } & PartialUnless<CM, {
255
+ metadata: CM;
256
+ }>;
257
+ type EditCommentOptions<CM extends BaseMetadata> = {
234
258
  threadId: string;
235
259
  commentId: string;
236
260
  body: CommentBody;
237
261
  attachments?: CommentAttachment[];
262
+ metadata?: Patchable<CM>;
263
+ };
264
+ type EditCommentMetadataOptions<CM extends BaseMetadata> = {
265
+ threadId: string;
266
+ commentId: string;
267
+ metadata: Patchable<CM>;
238
268
  };
239
269
  type DeleteCommentOptions = {
240
270
  threadId: string;
@@ -253,11 +283,15 @@ type PaginationFields = {
253
283
  };
254
284
  type PagedAsyncSuccess<T, F extends string> = Resolve<AsyncSuccess<T, F> & PaginationFields>;
255
285
  type PagedAsyncResult<T, F extends string> = Relax<AsyncLoading<F> | AsyncError<F> | PagedAsyncSuccess<T, F>>;
256
- type ThreadsAsyncSuccess<M extends BaseMetadata> = PagedAsyncSuccess<ThreadData<M>[], "threads">;
257
- type ThreadsAsyncResult<M extends BaseMetadata> = PagedAsyncResult<ThreadData<M>[], "threads">;
286
+ type ThreadsAsyncSuccess<TM extends BaseMetadata, CM extends BaseMetadata> = PagedAsyncSuccess<ThreadData<TM, CM>[], "threads">;
287
+ type ThreadsAsyncResult<TM extends BaseMetadata, CM extends BaseMetadata> = PagedAsyncResult<ThreadData<TM, CM>[], "threads">;
258
288
  type SearchCommentsAsyncResult = AsyncResult<Array<SearchCommentsResult>, "results">;
259
289
  type InboxNotificationsAsyncSuccess = PagedAsyncSuccess<InboxNotificationData[], "inboxNotifications">;
260
290
  type InboxNotificationsAsyncResult = PagedAsyncResult<InboxNotificationData[], "inboxNotifications">;
291
+ type AgentSessionsAsyncSuccess = PagedAsyncSuccess<AgentSession[], "sessions">;
292
+ type AgentSessionsAsyncResult = PagedAsyncResult<AgentSession[], "sessions">;
293
+ type AgentSessionAsyncSuccess = PagedAsyncSuccess<AgentMessage[], "messages">;
294
+ type AgentSessionAsyncResult = PagedAsyncResult<AgentMessage[], "messages">;
261
295
  type UnreadInboxNotificationsCountAsyncSuccess = AsyncSuccess<number, "count">;
262
296
  type UnreadInboxNotificationsCountAsyncResult = AsyncResult<number, "count">;
263
297
  type NotificationSettingsAsyncResult = AsyncResult<NotificationSettings, "settings">;
@@ -493,13 +527,13 @@ type SharedContextBundle<U extends BaseUserMeta> = {
493
527
  /**
494
528
  * Properties that are the same in RoomContext and RoomContext["suspense"].
495
529
  */
496
- type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata> = {
530
+ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, TM extends BaseMetadata, CM extends BaseMetadata> = {
497
531
  /**
498
532
  * You normally don't need to directly interact with the RoomContext, but
499
533
  * it can be necessary if you're building an advanced app where you need to
500
534
  * set up a context bridge between two React renderers.
501
535
  */
502
- RoomContext: Context<Room<P, S, U, E, M> | null>;
536
+ RoomContext: Context<Room<P, S, U, E, TM, CM> | null>;
503
537
  /**
504
538
  * Makes a Room available in the component hierarchy below.
505
539
  * Joins the room when the component is mounted, and automatically leaves
@@ -512,10 +546,10 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
512
546
  */
513
547
  useRoom(options?: {
514
548
  allowOutsideRoom: false;
515
- }): Room<P, S, U, E, M>;
549
+ }): Room<P, S, U, E, TM, CM>;
516
550
  useRoom(options: {
517
551
  allowOutsideRoom: boolean;
518
- }): Room<P, S, U, E, M> | null;
552
+ }): Room<P, S, U, E, TM, CM> | null;
519
553
  /**
520
554
  * Returns the current connection status for the Room, and triggers
521
555
  * a re-render whenever it changes. Can be used to render a status badge.
@@ -786,7 +820,7 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
786
820
  * const createThread = useCreateThread();
787
821
  * createThread({ body: {}, metadata: {} });
788
822
  */
789
- useCreateThread(): (options: CreateThreadOptions<M>) => ThreadData<M>;
823
+ useCreateThread(): (options: CreateThreadOptions<TM, CM>) => ThreadData<TM, CM>;
790
824
  /**
791
825
  * Returns a function that deletes a thread and its associated comments.
792
826
  * Only the thread creator can delete a thread, it will throw otherwise.
@@ -804,7 +838,7 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
804
838
  * const editThreadMetadata = useEditThreadMetadata();
805
839
  * editThreadMetadata({ threadId: "th_xxx", metadata: {} })
806
840
  */
807
- useEditThreadMetadata(): (options: EditThreadMetadataOptions<M>) => void;
841
+ useEditThreadMetadata(): (options: EditThreadMetadataOptions<TM>) => void;
808
842
  /**
809
843
  * Returns a function that marks a thread as resolved.
810
844
  *
@@ -844,15 +878,24 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
844
878
  * const createComment = useCreateComment();
845
879
  * createComment({ threadId: "th_xxx", body: {} });
846
880
  */
847
- useCreateComment(): (options: CreateCommentOptions) => CommentData;
881
+ useCreateComment(): (options: CreateCommentOptions<CM>) => CommentData<CM>;
848
882
  /**
849
- * Returns a function that edits a comment's body.
883
+ * Returns a function that edits a comment.
850
884
  *
851
885
  * @example
852
886
  * const editComment = useEditComment()
853
887
  * editComment({ threadId: "th_xxx", commentId: "cm_xxx", body: {} })
854
888
  */
855
- useEditComment(): (options: EditCommentOptions) => void;
889
+ useEditComment(): (options: EditCommentOptions<CM>) => void;
890
+ /**
891
+ * Returns a function that edits a comment's metadata.
892
+ * To delete an existing metadata property, set its value to `null`.
893
+ *
894
+ * @example
895
+ * const editCommentMetadata = useEditCommentMetadata();
896
+ * editCommentMetadata({ threadId: "th_xxx", commentId: "cm_xxx", metadata: { tag: "important", externalId: 1234 } })
897
+ */
898
+ useEditCommentMetadata(): (options: EditCommentMetadataOptions<CM>) => void;
856
899
  /**
857
900
  * Returns a function that deletes a comment.
858
901
  * If it is the last non-deleted comment, the thread also gets deleted.
@@ -904,7 +947,7 @@ type RoomContextBundleCommon<P extends JsonObject, S extends LsonObject, U exten
904
947
  */
905
948
  useThreadSubscription(threadId: string): ThreadSubscription;
906
949
  };
907
- type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, M extends BaseMetadata> = Resolve<RoomContextBundleCommon<P, S, U, E, M> & SharedContextBundle<U>["classic"] & {
950
+ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends BaseUserMeta, E extends Json, TM extends BaseMetadata, CM extends BaseMetadata> = Resolve<RoomContextBundleCommon<P, S, U, E, TM, CM> & SharedContextBundle<U>["classic"] & {
908
951
  /**
909
952
  * Extract arbitrary data from the Liveblocks Storage state, using an
910
953
  * arbitrary selector function.
@@ -965,14 +1008,28 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
965
1008
  * @example
966
1009
  * const { threads, error, isLoading } = useThreads();
967
1010
  */
968
- useThreads(options?: UseThreadsOptions<M>): ThreadsAsyncResult<M>;
1011
+ useThreads(options?: UseThreadsOptions<TM>): ThreadsAsyncResult<TM, CM>;
1012
+ /**
1013
+ * Returns agent sessions for the current room.
1014
+ *
1015
+ * @example
1016
+ * const { sessions, error, isLoading } = useAgentSessions();
1017
+ */
1018
+ useAgentSessions(options?: UseAgentSessionsOptions): AgentSessionsAsyncResult;
1019
+ /**
1020
+ * Returns agent messages for a specific session in the current room.
1021
+ *
1022
+ * @example
1023
+ * const { messages, error, isLoading } = useAgentSession("session-id");
1024
+ */
1025
+ useAgentSession(sessionId: string, options?: UseAgentSessionOptions): AgentSessionAsyncResult;
969
1026
  /**
970
1027
  * Returns the result of searching comments by text in the current room. The result includes the id and the plain text content of the matched comments along with the parent thread id of the comment.
971
1028
  *
972
1029
  * @example
973
1030
  * const { results, error, isLoading } = useSearchComments({ query: { text: "hello"} });
974
1031
  */
975
- useSearchComments(options: UseSearchCommentsOptions<M>): SearchCommentsAsyncResult;
1032
+ useSearchComments(options: UseSearchCommentsOptions<TM>): SearchCommentsAsyncResult;
976
1033
  /**
977
1034
  * Returns the user's subscription settings for the current room
978
1035
  * and a function to update them.
@@ -1005,7 +1062,7 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
1005
1062
  * const { data, error, isLoading } = useHistoryVersionData(version.id);
1006
1063
  */
1007
1064
  useHistoryVersionData(id: string): HistoryVersionDataAsyncResult;
1008
- suspense: Resolve<RoomContextBundleCommon<P, S, U, E, M> & SharedContextBundle<U>["suspense"] & {
1065
+ suspense: Resolve<RoomContextBundleCommon<P, S, U, E, TM, CM> & SharedContextBundle<U>["suspense"] & {
1009
1066
  /**
1010
1067
  * Extract arbitrary data from the Liveblocks Storage state, using an
1011
1068
  * arbitrary selector function.
@@ -1060,7 +1117,21 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
1060
1117
  * @example
1061
1118
  * const { threads } = useThreads();
1062
1119
  */
1063
- useThreads(options?: UseThreadsOptions<M>): ThreadsAsyncSuccess<M>;
1120
+ useThreads(options?: UseThreadsOptions<TM>): ThreadsAsyncSuccess<TM, CM>;
1121
+ /**
1122
+ * Returns agent sessions for the current room.
1123
+ *
1124
+ * @example
1125
+ * const { sessions } = useAgentSessions();
1126
+ */
1127
+ useAgentSessions(options?: UseAgentSessionsOptions): AgentSessionsAsyncSuccess;
1128
+ /**
1129
+ * Returns agent messages for a specific session in the current room.
1130
+ *
1131
+ * @example
1132
+ * const { messages } = useAgentSession("session-id");
1133
+ */
1134
+ useAgentSession(sessionId: string, options?: UseAgentSessionOptions): AgentSessionAsyncSuccess;
1064
1135
  /**
1065
1136
  * (Private beta) Returns a history of versions of the current room.
1066
1137
  *
@@ -1091,7 +1162,7 @@ type RoomContextBundle<P extends JsonObject, S extends LsonObject, U extends Bas
1091
1162
  /**
1092
1163
  * Properties that are the same in LiveblocksContext and LiveblocksContext["suspense"].
1093
1164
  */
1094
- type LiveblocksContextBundleCommon<M extends BaseMetadata> = {
1165
+ type LiveblocksContextBundleCommon<TM extends BaseMetadata, CM extends BaseMetadata> = {
1095
1166
  /**
1096
1167
  * Makes Liveblocks features outside of rooms (e.g. Notifications) available
1097
1168
  * in the component hierarchy below.
@@ -1144,7 +1215,7 @@ type LiveblocksContextBundleCommon<M extends BaseMetadata> = {
1144
1215
  * @example
1145
1216
  * const thread = useInboxNotificationThread("in_xxx");
1146
1217
  */
1147
- useInboxNotificationThread(inboxNotificationId: string): ThreadData<M>;
1218
+ useInboxNotificationThread(inboxNotificationId: string): ThreadData<TM, CM>;
1148
1219
  /**
1149
1220
  * Returns notification settings for the current user.
1150
1221
  *
@@ -1265,7 +1336,7 @@ type LiveblocksContextBundleCommon<M extends BaseMetadata> = {
1265
1336
  (options: WithRequired<SendAiMessageOptions, "chatId">): AiUserMessage;
1266
1337
  };
1267
1338
  };
1268
- type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = Resolve<LiveblocksContextBundleCommon<M> & SharedContextBundle<U>["classic"] & {
1339
+ type LiveblocksContextBundle<U extends BaseUserMeta, TM extends BaseMetadata, CM extends BaseMetadata> = Resolve<LiveblocksContextBundleCommon<TM, CM> & SharedContextBundle<U>["classic"] & {
1269
1340
  /**
1270
1341
  * Returns the inbox notifications for the current user.
1271
1342
  *
@@ -1286,7 +1357,7 @@ type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = R
1286
1357
  * This hook is experimental and could be removed or changed at any time!
1287
1358
  * Do not use unless explicitly recommended by the Liveblocks team.
1288
1359
  */
1289
- useUserThreads_experimental(options?: UseUserThreadsOptions<M>): ThreadsAsyncResult<M>;
1360
+ useUserThreads_experimental(options?: UseUserThreadsOptions<TM>): ThreadsAsyncResult<TM, CM>;
1290
1361
  /**
1291
1362
  * (Private beta) Returns the chats for the current user.
1292
1363
  *
@@ -1338,7 +1409,7 @@ type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = R
1338
1409
  * const { metadata, error, isLoading } = useUrlMetadata("https://liveblocks.io");
1339
1410
  */
1340
1411
  useUrlMetadata(url: string): UrlMetadataAsyncResult;
1341
- suspense: Resolve<LiveblocksContextBundleCommon<M> & SharedContextBundle<U>["suspense"] & {
1412
+ suspense: Resolve<LiveblocksContextBundleCommon<TM, CM> & SharedContextBundle<U>["suspense"] & {
1342
1413
  /**
1343
1414
  * Returns the inbox notifications for the current user.
1344
1415
  *
@@ -1369,7 +1440,7 @@ type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = R
1369
1440
  * This hook is experimental and could be removed or changed at any time!
1370
1441
  * Do not use unless explicitly recommended by the Liveblocks team.
1371
1442
  */
1372
- useUserThreads_experimental(options?: UseUserThreadsOptions<M>): ThreadsAsyncSuccess<M>;
1443
+ useUserThreads_experimental(options?: UseUserThreadsOptions<TM>): ThreadsAsyncSuccess<TM, CM>;
1373
1444
  /**
1374
1445
  * (Private beta) Returns the chats for the current user.
1375
1446
  *
@@ -1424,7 +1495,7 @@ type LiveblocksContextBundle<U extends BaseUserMeta, M extends BaseMetadata> = R
1424
1495
  }>;
1425
1496
  }>;
1426
1497
 
1427
- type ReadonlyThreadDB<M extends BaseMetadata> = Omit<ThreadDB<M>, "upsert" | "delete" | "signal">;
1498
+ type ReadonlyThreadDB<TM extends BaseMetadata, CM extends BaseMetadata> = Omit<ThreadDB<TM, CM>, "upsert" | "delete" | "signal">;
1428
1499
  /**
1429
1500
  * This class implements a lightweight, in-memory, "database" for all Thread
1430
1501
  * instances.
@@ -1442,20 +1513,20 @@ type ReadonlyThreadDB<M extends BaseMetadata> = Omit<ThreadDB<M>, "upsert" | "de
1442
1513
  * optimistic updates without losing the original thread contents.
1443
1514
  *
1444
1515
  */
1445
- declare class ThreadDB<M extends BaseMetadata> {
1516
+ declare class ThreadDB<TM extends BaseMetadata, CM extends BaseMetadata> {
1446
1517
  #private;
1447
1518
  readonly signal: MutableSignal<this>;
1448
1519
  constructor();
1449
- clone(): ThreadDB<M>;
1520
+ clone(): ThreadDB<TM, CM>;
1450
1521
  /** Returns an existing thread by ID. Will never return a deleted thread. */
1451
- get(threadId: string): ThreadData<M> | undefined;
1522
+ get(threadId: string): ThreadData<TM, CM> | undefined;
1452
1523
  /** Returns the (possibly deleted) thread by ID. */
1453
- getEvenIfDeleted(threadId: string): ThreadDataWithDeleteInfo<M> | undefined;
1524
+ getEvenIfDeleted(threadId: string): ThreadDataWithDeleteInfo<TM, CM> | undefined;
1454
1525
  /** Adds or updates a thread in the DB. If the newly given thread is a deleted one, it will get deleted. */
1455
- upsert(thread: ThreadDataWithDeleteInfo<M>): void;
1526
+ upsert(thread: ThreadDataWithDeleteInfo<TM, CM>): void;
1456
1527
  /** Like .upsert(), except it won't update if a thread by this ID already exists. */
1457
- upsertIfNewer(thread: ThreadDataWithDeleteInfo<M>): void;
1458
- applyDelta(newThreads: ThreadData<M>[], deletedThreads: ThreadDeleteInfo[]): void;
1528
+ upsertIfNewer(thread: ThreadDataWithDeleteInfo<TM, CM>): void;
1529
+ applyDelta(newThreads: ThreadData<TM, CM>[], deletedThreads: ThreadDeleteInfo[]): void;
1459
1530
  /**
1460
1531
  * Marks a thread as deleted. It will no longer pop up in .findMany()
1461
1532
  * queries, but it can still be accessed via `.getEvenIfDeleted()`.
@@ -1474,15 +1545,15 @@ declare class ThreadDB<M extends BaseMetadata> {
1474
1545
  *
1475
1546
  * Subscriptions are needed to filter threads based on the user's subscriptions.
1476
1547
  */
1477
- findMany(roomId: string | undefined, query: ThreadsQuery<M> | undefined, direction: "asc" | "desc", subscriptions: Record<SubscriptionKey, SubscriptionData> | undefined): ThreadData<M>[];
1548
+ findMany(roomId: string | undefined, query: ThreadsQuery<TM> | undefined, direction: "asc" | "desc", subscriptions?: Record<SubscriptionKey, SubscriptionData>): ThreadData<TM, CM>[];
1478
1549
  }
1479
1550
 
1480
- type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | SubscribeToThreadOptimisticUpdate | UnsubscribeFromThreadOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateRoomSubscriptionSettingsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
1481
- type CreateThreadOptimisticUpdate<M extends BaseMetadata> = {
1551
+ type OptimisticUpdate<TM extends BaseMetadata, CM extends BaseMetadata> = CreateThreadOptimisticUpdate<TM, CM> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<TM> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | SubscribeToThreadOptimisticUpdate | UnsubscribeFromThreadOptimisticUpdate | CreateCommentOptimisticUpdate<CM> | EditCommentOptimisticUpdate<CM> | EditCommentMetadataOptimisticUpdate<CM> | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateRoomSubscriptionSettingsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
1552
+ type CreateThreadOptimisticUpdate<TM extends BaseMetadata, CM extends BaseMetadata> = {
1482
1553
  type: "create-thread";
1483
1554
  id: string;
1484
1555
  roomId: string;
1485
- thread: ThreadData<M>;
1556
+ thread: ThreadData<TM, CM>;
1486
1557
  };
1487
1558
  type DeleteThreadOptimisticUpdate = {
1488
1559
  type: "delete-thread";
@@ -1491,11 +1562,11 @@ type DeleteThreadOptimisticUpdate = {
1491
1562
  threadId: string;
1492
1563
  deletedAt: Date;
1493
1564
  };
1494
- type EditThreadMetadataOptimisticUpdate<M extends BaseMetadata> = {
1565
+ type EditThreadMetadataOptimisticUpdate<TM extends BaseMetadata> = {
1495
1566
  type: "edit-thread-metadata";
1496
1567
  id: string;
1497
1568
  threadId: string;
1498
- metadata: Resolve<Patchable<M>>;
1569
+ metadata: Resolve<Patchable<TM>>;
1499
1570
  updatedAt: Date;
1500
1571
  };
1501
1572
  type MarkThreadAsResolvedOptimisticUpdate = {
@@ -1522,15 +1593,23 @@ type UnsubscribeFromThreadOptimisticUpdate = {
1522
1593
  threadId: string;
1523
1594
  unsubscribedAt: Date;
1524
1595
  };
1525
- type CreateCommentOptimisticUpdate = {
1596
+ type CreateCommentOptimisticUpdate<CM extends BaseMetadata> = {
1526
1597
  type: "create-comment";
1527
1598
  id: string;
1528
- comment: CommentData;
1599
+ comment: CommentData<CM>;
1529
1600
  };
1530
- type EditCommentOptimisticUpdate = {
1601
+ type EditCommentOptimisticUpdate<CM extends BaseMetadata> = {
1531
1602
  type: "edit-comment";
1532
1603
  id: string;
1533
- comment: CommentData;
1604
+ comment: CommentData<CM>;
1605
+ };
1606
+ type EditCommentMetadataOptimisticUpdate<CM extends BaseMetadata> = {
1607
+ type: "edit-comment-metadata";
1608
+ id: string;
1609
+ threadId: string;
1610
+ commentId: string;
1611
+ metadata: Resolve<Patchable<CM>>;
1612
+ updatedAt: Date;
1534
1613
  };
1535
1614
  type DeleteCommentOptimisticUpdate = {
1536
1615
  type: "delete-comment";
@@ -1626,14 +1705,14 @@ type NotificationsLUT = Map<string, InboxNotificationData>;
1626
1705
  */
1627
1706
  type RoomSubscriptionSettingsByRoomId = Record<RoomId, RoomSubscriptionSettings$1>;
1628
1707
  type SubscriptionsByKey = Record<SubscriptionKey, SubscriptionData>;
1629
- type CleanThreadifications<M extends BaseMetadata> = CleanThreads<M> & CleanNotifications;
1630
- type CleanThreads<M extends BaseMetadata> = {
1708
+ type CleanThreadifications<TM extends BaseMetadata, CM extends BaseMetadata> = CleanThreads<TM, CM> & CleanNotifications;
1709
+ type CleanThreads<TM extends BaseMetadata, CM extends BaseMetadata> = {
1631
1710
  /**
1632
1711
  * Keep track of loading and error status of all the queries made by the client.
1633
1712
  * e.g. 'room-abc-{"color":"red"}' - ok
1634
1713
  * e.g. 'room-abc-{}' - loading
1635
1714
  */
1636
- threadsDB: ReadonlyThreadDB<M>;
1715
+ threadsDB: ReadonlyThreadDB<TM, CM>;
1637
1716
  };
1638
1717
  type CleanNotifications = {
1639
1718
  /**
@@ -1668,7 +1747,7 @@ declare function createStore_forNotifications(): {
1668
1747
  delete: (inboxNotificationId: string) => void;
1669
1748
  applyDelta: (newNotifications: InboxNotificationData[], deletedNotifications: InboxNotificationDeleteInfo[]) => void;
1670
1749
  clear: () => void;
1671
- updateAssociatedNotification: (newComment: CommentData) => void;
1750
+ updateAssociatedNotification: <CM extends BaseMetadata>(newComment: CommentData<CM>) => void;
1672
1751
  upsert: (notification: InboxNotificationData) => void;
1673
1752
  };
1674
1753
  declare function createStore_forUnreadNotificationsCount(): {
@@ -1677,13 +1756,13 @@ declare function createStore_forUnreadNotificationsCount(): {
1677
1756
  }>;
1678
1757
  update: (queryKey: InboxNotificationsQueryKey, count: number) => void;
1679
1758
  };
1680
- declare function createStore_forSubscriptions(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>, threads: ReadonlyThreadDB<BaseMetadata>): {
1759
+ declare function createStore_forSubscriptions(updates: ISignal<readonly OptimisticUpdate<BaseMetadata, BaseMetadata>[]>, threads: ReadonlyThreadDB<BaseMetadata, BaseMetadata>): {
1681
1760
  signal: DerivedSignal<SubscriptionsByKey>;
1682
1761
  applyDelta: (newSubscriptions: SubscriptionData[], deletedSubscriptions: SubscriptionDeleteInfo[]) => void;
1683
1762
  create: (subscription: SubscriptionData) => void;
1684
1763
  delete: (subscriptionKey: SubscriptionKey) => void;
1685
1764
  };
1686
- declare function createStore_forRoomSubscriptionSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>): {
1765
+ declare function createStore_forRoomSubscriptionSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata, BaseMetadata>[]>): {
1687
1766
  signal: DerivedSignal<RoomSubscriptionSettingsByRoomId>;
1688
1767
  update: (roomId: string, settings: RoomSubscriptionSettings$1) => void;
1689
1768
  };
@@ -1723,18 +1802,18 @@ declare function createStore_forPermissionHints(): {
1723
1802
  * }
1724
1803
  * e.g. {} when before the first successful fetch.
1725
1804
  */
1726
- declare function createStore_forNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata>[]>): {
1805
+ declare function createStore_forNotificationSettings(updates: ISignal<readonly OptimisticUpdate<BaseMetadata, BaseMetadata>[]>): {
1727
1806
  signal: DerivedSignal<NotificationSettings>;
1728
1807
  update: (settings: NotificationSettings) => void;
1729
1808
  };
1730
- declare function createStore_forOptimistic<M extends BaseMetadata>(client: Client$1<BaseUserMeta$1, M>): {
1731
- signal: ISignal<readonly OptimisticUpdate<M>[]>;
1732
- add: (optimisticUpdate: DistributiveOmit<OptimisticUpdate<M>, "id">) => string;
1809
+ declare function createStore_forOptimistic<TM extends BaseMetadata, CM extends BaseMetadata>(client: Client$1<BaseUserMeta$1, TM, CM>): {
1810
+ signal: ISignal<readonly OptimisticUpdate<TM, CM>[]>;
1811
+ add: (optimisticUpdate: DistributiveOmit<OptimisticUpdate<TM, CM>, "id">) => string;
1733
1812
  remove: (optimisticId: string) => void;
1734
1813
  };
1735
- declare class UmbrellaStore<M extends BaseMetadata> {
1814
+ declare class UmbrellaStore<TM extends BaseMetadata, CM extends BaseMetadata> {
1736
1815
  #private;
1737
- readonly threads: ThreadDB<M>;
1816
+ readonly threads: ThreadDB<TM, CM>;
1738
1817
  readonly notifications: ReturnType<typeof createStore_forNotifications>;
1739
1818
  readonly subscriptions: ReturnType<typeof createStore_forSubscriptions>;
1740
1819
  readonly roomSubscriptionSettings: ReturnType<typeof createStore_forRoomSubscriptionSettings>;
@@ -1743,12 +1822,12 @@ declare class UmbrellaStore<M extends BaseMetadata> {
1743
1822
  readonly urlsMetadata: ReturnType<typeof createStore_forUrlsMetadata>;
1744
1823
  readonly permissionHints: ReturnType<typeof createStore_forPermissionHints>;
1745
1824
  readonly notificationSettings: ReturnType<typeof createStore_forNotificationSettings>;
1746
- readonly optimisticUpdates: ReturnType<typeof createStore_forOptimistic<M>>;
1825
+ readonly optimisticUpdates: ReturnType<typeof createStore_forOptimistic<TM, CM>>;
1747
1826
  readonly outputs: {
1748
- readonly threadifications: DerivedSignal<CleanThreadifications<M>>;
1749
- readonly threads: DerivedSignal<ReadonlyThreadDB<M>>;
1750
- readonly loadingRoomThreads: DefaultMap<RoomQueryKey, LoadableResource<ThreadsAsyncResult<M>>>;
1751
- readonly loadingUserThreads: DefaultMap<UserQueryKey, LoadableResource<ThreadsAsyncResult<M>>>;
1827
+ readonly threadifications: DerivedSignal<CleanThreadifications<TM, CM>>;
1828
+ readonly threads: DerivedSignal<ReadonlyThreadDB<TM, CM>>;
1829
+ readonly loadingRoomThreads: DefaultMap<RoomQueryKey, LoadableResource<ThreadsAsyncResult<TM, CM>>>;
1830
+ readonly loadingUserThreads: DefaultMap<UserQueryKey, LoadableResource<ThreadsAsyncResult<TM, CM>>>;
1752
1831
  readonly notifications: DerivedSignal<CleanNotifications>;
1753
1832
  readonly threadSubscriptions: DerivedSignal<CleanThreadSubscriptions>;
1754
1833
  readonly loadingNotifications: DefaultMap<InboxNotificationsQueryKey, LoadableResource<InboxNotificationsAsyncResult>>;
@@ -1760,6 +1839,8 @@ declare class UmbrellaStore<M extends BaseMetadata> {
1760
1839
  readonly messagesByChatId: DefaultMap<string, DefaultMap<MessageId | null, LoadableResource<AiChatMessagesAsyncResult>>>;
1761
1840
  readonly aiChatById: DefaultMap<string, LoadableResource<AiChatAsyncResult>>;
1762
1841
  readonly urlMetadataByUrl: DefaultMap<string, LoadableResource<UrlMetadataAsyncResult>>;
1842
+ readonly loadingAgentSessions: DefaultMap<string, LoadableResource<AgentSessionsAsyncResult>>;
1843
+ readonly loadingAgentMessages: DefaultMap<string, LoadableResource<AgentSessionAsyncResult>>;
1763
1844
  };
1764
1845
  constructor(client: OpaqueClient);
1765
1846
  /**
@@ -1793,9 +1874,9 @@ declare class UmbrellaStore<M extends BaseMetadata> {
1793
1874
  /**
1794
1875
  * Creates an new thread, replacing the corresponding optimistic update.
1795
1876
  */
1796
- createThread(optimisticId: string, thread: Readonly<ThreadDataWithDeleteInfo<M>>): void;
1877
+ createThread(optimisticId: string, thread: Readonly<ThreadDataWithDeleteInfo<TM, CM>>): void;
1797
1878
  patchThread(threadId: string, optimisticId: string | null, patch: {
1798
- metadata?: M;
1879
+ metadata?: TM;
1799
1880
  resolved?: boolean;
1800
1881
  }, updatedAt: Date): void;
1801
1882
  addReaction(threadId: string, optimisticId: string | null, commentId: string, reaction: CommentUserReaction, createdAt: Date): void;
@@ -1813,16 +1894,35 @@ declare class UmbrellaStore<M extends BaseMetadata> {
1813
1894
  * Creates an existing comment and ensures the associated notification is
1814
1895
  * updated correctly, replacing the corresponding optimistic update.
1815
1896
  */
1816
- createComment(newComment: CommentData, optimisticId: string): void;
1817
- editComment(threadId: string, optimisticId: string, editedComment: CommentData): void;
1897
+ createComment(newComment: CommentData<CM>, optimisticId: string): void;
1898
+ editComment(threadId: string, optimisticId: string, editedComment: CommentData<CM>): void;
1899
+ editCommentMetadata(threadId: string, commentId: string, optimisticId: string, updatedMetadata: CM, updatedAt: Date): void;
1818
1900
  deleteComment(threadId: string, optimisticId: string, commentId: string, deletedAt: Date): void;
1819
- updateThreadifications(threads: ThreadData<M>[], notifications: InboxNotificationData[], subscriptions: SubscriptionData[], deletedThreads?: ThreadDeleteInfo[], deletedNotifications?: InboxNotificationDeleteInfo[], deletedSubscriptions?: SubscriptionDeleteInfo[]): void;
1901
+ updateThreadifications(threads: ThreadData<TM, CM>[], notifications: InboxNotificationData[], subscriptions: SubscriptionData[], deletedThreads?: ThreadDeleteInfo[], deletedNotifications?: InboxNotificationDeleteInfo[], deletedSubscriptions?: SubscriptionDeleteInfo[]): void;
1820
1902
  /**
1821
1903
  * Updates existing subscription settings for a room with a new value,
1822
1904
  * replacing the corresponding optimistic update.
1823
1905
  */
1824
1906
  updateRoomSubscriptionSettings(roomId: string, optimisticId: string, settings: Readonly<RoomSubscriptionSettings$1>): void;
1825
1907
  fetchNotificationsDeltaUpdate(signal: AbortSignal): Promise<void>;
1908
+ /**
1909
+ * Registers a room instance for agent session fetching.
1910
+ * Called by RoomProvider when it mounts.
1911
+ */
1912
+ registerRoom(roomId: RoomId, room: OpaqueRoom): void;
1913
+ /**
1914
+ * Unregisters a room instance.
1915
+ * Called by RoomProvider when it unmounts.
1916
+ */
1917
+ unregisterRoom(roomId: RoomId): void;
1918
+ /**
1919
+ * Updates the agent sessions cache based on WebSocket events.
1920
+ */
1921
+ updateAgentSessions(roomId: RoomId, sessions: readonly AgentSession[], operation: "list" | "added" | "updated" | "deleted"): void;
1922
+ /**
1923
+ * Updates the agent messages cache based on WebSocket events.
1924
+ */
1925
+ updateAgentMessages(_roomId: RoomId, sessionId: string, messages: readonly AgentMessage[], operation: "list" | "added" | "updated" | "deleted"): void;
1826
1926
  fetchUnreadNotificationsCount(queryKey: InboxNotificationsQueryKey, signal: AbortSignal): Promise<void>;
1827
1927
  fetchRoomThreadsDeltaUpdate(roomId: string, signal: AbortSignal): Promise<void>;
1828
1928
  fetchUserThreadsDeltaUpdate(signal: AbortSignal): Promise<void>;
@@ -1844,7 +1944,7 @@ declare class UmbrellaStore<M extends BaseMetadata> {
1844
1944
  *
1845
1945
  * @private
1846
1946
  */
1847
- declare function getUmbrellaStoreForClient<M extends BaseMetadata$1>(client: OpaqueClient): UmbrellaStore<M>;
1947
+ declare function getUmbrellaStoreForClient<TM extends BaseMetadata$1, CM extends BaseMetadata$1>(client: OpaqueClient): UmbrellaStore<TM, CM>;
1848
1948
  /**
1849
1949
  * Returns a function that creates an AI chat.
1850
1950
  *
@@ -1946,7 +2046,7 @@ declare function LiveblocksProvider<U extends BaseUserMeta = DU>(props: PropsWit
1946
2046
  * LiveblocksProvider created in this way takes no props, because it uses
1947
2047
  * settings from the given client instead.
1948
2048
  */
1949
- declare function createLiveblocksContext<U extends BaseUserMeta = DU, M extends BaseMetadata$1 = DM>(client: OpaqueClient): LiveblocksContextBundle<U, M>;
2049
+ declare function createLiveblocksContext<U extends BaseUserMeta = DU, TM extends BaseMetadata$1 = DTM, CM extends BaseMetadata$1 = DCM>(client: OpaqueClient): LiveblocksContextBundle<U, TM, CM>;
1950
2050
  /**
1951
2051
  * Returns the inbox notifications for the current user.
1952
2052
  *
@@ -2073,7 +2173,7 @@ declare function useGroupInfo(groupId: string): GroupInfoAsyncResult;
2073
2173
  * const { info } = useGroupInfo("group-id");
2074
2174
  */
2075
2175
  declare function useGroupInfoSuspense(groupId: string): GroupInfoAsyncSuccess;
2076
- type TypedBundle$1 = LiveblocksContextBundle<DU, DM>;
2176
+ type TypedBundle$1 = LiveblocksContextBundle<DU, DTM, DCM>;
2077
2177
  /**
2078
2178
  * Returns the thread associated with a `"thread"` inbox notification.
2079
2179
  *
@@ -2293,33 +2393,17 @@ declare function useOthersConnectionIds(): readonly number[];
2293
2393
  /**
2294
2394
  * @private
2295
2395
  */
2296
- declare function useCreateRoomThread<M extends BaseMetadata$1>(roomId: string): (options: CreateThreadOptions<M>) => ThreadData$1<M>;
2396
+ declare function useCreateRoomThread<TM extends BaseMetadata$1, CM extends BaseMetadata$1>(roomId: string): (options: CreateThreadOptions<TM, CM>) => ThreadData$1<TM, CM>;
2297
2397
  declare function useDeleteRoomThread(roomId: string): (threadId: string) => void;
2298
- declare function useEditRoomThreadMetadata<M extends BaseMetadata$1>(roomId: string): (options: EditThreadMetadataOptions<M>) => void;
2299
- /**
2300
- * Returns a function that adds a comment to a thread.
2301
- *
2302
- * @example
2303
- * const createComment = useCreateComment();
2304
- * createComment({ threadId: "th_xxx", body: {} });
2305
- */
2306
- declare function useCreateComment(): (options: CreateCommentOptions) => CommentData$1;
2398
+ declare function useEditRoomThreadMetadata<TM extends BaseMetadata$1>(roomId: string): (options: EditThreadMetadataOptions<TM>) => void;
2307
2399
  /**
2308
2400
  * @private
2309
2401
  */
2310
- declare function useCreateRoomComment(roomId: string): (options: CreateCommentOptions) => CommentData$1;
2311
- /**
2312
- * Returns a function that edits a comment's body.
2313
- *
2314
- * @example
2315
- * const editComment = useEditComment()
2316
- * editComment({ threadId: "th_xxx", commentId: "cm_xxx", body: {} })
2317
- */
2318
- declare function useEditComment(): (options: EditCommentOptions) => void;
2402
+ declare function useCreateRoomComment<CM extends BaseMetadata$1>(roomId: string): (options: CreateCommentOptions<CM>) => CommentData$1<CM>;
2319
2403
  /**
2320
2404
  * @private
2321
2405
  */
2322
- declare function useEditRoomComment(roomId: string): (options: EditCommentOptions) => void;
2406
+ declare function useEditRoomComment<CM extends BaseMetadata$1>(roomId: string): (options: EditCommentOptions<CM>) => void;
2323
2407
  /**
2324
2408
  * Returns a function that deletes a comment.
2325
2409
  * If it is the last non-deleted comment, the thread also gets deleted.
@@ -2336,7 +2420,7 @@ declare function useDeleteRoomComment(roomId: string): ({ threadId, commentId }:
2336
2420
  /**
2337
2421
  * @private
2338
2422
  */
2339
- declare function useAddRoomCommentReaction<M extends BaseMetadata$1>(roomId: string): ({ threadId, commentId, emoji }: CommentReactionOptions) => void;
2423
+ declare function useAddRoomCommentReaction(roomId: string): ({ threadId, commentId, emoji }: CommentReactionOptions) => void;
2340
2424
  /**
2341
2425
  * Returns a function that removes a reaction on a comment.
2342
2426
  *
@@ -2475,8 +2559,8 @@ declare function useRoomPermissions(roomId: string): Set<_liveblocks_core.Permis
2475
2559
  * that any RoomProvider created in this way does not need to be nested in
2476
2560
  * LiveblocksProvider, as it already has access to the client.
2477
2561
  */
2478
- declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, M extends BaseMetadata$1 = DM>(client: OpaqueClient): RoomContextBundle<P, S, U, E, M>;
2479
- type TypedBundle = RoomContextBundle<DP, DS, DU, DE, DM>;
2562
+ declare function createRoomContext<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUserMeta = DU, E extends Json = DE, TM extends BaseMetadata$1 = DTM, CM extends BaseMetadata$1 = DCM>(client: OpaqueClient): RoomContextBundle<P, S, U, E, TM, CM>;
2563
+ type TypedBundle = RoomContextBundle<DP, DS, DU, DE, DTM, DCM>;
2480
2564
  /**
2481
2565
  * Makes a Room available in the component hierarchy below.
2482
2566
  * Joins the room when the component is mounted, and automatically leaves
@@ -2595,6 +2679,31 @@ declare const _useDeleteThread: TypedBundle["useDeleteThread"];
2595
2679
  * editThreadMetadata({ threadId: "th_xxx", metadata: {} })
2596
2680
  */
2597
2681
  declare const _useEditThreadMetadata: TypedBundle["useEditThreadMetadata"];
2682
+ /**
2683
+ * Returns a function that adds a comment to a thread.
2684
+ *
2685
+ * @example
2686
+ * const createComment = useCreateComment();
2687
+ * createComment({ threadId: "th_xxx", body: {} });
2688
+ */
2689
+ declare const _useCreateComment: TypedBundle["useCreateComment"];
2690
+ /**
2691
+ * Returns a function that edits a comment.
2692
+ *
2693
+ * @example
2694
+ * const editComment = useEditComment()
2695
+ * editComment({ threadId: "th_xxx", commentId: "cm_xxx", body: {} })
2696
+ */
2697
+ declare const _useEditComment: TypedBundle["useEditComment"];
2698
+ /**
2699
+ * Returns a function that edits a comment's metadata.
2700
+ * To delete an existing metadata property, set its value to `null`.
2701
+ *
2702
+ * @example
2703
+ * const editCommentMetadata = useEditCommentMetadata();
2704
+ * editCommentMetadata({ threadId: "th_xxx", commentId: "cm_xxx", metadata: { tag: "important", externalId: 1234 } })
2705
+ */
2706
+ declare const _useEditCommentMetadata: TypedBundle["useEditCommentMetadata"];
2598
2707
  /**
2599
2708
  * useEventListener is a React hook that allows you to respond to events broadcast
2600
2709
  * by other users in the room.
@@ -2682,6 +2791,20 @@ declare const _useOthersMappedSuspense: TypedBundle["suspense"]["useOthersMapped
2682
2791
  * const { threads, error, isLoading } = useThreads();
2683
2792
  */
2684
2793
  declare const _useThreads: TypedBundle["useThreads"];
2794
+ /**
2795
+ * Returns agent sessions for the current room.
2796
+ *
2797
+ * @example
2798
+ * const { sessions, error, isLoading } = useAgentSessions();
2799
+ */
2800
+ declare const _useAgentSessions: TypedBundle["useAgentSessions"];
2801
+ /**
2802
+ * Returns agent messages for a specific session in the current room.
2803
+ *
2804
+ * @example
2805
+ * const { messages, error, isLoading } = useAgentSession("session-id");
2806
+ */
2807
+ declare const _useAgentSession: TypedBundle["useAgentSession"];
2685
2808
  /**
2686
2809
  * Returns the result of searching comments by text in the current room. The result includes the id and the plain text content of the matched comments along with the parent thread id of the comment.
2687
2810
  *
@@ -2953,4 +3076,4 @@ declare const _useStorageRoot: TypedBundle["useStorageRoot"];
2953
3076
  */
2954
3077
  declare const _useUpdateMyPresence: TypedBundle["useUpdateMyPresence"];
2955
3078
 
2956
- export { _useEditThreadMetadata as $, type AiChatStatus as A, createLiveblocksContext as B, ClientContext as C, useDeleteAllInboxNotifications as D, useDeleteInboxNotification as E, useErrorListener as F, type GroupAsyncResult as G, useMarkAllInboxNotificationsAsRead as H, useMarkInboxNotificationAsRead as I, useSyncStatus as J, createRoomContext as K, LiveblocksProvider as L, type MutationContext as M, _RoomProvider as N, _useAddReaction as O, _useBroadcastEvent as P, useCanRedo as Q, type RegisterAiKnowledgeProps as R, type SendAiMessageOptions as S, useCanUndo as T, type UseSendAiMessageOptions as U, useCreateComment as V, _useCreateThread as W, useDeleteComment as X, _useDeleteThread as Y, useEditComment as Z, _useInboxNotificationThread as _, useAddRoomCommentReaction as a, useUnreadInboxNotificationsCountSuspense as a$, useMarkThreadAsResolved as a0, useMarkThreadAsUnresolved as a1, useSubscribeToThread as a2, useUnsubscribeFromThread as a3, _useEventListener as a4, useHistory as a5, _useIsInsideRoom as a6, useLostConnectionListener as a7, useMarkThreadAsRead as a8, _useMutation as a9, useCreateAiChat as aA, useDeleteAiChat as aB, useSendAiMessage as aC, _useUserThreads_experimental as aD, useRoomInfo as aE, useGroupInfo as aF, useUnreadInboxNotificationsCount as aG, _useUser as aH, _useAiChat as aI, _useAiChats as aJ, _useAiChatMessages as aK, useAiChatStatus as aL, _useUrlMetadata as aM, _useOtherSuspense as aN, _useOthersSuspense as aO, useOthersConnectionIdsSuspense as aP, _useOthersMappedSuspense as aQ, _useSelfSuspense as aR, _useStorageSuspense as aS, _useThreadsSuspense as aT, useAttachmentUrlSuspense as aU, _useHistoryVersionsSuspense as aV, _useRoomSubscriptionSettingsSuspense as aW, useInboxNotificationsSuspense as aX, useNotificationSettingsSuspense as aY, useRoomInfoSuspense as aZ, useGroupInfoSuspense as a_, _useMyPresence as aa, _useOthersListener as ab, useRedo as ac, useRemoveReaction as ad, _useRoom as ae, useStatus as af, _useStorageRoot as ag, useThreadSubscription as ah, useUndo as ai, _useUpdateMyPresence as aj, useUpdateRoomSubscriptionSettings as ak, useHistoryVersionData as al, _useOther as am, _useOthers as an, useOthersConnectionIds as ao, _useOthersMapped as ap, _useSelf as aq, _useStorage as ar, _useThreads as as, _useSearchComments as at, useAttachmentUrl as au, _useHistoryVersions as av, _useRoomSubscriptionSettings as aw, useInboxNotifications as ax, useNotificationSettings as ay, useUpdateNotificationSettings as az, useCreateRoomComment as b, _useUserSuspense as b0, _useUserThreadsSuspense_experimental as b1, _useAiChatsSuspense as b2, _useAiChatMessagesSuspense as b3, _useAiChatSuspense as b4, _useUrlMetadataSuspense as b5, useCreateRoomThread as c, useCreateTextMention as d, useDeleteRoomComment as e, useDeleteRoomThread as f, getUmbrellaStoreForClient as g, useDeleteTextMention as h, useEditRoomComment as i, useEditRoomThreadMetadata as j, useMarkRoomThreadAsRead as k, useMarkRoomThreadAsResolved as l, useMarkRoomThreadAsUnresolved as m, useMentionSuggestionsCache as n, useRemoveRoomCommentReaction as o, useReportTextEditor as p, useResolveMentionSuggestions as q, useRoomAttachmentUrl as r, useRoomPermissions as s, useRoomThreadSubscription as t, useClientOrNull as u, useYjsProvider as v, type RegisterAiToolProps as w, type UseThreadsOptions as x, RoomContext as y, useClient as z };
3079
+ export { _useEditThreadMetadata as $, type AiChatStatus as A, createLiveblocksContext as B, ClientContext as C, useDeleteAllInboxNotifications as D, useDeleteInboxNotification as E, useErrorListener as F, type GroupAsyncResult as G, useMarkAllInboxNotificationsAsRead as H, useMarkInboxNotificationAsRead as I, useSyncStatus as J, createRoomContext as K, LiveblocksProvider as L, type MutationContext as M, _RoomProvider as N, _useAddReaction as O, _useBroadcastEvent as P, useCanRedo as Q, type RegisterAiKnowledgeProps as R, type SendAiMessageOptions as S, useCanUndo as T, type UseSendAiMessageOptions as U, _useCreateComment as V, _useCreateThread as W, useDeleteComment as X, _useDeleteThread as Y, _useEditComment as Z, _useInboxNotificationThread as _, useAddRoomCommentReaction as a, useNotificationSettingsSuspense as a$, _useEditCommentMetadata as a0, useMarkThreadAsResolved as a1, useMarkThreadAsUnresolved as a2, useSubscribeToThread as a3, useUnsubscribeFromThread as a4, _useEventListener as a5, useHistory as a6, _useIsInsideRoom as a7, useLostConnectionListener as a8, useMarkThreadAsRead as a9, useInboxNotifications as aA, useNotificationSettings as aB, useUpdateNotificationSettings as aC, useCreateAiChat as aD, useDeleteAiChat as aE, useSendAiMessage as aF, _useUserThreads_experimental as aG, useRoomInfo as aH, useGroupInfo as aI, useUnreadInboxNotificationsCount as aJ, _useUser as aK, _useAiChat as aL, _useAiChats as aM, _useAiChatMessages as aN, useAiChatStatus as aO, _useUrlMetadata as aP, _useOtherSuspense as aQ, _useOthersSuspense as aR, useOthersConnectionIdsSuspense as aS, _useOthersMappedSuspense as aT, _useSelfSuspense as aU, _useStorageSuspense as aV, _useThreadsSuspense as aW, useAttachmentUrlSuspense as aX, _useHistoryVersionsSuspense as aY, _useRoomSubscriptionSettingsSuspense as aZ, useInboxNotificationsSuspense as a_, _useMutation as aa, _useMyPresence as ab, _useOthersListener as ac, useRedo as ad, useRemoveReaction as ae, _useRoom as af, useStatus as ag, _useStorageRoot as ah, useThreadSubscription as ai, useUndo as aj, _useUpdateMyPresence as ak, useUpdateRoomSubscriptionSettings as al, useHistoryVersionData as am, _useOther as an, _useOthers as ao, useOthersConnectionIds as ap, _useOthersMapped as aq, _useSelf as ar, _useStorage as as, _useThreads as at, _useAgentSessions as au, _useAgentSession as av, _useSearchComments as aw, useAttachmentUrl as ax, _useHistoryVersions as ay, _useRoomSubscriptionSettings as az, useCreateRoomComment as b, useRoomInfoSuspense as b0, useGroupInfoSuspense as b1, useUnreadInboxNotificationsCountSuspense as b2, _useUserSuspense as b3, _useUserThreadsSuspense_experimental as b4, _useAiChatsSuspense as b5, _useAiChatMessagesSuspense as b6, _useAiChatSuspense as b7, _useUrlMetadataSuspense as b8, useCreateRoomThread as c, useCreateTextMention as d, useDeleteRoomComment as e, useDeleteRoomThread as f, getUmbrellaStoreForClient as g, useDeleteTextMention as h, useEditRoomComment as i, useEditRoomThreadMetadata as j, useMarkRoomThreadAsRead as k, useMarkRoomThreadAsResolved as l, useMarkRoomThreadAsUnresolved as m, useMentionSuggestionsCache as n, useRemoveRoomCommentReaction as o, useReportTextEditor as p, useResolveMentionSuggestions as q, useRoomAttachmentUrl as r, useRoomPermissions as s, useRoomThreadSubscription as t, useClientOrNull as u, useYjsProvider as v, type RegisterAiToolProps as w, type UseThreadsOptions as x, RoomContext as y, useClient as z };