@liveblocks/core 2.17.0-usrnotsettings2 → 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,
@@ -2404,6 +2420,15 @@ type PrivateRoomApi = {
2404
2420
  }>;
2405
2421
  getTextVersion(versionId: string): Promise<Response>;
2406
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>;
2407
2432
  simulate: {
2408
2433
  explicitClose(event: IWebSocketCloseEvent): void;
2409
2434
  rawSend(data: string): void;
@@ -2441,55 +2466,7 @@ type PartialUnless<C, T> = Record<string, never> extends C ? Partial<T> : [
2441
2466
  type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ? OptionalTuple<T> : [
2442
2467
  C
2443
2468
  ] extends [never] ? OptionalTuple<T> : T;
2444
-
2445
- /**
2446
- * Pre-defined notification channels support list.
2447
- */
2448
- type NotificationChannel = "email" | "slack" | "teams" | "webPush";
2449
- /**
2450
- * `K` represents custom notification kinds
2451
- * defined in the augmentation `ActivitiesData` (e.g `liveblocks.config.ts`).
2452
- * It means the type `NotificationKind` will be shaped like:
2453
- * thread | textMention | $customKind1 | $customKind2 | ...
2454
- */
2455
- type NotificationKind<K extends keyof DAD = keyof DAD> = "thread" | "textMention" | K;
2456
- /**
2457
- * A notification channel settings is a set of notification kinds.
2458
- * One setting can have multiple kinds (+ augmentation)
2459
- */
2460
- type NotificationChannelSettings = {
2461
- [K in NotificationKind]: boolean;
2462
- };
2463
- /**
2464
- * User notification settings are a set of notification channel setting.
2465
- * One channel for one set of settings.
2466
- */
2467
- type UserNotificationSettings = {
2468
- [C in NotificationChannel]: NotificationChannelSettings;
2469
- };
2470
- /**
2471
- * It creates a deep partial specific for `UserNotificationSettings`
2472
- * to offer a nice DX when updating the settings (e.g not being forced to define every keys)
2473
- * and at the same the some preserver the augmentation for custom kinds (e.g `liveblocks.config.ts`).
2474
- */
2475
- type DeepPartialWithAugmentation<T> = T extends object ? {
2476
- [P in keyof T]?: T[P] extends {
2477
- [K in NotificationKind]: boolean;
2478
- } ? Partial<T[P]> & {
2479
- [K in keyof DAD]?: boolean;
2480
- } : DeepPartialWithAugmentation<T[P]>;
2481
- } : T;
2482
- /**
2483
- * Partial user notification settings
2484
- * with augmentation preserved gracefully
2485
- */
2486
- type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettings>;
2487
- /**
2488
- *
2489
- * Utility to check if a notification channel settings
2490
- * is enabled for every notification kinds.
2491
- */
2492
- declare function isNotificationChannelEnabled(settings: NotificationChannelSettings): boolean;
2469
+ type LargeMessageStrategy = "default" | "split" | "experimental-fallback-to-http";
2493
2470
 
2494
2471
  interface RoomHttpApi<M extends BaseMetadata> {
2495
2472
  getThreads(options: {
@@ -2666,6 +2643,16 @@ interface RoomHttpApi<M extends BaseMetadata> {
2666
2643
  nonce: string | undefined;
2667
2644
  messages: ClientMsg<P, E>[];
2668
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>;
2669
2656
  }
2670
2657
  interface NotificationHttpApi<M extends BaseMetadata> {
2671
2658
  getInboxNotifications(options?: {
@@ -2695,8 +2682,6 @@ interface NotificationHttpApi<M extends BaseMetadata> {
2695
2682
  markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
2696
2683
  deleteAllInboxNotifications(): Promise<void>;
2697
2684
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2698
- getUserNotificationSettings(): Promise<UserNotificationSettings>;
2699
- updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
2700
2685
  }
2701
2686
  interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
2702
2687
  getUserThreads_experimental(options?: {
@@ -2819,7 +2804,7 @@ declare class MutableSignal<T extends object> extends AbstractSignal<T> {
2819
2804
  mutate(callback?: (state: T) => void | boolean): void;
2820
2805
  }
2821
2806
 
2822
- type OptionalPromise<T> = T | Promise<T>;
2807
+ type Awaitable<T> = T | PromiseLike<T>;
2823
2808
 
2824
2809
  type ResolveMentionSuggestionsArgs = {
2825
2810
  /**
@@ -2986,28 +2971,6 @@ type NotificationsApi<M extends BaseMetadata> = {
2986
2971
  * await client.deleteInboxNotification("in_xxx");
2987
2972
  */
2988
2973
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2989
- /**
2990
- * Gets notifications settings for a user for a project.
2991
- *
2992
- * @example
2993
- * const notificationSettings = await client.getNotificationSettings();
2994
- */
2995
- getNotificationSettings(options?: {
2996
- signal?: AbortSignal;
2997
- }): Promise<UserNotificationSettings>;
2998
- /**
2999
- * Update notifications settings for a user for a project.
3000
- *
3001
- * @example
3002
- * await client.updateNotificationSettings({
3003
- * email: {
3004
- * thread: true,
3005
- * textMention: false,
3006
- * $customKind1: true,
3007
- * }
3008
- * })
3009
- */
3010
- updateNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
3011
2974
  };
3012
2975
  /**
3013
2976
  * @private Widest-possible Client type, matching _any_ Client instance. Note
@@ -3121,22 +3084,24 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
3121
3084
  lostConnectionTimeout?: number;
3122
3085
  backgroundKeepAliveTimeout?: number;
3123
3086
  polyfills?: Polyfills;
3087
+ largeMessageStrategy?: LargeMessageStrategy;
3088
+ /** @deprecated Use `largeMessageStrategy="experimental-fallback-to-http"` instead. */
3124
3089
  unstable_fallbackToHTTP?: boolean;
3125
3090
  unstable_streamData?: boolean;
3126
3091
  /**
3127
3092
  * A function that returns a list of user IDs matching a string.
3128
3093
  */
3129
- resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => OptionalPromise<string[]>;
3094
+ resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => Awaitable<string[]>;
3130
3095
  /**
3131
3096
  * A function that returns user info from user IDs.
3132
3097
  * You should return a list of user objects of the same size, in the same order.
3133
3098
  */
3134
- resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3099
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
3135
3100
  /**
3136
3101
  * A function that returns room info from room IDs.
3137
3102
  * You should return a list of room info objects of the same size, in the same order.
3138
3103
  */
3139
- resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => OptionalPromise<(DRI | undefined)[] | undefined>;
3104
+ resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => Awaitable<(DRI | undefined)[] | undefined>;
3140
3105
  /**
3141
3106
  * Prevent the current browser tab from being closed if there are any locally
3142
3107
  * pending Liveblocks changes that haven't been submitted to or confirmed by
@@ -3247,7 +3212,7 @@ type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
3247
3212
  * A function that returns user info from user IDs.
3248
3213
  * You should return a list of user objects of the same size, in the same order.
3249
3214
  */
3250
- resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3215
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
3251
3216
  };
3252
3217
  declare function isCommentBodyText(element: CommentBodyElement): element is CommentBodyText;
3253
3218
  declare function isCommentBodyMention(element: CommentBodyElement): element is CommentBodyMention;
@@ -3256,7 +3221,7 @@ declare function isCommentBodyLink(element: CommentBodyElement): element is Comm
3256
3221
  * Get an array of each user's ID that has been mentioned in a `CommentBody`.
3257
3222
  */
3258
3223
  declare function getMentionedIdsFromCommentBody(body: CommentBody): string[];
3259
- 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"]>>;
3260
3225
  declare function htmlSafe(value: string): HtmlSafeString;
3261
3226
  declare class HtmlSafeString {
3262
3227
  #private;
@@ -3597,18 +3562,6 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : n
3597
3562
  * Throw an error, but as an expression instead of a statement.
3598
3563
  */
3599
3564
  declare function raise(msg: string): never;
3600
- /**
3601
- * Drop-in replacement for Object.entries() that retains better types.
3602
- */
3603
- declare function entries<O extends {
3604
- [key: string]: unknown;
3605
- }, K extends keyof O>(obj: O): [K, O[K]][];
3606
- /**
3607
- * Drop-in replacement for Object.keys() that retains better types.
3608
- */
3609
- declare function keys<O extends {
3610
- [key: string]: unknown;
3611
- }, K extends keyof O>(obj: O): K[];
3612
3565
  /**
3613
3566
  * Creates a new object by mapping a function over all values. Keys remain the
3614
3567
  * same. Think Array.prototype.map(), but for values in an object.
@@ -3926,4 +3879,4 @@ declare const CommentsApiError: typeof HttpError;
3926
3879
  /** @deprecated Use HttpError instead. */
3927
3880
  declare const NotificationsApiError: typeof HttpError;
3928
3881
 
3929
- 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,
@@ -2404,6 +2420,15 @@ type PrivateRoomApi = {
2404
2420
  }>;
2405
2421
  getTextVersion(versionId: string): Promise<Response>;
2406
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>;
2407
2432
  simulate: {
2408
2433
  explicitClose(event: IWebSocketCloseEvent): void;
2409
2434
  rawSend(data: string): void;
@@ -2441,55 +2466,7 @@ type PartialUnless<C, T> = Record<string, never> extends C ? Partial<T> : [
2441
2466
  type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ? OptionalTuple<T> : [
2442
2467
  C
2443
2468
  ] extends [never] ? OptionalTuple<T> : T;
2444
-
2445
- /**
2446
- * Pre-defined notification channels support list.
2447
- */
2448
- type NotificationChannel = "email" | "slack" | "teams" | "webPush";
2449
- /**
2450
- * `K` represents custom notification kinds
2451
- * defined in the augmentation `ActivitiesData` (e.g `liveblocks.config.ts`).
2452
- * It means the type `NotificationKind` will be shaped like:
2453
- * thread | textMention | $customKind1 | $customKind2 | ...
2454
- */
2455
- type NotificationKind<K extends keyof DAD = keyof DAD> = "thread" | "textMention" | K;
2456
- /**
2457
- * A notification channel settings is a set of notification kinds.
2458
- * One setting can have multiple kinds (+ augmentation)
2459
- */
2460
- type NotificationChannelSettings = {
2461
- [K in NotificationKind]: boolean;
2462
- };
2463
- /**
2464
- * User notification settings are a set of notification channel setting.
2465
- * One channel for one set of settings.
2466
- */
2467
- type UserNotificationSettings = {
2468
- [C in NotificationChannel]: NotificationChannelSettings;
2469
- };
2470
- /**
2471
- * It creates a deep partial specific for `UserNotificationSettings`
2472
- * to offer a nice DX when updating the settings (e.g not being forced to define every keys)
2473
- * and at the same the some preserver the augmentation for custom kinds (e.g `liveblocks.config.ts`).
2474
- */
2475
- type DeepPartialWithAugmentation<T> = T extends object ? {
2476
- [P in keyof T]?: T[P] extends {
2477
- [K in NotificationKind]: boolean;
2478
- } ? Partial<T[P]> & {
2479
- [K in keyof DAD]?: boolean;
2480
- } : DeepPartialWithAugmentation<T[P]>;
2481
- } : T;
2482
- /**
2483
- * Partial user notification settings
2484
- * with augmentation preserved gracefully
2485
- */
2486
- type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettings>;
2487
- /**
2488
- *
2489
- * Utility to check if a notification channel settings
2490
- * is enabled for every notification kinds.
2491
- */
2492
- declare function isNotificationChannelEnabled(settings: NotificationChannelSettings): boolean;
2469
+ type LargeMessageStrategy = "default" | "split" | "experimental-fallback-to-http";
2493
2470
 
2494
2471
  interface RoomHttpApi<M extends BaseMetadata> {
2495
2472
  getThreads(options: {
@@ -2666,6 +2643,16 @@ interface RoomHttpApi<M extends BaseMetadata> {
2666
2643
  nonce: string | undefined;
2667
2644
  messages: ClientMsg<P, E>[];
2668
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>;
2669
2656
  }
2670
2657
  interface NotificationHttpApi<M extends BaseMetadata> {
2671
2658
  getInboxNotifications(options?: {
@@ -2695,8 +2682,6 @@ interface NotificationHttpApi<M extends BaseMetadata> {
2695
2682
  markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
2696
2683
  deleteAllInboxNotifications(): Promise<void>;
2697
2684
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2698
- getUserNotificationSettings(): Promise<UserNotificationSettings>;
2699
- updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
2700
2685
  }
2701
2686
  interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
2702
2687
  getUserThreads_experimental(options?: {
@@ -2819,7 +2804,7 @@ declare class MutableSignal<T extends object> extends AbstractSignal<T> {
2819
2804
  mutate(callback?: (state: T) => void | boolean): void;
2820
2805
  }
2821
2806
 
2822
- type OptionalPromise<T> = T | Promise<T>;
2807
+ type Awaitable<T> = T | PromiseLike<T>;
2823
2808
 
2824
2809
  type ResolveMentionSuggestionsArgs = {
2825
2810
  /**
@@ -2986,28 +2971,6 @@ type NotificationsApi<M extends BaseMetadata> = {
2986
2971
  * await client.deleteInboxNotification("in_xxx");
2987
2972
  */
2988
2973
  deleteInboxNotification(inboxNotificationId: string): Promise<void>;
2989
- /**
2990
- * Gets notifications settings for a user for a project.
2991
- *
2992
- * @example
2993
- * const notificationSettings = await client.getNotificationSettings();
2994
- */
2995
- getNotificationSettings(options?: {
2996
- signal?: AbortSignal;
2997
- }): Promise<UserNotificationSettings>;
2998
- /**
2999
- * Update notifications settings for a user for a project.
3000
- *
3001
- * @example
3002
- * await client.updateNotificationSettings({
3003
- * email: {
3004
- * thread: true,
3005
- * textMention: false,
3006
- * $customKind1: true,
3007
- * }
3008
- * })
3009
- */
3010
- updateNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
3011
2974
  };
3012
2975
  /**
3013
2976
  * @private Widest-possible Client type, matching _any_ Client instance. Note
@@ -3121,22 +3084,24 @@ type ClientOptions<U extends BaseUserMeta = DU> = {
3121
3084
  lostConnectionTimeout?: number;
3122
3085
  backgroundKeepAliveTimeout?: number;
3123
3086
  polyfills?: Polyfills;
3087
+ largeMessageStrategy?: LargeMessageStrategy;
3088
+ /** @deprecated Use `largeMessageStrategy="experimental-fallback-to-http"` instead. */
3124
3089
  unstable_fallbackToHTTP?: boolean;
3125
3090
  unstable_streamData?: boolean;
3126
3091
  /**
3127
3092
  * A function that returns a list of user IDs matching a string.
3128
3093
  */
3129
- resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => OptionalPromise<string[]>;
3094
+ resolveMentionSuggestions?: (args: ResolveMentionSuggestionsArgs) => Awaitable<string[]>;
3130
3095
  /**
3131
3096
  * A function that returns user info from user IDs.
3132
3097
  * You should return a list of user objects of the same size, in the same order.
3133
3098
  */
3134
- resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3099
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
3135
3100
  /**
3136
3101
  * A function that returns room info from room IDs.
3137
3102
  * You should return a list of room info objects of the same size, in the same order.
3138
3103
  */
3139
- resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => OptionalPromise<(DRI | undefined)[] | undefined>;
3104
+ resolveRoomsInfo?: (args: ResolveRoomsInfoArgs) => Awaitable<(DRI | undefined)[] | undefined>;
3140
3105
  /**
3141
3106
  * Prevent the current browser tab from being closed if there are any locally
3142
3107
  * pending Liveblocks changes that haven't been submitted to or confirmed by
@@ -3247,7 +3212,7 @@ type StringifyCommentBodyOptions<U extends BaseUserMeta = DU> = {
3247
3212
  * A function that returns user info from user IDs.
3248
3213
  * You should return a list of user objects of the same size, in the same order.
3249
3214
  */
3250
- resolveUsers?: (args: ResolveUsersArgs) => OptionalPromise<(U["info"] | undefined)[] | undefined>;
3215
+ resolveUsers?: (args: ResolveUsersArgs) => Awaitable<(U["info"] | undefined)[] | undefined>;
3251
3216
  };
3252
3217
  declare function isCommentBodyText(element: CommentBodyElement): element is CommentBodyText;
3253
3218
  declare function isCommentBodyMention(element: CommentBodyElement): element is CommentBodyMention;
@@ -3256,7 +3221,7 @@ declare function isCommentBodyLink(element: CommentBodyElement): element is Comm
3256
3221
  * Get an array of each user's ID that has been mentioned in a `CommentBody`.
3257
3222
  */
3258
3223
  declare function getMentionedIdsFromCommentBody(body: CommentBody): string[];
3259
- 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"]>>;
3260
3225
  declare function htmlSafe(value: string): HtmlSafeString;
3261
3226
  declare class HtmlSafeString {
3262
3227
  #private;
@@ -3597,18 +3562,6 @@ type DistributiveOmit<T, K extends PropertyKey> = T extends any ? Omit<T, K> : n
3597
3562
  * Throw an error, but as an expression instead of a statement.
3598
3563
  */
3599
3564
  declare function raise(msg: string): never;
3600
- /**
3601
- * Drop-in replacement for Object.entries() that retains better types.
3602
- */
3603
- declare function entries<O extends {
3604
- [key: string]: unknown;
3605
- }, K extends keyof O>(obj: O): [K, O[K]][];
3606
- /**
3607
- * Drop-in replacement for Object.keys() that retains better types.
3608
- */
3609
- declare function keys<O extends {
3610
- [key: string]: unknown;
3611
- }, K extends keyof O>(obj: O): K[];
3612
3565
  /**
3613
3566
  * Creates a new object by mapping a function over all values. Keys remain the
3614
3567
  * same. Think Array.prototype.map(), but for values in an object.
@@ -3926,4 +3879,4 @@ declare const CommentsApiError: typeof HttpError;
3926
3879
  /** @deprecated Use HttpError instead. */
3927
3880
  declare const NotificationsApiError: typeof HttpError;
3928
3881
 
3929
- 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 };