@liveblocks/core 2.17.0-usrnotsettings3 → 2.17.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/dist/index.d.mts CHANGED
@@ -1127,6 +1127,22 @@ type BatchStore<O, I> = {
1127
1127
  invalidate: (inputs?: I[]) => void;
1128
1128
  };
1129
1129
 
1130
+ type ContextualPromptResponse = Relax<{
1131
+ type: "insert";
1132
+ text: string;
1133
+ } | {
1134
+ type: "replace";
1135
+ text: string;
1136
+ } | {
1137
+ type: "other";
1138
+ text: string;
1139
+ }>;
1140
+ type ContextualPromptContext = {
1141
+ beforeSelection: string;
1142
+ selection: string;
1143
+ afterSelection: string;
1144
+ };
1145
+
1130
1146
  declare enum ClientMsgCode {
1131
1147
  UPDATE_PRESENCE = 100,
1132
1148
  BROADCAST_EVENT = 103,
@@ -1583,8 +1599,6 @@ type CommentsOrNotificationsErrorContext = {
1583
1599
  } | {
1584
1600
  type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
1585
1601
  roomId: string;
1586
- } | {
1587
- type: "UPDATE_USER_NOTIFICATION_SETTINGS_ERROR";
1588
1602
  };
1589
1603
  type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext>;
1590
1604
  declare class LiveblocksError extends Error {
@@ -2406,6 +2420,15 @@ type PrivateRoomApi = {
2406
2420
  }>;
2407
2421
  getTextVersion(versionId: string): Promise<Response>;
2408
2422
  createTextVersion(): Promise<void>;
2423
+ executeContextualPrompt(options: {
2424
+ prompt: string;
2425
+ context: ContextualPromptContext;
2426
+ previous?: {
2427
+ prompt: string;
2428
+ response: ContextualPromptResponse;
2429
+ };
2430
+ signal: AbortSignal;
2431
+ }): Promise<string>;
2409
2432
  simulate: {
2410
2433
  explicitClose(event: IWebSocketCloseEvent): void;
2411
2434
  rawSend(data: string): void;
@@ -2443,55 +2466,7 @@ type PartialUnless<C, T> = Record<string, never> extends C ? Partial<T> : [
2443
2466
  type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ? OptionalTuple<T> : [
2444
2467
  C
2445
2468
  ] extends [never] ? OptionalTuple<T> : T;
2446
-
2447
- /**
2448
- * Pre-defined notification channels support list.
2449
- */
2450
- type NotificationChannel = "email" | "slack" | "teams" | "webPush";
2451
- /**
2452
- * `K` represents custom notification kinds
2453
- * defined in the augmentation `ActivitiesData` (e.g `liveblocks.config.ts`).
2454
- * It means the type `NotificationKind` will be shaped like:
2455
- * thread | textMention | $customKind1 | $customKind2 | ...
2456
- */
2457
- type NotificationKind<K extends keyof DAD = keyof DAD> = "thread" | "textMention" | K;
2458
- /**
2459
- * A notification channel settings is a set of notification kinds.
2460
- * One setting can have multiple kinds (+ augmentation)
2461
- */
2462
- type NotificationChannelSettings = {
2463
- [K in NotificationKind]: boolean;
2464
- };
2465
- /**
2466
- * User notification settings are a set of notification channel setting.
2467
- * One channel for one set of settings.
2468
- */
2469
- type UserNotificationSettings = {
2470
- [C in NotificationChannel]: NotificationChannelSettings;
2471
- };
2472
- /**
2473
- * It creates a deep partial specific for `UserNotificationSettings`
2474
- * to offer a nice DX when updating the settings (e.g not being forced to define every keys)
2475
- * and at the same the some preserver the augmentation for custom kinds (e.g `liveblocks.config.ts`).
2476
- */
2477
- type DeepPartialWithAugmentation<T> = T extends object ? {
2478
- [P in keyof T]?: T[P] extends {
2479
- [K in NotificationKind]: boolean;
2480
- } ? Partial<T[P]> & {
2481
- [K in keyof DAD]?: boolean;
2482
- } : DeepPartialWithAugmentation<T[P]>;
2483
- } : T;
2484
- /**
2485
- * Partial user notification settings
2486
- * with augmentation preserved gracefully
2487
- */
2488
- type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettings>;
2489
- /**
2490
- *
2491
- * Utility to check if a notification channel settings
2492
- * is enabled for every notification kinds.
2493
- */
2494
- declare function isNotificationChannelEnabled(settings: NotificationChannelSettings): boolean;
2469
+ type LargeMessageStrategy = "default" | "split" | "experimental-fallback-to-http";
2495
2470
 
2496
2471
  interface RoomHttpApi<M extends BaseMetadata> {
2497
2472
  getThreads(options: {
@@ -2668,6 +2643,16 @@ interface RoomHttpApi<M extends BaseMetadata> {
2668
2643
  nonce: string | undefined;
2669
2644
  messages: ClientMsg<P, E>[];
2670
2645
  }): Promise<Response>;
2646
+ executeContextualPrompt({ roomId, prompt, context, signal, }: {
2647
+ roomId: string;
2648
+ prompt: string;
2649
+ context: ContextualPromptContext;
2650
+ previous?: {
2651
+ prompt: string;
2652
+ response: ContextualPromptResponse;
2653
+ };
2654
+ signal: AbortSignal;
2655
+ }): Promise<string>;
2671
2656
  }
2672
2657
  interface NotificationHttpApi<M extends BaseMetadata> {
2673
2658
  getInboxNotifications(options?: {
@@ -2697,8 +2682,6 @@ interface NotificationHttpApi<M extends BaseMetadata> {
2697
2682
  markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
2698
2683
  deleteAllInboxNotifications(): Promise<void>;
2699
2684
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2700
- getUserNotificationSettings(): Promise<UserNotificationSettings>;
2701
- updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
2702
2685
  }
2703
2686
  interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
2704
2687
  getUserThreads_experimental(options?: {
@@ -2821,7 +2804,7 @@ declare class MutableSignal<T extends object> extends AbstractSignal<T> {
2821
2804
  mutate(callback?: (state: T) => void | boolean): void;
2822
2805
  }
2823
2806
 
2824
- type OptionalPromise<T> = T | Promise<T>;
2807
+ type Awaitable<T> = T | PromiseLike<T>;
2825
2808
 
2826
2809
  type ResolveMentionSuggestionsArgs = {
2827
2810
  /**
@@ -2988,28 +2971,6 @@ type NotificationsApi<M extends BaseMetadata> = {
2988
2971
  * await client.deleteInboxNotification("in_xxx");
2989
2972
  */
2990
2973
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2991
- /**
2992
- * Gets notifications settings for a user for a project.
2993
- *
2994
- * @example
2995
- * const notificationSettings = await client.getNotificationSettings();
2996
- */
2997
- getNotificationSettings(options?: {
2998
- signal?: AbortSignal;
2999
- }): Promise<UserNotificationSettings>;
3000
- /**
3001
- * Update notifications settings for a user for a project.
3002
- *
3003
- * @example
3004
- * await client.updateNotificationSettings({
3005
- * email: {
3006
- * thread: true,
3007
- * textMention: false,
3008
- * $customKind1: true,
3009
- * }
3010
- * })
3011
- */
3012
- updateNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
3013
2974
  };
3014
2975
  /**
3015
2976
  * @private Widest-possible Client type, matching _any_ Client instance. Note
@@ -3123,22 +3084,24 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
3123
3084
  lostConnectionTimeout?: number;
3124
3085
  backgroundKeepAliveTimeout?: number;
3125
3086
  polyfills?: Polyfills;
3087
+ largeMessageStrategy?: LargeMessageStrategy;
3088
+ /** @deprecated Use `largeMessageStrategy="experimental-fallback-to-http"` instead. */
3126
3089
  unstable_fallbackToHTTP?: boolean;
3127
3090
  unstable_streamData?: boolean;
3128
3091
  /**
3129
3092
  * A function that returns a list of user IDs matching a string.
3130
3093
  */
3131
- resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => OptionalPromise<string[]>;
3094
+ resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => Awaitable<string[]>;
3132
3095
  /**
3133
3096
  * A function that returns user info from user IDs.
3134
3097
  * You should return a list of user objects of the same size, in the same order.
3135
3098
  */
3136
- resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3099
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
3137
3100
  /**
3138
3101
  * A function that returns room info from room IDs.
3139
3102
  * You should return a list of room info objects of the same size, in the same order.
3140
3103
  */
3141
- resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => OptionalPromise<(DRI | undefined)[] | undefined>;
3104
+ resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => Awaitable<(DRI | undefined)[] | undefined>;
3142
3105
  /**
3143
3106
  * Prevent the current browser tab from being closed if there are any locally
3144
3107
  * pending Liveblocks changes that haven't been submitted to or confirmed by
@@ -3249,7 +3212,7 @@ type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
3249
3212
  * A function that returns user info from user IDs.
3250
3213
  * You should return a list of user objects of the same size, in the same order.
3251
3214
  */
3252
- resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3215
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
3253
3216
  };
3254
3217
  declare function isCommentBodyText(element: CommentBodyElement): element is CommentBodyText;
3255
3218
  declare function isCommentBodyMention(element: CommentBodyElement): element is CommentBodyMention;
@@ -3258,7 +3221,7 @@ declare function isCommentBodyLink(element: CommentBodyElement): element is Comm
3258
3221
  * Get an array of each user's ID that has been mentioned in a `CommentBody`.
3259
3222
  */
3260
3223
  declare function getMentionedIdsFromCommentBody(body: CommentBody): string[];
3261
- declare function resolveUsersInCommentBody<U extends BaseUserMeta>(body: CommentBody, resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>): Promise<Map<string, U["info"]>>;
3224
+ declare function resolveUsersInCommentBody<U extends BaseUserMeta>(body: CommentBody, resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>): Promise<Map<string, U["info"]>>;
3262
3225
  declare function htmlSafe(value: string): HtmlSafeString;
3263
3226
  declare class HtmlSafeString {
3264
3227
  #private;
@@ -3599,18 +3562,6 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : n
3599
3562
  * Throw an error, but as an expression instead of a statement.
3600
3563
  */
3601
3564
  declare function raise(msg: string): never;
3602
- /**
3603
- * Drop-in replacement for Object.entries() that retains better types.
3604
- */
3605
- declare function entries<O extends {
3606
- [key: string]: unknown;
3607
- }, K extends keyof O>(obj: O): [K, O[K]][];
3608
- /**
3609
- * Drop-in replacement for Object.keys() that retains better types.
3610
- */
3611
- declare function keys<O extends {
3612
- [key: string]: unknown;
3613
- }, K extends keyof O>(obj: O): K[];
3614
3565
  /**
3615
3566
  * Creates a new object by mapping a function over all values. Keys remain the
3616
3567
  * same. Think Array.prototype.map(), but for values in an object.
@@ -3928,4 +3879,4 @@ declare const CommentsApiError: typeof HttpError;
3928
3879
  /** @deprecated Use HttpError instead. */
3929
3880
  declare const NotificationsApiError: typeof HttpError;
3930
3881
 
3931
- export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
3882
+ export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
package/dist/index.d.ts CHANGED
@@ -1127,6 +1127,22 @@ type BatchStore<O, I> = {
1127
1127
  invalidate: (inputs?: I[]) => void;
1128
1128
  };
1129
1129
 
1130
+ type ContextualPromptResponse = Relax<{
1131
+ type: "insert";
1132
+ text: string;
1133
+ } | {
1134
+ type: "replace";
1135
+ text: string;
1136
+ } | {
1137
+ type: "other";
1138
+ text: string;
1139
+ }>;
1140
+ type ContextualPromptContext = {
1141
+ beforeSelection: string;
1142
+ selection: string;
1143
+ afterSelection: string;
1144
+ };
1145
+
1130
1146
  declare enum ClientMsgCode {
1131
1147
  UPDATE_PRESENCE = 100,
1132
1148
  BROADCAST_EVENT = 103,
@@ -1583,8 +1599,6 @@ type CommentsOrNotificationsErrorContext = {
1583
1599
  } | {
1584
1600
  type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
1585
1601
  roomId: string;
1586
- } | {
1587
- type: "UPDATE_USER_NOTIFICATION_SETTINGS_ERROR";
1588
1602
  };
1589
1603
  type LiveblocksErrorContext = Relax<RoomConnectionErrorContext | CommentsOrNotificationsErrorContext>;
1590
1604
  declare class LiveblocksError extends Error {
@@ -2406,6 +2420,15 @@ type PrivateRoomApi = {
2406
2420
  }>;
2407
2421
  getTextVersion(versionId: string): Promise<Response>;
2408
2422
  createTextVersion(): Promise<void>;
2423
+ executeContextualPrompt(options: {
2424
+ prompt: string;
2425
+ context: ContextualPromptContext;
2426
+ previous?: {
2427
+ prompt: string;
2428
+ response: ContextualPromptResponse;
2429
+ };
2430
+ signal: AbortSignal;
2431
+ }): Promise<string>;
2409
2432
  simulate: {
2410
2433
  explicitClose(event: IWebSocketCloseEvent): void;
2411
2434
  rawSend(data: string): void;
@@ -2443,55 +2466,7 @@ type PartialUnless<C, T> = Record<string, never> extends C ? Partial<T> : [
2443
2466
  type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ? OptionalTuple<T> : [
2444
2467
  C
2445
2468
  ] extends [never] ? OptionalTuple<T> : T;
2446
-
2447
- /**
2448
- * Pre-defined notification channels support list.
2449
- */
2450
- type NotificationChannel = "email" | "slack" | "teams" | "webPush";
2451
- /**
2452
- * `K` represents custom notification kinds
2453
- * defined in the augmentation `ActivitiesData` (e.g `liveblocks.config.ts`).
2454
- * It means the type `NotificationKind` will be shaped like:
2455
- * thread | textMention | $customKind1 | $customKind2 | ...
2456
- */
2457
- type NotificationKind<K extends keyof DAD = keyof DAD> = "thread" | "textMention" | K;
2458
- /**
2459
- * A notification channel settings is a set of notification kinds.
2460
- * One setting can have multiple kinds (+ augmentation)
2461
- */
2462
- type NotificationChannelSettings = {
2463
- [K in NotificationKind]: boolean;
2464
- };
2465
- /**
2466
- * User notification settings are a set of notification channel setting.
2467
- * One channel for one set of settings.
2468
- */
2469
- type UserNotificationSettings = {
2470
- [C in NotificationChannel]: NotificationChannelSettings;
2471
- };
2472
- /**
2473
- * It creates a deep partial specific for `UserNotificationSettings`
2474
- * to offer a nice DX when updating the settings (e.g not being forced to define every keys)
2475
- * and at the same the some preserver the augmentation for custom kinds (e.g `liveblocks.config.ts`).
2476
- */
2477
- type DeepPartialWithAugmentation<T> = T extends object ? {
2478
- [P in keyof T]?: T[P] extends {
2479
- [K in NotificationKind]: boolean;
2480
- } ? Partial<T[P]> & {
2481
- [K in keyof DAD]?: boolean;
2482
- } : DeepPartialWithAugmentation<T[P]>;
2483
- } : T;
2484
- /**
2485
- * Partial user notification settings
2486
- * with augmentation preserved gracefully
2487
- */
2488
- type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettings>;
2489
- /**
2490
- *
2491
- * Utility to check if a notification channel settings
2492
- * is enabled for every notification kinds.
2493
- */
2494
- declare function isNotificationChannelEnabled(settings: NotificationChannelSettings): boolean;
2469
+ type LargeMessageStrategy = "default" | "split" | "experimental-fallback-to-http";
2495
2470
 
2496
2471
  interface RoomHttpApi<M extends BaseMetadata> {
2497
2472
  getThreads(options: {
@@ -2668,6 +2643,16 @@ interface RoomHttpApi<M extends BaseMetadata> {
2668
2643
  nonce: string | undefined;
2669
2644
  messages: ClientMsg<P, E>[];
2670
2645
  }): Promise<Response>;
2646
+ executeContextualPrompt({ roomId, prompt, context, signal, }: {
2647
+ roomId: string;
2648
+ prompt: string;
2649
+ context: ContextualPromptContext;
2650
+ previous?: {
2651
+ prompt: string;
2652
+ response: ContextualPromptResponse;
2653
+ };
2654
+ signal: AbortSignal;
2655
+ }): Promise<string>;
2671
2656
  }
2672
2657
  interface NotificationHttpApi<M extends BaseMetadata> {
2673
2658
  getInboxNotifications(options?: {
@@ -2697,8 +2682,6 @@ interface NotificationHttpApi<M extends BaseMetadata> {
2697
2682
  markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
2698
2683
  deleteAllInboxNotifications(): Promise<void>;
2699
2684
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2700
- getUserNotificationSettings(): Promise<UserNotificationSettings>;
2701
- updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
2702
2685
  }
2703
2686
  interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
2704
2687
  getUserThreads_experimental(options?: {
@@ -2821,7 +2804,7 @@ declare class MutableSignal<T extends object> extends AbstractSignal<T> {
2821
2804
  mutate(callback?: (state: T) => void | boolean): void;
2822
2805
  }
2823
2806
 
2824
- type OptionalPromise<T> = T | Promise<T>;
2807
+ type Awaitable<T> = T | PromiseLike<T>;
2825
2808
 
2826
2809
  type ResolveMentionSuggestionsArgs = {
2827
2810
  /**
@@ -2988,28 +2971,6 @@ type NotificationsApi<M extends BaseMetadata> = {
2988
2971
  * await client.deleteInboxNotification("in_xxx");
2989
2972
  */
2990
2973
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2991
- /**
2992
- * Gets notifications settings for a user for a project.
2993
- *
2994
- * @example
2995
- * const notificationSettings = await client.getNotificationSettings();
2996
- */
2997
- getNotificationSettings(options?: {
2998
- signal?: AbortSignal;
2999
- }): Promise<UserNotificationSettings>;
3000
- /**
3001
- * Update notifications settings for a user for a project.
3002
- *
3003
- * @example
3004
- * await client.updateNotificationSettings({
3005
- * email: {
3006
- * thread: true,
3007
- * textMention: false,
3008
- * $customKind1: true,
3009
- * }
3010
- * })
3011
- */
3012
- updateNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
3013
2974
  };
3014
2975
  /**
3015
2976
  * @private Widest-possible Client type, matching _any_ Client instance. Note
@@ -3123,22 +3084,24 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
3123
3084
  lostConnectionTimeout?: number;
3124
3085
  backgroundKeepAliveTimeout?: number;
3125
3086
  polyfills?: Polyfills;
3087
+ largeMessageStrategy?: LargeMessageStrategy;
3088
+ /** @deprecated Use `largeMessageStrategy="experimental-fallback-to-http"` instead. */
3126
3089
  unstable_fallbackToHTTP?: boolean;
3127
3090
  unstable_streamData?: boolean;
3128
3091
  /**
3129
3092
  * A function that returns a list of user IDs matching a string.
3130
3093
  */
3131
- resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => OptionalPromise<string[]>;
3094
+ resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => Awaitable<string[]>;
3132
3095
  /**
3133
3096
  * A function that returns user info from user IDs.
3134
3097
  * You should return a list of user objects of the same size, in the same order.
3135
3098
  */
3136
- resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3099
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
3137
3100
  /**
3138
3101
  * A function that returns room info from room IDs.
3139
3102
  * You should return a list of room info objects of the same size, in the same order.
3140
3103
  */
3141
- resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => OptionalPromise<(DRI | undefined)[] | undefined>;
3104
+ resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => Awaitable<(DRI | undefined)[] | undefined>;
3142
3105
  /**
3143
3106
  * Prevent the current browser tab from being closed if there are any locally
3144
3107
  * pending Liveblocks changes that haven't been submitted to or confirmed by
@@ -3249,7 +3212,7 @@ type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
3249
3212
  * A function that returns user info from user IDs.
3250
3213
  * You should return a list of user objects of the same size, in the same order.
3251
3214
  */
3252
- resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3215
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
3253
3216
  };
3254
3217
  declare function isCommentBodyText(element: CommentBodyElement): element is CommentBodyText;
3255
3218
  declare function isCommentBodyMention(element: CommentBodyElement): element is CommentBodyMention;
@@ -3258,7 +3221,7 @@ declare function isCommentBodyLink(element: CommentBodyElement): element is Comm
3258
3221
  * Get an array of each user's ID that has been mentioned in a `CommentBody`.
3259
3222
  */
3260
3223
  declare function getMentionedIdsFromCommentBody(body: CommentBody): string[];
3261
- declare function resolveUsersInCommentBody<U extends BaseUserMeta>(body: CommentBody, resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>): Promise<Map<string, U["info"]>>;
3224
+ declare function resolveUsersInCommentBody<U extends BaseUserMeta>(body: CommentBody, resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>): Promise<Map<string, U["info"]>>;
3262
3225
  declare function htmlSafe(value: string): HtmlSafeString;
3263
3226
  declare class HtmlSafeString {
3264
3227
  #private;
@@ -3599,18 +3562,6 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : n
3599
3562
  * Throw an error, but as an expression instead of a statement.
3600
3563
  */
3601
3564
  declare function raise(msg: string): never;
3602
- /**
3603
- * Drop-in replacement for Object.entries() that retains better types.
3604
- */
3605
- declare function entries<O extends {
3606
- [key: string]: unknown;
3607
- }, K extends keyof O>(obj: O): [K, O[K]][];
3608
- /**
3609
- * Drop-in replacement for Object.keys() that retains better types.
3610
- */
3611
- declare function keys<O extends {
3612
- [key: string]: unknown;
3613
- }, K extends keyof O>(obj: O): K[];
3614
3565
  /**
3615
3566
  * Creates a new object by mapping a function over all values. Keys remain the
3616
3567
  * same. Think Array.prototype.map(), but for values in an object.
@@ -3928,4 +3879,4 @@ declare const CommentsApiError: typeof HttpError;
3928
3879
  /** @deprecated Use HttpError instead. */
3929
3880
  declare const NotificationsApiError: typeof HttpError;
3930
3881
 
3931
- export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
3882
+ export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentLocalAttachment, type CommentMixedAttachment, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, type ContextualPromptContext, type ContextualPromptResponse, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };